Skip to content

feat(config): zod-validated YAML config loader#1

Merged
mortik merged 2 commits into
mainfrom
feat/config-loader
May 26, 2026
Merged

feat(config): zod-validated YAML config loader#1
mortik merged 2 commits into
mainfrom
feat/config-loader

Conversation

@mortik
Copy link
Copy Markdown
Member

@mortik mortik commented May 26, 2026

Summary

  • Adds src/config.ts with a strict zod schema for verifications.yaml: snowflake IDs, valid cron, unique verification names, no unknown fields. Two exports: parseConfig(yamlString) and loadConfig(path).
  • Wires the loader into src/index.ts so the bot fails fast and prints a summary on startup.
  • Moves rootDir out of the base tsconfig.json (it was preventing test/**/* from typechecking) into tsconfig.build.json.

Implements step 2 of docs/exec-plans/v1.md.

Test plan

  • pnpm test — 8 unit tests in test/config.test.ts (valid parse, defaults, snowflake/cron/strict validation, duplicate-name detection)
  • pnpm lint, pnpm typecheck, pnpm build clean
  • Manual smoke: pnpm exec tsx src/index.ts against the example config prints the parsed verifications and exits 0

🤖 Generated with Claude Code

mortik and others added 2 commits May 26, 2026 14:53
Loads verifications.yaml and validates it with a strict zod schema:
snowflake-format Discord IDs, valid cron expression, no duplicate
verification names, no unknown fields. Wires the loader into the entry
point so the bot fails fast on bad config.

Also moves rootDir out of the base tsconfig (it was preventing
test/**/* from typechecking) and into tsconfig.build.json where it
actually matters.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The initial scaffold's example config, tests, and exec-plan used the
real Fleetyards guild/channel/message/role IDs. These aren't secrets,
but examples in a public repo should be obviously synthetic so readers
don't mistake them for required values.

Note: the real IDs remain in this branch's earlier commits and on main.
Not rewriting history since Discord snowflakes are public.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mortik mortik merged commit 5439c53 into main May 26, 2026
1 check passed
@mortik mortik deleted the feat/config-loader branch May 26, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant