@dadado/agent-kit-cli 6.23.0 → 6.26.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.
Files changed (86) hide show
  1. package/README.md +1 -0
  2. package/dashboard/dashboard-data.mjs +126 -5
  3. package/dashboard/dashboard.html +48 -7
  4. package/dashboard/lib/guards.mjs +1 -0
  5. package/dashboard/lib/live-refresh.mjs +1 -0
  6. package/dist/{add-RKZQX6ZK.js → add-G7KEZLWP.js} +17 -8
  7. package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
  8. package/dist/{chunk-5PSV76CQ.js → chunk-2GXN7HVG.js} +26 -7
  9. package/dist/chunk-2QYWMSI5.js +193 -0
  10. package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
  11. package/dist/{chunk-IESSMKOV.js → chunk-5A72LTR3.js} +7 -7
  12. package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
  13. package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
  14. package/dist/{chunk-AWQ6KRFV.js → chunk-BVZDPVUL.js} +1 -1
  15. package/dist/{chunk-QNISTPPZ.js → chunk-ENRXS5O6.js} +19 -12
  16. package/dist/chunk-FB6G6OD6.js +519 -0
  17. package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
  18. package/dist/{chunk-6BEFGKCU.js → chunk-FUSNEYGU.js} +29 -3
  19. package/dist/chunk-H7KAXI5R.js +357 -0
  20. package/dist/chunk-HGB4DHXV.js +138 -0
  21. package/dist/{chunk-W3ZJVBNY.js → chunk-HXV6VQD4.js} +2374 -983
  22. package/dist/{chunk-BGL5DRK2.js → chunk-I3FGWNU5.js} +4 -4
  23. package/dist/chunk-IHVJTGYR.js +144 -0
  24. package/dist/{chunk-5LNHRL5E.js → chunk-IUY24WPE.js} +93 -263
  25. package/dist/chunk-JG5MKMOM.js +248 -0
  26. package/dist/{chunk-SGTTC2JP.js → chunk-JWIJHO67.js} +17 -2
  27. package/dist/chunk-KMK4T4ZM.js +34 -0
  28. package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
  29. package/dist/{chunk-2IP4OO6R.js → chunk-MGVV6YC4.js} +1 -1
  30. package/dist/{chunk-7TYA3GMI.js → chunk-MWRYQLEG.js} +7 -4
  31. package/dist/chunk-NHJ4IAVN.js +435 -0
  32. package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
  33. package/dist/{chunk-5EBT3V7G.js → chunk-OVRGTHZD.js} +1 -1
  34. package/dist/{chunk-F7YAAKYP.js → chunk-PCIYXGB3.js} +7 -5
  35. package/dist/{chunk-UJCATSYO.js → chunk-PLLXFSN2.js} +46 -17
  36. package/dist/{chunk-OYFCBYMP.js → chunk-RJP47EGS.js} +18 -1
  37. package/dist/{chunk-KDJ4ML7I.js → chunk-RRJVC35Y.js} +4 -4
  38. package/dist/{chunk-DRZFWIBN.js → chunk-SWJJW624.js} +1 -1
  39. package/dist/{chunk-MJJBIOSY.js → chunk-SYRJ5TTK.js} +34 -12
  40. package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
  41. package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
  42. package/dist/{chunk-CVZNSRXV.js → chunk-Y5526WCN.js} +84 -19
  43. package/dist/{chunk-CQHD6UKB.js → chunk-Y575INEC.js} +2 -1
  44. package/dist/{chunk-V2H57TFD.js → chunk-ZNZHDPS3.js} +80 -170
  45. package/dist/{commands-SAQEEE6V.js → commands-K4HSDML5.js} +8 -6
  46. package/dist/{conflicts-5JOP4GX2.js → conflicts-4SUWIPWP.js} +9 -10
  47. package/dist/{contribute-BQKRT5GN.js → contribute-HE4WCBRY.js} +7 -5
  48. package/dist/{countdown-25E5C7AR.js → countdown-TYQHVAIX.js} +305 -32
  49. package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
  50. package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
  51. package/dist/{diff-6JSXBVSX.js → diff-3XUZM7ZT.js} +15 -6
  52. package/dist/{doctor-I3MTHS7F.js → doctor-KGUWU5SN.js} +106 -19
  53. package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
  54. package/dist/{ground-control-IDCXN5FK.js → ground-control-ZIDHEOPW.js} +7 -4
  55. package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
  56. package/dist/{handoff-5AGE2D3T.js → handoff-LLT4CI6H.js} +4 -3
  57. package/dist/{hook-WNA42CXE.js → hook-UPZ3CPYS.js} +22 -20
  58. package/dist/index.js +51 -33
  59. package/dist/{init-FZ2UFPO7.js → init-ZHLVXEVT.js} +25 -18
  60. package/dist/install-XWOG64W3.js +42 -0
  61. package/dist/installs-2ROXPO6M.js +223 -0
  62. package/dist/{mission-control-CRMCRZUU.js → mission-control-IGOI3WHS.js} +2 -2
  63. package/dist/models-5BDXREWM.js +45 -0
  64. package/dist/paths-JTPV6SXH.js +107 -0
  65. package/dist/pi-DCMDOY65.js +248 -0
  66. package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
  67. package/dist/{queue-JW4VR33H.js → queue-Z5VNNHM6.js} +10 -12
  68. package/dist/{run-X2WOONTB.js → run-QURAXAR2.js} +27 -33
  69. package/dist/{run-plan-4MOLLIES.js → run-plan-4MMHVCTS.js} +35 -23
  70. package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
  71. package/dist/{session-start-MV7A4263.js → session-start-NC2HE5X5.js} +20 -14
  72. package/dist/{sessions-UPFDWDMB.js → sessions-WWWLYPW6.js} +4 -4
  73. package/dist/{setup-global-VNADNTQ2.js → setup-global-WDMARD4Z.js} +12 -10
  74. package/dist/{status-SXA3OK5E.js → status-2WNJL7PP.js} +17 -13
  75. package/dist/update-YSVOYYK5.js +32 -0
  76. package/dist/update-all-5XLTCHPX.js +697 -0
  77. package/package.json +14 -4
  78. package/pi/agent-kit.ts +224 -0
  79. package/dist/chunk-4MR4QXMF.js +0 -52
  80. package/dist/chunk-7ABY6DYH.js +0 -89
  81. package/dist/chunk-C4LCOOL4.js +0 -71
  82. package/dist/chunk-DZCLMIAS.js +0 -391
  83. package/dist/chunk-HAFRAXGV.js +0 -17
  84. package/dist/chunk-MUTTNRX4.js +0 -53
  85. package/dist/install-CTLT3TSI.js +0 -38
  86. package/dist/update-RMAWXMCV.js +0 -304
