Framework Upgrades
npx spine-framework upgrade syncs a project's framework-owned files to the spine-framework version installed in node_modules (.framework/cli/commands/upgrade.ts). It is a file sync with an integrity gate, not a git operation — and the executing copy is always the new package's code, since npx resolves node_modules.
What is sealed
The frozen manifest .spine-manifest.json (written by init, regenerated by upgrade) records a sha256 for every file under the protected trees — .framework/, config/, scripts/, plus bin/ (scripts/checksum-manifest.mts, PROTECTED_DIRS + --include-dir bin). The file set itself is declared by .framework/templates/project.json (framework_dirs, framework_files, config_files, root_scripts, bin).
Also recorded in the manifest: framework_version, framework_dependencies (so the package.json merge knows which deps the framework owns), a tree_digest, and a separate agent_files hash map (more below). npm run verify re-hashes the tree and fails on drift; SPINE_INTEGRITY=warn downgrades that to warnings.
The integrity gate
Before writing anything, upgrade re-hashes every manifest entry:
- Any modified or missing protected file → abort with a per-file list. The only way through is
--force, which overwrites modified files and restores missing ones (each is logged). - This is the safety rail: overwriting
.framework/loses nothing the user owned, because the gate proves they never changed it. Never edit sealed trees — the change is either blocked or silently reverted later. --dry-runcomputes the full report (added / changed / removed / agent assets / new migrations) and writes nothing.
What an upgrade does, in order
- Preconditions: refuses to run from the vendored copy (
package.jsonnamemust bespine-framework), requires.spine-manifest.json, and refuses to downgrade (cmpSemveronframework_version). - Integrity gate (above).
- Collects the new file set, then applies copies; deletions are confined to
.framework/— files outside it that upstream dropped are warned about and left in place. - Syncs agent assets (below).
- Merges
package.json: framework scripts and the dependency set are rewritten,spine-frameworkpinned exactly; a dependency is removed only if the previous framework version owned it and the new one doesn't. Customer scripts/deps survive. - Re-renders
netlify.toml: framework blocks come from the package;[functions."custom_*"]sections in the existing file (with their attached comments) are re-appended verbatim — that's where app-owned scheduled functions live. A changed render leavesnetlify.toml.bak. - Regenerates
.spine-manifest.jsonat the new version. - Lists new
.framework/migrations/*.sqlfiles — reported, never run.npx spine-framework migrateapplies them.
Agent files merge behavior
profile.agent_files (.framework/templates/project.json) declares two merge modes, applied by syncAgentFiles in .framework/cli/lib/project-files.ts:
framework-block→AGENTS.md. The template renders{{SPINE_VERSION}}, then the marker-delimited block —<!-- spine-framework:begin version=X.Y.Z -->…<!-- spine-framework:end -->— is replaced in place. Everything outside the markers is customer content and is preserved. A file with no markers gets the block prepended (never overwritten). Hashes go into the manifest'sagent_filesmap — deliberately notfiles, so edits outside the markers don't count as drift.dir-replace→.devin/skills. Onlyspine-*subdirectories are removed and re-copied from the package. Sibling dirs with any other name are customer-owned and untouched.
What upgrade never touches
custom/, spine.config.json, .env, .spine/, netlify.toml [functions."custom_*"] sections, and the customer-owned parts of AGENTS.md / .devin/skills. If a run would destroy your work, the design has failed — that is the promise the sealed layer exists to keep (see Core vs Custom Boundary).
Upgrade checklist
- [ ]
npm run verifyclean before starting — a dirty tree only aborts later anyway. - [ ]
npm install spine-framework@<version>first; upgrade syncs to whatevernode_moduleshas. - [ ]
npx spine-framework upgrade --dry-run, read the report, then run for real. - [ ] Never pass
--forceto make local.framework/edits stick — it does the opposite. Move the change tocustom/first. - [ ]
npm installafter (dependency set changed), thennpm run verify. - [ ]
npx spine-framework migratefor the reported new migrations (Migrations). - [ ] Re-run
npm run assemble/ restartnetlify devso.assembled/picks up the new files (Deployment). - [ ] Commit the result — manifest,
netlify.toml,package.json,.devin/skills,AGENTS.mdare all part of the upgrade diff.
Related
- Anatomy of an installed project — sealed vs customer trees
- Migrations · Deployment · Troubleshooting
- CLI Reference —
upgrade,verify,doctor