@cleocode/caamp 1.8.1 → 1.9.1

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.
@@ -0,0 +1,276 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/core/platform-paths.ts
8
+ import envPaths from "env-paths";
9
+ import { arch, homedir, hostname, platform, release } from "os";
10
+ import { isAbsolute, join, resolve } from "path";
11
+ var APP_NAME = "agents";
12
+ function resolveAgentsHomeOverride(value) {
13
+ if (value === void 0) return void 0;
14
+ const trimmed = value.trim();
15
+ if (trimmed.length === 0) return void 0;
16
+ if (trimmed === "~") return homedir();
17
+ if (trimmed.startsWith("~/")) return join(homedir(), trimmed.slice(2));
18
+ if (isAbsolute(trimmed)) return resolve(trimmed);
19
+ return resolve(homedir(), trimmed);
20
+ }
21
+ var _paths = null;
22
+ var _sysInfo = null;
23
+ var _lastAgentsHome = void 0;
24
+ function getPlatformPaths() {
25
+ const currentAgentsHome = process.env["AGENTS_HOME"];
26
+ if (_paths && currentAgentsHome !== _lastAgentsHome) {
27
+ _paths = null;
28
+ _sysInfo = null;
29
+ }
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;
41
+ }
42
+ 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;
54
+ }
55
+ function _resetPlatformPathsCache() {
56
+ _paths = null;
57
+ _sysInfo = null;
58
+ _lastAgentsHome = void 0;
59
+ }
60
+
61
+ // src/core/paths/standard.ts
62
+ import { existsSync } from "fs";
63
+ import { homedir as homedir2 } from "os";
64
+ import { dirname, join as join2 } from "path";
65
+ function getPlatformLocations() {
66
+ const home = homedir2();
67
+ const platform2 = process.platform;
68
+ if (platform2 === "win32") {
69
+ const appData = process.env["APPDATA"] ?? join2(home, "AppData", "Roaming");
70
+ return {
71
+ home,
72
+ config: appData,
73
+ vscodeConfig: join2(appData, "Code", "User"),
74
+ zedConfig: join2(appData, "Zed"),
75
+ claudeDesktopConfig: join2(appData, "Claude"),
76
+ applications: []
77
+ };
78
+ }
79
+ if (platform2 === "darwin") {
80
+ const config2 = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
81
+ return {
82
+ home,
83
+ config: config2,
84
+ vscodeConfig: join2(home, "Library", "Application Support", "Code", "User"),
85
+ zedConfig: join2(home, "Library", "Application Support", "Zed"),
86
+ claudeDesktopConfig: join2(home, "Library", "Application Support", "Claude"),
87
+ applications: ["/Applications", join2(home, "Applications")]
88
+ };
89
+ }
90
+ const config = process.env["XDG_CONFIG_HOME"] ?? join2(home, ".config");
91
+ return {
92
+ home,
93
+ config,
94
+ vscodeConfig: join2(config, "Code", "User"),
95
+ zedConfig: join2(config, "zed"),
96
+ claudeDesktopConfig: join2(config, "Claude"),
97
+ applications: []
98
+ };
99
+ }
100
+ function getAgentsHome() {
101
+ return getPlatformPaths().data;
102
+ }
103
+ function getProjectAgentsDir(projectRoot = process.cwd()) {
104
+ return join2(projectRoot, ".agents");
105
+ }
106
+ function resolveProjectPath(relativePath, projectDir = process.cwd()) {
107
+ return join2(projectDir, relativePath);
108
+ }
109
+ function getCanonicalSkillsDir() {
110
+ return join2(getAgentsHome(), "skills");
111
+ }
112
+ function getLockFilePath() {
113
+ return join2(getAgentsHome(), ".caamp-lock.json");
114
+ }
115
+ function getAgentsMcpDir(scope = "global", projectDir) {
116
+ if (scope === "global") return join2(getAgentsHome(), "mcp");
117
+ return join2(projectDir ?? process.cwd(), ".agents", "mcp");
118
+ }
119
+ function getAgentsMcpServersPath(scope = "global", projectDir) {
120
+ return join2(getAgentsMcpDir(scope, projectDir), "servers.json");
121
+ }
122
+ function getAgentsInstructFile(scope = "global", projectDir) {
123
+ if (scope === "global") return join2(getAgentsHome(), "AGENTS.md");
124
+ return join2(projectDir ?? process.cwd(), ".agents", "AGENTS.md");
125
+ }
126
+ function getAgentsConfigPath(scope = "global", projectDir) {
127
+ if (scope === "global") return join2(getAgentsHome(), "config.toml");
128
+ return join2(projectDir ?? process.cwd(), ".agents", "config.toml");
129
+ }
130
+ function getAgentsWikiDir(scope = "global", projectDir) {
131
+ if (scope === "global") return join2(getAgentsHome(), "wiki");
132
+ return join2(projectDir ?? process.cwd(), ".agents", "wiki");
133
+ }
134
+ function getAgentsSpecDir(scope = "global", projectDir) {
135
+ if (scope === "global") return join2(getAgentsHome(), "spec");
136
+ return join2(projectDir ?? process.cwd(), ".agents", "spec");
137
+ }
138
+ function getAgentsLinksDir(scope = "global", projectDir) {
139
+ if (scope === "global") return join2(getAgentsHome(), "links");
140
+ return join2(projectDir ?? process.cwd(), ".agents", "links");
141
+ }
142
+ function resolveRegistryTemplatePath(template) {
143
+ const locations = getPlatformLocations();
144
+ return template.replace(/\$HOME/g, locations.home).replace(/\$CONFIG/g, locations.config).replace(/\$VSCODE_CONFIG/g, locations.vscodeConfig).replace(/\$ZED_CONFIG/g, locations.zedConfig).replace(/\$CLAUDE_DESKTOP_CONFIG/g, locations.claudeDesktopConfig).replace(/\$AGENTS_HOME/g, getAgentsHome());
145
+ }
146
+ function resolveProviderConfigPath(provider, scope, projectDir = process.cwd()) {
147
+ if (scope === "global") {
148
+ return provider.configPathGlobal;
149
+ }
150
+ if (!provider.configPathProject) {
151
+ return null;
152
+ }
153
+ return resolveProjectPath(provider.configPathProject, projectDir);
154
+ }
155
+ function resolvePreferredConfigScope(provider, useGlobalFlag) {
156
+ if (useGlobalFlag) {
157
+ return "global";
158
+ }
159
+ return provider.configPathProject ? "project" : "global";
160
+ }
161
+ function resolveProviderSkillsDir(provider, scope, projectDir = process.cwd()) {
162
+ if (scope === "global") {
163
+ return provider.pathSkills;
164
+ }
165
+ return resolveProjectPath(provider.pathProjectSkills, projectDir);
166
+ }
167
+ function resolveProviderSkillsDirs(provider, scope, projectDir = process.cwd()) {
168
+ const vendorPath = resolveProviderSkillsDir(provider, scope, projectDir);
169
+ const precedence = provider.capabilities?.skills?.precedence ?? "vendor-only";
170
+ const resolveAgentsPath = () => {
171
+ if (scope === "global") {
172
+ return provider.capabilities?.skills?.agentsGlobalPath ?? null;
173
+ }
174
+ const projectRelative = provider.capabilities?.skills?.agentsProjectPath ?? null;
175
+ return projectRelative ? join2(projectDir, projectRelative) : null;
176
+ };
177
+ switch (precedence) {
178
+ case "vendor-only":
179
+ return [vendorPath];
180
+ case "agents-canonical": {
181
+ const agentsPath = resolveAgentsPath();
182
+ return agentsPath ? [agentsPath] : [vendorPath];
183
+ }
184
+ case "agents-first": {
185
+ const agentsPath = resolveAgentsPath();
186
+ return agentsPath ? [agentsPath, vendorPath] : [vendorPath];
187
+ }
188
+ case "agents-supported": {
189
+ const agentsPath = resolveAgentsPath();
190
+ return agentsPath ? [vendorPath, agentsPath] : [vendorPath];
191
+ }
192
+ case "vendor-global-agents-project": {
193
+ if (scope === "global") {
194
+ return [vendorPath];
195
+ }
196
+ const agentsPath = resolveAgentsPath();
197
+ return agentsPath ? [agentsPath, vendorPath] : [vendorPath];
198
+ }
199
+ default:
200
+ return [vendorPath];
201
+ }
202
+ }
203
+ function resolveProviderProjectPath(provider, projectDir = process.cwd()) {
204
+ return resolveProjectPath(provider.pathProject, projectDir);
205
+ }
206
+ function resolveProvidersRegistryPath(startDir) {
207
+ const candidates = [
208
+ join2(startDir, "..", "..", "..", "providers", "registry.json"),
209
+ join2(startDir, "..", "providers", "registry.json")
210
+ ];
211
+ for (const candidate of candidates) {
212
+ if (existsSync(candidate)) {
213
+ return candidate;
214
+ }
215
+ }
216
+ let current = startDir;
217
+ for (let i = 0; i < 8; i += 1) {
218
+ const candidate = join2(current, "providers", "registry.json");
219
+ if (existsSync(candidate)) {
220
+ return candidate;
221
+ }
222
+ current = dirname(current);
223
+ }
224
+ throw new Error(`Cannot find providers/registry.json (searched from ${startDir})`);
225
+ }
226
+ function normalizeSkillSubPath(path) {
227
+ if (!path) return void 0;
228
+ const normalized = path.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/SKILL\.md$/i, "").trim();
229
+ return normalized.length > 0 ? normalized : void 0;
230
+ }
231
+ function buildSkillSubPathCandidates(marketplacePath, parsedPath) {
232
+ const candidates = [];
233
+ const base = normalizeSkillSubPath(marketplacePath);
234
+ const parsed = normalizeSkillSubPath(parsedPath);
235
+ if (base) candidates.push(base);
236
+ if (parsed) candidates.push(parsed);
237
+ const knownPrefixes = [".agents", ".claude"];
238
+ for (const value of [base, parsed]) {
239
+ if (!value || !value.startsWith("skills/")) continue;
240
+ for (const prefix of knownPrefixes) {
241
+ candidates.push(`${prefix}/${value}`);
242
+ }
243
+ }
244
+ if (candidates.length === 0) {
245
+ candidates.push(void 0);
246
+ }
247
+ return Array.from(new Set(candidates));
248
+ }
249
+
250
+ export {
251
+ __export,
252
+ getPlatformPaths,
253
+ getSystemInfo,
254
+ _resetPlatformPathsCache,
255
+ getPlatformLocations,
256
+ getAgentsHome,
257
+ getProjectAgentsDir,
258
+ getCanonicalSkillsDir,
259
+ getLockFilePath,
260
+ getAgentsMcpDir,
261
+ getAgentsMcpServersPath,
262
+ getAgentsInstructFile,
263
+ getAgentsConfigPath,
264
+ getAgentsWikiDir,
265
+ getAgentsSpecDir,
266
+ getAgentsLinksDir,
267
+ resolveRegistryTemplatePath,
268
+ resolveProviderConfigPath,
269
+ resolvePreferredConfigScope,
270
+ resolveProviderSkillsDir,
271
+ resolveProviderSkillsDirs,
272
+ resolveProviderProjectPath,
273
+ resolveProvidersRegistryPath,
274
+ buildSkillSubPathCandidates
275
+ };
276
+ //# sourceMappingURL=chunk-TI6WOJDG.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\nimport envPaths from 'env-paths';\nimport { arch, homedir, hostname, platform, release } from 'node:os';\nimport { isAbsolute, join, resolve } from 'node:path';\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 = 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 * 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`, and `$AGENTS_HOME` with their\n * actual platform-specific values. Used to resolve paths from the provider\n * 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}\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 if (scope === \"global\") {\n return provider.configPathGlobal;\n }\n if (!provider.configPathProject) {\n return null;\n }\n return resolveProjectPath(provider.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(provider: Provider, useGlobalFlag?: boolean): PathScope {\n if (useGlobalFlag) {\n return \"global\";\n }\n return provider.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.replace(/\\\\/g, \"/\").replace(/^\\/+/, \"\").replace(/\\/SKILL\\.md$/i, \"\").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 || !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,OAAO,cAAc;AACrB,SAAS,MAAM,SAAS,UAAU,UAAU,eAAe;AAC3D,SAAS,YAAY,MAAM,eAAe;AAE1C,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,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AC5C,QAAM,OAAO,sBAAsB,eAAe;AAClD,QAAM,SAAS,sBAAsB,UAAU;AAE/C,MAAI,KAAM,YAAW,KAAK,IAAI;AAC9B,MAAI,OAAQ,YAAW,KAAK,MAAM;AAElC,QAAM,gBAAgB,CAAC,WAAW,SAAS;AAC3C,aAAW,SAAS,CAAC,MAAM,MAAM,GAAG;AAClC,QAAI,CAAC,SAAS,CAAC,MAAM,WAAW,SAAS,EAAG;AAC5C,eAAW,UAAU,eAAe;AAClC,iBAAW,KAAK,GAAG,MAAM,IAAI,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":["homedir","join","homedir","platform","join","config"]}
@@ -1,19 +1,21 @@
1
+ import {
2
+ getAllProviders,
3
+ groupByInstructFile,
4
+ injectAll
5
+ } from "./chunk-O7IVK5JY.js";
1
6
  import {
2
7
  __export,
3
8
  getAgentsConfigPath,
4
9
  getAgentsHome,
5
10
  getAgentsMcpDir,
6
11
  getAgentsMcpServersPath,
7
- getAllProviders,
8
12
  getCanonicalSkillsDir,
9
13
  getLockFilePath,
10
14
  getPlatformLocations,
11
- groupByInstructFile,
12
- injectAll,
13
15
  resolveProviderConfigPath,
14
16
  resolveProviderProjectPath,
15
17
  resolveProviderSkillsDirs
16
- } from "./chunk-CPHF5IM4.js";
18
+ } from "./chunk-TI6WOJDG.js";
17
19
 