@@ -2,12 +2,19 @@ import {
2
2
  assessHooksHealth,
3
3
  executeSafeReadinessFixes,
4
4
  refreshRepositoryProfile
5
- } from "./chunk-F7YAAKYP.js";
5
+ } from "./chunk-PCIYXGB3.js";
6
6
  import {
7
+ assessInstallHealth,
8
+ cachedCliNpmLatest,
9
+ npmLatestCheckAllowed,
10
+ writeInstallHealthSnapshot,
7
11
  writeReadinessSnapshot
8
- } from "./chunk-HAFRAXGV.js";
9
- import "./chunk-AWQ6KRFV.js";
10
- import "./chunk-6BEFGKCU.js";
12
+ } from "./chunk-FB6G6OD6.js";
13
+ import "./chunk-BVZDPVUL.js";
14
+ import "./chunk-FUSNEYGU.js";
15
+ import {
16
+ feedInstallsRegistry
17
+ } from "./chunk-NHJ4IAVN.js";
11
18
  import "./chunk-WGLPZXNU.js";
12
19
  import "./chunk-Q35TWISF.js";
13
20
  import {
@@ -16,34 +23,45 @@ import {
16
23
  import {
17
24
  detectWorkspaceParent,
18
25
  workspaceParentAdvisoryLines
19
- } from "./chunk-2IP4OO6R.js";
26
+ } from "./chunk-MGVV6YC4.js";
20
27
  import {
21
28
  createReadinessReport
22
29
  } from "./chunk-PNFF6OU3.js";
23
30
  import {
24
31
  runScanner
25
- } from "./chunk-R4DUO5DA.js";
32
+ } from "./chunk-AXQMVQ6O.js";
26
33
  import "./chunk-F6C3GFKV.js";
34
+ import "./chunk-2QYWMSI5.js";
27
35
  import {
28
36
  logger
29
37
  } from "./chunk-ZB43YMHW.js";
30
38
  import {
31
39
  MIN_NODE_VERSION_LABEL,
32
- assessEnvironment
33
- } from "./chunk-B3VR5YBQ.js";
40
+ assessEnvironment,
41
+ readBinVersion,
42
+ resolveBinOnPath
43
+ } from "./chunk-2TW7ENWC.js";
34
44
  import {
45
+ CLI_NPM_PACKAGES,
46
+ fetchLatestCliNpmVersion,
35
47
  warnIfRunningCliBehindNpm
36
- } from "./chunk-CVZNSRXV.js";
37
- import "./chunk-PFEUZXVT.js";
38
- import "./chunk-7TYA3GMI.js";
39
- import "./chunk-4MR4QXMF.js";
48
+ } from "./chunk-Y5526WCN.js";
49
+ import "./chunk-MWRYQLEG.js";
50
+ import "./chunk-HGB4DHXV.js";
40
51
  import "./chunk-CGXLR77R.js";
41
- import "./chunk-V2H57TFD.js";
42
- import "./chunk-OYFCBYMP.js";
52
+ import {
53
+ loadContextConfig
54
+ } from "./chunk-PFEUZXVT.js";
55
+ import {
56
+ loadAgentKitManifest
57
+ } from "./chunk-ZNZHDPS3.js";
58
+ import "./chunk-RJP47EGS.js";
59
+ import "./chunk-IHVJTGYR.js";
60
+ import "./chunk-KMK4T4ZM.js";
43
61
  import {
44
62
  KIT_VERSION
45
- } from "./chunk-7HDQEK6T.js";
46
- import "./chunk-C4Q77GGJ.js";
63
+ } from "./chunk-2G4K4ZI5.js";
64
+ import "./chunk-O7VMHCNN.js";
47
65
  import {
48
66
  readJson
49
67
  } from "./chunk-5B4DVO6C.js";
