Description
Context
#816 fixed worktree provisioning so it "cannot dirty the lockfile", switching the TypeScript worktree-manager path to the package manager's frozen install (npm ci / pnpm install --frozen-lockfile). The rationale is worth restating because it is not cosmetic — a single unstaged package-lock.json cascades into three unrelated-looking failures:
rebaseBeforePRrefuses to run (cannot rebase: You have unstaged changes), so the fix: Rebase worktrees onto main before PR to prevent lockfile drift #295 stale-base guard silently never fires while the run log still reports successcheckWorktreeFreshnesscounts the file as uncommitted work, so stale worktrees are kept forever instead of recreated- chain-mode checkpoints skip on an "unrelated dirty file", breaking chain resume (feat: resume a partially-completed chain from its last good link #760) on every link
scripts/new-feature.sh was not covered by that fix and still uses npm install --silent at three sites.
Evidence
Observed 2026-07-26 while provisioning the worktree for #804 with ./scripts/new-feature.sh 804. Immediately after provisioning, before any edit:
$ git diff --stat package-lock.json
package-lock.json | 12 ------------
1 file changed, 12 deletions(-)
$ git diff package-lock.json | head
- "libc": [
- "glibc"
- ],
...
- "libc": [
- "musl"
This is the exact signature #816 documents: the local npm stripping libc fields a newer npm wrote via dependabot. It had to be reverted by hand before committing, and would otherwise have ridden along in PR #825.
Affected sites
templates/scripts/new-feature.sh (note: scripts/new-feature.sh is a symlink to it — edit the template, not the link):
:203— cache-enabled path, package-lock changed:210— cache-enabled path, cache initialization:219— default path
Proposal
Use the frozen install at all three sites, matching #816's substitution. The enclosing if [ ! -d "node_modules" ] guard means this always runs against an absent node_modules, which is exactly npm ci's precondition, so the swap is safe.
Worth considering whether the script should route through the same package-manager abstraction the TypeScript path uses rather than hardcoding npm, since the script already hardcodes npm elsewhere — but a like-for-like npm ci swap is the minimal fix and can land first.
Acceptance Criteria
- AC-1: All three
npm install --silentsites intemplates/scripts/new-feature.shuse a frozen install that cannot rewritepackage-lock.json. - AC-2: Provisioning a fresh worktree on a repo whose committed lockfile disagrees with the local npm leaves
git status --porcelainempty — verified by running the script, not by inspection. - AC-3: The
SEQUANT_NPM_CACHE=truepath still works: cache hit copiesnode_modules, cache miss installs and updates the hash file. - AC-4: Failure mode is not silently worse than before — if the frozen install fails because the lockfile is genuinely out of sync with
package.json, the script surfaces that rather than leaving a half-provisioned worktree.
Non-Goals
- Migrating the script to the TypeScript worktree-manager path.
- Generalizing the script beyond npm (pnpm/yarn support) — separate concern.
References
- fix(worktree): frozen installs so provisioning cannot dirty the lockfile #816 — the same fix for the TypeScript provisioning path
- fix: Rebase worktrees onto main before PR to prevent lockfile drift #295 — the stale-base guard that silently stops firing
- feat: resume a partially-completed chain from its last good link #760 — chain resume, broken per-link by the dirty file
Activity
fix(#826): frozen install in new-feature.sh so provisioning cannot di…
fix(#846): ensureWorktree surfaces failed provisioning install instea…
fix(#845): harden the eight numeric CLI options #833 left on bare par…
fix(#826): frozen install in new-feature.sh so provisioning cannot di…