Repository navigation
fix: respect SQUAD_HOME env var, implement SQUAD_PERSONAL_DIR, fix Windows loop preflight - #1382
Conversation
…ndows loop preflight - capabilities.ts: use resolveSquadHome() instead of hardcoded ~/.squad/ (#1280) - comms-teams.ts: use resolveSquadHome() for Teams OAuth token storage (#1279) - resolution.ts: implement SQUAD_PERSONAL_DIR env var override (#1278) - loop.ts: add shell flag for Windows copilot.ps1/.cmd resolution (#1372) - init.ts: link to personal squad teamRoot when available (#1010, #984) Closes #1280, Closes #1279, Closes #1278, Closes #1372, Closes #1010, Closes #984 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 3 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 | 4 active Copilot thread(s) resolved (1 outdated skipped) |
| ✅ | CI passing | All checks passing |
Files Changed (8 files, +125 −15)
| File | +/− |
|---|---|
.changeset/fix-squad-home-env-bugs.md |
+12 −0 |
packages/squad-cli/src/cli/commands/loop.ts |
+1 −1 |
packages/squad-cli/src/cli/core/init.ts |
+22 −1 |
packages/squad-sdk/src/platform/comms-teams.ts |
+13 −7 |
packages/squad-sdk/src/ralph/capabilities.ts |
+10 −4 |
packages/squad-sdk/src/resolution.ts |
+8 −0 |
test/comms-teams-integration.test.ts |
+30 −2 |
test/personal-squad-init.test.ts |
+29 −0 |
Total: +125 −15
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🏗️ Architectural Review
Automated architectural review — informational only. |
🟡 Impact Analysis — PR #1382Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (2 files)
squad-sdk (3 files)
tests (2 files)
This report is generated automatically for every PR. See #733 for details. |
There was a problem hiding this comment.
Pull request overview
This PR aims to fix several environment/path-related bugs by routing user-level state through the SDK’s resolution helpers (not hardcoded ~/.squad paths), adding a SQUAD_PERSONAL_DIR override, and improving Windows compatibility for Copilot CLI preflight.
Changes:
- Use
resolveSquadHome()for capability and Teams token storage soSQUAD_HOMEis honored. - Add
SQUAD_PERSONAL_DIRsupport toresolvePersonalSquadDir(). - Fix Windows
squad looppreflight by enablingshellwhen invokingcopilot.
Show a summary per file
| File | Description |
|---|---|
| packages/squad-sdk/src/resolution.ts | Adds SQUAD_PERSONAL_DIR override handling in personal squad resolution. |
| packages/squad-sdk/src/ralph/capabilities.ts | Switches user-level capabilities lookup to resolveSquadHome() (respects SQUAD_HOME). |
| packages/squad-sdk/src/platform/comms-teams.ts | Routes Teams token cache storage through resolveSquadHome() (respects SQUAD_HOME). |
| packages/squad-cli/src/cli/core/init.ts | Attempts to link repo init to a personal squad by patching .squad/config.json. |
| packages/squad-cli/src/cli/commands/loop.ts | Makes Copilot CLI availability check Windows-friendly via shell + timeout. |
| .changeset/fix-squad-home-env-bugs.md | Adds a changeset covering CLI + SDK patch releases for these fixes. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 5
tamirdresher
left a comment
There was a problem hiding this comment.
LGTM — the SQUAD_HOME / env handling is correct and idempotent (the if (!config['teamRoot']) guard keeps init from overwriting an existing value), and the Windows loop preflight fix matches the existing agent-spawn.ts pattern. Approving.
Two non-blocking things worth a follow-up:
SQUAD_PERSONAL_DIRdoesn't expand~.path.resolve('~/foo')becomes<cwd>/~/foo, failsexistsSync, andresolvePersonalSquadDir()returnsnullsilently — so the most natural value a Unix user would type quietly does nothing. Either expand~(envDir.startsWith('~/') ? path.join(os.homedir(), envDir.slice(1)) : envDir) orconsole.warnwhen the var is set but the path doesn't exist.shellflag convention now differs fromdoctor.ts/monitor-*.ts, which pass unconditionalshell: true. No injection risk here since the args are hardcoded, but might be worth unifying on the conditionalshell: process.platform === 'win32'pattern you used.
A test for the new init → teamRoot linking would be a nice addition too. None of these block — good to merge.
…oc, tests - init.ts: use resolveGlobalSquadPath() for teamRoot instead of personal-squad dir - resolution.ts: validate SQUAD_PERSONAL_DIR is a directory, not just exists - comms-teams.ts: update JSDoc to reflect resolveSquadHome() usage - capabilities.ts: update JSDoc search order to document SQUAD_HOME support - test: add SQUAD_PERSONAL_DIR env var test cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #1280 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Batch fix for SQUAD_HOME and environment-related bugs. All changes are small, surgical fixes.
Issues Fixed
capabilities.tsnow usesresolveSquadHome()instead of hardcoded~/.squad/formachine-capabilities.jsoncomms-teams.tsnow usesresolveSquadHome()instead of hardcoded~/.squad/for Teams OAuth token storageresolvePersonalSquadDir()now respectsSQUAD_PERSONAL_DIRenv var overrideloop.tscheckCopilotCli()now passesshell: process.platform === 'win32'so Windows can resolvecopilot.ps1/.cmdshimssquad initnow setsteamRootin config.json to the personal squad directory when one existsgit initcall) — no code change neededChanges by file
packages/squad-sdk/src/ralph/capabilities.ts— Replaceos.homedir()fallback withresolveSquadHome()packages/squad-sdk/src/platform/comms-teams.ts— Replace hardcodedSQUAD_DIRconstant withgetSquadDir()helper that usesresolveSquadHome()packages/squad-sdk/src/resolution.ts— AddSQUAD_PERSONAL_DIRenv var check at the top ofresolvePersonalSquadDir()packages/squad-cli/src/cli/commands/loop.ts— Addshellandtimeoutoptions toexecFile('copilot', ...)matching sibling call sitespackages/squad-cli/src/cli/core/init.ts— After SDK init, patch config.json withteamRootpointing to personal squad directoryTesting
tsc --noEmit): no new errors introduced (pre-existing errors in unrelated files remain)doctor.ts,monitor-teams.tsalready useshell: true)Closes #1280, Closes #1279, Closes #1278, Closes #1372, Closes #1010, Closes #984