|
1 | 1 | # Repository Guidelines |
2 | 2 |
|
3 | 3 | ## Project Structure & Module Organization |
4 | | -- `src/pages/`: Next.js routes and API handlers (`src/pages/api`). |
5 | | -- `src/components/`: React UI components; `src/hooks/` custom hooks. |
6 | | -- `src/lib/` core services (auth, API, embeddings); `src/utils/` helpers. |
7 | | -- `src/styles/` global and editor styles; `public/` static assets. |
8 | | -- `docs/`, `scripts/` (utility scripts), `training/` (example and data assets). |
| 4 | +- `src/pages/`: Next.js routes and API (`src/pages/api`). |
| 5 | +- `src/components/`: React components; `src/hooks/` custom hooks. |
| 6 | +- `src/lib/`: Core services (auth, API, embeddings); `src/utils/` helpers. |
| 7 | +- `src/styles/`: Global/editor styles; `public/`: static assets. |
| 8 | +- `docs/`, `scripts/` (utility scripts), `training/` (examples/data). |
9 | 9 |
|
10 | 10 | ## Build, Test, and Development Commands |
11 | | -- `npm run dev`: Start the Next.js dev server on `http://localhost:3000`. |
12 | | -- `npm run build`: Create a production build. |
| 11 | +- `npm run dev`: Start dev server at `http://localhost:3000`. |
| 12 | +- `npm run build`: Create production build. |
13 | 13 | - `npm run start`: Serve the production build. |
14 | | -- `npm run lint` / `npm run lint:fix`: Lint (and auto-fix) the codebase. |
| 14 | +- `npm run lint` / `npm run lint:fix`: Lint the codebase (and auto-fix). |
15 | 15 | - `npm run typecheck`: Run TypeScript checks. |
16 | | -- `npm run refresh`: Install local `graffiticode-*.tgz` language packages (dev convenience). |
17 | | -- Requirements: Node `>=18.17`. Environment vars via `.env.local` (see `.env*` for hints). |
| 16 | +- `npm run refresh`: Install local `graffiticode-*.tgz` language packages. |
| 17 | +- Requirements: Node `>=18.17`. Configure env in `.env.local` (see `.env*`). |
18 | 18 |
|
19 | 19 | ## Coding Style & Naming Conventions |
20 | | -- Language: TypeScript, React 18, Next.js 15, TailwindCSS for styling. |
21 | | -- Linting: ESLint (extends `next` and `next/core-web-vitals`). Keep code lint‑clean and type‑safe. |
22 | | -- Indentation: 2 spaces; prefer concise, functional components and hooks. |
23 | | -- Naming: PascalCase for React components/files in `src/components` (e.g., `NewAPIKeyDialog.tsx`); camelCase for variables/functions; lower-case file names for pages (e.g., `src/pages/items.tsx`). |
24 | | -- Styling: Prefer Tailwind utility classes; group related classes logically. |
| 20 | +- Language: TypeScript, React 18, Next.js 15; TailwindCSS for styling. |
| 21 | +- Linting: ESLint (extends `next`, `next/core-web-vitals`). Keep lint- and type-clean. |
| 22 | +- Indentation: 2 spaces; prefer concise functional components and hooks. |
| 23 | +- Naming: PascalCase for components in `src/components` (e.g., `NewAPIKeyDialog.tsx`); |
| 24 | + camelCase for variables/functions; page files lower-case in `src/pages` (e.g., `items.tsx`). |
| 25 | +- Styling: Use Tailwind utility classes; group related utilities logically. |
25 | 26 |
|
26 | 27 | ## Testing Guidelines |
27 | | -- No formal test runner is configured. When adding complex logic, include lightweight component or unit tests (e.g., Jest + React Testing Library) in the PR if feasible. |
28 | | -- At minimum, ensure `npm run lint` and `npm run typecheck` pass and exercise critical paths manually. |
| 28 | +- No formal runner configured. For complex logic, include lightweight Jest + RTL tests in PRs if feasible. |
| 29 | +- Minimum bar: `npm run lint` and `npm run typecheck` must pass; manually exercise critical paths. |
| 30 | +- Place component/unit tests near sources or under `__tests__` when added; name files `*.test.ts(x)`. |
29 | 31 |
|
30 | 32 | ## Commit & Pull Request Guidelines |
31 | | -- Commits: Use clear, imperative messages (e.g., "fix: address build error", "feat: add editor timeline"). Keep changes focused. |
32 | | -- PRs: Provide a summary, linked issues, screenshots/GIFs for UI changes, and steps to verify locally. |
33 | | -- Checks: PRs should be lint-clean, type-clean, and build successfully. Note any config or data prerequisites. |
| 33 | +- Commits: Clear, imperative messages (e.g., `fix: address build error`, `feat: add editor timeline`). Keep changes focused. |
| 34 | +- PRs: Provide a summary, linked issues, and screenshots/GIFs for UI changes. Include steps to verify locally and any config/data prerequisites. |
| 35 | +- Checks: PRs should lint, typecheck, and build successfully. |
34 | 36 |
|
35 | 37 | ## Security & Configuration Tips |
36 | | -- Store secrets in `.env.local` (do not commit). Typical keys: NextAuth secret/URL, Stripe keys, provider credentials. Client-side Firebase config is embedded; server credentials must remain private. |
37 | | -- Avoid logging secrets; scrub PII in debug output. |
| 38 | +- Store secrets in `.env.local` only. Typical keys: NextAuth secret/URL, Stripe, provider creds. |
| 39 | +- Avoid logging secrets; scrub PII in debug output. Client-side Firebase config is public; server creds must remain private. |
0 commit comments