@@ -64,6 +82,45 @@ async function readDeferredEssentials(rootDir, report) {
64
82
  (item) => typeof item?.checkId === "string" && typeof item?.reason === "string" && essentialIds.has(item.checkId)
65
83
  ).map((item) => ({ checkId: item.checkId, reason: item.reason }));
66
84
  }
85
+ async function resolveCliBin(env, procEnv, platform) {
86
+ if (procEnv === process.env && env.binPath) {
87
+ return { binPath: env.binPath, binVersion: env.binVersion };
88
+ }
89
+ for (const pkg of CLI_NPM_PACKAGES) {
90
+ const hit = await resolveBinOnPath(pkg.bin, procEnv, platform).catch(() => null);
91
+ if (hit) {
92
+ return { binPath: hit, binVersion: await readBinVersion(hit).catch(() => null) };
93
+ }
94
+ }
95
+ return { binPath: null, binVersion: null };
96
+ }
97
+ async function runInstallHealth(rootDir, env, options) {
98
+ const seams = options.installHealth ?? {};
99
+ const procEnv = seams.env ?? process.env;
100
+ const platform = seams.platform ?? process.platform;
101
+ let latest = null;
102
+ const checked = options.fetchNpmLatest !== void 0;
103
+ if (options.fetchNpmLatest) {
104
+ latest = await options.fetchNpmLatest().catch(() => null);
105
+ }
106
+ const manifest = await loadAgentKitManifest(rootDir).catch(() => null);
107
+ const bin = await resolveCliBin(env, procEnv, platform);
108
+ return assessInstallHealth({
109
+ cwd: rootDir,
110
+ cliVersion: KIT_VERSION,
111
+ npm: { checked, latest },
112
+ binPath: bin.binPath,
113
+ binVersion: bin.binVersion,
114
+ manifest: manifest ? {
115
+ version: manifest.version,
116
+ registryUrl: manifest.registry?.url ?? null,
117
+ registryRef: manifest.registry?.ref ?? null
118
+ } : null,
119
+ ...seams,
120
+ env: procEnv,
121
+ platform
122
+ });
123
+ }
67
124
  async function runDoctor(cwd, options = {}) {
68
125
  const rootDir = path.resolve(cwd);
69
126
  const hooks = await assessHooksHealth(rootDir);
@@ -74,16 +131,21 @@ async function runDoctor(cwd, options = {}) {
74
131
  generatorVersion: KIT_VERSION,
75
132
  generatedAt: options.generatedAt
76
133
  });
134
+ const env2 = await assessEnvironment();
77
135
  return {
78
136
  report: report2,
79
137
  safeChanges: [],
80
138
  hooks,
81
- env: await assessEnvironment(),
139
+ env: env2,
140
+ // Machine-level checks still run; nothing is written in a parent folder.
141
+ install: await runInstallHealth(rootDir, env2, options),
82
142
  deferredEssentials: [],
83
143
  workspaceParent
84
144
  };
85
145
  }
86
146
  const env = await assessEnvironment();
