# Copilot Instructions ## Build & Test Commands - **Dev server:** `npm run dev` (runs on localhost:3000) - **Build:** `npm run build` (static export to `out/` directory) - **Test all:** `npm test` - **Test single file:** `npx jest __tests__/editor.test.js` or `npx jest components/__tests__/Nav.test.js` - **Test watch:** `npm run test:watch` - **Lint:** `npm run lint` (runs Next.js linter + Prettier check) - **Format:** `npm run format` (Prettier auto-fix) ## Architecture This is a static Next.js app (exported to `out/`) that lets users build README.md files by selecting, editing, and reordering markdown section templates. ### Data flow All state lives in `pages/editor.js` and is passed down via props — there is no global state management library. The key state: - **`templates`** — array of `{ slug, name, markdown }` objects representing all available sections with their current markdown content - **`selectedSectionSlugs`** — ordered array of slug strings the user has added to their readme - **`focusedSectionSlug`** — which section is currently being edited - **`sectionSlugs`** — slugs not yet added (the "available" pool) User edits persist to `localStorage` via the `useLocalStorage` hook (key: `readme-backup`), which debounces saves by 1 second. The selected section list is also stored in `localStorage` under `current-slug-list`. ### Section templates Defined in `data/section-templates-{locale}.js` as exported arrays of `{ slug, name, markdown }` objects. The `data/index.js` file maps locale keys to template sets, though the editor currently hardcodes `en_EN`. Custom sections get a slug prefixed with `custom-` (e.g., `custom-my-section`). This prefix is checked when resetting a section to distinguish custom from built-in templates. ### Three-column layout 1. **SectionsColumn** (left) — lists selected sections (drag-to-reorder via `@dnd-kit`) and available sections to add 2. **EditorColumn** (center) — Monaco editor on desktop, `