@cleocode/caamp 2026.4.91 → 2026.4.93

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-6G2XZN23.js";
3
+ } from "./chunk-B5WJ4RDT.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-GIV6BURT.js.map
294
+ //# sourceMappingURL=chunk-AOCNTIKB.js.map
@@ -8,8 +8,7 @@ var __export = (target, all) => {
8
8
  import { arch, homedir, hostname, platform, release } from "os";
9
9
  import { isAbsolute, join, resolve } from "path";
10
10
  import envPaths from "env-paths";
11
- var APP_NAME = "agents";
12
- function resolveAgentsHomeOverride(value) {
11
+ function resolveHomeOverride(value) {
13
12
  if (value === void 0) return void 0;
14
13
  const trimmed = value.trim();
15
14
  if (trimmed.length === 0) return void 0;
@@ -18,44 +17,57 @@ function resolveAgentsHomeOverride(value) {
18
17
  if (isAbsolute(trimmed)) return resolve(trimmed);
19
18
  return resolve(homedir(), trimmed);
20
19
  }
21
- var _paths = null;
22
- var _sysInfo = null;
23
- var _lastAgentsHome;
24
- function getPlatformPaths() {
25
- const currentAgentsHome = process.env["AGENTS_HOME"];
26
- if (_paths && currentAgentsHome !== _lastAgentsHome) {
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() {
27
56
  _paths = null;
28
57
  _sysInfo = null;
58
+ _lastHomeValue = void 0;
29
59
  }
30
- if (_paths) return _paths;
31
- const ep = envPaths(APP_NAME, { suffix: "" });
32
- _lastAgentsHome = currentAgentsHome;
33
- _paths = {
34
- data: resolveAgentsHomeOverride(currentAgentsHome) ?? ep.data,
35
- config: ep.config,
36
- cache: ep.cache,
37
- log: ep.log,
38
- temp: ep.temp
39
- };
40
- return _paths;
60
+ return { getPlatformPaths: getPlatformPaths2, getSystemInfo: getSystemInfo2, resetCache };
61
+ }
62
+ var _agentsResolver = createPlatformPathsResolver("agents", "AGENTS_HOME");
63
+ function getPlatformPaths() {
64
+ return _agentsResolver.getPlatformPaths();
41
65
  }
42
66
  function getSystemInfo() {
43
- if (_sysInfo) return _sysInfo;
44
- const paths = getPlatformPaths();
45
- _sysInfo = {
46
- platform: platform(),
47
- arch: arch(),
48
- release: release(),
49
- hostname: hostname(),
50
- nodeVersion: process.version,
51
- paths
52
- };
53
- return _sysInfo;
67
+ return _agentsResolver.getSystemInfo();
54
68
  }
55
69
  function _resetPlatformPathsCache() {
56
- _paths = null;
57
- _sysInfo = null;
58
- _lastAgentsHome = void 0;
70
+ _agentsResolver.resetCache();
59
71
  }
60
72
 
61
73
  // src/core/paths/standard.ts
@@ -286,4 +298,4 @@ export {
286
298
  resolveProvidersRegistryPath,
287
299
  buildSkillSubPathCandidates
288
300
  };
289
- //# sourceMappingURL=chunk-6G2XZN23.js.map
301
+ //# sourceMappingURL=chunk-B5WJ4RDT.js.map
@@ -0,0 +1 @@
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}`);\n }\n }\n\n if (candidates.length === 0) {\n candidates.push(undefined);\n }\n\n return Array.from(new Set(candidates));\n}\n"],"mappings":";;;;;;;AAyBA,SAAS,MAAM,SAAS,UAAU,UAAU,eAAe;AAC3D,SAAS,YAAY,MAAM,eAAe;AAC1C,OAAO,cAAc;AAoGrB,SAAS,oBAAoB,OAA+C;AAC1E,MAAI,UAAU,OA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I,KAAK,EAAE;AAAA,IACtC;AAAA,EACF;AAEA,MAAI,WAAW,WAAW,GAAG;AAC3B,eAAW,KAAK,MAAS;AAAA,EAC3B;AAEA,SAAO,MAAM,KAAK,IAAI,IAAI,UAAU,CAAC;AACvC;","names":["getPlatformPaths","getSystemInfo","homedir","join","homedir","platform","join","config","join"]}
@@ -2,7 +2,7 @@ import {
2
2
  resolveProviderSkillsDir,
3
3
  resolveProvidersRegistryPath,
4
4
  resolveRegistryTemplatePath
5
- } from "./chunk-6G2XZN23.js";
5
+ } from "./chunk-B5WJ4RDT.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-WM3UZVDZ.js.map
585
+ //# sourceMappingURL=chunk-QUVY4LG4.js.map
@@ -3,7 +3,7 @@ import {
3
3
  getPrimaryProvider,
4
4
  groupByInstructFile,
5
5
  injectAll
6
- } from "./chunk-WM3UZVDZ.js";
6
+ } from "./chunk-QUVY4LG4.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-6G2XZN23.js";
19
+ } from "./chunk-B5WJ4RDT.js";
20
20
 
21
21
  // src/core/logger.ts
22
22
  var verboseMode = false;
@@ -4715,4 +4715,4 @@ export {
4715
4715
  discoverSkillsMulti,
4716
4716
  validateSkill
4717
4717
  };
4718
- //# sourceMappingURL=chunk-DVNEIJOO.js.map
4718
+ //# sourceMappingURL=chunk-SHOXU2YA.js.map
package/dist/cli.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  tokenizeCriteriaValue,
53
53
  updateInstructionsSingleOperation,
54
54
  validateSkill
55
- } from "./chunk-DVNEIJOO.js";
55
+ } from "./chunk-SHOXU2YA.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-WM3UZVDZ.js";
68
+ } from "./chunk-QUVY4LG4.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-GIV6BURT.js";
77
+ } from "./chunk-AOCNTIKB.js";
78
78
  import {
79
79
  buildSkillSubPathCandidates,
80
80
  resolveProviderConfigPath,
81
81
  resolveProviderSkillsDir
82
- } from "./chunk-6G2XZN23.js";
82
+ } from "./chunk-B5WJ4RDT.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-N4NQBYRE.js");
3352
+ const { toCanonical } = await import("./hooks-LLJHGX5J.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-N4NQBYRE.js");
3392
+ const { getMappedProviderIds } = await import("./hooks-LLJHGX5J.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-GIV6BURT.js";
28
- import "./chunk-6G2XZN23.js";
27
+ } from "./chunk-AOCNTIKB.js";
28
+ import "./chunk-B5WJ4RDT.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-N4NQBYRE.js.map
56
+ //# sourceMappingURL=hooks-LLJHGX5J.js.map
package/dist/index.d.ts CHANGED
@@ -5757,14 +5757,21 @@ declare function resolveProviderSkillsDirs(provider: Provider, scope: PathScope,
5757
5757
  *
5758
5758
  * AGENTS_HOME env var overrides the data path for backward compatibility
5759
5759
  * with existing ~/.agents installations.
5760
+ *
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.
5760
5767
  */
5761
5768
  /**
5762
- * OS-appropriate directory paths for CAAMP's global storage.
5769
+ * OS-appropriate directory paths for a global agent tool.
5763
5770
  *
5764
5771
  * @public
5765
5772
  */
5766
5773
  interface PlatformPaths {
5767
- /** User data dir. Override with AGENTS_HOME env var. */
5774
+ /** User data dir. Override with the configured home env var. */
5768
5775
  data: string;
5769
5776
  /** OS config dir (XDG_CONFIG_HOME / Library/Preferences / %APPDATA%). */
5770
5777
  config: string;
@@ -5802,6 +5809,10 @@ interface SystemInfo {
5802
5809
  * for backward compatibility with existing `~/.agents` installations. The
5803
5810
  * cache auto-invalidates when `AGENTS_HOME` changes (supports test isolation).
5804
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
+ *
5805
5816
  * @returns Resolved platform paths
5806
5817
  *
5807
5818
  * @example
package/dist/index.js CHANGED
@@ -70,7 +70,7 @@ import {
70
70
  validateRecommendationCriteria,
71
71
  validateSkill,
72
72
  writeConfig
73
- } from "./chunk-DVNEIJOO.js";
73
+ } from "./chunk-SHOXU2YA.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-WM3UZVDZ.js";
109
+ } from "./chunk-QUVY4LG4.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-GIV6BURT.js";
135
+ } from "./chunk-AOCNTIKB.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-6G2XZN23.js";
154
+ } from "./chunk-B5WJ4RDT.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-PEUIAZCU.js");
272
+ const { checkAllInjections: checkAllInjections2 } = await import("./injector-SMCEHZBY.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-WM3UZVDZ.js";
12
- import "./chunk-6G2XZN23.js";
11
+ } from "./chunk-QUVY4LG4.js";
12
+ import "./chunk-B5WJ4RDT.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-PEUIAZCU.js.map
24
+ //# sourceMappingURL=injector-SMCEHZBY.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/caamp",
3
- "version": "2026.4.91",
3
+ "version": "2026.4.93",
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": {
@@ -51,8 +51,8 @@
51
51
  "jsonc-parser": "^3.3.1",
52
52
  "picocolors": "^1.1.1",
53
53
  "simple-git": "3.33.0",
54
- "@cleocode/lafs": "2026.4.91",
55
- "@cleocode/cant": "2026.4.91"
54
+ "@cleocode/cant": "2026.4.93",
55
+ "@cleocode/lafs": "2026.4.93"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@biomejs/biome": "2.4.8",
@@ -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\nimport { arch, homedir, hostname, platform, release } from 'node:os';\nimport { isAbsolute, join, resolve } from 'node:path';\nimport envPaths from 'env-paths';\n\nconst APP_NAME = 'agents';\n\n/**\n * Normalize an AGENTS_HOME env var value to an absolute path.\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 */\nfunction resolveAgentsHomeOverride(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 * OS-appropriate directory paths for CAAMP's global storage.\n *\n * @public\n */\nexport interface PlatformPaths {\n /** User data dir. Override with AGENTS_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\nlet _paths: PlatformPaths | null = null;\nlet _sysInfo: SystemInfo | null = null;\nlet _lastAgentsHome: string | undefined;\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 * @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 const currentAgentsHome = process.env['AGENTS_HOME'];\n\n // Invalidate if AGENTS_HOME changed since last cache build\n if (_paths && currentAgentsHome !== _lastAgentsHome) {\n _paths = null;\n _sysInfo = null;\n }\n\n if (_paths) return _paths;\n\n const ep = envPaths(APP_NAME, { suffix: '' });\n _lastAgentsHome = currentAgentsHome;\n\n _paths = {\n data: resolveAgentsHomeOverride(currentAgentsHome) ?? 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/**\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 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/**\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 _paths = null;\n _sysInfo = null;\n _lastAgentsHome = undefined;\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":";;;;;;;AAkBA,SAAS,MAAM,SAAS,UAAU,UAAU,eAAe;AAC3D,SAAS,YAAY,MAAM,eAAe;AAC1C,OAAO,cAAc;AAErB,IAAM,WAAW;AAOjB,SAAS,0BAA0B,OAA+C;AAChF,MAAI,UAAU,OAAW,QAAO;AAChC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,MAAI,YAAY,IAAK,QAAO,QAAQ;AACpC,MAAI,QAAQ,WAAW,IAAI,EAAG,QAAO,KAAK,QAAQ,GAAG,QAAQ,MAAM,CAAC,CAAC;AACrE,MAAI,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