Skip to content

feat(cli): prompt to add @copilot during squad init (#1147)#1199

Open
obit91 wants to merge 3 commits into
bradygaster:devfrom
obit91:squad/1147-init-copilot-prompt
Open

feat(cli): prompt to add @copilot during squad init (#1147)#1199
obit91 wants to merge 3 commits into
bradygaster:devfrom
obit91:squad/1147-init-copilot-prompt

Conversation

@obit91

@obit91 obit91 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Closes #1147

Problem

Running squad init scaffolds the team but never creates .github/copilot-instructions.md — that file (and the @copilot roster entry) was only produced by the separate squad copilot command. 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:

Add @copilot as an autonomous team member? [y/N]

  • yes → adds the @copilot roster entry and copies .github/copilot-instructions.md inline
  • no → notes it can be added later with squad copilot
  • non-interactive (no TTY) → skips silently, preserving existing behavior

New flags --copilot / --no-copilot skip the prompt for scripted/non-interactive use (e.g. E2E).

Implementation

  • Extracted addCopilotToTeam and copyCopilotInstructions helpers in copilot.ts, now shared by the squad copilot command and init. squad copilot behavior is unchanged.
  • runInit gains a copilot?: boolean option (tri-state) and a promptCopilot step.
  • @copilot opt-in is skipped for --global (personal squad) and when @copilot is already on the team (idempotent re-init).

Tests

  • Extended test/cli/init.test.ts: default non-interactive does not add @copilot; copilot: false skips; copilot: true adds roster + instructions; re-init is idempotent.
  • npm run build passes; init + copilot suites green (25 tests).

Notes

  • Includes a minor changeset for @bradygaster/squad-cli.
  • The canonical command is squad copilot (the issue's squad copilot enable phrasing); messaging uses squad copilot.

@obit91 obit91 marked this pull request as ready for review May 30, 2026 19:36
Copilot AI review requested due to automatic review settings May 30, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-copilot support to squad init, with interactive prompting only when attached to a TTY.
  • Extract shared “add @copilot + copy instructions” logic into a reusable helper used by both init and copilot commands.
  • 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.

Comment thread packages/squad-cli/src/cli/commands/copilot.ts Outdated
Comment thread packages/squad-cli/src/cli/core/init.ts Outdated
Comment thread packages/squad-cli/src/cli/core/init.ts
Comment thread packages/squad-cli/src/cli-entry.ts Outdated
obit91 and others added 3 commits June 6, 2026 19:16
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>
@obit91 obit91 force-pushed the squad/1147-init-copilot-prompt branch from 7f978ee to ccab2ee Compare June 6, 2026 16:17
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

⚠️ Architectural review: 1 warning(s).

Severity Category Finding Files
🟡 warning bootstrap-area 1 file(s) in the bootstrap area (packages/squad-cli/src/cli/core/) were modified. These files must maintain zero external dependencies. Review carefully. packages/squad-cli/src/cli/core/init.ts

Automated architectural review — informational only.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1199

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 6
Files added 1
Files modified 5
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 6 files changed (6-20 → MEDIUM)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • .changeset/init-copilot-opt-in.md
squad-cli (4 files)
  • packages/squad-cli/README.md
  • packages/squad-cli/src/cli-entry.ts
  • packages/squad-cli/src/cli/commands/copilot.ts
  • packages/squad-cli/src/cli/core/init.ts
tests (1 file)
  • test/cli/init.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit ccab2ee

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 item(s) to address before review

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UX: squad init should prompt to add @copilot as a team member

2 participants