147
+ const install = await runInstallHealth(rootDir, env, options);
148
+ await writeInstallHealthSnapshot(rootDir, install, options.generatedAt).catch(() => void 0);
87
149
  if (options.fixSafe) {
88
150
  const execution = await executeSafeReadinessFixes(rootDir, {
89
151
  generatorVersion: KIT_VERSION,
@@ -95,6 +157,7 @@ async function runDoctor(cwd, options = {}) {
95
157
  safeChanges: execution.changes,
96
158
  hooks,
97
159
  env,
160
+ install,
98
161
  deferredEssentials: await readDeferredEssentials(rootDir, execution.after)
99
162
  };
100
163
  }
@@ -114,6 +177,7 @@ async function runDoctor(cwd, options = {}) {
114
177
  safeChanges: [],
115
178
  hooks,
116
179
  env,
180
+ install,
117
181
  profileRefreshed: refresh.changed,
118
182
  deferredEssentials: await readDeferredEssentials(rootDir, report2)
119
183
  };
@@ -129,9 +193,20 @@ async function runDoctor(cwd, options = {}) {
129
193
  safeChanges: [],
130
194
  hooks,
131
195
  env,
196
+ install,
132
197
  deferredEssentials: await readDeferredEssentials(rootDir, report)
133
198
  };
134
199
  }
200
+ var INSTALL_SEVERITY_LABEL = { ok: "ok", warning: "WARN", info: "info" };
201
+ function printInstallHealth(install) {
202
+ console.log("install:");
203
+ for (const item of install.checks) {
204
+ console.log(` - ${item.label}: ${INSTALL_SEVERITY_LABEL[item.severity]} (${item.detail})`);
205
+ if (item.fix && item.severity !== "ok") {
206
+ console.log(` ${item.fixKind === "config-line" ? "add" : "fix"}: ${item.fix}`);
207
+ }
208
+ }
209
+ }
135
210
  function printDoctorSummary(result, rootDir) {
136
211
  if (result.workspaceParent) {
137
212
  for (const line of workspaceParentAdvisoryLines(rootDir, result.workspaceParent, "doctor")) {
@@ -183,6 +258,7 @@ function printDoctorSummary(result, rootDir) {
183
258
  console.log(
184
259
  ` - shell profile: ${result.env.shellProfile ?? "not detected (zsh/bash only)"}${result.env.shell ? ` (shell: ${result.env.shell})` : ""}`
185
260
  );
261
+ printInstallHealth(result.install);
186
262
  if (process.env.ALLOW_MAIN_PUSH === "1") {
187
263
  console.log("\u26A0\uFE0F WARNING: ALLOW_MAIN_PUSH=1 is set in environment");
188
264
  console.log(" This disables main-push protection for agent Shell commands.");
@@ -220,13 +296,23 @@ var doctorCommand = defineCommand({
220
296
  },
221
297
  async run({ args }) {
222
298
  if (!args.json) {
223
- await warnIfRunningCliBehindNpm(args.cwd, { warn: (message) => logger.warn(message) });
299
+ await warnIfRunningCliBehindNpm(args.cwd, {
300
+ warn: (message) => logger.warn(message),
301
+ stamp: false,
302
+ fetchLatest: async () => (await cachedCliNpmLatest())?.version ?? null
303
+ });
224
304
  }
305
+ const npmAllowed = npmLatestCheckAllowed(
306
+ process.env,
307
+ await loadContextConfig(path.resolve(args.cwd)).catch(() => null)
308
+ );
225
309
  const run = () => runDoctor(args.cwd, {
226
310
  fixSafe: args["fix-safe"],
227
- refreshProfile: args["refresh-profile"]
311
+ refreshProfile: args["refresh-profile"],
312
+ fetchNpmLatest: npmAllowed ? () => fetchLatestCliNpmVersion() : void 0
228
313
  });
229
314
  const result = args.json ? await run() : await withCliProgress("doctor", run);
315
+ await feedInstallsRegistry(path.resolve(args.cwd));
230
316
  if (args.json) {
231
317
  console.log(JSON.stringify(result, null, 2));
232
318
  return;
@@ -237,5 +323,6 @@ var doctorCommand = defineCommand({
237
323
  export {
238
324
  doctorCommand,
239
325
  printDoctorSummary,
326
+ printInstallHealth,
240
327
  runDoctor
241
328
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  bundledDashboardCandidates
3
- } from "./chunk-ZMYV6PRE.js";
3
+ } from "./chunk-LEVNLHH3.js";
4
4
  import {
5
5
  DRIVER_PROTOCOL_VERSION
6
- } from "./chunk-6WUKLS4D.js";
6
+ } from "./chunk-BIFTTL2O.js";
7
7
  import "./chunk-P7732A25.js";
8
8
  import "./chunk-ZB43YMHW.js";
9
9
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  blobId,
3
3
  isTicketMerged
4
- } from "./chunk-5EBT3V7G.js";
4
+ } from "./chunk-OVRGTHZD.js";
5
5
  import {
6
6
  GATE_EXIT_BRANCH_PREFIX,
7
7
  GATE_EXIT_MARKER_RELPATH,
@@ -16,12 +16,12 @@ import {
16
16
  readGateExitMarker,
17
17
  resolveGateExitRefs,
18
18
  writeGateExitMarker
19
- } from "./chunk-BGL5DRK2.js";
20
- import "./chunk-MUTTNRX4.js";
19
+ } from "./chunk-I3FGWNU5.js";
21
20
  import {
22
21
  redactSecrets
23
- } from "./chunk-W3ZJVBNY.js";
22
+ } from "./chunk-HXV6VQD4.js";
24
23
  import "./chunk-P7732A25.js";
24
+ import "./chunk-TTUFIE26.js";
25
25
  import {
26
26
  findOnPath
27
27
  } from "./chunk-WGLPZXNU.js";
@@ -30,6 +30,9 @@ import "./chunk-QTON2GQX.js";
30
30
  import {
31
31
  logger
32
32
  } from "./chunk-ZB43YMHW.js";
33
+ import "./chunk-PFEUZXVT.js";
34
+ import "./chunk-O7VMHCNN.js";
35
+ import "./chunk-5B4DVO6C.js";
33
36
 
34
37
  // src/commands/ground-control.ts
35
38
  import path from "path";
@@ -433,18 +433,24 @@ var SHELL_DENY_RULES = [
433
433
  if (!/^(?:[\w./-]+\/)?git\s+checkout\b/.test(head)) return false;
434
434
  if (/\s--(?:\s|$)/.test(head)) return true;
435
435
  if (/\scheckout\s+\.(?:\s|$)/.test(head)) return true;
436
+ if (/\s--(?:theirs|ours)(?:\s|$)/.test(head)) return true;
436
437
  return false;
437
- })
438
+ }),
439
+ allowed: () => "`git switch <branch>` to change branches, `git stash` to set edits aside, `git restore --staged <path>` to unstage; resolve a conflict by editing the file"
438
440
  },
439
441
  {
440
442
  id: "git-restore",
441
- description: "git restore discards working-tree edits",
442
- test: (cmd) => anyHeadMatches(cmd, /^(?:[\w./-]+\/)?git\s+restore\b/)
443
+ description: "git restore on the worktree discards working-tree edits",
444
+ test: (cmd) => shellInvocationHeads(cmd).some(
445
+ (head) => /^(?:[\w./-]+\/)?git\s+restore\b/.test(head) && !restoreIsIndexOnly(head)
446
+ ),
447
+ allowed: () => "`git restore --staged <path>` (index only, keeps the edit) or `git stash` to set edits aside"
443
448
  },
444
449
  {
445
450
  id: "git-reset-hard",
446
451
  description: "git reset --hard destroys uncommitted work",
447
- test: (cmd) => anyHeadMatches(cmd, /^(?:[\w./-]+\/)?git\s+reset\b.*--hard\b/)
452
+ test: (cmd) => anyHeadMatches(cmd, /^(?:[\w./-]+\/)?git\s+reset\b.*--hard\b/),
453
+ allowed: () => "`git stash` to set edits aside, `git reset --keep <ref>` (refuses to drop local edits) or `git reset --soft <ref>`"
448
454
  },
449
455
  {
450
456
  id: "git-clean-fd",
@@ -456,7 +462,8 @@ var SHELL_DENY_RULES = [
456
462
  const hasForce = tokens.some((t) => t === "--force" || shortBundle(t) && t.includes("f"));
457
463
  const hasD = tokens.some((t) => shortBundle(t) && t.includes("d"));
458
464
  return hasForce && hasD;
459
- })
465
+ }),
466
+ allowed: () => "`git clean -nd` to list what would go, then ask the operator before deleting untracked files"
460
467
  },
