claudeup 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,503 @@
1
+ /**
2
+ * update-engine.ts — applying an update plan. The ONLY implementation.
3
+ *
4
+ * This used to live inside `cli/update.ts`, which meant the TUI could not reach
5
+ * it and grew its own loop in `PluginsScreen.handleUpdateAll`. The two drifted
6
+ * exactly where you would expect:
7
+ *
8
+ * - the CLI advanced **every scope** holding an outdated install; the TUI
9
+ * updated one, derived from whichever scope tab was open, so drift in the
10
+ * others survived and reappeared on the next run;
11
+ * - the CLI recorded the version it **read back** after installing; the TUI
12
+ * recorded the version it had *expected*, which is the bug the CLI's own
13
+ * comments describe at length — `claude plugin install` takes no version
14
+ * argument, so writing the intended value made `install --check` compare a
15
+ * pin against a copy of itself and report clean forever;
16
+ * - only the CLI reported pins the installer could not honour.
17
+ *
18
+ * None of that was a decision. It was two copies of one idea, edited apart.
19
+ *
20
+ * So the engine lives here, in `services/`, and both front ends drive it.
21
+ * `cli/` and `ui/` are sibling presentation layers: they own how progress looks
22
+ * and nothing else. Everything IO-shaped is injected — `PluginApplyDeps` for
23
+ * the five Claude Code calls, `ApplyReporter` for progress, `runCommand` for
24
+ * installers — so the same code drives an animated terminal meter, a TUI modal,
25
+ * and a test that wants silence.
26
+ *
27
+ * NOTHING HERE PRINTS. A `console.log` in this file is a layering violation:
28
+ * the CLI paints an animated region that a stray write corrupts, and the TUI
29
+ * has no stdout to write to at all.
30
+ */
31
+
32
+ import path from "node:path";
33
+ import type { PluginScope } from "./claude-cli.js";
34
+ import { installPlugin, repairPlugin, updatePlugin } from "./claude-cli.js";
35
+ import {
36
+ readInstalledVersionForScope,
37
+ saveInstalledPluginVersionForScope,
38
+ } from "./plugin-manager.js";
39
+ import { installSkill } from "./skills-manager.js";
40
+ import { binInstallCommand, binUpgradeCommand } from "./toolchain.js";
41
+ import type { PluginUpdateItem, UpdatePlan } from "./update-plan.js";
42
+ import type { ProfileSkillRef, SkillInfo } from "../types/index.js";
43
+ import type { Command } from "../utils/command-utils.js";
44
+ import { formatCommand } from "../utils/command-utils.js";
45
+ import { runCommand } from "../utils/run.js";
46
+
47
+ // -- results -----------------------------------------------------------------
48
+
49
+ export interface ApplyResult {
50
+ ok: number;
51
+ failed: string[];
52
+ }
53
+
54
+ /** An exact pin the installer could not deliver, discovered by reading back. */
55
+ export interface PinMismatch {
56
+ pluginId: string;
57
+ pinned: string;
58
+ actual: string | null;
59
+ scope: PluginScope;
60
+ }
61
+
62
+ export interface PluginApplyResult extends ApplyResult {
63
+ mismatches: PinMismatch[];
64
+ }
65
+
66
+ /** Everything one full apply produced, for whichever front end is reporting. */
67
+ export interface UpdateOutcome {
68
+ plugins: PluginApplyResult;
69
+ bins: ApplyResult;
70
+ skills: ApplyResult;
71
+ /** Items that changed, across all three. */
72
+ changed: number;
73
+ /** Names that failed, across all three. */
74
+ failed: string[];
75
+ }
76
+
77
+ // -- injected edges ----------------------------------------------------------
78
+
79
+ /**
80
+ * How the apply loop reports itself.
81
+ *
82
+ * Injected rather than hard-coded, because the loop is the same work whether it
83
+ * is driving an animated meter, a TUI modal, or a test that wants silence.
84
+ */
85
+ export interface ApplyReporter {
86
+ /** An item is starting. Called before any of its work. */
87
+ begin(name: string): void;
88
+ /** An item finished. `detail` is already formatted for display. */
89
+ finish(ok: boolean, name: string, detail: string, ms: number): void;
90
+ /**
91
+ * Run `work` with the terminal released.
92
+ *
93
+ * A binary upgrade spawns `brew`/`uv` with inherited stdio: it writes and
94
+ * moves the cursor itself, so any animated block must be erased first or the
95
+ * two interleave into garbage. A TUI implementation suspends its renderer;
96
+ * a silent one just awaits.
97
+ */
98
+ detach<T>(work: () => Promise<T>): Promise<T>;
99
+ }
100
+
101
+ /** Reports nothing. The right default for a caller that renders its own state. */
102
+ export const SILENT_REPORTER: ApplyReporter = {
103
+ begin: () => {},
104
+ finish: () => {},
105
+ detach: (work) => work(),
106
+ };
107
+
108
+ /**
109
+ * The four side-effecting calls the plugin apply path makes, injectable so the
110
+ * path itself can be tested.
111
+ *
112
+ * This exists because the apply half shipped with no coverage while the pure
113
+ * planner had forty tests — and every real defect found in review lived here,
114
+ * not there.
115
+ */
116
+ export interface PluginApplyDeps {
117
+ /**
118
+ * A plugin NOT installed at this scope yet.
119
+ *
120
+ * Separate from {@link PluginApplyDeps.update} because the two are separate
121
+ * Claude Code commands that each no-op in the other's case — see the note on
122
+ * `updatePlugin` in claude-cli.ts.
123
+ */
124
+ install: (pluginId: string, scope: PluginScope) => Promise<void>;
125
+ update: (pluginId: string, scope: PluginScope) => Promise<void>;
126
+ repair: (
127
+ pluginId: string,
128
+ scope: PluginScope,
129
+ projectPath: string,
130
+ ) => Promise<void>;
131
+ readInstalled: (
132
+ pluginId: string,
133
+ scope: PluginScope,
134
+ projectPath: string,
135
+ ) => Promise<string | null>;
136
+ saveInstalled: (
137
+ pluginId: string,
138
+ version: string,
139
+ scope: PluginScope,
140
+ projectPath: string,
141
+ ) => Promise<void>;
142
+ }
143
+
144
+ export const REAL_PLUGIN_DEPS: PluginApplyDeps = {
145
+ install: installPlugin,
146
+ update: updatePlugin,
147
+ repair: repairPlugin,
148
+ readInstalled: readInstalledVersionForScope,
149
+ saveInstalled: saveInstalledPluginVersionForScope,
150
+ };
151
+
152
+ // -- selection ---------------------------------------------------------------
153
+
154
+ /**
155
+ * Scopes the apply loop would touch for `item`. Empty means it is skipped.
156
+ *
157
+ * A plugin the profile declares but nothing has installed goes in at PROJECT
158
+ * scope, matching `install`: a profile is a property of one repo, so its
159
+ * plugins must not be enabled machine-wide.
160
+ *
161
+ * Every scope holding an outdated install is returned, not just one. The
162
+ * prerunner learned this the expensive way: it detected drift, "fixed" it at
163
+ * user scope and reported success, leaving the project row untouched so the
164
+ * same drift reappeared on every run.
165
+ */
166
+ function scopesToApply(item: PluginUpdateItem): PluginScope[] {
167
+ if (item.action === "current" || item.action === "unknown") return [];
168
+ return item.action === "install" ? ["project"] : item.scopes;
169
+ }
170
+
171
+ /**
172
+ * Whether the apply loop will do anything for `item`.
173
+ *
174
+ * Exported for ONE reason: a progress meter's denominator must be the same
175
+ * predicate the loop applies. Re-deriving it at the call site is how the two
176
+ * drift, and a bar that stops short of full at the end of a successful run
177
+ * looks exactly like a hang.
178
+ */
179
+ export function pluginNeedsWork(item: PluginUpdateItem): boolean {
180
+ return scopesToApply(item).length > 0;
181
+ }
182
+
183
+ // -- plugins -----------------------------------------------------------------
184
+
185
+ /**
186
+ * Advance a plugin at `scope`, choosing the command by whether THIS project
187
+ * actually holds an install row there.
188
+ *
189
+ * The check is not defensive tidiness — without it `update` mutates a project
190
+ * nobody named. `claude plugin update --scope project` resolves the project
191
+ * from the CLI's working directory, and when that directory has no row for the
192
+ * plugin it falls back to some OTHER project's row and updates that one.
193
+ * Measured on Claude Code 2.1.252, run from a directory with no madbench row:
194
+ *
195
+ * $ claude plugin update madbench@magus --scope project
196
+ * ✔ Plugin "madbench" updated from 0.2.4 to 0.3.0 for scope project
197
+ * (/Users/jack/mag/tmux-mcp). Restart to apply changes.
198
+ *
199
+ * `/Users/jack/mag/tmux-mcp` was not the working directory and had nothing to
200
+ * do with the request. `plugin install` has no such fallback — it keys on the
201
+ * working directory — so the absent case must go there instead.
202
+ *
203
+ * This is live for git worktrees in particular: claudeup resolves a worktree's
204
+ * installed version by inheriting the parent repo's rows, so a worktree can
205
+ * report "0.2.4 installed, 0.3.0 available" while owning no row of its own.
206
+ * That is exactly the shape that used to reach `update`.
207
+ *
208
+ * `readInstalled` matches the project path EXACTLY (no worktree inheritance),
209
+ * which is what makes it the right question to ask here.
210
+ */
211
+ async function advanceInScope(
212
+ deps: PluginApplyDeps,
213
+ pluginId: string,
214
+ scope: PluginScope,
215
+ projectPath: string,
216
+ ): Promise<void> {
217
+ const here = await deps.readInstalled(pluginId, scope, projectPath);
218
+ if (here) await deps.update(pluginId, scope);
219
+ else await deps.install(pluginId, scope);
220
+ }
221
+
222
+ export async function applyPlugins(
223
+ items: PluginUpdateItem[],
224
+ projectPath: string,
225
+ deps: PluginApplyDeps = REAL_PLUGIN_DEPS,
226
+ report: ApplyReporter = SILENT_REPORTER,
227
+ ): Promise<PluginApplyResult> {
228
+ const result: PluginApplyResult = { ok: 0, failed: [], mismatches: [] };
229
+
230
+ for (const item of items) {
231
+ const scopes = scopesToApply(item);
232
+ if (scopes.length === 0) continue;
233
+
234
+ report.begin(item.pluginId);
235
+ const startedAt = Date.now();
236
+
237
+ try {
238
+ for (const scope of scopes) {
239
+ // Three actions, three DIFFERENT Claude Code commands. Each is a
240
+ // silent no-op in the other two cases:
241
+ // repair — same version, changed files: only uninstall+install
242
+ // re-copies; `update` sees no version bump to act on.
243
+ // install — absent at this scope: `update` answers "already at the
244
+ // latest version" and installs nothing.
245
+ // update — installed but behind: `install` answers "already
246
+ // installed", ignores the version, and exits 0.
247
+ // Folding install and update together is the bug that made every
248
+ // claudeup update path do nothing while reporting success.
249
+ if (item.action === "repair") {
250
+ await deps.repair(item.pluginId, scope, projectPath);
251
+ } else if (item.action === "install") {
252
+ await deps.install(item.pluginId, scope);
253
+ } else {
254
+ await advanceInScope(deps, item.pluginId, scope, projectPath);
255
+ }
256
+
257
+ // Record what LANDED, not what we asked for.
258
+ //
259
+ // `claude plugin install` accepts no version, so an exact pin is a
260
+ // request the installer cannot honour — it fetches whatever the
261
+ // marketplace publishes now. Writing `item.target` here recorded the
262
+ // pin as satisfied whatever actually installed, and `install --check`
263
+ // reads that same field to decide whether the machine has drifted.
264
+ // The gate would have compared the pin against a copy of itself and
265
+ // reported clean forever.
266
+ const actual = await deps.readInstalled(
267
+ item.pluginId,
268
+ scope,
269
+ projectPath,
270
+ );
271
+ if (actual) {
272
+ await deps.saveInstalled(item.pluginId, actual, scope, projectPath);
273
+ }
274
+ if (item.pinned !== "latest" && actual !== item.pinned) {
275
+ result.mismatches.push({
276
+ pluginId: item.pluginId,
277
+ pinned: item.pinned,
278
+ actual,
279
+ scope,
280
+ });
281
+ }
282
+ }
283
+ report.finish(
284
+ true,
285
+ item.pluginId,
286
+ `${scopes.join(", ")}${item.target ? ` → ${item.target}` : ""}`,
287
+ Date.now() - startedAt,
288
+ );
289
+ result.ok++;
290
+ } catch (error) {
291
+ const msg = error instanceof Error ? error.message : String(error);
292
+ report.finish(false, item.pluginId, msg, Date.now() - startedAt);
293
+ result.failed.push(item.pluginId);
294
+ }
295
+ }
296
+
297
+ return result;
298
+ }
299
+
300
+ /**
301
+ * One plugin, ONE explicitly chosen scope, recording what landed.
302
+ *
303
+ * For the scope-targeted actions — a menu where the user picked "install in user
304
+ * scope" — where {@link applyPlugins}'s "every scope that is behind" would
305
+ * override the choice they just made.
306
+ *
307
+ * These exist so those call sites still get the read-back: writing the version
308
+ * you EXPECTED is the bug documented at length in `applyPlugins`, and it was
309
+ * live in the TUI's per-scope menu long after the CLI had fixed it.
310
+ *
311
+ * They take no version parameter, deliberately: there is nothing for a caller
312
+ * to pass that could be wrong.
313
+ */
314
+ async function applyOneInScope(
315
+ run: (pluginId: string, scope: PluginScope) => Promise<void>,
316
+ pluginId: string,
317
+ scope: PluginScope,
318
+ projectPath: string,
319
+ deps: PluginApplyDeps,
320
+ ): Promise<string | null> {
321
+ await run(pluginId, scope);
322
+ const actual = await deps.readInstalled(pluginId, scope, projectPath);
323
+ if (actual) await deps.saveInstalled(pluginId, actual, scope, projectPath);
324
+ return actual;
325
+ }
326
+
327
+ /**
328
+ * Install a plugin NOT yet present at `scope`.
329
+ *
330
+ * This used to cover updating too, on the premise that `installPlugin` and
331
+ * `updatePlugin` issued the identical command. They no longer do, and never
332
+ * safely did: `claude plugin install` ignores the version of an install that is
333
+ * already there. Sending an update through here is why the TUI's scope menu
334
+ * reported success and changed nothing. Use {@link updatePluginInScope}.
335
+ *
336
+ * @returns the version actually on disk afterwards, or null if it could not be
337
+ * read — which is reported, never guessed.
338
+ */
339
+ export async function installPluginInScope(
340
+ pluginId: string,
341
+ scope: PluginScope,
342
+ projectPath: string,
343
+ deps: PluginApplyDeps = REAL_PLUGIN_DEPS,
344
+ ): Promise<string | null> {
345
+ return applyOneInScope(deps.install, pluginId, scope, projectPath, deps);
346
+ }
347
+
348
+ /**
349
+ * Advance a plugin ALREADY installed at `scope` to the latest published version.
350
+ *
351
+ * @returns the version actually on disk afterwards, or null if it could not be
352
+ * read — which is reported, never guessed.
353
+ */
354
+ export async function updatePluginInScope(
355
+ pluginId: string,
356
+ scope: PluginScope,
357
+ projectPath: string,
358
+ deps: PluginApplyDeps = REAL_PLUGIN_DEPS,
359
+ ): Promise<string | null> {
360
+ // Same guard as the apply loop, for the same reason — see advanceInScope.
361
+ return applyOneInScope(
362
+ (id, sc) => advanceInScope(deps, id, sc, projectPath),
363
+ pluginId,
364
+ scope,
365
+ projectPath,
366
+ deps,
367
+ );
368
+ }
369
+
370
+ // -- binaries ----------------------------------------------------------------
371
+
372
+ export async function applyBins(
373
+ plan: UpdatePlan,
374
+ report: ApplyReporter = SILENT_REPORTER,
375
+ // Named `run`, not `shell`. The old name was the misnomer that let a
376
+ // profile-supplied package name reach `/bin/sh`: a seam called "shell" reads
377
+ // as an invitation to hand it a string. It takes argv, and nothing here
378
+ // builds a shell line.
379
+ run: (command: Command) => Promise<boolean> = runCommand,
380
+ ): Promise<ApplyResult> {
381
+ const result: ApplyResult = { ok: 0, failed: [] };
382
+ for (const item of plan.bins) {
383
+ if (item.action === "current") continue;
384
+ const bin = plan.binSpecs.get(item.name);
385
+ if (!bin) continue;
386
+ const cmd =
387
+ item.action === "install"
388
+ ? binInstallCommand(bin)
389
+ : binUpgradeCommand(bin);
390
+ report.begin(item.name);
391
+ const startedAt = Date.now();
392
+ // The installer owns the terminal for the duration: it streams its own
393
+ // output through inherited stdio.
394
+ const succeeded = await report.detach(() => run(cmd));
395
+ // The reporter renders; only the argv above is executed.
396
+ report.finish(
397
+ succeeded,
398
+ item.name,
399
+ formatCommand(cmd),
400
+ Date.now() - startedAt,
401
+ );
402
+ if (succeeded) result.ok++;
403
+ else result.failed.push(item.name);
404
+ }
405
+ return result;
406
+ }
407
+
408
+ // -- skills ------------------------------------------------------------------
409
+
410
+ /** Map a manifest skill ref to the SkillInfo shape installSkill expects. */
411
+ function toSkillInfo(ref: ProfileSkillRef): SkillInfo {
412
+ return {
413
+ id: `${ref.repo}/${ref.path}`,
414
+ name: ref.name,
415
+ source: {
416
+ label: ref.repo,
417
+ repo: ref.repo,
418
+ skillsPath: path.dirname(ref.path),
419
+ },
420
+ repoPath: ref.path,
421
+ gitBlobSha: "",
422
+ frontmatter: null,
423
+ installed: false,
424
+ installedScope: null,
425
+ hasUpdate: false,
426
+ };
427
+ }
428
+
429
+ export async function applySkills(
430
+ plan: UpdatePlan,
431
+ projectPath: string,
432
+ report: ApplyReporter = SILENT_REPORTER,
433
+ install: typeof installSkill = installSkill,
434
+ ): Promise<ApplyResult> {
435
+ const result: ApplyResult = { ok: 0, failed: [] };
436
+ for (const item of plan.skills) {
437
+ report.begin(item.name);
438
+ const startedAt = Date.now();
439
+ try {
440
+ await install(toSkillInfo(item.ref), "project", projectPath);
441
+ report.finish(true, item.name, item.ref.repo, Date.now() - startedAt);
442
+ result.ok++;
443
+ } catch (error) {
444
+ const msg = error instanceof Error ? error.message : String(error);
445
+ report.finish(false, item.name, msg, Date.now() - startedAt);
446
+ result.failed.push(item.name);
447
+ }
448
+ }
449
+ return result;
450
+ }
451
+
452
+ // -- the whole plan ----------------------------------------------------------
453
+
454
+ export interface ApplyPlanOptions {
455
+ deps?: PluginApplyDeps;
456
+ report?: ApplyReporter;
457
+ /** Installer execution seam — see the note on {@link applyBins}. */
458
+ run?: (command: Command) => Promise<boolean>;
459
+ }
460
+
461
+ /**
462
+ * Apply a whole plan: plugins, then binaries, then skills.
463
+ *
464
+ * Order matters. Plugins first because a binary requirement is declared BY a
465
+ * plugin, so installing the plugin is what makes the requirement real; skills
466
+ * last because they are the only re-fetched-every-time item and a failure there
467
+ * must not stop the two that actually advance versions.
468
+ */
469
+ export async function applyPlan(
470
+ plan: UpdatePlan,
471
+ projectPath: string,
472
+ opts: ApplyPlanOptions = {},
473
+ ): Promise<UpdateOutcome> {
474
+ const report = opts.report ?? SILENT_REPORTER;
475
+ const plugins = await applyPlugins(
476
+ plan.plugins,
477
+ projectPath,
478
+ opts.deps ?? REAL_PLUGIN_DEPS,
479
+ report,
480
+ );
481
+ const bins = await applyBins(plan, report, opts.run);
482
+ const skills = await applySkills(plan, projectPath, report);
483
+
484
+ return {
485
+ plugins,
486
+ bins,
487
+ skills,
488
+ changed: plugins.ok + bins.ok + skills.ok,
489
+ failed: [...plugins.failed, ...bins.failed, ...skills.failed],
490
+ };
491
+ }
492
+
493
+ /**
494
+ * The items `applyPlan` will actually touch — a progress denominator that
495
+ * cannot drift from the loops, because it is derived from the same predicates.
496
+ */
497
+ export function planWorkItems(plan: UpdatePlan): string[] {
498
+ return [
499
+ ...plan.plugins.filter(pluginNeedsWork).map((p) => p.pluginId),
500
+ ...plan.bins.filter((b) => b.action !== "current").map((b) => b.name),
501
+ ...plan.skills.map((s) => s.name),
502
+ ];
503
+ }
@@ -1,17 +1,38 @@
1
1
  import React from "react";
