Repository navigation
fix: CLI and upgrade bug fixes (#1050, #1048, #1047, #1052, #1029, #1353) - #1383
Conversation
- Show externalize/internalize in squad --help (Closes #1050) - squad build writes to externalized state dir (Closes #1048) - squad new agent adds agent to config agents array (Closes #1047) - squad upgrade backs up customized squad.agent.md, adds --dry-run (Closes #1052) - Explicit @agent mentions bypass direct-response handler (Closes #1029) - state-mcp uses lazy init to avoid blocking multi-MCP startup (Closes #1353) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🟡 Impact Analysis — PR #1383Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (5 files)
squad-sdk (3 files)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
🛫 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 | 2 active Copilot thread(s) resolved (3 outdated skipped) |
| ✅ | CI passing | All checks passing |
Files Changed (10 files, +273 −54)
| File | +/− |
|---|---|
.changeset/cli-upgrade-fixes.md |
+12 −0 |
packages/squad-cli/src/cli-entry.ts |
+6 −0 |
packages/squad-cli/src/cli/commands/build.ts |
+29 −6 |
packages/squad-cli/src/cli/commands/state-mcp.ts |
+47 −19 |
packages/squad-cli/src/cli/core/command-help.ts |
+3 −0 |
packages/squad-cli/src/cli/core/upgrade.ts |
+51 −1 |
packages/squad-sdk/src/agents/onboarding.ts |
+77 −28 |
packages/squad-sdk/src/config/routing.ts |
+15 −0 |
packages/squad-sdk/src/coordinator/direct-response.ts |
+5 −0 |
test/routing.test.ts |
+28 −0 |
Total: +273 −54
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. |
There was a problem hiding this comment.
Pull request overview
Batch of CLI + SDK fixes addressing help discoverability, externalized state writes, onboarding config updates, safer upgrade behavior, explicit @agent routing, and reduced state-mcp startup blocking.
Changes:
- CLI: surface
externalize/internalizein--help, addupgrade --dry-run, and write.squad/*outputs to the externalized state directory duringbuild. - Upgrade: back up locally customized
squad.agent.mdbefore refresh; add dry-run preview mode. - SDK/runtime: prioritize explicit
@agentmentions over direct-response handling; adjuststate-mcpto lazily initialize its tool registry.
Show a summary per file
| File | Description |
|---|---|
| packages/squad-sdk/src/coordinator/direct-response.ts | Skips direct-response handling when an explicit @agent mention is present. |
| packages/squad-sdk/src/config/routing.ts | Adds highest-priority routing for explicit @agent mentions. |
| packages/squad-sdk/src/agents/onboarding.ts | Updates addAgentToConfig() to add agent definitions to squad.config.ts and optionally add a routing rule. |
| packages/squad-cli/src/cli/core/upgrade.ts | Adds --dry-run preview and backs up customized squad.agent.md prior to overwrite. |
| packages/squad-cli/src/cli/core/command-help.ts | Updates upgrade help text to describe backup + --dry-run. |
| packages/squad-cli/src/cli/commands/state-mcp.ts | Refactors to lazy tool registry initialization inside MCP request handlers. |
| packages/squad-cli/src/cli/commands/build.ts | Uses effectiveSquadDir() so generated .squad/* files write to external state dir when externalized. |
| packages/squad-cli/src/cli-entry.ts | Adds help lines for externalize/internalize; wires --dry-run through to upgrade. |
| .changeset/cli-upgrade-fixes.md | Changeset documenting the bundled fixes for CLI + SDK patch releases. |
Copilot's findings
- Files reviewed: 9/9 changed files
- Comments generated: 5
|
Reviewed this — one blocking issue in the Blocking:
|
- Require word boundary before @ in routing and direct-response (no email false positives) - Fix logic: known agent AND not coordinator (was incorrectly OR) - Narrow agentsArrayPattern to skip routing-rule string arrays - Normalize template content to LF before comparison in upgrade - Add tests for @agent mention routing behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tamirdresher
left a comment
There was a problem hiding this comment.
Re-reviewed at head fc2623b6. The ||→&& fix and the (?:^|\s)@(...) word-boundary regex are both in, direct-response.ts is aligned, onboarding.ts no longer corrupts string-only agent arrays, and test/routing.test.ts covers the @lead / @coordinator / email cases. Thanks for the fast turnaround — LGTM ✅
Summary
Fixes six CLI and upgrade issues in a single batch:
Issues Fixed
squad externalizeandsquad internalizemissing fromsquad --helpoutput #1050 —squad externalizeandsquad internalizenow appear insquad --helpoutputsquad buildwrites generated files to the externalized state directory when state is externalsquad new agentcorrectly adds agent definitions to theagentsarray insquad.config.ts(not just routing rules)squad upgradebacks up customizedsquad.agent.mdbefore overwriting; new--dry-runflag previews changes@agentmentions (e.g.,@bishop) bypass theDirectResponseHandlerand route directly to the named agentstate-mcpserver uses lazy registry initialization so it connects to the MCP transport immediately without blocking on state resolutionChanges
cli-entry.ts--dry-runflag for upgradebuild.tseffectiveSquadDir()state-mcp.tscommand-help.ts--dry-runupgrade.tssquad.agent.md; dry-run previewonboarding.tsaddAgentToConfigto add to agents arrayrouting.ts@agentmention detection at top ofmatchRoutedirect-response.ts@mentionNotes
cross-squad.ts,migrate-backend.ts, andinit.ts(missing SDK exports) are not caused by this PRdevCloses #1050, Closes #1048, Closes #1047, Closes #1052, Closes #1029, Closes #1353