18
20
  // src/core/formats/utils.ts
19
21
  function deepMerge(target, source) {
@@ -1752,8 +1754,11 @@ function isMarketplaceScoped(input) {
1752
1754
  // src/core/network/fetch.ts
1753
1755
  var DEFAULT_FETCH_TIMEOUT_MS = 1e4;
1754
1756
  var NetworkError = class extends Error {
1757
+ /** Classification of the failure. */
1755
1758
  kind;
1759
+ /** URL that was being fetched. */
1756
1760
  url;
1761
+ /** HTTP status code (only present for `"http"` kind). */
1757
1762
  status;
1758
1763
  constructor(message, kind, url, status) {
1759
1764
  super(message);
@@ -1823,7 +1828,15 @@ function toResult(skill) {
1823
1828
  };
1824
1829
  }
1825
1830
  var SkillsMPAdapter = class {
1831
+ /** The marketplace identifier used in search results. */
1826
1832
  name = "agentskills.in";
1833
+ /**
1834
+ * Search for skills by query string.
1835
+ *
1836
+ * @param query - Search query to match against skill names and descriptions.
1837
+ * @param limit - Maximum number of results to return.
1838
+ * @returns Array of marketplace results sorted by stars.
1839
+ */
1827
1840
  async search(query, limit = 20) {
1828
1841
  const params = new URLSearchParams({
1829
1842
  search: query,
@@ -1835,6 +1848,12 @@ var SkillsMPAdapter = class {
1835
1848
  const data = await response.json();
1836
1849
  return data.skills.map(toResult);
1837
1850
  }
1851
+ /**
1852
+ * Look up a specific skill by its scoped name.
1853
+ *
1854
+ * @param scopedName - The scoped skill name (e.g. `"@author/skill-name"`).
1855
+ * @returns The matching marketplace result, or `null` if not found.
1856
+ */
1838
1857
  async getSkill(scopedName) {
1839
1858
  const parts = parseScopedName(scopedName);
1840
1859
  const searchTerms = parts ? [parts.name, `${parts.author} ${parts.name}`, scopedName] : [scopedName];
@@ -1877,7 +1896,15 @@ function toResult2(skill) {
1877
1896
  };
1878
1897
  }
1879
1898
  var SkillsShAdapter = class {
1899
+ /** The marketplace identifier used in search results. */
1880
1900
  name = "skills.sh";
1901
+ /**
1902
+ * Search for skills by query string.
1903
+ *
1904
+ * @param query - Search query to match against skill names.
1905
+ * @param limit - Maximum number of results to return.
1906
+ * @returns Array of marketplace results.
1907
+ */
1881
1908
  async search(query, limit = 20) {
1882
1909
  const params = new URLSearchParams({
1883
1910
  q: query,
@@ -1888,6 +1915,12 @@ var SkillsShAdapter = class {
1888
1915
  const data = await response.json();
1889
1916
  return data.results.map(toResult2);
1890
1917
  }
1918
+ /**
1919
+ * Look up a specific skill by its scoped name.
1920
+ *
1921
+ * @param scopedName - The scoped skill name (e.g. `"@author/skill-name"`).
1922
+ * @returns The matching marketplace result, or `null` if not found.
1923
+ */
1891
1924
  async getSkill(scopedName) {
1892
1925
  const results = await this.search(scopedName, 5);
1893
1926
  return results.find((r) => r.scopedName === scopedName) ?? null;
@@ -1896,6 +1929,7 @@ var SkillsShAdapter = class {
1896
1929
 
1897
1930
  // src/core/marketplace/client.ts
1898
1931
  var MarketplaceUnavailableError = class extends Error {
1932
+ /** Per-adapter failure messages. */
1899
1933
  details;
1900
1934
  constructor(message, details) {
1901
1935
  super(message);
@@ -1904,6 +1938,7 @@ var MarketplaceUnavailableError = class extends Error {
1904
1938
  }
1905
1939
  };
1906
1940
  var MarketplaceClient = class {
1941
+ /** Configured marketplace adapters. */
1907
1942
  adapters;
1908
1943
  /**
1909
1944
  * Create a new marketplace client.
@@ -3570,4 +3605,4 @@ export {
3570
3605
  toSarif,
3571
3606
  validateSkill
3572
3607
  };
3573
- //# sourceMappingURL=chunk-LDTYDQGR.js.map
3608
+ //# sourceMappingURL=chunk-ZF4W3K5H.js.map