fix(ce-worktree): resolve script path against skill dir, not user CWD#772
Merged
fix(ce-worktree): resolve script path against skill dir, not user CWD#772
Conversation
The skill instructed agents to run `bash scripts/worktree-manager.sh`,
which resolves against the user's project CWD at runtime — not the
skill directory — so the bundled script is never found and the skill
fails with "No such file or directory" on every invocation.
Switch to `bash "${CLAUDE_SKILL_DIR}/scripts/worktree-manager.sh"`
(the same pattern ce-update already uses) and add a narrow
`allowed-tools: Bash(bash *worktree-manager.sh)` pattern so users
without bypassPermissions don't get prompted on every run.
Adds regression guards mirroring ce-update.test.ts: forbid the bare
relative-path antipattern, require the CLAUDE_SKILL_DIR-prefixed
form, and require the narrow allowed-tools entry.
Fixes #764
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c044878f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…gets
ce-worktree has no `ce_platforms` restriction, so filterSkillsByPlatform
exports it to Codex/Gemini/Pi/Kiro/Droid/Copilot/Opencode. None of
those converters substitute `${CLAUDE_SKILL_DIR}`, so the previous
unguarded form expanded to `/scripts/worktree-manager.sh` and failed.
Switch to `${CLAUDE_SKILL_DIR:-.}` so:
- Claude Code (var set) -> absolute path to bundled script (works)
- Non-Claude targets (var unset) -> `./scripts/worktree-manager.sh`,
matching the prior bare-relative behavior on those harnesses.
Adds a regression guard requiring the `:-` fallback so this concern
cannot regress, and loosens the `${CLAUDE_SKILL_DIR}` guard's regex
to accept the fallback form.
Addresses PR #772 review feedback from chatgpt-codex-connector.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
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
/ce-worktreeinvokedbash scripts/worktree-manager.sh, a relative path the runtime Bash tool resolves against the user's project CWD (not the skill directory). The bundled script lives under<plugin-cache>/skills/ce-worktree/scripts/, so every invocation failed with "No such file or directory".bash "${CLAUDE_SKILL_DIR}/scripts/worktree-manager.sh"and added a narrowallowed-tools: Bash(bash *worktree-manager.sh)so users withoutbypassPermissionsare not prompted every run. This mirrors the proven pattern already ince-update.tests/skills/ce-worktree.test.tswith three regression guards: forbid the bare relative-path antipattern, require the${CLAUDE_SKILL_DIR}-prefixed form, and require the narrowallowed-toolsentry. Mirrorstests/skills/ce-update.test.ts.Note: the same
bash scripts/<name>.shantipattern exists in seven other skills (ce-optimize,ce-resolve-pr-feedback,ce-code-review,ce-session-inventory,ce-polish-beta,ce-setup,ce-clean-gone-branches). Out of scope here — issue #764 only coversce-worktree— but worth a follow-up.Fixes #764
Test plan
bun test tests/skills/ce-worktree.test.ts— 3 new regression tests passbun test— full suite (1336 tests) passesbun run release:validate— cleanbash "${CLAUDE_SKILL_DIR}/scripts/worktree-manager.sh"finds and executes the scriptbash scripts/worktree-manager.shfrom the project root fails with "No such file or directory"🤖 Generated with Claude Code