feat(init): default VS Code chat sessions to Squad#1485
Conversation
- 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>
🟡 Impact Analysis — PR #1485Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affecteddocs (2 files)
root (2 files)
squad-cli (3 files)
tests (1 file)
|
🏗️ Architectural Review
Automated architectural review — informational only. |
🔒 Security Review🔒 Security review: 1 info.
Automated security review — informational only. |
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| 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.
There was a problem hiding this comment.
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.jsonupdate duringrunInit()withincludeVscodeDefault+--no-vscode-defaultopt-out and--globalskip 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. |
| 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", |
| // 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}`); | ||
| } | ||
| } |
|
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
I'll come back for another self-review pass once these are pushed. |
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.Closes #1486
Behavior
squad initcreates or updates.vscode/settings.jsonwith"chat.newSession.defaultMode": "Squad".vscode/dir if needed)--no-vscode-default: skips.vscode/settings.jsonentirely--global): skipped - no.vscode/context for personal squad configsquad initrun produces no further diffOpt-out flag
Follows the existing
--no-<capability>naming convention (same as--no-workflows).Changed files
packages/squad-cli/src/cli/core/init.ts-applyVscodeDefaultMode()function +includeVscodeDefaultoptionpackages/squad-cli/src/cli-entry.ts---no-vscode-defaultflag parsing + help textpackages/squad-cli/package.json-jsonc-parser ^3.3.1added to dependenciespackage-lock.json- updated for new direct deptest/init-vscode-settings.test.ts- 7 new focused test cases (new file)docs/src/content/docs/features/vscode.md- "Default Chat Session Mode" section addeddocs/src/content/docs/reference/cli.md---no-vscode-defaultrow added.changeset/init-vscode-default.md- minor bump changeset (new file)Validation
@types/react,@types/ws), zero new errorsnpm installis blocked by a corporate proxy 404 on an unrelated transitive package (vite@8.1.4), unrelated to this change. Test filetest/init-vscode-settings.test.tscovers 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 upgradewas intentionally not modified - its scaffolding path is independent.tamirdresheraccount after the Enterprise Managed User (EMU) account (tamirdresher_microsoft) was found to be blocked from creating issues on this external/public repo.