@dadado/agent-kit-cli 6.5.1 → 6.7.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 (40) hide show
  1. package/dashboard/lib/semantic-model.mjs +49 -2
  2. package/dist/{add-IT6XFPKT.js → add-NQILLNYA.js} +3 -2
  3. package/dist/{chunk-GIZNM73K.js → chunk-26KXYR5T.js} +1 -1
  4. package/dist/{chunk-I2D75F4I.js → chunk-2DETOPCK.js} +11 -9
  5. package/dist/{chunk-IN4MQ3P3.js → chunk-2KIOZMTV.js} +1 -48
  6. package/dist/{chunk-TNO7GTAJ.js → chunk-54T36ZDX.js} +5 -3
  7. package/dist/{chunk-2OIPMQHA.js → chunk-5WDFOFL4.js} +2 -2
  8. package/dist/{chunk-EI3VQ7FU.js → chunk-5YU3BSCN.js} +2 -2
  9. package/dist/{chunk-2TCRKQHD.js → chunk-6UKI4CAN.js} +63 -2
  10. package/dist/{chunk-MEZUW3LL.js → chunk-A3OJLKPH.js} +1 -1
  11. package/dist/{chunk-4XZXM2ZA.js → chunk-BB22FGQ4.js} +14 -6
  12. package/dist/{chunk-FM32XR7A.js → chunk-BSYQJ5WF.js} +1 -1
  13. package/dist/{chunk-U7XOLYDG.js → chunk-BZI5G3OZ.js} +33 -1
  14. package/dist/chunk-EHY2UZP3.js +52 -0
  15. package/dist/{chunk-YIOTJQHL.js → chunk-FLP2YVRO.js} +2 -2
  16. package/dist/{chunk-5LQP4JGH.js → chunk-GSCTZOS7.js} +7 -5
  17. package/dist/{chunk-34BBPQKI.js → chunk-HOFZX4M2.js} +1 -1
  18. package/dist/{chunk-WOGBBJCX.js → chunk-NSOWSTAL.js} +5 -3
  19. package/dist/{chunk-236IYK6L.js → chunk-QE4L2PVJ.js} +20 -135
  20. package/dist/chunk-QH33EIMD.js +125 -0
  21. package/dist/{chunk-HKYJG2FJ.js → chunk-S7XAV6JK.js} +4 -4
  22. package/dist/chunk-TL7AXLEU.js +967 -0
  23. package/dist/chunk-VZ3O4OKE.js +522 -0
  24. package/dist/commands-SIM2UP5W.js +92 -0
  25. package/dist/{contribute-V7PV5UMK.js → contribute-WEYAE7CE.js} +7 -4
  26. package/dist/{countdown-YONBTSJ2.js → countdown-XYRE4GZU.js} +6 -6
  27. package/dist/{diff-GWIHGH65.js → diff-ETCHVI7X.js} +6 -4
  28. package/dist/{doctor-FLIQCVFN.js → doctor-YRHSU3L2.js} +10 -7
  29. package/dist/{ground-control-6W2AKTKI.js → ground-control-726LRB6Q.js} +3 -3
  30. package/dist/{hook-2SX2V2T6.js → hook-MUTYISDL.js} +6 -4
  31. package/dist/index.js +21 -19
  32. package/dist/{init-4B2IRH27.js → init-7IOQCK6T.js} +13 -10
  33. package/dist/{install-3JVTG35O.js → install-LUFSJOYK.js} +13 -10
  34. package/dist/{run-AYT6CRHI.js → run-QG7XQ3XF.js} +7 -7
  35. package/dist/{run-plan-5XIISG3W.js → run-plan-P7VTOWYI.js} +4 -4
  36. package/dist/{setup-global-6JM5XTAT.js → setup-global-6JE6LSPE.js} +7 -5
  37. package/dist/{status-PMAI7NH3.js → status-YZRSVZM2.js} +8 -6
  38. package/dist/{update-3PLY4FZA.js → update-ZEYO6ZS7.js} +15 -10
  39. package/package.json +1 -1
  40. package/dist/chunk-5WSFO35Y.js +0 -1473
@@ -5,146 +5,35 @@ import {
5
5
  import {
6
6
  assertRealContained,
7
7
  assertRealParentContained,
8
- contentHash,
9
8
  isRealWriteTargetContained,
10
- loadManagedHashLedger,
11
- resolveContained,
12
- saveManagedHashLedger,
13
- shouldPreserveCustomizedOverlay
14
- } from "./chunk-5WSFO35Y.js";
9
+ resolveContained
10
+ } from "./chunk-VZ3O4OKE.js";
15
11
  import {
16
- ensureDir,
17
- fileExists
12
+ ensureDir
18
13
  } from "./chunk-5B4DVO6C.js";
