@cleocode/caamp 2026.5.26 → 2026.5.28

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveRegistryTemplatePath
3
- } from "./chunk-B5WJ4RDT.js";
3
+ } from "./chunk-OCQI7UDH.js";
4
4
 
5
5
  // src/core/hooks/normalizer.ts
6
6
  import { existsSync, readFileSync } from "fs";
@@ -291,4 +291,4 @@ export {
291
291
  resolveNativeEvent,
292
292
  getHookMappingsVersion
293
293
  };
294
- //# sourceMappingURL=chunk-UZSGHMYW.js.map
294
+ //# sourceMappingURL=chunk-GDEIR34D.js.map
@@ -3,7 +3,7 @@ import {
3
3
  getPrimaryProvider,
4
4
  groupByInstructFile,
5
5
  injectAll
6
- } from "./chunk-QUVY4LG4.js";
6
+ } from "./chunk-YXWL2IXL.js";
7
7
  import {
8
8
  __export,
9
9
  getAgentsConfigPath,
@@ -16,7 +16,7 @@ import {
16
16
  resolveProviderConfigPath,
17
17
  resolveProviderProjectPath,
18
18
  resolveProviderSkillsDirs
19
- } from "./chunk-B5WJ4RDT.js";
19
+ } from "./chunk-OCQI7UDH.js";
20
20
 
21
21
  // src/core/logger.ts
22
22
  var verboseMode = false;
@@ -4722,4 +4722,4 @@ export {
4722
4722
  discoverSkillsMulti,
4723
4723
  validateSkill
4724
4724
  };
4725
- //# sourceMappingURL=chunk-S3PLNL6K.js.map
4725
+ //# sourceMappingURL=chunk-HFC3WUME.js.map
@@ -5,107 +5,56 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/core/platform-paths.ts
8
- import { arch, homedir, hostname, platform, release } from "os";
9
- import { isAbsolute, join, resolve } from "path";
10
- import envPaths from "env-paths";
11
- function resolveHomeOverride(value) {
12
- if (value === void 0) return void 0;
13
- const trimmed = value.trim();
14
- if (trimmed.length === 0) return void 0;
15
- if (trimmed === "~") return homedir();
16
- if (trimmed.startsWith("~/")) return join(homedir(), trimmed.slice(2));
17
- if (isAbsolute(trimmed)) return resolve(trimmed);
18
- return resolve(homedir(), trimmed);
19
- }
20
- function createPlatformPathsResolver(appName, homeEnvVar) {
21
- let _paths = null;
22
- let _sysInfo = null;
23
- let _lastHomeValue;
24
- function getPlatformPaths2() {
25
- const currentHome = process.env[homeEnvVar];
26
- if (_paths && currentHome !== _lastHomeValue) {
27
- _paths = null;
28
- _sysInfo = null;
29
- }
30
- if (_paths) return _paths;
31
- const ep = envPaths(appName, { suffix: "" });
32
- _lastHomeValue = currentHome;
33
- _paths = {
34
- data: resolveHomeOverride(currentHome) ?? ep.data,
35
- config: ep.config,
36
- cache: ep.cache,
37
- log: ep.log,
38
- temp: ep.temp
39
- };
40
- return _paths;
41
- }
42
- function getSystemInfo2() {
43
- if (_sysInfo) return _sysInfo;
44
- const paths = getPlatformPaths2();
45
- _sysInfo = {
46
- platform: platform(),
47
- arch: arch(),
48
- release: release(),
49
- hostname: hostname(),
50
- nodeVersion: process.version,
51
- paths
52
- };
53
- return _sysInfo;
54
- }
55
- function resetCache() {
56
- _paths = null;
57
- _sysInfo = null;
58
- _lastHomeValue = void 0;
59
- }
60
- return { getPlatformPaths: getPlatformPaths2, getSystemInfo: getSystemInfo2, resetCache };
61
- }
62
- var _agentsResolver = createPlatformPathsResolver("agents", "AGENTS_HOME");
8
+ import {
9
+ createPlatformPathsResolver
10
+ } from "@cleocode/paths";
11
+ var agentsResolver = createPlatformPathsResolver("agents", "AGENTS_HOME");
63
12
  function getPlatformPaths() {
64
- return _agentsResolver.getPlatformPaths();
13
+ return agentsResolver.getPlatformPaths();
65
14
  }
66
15
  function getSystemInfo() {
67
- return _agentsResolver.getSystemInfo();
16
+ return agentsResolver.getSystemInfo();
68
17
  }
69
18
  function _resetPlatformPathsCache() {
70
- _agentsResolver.resetCache();
19
+ agentsResolver.resetCache();
71
20
  }
72
21
 
73
22
  // src/core/paths/standard.ts
74
23
  import { existsSync } from "fs";
