Skip to content

[recipes] repo-learning-coach: load .env via dotenv + fix research frontmatter - #446

Open
eazene wants to merge 1 commit into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/repo-learning-coach-env-fix
Open

[recipes] repo-learning-coach: load .env via dotenv + fix research frontmatter#446
eazene wants to merge 1 commit into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/repo-learning-coach-env-fix

Conversation

@eazene

@eazene eazene commented Jul 13, 2026

Copy link
Copy Markdown

What & why

The repo-learning-coach recipe documents a .env workflow (Step 2: copy .env.example, fill in Supabase + OpenRouter credentials) but the app never loaded .env. Following the README as written, npm run sync and npm run dev both fail immediately:

Error: Missing required environment variable: SUPABASE_URL

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

  • Add dotenv as a dependency and import 'dotenv/config' as the first import in the two server entry points (server/index.ts, server/sync-content.ts). Placed first so .env is loaded before server/supabase.ts reads process.env at module-init time. The client half (Vite) already loads .env on its own; this only affects the Node server process.
  • Quote two research/*.md frontmatter summary: values that contained unquoted colons ("...the recipe: a local...", "...plain files: one config file..."). Unquoted colons are parsed as YAML mappings, which broke npm run sync with an "incomplete explicit mapping pair" error.

Testing

On a fresh .env (from .env.example) against an existing Open Brain Supabase project:

  • npm run syncSynced 3 lessons and 3 research documents.
  • npm run dev → server GET /api/bootstrap returns HTTP 200 with the project + 3 lessons; Vite client returns HTTP 200.

No schema or app-logic changes; the core thoughts table is untouched.

🤖 Generated with Claude Code

…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
@github-actions github-actions Bot added the recipe Contribution: step-by-step recipe label Jul 13, 2026
@github-actions

Copy link
Copy Markdown

OB1 PR Gate

Folder structure — All files are in allowed directories
Required files — README.md and metadata.json found in all contribution folders
Metadata valid — All metadata.json files passed JSON Schema validation
No credentials — No API keys, tokens, or secrets detected
SQL safety — No destructive SQL or core table modifications
Category artifacts — Required file types present for each category
PR format — Title follows [category] Description format
No binary blobs — No oversized or binary files
README completeness — All READMEs include Prerequisites, Steps, and Expected Outcome
Contribution dependencies — All declared skill and primitive dependencies exist and are linked in README
LLM clarity review — Covered by Claude PR Review workflow
Remote MCP pattern — No local MCP server patterns detected — uses remote MCP correctly
Tool audit link — Extensions/integrations link to the MCP Tool Audit guide
Scope check — All changes are within the contribution folder(s)
Internal links — All relative links in READMEs resolve to existing files

Result: All 15 checks passed! Ready for human review.


Post-Merge Tasks

These don't block merge — they're reminders for admins after this PR lands.

  • Add Repo Learning Coach to recipes/README.md
  • Add Repo Learning Coach to root README.md community contributions section
  • Post in OB1 Discord #show-and-tell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recipe Contribution: step-by-step recipe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant