feat(spec): v0.3 four-property schema with gsd-plugin alignment#1
Merged
Conversation
Aligns schema/v1.json with gsd-plugin v2.42.3 read paths: - generated.frameworkManifest (framework detection) - generated.fileIndex (per-file fragility + attribution counts) - manual.fragileFiles (human-annotated fragile files) - manual.coChangePatterns (human-annotated co-change observations) Adds examples/ directory with minimal, populated, and manual-block examples. Corrects canonical write path to .agents/agents.workspace.json. All examples validate against the updated schema.
There was a problem hiding this comment.
Pull request overview
Updates the @workspacejson/spec JSON Schema to the proposed v0.3 “four-property” document shape (manual, generated, agents, health) and adds example v0.3 documents, with corresponding release notes and a small package-metadata test adjustment.
Changes:
- Rewrites
schema/v1.jsonto the v0.3 structure withgenerated.specVersionconst-locked to"0.3". - Adds three v0.3 example JSON documents under
packages/spec/examples/. - Adds a
0.3.0changelog entry and updates package metadata assertions in tests.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/schema/v1.json | Replaces the previous schema with a new v0.3 four-block schema layout and updated field locations. |
| packages/spec/examples/minimal-v0.3.json | Adds a minimal v0.3 example document. |
| packages/spec/examples/populated-v0.3.json | Adds a more complete v0.3 example document showing framework/fileIndex usage. |
| packages/spec/examples/with-manual-block-v0.3.json | Adds an example demonstrating the manual block (fragile files and co-change patterns). |
| packages/spec/CHANGELOG.md | Documents a 0.3.0 breaking-change release and migration notes. |
| packages/agents-audit/src/package-metadata.test.ts | Adjusts package metadata expectations (repository directory and package versions). |
Comments suppressed due to low confidence (4)
packages/spec/schema/v1.json:22
manual.fragileFiles[]entries don’t require apath(and allow arbitrary keys), so{}is currently valid even though it’s not meaningful. Consider addingrequired: ["path"](and likelyadditionalProperties: false) on the item schema to enforce minimally useful entries and generate stronger TypeScript types.
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"reason": { "type": "string" }
}
}
packages/spec/schema/v1.json:56
generated.frameworkManifest[]items definename/version/confidencebut don’t mark any of them as required, so objects like{}validate. If these are intended to be real detections, consider requiring at leastnameandconfidence(and possiblyadditionalProperties: false) to keep validation and generated types aligned with the documented shape.
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"version": { "type": "string" },
"confidence": { "type": "number", "minimum": 0, "maximum": 1 }
}
}
packages/spec/CHANGELOG.md:25
- The migration guidance says “Fall back to v0.1 shape if
specVersionis absent”, but the immediately preceding releases in this repo are0.2.xand also used a different top-level versioning approach. Consider updating this guidance to reference the actual legacy shape(s) (e.g., v0.2) so consumers migrate correctly.
### Migration
Check `generated.specVersion === "0.3"` to detect v0.3 documents. Fall back to v0.1 shape if `specVersion` is absent.
packages/spec/CHANGELOG.md:21
- The changelog says the package now includes an
examples/directory, butpackages/spec/package.json’sfileswhitelist currently excludesexamples, so these JSON files won’t be published to npm. Either addexamplesto the publishedfileslist or adjust the release notes to match what will actually ship.
### Added
- `examples/` directory with minimal, populated, and with-manual-block example files.
- `validate()` and `validateLegacy()` exports in `src/index.ts`.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+4
| "$id": "https://workspacejson.dev/schemas/v1.json", | ||
| "title": "workspace.json v0.3", |
…0.3.0 - WorkspaceJsonV3, FrameworkEntry, FileIndexEntry, IntelligenceState types - validate(): structural guard for v0.3 four-property shape - validateLegacy(): accepts v0.1 docs (top-level version string, no specVersion) - version constant exported as '0.3.0' - 10/10 tests pass
- schema/v1.json: $id was 'schemas/v1.json' (wrong); restored to canonical 'schemas/agents.workspace.v1.json' to match historical naming and prevent tooling breakage on schema identity - schema/v1.json: title was 'workspace.json v0.3' (wrong); restored to 'agents.workspace.json' consistent with schema.ts and package description - package-metadata.test.ts: version pin updated 0.2.0 → 0.3.0 to match the version bump in this release Findings from Copilot PR review on #1.
…+ invariant tests
Root cause of the recurring $id 404: the URL was defined in three places
(schema/v1.json, src/schema.ts, the live website) with no automated check
that they agree. This commit fixes the split-brain and adds a test suite
that will fail CI on any future drift.
Changes:
- schema/v1.json: $id fixed (schemas/agents.workspace.v1.json → canonical)
$schema fixed (http draft-07 → https draft-2020, matches site)
- src/schema.ts: $id fixed (same wrong value → canonical)
- src/index.test.ts: 5 new invariant tests:
1. TypeScript const $id == CANONICAL_ID
2. schema/v1.json $id == CANONICAL_ID
3. TS const == JSON file (no split-brain)
4. CHANGELOG top version == package.json version
5. $schema uses https (not http)
CANONICAL_ID = 'https://www.workspacejson.dev/schema/v1.json'
This constant is the single source of truth. Fix the source, not the test.
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
schema/v1.jsonto the v0.3 four-property shape:manual,generated,agents,healthgenerated.specVersionconst-locked to"0.3", withfileIndexandframeworkManifestas canonical gsd-plugin v2.42.3 read pathsmanual.fragileFilesandmanual.coChangePatternsare the two manual-side gsd-plugin read paths.agents/agents.workspace.json(v0.2.0 incorrectly stated repo root)minimal-v0.3.json,populated-v0.3.json,with-manual-block-v0.3.jsonBreaking changes
generated.files→generated.fileIndex; top-levelversion→generated.specVersion.agents/agents.workspace.jsonTest plan
pnpm --filter @workspacejson/spec exec vitest runpassesvalidate()export accepts all three new example filesvalidateLegacy()gracefully rejects v0.3 documents (returns false, no throw)src/index.tsexports and bumps to 0.3.0