@cleocode/caamp 2026.9.20 → 2026.9.22

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.
@@ -11,7 +11,7 @@ import {
11
11
  resolveGlobalInstructionPath,
12
12
  resolveInstructionDelivery,
13
13
  withFileLock
14
- } from "./chunk-JELNPPLN.js";
14
+ } from "./chunk-UIXTFV35.js";
15
15
  import {
16
16
  __export,
17
17
  buildSkillSubPathCandidates,
@@ -325,9 +325,12 @@ async function installToCanonical(sourcePath, skillName) {
325
325
  await replaceDirectoryFromSource(sourcePath, targetDir);
326
326
  return targetDir;
327
327
  }
328
+ function skillInstallResolves(path) {
329
+ return existsSync2(join2(path, "SKILL.md")) || existsSync2(path);
330
+ }
328
331
  function isLinkTo(linkPath, canonicalPath) {
329
332
  try {
330
- return lstatSync(linkPath).isSymbolicLink() && readlinkSync(linkPath) === canonicalPath;
333
+ return lstatSync(linkPath).isSymbolicLink() && readlinkSync(linkPath) === canonicalPath && skillInstallResolves(linkPath);
331
334
  } catch {
332
335
  return false;
333
336
  }
@@ -351,9 +354,14 @@ async function linkToAgent(canonicalPath, provider, skillName, isGlobal, project
351
354
  }
352
355
  const stagedPath = siblingPath(linkPath, "staging");
353
356
  const symlinkType = process.platform === "win32" ? "junction" : "dir";
357
+ let linked = false;
354
358
  try {
355
359
  await symlink(canonicalPath, stagedPath, symlinkType);
360
+ linked = skillInstallResolves(stagedPath);
356
361
  } catch {
362
+ linked = false;
363
+ }
364
+ if (!linked) {
357
365
  await rm(stagedPath, { recursive: true, force: true });
358
366
  await cp(canonicalPath, stagedPath, { recursive: true });
359
367
  }
@@ -363,6 +371,9 @@ async function linkToAgent(canonicalPath, provider, skillName, isGlobal, project
363
371
  await rm(stagedPath, { recursive: true, force: true });
364
372
  throw err;
365
373
  }
374
+ if (!skillInstallResolves(linkPath)) {
375
+ throw new Error(`${linkPath} was written but does not resolve to ${canonicalPath}`);
376
+ }
366
377
  anySuccess = true;
367
378
  } catch (err) {
368
379
  errors.push(err instanceof Error ? err.message : String(err));
@@ -2563,15 +2574,52 @@ function loadLibraryFromModule(root) {
2563
2574
  }
2564
2575
  return mod;
2565
2576
  }
2577
+ var CATALOG_CATEGORIES = /* @__PURE__ */ new Set([
2578
+ "core",
2579
+ "recommended",
2580
+ "specialist",
2581
+ "composition",
2582
+ "meta"
2583
+ ]);
2584
+ function catalogEntryFromManifest(skill) {
2585
+ const path = skill.path.endsWith("SKILL.md") ? skill.path : `${skill.path}/SKILL.md`;
2586
+ const category = skill.category !== void 0 && CATALOG_CATEGORIES.has(skill.category) ? skill.category : "recommended";
2587
+ return {
2588
+ name: skill.name,
2589
+ description: skill.description,
2590
+ version: skill.version,
2591
+ path,
2592
+ references: skill.references ?? [],
2593
+ core: skill.core ?? skill.deliveryTier === "core",
2594
+ category,
2595
+ tier: skill.tier,
2596
+ protocol: skill.protocol ?? null,
2597
+ dependencies: skill.dependencies ?? [],
2598
+ sharedResources: skill.sharedResources ?? [],
2599
+ compatibility: skill.compatibility ?? [],
2600
+ license: skill.license ?? "MIT",
2601
+ metadata: {
2602
+ ...skill.deliveryTier !== void 0 && { deliveryTier: skill.deliveryTier },
2603
+ ...skill.install !== void 0 && { install: skill.install }
2604
+ }
2605
+ };
2606
+ }
2607
+ function readPackageVersion(root) {
2608
+ const pkgPath = join5(root, "package.json");
2609
+ if (!existsSync4(pkgPath)) return "0.0.0";
2610
+ try {
2611
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
2612
+ return pkg.version ?? "0.0.0";
2613
+ } catch {
2614
+ return "0.0.0";
2615
+ }
2616
+ }
2566
2617
  function buildLibraryFromFiles(root) {
2567
2618
  const catalogPath = join5(root, "skills.json");
2568
- if (!existsSync4(catalogPath)) {
2569
- throw new Error(`No skills.json found at ${root}`);
2570
- }
2571
- const catalogData = JSON.parse(readFileSync(catalogPath, "utf-8"));
2572
- const entries = catalogData.skills ?? [];
2573
- const version = catalogData.version ?? "0.0.0";
2574
2619
  const manifestPath = join5(root, "skills", "manifest.json");
2620
+ if (!existsSync4(catalogPath) && !existsSync4(manifestPath)) {
2621
+ throw new Error(`No skills.json or skills/manifest.json found at ${root}`);
2622
+ }
2575
2623
  let manifest;
2576
2624
  if (existsSync4(manifestPath)) {
2577
2625
  manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
@@ -2583,6 +2631,16 @@ function buildLibraryFromFiles(root) {
2583
2631
  skills: []
2584
2632
  };
2585
2633
  }
2634
+ let entries;
2635
+ let version;
2636
+ if (existsSync4(catalogPath)) {
2637
+ const catalogData = JSON.parse(readFileSync(catalogPath, "utf-8"));
2638
+ entries = catalogData.skills ?? [];
2639
+ version = catalogData.version ?? "0.0.0";
2640
+ } else {
2641
+ entries = manifest.skills.map(catalogEntryFromManifest);
2642
+ version = readPackageVersion(root);
2643
+ }
2586
2644
  const profilesDir = join5(root, "profiles");
2587
2645
  const profiles = /* @__PURE__ */ new Map();
2588
2646
  if (existsSync4(profilesDir)) {
@@ -2815,7 +2873,7 @@ function discoverLibrary() {
2815
2873
  if (existsSync5(indexPath)) {
2816
2874
  return loadLibraryFromModule(envPath);
2817
2875
  }
2818
- if (existsSync5(join6(envPath, "skills.json"))) {
2876
+ if (existsSync5(join6(envPath, "skills.json")) || existsSync5(join6(envPath, "skills", "manifest.json"))) {
2819
2877
  return buildLibraryFromFiles(envPath);
2820
2878
  }
2821
2879
  } catch {
@@ -5369,6 +5427,7 @@ export {
5369
5427
  parseSource,
5370
5428
  isMarketplaceScoped,
5371
5429
  loadLibraryFromModule,
5430
+ catalogEntryFromManifest,
5372
5431
  buildLibraryFromFiles,
5373
5432
  registerSkillLibrary,
5374
5433
  registerSkillLibraryFromPath,
@@ -5425,4 +5484,4 @@ export {
5425
5484
  recommendSkills2 as recommendSkills,
5426
5485
  validateSkill
5427
5486
  };
5428
- //# sourceMappingURL=chunk-QC6CHW72.js.map
5487
+ //# sourceMappingURL=chunk-3OL6CAMT.js.map