@kurokeita/add-skill 1.16.0 → 1.17.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/dist/bin/cli.js +119 -0
- package/package.json +2 -1
package/dist/bin/cli.js
CHANGED
|
@@ -566,7 +566,125 @@ function getHandler(platform) {
|
|
|
566
566
|
return handlers.get(platform) || new DefaultHandler(platform);
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
+
// src/utils/prompts.ts
|
|
570
|
+
import { AutocompletePrompt } from "@clack/core";
|
|
571
|
+
var autocompletePromptPrototype = AutocompletePrompt.prototype;
|
|
572
|
+
var originalEmit = autocompletePromptPrototype.emit;
|
|
573
|
+
var originalIsActionKey = autocompletePromptPrototype._isActionKey;
|
|
574
|
+
var originalPrompt = autocompletePromptPrototype.prompt;
|
|
575
|
+
function isShiftAToggleKey(key) {
|
|
576
|
+
return key?.name === "a" && key.shift === true;
|
|
577
|
+
}
|
|
578
|
+
function isShiftIInvertKey(key) {
|
|
579
|
+
return key?.name === "i" && key.shift === true;
|
|
580
|
+
}
|
|
581
|
+
function getAvailableFilteredValues(prompt) {
|
|
582
|
+
return prompt.filteredOptions.filter((option) => !option.disabled).map((option) => option.value);
|
|
583
|
+
}
|
|
584
|
+
function toggleFilteredValues(prompt) {
|
|
585
|
+
const availableValues = getAvailableFilteredValues(prompt);
|
|
586
|
+
if (availableValues.length === 0) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
const allFilteredValuesSelected = availableValues.every(
|
|
590
|
+
(value) => prompt.selectedValues.includes(value)
|
|
591
|
+
);
|
|
592
|
+
prompt.selectedValues = allFilteredValuesSelected ? prompt.selectedValues.filter((value) => !availableValues.includes(value)) : [
|
|
593
|
+
...prompt.selectedValues,
|
|
594
|
+
...availableValues.filter(
|
|
595
|
+
(value) => !prompt.selectedValues.includes(value)
|
|
596
|
+
)
|
|
597
|
+
];
|
|
598
|
+
}
|
|
599
|
+
function invertFilteredValues(prompt) {
|
|
600
|
+
const availableValues = getAvailableFilteredValues(prompt);
|
|
601
|
+
if (availableValues.length === 0) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
prompt.selectedValues = [
|
|
605
|
+
...prompt.selectedValues.filter(
|
|
606
|
+
(value) => !availableValues.includes(value)
|
|
607
|
+
),
|
|
608
|
+
...availableValues.filter(
|
|
609
|
+
(value) => !prompt.selectedValues.includes(value)
|
|
610
|
+
)
|
|
611
|
+
];
|
|
612
|
+
}
|
|
613
|
+
function addShiftATextHint(output) {
|
|
614
|
+
if (output.includes("Shift+A")) {
|
|
615
|
+
return output;
|
|
616
|
+
}
|
|
617
|
+
const dimOpen = "\x1B[2m";
|
|
618
|
+
const reset = "\x1B[22m";
|
|
619
|
+
return output.replace(/to search(?![\s\S]*to search)/, (match) => {
|
|
620
|
+
return `${match} \u2022 ${dimOpen}Shift+A:${reset} toggle all \u2022 ${dimOpen}Shift+I:${reset} invert selection`;
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
function patchRenderHint(prompt) {
|
|
624
|
+
if (prompt.__aiManagerShiftARenderPatched__) {
|
|
625
|
+
return prompt;
|
|
626
|
+
}
|
|
627
|
+
prompt._render = wrapRenderFunction(prompt._render);
|
|
628
|
+
prompt.__aiManagerShiftARenderPatched__ = true;
|
|
629
|
+
return prompt;
|
|
630
|
+
}
|
|
631
|
+
function wrapRenderFunction(render) {
|
|
632
|
+
if (!render) {
|
|
633
|
+
return render;
|
|
634
|
+
}
|
|
635
|
+
return function() {
|
|
636
|
+
const output = render.call(this);
|
|
637
|
+
if (typeof output !== "string") {
|
|
638
|
+
return output;
|
|
639
|
+
}
|
|
640
|
+
return addShiftATextHint(output);
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
function attachAutocompleteMultiSelectShiftAToggle(prompt) {
|
|
644
|
+
if (prompt.__aiManagerShiftAListenerAttached__) {
|
|
645
|
+
return prompt;
|
|
646
|
+
}
|
|
647
|
+
prompt.on("key", (...args) => {
|
|
648
|
+
const [, key] = args;
|
|
649
|
+
if (!prompt.multiple) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
if (isShiftAToggleKey(key)) {
|
|
653
|
+
toggleFilteredValues(prompt);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
if (isShiftIInvertKey(key)) {
|
|
657
|
+
invertFilteredValues(prompt);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
prompt.__aiManagerShiftAListenerAttached__ = true;
|
|
662
|
+
patchRenderHint(prompt);
|
|
663
|
+
return prompt;
|
|
664
|
+
}
|
|
665
|
+
function enableAutocompleteMultiSelectShiftAToggle() {
|
|
666
|
+
if (autocompletePromptPrototype.__aiManagerShiftAPatched__) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
autocompletePromptPrototype._isActionKey = function(char, key) {
|
|
670
|
+
if (this.multiple && (isShiftAToggleKey(key) || isShiftIInvertKey(key))) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
return originalIsActionKey.call(this, char, key);
|
|
674
|
+
};
|
|
675
|
+
autocompletePromptPrototype.emit = function(event, ...args) {
|
|
676
|
+
attachAutocompleteMultiSelectShiftAToggle(this);
|
|
677
|
+
return originalEmit.call(this, event, ...args);
|
|
678
|
+
};
|
|
679
|
+
autocompletePromptPrototype.prompt = function() {
|
|
680
|
+
attachAutocompleteMultiSelectShiftAToggle(this);
|
|
681
|
+
return originalPrompt.call(this);
|
|
682
|
+
};
|
|
683
|
+
autocompletePromptPrototype.__aiManagerShiftAPatched__ = true;
|
|
684
|
+
}
|
|
685
|
+
|
|
569
686
|
// src/commands/add.ts
|
|
687
|
+
enableAutocompleteMultiSelectShiftAToggle();
|
|
570
688
|
function getPlatformOptions(type) {
|
|
571
689
|
const paths = getTargetPaths(type);
|
|
572
690
|
return Object.entries(paths).filter(([_, pathStr]) => !!pathStr).map(([platform, pathStr]) => ({
|
|
@@ -1079,6 +1197,7 @@ import {
|
|
|
1079
1197
|
} from "@clack/prompts";
|
|
1080
1198
|
import fs7 from "fs-extra";
|
|
1081
1199
|
import pc4 from "picocolors";
|
|
1200
|
+
enableAutocompleteMultiSelectShiftAToggle();
|
|
1082
1201
|
async function remove(type, options) {
|
|
1083
1202
|
if (!options?.skipIntro) {
|
|
1084
1203
|
intro4(pc4.bgCyan(pc4.black(" AI Manager : Remove ")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurokeita/add-skill",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "CLI to install AI agent skills to various platforms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"license": "GPL-3.0",
|
|
38
38
|
"packageManager": "pnpm@10.28.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@clack/core": "^1.2.0",
|
|
40
41
|
"@clack/prompts": "^1.2.0",
|
|
41
42
|
"commander": "^14.0.2",
|
|
42
43
|
"fs-extra": "^11.3.3",
|