feat(config): zod-validated YAML config loader#1
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/config.tswith a strict zod schema forverifications.yaml: snowflake IDs, valid cron, unique verification names, no unknown fields. Two exports:parseConfig(yamlString)andloadConfig(path).src/index.tsso the bot fails fast and prints a summary on startup.rootDirout of the basetsconfig.json(it was preventingtest/**/*from typechecking) intotsconfig.build.json.Implements step 2 of
docs/exec-plans/v1.md.Test plan
pnpm test— 8 unit tests intest/config.test.ts(valid parse, defaults, snowflake/cron/strict validation, duplicate-name detection)pnpm lint,pnpm typecheck,pnpm buildcleanpnpm exec tsx src/index.tsagainst the example config prints the parsed verifications and exits 0🤖 Generated with Claude Code