feat: schema export + preset snapshot tests (#72, #80)#100
Merged
Conversation
- Add `forge schema` command that outputs full JSON Schema derived from MonitorForgeConfigSchema via zod-to-json-schema - Support `forge schema <section>` to filter by sub-schema (sources, panels, map, etc.) - Add preset snapshot tests that validate all 15 presets parse correctly through MonitorForgeConfigSchema and snapshot the results - Install zod-to-json-schema as dev dependency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add unit tests for all valid sections, invalid section error handling, and _note field presence. Replace direct property mutation with object spread when injecting _note into JSON Schema output. Co-Authored-By: Claude Sonnet 4.6 <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
forge schemacommand (feat: forge schema command (Zod to JSON Schema introspection) #72): Outputs full JSON Schema derived fromMonitorForgeConfigSchemaviazod-to-json-schema. Supportsforge schema <section>to filter by sub-schema (e.g.,sources,panels,map). Includes_notefield documenting that Zod.refine()validators are not represented in JSON Schema output.MonitorForgeConfigSchema.parse()and snapshots the results. Catches schema drift and preset corruption by verifyingversionand_metafields on every preset.zod-to-json-schemaas a dev dependency.Verified
forge schemaoutputs valid JSON Schema withversionfieldforge schema sourcescorrectly filters to the sources sub-schemanpx vitest run forge/passes (405 tests, 0 failures)npx tsc --noEmithas zero errorsTest plan
npx tsx forge/bin/forge.ts schema --format jsonoutputs full JSON Schemanpx tsx forge/bin/forge.ts schema sources --format jsonoutputs sources sub-schema onlynpx tsx forge/bin/forge.ts schema invalid-sectionreturns structured errornpx vitest run forge/src/presetspasses all snapshot tests🤖 Generated with Claude Code