[recipes] repo-learning-coach: load .env via dotenv + fix research frontmatter - #446
Conversation
…ontmatter The recipe documents a `.env` workflow (copy .env.example, fill in credentials) but never loaded it, so `npm run sync` and `npm run dev` failed with "Missing required environment variable: SUPABASE_URL". - Add `dotenv` dependency and `import 'dotenv/config'` at the top of the server entry points (server/index.ts, server/sync-content.ts) so the documented .env workflow works without extra flags. - Quote two research frontmatter `summary:` values that contained unquoted colons, which broke YAML parsing during `npm run sync`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH
OB1 PR Gate✅ Folder structure — All files are in allowed directories Result: All 15 checks passed! Ready for human review. Post-Merge TasksThese don't block merge — they're reminders for admins after this PR lands.
|
What & why
The repo-learning-coach recipe documents a
.envworkflow (Step 2: copy.env.example, fill in Supabase + OpenRouter credentials) but the app never loaded.env. Following the README as written,npm run syncandnpm run devboth fail immediately:There was no
dotenv, no--env-file, and Node does not auto-load.env, so the server process (tsx server/index.ts) started with an empty environment.Changes
dotenvas a dependency andimport 'dotenv/config'as the first import in the two server entry points (server/index.ts,server/sync-content.ts). Placed first so.envis loaded beforeserver/supabase.tsreadsprocess.envat module-init time. The client half (Vite) already loads.envon its own; this only affects the Node server process.research/*.mdfrontmattersummary:values that contained unquoted colons ("...the recipe: a local...","...plain files: one config file..."). Unquoted colons are parsed as YAML mappings, which brokenpm run syncwith an "incomplete explicit mapping pair" error.Testing
On a fresh
.env(from.env.example) against an existing Open Brain Supabase project:npm run sync→Synced 3 lessons and 3 research documents.npm run dev→ serverGET /api/bootstrapreturns HTTP 200 with the project + 3 lessons; Vite client returns HTTP 200.No schema or app-logic changes; the core
thoughtstable is untouched.🤖 Generated with Claude Code