@dadado/agent-kit-cli 6.6.0 → 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 (33) 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-I2D75F4I.js → chunk-2DETOPCK.js} +11 -9
  4. package/dist/{chunk-IN4MQ3P3.js → chunk-2KIOZMTV.js} +1 -48
  5. package/dist/{chunk-TNO7GTAJ.js → chunk-54T36ZDX.js} +5 -3
  6. package/dist/{chunk-EI3VQ7FU.js → chunk-5YU3BSCN.js} +2 -2
  7. package/dist/{chunk-MEZUW3LL.js → chunk-A3OJLKPH.js} +1 -1
  8. package/dist/{chunk-WUEXATDP.js → chunk-BZI5G3OZ.js} +1 -0
  9. package/dist/chunk-EHY2UZP3.js +52 -0
  10. package/dist/{chunk-YIOTJQHL.js → chunk-FLP2YVRO.js} +2 -2
  11. package/dist/{chunk-5LQP4JGH.js → chunk-GSCTZOS7.js} +7 -5
  12. package/dist/{chunk-34BBPQKI.js → chunk-HOFZX4M2.js} +1 -1
  13. package/dist/{chunk-WOGBBJCX.js → chunk-NSOWSTAL.js} +5 -3
  14. package/dist/{chunk-236IYK6L.js → chunk-QE4L2PVJ.js} +20 -135
  15. package/dist/chunk-QH33EIMD.js +125 -0
  16. package/dist/{chunk-U2IMEYGQ.js → chunk-S7XAV6JK.js} +1 -1
  17. package/dist/chunk-TL7AXLEU.js +967 -0
  18. package/dist/chunk-VZ3O4OKE.js +522 -0
  19. package/dist/commands-SIM2UP5W.js +92 -0
  20. package/dist/{contribute-V7PV5UMK.js → contribute-WEYAE7CE.js} +7 -4
  21. package/dist/{countdown-YZSJQXYS.js → countdown-XYRE4GZU.js} +2 -2
  22. package/dist/{diff-GWIHGH65.js → diff-ETCHVI7X.js} +6 -4
  23. package/dist/{doctor-FLIQCVFN.js → doctor-YRHSU3L2.js} +10 -7
  24. package/dist/{hook-2SX2V2T6.js → hook-MUTYISDL.js} +6 -4
  25. package/dist/index.js +18 -16
  26. package/dist/{init-4B2IRH27.js → init-7IOQCK6T.js} +13 -10
  27. package/dist/{install-3JVTG35O.js → install-LUFSJOYK.js} +13 -10
  28. package/dist/{run-CWA6Q4TC.js → run-QG7XQ3XF.js} +2 -2
  29. package/dist/{setup-global-6JM5XTAT.js → setup-global-6JE6LSPE.js} +7 -5
  30. package/dist/{status-PMAI7NH3.js → status-YZRSVZM2.js} +8 -6
  31. package/dist/{update-3PLY4FZA.js → update-ZEYO6ZS7.js} +15 -10
  32. package/package.json +1 -1
  33. package/dist/chunk-5WSFO35Y.js +0 -1473
@@ -1780,6 +1780,40 @@ export function planQueueRole(plan, runQueueView) {
1780
1780
  return "none";
1781
1781
  }
1782
1782
 
