@4pm/cli 1.5.2 → 1.5.3

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 (2) hide show
  1. package/dist/index.js +32 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -28834,18 +28834,21 @@ function isValidRoleSet(roles) {
28834
28834
 
28835
28835
  // vendor/@4pm/constants/worker-tools.ts
28836
28836
  var WORKER_TOOL_CATALOG = [
28837
- { id: "git", label: "Git", category: "vcs", versionArg: "--version", installPackage: null, installable: false },
28838
- { id: "node", label: "Node.js", category: "runtime", versionArg: "--version", installPackage: null, installable: false },
28839
- { id: "npm", label: "npm", category: "runtime", versionArg: "--version", installPackage: null, installable: false },
28840
- { id: "pnpm", label: "pnpm", category: "runtime", versionArg: "--version", installPackage: "pnpm", installable: false },
28841
- { id: "claude", label: "Claude Code", category: "ai-cli", versionArg: "--version", installPackage: "@anthropic-ai/claude-code", installable: false },
28842
- { id: "codex", label: "Codex", category: "ai-cli", versionArg: "--version", installPackage: "@openai/codex", installable: false },
28843
- { id: "gh", label: "GitHub CLI", category: "vcs", versionArg: "--version", installPackage: null, installable: false },
28844
- { id: "glab", label: "GitLab CLI", category: "vcs", versionArg: "--version", installPackage: null, installable: false }
28837
+ { id: "git", label: "Git", category: "vcs", versionArg: "--version", installPackage: null, installable: false, updatable: false },
28838
+ { id: "node", label: "Node.js", category: "runtime", versionArg: "--version", installPackage: null, installable: false, updatable: false },
28839
+ { id: "npm", label: "npm", category: "runtime", versionArg: "--version", installPackage: null, installable: false, updatable: false },
28840
+ { id: "pnpm", label: "pnpm", category: "runtime", versionArg: "--version", installPackage: "pnpm", installable: false, updatable: true },
28841
+ { id: "claude", label: "Claude Code", category: "ai-cli", versionArg: "--version", installPackage: "@anthropic-ai/claude-code", installable: false, updatable: true },
28842
+ { id: "codex", label: "Codex", category: "ai-cli", versionArg: "--version", installPackage: "@openai/codex", installable: false, updatable: true },
28843
+ { id: "gh", label: "GitHub CLI", category: "vcs", versionArg: "--version", installPackage: null, installable: false, updatable: false },
28844
+ { id: "glab", label: "GitLab CLI", category: "vcs", versionArg: "--version", installPackage: null, installable: false, updatable: false }
28845
28845
  ];
28846
28846
  var WORKER_TOOL_PREREQUISITE_IDS = WORKER_TOOL_CATALOG.filter(
28847
28847
  (t) => !t.installable
28848
28848
  ).map((t) => t.id);
28849
+ var WORKER_TOOL_UPDATABLE_IDS = WORKER_TOOL_CATALOG.filter(
28850
+ (t) => t.updatable
28851
+ ).map((t) => t.id);
28849
28852
  var WORKER_TOOL_BUNDLED_GLOBALS = ["npm", "corepack"];
28850
28853
 
28851
28854
  // vendor/@4pm/constants/ws.ts
@@ -33675,6 +33678,9 @@ var WsChannels = {
33675
33678
  TOOLS_LIST: "tools.list",
33676
33679
  TOOLS_INSTALL: "tools.install",
33677
33680
  TOOLS_UNINSTALL: "tools.uninstall",
33681
+ // update-to-latest of an npm-distributed catalog tool or an extra (ADR-0252): same streamed
33682
+ // shape as install/uninstall — the cli reinstalls the package at `@latest`.
33683
+ TOOLS_UPDATE: "tools.update",
33678
33684
  TOOLS_PROGRESS: "tools.progress",
33679
33685
  TOOLS_DONE: "tools.done",
33680
33686
  // autonomous mode control (ADR-0152): read settings+status+books+approvals, tail logs, and
@@ -37413,7 +37419,8 @@ async function listExtras() {
37413
37419
  category: "runtime",
37414
37420
  installed: true,
37415
37421
  version: info.version ?? null,
37416
- installable: true
37422
+ installable: true,
37423
+ updatable: true
37417
37424
  }));
