@dadado/agent-kit-cli 6.23.0 → 6.26.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 (86) hide show
  1. package/README.md +1 -0
  2. package/dashboard/dashboard-data.mjs +126 -5
  3. package/dashboard/dashboard.html +48 -7
  4. package/dashboard/lib/guards.mjs +1 -0
  5. package/dashboard/lib/live-refresh.mjs +1 -0
  6. package/dist/{add-RKZQX6ZK.js → add-G7KEZLWP.js} +17 -8
  7. package/dist/{chunk-7HDQEK6T.js → chunk-2G4K4ZI5.js} +7 -3
  8. package/dist/{chunk-5PSV76CQ.js → chunk-2GXN7HVG.js} +26 -7
  9. package/dist/chunk-2QYWMSI5.js +193 -0
  10. package/dist/{chunk-B3VR5YBQ.js → chunk-2TW7ENWC.js} +12 -11
  11. package/dist/{chunk-IESSMKOV.js → chunk-5A72LTR3.js} +7 -7
  12. package/dist/{chunk-R4DUO5DA.js → chunk-AXQMVQ6O.js} +61 -237
  13. package/dist/{chunk-6WUKLS4D.js → chunk-BIFTTL2O.js} +1 -1
  14. package/dist/{chunk-AWQ6KRFV.js → chunk-BVZDPVUL.js} +1 -1
  15. package/dist/{chunk-QNISTPPZ.js → chunk-ENRXS5O6.js} +19 -12
  16. package/dist/chunk-FB6G6OD6.js +519 -0
  17. package/dist/{chunk-MFKHIWEL.js → chunk-FOVHFMSH.js} +1 -1
  18. package/dist/{chunk-6BEFGKCU.js → chunk-FUSNEYGU.js} +29 -3
  19. package/dist/chunk-H7KAXI5R.js +357 -0
  20. package/dist/chunk-HGB4DHXV.js +138 -0
  21. package/dist/{chunk-W3ZJVBNY.js → chunk-HXV6VQD4.js} +2374 -983
  22. package/dist/{chunk-BGL5DRK2.js → chunk-I3FGWNU5.js} +4 -4
  23. package/dist/chunk-IHVJTGYR.js +144 -0
  24. package/dist/{chunk-5LNHRL5E.js → chunk-IUY24WPE.js} +93 -263
  25. package/dist/chunk-JG5MKMOM.js +248 -0
  26. package/dist/{chunk-SGTTC2JP.js → chunk-JWIJHO67.js} +17 -2
  27. package/dist/chunk-KMK4T4ZM.js +34 -0
  28. package/dist/{chunk-ZMYV6PRE.js → chunk-LEVNLHH3.js} +2 -1
  29. package/dist/{chunk-2IP4OO6R.js → chunk-MGVV6YC4.js} +1 -1
  30. package/dist/{chunk-7TYA3GMI.js → chunk-MWRYQLEG.js} +7 -4
  31. package/dist/chunk-NHJ4IAVN.js +435 -0
  32. package/dist/{chunk-C4Q77GGJ.js → chunk-O7VMHCNN.js} +6 -0
  33. package/dist/{chunk-5EBT3V7G.js → chunk-OVRGTHZD.js} +1 -1
  34. package/dist/{chunk-F7YAAKYP.js → chunk-PCIYXGB3.js} +7 -5
  35. package/dist/{chunk-UJCATSYO.js → chunk-PLLXFSN2.js} +46 -17
  36. package/dist/{chunk-OYFCBYMP.js → chunk-RJP47EGS.js} +18 -1
  37. package/dist/{chunk-KDJ4ML7I.js → chunk-RRJVC35Y.js} +4 -4
  38. package/dist/{chunk-DRZFWIBN.js → chunk-SWJJW624.js} +1 -1
  39. package/dist/{chunk-MJJBIOSY.js → chunk-SYRJ5TTK.js} +34 -12
  40. package/dist/{chunk-L5V3W3DY.js → chunk-TTUFIE26.js} +60 -14
  41. package/dist/{chunk-JFS4GKP7.js → chunk-XXPI4H4D.js} +2 -2
  42. package/dist/{chunk-CVZNSRXV.js → chunk-Y5526WCN.js} +84 -19
  43. package/dist/{chunk-CQHD6UKB.js → chunk-Y575INEC.js} +2 -1
  44. package/dist/{chunk-V2H57TFD.js → chunk-ZNZHDPS3.js} +80 -170
  45. package/dist/{commands-SAQEEE6V.js → commands-K4HSDML5.js} +8 -6
  46. package/dist/{conflicts-5JOP4GX2.js → conflicts-4SUWIPWP.js} +9 -10
  47. package/dist/{contribute-BQKRT5GN.js → contribute-HE4WCBRY.js} +7 -5
  48. package/dist/{countdown-25E5C7AR.js → countdown-TYQHVAIX.js} +305 -32
  49. package/dist/{dashboard-P65XHYCU.js → dashboard-6V6PCNYF.js} +1 -1
  50. package/dist/{dashboard-broadcast-GYK34QYL.js → dashboard-broadcast-PMVQ7PXU.js} +1 -1
  51. package/dist/{diff-6JSXBVSX.js → diff-3XUZM7ZT.js} +15 -6
  52. package/dist/{doctor-I3MTHS7F.js → doctor-KGUWU5SN.js} +106 -19
  53. package/dist/{engine-info-BBI5QO5Y.js → engine-info-VM4VPGQM.js} +2 -2
  54. package/dist/{ground-control-IDCXN5FK.js → ground-control-ZIDHEOPW.js} +7 -4
  55. package/dist/{guard-RJZEEKSL.js → guard-ZO4Z3LLB.js} +47 -9
  56. package/dist/{handoff-5AGE2D3T.js → handoff-LLT4CI6H.js} +4 -3
  57. package/dist/{hook-WNA42CXE.js → hook-UPZ3CPYS.js} +22 -20
  58. package/dist/index.js +51 -33
  59. package/dist/{init-FZ2UFPO7.js → init-ZHLVXEVT.js} +25 -18
  60. package/dist/install-XWOG64W3.js +42 -0
  61. package/dist/installs-2ROXPO6M.js +223 -0
  62. package/dist/{mission-control-CRMCRZUU.js → mission-control-IGOI3WHS.js} +2 -2
  63. package/dist/models-5BDXREWM.js +45 -0
  64. package/dist/paths-JTPV6SXH.js +107 -0
  65. package/dist/pi-DCMDOY65.js +248 -0
  66. package/dist/{plan-index-BNLUU6T5.js → plan-index-5QZJK4AG.js} +2 -3
  67. package/dist/{queue-JW4VR33H.js → queue-Z5VNNHM6.js} +10 -12
  68. package/dist/{run-X2WOONTB.js → run-QURAXAR2.js} +27 -33
  69. package/dist/{run-plan-4MOLLIES.js → run-plan-4MMHVCTS.js} +35 -23
  70. package/dist/{scan-K3T5RQLC.js → scan-7D3RMO34.js} +2 -1
  71. package/dist/{session-start-MV7A4263.js → session-start-NC2HE5X5.js} +20 -14
  72. package/dist/{sessions-UPFDWDMB.js → sessions-WWWLYPW6.js} +4 -4
  73. package/dist/{setup-global-VNADNTQ2.js → setup-global-WDMARD4Z.js} +12 -10
  74. package/dist/{status-SXA3OK5E.js → status-2WNJL7PP.js} +17 -13
  75. package/dist/update-YSVOYYK5.js +32 -0
  76. package/dist/update-all-5XLTCHPX.js +697 -0
  77. package/package.json +14 -4
  78. package/pi/agent-kit.ts +224 -0
  79. package/dist/chunk-4MR4QXMF.js +0 -52
  80. package/dist/chunk-7ABY6DYH.js +0 -89
  81. package/dist/chunk-C4LCOOL4.js +0 -71
  82. package/dist/chunk-DZCLMIAS.js +0 -391
  83. package/dist/chunk-HAFRAXGV.js +0 -17
  84. package/dist/chunk-MUTTNRX4.js +0 -53
  85. package/dist/install-CTLT3TSI.js +0 -38
  86. package/dist/update-RMAWXMCV.js +0 -304
