magus-cli 7.10.3 → 7.10.5

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.
Files changed (44) hide show
  1. package/package.json +4 -4
  2. package/src/__tests__/blackbox-convergence.test.ts +0 -1
  3. package/src/__tests__/blackbox-parity.test.ts +2 -2
  4. package/src/__tests__/blackbox-tool-state.test.ts +8 -18
  5. package/src/__tests__/blind/c14-cli-row-label.test.ts +8 -3
  6. package/src/__tests__/blind/c15-probe-ownership.test.ts +11 -11
  7. package/src/__tests__/blind/c16-probe-adopts-node-global.test.ts +16 -12
  8. package/src/__tests__/blind/c17-enter-label.test.ts +42 -7
  9. package/src/__tests__/blind/c18-probe-adopts-homebrew-keg.test.ts +36 -19
  10. package/src/__tests__/blind/c19-probe-owner-version-shadow.test.ts +38 -35
  11. package/src/__tests__/cli-tool-commands.test.ts +2 -2
  12. package/src/__tests__/cli-tool-external-row.test.tsx +112 -0
  13. package/src/__tests__/cli-tools-adapter.test.ts +32 -22
  14. package/src/__tests__/cli-update-view.test.ts +124 -51
  15. package/src/__tests__/fixtures/bins.ts +9 -2
  16. package/src/__tests__/npm-package-name.test.ts +3 -2
  17. package/src/__tests__/profile-worktree-include.test.ts +212 -0
  18. package/src/__tests__/tool-adopt-brew-owner.test.ts +167 -0
  19. package/src/__tests__/tool-probe.test.ts +231 -144
  20. package/src/__tests__/tool-rows-followups.test.ts +315 -0
  21. package/src/__tests__/tool-rows-reproduction.test.ts +630 -0
  22. package/src/__tests__/tool-versions.test.ts +164 -0
  23. package/src/__tests__/toolchain.test.ts +0 -2
  24. package/src/__tests__/update-plan.test.ts +40 -9
  25. package/src/cli/update-view.ts +180 -76
  26. package/src/cli/update.ts +44 -37
  27. package/src/data/cli-tools.ts +5 -10
  28. package/src/data/tool-versions.ts +137 -0
  29. package/src/services/cli-tool-commands.ts +1 -2
  30. package/src/services/cli-tool-version.ts +10 -88
  31. package/src/services/profile-activate.ts +9 -0
  32. package/src/services/profile-live.ts +26 -0
  33. package/src/services/profile-skills.ts +14 -4
  34. package/src/services/profile-state.ts +18 -0
  35. package/src/services/resolver.ts +9 -15
  36. package/src/services/tool-probe.ts +537 -691
  37. package/src/services/toolchain.ts +10 -4
  38. package/src/services/update-engine.ts +9 -15
  39. package/src/services/update-plan.ts +49 -21
  40. package/src/types/index.ts +0 -2
  41. package/src/ui/adapters/cliToolsAdapter.ts +31 -22
  42. package/src/ui/renderers/cliToolRenderers.tsx +15 -21
  43. package/src/ui/state/types.ts +0 -1
  44. package/src/__tests__/blind/c9-cli-tool-version.test.ts +0 -239
@@ -13,6 +13,7 @@ import semver from "semver";
13
13
  import { cliTools, isOwnedEntry } from "../data/cli-tools.js";
14
14
  import { getMarketplaceByName } from "../data/marketplaces.js";
15
15
  import { PREDEFINED_PROFILES } from "../data/predefined-profiles.js";
16
+ import { presenceArgv } from "../data/tool-versions.js";
16
17
  import {
17
18
  type InstallOption,
18
19
  type Requirement,
@@ -258,13 +259,11 @@ export function pinOfBin(bin: SelectedBin): string | undefined {
258
259
  return option && "version" in option ? option.version : undefined;
259
260
  }
260
261
 
261
- /** The catalogue's check line as argv: split once, here, never by a shell. */
262
- const splitCheck = (line: string): string[] => line.trim().split(/\s+/);
263
-
264
262
  /**
265
263
  * Map a manifest cliTools entry (name -> version) onto a requirement: the
266
264
  * catalogue's installer as one option (`npm`/`pip`/`go` are the profile-only
267
- * kinds), its check as argv, the pin carried in the option. A tool a plugin
265
+ * kinds), magus's own version command as the check (`presenceArgv`), the pin
266
+ * carried in the option. A tool a plugin
268
267
  * owns (`ownedBy`) is that plugin's declaration, passed in as `owned`, with
269
268
  * the pin applied to its chosen option. An unknown tool installs with bun
270
269
  * under its own name.
@@ -293,18 +292,13 @@ export function cliToolToBin(
293
292
  : { ...owned, chosen: withPin(owned.chosen) };
294
293
  }
295
294
  const tool = cliTools.find((t) => t.name === name);
296
- let option: InstallOption;
297
- let check: string[];
298
- if (tool && !isOwnedEntry(tool)) {
299
- check = splitCheck(tool.checkCommand);
300
- option =
301
- tool.packageManager === "brew"
295
+ const check = presenceArgv(name);
296
+ const option: InstallOption =
297
+ tool && !isOwnedEntry(tool)
298
+ ? tool.packageManager === "brew"
302
299
  ? { via: "brew", formula: tool.packageName }
303
- : { via: tool.packageManager, package: tool.packageName };
304
- } else {
305
- check = [name, "--version"];
306
- option = { via: "bun", package: name };
307
- }
300
+ : { via: tool.packageManager, package: tool.packageName }
301
+ : { via: "bun", package: name };
308
302
  const requirement: Requirement = { name, check, install: [withPin(option)] };
309
303
  return (
310
304
  selectBins([requirement], undefined)[0] ?? {