Skip to content

feat(code): session inspector — branches, worktrees, env#3727

Merged
BunsDev merged 1 commit into
mainfrom
feat/code-inspector
Jul 23, 2026
Merged

feat(code): session inspector — branches, worktrees, env#3727
BunsDev merged 1 commit into
mainfrom
feat/code-inspector

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 23, 2026

Copy link
Copy Markdown
Member

Fifth slice of the dedicated Code surface (cave-k0ua, series: #3716#3719#3722#3724).

What

The workbench grows a toggleable right-hand inspector (ph:sliders-bold in the session header, aria-pressed, md+ only):

  • Session env — harness, model, work root, last-updated.
  • Branches — local branch list with current-✓ and worktree-⑂ marks, one-click switch.
  • New worktree — branch name → fresh worktree provisioning.

How

  • Reuses the exact /api/changes contracts chat's composer git chip speaks: ?branches=1, action=switch-branch, action=create-worktree. No API changes.
  • Every call scoped to the session's work root (cave-9q24): worktree sessions mutate their own checkout, never the shared root.
  • dynamic() import keyed by work root; mutations call through to onTasksRefresh so the enriched session list (branch chips) re-polls.
  • Narrow-screen treatment deferred to the mobile layout pass (next PR).

Verification

  • Pin suite code-surface-mode.test.ts extended (work-root scoping, ?branches=1 contract, switch/create action pins, toggle accessibility, refresh threading)
  • tsc --noEmit, eslint clean
  • Full pnpm test:app (892 files) + pnpm test:api (239 files) green

Fifth slice of the dedicated Code surface (cave-k0ua): the workbench grows a
toggleable right-hand inspector panel.

- code-inspector.tsx: session env rows (harness/model/root/updated), local
  branch list with one-click switch, and fresh-worktree provisioning — the
  same /api/changes contracts chat's composer git chip uses (?branches=1,
  action=switch-branch, action=create-worktree), scoped to the session's
  work root (cave-9q24: worktree sessions mutate their own checkout).
- code-workbench.tsx: header toggle (ph:sliders-bold, aria-pressed) shows the
  inspector as a w-72 border-l column on md+; dynamic() import; keyed by work
  root; narrow-screen treatment deferred to the mobile layout pass.
- code-view.tsx: threads onTasksRefresh into the workbench so branch/worktree
  mutations re-poll the enriched session list (branch chips stay honest).
- code-surface-mode.test.ts: inspector pin section (work-root scoping,
  ?branches=1 contract, switch/create actions, toggle accessibility, refresh
  threading).

Verified: pin suite, tsc --noEmit, eslint, 892 app + 239 api test files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 20:03

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 a toggleable right-hand Session Inspector to the Code workbench (md+), surfacing session environment details plus branch/worktree controls by reusing the existing /api/changes contracts and threading refresh back into the enriched session list.

Changes:

  • Added CodeInspector (env + branches + create worktree) and mounted it as an optional right-side panel in CodeWorkbench.
  • Threaded an onRefresh callback from CodeViewCodeWorkbenchCodeInspector so inspector mutations can trigger a session-list re-poll.
  • Extended code-surface-mode.test.ts to pin inspector wiring and /api/changes contract usage.

Reviewed changes

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

File Description
src/components/code-workbench.tsx Adds inspector toggle + right-side inspector column and refresh threading hook.
src/components/code-view.tsx Passes workspace refresh callback into the workbench.
src/components/code-surface-mode.test.ts Adds pins asserting inspector contract usage, toggle accessibility, and refresh wiring.
src/components/code-inspector.tsx New inspector panel implementing env/branches/worktree UI backed by /api/changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

aria-label="Session inspector"
className="hidden w-72 shrink-0 border-l border-[var(--border-hairline)] md:block"
>
<LazyInspector key={workRoot} row={row} onChanged={onRefresh} />
);
assert.match(
workbench,
/<LazyInspector key=\{workRoot\} row=\{row\} onChanged=\{onRefresh\} \/>/,
Comment on lines +179 to +184
<span
className="shrink-0 text-[length:var(--text-2xs)] text-[var(--text-muted)]"
title={b.worktreePath ?? undefined}
>
⑂ {b.worktree}
</span>
@BunsDev
BunsDev merged commit 68d5f1d into main Jul 23, 2026
16 checks passed
@BunsDev
BunsDev deleted the feat/code-inspector branch July 23, 2026 20:42
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.

2 participants