@ikyyofc/gemini-cli 3.0.3 → 3.0.4
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/index.js +6 -3
- package/package.json +1 -1
- package/src/skills.js +40 -25
package/index.js
CHANGED
|
@@ -279,12 +279,15 @@ async function handleCommand(input) {
|
|
|
279
279
|
try {
|
|
280
280
|
const { output } = await installSkill(source, { global: isGlobal, skill: skillName, all });
|
|
281
281
|
sp.stop();
|
|
282
|
-
// Print npx output
|
|
283
282
|
if (output) output.split("\n").filter(Boolean).forEach(l => printInfo(l));
|
|
284
283
|
printSuccess("skill installed — active on next message");
|
|
285
284
|
} catch (e) {
|
|
286
|
-
sp.
|
|
287
|
-
|
|
285
|
+
sp.stop();
|
|
286
|
+
// Print full npx output so user sees what actually went wrong
|
|
287
|
+
e.message.split("\n").filter(Boolean).forEach(l =>
|
|
288
|
+
process.stdout.write(chalk.hex("#7A7A9A")(" " + l + "\n"))
|
|
289
|
+
);
|
|
290
|
+
printError("install failed");
|
|
288
291
|
}
|
|
289
292
|
break;
|
|
290
293
|
}
|
package/package.json
CHANGED
package/src/skills.js
CHANGED
|
@@ -28,37 +28,52 @@ export function ensureSkillsDirs() {
|
|
|
28
28
|
// ─────────────────────────────────────────────────────────────────
|
|
29
29
|
async function npxSkills(args, cwd = process.cwd(), timeout = 120_000) {
|
|
30
30
|
const cmd = `npx --yes skills ${args}`;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
...process.env,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
try {
|
|
32
|
+
const { stdout, stderr } = await execAsync(cmd, {
|
|
33
|
+
cwd,
|
|
34
|
+
timeout,
|
|
35
|
+
env: { ...process.env, NO_COLOR: "1", CI: "1" },
|
|
36
|
+
});
|
|
37
|
+
return { stdout: stdout.trim(), stderr: stderr.trim() };
|
|
38
|
+
} catch (err) {
|
|
39
|
+
// Expose actual npx output in the thrown error message
|
|
40
|
+
const detail = [err.stdout?.trim(), err.stderr?.trim()]
|
|
41
|
+
.filter(Boolean).join("\n") || err.message;
|
|
42
|
+
throw new Error(detail);
|
|
43
|
+
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// ─────────────────────────────────────────────────────────────────
|
|
47
|
-
//
|
|
47
|
+
// Parse source: handles "owner/repo@skill-name" shorthand
|
|
48
|
+
// e.g. "anthropics/skills@frontend-design"
|
|
49
|
+
// → source="anthropics/skills", skill="frontend-design"
|
|
48
50
|
// ─────────────────────────────────────────────────────────────────
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
function parseSource(raw) {
|
|
52
|
+
const atIdx = raw.indexOf("@");
|
|
53
|
+
if (atIdx > 0 && !raw.startsWith("http") && !raw.startsWith("git@")) {
|
|
54
|
+
return {
|
|
55
|
+
source: raw.slice(0, atIdx),
|
|
56
|
+
skill: raw.slice(atIdx + 1),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return { source: raw, skill: null };
|
|
60
|
+
}
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
// ─────────────────────────────────────────────────────────────────
|
|
63
|
+
// Install — npx skills add <source> [-y] [--global] [--skill name]
|
|
64
|
+
// ─────────────────────────────────────────────────────────────────
|
|
65
|
+
export async function installSkill(rawSource, opts = {}) {
|
|
66
|
+
const { global = false, skill: explicitSkill = null, all = false } = opts;
|
|
67
|
+
const { source, skill: parsedSkill } = parseSource(rawSource);
|
|
68
|
+
const skillName = explicitSkill ?? parsedSkill;
|
|
60
69
|
|
|
61
|
-
|
|
70
|
+
// Build args — let npx skills auto-detect agent (more reliable than -a gemini)
|
|
71
|
+
const parts = ["add", source, "-y"];
|
|
72
|
+
if (global) parts.push("-g");
|
|
73
|
+
if (skillName) parts.push(`--skill "${skillName}"`);
|
|
74
|
+
if (all) parts.push("--skill '*'");
|
|
75
|
+
|
|
76
|
+
const { stdout, stderr } = await npxSkills(parts.join(" "));
|
|
62
77
|
return { output: stdout || stderr };
|
|
63
78
|
}
|
|
64
79
|
|