feat: resolve and validate plugin config #11

Merged
haylan merged 1 commits from feat/config into main 2026-10-03 17:09:23 +00:00
Owner

Step 2 (part 1) of the build order in docs/spec.md: src/config.ts with tests, written test-first.

  • resolveConfig(options, env): option > env > default for baseURL (CRW_API_URL, default http://localhost:3000) and apiKey (CRW_API_KEY); limit default 8 clamped to 1..20; lang; tbs enum
  • Blank strings count as unset; trailing slashes are stripped
  • Bad baseURL/tbs or non-string lang/apiKey throw naming the option; apiKey errors never echo the value; limit never throws
  • 11 tests (node --test); npm run check passes

🤖 Generated with Claude Code

Step 2 (part 1) of the build order in `docs/spec.md`: `src/config.ts` with tests, written test-first. - `resolveConfig(options, env)`: option > env > default for `baseURL` (`CRW_API_URL`, default `http://localhost:3000`) and `apiKey` (`CRW_API_KEY`); `limit` default 8 clamped to 1..20; `lang`; `tbs` enum - Blank strings count as unset; trailing slashes are stripped - Bad `baseURL`/`tbs` or non-string `lang`/`apiKey` throw naming the option; `apiKey` errors never echo the value; `limit` never throws - 11 tests (`node --test`); `npm run check` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
haylan added 1 commit 2026-10-03 17:07:41 +00:00
haylan merged commit b80b7eb87d into main 2026-10-03 17:09:23 +00:00
haylan deleted branch feat/config 2026-10-03 17:09:23 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/fastcrw-opencode-websearch#11