461
468
  {
462
469
  id: "public-repo-direct-write",
@@ -465,7 +472,8 @@ var SHELL_DENY_RULES = [
465
472
  if (segmentHasAllowPublicPushEnv(segment)) return false;
466
473
  const head = canonicalGitHead(segment);
467
474
  return pushTargetsPublicRepo(head, opts?.remotes) || ghTargetsPublicRepo(head);
468
- })
475
+ }),
476
+ allowed: () => "ship through /git-staging and /git-prod; the public repo is written by `scripts/sync-public.mjs` in CI"
469
477
  },
470
478
  {
471
479
  id: "git-push-main",
@@ -481,7 +489,8 @@ var SHELL_DENY_RULES = [
481
489
  return true;
482
490
  }
483
491
  return false;
484
- })
492
+ }),
493
+ allowed: () => "push a working branch (`git push -u origin <branch>`) and open a PR into staging (/git-staging); main moves only through /git-prod"
485
494
  },
486
495
  {
487
496
  // Claude settings allow `gh pr merge` / `glab mr merge` so the /git-staging merge
@@ -506,9 +515,38 @@ var SHELL_DENY_RULES = [
506
515
  const base = bases[prMergeKey(target)];
507
516
  return typeof base !== "string" || isProtectedBranch(base);
508
517
  });
509
- }
518
+ },
519
+ allowed: prMergeAllowedHint
510
520
  }
511
521
  ];
