@staff0rd/assist 0.983.0 → 0.984.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/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.984.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1635,7 +1635,7 @@ var defaultDeps = {
|
|
|
1635
1635
|
httpsPort: tailnetHttpsPort
|
|
1636
1636
|
};
|
|
1637
1637
|
async function ensureTailscaleServe(port, deps2 = {}) {
|
|
1638
|
-
const { enabled, status: status2, serveStatus, serve, sleep:
|
|
1638
|
+
const { enabled, status: status2, serveStatus, serve, sleep: sleep3, httpsPort } = {
|
|
1639
1639
|
...defaultDeps,
|
|
1640
1640
|
...deps2
|
|
1641
1641
|
};
|
|
@@ -1650,7 +1650,7 @@ async function ensureTailscaleServe(port, deps2 = {}) {
|
|
|
1650
1650
|
return `serving ${plan2.target} at ${plan2.url}`;
|
|
1651
1651
|
} catch (error) {
|
|
1652
1652
|
if (attempt2 >= SERVE_WRITE_ATTEMPTS) throw error;
|
|
1653
|
-
await
|
|
1653
|
+
await sleep3(attempt2 * 500 + Math.random() * 500);
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
}
|
|
@@ -4205,6 +4205,7 @@ async function readJsonBody(req) {
|
|
|
4205
4205
|
function parseBrowserRequest(body) {
|
|
4206
4206
|
const fields = body ?? {};
|
|
4207
4207
|
const { op, url, selector, text: text18, code } = fields;
|
|
4208
|
+
if (op === "update") return { op };
|
|
4208
4209
|
if (!optionalString(url)) return void 0;
|
|
4209
4210
|
if (op === "status" || op === "snapshot") return { op, url };
|
|
4210
4211
|
if (op === "console") return parseConsoleRequest(url, fields);
|
|
@@ -24154,8 +24155,9 @@ async function requestTab(server, request) {
|
|
|
24154
24155
|
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
24155
24156
|
fail6(reply2.error);
|
|
24156
24157
|
}
|
|
24157
|
-
|
|
24158
|
-
|
|
24158
|
+
const result = reply2.result;
|
|
24159
|
+
if (result.tabUrl) console.log(`tab: ${result.tabUrl}`);
|
|
24160
|
+
return { ...result, version: reply2.version };
|
|
24159
24161
|
}
|
|
24160
24162
|
|
|
24161
24163
|
// src/commands/browser/browserInspect.ts
|
|
@@ -24258,6 +24260,70 @@ async function browserStatus(options2) {
|
|
|
24258
24260
|
);
|
|
24259
24261
|
}
|
|
24260
24262
|
|
|
24263
|
+
// src/commands/browser/browserUpdate.ts
|
|
24264
|
+
import chalk147 from "chalk";
|
|
24265
|
+
|
|
24266
|
+
// src/commands/browser/describeUpdateCheck.ts
|
|
24267
|
+
function describeUpdateCheck(reply2) {
|
|
24268
|
+
const installed = `v${reply2.version}`;
|
|
24269
|
+
if (!reply2.ok) return { outcome: "failed", message: reply2.error };
|
|
24270
|
+
const { status: status2, available } = reply2.result;
|
|
24271
|
+
if (status2 === "update_available")
|
|
24272
|
+
return {
|
|
24273
|
+
outcome: "updating",
|
|
24274
|
+
message: `updating ${installed} \u2192 ${available ? `v${available}` : "a newer version"}\u2026`
|
|
24275
|
+
};
|
|
24276
|
+
if (status2 === "no_update")
|
|
24277
|
+
return {
|
|
24278
|
+
outcome: "current",
|
|
24279
|
+
message: `already up to date (${installed})`
|
|
24280
|
+
};
|
|
24281
|
+
return {
|
|
24282
|
+
outcome: "failed",
|
|
24283
|
+
message: `Firefox did not check for an update (status: ${status2}); still ${installed}`
|
|
24284
|
+
};
|
|
24285
|
+
}
|
|
24286
|
+
|
|
24287
|
+
// src/commands/browser/waitForNewVersion.ts
|
|
24288
|
+
import { setTimeout as sleep2 } from "timers/promises";
|
|
24289
|
+
var connectedVersion = (server) => requestBrowser(server, { op: "status" }).then((reply2) => reply2.version).catch(() => void 0);
|
|
24290
|
+
async function waitForNewVersion(server, oldVersion, {
|
|
24291
|
+
timeoutMs = 9e4,
|
|
24292
|
+
pollMs = 2e3,
|
|
24293
|
+
now = Date.now,
|
|
24294
|
+
connectedVersion: probe2 = connectedVersion,
|
|
24295
|
+
wait: wait2 = sleep2
|
|
24296
|
+
} = {}) {
|
|
24297
|
+
const deadline = now() + timeoutMs;
|
|
24298
|
+
while (now() < deadline) {
|
|
24299
|
+
await wait2(pollMs);
|
|
24300
|
+
const version2 = await probe2(server);
|
|
24301
|
+
if (version2 && version2 !== oldVersion) return version2;
|
|
24302
|
+
}
|
|
24303
|
+
return void 0;
|
|
24304
|
+
}
|
|
24305
|
+
|
|
24306
|
+
// src/commands/browser/browserUpdate.ts
|
|
24307
|
+
function fail7(message3) {
|
|
24308
|
+
console.error(chalk147.red(`Error: ${message3}`));
|
|
24309
|
+
process.exit(1);
|
|
24310
|
+
}
|
|
24311
|
+
async function browserUpdate(options2) {
|
|
24312
|
+
const reply2 = await requestBrowser(options2.server, { op: "update" }).catch(
|
|
24313
|
+
(error) => fail7(error.message)
|
|
24314
|
+
);
|
|
24315
|
+
const { outcome, message: message3 } = describeUpdateCheck(reply2);
|
|
24316
|
+
if (outcome === "failed") fail7(message3);
|
|
24317
|
+
console.log(message3);
|
|
24318
|
+
if (outcome === "current") return;
|
|
24319
|
+
const installed = await waitForNewVersion(options2.server, reply2.version);
|
|
24320
|
+
if (!installed)
|
|
24321
|
+
fail7(
|
|
24322
|
+
`the extension did not reconnect at a new version (still v${reply2.version})`
|
|
24323
|
+
);
|
|
24324
|
+
console.log(`updated v${reply2.version} \u2192 v${installed}`);
|
|
24325
|
+
}
|
|
24326
|
+
|
|
24261
24327
|
// src/commands/extension/consoleCapture/types.ts
|
|
24262
24328
|
var CONSOLE_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
24263
24329
|
var CONSOLE_DEFAULT_LIMIT = 200;
|
|
@@ -24272,7 +24338,7 @@ function parseTopCount(value) {
|
|
|
24272
24338
|
}
|
|
24273
24339
|
|
|
24274
24340
|
// src/commands/browser/browserConsole.ts
|
|
24275
|
-
import
|
|
24341
|
+
import chalk148 from "chalk";
|
|
24276
24342
|
|
|
24277
24343
|
// src/commands/browser/formatConsoleEntries.ts
|
|
24278
24344
|
var pad = (value, width2 = 2) => String(value).padStart(width2, "0");
|
|
@@ -24300,7 +24366,7 @@ function formatConsoleEntries({
|
|
|
24300
24366
|
// src/commands/browser/browserConsole.ts
|
|
24301
24367
|
async function browserConsole(options2) {
|
|
24302
24368
|
if (options2.all && options2.url) {
|
|
24303
|
-
console.error(
|
|
24369
|
+
console.error(chalk148.red("Error: pass either --url or --all, not both"));
|
|
24304
24370
|
process.exit(1);
|
|
24305
24371
|
}
|
|
24306
24372
|
const result = await requestTab(options2.server, {
|
|
@@ -24386,11 +24452,18 @@ function registerBrowser(program) {
|
|
|
24386
24452
|
).requiredOption("--file <script>", "JavaScript file to run")
|
|
24387
24453
|
).action(browserRun);
|
|
24388
24454
|
registerBrowserConsole(browser);
|
|
24455
|
+
browser.command("update").description(
|
|
24456
|
+
"Make the connected extension check for an update and install it now, then print the old and new versions"
|
|
24457
|
+
).option(
|
|
24458
|
+
"--server <url>",
|
|
24459
|
+
"assist web server the extension connects to",
|
|
24460
|
+
"http://localhost:3100"
|
|
24461
|
+
).action(browserUpdate);
|
|
24389
24462
|
}
|
|
24390
24463
|
|
|
24391
24464
|
// src/commands/extension/extension.ts
|
|
24392
24465
|
import { cp } from "fs/promises";
|
|
24393
|
-
import
|
|
24466
|
+
import chalk149 from "chalk";
|
|
24394
24467
|
|
|
24395
24468
|
// src/commands/extension/extensionDir.ts
|
|
24396
24469
|
import { existsSync as existsSync49 } from "fs";
|
|
@@ -24413,21 +24486,21 @@ async function loadPath(source) {
|
|
|
24413
24486
|
return WSL_WINDOWS_PATH;
|
|
24414
24487
|
} catch {
|
|
24415
24488
|
console.log(
|
|
24416
|
-
|
|
24489
|
+
chalk149.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
24417
24490
|
);
|
|
24418
24491
|
return source;
|
|
24419
24492
|
}
|
|
24420
24493
|
}
|
|
24421
24494
|
async function extension() {
|
|
24422
24495
|
const path109 = await loadPath(extensionDir());
|
|
24423
|
-
console.log(
|
|
24424
|
-
console.log(
|
|
24496
|
+
console.log(chalk149.bold("assist \u2014 GitHub browser extension"));
|
|
24497
|
+
console.log(chalk149.dim(`load the unpacked extension from ${path109}`));
|
|
24425
24498
|
}
|
|
24426
24499
|
|
|
24427
24500
|
// src/commands/extension/printExtensionUrl.ts
|
|
24428
24501
|
import { readFile as readFile4 } from "fs/promises";
|
|
24429
24502
|
import { join as join56 } from "path";
|
|
24430
|
-
import
|
|
24503
|
+
import chalk150 from "chalk";
|
|
24431
24504
|
|
|
24432
24505
|
// src/commands/extension/latestUpdate.ts
|
|
24433
24506
|
function latestUpdate(manifest, updates2) {
|
|
@@ -24450,7 +24523,7 @@ async function printExtensionUrl() {
|
|
|
24450
24523
|
const response = await fetch(update_url);
|
|
24451
24524
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
24452
24525
|
if (!link3) {
|
|
24453
|
-
console.log(
|
|
24526
|
+
console.log(chalk150.red(`no signed build found in ${update_url}`));
|
|
24454
24527
|
process.exitCode = 1;
|
|
24455
24528
|
return;
|
|
24456
24529
|
}
|
|
@@ -24461,7 +24534,7 @@ async function printExtensionUrl() {
|
|
|
24461
24534
|
import { rm as rm2 } from "fs/promises";
|
|
24462
24535
|
import { homedir as homedir22, tmpdir as tmpdir3 } from "os";
|
|
24463
24536
|
import { join as join62 } from "path";
|
|
24464
|
-
import
|
|
24537
|
+
import chalk152 from "chalk";
|
|
24465
24538
|
|
|
24466
24539
|
// src/commands/extension/copySignedXpi.ts
|
|
24467
24540
|
import { copyFile } from "fs/promises";
|
|
@@ -24486,7 +24559,7 @@ async function findSignedXpi(dir) {
|
|
|
24486
24559
|
|
|
24487
24560
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
24488
24561
|
import { cp as cp2 } from "fs/promises";
|
|
24489
|
-
import
|
|
24562
|
+
import chalk151 from "chalk";
|
|
24490
24563
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
24491
24564
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
24492
24565
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -24496,7 +24569,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
24496
24569
|
return WSL_WINDOWS_PATH2;
|
|
24497
24570
|
} catch {
|
|
24498
24571
|
console.log(
|
|
24499
|
-
|
|
24572
|
+
chalk151.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
24500
24573
|
);
|
|
24501
24574
|
return xpi;
|
|
24502
24575
|
}
|
|
@@ -24589,15 +24662,15 @@ async function signExtension() {
|
|
|
24589
24662
|
const source = extensionDir();
|
|
24590
24663
|
const problem = signPreflightProblem(source);
|
|
24591
24664
|
if (problem) {
|
|
24592
|
-
console.log(
|
|
24593
|
-
console.log(
|
|
24665
|
+
console.log(chalk152.red(problem.message));
|
|
24666
|
+
console.log(chalk152.dim(problem.hint));
|
|
24594
24667
|
process.exitCode = 1;
|
|
24595
24668
|
return;
|
|
24596
24669
|
}
|
|
24597
24670
|
const { version: version2 } = package_default;
|
|
24598
24671
|
await stageExtension(source, STAGING_DIR, version2);
|
|
24599
24672
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
24600
|
-
console.log(
|
|
24673
|
+
console.log(chalk152.bold(`signing version ${version2} for self-distribution`));
|
|
24601
24674
|
const { done: done2 } = spawnInherit("npx", [
|
|
24602
24675
|
"--yes",
|
|
24603
24676
|
"web-ext",
|
|
@@ -24607,13 +24680,13 @@ async function signExtension() {
|
|
|
24607
24680
|
"--channel=unlisted"
|
|
24608
24681
|
]);
|
|
24609
24682
|
if (await done2 !== 0) {
|
|
24610
|
-
console.log(
|
|
24683
|
+
console.log(chalk152.red("web-ext sign failed"));
|
|
24611
24684
|
process.exitCode = 1;
|
|
24612
24685
|
return;
|
|
24613
24686
|
}
|
|
24614
24687
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
24615
24688
|
if (!xpi) {
|
|
24616
|
-
console.log(
|
|
24689
|
+
console.log(chalk152.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
24617
24690
|
process.exitCode = 1;
|
|
24618
24691
|
return;
|
|
24619
24692
|
}
|
|
@@ -24621,7 +24694,7 @@ async function signExtension() {
|
|
|
24621
24694
|
const path109 = await signedAddonInstallPath(
|
|
24622
24695
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
24623
24696
|
);
|
|
24624
|
-
console.log(
|
|
24697
|
+
console.log(chalk152.dim(`install the signed add-on from ${path109}`));
|
|
24625
24698
|
}
|
|
24626
24699
|
|
|
24627
24700
|
// src/commands/registerExtension.ts
|
|
@@ -24682,11 +24755,11 @@ async function dropRetiredTables(exec3) {
|
|
|
24682
24755
|
}
|
|
24683
24756
|
|
|
24684
24757
|
// src/commands/db/reportRetiredTables.ts
|
|
24685
|
-
import
|
|
24758
|
+
import chalk153 from "chalk";
|
|
24686
24759
|
function reportRetiredTables(tables) {
|
|
24687
24760
|
for (const table of tables) {
|
|
24688
24761
|
console.error(
|
|
24689
|
-
|
|
24762
|
+
chalk153.yellow(
|
|
24690
24763
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
24691
24764
|
)
|
|
24692
24765
|
);
|
|
@@ -24694,40 +24767,40 @@ function reportRetiredTables(tables) {
|
|
|
24694
24767
|
}
|
|
24695
24768
|
|
|
24696
24769
|
// src/commands/db/reportMigrationStatus.ts
|
|
24697
|
-
import
|
|
24770
|
+
import chalk154 from "chalk";
|
|
24698
24771
|
function reportApplied(applied) {
|
|
24699
24772
|
if (applied.length === 0) {
|
|
24700
|
-
console.error(
|
|
24773
|
+
console.error(chalk154.green("Database is up to date; nothing to apply."));
|
|
24701
24774
|
return;
|
|
24702
24775
|
}
|
|
24703
24776
|
for (const migration of applied) {
|
|
24704
24777
|
console.error(
|
|
24705
|
-
|
|
24778
|
+
chalk154.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
24706
24779
|
);
|
|
24707
24780
|
}
|
|
24708
24781
|
}
|
|
24709
24782
|
function reportMigrationStatus(status2) {
|
|
24710
24783
|
if (status2.state === "in-sync") {
|
|
24711
24784
|
console.error(
|
|
24712
|
-
|
|
24785
|
+
chalk154.green(`In sync at migration ${status2.version} (latest).`)
|
|
24713
24786
|
);
|
|
24714
24787
|
return;
|
|
24715
24788
|
}
|
|
24716
24789
|
if (status2.state === "behind") {
|
|
24717
24790
|
console.error(
|
|
24718
|
-
|
|
24791
|
+
chalk154.yellow(
|
|
24719
24792
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
24720
24793
|
)
|
|
24721
24794
|
);
|
|
24722
24795
|
console.error(
|
|
24723
|
-
|
|
24796
|
+
chalk154.yellow(
|
|
24724
24797
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
24725
24798
|
)
|
|
24726
24799
|
);
|
|
24727
24800
|
return;
|
|
24728
24801
|
}
|
|
24729
24802
|
console.error(
|
|
24730
|
-
|
|
24803
|
+
chalk154.red(
|
|
24731
24804
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
24732
24805
|
)
|
|
24733
24806
|
);
|
|
@@ -24769,7 +24842,7 @@ function registerDb(program) {
|
|
|
24769
24842
|
|
|
24770
24843
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
24771
24844
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync28 } from "fs";
|
|
24772
|
-
import
|
|
24845
|
+
import chalk155 from "chalk";
|
|
24773
24846
|
|
|
24774
24847
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
24775
24848
|
import { join as join63 } from "path";
|
|
@@ -24800,7 +24873,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24800
24873
|
sweepRestrictedDir();
|
|
24801
24874
|
const state = readMigrationPinState(pin2);
|
|
24802
24875
|
if (!state) {
|
|
24803
|
-
console.error(
|
|
24876
|
+
console.error(chalk155.red(`No pending migration unlock for pin: ${pin2}`));
|
|
24804
24877
|
process.exitCode = 1;
|
|
24805
24878
|
return;
|
|
24806
24879
|
}
|
|
@@ -24810,7 +24883,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24810
24883
|
);
|
|
24811
24884
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
24812
24885
|
console.log(
|
|
24813
|
-
|
|
24886
|
+
chalk155.green(
|
|
24814
24887
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
24815
24888
|
)
|
|
24816
24889
|
);
|
|
@@ -24819,7 +24892,7 @@ function dbMigrationConfirm(pin2) {
|
|
|
24819
24892
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
24820
24893
|
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
24821
24894
|
import { randomInt as randomInt2 } from "crypto";
|
|
24822
|
-
import
|
|
24895
|
+
import chalk156 from "chalk";
|
|
24823
24896
|
|
|
24824
24897
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
24825
24898
|
function nextMigrationId() {
|
|
@@ -24834,7 +24907,7 @@ function dbMigrationUnlock() {
|
|
|
24834
24907
|
sweepRestrictedDir();
|
|
24835
24908
|
writeFileSync29(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
24836
24909
|
console.error(
|
|
24837
|
-
|
|
24910
|
+
chalk156.yellow.bold(
|
|
24838
24911
|
"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."
|
|
24839
24912
|
)
|
|
24840
24913
|
);
|
|
@@ -24844,7 +24917,7 @@ function dbMigrationUnlock() {
|
|
|
24844
24917
|
});
|
|
24845
24918
|
if (!delivered) {
|
|
24846
24919
|
console.error(
|
|
24847
|
-
|
|
24920
|
+
chalk156.red(
|
|
24848
24921
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
24849
24922
|
)
|
|
24850
24923
|
);
|
|
@@ -24854,7 +24927,7 @@ function dbMigrationUnlock() {
|
|
|
24854
24927
|
console.log(
|
|
24855
24928
|
`A confirmation pin was sent to your desktop notifications.
|
|
24856
24929
|
To approve creating migration ${migrationId}, run:
|
|
24857
|
-
${
|
|
24930
|
+
${chalk156.cyan(" assist db-migration confirm <PIN>")}
|
|
24858
24931
|
using the pin from that notification.`
|
|
24859
24932
|
);
|
|
24860
24933
|
}
|
|
@@ -24881,7 +24954,7 @@ function registerDbMigration(parent) {
|
|
|
24881
24954
|
|
|
24882
24955
|
// src/commands/deploy/redirect.ts
|
|
24883
24956
|
import { existsSync as existsSync53, readFileSync as readFileSync35, writeFileSync as writeFileSync30 } from "fs";
|
|
24884
|
-
import
|
|
24957
|
+
import chalk157 from "chalk";
|
|
24885
24958
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
24886
24959
|
if (!window.location.pathname.endsWith('/')) {
|
|
24887
24960
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -24890,23 +24963,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
24890
24963
|
function redirect() {
|
|
24891
24964
|
const indexPath = "index.html";
|
|
24892
24965
|
if (!existsSync53(indexPath)) {
|
|
24893
|
-
console.log(
|
|
24966
|
+
console.log(chalk157.yellow("No index.html found"));
|
|
24894
24967
|
return;
|
|
24895
24968
|
}
|
|
24896
24969
|
const content = readFileSync35(indexPath, "utf8");
|
|
24897
24970
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
24898
|
-
console.log(
|
|
24971
|
+
console.log(chalk157.dim("Trailing slash script already present"));
|
|
24899
24972
|
return;
|
|
24900
24973
|
}
|
|
24901
24974
|
const headCloseIndex = content.indexOf("</head>");
|
|
24902
24975
|
if (headCloseIndex === -1) {
|
|
24903
|
-
console.log(
|
|
24976
|
+
console.log(chalk157.red("Could not find </head> tag in index.html"));
|
|
24904
24977
|
return;
|
|
24905
24978
|
}
|
|
24906
24979
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
24907
24980
|
${content.slice(headCloseIndex)}`;
|
|
24908
24981
|
writeFileSync30(indexPath, newContent);
|
|
24909
|
-
console.log(
|
|
24982
|
+
console.log(chalk157.green("Added trailing slash redirect to index.html"));
|
|
24910
24983
|
}
|
|
24911
24984
|
|
|
24912
24985
|
// src/commands/registerDeploy.ts
|
|
@@ -24933,7 +25006,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
24933
25006
|
|
|
24934
25007
|
// src/commands/devlog/shared.ts
|
|
24935
25008
|
import { execSync as execSync33 } from "child_process";
|
|
24936
|
-
import
|
|
25009
|
+
import chalk158 from "chalk";
|
|
24937
25010
|
|
|
24938
25011
|
// src/shared/getRepoName.ts
|
|
24939
25012
|
import { existsSync as existsSync54, readFileSync as readFileSync36 } from "fs";
|
|
@@ -25042,13 +25115,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
25042
25115
|
}
|
|
25043
25116
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
25044
25117
|
for (const commit2 of commits2) {
|
|
25045
|
-
console.log(` ${
|
|
25118
|
+
console.log(` ${chalk158.yellow(commit2.hash)} ${commit2.message}`);
|
|
25046
25119
|
if (verbose) {
|
|
25047
25120
|
const visibleFiles = commit2.files.filter(
|
|
25048
25121
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
25049
25122
|
);
|
|
25050
25123
|
for (const file of visibleFiles) {
|
|
25051
|
-
console.log(` ${
|
|
25124
|
+
console.log(` ${chalk158.dim(file)}`);
|
|
25052
25125
|
}
|
|
25053
25126
|
}
|
|
25054
25127
|
}
|
|
@@ -25073,15 +25146,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
25073
25146
|
}
|
|
25074
25147
|
|
|
25075
25148
|
// src/commands/devlog/list/printDateHeader.ts
|
|
25076
|
-
import
|
|
25149
|
+
import chalk159 from "chalk";
|
|
25077
25150
|
function printDateHeader(date, isSkipped, entries) {
|
|
25078
25151
|
if (isSkipped) {
|
|
25079
|
-
console.log(`${
|
|
25152
|
+
console.log(`${chalk159.bold.blue(date)} ${chalk159.dim("skipped")}`);
|
|
25080
25153
|
} else if (entries && entries.length > 0) {
|
|
25081
|
-
const entryInfo = entries.map((e) => `${
|
|
25082
|
-
console.log(`${
|
|
25154
|
+
const entryInfo = entries.map((e) => `${chalk159.green(e.version)} ${e.title}`).join(" | ");
|
|
25155
|
+
console.log(`${chalk159.bold.blue(date)} ${entryInfo}`);
|
|
25083
25156
|
} else {
|
|
25084
|
-
console.log(`${
|
|
25157
|
+
console.log(`${chalk159.bold.blue(date)} ${chalk159.red("\u26A0 devlog missing")}`);
|
|
25085
25158
|
}
|
|
25086
25159
|
}
|
|
25087
25160
|
|
|
@@ -25185,24 +25258,24 @@ function bumpVersion(version2, type) {
|
|
|
25185
25258
|
|
|
25186
25259
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
25187
25260
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
25188
|
-
import
|
|
25261
|
+
import chalk161 from "chalk";
|
|
25189
25262
|
|
|
25190
25263
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
25191
|
-
import
|
|
25264
|
+
import chalk160 from "chalk";
|
|
25192
25265
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
25193
25266
|
if (conventional && firstHash) {
|
|
25194
25267
|
const version2 = getVersionAtCommit(firstHash);
|
|
25195
25268
|
if (version2) {
|
|
25196
|
-
console.log(`${
|
|
25269
|
+
console.log(`${chalk160.bold("version:")} ${stripToMinor(version2)}`);
|
|
25197
25270
|
} else {
|
|
25198
|
-
console.log(`${
|
|
25271
|
+
console.log(`${chalk160.bold("version:")} ${chalk160.red("unknown")}`);
|
|
25199
25272
|
}
|
|
25200
25273
|
} else if (patchVersion && minorVersion) {
|
|
25201
25274
|
console.log(
|
|
25202
|
-
`${
|
|
25275
|
+
`${chalk160.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
25203
25276
|
);
|
|
25204
25277
|
} else {
|
|
25205
|
-
console.log(`${
|
|
25278
|
+
console.log(`${chalk160.bold("version:")} v0.1 (initial)`);
|
|
25206
25279
|
}
|
|
25207
25280
|
}
|
|
25208
25281
|
|
|
@@ -25250,16 +25323,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
25250
25323
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
25251
25324
|
}
|
|
25252
25325
|
function logName(repoName) {
|
|
25253
|
-
console.log(`${
|
|
25326
|
+
console.log(`${chalk161.bold("name:")} ${repoName}`);
|
|
25254
25327
|
}
|
|
25255
25328
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
25256
25329
|
logName(ctx.repoName);
|
|
25257
25330
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
25258
|
-
console.log(
|
|
25331
|
+
console.log(chalk161.bold.blue(targetDate));
|
|
25259
25332
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
25260
25333
|
}
|
|
25261
25334
|
function logNoCommits(lastInfo) {
|
|
25262
|
-
console.log(
|
|
25335
|
+
console.log(chalk161.dim(noCommitsMessage(!!lastInfo)));
|
|
25263
25336
|
}
|
|
25264
25337
|
|
|
25265
25338
|
// src/commands/devlog/next.ts
|
|
@@ -25300,11 +25373,11 @@ function next2(options2) {
|
|
|
25300
25373
|
import { execSync as execSync35 } from "child_process";
|
|
25301
25374
|
|
|
25302
25375
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25303
|
-
import
|
|
25376
|
+
import chalk162 from "chalk";
|
|
25304
25377
|
function colorStatus(status2) {
|
|
25305
|
-
if (status2 === "missing") return
|
|
25306
|
-
if (status2 === "outdated") return
|
|
25307
|
-
return
|
|
25378
|
+
if (status2 === "missing") return chalk162.red(status2);
|
|
25379
|
+
if (status2 === "outdated") return chalk162.yellow(status2);
|
|
25380
|
+
return chalk162.green(status2);
|
|
25308
25381
|
}
|
|
25309
25382
|
function formatRow(row3, nameWidth) {
|
|
25310
25383
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -25318,8 +25391,8 @@ function printReposTable(rows) {
|
|
|
25318
25391
|
"Last Devlog".padEnd(11),
|
|
25319
25392
|
"Status"
|
|
25320
25393
|
].join(" ");
|
|
25321
|
-
console.log(
|
|
25322
|
-
console.log(
|
|
25394
|
+
console.log(chalk162.dim(header));
|
|
25395
|
+
console.log(chalk162.dim("-".repeat(header.length)));
|
|
25323
25396
|
for (const row3 of rows) {
|
|
25324
25397
|
console.log(formatRow(row3, nameWidth));
|
|
25325
25398
|
}
|
|
@@ -25377,14 +25450,14 @@ function repos(options2) {
|
|
|
25377
25450
|
// src/commands/devlog/skip.ts
|
|
25378
25451
|
import { writeFileSync as writeFileSync31 } from "fs";
|
|
25379
25452
|
import { join as join67 } from "path";
|
|
25380
|
-
import
|
|
25453
|
+
import chalk163 from "chalk";
|
|
25381
25454
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
25382
25455
|
function getBlogConfigPath() {
|
|
25383
25456
|
return join67(BLOG_REPO_ROOT, "assist.yml");
|
|
25384
25457
|
}
|
|
25385
25458
|
function skip2(date) {
|
|
25386
25459
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
25387
|
-
console.log(
|
|
25460
|
+
console.log(chalk163.red("Invalid date format. Use YYYY-MM-DD"));
|
|
25388
25461
|
process.exit(1);
|
|
25389
25462
|
}
|
|
25390
25463
|
const repoName = getRepoName();
|
|
@@ -25395,7 +25468,7 @@ function skip2(date) {
|
|
|
25395
25468
|
const skipDays = skip3[repoName] ?? [];
|
|
25396
25469
|
if (skipDays.includes(date)) {
|
|
25397
25470
|
console.log(
|
|
25398
|
-
|
|
25471
|
+
chalk163.yellow(`${date} is already in skip list for ${repoName}`)
|
|
25399
25472
|
);
|
|
25400
25473
|
return;
|
|
25401
25474
|
}
|
|
@@ -25405,20 +25478,20 @@ function skip2(date) {
|
|
|
25405
25478
|
devlog.skip = skip3;
|
|
25406
25479
|
config.devlog = devlog;
|
|
25407
25480
|
writeFileSync31(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25408
|
-
console.log(
|
|
25481
|
+
console.log(chalk163.green(`Added ${date} to skip list for ${repoName}`));
|
|
25409
25482
|
}
|
|
25410
25483
|
|
|
25411
25484
|
// src/commands/devlog/version.ts
|
|
25412
|
-
import
|
|
25485
|
+
import chalk164 from "chalk";
|
|
25413
25486
|
function version() {
|
|
25414
25487
|
const config = loadConfig();
|
|
25415
25488
|
const name = getRepoName();
|
|
25416
25489
|
const lastInfo = getLastVersionInfo(name, config);
|
|
25417
25490
|
const lastVersion = lastInfo?.version ?? null;
|
|
25418
25491
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
25419
|
-
console.log(`${
|
|
25420
|
-
console.log(`${
|
|
25421
|
-
console.log(`${
|
|
25492
|
+
console.log(`${chalk164.bold("name:")} ${name}`);
|
|
25493
|
+
console.log(`${chalk164.bold("last:")} ${lastVersion ?? chalk164.dim("none")}`);
|
|
25494
|
+
console.log(`${chalk164.bold("next:")} ${nextVersion ?? chalk164.dim("none")}`);
|
|
25422
25495
|
}
|
|
25423
25496
|
|
|
25424
25497
|
// src/commands/registerDevlog.ts
|
|
@@ -25443,7 +25516,7 @@ function registerDevlog(program) {
|
|
|
25443
25516
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
25444
25517
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
25445
25518
|
import { join as join68 } from "path";
|
|
25446
|
-
import
|
|
25519
|
+
import chalk165 from "chalk";
|
|
25447
25520
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
25448
25521
|
function isLockedDll(debugDir) {
|
|
25449
25522
|
let files;
|
|
@@ -25490,14 +25563,14 @@ function checkBuildLocks(startDir) {
|
|
|
25490
25563
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
25491
25564
|
if (locked) {
|
|
25492
25565
|
console.error(
|
|
25493
|
-
|
|
25566
|
+
chalk165.red("Build output locked (is VS debugging?): ") + locked
|
|
25494
25567
|
);
|
|
25495
25568
|
process.exit(1);
|
|
25496
25569
|
}
|
|
25497
25570
|
}
|
|
25498
25571
|
async function checkBuildLocksCommand() {
|
|
25499
25572
|
checkBuildLocks();
|
|
25500
|
-
console.log(
|
|
25573
|
+
console.log(chalk165.green("No build locks detected"));
|
|
25501
25574
|
}
|
|
25502
25575
|
|
|
25503
25576
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -25596,30 +25669,30 @@ function escapeRegex(s) {
|
|
|
25596
25669
|
}
|
|
25597
25670
|
|
|
25598
25671
|
// src/commands/dotnet/printTree.ts
|
|
25599
|
-
import
|
|
25672
|
+
import chalk166 from "chalk";
|
|
25600
25673
|
function printNodes(nodes, prefix2) {
|
|
25601
25674
|
for (let i = 0; i < nodes.length; i++) {
|
|
25602
25675
|
const isLast = i === nodes.length - 1;
|
|
25603
25676
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
25604
25677
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
25605
25678
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
25606
|
-
const label = isMissing ?
|
|
25679
|
+
const label = isMissing ? chalk166.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
25607
25680
|
console.log(`${prefix2}${connector}${label}`);
|
|
25608
25681
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
25609
25682
|
}
|
|
25610
25683
|
}
|
|
25611
25684
|
function printTree(tree, totalCount, solutions) {
|
|
25612
|
-
console.log(
|
|
25613
|
-
console.log(
|
|
25685
|
+
console.log(chalk166.bold("\nProject Dependency Tree"));
|
|
25686
|
+
console.log(chalk166.cyan(tree.relativePath));
|
|
25614
25687
|
printNodes(tree.children, "");
|
|
25615
|
-
console.log(
|
|
25688
|
+
console.log(chalk166.dim(`
|
|
25616
25689
|
${totalCount} projects total (including root)`));
|
|
25617
|
-
console.log(
|
|
25690
|
+
console.log(chalk166.bold("\nSolution Membership"));
|
|
25618
25691
|
if (solutions.length === 0) {
|
|
25619
|
-
console.log(
|
|
25692
|
+
console.log(chalk166.yellow(" Not found in any .sln"));
|
|
25620
25693
|
} else {
|
|
25621
25694
|
for (const sln of solutions) {
|
|
25622
|
-
console.log(` ${
|
|
25695
|
+
console.log(` ${chalk166.green(sln)}`);
|
|
25623
25696
|
}
|
|
25624
25697
|
}
|
|
25625
25698
|
console.log();
|
|
@@ -25648,16 +25721,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
25648
25721
|
// src/commands/dotnet/resolveCsproj.ts
|
|
25649
25722
|
import { existsSync as existsSync55 } from "fs";
|
|
25650
25723
|
import path37 from "path";
|
|
25651
|
-
import
|
|
25724
|
+
import chalk167 from "chalk";
|
|
25652
25725
|
function resolveCsproj(csprojPath) {
|
|
25653
25726
|
const resolved = path37.resolve(csprojPath);
|
|
25654
25727
|
if (!existsSync55(resolved)) {
|
|
25655
|
-
console.error(
|
|
25728
|
+
console.error(chalk167.red(`File not found: ${resolved}`));
|
|
25656
25729
|
process.exit(1);
|
|
25657
25730
|
}
|
|
25658
25731
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
25659
25732
|
if (!repoRoot2) {
|
|
25660
|
-
console.error(
|
|
25733
|
+
console.error(chalk167.red("Could not find git repository root"));
|
|
25661
25734
|
process.exit(1);
|
|
25662
25735
|
}
|
|
25663
25736
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -25707,12 +25780,12 @@ function getChangedCsFiles(scope) {
|
|
|
25707
25780
|
}
|
|
25708
25781
|
|
|
25709
25782
|
// src/commands/dotnet/inSln.ts
|
|
25710
|
-
import
|
|
25783
|
+
import chalk168 from "chalk";
|
|
25711
25784
|
async function inSln(csprojPath) {
|
|
25712
25785
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
25713
25786
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
25714
25787
|
if (solutions.length === 0) {
|
|
25715
|
-
console.log(
|
|
25788
|
+
console.log(chalk168.yellow("Not found in any .sln file"));
|
|
25716
25789
|
process.exit(1);
|
|
25717
25790
|
}
|
|
25718
25791
|
for (const sln of solutions) {
|
|
@@ -25721,7 +25794,7 @@ async function inSln(csprojPath) {
|
|
|
25721
25794
|
}
|
|
25722
25795
|
|
|
25723
25796
|
// src/commands/dotnet/inspect.ts
|
|
25724
|
-
import
|
|
25797
|
+
import chalk174 from "chalk";
|
|
25725
25798
|
|
|
25726
25799
|
// src/shared/formatElapsed.ts
|
|
25727
25800
|
function formatElapsed(ms) {
|
|
@@ -25733,12 +25806,12 @@ function formatElapsed(ms) {
|
|
|
25733
25806
|
}
|
|
25734
25807
|
|
|
25735
25808
|
// src/commands/dotnet/displayIssues.ts
|
|
25736
|
-
import
|
|
25809
|
+
import chalk169 from "chalk";
|
|
25737
25810
|
var SEVERITY_COLOR = {
|
|
25738
|
-
ERROR:
|
|
25739
|
-
WARNING:
|
|
25740
|
-
SUGGESTION:
|
|
25741
|
-
HINT:
|
|
25811
|
+
ERROR: chalk169.red,
|
|
25812
|
+
WARNING: chalk169.yellow,
|
|
25813
|
+
SUGGESTION: chalk169.cyan,
|
|
25814
|
+
HINT: chalk169.dim
|
|
25742
25815
|
};
|
|
25743
25816
|
function groupByFile(issues) {
|
|
25744
25817
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -25754,15 +25827,15 @@ function groupByFile(issues) {
|
|
|
25754
25827
|
}
|
|
25755
25828
|
function displayIssues(issues) {
|
|
25756
25829
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
25757
|
-
console.log(
|
|
25830
|
+
console.log(chalk169.bold(file));
|
|
25758
25831
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
25759
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
25832
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk169.white;
|
|
25760
25833
|
console.log(
|
|
25761
|
-
` ${
|
|
25834
|
+
` ${chalk169.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
25762
25835
|
);
|
|
25763
25836
|
}
|
|
25764
25837
|
}
|
|
25765
|
-
console.log(
|
|
25838
|
+
console.log(chalk169.dim(`
|
|
25766
25839
|
${issues.length} issue(s) found`));
|
|
25767
25840
|
}
|
|
25768
25841
|
|
|
@@ -25821,12 +25894,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
25821
25894
|
// src/commands/dotnet/resolveSolution.ts
|
|
25822
25895
|
import { existsSync as existsSync56 } from "fs";
|
|
25823
25896
|
import path38 from "path";
|
|
25824
|
-
import
|
|
25897
|
+
import chalk171 from "chalk";
|
|
25825
25898
|
|
|
25826
25899
|
// src/commands/dotnet/findSolution.ts
|
|
25827
25900
|
import { readdirSync as readdirSync11 } from "fs";
|
|
25828
25901
|
import { dirname as dirname30, join as join69 } from "path";
|
|
25829
|
-
import
|
|
25902
|
+
import chalk170 from "chalk";
|
|
25830
25903
|
function findSlnInDir(dir) {
|
|
25831
25904
|
try {
|
|
25832
25905
|
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join69(dir, f));
|
|
@@ -25842,17 +25915,17 @@ function findSolution() {
|
|
|
25842
25915
|
const slnFiles = findSlnInDir(current);
|
|
25843
25916
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
25844
25917
|
if (slnFiles.length > 1) {
|
|
25845
|
-
console.error(
|
|
25918
|
+
console.error(chalk170.red(`Multiple .sln files found in ${current}:`));
|
|
25846
25919
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
25847
25920
|
console.error(
|
|
25848
|
-
|
|
25921
|
+
chalk170.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
25849
25922
|
);
|
|
25850
25923
|
process.exit(1);
|
|
25851
25924
|
}
|
|
25852
25925
|
if (current === ceiling) break;
|
|
25853
25926
|
current = dirname30(current);
|
|
25854
25927
|
}
|
|
25855
|
-
console.error(
|
|
25928
|
+
console.error(chalk170.red("No .sln file found between cwd and repo root"));
|
|
25856
25929
|
process.exit(1);
|
|
25857
25930
|
}
|
|
25858
25931
|
|
|
@@ -25861,7 +25934,7 @@ function resolveSolution(sln) {
|
|
|
25861
25934
|
if (sln) {
|
|
25862
25935
|
const resolved = path38.resolve(sln);
|
|
25863
25936
|
if (!existsSync56(resolved)) {
|
|
25864
|
-
console.error(
|
|
25937
|
+
console.error(chalk171.red(`Solution file not found: ${resolved}`));
|
|
25865
25938
|
process.exit(1);
|
|
25866
25939
|
}
|
|
25867
25940
|
return resolved;
|
|
@@ -25903,14 +25976,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
25903
25976
|
import { existsSync as existsSync57, readFileSync as readFileSync40, unlinkSync as unlinkSync10 } from "fs";
|
|
25904
25977
|
import { tmpdir as tmpdir4 } from "os";
|
|
25905
25978
|
import path39 from "path";
|
|
25906
|
-
import
|
|
25979
|
+
import chalk172 from "chalk";
|
|
25907
25980
|
function assertJbInstalled() {
|
|
25908
25981
|
try {
|
|
25909
25982
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
25910
25983
|
} catch {
|
|
25911
|
-
console.error(
|
|
25984
|
+
console.error(chalk172.red("jb is not installed. Install with:"));
|
|
25912
25985
|
console.error(
|
|
25913
|
-
|
|
25986
|
+
chalk172.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
25914
25987
|
);
|
|
25915
25988
|
process.exit(1);
|
|
25916
25989
|
}
|
|
@@ -25928,11 +26001,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25928
26001
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
25929
26002
|
process.stderr.write(error.stderr);
|
|
25930
26003
|
}
|
|
25931
|
-
console.error(
|
|
26004
|
+
console.error(chalk172.red("jb inspectcode failed"));
|
|
25932
26005
|
process.exit(1);
|
|
25933
26006
|
}
|
|
25934
26007
|
if (!existsSync57(reportPath)) {
|
|
25935
|
-
console.error(
|
|
26008
|
+
console.error(chalk172.red("Report file not generated"));
|
|
25936
26009
|
process.exit(1);
|
|
25937
26010
|
}
|
|
25938
26011
|
const xml = readFileSync40(reportPath, "utf8");
|
|
@@ -25942,7 +26015,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
25942
26015
|
|
|
25943
26016
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
25944
26017
|
import { execSync as execSync38 } from "child_process";
|
|
25945
|
-
import
|
|
26018
|
+
import chalk173 from "chalk";
|
|
25946
26019
|
function resolveMsbuildPath() {
|
|
25947
26020
|
const { run: run4 } = loadConfig();
|
|
25948
26021
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -25954,9 +26027,9 @@ function assertMsbuildInstalled() {
|
|
|
25954
26027
|
try {
|
|
25955
26028
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
25956
26029
|
} catch {
|
|
25957
|
-
console.error(
|
|
26030
|
+
console.error(chalk173.red(`msbuild not found at: ${msbuild}`));
|
|
25958
26031
|
console.error(
|
|
25959
|
-
|
|
26032
|
+
chalk173.yellow(
|
|
25960
26033
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
25961
26034
|
)
|
|
25962
26035
|
);
|
|
@@ -26003,17 +26076,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
26003
26076
|
// src/commands/dotnet/inspect.ts
|
|
26004
26077
|
function logScope(changedFiles2) {
|
|
26005
26078
|
if (changedFiles2 === null) {
|
|
26006
|
-
console.log(
|
|
26079
|
+
console.log(chalk174.dim("Inspecting full solution..."));
|
|
26007
26080
|
} else {
|
|
26008
26081
|
console.log(
|
|
26009
|
-
|
|
26082
|
+
chalk174.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
26010
26083
|
);
|
|
26011
26084
|
}
|
|
26012
26085
|
}
|
|
26013
26086
|
function reportResults(issues, elapsed) {
|
|
26014
26087
|
if (issues.length > 0) displayIssues(issues);
|
|
26015
|
-
else console.log(
|
|
26016
|
-
console.log(
|
|
26088
|
+
else console.log(chalk174.green("No issues found"));
|
|
26089
|
+
console.log(chalk174.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
26017
26090
|
if (issues.length > 0) process.exit(1);
|
|
26018
26091
|
}
|
|
26019
26092
|
async function inspect(sln, options2) {
|
|
@@ -26024,7 +26097,7 @@ async function inspect(sln, options2) {
|
|
|
26024
26097
|
const scope = parseScope(options2.scope);
|
|
26025
26098
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
26026
26099
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
26027
|
-
console.log(
|
|
26100
|
+
console.log(chalk174.green("No changed .cs files found"));
|
|
26028
26101
|
return;
|
|
26029
26102
|
}
|
|
26030
26103
|
logScope(changedFiles2);
|
|
@@ -26912,25 +26985,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
26912
26985
|
}
|
|
26913
26986
|
|
|
26914
26987
|
// src/commands/github/printCountTable.ts
|
|
26915
|
-
import
|
|
26988
|
+
import chalk175 from "chalk";
|
|
26916
26989
|
function printCountTable(labelHeader, rows) {
|
|
26917
26990
|
const labelWidth = Math.max(
|
|
26918
26991
|
labelHeader.length,
|
|
26919
26992
|
...rows.map((row3) => row3.label.length)
|
|
26920
26993
|
);
|
|
26921
26994
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
26922
|
-
console.log(
|
|
26923
|
-
console.log(
|
|
26995
|
+
console.log(chalk175.dim(header));
|
|
26996
|
+
console.log(chalk175.dim("-".repeat(header.length)));
|
|
26924
26997
|
for (const row3 of rows) {
|
|
26925
26998
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
26926
26999
|
}
|
|
26927
27000
|
}
|
|
26928
27001
|
|
|
26929
27002
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
26930
|
-
import
|
|
27003
|
+
import chalk176 from "chalk";
|
|
26931
27004
|
function printRepoAuthorBreakdown(repos2) {
|
|
26932
27005
|
for (const repo of repos2) {
|
|
26933
|
-
console.log(
|
|
27006
|
+
console.log(chalk176.bold(repo.name));
|
|
26934
27007
|
const authorWidth = Math.max(
|
|
26935
27008
|
0,
|
|
26936
27009
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -27004,10 +27077,10 @@ function parseSinceDate(value) {
|
|
|
27004
27077
|
}
|
|
27005
27078
|
|
|
27006
27079
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
27007
|
-
import
|
|
27080
|
+
import chalk178 from "chalk";
|
|
27008
27081
|
|
|
27009
27082
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27010
|
-
import
|
|
27083
|
+
import chalk177 from "chalk";
|
|
27011
27084
|
|
|
27012
27085
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
27013
27086
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -27044,7 +27117,7 @@ function writeLineNow(line) {
|
|
|
27044
27117
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27045
27118
|
function applyFixStructurePlan(plan2) {
|
|
27046
27119
|
for (const entry of plan2.entries) {
|
|
27047
|
-
const where =
|
|
27120
|
+
const where = chalk177.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27048
27121
|
const { typeChange, labelRemovals } = entry;
|
|
27049
27122
|
if (typeChange) {
|
|
27050
27123
|
writeLineNow(
|
|
@@ -27314,12 +27387,12 @@ function planSubtree(root2, context) {
|
|
|
27314
27387
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27315
27388
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27316
27389
|
applyFixStructurePlan(plan2);
|
|
27317
|
-
writeLineNow(
|
|
27390
|
+
writeLineNow(chalk178.dim("Re-walking the subtree to confirm"));
|
|
27318
27391
|
assertNoResidualDrift(
|
|
27319
27392
|
planSubtree(fetchRootIssue(target), context),
|
|
27320
27393
|
context.chain
|
|
27321
27394
|
);
|
|
27322
|
-
writeLineNow(
|
|
27395
|
+
writeLineNow(chalk178.green("Subtree normalised"));
|
|
27323
27396
|
}
|
|
27324
27397
|
|
|
27325
27398
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27355,22 +27428,22 @@ function parseTypeChain(value) {
|
|
|
27355
27428
|
}
|
|
27356
27429
|
|
|
27357
27430
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27358
|
-
import
|
|
27431
|
+
import chalk179 from "chalk";
|
|
27359
27432
|
function annotate(entry) {
|
|
27360
27433
|
const notes = [];
|
|
27361
27434
|
if (entry.level === null) {
|
|
27362
|
-
notes.push(
|
|
27435
|
+
notes.push(chalk179.red("deeper than the leaf level"));
|
|
27363
27436
|
} else if (entry.typeChange) {
|
|
27364
27437
|
notes.push(
|
|
27365
|
-
|
|
27438
|
+
chalk179.yellow(
|
|
27366
27439
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27367
27440
|
)
|
|
27368
27441
|
);
|
|
27369
27442
|
} else {
|
|
27370
|
-
notes.push(
|
|
27443
|
+
notes.push(chalk179.dim(entry.issue.typeName ?? "no type"));
|
|
27371
27444
|
}
|
|
27372
27445
|
for (const label of entry.labelRemovals) {
|
|
27373
|
-
notes.push(
|
|
27446
|
+
notes.push(chalk179.yellow(`-${label.name}`));
|
|
27374
27447
|
}
|
|
27375
27448
|
return notes;
|
|
27376
27449
|
}
|
|
@@ -27378,22 +27451,22 @@ function formatCount(count10, noun) {
|
|
|
27378
27451
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27379
27452
|
}
|
|
27380
27453
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27381
|
-
writeLineNow(
|
|
27454
|
+
writeLineNow(chalk179.dim(`chain: ${chain2.join(" > ")}`));
|
|
27382
27455
|
for (const entry of plan2.entries) {
|
|
27383
27456
|
const indent4 = " ".repeat(entry.issue.depth);
|
|
27384
|
-
const name =
|
|
27457
|
+
const name = chalk179.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27385
27458
|
writeLineNow(
|
|
27386
27459
|
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27387
27460
|
);
|
|
27388
27461
|
}
|
|
27389
27462
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27390
|
-
writeLineNow(
|
|
27463
|
+
writeLineNow(chalk179.green("Nothing to change"));
|
|
27391
27464
|
return;
|
|
27392
27465
|
}
|
|
27393
27466
|
writeLineNow(
|
|
27394
27467
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27395
27468
|
);
|
|
27396
|
-
if (!apply) writeLineNow(
|
|
27469
|
+
if (!apply) writeLineNow(chalk179.dim("Dry run \u2014 nothing written"));
|
|
27397
27470
|
}
|
|
27398
27471
|
|
|
27399
27472
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28800,25 +28873,25 @@ function registerGithub(program) {
|
|
|
28800
28873
|
}
|
|
28801
28874
|
|
|
28802
28875
|
// src/commands/inbox/list.ts
|
|
28803
|
-
import
|
|
28876
|
+
import chalk180 from "chalk";
|
|
28804
28877
|
async function list3() {
|
|
28805
28878
|
const messages = await listInboxMessages(await getDb());
|
|
28806
28879
|
if (messages.length === 0) {
|
|
28807
|
-
console.log(
|
|
28880
|
+
console.log(chalk180.dim("No flagged messages; run assist inbox scan"));
|
|
28808
28881
|
return;
|
|
28809
28882
|
}
|
|
28810
28883
|
for (const message3 of messages) {
|
|
28811
28884
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
28812
28885
|
console.log(
|
|
28813
|
-
`${
|
|
28886
|
+
`${chalk180.dim(when)} ${chalk180.cyan(message3.source)} ${chalk180.bold(message3.sender)}`
|
|
28814
28887
|
);
|
|
28815
28888
|
console.log(` ${message3.summary}`);
|
|
28816
|
-
console.log(` ${
|
|
28889
|
+
console.log(` ${chalk180.dim(message3.link)}`);
|
|
28817
28890
|
}
|
|
28818
28891
|
}
|
|
28819
28892
|
|
|
28820
28893
|
// src/commands/inbox/scan.ts
|
|
28821
|
-
import
|
|
28894
|
+
import chalk181 from "chalk";
|
|
28822
28895
|
|
|
28823
28896
|
// src/shared/db/upsertInboxMessages.ts
|
|
28824
28897
|
async function upsertInboxMessages(orm, messages) {
|
|
@@ -29008,7 +29081,7 @@ async function scan() {
|
|
|
29008
29081
|
)
|
|
29009
29082
|
);
|
|
29010
29083
|
console.log(
|
|
29011
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29084
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk181.bold(added)} new.`
|
|
29012
29085
|
);
|
|
29013
29086
|
}
|
|
29014
29087
|
|
|
@@ -29023,7 +29096,7 @@ function registerInbox(program) {
|
|
|
29023
29096
|
}
|
|
29024
29097
|
|
|
29025
29098
|
// src/commands/jira/acceptanceCriteria.ts
|
|
29026
|
-
import
|
|
29099
|
+
import chalk182 from "chalk";
|
|
29027
29100
|
|
|
29028
29101
|
// src/commands/jira/adfToText.ts
|
|
29029
29102
|
function renderInline(node) {
|
|
@@ -29090,7 +29163,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
29090
29163
|
const parsed = fetchIssue(issueKey, field);
|
|
29091
29164
|
const acValue = parsed?.fields?.[field];
|
|
29092
29165
|
if (!acValue) {
|
|
29093
|
-
console.log(
|
|
29166
|
+
console.log(chalk182.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
29094
29167
|
return;
|
|
29095
29168
|
}
|
|
29096
29169
|
if (typeof acValue === "string") {
|
|
@@ -29156,14 +29229,14 @@ async function jiraAuth() {
|
|
|
29156
29229
|
}
|
|
29157
29230
|
|
|
29158
29231
|
// src/commands/jira/viewIssue.ts
|
|
29159
|
-
import
|
|
29232
|
+
import chalk183 from "chalk";
|
|
29160
29233
|
function viewIssue2(issueKey) {
|
|
29161
29234
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29162
29235
|
const fields = parsed?.fields;
|
|
29163
29236
|
const summary = fields?.summary;
|
|
29164
29237
|
const description = fields?.description;
|
|
29165
29238
|
if (summary) {
|
|
29166
|
-
console.log(
|
|
29239
|
+
console.log(chalk183.bold(summary));
|
|
29167
29240
|
}
|
|
29168
29241
|
if (description) {
|
|
29169
29242
|
if (summary) console.log();
|
|
@@ -29177,7 +29250,7 @@ function viewIssue2(issueKey) {
|
|
|
29177
29250
|
}
|
|
29178
29251
|
if (!summary && !description) {
|
|
29179
29252
|
console.log(
|
|
29180
|
-
|
|
29253
|
+
chalk183.yellow(`No summary or description found on ${issueKey}.`)
|
|
29181
29254
|
);
|
|
29182
29255
|
}
|
|
29183
29256
|
}
|
|
@@ -29884,7 +29957,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
29884
29957
|
}
|
|
29885
29958
|
|
|
29886
29959
|
// src/commands/review/failCheckout.ts
|
|
29887
|
-
import
|
|
29960
|
+
import chalk184 from "chalk";
|
|
29888
29961
|
|
|
29889
29962
|
// src/commands/review/azCliProblem.ts
|
|
29890
29963
|
import { execFileSync as execFileSync17 } from "child_process";
|
|
@@ -29937,14 +30010,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
29937
30010
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
29938
30011
|
if (headRef && stale === "local-work")
|
|
29939
30012
|
console.error(
|
|
29940
|
-
|
|
30013
|
+
chalk184.red(
|
|
29941
30014
|
`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.`
|
|
29942
30015
|
)
|
|
29943
30016
|
);
|
|
29944
30017
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
29945
|
-
if (problem) console.error(
|
|
30018
|
+
if (problem) console.error(chalk184.red(problem));
|
|
29946
30019
|
console.error(
|
|
29947
|
-
|
|
30020
|
+
chalk184.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
29948
30021
|
);
|
|
29949
30022
|
process.exit(1);
|
|
29950
30023
|
}
|
|
@@ -30137,18 +30210,18 @@ function registerList(program) {
|
|
|
30137
30210
|
}
|
|
30138
30211
|
|
|
30139
30212
|
// src/commands/litellm/listModels.ts
|
|
30140
|
-
import
|
|
30213
|
+
import chalk186 from "chalk";
|
|
30141
30214
|
|
|
30142
30215
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30143
|
-
import
|
|
30216
|
+
import chalk185 from "chalk";
|
|
30144
30217
|
function resolveLitellmConfig() {
|
|
30145
30218
|
const { config, missing } = readLitellmConfig();
|
|
30146
30219
|
if (!config) {
|
|
30147
|
-
console.error(
|
|
30220
|
+
console.error(chalk185.red("LiteLLM is not configured"));
|
|
30148
30221
|
for (const key of missing) {
|
|
30149
30222
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30150
30223
|
console.error(
|
|
30151
|
-
|
|
30224
|
+
chalk185.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30152
30225
|
);
|
|
30153
30226
|
}
|
|
30154
30227
|
process.exit(1);
|
|
@@ -30174,13 +30247,13 @@ async function listModels(options2) {
|
|
|
30174
30247
|
} catch (error) {
|
|
30175
30248
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30176
30249
|
console.error(
|
|
30177
|
-
|
|
30250
|
+
chalk186.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30178
30251
|
);
|
|
30179
30252
|
process.exit(1);
|
|
30180
30253
|
}
|
|
30181
30254
|
const body = await response.text();
|
|
30182
30255
|
if (!response.ok) {
|
|
30183
|
-
console.error(
|
|
30256
|
+
console.error(chalk186.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30184
30257
|
process.exit(1);
|
|
30185
30258
|
}
|
|
30186
30259
|
if (options2.json) {
|
|
@@ -30200,15 +30273,15 @@ function registerLitellm(program) {
|
|
|
30200
30273
|
// src/commands/mermaidExport.ts
|
|
30201
30274
|
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
30202
30275
|
import { resolve as resolve21 } from "path";
|
|
30203
|
-
import
|
|
30276
|
+
import chalk189 from "chalk";
|
|
30204
30277
|
|
|
30205
30278
|
// src/commands/mermaid/exportFile.ts
|
|
30206
30279
|
import { readFileSync as readFileSync42, writeFileSync as writeFileSync34 } from "fs";
|
|
30207
30280
|
import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
|
|
30208
|
-
import
|
|
30281
|
+
import chalk188 from "chalk";
|
|
30209
30282
|
|
|
30210
30283
|
// src/commands/mermaid/renderBlock.ts
|
|
30211
|
-
import
|
|
30284
|
+
import chalk187 from "chalk";
|
|
30212
30285
|
async function renderBlock(krokiUrl, source) {
|
|
30213
30286
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30214
30287
|
method: "POST",
|
|
@@ -30217,7 +30290,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
30217
30290
|
});
|
|
30218
30291
|
if (!response.ok) {
|
|
30219
30292
|
console.error(
|
|
30220
|
-
|
|
30293
|
+
chalk187.red(
|
|
30221
30294
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
30222
30295
|
)
|
|
30223
30296
|
);
|
|
@@ -30235,19 +30308,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30235
30308
|
if (onlyIndex !== void 0) {
|
|
30236
30309
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
30237
30310
|
console.error(
|
|
30238
|
-
|
|
30311
|
+
chalk188.red(
|
|
30239
30312
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
30240
30313
|
)
|
|
30241
30314
|
);
|
|
30242
30315
|
process.exit(1);
|
|
30243
30316
|
}
|
|
30244
30317
|
console.log(
|
|
30245
|
-
|
|
30318
|
+
chalk188.gray(
|
|
30246
30319
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
30247
30320
|
)
|
|
30248
30321
|
);
|
|
30249
30322
|
} else {
|
|
30250
|
-
console.log(
|
|
30323
|
+
console.log(chalk188.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
30251
30324
|
}
|
|
30252
30325
|
for (const [i, source] of blocks.entries()) {
|
|
30253
30326
|
const idx = i + 1;
|
|
@@ -30255,7 +30328,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
30255
30328
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
30256
30329
|
const svg = await renderBlock(krokiUrl, source);
|
|
30257
30330
|
writeFileSync34(outPath, svg, "utf8");
|
|
30258
|
-
console.log(
|
|
30331
|
+
console.log(chalk188.green(` \u2192 ${outPath}`));
|
|
30259
30332
|
}
|
|
30260
30333
|
}
|
|
30261
30334
|
function extractMermaidBlocks(markdown) {
|
|
@@ -30271,18 +30344,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
30271
30344
|
if (options2.index !== void 0) {
|
|
30272
30345
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
30273
30346
|
console.error(
|
|
30274
|
-
|
|
30347
|
+
chalk189.red(`--index must be a positive integer (got ${options2.index})`)
|
|
30275
30348
|
);
|
|
30276
30349
|
process.exit(1);
|
|
30277
30350
|
}
|
|
30278
30351
|
if (!file) {
|
|
30279
|
-
console.error(
|
|
30352
|
+
console.error(chalk189.red("--index requires a file argument"));
|
|
30280
30353
|
process.exit(1);
|
|
30281
30354
|
}
|
|
30282
30355
|
}
|
|
30283
30356
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
30284
30357
|
if (files.length === 0) {
|
|
30285
|
-
console.log(
|
|
30358
|
+
console.log(chalk189.gray("No markdown files found in current directory."));
|
|
30286
30359
|
return;
|
|
30287
30360
|
}
|
|
30288
30361
|
for (const f of files) {
|
|
@@ -30428,7 +30501,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
30428
30501
|
}
|
|
30429
30502
|
|
|
30430
30503
|
// src/commands/miro/keptTexts.ts
|
|
30431
|
-
import
|
|
30504
|
+
import chalk190 from "chalk";
|
|
30432
30505
|
|
|
30433
30506
|
// src/commands/miro/applyIgnore.ts
|
|
30434
30507
|
function applyIgnore(texts, ignore3) {
|
|
@@ -30467,7 +30540,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
30467
30540
|
if (unmatched.length === 0) return;
|
|
30468
30541
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
30469
30542
|
console.error(
|
|
30470
|
-
|
|
30543
|
+
chalk190.yellow(
|
|
30471
30544
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
30472
30545
|
${entries}`
|
|
30473
30546
|
)
|
|
@@ -30668,7 +30741,7 @@ function readMiroItems(file) {
|
|
|
30668
30741
|
}
|
|
30669
30742
|
|
|
30670
30743
|
// src/commands/miro/resolveExtractOptions.ts
|
|
30671
|
-
import
|
|
30744
|
+
import chalk191 from "chalk";
|
|
30672
30745
|
|
|
30673
30746
|
// src/commands/miro/extractLayers.ts
|
|
30674
30747
|
function extractsIn(layer) {
|
|
@@ -30746,7 +30819,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
30746
30819
|
paths.cwd,
|
|
30747
30820
|
paths.globalConfigPath
|
|
30748
30821
|
);
|
|
30749
|
-
console.error(
|
|
30822
|
+
console.error(chalk191.dim(`Extract "${name}" from ${resolved.from}`));
|
|
30750
30823
|
return resolved.options;
|
|
30751
30824
|
}
|
|
30752
30825
|
|
|
@@ -30851,7 +30924,7 @@ function registerMiro(program) {
|
|
|
30851
30924
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
30852
30925
|
import { createServer as createServer2 } from "http";
|
|
30853
30926
|
import { dirname as dirname36 } from "path";
|
|
30854
|
-
import
|
|
30927
|
+
import chalk193 from "chalk";
|
|
30855
30928
|
|
|
30856
30929
|
// src/commands/netcap/corsHeaders.ts
|
|
30857
30930
|
var corsHeaders = {
|
|
@@ -30930,7 +31003,7 @@ function createNetcapHandler(options2) {
|
|
|
30930
31003
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
30931
31004
|
import { networkInterfaces } from "os";
|
|
30932
31005
|
import { join as join76 } from "path";
|
|
30933
|
-
import
|
|
31006
|
+
import chalk192 from "chalk";
|
|
30934
31007
|
|
|
30935
31008
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
30936
31009
|
import { dirname as dirname35, join as join75 } from "path";
|
|
@@ -30974,7 +31047,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30974
31047
|
const host = lanIPv4();
|
|
30975
31048
|
if (!host) {
|
|
30976
31049
|
console.log(
|
|
30977
|
-
|
|
31050
|
+
chalk192.yellow("could not determine the WSL IP for the extension")
|
|
30978
31051
|
);
|
|
30979
31052
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
30980
31053
|
return source;
|
|
@@ -30985,7 +31058,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
30985
31058
|
return WSL_WINDOWS_PATH3;
|
|
30986
31059
|
} catch {
|
|
30987
31060
|
console.log(
|
|
30988
|
-
|
|
31061
|
+
chalk192.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
30989
31062
|
);
|
|
30990
31063
|
return source;
|
|
30991
31064
|
}
|
|
@@ -31018,30 +31091,30 @@ async function netcap(options2) {
|
|
|
31018
31091
|
let count10 = 0;
|
|
31019
31092
|
const handler = createNetcapHandler({
|
|
31020
31093
|
outPath,
|
|
31021
|
-
onPing: () => console.log(
|
|
31094
|
+
onPing: () => console.log(chalk193.dim("ping from extension")),
|
|
31022
31095
|
onCapture: (entry) => {
|
|
31023
31096
|
count10 += 1;
|
|
31024
31097
|
console.log(
|
|
31025
|
-
|
|
31026
|
-
|
|
31098
|
+
chalk193.green(`captured #${count10}`),
|
|
31099
|
+
chalk193.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
31027
31100
|
);
|
|
31028
31101
|
}
|
|
31029
31102
|
});
|
|
31030
31103
|
const server = createServer2(handler);
|
|
31031
31104
|
server.listen(port, () => {
|
|
31032
31105
|
console.log(
|
|
31033
|
-
|
|
31106
|
+
chalk193.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
31034
31107
|
);
|
|
31035
|
-
console.log(
|
|
31108
|
+
console.log(chalk193.dim(`appending captures to ${outPath}`));
|
|
31036
31109
|
if (filter)
|
|
31037
|
-
console.log(
|
|
31038
|
-
console.log(
|
|
31039
|
-
console.log(
|
|
31110
|
+
console.log(chalk193.dim(`forwarding only URLs matching "${filter}"`));
|
|
31111
|
+
console.log(chalk193.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31112
|
+
console.log(chalk193.dim("press Ctrl-C to stop"));
|
|
31040
31113
|
});
|
|
31041
31114
|
process.on("SIGINT", () => {
|
|
31042
31115
|
server.close();
|
|
31043
31116
|
console.log(
|
|
31044
|
-
|
|
31117
|
+
chalk193.bold(
|
|
31045
31118
|
`
|
|
31046
31119
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
31047
31120
|
)
|
|
@@ -31053,7 +31126,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31053
31126
|
// src/commands/netcap/netcapExtract.ts
|
|
31054
31127
|
import { writeFileSync as writeFileSync36 } from "fs";
|
|
31055
31128
|
import { join as join79 } from "path";
|
|
31056
|
-
import
|
|
31129
|
+
import chalk194 from "chalk";
|
|
31057
31130
|
|
|
31058
31131
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31059
31132
|
import { readFileSync as readFileSync45 } from "fs";
|
|
@@ -31501,8 +31574,8 @@ function netcapExtract(file) {
|
|
|
31501
31574
|
writeFileSync36(outFile, `${JSON.stringify(posts, null, 2)}
|
|
31502
31575
|
`);
|
|
31503
31576
|
console.log(
|
|
31504
|
-
|
|
31505
|
-
|
|
31577
|
+
chalk194.green(`extracted ${posts.length} posts`),
|
|
31578
|
+
chalk194.dim(`-> ${outFile}`)
|
|
31506
31579
|
);
|
|
31507
31580
|
}
|
|
31508
31581
|
|
|
@@ -31523,7 +31596,7 @@ function registerNetcap(program) {
|
|
|
31523
31596
|
}
|
|
31524
31597
|
|
|
31525
31598
|
// src/commands/news/add.ts
|
|
31526
|
-
import
|
|
31599
|
+
import chalk195 from "chalk";
|
|
31527
31600
|
import enquirer8 from "enquirer";
|
|
31528
31601
|
async function add2(url) {
|
|
31529
31602
|
if (!url) {
|
|
@@ -31544,25 +31617,25 @@ async function add2(url) {
|
|
|
31544
31617
|
}
|
|
31545
31618
|
const added = await addFeed(await getDb(), url);
|
|
31546
31619
|
if (!added) {
|
|
31547
|
-
console.log(
|
|
31620
|
+
console.log(chalk195.yellow("Feed already exists"));
|
|
31548
31621
|
return;
|
|
31549
31622
|
}
|
|
31550
|
-
console.log(
|
|
31623
|
+
console.log(chalk195.green(`Added feed: ${url}`));
|
|
31551
31624
|
}
|
|
31552
31625
|
|
|
31553
31626
|
// src/commands/news/list.ts
|
|
31554
|
-
import
|
|
31627
|
+
import chalk196 from "chalk";
|
|
31555
31628
|
async function list4() {
|
|
31556
31629
|
const urls = await listFeeds(await getDb());
|
|
31557
31630
|
if (urls.length === 0) {
|
|
31558
|
-
console.log(
|
|
31631
|
+
console.log(chalk196.dim("No feeds; add one with assist news add <url>"));
|
|
31559
31632
|
return;
|
|
31560
31633
|
}
|
|
31561
31634
|
for (const url of urls) console.log(url);
|
|
31562
31635
|
}
|
|
31563
31636
|
|
|
31564
31637
|
// src/commands/news/remove.ts
|
|
31565
|
-
import
|
|
31638
|
+
import chalk197 from "chalk";
|
|
31566
31639
|
|
|
31567
31640
|
// src/commands/backlog/removeFeed.ts
|
|
31568
31641
|
import { eq as eq49 } from "drizzle-orm";
|
|
@@ -31575,10 +31648,10 @@ async function removeFeed(db, url) {
|
|
|
31575
31648
|
async function remove(url) {
|
|
31576
31649
|
const removed = await removeFeed(await getDb(), url);
|
|
31577
31650
|
if (!removed) {
|
|
31578
|
-
console.log(
|
|
31651
|
+
console.log(chalk197.yellow(`No feed matches ${url}`));
|
|
31579
31652
|
return;
|
|
31580
31653
|
}
|
|
31581
|
-
console.log(
|
|
31654
|
+
console.log(chalk197.green(`Removed feed: ${url}`));
|
|
31582
31655
|
}
|
|
31583
31656
|
|
|
31584
31657
|
// src/commands/registerNews.ts
|
|
@@ -31631,7 +31704,7 @@ function registerPiHook(program) {
|
|
|
31631
31704
|
}
|
|
31632
31705
|
|
|
31633
31706
|
// src/commands/prompts/printPromptsTable.ts
|
|
31634
|
-
import
|
|
31707
|
+
import chalk198 from "chalk";
|
|
31635
31708
|
function truncate(str, max) {
|
|
31636
31709
|
if (str.length <= max) return str;
|
|
31637
31710
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -31649,14 +31722,14 @@ function printPromptsTable(rows) {
|
|
|
31649
31722
|
"Command".padEnd(commandWidth),
|
|
31650
31723
|
"Repos"
|
|
31651
31724
|
].join(" ");
|
|
31652
|
-
console.log(
|
|
31653
|
-
console.log(
|
|
31725
|
+
console.log(chalk198.dim(header));
|
|
31726
|
+
console.log(chalk198.dim("-".repeat(header.length)));
|
|
31654
31727
|
for (const row3 of rows) {
|
|
31655
31728
|
const count10 = String(row3.count).padStart(countWidth);
|
|
31656
31729
|
const tool = row3.tool.padEnd(toolWidth);
|
|
31657
31730
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
31658
31731
|
console.log(
|
|
31659
|
-
`${
|
|
31732
|
+
`${chalk198.yellow(count10)} ${tool} ${command} ${chalk198.dim(row3.repos)}`
|
|
31660
31733
|
);
|
|
31661
31734
|
}
|
|
31662
31735
|
}
|
|
@@ -31694,13 +31767,13 @@ import { execSync as execSync41 } from "child_process";
|
|
|
31694
31767
|
import enquirer9 from "enquirer";
|
|
31695
31768
|
|
|
31696
31769
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
31697
|
-
import
|
|
31770
|
+
import chalk199 from "chalk";
|
|
31698
31771
|
var STATUS_MAP = {
|
|
31699
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
31700
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
31772
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk199.magenta("merged"), date: pr.mergedAt } : null,
|
|
31773
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk199.red("closed"), date: pr.closedAt } : null
|
|
31701
31774
|
};
|
|
31702
31775
|
function defaultStatus(pr) {
|
|
31703
|
-
return { label:
|
|
31776
|
+
return { label: chalk199.green("opened"), date: pr.createdAt };
|
|
31704
31777
|
}
|
|
31705
31778
|
function getStatus2(pr) {
|
|
31706
31779
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -31709,11 +31782,11 @@ function formatDate(dateStr) {
|
|
|
31709
31782
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
31710
31783
|
}
|
|
31711
31784
|
function formatPrHeader(pr, status2) {
|
|
31712
|
-
return `${
|
|
31785
|
+
return `${chalk199.cyan(`#${pr.number}`)} ${pr.title} ${chalk199.dim(`(${pr.author.login},`)} ${status2.label} ${chalk199.dim(`${formatDate(status2.date)})`)}`;
|
|
31713
31786
|
}
|
|
31714
31787
|
function logPrDetails(pr) {
|
|
31715
31788
|
console.log(
|
|
31716
|
-
|
|
31789
|
+
chalk199.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
31717
31790
|
);
|
|
31718
31791
|
console.log();
|
|
31719
31792
|
}
|
|
@@ -32282,13 +32355,13 @@ function agentFooter(unresolvedCount) {
|
|
|
32282
32355
|
}
|
|
32283
32356
|
|
|
32284
32357
|
// src/commands/prs/listComments/commentStyle.ts
|
|
32285
|
-
import
|
|
32358
|
+
import chalk200 from "chalk";
|
|
32286
32359
|
var plain = (text18) => text18;
|
|
32287
32360
|
function colouredState(state) {
|
|
32288
32361
|
const label = `[${state}]`;
|
|
32289
|
-
if (state === "APPROVED") return
|
|
32290
|
-
if (state === "CHANGES_REQUESTED") return
|
|
32291
|
-
return
|
|
32362
|
+
if (state === "APPROVED") return chalk200.green(label);
|
|
32363
|
+
if (state === "CHANGES_REQUESTED") return chalk200.red(label);
|
|
32364
|
+
return chalk200.yellow(label);
|
|
32292
32365
|
}
|
|
32293
32366
|
function commentStyle() {
|
|
32294
32367
|
if (isClaudeCode()) {
|
|
@@ -32302,9 +32375,9 @@ function commentStyle() {
|
|
|
32302
32375
|
};
|
|
32303
32376
|
}
|
|
32304
32377
|
return {
|
|
32305
|
-
cyan:
|
|
32306
|
-
bold:
|
|
32307
|
-
dim:
|
|
32378
|
+
cyan: chalk200.cyan,
|
|
32379
|
+
bold: chalk200.bold,
|
|
32380
|
+
dim: chalk200.dim,
|
|
32308
32381
|
state: colouredState,
|
|
32309
32382
|
diffHunk: true,
|
|
32310
32383
|
agent: false
|
|
@@ -33778,16 +33851,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
33778
33851
|
}
|
|
33779
33852
|
|
|
33780
33853
|
// src/commands/prs/status/printPrsStatus.ts
|
|
33781
|
-
import
|
|
33854
|
+
import chalk202 from "chalk";
|
|
33782
33855
|
|
|
33783
33856
|
// src/commands/prs/status/printPrStatus.ts
|
|
33784
|
-
import
|
|
33857
|
+
import chalk201 from "chalk";
|
|
33785
33858
|
function flags(pr) {
|
|
33786
33859
|
const markers = [];
|
|
33787
33860
|
if (pr.isDraft) markers.push("draft");
|
|
33788
33861
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
33789
33862
|
if (pr.isBot) markers.push("bot");
|
|
33790
|
-
return markers.length ? ` ${
|
|
33863
|
+
return markers.length ? ` ${chalk201.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
33791
33864
|
}
|
|
33792
33865
|
function updated(pr) {
|
|
33793
33866
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -33801,35 +33874,35 @@ function reviewLine(pr) {
|
|
|
33801
33874
|
function checkLines(pr) {
|
|
33802
33875
|
const lines2 = [];
|
|
33803
33876
|
if (pr.checks.failing.length) {
|
|
33804
|
-
lines2.push(
|
|
33877
|
+
lines2.push(chalk201.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
33805
33878
|
}
|
|
33806
33879
|
if (pr.checks.pending.length) {
|
|
33807
|
-
lines2.push(
|
|
33880
|
+
lines2.push(chalk201.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
33808
33881
|
}
|
|
33809
33882
|
return lines2;
|
|
33810
33883
|
}
|
|
33811
33884
|
function threadsLine(pr) {
|
|
33812
33885
|
if (pr.unresolvedThreads === null) {
|
|
33813
|
-
return
|
|
33886
|
+
return chalk201.dim("unresolved comments: unknown");
|
|
33814
33887
|
}
|
|
33815
33888
|
if (pr.unresolvedThreads === 0) return null;
|
|
33816
|
-
return
|
|
33889
|
+
return chalk201.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
33817
33890
|
}
|
|
33818
33891
|
function mergeableLine(pr) {
|
|
33819
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
33892
|
+
if (pr.mergeable === "CONFLICTING") return chalk201.red("conflicting");
|
|
33820
33893
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
33821
|
-
return
|
|
33894
|
+
return chalk201.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
33822
33895
|
}
|
|
33823
33896
|
function printPrStatus(pr) {
|
|
33824
33897
|
console.log(
|
|
33825
|
-
` ${
|
|
33898
|
+
` ${chalk201.cyan(`#${pr.number}`)} ${pr.title} ${chalk201.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
33826
33899
|
);
|
|
33827
33900
|
const details = [
|
|
33828
33901
|
reviewLine(pr),
|
|
33829
33902
|
...checkLines(pr),
|
|
33830
33903
|
threadsLine(pr),
|
|
33831
33904
|
mergeableLine(pr),
|
|
33832
|
-
|
|
33905
|
+
chalk201.dim(pr.url)
|
|
33833
33906
|
];
|
|
33834
33907
|
for (const detail of details) {
|
|
33835
33908
|
if (detail) console.log(` ${detail}`);
|
|
@@ -33840,17 +33913,17 @@ function printPrStatus(pr) {
|
|
|
33840
33913
|
function printPrsStatus(report) {
|
|
33841
33914
|
for (const repo of report.repos) {
|
|
33842
33915
|
const count10 = repo.pullRequests.length;
|
|
33843
|
-
console.log(`${
|
|
33916
|
+
console.log(`${chalk202.bold(repo.repo)} ${chalk202.dim(`(${count10} open)`)}`);
|
|
33844
33917
|
for (const pr of repo.pullRequests) {
|
|
33845
33918
|
printPrStatus(pr);
|
|
33846
33919
|
}
|
|
33847
|
-
if (count10 === 0) console.log(
|
|
33920
|
+
if (count10 === 0) console.log(chalk202.dim(" no open pull requests"));
|
|
33848
33921
|
console.log();
|
|
33849
33922
|
}
|
|
33850
33923
|
if (report.errors.length === 0) return;
|
|
33851
|
-
console.log(
|
|
33924
|
+
console.log(chalk202.bold("Errors"));
|
|
33852
33925
|
for (const failure of report.errors) {
|
|
33853
|
-
console.log(` ${
|
|
33926
|
+
console.log(` ${chalk202.red(failure.repo)}: ${failure.error}`);
|
|
33854
33927
|
}
|
|
33855
33928
|
console.log();
|
|
33856
33929
|
}
|
|
@@ -34078,10 +34151,10 @@ function registerPrs(program) {
|
|
|
34078
34151
|
}
|
|
34079
34152
|
|
|
34080
34153
|
// src/commands/ravendb/ravendbAuth.ts
|
|
34081
|
-
import
|
|
34154
|
+
import chalk208 from "chalk";
|
|
34082
34155
|
|
|
34083
34156
|
// src/shared/createConnectionAuth.ts
|
|
34084
|
-
import
|
|
34157
|
+
import chalk203 from "chalk";
|
|
34085
34158
|
function listConnections(connections, format3) {
|
|
34086
34159
|
if (connections.length === 0) {
|
|
34087
34160
|
console.log("No connections configured.");
|
|
@@ -34094,7 +34167,7 @@ function listConnections(connections, format3) {
|
|
|
34094
34167
|
function removeConnection(connections, name, save) {
|
|
34095
34168
|
const filtered = connections.filter((c) => c.name !== name);
|
|
34096
34169
|
if (filtered.length === connections.length) {
|
|
34097
|
-
console.error(
|
|
34170
|
+
console.error(chalk203.red(`Connection "${name}" not found.`));
|
|
34098
34171
|
process.exit(1);
|
|
34099
34172
|
}
|
|
34100
34173
|
save(filtered);
|
|
@@ -34140,15 +34213,15 @@ function saveConnections(connections) {
|
|
|
34140
34213
|
}
|
|
34141
34214
|
|
|
34142
34215
|
// src/commands/ravendb/promptConnection.ts
|
|
34143
|
-
import
|
|
34216
|
+
import chalk206 from "chalk";
|
|
34144
34217
|
|
|
34145
34218
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34146
|
-
import
|
|
34219
|
+
import chalk205 from "chalk";
|
|
34147
34220
|
import Enquirer2 from "enquirer";
|
|
34148
34221
|
|
|
34149
34222
|
// src/commands/ravendb/searchItems.ts
|
|
34150
34223
|
import { execSync as execSync48 } from "child_process";
|
|
34151
|
-
import
|
|
34224
|
+
import chalk204 from "chalk";
|
|
34152
34225
|
function opExec(args) {
|
|
34153
34226
|
return execSync48(`op ${args}`, {
|
|
34154
34227
|
encoding: "utf8",
|
|
@@ -34161,7 +34234,7 @@ function searchItems(search2) {
|
|
|
34161
34234
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34162
34235
|
} catch {
|
|
34163
34236
|
console.error(
|
|
34164
|
-
|
|
34237
|
+
chalk204.red(
|
|
34165
34238
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34166
34239
|
)
|
|
34167
34240
|
);
|
|
@@ -34175,7 +34248,7 @@ function getItemFields(itemId2) {
|
|
|
34175
34248
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34176
34249
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34177
34250
|
} catch {
|
|
34178
|
-
console.error(
|
|
34251
|
+
console.error(chalk204.red("Failed to get item details from 1Password."));
|
|
34179
34252
|
process.exit(1);
|
|
34180
34253
|
}
|
|
34181
34254
|
}
|
|
@@ -34194,7 +34267,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34194
34267
|
}).run();
|
|
34195
34268
|
const items2 = searchItems(search2);
|
|
34196
34269
|
if (items2.length === 0) {
|
|
34197
|
-
console.error(
|
|
34270
|
+
console.error(chalk205.red(`No items found matching "${search2}".`));
|
|
34198
34271
|
process.exit(1);
|
|
34199
34272
|
}
|
|
34200
34273
|
const itemId2 = await selectOne(
|
|
@@ -34203,7 +34276,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34203
34276
|
);
|
|
34204
34277
|
const fields = getItemFields(itemId2);
|
|
34205
34278
|
if (fields.length === 0) {
|
|
34206
|
-
console.error(
|
|
34279
|
+
console.error(chalk205.red("No fields with references found on this item."));
|
|
34207
34280
|
process.exit(1);
|
|
34208
34281
|
}
|
|
34209
34282
|
const ref = await selectOne(
|
|
@@ -34217,7 +34290,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34217
34290
|
async function promptConnection(existingNames) {
|
|
34218
34291
|
const name = await promptInput("name", "Connection name:");
|
|
34219
34292
|
if (existingNames.includes(name)) {
|
|
34220
|
-
console.error(
|
|
34293
|
+
console.error(chalk206.red(`Connection "${name}" already exists.`));
|
|
34221
34294
|
process.exit(1);
|
|
34222
34295
|
}
|
|
34223
34296
|
const url = await promptInput(
|
|
@@ -34226,22 +34299,22 @@ async function promptConnection(existingNames) {
|
|
|
34226
34299
|
);
|
|
34227
34300
|
const database = await promptInput("database", "Database name:");
|
|
34228
34301
|
if (!name || !url || !database) {
|
|
34229
|
-
console.error(
|
|
34302
|
+
console.error(chalk206.red("All fields are required."));
|
|
34230
34303
|
process.exit(1);
|
|
34231
34304
|
}
|
|
34232
34305
|
const apiKeyRef = await selectOpSecret();
|
|
34233
|
-
console.log(
|
|
34306
|
+
console.log(chalk206.dim(`Using: ${apiKeyRef}`));
|
|
34234
34307
|
return { name, url, database, apiKeyRef };
|
|
34235
34308
|
}
|
|
34236
34309
|
|
|
34237
34310
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
34238
|
-
import
|
|
34311
|
+
import chalk207 from "chalk";
|
|
34239
34312
|
function ravendbSetConnection(name) {
|
|
34240
34313
|
const raw = loadGlobalConfigRaw();
|
|
34241
34314
|
const ravendb = raw.ravendb ?? {};
|
|
34242
34315
|
const connections = ravendb.connections ?? [];
|
|
34243
34316
|
if (!connections.some((c) => c.name === name)) {
|
|
34244
|
-
console.error(
|
|
34317
|
+
console.error(chalk207.red(`Connection "${name}" not found.`));
|
|
34245
34318
|
console.error(
|
|
34246
34319
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34247
34320
|
);
|
|
@@ -34257,16 +34330,16 @@ function ravendbSetConnection(name) {
|
|
|
34257
34330
|
var ravendbAuth = createConnectionAuth({
|
|
34258
34331
|
load: loadConnections,
|
|
34259
34332
|
save: saveConnections,
|
|
34260
|
-
format: (c) => `${
|
|
34333
|
+
format: (c) => `${chalk208.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
34261
34334
|
promptNew: promptConnection,
|
|
34262
34335
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
34263
34336
|
});
|
|
34264
34337
|
|
|
34265
34338
|
// src/commands/ravendb/ravendbCollections.ts
|
|
34266
|
-
import
|
|
34339
|
+
import chalk212 from "chalk";
|
|
34267
34340
|
|
|
34268
34341
|
// src/commands/ravendb/ravenFetch.ts
|
|
34269
|
-
import
|
|
34342
|
+
import chalk210 from "chalk";
|
|
34270
34343
|
|
|
34271
34344
|
// src/commands/ravendb/getAccessToken.ts
|
|
34272
34345
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -34303,10 +34376,10 @@ ${errorText}`
|
|
|
34303
34376
|
|
|
34304
34377
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
34305
34378
|
import { execSync as execSync49 } from "child_process";
|
|
34306
|
-
import
|
|
34379
|
+
import chalk209 from "chalk";
|
|
34307
34380
|
function resolveOpSecret(reference) {
|
|
34308
34381
|
if (!reference.startsWith("op://")) {
|
|
34309
|
-
console.error(
|
|
34382
|
+
console.error(chalk209.red(`Invalid secret reference: must start with op://`));
|
|
34310
34383
|
process.exit(1);
|
|
34311
34384
|
}
|
|
34312
34385
|
try {
|
|
@@ -34316,7 +34389,7 @@ function resolveOpSecret(reference) {
|
|
|
34316
34389
|
}).trim();
|
|
34317
34390
|
} catch {
|
|
34318
34391
|
console.error(
|
|
34319
|
-
|
|
34392
|
+
chalk209.red(
|
|
34320
34393
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
34321
34394
|
)
|
|
34322
34395
|
);
|
|
@@ -34343,7 +34416,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34343
34416
|
if (!response.ok) {
|
|
34344
34417
|
const body = await response.text();
|
|
34345
34418
|
console.error(
|
|
34346
|
-
|
|
34419
|
+
chalk210.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
34347
34420
|
);
|
|
34348
34421
|
console.error(body.substring(0, 500));
|
|
34349
34422
|
process.exit(1);
|
|
@@ -34352,7 +34425,7 @@ async function ravenFetch(connection, path109) {
|
|
|
34352
34425
|
}
|
|
34353
34426
|
|
|
34354
34427
|
// src/commands/ravendb/resolveConnection.ts
|
|
34355
|
-
import
|
|
34428
|
+
import chalk211 from "chalk";
|
|
34356
34429
|
function loadRavendb() {
|
|
34357
34430
|
const raw = loadGlobalConfigRaw();
|
|
34358
34431
|
const ravendb = raw.ravendb;
|
|
@@ -34366,7 +34439,7 @@ function resolveConnection(name) {
|
|
|
34366
34439
|
const connectionName = name ?? defaultConnection;
|
|
34367
34440
|
if (!connectionName) {
|
|
34368
34441
|
console.error(
|
|
34369
|
-
|
|
34442
|
+
chalk211.red(
|
|
34370
34443
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
34371
34444
|
)
|
|
34372
34445
|
);
|
|
@@ -34374,7 +34447,7 @@ function resolveConnection(name) {
|
|
|
34374
34447
|
}
|
|
34375
34448
|
const connection = connections.find((c) => c.name === connectionName);
|
|
34376
34449
|
if (!connection) {
|
|
34377
|
-
console.error(
|
|
34450
|
+
console.error(chalk211.red(`Connection "${connectionName}" not found.`));
|
|
34378
34451
|
console.error(
|
|
34379
34452
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
34380
34453
|
);
|
|
@@ -34405,15 +34478,15 @@ async function ravendbCollections(connectionName) {
|
|
|
34405
34478
|
return;
|
|
34406
34479
|
}
|
|
34407
34480
|
for (const c of collections) {
|
|
34408
|
-
console.log(`${
|
|
34481
|
+
console.log(`${chalk212.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
34409
34482
|
}
|
|
34410
34483
|
}
|
|
34411
34484
|
|
|
34412
34485
|
// src/commands/ravendb/ravendbQuery.ts
|
|
34413
|
-
import
|
|
34486
|
+
import chalk214 from "chalk";
|
|
34414
34487
|
|
|
34415
34488
|
// src/commands/ravendb/fetchAllPages.ts
|
|
34416
|
-
import
|
|
34489
|
+
import chalk213 from "chalk";
|
|
34417
34490
|
|
|
34418
34491
|
// src/commands/ravendb/buildQueryPath.ts
|
|
34419
34492
|
function buildQueryPath(opts) {
|
|
@@ -34451,7 +34524,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34451
34524
|
allResults.push(...results);
|
|
34452
34525
|
start2 += results.length;
|
|
34453
34526
|
process.stderr.write(
|
|
34454
|
-
`\r${
|
|
34527
|
+
`\r${chalk213.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
34455
34528
|
);
|
|
34456
34529
|
if (start2 >= totalResults) break;
|
|
34457
34530
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -34466,7 +34539,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
34466
34539
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
34467
34540
|
const resolved = resolveArgs(connectionName, collection);
|
|
34468
34541
|
if (!resolved.collection && !options2.query) {
|
|
34469
|
-
console.error(
|
|
34542
|
+
console.error(chalk214.red("Provide a collection name or --query filter."));
|
|
34470
34543
|
process.exit(1);
|
|
34471
34544
|
}
|
|
34472
34545
|
const { collection: col } = resolved;
|
|
@@ -34501,7 +34574,7 @@ function registerRavendb(program) {
|
|
|
34501
34574
|
}
|
|
34502
34575
|
|
|
34503
34576
|
// src/commands/releases/releasesConfigure.ts
|
|
34504
|
-
import
|
|
34577
|
+
import chalk216 from "chalk";
|
|
34505
34578
|
|
|
34506
34579
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
34507
34580
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -34572,26 +34645,26 @@ function readStreamsInput(source) {
|
|
|
34572
34645
|
}
|
|
34573
34646
|
|
|
34574
34647
|
// src/commands/releases/reportDerivedStreams.ts
|
|
34575
|
-
import
|
|
34648
|
+
import chalk215 from "chalk";
|
|
34576
34649
|
function printDerived(stream) {
|
|
34577
34650
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
34578
34651
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
34579
34652
|
console.log(
|
|
34580
|
-
`${
|
|
34653
|
+
`${chalk215.bold(stream.name)} ${chalk215.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
34581
34654
|
);
|
|
34582
34655
|
console.log(
|
|
34583
|
-
` environments: ${environments.join(", ") ||
|
|
34656
|
+
` environments: ${environments.join(", ") || chalk215.dim("none")}`
|
|
34584
34657
|
);
|
|
34585
34658
|
if (steps.length > 0)
|
|
34586
34659
|
console.log(
|
|
34587
34660
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
34588
34661
|
);
|
|
34589
34662
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
34590
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
34663
|
+
console.log(` edges: ${edges.join(", ") || chalk215.dim("none")}`);
|
|
34591
34664
|
}
|
|
34592
34665
|
function reportDerivedStreams(streams, target) {
|
|
34593
34666
|
for (const stream of streams) printDerived(stream);
|
|
34594
|
-
console.log(
|
|
34667
|
+
console.log(chalk215.dim(`Written to ${target}`));
|
|
34595
34668
|
}
|
|
34596
34669
|
|
|
34597
34670
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -34681,9 +34754,9 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
34681
34754
|
}
|
|
34682
34755
|
|
|
34683
34756
|
// src/commands/releases/releasesConfigure.ts
|
|
34684
|
-
function
|
|
34685
|
-
console.error(
|
|
34686
|
-
for (const detail of details) console.error(
|
|
34757
|
+
function fail8(message3, details = []) {
|
|
34758
|
+
console.error(chalk216.red(message3));
|
|
34759
|
+
for (const detail of details) console.error(chalk216.red(` ${detail}`));
|
|
34687
34760
|
process.exitCode = 1;
|
|
34688
34761
|
}
|
|
34689
34762
|
function reportWritten(incoming, target) {
|
|
@@ -34696,19 +34769,19 @@ function reportWritten(incoming, target) {
|
|
|
34696
34769
|
}
|
|
34697
34770
|
async function releasesConfigure(options2 = {}) {
|
|
34698
34771
|
const scope = parseRepoScopeFlag(options2.scope ?? "git");
|
|
34699
|
-
if (!scope) return
|
|
34772
|
+
if (!scope) return fail8("--scope must be 'git' or 'db'");
|
|
34700
34773
|
const input = readStreamsInput(options2.streams ?? "-");
|
|
34701
|
-
if ("error" in input) return
|
|
34774
|
+
if ("error" in input) return fail8(`Could not read --streams: ${input.error}`);
|
|
34702
34775
|
const incoming = withCurrentRepo(input.streams);
|
|
34703
34776
|
const broken = checkStreamGraph(incoming);
|
|
34704
34777
|
if (broken.length > 0)
|
|
34705
|
-
return
|
|
34778
|
+
return fail8(
|
|
34706
34779
|
"The graph does not hold together, so nothing was written:",
|
|
34707
34780
|
broken
|
|
34708
34781
|
);
|
|
34709
34782
|
const written = await writeReleaseStreams(incoming, scope);
|
|
34710
34783
|
if (!written.ok)
|
|
34711
|
-
return
|
|
34784
|
+
return fail8(
|
|
34712
34785
|
"releases.streams does not validate, so nothing was written:",
|
|
34713
34786
|
written.errors
|
|
34714
34787
|
);
|
|
@@ -34716,23 +34789,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
34716
34789
|
}
|
|
34717
34790
|
|
|
34718
34791
|
// src/commands/releases/releasesList.ts
|
|
34719
|
-
import
|
|
34792
|
+
import chalk217 from "chalk";
|
|
34720
34793
|
function describeNode(node) {
|
|
34721
34794
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
34722
34795
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
34723
34796
|
}
|
|
34724
34797
|
function printStream(stream) {
|
|
34725
|
-
console.log(`${
|
|
34726
|
-
console.log(
|
|
34798
|
+
console.log(`${chalk217.bold(stream.name)} ${chalk217.dim(stream.repo)}`);
|
|
34799
|
+
console.log(chalk217.dim(` workflow: ${stream.workflow}`));
|
|
34727
34800
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
34728
34801
|
for (const [from, to] of stream.edges)
|
|
34729
|
-
console.log(
|
|
34802
|
+
console.log(chalk217.dim(` ${from} \u2192 ${to}`));
|
|
34730
34803
|
}
|
|
34731
34804
|
function releasesList() {
|
|
34732
34805
|
const streams = loadConfig().releases?.streams ?? [];
|
|
34733
34806
|
if (streams.length === 0) {
|
|
34734
34807
|
console.log(
|
|
34735
|
-
|
|
34808
|
+
chalk217.dim("No release streams configured under releases.streams.")
|
|
34736
34809
|
);
|
|
34737
34810
|
return;
|
|
34738
34811
|
}
|
|
@@ -34780,7 +34853,7 @@ function coverage() {
|
|
|
34780
34853
|
|
|
34781
34854
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34782
34855
|
import path45 from "path";
|
|
34783
|
-
import
|
|
34856
|
+
import chalk219 from "chalk";
|
|
34784
34857
|
|
|
34785
34858
|
// src/commands/lint/lint/checkFileNames.ts
|
|
34786
34859
|
import fs23 from "fs";
|
|
@@ -34860,7 +34933,7 @@ function checkFileNames() {
|
|
|
34860
34933
|
}
|
|
34861
34934
|
|
|
34862
34935
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
34863
|
-
import
|
|
34936
|
+
import chalk218 from "chalk";
|
|
34864
34937
|
|
|
34865
34938
|
// src/commands/lint/lint/applyMoves.ts
|
|
34866
34939
|
import fs24 from "fs";
|
|
@@ -34945,25 +35018,25 @@ function fixFileNameViolations(moves) {
|
|
|
34945
35018
|
const start2 = performance.now();
|
|
34946
35019
|
const project = createLintProject();
|
|
34947
35020
|
const cwd = process.cwd();
|
|
34948
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
35021
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk218.green(line)));
|
|
34949
35022
|
const ms = (performance.now() - start2).toFixed(0);
|
|
34950
|
-
console.log(
|
|
35023
|
+
console.log(chalk218.dim(` Done in ${ms}ms`));
|
|
34951
35024
|
}
|
|
34952
35025
|
|
|
34953
35026
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
34954
35027
|
function reportViolations(violations) {
|
|
34955
|
-
console.error(
|
|
35028
|
+
console.error(chalk219.red("\nFile name check failed:\n"));
|
|
34956
35029
|
console.error(
|
|
34957
|
-
|
|
35030
|
+
chalk219.red(
|
|
34958
35031
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
34959
35032
|
)
|
|
34960
35033
|
);
|
|
34961
35034
|
for (const violation of violations) {
|
|
34962
|
-
console.error(
|
|
34963
|
-
console.error(
|
|
35035
|
+
console.error(chalk219.red(` ${violation.filePath}`));
|
|
35036
|
+
console.error(chalk219.gray(` Rename to: ${violation.suggestedName}
|
|
34964
35037
|
`));
|
|
34965
35038
|
}
|
|
34966
|
-
console.error(
|
|
35039
|
+
console.error(chalk219.dim(" Run with -f to auto-fix.\n"));
|
|
34967
35040
|
}
|
|
34968
35041
|
function runFileNameCheck(fix = false) {
|
|
34969
35042
|
const violations = checkFileNames();
|
|
@@ -34992,17 +35065,17 @@ function runFileNameCheck(fix = false) {
|
|
|
34992
35065
|
import fs26 from "fs";
|
|
34993
35066
|
|
|
34994
35067
|
// src/commands/lint/shared.ts
|
|
34995
|
-
import
|
|
35068
|
+
import chalk220 from "chalk";
|
|
34996
35069
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
34997
35070
|
if (violations.length > 0) {
|
|
34998
|
-
console.error(
|
|
35071
|
+
console.error(chalk220.red(`
|
|
34999
35072
|
${checkName2} failed:
|
|
35000
35073
|
`));
|
|
35001
|
-
console.error(
|
|
35074
|
+
console.error(chalk220.red(` ${errorMessage3}
|
|
35002
35075
|
`));
|
|
35003
35076
|
for (const violation of violations) {
|
|
35004
|
-
console.error(
|
|
35005
|
-
console.error(
|
|
35077
|
+
console.error(chalk220.red(` ${violation.filePath}:${violation.line}`));
|
|
35078
|
+
console.error(chalk220.gray(` ${violation.content}
|
|
35006
35079
|
`));
|
|
35007
35080
|
}
|
|
35008
35081
|
return false;
|
|
@@ -35227,7 +35300,7 @@ import { execSync as execSync51 } from "child_process";
|
|
|
35227
35300
|
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
35228
35301
|
import { tmpdir as tmpdir7 } from "os";
|
|
35229
35302
|
import { join as join83, resolve as resolve25 } from "path";
|
|
35230
|
-
import
|
|
35303
|
+
import chalk221 from "chalk";
|
|
35231
35304
|
|
|
35232
35305
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
35233
35306
|
var captureWindowPs1 = `
|
|
@@ -35378,22 +35451,22 @@ function screenshot(processName) {
|
|
|
35378
35451
|
const config = loadConfig();
|
|
35379
35452
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
35380
35453
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
35381
|
-
console.log(
|
|
35454
|
+
console.log(chalk221.gray(`Capturing window for process "${processName}" ...`));
|
|
35382
35455
|
try {
|
|
35383
35456
|
runPowerShellScript(processName, outputPath);
|
|
35384
|
-
console.log(
|
|
35457
|
+
console.log(chalk221.green(`Screenshot saved: ${outputPath}`));
|
|
35385
35458
|
} catch (error) {
|
|
35386
35459
|
const msg = error instanceof Error ? error.message : String(error);
|
|
35387
|
-
console.error(
|
|
35460
|
+
console.error(chalk221.red(`Failed to capture screenshot: ${msg}`));
|
|
35388
35461
|
process.exit(1);
|
|
35389
35462
|
}
|
|
35390
35463
|
}
|
|
35391
35464
|
|
|
35392
35465
|
// src/commands/statusLine.ts
|
|
35393
|
-
import
|
|
35466
|
+
import chalk224 from "chalk";
|
|
35394
35467
|
|
|
35395
35468
|
// src/commands/buildLimitsSegment.ts
|
|
35396
|
-
import
|
|
35469
|
+
import chalk222 from "chalk";
|
|
35397
35470
|
|
|
35398
35471
|
// src/shared/rateLimitLevel.ts
|
|
35399
35472
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -35431,9 +35504,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
35431
35504
|
|
|
35432
35505
|
// src/commands/buildLimitsSegment.ts
|
|
35433
35506
|
var LEVEL_COLOR = {
|
|
35434
|
-
ok:
|
|
35435
|
-
warn:
|
|
35436
|
-
over:
|
|
35507
|
+
ok: chalk222.green,
|
|
35508
|
+
warn: chalk222.yellow,
|
|
35509
|
+
over: chalk222.red
|
|
35437
35510
|
};
|
|
35438
35511
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
35439
35512
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -35529,7 +35602,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
35529
35602
|
}
|
|
35530
35603
|
|
|
35531
35604
|
// src/commands/colorizePercent.ts
|
|
35532
|
-
import
|
|
35605
|
+
import chalk223 from "chalk";
|
|
35533
35606
|
|
|
35534
35607
|
// src/shared/contextLevel.ts
|
|
35535
35608
|
var THRESHOLDS = {
|
|
@@ -35549,16 +35622,16 @@ function colorizePercent(pct) {
|
|
|
35549
35622
|
const label = `${Math.round(pct)}%`;
|
|
35550
35623
|
switch (contextLevel(pct)) {
|
|
35551
35624
|
case "red":
|
|
35552
|
-
return
|
|
35625
|
+
return chalk223.red(label);
|
|
35553
35626
|
case "yellow":
|
|
35554
|
-
return
|
|
35627
|
+
return chalk223.yellow(label);
|
|
35555
35628
|
default:
|
|
35556
35629
|
return label;
|
|
35557
35630
|
}
|
|
35558
35631
|
}
|
|
35559
35632
|
|
|
35560
35633
|
// src/commands/statusLine.ts
|
|
35561
|
-
|
|
35634
|
+
chalk224.level = 3;
|
|
35562
35635
|
function formatNumber(num) {
|
|
35563
35636
|
return num.toLocaleString("en-US");
|
|
35564
35637
|
}
|
|
@@ -35570,7 +35643,7 @@ async function statusLine() {
|
|
|
35570
35643
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
35571
35644
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
35572
35645
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
35573
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
35646
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk224.cyan(branch2)} | ` : "";
|
|
35574
35647
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
35575
35648
|
console.log(
|
|
35576
35649
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -35678,7 +35751,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
35678
35751
|
import * as path48 from "path";
|
|
35679
35752
|
|
|
35680
35753
|
// src/commands/refactor/logViolations.ts
|
|
35681
|
-
import
|
|
35754
|
+
import chalk225 from "chalk";
|
|
35682
35755
|
var DEFAULT_MAX_LINES2 = 100;
|
|
35683
35756
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
35684
35757
|
if (violations.length === 0) {
|
|
@@ -35687,43 +35760,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
35687
35760
|
}
|
|
35688
35761
|
return;
|
|
35689
35762
|
}
|
|
35690
|
-
console.error(
|
|
35763
|
+
console.error(chalk225.red(`
|
|
35691
35764
|
Refactor check failed:
|
|
35692
35765
|
`));
|
|
35693
|
-
console.error(
|
|
35766
|
+
console.error(chalk225.red(` The following files exceed ${maxLines} lines:
|
|
35694
35767
|
`));
|
|
35695
35768
|
for (const violation of violations) {
|
|
35696
|
-
console.error(
|
|
35769
|
+
console.error(chalk225.red(` ${violation.file} (${violation.lines} lines)`));
|
|
35697
35770
|
}
|
|
35698
35771
|
console.error(
|
|
35699
|
-
|
|
35772
|
+
chalk225.yellow(
|
|
35700
35773
|
`
|
|
35701
35774
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
35702
35775
|
way to refactor it, ignore it with:
|
|
35703
35776
|
`
|
|
35704
35777
|
)
|
|
35705
35778
|
);
|
|
35706
|
-
console.error(
|
|
35779
|
+
console.error(chalk225.gray(` assist refactor ignore <file>
|
|
35707
35780
|
`));
|
|
35708
35781
|
if (process.env.CLAUDECODE) {
|
|
35709
|
-
console.error(
|
|
35782
|
+
console.error(chalk225.cyan(`
|
|
35710
35783
|
## Extracting Code to New Files
|
|
35711
35784
|
`));
|
|
35712
35785
|
console.error(
|
|
35713
|
-
|
|
35786
|
+
chalk225.cyan(
|
|
35714
35787
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
35715
35788
|
`
|
|
35716
35789
|
)
|
|
35717
35790
|
);
|
|
35718
35791
|
console.error(
|
|
35719
|
-
|
|
35792
|
+
chalk225.cyan(
|
|
35720
35793
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
35721
35794
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
35722
35795
|
`
|
|
35723
35796
|
)
|
|
35724
35797
|
);
|
|
35725
35798
|
console.error(
|
|
35726
|
-
|
|
35799
|
+
chalk225.cyan(
|
|
35727
35800
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
35728
35801
|
domains, move it to a common/shared folder.
|
|
35729
35802
|
`
|
|
@@ -35879,7 +35952,7 @@ async function check(pattern2, options2) {
|
|
|
35879
35952
|
|
|
35880
35953
|
// src/commands/refactor/extract.ts
|
|
35881
35954
|
import path56 from "path";
|
|
35882
|
-
import
|
|
35955
|
+
import chalk228 from "chalk";
|
|
35883
35956
|
|
|
35884
35957
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
35885
35958
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -36487,23 +36560,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
36487
36560
|
|
|
36488
36561
|
// src/commands/refactor/extract/displayPlan.ts
|
|
36489
36562
|
import path52 from "path";
|
|
36490
|
-
import
|
|
36563
|
+
import chalk226 from "chalk";
|
|
36491
36564
|
function section(title) {
|
|
36492
36565
|
return `
|
|
36493
|
-
${
|
|
36566
|
+
${chalk226.cyan(title)}`;
|
|
36494
36567
|
}
|
|
36495
36568
|
function displayImporters(plan2, cwd) {
|
|
36496
36569
|
if (plan2.importersToUpdate.length === 0) return;
|
|
36497
36570
|
console.log(section("Update importers:"));
|
|
36498
36571
|
for (const imp of plan2.importersToUpdate) {
|
|
36499
36572
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
36500
|
-
console.log(` ${
|
|
36573
|
+
console.log(` ${chalk226.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
36501
36574
|
}
|
|
36502
36575
|
}
|
|
36503
36576
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
36504
|
-
console.log(
|
|
36577
|
+
console.log(chalk226.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
36505
36578
|
`));
|
|
36506
|
-
console.log(` ${
|
|
36579
|
+
console.log(` ${chalk226.cyan("Functions to move:")}`);
|
|
36507
36580
|
for (const name of plan2.extractedNames) {
|
|
36508
36581
|
console.log(` ${name}`);
|
|
36509
36582
|
}
|
|
@@ -36537,7 +36610,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
36537
36610
|
|
|
36538
36611
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
36539
36612
|
import path55 from "path";
|
|
36540
|
-
import
|
|
36613
|
+
import chalk227 from "chalk";
|
|
36541
36614
|
import { Project as Project4 } from "ts-morph";
|
|
36542
36615
|
|
|
36543
36616
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -36629,7 +36702,7 @@ function loadProjectFile(file) {
|
|
|
36629
36702
|
});
|
|
36630
36703
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
36631
36704
|
if (!sourceFile) {
|
|
36632
|
-
console.log(
|
|
36705
|
+
console.log(chalk227.red(`File not found in project: ${file}`));
|
|
36633
36706
|
process.exit(1);
|
|
36634
36707
|
}
|
|
36635
36708
|
return { project, sourceFile };
|
|
@@ -36652,19 +36725,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
36652
36725
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
36653
36726
|
if (options2.apply) {
|
|
36654
36727
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
36655
|
-
console.log(
|
|
36728
|
+
console.log(chalk228.green("\nExtraction complete"));
|
|
36656
36729
|
} else {
|
|
36657
|
-
console.log(
|
|
36730
|
+
console.log(chalk228.dim("\nDry run. Use --apply to execute."));
|
|
36658
36731
|
}
|
|
36659
36732
|
}
|
|
36660
36733
|
|
|
36661
36734
|
// src/commands/refactor/ignore.ts
|
|
36662
36735
|
import fs33 from "fs";
|
|
36663
|
-
import
|
|
36736
|
+
import chalk229 from "chalk";
|
|
36664
36737
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
36665
36738
|
function ignore2(file) {
|
|
36666
36739
|
if (!fs33.existsSync(file)) {
|
|
36667
|
-
console.error(
|
|
36740
|
+
console.error(chalk229.red(`Error: File does not exist: ${file}`));
|
|
36668
36741
|
process.exit(1);
|
|
36669
36742
|
}
|
|
36670
36743
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -36680,7 +36753,7 @@ function ignore2(file) {
|
|
|
36680
36753
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
36681
36754
|
}
|
|
36682
36755
|
console.log(
|
|
36683
|
-
|
|
36756
|
+
chalk229.green(
|
|
36684
36757
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
36685
36758
|
)
|
|
36686
36759
|
);
|
|
@@ -36689,12 +36762,12 @@ function ignore2(file) {
|
|
|
36689
36762
|
// src/commands/refactor/rename.ts
|
|
36690
36763
|
import fs36 from "fs";
|
|
36691
36764
|
import path62 from "path";
|
|
36692
|
-
import
|
|
36765
|
+
import chalk232 from "chalk";
|
|
36693
36766
|
|
|
36694
36767
|
// src/commands/refactor/rename/applyRename.ts
|
|
36695
36768
|
import fs35 from "fs";
|
|
36696
36769
|
import path58 from "path";
|
|
36697
|
-
import
|
|
36770
|
+
import chalk230 from "chalk";
|
|
36698
36771
|
|
|
36699
36772
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
36700
36773
|
import path57 from "path";
|
|
@@ -36800,13 +36873,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
36800
36873
|
const updatedContents = applyRewrites(rewrites);
|
|
36801
36874
|
for (const [file, content] of updatedContents) {
|
|
36802
36875
|
fs35.writeFileSync(file, content, "utf8");
|
|
36803
|
-
console.log(
|
|
36876
|
+
console.log(chalk230.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
36804
36877
|
}
|
|
36805
36878
|
const destDir = path58.dirname(destPath);
|
|
36806
36879
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
36807
36880
|
fs35.renameSync(sourcePath, destPath);
|
|
36808
36881
|
console.log(
|
|
36809
|
-
|
|
36882
|
+
chalk230.white(
|
|
36810
36883
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
36811
36884
|
)
|
|
36812
36885
|
);
|
|
@@ -36956,16 +37029,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
36956
37029
|
|
|
36957
37030
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
36958
37031
|
import path61 from "path";
|
|
36959
|
-
import
|
|
37032
|
+
import chalk231 from "chalk";
|
|
36960
37033
|
function printRenamePreview(rewrites, cwd) {
|
|
36961
37034
|
for (const rewrite of rewrites) {
|
|
36962
37035
|
console.log(
|
|
36963
|
-
|
|
37036
|
+
chalk231.dim(
|
|
36964
37037
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
36965
37038
|
)
|
|
36966
37039
|
);
|
|
36967
37040
|
}
|
|
36968
|
-
console.log(
|
|
37041
|
+
console.log(chalk231.dim("Dry run. Use --apply to execute."));
|
|
36969
37042
|
}
|
|
36970
37043
|
|
|
36971
37044
|
// src/commands/refactor/rename.ts
|
|
@@ -36976,20 +37049,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36976
37049
|
const relSource = path62.relative(cwd, sourcePath);
|
|
36977
37050
|
const relDest = path62.relative(cwd, destPath);
|
|
36978
37051
|
if (!fs36.existsSync(sourcePath)) {
|
|
36979
|
-
console.log(
|
|
37052
|
+
console.log(chalk232.red(`File not found: ${source}`));
|
|
36980
37053
|
process.exit(1);
|
|
36981
37054
|
}
|
|
36982
37055
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
36983
|
-
console.log(
|
|
37056
|
+
console.log(chalk232.red(`Destination already exists: ${destination}`));
|
|
36984
37057
|
process.exit(1);
|
|
36985
37058
|
}
|
|
36986
|
-
console.log(
|
|
36987
|
-
console.log(
|
|
36988
|
-
console.log(
|
|
37059
|
+
console.log(chalk232.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
37060
|
+
console.log(chalk232.dim("Loading project..."));
|
|
37061
|
+
console.log(chalk232.dim("Scanning imports across the project..."));
|
|
36989
37062
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
36990
37063
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
36991
37064
|
console.log(
|
|
36992
|
-
|
|
37065
|
+
chalk232.dim(
|
|
36993
37066
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
36994
37067
|
)
|
|
36995
37068
|
);
|
|
@@ -36998,11 +37071,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
36998
37071
|
return;
|
|
36999
37072
|
}
|
|
37000
37073
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
37001
|
-
console.log(
|
|
37074
|
+
console.log(chalk232.green("Done"));
|
|
37002
37075
|
}
|
|
37003
37076
|
|
|
37004
37077
|
// src/commands/refactor/renameSymbol.ts
|
|
37005
|
-
import
|
|
37078
|
+
import chalk233 from "chalk";
|
|
37006
37079
|
|
|
37007
37080
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
37008
37081
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -37048,34 +37121,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
37048
37121
|
const { project, sourceFile } = loadProjectFile(file);
|
|
37049
37122
|
const symbol = findSymbol(sourceFile, oldName);
|
|
37050
37123
|
if (!symbol) {
|
|
37051
|
-
console.log(
|
|
37124
|
+
console.log(chalk233.red(`Symbol "${oldName}" not found in ${file}`));
|
|
37052
37125
|
process.exit(1);
|
|
37053
37126
|
}
|
|
37054
37127
|
const grouped = groupReferences(symbol, cwd);
|
|
37055
37128
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
37056
37129
|
console.log(
|
|
37057
|
-
|
|
37130
|
+
chalk233.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
37058
37131
|
`)
|
|
37059
37132
|
);
|
|
37060
37133
|
for (const [refFile, lines2] of grouped) {
|
|
37061
37134
|
console.log(
|
|
37062
|
-
` ${
|
|
37135
|
+
` ${chalk233.dim(refFile)}: lines ${chalk233.cyan(lines2.join(", "))}`
|
|
37063
37136
|
);
|
|
37064
37137
|
}
|
|
37065
37138
|
if (options2.apply) {
|
|
37066
37139
|
symbol.rename(newName);
|
|
37067
37140
|
await project.save();
|
|
37068
|
-
console.log(
|
|
37141
|
+
console.log(chalk233.green(`
|
|
37069
37142
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
37070
37143
|
} else {
|
|
37071
|
-
console.log(
|
|
37144
|
+
console.log(chalk233.dim("\nDry run. Use --apply to execute."));
|
|
37072
37145
|
}
|
|
37073
37146
|
}
|
|
37074
37147
|
|
|
37075
37148
|
// src/commands/refactor/restructure.ts
|
|
37076
37149
|
import fs38 from "fs";
|
|
37077
37150
|
import path83 from "path";
|
|
37078
|
-
import
|
|
37151
|
+
import chalk243 from "chalk";
|
|
37079
37152
|
|
|
37080
37153
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
37081
37154
|
import path73 from "path";
|
|
@@ -37412,7 +37485,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
37412
37485
|
}
|
|
37413
37486
|
|
|
37414
37487
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
37415
|
-
import
|
|
37488
|
+
import chalk238 from "chalk";
|
|
37416
37489
|
|
|
37417
37490
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
37418
37491
|
import path74 from "path";
|
|
@@ -37423,13 +37496,13 @@ function applyCommand(scopeRoot) {
|
|
|
37423
37496
|
|
|
37424
37497
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
37425
37498
|
import path75 from "path";
|
|
37426
|
-
import
|
|
37499
|
+
import chalk234 from "chalk";
|
|
37427
37500
|
var shownMoves = 20;
|
|
37428
37501
|
function displayDrift(plan2, listMoves) {
|
|
37429
37502
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
37430
37503
|
if (plan2.moves.length > 0) {
|
|
37431
37504
|
console.log(
|
|
37432
|
-
|
|
37505
|
+
chalk234.red(
|
|
37433
37506
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
37434
37507
|
)
|
|
37435
37508
|
);
|
|
@@ -37437,17 +37510,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
37437
37510
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
37438
37511
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
37439
37512
|
if (plan2.moves.length > shownMoves)
|
|
37440
|
-
console.log(
|
|
37513
|
+
console.log(chalk234.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
37441
37514
|
}
|
|
37442
37515
|
}
|
|
37443
|
-
for (const error of plan2.errors) console.log(
|
|
37516
|
+
for (const error of plan2.errors) console.log(chalk234.red(error));
|
|
37444
37517
|
}
|
|
37445
37518
|
|
|
37446
37519
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
37447
|
-
import
|
|
37520
|
+
import chalk237 from "chalk";
|
|
37448
37521
|
|
|
37449
37522
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
37450
|
-
import
|
|
37523
|
+
import chalk235 from "chalk";
|
|
37451
37524
|
var shownChains = 10;
|
|
37452
37525
|
function formatChain(chain2) {
|
|
37453
37526
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -37457,28 +37530,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
37457
37530
|
if (chains.length === 0) return;
|
|
37458
37531
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
37459
37532
|
console.log(
|
|
37460
|
-
|
|
37533
|
+
chalk235.red(
|
|
37461
37534
|
`
|
|
37462
37535
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
37463
37536
|
)
|
|
37464
37537
|
);
|
|
37465
37538
|
console.log(
|
|
37466
|
-
|
|
37539
|
+
chalk235.bold(
|
|
37467
37540
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
37468
37541
|
)
|
|
37469
37542
|
);
|
|
37470
37543
|
for (const chain2 of chains.slice(0, shownChains))
|
|
37471
37544
|
console.log(formatChain(chain2));
|
|
37472
37545
|
if (chains.length > shownChains)
|
|
37473
|
-
console.log(
|
|
37546
|
+
console.log(chalk235.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
37474
37547
|
}
|
|
37475
37548
|
|
|
37476
37549
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
37477
|
-
import
|
|
37550
|
+
import chalk236 from "chalk";
|
|
37478
37551
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
37479
37552
|
if (longPaths.length === 0) return;
|
|
37480
37553
|
console.log(
|
|
37481
|
-
|
|
37554
|
+
chalk236.red(
|
|
37482
37555
|
`
|
|
37483
37556
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
37484
37557
|
)
|
|
@@ -37506,7 +37579,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
37506
37579
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
37507
37580
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
37508
37581
|
console.log("");
|
|
37509
|
-
for (const line of pinSteps(apply)) console.log(
|
|
37582
|
+
for (const line of pinSteps(apply)) console.log(chalk237.yellow(line));
|
|
37510
37583
|
}
|
|
37511
37584
|
|
|
37512
37585
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -37518,14 +37591,14 @@ function checkPlan(plan2, limits) {
|
|
|
37518
37591
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
37519
37592
|
if (plan2.moves.length > 0) {
|
|
37520
37593
|
console.log(
|
|
37521
|
-
|
|
37594
|
+
chalk238.yellow(
|
|
37522
37595
|
`
|
|
37523
37596
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
37524
37597
|
)
|
|
37525
37598
|
);
|
|
37526
37599
|
process.exit(1);
|
|
37527
37600
|
}
|
|
37528
|
-
console.log(
|
|
37601
|
+
console.log(chalk238.green("Layout matches the restructure plan"));
|
|
37529
37602
|
}
|
|
37530
37603
|
|
|
37531
37604
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -37595,15 +37668,15 @@ function partitionIgnored(files) {
|
|
|
37595
37668
|
}
|
|
37596
37669
|
|
|
37597
37670
|
// src/commands/refactor/restructure/runPlan.ts
|
|
37598
|
-
import
|
|
37671
|
+
import chalk242 from "chalk";
|
|
37599
37672
|
|
|
37600
37673
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37601
|
-
import
|
|
37674
|
+
import chalk240 from "chalk";
|
|
37602
37675
|
|
|
37603
37676
|
// src/commands/refactor/restructure/executePlan.ts
|
|
37604
37677
|
import fs37 from "fs";
|
|
37605
37678
|
import path79 from "path";
|
|
37606
|
-
import
|
|
37679
|
+
import chalk239 from "chalk";
|
|
37607
37680
|
function relPath(file) {
|
|
37608
37681
|
return path79.relative(process.cwd(), file);
|
|
37609
37682
|
}
|
|
@@ -37620,14 +37693,14 @@ function moveFiles(moves) {
|
|
|
37620
37693
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
37621
37694
|
fs37.renameSync(staging, move2.to);
|
|
37622
37695
|
console.log(
|
|
37623
|
-
|
|
37696
|
+
chalk239.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
37624
37697
|
);
|
|
37625
37698
|
}
|
|
37626
37699
|
}
|
|
37627
37700
|
function removeIfEmpty(dir) {
|
|
37628
37701
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
37629
37702
|
fs37.rmdirSync(dir);
|
|
37630
|
-
console.log(
|
|
37703
|
+
console.log(chalk239.dim(` Removed empty directory ${relPath(dir)}`));
|
|
37631
37704
|
return true;
|
|
37632
37705
|
}
|
|
37633
37706
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -37640,7 +37713,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
37640
37713
|
function executePlan(plan2) {
|
|
37641
37714
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
37642
37715
|
fs37.writeFileSync(file, content, "utf8");
|
|
37643
|
-
console.log(
|
|
37716
|
+
console.log(chalk239.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
37644
37717
|
}
|
|
37645
37718
|
moveFiles(plan2.moves);
|
|
37646
37719
|
removeEmptyDirectories(
|
|
@@ -37652,17 +37725,17 @@ function executePlan(plan2) {
|
|
|
37652
37725
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
37653
37726
|
function applyPlan(plan2) {
|
|
37654
37727
|
if (plan2.errors.length > 0) {
|
|
37655
|
-
console.log(
|
|
37728
|
+
console.log(chalk240.red("\nResolve the errors above before applying."));
|
|
37656
37729
|
process.exit(1);
|
|
37657
37730
|
}
|
|
37658
|
-
console.log(
|
|
37731
|
+
console.log(chalk240.bold("\nApplying changes..."));
|
|
37659
37732
|
executePlan(plan2);
|
|
37660
|
-
console.log(
|
|
37733
|
+
console.log(chalk240.green("\nRestructuring complete"));
|
|
37661
37734
|
}
|
|
37662
37735
|
|
|
37663
37736
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
37664
37737
|
import path82 from "path";
|
|
37665
|
-
import
|
|
37738
|
+
import chalk241 from "chalk";
|
|
37666
37739
|
|
|
37667
37740
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
37668
37741
|
import path80 from "path";
|
|
@@ -37713,17 +37786,17 @@ function relPath2(filePath) {
|
|
|
37713
37786
|
}
|
|
37714
37787
|
function displayMoves(plan2) {
|
|
37715
37788
|
if (plan2.moves.length === 0) return;
|
|
37716
|
-
console.log(
|
|
37789
|
+
console.log(chalk241.bold("\nFile moves:"));
|
|
37717
37790
|
for (const move2 of plan2.moves) {
|
|
37718
37791
|
console.log(
|
|
37719
|
-
` ${
|
|
37792
|
+
` ${chalk241.red(relPath2(move2.from))} \u2192 ${chalk241.green(relPath2(move2.to))}`
|
|
37720
37793
|
);
|
|
37721
|
-
console.log(
|
|
37794
|
+
console.log(chalk241.dim(` ${move2.reason}`));
|
|
37722
37795
|
}
|
|
37723
37796
|
}
|
|
37724
37797
|
function displayTree(plan2) {
|
|
37725
37798
|
console.log(
|
|
37726
|
-
|
|
37799
|
+
chalk241.bold(`
|
|
37727
37800
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
37728
37801
|
);
|
|
37729
37802
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -37734,15 +37807,15 @@ function displayDepthStats(plan2) {
|
|
|
37734
37807
|
plan2.targets.values(),
|
|
37735
37808
|
plan2.scopeRoot
|
|
37736
37809
|
);
|
|
37737
|
-
console.log(
|
|
37810
|
+
console.log(chalk241.bold(`
|
|
37738
37811
|
Depth (max ${max}):`));
|
|
37739
37812
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
37740
37813
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
37741
37814
|
}
|
|
37742
37815
|
function displayErrors(errors) {
|
|
37743
37816
|
if (errors.length === 0) return;
|
|
37744
|
-
console.log(
|
|
37745
|
-
for (const error of errors) console.log(
|
|
37817
|
+
console.log(chalk241.red("\nErrors:"));
|
|
37818
|
+
for (const error of errors) console.log(chalk241.red(` ${error}`));
|
|
37746
37819
|
}
|
|
37747
37820
|
function displayPlan2(plan2) {
|
|
37748
37821
|
displayMoves(plan2);
|
|
@@ -37751,7 +37824,7 @@ function displayPlan2(plan2) {
|
|
|
37751
37824
|
displayErrors(plan2.errors);
|
|
37752
37825
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
37753
37826
|
console.log(
|
|
37754
|
-
|
|
37827
|
+
chalk241.dim(
|
|
37755
37828
|
`
|
|
37756
37829
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
37757
37830
|
)
|
|
@@ -37763,11 +37836,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
37763
37836
|
displayPlan2(plan2);
|
|
37764
37837
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
37765
37838
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
37766
|
-
console.log(
|
|
37839
|
+
console.log(chalk242.green("No restructuring needed"));
|
|
37767
37840
|
return;
|
|
37768
37841
|
}
|
|
37769
37842
|
if (!apply) {
|
|
37770
|
-
console.log(
|
|
37843
|
+
console.log(chalk242.dim("\nDry run. Use --apply to execute."));
|
|
37771
37844
|
return;
|
|
37772
37845
|
}
|
|
37773
37846
|
applyPlan(plan2);
|
|
@@ -37777,14 +37850,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
37777
37850
|
async function restructure(root2, options2 = {}) {
|
|
37778
37851
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
37779
37852
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
37780
|
-
console.log(
|
|
37853
|
+
console.log(chalk243.red(`Not a directory: ${root2 ?? "src"}`));
|
|
37781
37854
|
process.exit(1);
|
|
37782
37855
|
}
|
|
37783
37856
|
const found = [];
|
|
37784
37857
|
walkSourceFiles(scopeRoot, found);
|
|
37785
37858
|
const { scoped, ignored } = partitionIgnored(found);
|
|
37786
37859
|
if (scoped.length === 0) {
|
|
37787
|
-
console.log(
|
|
37860
|
+
console.log(chalk243.yellow("No files found under root"));
|
|
37788
37861
|
return;
|
|
37789
37862
|
}
|
|
37790
37863
|
const {
|
|
@@ -37855,7 +37928,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
37855
37928
|
}
|
|
37856
37929
|
|
|
37857
37930
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
37858
|
-
import
|
|
37931
|
+
import chalk247 from "chalk";
|
|
37859
37932
|
|
|
37860
37933
|
// src/commands/config/promptConfigScope.ts
|
|
37861
37934
|
import Enquirer3 from "enquirer";
|
|
@@ -37881,7 +37954,7 @@ async function promptConfigScope() {
|
|
|
37881
37954
|
}
|
|
37882
37955
|
|
|
37883
37956
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
37884
|
-
import
|
|
37957
|
+
import chalk244 from "chalk";
|
|
37885
37958
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
37886
37959
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
37887
37960
|
for (; ; ) {
|
|
@@ -37889,7 +37962,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
37889
37962
|
if (answer === "") return void 0;
|
|
37890
37963
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
37891
37964
|
if (coercion.ok) return coercion.value;
|
|
37892
|
-
console.error(
|
|
37965
|
+
console.error(chalk244.red(coercion.error));
|
|
37893
37966
|
}
|
|
37894
37967
|
}
|
|
37895
37968
|
function coerceSupplied(key, supplied) {
|
|
@@ -37969,7 +38042,7 @@ function suggestGlobs(current, proposed) {
|
|
|
37969
38042
|
}
|
|
37970
38043
|
|
|
37971
38044
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
37972
|
-
import
|
|
38045
|
+
import chalk245 from "chalk";
|
|
37973
38046
|
function parseConfigureAnswers(answers) {
|
|
37974
38047
|
const known = Object.values(highLevelConfigKeys);
|
|
37975
38048
|
const parsed = {};
|
|
@@ -37987,13 +38060,13 @@ function answersCoverEveryKey(answers) {
|
|
|
37987
38060
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
37988
38061
|
}
|
|
37989
38062
|
function exitWith(message3) {
|
|
37990
|
-
console.error(
|
|
38063
|
+
console.error(chalk245.red(`Error: ${message3}.`));
|
|
37991
38064
|
process.exit(1);
|
|
37992
38065
|
}
|
|
37993
38066
|
|
|
37994
38067
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
37995
38068
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
37996
|
-
import
|
|
38069
|
+
import chalk246 from "chalk";
|
|
37997
38070
|
|
|
37998
38071
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
37999
38072
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -38087,12 +38160,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
38087
38160
|
const tree = summariseRepoTree(cwd);
|
|
38088
38161
|
if (tree === "") return NOTHING_PROPOSED;
|
|
38089
38162
|
console.log(
|
|
38090
|
-
|
|
38163
|
+
chalk246.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
38091
38164
|
);
|
|
38092
38165
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
38093
38166
|
if (output === void 0) {
|
|
38094
38167
|
console.log(
|
|
38095
|
-
|
|
38168
|
+
chalk246.yellow(
|
|
38096
38169
|
"Claude proposed nothing; answer each key from its current value."
|
|
38097
38170
|
)
|
|
38098
38171
|
);
|
|
@@ -38152,14 +38225,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38152
38225
|
function reportConfigured(result) {
|
|
38153
38226
|
for (const write of result.written)
|
|
38154
38227
|
console.log(
|
|
38155
|
-
|
|
38228
|
+
chalk247.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
38156
38229
|
);
|
|
38157
|
-
for (const key of result.skipped) console.log(
|
|
38158
|
-
console.log(
|
|
38230
|
+
for (const key of result.skipped) console.log(chalk247.dim(`Left ${key} unset`));
|
|
38231
|
+
console.log(chalk247.dim(`Written to ${result.target}`));
|
|
38159
38232
|
}
|
|
38160
38233
|
|
|
38161
38234
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38162
|
-
import
|
|
38235
|
+
import chalk248 from "chalk";
|
|
38163
38236
|
function savedMessage(subject) {
|
|
38164
38237
|
const head = subject.headSha.slice(0, 7);
|
|
38165
38238
|
if (subject.draft)
|
|
@@ -38170,10 +38243,10 @@ function savedMessage(subject) {
|
|
|
38170
38243
|
}
|
|
38171
38244
|
function announceSavedReview(subject, force) {
|
|
38172
38245
|
const message3 = savedMessage(subject);
|
|
38173
|
-
if (message3) console.log(
|
|
38246
|
+
if (message3) console.log(chalk248.dim(message3));
|
|
38174
38247
|
else if (force)
|
|
38175
38248
|
console.log(
|
|
38176
|
-
|
|
38249
|
+
chalk248.dim(
|
|
38177
38250
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38178
38251
|
)
|
|
38179
38252
|
);
|
|
@@ -39314,55 +39387,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
39314
39387
|
}
|
|
39315
39388
|
|
|
39316
39389
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39317
|
-
import
|
|
39390
|
+
import chalk253 from "chalk";
|
|
39318
39391
|
|
|
39319
39392
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
39320
|
-
import
|
|
39393
|
+
import chalk249 from "chalk";
|
|
39321
39394
|
var PATCH_LINE_COLOURS = {
|
|
39322
|
-
"+":
|
|
39323
|
-
"-":
|
|
39324
|
-
"@":
|
|
39395
|
+
"+": chalk249.green,
|
|
39396
|
+
"-": chalk249.red,
|
|
39397
|
+
"@": chalk249.cyan
|
|
39325
39398
|
};
|
|
39326
39399
|
function formatPatch(patch2) {
|
|
39327
39400
|
return patch2.split("\n").map(
|
|
39328
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
39401
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk249.dim)(line)}`
|
|
39329
39402
|
);
|
|
39330
39403
|
}
|
|
39331
39404
|
function formatDiff(diff3) {
|
|
39332
39405
|
return [
|
|
39333
39406
|
"",
|
|
39334
|
-
` ${
|
|
39335
|
-
...diff3.patch === null ? [` ${
|
|
39407
|
+
` ${chalk249.bold(diff3.path)} ${chalk249.dim(`(${diff3.status})`)} ${chalk249.green(`+${diff3.additions}`)} ${chalk249.red(`-${diff3.deletions}`)}`,
|
|
39408
|
+
...diff3.patch === null ? [` ${chalk249.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
39336
39409
|
];
|
|
39337
39410
|
}
|
|
39338
39411
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
39339
39412
|
if (criticalPaths.length === 0)
|
|
39340
|
-
return `${
|
|
39341
|
-
${
|
|
39413
|
+
return `${chalk249.bold.underline("Critical diffs")}
|
|
39414
|
+
${chalk249.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
39342
39415
|
if (diffs.length === 0)
|
|
39343
|
-
return `${
|
|
39344
|
-
${
|
|
39416
|
+
return `${chalk249.bold.underline("Critical diffs")}
|
|
39417
|
+
${chalk249.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
39345
39418
|
return [
|
|
39346
|
-
|
|
39419
|
+
chalk249.bold.underline("Critical diffs"),
|
|
39347
39420
|
...diffs.flatMap(formatDiff)
|
|
39348
39421
|
].join("\n");
|
|
39349
39422
|
}
|
|
39350
39423
|
|
|
39351
39424
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
39352
|
-
import
|
|
39425
|
+
import chalk250 from "chalk";
|
|
39353
39426
|
var MARKERS = {
|
|
39354
|
-
pass: () =>
|
|
39355
|
-
fail: () =>
|
|
39356
|
-
manual: () =>
|
|
39427
|
+
pass: () => chalk250.green("\u2714"),
|
|
39428
|
+
fail: () => chalk250.red("\u2718"),
|
|
39429
|
+
manual: () => chalk250.yellow("\u25A1")
|
|
39357
39430
|
};
|
|
39358
39431
|
function formatCheck(check2) {
|
|
39359
|
-
const title = check2.status === "fail" ?
|
|
39432
|
+
const title = check2.status === "fail" ? chalk250.red(check2.title) : chalk250.bold(check2.title);
|
|
39360
39433
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
39361
|
-
${
|
|
39434
|
+
${chalk250.dim(check2.reason)}`;
|
|
39362
39435
|
}
|
|
39363
39436
|
function formatGroup(heading2, checks2) {
|
|
39364
39437
|
if (checks2.length === 0) return [];
|
|
39365
|
-
return ["",
|
|
39438
|
+
return ["", chalk250.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
39366
39439
|
}
|
|
39367
39440
|
function formatHighLevelChecklist(checks2) {
|
|
39368
39441
|
const deterministic = checks2.filter(
|
|
@@ -39371,7 +39444,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39371
39444
|
const failed3 = deterministic.filter(
|
|
39372
39445
|
(check2) => check2.status === "fail"
|
|
39373
39446
|
).length;
|
|
39374
|
-
const summary = failed3 === 0 ?
|
|
39447
|
+
const summary = failed3 === 0 ? chalk250.green(`All ${deterministic.length} deterministic checks pass`) : chalk250.red(
|
|
39375
39448
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
39376
39449
|
);
|
|
39377
39450
|
return [
|
|
@@ -39386,37 +39459,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
39386
39459
|
}
|
|
39387
39460
|
|
|
39388
39461
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
39389
|
-
import
|
|
39462
|
+
import chalk251 from "chalk";
|
|
39390
39463
|
var STATUS_MARKERS = {
|
|
39391
|
-
added: () =>
|
|
39392
|
-
removed: () =>
|
|
39393
|
-
modified: () =>
|
|
39464
|
+
added: () => chalk251.green("A"),
|
|
39465
|
+
removed: () => chalk251.red("D"),
|
|
39466
|
+
modified: () => chalk251.yellow("M")
|
|
39394
39467
|
};
|
|
39395
39468
|
function counts(additions, deletions) {
|
|
39396
|
-
return `${
|
|
39469
|
+
return `${chalk251.green(`+${additions}`)} ${chalk251.red(`-${deletions}`)}`;
|
|
39397
39470
|
}
|
|
39398
39471
|
function formatNode(node, indent4) {
|
|
39399
39472
|
if (node.kind === "file")
|
|
39400
39473
|
return [
|
|
39401
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
39474
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk251.dim(counts(node.additions, node.deletions))}`
|
|
39402
39475
|
];
|
|
39403
39476
|
const dir = node;
|
|
39404
39477
|
return [
|
|
39405
|
-
`${indent4}${
|
|
39478
|
+
`${indent4}${chalk251.bold(`${dir.name}/`)} ${chalk251.dim(counts(dir.additions, dir.deletions))}`,
|
|
39406
39479
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
39407
39480
|
];
|
|
39408
39481
|
}
|
|
39409
39482
|
function formatHighLevelStructure(structure) {
|
|
39410
39483
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
39411
39484
|
return [
|
|
39412
|
-
|
|
39485
|
+
chalk251.bold.underline("Structure"),
|
|
39413
39486
|
` ${summary}`,
|
|
39414
39487
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
39415
39488
|
].join("\n");
|
|
39416
39489
|
}
|
|
39417
39490
|
|
|
39418
39491
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
39419
|
-
import
|
|
39492
|
+
import chalk252 from "chalk";
|
|
39420
39493
|
function changeMarker(change) {
|
|
39421
39494
|
if (change === "added") return "A";
|
|
39422
39495
|
if (change === "modified") return "M";
|
|
@@ -39425,22 +39498,22 @@ function changeMarker(change) {
|
|
|
39425
39498
|
function formatNode2(node, depth) {
|
|
39426
39499
|
const indent4 = " ".repeat(depth + 2);
|
|
39427
39500
|
if (node.kind === "it")
|
|
39428
|
-
return [`${indent4}${
|
|
39501
|
+
return [`${indent4}${chalk252.dim(changeMarker(node.change))} ${node.name}`];
|
|
39429
39502
|
return [
|
|
39430
|
-
`${indent4}${
|
|
39503
|
+
`${indent4}${chalk252.bold(node.name)}`,
|
|
39431
39504
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
39432
39505
|
];
|
|
39433
39506
|
}
|
|
39434
39507
|
function formatHighLevelTests(files, testPaths) {
|
|
39435
|
-
const heading2 =
|
|
39508
|
+
const heading2 = chalk252.bold.underline("Changed tests");
|
|
39436
39509
|
if (files.length === 0)
|
|
39437
39510
|
return `${heading2}
|
|
39438
|
-
${
|
|
39511
|
+
${chalk252.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
39439
39512
|
return [
|
|
39440
39513
|
heading2,
|
|
39441
39514
|
...files.flatMap((file) => [
|
|
39442
39515
|
"",
|
|
39443
|
-
` ${
|
|
39516
|
+
` ${chalk252.bold(file.path)} ${chalk252.dim(`(${file.status})`)}`,
|
|
39444
39517
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
39445
39518
|
])
|
|
39446
39519
|
].join("\n");
|
|
@@ -39454,10 +39527,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
39454
39527
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
39455
39528
|
function printHighLevelChecklist(subject) {
|
|
39456
39529
|
console.log(
|
|
39457
|
-
|
|
39530
|
+
chalk253.bold(
|
|
39458
39531
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
39459
39532
|
),
|
|
39460
|
-
|
|
39533
|
+
chalk253.dim(
|
|
39461
39534
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
39462
39535
|
)
|
|
39463
39536
|
);
|
|
@@ -39471,12 +39544,12 @@ function printHighLevelChecklist(subject) {
|
|
|
39471
39544
|
console.log("");
|
|
39472
39545
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
39473
39546
|
console.log(
|
|
39474
|
-
|
|
39547
|
+
chalk253.dim(
|
|
39475
39548
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
39476
39549
|
)
|
|
39477
39550
|
);
|
|
39478
39551
|
console.log(
|
|
39479
|
-
|
|
39552
|
+
chalk253.dim(
|
|
39480
39553
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
39481
39554
|
)
|
|
39482
39555
|
);
|
|
@@ -39762,18 +39835,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
39762
39835
|
}
|
|
39763
39836
|
|
|
39764
39837
|
// src/commands/review/warnOutOfDiff.ts
|
|
39765
|
-
import
|
|
39838
|
+
import chalk254 from "chalk";
|
|
39766
39839
|
function warnOutOfDiff(outOfDiff) {
|
|
39767
39840
|
if (outOfDiff.length === 0) return;
|
|
39768
39841
|
console.warn(
|
|
39769
|
-
|
|
39842
|
+
chalk254.yellow(
|
|
39770
39843
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
39771
39844
|
)
|
|
39772
39845
|
);
|
|
39773
39846
|
for (const finding of outOfDiff) {
|
|
39774
39847
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
39775
39848
|
console.warn(
|
|
39776
|
-
` ${
|
|
39849
|
+
` ${chalk254.yellow("\xB7")} ${finding.title} ${chalk254.dim(
|
|
39777
39850
|
`(${finding.file}:${range})`
|
|
39778
39851
|
)}`
|
|
39779
39852
|
);
|
|
@@ -39800,18 +39873,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
39800
39873
|
}
|
|
39801
39874
|
|
|
39802
39875
|
// src/commands/review/warnUnlocated.ts
|
|
39803
|
-
import
|
|
39876
|
+
import chalk255 from "chalk";
|
|
39804
39877
|
function warnUnlocated(unlocated) {
|
|
39805
39878
|
if (unlocated.length === 0) return;
|
|
39806
39879
|
console.warn(
|
|
39807
|
-
|
|
39880
|
+
chalk255.yellow(
|
|
39808
39881
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
39809
39882
|
)
|
|
39810
39883
|
);
|
|
39811
39884
|
for (const finding of unlocated) {
|
|
39812
|
-
const where = finding.location ||
|
|
39885
|
+
const where = finding.location || chalk255.dim("missing");
|
|
39813
39886
|
console.warn(
|
|
39814
|
-
` ${
|
|
39887
|
+
` ${chalk255.yellow("\xB7")} ${finding.title} ${chalk255.dim(`(${where})`)}`
|
|
39815
39888
|
);
|
|
39816
39889
|
}
|
|
39817
39890
|
}
|
|
@@ -41956,7 +42029,7 @@ function registerReview(program) {
|
|
|
41956
42029
|
|
|
41957
42030
|
// src/commands/rules/indexRules.ts
|
|
41958
42031
|
import path87 from "path";
|
|
41959
|
-
import
|
|
42032
|
+
import chalk256 from "chalk";
|
|
41960
42033
|
|
|
41961
42034
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
41962
42035
|
import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
@@ -42043,24 +42116,24 @@ function indexRules() {
|
|
|
42043
42116
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
42044
42117
|
if (directories.length === 0) {
|
|
42045
42118
|
console.log(
|
|
42046
|
-
|
|
42119
|
+
chalk256.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
42047
42120
|
);
|
|
42048
42121
|
return;
|
|
42049
42122
|
}
|
|
42050
42123
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
42051
42124
|
for (const directory of directories)
|
|
42052
|
-
console.log(` ${
|
|
42125
|
+
console.log(` ${chalk256.cyan(directory)}`);
|
|
42053
42126
|
}
|
|
42054
42127
|
|
|
42055
42128
|
// src/commands/rules/listRules.ts
|
|
42056
42129
|
import path88 from "path";
|
|
42057
|
-
import
|
|
42130
|
+
import chalk257 from "chalk";
|
|
42058
42131
|
function listRules(target, options2 = {}) {
|
|
42059
42132
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
42060
42133
|
const rules2 = readScopedRules(resolved);
|
|
42061
42134
|
if (rules2.length === 0) {
|
|
42062
42135
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
42063
|
-
console.log(
|
|
42136
|
+
console.log(chalk257.gray(`No rules in scope for ${label}`));
|
|
42064
42137
|
return;
|
|
42065
42138
|
}
|
|
42066
42139
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -42070,21 +42143,21 @@ function listRules(target, options2 = {}) {
|
|
|
42070
42143
|
if (rule.source !== shown) {
|
|
42071
42144
|
shown = rule.source;
|
|
42072
42145
|
console.log(
|
|
42073
|
-
|
|
42146
|
+
chalk257.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
42074
42147
|
);
|
|
42075
42148
|
}
|
|
42076
42149
|
console.log(
|
|
42077
|
-
` ${
|
|
42150
|
+
` ${chalk257.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
42078
42151
|
);
|
|
42079
42152
|
if (options2.full && rule.title)
|
|
42080
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42153
|
+
console.log(` ${" ".repeat(width2)} ${chalk257.dim(rule.text)}`);
|
|
42081
42154
|
}
|
|
42082
42155
|
}
|
|
42083
42156
|
|
|
42084
42157
|
// src/commands/rules/addRule.ts
|
|
42085
42158
|
import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
|
|
42086
42159
|
import path90 from "path";
|
|
42087
|
-
import
|
|
42160
|
+
import chalk258 from "chalk";
|
|
42088
42161
|
|
|
42089
42162
|
// src/commands/rules/insertRuleBullet.ts
|
|
42090
42163
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42143,7 +42216,7 @@ function read2(file) {
|
|
|
42143
42216
|
function addRule(text18, options2) {
|
|
42144
42217
|
const rule = text18.trim();
|
|
42145
42218
|
if (rule === "") {
|
|
42146
|
-
console.error(
|
|
42219
|
+
console.error(chalk258.red("Rule text is required"));
|
|
42147
42220
|
process.exitCode = 1;
|
|
42148
42221
|
return;
|
|
42149
42222
|
}
|
|
@@ -42161,14 +42234,14 @@ function addRule(text18, options2) {
|
|
|
42161
42234
|
);
|
|
42162
42235
|
updateScopedRulesIndex(root2);
|
|
42163
42236
|
console.log(
|
|
42164
|
-
`Added ${
|
|
42237
|
+
`Added ${chalk258.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42165
42238
|
);
|
|
42166
42239
|
}
|
|
42167
42240
|
|
|
42168
42241
|
// src/commands/rules/addUserRule.ts
|
|
42169
|
-
import
|
|
42170
|
-
function
|
|
42171
|
-
console.error(
|
|
42242
|
+
import chalk259 from "chalk";
|
|
42243
|
+
function fail9(message3) {
|
|
42244
|
+
console.error(chalk259.red(message3));
|
|
42172
42245
|
process.exitCode = 1;
|
|
42173
42246
|
}
|
|
42174
42247
|
function asRules(value) {
|
|
@@ -42186,8 +42259,8 @@ async function addToUserDb(rule) {
|
|
|
42186
42259
|
...asRules(current),
|
|
42187
42260
|
rule
|
|
42188
42261
|
]);
|
|
42189
|
-
if (!result.ok) return
|
|
42190
|
-
console.log(`Added ${
|
|
42262
|
+
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42263
|
+
console.log(`Added ${chalk259.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42191
42264
|
}
|
|
42192
42265
|
function addToUserNode(rule, globalConfigPath) {
|
|
42193
42266
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42198,17 +42271,17 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42198
42271
|
process.cwd(),
|
|
42199
42272
|
globalConfigPath
|
|
42200
42273
|
);
|
|
42201
|
-
if (!result.ok) return
|
|
42274
|
+
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42202
42275
|
console.log(
|
|
42203
|
-
`Added ${
|
|
42276
|
+
`Added ${chalk259.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42204
42277
|
);
|
|
42205
42278
|
}
|
|
42206
42279
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
42207
42280
|
const error = optionsError(options2);
|
|
42208
|
-
if (error) return
|
|
42281
|
+
if (error) return fail9(error);
|
|
42209
42282
|
const rule = { title: options2.title?.trim() ?? "", text: text18.trim() };
|
|
42210
42283
|
if (rule.text === "" || rule.title === "")
|
|
42211
|
-
return
|
|
42284
|
+
return fail9("User rules need both rule text and --title");
|
|
42212
42285
|
if (options2.user) return addToUserDb(rule);
|
|
42213
42286
|
addToUserNode(rule, globalConfigPath);
|
|
42214
42287
|
}
|
|
@@ -42255,7 +42328,7 @@ function registerRules(program) {
|
|
|
42255
42328
|
}
|
|
42256
42329
|
|
|
42257
42330
|
// src/commands/seq/seqAuth.ts
|
|
42258
|
-
import
|
|
42331
|
+
import chalk261 from "chalk";
|
|
42259
42332
|
|
|
42260
42333
|
// src/commands/seq/loadConnections.ts
|
|
42261
42334
|
function loadConnections2() {
|
|
@@ -42284,10 +42357,10 @@ function setDefaultConnection(name) {
|
|
|
42284
42357
|
}
|
|
42285
42358
|
|
|
42286
42359
|
// src/shared/assertUniqueName.ts
|
|
42287
|
-
import
|
|
42360
|
+
import chalk260 from "chalk";
|
|
42288
42361
|
function assertUniqueName(existingNames, name) {
|
|
42289
42362
|
if (existingNames.includes(name)) {
|
|
42290
|
-
console.error(
|
|
42363
|
+
console.error(chalk260.red(`Connection "${name}" already exists.`));
|
|
42291
42364
|
process.exit(1);
|
|
42292
42365
|
}
|
|
42293
42366
|
}
|
|
@@ -42305,16 +42378,16 @@ async function promptConnection2(existingNames) {
|
|
|
42305
42378
|
var seqAuth = createConnectionAuth({
|
|
42306
42379
|
load: loadConnections2,
|
|
42307
42380
|
save: saveConnections2,
|
|
42308
|
-
format: (c) => `${
|
|
42381
|
+
format: (c) => `${chalk261.bold(c.name)} ${c.url}`,
|
|
42309
42382
|
promptNew: promptConnection2,
|
|
42310
42383
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
42311
42384
|
});
|
|
42312
42385
|
|
|
42313
42386
|
// src/commands/seq/seqQuery.ts
|
|
42314
|
-
import
|
|
42387
|
+
import chalk265 from "chalk";
|
|
42315
42388
|
|
|
42316
42389
|
// src/commands/seq/fetchSeq.ts
|
|
42317
|
-
import
|
|
42390
|
+
import chalk262 from "chalk";
|
|
42318
42391
|
async function fetchSeq(conn, path109, params) {
|
|
42319
42392
|
const url = `${conn.url}${path109}?${params}`;
|
|
42320
42393
|
const response = await fetch(url, {
|
|
@@ -42325,7 +42398,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
42325
42398
|
});
|
|
42326
42399
|
if (!response.ok) {
|
|
42327
42400
|
const body = await response.text();
|
|
42328
|
-
console.error(
|
|
42401
|
+
console.error(chalk262.red(`Seq returned ${response.status}: ${body}`));
|
|
42329
42402
|
process.exit(1);
|
|
42330
42403
|
}
|
|
42331
42404
|
return response;
|
|
@@ -42384,23 +42457,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
42384
42457
|
}
|
|
42385
42458
|
|
|
42386
42459
|
// src/commands/seq/formatEvent.ts
|
|
42387
|
-
import
|
|
42460
|
+
import chalk263 from "chalk";
|
|
42388
42461
|
function levelColor(level) {
|
|
42389
42462
|
switch (level) {
|
|
42390
42463
|
case "Fatal":
|
|
42391
|
-
return
|
|
42464
|
+
return chalk263.bgRed.white;
|
|
42392
42465
|
case "Error":
|
|
42393
|
-
return
|
|
42466
|
+
return chalk263.red;
|
|
42394
42467
|
case "Warning":
|
|
42395
|
-
return
|
|
42468
|
+
return chalk263.yellow;
|
|
42396
42469
|
case "Information":
|
|
42397
|
-
return
|
|
42470
|
+
return chalk263.cyan;
|
|
42398
42471
|
case "Debug":
|
|
42399
|
-
return
|
|
42472
|
+
return chalk263.gray;
|
|
42400
42473
|
case "Verbose":
|
|
42401
|
-
return
|
|
42474
|
+
return chalk263.dim;
|
|
42402
42475
|
default:
|
|
42403
|
-
return
|
|
42476
|
+
return chalk263.white;
|
|
42404
42477
|
}
|
|
42405
42478
|
}
|
|
42406
42479
|
function levelAbbrev(level) {
|
|
@@ -42441,12 +42514,12 @@ function formatTimestamp(iso) {
|
|
|
42441
42514
|
function formatEvent(event) {
|
|
42442
42515
|
const color = levelColor(event.Level);
|
|
42443
42516
|
const abbrev = levelAbbrev(event.Level);
|
|
42444
|
-
const ts10 =
|
|
42517
|
+
const ts10 = chalk263.dim(formatTimestamp(event.Timestamp));
|
|
42445
42518
|
const msg = renderMessage(event);
|
|
42446
42519
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
42447
42520
|
if (event.Exception) {
|
|
42448
42521
|
for (const line of event.Exception.split("\n")) {
|
|
42449
|
-
lines2.push(
|
|
42522
|
+
lines2.push(chalk263.red(` ${line}`));
|
|
42450
42523
|
}
|
|
42451
42524
|
}
|
|
42452
42525
|
return lines2.join("\n");
|
|
@@ -42479,11 +42552,11 @@ function rejectTimestampFilter(filter) {
|
|
|
42479
42552
|
}
|
|
42480
42553
|
|
|
42481
42554
|
// src/shared/resolveNamedConnection.ts
|
|
42482
|
-
import
|
|
42555
|
+
import chalk264 from "chalk";
|
|
42483
42556
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
42484
42557
|
if (connections.length === 0) {
|
|
42485
42558
|
console.error(
|
|
42486
|
-
|
|
42559
|
+
chalk264.red(
|
|
42487
42560
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
42488
42561
|
)
|
|
42489
42562
|
);
|
|
@@ -42492,7 +42565,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
42492
42565
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
42493
42566
|
const connection = connections.find((c) => c.name === target);
|
|
42494
42567
|
if (!connection) {
|
|
42495
|
-
console.error(
|
|
42568
|
+
console.error(chalk264.red(`${kind} connection "${target}" not found.`));
|
|
42496
42569
|
process.exit(1);
|
|
42497
42570
|
}
|
|
42498
42571
|
return connection;
|
|
@@ -42521,7 +42594,7 @@ async function seqQuery(filter, options2) {
|
|
|
42521
42594
|
new URLSearchParams({ filter, count: String(count10) })
|
|
42522
42595
|
);
|
|
42523
42596
|
if (events.length === 0) {
|
|
42524
|
-
console.log(
|
|
42597
|
+
console.log(chalk265.yellow("No events found."));
|
|
42525
42598
|
return;
|
|
42526
42599
|
}
|
|
42527
42600
|
if (options2.json) {
|
|
@@ -42532,11 +42605,11 @@ async function seqQuery(filter, options2) {
|
|
|
42532
42605
|
for (const event of chronological) {
|
|
42533
42606
|
console.log(formatEvent(event));
|
|
42534
42607
|
}
|
|
42535
|
-
console.log(
|
|
42608
|
+
console.log(chalk265.dim(`
|
|
42536
42609
|
${events.length} events`));
|
|
42537
42610
|
if (events.length >= count10) {
|
|
42538
42611
|
console.log(
|
|
42539
|
-
|
|
42612
|
+
chalk265.yellow(
|
|
42540
42613
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
42541
42614
|
)
|
|
42542
42615
|
);
|
|
@@ -42544,10 +42617,10 @@ ${events.length} events`));
|
|
|
42544
42617
|
}
|
|
42545
42618
|
|
|
42546
42619
|
// src/shared/setNamedDefaultConnection.ts
|
|
42547
|
-
import
|
|
42620
|
+
import chalk266 from "chalk";
|
|
42548
42621
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
42549
42622
|
if (!connections.find((c) => c.name === name)) {
|
|
42550
|
-
console.error(
|
|
42623
|
+
console.error(chalk266.red(`Connection "${name}" not found.`));
|
|
42551
42624
|
process.exit(1);
|
|
42552
42625
|
}
|
|
42553
42626
|
setDefault(name);
|
|
@@ -42849,7 +42922,7 @@ function registerSlack(program) {
|
|
|
42849
42922
|
}
|
|
42850
42923
|
|
|
42851
42924
|
// src/commands/sql/sqlAuth.ts
|
|
42852
|
-
import
|
|
42925
|
+
import chalk268 from "chalk";
|
|
42853
42926
|
|
|
42854
42927
|
// src/commands/sql/loadConnections.ts
|
|
42855
42928
|
function loadConnections3() {
|
|
@@ -42878,7 +42951,7 @@ function setDefaultConnection2(name) {
|
|
|
42878
42951
|
}
|
|
42879
42952
|
|
|
42880
42953
|
// src/commands/sql/promptConnection.ts
|
|
42881
|
-
import
|
|
42954
|
+
import chalk267 from "chalk";
|
|
42882
42955
|
async function promptConnection3(existingNames) {
|
|
42883
42956
|
const name = await promptInput("name", "Connection name:", "default");
|
|
42884
42957
|
assertUniqueName(existingNames, name);
|
|
@@ -42886,7 +42959,7 @@ async function promptConnection3(existingNames) {
|
|
|
42886
42959
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
42887
42960
|
const port = Number.parseInt(portStr, 10);
|
|
42888
42961
|
if (!Number.isFinite(port)) {
|
|
42889
|
-
console.error(
|
|
42962
|
+
console.error(chalk267.red(`Invalid port "${portStr}".`));
|
|
42890
42963
|
process.exit(1);
|
|
42891
42964
|
}
|
|
42892
42965
|
const user = await promptInput("user", "User:");
|
|
@@ -42899,13 +42972,13 @@ async function promptConnection3(existingNames) {
|
|
|
42899
42972
|
var sqlAuth = createConnectionAuth({
|
|
42900
42973
|
load: loadConnections3,
|
|
42901
42974
|
save: saveConnections3,
|
|
42902
|
-
format: (c) => `${
|
|
42975
|
+
format: (c) => `${chalk268.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
42903
42976
|
promptNew: promptConnection3,
|
|
42904
42977
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
42905
42978
|
});
|
|
42906
42979
|
|
|
42907
42980
|
// src/commands/sql/printTable.ts
|
|
42908
|
-
import
|
|
42981
|
+
import chalk269 from "chalk";
|
|
42909
42982
|
function formatCell(value) {
|
|
42910
42983
|
if (value === null || value === void 0) return "";
|
|
42911
42984
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -42914,7 +42987,7 @@ function formatCell(value) {
|
|
|
42914
42987
|
}
|
|
42915
42988
|
function printTable(rows) {
|
|
42916
42989
|
if (rows.length === 0) {
|
|
42917
|
-
console.log(
|
|
42990
|
+
console.log(chalk269.yellow("(no rows)"));
|
|
42918
42991
|
return;
|
|
42919
42992
|
}
|
|
42920
42993
|
const columns = Object.keys(rows[0]);
|
|
@@ -42922,13 +42995,13 @@ function printTable(rows) {
|
|
|
42922
42995
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
42923
42996
|
);
|
|
42924
42997
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
42925
|
-
console.log(
|
|
42926
|
-
console.log(
|
|
42998
|
+
console.log(chalk269.dim(header));
|
|
42999
|
+
console.log(chalk269.dim("-".repeat(header.length)));
|
|
42927
43000
|
for (const row3 of rows) {
|
|
42928
43001
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
42929
43002
|
console.log(line);
|
|
42930
43003
|
}
|
|
42931
|
-
console.log(
|
|
43004
|
+
console.log(chalk269.dim(`
|
|
42932
43005
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
42933
43006
|
}
|
|
42934
43007
|
|
|
@@ -42988,7 +43061,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
42988
43061
|
}
|
|
42989
43062
|
|
|
42990
43063
|
// src/commands/sql/sqlMutate.ts
|
|
42991
|
-
import
|
|
43064
|
+
import chalk270 from "chalk";
|
|
42992
43065
|
|
|
42993
43066
|
// src/commands/sql/isMutation.ts
|
|
42994
43067
|
var MUTATION_KEYWORDS = [
|
|
@@ -43022,7 +43095,7 @@ function isMutation(sql30) {
|
|
|
43022
43095
|
async function sqlMutate(query, connectionName) {
|
|
43023
43096
|
if (!isMutation(query)) {
|
|
43024
43097
|
console.error(
|
|
43025
|
-
|
|
43098
|
+
chalk270.red(
|
|
43026
43099
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
43027
43100
|
)
|
|
43028
43101
|
);
|
|
@@ -43032,18 +43105,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
43032
43105
|
const pool = await sqlConnect(conn);
|
|
43033
43106
|
try {
|
|
43034
43107
|
const result = await pool.request().query(query);
|
|
43035
|
-
console.log(
|
|
43108
|
+
console.log(chalk270.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
43036
43109
|
} finally {
|
|
43037
43110
|
await pool.close();
|
|
43038
43111
|
}
|
|
43039
43112
|
}
|
|
43040
43113
|
|
|
43041
43114
|
// src/commands/sql/sqlQuery.ts
|
|
43042
|
-
import
|
|
43115
|
+
import chalk271 from "chalk";
|
|
43043
43116
|
async function sqlQuery(query, connectionName) {
|
|
43044
43117
|
if (isMutation(query)) {
|
|
43045
43118
|
console.error(
|
|
43046
|
-
|
|
43119
|
+
chalk271.red(
|
|
43047
43120
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
43048
43121
|
)
|
|
43049
43122
|
);
|
|
@@ -43058,7 +43131,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
43058
43131
|
printTable(rows);
|
|
43059
43132
|
} else {
|
|
43060
43133
|
console.log(
|
|
43061
|
-
|
|
43134
|
+
chalk271.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
43062
43135
|
);
|
|
43063
43136
|
}
|
|
43064
43137
|
} finally {
|
|
@@ -43473,7 +43546,7 @@ function syncPi(claudeDir, options2) {
|
|
|
43473
43546
|
// src/commands/sync/syncSettings.ts
|
|
43474
43547
|
import * as fs47 from "fs";
|
|
43475
43548
|
import * as path101 from "path";
|
|
43476
|
-
import
|
|
43549
|
+
import chalk272 from "chalk";
|
|
43477
43550
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
43478
43551
|
const source = path101.join(claudeDir, "settings.json");
|
|
43479
43552
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -43492,7 +43565,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43492
43565
|
if (mergedContent !== normalizedTarget) {
|
|
43493
43566
|
if (!options2?.yes) {
|
|
43494
43567
|
console.log(
|
|
43495
|
-
|
|
43568
|
+
chalk272.yellow(
|
|
43496
43569
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
43497
43570
|
)
|
|
43498
43571
|
);
|
|
@@ -43500,7 +43573,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
43500
43573
|
printDiff(targetContent, mergedContent);
|
|
43501
43574
|
printAutoConfirmHint();
|
|
43502
43575
|
const confirm = await promptConfirm(
|
|
43503
|
-
|
|
43576
|
+
chalk272.red("Overwrite existing settings.json?"),
|
|
43504
43577
|
false
|
|
43505
43578
|
);
|
|
43506
43579
|
if (!confirm) {
|
|
@@ -46048,7 +46121,7 @@ function parseEnvPairs(pairs) {
|
|
|
46048
46121
|
}
|
|
46049
46122
|
|
|
46050
46123
|
// src/commands/run/parseParamSpecs.ts
|
|
46051
|
-
function
|
|
46124
|
+
function fail10(spec) {
|
|
46052
46125
|
console.error(
|
|
46053
46126
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
46054
46127
|
);
|
|
@@ -46058,14 +46131,14 @@ function parseParamSpec(spec) {
|
|
|
46058
46131
|
const eq52 = spec.indexOf("=");
|
|
46059
46132
|
const name = eq52 === -1 ? spec : spec.slice(0, eq52);
|
|
46060
46133
|
if (eq52 !== -1) {
|
|
46061
|
-
if (eq52 === 0 || name.endsWith("!"))
|
|
46134
|
+
if (eq52 === 0 || name.endsWith("!")) fail10(spec);
|
|
46062
46135
|
return { name, default: spec.slice(eq52 + 1) };
|
|
46063
46136
|
}
|
|
46064
46137
|
if (name.endsWith("!")) {
|
|
46065
|
-
if (name.length === 1)
|
|
46138
|
+
if (name.length === 1) fail10(spec);
|
|
46066
46139
|
return { name: name.slice(0, -1), required: true };
|
|
46067
46140
|
}
|
|
46068
|
-
if (name.length === 0)
|
|
46141
|
+
if (name.length === 0) fail10(spec);
|
|
46069
46142
|
return { name };
|
|
46070
46143
|
}
|
|
46071
46144
|
function parseParamSpecs(specs) {
|
|
@@ -46342,18 +46415,18 @@ function registerRun(program) {
|
|
|
46342
46415
|
}
|
|
46343
46416
|
|
|
46344
46417
|
// src/commands/sessions/nodes/formatLink.ts
|
|
46345
|
-
import
|
|
46418
|
+
import chalk273 from "chalk";
|
|
46346
46419
|
var STATE_COLOURS = {
|
|
46347
|
-
connected:
|
|
46348
|
-
connecting:
|
|
46349
|
-
disconnected:
|
|
46350
|
-
"version-blocked":
|
|
46420
|
+
connected: chalk273.green,
|
|
46421
|
+
connecting: chalk273.yellow,
|
|
46422
|
+
disconnected: chalk273.red,
|
|
46423
|
+
"version-blocked": chalk273.red
|
|
46351
46424
|
};
|
|
46352
46425
|
function formatLink(link3) {
|
|
46353
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
46426
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk273.white;
|
|
46354
46427
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
46355
46428
|
const error = link3.error ? `
|
|
46356
|
-
${
|
|
46429
|
+
${chalk273.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
46357
46430
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
46358
46431
|
}
|
|
46359
46432
|
|
|
@@ -49109,6 +49182,12 @@ function holdBlockingPreview(session, waiters, client, preview) {
|
|
|
49109
49182
|
preview.requestId
|
|
49110
49183
|
);
|
|
49111
49184
|
session.pendingPrPreview = supersedes ? { ...preview, supersedes } : preview;
|
|
49185
|
+
if (session.pendingShow) {
|
|
49186
|
+
daemonLog(
|
|
49187
|
+
`pr-preview show closed: id=${session.id} requestId=${session.pendingShow.requestId} by=${preview.requestId}`
|
|
49188
|
+
);
|
|
49189
|
+
session.pendingShow = void 0;
|
|
49190
|
+
}
|
|
49112
49191
|
waiters.set(session.id, client);
|
|
49113
49192
|
}
|
|
49114
49193
|
|
|
@@ -54355,7 +54434,7 @@ async function closeSession() {
|
|
|
54355
54434
|
}
|
|
54356
54435
|
|
|
54357
54436
|
// src/commands/sessions/nodes/listNodes.ts
|
|
54358
|
-
import
|
|
54437
|
+
import chalk274 from "chalk";
|
|
54359
54438
|
async function nodesReport() {
|
|
54360
54439
|
const live = await queryNodes();
|
|
54361
54440
|
if (live)
|
|
@@ -54372,10 +54451,10 @@ async function listNodes(options2) {
|
|
|
54372
54451
|
console.log(JSON.stringify(report, null, 2));
|
|
54373
54452
|
return;
|
|
54374
54453
|
}
|
|
54375
|
-
console.log(`${report.local} ${
|
|
54454
|
+
console.log(`${report.local} ${chalk274.dim("(this node)")}`);
|
|
54376
54455
|
if (!report.daemonRunning)
|
|
54377
|
-
console.log(
|
|
54378
|
-
if (report.links.length === 0) console.log(
|
|
54456
|
+
console.log(chalk274.dim(" daemon not running; showing configured links"));
|
|
54457
|
+
if (report.links.length === 0) console.log(chalk274.dim(" no links"));
|
|
54379
54458
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
54380
54459
|
}
|
|
54381
54460
|
|
|
@@ -54397,7 +54476,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
54397
54476
|
}
|
|
54398
54477
|
|
|
54399
54478
|
// src/commands/sessions/nodes/printReport.ts
|
|
54400
|
-
import
|
|
54479
|
+
import chalk275 from "chalk";
|
|
54401
54480
|
function printReport(report) {
|
|
54402
54481
|
if (report.links.length === 0) {
|
|
54403
54482
|
console.log(`${report.local} has no links`);
|
|
@@ -54411,11 +54490,11 @@ function printReport(report) {
|
|
|
54411
54490
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
54412
54491
|
}
|
|
54413
54492
|
function printDiagnosis(diagnosis) {
|
|
54414
|
-
console.log(`${
|
|
54493
|
+
console.log(`${chalk275.bold(diagnosis.name)} ${chalk275.dim(diagnosis.url)}`);
|
|
54415
54494
|
for (const hop of diagnosis.hops) {
|
|
54416
|
-
const mark = hop.ok ?
|
|
54495
|
+
const mark = hop.ok ? chalk275.green("\u2713") : chalk275.red("\u2717");
|
|
54417
54496
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
54418
|
-
if (hop.remediation) console.log(` ${
|
|
54497
|
+
if (hop.remediation) console.log(` ${chalk275.yellow(hop.remediation)}`);
|
|
54419
54498
|
}
|
|
54420
54499
|
}
|
|
54421
54500
|
|
|
@@ -54487,14 +54566,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
54487
54566
|
}
|
|
54488
54567
|
|
|
54489
54568
|
// src/commands/sessions/nodes/linkNode.ts
|
|
54490
|
-
import
|
|
54569
|
+
import chalk278 from "chalk";
|
|
54491
54570
|
|
|
54492
54571
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
54493
|
-
import
|
|
54572
|
+
import chalk276 from "chalk";
|
|
54494
54573
|
async function notifyDaemonLinks() {
|
|
54495
54574
|
if (!await isDaemonRunning()) {
|
|
54496
54575
|
console.log(
|
|
54497
|
-
|
|
54576
|
+
chalk276.yellow(
|
|
54498
54577
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
54499
54578
|
)
|
|
54500
54579
|
);
|
|
@@ -54502,11 +54581,11 @@ async function notifyDaemonLinks() {
|
|
|
54502
54581
|
}
|
|
54503
54582
|
try {
|
|
54504
54583
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
54505
|
-
console.log(
|
|
54584
|
+
console.log(chalk276.dim("The sessions daemon reloaded its links."));
|
|
54506
54585
|
} catch (error) {
|
|
54507
54586
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
54508
54587
|
console.log(
|
|
54509
|
-
|
|
54588
|
+
chalk276.yellow(
|
|
54510
54589
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
54511
54590
|
)
|
|
54512
54591
|
);
|
|
@@ -54514,7 +54593,7 @@ async function notifyDaemonLinks() {
|
|
|
54514
54593
|
}
|
|
54515
54594
|
|
|
54516
54595
|
// src/commands/sessions/nodes/readLinks.ts
|
|
54517
|
-
import
|
|
54596
|
+
import chalk277 from "chalk";
|
|
54518
54597
|
|
|
54519
54598
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
54520
54599
|
async function writeLinks(links2) {
|
|
@@ -54537,7 +54616,7 @@ async function readLinks() {
|
|
|
54537
54616
|
await writeLinks(links2);
|
|
54538
54617
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
54539
54618
|
console.log(
|
|
54540
|
-
|
|
54619
|
+
chalk277.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
54541
54620
|
);
|
|
54542
54621
|
return links2;
|
|
54543
54622
|
}
|
|
@@ -54593,7 +54672,7 @@ async function linkNode(name, url, options2) {
|
|
|
54593
54672
|
throw new Error(`${name} is this node; link to a different node`);
|
|
54594
54673
|
const link3 = await buildLink(name, url, options2);
|
|
54595
54674
|
await writeLinks([...others, link3]);
|
|
54596
|
-
console.log(
|
|
54675
|
+
console.log(chalk278.green(`Linked ${name} (${link3.url})`));
|
|
54597
54676
|
await notifyDaemonLinks();
|
|
54598
54677
|
}
|
|
54599
54678
|
|
|
@@ -54614,14 +54693,14 @@ async function linkStatus(name, query = queryNodes) {
|
|
|
54614
54693
|
return (await query())?.links.find((l) => l.name === name);
|
|
54615
54694
|
}
|
|
54616
54695
|
async function awaitLinkReturn(name, options2, deps2 = {}) {
|
|
54617
|
-
const { query = queryNodes, sleep:
|
|
54696
|
+
const { query = queryNodes, sleep: sleep3 = wait, now = Date.now } = deps2;
|
|
54618
54697
|
const deadline = now() + options2.timeoutMs;
|
|
54619
54698
|
let sawDown = options2.sawDown;
|
|
54620
54699
|
while (now() < deadline) {
|
|
54621
54700
|
const link3 = await linkStatus(name, query);
|
|
54622
54701
|
if (link3?.state !== "connected") sawDown = true;
|
|
54623
54702
|
else if (sawDown) return link3;
|
|
54624
|
-
await
|
|
54703
|
+
await sleep3(POLL_MS5);
|
|
54625
54704
|
}
|
|
54626
54705
|
return void 0;
|
|
54627
54706
|
}
|
|
@@ -54658,14 +54737,14 @@ function startPeerAction(name, action) {
|
|
|
54658
54737
|
const line = `nodes ${action} ${name} trace=${traceId}`;
|
|
54659
54738
|
console.log(line);
|
|
54660
54739
|
appendDaemonLog(line);
|
|
54661
|
-
const
|
|
54740
|
+
const fail12 = async (summary, error) => new Error(await describeFailure(name, summary, error));
|
|
54662
54741
|
return {
|
|
54663
54742
|
spec,
|
|
54664
54743
|
traceId,
|
|
54665
|
-
fail:
|
|
54744
|
+
fail: fail12,
|
|
54666
54745
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
54667
54746
|
const link3 = await awaitLinkReturn(name, { sawDown, timeoutMs });
|
|
54668
|
-
if (!link3) throw await
|
|
54747
|
+
if (!link3) throw await fail12(`${name} did not come back`);
|
|
54669
54748
|
return link3;
|
|
54670
54749
|
}
|
|
54671
54750
|
};
|
|
@@ -54776,16 +54855,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
54776
54855
|
}
|
|
54777
54856
|
|
|
54778
54857
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
54779
|
-
import
|
|
54858
|
+
import chalk279 from "chalk";
|
|
54780
54859
|
async function unlinkNode(name) {
|
|
54781
54860
|
const links2 = await readLinks();
|
|
54782
54861
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
54783
54862
|
if (remaining.length === links2.length) {
|
|
54784
|
-
console.log(
|
|
54863
|
+
console.log(chalk279.yellow(`No link named ${name}`));
|
|
54785
54864
|
return;
|
|
54786
54865
|
}
|
|
54787
54866
|
await writeLinks(remaining);
|
|
54788
|
-
console.log(
|
|
54867
|
+
console.log(chalk279.green(`Unlinked ${name}`));
|
|
54789
54868
|
await notifyDaemonLinks();
|
|
54790
54869
|
}
|
|
54791
54870
|
|
|
@@ -54859,17 +54938,17 @@ function resolveTarget3(sessionId, server) {
|
|
|
54859
54938
|
async function sessionOutput(sessionId, options2) {
|
|
54860
54939
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
54861
54940
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
54862
|
-
return
|
|
54941
|
+
return fail11(`-n must be a positive integer, got ${options2.lines}`);
|
|
54863
54942
|
const target = resolveTarget3(sessionId, options2.server);
|
|
54864
|
-
if (typeof target === "string") return
|
|
54943
|
+
if (typeof target === "string") return fail11(target);
|
|
54865
54944
|
try {
|
|
54866
54945
|
const scrollback = await requestSessionOutput(target);
|
|
54867
54946
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
54868
54947
|
} catch (error) {
|
|
54869
|
-
|
|
54948
|
+
fail11(error instanceof Error ? error.message : String(error));
|
|
54870
54949
|
}
|
|
54871
54950
|
}
|
|
54872
|
-
function
|
|
54951
|
+
function fail11(message3) {
|
|
54873
54952
|
console.error(message3);
|
|
54874
54953
|
process.exitCode = 1;
|
|
54875
54954
|
}
|
|
@@ -55022,10 +55101,10 @@ function createProgram() {
|
|
|
55022
55101
|
}
|
|
55023
55102
|
|
|
55024
55103
|
// src/reportCliError.ts
|
|
55025
|
-
import
|
|
55104
|
+
import chalk280 from "chalk";
|
|
55026
55105
|
function reportCliError(error) {
|
|
55027
55106
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
55028
|
-
console.error(
|
|
55107
|
+
console.error(chalk280.red(error.message));
|
|
55029
55108
|
} else {
|
|
55030
55109
|
console.error(error);
|
|
55031
55110
|
}
|