agentskillsdk 0.1.5 → 0.1.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/package.json +1 -1
- package/src/commands/add.js +2 -2
- package/src/commands/list.js +1 -1
- package/src/lib/prompt.js +12 -12
- 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) {
|
|
@@ -92,7 +92,7 @@ export async function addCommand(skillName, options) {
|
|
|
92
92
|
|
|
93
93
|
// --- download ---
|
|
94
94
|
const destDir = agent.path(installName, { cwd, scope });
|
|
95
|
-
const spinner = ora({ text: 'Downloading skill files...', indent:
|
|
95
|
+
const spinner = ora({ text: 'Downloading skill files...', indent: 2 }).start();
|
|
96
96
|
try {
|
|
97
97
|
await downloadSkill(skill, destDir);
|
|
98
98
|
} 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/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();
|
|
@@ -77,11 +77,11 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
77
77
|
|
|
78
78
|
// Enter
|
|
79
79
|
if (key === '\r' || key === '\n') {
|
|
80
|
-
// Move
|
|
81
|
-
const upCount = totalPhysicalLines(prevLines);
|
|
82
|
-
stdout.write(`\x1b[${upCount}A`);
|
|
83
|
-
stdout.write('\x1b[J'); // clear to end
|
|
84
|
-
const final = `
|
|
80
|
+
// Move cursor to start of first choice line, then clear
|
|
81
|
+
const upCount = totalPhysicalLines(prevLines) - 1;
|
|
82
|
+
if (upCount > 0) stdout.write(`\x1b[${upCount}A`);
|
|
83
|
+
stdout.write('\r\x1b[J'); // col 0, clear to end
|
|
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);
|
|
@@ -99,10 +99,10 @@ export function selectPrompt(question, choices, { defaultIndex = 0 } = {}) {
|
|
|
99
99
|
return; // ignore other keys
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// Redraw: move cursor
|
|
103
|
-
const upCount = totalPhysicalLines(prevLines);
|
|
104
|
-
stdout.write(`\x1b[${upCount}A`);
|
|
105
|
-
stdout.write('\x1b[J');
|
|
102
|
+
// Redraw: move cursor to start of first choice line, clear, rewrite
|
|
103
|
+
const upCount = totalPhysicalLines(prevLines) - 1;
|
|
104
|
+
if (upCount > 0) stdout.write(`\x1b[${upCount}A`);
|
|
105
|
+
stdout.write('\r\x1b[J');
|
|
106
106
|
prevLines = render();
|
|
107
107
|
stdout.write(prevLines.join('\n'));
|
|
108
108
|
}
|
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
|
}
|