openkitt 0.3.13 → 0.3.18
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/README.md +17 -9
- package/dist/cli.js +1795 -1365
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -2192,6 +2192,100 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
2192
2192
|
module.exports.createColors = createColors;
|
|
2193
2193
|
});
|
|
2194
2194
|
|
|
2195
|
+
// src/audit/logger.ts
|
|
2196
|
+
import {
|
|
2197
|
+
appendFileSync,
|
|
2198
|
+
existsSync,
|
|
2199
|
+
mkdirSync,
|
|
2200
|
+
renameSync,
|
|
2201
|
+
rmSync,
|
|
2202
|
+
statSync,
|
|
2203
|
+
writeFileSync
|
|
2204
|
+
} from "node:fs";
|
|
2205
|
+
import { join } from "node:path";
|
|
2206
|
+
function formatLine(type, message) {
|
|
2207
|
+
return `[${new Date().toISOString()}] ${type} ${message}
|
|
2208
|
+
`;
|
|
2209
|
+
}
|
|
2210
|
+
function ensureAuditDir(auditDir) {
|
|
2211
|
+
if (existsSync(auditDir)) {
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
mkdirSync(auditDir, { recursive: true, mode: 448 });
|
|
2215
|
+
}
|
|
2216
|
+
function rotateLogIfNeeded(logPath, log1Path, log2Path) {
|
|
2217
|
+
if (!existsSync(logPath)) {
|
|
2218
|
+
return;
|
|
2219
|
+
}
|
|
2220
|
+
const stats = statSync(logPath);
|
|
2221
|
+
if (stats.size < MAX_LOG_SIZE_BYTES) {
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
if (existsSync(log2Path)) {
|
|
2225
|
+
rmSync(log2Path, { force: true });
|
|
2226
|
+
}
|
|
2227
|
+
if (existsSync(log1Path)) {
|
|
2228
|
+
renameSync(log1Path, log2Path);
|
|
2229
|
+
}
|
|
2230
|
+
renameSync(logPath, log1Path);
|
|
2231
|
+
writeFileSync(logPath, "", { encoding: "utf8", mode: 384 });
|
|
2232
|
+
}
|
|
2233
|
+
function writeAuditLine(logPath, log1Path, log2Path, type, message) {
|
|
2234
|
+
try {
|
|
2235
|
+
rotateLogIfNeeded(logPath, log1Path, log2Path);
|
|
2236
|
+
appendFileSync(logPath, formatLine(type, message), { encoding: "utf8", mode: 384 });
|
|
2237
|
+
} catch {
|
|
2238
|
+
return;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
function createAuditLogger(workspaceDir) {
|
|
2242
|
+
const auditDir = join(workspaceDir, AUDIT_DIR_NAME);
|
|
2243
|
+
const logPath = join(auditDir, AUDIT_FILE_NAME);
|
|
2244
|
+
const log1Path = join(auditDir, ROTATED_LOG_1);
|
|
2245
|
+
const log2Path = join(auditDir, ROTATED_LOG_2);
|
|
2246
|
+
return {
|
|
2247
|
+
log(type, message) {
|
|
2248
|
+
try {
|
|
2249
|
+
ensureAuditDir(auditDir);
|
|
2250
|
+
} catch {
|
|
2251
|
+
return;
|
|
2252
|
+
}
|
|
2253
|
+
writeAuditLine(logPath, log1Path, log2Path, type, message);
|
|
2254
|
+
},
|
|
2255
|
+
cmd(command, status, detail) {
|
|
2256
|
+
const suffix = detail ? ` (${detail})` : "";
|
|
2257
|
+
this.log("CMD", `${command} → ${status}${suffix}`);
|
|
2258
|
+
},
|
|
2259
|
+
cmdExec(command, status) {
|
|
2260
|
+
this.log("CMD_EXEC", `${command} → ${status}`);
|
|
2261
|
+
},
|
|
2262
|
+
mcp(tool, params, status, detail) {
|
|
2263
|
+
const suffix = detail ? ` (${detail})` : "";
|
|
2264
|
+
this.log("MCP", `${tool} (${params}) → ${status}${suffix}`);
|
|
2265
|
+
},
|
|
2266
|
+
llmCall(provider, model, promptVersion, estimatedTokens, status) {
|
|
2267
|
+
this.log("LLM_CALL", `${provider}/${model} (prompt: ${promptVersion}, est. ${estimatedTokens} tokens) → ${status}`);
|
|
2268
|
+
},
|
|
2269
|
+
fileWrite(path, hash) {
|
|
2270
|
+
const suffix = hash ? ` (SHA-256: ${hash})` : "";
|
|
2271
|
+
this.log("FILE_WRITE", `${path}${suffix}`);
|
|
2272
|
+
},
|
|
2273
|
+
staged(path, detail) {
|
|
2274
|
+
this.log("STAGED", `${path} (${detail})`);
|
|
2275
|
+
},
|
|
2276
|
+
userConfirmed() {
|
|
2277
|
+
this.log("USER_CONFIRMED", "staged changes");
|
|
2278
|
+
},
|
|
2279
|
+
security(action, message) {
|
|
2280
|
+
this.log("SECURITY", `${action} ${message}`);
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
}
|
|
2284
|
+
var AUDIT_DIR_NAME = ".kitt", AUDIT_FILE_NAME = "audit.log", ROTATED_LOG_1 = "audit.log.1", ROTATED_LOG_2 = "audit.log.2", MAX_LOG_SIZE_BYTES;
|
|
2285
|
+
var init_logger = __esm(() => {
|
|
2286
|
+
MAX_LOG_SIZE_BYTES = 10 * 1024 * 1024;
|
|
2287
|
+
});
|
|
2288
|
+
|
|
2195
2289
|
// node_modules/sisteransi/src/index.js
|
|
2196
2290
|
var require_src = __commonJS((exports, module) => {
|
|
2197
2291
|
var ESC = "\x1B";
|
|
@@ -2250,6 +2344,869 @@ var require_src = __commonJS((exports, module) => {
|
|
|
2250
2344
|
module.exports = { cursor, scroll, erase, beep };
|
|
2251
2345
|
});
|
|
2252
2346
|
|
|
2347
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
2348
|
+
import { stdin as j, stdout as M } from "node:process";
|
|
2349
|
+
import O from "node:readline";
|
|
2350
|
+
import { Writable as X } from "node:stream";
|
|
2351
|
+
function DD({ onlyFirst: e = false } = {}) {
|
|
2352
|
+
const t = ["[\\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("|");
|
|
2353
|
+
return new RegExp(t, e ? undefined : "g");
|
|
2354
|
+
}
|
|
2355
|
+
function P(e) {
|
|
2356
|
+
if (typeof e != "string")
|
|
2357
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
2358
|
+
return e.replace(uD, "");
|
|
2359
|
+
}
|
|
2360
|
+
function L(e) {
|
|
2361
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
2362
|
+
}
|
|
2363
|
+
function p(e, u = {}) {
|
|
2364
|
+
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
2365
|
+
return 0;
|
|
2366
|
+
e = e.replace(sD(), " ");
|
|
2367
|
+
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
2368
|
+
let F = 0;
|
|
2369
|
+
for (const s of e) {
|
|
2370
|
+
const i = s.codePointAt(0);
|
|
2371
|
+
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
2372
|
+
continue;
|
|
2373
|
+
switch (eD.eastAsianWidth(s)) {
|
|
2374
|
+
case "F":
|
|
2375
|
+
case "W":
|
|
2376
|
+
F += 2;
|
|
2377
|
+
break;
|
|
2378
|
+
case "A":
|
|
2379
|
+
F += t;
|
|
2380
|
+
break;
|
|
2381
|
+
default:
|
|
2382
|
+
F += 1;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
return F;
|
|
2386
|
+
}
|
|
2387
|
+
function rD() {
|
|
2388
|
+
const e = new Map;
|
|
2389
|
+
for (const [u, t] of Object.entries(r)) {
|
|
2390
|
+
for (const [F, s] of Object.entries(t))
|
|
2391
|
+
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
2392
|
+
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
2393
|
+
}
|
|
2394
|
+
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
2395
|
+
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
2396
|
+
if (!t)
|
|
2397
|
+
return [0, 0, 0];
|
|
2398
|
+
let [F] = t;
|
|
2399
|
+
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
2400
|
+
const s = Number.parseInt(F, 16);
|
|
2401
|
+
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
2402
|
+
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
2403
|
+
if (u < 8)
|
|
2404
|
+
return 30 + u;
|
|
2405
|
+
if (u < 16)
|
|
2406
|
+
return 90 + (u - 8);
|
|
2407
|
+
let t, F, s;
|
|
2408
|
+
if (u >= 232)
|
|
2409
|
+
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
2410
|
+
else {
|
|
2411
|
+
u -= 16;
|
|
2412
|
+
const C = u % 36;
|
|
2413
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
2414
|
+
}
|
|
2415
|
+
const i = Math.max(t, F, s) * 2;
|
|
2416
|
+
if (i === 0)
|
|
2417
|
+
return 30;
|
|
2418
|
+
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
2419
|
+
return i === 2 && (D += 60), D;
|
|
2420
|
+
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
2421
|
+
}
|
|
2422
|
+
function Y(e, u, t) {
|
|
2423
|
+
return String(e).normalize().replace(/\r\n/g, `
|
|
2424
|
+
`).split(`
|
|
2425
|
+
`).map((F) => lD(F, u, t)).join(`
|
|
2426
|
+
`);
|
|
2427
|
+
}
|
|
2428
|
+
function $(e, u) {
|
|
2429
|
+
if (typeof e == "string")
|
|
2430
|
+
return B.aliases.get(e) === u;
|
|
2431
|
+
for (const t of e)
|
|
2432
|
+
if (t !== undefined && $(t, u))
|
|
2433
|
+
return true;
|
|
2434
|
+
return false;
|
|
2435
|
+
}
|
|
2436
|
+
function BD(e, u) {
|
|
2437
|
+
if (e === u)
|
|
2438
|
+
return;
|
|
2439
|
+
const t = e.split(`
|
|
2440
|
+
`), F = u.split(`
|
|
2441
|
+
`), s = [];
|
|
2442
|
+
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
2443
|
+
t[i] !== F[i] && s.push(i);
|
|
2444
|
+
return s;
|
|
2445
|
+
}
|
|
2446
|
+
function pD(e) {
|
|
2447
|
+
return e === S;
|
|
2448
|
+
}
|
|
2449
|
+
function m(e, u) {
|
|
2450
|
+
const t = e;
|
|
2451
|
+
t.isTTY && t.setRawMode(u);
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
class x {
|
|
2455
|
+
constructor(u, t = true) {
|
|
2456
|
+
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", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
2457
|
+
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
2458
|
+
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 = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
2459
|
+
}
|
|
2460
|
+
unsubscribe() {
|
|
2461
|
+
this._subscribers.clear();
|
|
2462
|
+
}
|
|
2463
|
+
setSubscriber(u, t) {
|
|
2464
|
+
const F = this._subscribers.get(u) ?? [];
|
|
2465
|
+
F.push(t), this._subscribers.set(u, F);
|
|
2466
|
+
}
|
|
2467
|
+
on(u, t) {
|
|
2468
|
+
this.setSubscriber(u, { cb: t });
|
|
2469
|
+
}
|
|
2470
|
+
once(u, t) {
|
|
2471
|
+
this.setSubscriber(u, { cb: t, once: true });
|
|
2472
|
+
}
|
|
2473
|
+
emit(u, ...t) {
|
|
2474
|
+
const F = this._subscribers.get(u) ?? [], s = [];
|
|
2475
|
+
for (const i of F)
|
|
2476
|
+
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
2477
|
+
for (const i of s)
|
|
2478
|
+
i();
|
|
2479
|
+
}
|
|
2480
|
+
prompt() {
|
|
2481
|
+
return new Promise((u, t) => {
|
|
2482
|
+
if (this._abortSignal) {
|
|
2483
|
+
if (this._abortSignal.aborted)
|
|
2484
|
+
return this.state = "cancel", this.close(), u(S);
|
|
2485
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
2486
|
+
this.state = "cancel", this.close();
|
|
2487
|
+
}, { once: true });
|
|
2488
|
+
}
|
|
2489
|
+
const F = new X;
|
|
2490
|
+
F._write = (s, i, D) => {
|
|
2491
|
+
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
2492
|
+
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
2493
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
2494
|
+
}), this.once("cancel", () => {
|
|
2495
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
2496
|
+
});
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
onKeypress(u, t) {
|
|
2500
|
+
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
2501
|
+
if (this.opts.validate) {
|
|
2502
|
+
const F = this.opts.validate(this.value);
|
|
2503
|
+
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
2504
|
+
}
|
|
2505
|
+
this.state !== "error" && (this.state = "submit");
|
|
2506
|
+
}
|
|
2507
|
+
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
2508
|
+
}
|
|
2509
|
+
close() {
|
|
2510
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
2511
|
+
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
2512
|
+
}
|
|
2513
|
+
restoreCursor() {
|
|
2514
|
+
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
2515
|
+
`).length - 1;
|
|
2516
|
+
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
2517
|
+
}
|
|
2518
|
+
render() {
|
|
2519
|
+
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
2520
|
+
if (u !== this._prevFrame) {
|
|
2521
|
+
if (this.state === "initial")
|
|
2522
|
+
this.output.write(import_sisteransi.cursor.hide);
|
|
2523
|
+
else {
|
|
2524
|
+
const t = BD(this._prevFrame, u);
|
|
2525
|
+
if (this.restoreCursor(), t && t?.length === 1) {
|
|
2526
|
+
const F = t[0];
|
|
2527
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
2528
|
+
const s = u.split(`
|
|
2529
|
+
`);
|
|
2530
|
+
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
if (t && t?.length > 1) {
|
|
2534
|
+
const F = t[0];
|
|
2535
|
+
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
2536
|
+
const s = u.split(`
|
|
2537
|
+
`).slice(F);
|
|
2538
|
+
this.output.write(s.join(`
|
|
2539
|
+
`)), this._prevFrame = u;
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
this.output.write(import_sisteransi.erase.down());
|
|
2543
|
+
}
|
|
2544
|
+
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
var import_sisteransi, import_picocolors, uD, W, tD, eD, FD = function() {
|
|
2549
|
+
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;
|
|
2550
|
+
}, sD, w = 10, N = (e = 0) => (u) => `\x1B[${u + e}m`, I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`, R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`, r, iD, CD, ED, d, oD = 39, y = "\x07", V = "[", nD = "]", G = "m", _, z = (e) => `${d.values().next().value}${V}${e}${G}`, K = (e) => `${d.values().next().value}${_}${e}${y}`, aD = (e) => e.split(" ").map((u) => p(u)), k = (e, u, t) => {
|
|
2551
|
+
const F = [...u];
|
|
2552
|
+
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
2553
|
+
for (const [C, n] of F.entries()) {
|
|
2554
|
+
const E = p(n);
|
|
2555
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
2556
|
+
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
2557
|
+
continue;
|
|
2558
|
+
}
|
|
2559
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
2560
|
+
}
|
|
2561
|
+
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
2562
|
+
}, hD = (e) => {
|
|
2563
|
+
const u = e.split(" ");
|
|
2564
|
+
let t = u.length;
|
|
2565
|
+
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
2566
|
+
t--;
|
|
2567
|
+
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
2568
|
+
}, lD = (e, u, t = {}) => {
|
|
2569
|
+
if (t.trim !== false && e.trim() === "")
|
|
2570
|
+
return "";
|
|
2571
|
+
let F = "", s, i;
|
|
2572
|
+
const D = aD(e);
|
|
2573
|
+
let C = [""];
|
|
2574
|
+
for (const [E, a] of e.split(" ").entries()) {
|
|
2575
|
+
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
2576
|
+
let o = p(C[C.length - 1]);
|
|
2577
|
+
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
2578
|
+
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
2579
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
2580
|
+
continue;
|
|
2581
|
+
}
|
|
2582
|
+
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
2583
|
+
if (t.wordWrap === false && o < u) {
|
|
2584
|
+
k(C, a, u);
|
|
2585
|
+
continue;
|
|
2586
|
+
}
|
|
2587
|
+
C.push("");
|
|
2588
|
+
}
|
|
2589
|
+
if (o + D[E] > u && t.wordWrap === false) {
|
|
2590
|
+
k(C, a, u);
|
|
2591
|
+
continue;
|
|
2592
|
+
}
|
|
2593
|
+
C[C.length - 1] += a;
|
|
2594
|
+
}
|
|
2595
|
+
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
2596
|
+
const n = [...C.join(`
|
|
2597
|
+
`)];
|
|
2598
|
+
for (const [E, a] of n.entries()) {
|
|
2599
|
+
if (F += a, d.has(a)) {
|
|
2600
|
+
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
2601
|
+
if (c.code !== undefined) {
|
|
2602
|
+
const f = Number.parseFloat(c.code);
|
|
2603
|
+
s = f === oD ? undefined : f;
|
|
2604
|
+
} else
|
|
2605
|
+
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
2606
|
+
}
|
|
2607
|
+
const o = ED.codes.get(Number(s));
|
|
2608
|
+
n[E + 1] === `
|
|
2609
|
+
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
2610
|
+
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
2611
|
+
}
|
|
2612
|
+
return F;
|
|
2613
|
+
}, xD, B, AD, S, gD, vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t), dD, A, kD, $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t), SD, TD, jD = (e, u, t) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, U = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t), MD, OD, PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t, J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t), LD, RD;
|
|
2614
|
+
var init_dist = __esm(() => {
|
|
2615
|
+
import_sisteransi = __toESM(require_src(), 1);
|
|
2616
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
2617
|
+
uD = DD();
|
|
2618
|
+
W = { exports: {} };
|
|
2619
|
+
(function(e) {
|
|
2620
|
+
var u = {};
|
|
2621
|
+
e.exports = u, u.eastAsianWidth = function(F) {
|
|
2622
|
+
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
2623
|
+
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";
|
|
2624
|
+
}, u.characterLength = function(F) {
|
|
2625
|
+
var s = this.eastAsianWidth(F);
|
|
2626
|
+
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
2627
|
+
};
|
|
2628
|
+
function t(F) {
|
|
2629
|
+
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
2630
|
+
}
|
|
2631
|
+
u.length = function(F) {
|
|
2632
|
+
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
2633
|
+
i = i + this.characterLength(s[D]);
|
|
2634
|
+
return i;
|
|
2635
|
+
}, u.slice = function(F, s, i) {
|
|
2636
|
+
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
2637
|
+
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
2638
|
+
var a = n[E], o = u.length(a);
|
|
2639
|
+
if (C >= s - (o == 2 ? 1 : 0))
|
|
2640
|
+
if (C + o <= i)
|
|
2641
|
+
D += a;
|
|
2642
|
+
else
|
|
2643
|
+
break;
|
|
2644
|
+
C += o;
|
|
2645
|
+
}
|
|
2646
|
+
return D;
|
|
2647
|
+
};
|
|
2648
|
+
})(W);
|
|
2649
|
+
tD = W.exports;
|
|
2650
|
+
eD = L(tD);
|
|
2651
|
+
sD = L(FD);
|
|
2652
|
+
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] } };
|
|
2653
|
+
Object.keys(r.modifier);
|
|
2654
|
+
iD = Object.keys(r.color);
|
|
2655
|
+
CD = Object.keys(r.bgColor);
|
|
2656
|
+
[...iD, ...CD];
|
|
2657
|
+
ED = rD();
|
|
2658
|
+
d = new Set(["\x1B", ""]);
|
|
2659
|
+
_ = `${nD}8;;`;
|
|
2660
|
+
xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
2661
|
+
B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
2662
|
+
AD = globalThis.process.platform.startsWith("win");
|
|
2663
|
+
S = Symbol("clack:cancel");
|
|
2664
|
+
gD = Object.defineProperty;
|
|
2665
|
+
dD = class dD extends x {
|
|
2666
|
+
get cursor() {
|
|
2667
|
+
return this.value ? 0 : 1;
|
|
2668
|
+
}
|
|
2669
|
+
get _value() {
|
|
2670
|
+
return this.cursor === 0;
|
|
2671
|
+
}
|
|
2672
|
+
constructor(u) {
|
|
2673
|
+
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
2674
|
+
this.value = this._value;
|
|
2675
|
+
}), this.on("confirm", (t) => {
|
|
2676
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
2677
|
+
}), this.on("cursor", () => {
|
|
2678
|
+
this.value = !this.value;
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
};
|
|
2682
|
+
A = new WeakMap;
|
|
2683
|
+
kD = Object.defineProperty;
|
|
2684
|
+
SD = class extends x {
|
|
2685
|
+
constructor(u) {
|
|
2686
|
+
super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
2687
|
+
t === "a" && this.toggleAll();
|
|
2688
|
+
}), this.on("cursor", (t) => {
|
|
2689
|
+
switch (t) {
|
|
2690
|
+
case "left":
|
|
2691
|
+
case "up":
|
|
2692
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
2693
|
+
break;
|
|
2694
|
+
case "down":
|
|
2695
|
+
case "right":
|
|
2696
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
2697
|
+
break;
|
|
2698
|
+
case "space":
|
|
2699
|
+
this.toggleValue();
|
|
2700
|
+
break;
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
get _value() {
|
|
2705
|
+
return this.options[this.cursor].value;
|
|
2706
|
+
}
|
|
2707
|
+
toggleAll() {
|
|
2708
|
+
const u = this.value.length === this.options.length;
|
|
2709
|
+
this.value = u ? [] : this.options.map((t) => t.value);
|
|
2710
|
+
}
|
|
2711
|
+
toggleValue() {
|
|
2712
|
+
const u = this.value.includes(this._value);
|
|
2713
|
+
this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
TD = Object.defineProperty;
|
|
2717
|
+
MD = class MD extends x {
|
|
2718
|
+
constructor({ mask: u, ...t }) {
|
|
2719
|
+
super(t), U(this, "valueWithCursor", ""), U(this, "_mask", "•"), this._mask = u ?? "•", this.on("finalize", () => {
|
|
2720
|
+
this.valueWithCursor = this.masked;
|
|
2721
|
+
}), this.on("value", () => {
|
|
2722
|
+
if (this.cursor >= this.value.length)
|
|
2723
|
+
this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
2724
|
+
else {
|
|
2725
|
+
const F = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
|
|
2726
|
+
this.valueWithCursor = `${F}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
|
|
2727
|
+
}
|
|
2728
|
+
});
|
|
2729
|
+
}
|
|
2730
|
+
get cursor() {
|
|
2731
|
+
return this._cursor;
|
|
2732
|
+
}
|
|
2733
|
+
get masked() {
|
|
2734
|
+
return this.value.replaceAll(/./g, this._mask);
|
|
2735
|
+
}
|
|
2736
|
+
};
|
|
2737
|
+
OD = Object.defineProperty;
|
|
2738
|
+
LD = class LD extends x {
|
|
2739
|
+
constructor(u) {
|
|
2740
|
+
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
2741
|
+
switch (t) {
|
|
2742
|
+
case "left":
|
|
2743
|
+
case "up":
|
|
2744
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
2745
|
+
break;
|
|
2746
|
+
case "down":
|
|
2747
|
+
case "right":
|
|
2748
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
2749
|
+
break;
|
|
2750
|
+
}
|
|
2751
|
+
this.changeValue();
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
get _value() {
|
|
2755
|
+
return this.options[this.cursor];
|
|
2756
|
+
}
|
|
2757
|
+
changeValue() {
|
|
2758
|
+
this.value = this._value.value;
|
|
2759
|
+
}
|
|
2760
|
+
};
|
|
2761
|
+
RD = class RD extends x {
|
|
2762
|
+
get valueWithCursor() {
|
|
2763
|
+
if (this.state === "submit")
|
|
2764
|
+
return this.value;
|
|
2765
|
+
if (this.cursor >= this.value.length)
|
|
2766
|
+
return `${this.value}█`;
|
|
2767
|
+
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
2768
|
+
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
2769
|
+
}
|
|
2770
|
+
get cursor() {
|
|
2771
|
+
return this._cursor;
|
|
2772
|
+
}
|
|
2773
|
+
constructor(u) {
|
|
2774
|
+
super(u), this.on("finalize", () => {
|
|
2775
|
+
this.value || (this.value = u.defaultValue);
|
|
2776
|
+
});
|
|
2777
|
+
}
|
|
2778
|
+
};
|
|
2779
|
+
});
|
|
2780
|
+
|
|
2781
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
2782
|
+
import y2 from "node:process";
|
|
2783
|
+
function ce() {
|
|
2784
|
+
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2785
|
+
}
|
|
2786
|
+
var import_picocolors2, import_sisteransi2, V2, u = (t, n) => V2 ? t : n, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U2, K2, b2 = (t) => {
|
|
2787
|
+
switch (t) {
|
|
2788
|
+
case "initial":
|
|
2789
|
+
case "active":
|
|
2790
|
+
return import_picocolors2.default.cyan(le);
|
|
2791
|
+
case "cancel":
|
|
2792
|
+
return import_picocolors2.default.red(L2);
|
|
2793
|
+
case "error":
|
|
2794
|
+
return import_picocolors2.default.yellow(W2);
|
|
2795
|
+
case "submit":
|
|
2796
|
+
return import_picocolors2.default.green(C);
|
|
2797
|
+
}
|
|
2798
|
+
}, G2 = (t) => {
|
|
2799
|
+
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
2800
|
+
let l2 = 0;
|
|
2801
|
+
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
2802
|
+
const $2 = a < r2.length && l2 > 0, g = a < r2.length && l2 + a < r2.length;
|
|
2803
|
+
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
2804
|
+
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g;
|
|
2805
|
+
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
2806
|
+
});
|
|
2807
|
+
}, he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
2808
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
2809
|
+
${b2(this.state)} ${t.message}
|
|
2810
|
+
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
2811
|
+
switch (this.state) {
|
|
2812
|
+
case "error":
|
|
2813
|
+
return `${n.trim()}
|
|
2814
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
2815
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
2816
|
+
`;
|
|
2817
|
+
case "submit":
|
|
2818
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
2819
|
+
case "cancel":
|
|
2820
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
2821
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
2822
|
+
default:
|
|
2823
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
2824
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2825
|
+
`;
|
|
2826
|
+
}
|
|
2827
|
+
} }).prompt(), ge = (t) => new MD({ validate: t.validate, mask: t.mask ?? $e, render() {
|
|
2828
|
+
const n = `${import_picocolors2.default.gray(o)}
|
|
2829
|
+
${b2(this.state)} ${t.message}
|
|
2830
|
+
`, r2 = this.valueWithCursor, i = this.masked;
|
|
2831
|
+
switch (this.state) {
|
|
2832
|
+
case "error":
|
|
2833
|
+
return `${n.trim()}
|
|
2834
|
+
${import_picocolors2.default.yellow(o)} ${i}
|
|
2835
|
+
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
2836
|
+
`;
|
|
2837
|
+
case "submit":
|
|
2838
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(i)}`;
|
|
2839
|
+
case "cancel":
|
|
2840
|
+
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i ?? ""))}${i ? `
|
|
2841
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
2842
|
+
default:
|
|
2843
|
+
return `${n}${import_picocolors2.default.cyan(o)} ${r2}
|
|
2844
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2845
|
+
`;
|
|
2846
|
+
}
|
|
2847
|
+
} }).prompt(), ye = (t) => {
|
|
2848
|
+
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
2849
|
+
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
2850
|
+
const i = `${import_picocolors2.default.gray(o)}
|
|
2851
|
+
${b2(this.state)} ${t.message}
|
|
2852
|
+
`, s = this.value ? n : r2;
|
|
2853
|
+
switch (this.state) {
|
|
2854
|
+
case "submit":
|
|
2855
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
2856
|
+
case "cancel":
|
|
2857
|
+
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
2858
|
+
${import_picocolors2.default.gray(o)}`;
|
|
2859
|
+
default:
|
|
2860
|
+
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
2861
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2862
|
+
`;
|
|
2863
|
+
}
|
|
2864
|
+
} }).prompt();
|
|
2865
|
+
}, ve = (t) => {
|
|
2866
|
+
const n = (r2, i) => {
|
|
2867
|
+
const s = r2.label ?? String(r2.value);
|
|
2868
|
+
switch (i) {
|
|
2869
|
+
case "selected":
|
|
2870
|
+
return `${import_picocolors2.default.dim(s)}`;
|
|
2871
|
+
case "active":
|
|
2872
|
+
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
2873
|
+
case "cancelled":
|
|
2874
|
+
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
2875
|
+
default:
|
|
2876
|
+
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
2877
|
+
}
|
|
2878
|
+
};
|
|
2879
|
+
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
2880
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
2881
|
+
${b2(this.state)} ${t.message}
|
|
2882
|
+
`;
|
|
2883
|
+
switch (this.state) {
|
|
2884
|
+
case "submit":
|
|
2885
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
2886
|
+
case "cancel":
|
|
2887
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
2888
|
+
${import_picocolors2.default.gray(o)}`;
|
|
2889
|
+
default:
|
|
2890
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
2891
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
2892
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2893
|
+
`;
|
|
2894
|
+
}
|
|
2895
|
+
} }).prompt();
|
|
2896
|
+
}, fe = (t) => {
|
|
2897
|
+
const n = (r2, i) => {
|
|
2898
|
+
const s = r2.label ?? String(r2.value);
|
|
2899
|
+
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
2900
|
+
};
|
|
2901
|
+
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
2902
|
+
if (this.required && r2.length === 0)
|
|
2903
|
+
return `Please select at least one option.
|
|
2904
|
+
${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`))}`;
|
|
2905
|
+
}, render() {
|
|
2906
|
+
const r2 = `${import_picocolors2.default.gray(o)}
|
|
2907
|
+
${b2(this.state)} ${t.message}
|
|
2908
|
+
`, i = (s, c) => {
|
|
2909
|
+
const a = this.value.includes(s.value);
|
|
2910
|
+
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
2911
|
+
};
|
|
2912
|
+
switch (this.state) {
|
|
2913
|
+
case "submit":
|
|
2914
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
2915
|
+
case "cancel": {
|
|
2916
|
+
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
2917
|
+
return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
2918
|
+
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
2919
|
+
}
|
|
2920
|
+
case "error": {
|
|
2921
|
+
const s = this.error.split(`
|
|
2922
|
+
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
2923
|
+
`);
|
|
2924
|
+
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
2925
|
+
${import_picocolors2.default.yellow(o)} `)}
|
|
2926
|
+
${s}
|
|
2927
|
+
`;
|
|
2928
|
+
}
|
|
2929
|
+
default:
|
|
2930
|
+
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
2931
|
+
${import_picocolors2.default.cyan(o)} `)}
|
|
2932
|
+
${import_picocolors2.default.cyan(d2)}
|
|
2933
|
+
`;
|
|
2934
|
+
}
|
|
2935
|
+
} }).prompt();
|
|
2936
|
+
}, J2;
|
|
2937
|
+
var init_dist2 = __esm(() => {
|
|
2938
|
+
init_dist();
|
|
2939
|
+
init_dist();
|
|
2940
|
+
import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
2941
|
+
import_sisteransi2 = __toESM(require_src(), 1);
|
|
2942
|
+
V2 = ce();
|
|
2943
|
+
le = u("◆", "*");
|
|
2944
|
+
L2 = u("■", "x");
|
|
2945
|
+
W2 = u("▲", "x");
|
|
2946
|
+
C = u("◇", "o");
|
|
2947
|
+
ue = u("┌", "T");
|
|
2948
|
+
o = u("│", "|");
|
|
2949
|
+
d2 = u("└", "—");
|
|
2950
|
+
k2 = u("●", ">");
|
|
2951
|
+
P2 = u("○", " ");
|
|
2952
|
+
A2 = u("◻", "[•]");
|
|
2953
|
+
T = u("◼", "[+]");
|
|
2954
|
+
F = u("◻", "[ ]");
|
|
2955
|
+
$e = u("▪", "•");
|
|
2956
|
+
_2 = u("─", "-");
|
|
2957
|
+
me = u("╮", "+");
|
|
2958
|
+
de = u("├", "+");
|
|
2959
|
+
pe = u("╯", "+");
|
|
2960
|
+
q = u("●", "•");
|
|
2961
|
+
D = u("◆", "*");
|
|
2962
|
+
U2 = u("▲", "!");
|
|
2963
|
+
K2 = u("■", "x");
|
|
2964
|
+
J2 = `${import_picocolors2.default.gray(o)} `;
|
|
2965
|
+
});
|
|
2966
|
+
|
|
2967
|
+
// src/utils/display.ts
|
|
2968
|
+
function success(message) {
|
|
2969
|
+
console.log(`${import_picocolors3.default.green("✓")} ${message}`);
|
|
2970
|
+
}
|
|
2971
|
+
function error(message) {
|
|
2972
|
+
console.log(`${import_picocolors3.default.red("✗")} ${message}`);
|
|
2973
|
+
}
|
|
2974
|
+
function warn(message) {
|
|
2975
|
+
console.log(`${import_picocolors3.default.yellow("⚠")} ${message}`);
|
|
2976
|
+
}
|
|
2977
|
+
function info(message) {
|
|
2978
|
+
console.log(`${import_picocolors3.default.blue("ℹ")} ${message}`);
|
|
2979
|
+
}
|
|
2980
|
+
function resolvePrice(model) {
|
|
2981
|
+
if (model in MODEL_PRICING)
|
|
2982
|
+
return MODEL_PRICING[model];
|
|
2983
|
+
const key = Object.keys(MODEL_PRICING).find((k3) => model.startsWith(k3));
|
|
2984
|
+
return key ? MODEL_PRICING[key] : null;
|
|
2985
|
+
}
|
|
2986
|
+
function formatCost(usd) {
|
|
2987
|
+
if (usd === 0)
|
|
2988
|
+
return "$0.00";
|
|
2989
|
+
if (usd < 0.001)
|
|
2990
|
+
return `$${usd.toFixed(6)}`;
|
|
2991
|
+
if (usd < 0.01)
|
|
2992
|
+
return `$${usd.toFixed(4)}`;
|
|
2993
|
+
return `$${usd.toFixed(2)}`;
|
|
2994
|
+
}
|
|
2995
|
+
function renderContextBanner(params) {
|
|
2996
|
+
const { inputTokens, outputTokens, provider, model } = params;
|
|
2997
|
+
const totalTokens = inputTokens + outputTokens;
|
|
2998
|
+
const contextWindow = /opus/.test(model) ? 200000 : 200000;
|
|
2999
|
+
const pctUsed = contextWindow > 0 ? Math.min(100, Math.round(inputTokens / contextWindow * 100)) : 0;
|
|
3000
|
+
const pricing = resolvePrice(model);
|
|
3001
|
+
const costUsd = pricing ? inputTokens / 1e6 * pricing[0] + outputTokens / 1e6 * pricing[1] : null;
|
|
3002
|
+
const providerLabel = provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
3003
|
+
const width = 36;
|
|
3004
|
+
const border = import_picocolors3.default.dim("─".repeat(width));
|
|
3005
|
+
console.log("");
|
|
3006
|
+
console.log(` ${import_picocolors3.default.dim(border)}`);
|
|
3007
|
+
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.bold("Context")}${" ".repeat(width - 9)}${import_picocolors3.default.dim("│")}`);
|
|
3008
|
+
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.cyan(totalTokens.toLocaleString())} ${import_picocolors3.default.dim("tokens")}${" ".repeat(Math.max(0, width - 2 - totalTokens.toLocaleString().length - 7))}${import_picocolors3.default.dim("│")}`);
|
|
3009
|
+
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.yellow(`${pctUsed}%`)} ${import_picocolors3.default.dim("of context window used")}${" ".repeat(Math.max(0, width - 2 - String(pctUsed).length - 1 - 22))}${import_picocolors3.default.dim("│")}`);
|
|
3010
|
+
if (costUsd !== null) {
|
|
3011
|
+
const costStr = formatCost(costUsd);
|
|
3012
|
+
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.green(costStr)} ${import_picocolors3.default.dim("spent")}${" ".repeat(Math.max(0, width - 2 - costStr.length - 6))}${import_picocolors3.default.dim("│")}`);
|
|
3013
|
+
}
|
|
3014
|
+
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.dim(`${providerLabel} · ${model}`)}${" ".repeat(Math.max(0, width - 2 - providerLabel.length - 3 - model.length))}${import_picocolors3.default.dim("│")}`);
|
|
3015
|
+
console.log(` ${import_picocolors3.default.dim(border)}`);
|
|
3016
|
+
console.log("");
|
|
3017
|
+
}
|
|
3018
|
+
function isModelNotSupportedError(err) {
|
|
3019
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
3020
|
+
return msg.includes("model is not supported") || msg.includes("model_not_found") || msg.includes("invalid model") || /4\d\d.*model/i.test(msg);
|
|
3021
|
+
}
|
|
3022
|
+
var import_picocolors3, MODEL_PRICING;
|
|
3023
|
+
var init_display = __esm(() => {
|
|
3024
|
+
init_dist2();
|
|
3025
|
+
import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
3026
|
+
MODEL_PRICING = {
|
|
3027
|
+
"claude-opus-4-5": [15, 75],
|
|
3028
|
+
"claude-opus-4": [15, 75],
|
|
3029
|
+
"claude-sonnet-4-5": [3, 15],
|
|
3030
|
+
"claude-sonnet-4": [3, 15],
|
|
3031
|
+
"claude-sonnet-4-20250514": [3, 15],
|
|
3032
|
+
"claude-3-7-sonnet-20250219": [3, 15],
|
|
3033
|
+
"claude-3-5-sonnet-20241022": [3, 15],
|
|
3034
|
+
"claude-3-5-haiku-20241022": [0.8, 4],
|
|
3035
|
+
"claude-haiku-4-5": [0.8, 4],
|
|
3036
|
+
"gpt-4o": [2.5, 10],
|
|
3037
|
+
"gpt-4o-mini": [0.15, 0.6],
|
|
3038
|
+
o3: [10, 40],
|
|
3039
|
+
"o4-mini": [1.1, 4.4],
|
|
3040
|
+
"gpt-4.1": [2, 8],
|
|
3041
|
+
"gemini-2.0-flash": [0.1, 0.4],
|
|
3042
|
+
"gemini-2.5-pro-preview-05-06": [1.25, 10]
|
|
3043
|
+
};
|
|
3044
|
+
});
|
|
3045
|
+
|
|
3046
|
+
// src/mcp/lifecycle.ts
|
|
3047
|
+
var exports_lifecycle = {};
|
|
3048
|
+
__export(exports_lifecycle, {
|
|
3049
|
+
spawnMcpServer: () => spawnMcpServer,
|
|
3050
|
+
shutdownMcpServer: () => shutdownMcpServer,
|
|
3051
|
+
isMcpServerRunning: () => isMcpServerRunning,
|
|
3052
|
+
getMcpServerProcess: () => getMcpServerProcess,
|
|
3053
|
+
findMcpEntryPoint: () => findMcpEntryPoint
|
|
3054
|
+
});
|
|
3055
|
+
import { spawn, execSync } from "node:child_process";
|
|
3056
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
3057
|
+
import { join as join2 } from "node:path";
|
|
3058
|
+
function findMcpEntryPoint() {
|
|
3059
|
+
try {
|
|
3060
|
+
const globalRoot = execSync("npm root -g", { encoding: "utf-8", stdio: "pipe" }).trim();
|
|
3061
|
+
const candidate = join2(globalRoot, "@railway", "mcp-server", "dist", "index.js");
|
|
3062
|
+
if (existsSync2(candidate))
|
|
3063
|
+
return candidate;
|
|
3064
|
+
} catch {}
|
|
3065
|
+
return null;
|
|
3066
|
+
}
|
|
3067
|
+
function formatExitDetail(code, signal) {
|
|
3068
|
+
const codeLabel = code === null ? "null" : String(code);
|
|
3069
|
+
const signalLabel = signal ?? "null";
|
|
3070
|
+
return `code=${codeLabel}, signal=${signalLabel}`;
|
|
3071
|
+
}
|
|
3072
|
+
function isChildRunning(child) {
|
|
3073
|
+
return child.exitCode === null && !child.killed;
|
|
3074
|
+
}
|
|
3075
|
+
function buildServerProcess(child) {
|
|
3076
|
+
if (!child.stdin || !child.stdout) {
|
|
3077
|
+
throw new Error("MCP server stdio was not created");
|
|
3078
|
+
}
|
|
3079
|
+
return {
|
|
3080
|
+
process: child,
|
|
3081
|
+
stdin: child.stdin,
|
|
3082
|
+
stdout: child.stdout,
|
|
3083
|
+
pid: child.pid ?? -1
|
|
3084
|
+
};
|
|
3085
|
+
}
|
|
3086
|
+
function attachLifecycleListeners(child) {
|
|
3087
|
+
child.stderr?.on("data", (chunk) => {
|
|
3088
|
+
const message = String(chunk).trim();
|
|
3089
|
+
if (!message) {
|
|
3090
|
+
return;
|
|
3091
|
+
}
|
|
3092
|
+
auditLogger.mcp("server-lifecycle", "stderr", "FAILED", message);
|
|
3093
|
+
});
|
|
3094
|
+
child.on("exit", (code, signal) => {
|
|
3095
|
+
const detail = formatExitDetail(code, signal);
|
|
3096
|
+
if (activeServer?.process === child) {
|
|
3097
|
+
activeServer = null;
|
|
3098
|
+
}
|
|
3099
|
+
if (intentionallyShuttingDown.has(child)) {
|
|
3100
|
+
return;
|
|
3101
|
+
}
|
|
3102
|
+
shouldLogRespawn = true;
|
|
3103
|
+
auditLogger.mcp("server-lifecycle", "crash", "FAILED", detail);
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3106
|
+
function displaySpawnFailure(reason) {
|
|
3107
|
+
error(MCP_START_FAILURE_MESSAGE);
|
|
3108
|
+
auditLogger.mcp("server-lifecycle", "spawn", "FAILED", reason);
|
|
3109
|
+
}
|
|
3110
|
+
async function spawnMcpServer() {
|
|
3111
|
+
if (activeServer && isChildRunning(activeServer.process)) {
|
|
3112
|
+
return activeServer;
|
|
3113
|
+
}
|
|
3114
|
+
if (pendingSpawn) {
|
|
3115
|
+
return pendingSpawn;
|
|
3116
|
+
}
|
|
3117
|
+
const entryPoint = findMcpEntryPoint();
|
|
3118
|
+
if (!entryPoint) {
|
|
3119
|
+
throw new Error(MCP_START_FAILURE_MESSAGE);
|
|
3120
|
+
}
|
|
3121
|
+
const respawn = shouldLogRespawn;
|
|
3122
|
+
const child = spawn("node", [entryPoint], {
|
|
3123
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
3124
|
+
});
|
|
3125
|
+
attachLifecycleListeners(child);
|
|
3126
|
+
pendingSpawn = new Promise((resolve, reject) => {
|
|
3127
|
+
const handleError = (spawnError) => {
|
|
3128
|
+
child.off("spawn", handleSpawn);
|
|
3129
|
+
if (activeServer?.process === child) {
|
|
3130
|
+
activeServer = null;
|
|
3131
|
+
}
|
|
3132
|
+
displaySpawnFailure(spawnError.message);
|
|
3133
|
+
reject(spawnError);
|
|
3134
|
+
};
|
|
3135
|
+
const handleSpawn = () => {
|
|
3136
|
+
child.off("error", handleError);
|
|
3137
|
+
let serverProcess;
|
|
3138
|
+
try {
|
|
3139
|
+
serverProcess = buildServerProcess(child);
|
|
3140
|
+
} catch (buildError) {
|
|
3141
|
+
const err = buildError instanceof Error ? buildError : new Error(String(buildError));
|
|
3142
|
+
displaySpawnFailure(err.message);
|
|
3143
|
+
reject(err);
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
3146
|
+
activeServer = serverProcess;
|
|
3147
|
+
shouldLogRespawn = false;
|
|
3148
|
+
if (respawn) {
|
|
3149
|
+
auditLogger.mcp("server-lifecycle", "respawn", "SUCCESS", `pid=${serverProcess.pid}`);
|
|
3150
|
+
} else {
|
|
3151
|
+
auditLogger.mcp("server-lifecycle", "spawn", "SUCCESS", `pid=${serverProcess.pid}`);
|
|
3152
|
+
}
|
|
3153
|
+
resolve(serverProcess);
|
|
3154
|
+
};
|
|
3155
|
+
child.once("error", handleError);
|
|
3156
|
+
child.once("spawn", handleSpawn);
|
|
3157
|
+
}).finally(() => {
|
|
3158
|
+
pendingSpawn = null;
|
|
3159
|
+
});
|
|
3160
|
+
return pendingSpawn;
|
|
3161
|
+
}
|
|
3162
|
+
function getMcpServerProcess() {
|
|
3163
|
+
if (!activeServer) {
|
|
3164
|
+
return null;
|
|
3165
|
+
}
|
|
3166
|
+
if (!isChildRunning(activeServer.process)) {
|
|
3167
|
+
activeServer = null;
|
|
3168
|
+
return null;
|
|
3169
|
+
}
|
|
3170
|
+
return activeServer;
|
|
3171
|
+
}
|
|
3172
|
+
function isMcpServerRunning() {
|
|
3173
|
+
return getMcpServerProcess() !== null;
|
|
3174
|
+
}
|
|
3175
|
+
async function shutdownMcpServer() {
|
|
3176
|
+
if (!activeServer) {
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
const child = activeServer.process;
|
|
3180
|
+
intentionallyShuttingDown.add(child);
|
|
3181
|
+
if (!isChildRunning(child)) {
|
|
3182
|
+
activeServer = null;
|
|
3183
|
+
return;
|
|
3184
|
+
}
|
|
3185
|
+
const exitPromise = new Promise((resolve) => {
|
|
3186
|
+
child.once("exit", (code, signal) => {
|
|
3187
|
+
resolve({ code, signal });
|
|
3188
|
+
});
|
|
3189
|
+
});
|
|
3190
|
+
child.kill("SIGTERM");
|
|
3191
|
+
let forcedKill = false;
|
|
3192
|
+
const timeoutHandle = setTimeout(() => {
|
|
3193
|
+
forcedKill = true;
|
|
3194
|
+
child.kill("SIGKILL");
|
|
3195
|
+
}, SHUTDOWN_TIMEOUT_MS);
|
|
3196
|
+
const exitResult = await exitPromise;
|
|
3197
|
+
clearTimeout(timeoutHandle);
|
|
3198
|
+
activeServer = null;
|
|
3199
|
+
const detail = forcedKill ? `forced after timeout (${formatExitDetail(exitResult.code, exitResult.signal)})` : formatExitDetail(exitResult.code, exitResult.signal);
|
|
3200
|
+
auditLogger.mcp("server-lifecycle", "shutdown", "SUCCESS", detail);
|
|
3201
|
+
}
|
|
3202
|
+
var MCP_START_FAILURE_MESSAGE = "Railway MCP Server not found. Install it: npm install -g @railway/mcp-server", SHUTDOWN_TIMEOUT_MS = 5000, auditLogger, activeServer = null, pendingSpawn = null, shouldLogRespawn = false, intentionallyShuttingDown;
|
|
3203
|
+
var init_lifecycle = __esm(() => {
|
|
3204
|
+
init_logger();
|
|
3205
|
+
init_display();
|
|
3206
|
+
auditLogger = createAuditLogger(".");
|
|
3207
|
+
intentionallyShuttingDown = new WeakSet;
|
|
3208
|
+
});
|
|
3209
|
+
|
|
2253
3210
|
// src/credentials/encryption.ts
|
|
2254
3211
|
import { execSync as execSync2 } from "node:child_process";
|
|
2255
3212
|
import {
|
|
@@ -2631,11 +3588,15 @@ function readConfig() {
|
|
|
2631
3588
|
if (raw.length === 0) {
|
|
2632
3589
|
return {};
|
|
2633
3590
|
}
|
|
2634
|
-
|
|
2635
|
-
|
|
3591
|
+
try {
|
|
3592
|
+
const parsed = JSON.parse(raw);
|
|
3593
|
+
if (!parsed || typeof parsed !== "object") {
|
|
3594
|
+
return {};
|
|
3595
|
+
}
|
|
3596
|
+
return parsed;
|
|
3597
|
+
} catch {
|
|
2636
3598
|
return {};
|
|
2637
3599
|
}
|
|
2638
|
-
return parsed;
|
|
2639
3600
|
}
|
|
2640
3601
|
function writeConfig(config) {
|
|
2641
3602
|
ensureConfigDir();
|
|
@@ -2814,8 +3775,7 @@ async function refreshCopilotToken(githubToken) {
|
|
|
2814
3775
|
throw new Error(`Copilot token exchange failed: network error — ${err instanceof Error ? err.message : String(err)}`);
|
|
2815
3776
|
}
|
|
2816
3777
|
if (!res.ok) {
|
|
2817
|
-
|
|
2818
|
-
throw new Error(`Copilot token exchange failed (HTTP ${res.status}): ${body.slice(0, 300)}`);
|
|
3778
|
+
throw new Error(`Copilot token exchange failed (HTTP ${res.status})`);
|
|
2819
3779
|
}
|
|
2820
3780
|
const data = await res.json();
|
|
2821
3781
|
if (typeof data.token !== "string" || typeof data.expires_at !== "number") {
|
|
@@ -2824,6 +3784,9 @@ async function refreshCopilotToken(githubToken) {
|
|
|
2824
3784
|
return { token: data.token, expiresAt: data.expires_at * 1000 };
|
|
2825
3785
|
}
|
|
2826
3786
|
async function getCopilotToken() {
|
|
3787
|
+
if (pendingCopilotRefresh) {
|
|
3788
|
+
return pendingCopilotRefresh;
|
|
3789
|
+
}
|
|
2827
3790
|
const config = readConfig();
|
|
2828
3791
|
const llm = getStoredLlm(config);
|
|
2829
3792
|
if (!llm || llm.authType !== "github-copilot") {
|
|
@@ -2836,24 +3799,29 @@ async function getCopilotToken() {
|
|
|
2836
3799
|
if (Date.now() < stored.copilotTokenExpiresAt - 60000) {
|
|
2837
3800
|
return decrypted.copilotToken;
|
|
2838
3801
|
}
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
const encCopilot = await encrypt(refreshed.token);
|
|
2846
|
-
writeConfig({
|
|
2847
|
-
llm: {
|
|
2848
|
-
...stored,
|
|
2849
|
-
copilotToken: encCopilot.encrypted,
|
|
2850
|
-
copilotIv: encCopilot.iv,
|
|
2851
|
-
copilotSalt: encCopilot.salt,
|
|
2852
|
-
copilotAuthTag: encCopilot.authTag,
|
|
2853
|
-
copilotTokenExpiresAt: refreshed.expiresAt
|
|
3802
|
+
pendingCopilotRefresh = (async () => {
|
|
3803
|
+
let refreshed;
|
|
3804
|
+
try {
|
|
3805
|
+
refreshed = await refreshCopilotToken(decrypted.githubToken);
|
|
3806
|
+
} catch {
|
|
3807
|
+
return null;
|
|
2854
3808
|
}
|
|
3809
|
+
const encCopilot = await encrypt(refreshed.token);
|
|
3810
|
+
writeConfig({
|
|
3811
|
+
llm: {
|
|
3812
|
+
...stored,
|
|
3813
|
+
copilotToken: encCopilot.encrypted,
|
|
3814
|
+
copilotIv: encCopilot.iv,
|
|
3815
|
+
copilotSalt: encCopilot.salt,
|
|
3816
|
+
copilotAuthTag: encCopilot.authTag,
|
|
3817
|
+
copilotTokenExpiresAt: refreshed.expiresAt
|
|
3818
|
+
}
|
|
3819
|
+
});
|
|
3820
|
+
return refreshed.token;
|
|
3821
|
+
})().finally(() => {
|
|
3822
|
+
pendingCopilotRefresh = null;
|
|
2855
3823
|
});
|
|
2856
|
-
return
|
|
3824
|
+
return pendingCopilotRefresh;
|
|
2857
3825
|
}
|
|
2858
3826
|
async function exchangeCopilotToken(githubToken) {
|
|
2859
3827
|
return refreshCopilotToken(githubToken);
|
|
@@ -2910,7 +3878,7 @@ async function isLlmConfigured() {
|
|
|
2910
3878
|
const apiKey = await getLlmApiKey();
|
|
2911
3879
|
return apiKey !== null;
|
|
2912
3880
|
}
|
|
2913
|
-
var CONFIG_DIR, CONFIG_FILE, KEYCHAIN_API_KEY = "llm-api-key", DIR_MODE = 448, FILE_MODE = 384, SHARED_MODEL_MIGRATIONS, COPILOT_MODEL_MIGRATIONS, COPILOT_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token";
|
|
3881
|
+
var CONFIG_DIR, CONFIG_FILE, KEYCHAIN_API_KEY = "llm-api-key", DIR_MODE = 448, FILE_MODE = 384, SHARED_MODEL_MIGRATIONS, COPILOT_MODEL_MIGRATIONS, COPILOT_TOKEN_URL = "https://api.github.com/copilot_internal/v2/token", pendingCopilotRefresh = null;
|
|
2914
3882
|
var init_config = __esm(() => {
|
|
2915
3883
|
init_encryption();
|
|
2916
3884
|
init_keychain();
|
|
@@ -2924,9 +3892,13 @@ var init_config = __esm(() => {
|
|
|
2924
3892
|
"o4-mini": "gpt-4.1"
|
|
2925
3893
|
};
|
|
2926
3894
|
COPILOT_MODEL_MIGRATIONS = {
|
|
2927
|
-
"claude-sonnet-4-5": "claude-
|
|
3895
|
+
"claude-sonnet-4-5": "claude-haiku-4.5",
|
|
2928
3896
|
"claude-haiku-4-5": "claude-haiku-4.5",
|
|
2929
|
-
"claude-opus-4-5": "claude-
|
|
3897
|
+
"claude-opus-4-5": "claude-haiku-4.5",
|
|
3898
|
+
"claude-sonnet-4": "claude-haiku-4.5",
|
|
3899
|
+
"claude-sonnet-4.5": "claude-haiku-4.5",
|
|
3900
|
+
"claude-opus-4.5": "claude-haiku-4.5",
|
|
3901
|
+
"gemini-2.5-pro": "gpt-4.1"
|
|
2930
3902
|
};
|
|
2931
3903
|
});
|
|
2932
3904
|
|
|
@@ -3122,7 +4094,7 @@ var init_values = __esm(() => {
|
|
|
3122
4094
|
});
|
|
3123
4095
|
|
|
3124
4096
|
// node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs
|
|
3125
|
-
var sleep = (ms) => new Promise((
|
|
4097
|
+
var sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
3126
4098
|
|
|
3127
4099
|
// node_modules/@anthropic-ai/sdk/version.mjs
|
|
3128
4100
|
var VERSION = "0.66.0";
|
|
@@ -3816,8 +4788,8 @@ var init_api_promise = __esm(() => {
|
|
|
3816
4788
|
init_parse();
|
|
3817
4789
|
APIPromise = class APIPromise extends Promise {
|
|
3818
4790
|
constructor(client, responsePromise, parseResponse = defaultParseResponse) {
|
|
3819
|
-
super((
|
|
3820
|
-
|
|
4791
|
+
super((resolve3) => {
|
|
4792
|
+
resolve3(null);
|
|
3821
4793
|
});
|
|
3822
4794
|
this.responsePromise = responsePromise;
|
|
3823
4795
|
this.parseResponse = parseResponse;
|
|
@@ -4720,12 +5692,12 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
4720
5692
|
}
|
|
4721
5693
|
return this._emit("error", new AnthropicError(String(error3)));
|
|
4722
5694
|
});
|
|
4723
|
-
__classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((
|
|
4724
|
-
__classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise,
|
|
5695
|
+
__classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve3, reject) => {
|
|
5696
|
+
__classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve3, "f");
|
|
4725
5697
|
__classPrivateFieldSet(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
|
|
4726
5698
|
}), "f");
|
|
4727
|
-
__classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((
|
|
4728
|
-
__classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise,
|
|
5699
|
+
__classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve3, reject) => {
|
|
5700
|
+
__classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve3, "f");
|
|
4729
5701
|
__classPrivateFieldSet(this, _BetaMessageStream_rejectEndPromise, reject, "f");
|
|
4730
5702
|
}), "f");
|
|
4731
5703
|
__classPrivateFieldGet(this, _BetaMessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -4842,11 +5814,11 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
4842
5814
|
return this;
|
|
4843
5815
|
}
|
|
4844
5816
|
emitted(event) {
|
|
4845
|
-
return new Promise((
|
|
5817
|
+
return new Promise((resolve3, reject) => {
|
|
4846
5818
|
__classPrivateFieldSet(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
|
|
4847
5819
|
if (event !== "error")
|
|
4848
5820
|
this.once("error", reject);
|
|
4849
|
-
this.once(event,
|
|
5821
|
+
this.once(event, resolve3);
|
|
4850
5822
|
});
|
|
4851
5823
|
}
|
|
4852
5824
|
async done() {
|
|
@@ -5161,7 +6133,7 @@ var init_BetaMessageStream = __esm(() => {
|
|
|
5161
6133
|
if (done) {
|
|
5162
6134
|
return { value: undefined, done: true };
|
|
5163
6135
|
}
|
|
5164
|
-
return new Promise((
|
|
6136
|
+
return new Promise((resolve3, reject) => readQueue.push({ resolve: resolve3, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
5165
6137
|
}
|
|
5166
6138
|
const chunk = pushQueue.shift();
|
|
5167
6139
|
return { value: chunk, done: false };
|
|
@@ -5196,13 +6168,13 @@ var init_constants = __esm(() => {
|
|
|
5196
6168
|
|
|
5197
6169
|
// node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs
|
|
5198
6170
|
function promiseWithResolvers() {
|
|
5199
|
-
let
|
|
6171
|
+
let resolve3;
|
|
5200
6172
|
let reject;
|
|
5201
6173
|
const promise = new Promise((res, rej) => {
|
|
5202
|
-
|
|
6174
|
+
resolve3 = res;
|
|
5203
6175
|
reject = rej;
|
|
5204
6176
|
});
|
|
5205
|
-
return { promise, resolve:
|
|
6177
|
+
return { promise, resolve: resolve3, reject };
|
|
5206
6178
|
}
|
|
5207
6179
|
async function generateToolResponse(params, lastMessage = params.messages.at(-1)) {
|
|
5208
6180
|
if (!lastMessage || lastMessage.role !== "assistant" || !lastMessage.content || typeof lastMessage.content === "string") {
|
|
@@ -5546,12 +6518,12 @@ var init_MessageStream = __esm(() => {
|
|
|
5546
6518
|
}
|
|
5547
6519
|
return this._emit("error", new AnthropicError(String(error3)));
|
|
5548
6520
|
});
|
|
5549
|
-
__classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((
|
|
5550
|
-
__classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise,
|
|
6521
|
+
__classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve3, reject) => {
|
|
6522
|
+
__classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve3, "f");
|
|
5551
6523
|
__classPrivateFieldSet(this, _MessageStream_rejectConnectedPromise, reject, "f");
|
|
5552
6524
|
}), "f");
|
|
5553
|
-
__classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((
|
|
5554
|
-
__classPrivateFieldSet(this, _MessageStream_resolveEndPromise,
|
|
6525
|
+
__classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve3, reject) => {
|
|
6526
|
+
__classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve3, "f");
|
|
5555
6527
|
__classPrivateFieldSet(this, _MessageStream_rejectEndPromise, reject, "f");
|
|
5556
6528
|
}), "f");
|
|
5557
6529
|
__classPrivateFieldGet(this, _MessageStream_connectedPromise, "f").catch(() => {});
|
|
@@ -5668,11 +6640,11 @@ var init_MessageStream = __esm(() => {
|
|
|
5668
6640
|
return this;
|
|
5669
6641
|
}
|
|
5670
6642
|
emitted(event) {
|
|
5671
|
-
return new Promise((
|
|
6643
|
+
return new Promise((resolve3, reject) => {
|
|
5672
6644
|
__classPrivateFieldSet(this, _MessageStream_catchingPromiseCreated, true, "f");
|
|
5673
6645
|
if (event !== "error")
|
|
5674
6646
|
this.once("error", reject);
|
|
5675
|
-
this.once(event,
|
|
6647
|
+
this.once(event, resolve3);
|
|
5676
6648
|
});
|
|
5677
6649
|
}
|
|
5678
6650
|
async done() {
|
|
@@ -5980,7 +6952,7 @@ var init_MessageStream = __esm(() => {
|
|
|
5980
6952
|
if (done) {
|
|
5981
6953
|
return { value: undefined, done: true };
|
|
5982
6954
|
}
|
|
5983
|
-
return new Promise((
|
|
6955
|
+
return new Promise((resolve3, reject) => readQueue.push({ resolve: resolve3, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
5984
6956
|
}
|
|
5985
6957
|
const chunk = pushQueue.shift();
|
|
5986
6958
|
return { value: chunk, done: false };
|
|
@@ -6835,7 +7807,7 @@ var init_values2 = __esm(() => {
|
|
|
6835
7807
|
});
|
|
6836
7808
|
|
|
6837
7809
|
// node_modules/openai/internal/utils/sleep.mjs
|
|
6838
|
-
var sleep2 = (ms) => new Promise((
|
|
7810
|
+
var sleep2 = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
6839
7811
|
|
|
6840
7812
|
// node_modules/openai/version.mjs
|
|
6841
7813
|
var VERSION2 = "6.22.0";
|
|
@@ -7862,8 +8834,8 @@ var init_api_promise2 = __esm(() => {
|
|
|
7862
8834
|
init_parse2();
|
|
7863
8835
|
APIPromise2 = class APIPromise2 extends Promise {
|
|
7864
8836
|
constructor(client, responsePromise, parseResponse = defaultParseResponse2) {
|
|
7865
|
-
super((
|
|
7866
|
-
|
|
8837
|
+
super((resolve3) => {
|
|
8838
|
+
resolve3(null);
|
|
7867
8839
|
});
|
|
7868
8840
|
this.responsePromise = responsePromise;
|
|
7869
8841
|
this.parseResponse = parseResponse;
|
|
@@ -8388,12 +9360,12 @@ class EventStream {
|
|
|
8388
9360
|
_EventStream_errored.set(this, false);
|
|
8389
9361
|
_EventStream_aborted.set(this, false);
|
|
8390
9362
|
_EventStream_catchingPromiseCreated.set(this, false);
|
|
8391
|
-
__classPrivateFieldSet2(this, _EventStream_connectedPromise, new Promise((
|
|
8392
|
-
__classPrivateFieldSet2(this, _EventStream_resolveConnectedPromise,
|
|
9363
|
+
__classPrivateFieldSet2(this, _EventStream_connectedPromise, new Promise((resolve3, reject) => {
|
|
9364
|
+
__classPrivateFieldSet2(this, _EventStream_resolveConnectedPromise, resolve3, "f");
|
|
8393
9365
|
__classPrivateFieldSet2(this, _EventStream_rejectConnectedPromise, reject, "f");
|
|
8394
9366
|
}), "f");
|
|
8395
|
-
__classPrivateFieldSet2(this, _EventStream_endPromise, new Promise((
|
|
8396
|
-
__classPrivateFieldSet2(this, _EventStream_resolveEndPromise,
|
|
9367
|
+
__classPrivateFieldSet2(this, _EventStream_endPromise, new Promise((resolve3, reject) => {
|
|
9368
|
+
__classPrivateFieldSet2(this, _EventStream_resolveEndPromise, resolve3, "f");
|
|
8397
9369
|
__classPrivateFieldSet2(this, _EventStream_rejectEndPromise, reject, "f");
|
|
8398
9370
|
}), "f");
|
|
8399
9371
|
__classPrivateFieldGet2(this, _EventStream_connectedPromise, "f").catch(() => {});
|
|
@@ -8445,11 +9417,11 @@ class EventStream {
|
|
|
8445
9417
|
return this;
|
|
8446
9418
|
}
|
|
8447
9419
|
emitted(event) {
|
|
8448
|
-
return new Promise((
|
|
9420
|
+
return new Promise((resolve3, reject) => {
|
|
8449
9421
|
__classPrivateFieldSet2(this, _EventStream_catchingPromiseCreated, true, "f");
|
|
8450
9422
|
if (event !== "error")
|
|
8451
9423
|
this.once("error", reject);
|
|
8452
|
-
this.once(event,
|
|
9424
|
+
this.once(event, resolve3);
|
|
8453
9425
|
});
|
|
8454
9426
|
}
|
|
8455
9427
|
async done() {
|
|
@@ -9456,7 +10428,7 @@ var init_ChatCompletionStream = __esm(() => {
|
|
|
9456
10428
|
if (done) {
|
|
9457
10429
|
return { value: undefined, done: true };
|
|
9458
10430
|
}
|
|
9459
|
-
return new Promise((
|
|
10431
|
+
return new Promise((resolve3, reject) => readQueue.push({ resolve: resolve3, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
9460
10432
|
}
|
|
9461
10433
|
const chunk = pushQueue.shift();
|
|
9462
10434
|
return { value: chunk, done: false };
|
|
@@ -10072,7 +11044,7 @@ var init_AssistantStream = __esm(() => {
|
|
|
10072
11044
|
if (done) {
|
|
10073
11045
|
return { value: undefined, done: true };
|
|
10074
11046
|
}
|
|
10075
|
-
return new Promise((
|
|
11047
|
+
return new Promise((resolve3, reject) => readQueue.push({ resolve: resolve3, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: undefined, done: true });
|
|
10076
11048
|
}
|
|
10077
11049
|
const chunk = pushQueue.shift();
|
|
10078
11050
|
return { value: chunk, done: false };
|
|
@@ -11696,7 +12668,7 @@ var init_ResponseStream = __esm(() => {
|
|
|
11696
12668
|
if (done) {
|
|
11697
12669
|
return { value: undefined, done: true };
|
|
11698
12670
|
}
|
|
11699
|
-
return new Promise((
|
|
12671
|
+
return new Promise((resolve3, reject) => readQueue.push({ resolve: resolve3, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: undefined, done: true });
|
|
11700
12672
|
}
|
|
11701
12673
|
const event = pushQueue.shift();
|
|
11702
12674
|
return { value: event, done: false };
|
|
@@ -13750,7 +14722,7 @@ class GoogleGenerativeAI {
|
|
|
13750
14722
|
}
|
|
13751
14723
|
}
|
|
13752
14724
|
var SchemaType, ExecutableCodeLanguage, Outcome, POSSIBLE_ROLES, HarmCategory, HarmBlockThreshold, HarmProbability, BlockReason, FinishReason, TaskType, FunctionCallingMode, DynamicRetrievalMode, GoogleGenerativeAIError, GoogleGenerativeAIResponseError, GoogleGenerativeAIFetchError, GoogleGenerativeAIRequestInputError, GoogleGenerativeAIAbortError, DEFAULT_BASE_URL = "https://generativelanguage.googleapis.com", DEFAULT_API_VERSION = "v1beta", PACKAGE_VERSION = "0.24.1", PACKAGE_LOG_HEADER = "genai-js", Task, badFinishReasons, responseLineRE, VALID_PART_FIELDS, VALID_PARTS_PER_ROLE, SILENT_ERROR = "SILENT_ERROR";
|
|
13753
|
-
var
|
|
14725
|
+
var init_dist3 = __esm(() => {
|
|
13754
14726
|
(function(SchemaType2) {
|
|
13755
14727
|
SchemaType2["STRING"] = "string";
|
|
13756
14728
|
SchemaType2["NUMBER"] = "number";
|
|
@@ -113923,14 +114895,14 @@ ${lanes.join(`
|
|
|
113923
114895
|
}
|
|
113924
114896
|
}
|
|
113925
114897
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
113926
|
-
const
|
|
114898
|
+
const resolve5 = factory2.createUniqueName("resolve");
|
|
113927
114899
|
const reject = factory2.createUniqueName("reject");
|
|
113928
114900
|
const parameters = [
|
|
113929
|
-
factory2.createParameterDeclaration(undefined, undefined,
|
|
114901
|
+
factory2.createParameterDeclaration(undefined, undefined, resolve5),
|
|
113930
114902
|
factory2.createParameterDeclaration(undefined, undefined, reject)
|
|
113931
114903
|
];
|
|
113932
114904
|
const body = factory2.createBlock([
|
|
113933
|
-
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
114905
|
+
factory2.createExpressionStatement(factory2.createCallExpression(factory2.createIdentifier("require"), undefined, [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve5, reject]))
|
|
113934
114906
|
]);
|
|
113935
114907
|
let func;
|
|
113936
114908
|
if (languageVersion >= 2) {
|
|
@@ -184110,8 +185082,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
184110
185082
|
installPackage(options) {
|
|
184111
185083
|
this.packageInstallId++;
|
|
184112
185084
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
184113
|
-
const promise = new Promise((
|
|
184114
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve:
|
|
185085
|
+
const promise = new Promise((resolve5, reject) => {
|
|
185086
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map)).set(this.packageInstallId, { resolve: resolve5, reject });
|
|
184115
185087
|
});
|
|
184116
185088
|
this.installer.send(request);
|
|
184117
185089
|
return promise;
|
|
@@ -185967,7 +186939,7 @@ var require_path_browserify = __commonJS((exports, module) => {
|
|
|
185967
186939
|
return dir + sep + base;
|
|
185968
186940
|
}
|
|
185969
186941
|
var posix = {
|
|
185970
|
-
resolve: function
|
|
186942
|
+
resolve: function resolve5() {
|
|
185971
186943
|
var resolvedPath = "";
|
|
185972
186944
|
var resolvedAbsolute = false;
|
|
185973
186945
|
var cwd;
|
|
@@ -231623,12 +232595,12 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231623
232595
|
|
|
231624
232596
|
class NodeRuntimeFileSystem {
|
|
231625
232597
|
delete(path4) {
|
|
231626
|
-
return new Promise((
|
|
232598
|
+
return new Promise((resolve5, reject) => {
|
|
231627
232599
|
fs__namespace.rm(path4, { recursive: true }, (err) => {
|
|
231628
232600
|
if (err)
|
|
231629
232601
|
reject(err);
|
|
231630
232602
|
else
|
|
231631
|
-
|
|
232603
|
+
resolve5();
|
|
231632
232604
|
});
|
|
231633
232605
|
});
|
|
231634
232606
|
}
|
|
@@ -231647,12 +232619,12 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231647
232619
|
}));
|
|
231648
232620
|
}
|
|
231649
232621
|
readFile(filePath, encoding = "utf-8") {
|
|
231650
|
-
return new Promise((
|
|
232622
|
+
return new Promise((resolve5, reject) => {
|
|
231651
232623
|
fs__namespace.readFile(filePath, encoding, (err, data) => {
|
|
231652
232624
|
if (err)
|
|
231653
232625
|
reject(err);
|
|
231654
232626
|
else
|
|
231655
|
-
|
|
232627
|
+
resolve5(data);
|
|
231656
232628
|
});
|
|
231657
232629
|
});
|
|
231658
232630
|
}
|
|
@@ -231660,12 +232632,12 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231660
232632
|
return fs__namespace.readFileSync(filePath, encoding);
|
|
231661
232633
|
}
|
|
231662
232634
|
async writeFile(filePath, fileText) {
|
|
231663
|
-
await new Promise((
|
|
232635
|
+
await new Promise((resolve5, reject) => {
|
|
231664
232636
|
fs__namespace.writeFile(filePath, fileText, (err) => {
|
|
231665
232637
|
if (err)
|
|
231666
232638
|
reject(err);
|
|
231667
232639
|
else
|
|
231668
|
-
|
|
232640
|
+
resolve5();
|
|
231669
232641
|
});
|
|
231670
232642
|
});
|
|
231671
232643
|
}
|
|
@@ -231679,12 +232651,12 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231679
232651
|
fs__namespace.mkdirSync(dirPath, { recursive: true });
|
|
231680
232652
|
}
|
|
231681
232653
|
move(srcPath, destPath) {
|
|
231682
|
-
return new Promise((
|
|
232654
|
+
return new Promise((resolve5, reject) => {
|
|
231683
232655
|
fs__namespace.rename(srcPath, destPath, (err) => {
|
|
231684
232656
|
if (err)
|
|
231685
232657
|
reject(err);
|
|
231686
232658
|
else
|
|
231687
|
-
|
|
232659
|
+
resolve5();
|
|
231688
232660
|
});
|
|
231689
232661
|
});
|
|
231690
232662
|
}
|
|
@@ -231692,12 +232664,12 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231692
232664
|
fs__namespace.renameSync(srcPath, destPath);
|
|
231693
232665
|
}
|
|
231694
232666
|
copy(srcPath, destPath) {
|
|
231695
|
-
return new Promise((
|
|
232667
|
+
return new Promise((resolve5, reject) => {
|
|
231696
232668
|
fs__namespace.copyFile(srcPath, destPath, (err) => {
|
|
231697
232669
|
if (err)
|
|
231698
232670
|
reject(err);
|
|
231699
232671
|
else
|
|
231700
|
-
|
|
232672
|
+
resolve5();
|
|
231701
232673
|
});
|
|
231702
232674
|
});
|
|
231703
232675
|
}
|
|
@@ -231705,15 +232677,15 @@ interface CSSNumericArray{[Symbol.iterator]():ArrayIterator<CSSNumericValue>;ent
|
|
|
231705
232677
|
fs__namespace.copyFileSync(srcPath, destPath);
|
|
231706
232678
|
}
|
|
231707
232679
|
stat(path4) {
|
|
231708
|
-
return new Promise((
|
|
232680
|
+
return new Promise((resolve5, reject) => {
|
|
231709
232681
|
fs__namespace.stat(path4, (err, stat) => {
|
|
231710
232682
|
if (err) {
|
|
231711
232683
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
|
231712
|
-
|
|
232684
|
+
resolve5(undefined);
|
|
231713
232685
|
else
|
|
231714
232686
|
reject(err);
|
|
231715
232687
|
} else {
|
|
231716
|
-
|
|
232688
|
+
resolve5(stat);
|
|
231717
232689
|
}
|
|
231718
232690
|
});
|
|
231719
232691
|
});
|
|
@@ -255742,982 +256714,18 @@ var {
|
|
|
255742
256714
|
} = import__.default;
|
|
255743
256715
|
|
|
255744
256716
|
// src/cli.ts
|
|
255745
|
-
var
|
|
256717
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
255746
256718
|
import { createInterface, emitKeypressEvents } from "node:readline";
|
|
255747
256719
|
import { stdin as input, stdout as output } from "node:process";
|
|
255748
|
-
import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync15, realpathSync } from "node:fs";
|
|
256720
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync15, writeFileSync as writeFileSync15, realpathSync as realpathSync2 } from "node:fs";
|
|
255749
256721
|
import { homedir as homedir6 } from "node:os";
|
|
255750
|
-
import { join as join24, resolve as
|
|
256722
|
+
import { join as join24, resolve as resolve7, dirname as dirname5 } from "node:path";
|
|
255751
256723
|
import { pathToFileURL } from "node:url";
|
|
255752
256724
|
|
|
255753
256725
|
// src/utils/prerequisites.ts
|
|
255754
|
-
|
|
255755
|
-
|
|
255756
|
-
// src/mcp/lifecycle.ts
|
|
255757
|
-
import { spawn, execSync } from "node:child_process";
|
|
255758
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
255759
|
-
import { join as join2 } from "node:path";
|
|
255760
|
-
|
|
255761
|
-
// src/audit/logger.ts
|
|
255762
|
-
import {
|
|
255763
|
-
appendFileSync,
|
|
255764
|
-
existsSync,
|
|
255765
|
-
mkdirSync,
|
|
255766
|
-
renameSync,
|
|
255767
|
-
rmSync,
|
|
255768
|
-
statSync,
|
|
255769
|
-
writeFileSync
|
|
255770
|
-
} from "node:fs";
|
|
255771
|
-
import { join } from "node:path";
|
|
255772
|
-
var AUDIT_DIR_NAME = ".kitt";
|
|
255773
|
-
var AUDIT_FILE_NAME = "audit.log";
|
|
255774
|
-
var ROTATED_LOG_1 = "audit.log.1";
|
|
255775
|
-
var ROTATED_LOG_2 = "audit.log.2";
|
|
255776
|
-
var MAX_LOG_SIZE_BYTES = 10 * 1024 * 1024;
|
|
255777
|
-
function formatLine(type, message) {
|
|
255778
|
-
return `[${new Date().toISOString()}] ${type} ${message}
|
|
255779
|
-
`;
|
|
255780
|
-
}
|
|
255781
|
-
function ensureAuditDir(auditDir) {
|
|
255782
|
-
if (existsSync(auditDir)) {
|
|
255783
|
-
return;
|
|
255784
|
-
}
|
|
255785
|
-
mkdirSync(auditDir, { recursive: true, mode: 448 });
|
|
255786
|
-
}
|
|
255787
|
-
function rotateLogIfNeeded(logPath, log1Path, log2Path) {
|
|
255788
|
-
if (!existsSync(logPath)) {
|
|
255789
|
-
return;
|
|
255790
|
-
}
|
|
255791
|
-
const stats = statSync(logPath);
|
|
255792
|
-
if (stats.size < MAX_LOG_SIZE_BYTES) {
|
|
255793
|
-
return;
|
|
255794
|
-
}
|
|
255795
|
-
if (existsSync(log2Path)) {
|
|
255796
|
-
rmSync(log2Path, { force: true });
|
|
255797
|
-
}
|
|
255798
|
-
if (existsSync(log1Path)) {
|
|
255799
|
-
renameSync(log1Path, log2Path);
|
|
255800
|
-
}
|
|
255801
|
-
renameSync(logPath, log1Path);
|
|
255802
|
-
writeFileSync(logPath, "", { encoding: "utf8", mode: 384 });
|
|
255803
|
-
}
|
|
255804
|
-
function writeAuditLine(logPath, log1Path, log2Path, type, message) {
|
|
255805
|
-
try {
|
|
255806
|
-
rotateLogIfNeeded(logPath, log1Path, log2Path);
|
|
255807
|
-
appendFileSync(logPath, formatLine(type, message), { encoding: "utf8", mode: 384 });
|
|
255808
|
-
} catch {
|
|
255809
|
-
return;
|
|
255810
|
-
}
|
|
255811
|
-
}
|
|
255812
|
-
function createAuditLogger(workspaceDir) {
|
|
255813
|
-
const auditDir = join(workspaceDir, AUDIT_DIR_NAME);
|
|
255814
|
-
const logPath = join(auditDir, AUDIT_FILE_NAME);
|
|
255815
|
-
const log1Path = join(auditDir, ROTATED_LOG_1);
|
|
255816
|
-
const log2Path = join(auditDir, ROTATED_LOG_2);
|
|
255817
|
-
return {
|
|
255818
|
-
log(type, message) {
|
|
255819
|
-
try {
|
|
255820
|
-
ensureAuditDir(auditDir);
|
|
255821
|
-
} catch {
|
|
255822
|
-
return;
|
|
255823
|
-
}
|
|
255824
|
-
writeAuditLine(logPath, log1Path, log2Path, type, message);
|
|
255825
|
-
},
|
|
255826
|
-
cmd(command, status, detail) {
|
|
255827
|
-
const suffix = detail ? ` (${detail})` : "";
|
|
255828
|
-
this.log("CMD", `${command} → ${status}${suffix}`);
|
|
255829
|
-
},
|
|
255830
|
-
cmdExec(command, status) {
|
|
255831
|
-
this.log("CMD_EXEC", `${command} → ${status}`);
|
|
255832
|
-
},
|
|
255833
|
-
mcp(tool, params, status, detail) {
|
|
255834
|
-
const suffix = detail ? ` (${detail})` : "";
|
|
255835
|
-
this.log("MCP", `${tool} (${params}) → ${status}${suffix}`);
|
|
255836
|
-
},
|
|
255837
|
-
llmCall(provider, model, promptVersion, estimatedTokens, status) {
|
|
255838
|
-
this.log("LLM_CALL", `${provider}/${model} (prompt: ${promptVersion}, est. ${estimatedTokens} tokens) → ${status}`);
|
|
255839
|
-
},
|
|
255840
|
-
fileWrite(path, hash) {
|
|
255841
|
-
const suffix = hash ? ` (SHA-256: ${hash})` : "";
|
|
255842
|
-
this.log("FILE_WRITE", `${path}${suffix}`);
|
|
255843
|
-
},
|
|
255844
|
-
staged(path, detail) {
|
|
255845
|
-
this.log("STAGED", `${path} (${detail})`);
|
|
255846
|
-
},
|
|
255847
|
-
userConfirmed() {
|
|
255848
|
-
this.log("USER_CONFIRMED", "staged changes");
|
|
255849
|
-
},
|
|
255850
|
-
security(action, message) {
|
|
255851
|
-
this.log("SECURITY", `${action} ${message}`);
|
|
255852
|
-
}
|
|
255853
|
-
};
|
|
255854
|
-
}
|
|
255855
|
-
|
|
255856
|
-
// node_modules/@clack/core/dist/index.mjs
|
|
255857
|
-
var import_sisteransi = __toESM(require_src(), 1);
|
|
255858
|
-
import { stdin as j, stdout as M } from "node:process";
|
|
255859
|
-
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
255860
|
-
import O from "node:readline";
|
|
255861
|
-
import { Writable as X } from "node:stream";
|
|
255862
|
-
function DD({ onlyFirst: e = false } = {}) {
|
|
255863
|
-
const t = ["[\\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("|");
|
|
255864
|
-
return new RegExp(t, e ? undefined : "g");
|
|
255865
|
-
}
|
|
255866
|
-
var uD = DD();
|
|
255867
|
-
function P(e) {
|
|
255868
|
-
if (typeof e != "string")
|
|
255869
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
|
|
255870
|
-
return e.replace(uD, "");
|
|
255871
|
-
}
|
|
255872
|
-
function L(e) {
|
|
255873
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
255874
|
-
}
|
|
255875
|
-
var W = { exports: {} };
|
|
255876
|
-
(function(e) {
|
|
255877
|
-
var u = {};
|
|
255878
|
-
e.exports = u, u.eastAsianWidth = function(F) {
|
|
255879
|
-
var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
|
|
255880
|
-
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";
|
|
255881
|
-
}, u.characterLength = function(F) {
|
|
255882
|
-
var s = this.eastAsianWidth(F);
|
|
255883
|
-
return s == "F" || s == "W" || s == "A" ? 2 : 1;
|
|
255884
|
-
};
|
|
255885
|
-
function t(F) {
|
|
255886
|
-
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
255887
|
-
}
|
|
255888
|
-
u.length = function(F) {
|
|
255889
|
-
for (var s = t(F), i = 0, D = 0;D < s.length; D++)
|
|
255890
|
-
i = i + this.characterLength(s[D]);
|
|
255891
|
-
return i;
|
|
255892
|
-
}, u.slice = function(F, s, i) {
|
|
255893
|
-
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
255894
|
-
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
|
|
255895
|
-
var a = n[E], o = u.length(a);
|
|
255896
|
-
if (C >= s - (o == 2 ? 1 : 0))
|
|
255897
|
-
if (C + o <= i)
|
|
255898
|
-
D += a;
|
|
255899
|
-
else
|
|
255900
|
-
break;
|
|
255901
|
-
C += o;
|
|
255902
|
-
}
|
|
255903
|
-
return D;
|
|
255904
|
-
};
|
|
255905
|
-
})(W);
|
|
255906
|
-
var tD = W.exports;
|
|
255907
|
-
var eD = L(tD);
|
|
255908
|
-
var FD = function() {
|
|
255909
|
-
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;
|
|
255910
|
-
};
|
|
255911
|
-
var sD = L(FD);
|
|
255912
|
-
function p(e, u = {}) {
|
|
255913
|
-
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
|
|
255914
|
-
return 0;
|
|
255915
|
-
e = e.replace(sD(), " ");
|
|
255916
|
-
const t = u.ambiguousIsNarrow ? 1 : 2;
|
|
255917
|
-
let F = 0;
|
|
255918
|
-
for (const s of e) {
|
|
255919
|
-
const i = s.codePointAt(0);
|
|
255920
|
-
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
|
|
255921
|
-
continue;
|
|
255922
|
-
switch (eD.eastAsianWidth(s)) {
|
|
255923
|
-
case "F":
|
|
255924
|
-
case "W":
|
|
255925
|
-
F += 2;
|
|
255926
|
-
break;
|
|
255927
|
-
case "A":
|
|
255928
|
-
F += t;
|
|
255929
|
-
break;
|
|
255930
|
-
default:
|
|
255931
|
-
F += 1;
|
|
255932
|
-
}
|
|
255933
|
-
}
|
|
255934
|
-
return F;
|
|
255935
|
-
}
|
|
255936
|
-
var w = 10;
|
|
255937
|
-
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
|
|
255938
|
-
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
|
|
255939
|
-
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
|
|
255940
|
-
var 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] } };
|
|
255941
|
-
Object.keys(r.modifier);
|
|
255942
|
-
var iD = Object.keys(r.color);
|
|
255943
|
-
var CD = Object.keys(r.bgColor);
|
|
255944
|
-
[...iD, ...CD];
|
|
255945
|
-
function rD() {
|
|
255946
|
-
const e = new Map;
|
|
255947
|
-
for (const [u, t] of Object.entries(r)) {
|
|
255948
|
-
for (const [F, s] of Object.entries(t))
|
|
255949
|
-
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
|
|
255950
|
-
Object.defineProperty(r, u, { value: t, enumerable: false });
|
|
255951
|
-
}
|
|
255952
|
-
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
255953
|
-
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
255954
|
-
if (!t)
|
|
255955
|
-
return [0, 0, 0];
|
|
255956
|
-
let [F] = t;
|
|
255957
|
-
F.length === 3 && (F = [...F].map((i) => i + i).join(""));
|
|
255958
|
-
const s = Number.parseInt(F, 16);
|
|
255959
|
-
return [s >> 16 & 255, s >> 8 & 255, s & 255];
|
|
255960
|
-
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
255961
|
-
if (u < 8)
|
|
255962
|
-
return 30 + u;
|
|
255963
|
-
if (u < 16)
|
|
255964
|
-
return 90 + (u - 8);
|
|
255965
|
-
let t, F, s;
|
|
255966
|
-
if (u >= 232)
|
|
255967
|
-
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
255968
|
-
else {
|
|
255969
|
-
u -= 16;
|
|
255970
|
-
const C = u % 36;
|
|
255971
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
255972
|
-
}
|
|
255973
|
-
const i = Math.max(t, F, s) * 2;
|
|
255974
|
-
if (i === 0)
|
|
255975
|
-
return 30;
|
|
255976
|
-
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
|
|
255977
|
-
return i === 2 && (D += 60), D;
|
|
255978
|
-
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
255979
|
-
}
|
|
255980
|
-
var ED = rD();
|
|
255981
|
-
var d = new Set(["\x1B", ""]);
|
|
255982
|
-
var oD = 39;
|
|
255983
|
-
var y = "\x07";
|
|
255984
|
-
var V = "[";
|
|
255985
|
-
var nD = "]";
|
|
255986
|
-
var G = "m";
|
|
255987
|
-
var _ = `${nD}8;;`;
|
|
255988
|
-
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
|
|
255989
|
-
var K = (e) => `${d.values().next().value}${_}${e}${y}`;
|
|
255990
|
-
var aD = (e) => e.split(" ").map((u) => p(u));
|
|
255991
|
-
var k = (e, u, t) => {
|
|
255992
|
-
const F = [...u];
|
|
255993
|
-
let s = false, i = false, D = p(P(e[e.length - 1]));
|
|
255994
|
-
for (const [C, n] of F.entries()) {
|
|
255995
|
-
const E = p(n);
|
|
255996
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
255997
|
-
i ? n === y && (s = false, i = false) : n === G && (s = false);
|
|
255998
|
-
continue;
|
|
255999
|
-
}
|
|
256000
|
-
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
256001
|
-
}
|
|
256002
|
-
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
256003
|
-
};
|
|
256004
|
-
var hD = (e) => {
|
|
256005
|
-
const u = e.split(" ");
|
|
256006
|
-
let t = u.length;
|
|
256007
|
-
for (;t > 0 && !(p(u[t - 1]) > 0); )
|
|
256008
|
-
t--;
|
|
256009
|
-
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
|
|
256010
|
-
};
|
|
256011
|
-
var lD = (e, u, t = {}) => {
|
|
256012
|
-
if (t.trim !== false && e.trim() === "")
|
|
256013
|
-
return "";
|
|
256014
|
-
let F = "", s, i;
|
|
256015
|
-
const D = aD(e);
|
|
256016
|
-
let C = [""];
|
|
256017
|
-
for (const [E, a] of e.split(" ").entries()) {
|
|
256018
|
-
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
256019
|
-
let o = p(C[C.length - 1]);
|
|
256020
|
-
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
256021
|
-
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
256022
|
-
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
256023
|
-
continue;
|
|
256024
|
-
}
|
|
256025
|
-
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
256026
|
-
if (t.wordWrap === false && o < u) {
|
|
256027
|
-
k(C, a, u);
|
|
256028
|
-
continue;
|
|
256029
|
-
}
|
|
256030
|
-
C.push("");
|
|
256031
|
-
}
|
|
256032
|
-
if (o + D[E] > u && t.wordWrap === false) {
|
|
256033
|
-
k(C, a, u);
|
|
256034
|
-
continue;
|
|
256035
|
-
}
|
|
256036
|
-
C[C.length - 1] += a;
|
|
256037
|
-
}
|
|
256038
|
-
t.trim !== false && (C = C.map((E) => hD(E)));
|
|
256039
|
-
const n = [...C.join(`
|
|
256040
|
-
`)];
|
|
256041
|
-
for (const [E, a] of n.entries()) {
|
|
256042
|
-
if (F += a, d.has(a)) {
|
|
256043
|
-
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
|
|
256044
|
-
if (c.code !== undefined) {
|
|
256045
|
-
const f = Number.parseFloat(c.code);
|
|
256046
|
-
s = f === oD ? undefined : f;
|
|
256047
|
-
} else
|
|
256048
|
-
c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
|
|
256049
|
-
}
|
|
256050
|
-
const o = ED.codes.get(Number(s));
|
|
256051
|
-
n[E + 1] === `
|
|
256052
|
-
` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
|
|
256053
|
-
` && (s && o && (F += z(s)), i && (F += K(i)));
|
|
256054
|
-
}
|
|
256055
|
-
return F;
|
|
256056
|
-
};
|
|
256057
|
-
function Y(e, u, t) {
|
|
256058
|
-
return String(e).normalize().replace(/\r\n/g, `
|
|
256059
|
-
`).split(`
|
|
256060
|
-
`).map((F) => lD(F, u, t)).join(`
|
|
256061
|
-
`);
|
|
256062
|
-
}
|
|
256063
|
-
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
256064
|
-
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
|
|
256065
|
-
function $(e, u) {
|
|
256066
|
-
if (typeof e == "string")
|
|
256067
|
-
return B.aliases.get(e) === u;
|
|
256068
|
-
for (const t of e)
|
|
256069
|
-
if (t !== undefined && $(t, u))
|
|
256070
|
-
return true;
|
|
256071
|
-
return false;
|
|
256072
|
-
}
|
|
256073
|
-
function BD(e, u) {
|
|
256074
|
-
if (e === u)
|
|
256075
|
-
return;
|
|
256076
|
-
const t = e.split(`
|
|
256077
|
-
`), F = u.split(`
|
|
256078
|
-
`), s = [];
|
|
256079
|
-
for (let i = 0;i < Math.max(t.length, F.length); i++)
|
|
256080
|
-
t[i] !== F[i] && s.push(i);
|
|
256081
|
-
return s;
|
|
256082
|
-
}
|
|
256083
|
-
var AD = globalThis.process.platform.startsWith("win");
|
|
256084
|
-
var S = Symbol("clack:cancel");
|
|
256085
|
-
function pD(e) {
|
|
256086
|
-
return e === S;
|
|
256087
|
-
}
|
|
256088
|
-
function m(e, u) {
|
|
256089
|
-
const t = e;
|
|
256090
|
-
t.isTTY && t.setRawMode(u);
|
|
256091
|
-
}
|
|
256092
|
-
var gD = Object.defineProperty;
|
|
256093
|
-
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
256094
|
-
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
256095
|
-
|
|
256096
|
-
class x {
|
|
256097
|
-
constructor(u, t = true) {
|
|
256098
|
-
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", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
256099
|
-
const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
|
|
256100
|
-
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 = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
256101
|
-
}
|
|
256102
|
-
unsubscribe() {
|
|
256103
|
-
this._subscribers.clear();
|
|
256104
|
-
}
|
|
256105
|
-
setSubscriber(u, t) {
|
|
256106
|
-
const F = this._subscribers.get(u) ?? [];
|
|
256107
|
-
F.push(t), this._subscribers.set(u, F);
|
|
256108
|
-
}
|
|
256109
|
-
on(u, t) {
|
|
256110
|
-
this.setSubscriber(u, { cb: t });
|
|
256111
|
-
}
|
|
256112
|
-
once(u, t) {
|
|
256113
|
-
this.setSubscriber(u, { cb: t, once: true });
|
|
256114
|
-
}
|
|
256115
|
-
emit(u, ...t) {
|
|
256116
|
-
const F = this._subscribers.get(u) ?? [], s = [];
|
|
256117
|
-
for (const i of F)
|
|
256118
|
-
i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
|
|
256119
|
-
for (const i of s)
|
|
256120
|
-
i();
|
|
256121
|
-
}
|
|
256122
|
-
prompt() {
|
|
256123
|
-
return new Promise((u, t) => {
|
|
256124
|
-
if (this._abortSignal) {
|
|
256125
|
-
if (this._abortSignal.aborted)
|
|
256126
|
-
return this.state = "cancel", this.close(), u(S);
|
|
256127
|
-
this._abortSignal.addEventListener("abort", () => {
|
|
256128
|
-
this.state = "cancel", this.close();
|
|
256129
|
-
}, { once: true });
|
|
256130
|
-
}
|
|
256131
|
-
const F = new X;
|
|
256132
|
-
F._write = (s, i, D) => {
|
|
256133
|
-
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
256134
|
-
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
256135
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
|
|
256136
|
-
}), this.once("cancel", () => {
|
|
256137
|
-
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
|
|
256138
|
-
});
|
|
256139
|
-
});
|
|
256140
|
-
}
|
|
256141
|
-
onKeypress(u, t) {
|
|
256142
|
-
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
256143
|
-
if (this.opts.validate) {
|
|
256144
|
-
const F = this.opts.validate(this.value);
|
|
256145
|
-
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
256146
|
-
}
|
|
256147
|
-
this.state !== "error" && (this.state = "submit");
|
|
256148
|
-
}
|
|
256149
|
-
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
256150
|
-
}
|
|
256151
|
-
close() {
|
|
256152
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
256153
|
-
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
256154
|
-
}
|
|
256155
|
-
restoreCursor() {
|
|
256156
|
-
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
256157
|
-
`).length - 1;
|
|
256158
|
-
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
|
|
256159
|
-
}
|
|
256160
|
-
render() {
|
|
256161
|
-
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
256162
|
-
if (u !== this._prevFrame) {
|
|
256163
|
-
if (this.state === "initial")
|
|
256164
|
-
this.output.write(import_sisteransi.cursor.hide);
|
|
256165
|
-
else {
|
|
256166
|
-
const t = BD(this._prevFrame, u);
|
|
256167
|
-
if (this.restoreCursor(), t && t?.length === 1) {
|
|
256168
|
-
const F = t[0];
|
|
256169
|
-
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
|
|
256170
|
-
const s = u.split(`
|
|
256171
|
-
`);
|
|
256172
|
-
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
|
|
256173
|
-
return;
|
|
256174
|
-
}
|
|
256175
|
-
if (t && t?.length > 1) {
|
|
256176
|
-
const F = t[0];
|
|
256177
|
-
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
|
|
256178
|
-
const s = u.split(`
|
|
256179
|
-
`).slice(F);
|
|
256180
|
-
this.output.write(s.join(`
|
|
256181
|
-
`)), this._prevFrame = u;
|
|
256182
|
-
return;
|
|
256183
|
-
}
|
|
256184
|
-
this.output.write(import_sisteransi.erase.down());
|
|
256185
|
-
}
|
|
256186
|
-
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
256187
|
-
}
|
|
256188
|
-
}
|
|
256189
|
-
}
|
|
256190
|
-
|
|
256191
|
-
class dD extends x {
|
|
256192
|
-
get cursor() {
|
|
256193
|
-
return this.value ? 0 : 1;
|
|
256194
|
-
}
|
|
256195
|
-
get _value() {
|
|
256196
|
-
return this.cursor === 0;
|
|
256197
|
-
}
|
|
256198
|
-
constructor(u) {
|
|
256199
|
-
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
256200
|
-
this.value = this._value;
|
|
256201
|
-
}), this.on("confirm", (t) => {
|
|
256202
|
-
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
|
|
256203
|
-
}), this.on("cursor", () => {
|
|
256204
|
-
this.value = !this.value;
|
|
256205
|
-
});
|
|
256206
|
-
}
|
|
256207
|
-
}
|
|
256208
|
-
var A;
|
|
256209
|
-
A = new WeakMap;
|
|
256210
|
-
var kD = Object.defineProperty;
|
|
256211
|
-
var $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
256212
|
-
var H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
256213
|
-
var SD = class extends x {
|
|
256214
|
-
constructor(u) {
|
|
256215
|
-
super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
|
|
256216
|
-
t === "a" && this.toggleAll();
|
|
256217
|
-
}), this.on("cursor", (t) => {
|
|
256218
|
-
switch (t) {
|
|
256219
|
-
case "left":
|
|
256220
|
-
case "up":
|
|
256221
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
256222
|
-
break;
|
|
256223
|
-
case "down":
|
|
256224
|
-
case "right":
|
|
256225
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
256226
|
-
break;
|
|
256227
|
-
case "space":
|
|
256228
|
-
this.toggleValue();
|
|
256229
|
-
break;
|
|
256230
|
-
}
|
|
256231
|
-
});
|
|
256232
|
-
}
|
|
256233
|
-
get _value() {
|
|
256234
|
-
return this.options[this.cursor].value;
|
|
256235
|
-
}
|
|
256236
|
-
toggleAll() {
|
|
256237
|
-
const u = this.value.length === this.options.length;
|
|
256238
|
-
this.value = u ? [] : this.options.map((t) => t.value);
|
|
256239
|
-
}
|
|
256240
|
-
toggleValue() {
|
|
256241
|
-
const u = this.value.includes(this._value);
|
|
256242
|
-
this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
|
|
256243
|
-
}
|
|
256244
|
-
};
|
|
256245
|
-
var TD = Object.defineProperty;
|
|
256246
|
-
var jD = (e, u, t) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
256247
|
-
var U = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
256248
|
-
|
|
256249
|
-
class MD extends x {
|
|
256250
|
-
constructor({ mask: u, ...t }) {
|
|
256251
|
-
super(t), U(this, "valueWithCursor", ""), U(this, "_mask", "•"), this._mask = u ?? "•", this.on("finalize", () => {
|
|
256252
|
-
this.valueWithCursor = this.masked;
|
|
256253
|
-
}), this.on("value", () => {
|
|
256254
|
-
if (this.cursor >= this.value.length)
|
|
256255
|
-
this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
256256
|
-
else {
|
|
256257
|
-
const F = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
|
|
256258
|
-
this.valueWithCursor = `${F}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
|
|
256259
|
-
}
|
|
256260
|
-
});
|
|
256261
|
-
}
|
|
256262
|
-
get cursor() {
|
|
256263
|
-
return this._cursor;
|
|
256264
|
-
}
|
|
256265
|
-
get masked() {
|
|
256266
|
-
return this.value.replaceAll(/./g, this._mask);
|
|
256267
|
-
}
|
|
256268
|
-
}
|
|
256269
|
-
var OD = Object.defineProperty;
|
|
256270
|
-
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
|
|
256271
|
-
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
|
|
256272
|
-
|
|
256273
|
-
class LD extends x {
|
|
256274
|
-
constructor(u) {
|
|
256275
|
-
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
|
|
256276
|
-
switch (t) {
|
|
256277
|
-
case "left":
|
|
256278
|
-
case "up":
|
|
256279
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
256280
|
-
break;
|
|
256281
|
-
case "down":
|
|
256282
|
-
case "right":
|
|
256283
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
256284
|
-
break;
|
|
256285
|
-
}
|
|
256286
|
-
this.changeValue();
|
|
256287
|
-
});
|
|
256288
|
-
}
|
|
256289
|
-
get _value() {
|
|
256290
|
-
return this.options[this.cursor];
|
|
256291
|
-
}
|
|
256292
|
-
changeValue() {
|
|
256293
|
-
this.value = this._value.value;
|
|
256294
|
-
}
|
|
256295
|
-
}
|
|
256296
|
-
class RD extends x {
|
|
256297
|
-
get valueWithCursor() {
|
|
256298
|
-
if (this.state === "submit")
|
|
256299
|
-
return this.value;
|
|
256300
|
-
if (this.cursor >= this.value.length)
|
|
256301
|
-
return `${this.value}█`;
|
|
256302
|
-
const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
|
|
256303
|
-
return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
|
|
256304
|
-
}
|
|
256305
|
-
get cursor() {
|
|
256306
|
-
return this._cursor;
|
|
256307
|
-
}
|
|
256308
|
-
constructor(u) {
|
|
256309
|
-
super(u), this.on("finalize", () => {
|
|
256310
|
-
this.value || (this.value = u.defaultValue);
|
|
256311
|
-
});
|
|
256312
|
-
}
|
|
256313
|
-
}
|
|
256314
|
-
|
|
256315
|
-
// node_modules/@clack/prompts/dist/index.mjs
|
|
256316
|
-
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
256317
|
-
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
256318
|
-
import y2 from "node:process";
|
|
256319
|
-
function ce() {
|
|
256320
|
-
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
256321
|
-
}
|
|
256322
|
-
var V2 = ce();
|
|
256323
|
-
var u = (t, n) => V2 ? t : n;
|
|
256324
|
-
var le = u("◆", "*");
|
|
256325
|
-
var L2 = u("■", "x");
|
|
256326
|
-
var W2 = u("▲", "x");
|
|
256327
|
-
var C = u("◇", "o");
|
|
256328
|
-
var ue = u("┌", "T");
|
|
256329
|
-
var o = u("│", "|");
|
|
256330
|
-
var d2 = u("└", "—");
|
|
256331
|
-
var k2 = u("●", ">");
|
|
256332
|
-
var P2 = u("○", " ");
|
|
256333
|
-
var A2 = u("◻", "[•]");
|
|
256334
|
-
var T = u("◼", "[+]");
|
|
256335
|
-
var F = u("◻", "[ ]");
|
|
256336
|
-
var $e = u("▪", "•");
|
|
256337
|
-
var _2 = u("─", "-");
|
|
256338
|
-
var me = u("╮", "+");
|
|
256339
|
-
var de = u("├", "+");
|
|
256340
|
-
var pe = u("╯", "+");
|
|
256341
|
-
var q = u("●", "•");
|
|
256342
|
-
var D = u("◆", "*");
|
|
256343
|
-
var U2 = u("▲", "!");
|
|
256344
|
-
var K2 = u("■", "x");
|
|
256345
|
-
var b2 = (t) => {
|
|
256346
|
-
switch (t) {
|
|
256347
|
-
case "initial":
|
|
256348
|
-
case "active":
|
|
256349
|
-
return import_picocolors2.default.cyan(le);
|
|
256350
|
-
case "cancel":
|
|
256351
|
-
return import_picocolors2.default.red(L2);
|
|
256352
|
-
case "error":
|
|
256353
|
-
return import_picocolors2.default.yellow(W2);
|
|
256354
|
-
case "submit":
|
|
256355
|
-
return import_picocolors2.default.green(C);
|
|
256356
|
-
}
|
|
256357
|
-
};
|
|
256358
|
-
var G2 = (t) => {
|
|
256359
|
-
const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
|
|
256360
|
-
let l2 = 0;
|
|
256361
|
-
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
|
|
256362
|
-
const $2 = a < r2.length && l2 > 0, g = a < r2.length && l2 + a < r2.length;
|
|
256363
|
-
return r2.slice(l2, l2 + a).map((p2, v2, f) => {
|
|
256364
|
-
const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g;
|
|
256365
|
-
return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
|
|
256366
|
-
});
|
|
256367
|
-
};
|
|
256368
|
-
var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
|
|
256369
|
-
const n = `${import_picocolors2.default.gray(o)}
|
|
256370
|
-
${b2(this.state)} ${t.message}
|
|
256371
|
-
`, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
|
|
256372
|
-
switch (this.state) {
|
|
256373
|
-
case "error":
|
|
256374
|
-
return `${n.trim()}
|
|
256375
|
-
${import_picocolors2.default.yellow(o)} ${i}
|
|
256376
|
-
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
256377
|
-
`;
|
|
256378
|
-
case "submit":
|
|
256379
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
|
|
256380
|
-
case "cancel":
|
|
256381
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
256382
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
256383
|
-
default:
|
|
256384
|
-
return `${n}${import_picocolors2.default.cyan(o)} ${i}
|
|
256385
|
-
${import_picocolors2.default.cyan(d2)}
|
|
256386
|
-
`;
|
|
256387
|
-
}
|
|
256388
|
-
} }).prompt();
|
|
256389
|
-
var ge = (t) => new MD({ validate: t.validate, mask: t.mask ?? $e, render() {
|
|
256390
|
-
const n = `${import_picocolors2.default.gray(o)}
|
|
256391
|
-
${b2(this.state)} ${t.message}
|
|
256392
|
-
`, r2 = this.valueWithCursor, i = this.masked;
|
|
256393
|
-
switch (this.state) {
|
|
256394
|
-
case "error":
|
|
256395
|
-
return `${n.trim()}
|
|
256396
|
-
${import_picocolors2.default.yellow(o)} ${i}
|
|
256397
|
-
${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
|
|
256398
|
-
`;
|
|
256399
|
-
case "submit":
|
|
256400
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(i)}`;
|
|
256401
|
-
case "cancel":
|
|
256402
|
-
return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i ?? ""))}${i ? `
|
|
256403
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
256404
|
-
default:
|
|
256405
|
-
return `${n}${import_picocolors2.default.cyan(o)} ${r2}
|
|
256406
|
-
${import_picocolors2.default.cyan(d2)}
|
|
256407
|
-
`;
|
|
256408
|
-
}
|
|
256409
|
-
} }).prompt();
|
|
256410
|
-
var ye = (t) => {
|
|
256411
|
-
const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
|
|
256412
|
-
return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
|
|
256413
|
-
const i = `${import_picocolors2.default.gray(o)}
|
|
256414
|
-
${b2(this.state)} ${t.message}
|
|
256415
|
-
`, s = this.value ? n : r2;
|
|
256416
|
-
switch (this.state) {
|
|
256417
|
-
case "submit":
|
|
256418
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
|
|
256419
|
-
case "cancel":
|
|
256420
|
-
return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
|
|
256421
|
-
${import_picocolors2.default.gray(o)}`;
|
|
256422
|
-
default:
|
|
256423
|
-
return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
|
|
256424
|
-
${import_picocolors2.default.cyan(d2)}
|
|
256425
|
-
`;
|
|
256426
|
-
}
|
|
256427
|
-
} }).prompt();
|
|
256428
|
-
};
|
|
256429
|
-
var ve = (t) => {
|
|
256430
|
-
const n = (r2, i) => {
|
|
256431
|
-
const s = r2.label ?? String(r2.value);
|
|
256432
|
-
switch (i) {
|
|
256433
|
-
case "selected":
|
|
256434
|
-
return `${import_picocolors2.default.dim(s)}`;
|
|
256435
|
-
case "active":
|
|
256436
|
-
return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
|
|
256437
|
-
case "cancelled":
|
|
256438
|
-
return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
|
|
256439
|
-
default:
|
|
256440
|
-
return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
|
|
256441
|
-
}
|
|
256442
|
-
};
|
|
256443
|
-
return new LD({ options: t.options, initialValue: t.initialValue, render() {
|
|
256444
|
-
const r2 = `${import_picocolors2.default.gray(o)}
|
|
256445
|
-
${b2(this.state)} ${t.message}
|
|
256446
|
-
`;
|
|
256447
|
-
switch (this.state) {
|
|
256448
|
-
case "submit":
|
|
256449
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
|
|
256450
|
-
case "cancel":
|
|
256451
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
|
|
256452
|
-
${import_picocolors2.default.gray(o)}`;
|
|
256453
|
-
default:
|
|
256454
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
|
|
256455
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
256456
|
-
${import_picocolors2.default.cyan(d2)}
|
|
256457
|
-
`;
|
|
256458
|
-
}
|
|
256459
|
-
} }).prompt();
|
|
256460
|
-
};
|
|
256461
|
-
var fe = (t) => {
|
|
256462
|
-
const n = (r2, i) => {
|
|
256463
|
-
const s = r2.label ?? String(r2.value);
|
|
256464
|
-
return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
|
|
256465
|
-
};
|
|
256466
|
-
return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
|
|
256467
|
-
if (this.required && r2.length === 0)
|
|
256468
|
-
return `Please select at least one option.
|
|
256469
|
-
${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`))}`;
|
|
256470
|
-
}, render() {
|
|
256471
|
-
const r2 = `${import_picocolors2.default.gray(o)}
|
|
256472
|
-
${b2(this.state)} ${t.message}
|
|
256473
|
-
`, i = (s, c) => {
|
|
256474
|
-
const a = this.value.includes(s.value);
|
|
256475
|
-
return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
|
|
256476
|
-
};
|
|
256477
|
-
switch (this.state) {
|
|
256478
|
-
case "submit":
|
|
256479
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
|
|
256480
|
-
case "cancel": {
|
|
256481
|
-
const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
|
|
256482
|
-
return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
|
|
256483
|
-
${import_picocolors2.default.gray(o)}` : ""}`;
|
|
256484
|
-
}
|
|
256485
|
-
case "error": {
|
|
256486
|
-
const s = this.error.split(`
|
|
256487
|
-
`).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
|
|
256488
|
-
`);
|
|
256489
|
-
return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
256490
|
-
${import_picocolors2.default.yellow(o)} `)}
|
|
256491
|
-
${s}
|
|
256492
|
-
`;
|
|
256493
|
-
}
|
|
256494
|
-
default:
|
|
256495
|
-
return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
|
|
256496
|
-
${import_picocolors2.default.cyan(o)} `)}
|
|
256497
|
-
${import_picocolors2.default.cyan(d2)}
|
|
256498
|
-
`;
|
|
256499
|
-
}
|
|
256500
|
-
} }).prompt();
|
|
256501
|
-
};
|
|
256502
|
-
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
256503
|
-
|
|
256504
|
-
// src/utils/display.ts
|
|
256505
|
-
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
256506
|
-
function success(message) {
|
|
256507
|
-
console.log(`${import_picocolors3.default.green("✓")} ${message}`);
|
|
256508
|
-
}
|
|
256509
|
-
function error(message) {
|
|
256510
|
-
console.log(`${import_picocolors3.default.red("✗")} ${message}`);
|
|
256511
|
-
}
|
|
256512
|
-
function warn(message) {
|
|
256513
|
-
console.log(`${import_picocolors3.default.yellow("⚠")} ${message}`);
|
|
256514
|
-
}
|
|
256515
|
-
function info(message) {
|
|
256516
|
-
console.log(`${import_picocolors3.default.blue("ℹ")} ${message}`);
|
|
256517
|
-
}
|
|
256518
|
-
var MODEL_PRICING = {
|
|
256519
|
-
"claude-opus-4-5": [15, 75],
|
|
256520
|
-
"claude-opus-4": [15, 75],
|
|
256521
|
-
"claude-sonnet-4-5": [3, 15],
|
|
256522
|
-
"claude-sonnet-4": [3, 15],
|
|
256523
|
-
"claude-sonnet-4-20250514": [3, 15],
|
|
256524
|
-
"claude-3-7-sonnet-20250219": [3, 15],
|
|
256525
|
-
"claude-3-5-sonnet-20241022": [3, 15],
|
|
256526
|
-
"claude-3-5-haiku-20241022": [0.8, 4],
|
|
256527
|
-
"claude-haiku-4-5": [0.8, 4],
|
|
256528
|
-
"gpt-4o": [2.5, 10],
|
|
256529
|
-
"gpt-4o-mini": [0.15, 0.6],
|
|
256530
|
-
o3: [10, 40],
|
|
256531
|
-
"o4-mini": [1.1, 4.4],
|
|
256532
|
-
"gpt-4.1": [2, 8],
|
|
256533
|
-
"gemini-2.0-flash": [0.1, 0.4],
|
|
256534
|
-
"gemini-2.5-pro-preview-05-06": [1.25, 10]
|
|
256535
|
-
};
|
|
256536
|
-
function resolvePrice(model) {
|
|
256537
|
-
if (model in MODEL_PRICING)
|
|
256538
|
-
return MODEL_PRICING[model];
|
|
256539
|
-
const key = Object.keys(MODEL_PRICING).find((k3) => model.startsWith(k3));
|
|
256540
|
-
return key ? MODEL_PRICING[key] : null;
|
|
256541
|
-
}
|
|
256542
|
-
function formatCost(usd) {
|
|
256543
|
-
if (usd === 0)
|
|
256544
|
-
return "$0.00";
|
|
256545
|
-
if (usd < 0.001)
|
|
256546
|
-
return `$${usd.toFixed(6)}`;
|
|
256547
|
-
if (usd < 0.01)
|
|
256548
|
-
return `$${usd.toFixed(4)}`;
|
|
256549
|
-
return `$${usd.toFixed(2)}`;
|
|
256550
|
-
}
|
|
256551
|
-
function renderContextBanner(params) {
|
|
256552
|
-
const { inputTokens, outputTokens, provider, model } = params;
|
|
256553
|
-
const totalTokens = inputTokens + outputTokens;
|
|
256554
|
-
const contextWindow = /opus/.test(model) ? 200000 : 200000;
|
|
256555
|
-
const pctUsed = contextWindow > 0 ? Math.min(100, Math.round(inputTokens / contextWindow * 100)) : 0;
|
|
256556
|
-
const pricing = resolvePrice(model);
|
|
256557
|
-
const costUsd = pricing ? inputTokens / 1e6 * pricing[0] + outputTokens / 1e6 * pricing[1] : null;
|
|
256558
|
-
const providerLabel = provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
256559
|
-
const width = 36;
|
|
256560
|
-
const border = import_picocolors3.default.dim("─".repeat(width));
|
|
256561
|
-
console.log("");
|
|
256562
|
-
console.log(` ${import_picocolors3.default.dim(border)}`);
|
|
256563
|
-
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.bold("Context")}${" ".repeat(width - 9)}${import_picocolors3.default.dim("│")}`);
|
|
256564
|
-
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.cyan(totalTokens.toLocaleString())} ${import_picocolors3.default.dim("tokens")}${" ".repeat(Math.max(0, width - 2 - totalTokens.toLocaleString().length - 7))}${import_picocolors3.default.dim("│")}`);
|
|
256565
|
-
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.yellow(`${pctUsed}%`)} ${import_picocolors3.default.dim("of context window used")}${" ".repeat(Math.max(0, width - 2 - String(pctUsed).length - 1 - 22))}${import_picocolors3.default.dim("│")}`);
|
|
256566
|
-
if (costUsd !== null) {
|
|
256567
|
-
const costStr = formatCost(costUsd);
|
|
256568
|
-
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.green(costStr)} ${import_picocolors3.default.dim("spent")}${" ".repeat(Math.max(0, width - 2 - costStr.length - 6))}${import_picocolors3.default.dim("│")}`);
|
|
256569
|
-
}
|
|
256570
|
-
console.log(` ${import_picocolors3.default.dim("│")} ${import_picocolors3.default.dim(`${providerLabel} · ${model}`)}${" ".repeat(Math.max(0, width - 2 - providerLabel.length - 3 - model.length))}${import_picocolors3.default.dim("│")}`);
|
|
256571
|
-
console.log(` ${import_picocolors3.default.dim(border)}`);
|
|
256572
|
-
console.log("");
|
|
256573
|
-
}
|
|
256574
|
-
function isModelNotSupportedError(err) {
|
|
256575
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
256576
|
-
return msg.includes("model is not supported") || msg.includes("model_not_found") || msg.includes("invalid model") || /4\d\d.*model/i.test(msg);
|
|
256577
|
-
}
|
|
256578
|
-
|
|
256579
|
-
// src/mcp/lifecycle.ts
|
|
256580
|
-
var MCP_START_FAILURE_MESSAGE = "Railway MCP Server not found. Install it: npm install -g @railway/mcp-server";
|
|
256581
|
-
var SHUTDOWN_TIMEOUT_MS = 5000;
|
|
256582
|
-
var auditLogger = createAuditLogger(".");
|
|
256583
|
-
function findMcpEntryPoint() {
|
|
256584
|
-
try {
|
|
256585
|
-
const globalRoot = execSync("npm root -g", { encoding: "utf-8", stdio: "pipe" }).trim();
|
|
256586
|
-
const candidate = join2(globalRoot, "@railway", "mcp-server", "dist", "index.js");
|
|
256587
|
-
if (existsSync2(candidate))
|
|
256588
|
-
return candidate;
|
|
256589
|
-
} catch {}
|
|
256590
|
-
return null;
|
|
256591
|
-
}
|
|
256592
|
-
var activeServer = null;
|
|
256593
|
-
var pendingSpawn = null;
|
|
256594
|
-
var shouldLogRespawn = false;
|
|
256595
|
-
var intentionallyShuttingDown = new WeakSet;
|
|
256596
|
-
function formatExitDetail(code, signal) {
|
|
256597
|
-
const codeLabel = code === null ? "null" : String(code);
|
|
256598
|
-
const signalLabel = signal ?? "null";
|
|
256599
|
-
return `code=${codeLabel}, signal=${signalLabel}`;
|
|
256600
|
-
}
|
|
256601
|
-
function isChildRunning(child) {
|
|
256602
|
-
return child.exitCode === null && !child.killed;
|
|
256603
|
-
}
|
|
256604
|
-
function buildServerProcess(child) {
|
|
256605
|
-
if (!child.stdin || !child.stdout) {
|
|
256606
|
-
throw new Error("MCP server stdio was not created");
|
|
256607
|
-
}
|
|
256608
|
-
return {
|
|
256609
|
-
process: child,
|
|
256610
|
-
stdin: child.stdin,
|
|
256611
|
-
stdout: child.stdout,
|
|
256612
|
-
pid: child.pid ?? -1
|
|
256613
|
-
};
|
|
256614
|
-
}
|
|
256615
|
-
function attachLifecycleListeners(child) {
|
|
256616
|
-
child.stderr?.on("data", (chunk) => {
|
|
256617
|
-
const message = String(chunk).trim();
|
|
256618
|
-
if (!message) {
|
|
256619
|
-
return;
|
|
256620
|
-
}
|
|
256621
|
-
auditLogger.mcp("server-lifecycle", "stderr", "FAILED", message);
|
|
256622
|
-
});
|
|
256623
|
-
child.on("exit", (code, signal) => {
|
|
256624
|
-
const detail = formatExitDetail(code, signal);
|
|
256625
|
-
if (activeServer?.process === child) {
|
|
256626
|
-
activeServer = null;
|
|
256627
|
-
}
|
|
256628
|
-
if (intentionallyShuttingDown.has(child)) {
|
|
256629
|
-
return;
|
|
256630
|
-
}
|
|
256631
|
-
shouldLogRespawn = true;
|
|
256632
|
-
auditLogger.mcp("server-lifecycle", "crash", "FAILED", detail);
|
|
256633
|
-
});
|
|
256634
|
-
}
|
|
256635
|
-
function displaySpawnFailure(reason) {
|
|
256636
|
-
error(MCP_START_FAILURE_MESSAGE);
|
|
256637
|
-
auditLogger.mcp("server-lifecycle", "spawn", "FAILED", reason);
|
|
256638
|
-
}
|
|
256639
|
-
async function spawnMcpServer() {
|
|
256640
|
-
if (activeServer && isChildRunning(activeServer.process)) {
|
|
256641
|
-
return activeServer;
|
|
256642
|
-
}
|
|
256643
|
-
if (pendingSpawn) {
|
|
256644
|
-
return pendingSpawn;
|
|
256645
|
-
}
|
|
256646
|
-
const entryPoint = findMcpEntryPoint();
|
|
256647
|
-
if (!entryPoint) {
|
|
256648
|
-
throw new Error(MCP_START_FAILURE_MESSAGE);
|
|
256649
|
-
}
|
|
256650
|
-
const respawn = shouldLogRespawn;
|
|
256651
|
-
const child = spawn("node", [entryPoint], {
|
|
256652
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
256653
|
-
});
|
|
256654
|
-
attachLifecycleListeners(child);
|
|
256655
|
-
pendingSpawn = new Promise((resolve, reject) => {
|
|
256656
|
-
const handleError = (spawnError) => {
|
|
256657
|
-
child.off("spawn", handleSpawn);
|
|
256658
|
-
if (activeServer?.process === child) {
|
|
256659
|
-
activeServer = null;
|
|
256660
|
-
}
|
|
256661
|
-
displaySpawnFailure(spawnError.message);
|
|
256662
|
-
reject(spawnError);
|
|
256663
|
-
};
|
|
256664
|
-
const handleSpawn = () => {
|
|
256665
|
-
child.off("error", handleError);
|
|
256666
|
-
let serverProcess;
|
|
256667
|
-
try {
|
|
256668
|
-
serverProcess = buildServerProcess(child);
|
|
256669
|
-
} catch (buildError) {
|
|
256670
|
-
const err = buildError instanceof Error ? buildError : new Error(String(buildError));
|
|
256671
|
-
displaySpawnFailure(err.message);
|
|
256672
|
-
reject(err);
|
|
256673
|
-
return;
|
|
256674
|
-
}
|
|
256675
|
-
activeServer = serverProcess;
|
|
256676
|
-
shouldLogRespawn = false;
|
|
256677
|
-
if (respawn) {
|
|
256678
|
-
auditLogger.mcp("server-lifecycle", "respawn", "SUCCESS", `pid=${serverProcess.pid}`);
|
|
256679
|
-
} else {
|
|
256680
|
-
auditLogger.mcp("server-lifecycle", "spawn", "SUCCESS", `pid=${serverProcess.pid}`);
|
|
256681
|
-
}
|
|
256682
|
-
resolve(serverProcess);
|
|
256683
|
-
};
|
|
256684
|
-
child.once("error", handleError);
|
|
256685
|
-
child.once("spawn", handleSpawn);
|
|
256686
|
-
}).finally(() => {
|
|
256687
|
-
pendingSpawn = null;
|
|
256688
|
-
});
|
|
256689
|
-
return pendingSpawn;
|
|
256690
|
-
}
|
|
256691
|
-
async function shutdownMcpServer() {
|
|
256692
|
-
if (!activeServer) {
|
|
256693
|
-
return;
|
|
256694
|
-
}
|
|
256695
|
-
const child = activeServer.process;
|
|
256696
|
-
intentionallyShuttingDown.add(child);
|
|
256697
|
-
if (!isChildRunning(child)) {
|
|
256698
|
-
activeServer = null;
|
|
256699
|
-
return;
|
|
256700
|
-
}
|
|
256701
|
-
const exitPromise = new Promise((resolve) => {
|
|
256702
|
-
child.once("exit", (code, signal) => {
|
|
256703
|
-
resolve({ code, signal });
|
|
256704
|
-
});
|
|
256705
|
-
});
|
|
256706
|
-
child.kill("SIGTERM");
|
|
256707
|
-
let forcedKill = false;
|
|
256708
|
-
const timeoutHandle = setTimeout(() => {
|
|
256709
|
-
forcedKill = true;
|
|
256710
|
-
child.kill("SIGKILL");
|
|
256711
|
-
}, SHUTDOWN_TIMEOUT_MS);
|
|
256712
|
-
const exitResult = await exitPromise;
|
|
256713
|
-
clearTimeout(timeoutHandle);
|
|
256714
|
-
activeServer = null;
|
|
256715
|
-
const detail = forcedKill ? `forced after timeout (${formatExitDetail(exitResult.code, exitResult.signal)})` : formatExitDetail(exitResult.code, exitResult.signal);
|
|
256716
|
-
auditLogger.mcp("server-lifecycle", "shutdown", "SUCCESS", detail);
|
|
256717
|
-
}
|
|
256718
|
-
|
|
256719
|
-
// src/utils/prerequisites.ts
|
|
256726
|
+
init_lifecycle();
|
|
256720
256727
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
256728
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
256721
256729
|
function getNodeVersion() {
|
|
256722
256730
|
try {
|
|
256723
256731
|
const output = execSync3("node --version", {
|
|
@@ -256811,7 +256819,7 @@ async function displayLlmStatus() {
|
|
|
256811
256819
|
}
|
|
256812
256820
|
|
|
256813
256821
|
// src/manifest/reader.ts
|
|
256814
|
-
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
256822
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync } from "node:fs";
|
|
256815
256823
|
import { join as join6, dirname as dirname2, resolve } from "node:path";
|
|
256816
256824
|
|
|
256817
256825
|
// src/utils/global-config.ts
|
|
@@ -257064,6 +257072,34 @@ function reconcileManifest(workspaceDir) {
|
|
|
257064
257072
|
writeManifest(workspaceDir, cleaned);
|
|
257065
257073
|
return cleaned;
|
|
257066
257074
|
}
|
|
257075
|
+
var SKIP_DIRS = new Set(["node_modules", ".git", ".kitt", "dist", "build", ".next", ".cache"]);
|
|
257076
|
+
function findChildWorkspaces(startDir, maxDepth = 3) {
|
|
257077
|
+
const results = [];
|
|
257078
|
+
const root = resolve(startDir);
|
|
257079
|
+
function scan(dir, depth) {
|
|
257080
|
+
if (depth > maxDepth)
|
|
257081
|
+
return;
|
|
257082
|
+
let entries;
|
|
257083
|
+
try {
|
|
257084
|
+
entries = readdirSync(dir, { withFileTypes: true }).filter((e2) => e2.isDirectory() && !SKIP_DIRS.has(e2.name) && !e2.name.startsWith(".")).map((e2) => e2.name);
|
|
257085
|
+
} catch {
|
|
257086
|
+
return;
|
|
257087
|
+
}
|
|
257088
|
+
for (const name of entries) {
|
|
257089
|
+
const childPath = join6(dir, name);
|
|
257090
|
+
if (isKittWorkspace(childPath)) {
|
|
257091
|
+
const manifest = readManifest(childPath);
|
|
257092
|
+
if (manifest) {
|
|
257093
|
+
results.push({ path: childPath, manifest });
|
|
257094
|
+
}
|
|
257095
|
+
continue;
|
|
257096
|
+
}
|
|
257097
|
+
scan(childPath, depth + 1);
|
|
257098
|
+
}
|
|
257099
|
+
}
|
|
257100
|
+
scan(root, 0);
|
|
257101
|
+
return results;
|
|
257102
|
+
}
|
|
257067
257103
|
|
|
257068
257104
|
// src/utils/auth-guard.ts
|
|
257069
257105
|
init_config();
|
|
@@ -257135,6 +257171,7 @@ async function railwayLogout() {
|
|
|
257135
257171
|
}
|
|
257136
257172
|
|
|
257137
257173
|
// src/utils/auth-guard.ts
|
|
257174
|
+
init_lifecycle();
|
|
257138
257175
|
var WORKSPACE_REQUIRED = new Set([
|
|
257139
257176
|
"create",
|
|
257140
257177
|
"delete",
|
|
@@ -257179,6 +257216,7 @@ var COMMAND_AUTH = {
|
|
|
257179
257216
|
settings: "none",
|
|
257180
257217
|
list: "none",
|
|
257181
257218
|
versions: "none",
|
|
257219
|
+
switch: "none",
|
|
257182
257220
|
exit: "none",
|
|
257183
257221
|
init: "both",
|
|
257184
257222
|
create: "both",
|
|
@@ -257195,12 +257233,15 @@ async function checkAuthGuard(commandKey) {
|
|
|
257195
257233
|
if (WORKSPACE_REQUIRED.has(commandKey)) {
|
|
257196
257234
|
const workspaceRoot = findWorkspaceRootStrict(process.cwd());
|
|
257197
257235
|
if (!workspaceRoot) {
|
|
257198
|
-
|
|
257199
|
-
|
|
257200
|
-
|
|
257201
|
-
|
|
257236
|
+
const children = findChildWorkspaces(process.cwd());
|
|
257237
|
+
if (children.length === 0) {
|
|
257238
|
+
return {
|
|
257239
|
+
allowed: false,
|
|
257240
|
+
message: "No KITT workspace found. Run /init to create one, or /switch to select an existing workspace."
|
|
257241
|
+
};
|
|
257242
|
+
}
|
|
257202
257243
|
}
|
|
257203
|
-
if (APPS_REQUIRED.has(commandKey)) {
|
|
257244
|
+
if (workspaceRoot && APPS_REQUIRED.has(commandKey)) {
|
|
257204
257245
|
const manifest = readManifest(workspaceRoot);
|
|
257205
257246
|
const appCount = manifest ? Object.keys(manifest.apps).length : 0;
|
|
257206
257247
|
if (appCount === 0) {
|
|
@@ -257252,19 +257293,25 @@ async function checkAuthGuard(commandKey) {
|
|
|
257252
257293
|
return { allowed: true };
|
|
257253
257294
|
}
|
|
257254
257295
|
|
|
257296
|
+
// src/cli.ts
|
|
257297
|
+
init_display();
|
|
257298
|
+
|
|
257255
257299
|
// src/sandbox/staging.ts
|
|
257300
|
+
init_logger();
|
|
257256
257301
|
import {
|
|
257257
257302
|
copyFileSync,
|
|
257258
257303
|
existsSync as existsSync7,
|
|
257304
|
+
lstatSync,
|
|
257259
257305
|
mkdirSync as mkdirSync5,
|
|
257260
|
-
readdirSync,
|
|
257306
|
+
readdirSync as readdirSync2,
|
|
257261
257307
|
readFileSync as readFileSync5,
|
|
257308
|
+
realpathSync,
|
|
257262
257309
|
rmSync as rmSync2,
|
|
257263
257310
|
statSync as statSync3,
|
|
257264
257311
|
writeFileSync as writeFileSync5
|
|
257265
257312
|
} from "node:fs";
|
|
257266
257313
|
import { createHash } from "node:crypto";
|
|
257267
|
-
import { dirname as dirname3, join as join7, relative } from "node:path";
|
|
257314
|
+
import { dirname as dirname3, join as join7, relative, resolve as resolve2 } from "node:path";
|
|
257268
257315
|
var KITT_DIR = ".kitt";
|
|
257269
257316
|
var STAGING_DIR = "staging";
|
|
257270
257317
|
function getStagingDir(workspaceDir) {
|
|
@@ -257274,7 +257321,15 @@ function hashContent(content) {
|
|
|
257274
257321
|
return createHash("sha256").update(content).digest("hex");
|
|
257275
257322
|
}
|
|
257276
257323
|
function assertWithinWorkspace(workspaceDir, targetPath) {
|
|
257277
|
-
|
|
257324
|
+
let resolvedTarget = targetPath;
|
|
257325
|
+
const resolvedWorkspace = existsSync7(workspaceDir) ? realpathSync(workspaceDir) : resolve2(workspaceDir);
|
|
257326
|
+
if (existsSync7(targetPath)) {
|
|
257327
|
+
if (lstatSync(targetPath).isSymbolicLink()) {
|
|
257328
|
+
throw new Error(`Refusing to follow symlink: ${targetPath}`);
|
|
257329
|
+
}
|
|
257330
|
+
resolvedTarget = realpathSync(targetPath);
|
|
257331
|
+
}
|
|
257332
|
+
const pathFromWorkspace = relative(resolvedWorkspace, resolvedTarget);
|
|
257278
257333
|
if (pathFromWorkspace === ".." || pathFromWorkspace.startsWith(`..${pathFromWorkspace.includes("\\") ? "\\" : "/"}`)) {
|
|
257279
257334
|
throw new Error(`Refusing to write outside workspace: ${targetPath}`);
|
|
257280
257335
|
}
|
|
@@ -257283,7 +257338,7 @@ function countLines(content) {
|
|
|
257283
257338
|
return content.match(/\n/g)?.length ?? 0;
|
|
257284
257339
|
}
|
|
257285
257340
|
function collectStagedFilePaths(stagingDir, currentDir, output) {
|
|
257286
|
-
const entries =
|
|
257341
|
+
const entries = readdirSync2(currentDir);
|
|
257287
257342
|
for (const entry of entries) {
|
|
257288
257343
|
const absolutePath = join7(currentDir, entry);
|
|
257289
257344
|
const stats = statSync3(absolutePath);
|
|
@@ -257323,7 +257378,7 @@ function listStagedFiles(workspaceDir) {
|
|
|
257323
257378
|
}
|
|
257324
257379
|
const filePaths = [];
|
|
257325
257380
|
collectStagedFilePaths(stagingDir, stagingDir, filePaths);
|
|
257326
|
-
return filePaths.sort((a, b3) => a.localeCompare(b3)).map((stagedRelativePath) => {
|
|
257381
|
+
return filePaths.sort((a, b3) => a.localeCompare(b3, "en")).map((stagedRelativePath) => {
|
|
257327
257382
|
const workspacePath = join7(workspaceDir, stagedRelativePath);
|
|
257328
257383
|
assertWithinWorkspace(workspaceDir, workspacePath);
|
|
257329
257384
|
const content = readFileSync5(join7(stagingDir, stagedRelativePath), "utf-8");
|
|
@@ -257366,6 +257421,7 @@ function rejectStagedChanges(workspaceDir) {
|
|
|
257366
257421
|
}
|
|
257367
257422
|
|
|
257368
257423
|
// src/utils/cleanup.ts
|
|
257424
|
+
init_display();
|
|
257369
257425
|
var cleanupRegistered = false;
|
|
257370
257426
|
var replMode = false;
|
|
257371
257427
|
function setReplMode(value) {
|
|
@@ -257391,29 +257447,33 @@ function registerCleanupHandlers() {
|
|
|
257391
257447
|
return;
|
|
257392
257448
|
}
|
|
257393
257449
|
cleanupRegistered = true;
|
|
257394
|
-
process.
|
|
257450
|
+
process.once("SIGINT", () => {
|
|
257395
257451
|
handleCleanupSignal("SIGINT");
|
|
257396
257452
|
});
|
|
257397
|
-
process.
|
|
257453
|
+
process.once("SIGTERM", () => {
|
|
257398
257454
|
handleCleanupSignal("SIGTERM");
|
|
257399
257455
|
});
|
|
257400
257456
|
}
|
|
257401
257457
|
|
|
257402
257458
|
// src/commands/init.ts
|
|
257403
|
-
|
|
257404
|
-
|
|
257405
|
-
import { basename, join as join11, resolve as resolve2 } from "node:path";
|
|
257406
|
-
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
257459
|
+
init_dist2();
|
|
257460
|
+
init_logger();
|
|
257407
257461
|
init_config();
|
|
257462
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
257463
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync7, readdirSync as readdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync8 } from "node:fs";
|
|
257464
|
+
import { homedir as homedir3, platform as platform5 } from "node:os";
|
|
257465
|
+
import { basename, join as join11, resolve as resolve3 } from "node:path";
|
|
257408
257466
|
|
|
257409
257467
|
// src/llm/client.ts
|
|
257410
|
-
|
|
257468
|
+
init_logger();
|
|
257411
257469
|
init_config();
|
|
257470
|
+
import { randomUUID } from "node:crypto";
|
|
257412
257471
|
|
|
257413
257472
|
// src/prompts/version.ts
|
|
257414
257473
|
var PROMPT_VERSION = "0.1.0";
|
|
257415
257474
|
|
|
257416
257475
|
// src/llm/rate-limiter.ts
|
|
257476
|
+
init_display();
|
|
257417
257477
|
var MAX_RETRIES = 3;
|
|
257418
257478
|
var WARN_THRESHOLD = 50;
|
|
257419
257479
|
var BLOCK_THRESHOLD = 100;
|
|
@@ -257480,7 +257540,7 @@ async function loadProvider(provider) {
|
|
|
257480
257540
|
case "openai":
|
|
257481
257541
|
return (await Promise.resolve().then(() => (init_openai(), exports_openai))).default;
|
|
257482
257542
|
case "gemini":
|
|
257483
|
-
return (await Promise.resolve().then(() => (
|
|
257543
|
+
return (await Promise.resolve().then(() => (init_dist3(), exports_dist2))).GoogleGenerativeAI;
|
|
257484
257544
|
}
|
|
257485
257545
|
}
|
|
257486
257546
|
function normalizeToolSchema(tools) {
|
|
@@ -257699,9 +257759,9 @@ function createAnthropicClient(Provider, apiKey, model, rateLimiter) {
|
|
|
257699
257759
|
}
|
|
257700
257760
|
};
|
|
257701
257761
|
}
|
|
257702
|
-
function createOpenAiClient(Provider, apiKey, model, rateLimiter) {
|
|
257762
|
+
function createOpenAiClient(Provider, apiKey, model, rateLimiter, providerOverride) {
|
|
257703
257763
|
const client = new Provider({ apiKey });
|
|
257704
|
-
const provider = "openai";
|
|
257764
|
+
const provider = providerOverride ?? "openai";
|
|
257705
257765
|
return {
|
|
257706
257766
|
getProvider() {
|
|
257707
257767
|
return provider;
|
|
@@ -257957,7 +258017,7 @@ async function createCopilotClient(bearerToken, model, rateLimiter) {
|
|
|
257957
258017
|
defaultHeaders: COPILOT_HEADERS
|
|
257958
258018
|
});
|
|
257959
258019
|
};
|
|
257960
|
-
return createOpenAiClient(CopilotProvider, bearerToken, model, rateLimiter);
|
|
258020
|
+
return createOpenAiClient(CopilotProvider, bearerToken, model, rateLimiter, "github-copilot");
|
|
257961
258021
|
}
|
|
257962
258022
|
async function createLlmClient(rateLimiter) {
|
|
257963
258023
|
const llmConfig = await getLlmConfig();
|
|
@@ -258298,12 +258358,14 @@ async function executeOperations(options) {
|
|
|
258298
258358
|
}
|
|
258299
258359
|
|
|
258300
258360
|
// src/mcp/client.ts
|
|
258361
|
+
init_logger();
|
|
258301
258362
|
var JSON_RPC_VERSION = "2.0";
|
|
258302
258363
|
var MCP_PROTOCOL_VERSION = "2025-11-25";
|
|
258303
258364
|
var CLIENT_INFO = {
|
|
258304
258365
|
name: "openkitt",
|
|
258305
258366
|
version: "0.1.0"
|
|
258306
258367
|
};
|
|
258368
|
+
var REQUEST_TIMEOUT_MS = 30000;
|
|
258307
258369
|
var auditLogger3 = createAuditLogger(".");
|
|
258308
258370
|
function createJsonRpcError(code, message) {
|
|
258309
258371
|
const error4 = new Error(message);
|
|
@@ -258362,6 +258424,7 @@ async function createMcpClient(server2) {
|
|
|
258362
258424
|
const pendingRequests = new Map;
|
|
258363
258425
|
const rejectPending = (error4) => {
|
|
258364
258426
|
for (const pending of pendingRequests.values()) {
|
|
258427
|
+
clearTimeout(pending.timer);
|
|
258365
258428
|
pending.reject(error4);
|
|
258366
258429
|
}
|
|
258367
258430
|
pendingRequests.clear();
|
|
@@ -258385,6 +258448,7 @@ async function createMcpClient(server2) {
|
|
|
258385
258448
|
if (isJsonRpcResponse(message)) {
|
|
258386
258449
|
const pending = pendingRequests.get(message.id);
|
|
258387
258450
|
if (pending) {
|
|
258451
|
+
clearTimeout(pending.timer);
|
|
258388
258452
|
pendingRequests.delete(message.id);
|
|
258389
258453
|
if (message.error) {
|
|
258390
258454
|
pending.reject(createJsonRpcError(message.error.code, message.error.message));
|
|
@@ -258393,15 +258457,12 @@ async function createMcpClient(server2) {
|
|
|
258393
258457
|
}
|
|
258394
258458
|
}
|
|
258395
258459
|
}
|
|
258396
|
-
|
|
258397
|
-
newlineIndex = stdoutBuffer.indexOf(`
|
|
258460
|
+
newlineIndex = stdoutBuffer.indexOf(`
|
|
258398
258461
|
`);
|
|
258462
|
+
}
|
|
258399
258463
|
}
|
|
258400
258464
|
};
|
|
258401
258465
|
const handleServerExit = () => {
|
|
258402
|
-
if (closed) {
|
|
258403
|
-
return;
|
|
258404
|
-
}
|
|
258405
258466
|
ready = false;
|
|
258406
258467
|
rejectPending(new Error("MCP server connection closed"));
|
|
258407
258468
|
};
|
|
@@ -258427,8 +258488,12 @@ async function createMcpClient(server2) {
|
|
|
258427
258488
|
method,
|
|
258428
258489
|
...params ? { params } : {}
|
|
258429
258490
|
};
|
|
258430
|
-
return new Promise((
|
|
258431
|
-
|
|
258491
|
+
return new Promise((resolve3, reject) => {
|
|
258492
|
+
const timer = setTimeout(() => {
|
|
258493
|
+
pendingRequests.delete(id);
|
|
258494
|
+
reject(new Error(`MCP request '${method}' timed out after ${REQUEST_TIMEOUT_MS}ms`));
|
|
258495
|
+
}, REQUEST_TIMEOUT_MS);
|
|
258496
|
+
pendingRequests.set(id, { resolve: resolve3, reject, timer });
|
|
258432
258497
|
writeMessage(message);
|
|
258433
258498
|
});
|
|
258434
258499
|
};
|
|
@@ -258505,6 +258570,9 @@ async function createMcpClient(server2) {
|
|
|
258505
258570
|
};
|
|
258506
258571
|
}
|
|
258507
258572
|
|
|
258573
|
+
// src/commands/init.ts
|
|
258574
|
+
init_lifecycle();
|
|
258575
|
+
|
|
258508
258576
|
// src/scaffold/packages.ts
|
|
258509
258577
|
import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
258510
258578
|
import { join as join8 } from "node:path";
|
|
@@ -258650,6 +258718,9 @@ function scaffoldDefaultPackages(packagesDir) {
|
|
|
258650
258718
|
scaffoldAnalytics(packagesDir);
|
|
258651
258719
|
}
|
|
258652
258720
|
|
|
258721
|
+
// src/commands/init.ts
|
|
258722
|
+
init_display();
|
|
258723
|
+
|
|
258653
258724
|
// src/utils/validation.ts
|
|
258654
258725
|
import { existsSync as existsSync8 } from "node:fs";
|
|
258655
258726
|
import { join as join9 } from "node:path";
|
|
@@ -258698,7 +258769,7 @@ function isWindows3() {
|
|
|
258698
258769
|
return platform4() === "win32";
|
|
258699
258770
|
}
|
|
258700
258771
|
function normalizeEntries(entries) {
|
|
258701
|
-
const lines = [...entries].sort((a, b3) => a.integration.localeCompare(b3.integration)).map((entry) => `${entry.integration}=${entry.version}`);
|
|
258772
|
+
const lines = [...entries].sort((a, b3) => a.integration.localeCompare(b3.integration, "en")).map((entry) => `${entry.integration}=${entry.version}`);
|
|
258702
258773
|
if (lines.length === 0) {
|
|
258703
258774
|
return "";
|
|
258704
258775
|
}
|
|
@@ -258755,7 +258826,7 @@ var INTEGRATION_ALLOWLIST = [
|
|
|
258755
258826
|
"Trigger.dev SDK",
|
|
258756
258827
|
"Railway CLI"
|
|
258757
258828
|
];
|
|
258758
|
-
var SEMVER_REGEX =
|
|
258829
|
+
var SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
258759
258830
|
var TABLE_ROW_REGEX = /^\|\s*([^|]+?)\s*\|\s*([^|]+?)\s*\|$/;
|
|
258760
258831
|
var ALLOWLIST_SET = new Set(INTEGRATION_ALLOWLIST);
|
|
258761
258832
|
function isSeparatorCell(value) {
|
|
@@ -258842,7 +258913,7 @@ function getDefaultVersions() {
|
|
|
258842
258913
|
}
|
|
258843
258914
|
|
|
258844
258915
|
// src/versions/registry.ts
|
|
258845
|
-
var
|
|
258916
|
+
var REQUEST_TIMEOUT_MS2 = 5000;
|
|
258846
258917
|
var INTEGRATION_NPM_MAP = {
|
|
258847
258918
|
TailwindCSS: "tailwindcss",
|
|
258848
258919
|
"shadcn/ui": "shadcn",
|
|
@@ -258910,7 +258981,7 @@ async function fetchLatestVersion(npmPackage) {
|
|
|
258910
258981
|
const controller = new AbortController;
|
|
258911
258982
|
const timeoutId = setTimeout(() => {
|
|
258912
258983
|
controller.abort();
|
|
258913
|
-
},
|
|
258984
|
+
}, REQUEST_TIMEOUT_MS2);
|
|
258914
258985
|
try {
|
|
258915
258986
|
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(npmPackage)}/latest`, {
|
|
258916
258987
|
signal: controller.signal
|
|
@@ -258955,7 +259026,7 @@ async function versionExistsOnNpm(npmPackage, version) {
|
|
|
258955
259026
|
const controller = new AbortController;
|
|
258956
259027
|
const timeoutId = setTimeout(() => {
|
|
258957
259028
|
controller.abort();
|
|
258958
|
-
},
|
|
259029
|
+
}, REQUEST_TIMEOUT_MS2);
|
|
258959
259030
|
try {
|
|
258960
259031
|
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(npmPackage)}/${encodeURIComponent(version)}`, { method: "HEAD", signal: controller.signal });
|
|
258961
259032
|
return response.ok;
|
|
@@ -259034,7 +259105,7 @@ function extractRailwayProjectId(operationsResult) {
|
|
|
259034
259105
|
try {
|
|
259035
259106
|
const raw = readFileSync7(railwayConfig, "utf-8");
|
|
259036
259107
|
const cfg = JSON.parse(raw);
|
|
259037
|
-
const cwd =
|
|
259108
|
+
const cwd = resolve3(".");
|
|
259038
259109
|
const linked = cfg.projects?.[cwd];
|
|
259039
259110
|
if (linked?.project)
|
|
259040
259111
|
return linked.project;
|
|
@@ -259054,28 +259125,25 @@ function extractRailwayProjectId(operationsResult) {
|
|
|
259054
259125
|
return labeledProjectId[1];
|
|
259055
259126
|
return null;
|
|
259056
259127
|
}
|
|
259057
|
-
async function initCommand(context,
|
|
259058
|
-
const workspaceDir = resolve2(".");
|
|
259059
|
-
if (isKittWorkspace(workspaceDir)) {
|
|
259060
|
-
error("Already a KITT workspace. Run /create to add a new app.");
|
|
259061
|
-
return;
|
|
259062
|
-
}
|
|
259063
|
-
const ALLOWED_EXISTING = new Set([".git", ".gitignore", ".DS_Store", "README.md", "LICENSE", "LICENSE.md"]);
|
|
259064
|
-
const existing = readdirSync2(workspaceDir).filter((f) => !ALLOWED_EXISTING.has(f));
|
|
259065
|
-
if (existing.length > 0) {
|
|
259066
|
-
error(`Directory is not empty. Remove or move these files first: ${existing.slice(0, 5).join(", ")}${existing.length > 5 ? ` (+${existing.length - 5} more)` : ""}`);
|
|
259067
|
-
return;
|
|
259068
|
-
}
|
|
259128
|
+
async function initCommand(context, args) {
|
|
259069
259129
|
let workspaceName;
|
|
259070
|
-
if (
|
|
259071
|
-
workspaceName =
|
|
259130
|
+
if (args[0]) {
|
|
259131
|
+
workspaceName = sanitizeInput(args[0].trim());
|
|
259132
|
+
const nameCheck = validateAppName(workspaceName);
|
|
259133
|
+
if (!nameCheck.valid) {
|
|
259134
|
+
error(nameCheck.error ?? "Invalid workspace name.");
|
|
259135
|
+
return;
|
|
259136
|
+
}
|
|
259137
|
+
} else if (context.yes) {
|
|
259138
|
+
workspaceName = getWorkspaceNameFromDirectory(resolve3("."));
|
|
259072
259139
|
} else {
|
|
259073
259140
|
const nameResult = await he({
|
|
259074
259141
|
message: "Workspace name:",
|
|
259075
|
-
placeholder:
|
|
259076
|
-
defaultValue: getWorkspaceNameFromDirectory(workspaceDir),
|
|
259142
|
+
placeholder: "my-project",
|
|
259077
259143
|
validate: (v2) => {
|
|
259078
|
-
const sanitized = v2.trim()
|
|
259144
|
+
const sanitized = v2.trim();
|
|
259145
|
+
if (sanitized.length === 0)
|
|
259146
|
+
return "Name is required";
|
|
259079
259147
|
const result = validateAppName(sanitized);
|
|
259080
259148
|
return result.valid ? undefined : result.error;
|
|
259081
259149
|
}
|
|
@@ -259084,8 +259152,24 @@ async function initCommand(context, _args) {
|
|
|
259084
259152
|
warn("Init cancelled.");
|
|
259085
259153
|
return;
|
|
259086
259154
|
}
|
|
259087
|
-
workspaceName = sanitizeInput(nameResult.trim())
|
|
259155
|
+
workspaceName = sanitizeInput(nameResult.trim());
|
|
259156
|
+
}
|
|
259157
|
+
const workspaceDir = resolve3(workspaceName);
|
|
259158
|
+
if (existsSync10(workspaceDir)) {
|
|
259159
|
+
if (isKittWorkspace(workspaceDir)) {
|
|
259160
|
+
error(`Directory '${workspaceName}' is already a KITT workspace. Run /create to add a new app.`);
|
|
259161
|
+
return;
|
|
259162
|
+
}
|
|
259163
|
+
const ALLOWED_EXISTING = new Set([".git", ".gitignore", ".DS_Store", "README.md", "LICENSE", "LICENSE.md"]);
|
|
259164
|
+
const existing = readdirSync3(workspaceDir).filter((f) => !ALLOWED_EXISTING.has(f));
|
|
259165
|
+
if (existing.length > 0) {
|
|
259166
|
+
error(`Directory '${workspaceName}' is not empty. Remove or move these files first: ${existing.slice(0, 5).join(", ")}${existing.length > 5 ? ` (+${existing.length - 5} more)` : ""}`);
|
|
259167
|
+
return;
|
|
259168
|
+
}
|
|
259169
|
+
} else {
|
|
259170
|
+
mkdirSync7(workspaceDir, { recursive: true });
|
|
259088
259171
|
}
|
|
259172
|
+
process.chdir(workspaceDir);
|
|
259089
259173
|
let packageManager = resolvePackageManager(workspaceDir);
|
|
259090
259174
|
if (!context.yes) {
|
|
259091
259175
|
const pmResult = await ve({
|
|
@@ -259202,9 +259286,31 @@ async function initCommand(context, _args) {
|
|
|
259202
259286
|
}
|
|
259203
259287
|
|
|
259204
259288
|
// src/commands/create.ts
|
|
259289
|
+
init_logger();
|
|
259290
|
+
init_config();
|
|
259291
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
259205
259292
|
import { existsSync as existsSync16, mkdirSync as mkdirSync10 } from "node:fs";
|
|
259206
259293
|
import { join as join18 } from "node:path";
|
|
259207
|
-
|
|
259294
|
+
init_lifecycle();
|
|
259295
|
+
|
|
259296
|
+
// src/utils/workspace-resolver.ts
|
|
259297
|
+
async function resolveWorkspaceDir(startDir) {
|
|
259298
|
+
const upResult = findWorkspaceRoot(startDir);
|
|
259299
|
+
if (upResult)
|
|
259300
|
+
return upResult;
|
|
259301
|
+
const children = findChildWorkspaces(startDir);
|
|
259302
|
+
if (children.length === 0)
|
|
259303
|
+
return null;
|
|
259304
|
+
if (children.length === 1)
|
|
259305
|
+
return children[0].path;
|
|
259306
|
+
return null;
|
|
259307
|
+
}
|
|
259308
|
+
function getChildWorkspaces(startDir) {
|
|
259309
|
+
return findChildWorkspaces(startDir);
|
|
259310
|
+
}
|
|
259311
|
+
|
|
259312
|
+
// src/commands/create.ts
|
|
259313
|
+
init_display();
|
|
259208
259314
|
|
|
259209
259315
|
// src/utils/constraints.ts
|
|
259210
259316
|
var FRONTEND_DEFAULT_INTEGRATIONS = ["tailwindcss", "shadcn", "vitest", "posthog", "sentry"];
|
|
@@ -259368,6 +259474,8 @@ function resolveIntegrations(selections, manifest) {
|
|
|
259368
259474
|
}
|
|
259369
259475
|
|
|
259370
259476
|
// src/utils/prompts.ts
|
|
259477
|
+
init_dist2();
|
|
259478
|
+
init_display();
|
|
259371
259479
|
class CancelError extends Error {
|
|
259372
259480
|
constructor(message = "Creation cancelled.") {
|
|
259373
259481
|
super(message);
|
|
@@ -259642,15 +259750,14 @@ All three arrays are required. Use empty arrays if a category is not needed.
|
|
|
259642
259750
|
- Do NOT emit package installation commands (bun add, npm install, pnpm add, yarn add). All dependencies must be declared in the package.json you generate via newFiles — KITT installs them automatically after applying files.
|
|
259643
259751
|
- Do NOT emit framework scaffold commands (create-next-app, create-start, @tanstack/cli create) for TanStack Start, Hono, Next.js, or Express.js — KITT generates all framework files statically.
|
|
259644
259752
|
- Do NOT emit vitest init, sentry-cli, @sentry/cli, or any monitoring/observability CLI setup commands. Vitest requires no init step. Sentry is configured via environment variables only.
|
|
259645
|
-
- You may ONLY propose commands matching these patterns (
|
|
259646
|
-
*
|
|
259647
|
-
*
|
|
259648
|
-
*
|
|
259649
|
-
*
|
|
259650
|
-
*
|
|
259651
|
-
*
|
|
259652
|
-
*
|
|
259653
|
-
- Any command not in the list above MUST NOT appear in commands[]. If no valid commands are needed, return an empty commands array.
|
|
259753
|
+
- You may ONLY propose commands matching these patterns (replace <exec> with the package manager's execute command: bunx for bun, npx for npm, pnpm dlx for pnpm, yarn dlx for yarn):
|
|
259754
|
+
* <exec> shadcn@<semver> init --yes --base-color neutral --cwd apps/<appName> (MUST include --cwd apps/<appName>)
|
|
259755
|
+
* <exec> shadcn@<semver> add <component>
|
|
259756
|
+
* <exec> storybook@<semver> init
|
|
259757
|
+
* <exec> prisma init
|
|
259758
|
+
* <exec> prisma generate
|
|
259759
|
+
* <exec> drizzle-kit generate
|
|
259760
|
+
* <exec> playwright install
|
|
259654
259761
|
- Do not propose commands that download scripts, make network requests, or execute arbitrary code.
|
|
259655
259762
|
</commands_rules>
|
|
259656
259763
|
|
|
@@ -260006,8 +260113,8 @@ function createScaffoldingExecutor(client, onChunk) {
|
|
|
260006
260113
|
break;
|
|
260007
260114
|
}
|
|
260008
260115
|
const delayMs = isOverloaded ? Math.min(OVERLOAD_RETRY_BASE_MS * 2 ** (attempt - 1), OVERLOAD_MAX_RETRY_MS) * (0.5 + Math.random() * 0.5) : calculateBackoff(attempt);
|
|
260009
|
-
await new Promise((
|
|
260010
|
-
setTimeout(
|
|
260116
|
+
await new Promise((resolve4) => {
|
|
260117
|
+
setTimeout(resolve4, delayMs);
|
|
260011
260118
|
});
|
|
260012
260119
|
}
|
|
260013
260120
|
}
|
|
@@ -260045,6 +260152,9 @@ async function executeScaffolding(client, context, onChunk) {
|
|
|
260045
260152
|
return scaffoldingExecutor.execute(context);
|
|
260046
260153
|
}
|
|
260047
260154
|
|
|
260155
|
+
// src/commands/create-scaffolding.ts
|
|
260156
|
+
init_display();
|
|
260157
|
+
|
|
260048
260158
|
// src/versions/compat.ts
|
|
260049
260159
|
var import_semver = __toESM(require_semver2(), 1);
|
|
260050
260160
|
var DEPENDENCY_COUPLING = [
|
|
@@ -260120,7 +260230,7 @@ async function checkCompatibility(displayVersions, resolvedIntegrations, framewo
|
|
|
260120
260230
|
if (installed === null)
|
|
260121
260231
|
continue;
|
|
260122
260232
|
const satisfied = checkRange(installed, range);
|
|
260123
|
-
if (satisfied === true
|
|
260233
|
+
if (satisfied === true)
|
|
260124
260234
|
continue;
|
|
260125
260235
|
const issue = {
|
|
260126
260236
|
package: `${npmName}@${version}`,
|
|
@@ -260151,7 +260261,7 @@ async function checkCompatibility(displayVersions, resolvedIntegrations, framewo
|
|
|
260151
260261
|
if (!depInstalled)
|
|
260152
260262
|
continue;
|
|
260153
260263
|
const satisfied = checkRange(depInstalled, coupling.depRange);
|
|
260154
|
-
if (satisfied === true
|
|
260264
|
+
if (satisfied === true)
|
|
260155
260265
|
continue;
|
|
260156
260266
|
errors.push({
|
|
260157
260267
|
package: `${coupling.pkg}@${pkgVersion}`,
|
|
@@ -260165,6 +260275,51 @@ async function checkCompatibility(displayVersions, resolvedIntegrations, framewo
|
|
|
260165
260275
|
return { errors, warnings };
|
|
260166
260276
|
}
|
|
260167
260277
|
|
|
260278
|
+
// src/utils/pm.ts
|
|
260279
|
+
var COMMANDS = {
|
|
260280
|
+
bun: {
|
|
260281
|
+
execute: "bunx",
|
|
260282
|
+
add: "bun add",
|
|
260283
|
+
remove: "bun remove",
|
|
260284
|
+
run: "bun run",
|
|
260285
|
+
install: "bun install"
|
|
260286
|
+
},
|
|
260287
|
+
npm: {
|
|
260288
|
+
execute: "npx",
|
|
260289
|
+
add: "npm install",
|
|
260290
|
+
remove: "npm uninstall",
|
|
260291
|
+
run: "npm run",
|
|
260292
|
+
install: "npm install"
|
|
260293
|
+
},
|
|
260294
|
+
pnpm: {
|
|
260295
|
+
execute: "pnpm dlx",
|
|
260296
|
+
add: "pnpm add",
|
|
260297
|
+
remove: "pnpm remove",
|
|
260298
|
+
run: "pnpm run",
|
|
260299
|
+
install: "pnpm install"
|
|
260300
|
+
},
|
|
260301
|
+
yarn: {
|
|
260302
|
+
execute: "yarn dlx",
|
|
260303
|
+
add: "yarn add",
|
|
260304
|
+
remove: "yarn remove",
|
|
260305
|
+
run: "yarn run",
|
|
260306
|
+
install: "yarn install"
|
|
260307
|
+
}
|
|
260308
|
+
};
|
|
260309
|
+
var LOCKFILES = {
|
|
260310
|
+
bun: "bun.lockb",
|
|
260311
|
+
npm: "package-lock.json",
|
|
260312
|
+
pnpm: "pnpm-lock.yaml",
|
|
260313
|
+
yarn: "yarn.lock"
|
|
260314
|
+
};
|
|
260315
|
+
var DEFAULT_PM = "bun";
|
|
260316
|
+
function getCommand(pm, operation) {
|
|
260317
|
+
return COMMANDS[pm][operation];
|
|
260318
|
+
}
|
|
260319
|
+
function getLockfile(pm) {
|
|
260320
|
+
return LOCKFILES[pm];
|
|
260321
|
+
}
|
|
260322
|
+
|
|
260168
260323
|
// src/scaffold/frameworks/hono.ts
|
|
260169
260324
|
function buildHonoFiles(opts) {
|
|
260170
260325
|
const { appName, integrations } = opts;
|
|
@@ -260248,7 +260403,7 @@ function buildIndexTs(base, appName, integrations) {
|
|
|
260248
260403
|
`) };
|
|
260249
260404
|
}
|
|
260250
260405
|
function buildHomeRoute(base, appName) {
|
|
260251
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
260406
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
260252
260407
|
const html = [
|
|
260253
260408
|
"<!DOCTYPE html>",
|
|
260254
260409
|
'<html lang="en">',
|
|
@@ -260493,7 +260648,7 @@ function buildIndexTs2(base, appName, integrations) {
|
|
|
260493
260648
|
`) };
|
|
260494
260649
|
}
|
|
260495
260650
|
function buildHomeRoute2(base, appName) {
|
|
260496
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
260651
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
260497
260652
|
const html = [
|
|
260498
260653
|
"<!DOCTYPE html>",
|
|
260499
260654
|
'<html lang="en">',
|
|
@@ -260752,8 +260907,8 @@ function buildNextjsPackageJson(opts) {
|
|
|
260752
260907
|
devDependencies["storybook"] = sbVersion;
|
|
260753
260908
|
devDependencies["@storybook/react"] = sbVersion;
|
|
260754
260909
|
devDependencies["@storybook/react-vite"] = sbVersion;
|
|
260755
|
-
devDependencies["@storybook/addon-essentials"] =
|
|
260756
|
-
devDependencies["@storybook/addon-interactions"] =
|
|
260910
|
+
devDependencies["@storybook/addon-essentials"] = "8.6.14";
|
|
260911
|
+
devDependencies["@storybook/addon-interactions"] = "8.6.14";
|
|
260757
260912
|
}
|
|
260758
260913
|
const pkg = {
|
|
260759
260914
|
name: `@${workspaceName}/${appName}`,
|
|
@@ -260921,7 +261076,7 @@ ${bodyContent}
|
|
|
260921
261076
|
`;
|
|
260922
261077
|
}
|
|
260923
261078
|
function buildHomePage(appName, _workspaceName, integrations) {
|
|
260924
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
261079
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
260925
261080
|
const hasTailwind = integrations.includes("tailwindcss");
|
|
260926
261081
|
if (hasTailwind) {
|
|
260927
261082
|
return [
|
|
@@ -261112,7 +261267,7 @@ function buildTanstackStartPackageJson(opts) {
|
|
|
261112
261267
|
const typesReactDomVersion = v3(versions, "@types/react-dom", "19.0.0");
|
|
261113
261268
|
const dependencies = {
|
|
261114
261269
|
"@tanstack/react-start": tanstackVersion,
|
|
261115
|
-
"@tanstack/react-router": tanstackVersion,
|
|
261270
|
+
"@tanstack/react-router": v3(versions, "@tanstack/react-router", tanstackVersion),
|
|
261116
261271
|
react: reactVersion,
|
|
261117
261272
|
"react-dom": reactVersion
|
|
261118
261273
|
};
|
|
@@ -261191,8 +261346,8 @@ function buildTanstackStartPackageJson(opts) {
|
|
|
261191
261346
|
devDependencies["storybook"] = sbVersion;
|
|
261192
261347
|
devDependencies["@storybook/react"] = sbVersion;
|
|
261193
261348
|
devDependencies["@storybook/react-vite"] = sbVersion;
|
|
261194
|
-
devDependencies["@storybook/addon-essentials"] =
|
|
261195
|
-
devDependencies["@storybook/addon-interactions"] =
|
|
261349
|
+
devDependencies["@storybook/addon-essentials"] = "8.6.14";
|
|
261350
|
+
devDependencies["@storybook/addon-interactions"] = "8.6.14";
|
|
261196
261351
|
}
|
|
261197
261352
|
const pkg = {
|
|
261198
261353
|
name: `@${workspaceName}/${appName}`,
|
|
@@ -261337,7 +261492,7 @@ export default { fetch: createStartHandler(defaultStreamHandler) };
|
|
|
261337
261492
|
return { path: `${base}/src/server.ts`, content };
|
|
261338
261493
|
}
|
|
261339
261494
|
function buildRouter(base, appName, integrations) {
|
|
261340
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
261495
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
261341
261496
|
const hasSentry = integrations.includes("sentry");
|
|
261342
261497
|
const sentryImport = hasSentry ? `import * as Sentry from '@sentry/tanstackstart-react';
|
|
261343
261498
|
` : "";
|
|
@@ -261385,7 +261540,7 @@ function buildRouter(base, appName, integrations) {
|
|
|
261385
261540
|
}
|
|
261386
261541
|
function buildRootRoute(base, appName, integrations) {
|
|
261387
261542
|
const hasTailwind = integrations.includes("tailwindcss");
|
|
261388
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
261543
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
261389
261544
|
const cssImport = hasTailwind ? `import appCss from '~/styles/app.css?url';
|
|
261390
261545
|
` : "";
|
|
261391
261546
|
const linksSection = hasTailwind ? ` links: [{ rel: 'stylesheet', href: appCss }],
|
|
@@ -261498,7 +261653,7 @@ function buildAppCss(base) {
|
|
|
261498
261653
|
};
|
|
261499
261654
|
}
|
|
261500
261655
|
function buildIndexRoute(base, appName, welcomeContent) {
|
|
261501
|
-
const displayName = appName.charAt(0).toUpperCase() + appName.slice(1);
|
|
261656
|
+
const displayName = appName.length > 0 ? appName.charAt(0).toUpperCase() + appName.slice(1) : "App";
|
|
261502
261657
|
const homeBody = welcomeContent ?? [
|
|
261503
261658
|
` return (`,
|
|
261504
261659
|
` <main className="min-h-screen bg-[#050508] text-white flex items-center justify-center antialiased">`,
|
|
@@ -262287,23 +262442,24 @@ function buildIntegrationFiles(opts) {
|
|
|
262287
262442
|
return files;
|
|
262288
262443
|
}
|
|
262289
262444
|
function buildIntegrationCommands(opts) {
|
|
262290
|
-
const { integrations, versions, appName,
|
|
262445
|
+
const { integrations, versions, appName, packageManager } = opts;
|
|
262446
|
+
const x2 = getCommand(packageManager, "execute");
|
|
262291
262447
|
const commands = [];
|
|
262292
262448
|
if (integrations.includes("shadcn")) {
|
|
262293
262449
|
const shadcnVersion = versions["shadcn/ui"] ?? "3.8.5";
|
|
262294
262450
|
commands.push({
|
|
262295
|
-
command:
|
|
262451
|
+
command: `${x2} shadcn@${shadcnVersion} init --yes --base-color neutral --cwd apps/${appName}`,
|
|
262296
262452
|
purpose: "Initialize shadcn/ui components"
|
|
262297
262453
|
});
|
|
262298
262454
|
}
|
|
262299
262455
|
if (integrations.includes("drizzle")) {
|
|
262300
|
-
commands.push({ command:
|
|
262456
|
+
commands.push({ command: `${x2} drizzle-kit generate`, purpose: "Generate Drizzle migrations" });
|
|
262301
262457
|
}
|
|
262302
262458
|
if (integrations.includes("prisma")) {
|
|
262303
|
-
commands.push({ command:
|
|
262459
|
+
commands.push({ command: `${x2} prisma generate`, purpose: "Generate Prisma client" });
|
|
262304
262460
|
}
|
|
262305
262461
|
if (integrations.includes("playwright")) {
|
|
262306
|
-
commands.push({ command:
|
|
262462
|
+
commands.push({ command: `${x2} playwright install`, purpose: "Install Playwright browsers" });
|
|
262307
262463
|
}
|
|
262308
262464
|
return commands;
|
|
262309
262465
|
}
|
|
@@ -262463,7 +262619,8 @@ async function executeCreateScaffolding(options) {
|
|
|
262463
262619
|
framework,
|
|
262464
262620
|
integrations: options.resolvedIntegrations,
|
|
262465
262621
|
versions: mergedVersions,
|
|
262466
|
-
workspaceName: options.manifest.workspace.name
|
|
262622
|
+
workspaceName: options.manifest.workspace.name,
|
|
262623
|
+
packageManager: options.manifest.workspace.packageManager
|
|
262467
262624
|
});
|
|
262468
262625
|
return {
|
|
262469
262626
|
scaffolding: {
|
|
@@ -262486,8 +262643,9 @@ async function executeCreateScaffolding(options) {
|
|
|
262486
262643
|
}
|
|
262487
262644
|
|
|
262488
262645
|
// src/sandbox/scanner.ts
|
|
262489
|
-
|
|
262490
|
-
import {
|
|
262646
|
+
init_logger();
|
|
262647
|
+
import { existsSync as existsSync11, lstatSync as lstatSync2, readFileSync as readFileSync9 } from "node:fs";
|
|
262648
|
+
import { extname, isAbsolute, join as join13, normalize, resolve as resolve4 } from "node:path";
|
|
262491
262649
|
var ALLOWED_EXTENSIONS = new Set([
|
|
262492
262650
|
".ts",
|
|
262493
262651
|
".tsx",
|
|
@@ -262508,6 +262666,9 @@ var SUSPICIOUS_CONTENT_PATTERNS = [
|
|
|
262508
262666
|
{ pattern: /\bexec\s*\(/, detail: "Found 'exec(' - command execution is not allowed" },
|
|
262509
262667
|
{ pattern: /\bchild_process\b/, detail: "Found 'child_process' - process spawning module usage is not allowed" },
|
|
262510
262668
|
{ pattern: /\bspawn\s*\(/, detail: "Found 'spawn(' - process spawning is not allowed" },
|
|
262669
|
+
{ pattern: /\bnew\s+Function\s*\(/, detail: "Found 'new Function(' - dynamic code execution is not allowed" },
|
|
262670
|
+
{ pattern: /\bimport\s*\(/, detail: "Found dynamic 'import(' - dynamic imports are not allowed" },
|
|
262671
|
+
{ pattern: /\(\s*0\s*,\s*eval\s*\)\s*\(/, detail: "Found indirect eval '(0, eval)(' - dynamic code execution is not allowed" },
|
|
262511
262672
|
{
|
|
262512
262673
|
pattern: /require\(\s*['"]http['"]\s*\)/,
|
|
262513
262674
|
detail: `Found 'require("http")' - insecure HTTP imports are not allowed`
|
|
@@ -262563,7 +262724,7 @@ function validateFilePath(filePath) {
|
|
|
262563
262724
|
});
|
|
262564
262725
|
}
|
|
262565
262726
|
if (existsSync11(filePath)) {
|
|
262566
|
-
const stats =
|
|
262727
|
+
const stats = lstatSync2(filePath);
|
|
262567
262728
|
if (stats.isSymbolicLink()) {
|
|
262568
262729
|
warnings.push({
|
|
262569
262730
|
type: "path_traversal",
|
|
@@ -262594,7 +262755,7 @@ function scanStagedFiles(workspaceDir) {
|
|
|
262594
262755
|
const auditLogger4 = createAuditLogger(workspaceDir);
|
|
262595
262756
|
const warnings = [];
|
|
262596
262757
|
const stagedFiles = listStagedFiles(workspaceDir);
|
|
262597
|
-
const stagingRoot =
|
|
262758
|
+
const stagingRoot = resolve4(workspaceDir, ".kitt/staging");
|
|
262598
262759
|
for (const stagedFile of stagedFiles) {
|
|
262599
262760
|
const filePathWarnings = validateFilePath(stagedFile.relativePath);
|
|
262600
262761
|
const fileTypeWarnings = validateFileType(stagedFile.relativePath);
|
|
@@ -262603,7 +262764,7 @@ function scanStagedFiles(workspaceDir) {
|
|
|
262603
262764
|
if (hasPathIssues) {
|
|
262604
262765
|
continue;
|
|
262605
262766
|
}
|
|
262606
|
-
const stagedAbsolutePath =
|
|
262767
|
+
const stagedAbsolutePath = resolve4(stagingRoot, normalize(stagedFile.relativePath));
|
|
262607
262768
|
const stagedContent = readFileSync9(stagedAbsolutePath, "utf-8");
|
|
262608
262769
|
warnings.push(...scanFileContent(stagedFile.relativePath, stagedContent));
|
|
262609
262770
|
}
|
|
@@ -262634,6 +262795,9 @@ function stageNewFiles(newFiles, workspaceDir) {
|
|
|
262634
262795
|
}
|
|
262635
262796
|
|
|
262636
262797
|
// src/commands/create-confirm.ts
|
|
262798
|
+
init_dist2();
|
|
262799
|
+
init_logger();
|
|
262800
|
+
init_display();
|
|
262637
262801
|
function presentStagedChanges(diffSummary, scanResult) {
|
|
262638
262802
|
info("Staged changes:");
|
|
262639
262803
|
for (const line of diffSummary) {
|
|
@@ -262669,10 +262833,11 @@ async function confirmAndApply(options) {
|
|
|
262669
262833
|
}
|
|
262670
262834
|
|
|
262671
262835
|
// src/ast/engine.ts
|
|
262836
|
+
init_logger();
|
|
262672
262837
|
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
262673
262838
|
import { createHash as createHash3 } from "node:crypto";
|
|
262674
262839
|
import { existsSync as existsSync12, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "node:fs";
|
|
262675
|
-
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join14, normalize as normalize2, relative as relative2, resolve as
|
|
262840
|
+
import { dirname as dirname4, isAbsolute as isAbsolute2, join as join14, normalize as normalize2, relative as relative2, resolve as resolve5 } from "node:path";
|
|
262676
262841
|
var KITT_DIR2 = ".kitt";
|
|
262677
262842
|
var STAGING_DIR2 = "staging";
|
|
262678
262843
|
function hashContent2(content) {
|
|
@@ -262712,7 +262877,7 @@ function createAstEngine(workspaceDir) {
|
|
|
262712
262877
|
const auditLogger4 = createAuditLogger(workspaceDir);
|
|
262713
262878
|
function loadSourceFile(relativePath) {
|
|
262714
262879
|
validateRelativePath(relativePath);
|
|
262715
|
-
const fullPath =
|
|
262880
|
+
const fullPath = resolve5(workspaceDir, relativePath);
|
|
262716
262881
|
if (!isRelativePathInside(workspaceDir, fullPath)) {
|
|
262717
262882
|
throw new Error(`Path is outside workspace: ${relativePath}`);
|
|
262718
262883
|
}
|
|
@@ -262728,7 +262893,7 @@ function createAstEngine(workspaceDir) {
|
|
|
262728
262893
|
function writeToStaging2(relativePath, sourceFile) {
|
|
262729
262894
|
validateRelativePath(relativePath);
|
|
262730
262895
|
const stagingPath = join14(workspaceDir, KITT_DIR2, STAGING_DIR2, relativePath);
|
|
262731
|
-
if (!isRelativePathInside(
|
|
262896
|
+
if (!isRelativePathInside(resolve5(workspaceDir, KITT_DIR2, STAGING_DIR2), stagingPath)) {
|
|
262732
262897
|
throw new Error(`Refusing to write outside staging directory: ${relativePath}`);
|
|
262733
262898
|
}
|
|
262734
262899
|
mkdirSync8(dirname4(stagingPath), { recursive: true });
|
|
@@ -263105,7 +263270,7 @@ function applyOperation(sourceFile, operation) {
|
|
|
263105
263270
|
// src/ast/validator.ts
|
|
263106
263271
|
var import_ts_morph3 = __toESM(require_ts_morph(), 1);
|
|
263107
263272
|
import { existsSync as existsSync13 } from "node:fs";
|
|
263108
|
-
import { extname as extname2, isAbsolute as isAbsolute3, normalize as normalize3, relative as relative3, resolve as
|
|
263273
|
+
import { extname as extname2, isAbsolute as isAbsolute3, normalize as normalize3, relative as relative3, resolve as resolve6 } from "node:path";
|
|
263109
263274
|
var VALID_EXTENSIONS = new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
263110
263275
|
var TARGET_FILE_OPERATION = { op: "targetFile" };
|
|
263111
263276
|
function toMessageText(messageText) {
|
|
@@ -263281,8 +263446,8 @@ function validateTargetFile(workspaceDir, filePath) {
|
|
|
263281
263446
|
message: `Unsupported AST target extension: ${targetExt || "(none)"}`
|
|
263282
263447
|
});
|
|
263283
263448
|
}
|
|
263284
|
-
const absoluteWorkspaceDir =
|
|
263285
|
-
const absoluteTargetPath =
|
|
263449
|
+
const absoluteWorkspaceDir = resolve6(workspaceDir);
|
|
263450
|
+
const absoluteTargetPath = resolve6(absoluteWorkspaceDir, filePath);
|
|
263286
263451
|
const pathFromWorkspace = relative3(absoluteWorkspaceDir, absoluteTargetPath);
|
|
263287
263452
|
if (pathFromWorkspace !== "" && (pathFromWorkspace.startsWith("..") || isAbsolute3(pathFromWorkspace))) {
|
|
263288
263453
|
errors.push({
|
|
@@ -263342,7 +263507,7 @@ function validateTransforms(workspaceDir, transforms) {
|
|
|
263342
263507
|
if (!hasRemoveChecks) {
|
|
263343
263508
|
continue;
|
|
263344
263509
|
}
|
|
263345
|
-
const absolutePath =
|
|
263510
|
+
const absolutePath = resolve6(workspaceDir, transform.path);
|
|
263346
263511
|
let sourceFile;
|
|
263347
263512
|
try {
|
|
263348
263513
|
sourceFile = project.addSourceFileAtPath(absolutePath);
|
|
@@ -263412,51 +263577,12 @@ function executeTransformPipeline(transforms, workspaceDir) {
|
|
|
263412
263577
|
}
|
|
263413
263578
|
|
|
263414
263579
|
// src/commands/create-pipeline.ts
|
|
263415
|
-
|
|
263580
|
+
init_logger();
|
|
263581
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
263416
263582
|
import { join as join15 } from "node:path";
|
|
263417
263583
|
|
|
263418
|
-
// src/utils/pm.ts
|
|
263419
|
-
var COMMANDS = {
|
|
263420
|
-
bun: {
|
|
263421
|
-
execute: "bunx",
|
|
263422
|
-
add: "bun add",
|
|
263423
|
-
remove: "bun remove",
|
|
263424
|
-
run: "bun run"
|
|
263425
|
-
},
|
|
263426
|
-
npm: {
|
|
263427
|
-
execute: "npx",
|
|
263428
|
-
add: "npm install",
|
|
263429
|
-
remove: "npm uninstall",
|
|
263430
|
-
run: "npm run"
|
|
263431
|
-
},
|
|
263432
|
-
pnpm: {
|
|
263433
|
-
execute: "pnpm dlx",
|
|
263434
|
-
add: "pnpm add",
|
|
263435
|
-
remove: "pnpm remove",
|
|
263436
|
-
run: "pnpm run"
|
|
263437
|
-
},
|
|
263438
|
-
yarn: {
|
|
263439
|
-
execute: "yarn dlx",
|
|
263440
|
-
add: "yarn add",
|
|
263441
|
-
remove: "yarn remove",
|
|
263442
|
-
run: "yarn run"
|
|
263443
|
-
}
|
|
263444
|
-
};
|
|
263445
|
-
var LOCKFILES = {
|
|
263446
|
-
bun: "bun.lockb",
|
|
263447
|
-
npm: "package-lock.json",
|
|
263448
|
-
pnpm: "pnpm-lock.yaml",
|
|
263449
|
-
yarn: "yarn.lock"
|
|
263450
|
-
};
|
|
263451
|
-
var DEFAULT_PM = "bun";
|
|
263452
|
-
function getCommand(pm, operation) {
|
|
263453
|
-
return COMMANDS[pm][operation];
|
|
263454
|
-
}
|
|
263455
|
-
function getLockfile(pm) {
|
|
263456
|
-
return LOCKFILES[pm];
|
|
263457
|
-
}
|
|
263458
|
-
|
|
263459
263584
|
// src/sandbox/command-allowlist.ts
|
|
263585
|
+
init_logger();
|
|
263460
263586
|
var auditLogger4 = createAuditLogger(".");
|
|
263461
263587
|
var SEMVER_PATTERN = String.raw`\d+\.\d+\.\d+`;
|
|
263462
263588
|
var PATH_PATTERN = String.raw`[A-Za-z0-9._/-]+`;
|
|
@@ -263527,7 +263653,15 @@ function blocked(command, reason) {
|
|
|
263527
263653
|
reason
|
|
263528
263654
|
};
|
|
263529
263655
|
}
|
|
263656
|
+
var MAX_COMMAND_LENGTH = 512;
|
|
263530
263657
|
function validateCommand(command, packageManager) {
|
|
263658
|
+
const normalized = command.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "").replace(/\s+/g, " ").trim();
|
|
263659
|
+
if (normalized.length === 0) {
|
|
263660
|
+
return blocked(command, "Command is empty after normalization");
|
|
263661
|
+
}
|
|
263662
|
+
if (normalized.length > MAX_COMMAND_LENGTH) {
|
|
263663
|
+
return blocked(command, `Command exceeds maximum length of ${MAX_COMMAND_LENGTH} characters`);
|
|
263664
|
+
}
|
|
263531
263665
|
const executePrefix = escapeRegex(getCommand(packageManager, "execute"));
|
|
263532
263666
|
const removePrefix = escapeRegex(getCommand(packageManager, "remove"));
|
|
263533
263667
|
const packageWithVersion = `(${PACKAGE_PATTERN})@(${SEMVER_PATTERN})`;
|
|
@@ -263543,8 +263677,8 @@ function validateCommand(command, packageManager) {
|
|
|
263543
263677
|
new RegExp(`^${executePrefix} drizzle-kit generate$`),
|
|
263544
263678
|
new RegExp(`^${executePrefix} playwright install$`)
|
|
263545
263679
|
];
|
|
263546
|
-
const cdMatch = /^cd ([A-Za-z0-9._\/-]+) && (.+)$/.exec(
|
|
263547
|
-
const bare = cdMatch ? cdMatch[2] :
|
|
263680
|
+
const cdMatch = /^cd ([A-Za-z0-9._\/-]+) && (.+)$/.exec(normalized);
|
|
263681
|
+
const bare = cdMatch ? cdMatch[2] : normalized;
|
|
263548
263682
|
const addPrefix = escapeRegex(getCommand(packageManager, "add"));
|
|
263549
263683
|
const devFlag = String.raw`(?:(?:-D|-d|--dev|--save-dev) )?`;
|
|
263550
263684
|
const addRegex = new RegExp(`^${addPrefix} ${devFlag}${packageWithVersion}( ${packageWithVersion})*$`);
|
|
@@ -263559,6 +263693,7 @@ function validateCommand(command, packageManager) {
|
|
|
263559
263693
|
}
|
|
263560
263694
|
|
|
263561
263695
|
// src/commands/create-pipeline.ts
|
|
263696
|
+
init_display();
|
|
263562
263697
|
function executeCommandPipeline(commands, options) {
|
|
263563
263698
|
const auditLogger5 = createAuditLogger(options.workspaceDir);
|
|
263564
263699
|
const results = [];
|
|
@@ -263589,7 +263724,8 @@ function executeCommandPipeline(commands, options) {
|
|
|
263589
263724
|
continue;
|
|
263590
263725
|
}
|
|
263591
263726
|
try {
|
|
263592
|
-
|
|
263727
|
+
const [bin, ...args] = bare.split(/\s+/);
|
|
263728
|
+
execFileSync2(bin, args, { cwd, stdio: "inherit" });
|
|
263593
263729
|
results.push({
|
|
263594
263730
|
command: cmd.command,
|
|
263595
263731
|
purpose: cmd.purpose,
|
|
@@ -263611,6 +263747,7 @@ function executeCommandPipeline(commands, options) {
|
|
|
263611
263747
|
}
|
|
263612
263748
|
|
|
263613
263749
|
// src/commands/create-infra.ts
|
|
263750
|
+
init_display();
|
|
263614
263751
|
function extractServiceId(operationsResult) {
|
|
263615
263752
|
const jsonServiceId = /"serviceId"\s*:\s*"([^"]+)"/i.exec(operationsResult);
|
|
263616
263753
|
if (jsonServiceId?.[1]) {
|
|
@@ -263671,16 +263808,21 @@ async function provisionInfrastructure(options) {
|
|
|
263671
263808
|
}
|
|
263672
263809
|
|
|
263673
263810
|
// src/commands/run.ts
|
|
263811
|
+
init_dist2();
|
|
263812
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
263674
263813
|
import { spawn as spawn2 } from "node:child_process";
|
|
263675
263814
|
import { existsSync as existsSync15, readFileSync as readFileSync11 } from "node:fs";
|
|
263676
263815
|
import { join as join17 } from "node:path";
|
|
263677
|
-
|
|
263816
|
+
init_display();
|
|
263678
263817
|
|
|
263679
263818
|
// src/commands/settings.ts
|
|
263680
|
-
|
|
263819
|
+
init_dist2();
|
|
263820
|
+
init_logger();
|
|
263821
|
+
import { execSync as execSync5 } from "node:child_process";
|
|
263681
263822
|
import { chmodSync as chmodSync4, existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync10, renameSync as renameSync5, rmSync as rmSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync11 } from "node:fs";
|
|
263682
263823
|
import { homedir as homedir4, platform as platform6 } from "node:os";
|
|
263683
263824
|
import { join as join16 } from "node:path";
|
|
263825
|
+
init_display();
|
|
263684
263826
|
var SUPPORTED_PACKAGE_MANAGERS = ["bun", "npm", "pnpm", "yarn"];
|
|
263685
263827
|
var CONFIG_DIR2 = join16(homedir4(), ".kitt");
|
|
263686
263828
|
var CONFIG_FILE2 = join16(CONFIG_DIR2, "config.json");
|
|
@@ -263785,8 +263927,13 @@ function removePackageManagerArtifacts(workspaceDir, packageManager) {
|
|
|
263785
263927
|
}
|
|
263786
263928
|
function ensureWorkspaceFieldInRootPackageJson(workspaceDir) {
|
|
263787
263929
|
const packageJsonPath = join16(workspaceDir, "package.json");
|
|
263788
|
-
|
|
263789
|
-
|
|
263930
|
+
let parsed;
|
|
263931
|
+
try {
|
|
263932
|
+
const raw = readFileSync10(packageJsonPath, "utf-8");
|
|
263933
|
+
parsed = JSON.parse(raw);
|
|
263934
|
+
} catch {
|
|
263935
|
+
throw new Error("Root package.json is missing or contains invalid JSON.");
|
|
263936
|
+
}
|
|
263790
263937
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
263791
263938
|
throw new Error("Root package.json must contain a JSON object.");
|
|
263792
263939
|
}
|
|
@@ -263865,7 +264012,11 @@ async function maybeConfirmMigration(context, fromPm, toPm) {
|
|
|
263865
264012
|
function migrateWorkspacePackageManager(workspaceDir, fromPm, toPm) {
|
|
263866
264013
|
removePackageManagerArtifacts(workspaceDir, fromPm);
|
|
263867
264014
|
writePackageManagerFiles(workspaceDir, toPm);
|
|
263868
|
-
|
|
264015
|
+
try {
|
|
264016
|
+
execSync5(getInstallCommand(toPm), { cwd: workspaceDir, stdio: "inherit" });
|
|
264017
|
+
} catch {
|
|
264018
|
+
throw new Error(`Failed to install dependencies with ${toPm}. You may need to run the install command manually.`);
|
|
264019
|
+
}
|
|
263869
264020
|
}
|
|
263870
264021
|
async function runDisplayMode(workspaceDir) {
|
|
263871
264022
|
const autoOpen = readAutoOpenBrowser();
|
|
@@ -263933,7 +264084,11 @@ async function runSetMode(context, workspaceDir, args) {
|
|
|
263933
264084
|
success(`Workspace migrated to ${rawValue}`);
|
|
263934
264085
|
}
|
|
263935
264086
|
async function settingsCommand(context, args) {
|
|
263936
|
-
const workspaceDir =
|
|
264087
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264088
|
+
if (!workspaceDir) {
|
|
264089
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264090
|
+
return;
|
|
264091
|
+
}
|
|
263937
264092
|
if (args.length === 0) {
|
|
263938
264093
|
await runDisplayMode(workspaceDir);
|
|
263939
264094
|
return;
|
|
@@ -263971,7 +264126,7 @@ function resolveDevScript(appDir) {
|
|
|
263971
264126
|
return { found: false, reason: "no-matching-script", available };
|
|
263972
264127
|
}
|
|
263973
264128
|
function spawnDevServer(appDir, runCmd, script, appName) {
|
|
263974
|
-
return new Promise((
|
|
264129
|
+
return new Promise((resolve7, reject) => {
|
|
263975
264130
|
const [bin, ...binArgs] = `${runCmd} ${script}`.split(" ");
|
|
263976
264131
|
if (!bin) {
|
|
263977
264132
|
reject(new Error("Could not resolve run command."));
|
|
@@ -263986,25 +264141,33 @@ function spawnDevServer(appDir, runCmd, script, appName) {
|
|
|
263986
264141
|
shell: false
|
|
263987
264142
|
});
|
|
263988
264143
|
child.on("error", (err) => {
|
|
264144
|
+
cleanup();
|
|
263989
264145
|
reject(new Error(`Failed to start dev server: ${err.message}`));
|
|
263990
264146
|
});
|
|
263991
264147
|
child.on("close", (code) => {
|
|
264148
|
+
cleanup();
|
|
263992
264149
|
if (code !== null && code !== 0) {
|
|
263993
264150
|
reject(new Error(`Dev server exited with code ${code}.`));
|
|
263994
264151
|
return;
|
|
263995
264152
|
}
|
|
263996
|
-
|
|
264153
|
+
resolve7();
|
|
263997
264154
|
});
|
|
263998
|
-
|
|
264155
|
+
const onSigint = () => {
|
|
263999
264156
|
child.kill("SIGINT");
|
|
264000
|
-
}
|
|
264001
|
-
|
|
264157
|
+
};
|
|
264158
|
+
const onSigterm = () => {
|
|
264002
264159
|
child.kill("SIGTERM");
|
|
264003
|
-
}
|
|
264160
|
+
};
|
|
264161
|
+
process.on("SIGINT", onSigint);
|
|
264162
|
+
process.on("SIGTERM", onSigterm);
|
|
264163
|
+
function cleanup() {
|
|
264164
|
+
process.removeListener("SIGINT", onSigint);
|
|
264165
|
+
process.removeListener("SIGTERM", onSigterm);
|
|
264166
|
+
}
|
|
264004
264167
|
});
|
|
264005
264168
|
}
|
|
264006
264169
|
function startDevServerWithUrl(appDir, runCmd, script, appName) {
|
|
264007
|
-
return new Promise((
|
|
264170
|
+
return new Promise((resolve7, reject) => {
|
|
264008
264171
|
const [bin, ...binArgs] = `${runCmd} ${script}`.split(" ");
|
|
264009
264172
|
if (!bin) {
|
|
264010
264173
|
reject(new Error("Could not resolve run command."));
|
|
@@ -264021,7 +264184,9 @@ function startDevServerWithUrl(appDir, runCmd, script, appName) {
|
|
|
264021
264184
|
let detectedUrl = null;
|
|
264022
264185
|
function openBrowser(url) {
|
|
264023
264186
|
const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
264024
|
-
spawn2(opener, [url], { detached: true, stdio: "ignore" })
|
|
264187
|
+
const proc = spawn2(opener, [url], { detached: true, stdio: "ignore" });
|
|
264188
|
+
proc.on("error", () => {});
|
|
264189
|
+
proc.unref();
|
|
264025
264190
|
}
|
|
264026
264191
|
function onUrlDetected(url) {
|
|
264027
264192
|
if (detectedUrl !== null)
|
|
@@ -264055,25 +264220,37 @@ function startDevServerWithUrl(appDir, runCmd, script, appName) {
|
|
|
264055
264220
|
scanForUrl(text);
|
|
264056
264221
|
});
|
|
264057
264222
|
child.on("error", (err) => {
|
|
264223
|
+
cleanup();
|
|
264058
264224
|
reject(new Error(`Failed to start dev server: ${err.message}`));
|
|
264059
264225
|
});
|
|
264060
264226
|
child.on("close", (code) => {
|
|
264227
|
+
cleanup();
|
|
264061
264228
|
if (code !== null && code !== 0) {
|
|
264062
264229
|
reject(new Error(`Dev server exited with code ${code}.`));
|
|
264063
264230
|
return;
|
|
264064
264231
|
}
|
|
264065
|
-
|
|
264232
|
+
resolve7();
|
|
264066
264233
|
});
|
|
264067
|
-
|
|
264234
|
+
const onSigint = () => {
|
|
264068
264235
|
child.kill("SIGINT");
|
|
264069
|
-
}
|
|
264070
|
-
|
|
264236
|
+
};
|
|
264237
|
+
const onSigterm = () => {
|
|
264071
264238
|
child.kill("SIGTERM");
|
|
264072
|
-
}
|
|
264239
|
+
};
|
|
264240
|
+
process.on("SIGINT", onSigint);
|
|
264241
|
+
process.on("SIGTERM", onSigterm);
|
|
264242
|
+
function cleanup() {
|
|
264243
|
+
process.removeListener("SIGINT", onSigint);
|
|
264244
|
+
process.removeListener("SIGTERM", onSigterm);
|
|
264245
|
+
}
|
|
264073
264246
|
});
|
|
264074
264247
|
}
|
|
264075
264248
|
async function runCommand(_context, args) {
|
|
264076
|
-
const workspaceDir =
|
|
264249
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264250
|
+
if (!workspaceDir) {
|
|
264251
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264252
|
+
return;
|
|
264253
|
+
}
|
|
264077
264254
|
if (!isKittWorkspace(workspaceDir)) {
|
|
264078
264255
|
error("Not a KITT workspace. Run /init first.");
|
|
264079
264256
|
return;
|
|
@@ -264131,7 +264308,11 @@ async function runCommand(_context, args) {
|
|
|
264131
264308
|
|
|
264132
264309
|
// src/commands/create.ts
|
|
264133
264310
|
async function createCommand2(context, _args) {
|
|
264134
|
-
const workspaceDir =
|
|
264311
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264312
|
+
if (!workspaceDir) {
|
|
264313
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264314
|
+
return;
|
|
264315
|
+
}
|
|
264135
264316
|
if (!isKittWorkspace(workspaceDir)) {
|
|
264136
264317
|
error("Not a KITT workspace. Run /init first.");
|
|
264137
264318
|
return;
|
|
@@ -264213,11 +264394,24 @@ async function createCommand2(context, _args) {
|
|
|
264213
264394
|
warn(`AST transform skipped: ${transformError}`);
|
|
264214
264395
|
}
|
|
264215
264396
|
}
|
|
264216
|
-
|
|
264217
|
-
|
|
264218
|
-
|
|
264219
|
-
|
|
264220
|
-
|
|
264397
|
+
let installSucceeded = true;
|
|
264398
|
+
if (!context.dryRun) {
|
|
264399
|
+
const installCmd = getCommand(manifest.workspace.packageManager, "install");
|
|
264400
|
+
info(`Installing dependencies (${installCmd})...`);
|
|
264401
|
+
try {
|
|
264402
|
+
execSync6(installCmd, { cwd: workspaceDir, stdio: "inherit" });
|
|
264403
|
+
} catch {
|
|
264404
|
+
installSucceeded = false;
|
|
264405
|
+
warn("Dependency install failed. Run the install command manually and then start your dev server.");
|
|
264406
|
+
}
|
|
264407
|
+
}
|
|
264408
|
+
if (installSucceeded) {
|
|
264409
|
+
executeCommandPipeline(scaffoldResult.scaffolding.commands, {
|
|
264410
|
+
workspaceDir,
|
|
264411
|
+
packageManager: manifest.workspace.packageManager,
|
|
264412
|
+
dryRun: context.dryRun
|
|
264413
|
+
});
|
|
264414
|
+
}
|
|
264221
264415
|
const infraResult = await provisionInfrastructure({
|
|
264222
264416
|
llmClient,
|
|
264223
264417
|
mcpClient,
|
|
@@ -264236,7 +264430,7 @@ async function createCommand2(context, _args) {
|
|
|
264236
264430
|
});
|
|
264237
264431
|
logger.cmd("/create", "SUCCESS");
|
|
264238
264432
|
success(`App ${selections.appName} created.`);
|
|
264239
|
-
if (existsSync16(appDir)) {
|
|
264433
|
+
if (existsSync16(appDir) && installSucceeded) {
|
|
264240
264434
|
const runCmd = getCommand(manifest.workspace.packageManager, "run");
|
|
264241
264435
|
const scriptResolution = resolveDevScript(appDir);
|
|
264242
264436
|
if (scriptResolution.found) {
|
|
@@ -264263,8 +264457,11 @@ async function createCommand2(context, _args) {
|
|
|
264263
264457
|
}
|
|
264264
264458
|
|
|
264265
264459
|
// src/commands/delete.ts
|
|
264460
|
+
init_dist2();
|
|
264461
|
+
init_logger();
|
|
264266
264462
|
import { rmSync as rmSync4 } from "node:fs";
|
|
264267
264463
|
import { join as join19 } from "node:path";
|
|
264464
|
+
init_display();
|
|
264268
264465
|
function removePackages(manifest, packageNames) {
|
|
264269
264466
|
const nextPackages = { ...manifest.packages };
|
|
264270
264467
|
for (const name of packageNames) {
|
|
@@ -264273,7 +264470,11 @@ function removePackages(manifest, packageNames) {
|
|
|
264273
264470
|
return { ...manifest, packages: nextPackages };
|
|
264274
264471
|
}
|
|
264275
264472
|
async function deleteCommand(context, args) {
|
|
264276
|
-
const workspaceDir =
|
|
264473
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264474
|
+
if (!workspaceDir) {
|
|
264475
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264476
|
+
return;
|
|
264477
|
+
}
|
|
264277
264478
|
if (!isKittWorkspace(workspaceDir)) {
|
|
264278
264479
|
error("Not a KITT workspace.");
|
|
264279
264480
|
return;
|
|
@@ -264339,11 +264540,15 @@ async function deleteCommand(context, args) {
|
|
|
264339
264540
|
}
|
|
264340
264541
|
|
|
264341
264542
|
// src/commands/deploy.ts
|
|
264342
|
-
|
|
264343
|
-
|
|
264543
|
+
init_dist2();
|
|
264544
|
+
init_logger();
|
|
264344
264545
|
init_config();
|
|
264546
|
+
import { existsSync as existsSync17, readdirSync as readdirSync4, readFileSync as readFileSync12, writeFileSync as writeFileSync13 } from "node:fs";
|
|
264547
|
+
import { basename as basename2, join as join20 } from "node:path";
|
|
264548
|
+
init_lifecycle();
|
|
264345
264549
|
|
|
264346
264550
|
// src/mcp/project-guard.ts
|
|
264551
|
+
init_logger();
|
|
264347
264552
|
function createProjectGuard(projectId) {
|
|
264348
264553
|
const auditLogger5 = createAuditLogger(".");
|
|
264349
264554
|
const validateProjectId = (args) => {
|
|
@@ -264371,6 +264576,7 @@ function createProjectGuard(projectId) {
|
|
|
264371
264576
|
}
|
|
264372
264577
|
|
|
264373
264578
|
// src/commands/deploy.ts
|
|
264579
|
+
init_display();
|
|
264374
264580
|
var SECRET_PATTERNS = [
|
|
264375
264581
|
"SECRET",
|
|
264376
264582
|
"KEY",
|
|
@@ -264446,7 +264652,7 @@ function listEnvFiles(workspaceDir) {
|
|
|
264446
264652
|
if (!currentDir) {
|
|
264447
264653
|
continue;
|
|
264448
264654
|
}
|
|
264449
|
-
const entries =
|
|
264655
|
+
const entries = readdirSync4(currentDir, { withFileTypes: true });
|
|
264450
264656
|
for (const entry of entries) {
|
|
264451
264657
|
const entryPath = join20(currentDir, entry.name);
|
|
264452
264658
|
const relativePath = normalizePathForMatch(entryPath.replace(`${workspaceDir}/`, ""));
|
|
@@ -264482,9 +264688,9 @@ function scanEnvFilesForSecrets(workspaceDir) {
|
|
|
264482
264688
|
}
|
|
264483
264689
|
function getSelectedApps(args, manifest) {
|
|
264484
264690
|
const appNames = Object.keys(manifest.apps);
|
|
264485
|
-
const selectionArg = args[0] ?? "";
|
|
264691
|
+
const selectionArg = (args[0] ?? "").toLowerCase();
|
|
264486
264692
|
if (selectionArg.length > 0) {
|
|
264487
|
-
if (selectionArg
|
|
264693
|
+
if (selectionArg === "all") {
|
|
264488
264694
|
return appNames;
|
|
264489
264695
|
}
|
|
264490
264696
|
if (!manifest.apps[selectionArg]) {
|
|
@@ -264549,7 +264755,11 @@ function ensureRailwayToml(appName, framework, packageManager) {
|
|
|
264549
264755
|
return true;
|
|
264550
264756
|
}
|
|
264551
264757
|
async function deployTemplateCommand(context, args) {
|
|
264552
|
-
const workspaceDir =
|
|
264758
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264759
|
+
if (!workspaceDir) {
|
|
264760
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264761
|
+
return;
|
|
264762
|
+
}
|
|
264553
264763
|
const logger = createAuditLogger(workspaceDir);
|
|
264554
264764
|
logger.cmd("/deploy:template", "START");
|
|
264555
264765
|
if (!isKittWorkspace(workspaceDir)) {
|
|
@@ -264630,7 +264840,11 @@ async function deployCommand(context, args, commandKey) {
|
|
|
264630
264840
|
await deployTemplateCommand(context, args);
|
|
264631
264841
|
return;
|
|
264632
264842
|
}
|
|
264633
|
-
const workspaceDir =
|
|
264843
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
264844
|
+
if (!workspaceDir) {
|
|
264845
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
264846
|
+
return;
|
|
264847
|
+
}
|
|
264634
264848
|
const logger = createAuditLogger(workspaceDir);
|
|
264635
264849
|
logger.cmd("/deploy", "START");
|
|
264636
264850
|
if (!isKittWorkspace(workspaceDir)) {
|
|
@@ -264736,7 +264950,11 @@ async function deployCommand(context, args, commandKey) {
|
|
|
264736
264950
|
}
|
|
264737
264951
|
|
|
264738
264952
|
// src/commands/env.ts
|
|
264953
|
+
init_dist2();
|
|
264954
|
+
init_logger();
|
|
264739
264955
|
init_config();
|
|
264956
|
+
init_lifecycle();
|
|
264957
|
+
init_display();
|
|
264740
264958
|
async function validateCommandPrerequisites(workspaceDir) {
|
|
264741
264959
|
if (!isKittWorkspace(workspaceDir)) {
|
|
264742
264960
|
error("Not a KITT workspace.");
|
|
@@ -264797,7 +265015,11 @@ async function runLlmOperations(command, args, manifest, projectId) {
|
|
|
264797
265015
|
}
|
|
264798
265016
|
}
|
|
264799
265017
|
async function envCreateCommand(context, args) {
|
|
264800
|
-
const workspaceDir =
|
|
265018
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
265019
|
+
if (!workspaceDir) {
|
|
265020
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
265021
|
+
return;
|
|
265022
|
+
}
|
|
264801
265023
|
const logger = createAuditLogger(workspaceDir);
|
|
264802
265024
|
logger.cmd("/env:create", "START");
|
|
264803
265025
|
const prereqs = await validateCommandPrerequisites(workspaceDir);
|
|
@@ -264832,7 +265054,11 @@ async function envCreateCommand(context, args) {
|
|
|
264832
265054
|
}
|
|
264833
265055
|
}
|
|
264834
265056
|
async function envVarsCommand(context, args) {
|
|
264835
|
-
const workspaceDir =
|
|
265057
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
265058
|
+
if (!workspaceDir) {
|
|
265059
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
265060
|
+
return;
|
|
265061
|
+
}
|
|
264836
265062
|
const logger = createAuditLogger(workspaceDir);
|
|
264837
265063
|
logger.cmd("/env:vars", "START");
|
|
264838
265064
|
const prereqs = await validateCommandPrerequisites(workspaceDir);
|
|
@@ -264877,9 +265103,17 @@ async function envCommand(context, args, commandKey) {
|
|
|
264877
265103
|
}
|
|
264878
265104
|
|
|
264879
265105
|
// src/commands/domain.ts
|
|
265106
|
+
init_dist2();
|
|
265107
|
+
init_logger();
|
|
264880
265108
|
init_config();
|
|
265109
|
+
init_lifecycle();
|
|
265110
|
+
init_display();
|
|
264881
265111
|
async function domainCommand(_context, args, _commandKey) {
|
|
264882
|
-
const workspaceDir =
|
|
265112
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
265113
|
+
if (!workspaceDir) {
|
|
265114
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
265115
|
+
return;
|
|
265116
|
+
}
|
|
264883
265117
|
const logger = createAuditLogger(workspaceDir);
|
|
264884
265118
|
logger.cmd("/domain", "START");
|
|
264885
265119
|
if (!isKittWorkspace(workspaceDir)) {
|
|
@@ -264960,9 +265194,17 @@ async function domainCommand(_context, args, _commandKey) {
|
|
|
264960
265194
|
}
|
|
264961
265195
|
|
|
264962
265196
|
// src/commands/logs.ts
|
|
265197
|
+
init_dist2();
|
|
265198
|
+
init_logger();
|
|
264963
265199
|
init_config();
|
|
265200
|
+
init_lifecycle();
|
|
265201
|
+
init_display();
|
|
264964
265202
|
async function logsCommand(_context, args, _commandKey) {
|
|
264965
|
-
const workspaceDir =
|
|
265203
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
265204
|
+
if (!workspaceDir) {
|
|
265205
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
265206
|
+
return;
|
|
265207
|
+
}
|
|
264966
265208
|
const logger = createAuditLogger(workspaceDir);
|
|
264967
265209
|
logger.cmd("/logs", "START");
|
|
264968
265210
|
if (!isKittWorkspace(workspaceDir)) {
|
|
@@ -265043,24 +265285,25 @@ async function logsCommand(_context, args, _commandKey) {
|
|
|
265043
265285
|
}
|
|
265044
265286
|
|
|
265045
265287
|
// src/commands/status.ts
|
|
265046
|
-
|
|
265288
|
+
init_logger();
|
|
265047
265289
|
init_config();
|
|
265290
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
265048
265291
|
|
|
265049
265292
|
// src/manifest/drift.ts
|
|
265050
|
-
import { existsSync as existsSync18, readdirSync as
|
|
265293
|
+
import { existsSync as existsSync18, readdirSync as readdirSync5 } from "node:fs";
|
|
265051
265294
|
import { join as join21 } from "node:path";
|
|
265052
265295
|
function listDirectories(parentDir) {
|
|
265053
265296
|
if (!existsSync18(parentDir)) {
|
|
265054
265297
|
return [];
|
|
265055
265298
|
}
|
|
265056
|
-
return
|
|
265299
|
+
return readdirSync5(parentDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort((left, right) => left.localeCompare(right, "en"));
|
|
265057
265300
|
}
|
|
265058
265301
|
function detectSegmentDrift(options) {
|
|
265059
265302
|
const { workspaceDir, segment, manifestEntries } = options;
|
|
265060
265303
|
const segmentDir = join21(workspaceDir, segment);
|
|
265061
265304
|
const diskDirectories = listDirectories(segmentDir);
|
|
265062
265305
|
const diskSet = new Set(diskDirectories);
|
|
265063
|
-
const manifestNames = Object.keys(manifestEntries).sort((left, right) => left.localeCompare(right));
|
|
265306
|
+
const manifestNames = Object.keys(manifestEntries).sort((left, right) => left.localeCompare(right, "en"));
|
|
265064
265307
|
const orphanedDirectories = diskDirectories.filter((dirName) => !Object.prototype.hasOwnProperty.call(manifestEntries, dirName)).map((dirName) => `${segment}/${dirName}`);
|
|
265065
265308
|
const missingDirectories = manifestNames.filter((entryName) => !diskSet.has(entryName)).map((entryName) => `${segment}/${entryName}`);
|
|
265066
265309
|
return {
|
|
@@ -265086,8 +265329,36 @@ function detectDrift(workspaceDir, manifest) {
|
|
|
265086
265329
|
}
|
|
265087
265330
|
|
|
265088
265331
|
// src/commands/status.ts
|
|
265332
|
+
init_lifecycle();
|
|
265333
|
+
init_display();
|
|
265089
265334
|
async function statusCommand(_context, _args, _commandKey) {
|
|
265090
|
-
const
|
|
265335
|
+
const directWorkspace = findWorkspaceRoot(process.cwd());
|
|
265336
|
+
if (!directWorkspace) {
|
|
265337
|
+
const children = getChildWorkspaces(process.cwd());
|
|
265338
|
+
if (children.length === 0) {
|
|
265339
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
265340
|
+
return;
|
|
265341
|
+
}
|
|
265342
|
+
console.log("");
|
|
265343
|
+
info(`${import_picocolors7.default.bold("KITT Workspaces")} ${import_picocolors7.default.dim(`(${children.length} found)`)}`);
|
|
265344
|
+
console.log("");
|
|
265345
|
+
for (const child of children) {
|
|
265346
|
+
const m2 = child.manifest;
|
|
265347
|
+
const appCount = Object.keys(m2.apps).length;
|
|
265348
|
+
const appLabel = `${appCount} app${appCount !== 1 ? "s" : ""}`;
|
|
265349
|
+
const railway = m2.workspace.railway?.projectId ? import_picocolors7.default.green("● linked") : import_picocolors7.default.dim("○ unlinked");
|
|
265350
|
+
info(` ${import_picocolors7.default.bold(import_picocolors7.default.white(m2.workspace.name))} ${import_picocolors7.default.dim(appLabel)} ${railway} ${import_picocolors7.default.dim(m2.workspace.packageManager)}`);
|
|
265351
|
+
if (appCount > 0) {
|
|
265352
|
+
for (const [name, app] of Object.entries(m2.apps)) {
|
|
265353
|
+
const typeTag = app.type === "frontend" ? import_picocolors7.default.cyan("frontend") : import_picocolors7.default.magenta("backend");
|
|
265354
|
+
info(` ${import_picocolors7.default.dim("·")} ${name} ${typeTag} ${import_picocolors7.default.dim(app.framework)}`);
|
|
265355
|
+
}
|
|
265356
|
+
}
|
|
265357
|
+
}
|
|
265358
|
+
console.log("");
|
|
265359
|
+
return;
|
|
265360
|
+
}
|
|
265361
|
+
const workspaceDir = directWorkspace;
|
|
265091
265362
|
const logger = createAuditLogger(workspaceDir);
|
|
265092
265363
|
logger.cmd("/status", "START");
|
|
265093
265364
|
if (!isKittWorkspace(workspaceDir)) {
|
|
@@ -265163,11 +265434,12 @@ async function statusCommand(_context, _args, _commandKey) {
|
|
|
265163
265434
|
}
|
|
265164
265435
|
|
|
265165
265436
|
// src/commands/login.ts
|
|
265437
|
+
init_dist2();
|
|
265438
|
+
init_config();
|
|
265439
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
265166
265440
|
import { existsSync as existsSync19, readFileSync as readFileSync13 } from "node:fs";
|
|
265167
265441
|
import { homedir as homedir5 } from "node:os";
|
|
265168
265442
|
import { join as join22 } from "node:path";
|
|
265169
|
-
init_config();
|
|
265170
|
-
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
265171
265443
|
var PROVIDER_LABELS = {
|
|
265172
265444
|
anthropic: "Anthropic",
|
|
265173
265445
|
openai: "OpenAI",
|
|
@@ -265197,12 +265469,10 @@ var MODEL_OPTIONS = {
|
|
|
265197
265469
|
]
|
|
265198
265470
|
};
|
|
265199
265471
|
var COPILOT_MODEL_OPTIONS = [
|
|
265200
|
-
{ value: "claude-
|
|
265201
|
-
{ value: "
|
|
265202
|
-
{ value: "claude-
|
|
265203
|
-
{ value: "claude-opus-4.
|
|
265204
|
-
{ value: "gpt-4.1", label: "gpt-4.1 (GPT-4.1 via Copilot)" },
|
|
265205
|
-
{ value: "gemini-2.5-pro", label: "gemini-2.5-pro (Gemini 2.5 Pro via Copilot)" }
|
|
265472
|
+
{ value: "claude-haiku-4.5", label: "claude-haiku-4.5 (recommended — enabled for all Copilot plans)" },
|
|
265473
|
+
{ value: "gpt-4.1", label: "gpt-4.1 (GPT-4.1 — enabled for all Copilot plans)" },
|
|
265474
|
+
{ value: "claude-sonnet-4.6", label: "claude-sonnet-4.6 (requires opt-in at github.com/settings/copilot)" },
|
|
265475
|
+
{ value: "claude-opus-4.6", label: "claude-opus-4.6 (requires opt-in at github.com/settings/copilot)" }
|
|
265206
265476
|
];
|
|
265207
265477
|
var GITHUB_DEVICE_CLIENT_ID = "Iv1.b507a08c87ecfe98";
|
|
265208
265478
|
function cancelled() {
|
|
@@ -265315,7 +265585,7 @@ async function runGitHubDeviceFlow() {
|
|
|
265315
265585
|
const intervalMs = (codeData.interval ?? 5) * 1000;
|
|
265316
265586
|
const expiresAt = Date.now() + (codeData.expires_in ?? 900) * 1000;
|
|
265317
265587
|
while (Date.now() < expiresAt) {
|
|
265318
|
-
await new Promise((
|
|
265588
|
+
await new Promise((resolve7) => setTimeout(resolve7, intervalMs));
|
|
265319
265589
|
const tokenRes = await fetch("https://github.com/login/oauth/access_token", {
|
|
265320
265590
|
method: "POST",
|
|
265321
265591
|
headers: {
|
|
@@ -265338,7 +265608,7 @@ async function runGitHubDeviceFlow() {
|
|
|
265338
265608
|
continue;
|
|
265339
265609
|
}
|
|
265340
265610
|
if (tokenData.error === "slow_down") {
|
|
265341
|
-
await new Promise((
|
|
265611
|
+
await new Promise((resolve7) => setTimeout(resolve7, intervalMs));
|
|
265342
265612
|
continue;
|
|
265343
265613
|
}
|
|
265344
265614
|
console.log(import_picocolors8.default.red(tokenData.error_description ?? `GitHub login failed: ${tokenData.error}`));
|
|
@@ -265634,9 +265904,12 @@ async function loginCommand(context, args, commandKey = "login") {
|
|
|
265634
265904
|
}
|
|
265635
265905
|
|
|
265636
265906
|
// src/commands/versions.ts
|
|
265907
|
+
init_dist2();
|
|
265908
|
+
init_logger();
|
|
265909
|
+
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
265637
265910
|
import { existsSync as existsSync20, readFileSync as readFileSync14, writeFileSync as writeFileSync14 } from "node:fs";
|
|
265638
265911
|
import { join as join23 } from "node:path";
|
|
265639
|
-
|
|
265912
|
+
init_display();
|
|
265640
265913
|
var TABLE_HEADER_INTEGRATION = "Integration";
|
|
265641
265914
|
var TABLE_HEADER_VERSION = "Version";
|
|
265642
265915
|
var REGISTRY_TABLE_HEADER_CURRENT = "Current";
|
|
@@ -265671,9 +265944,9 @@ function formatRegistryTable(results) {
|
|
|
265671
265944
|
}
|
|
265672
265945
|
return rows;
|
|
265673
265946
|
}
|
|
265674
|
-
function loadVersionsContext(logger) {
|
|
265675
|
-
const workspaceDir =
|
|
265676
|
-
if (!isKittWorkspace(workspaceDir)) {
|
|
265947
|
+
async function loadVersionsContext(logger) {
|
|
265948
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
265949
|
+
if (!workspaceDir || !isKittWorkspace(workspaceDir)) {
|
|
265677
265950
|
error("Not a KITT workspace. Run /init first.");
|
|
265678
265951
|
logger.cmd("/versions", "FAILED", "not a workspace");
|
|
265679
265952
|
return null;
|
|
@@ -265701,7 +265974,7 @@ function writeVersionsFiles(versionsContext, entries) {
|
|
|
265701
265974
|
writeVersionsLock(versionsContext.workspaceDir, hash);
|
|
265702
265975
|
}
|
|
265703
265976
|
async function runRegistryCheck(logger, commandName) {
|
|
265704
|
-
const versionsContext = loadVersionsContext(logger);
|
|
265977
|
+
const versionsContext = await loadVersionsContext(logger);
|
|
265705
265978
|
if (versionsContext === null) {
|
|
265706
265979
|
return null;
|
|
265707
265980
|
}
|
|
@@ -265728,7 +266001,7 @@ async function runRegistryCheck(logger, commandName) {
|
|
|
265728
266001
|
};
|
|
265729
266002
|
}
|
|
265730
266003
|
async function runVersionsBaseCommand(logger) {
|
|
265731
|
-
const versionsContext = loadVersionsContext(logger);
|
|
266004
|
+
const versionsContext = await loadVersionsContext(logger);
|
|
265732
266005
|
if (versionsContext === null) {
|
|
265733
266006
|
return;
|
|
265734
266007
|
}
|
|
@@ -265828,7 +266101,7 @@ async function runVersionsSetCommand(logger, commandKey, args) {
|
|
|
265828
266101
|
logger.cmd("/versions", "FAILED", `/versions set invalid semver: ${version}`);
|
|
265829
266102
|
return;
|
|
265830
266103
|
}
|
|
265831
|
-
const versionsContext = loadVersionsContext(logger);
|
|
266104
|
+
const versionsContext = await loadVersionsContext(logger);
|
|
265832
266105
|
if (versionsContext === null) {
|
|
265833
266106
|
return;
|
|
265834
266107
|
}
|
|
@@ -265845,8 +266118,8 @@ async function runVersionsSetCommand(logger, commandKey, args) {
|
|
|
265845
266118
|
logger.cmd("/versions", "SUCCESS", `/versions set pinned ${integration} to ${version}`);
|
|
265846
266119
|
}
|
|
265847
266120
|
async function versionsCommand(_context, args, commandKey) {
|
|
265848
|
-
const workspaceDir =
|
|
265849
|
-
const logger = createAuditLogger(workspaceDir);
|
|
266121
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
266122
|
+
const logger = createAuditLogger(workspaceDir ?? ".");
|
|
265850
266123
|
const sub = resolveSubcommand(commandKey, args);
|
|
265851
266124
|
if (!sub || sub === "list") {
|
|
265852
266125
|
await runVersionsBaseCommand(logger);
|
|
@@ -265868,9 +266141,14 @@ async function versionsCommand(_context, args, commandKey) {
|
|
|
265868
266141
|
}
|
|
265869
266142
|
|
|
265870
266143
|
// src/commands/list.ts
|
|
266144
|
+
init_display();
|
|
265871
266145
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
265872
266146
|
async function listCommand(_context, _args, _commandKey) {
|
|
265873
|
-
const workspaceDir =
|
|
266147
|
+
const workspaceDir = await resolveWorkspaceDir(process.cwd());
|
|
266148
|
+
if (!workspaceDir) {
|
|
266149
|
+
error("No KITT workspace found. Run /init to create one, or /switch to select an existing workspace.");
|
|
266150
|
+
return;
|
|
266151
|
+
}
|
|
265874
266152
|
if (!isKittWorkspace(workspaceDir)) {
|
|
265875
266153
|
error("Not a KITT workspace. Run /init first.");
|
|
265876
266154
|
return;
|
|
@@ -266003,31 +266281,102 @@ function renderPackages(pkgs) {
|
|
|
266003
266281
|
}
|
|
266004
266282
|
}
|
|
266005
266283
|
|
|
266006
|
-
// src/commands/
|
|
266284
|
+
// src/commands/switch.ts
|
|
266285
|
+
init_dist2();
|
|
266007
266286
|
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
266287
|
+
init_display();
|
|
266288
|
+
async function switchCommand(_context, args) {
|
|
266289
|
+
const cwd = process.cwd();
|
|
266290
|
+
const currentWorkspace = findWorkspaceRoot(cwd);
|
|
266291
|
+
const children = findChildWorkspaces(cwd);
|
|
266292
|
+
if (currentWorkspace) {
|
|
266293
|
+
const { dirname: dirname5 } = await import("node:path");
|
|
266294
|
+
const parentDir = dirname5(currentWorkspace);
|
|
266295
|
+
const siblings = findChildWorkspaces(parentDir);
|
|
266296
|
+
for (const sibling of siblings) {
|
|
266297
|
+
if (!children.some((c) => c.path === sibling.path)) {
|
|
266298
|
+
children.push(sibling);
|
|
266299
|
+
}
|
|
266300
|
+
}
|
|
266301
|
+
}
|
|
266302
|
+
if (children.length === 0 && !currentWorkspace) {
|
|
266303
|
+
error("No KITT workspaces found. Run /init to create one.");
|
|
266304
|
+
return;
|
|
266305
|
+
}
|
|
266306
|
+
const activePath = currentWorkspace ?? null;
|
|
266307
|
+
const options = children.map((child) => {
|
|
266308
|
+
const m2 = child.manifest;
|
|
266309
|
+
const appCount = Object.keys(m2.apps).length;
|
|
266310
|
+
const isActive = child.path === activePath;
|
|
266311
|
+
const label = isActive ? `${m2.workspace.name} ${import_picocolors11.default.green("(active)")}` : m2.workspace.name;
|
|
266312
|
+
const hint = `${appCount} app${appCount !== 1 ? "s" : ""} · ${m2.workspace.packageManager}`;
|
|
266313
|
+
return { value: child.path, label, hint };
|
|
266314
|
+
});
|
|
266315
|
+
if (options.length === 0) {
|
|
266316
|
+
info("Only one workspace available — already active.");
|
|
266317
|
+
return;
|
|
266318
|
+
}
|
|
266319
|
+
if (options.length === 1 && options[0].value === activePath) {
|
|
266320
|
+
info("Only one workspace available — already active.");
|
|
266321
|
+
return;
|
|
266322
|
+
}
|
|
266323
|
+
let targetPath = null;
|
|
266324
|
+
if (args[0]) {
|
|
266325
|
+
const name2 = args[0].toLowerCase();
|
|
266326
|
+
const match = children.find((c) => c.manifest.workspace.name.toLowerCase() === name2);
|
|
266327
|
+
if (match) {
|
|
266328
|
+
targetPath = match.path;
|
|
266329
|
+
} else {
|
|
266330
|
+
error(`Workspace "${args[0]}" not found.`);
|
|
266331
|
+
return;
|
|
266332
|
+
}
|
|
266333
|
+
} else {
|
|
266334
|
+
const selection = await ve({
|
|
266335
|
+
message: "Switch to workspace:",
|
|
266336
|
+
options
|
|
266337
|
+
});
|
|
266338
|
+
if (pD(selection)) {
|
|
266339
|
+
warn("Switch cancelled.");
|
|
266340
|
+
return;
|
|
266341
|
+
}
|
|
266342
|
+
targetPath = selection;
|
|
266343
|
+
}
|
|
266344
|
+
if (!targetPath || !isKittWorkspace(targetPath)) {
|
|
266345
|
+
error("Invalid workspace path.");
|
|
266346
|
+
return;
|
|
266347
|
+
}
|
|
266348
|
+
process.chdir(targetPath);
|
|
266349
|
+
setGlobalWorkspacePath(targetPath);
|
|
266350
|
+
const manifest = readManifest(targetPath);
|
|
266351
|
+
const name = manifest?.workspace.name ?? targetPath;
|
|
266352
|
+
success(`Switched to ${import_picocolors11.default.cyan(name)}`);
|
|
266353
|
+
}
|
|
266354
|
+
|
|
266355
|
+
// src/commands/help.ts
|
|
266356
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
266008
266357
|
var W3 = 56;
|
|
266009
266358
|
function box(lines) {
|
|
266010
|
-
console.log(` ${
|
|
266359
|
+
console.log(` ${import_picocolors12.default.dim("╭" + "─".repeat(W3) + "╮")}`);
|
|
266011
266360
|
for (const line of lines) {
|
|
266012
|
-
console.log(` ${
|
|
266361
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${line}`);
|
|
266013
266362
|
}
|
|
266014
|
-
console.log(` ${
|
|
266363
|
+
console.log(` ${import_picocolors12.default.dim("╰" + "─".repeat(W3) + "╯")}`);
|
|
266015
266364
|
}
|
|
266016
266365
|
function divider(label) {
|
|
266017
266366
|
const pad = W3 - 2 - label.length;
|
|
266018
|
-
console.log(` ${
|
|
266367
|
+
console.log(` ${import_picocolors12.default.dim("┌─")} ${import_picocolors12.default.bold(import_picocolors12.default.white(label))} ${import_picocolors12.default.dim("─".repeat(Math.max(0, pad)) + "┐")}`);
|
|
266019
266368
|
}
|
|
266020
266369
|
function cmd(command, argHint, desc) {
|
|
266021
266370
|
const raw = `${command} ${argHint}`;
|
|
266022
266371
|
const p2 = Math.max(0, 28 - raw.length);
|
|
266023
|
-
const argPart = argHint ? ` ${
|
|
266024
|
-
console.log(` ${
|
|
266372
|
+
const argPart = argHint ? ` ${import_picocolors12.default.dim(import_picocolors12.default.italic(argHint))}` : "";
|
|
266373
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.cyan(command)}${argPart}${" ".repeat(p2)} ${import_picocolors12.default.dim(desc)}`);
|
|
266025
266374
|
}
|
|
266026
266375
|
function row(label, value) {
|
|
266027
|
-
console.log(` ${
|
|
266376
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim(label.padEnd(14))} ${import_picocolors12.default.white(value)}`);
|
|
266028
266377
|
}
|
|
266029
266378
|
function sectionEnd() {
|
|
266030
|
-
console.log(` ${
|
|
266379
|
+
console.log(` ${import_picocolors12.default.dim("└" + "─".repeat(W3))}`);
|
|
266031
266380
|
console.log("");
|
|
266032
266381
|
}
|
|
266033
266382
|
function pad(text, width) {
|
|
@@ -266038,8 +266387,8 @@ function pad(text, width) {
|
|
|
266038
266387
|
function renderHelp() {
|
|
266039
266388
|
console.log("");
|
|
266040
266389
|
box([
|
|
266041
|
-
pad(`${
|
|
266042
|
-
pad(`${
|
|
266390
|
+
pad(`${import_picocolors12.default.bold(import_picocolors12.default.white("KITT"))} ${import_picocolors12.default.dim("— AI-powered monorepo CLI")}`, W3 - 1),
|
|
266391
|
+
pad(`${import_picocolors12.default.dim("scaffold · deploy · manage · iterate")}`, W3 - 1)
|
|
266043
266392
|
]);
|
|
266044
266393
|
console.log("");
|
|
266045
266394
|
divider("Setup");
|
|
@@ -266057,6 +266406,7 @@ function renderHelp() {
|
|
|
266057
266406
|
cmd("/list", "", "List all apps, packages, and Railway services");
|
|
266058
266407
|
cmd("/run", "[appName]", "Start an app dev server");
|
|
266059
266408
|
cmd("/settings", "", "View or update workspace settings");
|
|
266409
|
+
cmd("/switch", "[name]", "Switch active workspace context");
|
|
266060
266410
|
sectionEnd();
|
|
266061
266411
|
divider("Deploy & Infrastructure");
|
|
266062
266412
|
cmd("/deploy", "[appName]", "Deploy an app to Railway");
|
|
@@ -266083,16 +266433,16 @@ function renderHelp() {
|
|
|
266083
266433
|
row("backend", "hono expressjs");
|
|
266084
266434
|
sectionEnd();
|
|
266085
266435
|
divider("Integrations");
|
|
266086
|
-
console.log(` ${
|
|
266087
|
-
console.log(` ${
|
|
266088
|
-
console.log(` ${
|
|
266089
|
-
console.log(` ${
|
|
266090
|
-
console.log(` ${
|
|
266091
|
-
console.log(` ${
|
|
266092
|
-
console.log(` ${
|
|
266093
|
-
console.log(` ${
|
|
266094
|
-
console.log(` ${
|
|
266095
|
-
console.log(` ${
|
|
266436
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("databases")} ${[import_picocolors12.default.blue("[postgresql]"), import_picocolors12.default.blue("[mysql]"), import_picocolors12.default.blue("[sqlite]")].join(" ")}`);
|
|
266437
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("orm")} ${[import_picocolors12.default.cyan("[drizzle]"), import_picocolors12.default.cyan("[prisma]")].join(" ")}`);
|
|
266438
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("auth")} ${import_picocolors12.default.yellow("[better-auth]")}`);
|
|
266439
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("payments")} ${[import_picocolors12.default.green("[stripe]"), import_picocolors12.default.green("[polar]")].join(" ")}`);
|
|
266440
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("email")} ${import_picocolors12.default.magenta("[resend]")}`);
|
|
266441
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("queues")} ${[import_picocolors12.default.red("[bullmq]"), import_picocolors12.default.red("[trigger-dev]")].join(" ")}`);
|
|
266442
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("cache")} ${import_picocolors12.default.red("[redis]")}`);
|
|
266443
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("ui")} ${[import_picocolors12.default.cyan("[tailwindcss]"), import_picocolors12.default.white("[shadcn]")].join(" ")}`);
|
|
266444
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("analytics")} ${[import_picocolors12.default.green("[posthog]"), import_picocolors12.default.red("[sentry]")].join(" ")}`);
|
|
266445
|
+
console.log(` ${import_picocolors12.default.dim("│")} ${import_picocolors12.default.dim("testing")} ${[import_picocolors12.default.yellow("[vitest]"), import_picocolors12.default.cyan("[playwright]"), import_picocolors12.default.magenta("[storybook]")].join(" ")}`);
|
|
266096
266446
|
sectionEnd();
|
|
266097
266447
|
divider("CLI Flags");
|
|
266098
266448
|
row("--verbose", "Enable verbose logging");
|
|
@@ -266113,7 +266463,7 @@ async function helpCommand(_context, _args) {
|
|
|
266113
266463
|
// package.json
|
|
266114
266464
|
var package_default = {
|
|
266115
266465
|
name: "openkitt",
|
|
266116
|
-
version: "0.3.
|
|
266466
|
+
version: "0.3.18",
|
|
266117
266467
|
description: "AI-powered monorepo scaffolding CLI",
|
|
266118
266468
|
keywords: [
|
|
266119
266469
|
"cli",
|
|
@@ -266146,9 +266496,11 @@ var package_default = {
|
|
|
266146
266496
|
build: "bun build src/cli.ts --target=node --outfile=dist/cli.js",
|
|
266147
266497
|
"build:types": "tsc --noEmit",
|
|
266148
266498
|
dev: "bun build src/cli.ts --target=node --outfile=dist/cli.js --watch",
|
|
266499
|
+
kitt: "node dist/cli.js",
|
|
266149
266500
|
test: "vitest run",
|
|
266150
266501
|
"test:watch": "vitest",
|
|
266151
|
-
|
|
266502
|
+
"test:e2e": "npm run build && vitest run --config vitest.config.e2e.ts",
|
|
266503
|
+
"test:all": "npm run test && npm run test:e2e"
|
|
266152
266504
|
},
|
|
266153
266505
|
engines: {
|
|
266154
266506
|
node: ">=20.0.0"
|
|
@@ -266204,18 +266556,38 @@ var commandRegistry = {
|
|
|
266204
266556
|
versions: { handler: versionsCommand },
|
|
266205
266557
|
list: { handler: listCommand },
|
|
266206
266558
|
run: { handler: runCommand },
|
|
266207
|
-
help: { handler: helpCommand }
|
|
266559
|
+
help: { handler: helpCommand },
|
|
266560
|
+
switch: { handler: switchCommand }
|
|
266208
266561
|
};
|
|
266209
266562
|
function displayBanner() {
|
|
266210
|
-
console.log(
|
|
266211
|
-
console.log(
|
|
266212
|
-
console.log(
|
|
266213
|
-
console.log(
|
|
266214
|
-
console.log(
|
|
266563
|
+
console.log(import_picocolors13.default.cyan(" ______ _______________________"));
|
|
266564
|
+
console.log(import_picocolors13.default.cyan(" ___ //_/___ /__ __/__ __/"));
|
|
266565
|
+
console.log(import_picocolors13.default.cyan(" __ ,< __ / __ / __ / "));
|
|
266566
|
+
console.log(import_picocolors13.default.cyan(" _ /| | __/ / _ / _ / "));
|
|
266567
|
+
console.log(import_picocolors13.default.cyan(" /_/ |_| /___/ /_/ /_/ "));
|
|
266215
266568
|
console.log("");
|
|
266216
|
-
console.log(` ${
|
|
266217
|
-
console.log(` ${
|
|
266218
|
-
console.log(` ${
|
|
266569
|
+
console.log(` ${import_picocolors13.default.bold(import_picocolors13.default.white("KITT"))} ${import_picocolors13.default.dim("v" + APP_VERSION)} ${import_picocolors13.default.dim("— AI-Powered App Scaffolding CLI")}`);
|
|
266570
|
+
console.log(` ${import_picocolors13.default.dim("/login → /init → /create → /deploy → /publish")}`);
|
|
266571
|
+
console.log(` ${import_picocolors13.default.dim("Type /help for all commands")}`);
|
|
266572
|
+
console.log("");
|
|
266573
|
+
}
|
|
266574
|
+
function displayWorkspaceHint(cwd) {
|
|
266575
|
+
if (findWorkspaceRoot(cwd))
|
|
266576
|
+
return;
|
|
266577
|
+
const children = findChildWorkspaces(cwd);
|
|
266578
|
+
if (children.length === 0)
|
|
266579
|
+
return;
|
|
266580
|
+
const lastActive = getGlobalWorkspacePath();
|
|
266581
|
+
const hasLastActive = !!(lastActive && isKittWorkspace(lastActive));
|
|
266582
|
+
if (children.length === 1) {
|
|
266583
|
+
return;
|
|
266584
|
+
}
|
|
266585
|
+
console.log(` ${import_picocolors13.default.dim(`${children.length} kitt spaces`)}`);
|
|
266586
|
+
if (hasLastActive) {
|
|
266587
|
+
const manifest = readManifest(lastActive);
|
|
266588
|
+
const name = manifest?.workspace.name ?? lastActive;
|
|
266589
|
+
console.log(` ${import_picocolors13.default.dim("Last active:")} ${import_picocolors13.default.cyan(name)}`);
|
|
266590
|
+
}
|
|
266219
266591
|
console.log("");
|
|
266220
266592
|
}
|
|
266221
266593
|
function tokenizeCommand(inputValue) {
|
|
@@ -266246,23 +266618,27 @@ function parseCommand(inputValue) {
|
|
|
266246
266618
|
};
|
|
266247
266619
|
}
|
|
266248
266620
|
function isVersionNewer(latest, current) {
|
|
266249
|
-
const
|
|
266250
|
-
const
|
|
266251
|
-
|
|
266621
|
+
const parse = (value) => {
|
|
266622
|
+
const trimmed = value.trim().replace(/^v/i, "");
|
|
266623
|
+
const [main, ...pre] = trimmed.split("-");
|
|
266624
|
+
return {
|
|
266625
|
+
parts: main.split(".").map((s) => Number.parseInt(s, 10)).map((n) => Number.isFinite(n) ? n : 0),
|
|
266626
|
+
prerelease: pre.length > 0
|
|
266627
|
+
};
|
|
266252
266628
|
};
|
|
266253
|
-
const
|
|
266254
|
-
const
|
|
266255
|
-
const maxLen = Math.max(
|
|
266629
|
+
const l2 = parse(latest);
|
|
266630
|
+
const c = parse(current);
|
|
266631
|
+
const maxLen = Math.max(l2.parts.length, c.parts.length);
|
|
266256
266632
|
for (let index = 0;index < maxLen; index += 1) {
|
|
266257
|
-
const
|
|
266258
|
-
const
|
|
266259
|
-
if (
|
|
266633
|
+
const lp = l2.parts[index] ?? 0;
|
|
266634
|
+
const cp = c.parts[index] ?? 0;
|
|
266635
|
+
if (lp > cp)
|
|
266260
266636
|
return true;
|
|
266261
|
-
|
|
266262
|
-
if (latestPart < currentPart) {
|
|
266637
|
+
if (lp < cp)
|
|
266263
266638
|
return false;
|
|
266264
|
-
}
|
|
266265
266639
|
}
|
|
266640
|
+
if (!l2.prerelease && c.prerelease)
|
|
266641
|
+
return true;
|
|
266266
266642
|
return false;
|
|
266267
266643
|
}
|
|
266268
266644
|
function hasFreshUpdateCache(now) {
|
|
@@ -266353,25 +266729,16 @@ async function dispatchCommand(commandLine, context) {
|
|
|
266353
266729
|
}
|
|
266354
266730
|
const authCheck = await checkAuthGuard(parsed.key);
|
|
266355
266731
|
if (!authCheck.allowed) {
|
|
266356
|
-
console.log(
|
|
266732
|
+
console.log(import_picocolors13.default.red(`✗ ${authCheck.message}`));
|
|
266357
266733
|
return "continue";
|
|
266358
266734
|
}
|
|
266359
|
-
|
|
266360
|
-
process.stdin.setRawMode(false);
|
|
266361
|
-
try {
|
|
266362
|
-
await resolveAndRunHandler(route, context, parsed.args, parsed.key);
|
|
266363
|
-
} finally {
|
|
266364
|
-
if (!process.stdin.destroyed)
|
|
266365
|
-
process.stdin.resume();
|
|
266366
|
-
if (process.stdin.isTTY)
|
|
266367
|
-
process.stdin.setRawMode(true);
|
|
266368
|
-
}
|
|
266735
|
+
await resolveAndRunHandler(route, context, parsed.args, parsed.key);
|
|
266369
266736
|
return "continue";
|
|
266370
266737
|
}
|
|
266371
266738
|
async function runSingleCommand(commandLine, context) {
|
|
266372
266739
|
const parsed = parseCommand(commandLine);
|
|
266373
266740
|
if (parsed && STATE_CHANGING_COMMANDS.has(parsed.key) && !context.yes) {
|
|
266374
|
-
console.log(
|
|
266741
|
+
console.log(import_picocolors13.default.red(`✗ Non-interactive mode requires --yes for state-changing commands.
|
|
266375
266742
|
Usage: npx openkitt --run "${parsed.key}" --yes`));
|
|
266376
266743
|
return 1;
|
|
266377
266744
|
}
|
|
@@ -266418,7 +266785,7 @@ function getBestCompletion(line, registry) {
|
|
|
266418
266785
|
}
|
|
266419
266786
|
function resolvePrompt() {
|
|
266420
266787
|
let workspaceRoot = null;
|
|
266421
|
-
let current =
|
|
266788
|
+
let current = resolve7(process.cwd());
|
|
266422
266789
|
while (true) {
|
|
266423
266790
|
if (isKittWorkspace(current)) {
|
|
266424
266791
|
workspaceRoot = current;
|
|
@@ -266429,17 +266796,57 @@ function resolvePrompt() {
|
|
|
266429
266796
|
break;
|
|
266430
266797
|
current = parent;
|
|
266431
266798
|
}
|
|
266432
|
-
if (
|
|
266799
|
+
if (workspaceRoot) {
|
|
266800
|
+
const manifest = readManifest(workspaceRoot);
|
|
266801
|
+
const name = manifest?.workspace.name;
|
|
266802
|
+
if (name)
|
|
266803
|
+
return `${BASE_PROMPT} ${import_picocolors13.default.cyan(`[${name}]`)} > `;
|
|
266433
266804
|
return `${BASE_PROMPT} > `;
|
|
266434
|
-
|
|
266435
|
-
const
|
|
266436
|
-
if (
|
|
266805
|
+
}
|
|
266806
|
+
const children = findChildWorkspaces(process.cwd());
|
|
266807
|
+
if (children.length === 1) {
|
|
266808
|
+
const name = children[0].manifest.workspace.name;
|
|
266809
|
+
return `${BASE_PROMPT} ${import_picocolors13.default.cyan(`[${name}]`)} > `;
|
|
266810
|
+
}
|
|
266811
|
+
if (children.length > 1) {
|
|
266812
|
+
const lastActive = getGlobalWorkspacePath();
|
|
266813
|
+
if (lastActive && isKittWorkspace(lastActive)) {
|
|
266814
|
+
const manifest = readManifest(lastActive);
|
|
266815
|
+
const name = manifest?.workspace.name;
|
|
266816
|
+
if (name)
|
|
266817
|
+
return `${BASE_PROMPT} ${import_picocolors13.default.cyan(`[${name}]`)} > `;
|
|
266818
|
+
}
|
|
266437
266819
|
return `${BASE_PROMPT} > `;
|
|
266438
|
-
|
|
266820
|
+
}
|
|
266821
|
+
return `${BASE_PROMPT} > `;
|
|
266439
266822
|
}
|
|
266440
266823
|
async function startRepl(context) {
|
|
266441
|
-
|
|
266824
|
+
let rl;
|
|
266442
266825
|
let ghostLen = 0;
|
|
266826
|
+
let replActive = false;
|
|
266827
|
+
let intentionalClose = false;
|
|
266828
|
+
const onKeypress = (_ch, key) => {
|
|
266829
|
+
if (!key || !replActive)
|
|
266830
|
+
return;
|
|
266831
|
+
if (key.name === "tab" && ghostLen > 0 || key.name === "right" && ghostLen > 0) {
|
|
266832
|
+
acceptGhost();
|
|
266833
|
+
return;
|
|
266834
|
+
}
|
|
266835
|
+
if (key.name === "return" || key.name === "enter") {
|
|
266836
|
+
clearGhost();
|
|
266837
|
+
return;
|
|
266838
|
+
}
|
|
266839
|
+
if (key.name === "escape" || key.sequence === "\x03") {
|
|
266840
|
+
clearGhost();
|
|
266841
|
+
return;
|
|
266842
|
+
}
|
|
266843
|
+
setImmediate(() => {
|
|
266844
|
+
if (!replActive)
|
|
266845
|
+
return;
|
|
266846
|
+
const ghost = getBestCompletion(rl.line, commandRegistry);
|
|
266847
|
+
drawGhost(ghost);
|
|
266848
|
+
});
|
|
266849
|
+
};
|
|
266443
266850
|
function drawGhost(ghost) {
|
|
266444
266851
|
if (!process.stdout.isTTY)
|
|
266445
266852
|
return;
|
|
@@ -266466,64 +266873,74 @@ async function startRepl(context) {
|
|
|
266466
266873
|
}
|
|
266467
266874
|
}
|
|
266468
266875
|
}
|
|
266469
|
-
|
|
266470
|
-
|
|
266471
|
-
|
|
266472
|
-
process.stdin.
|
|
266473
|
-
|
|
266474
|
-
|
|
266475
|
-
|
|
266476
|
-
|
|
266876
|
+
function teardownRl() {
|
|
266877
|
+
replActive = false;
|
|
266878
|
+
clearGhost();
|
|
266879
|
+
if (process.stdin.isTTY) {
|
|
266880
|
+
process.stdin.removeListener("keypress", onKeypress);
|
|
266881
|
+
try {
|
|
266882
|
+
process.stdin.setRawMode(false);
|
|
266883
|
+
} catch {}
|
|
266884
|
+
}
|
|
266885
|
+
rl.close();
|
|
266886
|
+
}
|
|
266887
|
+
function setupRl() {
|
|
266888
|
+
rl = createInterface({ input, output, prompt: resolvePrompt(), completer: makeCompleter(commandRegistry) });
|
|
266889
|
+
if (process.stdin.isTTY) {
|
|
266890
|
+
emitKeypressEvents(process.stdin, rl);
|
|
266891
|
+
try {
|
|
266892
|
+
process.stdin.setRawMode(true);
|
|
266893
|
+
} catch {}
|
|
266894
|
+
process.stdin.on("keypress", onKeypress);
|
|
266895
|
+
}
|
|
266896
|
+
rl.on("SIGINT", () => {
|
|
266897
|
+
clearGhost();
|
|
266898
|
+
console.log("Use /exit to quit.");
|
|
266899
|
+
rl.prompt();
|
|
266900
|
+
});
|
|
266901
|
+
rl.on("close", async () => {
|
|
266902
|
+
if (intentionalClose) {
|
|
266903
|
+
const { shutdownMcpServer: shutdownMcpServer2 } = await Promise.resolve().then(() => (init_lifecycle(), exports_lifecycle));
|
|
266904
|
+
await shutdownMcpServer2().catch(() => {});
|
|
266905
|
+
process.exitCode = 0;
|
|
266477
266906
|
return;
|
|
266478
266907
|
}
|
|
266479
|
-
if (
|
|
266480
|
-
|
|
266481
|
-
|
|
266908
|
+
if (replActive) {
|
|
266909
|
+
replActive = false;
|
|
266910
|
+
try {
|
|
266911
|
+
if (!process.stdin.destroyed)
|
|
266912
|
+
process.stdin.resume();
|
|
266913
|
+
setupRl();
|
|
266914
|
+
rl.prompt();
|
|
266915
|
+
} catch {}
|
|
266482
266916
|
}
|
|
266483
|
-
|
|
266484
|
-
|
|
266485
|
-
|
|
266917
|
+
});
|
|
266918
|
+
rl.on("line", async (line) => {
|
|
266919
|
+
clearGhost();
|
|
266920
|
+
teardownRl();
|
|
266921
|
+
try {
|
|
266922
|
+
const result = await dispatchCommand(line, context);
|
|
266923
|
+
if (result === "exit") {
|
|
266924
|
+
intentionalClose = true;
|
|
266925
|
+
const activeOnExit = findWorkspaceRoot(process.cwd());
|
|
266926
|
+
if (activeOnExit)
|
|
266927
|
+
setGlobalWorkspacePath(activeOnExit);
|
|
266928
|
+
const { shutdownMcpServer: shutdownMcpServer2 } = await Promise.resolve().then(() => (init_lifecycle(), exports_lifecycle));
|
|
266929
|
+
await shutdownMcpServer2().catch(() => {});
|
|
266930
|
+
process.exitCode = 0;
|
|
266931
|
+
return;
|
|
266932
|
+
}
|
|
266933
|
+
} catch (error4) {
|
|
266934
|
+
const message = error4 instanceof Error ? error4.message : "Unexpected error.";
|
|
266935
|
+
console.error(import_picocolors13.default.red(message));
|
|
266486
266936
|
}
|
|
266487
|
-
|
|
266488
|
-
|
|
266489
|
-
drawGhost(ghost);
|
|
266490
|
-
});
|
|
266937
|
+
setupRl();
|
|
266938
|
+
rl.prompt();
|
|
266491
266939
|
});
|
|
266940
|
+
replActive = true;
|
|
266492
266941
|
}
|
|
266493
|
-
|
|
266494
|
-
clearGhost();
|
|
266495
|
-
console.log("Use /exit to quit.");
|
|
266496
|
-
rl.prompt();
|
|
266497
|
-
});
|
|
266498
|
-
let intentionalClose = false;
|
|
266499
|
-
rl.on("close", () => {
|
|
266500
|
-
if (intentionalClose)
|
|
266501
|
-
process.exit(0);
|
|
266502
|
-
else {
|
|
266503
|
-
if (!process.stdin.destroyed)
|
|
266504
|
-
process.stdin.resume();
|
|
266505
|
-
rl.prompt();
|
|
266506
|
-
}
|
|
266507
|
-
});
|
|
266942
|
+
setupRl();
|
|
266508
266943
|
rl.prompt();
|
|
266509
|
-
rl.on("line", async (line) => {
|
|
266510
|
-
clearGhost();
|
|
266511
|
-
try {
|
|
266512
|
-
const result = await dispatchCommand(line, context);
|
|
266513
|
-
if (result === "exit") {
|
|
266514
|
-
intentionalClose = true;
|
|
266515
|
-
rl.close();
|
|
266516
|
-
return;
|
|
266517
|
-
}
|
|
266518
|
-
rl.setPrompt(resolvePrompt());
|
|
266519
|
-
rl.prompt();
|
|
266520
|
-
} catch (error4) {
|
|
266521
|
-
const message = error4 instanceof Error ? error4.message : "Unexpected error.";
|
|
266522
|
-
console.error(import_picocolors12.default.red(message));
|
|
266523
|
-
rl.setPrompt(resolvePrompt());
|
|
266524
|
-
rl.prompt();
|
|
266525
|
-
}
|
|
266526
|
-
});
|
|
266527
266944
|
}
|
|
266528
266945
|
async function main() {
|
|
266529
266946
|
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
@@ -266536,7 +266953,20 @@ async function main() {
|
|
|
266536
266953
|
const options = program2.opts();
|
|
266537
266954
|
const appContext = buildAppContext(options);
|
|
266538
266955
|
registerCleanupHandlers();
|
|
266956
|
+
const cwd = process.cwd();
|
|
266957
|
+
if (!findWorkspaceRoot(cwd)) {
|
|
266958
|
+
const lastActive = getGlobalWorkspacePath();
|
|
266959
|
+
if (lastActive && isKittWorkspace(lastActive)) {
|
|
266960
|
+
try {
|
|
266961
|
+
process.chdir(lastActive);
|
|
266962
|
+
} catch {}
|
|
266963
|
+
}
|
|
266964
|
+
} else {
|
|
266965
|
+
setGlobalWorkspacePath(findWorkspaceRoot(cwd));
|
|
266966
|
+
}
|
|
266539
266967
|
displayBanner();
|
|
266968
|
+
if (!options.quiet)
|
|
266969
|
+
displayWorkspaceHint(process.cwd());
|
|
266540
266970
|
if (!options.quiet) {
|
|
266541
266971
|
const prerequisites = await checkPrerequisites();
|
|
266542
266972
|
displayPrerequisites(prerequisites);
|
|
@@ -266557,7 +266987,7 @@ function isDirectExecution() {
|
|
|
266557
266987
|
return false;
|
|
266558
266988
|
}
|
|
266559
266989
|
try {
|
|
266560
|
-
const realEntry = pathToFileURL(
|
|
266990
|
+
const realEntry = pathToFileURL(realpathSync2(entryPoint)).href;
|
|
266561
266991
|
return import.meta.url === realEntry;
|
|
266562
266992
|
} catch {
|
|
266563
266993
|
return import.meta.url === pathToFileURL(entryPoint).href;
|