feat: validate kiqr.yaml and config.yaml with zod schemas - #11
Merged
Conversation
Replace the unsafe `YAML.parse(content) as ProjectConfig` / `as LocalConfig` casts in src/lib/config.ts with zod schema parsing. A malformed or hand-edited config now produces a clear, actionable error naming the file and the offending field (e.g. "kiqr.yaml is invalid: name: ...") instead of a cryptic downstream crash, and invalid YAML reports "<file> is not valid YAML: <detail>". The schemas are constrained to the existing interfaces in src/types/config.ts via `satisfies z.ZodType<...>`, so the public TS types and all their imports are unchanged. Adds tests covering valid parse, missing required field, wrong field type, and malformed YAML for both config files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kjellbergzoey
added a commit
to kjellbergzoey/cli
that referenced
this pull request
Jun 7, 2026
Adds @biomejs/biome with a project config (biome.json): 2-space indent, single quotes, no bracket spacing, organize-imports, recommended lint rules (with a few project-specific rules disabled where they clash with the strict tsconfig or Ink/React patterns). Adds 'lint' and 'format' npm scripts and a dedicated lint job in CI. The large diff is the one-time 'biome check --write' format pass over the existing codebase. Two lint fixes beyond formatting: a string-concat -> template literal in db/list.tsx, and an empty destructure pattern in wp.tsx. Rebuilt on current main (post kiqr#11-kiqr#16) to resolve merge conflicts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kjellberg
pushed a commit
that referenced
this pull request
Jun 7, 2026
Adds @biomejs/biome with a project config (biome.json): 2-space indent, single quotes, no bracket spacing, organize-imports, recommended lint rules (with a few project-specific rules disabled where they clash with the strict tsconfig or Ink/React patterns). Adds 'lint' and 'format' npm scripts and a dedicated lint job in CI. The large diff is the one-time 'biome check --write' format pass over the existing codebase. Two lint fixes beyond formatting: a string-concat -> template literal in db/list.tsx, and an empty destructure pattern in wp.tsx. Rebuilt on current main (post #11-#16) to resolve merge conflicts. Co-authored-by: kjellbergzoey <kjellbergzoey@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <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
Replaces the unsafe
YAML.parse(content) as ProjectConfig/as LocalConfigcasts insrc/lib/config.tswith zod schema parsing (zodis already a dependency).A malformed or hand-edited
kiqr.yaml/config.yamlnow fails fast with a clear, actionable message instead of crashing somewhere downstream:kiqr.yaml is invalid: name: ...(file + field named)config.yaml is not valid YAML: <detail>Details
src/types/config.tsviasatisfies z.ZodType<ProjectConfig>/<LocalConfig>. This keeps the public TS types and every import of them unchanged, and thesatisfiescheck guarantees the schemas stay in sync with the types at compile time.Tests
Adds coverage in
tests/lib/config.test.ts:kiqr.yamlandconfig.yamlnpm run typecheck,npm test(75 passing), andnpm run buildall green.🤖 Generated with Claude Code