522
+ function restoreIsIndexOnly(head) {
523
+ const tokens = head.split(/\s+/);
524
+ const shortBundle = (t) => /^-[a-zA-Z]+$/.test(t);
525
+ const staged = tokens.some((t) => t === "--staged" || shortBundle(t) && t.includes("S"));
526
+ const worktree = tokens.some((t) => t === "--worktree" || shortBundle(t) && t.includes("W"));
527
+ return staged && !worktree;
528
+ }
529
+ function prMergeAllowedHint(command, opts) {
530
+ const ghForm = "`gh pr merge <n> -R owner/repo`";
531
+ const glabForm = "`glab mr merge <n> -R host/group/repo`";
532
+ const staging = "merge only into staging (/git-staging); main moves through /git-prod";
533
+ if (forgeApiMergeCall(command)) {
534
+ return `a literal ${ghForm} or ${glabForm} at the head of its own segment; ${staging}`;
535
+ }
536
+ const bases = opts?.prMergeBases ?? {};
537
+ const unresolved = shellSegments(command).filter((segment) => {
538
+ if (!PR_MERGE_CALL_RE.test(segment)) return false;
539
+ const target = literalPrMergeTarget(segment);
540
+ return target === null || typeof bases[prMergeKey(target)] !== "string";
541
+ });
542
+ if (unresolved.length === 0) return staging;
543
+ const forms = [
544
+ unresolved.some((seg) => /\bgh\s+pr\s+merge\b/.test(seg)) ? ghForm : null,
545
+ unresolved.some((seg) => /\bglab\s+mr\s+merge\b/.test(seg)) ? glabForm : null
546
+ ].filter((f) => f !== null);
547
+ const named = forms.length > 0 ? forms.join(" or ") : `${ghForm} or ${glabForm}`;
548
+ return `name the PR/MR and its repo literally, at the head of its own segment, so the base resolves: ${named} (check \`gh auth status\` / \`glab auth status\`); ${staging}`;
549
+ }
512
550
  function evaluateShellCommand(command, opts = {}) {
513
551
  const normalized = normalizeShellCommand(command);
514
552
  if (!normalized) {
@@ -516,7 +554,7 @@ function evaluateShellCommand(command, opts = {}) {
516
554
  }
517
555
  for (const rule of SHELL_DENY_RULES) {
518
556
  if (rule.test(command, opts)) {
519
- const agent_message = `Denied by ${CITE2}: ${rule.description} (rule \`${rule.id}\`). Use /git-staging; never discard human hunks or push protected branches from the agent.`;
557
+ const agent_message = `Denied by ${CITE2}: ${rule.description} (rule \`${rule.id}\`). Instead: ${rule.allowed(command, opts)}. Never discard human hunks or push protected branches from the agent.`;
520
558
  return {
521
559
  permission: "deny",
522
560
  rule: rule.id,
@@ -6,8 +6,7 @@ import {
6
6
  extractHandoffNamedPlans,
7
7
  namedPlanCandidatePaths,
8
8
  parsePlanFrontmatter
9
- } from "./chunk-L5V3W3DY.js";
10
- import "./chunk-MUTTNRX4.js";
9
+ } from "./chunk-TTUFIE26.js";
11
10
  import {
12
11
  PM_TOOL_LABELS
13
12
  } from "./chunk-F6C3GFKV.js";
@@ -16,7 +15,7 @@ import {
16
15
  } from "./chunk-ZB43YMHW.js";
17
16
  import {
18
17
  HANDOFF_REL
19
- } from "./chunk-C4Q77GGJ.js";
18
+ } from "./chunk-O7VMHCNN.js";
20
19
  import {
21
20
  ensureDir,
22
21
  fileExists,
@@ -78,6 +77,8 @@ var PRESERVED_FIELDS = [
78
77
  "Queue cursor",
79
78
  "Queue status",
80
79
  "Queue outcomes",
80
+ // Rows displaced by run-plan-all-consolidate.sh --rewrite-queue (HITL evidence).
81
+ "Queue outcomes anteriores",
81
82
  "Backlog plans",
82
83
  "Parked plans"
83
84
  ];
@@ -1,27 +1,29 @@
1
1
  import {
2
2
  buildSessionStartAdditionalContext,
3
3
  resolveSessionRoot
4
- } from "./chunk-MJJBIOSY.js";
4
+ } from "./chunk-SYRJ5TTK.js";
5
+ import "./chunk-XXPI4H4D.js";
5
6
  import "./chunk-2YU2H7I6.js";
6
7
  import {
7
8
  readStdinJson
8
9
  } from "./chunk-DE3LQFSJ.js";
9
- import "./chunk-JFS4GKP7.js";
10
- import "./chunk-MFKHIWEL.js";
10
+ import "./chunk-FOVHFMSH.js";
11
11
  import "./chunk-MCH3E46V.js";
12
12
  import "./chunk-4CRBUEJ6.js";
13
- import "./chunk-L5V3W3DY.js";
14
- import "./chunk-MUTTNRX4.js";
15
- import "./chunk-HAFRAXGV.js";
16
- import "./chunk-CVZNSRXV.js";
17
- import "./chunk-PFEUZXVT.js";
18
- import "./chunk-7TYA3GMI.js";
19
- import "./chunk-4MR4QXMF.js";
13
+ import "./chunk-TTUFIE26.js";
14
+ import "./chunk-FB6G6OD6.js";
15
+ import "./chunk-NHJ4IAVN.js";
16
+ import "./chunk-Y5526WCN.js";
17
+ import "./chunk-MWRYQLEG.js";
18
+ import "./chunk-HGB4DHXV.js";
20
19
  import "./chunk-CGXLR77R.js";
21
- import "./chunk-V2H57TFD.js";
22
- import "./chunk-OYFCBYMP.js";
23
- import "./chunk-7HDQEK6T.js";
24
- import "./chunk-C4Q77GGJ.js";
20
+ import "./chunk-PFEUZXVT.js";
21
+ import "./chunk-ZNZHDPS3.js";
22
+ import "./chunk-RJP47EGS.js";
23
+ import "./chunk-IHVJTGYR.js";
24
+ import "./chunk-KMK4T4ZM.js";
25
+ import "./chunk-2G4K4ZI5.js";
26
+ import "./chunk-O7VMHCNN.js";
25
27
  import "./chunk-5B4DVO6C.js";
26
28
 
27
29
  // src/commands/hook.ts
@@ -30,10 +32,10 @@ import { defineCommand } from "citty";
30
32
 
31
33
  // src/hooks/format-session-start.ts
32
34
  function resolveSessionStartFormat(value) {
33
- return value === "claude" ? "claude" : "cursor";
35
+ return value === "claude" || value === "pi" ? value : "cursor";
34
36
  }
35
37
  function formatSessionStartOutput(additionalContext, format) {
36
- if (format === "claude") return additionalContext;
38
+ if (format === "claude" || format === "pi") return additionalContext;
37
39
  return JSON.stringify({ additional_context: additionalContext });
38
40
  }
39
41
  var SESSION_START_DEGRADED_MESSAGE = "Agent Kit session-start context is unavailable this session (internal error, fail-open mode). Nothing else is affected; retry next session.";
@@ -57,7 +59,7 @@ async function runSessionStartHook(cwd, formatArg, deps = {}) {
57
59
  const buildContext = deps.buildContext ?? buildSessionStartAdditionalContext;
58
60
  const payload = await readStdin();
59
61
  const root = resolveSessionRoot(payload, path.resolve(cwd));
60
- const out = await buildContext(root, payload);
62
+ const out = await buildContext(root, payload, { host: format });
61
63
  return formatSessionStartOutput(out.additional_context, format);
62
64
  } catch {
63
65
  return formatSessionStartOutput(SESSION_START_DEGRADED_MESSAGE, format);
@@ -66,13 +68,13 @@ async function runSessionStartHook(cwd, formatArg, deps = {}) {
66
68
  var hookCommand = defineCommand({
67
69
  meta: {
68
70
  name: "hook",
69
- description: "Cursor + Claude Code hook adapters (session-start, pre-compact). CLI is SoT."
71
+ description: "Cursor, Claude Code and pi hook adapters (session-start, pre-compact). CLI is SoT."
70
72
  },
71
73
  subCommands: {
72
74
  "session-start": defineCommand({
73
75
  meta: {
74
76
  name: "session-start",
75
- description: "Emit sessionStart context (stdin: host payload). --format cursor (default, JSON additional_context) | claude (plain stdout)"
77
+ description: "Emit sessionStart context (stdin: host payload). --format cursor (default, JSON additional_context) | claude (plain stdout) | pi (plain stdout, numbered-list HITL)"
76
78
  },
77
79
  args: {
78
80
  cwd: {
@@ -82,7 +84,7 @@ var hookCommand = defineCommand({
82
84
  format: {
83
85
  type: "string",
84
86
  default: "cursor",
85
- description: "cursor (default) | claude"
87
+ description: "cursor (default) | claude | pi"
86
88
  }
87
89
  },
88
90
  async run({ args }) {
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  rewriteRootArgvToRun
4
- } from "./chunk-SGTTC2JP.js";
5
- import "./chunk-W3ZJVBNY.js";
4
+ } from "./chunk-JWIJHO67.js";
5
+ import "./chunk-HXV6VQD4.js";
6
6
  import "./chunk-P7732A25.js";
7
+ import "./chunk-TTUFIE26.js";
7
8
  import "./chunk-WGLPZXNU.js";
8
9
  import "./chunk-Q35TWISF.js";
9
10
  import {
@@ -14,10 +15,11 @@ import {
14
15
  tipAt,
15
16
  withKoloristColor
16
17
  } from "./chunk-QTON2GQX.js";
18
+ import "./chunk-PFEUZXVT.js";
17
19
  import {
18
20
  KIT_VERSION
19
- } from "./chunk-7HDQEK6T.js";
20
- import "./chunk-C4Q77GGJ.js";
21
+ } from "./chunk-2G4K4ZI5.js";
22
+ import "./chunk-O7VMHCNN.js";
21
23
  import "./chunk-5B4DVO6C.js";
22
24
 
23
25
  // src/index.ts
@@ -114,7 +116,18 @@ var CLI_HELP_GROUPS = [
114
116
  {
115
117
  id: "setup",
116
118
  title: "SETUP",
117
- commands: ["init", "install", "doctor", "status", "update", "add", "scan"]
119
+ commands: [
120
+ "init",
121
+ "install",
122
+ "doctor",
123
+ "status",
124
+ "update",
125
+ "installs",
126
+ "add",
127
+ "scan",
128
+ "pi",
129
+ "models"
130
+ ]
118
131
  },
119
132
  {
120
133
  id: "mission",
@@ -158,7 +171,8 @@ var CLI_HELP_GROUPS = [
158
171
  "diff",
159
172
  "contribute",
160
173
  "engine-info",
161
- "commands"
174
+ "commands",
175
+ "paths"
162
176
  ]
163
177
  }
164
178
  ];
@@ -234,41 +248,45 @@ var main = defineCommand({
234
248
  version: KIT_VERSION
235
249
  },
236
250
  subCommands: {
237
- init: () => import("./init-FZ2UFPO7.js").then((m) => m.initCommand),
238
- install: () => import("./install-CTLT3TSI.js").then((m) => m.installCommand),
239
- scan: () => import("./scan-K3T5RQLC.js").then((m) => m.scanCommand),
240
- add: () => import("./add-RKZQX6ZK.js").then((m) => m.addCommand),
241
- doctor: () => import("./doctor-I3MTHS7F.js").then((m) => m.doctorCommand),
242
- "setup-global": () => import("./setup-global-VNADNTQ2.js").then((m) => m.setupGlobalCommand),
243
- status: () => import("./status-SXA3OK5E.js").then((m) => m.statusCommand),
244
- update: () => import("./update-RMAWXMCV.js").then((m) => m.updateCommand),
251
+ init: () => import("./init-ZHLVXEVT.js").then((m) => m.initCommand),
252
+ install: () => import("./install-XWOG64W3.js").then((m) => m.installCommand),
253
+ scan: () => import("./scan-7D3RMO34.js").then((m) => m.scanCommand),
254
+ add: () => import("./add-G7KEZLWP.js").then((m) => m.addCommand),
255
+ doctor: () => import("./doctor-KGUWU5SN.js").then((m) => m.doctorCommand),
256
+ "setup-global": () => import("./setup-global-WDMARD4Z.js").then((m) => m.setupGlobalCommand),
257
+ status: () => import("./status-2WNJL7PP.js").then((m) => m.statusCommand),
258
+ update: () => import("./update-YSVOYYK5.js").then((m) => m.updateCommand),
259
+ installs: () => import("./installs-2ROXPO6M.js").then((m) => m.installsCommand),
245
260
  "cursor-awareness": () => import("./cursor-awareness-TN5JXD2C.js").then((m) => m.cursorAwarenessCommand),
246
261
  "public-inbound-radar": () => import("./public-inbound-radar-5U4JMBRU.js").then((m) => m.publicInboundRadarCommand),
247
262
  "remote-issues": () => import("./remote-issues-APYOMIJC.js").then((m) => m.remoteIssuesCommand),
248
263
  dogfood: () => import("./dogfood-2JAHSYQA.js").then((m) => m.dogfoodCommand),
249
- diff: () => import("./diff-6JSXBVSX.js").then((m) => m.diffCommand),
250
- contribute: () => import("./contribute-BQKRT5GN.js").then((m) => m.contributeCommand),
251
- handoff: () => import("./handoff-5AGE2D3T.js").then((m) => m.handoffCommand),
252
- "plan-index": () => import("./plan-index-BNLUU6T5.js").then((m) => m.planIndexCommand),
253
- run: () => import("./run-X2WOONTB.js").then((m) => m.runCommand),
254
- "run-plan": () => import("./run-plan-4MOLLIES.js").then((m) => m.runPlanCommand),
255
- "run-plan-all": () => import("./run-X2WOONTB.js").then((m) => m.runPlanAllCommand),
256
- queue: () => import("./queue-JW4VR33H.js").then((m) => m.queueCommand),
264
+ diff: () => import("./diff-3XUZM7ZT.js").then((m) => m.diffCommand),
265
+ contribute: () => import("./contribute-HE4WCBRY.js").then((m) => m.contributeCommand),
266
+ handoff: () => import("./handoff-LLT4CI6H.js").then((m) => m.handoffCommand),
267
+ "plan-index": () => import("./plan-index-5QZJK4AG.js").then((m) => m.planIndexCommand),
268
+ run: () => import("./run-QURAXAR2.js").then((m) => m.runCommand),
269
+ "run-plan": () => import("./run-plan-4MMHVCTS.js").then((m) => m.runPlanCommand),
270
+ "run-plan-all": () => import("./run-QURAXAR2.js").then((m) => m.runPlanAllCommand),
271
+ queue: () => import("./queue-Z5VNNHM6.js").then((m) => m.queueCommand),
257
272
  promote: () => import("./promote-H5MIMVEB.js").then((m) => m.promoteCommand),
258
- countdown: () => import("./countdown-25E5C7AR.js").then((m) => m.countdownCommand),
259
- "ground-control": () => import("./ground-control-IDCXN5FK.js").then((m) => m.groundControlCommand),
260
- conflicts: () => import("./conflicts-5JOP4GX2.js").then((m) => m.conflictsCommand),
261
- dashboard: () => import("./dashboard-P65XHYCU.js").then((m) => m.dashboardCommand),
262
- "dashboard-broadcast": () => import("./dashboard-broadcast-GYK34QYL.js").then((m) => m.dashboardBroadcastCommand),
263
- "mission-control": () => import("./mission-control-CRMCRZUU.js").then((m) => m.missionControlCommand),
264
- hook: () => import("./hook-WNA42CXE.js").then((m) => m.hookCommand),
265
- guard: () => import("./guard-RJZEEKSL.js").then((m) => m.guardCommand),
273
+ countdown: () => import("./countdown-TYQHVAIX.js").then((m) => m.countdownCommand),
274
+ "ground-control": () => import("./ground-control-ZIDHEOPW.js").then((m) => m.groundControlCommand),
275
+ conflicts: () => import("./conflicts-4SUWIPWP.js").then((m) => m.conflictsCommand),
276
+ dashboard: () => import("./dashboard-6V6PCNYF.js").then((m) => m.dashboardCommand),
277
+ "dashboard-broadcast": () => import("./dashboard-broadcast-PMVQ7PXU.js").then((m) => m.dashboardBroadcastCommand),
278
+ "mission-control": () => import("./mission-control-IGOI3WHS.js").then((m) => m.missionControlCommand),
279
+ hook: () => import("./hook-UPZ3CPYS.js").then((m) => m.hookCommand),
280
+ guard: () => import("./guard-ZO4Z3LLB.js").then((m) => m.guardCommand),
266
281
  monitors: () => import("./monitors-PDXBLB3U.js").then((m) => m.monitorsCommand),
267
- sessions: () => import("./sessions-UPFDWDMB.js").then((m) => m.sessionsCommand),
282
+ sessions: () => import("./sessions-WWWLYPW6.js").then((m) => m.sessionsCommand),
268
283
  "outcome-ledger": () => import("./outcome-ledger-XLWHWPVQ.js").then((m) => m.outcomeLedgerCommand),
269
284
  validate: () => import("./validate-V2CW7J4B.js").then((m) => m.validateCommand),
270
- "engine-info": () => import("./engine-info-BBI5QO5Y.js").then((m) => m.engineInfoCommand),
271
- commands: () => import("./commands-SAQEEE6V.js").then((m) => m.commandsCommand)
285
+ "engine-info": () => import("./engine-info-VM4VPGQM.js").then((m) => m.engineInfoCommand),
286
+ commands: () => import("./commands-K4HSDML5.js").then((m) => m.commandsCommand),
287
+ paths: () => import("./paths-JTPV6SXH.js").then((m) => m.pathsCommand),
288
+ pi: () => import("./pi-DCMDOY65.js").then((m) => m.piCommand),
289
+ models: () => import("./models-5BDXREWM.js").then((m) => m.modelsCommand)
272
290
  },
273
291
  async run({ rawArgs }) {
274
292
  if (hasCliSubcommand(rawArgs)) return;