Skip to content

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

Open
tamirdresher wants to merge 2 commits into
devfrom
tamirdresher-microsoft-super-dollop
Open

feat(init): default VS Code chat sessions to Squad#1485
tamirdresher wants to merge 2 commits 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.

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

github-actions Bot commented Jul 14, 2026

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

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 d84e369

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 2 item(s) to address before review

Status Check Details
Single commit 2 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 2 active Copilot thread(s) resolved (1 outdated skipped)
CI passing All checks passing

Files Changed (8 files, +303 −5)

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 +1 −0
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 +205 −0

Total: +303 −5


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 thread packages/squad-cli/src/cli-entry.ts
Comment thread packages/squad-cli/package.json Outdated
Comment thread packages/squad-cli/src/cli/core/init.ts
@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.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Friendly nudge — this PR has had no activity for 7 days.

What needs attention:

  • 💬 3 unresolved review thread(s) (3 from Copilot). Address and resolve them.
  • 👀 No approving reviews yet. Request a review from a teammate.
  • ⬇️ 16 commits behind dev. Rebase to pick up latest changes.

If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows.
This is an automated check that runs on weekdays. It won't nudge the same PR more than once per week.

bradygaster added a commit that referenced this pull request Jul 27, 2026
- Fix mojibake in packages/squad-cli/package.json description
- Fix --no-vscode-default help alignment in cli-entry.ts (split into
  separate console.log call matching surrounding indentation pattern)
- Add regression test: isGlobal:true does not create .vscode/settings.json

Closes #1486

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a05b5960-2854-438d-976d-2bc01816ee70
@bradygaster

Copy link
Copy Markdown
Owner

The three self-review blockers are fixed in e8ddcb0; focused tests pass 9/9 and the full build passes. Fresh CI's Policy Gates failure is branch staleness, not the fix: this branch still has @bradygaster/squad-cli@0.11.0-build.1 while current dev is 0.11.0. Per the approved sequence, hold this PR until #1445 lands, then rebase onto current dev, squash if desired, rerun CI, and request final approval.

@bradygaster

Copy link
Copy Markdown
Owner

#1445 has now merged — the blocker that was holding this PR is gone.

@tamirdresher please take the following steps to move this forward:

  1. Rebase tamirdresher-microsoft-super-dollop onto current dev (do not force-push; open a new commit on the branch or squash via a clean rebase — never rewrite the branch history in a way that breaks the contributor's commit chain).
  2. Ensure the version references resolve to 0.11.0 (not 0.11.0-build.1) after the rebase.
  3. Push the rebased branch so CI re-runs. The Policy Gates failure is solely branch staleness — a clean rebase onto dev should clear it.
  4. Once CI is fully green, request a formal review/approval and resolve any remaining Copilot review threads.

No code changes are expected from you in this pass — the three self-review items (@tamirdresher comment 2026-07-17, fixed in e8ddcb08) are already addressed. This is purely a rebase + CI + approval step.

— Flight 🏗️ (monitor pass, 2026-07-27)

Copilot and others added 2 commits July 28, 2026 15:53
- 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>
- Fix mojibake in packages/squad-cli/package.json description
- Fix --no-vscode-default help alignment in cli-entry.ts (split into
  separate console.log call matching surrounding indentation pattern)
- Add regression test: isGlobal:true does not create .vscode/settings.json

Closes #1486

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a05b5960-2854-438d-976d-2bc01816ee70
@tamirdresher
tamirdresher force-pushed the tamirdresher-microsoft-super-dollop branch from e8ddcb0 to d84e369 Compare July 28, 2026 13:58
@tamirdresher

Copy link
Copy Markdown
Collaborator Author

@bradygaster This is rebased onto latest dev, version cleanup done (@bradygaster/squad-cli restored to 0.11.0), all 3 outstanding review threads resolved (help text split, package description mojibake fixed, global-init regression test added), and all CI checks including Policy Gates are green. Ready for your review/approval whenever you have a chance.

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

3 participants