feat(env): wire supporter-binary resolution at boot (T-495)

main resolves the override map (and first-run auto-detects, using the
primed login-shell PATH) right after bootSettings.load(), exposing the
process-wide activeSupporterBinaries that tool consumers read — the d2
template (T-494) will resolve its binary through it. Analyze clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 23:07:52 +02:00
co-authored by Claude Opus 4.8
parent 0adccc5cd1
commit 62418b4010
2 changed files with 13 additions and 0 deletions
+8
View File
@@ -58,6 +58,7 @@ import 'package:clide/src/editor/registry.dart' show EditorRegistry;
import 'package:clide/src/git/client.dart';
import 'package:clide/src/cli/argv_dispatch.dart';
import 'package:clide/src/env/shell_env.dart' show primeLoginShellPath;
import 'package:clide/src/env/supporter_binaries.dart';
import 'package:clide/src/ipc/envelope.dart';
import 'package:clide/src/ipc/mcp_server.dart';
import 'package:clide/src/ipc/paths.dart' show workspaceSocketPath, logDirectory;
@@ -114,6 +115,13 @@ Future<void> main() async {
await primeLoginShellPath();
final bootSettings = SettingsStore(appDir: appDir);
await bootSettings.load();
// Resolve external supporter binaries (claude, d2, …) — explicit user-scope
// overrides first, else the primed PATH + the well-known dirs; auto-detect
// and pin them on first run (T-495, D-104).
activeSupporterBinaries = await loadSupporterBinaries(
readOverrides: () => bootSettings.get<Map>(supporterToolsKey),
writeOverrides: (m) => bootSettings.set(supporterToolsKey, m),
);
startupWorkRoot = resolveStartupWorkspace(
cwdRoot: startupWorkRoot,
lastProject: bootSettings.get<String>('app.lastProject'),