75
- import { homedir as homedir2 } from "os";
76
- import { dirname, join as join2 } from "path";
24
+ import { homedir } from "os";
25
+ import { dirname, join } from "path";
77
26
  function getPlatformLocations() {
78
- const home = homedir2();
79
- const platform2 = process.platform;
80
- if (platform2 === "win32") {
81
- const appData = process.env["APPDATA"] ?? join2(home, "AppData", "Roaming");
27
+ const home = homedir();
28
+ const platform = process.platform;
29
+ if (platform === "win32") {
30
+ const appData = process.env["APPDATA"] ?? join(home, "AppData", "Roaming");
82
31
  return {
83
32
  home,
84
33
  config: appData,
85
- vscodeConfig: join2(appData, "Code", "User"),
86
- zedConfig: join2(appData, "Zed"),
87
- claudeDesktopConfig: join2(appData, "Claude"),
34
+ vscodeConfig: join(appData, "Code", "User"),
35
+ zedConfig: join(appData, "Zed"),
36
+ claudeDesktopConfig: join(appData, "Claude"),
88
37
  applications: []
89
38
  };
90
39
  }
91
- if (platform2 === "darwin") {
92
- const config2 = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
40
+ if (platform === "darwin") {
41
+ const config2 = process.env["XDG_CONFIG_HOME"] ?? join(home, ".config");
93
42
  return {
94
43
  home,
95
44
  config: config2,
96
- vscodeConfig: join2(home, "Library", "Application Support", "Code", "User"),
97
- zedConfig: join2(home, "Library", "Application Support", "Zed"),
98
- claudeDesktopConfig: join2(home, "Library", "Application Support", "Claude"),
99
- applications: ["/Applications", join2(home, "Applications")]
45
+ vscodeConfig: join(home, "Library", "Application Support", "Code", "User"),
46
+ zedConfig: join(home, "Library", "Application Support", "Zed"),
47
+ claudeDesktopConfig: join(home, "Library", "Application Support", "Claude"),
48
+ applications: ["/Applications", join(home, "Applications")]
100
49
  };
101
50
  }
102
- const config = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
51
+ const config = process.env["XDG_CONFIG_HOME"] ?? join(home, ".config");
103
52
  return {
104
53
  home,
105
54
  config,
106
- vscodeConfig: join2(config, "Code", "User"),
107
- zedConfig: join2(config, "zed"),
108
- claudeDesktopConfig: join2(config, "Claude"),
55
+ vscodeConfig: join(config, "Code", "User"),
56
+ zedConfig: join(config, "zed"),
57
+ claudeDesktopConfig: join(config, "Claude"),
109
58
  applications: []
110
59
  };
111
60
  }
@@ -113,43 +62,43 @@ function getAgentsHome() {
113
62
  return getPlatformPaths().data;
114
63
  }
115
64
  function getProjectAgentsDir(projectRoot = process.cwd()) {
116
- return join2(projectRoot, ".agents");
65
+ return join(projectRoot, ".agents");
117
66
  }
118
67
  function resolveProjectPath(relativePath, projectDir = process.cwd()) {
119
- return join2(projectDir, relativePath);
68
+ return join(projectDir, relativePath);
120
69
  }
121
70
  function getCanonicalSkillsDir() {
122
- return join2(getAgentsHome(), "skills");
71
+ return join(getAgentsHome(), "skills");
123
72
  }
124
73
  function getLockFilePath() {
125
- return join2(getAgentsHome(), ".caamp-lock.json");
74
+ return join(getAgentsHome(), ".caamp-lock.json");
126
75
  }
127
76
  function getAgentsMcpDir(scope = "global", projectDir) {
128
- if (scope === "global") return join2(getAgentsHome(), "mcp");
129
- return join2(projectDir ?? process.cwd(), ".agents", "mcp");
77
+ if (scope === "global") return join(getAgentsHome(), "mcp");
78
+ return join(projectDir ?? process.cwd(), ".agents", "mcp");
130
79
  }
131
80
  function getAgentsMcpServersPath(scope = "global", projectDir) {
132
- return join2(getAgentsMcpDir(scope, projectDir), "servers.json");
81
+ return join(getAgentsMcpDir(scope, projectDir), "servers.json");
133
82
  }
134
83
  function getAgentsInstructFile(scope = "global", projectDir) {
135
- if (scope === "global") return join2(getAgentsHome(), "AGENTS.md");
136
- return join2(projectDir ?? process.cwd(), ".agents", "AGENTS.md");
84
+ if (scope === "global") return join(getAgentsHome(), "AGENTS.md");
85
+ return join(projectDir ?? process.cwd(), ".agents", "AGENTS.md");
137
86
  }
138
87
  function getAgentsConfigPath(scope = "global", projectDir) {
139
- if (scope === "global") return join2(getAgentsHome(), "config.toml");
140
- return join2(projectDir ?? process.cwd(), ".agents", "config.toml");
88
+ if (scope === "global") return join(getAgentsHome(), "config.toml");
89
+ return join(projectDir ?? process.cwd(), ".agents", "config.toml");
141
90
  }
142
91
  function getAgentsWikiDir(scope = "global", projectDir) {
143
- if (scope === "global") return join2(getAgentsHome(), "wiki");
144
- return join2(projectDir ?? process.cwd(), ".agents", "wiki");
92
+ if (scope === "global") return join(getAgentsHome(), "wiki");
93
+ return join(projectDir ?? process.cwd(), ".agents", "wiki");
145
94
  }
146
95
  function getAgentsSpecDir(scope = "global", projectDir) {
147
- if (scope === "global") return join2(getAgentsHome(), "spec");
148
- return join2(projectDir ?? process.cwd(), ".agents", "spec");
96
+ if (scope === "global") return join(getAgentsHome(), "spec");
97
+ return join(projectDir ?? process.cwd(), ".agents", "spec");
149
98
  }
150
99
  function getAgentsLinksDir(scope = "global", projectDir) {
151
- if (scope === "global") return join2(getAgentsHome(), "links");
152
- return join2(projectDir ?? process.cwd(), ".agents", "links");
100
+ if (scope === "global") return join(getAgentsHome(), "links");
101
+ return join(projectDir ?? process.cwd(), ".agents", "links");
153
102
  }
154
103
  function getCleoHomeForTemplate() {
155
104
  const envOverride = process.env["CLEO_HOME"];
@@ -158,14 +107,14 @@ function getCleoHomeForTemplate() {
158
107
  }
159
108
  const home = getPlatformLocations().home;
160
109
  if (process.platform === "win32") {
161
- const localAppData = process.env["LOCALAPPDATA"] ?? join2(home, "AppData", "Local");
162
- return join2(localAppData, "cleo", "Data");
110
+ const localAppData = process.env["LOCALAPPDATA"] ?? join(home, "AppData", "Local");
111
+ return join(localAppData, "cleo", "Data");
163
112
  }
164
113
  if (process.platform === "darwin") {
165
- return join2(home, "Library", "Application Support", "cleo");
114
+ return join(home, "Library", "Application Support", "cleo");
166
115
  }
167
- const xdgData = process.env["XDG_DATA_HOME"] ?? join2(home, ".local", "share");
168
- return join2(xdgData, "cleo");
116
+ const xdgData = process.env["XDG_DATA_HOME"] ?? join(home, ".local", "share");
117
+ return join(xdgData, "cleo");
169
118
  }
170
119
  function resolveRegistryTemplatePath(template) {
171
120
  const locations = getPlatformLocations();
@@ -198,7 +147,7 @@ function resolveProviderSkillsDirs(provider, scope, projectDir = process.cwd())
198
147
  return provider.capabilities?.skills?.agentsGlobalPath ?? null;
199
148
  }
200
149
  const projectRelative = provider.capabilities?.skills?.agentsProjectPath ?? null;
201
- return projectRelative ? join2(projectDir, projectRelative) : null;
150
+ return projectRelative ? join(projectDir, projectRelative) : null;
202
151
  };
203
152
  switch (precedence) {
204
153
  case "vendor-only":
@@ -231,8 +180,8 @@ function resolveProviderProjectPath(provider, projectDir = process.cwd()) {
231
180
  }
232
181
  function resolveProvidersRegistryPath(startDir) {
233
182
  const candidates = [
234
- join2(startDir, "..", "..", "..", "providers", "registry.json"),
235
- join2(startDir, "..", "providers", "registry.json")
183
+ join(startDir, "..", "..", "..", "providers", "registry.json"),
184
+ join(startDir, "..", "providers", "registry.json")
236
185
  ];
237
186
  for (const candidate of candidates) {
238
187
  if (existsSync(candidate)) {
@@ -241,7 +190,7 @@ function resolveProvidersRegistryPath(startDir) {
241
190
  }
242
191
  let current = startDir;
243
192
  for (let i = 0; i < 8; i += 1) {
244
- const candidate = join2(current, "providers", "registry.json");
193
+ const candidate = join(current, "providers", "registry.json");
245
194
  if (existsSync(candidate)) {
246
195
  return candidate;
247
196
  }
@@ -298,4 +247,4 @@ export {
298
247
  resolveProvidersRegistryPath,
299
248
  buildSkillSubPathCandidates
300
249
  };
301
- //# sourceMappingURL=chunk-B5WJ4RDT.js.map
250
+ //# sourceMappingURL=chunk-OCQI7UDH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/platform-paths.ts","../src/core/paths/standard.ts"],"sourcesContent":["/**\n * CAAMP platform-path façade — bound to `(appName='agents', envVar='AGENTS_HOME')`.\n *\n * The shared platform-paths factory now lives in `@cleocode/paths` (the\n * XDG / env-paths SSoT for the CLEO ecosystem). This module re-exposes the\n * factory + types and pre-binds an `agents`-scoped resolver so existing CAAMP\n * consumers keep working unchanged.\n *\n * Platform path defaults (no `AGENTS_HOME` set):\n * data: ~/.local/share/agents | ~/Library/Application Support/agents | %LOCALAPPDATA%\\agents\\Data\n * config: ~/.config/agents | ~/Library/Preferences/agents | %APPDATA%\\agents\\Config\n * cache: ~/.cache/agents | ~/Library/Caches/agents | %LOCALAPPDATA%\\agents\\Cache\n * log: ~/.local/state/agents | ~/Library/Logs/agents | %LOCALAPPDATA%\\agents\\Log\n * temp: /tmp/<user>/agents | /var/folders/.../agents | %TEMP%\\agents\n *\n * `AGENTS_HOME` env var overrides the data path (with tilde expansion).\n *\n * @task T1887\n */\n\nimport {\n createPlatformPathsResolver,\n type PlatformPaths,\n type PlatformPathsResolver,\n type SystemInfo,\n} from '@cleocode/paths';\n\nexport type { PlatformPaths, PlatformPathsResolver, SystemInfo };\nexport { createPlatformPathsResolver };\n\nconst agentsResolver = createPlatformPathsResolver('agents', 'AGENTS_HOME');\n\n/**\n * Get OS-appropriate paths for CAAMP's global directories.\n *\n * Reads fresh on every call (env-paths is microsecond-fast). The\n * `AGENTS_HOME` env var overrides the data path with tilde expansion.\n *\n * @public\n */\nexport function getPlatformPaths(): PlatformPaths {\n return agentsResolver.getPlatformPaths();\n}\n\n/**\n * Get a cached system information snapshot.\n *\n * Captured once and reused for the process lifetime. Includes platform,\n * architecture, hostname, Node version, and resolved paths.\n *\n * @public\n */\nexport function getSystemInfo(): SystemInfo {\n return agentsResolver.getSystemInfo();\n}\n\n/**\n * Invalidate the cached system info snapshot. Use in tests after\n * mutating `AGENTS_HOME`.\n *\n * @internal\n */\nexport function _resetPlatformPathsCache(): void {\n agentsResolver.resetCache();\n}\n","import { existsSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport type { Provider } from '../../types.js';\nimport { getPlatformPaths } from '../platform-paths.js';\n\n/**\n * Scope for path resolution, either global (user home) or project-local.\n *\n * @remarks\n * Global scope resolves paths under the user's home directory (e.g., `~/.agents/`).\n * Project scope resolves paths relative to the project root (e.g., `<project>/.agents/`).\n *\n * @public\n */\nexport type PathScope = 'project' | 'global';\n\n/**\n * Platform-specific directory locations for agent configuration.\n *\n * @remarks\n * Provides resolved paths for the current operating system, accounting for\n * platform differences in config directory locations (XDG on Linux, Library on macOS,\n * AppData on Windows).\n *\n * @public\n */\nexport interface PlatformLocations {\n /** The user's home directory path. */\n home: string;\n /** The platform-specific configuration directory. */\n config: string;\n /** The VS Code user settings directory. */\n vscodeConfig: string;\n /** The Zed editor configuration directory. */\n zedConfig: string;\n /** The Claude Desktop application configuration directory. */\n claudeDesktopConfig: string;\n /** List of application directories (macOS only). */\n applications: string[];\n}\n\n/**\n * Resolves platform-specific directory locations for the current OS.\n *\n * @remarks\n * Detects the current platform and returns appropriate paths for configuration,\n * editor settings, and application directories. Uses `XDG_CONFIG_HOME` on Linux\n * and macOS when available, falls back to conventional defaults. On Windows,\n * uses `APPDATA` or defaults to `~/AppData/Roaming`.\n *\n * @returns Platform-specific directory locations\n *\n * @example\n * ```typescript\n * const locations = getPlatformLocations();\n * console.log(locations.config); // e.g., \"/home/user/.config\"\n * ```\n *\n * @public\n */\nexport function getPlatformLocations(): PlatformLocations {\n const home = homedir();\n const platform = process.platform;\n\n if (platform === 'win32') {\n const appData = process.env['APPDATA'] ?? join(home, 'AppData', 'Roaming');\n return {\n home,\n config: appData,\n vscodeConfig: join(appData, 'Code', 'User'),\n zedConfig: join(appData, 'Zed'),\n claudeDesktopConfig: join(appData, 'Claude'),\n applications: [],\n };\n }\n\n if (platform === 'darwin') {\n const config = process.env['XDG_CONFIG_HOME'] ?? join(home, '.config');\n return {\n home,\n config,\n vscodeConfig: join(home, 'Library', 'Application Support', 'Code', 'User'),\n zedConfig: join(home, 'Library', 'Application Support', 'Zed'),\n claudeDesktopConfig: join(home, 'Library', 'Application Support', 'Claude'),\n applications: ['/Applications', join(home, 'Applications')],\n };\n }\n\n const config = process.env['XDG_CONFIG_HOME'] ?? join(home, '.config');\n return {\n home,\n config,\n vscodeConfig: join(config, 'Code', 'User'),\n zedConfig: join(config, 'zed'),\n claudeDesktopConfig: join(config, 'Claude'),\n applications: [],\n };\n}\n\n/**\n * Returns the global agents home directory path.\n *\n * @remarks\n * Delegates to the platform paths module to resolve the data directory\n * for the current operating system. This is the root for global agent\n * configuration such as canonical skills and lock files.\n *\n * @returns The absolute path to the global agents home directory\n *\n * @example\n * ```typescript\n * const home = getAgentsHome();\n * // e.g., \"/home/user/.local/share/caamp\"\n * ```\n *\n * @public\n */\nexport function getAgentsHome(): string {\n return getPlatformPaths().data;\n}\n\n/**\n * Returns the project-local `.agents` directory path.\n *\n * @remarks\n * Joins the project root with `.agents` to produce the conventional\n * project-scoped agent configuration directory.\n *\n * @param projectRoot - The project root directory, defaults to `process.cwd()`\n * @returns The absolute path to the project's `.agents` directory\n *\n * @example\n * ```typescript\n * const dir = getProjectAgentsDir(\"/home/user/my-project\");\n * // returns \"/home/user/my-project/.agents\"\n * ```\n *\n * @public\n */\nexport function getProjectAgentsDir(projectRoot = process.cwd()): string {\n return join(projectRoot, '.agents');\n}\n\n/**\n * Resolves a relative path against a project directory.\n *\n * @remarks\n * A simple path join utility that combines the project directory with\n * the given relative path to produce an absolute path.\n *\n * @param relativePath - The relative path to resolve\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved absolute path\n *\n * @example\n * ```typescript\n * const path = resolveProjectPath(\".agents/config.toml\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/config.toml\"\n * ```\n *\n * @public\n */\nexport function resolveProjectPath(relativePath: string, projectDir = process.cwd()): string {\n return join(projectDir, relativePath);\n}\n\n/**\n * Returns the canonical skills storage directory path.\n *\n * @remarks\n * Skills are stored once in this canonical directory and symlinked into\n * provider-specific locations. This is the single source of truth for\n * installed skill files.\n *\n * @returns The absolute path to the canonical skills directory\n *\n * @example\n * ```typescript\n * const dir = getCanonicalSkillsDir();\n * // e.g., \"/home/user/.local/share/caamp/skills\"\n * ```\n *\n * @public\n */\nexport function getCanonicalSkillsDir(): string {\n return join(getAgentsHome(), 'skills');\n}\n\n/**\n * Returns the path to the CAAMP lock file.\n *\n * @remarks\n * The lock file tracks installed skills and their versions to enable\n * deterministic reinstallation and conflict detection.\n *\n * @returns The absolute path to the `.caamp-lock.json` file\n *\n * @example\n * ```typescript\n * const lockPath = getLockFilePath();\n * // e.g., \"/home/user/.local/share/caamp/.caamp-lock.json\"\n * ```\n *\n * @public\n */\nexport function getLockFilePath(): string {\n return join(getAgentsHome(), '.caamp-lock.json');\n}\n\n// ── .agents/ Standard Directory Structure ────────────────────────────\n\n/**\n * Gets the MCP directory within the `.agents/` standard structure.\n *\n * @remarks\n * Resolves the MCP configuration directory based on scope. Global scope\n * points to `~/.agents/mcp/`, while project scope points to\n * `<project>/.agents/mcp/`.\n *\n * @param scope - `\"global\"` for `~/.agents/mcp/`, `\"project\"` for `<project>/.agents/mcp/`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the MCP directory\n *\n * @example\n * ```typescript\n * const globalMcp = getAgentsMcpDir(\"global\");\n * const projectMcp = getAgentsMcpDir(\"project\", \"/home/user/project\");\n * ```\n *\n * @public\n */\nexport function getAgentsMcpDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'mcp');\n return join(projectDir ?? process.cwd(), '.agents', 'mcp');\n}\n\n/**\n * Gets the MCP servers.json path within the `.agents/` standard structure.\n *\n * @remarks\n * Per the `.agents/` standard (Section 9), this is the canonical MCP\n * server registry that should be checked before legacy per-provider configs.\n *\n * @param scope - `\"global\"` for `~/.agents/mcp/servers.json`, `\"project\"` for `<project>/.agents/mcp/servers.json`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the `servers.json` file\n *\n * @example\n * ```typescript\n * const serversPath = getAgentsMcpServersPath(\"global\");\n * // e.g., \"/home/user/.agents/mcp/servers.json\"\n * ```\n *\n * @public\n */\nexport function getAgentsMcpServersPath(scope: PathScope = 'global', projectDir?: string): string {\n return join(getAgentsMcpDir(scope, projectDir), 'servers.json');\n}\n\n/**\n * Gets the primary AGENTS.md instruction file path within `.agents/`.\n *\n * @remarks\n * Returns the path to the AGENTS.md file for the given scope. This is the\n * standard instruction file that agents read for project or global guidance.\n *\n * @param scope - `\"global\"` for `~/.agents/AGENTS.md`, `\"project\"` for `<project>/.agents/AGENTS.md`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the AGENTS.md file\n *\n * @example\n * ```typescript\n * const agentsFile = getAgentsInstructFile(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/AGENTS.md\"\n * ```\n *\n * @public\n */\nexport function getAgentsInstructFile(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'AGENTS.md');\n return join(projectDir ?? process.cwd(), '.agents', 'AGENTS.md');\n}\n\n/**\n * Gets the config.toml path within the `.agents/` standard structure.\n *\n * @remarks\n * Returns the path to the TOML configuration file for agent settings.\n * Global scope points to `~/.agents/config.toml`, project scope points\n * to `<project>/.agents/config.toml`.\n *\n * @param scope - `\"global\"` for `~/.agents/config.toml`, `\"project\"` for `<project>/.agents/config.toml`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the config.toml file\n *\n * @example\n * ```typescript\n * const configPath = getAgentsConfigPath(\"global\");\n * // e.g., \"/home/user/.agents/config.toml\"\n * ```\n *\n * @public\n */\nexport function getAgentsConfigPath(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'config.toml');\n return join(projectDir ?? process.cwd(), '.agents', 'config.toml');\n}\n\n/**\n * Gets the wiki directory within the `.agents/` standard structure.\n *\n * @remarks\n * The wiki directory stores markdown documentation files that agents\n * can reference for project or global knowledge.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the wiki directory\n *\n * @example\n * ```typescript\n * const wikiDir = getAgentsWikiDir(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/wiki\"\n * ```\n *\n * @public\n */\nexport function getAgentsWikiDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'wiki');\n return join(projectDir ?? process.cwd(), '.agents', 'wiki');\n}\n\n/**\n * Gets the spec directory within the `.agents/` standard structure.\n *\n * @remarks\n * The spec directory stores specification files used by agents for\n * project architecture and design reference.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the spec directory\n *\n * @example\n * ```typescript\n * const specDir = getAgentsSpecDir(\"global\");\n * // e.g., \"/home/user/.agents/spec\"\n * ```\n *\n * @public\n */\nexport function getAgentsSpecDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'spec');\n return join(projectDir ?? process.cwd(), '.agents', 'spec');\n}\n\n/**\n * Gets the links directory within the `.agents/` standard structure.\n *\n * @remarks\n * The links directory stores symlinks or references to external resources\n * that agents can follow for additional context.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the links directory\n *\n * @example\n * ```typescript\n * const linksDir = getAgentsLinksDir(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/links\"\n * ```\n *\n * @public\n */\nexport function getAgentsLinksDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'links');\n return join(projectDir ?? process.cwd(), '.agents', 'links');\n}\n\n/**\n * Resolve the CLEO home directory for template path expansion.\n *\n * @remarks\n * Honors the `CLEO_HOME` environment variable when set. Otherwise falls\n * back to a platform-appropriate data directory for the `cleo` app name\n * (e.g. `~/.local/share/cleo` on Linux, `~/Library/Application Support/cleo`\n * on macOS, `%LOCALAPPDATA%\\cleo\\Data` on Windows). This mirrors the\n * resolution strategy used by the `@cleocode/core` package's `getCleoHome`\n * helper but is duplicated here to avoid a cross-package runtime dependency.\n *\n * @internal\n */\nfunction getCleoHomeForTemplate(): string {\n const envOverride = process.env['CLEO_HOME'];\n if (envOverride && envOverride.trim().length > 0) {\n return envOverride.trim();\n }\n const home = getPlatformLocations().home;\n if (process.platform === 'win32') {\n const localAppData = process.env['LOCALAPPDATA'] ?? join(home, 'AppData', 'Local');\n return join(localAppData, 'cleo', 'Data');\n }\n if (process.platform === 'darwin') {\n return join(home, 'Library', 'Application Support', 'cleo');\n }\n const xdgData = process.env['XDG_DATA_HOME'] ?? join(home, '.local', 'share');\n return join(xdgData, 'cleo');\n}\n\n/**\n * Resolves a registry template path by substituting platform variables.\n *\n * @remarks\n * Replaces template variables like `$HOME`, `$CONFIG`, `$VSCODE_CONFIG`,\n * `$ZED_CONFIG`, `$CLAUDE_DESKTOP_CONFIG`, `$AGENTS_HOME`, and `$CLEO_HOME`\n * with their actual platform-specific values. Used to resolve paths from\n * the provider registry JSON.\n *\n * @param template - The template string containing `$VARIABLE` placeholders\n * @returns The resolved absolute path with all variables expanded\n *\n * @example\n * ```typescript\n * const path = resolveRegistryTemplatePath(\"$HOME/.config/claude/settings.json\");\n * // e.g., \"/home/user/.config/claude/settings.json\"\n * ```\n *\n * @public\n */\nexport function resolveRegistryTemplatePath(template: string): string {\n const locations = getPlatformLocations();\n return template\n .replace(/\\$HOME/g, locations.home)\n .replace(/\\$CONFIG/g, locations.config)\n .replace(/\\$VSCODE_CONFIG/g, locations.vscodeConfig)\n .replace(/\\$ZED_CONFIG/g, locations.zedConfig)\n .replace(/\\$CLAUDE_DESKTOP_CONFIG/g, locations.claudeDesktopConfig)\n .replace(/\\$AGENTS_HOME/g, getAgentsHome())\n .replace(/\\$CLEO_HOME/g, getCleoHomeForTemplate());\n}\n\n/**\n * Resolves the configuration file path for a provider at the given scope.\n *\n * @remarks\n * For global scope, returns the provider's `configPathGlobal` directly.\n * For project scope, joins the project directory with the provider's\n * `configPathProject`. Returns null if the provider has no project-scoped\n * config path defined.\n *\n * @param provider - The provider whose config path to resolve\n * @param scope - Whether to resolve global or project config path\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved config file path, or null if unavailable for the given scope\n *\n * @example\n * ```typescript\n * const configPath = resolveProviderConfigPath(provider, \"project\", \"/home/user/project\");\n * if (configPath) {\n * console.log(\"Config at:\", configPath);\n * }\n * ```\n *\n * @public\n */\nexport function resolveProviderConfigPath(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string | null {\n const mcp = provider.capabilities.mcp;\n if (!mcp) {\n return null;\n }\n if (scope === 'global') {\n return mcp.configPathGlobal;\n }\n if (!mcp.configPathProject) {\n return null;\n }\n return resolveProjectPath(mcp.configPathProject, projectDir);\n}\n\n/**\n * Determines the preferred configuration scope for a provider.\n *\n * @remarks\n * If the global flag is explicitly set, always returns `\"global\"`. Otherwise,\n * returns `\"project\"` if the provider supports project-scoped configuration,\n * or `\"global\"` as a fallback.\n *\n * @param provider - The provider to determine scope for\n * @param useGlobalFlag - Optional flag to force global scope\n * @returns The preferred path scope for configuration\n *\n * @example\n * ```typescript\n * const scope = resolvePreferredConfigScope(provider, false);\n * // returns \"project\" if provider has configPathProject, otherwise \"global\"\n * ```\n *\n * @public\n */\nexport function resolvePreferredConfigScope(\n provider: Provider,\n useGlobalFlag?: boolean,\n): PathScope {\n if (useGlobalFlag) {\n return 'global';\n }\n return provider.capabilities.mcp?.configPathProject ? 'project' : 'global';\n}\n\n/**\n * Resolves the skills directory path for a provider at the given scope.\n *\n * @remarks\n * For global scope, returns the provider's `pathSkills` directly.\n * For project scope, joins the project directory with the provider's\n * `pathProjectSkills` relative path.\n *\n * @param provider - The provider whose skills directory to resolve\n * @param scope - Whether to resolve global or project skills path\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved skills directory path\n *\n * @example\n * ```typescript\n * const skillsDir = resolveProviderSkillsDir(provider, \"global\");\n * // e.g., \"/home/user/.claude/skills\"\n * ```\n *\n * @public\n */\nexport function resolveProviderSkillsDir(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string {\n if (scope === 'global') {\n return provider.pathSkills;\n }\n return resolveProjectPath(provider.pathProjectSkills, projectDir);\n}\n\n/**\n * Gets all target directories for skill installation based on provider precedence.\n *\n * @remarks\n * Resolves one or more skill directories based on the provider's skills\n * precedence setting. The precedence determines whether vendor-only, agents-canonical,\n * agents-first, agents-supported, or vendor-global-agents-project strategies are used.\n * Falls back to the vendor path when the agents path is not configured.\n *\n * @param provider - Provider to resolve paths for\n * @param scope - Whether to resolve global or project paths\n * @param projectDir - Project directory for project-scope resolution\n * @returns Array of target directories for symlink creation\n *\n * @example\n * ```typescript\n * const dirs = resolveProviderSkillsDirs(provider, \"project\", \"/home/user/project\");\n * for (const dir of dirs) {\n * console.log(\"Install skill to:\", dir);\n * }\n * ```\n *\n * @public\n */\nexport function resolveProviderSkillsDirs(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string[] {\n const vendorPath = resolveProviderSkillsDir(provider, scope, projectDir);\n const precedence = provider.capabilities?.skills?.precedence ?? 'vendor-only';\n\n const resolveAgentsPath = (): string | null => {\n if (scope === 'global') {\n return provider.capabilities?.skills?.agentsGlobalPath ?? null;\n }\n const projectRelative = provider.capabilities?.skills?.agentsProjectPath ?? null;\n return projectRelative ? join(projectDir, projectRelative) : null;\n };\n\n switch (precedence) {\n case 'vendor-only':\n return [vendorPath];\n\n case 'agents-canonical': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath] : [vendorPath];\n }\n\n case 'agents-first': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath, vendorPath] : [vendorPath];\n }\n\n case 'agents-supported': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [vendorPath, agentsPath] : [vendorPath];\n }\n\n case 'vendor-global-agents-project': {\n if (scope === 'global') {\n return [vendorPath];\n }\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath, vendorPath] : [vendorPath];\n }\n\n default:\n return [vendorPath];\n }\n}\n\n/**\n * Resolves a provider's project-level path against a project directory.\n *\n * @remarks\n * Joins the project directory with the provider's `pathProject` relative path\n * to produce an absolute path for project-scoped provider configuration.\n *\n * @param provider - The provider whose project path to resolve\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved absolute path for the provider's project directory\n *\n * @example\n * ```typescript\n * const projectPath = resolveProviderProjectPath(provider, \"/home/user/project\");\n * // e.g., \"/home/user/project/.claude\"\n * ```\n *\n * @public\n */\nexport function resolveProviderProjectPath(provider: Provider, projectDir = process.cwd()): string {\n return resolveProjectPath(provider.pathProject, projectDir);\n}\n\n/**\n * Locates the providers registry.json file by searching up from a start directory.\n *\n * @remarks\n * First checks common relative locations (3 levels up and 1 level up),\n * then walks up to 8 parent directories looking for `providers/registry.json`.\n * Throws if the registry file cannot be found.\n *\n * @param startDir - The directory to start searching from\n * @returns The absolute path to the found `providers/registry.json` file\n * @throws Error if `providers/registry.json` cannot be found within 8 parent levels\n *\n * @example\n * ```typescript\n * const registryPath = resolveProvidersRegistryPath(__dirname);\n * // e.g., \"/home/user/caamp/providers/registry.json\"\n * ```\n *\n * @public\n */\nexport function resolveProvidersRegistryPath(startDir: string): string {\n const candidates = [\n join(startDir, '..', '..', '..', 'providers', 'registry.json'),\n join(startDir, '..', 'providers', 'registry.json'),\n ];\n\n for (const candidate of candidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n let current = startDir;\n for (let i = 0; i < 8; i += 1) {\n const candidate = join(current, 'providers', 'registry.json');\n if (existsSync(candidate)) {\n return candidate;\n }\n current = dirname(current);\n }\n\n throw new Error(`Cannot find providers/registry.json (searched from ${startDir})`);\n}\n\n/**\n * Normalizes a skill sub-path by cleaning separators and removing SKILL.md suffix.\n *\n * @remarks\n * Converts backslashes to forward slashes, strips leading slashes and\n * trailing `/SKILL.md`, and trims whitespace. Returns undefined for\n * empty or falsy inputs.\n *\n * @param path - The raw skill sub-path to normalize\n * @returns The normalized path, or undefined if the input is empty or falsy\n *\n * @example\n * ```typescript\n * const normalized = normalizeSkillSubPath(\"skills/my-skill/SKILL.md\");\n * // returns \"skills/my-skill\"\n * ```\n *\n * @public\n */\nexport function normalizeSkillSubPath(path: string | undefined): string | undefined {\n if (!path) return undefined;\n const normalized = path\n .replace(/\\\\/g, '/')\n .replace(/^\\/+/, '')\n .replace(/\\/SKILL\\.md$/i, '')\n .trim();\n return normalized.length > 0 ? normalized : undefined;\n}\n\n/**\n * Builds a list of candidate sub-paths for skill file resolution.\n *\n * @remarks\n * Normalizes both the marketplace and parsed paths, then generates additional\n * candidates by prepending known prefixes (`.agents`, `.claude`) to paths\n * starting with `skills/`. Returns a deduplicated list of candidates, with\n * an undefined entry as fallback if no candidates are found.\n *\n * @param marketplacePath - The sub-path from the marketplace listing\n * @param parsedPath - The sub-path parsed from the source URL\n * @returns A deduplicated array of candidate sub-paths\n *\n * @example\n * ```typescript\n * const candidates = buildSkillSubPathCandidates(\"skills/my-skill\", undefined);\n * // returns [\"skills/my-skill\", \".agents/skills/my-skill\", \".claude/skills/my-skill\"]\n * ```\n *\n * @public\n */\nexport function buildSkillSubPathCandidates(\n marketplacePath: string | undefined,\n parsedPath: string | undefined,\n): (string | undefined)[] {\n const candidates: (string | undefined)[] = [];\n const base = normalizeSkillSubPath(marketplacePath);\n const parsed = normalizeSkillSubPath(parsedPath);\n\n if (base) candidates.push(base);\n if (parsed) candidates.push(parsed);\n\n const knownPrefixes = ['.agents', '.claude'];\n for (const value of [base, parsed]) {\n if (!value?.startsWith('skills/')) continue;\n for (const prefix of knownPrefixes) {\n candidates.push(`${prefix}/${value}`);\n }\n }\n\n if (candidates.length === 0) {\n candidates.push(undefined);\n }\n\n return Array.from(new Set(candidates));\n}\n"],"mappings":";;;;;;;AAoBA;AAAA,EACE;AAAA,OAIK;AAKP,IAAM,iBAAiB,4BAA4B,UAAU,aAAa;AAUnE,SAAS,mBAAkC;AAChD,SAAO,eAAe,iBAAiB;AACzC;AAUO,SAAS,gBAA4B;AAC1C,SAAO,eAAe,cAAc;AACtC;AAQO,SAAS,2BAAiC;AAC/C,iBAAe,WAAW;AAC5B;;;ACh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
3
  resolveProvidersRegistryPath,
4
4
  resolveRegistryTemplatePath
5
- } from "./chunk-B5WJ4RDT.js";
5
+ } from "./chunk-OCQI7UDH.js";
6
6
 
7
7
  // src/core/instructions/injector.ts
8
8
  import { existsSync } from "fs";
@@ -582,4 +582,4 @@ export {
582
582
  getProviderAgentFolder,
583
583
  writeAgentFileToAllProviders
584
584
  };
585
- //# sourceMappingURL=chunk-QUVY4LG4.js.map
585
+ //# sourceMappingURL=chunk-YXWL2IXL.js.map
package/dist/cli.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  tokenizeCriteriaValue,
53
53
  updateInstructionsSingleOperation,
54
54
  validateSkill
55
- } from "./chunk-S3PLNL6K.js";
55
+ } from "./chunk-HFC3WUME.js";
56
56
  import {
57
57
  buildSkillsMap,
58
58
  checkAllInjections,
@@ -65,7 +65,7 @@ import {
65
65
  groupByInstructFile,
66
66
  injectAll,
67
67
  providerSupports
68
- } from "./chunk-QUVY4LG4.js";
68
+ } from "./chunk-YXWL2IXL.js";
69
69
  import {
70
70
  CANONICAL_HOOK_EVENTS,
71
71
  buildHookMatrix,
@@ -74,12 +74,12 @@ import {
74
74
  getHookSupport,
75
75
  getProviderSummary,
76
76
  translateToAll
77
- } from "./chunk-UZSGHMYW.js";
77
+ } from "./chunk-GDEIR34D.js";
78
78
  import {
79
79
  buildSkillSubPathCandidates,
80
80
  resolveProviderConfigPath,
81
81
  resolveProviderSkillsDir
82
- } from "./chunk-B5WJ4RDT.js";
82
+ } from "./chunk-OCQI7UDH.js";
83
83
 
84
84
  // src/cli.ts
85
85
  import { Command } from "commander";
@@ -3349,7 +3349,7 @@ CAMP Hook Support (mappings v${getHookMappingsVersion()})
3349
3349
  return;
3350
3350
  }
