@cleocode/caamp 1.6.0 → 1.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.
@@ -437,104 +437,140 @@ async function removeConfig(filePath, format, key, serverName) {
437
437
  }
438
438
  }
439
439
 
440
+ // src/core/platform-paths.ts
441
+ import envPaths from "env-paths";
442
+ import { arch, homedir, hostname, platform, release } from "os";
443
+ import { isAbsolute, join as join2, resolve } from "path";
444
+ var APP_NAME = "agents";
445
+ function resolveAgentsHomeOverride(value) {
446
+ if (value === void 0) return void 0;
447
+ const trimmed = value.trim();
448
+ if (trimmed.length === 0) return void 0;
449
+ if (trimmed === "~") return homedir();
450
+ if (trimmed.startsWith("~/")) return join2(homedir(), trimmed.slice(2));
451
+ if (isAbsolute(trimmed)) return resolve(trimmed);
452
+ return resolve(homedir(), trimmed);
453
+ }
454
+ var _paths = null;
455
+ var _sysInfo = null;
456
+ var _lastAgentsHome = void 0;
457
+ function getPlatformPaths() {
458
+ const currentAgentsHome = process.env["AGENTS_HOME"];
459
+ if (_paths && currentAgentsHome !== _lastAgentsHome) {
460
+ _paths = null;
461
+ _sysInfo = null;
462
+ }
463
+ if (_paths) return _paths;
464
+ const ep = envPaths(APP_NAME, { suffix: "" });
465
+ _lastAgentsHome = currentAgentsHome;
466
+ _paths = {
467
+ data: resolveAgentsHomeOverride(currentAgentsHome) ?? ep.data,
468
+ config: ep.config,
469
+ cache: ep.cache,
470
+ log: ep.log,
471
+ temp: ep.temp
472
+ };
473
+ return _paths;
474
+ }
475
+ function getSystemInfo() {
476
+ if (_sysInfo) return _sysInfo;
477
+ const paths = getPlatformPaths();
478
+ _sysInfo = {
479
+ platform: platform(),
480
+ arch: arch(),
481
+ release: release(),
482
+ hostname: hostname(),
483
+ nodeVersion: process.version,
484
+ paths
485
+ };
486
+ return _sysInfo;
487
+ }
488
+ function _resetPlatformPathsCache() {
489
+ _paths = null;
490
+ _sysInfo = null;
491
+ _lastAgentsHome = void 0;
492
+ }
493
+
440
494
  // src/core/paths/standard.ts
441
495
  import { existsSync as existsSync5 } from "fs";
