@dadado/agent-kit-cli 6.6.0 → 6.7.1
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.
- package/dashboard/lib/semantic-model.mjs +49 -2
- package/dist/{add-IT6XFPKT.js → add-7GH3K44T.js} +3 -2
- package/dist/{chunk-IN4MQ3P3.js → chunk-2KIOZMTV.js} +1 -48
- package/dist/{chunk-YIOTJQHL.js → chunk-52WYZFP5.js} +2 -2
- package/dist/{chunk-I2D75F4I.js → chunk-67G3236R.js} +11 -9
- package/dist/chunk-6LRY2CYU.js +523 -0
- package/dist/{chunk-34BBPQKI.js → chunk-75ELVLBY.js} +1 -1
- package/dist/{chunk-WOGBBJCX.js → chunk-BCX5NDQC.js} +5 -3
- package/dist/{chunk-MEZUW3LL.js → chunk-BIFWN6BJ.js} +1 -1
- package/dist/{chunk-WUEXATDP.js → chunk-BZI5G3OZ.js} +1 -0
- package/dist/{chunk-5LQP4JGH.js → chunk-HIJTNHJE.js} +7 -5
- package/dist/chunk-HVH24VRL.js +967 -0
- package/dist/chunk-LGSNC4OI.js +125 -0
- package/dist/chunk-LPZ2KXVE.js +52 -0
- package/dist/{chunk-TNO7GTAJ.js → chunk-O5FKTKOW.js} +5 -3
- package/dist/{chunk-U2IMEYGQ.js → chunk-S7XAV6JK.js} +1 -1
- package/dist/{chunk-EI3VQ7FU.js → chunk-TZA7MT4I.js} +2 -2
- package/dist/{chunk-236IYK6L.js → chunk-ZF4YBL7F.js} +20 -135
- package/dist/commands-EQHK3ZEP.js +92 -0
- package/dist/{contribute-V7PV5UMK.js → contribute-VSVPRHQ7.js} +7 -4
- package/dist/{countdown-YZSJQXYS.js → countdown-XYRE4GZU.js} +2 -2
- package/dist/{diff-GWIHGH65.js → diff-4P7LMQK5.js} +6 -4
- package/dist/{doctor-FLIQCVFN.js → doctor-PZT7EGLQ.js} +10 -7
- package/dist/{hook-2SX2V2T6.js → hook-HJW5SXQG.js} +6 -4
- package/dist/index.js +18 -16
- package/dist/{init-4B2IRH27.js → init-MGRZ7U7A.js} +13 -10
- package/dist/{install-3JVTG35O.js → install-432KJISB.js} +13 -10
- package/dist/{run-CWA6Q4TC.js → run-QG7XQ3XF.js} +2 -2
- package/dist/{setup-global-6JM5XTAT.js → setup-global-BFBSR2RZ.js} +7 -5
- package/dist/{status-PMAI7NH3.js → status-UDM55MHU.js} +8 -6
- package/dist/{update-3PLY4FZA.js → update-PX5XFCSG.js} +15 -10
- package/package.json +1 -1
- package/dist/chunk-5WSFO35Y.js +0 -1473
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contentHash,
|
|
3
|
+
isRealWriteTargetContained,
|
|
4
|
+
loadManagedHashLedger,
|
|
5
|
+
resolveContained,
|
|
6
|
+
saveManagedHashLedger,
|
|
7
|
+
shouldPreserveCustomizedOverlay
|
|
8
|
+
} from "./chunk-6LRY2CYU.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
|
+
};
|
|
@@ -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-HVH24VRL.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
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
managedPairs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LPZ2KXVE.js";
|
|
4
4
|
import {
|
|
5
5
|
isProtectedPath,
|
|
6
|
-
resolveContained,
|
|
7
6
|
resolveProtectedGlobs
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HVH24VRL.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveContained
|
|
10
|
+
} from "./chunk-6LRY2CYU.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-
|
|
7
|
+
} from "./chunk-52WYZFP5.js";
|
|
8
8
|
import {
|
|
9
9
|
MANIFEST_RELATIVE_PATH
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HVH24VRL.js";
|
|
11
11
|
import {
|
|
12
12
|
KIT_VERSION,
|
|
13
13
|
pinnedCliSpec
|
|
@@ -5,146 +5,35 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
assertRealContained,
|
|
7
7
|
assertRealParentContained,
|
|
8
|
-
contentHash,
|
|
9
8
|
isRealWriteTargetContained,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
saveManagedHashLedger,
|
|
13
|
-
shouldPreserveCustomizedOverlay
|
|
14
|
-
} from "./chunk-5WSFO35Y.js";
|
|
9
|
+
resolveContained
|
|
10
|
+
} from "./chunk-6LRY2CYU.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
|
|
128
|
-
import
|
|
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
|
|
132
|
-
import
|
|
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(
|
|
136
|
-
super(`Refusing to use Claude settings ledger ${
|
|
137
|
-
this.path =
|
|
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(
|
|
32
|
+
constructor(path3) {
|
|
144
33
|
super(
|
|
145
|
-
`Claude settings ledger ${
|
|
34
|
+
`Claude settings ledger ${path3} is malformed or has an unknown schemaVersion; not overwriting without authorization.`
|
|
146
35
|
);
|
|
147
|
-
this.path =
|
|
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
|
|
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(
|
|
235
|
-
await
|
|
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
|
|
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(
|
|
442
|
-
await
|
|
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
|
|
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,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RUN_CATALOG
|
|
3
|
+
} from "./chunk-BZI5G3OZ.js";
|
|
4
|
+
import "./chunk-6UKI4CAN.js";
|
|
5
|
+
import "./chunk-MTLQN57O.js";
|
|
6
|
+
import {
|
|
7
|
+
discoverInstalledCommands
|
|
8
|
+
} from "./chunk-LGSNC4OI.js";
|
|
9
|
+
import "./chunk-WGLPZXNU.js";
|
|
10
|
+
import "./chunk-6RRG3WOE.js";
|
|
11
|
+
import "./chunk-QTON2GQX.js";
|
|
12
|
+
import {
|
|
13
|
+
L0_ARTIFACTS
|
|
14
|
+
} from "./chunk-2KIOZMTV.js";
|
|
15
|
+
import "./chunk-6LRY2CYU.js";
|
|
16
|
+
import {
|
|
17
|
+
KIT_VERSION
|
|
18
|
+
} from "./chunk-7HDQEK6T.js";
|
|
19
|
+
import "./chunk-C4Q77GGJ.js";
|
|
20
|
+
import "./chunk-5B4DVO6C.js";
|
|
21
|
+
|
|
22
|
+
// src/commands/commands.ts
|
|
23
|
+
import path from "path";
|
|
24
|
+
import { defineCommand } from "citty";
|
|
25
|
+
|
|
26
|
+
// src/lifecycle/commands-catalog.ts
|
|
27
|
+
var COMMANDS_CATALOG_VERSION = "1.0.0";
|
|
28
|
+
var COMMAND_NAME_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
29
|
+
var COMMANDS_PREFIX = ".cursor/commands/";
|
|
30
|
+
var NON_L0_KIT_COMMAND_IDS = /* @__PURE__ */ new Set(["context-status", "tips"]);
|
|
31
|
+
var KIT_COMMAND_IDS = /* @__PURE__ */ new Set([
|
|
32
|
+
...L0_ARTIFACTS.filter((a) => a.source.startsWith(COMMANDS_PREFIX)).map(
|
|
33
|
+
(a) => a.source.slice(COMMANDS_PREFIX.length).replace(/\.md$/, "")
|
|
34
|
+
),
|
|
35
|
+
...NON_L0_KIT_COMMAND_IDS
|
|
36
|
+
]);
|
|
37
|
+
var FACTORY_COMMAND_IDS = /* @__PURE__ */ new Set([
|
|
38
|
+
"kit-prod",
|
|
39
|
+
"kit-staging",
|
|
40
|
+
"public-inbound-radar",
|
|
41
|
+
"public-issue-triage"
|
|
42
|
+
]);
|
|
43
|
+
function commandLayer(name) {
|
|
44
|
+
if (KIT_COMMAND_IDS.has(name)) return "kit";
|
|
45
|
+
if (FACTORY_COMMAND_IDS.has(name)) return "factory";
|
|
46
|
+
return "project";
|
|
47
|
+
}
|
|
48
|
+
async function buildCommandsCatalog(rootDir) {
|
|
49
|
+
const headless = new Set(RUN_CATALOG);
|
|
50
|
+
const commands = (await discoverInstalledCommands(rootDir)).filter((c) => COMMAND_NAME_RE.test(c.name)).map((c) => ({
|
|
51
|
+
name: c.name,
|
|
52
|
+
description: c.description,
|
|
53
|
+
layer: commandLayer(c.name),
|
|
54
|
+
headless: headless.has(c.name)
|
|
55
|
+
})).sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
56
|
+
return { catalogVersion: COMMANDS_CATALOG_VERSION, kitVersion: KIT_VERSION, commands };
|
|
57
|
+
}
|
|
58
|
+
function renderCommandsCatalog(catalog) {
|
|
59
|
+
if (catalog.commands.length === 0) return "No slash commands found in .cursor/commands/.";
|
|
60
|
+
const width = Math.max(...catalog.commands.map((c) => c.name.length)) + 1;
|
|
61
|
+
return catalog.commands.map((c) => {
|
|
62
|
+
const tags = [c.layer, ...c.headless ? ["headless"] : []].join(", ");
|
|
63
|
+
return `/${c.name.padEnd(width)} [${tags}] ${c.description}`;
|
|
64
|
+
}).join("\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/commands/commands.ts
|
|
68
|
+
var commandsCommand = defineCommand({
|
|
69
|
+
meta: {
|
|
70
|
+
name: "commands",
|
|
71
|
+
description: "List the workspace's slash commands (name, description, layer, headless hint)"
|
|
72
|
+
},
|
|
73
|
+
args: {
|
|
74
|
+
cwd: {
|
|
75
|
+
type: "string",
|
|
76
|
+
default: process.cwd(),
|
|
77
|
+
description: "Workspace root to read .cursor/commands/ from"
|
|
78
|
+
},
|
|
79
|
+
json: { type: "boolean", description: "Print the versioned catalog as JSON", default: false }
|
|
80
|
+
},
|
|
81
|
+
async run({ args }) {
|
|
82
|
+
const catalog = await buildCommandsCatalog(path.resolve(args.cwd));
|
|
83
|
+
process.stdout.write(
|
|
84
|
+
args.json ? `${JSON.stringify(catalog, null, 2)}
|
|
85
|
+
` : `${renderCommandsCatalog(catalog)}
|
|
86
|
+
`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
export {
|
|
91
|
+
commandsCommand
|
|
92
|
+
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTRY_CLI_ARGS,
|
|
3
3
|
resolveRegistryFromCli
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-75ELVLBY.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-ZB43YMHW.js";
|
|
8
8
|
import {
|
|
9
9
|
managedPairs
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LPZ2KXVE.js";
|
|
11
|
+
import "./chunk-2KIOZMTV.js";
|
|
11
12
|
import {
|
|
12
13
|
loadAgentKitManifest,
|
|
13
|
-
normalizeRelPath
|
|
14
|
+
normalizeRelPath
|
|
15
|
+
} from "./chunk-HVH24VRL.js";
|
|
16
|
+
import {
|
|
14
17
|
resolveContained
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6LRY2CYU.js";
|
|
16
19
|
import "./chunk-C4Q77GGJ.js";
|
|
17
20
|
import "./chunk-5B4DVO6C.js";
|
|
18
21
|
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
REVIEW_PACK_SLASH,
|
|
5
5
|
parseReviewPackMaxBytes,
|
|
6
6
|
reviewBackendMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S7XAV6JK.js";
|
|
8
8
|
import {
|
|
9
9
|
detectAgentBackend,
|
|
10
10
|
listDetectBackendIds
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
normalizeSlashName,
|
|
28
28
|
promoteBlockedMessage,
|
|
29
29
|
unknownSlashMessage
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BZI5G3OZ.js";
|
|
31
31
|
import {
|
|
32
32
|
CLAUDE_MAX_BUDGET_USD_ENV,
|
|
33
33
|
CLAUDE_MAX_TURNS_ENV,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTRY_CLI_ARGS,
|
|
3
3
|
resolveRegistryFromCli
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-75ELVLBY.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-ZB43YMHW.js";
|
|
8
8
|
import {
|
|
9
9
|
diffAgainstRegistry,
|
|
10
10
|
summarizeDiff
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-O5FKTKOW.js";
|
|
12
|
+
import "./chunk-LPZ2KXVE.js";
|
|
13
|
+
import "./chunk-2KIOZMTV.js";
|
|
13
14
|
import {
|
|
14
15
|
loadAgentKitManifest
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HVH24VRL.js";
|
|
17
|
+
import "./chunk-6LRY2CYU.js";
|
|
16
18
|
import "./chunk-C4Q77GGJ.js";
|
|
17
19
|
import "./chunk-5B4DVO6C.js";
|
|
18
20
|
|
|
@@ -2,11 +2,12 @@ import {
|
|
|
2
2
|
assessHooksHealth,
|
|
3
3
|
executeSafeReadinessFixes,
|
|
4
4
|
refreshRepositoryProfile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BCX5NDQC.js";
|
|
6
6
|
import {
|
|
7
7
|
writeReadinessSnapshot
|
|
8
8
|
} from "./chunk-HAFRAXGV.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ZF4YBL7F.js";
|
|
10
|
+
import "./chunk-LGSNC4OI.js";
|
|
10
11
|
import "./chunk-WGLPZXNU.js";
|
|
11
12
|
import "./chunk-6RRG3WOE.js";
|
|
12
13
|
import {
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
import {
|
|
16
17
|
detectWorkspaceParent,
|
|
17
18
|
workspaceParentAdvisoryLines
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-BIFWN6BJ.js";
|
|
19
20
|
import {
|
|
20
21
|
createReadinessReport
|
|
21
22
|
} from "./chunk-PNFF6OU3.js";
|
|
@@ -32,11 +33,13 @@ import {
|
|
|
32
33
|
} from "./chunk-B3VR5YBQ.js";
|
|
33
34
|
import {
|
|
34
35
|
warnIfRunningCliBehindNpm
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-52WYZFP5.js";
|
|
36
37
|
import "./chunk-PFEUZXVT.js";
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-O5FKTKOW.js";
|
|
39
|
+
import "./chunk-LPZ2KXVE.js";
|
|
40
|
+
import "./chunk-2KIOZMTV.js";
|
|
41
|
+
import "./chunk-HVH24VRL.js";
|
|
42
|
+
import "./chunk-6LRY2CYU.js";
|
|
40
43
|
import {
|
|
41
44
|
KIT_VERSION
|
|
42
45
|
} from "./chunk-7HDQEK6T.js";
|
|
@@ -23,15 +23,17 @@ import {
|
|
|
23
23
|
} from "./chunk-HAFRAXGV.js";
|
|
24
24
|
import {
|
|
25
25
|
stampLastCheckedAt
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-52WYZFP5.js";
|
|
27
27
|
import {
|
|
28
28
|
loadContextConfig
|
|
29
29
|
} from "./chunk-PFEUZXVT.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-O5FKTKOW.js";
|
|
31
|
+
import "./chunk-LPZ2KXVE.js";
|
|
32
|
+
import "./chunk-2KIOZMTV.js";
|
|
32
33
|
import {
|
|
33
34
|
MANIFEST_RELATIVE_PATH
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-HVH24VRL.js";
|
|
36
|
+
import "./chunk-6LRY2CYU.js";
|
|
35
37
|
import "./chunk-7HDQEK6T.js";
|
|
36
38
|
import {
|
|
37
39
|
HANDOFF_REL
|