haac-aikit 0.1.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/LICENSE +21 -0
- package/README.md +119 -0
- package/catalog/agents/backend.md +49 -0
- package/catalog/agents/devops.md +74 -0
- package/catalog/agents/frontend.md +49 -0
- package/catalog/agents/implementer.md +55 -0
- package/catalog/agents/mobile.md +48 -0
- package/catalog/agents/orchestrator.md +53 -0
- package/catalog/agents/planner.md +59 -0
- package/catalog/agents/researcher.md +62 -0
- package/catalog/agents/reviewer.md +70 -0
- package/catalog/agents/security-auditor.md +73 -0
- package/catalog/agents/tester.md +63 -0
- package/catalog/ci/agents-md-sync.yml +42 -0
- package/catalog/ci/ci.yml +24 -0
- package/catalog/ci/claude.yml +20 -0
- package/catalog/ci/secret-scan.yml +20 -0
- package/catalog/commands/commit-push-pr.md +21 -0
- package/catalog/commands/commit.md +17 -0
- package/catalog/commands/debug.md +17 -0
- package/catalog/commands/execute.md +13 -0
- package/catalog/commands/explore.md +26 -0
- package/catalog/commands/plan.md +19 -0
- package/catalog/commands/review.md +17 -0
- package/catalog/commands/security-review.md +33 -0
- package/catalog/commands/ship.md +21 -0
- package/catalog/commands/tdd.md +21 -0
- package/catalog/devcontainer/devcontainer.json +24 -0
- package/catalog/hooks/block-dangerous-bash.sh +30 -0
- package/catalog/hooks/block-force-push-main.sh +22 -0
- package/catalog/hooks/block-secrets-in-commits.sh +37 -0
- package/catalog/hooks/compaction-preservation.sh +29 -0
- package/catalog/hooks/file-guard.sh +30 -0
- package/catalog/hooks/format-on-save.sh +43 -0
- package/catalog/hooks/hooks.json +70 -0
- package/catalog/hooks/session-start-prime.sh +31 -0
- package/catalog/husky/commit-msg +4 -0
- package/catalog/husky/commitlint.config.js +8 -0
- package/catalog/husky/gitleaks.toml +10 -0
- package/catalog/husky/lintstagedrc.json +5 -0
- package/catalog/husky/pre-commit +4 -0
- package/catalog/husky/pre-push +18 -0
- package/catalog/mcp/mcp.json +19 -0
- package/catalog/plugin/plugin.json +10 -0
- package/catalog/rules/AGENTS.md.tmpl +46 -0
- package/catalog/rules/CLAUDE.md.shim +5 -0
- package/catalog/rules/GEMINI.md.shim +5 -0
- package/catalog/rules/aider-conventions.md +5 -0
- package/catalog/rules/aider.conf.yml +5 -0
- package/catalog/rules/copilot-instructions.md +6 -0
- package/catalog/rules/cursor-base.mdc +13 -0
- package/catalog/rules/windsurf-rules.md +7 -0
- package/catalog/settings/env.example +7 -0
- package/catalog/settings/settings.json +45 -0
- package/catalog/skills/tier1/brainstorming.md +39 -0
- package/catalog/skills/tier1/codebase-exploration.md +55 -0
- package/catalog/skills/tier1/executing-plans.md +34 -0
- package/catalog/skills/tier1/requesting-code-review.md +37 -0
- package/catalog/skills/tier1/systematic-debugging.md +50 -0
- package/catalog/skills/tier1/test-driven-development.md +44 -0
- package/catalog/skills/tier1/using-git-worktrees.md +43 -0
- package/catalog/skills/tier1/verification-before-completion.md +46 -0
- package/catalog/skills/tier1/writing-commits.md +52 -0
- package/catalog/skills/tier1/writing-plans.md +42 -0
- package/catalog/skills/tier2/claude-md-improver.md +42 -0
- package/catalog/skills/tier2/dependency-hygiene.md +52 -0
- package/catalog/skills/tier2/dispatching-parallel-agents.md +43 -0
- package/catalog/skills/tier2/finishing-a-development-branch.md +48 -0
- package/catalog/skills/tier2/receiving-code-review.md +49 -0
- package/catalog/skills/tier2/refactoring-simplify.md +40 -0
- package/catalog/skills/tier2/security-review.md +48 -0
- package/catalog/skills/tier2/writing-pull-requests.md +47 -0
- package/dist/cli.mjs +2161 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +64 -0
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,2161 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res) => function __init() {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
};
|
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
|
+
};
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
// node_modules/sisteransi/src/index.js
|
|
36
|
+
var require_src = __commonJS({
|
|
37
|
+
"node_modules/sisteransi/src/index.js"(exports, module) {
|
|
38
|
+
"use strict";
|
|
39
|
+
var ESC = "\x1B";
|
|
40
|
+
var CSI = `${ESC}[`;
|
|
41
|
+
var beep = "\x07";
|
|
42
|
+
var cursor = {
|
|
43
|
+
to(x2, y3) {
|
|
44
|
+
if (!y3) return `${CSI}${x2 + 1}G`;
|
|
45
|
+
return `${CSI}${y3 + 1};${x2 + 1}H`;
|
|
46
|
+
},
|
|
47
|
+
move(x2, y3) {
|
|
48
|
+
let ret = "";
|
|
49
|
+
if (x2 < 0) ret += `${CSI}${-x2}D`;
|
|
50
|
+
else if (x2 > 0) ret += `${CSI}${x2}C`;
|
|
51
|
+
if (y3 < 0) ret += `${CSI}${-y3}A`;
|
|
52
|
+
else if (y3 > 0) ret += `${CSI}${y3}B`;
|
|
53
|
+
return ret;
|
|
54
|
+
},
|
|
55
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
56
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
57
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
58
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
59
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
60
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
61
|
+
left: `${CSI}G`,
|
|
62
|
+
hide: `${CSI}?25l`,
|
|
63
|
+
show: `${CSI}?25h`,
|
|
64
|
+
save: `${ESC}7`,
|
|
65
|
+
restore: `${ESC}8`
|
|
66
|
+
};
|
|
67
|
+
var scroll = {
|
|
68
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
69
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
70
|
+
};
|
|
71
|
+
var erase = {
|
|
72
|
+
screen: `${CSI}2J`,
|
|
73
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
74
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
75
|
+
line: `${CSI}2K`,
|
|
76
|
+
lineEnd: `${CSI}K`,
|
|
77
|
+
lineStart: `${CSI}1K`,
|
|
78
|
+
lines(count) {
|
|
79
|
+
let clear = "";
|
|
80
|
+
for (let i = 0; i < count; i++)
|
|
81
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
82
|
+
if (count)
|
|
83
|
+
clear += cursor.left;
|
|
84
|
+
return clear;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// node_modules/picocolors/picocolors.js
|
|
92
|
+
var require_picocolors = __commonJS({
|
|
93
|
+
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
94
|
+
"use strict";
|
|
95
|
+
var p2 = process || {};
|
|
96
|
+
var argv = p2.argv || [];
|
|
97
|
+
var env = p2.env || {};
|
|
98
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p2.platform === "win32" || (p2.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
99
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
100
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
101
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
102
|
+
};
|
|
103
|
+
var replaceClose = (string, close, replace, index) => {
|
|
104
|
+
let result = "", cursor = 0;
|
|
105
|
+
do {
|
|
106
|
+
result += string.substring(cursor, index) + replace;
|
|
107
|
+
cursor = index + close.length;
|
|
108
|
+
index = string.indexOf(close, cursor);
|
|
109
|
+
} while (~index);
|
|
110
|
+
return result + string.substring(cursor);
|
|
111
|
+
};
|
|
112
|
+
var createColors = (enabled = isColorSupported) => {
|
|
113
|
+
let f2 = enabled ? formatter : () => String;
|
|
114
|
+
return {
|
|
115
|
+
isColorSupported: enabled,
|
|
116
|
+
reset: f2("\x1B[0m", "\x1B[0m"),
|
|
117
|
+
bold: f2("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
118
|
+
dim: f2("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
119
|
+
italic: f2("\x1B[3m", "\x1B[23m"),
|
|
120
|
+
underline: f2("\x1B[4m", "\x1B[24m"),
|
|
121
|
+
inverse: f2("\x1B[7m", "\x1B[27m"),
|
|
122
|
+
hidden: f2("\x1B[8m", "\x1B[28m"),
|
|
123
|
+
strikethrough: f2("\x1B[9m", "\x1B[29m"),
|
|
124
|
+
black: f2("\x1B[30m", "\x1B[39m"),
|
|
125
|
+
red: f2("\x1B[31m", "\x1B[39m"),
|
|
126
|
+
green: f2("\x1B[32m", "\x1B[39m"),
|
|
127
|
+
yellow: f2("\x1B[33m", "\x1B[39m"),
|
|
128
|
+
blue: f2("\x1B[34m", "\x1B[39m"),
|
|
129
|
+
magenta: f2("\x1B[35m", "\x1B[39m"),
|
|
130
|
+
cyan: f2("\x1B[36m", "\x1B[39m"),
|
|
131
|
+
white: f2("\x1B[37m", "\x1B[39m"),
|
|
132
|
+
gray: f2("\x1B[90m", "\x1B[39m"),
|
|
133
|
+
bgBlack: f2("\x1B[40m", "\x1B[49m"),
|
|
134
|
+
bgRed: f2("\x1B[41m", "\x1B[49m"),
|
|
135
|
+
bgGreen: f2("\x1B[42m", "\x1B[49m"),
|
|
136
|
+
bgYellow: f2("\x1B[43m", "\x1B[49m"),
|
|
137
|
+
bgBlue: f2("\x1B[44m", "\x1B[49m"),
|
|
138
|
+
bgMagenta: f2("\x1B[45m", "\x1B[49m"),
|
|
139
|
+
bgCyan: f2("\x1B[46m", "\x1B[49m"),
|
|
140
|
+
bgWhite: f2("\x1B[47m", "\x1B[49m"),
|
|
141
|
+
blackBright: f2("\x1B[90m", "\x1B[39m"),
|
|
142
|
+
redBright: f2("\x1B[91m", "\x1B[39m"),
|
|
143
|
+
greenBright: f2("\x1B[92m", "\x1B[39m"),
|
|
144
|
+
yellowBright: f2("\x1B[93m", "\x1B[39m"),
|
|
145
|
+
blueBright: f2("\x1B[94m", "\x1B[39m"),
|
|
146
|
+
magentaBright: f2("\x1B[95m", "\x1B[39m"),
|
|
147
|
+
cyanBright: f2("\x1B[96m", "\x1B[39m"),
|
|
148
|
+
whiteBright: f2("\x1B[97m", "\x1B[39m"),
|
|
149
|
+
bgBlackBright: f2("\x1B[100m", "\x1B[49m"),
|
|
150
|
+
bgRedBright: f2("\x1B[101m", "\x1B[49m"),
|
|
151
|
+
bgGreenBright: f2("\x1B[102m", "\x1B[49m"),
|
|
152
|
+
bgYellowBright: f2("\x1B[103m", "\x1B[49m"),
|
|
153
|
+
bgBlueBright: f2("\x1B[104m", "\x1B[49m"),
|
|
154
|
+
bgMagentaBright: f2("\x1B[105m", "\x1B[49m"),
|
|
155
|
+
bgCyanBright: f2("\x1B[106m", "\x1B[49m"),
|
|
156
|
+
bgWhiteBright: f2("\x1B[107m", "\x1B[49m")
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
module.exports = createColors();
|
|
160
|
+
module.exports.createColors = createColors;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
165
|
+
import { stdin as $, stdout as j } from "process";
|
|
166
|
+
import * as f from "readline";
|
|
167
|
+
import M from "readline";
|
|
168
|
+
import { WriteStream as U } from "tty";
|
|
169
|
+
function J({ onlyFirst: t = false } = {}) {
|
|
170
|
+
const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
171
|
+
return new RegExp(F, t ? void 0 : "g");
|
|
172
|
+
}
|
|
173
|
+
function T(t) {
|
|
174
|
+
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
175
|
+
return t.replace(Q, "");
|
|
176
|
+
}
|
|
177
|
+
function O(t) {
|
|
178
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
179
|
+
}
|
|
180
|
+
function A(t, u2 = {}) {
|
|
181
|
+
if (typeof t != "string" || t.length === 0 || (u2 = { ambiguousIsNarrow: true, ...u2 }, t = T(t), t.length === 0)) return 0;
|
|
182
|
+
t = t.replace(FD(), " ");
|
|
183
|
+
const F = u2.ambiguousIsNarrow ? 1 : 2;
|
|
184
|
+
let e2 = 0;
|
|
185
|
+
for (const s of t) {
|
|
186
|
+
const i = s.codePointAt(0);
|
|
187
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
|
|
188
|
+
switch (DD.eastAsianWidth(s)) {
|
|
189
|
+
case "F":
|
|
190
|
+
case "W":
|
|
191
|
+
e2 += 2;
|
|
192
|
+
break;
|
|
193
|
+
case "A":
|
|
194
|
+
e2 += F;
|
|
195
|
+
break;
|
|
196
|
+
default:
|
|
197
|
+
e2 += 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return e2;
|
|
201
|
+
}
|
|
202
|
+
function sD() {
|
|
203
|
+
const t = /* @__PURE__ */ new Map();
|
|
204
|
+
for (const [u2, F] of Object.entries(r)) {
|
|
205
|
+
for (const [e2, s] of Object.entries(F)) r[e2] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, F[e2] = r[e2], t.set(s[0], s[1]);
|
|
206
|
+
Object.defineProperty(r, u2, { value: F, enumerable: false });
|
|
207
|
+
}
|
|
208
|
+
return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, { rgbToAnsi256: { value: (u2, F, e2) => u2 === F && F === e2 ? u2 < 8 ? 16 : u2 > 248 ? 231 : Math.round((u2 - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u2 / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e2 / 255 * 5), enumerable: false }, hexToRgb: { value: (u2) => {
|
|
209
|
+
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u2.toString(16));
|
|
210
|
+
if (!F) return [0, 0, 0];
|
|
211
|
+
let [e2] = F;
|
|
212
|
+
e2.length === 3 && (e2 = [...e2].map((i) => i + i).join(""));
|
|
213
|
+
const s = Number.parseInt(e2, 16);
|
|
214
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
215
|
+
}, enumerable: false }, hexToAnsi256: { value: (u2) => r.rgbToAnsi256(...r.hexToRgb(u2)), enumerable: false }, ansi256ToAnsi: { value: (u2) => {
|
|
216
|
+
if (u2 < 8) return 30 + u2;
|
|
217
|
+
if (u2 < 16) return 90 + (u2 - 8);
|
|
218
|
+
let F, e2, s;
|
|
219
|
+
if (u2 >= 232) F = ((u2 - 232) * 10 + 8) / 255, e2 = F, s = F;
|
|
220
|
+
else {
|
|
221
|
+
u2 -= 16;
|
|
222
|
+
const C = u2 % 36;
|
|
223
|
+
F = Math.floor(u2 / 36) / 5, e2 = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
224
|
+
}
|
|
225
|
+
const i = Math.max(F, e2, s) * 2;
|
|
226
|
+
if (i === 0) return 30;
|
|
227
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(e2) << 1 | Math.round(F));
|
|
228
|
+
return i === 2 && (D += 60), D;
|
|
229
|
+
}, enumerable: false }, rgbToAnsi: { value: (u2, F, e2) => r.ansi256ToAnsi(r.rgbToAnsi256(u2, F, e2)), enumerable: false }, hexToAnsi: { value: (u2) => r.ansi256ToAnsi(r.hexToAnsi256(u2)), enumerable: false } }), r;
|
|
230
|
+
}
|
|
231
|
+
function G(t, u2, F) {
|
|
232
|
+
return String(t).normalize().replace(/\r\n/g, `
|
|
233
|
+
`).split(`
|
|
234
|
+
`).map((e2) => oD(e2, u2, F)).join(`
|
|
235
|
+
`);
|
|
236
|
+
}
|
|
237
|
+
function k(t, u2) {
|
|
238
|
+
if (typeof t == "string") return c.aliases.get(t) === u2;
|
|
239
|
+
for (const F of t) if (F !== void 0 && k(F, u2)) return true;
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
function lD(t, u2) {
|
|
243
|
+
if (t === u2) return;
|
|
244
|
+
const F = t.split(`
|
|
245
|
+
`), e2 = u2.split(`
|
|
246
|
+
`), s = [];
|
|
247
|
+
for (let i = 0; i < Math.max(F.length, e2.length); i++) F[i] !== e2[i] && s.push(i);
|
|
248
|
+
return s;
|
|
249
|
+
}
|
|
250
|
+
function BD(t) {
|
|
251
|
+
return t === S;
|
|
252
|
+
}
|
|
253
|
+
function d(t, u2) {
|
|
254
|
+
const F = t;
|
|
255
|
+
F.isTTY && F.setRawMode(u2);
|
|
256
|
+
}
|
|
257
|
+
var import_sisteransi, import_picocolors, Q, P, X, DD, uD, FD, m, L, N, I, r, tD, eD, iD, v, CD, w, W, rD, R, y, V, z, ED, _, nD, oD, aD, c, xD, S, AD, pD, h, x, fD, bD, mD, Y, wD, SD, $D, q, jD, PD;
|
|
258
|
+
var init_dist = __esm({
|
|
259
|
+
"node_modules/@clack/core/dist/index.mjs"() {
|
|
260
|
+
"use strict";
|
|
261
|
+
import_sisteransi = __toESM(require_src(), 1);
|
|
262
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
263
|
+
Q = J();
|
|
264
|
+
P = { exports: {} };
|
|
265
|
+
(function(t) {
|
|
266
|
+
var u2 = {};
|
|
267
|
+
t.exports = u2, u2.eastAsianWidth = function(e2) {
|
|
268
|
+
var s = e2.charCodeAt(0), i = e2.length == 2 ? e2.charCodeAt(1) : 0, D = s;
|
|
269
|
+
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
270
|
+
}, u2.characterLength = function(e2) {
|
|
271
|
+
var s = this.eastAsianWidth(e2);
|
|
272
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
273
|
+
};
|
|
274
|
+
function F(e2) {
|
|
275
|
+
return e2.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
276
|
+
}
|
|
277
|
+
u2.length = function(e2) {
|
|
278
|
+
for (var s = F(e2), i = 0, D = 0; D < s.length; D++) i = i + this.characterLength(s[D]);
|
|
279
|
+
return i;
|
|
280
|
+
}, u2.slice = function(e2, s, i) {
|
|
281
|
+
textLen = u2.length(e2), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
282
|
+
for (var D = "", C = 0, o = F(e2), E2 = 0; E2 < o.length; E2++) {
|
|
283
|
+
var a2 = o[E2], n = u2.length(a2);
|
|
284
|
+
if (C >= s - (n == 2 ? 1 : 0)) if (C + n <= i) D += a2;
|
|
285
|
+
else break;
|
|
286
|
+
C += n;
|
|
287
|
+
}
|
|
288
|
+
return D;
|
|
289
|
+
};
|
|
290
|
+
})(P);
|
|
291
|
+
X = P.exports;
|
|
292
|
+
DD = O(X);
|
|
293
|
+
uD = function() {
|
|
294
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
295
|
+
};
|
|
296
|
+
FD = O(uD);
|
|
297
|
+
m = 10;
|
|
298
|
+
L = (t = 0) => (u2) => `\x1B[${u2 + t}m`;
|
|
299
|
+
N = (t = 0) => (u2) => `\x1B[${38 + t};5;${u2}m`;
|
|
300
|
+
I = (t = 0) => (u2, F, e2) => `\x1B[${38 + t};2;${u2};${F};${e2}m`;
|
|
301
|
+
r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
302
|
+
Object.keys(r.modifier);
|
|
303
|
+
tD = Object.keys(r.color);
|
|
304
|
+
eD = Object.keys(r.bgColor);
|
|
305
|
+
[...tD, ...eD];
|
|
306
|
+
iD = sD();
|
|
307
|
+
v = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
308
|
+
CD = 39;
|
|
309
|
+
w = "\x07";
|
|
310
|
+
W = "[";
|
|
311
|
+
rD = "]";
|
|
312
|
+
R = "m";
|
|
313
|
+
y = `${rD}8;;`;
|
|
314
|
+
V = (t) => `${v.values().next().value}${W}${t}${R}`;
|
|
315
|
+
z = (t) => `${v.values().next().value}${y}${t}${w}`;
|
|
316
|
+
ED = (t) => t.split(" ").map((u2) => A(u2));
|
|
317
|
+
_ = (t, u2, F) => {
|
|
318
|
+
const e2 = [...u2];
|
|
319
|
+
let s = false, i = false, D = A(T(t[t.length - 1]));
|
|
320
|
+
for (const [C, o] of e2.entries()) {
|
|
321
|
+
const E2 = A(o);
|
|
322
|
+
if (D + E2 <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e2.slice(C + 1).join("").startsWith(y)), s) {
|
|
323
|
+
i ? o === w && (s = false, i = false) : o === R && (s = false);
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
D += E2, D === F && C < e2.length - 1 && (t.push(""), D = 0);
|
|
327
|
+
}
|
|
328
|
+
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
329
|
+
};
|
|
330
|
+
nD = (t) => {
|
|
331
|
+
const u2 = t.split(" ");
|
|
332
|
+
let F = u2.length;
|
|
333
|
+
for (; F > 0 && !(A(u2[F - 1]) > 0); ) F--;
|
|
334
|
+
return F === u2.length ? t : u2.slice(0, F).join(" ") + u2.slice(F).join("");
|
|
335
|
+
};
|
|
336
|
+
oD = (t, u2, F = {}) => {
|
|
337
|
+
if (F.trim !== false && t.trim() === "") return "";
|
|
338
|
+
let e2 = "", s, i;
|
|
339
|
+
const D = ED(t);
|
|
340
|
+
let C = [""];
|
|
341
|
+
for (const [E2, a2] of t.split(" ").entries()) {
|
|
342
|
+
F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
343
|
+
let n = A(C[C.length - 1]);
|
|
344
|
+
if (E2 !== 0 && (n >= u2 && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E2] > u2) {
|
|
345
|
+
const B2 = u2 - n, p2 = 1 + Math.floor((D[E2] - B2 - 1) / u2);
|
|
346
|
+
Math.floor((D[E2] - 1) / u2) < p2 && C.push(""), _(C, a2, u2);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
if (n + D[E2] > u2 && n > 0 && D[E2] > 0) {
|
|
350
|
+
if (F.wordWrap === false && n < u2) {
|
|
351
|
+
_(C, a2, u2);
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
C.push("");
|
|
355
|
+
}
|
|
356
|
+
if (n + D[E2] > u2 && F.wordWrap === false) {
|
|
357
|
+
_(C, a2, u2);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
C[C.length - 1] += a2;
|
|
361
|
+
}
|
|
362
|
+
F.trim !== false && (C = C.map((E2) => nD(E2)));
|
|
363
|
+
const o = [...C.join(`
|
|
364
|
+
`)];
|
|
365
|
+
for (const [E2, a2] of o.entries()) {
|
|
366
|
+
if (e2 += a2, v.has(a2)) {
|
|
367
|
+
const { groups: B2 } = new RegExp(`(?:\\${W}(?<code>\\d+)m|\\${y}(?<uri>.*)${w})`).exec(o.slice(E2).join("")) || { groups: {} };
|
|
368
|
+
if (B2.code !== void 0) {
|
|
369
|
+
const p2 = Number.parseFloat(B2.code);
|
|
370
|
+
s = p2 === CD ? void 0 : p2;
|
|
371
|
+
} else B2.uri !== void 0 && (i = B2.uri.length === 0 ? void 0 : B2.uri);
|
|
372
|
+
}
|
|
373
|
+
const n = iD.codes.get(Number(s));
|
|
374
|
+
o[E2 + 1] === `
|
|
375
|
+
` ? (i && (e2 += z("")), s && n && (e2 += V(n))) : a2 === `
|
|
376
|
+
` && (s && n && (e2 += V(s)), i && (e2 += z(i)));
|
|
377
|
+
}
|
|
378
|
+
return e2;
|
|
379
|
+
};
|
|
380
|
+
aD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
381
|
+
c = { actions: new Set(aD), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]) };
|
|
382
|
+
xD = globalThis.process.platform.startsWith("win");
|
|
383
|
+
S = /* @__PURE__ */ Symbol("clack:cancel");
|
|
384
|
+
AD = Object.defineProperty;
|
|
385
|
+
pD = (t, u2, F) => u2 in t ? AD(t, u2, { enumerable: true, configurable: true, writable: true, value: F }) : t[u2] = F;
|
|
386
|
+
h = (t, u2, F) => (pD(t, typeof u2 != "symbol" ? u2 + "" : u2, F), F);
|
|
387
|
+
x = class {
|
|
388
|
+
constructor(u2, F = true) {
|
|
389
|
+
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
390
|
+
const { input: e2 = $, output: s = j, render: i, signal: D, ...C } = u2;
|
|
391
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e2, this.output = s;
|
|
392
|
+
}
|
|
393
|
+
unsubscribe() {
|
|
394
|
+
this._subscribers.clear();
|
|
395
|
+
}
|
|
396
|
+
setSubscriber(u2, F) {
|
|
397
|
+
const e2 = this._subscribers.get(u2) ?? [];
|
|
398
|
+
e2.push(F), this._subscribers.set(u2, e2);
|
|
399
|
+
}
|
|
400
|
+
on(u2, F) {
|
|
401
|
+
this.setSubscriber(u2, { cb: F });
|
|
402
|
+
}
|
|
403
|
+
once(u2, F) {
|
|
404
|
+
this.setSubscriber(u2, { cb: F, once: true });
|
|
405
|
+
}
|
|
406
|
+
emit(u2, ...F) {
|
|
407
|
+
const e2 = this._subscribers.get(u2) ?? [], s = [];
|
|
408
|
+
for (const i of e2) i.cb(...F), i.once && s.push(() => e2.splice(e2.indexOf(i), 1));
|
|
409
|
+
for (const i of s) i();
|
|
410
|
+
}
|
|
411
|
+
prompt() {
|
|
412
|
+
return new Promise((u2, F) => {
|
|
413
|
+
if (this._abortSignal) {
|
|
414
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u2(S);
|
|
415
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
416
|
+
this.state = "cancel", this.close();
|
|
417
|
+
}, { once: true });
|
|
418
|
+
}
|
|
419
|
+
const e2 = new U(0);
|
|
420
|
+
e2._write = (s, i, D) => {
|
|
421
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
422
|
+
}, this.input.pipe(e2), this.rl = M.createInterface({ input: this.input, output: e2, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), M.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
423
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), d(this.input, false), u2(this.value);
|
|
424
|
+
}), this.once("cancel", () => {
|
|
425
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), d(this.input, false), u2(S);
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
onKeypress(u2, F) {
|
|
430
|
+
if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u2 && (u2.toLowerCase() === "y" || u2.toLowerCase() === "n") && this.emit("confirm", u2.toLowerCase() === "y"), u2 === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u2 && this.emit("key", u2.toLowerCase()), F?.name === "return") {
|
|
431
|
+
if (this.opts.validate) {
|
|
432
|
+
const e2 = this.opts.validate(this.value);
|
|
433
|
+
e2 && (this.error = e2 instanceof Error ? e2.message : e2, this.state = "error", this.rl?.write(this.value));
|
|
434
|
+
}
|
|
435
|
+
this.state !== "error" && (this.state = "submit");
|
|
436
|
+
}
|
|
437
|
+
k([u2, F?.name, F?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
438
|
+
}
|
|
439
|
+
close() {
|
|
440
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
441
|
+
`), d(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
442
|
+
}
|
|
443
|
+
restoreCursor() {
|
|
444
|
+
const u2 = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
445
|
+
`).length - 1;
|
|
446
|
+
this.output.write(import_sisteransi.cursor.move(-999, u2 * -1));
|
|
447
|
+
}
|
|
448
|
+
render() {
|
|
449
|
+
const u2 = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
450
|
+
if (u2 !== this._prevFrame) {
|
|
451
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
452
|
+
else {
|
|
453
|
+
const F = lD(this._prevFrame, u2);
|
|
454
|
+
if (this.restoreCursor(), F && F?.length === 1) {
|
|
455
|
+
const e2 = F[0];
|
|
456
|
+
this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.lines(1));
|
|
457
|
+
const s = u2.split(`
|
|
458
|
+
`);
|
|
459
|
+
this.output.write(s[e2]), this._prevFrame = u2, this.output.write(import_sisteransi.cursor.move(0, s.length - e2 - 1));
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (F && F?.length > 1) {
|
|
463
|
+
const e2 = F[0];
|
|
464
|
+
this.output.write(import_sisteransi.cursor.move(0, e2)), this.output.write(import_sisteransi.erase.down());
|
|
465
|
+
const s = u2.split(`
|
|
466
|
+
`).slice(e2);
|
|
467
|
+
this.output.write(s.join(`
|
|
468
|
+
`)), this._prevFrame = u2;
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
this.output.write(import_sisteransi.erase.down());
|
|
472
|
+
}
|
|
473
|
+
this.output.write(u2), this.state === "initial" && (this.state = "active"), this._prevFrame = u2;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
fD = class extends x {
|
|
478
|
+
get cursor() {
|
|
479
|
+
return this.value ? 0 : 1;
|
|
480
|
+
}
|
|
481
|
+
get _value() {
|
|
482
|
+
return this.cursor === 0;
|
|
483
|
+
}
|
|
484
|
+
constructor(u2) {
|
|
485
|
+
super(u2, false), this.value = !!u2.initialValue, this.on("value", () => {
|
|
486
|
+
this.value = this._value;
|
|
487
|
+
}), this.on("confirm", (F) => {
|
|
488
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
489
|
+
}), this.on("cursor", () => {
|
|
490
|
+
this.value = !this.value;
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
bD = Object.defineProperty;
|
|
495
|
+
mD = (t, u2, F) => u2 in t ? bD(t, u2, { enumerable: true, configurable: true, writable: true, value: F }) : t[u2] = F;
|
|
496
|
+
Y = (t, u2, F) => (mD(t, typeof u2 != "symbol" ? u2 + "" : u2, F), F);
|
|
497
|
+
wD = class extends x {
|
|
498
|
+
constructor(u2) {
|
|
499
|
+
super(u2, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u2.options, this.value = [...u2.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u2.cursorAt), 0), this.on("key", (F) => {
|
|
500
|
+
F === "a" && this.toggleAll();
|
|
501
|
+
}), this.on("cursor", (F) => {
|
|
502
|
+
switch (F) {
|
|
503
|
+
case "left":
|
|
504
|
+
case "up":
|
|
505
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
506
|
+
break;
|
|
507
|
+
case "down":
|
|
508
|
+
case "right":
|
|
509
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
510
|
+
break;
|
|
511
|
+
case "space":
|
|
512
|
+
this.toggleValue();
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
get _value() {
|
|
518
|
+
return this.options[this.cursor].value;
|
|
519
|
+
}
|
|
520
|
+
toggleAll() {
|
|
521
|
+
const u2 = this.value.length === this.options.length;
|
|
522
|
+
this.value = u2 ? [] : this.options.map((F) => F.value);
|
|
523
|
+
}
|
|
524
|
+
toggleValue() {
|
|
525
|
+
const u2 = this.value.includes(this._value);
|
|
526
|
+
this.value = u2 ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
SD = Object.defineProperty;
|
|
530
|
+
$D = (t, u2, F) => u2 in t ? SD(t, u2, { enumerable: true, configurable: true, writable: true, value: F }) : t[u2] = F;
|
|
531
|
+
q = (t, u2, F) => ($D(t, typeof u2 != "symbol" ? u2 + "" : u2, F), F);
|
|
532
|
+
jD = class extends x {
|
|
533
|
+
constructor(u2) {
|
|
534
|
+
super(u2, false), q(this, "options"), q(this, "cursor", 0), this.options = u2.options, this.cursor = this.options.findIndex(({ value: F }) => F === u2.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
|
|
535
|
+
switch (F) {
|
|
536
|
+
case "left":
|
|
537
|
+
case "up":
|
|
538
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
539
|
+
break;
|
|
540
|
+
case "down":
|
|
541
|
+
case "right":
|
|
542
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
this.changeValue();
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
get _value() {
|
|
549
|
+
return this.options[this.cursor];
|
|
550
|
+
}
|
|
551
|
+
changeValue() {
|
|
552
|
+
this.value = this._value.value;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
PD = class extends x {
|
|
556
|
+
get valueWithCursor() {
|
|
557
|
+
if (this.state === "submit") return this.value;
|
|
558
|
+
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
559
|
+
const u2 = this.value.slice(0, this.cursor), [F, ...e2] = this.value.slice(this.cursor);
|
|
560
|
+
return `${u2}${import_picocolors.default.inverse(F)}${e2.join("")}`;
|
|
561
|
+
}
|
|
562
|
+
get cursor() {
|
|
563
|
+
return this._cursor;
|
|
564
|
+
}
|
|
565
|
+
constructor(u2) {
|
|
566
|
+
super(u2), this.on("finalize", () => {
|
|
567
|
+
this.value || (this.value = u2.defaultValue);
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
575
|
+
import { stripVTControlCharacters as T2 } from "util";
|
|
576
|
+
import p from "process";
|
|
577
|
+
function X2() {
|
|
578
|
+
return p.platform !== "win32" ? p.env.TERM !== "linux" : !!p.env.CI || !!p.env.WT_SESSION || !!p.env.TERMINUS_SUBLIME || p.env.ConEmuTask === "{cmd::Cmder}" || p.env.TERM_PROGRAM === "Terminus-Sublime" || p.env.TERM_PROGRAM === "vscode" || p.env.TERM === "xterm-256color" || p.env.TERM === "alacritty" || p.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
579
|
+
}
|
|
580
|
+
var import_picocolors2, import_sisteransi2, E, u, ee, A2, B, S2, te, a, m2, j2, R2, V2, M2, G2, se, N2, re, ie, ne, ae, oe, ce, le, y2, k2, ue, me, de, pe, ye, ve, we, fe, v2, be;
|
|
581
|
+
var init_dist2 = __esm({
|
|
582
|
+
"node_modules/@clack/prompts/dist/index.mjs"() {
|
|
583
|
+
"use strict";
|
|
584
|
+
init_dist();
|
|
585
|
+
init_dist();
|
|
586
|
+
import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
587
|
+
import_sisteransi2 = __toESM(require_src(), 1);
|
|
588
|
+
E = X2();
|
|
589
|
+
u = (s, n) => E ? s : n;
|
|
590
|
+
ee = u("\u25C6", "*");
|
|
591
|
+
A2 = u("\u25A0", "x");
|
|
592
|
+
B = u("\u25B2", "x");
|
|
593
|
+
S2 = u("\u25C7", "o");
|
|
594
|
+
te = u("\u250C", "T");
|
|
595
|
+
a = u("\u2502", "|");
|
|
596
|
+
m2 = u("\u2514", "\u2014");
|
|
597
|
+
j2 = u("\u25CF", ">");
|
|
598
|
+
R2 = u("\u25CB", " ");
|
|
599
|
+
V2 = u("\u25FB", "[\u2022]");
|
|
600
|
+
M2 = u("\u25FC", "[+]");
|
|
601
|
+
G2 = u("\u25FB", "[ ]");
|
|
602
|
+
se = u("\u25AA", "\u2022");
|
|
603
|
+
N2 = u("\u2500", "-");
|
|
604
|
+
re = u("\u256E", "+");
|
|
605
|
+
ie = u("\u251C", "+");
|
|
606
|
+
ne = u("\u256F", "+");
|
|
607
|
+
ae = u("\u25CF", "\u2022");
|
|
608
|
+
oe = u("\u25C6", "*");
|
|
609
|
+
ce = u("\u25B2", "!");
|
|
610
|
+
le = u("\u25A0", "x");
|
|
611
|
+
y2 = (s) => {
|
|
612
|
+
switch (s) {
|
|
613
|
+
case "initial":
|
|
614
|
+
case "active":
|
|
615
|
+
return import_picocolors2.default.cyan(ee);
|
|
616
|
+
case "cancel":
|
|
617
|
+
return import_picocolors2.default.red(A2);
|
|
618
|
+
case "error":
|
|
619
|
+
return import_picocolors2.default.yellow(B);
|
|
620
|
+
case "submit":
|
|
621
|
+
return import_picocolors2.default.green(S2);
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
k2 = (s) => {
|
|
625
|
+
const { cursor: n, options: t, style: i } = s, r2 = s.maxItems ?? Number.POSITIVE_INFINITY, c2 = Math.max(process.stdout.rows - 4, 0), o = Math.min(c2, Math.max(r2, 5));
|
|
626
|
+
let l2 = 0;
|
|
627
|
+
n >= l2 + o - 3 ? l2 = Math.max(Math.min(n - o + 3, t.length - o), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
628
|
+
const $3 = o < t.length && l2 > 0, d2 = o < t.length && l2 + o < t.length;
|
|
629
|
+
return t.slice(l2, l2 + o).map((w2, b2, C) => {
|
|
630
|
+
const I2 = b2 === 0 && $3, x2 = b2 === C.length - 1 && d2;
|
|
631
|
+
return I2 || x2 ? import_picocolors2.default.dim("...") : i(w2, b2 + l2 === n);
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
ue = (s) => new PD({ validate: s.validate, placeholder: s.placeholder, defaultValue: s.defaultValue, initialValue: s.initialValue, render() {
|
|
635
|
+
const n = `${import_picocolors2.default.gray(a)}
|
|
636
|
+
${y2(this.state)} ${s.message}
|
|
637
|
+
`, t = s.placeholder ? import_picocolors2.default.inverse(s.placeholder[0]) + import_picocolors2.default.dim(s.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : t;
|
|
638
|
+
switch (this.state) {
|
|
639
|
+
case "error":
|
|
640
|
+
return `${n.trim()}
|
|
641
|
+
${import_picocolors2.default.yellow(a)} ${i}
|
|
642
|
+
${import_picocolors2.default.yellow(m2)} ${import_picocolors2.default.yellow(this.error)}
|
|
643
|
+
`;
|
|
644
|
+
case "submit":
|
|
645
|
+
return `${n}${import_picocolors2.default.gray(a)} ${import_picocolors2.default.dim(this.value || s.placeholder)}`;
|
|
646
|
+
case "cancel":
|
|
647
|
+
return `${n}${import_picocolors2.default.gray(a)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
648
|
+
${import_picocolors2.default.gray(a)}` : ""}`;
|
|
649
|
+
default:
|
|
650
|
+
return `${n}${import_picocolors2.default.cyan(a)} ${i}
|
|
651
|
+
${import_picocolors2.default.cyan(m2)}
|
|
652
|
+
`;
|
|
653
|
+
}
|
|
654
|
+
} }).prompt();
|
|
655
|
+
me = (s) => {
|
|
656
|
+
const n = s.active ?? "Yes", t = s.inactive ?? "No";
|
|
657
|
+
return new fD({ active: n, inactive: t, initialValue: s.initialValue ?? true, render() {
|
|
658
|
+
const i = `${import_picocolors2.default.gray(a)}
|
|
659
|
+
${y2(this.state)} ${s.message}
|
|
660
|
+
`, r2 = this.value ? n : t;
|
|
661
|
+
switch (this.state) {
|
|
662
|
+
case "submit":
|
|
663
|
+
return `${i}${import_picocolors2.default.gray(a)} ${import_picocolors2.default.dim(r2)}`;
|
|
664
|
+
case "cancel":
|
|
665
|
+
return `${i}${import_picocolors2.default.gray(a)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(r2))}
|
|
666
|
+
${import_picocolors2.default.gray(a)}`;
|
|
667
|
+
default:
|
|
668
|
+
return `${i}${import_picocolors2.default.cyan(a)} ${this.value ? `${import_picocolors2.default.green(j2)} ${n}` : `${import_picocolors2.default.dim(R2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(R2)} ${import_picocolors2.default.dim(t)}` : `${import_picocolors2.default.green(j2)} ${t}`}
|
|
669
|
+
${import_picocolors2.default.cyan(m2)}
|
|
670
|
+
`;
|
|
671
|
+
}
|
|
672
|
+
} }).prompt();
|
|
673
|
+
};
|
|
674
|
+
de = (s) => {
|
|
675
|
+
const n = (t, i) => {
|
|
676
|
+
const r2 = t.label ?? String(t.value);
|
|
677
|
+
switch (i) {
|
|
678
|
+
case "selected":
|
|
679
|
+
return `${import_picocolors2.default.dim(r2)}`;
|
|
680
|
+
case "active":
|
|
681
|
+
return `${import_picocolors2.default.green(j2)} ${r2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}`;
|
|
682
|
+
case "cancelled":
|
|
683
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(r2))}`;
|
|
684
|
+
default:
|
|
685
|
+
return `${import_picocolors2.default.dim(R2)} ${import_picocolors2.default.dim(r2)}`;
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
return new jD({ options: s.options, initialValue: s.initialValue, render() {
|
|
689
|
+
const t = `${import_picocolors2.default.gray(a)}
|
|
690
|
+
${y2(this.state)} ${s.message}
|
|
691
|
+
`;
|
|
692
|
+
switch (this.state) {
|
|
693
|
+
case "submit":
|
|
694
|
+
return `${t}${import_picocolors2.default.gray(a)} ${n(this.options[this.cursor], "selected")}`;
|
|
695
|
+
case "cancel":
|
|
696
|
+
return `${t}${import_picocolors2.default.gray(a)} ${n(this.options[this.cursor], "cancelled")}
|
|
697
|
+
${import_picocolors2.default.gray(a)}`;
|
|
698
|
+
default:
|
|
699
|
+
return `${t}${import_picocolors2.default.cyan(a)} ${k2({ cursor: this.cursor, options: this.options, maxItems: s.maxItems, style: (i, r2) => n(i, r2 ? "active" : "inactive") }).join(`
|
|
700
|
+
${import_picocolors2.default.cyan(a)} `)}
|
|
701
|
+
${import_picocolors2.default.cyan(m2)}
|
|
702
|
+
`;
|
|
703
|
+
}
|
|
704
|
+
} }).prompt();
|
|
705
|
+
};
|
|
706
|
+
pe = (s) => {
|
|
707
|
+
const n = (t, i) => {
|
|
708
|
+
const r2 = t.label ?? String(t.value);
|
|
709
|
+
return i === "active" ? `${import_picocolors2.default.cyan(V2)} ${r2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(M2)} ${import_picocolors2.default.dim(r2)}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(r2))}` : i === "active-selected" ? `${import_picocolors2.default.green(M2)} ${r2} ${t.hint ? import_picocolors2.default.dim(`(${t.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.dim(G2)} ${import_picocolors2.default.dim(r2)}`;
|
|
710
|
+
};
|
|
711
|
+
return new wD({ options: s.options, initialValues: s.initialValues, required: s.required ?? true, cursorAt: s.cursorAt, validate(t) {
|
|
712
|
+
if (this.required && t.length === 0) return `Please select at least one option.
|
|
713
|
+
${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
|
|
714
|
+
}, render() {
|
|
715
|
+
const t = `${import_picocolors2.default.gray(a)}
|
|
716
|
+
${y2(this.state)} ${s.message}
|
|
717
|
+
`, i = (r2, c2) => {
|
|
718
|
+
const o = this.value.includes(r2.value);
|
|
719
|
+
return c2 && o ? n(r2, "active-selected") : o ? n(r2, "selected") : n(r2, c2 ? "active" : "inactive");
|
|
720
|
+
};
|
|
721
|
+
switch (this.state) {
|
|
722
|
+
case "submit":
|
|
723
|
+
return `${t}${import_picocolors2.default.gray(a)} ${this.options.filter(({ value: r2 }) => this.value.includes(r2)).map((r2) => n(r2, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
724
|
+
case "cancel": {
|
|
725
|
+
const r2 = this.options.filter(({ value: c2 }) => this.value.includes(c2)).map((c2) => n(c2, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
726
|
+
return `${t}${import_picocolors2.default.gray(a)} ${r2.trim() ? `${r2}
|
|
727
|
+
${import_picocolors2.default.gray(a)}` : ""}`;
|
|
728
|
+
}
|
|
729
|
+
case "error": {
|
|
730
|
+
const r2 = this.error.split(`
|
|
731
|
+
`).map((c2, o) => o === 0 ? `${import_picocolors2.default.yellow(m2)} ${import_picocolors2.default.yellow(c2)}` : ` ${c2}`).join(`
|
|
732
|
+
`);
|
|
733
|
+
return `${t + import_picocolors2.default.yellow(a)} ${k2({ options: this.options, cursor: this.cursor, maxItems: s.maxItems, style: i }).join(`
|
|
734
|
+
${import_picocolors2.default.yellow(a)} `)}
|
|
735
|
+
${r2}
|
|
736
|
+
`;
|
|
737
|
+
}
|
|
738
|
+
default:
|
|
739
|
+
return `${t}${import_picocolors2.default.cyan(a)} ${k2({ options: this.options, cursor: this.cursor, maxItems: s.maxItems, style: i }).join(`
|
|
740
|
+
${import_picocolors2.default.cyan(a)} `)}
|
|
741
|
+
${import_picocolors2.default.cyan(m2)}
|
|
742
|
+
`;
|
|
743
|
+
}
|
|
744
|
+
} }).prompt();
|
|
745
|
+
};
|
|
746
|
+
ye = (s = "", n = "") => {
|
|
747
|
+
const t = `
|
|
748
|
+
${s}
|
|
749
|
+
`.split(`
|
|
750
|
+
`), i = T2(n).length, r2 = Math.max(t.reduce((o, l2) => {
|
|
751
|
+
const $3 = T2(l2);
|
|
752
|
+
return $3.length > o ? $3.length : o;
|
|
753
|
+
}, 0), i) + 2, c2 = t.map((o) => `${import_picocolors2.default.gray(a)} ${import_picocolors2.default.dim(o)}${" ".repeat(r2 - T2(o).length)}${import_picocolors2.default.gray(a)}`).join(`
|
|
754
|
+
`);
|
|
755
|
+
process.stdout.write(`${import_picocolors2.default.gray(a)}
|
|
756
|
+
${import_picocolors2.default.green(S2)} ${import_picocolors2.default.reset(n)} ${import_picocolors2.default.gray(N2.repeat(Math.max(r2 - i - 1, 1)) + re)}
|
|
757
|
+
${c2}
|
|
758
|
+
${import_picocolors2.default.gray(ie + N2.repeat(r2 + 2) + ne)}
|
|
759
|
+
`);
|
|
760
|
+
};
|
|
761
|
+
ve = (s = "") => {
|
|
762
|
+
process.stdout.write(`${import_picocolors2.default.gray(m2)} ${import_picocolors2.default.red(s)}
|
|
763
|
+
|
|
764
|
+
`);
|
|
765
|
+
};
|
|
766
|
+
we = (s = "") => {
|
|
767
|
+
process.stdout.write(`${import_picocolors2.default.gray(te)} ${s}
|
|
768
|
+
`);
|
|
769
|
+
};
|
|
770
|
+
fe = (s = "") => {
|
|
771
|
+
process.stdout.write(`${import_picocolors2.default.gray(a)}
|
|
772
|
+
${import_picocolors2.default.gray(m2)} ${s}
|
|
773
|
+
|
|
774
|
+
`);
|
|
775
|
+
};
|
|
776
|
+
v2 = { message: (s = "", { symbol: n = import_picocolors2.default.gray(a) } = {}) => {
|
|
777
|
+
const t = [`${import_picocolors2.default.gray(a)}`];
|
|
778
|
+
if (s) {
|
|
779
|
+
const [i, ...r2] = s.split(`
|
|
780
|
+
`);
|
|
781
|
+
t.push(`${n} ${i}`, ...r2.map((c2) => `${import_picocolors2.default.gray(a)} ${c2}`));
|
|
782
|
+
}
|
|
783
|
+
process.stdout.write(`${t.join(`
|
|
784
|
+
`)}
|
|
785
|
+
`);
|
|
786
|
+
}, info: (s) => {
|
|
787
|
+
v2.message(s, { symbol: import_picocolors2.default.blue(ae) });
|
|
788
|
+
}, success: (s) => {
|
|
789
|
+
v2.message(s, { symbol: import_picocolors2.default.green(oe) });
|
|
790
|
+
}, step: (s) => {
|
|
791
|
+
v2.message(s, { symbol: import_picocolors2.default.green(S2) });
|
|
792
|
+
}, warn: (s) => {
|
|
793
|
+
v2.message(s, { symbol: import_picocolors2.default.yellow(ce) });
|
|
794
|
+
}, warning: (s) => {
|
|
795
|
+
v2.warn(s);
|
|
796
|
+
}, error: (s) => {
|
|
797
|
+
v2.message(s, { symbol: import_picocolors2.default.red(le) });
|
|
798
|
+
} };
|
|
799
|
+
be = async (s, n) => {
|
|
800
|
+
const t = {}, i = Object.keys(s);
|
|
801
|
+
for (const r2 of i) {
|
|
802
|
+
const c2 = s[r2], o = await c2({ results: t })?.catch((l2) => {
|
|
803
|
+
throw l2;
|
|
804
|
+
});
|
|
805
|
+
if (typeof n?.onCancel == "function" && BD(o)) {
|
|
806
|
+
t[r2] = "canceled", n.onCancel({ results: t });
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
t[r2] = o;
|
|
810
|
+
}
|
|
811
|
+
return t;
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
// src/detect/gitState.ts
|
|
817
|
+
import { execFileSync } from "child_process";
|
|
818
|
+
function isGitRepo() {
|
|
819
|
+
try {
|
|
820
|
+
execFileSync("git", ["rev-parse", "--git-dir"], { stdio: "ignore" });
|
|
821
|
+
return true;
|
|
822
|
+
} catch {
|
|
823
|
+
return false;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function isDirtyTree() {
|
|
827
|
+
try {
|
|
828
|
+
const output = execFileSync("git", ["status", "--porcelain"], {
|
|
829
|
+
encoding: "utf8",
|
|
830
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
831
|
+
});
|
|
832
|
+
return output.trim().length > 0;
|
|
833
|
+
} catch {
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
var init_gitState = __esm({
|
|
838
|
+
"src/detect/gitState.ts"() {
|
|
839
|
+
"use strict";
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
// src/fs/readConfig.ts
|
|
844
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
845
|
+
function readConfig(configPath = ".aikitrc.json") {
|
|
846
|
+
if (!existsSync(configPath)) return null;
|
|
847
|
+
let raw;
|
|
848
|
+
try {
|
|
849
|
+
raw = JSON.parse(readFileSync(configPath, "utf8"));
|
|
850
|
+
} catch {
|
|
851
|
+
throw new Error(`Failed to parse ${configPath}: invalid JSON`);
|
|
852
|
+
}
|
|
853
|
+
if (typeof raw !== "object" || raw === null) {
|
|
854
|
+
throw new Error(`${configPath} must be a JSON object`);
|
|
855
|
+
}
|
|
856
|
+
const cfg = raw;
|
|
857
|
+
if (cfg.version !== 1) {
|
|
858
|
+
throw new Error(`${configPath}: unsupported version ${cfg.version}`);
|
|
859
|
+
}
|
|
860
|
+
return cfg;
|
|
861
|
+
}
|
|
862
|
+
function writeConfig(config, configPath = ".aikitrc.json", dryRun = false) {
|
|
863
|
+
const content = JSON.stringify({ $schema: "https://haac-aikit.dev/schema.json", ...config }, null, 2) + "\n";
|
|
864
|
+
if (!dryRun) writeFileSync(configPath, content, "utf8");
|
|
865
|
+
}
|
|
866
|
+
var init_readConfig = __esm({
|
|
867
|
+
"src/fs/readConfig.ts"() {
|
|
868
|
+
"use strict";
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
// node_modules/kleur/index.mjs
|
|
873
|
+
function run(arr, str) {
|
|
874
|
+
let i = 0, tmp, beg = "", end = "";
|
|
875
|
+
for (; i < arr.length; i++) {
|
|
876
|
+
tmp = arr[i];
|
|
877
|
+
beg += tmp.open;
|
|
878
|
+
end += tmp.close;
|
|
879
|
+
if (!!~str.indexOf(tmp.close)) {
|
|
880
|
+
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
return beg + str + end;
|
|
884
|
+
}
|
|
885
|
+
function chain(has, keys) {
|
|
886
|
+
let ctx = { has, keys };
|
|
887
|
+
ctx.reset = $2.reset.bind(ctx);
|
|
888
|
+
ctx.bold = $2.bold.bind(ctx);
|
|
889
|
+
ctx.dim = $2.dim.bind(ctx);
|
|
890
|
+
ctx.italic = $2.italic.bind(ctx);
|
|
891
|
+
ctx.underline = $2.underline.bind(ctx);
|
|
892
|
+
ctx.inverse = $2.inverse.bind(ctx);
|
|
893
|
+
ctx.hidden = $2.hidden.bind(ctx);
|
|
894
|
+
ctx.strikethrough = $2.strikethrough.bind(ctx);
|
|
895
|
+
ctx.black = $2.black.bind(ctx);
|
|
896
|
+
ctx.red = $2.red.bind(ctx);
|
|
897
|
+
ctx.green = $2.green.bind(ctx);
|
|
898
|
+
ctx.yellow = $2.yellow.bind(ctx);
|
|
899
|
+
ctx.blue = $2.blue.bind(ctx);
|
|
900
|
+
ctx.magenta = $2.magenta.bind(ctx);
|
|
901
|
+
ctx.cyan = $2.cyan.bind(ctx);
|
|
902
|
+
ctx.white = $2.white.bind(ctx);
|
|
903
|
+
ctx.gray = $2.gray.bind(ctx);
|
|
904
|
+
ctx.grey = $2.grey.bind(ctx);
|
|
905
|
+
ctx.bgBlack = $2.bgBlack.bind(ctx);
|
|
906
|
+
ctx.bgRed = $2.bgRed.bind(ctx);
|
|
907
|
+
ctx.bgGreen = $2.bgGreen.bind(ctx);
|
|
908
|
+
ctx.bgYellow = $2.bgYellow.bind(ctx);
|
|
909
|
+
ctx.bgBlue = $2.bgBlue.bind(ctx);
|
|
910
|
+
ctx.bgMagenta = $2.bgMagenta.bind(ctx);
|
|
911
|
+
ctx.bgCyan = $2.bgCyan.bind(ctx);
|
|
912
|
+
ctx.bgWhite = $2.bgWhite.bind(ctx);
|
|
913
|
+
return ctx;
|
|
914
|
+
}
|
|
915
|
+
function init(open, close) {
|
|
916
|
+
let blk = {
|
|
917
|
+
open: `\x1B[${open}m`,
|
|
918
|
+
close: `\x1B[${close}m`,
|
|
919
|
+
rgx: new RegExp(`\\x1b\\[${close}m`, "g")
|
|
920
|
+
};
|
|
921
|
+
return function(txt) {
|
|
922
|
+
if (this !== void 0 && this.has !== void 0) {
|
|
923
|
+
!!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
|
|
924
|
+
return txt === void 0 ? this : $2.enabled ? run(this.keys, txt + "") : txt + "";
|
|
925
|
+
}
|
|
926
|
+
return txt === void 0 ? chain([open], [blk]) : $2.enabled ? run([blk], txt + "") : txt + "";
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
var FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY2, $2, kleur_default;
|
|
930
|
+
var init_kleur = __esm({
|
|
931
|
+
"node_modules/kleur/index.mjs"() {
|
|
932
|
+
"use strict";
|
|
933
|
+
isTTY2 = true;
|
|
934
|
+
if (typeof process !== "undefined") {
|
|
935
|
+
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
936
|
+
isTTY2 = process.stdout && process.stdout.isTTY;
|
|
937
|
+
}
|
|
938
|
+
$2 = {
|
|
939
|
+
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY2),
|
|
940
|
+
// modifiers
|
|
941
|
+
reset: init(0, 0),
|
|
942
|
+
bold: init(1, 22),
|
|
943
|
+
dim: init(2, 22),
|
|
944
|
+
italic: init(3, 23),
|
|
945
|
+
underline: init(4, 24),
|
|
946
|
+
inverse: init(7, 27),
|
|
947
|
+
hidden: init(8, 28),
|
|
948
|
+
strikethrough: init(9, 29),
|
|
949
|
+
// colors
|
|
950
|
+
black: init(30, 39),
|
|
951
|
+
red: init(31, 39),
|
|
952
|
+
green: init(32, 39),
|
|
953
|
+
yellow: init(33, 39),
|
|
954
|
+
blue: init(34, 39),
|
|
955
|
+
magenta: init(35, 39),
|
|
956
|
+
cyan: init(36, 39),
|
|
957
|
+
white: init(37, 39),
|
|
958
|
+
gray: init(90, 39),
|
|
959
|
+
grey: init(90, 39),
|
|
960
|
+
// background colors
|
|
961
|
+
bgBlack: init(40, 49),
|
|
962
|
+
bgRed: init(41, 49),
|
|
963
|
+
bgGreen: init(42, 49),
|
|
964
|
+
bgYellow: init(43, 49),
|
|
965
|
+
bgBlue: init(44, 49),
|
|
966
|
+
bgMagenta: init(45, 49),
|
|
967
|
+
bgCyan: init(46, 49),
|
|
968
|
+
bgWhite: init(47, 49)
|
|
969
|
+
};
|
|
970
|
+
kleur_default = $2;
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
// src/wizard.ts
|
|
975
|
+
async function runWizard(projectName) {
|
|
976
|
+
we(kleur_default.bgCyan().black(" haac-aikit ") + " The batteries-included AI-agentic-coding kit");
|
|
977
|
+
const answers = await be(
|
|
978
|
+
{
|
|
979
|
+
projectName: () => ue({
|
|
980
|
+
message: "Project name",
|
|
981
|
+
defaultValue: projectName,
|
|
982
|
+
placeholder: projectName
|
|
983
|
+
}),
|
|
984
|
+
projectDescription: () => ue({
|
|
985
|
+
message: "Project description",
|
|
986
|
+
placeholder: "One sentence (optional)"
|
|
987
|
+
}),
|
|
988
|
+
tools: () => pe({
|
|
989
|
+
message: "Which AI coding tools do you use?",
|
|
990
|
+
options: ALL_TOOLS,
|
|
991
|
+
initialValues: ALL_TOOLS.map((t) => t.value),
|
|
992
|
+
required: true
|
|
993
|
+
}),
|
|
994
|
+
scope: () => de({
|
|
995
|
+
message: "Installation scope",
|
|
996
|
+
options: [
|
|
997
|
+
{
|
|
998
|
+
value: "minimal",
|
|
999
|
+
label: "Minimal",
|
|
1000
|
+
hint: "AGENTS.md + rule shims + .mcp.json"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
value: "standard",
|
|
1004
|
+
label: "Standard (recommended)",
|
|
1005
|
+
hint: "+ skills, commands, agents, hooks, CI"
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
value: "everything",
|
|
1009
|
+
label: "Everything",
|
|
1010
|
+
hint: "+ devcontainer, plugin, OTel, sync workflow"
|
|
1011
|
+
}
|
|
1012
|
+
],
|
|
1013
|
+
initialValue: "standard"
|
|
1014
|
+
}),
|
|
1015
|
+
integrations: ({ results }) => {
|
|
1016
|
+
if (results.scope !== "everything") return Promise.resolve(void 0);
|
|
1017
|
+
return pe({
|
|
1018
|
+
message: "Optional integrations",
|
|
1019
|
+
options: ALL_INTEGRATIONS,
|
|
1020
|
+
initialValues: ALL_INTEGRATIONS.map((i) => i.value),
|
|
1021
|
+
required: false
|
|
1022
|
+
});
|
|
1023
|
+
},
|
|
1024
|
+
shape: ({ results }) => {
|
|
1025
|
+
if (results.scope === "minimal") return Promise.resolve(void 0);
|
|
1026
|
+
return pe({
|
|
1027
|
+
message: "Project shape (adds domain-specialist agents)",
|
|
1028
|
+
options: ALL_SHAPES,
|
|
1029
|
+
initialValues: ["web"],
|
|
1030
|
+
required: false
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
onCancel: () => {
|
|
1036
|
+
ve("Setup cancelled.");
|
|
1037
|
+
process.exit(0);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
return {
|
|
1042
|
+
projectName: answers.projectName || projectName,
|
|
1043
|
+
projectDescription: answers.projectDescription || "",
|
|
1044
|
+
tools: answers.tools ?? ALL_TOOLS.map((t) => t.value),
|
|
1045
|
+
scope: answers.scope ?? "standard",
|
|
1046
|
+
integrations: answers.integrations ?? [],
|
|
1047
|
+
shape: answers.shape ?? []
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
var ALL_TOOLS, ALL_SHAPES, ALL_INTEGRATIONS;
|
|
1051
|
+
var init_wizard = __esm({
|
|
1052
|
+
"src/wizard.ts"() {
|
|
1053
|
+
"use strict";
|
|
1054
|
+
init_dist2();
|
|
1055
|
+
init_kleur();
|
|
1056
|
+
ALL_TOOLS = [
|
|
1057
|
+
{ value: "claude", label: "Claude Code", hint: "CLAUDE.md + .claude/" },
|
|
1058
|
+
{ value: "cursor", label: "Cursor", hint: ".cursor/rules/" },
|
|
1059
|
+
{ value: "copilot", label: "GitHub Copilot", hint: ".github/copilot-instructions.md" },
|
|
1060
|
+
{ value: "windsurf", label: "Windsurf", hint: ".windsurf/rules/" },
|
|
1061
|
+
{ value: "aider", label: "Aider", hint: "CONVENTIONS.md + .aider.conf.yml" },
|
|
1062
|
+
{ value: "gemini", label: "Gemini CLI", hint: "GEMINI.md shim" },
|
|
1063
|
+
{ value: "codex", label: "OpenAI Codex CLI", hint: "AGENTS.md (already canonical)" }
|
|
1064
|
+
];
|
|
1065
|
+
ALL_SHAPES = [
|
|
1066
|
+
{ value: "web", label: "Web frontend" },
|
|
1067
|
+
{ value: "fullstack", label: "Full-stack" },
|
|
1068
|
+
{ value: "backend", label: "Backend / API" },
|
|
1069
|
+
{ value: "mobile", label: "Mobile" },
|
|
1070
|
+
{ value: "library", label: "Library / package" }
|
|
1071
|
+
];
|
|
1072
|
+
ALL_INTEGRATIONS = [
|
|
1073
|
+
{ value: "mcp", label: "MCP stub (.mcp.json)" },
|
|
1074
|
+
{ value: "hooks", label: "Claude Code hooks" },
|
|
1075
|
+
{ value: "commands", label: "Slash commands" },
|
|
1076
|
+
{ value: "subagents", label: "Subagents catalog" },
|
|
1077
|
+
{ value: "ci", label: "CI workflows (.github/workflows/)" },
|
|
1078
|
+
{ value: "husky", label: "Husky pre-commit hooks" },
|
|
1079
|
+
{ value: "devcontainer", label: "Dev container (.devcontainer/)" },
|
|
1080
|
+
{ value: "plugin", label: "Claude Code plugin wrapper" },
|
|
1081
|
+
{ value: "otel", label: "OTel telemetry exporter" }
|
|
1082
|
+
];
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
// src/render/markers.ts
|
|
1087
|
+
function detectDialect(filePath) {
|
|
1088
|
+
if (filePath.endsWith(".json")) return "json";
|
|
1089
|
+
if (filePath.endsWith(".yaml") || filePath.endsWith(".yml") || filePath.endsWith(".sh") || filePath.endsWith(".conf") || filePath.endsWith(".toml"))
|
|
1090
|
+
return "yaml";
|
|
1091
|
+
return "markdown";
|
|
1092
|
+
}
|
|
1093
|
+
function makeBegin(dialect) {
|
|
1094
|
+
switch (dialect) {
|
|
1095
|
+
case "json":
|
|
1096
|
+
return `"// BEGIN:${MARKER}": ""`;
|
|
1097
|
+
case "yaml":
|
|
1098
|
+
return `# BEGIN:${MARKER}`;
|
|
1099
|
+
case "markdown":
|
|
1100
|
+
return `<!-- BEGIN:${MARKER} -->`;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
function makeEnd(dialect) {
|
|
1104
|
+
switch (dialect) {
|
|
1105
|
+
case "json":
|
|
1106
|
+
return `"// END:${MARKER}": ""`;
|
|
1107
|
+
case "yaml":
|
|
1108
|
+
return `# END:${MARKER}`;
|
|
1109
|
+
case "markdown":
|
|
1110
|
+
return `<!-- END:${MARKER} -->`;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
function upsertMarkerRegion(existing, newContent, filePath) {
|
|
1114
|
+
const dialect = detectDialect(filePath);
|
|
1115
|
+
const begin = makeBegin(dialect);
|
|
1116
|
+
const end = makeEnd(dialect);
|
|
1117
|
+
const beginIdx = existing.indexOf(begin);
|
|
1118
|
+
const endIdx = existing.indexOf(end);
|
|
1119
|
+
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
1120
|
+
const before = existing.slice(0, beginIdx + begin.length);
|
|
1121
|
+
const after = existing.slice(endIdx);
|
|
1122
|
+
const replaced2 = `${before}
|
|
1123
|
+
${newContent}
|
|
1124
|
+
${after}`;
|
|
1125
|
+
return { hasMarkers: true, replaced: replaced2 };
|
|
1126
|
+
}
|
|
1127
|
+
const separator = existing.length > 0 && !existing.endsWith("\n") ? "\n\n" : "\n";
|
|
1128
|
+
const replaced = `${existing}${separator}${begin}
|
|
1129
|
+
${newContent}
|
|
1130
|
+
${end}
|
|
1131
|
+
`;
|
|
1132
|
+
return { hasMarkers: false, replaced };
|
|
1133
|
+
}
|
|
1134
|
+
var MARKER;
|
|
1135
|
+
var init_markers = __esm({
|
|
1136
|
+
"src/render/markers.ts"() {
|
|
1137
|
+
"use strict";
|
|
1138
|
+
MARKER = "haac-aikit";
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
|
|
1142
|
+
// src/fs/safeWrite.ts
|
|
1143
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1144
|
+
import { dirname } from "path";
|
|
1145
|
+
function safeWrite(filePath, content, opts = {}) {
|
|
1146
|
+
const { dryRun = false, force = false, useMarkers = true, managedContent } = opts;
|
|
1147
|
+
const existed = existsSync2(filePath);
|
|
1148
|
+
if (existed) {
|
|
1149
|
+
if (useMarkers && managedContent !== void 0) {
|
|
1150
|
+
const existing = readFileSync2(filePath, "utf8");
|
|
1151
|
+
const { replaced } = upsertMarkerRegion(existing, managedContent, filePath);
|
|
1152
|
+
if (!dryRun) writeFileSync2(filePath, replaced, "utf8");
|
|
1153
|
+
return { path: filePath, action: "updated" };
|
|
1154
|
+
}
|
|
1155
|
+
if (!force) {
|
|
1156
|
+
return { path: filePath, action: "conflict" };
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
if (!dryRun) {
|
|
1160
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
1161
|
+
writeFileSync2(filePath, content, "utf8");
|
|
1162
|
+
}
|
|
1163
|
+
return { path: filePath, action: existed ? "updated" : "created" };
|
|
1164
|
+
}
|
|
1165
|
+
var init_safeWrite = __esm({
|
|
1166
|
+
"src/fs/safeWrite.ts"() {
|
|
1167
|
+
"use strict";
|
|
1168
|
+
init_markers();
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
// src/fs/gitignore.ts
|
|
1173
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
1174
|
+
function ensureGitignoreEntries(dryRun = false) {
|
|
1175
|
+
const path = ".gitignore";
|
|
1176
|
+
const existing = existsSync3(path) ? readFileSync3(path, "utf8") : "";
|
|
1177
|
+
const lines = existing.split("\n");
|
|
1178
|
+
const toAdd = ENTRIES.filter((e2) => !lines.some((l2) => l2.trim() === e2));
|
|
1179
|
+
if (toAdd.length === 0) return;
|
|
1180
|
+
const appended = (existing.endsWith("\n") || existing === "" ? existing : existing + "\n") + toAdd.join("\n") + "\n";
|
|
1181
|
+
if (!dryRun) writeFileSync3(path, appended, "utf8");
|
|
1182
|
+
}
|
|
1183
|
+
var ENTRIES;
|
|
1184
|
+
var init_gitignore = __esm({
|
|
1185
|
+
"src/fs/gitignore.ts"() {
|
|
1186
|
+
"use strict";
|
|
1187
|
+
ENTRIES = [
|
|
1188
|
+
".claude/settings.local.json",
|
|
1189
|
+
".claude/backups/",
|
|
1190
|
+
".env.local",
|
|
1191
|
+
".env*.local"
|
|
1192
|
+
];
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
// src/render/template.ts
|
|
1197
|
+
function interpolate(template, vars) {
|
|
1198
|
+
return template.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
|
1199
|
+
if (!(key in vars)) {
|
|
1200
|
+
throw new Error(`Template variable not found: {{${key}}}`);
|
|
1201
|
+
}
|
|
1202
|
+
return vars[key] ?? "";
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
var init_template = __esm({
|
|
1206
|
+
"src/render/template.ts"() {
|
|
1207
|
+
"use strict";
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
// src/catalog/index.ts
|
|
1212
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
1213
|
+
import { fileURLToPath } from "url";
|
|
1214
|
+
import { dirname as dirname2, join } from "path";
|
|
1215
|
+
function read(rel) {
|
|
1216
|
+
return readFileSync4(join(ROOT, rel), "utf8");
|
|
1217
|
+
}
|
|
1218
|
+
function loadCatalog() {
|
|
1219
|
+
return {
|
|
1220
|
+
agentsMd: (vars) => interpolate(read("rules/AGENTS.md.tmpl"), vars),
|
|
1221
|
+
claudeMd: () => read("rules/CLAUDE.md.shim"),
|
|
1222
|
+
copilotInstructions: () => read("rules/copilot-instructions.md"),
|
|
1223
|
+
cursorBase: () => read("rules/cursor-base.mdc"),
|
|
1224
|
+
windsurfRules: () => read("rules/windsurf-rules.md"),
|
|
1225
|
+
aiderConventions: () => read("rules/aider-conventions.md"),
|
|
1226
|
+
aiderConf: () => read("rules/aider.conf.yml"),
|
|
1227
|
+
geminiMd: () => read("rules/GEMINI.md.shim"),
|
|
1228
|
+
mcpJson: () => read("mcp/mcp.json"),
|
|
1229
|
+
settingsJson: () => read("settings/settings.json")
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
var ROOT;
|
|
1233
|
+
var init_catalog = __esm({
|
|
1234
|
+
"src/catalog/index.ts"() {
|
|
1235
|
+
"use strict";
|
|
1236
|
+
init_template();
|
|
1237
|
+
ROOT = join(dirname2(fileURLToPath(import.meta.url)), "..", "catalog");
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
// src/commands/sync.ts
|
|
1242
|
+
var sync_exports = {};
|
|
1243
|
+
__export(sync_exports, {
|
|
1244
|
+
runSync: () => runSync
|
|
1245
|
+
});
|
|
1246
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, copyFileSync, readdirSync, readFileSync as readFileSync5 } from "fs";
|
|
1247
|
+
import { join as join2, dirname as dirname3 } from "path";
|
|
1248
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1249
|
+
async function runSync(argv) {
|
|
1250
|
+
const dryRun = argv["dry-run"];
|
|
1251
|
+
const force = argv.force;
|
|
1252
|
+
const config = readConfig(argv.config);
|
|
1253
|
+
if (!config) {
|
|
1254
|
+
v2.error(".aikitrc.json not found. Run `aikit` first to initialise.");
|
|
1255
|
+
process.exit(1);
|
|
1256
|
+
}
|
|
1257
|
+
v2.info(`Syncing from .aikitrc.json (scope: ${config.scope})`);
|
|
1258
|
+
const catalog = loadCatalog();
|
|
1259
|
+
const results = [];
|
|
1260
|
+
const opts = { dryRun, force };
|
|
1261
|
+
const agentsMdContent = catalog.agentsMd({
|
|
1262
|
+
projectName: config.projectName,
|
|
1263
|
+
description: config.projectDescription ?? ""
|
|
1264
|
+
});
|
|
1265
|
+
results.push(safeWrite("AGENTS.md", agentsMdContent, { ...opts, useMarkers: true, managedContent: agentsMdContent }));
|
|
1266
|
+
if (config.tools.includes("claude")) {
|
|
1267
|
+
results.push(safeWrite("CLAUDE.md", catalog.claudeMd(), { ...opts, useMarkers: false }));
|
|
1268
|
+
results.push(safeWrite(".claude/settings.json", catalog.settingsJson(), { ...opts, useMarkers: false }));
|
|
1269
|
+
}
|
|
1270
|
+
if (config.tools.includes("copilot")) {
|
|
1271
|
+
results.push(safeWrite(".github/copilot-instructions.md", catalog.copilotInstructions(), { ...opts, useMarkers: false }));
|
|
1272
|
+
}
|
|
1273
|
+
if (config.tools.includes("cursor")) {
|
|
1274
|
+
results.push(safeWrite(".cursor/rules/000-base.mdc", catalog.cursorBase(), { ...opts, useMarkers: false }));
|
|
1275
|
+
}
|
|
1276
|
+
if (config.tools.includes("windsurf")) {
|
|
1277
|
+
results.push(safeWrite(".windsurf/rules/project.md", catalog.windsurfRules(), { ...opts, useMarkers: false }));
|
|
1278
|
+
}
|
|
1279
|
+
if (config.tools.includes("aider")) {
|
|
1280
|
+
results.push(safeWrite("CONVENTIONS.md", catalog.aiderConventions(), { ...opts, useMarkers: false }));
|
|
1281
|
+
results.push(safeWrite(".aider.conf.yml", catalog.aiderConf(), { ...opts, useMarkers: false }));
|
|
1282
|
+
}
|
|
1283
|
+
if (config.tools.includes("gemini")) {
|
|
1284
|
+
results.push(safeWrite("GEMINI.md", catalog.geminiMd(), { ...opts, useMarkers: false }));
|
|
1285
|
+
}
|
|
1286
|
+
if (config.integrations.mcp && config.tools.includes("claude")) {
|
|
1287
|
+
results.push(safeWrite(".mcp.json", catalog.mcpJson(), { ...opts, useMarkers: false }));
|
|
1288
|
+
}
|
|
1289
|
+
if (config.scope !== "minimal") {
|
|
1290
|
+
results.push(...syncSkills("tier1", dryRun));
|
|
1291
|
+
results.push(...syncSkills("tier2", dryRun));
|
|
1292
|
+
}
|
|
1293
|
+
if (config.integrations.hooks) {
|
|
1294
|
+
results.push(...syncHooks(dryRun));
|
|
1295
|
+
}
|
|
1296
|
+
if (config.integrations.subagents) {
|
|
1297
|
+
results.push(...syncAgents(config.shape, dryRun));
|
|
1298
|
+
}
|
|
1299
|
+
if (config.integrations.commands) {
|
|
1300
|
+
results.push(...syncCommands(dryRun));
|
|
1301
|
+
}
|
|
1302
|
+
if (config.integrations.ci) {
|
|
1303
|
+
results.push(...syncCI(dryRun));
|
|
1304
|
+
}
|
|
1305
|
+
if (config.integrations.devcontainer) {
|
|
1306
|
+
results.push(...syncDir("devcontainer", ".devcontainer", dryRun, [".json"]));
|
|
1307
|
+
}
|
|
1308
|
+
if (config.integrations.otel) {
|
|
1309
|
+
results.push(safeWrite(".env.example", readCatalogFile("settings/env.example"), { dryRun, useMarkers: false }));
|
|
1310
|
+
}
|
|
1311
|
+
ensureGitignoreEntries(dryRun);
|
|
1312
|
+
const created = results.filter((r2) => r2.action === "created").length;
|
|
1313
|
+
const updated = results.filter((r2) => r2.action === "updated").length;
|
|
1314
|
+
const conflicts = results.filter((r2) => r2.action === "conflict");
|
|
1315
|
+
if (dryRun) {
|
|
1316
|
+
ye(results.map((r2) => `${r2.action.padEnd(9)} ${r2.path}`).join("\n"), "Dry run");
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
ye(
|
|
1320
|
+
results.map((r2) => `${r2.action.padEnd(9)} ${r2.path}`).join("\n"),
|
|
1321
|
+
`${created} created, ${updated} updated`
|
|
1322
|
+
);
|
|
1323
|
+
if (conflicts.length > 0) {
|
|
1324
|
+
v2.warn(`${conflicts.length} conflict(s) skipped (use --force to overwrite)`);
|
|
1325
|
+
}
|
|
1326
|
+
fe("Sync complete.");
|
|
1327
|
+
}
|
|
1328
|
+
function syncSkills(tier, dryRun) {
|
|
1329
|
+
const srcDir = join2(CATALOG_ROOT, "skills", tier);
|
|
1330
|
+
const destDir = `.claude/skills`;
|
|
1331
|
+
const results = [];
|
|
1332
|
+
if (!existsSync4(srcDir)) return results;
|
|
1333
|
+
const files = readdirSync(srcDir).filter((f2) => f2.endsWith(".md"));
|
|
1334
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1335
|
+
for (const file of files) {
|
|
1336
|
+
const dest = join2(destDir, file);
|
|
1337
|
+
if (!dryRun) copyFileSync(join2(srcDir, file), dest);
|
|
1338
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1339
|
+
}
|
|
1340
|
+
return results;
|
|
1341
|
+
}
|
|
1342
|
+
function syncHooks(dryRun) {
|
|
1343
|
+
const srcDir = join2(CATALOG_ROOT, "hooks");
|
|
1344
|
+
const destDir = `.claude/hooks`;
|
|
1345
|
+
const results = [];
|
|
1346
|
+
if (!existsSync4(srcDir)) return results;
|
|
1347
|
+
const files = readdirSync(srcDir).filter((f2) => f2.endsWith(".sh") || f2 === "hooks.json");
|
|
1348
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1349
|
+
for (const file of files) {
|
|
1350
|
+
const dest = join2(destDir, file);
|
|
1351
|
+
if (!dryRun) copyFileSync(join2(srcDir, file), dest);
|
|
1352
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1353
|
+
}
|
|
1354
|
+
return results;
|
|
1355
|
+
}
|
|
1356
|
+
function syncAgents(shapes, dryRun) {
|
|
1357
|
+
const srcDir = join2(CATALOG_ROOT, "agents");
|
|
1358
|
+
const destDir = `.claude/agents`;
|
|
1359
|
+
const results = [];
|
|
1360
|
+
if (!existsSync4(srcDir)) return results;
|
|
1361
|
+
const CORE_AGENTS = ["orchestrator", "planner", "researcher", "implementer", "reviewer", "tester", "security-auditor", "devops"];
|
|
1362
|
+
const SHAPE_AGENTS = {
|
|
1363
|
+
web: ["frontend"],
|
|
1364
|
+
fullstack: ["frontend", "backend"],
|
|
1365
|
+
backend: ["backend"],
|
|
1366
|
+
mobile: ["mobile"],
|
|
1367
|
+
library: ["backend"]
|
|
1368
|
+
};
|
|
1369
|
+
const agentsToInstall = new Set(CORE_AGENTS);
|
|
1370
|
+
for (const shape of shapes) {
|
|
1371
|
+
for (const agent of SHAPE_AGENTS[shape] ?? []) {
|
|
1372
|
+
agentsToInstall.add(agent);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1376
|
+
for (const agent of agentsToInstall) {
|
|
1377
|
+
const src = join2(srcDir, `${agent}.md`);
|
|
1378
|
+
const dest = join2(destDir, `${agent}.md`);
|
|
1379
|
+
if (!existsSync4(src)) continue;
|
|
1380
|
+
if (!dryRun) copyFileSync(src, dest);
|
|
1381
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1382
|
+
}
|
|
1383
|
+
return results;
|
|
1384
|
+
}
|
|
1385
|
+
function syncCommands(dryRun) {
|
|
1386
|
+
const srcDir = join2(CATALOG_ROOT, "commands");
|
|
1387
|
+
const destDir = `.claude/commands`;
|
|
1388
|
+
const results = [];
|
|
1389
|
+
if (!existsSync4(srcDir)) return results;
|
|
1390
|
+
const files = readdirSync(srcDir).filter((f2) => f2.endsWith(".md"));
|
|
1391
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1392
|
+
for (const file of files) {
|
|
1393
|
+
const dest = join2(destDir, file);
|
|
1394
|
+
if (!dryRun) copyFileSync(join2(srcDir, file), dest);
|
|
1395
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1396
|
+
}
|
|
1397
|
+
return results;
|
|
1398
|
+
}
|
|
1399
|
+
function syncCI(dryRun) {
|
|
1400
|
+
const srcDir = join2(CATALOG_ROOT, "ci");
|
|
1401
|
+
const destDir = `.github/workflows`;
|
|
1402
|
+
const results = [];
|
|
1403
|
+
if (!existsSync4(srcDir)) return results;
|
|
1404
|
+
const files = readdirSync(srcDir).filter((f2) => f2.endsWith(".yml"));
|
|
1405
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1406
|
+
for (const file of files) {
|
|
1407
|
+
const dest = join2(destDir, file);
|
|
1408
|
+
if (!dryRun) copyFileSync(join2(srcDir, file), dest);
|
|
1409
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1410
|
+
}
|
|
1411
|
+
return results;
|
|
1412
|
+
}
|
|
1413
|
+
function syncDir(catalogSubdir, destDir, dryRun, extensions = [".md", ".json", ".yml", ".yaml"]) {
|
|
1414
|
+
const srcDir = join2(CATALOG_ROOT, catalogSubdir);
|
|
1415
|
+
const results = [];
|
|
1416
|
+
if (!existsSync4(srcDir)) return results;
|
|
1417
|
+
const files = readdirSync(srcDir).filter(
|
|
1418
|
+
(f2) => extensions.some((ext) => f2.endsWith(ext))
|
|
1419
|
+
);
|
|
1420
|
+
if (!dryRun) mkdirSync2(destDir, { recursive: true });
|
|
1421
|
+
for (const file of files) {
|
|
1422
|
+
const dest = join2(destDir, file);
|
|
1423
|
+
if (!dryRun) copyFileSync(join2(srcDir, file), dest);
|
|
1424
|
+
results.push({ path: dest, action: existsSync4(dest) ? "updated" : "created" });
|
|
1425
|
+
}
|
|
1426
|
+
return results;
|
|
1427
|
+
}
|
|
1428
|
+
function readCatalogFile(rel) {
|
|
1429
|
+
return readFileSync5(join2(CATALOG_ROOT, rel), "utf8");
|
|
1430
|
+
}
|
|
1431
|
+
var CATALOG_ROOT;
|
|
1432
|
+
var init_sync = __esm({
|
|
1433
|
+
"src/commands/sync.ts"() {
|
|
1434
|
+
"use strict";
|
|
1435
|
+
init_dist2();
|
|
1436
|
+
init_readConfig();
|
|
1437
|
+
init_safeWrite();
|
|
1438
|
+
init_gitignore();
|
|
1439
|
+
init_catalog();
|
|
1440
|
+
CATALOG_ROOT = join2(dirname3(fileURLToPath2(import.meta.url)), "..", "catalog");
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
|
|
1444
|
+
// src/commands/init.ts
|
|
1445
|
+
var init_exports = {};
|
|
1446
|
+
__export(init_exports, {
|
|
1447
|
+
runInit: () => runInit
|
|
1448
|
+
});
|
|
1449
|
+
import { basename } from "path";
|
|
1450
|
+
async function runInit(argv, headless) {
|
|
1451
|
+
const dryRun = argv["dry-run"];
|
|
1452
|
+
if (!argv["skip-git-check"] && !headless && isGitRepo() && isDirtyTree()) {
|
|
1453
|
+
const proceed = await me({
|
|
1454
|
+
message: "Working tree has uncommitted changes. Continue?",
|
|
1455
|
+
initialValue: false
|
|
1456
|
+
});
|
|
1457
|
+
if (!proceed) {
|
|
1458
|
+
ve("Aborted. Stash or commit changes first.");
|
|
1459
|
+
process.exit(0);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
const existing = readConfig(argv.config);
|
|
1463
|
+
if (existing) {
|
|
1464
|
+
const { runSync: runSync3 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
1465
|
+
await runSync3(argv);
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
let config;
|
|
1469
|
+
if (headless || argv.yes) {
|
|
1470
|
+
const projectName = basename(process.cwd());
|
|
1471
|
+
const tools = parseTools(argv.tools);
|
|
1472
|
+
const scope = argv.preset ?? "standard";
|
|
1473
|
+
const integrations = defaultIntegrationsForScope(scope);
|
|
1474
|
+
config = buildDefaultConfig(projectName, "", tools, scope, integrations, []);
|
|
1475
|
+
} else {
|
|
1476
|
+
const answers = await runWizard(basename(process.cwd()));
|
|
1477
|
+
const defaultIntegrations = defaultIntegrationsForScope(answers.scope);
|
|
1478
|
+
const integrations = answers.integrations.length > 0 ? answers.integrations : defaultIntegrations;
|
|
1479
|
+
config = buildDefaultConfig(
|
|
1480
|
+
answers.projectName,
|
|
1481
|
+
answers.projectDescription,
|
|
1482
|
+
answers.tools,
|
|
1483
|
+
answers.scope,
|
|
1484
|
+
integrations,
|
|
1485
|
+
answers.shape
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
writeConfig(config, argv.config ?? ".aikitrc.json", dryRun);
|
|
1489
|
+
const { runSync: runSync2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
1490
|
+
await runSync2(argv);
|
|
1491
|
+
}
|
|
1492
|
+
function parseTools(raw) {
|
|
1493
|
+
const all = ["claude", "cursor", "copilot", "windsurf", "aider", "gemini", "codex"];
|
|
1494
|
+
if (!raw || raw === "all") return all;
|
|
1495
|
+
if (raw === "none") return [];
|
|
1496
|
+
return raw.split(",").filter((t) => all.includes(t));
|
|
1497
|
+
}
|
|
1498
|
+
function defaultIntegrationsForScope(scope) {
|
|
1499
|
+
if (scope === "minimal") return ["mcp"];
|
|
1500
|
+
if (scope === "standard") return ["mcp", "hooks", "commands", "subagents", "ci", "husky"];
|
|
1501
|
+
return ["mcp", "hooks", "commands", "subagents", "ci", "husky", "devcontainer", "plugin", "otel"];
|
|
1502
|
+
}
|
|
1503
|
+
function buildDefaultConfig(projectName, projectDescription, tools, scope, integrations, shape) {
|
|
1504
|
+
return {
|
|
1505
|
+
version: 1,
|
|
1506
|
+
projectName,
|
|
1507
|
+
projectDescription,
|
|
1508
|
+
tools,
|
|
1509
|
+
scope,
|
|
1510
|
+
shape,
|
|
1511
|
+
integrations: {
|
|
1512
|
+
mcp: integrations.includes("mcp"),
|
|
1513
|
+
hooks: integrations.includes("hooks"),
|
|
1514
|
+
commands: integrations.includes("commands"),
|
|
1515
|
+
subagents: integrations.includes("subagents"),
|
|
1516
|
+
ci: integrations.includes("ci"),
|
|
1517
|
+
husky: integrations.includes("husky"),
|
|
1518
|
+
devcontainer: integrations.includes("devcontainer"),
|
|
1519
|
+
plugin: integrations.includes("plugin"),
|
|
1520
|
+
otel: integrations.includes("otel")
|
|
1521
|
+
},
|
|
1522
|
+
skills: { tier1: "all", tier2: "all", tier3: [] },
|
|
1523
|
+
canonical: "AGENTS.md"
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
var init_init = __esm({
|
|
1527
|
+
"src/commands/init.ts"() {
|
|
1528
|
+
"use strict";
|
|
1529
|
+
init_dist2();
|
|
1530
|
+
init_gitState();
|
|
1531
|
+
init_readConfig();
|
|
1532
|
+
init_wizard();
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
// src/commands/diff.ts
|
|
1537
|
+
var diff_exports = {};
|
|
1538
|
+
__export(diff_exports, {
|
|
1539
|
+
runDiff: () => runDiff
|
|
1540
|
+
});
|
|
1541
|
+
import { existsSync as existsSync5, readFileSync as readFileSync6, readdirSync as readdirSync2 } from "fs";
|
|
1542
|
+
import { dirname as dirname4, join as join3 } from "path";
|
|
1543
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1544
|
+
async function runDiff(argv) {
|
|
1545
|
+
const config = readConfig(argv.config);
|
|
1546
|
+
if (!config) {
|
|
1547
|
+
process.stderr.write(".aikitrc.json not found. Run `aikit` to initialise.\n");
|
|
1548
|
+
process.exit(1);
|
|
1549
|
+
}
|
|
1550
|
+
const catalog = loadCatalog();
|
|
1551
|
+
const drifted = [];
|
|
1552
|
+
const missing = [];
|
|
1553
|
+
if (existsSync5("AGENTS.md")) {
|
|
1554
|
+
const current = readFileSync6("AGENTS.md", "utf8");
|
|
1555
|
+
const freshContent = catalog.agentsMd({
|
|
1556
|
+
projectName: config.projectName,
|
|
1557
|
+
description: config.projectDescription ?? ""
|
|
1558
|
+
});
|
|
1559
|
+
const begin = "<!-- BEGIN:haac-aikit -->";
|
|
1560
|
+
const end = "<!-- END:haac-aikit -->";
|
|
1561
|
+
const currentRegion = extractRegion(current, begin, end);
|
|
1562
|
+
const freshRegion = extractRegion(freshContent, begin, end);
|
|
1563
|
+
if (currentRegion !== freshRegion) {
|
|
1564
|
+
drifted.push("AGENTS.md (managed region differs from catalog template)");
|
|
1565
|
+
}
|
|
1566
|
+
} else {
|
|
1567
|
+
missing.push("AGENTS.md");
|
|
1568
|
+
}
|
|
1569
|
+
checkCatalogDir("skills/tier1", ".claude/skills", missing, drifted);
|
|
1570
|
+
checkCatalogDir("skills/tier2", ".claude/skills", missing, drifted);
|
|
1571
|
+
checkCatalogDir("agents", ".claude/agents", missing, drifted);
|
|
1572
|
+
checkCatalogDir("hooks", ".claude/hooks", missing, drifted, [".sh"]);
|
|
1573
|
+
if (missing.length === 0 && drifted.length === 0) {
|
|
1574
|
+
process.stdout.write(kleur_default.green("\u2713 No drift \u2014 project is in sync with catalog.\n"));
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
if (missing.length > 0) {
|
|
1578
|
+
process.stdout.write(kleur_default.yellow(`Missing (${missing.length}):
|
|
1579
|
+
`));
|
|
1580
|
+
for (const m3 of missing) process.stdout.write(` \xB7 ${m3}
|
|
1581
|
+
`);
|
|
1582
|
+
}
|
|
1583
|
+
if (drifted.length > 0) {
|
|
1584
|
+
process.stdout.write(kleur_default.cyan(`Drifted (${drifted.length}):
|
|
1585
|
+
`));
|
|
1586
|
+
for (const d2 of drifted) process.stdout.write(` ~ ${d2}
|
|
1587
|
+
`);
|
|
1588
|
+
}
|
|
1589
|
+
process.stdout.write(`
|
|
1590
|
+
Run ${kleur_default.cyan("aikit sync")} to update all, or ${kleur_default.cyan("aikit update")} to review changes first.
|
|
1591
|
+
`);
|
|
1592
|
+
}
|
|
1593
|
+
function extractRegion(content, begin, end) {
|
|
1594
|
+
const bi = content.indexOf(begin);
|
|
1595
|
+
const ei = content.indexOf(end);
|
|
1596
|
+
if (bi === -1 || ei === -1) return "";
|
|
1597
|
+
return content.slice(bi + begin.length, ei).trim();
|
|
1598
|
+
}
|
|
1599
|
+
function checkCatalogDir(catalogSubdir, installedDir, missing, drifted, extensions = [".md"]) {
|
|
1600
|
+
const catalogDir = join3(CATALOG_ROOT2, catalogSubdir);
|
|
1601
|
+
if (!existsSync5(catalogDir)) return;
|
|
1602
|
+
const files = readdirSync2(catalogDir).filter(
|
|
1603
|
+
(f2) => extensions.some((ext) => f2.endsWith(ext))
|
|
1604
|
+
);
|
|
1605
|
+
for (const file of files) {
|
|
1606
|
+
const installedPath = join3(installedDir, file);
|
|
1607
|
+
if (!existsSync5(installedPath)) {
|
|
1608
|
+
missing.push(`${installedDir}/${file}`);
|
|
1609
|
+
continue;
|
|
1610
|
+
}
|
|
1611
|
+
const catalogContent = readFileSync6(join3(catalogDir, file), "utf8");
|
|
1612
|
+
const installedContent = readFileSync6(installedPath, "utf8");
|
|
1613
|
+
if (catalogContent !== installedContent) {
|
|
1614
|
+
drifted.push(`${installedDir}/${file}`);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
var CATALOG_ROOT2;
|
|
1619
|
+
var init_diff = __esm({
|
|
1620
|
+
"src/commands/diff.ts"() {
|
|
1621
|
+
"use strict";
|
|
1622
|
+
init_kleur();
|
|
1623
|
+
init_readConfig();
|
|
1624
|
+
init_catalog();
|
|
1625
|
+
CATALOG_ROOT2 = join3(dirname4(fileURLToPath3(import.meta.url)), "..", "catalog");
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
// src/commands/update.ts
|
|
1630
|
+
var update_exports = {};
|
|
1631
|
+
__export(update_exports, {
|
|
1632
|
+
runUpdate: () => runUpdate
|
|
1633
|
+
});
|
|
1634
|
+
async function runUpdate(argv) {
|
|
1635
|
+
const config = readConfig(argv.config);
|
|
1636
|
+
if (!config) {
|
|
1637
|
+
v2.error(".aikitrc.json not found. Run `aikit` to initialise.");
|
|
1638
|
+
process.exit(1);
|
|
1639
|
+
}
|
|
1640
|
+
const { runDiff: runDiff2 } = await Promise.resolve().then(() => (init_diff(), diff_exports));
|
|
1641
|
+
await runDiff2({ ...argv, "dry-run": true });
|
|
1642
|
+
if (argv.yes) {
|
|
1643
|
+
const { runSync: runSync3 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
1644
|
+
await runSync3(argv);
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
const proceed = await me({
|
|
1648
|
+
message: "Apply these updates?",
|
|
1649
|
+
initialValue: true
|
|
1650
|
+
});
|
|
1651
|
+
if (!proceed || BD(proceed)) {
|
|
1652
|
+
ve("Update cancelled.");
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
const { runSync: runSync2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
1656
|
+
await runSync2(argv);
|
|
1657
|
+
}
|
|
1658
|
+
var init_update = __esm({
|
|
1659
|
+
"src/commands/update.ts"() {
|
|
1660
|
+
"use strict";
|
|
1661
|
+
init_dist2();
|
|
1662
|
+
init_readConfig();
|
|
1663
|
+
}
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
// src/commands/add.ts
|
|
1667
|
+
var add_exports = {};
|
|
1668
|
+
__export(add_exports, {
|
|
1669
|
+
runAdd: () => runAdd
|
|
1670
|
+
});
|
|
1671
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync6, mkdirSync as mkdirSync3, readdirSync as readdirSync3 } from "fs";
|
|
1672
|
+
import { dirname as dirname5, join as join4 } from "path";
|
|
1673
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
1674
|
+
async function runAdd(argv) {
|
|
1675
|
+
const itemArg = argv._[1];
|
|
1676
|
+
if (!itemArg) {
|
|
1677
|
+
v2.error("Usage: aikit add <name> (e.g. aikit add brainstorming)");
|
|
1678
|
+
process.exit(1);
|
|
1679
|
+
}
|
|
1680
|
+
for (const [_type, spec] of Object.entries(ITEM_DIRS)) {
|
|
1681
|
+
for (const tier of ["tier1", "tier2", ""]) {
|
|
1682
|
+
const catalogDir = join4(CATALOG_ROOT3, tier ? `skills/${tier}` : spec.catalog);
|
|
1683
|
+
if (!existsSync6(catalogDir)) continue;
|
|
1684
|
+
for (const ext of spec.ext) {
|
|
1685
|
+
const srcFile = join4(catalogDir, `${itemArg}${ext}`);
|
|
1686
|
+
if (existsSync6(srcFile)) {
|
|
1687
|
+
const dest = spec.dest;
|
|
1688
|
+
const destFile = join4(dest, `${itemArg}${ext}`);
|
|
1689
|
+
if (existsSync6(destFile) && !argv.force) {
|
|
1690
|
+
v2.warn(`${destFile} already exists. Use --force to overwrite.`);
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
if (!argv["dry-run"]) {
|
|
1694
|
+
mkdirSync3(dest, { recursive: true });
|
|
1695
|
+
copyFileSync2(srcFile, destFile);
|
|
1696
|
+
}
|
|
1697
|
+
process.stdout.write(
|
|
1698
|
+
`${argv["dry-run"] ? "[dry-run] " : ""}${kleur_default.green("\u2713")} Added ${destFile}
|
|
1699
|
+
`
|
|
1700
|
+
);
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
const allItems = listAllCatalogItems();
|
|
1707
|
+
const similar = allItems.filter((n) => n.includes(itemArg) || itemArg.includes(n.split("-")[0] ?? ""));
|
|
1708
|
+
v2.error(`"${itemArg}" not found in catalog.`);
|
|
1709
|
+
if (similar.length > 0) {
|
|
1710
|
+
process.stdout.write(`Did you mean: ${similar.slice(0, 5).join(", ")}?
|
|
1711
|
+
`);
|
|
1712
|
+
}
|
|
1713
|
+
process.stdout.write(`Run ${kleur_default.cyan("aikit list")} to see all available items.
|
|
1714
|
+
`);
|
|
1715
|
+
process.exit(1);
|
|
1716
|
+
}
|
|
1717
|
+
function listAllCatalogItems() {
|
|
1718
|
+
const items = [];
|
|
1719
|
+
for (const subdir of ["skills/tier1", "skills/tier2", "agents", "hooks"]) {
|
|
1720
|
+
const dir = join4(CATALOG_ROOT3, subdir);
|
|
1721
|
+
if (existsSync6(dir)) {
|
|
1722
|
+
readdirSync3(dir).filter((f2) => f2.endsWith(".md") || f2.endsWith(".sh")).forEach((f2) => items.push(f2.replace(/\.(md|sh)$/, "")));
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
return items;
|
|
1726
|
+
}
|
|
1727
|
+
var CATALOG_ROOT3, ITEM_DIRS;
|
|
1728
|
+
var init_add = __esm({
|
|
1729
|
+
"src/commands/add.ts"() {
|
|
1730
|
+
"use strict";
|
|
1731
|
+
init_dist2();
|
|
1732
|
+
init_kleur();
|
|
1733
|
+
CATALOG_ROOT3 = join4(dirname5(fileURLToPath4(import.meta.url)), "..", "catalog");
|
|
1734
|
+
ITEM_DIRS = {
|
|
1735
|
+
skill: { catalog: "skills/tier1", dest: ".claude/skills", ext: [".md"] },
|
|
1736
|
+
agent: { catalog: "agents", dest: ".claude/agents", ext: [".md"] },
|
|
1737
|
+
hook: { catalog: "hooks", dest: ".claude/hooks", ext: [".sh"] }
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
1741
|
+
|
|
1742
|
+
// src/commands/list.ts
|
|
1743
|
+
var list_exports = {};
|
|
1744
|
+
__export(list_exports, {
|
|
1745
|
+
runList: () => runList
|
|
1746
|
+
});
|
|
1747
|
+
import { existsSync as existsSync7, readdirSync as readdirSync4 } from "fs";
|
|
1748
|
+
import { dirname as dirname6, join as join5 } from "path";
|
|
1749
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
1750
|
+
async function runList(_argv) {
|
|
1751
|
+
const sections = [
|
|
1752
|
+
{ label: "Skills \u2014 Tier 1", items: listCategory("skills/tier1", ".claude/skills") },
|
|
1753
|
+
{ label: "Skills \u2014 Tier 2", items: listCategory("skills/tier2", ".claude/skills") },
|
|
1754
|
+
{ label: "Slash commands", items: listCategory("commands", ".claude/commands") },
|
|
1755
|
+
{ label: "Agents", items: listCategory("agents", ".claude/agents") },
|
|
1756
|
+
{ label: "Hooks", items: listCategory("hooks", ".claude/hooks", [".sh"]) }
|
|
1757
|
+
];
|
|
1758
|
+
let total = 0;
|
|
1759
|
+
let installed = 0;
|
|
1760
|
+
for (const section of sections) {
|
|
1761
|
+
if (section.items.length === 0) continue;
|
|
1762
|
+
process.stdout.write(`
|
|
1763
|
+
${kleur_default.bold(section.label)}
|
|
1764
|
+
`);
|
|
1765
|
+
for (const item of section.items) {
|
|
1766
|
+
const mark = item.installed ? kleur_default.green("\u2713") : kleur_default.dim("\xB7");
|
|
1767
|
+
const name = item.installed ? item.name : kleur_default.dim(item.name);
|
|
1768
|
+
process.stdout.write(` ${mark} ${name}
|
|
1769
|
+
`);
|
|
1770
|
+
total++;
|
|
1771
|
+
if (item.installed) installed++;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
process.stdout.write(`
|
|
1775
|
+
${installed}/${total} catalog items installed.
|
|
1776
|
+
`);
|
|
1777
|
+
if (installed < total) {
|
|
1778
|
+
process.stdout.write(
|
|
1779
|
+
`Run ${kleur_default.cyan("aikit add <name>")} to install individual items, or ${kleur_default.cyan("aikit sync")} to install all.
|
|
1780
|
+
`
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
function listCategory(catalogSubdir, installedDir, extensions = [".md"]) {
|
|
1785
|
+
const catalogDir = join5(CATALOG_ROOT4, catalogSubdir);
|
|
1786
|
+
if (!existsSync7(catalogDir)) return [];
|
|
1787
|
+
const installedFiles = new Set(
|
|
1788
|
+
existsSync7(installedDir) ? readdirSync4(installedDir).filter((f2) => extensions.some((ext) => f2.endsWith(ext))) : []
|
|
1789
|
+
);
|
|
1790
|
+
return readdirSync4(catalogDir).filter((f2) => extensions.some((ext) => f2.endsWith(ext))).map((f2) => ({ name: f2.replace(/\.md$/, ""), installed: installedFiles.has(f2) }));
|
|
1791
|
+
}
|
|
1792
|
+
var CATALOG_ROOT4;
|
|
1793
|
+
var init_list = __esm({
|
|
1794
|
+
"src/commands/list.ts"() {
|
|
1795
|
+
"use strict";
|
|
1796
|
+
init_kleur();
|
|
1797
|
+
CATALOG_ROOT4 = join5(dirname6(fileURLToPath5(import.meta.url)), "..", "catalog");
|
|
1798
|
+
}
|
|
1799
|
+
});
|
|
1800
|
+
|
|
1801
|
+
// src/commands/doctor.ts
|
|
1802
|
+
var doctor_exports = {};
|
|
1803
|
+
__export(doctor_exports, {
|
|
1804
|
+
runDoctor: () => runDoctor
|
|
1805
|
+
});
|
|
1806
|
+
import { existsSync as existsSync8, readFileSync as readFileSync7, readdirSync as readdirSync5 } from "fs";
|
|
1807
|
+
import { join as join6 } from "path";
|
|
1808
|
+
async function runDoctor(argv) {
|
|
1809
|
+
const findings = [];
|
|
1810
|
+
const config = readConfig(argv.config);
|
|
1811
|
+
if (!config) {
|
|
1812
|
+
findings.push({ level: "error", check: ".aikitrc.json", message: "Not found \u2014 run `aikit` to initialise." });
|
|
1813
|
+
printFindings(findings);
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
findings.push({ level: "ok", check: ".aikitrc.json", message: `version ${config.version}, scope: ${config.scope}` });
|
|
1817
|
+
if (existsSync8("AGENTS.md")) {
|
|
1818
|
+
const content = readFileSync7("AGENTS.md", "utf8");
|
|
1819
|
+
if (content.includes("<!-- BEGIN:haac-aikit -->")) {
|
|
1820
|
+
const lines = content.split("\n").length;
|
|
1821
|
+
if (lines > 200) {
|
|
1822
|
+
findings.push({ level: "warn", check: "AGENTS.md", message: `${lines} lines \u2014 exceeds 200-line budget. Consider pruning.` });
|
|
1823
|
+
} else {
|
|
1824
|
+
findings.push({ level: "ok", check: "AGENTS.md", message: `${lines} lines, markers present` });
|
|
1825
|
+
}
|
|
1826
|
+
} else {
|
|
1827
|
+
findings.push({ level: "warn", check: "AGENTS.md", message: "No haac-aikit markers \u2014 run `aikit sync` to inject them." });
|
|
1828
|
+
}
|
|
1829
|
+
} else {
|
|
1830
|
+
findings.push({ level: "error", check: "AGENTS.md", message: "Missing \u2014 run `aikit sync`." });
|
|
1831
|
+
}
|
|
1832
|
+
const toolChecks = {
|
|
1833
|
+
claude: "CLAUDE.md",
|
|
1834
|
+
copilot: ".github/copilot-instructions.md",
|
|
1835
|
+
cursor: ".cursor/rules/000-base.mdc",
|
|
1836
|
+
windsurf: ".windsurf/rules/project.md",
|
|
1837
|
+
aider: "CONVENTIONS.md",
|
|
1838
|
+
gemini: "GEMINI.md"
|
|
1839
|
+
};
|
|
1840
|
+
for (const tool of config.tools) {
|
|
1841
|
+
const file = toolChecks[tool];
|
|
1842
|
+
if (!file) continue;
|
|
1843
|
+
if (existsSync8(file)) {
|
|
1844
|
+
findings.push({ level: "ok", check: `${tool} shim`, message: file });
|
|
1845
|
+
} else {
|
|
1846
|
+
findings.push({ level: "warn", check: `${tool} shim`, message: `${file} missing \u2014 run \`aikit sync\`` });
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
if (config.tools.includes("claude")) {
|
|
1850
|
+
if (existsSync8(".claude/settings.json")) {
|
|
1851
|
+
findings.push({ level: "ok", check: "settings.json", message: ".claude/settings.json present" });
|
|
1852
|
+
} else {
|
|
1853
|
+
findings.push({ level: "warn", check: "settings.json", message: "Missing \u2014 run `aikit sync`" });
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
if (config.scope !== "minimal") {
|
|
1857
|
+
const skillsDir2 = ".claude/skills";
|
|
1858
|
+
if (existsSync8(skillsDir2)) {
|
|
1859
|
+
const count = readdirSync5(skillsDir2).filter((f2) => f2.endsWith(".md")).length;
|
|
1860
|
+
findings.push({ level: "ok", check: "skills", message: `${count} installed` });
|
|
1861
|
+
} else {
|
|
1862
|
+
findings.push({ level: "warn", check: "skills", message: "Not installed \u2014 run `aikit sync`" });
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
const skillsDir = ".claude/skills";
|
|
1866
|
+
if (existsSync8(skillsDir)) {
|
|
1867
|
+
const skills = readdirSync5(skillsDir).filter((f2) => f2.endsWith(".md"));
|
|
1868
|
+
let descErrors = 0;
|
|
1869
|
+
for (const skill of skills) {
|
|
1870
|
+
const content = readFileSync7(join6(skillsDir, skill), "utf8");
|
|
1871
|
+
const descMatch = content.match(/^description:\s*(.+)$/m);
|
|
1872
|
+
if (descMatch?.[1] && descMatch[1].length > 600) {
|
|
1873
|
+
descErrors++;
|
|
1874
|
+
findings.push({
|
|
1875
|
+
level: "warn",
|
|
1876
|
+
check: `skill:${skill}`,
|
|
1877
|
+
message: `description is ${descMatch[1].length} chars \u2014 exceeds 600-char limit`
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
if (descErrors === 0) {
|
|
1882
|
+
findings.push({ level: "ok", check: "skill descriptions", message: "All within 600-char limit" });
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
if (config.integrations.hooks) {
|
|
1886
|
+
if (existsSync8(".claude/hooks/hooks.json")) {
|
|
1887
|
+
findings.push({ level: "ok", check: "hooks", message: "hooks.json present" });
|
|
1888
|
+
} else {
|
|
1889
|
+
findings.push({ level: "warn", check: "hooks", message: "hooks.json missing \u2014 run `aikit sync`" });
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
if (existsSync8(".gitignore")) {
|
|
1893
|
+
const gi = readFileSync7(".gitignore", "utf8");
|
|
1894
|
+
if (gi.includes(".env")) {
|
|
1895
|
+
findings.push({ level: "ok", check: ".gitignore", message: ".env* entries present" });
|
|
1896
|
+
} else {
|
|
1897
|
+
findings.push({ level: "warn", check: ".gitignore", message: ".env* not in .gitignore \u2014 secrets risk" });
|
|
1898
|
+
}
|
|
1899
|
+
} else {
|
|
1900
|
+
findings.push({ level: "warn", check: ".gitignore", message: "Missing \u2014 run `aikit sync` to create" });
|
|
1901
|
+
}
|
|
1902
|
+
printFindings(findings);
|
|
1903
|
+
}
|
|
1904
|
+
function printFindings(findings) {
|
|
1905
|
+
const errors = findings.filter((f2) => f2.level === "error");
|
|
1906
|
+
const warns = findings.filter((f2) => f2.level === "warn");
|
|
1907
|
+
const oks = findings.filter((f2) => f2.level === "ok");
|
|
1908
|
+
for (const f2 of findings) {
|
|
1909
|
+
const icon = f2.level === "error" ? kleur_default.red("\u2717") : f2.level === "warn" ? kleur_default.yellow("\u26A0") : kleur_default.green("\u2713");
|
|
1910
|
+
process.stdout.write(`${icon} ${kleur_default.bold(f2.check)}: ${f2.message}
|
|
1911
|
+
`);
|
|
1912
|
+
}
|
|
1913
|
+
process.stdout.write("\n");
|
|
1914
|
+
if (errors.length > 0) {
|
|
1915
|
+
process.stdout.write(kleur_default.red(`${errors.length} error(s), ${warns.length} warning(s)
|
|
1916
|
+
`));
|
|
1917
|
+
process.exit(1);
|
|
1918
|
+
} else if (warns.length > 0) {
|
|
1919
|
+
process.stdout.write(kleur_default.yellow(`0 errors, ${warns.length} warning(s) \u2014 run \`aikit sync\` to resolve
|
|
1920
|
+
`));
|
|
1921
|
+
} else {
|
|
1922
|
+
process.stdout.write(kleur_default.green(`All ${oks.length} checks passed.
|
|
1923
|
+
`));
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
var init_doctor = __esm({
|
|
1927
|
+
"src/commands/doctor.ts"() {
|
|
1928
|
+
"use strict";
|
|
1929
|
+
init_kleur();
|
|
1930
|
+
init_readConfig();
|
|
1931
|
+
}
|
|
1932
|
+
});
|
|
1933
|
+
|
|
1934
|
+
// node_modules/mri/lib/index.mjs
|
|
1935
|
+
function toArr(any) {
|
|
1936
|
+
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
1937
|
+
}
|
|
1938
|
+
function toVal(out, key, val, opts) {
|
|
1939
|
+
var x2, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x2 = +val, x2 * 0 === 0) ? x2 : val), !!val) : (x2 = +val, x2 * 0 === 0) ? x2 : val;
|
|
1940
|
+
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
|
1941
|
+
}
|
|
1942
|
+
function lib_default(args, opts) {
|
|
1943
|
+
args = args || [];
|
|
1944
|
+
opts = opts || {};
|
|
1945
|
+
var k3, arr, arg, name, val, out = { _: [] };
|
|
1946
|
+
var i = 0, j3 = 0, idx = 0, len = args.length;
|
|
1947
|
+
const alibi = opts.alias !== void 0;
|
|
1948
|
+
const strict = opts.unknown !== void 0;
|
|
1949
|
+
const defaults = opts.default !== void 0;
|
|
1950
|
+
opts.alias = opts.alias || {};
|
|
1951
|
+
opts.string = toArr(opts.string);
|
|
1952
|
+
opts.boolean = toArr(opts.boolean);
|
|
1953
|
+
if (alibi) {
|
|
1954
|
+
for (k3 in opts.alias) {
|
|
1955
|
+
arr = opts.alias[k3] = toArr(opts.alias[k3]);
|
|
1956
|
+
for (i = 0; i < arr.length; i++) {
|
|
1957
|
+
(opts.alias[arr[i]] = arr.concat(k3)).splice(i, 1);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
for (i = opts.boolean.length; i-- > 0; ) {
|
|
1962
|
+
arr = opts.alias[opts.boolean[i]] || [];
|
|
1963
|
+
for (j3 = arr.length; j3-- > 0; ) opts.boolean.push(arr[j3]);
|
|
1964
|
+
}
|
|
1965
|
+
for (i = opts.string.length; i-- > 0; ) {
|
|
1966
|
+
arr = opts.alias[opts.string[i]] || [];
|
|
1967
|
+
for (j3 = arr.length; j3-- > 0; ) opts.string.push(arr[j3]);
|
|
1968
|
+
}
|
|
1969
|
+
if (defaults) {
|
|
1970
|
+
for (k3 in opts.default) {
|
|
1971
|
+
name = typeof opts.default[k3];
|
|
1972
|
+
arr = opts.alias[k3] = opts.alias[k3] || [];
|
|
1973
|
+
if (opts[name] !== void 0) {
|
|
1974
|
+
opts[name].push(k3);
|
|
1975
|
+
for (i = 0; i < arr.length; i++) {
|
|
1976
|
+
opts[name].push(arr[i]);
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
const keys = strict ? Object.keys(opts.alias) : [];
|
|
1982
|
+
for (i = 0; i < len; i++) {
|
|
1983
|
+
arg = args[i];
|
|
1984
|
+
if (arg === "--") {
|
|
1985
|
+
out._ = out._.concat(args.slice(++i));
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
for (j3 = 0; j3 < arg.length; j3++) {
|
|
1989
|
+
if (arg.charCodeAt(j3) !== 45) break;
|
|
1990
|
+
}
|
|
1991
|
+
if (j3 === 0) {
|
|
1992
|
+
out._.push(arg);
|
|
1993
|
+
} else if (arg.substring(j3, j3 + 3) === "no-") {
|
|
1994
|
+
name = arg.substring(j3 + 3);
|
|
1995
|
+
if (strict && !~keys.indexOf(name)) {
|
|
1996
|
+
return opts.unknown(arg);
|
|
1997
|
+
}
|
|
1998
|
+
out[name] = false;
|
|
1999
|
+
} else {
|
|
2000
|
+
for (idx = j3 + 1; idx < arg.length; idx++) {
|
|
2001
|
+
if (arg.charCodeAt(idx) === 61) break;
|
|
2002
|
+
}
|
|
2003
|
+
name = arg.substring(j3, idx);
|
|
2004
|
+
val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
|
|
2005
|
+
arr = j3 === 2 ? [name] : name;
|
|
2006
|
+
for (idx = 0; idx < arr.length; idx++) {
|
|
2007
|
+
name = arr[idx];
|
|
2008
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j3) + name);
|
|
2009
|
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
if (defaults) {
|
|
2014
|
+
for (k3 in opts.default) {
|
|
2015
|
+
if (out[k3] === void 0) {
|
|
2016
|
+
out[k3] = opts.default[k3];
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
if (alibi) {
|
|
2021
|
+
for (k3 in out) {
|
|
2022
|
+
arr = opts.alias[k3] || [];
|
|
2023
|
+
while (arr.length > 0) {
|
|
2024
|
+
out[arr.shift()] = out[k3];
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
return out;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
// src/detect/isCI.ts
|
|
2032
|
+
var CI_ENV_VARS = [
|
|
2033
|
+
"CI",
|
|
2034
|
+
"CONTINUOUS_INTEGRATION",
|
|
2035
|
+
"BUILD_NUMBER",
|
|
2036
|
+
"GITHUB_ACTIONS",
|
|
2037
|
+
"GITLAB_CI",
|
|
2038
|
+
"CIRCLECI",
|
|
2039
|
+
"TRAVIS",
|
|
2040
|
+
"JENKINS_URL",
|
|
2041
|
+
"TEAMCITY_VERSION",
|
|
2042
|
+
"BUILDKITE"
|
|
2043
|
+
];
|
|
2044
|
+
function isCI() {
|
|
2045
|
+
return CI_ENV_VARS.some((v3) => process.env[v3] !== void 0);
|
|
2046
|
+
}
|
|
2047
|
+
function isTTY() {
|
|
2048
|
+
return Boolean(process.stdout.isTTY);
|
|
2049
|
+
}
|
|
2050
|
+
function isInteractive() {
|
|
2051
|
+
return isTTY() && !isCI();
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
// src/cli.ts
|
|
2055
|
+
var VERSION = "0.1.0";
|
|
2056
|
+
var HELP = `
|
|
2057
|
+
haac-aikit \u2014 the batteries-included AI-agentic-coding kit
|
|
2058
|
+
|
|
2059
|
+
USAGE
|
|
2060
|
+
npx haac-aikit [command] [flags]
|
|
2061
|
+
aikit [command] [flags] (if installed globally)
|
|
2062
|
+
|
|
2063
|
+
COMMANDS
|
|
2064
|
+
(default) Interactive wizard \u2014 drop a complete AI setup into this repo
|
|
2065
|
+
sync Regenerate per-tool files from .aikitrc.json (idempotent)
|
|
2066
|
+
update Pull latest templates; show diff; prompt before writing
|
|
2067
|
+
diff Show drift between current state and a fresh generation
|
|
2068
|
+
add <item> Add a single skill, command, agent, or hook
|
|
2069
|
+
list Show installed items + available catalog
|
|
2070
|
+
doctor Sanity-check: schema, triggers, broken links
|
|
2071
|
+
|
|
2072
|
+
FLAGS
|
|
2073
|
+
--yes, -y Accept all defaults
|
|
2074
|
+
--dry-run Print what would be written; don't write
|
|
2075
|
+
--force Overwrite without prompting
|
|
2076
|
+
--skip-git-check Allow dirty working tree
|
|
2077
|
+
--no-color Disable ANSI colours
|
|
2078
|
+
--config=<path> Use a specific .aikitrc.json location
|
|
2079
|
+
--tools=<list> Comma-separated tool list (claude,cursor,copilot,...)
|
|
2080
|
+
--preset=<scope> minimal | standard | everything
|
|
2081
|
+
--help, -h Show this help
|
|
2082
|
+
--version, -v Show version
|
|
2083
|
+
`;
|
|
2084
|
+
async function main() {
|
|
2085
|
+
const argv = lib_default(process.argv.slice(2), {
|
|
2086
|
+
boolean: ["yes", "dry-run", "force", "skip-git-check", "no-color", "help", "version"],
|
|
2087
|
+
string: ["config", "tools", "preset"],
|
|
2088
|
+
alias: { y: "yes", h: "help", v: "version" },
|
|
2089
|
+
default: {
|
|
2090
|
+
yes: false,
|
|
2091
|
+
"dry-run": false,
|
|
2092
|
+
force: false,
|
|
2093
|
+
"skip-git-check": false,
|
|
2094
|
+
"no-color": false,
|
|
2095
|
+
help: false,
|
|
2096
|
+
version: false
|
|
2097
|
+
}
|
|
2098
|
+
});
|
|
2099
|
+
if (argv.version) {
|
|
2100
|
+
process.stdout.write(`haac-aikit v${VERSION}
|
|
2101
|
+
`);
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (argv.help) {
|
|
2105
|
+
process.stdout.write(HELP + "\n");
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
const [command = "init"] = argv._;
|
|
2109
|
+
const headless = argv.yes && !isInteractive();
|
|
2110
|
+
switch (command) {
|
|
2111
|
+
case "init":
|
|
2112
|
+
case "": {
|
|
2113
|
+
const { runInit: runInit2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
2114
|
+
await runInit2(argv, headless);
|
|
2115
|
+
break;
|
|
2116
|
+
}
|
|
2117
|
+
case "sync": {
|
|
2118
|
+
const { runSync: runSync2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
2119
|
+
await runSync2(argv);
|
|
2120
|
+
break;
|
|
2121
|
+
}
|
|
2122
|
+
case "update": {
|
|
2123
|
+
const { runUpdate: runUpdate2 } = await Promise.resolve().then(() => (init_update(), update_exports));
|
|
2124
|
+
await runUpdate2(argv);
|
|
2125
|
+
break;
|
|
2126
|
+
}
|
|
2127
|
+
case "diff": {
|
|
2128
|
+
const { runDiff: runDiff2 } = await Promise.resolve().then(() => (init_diff(), diff_exports));
|
|
2129
|
+
await runDiff2(argv);
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
case "add": {
|
|
2133
|
+
const { runAdd: runAdd2 } = await Promise.resolve().then(() => (init_add(), add_exports));
|
|
2134
|
+
await runAdd2(argv);
|
|
2135
|
+
break;
|
|
2136
|
+
}
|
|
2137
|
+
case "list": {
|
|
2138
|
+
const { runList: runList2 } = await Promise.resolve().then(() => (init_list(), list_exports));
|
|
2139
|
+
await runList2(argv);
|
|
2140
|
+
break;
|
|
2141
|
+
}
|
|
2142
|
+
case "doctor": {
|
|
2143
|
+
const { runDoctor: runDoctor2 } = await Promise.resolve().then(() => (init_doctor(), doctor_exports));
|
|
2144
|
+
await runDoctor2(argv);
|
|
2145
|
+
break;
|
|
2146
|
+
}
|
|
2147
|
+
default:
|
|
2148
|
+
process.stderr.write(`Unknown command: ${command}
|
|
2149
|
+
Run --help for usage.
|
|
2150
|
+
`);
|
|
2151
|
+
process.exit(1);
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
main().catch((err) => {
|
|
2155
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2156
|
+
process.stderr.write(`
|
|
2157
|
+
Error: ${message}
|
|
2158
|
+
`);
|
|
2159
|
+
process.exit(1);
|
|
2160
|
+
});
|
|
2161
|
+
//# sourceMappingURL=cli.mjs.map
|