@dadado/agent-kit-cli 5.15.1 → 5.16.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 (71) hide show
  1. package/dashboard/dashboard-data.mjs +69 -65
  2. package/dashboard/lib/guards.d.mts +5 -0
  3. package/dashboard/lib/guards.mjs +31 -0
  4. package/dashboard/lib/identity-probe.mjs +56 -0
  5. package/dashboard/lib/pipeline-cache.mjs +58 -0
  6. package/dashboard/lib/processes.mjs +71 -0
  7. package/dashboard/serve.mjs +43 -1
  8. package/dashboard/start-broadcast.mjs +2 -12
  9. package/dashboard/start.mjs +2 -13
  10. package/dist/add-7UMSGVWC.js +150 -0
  11. package/dist/chunk-2IPXQFJE.js +253 -0
  12. package/dist/chunk-2YU2H7I6.js +42 -0
  13. package/dist/chunk-4IWG5CVE.js +214 -0
  14. package/dist/chunk-5OXPNVCF.js +106 -0
  15. package/dist/chunk-5VCOWTTP.js +6 -0
  16. package/dist/chunk-6QV2BFGA.js +341 -0
  17. package/dist/chunk-77V75A7O.js +39 -0
  18. package/dist/chunk-7HDQEK6T.js +26 -0
  19. package/dist/chunk-CBCW5R5J.js +484 -0
  20. package/dist/chunk-CGTE7DHN.js +410 -0
  21. package/dist/chunk-DE3LQFSJ.js +18 -0
  22. package/dist/chunk-F6C3GFKV.js +57 -0
  23. package/dist/chunk-HFUH3HVS.js +282 -0
  24. package/dist/chunk-HS7LVVLO.js +74 -0
  25. package/dist/chunk-IHROBTNM.js +135 -0
  26. package/dist/chunk-KD2MYBB6.js +213 -0
  27. package/dist/chunk-KI6ZHBPV.js +332 -0
  28. package/dist/chunk-MAPOQEA2.js +43 -0
  29. package/dist/chunk-NQ7IQ5XT.js +26 -0
  30. package/dist/chunk-OUQZC744.js +1315 -0
  31. package/dist/chunk-OZ4QV6LM.js +1078 -0
  32. package/dist/chunk-PCCQUWE5.js +817 -0
  33. package/dist/chunk-PNFF6OU3.js +273 -0
  34. package/dist/chunk-QTON2GQX.js +203 -0
  35. package/dist/chunk-TFZ2JUXH.js +1081 -0
  36. package/dist/chunk-VGZBARQC.js +318 -0
  37. package/dist/chunk-VS2JD2XC.js +1453 -0
  38. package/dist/chunk-VY7MTPJ2.js +205 -0
  39. package/dist/chunk-WW3YZKHW.js +165 -0
  40. package/dist/chunk-XWPO3VYQ.js +53 -0
  41. package/dist/chunk-XZZAVHH4.js +503 -0
  42. package/dist/chunk-YGBBHKBE.js +82 -0
  43. package/dist/chunk-ZB43YMHW.js +20 -0
  44. package/dist/chunk-ZCTSUQRR.js +874 -0
  45. package/dist/chunk-ZXKZBTXE.js +17 -0
  46. package/dist/contribute-YKK6YCSI.js +367 -0
  47. package/dist/cursor-awareness-KTL2RGKD.js +77 -0
  48. package/dist/dashboard-YSNUGBFY.js +21 -0
  49. package/dist/dashboard-broadcast-M4CMW7RX.js +119 -0
  50. package/dist/diff-YTR7VOAN.js +74 -0
  51. package/dist/doctor-TA2FWREU.js +497 -0
  52. package/dist/dogfood-KKFVRWT6.js +366 -0
  53. package/dist/guard-EHXF76ID.js +530 -0
  54. package/dist/handoff-3UI6VKVG.js +302 -0
  55. package/dist/hook-MUV6Y7UW.js +1074 -0
  56. package/dist/index.js +62 -14068
  57. package/dist/init-TTTKGC4C.js +127 -0
  58. package/dist/install-ZMFJBPOI.js +34 -0
  59. package/dist/mission-control-LJACEVVN.js +89 -0
  60. package/dist/monitors-QV2IS3MP.js +176 -0
  61. package/dist/plan-index-JMC7Z4DW.js +44 -0
  62. package/dist/public-inbound-radar-WP3XF7GS.js +68 -0
  63. package/dist/remote-issues-SZ4HDQL5.js +44 -0
  64. package/dist/run-I3BFGULT.js +243 -0
  65. package/dist/run-plan-FO7CL4M3.js +118 -0
  66. package/dist/scan-NI2SWJ2E.js +33 -0
  67. package/dist/setup-global-JUVMJXJ5.js +340 -0
  68. package/dist/status-MVCUNCWX.js +138 -0
  69. package/dist/update-Q4EBIRUB.js +260 -0
  70. package/dist/validate-V2CW7J4B.js +201 -0
  71. package/package.json +1 -1
