feat(cli): prompt to add @copilot during squad init (#1147)#1199
feat(cli): prompt to add @copilot during squad init (#1147)#1199obit91 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an explicit, tri-state @copilot opt-in flow to squad init, including CLI flags and tests to ensure non-interactive runs don’t silently modify repos.
Changes:
- Add
--copilot / --no-copilotsupport tosquad init, with interactive prompting only when attached to a TTY. - Extract shared “add
@copilot+ copy instructions” logic into a reusable helper used by bothinitandcopilotcommands. - Add CLI tests covering default behavior, explicit opt-in/out, and idempotency.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/cli/init.test.ts | Adds coverage for @copilot opt-in/out and idempotency during init. |
| packages/squad-cli/src/cli/core/init.ts | Introduces tri-state copilot option and interactive prompt behavior after scaffolding. |
| packages/squad-cli/src/cli/commands/copilot.ts | Extracts shared helpers for adding @copilot and copying instructions template. |
| packages/squad-cli/src/cli-entry.ts | Adds flags/help text and wires parsed copilot tri-state into runInit. |
| packages/squad-cli/README.md | Documents squad init --copilot usage. |
| .changeset/init-copilot-opt-in.md | Declares a minor release and documents the new opt-in behavior/flags. |
During interactive `squad init`, offer to add @copilot as an autonomous team member. Answering yes adds the roster entry and copies .github/copilot-instructions.md inline, closing the UX gap where users had to know about the separate `squad copilot` step. Adds --copilot / --no-copilot flags for non-interactive control; non-interactive runs without an explicit flag skip silently (unchanged). Extracts addCopilotToTeam/copyCopilotInstructions helpers shared by the `squad copilot` command and init. Closes bradygaster#1147 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merge --sdk and --roles onto one help line to offset the new --copilot/--no-copilot entry, keeping `squad --help` within the 130-line speed gate (test/speed-gates.test.ts). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use fileURLToPath(import.meta.url) for robust cross-platform template path resolution - Place copilot-instructions.md at the git root (agentFileRoot) in monorepo layouts - Clarify --copilot / --no-copilot help text and the skip comment in promptCopilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7f978ee to
ccab2ee
Compare
🏗️ Architectural Review
Automated architectural review — informational only. |
🟡 Impact Analysis — PR #1199Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-cli (4 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 | 1 active Copilot thread(s) resolved (3 outdated skipped) |
| ❌ | CI passing | 7 check(s) still running |
Files Changed (6 files, +194 −17)
| File | +/− |
|---|---|
.changeset/init-copilot-opt-in.md |
+5 −0 |
packages/squad-cli/README.md |
+1 −0 |
packages/squad-cli/src/cli-entry.ts |
+9 −3 |
packages/squad-cli/src/cli/commands/copilot.ts |
+58 −14 |
packages/squad-cli/src/cli/core/init.ts |
+76 −0 |
test/cli/init.test.ts |
+45 −0 |
Total: +194 −17
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Closes #1147
Problem
Running
squad initscaffolds the team but never creates.github/copilot-instructions.md— that file (and the@copilotroster entry) was only produced by the separatesquad copilotcommand. New users who didn't know about that step got a confusing Copilot first-run experience, since Copilot had no Squad context.Change
During interactive
squad init(after scaffolding completes), Squad now prompts:@copilotroster entry and copies.github/copilot-instructions.mdinlinesquad copilotNew flags
--copilot/--no-copilotskip the prompt for scripted/non-interactive use (e.g. E2E).Implementation
addCopilotToTeamandcopyCopilotInstructionshelpers incopilot.ts, now shared by thesquad copilotcommand and init.squad copilotbehavior is unchanged.runInitgains acopilot?: booleanoption (tri-state) and apromptCopilotstep.@copilotopt-in is skipped for--global(personal squad) and when@copilotis already on the team (idempotent re-init).Tests
test/cli/init.test.ts: default non-interactive does not add @copilot;copilot: falseskips;copilot: trueadds roster + instructions; re-init is idempotent.npm run buildpasses; init + copilot suites green (25 tests).Notes
minorchangeset for@bradygaster/squad-cli.squad copilot(the issue'ssquad copilot enablephrasing); messaging usessquad copilot.