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
Copy link
Copy Markdown
Contributor

@obit91 obit91 commented May 30, 2026

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 and others added 2 commits May 30, 2026 22:03
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>
@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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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
- 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>
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