This repository was archived by the owner on Oct 5, 2026. It is now read-only.
Repository navigation
feat: add .svp manifest.json with schema versioning and auto-migration - #12
Merged
Merged
Conversation
Introduces a manifest.json file in .svp/ to track schema and forge versions, enabling forward-compatible schema evolution with automatic migration when users upgrade forge. - Add manifest.ts with SCHEMA_VERSION, read/write, compatibility check - Add migrate.ts with sequential migration runner and registry - Write manifest.json during forge init - Guard all CLI commands that read .svp/ with checkCompatibility() - Auto-create manifest for legacy projects missing manifest.json - Error on downgrade (manifest schema > current forge schema) - Add 13 tests for manifest and migration logic
There was a problem hiding this comment.
Pull request overview
Adds a new .svp/manifest.json mechanism to track schema/forge versions, introduces a migration runner for future schema upgrades, and wires compatibility checks into CLI paths that read .svp/ data.
Changes:
- Introduce
.svp/manifest.jsonsupport with schema version checks and upgrade hooks. - Add a sequential migration runner + registry scaffold for schema major upgrades.
- Add
checkCompatibility()calls in CLI loaders/commands prior to reading.svp/data.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/migrations/index.ts | Adds migration registry scaffold (currently empty). |
| packages/core/migrate.ts | Implements sequential migration runner (runMigrations). |
| packages/core/migrate.test.ts | Adds basic tests for no-op and missing-migration behavior. |
| packages/core/manifest.ts | Implements manifest read/write, schema compatibility checks, and auto-create/migrate logic. |
| packages/core/manifest.test.ts | Adds unit tests for manifest creation, compatibility, and downgrade detection. |
| packages/core/init.ts | Writes .svp/manifest.json during initialization. |
| packages/core/index.ts | Exports new manifest + migration APIs from core package entrypoint. |
| packages/cli/load.ts | Runs compatibility checks before loading .svp/ layers. |
| packages/cli/commands/view.ts | Adds compatibility check inside loadAll() helper used by some subcommands. |
| packages/cli/commands/rehash.ts | Guards rehash command with checkCompatibility(). |
| packages/cli/commands/link.ts | Guards link command with checkCompatibility(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+30
to
+31
| const m = /^(\d+)/.exec(version); | ||
| return m ? Number(m[1]) : 0; |
| root: string, | ||
| fromMajor: number, | ||
| toMajor: number, | ||
| ): Promise<void> { |
| @@ -0,0 +1,120 @@ | |||
| import { mkdir, readFile, rm, writeFile } from "node:fs/promises"; | |||
Comment on lines
24
to
33
| /** 从 .svp/ 加载所有层数据 */ | ||
| async function loadAll(root: string): Promise<{ | ||
| l5: L5Blueprint | undefined; | ||
| l4Flows: L4Artifact[]; | ||
| l3Blocks: L3Block[]; | ||
| l2Blocks: L2CodeBlock[]; | ||
| }> { | ||
| await checkCompatibility(root); | ||
| const l5 = (await readL5(root)) ?? undefined; | ||
|
|
Comment on lines
+36
to
+40
| try { | ||
| const content = await readFile(manifestPath(root), "utf8"); | ||
| return JSON.parse(content) as Manifest; | ||
| } catch { | ||
| return null; |
Comment on lines
+44
to
+47
| /** Write manifest.json */ | ||
| export async function writeManifest(root: string, manifest: Manifest): Promise<void> { | ||
| await writeFile(manifestPath(root), JSON.stringify(manifest, null, 2) + "\n", "utf8"); | ||
| } |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
.svp/manifest.json(created duringforge init) to trackschemaVersionandforgeVersion, enabling forward-compatible schema evolutionmigrate.ts) with a sequential chain pattern for future schema upgrades (v1→v2→v3…).svp/withcheckCompatibility()— auto-creates manifest for legacy projects, errors on downgradeTest plan
forge initcreates.svp/manifest.jsonwith correctschemaVersion: 1.0.0and currentforgeVersion.svp/without manifest gets auto-upgraded (legacy project support)