Repository navigation
Add the NODESPACE_SKILL_EXTENSIONS build input to core's skill build - #3404
Conversation
Automated pragmatic code review (medium depth)Review Type: Initial Review (PR #3404 @ What was checked
Requirements Check
The release guard (criterion 5).
The version bump (criterion 7).
Code Review Findings
Strengths
Recommendation: APPROVE. No correctness, security or idempotence problem was found, and every finding is optional polish. 🤖 Generated with Claude Code |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE, posted as a comment because GitHub blocks self-approval. The full findings are in the review comment above. All 8 acceptance criteria are met, and every finding is optional polish.
83fbb97 to
f207c38
Compare
Address reviewCommit ✅ Addressed (7)
⏭️ Skipped (1)
Not a code change
Verification
Re-Review DecisionDecision: RE-REVIEW NEEDED, scoped to 🤖 Generated with Claude Code |
f207c38 to
7b5d520
Compare
Automated pragmatic code re-review (medium depth)Review Type: Re-Review, scoped to Previous Review Summary: 8 recommendations.
What was checked
Why the dot-entry skip is safe
Findings🟡 The matcher misses commands that stage the skill. 📁
🟢 Nit: a hidden
Recommendation: APPROVE once the 🟡 matcher fix is in. 🤖 Generated with Claude Code |
Address re-reviewCommit ✅ Addressed: 🟡 the skill-build matcher
⏭️ Skipped: 🟢 log skipped hidden
|
- build-skill.ts: readSkillExtensions validates the directory named by NODESPACE_SKILL_EXTENSIONS (an optional non-empty SKILL.md and a flat references/*.md whose names do not clash with core's, compared without case) and returns its references and fragment. stageSkillResources merges them into the staged references/ and SKILL.md. syncTreeByContent becomes a wrapper over syncFilesByContent, which mirrors a file map (copied files or in-memory bytes), so a plain run after an extension run removes the additions and an unchanged run rewrites nothing. Unset or empty, the staged skill is byte-identical to before. - scripts/fixtures/skill-extension: a fragment and one added reference. - release.yml: the extensions guard also refuses NODESPACE_SKILL_EXTENSIONS and runs before build:skill in both Tauri build jobs; its test pins the guard ahead of build:skill in every job that runs it. - installer test: install and uninstall from an extension-staged package root leave no added file. - EXTENSION_API_VERSION 1.0 -> 1.1 in Rust and TypeScript (additive input). Co-Authored-By: Claude Opus 5.5 <[email protected]>
- readSkillExtensions skips entries whose names start with a dot, at the root and under references/, and never stages them, so a .DS_Store that Finder recreates no longer fails every dev build. A symlinked references/ now reports that symlinks are not accepted. - syncTreeByContent had no caller outside the tests; it is removed and the tests mirror a tree through a local helper over syncFilesByContent. - A test pins that an empty file map over a staged plain file removes it and counts it. - The release guard test recognizes every command that stages the skill (build:skill, the root build, build:windows, build:windows:quick and scripts/build-skill.ts) and not Bun's bundler, and a test pins the matcher. - Docs: the relative-path base is the repository root under bun run build:skill; the early read fails before tsc and staging. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e guard test The desktop app's tauri:build runs `bun run --cwd ../.. build:skill`, and the root tauri:build and build:macos reach it, so the release guard test now counts a step running any of them, or build:skill from any --cwd, as staging the skill. A --cwd before `build` still names another package's build and does not count. The matcher test moves build:macos to the positive cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The initial extension build-out stays at 1.0, and the bump rule applies once the version checks land. Restores the Rust and TypeScript constants and the pin test to their values on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
66c751b to
e2afdaf
Compare
Summary
Adds ADR-082 §5's build-time skill-content input.
NODESPACE_SKILL_EXTENSIONSnames a directory whosereferences/*.mdare staged beside core's references and whoseSKILL.mdfragment is appended to the stagedSKILL.md. Unset or empty, which is every core build and test run, the staged skill is byte-identical to before this PR. Core's release workflow refuses the variable.Closes #3369
Changes
scripts/build-skill.tsreadSkillExtensions(env = process.env, coreReferencesDir?)returnsundefinedfor an unset or empty variable. Otherwise it returns{ dir, references: Map<name, absPath>, fragment? }. A relative path resolves against the directory the build runs from.NODESPACE_SKILL_EXTENSIONS (<dir>): <problem>for:SKILL.mdandreferences;SKILL.md, or aSKILL.mdthat is not a regular file;referencesthat is not a directory, a subdirectory under it, a non-regular file (a symlink) or a non-.mdfile;packages/skill/references/, compared without case, becauseCLI.mdwould overwritecli.mdon a case-insensitive filesystem..DS_Storeand.gitkeepare skipped at both levels and never staged. A symlinkedreferences/is reported as a symlink.syncTreeByContentis replaced bysyncFilesByContent(files: Map<rel, {from} | {bytes}>, destRoot), which keeps the byte-compare, delete-what-is-gone and kind-flip self-heal behaviour.treeSources(root)builds the map for a plain tree. The old function's tests now go through a local helper.stagedSources(entry, skillDir, extensions?)builds each entry's file map:referencesis the union of core's files and the extension's, and refuses to replace one of core's;SKILL.mdis core's bytes, then\nand the fragment;stageSkillResources(skillDir, resourceDir, extensions?)is the staging loop, moved out ofmain()so it can be tested. A plain run after an extension run removes the additions, and a repeated run of either kind rewrites nothing.main()reads the extension beforetscruns and logs one line, for exampleSkill extensions from <dir>: adding references/fixture-guide.md, a SKILL.md fragment.scripts/fixtures/skill-extension/: a one-lineSKILL.mdfragment pointing atreferences/fixture-guide.md, and a neutralreferences/fixture-guide.md. Neither names a product..github/workflows/release.yml: the existingRefuse injected extensionsguard step now checks bothNODESPACE_EXTENSIONSandNODESPACE_SKILL_EXTENSIONS. It moved ahead ofBuild and stage skill resourcesin bothbuild-tauri-macos-armandbuild-tauri; it previously ran after the skill staging and before the Tauri build.scripts/release-workflow-extensions-guard.test.tsnow covers both variables:Every job that stages the skill has the guard earlier in the same job, under bash, with no
if:and nocontinue-on-error. Such jobs are found by scanning for any command that stages the skill, and are pinned to the two known jobs. A test also pins the matcher. The matcher covers:build:skill, ortauri:build, which runsbuild:skill, from any--cwd;build,build:macos,build:windowsandbuild:windows:quick;scripts/build-skill.ts.It does not cover Bun's bundler (
bun build),bunx tauri build, or another package'sbuild.The extracted guard script exits 1 when either variable is set, including empty, and exits 0 when both are unset.
No
envblock anywhere sets either variable.packages/skill/src/tests/installer.test.ts: installs from a package root shaped like an extension-staged skill (core's references plusfixture-guide.md, with a fragment at the end ofSKILL.md). It checks that the added reference is installed and recorded, and that uninstall removes it along with the install directory.Extension API: no bump,
EXTENSION_API_VERSIONstays at 1.0. The new input is additive (ADR-082 §7), but the version policy is not in force yet:So this input and fixture ship as part of 1.0, like the sibling extension-point PRs #3392, #3398, #3402 and #3405. I asked #3321 to add
NODESPACE_SKILL_EXTENSIONSandscripts/fixtures/skill-extension/to its watched fixtures, so later changes to them require a bump.Deviations from the issue
test -zstep, or extending the existing guard if one had landed. The guard from the build-entry PR exists, so this PR extends it. It usesprintenv, which also fails on a set-but-empty value, matching the existing check.scripts/release-workflow-extensions-guard.test.ts, alongside theNODESPACE_EXTENSIONSchecks, instead of a new file next toupdate-homebrew-cask.test.ts. Both are inscripts/and DOM-free.readSkillExtensionsalso rejects the cases listed above beyond the issue's list (empty or non-regularSKILL.md, non-directoryreferences, symlinks, case-only clashes). A build that quietly ignored a misplaced file would ship less guidance than its author meant. These match the installer's own filter, so nothing passes the build only to be skipped at install.SKILL.mdandreferences/*.md, but Finder recreates.DS_Storein any folder it opens. Rejecting it would fail everydev:tauriof a guidance checkout on macOS. Dot-entries are never staged, so nothing beyondSKILL.mdandreferences/*.mdcan reach the skill.EXTENSION_API_VERSIONexists, or to explain why not. It stays at 1.0, for the reason in the "Extension API" note above. An earlier revision bumped it to 1.1; that was reverted tomain's values, so this PR no longer touchespackages/desktop-app.FIXTURE_FILEScurrently lists only the Rust fixture files. I asked there forscripts/fixtures/skill-extension/to be added to the files it watches.Pro boundary ratchet
bun run scripts/check-pro-boundary.tsexits 0, and--changedreports 0 hits for every marker in this PR's files (delta 0).BASELINESis untouched.Tests
bun test scripts/build-skill.test.ts scripts/release-workflow-extensions-guard.test.ts: 99 pass (81 and 18).bun run test:skill: 132 pass.bun run test:changed: passed every tier, becauserelease.ymlis an unrecognized path. Those tiers were the skill tsc, the frontend, the scripts, the skill package, the browser and the Rust workspace nextest. It was re-run after each rebase; the branch is now on Add daemon-ready tasks and channel-rebuilt hooks to AppExtensions #3405.cargo clippy -p nodespace-app-lib --all-targets -- -D warnings -D clippy::unused-async: clean.cargo fmt -p nodespace-app-lib: no changes. After the revert,extension_api_version_is_one_zeropasses.bun run quality:scripts:fix,bun run --cwd packages/skill quality:fixandbun run --cwd packages/desktop-app quality:fixare clean (svelte-check 0 errors, 0 warnings).Mutation check: 53 runs of 52 distinct mutations, all killed, re-run after the review fixes. Each mutation was applied on its own, the named suite was run, and the file was restored.
readSkillExtensions(18 mutants):describeSkillExtensions(3): the "nothing" wording, the fragment omitted, the directory omitted.syncFilesByContent(5): always rewrites, never deletes, a bytes source never written, the kind-flip self-heal removed or inverted.if:, the variable set in a jobenv, the build moved before the guard in job 2, the skill-variable check dropped from job 2.files.size > 0guard removed;references/;referencescheck removed;tauri:builddropped,build:macosdropped,--cwddisallowed,--cwdallowed beforebuild(which flagsbuild-headless),bun buildaccepted, reverted to the literalbuild:skill, or without its end anchor (which matchesbuild:skill-repo).Manual verification (
bun run build:skillin the worktree)origin/main, and the run reports "nothing rewritten".NODESPACE_SKILL_EXTENSIONS=scripts/fixtures/skill-extension: logs the added files, updates 2 staged files, addsreferences/fixture-guide.md, andSKILL.mdends with the fragment.origin/mainstaging.notes.txt, a missing directory and areferences/cli.mdclash each fail witherror: NODESPACE_SKILL_EXTENSIONS (<dir>): <problem>..DS_Storeat the root and underreferences/. It staged only the fixture's two files, and no.DS_Storereached staging. A plain run then restored theorigin/mainsha256 list, and a second plain run rewrote nothing.🤖 Generated with Claude Code