@staff0rd/assist 0.981.0 → 0.982.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/extension/extension/background.js +2 -2
- package/dist/commands/extension/extension/console.js +1 -0
- package/dist/commands/extension/extension/consoleMain.js +1 -0
- package/dist/commands/extension/extension/manifest.json +23 -0
- package/dist/commands/extension/extension/options.html +17 -0
- package/dist/commands/extension/extension/options.js +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +686 -589
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.982.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -120,6 +120,7 @@ var package_default = {
|
|
|
120
120
|
"@vitest/coverage-v8": "^4.1.2",
|
|
121
121
|
"devicons-react": "^1.5.0",
|
|
122
122
|
esbuild: "^0.27.3",
|
|
123
|
+
"fake-indexeddb": "^6.2.7",
|
|
123
124
|
jscpd: "^4.0.5",
|
|
124
125
|
jsdom: "^29.1.1",
|
|
125
126
|
knip: "^5.71.0",
|
|
@@ -4200,16 +4201,13 @@ async function readJsonBody(req) {
|
|
|
4200
4201
|
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
4201
4202
|
}
|
|
4202
4203
|
|
|
4203
|
-
// src/commands/sessions/web/browser/
|
|
4204
|
-
var RELAY_TIMEOUT_MS = 1e4;
|
|
4205
|
-
var RUN_RELAY_TIMEOUT_MS = RUN_APPROVAL_TIMEOUT_MS + 3e4;
|
|
4206
|
-
function optionalString(value) {
|
|
4207
|
-
return value === void 0 || typeof value === "string";
|
|
4208
|
-
}
|
|
4204
|
+
// src/commands/sessions/web/browser/parseBrowserRequest.ts
|
|
4209
4205
|
function parseBrowserRequest(body) {
|
|
4210
|
-
const
|
|
4206
|
+
const fields = body ?? {};
|
|
4207
|
+
const { op, url, selector, text: text18, code } = fields;
|
|
4211
4208
|
if (!optionalString(url)) return void 0;
|
|
4212
4209
|
if (op === "status" || op === "snapshot") return { op, url };
|
|
4210
|
+
if (op === "console") return parseConsoleRequest(url, fields);
|
|
4213
4211
|
if (op === "run")
|
|
4214
4212
|
return typeof code === "string" && code.trim() ? { op, url, code } : void 0;
|
|
4215
4213
|
if (op !== "inspect") return void 0;
|
|
@@ -4217,6 +4215,24 @@ function parseBrowserRequest(body) {
|
|
|
4217
4215
|
if (typeof text18 === "string" && text18) return { op, url, text: text18 };
|
|
4218
4216
|
return void 0;
|
|
4219
4217
|
}
|
|
4218
|
+
function optionalString(value) {
|
|
4219
|
+
return value === void 0 || typeof value === "string";
|
|
4220
|
+
}
|
|
4221
|
+
function parseConsoleRequest(url, fields) {
|
|
4222
|
+
const { all, sinceMs, grep, limit } = fields;
|
|
4223
|
+
if (all !== void 0 && typeof all !== "boolean") return void 0;
|
|
4224
|
+
if (!optionalPositive(sinceMs) || !optionalString(grep)) return void 0;
|
|
4225
|
+
if (!optionalPositive(limit) || limit && !Number.isInteger(limit))
|
|
4226
|
+
return void 0;
|
|
4227
|
+
return { op: "console", url, all, sinceMs, grep, limit };
|
|
4228
|
+
}
|
|
4229
|
+
function optionalPositive(value) {
|
|
4230
|
+
return value === void 0 || typeof value === "number" && value > 0;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
// src/commands/sessions/web/browser/browserRelay.ts
|
|
4234
|
+
var RELAY_TIMEOUT_MS = 1e4;
|
|
4235
|
+
var RUN_RELAY_TIMEOUT_MS = RUN_APPROVAL_TIMEOUT_MS + 3e4;
|
|
4220
4236
|
async function browserRelay(req, res) {
|
|
4221
4237
|
if (req.headers.origin) {
|
|
4222
4238
|
respondJson(res, 403, { error: "browser relay is CLI-only" });
|
|
@@ -15805,10 +15821,10 @@ function chartYRange(values) {
|
|
|
15805
15821
|
const min = Math.min(...values);
|
|
15806
15822
|
const max = Math.max(...values);
|
|
15807
15823
|
const span = max - min;
|
|
15808
|
-
const
|
|
15824
|
+
const pad3 = span === 0 ? Math.max(Math.abs(max) * 0.1, 1) : span * 0.2;
|
|
15809
15825
|
return {
|
|
15810
|
-
minY: Math.floor(toCentsWithoutFloatError(min -
|
|
15811
|
-
maxY: Math.ceil(toCentsWithoutFloatError(max +
|
|
15826
|
+
minY: Math.floor(toCentsWithoutFloatError(min - pad3)) / 100,
|
|
15827
|
+
maxY: Math.ceil(toCentsWithoutFloatError(max + pad3)) / 100
|
|
15812
15828
|
};
|
|
15813
15829
|
}
|
|
15814
15830
|
|
|
@@ -22107,8 +22123,8 @@ function codeCommentConfirm(pin2) {
|
|
|
22107
22123
|
}
|
|
22108
22124
|
const marker2 = isHashCommentFile(state.file) ? "#" : "//";
|
|
22109
22125
|
const indentSource = lines2[index2] ?? "";
|
|
22110
|
-
const
|
|
22111
|
-
lines2.splice(index2, 0, `${
|
|
22126
|
+
const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
22127
|
+
lines2.splice(index2, 0, `${indent4}${marker2} ${state.text}`);
|
|
22112
22128
|
writeFileSync25(state.file, lines2.join("\n"));
|
|
22113
22129
|
unlinkSync8(getPinStatePath(pin2));
|
|
22114
22130
|
console.log(
|
|
@@ -24130,7 +24146,7 @@ async function requestTab(server, request) {
|
|
|
24130
24146
|
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
24131
24147
|
fail6(reply2.error);
|
|
24132
24148
|
}
|
|
24133
|
-
console.log(`tab: ${reply2.result.tabUrl}`);
|
|
24149
|
+
if (reply2.result.tabUrl) console.log(`tab: ${reply2.result.tabUrl}`);
|
|
24134
24150
|
return { ...reply2.result, version: reply2.version };
|
|
24135
24151
|
}
|
|
24136
24152
|
|
|
@@ -24234,7 +24250,73 @@ async function browserStatus(options2) {
|
|
|
24234
24250
|
);
|
|
24235
24251
|
}
|
|
24236
24252
|
|
|
24237
|
-
// src/commands/
|
|
24253
|
+
// src/commands/extension/consoleCapture/types.ts
|
|
24254
|
+
var CONSOLE_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
24255
|
+
var CONSOLE_DEFAULT_LIMIT = 200;
|
|
24256
|
+
|
|
24257
|
+
// src/commands/github/parseTopCount.ts
|
|
24258
|
+
import { InvalidArgumentError } from "commander";
|
|
24259
|
+
function parseTopCount(value) {
|
|
24260
|
+
if (!/^\d+$/.test(value) || Number.parseInt(value, 10) < 1) {
|
|
24261
|
+
throw new InvalidArgumentError("Expected a positive integer.");
|
|
24262
|
+
}
|
|
24263
|
+
return Number.parseInt(value, 10);
|
|
24264
|
+
}
|
|
24265
|
+
|
|
24266
|
+
// src/commands/browser/browserConsole.ts
|
|
24267
|
+
import chalk147 from "chalk";
|
|
24268
|
+
|
|
24269
|
+
// src/commands/browser/formatConsoleEntries.ts
|
|
24270
|
+
var pad = (value, width2 = 2) => String(value).padStart(width2, "0");
|
|
24271
|
+
function formatTime(time) {
|
|
24272
|
+
const date = new Date(time);
|
|
24273
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
|
|
24274
|
+
}
|
|
24275
|
+
var indent = (text18, prefix2) => text18.split("\n").map((line) => `${prefix2}${line}`);
|
|
24276
|
+
function formatConsoleEntries({
|
|
24277
|
+
recording,
|
|
24278
|
+
entries
|
|
24279
|
+
}) {
|
|
24280
|
+
if (!recording)
|
|
24281
|
+
return [
|
|
24282
|
+
`console recording is off; tick "Record console warnings and errors" on the assist extension's options page`
|
|
24283
|
+
];
|
|
24284
|
+
if (entries.length === 0) return ["no console entries match"];
|
|
24285
|
+
return entries.flatMap((entry) => [
|
|
24286
|
+
`${formatTime(entry.time)} ${entry.level} ${entry.url}`,
|
|
24287
|
+
...indent(entry.message, " "),
|
|
24288
|
+
...entry.stack ? indent(entry.stack, " ") : []
|
|
24289
|
+
]);
|
|
24290
|
+
}
|
|
24291
|
+
|
|
24292
|
+
// src/commands/browser/browserConsole.ts
|
|
24293
|
+
async function browserConsole(options2) {
|
|
24294
|
+
if (options2.all && options2.url) {
|
|
24295
|
+
console.error(chalk147.red("Error: pass either --url or --all, not both"));
|
|
24296
|
+
process.exit(1);
|
|
24297
|
+
}
|
|
24298
|
+
const result = await requestTab(options2.server, {
|
|
24299
|
+
op: "console",
|
|
24300
|
+
url: options2.url,
|
|
24301
|
+
all: options2.all,
|
|
24302
|
+
sinceMs: options2.since,
|
|
24303
|
+
grep: options2.grep,
|
|
24304
|
+
limit: options2.limit
|
|
24305
|
+
});
|
|
24306
|
+
for (const line of formatConsoleEntries(result)) console.log(line);
|
|
24307
|
+
}
|
|
24308
|
+
|
|
24309
|
+
// src/commands/browser/parseSinceDuration.ts
|
|
24310
|
+
import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
24311
|
+
function parseSinceDuration(value) {
|
|
24312
|
+
try {
|
|
24313
|
+
return parseDuration(value);
|
|
24314
|
+
} catch (error) {
|
|
24315
|
+
throw new InvalidArgumentError2(error.message);
|
|
24316
|
+
}
|
|
24317
|
+
}
|
|
24318
|
+
|
|
24319
|
+
// src/commands/browser/withTargetOptions.ts
|
|
24238
24320
|
function withTargetOptions(command) {
|
|
24239
24321
|
return command.option(
|
|
24240
24322
|
"--url <substring>",
|
|
@@ -24245,6 +24327,29 @@ function withTargetOptions(command) {
|
|
|
24245
24327
|
"http://localhost:3100"
|
|
24246
24328
|
);
|
|
24247
24329
|
}
|
|
24330
|
+
|
|
24331
|
+
// src/commands/browser/registerBrowserConsole.ts
|
|
24332
|
+
function registerBrowserConsole(browser) {
|
|
24333
|
+
withTargetOptions(
|
|
24334
|
+
browser.command("console").description(
|
|
24335
|
+
"Print the target tab's recorded console warnings and errors, uncaught errors and unhandled rejections, oldest first. Recording is opt-in on the extension's options page"
|
|
24336
|
+
).option("--all", "Print entries from every tab, not just the target tab").option(
|
|
24337
|
+
"--since <duration>",
|
|
24338
|
+
"Only entries newer than this (e.g. 30s, 10m, 2h)",
|
|
24339
|
+
parseSinceDuration
|
|
24340
|
+
).option(
|
|
24341
|
+
"--grep <text>",
|
|
24342
|
+
"Only entries whose message, stack or URL contains this (case-insensitive)"
|
|
24343
|
+
).option(
|
|
24344
|
+
"--limit <n>",
|
|
24345
|
+
"Print at most the newest n matching entries",
|
|
24346
|
+
parseTopCount,
|
|
24347
|
+
CONSOLE_DEFAULT_LIMIT
|
|
24348
|
+
)
|
|
24349
|
+
).action(browserConsole);
|
|
24350
|
+
}
|
|
24351
|
+
|
|
24352
|
+
// src/commands/registerBrowser.ts
|
|
24248
24353
|
function registerBrowser(program) {
|
|
24249
24354
|
const browser = program.command("browser").description(
|
|
24250
24355
|
"Probe the live browser tab through the assist extension, relayed by the assist web server"
|
|
@@ -24272,11 +24377,12 @@ function registerBrowser(program) {
|
|
|
24272
24377
|
"Show a script in an approval panel on the target tab and, once the user clicks Run, print its return value or error. The script is the body of an async function: `return` the value to print"
|
|
24273
24378
|
).requiredOption("--file <script>", "JavaScript file to run")
|
|
24274
24379
|
).action(browserRun);
|
|
24380
|
+
registerBrowserConsole(browser);
|
|
24275
24381
|
}
|
|
24276
24382
|
|
|
24277
24383
|
// src/commands/extension/extension.ts
|
|
24278
24384
|
import { cp } from "fs/promises";
|
|
24279
|
-
import
|
|
24385
|
+
import chalk148 from "chalk";
|
|
24280
24386
|
|
|
24281
24387
|
// src/commands/extension/extensionDir.ts
|
|
24282
24388
|
import { existsSync as existsSync49 } from "fs";
|
|
@@ -24299,21 +24405,21 @@ async function loadPath(source) {
|
|
|
24299
24405
|
return WSL_WINDOWS_PATH;
|
|
24300
24406
|
} catch {
|
|
24301
24407
|
console.log(
|
|
24302
|
-
|
|
24408
|
+
chalk148.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
24303
24409
|
);
|
|
24304
24410
|
return source;
|
|
24305
24411
|
}
|
|
24306
24412
|
}
|
|
24307
24413
|
async function extension() {
|
|
24308
24414
|
const path109 = await loadPath(extensionDir());
|
|
24309
|
-
console.log(
|
|
24310
|
-
console.log(
|
|
24415
|
+
console.log(chalk148.bold("assist \u2014 GitHub browser extension"));
|
|
24416
|
+
console.log(chalk148.dim(`load the unpacked extension from ${path109}`));
|
|
24311
24417
|
}
|
|
24312
24418
|
|
|
24313
24419
|
// src/commands/extension/printExtensionUrl.ts
|
|
24314
24420
|
import { readFile as readFile4 } from "fs/promises";
|
|
24315
24421
|
import { join as join56 } from "path";
|
|
24316
|
-
import
|
|
24422
|
+
import chalk149 from "chalk";
|
|
24317
24423
|
|
|
24318
24424
|
// src/commands/extension/latestUpdate.ts
|
|
24319
24425
|
function latestUpdate(manifest, updates2) {
|
|
@@ -24336,7 +24442,7 @@ async function printExtensionUrl() {
|
|
|
24336
24442
|
const response = await fetch(update_url);
|
|
24337
24443
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
24338
24444
|
if (!link3) {
|
|
24339
|
-
console.log(
|
|
24445
|
+
console.log(chalk149.red(`no signed build found in ${update_url}`));
|
|
24340
24446
|
process.exitCode = 1;
|
|
24341
24447
|
return;
|
|
24342
24448
|
}
|
|
@@ -24347,7 +24453,7 @@ async function printExtensionUrl() {
|
|
|
24347
24453
|
import { rm as rm2 } from "fs/promises";
|
|
24348
24454
|
import { homedir as homedir22, tmpdir as tmpdir3 } from "os";
|
|
24349
24455
|
import { join as join62 } from "path";
|
|
24350
|
-
import
|
|
24456
|
+
import chalk151 from "chalk";
|
|
24351
24457
|
|
|
24352
24458
|
// src/commands/extension/copySignedXpi.ts
|
|
24353
24459
|
import { copyFile } from "fs/promises";
|
|
@@ -24372,7 +24478,7 @@ async function findSignedXpi(dir) {
|
|
|
24372
24478
|
|
|
24373
24479
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
24374
24480
|
import { cp as cp2 } from "fs/promises";
|
|
24375
|
-
import
|
|
24481
|
+
import chalk150 from "chalk";
|
|
24376
24482
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
24377
24483
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
24378
24484
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -24382,7 +24488,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
24382
24488
|
return WSL_WINDOWS_PATH2;
|
|
24383
24489
|
} catch {
|
|
24384
24490
|
console.log(
|
|
24385
|
-
|
|
24491
|
+
chalk150.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
24386
24492
|
);
|
|
24387
24493
|
return xpi;
|
|
24388
24494
|
}
|
|
@@ -24475,15 +24581,15 @@ async function signExtension() {
|
|
|
24475
24581
|
const source = extensionDir();
|
|
24476
24582
|
const problem = signPreflightProblem(source);
|
|
24477
24583
|
if (problem) {
|
|
24478
|
-
console.log(
|
|
24479
|
-
console.log(
|
|
24584
|
+
console.log(chalk151.red(problem.message));
|
|
24585
|
+
console.log(chalk151.dim(problem.hint));
|
|
24480
24586
|
process.exitCode = 1;
|
|
24481
24587
|
return;
|
|
24482
24588
|
}
|
|
24483
24589
|
const { version: version2 } = package_default;
|
|
24484
24590
|
await stageExtension(source, STAGING_DIR, version2);
|
|
24485
24591
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
24486
|
-
console.log(
|
|
24592
|
+
console.log(chalk151.bold(`signing version ${version2} for self-distribution`));
|
|
24487
24593
|
const { done: done2 } = spawnInherit("npx", [
|
|
24488
24594
|
"--yes",
|
|
24489
24595
|
"web-ext",
|
|
@@ -24493,13 +24599,13 @@ async function signExtension() {
|
|
|
24493
24599
|
"--channel=unlisted"
|
|
24494
24600
|
]);
|
|
24495
24601
|
if (await done2 !== 0) {
|
|
24496
|
-
console.log(
|
|
24602
|
+
console.log(chalk151.red("web-ext sign failed"));
|
|
24497
24603
|
process.exitCode = 1;
|
|
24498
24604
|
return;
|
|
24499
24605
|
}
|
|
24500
24606
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
24501
24607
|
if (!xpi) {
|
|
24502
|
-
console.log(
|
|
24608
|
+
console.log(chalk151.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
24503
24609
|
process.exitCode = 1;
|
|
24504
24610
|
return;
|
|
24505
24611
|
}
|
|
@@ -24507,7 +24613,7 @@ async function signExtension() {
|
|
|
24507
24613
|
const path109 = await signedAddonInstallPath(
|
|
24508
24614
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
24509
24615
|
);
|
|
24510
|
-
console.log(
|
|
24616
|
+
console.log(chalk151.dim(`install the signed add-on from ${path109}`));
|
|
24511
24617
|
}
|
|
24512
24618
|
|
|
24513
24619
|
// src/commands/registerExtension.ts
|
|
@@ -24568,11 +24674,11 @@ async function dropRetiredTables(exec3) {
|
|
|
24568
24674
|
}
|
|
24569
24675
|
|
|
24570
24676
|
// src/commands/db/reportRetiredTables.ts
|
|
24571
|
-
import
|
|
24677
|
+
import chalk152 from "chalk";
|
|
24572
24678
|
function reportRetiredTables(tables) {
|
|
24573
24679
|
for (const table of tables) {
|
|
24574
24680
|
console.error(
|
|
24575
|
-
|
|
24681
|
+
chalk152.yellow(
|
|
24576
24682
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
24577
24683
|
)
|
|
24578
24684
|
);
|
|
@@ -24580,40 +24686,40 @@ function reportRetiredTables(tables) {
|
|
|
24580
24686
|
}
|
|
24581
24687
|
|
|
24582
24688
|
// src/commands/db/reportMigrationStatus.ts
|
|
24583
|
-
import
|
|
24689
|
+
import chalk153 from "chalk";
|
|
24584
24690
|
function reportApplied(applied) {
|
|
24585
24691
|
if (applied.length === 0) {
|
|
24586
|
-
console.error(
|
|
24692
|
+
console.error(chalk153.green("Database is up to date; nothing to apply."));
|
|
24587
24693
|
return;
|
|
24588
24694
|
}
|
|
24589
24695
|
for (const migration of applied) {
|
|
24590
24696
|
console.error(
|
|
24591
|
-
|
|
24697
|
+
chalk153.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
24592
24698
|
);
|
|
24593
24699
|
}
|
|
24594
24700
|
}
|
|
24595
24701
|
function reportMigrationStatus(status2) {
|
|
24596
24702
|
if (status2.state === "in-sync") {
|
|
24597
24703
|
console.error(
|
|
24598
|
-
|
|
24704
|
+
chalk153.green(`In sync at migration ${status2.version} (latest).`)
|
|
24599
24705
|
);
|
|
24600
24706
|
return;
|
|
24601
24707
|
}
|
|
24602
24708
|
if (status2.state === "behind") {
|
|
24603
24709
|
console.error(
|
|
24604
|
-
|
|
24710
|
+
chalk153.yellow(
|
|
24605
24711
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
24606
24712
|
)
|
|
24607
24713
|
);
|
|
24608
24714
|
console.error(
|
|
24609
|
-
|
|
24715
|
+
chalk153.yellow(
|
|
24610
24716
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
24611
24717
|
)
|
|
24612
24718
|
);
|
|
24613
24719
|
return;
|
|
24614
24720
|
}
|
|
24615
24721
|
console.error(
|
|
24616
|
-
|
|
24722
|
+
chalk153.red(
|
|
24617
24723
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
24618
24724
|
)
|
|
24619
24725
|
);
|
|
@@ -24655,7 +24761,7 @@ function registerDb(program) {
|
|
|
24655
24761
|
|
|
24656
24762
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
24657
24763
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync28 } from "fs";
|
|
24658
|
-
import
|
|
24764
|
+
import chalk154 from "chalk";
|
|
24659
24765
|
|
|
24660
24766
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
24661
24767
|
import { join as join63 } from "path";
|
|
@@ -24686,7 +24792,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24686
24792
|
sweepRestrictedDir();
|
|
24687
24793
|
const state = readMigrationPinState(pin2);
|
|
24688
24794
|
if (!state) {
|
|
24689
|
-
console.error(
|
|
24795
|
+
console.error(chalk154.red(`No pending migration unlock for pin: ${pin2}`));
|
|
24690
24796
|
process.exitCode = 1;
|
|
24691
24797
|
return;
|
|
24692
24798
|
}
|
|
@@ -24696,7 +24802,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24696
24802
|
);
|
|
24697
24803
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
24698
24804
|
console.log(
|
|
24699
|
-
|
|
24805
|
+
chalk154.green(
|
|
24700
24806
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
24701
24807
|
)
|
|
24702
24808
|
);
|
|
@@ -24705,7 +24811,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24705
24811
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
24706
24812
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
24707
24813
|
import { randomInt as randomInt2 } from "crypto";
|
|
24708
|
-
import
|
|
24814
|
+
import chalk155 from "chalk";
|
|
24709
24815
|
|
|
24710
24816
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
24711
24817
|
function nextMigrationId() {
|
|
@@ -24720,7 +24826,7 @@ function dbMigrationUnlock() {
|
|
|
24720
24826
|
sweepRestrictedDir();
|
|
24721
24827
|
writeFileSync29(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
24722
24828
|
console.error(
|
|
24723
|
-
|
|
24829
|
+
chalk155.yellow.bold(
|
|
24724
24830
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
24725
24831
|
)
|
|
24726
24832
|
);
|
|
@@ -24730,7 +24836,7 @@ function dbMigrationUnlock() {
|
|
|
24730
24836
|
});
|
|
24731
24837
|
if (!delivered) {
|
|
24732
24838
|
console.error(
|
|
24733
|
-
|
|
24839
|
+
chalk155.red(
|
|
24734
24840
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
24735
24841
|
)
|
|
24736
24842
|
);
|
|
@@ -24740,7 +24846,7 @@ function dbMigrationUnlock() {
|
|
|
24740
24846
|
console.log(
|
|
24741
24847
|
`A confirmation pin was sent to your desktop notifications.
|
|
24742
24848
|
To approve creating migration ${migrationId}, run:
|
|
24743
|
-
${
|
|
24849
|
+
${chalk155.cyan(" assist db-migration confirm <PIN>")}
|
|
24744
24850
|
using the pin from that notification.`
|
|
24745
24851
|
);
|
|
24746
24852
|
}
|
|
@@ -24767,7 +24873,7 @@ function registerDbMigration(parent) {
|
|
|
24767
24873
|
|
|
24768
24874
|
// src/commands/deploy/redirect.ts
|
|
24769
24875
|
import { existsSync as existsSync53, readFileSync as readFileSync35, writeFileSync as writeFileSync30 } from "fs";
|
|
24770
|
-
import
|
|
24876
|
+
import chalk156 from "chalk";
|
|
24771
24877
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
24772
24878
|
if (!window.location.pathname.endsWith('/')) {
|
|
24773
24879
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -24776,23 +24882,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
24776
24882
|
function redirect() {
|
|
24777
24883
|
const indexPath = "index.html";
|
|
24778
24884
|
if (!existsSync53(indexPath)) {
|
|
24779
|
-
console.log(
|
|
24885
|
+
console.log(chalk156.yellow("No index.html found"));
|
|
24780
24886
|
return;
|
|
24781
24887
|
}
|
|
24782
24888
|
const content = readFileSync35(indexPath, "utf8");
|
|
24783
24889
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
24784
|
-
console.log(
|
|
24890
|
+
console.log(chalk156.dim("Trailing slash script already present"));
|
|
24785
24891
|
return;
|
|
24786
24892
|
}
|
|
24787
24893
|
const headCloseIndex = content.indexOf("</head>");
|
|
24788
24894
|
if (headCloseIndex === -1) {
|
|
24789
|
-
console.log(
|
|
24895
|
+
console.log(chalk156.red("Could not find </head> tag in index.html"));
|
|
24790
24896
|
return;
|
|
24791
24897
|
}
|
|
24792
24898
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
24793
24899
|
${content.slice(headCloseIndex)}`;
|
|
24794
24900
|
writeFileSync30(indexPath, newContent);
|
|
24795
|
-
console.log(
|
|
24901
|
+
console.log(chalk156.green("Added trailing slash redirect to index.html"));
|
|
24796
24902
|
}
|
|
24797
24903
|
|
|
24798
24904
|
// src/commands/registerDeploy.ts
|
|
@@ -24819,7 +24925,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
24819
24925
|
|
|
24820
24926
|
// src/commands/devlog/shared.ts
|
|
24821
24927
|
import { execSync as execSync33 } from "child_process";
|
|
24822
|
-
import
|
|
24928
|
+
import chalk157 from "chalk";
|
|
24823
24929
|
|
|
24824
24930
|
// src/shared/getRepoName.ts
|
|
24825
24931
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
@@ -24928,13 +25034,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
24928
25034
|
}
|
|
24929
25035
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
24930
25036
|
for (const commit2 of commits2) {
|
|
24931
|
-
console.log(` ${
|
|
25037
|
+
console.log(` ${chalk157.yellow(commit2.hash)} ${commit2.message}`);
|
|
24932
25038
|
if (verbose) {
|
|
24933
25039
|
const visibleFiles = commit2.files.filter(
|
|
24934
25040
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
24935
25041
|
);
|
|
24936
25042
|
for (const file of visibleFiles) {
|
|
24937
|
-
console.log(` ${
|
|
25043
|
+
console.log(` ${chalk157.dim(file)}`);
|
|
24938
25044
|
}
|
|
24939
25045
|
}
|
|
24940
25046
|
}
|
|
@@ -24959,15 +25065,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
24959
25065
|
}
|
|
24960
25066
|
|
|
24961
25067
|
// src/commands/devlog/list/printDateHeader.ts
|
|
24962
|
-
import
|
|
25068
|
+
import chalk158 from "chalk";
|
|
24963
25069
|
function printDateHeader(date, isSkipped, entries) {
|
|
24964
25070
|
if (isSkipped) {
|
|
24965
|
-
console.log(`${
|
|
25071
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.dim("skipped")}`);
|
|
24966
25072
|
} else if (entries && entries.length > 0) {
|
|
24967
|
-
const entryInfo = entries.map((e) => `${
|
|
24968
|
-
console.log(`${
|
|
25073
|
+
const entryInfo = entries.map((e) => `${chalk158.green(e.version)} ${e.title}`).join(" | ");
|
|
25074
|
+
console.log(`${chalk158.bold.blue(date)} ${entryInfo}`);
|
|
24969
25075
|
} else {
|
|
24970
|
-
console.log(`${
|
|
25076
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.red("\u26A0 devlog missing")}`);
|
|
24971
25077
|
}
|
|
24972
25078
|
}
|
|
24973
25079
|
|
|
@@ -25071,24 +25177,24 @@ function bumpVersion(version2, type) {
|
|
|
25071
25177
|
|
|
25072
25178
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
25073
25179
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
25074
|
-
import
|
|
25180
|
+
import chalk160 from "chalk";
|
|
25075
25181
|
|
|
25076
25182
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
25077
|
-
import
|
|
25183
|
+
import chalk159 from "chalk";
|
|
25078
25184
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
25079
25185
|
if (conventional && firstHash) {
|
|
25080
25186
|
const version2 = getVersionAtCommit(firstHash);
|
|
25081
25187
|
if (version2) {
|
|
25082
|
-
console.log(`${
|
|
25188
|
+
console.log(`${chalk159.bold("version:")} ${stripToMinor(version2)}`);
|
|
25083
25189
|
} else {
|
|
25084
|
-
console.log(`${
|
|
25190
|
+
console.log(`${chalk159.bold("version:")} ${chalk159.red("unknown")}`);
|
|
25085
25191
|
}
|
|
25086
25192
|
} else if (patchVersion && minorVersion) {
|
|
25087
25193
|
console.log(
|
|
25088
|
-
`${
|
|
25194
|
+
`${chalk159.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
25089
25195
|
);
|
|
25090
25196
|
} else {
|
|
25091
|
-
console.log(`${
|
|
25197
|
+
console.log(`${chalk159.bold("version:")} v0.1 (initial)`);
|
|
25092
25198
|
}
|
|
25093
25199
|
}
|
|
25094
25200
|
|
|
@@ -25136,16 +25242,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
25136
25242
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25137
25243
|
}
|
|
25138
25244
|
function logName(repoName) {
|
|
25139
|
-
console.log(`${
|
|
25245
|
+
console.log(`${chalk160.bold("name:")} ${repoName}`);
|
|
25140
25246
|
}
|
|
25141
25247
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
25142
25248
|
logName(ctx.repoName);
|
|
25143
25249
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
25144
|
-
console.log(
|
|
25250
|
+
console.log(chalk160.bold.blue(targetDate));
|
|
25145
25251
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
25146
25252
|
}
|
|
25147
25253
|
function logNoCommits(lastInfo) {
|
|
25148
|
-
console.log(
|
|
25254
|
+
console.log(chalk160.dim(noCommitsMessage(!!lastInfo)));
|
|
25149
25255
|
}
|
|
25150
25256
|
|
|
25151
25257
|
// src/commands/devlog/next.ts
|
|
@@ -25186,11 +25292,11 @@ function next2(options2) {
|
|
|
25186
25292
|
import { execSync as execSync35 } from "child_process";
|
|
25187
25293
|
|
|
25188
25294
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25189
|
-
import
|
|
25295
|
+
import chalk161 from "chalk";
|
|
25190
25296
|
function colorStatus(status2) {
|
|
25191
|
-
if (status2 === "missing") return
|
|
25192
|
-
if (status2 === "outdated") return
|
|
25193
|
-
return
|
|
25297
|
+
if (status2 === "missing") return chalk161.red(status2);
|
|
25298
|
+
if (status2 === "outdated") return chalk161.yellow(status2);
|
|
25299
|
+
return chalk161.green(status2);
|
|
25194
25300
|
}
|
|
25195
25301
|
function formatRow(row3, nameWidth) {
|
|
25196
25302
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -25204,8 +25310,8 @@ function printReposTable(rows) {
|
|
|
25204
25310
|
"Last Devlog".padEnd(11),
|
|
25205
25311
|
"Status"
|
|
25206
25312
|
].join(" ");
|
|
25207
|
-
console.log(
|
|
25208
|
-
console.log(
|
|
25313
|
+
console.log(chalk161.dim(header));
|
|
25314
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
25209
25315
|
for (const row3 of rows) {
|
|
25210
25316
|
console.log(formatRow(row3, nameWidth));
|
|
25211
25317
|
}
|
|
@@ -25263,14 +25369,14 @@ function repos(options2) {
|
|
|
25263
25369
|
// src/commands/devlog/skip.ts
|
|
25264
25370
|
import { writeFileSync as writeFileSync31 } from "fs";
|
|
25265
25371
|
import { join as join67 } from "path";
|
|
25266
|
-
import
|
|
25372
|
+
import chalk162 from "chalk";
|
|
25267
25373
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25268
25374
|
function getBlogConfigPath() {
|
|
25269
25375
|
return join67(BLOG_REPO_ROOT, "assist.yml");
|
|
25270
25376
|
}
|
|
25271
25377
|
function skip2(date) {
|
|
25272
25378
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
25273
|
-
console.log(
|
|
25379
|
+
console.log(chalk162.red("Invalid date format. Use YYYY-MM-DD"));
|
|
25274
25380
|
process.exit(1);
|
|
25275
25381
|
}
|
|
25276
25382
|
const repoName = getRepoName();
|
|
@@ -25281,7 +25387,7 @@ function skip2(date) {
|
|
|
25281
25387
|
const skipDays = skip3[repoName] ?? [];
|
|
25282
25388
|
if (skipDays.includes(date)) {
|
|
25283
25389
|
console.log(
|
|
25284
|
-
|
|
25390
|
+
chalk162.yellow(`${date} is already in skip list for ${repoName}`)
|
|
25285
25391
|
);
|
|
25286
25392
|
return;
|
|
25287
25393
|
}
|
|
@@ -25291,20 +25397,20 @@ function skip2(date) {
|
|
|
25291
25397
|
devlog.skip = skip3;
|
|
25292
25398
|
config.devlog = devlog;
|
|
25293
25399
|
writeFileSync31(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25294
|
-
console.log(
|
|
25400
|
+
console.log(chalk162.green(`Added ${date} to skip list for ${repoName}`));
|
|
25295
25401
|
}
|
|
25296
25402
|
|
|
25297
25403
|
// src/commands/devlog/version.ts
|
|
25298
|
-
import
|
|
25404
|
+
import chalk163 from "chalk";
|
|
25299
25405
|
function version() {
|
|
25300
25406
|
const config = loadConfig();
|
|
25301
25407
|
const name = getRepoName();
|
|
25302
25408
|
const lastInfo = getLastVersionInfo(name, config);
|
|
25303
25409
|
const lastVersion = lastInfo?.version ?? null;
|
|
25304
25410
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
25305
|
-
console.log(`${
|
|
25306
|
-
console.log(`${
|
|
25307
|
-
console.log(`${
|
|
25411
|
+
console.log(`${chalk163.bold("name:")} ${name}`);
|
|
25412
|
+
console.log(`${chalk163.bold("last:")} ${lastVersion ?? chalk163.dim("none")}`);
|
|
25413
|
+
console.log(`${chalk163.bold("next:")} ${nextVersion ?? chalk163.dim("none")}`);
|
|
25308
25414
|
}
|
|
25309
25415
|
|
|
25310
25416
|
// src/commands/registerDevlog.ts
|
|
@@ -25329,7 +25435,7 @@ function registerDevlog(program) {
|
|
|
25329
25435
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25330
25436
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
25331
25437
|
import { join as join68 } from "path";
|
|
25332
|
-
import
|
|
25438
|
+
import chalk164 from "chalk";
|
|
25333
25439
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25334
25440
|
function isLockedDll(debugDir) {
|
|
25335
25441
|
let files;
|
|
@@ -25376,14 +25482,14 @@ function checkBuildLocks(startDir) {
|
|
|
25376
25482
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
25377
25483
|
if (locked) {
|
|
25378
25484
|
console.error(
|
|
25379
|
-
|
|
25485
|
+
chalk164.red("Build output locked (is VS debugging?): ") + locked
|
|
25380
25486
|
);
|
|
25381
25487
|
process.exit(1);
|
|
25382
25488
|
}
|
|
25383
25489
|
}
|
|
25384
25490
|
async function checkBuildLocksCommand() {
|
|
25385
25491
|
checkBuildLocks();
|
|
25386
|
-
console.log(
|
|
25492
|
+
console.log(chalk164.green("No build locks detected"));
|
|
25387
25493
|
}
|
|
25388
25494
|
|
|
25389
25495
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -25482,30 +25588,30 @@ function escapeRegex(s) {
|
|
|
25482
25588
|
}
|
|
25483
25589
|
|
|
25484
25590
|
// src/commands/dotnet/printTree.ts
|
|
25485
|
-
import
|
|
25591
|
+
import chalk165 from "chalk";
|
|
25486
25592
|
function printNodes(nodes, prefix2) {
|
|
25487
25593
|
for (let i = 0; i < nodes.length; i++) {
|
|
25488
25594
|
const isLast = i === nodes.length - 1;
|
|
25489
25595
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
25490
25596
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
25491
25597
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
25492
|
-
const label = isMissing ?
|
|
25598
|
+
const label = isMissing ? chalk165.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
25493
25599
|
console.log(`${prefix2}${connector}${label}`);
|
|
25494
25600
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
25495
25601
|
}
|
|
25496
25602
|
}
|
|
25497
25603
|
function printTree(tree, totalCount, solutions) {
|
|
25498
|
-
console.log(
|
|
25499
|
-
console.log(
|
|
25604
|
+
console.log(chalk165.bold("\nProject Dependency Tree"));
|
|
25605
|
+
console.log(chalk165.cyan(tree.relativePath));
|
|
25500
25606
|
printNodes(tree.children, "");
|
|
25501
|
-
console.log(
|
|
25607
|
+
console.log(chalk165.dim(`
|
|
25502
25608
|
${totalCount} projects total (including root)`));
|
|
25503
|
-
console.log(
|
|
25609
|
+
console.log(chalk165.bold("\nSolution Membership"));
|
|
25504
25610
|
if (solutions.length === 0) {
|
|
25505
|
-
console.log(
|
|
25611
|
+
console.log(chalk165.yellow(" Not found in any .sln"));
|
|
25506
25612
|
} else {
|
|
25507
25613
|
for (const sln of solutions) {
|
|
25508
|
-
console.log(` ${
|
|
25614
|
+
console.log(` ${chalk165.green(sln)}`);
|
|
25509
25615
|
}
|
|
25510
25616
|
}
|
|
25511
25617
|
console.log();
|
|
@@ -25534,16 +25640,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
25534
25640
|
// src/commands/dotnet/resolveCsproj.ts
|
|
25535
25641
|
import { existsSync as existsSync55 } from "fs";
|
|
25536
25642
|
import path37 from "path";
|
|
25537
|
-
import
|
|
25643
|
+
import chalk166 from "chalk";
|
|
25538
25644
|
function resolveCsproj(csprojPath) {
|
|
25539
25645
|
const resolved = path37.resolve(csprojPath);
|
|
25540
25646
|
if (!existsSync55(resolved)) {
|
|
25541
|
-
console.error(
|
|
25647
|
+
console.error(chalk166.red(`File not found: ${resolved}`));
|
|
25542
25648
|
process.exit(1);
|
|
25543
25649
|
}
|
|
25544
25650
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
25545
25651
|
if (!repoRoot2) {
|
|
25546
|
-
console.error(
|
|
25652
|
+
console.error(chalk166.red("Could not find git repository root"));
|
|
25547
25653
|
process.exit(1);
|
|
25548
25654
|
}
|
|
25549
25655
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -25593,12 +25699,12 @@ function getChangedCsFiles(scope) {
|
|
|
25593
25699
|
}
|
|
25594
25700
|
|
|
25595
25701
|
// src/commands/dotnet/inSln.ts
|
|
25596
|
-
import
|
|
25702
|
+
import chalk167 from "chalk";
|
|
25597
25703
|
async function inSln(csprojPath) {
|
|
25598
25704
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
25599
25705
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
25600
25706
|
if (solutions.length === 0) {
|
|
25601
|
-
console.log(
|
|
25707
|
+
console.log(chalk167.yellow("Not found in any .sln file"));
|
|
25602
25708
|
process.exit(1);
|
|
25603
25709
|
}
|
|
25604
25710
|
for (const sln of solutions) {
|
|
@@ -25607,7 +25713,7 @@ async function inSln(csprojPath) {
|
|
|
25607
25713
|
}
|
|
25608
25714
|
|
|
25609
25715
|
// src/commands/dotnet/inspect.ts
|
|
25610
|
-
import
|
|
25716
|
+
import chalk173 from "chalk";
|
|
25611
25717
|
|
|
25612
25718
|
// src/shared/formatElapsed.ts
|
|
25613
25719
|
function formatElapsed(ms) {
|
|
@@ -25619,12 +25725,12 @@ function formatElapsed(ms) {
|
|
|
25619
25725
|
}
|
|
25620
25726
|
|
|
25621
25727
|
// src/commands/dotnet/displayIssues.ts
|
|
25622
|
-
import
|
|
25728
|
+
import chalk168 from "chalk";
|
|
25623
25729
|
var SEVERITY_COLOR = {
|
|
25624
|
-
ERROR:
|
|
25625
|
-
WARNING:
|
|
25626
|
-
SUGGESTION:
|
|
25627
|
-
HINT:
|
|
25730
|
+
ERROR: chalk168.red,
|
|
25731
|
+
WARNING: chalk168.yellow,
|
|
25732
|
+
SUGGESTION: chalk168.cyan,
|
|
25733
|
+
HINT: chalk168.dim
|
|
25628
25734
|
};
|
|
25629
25735
|
function groupByFile(issues) {
|
|
25630
25736
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -25640,15 +25746,15 @@ function groupByFile(issues) {
|
|
|
25640
25746
|
}
|
|
25641
25747
|
function displayIssues(issues) {
|
|
25642
25748
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
25643
|
-
console.log(
|
|
25749
|
+
console.log(chalk168.bold(file));
|
|
25644
25750
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
25645
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
25751
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk168.white;
|
|
25646
25752
|
console.log(
|
|
25647
|
-
` ${
|
|
25753
|
+
` ${chalk168.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
25648
25754
|
);
|
|
25649
25755
|
}
|
|
25650
25756
|
}
|
|
25651
|
-
console.log(
|
|
25757
|
+
console.log(chalk168.dim(`
|
|
25652
25758
|
${issues.length} issue(s) found`));
|
|
25653
25759
|
}
|
|
25654
25760
|
|
|
@@ -25707,12 +25813,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
25707
25813
|
// src/commands/dotnet/resolveSolution.ts
|
|
25708
25814
|
import { existsSync as existsSync56 } from "fs";
|
|
25709
25815
|
import path38 from "path";
|
|
25710
|
-
import
|
|
25816
|
+
import chalk170 from "chalk";
|
|
25711
25817
|
|
|
25712
25818
|
// src/commands/dotnet/findSolution.ts
|
|
25713
25819
|
import { readdirSync as readdirSync11 } from "fs";
|
|
25714
25820
|
import { dirname as dirname30, join as join69 } from "path";
|
|
25715
|
-
import
|
|
25821
|
+
import chalk169 from "chalk";
|
|
25716
25822
|
function findSlnInDir(dir) {
|
|
25717
25823
|
try {
|
|
25718
25824
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join69(dir, f));
|
|
@@ -25728,17 +25834,17 @@ function findSolution() {
|
|
|
25728
25834
|
const slnFiles = findSlnInDir(current);
|
|
25729
25835
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
25730
25836
|
if (slnFiles.length > 1) {
|
|
25731
|
-
console.error(
|
|
25837
|
+
console.error(chalk169.red(`Multiple .sln files found in ${current}:`));
|
|
25732
25838
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
25733
25839
|
console.error(
|
|
25734
|
-
|
|
25840
|
+
chalk169.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
25735
25841
|
);
|
|
25736
25842
|
process.exit(1);
|
|
25737
25843
|
}
|
|
25738
25844
|
if (current === ceiling) break;
|
|
25739
25845
|
current = dirname30(current);
|
|
25740
25846
|
}
|
|
25741
|
-
console.error(
|
|
25847
|
+
console.error(chalk169.red("No .sln file found between cwd and repo root"));
|
|
25742
25848
|
process.exit(1);
|
|
25743
25849
|
}
|
|
25744
25850
|
|
|
@@ -25747,7 +25853,7 @@ function resolveSolution(sln) {
|
|
|
25747
25853
|
if (sln) {
|
|
25748
25854
|
const resolved = path38.resolve(sln);
|
|
25749
25855
|
if (!existsSync56(resolved)) {
|
|
25750
|
-
console.error(
|
|
25856
|
+
console.error(chalk170.red(`Solution file not found: ${resolved}`));
|
|
25751
25857
|
process.exit(1);
|
|
25752
25858
|
}
|
|
25753
25859
|
return resolved;
|
|
@@ -25789,14 +25895,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
25789
25895
|
import { existsSync as existsSync57, readFileSync as readFileSync40, unlinkSync as unlinkSync10 } from "fs";
|
|
25790
25896
|
import { tmpdir as tmpdir4 } from "os";
|
|
25791
25897
|
import path39 from "path";
|
|
25792
|
-
import
|
|
25898
|
+
import chalk171 from "chalk";
|
|
25793
25899
|
function assertJbInstalled() {
|
|
25794
25900
|
try {
|
|
25795
25901
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25796
25902
|
} catch {
|
|
25797
|
-
console.error(
|
|
25903
|
+
console.error(chalk171.red("jb is not installed. Install with:"));
|
|
25798
25904
|
console.error(
|
|
25799
|
-
|
|
25905
|
+
chalk171.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
25800
25906
|
);
|
|
25801
25907
|
process.exit(1);
|
|
25802
25908
|
}
|
|
@@ -25814,11 +25920,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25814
25920
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
25815
25921
|
process.stderr.write(error.stderr);
|
|
25816
25922
|
}
|
|
25817
|
-
console.error(
|
|
25923
|
+
console.error(chalk171.red("jb inspectcode failed"));
|
|
25818
25924
|
process.exit(1);
|
|
25819
25925
|
}
|
|
25820
25926
|
if (!existsSync57(reportPath)) {
|
|
25821
|
-
console.error(
|
|
25927
|
+
console.error(chalk171.red("Report file not generated"));
|
|
25822
25928
|
process.exit(1);
|
|
25823
25929
|
}
|
|
25824
25930
|
const xml = readFileSync40(reportPath, "utf8");
|
|
@@ -25828,7 +25934,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25828
25934
|
|
|
25829
25935
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
25830
25936
|
import { execSync as execSync38 } from "child_process";
|
|
25831
|
-
import
|
|
25937
|
+
import chalk172 from "chalk";
|
|
25832
25938
|
function resolveMsbuildPath() {
|
|
25833
25939
|
const { run: run4 } = loadConfig();
|
|
25834
25940
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -25840,9 +25946,9 @@ function assertMsbuildInstalled() {
|
|
|
25840
25946
|
try {
|
|
25841
25947
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
25842
25948
|
} catch {
|
|
25843
|
-
console.error(
|
|
25949
|
+
console.error(chalk172.red(`msbuild not found at: ${msbuild}`));
|
|
25844
25950
|
console.error(
|
|
25845
|
-
|
|
25951
|
+
chalk172.yellow(
|
|
25846
25952
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
25847
25953
|
)
|
|
25848
25954
|
);
|
|
@@ -25889,17 +25995,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
25889
25995
|
// src/commands/dotnet/inspect.ts
|
|
25890
25996
|
function logScope(changedFiles2) {
|
|
25891
25997
|
if (changedFiles2 === null) {
|
|
25892
|
-
console.log(
|
|
25998
|
+
console.log(chalk173.dim("Inspecting full solution..."));
|
|
25893
25999
|
} else {
|
|
25894
26000
|
console.log(
|
|
25895
|
-
|
|
26001
|
+
chalk173.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
25896
26002
|
);
|
|
25897
26003
|
}
|
|
25898
26004
|
}
|
|
25899
26005
|
function reportResults(issues, elapsed) {
|
|
25900
26006
|
if (issues.length > 0) displayIssues(issues);
|
|
25901
|
-
else console.log(
|
|
25902
|
-
console.log(
|
|
26007
|
+
else console.log(chalk173.green("No issues found"));
|
|
26008
|
+
console.log(chalk173.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
25903
26009
|
if (issues.length > 0) process.exit(1);
|
|
25904
26010
|
}
|
|
25905
26011
|
async function inspect(sln, options2) {
|
|
@@ -25910,7 +26016,7 @@ async function inspect(sln, options2) {
|
|
|
25910
26016
|
const scope = parseScope(options2.scope);
|
|
25911
26017
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
25912
26018
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
25913
|
-
console.log(
|
|
26019
|
+
console.log(chalk173.green("No changed .cs files found"));
|
|
25914
26020
|
return;
|
|
25915
26021
|
}
|
|
25916
26022
|
logScope(changedFiles2);
|
|
@@ -26798,25 +26904,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
26798
26904
|
}
|
|
26799
26905
|
|
|
26800
26906
|
// src/commands/github/printCountTable.ts
|
|
26801
|
-
import
|
|
26907
|
+
import chalk174 from "chalk";
|
|
26802
26908
|
function printCountTable(labelHeader, rows) {
|
|
26803
26909
|
const labelWidth = Math.max(
|
|
26804
26910
|
labelHeader.length,
|
|
26805
26911
|
...rows.map((row3) => row3.label.length)
|
|
26806
26912
|
);
|
|
26807
26913
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
26808
|
-
console.log(
|
|
26809
|
-
console.log(
|
|
26914
|
+
console.log(chalk174.dim(header));
|
|
26915
|
+
console.log(chalk174.dim("-".repeat(header.length)));
|
|
26810
26916
|
for (const row3 of rows) {
|
|
26811
26917
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
26812
26918
|
}
|
|
26813
26919
|
}
|
|
26814
26920
|
|
|
26815
26921
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
26816
|
-
import
|
|
26922
|
+
import chalk175 from "chalk";
|
|
26817
26923
|
function printRepoAuthorBreakdown(repos2) {
|
|
26818
26924
|
for (const repo of repos2) {
|
|
26819
|
-
console.log(
|
|
26925
|
+
console.log(chalk175.bold(repo.name));
|
|
26820
26926
|
const authorWidth = Math.max(
|
|
26821
26927
|
0,
|
|
26822
26928
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -26877,32 +26983,23 @@ function commits(org, options2) {
|
|
|
26877
26983
|
}
|
|
26878
26984
|
|
|
26879
26985
|
// src/commands/github/parseSinceDate.ts
|
|
26880
|
-
import { InvalidArgumentError } from "commander";
|
|
26986
|
+
import { InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
26881
26987
|
function parseSinceDate(value) {
|
|
26882
26988
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
26883
|
-
throw new
|
|
26989
|
+
throw new InvalidArgumentError3("Expected a date in YYYY-MM-DD format.");
|
|
26884
26990
|
}
|
|
26885
26991
|
const date = /* @__PURE__ */ new Date(`${value}T00:00:00Z`);
|
|
26886
26992
|
if (Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== value) {
|
|
26887
|
-
throw new
|
|
26993
|
+
throw new InvalidArgumentError3(`Not a valid calendar date: ${value}.`);
|
|
26888
26994
|
}
|
|
26889
26995
|
return value;
|
|
26890
26996
|
}
|
|
26891
26997
|
|
|
26892
|
-
// src/commands/github/parseTopCount.ts
|
|
26893
|
-
import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
26894
|
-
function parseTopCount(value) {
|
|
26895
|
-
if (!/^\d+$/.test(value) || Number.parseInt(value, 10) < 1) {
|
|
26896
|
-
throw new InvalidArgumentError2("Expected a positive integer.");
|
|
26897
|
-
}
|
|
26898
|
-
return Number.parseInt(value, 10);
|
|
26899
|
-
}
|
|
26900
|
-
|
|
26901
26998
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
26902
|
-
import
|
|
26999
|
+
import chalk177 from "chalk";
|
|
26903
27000
|
|
|
26904
27001
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
26905
|
-
import
|
|
27002
|
+
import chalk176 from "chalk";
|
|
26906
27003
|
|
|
26907
27004
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
26908
27005
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -26939,7 +27036,7 @@ function writeLineNow(line) {
|
|
|
26939
27036
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
26940
27037
|
function applyFixStructurePlan(plan2) {
|
|
26941
27038
|
for (const entry of plan2.entries) {
|
|
26942
|
-
const where =
|
|
27039
|
+
const where = chalk176.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
26943
27040
|
const { typeChange, labelRemovals } = entry;
|
|
26944
27041
|
if (typeChange) {
|
|
26945
27042
|
writeLineNow(
|
|
@@ -27209,12 +27306,12 @@ function planSubtree(root2, context) {
|
|
|
27209
27306
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27210
27307
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27211
27308
|
applyFixStructurePlan(plan2);
|
|
27212
|
-
writeLineNow(
|
|
27309
|
+
writeLineNow(chalk177.dim("Re-walking the subtree to confirm"));
|
|
27213
27310
|
assertNoResidualDrift(
|
|
27214
27311
|
planSubtree(fetchRootIssue(target), context),
|
|
27215
27312
|
context.chain
|
|
27216
27313
|
);
|
|
27217
|
-
writeLineNow(
|
|
27314
|
+
writeLineNow(chalk177.green("Subtree normalised"));
|
|
27218
27315
|
}
|
|
27219
27316
|
|
|
27220
27317
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27250,22 +27347,22 @@ function parseTypeChain(value) {
|
|
|
27250
27347
|
}
|
|
27251
27348
|
|
|
27252
27349
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27253
|
-
import
|
|
27350
|
+
import chalk178 from "chalk";
|
|
27254
27351
|
function annotate(entry) {
|
|
27255
27352
|
const notes = [];
|
|
27256
27353
|
if (entry.level === null) {
|
|
27257
|
-
notes.push(
|
|
27354
|
+
notes.push(chalk178.red("deeper than the leaf level"));
|
|
27258
27355
|
} else if (entry.typeChange) {
|
|
27259
27356
|
notes.push(
|
|
27260
|
-
|
|
27357
|
+
chalk178.yellow(
|
|
27261
27358
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27262
27359
|
)
|
|
27263
27360
|
);
|
|
27264
27361
|
} else {
|
|
27265
|
-
notes.push(
|
|
27362
|
+
notes.push(chalk178.dim(entry.issue.typeName ?? "no type"));
|
|
27266
27363
|
}
|
|
27267
27364
|
for (const label of entry.labelRemovals) {
|
|
27268
|
-
notes.push(
|
|
27365
|
+
notes.push(chalk178.yellow(`-${label.name}`));
|
|
27269
27366
|
}
|
|
27270
27367
|
return notes;
|
|
27271
27368
|
}
|
|
@@ -27273,22 +27370,22 @@ function formatCount(count10, noun) {
|
|
|
27273
27370
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27274
27371
|
}
|
|
27275
27372
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27276
|
-
writeLineNow(
|
|
27373
|
+
writeLineNow(chalk178.dim(`chain: ${chain2.join(" > ")}`));
|
|
27277
27374
|
for (const entry of plan2.entries) {
|
|
27278
|
-
const
|
|
27279
|
-
const name =
|
|
27375
|
+
const indent4 = " ".repeat(entry.issue.depth);
|
|
27376
|
+
const name = chalk178.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27280
27377
|
writeLineNow(
|
|
27281
|
-
`${
|
|
27378
|
+
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27282
27379
|
);
|
|
27283
27380
|
}
|
|
27284
27381
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27285
|
-
writeLineNow(
|
|
27382
|
+
writeLineNow(chalk178.green("Nothing to change"));
|
|
27286
27383
|
return;
|
|
27287
27384
|
}
|
|
27288
27385
|
writeLineNow(
|
|
27289
27386
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27290
27387
|
);
|
|
27291
|
-
if (!apply) writeLineNow(
|
|
27388
|
+
if (!apply) writeLineNow(chalk178.dim("Dry run \u2014 nothing written"));
|
|
27292
27389
|
}
|
|
27293
27390
|
|
|
27294
27391
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28695,25 +28792,25 @@ function registerGithub(program) {
|
|
|
28695
28792
|
}
|
|
28696
28793
|
|
|
28697
28794
|
// src/commands/inbox/list.ts
|
|
28698
|
-
import
|
|
28795
|
+
import chalk179 from "chalk";
|
|
28699
28796
|
async function list3() {
|
|
28700
28797
|
const messages = await listInboxMessages(await getDb());
|
|
28701
28798
|
if (messages.length === 0) {
|
|
28702
|
-
console.log(
|
|
28799
|
+
console.log(chalk179.dim("No flagged messages; run assist inbox scan"));
|
|
28703
28800
|
return;
|
|
28704
28801
|
}
|
|
28705
28802
|
for (const message3 of messages) {
|
|
28706
28803
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
28707
28804
|
console.log(
|
|
28708
|
-
`${
|
|
28805
|
+
`${chalk179.dim(when)} ${chalk179.cyan(message3.source)} ${chalk179.bold(message3.sender)}`
|
|
28709
28806
|
);
|
|
28710
28807
|
console.log(` ${message3.summary}`);
|
|
28711
|
-
console.log(` ${
|
|
28808
|
+
console.log(` ${chalk179.dim(message3.link)}`);
|
|
28712
28809
|
}
|
|
28713
28810
|
}
|
|
28714
28811
|
|
|
28715
28812
|
// src/commands/inbox/scan.ts
|
|
28716
|
-
import
|
|
28813
|
+
import chalk180 from "chalk";
|
|
28717
28814
|
|
|
28718
28815
|
// src/shared/db/upsertInboxMessages.ts
|
|
28719
28816
|
async function upsertInboxMessages(orm, messages) {
|
|
@@ -28903,7 +29000,7 @@ async function scan() {
|
|
|
28903
29000
|
)
|
|
28904
29001
|
);
|
|
28905
29002
|
console.log(
|
|
28906
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29003
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk180.bold(added)} new.`
|
|
28907
29004
|
);
|
|
28908
29005
|
}
|
|
28909
29006
|
|
|
@@ -28918,7 +29015,7 @@ function registerInbox(program) {
|
|
|
28918
29015
|
}
|
|
28919
29016
|
|
|
28920
29017
|
// src/commands/jira/acceptanceCriteria.ts
|
|
28921
|
-
import
|
|
29018
|
+
import chalk181 from "chalk";
|
|
28922
29019
|
|
|
28923
29020
|
// src/commands/jira/adfToText.ts
|
|
28924
29021
|
function renderInline(node) {
|
|
@@ -28926,52 +29023,52 @@ function renderInline(node) {
|
|
|
28926
29023
|
if (node.marks?.some((m) => m.type === "code")) return `\`${text18}\``;
|
|
28927
29024
|
return text18;
|
|
28928
29025
|
}
|
|
28929
|
-
function renderChildren(node,
|
|
28930
|
-
return renderNodes(node.content ?? [],
|
|
29026
|
+
function renderChildren(node, indent4) {
|
|
29027
|
+
return renderNodes(node.content ?? [], indent4);
|
|
28931
29028
|
}
|
|
28932
|
-
function renderOrderedList(node,
|
|
29029
|
+
function renderOrderedList(node, indent4) {
|
|
28933
29030
|
let counter = 0;
|
|
28934
29031
|
return (node.content ?? []).map((item) => {
|
|
28935
29032
|
counter++;
|
|
28936
|
-
return renderListItem(item,
|
|
29033
|
+
return renderListItem(item, indent4, `${counter}.`);
|
|
28937
29034
|
}).join("\n");
|
|
28938
29035
|
}
|
|
28939
|
-
function renderBulletList(node,
|
|
28940
|
-
return (node.content ?? []).map((item) => renderListItem(item,
|
|
29036
|
+
function renderBulletList(node, indent4) {
|
|
29037
|
+
return (node.content ?? []).map((item) => renderListItem(item, indent4, "-")).join("\n");
|
|
28941
29038
|
}
|
|
28942
|
-
function renderHeading(node,
|
|
29039
|
+
function renderHeading(node, indent4) {
|
|
28943
29040
|
const level = node.attrs?.level ?? 1;
|
|
28944
|
-
return `${"#".repeat(level)} ${renderChildren(node,
|
|
29041
|
+
return `${"#".repeat(level)} ${renderChildren(node, indent4)}`;
|
|
28945
29042
|
}
|
|
28946
29043
|
var renderers = {
|
|
28947
29044
|
text: (node) => renderInline(node),
|
|
28948
29045
|
paragraph: renderChildren,
|
|
28949
29046
|
orderedList: renderOrderedList,
|
|
28950
29047
|
bulletList: renderBulletList,
|
|
28951
|
-
listItem: (node,
|
|
29048
|
+
listItem: (node, indent4) => renderListItem(node, indent4, "-"),
|
|
28952
29049
|
heading: renderHeading,
|
|
28953
29050
|
doc: renderChildren
|
|
28954
29051
|
};
|
|
28955
|
-
function renderNode(node,
|
|
29052
|
+
function renderNode(node, indent4) {
|
|
28956
29053
|
const renderer = renderers[node.type];
|
|
28957
|
-
if (renderer) return renderer(node,
|
|
28958
|
-
return node.content ? renderChildren(node,
|
|
29054
|
+
if (renderer) return renderer(node, indent4);
|
|
29055
|
+
return node.content ? renderChildren(node, indent4) : "";
|
|
28959
29056
|
}
|
|
28960
|
-
function renderNodes(nodes,
|
|
28961
|
-
return nodes.map((node) => renderNode(node,
|
|
29057
|
+
function renderNodes(nodes, indent4) {
|
|
29058
|
+
return nodes.map((node) => renderNode(node, indent4)).join("");
|
|
28962
29059
|
}
|
|
28963
29060
|
function isListNode(node) {
|
|
28964
29061
|
return node.type === "orderedList" || node.type === "bulletList";
|
|
28965
29062
|
}
|
|
28966
|
-
function renderListChild(child,
|
|
28967
|
-
if (isListNode(child)) return renderNodes([child],
|
|
28968
|
-
if (child.type !== "paragraph") return renderNode(child,
|
|
28969
|
-
const text18 = renderChildren(child,
|
|
28970
|
-
return isFirst ? `${
|
|
29063
|
+
function renderListChild(child, indent4, pad3, marker2, isFirst) {
|
|
29064
|
+
if (isListNode(child)) return renderNodes([child], indent4 + 1);
|
|
29065
|
+
if (child.type !== "paragraph") return renderNode(child, indent4);
|
|
29066
|
+
const text18 = renderChildren(child, indent4);
|
|
29067
|
+
return isFirst ? `${pad3}${marker2} ${text18}` : `${pad3} ${text18}`;
|
|
28971
29068
|
}
|
|
28972
|
-
function renderListItem(node,
|
|
28973
|
-
const
|
|
28974
|
-
return (node.content ?? []).map((child, i) => renderListChild(child,
|
|
29069
|
+
function renderListItem(node, indent4, marker2) {
|
|
29070
|
+
const pad3 = " ".repeat(indent4);
|
|
29071
|
+
return (node.content ?? []).map((child, i) => renderListChild(child, indent4, pad3, marker2, i === 0)).join("\n");
|
|
28975
29072
|
}
|
|
28976
29073
|
function adfToText(doc) {
|
|
28977
29074
|
return renderNodes([doc], 0);
|
|
@@ -28985,7 +29082,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
28985
29082
|
const parsed = fetchIssue(issueKey, field);
|
|
28986
29083
|
const acValue = parsed?.fields?.[field];
|
|
28987
29084
|
if (!acValue) {
|
|
28988
|
-
console.log(
|
|
29085
|
+
console.log(chalk181.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
28989
29086
|
return;
|
|
28990
29087
|
}
|
|
28991
29088
|
if (typeof acValue === "string") {
|
|
@@ -29051,14 +29148,14 @@ async function jiraAuth() {
|
|
|
29051
29148
|
}
|
|
29052
29149
|
|
|
29053
29150
|
// src/commands/jira/viewIssue.ts
|
|
29054
|
-
import
|
|
29151
|
+
import chalk182 from "chalk";
|
|
29055
29152
|
function viewIssue2(issueKey) {
|
|
29056
29153
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29057
29154
|
const fields = parsed?.fields;
|
|
29058
29155
|
const summary = fields?.summary;
|
|
29059
29156
|
const description = fields?.description;
|
|
29060
29157
|
if (summary) {
|
|
29061
|
-
console.log(
|
|
29158
|
+
console.log(chalk182.bold(summary));
|
|
29062
29159
|
}
|
|
29063
29160
|
if (description) {
|
|
29064
29161
|
if (summary) console.log();
|
|
@@ -29072,7 +29169,7 @@ function viewIssue2(issueKey) {
|
|
|
29072
29169
|
}
|
|
29073
29170
|
if (!summary && !description) {
|
|
29074
29171
|
console.log(
|
|
29075
|
-
|
|
29172
|
+
chalk182.yellow(`No summary or description found on ${issueKey}.`)
|
|
29076
29173
|
);
|
|
29077
29174
|
}
|
|
29078
29175
|
}
|
|
@@ -29779,7 +29876,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
29779
29876
|
}
|
|
29780
29877
|
|
|
29781
29878
|
// src/commands/review/failCheckout.ts
|
|
29782
|
-
import
|
|
29879
|
+
import chalk183 from "chalk";
|
|
29783
29880
|
|
|
29784
29881
|
// src/commands/review/azCliProblem.ts
|
|
29785
29882
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
@@ -29832,14 +29929,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
29832
29929
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
29833
29930
|
if (headRef && stale === "local-work")
|
|
29834
29931
|
console.error(
|
|
29835
|
-
|
|
29932
|
+
chalk183.red(
|
|
29836
29933
|
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
29837
29934
|
)
|
|
29838
29935
|
);
|
|
29839
29936
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
29840
|
-
if (problem) console.error(
|
|
29937
|
+
if (problem) console.error(chalk183.red(problem));
|
|
29841
29938
|
console.error(
|
|
29842
|
-
|
|
29939
|
+
chalk183.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
29843
29940
|
);
|
|
29844
29941
|
process.exit(1);
|
|
29845
29942
|
}
|
|
@@ -30032,18 +30129,18 @@ function registerList(program) {
|
|
|
30032
30129
|
}
|
|
30033
30130
|
|
|
30034
30131
|
// src/commands/litellm/listModels.ts
|
|
30035
|
-
import
|
|
30132
|
+
import chalk185 from "chalk";
|
|
30036
30133
|
|
|
30037
30134
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30038
|
-
import
|
|
30135
|
+
import chalk184 from "chalk";
|
|
30039
30136
|
function resolveLitellmConfig() {
|
|
30040
30137
|
const { config, missing } = readLitellmConfig();
|
|
30041
30138
|
if (!config) {
|
|
30042
|
-
console.error(
|
|
30139
|
+
console.error(chalk184.red("LiteLLM is not configured"));
|
|
30043
30140
|
for (const key of missing) {
|
|
30044
30141
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30045
30142
|
console.error(
|
|
30046
|
-
|
|
30143
|
+
chalk184.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30047
30144
|
);
|
|
30048
30145
|
}
|
|
30049
30146
|
process.exit(1);
|
|
@@ -30069,13 +30166,13 @@ async function listModels(options2) {
|
|
|
30069
30166
|
} catch (error) {
|
|
30070
30167
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30071
30168
|
console.error(
|
|
30072
|
-
|
|
30169
|
+
chalk185.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30073
30170
|
);
|
|
30074
30171
|
process.exit(1);
|
|
30075
30172
|
}
|
|
30076
30173
|
const body = await response.text();
|
|
30077
30174
|
if (!response.ok) {
|
|
30078
|
-
console.error(
|
|
30175
|
+
console.error(chalk185.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30079
30176
|
process.exit(1);
|
|
30080
30177
|
}
|
|
30081
30178
|
if (options2.json) {
|
|
@@ -30095,15 +30192,15 @@ function registerLitellm(program) {
|
|
|
30095
30192
|
// src/commands/mermaidExport.ts
|
|
30096
30193
|
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
30097
30194
|
import { resolve as resolve21 } from "path";
|
|
30098
|
-
import
|
|
30195
|
+
import chalk188 from "chalk";
|
|
30099
30196
|
|
|
30100
30197
|
// src/commands/mermaid/exportFile.ts
|
|
30101
30198
|
import { readFileSync as readFileSync42, writeFileSync as writeFileSync34 } from "fs";
|
|
30102
30199
|
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
30103
|
-
import
|
|
30200
|
+
import chalk187 from "chalk";
|
|
30104
30201
|
|
|
30105
30202
|
// src/commands/mermaid/renderBlock.ts
|
|
30106
|
-
import
|
|
30203
|
+
import chalk186 from "chalk";
|
|
30107
30204
|
async function renderBlock(krokiUrl, source) {
|
|
30108
30205
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30109
30206
|
method: "POST",
|
|
@@ -30112,7 +30209,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30112
30209
|
});
|
|
30113
30210
|
if (!response.ok) {
|
|
30114
30211
|
console.error(
|
|
30115
|
-
|
|
30212
|
+
chalk186.red(
|
|
30116
30213
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
30117
30214
|
)
|
|
30118
30215
|
);
|
|
@@ -30130,19 +30227,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30130
30227
|
if (onlyIndex !== void 0) {
|
|
30131
30228
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30132
30229
|
console.error(
|
|
30133
|
-
|
|
30230
|
+
chalk187.red(
|
|
30134
30231
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
30135
30232
|
)
|
|
30136
30233
|
);
|
|
30137
30234
|
process.exit(1);
|
|
30138
30235
|
}
|
|
30139
30236
|
console.log(
|
|
30140
|
-
|
|
30237
|
+
chalk187.gray(
|
|
30141
30238
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
30142
30239
|
)
|
|
30143
30240
|
);
|
|
30144
30241
|
} else {
|
|
30145
|
-
console.log(
|
|
30242
|
+
console.log(chalk187.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
30146
30243
|
}
|
|
30147
30244
|
for (const [i, source] of blocks.entries()) {
|
|
30148
30245
|
const idx = i + 1;
|
|
@@ -30150,7 +30247,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30150
30247
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
30151
30248
|
const svg = await renderBlock(krokiUrl, source);
|
|
30152
30249
|
writeFileSync34(outPath, svg, "utf8");
|
|
30153
|
-
console.log(
|
|
30250
|
+
console.log(chalk187.green(` \u2192 ${outPath}`));
|
|
30154
30251
|
}
|
|
30155
30252
|
}
|
|
30156
30253
|
function extractMermaidBlocks(markdown) {
|
|
@@ -30166,18 +30263,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
30166
30263
|
if (options2.index !== void 0) {
|
|
30167
30264
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
30168
30265
|
console.error(
|
|
30169
|
-
|
|
30266
|
+
chalk188.red(`--index must be a positive integer (got ${options2.index})`)
|
|
30170
30267
|
);
|
|
30171
30268
|
process.exit(1);
|
|
30172
30269
|
}
|
|
30173
30270
|
if (!file) {
|
|
30174
|
-
console.error(
|
|
30271
|
+
console.error(chalk188.red("--index requires a file argument"));
|
|
30175
30272
|
process.exit(1);
|
|
30176
30273
|
}
|
|
30177
30274
|
}
|
|
30178
30275
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
30179
30276
|
if (files.length === 0) {
|
|
30180
|
-
console.log(
|
|
30277
|
+
console.log(chalk188.gray("No markdown files found in current directory."));
|
|
30181
30278
|
return;
|
|
30182
30279
|
}
|
|
30183
30280
|
for (const f of files) {
|
|
@@ -30323,7 +30420,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
30323
30420
|
}
|
|
30324
30421
|
|
|
30325
30422
|
// src/commands/miro/keptTexts.ts
|
|
30326
|
-
import
|
|
30423
|
+
import chalk189 from "chalk";
|
|
30327
30424
|
|
|
30328
30425
|
// src/commands/miro/applyIgnore.ts
|
|
30329
30426
|
function applyIgnore(texts, ignore3) {
|
|
@@ -30362,7 +30459,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
30362
30459
|
if (unmatched.length === 0) return;
|
|
30363
30460
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
30364
30461
|
console.error(
|
|
30365
|
-
|
|
30462
|
+
chalk189.yellow(
|
|
30366
30463
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
30367
30464
|
${entries}`
|
|
30368
30465
|
)
|
|
@@ -30563,7 +30660,7 @@ function readMiroItems(file) {
|
|
|
30563
30660
|
}
|
|
30564
30661
|
|
|
30565
30662
|
// src/commands/miro/resolveExtractOptions.ts
|
|
30566
|
-
import
|
|
30663
|
+
import chalk190 from "chalk";
|
|
30567
30664
|
|
|
30568
30665
|
// src/commands/miro/extractLayers.ts
|
|
30569
30666
|
function extractsIn(layer) {
|
|
@@ -30641,7 +30738,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
30641
30738
|
paths.cwd,
|
|
30642
30739
|
paths.globalConfigPath
|
|
30643
30740
|
);
|
|
30644
|
-
console.error(
|
|
30741
|
+
console.error(chalk190.dim(`Extract "${name}" from ${resolved.from}`));
|
|
30645
30742
|
return resolved.options;
|
|
30646
30743
|
}
|
|
30647
30744
|
|
|
@@ -30746,7 +30843,7 @@ function registerMiro(program) {
|
|
|
30746
30843
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
30747
30844
|
import { createServer as createServer2 } from "http";
|
|
30748
30845
|
import { dirname as dirname36 } from "path";
|
|
30749
|
-
import
|
|
30846
|
+
import chalk192 from "chalk";
|
|
30750
30847
|
|
|
30751
30848
|
// src/commands/netcap/corsHeaders.ts
|
|
30752
30849
|
var corsHeaders = {
|
|
@@ -30825,7 +30922,7 @@ function createNetcapHandler(options2) {
|
|
|
30825
30922
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
30826
30923
|
import { networkInterfaces } from "os";
|
|
30827
30924
|
import { join as join76 } from "path";
|
|
30828
|
-
import
|
|
30925
|
+
import chalk191 from "chalk";
|
|
30829
30926
|
|
|
30830
30927
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
30831
30928
|
import { dirname as dirname35, join as join75 } from "path";
|
|
@@ -30869,7 +30966,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30869
30966
|
const host = lanIPv4();
|
|
30870
30967
|
if (!host) {
|
|
30871
30968
|
console.log(
|
|
30872
|
-
|
|
30969
|
+
chalk191.yellow("could not determine the WSL IP for the extension")
|
|
30873
30970
|
);
|
|
30874
30971
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
30875
30972
|
return source;
|
|
@@ -30880,7 +30977,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30880
30977
|
return WSL_WINDOWS_PATH3;
|
|
30881
30978
|
} catch {
|
|
30882
30979
|
console.log(
|
|
30883
|
-
|
|
30980
|
+
chalk191.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
30884
30981
|
);
|
|
30885
30982
|
return source;
|
|
30886
30983
|
}
|
|
@@ -30913,30 +31010,30 @@ async function netcap(options2) {
|
|
|
30913
31010
|
let count10 = 0;
|
|
30914
31011
|
const handler = createNetcapHandler({
|
|
30915
31012
|
outPath,
|
|
30916
|
-
onPing: () => console.log(
|
|
31013
|
+
onPing: () => console.log(chalk192.dim("ping from extension")),
|
|
30917
31014
|
onCapture: (entry) => {
|
|
30918
31015
|
count10 += 1;
|
|
30919
31016
|
console.log(
|
|
30920
|
-
|
|
30921
|
-
|
|
31017
|
+
chalk192.green(`captured #${count10}`),
|
|
31018
|
+
chalk192.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
30922
31019
|
);
|
|
30923
31020
|
}
|
|
30924
31021
|
});
|
|
30925
31022
|
const server = createServer2(handler);
|
|
30926
31023
|
server.listen(port, () => {
|
|
30927
31024
|
console.log(
|
|
30928
|
-
|
|
31025
|
+
chalk192.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
30929
31026
|
);
|
|
30930
|
-
console.log(
|
|
31027
|
+
console.log(chalk192.dim(`appending captures to ${outPath}`));
|
|
30931
31028
|
if (filter)
|
|
30932
|
-
console.log(
|
|
30933
|
-
console.log(
|
|
30934
|
-
console.log(
|
|
31029
|
+
console.log(chalk192.dim(`forwarding only URLs matching "${filter}"`));
|
|
31030
|
+
console.log(chalk192.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31031
|
+
console.log(chalk192.dim("press Ctrl-C to stop"));
|
|
30935
31032
|
});
|
|
30936
31033
|
process.on("SIGINT", () => {
|
|
30937
31034
|
server.close();
|
|
30938
31035
|
console.log(
|
|
30939
|
-
|
|
31036
|
+
chalk192.bold(
|
|
30940
31037
|
`
|
|
30941
31038
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
30942
31039
|
)
|
|
@@ -30948,7 +31045,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
30948
31045
|
// src/commands/netcap/netcapExtract.ts
|
|
30949
31046
|
import { writeFileSync as writeFileSync36 } from "fs";
|
|
30950
31047
|
import { join as join79 } from "path";
|
|
30951
|
-
import
|
|
31048
|
+
import chalk193 from "chalk";
|
|
30952
31049
|
|
|
30953
31050
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
30954
31051
|
import { readFileSync as readFileSync45 } from "fs";
|
|
@@ -31396,8 +31493,8 @@ function netcapExtract(file) {
|
|
|
31396
31493
|
writeFileSync36(outFile, `${JSON.stringify(posts, null, 2)}
|
|
31397
31494
|
`);
|
|
31398
31495
|
console.log(
|
|
31399
|
-
|
|
31400
|
-
|
|
31496
|
+
chalk193.green(`extracted ${posts.length} posts`),
|
|
31497
|
+
chalk193.dim(`-> ${outFile}`)
|
|
31401
31498
|
);
|
|
31402
31499
|
}
|
|
31403
31500
|
|
|
@@ -31418,7 +31515,7 @@ function registerNetcap(program) {
|
|
|
31418
31515
|
}
|
|
31419
31516
|
|
|
31420
31517
|
// src/commands/news/add.ts
|
|
31421
|
-
import
|
|
31518
|
+
import chalk194 from "chalk";
|
|
31422
31519
|
import enquirer8 from "enquirer";
|
|
31423
31520
|
async function add2(url) {
|
|
31424
31521
|
if (!url) {
|
|
@@ -31439,25 +31536,25 @@ async function add2(url) {
|
|
|
31439
31536
|
}
|
|
31440
31537
|
const added = await addFeed(await getDb(), url);
|
|
31441
31538
|
if (!added) {
|
|
31442
|
-
console.log(
|
|
31539
|
+
console.log(chalk194.yellow("Feed already exists"));
|
|
31443
31540
|
return;
|
|
31444
31541
|
}
|
|
31445
|
-
console.log(
|
|
31542
|
+
console.log(chalk194.green(`Added feed: ${url}`));
|
|
31446
31543
|
}
|
|
31447
31544
|
|
|
31448
31545
|
// src/commands/news/list.ts
|
|
31449
|
-
import
|
|
31546
|
+
import chalk195 from "chalk";
|
|
31450
31547
|
async function list4() {
|
|
31451
31548
|
const urls = await listFeeds(await getDb());
|
|
31452
31549
|
if (urls.length === 0) {
|
|
31453
|
-
console.log(
|
|
31550
|
+
console.log(chalk195.dim("No feeds; add one with assist news add <url>"));
|
|
31454
31551
|
return;
|
|
31455
31552
|
}
|
|
31456
31553
|
for (const url of urls) console.log(url);
|
|
31457
31554
|
}
|
|
31458
31555
|
|
|
31459
31556
|
// src/commands/news/remove.ts
|
|
31460
|
-
import
|
|
31557
|
+
import chalk196 from "chalk";
|
|
31461
31558
|
|
|
31462
31559
|
// src/commands/backlog/removeFeed.ts
|
|
31463
31560
|
import { eq as eq49 } from "drizzle-orm";
|
|
@@ -31470,10 +31567,10 @@ async function removeFeed(db, url) {
|
|
|
31470
31567
|
async function remove(url) {
|
|
31471
31568
|
const removed = await removeFeed(await getDb(), url);
|
|
31472
31569
|
if (!removed) {
|
|
31473
|
-
console.log(
|
|
31570
|
+
console.log(chalk196.yellow(`No feed matches ${url}`));
|
|
31474
31571
|
return;
|
|
31475
31572
|
}
|
|
31476
|
-
console.log(
|
|
31573
|
+
console.log(chalk196.green(`Removed feed: ${url}`));
|
|
31477
31574
|
}
|
|
31478
31575
|
|
|
31479
31576
|
// src/commands/registerNews.ts
|
|
@@ -31526,7 +31623,7 @@ function registerPiHook(program) {
|
|
|
31526
31623
|
}
|
|
31527
31624
|
|
|
31528
31625
|
// src/commands/prompts/printPromptsTable.ts
|
|
31529
|
-
import
|
|
31626
|
+
import chalk197 from "chalk";
|
|
31530
31627
|
function truncate(str, max) {
|
|
31531
31628
|
if (str.length <= max) return str;
|
|
31532
31629
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -31544,14 +31641,14 @@ function printPromptsTable(rows) {
|
|
|
31544
31641
|
"Command".padEnd(commandWidth),
|
|
31545
31642
|
"Repos"
|
|
31546
31643
|
].join(" ");
|
|
31547
|
-
console.log(
|
|
31548
|
-
console.log(
|
|
31644
|
+
console.log(chalk197.dim(header));
|
|
31645
|
+
console.log(chalk197.dim("-".repeat(header.length)));
|
|
31549
31646
|
for (const row3 of rows) {
|
|
31550
31647
|
const count10 = String(row3.count).padStart(countWidth);
|
|
31551
31648
|
const tool = row3.tool.padEnd(toolWidth);
|
|
31552
31649
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
31553
31650
|
console.log(
|
|
31554
|
-
`${
|
|
31651
|
+
`${chalk197.yellow(count10)} ${tool} ${command} ${chalk197.dim(row3.repos)}`
|
|
31555
31652
|
);
|
|
31556
31653
|
}
|
|
31557
31654
|
}
|
|
@@ -31589,13 +31686,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
31589
31686
|
import enquirer9 from "enquirer";
|
|
31590
31687
|
|
|
31591
31688
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
31592
|
-
import
|
|
31689
|
+
import chalk198 from "chalk";
|
|
31593
31690
|
var STATUS_MAP = {
|
|
31594
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
31595
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
31691
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk198.magenta("merged"), date: pr.mergedAt } : null,
|
|
31692
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk198.red("closed"), date: pr.closedAt } : null
|
|
31596
31693
|
};
|
|
31597
31694
|
function defaultStatus(pr) {
|
|
31598
|
-
return { label:
|
|
31695
|
+
return { label: chalk198.green("opened"), date: pr.createdAt };
|
|
31599
31696
|
}
|
|
31600
31697
|
function getStatus2(pr) {
|
|
31601
31698
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -31604,11 +31701,11 @@ function formatDate(dateStr) {
|
|
|
31604
31701
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
31605
31702
|
}
|
|
31606
31703
|
function formatPrHeader(pr, status2) {
|
|
31607
|
-
return `${
|
|
31704
|
+
return `${chalk198.cyan(`#${pr.number}`)} ${pr.title} ${chalk198.dim(`(${pr.author.login},`)} ${status2.label} ${chalk198.dim(`${formatDate(status2.date)})`)}`;
|
|
31608
31705
|
}
|
|
31609
31706
|
function logPrDetails(pr) {
|
|
31610
31707
|
console.log(
|
|
31611
|
-
|
|
31708
|
+
chalk198.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
31612
31709
|
);
|
|
31613
31710
|
console.log();
|
|
31614
31711
|
}
|
|
@@ -32177,13 +32274,13 @@ function agentFooter(unresolvedCount) {
|
|
|
32177
32274
|
}
|
|
32178
32275
|
|
|
32179
32276
|
// src/commands/prs/listComments/commentStyle.ts
|
|
32180
|
-
import
|
|
32277
|
+
import chalk199 from "chalk";
|
|
32181
32278
|
var plain = (text18) => text18;
|
|
32182
32279
|
function colouredState(state) {
|
|
32183
32280
|
const label = `[${state}]`;
|
|
32184
|
-
if (state === "APPROVED") return
|
|
32185
|
-
if (state === "CHANGES_REQUESTED") return
|
|
32186
|
-
return
|
|
32281
|
+
if (state === "APPROVED") return chalk199.green(label);
|
|
32282
|
+
if (state === "CHANGES_REQUESTED") return chalk199.red(label);
|
|
32283
|
+
return chalk199.yellow(label);
|
|
32187
32284
|
}
|
|
32188
32285
|
function commentStyle() {
|
|
32189
32286
|
if (isClaudeCode()) {
|
|
@@ -32197,9 +32294,9 @@ function commentStyle() {
|
|
|
32197
32294
|
};
|
|
32198
32295
|
}
|
|
32199
32296
|
return {
|
|
32200
|
-
cyan:
|
|
32201
|
-
bold:
|
|
32202
|
-
dim:
|
|
32297
|
+
cyan: chalk199.cyan,
|
|
32298
|
+
bold: chalk199.bold,
|
|
32299
|
+
dim: chalk199.dim,
|
|
32203
32300
|
state: colouredState,
|
|
32204
32301
|
diffHunk: true,
|
|
32205
32302
|
agent: false
|
|
@@ -32246,7 +32343,7 @@ function renderResolvedIndex(threads, style) {
|
|
|
32246
32343
|
}
|
|
32247
32344
|
|
|
32248
32345
|
// src/commands/prs/listComments/renderThreadBlock.ts
|
|
32249
|
-
function
|
|
32346
|
+
function indent2(text18) {
|
|
32250
32347
|
return text18.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
|
|
32251
32348
|
}
|
|
32252
32349
|
function renderThreadBlock(thread, style) {
|
|
@@ -32257,12 +32354,12 @@ function renderThreadBlock(thread, style) {
|
|
|
32257
32354
|
];
|
|
32258
32355
|
if (style.diffHunk) {
|
|
32259
32356
|
lines2.push(
|
|
32260
|
-
|
|
32357
|
+
indent2(style.dim(first.diff_hunk.split("\n").slice(-3).join("\n")))
|
|
32261
32358
|
);
|
|
32262
32359
|
}
|
|
32263
32360
|
for (const comment3 of thread.comments) {
|
|
32264
32361
|
lines2.push(
|
|
32265
|
-
|
|
32362
|
+
indent2(
|
|
32266
32363
|
[
|
|
32267
32364
|
`${style.bold(comment3.user)} ${style.dim(`id ${comment3.id}`)} ${style.dim(comment3.html_url)}`,
|
|
32268
32365
|
comment3.body,
|
|
@@ -33673,16 +33770,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
33673
33770
|
}
|
|
33674
33771
|
|
|
33675
33772
|
// src/commands/prs/status/printPrsStatus.ts
|
|
33676
|
-
import
|
|
33773
|
+
import chalk201 from "chalk";
|
|
33677
33774
|
|
|
33678
33775
|
// src/commands/prs/status/printPrStatus.ts
|
|
33679
|
-
import
|
|
33776
|
+
import chalk200 from "chalk";
|
|
33680
33777
|
function flags(pr) {
|
|
33681
33778
|
const markers = [];
|
|
33682
33779
|
if (pr.isDraft) markers.push("draft");
|
|
33683
33780
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
33684
33781
|
if (pr.isBot) markers.push("bot");
|
|
33685
|
-
return markers.length ? ` ${
|
|
33782
|
+
return markers.length ? ` ${chalk200.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
33686
33783
|
}
|
|
33687
33784
|
function updated(pr) {
|
|
33688
33785
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -33696,35 +33793,35 @@ function reviewLine(pr) {
|
|
|
33696
33793
|
function checkLines(pr) {
|
|
33697
33794
|
const lines2 = [];
|
|
33698
33795
|
if (pr.checks.failing.length) {
|
|
33699
|
-
lines2.push(
|
|
33796
|
+
lines2.push(chalk200.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
33700
33797
|
}
|
|
33701
33798
|
if (pr.checks.pending.length) {
|
|
33702
|
-
lines2.push(
|
|
33799
|
+
lines2.push(chalk200.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
33703
33800
|
}
|
|
33704
33801
|
return lines2;
|
|
33705
33802
|
}
|
|
33706
33803
|
function threadsLine(pr) {
|
|
33707
33804
|
if (pr.unresolvedThreads === null) {
|
|
33708
|
-
return
|
|
33805
|
+
return chalk200.dim("unresolved comments: unknown");
|
|
33709
33806
|
}
|
|
33710
33807
|
if (pr.unresolvedThreads === 0) return null;
|
|
33711
|
-
return
|
|
33808
|
+
return chalk200.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
33712
33809
|
}
|
|
33713
33810
|
function mergeableLine(pr) {
|
|
33714
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
33811
|
+
if (pr.mergeable === "CONFLICTING") return chalk200.red("conflicting");
|
|
33715
33812
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
33716
|
-
return
|
|
33813
|
+
return chalk200.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
33717
33814
|
}
|
|
33718
33815
|
function printPrStatus(pr) {
|
|
33719
33816
|
console.log(
|
|
33720
|
-
` ${
|
|
33817
|
+
` ${chalk200.cyan(`#${pr.number}`)} ${pr.title} ${chalk200.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
33721
33818
|
);
|
|
33722
33819
|
const details = [
|
|
33723
33820
|
reviewLine(pr),
|
|
33724
33821
|
...checkLines(pr),
|
|
33725
33822
|
threadsLine(pr),
|
|
33726
33823
|
mergeableLine(pr),
|
|
33727
|
-
|
|
33824
|
+
chalk200.dim(pr.url)
|
|
33728
33825
|
];
|
|
33729
33826
|
for (const detail of details) {
|
|
33730
33827
|
if (detail) console.log(` ${detail}`);
|
|
@@ -33735,17 +33832,17 @@ function printPrStatus(pr) {
|
|
|
33735
33832
|
function printPrsStatus(report) {
|
|
33736
33833
|
for (const repo of report.repos) {
|
|
33737
33834
|
const count10 = repo.pullRequests.length;
|
|
33738
|
-
console.log(`${
|
|
33835
|
+
console.log(`${chalk201.bold(repo.repo)} ${chalk201.dim(`(${count10} open)`)}`);
|
|
33739
33836
|
for (const pr of repo.pullRequests) {
|
|
33740
33837
|
printPrStatus(pr);
|
|
33741
33838
|
}
|
|
33742
|
-
if (count10 === 0) console.log(
|
|
33839
|
+
if (count10 === 0) console.log(chalk201.dim(" no open pull requests"));
|
|
33743
33840
|
console.log();
|
|
33744
33841
|
}
|
|
33745
33842
|
if (report.errors.length === 0) return;
|
|
33746
|
-
console.log(
|
|
33843
|
+
console.log(chalk201.bold("Errors"));
|
|
33747
33844
|
for (const failure of report.errors) {
|
|
33748
|
-
console.log(` ${
|
|
33845
|
+
console.log(` ${chalk201.red(failure.repo)}: ${failure.error}`);
|
|
33749
33846
|
}
|
|
33750
33847
|
console.log();
|
|
33751
33848
|
}
|
|
@@ -33973,10 +34070,10 @@ function registerPrs(program) {
|
|
|
33973
34070
|
}
|
|
33974
34071
|
|
|
33975
34072
|
// src/commands/ravendb/ravendbAuth.ts
|
|
33976
|
-
import
|
|
34073
|
+
import chalk207 from "chalk";
|
|
33977
34074
|
|
|
33978
34075
|
// src/shared/createConnectionAuth.ts
|
|
33979
|
-
import
|
|
34076
|
+
import chalk202 from "chalk";
|
|
33980
34077
|
function listConnections(connections, format3) {
|
|
33981
34078
|
if (connections.length === 0) {
|
|
33982
34079
|
console.log("No connections configured.");
|
|
@@ -33989,7 +34086,7 @@ function listConnections(connections, format3) {
|
|
|
33989
34086
|
function removeConnection(connections, name, save) {
|
|
33990
34087
|
const filtered = connections.filter((c) => c.name !== name);
|
|
33991
34088
|
if (filtered.length === connections.length) {
|
|
33992
|
-
console.error(
|
|
34089
|
+
console.error(chalk202.red(`Connection "${name}" not found.`));
|
|
33993
34090
|
process.exit(1);
|
|
33994
34091
|
}
|
|
33995
34092
|
save(filtered);
|
|
@@ -34035,15 +34132,15 @@ function saveConnections(connections) {
|
|
|
34035
34132
|
}
|
|
34036
34133
|
|
|
34037
34134
|
// src/commands/ravendb/promptConnection.ts
|
|
34038
|
-
import
|
|
34135
|
+
import chalk205 from "chalk";
|
|
34039
34136
|
|
|
34040
34137
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34041
|
-
import
|
|
34138
|
+
import chalk204 from "chalk";
|
|
34042
34139
|
import Enquirer2 from "enquirer";
|
|
34043
34140
|
|
|
34044
34141
|
// src/commands/ravendb/searchItems.ts
|
|
34045
34142
|
import { execSync as execSync48 } from "child_process";
|
|
34046
|
-
import
|
|
34143
|
+
import chalk203 from "chalk";
|
|
34047
34144
|
function opExec(args) {
|
|
34048
34145
|
return execSync48(`op ${args}`, {
|
|
34049
34146
|
encoding: "utf8",
|
|
@@ -34056,7 +34153,7 @@ function searchItems(search2) {
|
|
|
34056
34153
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34057
34154
|
} catch {
|
|
34058
34155
|
console.error(
|
|
34059
|
-
|
|
34156
|
+
chalk203.red(
|
|
34060
34157
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34061
34158
|
)
|
|
34062
34159
|
);
|
|
@@ -34070,7 +34167,7 @@ function getItemFields(itemId2) {
|
|
|
34070
34167
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34071
34168
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34072
34169
|
} catch {
|
|
34073
|
-
console.error(
|
|
34170
|
+
console.error(chalk203.red("Failed to get item details from 1Password."));
|
|
34074
34171
|
process.exit(1);
|
|
34075
34172
|
}
|
|
34076
34173
|
}
|
|
@@ -34089,7 +34186,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34089
34186
|
}).run();
|
|
34090
34187
|
const items2 = searchItems(search2);
|
|
34091
34188
|
if (items2.length === 0) {
|
|
34092
|
-
console.error(
|
|
34189
|
+
console.error(chalk204.red(`No items found matching "${search2}".`));
|
|
34093
34190
|
process.exit(1);
|
|
34094
34191
|
}
|
|
34095
34192
|
const itemId2 = await selectOne(
|
|
@@ -34098,7 +34195,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34098
34195
|
);
|
|
34099
34196
|
const fields = getItemFields(itemId2);
|
|
34100
34197
|
if (fields.length === 0) {
|
|
34101
|
-
console.error(
|
|
34198
|
+
console.error(chalk204.red("No fields with references found on this item."));
|
|
34102
34199
|
process.exit(1);
|
|
34103
34200
|
}
|
|
34104
34201
|
const ref = await selectOne(
|
|
@@ -34112,7 +34209,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34112
34209
|
async function promptConnection(existingNames) {
|
|
34113
34210
|
const name = await promptInput("name", "Connection name:");
|
|
34114
34211
|
if (existingNames.includes(name)) {
|
|
34115
|
-
console.error(
|
|
34212
|
+
console.error(chalk205.red(`Connection "${name}" already exists.`));
|
|
34116
34213
|
process.exit(1);
|
|
34117
34214
|
}
|
|
34118
34215
|
const url = await promptInput(
|
|
@@ -34121,22 +34218,22 @@ async function promptConnection(existingNames) {
|
|
|
34121
34218
|
);
|
|
34122
34219
|
const database = await promptInput("database", "Database name:");
|
|
34123
34220
|
if (!name || !url || !database) {
|
|
34124
|
-
console.error(
|
|
34221
|
+
console.error(chalk205.red("All fields are required."));
|
|
34125
34222
|
process.exit(1);
|
|
34126
34223
|
}
|
|
34127
34224
|
const apiKeyRef = await selectOpSecret();
|
|
34128
|
-
console.log(
|
|
34225
|
+
console.log(chalk205.dim(`Using: ${apiKeyRef}`));
|
|
34129
34226
|
return { name, url, database, apiKeyRef };
|
|
34130
34227
|
}
|
|
34131
34228
|
|
|
34132
34229
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
34133
|
-
import
|
|
34230
|
+
import chalk206 from "chalk";
|
|
34134
34231
|
function ravendbSetConnection(name) {
|
|
34135
34232
|
const raw = loadGlobalConfigRaw();
|
|
34136
34233
|
const ravendb = raw.ravendb ?? {};
|
|
34137
34234
|
const connections = ravendb.connections ?? [];
|
|
34138
34235
|
if (!connections.some((c) => c.name === name)) {
|
|
34139
|
-
console.error(
|
|
34236
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
34140
34237
|
console.error(
|
|
34141
34238
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34142
34239
|
);
|
|
@@ -34152,16 +34249,16 @@ function ravendbSetConnection(name) {
|
|
|
34152
34249
|
var ravendbAuth = createConnectionAuth({
|
|
34153
34250
|
load: loadConnections,
|
|
34154
34251
|
save: saveConnections,
|
|
34155
|
-
format: (c) => `${
|
|
34252
|
+
format: (c) => `${chalk207.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
34156
34253
|
promptNew: promptConnection,
|
|
34157
34254
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
34158
34255
|
});
|
|
34159
34256
|
|
|
34160
34257
|
// src/commands/ravendb/ravendbCollections.ts
|
|
34161
|
-
import
|
|
34258
|
+
import chalk211 from "chalk";
|
|
34162
34259
|
|
|
34163
34260
|
// src/commands/ravendb/ravenFetch.ts
|
|
34164
|
-
import
|
|
34261
|
+
import chalk209 from "chalk";
|
|
34165
34262
|
|
|
34166
34263
|
// src/commands/ravendb/getAccessToken.ts
|
|
34167
34264
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -34198,10 +34295,10 @@ ${errorText}`
|
|
|
34198
34295
|
|
|
34199
34296
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
34200
34297
|
import { execSync as execSync49 } from "child_process";
|
|
34201
|
-
import
|
|
34298
|
+
import chalk208 from "chalk";
|
|
34202
34299
|
function resolveOpSecret(reference) {
|
|
34203
34300
|
if (!reference.startsWith("op://")) {
|
|
34204
|
-
console.error(
|
|
34301
|
+
console.error(chalk208.red(`Invalid secret reference: must start with op://`));
|
|
34205
34302
|
process.exit(1);
|
|
34206
34303
|
}
|
|
34207
34304
|
try {
|
|
@@ -34211,7 +34308,7 @@ function resolveOpSecret(reference) {
|
|
|
34211
34308
|
}).trim();
|
|
34212
34309
|
} catch {
|
|
34213
34310
|
console.error(
|
|
34214
|
-
|
|
34311
|
+
chalk208.red(
|
|
34215
34312
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
34216
34313
|
)
|
|
34217
34314
|
);
|
|
@@ -34238,7 +34335,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34238
34335
|
if (!response.ok) {
|
|
34239
34336
|
const body = await response.text();
|
|
34240
34337
|
console.error(
|
|
34241
|
-
|
|
34338
|
+
chalk209.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
34242
34339
|
);
|
|
34243
34340
|
console.error(body.substring(0, 500));
|
|
34244
34341
|
process.exit(1);
|
|
@@ -34247,7 +34344,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34247
34344
|
}
|
|
34248
34345
|
|
|
34249
34346
|
// src/commands/ravendb/resolveConnection.ts
|
|
34250
|
-
import
|
|
34347
|
+
import chalk210 from "chalk";
|
|
34251
34348
|
function loadRavendb() {
|
|
34252
34349
|
const raw = loadGlobalConfigRaw();
|
|
34253
34350
|
const ravendb = raw.ravendb;
|
|
@@ -34261,7 +34358,7 @@ function resolveConnection(name) {
|
|
|
34261
34358
|
const connectionName = name ?? defaultConnection;
|
|
34262
34359
|
if (!connectionName) {
|
|
34263
34360
|
console.error(
|
|
34264
|
-
|
|
34361
|
+
chalk210.red(
|
|
34265
34362
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
34266
34363
|
)
|
|
34267
34364
|
);
|
|
@@ -34269,7 +34366,7 @@ function resolveConnection(name) {
|
|
|
34269
34366
|
}
|
|
34270
34367
|
const connection = connections.find((c) => c.name === connectionName);
|
|
34271
34368
|
if (!connection) {
|
|
34272
|
-
console.error(
|
|
34369
|
+
console.error(chalk210.red(`Connection "${connectionName}" not found.`));
|
|
34273
34370
|
console.error(
|
|
34274
34371
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34275
34372
|
);
|
|
@@ -34300,15 +34397,15 @@ async function ravendbCollections(connectionName) {
|
|
|
34300
34397
|
return;
|
|
34301
34398
|
}
|
|
34302
34399
|
for (const c of collections) {
|
|
34303
|
-
console.log(`${
|
|
34400
|
+
console.log(`${chalk211.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
34304
34401
|
}
|
|
34305
34402
|
}
|
|
34306
34403
|
|
|
34307
34404
|
// src/commands/ravendb/ravendbQuery.ts
|
|
34308
|
-
import
|
|
34405
|
+
import chalk213 from "chalk";
|
|
34309
34406
|
|
|
34310
34407
|
// src/commands/ravendb/fetchAllPages.ts
|
|
34311
|
-
import
|
|
34408
|
+
import chalk212 from "chalk";
|
|
34312
34409
|
|
|
34313
34410
|
// src/commands/ravendb/buildQueryPath.ts
|
|
34314
34411
|
function buildQueryPath(opts) {
|
|
@@ -34346,7 +34443,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34346
34443
|
allResults.push(...results);
|
|
34347
34444
|
start2 += results.length;
|
|
34348
34445
|
process.stderr.write(
|
|
34349
|
-
`\r${
|
|
34446
|
+
`\r${chalk212.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
34350
34447
|
);
|
|
34351
34448
|
if (start2 >= totalResults) break;
|
|
34352
34449
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -34361,7 +34458,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34361
34458
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
34362
34459
|
const resolved = resolveArgs(connectionName, collection);
|
|
34363
34460
|
if (!resolved.collection && !options2.query) {
|
|
34364
|
-
console.error(
|
|
34461
|
+
console.error(chalk213.red("Provide a collection name or --query filter."));
|
|
34365
34462
|
process.exit(1);
|
|
34366
34463
|
}
|
|
34367
34464
|
const { collection: col } = resolved;
|
|
@@ -34396,7 +34493,7 @@ function registerRavendb(program) {
|
|
|
34396
34493
|
}
|
|
34397
34494
|
|
|
34398
34495
|
// src/commands/releases/releasesConfigure.ts
|
|
34399
|
-
import
|
|
34496
|
+
import chalk215 from "chalk";
|
|
34400
34497
|
|
|
34401
34498
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
34402
34499
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -34467,26 +34564,26 @@ function readStreamsInput(source) {
|
|
|
34467
34564
|
}
|
|
34468
34565
|
|
|
34469
34566
|
// src/commands/releases/reportDerivedStreams.ts
|
|
34470
|
-
import
|
|
34567
|
+
import chalk214 from "chalk";
|
|
34471
34568
|
function printDerived(stream) {
|
|
34472
34569
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
34473
34570
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
34474
34571
|
console.log(
|
|
34475
|
-
`${
|
|
34572
|
+
`${chalk214.bold(stream.name)} ${chalk214.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
34476
34573
|
);
|
|
34477
34574
|
console.log(
|
|
34478
|
-
` environments: ${environments.join(", ") ||
|
|
34575
|
+
` environments: ${environments.join(", ") || chalk214.dim("none")}`
|
|
34479
34576
|
);
|
|
34480
34577
|
if (steps.length > 0)
|
|
34481
34578
|
console.log(
|
|
34482
34579
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
34483
34580
|
);
|
|
34484
34581
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
34485
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
34582
|
+
console.log(` edges: ${edges.join(", ") || chalk214.dim("none")}`);
|
|
34486
34583
|
}
|
|
34487
34584
|
function reportDerivedStreams(streams, target) {
|
|
34488
34585
|
for (const stream of streams) printDerived(stream);
|
|
34489
|
-
console.log(
|
|
34586
|
+
console.log(chalk214.dim(`Written to ${target}`));
|
|
34490
34587
|
}
|
|
34491
34588
|
|
|
34492
34589
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -34577,8 +34674,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
34577
34674
|
|
|
34578
34675
|
// src/commands/releases/releasesConfigure.ts
|
|
34579
34676
|
function fail7(message3, details = []) {
|
|
34580
|
-
console.error(
|
|
34581
|
-
for (const detail of details) console.error(
|
|
34677
|
+
console.error(chalk215.red(message3));
|
|
34678
|
+
for (const detail of details) console.error(chalk215.red(` ${detail}`));
|
|
34582
34679
|
process.exitCode = 1;
|
|
34583
34680
|
}
|
|
34584
34681
|
function reportWritten(incoming, target) {
|
|
@@ -34611,23 +34708,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
34611
34708
|
}
|
|
34612
34709
|
|
|
34613
34710
|
// src/commands/releases/releasesList.ts
|
|
34614
|
-
import
|
|
34711
|
+
import chalk216 from "chalk";
|
|
34615
34712
|
function describeNode(node) {
|
|
34616
34713
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
34617
34714
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
34618
34715
|
}
|
|
34619
34716
|
function printStream(stream) {
|
|
34620
|
-
console.log(`${
|
|
34621
|
-
console.log(
|
|
34717
|
+
console.log(`${chalk216.bold(stream.name)} ${chalk216.dim(stream.repo)}`);
|
|
34718
|
+
console.log(chalk216.dim(` workflow: ${stream.workflow}`));
|
|
34622
34719
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
34623
34720
|
for (const [from, to] of stream.edges)
|
|
34624
|
-
console.log(
|
|
34721
|
+
console.log(chalk216.dim(` ${from} \u2192 ${to}`));
|
|
34625
34722
|
}
|
|
34626
34723
|
function releasesList() {
|
|
34627
34724
|
const streams = loadConfig().releases?.streams ?? [];
|
|
34628
34725
|
if (streams.length === 0) {
|
|
34629
34726
|
console.log(
|
|
34630
|
-
|
|
34727
|
+
chalk216.dim("No release streams configured under releases.streams.")
|
|
34631
34728
|
);
|
|
34632
34729
|
return;
|
|
34633
34730
|
}
|
|
@@ -34675,7 +34772,7 @@ function coverage() {
|
|
|
34675
34772
|
|
|
34676
34773
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34677
34774
|
import path45 from "path";
|
|
34678
|
-
import
|
|
34775
|
+
import chalk218 from "chalk";
|
|
34679
34776
|
|
|
34680
34777
|
// src/commands/lint/lint/checkFileNames.ts
|
|
34681
34778
|
import fs23 from "fs";
|
|
@@ -34755,7 +34852,7 @@ function checkFileNames() {
|
|
|
34755
34852
|
}
|
|
34756
34853
|
|
|
34757
34854
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
34758
|
-
import
|
|
34855
|
+
import chalk217 from "chalk";
|
|
34759
34856
|
|
|
34760
34857
|
// src/commands/lint/lint/applyMoves.ts
|
|
34761
34858
|
import fs24 from "fs";
|
|
@@ -34840,25 +34937,25 @@ function fixFileNameViolations(moves) {
|
|
|
34840
34937
|
const start2 = performance.now();
|
|
34841
34938
|
const project = createLintProject();
|
|
34842
34939
|
const cwd = process.cwd();
|
|
34843
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
34940
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk217.green(line)));
|
|
34844
34941
|
const ms = (performance.now() - start2).toFixed(0);
|
|
34845
|
-
console.log(
|
|
34942
|
+
console.log(chalk217.dim(` Done in ${ms}ms`));
|
|
34846
34943
|
}
|
|
34847
34944
|
|
|
34848
34945
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34849
34946
|
function reportViolations(violations) {
|
|
34850
|
-
console.error(
|
|
34947
|
+
console.error(chalk218.red("\nFile name check failed:\n"));
|
|
34851
34948
|
console.error(
|
|
34852
|
-
|
|
34949
|
+
chalk218.red(
|
|
34853
34950
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
34854
34951
|
)
|
|
34855
34952
|
);
|
|
34856
34953
|
for (const violation of violations) {
|
|
34857
|
-
console.error(
|
|
34858
|
-
console.error(
|
|
34954
|
+
console.error(chalk218.red(` ${violation.filePath}`));
|
|
34955
|
+
console.error(chalk218.gray(` Rename to: ${violation.suggestedName}
|
|
34859
34956
|
`));
|
|
34860
34957
|
}
|
|
34861
|
-
console.error(
|
|
34958
|
+
console.error(chalk218.dim(" Run with -f to auto-fix.\n"));
|
|
34862
34959
|
}
|
|
34863
34960
|
function runFileNameCheck(fix = false) {
|
|
34864
34961
|
const violations = checkFileNames();
|
|
@@ -34887,17 +34984,17 @@ function runFileNameCheck(fix = false) {
|
|
|
34887
34984
|
import fs26 from "fs";
|
|
34888
34985
|
|
|
34889
34986
|
// src/commands/lint/shared.ts
|
|
34890
|
-
import
|
|
34987
|
+
import chalk219 from "chalk";
|
|
34891
34988
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
34892
34989
|
if (violations.length > 0) {
|
|
34893
|
-
console.error(
|
|
34990
|
+
console.error(chalk219.red(`
|
|
34894
34991
|
${checkName2} failed:
|
|
34895
34992
|
`));
|
|
34896
|
-
console.error(
|
|
34993
|
+
console.error(chalk219.red(` ${errorMessage3}
|
|
34897
34994
|
`));
|
|
34898
34995
|
for (const violation of violations) {
|
|
34899
|
-
console.error(
|
|
34900
|
-
console.error(
|
|
34996
|
+
console.error(chalk219.red(` ${violation.filePath}:${violation.line}`));
|
|
34997
|
+
console.error(chalk219.gray(` ${violation.content}
|
|
34901
34998
|
`));
|
|
34902
34999
|
}
|
|
34903
35000
|
return false;
|
|
@@ -35122,7 +35219,7 @@ import { execSync as execSync51 } from "child_process";
|
|
|
35122
35219
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
35123
35220
|
import { tmpdir as tmpdir7 } from "os";
|
|
35124
35221
|
import { join as join83, resolve as resolve25 } from "path";
|
|
35125
|
-
import
|
|
35222
|
+
import chalk220 from "chalk";
|
|
35126
35223
|
|
|
35127
35224
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
35128
35225
|
var captureWindowPs1 = `
|
|
@@ -35273,19 +35370,19 @@ function screenshot(processName) {
|
|
|
35273
35370
|
const config = loadConfig();
|
|
35274
35371
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
35275
35372
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
35276
|
-
console.log(
|
|
35373
|
+
console.log(chalk220.gray(`Capturing window for process "${processName}" ...`));
|
|
35277
35374
|
try {
|
|
35278
35375
|
runPowerShellScript(processName, outputPath);
|
|
35279
|
-
console.log(
|
|
35376
|
+
console.log(chalk220.green(`Screenshot saved: ${outputPath}`));
|
|
35280
35377
|
} catch (error) {
|
|
35281
35378
|
const msg = error instanceof Error ? error.message : String(error);
|
|
35282
|
-
console.error(
|
|
35379
|
+
console.error(chalk220.red(`Failed to capture screenshot: ${msg}`));
|
|
35283
35380
|
process.exit(1);
|
|
35284
35381
|
}
|
|
35285
35382
|
}
|
|
35286
35383
|
|
|
35287
35384
|
// src/commands/statusLine.ts
|
|
35288
|
-
import
|
|
35385
|
+
import chalk222 from "chalk";
|
|
35289
35386
|
|
|
35290
35387
|
// src/shared/contextLevel.ts
|
|
35291
35388
|
var THRESHOLDS = {
|
|
@@ -35301,7 +35398,7 @@ function contextLevel(pct, harness) {
|
|
|
35301
35398
|
}
|
|
35302
35399
|
|
|
35303
35400
|
// src/commands/buildLimitsSegment.ts
|
|
35304
|
-
import
|
|
35401
|
+
import chalk221 from "chalk";
|
|
35305
35402
|
|
|
35306
35403
|
// src/shared/rateLimitLevel.ts
|
|
35307
35404
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35339,9 +35436,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35339
35436
|
|
|
35340
35437
|
// src/commands/buildLimitsSegment.ts
|
|
35341
35438
|
var LEVEL_COLOR = {
|
|
35342
|
-
ok:
|
|
35343
|
-
warn:
|
|
35344
|
-
over:
|
|
35439
|
+
ok: chalk221.green,
|
|
35440
|
+
warn: chalk221.yellow,
|
|
35441
|
+
over: chalk221.red
|
|
35345
35442
|
};
|
|
35346
35443
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35347
35444
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -35437,7 +35534,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
35437
35534
|
}
|
|
35438
35535
|
|
|
35439
35536
|
// src/commands/statusLine.ts
|
|
35440
|
-
|
|
35537
|
+
chalk222.level = 3;
|
|
35441
35538
|
function formatNumber(num) {
|
|
35442
35539
|
return num.toLocaleString("en-US");
|
|
35443
35540
|
}
|
|
@@ -35445,9 +35542,9 @@ function colorizePercent(pct) {
|
|
|
35445
35542
|
const label = `${Math.round(pct)}%`;
|
|
35446
35543
|
switch (contextLevel(pct)) {
|
|
35447
35544
|
case "red":
|
|
35448
|
-
return
|
|
35545
|
+
return chalk222.red(label);
|
|
35449
35546
|
case "yellow":
|
|
35450
|
-
return
|
|
35547
|
+
return chalk222.yellow(label);
|
|
35451
35548
|
default:
|
|
35452
35549
|
return label;
|
|
35453
35550
|
}
|
|
@@ -35460,7 +35557,7 @@ async function statusLine() {
|
|
|
35460
35557
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
35461
35558
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
35462
35559
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
35463
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
35560
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk222.cyan(branch2)} | ` : "";
|
|
35464
35561
|
console.log(
|
|
35465
35562
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
35466
35563
|
);
|
|
@@ -35567,7 +35664,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
35567
35664
|
import * as path48 from "path";
|
|
35568
35665
|
|
|
35569
35666
|
// src/commands/refactor/logViolations.ts
|
|
35570
|
-
import
|
|
35667
|
+
import chalk223 from "chalk";
|
|
35571
35668
|
var DEFAULT_MAX_LINES2 = 100;
|
|
35572
35669
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
35573
35670
|
if (violations.length === 0) {
|
|
@@ -35576,43 +35673,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
35576
35673
|
}
|
|
35577
35674
|
return;
|
|
35578
35675
|
}
|
|
35579
|
-
console.error(
|
|
35676
|
+
console.error(chalk223.red(`
|
|
35580
35677
|
Refactor check failed:
|
|
35581
35678
|
`));
|
|
35582
|
-
console.error(
|
|
35679
|
+
console.error(chalk223.red(` The following files exceed ${maxLines} lines:
|
|
35583
35680
|
`));
|
|
35584
35681
|
for (const violation of violations) {
|
|
35585
|
-
console.error(
|
|
35682
|
+
console.error(chalk223.red(` ${violation.file} (${violation.lines} lines)`));
|
|
35586
35683
|
}
|
|
35587
35684
|
console.error(
|
|
35588
|
-
|
|
35685
|
+
chalk223.yellow(
|
|
35589
35686
|
`
|
|
35590
35687
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
35591
35688
|
way to refactor it, ignore it with:
|
|
35592
35689
|
`
|
|
35593
35690
|
)
|
|
35594
35691
|
);
|
|
35595
|
-
console.error(
|
|
35692
|
+
console.error(chalk223.gray(` assist refactor ignore <file>
|
|
35596
35693
|
`));
|
|
35597
35694
|
if (process.env.CLAUDECODE) {
|
|
35598
|
-
console.error(
|
|
35695
|
+
console.error(chalk223.cyan(`
|
|
35599
35696
|
## Extracting Code to New Files
|
|
35600
35697
|
`));
|
|
35601
35698
|
console.error(
|
|
35602
|
-
|
|
35699
|
+
chalk223.cyan(
|
|
35603
35700
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
35604
35701
|
`
|
|
35605
35702
|
)
|
|
35606
35703
|
);
|
|
35607
35704
|
console.error(
|
|
35608
|
-
|
|
35705
|
+
chalk223.cyan(
|
|
35609
35706
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
35610
35707
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
35611
35708
|
`
|
|
35612
35709
|
)
|
|
35613
35710
|
);
|
|
35614
35711
|
console.error(
|
|
35615
|
-
|
|
35712
|
+
chalk223.cyan(
|
|
35616
35713
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
35617
35714
|
domains, move it to a common/shared folder.
|
|
35618
35715
|
`
|
|
@@ -35768,7 +35865,7 @@ async function check(pattern2, options2) {
|
|
|
35768
35865
|
|
|
35769
35866
|
// src/commands/refactor/extract.ts
|
|
35770
35867
|
import path56 from "path";
|
|
35771
|
-
import
|
|
35868
|
+
import chalk226 from "chalk";
|
|
35772
35869
|
|
|
35773
35870
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
35774
35871
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -36376,23 +36473,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
36376
36473
|
|
|
36377
36474
|
// src/commands/refactor/extract/displayPlan.ts
|
|
36378
36475
|
import path52 from "path";
|
|
36379
|
-
import
|
|
36476
|
+
import chalk224 from "chalk";
|
|
36380
36477
|
function section(title) {
|
|
36381
36478
|
return `
|
|
36382
|
-
${
|
|
36479
|
+
${chalk224.cyan(title)}`;
|
|
36383
36480
|
}
|
|
36384
36481
|
function displayImporters(plan2, cwd) {
|
|
36385
36482
|
if (plan2.importersToUpdate.length === 0) return;
|
|
36386
36483
|
console.log(section("Update importers:"));
|
|
36387
36484
|
for (const imp of plan2.importersToUpdate) {
|
|
36388
36485
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
36389
|
-
console.log(` ${
|
|
36486
|
+
console.log(` ${chalk224.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
36390
36487
|
}
|
|
36391
36488
|
}
|
|
36392
36489
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
36393
|
-
console.log(
|
|
36490
|
+
console.log(chalk224.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
36394
36491
|
`));
|
|
36395
|
-
console.log(` ${
|
|
36492
|
+
console.log(` ${chalk224.cyan("Functions to move:")}`);
|
|
36396
36493
|
for (const name of plan2.extractedNames) {
|
|
36397
36494
|
console.log(` ${name}`);
|
|
36398
36495
|
}
|
|
@@ -36426,7 +36523,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
36426
36523
|
|
|
36427
36524
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
36428
36525
|
import path55 from "path";
|
|
36429
|
-
import
|
|
36526
|
+
import chalk225 from "chalk";
|
|
36430
36527
|
import { Project as Project4 } from "ts-morph";
|
|
36431
36528
|
|
|
36432
36529
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -36518,7 +36615,7 @@ function loadProjectFile(file) {
|
|
|
36518
36615
|
});
|
|
36519
36616
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
36520
36617
|
if (!sourceFile) {
|
|
36521
|
-
console.log(
|
|
36618
|
+
console.log(chalk225.red(`File not found in project: ${file}`));
|
|
36522
36619
|
process.exit(1);
|
|
36523
36620
|
}
|
|
36524
36621
|
return { project, sourceFile };
|
|
@@ -36541,19 +36638,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
36541
36638
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
36542
36639
|
if (options2.apply) {
|
|
36543
36640
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
36544
|
-
console.log(
|
|
36641
|
+
console.log(chalk226.green("\nExtraction complete"));
|
|
36545
36642
|
} else {
|
|
36546
|
-
console.log(
|
|
36643
|
+
console.log(chalk226.dim("\nDry run. Use --apply to execute."));
|
|
36547
36644
|
}
|
|
36548
36645
|
}
|
|
36549
36646
|
|
|
36550
36647
|
// src/commands/refactor/ignore.ts
|
|
36551
36648
|
import fs33 from "fs";
|
|
36552
|
-
import
|
|
36649
|
+
import chalk227 from "chalk";
|
|
36553
36650
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
36554
36651
|
function ignore2(file) {
|
|
36555
36652
|
if (!fs33.existsSync(file)) {
|
|
36556
|
-
console.error(
|
|
36653
|
+
console.error(chalk227.red(`Error: File does not exist: ${file}`));
|
|
36557
36654
|
process.exit(1);
|
|
36558
36655
|
}
|
|
36559
36656
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -36569,7 +36666,7 @@ function ignore2(file) {
|
|
|
36569
36666
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
36570
36667
|
}
|
|
36571
36668
|
console.log(
|
|
36572
|
-
|
|
36669
|
+
chalk227.green(
|
|
36573
36670
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
36574
36671
|
)
|
|
36575
36672
|
);
|
|
@@ -36578,12 +36675,12 @@ function ignore2(file) {
|
|
|
36578
36675
|
// src/commands/refactor/rename.ts
|
|
36579
36676
|
import fs36 from "fs";
|
|
36580
36677
|
import path62 from "path";
|
|
36581
|
-
import
|
|
36678
|
+
import chalk230 from "chalk";
|
|
36582
36679
|
|
|
36583
36680
|
// src/commands/refactor/rename/applyRename.ts
|
|
36584
36681
|
import fs35 from "fs";
|
|
36585
36682
|
import path58 from "path";
|
|
36586
|
-
import
|
|
36683
|
+
import chalk228 from "chalk";
|
|
36587
36684
|
|
|
36588
36685
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
36589
36686
|
import path57 from "path";
|
|
@@ -36689,13 +36786,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
36689
36786
|
const updatedContents = applyRewrites(rewrites);
|
|
36690
36787
|
for (const [file, content] of updatedContents) {
|
|
36691
36788
|
fs35.writeFileSync(file, content, "utf8");
|
|
36692
|
-
console.log(
|
|
36789
|
+
console.log(chalk228.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
36693
36790
|
}
|
|
36694
36791
|
const destDir = path58.dirname(destPath);
|
|
36695
36792
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
36696
36793
|
fs35.renameSync(sourcePath, destPath);
|
|
36697
36794
|
console.log(
|
|
36698
|
-
|
|
36795
|
+
chalk228.white(
|
|
36699
36796
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
36700
36797
|
)
|
|
36701
36798
|
);
|
|
@@ -36845,16 +36942,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
36845
36942
|
|
|
36846
36943
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
36847
36944
|
import path61 from "path";
|
|
36848
|
-
import
|
|
36945
|
+
import chalk229 from "chalk";
|
|
36849
36946
|
function printRenamePreview(rewrites, cwd) {
|
|
36850
36947
|
for (const rewrite of rewrites) {
|
|
36851
36948
|
console.log(
|
|
36852
|
-
|
|
36949
|
+
chalk229.dim(
|
|
36853
36950
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
36854
36951
|
)
|
|
36855
36952
|
);
|
|
36856
36953
|
}
|
|
36857
|
-
console.log(
|
|
36954
|
+
console.log(chalk229.dim("Dry run. Use --apply to execute."));
|
|
36858
36955
|
}
|
|
36859
36956
|
|
|
36860
36957
|
// src/commands/refactor/rename.ts
|
|
@@ -36865,20 +36962,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36865
36962
|
const relSource = path62.relative(cwd, sourcePath);
|
|
36866
36963
|
const relDest = path62.relative(cwd, destPath);
|
|
36867
36964
|
if (!fs36.existsSync(sourcePath)) {
|
|
36868
|
-
console.log(
|
|
36965
|
+
console.log(chalk230.red(`File not found: ${source}`));
|
|
36869
36966
|
process.exit(1);
|
|
36870
36967
|
}
|
|
36871
36968
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
36872
|
-
console.log(
|
|
36969
|
+
console.log(chalk230.red(`Destination already exists: ${destination}`));
|
|
36873
36970
|
process.exit(1);
|
|
36874
36971
|
}
|
|
36875
|
-
console.log(
|
|
36876
|
-
console.log(
|
|
36877
|
-
console.log(
|
|
36972
|
+
console.log(chalk230.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
36973
|
+
console.log(chalk230.dim("Loading project..."));
|
|
36974
|
+
console.log(chalk230.dim("Scanning imports across the project..."));
|
|
36878
36975
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
36879
36976
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
36880
36977
|
console.log(
|
|
36881
|
-
|
|
36978
|
+
chalk230.dim(
|
|
36882
36979
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
36883
36980
|
)
|
|
36884
36981
|
);
|
|
@@ -36887,11 +36984,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36887
36984
|
return;
|
|
36888
36985
|
}
|
|
36889
36986
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
36890
|
-
console.log(
|
|
36987
|
+
console.log(chalk230.green("Done"));
|
|
36891
36988
|
}
|
|
36892
36989
|
|
|
36893
36990
|
// src/commands/refactor/renameSymbol.ts
|
|
36894
|
-
import
|
|
36991
|
+
import chalk231 from "chalk";
|
|
36895
36992
|
|
|
36896
36993
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
36897
36994
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -36937,34 +37034,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
36937
37034
|
const { project, sourceFile } = loadProjectFile(file);
|
|
36938
37035
|
const symbol = findSymbol(sourceFile, oldName);
|
|
36939
37036
|
if (!symbol) {
|
|
36940
|
-
console.log(
|
|
37037
|
+
console.log(chalk231.red(`Symbol "${oldName}" not found in ${file}`));
|
|
36941
37038
|
process.exit(1);
|
|
36942
37039
|
}
|
|
36943
37040
|
const grouped = groupReferences(symbol, cwd);
|
|
36944
37041
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
36945
37042
|
console.log(
|
|
36946
|
-
|
|
37043
|
+
chalk231.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
36947
37044
|
`)
|
|
36948
37045
|
);
|
|
36949
37046
|
for (const [refFile, lines2] of grouped) {
|
|
36950
37047
|
console.log(
|
|
36951
|
-
` ${
|
|
37048
|
+
` ${chalk231.dim(refFile)}: lines ${chalk231.cyan(lines2.join(", "))}`
|
|
36952
37049
|
);
|
|
36953
37050
|
}
|
|
36954
37051
|
if (options2.apply) {
|
|
36955
37052
|
symbol.rename(newName);
|
|
36956
37053
|
await project.save();
|
|
36957
|
-
console.log(
|
|
37054
|
+
console.log(chalk231.green(`
|
|
36958
37055
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
36959
37056
|
} else {
|
|
36960
|
-
console.log(
|
|
37057
|
+
console.log(chalk231.dim("\nDry run. Use --apply to execute."));
|
|
36961
37058
|
}
|
|
36962
37059
|
}
|
|
36963
37060
|
|
|
36964
37061
|
// src/commands/refactor/restructure.ts
|
|
36965
37062
|
import fs38 from "fs";
|
|
36966
37063
|
import path83 from "path";
|
|
36967
|
-
import
|
|
37064
|
+
import chalk241 from "chalk";
|
|
36968
37065
|
|
|
36969
37066
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
36970
37067
|
import path73 from "path";
|
|
@@ -37301,7 +37398,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
37301
37398
|
}
|
|
37302
37399
|
|
|
37303
37400
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
37304
|
-
import
|
|
37401
|
+
import chalk236 from "chalk";
|
|
37305
37402
|
|
|
37306
37403
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
37307
37404
|
import path74 from "path";
|
|
@@ -37312,13 +37409,13 @@ function applyCommand(scopeRoot) {
|
|
|
37312
37409
|
|
|
37313
37410
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
37314
37411
|
import path75 from "path";
|
|
37315
|
-
import
|
|
37412
|
+
import chalk232 from "chalk";
|
|
37316
37413
|
var shownMoves = 20;
|
|
37317
37414
|
function displayDrift(plan2, listMoves) {
|
|
37318
37415
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
37319
37416
|
if (plan2.moves.length > 0) {
|
|
37320
37417
|
console.log(
|
|
37321
|
-
|
|
37418
|
+
chalk232.red(
|
|
37322
37419
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
37323
37420
|
)
|
|
37324
37421
|
);
|
|
@@ -37326,17 +37423,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
37326
37423
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
37327
37424
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
37328
37425
|
if (plan2.moves.length > shownMoves)
|
|
37329
|
-
console.log(
|
|
37426
|
+
console.log(chalk232.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
37330
37427
|
}
|
|
37331
37428
|
}
|
|
37332
|
-
for (const error of plan2.errors) console.log(
|
|
37429
|
+
for (const error of plan2.errors) console.log(chalk232.red(error));
|
|
37333
37430
|
}
|
|
37334
37431
|
|
|
37335
37432
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
37336
|
-
import
|
|
37433
|
+
import chalk235 from "chalk";
|
|
37337
37434
|
|
|
37338
37435
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
37339
|
-
import
|
|
37436
|
+
import chalk233 from "chalk";
|
|
37340
37437
|
var shownChains = 10;
|
|
37341
37438
|
function formatChain(chain2) {
|
|
37342
37439
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -37346,28 +37443,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
37346
37443
|
if (chains.length === 0) return;
|
|
37347
37444
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
37348
37445
|
console.log(
|
|
37349
|
-
|
|
37446
|
+
chalk233.red(
|
|
37350
37447
|
`
|
|
37351
37448
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
37352
37449
|
)
|
|
37353
37450
|
);
|
|
37354
37451
|
console.log(
|
|
37355
|
-
|
|
37452
|
+
chalk233.bold(
|
|
37356
37453
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
37357
37454
|
)
|
|
37358
37455
|
);
|
|
37359
37456
|
for (const chain2 of chains.slice(0, shownChains))
|
|
37360
37457
|
console.log(formatChain(chain2));
|
|
37361
37458
|
if (chains.length > shownChains)
|
|
37362
|
-
console.log(
|
|
37459
|
+
console.log(chalk233.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
37363
37460
|
}
|
|
37364
37461
|
|
|
37365
37462
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
37366
|
-
import
|
|
37463
|
+
import chalk234 from "chalk";
|
|
37367
37464
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
37368
37465
|
if (longPaths.length === 0) return;
|
|
37369
37466
|
console.log(
|
|
37370
|
-
|
|
37467
|
+
chalk234.red(
|
|
37371
37468
|
`
|
|
37372
37469
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
37373
37470
|
)
|
|
@@ -37395,7 +37492,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
37395
37492
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
37396
37493
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
37397
37494
|
console.log("");
|
|
37398
|
-
for (const line of pinSteps(apply)) console.log(
|
|
37495
|
+
for (const line of pinSteps(apply)) console.log(chalk235.yellow(line));
|
|
37399
37496
|
}
|
|
37400
37497
|
|
|
37401
37498
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -37407,14 +37504,14 @@ function checkPlan(plan2, limits) {
|
|
|
37407
37504
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
37408
37505
|
if (plan2.moves.length > 0) {
|
|
37409
37506
|
console.log(
|
|
37410
|
-
|
|
37507
|
+
chalk236.yellow(
|
|
37411
37508
|
`
|
|
37412
37509
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
37413
37510
|
)
|
|
37414
37511
|
);
|
|
37415
37512
|
process.exit(1);
|
|
37416
37513
|
}
|
|
37417
|
-
console.log(
|
|
37514
|
+
console.log(chalk236.green("Layout matches the restructure plan"));
|
|
37418
37515
|
}
|
|
37419
37516
|
|
|
37420
37517
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -37484,15 +37581,15 @@ function partitionIgnored(files) {
|
|
|
37484
37581
|
}
|
|
37485
37582
|
|
|
37486
37583
|
// src/commands/refactor/restructure/runPlan.ts
|
|
37487
|
-
import
|
|
37584
|
+
import chalk240 from "chalk";
|
|
37488
37585
|
|
|
37489
37586
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37490
|
-
import
|
|
37587
|
+
import chalk238 from "chalk";
|
|
37491
37588
|
|
|
37492
37589
|
// src/commands/refactor/restructure/executePlan.ts
|
|
37493
37590
|
import fs37 from "fs";
|
|
37494
37591
|
import path79 from "path";
|
|
37495
|
-
import
|
|
37592
|
+
import chalk237 from "chalk";
|
|
37496
37593
|
function relPath(file) {
|
|
37497
37594
|
return path79.relative(process.cwd(), file);
|
|
37498
37595
|
}
|
|
@@ -37509,14 +37606,14 @@ function moveFiles(moves) {
|
|
|
37509
37606
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
37510
37607
|
fs37.renameSync(staging, move2.to);
|
|
37511
37608
|
console.log(
|
|
37512
|
-
|
|
37609
|
+
chalk237.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
37513
37610
|
);
|
|
37514
37611
|
}
|
|
37515
37612
|
}
|
|
37516
37613
|
function removeIfEmpty(dir) {
|
|
37517
37614
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
37518
37615
|
fs37.rmdirSync(dir);
|
|
37519
|
-
console.log(
|
|
37616
|
+
console.log(chalk237.dim(` Removed empty directory ${relPath(dir)}`));
|
|
37520
37617
|
return true;
|
|
37521
37618
|
}
|
|
37522
37619
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -37529,7 +37626,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
37529
37626
|
function executePlan(plan2) {
|
|
37530
37627
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
37531
37628
|
fs37.writeFileSync(file, content, "utf8");
|
|
37532
|
-
console.log(
|
|
37629
|
+
console.log(chalk237.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
37533
37630
|
}
|
|
37534
37631
|
moveFiles(plan2.moves);
|
|
37535
37632
|
removeEmptyDirectories(
|
|
@@ -37541,17 +37638,17 @@ function executePlan(plan2) {
|
|
|
37541
37638
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37542
37639
|
function applyPlan(plan2) {
|
|
37543
37640
|
if (plan2.errors.length > 0) {
|
|
37544
|
-
console.log(
|
|
37641
|
+
console.log(chalk238.red("\nResolve the errors above before applying."));
|
|
37545
37642
|
process.exit(1);
|
|
37546
37643
|
}
|
|
37547
|
-
console.log(
|
|
37644
|
+
console.log(chalk238.bold("\nApplying changes..."));
|
|
37548
37645
|
executePlan(plan2);
|
|
37549
|
-
console.log(
|
|
37646
|
+
console.log(chalk238.green("\nRestructuring complete"));
|
|
37550
37647
|
}
|
|
37551
37648
|
|
|
37552
37649
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
37553
37650
|
import path82 from "path";
|
|
37554
|
-
import
|
|
37651
|
+
import chalk239 from "chalk";
|
|
37555
37652
|
|
|
37556
37653
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
37557
37654
|
import path80 from "path";
|
|
@@ -37577,14 +37674,14 @@ function insert(root2, parts) {
|
|
|
37577
37674
|
node = child;
|
|
37578
37675
|
}
|
|
37579
37676
|
}
|
|
37580
|
-
function render(node,
|
|
37677
|
+
function render(node, indent4, lines2) {
|
|
37581
37678
|
const entries = [...node].sort(([a, ca], [b, cb]) => {
|
|
37582
37679
|
const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
|
|
37583
37680
|
return dirFirst || a.localeCompare(b);
|
|
37584
37681
|
});
|
|
37585
37682
|
for (const [name, child] of entries) {
|
|
37586
|
-
lines2.push(`${
|
|
37587
|
-
render(child, `${
|
|
37683
|
+
lines2.push(`${indent4}${name}${child.size > 0 ? "/" : ""}`);
|
|
37684
|
+
render(child, `${indent4} `, lines2);
|
|
37588
37685
|
}
|
|
37589
37686
|
}
|
|
37590
37687
|
function formatTree(files, scopeRoot) {
|
|
@@ -37602,17 +37699,17 @@ function relPath2(filePath) {
|
|
|
37602
37699
|
}
|
|
37603
37700
|
function displayMoves(plan2) {
|
|
37604
37701
|
if (plan2.moves.length === 0) return;
|
|
37605
|
-
console.log(
|
|
37702
|
+
console.log(chalk239.bold("\nFile moves:"));
|
|
37606
37703
|
for (const move2 of plan2.moves) {
|
|
37607
37704
|
console.log(
|
|
37608
|
-
` ${
|
|
37705
|
+
` ${chalk239.red(relPath2(move2.from))} \u2192 ${chalk239.green(relPath2(move2.to))}`
|
|
37609
37706
|
);
|
|
37610
|
-
console.log(
|
|
37707
|
+
console.log(chalk239.dim(` ${move2.reason}`));
|
|
37611
37708
|
}
|
|
37612
37709
|
}
|
|
37613
37710
|
function displayTree(plan2) {
|
|
37614
37711
|
console.log(
|
|
37615
|
-
|
|
37712
|
+
chalk239.bold(`
|
|
37616
37713
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
37617
37714
|
);
|
|
37618
37715
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -37623,15 +37720,15 @@ function displayDepthStats(plan2) {
|
|
|
37623
37720
|
plan2.targets.values(),
|
|
37624
37721
|
plan2.scopeRoot
|
|
37625
37722
|
);
|
|
37626
|
-
console.log(
|
|
37723
|
+
console.log(chalk239.bold(`
|
|
37627
37724
|
Depth (max ${max}):`));
|
|
37628
37725
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
37629
37726
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
37630
37727
|
}
|
|
37631
37728
|
function displayErrors(errors) {
|
|
37632
37729
|
if (errors.length === 0) return;
|
|
37633
|
-
console.log(
|
|
37634
|
-
for (const error of errors) console.log(
|
|
37730
|
+
console.log(chalk239.red("\nErrors:"));
|
|
37731
|
+
for (const error of errors) console.log(chalk239.red(` ${error}`));
|
|
37635
37732
|
}
|
|
37636
37733
|
function displayPlan2(plan2) {
|
|
37637
37734
|
displayMoves(plan2);
|
|
@@ -37640,7 +37737,7 @@ function displayPlan2(plan2) {
|
|
|
37640
37737
|
displayErrors(plan2.errors);
|
|
37641
37738
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
37642
37739
|
console.log(
|
|
37643
|
-
|
|
37740
|
+
chalk239.dim(
|
|
37644
37741
|
`
|
|
37645
37742
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
37646
37743
|
)
|
|
@@ -37652,11 +37749,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
37652
37749
|
displayPlan2(plan2);
|
|
37653
37750
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
37654
37751
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
37655
|
-
console.log(
|
|
37752
|
+
console.log(chalk240.green("No restructuring needed"));
|
|
37656
37753
|
return;
|
|
37657
37754
|
}
|
|
37658
37755
|
if (!apply) {
|
|
37659
|
-
console.log(
|
|
37756
|
+
console.log(chalk240.dim("\nDry run. Use --apply to execute."));
|
|
37660
37757
|
return;
|
|
37661
37758
|
}
|
|
37662
37759
|
applyPlan(plan2);
|
|
@@ -37666,14 +37763,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
37666
37763
|
async function restructure(root2, options2 = {}) {
|
|
37667
37764
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
37668
37765
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
37669
|
-
console.log(
|
|
37766
|
+
console.log(chalk241.red(`Not a directory: ${root2 ?? "src"}`));
|
|
37670
37767
|
process.exit(1);
|
|
37671
37768
|
}
|
|
37672
37769
|
const found = [];
|
|
37673
37770
|
walkSourceFiles(scopeRoot, found);
|
|
37674
37771
|
const { scoped, ignored } = partitionIgnored(found);
|
|
37675
37772
|
if (scoped.length === 0) {
|
|
37676
|
-
console.log(
|
|
37773
|
+
console.log(chalk241.yellow("No files found under root"));
|
|
37677
37774
|
return;
|
|
37678
37775
|
}
|
|
37679
37776
|
const {
|
|
@@ -37744,7 +37841,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
37744
37841
|
}
|
|
37745
37842
|
|
|
37746
37843
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
37747
|
-
import
|
|
37844
|
+
import chalk245 from "chalk";
|
|
37748
37845
|
|
|
37749
37846
|
// src/commands/config/promptConfigScope.ts
|
|
37750
37847
|
import Enquirer3 from "enquirer";
|
|
@@ -37770,7 +37867,7 @@ async function promptConfigScope() {
|
|
|
37770
37867
|
}
|
|
37771
37868
|
|
|
37772
37869
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
37773
|
-
import
|
|
37870
|
+
import chalk242 from "chalk";
|
|
37774
37871
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
37775
37872
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
37776
37873
|
for (; ; ) {
|
|
@@ -37778,7 +37875,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
37778
37875
|
if (answer === "") return void 0;
|
|
37779
37876
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
37780
37877
|
if (coercion.ok) return coercion.value;
|
|
37781
|
-
console.error(
|
|
37878
|
+
console.error(chalk242.red(coercion.error));
|
|
37782
37879
|
}
|
|
37783
37880
|
}
|
|
37784
37881
|
function coerceSupplied(key, supplied) {
|
|
@@ -37858,7 +37955,7 @@ function suggestGlobs(current, proposed) {
|
|
|
37858
37955
|
}
|
|
37859
37956
|
|
|
37860
37957
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
37861
|
-
import
|
|
37958
|
+
import chalk243 from "chalk";
|
|
37862
37959
|
function parseConfigureAnswers(answers) {
|
|
37863
37960
|
const known = Object.values(highLevelConfigKeys);
|
|
37864
37961
|
const parsed = {};
|
|
@@ -37876,13 +37973,13 @@ function answersCoverEveryKey(answers) {
|
|
|
37876
37973
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
37877
37974
|
}
|
|
37878
37975
|
function exitWith(message3) {
|
|
37879
|
-
console.error(
|
|
37976
|
+
console.error(chalk243.red(`Error: ${message3}.`));
|
|
37880
37977
|
process.exit(1);
|
|
37881
37978
|
}
|
|
37882
37979
|
|
|
37883
37980
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
37884
37981
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
37885
|
-
import
|
|
37982
|
+
import chalk244 from "chalk";
|
|
37886
37983
|
|
|
37887
37984
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
37888
37985
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -37976,12 +38073,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
37976
38073
|
const tree = summariseRepoTree(cwd);
|
|
37977
38074
|
if (tree === "") return NOTHING_PROPOSED;
|
|
37978
38075
|
console.log(
|
|
37979
|
-
|
|
38076
|
+
chalk244.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
37980
38077
|
);
|
|
37981
38078
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
37982
38079
|
if (output === void 0) {
|
|
37983
38080
|
console.log(
|
|
37984
|
-
|
|
38081
|
+
chalk244.yellow(
|
|
37985
38082
|
"Claude proposed nothing; answer each key from its current value."
|
|
37986
38083
|
)
|
|
37987
38084
|
);
|
|
@@ -38041,14 +38138,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38041
38138
|
function reportConfigured(result) {
|
|
38042
38139
|
for (const write of result.written)
|
|
38043
38140
|
console.log(
|
|
38044
|
-
|
|
38141
|
+
chalk245.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
38045
38142
|
);
|
|
38046
|
-
for (const key of result.skipped) console.log(
|
|
38047
|
-
console.log(
|
|
38143
|
+
for (const key of result.skipped) console.log(chalk245.dim(`Left ${key} unset`));
|
|
38144
|
+
console.log(chalk245.dim(`Written to ${result.target}`));
|
|
38048
38145
|
}
|
|
38049
38146
|
|
|
38050
38147
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38051
|
-
import
|
|
38148
|
+
import chalk246 from "chalk";
|
|
38052
38149
|
function savedMessage(subject) {
|
|
38053
38150
|
const head = subject.headSha.slice(0, 7);
|
|
38054
38151
|
if (subject.draft)
|
|
@@ -38059,10 +38156,10 @@ function savedMessage(subject) {
|
|
|
38059
38156
|
}
|
|
38060
38157
|
function announceSavedReview(subject, force) {
|
|
38061
38158
|
const message3 = savedMessage(subject);
|
|
38062
|
-
if (message3) console.log(
|
|
38159
|
+
if (message3) console.log(chalk246.dim(message3));
|
|
38063
38160
|
else if (force)
|
|
38064
38161
|
console.log(
|
|
38065
|
-
|
|
38162
|
+
chalk246.dim(
|
|
38066
38163
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38067
38164
|
)
|
|
38068
38165
|
);
|
|
@@ -38331,8 +38428,8 @@ function testName(call) {
|
|
|
38331
38428
|
function dedentedSource(call) {
|
|
38332
38429
|
const text18 = call.getSourceFile().getFullText();
|
|
38333
38430
|
const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
|
|
38334
|
-
const
|
|
38335
|
-
return call.getText().split("\n").map((line) => line.startsWith(
|
|
38431
|
+
const indent4 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
|
|
38432
|
+
return call.getText().split("\n").map((line) => line.startsWith(indent4) ? line.slice(indent4.length) : line).join("\n");
|
|
38336
38433
|
}
|
|
38337
38434
|
|
|
38338
38435
|
// src/commands/review/highLevel/visitCase.ts
|
|
@@ -39203,55 +39300,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39203
39300
|
}
|
|
39204
39301
|
|
|
39205
39302
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39206
|
-
import
|
|
39303
|
+
import chalk251 from "chalk";
|
|
39207
39304
|
|
|
39208
39305
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
39209
|
-
import
|
|
39306
|
+
import chalk247 from "chalk";
|
|
39210
39307
|
var PATCH_LINE_COLOURS = {
|
|
39211
|
-
"+":
|
|
39212
|
-
"-":
|
|
39213
|
-
"@":
|
|
39308
|
+
"+": chalk247.green,
|
|
39309
|
+
"-": chalk247.red,
|
|
39310
|
+
"@": chalk247.cyan
|
|
39214
39311
|
};
|
|
39215
39312
|
function formatPatch(patch2) {
|
|
39216
39313
|
return patch2.split("\n").map(
|
|
39217
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
39314
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk247.dim)(line)}`
|
|
39218
39315
|
);
|
|
39219
39316
|
}
|
|
39220
39317
|
function formatDiff(diff3) {
|
|
39221
39318
|
return [
|
|
39222
39319
|
"",
|
|
39223
|
-
` ${
|
|
39224
|
-
...diff3.patch === null ? [` ${
|
|
39320
|
+
` ${chalk247.bold(diff3.path)} ${chalk247.dim(`(${diff3.status})`)} ${chalk247.green(`+${diff3.additions}`)} ${chalk247.red(`-${diff3.deletions}`)}`,
|
|
39321
|
+
...diff3.patch === null ? [` ${chalk247.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
39225
39322
|
];
|
|
39226
39323
|
}
|
|
39227
39324
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
39228
39325
|
if (criticalPaths.length === 0)
|
|
39229
|
-
return `${
|
|
39230
|
-
${
|
|
39326
|
+
return `${chalk247.bold.underline("Critical diffs")}
|
|
39327
|
+
${chalk247.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
39231
39328
|
if (diffs.length === 0)
|
|
39232
|
-
return `${
|
|
39233
|
-
${
|
|
39329
|
+
return `${chalk247.bold.underline("Critical diffs")}
|
|
39330
|
+
${chalk247.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
39234
39331
|
return [
|
|
39235
|
-
|
|
39332
|
+
chalk247.bold.underline("Critical diffs"),
|
|
39236
39333
|
...diffs.flatMap(formatDiff)
|
|
39237
39334
|
].join("\n");
|
|
39238
39335
|
}
|
|
39239
39336
|
|
|
39240
39337
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
39241
|
-
import
|
|
39338
|
+
import chalk248 from "chalk";
|
|
39242
39339
|
var MARKERS = {
|
|
39243
|
-
pass: () =>
|
|
39244
|
-
fail: () =>
|
|
39245
|
-
manual: () =>
|
|
39340
|
+
pass: () => chalk248.green("\u2714"),
|
|
39341
|
+
fail: () => chalk248.red("\u2718"),
|
|
39342
|
+
manual: () => chalk248.yellow("\u25A1")
|
|
39246
39343
|
};
|
|
39247
39344
|
function formatCheck(check2) {
|
|
39248
|
-
const title = check2.status === "fail" ?
|
|
39345
|
+
const title = check2.status === "fail" ? chalk248.red(check2.title) : chalk248.bold(check2.title);
|
|
39249
39346
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
39250
|
-
${
|
|
39347
|
+
${chalk248.dim(check2.reason)}`;
|
|
39251
39348
|
}
|
|
39252
39349
|
function formatGroup(heading2, checks2) {
|
|
39253
39350
|
if (checks2.length === 0) return [];
|
|
39254
|
-
return ["",
|
|
39351
|
+
return ["", chalk248.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
39255
39352
|
}
|
|
39256
39353
|
function formatHighLevelChecklist(checks2) {
|
|
39257
39354
|
const deterministic = checks2.filter(
|
|
@@ -39260,7 +39357,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39260
39357
|
const failed3 = deterministic.filter(
|
|
39261
39358
|
(check2) => check2.status === "fail"
|
|
39262
39359
|
).length;
|
|
39263
|
-
const summary = failed3 === 0 ?
|
|
39360
|
+
const summary = failed3 === 0 ? chalk248.green(`All ${deterministic.length} deterministic checks pass`) : chalk248.red(
|
|
39264
39361
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
39265
39362
|
);
|
|
39266
39363
|
return [
|
|
@@ -39275,61 +39372,61 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39275
39372
|
}
|
|
39276
39373
|
|
|
39277
39374
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
39278
|
-
import
|
|
39375
|
+
import chalk249 from "chalk";
|
|
39279
39376
|
var STATUS_MARKERS = {
|
|
39280
|
-
added: () =>
|
|
39281
|
-
removed: () =>
|
|
39282
|
-
modified: () =>
|
|
39377
|
+
added: () => chalk249.green("A"),
|
|
39378
|
+
removed: () => chalk249.red("D"),
|
|
39379
|
+
modified: () => chalk249.yellow("M")
|
|
39283
39380
|
};
|
|
39284
39381
|
function counts(additions, deletions) {
|
|
39285
|
-
return `${
|
|
39382
|
+
return `${chalk249.green(`+${additions}`)} ${chalk249.red(`-${deletions}`)}`;
|
|
39286
39383
|
}
|
|
39287
|
-
function formatNode(node,
|
|
39384
|
+
function formatNode(node, indent4) {
|
|
39288
39385
|
if (node.kind === "file")
|
|
39289
39386
|
return [
|
|
39290
|
-
`${
|
|
39387
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk249.dim(counts(node.additions, node.deletions))}`
|
|
39291
39388
|
];
|
|
39292
39389
|
const dir = node;
|
|
39293
39390
|
return [
|
|
39294
|
-
`${
|
|
39295
|
-
...dir.children.flatMap((child) => formatNode(child, `${
|
|
39391
|
+
`${indent4}${chalk249.bold(`${dir.name}/`)} ${chalk249.dim(counts(dir.additions, dir.deletions))}`,
|
|
39392
|
+
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
39296
39393
|
];
|
|
39297
39394
|
}
|
|
39298
39395
|
function formatHighLevelStructure(structure) {
|
|
39299
39396
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
39300
39397
|
return [
|
|
39301
|
-
|
|
39398
|
+
chalk249.bold.underline("Structure"),
|
|
39302
39399
|
` ${summary}`,
|
|
39303
39400
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
39304
39401
|
].join("\n");
|
|
39305
39402
|
}
|
|
39306
39403
|
|
|
39307
39404
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
39308
|
-
import
|
|
39405
|
+
import chalk250 from "chalk";
|
|
39309
39406
|
function changeMarker(change) {
|
|
39310
39407
|
if (change === "added") return "A";
|
|
39311
39408
|
if (change === "modified") return "M";
|
|
39312
39409
|
return "\xB7";
|
|
39313
39410
|
}
|
|
39314
39411
|
function formatNode2(node, depth) {
|
|
39315
|
-
const
|
|
39412
|
+
const indent4 = " ".repeat(depth + 2);
|
|
39316
39413
|
if (node.kind === "it")
|
|
39317
|
-
return [`${
|
|
39414
|
+
return [`${indent4}${chalk250.dim(changeMarker(node.change))} ${node.name}`];
|
|
39318
39415
|
return [
|
|
39319
|
-
`${
|
|
39416
|
+
`${indent4}${chalk250.bold(node.name)}`,
|
|
39320
39417
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
39321
39418
|
];
|
|
39322
39419
|
}
|
|
39323
39420
|
function formatHighLevelTests(files, testPaths) {
|
|
39324
|
-
const heading2 =
|
|
39421
|
+
const heading2 = chalk250.bold.underline("Changed tests");
|
|
39325
39422
|
if (files.length === 0)
|
|
39326
39423
|
return `${heading2}
|
|
39327
|
-
${
|
|
39424
|
+
${chalk250.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
39328
39425
|
return [
|
|
39329
39426
|
heading2,
|
|
39330
39427
|
...files.flatMap((file) => [
|
|
39331
39428
|
"",
|
|
39332
|
-
` ${
|
|
39429
|
+
` ${chalk250.bold(file.path)} ${chalk250.dim(`(${file.status})`)}`,
|
|
39333
39430
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
39334
39431
|
])
|
|
39335
39432
|
].join("\n");
|
|
@@ -39343,10 +39440,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
39343
39440
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39344
39441
|
function printHighLevelChecklist(subject) {
|
|
39345
39442
|
console.log(
|
|
39346
|
-
|
|
39443
|
+
chalk251.bold(
|
|
39347
39444
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
39348
39445
|
),
|
|
39349
|
-
|
|
39446
|
+
chalk251.dim(
|
|
39350
39447
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
39351
39448
|
)
|
|
39352
39449
|
);
|
|
@@ -39360,12 +39457,12 @@ function printHighLevelChecklist(subject) {
|
|
|
39360
39457
|
console.log("");
|
|
39361
39458
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
39362
39459
|
console.log(
|
|
39363
|
-
|
|
39460
|
+
chalk251.dim(
|
|
39364
39461
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
39365
39462
|
)
|
|
39366
39463
|
);
|
|
39367
39464
|
console.log(
|
|
39368
|
-
|
|
39465
|
+
chalk251.dim(
|
|
39369
39466
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
39370
39467
|
)
|
|
39371
39468
|
);
|
|
@@ -39651,18 +39748,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
39651
39748
|
}
|
|
39652
39749
|
|
|
39653
39750
|
// src/commands/review/warnOutOfDiff.ts
|
|
39654
|
-
import
|
|
39751
|
+
import chalk252 from "chalk";
|
|
39655
39752
|
function warnOutOfDiff(outOfDiff) {
|
|
39656
39753
|
if (outOfDiff.length === 0) return;
|
|
39657
39754
|
console.warn(
|
|
39658
|
-
|
|
39755
|
+
chalk252.yellow(
|
|
39659
39756
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
39660
39757
|
)
|
|
39661
39758
|
);
|
|
39662
39759
|
for (const finding of outOfDiff) {
|
|
39663
39760
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
39664
39761
|
console.warn(
|
|
39665
|
-
` ${
|
|
39762
|
+
` ${chalk252.yellow("\xB7")} ${finding.title} ${chalk252.dim(
|
|
39666
39763
|
`(${finding.file}:${range})`
|
|
39667
39764
|
)}`
|
|
39668
39765
|
);
|
|
@@ -39689,18 +39786,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
39689
39786
|
}
|
|
39690
39787
|
|
|
39691
39788
|
// src/commands/review/warnUnlocated.ts
|
|
39692
|
-
import
|
|
39789
|
+
import chalk253 from "chalk";
|
|
39693
39790
|
function warnUnlocated(unlocated) {
|
|
39694
39791
|
if (unlocated.length === 0) return;
|
|
39695
39792
|
console.warn(
|
|
39696
|
-
|
|
39793
|
+
chalk253.yellow(
|
|
39697
39794
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
39698
39795
|
)
|
|
39699
39796
|
);
|
|
39700
39797
|
for (const finding of unlocated) {
|
|
39701
|
-
const where = finding.location ||
|
|
39798
|
+
const where = finding.location || chalk253.dim("missing");
|
|
39702
39799
|
console.warn(
|
|
39703
|
-
` ${
|
|
39800
|
+
` ${chalk253.yellow("\xB7")} ${finding.title} ${chalk253.dim(`(${where})`)}`
|
|
39704
39801
|
);
|
|
39705
39802
|
}
|
|
39706
39803
|
}
|
|
@@ -40396,7 +40493,7 @@ function attachStdoutTail(child, maxBytes = 8192) {
|
|
|
40396
40493
|
// src/commands/review/formatReviewerFailure.ts
|
|
40397
40494
|
var FAST_FAIL_MS = 1e3;
|
|
40398
40495
|
var STDOUT_TAIL_LINES = 20;
|
|
40399
|
-
function
|
|
40496
|
+
function indent3(text18) {
|
|
40400
40497
|
return text18.split(/\r?\n/).map((line) => ` ${line}`);
|
|
40401
40498
|
}
|
|
40402
40499
|
function tailLines(text18, maxLines) {
|
|
@@ -40415,12 +40512,12 @@ function fastFailHint(command) {
|
|
|
40415
40512
|
}
|
|
40416
40513
|
function outputDetail(input) {
|
|
40417
40514
|
const stderr = input.stderr.trim();
|
|
40418
|
-
if (stderr) return ["stderr:", ...
|
|
40515
|
+
if (stderr) return ["stderr:", ...indent3(stderr)];
|
|
40419
40516
|
const stdout = (input.stdout ?? "").trim();
|
|
40420
40517
|
if (stdout) {
|
|
40421
40518
|
return [
|
|
40422
40519
|
`stdout (no stderr was captured \u2014 showing last ${STDOUT_TAIL_LINES} lines):`,
|
|
40423
|
-
...
|
|
40520
|
+
...indent3(tailLines(stdout, STDOUT_TAIL_LINES))
|
|
40424
40521
|
];
|
|
40425
40522
|
}
|
|
40426
40523
|
return [
|
|
@@ -41845,7 +41942,7 @@ function registerReview(program) {
|
|
|
41845
41942
|
|
|
41846
41943
|
// src/commands/rules/indexRules.ts
|
|
41847
41944
|
import path87 from "path";
|
|
41848
|
-
import
|
|
41945
|
+
import chalk254 from "chalk";
|
|
41849
41946
|
|
|
41850
41947
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
41851
41948
|
import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
@@ -41932,24 +42029,24 @@ function indexRules() {
|
|
|
41932
42029
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
41933
42030
|
if (directories.length === 0) {
|
|
41934
42031
|
console.log(
|
|
41935
|
-
|
|
42032
|
+
chalk254.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
41936
42033
|
);
|
|
41937
42034
|
return;
|
|
41938
42035
|
}
|
|
41939
42036
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
41940
42037
|
for (const directory of directories)
|
|
41941
|
-
console.log(` ${
|
|
42038
|
+
console.log(` ${chalk254.cyan(directory)}`);
|
|
41942
42039
|
}
|
|
41943
42040
|
|
|
41944
42041
|
// src/commands/rules/listRules.ts
|
|
41945
42042
|
import path88 from "path";
|
|
41946
|
-
import
|
|
42043
|
+
import chalk255 from "chalk";
|
|
41947
42044
|
function listRules(target, options2 = {}) {
|
|
41948
42045
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
41949
42046
|
const rules2 = readScopedRules(resolved);
|
|
41950
42047
|
if (rules2.length === 0) {
|
|
41951
42048
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
41952
|
-
console.log(
|
|
42049
|
+
console.log(chalk255.gray(`No rules in scope for ${label}`));
|
|
41953
42050
|
return;
|
|
41954
42051
|
}
|
|
41955
42052
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -41959,21 +42056,21 @@ function listRules(target, options2 = {}) {
|
|
|
41959
42056
|
if (rule.source !== shown) {
|
|
41960
42057
|
shown = rule.source;
|
|
41961
42058
|
console.log(
|
|
41962
|
-
|
|
42059
|
+
chalk255.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
41963
42060
|
);
|
|
41964
42061
|
}
|
|
41965
42062
|
console.log(
|
|
41966
|
-
` ${
|
|
42063
|
+
` ${chalk255.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
41967
42064
|
);
|
|
41968
42065
|
if (options2.full && rule.title)
|
|
41969
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42066
|
+
console.log(` ${" ".repeat(width2)} ${chalk255.dim(rule.text)}`);
|
|
41970
42067
|
}
|
|
41971
42068
|
}
|
|
41972
42069
|
|
|
41973
42070
|
// src/commands/rules/addRule.ts
|
|
41974
42071
|
import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
|
|
41975
42072
|
import path90 from "path";
|
|
41976
|
-
import
|
|
42073
|
+
import chalk256 from "chalk";
|
|
41977
42074
|
|
|
41978
42075
|
// src/commands/rules/insertRuleBullet.ts
|
|
41979
42076
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42032,7 +42129,7 @@ function read2(file) {
|
|
|
42032
42129
|
function addRule(text18, options2) {
|
|
42033
42130
|
const rule = text18.trim();
|
|
42034
42131
|
if (rule === "") {
|
|
42035
|
-
console.error(
|
|
42132
|
+
console.error(chalk256.red("Rule text is required"));
|
|
42036
42133
|
process.exitCode = 1;
|
|
42037
42134
|
return;
|
|
42038
42135
|
}
|
|
@@ -42050,14 +42147,14 @@ function addRule(text18, options2) {
|
|
|
42050
42147
|
);
|
|
42051
42148
|
updateScopedRulesIndex(root2);
|
|
42052
42149
|
console.log(
|
|
42053
|
-
`Added ${
|
|
42150
|
+
`Added ${chalk256.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42054
42151
|
);
|
|
42055
42152
|
}
|
|
42056
42153
|
|
|
42057
42154
|
// src/commands/rules/addUserRule.ts
|
|
42058
|
-
import
|
|
42155
|
+
import chalk257 from "chalk";
|
|
42059
42156
|
function fail8(message3) {
|
|
42060
|
-
console.error(
|
|
42157
|
+
console.error(chalk257.red(message3));
|
|
42061
42158
|
process.exitCode = 1;
|
|
42062
42159
|
}
|
|
42063
42160
|
function asRules(value) {
|
|
@@ -42076,7 +42173,7 @@ async function addToUserDb(rule) {
|
|
|
42076
42173
|
rule
|
|
42077
42174
|
]);
|
|
42078
42175
|
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42079
|
-
console.log(`Added ${
|
|
42176
|
+
console.log(`Added ${chalk257.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42080
42177
|
}
|
|
42081
42178
|
function addToUserNode(rule, globalConfigPath) {
|
|
42082
42179
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42089,7 +42186,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42089
42186
|
);
|
|
42090
42187
|
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42091
42188
|
console.log(
|
|
42092
|
-
`Added ${
|
|
42189
|
+
`Added ${chalk257.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42093
42190
|
);
|
|
42094
42191
|
}
|
|
42095
42192
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -42144,7 +42241,7 @@ function registerRules(program) {
|
|
|
42144
42241
|
}
|
|
42145
42242
|
|
|
42146
42243
|
// src/commands/seq/seqAuth.ts
|
|
42147
|
-
import
|
|
42244
|
+
import chalk259 from "chalk";
|
|
42148
42245
|
|
|
42149
42246
|
// src/commands/seq/loadConnections.ts
|
|
42150
42247
|
function loadConnections2() {
|
|
@@ -42173,10 +42270,10 @@ function setDefaultConnection(name) {
|
|
|
42173
42270
|
}
|
|
42174
42271
|
|
|
42175
42272
|
// src/shared/assertUniqueName.ts
|
|
42176
|
-
import
|
|
42273
|
+
import chalk258 from "chalk";
|
|
42177
42274
|
function assertUniqueName(existingNames, name) {
|
|
42178
42275
|
if (existingNames.includes(name)) {
|
|
42179
|
-
console.error(
|
|
42276
|
+
console.error(chalk258.red(`Connection "${name}" already exists.`));
|
|
42180
42277
|
process.exit(1);
|
|
42181
42278
|
}
|
|
42182
42279
|
}
|
|
@@ -42194,16 +42291,16 @@ async function promptConnection2(existingNames) {
|
|
|
42194
42291
|
var seqAuth = createConnectionAuth({
|
|
42195
42292
|
load: loadConnections2,
|
|
42196
42293
|
save: saveConnections2,
|
|
42197
|
-
format: (c) => `${
|
|
42294
|
+
format: (c) => `${chalk259.bold(c.name)} ${c.url}`,
|
|
42198
42295
|
promptNew: promptConnection2,
|
|
42199
42296
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
42200
42297
|
});
|
|
42201
42298
|
|
|
42202
42299
|
// src/commands/seq/seqQuery.ts
|
|
42203
|
-
import
|
|
42300
|
+
import chalk263 from "chalk";
|
|
42204
42301
|
|
|
42205
42302
|
// src/commands/seq/fetchSeq.ts
|
|
42206
|
-
import
|
|
42303
|
+
import chalk260 from "chalk";
|
|
42207
42304
|
async function fetchSeq(conn, path109, params) {
|
|
42208
42305
|
const url = `${conn.url}${path109}?${params}`;
|
|
42209
42306
|
const response = await fetch(url, {
|
|
@@ -42214,7 +42311,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
42214
42311
|
});
|
|
42215
42312
|
if (!response.ok) {
|
|
42216
42313
|
const body = await response.text();
|
|
42217
|
-
console.error(
|
|
42314
|
+
console.error(chalk260.red(`Seq returned ${response.status}: ${body}`));
|
|
42218
42315
|
process.exit(1);
|
|
42219
42316
|
}
|
|
42220
42317
|
return response;
|
|
@@ -42273,23 +42370,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
42273
42370
|
}
|
|
42274
42371
|
|
|
42275
42372
|
// src/commands/seq/formatEvent.ts
|
|
42276
|
-
import
|
|
42373
|
+
import chalk261 from "chalk";
|
|
42277
42374
|
function levelColor(level) {
|
|
42278
42375
|
switch (level) {
|
|
42279
42376
|
case "Fatal":
|
|
42280
|
-
return
|
|
42377
|
+
return chalk261.bgRed.white;
|
|
42281
42378
|
case "Error":
|
|
42282
|
-
return
|
|
42379
|
+
return chalk261.red;
|
|
42283
42380
|
case "Warning":
|
|
42284
|
-
return
|
|
42381
|
+
return chalk261.yellow;
|
|
42285
42382
|
case "Information":
|
|
42286
|
-
return
|
|
42383
|
+
return chalk261.cyan;
|
|
42287
42384
|
case "Debug":
|
|
42288
|
-
return
|
|
42385
|
+
return chalk261.gray;
|
|
42289
42386
|
case "Verbose":
|
|
42290
|
-
return
|
|
42387
|
+
return chalk261.dim;
|
|
42291
42388
|
default:
|
|
42292
|
-
return
|
|
42389
|
+
return chalk261.white;
|
|
42293
42390
|
}
|
|
42294
42391
|
}
|
|
42295
42392
|
function levelAbbrev(level) {
|
|
@@ -42330,12 +42427,12 @@ function formatTimestamp(iso) {
|
|
|
42330
42427
|
function formatEvent(event) {
|
|
42331
42428
|
const color = levelColor(event.Level);
|
|
42332
42429
|
const abbrev = levelAbbrev(event.Level);
|
|
42333
|
-
const ts10 =
|
|
42430
|
+
const ts10 = chalk261.dim(formatTimestamp(event.Timestamp));
|
|
42334
42431
|
const msg = renderMessage(event);
|
|
42335
42432
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
42336
42433
|
if (event.Exception) {
|
|
42337
42434
|
for (const line of event.Exception.split("\n")) {
|
|
42338
|
-
lines2.push(
|
|
42435
|
+
lines2.push(chalk261.red(` ${line}`));
|
|
42339
42436
|
}
|
|
42340
42437
|
}
|
|
42341
42438
|
return lines2.join("\n");
|
|
@@ -42368,11 +42465,11 @@ function rejectTimestampFilter(filter) {
|
|
|
42368
42465
|
}
|
|
42369
42466
|
|
|
42370
42467
|
// src/shared/resolveNamedConnection.ts
|
|
42371
|
-
import
|
|
42468
|
+
import chalk262 from "chalk";
|
|
42372
42469
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
42373
42470
|
if (connections.length === 0) {
|
|
42374
42471
|
console.error(
|
|
42375
|
-
|
|
42472
|
+
chalk262.red(
|
|
42376
42473
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
42377
42474
|
)
|
|
42378
42475
|
);
|
|
@@ -42381,7 +42478,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
42381
42478
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
42382
42479
|
const connection = connections.find((c) => c.name === target);
|
|
42383
42480
|
if (!connection) {
|
|
42384
|
-
console.error(
|
|
42481
|
+
console.error(chalk262.red(`${kind} connection "${target}" not found.`));
|
|
42385
42482
|
process.exit(1);
|
|
42386
42483
|
}
|
|
42387
42484
|
return connection;
|
|
@@ -42410,7 +42507,7 @@ async function seqQuery(filter, options2) {
|
|
|
42410
42507
|
new URLSearchParams({ filter, count: String(count10) })
|
|
42411
42508
|
);
|
|
42412
42509
|
if (events.length === 0) {
|
|
42413
|
-
console.log(
|
|
42510
|
+
console.log(chalk263.yellow("No events found."));
|
|
42414
42511
|
return;
|
|
42415
42512
|
}
|
|
42416
42513
|
if (options2.json) {
|
|
@@ -42421,11 +42518,11 @@ async function seqQuery(filter, options2) {
|
|
|
42421
42518
|
for (const event of chronological) {
|
|
42422
42519
|
console.log(formatEvent(event));
|
|
42423
42520
|
}
|
|
42424
|
-
console.log(
|
|
42521
|
+
console.log(chalk263.dim(`
|
|
42425
42522
|
${events.length} events`));
|
|
42426
42523
|
if (events.length >= count10) {
|
|
42427
42524
|
console.log(
|
|
42428
|
-
|
|
42525
|
+
chalk263.yellow(
|
|
42429
42526
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
42430
42527
|
)
|
|
42431
42528
|
);
|
|
@@ -42433,10 +42530,10 @@ ${events.length} events`));
|
|
|
42433
42530
|
}
|
|
42434
42531
|
|
|
42435
42532
|
// src/shared/setNamedDefaultConnection.ts
|
|
42436
|
-
import
|
|
42533
|
+
import chalk264 from "chalk";
|
|
42437
42534
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
42438
42535
|
if (!connections.find((c) => c.name === name)) {
|
|
42439
|
-
console.error(
|
|
42536
|
+
console.error(chalk264.red(`Connection "${name}" not found.`));
|
|
42440
42537
|
process.exit(1);
|
|
42441
42538
|
}
|
|
42442
42539
|
setDefault(name);
|
|
@@ -42565,7 +42662,7 @@ function registerSignal(program) {
|
|
|
42565
42662
|
}
|
|
42566
42663
|
|
|
42567
42664
|
// src/commands/slack/parseSlackThreadRef.ts
|
|
42568
|
-
import { InvalidArgumentError as
|
|
42665
|
+
import { InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
42569
42666
|
var MESSAGE_TS = /^\d{10}\.\d{6}$/;
|
|
42570
42667
|
var PERMALINK_TS = /\/archives\/[^/?#]+\/p(\d{10})(\d{6})\b/;
|
|
42571
42668
|
var PERMALINK_THREAD_TS = /[?&]thread_ts=(\d{10}\.\d{6})\b/;
|
|
@@ -42576,7 +42673,7 @@ function parseSlackThreadRef(value) {
|
|
|
42576
42673
|
if (thread) return thread[1];
|
|
42577
42674
|
const permalink = PERMALINK_TS.exec(trimmed);
|
|
42578
42675
|
if (permalink) return `${permalink[1]}.${permalink[2]}`;
|
|
42579
|
-
throw new
|
|
42676
|
+
throw new InvalidArgumentError4(
|
|
42580
42677
|
"Expected a message ts (1712345678.123456) or a Slack archives permalink (https://<workspace>.slack.com/archives/<channel>/p1712345678123456)."
|
|
42581
42678
|
);
|
|
42582
42679
|
}
|
|
@@ -42738,7 +42835,7 @@ function registerSlack(program) {
|
|
|
42738
42835
|
}
|
|
42739
42836
|
|
|
42740
42837
|
// src/commands/sql/sqlAuth.ts
|
|
42741
|
-
import
|
|
42838
|
+
import chalk266 from "chalk";
|
|
42742
42839
|
|
|
42743
42840
|
// src/commands/sql/loadConnections.ts
|
|
42744
42841
|
function loadConnections3() {
|
|
@@ -42767,7 +42864,7 @@ function setDefaultConnection2(name) {
|
|
|
42767
42864
|
}
|
|
42768
42865
|
|
|
42769
42866
|
// src/commands/sql/promptConnection.ts
|
|
42770
|
-
import
|
|
42867
|
+
import chalk265 from "chalk";
|
|
42771
42868
|
async function promptConnection3(existingNames) {
|
|
42772
42869
|
const name = await promptInput("name", "Connection name:", "default");
|
|
42773
42870
|
assertUniqueName(existingNames, name);
|
|
@@ -42775,7 +42872,7 @@ async function promptConnection3(existingNames) {
|
|
|
42775
42872
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
42776
42873
|
const port = Number.parseInt(portStr, 10);
|
|
42777
42874
|
if (!Number.isFinite(port)) {
|
|
42778
|
-
console.error(
|
|
42875
|
+
console.error(chalk265.red(`Invalid port "${portStr}".`));
|
|
42779
42876
|
process.exit(1);
|
|
42780
42877
|
}
|
|
42781
42878
|
const user = await promptInput("user", "User:");
|
|
@@ -42788,13 +42885,13 @@ async function promptConnection3(existingNames) {
|
|
|
42788
42885
|
var sqlAuth = createConnectionAuth({
|
|
42789
42886
|
load: loadConnections3,
|
|
42790
42887
|
save: saveConnections3,
|
|
42791
|
-
format: (c) => `${
|
|
42888
|
+
format: (c) => `${chalk266.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
42792
42889
|
promptNew: promptConnection3,
|
|
42793
42890
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
42794
42891
|
});
|
|
42795
42892
|
|
|
42796
42893
|
// src/commands/sql/printTable.ts
|
|
42797
|
-
import
|
|
42894
|
+
import chalk267 from "chalk";
|
|
42798
42895
|
function formatCell(value) {
|
|
42799
42896
|
if (value === null || value === void 0) return "";
|
|
42800
42897
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -42803,7 +42900,7 @@ function formatCell(value) {
|
|
|
42803
42900
|
}
|
|
42804
42901
|
function printTable(rows) {
|
|
42805
42902
|
if (rows.length === 0) {
|
|
42806
|
-
console.log(
|
|
42903
|
+
console.log(chalk267.yellow("(no rows)"));
|
|
42807
42904
|
return;
|
|
42808
42905
|
}
|
|
42809
42906
|
const columns = Object.keys(rows[0]);
|
|
@@ -42811,13 +42908,13 @@ function printTable(rows) {
|
|
|
42811
42908
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
42812
42909
|
);
|
|
42813
42910
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
42814
|
-
console.log(
|
|
42815
|
-
console.log(
|
|
42911
|
+
console.log(chalk267.dim(header));
|
|
42912
|
+
console.log(chalk267.dim("-".repeat(header.length)));
|
|
42816
42913
|
for (const row3 of rows) {
|
|
42817
42914
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
42818
42915
|
console.log(line);
|
|
42819
42916
|
}
|
|
42820
|
-
console.log(
|
|
42917
|
+
console.log(chalk267.dim(`
|
|
42821
42918
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
42822
42919
|
}
|
|
42823
42920
|
|
|
@@ -42877,7 +42974,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
42877
42974
|
}
|
|
42878
42975
|
|
|
42879
42976
|
// src/commands/sql/sqlMutate.ts
|
|
42880
|
-
import
|
|
42977
|
+
import chalk268 from "chalk";
|
|
42881
42978
|
|
|
42882
42979
|
// src/commands/sql/isMutation.ts
|
|
42883
42980
|
var MUTATION_KEYWORDS = [
|
|
@@ -42911,7 +43008,7 @@ function isMutation(sql30) {
|
|
|
42911
43008
|
async function sqlMutate(query, connectionName) {
|
|
42912
43009
|
if (!isMutation(query)) {
|
|
42913
43010
|
console.error(
|
|
42914
|
-
|
|
43011
|
+
chalk268.red(
|
|
42915
43012
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
42916
43013
|
)
|
|
42917
43014
|
);
|
|
@@ -42921,18 +43018,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
42921
43018
|
const pool = await sqlConnect(conn);
|
|
42922
43019
|
try {
|
|
42923
43020
|
const result = await pool.request().query(query);
|
|
42924
|
-
console.log(
|
|
43021
|
+
console.log(chalk268.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
42925
43022
|
} finally {
|
|
42926
43023
|
await pool.close();
|
|
42927
43024
|
}
|
|
42928
43025
|
}
|
|
42929
43026
|
|
|
42930
43027
|
// src/commands/sql/sqlQuery.ts
|
|
42931
|
-
import
|
|
43028
|
+
import chalk269 from "chalk";
|
|
42932
43029
|
async function sqlQuery(query, connectionName) {
|
|
42933
43030
|
if (isMutation(query)) {
|
|
42934
43031
|
console.error(
|
|
42935
|
-
|
|
43032
|
+
chalk269.red(
|
|
42936
43033
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
42937
43034
|
)
|
|
42938
43035
|
);
|
|
@@ -42947,7 +43044,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
42947
43044
|
printTable(rows);
|
|
42948
43045
|
} else {
|
|
42949
43046
|
console.log(
|
|
42950
|
-
|
|
43047
|
+
chalk269.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
42951
43048
|
);
|
|
42952
43049
|
}
|
|
42953
43050
|
} finally {
|
|
@@ -43362,7 +43459,7 @@ function syncPi(claudeDir, options2) {
|
|
|
43362
43459
|
// src/commands/sync/syncSettings.ts
|
|
43363
43460
|
import * as fs47 from "fs";
|
|
43364
43461
|
import * as path101 from "path";
|
|
43365
|
-
import
|
|
43462
|
+
import chalk270 from "chalk";
|
|
43366
43463
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
43367
43464
|
const source = path101.join(claudeDir, "settings.json");
|
|
43368
43465
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -43381,7 +43478,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43381
43478
|
if (mergedContent !== normalizedTarget) {
|
|
43382
43479
|
if (!options2?.yes) {
|
|
43383
43480
|
console.log(
|
|
43384
|
-
|
|
43481
|
+
chalk270.yellow(
|
|
43385
43482
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
43386
43483
|
)
|
|
43387
43484
|
);
|
|
@@ -43389,7 +43486,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43389
43486
|
printDiff(targetContent, mergedContent);
|
|
43390
43487
|
printAutoConfirmHint();
|
|
43391
43488
|
const confirm = await promptConfirm(
|
|
43392
|
-
|
|
43489
|
+
chalk270.red("Overwrite existing settings.json?"),
|
|
43393
43490
|
false
|
|
43394
43491
|
);
|
|
43395
43492
|
if (!confirm) {
|
|
@@ -43460,7 +43557,7 @@ function registerSync(program) {
|
|
|
43460
43557
|
import { existsSync as existsSync77 } from "fs";
|
|
43461
43558
|
|
|
43462
43559
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
43463
|
-
function
|
|
43560
|
+
function pad2(value, width2) {
|
|
43464
43561
|
return String(value).padStart(width2, "0");
|
|
43465
43562
|
}
|
|
43466
43563
|
function formatTimestamp2(ms) {
|
|
@@ -43468,7 +43565,7 @@ function formatTimestamp2(ms) {
|
|
|
43468
43565
|
const hours = Math.floor(totalSeconds / 3600);
|
|
43469
43566
|
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
43470
43567
|
const seconds = totalSeconds % 60;
|
|
43471
|
-
return `${
|
|
43568
|
+
return `${pad2(hours, 2)}:${pad2(minutes, 2)}:${pad2(seconds, 2)}.${pad2(ms % 1e3, 3)}`;
|
|
43472
43569
|
}
|
|
43473
43570
|
function formatClock(ms) {
|
|
43474
43571
|
return formatTimestamp2(ms).slice(0, 8);
|
|
@@ -46231,18 +46328,18 @@ function registerRun(program) {
|
|
|
46231
46328
|
}
|
|
46232
46329
|
|
|
46233
46330
|
// src/commands/sessions/nodes/formatLink.ts
|
|
46234
|
-
import
|
|
46331
|
+
import chalk271 from "chalk";
|
|
46235
46332
|
var STATE_COLOURS = {
|
|
46236
|
-
connected:
|
|
46237
|
-
connecting:
|
|
46238
|
-
disconnected:
|
|
46239
|
-
"version-blocked":
|
|
46333
|
+
connected: chalk271.green,
|
|
46334
|
+
connecting: chalk271.yellow,
|
|
46335
|
+
disconnected: chalk271.red,
|
|
46336
|
+
"version-blocked": chalk271.red
|
|
46240
46337
|
};
|
|
46241
46338
|
function formatLink(link3) {
|
|
46242
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
46339
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk271.white;
|
|
46243
46340
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
46244
46341
|
const error = link3.error ? `
|
|
46245
|
-
${
|
|
46342
|
+
${chalk271.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
46246
46343
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
46247
46344
|
}
|
|
46248
46345
|
|
|
@@ -54244,7 +54341,7 @@ async function closeSession() {
|
|
|
54244
54341
|
}
|
|
54245
54342
|
|
|
54246
54343
|
// src/commands/sessions/nodes/listNodes.ts
|
|
54247
|
-
import
|
|
54344
|
+
import chalk272 from "chalk";
|
|
54248
54345
|
async function nodesReport() {
|
|
54249
54346
|
const live = await queryNodes();
|
|
54250
54347
|
if (live)
|
|
@@ -54261,10 +54358,10 @@ async function listNodes(options2) {
|
|
|
54261
54358
|
console.log(JSON.stringify(report, null, 2));
|
|
54262
54359
|
return;
|
|
54263
54360
|
}
|
|
54264
|
-
console.log(`${report.local} ${
|
|
54361
|
+
console.log(`${report.local} ${chalk272.dim("(this node)")}`);
|
|
54265
54362
|
if (!report.daemonRunning)
|
|
54266
|
-
console.log(
|
|
54267
|
-
if (report.links.length === 0) console.log(
|
|
54363
|
+
console.log(chalk272.dim(" daemon not running; showing configured links"));
|
|
54364
|
+
if (report.links.length === 0) console.log(chalk272.dim(" no links"));
|
|
54268
54365
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
54269
54366
|
}
|
|
54270
54367
|
|
|
@@ -54286,7 +54383,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
54286
54383
|
}
|
|
54287
54384
|
|
|
54288
54385
|
// src/commands/sessions/nodes/printReport.ts
|
|
54289
|
-
import
|
|
54386
|
+
import chalk273 from "chalk";
|
|
54290
54387
|
function printReport(report) {
|
|
54291
54388
|
if (report.links.length === 0) {
|
|
54292
54389
|
console.log(`${report.local} has no links`);
|
|
@@ -54300,11 +54397,11 @@ function printReport(report) {
|
|
|
54300
54397
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
54301
54398
|
}
|
|
54302
54399
|
function printDiagnosis(diagnosis) {
|
|
54303
|
-
console.log(`${
|
|
54400
|
+
console.log(`${chalk273.bold(diagnosis.name)} ${chalk273.dim(diagnosis.url)}`);
|
|
54304
54401
|
for (const hop of diagnosis.hops) {
|
|
54305
|
-
const mark = hop.ok ?
|
|
54402
|
+
const mark = hop.ok ? chalk273.green("\u2713") : chalk273.red("\u2717");
|
|
54306
54403
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
54307
|
-
if (hop.remediation) console.log(` ${
|
|
54404
|
+
if (hop.remediation) console.log(` ${chalk273.yellow(hop.remediation)}`);
|
|
54308
54405
|
}
|
|
54309
54406
|
}
|
|
54310
54407
|
|
|
@@ -54376,14 +54473,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
54376
54473
|
}
|
|
54377
54474
|
|
|
54378
54475
|
// src/commands/sessions/nodes/linkNode.ts
|
|
54379
|
-
import
|
|
54476
|
+
import chalk276 from "chalk";
|
|
54380
54477
|
|
|
54381
54478
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
54382
|
-
import
|
|
54479
|
+
import chalk274 from "chalk";
|
|
54383
54480
|
async function notifyDaemonLinks() {
|
|
54384
54481
|
if (!await isDaemonRunning()) {
|
|
54385
54482
|
console.log(
|
|
54386
|
-
|
|
54483
|
+
chalk274.yellow(
|
|
54387
54484
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
54388
54485
|
)
|
|
54389
54486
|
);
|
|
@@ -54391,11 +54488,11 @@ async function notifyDaemonLinks() {
|
|
|
54391
54488
|
}
|
|
54392
54489
|
try {
|
|
54393
54490
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
54394
|
-
console.log(
|
|
54491
|
+
console.log(chalk274.dim("The sessions daemon reloaded its links."));
|
|
54395
54492
|
} catch (error) {
|
|
54396
54493
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
54397
54494
|
console.log(
|
|
54398
|
-
|
|
54495
|
+
chalk274.yellow(
|
|
54399
54496
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
54400
54497
|
)
|
|
54401
54498
|
);
|
|
@@ -54403,7 +54500,7 @@ async function notifyDaemonLinks() {
|
|
|
54403
54500
|
}
|
|
54404
54501
|
|
|
54405
54502
|
// src/commands/sessions/nodes/readLinks.ts
|
|
54406
|
-
import
|
|
54503
|
+
import chalk275 from "chalk";
|
|
54407
54504
|
|
|
54408
54505
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
54409
54506
|
async function writeLinks(links2) {
|
|
@@ -54426,7 +54523,7 @@ async function readLinks() {
|
|
|
54426
54523
|
await writeLinks(links2);
|
|
54427
54524
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
54428
54525
|
console.log(
|
|
54429
|
-
|
|
54526
|
+
chalk275.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
54430
54527
|
);
|
|
54431
54528
|
return links2;
|
|
54432
54529
|
}
|
|
@@ -54482,7 +54579,7 @@ async function linkNode(name, url, options2) {
|
|
|
54482
54579
|
throw new Error(`${name} is this node; link to a different node`);
|
|
54483
54580
|
const link3 = await buildLink(name, url, options2);
|
|
54484
54581
|
await writeLinks([...others, link3]);
|
|
54485
|
-
console.log(
|
|
54582
|
+
console.log(chalk276.green(`Linked ${name} (${link3.url})`));
|
|
54486
54583
|
await notifyDaemonLinks();
|
|
54487
54584
|
}
|
|
54488
54585
|
|
|
@@ -54665,16 +54762,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
54665
54762
|
}
|
|
54666
54763
|
|
|
54667
54764
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
54668
|
-
import
|
|
54765
|
+
import chalk277 from "chalk";
|
|
54669
54766
|
async function unlinkNode(name) {
|
|
54670
54767
|
const links2 = await readLinks();
|
|
54671
54768
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
54672
54769
|
if (remaining.length === links2.length) {
|
|
54673
|
-
console.log(
|
|
54770
|
+
console.log(chalk277.yellow(`No link named ${name}`));
|
|
54674
54771
|
return;
|
|
54675
54772
|
}
|
|
54676
54773
|
await writeLinks(remaining);
|
|
54677
|
-
console.log(
|
|
54774
|
+
console.log(chalk277.green(`Unlinked ${name}`));
|
|
54678
54775
|
await notifyDaemonLinks();
|
|
54679
54776
|
}
|
|
54680
54777
|
|
|
@@ -54911,10 +55008,10 @@ function createProgram() {
|
|
|
54911
55008
|
}
|
|
54912
55009
|
|
|
54913
55010
|
// src/reportCliError.ts
|
|
54914
|
-
import
|
|
55011
|
+
import chalk278 from "chalk";
|
|
54915
55012
|
function reportCliError(error) {
|
|
54916
55013
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
54917
|
-
console.error(
|
|
55014
|
+
console.error(chalk278.red(error.message));
|
|
54918
55015
|
} else {
|
|
54919
55016
|
console.error(error);
|
|
54920
55017
|
}
|