19
14
 
20
- // src/generator/claude-command-adapters.ts
21
- import { readdir, readFile, writeFile } from "fs/promises";
22
- import path from "path";
23
- var CURSOR_COMMANDS_DIR_REL = ".cursor/commands";
24
- var CLAUDE_COMMANDS_DIR_REL = ".claude/commands";
25
- var RESERVED_ADAPTER_NAMES = /* @__PURE__ */ new Set(["agent-kit"]);
26
- function parseCommandFrontmatter(name, raw) {
27
- const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
28
- if (!match) return null;
29
- const body = match[1] ?? "";
30
- const descMatch = /^description:\s*(.+)$/m.exec(body);
31
- if (!descMatch) return null;
32
- const description = (descMatch[1] ?? "").trim();
33
- if (!description) return null;
34
- return { name, description };
35
- }
36
- var CLAUDE_HITL_FALLBACK = `Cursor "Ask questions" is unavailable here: use AskUserQuestion when possible, else print one line \`HITL_GATE: <ask-id> | <label 1> | <label 2> | ...\` immediately followed by the same labels as one numbered list, one list per message, and WAIT for the answer (ask-id and labels: \`.cursor/skills/core/hitl-gates/SKILL.md\`). A headless reply arrives as \`HITL_REPLY: <ask-id> | operator reply <n> | <label>\`; cite that line as the Ask provenance.`;
37
- var MODEL_INVOCATION_DISABLED = /* @__PURE__ */ new Set([
38
- "git-prod",
39
- "kit-prod",
40
- "backlog-delete",
41
- "backlog-cancel",
42
- "archive-plan",
43
- "hotfix",
44
- "run-plan-all"
45
- ]);
46
- function renderClaudeCommandAdapter(command) {
47
- const invocation = MODEL_INVOCATION_DISABLED.has(command.name) ? "disable-model-invocation: true\n" : "";
48
- return `---
49
- description: ${command.description}
50
- ${invocation}---
51
-
52
- Read \`.cursor/commands/${command.name}.md\` now and follow that contract exactly \u2014 it is the source of truth for /${command.name}; this file is only a thin adapter for Claude Code.
53
-
54
- Adapter rules (Claude Code CLI):
55
- - ${CLAUDE_HITL_FALLBACK}
56
- - Skip or cancel means stop.
57
- - Never \`/git-prod\` without an explicit operator yes.
58
- - Do not clone Cursor hooks or invent behavior beyond the SoT file.
59
- `;
60
- }
61
- async function discoverInstalledCommands(rootDir) {
62
- const dir = path.join(rootDir, CURSOR_COMMANDS_DIR_REL);
63
- let entries;
64
- try {
65
- entries = (await readdir(dir)).filter((f) => f.endsWith(".md"));
66
- } catch {
67
- return [];
68
- }
69
- const commands = [];
70
- for (const file of entries.sort()) {
71
- const name = file.slice(0, -3);
72
- if (RESERVED_ADAPTER_NAMES.has(name)) continue;
73
- try {
74
- const raw = await readFile(path.join(dir, file), "utf8");
75
- const parsed = parseCommandFrontmatter(name, raw);
76
- if (parsed) commands.push(parsed);
77
- } catch {
78
- }
79
- }
80
- return commands;
81
- }
82
- async function generateClaudeCommandAdapters(rootDir) {
83
- const commands = await discoverInstalledCommands(rootDir);
84
- if (commands.length === 0) return [];
85
- const ledger = await loadManagedHashLedger(rootDir);
86
- const results = [];
87
- let ledgerDirty = false;
88
- for (const command of commands) {
89
- const relPath = path.posix.join(CLAUDE_COMMANDS_DIR_REL, `${command.name}.md`);
90
- const rendered = renderClaudeCommandAdapter(command);
91
- const abs = resolveContained(rootDir, relPath);
92
- if (!await isRealWriteTargetContained(rootDir, abs)) {
93
- results.push({ relativePath: relPath, status: "skipped-symlink" });
94
- continue;
95
- }
96
- if (!await fileExists(abs)) {
97
- await ensureDir(path.dirname(abs));
98
- await writeFile(abs, rendered, "utf8");
99
- ledger.hashes[relPath] = contentHash(rendered);
100
- ledgerDirty = true;
101
- results.push({ relativePath: relPath, status: "applied" });
102
- continue;
103
- }
104
- const localContent = await readFile(abs, "utf8");
105
- if (localContent === rendered) {
106
- if (ledger.hashes[relPath] !== contentHash(rendered)) {
107
- ledger.hashes[relPath] = contentHash(rendered);
108
- ledgerDirty = true;
109
- }
110
- results.push({ relativePath: relPath, status: "unchanged" });
111
- continue;
112
- }
113
- if (shouldPreserveCustomizedOverlay(localContent, ledger.hashes[relPath])) {
114
- results.push({ relativePath: relPath, status: "preserved-customized" });
115
- continue;
116
- }
117
- await writeFile(abs, rendered, "utf8");
118
- ledger.hashes[relPath] = contentHash(rendered);
119
- ledgerDirty = true;
120
- results.push({ relativePath: relPath, status: "refreshed" });
121
- }
122
- if (ledgerDirty) await saveManagedHashLedger(rootDir, ledger);
123
- return results;
124
- }
125
-
126
15
  // src/generator/claude-session-start-hook.ts