3351
3351
  if (opts.from) {
3352
- const { toCanonical } = await import("./hooks-4MLYUJJL.js");
3352
+ const { toCanonical } = await import("./hooks-WZ3MTLQF.js");
3353
3353
  const canonical2 = toCanonical(event, opts.from);
3354
3354
  if (format === "json") {
3355
3355
  const envelope = buildEnvelope2(
@@ -3389,7 +3389,7 @@ CAMP Hook Support (mappings v${getHookMappingsVersion()})
3389
3389
  }
3390
3390
  process.exit(1);
3391
3391
  }
3392
- const { getMappedProviderIds } = await import("./hooks-4MLYUJJL.js");
3392
+ const { getMappedProviderIds } = await import("./hooks-WZ3MTLQF.js");
3393
3393
  const allIds = getMappedProviderIds();
3394
3394
  const translations = translateToAll(canonical, allIds);
3395
3395
  if (format === "json") {
@@ -24,8 +24,8 @@ import {
24
24
  toNative,
25
25
  toNativeBatch,
26
26
  translateToAll
27
- } from "./chunk-UZSGHMYW.js";
28
- import "./chunk-B5WJ4RDT.js";
27
+ } from "./chunk-GDEIR34D.js";
28
+ import "./chunk-OCQI7UDH.js";
29
29
  export {
30
30
  CANONICAL_HOOK_EVENTS,
31
31
  HOOK_CATEGORIES,
@@ -53,4 +53,4 @@ export {
53
53
  toNativeBatch,
54
54
  translateToAll
55
55
  };
56
- //# sourceMappingURL=hooks-4MLYUJJL.js.map
56
+ //# sourceMappingURL=hooks-WZ3MTLQF.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { WorktreeHandle } from '@cleocode/cant';
2
+ import { PlatformPaths, SystemInfo } from '@cleocode/paths';
3
+ export { PlatformPaths, SystemInfo } from '@cleocode/paths';
2
4
 
3
5
  /**
4
6
  * Priority tier identifier stored in registry.json.
@@ -5742,84 +5744,30 @@ declare function resolveRegistryTemplatePath(template: string): string;
5742
5744
  declare function resolveProviderSkillsDirs(provider: Provider, scope: PathScope, projectDir?: string): string[];
5743
5745
 
5744
5746
  /**
5745
- * Central OS platform path resolution using env-paths.
5747
+ * CAAMP platform-path façade bound to `(appName='agents', envVar='AGENTS_HOME')`.
5746
5748
  *
5747
- * Provides OS-appropriate paths for CAAMP's global directories using
5748
- * XDG conventions on Linux, standard conventions on macOS/Windows.
5749
- * Results are cached for the process lifetime. Env vars take precedence.
5749
+ * The shared platform-paths factory now lives in `@cleocode/paths` (the
5750
+ * XDG / env-paths SSoT for the CLEO ecosystem). This module re-exposes the
5751
+ * factory + types and pre-binds an `agents`-scoped resolver so existing CAAMP
5752
+ * consumers keep working unchanged.
5750
5753
  *
5751
- * Platform path defaults:
5754
+ * Platform path defaults (no `AGENTS_HOME` set):
5752
5755
  * data: ~/.local/share/agents | ~/Library/Application Support/agents | %LOCALAPPDATA%\agents\Data
5753
5756
  * config: ~/.config/agents | ~/Library/Preferences/agents | %APPDATA%\agents\Config
5754
5757
  * cache: ~/.cache/agents | ~/Library/Caches/agents | %LOCALAPPDATA%\agents\Cache
5755
5758
  * log: ~/.local/state/agents | ~/Library/Logs/agents | %LOCALAPPDATA%\agents\Log
5756
5759
  * temp: /tmp/<user>/agents | /var/folders/.../agents | %TEMP%\agents
5757
5760
  *
5758
- * AGENTS_HOME env var overrides the data path for backward compatibility
5759
- * with existing ~/.agents installations.
5761
+ * `AGENTS_HOME` env var overrides the data path (with tilde expansion).
5760
5762
  *
5761
- * @remarks
5762
- * Dependency note: `@cleocode/core` depends on `@cleocode/caamp`, so this
5763
- * module intentionally does NOT import from `@cleocode/core` to avoid a
5764
- * circular dependency. The shared env-paths wrapper pattern is factored into
5765
- * {@link createPlatformPathsResolver} below, which can be reused by callers
5766
- * that need a different app name / home env-var without duplicating logic.
5767
- */
5768
- /**
5769
- * OS-appropriate directory paths for a global agent tool.
5770
- *
5771
- * @public
5772
- */
5773
- interface PlatformPaths {
5774
- /** User data dir. Override with the configured home env var. */
5775
- data: string;
5776
- /** OS config dir (XDG_CONFIG_HOME / Library/Preferences / %APPDATA%). */
5777
- config: string;
5778
- /** OS cache dir. */
5779
- cache: string;
5780
- /** OS log dir. */
5781
- log: string;
5782
- /** OS temp dir. */
5783
- temp: string;
5784
- }
5785
- /**
5786
- * Snapshot of the current system environment and resolved platform paths.
5787
- *
5788
- * @public
5763
+ * @task T1887
5789
5764
  */
5790
- interface SystemInfo {
5791
- /** Operating system platform identifier. */
5792
- platform: NodeJS.Platform;
5793
- /** CPU architecture (e.g. `"x64"`, `"arm64"`). */
5794
- arch: string;
5795
- /** OS kernel release version string. */
5796
- release: string;
5797
- /** Machine hostname. */
5798
- hostname: string;
5799
- /** Node.js version string (e.g. `"v20.11.0"`). */
5800
- nodeVersion: string;
5801
- /** Resolved platform directory paths. */
5802
- paths: PlatformPaths;
5803
- }
5765
+
5804
5766
  /**
5805
5767
  * Get OS-appropriate paths for CAAMP's global directories.
5806
5768
  *
5807
- * @remarks
5808
- * Cached after first call. The `AGENTS_HOME` env var overrides the data path
5809
- * for backward compatibility with existing `~/.agents` installations. The
5810
- * cache auto-invalidates when `AGENTS_HOME` changes (supports test isolation).
5811
- *
5812
- * Delegates to an internal {@link PlatformPathsResolver} created by
5813
- * {@link createPlatformPathsResolver}. To resolve paths for a different app
5814
- * use that factory directly.
5815
- *
5816
- * @returns Resolved platform paths
5817
- *
5818
- * @example
5819
- * ```typescript
5820
- * const paths = getPlatformPaths();
5821
- * console.log(paths.data); // e.g. "/home/user/.local/share/agents"
5822
- * ```
5769
+ * Reads fresh on every call (env-paths is microsecond-fast). The
5770
+ * `AGENTS_HOME` env var overrides the data path with tilde expansion.
5823
5771
  *
5824
5772
  * @public
5825
5773
  */
@@ -5827,24 +5775,16 @@ declare function getPlatformPaths(): PlatformPaths;
5827
5775
  /**
5828
5776
  * Get a cached system information snapshot.
5829
5777
  *
5830
- * @remarks
5831
5778
  * Captured once and reused for the process lifetime. Includes platform,
5832
5779
  * architecture, hostname, Node version, and resolved paths.
5833
5780
  *
5834
- * @returns Cached system info object
5835
- *
5836
- * @example
5837
- * ```typescript
5838
- * const info = getSystemInfo();
5839
- * console.log(`Running on ${info.platform}/${info.arch}`);
5840
- * ```
5841
- *
5842
5781
  * @public
5843
5782
  */
5844
5783
  declare function getSystemInfo(): SystemInfo;
5845
5784
  /**
5846
- * Invalidate the path and system info caches.
5847
- * Use in tests after mutating AGENTS_HOME env var.
5785
+ * Invalidate the cached system info snapshot. Use in tests after
5786
+ * mutating `AGENTS_HOME`.
5787
+ *
5848
5788
  * @internal
5849
5789
  */
5850
5790
  declare function _resetPlatformPathsCache(): void;
@@ -8249,4 +8189,4 @@ declare function parseSource(input: string): ParsedSource;
8249
8189
  */
8250
8190
  declare function isMarketplaceScoped(input: string): boolean;
8251
8191
 
8252
- export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, CANONICAL_HOOK_EVENTS, type CaampLockFile, type CanonicalEventDefinition, type CanonicalHookEvent, type CantProfileCounts, type CantProfileEntry, type CantValidationDiagnostic, type ConfigFormat, type CrossProviderMatrix, type CtDispatchMatrix, type CtManifest, type CtManifestSkill, type CtProfileDefinition, type CtSkillEntry, type CtValidationIssue, type CtValidationResult, DEFAULT_EXCLUSIVITY_MODE, type DetectionCacheOptions, type DetectionResult, EXCLUSIVITY_MODE_ENV_VAR, type EnsureProviderInstructionFileOptions, type EnsureProviderInstructionFileResult, type ExclusivityMode, type GlobalOptions, HOOK_CATEGORIES, type Harness, type HarnessScope, type HookCategory, type HookEvent, type HookHandlerType, type HookMapping, type HookSupportResult, type HookSystemType, type InjectionCheckResult, type InjectionStatus, type InjectionTemplate, type InstallMcpServerOptions, type InstallMcpServerResult, type InstructionUpdateSummary, type KnownProviderAgentFolderId, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpConfigFormat, type McpDetectionEntry, type McpScope, type McpServerConfig, type McpServerEntriesByProvider, type McpServerEntry, type McpTransportType, type NormalizedHookEvent, type NormalizedRecommendationCriteria, type ParsedSource, PiHarness, PiRequiredError, type PlatformPaths, type Provider, type ProviderCapabilities, type ProviderHarnessCapability, type ProviderHookProfile, type ProviderHookSummary, type ProviderHooksCapability, type ProviderMcpCapability, type ProviderPriority, type ProviderSkillsCapability, type ProviderSpawnCapability, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type RegistryHarnessKind, type RegistryHookCatalog, type RegistryHookFormat, type RemoveMcpServerOptions, type RemoveMcpServerResult, type ResolveDefaultTargetProvidersOptions, type SkillBatchOperation, type SkillEntry, type SkillInstallResult, type SkillIntegrityResult, type SkillIntegrityStatus, type SkillLibrary, type SkillLibraryDispatchMatrix, type SkillLibraryEntry, type SkillLibraryManifest, type SkillLibraryManifestSkill, type SkillLibraryProfile, type SkillLibraryValidationIssue, type SkillLibraryValidationResult, type SkillMetadata, type SkillsPrecedence, type SourceType, type SpawnAdapter, type SpawnMechanism, type SpawnOptions, type SpawnResult, type SubagentHandle, type SubagentResult, type SubagentTask, type SystemInfo, type TransportType, type ValidateCantProfileResult, type ValidationIssue, type ValidationResult, type WriteAgentFileOptions, type WriteAgentFileResult, _resetPlatformPathsCache, buildHookMatrix, buildInjectionContent, buildLibraryFromFiles, buildSkillsMap, catalog, checkAllInjections, checkAllSkillIntegrity, checkAllSkillUpdates, checkInjection, checkSkillIntegrity, checkSkillUpdate, clearRegisteredLibrary, deepMerge, detectAllProviders, detectMcpInstallations, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureAllProviderInstructionFiles, ensureDir, ensureProviderInstructionFile, formatSkillRecommendations, generateInjectionContent, generateSkillsSection, getAgentsConfigPath, getAgentsHome, getAgentsInstructFile, getAgentsLinksDir, getAgentsMcpDir, getAgentsMcpServersPath, getAgentsSpecDir, getAgentsWikiDir, getAllCanonicalEvents, getAllHarnesses, getAllProviders, getCanonicalEvent, getCanonicalEventsByCategory, getCanonicalSkillsDir, getCommonEvents, getCommonHookEvents, getEffectiveSkillsPaths, getExclusivityMode, getHarnessFor, getHookConfigPath, getHookMappingsVersion, getHookSupport, getHookSystemType, getInstalledProviders, getInstructionFiles, getLockFilePath, getMappedProviderIds, getNestedValue, getPlatformLocations, getPlatformPaths, getPrimaryHarness, getPrimaryProvider, getProjectAgentsDir, getProvider, getProviderAgentFolder, getProviderCapabilities, getProviderCount, getProviderHookProfile, getProviderOnlyEvents, getProviderSummary, getProvidersByHookEvent, getProvidersByInstructFile, getProvidersByPriority, getProvidersBySkillsPrecedence, getProvidersBySpawnCapability, getProvidersByStatus, getProvidersForEvent, getRegistryVersion, getSpawnCapableProviders, getSupportedEvents, getSystemInfo, getTrackedSkills, getUnsupportedEvents, groupByInstructFile, inject, injectAll, installBatchWithRollback, installMcpServer, installSkill, isCaampOwnedSkill, isExclusivityMode, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, loadLibraryFromModule, normalizeRecommendationCriteria, parseInjectionContent, parseSkillFile, parseSource, providerSupports, providerSupportsById, rankSkills, readConfig, recommendSkills, recordSkillInstall, registerSkillLibrary, registerSkillLibraryFromPath, removeConfig, removeInjection, removeMcpServer, removeMcpServerFromAll, removeSkill, removeSkillFromLock, resetDetectionCache, resetExclusivityModeOverride, resolveAlias, resolveDefaultTargetProviders, resolveMcpConfigPath, resolveNativeEvent, resolveProviderSkillsDirs, resolveRegistryTemplatePath, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setExclusivityMode, setQuiet, setVerbose, shouldOverrideSkill, supportsHook, toCanonical, toNative, toNativeBatch, toSarif, tokenizeCriteriaValue, translateToAll, updateInstructionsSingleOperation, validateInstructionIntegrity, validateRecommendationCriteria, validateSkill, writeAgentFileToAllProviders, writeConfig };
8192
+ export { type AuditFinding, type AuditResult, type AuditRule, type AuditSeverity, type BatchInstallOptions, type BatchInstallResult, CANONICAL_HOOK_EVENTS, type CaampLockFile, type CanonicalEventDefinition, type CanonicalHookEvent, type CantProfileCounts, type CantProfileEntry, type CantValidationDiagnostic, type ConfigFormat, type CrossProviderMatrix, type CtDispatchMatrix, type CtManifest, type CtManifestSkill, type CtProfileDefinition, type CtSkillEntry, type CtValidationIssue, type CtValidationResult, DEFAULT_EXCLUSIVITY_MODE, type DetectionCacheOptions, type DetectionResult, EXCLUSIVITY_MODE_ENV_VAR, type EnsureProviderInstructionFileOptions, type EnsureProviderInstructionFileResult, type ExclusivityMode, type GlobalOptions, HOOK_CATEGORIES, type Harness, type HarnessScope, type HookCategory, type HookEvent, type HookHandlerType, type HookMapping, type HookSupportResult, type HookSystemType, type InjectionCheckResult, type InjectionStatus, type InjectionTemplate, type InstallMcpServerOptions, type InstallMcpServerResult, type InstructionUpdateSummary, type KnownProviderAgentFolderId, type LockEntry, MarketplaceClient, type MarketplaceResult, type MarketplaceSearchResult, type MarketplaceSkill, type McpConfigFormat, type McpDetectionEntry, type McpScope, type McpServerConfig, type McpServerEntriesByProvider, type McpServerEntry, type McpTransportType, type NormalizedHookEvent, type NormalizedRecommendationCriteria, type ParsedSource, PiHarness, PiRequiredError, type Provider, type ProviderCapabilities, type ProviderHarnessCapability, type ProviderHookProfile, type ProviderHookSummary, type ProviderHooksCapability, type ProviderMcpCapability, type ProviderPriority, type ProviderSkillsCapability, type ProviderSpawnCapability, type ProviderStatus, RECOMMENDATION_ERROR_CODES, type RankedSkillRecommendation, type RecommendSkillsResult, type RecommendationCriteriaInput, type RecommendationErrorCode, type RecommendationOptions, type RecommendationReason, type RecommendationReasonCode, type RecommendationScoreBreakdown, type RecommendationValidationIssue, type RecommendationValidationResult, type RecommendationWeights, type RegistryHarnessKind, type RegistryHookCatalog, type RegistryHookFormat, type RemoveMcpServerOptions, type RemoveMcpServerResult, type ResolveDefaultTargetProvidersOptions, type SkillBatchOperation, type SkillEntry, type SkillInstallResult, type SkillIntegrityResult, type SkillIntegrityStatus, type SkillLibrary, type SkillLibraryDispatchMatrix, type SkillLibraryEntry, type SkillLibraryManifest, type SkillLibraryManifestSkill, type SkillLibraryProfile, type SkillLibraryValidationIssue, type SkillLibraryValidationResult, type SkillMetadata, type SkillsPrecedence, type SourceType, type SpawnAdapter, type SpawnMechanism, type SpawnOptions, type SpawnResult, type SubagentHandle, type SubagentResult, type SubagentTask, type TransportType, type ValidateCantProfileResult, type ValidationIssue, type ValidationResult, type WriteAgentFileOptions, type WriteAgentFileResult, _resetPlatformPathsCache, buildHookMatrix, buildInjectionContent, buildLibraryFromFiles, buildSkillsMap, catalog, checkAllInjections, checkAllSkillIntegrity, checkAllSkillUpdates, checkInjection, checkSkillIntegrity, checkSkillUpdate, clearRegisteredLibrary, deepMerge, detectAllProviders, detectMcpInstallations, detectProjectProviders, detectProvider, discoverSkill, discoverSkills, ensureAllProviderInstructionFiles, ensureDir, ensureProviderInstructionFile, formatSkillRecommendations, generateInjectionContent, generateSkillsSection, getAgentsConfigPath, getAgentsHome, getAgentsInstructFile, getAgentsLinksDir, getAgentsMcpDir, getAgentsMcpServersPath, getAgentsSpecDir, getAgentsWikiDir, getAllCanonicalEvents, getAllHarnesses, getAllProviders, getCanonicalEvent, getCanonicalEventsByCategory, getCanonicalSkillsDir, getCommonEvents, getCommonHookEvents, getEffectiveSkillsPaths, getExclusivityMode, getHarnessFor, getHookConfigPath, getHookMappingsVersion, getHookSupport, getHookSystemType, getInstalledProviders, getInstructionFiles, getLockFilePath, getMappedProviderIds, getNestedValue, getPlatformLocations, getPlatformPaths, getPrimaryHarness, getPrimaryProvider, getProjectAgentsDir, getProvider, getProviderAgentFolder, getProviderCapabilities, getProviderCount, getProviderHookProfile, getProviderOnlyEvents, getProviderSummary, getProvidersByHookEvent, getProvidersByInstructFile, getProvidersByPriority, getProvidersBySkillsPrecedence, getProvidersBySpawnCapability, getProvidersByStatus, getProvidersForEvent, getRegistryVersion, getSpawnCapableProviders, getSupportedEvents, getSystemInfo, getTrackedSkills, getUnsupportedEvents, groupByInstructFile, inject, injectAll, installBatchWithRollback, installMcpServer, installSkill, isCaampOwnedSkill, isExclusivityMode, isMarketplaceScoped, isQuiet, isVerbose, listAllMcpServers, listCanonicalSkills, listMcpServers, loadLibraryFromModule, normalizeRecommendationCriteria, parseInjectionContent, parseSkillFile, parseSource, providerSupports, providerSupportsById, rankSkills, readConfig, recommendSkills, recordSkillInstall, registerSkillLibrary, registerSkillLibraryFromPath, removeConfig, removeInjection, removeMcpServer, removeMcpServerFromAll, removeSkill, removeSkillFromLock, resetDetectionCache, resetExclusivityModeOverride, resolveAlias, resolveDefaultTargetProviders, resolveMcpConfigPath, resolveNativeEvent, resolveProviderSkillsDirs, resolveRegistryTemplatePath, scanDirectory, scanFile, scoreSkillRecommendation, searchSkills, selectProvidersByMinimumPriority, setExclusivityMode, setQuiet, setVerbose, shouldOverrideSkill, supportsHook, toCanonical, toNative, toNativeBatch, toSarif, tokenizeCriteriaValue, translateToAll, updateInstructionsSingleOperation, validateInstructionIntegrity, validateRecommendationCriteria, validateSkill, writeAgentFileToAllProviders, writeConfig };
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ import {
70
70
  validateRecommendationCriteria,
71
71
  validateSkill,
72
72
  writeConfig
73
- } from "./chunk-S3PLNL6K.js";
73
+ } from "./chunk-HFC3WUME.js";
74
74
  import {
75
75
  buildInjectionContent,
76
76
  buildSkillsMap,
@@ -106,7 +106,7 @@ import {
106
106
  removeInjection,
107
107
  resolveAlias,
108
108
  writeAgentFileToAllProviders
109
- } from "./chunk-QUVY4LG4.js";
109
+ } from "./chunk-YXWL2IXL.js";
110
110
  import {
111
111
  CANONICAL_HOOK_EVENTS,
112
112
  HOOK_CATEGORIES,
@@ -132,7 +132,7 @@ import {
132
132
  toNative,
133
133
  toNativeBatch,
134
134
  translateToAll
135
- } from "./chunk-UZSGHMYW.js";
135
+ } from "./chunk-GDEIR34D.js";
136
136
  import {
137
137
  _resetPlatformPathsCache,
138
138
  getAgentsConfigPath,
@@ -151,7 +151,7 @@ import {
151
151
  getSystemInfo,
152
152
  resolveProviderSkillsDirs,
153
153
  resolveRegistryTemplatePath
154
- } from "./chunk-B5WJ4RDT.js";
154
+ } from "./chunk-OCQI7UDH.js";
155
155
 
