feat: Phase 3 compile directory bundle - #7
Merged
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.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.
Phase 3: interfacectl compile directory bundle
Strategy check
What changed
interfacectl compile --contract <path> --out <dir> [--schema <path>] [--format json].manifest.json(bundleVersion, contractId, contractVersion, schemaVersion, tool, inputs, files with sha256 sorted by path)contract.normalized.json(stable key ordering, same information as source)surfaces/<surfaceId>.jsonper surfaceconstraints/motion.jsonwhen motion existsWhy it matters
Contract and enforcement notes
gatecommand.Tests
Phase 3 acceptance criteria (docs/plans/phase-3-compile-directory-bundle.md)
interfacectl compile --contract <fixture> --out <tmpdir>creates manifest.json, contract.normalized.json, surfaces/.json for each surface, constraints/motion.json when motion exists.fileslist includes sha256 for every file except manifest itself, sorted by path.Determinism and schema stability verification
schemaVersion
schemaVersionis a fixed constant in code:"surfaces.web.contract@1". It is not read from the schema file, filesystem, or environment.--schema,inputs.schemaPathrecords it;schemaVersioncontinues to denote the bundled contract schema format. Fixture and expected manifest use this constant.JSON stringify behavior
sortKeysRecursivebeforeJSON.stringify(..., null, 2). Ensures stable key order across runs.allowedFonts,requiredSections,allowedDurationsMs) is done innormalizeContract()by documented semantic rule (those fields are set-like in the contract schema), not in the stringify helper.JSON.stringify(..., null, 2)plus a single trailing newline. Stable and consistent.writeAtomic(the same content written to disk). No separate read-back; hash matches file bytes.Review checklist (from plan)