@buiducnhat/agent-skills 0.5.4 → 0.5.6
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/dist/index.js +36 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs, { existsSync, lstatSync, mkdtempSync, readdirSync } from "node:fs";
|
|
3
|
+
import fs, { existsSync, lstatSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
4
4
|
import os, { tmpdir } from "node:os";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
|
6
6
|
import N, { stdin, stdout } from "node:process";
|
|
@@ -2069,7 +2069,6 @@ const AGENT_SKILLS_DIRS = {
|
|
|
2069
2069
|
"codex",
|
|
2070
2070
|
"github-copilot",
|
|
2071
2071
|
"gemini-cli",
|
|
2072
|
-
"cline",
|
|
2073
2072
|
"kimi-cli",
|
|
2074
2073
|
"replit",
|
|
2075
2074
|
"amp"
|
|
@@ -2175,7 +2174,10 @@ async function fetchTemplates() {
|
|
|
2175
2174
|
}
|
|
2176
2175
|
function cleanupTemp(tempDir) {
|
|
2177
2176
|
try {
|
|
2178
|
-
|
|
2177
|
+
rmSync(tempDir, {
|
|
2178
|
+
recursive: true,
|
|
2179
|
+
force: true
|
|
2180
|
+
});
|
|
2179
2181
|
} catch {}
|
|
2180
2182
|
}
|
|
2181
2183
|
|
|
@@ -2249,7 +2251,8 @@ async function runSkillsAdd(projectDir, agents, copy = false, global = false) {
|
|
|
2249
2251
|
return new Promise((resolve) => {
|
|
2250
2252
|
const child = spawn("npx", args, {
|
|
2251
2253
|
cwd: projectDir,
|
|
2252
|
-
stdio: "inherit"
|
|
2254
|
+
stdio: "inherit",
|
|
2255
|
+
shell: true
|
|
2253
2256
|
});
|
|
2254
2257
|
child.on("close", (code) => {
|
|
2255
2258
|
resolve({ success: code === 0 });
|
|
@@ -2300,6 +2303,33 @@ function detectAgentsFromFilesystem(projectDir) {
|
|
|
2300
2303
|
}
|
|
2301
2304
|
return detected;
|
|
2302
2305
|
}
|
|
2306
|
+
function setupCursorSkillsDir(baseDir, copy) {
|
|
2307
|
+
const src = path.join(baseDir, ".agents", "skills");
|
|
2308
|
+
const dest = path.join(baseDir, ".cursor", "skills");
|
|
2309
|
+
if (!fs.existsSync(src)) {
|
|
2310
|
+
R.warn("`.agents/skills/` not found — skipping Cursor skills mirror.");
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
2314
|
+
const entries = fs.readdirSync(src);
|
|
2315
|
+
for (const name of entries) {
|
|
2316
|
+
const srcPath = path.join(src, name);
|
|
2317
|
+
const destPath = path.join(dest, name);
|
|
2318
|
+
if (copy) fs.cpSync(srcPath, destPath, {
|
|
2319
|
+
recursive: true,
|
|
2320
|
+
force: true
|
|
2321
|
+
});
|
|
2322
|
+
else if (!fs.existsSync(destPath)) try {
|
|
2323
|
+
fs.symlinkSync(srcPath, destPath);
|
|
2324
|
+
} catch {
|
|
2325
|
+
R.warn(`Symlink not supported — copying ${name} instead. Use --copy to suppress this warning.`);
|
|
2326
|
+
fs.cpSync(srcPath, destPath, {
|
|
2327
|
+
recursive: true,
|
|
2328
|
+
force: true
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2303
2333
|
function printHelp() {
|
|
2304
2334
|
console.log(`
|
|
2305
2335
|
@buiducnhat/agent-skills - Install AI agent workflow skills for coding assistants
|
|
@@ -2372,6 +2402,7 @@ async function main() {
|
|
|
2372
2402
|
process.exit(1);
|
|
2373
2403
|
}
|
|
2374
2404
|
selectedAgents = detectAgentsFromFilesystem(baseDir);
|
|
2405
|
+
if (selectedAgents.includes("cursor")) setupCursorSkillsDir(baseDir, args.copy);
|
|
2375
2406
|
if (selectedAgents.length === 0) {
|
|
2376
2407
|
R.warn("No agents detected from filesystem. Skills may have been installed but rules injection was skipped.");
|
|
2377
2408
|
Le(import_picocolors.default.yellow("Done. No agent rules files were updated."));
|
|
@@ -2418,6 +2449,7 @@ async function main() {
|
|
|
2418
2449
|
Ne(import_picocolors.default.red("Skills CLI failed. See errors above.\nYou can try running manually: npx skills add buiducnhat/agent-skills --skill '*' -a <agent> -y"));
|
|
2419
2450
|
process.exit(1);
|
|
2420
2451
|
}
|
|
2452
|
+
if (selectedAgents.includes("cursor")) setupCursorSkillsDir(baseDir, copyFlag);
|
|
2421
2453
|
}
|
|
2422
2454
|
R.info(`Configuring agents: ${selectedAgents.join(", ")}`);
|
|
2423
2455
|
let tempDir;
|