442
- import { homedir } from "os";
443
- import { dirname as dirname2, isAbsolute, join as join2, resolve } from "path";
496
+ import { homedir as homedir2 } from "os";
497
+ import { dirname as dirname2, isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "path";
444
498
  function getPlatformLocations() {
445
- const home = homedir();
446
- const platform = process.platform;
447
- if (platform === "win32") {
448
- const appData = process.env["APPDATA"] ?? join2(home, "AppData", "Roaming");
499
+ const home = homedir2();
500
+ const platform2 = process.platform;
501
+ if (platform2 === "win32") {
502
+ const appData = process.env["APPDATA"] ?? join3(home, "AppData", "Roaming");
449
503
  return {
450
504
  home,
451
505
  config: appData,
452
- vscodeConfig: join2(appData, "Code", "User"),
453
- zedConfig: join2(appData, "Zed"),
454
- claudeDesktopConfig: join2(appData, "Claude"),
506
+ vscodeConfig: join3(appData, "Code", "User"),
507
+ zedConfig: join3(appData, "Zed"),
508
+ claudeDesktopConfig: join3(appData, "Claude"),
455
509
  applications: []
456
510
  };
457
511
  }
458
- if (platform === "darwin") {
459
- const config2 = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
512
+ if (platform2 === "darwin") {
513
+ const config2 = process.env["XDG_CONFIG_HOME"] ?? join3(home, ".config");
460
514
  return {
461
515
  home,
462
516
  config: config2,
463
- vscodeConfig: join2(home, "Library", "Application Support", "Code", "User"),
464
- zedConfig: join2(home, "Library", "Application Support", "Zed"),
465
- claudeDesktopConfig: join2(home, "Library", "Application Support", "Claude"),
466
- applications: ["/Applications", join2(home, "Applications")]
517
+ vscodeConfig: join3(home, "Library", "Application Support", "Code", "User"),
518
+ zedConfig: join3(home, "Library", "Application Support", "Zed"),
519
+ claudeDesktopConfig: join3(home, "Library", "Application Support", "Claude"),
520
+ applications: ["/Applications", join3(home, "Applications")]
467
521
  };
468
522
  }
469
- const config = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
523
+ const config = process.env["XDG_CONFIG_HOME"] ?? join3(home, ".config");
470
524
  return {
471
525
  home,
472
526
  config,
473
- vscodeConfig: join2(config, "Code", "User"),
474
- zedConfig: join2(config, "zed"),
475
- claudeDesktopConfig: join2(config, "Claude"),
527
+ vscodeConfig: join3(config, "Code", "User"),
528
+ zedConfig: join3(config, "zed"),
529
+ claudeDesktopConfig: join3(config, "Claude"),
476
530
  applications: []
477
531
  };
478
532
  }
479
- function normalizeHomeOverride(value) {
480
- const home = homedir();
481
- const trimmed = value.trim();
482
- if (trimmed.startsWith("~/")) {
483
- return join2(home, trimmed.slice(2));
484
- }
485
- if (trimmed === "~") {
486
- return home;
487
- }
488
- if (isAbsolute(trimmed)) {
489
- return resolve(trimmed);
490
- }
491
- return resolve(home, trimmed);
492
- }
493
533
  function getAgentsHome() {
494
- const override = process.env["AGENTS_HOME"];
495
- if (override && override.trim().length > 0) {
496
- return normalizeHomeOverride(override);
497
- }
498
- return join2(homedir(), ".agents");
534
+ return getPlatformPaths().data;
499
535
  }
500
536
  function getProjectAgentsDir(projectRoot = process.cwd()) {
501
- return join2(projectRoot, ".agents");
537
+ return join3(projectRoot, ".agents");
502
538
  }
503
539
  function resolveProjectPath(relativePath, projectDir = process.cwd()) {
504
- return join2(projectDir, relativePath);
540
+ return join3(projectDir, relativePath);
505
541
  }
506
542
  function getCanonicalSkillsDir() {
507
- return join2(getAgentsHome(), "skills");
543
+ return join3(getAgentsHome(), "skills");
508
544
  }
509
545
  function getLockFilePath() {
510
- return join2(getAgentsHome(), ".caamp-lock.json");
546
+ return join3(getAgentsHome(), ".caamp-lock.json");
511
547
  }
512
548
  function getAgentsMcpDir(scope = "global", projectDir) {
513
- if (scope === "global") return join2(getAgentsHome(), "mcp");
514
- return join2(projectDir ?? process.cwd(), ".agents", "mcp");
549
+ if (scope === "global") return join3(getAgentsHome(), "mcp");
550
+ return join3(projectDir ?? process.cwd(), ".agents", "mcp");
515
551
  }
516
552
  function getAgentsMcpServersPath(scope = "global", projectDir) {
517
- return join2(getAgentsMcpDir(scope, projectDir), "servers.json");
553
+ return join3(getAgentsMcpDir(scope, projectDir), "servers.json");
518
554
  }
519
555
  function getAgentsInstructFile(scope = "global", projectDir) {
520
- if (scope === "global") return join2(getAgentsHome(), "AGENTS.md");
521
- return join2(projectDir ?? process.cwd(), ".agents", "AGENTS.md");
556
+ if (scope === "global") return join3(getAgentsHome(), "AGENTS.md");
557
+ return join3(projectDir ?? process.cwd(), ".agents", "AGENTS.md");
522
558
  }
523
559
  function getAgentsConfigPath(scope = "global", projectDir) {
524
- if (scope === "global") return join2(getAgentsHome(), "config.toml");
525
- return join2(projectDir ?? process.cwd(), ".agents", "config.toml");
560
+ if (scope === "global") return join3(getAgentsHome(), "config.toml");
561
+ return join3(projectDir ?? process.cwd(), ".agents", "config.toml");
526
562
  }
527
563
  function getAgentsWikiDir(scope = "global", projectDir) {
528
- if (scope === "global") return join2(getAgentsHome(), "wiki");
529
- return join2(projectDir ?? process.cwd(), ".agents", "wiki");
564
+ if (scope === "global") return join3(getAgentsHome(), "wiki");
565
+ return join3(projectDir ?? process.cwd(), ".agents", "wiki");
530
566
  }
531
567
  function getAgentsSpecDir(scope = "global", projectDir) {
532
- if (scope === "global") return join2(getAgentsHome(), "spec");
533
- return join2(projectDir ?? process.cwd(), ".agents", "spec");
568
+ if (scope === "global") return join3(getAgentsHome(), "spec");
569
+ return join3(projectDir ?? process.cwd(), ".agents", "spec");
534
570
  }
535
571
  function getAgentsLinksDir(scope = "global", projectDir) {
536
- if (scope === "global") return join2(getAgentsHome(), "links");
537
- return join2(projectDir ?? process.cwd(), ".agents", "links");
572
+ if (scope === "global") return join3(getAgentsHome(), "links");
573
+ return join3(projectDir ?? process.cwd(), ".agents", "links");
538
574
  }
539
575
  function resolveRegistryTemplatePath(template) {
540
576
  const locations = getPlatformLocations();
@@ -569,7 +605,7 @@ function resolveProviderSkillsDirs(provider, scope, projectDir = process.cwd())
569
605
  return provider.capabilities?.skills?.agentsGlobalPath ?? null;
570
606
  }
571
607
  const projectRelative = provider.capabilities?.skills?.agentsProjectPath ?? null;
572
- return projectRelative ? join2(projectDir, projectRelative) : null;
608
+ return projectRelative ? join3(projectDir, projectRelative) : null;
573
609
  };
574
610
  switch (precedence) {
575
611
  case "vendor-only":
@@ -602,8 +638,8 @@ function resolveProviderProjectPath(provider, projectDir = process.cwd()) {
602
638
  }
603
639
  function resolveProvidersRegistryPath(startDir) {
604
640
  const candidates = [
605
- join2(startDir, "..", "..", "..", "providers", "registry.json"),
606
- join2(startDir, "..", "providers", "registry.json")
641
+ join3(startDir, "..", "..", "..", "providers", "registry.json"),
642
+ join3(startDir, "..", "providers", "registry.json")
607
643
  ];
608
644
  for (const candidate of candidates) {
609
645
  if (existsSync5(candidate)) {
@@ -612,7 +648,7 @@ function resolveProvidersRegistryPath(startDir) {
612
648
  }
613
649
  let current = startDir;
614
650
  for (let i = 0; i < 8; i += 1) {
615
- const candidate = join2(current, "providers", "registry.json");
651
+ const candidate = join3(current, "providers", "registry.json");
616
652
  if (existsSync5(candidate)) {
617
653
  return candidate;
618
654
  }
@@ -896,7 +932,7 @@ function buildServerConfig(source, transport, headers) {
896
932
 
897
933
  // src/core/registry/providers.ts
898
934
  import { readFileSync } from "fs";
899
- import { dirname as dirname3, join as join3 } from "path";
935
+ import { dirname as dirname3, join as join4 } from "path";
900
936
  import { fileURLToPath } from "url";
901
937
  var DEFAULT_SKILLS_CAPABILITY = {
902
938
  agentsGlobalPath: null,
@@ -1067,7 +1103,7 @@ function getEffectiveSkillsPaths(provider, scope, projectDir) {
1067
1103
  const resolveAgentsPath = () => {
1068
1104
  if (scope === "global" && agentsGlobalPath) return agentsGlobalPath;
1069
1105
  if (scope === "project" && agentsProjectPath && projectDir) {
1070
- return join3(projectDir, agentsProjectPath);
1106
+ return join4(projectDir, agentsProjectPath);
1071
1107
  }
1072
1108
  return null;
1073
1109
  };
@@ -1127,7 +1163,7 @@ function providerSupportsById(idOrAlias, capabilityPath) {
1127
1163
  // src/core/registry/detection.ts
1128
1164
  import { execFileSync } from "child_process";
1129
1165
  import { existsSync as existsSync7 } from "fs";
1130
- import { join as join4 } from "path";
1166
+ import { join as join5 } from "path";
1131
1167
  var DEFAULT_DETECTION_CACHE_TTL_MS = 3e4;
1132
1168
  var detectionCache = null;
1133
1169
  function checkBinary(binary) {
@@ -1145,7 +1181,7 @@ function checkDirectory(dir) {
1145
1181
  function checkAppBundle(appName) {
1146
1182
  if (process.platform !== "darwin") return false;
1147
1183
  const applications = getPlatformLocations().applications;
1148
- return applications.some((base) => existsSync7(join4(base, appName)));
1184
+ return applications.some((base) => existsSync7(join5(base, appName)));
1149
1185
  }
1150
1186
  function checkFlatpak(flatpakId) {
1151
1187
  if (process.platform !== "linux") return false;
@@ -1267,13 +1303,13 @@ function resetDetectionCache() {
1267
1303
  // src/core/skills/installer.ts
1268
1304
  import { existsSync as existsSync8, lstatSync } from "fs";
1269
1305
  import { cp, mkdir as mkdir2, rm, symlink } from "fs/promises";
1270
- import { join as join5 } from "path";
1306
+ import { join as join6 } from "path";
1271
1307
  async function ensureCanonicalDir() {
1272
1308
  await mkdir2(getCanonicalSkillsDir(), { recursive: true });
1273
1309
  }
1274
1310
  async function installToCanonical(sourcePath, skillName) {
1275
1311
  await ensureCanonicalDir();
1276
- const targetDir = join5(getCanonicalSkillsDir(), skillName);
1312
+ const targetDir = join6(getCanonicalSkillsDir(), skillName);
1277
1313
  await rm(targetDir, { recursive: true, force: true });
1278
1314
  try {
1279
1315
  await cp(sourcePath, targetDir, { recursive: true });
@@ -1299,7 +1335,7 @@ async function linkToAgent(canonicalPath, provider, skillName, isGlobal, project
1299
1335
  if (!targetSkillsDir) continue;
1300
1336
  try {
1301
1337
  await mkdir2(targetSkillsDir, { recursive: true });
1302
- const linkPath = join5(targetSkillsDir, skillName);
1338
+ const linkPath = join6(targetSkillsDir, skillName);
1303
1339
  if (existsSync8(linkPath)) {
1304
1340
  const stat2 = lstatSync(linkPath);
1305
1341
  if (stat2.isSymbolicLink()) {
@@ -1356,7 +1392,7 @@ async function removeSkill(skillName, providers, isGlobal, projectDir) {
1356
1392
  let providerRemoved = false;
1357
1393
  for (const skillsDir of targetDirs) {
1358
1394
  if (!skillsDir) continue;
1359
- const linkPath = join5(skillsDir, skillName);
1395
+ const linkPath = join6(skillsDir, skillName);
1360
1396
  if (existsSync8(linkPath)) {
1361
1397
  try {
1362
1398
  await rm(linkPath, { recursive: true });
@@ -1370,7 +1406,7 @@ async function removeSkill(skillName, providers, isGlobal, projectDir) {
1370
1406
  removed.push(provider.id);
1371
1407
  }
1372
1408
  }
1373
- const canonicalPath = join5(getCanonicalSkillsDir(), skillName);
1409
+ const canonicalPath = join6(getCanonicalSkillsDir(), skillName);
1374
1410
  if (existsSync8(canonicalPath)) {
1375
1411
  try {
1376
1412
  await rm(canonicalPath, { recursive: true });
@@ -1399,7 +1435,7 @@ import {
1399
1435
  writeFile as writeFile5
1400
1436
  } from "fs/promises";
1401
1437
  import { tmpdir } from "os";
1402
- import { basename, dirname as dirname4, join as join6 } from "path";
1438
+ import { basename, dirname as dirname4, join as join7 } from "path";
1403
1439
 
1404
1440
  // src/core/paths/agents.ts
1405
1441
  var AGENTS_HOME = getAgentsHome();
@@ -1420,8 +1456,8 @@ function selectProvidersByMinimumPriority(providers, minimumPriority = "low") {
1420
1456
  return [...providers].filter((provider) => PRIORITY_ORDER[provider.priority] <= maxRank).sort((a, b) => PRIORITY_ORDER[a.priority] - PRIORITY_ORDER[b.priority]);
1421
1457
  }
1422
1458
  function resolveSkillLinkPath(provider, skillName, isGlobal, projectDir) {
1423
- const skillDir = isGlobal ? provider.pathSkills : join6(projectDir, provider.pathProjectSkills);
1424
- return join6(skillDir, skillName);
1459
+ const skillDir = isGlobal ? provider.pathSkills : join7(projectDir, provider.pathProjectSkills);
1460
+ return join7(skillDir, skillName);
1425
1461
  }
1426
1462
  async function snapshotConfigs(paths) {
1427
1463
  const snapshots = /* @__PURE__ */ new Map();
@@ -1448,9 +1484,9 @@ async function restoreConfigSnapshots(snapshots) {
1448
1484
  async function snapshotSkillState(providerTargets, operation, projectDir, backupRoot) {
1449
1485
  const skillName = operation.skillName;
1450
1486
  const isGlobal = operation.isGlobal ?? true;
1451
- const canonicalPath = join6(CANONICAL_SKILLS_DIR, skillName);
1487
+ const canonicalPath = join7(CANONICAL_SKILLS_DIR, skillName);
1452
1488
  const canonicalExisted = existsSync9(canonicalPath);
1453
- const canonicalBackupPath = join6(backupRoot, "canonical", skillName);
1489
+ const canonicalBackupPath = join7(backupRoot, "canonical", skillName);
1454
1490
  if (canonicalExisted) {
1455
1491
  await mkdir3(dirname4(canonicalBackupPath), { recursive: true });
1456
1492
  await cp2(canonicalPath, canonicalBackupPath, { recursive: true });
@@ -1471,7 +1507,7 @@ async function snapshotSkillState(providerTargets, operation, projectDir, backup
1471
1507
  });
1472
1508
  continue;
1473
1509
  }
1474
- const backupPath = join6(backupRoot, "links", provider.id, `${skillName}-${basename(linkPath)}`);
1510
+ const backupPath = join7(backupRoot, "links", provider.id, `${skillName}-${basename(linkPath)}`);
1475
1511
  await mkdir3(dirname4(backupPath), { recursive: true });
1476
1512
  if (stat2.isDirectory()) {
1477
1513
  await cp2(linkPath, backupPath, { recursive: true });
@@ -1532,7 +1568,7 @@ async function installBatchWithRollback(options) {
1532
1568
  return paths;
1533
1569
  });
1534
1570
  const configSnapshots = await snapshotConfigs(configPaths);
1535
- const backupRoot = join6(
1571
+ const backupRoot = join7(
1536
1572
  tmpdir(),
1537
1573
  `caamp-skill-backup-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
1538
1574
  );
@@ -1723,7 +1759,7 @@ async function updateInstructionsSingleOperation(providers, content, scope = "pr
1723
1759
  };
1724
1760
  for (const [filePath, action] of actions.entries()) {
1725
1761
  const providersForFile = providers.filter((provider) => {
1726
- const expectedPath = scope === "global" ? join6(provider.pathGlobal, provider.instructFile) : join6(projectDir, provider.instructFile);
1762
+ const expectedPath = scope === "global" ? join7(provider.pathGlobal, provider.instructFile) : join7(projectDir, provider.instructFile);
1727
1763
  return expectedPath === filePath;
1728
1764
  });
1729
1765
  const fallback = groupedByFile.get(basename(filePath)) ?? [];
@@ -1791,8 +1827,8 @@ async function configureProviderGlobalAndProject(provider, options) {
1791
1827
  // src/core/mcp/cleo.ts
1792
1828
  import { execFileSync as execFileSync2 } from "child_process";
1793
1829
  import { existsSync as existsSync10 } from "fs";
1794
- import { homedir as homedir2 } from "os";
1795
- import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
1830
+ import { homedir as homedir3 } from "os";
1831
+ import { isAbsolute as isAbsolute3, resolve as resolve4 } from "path";
1796
1832
  var CLEO_SERVER_NAMES = {
1797
1833
  stable: "cleo",
1798
1834
  beta: "cleo-beta",
@@ -1873,9 +1909,9 @@ function buildCleoProfile(options) {
1873
1909
  };
1874
1910
  }
1875
1911
  function expandHome(pathValue) {
1876
- if (pathValue === "~") return homedir2();
1912
+ if (pathValue === "~") return homedir3();
1877
1913
  if (pathValue.startsWith("~/")) {
1878
- return resolve3(homedir2(), pathValue.slice(2));
1914
+ return resolve4(homedir3(), pathValue.slice(2));
1879
1915
  }
1880
1916
  return pathValue;
1881
1917
  }
@@ -1883,7 +1919,7 @@ function checkCommandReachability(command) {
1883
1919
  const hasPathSeparator = command.includes("/") || command.includes("\\");
1884
1920
  if (hasPathSeparator || command.startsWith("~")) {
1885
1921
  const expanded = expandHome(command);
1886
- const candidate = isAbsolute2(expanded) ? expanded : resolve3(process.cwd(), expanded);
1922
+ const candidate = isAbsolute3(expanded) ? expanded : resolve4(process.cwd(), expanded);
1887
1923
  if (existsSync10(candidate)) {
1888
1924
  return { reachable: true, method: "path", detail: candidate };
1889
1925
  }
@@ -1929,7 +1965,7 @@ import { existsSync as existsSync11 } from "fs";
1929
1965
  var LOCK_GUARD_PATH = `${LOCK_FILE_PATH}.lock`;
1930
1966
  var STALE_LOCK_MS = 5e3;
1931
1967
  function sleep(ms) {
1932
- return new Promise((resolve4) => setTimeout(resolve4, ms));
1968
+ return new Promise((resolve5) => setTimeout(resolve5, ms));
1933
1969
  }
1934
1970
  async function removeStaleLock() {
1935
1971
  try {
@@ -2591,7 +2627,7 @@ var MarketplaceClient = class {
2591
2627
  // src/core/skills/library-loader.ts
2592
2628
  import { createRequire } from "module";
2593
2629
  import { existsSync as existsSync12, readdirSync, readFileSync as readFileSync2 } from "fs";
2594
- import { basename as basename2, dirname as dirname5, join as join7 } from "path";
2630
+ import { basename as basename2, dirname as dirname5, join as join8 } from "path";
2595
2631
  var require2 = createRequire(import.meta.url);
2596
2632
  function loadLibraryFromModule(root) {
2597
2633
  let mod;
@@ -2639,14 +2675,14 @@ function loadLibraryFromModule(root) {
2639
2675
  return mod;
2640
2676
  }
2641
2677
  function buildLibraryFromFiles(root) {
2642
- const catalogPath = join7(root, "skills.json");
2678
+ const catalogPath = join8(root, "skills.json");
2643
2679
  if (!existsSync12(catalogPath)) {
2644
2680
  throw new Error(`No skills.json found at ${root}`);
2645
2681
  }
2646
2682
  const catalogData = JSON.parse(readFileSync2(catalogPath, "utf-8"));
2647
2683
  const entries = catalogData.skills ?? [];
2648
2684
  const version = catalogData.version ?? "0.0.0";
2649
- const manifestPath = join7(root, "skills", "manifest.json");
2685
+ const manifestPath = join8(root, "skills", "manifest.json");
2650
2686
  let manifest;
2651
2687
  if (existsSync12(manifestPath)) {
2652
2688
  manifest = JSON.parse(readFileSync2(manifestPath, "utf-8"));
@@ -2658,14 +2694,14 @@ function buildLibraryFromFiles(root) {
2658
2694
  skills: []
2659
2695
  };
2660
2696
  }
2661
- const profilesDir = join7(root, "profiles");
2697
+ const profilesDir = join8(root, "profiles");
2662
2698
  const profiles = /* @__PURE__ */ new Map();
2663
2699
  if (existsSync12(profilesDir)) {
2664
2700
  for (const file of readdirSync(profilesDir)) {
2665
2701
  if (!file.endsWith(".json")) continue;
2666
2702
  try {
2667
2703
  const profile = JSON.parse(
2668
- readFileSync2(join7(profilesDir, file), "utf-8")
2704
+ readFileSync2(join8(profilesDir, file), "utf-8")
2669
2705
  );
2670
2706
  profiles.set(profile.name, profile);
2671
2707
  } catch {
@@ -2679,9 +2715,9 @@ function buildLibraryFromFiles(root) {
2679
2715
  function getSkillDir2(name) {
2680
2716
  const entry = skillMap.get(name);
2681
2717
  if (entry) {
2682
- return dirname5(join7(root, entry.path));
2718
+ return dirname5(join8(root, entry.path));
2683
2719
  }
2684
- return join7(root, "skills", name);
2720
+ return join8(root, "skills", name);
2685
2721
  }
2686
2722
  function resolveDeps(names, visited = /* @__PURE__ */ new Set()) {
2687
2723
  const result = [];
@@ -2726,9 +2762,9 @@ function buildLibraryFromFiles(root) {
2726
2762
  getSkillPath(name) {
2727
2763
  const entry = skillMap.get(name);
2728
2764
  if (entry) {
2729
- return join7(root, entry.path);
2765
+ return join8(root, entry.path);
2730
2766
  }
2731
- return join7(root, "skills", name, "SKILL.md");
2767
+ return join8(root, "skills", name, "SKILL.md");
2732
2768
  },
2733
2769
  getSkillDir: getSkillDir2,
2734
2770
  readSkillContent(name) {
@@ -2760,10 +2796,10 @@ function buildLibraryFromFiles(root) {
2760
2796
  return resolveProfileByName(name);
2761
2797
  },
2762
2798
  listSharedResources() {
2763
- return discoverFiles(join7(root, "skills", "_shared"), ".md");
2799
+ return discoverFiles(join8(root, "skills", "_shared"), ".md");
2764
2800
  },
2765
2801
  getSharedResourcePath(name) {
2766
- const resourcePath = join7(root, "skills", "_shared", `${name}.md`);
2802
+ const resourcePath = join8(root, "skills", "_shared", `${name}.md`);
2767
2803
  return existsSync12(resourcePath) ? resourcePath : void 0;
2768
2804
  },
2769
2805
  readSharedResource(name) {
@@ -2772,14 +2808,14 @@ function buildLibraryFromFiles(root) {
2772
2808
  return readFileSync2(resourcePath, "utf-8");
2773
2809
  },
2774
2810
  listProtocols() {
2775
- const rootProtocols = discoverFiles(join7(root, "protocols"), ".md");
2811
+ const rootProtocols = discoverFiles(join8(root, "protocols"), ".md");
2776
2812
  if (rootProtocols.length > 0) return rootProtocols;
2777
- return discoverFiles(join7(root, "skills", "protocols"), ".md");
2813
+ return discoverFiles(join8(root, "skills", "protocols"), ".md");
2778
2814
  },
2779
2815
  getProtocolPath(name) {
2780
- const rootPath = join7(root, "protocols", `${name}.md`);
2816
+ const rootPath = join8(root, "protocols", `${name}.md`);
2781
2817
  if (existsSync12(rootPath)) return rootPath;
2782
- const skillsPath = join7(root, "skills", "protocols", `${name}.md`);
2818
+ const skillsPath = join8(root, "skills", "protocols", `${name}.md`);
2783
2819
  return existsSync12(skillsPath) ? skillsPath : void 0;
2784
2820
  },
2785
2821
  readProtocol(name) {
@@ -2805,7 +2841,7 @@ function buildLibraryFromFiles(root) {
2805
2841
  if (!entry.version) {
2806
2842
  issues.push({ level: "warn", field: "version", message: "Missing version" });
2807
2843
  }
2808
- const skillPath = join7(root, entry.path);
2844
+ const skillPath = join8(root, entry.path);
2809
2845
  if (!existsSync12(skillPath)) {
2810
2846
  issues.push({ level: "error", field: "path", message: `SKILL.md not found at ${entry.path}` });
2811
2847
  }
@@ -2862,13 +2898,13 @@ __export(catalog_exports, {
2862
2898
  validateSkillFrontmatter: () => validateSkillFrontmatter
2863
2899
  });
2864
2900
  import { existsSync as existsSync13 } from "fs";
2865
- import { join as join8 } from "path";
2901
+ import { join as join9 } from "path";
2866
2902
  var _library = null;
2867
2903
  function registerSkillLibrary(library) {
2868
2904
  _library = library;
2869
2905
  }
2870
2906
  function registerSkillLibraryFromPath(root) {
2871
- const indexPath = join8(root, "index.js");
2907
+ const indexPath = join9(root, "index.js");
2872
2908
  if (existsSync13(indexPath)) {
2873
2909
  _library = loadLibraryFromModule(root);
2874
2910
  return;
@@ -2882,11 +2918,11 @@ function discoverLibrary() {
2882
2918
  const envPath = process.env["CAAMP_SKILL_LIBRARY"];
2883
2919
  if (envPath && existsSync13(envPath)) {
2884
2920
  try {
2885
- const indexPath = join8(envPath, "index.js");
2921
+ const indexPath = join9(envPath, "index.js");
2886
2922
  if (existsSync13(indexPath)) {
2887
2923
  return loadLibraryFromModule(envPath);
2888
2924
  }
2889
- if (existsSync13(join8(envPath, "skills.json"))) {
2925
+ if (existsSync13(join9(envPath, "skills.json"))) {
2890
2926
  return buildLibraryFromFiles(envPath);
2891
2927
  }
2892
2928
  } catch {
@@ -2995,7 +3031,7 @@ function getLibraryRoot() {
2995
3031
  // src/core/skills/discovery.ts
2996
3032
  import { readFile as readFile7, readdir } from "fs/promises";
2997
3033
  import { existsSync as existsSync14 } from "fs";
2998
- import { join as join9 } from "path";
3034
+ import { join as join10 } from "path";
2999
3035
  import matter from "gray-matter";
3000
3036
  async function parseSkillFile(filePath) {
3001
3037
  try {
@@ -3019,7 +3055,7 @@ async function parseSkillFile(filePath) {
3019
3055
  }
3020
3056
  }
3021
3057
  async function discoverSkill(skillDir) {
3022
- const skillFile = join9(skillDir, "SKILL.md");
3058
+ const skillFile = join10(skillDir, "SKILL.md");
3023
3059
  if (!existsSync14(skillFile)) return null;
3024
3060
  const metadata = await parseSkillFile(skillFile);
3025
3061
  if (!metadata) return null;
@@ -3036,7 +3072,7 @@ async function discoverSkills(rootDir) {
3036
3072
  const skills = [];
3037
3073
  for (const entry of entries) {
3038
3074
  if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
3039
- const skillDir = join9(rootDir, entry.name);
3075
+ const skillDir = join10(rootDir, entry.name);
3040
3076
  const skill = await discoverSkill(skillDir);
3041
3077
  if (skill) {
3042
3078
  skills.push(skill);
@@ -3874,13 +3910,13 @@ async function scanFile(filePath, rules) {
3874
3910
  }
3875
3911
  async function scanDirectory(dirPath) {
3876
3912
  const { readdir: readdir2 } = await import("fs/promises");
3877
- const { join: join10 } = await import("path");
3913
+ const { join: join11 } = await import("path");
3878
3914
  if (!existsSync15(dirPath)) return [];
3879
3915
  const entries = await readdir2(dirPath, { withFileTypes: true });
3880
3916
  const results = [];
3881
3917
  for (const entry of entries) {
3882
3918
  if (entry.isDirectory() || entry.isSymbolicLink()) {
3883
- const skillFile = join10(dirPath, entry.name, "SKILL.md");
3919
+ const skillFile = join11(dirPath, entry.name, "SKILL.md");
3884
3920
  if (existsSync15(skillFile)) {
3885
3921
  results.push(await scanFile(skillFile));
3886
3922
  }
@@ -4090,6 +4126,9 @@ export {
4090
4126
  readConfig,
4091
4127
  writeConfig,
4092
4128
  removeConfig,
4129
+ getPlatformPaths,
4130
+ getSystemInfo,
4131
+ _resetPlatformPathsCache,
4093
4132
  getPlatformLocations,
4094
4133
  getAgentsHome,
4095
4134
  getProjectAgentsDir,
@@ -4206,4 +4245,4 @@ export {
4206
4245
  toSarif,
4207
4246
  validateSkill
4208
4247
  };
4209
- //# sourceMappingURL=chunk-N5E7BZM2.js.map
4248
+ //# sourceMappingURL=chunk-M6KHYT2D.js.map