Skip to content

Commit e0842ed

Browse files
committed
refactor: Restructure training examples pipeline and remove automatic Firestore updates
- Add download-training-examples.ts script to fetch examples from Firestore - Replace update-embeddings.ts with update-embeddings-from-md.ts for markdown-based processing - Remove automatic Firestore writes from code-generation-service: - Remove addTrainingExample() exported function - Remove storeSuccessfulGeneration() function and all its calls - Firestore updates now only via explicit scripts (no automatic writes) - Standardize on "lang" field name (was inconsistently "language" in some places) - Update embedding-service vectorSearch to filter by "lang" field - Transform retrieved examples to match new standardized format with proper field mapping - Update training markdown files with improved structure - Add new npm scripts: download-training-examples, update-embeddings-from-md BREAKING: Removed addTrainingExample() export from code-generation-service
1 parent 9e746f7 commit e0842ed

10 files changed

Lines changed: 1805 additions & 3149 deletions

AGENTS.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
11
# Repository Guidelines
22

33
## 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).
99

1010
## 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.
1313
- `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).
1515
- `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*`).
1818

1919
## 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.
2526

2627
## 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)`.
2931

3032
## 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.
3436

3537
## 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.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"start": "cross-env NODE_NO_WARNINGS=1 next start",
1414
"lint": "next lint",
1515
"lint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
16-
"typecheck": "tsc"
16+
"typecheck": "tsc",
17+
"download-training-examples": "node --experimental-strip-types scripts/download-training-examples.ts",
18+
"update-embeddings": "node --experimental-strip-types scripts/update-embeddings.ts --collection training_examples",
19+
"update-embeddings-from-md": "node --experimental-strip-types scripts/update-embeddings-from-md.ts"
1720
},
1821
"dependencies": {
1922
"@codemirror/autocomplete": "^6.18.6",

0 commit comments

Comments
 (0)