@@ -0,0 +1,357 @@
1
+ import {
2
+ formatQueueLeaseRefusal,
3
+ inspectQueueLease
4
+ } from "./chunk-FOVHFMSH.js";
5
+ import {
6
+ NON_INTERACTIVE_ROOT_ARGS,
7
+ detectStaleCli,
8
+ formatRerunFlags,
9
+ formatStaleCliRefusal,
10
+ syncFromManifest
11
+ } from "./chunk-2GXN7HVG.js";
12
+ import {
13
+ formatSkippedSymlinks,
14
+ logApplyStats
15
+ } from "./chunk-HS7LVVLO.js";
16
+ import {
17
+ REGISTRY_CLI_ARGS,
18
+ resolveRegistryFromCli
19
+ } from "./chunk-SWJJW624.js";
20
+ import {
21
+ CLAUDE_SETTINGS_REL,
22
+ formatClaudeSettingsDrift,
23
+ formatPermissionsChanged,
24
+ planClaudeSettingsDrift,
25
+ writeClaudeSessionStartHook
26
+ } from "./chunk-BVZDPVUL.js";
27
+ import {
28
+ generateClaudeCommandAdapters
29
+ } from "./chunk-FUSNEYGU.js";
30
+ import {
31
+ feedInstallsRegistry
32
+ } from "./chunk-NHJ4IAVN.js";
33
+ import {
34
+ withCliProgress
35
+ } from "./chunk-QTON2GQX.js";
36
+ import {
37
+ logger
38
+ } from "./chunk-ZB43YMHW.js";
39
+ import {
40
+ RootRefusedError,
41
+ confirmProjectRoot,
42
+ isNonInteractive,
43
+ syncPathCliToRuntime
44
+ } from "./chunk-RRJVC35Y.js";
45
+ import {
46
+ checkForUpdates
47
+ } from "./chunk-Y5526WCN.js";
48
+ import {
49
+ dropRetiredSkillIds,
50
+ formatRetiredSkillDrop
51
+ } from "./chunk-HGB4DHXV.js";
52
+ import {
53
+ buildManifest,
54
+ canonicalizePackIds,
55
+ formatPackIdRewrite,
56
+ isProtectedPath,
57
+ loadAgentKitManifest,
58
+ resolveProtectedGlobs,
59
+ saveManifest
60
+ } from "./chunk-ZNZHDPS3.js";
61
+ import {
62
+ seedManagedHashLedger
63
+ } from "./chunk-RJP47EGS.js";
64
+ import {
65
+ KIT_VERSION
66
+ } from "./chunk-2G4K4ZI5.js";
67
+
68
+ // src/commands/update.ts
69
+ import { defineCommand } from "citty";
70
+ var UPDATE_RERUN_FLAGS = [
71
+ "claude",
72
+ "yes",
73
+ "force-root",
74
+ "force",
75
+ "seed-overlay",
76
+ "cwd",
77
+ "registry",
78
+ "url",
79
+ "ref",
80
+ "refresh"
81
+ ];
82
+ var updateCommand = defineCommand({
83
+ meta: {
84
+ name: "update",
85
+ description: "Re-apply L0/packs/skills from the registry (never overwrites L3). --check = notify-only."
86
+ },
87
+ args: {
88
+ cwd: {
89
+ type: "string",
90
+ default: process.cwd()
91
+ },
92
+ check: {
93
+ type: "boolean",
94
+ description: "Check-only: compare installed version to the resolved registry (public tags, or --registry local checkout); never apply L0 writes",
95
+ default: false
96
+ },
97
+ json: {
98
+ type: "boolean",
99
+ description: "Print machine-readable JSON (with --check)",
100
+ default: false
101
+ },
102
+ "respect-prefs": {
103
+ type: "boolean",
104
+ description: "Honor updateCheck.enabled and intervalDays from .cursor/context/config.json (hooks)",
105
+ default: false
106
+ },
107
+ stamp: {
108
+ type: "boolean",
109
+ description: "Persist updateCheck.lastCheckedAt after a network check",
110
+ default: false
111
+ },
112
+ "seed-overlay": {
113
+ type: "boolean",
114
+ description: "Seed the managed-hash ledger from current local overlay files before applying (factory/dogfood only; consumers should not use this)",
115
+ default: false
116
+ },
117
+ "allow-stale-cli": {
118
+ type: "boolean",
119
+ description: "Apply even when this CLI is older than the registry it is syncing from; the manifest is then stamped with this CLI's version, not the registry's (factory/dev only)",
120
+ default: false
121
+ },
122
+ force: {
123
+ type: "boolean",
124
+ description: "Apply even while another live writer holds the queue lease (.cursor/context/run-plan-all.lock); an operator choice, never a default",
125
+ default: false
126
+ },
127
+ claude: {
128
+ type: "boolean",
129
+ description: "Also apply the ledger-aware Claude settings merge (.claude/settings.json + ledger) and generate the .claude/commands/* pointer adapters with install --claude authority; operator opt-in, never from hooks or plan-loop",
130
+ default: false
131
+ },
132
+ all: {
133
+ type: "boolean",
134
+ description: "Operator-typed only: update every repo in the machine install registry, one branch chore/kit-X.Y.Z and one PR/MR per repo after one plan table and one confirm; refuses without a TTY or inside an agent session; never merges",
135
+ default: false
136
+ },
137
+ "include-worktrees": {
138
+ type: "boolean",
139
+ description: "With --all: also update linked git worktrees (excluded by default)",
140
+ default: false
141
+ },
142
+ ...NON_INTERACTIVE_ROOT_ARGS,
143
+ ...REGISTRY_CLI_ARGS
144
+ },
145
+ async run({ args }) {
146
+ if (args.all) {
147
+ if (args.check) {
148
+ logger.error(
149
+ "--all and --check do not combine; use agent-kit installs list to see versions."
150
+ );
151
+ process.exitCode = 1;
152
+ return;
153
+ }
154
+ const { runUpdateAll } = await import("./update-all-5XLTCHPX.js");
155
+ const result2 = await runUpdateAll({
156
+ includeWorktrees: args["include-worktrees"],
157
+ applyOptions: {
158
+ registry: args.registry,
159
+ url: args.url,
160
+ ref: args.ref,
161
+ refresh: args.refresh
162
+ }
163
+ });
164
+ const failed = result2.results.some((r) => r.outcome.status === "error");
165
+ if (result2.status === "refused" || result2.status === "preflight-stop" || failed) {
166
+ process.exitCode = 1;
167
+ }
168
+ return;
169
+ }
170
+ if (args.check) {
171
+ const result2 = await checkForUpdates(args.cwd, {
172
+ respectPrefs: Boolean(args["respect-prefs"]),
173
+ stamp: Boolean(args.stamp),
174
+ publicRegistryUrl: typeof args.url === "string" && args.url ? args.url : void 0,
175
+ registryPath: typeof args.registry === "string" && args.registry ? args.registry : void 0
176
+ });
177
+ if (args.json) {
178
+ console.log(JSON.stringify(result2, null, 2));
179
+ } else {
180
+ const line = `[${result2.status}] ${result2.message}`;
181
+ if (result2.status === "error") logger.error(line);
182
+ else if (result2.status === "update-available") logger.warn(line);
183
+ else if (result2.status.startsWith("skipped-")) logger.warn(line);
184
+ else logger.info(line);
185
+ }
186
+ if (result2.status === "error") process.exitCode = 2;
187
+ return;
188
+ }
189
+ const nonInteractive = args.yes || isNonInteractive();
190
+ let projectRoot;
191
+ try {
192
+ projectRoot = await confirmProjectRoot(args.cwd, {
193
+ nonInteractive,
194
+ command: "update",
195
+ forceRoot: args["force-root"]
196
+ });
197
+ } catch (err) {
198
+ if (err instanceof RootRefusedError) {
199
+ logger.error(err.message);
200
+ if (err.recovery) console.error(`
201
+ ${err.recovery}
202
+ `);
203
+ process.exitCode = 1;
204
+ return;
205
+ }
206
+ throw err;
207
+ }
208
+ const result = await applyUpdateAtRoot(projectRoot, {
209
+ registry: args.registry,
210
+ url: args.url,
211
+ ref: args.ref,
212
+ refresh: args.refresh,
213
+ force: args.force,
214
+ allowStaleCli: args["allow-stale-cli"],
215
+ seedOverlay: args["seed-overlay"],
216
+ claude: args.claude,
217
+ rerun: formatRerunFlags(args, UPDATE_RERUN_FLAGS),
218
+ syncPathCli: true
219
+ });
220
+ if (result.status === "refused" || result.status === "failed") process.exitCode = 1;
221
+ }
222
+ });
223
+ async function applyUpdateAtRoot(projectRoot, options = {}) {
224
+ const existing = await loadAgentKitManifest(projectRoot, { onWarning: logger.warn });
225
+ if (!existing) {
226
+ logger.warn("No .cursor/agent-kit.json \u2014 run agent-kit install first.");
227
+ return { status: "no-manifest" };
228
+ }
229
+ const lease = inspectQueueLease(projectRoot);
230
+ if (lease.kind === "held" && !options.force) {
231
+ const reason = formatQueueLeaseRefusal(lease, {
232
+ what: "another live session writes this workspace, so update will not rewrite L0",
233
+ next: "run agent-kit update again (--force applies anyway; operator choice)"
234
+ });
235
+ logger.error(reason);
236
+ return { status: "refused", reason };
237
+ }
238
+ const registry = await resolveRegistryFromCli({
239
+ cwd: projectRoot,
240
+ registry: options.registry,
241
+ url: options.url,
242
+ ref: options.ref,
243
+ refresh: options.refresh,
244
+ manifest: existing
245
+ });
246
+ try {
247
+ logger.info(`Registry: ${registry.root} (${registry.source})`);
248
+ const stale = await detectStaleCli(registry.root, { warn: logger.warn });
249
+ if (stale && !options.allowStaleCli) {
250
+ const refusal = formatStaleCliRefusal({
251
+ command: "update",
252
+ stale,
253
+ rerun: options.rerun ?? ""
254
+ });
255
+ logger.error(refusal.error);
256
+ console.error(refusal.recovery);
257
+ return { status: "refused", reason: refusal.error };
258
+ }
259
+ const packIds = await canonicalizePackIds(registry.root, existing.packs);
260
+ const retiredSkills = dropRetiredSkillIds(existing.skills);
261
+ const next = buildManifest({
262
+ version: KIT_VERSION,
263
+ profile: existing.profile,
264
+ packs: packIds.packs,
265
+ skills: retiredSkills.skills,
266
+ protected: existing.protected,
267
+ // Restamp generatorVersion with the CLI that ran this apply so the two
268
+ // version fields in the manifest stop disagreeing after an update. The
269
+ // personalization result file itself is not regenerated here.
270
+ personalization: existing.personalization ? { ...existing.personalization, generatorVersion: KIT_VERSION } : void 0,
271
+ registryUrl: registry.url ?? existing.registry?.url,
272
+ registryRef: registry.ref ?? existing.registry?.ref
273
+ });
274
+ if (existing.overrides?.length) next.overrides = existing.overrides;
275
+ if (existing.unknownFields) next.unknownFields = existing.unknownFields;
276
+ if (next.version === existing.version && existing.installedAt) {
277
+ next.installedAt = existing.installedAt;
278
+ }
279
+ if (options.seedOverlay) {
280
+ await seedManagedHashLedger(projectRoot);
281
+ logger.info("Seeded managed-hash ledger from current local overlay files.");
282
+ }
283
+ const stats = await withCliProgress(
284
+ "update",
285
+ () => syncFromManifest(registry.root, projectRoot, next)
286
+ );
287
+ if (stats.skippedSymlink.length > 0) {
288
+ logApplyStats(stats);
289
+ const reason = formatSkippedSymlinks(stats.skippedSymlink);
290
+ logger.error(reason);
291
+ return { status: "failed", reason };
292
+ }
293
+ if (options.claude) {
294
+ const claude = await writeClaudeSessionStartHook(projectRoot, { authorized: true });
295
+ if (claude.status === "skipped-symlink") {
296
+ logApplyStats(stats);
297
+ const reason = `Claude settings not written: ${CLAUDE_SETTINGS_REL}, .claude/ or the ledger resolves outside the project (symlink). Nothing was changed there.`;
298
+ logger.error(reason);
299
+ return { status: "failed", reason };
300
+ }
301
+ if (claude.status === "unavailable") {
302
+ logger.warn(claude.instructions ?? `${CLAUDE_SETTINGS_REL} could not be merged.`);
303
+ } else {
304
+ console.log(`Claude settings ${claude.status}: ${claude.relativePath}`);
305
+ const changed = formatPermissionsChanged(claude.permissionChanges ?? [], {
306
+ mergeAllowWithoutGuard: claude.mergeAllowWithoutGuard ?? []
307
+ });
308
+ for (const line of changed) console.log(line);
309
+ }
310
+ const adapters = await generateClaudeCommandAdapters(projectRoot);
311
+ const skipped = adapters.filter((a) => a.status === "skipped-symlink");
312
+ if (skipped.length > 0) {
313
+ logApplyStats(stats);
314
+ const reason = `Claude command adapters not written for: ${skipped.map((a) => a.relativePath).join(", ")} (symlink outside the project). Nothing was changed there.`;
315
+ logger.error(reason);
316
+ return { status: "failed", reason };
317
+ }
318
+ if (adapters.length > 0) console.log(formatClaudeAdapterSummary(adapters));
319
+ } else {
320
+ const drift = await planClaudeSettingsDrift(projectRoot);
321
+ if (drift) {
322
+ const protectedPath = isProtectedPath(CLAUDE_SETTINGS_REL, resolveProtectedGlobs(next));
323
+ for (const line of formatClaudeSettingsDrift(drift, { protectedPath })) console.log(line);
324
+ }
325
+ }
326
+ await saveManifest(projectRoot, next);
327
+ for (const rewrite of packIds.rewrites) logger.info(formatPackIdRewrite(rewrite));
328
+ for (const id of retiredSkills.dropped) logger.info(formatRetiredSkillDrop(id));
329
+ logApplyStats(stats);
330
+ const transition = next.version === existing.version ? `unchanged at v${next.version}` : `v${existing.version} \u2192 v${next.version}`;
331
+ logger.success(`Update complete: ${transition} (L3 protected paths left untouched).`);
332
+ await feedInstallsRegistry(projectRoot);
333
+ if (options.syncPathCli) {
334
+ const sync = await syncPathCliToRuntime({ runtimeVersion: KIT_VERSION });
335
+ for (const line of sync.lines) console.log(line);
336
+ }
337
+ return { status: "applied", fromVersion: existing.version, toVersion: next.version, stats };
338
+ } finally {
339
+ await registry.unlock?.();
340
+ }
341
+ }
342
+ function formatClaudeAdapterSummary(results) {
343
+ const count = (status) => results.filter((r) => r.status === status).length;
344
+ const parts = [
345
+ `${count("applied")} written`,
346
+ `${count("refreshed")} refreshed`,
347
+ `${count("unchanged")} unchanged`
348
+ ];
349
+ const customized = count("preserved-customized");
350
+ if (customized > 0) parts.push(`${customized} preserved (customized)`);
351
+ return `Claude command adapters: ${parts.join(", ")} (.claude/commands/)`;
352
+ }
353
+
354
+ export {
355
+ updateCommand,
356
+ applyUpdateAtRoot
357
+ };
@@ -0,0 +1,138 @@
1
+ import {
2
+ L0_ARTIFACTS
3
+ } from "./chunk-CGXLR77R.js";
4
+ import {
5
+ UnknownPackError,
6
+ allSkills,
7
+ isProtectedPath,
8
+ loadPackManifest,
9
+ loadRegistry,
10
+ packMemberFileTargets,
11
+ skillFileTargets
12
+ } from "./chunk-ZNZHDPS3.js";
13
+ import {
14
+ contentHash,
15
+ resolveContained
16
+ } from "./chunk-RJP47EGS.js";
17
+ import {
18
+ MANIFEST_RELATIVE_PATH
19
+ } from "./chunk-KMK4T4ZM.js";
20
+
21
+ // src/lifecycle/retired.ts
22
+ import { lstat, readFile, rmdir, unlink } from "fs/promises";
23
+ import path from "path";
24
+ var RETIRED_SKILL_IDS = ["cursor-skills-groovy"];
25
+ var RETIRED_MANAGED_FILES = [
26
+ {
27
+ path: ".cursor/rules/cursor-skills-groovy.mdc",
28
+ hashes: /* @__PURE__ */ new Set([
29
+ "4bee84cedc08822a3c7ec61804574054031206ab0c66286b1adc81d2fd330f86",
30
+ "87eddaddb927069fd161845d514df56fdb395c3e8b893324c135020e2c0285a4"
31
+ ])
32
+ },
33
+ {
34
+ path: ".cursor/skills/community/cursor-skills-groovy/SKILL.md",
35
+ hashes: /* @__PURE__ */ new Set(["ac2f1f7d9e68f9c98fc4fe5ca348b1a90cf484141bbd116db871d63bdcc3c7c3"])
36
+ }
37
+ ];
38
+ function isRetiredSkillId(id) {
39
+ return RETIRED_SKILL_IDS.includes(id);
40
+ }
41
+ function dropRetiredSkillIds(skills) {
42
+ if (!skills) return { skills: void 0, dropped: [] };
43
+ const dropped = skills.filter(isRetiredSkillId);
44
+ return { skills: skills.filter((id) => !isRetiredSkillId(id)), dropped };
45
+ }
46
+ function formatRetiredSkillDrop(id) {
47
+ return `Skill '${id}' was retired from the registry and removed from "skills" in ${MANIFEST_RELATIVE_PATH} (ADR 2026-11-26 third-party skill license policy).`;
48
+ }
49
+ async function retireManagedFiles(projectRoot, protectedGlobs, ledger, files = RETIRED_MANAGED_FILES) {
50
+ const results = [];
51
+ for (const file of files) {
52
+ const abs = resolveContained(projectRoot, file.path);
53
+ let info;
54
+ try {
55
+ info = await lstat(abs);
56
+ } catch {
57
+ results.push({ path: file.path, outcome: "absent" });
58
+ continue;
59
+ }
60
+ if (isProtectedPath(file.path, protectedGlobs)) {
61
+ results.push({ path: file.path, outcome: "skipped-protected" });
62
+ continue;
63
+ }
64
+ if (info.isSymbolicLink() || !info.isFile()) {
65
+ results.push({ path: file.path, outcome: "skipped-symlink" });
66
+ continue;
67
+ }
68
+ const hash = contentHash(await readFile(abs, "utf8"));
69
+ const recorded = ledger?.hashes[file.path];
70
+ if (!file.hashes.has(hash) && hash !== recorded) {
71
+ results.push({ path: file.path, outcome: "preserved-customized" });
72
+ continue;
73
+ }
74
+ await unlink(abs);
75
+ if (ledger) delete ledger.hashes[file.path];
76
+ try {
77
+ await rmdir(path.dirname(abs));
78
+ } catch {
79
+ }
80
+ results.push({ path: file.path, outcome: "removed" });
81
+ }
82
+ return results;
83
+ }
84
+
85
+ // src/lifecycle/targets.ts
86
+ import path2 from "path";
87
+ var toPosix = (rel) => rel.split(path2.sep).join("/");
88
+ async function managedPairs(registryRoot, manifest, index) {
89
+ const pairs = [];
90
+ const missingSkills = [];
91
+ const missingPacks = [];
92
+ const push = (sourceRel, targetRel, origin) => {
93
+ pairs.push({ sourceRel: toPosix(sourceRel), targetRel: toPosix(targetRel), origin });
94
+ };
95
+ for (const a of L0_ARTIFACTS) push(a.source, a.target, "l0");
96
+ for (const packId of manifest.packs ?? []) {
97
+ let pack;
98
+ try {
99
+ pack = await loadPackManifest(registryRoot, packId);
100
+ } catch (err) {
101
+ if (!(err instanceof UnknownPackError)) throw err;
102
+ missingPacks.push(packId);
103
+ continue;
104
+ }
105
+ for (const member of pack.members) {
106
+ for (const { sourceRel, targetRel } of await packMemberFileTargets(registryRoot, member)) {
107
+ push(sourceRel, targetRel, "pack");
108
+ }
109
+ }
110
+ }
111
+ if ((manifest.skills ?? []).length > 0) {
112
+ const pool = allSkills(index ?? await loadRegistry(registryRoot));
113
+ for (const id of manifest.skills ?? []) {
114
+ if (isRetiredSkillId(id)) continue;
115
+ const skill = pool.find((s) => s.id === id);
116
+ if (!skill) {
117
+ missingSkills.push(id);
118
+ continue;
119
+ }
120
+ for (const { sourceRel, targetRel } of await skillFileTargets(
121
+ registryRoot,
122
+ skill.path,
123
+ skill.id
124
+ )) {
125
+ push(sourceRel, targetRel, "skill");
126
+ }
127
+ }
128
+ }
129
+ return { pairs, missingSkills, missingPacks };
130
+ }
131
+
132
+ export {
133
+ isRetiredSkillId,
134
+ dropRetiredSkillIds,
135
+ formatRetiredSkillDrop,
136
+ retireManagedFiles,
137
+ managedPairs
138
+ };