37418
37425
  }
37419
37426
  async function detectWorkerTools() {
@@ -37426,33 +37433,39 @@ async function detectWorkerTools() {
37426
37433
  category: t.category,
37427
37434
  installed: version !== null,
37428
37435
  version,
37429
- installable: t.installable
37436
+ installable: t.installable,
37437
+ updatable: t.updatable
37430
37438
  };
37431
37439
  })
37432
37440
  );
37433
37441
  const extras = await listExtras().catch(() => []);
37434
37442
  return { catalog, extras };
37435
37443
  }
37444
+ function opPast(op) {
37445
+ return op === "install" ? "installed" : op === "uninstall" ? "uninstalled" : "updated";
37446
+ }
37436
37447
  function resolvePackage(name, op) {
37437
37448
  const entry = WORKER_TOOL_CATALOG.find((t) => t.id === name);
37438
37449
  if (entry) {
37439
- if (!entry.installable) {
37440
- return { error: `"${name}" is a prerequisite and cannot be ${op}ed from here.` };
37450
+ const allowed = op === "update" ? entry.updatable : entry.installable;
37451
+ if (!allowed) {
37452
+ return { error: `"${name}" is a prerequisite and cannot be ${opPast(op)} from here.` };
37441
37453
  }
37442
37454
  return { pkg: entry.installPackage ?? name };
37443
37455
  }
37444
37456
  if (WORKER_TOOL_PREREQUISITE_IDS.includes(name)) {
37445
- return { error: `"${name}" is a prerequisite and cannot be ${op}ed from here.` };
37457
+ return { error: `"${name}" is a prerequisite and cannot be ${opPast(op)} from here.` };
37446
37458
  }
37447
37459
  if (WORKER_TOOL_BUNDLED_GLOBALS.includes(name)) {
37448
- return { error: `"${name}" ships with Node and cannot be ${op}ed from here.` };
37460
+ return { error: `"${name}" ships with Node and cannot be ${opPast(op)} from here.` };
37449
37461
  }
37450
37462
  if (!NPM_NAME.test(name)) return { error: `Invalid package name: "${name}".` };
37451
37463
  return { pkg: name };
37452
37464
  }
37453
37465
  function opArgs(op, manager, pkg) {
37454
- if (manager === "pnpm") return [op === "install" ? "add" : "remove", "-g", pkg];
37455
- return [op === "install" ? "install" : "uninstall", "-g", pkg];
37466
+ if (op === "uninstall") return manager === "pnpm" ? ["remove", "-g", pkg] : ["uninstall", "-g", pkg];
37467
+ const target = op === "update" ? `${pkg}@latest` : pkg;
37468
+ return manager === "pnpm" ? ["add", "-g", target] : ["install", "-g", target];
37456
37469
  }
37457
37470
  async function runWorkerToolOp(op, name, manager, onLine) {
37458
37471
  const resolved = resolvePackage(name, op);
@@ -38255,9 +38268,10 @@ var WsClient = class {
38255
38268
  );
38256
38269
  break;
38257
38270
  case WsChannels.TOOLS_INSTALL:
38258
- case WsChannels.TOOLS_UNINSTALL: {
38271
+ case WsChannels.TOOLS_UNINSTALL:
38272
+ case WsChannels.TOOLS_UPDATE: {
38259
38273
  const req = payload;
38260
- const op = message.channel === WsChannels.TOOLS_INSTALL ? "install" : "uninstall";
38274
+ const op = message.channel === WsChannels.TOOLS_INSTALL ? "install" : message.channel === WsChannels.TOOLS_UPDATE ? "update" : "uninstall";
38261
38275
  this.send(message.channel, { started: true }, message.id);
38262
38276
  void runWorkerToolOp(
38263
38277
  op,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4pm/cli",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "private": false,
5
5
  "description": "4PM CLI — drives Claude/Codex CLIs on AI worker machines (Node + TypeScript)",
6
6
  "license": "LicenseRef-4PM-Source-Available",