feat(claude): Settings → Claude per-workspace account picker (T-482 part 1)

A custom settings control under the Claude category: a dropdown of the
registered accounts plus Default. Picking one binds (or unbinds) this
workspace via the AccountRegistry and publishes set/unset on
accountActionChannel — the same channel the CLI verbs use, so the session
respawns onto the account (T-480) and the IDE lock re-syncs (T-479). It reads
live off the shared settings notifier, so a CLI `account set` updates the
dropdown too. Empty states cover no-workspace and no-accounts, each pointing at
the CLI.

Registry writes set the in-memory binding synchronously then flush, so the
control publishes the bus event before the disk write completes.

Part 2 (the global Accounts registry CRUD list + sign-in probe) is still open
on T-482. en/nl strings added; widget test covers the states + bind/unbind.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-27 23:46:43 +02:00
co-authored by Claude Opus 4.8
parent e86543d476
commit c3efcf3855
8 changed files with 414 additions and 2 deletions
+23
View File
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:clide/clide.dart';
import 'package:clide/builtin/claude/src/account_registry.dart';
import 'package:clide/builtin/claude/src/account_settings_control.dart';
import 'package:clide/builtin/claude/src/activity_cluster.dart' show foldLevelFromName, kActivityFoldLevelKey, nextFoldLevel;
import 'package:clide/builtin/claude/src/claude_config.dart';
import 'package:clide/builtin/claude/src/claude_status.dart' show nextSafePermissionMode;
@@ -198,9 +199,31 @@ class ClaudeExtension extends ClideExtension {
),
],
),
// Per-repo Claude account (T-482, epic T-476). The dropdown binds this
// workspace to a registered account; manage the registry itself with
// the `clide claude account` verbs (T-480).
SettingsSection(
label: 'Account',
labelKey: 'settings.claude.account.label',
fields: [
SettingsField(
// Placeholder key — a custom field is rendered by its control,
// never stored here; kept clear of the app.claude.account.<hash>
// binding namespace the registry scans (T-480).
key: 'app.claude.workspaceAccount',
kind: SettingsFieldKind.custom,
label: 'Account for this workspace',
labelKey: 'settings.claude.account.workspace.label',
help: 'Which Claude account this repo runs under; Default uses the system login.',
helpKey: 'settings.claude.account.workspace.help',
customId: 'claude.workspace-account',
),
],
),
],
),
),
SettingsControlContribution(id: 'claude.workspace-account', customId: 'claude.workspace-account', builder: (_) => const ClaudeWorkspaceAccountControl()),
// T-171: agent roster controls (D-6 CLI/UI parity).
// Usage: clide claude.agent.show <sessionId>
CommandContribution(