@staff0rd/assist 0.981.0 → 0.983.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/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +725 -614
- 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.983.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
|
|
|
@@ -21407,19 +21423,27 @@ ${questionsJson}`
|
|
|
21407
21423
|
|
|
21408
21424
|
// src/commands/backlog/isDocsPath.ts
|
|
21409
21425
|
import { relative as relative6, resolve as resolve18 } from "path";
|
|
21410
|
-
var
|
|
21411
|
-
var
|
|
21426
|
+
var LOCKED_DOCS_DIRS = ["docs/src/content/docs/", "docs/public/screenshots/"];
|
|
21427
|
+
var DOCS_LOCK_REASON = `Docs pages and screenshots (${LOCKED_DOCS_DIRS.join(", ")}) are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave them untouched and carry on with the phase.`;
|
|
21428
|
+
var SEP = String.raw`[/\\]`;
|
|
21429
|
+
var LOCKED_DIR_PATTERN = String.raw`docs${SEP}(?:src${SEP}content${SEP}docs|public${SEP}screenshots)(?:${SEP}|(?![\w.-]))`;
|
|
21430
|
+
var RELATIVE_DOCS = new RegExp(
|
|
21431
|
+
String.raw`(?:^|[\s'"=(<>|;&:])(?:\.${SEP})?${LOCKED_DIR_PATTERN}`
|
|
21432
|
+
);
|
|
21412
21433
|
function escapeRegExp(value) {
|
|
21413
21434
|
return value.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
21414
21435
|
}
|
|
21436
|
+
function isLockedDocsRelativePath(rel) {
|
|
21437
|
+
const normalized = `${rel.replace(/\\/g, "/")}/`;
|
|
21438
|
+
return LOCKED_DOCS_DIRS.some((dir) => normalized.startsWith(dir));
|
|
21439
|
+
}
|
|
21415
21440
|
function isDocsPath(filePath, root2 = getProjectRoot()) {
|
|
21416
|
-
|
|
21417
|
-
return rel.startsWith("docs/");
|
|
21441
|
+
return isLockedDocsRelativePath(relative6(root2, resolve18(root2, filePath)));
|
|
21418
21442
|
}
|
|
21419
21443
|
function mentionsDocsPath(command, root2 = getProjectRoot()) {
|
|
21420
21444
|
if (RELATIVE_DOCS.test(command)) return true;
|
|
21421
|
-
const absolute2 = `${root2.replace(/\\/g, "/")}
|
|
21422
|
-
return new RegExp(
|
|
21445
|
+
const absolute2 = `${escapeRegExp(root2.replace(/\\/g, "/"))}/${LOCKED_DIR_PATTERN}`;
|
|
21446
|
+
return new RegExp(absolute2).test(command.replace(/\\/g, "/"));
|
|
21423
21447
|
}
|
|
21424
21448
|
|
|
21425
21449
|
// src/commands/cliHook/findDocsPathDeny.ts
|
|
@@ -22107,8 +22131,8 @@ function codeCommentConfirm(pin2) {
|
|
|
22107
22131
|
}
|
|
22108
22132
|
const marker2 = isHashCommentFile(state.file) ? "#" : "//";
|
|
22109
22133
|
const indentSource = lines2[index2] ?? "";
|
|
22110
|
-
const
|
|
22111
|
-
lines2.splice(index2, 0, `${
|
|
22134
|
+
const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
22135
|
+
lines2.splice(index2, 0, `${indent4}${marker2} ${state.text}`);
|
|
22112
22136
|
writeFileSync25(state.file, lines2.join("\n"));
|
|
22113
22137
|
unlinkSync8(getPinStatePath(pin2));
|
|
22114
22138
|
console.log(
|
|
@@ -22640,7 +22664,7 @@ function findStagedDocs() {
|
|
|
22640
22664
|
return execSync28("git diff --cached --name-only --relative", {
|
|
22641
22665
|
cwd: getProjectRoot(),
|
|
22642
22666
|
encoding: "utf8"
|
|
22643
|
-
}).split("\n").filter(
|
|
22667
|
+
}).split("\n").filter(isLockedDocsRelativePath);
|
|
22644
22668
|
}
|
|
22645
22669
|
async function refuseLockedDocs() {
|
|
22646
22670
|
const staged = findStagedDocs();
|
|
@@ -22650,7 +22674,7 @@ async function refuseLockedDocs() {
|
|
|
22650
22674
|
);
|
|
22651
22675
|
console.error(DOCS_LOCK_REASON);
|
|
22652
22676
|
console.error(
|
|
22653
|
-
|
|
22677
|
+
`Unstage them with \`git restore --staged ${staged.join(" ")}\`, then re-run the commit. Nothing was committed or pushed.`
|
|
22654
22678
|
);
|
|
22655
22679
|
process.exit(1);
|
|
22656
22680
|
}
|
|
@@ -24130,7 +24154,7 @@ async function requestTab(server, request) {
|
|
|
24130
24154
|
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
24131
24155
|
fail6(reply2.error);
|
|
24132
24156
|
}
|
|
24133
|
-
console.log(`tab: ${reply2.result.tabUrl}`);
|
|
24157
|
+
if (reply2.result.tabUrl) console.log(`tab: ${reply2.result.tabUrl}`);
|
|
24134
24158
|
return { ...reply2.result, version: reply2.version };
|
|
24135
24159
|
}
|
|
24136
24160
|
|
|
@@ -24234,7 +24258,73 @@ async function browserStatus(options2) {
|
|
|
24234
24258
|
);
|
|
24235
24259
|
}
|
|
24236
24260
|
|
|
24237
|
-
// src/commands/
|
|
24261
|
+
// src/commands/extension/consoleCapture/types.ts
|
|
24262
|
+
var CONSOLE_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
24263
|
+
var CONSOLE_DEFAULT_LIMIT = 200;
|
|
24264
|
+
|
|
24265
|
+
// src/commands/github/parseTopCount.ts
|
|
24266
|
+
import { InvalidArgumentError } from "commander";
|
|
24267
|
+
function parseTopCount(value) {
|
|
24268
|
+
if (!/^\d+$/.test(value) || Number.parseInt(value, 10) < 1) {
|
|
24269
|
+
throw new InvalidArgumentError("Expected a positive integer.");
|
|
24270
|
+
}
|
|
24271
|
+
return Number.parseInt(value, 10);
|
|
24272
|
+
}
|
|
24273
|
+
|
|
24274
|
+
// src/commands/browser/browserConsole.ts
|
|
24275
|
+
import chalk147 from "chalk";
|
|
24276
|
+
|
|
24277
|
+
// src/commands/browser/formatConsoleEntries.ts
|
|
24278
|
+
var pad = (value, width2 = 2) => String(value).padStart(width2, "0");
|
|
24279
|
+
function formatTime(time) {
|
|
24280
|
+
const date = new Date(time);
|
|
24281
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
|
|
24282
|
+
}
|
|
24283
|
+
var indent = (text18, prefix2) => text18.split("\n").map((line) => `${prefix2}${line}`);
|
|
24284
|
+
function formatConsoleEntries({
|
|
24285
|
+
recording,
|
|
24286
|
+
entries
|
|
24287
|
+
}) {
|
|
24288
|
+
if (!recording)
|
|
24289
|
+
return [
|
|
24290
|
+
`console recording is off; tick "Record console warnings and errors" on the assist extension's options page`
|
|
24291
|
+
];
|
|
24292
|
+
if (entries.length === 0) return ["no console entries match"];
|
|
24293
|
+
return entries.flatMap((entry) => [
|
|
24294
|
+
`${formatTime(entry.time)} ${entry.level} ${entry.url}`,
|
|
24295
|
+
...indent(entry.message, " "),
|
|
24296
|
+
...entry.stack ? indent(entry.stack, " ") : []
|
|
24297
|
+
]);
|
|
24298
|
+
}
|
|
24299
|
+
|
|
24300
|
+
// src/commands/browser/browserConsole.ts
|
|
24301
|
+
async function browserConsole(options2) {
|
|
24302
|
+
if (options2.all && options2.url) {
|
|
24303
|
+
console.error(chalk147.red("Error: pass either --url or --all, not both"));
|
|
24304
|
+
process.exit(1);
|
|
24305
|
+
}
|
|
24306
|
+
const result = await requestTab(options2.server, {
|
|
24307
|
+
op: "console",
|
|
24308
|
+
url: options2.url,
|
|
24309
|
+
all: options2.all,
|
|
24310
|
+
sinceMs: options2.since,
|
|
24311
|
+
grep: options2.grep,
|
|
24312
|
+
limit: options2.limit
|
|
24313
|
+
});
|
|
24314
|
+
for (const line of formatConsoleEntries(result)) console.log(line);
|
|
24315
|
+
}
|
|
24316
|
+
|
|
24317
|
+
// src/commands/browser/parseSinceDuration.ts
|
|
24318
|
+
import { InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
24319
|
+
function parseSinceDuration(value) {
|
|
24320
|
+
try {
|
|
24321
|
+
return parseDuration(value);
|
|
24322
|
+
} catch (error) {
|
|
24323
|
+
throw new InvalidArgumentError2(error.message);
|
|
24324
|
+
}
|
|
24325
|
+
}
|
|
24326
|
+
|
|
24327
|
+
// src/commands/browser/withTargetOptions.ts
|
|
24238
24328
|
function withTargetOptions(command) {
|
|
24239
24329
|
return command.option(
|
|
24240
24330
|
"--url <substring>",
|
|
@@ -24245,6 +24335,29 @@ function withTargetOptions(command) {
|
|
|
24245
24335
|
"http://localhost:3100"
|
|
24246
24336
|
);
|
|
24247
24337
|
}
|
|
24338
|
+
|
|
24339
|
+
// src/commands/browser/registerBrowserConsole.ts
|
|
24340
|
+
function registerBrowserConsole(browser) {
|
|
24341
|
+
withTargetOptions(
|
|
24342
|
+
browser.command("console").description(
|
|
24343
|
+
"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"
|
|
24344
|
+
).option("--all", "Print entries from every tab, not just the target tab").option(
|
|
24345
|
+
"--since <duration>",
|
|
24346
|
+
"Only entries newer than this (e.g. 30s, 10m, 2h)",
|
|
24347
|
+
parseSinceDuration
|
|
24348
|
+
).option(
|
|
24349
|
+
"--grep <text>",
|
|
24350
|
+
"Only entries whose message, stack or URL contains this (case-insensitive)"
|
|
24351
|
+
).option(
|
|
24352
|
+
"--limit <n>",
|
|
24353
|
+
"Print at most the newest n matching entries",
|
|
24354
|
+
parseTopCount,
|
|
24355
|
+
CONSOLE_DEFAULT_LIMIT
|
|
24356
|
+
)
|
|
24357
|
+
).action(browserConsole);
|
|
24358
|
+
}
|
|
24359
|
+
|
|
24360
|
+
// src/commands/registerBrowser.ts
|
|
24248
24361
|
function registerBrowser(program) {
|
|
24249
24362
|
const browser = program.command("browser").description(
|
|
24250
24363
|
"Probe the live browser tab through the assist extension, relayed by the assist web server"
|
|
@@ -24272,11 +24385,12 @@ function registerBrowser(program) {
|
|
|
24272
24385
|
"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
24386
|
).requiredOption("--file <script>", "JavaScript file to run")
|
|
24274
24387
|
).action(browserRun);
|
|
24388
|
+
registerBrowserConsole(browser);
|
|
24275
24389
|
}
|
|
24276
24390
|
|
|
24277
24391
|
// src/commands/extension/extension.ts
|
|
24278
24392
|
import { cp } from "fs/promises";
|
|
24279
|
-
import
|
|
24393
|
+
import chalk148 from "chalk";
|
|
24280
24394
|
|
|
24281
24395
|
// src/commands/extension/extensionDir.ts
|
|
24282
24396
|
import { existsSync as existsSync49 } from "fs";
|
|
@@ -24299,21 +24413,21 @@ async function loadPath(source) {
|
|
|
24299
24413
|
return WSL_WINDOWS_PATH;
|
|
24300
24414
|
} catch {
|
|
24301
24415
|
console.log(
|
|
24302
|
-
|
|
24416
|
+
chalk148.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
24303
24417
|
);
|
|
24304
24418
|
return source;
|
|
24305
24419
|
}
|
|
24306
24420
|
}
|
|
24307
24421
|
async function extension() {
|
|
24308
24422
|
const path109 = await loadPath(extensionDir());
|
|
24309
|
-
console.log(
|
|
24310
|
-
console.log(
|
|
24423
|
+
console.log(chalk148.bold("assist \u2014 GitHub browser extension"));
|
|
24424
|
+
console.log(chalk148.dim(`load the unpacked extension from ${path109}`));
|
|
24311
24425
|
}
|
|
24312
24426
|
|
|
24313
24427
|
// src/commands/extension/printExtensionUrl.ts
|
|
24314
24428
|
import { readFile as readFile4 } from "fs/promises";
|
|
24315
24429
|
import { join as join56 } from "path";
|
|
24316
|
-
import
|
|
24430
|
+
import chalk149 from "chalk";
|
|
24317
24431
|
|
|
24318
24432
|
// src/commands/extension/latestUpdate.ts
|
|
24319
24433
|
function latestUpdate(manifest, updates2) {
|
|
@@ -24336,7 +24450,7 @@ async function printExtensionUrl() {
|
|
|
24336
24450
|
const response = await fetch(update_url);
|
|
24337
24451
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
24338
24452
|
if (!link3) {
|
|
24339
|
-
console.log(
|
|
24453
|
+
console.log(chalk149.red(`no signed build found in ${update_url}`));
|
|
24340
24454
|
process.exitCode = 1;
|
|
24341
24455
|
return;
|
|
24342
24456
|
}
|
|
@@ -24347,7 +24461,7 @@ async function printExtensionUrl() {
|
|
|
24347
24461
|
import { rm as rm2 } from "fs/promises";
|
|
24348
24462
|
import { homedir as homedir22, tmpdir as tmpdir3 } from "os";
|
|
24349
24463
|
import { join as join62 } from "path";
|
|
24350
|
-
import
|
|
24464
|
+
import chalk151 from "chalk";
|
|
24351
24465
|
|
|
24352
24466
|
// src/commands/extension/copySignedXpi.ts
|
|
24353
24467
|
import { copyFile } from "fs/promises";
|
|
@@ -24372,7 +24486,7 @@ async function findSignedXpi(dir) {
|
|
|
24372
24486
|
|
|
24373
24487
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
24374
24488
|
import { cp as cp2 } from "fs/promises";
|
|
24375
|
-
import
|
|
24489
|
+
import chalk150 from "chalk";
|
|
24376
24490
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
24377
24491
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
24378
24492
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -24382,7 +24496,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
24382
24496
|
return WSL_WINDOWS_PATH2;
|
|
24383
24497
|
} catch {
|
|
24384
24498
|
console.log(
|
|
24385
|
-
|
|
24499
|
+
chalk150.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
24386
24500
|
);
|
|
24387
24501
|
return xpi;
|
|
24388
24502
|
}
|
|
@@ -24475,15 +24589,15 @@ async function signExtension() {
|
|
|
24475
24589
|
const source = extensionDir();
|
|
24476
24590
|
const problem = signPreflightProblem(source);
|
|
24477
24591
|
if (problem) {
|
|
24478
|
-
console.log(
|
|
24479
|
-
console.log(
|
|
24592
|
+
console.log(chalk151.red(problem.message));
|
|
24593
|
+
console.log(chalk151.dim(problem.hint));
|
|
24480
24594
|
process.exitCode = 1;
|
|
24481
24595
|
return;
|
|
24482
24596
|
}
|
|
24483
24597
|
const { version: version2 } = package_default;
|
|
24484
24598
|
await stageExtension(source, STAGING_DIR, version2);
|
|
24485
24599
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
24486
|
-
console.log(
|
|
24600
|
+
console.log(chalk151.bold(`signing version ${version2} for self-distribution`));
|
|
24487
24601
|
const { done: done2 } = spawnInherit("npx", [
|
|
24488
24602
|
"--yes",
|
|
24489
24603
|
"web-ext",
|
|
@@ -24493,13 +24607,13 @@ async function signExtension() {
|
|
|
24493
24607
|
"--channel=unlisted"
|
|
24494
24608
|
]);
|
|
24495
24609
|
if (await done2 !== 0) {
|
|
24496
|
-
console.log(
|
|
24610
|
+
console.log(chalk151.red("web-ext sign failed"));
|
|
24497
24611
|
process.exitCode = 1;
|
|
24498
24612
|
return;
|
|
24499
24613
|
}
|
|
24500
24614
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
24501
24615
|
if (!xpi) {
|
|
24502
|
-
console.log(
|
|
24616
|
+
console.log(chalk151.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
24503
24617
|
process.exitCode = 1;
|
|
24504
24618
|
return;
|
|
24505
24619
|
}
|
|
@@ -24507,7 +24621,7 @@ async function signExtension() {
|
|
|
24507
24621
|
const path109 = await signedAddonInstallPath(
|
|
24508
24622
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
24509
24623
|
);
|
|
24510
|
-
console.log(
|
|
24624
|
+
console.log(chalk151.dim(`install the signed add-on from ${path109}`));
|
|
24511
24625
|
}
|
|
24512
24626
|
|
|
24513
24627
|
// src/commands/registerExtension.ts
|
|
@@ -24568,11 +24682,11 @@ async function dropRetiredTables(exec3) {
|
|
|
24568
24682
|
}
|
|
24569
24683
|
|
|
24570
24684
|
// src/commands/db/reportRetiredTables.ts
|
|
24571
|
-
import
|
|
24685
|
+
import chalk152 from "chalk";
|
|
24572
24686
|
function reportRetiredTables(tables) {
|
|
24573
24687
|
for (const table of tables) {
|
|
24574
24688
|
console.error(
|
|
24575
|
-
|
|
24689
|
+
chalk152.yellow(
|
|
24576
24690
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
24577
24691
|
)
|
|
24578
24692
|
);
|
|
@@ -24580,40 +24694,40 @@ function reportRetiredTables(tables) {
|
|
|
24580
24694
|
}
|
|
24581
24695
|
|
|
24582
24696
|
// src/commands/db/reportMigrationStatus.ts
|
|
24583
|
-
import
|
|
24697
|
+
import chalk153 from "chalk";
|
|
24584
24698
|
function reportApplied(applied) {
|
|
24585
24699
|
if (applied.length === 0) {
|
|
24586
|
-
console.error(
|
|
24700
|
+
console.error(chalk153.green("Database is up to date; nothing to apply."));
|
|
24587
24701
|
return;
|
|
24588
24702
|
}
|
|
24589
24703
|
for (const migration of applied) {
|
|
24590
24704
|
console.error(
|
|
24591
|
-
|
|
24705
|
+
chalk153.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
24592
24706
|
);
|
|
24593
24707
|
}
|
|
24594
24708
|
}
|
|
24595
24709
|
function reportMigrationStatus(status2) {
|
|
24596
24710
|
if (status2.state === "in-sync") {
|
|
24597
24711
|
console.error(
|
|
24598
|
-
|
|
24712
|
+
chalk153.green(`In sync at migration ${status2.version} (latest).`)
|
|
24599
24713
|
);
|
|
24600
24714
|
return;
|
|
24601
24715
|
}
|
|
24602
24716
|
if (status2.state === "behind") {
|
|
24603
24717
|
console.error(
|
|
24604
|
-
|
|
24718
|
+
chalk153.yellow(
|
|
24605
24719
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
24606
24720
|
)
|
|
24607
24721
|
);
|
|
24608
24722
|
console.error(
|
|
24609
|
-
|
|
24723
|
+
chalk153.yellow(
|
|
24610
24724
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
24611
24725
|
)
|
|
24612
24726
|
);
|
|
24613
24727
|
return;
|
|
24614
24728
|
}
|
|
24615
24729
|
console.error(
|
|
24616
|
-
|
|
24730
|
+
chalk153.red(
|
|
24617
24731
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
24618
24732
|
)
|
|
24619
24733
|
);
|
|
@@ -24655,7 +24769,7 @@ function registerDb(program) {
|
|
|
24655
24769
|
|
|
24656
24770
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
24657
24771
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync28 } from "fs";
|
|
24658
|
-
import
|
|
24772
|
+
import chalk154 from "chalk";
|
|
24659
24773
|
|
|
24660
24774
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
24661
24775
|
import { join as join63 } from "path";
|
|
@@ -24686,7 +24800,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24686
24800
|
sweepRestrictedDir();
|
|
24687
24801
|
const state = readMigrationPinState(pin2);
|
|
24688
24802
|
if (!state) {
|
|
24689
|
-
console.error(
|
|
24803
|
+
console.error(chalk154.red(`No pending migration unlock for pin: ${pin2}`));
|
|
24690
24804
|
process.exitCode = 1;
|
|
24691
24805
|
return;
|
|
24692
24806
|
}
|
|
@@ -24696,7 +24810,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24696
24810
|
);
|
|
24697
24811
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
24698
24812
|
console.log(
|
|
24699
|
-
|
|
24813
|
+
chalk154.green(
|
|
24700
24814
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
24701
24815
|
)
|
|
24702
24816
|
);
|
|
@@ -24705,7 +24819,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24705
24819
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
24706
24820
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
24707
24821
|
import { randomInt as randomInt2 } from "crypto";
|
|
24708
|
-
import
|
|
24822
|
+
import chalk155 from "chalk";
|
|
24709
24823
|
|
|
24710
24824
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
24711
24825
|
function nextMigrationId() {
|
|
@@ -24720,7 +24834,7 @@ function dbMigrationUnlock() {
|
|
|
24720
24834
|
sweepRestrictedDir();
|
|
24721
24835
|
writeFileSync29(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
24722
24836
|
console.error(
|
|
24723
|
-
|
|
24837
|
+
chalk155.yellow.bold(
|
|
24724
24838
|
"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
24839
|
)
|
|
24726
24840
|
);
|
|
@@ -24730,7 +24844,7 @@ function dbMigrationUnlock() {
|
|
|
24730
24844
|
});
|
|
24731
24845
|
if (!delivered) {
|
|
24732
24846
|
console.error(
|
|
24733
|
-
|
|
24847
|
+
chalk155.red(
|
|
24734
24848
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
24735
24849
|
)
|
|
24736
24850
|
);
|
|
@@ -24740,7 +24854,7 @@ function dbMigrationUnlock() {
|
|
|
24740
24854
|
console.log(
|
|
24741
24855
|
`A confirmation pin was sent to your desktop notifications.
|
|
24742
24856
|
To approve creating migration ${migrationId}, run:
|
|
24743
|
-
${
|
|
24857
|
+
${chalk155.cyan(" assist db-migration confirm <PIN>")}
|
|
24744
24858
|
using the pin from that notification.`
|
|
24745
24859
|
);
|
|
24746
24860
|
}
|
|
@@ -24767,7 +24881,7 @@ function registerDbMigration(parent) {
|
|
|
24767
24881
|
|
|
24768
24882
|
// src/commands/deploy/redirect.ts
|
|
24769
24883
|
import { existsSync as existsSync53, readFileSync as readFileSync35, writeFileSync as writeFileSync30 } from "fs";
|
|
24770
|
-
import
|
|
24884
|
+
import chalk156 from "chalk";
|
|
24771
24885
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
24772
24886
|
if (!window.location.pathname.endsWith('/')) {
|
|
24773
24887
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -24776,23 +24890,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
24776
24890
|
function redirect() {
|
|
24777
24891
|
const indexPath = "index.html";
|
|
24778
24892
|
if (!existsSync53(indexPath)) {
|
|
24779
|
-
console.log(
|
|
24893
|
+
console.log(chalk156.yellow("No index.html found"));
|
|
24780
24894
|
return;
|
|
24781
24895
|
}
|
|
24782
24896
|
const content = readFileSync35(indexPath, "utf8");
|
|
24783
24897
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
24784
|
-
console.log(
|
|
24898
|
+
console.log(chalk156.dim("Trailing slash script already present"));
|
|
24785
24899
|
return;
|
|
24786
24900
|
}
|
|
24787
24901
|
const headCloseIndex = content.indexOf("</head>");
|
|
24788
24902
|
if (headCloseIndex === -1) {
|
|
24789
|
-
console.log(
|
|
24903
|
+
console.log(chalk156.red("Could not find </head> tag in index.html"));
|
|
24790
24904
|
return;
|
|
24791
24905
|
}
|
|
24792
24906
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
24793
24907
|
${content.slice(headCloseIndex)}`;
|
|
24794
24908
|
writeFileSync30(indexPath, newContent);
|
|
24795
|
-
console.log(
|
|
24909
|
+
console.log(chalk156.green("Added trailing slash redirect to index.html"));
|
|
24796
24910
|
}
|
|
24797
24911
|
|
|
24798
24912
|
// src/commands/registerDeploy.ts
|
|
@@ -24819,7 +24933,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
24819
24933
|
|
|
24820
24934
|
// src/commands/devlog/shared.ts
|
|
24821
24935
|
import { execSync as execSync33 } from "child_process";
|
|
24822
|
-
import
|
|
24936
|
+
import chalk157 from "chalk";
|
|
24823
24937
|
|
|
24824
24938
|
// src/shared/getRepoName.ts
|
|
24825
24939
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
@@ -24928,13 +25042,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
24928
25042
|
}
|
|
24929
25043
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
24930
25044
|
for (const commit2 of commits2) {
|
|
24931
|
-
console.log(` ${
|
|
25045
|
+
console.log(` ${chalk157.yellow(commit2.hash)} ${commit2.message}`);
|
|
24932
25046
|
if (verbose) {
|
|
24933
25047
|
const visibleFiles = commit2.files.filter(
|
|
24934
25048
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
24935
25049
|
);
|
|
24936
25050
|
for (const file of visibleFiles) {
|
|
24937
|
-
console.log(` ${
|
|
25051
|
+
console.log(` ${chalk157.dim(file)}`);
|
|
24938
25052
|
}
|
|
24939
25053
|
}
|
|
24940
25054
|
}
|
|
@@ -24959,15 +25073,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
24959
25073
|
}
|
|
24960
25074
|
|
|
24961
25075
|
// src/commands/devlog/list/printDateHeader.ts
|
|
24962
|
-
import
|
|
25076
|
+
import chalk158 from "chalk";
|
|
24963
25077
|
function printDateHeader(date, isSkipped, entries) {
|
|
24964
25078
|
if (isSkipped) {
|
|
24965
|
-
console.log(`${
|
|
25079
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.dim("skipped")}`);
|
|
24966
25080
|
} else if (entries && entries.length > 0) {
|
|
24967
|
-
const entryInfo = entries.map((e) => `${
|
|
24968
|
-
console.log(`${
|
|
25081
|
+
const entryInfo = entries.map((e) => `${chalk158.green(e.version)} ${e.title}`).join(" | ");
|
|
25082
|
+
console.log(`${chalk158.bold.blue(date)} ${entryInfo}`);
|
|
24969
25083
|
} else {
|
|
24970
|
-
console.log(`${
|
|
25084
|
+
console.log(`${chalk158.bold.blue(date)} ${chalk158.red("\u26A0 devlog missing")}`);
|
|
24971
25085
|
}
|
|
24972
25086
|
}
|
|
24973
25087
|
|
|
@@ -25071,24 +25185,24 @@ function bumpVersion(version2, type) {
|
|
|
25071
25185
|
|
|
25072
25186
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
25073
25187
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
25074
|
-
import
|
|
25188
|
+
import chalk160 from "chalk";
|
|
25075
25189
|
|
|
25076
25190
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
25077
|
-
import
|
|
25191
|
+
import chalk159 from "chalk";
|
|
25078
25192
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
25079
25193
|
if (conventional && firstHash) {
|
|
25080
25194
|
const version2 = getVersionAtCommit(firstHash);
|
|
25081
25195
|
if (version2) {
|
|
25082
|
-
console.log(`${
|
|
25196
|
+
console.log(`${chalk159.bold("version:")} ${stripToMinor(version2)}`);
|
|
25083
25197
|
} else {
|
|
25084
|
-
console.log(`${
|
|
25198
|
+
console.log(`${chalk159.bold("version:")} ${chalk159.red("unknown")}`);
|
|
25085
25199
|
}
|
|
25086
25200
|
} else if (patchVersion && minorVersion) {
|
|
25087
25201
|
console.log(
|
|
25088
|
-
`${
|
|
25202
|
+
`${chalk159.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
25089
25203
|
);
|
|
25090
25204
|
} else {
|
|
25091
|
-
console.log(`${
|
|
25205
|
+
console.log(`${chalk159.bold("version:")} v0.1 (initial)`);
|
|
25092
25206
|
}
|
|
25093
25207
|
}
|
|
25094
25208
|
|
|
@@ -25136,16 +25250,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
25136
25250
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25137
25251
|
}
|
|
25138
25252
|
function logName(repoName) {
|
|
25139
|
-
console.log(`${
|
|
25253
|
+
console.log(`${chalk160.bold("name:")} ${repoName}`);
|
|
25140
25254
|
}
|
|
25141
25255
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
25142
25256
|
logName(ctx.repoName);
|
|
25143
25257
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
25144
|
-
console.log(
|
|
25258
|
+
console.log(chalk160.bold.blue(targetDate));
|
|
25145
25259
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
25146
25260
|
}
|
|
25147
25261
|
function logNoCommits(lastInfo) {
|
|
25148
|
-
console.log(
|
|
25262
|
+
console.log(chalk160.dim(noCommitsMessage(!!lastInfo)));
|
|
25149
25263
|
}
|
|
25150
25264
|
|
|
25151
25265
|
// src/commands/devlog/next.ts
|
|
@@ -25186,11 +25300,11 @@ function next2(options2) {
|
|
|
25186
25300
|
import { execSync as execSync35 } from "child_process";
|
|
25187
25301
|
|
|
25188
25302
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25189
|
-
import
|
|
25303
|
+
import chalk161 from "chalk";
|
|
25190
25304
|
function colorStatus(status2) {
|
|
25191
|
-
if (status2 === "missing") return
|
|
25192
|
-
if (status2 === "outdated") return
|
|
25193
|
-
return
|
|
25305
|
+
if (status2 === "missing") return chalk161.red(status2);
|
|
25306
|
+
if (status2 === "outdated") return chalk161.yellow(status2);
|
|
25307
|
+
return chalk161.green(status2);
|
|
25194
25308
|
}
|
|
25195
25309
|
function formatRow(row3, nameWidth) {
|
|
25196
25310
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -25204,8 +25318,8 @@ function printReposTable(rows) {
|
|
|
25204
25318
|
"Last Devlog".padEnd(11),
|
|
25205
25319
|
"Status"
|
|
25206
25320
|
].join(" ");
|
|
25207
|
-
console.log(
|
|
25208
|
-
console.log(
|
|
25321
|
+
console.log(chalk161.dim(header));
|
|
25322
|
+
console.log(chalk161.dim("-".repeat(header.length)));
|
|
25209
25323
|
for (const row3 of rows) {
|
|
25210
25324
|
console.log(formatRow(row3, nameWidth));
|
|
25211
25325
|
}
|
|
@@ -25263,14 +25377,14 @@ function repos(options2) {
|
|
|
25263
25377
|
// src/commands/devlog/skip.ts
|
|
25264
25378
|
import { writeFileSync as writeFileSync31 } from "fs";
|
|
25265
25379
|
import { join as join67 } from "path";
|
|
25266
|
-
import
|
|
25380
|
+
import chalk162 from "chalk";
|
|
25267
25381
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25268
25382
|
function getBlogConfigPath() {
|
|
25269
25383
|
return join67(BLOG_REPO_ROOT, "assist.yml");
|
|
25270
25384
|
}
|
|
25271
25385
|
function skip2(date) {
|
|
25272
25386
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
25273
|
-
console.log(
|
|
25387
|
+
console.log(chalk162.red("Invalid date format. Use YYYY-MM-DD"));
|
|
25274
25388
|
process.exit(1);
|
|
25275
25389
|
}
|
|
25276
25390
|
const repoName = getRepoName();
|
|
@@ -25281,7 +25395,7 @@ function skip2(date) {
|
|
|
25281
25395
|
const skipDays = skip3[repoName] ?? [];
|
|
25282
25396
|
if (skipDays.includes(date)) {
|
|
25283
25397
|
console.log(
|
|
25284
|
-
|
|
25398
|
+
chalk162.yellow(`${date} is already in skip list for ${repoName}`)
|
|
25285
25399
|
);
|
|
25286
25400
|
return;
|
|
25287
25401
|
}
|
|
@@ -25291,20 +25405,20 @@ function skip2(date) {
|
|
|
25291
25405
|
devlog.skip = skip3;
|
|
25292
25406
|
config.devlog = devlog;
|
|
25293
25407
|
writeFileSync31(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25294
|
-
console.log(
|
|
25408
|
+
console.log(chalk162.green(`Added ${date} to skip list for ${repoName}`));
|
|
25295
25409
|
}
|
|
25296
25410
|
|
|
25297
25411
|
// src/commands/devlog/version.ts
|
|
25298
|
-
import
|
|
25412
|
+
import chalk163 from "chalk";
|
|
25299
25413
|
function version() {
|
|
25300
25414
|
const config = loadConfig();
|
|
25301
25415
|
const name = getRepoName();
|
|
25302
25416
|
const lastInfo = getLastVersionInfo(name, config);
|
|
25303
25417
|
const lastVersion = lastInfo?.version ?? null;
|
|
25304
25418
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
25305
|
-
console.log(`${
|
|
25306
|
-
console.log(`${
|
|
25307
|
-
console.log(`${
|
|
25419
|
+
console.log(`${chalk163.bold("name:")} ${name}`);
|
|
25420
|
+
console.log(`${chalk163.bold("last:")} ${lastVersion ?? chalk163.dim("none")}`);
|
|
25421
|
+
console.log(`${chalk163.bold("next:")} ${nextVersion ?? chalk163.dim("none")}`);
|
|
25308
25422
|
}
|
|
25309
25423
|
|
|
25310
25424
|
// src/commands/registerDevlog.ts
|
|
@@ -25329,7 +25443,7 @@ function registerDevlog(program) {
|
|
|
25329
25443
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25330
25444
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
25331
25445
|
import { join as join68 } from "path";
|
|
25332
|
-
import
|
|
25446
|
+
import chalk164 from "chalk";
|
|
25333
25447
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25334
25448
|
function isLockedDll(debugDir) {
|
|
25335
25449
|
let files;
|
|
@@ -25376,14 +25490,14 @@ function checkBuildLocks(startDir) {
|
|
|
25376
25490
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
25377
25491
|
if (locked) {
|
|
25378
25492
|
console.error(
|
|
25379
|
-
|
|
25493
|
+
chalk164.red("Build output locked (is VS debugging?): ") + locked
|
|
25380
25494
|
);
|
|
25381
25495
|
process.exit(1);
|
|
25382
25496
|
}
|
|
25383
25497
|
}
|
|
25384
25498
|
async function checkBuildLocksCommand() {
|
|
25385
25499
|
checkBuildLocks();
|
|
25386
|
-
console.log(
|
|
25500
|
+
console.log(chalk164.green("No build locks detected"));
|
|
25387
25501
|
}
|
|
25388
25502
|
|
|
25389
25503
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -25482,30 +25596,30 @@ function escapeRegex(s) {
|
|
|
25482
25596
|
}
|
|
25483
25597
|
|
|
25484
25598
|
// src/commands/dotnet/printTree.ts
|
|
25485
|
-
import
|
|
25599
|
+
import chalk165 from "chalk";
|
|
25486
25600
|
function printNodes(nodes, prefix2) {
|
|
25487
25601
|
for (let i = 0; i < nodes.length; i++) {
|
|
25488
25602
|
const isLast = i === nodes.length - 1;
|
|
25489
25603
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
25490
25604
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
25491
25605
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
25492
|
-
const label = isMissing ?
|
|
25606
|
+
const label = isMissing ? chalk165.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
25493
25607
|
console.log(`${prefix2}${connector}${label}`);
|
|
25494
25608
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
25495
25609
|
}
|
|
25496
25610
|
}
|
|
25497
25611
|
function printTree(tree, totalCount, solutions) {
|
|
25498
|
-
console.log(
|
|
25499
|
-
console.log(
|
|
25612
|
+
console.log(chalk165.bold("\nProject Dependency Tree"));
|
|
25613
|
+
console.log(chalk165.cyan(tree.relativePath));
|
|
25500
25614
|
printNodes(tree.children, "");
|
|
25501
|
-
console.log(
|
|
25615
|
+
console.log(chalk165.dim(`
|
|
25502
25616
|
${totalCount} projects total (including root)`));
|
|
25503
|
-
console.log(
|
|
25617
|
+
console.log(chalk165.bold("\nSolution Membership"));
|
|
25504
25618
|
if (solutions.length === 0) {
|
|
25505
|
-
console.log(
|
|
25619
|
+
console.log(chalk165.yellow(" Not found in any .sln"));
|
|
25506
25620
|
} else {
|
|
25507
25621
|
for (const sln of solutions) {
|
|
25508
|
-
console.log(` ${
|
|
25622
|
+
console.log(` ${chalk165.green(sln)}`);
|
|
25509
25623
|
}
|
|
25510
25624
|
}
|
|
25511
25625
|
console.log();
|
|
@@ -25534,16 +25648,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
25534
25648
|
// src/commands/dotnet/resolveCsproj.ts
|
|
25535
25649
|
import { existsSync as existsSync55 } from "fs";
|
|
25536
25650
|
import path37 from "path";
|
|
25537
|
-
import
|
|
25651
|
+
import chalk166 from "chalk";
|
|
25538
25652
|
function resolveCsproj(csprojPath) {
|
|
25539
25653
|
const resolved = path37.resolve(csprojPath);
|
|
25540
25654
|
if (!existsSync55(resolved)) {
|
|
25541
|
-
console.error(
|
|
25655
|
+
console.error(chalk166.red(`File not found: ${resolved}`));
|
|
25542
25656
|
process.exit(1);
|
|
25543
25657
|
}
|
|
25544
25658
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
25545
25659
|
if (!repoRoot2) {
|
|
25546
|
-
console.error(
|
|
25660
|
+
console.error(chalk166.red("Could not find git repository root"));
|
|
25547
25661
|
process.exit(1);
|
|
25548
25662
|
}
|
|
25549
25663
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -25593,12 +25707,12 @@ function getChangedCsFiles(scope) {
|
|
|
25593
25707
|
}
|
|
25594
25708
|
|
|
25595
25709
|
// src/commands/dotnet/inSln.ts
|
|
25596
|
-
import
|
|
25710
|
+
import chalk167 from "chalk";
|
|
25597
25711
|
async function inSln(csprojPath) {
|
|
25598
25712
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
25599
25713
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
25600
25714
|
if (solutions.length === 0) {
|
|
25601
|
-
console.log(
|
|
25715
|
+
console.log(chalk167.yellow("Not found in any .sln file"));
|
|
25602
25716
|
process.exit(1);
|
|
25603
25717
|
}
|
|
25604
25718
|
for (const sln of solutions) {
|
|
@@ -25607,7 +25721,7 @@ async function inSln(csprojPath) {
|
|
|
25607
25721
|
}
|
|
25608
25722
|
|
|
25609
25723
|
// src/commands/dotnet/inspect.ts
|
|
25610
|
-
import
|
|
25724
|
+
import chalk173 from "chalk";
|
|
25611
25725
|
|
|
25612
25726
|
// src/shared/formatElapsed.ts
|
|
25613
25727
|
function formatElapsed(ms) {
|
|
@@ -25619,12 +25733,12 @@ function formatElapsed(ms) {
|
|
|
25619
25733
|
}
|
|
25620
25734
|
|
|
25621
25735
|
// src/commands/dotnet/displayIssues.ts
|
|
25622
|
-
import
|
|
25736
|
+
import chalk168 from "chalk";
|
|
25623
25737
|
var SEVERITY_COLOR = {
|
|
25624
|
-
ERROR:
|
|
25625
|
-
WARNING:
|
|
25626
|
-
SUGGESTION:
|
|
25627
|
-
HINT:
|
|
25738
|
+
ERROR: chalk168.red,
|
|
25739
|
+
WARNING: chalk168.yellow,
|
|
25740
|
+
SUGGESTION: chalk168.cyan,
|
|
25741
|
+
HINT: chalk168.dim
|
|
25628
25742
|
};
|
|
25629
25743
|
function groupByFile(issues) {
|
|
25630
25744
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -25640,15 +25754,15 @@ function groupByFile(issues) {
|
|
|
25640
25754
|
}
|
|
25641
25755
|
function displayIssues(issues) {
|
|
25642
25756
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
25643
|
-
console.log(
|
|
25757
|
+
console.log(chalk168.bold(file));
|
|
25644
25758
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
25645
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
25759
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk168.white;
|
|
25646
25760
|
console.log(
|
|
25647
|
-
` ${
|
|
25761
|
+
` ${chalk168.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
25648
25762
|
);
|
|
25649
25763
|
}
|
|
25650
25764
|
}
|
|
25651
|
-
console.log(
|
|
25765
|
+
console.log(chalk168.dim(`
|
|
25652
25766
|
${issues.length} issue(s) found`));
|
|
25653
25767
|
}
|
|
25654
25768
|
|
|
@@ -25707,12 +25821,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
25707
25821
|
// src/commands/dotnet/resolveSolution.ts
|
|
25708
25822
|
import { existsSync as existsSync56 } from "fs";
|
|
25709
25823
|
import path38 from "path";
|
|
25710
|
-
import
|
|
25824
|
+
import chalk170 from "chalk";
|
|
25711
25825
|
|
|
25712
25826
|
// src/commands/dotnet/findSolution.ts
|
|
25713
25827
|
import { readdirSync as readdirSync11 } from "fs";
|
|
25714
25828
|
import { dirname as dirname30, join as join69 } from "path";
|
|
25715
|
-
import
|
|
25829
|
+
import chalk169 from "chalk";
|
|
25716
25830
|
function findSlnInDir(dir) {
|
|
25717
25831
|
try {
|
|
25718
25832
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join69(dir, f));
|
|
@@ -25728,17 +25842,17 @@ function findSolution() {
|
|
|
25728
25842
|
const slnFiles = findSlnInDir(current);
|
|
25729
25843
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
25730
25844
|
if (slnFiles.length > 1) {
|
|
25731
|
-
console.error(
|
|
25845
|
+
console.error(chalk169.red(`Multiple .sln files found in ${current}:`));
|
|
25732
25846
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
25733
25847
|
console.error(
|
|
25734
|
-
|
|
25848
|
+
chalk169.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
25735
25849
|
);
|
|
25736
25850
|
process.exit(1);
|
|
25737
25851
|
}
|
|
25738
25852
|
if (current === ceiling) break;
|
|
25739
25853
|
current = dirname30(current);
|
|
25740
25854
|
}
|
|
25741
|
-
console.error(
|
|
25855
|
+
console.error(chalk169.red("No .sln file found between cwd and repo root"));
|
|
25742
25856
|
process.exit(1);
|
|
25743
25857
|
}
|
|
25744
25858
|
|
|
@@ -25747,7 +25861,7 @@ function resolveSolution(sln) {
|
|
|
25747
25861
|
if (sln) {
|
|
25748
25862
|
const resolved = path38.resolve(sln);
|
|
25749
25863
|
if (!existsSync56(resolved)) {
|
|
25750
|
-
console.error(
|
|
25864
|
+
console.error(chalk170.red(`Solution file not found: ${resolved}`));
|
|
25751
25865
|
process.exit(1);
|
|
25752
25866
|
}
|
|
25753
25867
|
return resolved;
|
|
@@ -25789,14 +25903,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
25789
25903
|
import { existsSync as existsSync57, readFileSync as readFileSync40, unlinkSync as unlinkSync10 } from "fs";
|
|
25790
25904
|
import { tmpdir as tmpdir4 } from "os";
|
|
25791
25905
|
import path39 from "path";
|
|
25792
|
-
import
|
|
25906
|
+
import chalk171 from "chalk";
|
|
25793
25907
|
function assertJbInstalled() {
|
|
25794
25908
|
try {
|
|
25795
25909
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25796
25910
|
} catch {
|
|
25797
|
-
console.error(
|
|
25911
|
+
console.error(chalk171.red("jb is not installed. Install with:"));
|
|
25798
25912
|
console.error(
|
|
25799
|
-
|
|
25913
|
+
chalk171.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
25800
25914
|
);
|
|
25801
25915
|
process.exit(1);
|
|
25802
25916
|
}
|
|
@@ -25814,11 +25928,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25814
25928
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
25815
25929
|
process.stderr.write(error.stderr);
|
|
25816
25930
|
}
|
|
25817
|
-
console.error(
|
|
25931
|
+
console.error(chalk171.red("jb inspectcode failed"));
|
|
25818
25932
|
process.exit(1);
|
|
25819
25933
|
}
|
|
25820
25934
|
if (!existsSync57(reportPath)) {
|
|
25821
|
-
console.error(
|
|
25935
|
+
console.error(chalk171.red("Report file not generated"));
|
|
25822
25936
|
process.exit(1);
|
|
25823
25937
|
}
|
|
25824
25938
|
const xml = readFileSync40(reportPath, "utf8");
|
|
@@ -25828,7 +25942,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25828
25942
|
|
|
25829
25943
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
25830
25944
|
import { execSync as execSync38 } from "child_process";
|
|
25831
|
-
import
|
|
25945
|
+
import chalk172 from "chalk";
|
|
25832
25946
|
function resolveMsbuildPath() {
|
|
25833
25947
|
const { run: run4 } = loadConfig();
|
|
25834
25948
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -25840,9 +25954,9 @@ function assertMsbuildInstalled() {
|
|
|
25840
25954
|
try {
|
|
25841
25955
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
25842
25956
|
} catch {
|
|
25843
|
-
console.error(
|
|
25957
|
+
console.error(chalk172.red(`msbuild not found at: ${msbuild}`));
|
|
25844
25958
|
console.error(
|
|
25845
|
-
|
|
25959
|
+
chalk172.yellow(
|
|
25846
25960
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
25847
25961
|
)
|
|
25848
25962
|
);
|
|
@@ -25889,17 +26003,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
25889
26003
|
// src/commands/dotnet/inspect.ts
|
|
25890
26004
|
function logScope(changedFiles2) {
|
|
25891
26005
|
if (changedFiles2 === null) {
|
|
25892
|
-
console.log(
|
|
26006
|
+
console.log(chalk173.dim("Inspecting full solution..."));
|
|
25893
26007
|
} else {
|
|
25894
26008
|
console.log(
|
|
25895
|
-
|
|
26009
|
+
chalk173.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
25896
26010
|
);
|
|
25897
26011
|
}
|
|
25898
26012
|
}
|
|
25899
26013
|
function reportResults(issues, elapsed) {
|
|
25900
26014
|
if (issues.length > 0) displayIssues(issues);
|
|
25901
|
-
else console.log(
|
|
25902
|
-
console.log(
|
|
26015
|
+
else console.log(chalk173.green("No issues found"));
|
|
26016
|
+
console.log(chalk173.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
25903
26017
|
if (issues.length > 0) process.exit(1);
|
|
25904
26018
|
}
|
|
25905
26019
|
async function inspect(sln, options2) {
|
|
@@ -25910,7 +26024,7 @@ async function inspect(sln, options2) {
|
|
|
25910
26024
|
const scope = parseScope(options2.scope);
|
|
25911
26025
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
25912
26026
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
25913
|
-
console.log(
|
|
26027
|
+
console.log(chalk173.green("No changed .cs files found"));
|
|
25914
26028
|
return;
|
|
25915
26029
|
}
|
|
25916
26030
|
logScope(changedFiles2);
|
|
@@ -26798,25 +26912,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
26798
26912
|
}
|
|
26799
26913
|
|
|
26800
26914
|
// src/commands/github/printCountTable.ts
|
|
26801
|
-
import
|
|
26915
|
+
import chalk174 from "chalk";
|
|
26802
26916
|
function printCountTable(labelHeader, rows) {
|
|
26803
26917
|
const labelWidth = Math.max(
|
|
26804
26918
|
labelHeader.length,
|
|
26805
26919
|
...rows.map((row3) => row3.label.length)
|
|
26806
26920
|
);
|
|
26807
26921
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
26808
|
-
console.log(
|
|
26809
|
-
console.log(
|
|
26922
|
+
console.log(chalk174.dim(header));
|
|
26923
|
+
console.log(chalk174.dim("-".repeat(header.length)));
|
|
26810
26924
|
for (const row3 of rows) {
|
|
26811
26925
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
26812
26926
|
}
|
|
26813
26927
|
}
|
|
26814
26928
|
|
|
26815
26929
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
26816
|
-
import
|
|
26930
|
+
import chalk175 from "chalk";
|
|
26817
26931
|
function printRepoAuthorBreakdown(repos2) {
|
|
26818
26932
|
for (const repo of repos2) {
|
|
26819
|
-
console.log(
|
|
26933
|
+
console.log(chalk175.bold(repo.name));
|
|
26820
26934
|
const authorWidth = Math.max(
|
|
26821
26935
|
0,
|
|
26822
26936
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -26877,32 +26991,23 @@ function commits(org, options2) {
|
|
|
26877
26991
|
}
|
|
26878
26992
|
|
|
26879
26993
|
// src/commands/github/parseSinceDate.ts
|
|
26880
|
-
import { InvalidArgumentError } from "commander";
|
|
26994
|
+
import { InvalidArgumentError as InvalidArgumentError3 } from "commander";
|
|
26881
26995
|
function parseSinceDate(value) {
|
|
26882
26996
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
26883
|
-
throw new
|
|
26997
|
+
throw new InvalidArgumentError3("Expected a date in YYYY-MM-DD format.");
|
|
26884
26998
|
}
|
|
26885
26999
|
const date = /* @__PURE__ */ new Date(`${value}T00:00:00Z`);
|
|
26886
27000
|
if (Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== value) {
|
|
26887
|
-
throw new
|
|
27001
|
+
throw new InvalidArgumentError3(`Not a valid calendar date: ${value}.`);
|
|
26888
27002
|
}
|
|
26889
27003
|
return value;
|
|
26890
27004
|
}
|
|
26891
27005
|
|
|
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
27006
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
26902
|
-
import
|
|
27007
|
+
import chalk177 from "chalk";
|
|
26903
27008
|
|
|
26904
27009
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
26905
|
-
import
|
|
27010
|
+
import chalk176 from "chalk";
|
|
26906
27011
|
|
|
26907
27012
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
26908
27013
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -26939,7 +27044,7 @@ function writeLineNow(line) {
|
|
|
26939
27044
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
26940
27045
|
function applyFixStructurePlan(plan2) {
|
|
26941
27046
|
for (const entry of plan2.entries) {
|
|
26942
|
-
const where =
|
|
27047
|
+
const where = chalk176.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
26943
27048
|
const { typeChange, labelRemovals } = entry;
|
|
26944
27049
|
if (typeChange) {
|
|
26945
27050
|
writeLineNow(
|
|
@@ -27209,12 +27314,12 @@ function planSubtree(root2, context) {
|
|
|
27209
27314
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27210
27315
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27211
27316
|
applyFixStructurePlan(plan2);
|
|
27212
|
-
writeLineNow(
|
|
27317
|
+
writeLineNow(chalk177.dim("Re-walking the subtree to confirm"));
|
|
27213
27318
|
assertNoResidualDrift(
|
|
27214
27319
|
planSubtree(fetchRootIssue(target), context),
|
|
27215
27320
|
context.chain
|
|
27216
27321
|
);
|
|
27217
|
-
writeLineNow(
|
|
27322
|
+
writeLineNow(chalk177.green("Subtree normalised"));
|
|
27218
27323
|
}
|
|
27219
27324
|
|
|
27220
27325
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27250,22 +27355,22 @@ function parseTypeChain(value) {
|
|
|
27250
27355
|
}
|
|
27251
27356
|
|
|
27252
27357
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27253
|
-
import
|
|
27358
|
+
import chalk178 from "chalk";
|
|
27254
27359
|
function annotate(entry) {
|
|
27255
27360
|
const notes = [];
|
|
27256
27361
|
if (entry.level === null) {
|
|
27257
|
-
notes.push(
|
|
27362
|
+
notes.push(chalk178.red("deeper than the leaf level"));
|
|
27258
27363
|
} else if (entry.typeChange) {
|
|
27259
27364
|
notes.push(
|
|
27260
|
-
|
|
27365
|
+
chalk178.yellow(
|
|
27261
27366
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27262
27367
|
)
|
|
27263
27368
|
);
|
|
27264
27369
|
} else {
|
|
27265
|
-
notes.push(
|
|
27370
|
+
notes.push(chalk178.dim(entry.issue.typeName ?? "no type"));
|
|
27266
27371
|
}
|
|
27267
27372
|
for (const label of entry.labelRemovals) {
|
|
27268
|
-
notes.push(
|
|
27373
|
+
notes.push(chalk178.yellow(`-${label.name}`));
|
|
27269
27374
|
}
|
|
27270
27375
|
return notes;
|
|
27271
27376
|
}
|
|
@@ -27273,22 +27378,22 @@ function formatCount(count10, noun) {
|
|
|
27273
27378
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27274
27379
|
}
|
|
27275
27380
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27276
|
-
writeLineNow(
|
|
27381
|
+
writeLineNow(chalk178.dim(`chain: ${chain2.join(" > ")}`));
|
|
27277
27382
|
for (const entry of plan2.entries) {
|
|
27278
|
-
const
|
|
27279
|
-
const name =
|
|
27383
|
+
const indent4 = " ".repeat(entry.issue.depth);
|
|
27384
|
+
const name = chalk178.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27280
27385
|
writeLineNow(
|
|
27281
|
-
`${
|
|
27386
|
+
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27282
27387
|
);
|
|
27283
27388
|
}
|
|
27284
27389
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27285
|
-
writeLineNow(
|
|
27390
|
+
writeLineNow(chalk178.green("Nothing to change"));
|
|
27286
27391
|
return;
|
|
27287
27392
|
}
|
|
27288
27393
|
writeLineNow(
|
|
27289
27394
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27290
27395
|
);
|
|
27291
|
-
if (!apply) writeLineNow(
|
|
27396
|
+
if (!apply) writeLineNow(chalk178.dim("Dry run \u2014 nothing written"));
|
|
27292
27397
|
}
|
|
27293
27398
|
|
|
27294
27399
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28695,25 +28800,25 @@ function registerGithub(program) {
|
|
|
28695
28800
|
}
|
|
28696
28801
|
|
|
28697
28802
|
// src/commands/inbox/list.ts
|
|
28698
|
-
import
|
|
28803
|
+
import chalk179 from "chalk";
|
|
28699
28804
|
async function list3() {
|
|
28700
28805
|
const messages = await listInboxMessages(await getDb());
|
|
28701
28806
|
if (messages.length === 0) {
|
|
28702
|
-
console.log(
|
|
28807
|
+
console.log(chalk179.dim("No flagged messages; run assist inbox scan"));
|
|
28703
28808
|
return;
|
|
28704
28809
|
}
|
|
28705
28810
|
for (const message3 of messages) {
|
|
28706
28811
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
28707
28812
|
console.log(
|
|
28708
|
-
`${
|
|
28813
|
+
`${chalk179.dim(when)} ${chalk179.cyan(message3.source)} ${chalk179.bold(message3.sender)}`
|
|
28709
28814
|
);
|
|
28710
28815
|
console.log(` ${message3.summary}`);
|
|
28711
|
-
console.log(` ${
|
|
28816
|
+
console.log(` ${chalk179.dim(message3.link)}`);
|
|
28712
28817
|
}
|
|
28713
28818
|
}
|
|
28714
28819
|
|
|
28715
28820
|
// src/commands/inbox/scan.ts
|
|
28716
|
-
import
|
|
28821
|
+
import chalk180 from "chalk";
|
|
28717
28822
|
|
|
28718
28823
|
// src/shared/db/upsertInboxMessages.ts
|
|
28719
28824
|
async function upsertInboxMessages(orm, messages) {
|
|
@@ -28903,7 +29008,7 @@ async function scan() {
|
|
|
28903
29008
|
)
|
|
28904
29009
|
);
|
|
28905
29010
|
console.log(
|
|
28906
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29011
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk180.bold(added)} new.`
|
|
28907
29012
|
);
|
|
28908
29013
|
}
|
|
28909
29014
|
|
|
@@ -28918,7 +29023,7 @@ function registerInbox(program) {
|
|
|
28918
29023
|
}
|
|
28919
29024
|
|
|
28920
29025
|
// src/commands/jira/acceptanceCriteria.ts
|
|
28921
|
-
import
|
|
29026
|
+
import chalk181 from "chalk";
|
|
28922
29027
|
|
|
28923
29028
|
// src/commands/jira/adfToText.ts
|
|
28924
29029
|
function renderInline(node) {
|
|
@@ -28926,52 +29031,52 @@ function renderInline(node) {
|
|
|
28926
29031
|
if (node.marks?.some((m) => m.type === "code")) return `\`${text18}\``;
|
|
28927
29032
|
return text18;
|
|
28928
29033
|
}
|
|
28929
|
-
function renderChildren(node,
|
|
28930
|
-
return renderNodes(node.content ?? [],
|
|
29034
|
+
function renderChildren(node, indent4) {
|
|
29035
|
+
return renderNodes(node.content ?? [], indent4);
|
|
28931
29036
|
}
|
|
28932
|
-
function renderOrderedList(node,
|
|
29037
|
+
function renderOrderedList(node, indent4) {
|
|
28933
29038
|
let counter = 0;
|
|
28934
29039
|
return (node.content ?? []).map((item) => {
|
|
28935
29040
|
counter++;
|
|
28936
|
-
return renderListItem(item,
|
|
29041
|
+
return renderListItem(item, indent4, `${counter}.`);
|
|
28937
29042
|
}).join("\n");
|
|
28938
29043
|
}
|
|
28939
|
-
function renderBulletList(node,
|
|
28940
|
-
return (node.content ?? []).map((item) => renderListItem(item,
|
|
29044
|
+
function renderBulletList(node, indent4) {
|
|
29045
|
+
return (node.content ?? []).map((item) => renderListItem(item, indent4, "-")).join("\n");
|
|
28941
29046
|
}
|
|
28942
|
-
function renderHeading(node,
|
|
29047
|
+
function renderHeading(node, indent4) {
|
|
28943
29048
|
const level = node.attrs?.level ?? 1;
|
|
28944
|
-
return `${"#".repeat(level)} ${renderChildren(node,
|
|
29049
|
+
return `${"#".repeat(level)} ${renderChildren(node, indent4)}`;
|
|
28945
29050
|
}
|
|
28946
29051
|
var renderers = {
|
|
28947
29052
|
text: (node) => renderInline(node),
|
|
28948
29053
|
paragraph: renderChildren,
|
|
28949
29054
|
orderedList: renderOrderedList,
|
|
28950
29055
|
bulletList: renderBulletList,
|
|
28951
|
-
listItem: (node,
|
|
29056
|
+
listItem: (node, indent4) => renderListItem(node, indent4, "-"),
|
|
28952
29057
|
heading: renderHeading,
|
|
28953
29058
|
doc: renderChildren
|
|
28954
29059
|
};
|
|
28955
|
-
function renderNode(node,
|
|
29060
|
+
function renderNode(node, indent4) {
|
|
28956
29061
|
const renderer = renderers[node.type];
|
|
28957
|
-
if (renderer) return renderer(node,
|
|
28958
|
-
return node.content ? renderChildren(node,
|
|
29062
|
+
if (renderer) return renderer(node, indent4);
|
|
29063
|
+
return node.content ? renderChildren(node, indent4) : "";
|
|
28959
29064
|
}
|
|
28960
|
-
function renderNodes(nodes,
|
|
28961
|
-
return nodes.map((node) => renderNode(node,
|
|
29065
|
+
function renderNodes(nodes, indent4) {
|
|
29066
|
+
return nodes.map((node) => renderNode(node, indent4)).join("");
|
|
28962
29067
|
}
|
|
28963
29068
|
function isListNode(node) {
|
|
28964
29069
|
return node.type === "orderedList" || node.type === "bulletList";
|
|
28965
29070
|
}
|
|
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 ? `${
|
|
29071
|
+
function renderListChild(child, indent4, pad3, marker2, isFirst) {
|
|
29072
|
+
if (isListNode(child)) return renderNodes([child], indent4 + 1);
|
|
29073
|
+
if (child.type !== "paragraph") return renderNode(child, indent4);
|
|
29074
|
+
const text18 = renderChildren(child, indent4);
|
|
29075
|
+
return isFirst ? `${pad3}${marker2} ${text18}` : `${pad3} ${text18}`;
|
|
28971
29076
|
}
|
|
28972
|
-
function renderListItem(node,
|
|
28973
|
-
const
|
|
28974
|
-
return (node.content ?? []).map((child, i) => renderListChild(child,
|
|
29077
|
+
function renderListItem(node, indent4, marker2) {
|
|
29078
|
+
const pad3 = " ".repeat(indent4);
|
|
29079
|
+
return (node.content ?? []).map((child, i) => renderListChild(child, indent4, pad3, marker2, i === 0)).join("\n");
|
|
28975
29080
|
}
|
|
28976
29081
|
function adfToText(doc) {
|
|
28977
29082
|
return renderNodes([doc], 0);
|
|
@@ -28985,7 +29090,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
28985
29090
|
const parsed = fetchIssue(issueKey, field);
|
|
28986
29091
|
const acValue = parsed?.fields?.[field];
|
|
28987
29092
|
if (!acValue) {
|
|
28988
|
-
console.log(
|
|
29093
|
+
console.log(chalk181.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
28989
29094
|
return;
|
|
28990
29095
|
}
|
|
28991
29096
|
if (typeof acValue === "string") {
|
|
@@ -29051,14 +29156,14 @@ async function jiraAuth() {
|
|
|
29051
29156
|
}
|
|
29052
29157
|
|
|
29053
29158
|
// src/commands/jira/viewIssue.ts
|
|
29054
|
-
import
|
|
29159
|
+
import chalk182 from "chalk";
|
|
29055
29160
|
function viewIssue2(issueKey) {
|
|
29056
29161
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29057
29162
|
const fields = parsed?.fields;
|
|
29058
29163
|
const summary = fields?.summary;
|
|
29059
29164
|
const description = fields?.description;
|
|
29060
29165
|
if (summary) {
|
|
29061
|
-
console.log(
|
|
29166
|
+
console.log(chalk182.bold(summary));
|
|
29062
29167
|
}
|
|
29063
29168
|
if (description) {
|
|
29064
29169
|
if (summary) console.log();
|
|
@@ -29072,7 +29177,7 @@ function viewIssue2(issueKey) {
|
|
|
29072
29177
|
}
|
|
29073
29178
|
if (!summary && !description) {
|
|
29074
29179
|
console.log(
|
|
29075
|
-
|
|
29180
|
+
chalk182.yellow(`No summary or description found on ${issueKey}.`)
|
|
29076
29181
|
);
|
|
29077
29182
|
}
|
|
29078
29183
|
}
|
|
@@ -29779,7 +29884,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
29779
29884
|
}
|
|
29780
29885
|
|
|
29781
29886
|
// src/commands/review/failCheckout.ts
|
|
29782
|
-
import
|
|
29887
|
+
import chalk183 from "chalk";
|
|
29783
29888
|
|
|
29784
29889
|
// src/commands/review/azCliProblem.ts
|
|
29785
29890
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
@@ -29832,14 +29937,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
29832
29937
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
29833
29938
|
if (headRef && stale === "local-work")
|
|
29834
29939
|
console.error(
|
|
29835
|
-
|
|
29940
|
+
chalk183.red(
|
|
29836
29941
|
`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
29942
|
)
|
|
29838
29943
|
);
|
|
29839
29944
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
29840
|
-
if (problem) console.error(
|
|
29945
|
+
if (problem) console.error(chalk183.red(problem));
|
|
29841
29946
|
console.error(
|
|
29842
|
-
|
|
29947
|
+
chalk183.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
29843
29948
|
);
|
|
29844
29949
|
process.exit(1);
|
|
29845
29950
|
}
|
|
@@ -30032,18 +30137,18 @@ function registerList(program) {
|
|
|
30032
30137
|
}
|
|
30033
30138
|
|
|
30034
30139
|
// src/commands/litellm/listModels.ts
|
|
30035
|
-
import
|
|
30140
|
+
import chalk185 from "chalk";
|
|
30036
30141
|
|
|
30037
30142
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30038
|
-
import
|
|
30143
|
+
import chalk184 from "chalk";
|
|
30039
30144
|
function resolveLitellmConfig() {
|
|
30040
30145
|
const { config, missing } = readLitellmConfig();
|
|
30041
30146
|
if (!config) {
|
|
30042
|
-
console.error(
|
|
30147
|
+
console.error(chalk184.red("LiteLLM is not configured"));
|
|
30043
30148
|
for (const key of missing) {
|
|
30044
30149
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30045
30150
|
console.error(
|
|
30046
|
-
|
|
30151
|
+
chalk184.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30047
30152
|
);
|
|
30048
30153
|
}
|
|
30049
30154
|
process.exit(1);
|
|
@@ -30069,13 +30174,13 @@ async function listModels(options2) {
|
|
|
30069
30174
|
} catch (error) {
|
|
30070
30175
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30071
30176
|
console.error(
|
|
30072
|
-
|
|
30177
|
+
chalk185.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30073
30178
|
);
|
|
30074
30179
|
process.exit(1);
|
|
30075
30180
|
}
|
|
30076
30181
|
const body = await response.text();
|
|
30077
30182
|
if (!response.ok) {
|
|
30078
|
-
console.error(
|
|
30183
|
+
console.error(chalk185.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30079
30184
|
process.exit(1);
|
|
30080
30185
|
}
|
|
30081
30186
|
if (options2.json) {
|
|
@@ -30095,15 +30200,15 @@ function registerLitellm(program) {
|
|
|
30095
30200
|
// src/commands/mermaidExport.ts
|
|
30096
30201
|
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
30097
30202
|
import { resolve as resolve21 } from "path";
|
|
30098
|
-
import
|
|
30203
|
+
import chalk188 from "chalk";
|
|
30099
30204
|
|
|
30100
30205
|
// src/commands/mermaid/exportFile.ts
|
|
30101
30206
|
import { readFileSync as readFileSync42, writeFileSync as writeFileSync34 } from "fs";
|
|
30102
30207
|
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
30103
|
-
import
|
|
30208
|
+
import chalk187 from "chalk";
|
|
30104
30209
|
|
|
30105
30210
|
// src/commands/mermaid/renderBlock.ts
|
|
30106
|
-
import
|
|
30211
|
+
import chalk186 from "chalk";
|
|
30107
30212
|
async function renderBlock(krokiUrl, source) {
|
|
30108
30213
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30109
30214
|
method: "POST",
|
|
@@ -30112,7 +30217,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30112
30217
|
});
|
|
30113
30218
|
if (!response.ok) {
|
|
30114
30219
|
console.error(
|
|
30115
|
-
|
|
30220
|
+
chalk186.red(
|
|
30116
30221
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
30117
30222
|
)
|
|
30118
30223
|
);
|
|
@@ -30130,19 +30235,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30130
30235
|
if (onlyIndex !== void 0) {
|
|
30131
30236
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30132
30237
|
console.error(
|
|
30133
|
-
|
|
30238
|
+
chalk187.red(
|
|
30134
30239
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
30135
30240
|
)
|
|
30136
30241
|
);
|
|
30137
30242
|
process.exit(1);
|
|
30138
30243
|
}
|
|
30139
30244
|
console.log(
|
|
30140
|
-
|
|
30245
|
+
chalk187.gray(
|
|
30141
30246
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
30142
30247
|
)
|
|
30143
30248
|
);
|
|
30144
30249
|
} else {
|
|
30145
|
-
console.log(
|
|
30250
|
+
console.log(chalk187.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
30146
30251
|
}
|
|
30147
30252
|
for (const [i, source] of blocks.entries()) {
|
|
30148
30253
|
const idx = i + 1;
|
|
@@ -30150,7 +30255,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30150
30255
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
30151
30256
|
const svg = await renderBlock(krokiUrl, source);
|
|
30152
30257
|
writeFileSync34(outPath, svg, "utf8");
|
|
30153
|
-
console.log(
|
|
30258
|
+
console.log(chalk187.green(` \u2192 ${outPath}`));
|
|
30154
30259
|
}
|
|
30155
30260
|
}
|
|
30156
30261
|
function extractMermaidBlocks(markdown) {
|
|
@@ -30166,18 +30271,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
30166
30271
|
if (options2.index !== void 0) {
|
|
30167
30272
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
30168
30273
|
console.error(
|
|
30169
|
-
|
|
30274
|
+
chalk188.red(`--index must be a positive integer (got ${options2.index})`)
|
|
30170
30275
|
);
|
|
30171
30276
|
process.exit(1);
|
|
30172
30277
|
}
|
|
30173
30278
|
if (!file) {
|
|
30174
|
-
console.error(
|
|
30279
|
+
console.error(chalk188.red("--index requires a file argument"));
|
|
30175
30280
|
process.exit(1);
|
|
30176
30281
|
}
|
|
30177
30282
|
}
|
|
30178
30283
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
30179
30284
|
if (files.length === 0) {
|
|
30180
|
-
console.log(
|
|
30285
|
+
console.log(chalk188.gray("No markdown files found in current directory."));
|
|
30181
30286
|
return;
|
|
30182
30287
|
}
|
|
30183
30288
|
for (const f of files) {
|
|
@@ -30323,7 +30428,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
30323
30428
|
}
|
|
30324
30429
|
|
|
30325
30430
|
// src/commands/miro/keptTexts.ts
|
|
30326
|
-
import
|
|
30431
|
+
import chalk189 from "chalk";
|
|
30327
30432
|
|
|
30328
30433
|
// src/commands/miro/applyIgnore.ts
|
|
30329
30434
|
function applyIgnore(texts, ignore3) {
|
|
@@ -30362,7 +30467,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
30362
30467
|
if (unmatched.length === 0) return;
|
|
30363
30468
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
30364
30469
|
console.error(
|
|
30365
|
-
|
|
30470
|
+
chalk189.yellow(
|
|
30366
30471
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
30367
30472
|
${entries}`
|
|
30368
30473
|
)
|
|
@@ -30563,7 +30668,7 @@ function readMiroItems(file) {
|
|
|
30563
30668
|
}
|
|
30564
30669
|
|
|
30565
30670
|
// src/commands/miro/resolveExtractOptions.ts
|
|
30566
|
-
import
|
|
30671
|
+
import chalk190 from "chalk";
|
|
30567
30672
|
|
|
30568
30673
|
// src/commands/miro/extractLayers.ts
|
|
30569
30674
|
function extractsIn(layer) {
|
|
@@ -30641,7 +30746,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
30641
30746
|
paths.cwd,
|
|
30642
30747
|
paths.globalConfigPath
|
|
30643
30748
|
);
|
|
30644
|
-
console.error(
|
|
30749
|
+
console.error(chalk190.dim(`Extract "${name}" from ${resolved.from}`));
|
|
30645
30750
|
return resolved.options;
|
|
30646
30751
|
}
|
|
30647
30752
|
|
|
@@ -30746,7 +30851,7 @@ function registerMiro(program) {
|
|
|
30746
30851
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
30747
30852
|
import { createServer as createServer2 } from "http";
|
|
30748
30853
|
import { dirname as dirname36 } from "path";
|
|
30749
|
-
import
|
|
30854
|
+
import chalk192 from "chalk";
|
|
30750
30855
|
|
|
30751
30856
|
// src/commands/netcap/corsHeaders.ts
|
|
30752
30857
|
var corsHeaders = {
|
|
@@ -30825,7 +30930,7 @@ function createNetcapHandler(options2) {
|
|
|
30825
30930
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
30826
30931
|
import { networkInterfaces } from "os";
|
|
30827
30932
|
import { join as join76 } from "path";
|
|
30828
|
-
import
|
|
30933
|
+
import chalk191 from "chalk";
|
|
30829
30934
|
|
|
30830
30935
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
30831
30936
|
import { dirname as dirname35, join as join75 } from "path";
|
|
@@ -30869,7 +30974,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30869
30974
|
const host = lanIPv4();
|
|
30870
30975
|
if (!host) {
|
|
30871
30976
|
console.log(
|
|
30872
|
-
|
|
30977
|
+
chalk191.yellow("could not determine the WSL IP for the extension")
|
|
30873
30978
|
);
|
|
30874
30979
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
30875
30980
|
return source;
|
|
@@ -30880,7 +30985,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30880
30985
|
return WSL_WINDOWS_PATH3;
|
|
30881
30986
|
} catch {
|
|
30882
30987
|
console.log(
|
|
30883
|
-
|
|
30988
|
+
chalk191.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
30884
30989
|
);
|
|
30885
30990
|
return source;
|
|
30886
30991
|
}
|
|
@@ -30913,30 +31018,30 @@ async function netcap(options2) {
|
|
|
30913
31018
|
let count10 = 0;
|
|
30914
31019
|
const handler = createNetcapHandler({
|
|
30915
31020
|
outPath,
|
|
30916
|
-
onPing: () => console.log(
|
|
31021
|
+
onPing: () => console.log(chalk192.dim("ping from extension")),
|
|
30917
31022
|
onCapture: (entry) => {
|
|
30918
31023
|
count10 += 1;
|
|
30919
31024
|
console.log(
|
|
30920
|
-
|
|
30921
|
-
|
|
31025
|
+
chalk192.green(`captured #${count10}`),
|
|
31026
|
+
chalk192.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
30922
31027
|
);
|
|
30923
31028
|
}
|
|
30924
31029
|
});
|
|
30925
31030
|
const server = createServer2(handler);
|
|
30926
31031
|
server.listen(port, () => {
|
|
30927
31032
|
console.log(
|
|
30928
|
-
|
|
31033
|
+
chalk192.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
30929
31034
|
);
|
|
30930
|
-
console.log(
|
|
31035
|
+
console.log(chalk192.dim(`appending captures to ${outPath}`));
|
|
30931
31036
|
if (filter)
|
|
30932
|
-
console.log(
|
|
30933
|
-
console.log(
|
|
30934
|
-
console.log(
|
|
31037
|
+
console.log(chalk192.dim(`forwarding only URLs matching "${filter}"`));
|
|
31038
|
+
console.log(chalk192.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31039
|
+
console.log(chalk192.dim("press Ctrl-C to stop"));
|
|
30935
31040
|
});
|
|
30936
31041
|
process.on("SIGINT", () => {
|
|
30937
31042
|
server.close();
|
|
30938
31043
|
console.log(
|
|
30939
|
-
|
|
31044
|
+
chalk192.bold(
|
|
30940
31045
|
`
|
|
30941
31046
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
30942
31047
|
)
|
|
@@ -30948,7 +31053,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
30948
31053
|
// src/commands/netcap/netcapExtract.ts
|
|
30949
31054
|
import { writeFileSync as writeFileSync36 } from "fs";
|
|
30950
31055
|
import { join as join79 } from "path";
|
|
30951
|
-
import
|
|
31056
|
+
import chalk193 from "chalk";
|
|
30952
31057
|
|
|
30953
31058
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
30954
31059
|
import { readFileSync as readFileSync45 } from "fs";
|
|
@@ -31396,8 +31501,8 @@ function netcapExtract(file) {
|
|
|
31396
31501
|
writeFileSync36(outFile, `${JSON.stringify(posts, null, 2)}
|
|
31397
31502
|
`);
|
|
31398
31503
|
console.log(
|
|
31399
|
-
|
|
31400
|
-
|
|
31504
|
+
chalk193.green(`extracted ${posts.length} posts`),
|
|
31505
|
+
chalk193.dim(`-> ${outFile}`)
|
|
31401
31506
|
);
|
|
31402
31507
|
}
|
|
31403
31508
|
|
|
@@ -31418,7 +31523,7 @@ function registerNetcap(program) {
|
|
|
31418
31523
|
}
|
|
31419
31524
|
|
|
31420
31525
|
// src/commands/news/add.ts
|
|
31421
|
-
import
|
|
31526
|
+
import chalk194 from "chalk";
|
|
31422
31527
|
import enquirer8 from "enquirer";
|
|
31423
31528
|
async function add2(url) {
|
|
31424
31529
|
if (!url) {
|
|
@@ -31439,25 +31544,25 @@ async function add2(url) {
|
|
|
31439
31544
|
}
|
|
31440
31545
|
const added = await addFeed(await getDb(), url);
|
|
31441
31546
|
if (!added) {
|
|
31442
|
-
console.log(
|
|
31547
|
+
console.log(chalk194.yellow("Feed already exists"));
|
|
31443
31548
|
return;
|
|
31444
31549
|
}
|
|
31445
|
-
console.log(
|
|
31550
|
+
console.log(chalk194.green(`Added feed: ${url}`));
|
|
31446
31551
|
}
|
|
31447
31552
|
|
|
31448
31553
|
// src/commands/news/list.ts
|
|
31449
|
-
import
|
|
31554
|
+
import chalk195 from "chalk";
|
|
31450
31555
|
async function list4() {
|
|
31451
31556
|
const urls = await listFeeds(await getDb());
|
|
31452
31557
|
if (urls.length === 0) {
|
|
31453
|
-
console.log(
|
|
31558
|
+
console.log(chalk195.dim("No feeds; add one with assist news add <url>"));
|
|
31454
31559
|
return;
|
|
31455
31560
|
}
|
|
31456
31561
|
for (const url of urls) console.log(url);
|
|
31457
31562
|
}
|
|
31458
31563
|
|
|
31459
31564
|
// src/commands/news/remove.ts
|
|
31460
|
-
import
|
|
31565
|
+
import chalk196 from "chalk";
|
|
31461
31566
|
|
|
31462
31567
|
// src/commands/backlog/removeFeed.ts
|
|
31463
31568
|
import { eq as eq49 } from "drizzle-orm";
|
|
@@ -31470,10 +31575,10 @@ async function removeFeed(db, url) {
|
|
|
31470
31575
|
async function remove(url) {
|
|
31471
31576
|
const removed = await removeFeed(await getDb(), url);
|
|
31472
31577
|
if (!removed) {
|
|
31473
|
-
console.log(
|
|
31578
|
+
console.log(chalk196.yellow(`No feed matches ${url}`));
|
|
31474
31579
|
return;
|
|
31475
31580
|
}
|
|
31476
|
-
console.log(
|
|
31581
|
+
console.log(chalk196.green(`Removed feed: ${url}`));
|
|
31477
31582
|
}
|
|
31478
31583
|
|
|
31479
31584
|
// src/commands/registerNews.ts
|
|
@@ -31526,7 +31631,7 @@ function registerPiHook(program) {
|
|
|
31526
31631
|
}
|
|
31527
31632
|
|
|
31528
31633
|
// src/commands/prompts/printPromptsTable.ts
|
|
31529
|
-
import
|
|
31634
|
+
import chalk197 from "chalk";
|
|
31530
31635
|
function truncate(str, max) {
|
|
31531
31636
|
if (str.length <= max) return str;
|
|
31532
31637
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -31544,14 +31649,14 @@ function printPromptsTable(rows) {
|
|
|
31544
31649
|
"Command".padEnd(commandWidth),
|
|
31545
31650
|
"Repos"
|
|
31546
31651
|
].join(" ");
|
|
31547
|
-
console.log(
|
|
31548
|
-
console.log(
|
|
31652
|
+
console.log(chalk197.dim(header));
|
|
31653
|
+
console.log(chalk197.dim("-".repeat(header.length)));
|
|
31549
31654
|
for (const row3 of rows) {
|
|
31550
31655
|
const count10 = String(row3.count).padStart(countWidth);
|
|
31551
31656
|
const tool = row3.tool.padEnd(toolWidth);
|
|
31552
31657
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
31553
31658
|
console.log(
|
|
31554
|
-
`${
|
|
31659
|
+
`${chalk197.yellow(count10)} ${tool} ${command} ${chalk197.dim(row3.repos)}`
|
|
31555
31660
|
);
|
|
31556
31661
|
}
|
|
31557
31662
|
}
|
|
@@ -31589,13 +31694,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
31589
31694
|
import enquirer9 from "enquirer";
|
|
31590
31695
|
|
|
31591
31696
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
31592
|
-
import
|
|
31697
|
+
import chalk198 from "chalk";
|
|
31593
31698
|
var STATUS_MAP = {
|
|
31594
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
31595
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
31699
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk198.magenta("merged"), date: pr.mergedAt } : null,
|
|
31700
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk198.red("closed"), date: pr.closedAt } : null
|
|
31596
31701
|
};
|
|
31597
31702
|
function defaultStatus(pr) {
|
|
31598
|
-
return { label:
|
|
31703
|
+
return { label: chalk198.green("opened"), date: pr.createdAt };
|
|
31599
31704
|
}
|
|
31600
31705
|
function getStatus2(pr) {
|
|
31601
31706
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -31604,11 +31709,11 @@ function formatDate(dateStr) {
|
|
|
31604
31709
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
31605
31710
|
}
|
|
31606
31711
|
function formatPrHeader(pr, status2) {
|
|
31607
|
-
return `${
|
|
31712
|
+
return `${chalk198.cyan(`#${pr.number}`)} ${pr.title} ${chalk198.dim(`(${pr.author.login},`)} ${status2.label} ${chalk198.dim(`${formatDate(status2.date)})`)}`;
|
|
31608
31713
|
}
|
|
31609
31714
|
function logPrDetails(pr) {
|
|
31610
31715
|
console.log(
|
|
31611
|
-
|
|
31716
|
+
chalk198.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
31612
31717
|
);
|
|
31613
31718
|
console.log();
|
|
31614
31719
|
}
|
|
@@ -32177,13 +32282,13 @@ function agentFooter(unresolvedCount) {
|
|
|
32177
32282
|
}
|
|
32178
32283
|
|
|
32179
32284
|
// src/commands/prs/listComments/commentStyle.ts
|
|
32180
|
-
import
|
|
32285
|
+
import chalk199 from "chalk";
|
|
32181
32286
|
var plain = (text18) => text18;
|
|
32182
32287
|
function colouredState(state) {
|
|
32183
32288
|
const label = `[${state}]`;
|
|
32184
|
-
if (state === "APPROVED") return
|
|
32185
|
-
if (state === "CHANGES_REQUESTED") return
|
|
32186
|
-
return
|
|
32289
|
+
if (state === "APPROVED") return chalk199.green(label);
|
|
32290
|
+
if (state === "CHANGES_REQUESTED") return chalk199.red(label);
|
|
32291
|
+
return chalk199.yellow(label);
|
|
32187
32292
|
}
|
|
32188
32293
|
function commentStyle() {
|
|
32189
32294
|
if (isClaudeCode()) {
|
|
@@ -32197,9 +32302,9 @@ function commentStyle() {
|
|
|
32197
32302
|
};
|
|
32198
32303
|
}
|
|
32199
32304
|
return {
|
|
32200
|
-
cyan:
|
|
32201
|
-
bold:
|
|
32202
|
-
dim:
|
|
32305
|
+
cyan: chalk199.cyan,
|
|
32306
|
+
bold: chalk199.bold,
|
|
32307
|
+
dim: chalk199.dim,
|
|
32203
32308
|
state: colouredState,
|
|
32204
32309
|
diffHunk: true,
|
|
32205
32310
|
agent: false
|
|
@@ -32246,7 +32351,7 @@ function renderResolvedIndex(threads, style) {
|
|
|
32246
32351
|
}
|
|
32247
32352
|
|
|
32248
32353
|
// src/commands/prs/listComments/renderThreadBlock.ts
|
|
32249
|
-
function
|
|
32354
|
+
function indent2(text18) {
|
|
32250
32355
|
return text18.split("\n").map((line) => line ? ` ${line}` : line).join("\n");
|
|
32251
32356
|
}
|
|
32252
32357
|
function renderThreadBlock(thread, style) {
|
|
@@ -32257,12 +32362,12 @@ function renderThreadBlock(thread, style) {
|
|
|
32257
32362
|
];
|
|
32258
32363
|
if (style.diffHunk) {
|
|
32259
32364
|
lines2.push(
|
|
32260
|
-
|
|
32365
|
+
indent2(style.dim(first.diff_hunk.split("\n").slice(-3).join("\n")))
|
|
32261
32366
|
);
|
|
32262
32367
|
}
|
|
32263
32368
|
for (const comment3 of thread.comments) {
|
|
32264
32369
|
lines2.push(
|
|
32265
|
-
|
|
32370
|
+
indent2(
|
|
32266
32371
|
[
|
|
32267
32372
|
`${style.bold(comment3.user)} ${style.dim(`id ${comment3.id}`)} ${style.dim(comment3.html_url)}`,
|
|
32268
32373
|
comment3.body,
|
|
@@ -33673,16 +33778,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
33673
33778
|
}
|
|
33674
33779
|
|
|
33675
33780
|
// src/commands/prs/status/printPrsStatus.ts
|
|
33676
|
-
import
|
|
33781
|
+
import chalk201 from "chalk";
|
|
33677
33782
|
|
|
33678
33783
|
// src/commands/prs/status/printPrStatus.ts
|
|
33679
|
-
import
|
|
33784
|
+
import chalk200 from "chalk";
|
|
33680
33785
|
function flags(pr) {
|
|
33681
33786
|
const markers = [];
|
|
33682
33787
|
if (pr.isDraft) markers.push("draft");
|
|
33683
33788
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
33684
33789
|
if (pr.isBot) markers.push("bot");
|
|
33685
|
-
return markers.length ? ` ${
|
|
33790
|
+
return markers.length ? ` ${chalk200.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
33686
33791
|
}
|
|
33687
33792
|
function updated(pr) {
|
|
33688
33793
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -33696,35 +33801,35 @@ function reviewLine(pr) {
|
|
|
33696
33801
|
function checkLines(pr) {
|
|
33697
33802
|
const lines2 = [];
|
|
33698
33803
|
if (pr.checks.failing.length) {
|
|
33699
|
-
lines2.push(
|
|
33804
|
+
lines2.push(chalk200.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
33700
33805
|
}
|
|
33701
33806
|
if (pr.checks.pending.length) {
|
|
33702
|
-
lines2.push(
|
|
33807
|
+
lines2.push(chalk200.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
33703
33808
|
}
|
|
33704
33809
|
return lines2;
|
|
33705
33810
|
}
|
|
33706
33811
|
function threadsLine(pr) {
|
|
33707
33812
|
if (pr.unresolvedThreads === null) {
|
|
33708
|
-
return
|
|
33813
|
+
return chalk200.dim("unresolved comments: unknown");
|
|
33709
33814
|
}
|
|
33710
33815
|
if (pr.unresolvedThreads === 0) return null;
|
|
33711
|
-
return
|
|
33816
|
+
return chalk200.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
33712
33817
|
}
|
|
33713
33818
|
function mergeableLine(pr) {
|
|
33714
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
33819
|
+
if (pr.mergeable === "CONFLICTING") return chalk200.red("conflicting");
|
|
33715
33820
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
33716
|
-
return
|
|
33821
|
+
return chalk200.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
33717
33822
|
}
|
|
33718
33823
|
function printPrStatus(pr) {
|
|
33719
33824
|
console.log(
|
|
33720
|
-
` ${
|
|
33825
|
+
` ${chalk200.cyan(`#${pr.number}`)} ${pr.title} ${chalk200.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
33721
33826
|
);
|
|
33722
33827
|
const details = [
|
|
33723
33828
|
reviewLine(pr),
|
|
33724
33829
|
...checkLines(pr),
|
|
33725
33830
|
threadsLine(pr),
|
|
33726
33831
|
mergeableLine(pr),
|
|
33727
|
-
|
|
33832
|
+
chalk200.dim(pr.url)
|
|
33728
33833
|
];
|
|
33729
33834
|
for (const detail of details) {
|
|
33730
33835
|
if (detail) console.log(` ${detail}`);
|
|
@@ -33735,17 +33840,17 @@ function printPrStatus(pr) {
|
|
|
33735
33840
|
function printPrsStatus(report) {
|
|
33736
33841
|
for (const repo of report.repos) {
|
|
33737
33842
|
const count10 = repo.pullRequests.length;
|
|
33738
|
-
console.log(`${
|
|
33843
|
+
console.log(`${chalk201.bold(repo.repo)} ${chalk201.dim(`(${count10} open)`)}`);
|
|
33739
33844
|
for (const pr of repo.pullRequests) {
|
|
33740
33845
|
printPrStatus(pr);
|
|
33741
33846
|
}
|
|
33742
|
-
if (count10 === 0) console.log(
|
|
33847
|
+
if (count10 === 0) console.log(chalk201.dim(" no open pull requests"));
|
|
33743
33848
|
console.log();
|
|
33744
33849
|
}
|
|
33745
33850
|
if (report.errors.length === 0) return;
|
|
33746
|
-
console.log(
|
|
33851
|
+
console.log(chalk201.bold("Errors"));
|
|
33747
33852
|
for (const failure of report.errors) {
|
|
33748
|
-
console.log(` ${
|
|
33853
|
+
console.log(` ${chalk201.red(failure.repo)}: ${failure.error}`);
|
|
33749
33854
|
}
|
|
33750
33855
|
console.log();
|
|
33751
33856
|
}
|
|
@@ -33973,10 +34078,10 @@ function registerPrs(program) {
|
|
|
33973
34078
|
}
|
|
33974
34079
|
|
|
33975
34080
|
// src/commands/ravendb/ravendbAuth.ts
|
|
33976
|
-
import
|
|
34081
|
+
import chalk207 from "chalk";
|
|
33977
34082
|
|
|
33978
34083
|
// src/shared/createConnectionAuth.ts
|
|
33979
|
-
import
|
|
34084
|
+
import chalk202 from "chalk";
|
|
33980
34085
|
function listConnections(connections, format3) {
|
|
33981
34086
|
if (connections.length === 0) {
|
|
33982
34087
|
console.log("No connections configured.");
|
|
@@ -33989,7 +34094,7 @@ function listConnections(connections, format3) {
|
|
|
33989
34094
|
function removeConnection(connections, name, save) {
|
|
33990
34095
|
const filtered = connections.filter((c) => c.name !== name);
|
|
33991
34096
|
if (filtered.length === connections.length) {
|
|
33992
|
-
console.error(
|
|
34097
|
+
console.error(chalk202.red(`Connection "${name}" not found.`));
|
|
33993
34098
|
process.exit(1);
|
|
33994
34099
|
}
|
|
33995
34100
|
save(filtered);
|
|
@@ -34035,15 +34140,15 @@ function saveConnections(connections) {
|
|
|
34035
34140
|
}
|
|
34036
34141
|
|
|
34037
34142
|
// src/commands/ravendb/promptConnection.ts
|
|
34038
|
-
import
|
|
34143
|
+
import chalk205 from "chalk";
|
|
34039
34144
|
|
|
34040
34145
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34041
|
-
import
|
|
34146
|
+
import chalk204 from "chalk";
|
|
34042
34147
|
import Enquirer2 from "enquirer";
|
|
34043
34148
|
|
|
34044
34149
|
// src/commands/ravendb/searchItems.ts
|
|
34045
34150
|
import { execSync as execSync48 } from "child_process";
|
|
34046
|
-
import
|
|
34151
|
+
import chalk203 from "chalk";
|
|
34047
34152
|
function opExec(args) {
|
|
34048
34153
|
return execSync48(`op ${args}`, {
|
|
34049
34154
|
encoding: "utf8",
|
|
@@ -34056,7 +34161,7 @@ function searchItems(search2) {
|
|
|
34056
34161
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34057
34162
|
} catch {
|
|
34058
34163
|
console.error(
|
|
34059
|
-
|
|
34164
|
+
chalk203.red(
|
|
34060
34165
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34061
34166
|
)
|
|
34062
34167
|
);
|
|
@@ -34070,7 +34175,7 @@ function getItemFields(itemId2) {
|
|
|
34070
34175
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34071
34176
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34072
34177
|
} catch {
|
|
34073
|
-
console.error(
|
|
34178
|
+
console.error(chalk203.red("Failed to get item details from 1Password."));
|
|
34074
34179
|
process.exit(1);
|
|
34075
34180
|
}
|
|
34076
34181
|
}
|
|
@@ -34089,7 +34194,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34089
34194
|
}).run();
|
|
34090
34195
|
const items2 = searchItems(search2);
|
|
34091
34196
|
if (items2.length === 0) {
|
|
34092
|
-
console.error(
|
|
34197
|
+
console.error(chalk204.red(`No items found matching "${search2}".`));
|
|
34093
34198
|
process.exit(1);
|
|
34094
34199
|
}
|
|
34095
34200
|
const itemId2 = await selectOne(
|
|
@@ -34098,7 +34203,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34098
34203
|
);
|
|
34099
34204
|
const fields = getItemFields(itemId2);
|
|
34100
34205
|
if (fields.length === 0) {
|
|
34101
|
-
console.error(
|
|
34206
|
+
console.error(chalk204.red("No fields with references found on this item."));
|
|
34102
34207
|
process.exit(1);
|
|
34103
34208
|
}
|
|
34104
34209
|
const ref = await selectOne(
|
|
@@ -34112,7 +34217,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34112
34217
|
async function promptConnection(existingNames) {
|
|
34113
34218
|
const name = await promptInput("name", "Connection name:");
|
|
34114
34219
|
if (existingNames.includes(name)) {
|
|
34115
|
-
console.error(
|
|
34220
|
+
console.error(chalk205.red(`Connection "${name}" already exists.`));
|
|
34116
34221
|
process.exit(1);
|
|
34117
34222
|
}
|
|
34118
34223
|
const url = await promptInput(
|
|
@@ -34121,22 +34226,22 @@ async function promptConnection(existingNames) {
|
|
|
34121
34226
|
);
|
|
34122
34227
|
const database = await promptInput("database", "Database name:");
|
|
34123
34228
|
if (!name || !url || !database) {
|
|
34124
|
-
console.error(
|
|
34229
|
+
console.error(chalk205.red("All fields are required."));
|
|
34125
34230
|
process.exit(1);
|
|
34126
34231
|
}
|
|
34127
34232
|
const apiKeyRef = await selectOpSecret();
|
|
34128
|
-
console.log(
|
|
34233
|
+
console.log(chalk205.dim(`Using: ${apiKeyRef}`));
|
|
34129
34234
|
return { name, url, database, apiKeyRef };
|
|
34130
34235
|
}
|
|
34131
34236
|
|
|
34132
34237
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
34133
|
-
import
|
|
34238
|
+
import chalk206 from "chalk";
|
|
34134
34239
|
function ravendbSetConnection(name) {
|
|
34135
34240
|
const raw = loadGlobalConfigRaw();
|
|
34136
34241
|
const ravendb = raw.ravendb ?? {};
|
|
34137
34242
|
const connections = ravendb.connections ?? [];
|
|
34138
34243
|
if (!connections.some((c) => c.name === name)) {
|
|
34139
|
-
console.error(
|
|
34244
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
34140
34245
|
console.error(
|
|
34141
34246
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34142
34247
|
);
|
|
@@ -34152,16 +34257,16 @@ function ravendbSetConnection(name) {
|
|
|
34152
34257
|
var ravendbAuth = createConnectionAuth({
|
|
34153
34258
|
load: loadConnections,
|
|
34154
34259
|
save: saveConnections,
|
|
34155
|
-
format: (c) => `${
|
|
34260
|
+
format: (c) => `${chalk207.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
34156
34261
|
promptNew: promptConnection,
|
|
34157
34262
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
34158
34263
|
});
|
|
34159
34264
|
|
|
34160
34265
|
// src/commands/ravendb/ravendbCollections.ts
|
|
34161
|
-
import
|
|
34266
|
+
import chalk211 from "chalk";
|
|
34162
34267
|
|
|
34163
34268
|
// src/commands/ravendb/ravenFetch.ts
|
|
34164
|
-
import
|
|
34269
|
+
import chalk209 from "chalk";
|
|
34165
34270
|
|
|
34166
34271
|
// src/commands/ravendb/getAccessToken.ts
|
|
34167
34272
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -34198,10 +34303,10 @@ ${errorText}`
|
|
|
34198
34303
|
|
|
34199
34304
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
34200
34305
|
import { execSync as execSync49 } from "child_process";
|
|
34201
|
-
import
|
|
34306
|
+
import chalk208 from "chalk";
|
|
34202
34307
|
function resolveOpSecret(reference) {
|
|
34203
34308
|
if (!reference.startsWith("op://")) {
|
|
34204
|
-
console.error(
|
|
34309
|
+
console.error(chalk208.red(`Invalid secret reference: must start with op://`));
|
|
34205
34310
|
process.exit(1);
|
|
34206
34311
|
}
|
|
34207
34312
|
try {
|
|
@@ -34211,7 +34316,7 @@ function resolveOpSecret(reference) {
|
|
|
34211
34316
|
}).trim();
|
|
34212
34317
|
} catch {
|
|
34213
34318
|
console.error(
|
|
34214
|
-
|
|
34319
|
+
chalk208.red(
|
|
34215
34320
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
34216
34321
|
)
|
|
34217
34322
|
);
|
|
@@ -34238,7 +34343,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34238
34343
|
if (!response.ok) {
|
|
34239
34344
|
const body = await response.text();
|
|
34240
34345
|
console.error(
|
|
34241
|
-
|
|
34346
|
+
chalk209.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
34242
34347
|
);
|
|
34243
34348
|
console.error(body.substring(0, 500));
|
|
34244
34349
|
process.exit(1);
|
|
@@ -34247,7 +34352,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34247
34352
|
}
|
|
34248
34353
|
|
|
34249
34354
|
// src/commands/ravendb/resolveConnection.ts
|
|
34250
|
-
import
|
|
34355
|
+
import chalk210 from "chalk";
|
|
34251
34356
|
function loadRavendb() {
|
|
34252
34357
|
const raw = loadGlobalConfigRaw();
|
|
34253
34358
|
const ravendb = raw.ravendb;
|
|
@@ -34261,7 +34366,7 @@ function resolveConnection(name) {
|
|
|
34261
34366
|
const connectionName = name ?? defaultConnection;
|
|
34262
34367
|
if (!connectionName) {
|
|
34263
34368
|
console.error(
|
|
34264
|
-
|
|
34369
|
+
chalk210.red(
|
|
34265
34370
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
34266
34371
|
)
|
|
34267
34372
|
);
|
|
@@ -34269,7 +34374,7 @@ function resolveConnection(name) {
|
|
|
34269
34374
|
}
|
|
34270
34375
|
const connection = connections.find((c) => c.name === connectionName);
|
|
34271
34376
|
if (!connection) {
|
|
34272
|
-
console.error(
|
|
34377
|
+
console.error(chalk210.red(`Connection "${connectionName}" not found.`));
|
|
34273
34378
|
console.error(
|
|
34274
34379
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34275
34380
|
);
|
|
@@ -34300,15 +34405,15 @@ async function ravendbCollections(connectionName) {
|
|
|
34300
34405
|
return;
|
|
34301
34406
|
}
|
|
34302
34407
|
for (const c of collections) {
|
|
34303
|
-
console.log(`${
|
|
34408
|
+
console.log(`${chalk211.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
34304
34409
|
}
|
|
34305
34410
|
}
|
|
34306
34411
|
|
|
34307
34412
|
// src/commands/ravendb/ravendbQuery.ts
|
|
34308
|
-
import
|
|
34413
|
+
import chalk213 from "chalk";
|
|
34309
34414
|
|
|
34310
34415
|
// src/commands/ravendb/fetchAllPages.ts
|
|
34311
|
-
import
|
|
34416
|
+
import chalk212 from "chalk";
|
|
34312
34417
|
|
|
34313
34418
|
// src/commands/ravendb/buildQueryPath.ts
|
|
34314
34419
|
function buildQueryPath(opts) {
|
|
@@ -34346,7 +34451,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34346
34451
|
allResults.push(...results);
|
|
34347
34452
|
start2 += results.length;
|
|
34348
34453
|
process.stderr.write(
|
|
34349
|
-
`\r${
|
|
34454
|
+
`\r${chalk212.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
34350
34455
|
);
|
|
34351
34456
|
if (start2 >= totalResults) break;
|
|
34352
34457
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -34361,7 +34466,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34361
34466
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
34362
34467
|
const resolved = resolveArgs(connectionName, collection);
|
|
34363
34468
|
if (!resolved.collection && !options2.query) {
|
|
34364
|
-
console.error(
|
|
34469
|
+
console.error(chalk213.red("Provide a collection name or --query filter."));
|
|
34365
34470
|
process.exit(1);
|
|
34366
34471
|
}
|
|
34367
34472
|
const { collection: col } = resolved;
|
|
@@ -34396,7 +34501,7 @@ function registerRavendb(program) {
|
|
|
34396
34501
|
}
|
|
34397
34502
|
|
|
34398
34503
|
// src/commands/releases/releasesConfigure.ts
|
|
34399
|
-
import
|
|
34504
|
+
import chalk215 from "chalk";
|
|
34400
34505
|
|
|
34401
34506
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
34402
34507
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -34467,26 +34572,26 @@ function readStreamsInput(source) {
|
|
|
34467
34572
|
}
|
|
34468
34573
|
|
|
34469
34574
|
// src/commands/releases/reportDerivedStreams.ts
|
|
34470
|
-
import
|
|
34575
|
+
import chalk214 from "chalk";
|
|
34471
34576
|
function printDerived(stream) {
|
|
34472
34577
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
34473
34578
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
34474
34579
|
console.log(
|
|
34475
|
-
`${
|
|
34580
|
+
`${chalk214.bold(stream.name)} ${chalk214.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
34476
34581
|
);
|
|
34477
34582
|
console.log(
|
|
34478
|
-
` environments: ${environments.join(", ") ||
|
|
34583
|
+
` environments: ${environments.join(", ") || chalk214.dim("none")}`
|
|
34479
34584
|
);
|
|
34480
34585
|
if (steps.length > 0)
|
|
34481
34586
|
console.log(
|
|
34482
34587
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
34483
34588
|
);
|
|
34484
34589
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
34485
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
34590
|
+
console.log(` edges: ${edges.join(", ") || chalk214.dim("none")}`);
|
|
34486
34591
|
}
|
|
34487
34592
|
function reportDerivedStreams(streams, target) {
|
|
34488
34593
|
for (const stream of streams) printDerived(stream);
|
|
34489
|
-
console.log(
|
|
34594
|
+
console.log(chalk214.dim(`Written to ${target}`));
|
|
34490
34595
|
}
|
|
34491
34596
|
|
|
34492
34597
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -34577,8 +34682,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
34577
34682
|
|
|
34578
34683
|
// src/commands/releases/releasesConfigure.ts
|
|
34579
34684
|
function fail7(message3, details = []) {
|
|
34580
|
-
console.error(
|
|
34581
|
-
for (const detail of details) console.error(
|
|
34685
|
+
console.error(chalk215.red(message3));
|
|
34686
|
+
for (const detail of details) console.error(chalk215.red(` ${detail}`));
|
|
34582
34687
|
process.exitCode = 1;
|
|
34583
34688
|
}
|
|
34584
34689
|
function reportWritten(incoming, target) {
|
|
@@ -34611,23 +34716,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
34611
34716
|
}
|
|
34612
34717
|
|
|
34613
34718
|
// src/commands/releases/releasesList.ts
|
|
34614
|
-
import
|
|
34719
|
+
import chalk216 from "chalk";
|
|
34615
34720
|
function describeNode(node) {
|
|
34616
34721
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
34617
34722
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
34618
34723
|
}
|
|
34619
34724
|
function printStream(stream) {
|
|
34620
|
-
console.log(`${
|
|
34621
|
-
console.log(
|
|
34725
|
+
console.log(`${chalk216.bold(stream.name)} ${chalk216.dim(stream.repo)}`);
|
|
34726
|
+
console.log(chalk216.dim(` workflow: ${stream.workflow}`));
|
|
34622
34727
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
34623
34728
|
for (const [from, to] of stream.edges)
|
|
34624
|
-
console.log(
|
|
34729
|
+
console.log(chalk216.dim(` ${from} \u2192 ${to}`));
|
|
34625
34730
|
}
|
|
34626
34731
|
function releasesList() {
|
|
34627
34732
|
const streams = loadConfig().releases?.streams ?? [];
|
|
34628
34733
|
if (streams.length === 0) {
|
|
34629
34734
|
console.log(
|
|
34630
|
-
|
|
34735
|
+
chalk216.dim("No release streams configured under releases.streams.")
|
|
34631
34736
|
);
|
|
34632
34737
|
return;
|
|
34633
34738
|
}
|
|
@@ -34675,7 +34780,7 @@ function coverage() {
|
|
|
34675
34780
|
|
|
34676
34781
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34677
34782
|
import path45 from "path";
|
|
34678
|
-
import
|
|
34783
|
+
import chalk218 from "chalk";
|
|
34679
34784
|
|
|
34680
34785
|
// src/commands/lint/lint/checkFileNames.ts
|
|
34681
34786
|
import fs23 from "fs";
|
|
@@ -34755,7 +34860,7 @@ function checkFileNames() {
|
|
|
34755
34860
|
}
|
|
34756
34861
|
|
|
34757
34862
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
34758
|
-
import
|
|
34863
|
+
import chalk217 from "chalk";
|
|
34759
34864
|
|
|
34760
34865
|
// src/commands/lint/lint/applyMoves.ts
|
|
34761
34866
|
import fs24 from "fs";
|
|
@@ -34840,25 +34945,25 @@ function fixFileNameViolations(moves) {
|
|
|
34840
34945
|
const start2 = performance.now();
|
|
34841
34946
|
const project = createLintProject();
|
|
34842
34947
|
const cwd = process.cwd();
|
|
34843
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
34948
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk217.green(line)));
|
|
34844
34949
|
const ms = (performance.now() - start2).toFixed(0);
|
|
34845
|
-
console.log(
|
|
34950
|
+
console.log(chalk217.dim(` Done in ${ms}ms`));
|
|
34846
34951
|
}
|
|
34847
34952
|
|
|
34848
34953
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34849
34954
|
function reportViolations(violations) {
|
|
34850
|
-
console.error(
|
|
34955
|
+
console.error(chalk218.red("\nFile name check failed:\n"));
|
|
34851
34956
|
console.error(
|
|
34852
|
-
|
|
34957
|
+
chalk218.red(
|
|
34853
34958
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
34854
34959
|
)
|
|
34855
34960
|
);
|
|
34856
34961
|
for (const violation of violations) {
|
|
34857
|
-
console.error(
|
|
34858
|
-
console.error(
|
|
34962
|
+
console.error(chalk218.red(` ${violation.filePath}`));
|
|
34963
|
+
console.error(chalk218.gray(` Rename to: ${violation.suggestedName}
|
|
34859
34964
|
`));
|
|
34860
34965
|
}
|
|
34861
|
-
console.error(
|
|
34966
|
+
console.error(chalk218.dim(" Run with -f to auto-fix.\n"));
|
|
34862
34967
|
}
|
|
34863
34968
|
function runFileNameCheck(fix = false) {
|
|
34864
34969
|
const violations = checkFileNames();
|
|
@@ -34887,17 +34992,17 @@ function runFileNameCheck(fix = false) {
|
|
|
34887
34992
|
import fs26 from "fs";
|
|
34888
34993
|
|
|
34889
34994
|
// src/commands/lint/shared.ts
|
|
34890
|
-
import
|
|
34995
|
+
import chalk219 from "chalk";
|
|
34891
34996
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
34892
34997
|
if (violations.length > 0) {
|
|
34893
|
-
console.error(
|
|
34998
|
+
console.error(chalk219.red(`
|
|
34894
34999
|
${checkName2} failed:
|
|
34895
35000
|
`));
|
|
34896
|
-
console.error(
|
|
35001
|
+
console.error(chalk219.red(` ${errorMessage3}
|
|
34897
35002
|
`));
|
|
34898
35003
|
for (const violation of violations) {
|
|
34899
|
-
console.error(
|
|
34900
|
-
console.error(
|
|
35004
|
+
console.error(chalk219.red(` ${violation.filePath}:${violation.line}`));
|
|
35005
|
+
console.error(chalk219.gray(` ${violation.content}
|
|
34901
35006
|
`));
|
|
34902
35007
|
}
|
|
34903
35008
|
return false;
|
|
@@ -35122,7 +35227,7 @@ import { execSync as execSync51 } from "child_process";
|
|
|
35122
35227
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
35123
35228
|
import { tmpdir as tmpdir7 } from "os";
|
|
35124
35229
|
import { join as join83, resolve as resolve25 } from "path";
|
|
35125
|
-
import
|
|
35230
|
+
import chalk220 from "chalk";
|
|
35126
35231
|
|
|
35127
35232
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
35128
35233
|
var captureWindowPs1 = `
|
|
@@ -35273,35 +35378,22 @@ function screenshot(processName) {
|
|
|
35273
35378
|
const config = loadConfig();
|
|
35274
35379
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
35275
35380
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
35276
|
-
console.log(
|
|
35381
|
+
console.log(chalk220.gray(`Capturing window for process "${processName}" ...`));
|
|
35277
35382
|
try {
|
|
35278
35383
|
runPowerShellScript(processName, outputPath);
|
|
35279
|
-
console.log(
|
|
35384
|
+
console.log(chalk220.green(`Screenshot saved: ${outputPath}`));
|
|
35280
35385
|
} catch (error) {
|
|
35281
35386
|
const msg = error instanceof Error ? error.message : String(error);
|
|
35282
|
-
console.error(
|
|
35387
|
+
console.error(chalk220.red(`Failed to capture screenshot: ${msg}`));
|
|
35283
35388
|
process.exit(1);
|
|
35284
35389
|
}
|
|
35285
35390
|
}
|
|
35286
35391
|
|
|
35287
35392
|
// src/commands/statusLine.ts
|
|
35288
|
-
import
|
|
35289
|
-
|
|
35290
|
-
// src/shared/contextLevel.ts
|
|
35291
|
-
var THRESHOLDS = {
|
|
35292
|
-
claude: { red: 30, yellow: 20 },
|
|
35293
|
-
codex: { red: 75, yellow: 50 },
|
|
35294
|
-
pi: { red: 30, yellow: 20 }
|
|
35295
|
-
};
|
|
35296
|
-
function contextLevel(pct, harness) {
|
|
35297
|
-
const { red, yellow } = THRESHOLDS[resolveHarness(harness)];
|
|
35298
|
-
if (pct >= red) return "red";
|
|
35299
|
-
if (pct >= yellow) return "yellow";
|
|
35300
|
-
return "dim";
|
|
35301
|
-
}
|
|
35393
|
+
import chalk223 from "chalk";
|
|
35302
35394
|
|
|
35303
35395
|
// src/commands/buildLimitsSegment.ts
|
|
35304
|
-
import
|
|
35396
|
+
import chalk221 from "chalk";
|
|
35305
35397
|
|
|
35306
35398
|
// src/shared/rateLimitLevel.ts
|
|
35307
35399
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35339,9 +35431,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35339
35431
|
|
|
35340
35432
|
// src/commands/buildLimitsSegment.ts
|
|
35341
35433
|
var LEVEL_COLOR = {
|
|
35342
|
-
ok:
|
|
35343
|
-
warn:
|
|
35344
|
-
over:
|
|
35434
|
+
ok: chalk221.green,
|
|
35435
|
+
warn: chalk221.yellow,
|
|
35436
|
+
over: chalk221.red
|
|
35345
35437
|
};
|
|
35346
35438
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35347
35439
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -35436,22 +35528,40 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
35436
35528
|
}
|
|
35437
35529
|
}
|
|
35438
35530
|
|
|
35439
|
-
// src/commands/
|
|
35440
|
-
|
|
35441
|
-
|
|
35442
|
-
|
|
35531
|
+
// src/commands/colorizePercent.ts
|
|
35532
|
+
import chalk222 from "chalk";
|
|
35533
|
+
|
|
35534
|
+
// src/shared/contextLevel.ts
|
|
35535
|
+
var THRESHOLDS = {
|
|
35536
|
+
claude: { red: 30, yellow: 20 },
|
|
35537
|
+
codex: { red: 75, yellow: 50 },
|
|
35538
|
+
pi: { red: 30, yellow: 20 }
|
|
35539
|
+
};
|
|
35540
|
+
function contextLevel(pct, harness) {
|
|
35541
|
+
const { red, yellow } = THRESHOLDS[resolveHarness(harness)];
|
|
35542
|
+
if (pct >= red) return "red";
|
|
35543
|
+
if (pct >= yellow) return "yellow";
|
|
35544
|
+
return "dim";
|
|
35443
35545
|
}
|
|
35546
|
+
|
|
35547
|
+
// src/commands/colorizePercent.ts
|
|
35444
35548
|
function colorizePercent(pct) {
|
|
35445
35549
|
const label = `${Math.round(pct)}%`;
|
|
35446
35550
|
switch (contextLevel(pct)) {
|
|
35447
35551
|
case "red":
|
|
35448
|
-
return
|
|
35552
|
+
return chalk222.red(label);
|
|
35449
35553
|
case "yellow":
|
|
35450
|
-
return
|
|
35554
|
+
return chalk222.yellow(label);
|
|
35451
35555
|
default:
|
|
35452
35556
|
return label;
|
|
35453
35557
|
}
|
|
35454
35558
|
}
|
|
35559
|
+
|
|
35560
|
+
// src/commands/statusLine.ts
|
|
35561
|
+
chalk223.level = 3;
|
|
35562
|
+
function formatNumber(num) {
|
|
35563
|
+
return num.toLocaleString("en-US");
|
|
35564
|
+
}
|
|
35455
35565
|
async function statusLine() {
|
|
35456
35566
|
const inputData = await readStdin();
|
|
35457
35567
|
const data = JSON.parse(inputData);
|
|
@@ -35460,9 +35570,10 @@ async function statusLine() {
|
|
|
35460
35570
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
35461
35571
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
35462
35572
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
35463
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
35573
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk223.cyan(branch2)} | ` : "";
|
|
35574
|
+
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
35464
35575
|
console.log(
|
|
35465
|
-
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${
|
|
35576
|
+
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
35466
35577
|
);
|
|
35467
35578
|
await relayRateLimits(data.rate_limits);
|
|
35468
35579
|
await relayUsage(
|
|
@@ -35567,7 +35678,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
35567
35678
|
import * as path48 from "path";
|
|
35568
35679
|
|
|
35569
35680
|
// src/commands/refactor/logViolations.ts
|
|
35570
|
-
import
|
|
35681
|
+
import chalk224 from "chalk";
|
|
35571
35682
|
var DEFAULT_MAX_LINES2 = 100;
|
|
35572
35683
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
35573
35684
|
if (violations.length === 0) {
|
|
@@ -35576,43 +35687,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
35576
35687
|
}
|
|
35577
35688
|
return;
|
|
35578
35689
|
}
|
|
35579
|
-
console.error(
|
|
35690
|
+
console.error(chalk224.red(`
|
|
35580
35691
|
Refactor check failed:
|
|
35581
35692
|
`));
|
|
35582
|
-
console.error(
|
|
35693
|
+
console.error(chalk224.red(` The following files exceed ${maxLines} lines:
|
|
35583
35694
|
`));
|
|
35584
35695
|
for (const violation of violations) {
|
|
35585
|
-
console.error(
|
|
35696
|
+
console.error(chalk224.red(` ${violation.file} (${violation.lines} lines)`));
|
|
35586
35697
|
}
|
|
35587
35698
|
console.error(
|
|
35588
|
-
|
|
35699
|
+
chalk224.yellow(
|
|
35589
35700
|
`
|
|
35590
35701
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
35591
35702
|
way to refactor it, ignore it with:
|
|
35592
35703
|
`
|
|
35593
35704
|
)
|
|
35594
35705
|
);
|
|
35595
|
-
console.error(
|
|
35706
|
+
console.error(chalk224.gray(` assist refactor ignore <file>
|
|
35596
35707
|
`));
|
|
35597
35708
|
if (process.env.CLAUDECODE) {
|
|
35598
|
-
console.error(
|
|
35709
|
+
console.error(chalk224.cyan(`
|
|
35599
35710
|
## Extracting Code to New Files
|
|
35600
35711
|
`));
|
|
35601
35712
|
console.error(
|
|
35602
|
-
|
|
35713
|
+
chalk224.cyan(
|
|
35603
35714
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
35604
35715
|
`
|
|
35605
35716
|
)
|
|
35606
35717
|
);
|
|
35607
35718
|
console.error(
|
|
35608
|
-
|
|
35719
|
+
chalk224.cyan(
|
|
35609
35720
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
35610
35721
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
35611
35722
|
`
|
|
35612
35723
|
)
|
|
35613
35724
|
);
|
|
35614
35725
|
console.error(
|
|
35615
|
-
|
|
35726
|
+
chalk224.cyan(
|
|
35616
35727
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
35617
35728
|
domains, move it to a common/shared folder.
|
|
35618
35729
|
`
|
|
@@ -35768,7 +35879,7 @@ async function check(pattern2, options2) {
|
|
|
35768
35879
|
|
|
35769
35880
|
// src/commands/refactor/extract.ts
|
|
35770
35881
|
import path56 from "path";
|
|
35771
|
-
import
|
|
35882
|
+
import chalk227 from "chalk";
|
|
35772
35883
|
|
|
35773
35884
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
35774
35885
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -36376,23 +36487,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
36376
36487
|
|
|
36377
36488
|
// src/commands/refactor/extract/displayPlan.ts
|
|
36378
36489
|
import path52 from "path";
|
|
36379
|
-
import
|
|
36490
|
+
import chalk225 from "chalk";
|
|
36380
36491
|
function section(title) {
|
|
36381
36492
|
return `
|
|
36382
|
-
${
|
|
36493
|
+
${chalk225.cyan(title)}`;
|
|
36383
36494
|
}
|
|
36384
36495
|
function displayImporters(plan2, cwd) {
|
|
36385
36496
|
if (plan2.importersToUpdate.length === 0) return;
|
|
36386
36497
|
console.log(section("Update importers:"));
|
|
36387
36498
|
for (const imp of plan2.importersToUpdate) {
|
|
36388
36499
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
36389
|
-
console.log(` ${
|
|
36500
|
+
console.log(` ${chalk225.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
36390
36501
|
}
|
|
36391
36502
|
}
|
|
36392
36503
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
36393
|
-
console.log(
|
|
36504
|
+
console.log(chalk225.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
36394
36505
|
`));
|
|
36395
|
-
console.log(` ${
|
|
36506
|
+
console.log(` ${chalk225.cyan("Functions to move:")}`);
|
|
36396
36507
|
for (const name of plan2.extractedNames) {
|
|
36397
36508
|
console.log(` ${name}`);
|
|
36398
36509
|
}
|
|
@@ -36426,7 +36537,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
36426
36537
|
|
|
36427
36538
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
36428
36539
|
import path55 from "path";
|
|
36429
|
-
import
|
|
36540
|
+
import chalk226 from "chalk";
|
|
36430
36541
|
import { Project as Project4 } from "ts-morph";
|
|
36431
36542
|
|
|
36432
36543
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -36518,7 +36629,7 @@ function loadProjectFile(file) {
|
|
|
36518
36629
|
});
|
|
36519
36630
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
36520
36631
|
if (!sourceFile) {
|
|
36521
|
-
console.log(
|
|
36632
|
+
console.log(chalk226.red(`File not found in project: ${file}`));
|
|
36522
36633
|
process.exit(1);
|
|
36523
36634
|
}
|
|
36524
36635
|
return { project, sourceFile };
|
|
@@ -36541,19 +36652,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
36541
36652
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
36542
36653
|
if (options2.apply) {
|
|
36543
36654
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
36544
|
-
console.log(
|
|
36655
|
+
console.log(chalk227.green("\nExtraction complete"));
|
|
36545
36656
|
} else {
|
|
36546
|
-
console.log(
|
|
36657
|
+
console.log(chalk227.dim("\nDry run. Use --apply to execute."));
|
|
36547
36658
|
}
|
|
36548
36659
|
}
|
|
36549
36660
|
|
|
36550
36661
|
// src/commands/refactor/ignore.ts
|
|
36551
36662
|
import fs33 from "fs";
|
|
36552
|
-
import
|
|
36663
|
+
import chalk228 from "chalk";
|
|
36553
36664
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
36554
36665
|
function ignore2(file) {
|
|
36555
36666
|
if (!fs33.existsSync(file)) {
|
|
36556
|
-
console.error(
|
|
36667
|
+
console.error(chalk228.red(`Error: File does not exist: ${file}`));
|
|
36557
36668
|
process.exit(1);
|
|
36558
36669
|
}
|
|
36559
36670
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -36569,7 +36680,7 @@ function ignore2(file) {
|
|
|
36569
36680
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
36570
36681
|
}
|
|
36571
36682
|
console.log(
|
|
36572
|
-
|
|
36683
|
+
chalk228.green(
|
|
36573
36684
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
36574
36685
|
)
|
|
36575
36686
|
);
|
|
@@ -36578,12 +36689,12 @@ function ignore2(file) {
|
|
|
36578
36689
|
// src/commands/refactor/rename.ts
|
|
36579
36690
|
import fs36 from "fs";
|
|
36580
36691
|
import path62 from "path";
|
|
36581
|
-
import
|
|
36692
|
+
import chalk231 from "chalk";
|
|
36582
36693
|
|
|
36583
36694
|
// src/commands/refactor/rename/applyRename.ts
|
|
36584
36695
|
import fs35 from "fs";
|
|
36585
36696
|
import path58 from "path";
|
|
36586
|
-
import
|
|
36697
|
+
import chalk229 from "chalk";
|
|
36587
36698
|
|
|
36588
36699
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
36589
36700
|
import path57 from "path";
|
|
@@ -36689,13 +36800,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
36689
36800
|
const updatedContents = applyRewrites(rewrites);
|
|
36690
36801
|
for (const [file, content] of updatedContents) {
|
|
36691
36802
|
fs35.writeFileSync(file, content, "utf8");
|
|
36692
|
-
console.log(
|
|
36803
|
+
console.log(chalk229.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
36693
36804
|
}
|
|
36694
36805
|
const destDir = path58.dirname(destPath);
|
|
36695
36806
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
36696
36807
|
fs35.renameSync(sourcePath, destPath);
|
|
36697
36808
|
console.log(
|
|
36698
|
-
|
|
36809
|
+
chalk229.white(
|
|
36699
36810
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
36700
36811
|
)
|
|
36701
36812
|
);
|
|
@@ -36845,16 +36956,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
36845
36956
|
|
|
36846
36957
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
36847
36958
|
import path61 from "path";
|
|
36848
|
-
import
|
|
36959
|
+
import chalk230 from "chalk";
|
|
36849
36960
|
function printRenamePreview(rewrites, cwd) {
|
|
36850
36961
|
for (const rewrite of rewrites) {
|
|
36851
36962
|
console.log(
|
|
36852
|
-
|
|
36963
|
+
chalk230.dim(
|
|
36853
36964
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
36854
36965
|
)
|
|
36855
36966
|
);
|
|
36856
36967
|
}
|
|
36857
|
-
console.log(
|
|
36968
|
+
console.log(chalk230.dim("Dry run. Use --apply to execute."));
|
|
36858
36969
|
}
|
|
36859
36970
|
|
|
36860
36971
|
// src/commands/refactor/rename.ts
|
|
@@ -36865,20 +36976,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36865
36976
|
const relSource = path62.relative(cwd, sourcePath);
|
|
36866
36977
|
const relDest = path62.relative(cwd, destPath);
|
|
36867
36978
|
if (!fs36.existsSync(sourcePath)) {
|
|
36868
|
-
console.log(
|
|
36979
|
+
console.log(chalk231.red(`File not found: ${source}`));
|
|
36869
36980
|
process.exit(1);
|
|
36870
36981
|
}
|
|
36871
36982
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
36872
|
-
console.log(
|
|
36983
|
+
console.log(chalk231.red(`Destination already exists: ${destination}`));
|
|
36873
36984
|
process.exit(1);
|
|
36874
36985
|
}
|
|
36875
|
-
console.log(
|
|
36876
|
-
console.log(
|
|
36877
|
-
console.log(
|
|
36986
|
+
console.log(chalk231.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
36987
|
+
console.log(chalk231.dim("Loading project..."));
|
|
36988
|
+
console.log(chalk231.dim("Scanning imports across the project..."));
|
|
36878
36989
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
36879
36990
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
36880
36991
|
console.log(
|
|
36881
|
-
|
|
36992
|
+
chalk231.dim(
|
|
36882
36993
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
36883
36994
|
)
|
|
36884
36995
|
);
|
|
@@ -36887,11 +36998,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36887
36998
|
return;
|
|
36888
36999
|
}
|
|
36889
37000
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
36890
|
-
console.log(
|
|
37001
|
+
console.log(chalk231.green("Done"));
|
|
36891
37002
|
}
|
|
36892
37003
|
|
|
36893
37004
|
// src/commands/refactor/renameSymbol.ts
|
|
36894
|
-
import
|
|
37005
|
+
import chalk232 from "chalk";
|
|
36895
37006
|
|
|
36896
37007
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
36897
37008
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -36937,34 +37048,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
36937
37048
|
const { project, sourceFile } = loadProjectFile(file);
|
|
36938
37049
|
const symbol = findSymbol(sourceFile, oldName);
|
|
36939
37050
|
if (!symbol) {
|
|
36940
|
-
console.log(
|
|
37051
|
+
console.log(chalk232.red(`Symbol "${oldName}" not found in ${file}`));
|
|
36941
37052
|
process.exit(1);
|
|
36942
37053
|
}
|
|
36943
37054
|
const grouped = groupReferences(symbol, cwd);
|
|
36944
37055
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
36945
37056
|
console.log(
|
|
36946
|
-
|
|
37057
|
+
chalk232.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
36947
37058
|
`)
|
|
36948
37059
|
);
|
|
36949
37060
|
for (const [refFile, lines2] of grouped) {
|
|
36950
37061
|
console.log(
|
|
36951
|
-
` ${
|
|
37062
|
+
` ${chalk232.dim(refFile)}: lines ${chalk232.cyan(lines2.join(", "))}`
|
|
36952
37063
|
);
|
|
36953
37064
|
}
|
|
36954
37065
|
if (options2.apply) {
|
|
36955
37066
|
symbol.rename(newName);
|
|
36956
37067
|
await project.save();
|
|
36957
|
-
console.log(
|
|
37068
|
+
console.log(chalk232.green(`
|
|
36958
37069
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
36959
37070
|
} else {
|
|
36960
|
-
console.log(
|
|
37071
|
+
console.log(chalk232.dim("\nDry run. Use --apply to execute."));
|
|
36961
37072
|
}
|
|
36962
37073
|
}
|
|
36963
37074
|
|
|
36964
37075
|
// src/commands/refactor/restructure.ts
|
|
36965
37076
|
import fs38 from "fs";
|
|
36966
37077
|
import path83 from "path";
|
|
36967
|
-
import
|
|
37078
|
+
import chalk242 from "chalk";
|
|
36968
37079
|
|
|
36969
37080
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
36970
37081
|
import path73 from "path";
|
|
@@ -37301,7 +37412,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
37301
37412
|
}
|
|
37302
37413
|
|
|
37303
37414
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
37304
|
-
import
|
|
37415
|
+
import chalk237 from "chalk";
|
|
37305
37416
|
|
|
37306
37417
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
37307
37418
|
import path74 from "path";
|
|
@@ -37312,13 +37423,13 @@ function applyCommand(scopeRoot) {
|
|
|
37312
37423
|
|
|
37313
37424
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
37314
37425
|
import path75 from "path";
|
|
37315
|
-
import
|
|
37426
|
+
import chalk233 from "chalk";
|
|
37316
37427
|
var shownMoves = 20;
|
|
37317
37428
|
function displayDrift(plan2, listMoves) {
|
|
37318
37429
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
37319
37430
|
if (plan2.moves.length > 0) {
|
|
37320
37431
|
console.log(
|
|
37321
|
-
|
|
37432
|
+
chalk233.red(
|
|
37322
37433
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
37323
37434
|
)
|
|
37324
37435
|
);
|
|
@@ -37326,17 +37437,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
37326
37437
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
37327
37438
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
37328
37439
|
if (plan2.moves.length > shownMoves)
|
|
37329
|
-
console.log(
|
|
37440
|
+
console.log(chalk233.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
37330
37441
|
}
|
|
37331
37442
|
}
|
|
37332
|
-
for (const error of plan2.errors) console.log(
|
|
37443
|
+
for (const error of plan2.errors) console.log(chalk233.red(error));
|
|
37333
37444
|
}
|
|
37334
37445
|
|
|
37335
37446
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
37336
|
-
import
|
|
37447
|
+
import chalk236 from "chalk";
|
|
37337
37448
|
|
|
37338
37449
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
37339
|
-
import
|
|
37450
|
+
import chalk234 from "chalk";
|
|
37340
37451
|
var shownChains = 10;
|
|
37341
37452
|
function formatChain(chain2) {
|
|
37342
37453
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -37346,28 +37457,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
37346
37457
|
if (chains.length === 0) return;
|
|
37347
37458
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
37348
37459
|
console.log(
|
|
37349
|
-
|
|
37460
|
+
chalk234.red(
|
|
37350
37461
|
`
|
|
37351
37462
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
37352
37463
|
)
|
|
37353
37464
|
);
|
|
37354
37465
|
console.log(
|
|
37355
|
-
|
|
37466
|
+
chalk234.bold(
|
|
37356
37467
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
37357
37468
|
)
|
|
37358
37469
|
);
|
|
37359
37470
|
for (const chain2 of chains.slice(0, shownChains))
|
|
37360
37471
|
console.log(formatChain(chain2));
|
|
37361
37472
|
if (chains.length > shownChains)
|
|
37362
|
-
console.log(
|
|
37473
|
+
console.log(chalk234.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
37363
37474
|
}
|
|
37364
37475
|
|
|
37365
37476
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
37366
|
-
import
|
|
37477
|
+
import chalk235 from "chalk";
|
|
37367
37478
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
37368
37479
|
if (longPaths.length === 0) return;
|
|
37369
37480
|
console.log(
|
|
37370
|
-
|
|
37481
|
+
chalk235.red(
|
|
37371
37482
|
`
|
|
37372
37483
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
37373
37484
|
)
|
|
@@ -37395,7 +37506,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
37395
37506
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
37396
37507
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
37397
37508
|
console.log("");
|
|
37398
|
-
for (const line of pinSteps(apply)) console.log(
|
|
37509
|
+
for (const line of pinSteps(apply)) console.log(chalk236.yellow(line));
|
|
37399
37510
|
}
|
|
37400
37511
|
|
|
37401
37512
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -37407,14 +37518,14 @@ function checkPlan(plan2, limits) {
|
|
|
37407
37518
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
37408
37519
|
if (plan2.moves.length > 0) {
|
|
37409
37520
|
console.log(
|
|
37410
|
-
|
|
37521
|
+
chalk237.yellow(
|
|
37411
37522
|
`
|
|
37412
37523
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
37413
37524
|
)
|
|
37414
37525
|
);
|
|
37415
37526
|
process.exit(1);
|
|
37416
37527
|
}
|
|
37417
|
-
console.log(
|
|
37528
|
+
console.log(chalk237.green("Layout matches the restructure plan"));
|
|
37418
37529
|
}
|
|
37419
37530
|
|
|
37420
37531
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -37484,15 +37595,15 @@ function partitionIgnored(files) {
|
|
|
37484
37595
|
}
|
|
37485
37596
|
|
|
37486
37597
|
// src/commands/refactor/restructure/runPlan.ts
|
|
37487
|
-
import
|
|
37598
|
+
import chalk241 from "chalk";
|
|
37488
37599
|
|
|
37489
37600
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37490
|
-
import
|
|
37601
|
+
import chalk239 from "chalk";
|
|
37491
37602
|
|
|
37492
37603
|
// src/commands/refactor/restructure/executePlan.ts
|
|
37493
37604
|
import fs37 from "fs";
|
|
37494
37605
|
import path79 from "path";
|
|
37495
|
-
import
|
|
37606
|
+
import chalk238 from "chalk";
|
|
37496
37607
|
function relPath(file) {
|
|
37497
37608
|
return path79.relative(process.cwd(), file);
|
|
37498
37609
|
}
|
|
@@ -37509,14 +37620,14 @@ function moveFiles(moves) {
|
|
|
37509
37620
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
37510
37621
|
fs37.renameSync(staging, move2.to);
|
|
37511
37622
|
console.log(
|
|
37512
|
-
|
|
37623
|
+
chalk238.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
37513
37624
|
);
|
|
37514
37625
|
}
|
|
37515
37626
|
}
|
|
37516
37627
|
function removeIfEmpty(dir) {
|
|
37517
37628
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
37518
37629
|
fs37.rmdirSync(dir);
|
|
37519
|
-
console.log(
|
|
37630
|
+
console.log(chalk238.dim(` Removed empty directory ${relPath(dir)}`));
|
|
37520
37631
|
return true;
|
|
37521
37632
|
}
|
|
37522
37633
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -37529,7 +37640,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
37529
37640
|
function executePlan(plan2) {
|
|
37530
37641
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
37531
37642
|
fs37.writeFileSync(file, content, "utf8");
|
|
37532
|
-
console.log(
|
|
37643
|
+
console.log(chalk238.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
37533
37644
|
}
|
|
37534
37645
|
moveFiles(plan2.moves);
|
|
37535
37646
|
removeEmptyDirectories(
|
|
@@ -37541,17 +37652,17 @@ function executePlan(plan2) {
|
|
|
37541
37652
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37542
37653
|
function applyPlan(plan2) {
|
|
37543
37654
|
if (plan2.errors.length > 0) {
|
|
37544
|
-
console.log(
|
|
37655
|
+
console.log(chalk239.red("\nResolve the errors above before applying."));
|
|
37545
37656
|
process.exit(1);
|
|
37546
37657
|
}
|
|
37547
|
-
console.log(
|
|
37658
|
+
console.log(chalk239.bold("\nApplying changes..."));
|
|
37548
37659
|
executePlan(plan2);
|
|
37549
|
-
console.log(
|
|
37660
|
+
console.log(chalk239.green("\nRestructuring complete"));
|
|
37550
37661
|
}
|
|
37551
37662
|
|
|
37552
37663
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
37553
37664
|
import path82 from "path";
|
|
37554
|
-
import
|
|
37665
|
+
import chalk240 from "chalk";
|
|
37555
37666
|
|
|
37556
37667
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
37557
37668
|
import path80 from "path";
|
|
@@ -37577,14 +37688,14 @@ function insert(root2, parts) {
|
|
|
37577
37688
|
node = child;
|
|
37578
37689
|
}
|
|
37579
37690
|
}
|
|
37580
|
-
function render(node,
|
|
37691
|
+
function render(node, indent4, lines2) {
|
|
37581
37692
|
const entries = [...node].sort(([a, ca], [b, cb]) => {
|
|
37582
37693
|
const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
|
|
37583
37694
|
return dirFirst || a.localeCompare(b);
|
|
37584
37695
|
});
|
|
37585
37696
|
for (const [name, child] of entries) {
|
|
37586
|
-
lines2.push(`${
|
|
37587
|
-
render(child, `${
|
|
37697
|
+
lines2.push(`${indent4}${name}${child.size > 0 ? "/" : ""}`);
|
|
37698
|
+
render(child, `${indent4} `, lines2);
|
|
37588
37699
|
}
|
|
37589
37700
|
}
|
|
37590
37701
|
function formatTree(files, scopeRoot) {
|
|
@@ -37602,17 +37713,17 @@ function relPath2(filePath) {
|
|
|
37602
37713
|
}
|
|
37603
37714
|
function displayMoves(plan2) {
|
|
37604
37715
|
if (plan2.moves.length === 0) return;
|
|
37605
|
-
console.log(
|
|
37716
|
+
console.log(chalk240.bold("\nFile moves:"));
|
|
37606
37717
|
for (const move2 of plan2.moves) {
|
|
37607
37718
|
console.log(
|
|
37608
|
-
` ${
|
|
37719
|
+
` ${chalk240.red(relPath2(move2.from))} \u2192 ${chalk240.green(relPath2(move2.to))}`
|
|
37609
37720
|
);
|
|
37610
|
-
console.log(
|
|
37721
|
+
console.log(chalk240.dim(` ${move2.reason}`));
|
|
37611
37722
|
}
|
|
37612
37723
|
}
|
|
37613
37724
|
function displayTree(plan2) {
|
|
37614
37725
|
console.log(
|
|
37615
|
-
|
|
37726
|
+
chalk240.bold(`
|
|
37616
37727
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
37617
37728
|
);
|
|
37618
37729
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -37623,15 +37734,15 @@ function displayDepthStats(plan2) {
|
|
|
37623
37734
|
plan2.targets.values(),
|
|
37624
37735
|
plan2.scopeRoot
|
|
37625
37736
|
);
|
|
37626
|
-
console.log(
|
|
37737
|
+
console.log(chalk240.bold(`
|
|
37627
37738
|
Depth (max ${max}):`));
|
|
37628
37739
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
37629
37740
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
37630
37741
|
}
|
|
37631
37742
|
function displayErrors(errors) {
|
|
37632
37743
|
if (errors.length === 0) return;
|
|
37633
|
-
console.log(
|
|
37634
|
-
for (const error of errors) console.log(
|
|
37744
|
+
console.log(chalk240.red("\nErrors:"));
|
|
37745
|
+
for (const error of errors) console.log(chalk240.red(` ${error}`));
|
|
37635
37746
|
}
|
|
37636
37747
|
function displayPlan2(plan2) {
|
|
37637
37748
|
displayMoves(plan2);
|
|
@@ -37640,7 +37751,7 @@ function displayPlan2(plan2) {
|
|
|
37640
37751
|
displayErrors(plan2.errors);
|
|
37641
37752
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
37642
37753
|
console.log(
|
|
37643
|
-
|
|
37754
|
+
chalk240.dim(
|
|
37644
37755
|
`
|
|
37645
37756
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
37646
37757
|
)
|
|
@@ -37652,11 +37763,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
37652
37763
|
displayPlan2(plan2);
|
|
37653
37764
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
37654
37765
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
37655
|
-
console.log(
|
|
37766
|
+
console.log(chalk241.green("No restructuring needed"));
|
|
37656
37767
|
return;
|
|
37657
37768
|
}
|
|
37658
37769
|
if (!apply) {
|
|
37659
|
-
console.log(
|
|
37770
|
+
console.log(chalk241.dim("\nDry run. Use --apply to execute."));
|
|
37660
37771
|
return;
|
|
37661
37772
|
}
|
|
37662
37773
|
applyPlan(plan2);
|
|
@@ -37666,14 +37777,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
37666
37777
|
async function restructure(root2, options2 = {}) {
|
|
37667
37778
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
37668
37779
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
37669
|
-
console.log(
|
|
37780
|
+
console.log(chalk242.red(`Not a directory: ${root2 ?? "src"}`));
|
|
37670
37781
|
process.exit(1);
|
|
37671
37782
|
}
|
|
37672
37783
|
const found = [];
|
|
37673
37784
|
walkSourceFiles(scopeRoot, found);
|
|
37674
37785
|
const { scoped, ignored } = partitionIgnored(found);
|
|
37675
37786
|
if (scoped.length === 0) {
|
|
37676
|
-
console.log(
|
|
37787
|
+
console.log(chalk242.yellow("No files found under root"));
|
|
37677
37788
|
return;
|
|
37678
37789
|
}
|
|
37679
37790
|
const {
|
|
@@ -37744,7 +37855,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
37744
37855
|
}
|
|
37745
37856
|
|
|
37746
37857
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
37747
|
-
import
|
|
37858
|
+
import chalk246 from "chalk";
|
|
37748
37859
|
|
|
37749
37860
|
// src/commands/config/promptConfigScope.ts
|
|
37750
37861
|
import Enquirer3 from "enquirer";
|
|
@@ -37770,7 +37881,7 @@ async function promptConfigScope() {
|
|
|
37770
37881
|
}
|
|
37771
37882
|
|
|
37772
37883
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
37773
|
-
import
|
|
37884
|
+
import chalk243 from "chalk";
|
|
37774
37885
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
37775
37886
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
37776
37887
|
for (; ; ) {
|
|
@@ -37778,7 +37889,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
37778
37889
|
if (answer === "") return void 0;
|
|
37779
37890
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
37780
37891
|
if (coercion.ok) return coercion.value;
|
|
37781
|
-
console.error(
|
|
37892
|
+
console.error(chalk243.red(coercion.error));
|
|
37782
37893
|
}
|
|
37783
37894
|
}
|
|
37784
37895
|
function coerceSupplied(key, supplied) {
|
|
@@ -37858,7 +37969,7 @@ function suggestGlobs(current, proposed) {
|
|
|
37858
37969
|
}
|
|
37859
37970
|
|
|
37860
37971
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
37861
|
-
import
|
|
37972
|
+
import chalk244 from "chalk";
|
|
37862
37973
|
function parseConfigureAnswers(answers) {
|
|
37863
37974
|
const known = Object.values(highLevelConfigKeys);
|
|
37864
37975
|
const parsed = {};
|
|
@@ -37876,13 +37987,13 @@ function answersCoverEveryKey(answers) {
|
|
|
37876
37987
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
37877
37988
|
}
|
|
37878
37989
|
function exitWith(message3) {
|
|
37879
|
-
console.error(
|
|
37990
|
+
console.error(chalk244.red(`Error: ${message3}.`));
|
|
37880
37991
|
process.exit(1);
|
|
37881
37992
|
}
|
|
37882
37993
|
|
|
37883
37994
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
37884
37995
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
37885
|
-
import
|
|
37996
|
+
import chalk245 from "chalk";
|
|
37886
37997
|
|
|
37887
37998
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
37888
37999
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -37976,12 +38087,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
37976
38087
|
const tree = summariseRepoTree(cwd);
|
|
37977
38088
|
if (tree === "") return NOTHING_PROPOSED;
|
|
37978
38089
|
console.log(
|
|
37979
|
-
|
|
38090
|
+
chalk245.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
37980
38091
|
);
|
|
37981
38092
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
37982
38093
|
if (output === void 0) {
|
|
37983
38094
|
console.log(
|
|
37984
|
-
|
|
38095
|
+
chalk245.yellow(
|
|
37985
38096
|
"Claude proposed nothing; answer each key from its current value."
|
|
37986
38097
|
)
|
|
37987
38098
|
);
|
|
@@ -38041,14 +38152,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38041
38152
|
function reportConfigured(result) {
|
|
38042
38153
|
for (const write of result.written)
|
|
38043
38154
|
console.log(
|
|
38044
|
-
|
|
38155
|
+
chalk246.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
38045
38156
|
);
|
|
38046
|
-
for (const key of result.skipped) console.log(
|
|
38047
|
-
console.log(
|
|
38157
|
+
for (const key of result.skipped) console.log(chalk246.dim(`Left ${key} unset`));
|
|
38158
|
+
console.log(chalk246.dim(`Written to ${result.target}`));
|
|
38048
38159
|
}
|
|
38049
38160
|
|
|
38050
38161
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38051
|
-
import
|
|
38162
|
+
import chalk247 from "chalk";
|
|
38052
38163
|
function savedMessage(subject) {
|
|
38053
38164
|
const head = subject.headSha.slice(0, 7);
|
|
38054
38165
|
if (subject.draft)
|
|
@@ -38059,10 +38170,10 @@ function savedMessage(subject) {
|
|
|
38059
38170
|
}
|
|
38060
38171
|
function announceSavedReview(subject, force) {
|
|
38061
38172
|
const message3 = savedMessage(subject);
|
|
38062
|
-
if (message3) console.log(
|
|
38173
|
+
if (message3) console.log(chalk247.dim(message3));
|
|
38063
38174
|
else if (force)
|
|
38064
38175
|
console.log(
|
|
38065
|
-
|
|
38176
|
+
chalk247.dim(
|
|
38066
38177
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38067
38178
|
)
|
|
38068
38179
|
);
|
|
@@ -38331,8 +38442,8 @@ function testName(call) {
|
|
|
38331
38442
|
function dedentedSource(call) {
|
|
38332
38443
|
const text18 = call.getSourceFile().getFullText();
|
|
38333
38444
|
const lineStart = text18.lastIndexOf("\n", call.getStart()) + 1;
|
|
38334
|
-
const
|
|
38335
|
-
return call.getText().split("\n").map((line) => line.startsWith(
|
|
38445
|
+
const indent4 = /^\s*/.exec(text18.slice(lineStart, call.getStart()))?.[0] ?? "";
|
|
38446
|
+
return call.getText().split("\n").map((line) => line.startsWith(indent4) ? line.slice(indent4.length) : line).join("\n");
|
|
38336
38447
|
}
|
|
38337
38448
|
|
|
38338
38449
|
// src/commands/review/highLevel/visitCase.ts
|
|
@@ -39203,55 +39314,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39203
39314
|
}
|
|
39204
39315
|
|
|
39205
39316
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39206
|
-
import
|
|
39317
|
+
import chalk252 from "chalk";
|
|
39207
39318
|
|
|
39208
39319
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
39209
|
-
import
|
|
39320
|
+
import chalk248 from "chalk";
|
|
39210
39321
|
var PATCH_LINE_COLOURS = {
|
|
39211
|
-
"+":
|
|
39212
|
-
"-":
|
|
39213
|
-
"@":
|
|
39322
|
+
"+": chalk248.green,
|
|
39323
|
+
"-": chalk248.red,
|
|
39324
|
+
"@": chalk248.cyan
|
|
39214
39325
|
};
|
|
39215
39326
|
function formatPatch(patch2) {
|
|
39216
39327
|
return patch2.split("\n").map(
|
|
39217
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
39328
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk248.dim)(line)}`
|
|
39218
39329
|
);
|
|
39219
39330
|
}
|
|
39220
39331
|
function formatDiff(diff3) {
|
|
39221
39332
|
return [
|
|
39222
39333
|
"",
|
|
39223
|
-
` ${
|
|
39224
|
-
...diff3.patch === null ? [` ${
|
|
39334
|
+
` ${chalk248.bold(diff3.path)} ${chalk248.dim(`(${diff3.status})`)} ${chalk248.green(`+${diff3.additions}`)} ${chalk248.red(`-${diff3.deletions}`)}`,
|
|
39335
|
+
...diff3.patch === null ? [` ${chalk248.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
39225
39336
|
];
|
|
39226
39337
|
}
|
|
39227
39338
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
39228
39339
|
if (criticalPaths.length === 0)
|
|
39229
|
-
return `${
|
|
39230
|
-
${
|
|
39340
|
+
return `${chalk248.bold.underline("Critical diffs")}
|
|
39341
|
+
${chalk248.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
39231
39342
|
if (diffs.length === 0)
|
|
39232
|
-
return `${
|
|
39233
|
-
${
|
|
39343
|
+
return `${chalk248.bold.underline("Critical diffs")}
|
|
39344
|
+
${chalk248.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
39234
39345
|
return [
|
|
39235
|
-
|
|
39346
|
+
chalk248.bold.underline("Critical diffs"),
|
|
39236
39347
|
...diffs.flatMap(formatDiff)
|
|
39237
39348
|
].join("\n");
|
|
39238
39349
|
}
|
|
39239
39350
|
|
|
39240
39351
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
39241
|
-
import
|
|
39352
|
+
import chalk249 from "chalk";
|
|
39242
39353
|
var MARKERS = {
|
|
39243
|
-
pass: () =>
|
|
39244
|
-
fail: () =>
|
|
39245
|
-
manual: () =>
|
|
39354
|
+
pass: () => chalk249.green("\u2714"),
|
|
39355
|
+
fail: () => chalk249.red("\u2718"),
|
|
39356
|
+
manual: () => chalk249.yellow("\u25A1")
|
|
39246
39357
|
};
|
|
39247
39358
|
function formatCheck(check2) {
|
|
39248
|
-
const title = check2.status === "fail" ?
|
|
39359
|
+
const title = check2.status === "fail" ? chalk249.red(check2.title) : chalk249.bold(check2.title);
|
|
39249
39360
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
39250
|
-
${
|
|
39361
|
+
${chalk249.dim(check2.reason)}`;
|
|
39251
39362
|
}
|
|
39252
39363
|
function formatGroup(heading2, checks2) {
|
|
39253
39364
|
if (checks2.length === 0) return [];
|
|
39254
|
-
return ["",
|
|
39365
|
+
return ["", chalk249.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
39255
39366
|
}
|
|
39256
39367
|
function formatHighLevelChecklist(checks2) {
|
|
39257
39368
|
const deterministic = checks2.filter(
|
|
@@ -39260,7 +39371,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39260
39371
|
const failed3 = deterministic.filter(
|
|
39261
39372
|
(check2) => check2.status === "fail"
|
|
39262
39373
|
).length;
|
|
39263
|
-
const summary = failed3 === 0 ?
|
|
39374
|
+
const summary = failed3 === 0 ? chalk249.green(`All ${deterministic.length} deterministic checks pass`) : chalk249.red(
|
|
39264
39375
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
39265
39376
|
);
|
|
39266
39377
|
return [
|
|
@@ -39275,61 +39386,61 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39275
39386
|
}
|
|
39276
39387
|
|
|
39277
39388
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
39278
|
-
import
|
|
39389
|
+
import chalk250 from "chalk";
|
|
39279
39390
|
var STATUS_MARKERS = {
|
|
39280
|
-
added: () =>
|
|
39281
|
-
removed: () =>
|
|
39282
|
-
modified: () =>
|
|
39391
|
+
added: () => chalk250.green("A"),
|
|
39392
|
+
removed: () => chalk250.red("D"),
|
|
39393
|
+
modified: () => chalk250.yellow("M")
|
|
39283
39394
|
};
|
|
39284
39395
|
function counts(additions, deletions) {
|
|
39285
|
-
return `${
|
|
39396
|
+
return `${chalk250.green(`+${additions}`)} ${chalk250.red(`-${deletions}`)}`;
|
|
39286
39397
|
}
|
|
39287
|
-
function formatNode(node,
|
|
39398
|
+
function formatNode(node, indent4) {
|
|
39288
39399
|
if (node.kind === "file")
|
|
39289
39400
|
return [
|
|
39290
|
-
`${
|
|
39401
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk250.dim(counts(node.additions, node.deletions))}`
|
|
39291
39402
|
];
|
|
39292
39403
|
const dir = node;
|
|
39293
39404
|
return [
|
|
39294
|
-
`${
|
|
39295
|
-
...dir.children.flatMap((child) => formatNode(child, `${
|
|
39405
|
+
`${indent4}${chalk250.bold(`${dir.name}/`)} ${chalk250.dim(counts(dir.additions, dir.deletions))}`,
|
|
39406
|
+
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
39296
39407
|
];
|
|
39297
39408
|
}
|
|
39298
39409
|
function formatHighLevelStructure(structure) {
|
|
39299
39410
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
39300
39411
|
return [
|
|
39301
|
-
|
|
39412
|
+
chalk250.bold.underline("Structure"),
|
|
39302
39413
|
` ${summary}`,
|
|
39303
39414
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
39304
39415
|
].join("\n");
|
|
39305
39416
|
}
|
|
39306
39417
|
|
|
39307
39418
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
39308
|
-
import
|
|
39419
|
+
import chalk251 from "chalk";
|
|
39309
39420
|
function changeMarker(change) {
|
|
39310
39421
|
if (change === "added") return "A";
|
|
39311
39422
|
if (change === "modified") return "M";
|
|
39312
39423
|
return "\xB7";
|
|
39313
39424
|
}
|
|
39314
39425
|
function formatNode2(node, depth) {
|
|
39315
|
-
const
|
|
39426
|
+
const indent4 = " ".repeat(depth + 2);
|
|
39316
39427
|
if (node.kind === "it")
|
|
39317
|
-
return [`${
|
|
39428
|
+
return [`${indent4}${chalk251.dim(changeMarker(node.change))} ${node.name}`];
|
|
39318
39429
|
return [
|
|
39319
|
-
`${
|
|
39430
|
+
`${indent4}${chalk251.bold(node.name)}`,
|
|
39320
39431
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
39321
39432
|
];
|
|
39322
39433
|
}
|
|
39323
39434
|
function formatHighLevelTests(files, testPaths) {
|
|
39324
|
-
const heading2 =
|
|
39435
|
+
const heading2 = chalk251.bold.underline("Changed tests");
|
|
39325
39436
|
if (files.length === 0)
|
|
39326
39437
|
return `${heading2}
|
|
39327
|
-
${
|
|
39438
|
+
${chalk251.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
39328
39439
|
return [
|
|
39329
39440
|
heading2,
|
|
39330
39441
|
...files.flatMap((file) => [
|
|
39331
39442
|
"",
|
|
39332
|
-
` ${
|
|
39443
|
+
` ${chalk251.bold(file.path)} ${chalk251.dim(`(${file.status})`)}`,
|
|
39333
39444
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
39334
39445
|
])
|
|
39335
39446
|
].join("\n");
|
|
@@ -39343,10 +39454,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
39343
39454
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39344
39455
|
function printHighLevelChecklist(subject) {
|
|
39345
39456
|
console.log(
|
|
39346
|
-
|
|
39457
|
+
chalk252.bold(
|
|
39347
39458
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
39348
39459
|
),
|
|
39349
|
-
|
|
39460
|
+
chalk252.dim(
|
|
39350
39461
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
39351
39462
|
)
|
|
39352
39463
|
);
|
|
@@ -39360,12 +39471,12 @@ function printHighLevelChecklist(subject) {
|
|
|
39360
39471
|
console.log("");
|
|
39361
39472
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
39362
39473
|
console.log(
|
|
39363
|
-
|
|
39474
|
+
chalk252.dim(
|
|
39364
39475
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
39365
39476
|
)
|
|
39366
39477
|
);
|
|
39367
39478
|
console.log(
|
|
39368
|
-
|
|
39479
|
+
chalk252.dim(
|
|
39369
39480
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
39370
39481
|
)
|
|
39371
39482
|
);
|
|
@@ -39651,18 +39762,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
39651
39762
|
}
|
|
39652
39763
|
|
|
39653
39764
|
// src/commands/review/warnOutOfDiff.ts
|
|
39654
|
-
import
|
|
39765
|
+
import chalk253 from "chalk";
|
|
39655
39766
|
function warnOutOfDiff(outOfDiff) {
|
|
39656
39767
|
if (outOfDiff.length === 0) return;
|
|
39657
39768
|
console.warn(
|
|
39658
|
-
|
|
39769
|
+
chalk253.yellow(
|
|
39659
39770
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
39660
39771
|
)
|
|
39661
39772
|
);
|
|
39662
39773
|
for (const finding of outOfDiff) {
|
|
39663
39774
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
39664
39775
|
console.warn(
|
|
39665
|
-
` ${
|
|
39776
|
+
` ${chalk253.yellow("\xB7")} ${finding.title} ${chalk253.dim(
|
|
39666
39777
|
`(${finding.file}:${range})`
|
|
39667
39778
|
)}`
|
|
39668
39779
|
);
|
|
@@ -39689,18 +39800,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
39689
39800
|
}
|
|
39690
39801
|
|
|
39691
39802
|
// src/commands/review/warnUnlocated.ts
|
|
39692
|
-
import
|
|
39803
|
+
import chalk254 from "chalk";
|
|
39693
39804
|
function warnUnlocated(unlocated) {
|
|
39694
39805
|
if (unlocated.length === 0) return;
|
|
39695
39806
|
console.warn(
|
|
39696
|
-
|
|
39807
|
+
chalk254.yellow(
|
|
39697
39808
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
39698
39809
|
)
|
|
39699
39810
|
);
|
|
39700
39811
|
for (const finding of unlocated) {
|
|
39701
|
-
const where = finding.location ||
|
|
39812
|
+
const where = finding.location || chalk254.dim("missing");
|
|
39702
39813
|
console.warn(
|
|
39703
|
-
` ${
|
|
39814
|
+
` ${chalk254.yellow("\xB7")} ${finding.title} ${chalk254.dim(`(${where})`)}`
|
|
39704
39815
|
);
|
|
39705
39816
|
}
|
|
39706
39817
|
}
|
|
@@ -40396,7 +40507,7 @@ function attachStdoutTail(child, maxBytes = 8192) {
|
|
|
40396
40507
|
// src/commands/review/formatReviewerFailure.ts
|
|
40397
40508
|
var FAST_FAIL_MS = 1e3;
|
|
40398
40509
|
var STDOUT_TAIL_LINES = 20;
|
|
40399
|
-
function
|
|
40510
|
+
function indent3(text18) {
|
|
40400
40511
|
return text18.split(/\r?\n/).map((line) => ` ${line}`);
|
|
40401
40512
|
}
|
|
40402
40513
|
function tailLines(text18, maxLines) {
|
|
@@ -40415,12 +40526,12 @@ function fastFailHint(command) {
|
|
|
40415
40526
|
}
|
|
40416
40527
|
function outputDetail(input) {
|
|
40417
40528
|
const stderr = input.stderr.trim();
|
|
40418
|
-
if (stderr) return ["stderr:", ...
|
|
40529
|
+
if (stderr) return ["stderr:", ...indent3(stderr)];
|
|
40419
40530
|
const stdout = (input.stdout ?? "").trim();
|
|
40420
40531
|
if (stdout) {
|
|
40421
40532
|
return [
|
|
40422
40533
|
`stdout (no stderr was captured \u2014 showing last ${STDOUT_TAIL_LINES} lines):`,
|
|
40423
|
-
...
|
|
40534
|
+
...indent3(tailLines(stdout, STDOUT_TAIL_LINES))
|
|
40424
40535
|
];
|
|
40425
40536
|
}
|
|
40426
40537
|
return [
|
|
@@ -41845,7 +41956,7 @@ function registerReview(program) {
|
|
|
41845
41956
|
|
|
41846
41957
|
// src/commands/rules/indexRules.ts
|
|
41847
41958
|
import path87 from "path";
|
|
41848
|
-
import
|
|
41959
|
+
import chalk255 from "chalk";
|
|
41849
41960
|
|
|
41850
41961
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
41851
41962
|
import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
@@ -41932,24 +42043,24 @@ function indexRules() {
|
|
|
41932
42043
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
41933
42044
|
if (directories.length === 0) {
|
|
41934
42045
|
console.log(
|
|
41935
|
-
|
|
42046
|
+
chalk255.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
41936
42047
|
);
|
|
41937
42048
|
return;
|
|
41938
42049
|
}
|
|
41939
42050
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
41940
42051
|
for (const directory of directories)
|
|
41941
|
-
console.log(` ${
|
|
42052
|
+
console.log(` ${chalk255.cyan(directory)}`);
|
|
41942
42053
|
}
|
|
41943
42054
|
|
|
41944
42055
|
// src/commands/rules/listRules.ts
|
|
41945
42056
|
import path88 from "path";
|
|
41946
|
-
import
|
|
42057
|
+
import chalk256 from "chalk";
|
|
41947
42058
|
function listRules(target, options2 = {}) {
|
|
41948
42059
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
41949
42060
|
const rules2 = readScopedRules(resolved);
|
|
41950
42061
|
if (rules2.length === 0) {
|
|
41951
42062
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
41952
|
-
console.log(
|
|
42063
|
+
console.log(chalk256.gray(`No rules in scope for ${label}`));
|
|
41953
42064
|
return;
|
|
41954
42065
|
}
|
|
41955
42066
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -41959,21 +42070,21 @@ function listRules(target, options2 = {}) {
|
|
|
41959
42070
|
if (rule.source !== shown) {
|
|
41960
42071
|
shown = rule.source;
|
|
41961
42072
|
console.log(
|
|
41962
|
-
|
|
42073
|
+
chalk256.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
41963
42074
|
);
|
|
41964
42075
|
}
|
|
41965
42076
|
console.log(
|
|
41966
|
-
` ${
|
|
42077
|
+
` ${chalk256.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
41967
42078
|
);
|
|
41968
42079
|
if (options2.full && rule.title)
|
|
41969
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42080
|
+
console.log(` ${" ".repeat(width2)} ${chalk256.dim(rule.text)}`);
|
|
41970
42081
|
}
|
|
41971
42082
|
}
|
|
41972
42083
|
|
|
41973
42084
|
// src/commands/rules/addRule.ts
|
|
41974
42085
|
import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
|
|
41975
42086
|
import path90 from "path";
|
|
41976
|
-
import
|
|
42087
|
+
import chalk257 from "chalk";
|
|
41977
42088
|
|
|
41978
42089
|
// src/commands/rules/insertRuleBullet.ts
|
|
41979
42090
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42032,7 +42143,7 @@ function read2(file) {
|
|
|
42032
42143
|
function addRule(text18, options2) {
|
|
42033
42144
|
const rule = text18.trim();
|
|
42034
42145
|
if (rule === "") {
|
|
42035
|
-
console.error(
|
|
42146
|
+
console.error(chalk257.red("Rule text is required"));
|
|
42036
42147
|
process.exitCode = 1;
|
|
42037
42148
|
return;
|
|
42038
42149
|
}
|
|
@@ -42050,14 +42161,14 @@ function addRule(text18, options2) {
|
|
|
42050
42161
|
);
|
|
42051
42162
|
updateScopedRulesIndex(root2);
|
|
42052
42163
|
console.log(
|
|
42053
|
-
`Added ${
|
|
42164
|
+
`Added ${chalk257.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42054
42165
|
);
|
|
42055
42166
|
}
|
|
42056
42167
|
|
|
42057
42168
|
// src/commands/rules/addUserRule.ts
|
|
42058
|
-
import
|
|
42169
|
+
import chalk258 from "chalk";
|
|
42059
42170
|
function fail8(message3) {
|
|
42060
|
-
console.error(
|
|
42171
|
+
console.error(chalk258.red(message3));
|
|
42061
42172
|
process.exitCode = 1;
|
|
42062
42173
|
}
|
|
42063
42174
|
function asRules(value) {
|
|
@@ -42076,7 +42187,7 @@ async function addToUserDb(rule) {
|
|
|
42076
42187
|
rule
|
|
42077
42188
|
]);
|
|
42078
42189
|
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42079
|
-
console.log(`Added ${
|
|
42190
|
+
console.log(`Added ${chalk258.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42080
42191
|
}
|
|
42081
42192
|
function addToUserNode(rule, globalConfigPath) {
|
|
42082
42193
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42089,7 +42200,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42089
42200
|
);
|
|
42090
42201
|
if (!result.ok) return fail8(result.errors.join("\n"));
|
|
42091
42202
|
console.log(
|
|
42092
|
-
`Added ${
|
|
42203
|
+
`Added ${chalk258.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42093
42204
|
);
|
|
42094
42205
|
}
|
|
42095
42206
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -42144,7 +42255,7 @@ function registerRules(program) {
|
|
|
42144
42255
|
}
|
|
42145
42256
|
|
|
42146
42257
|
// src/commands/seq/seqAuth.ts
|
|
42147
|
-
import
|
|
42258
|
+
import chalk260 from "chalk";
|
|
42148
42259
|
|
|
42149
42260
|
// src/commands/seq/loadConnections.ts
|
|
42150
42261
|
function loadConnections2() {
|
|
@@ -42173,10 +42284,10 @@ function setDefaultConnection(name) {
|
|
|
42173
42284
|
}
|
|
42174
42285
|
|
|
42175
42286
|
// src/shared/assertUniqueName.ts
|
|
42176
|
-
import
|
|
42287
|
+
import chalk259 from "chalk";
|
|
42177
42288
|
function assertUniqueName(existingNames, name) {
|
|
42178
42289
|
if (existingNames.includes(name)) {
|
|
42179
|
-
console.error(
|
|
42290
|
+
console.error(chalk259.red(`Connection "${name}" already exists.`));
|
|
42180
42291
|
process.exit(1);
|
|
42181
42292
|
}
|
|
42182
42293
|
}
|
|
@@ -42194,16 +42305,16 @@ async function promptConnection2(existingNames) {
|
|
|
42194
42305
|
var seqAuth = createConnectionAuth({
|
|
42195
42306
|
load: loadConnections2,
|
|
42196
42307
|
save: saveConnections2,
|
|
42197
|
-
format: (c) => `${
|
|
42308
|
+
format: (c) => `${chalk260.bold(c.name)} ${c.url}`,
|
|
42198
42309
|
promptNew: promptConnection2,
|
|
42199
42310
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
42200
42311
|
});
|
|
42201
42312
|
|
|
42202
42313
|
// src/commands/seq/seqQuery.ts
|
|
42203
|
-
import
|
|
42314
|
+
import chalk264 from "chalk";
|
|
42204
42315
|
|
|
42205
42316
|
// src/commands/seq/fetchSeq.ts
|
|
42206
|
-
import
|
|
42317
|
+
import chalk261 from "chalk";
|
|
42207
42318
|
async function fetchSeq(conn, path109, params) {
|
|
42208
42319
|
const url = `${conn.url}${path109}?${params}`;
|
|
42209
42320
|
const response = await fetch(url, {
|
|
@@ -42214,7 +42325,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
42214
42325
|
});
|
|
42215
42326
|
if (!response.ok) {
|
|
42216
42327
|
const body = await response.text();
|
|
42217
|
-
console.error(
|
|
42328
|
+
console.error(chalk261.red(`Seq returned ${response.status}: ${body}`));
|
|
42218
42329
|
process.exit(1);
|
|
42219
42330
|
}
|
|
42220
42331
|
return response;
|
|
@@ -42273,23 +42384,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
42273
42384
|
}
|
|
42274
42385
|
|
|
42275
42386
|
// src/commands/seq/formatEvent.ts
|
|
42276
|
-
import
|
|
42387
|
+
import chalk262 from "chalk";
|
|
42277
42388
|
function levelColor(level) {
|
|
42278
42389
|
switch (level) {
|
|
42279
42390
|
case "Fatal":
|
|
42280
|
-
return
|
|
42391
|
+
return chalk262.bgRed.white;
|
|
42281
42392
|
case "Error":
|
|
42282
|
-
return
|
|
42393
|
+
return chalk262.red;
|
|
42283
42394
|
case "Warning":
|
|
42284
|
-
return
|
|
42395
|
+
return chalk262.yellow;
|
|
42285
42396
|
case "Information":
|
|
42286
|
-
return
|
|
42397
|
+
return chalk262.cyan;
|
|
42287
42398
|
case "Debug":
|
|
42288
|
-
return
|
|
42399
|
+
return chalk262.gray;
|
|
42289
42400
|
case "Verbose":
|
|
42290
|
-
return
|
|
42401
|
+
return chalk262.dim;
|
|
42291
42402
|
default:
|
|
42292
|
-
return
|
|
42403
|
+
return chalk262.white;
|
|
42293
42404
|
}
|
|
42294
42405
|
}
|
|
42295
42406
|
function levelAbbrev(level) {
|
|
@@ -42330,12 +42441,12 @@ function formatTimestamp(iso) {
|
|
|
42330
42441
|
function formatEvent(event) {
|
|
42331
42442
|
const color = levelColor(event.Level);
|
|
42332
42443
|
const abbrev = levelAbbrev(event.Level);
|
|
42333
|
-
const ts10 =
|
|
42444
|
+
const ts10 = chalk262.dim(formatTimestamp(event.Timestamp));
|
|
42334
42445
|
const msg = renderMessage(event);
|
|
42335
42446
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
42336
42447
|
if (event.Exception) {
|
|
42337
42448
|
for (const line of event.Exception.split("\n")) {
|
|
42338
|
-
lines2.push(
|
|
42449
|
+
lines2.push(chalk262.red(` ${line}`));
|
|
42339
42450
|
}
|
|
42340
42451
|
}
|
|
42341
42452
|
return lines2.join("\n");
|
|
@@ -42368,11 +42479,11 @@ function rejectTimestampFilter(filter) {
|
|
|
42368
42479
|
}
|
|
42369
42480
|
|
|
42370
42481
|
// src/shared/resolveNamedConnection.ts
|
|
42371
|
-
import
|
|
42482
|
+
import chalk263 from "chalk";
|
|
42372
42483
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
42373
42484
|
if (connections.length === 0) {
|
|
42374
42485
|
console.error(
|
|
42375
|
-
|
|
42486
|
+
chalk263.red(
|
|
42376
42487
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
42377
42488
|
)
|
|
42378
42489
|
);
|
|
@@ -42381,7 +42492,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
42381
42492
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
42382
42493
|
const connection = connections.find((c) => c.name === target);
|
|
42383
42494
|
if (!connection) {
|
|
42384
|
-
console.error(
|
|
42495
|
+
console.error(chalk263.red(`${kind} connection "${target}" not found.`));
|
|
42385
42496
|
process.exit(1);
|
|
42386
42497
|
}
|
|
42387
42498
|
return connection;
|
|
@@ -42410,7 +42521,7 @@ async function seqQuery(filter, options2) {
|
|
|
42410
42521
|
new URLSearchParams({ filter, count: String(count10) })
|
|
42411
42522
|
);
|
|
42412
42523
|
if (events.length === 0) {
|
|
42413
|
-
console.log(
|
|
42524
|
+
console.log(chalk264.yellow("No events found."));
|
|
42414
42525
|
return;
|
|
42415
42526
|
}
|
|
42416
42527
|
if (options2.json) {
|
|
@@ -42421,11 +42532,11 @@ async function seqQuery(filter, options2) {
|
|
|
42421
42532
|
for (const event of chronological) {
|
|
42422
42533
|
console.log(formatEvent(event));
|
|
42423
42534
|
}
|
|
42424
|
-
console.log(
|
|
42535
|
+
console.log(chalk264.dim(`
|
|
42425
42536
|
${events.length} events`));
|
|
42426
42537
|
if (events.length >= count10) {
|
|
42427
42538
|
console.log(
|
|
42428
|
-
|
|
42539
|
+
chalk264.yellow(
|
|
42429
42540
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
42430
42541
|
)
|
|
42431
42542
|
);
|
|
@@ -42433,10 +42544,10 @@ ${events.length} events`));
|
|
|
42433
42544
|
}
|
|
42434
42545
|
|
|
42435
42546
|
// src/shared/setNamedDefaultConnection.ts
|
|
42436
|
-
import
|
|
42547
|
+
import chalk265 from "chalk";
|
|
42437
42548
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
42438
42549
|
if (!connections.find((c) => c.name === name)) {
|
|
42439
|
-
console.error(
|
|
42550
|
+
console.error(chalk265.red(`Connection "${name}" not found.`));
|
|
42440
42551
|
process.exit(1);
|
|
42441
42552
|
}
|
|
42442
42553
|
setDefault(name);
|
|
@@ -42565,7 +42676,7 @@ function registerSignal(program) {
|
|
|
42565
42676
|
}
|
|
42566
42677
|
|
|
42567
42678
|
// src/commands/slack/parseSlackThreadRef.ts
|
|
42568
|
-
import { InvalidArgumentError as
|
|
42679
|
+
import { InvalidArgumentError as InvalidArgumentError4 } from "commander";
|
|
42569
42680
|
var MESSAGE_TS = /^\d{10}\.\d{6}$/;
|
|
42570
42681
|
var PERMALINK_TS = /\/archives\/[^/?#]+\/p(\d{10})(\d{6})\b/;
|
|
42571
42682
|
var PERMALINK_THREAD_TS = /[?&]thread_ts=(\d{10}\.\d{6})\b/;
|
|
@@ -42576,7 +42687,7 @@ function parseSlackThreadRef(value) {
|
|
|
42576
42687
|
if (thread) return thread[1];
|
|
42577
42688
|
const permalink = PERMALINK_TS.exec(trimmed);
|
|
42578
42689
|
if (permalink) return `${permalink[1]}.${permalink[2]}`;
|
|
42579
|
-
throw new
|
|
42690
|
+
throw new InvalidArgumentError4(
|
|
42580
42691
|
"Expected a message ts (1712345678.123456) or a Slack archives permalink (https://<workspace>.slack.com/archives/<channel>/p1712345678123456)."
|
|
42581
42692
|
);
|
|
42582
42693
|
}
|
|
@@ -42738,7 +42849,7 @@ function registerSlack(program) {
|
|
|
42738
42849
|
}
|
|
42739
42850
|
|
|
42740
42851
|
// src/commands/sql/sqlAuth.ts
|
|
42741
|
-
import
|
|
42852
|
+
import chalk267 from "chalk";
|
|
42742
42853
|
|
|
42743
42854
|
// src/commands/sql/loadConnections.ts
|
|
42744
42855
|
function loadConnections3() {
|
|
@@ -42767,7 +42878,7 @@ function setDefaultConnection2(name) {
|
|
|
42767
42878
|
}
|
|
42768
42879
|
|
|
42769
42880
|
// src/commands/sql/promptConnection.ts
|
|
42770
|
-
import
|
|
42881
|
+
import chalk266 from "chalk";
|
|
42771
42882
|
async function promptConnection3(existingNames) {
|
|
42772
42883
|
const name = await promptInput("name", "Connection name:", "default");
|
|
42773
42884
|
assertUniqueName(existingNames, name);
|
|
@@ -42775,7 +42886,7 @@ async function promptConnection3(existingNames) {
|
|
|
42775
42886
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
42776
42887
|
const port = Number.parseInt(portStr, 10);
|
|
42777
42888
|
if (!Number.isFinite(port)) {
|
|
42778
|
-
console.error(
|
|
42889
|
+
console.error(chalk266.red(`Invalid port "${portStr}".`));
|
|
42779
42890
|
process.exit(1);
|
|
42780
42891
|
}
|
|
42781
42892
|
const user = await promptInput("user", "User:");
|
|
@@ -42788,13 +42899,13 @@ async function promptConnection3(existingNames) {
|
|
|
42788
42899
|
var sqlAuth = createConnectionAuth({
|
|
42789
42900
|
load: loadConnections3,
|
|
42790
42901
|
save: saveConnections3,
|
|
42791
|
-
format: (c) => `${
|
|
42902
|
+
format: (c) => `${chalk267.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
42792
42903
|
promptNew: promptConnection3,
|
|
42793
42904
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
42794
42905
|
});
|
|
42795
42906
|
|
|
42796
42907
|
// src/commands/sql/printTable.ts
|
|
42797
|
-
import
|
|
42908
|
+
import chalk268 from "chalk";
|
|
42798
42909
|
function formatCell(value) {
|
|
42799
42910
|
if (value === null || value === void 0) return "";
|
|
42800
42911
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -42803,7 +42914,7 @@ function formatCell(value) {
|
|
|
42803
42914
|
}
|
|
42804
42915
|
function printTable(rows) {
|
|
42805
42916
|
if (rows.length === 0) {
|
|
42806
|
-
console.log(
|
|
42917
|
+
console.log(chalk268.yellow("(no rows)"));
|
|
42807
42918
|
return;
|
|
42808
42919
|
}
|
|
42809
42920
|
const columns = Object.keys(rows[0]);
|
|
@@ -42811,13 +42922,13 @@ function printTable(rows) {
|
|
|
42811
42922
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
42812
42923
|
);
|
|
42813
42924
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
42814
|
-
console.log(
|
|
42815
|
-
console.log(
|
|
42925
|
+
console.log(chalk268.dim(header));
|
|
42926
|
+
console.log(chalk268.dim("-".repeat(header.length)));
|
|
42816
42927
|
for (const row3 of rows) {
|
|
42817
42928
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
42818
42929
|
console.log(line);
|
|
42819
42930
|
}
|
|
42820
|
-
console.log(
|
|
42931
|
+
console.log(chalk268.dim(`
|
|
42821
42932
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
42822
42933
|
}
|
|
42823
42934
|
|
|
@@ -42877,7 +42988,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
42877
42988
|
}
|
|
42878
42989
|
|
|
42879
42990
|
// src/commands/sql/sqlMutate.ts
|
|
42880
|
-
import
|
|
42991
|
+
import chalk269 from "chalk";
|
|
42881
42992
|
|
|
42882
42993
|
// src/commands/sql/isMutation.ts
|
|
42883
42994
|
var MUTATION_KEYWORDS = [
|
|
@@ -42911,7 +43022,7 @@ function isMutation(sql30) {
|
|
|
42911
43022
|
async function sqlMutate(query, connectionName) {
|
|
42912
43023
|
if (!isMutation(query)) {
|
|
42913
43024
|
console.error(
|
|
42914
|
-
|
|
43025
|
+
chalk269.red(
|
|
42915
43026
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
42916
43027
|
)
|
|
42917
43028
|
);
|
|
@@ -42921,18 +43032,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
42921
43032
|
const pool = await sqlConnect(conn);
|
|
42922
43033
|
try {
|
|
42923
43034
|
const result = await pool.request().query(query);
|
|
42924
|
-
console.log(
|
|
43035
|
+
console.log(chalk269.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
42925
43036
|
} finally {
|
|
42926
43037
|
await pool.close();
|
|
42927
43038
|
}
|
|
42928
43039
|
}
|
|
42929
43040
|
|
|
42930
43041
|
// src/commands/sql/sqlQuery.ts
|
|
42931
|
-
import
|
|
43042
|
+
import chalk270 from "chalk";
|
|
42932
43043
|
async function sqlQuery(query, connectionName) {
|
|
42933
43044
|
if (isMutation(query)) {
|
|
42934
43045
|
console.error(
|
|
42935
|
-
|
|
43046
|
+
chalk270.red(
|
|
42936
43047
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
42937
43048
|
)
|
|
42938
43049
|
);
|
|
@@ -42947,7 +43058,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
42947
43058
|
printTable(rows);
|
|
42948
43059
|
} else {
|
|
42949
43060
|
console.log(
|
|
42950
|
-
|
|
43061
|
+
chalk270.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
42951
43062
|
);
|
|
42952
43063
|
}
|
|
42953
43064
|
} finally {
|
|
@@ -43362,7 +43473,7 @@ function syncPi(claudeDir, options2) {
|
|
|
43362
43473
|
// src/commands/sync/syncSettings.ts
|
|
43363
43474
|
import * as fs47 from "fs";
|
|
43364
43475
|
import * as path101 from "path";
|
|
43365
|
-
import
|
|
43476
|
+
import chalk271 from "chalk";
|
|
43366
43477
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
43367
43478
|
const source = path101.join(claudeDir, "settings.json");
|
|
43368
43479
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -43381,7 +43492,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43381
43492
|
if (mergedContent !== normalizedTarget) {
|
|
43382
43493
|
if (!options2?.yes) {
|
|
43383
43494
|
console.log(
|
|
43384
|
-
|
|
43495
|
+
chalk271.yellow(
|
|
43385
43496
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
43386
43497
|
)
|
|
43387
43498
|
);
|
|
@@ -43389,7 +43500,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43389
43500
|
printDiff(targetContent, mergedContent);
|
|
43390
43501
|
printAutoConfirmHint();
|
|
43391
43502
|
const confirm = await promptConfirm(
|
|
43392
|
-
|
|
43503
|
+
chalk271.red("Overwrite existing settings.json?"),
|
|
43393
43504
|
false
|
|
43394
43505
|
);
|
|
43395
43506
|
if (!confirm) {
|
|
@@ -43460,7 +43571,7 @@ function registerSync(program) {
|
|
|
43460
43571
|
import { existsSync as existsSync77 } from "fs";
|
|
43461
43572
|
|
|
43462
43573
|
// src/commands/transcript/convert/formatTimestamp.ts
|
|
43463
|
-
function
|
|
43574
|
+
function pad2(value, width2) {
|
|
43464
43575
|
return String(value).padStart(width2, "0");
|
|
43465
43576
|
}
|
|
43466
43577
|
function formatTimestamp2(ms) {
|
|
@@ -43468,7 +43579,7 @@ function formatTimestamp2(ms) {
|
|
|
43468
43579
|
const hours = Math.floor(totalSeconds / 3600);
|
|
43469
43580
|
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
43470
43581
|
const seconds = totalSeconds % 60;
|
|
43471
|
-
return `${
|
|
43582
|
+
return `${pad2(hours, 2)}:${pad2(minutes, 2)}:${pad2(seconds, 2)}.${pad2(ms % 1e3, 3)}`;
|
|
43472
43583
|
}
|
|
43473
43584
|
function formatClock(ms) {
|
|
43474
43585
|
return formatTimestamp2(ms).slice(0, 8);
|
|
@@ -46231,18 +46342,18 @@ function registerRun(program) {
|
|
|
46231
46342
|
}
|
|
46232
46343
|
|
|
46233
46344
|
// src/commands/sessions/nodes/formatLink.ts
|
|
46234
|
-
import
|
|
46345
|
+
import chalk272 from "chalk";
|
|
46235
46346
|
var STATE_COLOURS = {
|
|
46236
|
-
connected:
|
|
46237
|
-
connecting:
|
|
46238
|
-
disconnected:
|
|
46239
|
-
"version-blocked":
|
|
46347
|
+
connected: chalk272.green,
|
|
46348
|
+
connecting: chalk272.yellow,
|
|
46349
|
+
disconnected: chalk272.red,
|
|
46350
|
+
"version-blocked": chalk272.red
|
|
46240
46351
|
};
|
|
46241
46352
|
function formatLink(link3) {
|
|
46242
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
46353
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk272.white;
|
|
46243
46354
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
46244
46355
|
const error = link3.error ? `
|
|
46245
|
-
${
|
|
46356
|
+
${chalk272.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
46246
46357
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
46247
46358
|
}
|
|
46248
46359
|
|
|
@@ -54244,7 +54355,7 @@ async function closeSession() {
|
|
|
54244
54355
|
}
|
|
54245
54356
|
|
|
54246
54357
|
// src/commands/sessions/nodes/listNodes.ts
|
|
54247
|
-
import
|
|
54358
|
+
import chalk273 from "chalk";
|
|
54248
54359
|
async function nodesReport() {
|
|
54249
54360
|
const live = await queryNodes();
|
|
54250
54361
|
if (live)
|
|
@@ -54261,10 +54372,10 @@ async function listNodes(options2) {
|
|
|
54261
54372
|
console.log(JSON.stringify(report, null, 2));
|
|
54262
54373
|
return;
|
|
54263
54374
|
}
|
|
54264
|
-
console.log(`${report.local} ${
|
|
54375
|
+
console.log(`${report.local} ${chalk273.dim("(this node)")}`);
|
|
54265
54376
|
if (!report.daemonRunning)
|
|
54266
|
-
console.log(
|
|
54267
|
-
if (report.links.length === 0) console.log(
|
|
54377
|
+
console.log(chalk273.dim(" daemon not running; showing configured links"));
|
|
54378
|
+
if (report.links.length === 0) console.log(chalk273.dim(" no links"));
|
|
54268
54379
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
54269
54380
|
}
|
|
54270
54381
|
|
|
@@ -54286,7 +54397,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
54286
54397
|
}
|
|
54287
54398
|
|
|
54288
54399
|
// src/commands/sessions/nodes/printReport.ts
|
|
54289
|
-
import
|
|
54400
|
+
import chalk274 from "chalk";
|
|
54290
54401
|
function printReport(report) {
|
|
54291
54402
|
if (report.links.length === 0) {
|
|
54292
54403
|
console.log(`${report.local} has no links`);
|
|
@@ -54300,11 +54411,11 @@ function printReport(report) {
|
|
|
54300
54411
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
54301
54412
|
}
|
|
54302
54413
|
function printDiagnosis(diagnosis) {
|
|
54303
|
-
console.log(`${
|
|
54414
|
+
console.log(`${chalk274.bold(diagnosis.name)} ${chalk274.dim(diagnosis.url)}`);
|
|
54304
54415
|
for (const hop of diagnosis.hops) {
|
|
54305
|
-
const mark = hop.ok ?
|
|
54416
|
+
const mark = hop.ok ? chalk274.green("\u2713") : chalk274.red("\u2717");
|
|
54306
54417
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
54307
|
-
if (hop.remediation) console.log(` ${
|
|
54418
|
+
if (hop.remediation) console.log(` ${chalk274.yellow(hop.remediation)}`);
|
|
54308
54419
|
}
|
|
54309
54420
|
}
|
|
54310
54421
|
|
|
@@ -54376,14 +54487,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
54376
54487
|
}
|
|
54377
54488
|
|
|
54378
54489
|
// src/commands/sessions/nodes/linkNode.ts
|
|
54379
|
-
import
|
|
54490
|
+
import chalk277 from "chalk";
|
|
54380
54491
|
|
|
54381
54492
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
54382
|
-
import
|
|
54493
|
+
import chalk275 from "chalk";
|
|
54383
54494
|
async function notifyDaemonLinks() {
|
|
54384
54495
|
if (!await isDaemonRunning()) {
|
|
54385
54496
|
console.log(
|
|
54386
|
-
|
|
54497
|
+
chalk275.yellow(
|
|
54387
54498
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
54388
54499
|
)
|
|
54389
54500
|
);
|
|
@@ -54391,11 +54502,11 @@ async function notifyDaemonLinks() {
|
|
|
54391
54502
|
}
|
|
54392
54503
|
try {
|
|
54393
54504
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
54394
|
-
console.log(
|
|
54505
|
+
console.log(chalk275.dim("The sessions daemon reloaded its links."));
|
|
54395
54506
|
} catch (error) {
|
|
54396
54507
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
54397
54508
|
console.log(
|
|
54398
|
-
|
|
54509
|
+
chalk275.yellow(
|
|
54399
54510
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
54400
54511
|
)
|
|
54401
54512
|
);
|
|
@@ -54403,7 +54514,7 @@ async function notifyDaemonLinks() {
|
|
|
54403
54514
|
}
|
|
54404
54515
|
|
|
54405
54516
|
// src/commands/sessions/nodes/readLinks.ts
|
|
54406
|
-
import
|
|
54517
|
+
import chalk276 from "chalk";
|
|
54407
54518
|
|
|
54408
54519
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
54409
54520
|
async function writeLinks(links2) {
|
|
@@ -54426,7 +54537,7 @@ async function readLinks() {
|
|
|
54426
54537
|
await writeLinks(links2);
|
|
54427
54538
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
54428
54539
|
console.log(
|
|
54429
|
-
|
|
54540
|
+
chalk276.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
54430
54541
|
);
|
|
54431
54542
|
return links2;
|
|
54432
54543
|
}
|
|
@@ -54482,7 +54593,7 @@ async function linkNode(name, url, options2) {
|
|
|
54482
54593
|
throw new Error(`${name} is this node; link to a different node`);
|
|
54483
54594
|
const link3 = await buildLink(name, url, options2);
|
|
54484
54595
|
await writeLinks([...others, link3]);
|
|
54485
|
-
console.log(
|
|
54596
|
+
console.log(chalk277.green(`Linked ${name} (${link3.url})`));
|
|
54486
54597
|
await notifyDaemonLinks();
|
|
54487
54598
|
}
|
|
54488
54599
|
|
|
@@ -54665,16 +54776,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
54665
54776
|
}
|
|
54666
54777
|
|
|
54667
54778
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
54668
|
-
import
|
|
54779
|
+
import chalk278 from "chalk";
|
|
54669
54780
|
async function unlinkNode(name) {
|
|
54670
54781
|
const links2 = await readLinks();
|
|
54671
54782
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
54672
54783
|
if (remaining.length === links2.length) {
|
|
54673
|
-
console.log(
|
|
54784
|
+
console.log(chalk278.yellow(`No link named ${name}`));
|
|
54674
54785
|
return;
|
|
54675
54786
|
}
|
|
54676
54787
|
await writeLinks(remaining);
|
|
54677
|
-
console.log(
|
|
54788
|
+
console.log(chalk278.green(`Unlinked ${name}`));
|
|
54678
54789
|
await notifyDaemonLinks();
|
|
54679
54790
|
}
|
|
54680
54791
|
|
|
@@ -54911,10 +55022,10 @@ function createProgram() {
|
|
|
54911
55022
|
}
|
|
54912
55023
|
|
|
54913
55024
|
// src/reportCliError.ts
|
|
54914
|
-
import
|
|
55025
|
+
import chalk279 from "chalk";
|
|
54915
55026
|
function reportCliError(error) {
|
|
54916
55027
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
54917
|
-
console.error(
|
|
55028
|
+
console.error(chalk279.red(error.message));
|
|
54918
55029
|
} else {
|
|
54919
55030
|
console.error(error);
|
|
54920
55031
|
}
|