@staff0rd/assist 0.217.0 → 0.218.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 +373 -353
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.218.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5291,8 +5291,27 @@ async function start(id) {
|
|
|
5291
5291
|
}
|
|
5292
5292
|
}
|
|
5293
5293
|
|
|
5294
|
-
// src/commands/backlog/
|
|
5294
|
+
// src/commands/backlog/stop/index.ts
|
|
5295
5295
|
import chalk59 from "chalk";
|
|
5296
|
+
async function stop() {
|
|
5297
|
+
const items = loadBacklog();
|
|
5298
|
+
const inProgress = items.filter((item) => item.status === "in-progress");
|
|
5299
|
+
if (inProgress.length === 0) {
|
|
5300
|
+
console.log(chalk59.yellow("No in-progress items to stop."));
|
|
5301
|
+
return;
|
|
5302
|
+
}
|
|
5303
|
+
for (const item of inProgress) {
|
|
5304
|
+
item.status = "todo";
|
|
5305
|
+
item.currentPhase = 1;
|
|
5306
|
+
}
|
|
5307
|
+
saveBacklog(items);
|
|
5308
|
+
for (const item of inProgress) {
|
|
5309
|
+
console.log(chalk59.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
5310
|
+
}
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
// src/commands/backlog/wontdo/index.ts
|
|
5314
|
+
import chalk60 from "chalk";
|
|
5296
5315
|
async function wontdo(id, reason) {
|
|
5297
5316
|
const result = loadAndFindItem(id);
|
|
5298
5317
|
if (!result) return;
|
|
@@ -5302,22 +5321,23 @@ async function wontdo(id, reason) {
|
|
|
5302
5321
|
addPhaseSummary(result.item, reason, phase);
|
|
5303
5322
|
}
|
|
5304
5323
|
saveBacklog(result.items);
|
|
5305
|
-
console.log(
|
|
5324
|
+
console.log(chalk60.red(`Won't do item #${id}: ${result.item.name}`));
|
|
5306
5325
|
}
|
|
5307
5326
|
|
|
5308
5327
|
// src/commands/backlog/registerStatusCommands.ts
|
|
5309
5328
|
function registerStatusCommands(cmd) {
|
|
5310
5329
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
5330
|
+
cmd.command("stop").description("Revert all in-progress backlog items to todo").action(stop);
|
|
5311
5331
|
cmd.command("done <id> [summary]").description("Set a backlog item to done").action(done);
|
|
5312
5332
|
cmd.command("wontdo <id> [reason]").description("Set a backlog item to won't do").action(wontdo);
|
|
5313
5333
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
5314
5334
|
}
|
|
5315
5335
|
|
|
5316
5336
|
// src/commands/backlog/removePhase.ts
|
|
5317
|
-
import
|
|
5337
|
+
import chalk62 from "chalk";
|
|
5318
5338
|
|
|
5319
5339
|
// src/commands/backlog/findPhase.ts
|
|
5320
|
-
import
|
|
5340
|
+
import chalk61 from "chalk";
|
|
5321
5341
|
function findPhase(id, phase) {
|
|
5322
5342
|
const result = loadAndFindItem(id);
|
|
5323
5343
|
if (!result) return void 0;
|
|
@@ -5331,7 +5351,7 @@ function findPhase(id, phase) {
|
|
|
5331
5351
|
).get(itemId, phaseIdx);
|
|
5332
5352
|
if (existing.cnt === 0) {
|
|
5333
5353
|
console.log(
|
|
5334
|
-
|
|
5354
|
+
chalk61.red(`Phase ${phaseNumber} not found on item #${itemId}.`)
|
|
5335
5355
|
);
|
|
5336
5356
|
process.exitCode = 1;
|
|
5337
5357
|
return void 0;
|
|
@@ -5391,24 +5411,24 @@ function removePhase(id, phase) {
|
|
|
5391
5411
|
exportToJsonl(db, dir);
|
|
5392
5412
|
commitBacklog(itemId, result.item.name);
|
|
5393
5413
|
console.log(
|
|
5394
|
-
|
|
5414
|
+
chalk62.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
5395
5415
|
);
|
|
5396
5416
|
}
|
|
5397
5417
|
|
|
5398
5418
|
// src/commands/backlog/update/index.ts
|
|
5399
|
-
import
|
|
5419
|
+
import chalk64 from "chalk";
|
|
5400
5420
|
|
|
5401
5421
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
5402
|
-
import
|
|
5422
|
+
import chalk63 from "chalk";
|
|
5403
5423
|
function buildUpdateSql(options2) {
|
|
5404
5424
|
const { name, desc, type, ac } = options2;
|
|
5405
5425
|
if (!name && !desc && !type && !ac) {
|
|
5406
|
-
console.log(
|
|
5426
|
+
console.log(chalk63.red("Nothing to update. Provide at least one flag."));
|
|
5407
5427
|
process.exitCode = 1;
|
|
5408
5428
|
return void 0;
|
|
5409
5429
|
}
|
|
5410
5430
|
if (type && type !== "story" && type !== "bug") {
|
|
5411
|
-
console.log(
|
|
5431
|
+
console.log(chalk63.red('Invalid type. Must be "story" or "bug".'));
|
|
5412
5432
|
process.exitCode = 1;
|
|
5413
5433
|
return void 0;
|
|
5414
5434
|
}
|
|
@@ -5453,11 +5473,11 @@ function update(id, options2) {
|
|
|
5453
5473
|
);
|
|
5454
5474
|
exportToJsonl(db, dir);
|
|
5455
5475
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
5456
|
-
console.log(
|
|
5476
|
+
console.log(chalk64.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
5457
5477
|
}
|
|
5458
5478
|
|
|
5459
5479
|
// src/commands/backlog/updatePhase.ts
|
|
5460
|
-
import
|
|
5480
|
+
import chalk65 from "chalk";
|
|
5461
5481
|
|
|
5462
5482
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
5463
5483
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -5491,7 +5511,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
5491
5511
|
function updatePhase(id, phase, options2) {
|
|
5492
5512
|
const { name, task, manualCheck } = options2;
|
|
5493
5513
|
if (!name && !task && !manualCheck) {
|
|
5494
|
-
console.log(
|
|
5514
|
+
console.log(chalk65.red("Nothing to update. Provide at least one flag."));
|
|
5495
5515
|
process.exitCode = 1;
|
|
5496
5516
|
return;
|
|
5497
5517
|
}
|
|
@@ -5507,7 +5527,7 @@ function updatePhase(id, phase, options2) {
|
|
|
5507
5527
|
manualCheck && "manual checks"
|
|
5508
5528
|
].filter(Boolean).join(", ");
|
|
5509
5529
|
console.log(
|
|
5510
|
-
|
|
5530
|
+
chalk65.green(
|
|
5511
5531
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
5512
5532
|
)
|
|
5513
5533
|
);
|
|
@@ -6136,11 +6156,11 @@ function assertCliExists(cli) {
|
|
|
6136
6156
|
}
|
|
6137
6157
|
|
|
6138
6158
|
// src/commands/permitCliReads/colorize.ts
|
|
6139
|
-
import
|
|
6159
|
+
import chalk66 from "chalk";
|
|
6140
6160
|
function colorize(plainOutput) {
|
|
6141
6161
|
return plainOutput.split("\n").map((line) => {
|
|
6142
|
-
if (line.startsWith(" R ")) return
|
|
6143
|
-
if (line.startsWith(" W ")) return
|
|
6162
|
+
if (line.startsWith(" R ")) return chalk66.green(line);
|
|
6163
|
+
if (line.startsWith(" W ")) return chalk66.red(line);
|
|
6144
6164
|
return line;
|
|
6145
6165
|
}).join("\n");
|
|
6146
6166
|
}
|
|
@@ -6438,7 +6458,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
6438
6458
|
}
|
|
6439
6459
|
|
|
6440
6460
|
// src/commands/deny/denyAdd.ts
|
|
6441
|
-
import
|
|
6461
|
+
import chalk67 from "chalk";
|
|
6442
6462
|
|
|
6443
6463
|
// src/commands/deny/loadDenyConfig.ts
|
|
6444
6464
|
function loadDenyConfig(global) {
|
|
@@ -6458,16 +6478,16 @@ function loadDenyConfig(global) {
|
|
|
6458
6478
|
function denyAdd(pattern2, message, options2) {
|
|
6459
6479
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6460
6480
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
6461
|
-
console.log(
|
|
6481
|
+
console.log(chalk67.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
6462
6482
|
return;
|
|
6463
6483
|
}
|
|
6464
6484
|
deny.push({ pattern: pattern2, message });
|
|
6465
6485
|
saveDeny(deny);
|
|
6466
|
-
console.log(
|
|
6486
|
+
console.log(chalk67.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
6467
6487
|
}
|
|
6468
6488
|
|
|
6469
6489
|
// src/commands/deny/denyList.ts
|
|
6470
|
-
import
|
|
6490
|
+
import chalk68 from "chalk";
|
|
6471
6491
|
function denyList() {
|
|
6472
6492
|
const globalRaw = loadGlobalConfigRaw();
|
|
6473
6493
|
const projectRaw = loadProjectConfig();
|
|
@@ -6478,7 +6498,7 @@ function denyList() {
|
|
|
6478
6498
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
6479
6499
|
);
|
|
6480
6500
|
if (!merged || merged.length === 0) {
|
|
6481
|
-
console.log(
|
|
6501
|
+
console.log(chalk68.dim("No deny rules configured."));
|
|
6482
6502
|
return;
|
|
6483
6503
|
}
|
|
6484
6504
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -6486,23 +6506,23 @@ function denyList() {
|
|
|
6486
6506
|
for (const rule of merged) {
|
|
6487
6507
|
const inProject = projectPatterns.has(rule.pattern);
|
|
6488
6508
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
6489
|
-
const label2 = inProject && inGlobal ?
|
|
6490
|
-
console.log(`${
|
|
6509
|
+
const label2 = inProject && inGlobal ? chalk68.dim(" (project, overrides global)") : inGlobal ? chalk68.dim(" (global)") : "";
|
|
6510
|
+
console.log(`${chalk68.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
6491
6511
|
}
|
|
6492
6512
|
}
|
|
6493
6513
|
|
|
6494
6514
|
// src/commands/deny/denyRemove.ts
|
|
6495
|
-
import
|
|
6515
|
+
import chalk69 from "chalk";
|
|
6496
6516
|
function denyRemove(pattern2, options2) {
|
|
6497
6517
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6498
6518
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
6499
6519
|
if (index === -1) {
|
|
6500
|
-
console.log(
|
|
6520
|
+
console.log(chalk69.yellow(`No deny rule found for: ${pattern2}`));
|
|
6501
6521
|
return;
|
|
6502
6522
|
}
|
|
6503
6523
|
deny.splice(index, 1);
|
|
6504
6524
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
6505
|
-
console.log(
|
|
6525
|
+
console.log(chalk69.green(`Removed deny rule: ${pattern2}`));
|
|
6506
6526
|
}
|
|
6507
6527
|
|
|
6508
6528
|
// src/commands/registerDeny.ts
|
|
@@ -6531,15 +6551,15 @@ function registerCliHook(program2) {
|
|
|
6531
6551
|
}
|
|
6532
6552
|
|
|
6533
6553
|
// src/commands/complexity/analyze.ts
|
|
6534
|
-
import
|
|
6554
|
+
import chalk75 from "chalk";
|
|
6535
6555
|
|
|
6536
6556
|
// src/commands/complexity/cyclomatic.ts
|
|
6537
|
-
import
|
|
6557
|
+
import chalk71 from "chalk";
|
|
6538
6558
|
|
|
6539
6559
|
// src/commands/complexity/shared/index.ts
|
|
6540
6560
|
import fs14 from "fs";
|
|
6541
6561
|
import path22 from "path";
|
|
6542
|
-
import
|
|
6562
|
+
import chalk70 from "chalk";
|
|
6543
6563
|
import ts5 from "typescript";
|
|
6544
6564
|
|
|
6545
6565
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -6785,7 +6805,7 @@ function createSourceFromFile(filePath) {
|
|
|
6785
6805
|
function withSourceFiles(pattern2, callback) {
|
|
6786
6806
|
const files = findSourceFiles2(pattern2);
|
|
6787
6807
|
if (files.length === 0) {
|
|
6788
|
-
console.log(
|
|
6808
|
+
console.log(chalk70.yellow("No files found matching pattern"));
|
|
6789
6809
|
return void 0;
|
|
6790
6810
|
}
|
|
6791
6811
|
return callback(files);
|
|
@@ -6818,11 +6838,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6818
6838
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
6819
6839
|
for (const { file, name, complexity } of results) {
|
|
6820
6840
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
6821
|
-
const color = exceedsThreshold ?
|
|
6822
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
6841
|
+
const color = exceedsThreshold ? chalk71.red : chalk71.white;
|
|
6842
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk71.cyan(complexity)}`);
|
|
6823
6843
|
}
|
|
6824
6844
|
console.log(
|
|
6825
|
-
|
|
6845
|
+
chalk71.dim(
|
|
6826
6846
|
`
|
|
6827
6847
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6828
6848
|
)
|
|
@@ -6834,7 +6854,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6834
6854
|
}
|
|
6835
6855
|
|
|
6836
6856
|
// src/commands/complexity/halstead.ts
|
|
6837
|
-
import
|
|
6857
|
+
import chalk72 from "chalk";
|
|
6838
6858
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
6839
6859
|
withSourceFiles(pattern2, (files) => {
|
|
6840
6860
|
const results = [];
|
|
@@ -6849,13 +6869,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6849
6869
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
6850
6870
|
for (const { file, name, metrics } of results) {
|
|
6851
6871
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
6852
|
-
const color = exceedsThreshold ?
|
|
6872
|
+
const color = exceedsThreshold ? chalk72.red : chalk72.white;
|
|
6853
6873
|
console.log(
|
|
6854
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
6874
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk72.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk72.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk72.magenta(metrics.effort.toFixed(1))}`
|
|
6855
6875
|
);
|
|
6856
6876
|
}
|
|
6857
6877
|
console.log(
|
|
6858
|
-
|
|
6878
|
+
chalk72.dim(
|
|
6859
6879
|
`
|
|
6860
6880
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6861
6881
|
)
|
|
@@ -6870,28 +6890,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6870
6890
|
import fs15 from "fs";
|
|
6871
6891
|
|
|
6872
6892
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
6873
|
-
import
|
|
6893
|
+
import chalk73 from "chalk";
|
|
6874
6894
|
function displayMaintainabilityResults(results, threshold) {
|
|
6875
6895
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
6876
6896
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
6877
|
-
console.log(
|
|
6897
|
+
console.log(chalk73.green("All files pass maintainability threshold"));
|
|
6878
6898
|
} else {
|
|
6879
6899
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
6880
|
-
const color = threshold !== void 0 ?
|
|
6900
|
+
const color = threshold !== void 0 ? chalk73.red : chalk73.white;
|
|
6881
6901
|
console.log(
|
|
6882
|
-
`${color(file)} \u2192 avg: ${
|
|
6902
|
+
`${color(file)} \u2192 avg: ${chalk73.cyan(avgMaintainability.toFixed(1))}, min: ${chalk73.yellow(minMaintainability.toFixed(1))}`
|
|
6883
6903
|
);
|
|
6884
6904
|
}
|
|
6885
6905
|
}
|
|
6886
|
-
console.log(
|
|
6906
|
+
console.log(chalk73.dim(`
|
|
6887
6907
|
Analyzed ${results.length} files`));
|
|
6888
6908
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
6889
6909
|
console.error(
|
|
6890
|
-
|
|
6910
|
+
chalk73.red(
|
|
6891
6911
|
`
|
|
6892
6912
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
6893
6913
|
|
|
6894
|
-
\u26A0\uFE0F ${
|
|
6914
|
+
\u26A0\uFE0F ${chalk73.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel. Run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
6895
6915
|
)
|
|
6896
6916
|
);
|
|
6897
6917
|
process.exit(1);
|
|
@@ -6948,7 +6968,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6948
6968
|
|
|
6949
6969
|
// src/commands/complexity/sloc.ts
|
|
6950
6970
|
import fs16 from "fs";
|
|
6951
|
-
import
|
|
6971
|
+
import chalk74 from "chalk";
|
|
6952
6972
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
6953
6973
|
withSourceFiles(pattern2, (files) => {
|
|
6954
6974
|
const results = [];
|
|
@@ -6964,12 +6984,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6964
6984
|
results.sort((a, b) => b.lines - a.lines);
|
|
6965
6985
|
for (const { file, lines } of results) {
|
|
6966
6986
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
6967
|
-
const color = exceedsThreshold ?
|
|
6968
|
-
console.log(`${color(file)} \u2192 ${
|
|
6987
|
+
const color = exceedsThreshold ? chalk74.red : chalk74.white;
|
|
6988
|
+
console.log(`${color(file)} \u2192 ${chalk74.cyan(lines)} lines`);
|
|
6969
6989
|
}
|
|
6970
6990
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
6971
6991
|
console.log(
|
|
6972
|
-
|
|
6992
|
+
chalk74.dim(`
|
|
6973
6993
|
Total: ${total} lines across ${files.length} files`)
|
|
6974
6994
|
);
|
|
6975
6995
|
if (hasViolation) {
|
|
@@ -6983,21 +7003,21 @@ async function analyze(pattern2) {
|
|
|
6983
7003
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
6984
7004
|
const files = findSourceFiles2(searchPattern);
|
|
6985
7005
|
if (files.length === 0) {
|
|
6986
|
-
console.log(
|
|
7006
|
+
console.log(chalk75.yellow("No files found matching pattern"));
|
|
6987
7007
|
return;
|
|
6988
7008
|
}
|
|
6989
7009
|
if (files.length === 1) {
|
|
6990
7010
|
const file = files[0];
|
|
6991
|
-
console.log(
|
|
7011
|
+
console.log(chalk75.bold.underline("SLOC"));
|
|
6992
7012
|
await sloc(file);
|
|
6993
7013
|
console.log();
|
|
6994
|
-
console.log(
|
|
7014
|
+
console.log(chalk75.bold.underline("Cyclomatic Complexity"));
|
|
6995
7015
|
await cyclomatic(file);
|
|
6996
7016
|
console.log();
|
|
6997
|
-
console.log(
|
|
7017
|
+
console.log(chalk75.bold.underline("Halstead Metrics"));
|
|
6998
7018
|
await halstead(file);
|
|
6999
7019
|
console.log();
|
|
7000
|
-
console.log(
|
|
7020
|
+
console.log(chalk75.bold.underline("Maintainability Index"));
|
|
7001
7021
|
await maintainability(file);
|
|
7002
7022
|
return;
|
|
7003
7023
|
}
|
|
@@ -7024,7 +7044,7 @@ function registerComplexity(program2) {
|
|
|
7024
7044
|
}
|
|
7025
7045
|
|
|
7026
7046
|
// src/commands/config/index.ts
|
|
7027
|
-
import
|
|
7047
|
+
import chalk76 from "chalk";
|
|
7028
7048
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
7029
7049
|
|
|
7030
7050
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7087,7 +7107,7 @@ function formatIssuePath(issue, key) {
|
|
|
7087
7107
|
function printValidationErrors(issues, key) {
|
|
7088
7108
|
for (const issue of issues) {
|
|
7089
7109
|
console.error(
|
|
7090
|
-
|
|
7110
|
+
chalk76.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7091
7111
|
);
|
|
7092
7112
|
}
|
|
7093
7113
|
}
|
|
@@ -7104,7 +7124,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7104
7124
|
function assertNotGlobalOnly(key, global) {
|
|
7105
7125
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7106
7126
|
console.error(
|
|
7107
|
-
|
|
7127
|
+
chalk76.red(
|
|
7108
7128
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7109
7129
|
)
|
|
7110
7130
|
);
|
|
@@ -7127,7 +7147,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7127
7147
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7128
7148
|
const target = options2.global ? "global" : "project";
|
|
7129
7149
|
console.log(
|
|
7130
|
-
|
|
7150
|
+
chalk76.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7131
7151
|
);
|
|
7132
7152
|
}
|
|
7133
7153
|
function configList() {
|
|
@@ -7136,7 +7156,7 @@ function configList() {
|
|
|
7136
7156
|
}
|
|
7137
7157
|
|
|
7138
7158
|
// src/commands/config/configGet.ts
|
|
7139
|
-
import
|
|
7159
|
+
import chalk77 from "chalk";
|
|
7140
7160
|
|
|
7141
7161
|
// src/commands/config/getNestedValue.ts
|
|
7142
7162
|
function isTraversable(value) {
|
|
@@ -7168,7 +7188,7 @@ function requireNestedValue(config, key) {
|
|
|
7168
7188
|
return value;
|
|
7169
7189
|
}
|
|
7170
7190
|
function exitKeyNotSet(key) {
|
|
7171
|
-
console.error(
|
|
7191
|
+
console.error(chalk77.red(`Key "${key}" is not set`));
|
|
7172
7192
|
process.exit(1);
|
|
7173
7193
|
}
|
|
7174
7194
|
|
|
@@ -7182,7 +7202,7 @@ function registerConfig(program2) {
|
|
|
7182
7202
|
|
|
7183
7203
|
// src/commands/deploy/redirect.ts
|
|
7184
7204
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
7185
|
-
import
|
|
7205
|
+
import chalk78 from "chalk";
|
|
7186
7206
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7187
7207
|
if (!window.location.pathname.endsWith('/')) {
|
|
7188
7208
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7191,22 +7211,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7191
7211
|
function redirect() {
|
|
7192
7212
|
const indexPath = "index.html";
|
|
7193
7213
|
if (!existsSync24(indexPath)) {
|
|
7194
|
-
console.log(
|
|
7214
|
+
console.log(chalk78.yellow("No index.html found"));
|
|
7195
7215
|
return;
|
|
7196
7216
|
}
|
|
7197
7217
|
const content = readFileSync20(indexPath, "utf-8");
|
|
7198
7218
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7199
|
-
console.log(
|
|
7219
|
+
console.log(chalk78.dim("Trailing slash script already present"));
|
|
7200
7220
|
return;
|
|
7201
7221
|
}
|
|
7202
7222
|
const headCloseIndex = content.indexOf("</head>");
|
|
7203
7223
|
if (headCloseIndex === -1) {
|
|
7204
|
-
console.log(
|
|
7224
|
+
console.log(chalk78.red("Could not find </head> tag in index.html"));
|
|
7205
7225
|
return;
|
|
7206
7226
|
}
|
|
7207
7227
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7208
7228
|
writeFileSync18(indexPath, newContent);
|
|
7209
|
-
console.log(
|
|
7229
|
+
console.log(chalk78.green("Added trailing slash redirect to index.html"));
|
|
7210
7230
|
}
|
|
7211
7231
|
|
|
7212
7232
|
// src/commands/registerDeploy.ts
|
|
@@ -7233,7 +7253,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7233
7253
|
|
|
7234
7254
|
// src/commands/devlog/shared.ts
|
|
7235
7255
|
import { execSync as execSync18 } from "child_process";
|
|
7236
|
-
import
|
|
7256
|
+
import chalk79 from "chalk";
|
|
7237
7257
|
|
|
7238
7258
|
// src/shared/getRepoName.ts
|
|
7239
7259
|
import { existsSync as existsSync25, readFileSync as readFileSync21 } from "fs";
|
|
@@ -7342,13 +7362,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
7342
7362
|
}
|
|
7343
7363
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
7344
7364
|
for (const commit2 of commits) {
|
|
7345
|
-
console.log(` ${
|
|
7365
|
+
console.log(` ${chalk79.yellow(commit2.hash)} ${commit2.message}`);
|
|
7346
7366
|
if (verbose) {
|
|
7347
7367
|
const visibleFiles = commit2.files.filter(
|
|
7348
7368
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
7349
7369
|
);
|
|
7350
7370
|
for (const file of visibleFiles) {
|
|
7351
|
-
console.log(` ${
|
|
7371
|
+
console.log(` ${chalk79.dim(file)}`);
|
|
7352
7372
|
}
|
|
7353
7373
|
}
|
|
7354
7374
|
}
|
|
@@ -7373,15 +7393,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
7373
7393
|
}
|
|
7374
7394
|
|
|
7375
7395
|
// src/commands/devlog/list/printDateHeader.ts
|
|
7376
|
-
import
|
|
7396
|
+
import chalk80 from "chalk";
|
|
7377
7397
|
function printDateHeader(date, isSkipped, entries) {
|
|
7378
7398
|
if (isSkipped) {
|
|
7379
|
-
console.log(`${
|
|
7399
|
+
console.log(`${chalk80.bold.blue(date)} ${chalk80.dim("skipped")}`);
|
|
7380
7400
|
} else if (entries && entries.length > 0) {
|
|
7381
|
-
const entryInfo = entries.map((e) => `${
|
|
7382
|
-
console.log(`${
|
|
7401
|
+
const entryInfo = entries.map((e) => `${chalk80.green(e.version)} ${e.title}`).join(" | ");
|
|
7402
|
+
console.log(`${chalk80.bold.blue(date)} ${entryInfo}`);
|
|
7383
7403
|
} else {
|
|
7384
|
-
console.log(`${
|
|
7404
|
+
console.log(`${chalk80.bold.blue(date)} ${chalk80.red("\u26A0 devlog missing")}`);
|
|
7385
7405
|
}
|
|
7386
7406
|
}
|
|
7387
7407
|
|
|
@@ -7485,24 +7505,24 @@ function bumpVersion(version2, type) {
|
|
|
7485
7505
|
|
|
7486
7506
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
7487
7507
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
7488
|
-
import
|
|
7508
|
+
import chalk82 from "chalk";
|
|
7489
7509
|
|
|
7490
7510
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
7491
|
-
import
|
|
7511
|
+
import chalk81 from "chalk";
|
|
7492
7512
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
7493
7513
|
if (conventional && firstHash) {
|
|
7494
7514
|
const version2 = getVersionAtCommit(firstHash);
|
|
7495
7515
|
if (version2) {
|
|
7496
|
-
console.log(`${
|
|
7516
|
+
console.log(`${chalk81.bold("version:")} ${stripToMinor(version2)}`);
|
|
7497
7517
|
} else {
|
|
7498
|
-
console.log(`${
|
|
7518
|
+
console.log(`${chalk81.bold("version:")} ${chalk81.red("unknown")}`);
|
|
7499
7519
|
}
|
|
7500
7520
|
} else if (patchVersion && minorVersion) {
|
|
7501
7521
|
console.log(
|
|
7502
|
-
`${
|
|
7522
|
+
`${chalk81.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
7503
7523
|
);
|
|
7504
7524
|
} else {
|
|
7505
|
-
console.log(`${
|
|
7525
|
+
console.log(`${chalk81.bold("version:")} v0.1 (initial)`);
|
|
7506
7526
|
}
|
|
7507
7527
|
}
|
|
7508
7528
|
|
|
@@ -7550,16 +7570,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
7550
7570
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
7551
7571
|
}
|
|
7552
7572
|
function logName(repoName) {
|
|
7553
|
-
console.log(`${
|
|
7573
|
+
console.log(`${chalk82.bold("name:")} ${repoName}`);
|
|
7554
7574
|
}
|
|
7555
7575
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
7556
7576
|
logName(ctx.repoName);
|
|
7557
7577
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
7558
|
-
console.log(
|
|
7578
|
+
console.log(chalk82.bold.blue(targetDate));
|
|
7559
7579
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
7560
7580
|
}
|
|
7561
7581
|
function logNoCommits(lastInfo) {
|
|
7562
|
-
console.log(
|
|
7582
|
+
console.log(chalk82.dim(noCommitsMessage(!!lastInfo)));
|
|
7563
7583
|
}
|
|
7564
7584
|
|
|
7565
7585
|
// src/commands/devlog/next/index.ts
|
|
@@ -7600,11 +7620,11 @@ function next2(options2) {
|
|
|
7600
7620
|
import { execSync as execSync20 } from "child_process";
|
|
7601
7621
|
|
|
7602
7622
|
// src/commands/devlog/repos/printReposTable.ts
|
|
7603
|
-
import
|
|
7623
|
+
import chalk83 from "chalk";
|
|
7604
7624
|
function colorStatus(status2) {
|
|
7605
|
-
if (status2 === "missing") return
|
|
7606
|
-
if (status2 === "outdated") return
|
|
7607
|
-
return
|
|
7625
|
+
if (status2 === "missing") return chalk83.red(status2);
|
|
7626
|
+
if (status2 === "outdated") return chalk83.yellow(status2);
|
|
7627
|
+
return chalk83.green(status2);
|
|
7608
7628
|
}
|
|
7609
7629
|
function formatRow(row, nameWidth) {
|
|
7610
7630
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -7618,8 +7638,8 @@ function printReposTable(rows) {
|
|
|
7618
7638
|
"Last Devlog".padEnd(11),
|
|
7619
7639
|
"Status"
|
|
7620
7640
|
].join(" ");
|
|
7621
|
-
console.log(
|
|
7622
|
-
console.log(
|
|
7641
|
+
console.log(chalk83.dim(header));
|
|
7642
|
+
console.log(chalk83.dim("-".repeat(header.length)));
|
|
7623
7643
|
for (const row of rows) {
|
|
7624
7644
|
console.log(formatRow(row, nameWidth));
|
|
7625
7645
|
}
|
|
@@ -7677,14 +7697,14 @@ function repos(options2) {
|
|
|
7677
7697
|
// src/commands/devlog/skip.ts
|
|
7678
7698
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
7679
7699
|
import { join as join26 } from "path";
|
|
7680
|
-
import
|
|
7700
|
+
import chalk84 from "chalk";
|
|
7681
7701
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
7682
7702
|
function getBlogConfigPath() {
|
|
7683
7703
|
return join26(BLOG_REPO_ROOT, "assist.yml");
|
|
7684
7704
|
}
|
|
7685
7705
|
function skip(date) {
|
|
7686
7706
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
7687
|
-
console.log(
|
|
7707
|
+
console.log(chalk84.red("Invalid date format. Use YYYY-MM-DD"));
|
|
7688
7708
|
process.exit(1);
|
|
7689
7709
|
}
|
|
7690
7710
|
const repoName = getRepoName();
|
|
@@ -7695,7 +7715,7 @@ function skip(date) {
|
|
|
7695
7715
|
const skipDays = skip2[repoName] ?? [];
|
|
7696
7716
|
if (skipDays.includes(date)) {
|
|
7697
7717
|
console.log(
|
|
7698
|
-
|
|
7718
|
+
chalk84.yellow(`${date} is already in skip list for ${repoName}`)
|
|
7699
7719
|
);
|
|
7700
7720
|
return;
|
|
7701
7721
|
}
|
|
@@ -7705,20 +7725,20 @@ function skip(date) {
|
|
|
7705
7725
|
devlog.skip = skip2;
|
|
7706
7726
|
config.devlog = devlog;
|
|
7707
7727
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
7708
|
-
console.log(
|
|
7728
|
+
console.log(chalk84.green(`Added ${date} to skip list for ${repoName}`));
|
|
7709
7729
|
}
|
|
7710
7730
|
|
|
7711
7731
|
// src/commands/devlog/version.ts
|
|
7712
|
-
import
|
|
7732
|
+
import chalk85 from "chalk";
|
|
7713
7733
|
function version() {
|
|
7714
7734
|
const config = loadConfig();
|
|
7715
7735
|
const name = getRepoName();
|
|
7716
7736
|
const lastInfo = getLastVersionInfo(name, config);
|
|
7717
7737
|
const lastVersion = lastInfo?.version ?? null;
|
|
7718
7738
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
7719
|
-
console.log(`${
|
|
7720
|
-
console.log(`${
|
|
7721
|
-
console.log(`${
|
|
7739
|
+
console.log(`${chalk85.bold("name:")} ${name}`);
|
|
7740
|
+
console.log(`${chalk85.bold("last:")} ${lastVersion ?? chalk85.dim("none")}`);
|
|
7741
|
+
console.log(`${chalk85.bold("next:")} ${nextVersion ?? chalk85.dim("none")}`);
|
|
7722
7742
|
}
|
|
7723
7743
|
|
|
7724
7744
|
// src/commands/registerDevlog.ts
|
|
@@ -7742,7 +7762,7 @@ function registerDevlog(program2) {
|
|
|
7742
7762
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
7743
7763
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
7744
7764
|
import { join as join27 } from "path";
|
|
7745
|
-
import
|
|
7765
|
+
import chalk86 from "chalk";
|
|
7746
7766
|
|
|
7747
7767
|
// src/shared/findRepoRoot.ts
|
|
7748
7768
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -7805,14 +7825,14 @@ function checkBuildLocks(startDir) {
|
|
|
7805
7825
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
7806
7826
|
if (locked) {
|
|
7807
7827
|
console.error(
|
|
7808
|
-
|
|
7828
|
+
chalk86.red("Build output locked (is VS debugging?): ") + locked
|
|
7809
7829
|
);
|
|
7810
7830
|
process.exit(1);
|
|
7811
7831
|
}
|
|
7812
7832
|
}
|
|
7813
7833
|
async function checkBuildLocksCommand() {
|
|
7814
7834
|
checkBuildLocks();
|
|
7815
|
-
console.log(
|
|
7835
|
+
console.log(chalk86.green("No build locks detected"));
|
|
7816
7836
|
}
|
|
7817
7837
|
|
|
7818
7838
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -7911,30 +7931,30 @@ function escapeRegex(s) {
|
|
|
7911
7931
|
}
|
|
7912
7932
|
|
|
7913
7933
|
// src/commands/dotnet/printTree.ts
|
|
7914
|
-
import
|
|
7934
|
+
import chalk87 from "chalk";
|
|
7915
7935
|
function printNodes(nodes, prefix2) {
|
|
7916
7936
|
for (let i = 0; i < nodes.length; i++) {
|
|
7917
7937
|
const isLast = i === nodes.length - 1;
|
|
7918
7938
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7919
7939
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
7920
7940
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
7921
|
-
const label2 = isMissing ?
|
|
7941
|
+
const label2 = isMissing ? chalk87.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
7922
7942
|
console.log(`${prefix2}${connector}${label2}`);
|
|
7923
7943
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
7924
7944
|
}
|
|
7925
7945
|
}
|
|
7926
7946
|
function printTree(tree, totalCount, solutions) {
|
|
7927
|
-
console.log(
|
|
7928
|
-
console.log(
|
|
7947
|
+
console.log(chalk87.bold("\nProject Dependency Tree"));
|
|
7948
|
+
console.log(chalk87.cyan(tree.relativePath));
|
|
7929
7949
|
printNodes(tree.children, "");
|
|
7930
|
-
console.log(
|
|
7950
|
+
console.log(chalk87.dim(`
|
|
7931
7951
|
${totalCount} projects total (including root)`));
|
|
7932
|
-
console.log(
|
|
7952
|
+
console.log(chalk87.bold("\nSolution Membership"));
|
|
7933
7953
|
if (solutions.length === 0) {
|
|
7934
|
-
console.log(
|
|
7954
|
+
console.log(chalk87.yellow(" Not found in any .sln"));
|
|
7935
7955
|
} else {
|
|
7936
7956
|
for (const sln of solutions) {
|
|
7937
|
-
console.log(` ${
|
|
7957
|
+
console.log(` ${chalk87.green(sln)}`);
|
|
7938
7958
|
}
|
|
7939
7959
|
}
|
|
7940
7960
|
console.log();
|
|
@@ -7963,16 +7983,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
7963
7983
|
// src/commands/dotnet/resolveCsproj.ts
|
|
7964
7984
|
import { existsSync as existsSync27 } from "fs";
|
|
7965
7985
|
import path26 from "path";
|
|
7966
|
-
import
|
|
7986
|
+
import chalk88 from "chalk";
|
|
7967
7987
|
function resolveCsproj(csprojPath) {
|
|
7968
7988
|
const resolved = path26.resolve(csprojPath);
|
|
7969
7989
|
if (!existsSync27(resolved)) {
|
|
7970
|
-
console.error(
|
|
7990
|
+
console.error(chalk88.red(`File not found: ${resolved}`));
|
|
7971
7991
|
process.exit(1);
|
|
7972
7992
|
}
|
|
7973
7993
|
const repoRoot = findRepoRoot(path26.dirname(resolved));
|
|
7974
7994
|
if (!repoRoot) {
|
|
7975
|
-
console.error(
|
|
7995
|
+
console.error(chalk88.red("Could not find git repository root"));
|
|
7976
7996
|
process.exit(1);
|
|
7977
7997
|
}
|
|
7978
7998
|
return { resolved, repoRoot };
|
|
@@ -8022,12 +8042,12 @@ function getChangedCsFiles(scope) {
|
|
|
8022
8042
|
}
|
|
8023
8043
|
|
|
8024
8044
|
// src/commands/dotnet/inSln.ts
|
|
8025
|
-
import
|
|
8045
|
+
import chalk89 from "chalk";
|
|
8026
8046
|
async function inSln(csprojPath) {
|
|
8027
8047
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
8028
8048
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
8029
8049
|
if (solutions.length === 0) {
|
|
8030
|
-
console.log(
|
|
8050
|
+
console.log(chalk89.yellow("Not found in any .sln file"));
|
|
8031
8051
|
process.exit(1);
|
|
8032
8052
|
}
|
|
8033
8053
|
for (const sln of solutions) {
|
|
@@ -8036,7 +8056,7 @@ async function inSln(csprojPath) {
|
|
|
8036
8056
|
}
|
|
8037
8057
|
|
|
8038
8058
|
// src/commands/dotnet/inspect.ts
|
|
8039
|
-
import
|
|
8059
|
+
import chalk95 from "chalk";
|
|
8040
8060
|
|
|
8041
8061
|
// src/shared/formatElapsed.ts
|
|
8042
8062
|
function formatElapsed(ms) {
|
|
@@ -8048,12 +8068,12 @@ function formatElapsed(ms) {
|
|
|
8048
8068
|
}
|
|
8049
8069
|
|
|
8050
8070
|
// src/commands/dotnet/displayIssues.ts
|
|
8051
|
-
import
|
|
8071
|
+
import chalk90 from "chalk";
|
|
8052
8072
|
var SEVERITY_COLOR = {
|
|
8053
|
-
ERROR:
|
|
8054
|
-
WARNING:
|
|
8055
|
-
SUGGESTION:
|
|
8056
|
-
HINT:
|
|
8073
|
+
ERROR: chalk90.red,
|
|
8074
|
+
WARNING: chalk90.yellow,
|
|
8075
|
+
SUGGESTION: chalk90.cyan,
|
|
8076
|
+
HINT: chalk90.dim
|
|
8057
8077
|
};
|
|
8058
8078
|
function groupByFile(issues) {
|
|
8059
8079
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8069,15 +8089,15 @@ function groupByFile(issues) {
|
|
|
8069
8089
|
}
|
|
8070
8090
|
function displayIssues(issues) {
|
|
8071
8091
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8072
|
-
console.log(
|
|
8092
|
+
console.log(chalk90.bold(file));
|
|
8073
8093
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8074
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8094
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk90.white;
|
|
8075
8095
|
console.log(
|
|
8076
|
-
` ${
|
|
8096
|
+
` ${chalk90.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8077
8097
|
);
|
|
8078
8098
|
}
|
|
8079
8099
|
}
|
|
8080
|
-
console.log(
|
|
8100
|
+
console.log(chalk90.dim(`
|
|
8081
8101
|
${issues.length} issue(s) found`));
|
|
8082
8102
|
}
|
|
8083
8103
|
|
|
@@ -8136,12 +8156,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8136
8156
|
// src/commands/dotnet/resolveSolution.ts
|
|
8137
8157
|
import { existsSync as existsSync28 } from "fs";
|
|
8138
8158
|
import path27 from "path";
|
|
8139
|
-
import
|
|
8159
|
+
import chalk92 from "chalk";
|
|
8140
8160
|
|
|
8141
8161
|
// src/commands/dotnet/findSolution.ts
|
|
8142
8162
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8143
8163
|
import { dirname as dirname18, join as join28 } from "path";
|
|
8144
|
-
import
|
|
8164
|
+
import chalk91 from "chalk";
|
|
8145
8165
|
function findSlnInDir(dir) {
|
|
8146
8166
|
try {
|
|
8147
8167
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join28(dir, f));
|
|
@@ -8157,17 +8177,17 @@ function findSolution() {
|
|
|
8157
8177
|
const slnFiles = findSlnInDir(current);
|
|
8158
8178
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8159
8179
|
if (slnFiles.length > 1) {
|
|
8160
|
-
console.error(
|
|
8180
|
+
console.error(chalk91.red(`Multiple .sln files found in ${current}:`));
|
|
8161
8181
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8162
8182
|
console.error(
|
|
8163
|
-
|
|
8183
|
+
chalk91.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8164
8184
|
);
|
|
8165
8185
|
process.exit(1);
|
|
8166
8186
|
}
|
|
8167
8187
|
if (current === ceiling) break;
|
|
8168
8188
|
current = dirname18(current);
|
|
8169
8189
|
}
|
|
8170
|
-
console.error(
|
|
8190
|
+
console.error(chalk91.red("No .sln file found between cwd and repo root"));
|
|
8171
8191
|
process.exit(1);
|
|
8172
8192
|
}
|
|
8173
8193
|
|
|
@@ -8176,7 +8196,7 @@ function resolveSolution(sln) {
|
|
|
8176
8196
|
if (sln) {
|
|
8177
8197
|
const resolved = path27.resolve(sln);
|
|
8178
8198
|
if (!existsSync28(resolved)) {
|
|
8179
|
-
console.error(
|
|
8199
|
+
console.error(chalk92.red(`Solution file not found: ${resolved}`));
|
|
8180
8200
|
process.exit(1);
|
|
8181
8201
|
}
|
|
8182
8202
|
return resolved;
|
|
@@ -8218,14 +8238,14 @@ import { execSync as execSync22 } from "child_process";
|
|
|
8218
8238
|
import { existsSync as existsSync29, readFileSync as readFileSync25, unlinkSync as unlinkSync5 } from "fs";
|
|
8219
8239
|
import { tmpdir as tmpdir3 } from "os";
|
|
8220
8240
|
import path28 from "path";
|
|
8221
|
-
import
|
|
8241
|
+
import chalk93 from "chalk";
|
|
8222
8242
|
function assertJbInstalled() {
|
|
8223
8243
|
try {
|
|
8224
8244
|
execSync22("jb inspectcode --version", { stdio: "pipe" });
|
|
8225
8245
|
} catch {
|
|
8226
|
-
console.error(
|
|
8246
|
+
console.error(chalk93.red("jb is not installed. Install with:"));
|
|
8227
8247
|
console.error(
|
|
8228
|
-
|
|
8248
|
+
chalk93.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8229
8249
|
);
|
|
8230
8250
|
process.exit(1);
|
|
8231
8251
|
}
|
|
@@ -8243,11 +8263,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8243
8263
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
8244
8264
|
process.stderr.write(err.stderr);
|
|
8245
8265
|
}
|
|
8246
|
-
console.error(
|
|
8266
|
+
console.error(chalk93.red("jb inspectcode failed"));
|
|
8247
8267
|
process.exit(1);
|
|
8248
8268
|
}
|
|
8249
8269
|
if (!existsSync29(reportPath)) {
|
|
8250
|
-
console.error(
|
|
8270
|
+
console.error(chalk93.red("Report file not generated"));
|
|
8251
8271
|
process.exit(1);
|
|
8252
8272
|
}
|
|
8253
8273
|
const xml = readFileSync25(reportPath, "utf-8");
|
|
@@ -8257,7 +8277,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8257
8277
|
|
|
8258
8278
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
8259
8279
|
import { execSync as execSync23 } from "child_process";
|
|
8260
|
-
import
|
|
8280
|
+
import chalk94 from "chalk";
|
|
8261
8281
|
function resolveMsbuildPath() {
|
|
8262
8282
|
const { run: run4 } = loadConfig();
|
|
8263
8283
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -8269,9 +8289,9 @@ function assertMsbuildInstalled() {
|
|
|
8269
8289
|
try {
|
|
8270
8290
|
execSync23(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
8271
8291
|
} catch {
|
|
8272
|
-
console.error(
|
|
8292
|
+
console.error(chalk94.red(`msbuild not found at: ${msbuild}`));
|
|
8273
8293
|
console.error(
|
|
8274
|
-
|
|
8294
|
+
chalk94.yellow(
|
|
8275
8295
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
8276
8296
|
)
|
|
8277
8297
|
);
|
|
@@ -8318,17 +8338,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
8318
8338
|
// src/commands/dotnet/inspect.ts
|
|
8319
8339
|
function logScope(changedFiles) {
|
|
8320
8340
|
if (changedFiles === null) {
|
|
8321
|
-
console.log(
|
|
8341
|
+
console.log(chalk95.dim("Inspecting full solution..."));
|
|
8322
8342
|
} else {
|
|
8323
8343
|
console.log(
|
|
8324
|
-
|
|
8344
|
+
chalk95.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
8325
8345
|
);
|
|
8326
8346
|
}
|
|
8327
8347
|
}
|
|
8328
8348
|
function reportResults(issues, elapsed) {
|
|
8329
8349
|
if (issues.length > 0) displayIssues(issues);
|
|
8330
|
-
else console.log(
|
|
8331
|
-
console.log(
|
|
8350
|
+
else console.log(chalk95.green("No issues found"));
|
|
8351
|
+
console.log(chalk95.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
8332
8352
|
if (issues.length > 0) process.exit(1);
|
|
8333
8353
|
}
|
|
8334
8354
|
async function inspect(sln, options2) {
|
|
@@ -8339,7 +8359,7 @@ async function inspect(sln, options2) {
|
|
|
8339
8359
|
const scope = parseScope(options2.scope);
|
|
8340
8360
|
const changedFiles = getChangedCsFiles(scope);
|
|
8341
8361
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
8342
|
-
console.log(
|
|
8362
|
+
console.log(chalk95.green("No changed .cs files found"));
|
|
8343
8363
|
return;
|
|
8344
8364
|
}
|
|
8345
8365
|
logScope(changedFiles);
|
|
@@ -8365,7 +8385,7 @@ function registerDotnet(program2) {
|
|
|
8365
8385
|
}
|
|
8366
8386
|
|
|
8367
8387
|
// src/commands/jira/acceptanceCriteria.ts
|
|
8368
|
-
import
|
|
8388
|
+
import chalk97 from "chalk";
|
|
8369
8389
|
|
|
8370
8390
|
// src/commands/jira/adfToText.ts
|
|
8371
8391
|
function renderInline(node) {
|
|
@@ -8426,7 +8446,7 @@ function adfToText(doc) {
|
|
|
8426
8446
|
|
|
8427
8447
|
// src/commands/jira/fetchIssue.ts
|
|
8428
8448
|
import { execSync as execSync24 } from "child_process";
|
|
8429
|
-
import
|
|
8449
|
+
import chalk96 from "chalk";
|
|
8430
8450
|
function fetchIssue(issueKey, fields) {
|
|
8431
8451
|
let result;
|
|
8432
8452
|
try {
|
|
@@ -8439,15 +8459,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
8439
8459
|
const stderr = error.stderr;
|
|
8440
8460
|
if (stderr.includes("unauthorized")) {
|
|
8441
8461
|
console.error(
|
|
8442
|
-
|
|
8462
|
+
chalk96.red("Jira authentication expired."),
|
|
8443
8463
|
"Run",
|
|
8444
|
-
|
|
8464
|
+
chalk96.cyan("assist jira auth"),
|
|
8445
8465
|
"to re-authenticate."
|
|
8446
8466
|
);
|
|
8447
8467
|
process.exit(1);
|
|
8448
8468
|
}
|
|
8449
8469
|
}
|
|
8450
|
-
console.error(
|
|
8470
|
+
console.error(chalk96.red(`Failed to fetch ${issueKey}.`));
|
|
8451
8471
|
process.exit(1);
|
|
8452
8472
|
}
|
|
8453
8473
|
return JSON.parse(result);
|
|
@@ -8461,7 +8481,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
8461
8481
|
const parsed = fetchIssue(issueKey, field);
|
|
8462
8482
|
const acValue = parsed?.fields?.[field];
|
|
8463
8483
|
if (!acValue) {
|
|
8464
|
-
console.log(
|
|
8484
|
+
console.log(chalk97.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
8465
8485
|
return;
|
|
8466
8486
|
}
|
|
8467
8487
|
if (typeof acValue === "string") {
|
|
@@ -8556,14 +8576,14 @@ async function jiraAuth() {
|
|
|
8556
8576
|
}
|
|
8557
8577
|
|
|
8558
8578
|
// src/commands/jira/viewIssue.ts
|
|
8559
|
-
import
|
|
8579
|
+
import chalk98 from "chalk";
|
|
8560
8580
|
function viewIssue(issueKey) {
|
|
8561
8581
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
8562
8582
|
const fields = parsed?.fields;
|
|
8563
8583
|
const summary = fields?.summary;
|
|
8564
8584
|
const description = fields?.description;
|
|
8565
8585
|
if (summary) {
|
|
8566
|
-
console.log(
|
|
8586
|
+
console.log(chalk98.bold(summary));
|
|
8567
8587
|
}
|
|
8568
8588
|
if (description) {
|
|
8569
8589
|
if (summary) console.log();
|
|
@@ -8577,7 +8597,7 @@ function viewIssue(issueKey) {
|
|
|
8577
8597
|
}
|
|
8578
8598
|
if (!summary && !description) {
|
|
8579
8599
|
console.log(
|
|
8580
|
-
|
|
8600
|
+
chalk98.yellow(`No summary or description found on ${issueKey}.`)
|
|
8581
8601
|
);
|
|
8582
8602
|
}
|
|
8583
8603
|
}
|
|
@@ -8593,15 +8613,15 @@ function registerJira(program2) {
|
|
|
8593
8613
|
// src/commands/mermaid/index.ts
|
|
8594
8614
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync5 } from "fs";
|
|
8595
8615
|
import { resolve as resolve10 } from "path";
|
|
8596
|
-
import
|
|
8616
|
+
import chalk101 from "chalk";
|
|
8597
8617
|
|
|
8598
8618
|
// src/commands/mermaid/exportFile.ts
|
|
8599
8619
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync21 } from "fs";
|
|
8600
8620
|
import { basename as basename7, extname, resolve as resolve9 } from "path";
|
|
8601
|
-
import
|
|
8621
|
+
import chalk100 from "chalk";
|
|
8602
8622
|
|
|
8603
8623
|
// src/commands/mermaid/renderBlock.ts
|
|
8604
|
-
import
|
|
8624
|
+
import chalk99 from "chalk";
|
|
8605
8625
|
async function renderBlock(krokiUrl, source) {
|
|
8606
8626
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
8607
8627
|
method: "POST",
|
|
@@ -8610,7 +8630,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
8610
8630
|
});
|
|
8611
8631
|
if (!response.ok) {
|
|
8612
8632
|
console.error(
|
|
8613
|
-
|
|
8633
|
+
chalk99.red(
|
|
8614
8634
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
8615
8635
|
)
|
|
8616
8636
|
);
|
|
@@ -8628,19 +8648,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8628
8648
|
if (onlyIndex !== void 0) {
|
|
8629
8649
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
8630
8650
|
console.error(
|
|
8631
|
-
|
|
8651
|
+
chalk100.red(
|
|
8632
8652
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
8633
8653
|
)
|
|
8634
8654
|
);
|
|
8635
8655
|
process.exit(1);
|
|
8636
8656
|
}
|
|
8637
8657
|
console.log(
|
|
8638
|
-
|
|
8658
|
+
chalk100.gray(
|
|
8639
8659
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
8640
8660
|
)
|
|
8641
8661
|
);
|
|
8642
8662
|
} else {
|
|
8643
|
-
console.log(
|
|
8663
|
+
console.log(chalk100.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
8644
8664
|
}
|
|
8645
8665
|
for (const [i, source] of blocks.entries()) {
|
|
8646
8666
|
const idx = i + 1;
|
|
@@ -8648,7 +8668,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8648
8668
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
8649
8669
|
const svg = await renderBlock(krokiUrl, source);
|
|
8650
8670
|
writeFileSync21(outPath, svg, "utf8");
|
|
8651
|
-
console.log(
|
|
8671
|
+
console.log(chalk100.green(` \u2192 ${outPath}`));
|
|
8652
8672
|
}
|
|
8653
8673
|
}
|
|
8654
8674
|
function extractMermaidBlocks(markdown) {
|
|
@@ -8664,18 +8684,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
8664
8684
|
if (options2.index !== void 0) {
|
|
8665
8685
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
8666
8686
|
console.error(
|
|
8667
|
-
|
|
8687
|
+
chalk101.red(`--index must be a positive integer (got ${options2.index})`)
|
|
8668
8688
|
);
|
|
8669
8689
|
process.exit(1);
|
|
8670
8690
|
}
|
|
8671
8691
|
if (!file) {
|
|
8672
|
-
console.error(
|
|
8692
|
+
console.error(chalk101.red("--index requires a file argument"));
|
|
8673
8693
|
process.exit(1);
|
|
8674
8694
|
}
|
|
8675
8695
|
}
|
|
8676
8696
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
8677
8697
|
if (files.length === 0) {
|
|
8678
|
-
console.log(
|
|
8698
|
+
console.log(chalk101.gray("No markdown files found in current directory."));
|
|
8679
8699
|
return;
|
|
8680
8700
|
}
|
|
8681
8701
|
for (const f of files) {
|
|
@@ -8698,7 +8718,7 @@ function registerMermaid(program2) {
|
|
|
8698
8718
|
}
|
|
8699
8719
|
|
|
8700
8720
|
// src/commands/news/add/index.ts
|
|
8701
|
-
import
|
|
8721
|
+
import chalk102 from "chalk";
|
|
8702
8722
|
import enquirer8 from "enquirer";
|
|
8703
8723
|
async function add2(url) {
|
|
8704
8724
|
if (!url) {
|
|
@@ -8721,17 +8741,17 @@ async function add2(url) {
|
|
|
8721
8741
|
const news = config.news ?? {};
|
|
8722
8742
|
const feeds = news.feeds ?? [];
|
|
8723
8743
|
if (feeds.includes(url)) {
|
|
8724
|
-
console.log(
|
|
8744
|
+
console.log(chalk102.yellow("Feed already exists in config"));
|
|
8725
8745
|
return;
|
|
8726
8746
|
}
|
|
8727
8747
|
feeds.push(url);
|
|
8728
8748
|
config.news = { ...news, feeds };
|
|
8729
8749
|
saveGlobalConfig(config);
|
|
8730
|
-
console.log(
|
|
8750
|
+
console.log(chalk102.green(`Added feed: ${url}`));
|
|
8731
8751
|
}
|
|
8732
8752
|
|
|
8733
8753
|
// src/commands/news/web/handleRequest.ts
|
|
8734
|
-
import
|
|
8754
|
+
import chalk103 from "chalk";
|
|
8735
8755
|
|
|
8736
8756
|
// src/commands/news/web/shared.ts
|
|
8737
8757
|
import { decodeHTML } from "entities";
|
|
@@ -8867,17 +8887,17 @@ function prefetch() {
|
|
|
8867
8887
|
const config = loadConfig();
|
|
8868
8888
|
const total = config.news.feeds.length;
|
|
8869
8889
|
if (total === 0) return;
|
|
8870
|
-
process.stdout.write(
|
|
8890
|
+
process.stdout.write(chalk103.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
8871
8891
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
8872
8892
|
const width = 20;
|
|
8873
8893
|
const filled = Math.round(done2 / t * width);
|
|
8874
8894
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
8875
8895
|
process.stdout.write(
|
|
8876
|
-
`\r${
|
|
8896
|
+
`\r${chalk103.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
8877
8897
|
);
|
|
8878
8898
|
}).then((items) => {
|
|
8879
8899
|
process.stdout.write(
|
|
8880
|
-
`\r${
|
|
8900
|
+
`\r${chalk103.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
8881
8901
|
`
|
|
8882
8902
|
);
|
|
8883
8903
|
cachedItems = items;
|
|
@@ -8922,7 +8942,7 @@ function registerNews(program2) {
|
|
|
8922
8942
|
}
|
|
8923
8943
|
|
|
8924
8944
|
// src/commands/prompts/printPromptsTable.ts
|
|
8925
|
-
import
|
|
8945
|
+
import chalk104 from "chalk";
|
|
8926
8946
|
function truncate(str, max) {
|
|
8927
8947
|
if (str.length <= max) return str;
|
|
8928
8948
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -8940,14 +8960,14 @@ function printPromptsTable(rows) {
|
|
|
8940
8960
|
"Command".padEnd(commandWidth),
|
|
8941
8961
|
"Repos"
|
|
8942
8962
|
].join(" ");
|
|
8943
|
-
console.log(
|
|
8944
|
-
console.log(
|
|
8963
|
+
console.log(chalk104.dim(header));
|
|
8964
|
+
console.log(chalk104.dim("-".repeat(header.length)));
|
|
8945
8965
|
for (const row of rows) {
|
|
8946
8966
|
const count = String(row.count).padStart(countWidth);
|
|
8947
8967
|
const tool = row.tool.padEnd(toolWidth);
|
|
8948
8968
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
8949
8969
|
console.log(
|
|
8950
|
-
`${
|
|
8970
|
+
`${chalk104.yellow(count)} ${tool} ${command} ${chalk104.dim(row.repos)}`
|
|
8951
8971
|
);
|
|
8952
8972
|
}
|
|
8953
8973
|
}
|
|
@@ -9379,20 +9399,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
9379
9399
|
}
|
|
9380
9400
|
|
|
9381
9401
|
// src/commands/prs/listComments/printComments.ts
|
|
9382
|
-
import
|
|
9402
|
+
import chalk105 from "chalk";
|
|
9383
9403
|
function formatForHuman(comment3) {
|
|
9384
9404
|
if (comment3.type === "review") {
|
|
9385
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
9405
|
+
const stateColor = comment3.state === "APPROVED" ? chalk105.green : comment3.state === "CHANGES_REQUESTED" ? chalk105.red : chalk105.yellow;
|
|
9386
9406
|
return [
|
|
9387
|
-
`${
|
|
9407
|
+
`${chalk105.cyan("Review")} by ${chalk105.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
9388
9408
|
comment3.body,
|
|
9389
9409
|
""
|
|
9390
9410
|
].join("\n");
|
|
9391
9411
|
}
|
|
9392
9412
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
9393
9413
|
return [
|
|
9394
|
-
`${
|
|
9395
|
-
|
|
9414
|
+
`${chalk105.cyan("Line comment")} by ${chalk105.bold(comment3.user)} on ${chalk105.dim(`${comment3.path}${location}`)}`,
|
|
9415
|
+
chalk105.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
9396
9416
|
comment3.body,
|
|
9397
9417
|
""
|
|
9398
9418
|
].join("\n");
|
|
@@ -9482,13 +9502,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
9482
9502
|
import enquirer9 from "enquirer";
|
|
9483
9503
|
|
|
9484
9504
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
9485
|
-
import
|
|
9505
|
+
import chalk106 from "chalk";
|
|
9486
9506
|
var STATUS_MAP = {
|
|
9487
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
9488
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
9507
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk106.magenta("merged"), date: pr.mergedAt } : null,
|
|
9508
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk106.red("closed"), date: pr.closedAt } : null
|
|
9489
9509
|
};
|
|
9490
9510
|
function defaultStatus(pr) {
|
|
9491
|
-
return { label:
|
|
9511
|
+
return { label: chalk106.green("opened"), date: pr.createdAt };
|
|
9492
9512
|
}
|
|
9493
9513
|
function getStatus2(pr) {
|
|
9494
9514
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -9497,11 +9517,11 @@ function formatDate(dateStr) {
|
|
|
9497
9517
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
9498
9518
|
}
|
|
9499
9519
|
function formatPrHeader(pr, status2) {
|
|
9500
|
-
return `${
|
|
9520
|
+
return `${chalk106.cyan(`#${pr.number}`)} ${pr.title} ${chalk106.dim(`(${pr.author.login},`)} ${status2.label} ${chalk106.dim(`${formatDate(status2.date)})`)}`;
|
|
9501
9521
|
}
|
|
9502
9522
|
function logPrDetails(pr) {
|
|
9503
9523
|
console.log(
|
|
9504
|
-
|
|
9524
|
+
chalk106.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
9505
9525
|
);
|
|
9506
9526
|
console.log();
|
|
9507
9527
|
}
|
|
@@ -9668,10 +9688,10 @@ function registerPrs(program2) {
|
|
|
9668
9688
|
}
|
|
9669
9689
|
|
|
9670
9690
|
// src/commands/ravendb/ravendbAuth.ts
|
|
9671
|
-
import
|
|
9691
|
+
import chalk112 from "chalk";
|
|
9672
9692
|
|
|
9673
9693
|
// src/shared/createConnectionAuth.ts
|
|
9674
|
-
import
|
|
9694
|
+
import chalk107 from "chalk";
|
|
9675
9695
|
function listConnections(connections, format2) {
|
|
9676
9696
|
if (connections.length === 0) {
|
|
9677
9697
|
console.log("No connections configured.");
|
|
@@ -9684,7 +9704,7 @@ function listConnections(connections, format2) {
|
|
|
9684
9704
|
function removeConnection(connections, name, save) {
|
|
9685
9705
|
const filtered = connections.filter((c) => c.name !== name);
|
|
9686
9706
|
if (filtered.length === connections.length) {
|
|
9687
|
-
console.error(
|
|
9707
|
+
console.error(chalk107.red(`Connection "${name}" not found.`));
|
|
9688
9708
|
process.exit(1);
|
|
9689
9709
|
}
|
|
9690
9710
|
save(filtered);
|
|
@@ -9730,15 +9750,15 @@ function saveConnections(connections) {
|
|
|
9730
9750
|
}
|
|
9731
9751
|
|
|
9732
9752
|
// src/commands/ravendb/promptConnection.ts
|
|
9733
|
-
import
|
|
9753
|
+
import chalk110 from "chalk";
|
|
9734
9754
|
|
|
9735
9755
|
// src/commands/ravendb/selectOpSecret.ts
|
|
9736
|
-
import
|
|
9756
|
+
import chalk109 from "chalk";
|
|
9737
9757
|
import Enquirer2 from "enquirer";
|
|
9738
9758
|
|
|
9739
9759
|
// src/commands/ravendb/searchItems.ts
|
|
9740
9760
|
import { execSync as execSync34 } from "child_process";
|
|
9741
|
-
import
|
|
9761
|
+
import chalk108 from "chalk";
|
|
9742
9762
|
function opExec(args) {
|
|
9743
9763
|
return execSync34(`op ${args}`, {
|
|
9744
9764
|
encoding: "utf-8",
|
|
@@ -9751,7 +9771,7 @@ function searchItems(search2) {
|
|
|
9751
9771
|
items = JSON.parse(opExec("item list --format=json"));
|
|
9752
9772
|
} catch {
|
|
9753
9773
|
console.error(
|
|
9754
|
-
|
|
9774
|
+
chalk108.red(
|
|
9755
9775
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
9756
9776
|
)
|
|
9757
9777
|
);
|
|
@@ -9765,7 +9785,7 @@ function getItemFields(itemId) {
|
|
|
9765
9785
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
9766
9786
|
return item.fields.filter((f) => f.reference && f.label);
|
|
9767
9787
|
} catch {
|
|
9768
|
-
console.error(
|
|
9788
|
+
console.error(chalk108.red("Failed to get item details from 1Password."));
|
|
9769
9789
|
process.exit(1);
|
|
9770
9790
|
}
|
|
9771
9791
|
}
|
|
@@ -9784,7 +9804,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9784
9804
|
}).run();
|
|
9785
9805
|
const items = searchItems(search2);
|
|
9786
9806
|
if (items.length === 0) {
|
|
9787
|
-
console.error(
|
|
9807
|
+
console.error(chalk109.red(`No items found matching "${search2}".`));
|
|
9788
9808
|
process.exit(1);
|
|
9789
9809
|
}
|
|
9790
9810
|
const itemId = await selectOne(
|
|
@@ -9793,7 +9813,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9793
9813
|
);
|
|
9794
9814
|
const fields = getItemFields(itemId);
|
|
9795
9815
|
if (fields.length === 0) {
|
|
9796
|
-
console.error(
|
|
9816
|
+
console.error(chalk109.red("No fields with references found on this item."));
|
|
9797
9817
|
process.exit(1);
|
|
9798
9818
|
}
|
|
9799
9819
|
const ref = await selectOne(
|
|
@@ -9807,7 +9827,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9807
9827
|
async function promptConnection(existingNames) {
|
|
9808
9828
|
const name = await promptInput("name", "Connection name:");
|
|
9809
9829
|
if (existingNames.includes(name)) {
|
|
9810
|
-
console.error(
|
|
9830
|
+
console.error(chalk110.red(`Connection "${name}" already exists.`));
|
|
9811
9831
|
process.exit(1);
|
|
9812
9832
|
}
|
|
9813
9833
|
const url = await promptInput(
|
|
@@ -9816,22 +9836,22 @@ async function promptConnection(existingNames) {
|
|
|
9816
9836
|
);
|
|
9817
9837
|
const database = await promptInput("database", "Database name:");
|
|
9818
9838
|
if (!name || !url || !database) {
|
|
9819
|
-
console.error(
|
|
9839
|
+
console.error(chalk110.red("All fields are required."));
|
|
9820
9840
|
process.exit(1);
|
|
9821
9841
|
}
|
|
9822
9842
|
const apiKeyRef = await selectOpSecret();
|
|
9823
|
-
console.log(
|
|
9843
|
+
console.log(chalk110.dim(`Using: ${apiKeyRef}`));
|
|
9824
9844
|
return { name, url, database, apiKeyRef };
|
|
9825
9845
|
}
|
|
9826
9846
|
|
|
9827
9847
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
9828
|
-
import
|
|
9848
|
+
import chalk111 from "chalk";
|
|
9829
9849
|
function ravendbSetConnection(name) {
|
|
9830
9850
|
const raw = loadGlobalConfigRaw();
|
|
9831
9851
|
const ravendb = raw.ravendb ?? {};
|
|
9832
9852
|
const connections = ravendb.connections ?? [];
|
|
9833
9853
|
if (!connections.some((c) => c.name === name)) {
|
|
9834
|
-
console.error(
|
|
9854
|
+
console.error(chalk111.red(`Connection "${name}" not found.`));
|
|
9835
9855
|
console.error(
|
|
9836
9856
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9837
9857
|
);
|
|
@@ -9847,16 +9867,16 @@ function ravendbSetConnection(name) {
|
|
|
9847
9867
|
var ravendbAuth = createConnectionAuth({
|
|
9848
9868
|
load: loadConnections,
|
|
9849
9869
|
save: saveConnections,
|
|
9850
|
-
format: (c) => `${
|
|
9870
|
+
format: (c) => `${chalk112.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
9851
9871
|
promptNew: promptConnection,
|
|
9852
9872
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
9853
9873
|
});
|
|
9854
9874
|
|
|
9855
9875
|
// src/commands/ravendb/ravendbCollections.ts
|
|
9856
|
-
import
|
|
9876
|
+
import chalk116 from "chalk";
|
|
9857
9877
|
|
|
9858
9878
|
// src/commands/ravendb/ravenFetch.ts
|
|
9859
|
-
import
|
|
9879
|
+
import chalk114 from "chalk";
|
|
9860
9880
|
|
|
9861
9881
|
// src/commands/ravendb/getAccessToken.ts
|
|
9862
9882
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -9893,10 +9913,10 @@ ${errorText}`
|
|
|
9893
9913
|
|
|
9894
9914
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
9895
9915
|
import { execSync as execSync35 } from "child_process";
|
|
9896
|
-
import
|
|
9916
|
+
import chalk113 from "chalk";
|
|
9897
9917
|
function resolveOpSecret(reference) {
|
|
9898
9918
|
if (!reference.startsWith("op://")) {
|
|
9899
|
-
console.error(
|
|
9919
|
+
console.error(chalk113.red(`Invalid secret reference: must start with op://`));
|
|
9900
9920
|
process.exit(1);
|
|
9901
9921
|
}
|
|
9902
9922
|
try {
|
|
@@ -9906,7 +9926,7 @@ function resolveOpSecret(reference) {
|
|
|
9906
9926
|
}).trim();
|
|
9907
9927
|
} catch {
|
|
9908
9928
|
console.error(
|
|
9909
|
-
|
|
9929
|
+
chalk113.red(
|
|
9910
9930
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
9911
9931
|
)
|
|
9912
9932
|
);
|
|
@@ -9933,7 +9953,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9933
9953
|
if (!response.ok) {
|
|
9934
9954
|
const body = await response.text();
|
|
9935
9955
|
console.error(
|
|
9936
|
-
|
|
9956
|
+
chalk114.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
9937
9957
|
);
|
|
9938
9958
|
console.error(body.substring(0, 500));
|
|
9939
9959
|
process.exit(1);
|
|
@@ -9942,7 +9962,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9942
9962
|
}
|
|
9943
9963
|
|
|
9944
9964
|
// src/commands/ravendb/resolveConnection.ts
|
|
9945
|
-
import
|
|
9965
|
+
import chalk115 from "chalk";
|
|
9946
9966
|
function loadRavendb() {
|
|
9947
9967
|
const raw = loadGlobalConfigRaw();
|
|
9948
9968
|
const ravendb = raw.ravendb;
|
|
@@ -9956,7 +9976,7 @@ function resolveConnection(name) {
|
|
|
9956
9976
|
const connectionName = name ?? defaultConnection;
|
|
9957
9977
|
if (!connectionName) {
|
|
9958
9978
|
console.error(
|
|
9959
|
-
|
|
9979
|
+
chalk115.red(
|
|
9960
9980
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
9961
9981
|
)
|
|
9962
9982
|
);
|
|
@@ -9964,7 +9984,7 @@ function resolveConnection(name) {
|
|
|
9964
9984
|
}
|
|
9965
9985
|
const connection = connections.find((c) => c.name === connectionName);
|
|
9966
9986
|
if (!connection) {
|
|
9967
|
-
console.error(
|
|
9987
|
+
console.error(chalk115.red(`Connection "${connectionName}" not found.`));
|
|
9968
9988
|
console.error(
|
|
9969
9989
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9970
9990
|
);
|
|
@@ -9995,15 +10015,15 @@ async function ravendbCollections(connectionName) {
|
|
|
9995
10015
|
return;
|
|
9996
10016
|
}
|
|
9997
10017
|
for (const c of collections) {
|
|
9998
|
-
console.log(`${
|
|
10018
|
+
console.log(`${chalk116.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
9999
10019
|
}
|
|
10000
10020
|
}
|
|
10001
10021
|
|
|
10002
10022
|
// src/commands/ravendb/ravendbQuery.ts
|
|
10003
|
-
import
|
|
10023
|
+
import chalk118 from "chalk";
|
|
10004
10024
|
|
|
10005
10025
|
// src/commands/ravendb/fetchAllPages.ts
|
|
10006
|
-
import
|
|
10026
|
+
import chalk117 from "chalk";
|
|
10007
10027
|
|
|
10008
10028
|
// src/commands/ravendb/buildQueryPath.ts
|
|
10009
10029
|
function buildQueryPath(opts) {
|
|
@@ -10041,7 +10061,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10041
10061
|
allResults.push(...results);
|
|
10042
10062
|
start3 += results.length;
|
|
10043
10063
|
process.stderr.write(
|
|
10044
|
-
`\r${
|
|
10064
|
+
`\r${chalk117.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
10045
10065
|
);
|
|
10046
10066
|
if (start3 >= totalResults) break;
|
|
10047
10067
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -10056,7 +10076,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10056
10076
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
10057
10077
|
const resolved = resolveArgs(connectionName, collection);
|
|
10058
10078
|
if (!resolved.collection && !options2.query) {
|
|
10059
|
-
console.error(
|
|
10079
|
+
console.error(chalk118.red("Provide a collection name or --query filter."));
|
|
10060
10080
|
process.exit(1);
|
|
10061
10081
|
}
|
|
10062
10082
|
const { collection: col } = resolved;
|
|
@@ -10094,7 +10114,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
10094
10114
|
import * as path29 from "path";
|
|
10095
10115
|
|
|
10096
10116
|
// src/commands/refactor/logViolations.ts
|
|
10097
|
-
import
|
|
10117
|
+
import chalk119 from "chalk";
|
|
10098
10118
|
var DEFAULT_MAX_LINES = 100;
|
|
10099
10119
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
10100
10120
|
if (violations.length === 0) {
|
|
@@ -10103,43 +10123,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
10103
10123
|
}
|
|
10104
10124
|
return;
|
|
10105
10125
|
}
|
|
10106
|
-
console.error(
|
|
10126
|
+
console.error(chalk119.red(`
|
|
10107
10127
|
Refactor check failed:
|
|
10108
10128
|
`));
|
|
10109
|
-
console.error(
|
|
10129
|
+
console.error(chalk119.red(` The following files exceed ${maxLines} lines:
|
|
10110
10130
|
`));
|
|
10111
10131
|
for (const violation of violations) {
|
|
10112
|
-
console.error(
|
|
10132
|
+
console.error(chalk119.red(` ${violation.file} (${violation.lines} lines)`));
|
|
10113
10133
|
}
|
|
10114
10134
|
console.error(
|
|
10115
|
-
|
|
10135
|
+
chalk119.yellow(
|
|
10116
10136
|
`
|
|
10117
10137
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
10118
10138
|
way to refactor it, ignore it with:
|
|
10119
10139
|
`
|
|
10120
10140
|
)
|
|
10121
10141
|
);
|
|
10122
|
-
console.error(
|
|
10142
|
+
console.error(chalk119.gray(` assist refactor ignore <file>
|
|
10123
10143
|
`));
|
|
10124
10144
|
if (process.env.CLAUDECODE) {
|
|
10125
|
-
console.error(
|
|
10145
|
+
console.error(chalk119.cyan(`
|
|
10126
10146
|
## Extracting Code to New Files
|
|
10127
10147
|
`));
|
|
10128
10148
|
console.error(
|
|
10129
|
-
|
|
10149
|
+
chalk119.cyan(
|
|
10130
10150
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
10131
10151
|
`
|
|
10132
10152
|
)
|
|
10133
10153
|
);
|
|
10134
10154
|
console.error(
|
|
10135
|
-
|
|
10155
|
+
chalk119.cyan(
|
|
10136
10156
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
10137
10157
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
10138
10158
|
`
|
|
10139
10159
|
)
|
|
10140
10160
|
);
|
|
10141
10161
|
console.error(
|
|
10142
|
-
|
|
10162
|
+
chalk119.cyan(
|
|
10143
10163
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
10144
10164
|
domains, move it to a common/shared folder.
|
|
10145
10165
|
`
|
|
@@ -10295,7 +10315,7 @@ async function check(pattern2, options2) {
|
|
|
10295
10315
|
|
|
10296
10316
|
// src/commands/refactor/extract/index.ts
|
|
10297
10317
|
import path36 from "path";
|
|
10298
|
-
import
|
|
10318
|
+
import chalk122 from "chalk";
|
|
10299
10319
|
|
|
10300
10320
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
10301
10321
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -10842,23 +10862,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
10842
10862
|
|
|
10843
10863
|
// src/commands/refactor/extract/displayPlan.ts
|
|
10844
10864
|
import path33 from "path";
|
|
10845
|
-
import
|
|
10865
|
+
import chalk120 from "chalk";
|
|
10846
10866
|
function section(title) {
|
|
10847
10867
|
return `
|
|
10848
|
-
${
|
|
10868
|
+
${chalk120.cyan(title)}`;
|
|
10849
10869
|
}
|
|
10850
10870
|
function displayImporters(plan2, cwd) {
|
|
10851
10871
|
if (plan2.importersToUpdate.length === 0) return;
|
|
10852
10872
|
console.log(section("Update importers:"));
|
|
10853
10873
|
for (const imp of plan2.importersToUpdate) {
|
|
10854
10874
|
const rel = path33.relative(cwd, imp.file.getFilePath());
|
|
10855
|
-
console.log(` ${
|
|
10875
|
+
console.log(` ${chalk120.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
10856
10876
|
}
|
|
10857
10877
|
}
|
|
10858
10878
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
10859
|
-
console.log(
|
|
10879
|
+
console.log(chalk120.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
10860
10880
|
`));
|
|
10861
|
-
console.log(` ${
|
|
10881
|
+
console.log(` ${chalk120.cyan("Functions to move:")}`);
|
|
10862
10882
|
for (const name of plan2.extractedNames) {
|
|
10863
10883
|
console.log(` ${name}`);
|
|
10864
10884
|
}
|
|
@@ -10892,7 +10912,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
10892
10912
|
|
|
10893
10913
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
10894
10914
|
import path35 from "path";
|
|
10895
|
-
import
|
|
10915
|
+
import chalk121 from "chalk";
|
|
10896
10916
|
import { Project as Project3 } from "ts-morph";
|
|
10897
10917
|
|
|
10898
10918
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -10952,7 +10972,7 @@ function loadProjectFile(file) {
|
|
|
10952
10972
|
});
|
|
10953
10973
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
10954
10974
|
if (!sourceFile) {
|
|
10955
|
-
console.log(
|
|
10975
|
+
console.log(chalk121.red(`File not found in project: ${file}`));
|
|
10956
10976
|
process.exit(1);
|
|
10957
10977
|
}
|
|
10958
10978
|
return { project, sourceFile };
|
|
@@ -10975,19 +10995,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
10975
10995
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
10976
10996
|
if (options2.apply) {
|
|
10977
10997
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
10978
|
-
console.log(
|
|
10998
|
+
console.log(chalk122.green("\nExtraction complete"));
|
|
10979
10999
|
} else {
|
|
10980
|
-
console.log(
|
|
11000
|
+
console.log(chalk122.dim("\nDry run. Use --apply to execute."));
|
|
10981
11001
|
}
|
|
10982
11002
|
}
|
|
10983
11003
|
|
|
10984
11004
|
// src/commands/refactor/ignore.ts
|
|
10985
11005
|
import fs20 from "fs";
|
|
10986
|
-
import
|
|
11006
|
+
import chalk123 from "chalk";
|
|
10987
11007
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
10988
11008
|
function ignore(file) {
|
|
10989
11009
|
if (!fs20.existsSync(file)) {
|
|
10990
|
-
console.error(
|
|
11010
|
+
console.error(chalk123.red(`Error: File does not exist: ${file}`));
|
|
10991
11011
|
process.exit(1);
|
|
10992
11012
|
}
|
|
10993
11013
|
const content = fs20.readFileSync(file, "utf-8");
|
|
@@ -11003,7 +11023,7 @@ function ignore(file) {
|
|
|
11003
11023
|
fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
11004
11024
|
}
|
|
11005
11025
|
console.log(
|
|
11006
|
-
|
|
11026
|
+
chalk123.green(
|
|
11007
11027
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
11008
11028
|
)
|
|
11009
11029
|
);
|
|
@@ -11011,25 +11031,25 @@ function ignore(file) {
|
|
|
11011
11031
|
|
|
11012
11032
|
// src/commands/refactor/rename/index.ts
|
|
11013
11033
|
import path37 from "path";
|
|
11014
|
-
import
|
|
11034
|
+
import chalk124 from "chalk";
|
|
11015
11035
|
async function rename(source, destination, options2 = {}) {
|
|
11016
11036
|
const destPath = path37.resolve(destination);
|
|
11017
11037
|
const cwd = process.cwd();
|
|
11018
11038
|
const relSource = path37.relative(cwd, path37.resolve(source));
|
|
11019
11039
|
const relDest = path37.relative(cwd, destPath);
|
|
11020
11040
|
const { project, sourceFile } = loadProjectFile(source);
|
|
11021
|
-
console.log(
|
|
11041
|
+
console.log(chalk124.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
11022
11042
|
if (options2.apply) {
|
|
11023
11043
|
sourceFile.move(destPath);
|
|
11024
11044
|
await project.save();
|
|
11025
|
-
console.log(
|
|
11045
|
+
console.log(chalk124.green("Done"));
|
|
11026
11046
|
} else {
|
|
11027
|
-
console.log(
|
|
11047
|
+
console.log(chalk124.dim("Dry run. Use --apply to execute."));
|
|
11028
11048
|
}
|
|
11029
11049
|
}
|
|
11030
11050
|
|
|
11031
11051
|
// src/commands/refactor/renameSymbol/index.ts
|
|
11032
|
-
import
|
|
11052
|
+
import chalk125 from "chalk";
|
|
11033
11053
|
|
|
11034
11054
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
11035
11055
|
import { SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
@@ -11075,33 +11095,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
11075
11095
|
const { project, sourceFile } = loadProjectFile(file);
|
|
11076
11096
|
const symbol = findSymbol(sourceFile, oldName);
|
|
11077
11097
|
if (!symbol) {
|
|
11078
|
-
console.log(
|
|
11098
|
+
console.log(chalk125.red(`Symbol "${oldName}" not found in ${file}`));
|
|
11079
11099
|
process.exit(1);
|
|
11080
11100
|
}
|
|
11081
11101
|
const grouped = groupReferences(symbol, cwd);
|
|
11082
11102
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
11083
11103
|
console.log(
|
|
11084
|
-
|
|
11104
|
+
chalk125.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
11085
11105
|
`)
|
|
11086
11106
|
);
|
|
11087
11107
|
for (const [refFile, lines] of grouped) {
|
|
11088
11108
|
console.log(
|
|
11089
|
-
` ${
|
|
11109
|
+
` ${chalk125.dim(refFile)}: lines ${chalk125.cyan(lines.join(", "))}`
|
|
11090
11110
|
);
|
|
11091
11111
|
}
|
|
11092
11112
|
if (options2.apply) {
|
|
11093
11113
|
symbol.rename(newName);
|
|
11094
11114
|
await project.save();
|
|
11095
|
-
console.log(
|
|
11115
|
+
console.log(chalk125.green(`
|
|
11096
11116
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
11097
11117
|
} else {
|
|
11098
|
-
console.log(
|
|
11118
|
+
console.log(chalk125.dim("\nDry run. Use --apply to execute."));
|
|
11099
11119
|
}
|
|
11100
11120
|
}
|
|
11101
11121
|
|
|
11102
11122
|
// src/commands/refactor/restructure/index.ts
|
|
11103
11123
|
import path47 from "path";
|
|
11104
|
-
import
|
|
11124
|
+
import chalk128 from "chalk";
|
|
11105
11125
|
|
|
11106
11126
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
11107
11127
|
import path39 from "path";
|
|
@@ -11344,50 +11364,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
11344
11364
|
|
|
11345
11365
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
11346
11366
|
import path43 from "path";
|
|
11347
|
-
import
|
|
11367
|
+
import chalk126 from "chalk";
|
|
11348
11368
|
function relPath(filePath) {
|
|
11349
11369
|
return path43.relative(process.cwd(), filePath);
|
|
11350
11370
|
}
|
|
11351
11371
|
function displayMoves(plan2) {
|
|
11352
11372
|
if (plan2.moves.length === 0) return;
|
|
11353
|
-
console.log(
|
|
11373
|
+
console.log(chalk126.bold("\nFile moves:"));
|
|
11354
11374
|
for (const move of plan2.moves) {
|
|
11355
11375
|
console.log(
|
|
11356
|
-
` ${
|
|
11376
|
+
` ${chalk126.red(relPath(move.from))} \u2192 ${chalk126.green(relPath(move.to))}`
|
|
11357
11377
|
);
|
|
11358
|
-
console.log(
|
|
11378
|
+
console.log(chalk126.dim(` ${move.reason}`));
|
|
11359
11379
|
}
|
|
11360
11380
|
}
|
|
11361
11381
|
function displayRewrites(rewrites) {
|
|
11362
11382
|
if (rewrites.length === 0) return;
|
|
11363
11383
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
11364
|
-
console.log(
|
|
11384
|
+
console.log(chalk126.bold(`
|
|
11365
11385
|
Import rewrites (${affectedFiles.size} files):`));
|
|
11366
11386
|
for (const file of affectedFiles) {
|
|
11367
|
-
console.log(` ${
|
|
11387
|
+
console.log(` ${chalk126.cyan(relPath(file))}:`);
|
|
11368
11388
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
11369
11389
|
(r) => r.file === file
|
|
11370
11390
|
)) {
|
|
11371
11391
|
console.log(
|
|
11372
|
-
` ${
|
|
11392
|
+
` ${chalk126.red(`"${oldSpecifier}"`)} \u2192 ${chalk126.green(`"${newSpecifier}"`)}`
|
|
11373
11393
|
);
|
|
11374
11394
|
}
|
|
11375
11395
|
}
|
|
11376
11396
|
}
|
|
11377
11397
|
function displayPlan2(plan2) {
|
|
11378
11398
|
if (plan2.warnings.length > 0) {
|
|
11379
|
-
console.log(
|
|
11380
|
-
for (const w of plan2.warnings) console.log(
|
|
11399
|
+
console.log(chalk126.yellow("\nWarnings:"));
|
|
11400
|
+
for (const w of plan2.warnings) console.log(chalk126.yellow(` ${w}`));
|
|
11381
11401
|
}
|
|
11382
11402
|
if (plan2.newDirectories.length > 0) {
|
|
11383
|
-
console.log(
|
|
11403
|
+
console.log(chalk126.bold("\nNew directories:"));
|
|
11384
11404
|
for (const dir of plan2.newDirectories)
|
|
11385
|
-
console.log(
|
|
11405
|
+
console.log(chalk126.green(` ${dir}/`));
|
|
11386
11406
|
}
|
|
11387
11407
|
displayMoves(plan2);
|
|
11388
11408
|
displayRewrites(plan2.rewrites);
|
|
11389
11409
|
console.log(
|
|
11390
|
-
|
|
11410
|
+
chalk126.dim(
|
|
11391
11411
|
`
|
|
11392
11412
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
11393
11413
|
)
|
|
@@ -11397,18 +11417,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
11397
11417
|
// src/commands/refactor/restructure/executePlan.ts
|
|
11398
11418
|
import fs22 from "fs";
|
|
11399
11419
|
import path44 from "path";
|
|
11400
|
-
import
|
|
11420
|
+
import chalk127 from "chalk";
|
|
11401
11421
|
function executePlan(plan2) {
|
|
11402
11422
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
11403
11423
|
for (const [file, content] of updatedContents) {
|
|
11404
11424
|
fs22.writeFileSync(file, content, "utf-8");
|
|
11405
11425
|
console.log(
|
|
11406
|
-
|
|
11426
|
+
chalk127.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
|
|
11407
11427
|
);
|
|
11408
11428
|
}
|
|
11409
11429
|
for (const dir of plan2.newDirectories) {
|
|
11410
11430
|
fs22.mkdirSync(dir, { recursive: true });
|
|
11411
|
-
console.log(
|
|
11431
|
+
console.log(chalk127.green(` Created ${path44.relative(process.cwd(), dir)}/`));
|
|
11412
11432
|
}
|
|
11413
11433
|
for (const move of plan2.moves) {
|
|
11414
11434
|
const targetDir = path44.dirname(move.to);
|
|
@@ -11417,7 +11437,7 @@ function executePlan(plan2) {
|
|
|
11417
11437
|
}
|
|
11418
11438
|
fs22.renameSync(move.from, move.to);
|
|
11419
11439
|
console.log(
|
|
11420
|
-
|
|
11440
|
+
chalk127.white(
|
|
11421
11441
|
` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
|
|
11422
11442
|
)
|
|
11423
11443
|
);
|
|
@@ -11432,7 +11452,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
11432
11452
|
if (entries.length === 0) {
|
|
11433
11453
|
fs22.rmdirSync(dir);
|
|
11434
11454
|
console.log(
|
|
11435
|
-
|
|
11455
|
+
chalk127.dim(
|
|
11436
11456
|
` Removed empty directory ${path44.relative(process.cwd(), dir)}`
|
|
11437
11457
|
)
|
|
11438
11458
|
);
|
|
@@ -11565,22 +11585,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
11565
11585
|
const targetPattern = pattern2 ?? "src";
|
|
11566
11586
|
const files = findSourceFiles2(targetPattern);
|
|
11567
11587
|
if (files.length === 0) {
|
|
11568
|
-
console.log(
|
|
11588
|
+
console.log(chalk128.yellow("No files found matching pattern"));
|
|
11569
11589
|
return;
|
|
11570
11590
|
}
|
|
11571
11591
|
const tsConfigPath = path47.resolve("tsconfig.json");
|
|
11572
11592
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
11573
11593
|
if (plan2.moves.length === 0) {
|
|
11574
|
-
console.log(
|
|
11594
|
+
console.log(chalk128.green("No restructuring needed"));
|
|
11575
11595
|
return;
|
|
11576
11596
|
}
|
|
11577
11597
|
displayPlan2(plan2);
|
|
11578
11598
|
if (options2.apply) {
|
|
11579
|
-
console.log(
|
|
11599
|
+
console.log(chalk128.bold("\nApplying changes..."));
|
|
11580
11600
|
executePlan(plan2);
|
|
11581
|
-
console.log(
|
|
11601
|
+
console.log(chalk128.green("\nRestructuring complete"));
|
|
11582
11602
|
} else {
|
|
11583
|
-
console.log(
|
|
11603
|
+
console.log(chalk128.dim("\nDry run. Use --apply to execute."));
|
|
11584
11604
|
}
|
|
11585
11605
|
}
|
|
11586
11606
|
|
|
@@ -12031,18 +12051,18 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
12031
12051
|
}
|
|
12032
12052
|
|
|
12033
12053
|
// src/commands/review/warnUnlocated.ts
|
|
12034
|
-
import
|
|
12054
|
+
import chalk129 from "chalk";
|
|
12035
12055
|
function warnUnlocated(unlocated) {
|
|
12036
12056
|
if (unlocated.length === 0) return;
|
|
12037
12057
|
console.warn(
|
|
12038
|
-
|
|
12058
|
+
chalk129.yellow(
|
|
12039
12059
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
12040
12060
|
)
|
|
12041
12061
|
);
|
|
12042
12062
|
for (const finding of unlocated) {
|
|
12043
|
-
const where = finding.location ||
|
|
12063
|
+
const where = finding.location || chalk129.dim("missing");
|
|
12044
12064
|
console.warn(
|
|
12045
|
-
` ${
|
|
12065
|
+
` ${chalk129.yellow("\xB7")} ${finding.title} ${chalk129.dim(`(${where})`)}`
|
|
12046
12066
|
);
|
|
12047
12067
|
}
|
|
12048
12068
|
}
|
|
@@ -12894,7 +12914,7 @@ function registerReview(program2) {
|
|
|
12894
12914
|
}
|
|
12895
12915
|
|
|
12896
12916
|
// src/commands/seq/seqAuth.ts
|
|
12897
|
-
import
|
|
12917
|
+
import chalk131 from "chalk";
|
|
12898
12918
|
|
|
12899
12919
|
// src/commands/seq/loadConnections.ts
|
|
12900
12920
|
function loadConnections2() {
|
|
@@ -12923,10 +12943,10 @@ function setDefaultConnection(name) {
|
|
|
12923
12943
|
}
|
|
12924
12944
|
|
|
12925
12945
|
// src/shared/assertUniqueName.ts
|
|
12926
|
-
import
|
|
12946
|
+
import chalk130 from "chalk";
|
|
12927
12947
|
function assertUniqueName(existingNames, name) {
|
|
12928
12948
|
if (existingNames.includes(name)) {
|
|
12929
|
-
console.error(
|
|
12949
|
+
console.error(chalk130.red(`Connection "${name}" already exists.`));
|
|
12930
12950
|
process.exit(1);
|
|
12931
12951
|
}
|
|
12932
12952
|
}
|
|
@@ -12944,16 +12964,16 @@ async function promptConnection2(existingNames) {
|
|
|
12944
12964
|
var seqAuth = createConnectionAuth({
|
|
12945
12965
|
load: loadConnections2,
|
|
12946
12966
|
save: saveConnections2,
|
|
12947
|
-
format: (c) => `${
|
|
12967
|
+
format: (c) => `${chalk131.bold(c.name)} ${c.url}`,
|
|
12948
12968
|
promptNew: promptConnection2,
|
|
12949
12969
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
12950
12970
|
});
|
|
12951
12971
|
|
|
12952
12972
|
// src/commands/seq/seqQuery.ts
|
|
12953
|
-
import
|
|
12973
|
+
import chalk135 from "chalk";
|
|
12954
12974
|
|
|
12955
12975
|
// src/commands/seq/fetchSeq.ts
|
|
12956
|
-
import
|
|
12976
|
+
import chalk132 from "chalk";
|
|
12957
12977
|
async function fetchSeq(conn, path52, params) {
|
|
12958
12978
|
const url = `${conn.url}${path52}?${params}`;
|
|
12959
12979
|
const response = await fetch(url, {
|
|
@@ -12964,7 +12984,7 @@ async function fetchSeq(conn, path52, params) {
|
|
|
12964
12984
|
});
|
|
12965
12985
|
if (!response.ok) {
|
|
12966
12986
|
const body = await response.text();
|
|
12967
|
-
console.error(
|
|
12987
|
+
console.error(chalk132.red(`Seq returned ${response.status}: ${body}`));
|
|
12968
12988
|
process.exit(1);
|
|
12969
12989
|
}
|
|
12970
12990
|
return response;
|
|
@@ -13019,23 +13039,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
13019
13039
|
}
|
|
13020
13040
|
|
|
13021
13041
|
// src/commands/seq/formatEvent.ts
|
|
13022
|
-
import
|
|
13042
|
+
import chalk133 from "chalk";
|
|
13023
13043
|
function levelColor(level) {
|
|
13024
13044
|
switch (level) {
|
|
13025
13045
|
case "Fatal":
|
|
13026
|
-
return
|
|
13046
|
+
return chalk133.bgRed.white;
|
|
13027
13047
|
case "Error":
|
|
13028
|
-
return
|
|
13048
|
+
return chalk133.red;
|
|
13029
13049
|
case "Warning":
|
|
13030
|
-
return
|
|
13050
|
+
return chalk133.yellow;
|
|
13031
13051
|
case "Information":
|
|
13032
|
-
return
|
|
13052
|
+
return chalk133.cyan;
|
|
13033
13053
|
case "Debug":
|
|
13034
|
-
return
|
|
13054
|
+
return chalk133.gray;
|
|
13035
13055
|
case "Verbose":
|
|
13036
|
-
return
|
|
13056
|
+
return chalk133.dim;
|
|
13037
13057
|
default:
|
|
13038
|
-
return
|
|
13058
|
+
return chalk133.white;
|
|
13039
13059
|
}
|
|
13040
13060
|
}
|
|
13041
13061
|
function levelAbbrev(level) {
|
|
@@ -13076,12 +13096,12 @@ function formatTimestamp(iso) {
|
|
|
13076
13096
|
function formatEvent(event) {
|
|
13077
13097
|
const color = levelColor(event.Level);
|
|
13078
13098
|
const abbrev = levelAbbrev(event.Level);
|
|
13079
|
-
const ts8 =
|
|
13099
|
+
const ts8 = chalk133.dim(formatTimestamp(event.Timestamp));
|
|
13080
13100
|
const msg = renderMessage(event);
|
|
13081
13101
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
13082
13102
|
if (event.Exception) {
|
|
13083
13103
|
for (const line of event.Exception.split("\n")) {
|
|
13084
|
-
lines.push(
|
|
13104
|
+
lines.push(chalk133.red(` ${line}`));
|
|
13085
13105
|
}
|
|
13086
13106
|
}
|
|
13087
13107
|
return lines.join("\n");
|
|
@@ -13114,11 +13134,11 @@ function rejectTimestampFilter(filter) {
|
|
|
13114
13134
|
}
|
|
13115
13135
|
|
|
13116
13136
|
// src/shared/resolveNamedConnection.ts
|
|
13117
|
-
import
|
|
13137
|
+
import chalk134 from "chalk";
|
|
13118
13138
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
13119
13139
|
if (connections.length === 0) {
|
|
13120
13140
|
console.error(
|
|
13121
|
-
|
|
13141
|
+
chalk134.red(
|
|
13122
13142
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
13123
13143
|
)
|
|
13124
13144
|
);
|
|
@@ -13127,7 +13147,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
13127
13147
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
13128
13148
|
const connection = connections.find((c) => c.name === target);
|
|
13129
13149
|
if (!connection) {
|
|
13130
|
-
console.error(
|
|
13150
|
+
console.error(chalk134.red(`${kind} connection "${target}" not found.`));
|
|
13131
13151
|
process.exit(1);
|
|
13132
13152
|
}
|
|
13133
13153
|
return connection;
|
|
@@ -13156,7 +13176,7 @@ async function seqQuery(filter, options2) {
|
|
|
13156
13176
|
new URLSearchParams({ filter, count: String(count) })
|
|
13157
13177
|
);
|
|
13158
13178
|
if (events.length === 0) {
|
|
13159
|
-
console.log(
|
|
13179
|
+
console.log(chalk135.yellow("No events found."));
|
|
13160
13180
|
return;
|
|
13161
13181
|
}
|
|
13162
13182
|
if (options2.json) {
|
|
@@ -13167,11 +13187,11 @@ async function seqQuery(filter, options2) {
|
|
|
13167
13187
|
for (const event of chronological) {
|
|
13168
13188
|
console.log(formatEvent(event));
|
|
13169
13189
|
}
|
|
13170
|
-
console.log(
|
|
13190
|
+
console.log(chalk135.dim(`
|
|
13171
13191
|
${events.length} events`));
|
|
13172
13192
|
if (events.length >= count) {
|
|
13173
13193
|
console.log(
|
|
13174
|
-
|
|
13194
|
+
chalk135.yellow(
|
|
13175
13195
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
13176
13196
|
)
|
|
13177
13197
|
);
|
|
@@ -13179,10 +13199,10 @@ ${events.length} events`));
|
|
|
13179
13199
|
}
|
|
13180
13200
|
|
|
13181
13201
|
// src/shared/setNamedDefaultConnection.ts
|
|
13182
|
-
import
|
|
13202
|
+
import chalk136 from "chalk";
|
|
13183
13203
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
13184
13204
|
if (!connections.find((c) => c.name === name)) {
|
|
13185
|
-
console.error(
|
|
13205
|
+
console.error(chalk136.red(`Connection "${name}" not found.`));
|
|
13186
13206
|
process.exit(1);
|
|
13187
13207
|
}
|
|
13188
13208
|
setDefault(name);
|
|
@@ -13226,7 +13246,7 @@ function registerSignal(program2) {
|
|
|
13226
13246
|
}
|
|
13227
13247
|
|
|
13228
13248
|
// src/commands/sql/sqlAuth.ts
|
|
13229
|
-
import
|
|
13249
|
+
import chalk138 from "chalk";
|
|
13230
13250
|
|
|
13231
13251
|
// src/commands/sql/loadConnections.ts
|
|
13232
13252
|
function loadConnections3() {
|
|
@@ -13255,7 +13275,7 @@ function setDefaultConnection2(name) {
|
|
|
13255
13275
|
}
|
|
13256
13276
|
|
|
13257
13277
|
// src/commands/sql/promptConnection.ts
|
|
13258
|
-
import
|
|
13278
|
+
import chalk137 from "chalk";
|
|
13259
13279
|
async function promptConnection3(existingNames) {
|
|
13260
13280
|
const name = await promptInput("name", "Connection name:", "default");
|
|
13261
13281
|
assertUniqueName(existingNames, name);
|
|
@@ -13263,7 +13283,7 @@ async function promptConnection3(existingNames) {
|
|
|
13263
13283
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
13264
13284
|
const port = Number.parseInt(portStr, 10);
|
|
13265
13285
|
if (!Number.isFinite(port)) {
|
|
13266
|
-
console.error(
|
|
13286
|
+
console.error(chalk137.red(`Invalid port "${portStr}".`));
|
|
13267
13287
|
process.exit(1);
|
|
13268
13288
|
}
|
|
13269
13289
|
const user = await promptInput("user", "User:");
|
|
@@ -13276,13 +13296,13 @@ async function promptConnection3(existingNames) {
|
|
|
13276
13296
|
var sqlAuth = createConnectionAuth({
|
|
13277
13297
|
load: loadConnections3,
|
|
13278
13298
|
save: saveConnections3,
|
|
13279
|
-
format: (c) => `${
|
|
13299
|
+
format: (c) => `${chalk138.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
13280
13300
|
promptNew: promptConnection3,
|
|
13281
13301
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
13282
13302
|
});
|
|
13283
13303
|
|
|
13284
13304
|
// src/commands/sql/printTable.ts
|
|
13285
|
-
import
|
|
13305
|
+
import chalk139 from "chalk";
|
|
13286
13306
|
function formatCell(value) {
|
|
13287
13307
|
if (value === null || value === void 0) return "";
|
|
13288
13308
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -13291,7 +13311,7 @@ function formatCell(value) {
|
|
|
13291
13311
|
}
|
|
13292
13312
|
function printTable(rows) {
|
|
13293
13313
|
if (rows.length === 0) {
|
|
13294
|
-
console.log(
|
|
13314
|
+
console.log(chalk139.yellow("(no rows)"));
|
|
13295
13315
|
return;
|
|
13296
13316
|
}
|
|
13297
13317
|
const columns = Object.keys(rows[0]);
|
|
@@ -13299,13 +13319,13 @@ function printTable(rows) {
|
|
|
13299
13319
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
13300
13320
|
);
|
|
13301
13321
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
13302
|
-
console.log(
|
|
13303
|
-
console.log(
|
|
13322
|
+
console.log(chalk139.dim(header));
|
|
13323
|
+
console.log(chalk139.dim("-".repeat(header.length)));
|
|
13304
13324
|
for (const row of rows) {
|
|
13305
13325
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
13306
13326
|
console.log(line);
|
|
13307
13327
|
}
|
|
13308
|
-
console.log(
|
|
13328
|
+
console.log(chalk139.dim(`
|
|
13309
13329
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
13310
13330
|
}
|
|
13311
13331
|
|
|
@@ -13365,7 +13385,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
13365
13385
|
}
|
|
13366
13386
|
|
|
13367
13387
|
// src/commands/sql/sqlMutate.ts
|
|
13368
|
-
import
|
|
13388
|
+
import chalk140 from "chalk";
|
|
13369
13389
|
|
|
13370
13390
|
// src/commands/sql/isMutation.ts
|
|
13371
13391
|
var MUTATION_KEYWORDS = [
|
|
@@ -13399,7 +13419,7 @@ function isMutation(sql2) {
|
|
|
13399
13419
|
async function sqlMutate(query, connectionName) {
|
|
13400
13420
|
if (!isMutation(query)) {
|
|
13401
13421
|
console.error(
|
|
13402
|
-
|
|
13422
|
+
chalk140.red(
|
|
13403
13423
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
13404
13424
|
)
|
|
13405
13425
|
);
|
|
@@ -13409,18 +13429,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
13409
13429
|
const pool = await sqlConnect(conn);
|
|
13410
13430
|
try {
|
|
13411
13431
|
const result = await pool.request().query(query);
|
|
13412
|
-
console.log(
|
|
13432
|
+
console.log(chalk140.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
13413
13433
|
} finally {
|
|
13414
13434
|
await pool.close();
|
|
13415
13435
|
}
|
|
13416
13436
|
}
|
|
13417
13437
|
|
|
13418
13438
|
// src/commands/sql/sqlQuery.ts
|
|
13419
|
-
import
|
|
13439
|
+
import chalk141 from "chalk";
|
|
13420
13440
|
async function sqlQuery(query, connectionName) {
|
|
13421
13441
|
if (isMutation(query)) {
|
|
13422
13442
|
console.error(
|
|
13423
|
-
|
|
13443
|
+
chalk141.red(
|
|
13424
13444
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
13425
13445
|
)
|
|
13426
13446
|
);
|
|
@@ -13435,7 +13455,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
13435
13455
|
printTable(rows);
|
|
13436
13456
|
} else {
|
|
13437
13457
|
console.log(
|
|
13438
|
-
|
|
13458
|
+
chalk141.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
13439
13459
|
);
|
|
13440
13460
|
}
|
|
13441
13461
|
} finally {
|
|
@@ -14015,14 +14035,14 @@ import {
|
|
|
14015
14035
|
import { dirname as dirname22, join as join40 } from "path";
|
|
14016
14036
|
|
|
14017
14037
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
14018
|
-
import
|
|
14038
|
+
import chalk142 from "chalk";
|
|
14019
14039
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
14020
14040
|
function validateStagedContent(filename, content) {
|
|
14021
14041
|
const firstLine = content.split("\n")[0];
|
|
14022
14042
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
14023
14043
|
if (!match) {
|
|
14024
14044
|
console.error(
|
|
14025
|
-
|
|
14045
|
+
chalk142.red(
|
|
14026
14046
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
14027
14047
|
)
|
|
14028
14048
|
);
|
|
@@ -14031,7 +14051,7 @@ function validateStagedContent(filename, content) {
|
|
|
14031
14051
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
14032
14052
|
if (!contentAfterLink) {
|
|
14033
14053
|
console.error(
|
|
14034
|
-
|
|
14054
|
+
chalk142.red(
|
|
14035
14055
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
14036
14056
|
)
|
|
14037
14057
|
);
|
|
@@ -14390,7 +14410,7 @@ function status() {
|
|
|
14390
14410
|
|
|
14391
14411
|
// src/commands/voice/stop.ts
|
|
14392
14412
|
import { existsSync as existsSync44, readFileSync as readFileSync36, unlinkSync as unlinkSync13 } from "fs";
|
|
14393
|
-
function
|
|
14413
|
+
function stop2() {
|
|
14394
14414
|
if (!existsSync44(voicePaths.pid)) {
|
|
14395
14415
|
console.log("Voice daemon is not running (no PID file)");
|
|
14396
14416
|
return;
|
|
@@ -14419,7 +14439,7 @@ function registerVoice(program2) {
|
|
|
14419
14439
|
const voiceCommand = program2.command("voice").description("Voice interaction daemon for hands-free Claude commands");
|
|
14420
14440
|
voiceCommand.command("start").description("Start the voice daemon").option("--foreground", "Run in foreground for debugging").option("--debug", "Enable debug output (live VAD meter, verbose logging)").action((options2) => start2(options2));
|
|
14421
14441
|
voiceCommand.command("setup").description("Download required voice models (VAD, STT)").action(setup);
|
|
14422
|
-
voiceCommand.command("stop").description("Stop the voice daemon").action(
|
|
14442
|
+
voiceCommand.command("stop").description("Stop the voice daemon").action(stop2);
|
|
14423
14443
|
voiceCommand.command("status").description("Check voice daemon status").action(status);
|
|
14424
14444
|
voiceCommand.command("devices").description("List available audio input devices").action(devices);
|
|
14425
14445
|
voiceCommand.command("logs").description("Tail voice daemon logs").option("-n, --lines <count>", "Number of lines to show", "20").action((options2) => logs(options2));
|
|
@@ -14427,7 +14447,7 @@ function registerVoice(program2) {
|
|
|
14427
14447
|
|
|
14428
14448
|
// src/commands/roam/auth.ts
|
|
14429
14449
|
import { randomBytes } from "crypto";
|
|
14430
|
-
import
|
|
14450
|
+
import chalk143 from "chalk";
|
|
14431
14451
|
|
|
14432
14452
|
// src/lib/openBrowser.ts
|
|
14433
14453
|
import { execSync as execSync41 } from "child_process";
|
|
@@ -14602,13 +14622,13 @@ async function auth() {
|
|
|
14602
14622
|
saveGlobalConfig(config);
|
|
14603
14623
|
const state = randomBytes(16).toString("hex");
|
|
14604
14624
|
console.log(
|
|
14605
|
-
|
|
14625
|
+
chalk143.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
14606
14626
|
);
|
|
14607
|
-
console.log(
|
|
14608
|
-
console.log(
|
|
14609
|
-
console.log(
|
|
14627
|
+
console.log(chalk143.white("http://localhost:14523/callback\n"));
|
|
14628
|
+
console.log(chalk143.blue("Opening browser for authorization..."));
|
|
14629
|
+
console.log(chalk143.dim("Waiting for authorization callback..."));
|
|
14610
14630
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
14611
|
-
console.log(
|
|
14631
|
+
console.log(chalk143.dim("Exchanging code for tokens..."));
|
|
14612
14632
|
const tokens = await exchangeToken({
|
|
14613
14633
|
code,
|
|
14614
14634
|
clientId,
|
|
@@ -14624,7 +14644,7 @@ async function auth() {
|
|
|
14624
14644
|
};
|
|
14625
14645
|
saveGlobalConfig(config);
|
|
14626
14646
|
console.log(
|
|
14627
|
-
|
|
14647
|
+
chalk143.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
14628
14648
|
);
|
|
14629
14649
|
}
|
|
14630
14650
|
|
|
@@ -15047,7 +15067,7 @@ import { execSync as execSync43 } from "child_process";
|
|
|
15047
15067
|
import { existsSync as existsSync47, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync32 } from "fs";
|
|
15048
15068
|
import { tmpdir as tmpdir7 } from "os";
|
|
15049
15069
|
import { join as join51, resolve as resolve13 } from "path";
|
|
15050
|
-
import
|
|
15070
|
+
import chalk144 from "chalk";
|
|
15051
15071
|
|
|
15052
15072
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
15053
15073
|
var captureWindowPs1 = `
|
|
@@ -15198,20 +15218,20 @@ function screenshot(processName) {
|
|
|
15198
15218
|
const config = loadConfig();
|
|
15199
15219
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
15200
15220
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
15201
|
-
console.log(
|
|
15221
|
+
console.log(chalk144.gray(`Capturing window for process "${processName}" ...`));
|
|
15202
15222
|
try {
|
|
15203
15223
|
runPowerShellScript(processName, outputPath);
|
|
15204
|
-
console.log(
|
|
15224
|
+
console.log(chalk144.green(`Screenshot saved: ${outputPath}`));
|
|
15205
15225
|
} catch (error) {
|
|
15206
15226
|
const msg = error instanceof Error ? error.message : String(error);
|
|
15207
|
-
console.error(
|
|
15227
|
+
console.error(chalk144.red(`Failed to capture screenshot: ${msg}`));
|
|
15208
15228
|
process.exit(1);
|
|
15209
15229
|
}
|
|
15210
15230
|
}
|
|
15211
15231
|
|
|
15212
15232
|
// src/commands/sessions/summarise/index.ts
|
|
15213
15233
|
import * as fs27 from "fs";
|
|
15214
|
-
import
|
|
15234
|
+
import chalk145 from "chalk";
|
|
15215
15235
|
|
|
15216
15236
|
// src/commands/sessions/summarise/shared.ts
|
|
15217
15237
|
import * as fs25 from "fs";
|
|
@@ -15351,22 +15371,22 @@ ${firstMessage}`);
|
|
|
15351
15371
|
async function summarise3(options2) {
|
|
15352
15372
|
const files = await discoverSessionJsonlPaths();
|
|
15353
15373
|
if (files.length === 0) {
|
|
15354
|
-
console.log(
|
|
15374
|
+
console.log(chalk145.yellow("No sessions found."));
|
|
15355
15375
|
return;
|
|
15356
15376
|
}
|
|
15357
15377
|
const toProcess = selectCandidates(files, options2);
|
|
15358
15378
|
if (toProcess.length === 0) {
|
|
15359
|
-
console.log(
|
|
15379
|
+
console.log(chalk145.green("All sessions already summarised."));
|
|
15360
15380
|
return;
|
|
15361
15381
|
}
|
|
15362
15382
|
console.log(
|
|
15363
|
-
|
|
15383
|
+
chalk145.cyan(
|
|
15364
15384
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
15365
15385
|
)
|
|
15366
15386
|
);
|
|
15367
15387
|
const { succeeded, failed } = processSessions(toProcess);
|
|
15368
15388
|
console.log(
|
|
15369
|
-
|
|
15389
|
+
chalk145.green(`Done: ${succeeded} summarised`) + (failed > 0 ? chalk145.yellow(`, ${failed} skipped`) : "")
|
|
15370
15390
|
);
|
|
15371
15391
|
}
|
|
15372
15392
|
function selectCandidates(files, options2) {
|
|
@@ -15386,16 +15406,16 @@ function processSessions(files) {
|
|
|
15386
15406
|
let failed = 0;
|
|
15387
15407
|
for (let i = 0; i < files.length; i++) {
|
|
15388
15408
|
const file = files[i];
|
|
15389
|
-
process.stdout.write(
|
|
15409
|
+
process.stdout.write(chalk145.dim(` [${i + 1}/${files.length}] `));
|
|
15390
15410
|
const summary = summariseSession(file);
|
|
15391
15411
|
if (summary) {
|
|
15392
15412
|
writeSummary(file, summary);
|
|
15393
15413
|
succeeded++;
|
|
15394
|
-
process.stdout.write(`${
|
|
15414
|
+
process.stdout.write(`${chalk145.green("\u2713")} ${summary}
|
|
15395
15415
|
`);
|
|
15396
15416
|
} else {
|
|
15397
15417
|
failed++;
|
|
15398
|
-
process.stdout.write(` ${
|
|
15418
|
+
process.stdout.write(` ${chalk145.yellow("skip")}
|
|
15399
15419
|
`);
|
|
15400
15420
|
}
|
|
15401
15421
|
}
|
|
@@ -15410,10 +15430,10 @@ function registerSessions(program2) {
|
|
|
15410
15430
|
}
|
|
15411
15431
|
|
|
15412
15432
|
// src/commands/statusLine.ts
|
|
15413
|
-
import
|
|
15433
|
+
import chalk147 from "chalk";
|
|
15414
15434
|
|
|
15415
15435
|
// src/commands/buildLimitsSegment.ts
|
|
15416
|
-
import
|
|
15436
|
+
import chalk146 from "chalk";
|
|
15417
15437
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
15418
15438
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
15419
15439
|
function formatTimeLeft(resetsAt) {
|
|
@@ -15436,10 +15456,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
15436
15456
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
15437
15457
|
const label2 = `${Math.round(pct)}%`;
|
|
15438
15458
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
15439
|
-
if (projected == null) return
|
|
15440
|
-
if (projected > 100) return
|
|
15441
|
-
if (projected > 75) return
|
|
15442
|
-
return
|
|
15459
|
+
if (projected == null) return chalk146.green(label2);
|
|
15460
|
+
if (projected > 100) return chalk146.red(label2);
|
|
15461
|
+
if (projected > 75) return chalk146.yellow(label2);
|
|
15462
|
+
return chalk146.green(label2);
|
|
15443
15463
|
}
|
|
15444
15464
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
15445
15465
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -15465,14 +15485,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
15465
15485
|
}
|
|
15466
15486
|
|
|
15467
15487
|
// src/commands/statusLine.ts
|
|
15468
|
-
|
|
15488
|
+
chalk147.level = 3;
|
|
15469
15489
|
function formatNumber(num) {
|
|
15470
15490
|
return num.toLocaleString("en-US");
|
|
15471
15491
|
}
|
|
15472
15492
|
function colorizePercent(pct) {
|
|
15473
15493
|
const label2 = `${Math.round(pct)}%`;
|
|
15474
|
-
if (pct > 80) return
|
|
15475
|
-
if (pct > 40) return
|
|
15494
|
+
if (pct > 80) return chalk147.red(label2);
|
|
15495
|
+
if (pct > 40) return chalk147.yellow(label2);
|
|
15476
15496
|
return label2;
|
|
15477
15497
|
}
|
|
15478
15498
|
async function statusLine() {
|
|
@@ -15495,7 +15515,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
15495
15515
|
// src/commands/sync/syncClaudeMd.ts
|
|
15496
15516
|
import * as fs28 from "fs";
|
|
15497
15517
|
import * as path48 from "path";
|
|
15498
|
-
import
|
|
15518
|
+
import chalk148 from "chalk";
|
|
15499
15519
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
15500
15520
|
const source = path48.join(claudeDir, "CLAUDE.md");
|
|
15501
15521
|
const target = path48.join(targetBase, "CLAUDE.md");
|
|
@@ -15504,12 +15524,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15504
15524
|
const targetContent = fs28.readFileSync(target, "utf-8");
|
|
15505
15525
|
if (sourceContent !== targetContent) {
|
|
15506
15526
|
console.log(
|
|
15507
|
-
|
|
15527
|
+
chalk148.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
15508
15528
|
);
|
|
15509
15529
|
console.log();
|
|
15510
15530
|
printDiff(targetContent, sourceContent);
|
|
15511
15531
|
const confirm = options2?.yes || await promptConfirm(
|
|
15512
|
-
|
|
15532
|
+
chalk148.red("Overwrite existing CLAUDE.md?"),
|
|
15513
15533
|
false
|
|
15514
15534
|
);
|
|
15515
15535
|
if (!confirm) {
|
|
@@ -15525,7 +15545,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15525
15545
|
// src/commands/sync/syncSettings.ts
|
|
15526
15546
|
import * as fs29 from "fs";
|
|
15527
15547
|
import * as path49 from "path";
|
|
15528
|
-
import
|
|
15548
|
+
import chalk149 from "chalk";
|
|
15529
15549
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
15530
15550
|
const source = path49.join(claudeDir, "settings.json");
|
|
15531
15551
|
const target = path49.join(targetBase, "settings.json");
|
|
@@ -15541,14 +15561,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
15541
15561
|
if (mergedContent !== normalizedTarget) {
|
|
15542
15562
|
if (!options2?.yes) {
|
|
15543
15563
|
console.log(
|
|
15544
|
-
|
|
15564
|
+
chalk149.yellow(
|
|
15545
15565
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
15546
15566
|
)
|
|
15547
15567
|
);
|
|
15548
15568
|
console.log();
|
|
15549
15569
|
printDiff(targetContent, mergedContent);
|
|
15550
15570
|
const confirm = await promptConfirm(
|
|
15551
|
-
|
|
15571
|
+
chalk149.red("Overwrite existing settings.json?"),
|
|
15552
15572
|
false
|
|
15553
15573
|
);
|
|
15554
15574
|
if (!confirm) {
|