1783
+ /**
1784
+ * In /run-plan-all mode, resolve the queue cursor plan as active when HANDOFF
1785
+ * `Plan:` still names a terminal (or missing) plan, e.g. a /hotfix mini plan the
1786
+ * queue resumed past without handing `Plan:` back. Narrowest condition only:
1787
+ * the cursor resolves, its plan exists with open to-dos, is not parked, and has
1788
+ * no terminal queue outcome. Every other case returns the HANDOFF unchanged
1789
+ * (false negative over guessing).
1790
+ * @param {object[]} plans
1791
+ * @param {object|null} handoff
1792
+ * @returns {object|null} the same handoff, or a copy with `plan`/`planPath` swapped
1793
+ */
1794
+ export function resolveQueueActiveHandoff(plans, handoff) {
1795
+ if (!handoffPlanKey(handoff)) return handoff;
1796
+ const view = buildRunQueueView(handoff);
1797
+ if (!view || view.cursor === null) return handoff;
1798
+ const cursorKey = view.queue[view.cursor];
1799
+ if (!cursorKey || cursorKey === handoffPlanKey(handoff)) return handoff;
1800
+ if (TERMINAL_QUEUE_OUTCOMES.has(view.outcomes[cursorKey])) return handoff;
1801
+
1802
+ const cursorPlan = (plans || []).find((p) => planFileKey(p) === cursorKey);
1803
+ if (!cursorPlan || todoStats(cursorPlan).open === 0) return handoff;
1804
+ if (isParkedPlan(cursorPlan, handoff)) return handoff;
1805
+
1806
+ const named = (plans || []).find((p) => isExactActivePlan(p, handoff));
1807
+ if (named && todoStats(named).open > 0) return handoff;
1808
+
1809
+ return {
1810
+ ...handoff,
1811
+ plan: cursorKey,
1812
+ planPath: cursorPlan.path || `.cursor/plans/${cursorKey}`,
1813
+ planFromQueueCursor: true,
1814
+ };
1815
+ }
1816
+
1783
1817
  function planFileKey(plan) {
1784
1818
  if (!plan) return "";
1785
1819
  return String(plan.file || plan.path || plan.id || "")
@@ -1807,6 +1841,14 @@ function isActivePlan(plan, handoff) {
1807
1841
  );
1808
1842
  }
1809
1843
 
