@cleocode/caamp 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/{chunk-HUMRYJPE.js → chunk-KAJJ6L6H.js} +393 -61
- package/dist/chunk-KAJJ6L6H.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 +4 -2
- 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,246 @@ 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
|
+
return discoverFiles(join6(root, "skills", "protocols"), ".md");
|
|
2291
|
+
},
|
|
2292
|
+
getProtocolPath(name) {
|
|
2293
|
+
const protocolPath = join6(root, "skills", "protocols", `${name}.md`);
|
|
2294
|
+
return existsSync11(protocolPath) ? protocolPath : void 0;
|
|
2295
|
+
},
|
|
2296
|
+
readProtocol(name) {
|
|
2297
|
+
const protocolPath = library.getProtocolPath(name);
|
|
2298
|
+
if (!protocolPath) return void 0;
|
|
2299
|
+
return readFileSync2(protocolPath, "utf-8");
|
|
2300
|
+
},
|
|
2301
|
+
validateSkillFrontmatter(name) {
|
|
2302
|
+
const entry = skillMap.get(name);
|
|
2303
|
+
if (!entry) {
|
|
2304
|
+
return {
|
|
2305
|
+
valid: false,
|
|
2306
|
+
issues: [{ level: "error", field: "name", message: `Skill not found: ${name}` }]
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
const issues = [];
|
|
2310
|
+
if (!entry.name) {
|
|
2311
|
+
issues.push({ level: "error", field: "name", message: "Missing name" });
|
|
2312
|
+
}
|
|
2313
|
+
if (!entry.description) {
|
|
2314
|
+
issues.push({ level: "error", field: "description", message: "Missing description" });
|
|
2315
|
+
}
|
|
2316
|
+
if (!entry.version) {
|
|
2317
|
+
issues.push({ level: "warn", field: "version", message: "Missing version" });
|
|
2318
|
+
}
|
|
2319
|
+
const skillPath = join6(root, entry.path);
|
|
2320
|
+
if (!existsSync11(skillPath)) {
|
|
2321
|
+
issues.push({ level: "error", field: "path", message: `SKILL.md not found at ${entry.path}` });
|
|
2322
|
+
}
|
|
2323
|
+
return {
|
|
2324
|
+
valid: !issues.some((i) => i.level === "error"),
|
|
2325
|
+
issues
|
|
2326
|
+
};
|
|
2327
|
+
},
|
|
2328
|
+
validateAll() {
|
|
2329
|
+
const results = /* @__PURE__ */ new Map();
|
|
2330
|
+
for (const entry of entries) {
|
|
2331
|
+
results.set(entry.name, library.validateSkillFrontmatter(entry.name));
|
|
2332
|
+
}
|
|
2333
|
+
return results;
|
|
2334
|
+
},
|
|
2335
|
+
getDispatchMatrix() {
|
|
2336
|
+
return manifest.dispatch_matrix;
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
return library;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2066
2342
|
// src/core/skills/catalog.ts
|
|
2067
2343
|
var catalog_exports = {};
|
|
2068
2344
|
__export(catalog_exports, {
|
|
2345
|
+
clearRegisteredLibrary: () => clearRegisteredLibrary,
|
|
2069
2346
|
getCoreSkills: () => getCoreSkills,
|
|
2070
2347
|
getDispatchMatrix: () => getDispatchMatrix,
|
|
2071
2348
|
getLibraryRoot: () => getLibraryRoot,
|
|
@@ -2088,114 +2365,161 @@ __export(catalog_exports, {
|
|
|
2088
2365
|
readProtocol: () => readProtocol,
|
|
2089
2366
|
readSharedResource: () => readSharedResource,
|
|
2090
2367
|
readSkillContent: () => readSkillContent,
|
|
2368
|
+
registerSkillLibrary: () => registerSkillLibrary,
|
|
2369
|
+
registerSkillLibraryFromPath: () => registerSkillLibraryFromPath,
|
|
2091
2370
|
resolveDependencyTree: () => resolveDependencyTree,
|
|
2092
2371
|
resolveProfile: () => resolveProfile,
|
|
2093
2372
|
validateAll: () => validateAll,
|
|
2094
2373
|
validateSkillFrontmatter: () => validateSkillFrontmatter
|
|
2095
2374
|
});
|
|
2096
|
-
import {
|
|
2097
|
-
|
|
2098
|
-
var
|
|
2099
|
-
function
|
|
2100
|
-
|
|
2375
|
+
import { existsSync as existsSync12 } from "fs";
|
|
2376
|
+
import { join as join7 } from "path";
|
|
2377
|
+
var _library = null;
|
|
2378
|
+
function registerSkillLibrary(library) {
|
|
2379
|
+
_library = library;
|
|
2380
|
+
}
|
|
2381
|
+
function registerSkillLibraryFromPath(root) {
|
|
2382
|
+
const indexPath = join7(root, "index.js");
|
|
2383
|
+
if (existsSync12(indexPath)) {
|
|
2384
|
+
_library = loadLibraryFromModule(root);
|
|
2385
|
+
return;
|
|
2386
|
+
}
|
|
2387
|
+
_library = buildLibraryFromFiles(root);
|
|
2388
|
+
}
|
|
2389
|
+
function clearRegisteredLibrary() {
|
|
2390
|
+
_library = null;
|
|
2391
|
+
}
|
|
2392
|
+
function discoverLibrary() {
|
|
2393
|
+
const envPath = process.env["CAAMP_SKILL_LIBRARY"];
|
|
2394
|
+
if (envPath && existsSync12(envPath)) {
|
|
2101
2395
|
try {
|
|
2102
|
-
|
|
2396
|
+
const indexPath = join7(envPath, "index.js");
|
|
2397
|
+
if (existsSync12(indexPath)) {
|
|
2398
|
+
return loadLibraryFromModule(envPath);
|
|
2399
|
+
}
|
|
2400
|
+
if (existsSync12(join7(envPath, "skills.json"))) {
|
|
2401
|
+
return buildLibraryFromFiles(envPath);
|
|
2402
|
+
}
|
|
2103
2403
|
} catch {
|
|
2104
|
-
throw new Error(
|
|
2105
|
-
"@cleocode/ct-skills is not installed. Run: npm install @cleocode/ct-skills"
|
|
2106
|
-
);
|
|
2107
2404
|
}
|
|
2108
2405
|
}
|
|
2109
|
-
|
|
2406
|
+
const canonicalPath = join7(getAgentsHome(), "skill-library");
|
|
2407
|
+
if (existsSync12(canonicalPath)) {
|
|
2408
|
+
try {
|
|
2409
|
+
const indexPath = join7(canonicalPath, "index.js");
|
|
2410
|
+
if (existsSync12(indexPath)) {
|
|
2411
|
+
return loadLibraryFromModule(canonicalPath);
|
|
2412
|
+
}
|
|
2413
|
+
if (existsSync12(join7(canonicalPath, "skills.json"))) {
|
|
2414
|
+
return buildLibraryFromFiles(canonicalPath);
|
|
2415
|
+
}
|
|
2416
|
+
} catch {
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
return null;
|
|
2420
|
+
}
|
|
2421
|
+
function getLibrary() {
|
|
2422
|
+
if (!_library) {
|
|
2423
|
+
const discovered = discoverLibrary();
|
|
2424
|
+
if (discovered) {
|
|
2425
|
+
_library = discovered;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
if (!_library) {
|
|
2429
|
+
throw new Error(
|
|
2430
|
+
"No skill library registered. Register one with registerSkillLibraryFromPath() or set the CAAMP_SKILL_LIBRARY environment variable."
|
|
2431
|
+
);
|
|
2432
|
+
}
|
|
2433
|
+
return _library;
|
|
2434
|
+
}
|
|
2435
|
+
function isCatalogAvailable() {
|
|
2436
|
+
try {
|
|
2437
|
+
getLibrary();
|
|
2438
|
+
return true;
|
|
2439
|
+
} catch {
|
|
2440
|
+
return false;
|
|
2441
|
+
}
|
|
2110
2442
|
}
|
|
2111
2443
|
function getSkills() {
|
|
2112
|
-
return
|
|
2444
|
+
return getLibrary().skills;
|
|
2113
2445
|
}
|
|
2114
2446
|
function getManifest() {
|
|
2115
|
-
return
|
|
2447
|
+
return getLibrary().manifest;
|
|
2116
2448
|
}
|
|
2117
2449
|
function listSkills() {
|
|
2118
|
-
return
|
|
2450
|
+
return getLibrary().listSkills();
|
|
2119
2451
|
}
|
|
2120
2452
|
function getSkill(name) {
|
|
2121
|
-
return
|
|
2453
|
+
return getLibrary().getSkill(name);
|
|
2122
2454
|
}
|
|
2123
2455
|
function getSkillPath(name) {
|
|
2124
|
-
return
|
|
2456
|
+
return getLibrary().getSkillPath(name);
|
|
2125
2457
|
}
|
|
2126
2458
|
function getSkillDir(name) {
|
|
2127
|
-
return
|
|
2459
|
+
return getLibrary().getSkillDir(name);
|
|
2128
2460
|
}
|
|
2129
2461
|
function readSkillContent(name) {
|
|
2130
|
-
return
|
|
2462
|
+
return getLibrary().readSkillContent(name);
|
|
2131
2463
|
}
|
|
2132
2464
|
function getCoreSkills() {
|
|
2133
|
-
return
|
|
2465
|
+
return getLibrary().getCoreSkills();
|
|
2134
2466
|
}
|
|
2135
2467
|
function getSkillsByCategory(category) {
|
|
2136
|
-
return
|
|
2468
|
+
return getLibrary().getSkillsByCategory(category);
|
|
2137
2469
|
}
|
|
2138
2470
|
function getSkillDependencies(name) {
|
|
2139
|
-
return
|
|
2471
|
+
return getLibrary().getSkillDependencies(name);
|
|
2140
2472
|
}
|
|
2141
2473
|
function resolveDependencyTree(names) {
|
|
2142
|
-
return
|
|
2474
|
+
return getLibrary().resolveDependencyTree(names);
|
|
2143
2475
|
}
|
|
2144
2476
|
function listProfiles() {
|
|
2145
|
-
return
|
|
2477
|
+
return getLibrary().listProfiles();
|
|
2146
2478
|
}
|
|
2147
2479
|
function getProfile(name) {
|
|
2148
|
-
return
|
|
2480
|
+
return getLibrary().getProfile(name);
|
|
2149
2481
|
}
|
|
2150
2482
|
function resolveProfile(name) {
|
|
2151
|
-
return
|
|
2483
|
+
return getLibrary().resolveProfile(name);
|
|
2152
2484
|
}
|
|
2153
2485
|
function listSharedResources() {
|
|
2154
|
-
return
|
|
2486
|
+
return getLibrary().listSharedResources();
|
|
2155
2487
|
}
|
|
2156
2488
|
function getSharedResourcePath(name) {
|
|
2157
|
-
return
|
|
2489
|
+
return getLibrary().getSharedResourcePath(name);
|
|
2158
2490
|
}
|
|
2159
2491
|
function readSharedResource(name) {
|
|
2160
|
-
return
|
|
2492
|
+
return getLibrary().readSharedResource(name);
|
|
2161
2493
|
}
|
|
2162
2494
|
function listProtocols() {
|
|
2163
|
-
return
|
|
2495
|
+
return getLibrary().listProtocols();
|
|
2164
2496
|
}
|
|
2165
2497
|
function getProtocolPath(name) {
|
|
2166
|
-
return
|
|
2498
|
+
return getLibrary().getProtocolPath(name);
|
|
2167
2499
|
}
|
|
2168
2500
|
function readProtocol(name) {
|
|
2169
|
-
return
|
|
2501
|
+
return getLibrary().readProtocol(name);
|
|
2170
2502
|
}
|
|
2171
2503
|
function validateSkillFrontmatter(name) {
|
|
2172
|
-
return
|
|
2504
|
+
return getLibrary().validateSkillFrontmatter(name);
|
|
2173
2505
|
}
|
|
2174
2506
|
function validateAll() {
|
|
2175
|
-
return
|
|
2507
|
+
return getLibrary().validateAll();
|
|
2176
2508
|
}
|
|
2177
2509
|
function getDispatchMatrix() {
|
|
2178
|
-
return
|
|
2510
|
+
return getLibrary().getDispatchMatrix();
|
|
2179
2511
|
}
|
|
2180
2512
|
function getVersion() {
|
|
2181
|
-
return
|
|
2513
|
+
return getLibrary().version;
|
|
2182
2514
|
}
|
|
2183
2515
|
function getLibraryRoot() {
|
|
2184
|
-
return
|
|
2185
|
-
}
|
|
2186
|
-
function isCatalogAvailable() {
|
|
2187
|
-
try {
|
|
2188
|
-
getCtSkills();
|
|
2189
|
-
return true;
|
|
2190
|
-
} catch {
|
|
2191
|
-
return false;
|
|
2192
|
-
}
|
|
2516
|
+
return getLibrary().libraryRoot;
|
|
2193
2517
|
}
|
|
2194
2518
|
|
|
2195
2519
|
// src/core/skills/discovery.ts
|
|
2196
2520
|
import { readFile as readFile7, readdir } from "fs/promises";
|
|
2197
|
-
import { existsSync as
|
|
2198
|
-
import { join as
|
|
2521
|
+
import { existsSync as existsSync13 } from "fs";
|
|
2522
|
+
import { join as join8 } from "path";
|
|
2199
2523
|
import matter from "gray-matter";
|
|
2200
2524
|
async function parseSkillFile(filePath) {
|
|
2201
2525
|
try {
|
|
@@ -2219,8 +2543,8 @@ async function parseSkillFile(filePath) {
|
|
|
2219
2543
|
}
|
|
2220
2544
|
}
|
|
2221
2545
|
async function discoverSkill(skillDir) {
|
|
2222
|
-
const skillFile =
|
|
2223
|
-
if (!
|
|
2546
|
+
const skillFile = join8(skillDir, "SKILL.md");
|
|
2547
|
+
if (!existsSync13(skillFile)) return null;
|
|
2224
2548
|
const metadata = await parseSkillFile(skillFile);
|
|
2225
2549
|
if (!metadata) return null;
|
|
2226
2550
|
return {
|
|
@@ -2231,12 +2555,12 @@ async function discoverSkill(skillDir) {
|
|
|
2231
2555
|
};
|
|
2232
2556
|
}
|
|
2233
2557
|
async function discoverSkills(rootDir) {
|
|
2234
|
-
if (!
|
|
2558
|
+
if (!existsSync13(rootDir)) return [];
|
|
2235
2559
|
const entries = await readdir(rootDir, { withFileTypes: true });
|
|
2236
2560
|
const skills = [];
|
|
2237
2561
|
for (const entry of entries) {
|
|
2238
2562
|
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
2239
|
-
const skillDir =
|
|
2563
|
+
const skillDir = join8(rootDir, entry.name);
|
|
2240
2564
|
const skill = await discoverSkill(skillDir);
|
|
2241
2565
|
if (skill) {
|
|
2242
2566
|
skills.push(skill);
|
|
@@ -2616,7 +2940,7 @@ async function recommendSkills2(query, criteria, options = {}) {
|
|
|
2616
2940
|
}
|
|
2617
2941
|
|
|
2618
2942
|
// src/core/skills/audit/scanner.ts
|
|
2619
|
-
import { existsSync as
|
|
2943
|
+
import { existsSync as existsSync14 } from "fs";
|
|
2620
2944
|
import { readFile as readFile8 } from "fs/promises";
|
|
2621
2945
|
|
|
2622
2946
|
// src/core/skills/audit/rules.ts
|
|
@@ -2996,7 +3320,7 @@ var SEVERITY_WEIGHTS = {
|
|
|
2996
3320
|
info: 0
|
|
2997
3321
|
};
|
|
2998
3322
|
async function scanFile(filePath, rules) {
|
|
2999
|
-
if (!
|
|
3323
|
+
if (!existsSync14(filePath)) {
|
|
3000
3324
|
return { file: filePath, findings: [], score: 100, passed: true };
|
|
3001
3325
|
}
|
|
3002
3326
|
const content = await readFile8(filePath, "utf-8");
|
|
@@ -3028,14 +3352,14 @@ async function scanFile(filePath, rules) {
|
|
|
3028
3352
|
}
|
|
3029
3353
|
async function scanDirectory(dirPath) {
|
|
3030
3354
|
const { readdir: readdir2 } = await import("fs/promises");
|
|
3031
|
-
const { join:
|
|
3032
|
-
if (!
|
|
3355
|
+
const { join: join9 } = await import("path");
|
|
3356
|
+
if (!existsSync14(dirPath)) return [];
|
|
3033
3357
|
const entries = await readdir2(dirPath, { withFileTypes: true });
|
|
3034
3358
|
const results = [];
|
|
3035
3359
|
for (const entry of entries) {
|
|
3036
3360
|
if (entry.isDirectory() || entry.isSymbolicLink()) {
|
|
3037
|
-
const skillFile =
|
|
3038
|
-
if (
|
|
3361
|
+
const skillFile = join9(dirPath, entry.name, "SKILL.md");
|
|
3362
|
+
if (existsSync14(skillFile)) {
|
|
3039
3363
|
results.push(await scanFile(skillFile));
|
|
3040
3364
|
}
|
|
3041
3365
|
}
|
|
@@ -3088,7 +3412,7 @@ function toSarif(results) {
|
|
|
3088
3412
|
|
|
3089
3413
|
// src/core/skills/validator.ts
|
|
3090
3414
|
import { readFile as readFile9 } from "fs/promises";
|
|
3091
|
-
import { existsSync as
|
|
3415
|
+
import { existsSync as existsSync15 } from "fs";
|
|
3092
3416
|
import matter2 from "gray-matter";
|
|
3093
3417
|
var RESERVED_NAMES = [
|
|
3094
3418
|
"anthropic",
|
|
@@ -3109,7 +3433,7 @@ var WARN_BODY_LINES = 500;
|
|
|
3109
3433
|
var WARN_DESCRIPTION_LENGTH = 50;
|
|
3110
3434
|
async function validateSkill(filePath) {
|
|
3111
3435
|
const issues = [];
|
|
3112
|
-
if (!
|
|
3436
|
+
if (!existsSync15(filePath)) {
|
|
3113
3437
|
return {
|
|
3114
3438
|
valid: false,
|
|
3115
3439
|
issues: [{ level: "error", field: "file", message: "File does not exist" }],
|
|
@@ -3227,7 +3551,10 @@ export {
|
|
|
3227
3551
|
removeInjection,
|
|
3228
3552
|
checkAllInjections,
|
|
3229
3553
|
injectAll,
|
|
3554
|
+
buildInjectionContent,
|
|
3555
|
+
parseInjectionContent,
|
|
3230
3556
|
generateInjectionContent,
|
|
3557
|
+
generateSkillsSection,
|
|
3231
3558
|
groupByInstructFile,
|
|
3232
3559
|
deepMerge,
|
|
3233
3560
|
getNestedValue,
|
|
@@ -3301,12 +3628,17 @@ export {
|
|
|
3301
3628
|
isMarketplaceScoped,
|
|
3302
3629
|
formatNetworkError,
|
|
3303
3630
|
MarketplaceClient,
|
|
3631
|
+
loadLibraryFromModule,
|
|
3632
|
+
buildLibraryFromFiles,
|
|
3633
|
+
registerSkillLibrary,
|
|
3634
|
+
registerSkillLibraryFromPath,
|
|
3635
|
+
clearRegisteredLibrary,
|
|
3636
|
+
isCatalogAvailable,
|
|
3304
3637
|
listSkills,
|
|
3305
3638
|
getSkill,
|
|
3306
3639
|
getSkillDir,
|
|
3307
3640
|
listProfiles,
|
|
3308
3641
|
resolveProfile,
|
|
3309
|
-
isCatalogAvailable,
|
|
3310
3642
|
catalog_exports,
|
|
3311
3643
|
parseSkillFile,
|
|
3312
3644
|
discoverSkill,
|
|
@@ -3330,4 +3662,4 @@ export {
|
|
|
3330
3662
|
toSarif,
|
|
3331
3663
|
validateSkill
|
|
3332
3664
|
};
|
|
3333
|
-
//# sourceMappingURL=chunk-
|
|
3665
|
+
//# sourceMappingURL=chunk-KAJJ6L6H.js.map
|