Skip to content

feat(init): default VS Code chat sessions to Squad#1485

Open
tamirdresher wants to merge 1 commit into
devfrom
tamirdresher-microsoft-super-dollop
Open

feat(init): default VS Code chat sessions to Squad#1485
tamirdresher wants to merge 1 commit into
devfrom
tamirdresher-microsoft-super-dollop

Conversation

@tamirdresher

@tamirdresher tamirdresher commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements the feature that defaults VS Code chat sessions to Squad mode during squad init,
using a JSONC-safe editor (jsonc-parser) to write "chat.newSession.defaultMode": "Squad"
to .vscode/settings.json.

Note: This is a 🟡 capability task for EECOM. Needs squad member review before merging.

Closes #1486

Behavior

  • Plain squad init creates or updates .vscode/settings.json with "chat.newSession.defaultMode": "Squad"
  • Missing file: created with that key (and .vscode/ dir if needed)
  • Existing file without key: key added, all existing settings/comments/formatting preserved
  • Key already set (any value): left untouched - user ownership respected; idempotent
  • --no-vscode-default: skips .vscode/settings.json entirely
  • Global init (--global): skipped - no .vscode/ context for personal squad config
  • Malformed settings.json: warns and continues without corrupting the file
  • Idempotent: second squad init run produces no further diff

Opt-out flag

--no-vscode-default    Skip writing chat.newSession.defaultMode to .vscode/settings.json

Follows the existing --no-<capability> naming convention (same as --no-workflows).

Changed files

  • packages/squad-cli/src/cli/core/init.ts - applyVscodeDefaultMode() function + includeVscodeDefault option
  • packages/squad-cli/src/cli-entry.ts - --no-vscode-default flag parsing + help text
  • packages/squad-cli/package.json - jsonc-parser ^3.3.1 added to dependencies
  • package-lock.json - updated for new direct dep
  • test/init-vscode-settings.test.ts - 7 new focused test cases (new file)
  • docs/src/content/docs/features/vscode.md - "Default Chat Session Mode" section added
  • docs/src/content/docs/reference/cli.md - --no-vscode-default row added
  • .changeset/init-vscode-default.md - minor bump changeset (new file)

Validation

  • tsc lint: passes - only pre-existing errors (missing @types/react, @types/ws), zero new errors
  • Tests / Build: cannot run in this sandboxed environment - npm install is blocked by a corporate proxy 404 on an unrelated transitive package (vite@8.1.4), unrelated to this change. Test file test/init-vscode-settings.test.ts covers 7 cases (missing file, existing without key, existing key with different value preserved, comments/trailing commas preserved, opt-out flag, idempotent rerun, malformed-file safety) but could not be executed locally; recommend CI run on this PR as the actual test gate.

Notes

  • squad upgrade was intentionally not modified - its scaffolding path is independent.
  • Issue feat(init): default VS Code chat sessions to Squad #1486 was created from the personal tamirdresher account after the Enterprise Managed User (EMU) account (tamirdresher_microsoft) was found to be blocked from creating issues on this external/public repo.

- Add applyVscodeDefaultMode() to packages/squad-cli/src/cli/core/init.ts using
  jsonc-parser (modify/applyEdits) for JSONC-safe, comment-preserving edits
- Create .vscode/settings.json with chat.newSession.defaultMode: Squad if absent
- Add key to existing settings.json; preserve existing value if key already set
- Add includeVscodeDefault?: boolean to RunInitOptions interface
- Wire --no-vscode-default flag in cli-entry.ts (matches existing --no-<cap> pattern)
- Add --no-vscode-default to squad init --help output
- Add jsonc-parser ^3.3.1 as direct dependency of @bradygaster/squad-cli
- Add test/init-vscode-settings.test.ts with 7 focused test cases
- Update docs/features/vscode.md and docs/reference/cli.md
- Add .changeset/init-vscode-default.md (minor bump)

Note: GitHub issue creation was blocked by Enterprise Managed User (EMU) restriction
on the tamirdresher_microsoft account — cannot create issues/PRs on external
bradygaster/squad repo via the GitHub API or gh CLI. PR is opened without
a linked issue number.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 14, 2026 16:44
@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1485

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 8
Files added 2
Files modified 6
Files deleted 0
Modules touched 4
Critical files 1

🎯 Risk Factors

  • 8 files changed (6-20 → MEDIUM)
  • 4 modules touched (2-4 → MEDIUM)
  • Critical files touched: packages/squad-cli/package.json

📦 Modules Affected

docs (2 files)
  • docs/src/content/docs/features/vscode.md
  • docs/src/content/docs/reference/cli.md
root (2 files)
  • .changeset/init-vscode-default.md
  • package-lock.json
squad-cli (3 files)
  • packages/squad-cli/package.json
  • packages/squad-cli/src/cli-entry.ts
  • packages/squad-cli/src/cli/core/init.ts
tests (1 file)
  • test/init-vscode-settings.test.ts