1844
+ /** Exact basename match with HANDOFF `Plan:` (no substring fallback). */
1845
+ function isExactActivePlan(plan, handoff) {
1846
+ const active = handoffPlanKey(handoff);
1847
+ const key = planFileKey(plan);
1848
+ if (!active || !key) return false;
1849
+ return key === active || key === `${active}.plan.md`;
1850
+ }
1851
+
1810
1852
  function planListedIn(plan, list) {
1811
1853
  if (!Array.isArray(list) || list.length === 0) return false;
1812
1854
  const key = planFileKey(plan);
@@ -1881,17 +1923,21 @@ function modeImpliesExecuting(mode) {
1881
1923
  * Active plan: terminal todos (open === 0) are always completed, even when Mode
1882
1924
  * still says run-plan before Final HANDOFF writes STOPPED/exhausted. Open work
1883
1925
  * never classifies as completed (pending/in_progress hold the mission live).
1926
+ * The plan HANDOFF `Plan:` names exactly wins over a Parked/Backlog row: a plan
1927
+ * cannot be active and parked/queued at once, so that row is stale (left behind
1928
+ * when a queue or hotfix activated the plan without removing it).
1884
1929
  * @returns {'executing'|'awaiting_user'|'parked'|'backlog'|'incomplete'|'completed'}
1885
1930
  */
1886
1931
  export function classifyPlan(plan, handoff) {
1887
1932
  const stats = todoStats(plan);
1933
+ const exactActive = isExactActivePlan(plan, handoff);
1888
1934
 
1889
- if (isParkedPlan(plan, handoff)) {
1935
+ if (!exactActive && isParkedPlan(plan, handoff)) {
1890
1936
  if (stats.open === 0) return "completed";
1891
1937
  return "parked";
1892
1938
  }
1893
1939
 
1894
- if (isBacklogPlan(plan, handoff)) {
1940
+ if (!exactActive && isBacklogPlan(plan, handoff)) {
1895
1941
  if (stats.open === 0) return "completed";
1896
1942
  return "backlog";
1897
1943
  }
@@ -3838,6 +3884,7 @@ export function buildMissionControlView({
3838
3884
  gateExitTickets = [],
3839
3885
  nowMs = Date.now(),
3840
3886
  } = {}) {
3887
+ handoff = resolveQueueActiveHandoff(plans, handoff);
3841
3888
  const nowBase = buildCurrentExecution(plans, handoff);
3842
3889
  const activeForTiming = (plans || []).find((p) => isActivePlan(p, handoff)) || null;
3843
3890
  const { ledger: nextTimingLedger, timing } = observeMissionTiming(
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  REGISTRY_CLI_ARGS,
7
7
  resolveRegistryFromCli
8
- } from "./chunk-34BBPQKI.js";
8
+ } from "./chunk-HOFZX4M2.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-ZB43YMHW.js";
@@ -22,7 +22,8 @@ import {
22
22
  resolveProtectedGlobs,
23
23
  saveManifest,
24
24
  upsertIdList
25
- } from "./chunk-5WSFO35Y.js";
25
+ } from "./chunk-TL7AXLEU.js";
26
+ import "./chunk-VZ3O4OKE.js";
26
27
  import {
27
28
  KIT_VERSION
28
29
  } from "./chunk-7HDQEK6T.js";
@@ -6,7 +6,7 @@ import {
6
6
  formatStaleCliRefusal,
7
7
  installL0,
8
8
  syncFromManifest
9
- } from "./chunk-5LQP4JGH.js";
9
+ } from "./chunk-GSCTZOS7.js";
10
10
  import {
11
11
  SkippedSymlinkError,
12
12
  formatPersonalizationSkippedSymlinks,
@@ -15,19 +15,21 @@ import {
15
15
  import {
16
16
  REGISTRY_CLI_ARGS,
17
17
  resolveRegistryFromCli
18
- } from "./chunk-34BBPQKI.js";
18
+ } from "./chunk-HOFZX4M2.js";
19
19
  import {
20
20
  assessClaudeCommandAdapters,
21
21
  executeSafeReadinessFixes
22
- } from "./chunk-WOGBBJCX.js";
22
+ } from "./chunk-NSOWSTAL.js";
23
23
  import {
24
24
  writeReadinessSnapshot
25
25
  } from "./chunk-HAFRAXGV.js";
26
26
  import {
27
- CLAUDE_HITL_FALLBACK,
28
- generateClaudeCommandAdapters,
29
27
  writeClaudeSessionStartHook
30
- } from "./chunk-236IYK6L.js";
28
+ } from "./chunk-QE4L2PVJ.js";
29
+ import {
30
+ CLAUDE_HITL_FALLBACK,
31
+ generateClaudeCommandAdapters
32
+ } from "./chunk-QH33EIMD.js";
31
33
  import {
32
34
  shouldUseWelcomeColor,
33
35
  withCliProgress
@@ -54,13 +56,13 @@ import {
54
56
  npxPinned,
55
57
  pathCliStatus,
56
58
  syncPathCliToRuntime
57
- } from "./chunk-EI3VQ7FU.js";
59
+ } from "./chunk-5YU3BSCN.js";
58
60
  import {
59
61
  assessEnvironment
60
62
  } from "./chunk-B3VR5YBQ.js";
61
63
  import {
62
64
  warnIfRunningCliBehindNpm
63
- } from "./chunk-YIOTJQHL.js";
65
+ } from "./chunk-FLP2YVRO.js";
64
66
  import {
65
67
  DOMAIN_PACK_IDS,
66
68
  allPacks,
@@ -77,7 +79,7 @@ import {
77
79
  resolveProtectedGlobs,
78
80
  saveManifest,
79
81
  skillTargetDir
80
- } from "./chunk-5WSFO35Y.js";
82
+ } from "./chunk-TL7AXLEU.js";
81
83
  import {
82
84
  KIT_VERSION,
83
85
  pinnedCliSpec
@@ -1,11 +1,3 @@
1
- import {
2
- allSkills,
3
- loadPackManifest,
4
- loadRegistry,
5
- packMemberFileTargets,
6
- skillFileTargets
7
- } from "./chunk-5WSFO35Y.js";
8
-
9
1
  // src/lifecycle/l0.ts
10
2
  var L0_ARTIFACTS = [
11
3
  // Rules
@@ -305,45 +297,6 @@ var L0_ARTIFACTS = [
305
297
  }
306
298
  ];
307
299
 
308
- // src/lifecycle/targets.ts
309
- import path from "path";
310
- var toPosix = (rel) => rel.split(path.sep).join("/");
311
- async function managedPairs(registryRoot, manifest, index) {
312
- const pairs = [];
313
- const missingSkills = [];
314
- const push = (sourceRel, targetRel, origin) => {
315
- pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
316
- };
317
- for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
318
- for (const packId of manifest.packs ?? []) {
319
- const pack = await loadPackManifest(registryRoot, packId);
320
- for (const member of pack.members) {
321
- for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
322
- push(sourceRel, targetRel, "pack");
323
- }
324
- }
325
- }
326
- if ((manifest.skills ?? []).length > 0) {
327
- const pool = allSkills(index ?? await loadRegistry(registryRoot));
328
- for (const id of manifest.skills ?? []) {
329
- const skill = pool.find((s) => s.id === id);
330
- if (!skill) {
331
- missingSkills.push(id);
332
- continue;
333
- }
334
- for (const { sourceRel, targetRel } of await skillFileTargets(
335
- registryRoot,
336
- skill.path,
337
- skill.id
338
- )) {
339
- push(sourceRel, targetRel, "skill");
340
- }
341
- }
342
- }
343
- return { pairs, missingSkills };
344
- }
345
-
346
300
  export {
347
- L0_ARTIFACTS,
348
- managedPairs
301
+ L0_ARTIFACTS
349
302
  };
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  managedPairs
3
- } from "./chunk-IN4MQ3P3.js";
3
+ } from "./chunk-EHY2UZP3.js";
4
4
  import {
5
5
  isProtectedPath,
6
- resolveContained,
7
6
  resolveProtectedGlobs
8
- } from "./chunk-5WSFO35Y.js";
7
+ } from "./chunk-TL7AXLEU.js";
8
+ import {
9
+ resolveContained
10
+ } from "./chunk-VZ3O4OKE.js";
9
11
 