156
156
  // src/core/skills/integrity.ts
157
157
  import { existsSync, lstatSync, readlinkSync } from "fs";
@@ -269,7 +269,7 @@ function shouldOverrideSkill(skillName, incomingSource, existingEntry) {
269
269
  return true;
270
270
  }
271
271
  async function validateInstructionIntegrity(providers, projectDir, scope, expectedContent) {
272
- const { checkAllInjections: checkAllInjections2 } = await import("./injector-SMCEHZBY.js");
272
+ const { checkAllInjections: checkAllInjections2 } = await import("./injector-J2C4VCJJ.js");
273
273
  const results = await checkAllInjections2(providers, projectDir, scope, expectedContent);
274
274
  const issues = [];
275
275
  for (const result of results) {
@@ -8,8 +8,8 @@ import {
8
8
  injectAll,
9
9
  removeInjection,
10
10
  writeAgentFileToAllProviders
11
- } from "./chunk-QUVY4LG4.js";
12
- import "./chunk-B5WJ4RDT.js";
11
+ } from "./chunk-YXWL2IXL.js";
12
+ import "./chunk-OCQI7UDH.js";
13
13
  export {
14
14
  checkAllInjections,
15
15
  checkInjection,
@@ -21,4 +21,4 @@ export {
21
21
  removeInjection,
22
22
  writeAgentFileToAllProviders
23
23
  };
24
- //# sourceMappingURL=injector-SMCEHZBY.js.map
24
+ //# sourceMappingURL=injector-J2C4VCJJ.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/caamp",
3
- "version": "2026.5.26",
3
+ "version": "2026.5.28",
4
4
  "description": "Central AI Agent Managed Packages - unified provider registry and package manager for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,15 +45,15 @@
45
45
  "dependencies": {
46
46
  "@iarna/toml": "^2.2.5",
47
47
  "commander": "^14.0.0",
48
- "env-paths": "^4.0.0",
49
48
  "gray-matter": "^4.0.3",
50
49
  "js-yaml": "^4.1.0",
51
50
  "jsonc-parser": "^3.3.1",
52
51
  "picocolors": "^1.1.1",
53
52
  "simple-git": "3.33.0",
54
- "@cleocode/cant": "2026.5.26",
55
- "@cleocode/lafs": "2026.5.26",
56
- "@cleocode/contracts": "2026.5.26"
53
+ "@cleocode/contracts": "2026.5.28",
54
+ "@cleocode/lafs": "2026.5.28",
55
+ "@cleocode/paths": "2026.5.28",
56
+ "@cleocode/cant": "2026.5.28"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@biomejs/biome": "2.4.11",
@@ -61,6 +61,7 @@
61
61
  "@types/js-yaml": "^4.0.9",
62
62
  "@types/node": "25.5.0",
63
63
  "@vitest/coverage-v8": "^4.1.4",
64
+ "env-paths": "^4.0.0",
64
65
  "tsup": "^8.5.0",
65
66
  "tsx": "^4.21.0",
66
67
  "typedoc": "0.28.17",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/platform-paths.ts","../src/core/paths/standard.ts"],"sourcesContent":["/**\n * Central OS platform path resolution using env-paths.\n *\n * Provides OS-appropriate paths for CAAMP's global directories using\n * XDG conventions on Linux, standard conventions on macOS/Windows.\n * Results are cached for the process lifetime. Env vars take precedence.\n *\n * Platform path defaults:\n * data: ~/.local/share/agents | ~/Library/Application Support/agents | %LOCALAPPDATA%\\agents\\Data\n * config: ~/.config/agents | ~/Library/Preferences/agents | %APPDATA%\\agents\\Config\n * cache: ~/.cache/agents | ~/Library/Caches/agents | %LOCALAPPDATA%\\agents\\Cache\n * log: ~/.local/state/agents | ~/Library/Logs/agents | %LOCALAPPDATA%\\agents\\Log\n * temp: /tmp/<user>/agents | /var/folders/.../agents | %TEMP%\\agents\n *\n * AGENTS_HOME env var overrides the data path for backward compatibility\n * with existing ~/.agents installations.\n *\n * @remarks\n * Dependency note: `@cleocode/core` depends on `@cleocode/caamp`, so this\n * module intentionally does NOT import from `@cleocode/core` to avoid a\n * circular dependency. The shared env-paths wrapper pattern is factored into\n * {@link createPlatformPathsResolver} below, which can be reused by callers\n * that need a different app name / home env-var without duplicating logic.\n */\n\nimport { arch, homedir, hostname, platform, release } from 'node:os';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport envPaths from 'env-paths';\n\n/**\n * OS-appropriate directory paths for a global agent tool.\n *\n * @public\n */\nexport interface PlatformPaths {\n /** User data dir. Override with the configured home env var. */\n data: string;\n /** OS config dir (XDG_CONFIG_HOME / Library/Preferences / %APPDATA%). */\n config: string;\n /** OS cache dir. */\n cache: string;\n /** OS log dir. */\n log: string;\n /** OS temp dir. */\n temp: string;\n}\n\n/**\n * Snapshot of the current system environment and resolved platform paths.\n *\n * @public\n */\nexport interface SystemInfo {\n /** Operating system platform identifier. */\n platform: NodeJS.Platform;\n /** CPU architecture (e.g. `\"x64\"`, `\"arm64\"`). */\n arch: string;\n /** OS kernel release version string. */\n release: string;\n /** Machine hostname. */\n hostname: string;\n /** Node.js version string (e.g. `\"v20.11.0\"`). */\n nodeVersion: string;\n /** Resolved platform directory paths. */\n paths: PlatformPaths;\n}\n\n/**\n * A bound platform-paths resolver for one app name + home env var.\n *\n * @remarks\n * Created by {@link createPlatformPathsResolver}. Holds its own cache state\n * so different resolvers (e.g. `agents` and `cleo`) are fully isolated.\n *\n * @public\n */\nexport interface PlatformPathsResolver {\n /**\n * Get OS-appropriate paths for the resolver's app directories.\n *\n * @remarks\n * Cached after first call. The home env var overrides the data path for\n * backward compatibility. The cache auto-invalidates when the env var\n * changes (supports test isolation).\n *\n * @returns Resolved platform paths\n *\n * @example\n * ```typescript\n * const resolver = createPlatformPathsResolver('agents', 'AGENTS_HOME');\n * const paths = resolver.getPlatformPaths();\n * console.log(paths.data); // e.g. \"/home/user/.local/share/agents\"\n * ```\n */\n getPlatformPaths(): PlatformPaths;\n\n /**\n * Get a cached system information snapshot.\n *\n * @remarks\n * Captured once and reused for the process lifetime. Includes platform,\n * architecture, hostname, Node version, and resolved paths.\n *\n * @returns Cached system info object\n */\n getSystemInfo(): SystemInfo;\n\n /**\n * Invalidate the path and system info caches.\n * Use in tests after mutating the home env var.\n * @internal\n */\n resetCache(): void;\n}\n\n/**\n * Normalize a home override env var value to an absolute path.\n *\n * @remarks\n * Returns `undefined` when the value is absent, empty, or whitespace-only\n * (callers should fall back to the OS default in that case).\n *\n * @param value - The raw env var value to normalize\n * @returns An absolute path string, or `undefined` if the value is blank\n *\n * @internal\n */\nfunction resolveHomeOverride(value: string | undefined): string | undefined {\n if (value === undefined) return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0) return undefined;\n if (trimmed === '~') return homedir();\n if (trimmed.startsWith('~/')) return join(homedir(), trimmed.slice(2));\n if (isAbsolute(trimmed)) return resolve(trimmed);\n return resolve(homedir(), trimmed);\n}\n\n/**\n * Create a platform-paths resolver bound to a specific app name and home env var.\n *\n * @remarks\n * Encapsulates the `env-paths` wrapper pattern so callers can declare their\n * own app-specific resolver without duplicating the caching and tilde-expansion\n * logic. Each call to `createPlatformPathsResolver` returns an independent\n * resolver with its own internal cache — different apps (e.g. `agents` vs\n * `cleo`) remain fully isolated.\n *\n * Dependency constraint: `@cleocode/core` depends on `@cleocode/caamp`, so\n * this factory lives here rather than in core. Packages that cannot import\n * from core (e.g. install-time scripts) should use this factory directly with\n * `env-paths` as a peer dependency.\n *\n * @param appName - The application name passed to `env-paths` (e.g. `\"agents\"`)\n * @param homeEnvVar - The env var name that overrides the data directory\n * (e.g. `\"AGENTS_HOME\"`). The override supports `~`, `~/…`, absolute, and\n * relative paths.\n * @returns A {@link PlatformPathsResolver} with `getPlatformPaths`,\n * `getSystemInfo`, and `resetCache` methods\n *\n * @example\n * ```typescript\n * const resolver = createPlatformPathsResolver('agents', 'AGENTS_HOME');\n * const paths = resolver.getPlatformPaths();\n * console.log(paths.data); // e.g. \"/home/user/.local/share/agents\"\n * ```\n *\n * @public\n */\nexport function createPlatformPathsResolver(\n appName: string,\n homeEnvVar: string,\n): PlatformPathsResolver {\n let _paths: PlatformPaths | null = null;\n let _sysInfo: SystemInfo | null = null;\n let _lastHomeValue: string | undefined;\n\n function getPlatformPaths(): PlatformPaths {\n const currentHome = process.env[homeEnvVar];\n\n // Invalidate if the home env var changed since last cache build\n if (_paths && currentHome !== _lastHomeValue) {\n _paths = null;\n _sysInfo = null;\n }\n\n if (_paths) return _paths;\n\n const ep = envPaths(appName, { suffix: '' });\n _lastHomeValue = currentHome;\n\n _paths = {\n data: resolveHomeOverride(currentHome) ?? ep.data,\n config: ep.config,\n cache: ep.cache,\n log: ep.log,\n temp: ep.temp,\n };\n\n return _paths;\n }\n\n function getSystemInfo(): SystemInfo {\n if (_sysInfo) return _sysInfo;\n\n const paths = getPlatformPaths();\n\n _sysInfo = {\n platform: platform(),\n arch: arch(),\n release: release(),\n hostname: hostname(),\n nodeVersion: process.version,\n paths,\n };\n\n return _sysInfo;\n }\n\n function resetCache(): void {\n _paths = null;\n _sysInfo = null;\n _lastHomeValue = undefined;\n }\n\n return { getPlatformPaths, getSystemInfo, resetCache };\n}\n\n// ---------------------------------------------------------------------------\n// CAAMP's bound resolver — app name \"agents\", home override \"AGENTS_HOME\"\n// ---------------------------------------------------------------------------\n\nconst _agentsResolver = createPlatformPathsResolver('agents', 'AGENTS_HOME');\n\n/**\n * Get OS-appropriate paths for CAAMP's global directories.\n *\n * @remarks\n * Cached after first call. The `AGENTS_HOME` env var overrides the data path\n * for backward compatibility with existing `~/.agents` installations. The\n * cache auto-invalidates when `AGENTS_HOME` changes (supports test isolation).\n *\n * Delegates to an internal {@link PlatformPathsResolver} created by\n * {@link createPlatformPathsResolver}. To resolve paths for a different app\n * use that factory directly.\n *\n * @returns Resolved platform paths\n *\n * @example\n * ```typescript\n * const paths = getPlatformPaths();\n * console.log(paths.data); // e.g. \"/home/user/.local/share/agents\"\n * ```\n *\n * @public\n */\nexport function getPlatformPaths(): PlatformPaths {\n return _agentsResolver.getPlatformPaths();\n}\n\n/**\n * Get a cached system information snapshot.\n *\n * @remarks\n * Captured once and reused for the process lifetime. Includes platform,\n * architecture, hostname, Node version, and resolved paths.\n *\n * @returns Cached system info object\n *\n * @example\n * ```typescript\n * const info = getSystemInfo();\n * console.log(`Running on ${info.platform}/${info.arch}`);\n * ```\n *\n * @public\n */\nexport function getSystemInfo(): SystemInfo {\n return _agentsResolver.getSystemInfo();\n}\n\n/**\n * Invalidate the path and system info caches.\n * Use in tests after mutating AGENTS_HOME env var.\n * @internal\n */\nexport function _resetPlatformPathsCache(): void {\n _agentsResolver.resetCache();\n}\n","import { existsSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport type { Provider } from '../../types.js';\nimport { getPlatformPaths } from '../platform-paths.js';\n\n/**\n * Scope for path resolution, either global (user home) or project-local.\n *\n * @remarks\n * Global scope resolves paths under the user's home directory (e.g., `~/.agents/`).\n * Project scope resolves paths relative to the project root (e.g., `<project>/.agents/`).\n *\n * @public\n */\nexport type PathScope = 'project' | 'global';\n\n/**\n * Platform-specific directory locations for agent configuration.\n *\n * @remarks\n * Provides resolved paths for the current operating system, accounting for\n * platform differences in config directory locations (XDG on Linux, Library on macOS,\n * AppData on Windows).\n *\n * @public\n */\nexport interface PlatformLocations {\n /** The user's home directory path. */\n home: string;\n /** The platform-specific configuration directory. */\n config: string;\n /** The VS Code user settings directory. */\n vscodeConfig: string;\n /** The Zed editor configuration directory. */\n zedConfig: string;\n /** The Claude Desktop application configuration directory. */\n claudeDesktopConfig: string;\n /** List of application directories (macOS only). */\n applications: string[];\n}\n\n/**\n * Resolves platform-specific directory locations for the current OS.\n *\n * @remarks\n * Detects the current platform and returns appropriate paths for configuration,\n * editor settings, and application directories. Uses `XDG_CONFIG_HOME` on Linux\n * and macOS when available, falls back to conventional defaults. On Windows,\n * uses `APPDATA` or defaults to `~/AppData/Roaming`.\n *\n * @returns Platform-specific directory locations\n *\n * @example\n * ```typescript\n * const locations = getPlatformLocations();\n * console.log(locations.config); // e.g., \"/home/user/.config\"\n * ```\n *\n * @public\n */\nexport function getPlatformLocations(): PlatformLocations {\n const home = homedir();\n const platform = process.platform;\n\n if (platform === 'win32') {\n const appData = process.env['APPDATA'] ?? join(home, 'AppData', 'Roaming');\n return {\n home,\n config: appData,\n vscodeConfig: join(appData, 'Code', 'User'),\n zedConfig: join(appData, 'Zed'),\n claudeDesktopConfig: join(appData, 'Claude'),\n applications: [],\n };\n }\n\n if (platform === 'darwin') {\n const config = process.env['XDG_CONFIG_HOME'] ?? join(home, '.config');\n return {\n home,\n config,\n vscodeConfig: join(home, 'Library', 'Application Support', 'Code', 'User'),\n zedConfig: join(home, 'Library', 'Application Support', 'Zed'),\n claudeDesktopConfig: join(home, 'Library', 'Application Support', 'Claude'),\n applications: ['/Applications', join(home, 'Applications')],\n };\n }\n\n const config = process.env['XDG_CONFIG_HOME'] ?? join(home, '.config');\n return {\n home,\n config,\n vscodeConfig: join(config, 'Code', 'User'),\n zedConfig: join(config, 'zed'),\n claudeDesktopConfig: join(config, 'Claude'),\n applications: [],\n };\n}\n\n/**\n * Returns the global agents home directory path.\n *\n * @remarks\n * Delegates to the platform paths module to resolve the data directory\n * for the current operating system. This is the root for global agent\n * configuration such as canonical skills and lock files.\n *\n * @returns The absolute path to the global agents home directory\n *\n * @example\n * ```typescript\n * const home = getAgentsHome();\n * // e.g., \"/home/user/.local/share/caamp\"\n * ```\n *\n * @public\n */\nexport function getAgentsHome(): string {\n return getPlatformPaths().data;\n}\n\n/**\n * Returns the project-local `.agents` directory path.\n *\n * @remarks\n * Joins the project root with `.agents` to produce the conventional\n * project-scoped agent configuration directory.\n *\n * @param projectRoot - The project root directory, defaults to `process.cwd()`\n * @returns The absolute path to the project's `.agents` directory\n *\n * @example\n * ```typescript\n * const dir = getProjectAgentsDir(\"/home/user/my-project\");\n * // returns \"/home/user/my-project/.agents\"\n * ```\n *\n * @public\n */\nexport function getProjectAgentsDir(projectRoot = process.cwd()): string {\n return join(projectRoot, '.agents');\n}\n\n/**\n * Resolves a relative path against a project directory.\n *\n * @remarks\n * A simple path join utility that combines the project directory with\n * the given relative path to produce an absolute path.\n *\n * @param relativePath - The relative path to resolve\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved absolute path\n *\n * @example\n * ```typescript\n * const path = resolveProjectPath(\".agents/config.toml\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/config.toml\"\n * ```\n *\n * @public\n */\nexport function resolveProjectPath(relativePath: string, projectDir = process.cwd()): string {\n return join(projectDir, relativePath);\n}\n\n/**\n * Returns the canonical skills storage directory path.\n *\n * @remarks\n * Skills are stored once in this canonical directory and symlinked into\n * provider-specific locations. This is the single source of truth for\n * installed skill files.\n *\n * @returns The absolute path to the canonical skills directory\n *\n * @example\n * ```typescript\n * const dir = getCanonicalSkillsDir();\n * // e.g., \"/home/user/.local/share/caamp/skills\"\n * ```\n *\n * @public\n */\nexport function getCanonicalSkillsDir(): string {\n return join(getAgentsHome(), 'skills');\n}\n\n/**\n * Returns the path to the CAAMP lock file.\n *\n * @remarks\n * The lock file tracks installed skills and their versions to enable\n * deterministic reinstallation and conflict detection.\n *\n * @returns The absolute path to the `.caamp-lock.json` file\n *\n * @example\n * ```typescript\n * const lockPath = getLockFilePath();\n * // e.g., \"/home/user/.local/share/caamp/.caamp-lock.json\"\n * ```\n *\n * @public\n */\nexport function getLockFilePath(): string {\n return join(getAgentsHome(), '.caamp-lock.json');\n}\n\n// ── .agents/ Standard Directory Structure ────────────────────────────\n\n/**\n * Gets the MCP directory within the `.agents/` standard structure.\n *\n * @remarks\n * Resolves the MCP configuration directory based on scope. Global scope\n * points to `~/.agents/mcp/`, while project scope points to\n * `<project>/.agents/mcp/`.\n *\n * @param scope - `\"global\"` for `~/.agents/mcp/`, `\"project\"` for `<project>/.agents/mcp/`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the MCP directory\n *\n * @example\n * ```typescript\n * const globalMcp = getAgentsMcpDir(\"global\");\n * const projectMcp = getAgentsMcpDir(\"project\", \"/home/user/project\");\n * ```\n *\n * @public\n */\nexport function getAgentsMcpDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'mcp');\n return join(projectDir ?? process.cwd(), '.agents', 'mcp');\n}\n\n/**\n * Gets the MCP servers.json path within the `.agents/` standard structure.\n *\n * @remarks\n * Per the `.agents/` standard (Section 9), this is the canonical MCP\n * server registry that should be checked before legacy per-provider configs.\n *\n * @param scope - `\"global\"` for `~/.agents/mcp/servers.json`, `\"project\"` for `<project>/.agents/mcp/servers.json`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the `servers.json` file\n *\n * @example\n * ```typescript\n * const serversPath = getAgentsMcpServersPath(\"global\");\n * // e.g., \"/home/user/.agents/mcp/servers.json\"\n * ```\n *\n * @public\n */\nexport function getAgentsMcpServersPath(scope: PathScope = 'global', projectDir?: string): string {\n return join(getAgentsMcpDir(scope, projectDir), 'servers.json');\n}\n\n/**\n * Gets the primary AGENTS.md instruction file path within `.agents/`.\n *\n * @remarks\n * Returns the path to the AGENTS.md file for the given scope. This is the\n * standard instruction file that agents read for project or global guidance.\n *\n * @param scope - `\"global\"` for `~/.agents/AGENTS.md`, `\"project\"` for `<project>/.agents/AGENTS.md`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the AGENTS.md file\n *\n * @example\n * ```typescript\n * const agentsFile = getAgentsInstructFile(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/AGENTS.md\"\n * ```\n *\n * @public\n */\nexport function getAgentsInstructFile(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'AGENTS.md');\n return join(projectDir ?? process.cwd(), '.agents', 'AGENTS.md');\n}\n\n/**\n * Gets the config.toml path within the `.agents/` standard structure.\n *\n * @remarks\n * Returns the path to the TOML configuration file for agent settings.\n * Global scope points to `~/.agents/config.toml`, project scope points\n * to `<project>/.agents/config.toml`.\n *\n * @param scope - `\"global\"` for `~/.agents/config.toml`, `\"project\"` for `<project>/.agents/config.toml`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the config.toml file\n *\n * @example\n * ```typescript\n * const configPath = getAgentsConfigPath(\"global\");\n * // e.g., \"/home/user/.agents/config.toml\"\n * ```\n *\n * @public\n */\nexport function getAgentsConfigPath(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'config.toml');\n return join(projectDir ?? process.cwd(), '.agents', 'config.toml');\n}\n\n/**\n * Gets the wiki directory within the `.agents/` standard structure.\n *\n * @remarks\n * The wiki directory stores markdown documentation files that agents\n * can reference for project or global knowledge.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the wiki directory\n *\n * @example\n * ```typescript\n * const wikiDir = getAgentsWikiDir(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/wiki\"\n * ```\n *\n * @public\n */\nexport function getAgentsWikiDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'wiki');\n return join(projectDir ?? process.cwd(), '.agents', 'wiki');\n}\n\n/**\n * Gets the spec directory within the `.agents/` standard structure.\n *\n * @remarks\n * The spec directory stores specification files used by agents for\n * project architecture and design reference.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the spec directory\n *\n * @example\n * ```typescript\n * const specDir = getAgentsSpecDir(\"global\");\n * // e.g., \"/home/user/.agents/spec\"\n * ```\n *\n * @public\n */\nexport function getAgentsSpecDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'spec');\n return join(projectDir ?? process.cwd(), '.agents', 'spec');\n}\n\n/**\n * Gets the links directory within the `.agents/` standard structure.\n *\n * @remarks\n * The links directory stores symlinks or references to external resources\n * that agents can follow for additional context.\n *\n * @param scope - `\"global\"` or `\"project\"`\n * @param projectDir - Project root (defaults to `process.cwd()`)\n * @returns The absolute path to the links directory\n *\n * @example\n * ```typescript\n * const linksDir = getAgentsLinksDir(\"project\", \"/home/user/project\");\n * // returns \"/home/user/project/.agents/links\"\n * ```\n *\n * @public\n */\nexport function getAgentsLinksDir(scope: PathScope = 'global', projectDir?: string): string {\n if (scope === 'global') return join(getAgentsHome(), 'links');\n return join(projectDir ?? process.cwd(), '.agents', 'links');\n}\n\n/**\n * Resolve the CLEO home directory for template path expansion.\n *\n * @remarks\n * Honors the `CLEO_HOME` environment variable when set. Otherwise falls\n * back to a platform-appropriate data directory for the `cleo` app name\n * (e.g. `~/.local/share/cleo` on Linux, `~/Library/Application Support/cleo`\n * on macOS, `%LOCALAPPDATA%\\cleo\\Data` on Windows). This mirrors the\n * resolution strategy used by the `@cleocode/core` package's `getCleoHome`\n * helper but is duplicated here to avoid a cross-package runtime dependency.\n *\n * @internal\n */\nfunction getCleoHomeForTemplate(): string {\n const envOverride = process.env['CLEO_HOME'];\n if (envOverride && envOverride.trim().length > 0) {\n return envOverride.trim();\n }\n const home = getPlatformLocations().home;\n if (process.platform === 'win32') {\n const localAppData = process.env['LOCALAPPDATA'] ?? join(home, 'AppData', 'Local');\n return join(localAppData, 'cleo', 'Data');\n }\n if (process.platform === 'darwin') {\n return join(home, 'Library', 'Application Support', 'cleo');\n }\n const xdgData = process.env['XDG_DATA_HOME'] ?? join(home, '.local', 'share');\n return join(xdgData, 'cleo');\n}\n\n/**\n * Resolves a registry template path by substituting platform variables.\n *\n * @remarks\n * Replaces template variables like `$HOME`, `$CONFIG`, `$VSCODE_CONFIG`,\n * `$ZED_CONFIG`, `$CLAUDE_DESKTOP_CONFIG`, `$AGENTS_HOME`, and `$CLEO_HOME`\n * with their actual platform-specific values. Used to resolve paths from\n * the provider registry JSON.\n *\n * @param template - The template string containing `$VARIABLE` placeholders\n * @returns The resolved absolute path with all variables expanded\n *\n * @example\n * ```typescript\n * const path = resolveRegistryTemplatePath(\"$HOME/.config/claude/settings.json\");\n * // e.g., \"/home/user/.config/claude/settings.json\"\n * ```\n *\n * @public\n */\nexport function resolveRegistryTemplatePath(template: string): string {\n const locations = getPlatformLocations();\n return template\n .replace(/\\$HOME/g, locations.home)\n .replace(/\\$CONFIG/g, locations.config)\n .replace(/\\$VSCODE_CONFIG/g, locations.vscodeConfig)\n .replace(/\\$ZED_CONFIG/g, locations.zedConfig)\n .replace(/\\$CLAUDE_DESKTOP_CONFIG/g, locations.claudeDesktopConfig)\n .replace(/\\$AGENTS_HOME/g, getAgentsHome())\n .replace(/\\$CLEO_HOME/g, getCleoHomeForTemplate());\n}\n\n/**\n * Resolves the configuration file path for a provider at the given scope.\n *\n * @remarks\n * For global scope, returns the provider's `configPathGlobal` directly.\n * For project scope, joins the project directory with the provider's\n * `configPathProject`. Returns null if the provider has no project-scoped\n * config path defined.\n *\n * @param provider - The provider whose config path to resolve\n * @param scope - Whether to resolve global or project config path\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved config file path, or null if unavailable for the given scope\n *\n * @example\n * ```typescript\n * const configPath = resolveProviderConfigPath(provider, \"project\", \"/home/user/project\");\n * if (configPath) {\n * console.log(\"Config at:\", configPath);\n * }\n * ```\n *\n * @public\n */\nexport function resolveProviderConfigPath(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string | null {\n const mcp = provider.capabilities.mcp;\n if (!mcp) {\n return null;\n }\n if (scope === 'global') {\n return mcp.configPathGlobal;\n }\n if (!mcp.configPathProject) {\n return null;\n }\n return resolveProjectPath(mcp.configPathProject, projectDir);\n}\n\n/**\n * Determines the preferred configuration scope for a provider.\n *\n * @remarks\n * If the global flag is explicitly set, always returns `\"global\"`. Otherwise,\n * returns `\"project\"` if the provider supports project-scoped configuration,\n * or `\"global\"` as a fallback.\n *\n * @param provider - The provider to determine scope for\n * @param useGlobalFlag - Optional flag to force global scope\n * @returns The preferred path scope for configuration\n *\n * @example\n * ```typescript\n * const scope = resolvePreferredConfigScope(provider, false);\n * // returns \"project\" if provider has configPathProject, otherwise \"global\"\n * ```\n *\n * @public\n */\nexport function resolvePreferredConfigScope(\n provider: Provider,\n useGlobalFlag?: boolean,\n): PathScope {\n if (useGlobalFlag) {\n return 'global';\n }\n return provider.capabilities.mcp?.configPathProject ? 'project' : 'global';\n}\n\n/**\n * Resolves the skills directory path for a provider at the given scope.\n *\n * @remarks\n * For global scope, returns the provider's `pathSkills` directly.\n * For project scope, joins the project directory with the provider's\n * `pathProjectSkills` relative path.\n *\n * @param provider - The provider whose skills directory to resolve\n * @param scope - Whether to resolve global or project skills path\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved skills directory path\n *\n * @example\n * ```typescript\n * const skillsDir = resolveProviderSkillsDir(provider, \"global\");\n * // e.g., \"/home/user/.claude/skills\"\n * ```\n *\n * @public\n */\nexport function resolveProviderSkillsDir(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string {\n if (scope === 'global') {\n return provider.pathSkills;\n }\n return resolveProjectPath(provider.pathProjectSkills, projectDir);\n}\n\n/**\n * Gets all target directories for skill installation based on provider precedence.\n *\n * @remarks\n * Resolves one or more skill directories based on the provider's skills\n * precedence setting. The precedence determines whether vendor-only, agents-canonical,\n * agents-first, agents-supported, or vendor-global-agents-project strategies are used.\n * Falls back to the vendor path when the agents path is not configured.\n *\n * @param provider - Provider to resolve paths for\n * @param scope - Whether to resolve global or project paths\n * @param projectDir - Project directory for project-scope resolution\n * @returns Array of target directories for symlink creation\n *\n * @example\n * ```typescript\n * const dirs = resolveProviderSkillsDirs(provider, \"project\", \"/home/user/project\");\n * for (const dir of dirs) {\n * console.log(\"Install skill to:\", dir);\n * }\n * ```\n *\n * @public\n */\nexport function resolveProviderSkillsDirs(\n provider: Provider,\n scope: PathScope,\n projectDir = process.cwd(),\n): string[] {\n const vendorPath = resolveProviderSkillsDir(provider, scope, projectDir);\n const precedence = provider.capabilities?.skills?.precedence ?? 'vendor-only';\n\n const resolveAgentsPath = (): string | null => {\n if (scope === 'global') {\n return provider.capabilities?.skills?.agentsGlobalPath ?? null;\n }\n const projectRelative = provider.capabilities?.skills?.agentsProjectPath ?? null;\n return projectRelative ? join(projectDir, projectRelative) : null;\n };\n\n switch (precedence) {\n case 'vendor-only':\n return [vendorPath];\n\n case 'agents-canonical': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath] : [vendorPath];\n }\n\n case 'agents-first': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath, vendorPath] : [vendorPath];\n }\n\n case 'agents-supported': {\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [vendorPath, agentsPath] : [vendorPath];\n }\n\n case 'vendor-global-agents-project': {\n if (scope === 'global') {\n return [vendorPath];\n }\n const agentsPath = resolveAgentsPath();\n return agentsPath ? [agentsPath, vendorPath] : [vendorPath];\n }\n\n default:\n return [vendorPath];\n }\n}\n\n/**\n * Resolves a provider's project-level path against a project directory.\n *\n * @remarks\n * Joins the project directory with the provider's `pathProject` relative path\n * to produce an absolute path for project-scoped provider configuration.\n *\n * @param provider - The provider whose project path to resolve\n * @param projectDir - The project root directory, defaults to `process.cwd()`\n * @returns The resolved absolute path for the provider's project directory\n *\n * @example\n * ```typescript\n * const projectPath = resolveProviderProjectPath(provider, \"/home/user/project\");\n * // e.g., \"/home/user/project/.claude\"\n * ```\n *\n * @public\n */\nexport function resolveProviderProjectPath(provider: Provider, projectDir = process.cwd()): string {\n return resolveProjectPath(provider.pathProject, projectDir);\n}\n\n/**\n * Locates the providers registry.json file by searching up from a start directory.\n *\n * @remarks\n * First checks common relative locations (3 levels up and 1 level up),\n * then walks up to 8 parent directories looking for `providers/registry.json`.\n * Throws if the registry file cannot be found.\n *\n * @param startDir - The directory to start searching from\n * @returns The absolute path to the found `providers/registry.json` file\n * @throws Error if `providers/registry.json` cannot be found within 8 parent levels\n *\n * @example\n * ```typescript\n * const registryPath = resolveProvidersRegistryPath(__dirname);\n * // e.g., \"/home/user/caamp/providers/registry.json\"\n * ```\n *\n * @public\n */\nexport function resolveProvidersRegistryPath(startDir: string): string {\n const candidates = [\n join(startDir, '..', '..', '..', 'providers', 'registry.json'),\n join(startDir, '..', 'providers', 'registry.json'),\n ];\n\n for (const candidate of candidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n let current = startDir;\n for (let i = 0; i < 8; i += 1) {\n const candidate = join(current, 'providers', 'registry.json');\n if (existsSync(candidate)) {\n return candidate;\n }\n current = dirname(current);\n }\n\n throw new Error(`Cannot find providers/registry.json (searched from ${startDir})`);\n}\n\n/**\n * Normalizes a skill sub-path by cleaning separators and removing SKILL.md suffix.\n *\n * @remarks\n * Converts backslashes to forward slashes, strips leading slashes and\n * trailing `/SKILL.md`, and trims whitespace. Returns undefined for\n * empty or falsy inputs.\n *\n * @param path - The raw skill sub-path to normalize\n * @returns The normalized path, or undefined if the input is empty or falsy\n *\n * @example\n * ```typescript\n * const normalized = normalizeSkillSubPath(\"skills/my-skill/SKILL.md\");\n * // returns \"skills/my-skill\"\n * ```\n *\n * @public\n */\nexport function normalizeSkillSubPath(path: string | undefined): string | undefined {\n if (!path) return undefined;\n const normalized = path\n .replace(/\\\\/g, '/')\n .replace(/^\\/+/, '')\n .replace(/\\/SKILL\\.md$/i, '')\n .trim();\n return normalized.length > 0 ? normalized : undefined;\n}\n\n/**\n * Builds a list of candidate sub-paths for skill file resolution.\n *\n * @remarks\n * Normalizes both the marketplace and parsed paths, then generates additional\n * candidates by prepending known prefixes (`.agents`, `.claude`) to paths\n * starting with `skills/`. Returns a deduplicated list of candidates, with\n * an undefined entry as fallback if no candidates are found.\n *\n * @param marketplacePath - The sub-path from the marketplace listing\n * @param parsedPath - The sub-path parsed from the source URL\n * @returns A deduplicated array of candidate sub-paths\n *\n * @example\n * ```typescript\n * const candidates = buildSkillSubPathCandidates(\"skills/my-skill\", undefined);\n * // returns [\"skills/my-skill\", \".agents/skills/my-skill\", \".claude/skills/my-skill\"]\n * ```\n *\n * @public\n */\nexport function buildSkillSubPathCandidates(\n marketplacePath: string | undefined,\n parsedPath: string | undefined,\n): (string | undefined)[] {\n const candidates: (string | undefined)[] = [];\n const base = normalizeSkillSubPath(marketplacePath);\n const parsed = normalizeSkillSubPath(parsedPath);\n\n if (base) candidates.push(base);\n if (parsed) candidates.push(parsed);\n\n const knownPrefixes = ['.agents', '.claude'];\n for (const value of [base, parsed]) {\n if (!value?.startsWith('skills/')) continue;\n for (const prefix of knownPrefixes) {\n candidates.push(`${prefix}/${value}`);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