@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.
- package/dashboard/lib/semantic-model.mjs +49 -2
- package/dist/{add-IT6XFPKT.js → add-NQILLNYA.js} +3 -2
- package/dist/{chunk-I2D75F4I.js → chunk-2DETOPCK.js} +11 -9
- package/dist/{chunk-IN4MQ3P3.js → chunk-2KIOZMTV.js} +1 -48
- package/dist/{chunk-TNO7GTAJ.js → chunk-54T36ZDX.js} +5 -3
- package/dist/{chunk-EI3VQ7FU.js → chunk-5YU3BSCN.js} +2 -2
- package/dist/{chunk-MEZUW3LL.js → chunk-A3OJLKPH.js} +1 -1
- package/dist/{chunk-WUEXATDP.js → chunk-BZI5G3OZ.js} +1 -0
- package/dist/chunk-EHY2UZP3.js +52 -0
- package/dist/{chunk-YIOTJQHL.js → chunk-FLP2YVRO.js} +2 -2
- package/dist/{chunk-5LQP4JGH.js → chunk-GSCTZOS7.js} +7 -5
- package/dist/{chunk-34BBPQKI.js → chunk-HOFZX4M2.js} +1 -1
- package/dist/{chunk-WOGBBJCX.js → chunk-NSOWSTAL.js} +5 -3
- package/dist/{chunk-236IYK6L.js → chunk-QE4L2PVJ.js} +20 -135
- package/dist/chunk-QH33EIMD.js +125 -0
- package/dist/{chunk-U2IMEYGQ.js → chunk-S7XAV6JK.js} +1 -1
- package/dist/chunk-TL7AXLEU.js +967 -0
- package/dist/chunk-VZ3O4OKE.js +522 -0
- package/dist/commands-SIM2UP5W.js +92 -0
- package/dist/{contribute-V7PV5UMK.js → contribute-WEYAE7CE.js} +7 -4
- package/dist/{countdown-YZSJQXYS.js → countdown-XYRE4GZU.js} +2 -2
- package/dist/{diff-GWIHGH65.js → diff-ETCHVI7X.js} +6 -4
- package/dist/{doctor-FLIQCVFN.js → doctor-YRHSU3L2.js} +10 -7
- package/dist/{hook-2SX2V2T6.js → hook-MUTYISDL.js} +6 -4
- package/dist/index.js +18 -16
- package/dist/{init-4B2IRH27.js → init-7IOQCK6T.js} +13 -10
- package/dist/{install-3JVTG35O.js → install-LUFSJOYK.js} +13 -10
- package/dist/{run-CWA6Q4TC.js → run-QG7XQ3XF.js} +2 -2
- package/dist/{setup-global-6JM5XTAT.js → setup-global-6JE6LSPE.js} +7 -5
- package/dist/{status-PMAI7NH3.js → status-YZRSVZM2.js} +8 -6
- package/dist/{update-3PLY4FZA.js → update-ZEYO6ZS7.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-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
|
+
};
|