Repository navigation
fix(install): refuse to replace non-managed files or dirs during setup - #114
Merged
Merged
Conversation
linkSkills/linkDir/linkFile/linkHook previously did rmSync(dst,
{recursive:true}) before symlinking, silently destroying any pre-existing
file or directory at the destination. A user's own ~/.claude/hooks/
rtk-rewrite.sh (installed by RTK itself) or a user-authored skills dir
with a colliding name would be deleted without prompt or backup.
Add assertReplaceable(): the destination may only be replaced when it is
absent or already a symlink pointing back into this package. Anything
else throws with a clear message. The recursive rmSync is dropped in
favor of plain rmSync since the only removable case is now a single
managed symlink.
Closes danielvm-git#112
|
🎉 This PR is included in version 2.87.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
danielvm-git
added a commit
that referenced
this pull request
Sep 1, 2026
Regression tests for BUG-2026-08-31-pi-scripts-provisioning (#116): - initProject links package scripts/ into a consumer project and scaffolds specs/bugs + specs/verifications - initProjectRemove cleans only managed artifacts - init refuses (never clobbers) a user-owned scripts/ dir - CLI drift guards: 'init' dispatch in bin/bigpowers.js + bin/init.js - managed-symlink check needs a path-separator boundary (PR #114 follow-up): prefix sibling <ROOT>-evil must be refused All fail against current code (initProject undefined).
danielvm-git
added a commit
that referenced
this pull request
Sep 1, 2026
…rojects BUG-2026-08-31-pi-scripts-provisioning (#116). Package installs (pi install npm:bigpowers, npm i -g, npx) register skills but never provision a project-local scripts/ tree — pi's package contract has no resource type for project files and no lifecycle script runs — so SKILL.md commands (bash scripts/*.sh) and verify gates fail in every consumer project. - install-helpers.js: initProject(repoRoot) links the package scripts/ into cwd and scaffolds specs/bugs + specs/verifications; initProjectRemove(repoRoot) removes only managed artifacts. Both reuse linkDir/assertReplaceable — a user-owned scripts/ is refused, never clobbered. - assertReplaceable: managed-symlink check now requires a path-separator boundary — a string-prefix sibling of the package root (<ROOT>-evil) is no longer treated as managed (PR #114 follow-up). - bin/init.js + bigpowers init [--remove] dispatch + help text. - README pi Support: document the per-project provisioning step. RED->GREEN: test-install-helpers.js additions from the previous commit failed (initProject undefined) and now pass; e2e verified in a temp consumer project (gates resolve, idempotent, --remove cleans, refusal preserves user content, no-op inside the package).
danielvm-git
added a commit
that referenced
this pull request
Sep 1, 2026
…rojects (#117) * chore(bugs): file BUG-2026-08-31 — npm token release failure + pi scripts provisioning Two open bug records: - BUG-2026-08-31-npm-token-invalid-release: Release workflow fails EINVALIDNPMTOKEN at verifyConditions (run 33461454695, commit f866adc); v2.87.6 unpublished pending NPM_TOKEN rotation. Code unaffected — skill-health and compliance green on the same commit. - BUG-2026-08-31-pi-scripts-provisioning (#116): package installs provision skills but never scripts/ — verify gates fail in every consumer project. Fix via bigpowers init lands in the following commits on this branch. Registry regenerated (74 bugs) with OKF sidecars. * test(install): bigpowers init provisions scripts/ + specs/ — RED Regression tests for BUG-2026-08-31-pi-scripts-provisioning (#116): - initProject links package scripts/ into a consumer project and scaffolds specs/bugs + specs/verifications - initProjectRemove cleans only managed artifacts - init refuses (never clobbers) a user-owned scripts/ dir - CLI drift guards: 'init' dispatch in bin/bigpowers.js + bin/init.js - managed-symlink check needs a path-separator boundary (PR #114 follow-up): prefix sibling <ROOT>-evil must be refused All fail against current code (initProject undefined). * fix(cli): bigpowers init provisions scripts/ + specs/ into consumer projects BUG-2026-08-31-pi-scripts-provisioning (#116). Package installs (pi install npm:bigpowers, npm i -g, npx) register skills but never provision a project-local scripts/ tree — pi's package contract has no resource type for project files and no lifecycle script runs — so SKILL.md commands (bash scripts/*.sh) and verify gates fail in every consumer project. - install-helpers.js: initProject(repoRoot) links the package scripts/ into cwd and scaffolds specs/bugs + specs/verifications; initProjectRemove(repoRoot) removes only managed artifacts. Both reuse linkDir/assertReplaceable — a user-owned scripts/ is refused, never clobbered. - assertReplaceable: managed-symlink check now requires a path-separator boundary — a string-prefix sibling of the package root (<ROOT>-evil) is no longer treated as managed (PR #114 follow-up). - bin/init.js + bigpowers init [--remove] dispatch + help text. - README pi Support: document the per-project provisioning step. RED->GREEN: test-install-helpers.js additions from the previous commit failed (initProject undefined) and now pass; e2e verified in a temp consumer project (gates resolve, idempotent, --remove cleans, refusal preserves user content, no-op inside the package).
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
linkSkills/linkDir/linkFile/linkHookinscripts/lib/install-helpers.jspreviously didfs.rmSync(dst, { force: true, recursive: true })before symlinking — silently destroying any pre-existing file or directory at the destination. A user's own~/.claude/hooks/rtk-rewrite.sh(installed by RTK itself) or a user-authored skills dir with a colliding name would be deleted without prompt, backup, or any check.Change
Add
assertReplaceable(dst), called by all four link functions before removal:REPO_ROOT) → managed by bigpowers, safe to re-link.The
recursive: truermSync is dropped in favor of plainrmSync, since the only removable case is now a single managed symlink.Verification
bash scripts/test-install-helpers.sh→ ALL PASS (existing suite, no regressions).Closes #112.