⚠️ Critical Files

  • packages/squad-cli/package.json

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

@github-actions

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

Copy link
Copy Markdown
Contributor

🔒 Security Review

🔒 Security review: 1 info.

Severity Category Finding Location
ℹ️ info new-dependency 1 new/changed dependency version(s) in packages/squad-cli/package.json. Verify these packages are trusted and necessary. packages/squad-cli/package.json:197

Automated security review — informational only.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

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

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 item(s) to address before review

Status Check Details
Single commit 1 commit — clean history
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 3 unresolved Copilot thread(s) — fix and resolve before merging
CI passing 1 check(s) failing: test

Files Changed (8 files, +295 −6)

File +/−
.changeset/init-vscode-default.md +5 −0
docs/src/content/docs/features/vscode.md +33 −0
docs/src/content/docs/reference/cli.md +1 −0
package-lock.json +2 −2
packages/squad-cli/package.json +2 −1
packages/squad-cli/src/cli-entry.ts +5 −3
packages/squad-cli/src/cli/core/init.ts +51 −0
test/init-vscode-settings.test.ts +196 −0

Total: +295 −6


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

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

Adds an opt-outable squad init enhancement that updates VS Code workspace settings to default new chat sessions to Squad mode by writing "chat.newSession.defaultMode": "Squad" into .vscode/settings.json using JSONC-safe edits.

Changes:

  • Add JSONC-aware .vscode/settings.json update during runInit() with includeVscodeDefault + --no-vscode-default opt-out and --global skip behavior.
  • Add focused vitest coverage for create/update/idempotency/opt-out/malformed JSON scenarios.
  • Document the new behavior and CLI flag; add a changeset and new dependency (jsonc-parser).

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/init-vscode-settings.test.ts Adds tests for the VS Code settings injection behavior and opt-out semantics.
packages/squad-cli/src/cli/core/init.ts Implements JSONC-safe injection of chat.newSession.defaultMode during init, gated by options.
packages/squad-cli/src/cli-entry.ts Adds --no-vscode-default parsing and help text (currently has a formatting issue).
packages/squad-cli/package.json Adds jsonc-parser dependency (description currently has encoding/mojibake).
package-lock.json Lockfile updates for the new direct dependency.
docs/src/content/docs/reference/cli.md Documents the new --no-vscode-default flag.
docs/src/content/docs/features/vscode.md Documents “Default Chat Session Mode” behavior and opt-out.
.changeset/init-vscode-default.md Changeset for a minor bump describing the new init behavior.

Comment on lines 158 to 162
console.log(` --roles (use base roles)`);
console.log(` --global (personal squad dir)`);
console.log(` --no-workflows (skip CI setup)`);
console.log(` --no-workflows (skip CI setup)
--no-vscode-default (skip .vscode/settings.json update)`);
console.log(` --preset <name> (apply a preset after init)`);
"name": "@bradygaster/squad-cli",
"version": "0.11.0",
"description": "Squad CLI Command-line interface for the Squad multi-agent runtime",
"description": "Squad CLI \u00e2\u20ac\u201d Command-line interface for the Squad multi-agent runtime",
Comment on lines +482 to +489
// Apply VS Code default chat session mode (opt-out: --no-vscode-default)
if (options.includeVscodeDefault !== false && !options.isGlobal) {
try {
await applyVscodeDefaultMode(dest);
} catch {
console.warn(`${YELLOW}⚠ could not apply VS Code default mode setting${RESET}`);
}
}
@tamirdresher

Copy link
Copy Markdown
Collaborator Author

Self-review notes before this can go in — I can't formally request changes on my own PR, but the following three items are still required before merge. Head verified at 4a43c0125d37185ed61ee90b47fb39e74faca77a.

  1. Fix the mojibake in packages/squad-cli/package.json description. It currently reads "Squad CLI — Command-line ..." (raw bytes \u00e2\u20ac\u201d) because a UTF-8 em-dash was decoded as CP1252 and re-encoded into JSON. Replace it with either a literal or --. This will otherwise ship to the npm registry as garbled text.

  2. Fix the --no-vscode-default help output in packages/squad-cli/src/cli-entry.ts. The --no-vscode-default line is currently concatenated inside the same template literal that owns --no-workflows, with a bare newline and no indentation, so squad init --help prints it flush-left and misaligned relative to every other flag. Give it its own console.log(...) line matching the surrounding indentation and spacing.

  3. Add an explicit regression test that --global init does NOT write .vscode/settings.json. The guard !options.isGlobal in runInit exists, but test/init-vscode-settings.test.ts never exercises isGlobal: true. Add a case that runs the init flow with { ...INIT_OPTS, isGlobal: true } in a temp dir and asserts .vscode/settings.json was not created. Without it, a future refactor can silently drop the guard.

I'll come back for another self-review pass once these are pushed.

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.

feat(init): default VS Code chat sessions to Squad

2 participants