@iceinvein/agent-skills 0.1.5 → 0.1.6
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/cli/index.js +51 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -648,7 +648,40 @@ async function updateSkill(cwd, skillName) {
|
|
|
648
648
|
// src/cli/types.ts
|
|
649
649
|
var TOOL_NAMES2 = ["claude", "cursor", "codex", "gemini"];
|
|
650
650
|
|
|
651
|
+
// src/cli/prompt.ts
|
|
652
|
+
import { createInterface } from "node:readline";
|
|
653
|
+
var rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
654
|
+
function ask(question) {
|
|
655
|
+
return new Promise((resolve) => {
|
|
656
|
+
rl.question(question, (answer) => resolve(answer.trim()));
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
async function promptSelect(message, options) {
|
|
660
|
+
console.log(`
|
|
661
|
+
${message}
|
|
662
|
+
`);
|
|
663
|
+
for (let i = 0;i < options.length; i++) {
|
|
664
|
+
console.log(` ${i + 1}) ${options[i].label}`);
|
|
665
|
+
}
|
|
666
|
+
console.log(` ${options.length + 1}) All of the above`);
|
|
667
|
+
const answer = await ask(`
|
|
668
|
+
Select (comma-separated numbers, e.g. 1,3): `);
|
|
669
|
+
rl.close();
|
|
670
|
+
const nums = answer.split(",").map((s) => parseInt(s.trim(), 10));
|
|
671
|
+
if (nums.includes(options.length + 1)) {
|
|
672
|
+
return options.map((o) => o.value);
|
|
673
|
+
}
|
|
674
|
+
const selected = nums.filter((n) => n >= 1 && n <= options.length).map((n) => options[n - 1].value);
|
|
675
|
+
if (selected.length === 0) {
|
|
676
|
+
console.error("No valid selection. Exiting.");
|
|
677
|
+
process.exit(1);
|
|
678
|
+
}
|
|
679
|
+
return selected;
|
|
680
|
+
}
|
|
681
|
+
|
|
651
682
|
// src/cli/index.ts
|
|
683
|
+
import { mkdirSync as mkdirSync4 } from "fs";
|
|
684
|
+
import { join as join7 } from "path";
|
|
652
685
|
function parseArgs(argv) {
|
|
653
686
|
if (argv.length === 0)
|
|
654
687
|
return { command: "help", args: [], flags: {} };
|
|
@@ -722,10 +755,25 @@ async function main() {
|
|
|
722
755
|
} else {
|
|
723
756
|
tools = await detectTools(process.cwd());
|
|
724
757
|
if (tools.length === 0) {
|
|
725
|
-
|
|
726
|
-
|
|
758
|
+
const supportedTools = manifestResult.manifest.tools;
|
|
759
|
+
const selected = await promptSelect("No tools detected in this directory. Which tools do you use?", supportedTools.map((t) => ({
|
|
760
|
+
label: { claude: "Claude Code", cursor: "Cursor", codex: "Codex", gemini: "Gemini CLI" }[t],
|
|
761
|
+
value: t
|
|
762
|
+
})));
|
|
763
|
+
tools = selected;
|
|
764
|
+
for (const tool of tools) {
|
|
765
|
+
const dirs = {
|
|
766
|
+
claude: ".claude",
|
|
767
|
+
cursor: ".cursor",
|
|
768
|
+
gemini: ".gemini"
|
|
769
|
+
};
|
|
770
|
+
if (dirs[tool]) {
|
|
771
|
+
mkdirSync4(join7(process.cwd(), dirs[tool]), { recursive: true });
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
} else {
|
|
775
|
+
console.log(`Detected tools: ${tools.join(", ")}`);
|
|
727
776
|
}
|
|
728
|
-
console.log(`Detected tools: ${tools.join(", ")}`);
|
|
729
777
|
}
|
|
730
778
|
const result = await installSkill(process.cwd(), manifestResult.manifest, filesResult, tools);
|
|
731
779
|
if (!result.ok) {
|