@staff0rd/assist 0.171.1 → 0.172.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/commands/backlog/web/bundle.js +1 -1
- package/dist/index.js +321 -294
- 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.172.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -306,7 +306,7 @@ function saveAllItems(db, items) {
|
|
|
306
306
|
|
|
307
307
|
// src/commands/backlog/types.ts
|
|
308
308
|
import { z } from "zod";
|
|
309
|
-
var backlogStatusSchema = z.enum(["todo", "in-progress", "done"]);
|
|
309
|
+
var backlogStatusSchema = z.enum(["todo", "in-progress", "done", "wontdo"]);
|
|
310
310
|
var backlogTypeSchema = z.enum(["story", "bug"]);
|
|
311
311
|
var planTaskSchema = z.strictObject({
|
|
312
312
|
task: z.string(),
|
|
@@ -595,6 +595,8 @@ function statusIcon(status2) {
|
|
|
595
595
|
return chalk2.yellow("[~]");
|
|
596
596
|
case "done":
|
|
597
597
|
return chalk2.green("[x]");
|
|
598
|
+
case "wontdo":
|
|
599
|
+
return chalk2.dim("[-]");
|
|
598
600
|
}
|
|
599
601
|
}
|
|
600
602
|
function typeLabel(type) {
|
|
@@ -791,8 +793,14 @@ function cleanupSignal() {
|
|
|
791
793
|
unlinkSync2(statusPath);
|
|
792
794
|
}
|
|
793
795
|
}
|
|
794
|
-
|
|
796
|
+
function isTerminalStatus(itemId) {
|
|
797
|
+
const items = loadBacklog();
|
|
798
|
+
const item = items.find((i) => i.id === itemId);
|
|
799
|
+
return item?.status === "done" || item?.status === "wontdo";
|
|
800
|
+
}
|
|
801
|
+
async function resolvePhaseResult(phaseIndex, itemId) {
|
|
795
802
|
if (!existsSync3(getSignalPath())) {
|
|
803
|
+
if (isTerminalStatus(itemId)) return -1;
|
|
796
804
|
const action = await handleIncompletePhase();
|
|
797
805
|
if (action === "abort") return -1;
|
|
798
806
|
return action === "skip" ? 1 : 0;
|
|
@@ -870,7 +878,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions) {
|
|
|
870
878
|
watchForMarker(child);
|
|
871
879
|
await done2;
|
|
872
880
|
stopWatching();
|
|
873
|
-
const delta = await resolvePhaseResult(phaseIndex);
|
|
881
|
+
const delta = await resolvePhaseResult(phaseIndex, item.id);
|
|
874
882
|
return delta < 0 ? -1 : phaseIndex + delta;
|
|
875
883
|
}
|
|
876
884
|
|
|
@@ -3896,7 +3904,8 @@ import { existsSync as existsSync20 } from "fs";
|
|
|
3896
3904
|
import chalk47 from "chalk";
|
|
3897
3905
|
function filterItems(items, options2) {
|
|
3898
3906
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3899
|
-
if (!options2.all)
|
|
3907
|
+
if (!options2.all)
|
|
3908
|
+
return items.filter((i) => i.status !== "done" && i.status !== "wontdo");
|
|
3900
3909
|
return items;
|
|
3901
3910
|
}
|
|
3902
3911
|
async function list2(options2) {
|
|
@@ -3926,7 +3935,10 @@ async function list2(options2) {
|
|
|
3926
3935
|
// src/commands/backlog/registerItemCommands.ts
|
|
3927
3936
|
function registerItemCommands(cmd) {
|
|
3928
3937
|
cmd.command("init").description("Create an empty assist.backlog.yml").action(init6);
|
|
3929
|
-
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
3938
|
+
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
3939
|
+
"--status <type>",
|
|
3940
|
+
"Filter by status (todo, in-progress, done, wontdo)"
|
|
3941
|
+
).option("-a, --all", "Include done/wontdo items").option("-v, --verbose", "Show all item details").action(list2);
|
|
3930
3942
|
cmd.command("add").description("Add a new backlog item").option("--file <path>", "Read item as JSON from a file").action(add);
|
|
3931
3943
|
}
|
|
3932
3944
|
|
|
@@ -4081,10 +4093,25 @@ async function start(id) {
|
|
|
4081
4093
|
}
|
|
4082
4094
|
}
|
|
4083
4095
|
|
|
4096
|
+
// src/commands/backlog/wontdo/index.ts
|
|
4097
|
+
import chalk54 from "chalk";
|
|
4098
|
+
async function wontdo(id, reason) {
|
|
4099
|
+
const result = loadAndFindItem(id);
|
|
4100
|
+
if (!result) return;
|
|
4101
|
+
result.item.status = "wontdo";
|
|
4102
|
+
if (reason) {
|
|
4103
|
+
const phase = result.item.currentPhase ?? 0;
|
|
4104
|
+
addPhaseSummary(result.item, reason, phase);
|
|
4105
|
+
}
|
|
4106
|
+
saveBacklog(result.items);
|
|
4107
|
+
console.log(chalk54.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4084
4110
|
// src/commands/backlog/registerStatusCommands.ts
|
|
4085
4111
|
function registerStatusCommands(cmd) {
|
|
4086
4112
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
4087
4113
|
cmd.command("done <id> [summary]").description("Set a backlog item to done").action(done);
|
|
4114
|
+
cmd.command("wontdo <id> [reason]").description("Set a backlog item to won't do").action(wontdo);
|
|
4088
4115
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
4089
4116
|
}
|
|
4090
4117
|
|
|
@@ -4520,48 +4547,48 @@ ${reasons.join("\n")}`);
|
|
|
4520
4547
|
}
|
|
4521
4548
|
|
|
4522
4549
|
// src/commands/deny/denyAdd.ts
|
|
4523
|
-
import
|
|
4550
|
+
import chalk55 from "chalk";
|
|
4524
4551
|
function denyAdd(pattern2, message) {
|
|
4525
4552
|
const config = loadProjectConfig();
|
|
4526
4553
|
const deny = config.deny ?? [];
|
|
4527
4554
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4528
|
-
console.log(
|
|
4555
|
+
console.log(chalk55.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4529
4556
|
return;
|
|
4530
4557
|
}
|
|
4531
4558
|
deny.push({ pattern: pattern2, message });
|
|
4532
4559
|
config.deny = deny;
|
|
4533
4560
|
saveConfig(config);
|
|
4534
|
-
console.log(
|
|
4561
|
+
console.log(chalk55.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4535
4562
|
}
|
|
4536
4563
|
|
|
4537
4564
|
// src/commands/deny/denyList.ts
|
|
4538
|
-
import
|
|
4565
|
+
import chalk56 from "chalk";
|
|
4539
4566
|
function denyList() {
|
|
4540
4567
|
const config = loadConfig();
|
|
4541
4568
|
const deny = config.deny;
|
|
4542
4569
|
if (!deny || deny.length === 0) {
|
|
4543
|
-
console.log(
|
|
4570
|
+
console.log(chalk56.dim("No deny rules configured."));
|
|
4544
4571
|
return;
|
|
4545
4572
|
}
|
|
4546
4573
|
for (const rule of deny) {
|
|
4547
|
-
console.log(`${
|
|
4574
|
+
console.log(`${chalk56.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4548
4575
|
}
|
|
4549
4576
|
}
|
|
4550
4577
|
|
|
4551
4578
|
// src/commands/deny/denyRemove.ts
|
|
4552
|
-
import
|
|
4579
|
+
import chalk57 from "chalk";
|
|
4553
4580
|
function denyRemove(pattern2) {
|
|
4554
4581
|
const config = loadProjectConfig();
|
|
4555
4582
|
const deny = config.deny ?? [];
|
|
4556
4583
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4557
4584
|
if (index === -1) {
|
|
4558
|
-
console.log(
|
|
4585
|
+
console.log(chalk57.yellow(`No deny rule found for: ${pattern2}`));
|
|
4559
4586
|
return;
|
|
4560
4587
|
}
|
|
4561
4588
|
deny.splice(index, 1);
|
|
4562
4589
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4563
4590
|
saveConfig(config);
|
|
4564
|
-
console.log(
|
|
4591
|
+
console.log(chalk57.green(`Removed deny rule: ${pattern2}`));
|
|
4565
4592
|
}
|
|
4566
4593
|
|
|
4567
4594
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4611,11 +4638,11 @@ function assertCliExists(cli) {
|
|
|
4611
4638
|
}
|
|
4612
4639
|
|
|
4613
4640
|
// src/commands/permitCliReads/colorize.ts
|
|
4614
|
-
import
|
|
4641
|
+
import chalk58 from "chalk";
|
|
4615
4642
|
function colorize(plainOutput) {
|
|
4616
4643
|
return plainOutput.split("\n").map((line) => {
|
|
4617
|
-
if (line.startsWith(" R ")) return
|
|
4618
|
-
if (line.startsWith(" W ")) return
|
|
4644
|
+
if (line.startsWith(" R ")) return chalk58.green(line);
|
|
4645
|
+
if (line.startsWith(" W ")) return chalk58.red(line);
|
|
4619
4646
|
return line;
|
|
4620
4647
|
}).join("\n");
|
|
4621
4648
|
}
|
|
@@ -4933,15 +4960,15 @@ function registerCliHook(program2) {
|
|
|
4933
4960
|
}
|
|
4934
4961
|
|
|
4935
4962
|
// src/commands/complexity/analyze.ts
|
|
4936
|
-
import
|
|
4963
|
+
import chalk64 from "chalk";
|
|
4937
4964
|
|
|
4938
4965
|
// src/commands/complexity/cyclomatic.ts
|
|
4939
|
-
import
|
|
4966
|
+
import chalk60 from "chalk";
|
|
4940
4967
|
|
|
4941
4968
|
// src/commands/complexity/shared/index.ts
|
|
4942
4969
|
import fs12 from "fs";
|
|
4943
4970
|
import path20 from "path";
|
|
4944
|
-
import
|
|
4971
|
+
import chalk59 from "chalk";
|
|
4945
4972
|
import ts5 from "typescript";
|
|
4946
4973
|
|
|
4947
4974
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5187,7 +5214,7 @@ function createSourceFromFile(filePath) {
|
|
|
5187
5214
|
function withSourceFiles(pattern2, callback) {
|
|
5188
5215
|
const files = findSourceFiles2(pattern2);
|
|
5189
5216
|
if (files.length === 0) {
|
|
5190
|
-
console.log(
|
|
5217
|
+
console.log(chalk59.yellow("No files found matching pattern"));
|
|
5191
5218
|
return void 0;
|
|
5192
5219
|
}
|
|
5193
5220
|
return callback(files);
|
|
@@ -5220,11 +5247,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5220
5247
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5221
5248
|
for (const { file, name, complexity } of results) {
|
|
5222
5249
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5223
|
-
const color = exceedsThreshold ?
|
|
5224
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5250
|
+
const color = exceedsThreshold ? chalk60.red : chalk60.white;
|
|
5251
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk60.cyan(complexity)}`);
|
|
5225
5252
|
}
|
|
5226
5253
|
console.log(
|
|
5227
|
-
|
|
5254
|
+
chalk60.dim(
|
|
5228
5255
|
`
|
|
5229
5256
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5230
5257
|
)
|
|
@@ -5236,7 +5263,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5236
5263
|
}
|
|
5237
5264
|
|
|
5238
5265
|
// src/commands/complexity/halstead.ts
|
|
5239
|
-
import
|
|
5266
|
+
import chalk61 from "chalk";
|
|
5240
5267
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5241
5268
|
withSourceFiles(pattern2, (files) => {
|
|
5242
5269
|
const results = [];
|
|
@@ -5251,13 +5278,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5251
5278
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5252
5279
|
for (const { file, name, metrics } of results) {
|
|
5253
5280
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5254
|
-
const color = exceedsThreshold ?
|
|
5281
|
+
const color = exceedsThreshold ? chalk61.red : chalk61.white;
|
|
5255
5282
|
console.log(
|
|
5256
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5283
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk61.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk61.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk61.magenta(metrics.effort.toFixed(1))}`
|
|
5257
5284
|
);
|
|
5258
5285
|
}
|
|
5259
5286
|
console.log(
|
|
5260
|
-
|
|
5287
|
+
chalk61.dim(
|
|
5261
5288
|
`
|
|
5262
5289
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5263
5290
|
)
|
|
@@ -5272,28 +5299,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5272
5299
|
import fs13 from "fs";
|
|
5273
5300
|
|
|
5274
5301
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5275
|
-
import
|
|
5302
|
+
import chalk62 from "chalk";
|
|
5276
5303
|
function displayMaintainabilityResults(results, threshold) {
|
|
5277
5304
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5278
5305
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5279
|
-
console.log(
|
|
5306
|
+
console.log(chalk62.green("All files pass maintainability threshold"));
|
|
5280
5307
|
} else {
|
|
5281
5308
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5282
|
-
const color = threshold !== void 0 ?
|
|
5309
|
+
const color = threshold !== void 0 ? chalk62.red : chalk62.white;
|
|
5283
5310
|
console.log(
|
|
5284
|
-
`${color(file)} \u2192 avg: ${
|
|
5311
|
+
`${color(file)} \u2192 avg: ${chalk62.cyan(avgMaintainability.toFixed(1))}, min: ${chalk62.yellow(minMaintainability.toFixed(1))}`
|
|
5285
5312
|
);
|
|
5286
5313
|
}
|
|
5287
5314
|
}
|
|
5288
|
-
console.log(
|
|
5315
|
+
console.log(chalk62.dim(`
|
|
5289
5316
|
Analyzed ${results.length} files`));
|
|
5290
5317
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5291
5318
|
console.error(
|
|
5292
|
-
|
|
5319
|
+
chalk62.red(
|
|
5293
5320
|
`
|
|
5294
5321
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5295
5322
|
|
|
5296
|
-
\u26A0\uFE0F ${
|
|
5323
|
+
\u26A0\uFE0F ${chalk62.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.`
|
|
5297
5324
|
)
|
|
5298
5325
|
);
|
|
5299
5326
|
process.exit(1);
|
|
@@ -5350,7 +5377,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5350
5377
|
|
|
5351
5378
|
// src/commands/complexity/sloc.ts
|
|
5352
5379
|
import fs14 from "fs";
|
|
5353
|
-
import
|
|
5380
|
+
import chalk63 from "chalk";
|
|
5354
5381
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5355
5382
|
withSourceFiles(pattern2, (files) => {
|
|
5356
5383
|
const results = [];
|
|
@@ -5366,12 +5393,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5366
5393
|
results.sort((a, b) => b.lines - a.lines);
|
|
5367
5394
|
for (const { file, lines } of results) {
|
|
5368
5395
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5369
|
-
const color = exceedsThreshold ?
|
|
5370
|
-
console.log(`${color(file)} \u2192 ${
|
|
5396
|
+
const color = exceedsThreshold ? chalk63.red : chalk63.white;
|
|
5397
|
+
console.log(`${color(file)} \u2192 ${chalk63.cyan(lines)} lines`);
|
|
5371
5398
|
}
|
|
5372
5399
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5373
5400
|
console.log(
|
|
5374
|
-
|
|
5401
|
+
chalk63.dim(`
|
|
5375
5402
|
Total: ${total} lines across ${files.length} files`)
|
|
5376
5403
|
);
|
|
5377
5404
|
if (hasViolation) {
|
|
@@ -5385,21 +5412,21 @@ async function analyze(pattern2) {
|
|
|
5385
5412
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5386
5413
|
const files = findSourceFiles2(searchPattern);
|
|
5387
5414
|
if (files.length === 0) {
|
|
5388
|
-
console.log(
|
|
5415
|
+
console.log(chalk64.yellow("No files found matching pattern"));
|
|
5389
5416
|
return;
|
|
5390
5417
|
}
|
|
5391
5418
|
if (files.length === 1) {
|
|
5392
5419
|
const file = files[0];
|
|
5393
|
-
console.log(
|
|
5420
|
+
console.log(chalk64.bold.underline("SLOC"));
|
|
5394
5421
|
await sloc(file);
|
|
5395
5422
|
console.log();
|
|
5396
|
-
console.log(
|
|
5423
|
+
console.log(chalk64.bold.underline("Cyclomatic Complexity"));
|
|
5397
5424
|
await cyclomatic(file);
|
|
5398
5425
|
console.log();
|
|
5399
|
-
console.log(
|
|
5426
|
+
console.log(chalk64.bold.underline("Halstead Metrics"));
|
|
5400
5427
|
await halstead(file);
|
|
5401
5428
|
console.log();
|
|
5402
|
-
console.log(
|
|
5429
|
+
console.log(chalk64.bold.underline("Maintainability Index"));
|
|
5403
5430
|
await maintainability(file);
|
|
5404
5431
|
return;
|
|
5405
5432
|
}
|
|
@@ -5427,7 +5454,7 @@ function registerComplexity(program2) {
|
|
|
5427
5454
|
|
|
5428
5455
|
// src/commands/deploy/redirect.ts
|
|
5429
5456
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
5430
|
-
import
|
|
5457
|
+
import chalk65 from "chalk";
|
|
5431
5458
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5432
5459
|
if (!window.location.pathname.endsWith('/')) {
|
|
5433
5460
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5436,22 +5463,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5436
5463
|
function redirect() {
|
|
5437
5464
|
const indexPath = "index.html";
|
|
5438
5465
|
if (!existsSync24(indexPath)) {
|
|
5439
|
-
console.log(
|
|
5466
|
+
console.log(chalk65.yellow("No index.html found"));
|
|
5440
5467
|
return;
|
|
5441
5468
|
}
|
|
5442
5469
|
const content = readFileSync20(indexPath, "utf-8");
|
|
5443
5470
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5444
|
-
console.log(
|
|
5471
|
+
console.log(chalk65.dim("Trailing slash script already present"));
|
|
5445
5472
|
return;
|
|
5446
5473
|
}
|
|
5447
5474
|
const headCloseIndex = content.indexOf("</head>");
|
|
5448
5475
|
if (headCloseIndex === -1) {
|
|
5449
|
-
console.log(
|
|
5476
|
+
console.log(chalk65.red("Could not find </head> tag in index.html"));
|
|
5450
5477
|
return;
|
|
5451
5478
|
}
|
|
5452
5479
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5453
5480
|
writeFileSync17(indexPath, newContent);
|
|
5454
|
-
console.log(
|
|
5481
|
+
console.log(chalk65.green("Added trailing slash redirect to index.html"));
|
|
5455
5482
|
}
|
|
5456
5483
|
|
|
5457
5484
|
// src/commands/registerDeploy.ts
|
|
@@ -5478,7 +5505,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5478
5505
|
|
|
5479
5506
|
// src/commands/devlog/shared.ts
|
|
5480
5507
|
import { execSync as execSync17 } from "child_process";
|
|
5481
|
-
import
|
|
5508
|
+
import chalk66 from "chalk";
|
|
5482
5509
|
|
|
5483
5510
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5484
5511
|
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
@@ -5565,13 +5592,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5565
5592
|
}
|
|
5566
5593
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5567
5594
|
for (const commit2 of commits) {
|
|
5568
|
-
console.log(` ${
|
|
5595
|
+
console.log(` ${chalk66.yellow(commit2.hash)} ${commit2.message}`);
|
|
5569
5596
|
if (verbose) {
|
|
5570
5597
|
const visibleFiles = commit2.files.filter(
|
|
5571
5598
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5572
5599
|
);
|
|
5573
5600
|
for (const file of visibleFiles) {
|
|
5574
|
-
console.log(` ${
|
|
5601
|
+
console.log(` ${chalk66.dim(file)}`);
|
|
5575
5602
|
}
|
|
5576
5603
|
}
|
|
5577
5604
|
}
|
|
@@ -5596,15 +5623,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5596
5623
|
}
|
|
5597
5624
|
|
|
5598
5625
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5599
|
-
import
|
|
5626
|
+
import chalk67 from "chalk";
|
|
5600
5627
|
function printDateHeader(date, isSkipped, entries) {
|
|
5601
5628
|
if (isSkipped) {
|
|
5602
|
-
console.log(`${
|
|
5629
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.dim("skipped")}`);
|
|
5603
5630
|
} else if (entries && entries.length > 0) {
|
|
5604
|
-
const entryInfo = entries.map((e) => `${
|
|
5605
|
-
console.log(`${
|
|
5631
|
+
const entryInfo = entries.map((e) => `${chalk67.green(e.version)} ${e.title}`).join(" | ");
|
|
5632
|
+
console.log(`${chalk67.bold.blue(date)} ${entryInfo}`);
|
|
5606
5633
|
} else {
|
|
5607
|
-
console.log(`${
|
|
5634
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.red("\u26A0 devlog missing")}`);
|
|
5608
5635
|
}
|
|
5609
5636
|
}
|
|
5610
5637
|
|
|
@@ -5708,24 +5735,24 @@ function bumpVersion(version2, type) {
|
|
|
5708
5735
|
|
|
5709
5736
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5710
5737
|
import { execSync as execSync20 } from "child_process";
|
|
5711
|
-
import
|
|
5738
|
+
import chalk69 from "chalk";
|
|
5712
5739
|
|
|
5713
5740
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5714
|
-
import
|
|
5741
|
+
import chalk68 from "chalk";
|
|
5715
5742
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5716
5743
|
if (conventional && firstHash) {
|
|
5717
5744
|
const version2 = getVersionAtCommit(firstHash);
|
|
5718
5745
|
if (version2) {
|
|
5719
|
-
console.log(`${
|
|
5746
|
+
console.log(`${chalk68.bold("version:")} ${stripToMinor(version2)}`);
|
|
5720
5747
|
} else {
|
|
5721
|
-
console.log(`${
|
|
5748
|
+
console.log(`${chalk68.bold("version:")} ${chalk68.red("unknown")}`);
|
|
5722
5749
|
}
|
|
5723
5750
|
} else if (patchVersion && minorVersion) {
|
|
5724
5751
|
console.log(
|
|
5725
|
-
`${
|
|
5752
|
+
`${chalk68.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5726
5753
|
);
|
|
5727
5754
|
} else {
|
|
5728
|
-
console.log(`${
|
|
5755
|
+
console.log(`${chalk68.bold("version:")} v0.1 (initial)`);
|
|
5729
5756
|
}
|
|
5730
5757
|
}
|
|
5731
5758
|
|
|
@@ -5772,16 +5799,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5772
5799
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5773
5800
|
}
|
|
5774
5801
|
function logName(repoName) {
|
|
5775
|
-
console.log(`${
|
|
5802
|
+
console.log(`${chalk69.bold("name:")} ${repoName}`);
|
|
5776
5803
|
}
|
|
5777
5804
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5778
5805
|
logName(ctx.repoName);
|
|
5779
5806
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5780
|
-
console.log(
|
|
5807
|
+
console.log(chalk69.bold.blue(targetDate));
|
|
5781
5808
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5782
5809
|
}
|
|
5783
5810
|
function logNoCommits(lastInfo) {
|
|
5784
|
-
console.log(
|
|
5811
|
+
console.log(chalk69.dim(noCommitsMessage(!!lastInfo)));
|
|
5785
5812
|
}
|
|
5786
5813
|
|
|
5787
5814
|
// src/commands/devlog/next/index.ts
|
|
@@ -5822,11 +5849,11 @@ function next2(options2) {
|
|
|
5822
5849
|
import { execSync as execSync21 } from "child_process";
|
|
5823
5850
|
|
|
5824
5851
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5825
|
-
import
|
|
5852
|
+
import chalk70 from "chalk";
|
|
5826
5853
|
function colorStatus(status2) {
|
|
5827
|
-
if (status2 === "missing") return
|
|
5828
|
-
if (status2 === "outdated") return
|
|
5829
|
-
return
|
|
5854
|
+
if (status2 === "missing") return chalk70.red(status2);
|
|
5855
|
+
if (status2 === "outdated") return chalk70.yellow(status2);
|
|
5856
|
+
return chalk70.green(status2);
|
|
5830
5857
|
}
|
|
5831
5858
|
function formatRow(row, nameWidth) {
|
|
5832
5859
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5840,8 +5867,8 @@ function printReposTable(rows) {
|
|
|
5840
5867
|
"Last Devlog".padEnd(11),
|
|
5841
5868
|
"Status"
|
|
5842
5869
|
].join(" ");
|
|
5843
|
-
console.log(
|
|
5844
|
-
console.log(
|
|
5870
|
+
console.log(chalk70.dim(header));
|
|
5871
|
+
console.log(chalk70.dim("-".repeat(header.length)));
|
|
5845
5872
|
for (const row of rows) {
|
|
5846
5873
|
console.log(formatRow(row, nameWidth));
|
|
5847
5874
|
}
|
|
@@ -5899,14 +5926,14 @@ function repos(options2) {
|
|
|
5899
5926
|
// src/commands/devlog/skip.ts
|
|
5900
5927
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5901
5928
|
import { join as join20 } from "path";
|
|
5902
|
-
import
|
|
5929
|
+
import chalk71 from "chalk";
|
|
5903
5930
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5904
5931
|
function getBlogConfigPath() {
|
|
5905
5932
|
return join20(BLOG_REPO_ROOT, "assist.yml");
|
|
5906
5933
|
}
|
|
5907
5934
|
function skip(date) {
|
|
5908
5935
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5909
|
-
console.log(
|
|
5936
|
+
console.log(chalk71.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5910
5937
|
process.exit(1);
|
|
5911
5938
|
}
|
|
5912
5939
|
const repoName = getRepoName();
|
|
@@ -5917,7 +5944,7 @@ function skip(date) {
|
|
|
5917
5944
|
const skipDays = skip2[repoName] ?? [];
|
|
5918
5945
|
if (skipDays.includes(date)) {
|
|
5919
5946
|
console.log(
|
|
5920
|
-
|
|
5947
|
+
chalk71.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5921
5948
|
);
|
|
5922
5949
|
return;
|
|
5923
5950
|
}
|
|
@@ -5927,20 +5954,20 @@ function skip(date) {
|
|
|
5927
5954
|
devlog.skip = skip2;
|
|
5928
5955
|
config.devlog = devlog;
|
|
5929
5956
|
writeFileSync18(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
5930
|
-
console.log(
|
|
5957
|
+
console.log(chalk71.green(`Added ${date} to skip list for ${repoName}`));
|
|
5931
5958
|
}
|
|
5932
5959
|
|
|
5933
5960
|
// src/commands/devlog/version.ts
|
|
5934
|
-
import
|
|
5961
|
+
import chalk72 from "chalk";
|
|
5935
5962
|
function version() {
|
|
5936
5963
|
const config = loadConfig();
|
|
5937
5964
|
const name = getRepoName();
|
|
5938
5965
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5939
5966
|
const lastVersion = lastInfo?.version ?? null;
|
|
5940
5967
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5941
|
-
console.log(`${
|
|
5942
|
-
console.log(`${
|
|
5943
|
-
console.log(`${
|
|
5968
|
+
console.log(`${chalk72.bold("name:")} ${name}`);
|
|
5969
|
+
console.log(`${chalk72.bold("last:")} ${lastVersion ?? chalk72.dim("none")}`);
|
|
5970
|
+
console.log(`${chalk72.bold("next:")} ${nextVersion ?? chalk72.dim("none")}`);
|
|
5944
5971
|
}
|
|
5945
5972
|
|
|
5946
5973
|
// src/commands/registerDevlog.ts
|
|
@@ -5964,7 +5991,7 @@ function registerDevlog(program2) {
|
|
|
5964
5991
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5965
5992
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5966
5993
|
import { join as join21 } from "path";
|
|
5967
|
-
import
|
|
5994
|
+
import chalk73 from "chalk";
|
|
5968
5995
|
|
|
5969
5996
|
// src/shared/findRepoRoot.ts
|
|
5970
5997
|
import { existsSync as existsSync25 } from "fs";
|
|
@@ -6027,14 +6054,14 @@ function checkBuildLocks(startDir) {
|
|
|
6027
6054
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6028
6055
|
if (locked) {
|
|
6029
6056
|
console.error(
|
|
6030
|
-
|
|
6057
|
+
chalk73.red("Build output locked (is VS debugging?): ") + locked
|
|
6031
6058
|
);
|
|
6032
6059
|
process.exit(1);
|
|
6033
6060
|
}
|
|
6034
6061
|
}
|
|
6035
6062
|
async function checkBuildLocksCommand() {
|
|
6036
6063
|
checkBuildLocks();
|
|
6037
|
-
console.log(
|
|
6064
|
+
console.log(chalk73.green("No build locks detected"));
|
|
6038
6065
|
}
|
|
6039
6066
|
|
|
6040
6067
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6133,30 +6160,30 @@ function escapeRegex(s) {
|
|
|
6133
6160
|
}
|
|
6134
6161
|
|
|
6135
6162
|
// src/commands/dotnet/printTree.ts
|
|
6136
|
-
import
|
|
6163
|
+
import chalk74 from "chalk";
|
|
6137
6164
|
function printNodes(nodes, prefix2) {
|
|
6138
6165
|
for (let i = 0; i < nodes.length; i++) {
|
|
6139
6166
|
const isLast = i === nodes.length - 1;
|
|
6140
6167
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6141
6168
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6142
6169
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6143
|
-
const label2 = isMissing ?
|
|
6170
|
+
const label2 = isMissing ? chalk74.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6144
6171
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6145
6172
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6146
6173
|
}
|
|
6147
6174
|
}
|
|
6148
6175
|
function printTree(tree, totalCount, solutions) {
|
|
6149
|
-
console.log(
|
|
6150
|
-
console.log(
|
|
6176
|
+
console.log(chalk74.bold("\nProject Dependency Tree"));
|
|
6177
|
+
console.log(chalk74.cyan(tree.relativePath));
|
|
6151
6178
|
printNodes(tree.children, "");
|
|
6152
|
-
console.log(
|
|
6179
|
+
console.log(chalk74.dim(`
|
|
6153
6180
|
${totalCount} projects total (including root)`));
|
|
6154
|
-
console.log(
|
|
6181
|
+
console.log(chalk74.bold("\nSolution Membership"));
|
|
6155
6182
|
if (solutions.length === 0) {
|
|
6156
|
-
console.log(
|
|
6183
|
+
console.log(chalk74.yellow(" Not found in any .sln"));
|
|
6157
6184
|
} else {
|
|
6158
6185
|
for (const sln of solutions) {
|
|
6159
|
-
console.log(` ${
|
|
6186
|
+
console.log(` ${chalk74.green(sln)}`);
|
|
6160
6187
|
}
|
|
6161
6188
|
}
|
|
6162
6189
|
console.log();
|
|
@@ -6185,16 +6212,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6185
6212
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6186
6213
|
import { existsSync as existsSync26 } from "fs";
|
|
6187
6214
|
import path24 from "path";
|
|
6188
|
-
import
|
|
6215
|
+
import chalk75 from "chalk";
|
|
6189
6216
|
function resolveCsproj(csprojPath) {
|
|
6190
6217
|
const resolved = path24.resolve(csprojPath);
|
|
6191
6218
|
if (!existsSync26(resolved)) {
|
|
6192
|
-
console.error(
|
|
6219
|
+
console.error(chalk75.red(`File not found: ${resolved}`));
|
|
6193
6220
|
process.exit(1);
|
|
6194
6221
|
}
|
|
6195
6222
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6196
6223
|
if (!repoRoot) {
|
|
6197
|
-
console.error(
|
|
6224
|
+
console.error(chalk75.red("Could not find git repository root"));
|
|
6198
6225
|
process.exit(1);
|
|
6199
6226
|
}
|
|
6200
6227
|
return { resolved, repoRoot };
|
|
@@ -6244,12 +6271,12 @@ function getChangedCsFiles(scope) {
|
|
|
6244
6271
|
}
|
|
6245
6272
|
|
|
6246
6273
|
// src/commands/dotnet/inSln.ts
|
|
6247
|
-
import
|
|
6274
|
+
import chalk76 from "chalk";
|
|
6248
6275
|
async function inSln(csprojPath) {
|
|
6249
6276
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6250
6277
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6251
6278
|
if (solutions.length === 0) {
|
|
6252
|
-
console.log(
|
|
6279
|
+
console.log(chalk76.yellow("Not found in any .sln file"));
|
|
6253
6280
|
process.exit(1);
|
|
6254
6281
|
}
|
|
6255
6282
|
for (const sln of solutions) {
|
|
@@ -6258,7 +6285,7 @@ async function inSln(csprojPath) {
|
|
|
6258
6285
|
}
|
|
6259
6286
|
|
|
6260
6287
|
// src/commands/dotnet/inspect.ts
|
|
6261
|
-
import
|
|
6288
|
+
import chalk82 from "chalk";
|
|
6262
6289
|
|
|
6263
6290
|
// src/shared/formatElapsed.ts
|
|
6264
6291
|
function formatElapsed(ms) {
|
|
@@ -6270,12 +6297,12 @@ function formatElapsed(ms) {
|
|
|
6270
6297
|
}
|
|
6271
6298
|
|
|
6272
6299
|
// src/commands/dotnet/displayIssues.ts
|
|
6273
|
-
import
|
|
6300
|
+
import chalk77 from "chalk";
|
|
6274
6301
|
var SEVERITY_COLOR = {
|
|
6275
|
-
ERROR:
|
|
6276
|
-
WARNING:
|
|
6277
|
-
SUGGESTION:
|
|
6278
|
-
HINT:
|
|
6302
|
+
ERROR: chalk77.red,
|
|
6303
|
+
WARNING: chalk77.yellow,
|
|
6304
|
+
SUGGESTION: chalk77.cyan,
|
|
6305
|
+
HINT: chalk77.dim
|
|
6279
6306
|
};
|
|
6280
6307
|
function groupByFile(issues) {
|
|
6281
6308
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6291,15 +6318,15 @@ function groupByFile(issues) {
|
|
|
6291
6318
|
}
|
|
6292
6319
|
function displayIssues(issues) {
|
|
6293
6320
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6294
|
-
console.log(
|
|
6321
|
+
console.log(chalk77.bold(file));
|
|
6295
6322
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6296
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6323
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk77.white;
|
|
6297
6324
|
console.log(
|
|
6298
|
-
` ${
|
|
6325
|
+
` ${chalk77.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6299
6326
|
);
|
|
6300
6327
|
}
|
|
6301
6328
|
}
|
|
6302
|
-
console.log(
|
|
6329
|
+
console.log(chalk77.dim(`
|
|
6303
6330
|
${issues.length} issue(s) found`));
|
|
6304
6331
|
}
|
|
6305
6332
|
|
|
@@ -6358,12 +6385,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6358
6385
|
// src/commands/dotnet/resolveSolution.ts
|
|
6359
6386
|
import { existsSync as existsSync27 } from "fs";
|
|
6360
6387
|
import path25 from "path";
|
|
6361
|
-
import
|
|
6388
|
+
import chalk79 from "chalk";
|
|
6362
6389
|
|
|
6363
6390
|
// src/commands/dotnet/findSolution.ts
|
|
6364
6391
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6365
6392
|
import { dirname as dirname16, join as join22 } from "path";
|
|
6366
|
-
import
|
|
6393
|
+
import chalk78 from "chalk";
|
|
6367
6394
|
function findSlnInDir(dir) {
|
|
6368
6395
|
try {
|
|
6369
6396
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join22(dir, f));
|
|
@@ -6379,17 +6406,17 @@ function findSolution() {
|
|
|
6379
6406
|
const slnFiles = findSlnInDir(current);
|
|
6380
6407
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6381
6408
|
if (slnFiles.length > 1) {
|
|
6382
|
-
console.error(
|
|
6409
|
+
console.error(chalk78.red(`Multiple .sln files found in ${current}:`));
|
|
6383
6410
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6384
6411
|
console.error(
|
|
6385
|
-
|
|
6412
|
+
chalk78.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6386
6413
|
);
|
|
6387
6414
|
process.exit(1);
|
|
6388
6415
|
}
|
|
6389
6416
|
if (current === ceiling) break;
|
|
6390
6417
|
current = dirname16(current);
|
|
6391
6418
|
}
|
|
6392
|
-
console.error(
|
|
6419
|
+
console.error(chalk78.red("No .sln file found between cwd and repo root"));
|
|
6393
6420
|
process.exit(1);
|
|
6394
6421
|
}
|
|
6395
6422
|
|
|
@@ -6398,7 +6425,7 @@ function resolveSolution(sln) {
|
|
|
6398
6425
|
if (sln) {
|
|
6399
6426
|
const resolved = path25.resolve(sln);
|
|
6400
6427
|
if (!existsSync27(resolved)) {
|
|
6401
|
-
console.error(
|
|
6428
|
+
console.error(chalk79.red(`Solution file not found: ${resolved}`));
|
|
6402
6429
|
process.exit(1);
|
|
6403
6430
|
}
|
|
6404
6431
|
return resolved;
|
|
@@ -6440,14 +6467,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6440
6467
|
import { existsSync as existsSync28, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6441
6468
|
import { tmpdir as tmpdir2 } from "os";
|
|
6442
6469
|
import path26 from "path";
|
|
6443
|
-
import
|
|
6470
|
+
import chalk80 from "chalk";
|
|
6444
6471
|
function assertJbInstalled() {
|
|
6445
6472
|
try {
|
|
6446
6473
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6447
6474
|
} catch {
|
|
6448
|
-
console.error(
|
|
6475
|
+
console.error(chalk80.red("jb is not installed. Install with:"));
|
|
6449
6476
|
console.error(
|
|
6450
|
-
|
|
6477
|
+
chalk80.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6451
6478
|
);
|
|
6452
6479
|
process.exit(1);
|
|
6453
6480
|
}
|
|
@@ -6465,11 +6492,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6465
6492
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6466
6493
|
process.stderr.write(err.stderr);
|
|
6467
6494
|
}
|
|
6468
|
-
console.error(
|
|
6495
|
+
console.error(chalk80.red("jb inspectcode failed"));
|
|
6469
6496
|
process.exit(1);
|
|
6470
6497
|
}
|
|
6471
6498
|
if (!existsSync28(reportPath)) {
|
|
6472
|
-
console.error(
|
|
6499
|
+
console.error(chalk80.red("Report file not generated"));
|
|
6473
6500
|
process.exit(1);
|
|
6474
6501
|
}
|
|
6475
6502
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6479,7 +6506,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6479
6506
|
|
|
6480
6507
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6481
6508
|
import { execSync as execSync24 } from "child_process";
|
|
6482
|
-
import
|
|
6509
|
+
import chalk81 from "chalk";
|
|
6483
6510
|
function resolveMsbuildPath() {
|
|
6484
6511
|
const config = loadConfig();
|
|
6485
6512
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6490,9 +6517,9 @@ function assertMsbuildInstalled() {
|
|
|
6490
6517
|
try {
|
|
6491
6518
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6492
6519
|
} catch {
|
|
6493
|
-
console.error(
|
|
6520
|
+
console.error(chalk81.red(`msbuild not found at: ${msbuild}`));
|
|
6494
6521
|
console.error(
|
|
6495
|
-
|
|
6522
|
+
chalk81.yellow(
|
|
6496
6523
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6497
6524
|
)
|
|
6498
6525
|
);
|
|
@@ -6539,17 +6566,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6539
6566
|
// src/commands/dotnet/inspect.ts
|
|
6540
6567
|
function logScope(changedFiles) {
|
|
6541
6568
|
if (changedFiles === null) {
|
|
6542
|
-
console.log(
|
|
6569
|
+
console.log(chalk82.dim("Inspecting full solution..."));
|
|
6543
6570
|
} else {
|
|
6544
6571
|
console.log(
|
|
6545
|
-
|
|
6572
|
+
chalk82.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6546
6573
|
);
|
|
6547
6574
|
}
|
|
6548
6575
|
}
|
|
6549
6576
|
function reportResults(issues, elapsed) {
|
|
6550
6577
|
if (issues.length > 0) displayIssues(issues);
|
|
6551
|
-
else console.log(
|
|
6552
|
-
console.log(
|
|
6578
|
+
else console.log(chalk82.green("No issues found"));
|
|
6579
|
+
console.log(chalk82.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6553
6580
|
if (issues.length > 0) process.exit(1);
|
|
6554
6581
|
}
|
|
6555
6582
|
async function inspect(sln, options2) {
|
|
@@ -6560,7 +6587,7 @@ async function inspect(sln, options2) {
|
|
|
6560
6587
|
const scope = parseScope(options2.scope);
|
|
6561
6588
|
const changedFiles = getChangedCsFiles(scope);
|
|
6562
6589
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6563
|
-
console.log(
|
|
6590
|
+
console.log(chalk82.green("No changed .cs files found"));
|
|
6564
6591
|
return;
|
|
6565
6592
|
}
|
|
6566
6593
|
logScope(changedFiles);
|
|
@@ -6586,7 +6613,7 @@ function registerDotnet(program2) {
|
|
|
6586
6613
|
}
|
|
6587
6614
|
|
|
6588
6615
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6589
|
-
import
|
|
6616
|
+
import chalk84 from "chalk";
|
|
6590
6617
|
|
|
6591
6618
|
// src/commands/jira/adfToText.ts
|
|
6592
6619
|
function renderInline(node) {
|
|
@@ -6647,7 +6674,7 @@ function adfToText(doc) {
|
|
|
6647
6674
|
|
|
6648
6675
|
// src/commands/jira/fetchIssue.ts
|
|
6649
6676
|
import { execSync as execSync25 } from "child_process";
|
|
6650
|
-
import
|
|
6677
|
+
import chalk83 from "chalk";
|
|
6651
6678
|
function fetchIssue(issueKey, fields) {
|
|
6652
6679
|
let result;
|
|
6653
6680
|
try {
|
|
@@ -6660,15 +6687,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6660
6687
|
const stderr = error.stderr;
|
|
6661
6688
|
if (stderr.includes("unauthorized")) {
|
|
6662
6689
|
console.error(
|
|
6663
|
-
|
|
6690
|
+
chalk83.red("Jira authentication expired."),
|
|
6664
6691
|
"Run",
|
|
6665
|
-
|
|
6692
|
+
chalk83.cyan("assist jira auth"),
|
|
6666
6693
|
"to re-authenticate."
|
|
6667
6694
|
);
|
|
6668
6695
|
process.exit(1);
|
|
6669
6696
|
}
|
|
6670
6697
|
}
|
|
6671
|
-
console.error(
|
|
6698
|
+
console.error(chalk83.red(`Failed to fetch ${issueKey}.`));
|
|
6672
6699
|
process.exit(1);
|
|
6673
6700
|
}
|
|
6674
6701
|
return JSON.parse(result);
|
|
@@ -6682,7 +6709,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6682
6709
|
const parsed = fetchIssue(issueKey, field);
|
|
6683
6710
|
const acValue = parsed?.fields?.[field];
|
|
6684
6711
|
if (!acValue) {
|
|
6685
|
-
console.log(
|
|
6712
|
+
console.log(chalk84.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6686
6713
|
return;
|
|
6687
6714
|
}
|
|
6688
6715
|
if (typeof acValue === "string") {
|
|
@@ -6777,14 +6804,14 @@ async function jiraAuth() {
|
|
|
6777
6804
|
}
|
|
6778
6805
|
|
|
6779
6806
|
// src/commands/jira/viewIssue.ts
|
|
6780
|
-
import
|
|
6807
|
+
import chalk85 from "chalk";
|
|
6781
6808
|
function viewIssue(issueKey) {
|
|
6782
6809
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6783
6810
|
const fields = parsed?.fields;
|
|
6784
6811
|
const summary = fields?.summary;
|
|
6785
6812
|
const description = fields?.description;
|
|
6786
6813
|
if (summary) {
|
|
6787
|
-
console.log(
|
|
6814
|
+
console.log(chalk85.bold(summary));
|
|
6788
6815
|
}
|
|
6789
6816
|
if (description) {
|
|
6790
6817
|
if (summary) console.log();
|
|
@@ -6798,7 +6825,7 @@ function viewIssue(issueKey) {
|
|
|
6798
6825
|
}
|
|
6799
6826
|
if (!summary && !description) {
|
|
6800
6827
|
console.log(
|
|
6801
|
-
|
|
6828
|
+
chalk85.yellow(`No summary or description found on ${issueKey}.`)
|
|
6802
6829
|
);
|
|
6803
6830
|
}
|
|
6804
6831
|
}
|
|
@@ -6812,7 +6839,7 @@ function registerJira(program2) {
|
|
|
6812
6839
|
}
|
|
6813
6840
|
|
|
6814
6841
|
// src/commands/news/add/index.ts
|
|
6815
|
-
import
|
|
6842
|
+
import chalk86 from "chalk";
|
|
6816
6843
|
import enquirer7 from "enquirer";
|
|
6817
6844
|
async function add2(url) {
|
|
6818
6845
|
if (!url) {
|
|
@@ -6835,17 +6862,17 @@ async function add2(url) {
|
|
|
6835
6862
|
const news = config.news ?? {};
|
|
6836
6863
|
const feeds = news.feeds ?? [];
|
|
6837
6864
|
if (feeds.includes(url)) {
|
|
6838
|
-
console.log(
|
|
6865
|
+
console.log(chalk86.yellow("Feed already exists in config"));
|
|
6839
6866
|
return;
|
|
6840
6867
|
}
|
|
6841
6868
|
feeds.push(url);
|
|
6842
6869
|
config.news = { ...news, feeds };
|
|
6843
6870
|
saveGlobalConfig(config);
|
|
6844
|
-
console.log(
|
|
6871
|
+
console.log(chalk86.green(`Added feed: ${url}`));
|
|
6845
6872
|
}
|
|
6846
6873
|
|
|
6847
6874
|
// src/commands/news/web/handleRequest.ts
|
|
6848
|
-
import
|
|
6875
|
+
import chalk87 from "chalk";
|
|
6849
6876
|
|
|
6850
6877
|
// src/commands/news/web/shared.ts
|
|
6851
6878
|
import { decodeHTML } from "entities";
|
|
@@ -6981,17 +7008,17 @@ function prefetch() {
|
|
|
6981
7008
|
const config = loadConfig();
|
|
6982
7009
|
const total = config.news.feeds.length;
|
|
6983
7010
|
if (total === 0) return;
|
|
6984
|
-
process.stdout.write(
|
|
7011
|
+
process.stdout.write(chalk87.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6985
7012
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6986
7013
|
const width = 20;
|
|
6987
7014
|
const filled = Math.round(done2 / t * width);
|
|
6988
7015
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6989
7016
|
process.stdout.write(
|
|
6990
|
-
`\r${
|
|
7017
|
+
`\r${chalk87.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6991
7018
|
);
|
|
6992
7019
|
}).then((items) => {
|
|
6993
7020
|
process.stdout.write(
|
|
6994
|
-
`\r${
|
|
7021
|
+
`\r${chalk87.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6995
7022
|
`
|
|
6996
7023
|
);
|
|
6997
7024
|
cachedItems = items;
|
|
@@ -7352,20 +7379,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7352
7379
|
}
|
|
7353
7380
|
|
|
7354
7381
|
// src/commands/prs/listComments/printComments.ts
|
|
7355
|
-
import
|
|
7382
|
+
import chalk88 from "chalk";
|
|
7356
7383
|
function formatForHuman(comment3) {
|
|
7357
7384
|
if (comment3.type === "review") {
|
|
7358
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7385
|
+
const stateColor = comment3.state === "APPROVED" ? chalk88.green : comment3.state === "CHANGES_REQUESTED" ? chalk88.red : chalk88.yellow;
|
|
7359
7386
|
return [
|
|
7360
|
-
`${
|
|
7387
|
+
`${chalk88.cyan("Review")} by ${chalk88.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7361
7388
|
comment3.body,
|
|
7362
7389
|
""
|
|
7363
7390
|
].join("\n");
|
|
7364
7391
|
}
|
|
7365
7392
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7366
7393
|
return [
|
|
7367
|
-
`${
|
|
7368
|
-
|
|
7394
|
+
`${chalk88.cyan("Line comment")} by ${chalk88.bold(comment3.user)} on ${chalk88.dim(`${comment3.path}${location}`)}`,
|
|
7395
|
+
chalk88.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7369
7396
|
comment3.body,
|
|
7370
7397
|
""
|
|
7371
7398
|
].join("\n");
|
|
@@ -7455,13 +7482,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7455
7482
|
import enquirer8 from "enquirer";
|
|
7456
7483
|
|
|
7457
7484
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7458
|
-
import
|
|
7485
|
+
import chalk89 from "chalk";
|
|
7459
7486
|
var STATUS_MAP = {
|
|
7460
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7461
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
7487
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk89.magenta("merged"), date: pr.mergedAt } : null,
|
|
7488
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk89.red("closed"), date: pr.closedAt } : null
|
|
7462
7489
|
};
|
|
7463
7490
|
function defaultStatus(pr) {
|
|
7464
|
-
return { label:
|
|
7491
|
+
return { label: chalk89.green("opened"), date: pr.createdAt };
|
|
7465
7492
|
}
|
|
7466
7493
|
function getStatus2(pr) {
|
|
7467
7494
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7470,11 +7497,11 @@ function formatDate(dateStr) {
|
|
|
7470
7497
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7471
7498
|
}
|
|
7472
7499
|
function formatPrHeader(pr, status2) {
|
|
7473
|
-
return `${
|
|
7500
|
+
return `${chalk89.cyan(`#${pr.number}`)} ${pr.title} ${chalk89.dim(`(${pr.author.login},`)} ${status2.label} ${chalk89.dim(`${formatDate(status2.date)})`)}`;
|
|
7474
7501
|
}
|
|
7475
7502
|
function logPrDetails(pr) {
|
|
7476
7503
|
console.log(
|
|
7477
|
-
|
|
7504
|
+
chalk89.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7478
7505
|
);
|
|
7479
7506
|
console.log();
|
|
7480
7507
|
}
|
|
@@ -7640,10 +7667,10 @@ function registerPrs(program2) {
|
|
|
7640
7667
|
}
|
|
7641
7668
|
|
|
7642
7669
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7643
|
-
import
|
|
7670
|
+
import chalk95 from "chalk";
|
|
7644
7671
|
|
|
7645
7672
|
// src/shared/createConnectionAuth.ts
|
|
7646
|
-
import
|
|
7673
|
+
import chalk90 from "chalk";
|
|
7647
7674
|
function listConnections(connections, format2) {
|
|
7648
7675
|
if (connections.length === 0) {
|
|
7649
7676
|
console.log("No connections configured.");
|
|
@@ -7656,7 +7683,7 @@ function listConnections(connections, format2) {
|
|
|
7656
7683
|
function removeConnection(connections, name, save) {
|
|
7657
7684
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7658
7685
|
if (filtered.length === connections.length) {
|
|
7659
|
-
console.error(
|
|
7686
|
+
console.error(chalk90.red(`Connection "${name}" not found.`));
|
|
7660
7687
|
process.exit(1);
|
|
7661
7688
|
}
|
|
7662
7689
|
save(filtered);
|
|
@@ -7702,15 +7729,15 @@ function saveConnections(connections) {
|
|
|
7702
7729
|
}
|
|
7703
7730
|
|
|
7704
7731
|
// src/commands/ravendb/promptConnection.ts
|
|
7705
|
-
import
|
|
7732
|
+
import chalk93 from "chalk";
|
|
7706
7733
|
|
|
7707
7734
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7708
|
-
import
|
|
7735
|
+
import chalk92 from "chalk";
|
|
7709
7736
|
import Enquirer2 from "enquirer";
|
|
7710
7737
|
|
|
7711
7738
|
// src/commands/ravendb/searchItems.ts
|
|
7712
7739
|
import { execSync as execSync34 } from "child_process";
|
|
7713
|
-
import
|
|
7740
|
+
import chalk91 from "chalk";
|
|
7714
7741
|
function opExec(args) {
|
|
7715
7742
|
return execSync34(`op ${args}`, {
|
|
7716
7743
|
encoding: "utf-8",
|
|
@@ -7723,7 +7750,7 @@ function searchItems(search) {
|
|
|
7723
7750
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7724
7751
|
} catch {
|
|
7725
7752
|
console.error(
|
|
7726
|
-
|
|
7753
|
+
chalk91.red(
|
|
7727
7754
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7728
7755
|
)
|
|
7729
7756
|
);
|
|
@@ -7737,7 +7764,7 @@ function getItemFields(itemId) {
|
|
|
7737
7764
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7738
7765
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7739
7766
|
} catch {
|
|
7740
|
-
console.error(
|
|
7767
|
+
console.error(chalk91.red("Failed to get item details from 1Password."));
|
|
7741
7768
|
process.exit(1);
|
|
7742
7769
|
}
|
|
7743
7770
|
}
|
|
@@ -7756,7 +7783,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7756
7783
|
}).run();
|
|
7757
7784
|
const items = searchItems(search);
|
|
7758
7785
|
if (items.length === 0) {
|
|
7759
|
-
console.error(
|
|
7786
|
+
console.error(chalk92.red(`No items found matching "${search}".`));
|
|
7760
7787
|
process.exit(1);
|
|
7761
7788
|
}
|
|
7762
7789
|
const itemId = await selectOne(
|
|
@@ -7765,7 +7792,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7765
7792
|
);
|
|
7766
7793
|
const fields = getItemFields(itemId);
|
|
7767
7794
|
if (fields.length === 0) {
|
|
7768
|
-
console.error(
|
|
7795
|
+
console.error(chalk92.red("No fields with references found on this item."));
|
|
7769
7796
|
process.exit(1);
|
|
7770
7797
|
}
|
|
7771
7798
|
const ref = await selectOne(
|
|
@@ -7779,7 +7806,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7779
7806
|
async function promptConnection(existingNames) {
|
|
7780
7807
|
const name = await promptInput("name", "Connection name:");
|
|
7781
7808
|
if (existingNames.includes(name)) {
|
|
7782
|
-
console.error(
|
|
7809
|
+
console.error(chalk93.red(`Connection "${name}" already exists.`));
|
|
7783
7810
|
process.exit(1);
|
|
7784
7811
|
}
|
|
7785
7812
|
const url = await promptInput(
|
|
@@ -7788,22 +7815,22 @@ async function promptConnection(existingNames) {
|
|
|
7788
7815
|
);
|
|
7789
7816
|
const database = await promptInput("database", "Database name:");
|
|
7790
7817
|
if (!name || !url || !database) {
|
|
7791
|
-
console.error(
|
|
7818
|
+
console.error(chalk93.red("All fields are required."));
|
|
7792
7819
|
process.exit(1);
|
|
7793
7820
|
}
|
|
7794
7821
|
const apiKeyRef = await selectOpSecret();
|
|
7795
|
-
console.log(
|
|
7822
|
+
console.log(chalk93.dim(`Using: ${apiKeyRef}`));
|
|
7796
7823
|
return { name, url, database, apiKeyRef };
|
|
7797
7824
|
}
|
|
7798
7825
|
|
|
7799
7826
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7800
|
-
import
|
|
7827
|
+
import chalk94 from "chalk";
|
|
7801
7828
|
function ravendbSetConnection(name) {
|
|
7802
7829
|
const raw = loadGlobalConfigRaw();
|
|
7803
7830
|
const ravendb = raw.ravendb ?? {};
|
|
7804
7831
|
const connections = ravendb.connections ?? [];
|
|
7805
7832
|
if (!connections.some((c) => c.name === name)) {
|
|
7806
|
-
console.error(
|
|
7833
|
+
console.error(chalk94.red(`Connection "${name}" not found.`));
|
|
7807
7834
|
console.error(
|
|
7808
7835
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7809
7836
|
);
|
|
@@ -7819,16 +7846,16 @@ function ravendbSetConnection(name) {
|
|
|
7819
7846
|
var ravendbAuth = createConnectionAuth({
|
|
7820
7847
|
load: loadConnections,
|
|
7821
7848
|
save: saveConnections,
|
|
7822
|
-
format: (c) => `${
|
|
7849
|
+
format: (c) => `${chalk95.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7823
7850
|
promptNew: promptConnection,
|
|
7824
7851
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7825
7852
|
});
|
|
7826
7853
|
|
|
7827
7854
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7828
|
-
import
|
|
7855
|
+
import chalk99 from "chalk";
|
|
7829
7856
|
|
|
7830
7857
|
// src/commands/ravendb/ravenFetch.ts
|
|
7831
|
-
import
|
|
7858
|
+
import chalk97 from "chalk";
|
|
7832
7859
|
|
|
7833
7860
|
// src/commands/ravendb/getAccessToken.ts
|
|
7834
7861
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7865,10 +7892,10 @@ ${errorText}`
|
|
|
7865
7892
|
|
|
7866
7893
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7867
7894
|
import { execSync as execSync35 } from "child_process";
|
|
7868
|
-
import
|
|
7895
|
+
import chalk96 from "chalk";
|
|
7869
7896
|
function resolveOpSecret(reference) {
|
|
7870
7897
|
if (!reference.startsWith("op://")) {
|
|
7871
|
-
console.error(
|
|
7898
|
+
console.error(chalk96.red(`Invalid secret reference: must start with op://`));
|
|
7872
7899
|
process.exit(1);
|
|
7873
7900
|
}
|
|
7874
7901
|
try {
|
|
@@ -7878,7 +7905,7 @@ function resolveOpSecret(reference) {
|
|
|
7878
7905
|
}).trim();
|
|
7879
7906
|
} catch {
|
|
7880
7907
|
console.error(
|
|
7881
|
-
|
|
7908
|
+
chalk96.red(
|
|
7882
7909
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7883
7910
|
)
|
|
7884
7911
|
);
|
|
@@ -7905,7 +7932,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7905
7932
|
if (!response.ok) {
|
|
7906
7933
|
const body = await response.text();
|
|
7907
7934
|
console.error(
|
|
7908
|
-
|
|
7935
|
+
chalk97.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7909
7936
|
);
|
|
7910
7937
|
console.error(body.substring(0, 500));
|
|
7911
7938
|
process.exit(1);
|
|
@@ -7914,7 +7941,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7914
7941
|
}
|
|
7915
7942
|
|
|
7916
7943
|
// src/commands/ravendb/resolveConnection.ts
|
|
7917
|
-
import
|
|
7944
|
+
import chalk98 from "chalk";
|
|
7918
7945
|
function loadRavendb() {
|
|
7919
7946
|
const raw = loadGlobalConfigRaw();
|
|
7920
7947
|
const ravendb = raw.ravendb;
|
|
@@ -7928,7 +7955,7 @@ function resolveConnection(name) {
|
|
|
7928
7955
|
const connectionName = name ?? defaultConnection;
|
|
7929
7956
|
if (!connectionName) {
|
|
7930
7957
|
console.error(
|
|
7931
|
-
|
|
7958
|
+
chalk98.red(
|
|
7932
7959
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7933
7960
|
)
|
|
7934
7961
|
);
|
|
@@ -7936,7 +7963,7 @@ function resolveConnection(name) {
|
|
|
7936
7963
|
}
|
|
7937
7964
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7938
7965
|
if (!connection) {
|
|
7939
|
-
console.error(
|
|
7966
|
+
console.error(chalk98.red(`Connection "${connectionName}" not found.`));
|
|
7940
7967
|
console.error(
|
|
7941
7968
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7942
7969
|
);
|
|
@@ -7967,15 +7994,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7967
7994
|
return;
|
|
7968
7995
|
}
|
|
7969
7996
|
for (const c of collections) {
|
|
7970
|
-
console.log(`${
|
|
7997
|
+
console.log(`${chalk99.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7971
7998
|
}
|
|
7972
7999
|
}
|
|
7973
8000
|
|
|
7974
8001
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7975
|
-
import
|
|
8002
|
+
import chalk101 from "chalk";
|
|
7976
8003
|
|
|
7977
8004
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7978
|
-
import
|
|
8005
|
+
import chalk100 from "chalk";
|
|
7979
8006
|
|
|
7980
8007
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7981
8008
|
function buildQueryPath(opts) {
|
|
@@ -8013,7 +8040,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8013
8040
|
allResults.push(...results);
|
|
8014
8041
|
start3 += results.length;
|
|
8015
8042
|
process.stderr.write(
|
|
8016
|
-
`\r${
|
|
8043
|
+
`\r${chalk100.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8017
8044
|
);
|
|
8018
8045
|
if (start3 >= totalResults) break;
|
|
8019
8046
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8028,7 +8055,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8028
8055
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8029
8056
|
const resolved = resolveArgs(connectionName, collection);
|
|
8030
8057
|
if (!resolved.collection && !options2.query) {
|
|
8031
|
-
console.error(
|
|
8058
|
+
console.error(chalk101.red("Provide a collection name or --query filter."));
|
|
8032
8059
|
process.exit(1);
|
|
8033
8060
|
}
|
|
8034
8061
|
const { collection: col } = resolved;
|
|
@@ -8066,7 +8093,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8066
8093
|
import * as path27 from "path";
|
|
8067
8094
|
|
|
8068
8095
|
// src/commands/refactor/logViolations.ts
|
|
8069
|
-
import
|
|
8096
|
+
import chalk102 from "chalk";
|
|
8070
8097
|
var DEFAULT_MAX_LINES = 100;
|
|
8071
8098
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8072
8099
|
if (violations.length === 0) {
|
|
@@ -8075,43 +8102,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8075
8102
|
}
|
|
8076
8103
|
return;
|
|
8077
8104
|
}
|
|
8078
|
-
console.error(
|
|
8105
|
+
console.error(chalk102.red(`
|
|
8079
8106
|
Refactor check failed:
|
|
8080
8107
|
`));
|
|
8081
|
-
console.error(
|
|
8108
|
+
console.error(chalk102.red(` The following files exceed ${maxLines} lines:
|
|
8082
8109
|
`));
|
|
8083
8110
|
for (const violation of violations) {
|
|
8084
|
-
console.error(
|
|
8111
|
+
console.error(chalk102.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8085
8112
|
}
|
|
8086
8113
|
console.error(
|
|
8087
|
-
|
|
8114
|
+
chalk102.yellow(
|
|
8088
8115
|
`
|
|
8089
8116
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8090
8117
|
way to refactor it, ignore it with:
|
|
8091
8118
|
`
|
|
8092
8119
|
)
|
|
8093
8120
|
);
|
|
8094
|
-
console.error(
|
|
8121
|
+
console.error(chalk102.gray(` assist refactor ignore <file>
|
|
8095
8122
|
`));
|
|
8096
8123
|
if (process.env.CLAUDECODE) {
|
|
8097
|
-
console.error(
|
|
8124
|
+
console.error(chalk102.cyan(`
|
|
8098
8125
|
## Extracting Code to New Files
|
|
8099
8126
|
`));
|
|
8100
8127
|
console.error(
|
|
8101
|
-
|
|
8128
|
+
chalk102.cyan(
|
|
8102
8129
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8103
8130
|
`
|
|
8104
8131
|
)
|
|
8105
8132
|
);
|
|
8106
8133
|
console.error(
|
|
8107
|
-
|
|
8134
|
+
chalk102.cyan(
|
|
8108
8135
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8109
8136
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8110
8137
|
`
|
|
8111
8138
|
)
|
|
8112
8139
|
);
|
|
8113
8140
|
console.error(
|
|
8114
|
-
|
|
8141
|
+
chalk102.cyan(
|
|
8115
8142
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8116
8143
|
domains, move it to a common/shared folder.
|
|
8117
8144
|
`
|
|
@@ -8267,7 +8294,7 @@ async function check(pattern2, options2) {
|
|
|
8267
8294
|
|
|
8268
8295
|
// src/commands/refactor/extract/index.ts
|
|
8269
8296
|
import path33 from "path";
|
|
8270
|
-
import
|
|
8297
|
+
import chalk105 from "chalk";
|
|
8271
8298
|
|
|
8272
8299
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8273
8300
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8814,23 +8841,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8814
8841
|
|
|
8815
8842
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8816
8843
|
import path31 from "path";
|
|
8817
|
-
import
|
|
8844
|
+
import chalk103 from "chalk";
|
|
8818
8845
|
function section(title) {
|
|
8819
8846
|
return `
|
|
8820
|
-
${
|
|
8847
|
+
${chalk103.cyan(title)}`;
|
|
8821
8848
|
}
|
|
8822
8849
|
function displayImporters(plan2, cwd) {
|
|
8823
8850
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8824
8851
|
console.log(section("Update importers:"));
|
|
8825
8852
|
for (const imp of plan2.importersToUpdate) {
|
|
8826
8853
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8827
|
-
console.log(` ${
|
|
8854
|
+
console.log(` ${chalk103.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8828
8855
|
}
|
|
8829
8856
|
}
|
|
8830
8857
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8831
|
-
console.log(
|
|
8858
|
+
console.log(chalk103.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8832
8859
|
`));
|
|
8833
|
-
console.log(` ${
|
|
8860
|
+
console.log(` ${chalk103.cyan("Functions to move:")}`);
|
|
8834
8861
|
for (const name of plan2.extractedNames) {
|
|
8835
8862
|
console.log(` ${name}`);
|
|
8836
8863
|
}
|
|
@@ -8865,7 +8892,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8865
8892
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8866
8893
|
import fs17 from "fs";
|
|
8867
8894
|
import path32 from "path";
|
|
8868
|
-
import
|
|
8895
|
+
import chalk104 from "chalk";
|
|
8869
8896
|
import { Project as Project2 } from "ts-morph";
|
|
8870
8897
|
function findTsConfig(sourcePath) {
|
|
8871
8898
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8896,7 +8923,7 @@ function loadProjectFile(file) {
|
|
|
8896
8923
|
});
|
|
8897
8924
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8898
8925
|
if (!sourceFile) {
|
|
8899
|
-
console.log(
|
|
8926
|
+
console.log(chalk104.red(`File not found in project: ${file}`));
|
|
8900
8927
|
process.exit(1);
|
|
8901
8928
|
}
|
|
8902
8929
|
return { project, sourceFile };
|
|
@@ -8919,19 +8946,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8919
8946
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8920
8947
|
if (options2.apply) {
|
|
8921
8948
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8922
|
-
console.log(
|
|
8949
|
+
console.log(chalk105.green("\nExtraction complete"));
|
|
8923
8950
|
} else {
|
|
8924
|
-
console.log(
|
|
8951
|
+
console.log(chalk105.dim("\nDry run. Use --apply to execute."));
|
|
8925
8952
|
}
|
|
8926
8953
|
}
|
|
8927
8954
|
|
|
8928
8955
|
// src/commands/refactor/ignore.ts
|
|
8929
8956
|
import fs18 from "fs";
|
|
8930
|
-
import
|
|
8957
|
+
import chalk106 from "chalk";
|
|
8931
8958
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8932
8959
|
function ignore(file) {
|
|
8933
8960
|
if (!fs18.existsSync(file)) {
|
|
8934
|
-
console.error(
|
|
8961
|
+
console.error(chalk106.red(`Error: File does not exist: ${file}`));
|
|
8935
8962
|
process.exit(1);
|
|
8936
8963
|
}
|
|
8937
8964
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8947,7 +8974,7 @@ function ignore(file) {
|
|
|
8947
8974
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8948
8975
|
}
|
|
8949
8976
|
console.log(
|
|
8950
|
-
|
|
8977
|
+
chalk106.green(
|
|
8951
8978
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8952
8979
|
)
|
|
8953
8980
|
);
|
|
@@ -8955,26 +8982,26 @@ function ignore(file) {
|
|
|
8955
8982
|
|
|
8956
8983
|
// src/commands/refactor/rename/index.ts
|
|
8957
8984
|
import path34 from "path";
|
|
8958
|
-
import
|
|
8985
|
+
import chalk107 from "chalk";
|
|
8959
8986
|
async function rename(source, destination, options2 = {}) {
|
|
8960
8987
|
const destPath = path34.resolve(destination);
|
|
8961
8988
|
const cwd = process.cwd();
|
|
8962
8989
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8963
8990
|
const relDest = path34.relative(cwd, destPath);
|
|
8964
8991
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8965
|
-
console.log(
|
|
8992
|
+
console.log(chalk107.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8966
8993
|
if (options2.apply) {
|
|
8967
8994
|
sourceFile.move(destPath);
|
|
8968
8995
|
await project.save();
|
|
8969
|
-
console.log(
|
|
8996
|
+
console.log(chalk107.green("Done"));
|
|
8970
8997
|
} else {
|
|
8971
|
-
console.log(
|
|
8998
|
+
console.log(chalk107.dim("Dry run. Use --apply to execute."));
|
|
8972
8999
|
}
|
|
8973
9000
|
}
|
|
8974
9001
|
|
|
8975
9002
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8976
9003
|
import path36 from "path";
|
|
8977
|
-
import
|
|
9004
|
+
import chalk108 from "chalk";
|
|
8978
9005
|
import { Project as Project3 } from "ts-morph";
|
|
8979
9006
|
|
|
8980
9007
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9023,38 +9050,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9023
9050
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9024
9051
|
const sourceFile = project.getSourceFile(filePath);
|
|
9025
9052
|
if (!sourceFile) {
|
|
9026
|
-
console.log(
|
|
9053
|
+
console.log(chalk108.red(`File not found in project: ${file}`));
|
|
9027
9054
|
process.exit(1);
|
|
9028
9055
|
}
|
|
9029
9056
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9030
9057
|
if (!symbol) {
|
|
9031
|
-
console.log(
|
|
9058
|
+
console.log(chalk108.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9032
9059
|
process.exit(1);
|
|
9033
9060
|
}
|
|
9034
9061
|
const grouped = groupReferences(symbol, cwd);
|
|
9035
9062
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9036
9063
|
console.log(
|
|
9037
|
-
|
|
9064
|
+
chalk108.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9038
9065
|
`)
|
|
9039
9066
|
);
|
|
9040
9067
|
for (const [refFile, lines] of grouped) {
|
|
9041
9068
|
console.log(
|
|
9042
|
-
` ${
|
|
9069
|
+
` ${chalk108.dim(refFile)}: lines ${chalk108.cyan(lines.join(", "))}`
|
|
9043
9070
|
);
|
|
9044
9071
|
}
|
|
9045
9072
|
if (options2.apply) {
|
|
9046
9073
|
symbol.rename(newName);
|
|
9047
9074
|
await project.save();
|
|
9048
|
-
console.log(
|
|
9075
|
+
console.log(chalk108.green(`
|
|
9049
9076
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9050
9077
|
} else {
|
|
9051
|
-
console.log(
|
|
9078
|
+
console.log(chalk108.dim("\nDry run. Use --apply to execute."));
|
|
9052
9079
|
}
|
|
9053
9080
|
}
|
|
9054
9081
|
|
|
9055
9082
|
// src/commands/refactor/restructure/index.ts
|
|
9056
9083
|
import path45 from "path";
|
|
9057
|
-
import
|
|
9084
|
+
import chalk111 from "chalk";
|
|
9058
9085
|
|
|
9059
9086
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9060
9087
|
import path37 from "path";
|
|
@@ -9297,50 +9324,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9297
9324
|
|
|
9298
9325
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9299
9326
|
import path41 from "path";
|
|
9300
|
-
import
|
|
9327
|
+
import chalk109 from "chalk";
|
|
9301
9328
|
function relPath(filePath) {
|
|
9302
9329
|
return path41.relative(process.cwd(), filePath);
|
|
9303
9330
|
}
|
|
9304
9331
|
function displayMoves(plan2) {
|
|
9305
9332
|
if (plan2.moves.length === 0) return;
|
|
9306
|
-
console.log(
|
|
9333
|
+
console.log(chalk109.bold("\nFile moves:"));
|
|
9307
9334
|
for (const move of plan2.moves) {
|
|
9308
9335
|
console.log(
|
|
9309
|
-
` ${
|
|
9336
|
+
` ${chalk109.red(relPath(move.from))} \u2192 ${chalk109.green(relPath(move.to))}`
|
|
9310
9337
|
);
|
|
9311
|
-
console.log(
|
|
9338
|
+
console.log(chalk109.dim(` ${move.reason}`));
|
|
9312
9339
|
}
|
|
9313
9340
|
}
|
|
9314
9341
|
function displayRewrites(rewrites) {
|
|
9315
9342
|
if (rewrites.length === 0) return;
|
|
9316
9343
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9317
|
-
console.log(
|
|
9344
|
+
console.log(chalk109.bold(`
|
|
9318
9345
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9319
9346
|
for (const file of affectedFiles) {
|
|
9320
|
-
console.log(` ${
|
|
9347
|
+
console.log(` ${chalk109.cyan(relPath(file))}:`);
|
|
9321
9348
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9322
9349
|
(r) => r.file === file
|
|
9323
9350
|
)) {
|
|
9324
9351
|
console.log(
|
|
9325
|
-
` ${
|
|
9352
|
+
` ${chalk109.red(`"${oldSpecifier}"`)} \u2192 ${chalk109.green(`"${newSpecifier}"`)}`
|
|
9326
9353
|
);
|
|
9327
9354
|
}
|
|
9328
9355
|
}
|
|
9329
9356
|
}
|
|
9330
9357
|
function displayPlan2(plan2) {
|
|
9331
9358
|
if (plan2.warnings.length > 0) {
|
|
9332
|
-
console.log(
|
|
9333
|
-
for (const w of plan2.warnings) console.log(
|
|
9359
|
+
console.log(chalk109.yellow("\nWarnings:"));
|
|
9360
|
+
for (const w of plan2.warnings) console.log(chalk109.yellow(` ${w}`));
|
|
9334
9361
|
}
|
|
9335
9362
|
if (plan2.newDirectories.length > 0) {
|
|
9336
|
-
console.log(
|
|
9363
|
+
console.log(chalk109.bold("\nNew directories:"));
|
|
9337
9364
|
for (const dir of plan2.newDirectories)
|
|
9338
|
-
console.log(
|
|
9365
|
+
console.log(chalk109.green(` ${dir}/`));
|
|
9339
9366
|
}
|
|
9340
9367
|
displayMoves(plan2);
|
|
9341
9368
|
displayRewrites(plan2.rewrites);
|
|
9342
9369
|
console.log(
|
|
9343
|
-
|
|
9370
|
+
chalk109.dim(
|
|
9344
9371
|
`
|
|
9345
9372
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9346
9373
|
)
|
|
@@ -9350,18 +9377,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9350
9377
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9351
9378
|
import fs20 from "fs";
|
|
9352
9379
|
import path42 from "path";
|
|
9353
|
-
import
|
|
9380
|
+
import chalk110 from "chalk";
|
|
9354
9381
|
function executePlan(plan2) {
|
|
9355
9382
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9356
9383
|
for (const [file, content] of updatedContents) {
|
|
9357
9384
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9358
9385
|
console.log(
|
|
9359
|
-
|
|
9386
|
+
chalk110.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9360
9387
|
);
|
|
9361
9388
|
}
|
|
9362
9389
|
for (const dir of plan2.newDirectories) {
|
|
9363
9390
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9364
|
-
console.log(
|
|
9391
|
+
console.log(chalk110.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9365
9392
|
}
|
|
9366
9393
|
for (const move of plan2.moves) {
|
|
9367
9394
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9370,7 +9397,7 @@ function executePlan(plan2) {
|
|
|
9370
9397
|
}
|
|
9371
9398
|
fs20.renameSync(move.from, move.to);
|
|
9372
9399
|
console.log(
|
|
9373
|
-
|
|
9400
|
+
chalk110.white(
|
|
9374
9401
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9375
9402
|
)
|
|
9376
9403
|
);
|
|
@@ -9385,7 +9412,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9385
9412
|
if (entries.length === 0) {
|
|
9386
9413
|
fs20.rmdirSync(dir);
|
|
9387
9414
|
console.log(
|
|
9388
|
-
|
|
9415
|
+
chalk110.dim(
|
|
9389
9416
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9390
9417
|
)
|
|
9391
9418
|
);
|
|
@@ -9518,22 +9545,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9518
9545
|
const targetPattern = pattern2 ?? "src";
|
|
9519
9546
|
const files = findSourceFiles2(targetPattern);
|
|
9520
9547
|
if (files.length === 0) {
|
|
9521
|
-
console.log(
|
|
9548
|
+
console.log(chalk111.yellow("No files found matching pattern"));
|
|
9522
9549
|
return;
|
|
9523
9550
|
}
|
|
9524
9551
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9525
9552
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9526
9553
|
if (plan2.moves.length === 0) {
|
|
9527
|
-
console.log(
|
|
9554
|
+
console.log(chalk111.green("No restructuring needed"));
|
|
9528
9555
|
return;
|
|
9529
9556
|
}
|
|
9530
9557
|
displayPlan2(plan2);
|
|
9531
9558
|
if (options2.apply) {
|
|
9532
|
-
console.log(
|
|
9559
|
+
console.log(chalk111.bold("\nApplying changes..."));
|
|
9533
9560
|
executePlan(plan2);
|
|
9534
|
-
console.log(
|
|
9561
|
+
console.log(chalk111.green("\nRestructuring complete"));
|
|
9535
9562
|
} else {
|
|
9536
|
-
console.log(
|
|
9563
|
+
console.log(chalk111.dim("\nDry run. Use --apply to execute."));
|
|
9537
9564
|
}
|
|
9538
9565
|
}
|
|
9539
9566
|
|
|
@@ -9573,7 +9600,7 @@ function registerRefactor(program2) {
|
|
|
9573
9600
|
}
|
|
9574
9601
|
|
|
9575
9602
|
// src/commands/seq/seqAuth.ts
|
|
9576
|
-
import
|
|
9603
|
+
import chalk113 from "chalk";
|
|
9577
9604
|
|
|
9578
9605
|
// src/commands/seq/loadConnections.ts
|
|
9579
9606
|
function loadConnections2() {
|
|
@@ -9602,11 +9629,11 @@ function setDefaultConnection(name) {
|
|
|
9602
9629
|
}
|
|
9603
9630
|
|
|
9604
9631
|
// src/commands/seq/promptConnection.ts
|
|
9605
|
-
import
|
|
9632
|
+
import chalk112 from "chalk";
|
|
9606
9633
|
async function promptConnection2(existingNames) {
|
|
9607
9634
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9608
9635
|
if (existingNames.includes(name)) {
|
|
9609
|
-
console.error(
|
|
9636
|
+
console.error(chalk112.red(`Connection "${name}" already exists.`));
|
|
9610
9637
|
process.exit(1);
|
|
9611
9638
|
}
|
|
9612
9639
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9618,16 +9645,16 @@ async function promptConnection2(existingNames) {
|
|
|
9618
9645
|
var seqAuth = createConnectionAuth({
|
|
9619
9646
|
load: loadConnections2,
|
|
9620
9647
|
save: saveConnections2,
|
|
9621
|
-
format: (c) => `${
|
|
9648
|
+
format: (c) => `${chalk113.bold(c.name)} ${c.url}`,
|
|
9622
9649
|
promptNew: promptConnection2,
|
|
9623
9650
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9624
9651
|
});
|
|
9625
9652
|
|
|
9626
9653
|
// src/commands/seq/seqQuery.ts
|
|
9627
|
-
import
|
|
9654
|
+
import chalk117 from "chalk";
|
|
9628
9655
|
|
|
9629
9656
|
// src/commands/seq/fetchSeq.ts
|
|
9630
|
-
import
|
|
9657
|
+
import chalk114 from "chalk";
|
|
9631
9658
|
async function fetchSeq(conn, path50, params) {
|
|
9632
9659
|
const url = `${conn.url}${path50}?${params}`;
|
|
9633
9660
|
const response = await fetch(url, {
|
|
@@ -9638,7 +9665,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9638
9665
|
});
|
|
9639
9666
|
if (!response.ok) {
|
|
9640
9667
|
const body = await response.text();
|
|
9641
|
-
console.error(
|
|
9668
|
+
console.error(chalk114.red(`Seq returned ${response.status}: ${body}`));
|
|
9642
9669
|
process.exit(1);
|
|
9643
9670
|
}
|
|
9644
9671
|
return response;
|
|
@@ -9691,23 +9718,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9691
9718
|
}
|
|
9692
9719
|
|
|
9693
9720
|
// src/commands/seq/formatEvent.ts
|
|
9694
|
-
import
|
|
9721
|
+
import chalk115 from "chalk";
|
|
9695
9722
|
function levelColor(level) {
|
|
9696
9723
|
switch (level) {
|
|
9697
9724
|
case "Fatal":
|
|
9698
|
-
return
|
|
9725
|
+
return chalk115.bgRed.white;
|
|
9699
9726
|
case "Error":
|
|
9700
|
-
return
|
|
9727
|
+
return chalk115.red;
|
|
9701
9728
|
case "Warning":
|
|
9702
|
-
return
|
|
9729
|
+
return chalk115.yellow;
|
|
9703
9730
|
case "Information":
|
|
9704
|
-
return
|
|
9731
|
+
return chalk115.cyan;
|
|
9705
9732
|
case "Debug":
|
|
9706
|
-
return
|
|
9733
|
+
return chalk115.gray;
|
|
9707
9734
|
case "Verbose":
|
|
9708
|
-
return
|
|
9735
|
+
return chalk115.dim;
|
|
9709
9736
|
default:
|
|
9710
|
-
return
|
|
9737
|
+
return chalk115.white;
|
|
9711
9738
|
}
|
|
9712
9739
|
}
|
|
9713
9740
|
function levelAbbrev(level) {
|
|
@@ -9748,31 +9775,31 @@ function formatTimestamp(iso) {
|
|
|
9748
9775
|
function formatEvent(event) {
|
|
9749
9776
|
const color = levelColor(event.Level);
|
|
9750
9777
|
const abbrev = levelAbbrev(event.Level);
|
|
9751
|
-
const ts8 =
|
|
9778
|
+
const ts8 = chalk115.dim(formatTimestamp(event.Timestamp));
|
|
9752
9779
|
const msg = renderMessage(event);
|
|
9753
9780
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9754
9781
|
if (event.Exception) {
|
|
9755
9782
|
for (const line of event.Exception.split("\n")) {
|
|
9756
|
-
lines.push(
|
|
9783
|
+
lines.push(chalk115.red(` ${line}`));
|
|
9757
9784
|
}
|
|
9758
9785
|
}
|
|
9759
9786
|
return lines.join("\n");
|
|
9760
9787
|
}
|
|
9761
9788
|
|
|
9762
9789
|
// src/commands/seq/resolveConnection.ts
|
|
9763
|
-
import
|
|
9790
|
+
import chalk116 from "chalk";
|
|
9764
9791
|
function resolveConnection2(name) {
|
|
9765
9792
|
const connections = loadConnections2();
|
|
9766
9793
|
if (connections.length === 0) {
|
|
9767
9794
|
console.error(
|
|
9768
|
-
|
|
9795
|
+
chalk116.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9769
9796
|
);
|
|
9770
9797
|
process.exit(1);
|
|
9771
9798
|
}
|
|
9772
9799
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9773
9800
|
const connection = connections.find((c) => c.name === target);
|
|
9774
9801
|
if (!connection) {
|
|
9775
|
-
console.error(
|
|
9802
|
+
console.error(chalk116.red(`Seq connection "${target}" not found.`));
|
|
9776
9803
|
process.exit(1);
|
|
9777
9804
|
}
|
|
9778
9805
|
return connection;
|
|
@@ -9787,7 +9814,7 @@ async function seqQuery(filter, options2) {
|
|
|
9787
9814
|
new URLSearchParams({ filter, count: String(count) })
|
|
9788
9815
|
);
|
|
9789
9816
|
if (events.length === 0) {
|
|
9790
|
-
console.log(
|
|
9817
|
+
console.log(chalk117.yellow("No events found."));
|
|
9791
9818
|
return;
|
|
9792
9819
|
}
|
|
9793
9820
|
if (options2.json) {
|
|
@@ -9798,11 +9825,11 @@ async function seqQuery(filter, options2) {
|
|
|
9798
9825
|
for (const event of chronological) {
|
|
9799
9826
|
console.log(formatEvent(event));
|
|
9800
9827
|
}
|
|
9801
|
-
console.log(
|
|
9828
|
+
console.log(chalk117.dim(`
|
|
9802
9829
|
${events.length} events`));
|
|
9803
9830
|
if (events.length >= count) {
|
|
9804
9831
|
console.log(
|
|
9805
|
-
|
|
9832
|
+
chalk117.yellow(
|
|
9806
9833
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9807
9834
|
)
|
|
9808
9835
|
);
|
|
@@ -9810,11 +9837,11 @@ ${events.length} events`));
|
|
|
9810
9837
|
}
|
|
9811
9838
|
|
|
9812
9839
|
// src/commands/seq/seqSetConnection.ts
|
|
9813
|
-
import
|
|
9840
|
+
import chalk118 from "chalk";
|
|
9814
9841
|
function seqSetConnection(name) {
|
|
9815
9842
|
const connections = loadConnections2();
|
|
9816
9843
|
if (!connections.find((c) => c.name === name)) {
|
|
9817
|
-
console.error(
|
|
9844
|
+
console.error(chalk118.red(`Connection "${name}" not found.`));
|
|
9818
9845
|
process.exit(1);
|
|
9819
9846
|
}
|
|
9820
9847
|
setDefaultConnection(name);
|
|
@@ -10353,14 +10380,14 @@ import {
|
|
|
10353
10380
|
import { dirname as dirname20, join as join33 } from "path";
|
|
10354
10381
|
|
|
10355
10382
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10356
|
-
import
|
|
10383
|
+
import chalk119 from "chalk";
|
|
10357
10384
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10358
10385
|
function validateStagedContent(filename, content) {
|
|
10359
10386
|
const firstLine = content.split("\n")[0];
|
|
10360
10387
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10361
10388
|
if (!match) {
|
|
10362
10389
|
console.error(
|
|
10363
|
-
|
|
10390
|
+
chalk119.red(
|
|
10364
10391
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10365
10392
|
)
|
|
10366
10393
|
);
|
|
@@ -10369,7 +10396,7 @@ function validateStagedContent(filename, content) {
|
|
|
10369
10396
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10370
10397
|
if (!contentAfterLink) {
|
|
10371
10398
|
console.error(
|
|
10372
|
-
|
|
10399
|
+
chalk119.red(
|
|
10373
10400
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10374
10401
|
)
|
|
10375
10402
|
);
|
|
@@ -10762,7 +10789,7 @@ function registerVoice(program2) {
|
|
|
10762
10789
|
|
|
10763
10790
|
// src/commands/roam/auth.ts
|
|
10764
10791
|
import { randomBytes } from "crypto";
|
|
10765
|
-
import
|
|
10792
|
+
import chalk120 from "chalk";
|
|
10766
10793
|
|
|
10767
10794
|
// src/lib/openBrowser.ts
|
|
10768
10795
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10937,13 +10964,13 @@ async function auth() {
|
|
|
10937
10964
|
saveGlobalConfig(config);
|
|
10938
10965
|
const state = randomBytes(16).toString("hex");
|
|
10939
10966
|
console.log(
|
|
10940
|
-
|
|
10967
|
+
chalk120.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10941
10968
|
);
|
|
10942
|
-
console.log(
|
|
10943
|
-
console.log(
|
|
10944
|
-
console.log(
|
|
10969
|
+
console.log(chalk120.white("http://localhost:14523/callback\n"));
|
|
10970
|
+
console.log(chalk120.blue("Opening browser for authorization..."));
|
|
10971
|
+
console.log(chalk120.dim("Waiting for authorization callback..."));
|
|
10945
10972
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10946
|
-
console.log(
|
|
10973
|
+
console.log(chalk120.dim("Exchanging code for tokens..."));
|
|
10947
10974
|
const tokens = await exchangeToken({
|
|
10948
10975
|
code,
|
|
10949
10976
|
clientId,
|
|
@@ -10959,7 +10986,7 @@ async function auth() {
|
|
|
10959
10986
|
};
|
|
10960
10987
|
saveGlobalConfig(config);
|
|
10961
10988
|
console.log(
|
|
10962
|
-
|
|
10989
|
+
chalk120.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10963
10990
|
);
|
|
10964
10991
|
}
|
|
10965
10992
|
|
|
@@ -11172,7 +11199,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11172
11199
|
import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11173
11200
|
import { tmpdir as tmpdir6 } from "os";
|
|
11174
11201
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11175
|
-
import
|
|
11202
|
+
import chalk121 from "chalk";
|
|
11176
11203
|
|
|
11177
11204
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11178
11205
|
var captureWindowPs1 = `
|
|
@@ -11323,22 +11350,22 @@ function screenshot(processName) {
|
|
|
11323
11350
|
const config = loadConfig();
|
|
11324
11351
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11325
11352
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11326
|
-
console.log(
|
|
11353
|
+
console.log(chalk121.gray(`Capturing window for process "${processName}" ...`));
|
|
11327
11354
|
try {
|
|
11328
11355
|
runPowerShellScript(processName, outputPath);
|
|
11329
|
-
console.log(
|
|
11356
|
+
console.log(chalk121.green(`Screenshot saved: ${outputPath}`));
|
|
11330
11357
|
} catch (error) {
|
|
11331
11358
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11332
|
-
console.error(
|
|
11359
|
+
console.error(chalk121.red(`Failed to capture screenshot: ${msg}`));
|
|
11333
11360
|
process.exit(1);
|
|
11334
11361
|
}
|
|
11335
11362
|
}
|
|
11336
11363
|
|
|
11337
11364
|
// src/commands/statusLine.ts
|
|
11338
|
-
import
|
|
11365
|
+
import chalk123 from "chalk";
|
|
11339
11366
|
|
|
11340
11367
|
// src/commands/buildLimitsSegment.ts
|
|
11341
|
-
import
|
|
11368
|
+
import chalk122 from "chalk";
|
|
11342
11369
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11343
11370
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11344
11371
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11361,10 +11388,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11361
11388
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11362
11389
|
const label2 = `${Math.round(pct)}%`;
|
|
11363
11390
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11364
|
-
if (projected == null) return
|
|
11365
|
-
if (projected > 100) return
|
|
11366
|
-
if (projected > 75) return
|
|
11367
|
-
return
|
|
11391
|
+
if (projected == null) return chalk122.green(label2);
|
|
11392
|
+
if (projected > 100) return chalk122.red(label2);
|
|
11393
|
+
if (projected > 75) return chalk122.yellow(label2);
|
|
11394
|
+
return chalk122.green(label2);
|
|
11368
11395
|
}
|
|
11369
11396
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11370
11397
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11390,14 +11417,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11390
11417
|
}
|
|
11391
11418
|
|
|
11392
11419
|
// src/commands/statusLine.ts
|
|
11393
|
-
|
|
11420
|
+
chalk123.level = 3;
|
|
11394
11421
|
function formatNumber(num) {
|
|
11395
11422
|
return num.toLocaleString("en-US");
|
|
11396
11423
|
}
|
|
11397
11424
|
function colorizePercent(pct) {
|
|
11398
11425
|
const label2 = `${Math.round(pct)}%`;
|
|
11399
|
-
if (pct > 80) return
|
|
11400
|
-
if (pct > 40) return
|
|
11426
|
+
if (pct > 80) return chalk123.red(label2);
|
|
11427
|
+
if (pct > 40) return chalk123.yellow(label2);
|
|
11401
11428
|
return label2;
|
|
11402
11429
|
}
|
|
11403
11430
|
async function statusLine() {
|
|
@@ -11420,7 +11447,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11420
11447
|
// src/commands/sync/syncClaudeMd.ts
|
|
11421
11448
|
import * as fs23 from "fs";
|
|
11422
11449
|
import * as path46 from "path";
|
|
11423
|
-
import
|
|
11450
|
+
import chalk124 from "chalk";
|
|
11424
11451
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11425
11452
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11426
11453
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11429,12 +11456,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11429
11456
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11430
11457
|
if (sourceContent !== targetContent) {
|
|
11431
11458
|
console.log(
|
|
11432
|
-
|
|
11459
|
+
chalk124.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11433
11460
|
);
|
|
11434
11461
|
console.log();
|
|
11435
11462
|
printDiff(targetContent, sourceContent);
|
|
11436
11463
|
const confirm = options2?.yes || await promptConfirm(
|
|
11437
|
-
|
|
11464
|
+
chalk124.red("Overwrite existing CLAUDE.md?"),
|
|
11438
11465
|
false
|
|
11439
11466
|
);
|
|
11440
11467
|
if (!confirm) {
|
|
@@ -11450,7 +11477,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11450
11477
|
// src/commands/sync/syncSettings.ts
|
|
11451
11478
|
import * as fs24 from "fs";
|
|
11452
11479
|
import * as path47 from "path";
|
|
11453
|
-
import
|
|
11480
|
+
import chalk125 from "chalk";
|
|
11454
11481
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11455
11482
|
const source = path47.join(claudeDir, "settings.json");
|
|
11456
11483
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11466,14 +11493,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11466
11493
|
if (mergedContent !== normalizedTarget) {
|
|
11467
11494
|
if (!options2?.yes) {
|
|
11468
11495
|
console.log(
|
|
11469
|
-
|
|
11496
|
+
chalk125.yellow(
|
|
11470
11497
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11471
11498
|
)
|
|
11472
11499
|
);
|
|
11473
11500
|
console.log();
|
|
11474
11501
|
printDiff(targetContent, mergedContent);
|
|
11475
11502
|
const confirm = await promptConfirm(
|
|
11476
|
-
|
|
11503
|
+
chalk125.red("Overwrite existing settings.json?"),
|
|
11477
11504
|
false
|
|
11478
11505
|
);
|
|
11479
11506
|
if (!confirm) {
|