@rafter-security/cli 0.7.3 → 0.7.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/dist/commands/agent/init.js +49 -1
- package/package.json +1 -1
|
@@ -463,6 +463,52 @@ async function installClaudeCodeSkills(root) {
|
|
|
463
463
|
function installCodexSkills(root) {
|
|
464
464
|
installSkillsTo(path.join(root, ".agents", "skills"));
|
|
465
465
|
}
|
|
466
|
+
function installGeminiSkills(root) {
|
|
467
|
+
installSkillsTo(path.join(root, ".agents", "skills"));
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Register installed skills with Gemini CLI via `gemini skills link <abs-path>`.
|
|
471
|
+
*
|
|
472
|
+
* Requires gemini CLI >= 0.35 (the version that added `gemini skills`).
|
|
473
|
+
* Missing CLI, missing subcommand, and per-skill registration failures are
|
|
474
|
+
* non-fatal: we warn and continue so the on-disk install still succeeds.
|
|
475
|
+
*/
|
|
476
|
+
function registerGeminiSkills(skillsDir) {
|
|
477
|
+
// Probe for the `gemini` binary. Absence is expected on CI / fresh machines.
|
|
478
|
+
try {
|
|
479
|
+
execSync("gemini --version", { stdio: ["ignore", "pipe", "ignore"], timeout: 5000 });
|
|
480
|
+
}
|
|
481
|
+
catch {
|
|
482
|
+
console.log(fmt.warning("gemini CLI not found on PATH — skipping skill registration. " +
|
|
483
|
+
"Skills are installed to disk; re-run after installing gemini ≥ 0.35."));
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
// Probe `gemini skills` subcommand (added in 0.35).
|
|
487
|
+
try {
|
|
488
|
+
execSync("gemini skills --help", { stdio: ["ignore", "pipe", "ignore"], timeout: 5000 });
|
|
489
|
+
}
|
|
490
|
+
catch {
|
|
491
|
+
console.log(fmt.warning("gemini CLI does not support `skills` subcommand (needs ≥ 0.35). " +
|
|
492
|
+
"Skipping registration — skills are still installed to disk."));
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
for (const skill of AGENT_SKILLS) {
|
|
496
|
+
const absPath = path.resolve(skillsDir, skill.name);
|
|
497
|
+
if (!fs.existsSync(absPath))
|
|
498
|
+
continue;
|
|
499
|
+
try {
|
|
500
|
+
execSync(`gemini skills link ${JSON.stringify(absPath)}`, {
|
|
501
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
502
|
+
timeout: 10000,
|
|
503
|
+
});
|
|
504
|
+
console.log(fmt.success(`Registered ${skill.name} with Gemini CLI`));
|
|
505
|
+
}
|
|
506
|
+
catch (e) {
|
|
507
|
+
const msg = (e?.stderr?.toString?.() || e?.message || "").trim();
|
|
508
|
+
console.log(fmt.warning(`Failed to register ${skill.name} with Gemini CLI: ${msg.split("\n")[0] || "unknown error"}`));
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
466
512
|
async function askYesNo(question, defaultYes = true) {
|
|
467
513
|
const rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
468
514
|
const suffix = defaultYes ? "[Y/n]" : "[y/N]";
|
|
@@ -739,11 +785,13 @@ export function createInitCommand() {
|
|
|
739
785
|
console.error(fmt.error(`Failed to install Codex CLI integration: ${e}`));
|
|
740
786
|
}
|
|
741
787
|
}
|
|
742
|
-
// Install Gemini CLI MCP + hooks if opted in
|
|
788
|
+
// Install Gemini CLI MCP + skills + hooks if opted in
|
|
743
789
|
let geminiOk = false;
|
|
744
790
|
if ((hasGemini || (opts.local && wantGemini)) && wantGemini) {
|
|
745
791
|
try {
|
|
746
792
|
geminiOk = installGeminiMcp(root);
|
|
793
|
+
installGeminiSkills(root);
|
|
794
|
+
registerGeminiSkills(path.join(root, ".agents", "skills"));
|
|
747
795
|
installGeminiHooks(root);
|
|
748
796
|
if (geminiOk && scope === "user")
|
|
749
797
|
manager.set("agent.environments.gemini.enabled", true);
|