@empjs/skill 1.0.6 → 1.0.7
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 +19 -5
- package/dist/index.cjs +180 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +180 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,14 +34,16 @@ var import_path = require("path");
|
|
|
34
34
|
var import_url = require("url");
|
|
35
35
|
|
|
36
36
|
// src/commands/agents.ts
|
|
37
|
-
var
|
|
37
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
38
38
|
var import_node_os2 = __toESM(require("os"), 1);
|
|
39
39
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
40
40
|
|
|
41
41
|
// src/config/agents.ts
|
|
42
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
42
43
|
var import_node_os = __toESM(require("os"), 1);
|
|
43
44
|
var import_node_path = __toESM(require("path"), 1);
|
|
44
45
|
var HOME = import_node_os.default.homedir();
|
|
46
|
+
var CONFIG_HOME = process.env.XDG_CONFIG_HOME || import_node_path.default.join(HOME, ".config");
|
|
45
47
|
function getAgentSkillsDirs(agent, cwd) {
|
|
46
48
|
if (agent.skillsDirs) {
|
|
47
49
|
if (typeof agent.skillsDirs === "function") {
|
|
@@ -56,21 +58,44 @@ function getAgentSkillsDirs(agent, cwd) {
|
|
|
56
58
|
}
|
|
57
59
|
var AGENTS = [
|
|
58
60
|
{
|
|
59
|
-
name: "
|
|
60
|
-
displayName: "
|
|
61
|
-
|
|
61
|
+
name: "amp",
|
|
62
|
+
displayName: "AMP",
|
|
63
|
+
skillsDirs: (cwd) => {
|
|
64
|
+
const dirs = [import_node_path.default.join(CONFIG_HOME, "agents", "skills")];
|
|
65
|
+
if (cwd) dirs.push(import_node_path.default.join(cwd, ".agents", "skills"));
|
|
66
|
+
return dirs;
|
|
67
|
+
},
|
|
62
68
|
enabled: true
|
|
63
69
|
},
|
|
64
70
|
{
|
|
65
|
-
name: "
|
|
66
|
-
displayName: "
|
|
67
|
-
|
|
71
|
+
name: "antigravity",
|
|
72
|
+
displayName: "Antigravity",
|
|
73
|
+
skillsDirs: (cwd) => {
|
|
74
|
+
const dirs = [import_node_path.default.join(HOME, ".gemini", "antigravity", "skills")];
|
|
75
|
+
if (cwd) dirs.push(import_node_path.default.join(cwd, ".agent", "skills"));
|
|
76
|
+
if (cwd) dirs.push(import_node_path.default.join(cwd, ".shared", "skills"));
|
|
77
|
+
return dirs;
|
|
78
|
+
},
|
|
68
79
|
enabled: true
|
|
69
80
|
},
|
|
70
81
|
{
|
|
71
|
-
name: "
|
|
72
|
-
displayName: "
|
|
73
|
-
skillsDir: import_node_path.default.join(HOME, ".
|
|
82
|
+
name: "claude",
|
|
83
|
+
displayName: "Claude Code",
|
|
84
|
+
skillsDir: import_node_path.default.join(process.env.CLAUDE_CONFIG_DIR?.trim() || import_node_path.default.join(HOME, ".claude"), "skills"),
|
|
85
|
+
enabled: true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "clawdbot",
|
|
89
|
+
displayName: "ClawdBot",
|
|
90
|
+
skillsDirs: () => {
|
|
91
|
+
const openclaw = import_node_path.default.join(HOME, ".openclaw", "skills");
|
|
92
|
+
const clawdbot = import_node_path.default.join(HOME, ".clawdbot", "skills");
|
|
93
|
+
const moltbot = import_node_path.default.join(HOME, ".moltbot", "skills");
|
|
94
|
+
if (import_node_fs.default.existsSync(import_node_path.default.join(HOME, ".openclaw"))) return [openclaw];
|
|
95
|
+
if (import_node_fs.default.existsSync(import_node_path.default.join(HOME, ".clawdbot"))) return [clawdbot];
|
|
96
|
+
if (import_node_fs.default.existsSync(import_node_path.default.join(HOME, ".moltbot"))) return [moltbot];
|
|
97
|
+
return [openclaw];
|
|
98
|
+
},
|
|
74
99
|
enabled: true
|
|
75
100
|
},
|
|
76
101
|
{
|
|
@@ -79,9 +104,27 @@ var AGENTS = [
|
|
|
79
104
|
skillsDir: import_node_path.default.join(HOME, ".cline", "skills"),
|
|
80
105
|
enabled: true
|
|
81
106
|
},
|
|
107
|
+
{
|
|
108
|
+
name: "codex",
|
|
109
|
+
displayName: "Codex",
|
|
110
|
+
skillsDir: import_node_path.default.join(process.env.CODEX_HOME?.trim() || import_node_path.default.join(HOME, ".codex"), "skills"),
|
|
111
|
+
enabled: true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "cursor",
|
|
115
|
+
displayName: "Cursor",
|
|
116
|
+
skillsDir: import_node_path.default.join(HOME, ".cursor", "skills"),
|
|
117
|
+
enabled: true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "droid",
|
|
121
|
+
displayName: "Droid",
|
|
122
|
+
skillsDir: import_node_path.default.join(HOME, ".factory", "skills"),
|
|
123
|
+
enabled: true
|
|
124
|
+
},
|
|
82
125
|
{
|
|
83
126
|
name: "gemini",
|
|
84
|
-
displayName: "Gemini
|
|
127
|
+
displayName: "Gemini",
|
|
85
128
|
skillsDir: import_node_path.default.join(HOME, ".gemini", "skills"),
|
|
86
129
|
enabled: true
|
|
87
130
|
},
|
|
@@ -92,47 +135,31 @@ var AGENTS = [
|
|
|
92
135
|
enabled: true
|
|
93
136
|
},
|
|
94
137
|
{
|
|
95
|
-
name: "
|
|
96
|
-
displayName: "
|
|
97
|
-
skillsDir: import_node_path.default.join(
|
|
138
|
+
name: "goose",
|
|
139
|
+
displayName: "Goose",
|
|
140
|
+
skillsDir: import_node_path.default.join(CONFIG_HOME, "goose", "skills"),
|
|
98
141
|
enabled: true
|
|
99
142
|
},
|
|
100
143
|
{
|
|
101
|
-
name: "
|
|
102
|
-
displayName: "
|
|
103
|
-
|
|
104
|
-
const dirs = [];
|
|
105
|
-
dirs.push(import_node_path.default.join(HOME, ".gemini", "antigravity", "skills"));
|
|
106
|
-
if (cwd) {
|
|
107
|
-
dirs.push(import_node_path.default.join(cwd, ".agent", "skills"));
|
|
108
|
-
}
|
|
109
|
-
if (cwd) {
|
|
110
|
-
dirs.push(import_node_path.default.join(cwd, ".shared", "skills"));
|
|
111
|
-
}
|
|
112
|
-
return dirs;
|
|
113
|
-
},
|
|
144
|
+
name: "kilo",
|
|
145
|
+
displayName: "Kilo Code",
|
|
146
|
+
skillsDir: import_node_path.default.join(HOME, ".kilocode", "skills"),
|
|
114
147
|
enabled: true
|
|
115
148
|
},
|
|
116
149
|
{
|
|
117
150
|
name: "kiro",
|
|
118
|
-
displayName: "Kiro",
|
|
151
|
+
displayName: "Kiro CLI",
|
|
119
152
|
skillsDir: import_node_path.default.join(HOME, ".kiro", "skills"),
|
|
120
153
|
enabled: true
|
|
121
154
|
},
|
|
122
155
|
{
|
|
123
|
-
name: "
|
|
124
|
-
displayName: "
|
|
125
|
-
skillsDir: import_node_path.default.join(
|
|
126
|
-
enabled: true
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
name: "qoder",
|
|
130
|
-
displayName: "Qoder",
|
|
131
|
-
skillsDir: import_node_path.default.join(HOME, ".qoder", "skills"),
|
|
156
|
+
name: "opencode",
|
|
157
|
+
displayName: "OpenCode",
|
|
158
|
+
skillsDir: import_node_path.default.join(CONFIG_HOME, "opencode", "skills"),
|
|
132
159
|
enabled: true
|
|
133
160
|
},
|
|
134
161
|
{
|
|
135
|
-
name: "
|
|
162
|
+
name: "roo",
|
|
136
163
|
displayName: "Roo Code",
|
|
137
164
|
skillsDir: import_node_path.default.join(HOME, ".roo", "skills"),
|
|
138
165
|
enabled: true
|
|
@@ -143,6 +170,24 @@ var AGENTS = [
|
|
|
143
170
|
skillsDir: import_node_path.default.join(HOME, ".trae", "skills"),
|
|
144
171
|
enabled: true
|
|
145
172
|
},
|
|
173
|
+
{
|
|
174
|
+
name: "windsurf",
|
|
175
|
+
displayName: "Windsurf",
|
|
176
|
+
skillsDirs: () => {
|
|
177
|
+
const dirs = [];
|
|
178
|
+
dirs.push(import_node_path.default.join(HOME, ".windsurf", "skills"));
|
|
179
|
+
dirs.push(import_node_path.default.join(HOME, ".codeium", "windsurf", "skills"));
|
|
180
|
+
return dirs;
|
|
181
|
+
},
|
|
182
|
+
enabled: true
|
|
183
|
+
},
|
|
184
|
+
// Additional agents
|
|
185
|
+
{
|
|
186
|
+
name: "qoder",
|
|
187
|
+
displayName: "Qoder",
|
|
188
|
+
skillsDir: import_node_path.default.join(HOME, ".qoder", "skills"),
|
|
189
|
+
enabled: true
|
|
190
|
+
},
|
|
146
191
|
{
|
|
147
192
|
name: "continue",
|
|
148
193
|
displayName: "Continue",
|
|
@@ -168,7 +213,7 @@ function agents() {
|
|
|
168
213
|
} else {
|
|
169
214
|
console.log(import_chalk.default.gray(` Directories${dirsInfo}:`));
|
|
170
215
|
for (const dir of skillsDirs) {
|
|
171
|
-
const exists =
|
|
216
|
+
const exists = import_node_fs2.default.existsSync(dir);
|
|
172
217
|
const status = exists ? import_chalk.default.green("\u2713") : import_chalk.default.gray("\u25CB");
|
|
173
218
|
const pathColor = exists ? import_chalk.default.white : import_chalk.default.gray;
|
|
174
219
|
console.log(` ${status} ${pathColor(dir)}`);
|
|
@@ -177,7 +222,7 @@ function agents() {
|
|
|
177
222
|
console.log("");
|
|
178
223
|
}
|
|
179
224
|
console.log(import_chalk.default.bold("\u{1F4E6} Shared Skills Directory:"));
|
|
180
|
-
const sharedExists =
|
|
225
|
+
const sharedExists = import_node_fs2.default.existsSync(SHARED_SKILLS_DIR);
|
|
181
226
|
const sharedStatus = sharedExists ? import_chalk.default.green("\u2713") : import_chalk.default.gray("\u25CB");
|
|
182
227
|
const sharedPathColor = sharedExists ? import_chalk.default.white : import_chalk.default.gray;
|
|
183
228
|
console.log(` ${sharedStatus} ${sharedPathColor(SHARED_SKILLS_DIR)}`);
|
|
@@ -191,7 +236,7 @@ function agents() {
|
|
|
191
236
|
|
|
192
237
|
// src/commands/install.ts
|
|
193
238
|
var import_node_child_process2 = require("child_process");
|
|
194
|
-
var
|
|
239
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
195
240
|
var import_node_os3 = __toESM(require("os"), 1);
|
|
196
241
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
197
242
|
var import_node_util2 = require("util");
|
|
@@ -323,6 +368,10 @@ var Logger = class {
|
|
|
323
368
|
if (this.spinner) this.spinner.stop();
|
|
324
369
|
console.log(import_chalk2.default.red("\u2717"), message);
|
|
325
370
|
}
|
|
371
|
+
dim(message) {
|
|
372
|
+
if (this.spinner) this.spinner.stop();
|
|
373
|
+
console.log(import_chalk2.default.dim(" " + message));
|
|
374
|
+
}
|
|
326
375
|
start(message) {
|
|
327
376
|
if (this.spinner) this.spinner.stop();
|
|
328
377
|
this.spinner = (0, import_ora.default)(message).start();
|
|
@@ -359,7 +408,7 @@ var Logger = class {
|
|
|
359
408
|
var logger = new Logger();
|
|
360
409
|
|
|
361
410
|
// src/utils/paths.ts
|
|
362
|
-
var
|
|
411
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
363
412
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
364
413
|
function getSharedSkillPath(skillName) {
|
|
365
414
|
return import_node_path2.default.join(SHARED_SKILLS_DIR, skillName);
|
|
@@ -373,8 +422,8 @@ function getAgentSkillPaths(agentName, skillName, cwd) {
|
|
|
373
422
|
return skillsDirs.map((dir) => import_node_path2.default.join(dir, skillName));
|
|
374
423
|
}
|
|
375
424
|
function ensureSharedDir() {
|
|
376
|
-
if (!
|
|
377
|
-
|
|
425
|
+
if (!import_node_fs3.default.existsSync(SHARED_SKILLS_DIR)) {
|
|
426
|
+
import_node_fs3.default.mkdirSync(SHARED_SKILLS_DIR, { recursive: true });
|
|
378
427
|
}
|
|
379
428
|
}
|
|
380
429
|
function detectInstalledAgents(cwd) {
|
|
@@ -382,7 +431,7 @@ function detectInstalledAgents(cwd) {
|
|
|
382
431
|
try {
|
|
383
432
|
const skillsDirs = getAgentSkillsDirs(agent, cwd);
|
|
384
433
|
return skillsDirs.some((dir) => {
|
|
385
|
-
return
|
|
434
|
+
return import_node_fs3.default.existsSync(dir) || import_node_fs3.default.existsSync(import_node_path2.default.dirname(dir));
|
|
386
435
|
});
|
|
387
436
|
} catch {
|
|
388
437
|
return false;
|
|
@@ -403,7 +452,7 @@ function extractSkillName(nameOrPath) {
|
|
|
403
452
|
|
|
404
453
|
// src/utils/registry.ts
|
|
405
454
|
var import_node_child_process = require("child_process");
|
|
406
|
-
var
|
|
455
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
|
407
456
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
408
457
|
var import_node_util = require("util");
|
|
409
458
|
var execAsync = (0, import_node_util.promisify)(import_node_child_process.exec);
|
|
@@ -411,7 +460,7 @@ function findNpmrc(startDir) {
|
|
|
411
460
|
let currentDir = import_node_path3.default.resolve(startDir);
|
|
412
461
|
while (currentDir !== import_node_path3.default.dirname(currentDir)) {
|
|
413
462
|
const npmrcPath = import_node_path3.default.join(currentDir, ".npmrc");
|
|
414
|
-
if (
|
|
463
|
+
if (import_node_fs4.default.existsSync(npmrcPath)) {
|
|
415
464
|
return npmrcPath;
|
|
416
465
|
}
|
|
417
466
|
currentDir = import_node_path3.default.dirname(currentDir);
|
|
@@ -420,7 +469,7 @@ function findNpmrc(startDir) {
|
|
|
420
469
|
}
|
|
421
470
|
function parseNpmrc(npmrcPath) {
|
|
422
471
|
try {
|
|
423
|
-
const content =
|
|
472
|
+
const content = import_node_fs4.default.readFileSync(npmrcPath, "utf-8");
|
|
424
473
|
const lines = content.split("\n");
|
|
425
474
|
for (const line of lines) {
|
|
426
475
|
const trimmed = line.trim();
|
|
@@ -463,11 +512,11 @@ async function getRegistry(cwd = process.cwd()) {
|
|
|
463
512
|
}
|
|
464
513
|
|
|
465
514
|
// src/utils/symlink.ts
|
|
466
|
-
var
|
|
515
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
467
516
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
468
517
|
function createSymlink(skillName, agent, cwd) {
|
|
469
518
|
const source = getSharedSkillPath(skillName);
|
|
470
|
-
if (!
|
|
519
|
+
if (!import_node_fs5.default.existsSync(source)) {
|
|
471
520
|
logger.error(`Skill not found: ${source}`);
|
|
472
521
|
return false;
|
|
473
522
|
}
|
|
@@ -475,19 +524,19 @@ function createSymlink(skillName, agent, cwd) {
|
|
|
475
524
|
let successCount = 0;
|
|
476
525
|
for (const target of targets) {
|
|
477
526
|
const targetDir = import_node_path4.default.dirname(target);
|
|
478
|
-
if (!
|
|
527
|
+
if (!import_node_fs5.default.existsSync(targetDir)) {
|
|
479
528
|
try {
|
|
480
|
-
|
|
529
|
+
import_node_fs5.default.mkdirSync(targetDir, { recursive: true });
|
|
481
530
|
} catch (error) {
|
|
482
531
|
logger.error(`Failed to create directory ${targetDir}: ${error.message}`);
|
|
483
532
|
continue;
|
|
484
533
|
}
|
|
485
534
|
}
|
|
486
|
-
if (
|
|
535
|
+
if (import_node_fs5.default.existsSync(target)) {
|
|
487
536
|
try {
|
|
488
|
-
const stats =
|
|
537
|
+
const stats = import_node_fs5.default.lstatSync(target);
|
|
489
538
|
if (stats.isSymbolicLink()) {
|
|
490
|
-
|
|
539
|
+
import_node_fs5.default.unlinkSync(target);
|
|
491
540
|
} else {
|
|
492
541
|
logger.warn(`Target exists but is not a symlink, skipping: ${target}`);
|
|
493
542
|
continue;
|
|
@@ -498,7 +547,7 @@ function createSymlink(skillName, agent, cwd) {
|
|
|
498
547
|
}
|
|
499
548
|
}
|
|
500
549
|
try {
|
|
501
|
-
|
|
550
|
+
import_node_fs5.default.symlinkSync(source, target, "dir");
|
|
502
551
|
successCount++;
|
|
503
552
|
} catch (error) {
|
|
504
553
|
logger.error(`Failed to create symlink at ${target}: ${error.message}`);
|
|
@@ -515,13 +564,13 @@ function removeSymlink(skillName, agent, cwd) {
|
|
|
515
564
|
const targets = getAgentSkillPaths(agent.name, skillName, cwd);
|
|
516
565
|
let removedCount = 0;
|
|
517
566
|
for (const target of targets) {
|
|
518
|
-
if (!
|
|
567
|
+
if (!import_node_fs5.default.existsSync(target)) {
|
|
519
568
|
continue;
|
|
520
569
|
}
|
|
521
570
|
try {
|
|
522
|
-
const stats =
|
|
571
|
+
const stats = import_node_fs5.default.lstatSync(target);
|
|
523
572
|
if (stats.isSymbolicLink()) {
|
|
524
|
-
|
|
573
|
+
import_node_fs5.default.unlinkSync(target);
|
|
525
574
|
removedCount++;
|
|
526
575
|
} else {
|
|
527
576
|
logger.warn(`Not a symlink: ${target}`);
|
|
@@ -539,7 +588,7 @@ function removeSymlink(skillName, agent, cwd) {
|
|
|
539
588
|
}
|
|
540
589
|
function isSymlink(filePath) {
|
|
541
590
|
try {
|
|
542
|
-
const stats =
|
|
591
|
+
const stats = import_node_fs5.default.lstatSync(filePath);
|
|
543
592
|
return stats.isSymbolicLink();
|
|
544
593
|
} catch {
|
|
545
594
|
return false;
|
|
@@ -547,7 +596,7 @@ function isSymlink(filePath) {
|
|
|
547
596
|
}
|
|
548
597
|
function readSymlink(filePath) {
|
|
549
598
|
try {
|
|
550
|
-
return
|
|
599
|
+
return import_node_fs5.default.readlinkSync(filePath);
|
|
551
600
|
} catch {
|
|
552
601
|
return null;
|
|
553
602
|
}
|
|
@@ -576,12 +625,25 @@ async function execWithTimeout(command, timeout = 12e4, env) {
|
|
|
576
625
|
throw error;
|
|
577
626
|
}
|
|
578
627
|
}
|
|
628
|
+
function shortenPath(p) {
|
|
629
|
+
const home = import_node_os3.default.homedir();
|
|
630
|
+
return p.startsWith(home) ? p.replace(home, "~") : p;
|
|
631
|
+
}
|
|
579
632
|
async function install(skillNameOrPath, options = {}) {
|
|
580
|
-
|
|
633
|
+
const isGit = isGitUrl(skillNameOrPath);
|
|
634
|
+
if (isGit) {
|
|
635
|
+
logger.info("Installing from Git URL");
|
|
636
|
+
logger.dim(skillNameOrPath);
|
|
637
|
+
} else {
|
|
638
|
+
logger.info(`Installing skill: ${skillNameOrPath}`);
|
|
639
|
+
}
|
|
581
640
|
ensureSharedDir();
|
|
582
641
|
let skillPath;
|
|
583
642
|
let skillName;
|
|
584
|
-
if (
|
|
643
|
+
if (process.env.DEBUG_ESKILL) {
|
|
644
|
+
logger.dim(`[DEBUG] isGitUrl=${isGit}, parseGitUrl=${parseGitUrl(skillNameOrPath) ? "ok" : "null"}`);
|
|
645
|
+
}
|
|
646
|
+
if (isGit) {
|
|
585
647
|
const gitInfo = parseGitUrl(skillNameOrPath);
|
|
586
648
|
if (!gitInfo) {
|
|
587
649
|
logger.error(`Invalid git URL: ${skillNameOrPath}`);
|
|
@@ -593,21 +655,17 @@ async function install(skillNameOrPath, options = {}) {
|
|
|
593
655
|
const cloneDir = import_node_path5.default.join(tempDir, "repo");
|
|
594
656
|
try {
|
|
595
657
|
const timeout = options.timeout || 12e4;
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
if (gitInfo.
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
logger.infoWithoutStop(`Path: ${gitInfo.path}`);
|
|
603
|
-
}
|
|
604
|
-
logger.infoWithoutStop(`Timeout: ${timeout / 1e3}s`);
|
|
605
|
-
import_node_fs5.default.mkdirSync(tempDir, { recursive: true });
|
|
658
|
+
const gitDetails = [`${gitInfo.gitUrl}`];
|
|
659
|
+
if (gitInfo.branch) gitDetails.push(`branch: ${gitInfo.branch}`);
|
|
660
|
+
if (gitInfo.path) gitDetails.push(`path: ${gitInfo.path}`);
|
|
661
|
+
logger.dim(gitDetails.join(" \xB7 "));
|
|
662
|
+
const spinner = logger.start(`Cloning...`);
|
|
663
|
+
import_node_fs6.default.mkdirSync(tempDir, { recursive: true });
|
|
606
664
|
const branchFlag = gitInfo.branch ? `-b ${gitInfo.branch}` : "";
|
|
607
665
|
const cloneCommand = branchFlag ? `git clone ${branchFlag} ${gitInfo.gitUrl} ${cloneDir} --depth 1 --quiet` : `git clone ${gitInfo.gitUrl} ${cloneDir} --depth 1 --quiet`;
|
|
608
666
|
try {
|
|
609
667
|
await execWithTimeout(cloneCommand, timeout);
|
|
610
|
-
spinner.succeed(`
|
|
668
|
+
spinner.succeed(`Cloned successfully`);
|
|
611
669
|
} catch (error) {
|
|
612
670
|
spinner.fail("Clone failed");
|
|
613
671
|
if (error.message.includes("timeout")) {
|
|
@@ -624,7 +682,7 @@ async function install(skillNameOrPath, options = {}) {
|
|
|
624
682
|
}
|
|
625
683
|
if (gitInfo.path) {
|
|
626
684
|
skillPath = import_node_path5.default.join(cloneDir, gitInfo.path);
|
|
627
|
-
if (!
|
|
685
|
+
if (!import_node_fs6.default.existsSync(skillPath)) {
|
|
628
686
|
logger.error(`Path not found in repository: ${gitInfo.path}`);
|
|
629
687
|
logger.info(`Repository cloned to: ${cloneDir}`);
|
|
630
688
|
process.exit(1);
|
|
@@ -633,7 +691,7 @@ async function install(skillNameOrPath, options = {}) {
|
|
|
633
691
|
skillPath = cloneDir;
|
|
634
692
|
}
|
|
635
693
|
const skillMdPath = import_node_path5.default.join(skillPath, "SKILL.md");
|
|
636
|
-
if (!
|
|
694
|
+
if (!import_node_fs6.default.existsSync(skillMdPath)) {
|
|
637
695
|
logger.warn(`Warning: SKILL.md not found in ${skillPath}`);
|
|
638
696
|
logger.info("The directory may not be a valid skill package");
|
|
639
697
|
}
|
|
@@ -655,16 +713,16 @@ Tried to clone: ${gitInfo.gitUrl}`);
|
|
|
655
713
|
}
|
|
656
714
|
process.exit(1);
|
|
657
715
|
}
|
|
658
|
-
} else if (options.link ||
|
|
716
|
+
} else if (options.link || import_node_fs6.default.existsSync(skillNameOrPath)) {
|
|
659
717
|
skillPath = import_node_path5.default.resolve(skillNameOrPath);
|
|
660
|
-
if (!
|
|
718
|
+
if (!import_node_fs6.default.existsSync(skillPath)) {
|
|
661
719
|
logger.error(`Path not found: ${skillPath}`);
|
|
662
720
|
process.exit(1);
|
|
663
721
|
}
|
|
664
722
|
const pkgPath = import_node_path5.default.join(skillPath, "package.json");
|
|
665
|
-
if (
|
|
723
|
+
if (import_node_fs6.default.existsSync(pkgPath)) {
|
|
666
724
|
try {
|
|
667
|
-
const pkg = JSON.parse(
|
|
725
|
+
const pkg = JSON.parse(import_node_fs6.default.readFileSync(pkgPath, "utf-8"));
|
|
668
726
|
skillName = extractSkillName(pkg.name);
|
|
669
727
|
} catch {
|
|
670
728
|
skillName = extractSkillName(import_node_path5.default.basename(skillPath));
|
|
@@ -681,12 +739,12 @@ Tried to clone: ${gitInfo.gitUrl}`);
|
|
|
681
739
|
const spinner = logger.start(`Installing ${skillNameOrPath}...`);
|
|
682
740
|
logger.infoWithoutStop(`Registry: ${registry}`);
|
|
683
741
|
logger.infoWithoutStop(`Timeout: ${timeout / 1e3}s`);
|
|
684
|
-
|
|
742
|
+
import_node_fs6.default.mkdirSync(tempDir, { recursive: true });
|
|
685
743
|
logger.updateSpinner(`Downloading ${skillNameOrPath} from ${registry}...`);
|
|
686
744
|
const homeDir = process.env.HOME || process.env.USERPROFILE || import_node_os3.default.homedir();
|
|
687
745
|
const npmCacheDir = import_node_path5.default.join(homeDir, ".npm");
|
|
688
746
|
const npmConfigPrefix = import_node_path5.default.join(homeDir, ".npm-global");
|
|
689
|
-
|
|
747
|
+
import_node_fs6.default.mkdirSync(npmCacheDir, { recursive: true });
|
|
690
748
|
const installCommand = `npm install ${skillNameOrPath} --prefix ${tempDir} --registry=${registry} --no-save --silent --no-bin-links --prefer-offline`;
|
|
691
749
|
const env = {
|
|
692
750
|
...process.env,
|
|
@@ -767,7 +825,7 @@ Tried to clone: ${gitInfo.gitUrl}`);
|
|
|
767
825
|
process.exit(1);
|
|
768
826
|
}
|
|
769
827
|
skillPath = import_node_path5.default.join(tempDir, "node_modules", skillNameOrPath);
|
|
770
|
-
if (!
|
|
828
|
+
if (!import_node_fs6.default.existsSync(skillPath)) {
|
|
771
829
|
logger.error(`Failed to download package: ${skillNameOrPath}`);
|
|
772
830
|
process.exit(1);
|
|
773
831
|
}
|
|
@@ -777,18 +835,19 @@ Tried to clone: ${gitInfo.gitUrl}`);
|
|
|
777
835
|
}
|
|
778
836
|
}
|
|
779
837
|
const targetPath = getSharedSkillPath(skillName);
|
|
780
|
-
if (
|
|
838
|
+
if (import_node_fs6.default.existsSync(targetPath)) {
|
|
781
839
|
if (options.force) {
|
|
782
840
|
logger.warn("Removing existing installation...");
|
|
783
|
-
|
|
841
|
+
import_node_fs6.default.rmSync(targetPath, { recursive: true, force: true });
|
|
784
842
|
} else {
|
|
785
|
-
logger.error(`Skill already exists
|
|
786
|
-
logger.
|
|
843
|
+
logger.error(`Skill already exists`);
|
|
844
|
+
logger.dim(`Location: ${shortenPath(targetPath)}`);
|
|
845
|
+
logger.dim(`Tip: Add --force to overwrite`);
|
|
787
846
|
process.exit(1);
|
|
788
847
|
}
|
|
789
848
|
}
|
|
790
849
|
if (options.link) {
|
|
791
|
-
|
|
850
|
+
import_node_fs6.default.symlinkSync(skillPath, targetPath, "dir");
|
|
792
851
|
logger.success(`Linked to shared directory (dev mode)`);
|
|
793
852
|
} else {
|
|
794
853
|
copyDir(skillPath, targetPath);
|
|
@@ -802,21 +861,25 @@ Tried to clone: ${gitInfo.gitUrl}`);
|
|
|
802
861
|
logger.info("Skill installed to shared directory, but not linked to any agent");
|
|
803
862
|
logger.info("");
|
|
804
863
|
logger.info("Supported agents:");
|
|
805
|
-
logger.info("
|
|
806
|
-
logger.info("
|
|
807
|
-
logger.info("
|
|
864
|
+
logger.info(" AMP, Antigravity, Claude Code, ClawdBot, Cline, Codex, Cursor, Droid,");
|
|
865
|
+
logger.info(" Gemini, GitHub Copilot, Goose, Kilo, Kiro CLI, OpenCode, Roo, Trae, Windsurf");
|
|
866
|
+
logger.info("");
|
|
867
|
+
logger.info('Run "eskill agents" to see all agent directories');
|
|
808
868
|
return;
|
|
809
869
|
}
|
|
810
870
|
let targetAgents = installedAgents;
|
|
811
871
|
if (options.agent && options.agent !== "all") {
|
|
812
|
-
const agent =
|
|
872
|
+
const agent = AGENTS.find((a) => a.name === options.agent && a.enabled);
|
|
813
873
|
if (!agent) {
|
|
814
|
-
logger.error(`
|
|
874
|
+
logger.error(`Unknown agent: ${options.agent}`);
|
|
815
875
|
logger.info(`
|
|
816
|
-
|
|
876
|
+
Supported agents: ${AGENTS.filter((a) => a.enabled).map((a) => a.name).join(", ")}`);
|
|
817
877
|
process.exit(1);
|
|
818
878
|
}
|
|
819
879
|
targetAgents = [agent];
|
|
880
|
+
if (!installedAgents.find((a) => a.name === options.agent)) {
|
|
881
|
+
logger.info(`Note: ${agent.displayName} directory will be created if not exists`);
|
|
882
|
+
}
|
|
820
883
|
}
|
|
821
884
|
logger.info("\nCreating symlinks...");
|
|
822
885
|
let successCount = 0;
|
|
@@ -834,8 +897,8 @@ Linked to ${successCount}/${targetAgents.length} agents`);
|
|
|
834
897
|
}
|
|
835
898
|
}
|
|
836
899
|
function copyDir(src, dest) {
|
|
837
|
-
|
|
838
|
-
const entries =
|
|
900
|
+
import_node_fs6.default.mkdirSync(dest, { recursive: true });
|
|
901
|
+
const entries = import_node_fs6.default.readdirSync(src, { withFileTypes: true });
|
|
839
902
|
for (const entry of entries) {
|
|
840
903
|
const srcPath = import_node_path5.default.join(src, entry.name);
|
|
841
904
|
const destPath = import_node_path5.default.join(dest, entry.name);
|
|
@@ -845,23 +908,23 @@ function copyDir(src, dest) {
|
|
|
845
908
|
if (entry.isDirectory()) {
|
|
846
909
|
copyDir(srcPath, destPath);
|
|
847
910
|
} else {
|
|
848
|
-
|
|
911
|
+
import_node_fs6.default.copyFileSync(srcPath, destPath);
|
|
849
912
|
}
|
|
850
913
|
}
|
|
851
914
|
}
|
|
852
915
|
|
|
853
916
|
// src/commands/list.ts
|
|
854
|
-
var
|
|
917
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
855
918
|
var import_node_path6 = __toESM(require("path"), 1);
|
|
856
919
|
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
857
920
|
function list() {
|
|
858
|
-
if (!
|
|
921
|
+
if (!import_node_fs7.default.existsSync(SHARED_SKILLS_DIR)) {
|
|
859
922
|
logger.info("No skills installed");
|
|
860
923
|
logger.info(`
|
|
861
924
|
To install a skill, run: ${import_chalk3.default.cyan("eskill install <skill-name>")}`);
|
|
862
925
|
return;
|
|
863
926
|
}
|
|
864
|
-
const skills =
|
|
927
|
+
const skills = import_node_fs7.default.readdirSync(SHARED_SKILLS_DIR);
|
|
865
928
|
if (skills.length === 0) {
|
|
866
929
|
logger.info("No skills installed");
|
|
867
930
|
logger.info(`
|
|
@@ -874,15 +937,15 @@ Installed skills in ${SHARED_SKILLS_DIR}:
|
|
|
874
937
|
for (const skill of skills) {
|
|
875
938
|
const skillPath = import_node_path6.default.join(SHARED_SKILLS_DIR, skill);
|
|
876
939
|
try {
|
|
877
|
-
const stats =
|
|
940
|
+
const stats = import_node_fs7.default.lstatSync(skillPath);
|
|
878
941
|
if (!stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
879
942
|
continue;
|
|
880
943
|
}
|
|
881
944
|
let version2 = "unknown";
|
|
882
945
|
const pkgPath = import_node_path6.default.join(skillPath, "package.json");
|
|
883
|
-
if (
|
|
946
|
+
if (import_node_fs7.default.existsSync(pkgPath)) {
|
|
884
947
|
try {
|
|
885
|
-
const pkgContent =
|
|
948
|
+
const pkgContent = import_node_fs7.default.readFileSync(pkgPath, "utf-8");
|
|
886
949
|
const pkg = JSON.parse(pkgContent);
|
|
887
950
|
if (pkg.version && typeof pkg.version === "string") {
|
|
888
951
|
version2 = pkg.version;
|
|
@@ -892,9 +955,9 @@ Installed skills in ${SHARED_SKILLS_DIR}:
|
|
|
892
955
|
}
|
|
893
956
|
if (version2 === "unknown") {
|
|
894
957
|
const skillMdPath = import_node_path6.default.join(skillPath, "SKILL.md");
|
|
895
|
-
if (
|
|
958
|
+
if (import_node_fs7.default.existsSync(skillMdPath)) {
|
|
896
959
|
try {
|
|
897
|
-
const skillMdContent =
|
|
960
|
+
const skillMdContent = import_node_fs7.default.readFileSync(skillMdPath, "utf-8");
|
|
898
961
|
const frontmatterMatch = skillMdContent.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
899
962
|
if (frontmatterMatch) {
|
|
900
963
|
const frontmatter = frontmatterMatch[1];
|
|
@@ -912,8 +975,8 @@ Installed skills in ${SHARED_SKILLS_DIR}:
|
|
|
912
975
|
const targetPath = readSymlink(skillPath);
|
|
913
976
|
if (targetPath) {
|
|
914
977
|
const targetPkgPath = import_node_path6.default.join(targetPath, "package.json");
|
|
915
|
-
if (
|
|
916
|
-
const pkg = JSON.parse(
|
|
978
|
+
if (import_node_fs7.default.existsSync(targetPkgPath)) {
|
|
979
|
+
const pkg = JSON.parse(import_node_fs7.default.readFileSync(targetPkgPath, "utf-8"));
|
|
917
980
|
if (pkg.version && typeof pkg.version === "string") {
|
|
918
981
|
version2 = pkg.version;
|
|
919
982
|
}
|
|
@@ -932,7 +995,7 @@ Installed skills in ${SHARED_SKILLS_DIR}:
|
|
|
932
995
|
const skillsDirs = getAgentSkillsDirs(agent, cwd);
|
|
933
996
|
const hasSymlink = skillsDirs.some((dir) => {
|
|
934
997
|
const agentSkillPath = import_node_path6.default.join(dir, skill);
|
|
935
|
-
if (
|
|
998
|
+
if (import_node_fs7.default.existsSync(agentSkillPath) && isSymlink(agentSkillPath)) {
|
|
936
999
|
const target = readSymlink(agentSkillPath);
|
|
937
1000
|
return target === skillPath;
|
|
938
1001
|
}
|
|
@@ -960,11 +1023,11 @@ Installed skills in ${SHARED_SKILLS_DIR}:
|
|
|
960
1023
|
}
|
|
961
1024
|
|
|
962
1025
|
// src/commands/remove.ts
|
|
963
|
-
var
|
|
1026
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
964
1027
|
async function remove(skillName, options = {}) {
|
|
965
1028
|
const extractedName = extractSkillName(skillName);
|
|
966
1029
|
const sharedPath = getSharedSkillPath(extractedName);
|
|
967
|
-
const skillExists =
|
|
1030
|
+
const skillExists = import_node_fs8.default.existsSync(sharedPath);
|
|
968
1031
|
if (!skillExists) {
|
|
969
1032
|
logger.error(`Skill not found: ${extractedName}`);
|
|
970
1033
|
logger.info(`Location: ${sharedPath}`);
|
|
@@ -974,11 +1037,11 @@ async function remove(skillName, options = {}) {
|
|
|
974
1037
|
const installedAgents = detectInstalledAgents(cwd);
|
|
975
1038
|
let targetAgents = installedAgents;
|
|
976
1039
|
if (options.agent && options.agent !== "all") {
|
|
977
|
-
const agent =
|
|
1040
|
+
const agent = AGENTS.find((a) => a.name === options.agent && a.enabled);
|
|
978
1041
|
if (!agent) {
|
|
979
|
-
logger.error(`
|
|
1042
|
+
logger.error(`Unknown agent: ${options.agent}`);
|
|
980
1043
|
logger.info(`
|
|
981
|
-
|
|
1044
|
+
Supported agents: ${AGENTS.filter((a) => a.enabled).map((a) => a.name).join(", ")}`);
|
|
982
1045
|
process.exit(1);
|
|
983
1046
|
}
|
|
984
1047
|
targetAgents = [agent];
|
|
@@ -1000,12 +1063,12 @@ Installed agents: ${installedAgents.map((a) => a.name).join(", ")}`);
|
|
|
1000
1063
|
}
|
|
1001
1064
|
logger.info("Removing skill from shared directory...");
|
|
1002
1065
|
try {
|
|
1003
|
-
const stats =
|
|
1066
|
+
const stats = import_node_fs8.default.lstatSync(sharedPath);
|
|
1004
1067
|
if (stats.isSymbolicLink()) {
|
|
1005
|
-
|
|
1068
|
+
import_node_fs8.default.unlinkSync(sharedPath);
|
|
1006
1069
|
logger.success("Removed symlink from shared directory");
|
|
1007
1070
|
} else {
|
|
1008
|
-
|
|
1071
|
+
import_node_fs8.default.rmSync(sharedPath, { recursive: true, force: true });
|
|
1009
1072
|
logger.success("Removed skill from shared directory");
|
|
1010
1073
|
}
|
|
1011
1074
|
} catch (error) {
|
|
@@ -1016,7 +1079,7 @@ Installed agents: ${installedAgents.map((a) => a.name).join(", ")}`);
|
|
|
1016
1079
|
for (const agent of AGENTS) {
|
|
1017
1080
|
const agentSkillPaths = getAgentSkillPaths(agent.name, extractedName, cwd);
|
|
1018
1081
|
const hasSymlink = agentSkillPaths.some((path7) => {
|
|
1019
|
-
return
|
|
1082
|
+
return import_node_fs8.default.existsSync(path7) && isSymlink(path7);
|
|
1020
1083
|
});
|
|
1021
1084
|
if (hasSymlink) {
|
|
1022
1085
|
remainingSymlinks.push(agent.displayName);
|