10
12
  // src/lifecycle/diff.ts
11
13
  import { readFile } from "fs/promises";
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  compareSemver,
6
6
  normalizeSemver
7
- } from "./chunk-YIOTJQHL.js";
7
+ } from "./chunk-FLP2YVRO.js";
8
8
  import {
9
9
  MANIFEST_RELATIVE_PATH
10
- } from "./chunk-5WSFO35Y.js";
10
+ } from "./chunk-TL7AXLEU.js";
11
11
  import {
12
12
  KIT_VERSION,
13
13
  pinnedCliSpec
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MANIFEST_RELATIVE_PATH
3
- } from "./chunk-5WSFO35Y.js";
3
+ } from "./chunk-TL7AXLEU.js";
4
4
  import {
5
5
  fileExists
6
6
  } from "./chunk-5B4DVO6C.js";
@@ -211,6 +211,7 @@ async function ensureDispatchLogPath(root) {
211
211
  }
212
212
 
213
213
  export {
214
+ RUN_CATALOG,
214
215
  normalizeSlashName,
215
216
  classifySlash,
216
217
  rewriteRootArgvToRun,
@@ -0,0 +1,52 @@
1
+ import {
2
+ L0_ARTIFACTS
3
+ } from "./chunk-2KIOZMTV.js";
4
+ import {
5
+ allSkills,
6
+ loadPackManifest,
7
+ loadRegistry,
8
+ packMemberFileTargets,
9
+ skillFileTargets
10
+ } from "./chunk-TL7AXLEU.js";
11
+
12
+ // src/lifecycle/targets.ts
13
+ import path from "path";
14
+ var toPosix = (rel) => rel.split(path.sep).join("/");
15
+ async function managedPairs(registryRoot, manifest, index) {
16
+ const pairs = [];
17
+ const missingSkills = [];
18
+ const push = (sourceRel, targetRel, origin) => {
19
+ pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
20
+ };
21
+ for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
22
+ for (const packId of manifest.packs ?? []) {
23
+ const pack = await loadPackManifest(registryRoot, packId);
24
+ for (const member of pack.members) {
25
+ for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
26
+ push(sourceRel, targetRel, "pack");
27
+ }
28
+ }
29
+ }
30
+ if ((manifest.skills ?? []).length > 0) {
31
+ const pool = allSkills(index ?? await loadRegistry(registryRoot));
32
+ for (const id of manifest.skills ?? []) {
33
+ const skill = pool.find((s) => s.id === id);
34
+ if (!skill) {
35
+ missingSkills.push(id);
36
+ continue;
37
+ }
38
+ for (const { sourceRel, targetRel } of await skillFileTargets(
39
+ registryRoot,
40
+ skill.path,
41
+ skill.id
42
+ )) {
43
+ push(sourceRel, targetRel, "skill");
44
+ }
45
+ }
46
+ }
47
+ return { pairs, missingSkills };
48
+ }
49
+
50
+ export {
51
+ managedPairs
52
+ };
@@ -6,13 +6,13 @@ import {
6
6
  import {
7
7
  diffAgainstRegistry,
8
8
  summarizeDiff
9
- } from "./chunk-TNO7GTAJ.js";
9
+ } from "./chunk-54T36ZDX.js";
10
10
  import {
11
11
  DEFAULT_REGISTRY_URL,
12
12
  assertSafeRegistrySource,
13
13
  loadAgentKitManifest,
14
14
  resolveRegistryRoot
15
- } from "./chunk-5WSFO35Y.js";
15
+ } from "./chunk-TL7AXLEU.js";
16
16
  import {
17
17
  KIT_PACKAGE_SPEC,
18
18
  KIT_VERSION
@@ -2,22 +2,24 @@ import {
2
2
  compareSemver,
3
3
  normalizeSemver,
4
4
  readLocalKitVersion
5
- } from "./chunk-YIOTJQHL.js";
5
+ } from "./chunk-FLP2YVRO.js";
6
6
  import {
7
7
  L0_ARTIFACTS
8
- } from "./chunk-IN4MQ3P3.js";
8
+ } from "./chunk-2KIOZMTV.js";
9
9
  import {
10
10
  copyRegistryFile,
11
11
  emptyStats,
12
12
  installPack,
13
13
  installSkillsByIds,
14
- loadManagedHashLedger,
15
14
  loadRegistry,
16
15
  mergeStats,
17
16
  recordOutcome,
18
- resolveProtectedGlobs,
17
+ resolveProtectedGlobs
18
+ } from "./chunk-TL7AXLEU.js";
19
+ import {
20
+ loadManagedHashLedger,
19
21
  saveManagedHashLedger
20
- } from "./chunk-5WSFO35Y.js";
22
+ } from "./chunk-VZ3O4OKE.js";
21
23
  import {
22
24
  KIT_PACKAGE_SPEC,
23
25
  KIT_VERSION
@@ -5,7 +5,7 @@ import {
5
5
  DEFAULT_REGISTRY_REF,
6
6
  DEFAULT_REGISTRY_URL,
7
7
  resolveRegistryRoot
8
- } from "./chunk-5WSFO35Y.js";
8
+ } from "./chunk-TL7AXLEU.js";
9
9
 
10
10
  // src/lifecycle/resolve-cli.ts
11
11
  async function resolveRegistryFromCli(options) {
@@ -1,11 +1,13 @@
1
1
  import {
2
- CLAUDE_COMMANDS_DIR_REL,
3
2
  CLAUDE_SETTINGS_REL,
4
3
  GUARD_SHELL_HOOK_MARKER,
5
4
  RESOLVE_AGENT_KIT_REL,
6
- SESSION_START_HOOK_MARKER,
5
+ SESSION_START_HOOK_MARKER
6
+ } from "./chunk-QE4L2PVJ.js";
7
+ import {
8
+ CLAUDE_COMMANDS_DIR_REL,
7
9
  discoverInstalledCommands
8
- } from "./chunk-236IYK6L.js";
10
+ } from "./chunk-QH33EIMD.js";
9
11
  import {
10
12
  findOnPath
11
13
  } from "./chunk-WGLPZXNU.js";
@@ -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,