agentskillsdk 0.1.6 → 0.2.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/package.json +1 -1
- package/src/commands/add.js +5 -6
- package/src/commands/list.js +1 -1
- package/src/lib/detect-agent.js +24 -10
- package/src/lib/prompt.js +4 -4
- package/src/lib/ui.js +5 -5
package/package.json
CHANGED
package/src/commands/add.js
CHANGED
|
@@ -38,7 +38,7 @@ export async function addCommand(skillName, options) {
|
|
|
38
38
|
(options.skill ? ` (skill: ${chalk.bold(options.skill)})` : ''));
|
|
39
39
|
} else {
|
|
40
40
|
installName = skillName;
|
|
41
|
-
const spinner = ora({ text: `Looking up ${chalk.bold(skillName)}...`, indent:
|
|
41
|
+
const spinner = ora({ text: `Looking up ${chalk.bold(skillName)}...`, indent: 2 }).start();
|
|
42
42
|
try {
|
|
43
43
|
skill = await fetchSkill(skillName);
|
|
44
44
|
} catch (err) {
|
|
@@ -68,8 +68,7 @@ export async function addCommand(skillName, options) {
|
|
|
68
68
|
process.exit(1);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
spinner.
|
|
72
|
-
step(`Found skill: ${chalk.bold(skill.name)}`);
|
|
71
|
+
spinner.succeed(`Found skill: ${chalk.bold(skill.name)}`);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
// --- detect agent ---
|
|
@@ -85,14 +84,14 @@ export async function addCommand(skillName, options) {
|
|
|
85
84
|
scope = 'project';
|
|
86
85
|
} else {
|
|
87
86
|
scope = await selectPrompt('Install scope:', [
|
|
88
|
-
{ label: 'Project', hint:
|
|
89
|
-
{ label: 'Global', hint:
|
|
87
|
+
{ label: 'Project', hint: `(local ${agent.folder}/skills/)`, value: 'project' },
|
|
88
|
+
{ label: 'Global', hint: `(~/${agent.globalFolder}/skills/)`, value: 'global' },
|
|
90
89
|
]);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
// --- download ---
|
|
94
93
|
const destDir = agent.path(installName, { cwd, scope });
|
|
95
|
-
const spinner = ora({ text: 'Downloading skill files...', indent:
|
|
94
|
+
const spinner = ora({ text: 'Downloading skill files...', indent: 2 }).start();
|
|
96
95
|
try {
|
|
97
96
|
await downloadSkill(skill, destDir);
|
|
98
97
|
} catch (err) {
|
package/src/commands/list.js
CHANGED
|
@@ -22,7 +22,7 @@ export async function listCommand() {
|
|
|
22
22
|
const maxName = Math.max(...skills.map(s => s.name.length));
|
|
23
23
|
|
|
24
24
|
for (const skill of skills) {
|
|
25
|
-
console.log(`
|
|
25
|
+
console.log(` ${chalk.cyan(skill.name.padEnd(maxName + 2))} ${skill.description}`);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
console.log(`\n Install: ${chalk.bold('npx agentskillsdk add <skill-name>')}`);
|
package/src/lib/detect-agent.js
CHANGED
|
@@ -3,23 +3,37 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { selectPrompt } from './prompt.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function makeAgent(name, folder, { globalFolder, detectFolder } = {}) {
|
|
7
|
+
const gFolder = globalFolder || folder;
|
|
8
|
+
const dFolder = detectFolder || folder;
|
|
9
|
+
return {
|
|
10
|
+
name,
|
|
11
|
+
folder,
|
|
12
|
+
globalFolder: gFolder,
|
|
13
|
+
detectFolder: dFolder,
|
|
10
14
|
path: (skill, { cwd, scope }) => {
|
|
11
|
-
if (scope === 'global') return join(homedir(),
|
|
12
|
-
return join(cwd,
|
|
15
|
+
if (scope === 'global') return join(homedir(), gFolder, 'skills', skill);
|
|
16
|
+
return join(cwd, folder, 'skills', skill);
|
|
13
17
|
},
|
|
14
18
|
displayPath: (skill, scope) => {
|
|
15
|
-
if (scope === 'global') return
|
|
16
|
-
return
|
|
19
|
+
if (scope === 'global') return `~/${gFolder}/skills/${skill}/`;
|
|
20
|
+
return `${folder}/skills/${skill}/`;
|
|
17
21
|
},
|
|
18
|
-
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const AGENTS = [
|
|
26
|
+
makeAgent('Claude Code', '.claude'),
|
|
27
|
+
makeAgent('Codex CLI', '.agents', { globalFolder: '.codex' }),
|
|
28
|
+
makeAgent('Cursor', '.cursor'),
|
|
29
|
+
makeAgent('Droid', '.factory'),
|
|
30
|
+
makeAgent('GitHub Copilot', '.github', { detectFolder: '.github/skills' }),
|
|
31
|
+
makeAgent('OpenClaw', '.openclaw'),
|
|
32
|
+
makeAgent('OpenCode', '.opencode'),
|
|
19
33
|
];
|
|
20
34
|
|
|
21
35
|
export async function detectAgents(cwd) {
|
|
22
|
-
const found = AGENTS.filter(agent => existsSync(join(cwd, agent.
|
|
36
|
+
const found = AGENTS.filter(agent => existsSync(join(cwd, agent.detectFolder)));
|
|
23
37
|
|
|
24
38
|
if (found.length === 1) return [found[0]];
|
|
25
39
|
if (found.length > 1) {
|
package/src/lib/prompt.js
CHANGED
|
@@ -38,15 +38,15 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
38
38
|
const marker = i === selected ? chalk.cyan('\u276f') : ' ';
|
|
39
39
|
const label = i === selected ? chalk.cyan(c.label) : c.label;
|
|
40
40
|
const hint = c.hint ? chalk.dim(` ${c.hint}`) : '';
|
|
41
|
-
return `
|
|
41
|
+
return ` ${marker} ${label}${hint}`;
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// Hide cursor
|
|
46
46
|
stdout.write('\x1b[?25l');
|
|
47
47
|
|
|
48
|
-
// Print question (
|
|
49
|
-
stdout.write(`\n
|
|
48
|
+
// Print question (2-space indent)
|
|
49
|
+
stdout.write(`\n ${question}\n\n`);
|
|
50
50
|
|
|
51
51
|
// Initial render
|
|
52
52
|
let prevLines = render();
|
|
@@ -81,7 +81,7 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
81
81
|
const upCount = totalPhysicalLines(prevLines) - 1;
|
|
82
82
|
if (upCount > 0) stdout.write(`\x1b[${upCount}A`);
|
|
83
83
|
stdout.write('\r\x1b[J'); // col 0, clear to end
|
|
84
|
-
const final = `
|
|
84
|
+
const final = ` ${chalk.cyan('\u276f')} ${chalk.cyan(choices[selected].label)}`;
|
|
85
85
|
stdout.write(final + '\n');
|
|
86
86
|
cleanup();
|
|
87
87
|
resolve(choices[selected].value);
|
package/src/lib/ui.js
CHANGED
|
@@ -20,12 +20,12 @@ export function box(lines, { borderColor, padding = 2 } = {}) {
|
|
|
20
20
|
|
|
21
21
|
const colorize = borderColor ? chalk[borderColor].bind(chalk) : (s) => s;
|
|
22
22
|
|
|
23
|
-
const top = colorize(`
|
|
24
|
-
const bottom = colorize(`
|
|
23
|
+
const top = colorize(` \u250c${'─'.repeat(inner)}\u2510`);
|
|
24
|
+
const bottom = colorize(` \u2514${'─'.repeat(inner)}\u2518`);
|
|
25
25
|
const rowLines = lines.map(l => {
|
|
26
26
|
const visible = stripAnsi(l).length;
|
|
27
27
|
const rightPad = ' '.repeat(maxWidth - visible);
|
|
28
|
-
return `
|
|
28
|
+
return ` ${colorize('\u2502')}${pad}${l}${rightPad}${pad}${colorize('\u2502')}`;
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
return [top, ...rowLines, bottom].join('\n');
|
|
@@ -72,9 +72,9 @@ export function printCompletionSummary({ skillName, scope, installPath, agentNam
|
|
|
72
72
|
// --- step / error output ---
|
|
73
73
|
|
|
74
74
|
export function step(text) {
|
|
75
|
-
console.log(chalk.green('
|
|
75
|
+
console.log(chalk.green(' \u2713') + ` ${text}`);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export function error(text) {
|
|
79
|
-
console.error(chalk.red(`
|
|
79
|
+
console.error(chalk.red(` ${text}`));
|
|
80
80
|
}
|