2
2
  import type { CliTool } from "../../data/cli-tools.js";
3
+ import {
4
+ type InstallMethod,
5
+ cliToolInstall,
6
+ cliToolUninstall,
7
+ } from "../../services/cli-tool-commands.js";
8
+ import type { Command } from "../../utils/command-utils.js";
9
+ import { formatCommand } from "../../utils/command-utils.js";
3
10
  import { theme, type UiColor } from "../theme.js";
4
11
 
5
- // ─── Status type ───────────────────────────────────────────────────────────────
12
+ // ─── Helpers ────────────────────────────────────────────────────────────────
6
13
 
7
- export type InstallMethod =
8
- | "npm"
9
- | "bun"
10
- | "pnpm"
11
- | "yarn"
12
- | "brew"
13
- | "pip"
14
- | "unknown";
14
+ /**
15
+ * The uninstall command as a line the reader can copy.
16
+ *
17
+ * This used to be a second, hand-written copy of the screen's own uninstall
18
+ * switch — same shape, and already drifted (`pip uninstall` here,
19
+ * `pip uninstall -y` there). Both spelled a bare `pip`, which on many machines
20
+ * is not an executable. Now the renderer and the screen ask the same function,
21
+ * so what is shown is what would run.
22
+ *
23
+ * Empty string when there is nothing to offer, which is what the caller
24
+ * interpolates into the conflict list.
25
+ */
26
+ function uninstallHint(
27
+ tool: CliTool,
28
+ method: InstallMethod,
29
+ brewFormula?: string,
30
+ ): string {
31
+ const cmd = cliToolUninstall(tool, method, brewFormula);
32
+ return cmd ? formatCommand(cmd) : "";
33
+ }
34
+
35
+ // ─── Status type ───────────────────────────────────────────────────────────────
15
36
 
