Repository navigation
fix(claude): repository launcher finds squad on PATH; launcher argv tested on Windows - #2483
Conversation
The repo launcher skipped every PATH entry because realpath of its (nonexistent) .squad/bin threw inside the comparison. New test/launcher-argv.test.ts checks hostile argv round-trips through a global squad, npx, SQUAD_CLI and a project install, through .cmd shims on Windows without cmd.exe. A new workflow runs the launcher tests on Windows and Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🟠 Impact Analysis — PR #2483Risk tier: 🟠 HIGH 📊 Summary
🎯 Risk Factors
📦 Modules Affectedci-workflows (1 file)
root (3 files)
scripts (1 file)
squad-sdk (1 file)
tests (3 files)
This report is generated automatically for every PR. See #733 for details. |
🏗️ Architectural Review
Automated architectural review — informational only. |
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 5 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 2 unresolved Copilot thread(s) — fix and resolve before merging |
| ❌ | CI passing | 1 check(s) still running |
Files Changed (9 files, +219 −9)
| File | +/− |
|---|---|
.changeset/launcher-path-lookup.md |
+6 −0 |
.github/workflows/squad-launcher-platforms.yml |
+59 −0 |
CHANGELOG.md |
+1 −0 |
packages/squad-sdk/src/client/adapters/claude-plugin.ts |
+6 −3 |
plugins/squad/scripts/squad.mjs |
+6 −3 |
scripts/release/test-reconciliation.mjs |
+1 −0 |
test/claude-plugin.test.ts |
+3 −1 |
test/claude-projection-v3-plugin.test.ts |
+2 −2 |
test/launcher-argv.test.ts |
+135 −0 |
Total: +219 −9
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
~/.squad/cli.json (since #2470) is found by the launcher, so tests that expect the npx fallback or a missing CLI failed on any machine that had run squad init from a source build. Point SQUAD_HOME at an empty dir. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
A missing reconciliation rule for the Windows-only test blocks release verification and publishing, while the npx tests can run a globally installed CLI instead of their fixtures.
2 open issues
What changed in this PR
Fixes PATH lookup in the repository launcher used by Squad’s MCP configs and Claude Code hooks, and adds cross-platform argument-forwarding coverage requested in #2469.
Changes:
- Fixes shared launcher logic so a missing launcher-owned
bindirectory no longer prevents PATH lookup. - Adds tests for literal argument forwarding through global installs, npx,
SQUAD_CLI, and project installs. - Adds Windows/Linux CI coverage and records the fix in release notes.
| File | Description |
|---|---|
test/launcher-argv.test.ts |
Adds argument-forwarding and Windows shim tests. |
plugins/squad/scripts/squad.mjs |
Regenerates the plugin launcher with the PATH fix. |
packages/squad-sdk/src/client/adapters/claude-plugin.ts |
Fixes own-directory handling in the shared launcher template. |
CHANGELOG.md |
Documents the PATH fix and cross-platform coverage. |
.github/workflows/squad-launcher-platforms.yml |
Runs launcher tests on Windows and Linux. |
.changeset/launcher-path-lookup.md |
Declares SDK and CLI patch releases. |
Review effort: Max (auto)
| expect(parsed(run(HOSTILE))).toEqual(HOSTILE); | ||
| }); | ||
|
|
||
| it.runIf(win)('fails closed when a .cmd shim has no JavaScript entry beside it', () => { |
| return spawnSync(process.execPath, [path.join(root, '.squad', 'squad.mjs'), ...args], { | ||
| cwd: os.tmpdir(), | ||
| encoding: 'utf8', | ||
| env: { | ||
| ...base, | ||
| // The fake bin first, then Node's own directory; no real squad or npx. | ||
| PATH: [bin, path.dirname(process.execPath)].join(path.delimiter), |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Tests the launcher on Windows, as #2469 asked ("Test the Windows launcher's
npxquoting"). Writing the test turned up a bug from #2470.Bug: the repository launcher never found
squadon PATHonPathskips the launcher's ownbindirectory. It comparedrealpathSync(dir)withrealpathSync(ownBin)inside onetry, andcontinued on any error. The plugin has abin/, but the repository launcher's.squad/bindoesn't exist, so every PATH entry was skipped. A repository whose only Squad CLI was a global install failed with "no Squad CLI found". The existing tests covered the project install,SQUAD_CLIand~/.squad/cli.json, but not PATH. The fix resolvesownBinonce and only skips it when it exists. The plugin'sscripts/squad.mjsis regenerated (still pinned to2.0.0-preview.4).Windows argv test
New
test/launcher-argv.test.tssends arguments that a shell or cmd.exe would rewrite (&echo pwned,pipe|more,%PATH%,^caret,!bang!, quotes, an empty string, a trailing backslash, non-ASCII text) through each way the launcher finds a CLI: a globalsquad,npxwithSQUAD_ALLOW_NPX=1,SQUAD_CLIand the project's install. It checks they arrive byte for byte.On Windows the fakes are npm-style
squad.cmdandnpx.cmdshims that printSHELL-USEDif cmd.exe ever runs them, beside the JavaScript entry the launcher should run instead. A Windows-only case checks that a shim with no entry fails closed.The main CI runs on Linux only, so the new workflow
squad-launcher-platforms.ymlruns this test andportable-launch.test.tsonwindows-latestandubuntu-latestwhen the launcher template, the plugin scripts or these tests change.Testing
squad-launcher-platformsrun.actionlintis clean.🤖 Generated with Claude Code