127
- import { readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
128
- import path3 from "path";
16
+ import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
17
+ import path2 from "path";
129
18
 
130
19
  // src/generator/claude-settings-ledger.ts
131
- import { lstat, mkdir, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
132
- import path2 from "path";
20
+ import { lstat, mkdir, readFile, writeFile } from "fs/promises";
21
+ import path from "path";
133
22
  var CLAUDE_SETTINGS_LEDGER_REL = ".cursor/agent-kit.claude-settings.json";
134
23
  var ClaudeSettingsLedgerSymlinkError = class extends Error {
135
- constructor(path4, detail) {
136
- super(`Refusing to use Claude settings ledger ${path4}: ${detail}`);
137
- this.path = path4;
24
+ constructor(path3, detail) {
25
+ super(`Refusing to use Claude settings ledger ${path3}: ${detail}`);
26
+ this.path = path3;
138
27
  this.name = "ClaudeSettingsLedgerSymlinkError";
139
28
  }
140
29
  path;
141
30
  };
142
31
  var ClaudeSettingsLedgerInvalidError = class extends Error {
143
- constructor(path4) {
32
+ constructor(path3) {
144
33
  super(
145
- `Claude settings ledger ${path4} is malformed or has an unknown schemaVersion; not overwriting without authorization.`
34
+ `Claude settings ledger ${path3} is malformed or has an unknown schemaVersion; not overwriting without authorization.`
146
35
  );
147
- this.path = path4;
36
+ this.path = path3;
148
37
  this.name = "ClaudeSettingsLedgerInvalidError";
149
38
  }
150
39
  path;
@@ -213,7 +102,7 @@ async function readState(root) {
213
102
  );
214
103
  }
215
104
  if (!exists) return { abs, state: { kind: "missing" } };
216
- const ledger = parseLedger(await readFile2(abs, "utf8"));
105
+ const ledger = parseLedger(await readFile(abs, "utf8"));
217
106
  return { abs, state: ledger ? { kind: "ok", ledger } : { kind: "invalid" } };
218
107
  }
219
108
  async function loadClaudeSettingsLedger(root) {
@@ -231,8 +120,8 @@ async function saveClaudeSettingsLedger(root, additions, opts = {}) {
231
120
  [...base.allowRowsWritten, ...additions.allowRowsWritten ?? []],
232
121
  [...base.hookEntriesWritten, ...additions.hookEntriesWritten ?? []]
233
122
  );
234
- await mkdir(path2.dirname(abs), { recursive: true });
235
- await writeFile2(abs, `${JSON.stringify(merged, null, 2)}
123
+ await mkdir(path.dirname(abs), { recursive: true });
124
+ await writeFile(abs, `${JSON.stringify(merged, null, 2)}
236
125
  `, "utf8");
237
126
  return merged;
238
127
  }
@@ -425,7 +314,7 @@ async function writeClaudeSessionStartHook(rootDir, opts = {}) {
425
314
  }
426
315
  let existing = null;
427
316
  try {
428
- existing = await readFile3(abs, "utf8");
317
+ existing = await readFile2(abs, "utf8");
429
318
  } catch {
430
319
  existing = null;
431
320
  }
@@ -438,8 +327,8 @@ async function writeClaudeSessionStartHook(rootDir, opts = {}) {
438
327
  };
439
328
  }
440
329
  if (merged.status !== "unchanged") {
441
- await ensureDir(path3.dirname(abs));
442
- await writeFile3(abs, merged.content, "utf8");
330
+ await ensureDir(path2.dirname(abs));
331
+ await writeFile2(abs, merged.content, "utf8");
443
332
  }
444
333
  const result = {
445
334
  relativePath: CLAUDE_SETTINGS_REL,
@@ -466,7 +355,7 @@ async function planClaudeSettingsDrift(rootDir) {
466
355
  if (!await isRealWriteTargetContained(rootDir, abs)) return null;
467
356
  let raw;
468
357
  try {
469
- raw = await readFile3(abs, "utf8");
358
+ raw = await readFile2(abs, "utf8");
470
359
  } catch {
471
360
  return null;
472
361
  }
@@ -547,10 +436,6 @@ function formatClaudeSettingsDrift(report, opts) {
547
436
  }
548
437
 
549
438
  export {
550
- CLAUDE_COMMANDS_DIR_REL,
551
- CLAUDE_HITL_FALLBACK,
552
- discoverInstalledCommands,
553
- generateClaudeCommandAdapters,
554
439
  CLAUDE_SETTINGS_REL,
555
440
  RESOLVE_AGENT_KIT_REL,
556
441
  SESSION_START_HOOK_MARKER,
@@ -0,0 +1,125 @@
1
+ import {
2
+ contentHash,
3
+ isRealWriteTargetContained,
4
+ loadManagedHashLedger,
5
+ resolveContained,
6
+ saveManagedHashLedger,
7
+ shouldPreserveCustomizedOverlay
8
+ } from "./chunk-VZ3O4OKE.js";
9
+ import {
10
+ ensureDir,
11
+ fileExists
12
+ } from "./chunk-5B4DVO6C.js";
13
+
14
+ // src/generator/claude-command-adapters.ts
15
+ import { readdir, readFile, writeFile } from "fs/promises";
16
+ import path from "path";
17
+ var CURSOR_COMMANDS_DIR_REL = ".cursor/commands";
18
+ var CLAUDE_COMMANDS_DIR_REL = ".claude/commands";
19
+ var RESERVED_ADAPTER_NAMES = /* @__PURE__ */ new Set(["agent-kit"]);
20
+ function parseCommandFrontmatter(name, raw) {
21
+ const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
22
+ if (!match) return null;
23
+ const body = match[1] ?? "";
24
+ const descMatch = /^description:\s*(.+)$/m.exec(body);
25
+ if (!descMatch) return null;
26
+ const description = (descMatch[1] ?? "").trim();
27
+ if (!description) return null;
28
+ return { name, description };
29
+ }
30
+ var CLAUDE_HITL_FALLBACK = `Cursor "Ask questions" is unavailable here: use AskUserQuestion when possible, else print one line \`HITL_GATE: <ask-id> | <label 1> | <label 2> | ...\` immediately followed by the same labels as one numbered list, one list per message, and WAIT for the answer (ask-id and labels: \`.cursor/skills/core/hitl-gates/SKILL.md\`). A headless reply arrives as \`HITL_REPLY: <ask-id> | operator reply <n> | <label>\`; cite that line as the Ask provenance.`;
31
+ var MODEL_INVOCATION_DISABLED = /* @__PURE__ */ new Set([
32
+ "git-prod",
33
+ "kit-prod",
34
+ "backlog-delete",
35
+ "backlog-cancel",
36
+ "archive-plan",
37
+ "hotfix",
38
+ "run-plan-all"
39
+ ]);
40
+ function renderClaudeCommandAdapter(command) {
41
+ const invocation = MODEL_INVOCATION_DISABLED.has(command.name) ? "disable-model-invocation: true\n" : "";
42
+ return `---
43
+ description: ${command.description}
44
+ ${invocation}---
45
+
46
+ Read \`.cursor/commands/${command.name}.md\` now and follow that contract exactly \u2014 it is the source of truth for /${command.name}; this file is only a thin adapter for Claude Code.
47
+
48
+ Adapter rules (Claude Code CLI):
49
+ - ${CLAUDE_HITL_FALLBACK}
50
+ - Skip or cancel means stop.
51
+ - Never \`/git-prod\` without an explicit operator yes.
52
+ - Do not clone Cursor hooks or invent behavior beyond the SoT file.
53
+ `;
54
+ }
55
+ async function discoverInstalledCommands(rootDir) {
56
+ const dir = path.join(rootDir, CURSOR_COMMANDS_DIR_REL);
57
+ let entries;
58
+ try {
59
+ entries = (await readdir(dir)).filter((f) => f.endsWith(".md"));
60
+ } catch {
61
+ return [];
62
+ }
63
+ const commands = [];
64
+ for (const file of entries.sort()) {
65
+ const name = file.slice(0, -3);
66
+ if (RESERVED_ADAPTER_NAMES.has(name)) continue;
67
+ try {
68
+ const raw = await readFile(path.join(dir, file), "utf8");
69
+ const parsed = parseCommandFrontmatter(name, raw);
70
+ if (parsed) commands.push(parsed);
71
+ } catch {
72
+ }
73
+ }
74
+ return commands;
75
+ }
76
+ async function generateClaudeCommandAdapters(rootDir) {
77
+ const commands = await discoverInstalledCommands(rootDir);
78
+ if (commands.length === 0) return [];
79
+ const ledger = await loadManagedHashLedger(rootDir);
80
+ const results = [];
81
+ let ledgerDirty = false;
82
+ for (const command of commands) {
83
+ const relPath = path.posix.join(CLAUDE_COMMANDS_DIR_REL, `${command.name}.md`);
84
+ const rendered = renderClaudeCommandAdapter(command);
85
+ const abs = resolveContained(rootDir, relPath);
86
+ if (!await isRealWriteTargetContained(rootDir, abs)) {
87
+ results.push({ relativePath: relPath, status: "skipped-symlink" });
88
+ continue;
89
+ }
90
+ if (!await fileExists(abs)) {
91
+ await ensureDir(path.dirname(abs));
92
+ await writeFile(abs, rendered, "utf8");
93
+ ledger.hashes[relPath] = contentHash(rendered);
94
+ ledgerDirty = true;
95
+ results.push({ relativePath: relPath, status: "applied" });
96
+ continue;
97
+ }
98
+ const localContent = await readFile(abs, "utf8");
99
+ if (localContent === rendered) {
100
+ if (ledger.hashes[relPath] !== contentHash(rendered)) {
101
+ ledger.hashes[relPath] = contentHash(rendered);
102
+ ledgerDirty = true;
103
+ }
104
+ results.push({ relativePath: relPath, status: "unchanged" });
105
+ continue;
106
+ }
107
+ if (shouldPreserveCustomizedOverlay(localContent, ledger.hashes[relPath])) {
108
+ results.push({ relativePath: relPath, status: "preserved-customized" });
109
+ continue;
110
+ }
111
+ await writeFile(abs, rendered, "utf8");
112
+ ledger.hashes[relPath] = contentHash(rendered);
113
+ ledgerDirty = true;
114
+ results.push({ relativePath: relPath, status: "refreshed" });
115
+ }
116
+ if (ledgerDirty) await saveManagedHashLedger(rootDir, ledger);
117
+ return results;
118
+ }
119
+
120
+ export {
121
+ CLAUDE_COMMANDS_DIR_REL,
122
+ CLAUDE_HITL_FALLBACK,
123
+ discoverInstalledCommands,
124
+ generateClaudeCommandAdapters
125
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isBranchInBase
3
- } from "./chunk-FM32XR7A.js";
3
+ } from "./chunk-BSYQJ5WF.js";
4
4
  import {
5
5
  GATE_EXIT_BRANCH_PREFIX,
6
6
  GATE_EXIT_NOTE_DIR,
@@ -11,7 +11,7 @@ import {
11
11
  isSafeBaseRef,
12
12
  landGateExit,
13
13
  resolveGateExitRefs
14
- } from "./chunk-GIZNM73K.js";
14
+ } from "./chunk-26KXYR5T.js";
15
15
  import {
16
16
  ensurePathIgnored
17
17
  } from "./chunk-MUTTNRX4.js";
@@ -19,10 +19,10 @@ import {
19
19
  ensureDispatchLogPath,
20
20
  readCommandFile,
21
21
  runHeadlessDispatch
22
- } from "./chunk-U7XOLYDG.js";
22
+ } from "./chunk-BZI5G3OZ.js";
23
23
  import {
24
24
  redactSecrets
25
- } from "./chunk-2TCRKQHD.js";
25
+ } from "./chunk-6UKI4CAN.js";
26
26
  import {
27
27
  formatHitlSummary,
28
28
  hitlExitCode