16
37
  export interface CliToolStatus {
17
38
  tool: CliTool;
@@ -22,35 +43,10 @@ export interface CliToolStatus {
22
43
  checking: boolean;
23
44
  installMethod?: InstallMethod;
24
45
  allMethods?: InstallMethod[];
25
- updateCommand?: string;
46
+ updateCommand?: Command;
26
47
  brewFormula?: string;
27
48
  }
28
49
 
29
- // ─── Helpers ────────────────────────────────────────────────────────────────
30
-
31
- function getUninstallHint(
32
- tool: CliTool,
33
- method: InstallMethod,
34
- brewFormula?: string,
35
- ): string {
36
- switch (method) {
37
- case "bun":
38
- return `bun remove -g ${tool.packageName}`;
39
- case "npm":
40
- return `npm uninstall -g ${tool.packageName}`;
41
- case "pnpm":
42
- return `pnpm remove -g ${tool.packageName}`;
43
- case "yarn":
44
- return `yarn global remove ${tool.packageName}`;
45
- case "brew":
46
- return `brew uninstall ${brewFormula || tool.name}`;
47
- case "pip":
48
- return `pip uninstall ${tool.packageName}`;
49
- default:
50
- return "";
51
- }
52
- }
53
-
54
50
  // ─── Row renderer ──────────────────────────────────────────────────────────────
55
51
 
56
52
  export function renderCliToolRow(
@@ -192,12 +188,14 @@ export function renderCliToolDetail(
192
188
  {installed && updateCommand ? (
193
189
  <box>
194
190
  <text fg={theme.colors.muted}>{"Update "}</text>
195
- <text fg={theme.colors.accent}>{updateCommand}</text>
191
+ <text fg={theme.colors.accent}>{formatCommand(updateCommand)}</text>
196
192
  </box>
197
193
  ) : !installed ? (
198
194
  <box>
199
195
  <text fg={theme.colors.muted}>{"Install "}</text>
200
- <text fg={theme.colors.accent}>{tool.installCommand}</text>
196
+ <text fg={theme.colors.accent}>
197
+ {formatCommand(cliToolInstall(tool))}
198
+ </text>
201
199
  </box>
202
200
  ) : null}
203
201
  <box>
@@ -233,7 +231,7 @@ export function renderCliToolDetail(
233
231
  {i > 0 ? (
234
232
  <span
235
233
  fg={theme.colors.dim}
236
- >{` ${getUninstallHint(tool, method, brewFormula)}`}</span>
234
+ >{` ${uninstallHint(tool, method, brewFormula)}`}</span>
237
235
  ) : (
238
236
  <span fg={theme.colors.dim}> (active in PATH)</span>
239
237
  )}
@@ -259,7 +257,10 @@ export function renderCliToolDetail(
259
257
  Enter{" "}
260
258
  </text>
261
259
  <text fg={theme.colors.muted}> Install</text>
262
- <text fg={theme.colors.dim}> {tool.installCommand}</text>
260
+ <text fg={theme.colors.dim}>
261
+ {" "}
262
+ {formatCommand(cliToolInstall(tool))}
263
+ </text>
263
264
  </box>
264
265
  ) : hasUpdate ? (
265
266
  <box>