@dccxx/auggiegw 1.0.25 → 1.0.26
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/.opencode/command/opsx-apply.md +149 -0
- package/.opencode/command/opsx-archive.md +154 -0
- package/.opencode/command/opsx-bulk-archive.md +239 -0
- package/.opencode/command/opsx-continue.md +111 -0
- package/.opencode/command/opsx-explore.md +171 -0
- package/.opencode/command/opsx-ff.md +91 -0
- package/.opencode/command/opsx-new.md +66 -0
- package/.opencode/command/opsx-onboard.md +522 -0
- package/.opencode/command/opsx-sync.md +131 -0
- package/.opencode/command/opsx-verify.md +161 -0
- package/.opencode/skills/openspec-apply-change/SKILL.md +156 -0
- package/.opencode/skills/openspec-archive-change/SKILL.md +114 -0
- package/.opencode/skills/openspec-bulk-archive-change/SKILL.md +246 -0
- package/.opencode/skills/openspec-continue-change/SKILL.md +118 -0
- package/.opencode/skills/openspec-explore/SKILL.md +290 -0
- package/.opencode/skills/openspec-ff-change/SKILL.md +101 -0
- package/.opencode/skills/openspec-new-change/SKILL.md +74 -0
- package/.opencode/skills/openspec-onboard/SKILL.md +529 -0
- package/.opencode/skills/openspec-sync-specs/SKILL.md +138 -0
- package/.opencode/skills/openspec-verify-change/SKILL.md +168 -0
- package/dist/cli.js +1171 -71
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/design.md +113 -0
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/proposal.md +28 -0
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/specs/kit-command/spec.md +107 -0
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/specs/kit-install-prompts/spec.md +90 -0
- package/openspec/changes/archive/2026-02-01-add-kit-install-prompts/tasks.md +62 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/.openspec.yaml +2 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/design.md +131 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/proposal.md +35 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/specs/kit-command/spec.md +157 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/specs/opencode-agent-support/spec.md +65 -0
- package/openspec/changes/archive/2026-02-01-add-opencode-agent-support/tasks.md +54 -0
- package/openspec/config.yaml +20 -0
- package/package.json +2 -1
- package/specs/kit-command/spec.md +157 -0
- package/specs/kit-install-prompts/spec.md +90 -0
- package/specs/opencode-agent-support/spec.md +65 -0
package/dist/cli.js
CHANGED
|
@@ -19,6 +19,134 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
20
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
21
21
|
|
|
22
|
+
// node_modules/picocolors/picocolors.js
|
|
23
|
+
var require_picocolors = __commonJS((exports, module) => {
|
|
24
|
+
var p = process || {};
|
|
25
|
+
var argv = p.argv || [];
|
|
26
|
+
var env = p.env || {};
|
|
27
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
28
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
29
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
30
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
31
|
+
};
|
|
32
|
+
var replaceClose = (string, close, replace, index) => {
|
|
33
|
+
let result = "", cursor = 0;
|
|
34
|
+
do {
|
|
35
|
+
result += string.substring(cursor, index) + replace;
|
|
36
|
+
cursor = index + close.length;
|
|
37
|
+
index = string.indexOf(close, cursor);
|
|
38
|
+
} while (~index);
|
|
39
|
+
return result + string.substring(cursor);
|
|
40
|
+
};
|
|
41
|
+
var createColors = (enabled = isColorSupported) => {
|
|
42
|
+
let f = enabled ? formatter : () => String;
|
|
43
|
+
return {
|
|
44
|
+
isColorSupported: enabled,
|
|
45
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
46
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
47
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
48
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
49
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
50
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
51
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
52
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
53
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
54
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
55
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
56
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
57
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
58
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
59
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
60
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
61
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
62
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
63
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
64
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
65
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
66
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
67
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
68
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
69
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
70
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
71
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
72
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
73
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
74
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
75
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
76
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
77
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
78
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
79
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
80
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
81
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
82
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
83
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
84
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
85
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
module.exports = createColors();
|
|
89
|
+
module.exports.createColors = createColors;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// node_modules/sisteransi/src/index.js
|
|
93
|
+
var require_src = __commonJS((exports, module) => {
|
|
94
|
+
var ESC = "\x1B";
|
|
95
|
+
var CSI = `${ESC}[`;
|
|
96
|
+
var beep = "\x07";
|
|
97
|
+
var cursor = {
|
|
98
|
+
to(x, y) {
|
|
99
|
+
if (!y)
|
|
100
|
+
return `${CSI}${x + 1}G`;
|
|
101
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
102
|
+
},
|
|
103
|
+
move(x, y) {
|
|
104
|
+
let ret = "";
|
|
105
|
+
if (x < 0)
|
|
106
|
+
ret += `${CSI}${-x}D`;
|
|
107
|
+
else if (x > 0)
|
|
108
|
+
ret += `${CSI}${x}C`;
|
|
109
|
+
if (y < 0)
|
|
110
|
+
ret += `${CSI}${-y}A`;
|
|
111
|
+
else if (y > 0)
|
|
112
|
+
ret += `${CSI}${y}B`;
|
|
113
|
+
return ret;
|
|
114
|
+
},
|
|
115
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
116
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
117
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
118
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
119
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
120
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
121
|
+
left: `${CSI}G`,
|
|
122
|
+
hide: `${CSI}?25l`,
|
|
123
|
+
show: `${CSI}?25h`,
|
|
124
|
+
save: `${ESC}7`,
|
|
125
|
+
restore: `${ESC}8`
|
|
126
|
+
};
|
|
127
|
+
var scroll = {
|
|
128
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
129
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
130
|
+
};
|
|
131
|
+
var erase = {
|
|
132
|
+
screen: `${CSI}2J`,
|
|
133
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
134
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
135
|
+
line: `${CSI}2K`,
|
|
136
|
+
lineEnd: `${CSI}K`,
|
|
137
|
+
lineStart: `${CSI}1K`,
|
|
138
|
+
lines(count) {
|
|
139
|
+
let clear = "";
|
|
140
|
+
for (let i = 0;i < count; i++)
|
|
141
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
142
|
+
if (count)
|
|
143
|
+
clear += cursor.left;
|
|
144
|
+
return clear;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
148
|
+
});
|
|
149
|
+
|
|
22
150
|
// node_modules/commander/lib/error.js
|
|
23
151
|
var require_error = __commonJS((exports) => {
|
|
24
152
|
class CommanderError extends Error {
|
|
@@ -674,20 +802,20 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
674
802
|
for (let i = 0;i <= a.length; i++) {
|
|
675
803
|
d[i] = [i];
|
|
676
804
|
}
|
|
677
|
-
for (let
|
|
678
|
-
d[0][
|
|
805
|
+
for (let j2 = 0;j2 <= b.length; j2++) {
|
|
806
|
+
d[0][j2] = j2;
|
|
679
807
|
}
|
|
680
|
-
for (let
|
|
808
|
+
for (let j2 = 1;j2 <= b.length; j2++) {
|
|
681
809
|
for (let i = 1;i <= a.length; i++) {
|
|
682
810
|
let cost = 1;
|
|
683
|
-
if (a[i - 1] === b[
|
|
811
|
+
if (a[i - 1] === b[j2 - 1]) {
|
|
684
812
|
cost = 0;
|
|
685
813
|
} else {
|
|
686
814
|
cost = 1;
|
|
687
815
|
}
|
|
688
|
-
d[i][
|
|
689
|
-
if (i > 1 &&
|
|
690
|
-
d[i][
|
|
816
|
+
d[i][j2] = Math.min(d[i - 1][j2] + 1, d[i][j2 - 1] + 1, d[i - 1][j2 - 1] + cost);
|
|
817
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
818
|
+
d[i][j2] = Math.min(d[i][j2], d[i - 2][j2 - 2] + 1);
|
|
691
819
|
}
|
|
692
820
|
}
|
|
693
821
|
}
|
|
@@ -2121,6 +2249,835 @@ import * as path from "node:path";
|
|
|
2121
2249
|
import * as readline from "node:readline/promises";
|
|
2122
2250
|
import { promisify } from "node:util";
|
|
2123
2251
|
|
|
2252
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
2253
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2254
|
+
import { stdout as R, stdin as q } from "node:process";
|
|
2255
|
+
var import_sisteransi = __toESM(require_src(), 1);
|
|
2256
|
+
import ot from "node:readline";
|
|
2257
|
+
var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
|
|
2258
|
+
var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
|
|
2259
|
+
var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
|
|
2260
|
+
var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
2261
|
+
var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
2262
|
+
var M = /\t{1,1000}/y;
|
|
2263
|
+
var P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
2264
|
+
var L = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
2265
|
+
var ct = /\p{M}+/gu;
|
|
2266
|
+
var pt = { limit: 1 / 0, ellipsis: "" };
|
|
2267
|
+
var X = (t, e = {}, s = {}) => {
|
|
2268
|
+
const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, pt, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
2269
|
+
let h = 0, o = 0, f = t.length, v = 0, F = false, d = f, b = Math.max(0, i - n), C = 0, B = 0, c = 0, p = 0;
|
|
2270
|
+
t:
|
|
2271
|
+
for (;; ) {
|
|
2272
|
+
if (B > C || o >= f && o > h) {
|
|
2273
|
+
const ut = t.slice(C, B) || t.slice(h, o);
|
|
2274
|
+
v = 0;
|
|
2275
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
2276
|
+
const $ = Y.codePointAt(0) || 0;
|
|
2277
|
+
if (lt($) ? p = m : ht($) ? p = V : E !== A && at($) ? p = E : p = A, c + p > b && (d = Math.min(d, Math.max(C, h) + v)), c + p > i) {
|
|
2278
|
+
F = true;
|
|
2279
|
+
break t;
|
|
2280
|
+
}
|
|
2281
|
+
v += Y.length, c += p;
|
|
2282
|
+
}
|
|
2283
|
+
C = B = 0;
|
|
2284
|
+
}
|
|
2285
|
+
if (o >= f)
|
|
2286
|
+
break;
|
|
2287
|
+
if (L.lastIndex = o, L.test(t)) {
|
|
2288
|
+
if (v = L.lastIndex - o, p = v * A, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + p > i) {
|
|
2289
|
+
F = true;
|
|
2290
|
+
break;
|
|
2291
|
+
}
|
|
2292
|
+
c += p, C = h, B = o, o = h = L.lastIndex;
|
|
2293
|
+
continue;
|
|
2294
|
+
}
|
|
2295
|
+
if (O.lastIndex = o, O.test(t)) {
|
|
2296
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
2297
|
+
F = true;
|
|
2298
|
+
break;
|
|
2299
|
+
}
|
|
2300
|
+
c += u, C = h, B = o, o = h = O.lastIndex;
|
|
2301
|
+
continue;
|
|
2302
|
+
}
|
|
2303
|
+
if (y.lastIndex = o, y.test(t)) {
|
|
2304
|
+
if (v = y.lastIndex - o, p = v * a, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + p > i) {
|
|
2305
|
+
F = true;
|
|
2306
|
+
break;
|
|
2307
|
+
}
|
|
2308
|
+
c += p, C = h, B = o, o = h = y.lastIndex;
|
|
2309
|
+
continue;
|
|
2310
|
+
}
|
|
2311
|
+
if (M.lastIndex = o, M.test(t)) {
|
|
2312
|
+
if (v = M.lastIndex - o, p = v * l, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + p > i) {
|
|
2313
|
+
F = true;
|
|
2314
|
+
break;
|
|
2315
|
+
}
|
|
2316
|
+
c += p, C = h, B = o, o = h = M.lastIndex;
|
|
2317
|
+
continue;
|
|
2318
|
+
}
|
|
2319
|
+
if (P.lastIndex = o, P.test(t)) {
|
|
2320
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
2321
|
+
F = true;
|
|
2322
|
+
break;
|
|
2323
|
+
}
|
|
2324
|
+
c += g, C = h, B = o, o = h = P.lastIndex;
|
|
2325
|
+
continue;
|
|
2326
|
+
}
|
|
2327
|
+
o += 1;
|
|
2328
|
+
}
|
|
2329
|
+
return { width: F ? b : c, index: F ? d : f, truncated: F, ellipsed: F && i >= n };
|
|
2330
|
+
};
|
|
2331
|
+
var ft = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
2332
|
+
var S = (t, e = {}) => X(t, ft, e).width;
|
|
2333
|
+
var W = "\x1B";
|
|
2334
|
+
var Z = "";
|
|
2335
|
+
var Ft = 39;
|
|
2336
|
+
var j = "\x07";
|
|
2337
|
+
var Q = "[";
|
|
2338
|
+
var dt = "]";
|
|
2339
|
+
var tt = "m";
|
|
2340
|
+
var U = `${dt}8;;`;
|
|
2341
|
+
var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
|
|
2342
|
+
var mt = (t) => {
|
|
2343
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
|
|
2344
|
+
return 39;
|
|
2345
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
|
|
2346
|
+
return 49;
|
|
2347
|
+
if (t === 1 || t === 2)
|
|
2348
|
+
return 22;
|
|
2349
|
+
if (t === 3)
|
|
2350
|
+
return 23;
|
|
2351
|
+
if (t === 4)
|
|
2352
|
+
return 24;
|
|
2353
|
+
if (t === 7)
|
|
2354
|
+
return 27;
|
|
2355
|
+
if (t === 8)
|
|
2356
|
+
return 28;
|
|
2357
|
+
if (t === 9)
|
|
2358
|
+
return 29;
|
|
2359
|
+
if (t === 0)
|
|
2360
|
+
return 0;
|
|
2361
|
+
};
|
|
2362
|
+
var st = (t) => `${W}${Q}${t}${tt}`;
|
|
2363
|
+
var it = (t) => `${W}${U}${t}${j}`;
|
|
2364
|
+
var gt = (t) => t.map((e) => S(e));
|
|
2365
|
+
var G = (t, e, s) => {
|
|
2366
|
+
const i = e[Symbol.iterator]();
|
|
2367
|
+
let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
|
|
2368
|
+
for (;!l.done; ) {
|
|
2369
|
+
const m = l.value, A = S(m);
|
|
2370
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
2371
|
+
}
|
|
2372
|
+
u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
2373
|
+
};
|
|
2374
|
+
var vt = (t) => {
|
|
2375
|
+
const e = t.split(" ");
|
|
2376
|
+
let s = e.length;
|
|
2377
|
+
for (;s > 0 && !(S(e[s - 1]) > 0); )
|
|
2378
|
+
s--;
|
|
2379
|
+
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
2380
|
+
};
|
|
2381
|
+
var Et = (t, e, s = {}) => {
|
|
2382
|
+
if (s.trim !== false && t.trim() === "")
|
|
2383
|
+
return "";
|
|
2384
|
+
let i = "", r, n;
|
|
2385
|
+
const u = t.split(" "), a = gt(u);
|
|
2386
|
+
let l = [""];
|
|
2387
|
+
for (const [h, o] of u.entries()) {
|
|
2388
|
+
s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
2389
|
+
let f = S(l.at(-1) ?? "");
|
|
2390
|
+
if (h !== 0 && (f >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), f = 0), (f > 0 || s.trim === false) && (l[l.length - 1] += " ", f++)), s.hard && a[h] > e) {
|
|
2391
|
+
const v = e - f, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
2392
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
|
|
2393
|
+
continue;
|
|
2394
|
+
}
|
|
2395
|
+
if (f + a[h] > e && f > 0 && a[h] > 0) {
|
|
2396
|
+
if (s.wordWrap === false && f < e) {
|
|
2397
|
+
G(l, o, e);
|
|
2398
|
+
continue;
|
|
2399
|
+
}
|
|
2400
|
+
l.push("");
|
|
2401
|
+
}
|
|
2402
|
+
if (f + a[h] > e && s.wordWrap === false) {
|
|
2403
|
+
G(l, o, e);
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
l[l.length - 1] += o;
|
|
2407
|
+
}
|
|
2408
|
+
s.trim !== false && (l = l.map((h) => vt(h)));
|
|
2409
|
+
const E = l.join(`
|
|
2410
|
+
`), g = E[Symbol.iterator]();
|
|
2411
|
+
let m = g.next(), A = g.next(), V = 0;
|
|
2412
|
+
for (;!m.done; ) {
|
|
2413
|
+
const h = m.value, o = A.value;
|
|
2414
|
+
if (i += h, h === W || h === Z) {
|
|
2415
|
+
et.lastIndex = V + 1;
|
|
2416
|
+
const F = et.exec(E)?.groups;
|
|
2417
|
+
if (F?.code !== undefined) {
|
|
2418
|
+
const d = Number.parseFloat(F.code);
|
|
2419
|
+
r = d === Ft ? undefined : d;
|
|
2420
|
+
} else
|
|
2421
|
+
F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
|
|
2422
|
+
}
|
|
2423
|
+
const f = r ? mt(r) : undefined;
|
|
2424
|
+
o === `
|
|
2425
|
+
` ? (n && (i += it("")), r && f && (i += st(f))) : h === `
|
|
2426
|
+
` && (r && f && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
2427
|
+
}
|
|
2428
|
+
return i;
|
|
2429
|
+
};
|
|
2430
|
+
function K(t, e, s) {
|
|
2431
|
+
return String(t).normalize().replaceAll(`\r
|
|
2432
|
+
`, `
|
|
2433
|
+
`).split(`
|
|
2434
|
+
`).map((i) => Et(i, e, s)).join(`
|
|
2435
|
+
`);
|
|
2436
|
+
}
|
|
2437
|
+
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
2438
|
+
var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
|
|
2439
|
+
function H(t, e) {
|
|
2440
|
+
if (typeof t == "string")
|
|
2441
|
+
return _.aliases.get(t) === e;
|
|
2442
|
+
for (const s of t)
|
|
2443
|
+
if (s !== undefined && H(s, e))
|
|
2444
|
+
return true;
|
|
2445
|
+
return false;
|
|
2446
|
+
}
|
|
2447
|
+
function _t(t, e) {
|
|
2448
|
+
if (t === e)
|
|
2449
|
+
return;
|
|
2450
|
+
const s = t.split(`
|
|
2451
|
+
`), i = e.split(`
|
|
2452
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
2453
|
+
for (let u = 0;u < r; u++)
|
|
2454
|
+
s[u] !== i[u] && n.push(u);
|
|
2455
|
+
return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
|
|
2456
|
+
}
|
|
2457
|
+
var bt = globalThis.process.platform.startsWith("win");
|
|
2458
|
+
var z = Symbol("clack:cancel");
|
|
2459
|
+
function Ct(t) {
|
|
2460
|
+
return t === z;
|
|
2461
|
+
}
|
|
2462
|
+
function T(t, e) {
|
|
2463
|
+
const s = t;
|
|
2464
|
+
s.isTTY && s.setRawMode(e);
|
|
2465
|
+
}
|
|
2466
|
+
var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
|
|
2467
|
+
var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
|
|
2468
|
+
function Bt(t, e, s, i = s) {
|
|
2469
|
+
const r = rt(t ?? R);
|
|
2470
|
+
return K(e, r - s.length, { hard: true, trim: false }).split(`
|
|
2471
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
2472
|
+
`);
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
class x {
|
|
2476
|
+
input;
|
|
2477
|
+
output;
|
|
2478
|
+
_abortSignal;
|
|
2479
|
+
rl;
|
|
2480
|
+
opts;
|
|
2481
|
+
_render;
|
|
2482
|
+
_track = false;
|
|
2483
|
+
_prevFrame = "";
|
|
2484
|
+
_subscribers = new Map;
|
|
2485
|
+
_cursor = 0;
|
|
2486
|
+
state = "initial";
|
|
2487
|
+
error = "";
|
|
2488
|
+
value;
|
|
2489
|
+
userInput = "";
|
|
2490
|
+
constructor(e, s = true) {
|
|
2491
|
+
const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
|
|
2492
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
|
|
2493
|
+
}
|
|
2494
|
+
unsubscribe() {
|
|
2495
|
+
this._subscribers.clear();
|
|
2496
|
+
}
|
|
2497
|
+
setSubscriber(e, s) {
|
|
2498
|
+
const i = this._subscribers.get(e) ?? [];
|
|
2499
|
+
i.push(s), this._subscribers.set(e, i);
|
|
2500
|
+
}
|
|
2501
|
+
on(e, s) {
|
|
2502
|
+
this.setSubscriber(e, { cb: s });
|
|
2503
|
+
}
|
|
2504
|
+
once(e, s) {
|
|
2505
|
+
this.setSubscriber(e, { cb: s, once: true });
|
|
2506
|
+
}
|
|
2507
|
+
emit(e, ...s) {
|
|
2508
|
+
const i = this._subscribers.get(e) ?? [], r = [];
|
|
2509
|
+
for (const n of i)
|
|
2510
|
+
n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
2511
|
+
for (const n of r)
|
|
2512
|
+
n();
|
|
2513
|
+
}
|
|
2514
|
+
prompt() {
|
|
2515
|
+
return new Promise((e) => {
|
|
2516
|
+
if (this._abortSignal) {
|
|
2517
|
+
if (this._abortSignal.aborted)
|
|
2518
|
+
return this.state = "cancel", this.close(), e(z);
|
|
2519
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
2520
|
+
this.state = "cancel", this.close();
|
|
2521
|
+
}, { once: true });
|
|
2522
|
+
}
|
|
2523
|
+
this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
2524
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
|
|
2525
|
+
}), this.once("cancel", () => {
|
|
2526
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
|
|
2527
|
+
});
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
_isActionKey(e, s) {
|
|
2531
|
+
return e === "\t";
|
|
2532
|
+
}
|
|
2533
|
+
_setValue(e) {
|
|
2534
|
+
this.value = e, this.emit("value", this.value);
|
|
2535
|
+
}
|
|
2536
|
+
_setUserInput(e, s) {
|
|
2537
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
2538
|
+
}
|
|
2539
|
+
_clearUserInput() {
|
|
2540
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
2541
|
+
}
|
|
2542
|
+
onKeypress(e, s) {
|
|
2543
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
|
|
2544
|
+
if (this.opts.validate) {
|
|
2545
|
+
const i = this.opts.validate(this.value);
|
|
2546
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
2547
|
+
}
|
|
2548
|
+
this.state !== "error" && (this.state = "submit");
|
|
2549
|
+
}
|
|
2550
|
+
H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
2551
|
+
}
|
|
2552
|
+
close() {
|
|
2553
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
2554
|
+
`), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
2555
|
+
}
|
|
2556
|
+
restoreCursor() {
|
|
2557
|
+
const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
2558
|
+
`).length - 1;
|
|
2559
|
+
this.output.write(import_sisteransi.cursor.move(-999, e * -1));
|
|
2560
|
+
}
|
|
2561
|
+
render() {
|
|
2562
|
+
const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
2563
|
+
if (e !== this._prevFrame) {
|
|
2564
|
+
if (this.state === "initial")
|
|
2565
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
2566
|
+
else {
|
|
2567
|
+
const s = _t(this._prevFrame, e), i = nt(this.output);
|
|
2568
|
+
if (this.restoreCursor(), s) {
|
|
2569
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
2570
|
+
let u = s.lines.find((a) => a >= r);
|
|
2571
|
+
if (u === undefined) {
|
|
2572
|
+
this._prevFrame = e;
|
|
2573
|
+
return;
|
|
2574
|
+
}
|
|
2575
|
+
if (s.lines.length === 1) {
|
|
2576
|
+
this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
2577
|
+
const a = e.split(`
|
|
2578
|
+
`);
|
|
2579
|
+
this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
|
|
2580
|
+
return;
|
|
2581
|
+
} else if (s.lines.length > 1) {
|
|
2582
|
+
if (r < n)
|
|
2583
|
+
u = r;
|
|
2584
|
+
else {
|
|
2585
|
+
const l = u - n;
|
|
2586
|
+
l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
|
|
2587
|
+
}
|
|
2588
|
+
this.output.write(import_sisteransi.erase.down());
|
|
2589
|
+
const a = e.split(`
|
|
2590
|
+
`).slice(u);
|
|
2591
|
+
this.output.write(a.join(`
|
|
2592
|
+
`)), this._prevFrame = e;
|
|
2593
|
+
return;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
this.output.write(import_sisteransi.erase.down());
|
|
2597
|
+
}
|
|
2598
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
function wt(t, e) {
|
|
2603
|
+
if (t === undefined || e.length === 0)
|
|
2604
|
+
return 0;
|
|
2605
|
+
const s = e.findIndex((i) => i.value === t);
|
|
2606
|
+
return s !== -1 ? s : 0;
|
|
2607
|
+
}
|
|
2608
|
+
function Dt(t, e) {
|
|
2609
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
|
|
2610
|
+
}
|
|
2611
|
+
function St(t, e) {
|
|
2612
|
+
if (e)
|
|
2613
|
+
return t ? e : e[0];
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
class Vt extends x {
|
|
2617
|
+
filteredOptions;
|
|
2618
|
+
multiple;
|
|
2619
|
+
isNavigating = false;
|
|
2620
|
+
selectedValues = [];
|
|
2621
|
+
focusedValue;
|
|
2622
|
+
#t = 0;
|
|
2623
|
+
#s = "";
|
|
2624
|
+
#i;
|
|
2625
|
+
#e;
|
|
2626
|
+
get cursor() {
|
|
2627
|
+
return this.#t;
|
|
2628
|
+
}
|
|
2629
|
+
get userInputWithCursor() {
|
|
2630
|
+
if (!this.userInput)
|
|
2631
|
+
return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
2632
|
+
if (this._cursor >= this.userInput.length)
|
|
2633
|
+
return `${this.userInput}█`;
|
|
2634
|
+
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
2635
|
+
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
2636
|
+
}
|
|
2637
|
+
get options() {
|
|
2638
|
+
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
2639
|
+
}
|
|
2640
|
+
constructor(e) {
|
|
2641
|
+
super(e), this.#e = e.options;
|
|
2642
|
+
const s = this.options;
|
|
2643
|
+
this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
|
|
2644
|
+
let i;
|
|
2645
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
|
|
2646
|
+
for (const r of i) {
|
|
2647
|
+
const n = s.findIndex((u) => u.value === r);
|
|
2648
|
+
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
2649
|
+
}
|
|
2650
|
+
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
2651
|
+
}
|
|
2652
|
+
_isActionKey(e, s) {
|
|
2653
|
+
return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
|
|
2654
|
+
}
|
|
2655
|
+
#r(e, s) {
|
|
2656
|
+
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
2657
|
+
i || r ? (this.#t = Math.max(0, Math.min(this.#t + (i ? -1 : 1), this.filteredOptions.length - 1)), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
2658
|
+
}
|
|
2659
|
+
deselectAll() {
|
|
2660
|
+
this.selectedValues = [];
|
|
2661
|
+
}
|
|
2662
|
+
toggleSelected(e) {
|
|
2663
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
2664
|
+
}
|
|
2665
|
+
#n(e) {
|
|
2666
|
+
if (e !== this.#s) {
|
|
2667
|
+
this.#s = e;
|
|
2668
|
+
const s = this.options;
|
|
2669
|
+
e ? this.filteredOptions = s.filter((i) => this.#i(e, i)) : this.filteredOptions = [...s], this.#t = wt(this.focusedValue, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
class yt extends x {
|
|
2674
|
+
options;
|
|
2675
|
+
cursor = 0;
|
|
2676
|
+
#t;
|
|
2677
|
+
getGroupItems(e) {
|
|
2678
|
+
return this.options.filter((s) => s.group === e);
|
|
2679
|
+
}
|
|
2680
|
+
isGroupSelected(e) {
|
|
2681
|
+
const s = this.getGroupItems(e), i = this.value;
|
|
2682
|
+
return i === undefined ? false : s.every((r) => i.includes(r.value));
|
|
2683
|
+
}
|
|
2684
|
+
toggleValue() {
|
|
2685
|
+
const e = this.options[this.cursor];
|
|
2686
|
+
if (this.value === undefined && (this.value = []), e.group === true) {
|
|
2687
|
+
const s = e.value, i = this.getGroupItems(s);
|
|
2688
|
+
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
2689
|
+
} else {
|
|
2690
|
+
const s = this.value.includes(e.value);
|
|
2691
|
+
this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
constructor(e) {
|
|
2695
|
+
super(e, false);
|
|
2696
|
+
const { options: s } = e;
|
|
2697
|
+
this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
2698
|
+
switch (i) {
|
|
2699
|
+
case "left":
|
|
2700
|
+
case "up": {
|
|
2701
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
2702
|
+
const r = this.options[this.cursor]?.group === true;
|
|
2703
|
+
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
2704
|
+
break;
|
|
2705
|
+
}
|
|
2706
|
+
case "down":
|
|
2707
|
+
case "right": {
|
|
2708
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
2709
|
+
const r = this.options[this.cursor]?.group === true;
|
|
2710
|
+
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
2711
|
+
break;
|
|
2712
|
+
}
|
|
2713
|
+
case "space":
|
|
2714
|
+
this.toggleValue();
|
|
2715
|
+
break;
|
|
2716
|
+
}
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
function D(t, e, s) {
|
|
2721
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
2722
|
+
return s[n].disabled ? D(n, e < 0 ? -1 : 1, s) : n;
|
|
2723
|
+
}
|
|
2724
|
+
class Wt extends x {
|
|
2725
|
+
options;
|
|
2726
|
+
cursor = 0;
|
|
2727
|
+
get _selectedValue() {
|
|
2728
|
+
return this.options[this.cursor];
|
|
2729
|
+
}
|
|
2730
|
+
changeValue() {
|
|
2731
|
+
this.value = this._selectedValue.value;
|
|
2732
|
+
}
|
|
2733
|
+
constructor(e) {
|
|
2734
|
+
super(e, false), this.options = e.options;
|
|
2735
|
+
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
2736
|
+
this.cursor = this.options[i].disabled ? D(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
2737
|
+
switch (r) {
|
|
2738
|
+
case "left":
|
|
2739
|
+
case "up":
|
|
2740
|
+
this.cursor = D(this.cursor, -1, this.options);
|
|
2741
|
+
break;
|
|
2742
|
+
case "down":
|
|
2743
|
+
case "right":
|
|
2744
|
+
this.cursor = D(this.cursor, 1, this.options);
|
|
2745
|
+
break;
|
|
2746
|
+
}
|
|
2747
|
+
this.changeValue();
|
|
2748
|
+
});
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
2753
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
2754
|
+
import P2 from "node:process";
|
|
2755
|
+
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
2756
|
+
function ht2() {
|
|
2757
|
+
return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2758
|
+
}
|
|
2759
|
+
var ee = ht2();
|
|
2760
|
+
var w2 = (e, r) => ee ? e : r;
|
|
2761
|
+
var Me = w2("◆", "*");
|
|
2762
|
+
var ce = w2("■", "x");
|
|
2763
|
+
var de = w2("▲", "x");
|
|
2764
|
+
var k = w2("◇", "o");
|
|
2765
|
+
var $e = w2("┌", "T");
|
|
2766
|
+
var h = w2("│", "|");
|
|
2767
|
+
var x2 = w2("└", "—");
|
|
2768
|
+
var Re = w2("┐", "T");
|
|
2769
|
+
var Oe = w2("┘", "—");
|
|
2770
|
+
var Y = w2("●", ">");
|
|
2771
|
+
var K2 = w2("○", " ");
|
|
2772
|
+
var te = w2("◻", "[•]");
|
|
2773
|
+
var G2 = w2("◼", "[+]");
|
|
2774
|
+
var z2 = w2("◻", "[ ]");
|
|
2775
|
+
var Pe = w2("▪", "•");
|
|
2776
|
+
var se = w2("─", "-");
|
|
2777
|
+
var he = w2("╮", "+");
|
|
2778
|
+
var Ne = w2("├", "+");
|
|
2779
|
+
var me = w2("╯", "+");
|
|
2780
|
+
var pe = w2("╰", "+");
|
|
2781
|
+
var We = w2("╭", "+");
|
|
2782
|
+
var ge = w2("●", "•");
|
|
2783
|
+
var fe = w2("◆", "*");
|
|
2784
|
+
var Fe = w2("▲", "!");
|
|
2785
|
+
var ye = w2("■", "x");
|
|
2786
|
+
var N2 = (e) => {
|
|
2787
|
+
switch (e) {
|
|
2788
|
+
case "initial":
|
|
2789
|
+
case "active":
|
|
2790
|
+
return import_picocolors2.default.cyan(Me);
|
|
2791
|
+
case "cancel":
|
|
2792
|
+
return import_picocolors2.default.red(ce);
|
|
2793
|
+
case "error":
|
|
2794
|
+
return import_picocolors2.default.yellow(de);
|
|
2795
|
+
case "submit":
|
|
2796
|
+
return import_picocolors2.default.green(k);
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
var Ee = (e) => {
|
|
2800
|
+
switch (e) {
|
|
2801
|
+
case "initial":
|
|
2802
|
+
case "active":
|
|
2803
|
+
return import_picocolors2.default.cyan(h);
|
|
2804
|
+
case "cancel":
|
|
2805
|
+
return import_picocolors2.default.red(h);
|
|
2806
|
+
case "error":
|
|
2807
|
+
return import_picocolors2.default.yellow(h);
|
|
2808
|
+
case "submit":
|
|
2809
|
+
return import_picocolors2.default.green(h);
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
|
|
2813
|
+
var pt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
|
|
2814
|
+
var gt2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
|
|
2815
|
+
var ve = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
2816
|
+
var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
2817
|
+
var ie = /\t{1,1000}/y;
|
|
2818
|
+
var Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
2819
|
+
var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
2820
|
+
var ft2 = /\p{M}+/gu;
|
|
2821
|
+
var Ft2 = { limit: 1 / 0, ellipsis: "" };
|
|
2822
|
+
var Le = (e, r = {}, s = {}) => {
|
|
2823
|
+
const i = r.limit ?? 1 / 0, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Le(n, Ft2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, a = s.tabWidth ?? 8, d = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, E = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, y2 = s.wideWidth ?? 2;
|
|
2824
|
+
let $ = 0, c = 0, m = e.length, f = 0, F = false, v = m, S2 = Math.max(0, i - o), B = 0, b = 0, A = 0, C = 0;
|
|
2825
|
+
e:
|
|
2826
|
+
for (;; ) {
|
|
2827
|
+
if (b > B || c >= m && c > $) {
|
|
2828
|
+
const _2 = e.slice(B, b) || e.slice($, c);
|
|
2829
|
+
f = 0;
|
|
2830
|
+
for (const D2 of _2.replaceAll(ft2, "")) {
|
|
2831
|
+
const T2 = D2.codePointAt(0) || 0;
|
|
2832
|
+
if (pt2(T2) ? C = E : gt2(T2) ? C = y2 : d !== p && mt2(T2) ? C = d : C = p, A + C > S2 && (v = Math.min(v, Math.max(B, $) + f)), A + C > i) {
|
|
2833
|
+
F = true;
|
|
2834
|
+
break e;
|
|
2835
|
+
}
|
|
2836
|
+
f += D2.length, A += C;
|
|
2837
|
+
}
|
|
2838
|
+
B = b = 0;
|
|
2839
|
+
}
|
|
2840
|
+
if (c >= m)
|
|
2841
|
+
break;
|
|
2842
|
+
if (ne.lastIndex = c, ne.test(e)) {
|
|
2843
|
+
if (f = ne.lastIndex - c, C = f * p, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / p))), A + C > i) {
|
|
2844
|
+
F = true;
|
|
2845
|
+
break;
|
|
2846
|
+
}
|
|
2847
|
+
A += C, B = $, b = c, c = $ = ne.lastIndex;
|
|
2848
|
+
continue;
|
|
2849
|
+
}
|
|
2850
|
+
if (ve.lastIndex = c, ve.test(e)) {
|
|
2851
|
+
if (A + u > S2 && (v = Math.min(v, c)), A + u > i) {
|
|
2852
|
+
F = true;
|
|
2853
|
+
break;
|
|
2854
|
+
}
|
|
2855
|
+
A += u, B = $, b = c, c = $ = ve.lastIndex;
|
|
2856
|
+
continue;
|
|
2857
|
+
}
|
|
2858
|
+
if (re.lastIndex = c, re.test(e)) {
|
|
2859
|
+
if (f = re.lastIndex - c, C = f * l, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / l))), A + C > i) {
|
|
2860
|
+
F = true;
|
|
2861
|
+
break;
|
|
2862
|
+
}
|
|
2863
|
+
A += C, B = $, b = c, c = $ = re.lastIndex;
|
|
2864
|
+
continue;
|
|
2865
|
+
}
|
|
2866
|
+
if (ie.lastIndex = c, ie.test(e)) {
|
|
2867
|
+
if (f = ie.lastIndex - c, C = f * a, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / a))), A + C > i) {
|
|
2868
|
+
F = true;
|
|
2869
|
+
break;
|
|
2870
|
+
}
|
|
2871
|
+
A += C, B = $, b = c, c = $ = ie.lastIndex;
|
|
2872
|
+
continue;
|
|
2873
|
+
}
|
|
2874
|
+
if (Ae.lastIndex = c, Ae.test(e)) {
|
|
2875
|
+
if (A + g > S2 && (v = Math.min(v, c)), A + g > i) {
|
|
2876
|
+
F = true;
|
|
2877
|
+
break;
|
|
2878
|
+
}
|
|
2879
|
+
A += g, B = $, b = c, c = $ = Ae.lastIndex;
|
|
2880
|
+
continue;
|
|
2881
|
+
}
|
|
2882
|
+
c += 1;
|
|
2883
|
+
}
|
|
2884
|
+
return { width: F ? S2 : A, index: F ? v : m, truncated: F, ellipsed: F && i >= o };
|
|
2885
|
+
};
|
|
2886
|
+
var yt2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
|
|
2887
|
+
var M2 = (e, r = {}) => Le(e, yt2, r).width;
|
|
2888
|
+
var ae = "\x1B";
|
|
2889
|
+
var je = "";
|
|
2890
|
+
var Et2 = 39;
|
|
2891
|
+
var Ce = "\x07";
|
|
2892
|
+
var Ve = "[";
|
|
2893
|
+
var vt2 = "]";
|
|
2894
|
+
var ke = "m";
|
|
2895
|
+
var we = `${vt2}8;;`;
|
|
2896
|
+
var Ge = new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${we}(?<uri>.*)${Ce})`, "y");
|
|
2897
|
+
var At2 = (e) => {
|
|
2898
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
|
|
2899
|
+
return 39;
|
|
2900
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
|
|
2901
|
+
return 49;
|
|
2902
|
+
if (e === 1 || e === 2)
|
|
2903
|
+
return 22;
|
|
2904
|
+
if (e === 3)
|
|
2905
|
+
return 23;
|
|
2906
|
+
if (e === 4)
|
|
2907
|
+
return 24;
|
|
2908
|
+
if (e === 7)
|
|
2909
|
+
return 27;
|
|
2910
|
+
if (e === 8)
|
|
2911
|
+
return 28;
|
|
2912
|
+
if (e === 9)
|
|
2913
|
+
return 29;
|
|
2914
|
+
if (e === 0)
|
|
2915
|
+
return 0;
|
|
2916
|
+
};
|
|
2917
|
+
var He = (e) => `${ae}${Ve}${e}${ke}`;
|
|
2918
|
+
var Ue = (e) => `${ae}${we}${e}${Ce}`;
|
|
2919
|
+
var Ct2 = (e) => e.map((r) => M2(r));
|
|
2920
|
+
var Se = (e, r, s) => {
|
|
2921
|
+
const i = r[Symbol.iterator]();
|
|
2922
|
+
let n = false, o = false, u = e.at(-1), l = u === undefined ? 0 : M2(u), a = i.next(), d = i.next(), g = 0;
|
|
2923
|
+
for (;!a.done; ) {
|
|
2924
|
+
const E = a.value, p = M2(E);
|
|
2925
|
+
l + p <= s ? e[e.length - 1] += E : (e.push(E), l = 0), (E === ae || E === je) && (n = true, o = r.startsWith(we, g + 1)), n ? o ? E === Ce && (n = false, o = false) : E === ke && (n = false) : (l += p, l === s && !d.done && (e.push(""), l = 0)), a = d, d = i.next(), g += E.length;
|
|
2926
|
+
}
|
|
2927
|
+
u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
2928
|
+
};
|
|
2929
|
+
var wt2 = (e) => {
|
|
2930
|
+
const r = e.split(" ");
|
|
2931
|
+
let s = r.length;
|
|
2932
|
+
for (;s > 0 && !(M2(r[s - 1]) > 0); )
|
|
2933
|
+
s--;
|
|
2934
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
2935
|
+
};
|
|
2936
|
+
var St2 = (e, r, s = {}) => {
|
|
2937
|
+
if (s.trim !== false && e.trim() === "")
|
|
2938
|
+
return "";
|
|
2939
|
+
let i = "", n, o;
|
|
2940
|
+
const u = e.split(" "), l = Ct2(u);
|
|
2941
|
+
let a = [""];
|
|
2942
|
+
for (const [$, c] of u.entries()) {
|
|
2943
|
+
s.trim !== false && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
|
|
2944
|
+
let m = M2(a.at(-1) ?? "");
|
|
2945
|
+
if ($ !== 0 && (m >= r && (s.wordWrap === false || s.trim === false) && (a.push(""), m = 0), (m > 0 || s.trim === false) && (a[a.length - 1] += " ", m++)), s.hard && l[$] > r) {
|
|
2946
|
+
const f = r - m, F = 1 + Math.floor((l[$] - f - 1) / r);
|
|
2947
|
+
Math.floor((l[$] - 1) / r) < F && a.push(""), Se(a, c, r);
|
|
2948
|
+
continue;
|
|
2949
|
+
}
|
|
2950
|
+
if (m + l[$] > r && m > 0 && l[$] > 0) {
|
|
2951
|
+
if (s.wordWrap === false && m < r) {
|
|
2952
|
+
Se(a, c, r);
|
|
2953
|
+
continue;
|
|
2954
|
+
}
|
|
2955
|
+
a.push("");
|
|
2956
|
+
}
|
|
2957
|
+
if (m + l[$] > r && s.wordWrap === false) {
|
|
2958
|
+
Se(a, c, r);
|
|
2959
|
+
continue;
|
|
2960
|
+
}
|
|
2961
|
+
a[a.length - 1] += c;
|
|
2962
|
+
}
|
|
2963
|
+
s.trim !== false && (a = a.map(($) => wt2($)));
|
|
2964
|
+
const d = a.join(`
|
|
2965
|
+
`), g = d[Symbol.iterator]();
|
|
2966
|
+
let E = g.next(), p = g.next(), y2 = 0;
|
|
2967
|
+
for (;!E.done; ) {
|
|
2968
|
+
const $ = E.value, c = p.value;
|
|
2969
|
+
if (i += $, $ === ae || $ === je) {
|
|
2970
|
+
Ge.lastIndex = y2 + 1;
|
|
2971
|
+
const F = Ge.exec(d)?.groups;
|
|
2972
|
+
if (F?.code !== undefined) {
|
|
2973
|
+
const v = Number.parseFloat(F.code);
|
|
2974
|
+
n = v === Et2 ? undefined : v;
|
|
2975
|
+
} else
|
|
2976
|
+
F?.uri !== undefined && (o = F.uri.length === 0 ? undefined : F.uri);
|
|
2977
|
+
}
|
|
2978
|
+
const m = n ? At2(n) : undefined;
|
|
2979
|
+
c === `
|
|
2980
|
+
` ? (o && (i += Ue("")), n && m && (i += He(m))) : $ === `
|
|
2981
|
+
` && (n && m && (i += He(n)), o && (i += Ue(o))), y2 += $.length, E = p, p = g.next();
|
|
2982
|
+
}
|
|
2983
|
+
return i;
|
|
2984
|
+
};
|
|
2985
|
+
function q2(e, r, s) {
|
|
2986
|
+
return String(e).normalize().replaceAll(`\r
|
|
2987
|
+
`, `
|
|
2988
|
+
`).split(`
|
|
2989
|
+
`).map((i) => St2(i, r, s)).join(`
|
|
2990
|
+
`);
|
|
2991
|
+
}
|
|
2992
|
+
var It2 = (e, r, s, i, n) => {
|
|
2993
|
+
let o = r, u = 0;
|
|
2994
|
+
for (let l = s;l < i; l++) {
|
|
2995
|
+
const a = e[l];
|
|
2996
|
+
if (o = o - a.length, u++, o <= n)
|
|
2997
|
+
break;
|
|
2998
|
+
}
|
|
2999
|
+
return { lineCount: o, removals: u };
|
|
3000
|
+
};
|
|
3001
|
+
var J = (e) => {
|
|
3002
|
+
const { cursor: r, options: s, style: i } = e, n = e.output ?? process.stdout, o = rt(n), u = e.columnPadding ?? 0, l = e.rowPadding ?? 4, a = o - u, d = nt(n), g = import_picocolors2.default.dim("..."), E = e.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(d - l, 0), y2 = Math.max(Math.min(E, p), 5);
|
|
3003
|
+
let $ = 0;
|
|
3004
|
+
r >= y2 - 3 && ($ = Math.max(Math.min(r - y2 + 3, s.length - y2), 0));
|
|
3005
|
+
let c = y2 < s.length && $ > 0, m = y2 < s.length && $ + y2 < s.length;
|
|
3006
|
+
const f = Math.min($ + y2, s.length), F = [];
|
|
3007
|
+
let v = 0;
|
|
3008
|
+
c && v++, m && v++;
|
|
3009
|
+
const S2 = $ + (c ? 1 : 0), B = f - (m ? 1 : 0);
|
|
3010
|
+
for (let A = S2;A < B; A++) {
|
|
3011
|
+
const C = q2(i(s[A], A === r), a, { hard: true, trim: false }).split(`
|
|
3012
|
+
`);
|
|
3013
|
+
F.push(C), v += C.length;
|
|
3014
|
+
}
|
|
3015
|
+
if (v > p) {
|
|
3016
|
+
let A = 0, C = 0, _2 = v;
|
|
3017
|
+
const D2 = r - S2, T2 = (W2, I2) => It2(F, _2, W2, I2, p);
|
|
3018
|
+
c ? ({ lineCount: _2, removals: A } = T2(0, D2), _2 > p && ({ lineCount: _2, removals: C } = T2(D2 + 1, F.length))) : ({ lineCount: _2, removals: C } = T2(D2 + 1, F.length), _2 > p && ({ lineCount: _2, removals: A } = T2(0, D2))), A > 0 && (c = true, F.splice(0, A)), C > 0 && (m = true, F.splice(F.length - C, C));
|
|
3019
|
+
}
|
|
3020
|
+
const b = [];
|
|
3021
|
+
c && b.push(g);
|
|
3022
|
+
for (const A of F)
|
|
3023
|
+
for (const C of A)
|
|
3024
|
+
b.push(C);
|
|
3025
|
+
return m && b.push(g), b;
|
|
3026
|
+
};
|
|
3027
|
+
var Pt = (e = "", r) => {
|
|
3028
|
+
(r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(e)}
|
|
3029
|
+
|
|
3030
|
+
`);
|
|
3031
|
+
};
|
|
3032
|
+
var Ut = import_picocolors2.default.magenta;
|
|
3033
|
+
var Ye = { light: w2("─", "-"), heavy: w2("━", "="), block: w2("█", "#") };
|
|
3034
|
+
var oe = (e, r) => e.includes(`
|
|
3035
|
+
`) ? e.split(`
|
|
3036
|
+
`).map((s) => r(s)).join(`
|
|
3037
|
+
`) : r(e);
|
|
3038
|
+
var qt = (e) => {
|
|
3039
|
+
const r = (s, i) => {
|
|
3040
|
+
const n = s.label ?? String(s.value);
|
|
3041
|
+
switch (i) {
|
|
3042
|
+
case "disabled":
|
|
3043
|
+
return `${import_picocolors2.default.gray(K2)} ${oe(n, import_picocolors2.default.gray)}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
3044
|
+
case "selected":
|
|
3045
|
+
return `${oe(n, import_picocolors2.default.dim)}`;
|
|
3046
|
+
case "active":
|
|
3047
|
+
return `${import_picocolors2.default.green(Y)} ${n}${s.hint ? ` ${import_picocolors2.default.dim(`(${s.hint})`)}` : ""}`;
|
|
3048
|
+
case "cancelled":
|
|
3049
|
+
return `${oe(n, (o) => import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o)))}`;
|
|
3050
|
+
default:
|
|
3051
|
+
return `${import_picocolors2.default.dim(K2)} ${oe(n, import_picocolors2.default.dim)}`;
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
return new Wt({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue, render() {
|
|
3055
|
+
const s = `${N2(this.state)} `, i = `${Ee(this.state)} `, n = Bt(e.output, e.message, i, s), o = `${import_picocolors2.default.gray(h)}
|
|
3056
|
+
${n}
|
|
3057
|
+
`;
|
|
3058
|
+
switch (this.state) {
|
|
3059
|
+
case "submit": {
|
|
3060
|
+
const u = `${import_picocolors2.default.gray(h)} `, l = Bt(e.output, r(this.options[this.cursor], "selected"), u);
|
|
3061
|
+
return `${o}${l}`;
|
|
3062
|
+
}
|
|
3063
|
+
case "cancel": {
|
|
3064
|
+
const u = `${import_picocolors2.default.gray(h)} `, l = Bt(e.output, r(this.options[this.cursor], "cancelled"), u);
|
|
3065
|
+
return `${o}${l}
|
|
3066
|
+
${import_picocolors2.default.gray(h)}`;
|
|
3067
|
+
}
|
|
3068
|
+
default: {
|
|
3069
|
+
const u = `${import_picocolors2.default.cyan(h)} `, l = o.split(`
|
|
3070
|
+
`).length;
|
|
3071
|
+
return `${o}${u}${J({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: u.length, rowPadding: l + 2, style: (a, d) => r(a, a.disabled ? "disabled" : d ? "active" : "inactive") }).join(`
|
|
3072
|
+
${u}`)}
|
|
3073
|
+
${import_picocolors2.default.cyan(x2)}
|
|
3074
|
+
`;
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
} }).prompt();
|
|
3078
|
+
};
|
|
3079
|
+
var ze = `${import_picocolors2.default.gray(h)} `;
|
|
3080
|
+
|
|
2124
3081
|
// node_modules/commander/esm.mjs
|
|
2125
3082
|
var import__ = __toESM(require_commander(), 1);
|
|
2126
3083
|
var {
|
|
@@ -2199,10 +3156,7 @@ var AUTH_FILE = path.join(AUTH_DIR, "auth.json");
|
|
|
2199
3156
|
var AUGMENT_DIR = path.join(os.homedir(), ".augment");
|
|
2200
3157
|
var AUGMENT_SESSION_FILE = path.join(AUGMENT_DIR, "session.json");
|
|
2201
3158
|
var AUGMENT_COMMANDS_DIR = path.join(AUGMENT_DIR, "commands");
|
|
2202
|
-
var
|
|
2203
|
-
var CLAUDE_DIR = path.join(os.homedir(), ".claude");
|
|
2204
|
-
var CLAUDE_COMMANDS_DIR = path.join(CLAUDE_DIR, "commands");
|
|
2205
|
-
var CLAUDE_AGENTS_DIR = path.join(CLAUDE_DIR, "agents");
|
|
3159
|
+
var CLAUDE_COMMANDS_DIR = path.join(os.homedir(), ".claude", "commands");
|
|
2206
3160
|
function loadConfig() {
|
|
2207
3161
|
const apiUrl = process.env.AUGMENT_GATEWAY_URL || "https://augmentgateway.1app.space";
|
|
2208
3162
|
return { apiUrl };
|
|
@@ -2324,33 +3278,6 @@ async function getAllPrompts(token, apiUrl, spinner) {
|
|
|
2324
3278
|
}
|
|
2325
3279
|
return allPrompts;
|
|
2326
3280
|
}
|
|
2327
|
-
async function savePromptToFile(prompt) {
|
|
2328
|
-
const markdownContent = `---
|
|
2329
|
-
description: ${prompt.name}
|
|
2330
|
-
type: "manual"
|
|
2331
|
-
---
|
|
2332
|
-
|
|
2333
|
-
${prompt.content}`;
|
|
2334
|
-
let augmentError = null;
|
|
2335
|
-
let claudeError = null;
|
|
2336
|
-
try {
|
|
2337
|
-
await fs.mkdir(AUGMENT_COMMANDS_DIR, { recursive: true });
|
|
2338
|
-
const filePath = path.join(AUGMENT_COMMANDS_DIR, `${prompt.command}.md`);
|
|
2339
|
-
await fs.writeFile(filePath, markdownContent, "utf-8");
|
|
2340
|
-
} catch (error) {
|
|
2341
|
-
augmentError = new Error(`Failed to save to .augment: ${error}`);
|
|
2342
|
-
}
|
|
2343
|
-
try {
|
|
2344
|
-
await fs.mkdir(CLAUDE_COMMANDS_DIR, { recursive: true });
|
|
2345
|
-
const filePath = path.join(CLAUDE_COMMANDS_DIR, `${prompt.command}.md`);
|
|
2346
|
-
await fs.writeFile(filePath, markdownContent, "utf-8");
|
|
2347
|
-
} catch (error) {
|
|
2348
|
-
claudeError = new Error(`Failed to save to .claude: ${error}`);
|
|
2349
|
-
}
|
|
2350
|
-
if (augmentError && claudeError) {
|
|
2351
|
-
throw new Error(`Failed to save prompt file for command '${prompt.command}': ${augmentError.message}; ${claudeError.message}`);
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
3281
|
async function deleteAllCommandFiles() {
|
|
2355
3282
|
try {
|
|
2356
3283
|
await fs.access(AUGMENT_COMMANDS_DIR);
|
|
@@ -2390,43 +3317,166 @@ function mapModelName(model) {
|
|
|
2390
3317
|
}
|
|
2391
3318
|
return model;
|
|
2392
3319
|
}
|
|
2393
|
-
async function
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
3320
|
+
async function promptAITarget() {
|
|
3321
|
+
const target = await qt({
|
|
3322
|
+
message: "Which AI tool do you want to install to?",
|
|
3323
|
+
options: [
|
|
3324
|
+
{ value: "claude", label: "Claude" },
|
|
3325
|
+
{ value: "augment", label: "Augment" },
|
|
3326
|
+
{ value: "opencode", label: "OpenCode" },
|
|
3327
|
+
{ value: "both", label: "Both" }
|
|
3328
|
+
]
|
|
3329
|
+
});
|
|
3330
|
+
if (Ct(target)) {
|
|
3331
|
+
Pt("Operation cancelled");
|
|
3332
|
+
process.exit(0);
|
|
3333
|
+
}
|
|
3334
|
+
return target;
|
|
3335
|
+
}
|
|
3336
|
+
async function promptInstallScope() {
|
|
3337
|
+
const scope = await qt({
|
|
3338
|
+
message: "Where do you want to install?",
|
|
3339
|
+
options: [
|
|
3340
|
+
{ value: "project", label: "Project level (./.augment, ./.claude, or ./.opencode)" },
|
|
3341
|
+
{ value: "user", label: "User level (~/.augment, ~/.claude, or ~/.config/opencode)" }
|
|
3342
|
+
]
|
|
3343
|
+
});
|
|
3344
|
+
if (Ct(scope)) {
|
|
3345
|
+
Pt("Operation cancelled");
|
|
3346
|
+
process.exit(0);
|
|
3347
|
+
}
|
|
3348
|
+
return scope;
|
|
3349
|
+
}
|
|
3350
|
+
function resolveInstallPaths(target, scope) {
|
|
3351
|
+
const baseDir = scope === "user" ? os.homedir() : process.cwd();
|
|
3352
|
+
const paths = {};
|
|
3353
|
+
if (target === "augment" || target === "both") {
|
|
3354
|
+
paths.augment = {
|
|
3355
|
+
commands: path.join(baseDir, ".augment", "commands"),
|
|
3356
|
+
agents: path.join(baseDir, ".augment", "agents")
|
|
3357
|
+
};
|
|
3358
|
+
}
|
|
3359
|
+
if (target === "claude" || target === "both") {
|
|
3360
|
+
paths.claude = {
|
|
3361
|
+
commands: path.join(baseDir, ".claude", "commands"),
|
|
3362
|
+
agents: path.join(baseDir, ".claude", "agents")
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
3365
|
+
if (target === "opencode") {
|
|
3366
|
+
if (scope === "user") {
|
|
3367
|
+
paths.opencode = {
|
|
3368
|
+
commands: path.join(baseDir, ".config", "opencode", "commands"),
|
|
3369
|
+
agents: path.join(baseDir, ".config", "opencode", "agents")
|
|
3370
|
+
};
|
|
3371
|
+
} else {
|
|
3372
|
+
paths.opencode = {
|
|
3373
|
+
commands: path.join(baseDir, ".opencode", "commands"),
|
|
3374
|
+
agents: path.join(baseDir, ".opencode", "agents")
|
|
3375
|
+
};
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
return {
|
|
3379
|
+
targets: target === "both" ? ["augment", "claude"] : [target],
|
|
3380
|
+
scope,
|
|
3381
|
+
paths
|
|
3382
|
+
};
|
|
3383
|
+
}
|
|
3384
|
+
async function savePromptToPath(prompt, commandsDir) {
|
|
3385
|
+
const markdownContent = `---
|
|
3386
|
+
description: ${prompt.name}
|
|
3387
|
+
type: "manual"
|
|
3388
|
+
---
|
|
3389
|
+
|
|
3390
|
+
${prompt.content}`;
|
|
3391
|
+
await fs.mkdir(commandsDir, { recursive: true });
|
|
3392
|
+
const filePath = path.join(commandsDir, `${prompt.command}.md`);
|
|
3393
|
+
await fs.writeFile(filePath, markdownContent, "utf-8");
|
|
3394
|
+
}
|
|
3395
|
+
async function saveSubagentToPath(subagent, agentsDir, targetType) {
|
|
3396
|
+
let markdownContent;
|
|
3397
|
+
if (targetType === "opencode") {
|
|
3398
|
+
markdownContent = `---
|
|
3399
|
+
mode: subagent
|
|
2398
3400
|
name: "${subagent.name}"
|
|
2399
3401
|
description: "${subagent.description}"
|
|
2400
|
-
model: "${subagent.model}"
|
|
2401
|
-
color: "${subagent.color}"
|
|
2402
3402
|
---
|
|
2403
3403
|
|
|
2404
3404
|
${subagent.content}`;
|
|
2405
|
-
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
} catch (error) {
|
|
2409
|
-
augmentError = new Error(`Failed to save to .augment: ${error}`);
|
|
2410
|
-
}
|
|
2411
|
-
try {
|
|
2412
|
-
const mappedModel = mapModelName(subagent.model);
|
|
2413
|
-
const claudeMarkdownContent = `---
|
|
3405
|
+
} else {
|
|
3406
|
+
const modelToUse = targetType === "claude" ? mapModelName(subagent.model) : subagent.model;
|
|
3407
|
+
markdownContent = `---
|
|
2414
3408
|
name: "${subagent.name}"
|
|
2415
3409
|
description: "${subagent.description}"
|
|
2416
|
-
model: "${
|
|
3410
|
+
model: "${modelToUse}"
|
|
2417
3411
|
color: "${subagent.color}"
|
|
2418
3412
|
---
|
|
2419
3413
|
|
|
2420
3414
|
${subagent.content}`;
|
|
2421
|
-
await fs.mkdir(CLAUDE_AGENTS_DIR, { recursive: true });
|
|
2422
|
-
const filePath = path.join(CLAUDE_AGENTS_DIR, `${subagent.name}.md`);
|
|
2423
|
-
await fs.writeFile(filePath, claudeMarkdownContent, "utf-8");
|
|
2424
|
-
} catch (error) {
|
|
2425
|
-
claudeError = new Error(`Failed to save to .claude: ${error}`);
|
|
2426
3415
|
}
|
|
2427
|
-
|
|
2428
|
-
|
|
3416
|
+
await fs.mkdir(agentsDir, { recursive: true });
|
|
3417
|
+
const filePath = path.join(agentsDir, `${subagent.name}.md`);
|
|
3418
|
+
await fs.writeFile(filePath, markdownContent, "utf-8");
|
|
3419
|
+
}
|
|
3420
|
+
function parseTargetFlag(targetFlag) {
|
|
3421
|
+
if (targetFlag.includes(",")) {
|
|
3422
|
+
const targets = targetFlag.split(",").map((t2) => t2.trim());
|
|
3423
|
+
const validTargets = [];
|
|
3424
|
+
for (const target of targets) {
|
|
3425
|
+
if (target === "claude" || target === "augment" || target === "opencode") {
|
|
3426
|
+
validTargets.push(target);
|
|
3427
|
+
} else {
|
|
3428
|
+
throw new Error(`Invalid target: ${target}. Valid options: claude, augment, opencode`);
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
return validTargets;
|
|
3432
|
+
}
|
|
3433
|
+
if (targetFlag === "claude" || targetFlag === "augment" || targetFlag === "opencode" || targetFlag === "both") {
|
|
3434
|
+
return [targetFlag];
|
|
3435
|
+
}
|
|
3436
|
+
throw new Error(`Invalid target: ${targetFlag}. Valid options: claude, augment, opencode, both`);
|
|
3437
|
+
}
|
|
3438
|
+
function resolveMultipleTargetPaths(targets, scope) {
|
|
3439
|
+
const baseDir = scope === "user" ? os.homedir() : process.cwd();
|
|
3440
|
+
const paths = {};
|
|
3441
|
+
for (const target of targets) {
|
|
3442
|
+
if (target === "both") {
|
|
3443
|
+
paths.augment = {
|
|
3444
|
+
commands: path.join(baseDir, ".augment", "commands"),
|
|
3445
|
+
agents: path.join(baseDir, ".augment", "agents")
|
|
3446
|
+
};
|
|
3447
|
+
paths.claude = {
|
|
3448
|
+
commands: path.join(baseDir, ".claude", "commands"),
|
|
3449
|
+
agents: path.join(baseDir, ".claude", "agents")
|
|
3450
|
+
};
|
|
3451
|
+
} else if (target === "augment") {
|
|
3452
|
+
paths.augment = {
|
|
3453
|
+
commands: path.join(baseDir, ".augment", "commands"),
|
|
3454
|
+
agents: path.join(baseDir, ".augment", "agents")
|
|
3455
|
+
};
|
|
3456
|
+
} else if (target === "claude") {
|
|
3457
|
+
paths.claude = {
|
|
3458
|
+
commands: path.join(baseDir, ".claude", "commands"),
|
|
3459
|
+
agents: path.join(baseDir, ".claude", "agents")
|
|
3460
|
+
};
|
|
3461
|
+
} else if (target === "opencode") {
|
|
3462
|
+
if (scope === "user") {
|
|
3463
|
+
paths.opencode = {
|
|
3464
|
+
commands: path.join(baseDir, ".config", "opencode", "commands"),
|
|
3465
|
+
agents: path.join(baseDir, ".config", "opencode", "agents")
|
|
3466
|
+
};
|
|
3467
|
+
} else {
|
|
3468
|
+
paths.opencode = {
|
|
3469
|
+
commands: path.join(baseDir, ".opencode", "commands"),
|
|
3470
|
+
agents: path.join(baseDir, ".opencode", "agents")
|
|
3471
|
+
};
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
2429
3474
|
}
|
|
3475
|
+
return {
|
|
3476
|
+
targets,
|
|
3477
|
+
scope,
|
|
3478
|
+
paths
|
|
3479
|
+
};
|
|
2430
3480
|
}
|
|
2431
3481
|
async function promptInput(question, hidden = false) {
|
|
2432
3482
|
const rl = readline.createInterface({
|
|
@@ -2667,7 +3717,8 @@ async function handleFetch(options) {
|
|
|
2667
3717
|
if (allPrompts.length > 0) {
|
|
2668
3718
|
spinner.text = `Saving ${allPrompts.length} prompts...`;
|
|
2669
3719
|
for (const prompt of allPrompts) {
|
|
2670
|
-
await
|
|
3720
|
+
await savePromptToPath(prompt, AUGMENT_COMMANDS_DIR);
|
|
3721
|
+
await savePromptToPath(prompt, CLAUDE_COMMANDS_DIR);
|
|
2671
3722
|
}
|
|
2672
3723
|
spinner.succeed(`Successfully refreshed commands: deleted ${deletedCount}, saved ${allPrompts.length} prompts`);
|
|
2673
3724
|
} else {
|
|
@@ -2679,7 +3730,8 @@ async function handleFetch(options) {
|
|
|
2679
3730
|
if (allPrompts.length > 0) {
|
|
2680
3731
|
spinner.text = `Saving ${allPrompts.length} prompts...`;
|
|
2681
3732
|
for (const prompt of allPrompts) {
|
|
2682
|
-
await
|
|
3733
|
+
await savePromptToPath(prompt, AUGMENT_COMMANDS_DIR);
|
|
3734
|
+
await savePromptToPath(prompt, CLAUDE_COMMANDS_DIR);
|
|
2683
3735
|
}
|
|
2684
3736
|
spinner.succeed(`Successfully synced ${allPrompts.length} prompts from server`);
|
|
2685
3737
|
} else {
|
|
@@ -2762,12 +3814,22 @@ async function handleSwitchAccount() {
|
|
|
2762
3814
|
process.exit(1);
|
|
2763
3815
|
}
|
|
2764
3816
|
}
|
|
2765
|
-
async function handleKit(kitId) {
|
|
3817
|
+
async function handleKit(kitId, options = {}) {
|
|
2766
3818
|
if (!kitId) {
|
|
2767
3819
|
console.error("Error: Kit ID is required");
|
|
2768
3820
|
console.error("Usage: auggiegw kit <kit-id>");
|
|
2769
3821
|
process.exit(1);
|
|
2770
3822
|
}
|
|
3823
|
+
let installConfig;
|
|
3824
|
+
if (options.target) {
|
|
3825
|
+
const targets = parseTargetFlag(options.target);
|
|
3826
|
+
const scope = options.scope || await promptInstallScope();
|
|
3827
|
+
installConfig = resolveMultipleTargetPaths(targets, scope);
|
|
3828
|
+
} else {
|
|
3829
|
+
const target = await promptAITarget();
|
|
3830
|
+
const scope = options.scope || await promptInstallScope();
|
|
3831
|
+
installConfig = resolveInstallPaths(target, scope);
|
|
3832
|
+
}
|
|
2771
3833
|
const spinner = ora("Fetching kit...").start();
|
|
2772
3834
|
try {
|
|
2773
3835
|
const config = loadConfig();
|
|
@@ -2780,19 +3842,55 @@ async function handleKit(kitId) {
|
|
|
2780
3842
|
if (kit.prompts && kit.prompts.length > 0) {
|
|
2781
3843
|
spinner.text = `Saving ${kit.prompts.length} prompts...`;
|
|
2782
3844
|
for (const prompt of kit.prompts) {
|
|
2783
|
-
|
|
3845
|
+
if (installConfig.paths.augment) {
|
|
3846
|
+
await savePromptToPath(prompt, installConfig.paths.augment.commands);
|
|
3847
|
+
}
|
|
3848
|
+
if (installConfig.paths.claude) {
|
|
3849
|
+
await savePromptToPath(prompt, installConfig.paths.claude.commands);
|
|
3850
|
+
}
|
|
3851
|
+
if (installConfig.paths.opencode) {
|
|
3852
|
+
await savePromptToPath(prompt, installConfig.paths.opencode.commands);
|
|
3853
|
+
}
|
|
2784
3854
|
promptsCount++;
|
|
2785
3855
|
}
|
|
2786
3856
|
}
|
|
2787
3857
|
if (kit.subagents && kit.subagents.length > 0) {
|
|
2788
3858
|
spinner.text = `Saving ${kit.subagents.length} subagents...`;
|
|
2789
3859
|
for (const subagent of kit.subagents) {
|
|
2790
|
-
|
|
3860
|
+
if (installConfig.paths.augment) {
|
|
3861
|
+
await saveSubagentToPath(subagent, installConfig.paths.augment.agents, "augment");
|
|
3862
|
+
}
|
|
3863
|
+
if (installConfig.paths.claude) {
|
|
3864
|
+
await saveSubagentToPath(subagent, installConfig.paths.claude.agents, "claude");
|
|
3865
|
+
}
|
|
3866
|
+
if (installConfig.paths.opencode) {
|
|
3867
|
+
await saveSubagentToPath(subagent, installConfig.paths.opencode.agents, "opencode");
|
|
3868
|
+
}
|
|
2791
3869
|
subagentsCount++;
|
|
2792
3870
|
}
|
|
2793
3871
|
}
|
|
2794
|
-
|
|
2795
|
-
|
|
3872
|
+
let successMessage = `Successfully installed kit "${kit.name}": ${promptsCount} prompts, ${subagentsCount} subagents
|
|
3873
|
+
|
|
3874
|
+
Installed to:`;
|
|
3875
|
+
if (installConfig.paths.augment) {
|
|
3876
|
+
successMessage += `
|
|
3877
|
+
• ${installConfig.paths.augment.commands} (${promptsCount} prompts)`;
|
|
3878
|
+
successMessage += `
|
|
3879
|
+
• ${installConfig.paths.augment.agents} (${subagentsCount} subagents)`;
|
|
3880
|
+
}
|
|
3881
|
+
if (installConfig.paths.claude) {
|
|
3882
|
+
successMessage += `
|
|
3883
|
+
• ${installConfig.paths.claude.commands} (${promptsCount} prompts)`;
|
|
3884
|
+
successMessage += `
|
|
3885
|
+
• ${installConfig.paths.claude.agents} (${subagentsCount} subagents)`;
|
|
3886
|
+
}
|
|
3887
|
+
if (installConfig.paths.opencode) {
|
|
3888
|
+
successMessage += `
|
|
3889
|
+
• ${installConfig.paths.opencode.commands} (${promptsCount} prompts)`;
|
|
3890
|
+
successMessage += `
|
|
3891
|
+
• ${installConfig.paths.opencode.agents} (${subagentsCount} subagents)`;
|
|
3892
|
+
}
|
|
3893
|
+
spinner.succeed(successMessage);
|
|
2796
3894
|
} catch (error) {
|
|
2797
3895
|
spinner.fail(`Kit fetch failed: ${error}`);
|
|
2798
3896
|
process.exit(1);
|
|
@@ -2818,7 +3916,9 @@ program2.command("exec <command> [args...]").description("Execute any custom com
|
|
|
2818
3916
|
handleExec(command, args, sessionOptions);
|
|
2819
3917
|
});
|
|
2820
3918
|
program2.command("switch-account").description("Switch to a newer account from the purchased account list").action(handleSwitchAccount);
|
|
2821
|
-
program2.command("kit <kit-id>").description("Fetch and install a kit (prompts and subagents) from the public API").action(
|
|
3919
|
+
program2.command("kit <kit-id>").description("Fetch and install a kit (prompts and subagents) from the public API").option("--target <type>", "Target AI tool: claude, augment, opencode, both, or comma-separated (e.g., claude,opencode)").option("--scope <type>", "Installation scope: user or project").action((kitId, options) => {
|
|
3920
|
+
handleKit(kitId, options);
|
|
3921
|
+
});
|
|
2822
3922
|
program2.parse();
|
|
2823
3923
|
|
|
2824
|
-
//# debugId=
|
|
3924
|
+
//# debugId=ECAEF2044F788D9764756E2164756E21
|