@@ -0,0 +1,106 @@
1
+ import {
2
+ L0_ARTIFACTS
3
+ } from "./chunk-6QV2BFGA.js";
4
+ import {
5
+ copyRegistryFile,
6
+ emptyStats,
7
+ installPack,
8
+ installSkillsByIds,
9
+ loadManagedHashLedger,
10
+ loadRegistry,
11
+ mergeStats,
12
+ recordOutcome,
13
+ resolveProtectedGlobs,
14
+ saveManagedHashLedger
15
+ } from "./chunk-VS2JD2XC.js";
16
+ import {
17
+ fileExists
18
+ } from "./chunk-77V75A7O.js";
19
+
20
+ // src/lifecycle/onboard-migration.ts
21
+ import { createHash } from "crypto";
22
+ import { readFile, unlink } from "fs/promises";
23
+ import path from "path";
24
+ var LEGACY_ONBOARD_PATH = ".cursor/commands/onboard.md";
25
+ var NAMESPACED_ONBOARD_PATH = ".cursor/commands/agent-kit-onboard.md";
26
+ var MANAGED_LEGACY_HASHES = /* @__PURE__ */ new Set([
27
+ "b274a68941813f19b185893cb7c5561dff027f53270890029992f208e24992fe"
28
+ ]);
29
+ async function migrateLegacyOnboardCommand(projectRoot, managedHashes = MANAGED_LEGACY_HASHES) {
30
+ const legacyPath = path.join(projectRoot, LEGACY_ONBOARD_PATH);
31
+ if (!await fileExists(legacyPath)) return "absent";
32
+ const namespacedPath = path.join(projectRoot, NAMESPACED_ONBOARD_PATH);
33
+ if (!await fileExists(namespacedPath)) return "preserved-customized";
34
+ const content = await readFile(legacyPath);
35
+ const hash = createHash("sha256").update(content).digest("hex");
36
+ if (!managedHashes.has(hash)) return "preserved-customized";
37
+ await unlink(legacyPath);
38
+ return "removed-managed";
39
+ }
40
+
41
+ // src/lifecycle/sync.ts
42
+ async function installL0(registryRoot, projectRoot, protectedGlobs, ledger) {
43
+ const stats = emptyStats();
44
+ const managedHashes = ledger ?? await loadManagedHashLedger(projectRoot);
45
+ const copyOpts = { managedHashes, persistManagedHashes: false };
46
+ for (const artifact of L0_ARTIFACTS) {
47
+ const outcome = await copyRegistryFile(
48
+ registryRoot,
49
+ projectRoot,
50
+ artifact.source,
51
+ artifact.target,
52
+ protectedGlobs,
53
+ copyOpts
54
+ );
55
+ recordOutcome(stats, artifact.target, outcome);
56
+ }
57
+ if (!ledger) await saveManagedHashLedger(projectRoot, managedHashes);
58
+ const migration = await migrateLegacyOnboardCommand(projectRoot);
59
+ if (migration === "removed-managed") {
60
+ stats.removed.push(".cursor/commands/onboard.md");
61
+ } else if (migration === "preserved-customized") {
62
+ stats.collisions.push(".cursor/commands/onboard.md");
63
+ }
64
+ return stats;
65
+ }
66
+ async function syncFromManifest(registryRoot, projectRoot, manifest) {
67
+ const protectedGlobs = resolveProtectedGlobs(manifest);
68
+ const stats = emptyStats();
69
+ const managedHashes = await loadManagedHashLedger(projectRoot);
70
+ const installOpts = { protectedGlobs, managedHashes };
71
+ try {
72
+ mergeStats(stats, await installL0(registryRoot, projectRoot, protectedGlobs, managedHashes));
73
+ for (const packId of manifest.packs ?? []) {
74
+ mergeStats(stats, await installPack(registryRoot, projectRoot, packId, installOpts));
75
+ }
76
+ const skillIds = manifest.skills ?? [];
77
+ if (skillIds.length > 0) {
78
+ await loadRegistry(registryRoot);
79
+ mergeStats(stats, await installSkillsByIds(registryRoot, projectRoot, skillIds, installOpts));
80
+ }
81
+ } finally {
82
+ await saveManagedHashLedger(projectRoot, managedHashes);
83
+ }
84
+ return stats;
85
+ }
86
+
87
+ // src/commands/shared-args.ts
88
+ var NON_INTERACTIVE_ROOT_ARGS = {
89
+ yes: {
90
+ type: "boolean",
91
+ alias: "y",
92
+ description: "Skip interactive prompts; use defaults (IDE-agnostic non-interactive mode)",
93
+ default: false
94
+ },
95
+ "force-root": {
96
+ type: "boolean",
97
+ description: "Bypass the ambiguous-root guard (use with caution)",
98
+ default: false
99
+ }
100
+ };
101
+
102
+ export {
103
+ installL0,
104
+ syncFromManifest,
105
+ NON_INTERACTIVE_ROOT_ARGS
106
+ };
@@ -0,0 +1,6 @@
1
+ // src/utils/kit-paths.ts
2
+ var HANDOFF_REL = ".cursor/HANDOFF.md";
3
+
4
+ export {
5
+ HANDOFF_REL
6
+ };
@@ -0,0 +1,341 @@
1
+ import {
2
+ allSkills,
3
+ loadPackManifest,
4
+ loadRegistry,
5
+ packMemberFileTargets,
6
+ skillFileTargets
7
+ } from "./chunk-VS2JD2XC.js";
8
+
9
+ // src/lifecycle/l0.ts
10
+ var L0_ARTIFACTS = [
11
+ // Rules
12
+ {
13
+ source: ".cursor/rules/cursor-plan-handoff.mdc",
14
+ target: ".cursor/rules/cursor-plan-handoff.mdc"
15
+ },
16
+ {
17
+ source: ".cursor/rules/context-guardian.mdc",
18
+ target: ".cursor/rules/context-guardian.mdc"
19
+ },
20
+ {
21
+ source: ".cursor/rules/cursor-skills-git-workflow.mdc",
22
+ target: ".cursor/rules/cursor-skills-git-workflow.mdc"
23
+ },
24
+ {
25
+ source: ".cursor/rules/cursor-skills-general.mdc",
26
+ target: ".cursor/rules/cursor-skills-general.mdc"
27
+ },
28
+ { source: ".cursor/rules/ux-tone.mdc", target: ".cursor/rules/ux-tone.mdc" },
29
+ {
30
+ source: ".cursor/rules/agent-output-hygiene.mdc",
31
+ target: ".cursor/rules/agent-output-hygiene.mdc"
32
+ },
33
+ {
34
+ source: ".cursor/rules/docs-professional-standard.mdc",
35
+ target: ".cursor/rules/docs-professional-standard.mdc"
36
+ },
37
+ { source: ".cursor/rules/memory-loop.mdc", target: ".cursor/rules/memory-loop.mdc" },
38
+ {
39
+ source: ".cursor/rules/hitl-ask-questions.mdc",
40
+ target: ".cursor/rules/hitl-ask-questions.mdc"
41
+ },
42
+ {
43
+ source: ".cursor/skills/core/hitl-gates/SKILL.md",
44
+ target: ".cursor/skills/core/hitl-gates/SKILL.md"
45
+ },
46
+ {
47
+ source: ".cursor/skills/core/hitl-gates/procedures.md",
48
+ target: ".cursor/skills/core/hitl-gates/procedures.md"
49
+ },
50
+ {
51
+ source: ".cursor/skills/core/hitl-gates/run-plan-tick-contract.md",
52
+ target: ".cursor/skills/core/hitl-gates/run-plan-tick-contract.md"
53
+ },
54
+ {
55
+ source: ".cursor/skills/core/hitl-gates/start-project-intake.md",
56
+ target: ".cursor/skills/core/hitl-gates/start-project-intake.md"
57
+ },
58
+ {
59
+ source: ".cursor/skills/core/hitl-gates/run-plan-all-queue.md",
60
+ target: ".cursor/skills/core/hitl-gates/run-plan-all-queue.md"
61
+ },
62
+ {
63
+ source: ".cursor/skills/core/qa/SKILL.md",
64
+ target: ".cursor/skills/core/qa/SKILL.md"
65
+ },
66
+ {
67
+ source: ".cursor/skills/core/dashboard-broadcast/SKILL.md",
68
+ target: ".cursor/skills/core/dashboard-broadcast/SKILL.md"
69
+ },
70
+ {
71
+ source: ".cursor/skills/core/plan-review-triage/procedure.md",
72
+ target: ".cursor/skills/core/plan-review-triage/procedure.md"
73
+ },
74
+ {
75
+ source: ".cursor/skills/core/plan-external-review/procedure.md",
76
+ target: ".cursor/skills/core/plan-external-review/procedure.md"
77
+ },
78
+ {
79
+ source: ".cursor/skills/core/agent-kit-onboard/procedure.md",
80
+ target: ".cursor/skills/core/agent-kit-onboard/procedure.md"
81
+ },
82
+ {
83
+ source: ".cursor/skills/core/field-report-resolve/procedure.md",
84
+ target: ".cursor/skills/core/field-report-resolve/procedure.md"
85
+ },
86
+ {
87
+ source: ".cursor/skills/core/backlog-add/procedure.md",
88
+ target: ".cursor/skills/core/backlog-add/procedure.md"
89
+ },
90
+ {
91
+ source: "registry/rules/git-secrets-safety.mdc",
92
+ target: ".cursor/rules/git-secrets-safety.mdc"
93
+ },
94
+ // Commands
95
+ {
96
+ source: ".cursor/commands/start-project.md",
97
+ target: ".cursor/commands/start-project.md"
98
+ },
99
+ {
100
+ source: ".cursor/commands/backlog-add.md",
101
+ target: ".cursor/commands/backlog-add.md"
102
+ },
103
+ {
104
+ source: ".cursor/commands/backlog-edit.md",
105
+ target: ".cursor/commands/backlog-edit.md"
106
+ },
107
+ {
108
+ source: ".cursor/commands/backlog-delete.md",
109
+ target: ".cursor/commands/backlog-delete.md"
110
+ },
111
+ {
112
+ source: ".cursor/commands/backlog-cancel.md",
113
+ target: ".cursor/commands/backlog-cancel.md"
114
+ },
115
+ {
116
+ source: ".cursor/commands/archive-plan.md",
117
+ target: ".cursor/commands/archive-plan.md"
118
+ },
119
+ {
120
+ source: ".cursor/commands/agent-kit-onboard.md",
121
+ target: ".cursor/commands/agent-kit-onboard.md"
122
+ },
123
+ {
124
+ source: ".cursor/commands/continue-plan.md",
125
+ target: ".cursor/commands/continue-plan.md"
126
+ },
127
+ {
128
+ source: ".cursor/commands/run-plan.md",
129
+ target: ".cursor/commands/run-plan.md"
130
+ },
131
+ {
132
+ source: ".cursor/commands/hotfix.md",
133
+ target: ".cursor/commands/hotfix.md"
134
+ },
135
+ {
136
+ source: ".cursor/commands/run-plan-all.md",
137
+ target: ".cursor/commands/run-plan-all.md"
138
+ },
139
+ // Deprecated aliases of /run-plan (kept so existing references keep working)
140
+ {
141
+ source: ".cursor/commands/run-plan-loop.md",
142
+ target: ".cursor/commands/run-plan-loop.md"
143
+ },
144
+ {
145
+ source: ".cursor/commands/run-plan-orchestrated.md",
146
+ target: ".cursor/commands/run-plan-orchestrated.md"
147
+ },
148
+ { source: ".cursor/commands/handoff.md", target: ".cursor/commands/handoff.md" },
149
+ { source: ".cursor/commands/summary.md", target: ".cursor/commands/summary.md" },
150
+ {
151
+ source: ".cursor/commands/dashboard.md",
152
+ target: ".cursor/commands/dashboard.md"
153
+ },
154
+ {
155
+ source: ".cursor/commands/dashboard-broadcast.md",
156
+ target: ".cursor/commands/dashboard-broadcast.md"
157
+ },
158
+ {
159
+ source: ".cursor/commands/git-staging.md",
160
+ target: ".cursor/commands/git-staging.md"
161
+ },
162
+ { source: ".cursor/commands/git-prod.md", target: ".cursor/commands/git-prod.md" },
163
+ // Factory landing wraps: keep `.cursor/commands/kit-staging.md` and
164
+ // `kit-prod.md` on disk. They are not consumer L0 (surface diet).
165
+ {
166
+ source: ".cursor/commands/plan-external-review.md",
167
+ target: ".cursor/commands/plan-external-review.md"
168
+ },
169
+ {
170
+ source: ".cursor/commands/plan-review-triage.md",
171
+ target: ".cursor/commands/plan-review-triage.md"
172
+ },
173
+ {
174
+ source: ".cursor/commands/field-report-resolve.md",
175
+ target: ".cursor/commands/field-report-resolve.md"
176
+ },
177
+ {
178
+ source: ".cursor/commands/dogfood.md",
179
+ target: ".cursor/commands/dogfood.md"
180
+ },
181
+ // Factory-only: `.cursor/commands/public-issue-triage.md` and
182
+ // `.cursor/commands/public-inbound-radar.md` are intentionally omitted from
183
+ // L0 (and excluded from public-sync). See ADRs
184
+ // 2026-08-05_factory-only-public-issue-triage-command.md and
185
+ // 2026-09-24_public-inbound-radar.md.
186
+ {
187
+ source: ".cursor/commands/cursor-update-awareness.md",
188
+ target: ".cursor/commands/cursor-update-awareness.md"
189
+ },
190
+ {
191
+ source: ".cursor/commands/qa.md",
192
+ target: ".cursor/commands/qa.md"
193
+ },
194
+ {
195
+ source: ".cursor/commands/update.md",
196
+ target: ".cursor/commands/update.md"
197
+ },
198
+ // Context (templates + example config; private config.json is not L0)
199
+ {
200
+ source: ".cursor/context/templates/plan-external-review-prompt.md",
201
+ target: ".cursor/context/templates/plan-external-review-prompt.md"
202
+ },
203
+ {
204
+ source: ".cursor/context/templates/plan.md",
205
+ target: ".cursor/context/templates/plan.md"
206
+ },
207
+ {
208
+ source: ".cursor/context/templates/context-pack.md",
209
+ target: ".cursor/context/templates/context-pack.md"
210
+ },
211
+ {
212
+ source: ".cursor/context/templates/task-brief.md",
213
+ target: ".cursor/context/templates/task-brief.md"
214
+ },
215
+ {
216
+ source: ".cursor/context/templates/handoff.md",
217
+ target: ".cursor/context/templates/handoff.md"
218
+ },
219
+ {
220
+ source: ".cursor/context/templates/adr.md",
221
+ target: ".cursor/context/templates/adr.md"
222
+ },
223
+ {
224
+ source: ".cursor/context/templates/plan-monitor.md",
225
+ target: ".cursor/context/templates/plan-monitor.md"
226
+ },
227
+ {
228
+ source: ".cursor/context/templates/memory-entry.md",
229
+ target: ".cursor/context/templates/memory-entry.md"
230
+ },
231
+ {
232
+ source: ".cursor/context/config.example.json",
233
+ target: ".cursor/context/config.example.json"
234
+ },
235
+ // Scripts (canonical launchers; consumers never receive repo-root scripts/)
236
+ {
237
+ source: ".cursor/scripts/plan-external-review.sh",
238
+ target: ".cursor/scripts/plan-external-review.sh"
239
+ },
240
+ {
241
+ source: ".cursor/scripts/field-report-cadence-bump.sh",
242
+ target: ".cursor/scripts/field-report-cadence-bump.sh"
243
+ },
244
+ {
245
+ source: ".cursor/scripts/run-plan-all-consolidate.sh",
246
+ target: ".cursor/scripts/run-plan-all-consolidate.sh"
247
+ },
248
+ // Secrets gate (structural)
249
+ {
250
+ source: ".cursor/hooks/pre-commit/check-secrets.sh",
251
+ target: ".cursor/hooks/pre-commit/check-secrets.sh"
252
+ },
253
+ // Native Cursor agent hooks (thin adapters -> agent-kit CLI)
254
+ {
255
+ source: ".cursor/hooks.json",
256
+ target: ".cursor/hooks.json"
257
+ },
258
+ {
259
+ source: ".cursor/hooks/agent/resolve-agent-kit.sh",
260
+ target: ".cursor/hooks/agent/resolve-agent-kit.sh"
261
+ },
262
+ {
263
+ source: ".cursor/hooks/agent/session-start.sh",
264
+ target: ".cursor/hooks/agent/session-start.sh"
265
+ },
266
+ {
267
+ source: ".cursor/hooks/agent/pre-compact.sh",
268
+ target: ".cursor/hooks/agent/pre-compact.sh"
269
+ },
270
+ {
271
+ source: ".cursor/hooks/agent/guard-shell.sh",
272
+ target: ".cursor/hooks/agent/guard-shell.sh"
273
+ },
274
+ {
275
+ source: ".cursor/hooks/agent/after-edit-schema.sh",
276
+ target: ".cursor/hooks/agent/after-edit-schema.sh"
277
+ },
278
+ {
279
+ source: ".cursor/hooks/agent/secrets-prompt.sh",
280
+ target: ".cursor/hooks/agent/secrets-prompt.sh"
281
+ },
282
+ // Git spine docs at project root (not a nested agent-kit/ copy)
283
+ {
284
+ source: "autogit/gitupdate.md",
285
+ target: "autogit/gitupdate.md"
286
+ },
287
+ {
288
+ source: "autogit/plan-routine.md",
289
+ target: "autogit/plan-routine.md"
290
+ },
291
+ // Signature gate script: the staging/prod routines run
292
+ // `sh git-hooks/prepare-commit-msg --check -`, so the file must exist in the
293
+ // checkout. Installing it into .git/hooks stays optional (issue #89).
294
+ {
295
+ source: "git-hooks/prepare-commit-msg",
296
+ target: "git-hooks/prepare-commit-msg"
297
+ }
298
+ ];
299
+
300
+ // src/lifecycle/targets.ts
301
+ import path from "path";
302
+ var toPosix = (rel) => rel.split(path.sep).join("/");
303
+ async function managedPairs(registryRoot, manifest, index) {
304
+ const pairs = [];
305
+ const missingSkills = [];
306
+ const push = (sourceRel, targetRel, origin) => {
307
+ pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
308
+ };
309
+ for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
310
+ for (const packId of manifest.packs ?? []) {
311
+ const pack = await loadPackManifest(registryRoot, packId);
312
+ for (const member of pack.members) {
313
+ for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
314
+ push(sourceRel, targetRel, "pack");
315
+ }
316
+ }
317
+ }
318
+ if ((manifest.skills ?? []).length > 0) {
319
+ const pool = allSkills(index ?? await loadRegistry(registryRoot));
320
+ for (const id of manifest.skills ?? []) {
321
+ const skill = pool.find((s) => s.id === id);
322
+ if (!skill) {
323
+ missingSkills.push(id);
324
+ continue;
325
+ }
326
+ for (const { sourceRel, targetRel } of await skillFileTargets(
327
+ registryRoot,
328
+ skill.path,
329
+ skill.id
330
+ )) {
331
+ push(sourceRel, targetRel, "skill");
332
+ }
333
+ }
334
+ }
335
+ return { pairs, missingSkills };
336
+ }
337
+
338
+ export {
339
+ L0_ARTIFACTS,
340
+ managedPairs
341
+ };
@@ -0,0 +1,39 @@
1
+ // src/utils/fs.ts
2
+ import { randomUUID } from "crypto";
3
+ import { constants } from "fs";
4
+ import { access, mkdir, readFile, readdir, rename, writeFile } from "fs/promises";
5
+ import path from "path";
6
+ async function fileExists(target) {
7
+ try {
8
+ await access(target, constants.F_OK);
9
+ return true;
10
+ } catch {
11
+ return false;
12
+ }
13
+ }
14
+ async function readJson(target) {
15
+ if (!await fileExists(target)) return null;
16
+ const raw = await readFile(target, "utf8");
17
+ return JSON.parse(raw);
18
+ }
19
+ async function writeJson(target, data) {
20
+ await ensureDir(path.dirname(target));
21
+ const tmp = `${target}.${randomUUID()}.tmp`;
22
+ await writeFile(tmp, `${JSON.stringify(data, null, 2)}
23
+ `, "utf8");
24
+ await rename(tmp, target);
25
+ }
26
+ async function ensureDir(target) {
27
+ await mkdir(target, { recursive: true });
28
+ }
29
+ async function listDirectory(rootDir) {
30
+ return readdir(rootDir);
31
+ }
32
+
33
+ export {
34
+ fileExists,
35
+ readJson,
36
+ writeJson,
37
+ ensureDir,
38
+ listDirectory
39
+ };
@@ -0,0 +1,26 @@
1
+ // src/lifecycle/version.ts
2
+ import { createRequire } from "module";
3
+ var require2 = createRequire(import.meta.url);
4
+ function loadPackageVersion() {
5
+ for (const packagePath of ["../package.json", "../../package.json"]) {
6
+ try {
7
+ const metadata = require2(packagePath);
8
+ if (typeof metadata.version === "string" && metadata.version.length > 0) {
9
+ return metadata.version;
10
+ }
11
+ } catch {
12
+ }
13
+ }
14
+ throw new Error("Unable to resolve the Agent Kit CLI package version");
15
+ }
16
+ var KIT_VERSION = loadPackageVersion();
17
+ var KIT_PACKAGE_SPEC = "@dadado/agent-kit-cli";
18
+ function pinnedCliSpec(version = KIT_VERSION) {
19
+ return `${KIT_PACKAGE_SPEC}@${version}`;
20
+ }
21
+
22
+ export {
23
+ KIT_VERSION,
24
+ KIT_PACKAGE_SPEC,
25
+ pinnedCliSpec
26
+ };