Repository navigation
Closed
Labels
pro-boundaryPro/core boundary: Pro code moves to nodespace-sync (ADR-081..085)
Description
Summary
Add ADR-082 (proposed) §5's build-time skill-content input to scripts/build-skill.ts. NODESPACE_SKILL_EXTENSIONS names a directory.
- Unset, as in every core build and test run, the staged skill is exactly core's.
- Set, the build also stages the directory's
references/*.mdintoresources/skill/references/, and appends the directory'sSKILL.mdfragment, if there is one, to the stagedSKILL.md. - It rejects anything else in the directory, a name clash with core's references, and a missing directory.
Core's release workflow fails if the variable is set. This is the Pro build's way to add its agent guidance (ADR-082 §1 step 3), and the counterpart of NODESPACE_EXTENSIONS for the frontend.
Context
- How staging works.
scripts/build-skill.tsmain()syncs each ofSTAGED_ENTRIES(dist,shims,SKILL.md,references,package.json) frompackages/skill/intopackages/desktop-app/src-tauri/resources/skill/withsyncTreeByContent.syncTreeByContentdeletes staged files that are missing from the source, and rewrites only files whose bytes differ.- The module doc explains why that idempotence matters: every staged byte is a
tauri-buildrerun input. - Extension files must therefore be merged into what is staged, not copied after it. Otherwise the next plain run deletes them, and a run with the variable set churns them.
- The installer already copes. After Install skill references from the staged directory and record installed files #3368 it installs every staged
references/*.mdand records it, so an added reference is installed and uninstalled like core's own. - What the Pro build does today. It never runs
build:skill(ADR-082 §1). nodespace-sync's side of this change is the SYNC item on Move the Pro shared-workspaces agent guidance out of core's skill #3370. - ADR-082 §7 and §8.
- The input, its accepted layout and the install/uninstall behaviour are part of the versioned extension API.
- A fixture directory exercises them in core's script tests.
- The gate that watches fixture files requires an
EXTENSION_API_VERSIONbump when they change.
- Where the release guard goes.
.github/workflows/release.ymlrunsbun run build:skillin two jobs (~124 and ~349 at af8ddb6).
Scope
scripts/build-skill.ts.- Export
readSkillExtensions(env = process.env). It returnsundefinedwhenNODESPACE_SKILL_EXTENSIONSis unset or empty; otherwise it returns{ references: Map<name, absPath>, fragment?: string }. It throws a clear error when:- the directory does not exist;
- it holds anything other than an optional
SKILL.mdandreferences/*.md(no subdirectories underreferences/, no other files); - an added reference has the same name as one in
packages/skill/references/.
- Stage
referencesfrom the union of core's files and the extension's, reusingsyncTreeByContent's byte-compare-and-delete behaviour. Generalize it to take a file map, or add a sibling helper, so a plain run after an extension run removes the added files and an unchanged run rewrites nothing. - Stage
SKILL.mdas core's content, followed by\nand the fragment when there is one. Write it only if the bytes differ. - Log one line naming the extension directory and the added files, so a Pro build log shows what it added.
- Export
scripts/build-skill.test.ts. Add the tests listed under Tests and verification.- Fixture:
scripts/fixtures/skill-extension/.SKILL.md: a one-line fragment pointing atreferences/fixture-guide.md.references/fixture-guide.md: neutral content.- Name no product: the Pro-boundary ratchet scans
scripts/.
packages/skill/src/tests/installer.test.ts. One test that installs from a package root shaped like an extension-staged skill (core's references plusfixture-guide.md), uninstalls, and asserts no added file remains. This is ADR-082 §8's "install followed by uninstall leaves no added file behind"..github/workflows/release.yml.- Before each
bun run build:skillstep, add a step that fails when the variable is set:test -z "${NODESPACE_SKILL_EXTENSIONS:-}" || { echo "::error::NODESPACE_SKILL_EXTENSIONS must not be set in a core release (ADR-082 §9)"; exit 1; }
- If Turn the UI-extension registry into ADR-082's build-time frontend extension API #3317 already added a release guard for
NODESPACE_EXTENSIONS, extend that step to check both variables instead. - Add a DOM-free bun test, next to the existing
scripts/update-homebrew-cask.test.tschecks ofrelease.yml, asserting that every job that runsbun run build:skillruns the guard earlier in the same job.
- Before each
- Extension API version. If
EXTENSION_API_VERSIONexists at your base commit (added by Split the desktop Tauri crate and add ADR-082's Tauri extension points #3322 or Turn the UI-extension registry into ADR-082's build-time frontend extension API #3317), bump its minor version: a new optional input is an additive change (ADR-082 §7). Add an "Extension API" line to the PR description. If it does not exist yet, tell the issue that adds it to list this input and fixture among its watched fixtures.
Out of scope
- Any change to what core's own skill contains.
scripts/publish-skill-repo.ts. It never reads the variable, so the public skill stays core's.- nodespace-sync's guidance directory and its build step (the SYNC item on Move the Pro shared-workspaces agent guidance out of core's skill #3370).
Steps
- Follow CLAUDE.md's startup sequence:
- pull
main; EnterWorktree({name: "issue-<N>-skill-extensions-input"});bun install, then thebun run testbaseline;- self-assign at pickup and set In Progress.
- pull
- Confirm Install skill references from the staged directory and record installed files #3368 has merged.
- Implement
readSkillExtensionsand the merged staging, then the fixture and tests. Mutation-check each new test. - Add the release guard and its test.
- Check by hand:
bun run build:skillstages exactly core's skill;NODESPACE_SKILL_EXTENSIONS=scripts/fixtures/skill-extension bun run build:skilladdsfixture-guide.mdand the fragment;- a plain
bun run build:skillafterwards removes both; - a second plain run reports "nothing rewritten".
- Run
bun run scripts/check-pro-boundary.ts. This PR should neither add nor remove a marker. - Verify, then finish:
bun run quality:fix, and commit;git push origin HEAD:issue-<N>-skill-extensions-input;gh pr create --head issue-<N>-skill-extensions-input;- merge only with
bun run merge <PR#>once approved.
Acceptance criteria
- With the variable unset, the staged skill is byte-identical to one staged before this PR.
- With the fixture set, the staged skill has core's references plus
fixture-guide.md, andSKILL.mdends with the fragment. - A plain run after a fixture run restores core's staging, and an unchanged run rewrites nothing.
- A missing directory, an unexpected file and a name clash each fail the build with a message naming the problem.
-
release.ymlfails any job that runsbuild:skillwith the variable set, and a test pins that. - Install followed by uninstall of an extension-staged skill leaves no added file.
-
EXTENSION_API_VERSION's minor version is bumped, or the PR says why not. -
BASELINESinscripts/check-pro-boundary.tsstill equals the CLI's counts (this PR adds and removes no marker), and the CLI exits 0.
Tests and verification
New tests in scripts/build-skill.test.ts. Use a temporary directory per test.
- Unset or empty:
readSkillExtensionsreturnsundefined. - Valid fixture: it returns the added reference and the fragment.
- Each rejection: a missing directory, a stray file at the root, a subdirectory under
references/, a non-.mdfile, and a name clash with a core reference. - Merged staging:
- adds the extension's files;
- a later plain staging deletes them;
- identical inputs rewrite nothing and preserve mtimes.
Commands:
bun run test:scriptsbun run test:skillbun run quality:scripts:checkbun run build:skillbun run test:changedbun run scripts/check-pro-boundary.ts
Dependencies
- Install skill references from the staged directory and record installed files #3368: the installer installs and records every staged reference. NodeSpaceAI/nodespace-docs#88 (ADR-081), NodeSpaceAI/nodespace-docs#90 (ADR-082) and Guardrail: stop new Pro code from landing in core #3302 come through it.
Risks and rollback
- Staging churn. If the merged staging rewrites unchanged files, every
tauri devrebuilds the app crate. The mtime-preservation test guards against it. - A core release built with the variable set. The release guard stops it before the skill is staged.
- Rollback. Revert the PR. With the variable unset, staging is unchanged, so no core build notices.
Plan key: C10.6b (pro-boundary DAG).
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
pro-boundaryPro/core boundary: Pro code moves to nodespace-sync (ADR-081..085)
Activity