@cleocode/caamp 1.0.5 → 1.1.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.
- package/README.md +0 -0
- package/dist/{chunk-HUMRYJPE.js → chunk-7YV3KXEJ.js} +397 -61
- package/dist/chunk-7YV3KXEJ.js.map +1 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +20 -20
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +270 -86
- package/dist/index.js +17 -1
- package/dist/index.js.map +0 -0
- package/package.json +6 -4
- package/providers/registry.json +0 -0
- package/dist/chunk-HUMRYJPE.js.map +0 -1
package/README.md
CHANGED
|
File without changes
|
|
@@ -100,6 +100,36 @@ async function injectAll(providers, projectDir, scope, content) {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// src/core/instructions/templates.ts
|
|
103
|
+
function buildInjectionContent(template) {
|
|
104
|
+
const lines = [];
|
|
105
|
+
for (const ref of template.references) {
|
|
106
|
+
lines.push(ref);
|
|
107
|
+
}
|
|
108
|
+
if (template.content && template.content.length > 0) {
|
|
109
|
+
if (lines.length > 0) {
|
|
110
|
+
lines.push("");
|
|
111
|
+
}
|
|
112
|
+
lines.push(...template.content);
|
|
113
|
+
}
|
|
114
|
+
return lines.join("\n");
|
|
115
|
+
}
|
|
116
|
+
function parseInjectionContent(content) {
|
|
117
|
+
const references = [];
|
|
118
|
+
const contentLines = [];
|
|
119
|
+
for (const line of content.split("\n")) {
|
|
120
|
+
const trimmed = line.trim();
|
|
121
|
+
if (!trimmed) continue;
|
|
122
|
+
if (trimmed.startsWith("@")) {
|
|
123
|
+
references.push(trimmed);
|
|
124
|
+
} else {
|
|
125
|
+
contentLines.push(line);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
references,
|
|
130
|
+
content: contentLines.length > 0 ? contentLines : void 0
|
|
131
|
+
};
|
|
132
|
+
}
|
|
103
133
|
function generateInjectionContent(options) {
|
|
104
134
|
const lines = [];
|
|
105
135
|
lines.push("## CAAMP Managed Configuration");
|
|
@@ -117,6 +147,16 @@ function generateInjectionContent(options) {
|
|
|
117
147
|
}
|
|
118
148
|
return lines.join("\n");
|
|
119
149
|
}
|
|
150
|
+
function generateSkillsSection(skillNames) {
|
|
151
|
+
if (skillNames.length === 0) return "";
|
|
152
|
+
const lines = [];
|
|
153
|
+
lines.push("### Installed Skills");
|
|
154
|
+
lines.push("");
|
|
155
|
+
for (const name of skillNames) {
|
|
156
|
+
lines.push(`- \`${name}\` - Available via SKILL.md`);
|
|
157
|
+
}
|
|
158
|
+
return lines.join("\n");
|
|
159
|
+
}
|
|
120
160
|
function groupByInstructFile(providers) {
|
|
121
161
|
const groups = /* @__PURE__ */ new Map();
|
|
122
162
|
for (const provider of providers) {
|
|
@@ -155,8 +195,8 @@ function getNestedValue(obj, keyPath) {
|
|
|
155
195
|
}
|
|
156
196
|
async function ensureDir(filePath) {
|
|
157
197
|
const { mkdir: mkdir5 } = await import("fs/promises");
|
|
158
|
-
const { dirname:
|
|
159
|
-
await mkdir5(
|
|
198
|
+
const { dirname: dirname6 } = await import("path");
|
|
199
|
+
await mkdir5(dirname6(filePath), { recursive: true });
|
|
160
200
|
}
|
|
161
201
|
|
|
162
202
|
// src/core/logger.ts
|
|
@@ -2063,9 +2103,250 @@ var MarketplaceClient = class {
|
|
|
2063
2103
|
}
|
|
2064
2104
|
};
|
|
2065
2105
|
|
|
2106
|
+
// src/core/skills/library-loader.ts
|
|
2107
|
+
import { createRequire } from "module";
|
|
2108
|
+
import { existsSync as existsSync11, readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
2109
|
+
import { basename as basename2, dirname as dirname5, join as join6 } from "path";
|
|
2110
|
+
var require2 = createRequire(import.meta.url);
|
|
2111
|
+
function loadLibraryFromModule(root) {
|
|
2112
|
+
let mod;
|
|
2113
|
+
try {
|
|
2114
|
+
mod = require2(root);
|
|
2115
|
+
} catch {
|
|
2116
|
+
throw new Error(`Failed to load skill library module from ${root}`);
|
|
2117
|
+
}
|
|
2118
|
+
const requiredMethods = [
|
|
2119
|
+
"listSkills",
|
|
2120
|
+
"getSkill",
|
|
2121
|
+
"getSkillPath",
|
|
2122
|
+
"getSkillDir",
|
|
2123
|
+
"readSkillContent",
|
|
2124
|
+
"getCoreSkills",
|
|
2125
|
+
"getSkillsByCategory",
|
|
2126
|
+
"getSkillDependencies",
|
|
2127
|
+
"resolveDependencyTree",
|
|
2128
|
+
"listProfiles",
|
|
2129
|
+
"getProfile",
|
|
2130
|
+
"resolveProfile",
|
|
2131
|
+
"listSharedResources",
|
|
2132
|
+
"getSharedResourcePath",
|
|
2133
|
+
"readSharedResource",
|
|
2134
|
+
"listProtocols",
|
|
2135
|
+
"getProtocolPath",
|
|
2136
|
+
"readProtocol",
|
|
2137
|
+
"validateSkillFrontmatter",
|
|
2138
|
+
"validateAll",
|
|
2139
|
+
"getDispatchMatrix"
|
|
2140
|
+
];
|
|
2141
|
+
for (const method of requiredMethods) {
|
|
2142
|
+
if (typeof mod[method] !== "function") {
|
|
2143
|
+
throw new Error(
|
|
2144
|
+
`Skill library at ${root} does not implement required method: ${method}`
|
|
2145
|
+
);
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
if (!mod.version || typeof mod.version !== "string") {
|
|
2149
|
+
throw new Error(`Skill library at ${root} is missing 'version' property`);
|
|
2150
|
+
}
|
|
2151
|
+
if (!mod.libraryRoot || typeof mod.libraryRoot !== "string") {
|
|
2152
|
+
throw new Error(`Skill library at ${root} is missing 'libraryRoot' property`);
|
|
2153
|
+
}
|
|
2154
|
+
return mod;
|
|
2155
|
+
}
|
|
2156
|
+
function buildLibraryFromFiles(root) {
|
|
2157
|
+
const catalogPath = join6(root, "skills.json");
|
|
2158
|
+
if (!existsSync11(catalogPath)) {
|
|
2159
|
+
throw new Error(`No skills.json found at ${root}`);
|
|
2160
|
+
}
|
|
2161
|
+
const catalogData = JSON.parse(readFileSync2(catalogPath, "utf-8"));
|
|
2162
|
+
const entries = catalogData.skills ?? [];
|
|
2163
|
+
const version = catalogData.version ?? "0.0.0";
|
|
2164
|
+
const manifestPath = join6(root, "skills", "manifest.json");
|
|
2165
|
+
let manifest;
|
|
2166
|
+
if (existsSync11(manifestPath)) {
|
|
2167
|
+
manifest = JSON.parse(readFileSync2(manifestPath, "utf-8"));
|
|
2168
|
+
} else {
|
|
2169
|
+
manifest = {
|
|
2170
|
+
$schema: "",
|
|
2171
|
+
_meta: {},
|
|
2172
|
+
dispatch_matrix: { by_task_type: {}, by_keyword: {}, by_protocol: {} },
|
|
2173
|
+
skills: []
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
const profilesDir = join6(root, "profiles");
|
|
2177
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
2178
|
+
if (existsSync11(profilesDir)) {
|
|
2179
|
+
for (const file of readdirSync(profilesDir)) {
|
|
2180
|
+
if (!file.endsWith(".json")) continue;
|
|
2181
|
+
try {
|
|
2182
|
+
const profile = JSON.parse(
|
|
2183
|
+
readFileSync2(join6(profilesDir, file), "utf-8")
|
|
2184
|
+
);
|
|
2185
|
+
profiles.set(profile.name, profile);
|
|
2186
|
+
} catch {
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
const skillMap = /* @__PURE__ */ new Map();
|
|
2191
|
+
for (const entry of entries) {
|
|
2192
|
+
skillMap.set(entry.name, entry);
|
|
2193
|
+
}
|
|
2194
|
+
function getSkillDir2(name) {
|
|
2195
|
+
const entry = skillMap.get(name);
|
|
2196
|
+
if (entry) {
|
|
2197
|
+
return dirname5(join6(root, entry.path));
|
|
2198
|
+
}
|
|
2199
|
+
return join6(root, "skills", name);
|
|
2200
|
+
}
|
|
2201
|
+
function resolveDeps(names, visited = /* @__PURE__ */ new Set()) {
|
|
2202
|
+
const result = [];
|
|
2203
|
+
for (const name of names) {
|
|
2204
|
+
if (visited.has(name)) continue;
|
|
2205
|
+
visited.add(name);
|
|
2206
|
+
const entry = skillMap.get(name);
|
|
2207
|
+
if (entry && entry.dependencies.length > 0) {
|
|
2208
|
+
result.push(...resolveDeps(entry.dependencies, visited));
|
|
2209
|
+
}
|
|
2210
|
+
result.push(name);
|
|
2211
|
+
}
|
|
2212
|
+
return result;
|
|
2213
|
+
}
|
|
2214
|
+
function resolveProfileByName(name, visited = /* @__PURE__ */ new Set()) {
|
|
2215
|
+
if (visited.has(name)) return [];
|
|
2216
|
+
visited.add(name);
|
|
2217
|
+
const profile = profiles.get(name);
|
|
2218
|
+
if (!profile) return [];
|
|
2219
|
+
let skills = [];
|
|
2220
|
+
if (profile.extends) {
|
|
2221
|
+
skills = resolveProfileByName(profile.extends, visited);
|
|
2222
|
+
}
|
|
2223
|
+
skills.push(...profile.skills);
|
|
2224
|
+
return resolveDeps([...new Set(skills)]);
|
|
2225
|
+
}
|
|
2226
|
+
function discoverFiles(dir, ext) {
|
|
2227
|
+
if (!existsSync11(dir)) return [];
|
|
2228
|
+
return readdirSync(dir).filter((f) => f.endsWith(ext)).map((f) => basename2(f, ext));
|
|
2229
|
+
}
|
|
2230
|
+
const library = {
|
|
2231
|
+
version,
|
|
2232
|
+
libraryRoot: root,
|
|
2233
|
+
skills: entries,
|
|
2234
|
+
manifest,
|
|
2235
|
+
listSkills() {
|
|
2236
|
+
return entries.map((e) => e.name);
|
|
2237
|
+
},
|
|
2238
|
+
getSkill(name) {
|
|
2239
|
+
return skillMap.get(name);
|
|
2240
|
+
},
|
|
2241
|
+
getSkillPath(name) {
|
|
2242
|
+
const entry = skillMap.get(name);
|
|
2243
|
+
if (entry) {
|
|
2244
|
+
return join6(root, entry.path);
|
|
2245
|
+
}
|
|
2246
|
+
return join6(root, "skills", name, "SKILL.md");
|
|
2247
|
+
},
|
|
2248
|
+
getSkillDir: getSkillDir2,
|
|
2249
|
+
readSkillContent(name) {
|
|
2250
|
+
const skillPath = library.getSkillPath(name);
|
|
2251
|
+
if (!existsSync11(skillPath)) {
|
|
2252
|
+
throw new Error(`Skill content not found: ${skillPath}`);
|
|
2253
|
+
}
|
|
2254
|
+
return readFileSync2(skillPath, "utf-8");
|
|
2255
|
+
},
|
|
2256
|
+
getCoreSkills() {
|
|
2257
|
+
return entries.filter((e) => e.core);
|
|
2258
|
+
},
|
|
2259
|
+
getSkillsByCategory(category) {
|
|
2260
|
+
return entries.filter((e) => e.category === category);
|
|
2261
|
+
},
|
|
2262
|
+
getSkillDependencies(name) {
|
|
2263
|
+
return skillMap.get(name)?.dependencies ?? [];
|
|
2264
|
+
},
|
|
2265
|
+
resolveDependencyTree(names) {
|
|
2266
|
+
return resolveDeps(names);
|
|
2267
|
+
},
|
|
2268
|
+
listProfiles() {
|
|
2269
|
+
return [...profiles.keys()];
|
|
2270
|
+
},
|
|
2271
|
+
getProfile(name) {
|
|
2272
|
+
return profiles.get(name);
|
|
2273
|
+
},
|
|
2274
|
+
resolveProfile(name) {
|
|
2275
|
+
return resolveProfileByName(name);
|
|
2276
|
+
},
|
|
2277
|
+
listSharedResources() {
|
|
2278
|
+
return discoverFiles(join6(root, "skills", "_shared"), ".md");
|
|
2279
|
+
},
|
|
2280
|
+
getSharedResourcePath(name) {
|
|
2281
|
+
const resourcePath = join6(root, "skills", "_shared", `${name}.md`);
|
|
2282
|
+
return existsSync11(resourcePath) ? resourcePath : void 0;
|
|
2283
|
+
},
|
|
2284
|
+
readSharedResource(name) {
|
|
2285
|
+
const resourcePath = library.getSharedResourcePath(name);
|
|
2286
|
+
if (!resourcePath) return void 0;
|
|
2287
|
+
return readFileSync2(resourcePath, "utf-8");
|
|
2288
|
+
},
|
|
2289
|
+
listProtocols() {
|
|
2290
|
+
const rootProtocols = discoverFiles(join6(root, "protocols"), ".md");
|
|
2291
|
+
if (rootProtocols.length > 0) return rootProtocols;
|
|
2292
|
+
return discoverFiles(join6(root, "skills", "protocols"), ".md");
|
|
2293
|
+
},
|
|
2294
|
+
getProtocolPath(name) {
|
|
2295
|
+
const rootPath = join6(root, "protocols", `${name}.md`);
|
|
2296
|
+
if (existsSync11(rootPath)) return rootPath;
|
|
2297
|
+
const skillsPath = join6(root, "skills", "protocols", `${name}.md`);
|
|
2298
|
+
return existsSync11(skillsPath) ? skillsPath : void 0;
|
|
2299
|
+
},
|
|
2300
|
+
readProtocol(name) {
|
|
2301
|
+
const protocolPath = library.getProtocolPath(name);
|
|
2302
|
+
if (!protocolPath) return void 0;
|
|
2303
|
+
return readFileSync2(protocolPath, "utf-8");
|
|
2304
|
+
},
|
|
2305
|
+
validateSkillFrontmatter(name) {
|
|
2306
|
+
const entry = skillMap.get(name);
|
|
2307
|
+
if (!entry) {
|
|
2308
|
+
return {
|
|
2309
|
+
valid: false,
|
|
2310
|
+
issues: [{ level: "error", field: "name", message: `Skill not found: ${name}` }]
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
const issues = [];
|
|
2314
|
+
if (!entry.name) {
|
|
2315
|
+
issues.push({ level: "error", field: "name", message: "Missing name" });
|
|
2316
|
+
}
|
|
2317
|
+
if (!entry.description) {
|
|
2318
|
+
issues.push({ level: "error", field: "description", message: "Missing description" });
|
|
2319
|
+
}
|
|
2320
|
+
if (!entry.version) {
|
|
2321
|
+
issues.push({ level: "warn", field: "version", message: "Missing version" });
|
|
2322
|
+
}
|
|
2323
|
+
const skillPath = join6(root, entry.path);
|
|
2324
|
+
if (!existsSync11(skillPath)) {
|
|
2325
|
+
issues.push({ level: "error", field: "path", message: `SKILL.md not found at ${entry.path}` });
|
|
2326
|
+
}
|
|
2327
|
+
return {
|
|
2328
|
+
valid: !issues.some((i) => i.level === "error"),
|
|
2329
|
+
issues
|
|
2330
|
+
};
|
|
2331
|
+
},
|
|
2332
|
+
validateAll() {
|
|
2333
|
+
const results = /* @__PURE__ */ new Map();
|
|
2334
|
+
for (const entry of entries) {
|
|
2335
|
+
results.set(entry.name, library.validateSkillFrontmatter(entry.name));
|
|
2336
|
+
}
|
|
2337
|
+
return results;
|
|
2338
|
+
},
|
|
2339
|
+
getDispatchMatrix() {
|
|
2340
|
+
return manifest.dispatch_matrix;
|
|
2341
|
+
}
|
|
2342
|
+
};
|
|
2343
|
+
return library;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2066
2346
|
// src/core/skills/catalog.ts
|
|
2067
2347
|
var catalog_exports = {};
|
|
2068
2348
|
__export(catalog_exports, {
|
|
2349
|
+
clearRegisteredLibrary: () => clearRegisteredLibrary,
|
|
2069
2350
|
getCoreSkills: () => getCoreSkills,
|
|
2070
2351
|
getDispatchMatrix: () => getDispatchMatrix,
|
|
2071
2352
|
getLibraryRoot: () => getLibraryRoot,
|
|
@@ -2088,114 +2369,161 @@ __export(catalog_exports, {
|
|
|
2088
2369
|
readProtocol: () => readProtocol,
|
|
2089
2370
|
readSharedResource: () => readSharedResource,
|
|
2090
2371
|
readSkillContent: () => readSkillContent,
|
|
2372
|
+
registerSkillLibrary: () => registerSkillLibrary,
|
|
2373
|
+
registerSkillLibraryFromPath: () => registerSkillLibraryFromPath,
|
|
2091
2374
|
resolveDependencyTree: () => resolveDependencyTree,
|
|
2092
2375
|
resolveProfile: () => resolveProfile,
|
|
2093
2376
|
validateAll: () => validateAll,
|
|
2094
2377
|
validateSkillFrontmatter: () => validateSkillFrontmatter
|
|
2095
2378
|
});
|
|
2096
|
-
import {
|
|
2097
|
-
|
|
2098
|
-
var
|
|
2099
|
-
function
|
|
2100
|
-
|
|
2379
|
+
import { existsSync as existsSync12 } from "fs";
|
|
2380
|
+
import { join as join7 } from "path";
|
|
2381
|
+
var _library = null;
|
|
2382
|
+
function registerSkillLibrary(library) {
|
|
2383
|
+
_library = library;
|
|
2384
|
+
}
|
|
2385
|
+
function registerSkillLibraryFromPath(root) {
|
|
2386
|
+
const indexPath = join7(root, "index.js");
|
|
2387
|
+
if (existsSync12(indexPath)) {
|
|
2388
|
+
_library = loadLibraryFromModule(root);
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2391
|
+
_library = buildLibraryFromFiles(root);
|
|
2392
|
+
}
|
|
2393
|
+
function clearRegisteredLibrary() {
|
|
2394
|
+
_library = null;
|
|
2395
|
+
}
|
|
2396
|
+
function discoverLibrary() {
|
|
2397
|
+
const envPath = process.env["CAAMP_SKILL_LIBRARY"];
|
|
2398
|
+
if (envPath && existsSync12(envPath)) {
|
|
2101
2399
|
try {
|
|
2102
|
-
|
|
2400
|
+
const indexPath = join7(envPath, "index.js");
|
|
2401
|
+
if (existsSync12(indexPath)) {
|
|
2402
|
+
return loadLibraryFromModule(envPath);
|
|
2403
|
+
}
|
|
2404
|
+
if (existsSync12(join7(envPath, "skills.json"))) {
|
|
2405
|
+
return buildLibraryFromFiles(envPath);
|
|
2406
|
+
}
|
|
2103
2407
|
} catch {
|
|
2104
|
-
throw new Error(
|
|
2105
|
-
"@cleocode/ct-skills is not installed. Run: npm install @cleocode/ct-skills"
|
|
2106
|
-
);
|
|
2107
2408
|
}
|
|
2108
2409
|
}
|
|
2109
|
-
|
|
2410
|
+
const canonicalPath = join7(getAgentsHome(), "skill-library");
|
|
2411
|
+
if (existsSync12(canonicalPath)) {
|
|
2412
|
+
try {
|
|
2413
|
+
const indexPath = join7(canonicalPath, "index.js");
|
|
2414
|
+
if (existsSync12(indexPath)) {
|
|
2415
|
+
return loadLibraryFromModule(canonicalPath);
|
|
2416
|
+
}
|
|
2417
|
+
if (existsSync12(join7(canonicalPath, "skills.json"))) {
|
|
2418
|
+
return buildLibraryFromFiles(canonicalPath);
|
|
2419
|
+
}
|
|
2420
|
+
} catch {
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
return null;
|
|
2424
|
+
}
|
|
2425
|
+
function getLibrary() {
|
|
2426
|
+
if (!_library) {
|
|
2427
|
+
const discovered = discoverLibrary();
|
|
2428
|
+
if (discovered) {
|
|
2429
|
+
_library = discovered;
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
if (!_library) {
|
|
2433
|
+
throw new Error(
|
|
2434
|
+
"No skill library registered. Register one with registerSkillLibraryFromPath() or set the CAAMP_SKILL_LIBRARY environment variable."
|
|
2435
|
+
);
|
|
2436
|
+
}
|
|
2437
|
+
return _library;
|
|
2438
|
+
}
|
|
2439
|
+
function isCatalogAvailable() {
|
|
2440
|
+
try {
|
|
2441
|
+
getLibrary();
|
|
2442
|
+
return true;
|
|
2443
|
+
} catch {
|
|
2444
|
+
return false;
|
|
2445
|
+
}
|
|
2110
2446
|
}
|
|
2111
2447
|
function getSkills() {
|
|
2112
|
-
return
|
|
2448
|
+
return getLibrary().skills;
|
|
2113
2449
|
}
|
|
2114
2450
|
function getManifest() {
|
|
2115
|
-
return
|
|
2451
|
+
return getLibrary().manifest;
|
|
2116
2452
|
}
|
|
2117
2453
|
function listSkills() {
|
|
2118
|
-
return
|
|
2454
|
+
return getLibrary().listSkills();
|
|
2119
2455
|
}
|
|
2120
2456
|
function getSkill(name) {
|
|
2121
|
-
return
|
|
2457
|
+
return getLibrary().getSkill(name);
|
|
2122
2458
|
}
|
|
2123
2459
|
function getSkillPath(name) {
|
|
2124
|
-
return
|
|
2460
|
+
return getLibrary().getSkillPath(name);
|
|
2125
2461
|
}
|
|
2126
2462
|
function getSkillDir(name) {
|
|
2127
|
-
return
|
|
2463
|
+
return getLibrary().getSkillDir(name);
|
|
2128
2464
|
}
|
|
2129
2465
|
function readSkillContent(name) {
|
|
2130
|
-
return
|
|
2466
|
+
return getLibrary().readSkillContent(name);
|
|
2131
2467
|
}
|
|
2132
2468
|
function getCoreSkills() {
|
|
2133
|
-
return
|
|
2469
|
+
return getLibrary().getCoreSkills();
|
|
2134
2470
|
}
|
|
2135
2471
|
function getSkillsByCategory(category) {
|
|
2136
|
-
return
|
|
2472
|
+
return getLibrary().getSkillsByCategory(category);
|
|
2137
2473
|
}
|
|
2138
2474
|
function getSkillDependencies(name) {
|
|
2139
|
-
return
|
|
2475
|
+
return getLibrary().getSkillDependencies(name);
|
|
2140
2476
|
}
|
|
2141
2477
|
function resolveDependencyTree(names) {
|
|
2142
|
-
return
|
|
2478
|
+
return getLibrary().resolveDependencyTree(names);
|
|
2143
2479
|
}
|
|
2144
2480
|
function listProfiles() {
|
|
2145
|
-
return
|
|
2481
|
+
return getLibrary().listProfiles();
|
|
2146
2482
|
}
|
|
2147
2483
|
function getProfile(name) {
|
|
2148
|
-
return
|
|
2484
|
+
return getLibrary().getProfile(name);
|
|
2149
2485
|
}
|
|
2150
2486
|
function resolveProfile(name) {
|
|
2151
|
-
return
|
|
2487
|
+
return getLibrary().resolveProfile(name);
|
|
2152
2488
|
}
|
|
2153
2489
|
function listSharedResources() {
|
|
2154
|
-
return
|
|
2490
|
+
return getLibrary().listSharedResources();
|
|
2155
2491
|
}
|
|
2156
2492
|
function getSharedResourcePath(name) {
|
|
2157
|
-
return
|
|
2493
|
+
return getLibrary().getSharedResourcePath(name);
|
|
2158
2494
|
}
|
|
2159
2495
|
function readSharedResource(name) {
|
|
2160
|
-
return
|
|
2496
|
+
return getLibrary().readSharedResource(name);
|
|
2161
2497
|
}
|
|
2162
2498
|
function listProtocols() {
|
|
2163
|
-
return
|
|
2499
|
+
return getLibrary().listProtocols();
|
|
2164
2500
|
}
|
|
2165
2501
|
function getProtocolPath(name) {
|
|
2166
|
-
return
|
|
2502
|
+
return getLibrary().getProtocolPath(name);
|
|
2167
2503
|
}
|
|
2168
2504
|
function readProtocol(name) {
|
|
2169
|
-
return
|
|
2505
|
+
return getLibrary().readProtocol(name);
|
|
2170
2506
|
}
|
|
2171
2507
|
function validateSkillFrontmatter(name) {
|
|
2172
|
-
return
|
|
2508
|
+
return getLibrary().validateSkillFrontmatter(name);
|
|
2173
2509
|
}
|
|
2174
2510
|
function validateAll() {
|
|
2175
|
-
return
|
|
2511
|
+
return getLibrary().validateAll();
|
|
2176
2512
|
}
|
|
2177
2513
|
function getDispatchMatrix() {
|
|
2178
|
-
return
|
|
2514
|
+
return getLibrary().getDispatchMatrix();
|
|
2179
2515
|
}
|
|
2180
2516
|
function getVersion() {
|
|
2181
|
-
return
|
|
2517
|
+
return getLibrary().version;
|
|
2182
2518
|
}
|
|
2183
2519
|
function getLibraryRoot() {
|
|
2184
|
-
return
|
|
2185
|
-
}
|
|
2186
|
-
function isCatalogAvailable() {
|
|
2187
|
-
try {
|
|
2188
|
-
getCtSkills();
|
|
2189
|
-
return true;
|
|
2190
|
-
} catch {
|
|
2191
|
-
return false;
|
|
2192
|
-
}
|
|
2520
|
+
return getLibrary().libraryRoot;
|
|
2193
2521
|
}
|
|
2194
2522
|
|
|
2195
2523
|
// src/core/skills/discovery.ts
|
|
2196
2524
|
import { readFile as readFile7, readdir } from "fs/promises";
|
|
2197
|
-
import { existsSync as
|
|
2198
|
-
import { join as
|
|
2525
|
+
import { existsSync as existsSync13 } from "fs";
|
|
2526
|
+
import { join as join8 } from "path";
|
|
2199
2527
|
import matter from "gray-matter";
|
|
2200
2528
|
async function parseSkillFile(filePath) {
|
|
2201
2529
|
try {
|
|
@@ -2219,8 +2547,8 @@ async function parseSkillFile(filePath) {
|
|
|
2219
2547
|
}
|
|
2220
2548
|
}
|
|
2221
2549
|
async function discoverSkill(skillDir) {
|
|
2222
|
-
const skillFile =
|
|
2223
|
-
if (!
|
|
2550
|
+
const skillFile = join8(skillDir, "SKILL.md");
|
|
2551
|
+
if (!existsSync13(skillFile)) return null;
|
|
2224
2552
|
const metadata = await parseSkillFile(skillFile);
|
|
2225
2553
|
if (!metadata) return null;
|
|
2226
2554
|
return {
|
|
@@ -2231,12 +2559,12 @@ async function discoverSkill(skillDir) {
|
|
|
2231
2559
|
};
|
|
2232
2560
|
}
|
|
2233
2561
|
async function discoverSkills(rootDir) {
|
|
2234
|
-
if (!
|
|
2562
|
+
if (!existsSync13(rootDir)) return [];
|
|
2235
2563
|
const entries = await readdir(rootDir, { withFileTypes: true });
|
|
2236
2564
|
const skills = [];
|
|
2237
2565
|
for (const entry of entries) {
|
|
2238
2566
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
2239
|
-
const skillDir =
|
|
2567
|
+
const skillDir = join8(rootDir, entry.name);
|
|
2240
2568
|
const skill = await discoverSkill(skillDir);
|
|
2241
2569
|
if (skill) {
|
|
2242
2570
|
skills.push(skill);
|
|
@@ -2616,7 +2944,7 @@ async function recommendSkills2(query, criteria, options = {}) {
|
|
|
2616
2944
|
}
|
|
2617
2945
|
|
|
2618
2946
|
// src/core/skills/audit/scanner.ts
|
|
2619
|
-
import { existsSync as
|
|
2947
|
+
import { existsSync as existsSync14 } from "fs";
|
|
2620
2948
|
import { readFile as readFile8 } from "fs/promises";
|
|
2621
2949
|
|
|
2622
2950
|
// src/core/skills/audit/rules.ts
|
|
@@ -2996,7 +3324,7 @@ var SEVERITY_WEIGHTS = {
|
|
|
2996
3324
|
info: 0
|
|
2997
3325
|
};
|
|
2998
3326
|
async function scanFile(filePath, rules) {
|
|
2999
|
-
if (!
|
|
3327
|
+
if (!existsSync14(filePath)) {
|
|
3000
3328
|
return { file: filePath, findings: [], score: 100, passed: true };
|
|
3001
3329
|
}
|
|
3002
3330
|
const content = await readFile8(filePath, "utf-8");
|
|
@@ -3028,14 +3356,14 @@ async function scanFile(filePath, rules) {
|
|
|
3028
3356
|
}
|
|
3029
3357
|
async function scanDirectory(dirPath) {
|
|
3030
3358
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
3031
|
-
const { join:
|
|
3032
|
-
if (!
|
|
3359
|
+
const { join: join9 } = await import("path");
|
|
3360
|
+
if (!existsSync14(dirPath)) return [];
|
|
3033
3361
|
const entries = await readdir2(dirPath, { withFileTypes: true });
|
|
3034
3362
|
const results = [];
|
|
3035
3363
|
for (const entry of entries) {
|
|
3036
3364
|
if (entry.isDirectory() || entry.isSymbolicLink()) {
|
|
3037
|
-
const skillFile =
|
|
3038
|
-
if (
|
|
3365
|
+
const skillFile = join9(dirPath, entry.name, "SKILL.md");
|
|
3366
|
+
if (existsSync14(skillFile)) {
|
|
3039
3367
|
results.push(await scanFile(skillFile));
|
|
3040
3368
|
}
|
|
3041
3369
|
}
|
|
@@ -3088,7 +3416,7 @@ function toSarif(results) {
|
|
|
3088
3416
|
|
|
3089
3417
|
// src/core/skills/validator.ts
|
|
3090
3418
|
import { readFile as readFile9 } from "fs/promises";
|
|
3091
|
-
import { existsSync as
|
|
3419
|
+
import { existsSync as existsSync15 } from "fs";
|
|
3092
3420
|
import matter2 from "gray-matter";
|
|
3093
3421
|
var RESERVED_NAMES = [
|
|
3094
3422
|
"anthropic",
|
|
@@ -3109,7 +3437,7 @@ var WARN_BODY_LINES = 500;
|
|
|
3109
3437
|
var WARN_DESCRIPTION_LENGTH = 50;
|
|
3110
3438
|
async function validateSkill(filePath) {
|
|
3111
3439
|
const issues = [];
|
|
3112
|
-
if (!
|
|
3440
|
+
if (!existsSync15(filePath)) {
|
|
3113
3441
|
return {
|
|
3114
3442
|
valid: false,
|
|
3115
3443
|
issues: [{ level: "error", field: "file", message: "File does not exist" }],
|
|
@@ -3227,7 +3555,10 @@ export {
|
|
|
3227
3555
|
removeInjection,
|
|
3228
3556
|
checkAllInjections,
|
|
3229
3557
|
injectAll,
|
|
3558
|
+
buildInjectionContent,
|
|
3559
|
+
parseInjectionContent,
|
|
3230
3560
|
generateInjectionContent,
|
|
3561
|
+
generateSkillsSection,
|
|
3231
3562
|
groupByInstructFile,
|
|
3232
3563
|
deepMerge,
|
|
3233
3564
|
getNestedValue,
|
|
@@ -3301,12 +3632,17 @@ export {
|
|
|
3301
3632
|
isMarketplaceScoped,
|
|
3302
3633
|
formatNetworkError,
|
|
3303
3634
|
MarketplaceClient,
|
|
3635
|
+
loadLibraryFromModule,
|
|
3636
|
+
buildLibraryFromFiles,
|
|
3637
|
+
registerSkillLibrary,
|
|
3638
|
+
registerSkillLibraryFromPath,
|
|
3639
|
+
clearRegisteredLibrary,
|
|
3640
|
+
isCatalogAvailable,
|
|
3304
3641
|
listSkills,
|
|
3305
3642
|
getSkill,
|
|
3306
3643
|
getSkillDir,
|
|
3307
3644
|
listProfiles,
|
|
3308
3645
|
resolveProfile,
|
|
3309
|
-
isCatalogAvailable,
|
|
3310
3646
|
catalog_exports,
|
|
3311
3647
|
parseSkillFile,
|
|
3312
3648
|
discoverSkill,
|
|
@@ -3330,4 +3666,4 @@ export {
|
|
|
3330
3666
|
toSarif,
|
|
3331
3667
|
validateSkill
|
|
3332
3668
|
};
|
|
3333
|
-
//# sourceMappingURL=chunk-
|
|
3669
|
+
//# sourceMappingURL=chunk-7YV3KXEJ.js.map
|