@staff0rd/assist 0.171.1 → 0.172.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/README.md +1 -0
- package/dist/commands/backlog/web/bundle.js +1 -1
- package/dist/index.js +313 -292
- 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.0",
|
|
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) {
|
|
@@ -3896,7 +3898,8 @@ import { existsSync as existsSync20 } from "fs";
|
|
|
3896
3898
|
import chalk47 from "chalk";
|
|
3897
3899
|
function filterItems(items, options2) {
|
|
3898
3900
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3899
|
-
if (!options2.all)
|
|
3901
|
+
if (!options2.all)
|
|
3902
|
+
return items.filter((i) => i.status !== "done" && i.status !== "wontdo");
|
|
3900
3903
|
return items;
|
|
3901
3904
|
}
|
|
3902
3905
|
async function list2(options2) {
|
|
@@ -3926,7 +3929,10 @@ async function list2(options2) {
|
|
|
3926
3929
|
// src/commands/backlog/registerItemCommands.ts
|
|
3927
3930
|
function registerItemCommands(cmd) {
|
|
3928
3931
|
cmd.command("init").description("Create an empty assist.backlog.yml").action(init6);
|
|
3929
|
-
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
3932
|
+
cmd.command("list").alias("ls").description("List all backlog items").option(
|
|
3933
|
+
"--status <type>",
|
|
3934
|
+
"Filter by status (todo, in-progress, done, wontdo)"
|
|
3935
|
+
).option("-a, --all", "Include done/wontdo items").option("-v, --verbose", "Show all item details").action(list2);
|
|
3930
3936
|
cmd.command("add").description("Add a new backlog item").option("--file <path>", "Read item as JSON from a file").action(add);
|
|
3931
3937
|
}
|
|
3932
3938
|
|
|
@@ -4081,10 +4087,25 @@ async function start(id) {
|
|
|
4081
4087
|
}
|
|
4082
4088
|
}
|
|
4083
4089
|
|
|
4090
|
+
// src/commands/backlog/wontdo/index.ts
|
|
4091
|
+
import chalk54 from "chalk";
|
|
4092
|
+
async function wontdo(id, reason) {
|
|
4093
|
+
const result = loadAndFindItem(id);
|
|
4094
|
+
if (!result) return;
|
|
4095
|
+
result.item.status = "wontdo";
|
|
4096
|
+
if (reason) {
|
|
4097
|
+
const phase = result.item.currentPhase ?? 0;
|
|
4098
|
+
addPhaseSummary(result.item, reason, phase);
|
|
4099
|
+
}
|
|
4100
|
+
saveBacklog(result.items);
|
|
4101
|
+
console.log(chalk54.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4084
4104
|
// src/commands/backlog/registerStatusCommands.ts
|
|
4085
4105
|
function registerStatusCommands(cmd) {
|
|
4086
4106
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
4087
4107
|
cmd.command("done <id> [summary]").description("Set a backlog item to done").action(done);
|
|
4108
|
+
cmd.command("wontdo <id> [reason]").description("Set a backlog item to won't do").action(wontdo);
|
|
4088
4109
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
4089
4110
|
}
|
|
4090
4111
|
|
|
@@ -4520,48 +4541,48 @@ ${reasons.join("\n")}`);
|
|
|
4520
4541
|
}
|
|
4521
4542
|
|
|
4522
4543
|
// src/commands/deny/denyAdd.ts
|
|
4523
|
-
import
|
|
4544
|
+
import chalk55 from "chalk";
|
|
4524
4545
|
function denyAdd(pattern2, message) {
|
|
4525
4546
|
const config = loadProjectConfig();
|
|
4526
4547
|
const deny = config.deny ?? [];
|
|
4527
4548
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4528
|
-
console.log(
|
|
4549
|
+
console.log(chalk55.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4529
4550
|
return;
|
|
4530
4551
|
}
|
|
4531
4552
|
deny.push({ pattern: pattern2, message });
|
|
4532
4553
|
config.deny = deny;
|
|
4533
4554
|
saveConfig(config);
|
|
4534
|
-
console.log(
|
|
4555
|
+
console.log(chalk55.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4535
4556
|
}
|
|
4536
4557
|
|
|
4537
4558
|
// src/commands/deny/denyList.ts
|
|
4538
|
-
import
|
|
4559
|
+
import chalk56 from "chalk";
|
|
4539
4560
|
function denyList() {
|
|
4540
4561
|
const config = loadConfig();
|
|
4541
4562
|
const deny = config.deny;
|
|
4542
4563
|
if (!deny || deny.length === 0) {
|
|
4543
|
-
console.log(
|
|
4564
|
+
console.log(chalk56.dim("No deny rules configured."));
|
|
4544
4565
|
return;
|
|
4545
4566
|
}
|
|
4546
4567
|
for (const rule of deny) {
|
|
4547
|
-
console.log(`${
|
|
4568
|
+
console.log(`${chalk56.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4548
4569
|
}
|
|
4549
4570
|
}
|
|
4550
4571
|
|
|
4551
4572
|
// src/commands/deny/denyRemove.ts
|
|
4552
|
-
import
|
|
4573
|
+
import chalk57 from "chalk";
|
|
4553
4574
|
function denyRemove(pattern2) {
|
|
4554
4575
|
const config = loadProjectConfig();
|
|
4555
4576
|
const deny = config.deny ?? [];
|
|
4556
4577
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4557
4578
|
if (index === -1) {
|
|
4558
|
-
console.log(
|
|
4579
|
+
console.log(chalk57.yellow(`No deny rule found for: ${pattern2}`));
|
|
4559
4580
|
return;
|
|
4560
4581
|
}
|
|
4561
4582
|
deny.splice(index, 1);
|
|
4562
4583
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4563
4584
|
saveConfig(config);
|
|
4564
|
-
console.log(
|
|
4585
|
+
console.log(chalk57.green(`Removed deny rule: ${pattern2}`));
|
|
4565
4586
|
}
|
|
4566
4587
|
|
|
4567
4588
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4611,11 +4632,11 @@ function assertCliExists(cli) {
|
|
|
4611
4632
|
}
|
|
4612
4633
|
|
|
4613
4634
|
// src/commands/permitCliReads/colorize.ts
|
|
4614
|
-
import
|
|
4635
|
+
import chalk58 from "chalk";
|
|
4615
4636
|
function colorize(plainOutput) {
|
|
4616
4637
|
return plainOutput.split("\n").map((line) => {
|
|
4617
|
-
if (line.startsWith(" R ")) return
|
|
4618
|
-
if (line.startsWith(" W ")) return
|
|
4638
|
+
if (line.startsWith(" R ")) return chalk58.green(line);
|
|
4639
|
+
if (line.startsWith(" W ")) return chalk58.red(line);
|
|
4619
4640
|
return line;
|
|
4620
4641
|
}).join("\n");
|
|
4621
4642
|
}
|
|
@@ -4933,15 +4954,15 @@ function registerCliHook(program2) {
|
|
|
4933
4954
|
}
|
|
4934
4955
|
|
|
4935
4956
|
// src/commands/complexity/analyze.ts
|
|
4936
|
-
import
|
|
4957
|
+
import chalk64 from "chalk";
|
|
4937
4958
|
|
|
4938
4959
|
// src/commands/complexity/cyclomatic.ts
|
|
4939
|
-
import
|
|
4960
|
+
import chalk60 from "chalk";
|
|
4940
4961
|
|
|
4941
4962
|
// src/commands/complexity/shared/index.ts
|
|
4942
4963
|
import fs12 from "fs";
|
|
4943
4964
|
import path20 from "path";
|
|
4944
|
-
import
|
|
4965
|
+
import chalk59 from "chalk";
|
|
4945
4966
|
import ts5 from "typescript";
|
|
4946
4967
|
|
|
4947
4968
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5187,7 +5208,7 @@ function createSourceFromFile(filePath) {
|
|
|
5187
5208
|
function withSourceFiles(pattern2, callback) {
|
|
5188
5209
|
const files = findSourceFiles2(pattern2);
|
|
5189
5210
|
if (files.length === 0) {
|
|
5190
|
-
console.log(
|
|
5211
|
+
console.log(chalk59.yellow("No files found matching pattern"));
|
|
5191
5212
|
return void 0;
|
|
5192
5213
|
}
|
|
5193
5214
|
return callback(files);
|
|
@@ -5220,11 +5241,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5220
5241
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5221
5242
|
for (const { file, name, complexity } of results) {
|
|
5222
5243
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5223
|
-
const color = exceedsThreshold ?
|
|
5224
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5244
|
+
const color = exceedsThreshold ? chalk60.red : chalk60.white;
|
|
5245
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk60.cyan(complexity)}`);
|
|
5225
5246
|
}
|
|
5226
5247
|
console.log(
|
|
5227
|
-
|
|
5248
|
+
chalk60.dim(
|
|
5228
5249
|
`
|
|
5229
5250
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5230
5251
|
)
|
|
@@ -5236,7 +5257,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5236
5257
|
}
|
|
5237
5258
|
|
|
5238
5259
|
// src/commands/complexity/halstead.ts
|
|
5239
|
-
import
|
|
5260
|
+
import chalk61 from "chalk";
|
|
5240
5261
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5241
5262
|
withSourceFiles(pattern2, (files) => {
|
|
5242
5263
|
const results = [];
|
|
@@ -5251,13 +5272,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5251
5272
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5252
5273
|
for (const { file, name, metrics } of results) {
|
|
5253
5274
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5254
|
-
const color = exceedsThreshold ?
|
|
5275
|
+
const color = exceedsThreshold ? chalk61.red : chalk61.white;
|
|
5255
5276
|
console.log(
|
|
5256
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5277
|
+
`${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
5278
|
);
|
|
5258
5279
|
}
|
|
5259
5280
|
console.log(
|
|
5260
|
-
|
|
5281
|
+
chalk61.dim(
|
|
5261
5282
|
`
|
|
5262
5283
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5263
5284
|
)
|
|
@@ -5272,28 +5293,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5272
5293
|
import fs13 from "fs";
|
|
5273
5294
|
|
|
5274
5295
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5275
|
-
import
|
|
5296
|
+
import chalk62 from "chalk";
|
|
5276
5297
|
function displayMaintainabilityResults(results, threshold) {
|
|
5277
5298
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5278
5299
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5279
|
-
console.log(
|
|
5300
|
+
console.log(chalk62.green("All files pass maintainability threshold"));
|
|
5280
5301
|
} else {
|
|
5281
5302
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5282
|
-
const color = threshold !== void 0 ?
|
|
5303
|
+
const color = threshold !== void 0 ? chalk62.red : chalk62.white;
|
|
5283
5304
|
console.log(
|
|
5284
|
-
`${color(file)} \u2192 avg: ${
|
|
5305
|
+
`${color(file)} \u2192 avg: ${chalk62.cyan(avgMaintainability.toFixed(1))}, min: ${chalk62.yellow(minMaintainability.toFixed(1))}`
|
|
5285
5306
|
);
|
|
5286
5307
|
}
|
|
5287
5308
|
}
|
|
5288
|
-
console.log(
|
|
5309
|
+
console.log(chalk62.dim(`
|
|
5289
5310
|
Analyzed ${results.length} files`));
|
|
5290
5311
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5291
5312
|
console.error(
|
|
5292
|
-
|
|
5313
|
+
chalk62.red(
|
|
5293
5314
|
`
|
|
5294
5315
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5295
5316
|
|
|
5296
|
-
\u26A0\uFE0F ${
|
|
5317
|
+
\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
5318
|
)
|
|
5298
5319
|
);
|
|
5299
5320
|
process.exit(1);
|
|
@@ -5350,7 +5371,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5350
5371
|
|
|
5351
5372
|
// src/commands/complexity/sloc.ts
|
|
5352
5373
|
import fs14 from "fs";
|
|
5353
|
-
import
|
|
5374
|
+
import chalk63 from "chalk";
|
|
5354
5375
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5355
5376
|
withSourceFiles(pattern2, (files) => {
|
|
5356
5377
|
const results = [];
|
|
@@ -5366,12 +5387,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5366
5387
|
results.sort((a, b) => b.lines - a.lines);
|
|
5367
5388
|
for (const { file, lines } of results) {
|
|
5368
5389
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5369
|
-
const color = exceedsThreshold ?
|
|
5370
|
-
console.log(`${color(file)} \u2192 ${
|
|
5390
|
+
const color = exceedsThreshold ? chalk63.red : chalk63.white;
|
|
5391
|
+
console.log(`${color(file)} \u2192 ${chalk63.cyan(lines)} lines`);
|
|
5371
5392
|
}
|
|
5372
5393
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5373
5394
|
console.log(
|
|
5374
|
-
|
|
5395
|
+
chalk63.dim(`
|
|
5375
5396
|
Total: ${total} lines across ${files.length} files`)
|
|
5376
5397
|
);
|
|
5377
5398
|
if (hasViolation) {
|
|
@@ -5385,21 +5406,21 @@ async function analyze(pattern2) {
|
|
|
5385
5406
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5386
5407
|
const files = findSourceFiles2(searchPattern);
|
|
5387
5408
|
if (files.length === 0) {
|
|
5388
|
-
console.log(
|
|
5409
|
+
console.log(chalk64.yellow("No files found matching pattern"));
|
|
5389
5410
|
return;
|
|
5390
5411
|
}
|
|
5391
5412
|
if (files.length === 1) {
|
|
5392
5413
|
const file = files[0];
|
|
5393
|
-
console.log(
|
|
5414
|
+
console.log(chalk64.bold.underline("SLOC"));
|
|
5394
5415
|
await sloc(file);
|
|
5395
5416
|
console.log();
|
|
5396
|
-
console.log(
|
|
5417
|
+
console.log(chalk64.bold.underline("Cyclomatic Complexity"));
|
|
5397
5418
|
await cyclomatic(file);
|
|
5398
5419
|
console.log();
|
|
5399
|
-
console.log(
|
|
5420
|
+
console.log(chalk64.bold.underline("Halstead Metrics"));
|
|
5400
5421
|
await halstead(file);
|
|
5401
5422
|
console.log();
|
|
5402
|
-
console.log(
|
|
5423
|
+
console.log(chalk64.bold.underline("Maintainability Index"));
|
|
5403
5424
|
await maintainability(file);
|
|
5404
5425
|
return;
|
|
5405
5426
|
}
|
|
@@ -5427,7 +5448,7 @@ function registerComplexity(program2) {
|
|
|
5427
5448
|
|
|
5428
5449
|
// src/commands/deploy/redirect.ts
|
|
5429
5450
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
5430
|
-
import
|
|
5451
|
+
import chalk65 from "chalk";
|
|
5431
5452
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5432
5453
|
if (!window.location.pathname.endsWith('/')) {
|
|
5433
5454
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5436,22 +5457,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5436
5457
|
function redirect() {
|
|
5437
5458
|
const indexPath = "index.html";
|
|
5438
5459
|
if (!existsSync24(indexPath)) {
|
|
5439
|
-
console.log(
|
|
5460
|
+
console.log(chalk65.yellow("No index.html found"));
|
|
5440
5461
|
return;
|
|
5441
5462
|
}
|
|
5442
5463
|
const content = readFileSync20(indexPath, "utf-8");
|
|
5443
5464
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5444
|
-
console.log(
|
|
5465
|
+
console.log(chalk65.dim("Trailing slash script already present"));
|
|
5445
5466
|
return;
|
|
5446
5467
|
}
|
|
5447
5468
|
const headCloseIndex = content.indexOf("</head>");
|
|
5448
5469
|
if (headCloseIndex === -1) {
|
|
5449
|
-
console.log(
|
|
5470
|
+
console.log(chalk65.red("Could not find </head> tag in index.html"));
|
|
5450
5471
|
return;
|
|
5451
5472
|
}
|
|
5452
5473
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5453
5474
|
writeFileSync17(indexPath, newContent);
|
|
5454
|
-
console.log(
|
|
5475
|
+
console.log(chalk65.green("Added trailing slash redirect to index.html"));
|
|
5455
5476
|
}
|
|
5456
5477
|
|
|
5457
5478
|
// src/commands/registerDeploy.ts
|
|
@@ -5478,7 +5499,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5478
5499
|
|
|
5479
5500
|
// src/commands/devlog/shared.ts
|
|
5480
5501
|
import { execSync as execSync17 } from "child_process";
|
|
5481
|
-
import
|
|
5502
|
+
import chalk66 from "chalk";
|
|
5482
5503
|
|
|
5483
5504
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5484
5505
|
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
@@ -5565,13 +5586,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5565
5586
|
}
|
|
5566
5587
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5567
5588
|
for (const commit2 of commits) {
|
|
5568
|
-
console.log(` ${
|
|
5589
|
+
console.log(` ${chalk66.yellow(commit2.hash)} ${commit2.message}`);
|
|
5569
5590
|
if (verbose) {
|
|
5570
5591
|
const visibleFiles = commit2.files.filter(
|
|
5571
5592
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5572
5593
|
);
|
|
5573
5594
|
for (const file of visibleFiles) {
|
|
5574
|
-
console.log(` ${
|
|
5595
|
+
console.log(` ${chalk66.dim(file)}`);
|
|
5575
5596
|
}
|
|
5576
5597
|
}
|
|
5577
5598
|
}
|
|
@@ -5596,15 +5617,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5596
5617
|
}
|
|
5597
5618
|
|
|
5598
5619
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5599
|
-
import
|
|
5620
|
+
import chalk67 from "chalk";
|
|
5600
5621
|
function printDateHeader(date, isSkipped, entries) {
|
|
5601
5622
|
if (isSkipped) {
|
|
5602
|
-
console.log(`${
|
|
5623
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.dim("skipped")}`);
|
|
5603
5624
|
} else if (entries && entries.length > 0) {
|
|
5604
|
-
const entryInfo = entries.map((e) => `${
|
|
5605
|
-
console.log(`${
|
|
5625
|
+
const entryInfo = entries.map((e) => `${chalk67.green(e.version)} ${e.title}`).join(" | ");
|
|
5626
|
+
console.log(`${chalk67.bold.blue(date)} ${entryInfo}`);
|
|
5606
5627
|
} else {
|
|
5607
|
-
console.log(`${
|
|
5628
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.red("\u26A0 devlog missing")}`);
|
|
5608
5629
|
}
|
|
5609
5630
|
}
|
|
5610
5631
|
|
|
@@ -5708,24 +5729,24 @@ function bumpVersion(version2, type) {
|
|
|
5708
5729
|
|
|
5709
5730
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5710
5731
|
import { execSync as execSync20 } from "child_process";
|
|
5711
|
-
import
|
|
5732
|
+
import chalk69 from "chalk";
|
|
5712
5733
|
|
|
5713
5734
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5714
|
-
import
|
|
5735
|
+
import chalk68 from "chalk";
|
|
5715
5736
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5716
5737
|
if (conventional && firstHash) {
|
|
5717
5738
|
const version2 = getVersionAtCommit(firstHash);
|
|
5718
5739
|
if (version2) {
|
|
5719
|
-
console.log(`${
|
|
5740
|
+
console.log(`${chalk68.bold("version:")} ${stripToMinor(version2)}`);
|
|
5720
5741
|
} else {
|
|
5721
|
-
console.log(`${
|
|
5742
|
+
console.log(`${chalk68.bold("version:")} ${chalk68.red("unknown")}`);
|
|
5722
5743
|
}
|
|
5723
5744
|
} else if (patchVersion && minorVersion) {
|
|
5724
5745
|
console.log(
|
|
5725
|
-
`${
|
|
5746
|
+
`${chalk68.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5726
5747
|
);
|
|
5727
5748
|
} else {
|
|
5728
|
-
console.log(`${
|
|
5749
|
+
console.log(`${chalk68.bold("version:")} v0.1 (initial)`);
|
|
5729
5750
|
}
|
|
5730
5751
|
}
|
|
5731
5752
|
|
|
@@ -5772,16 +5793,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5772
5793
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5773
5794
|
}
|
|
5774
5795
|
function logName(repoName) {
|
|
5775
|
-
console.log(`${
|
|
5796
|
+
console.log(`${chalk69.bold("name:")} ${repoName}`);
|
|
5776
5797
|
}
|
|
5777
5798
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5778
5799
|
logName(ctx.repoName);
|
|
5779
5800
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5780
|
-
console.log(
|
|
5801
|
+
console.log(chalk69.bold.blue(targetDate));
|
|
5781
5802
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5782
5803
|
}
|
|
5783
5804
|
function logNoCommits(lastInfo) {
|
|
5784
|
-
console.log(
|
|
5805
|
+
console.log(chalk69.dim(noCommitsMessage(!!lastInfo)));
|
|
5785
5806
|
}
|
|
5786
5807
|
|
|
5787
5808
|
// src/commands/devlog/next/index.ts
|
|
@@ -5822,11 +5843,11 @@ function next2(options2) {
|
|
|
5822
5843
|
import { execSync as execSync21 } from "child_process";
|
|
5823
5844
|
|
|
5824
5845
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5825
|
-
import
|
|
5846
|
+
import chalk70 from "chalk";
|
|
5826
5847
|
function colorStatus(status2) {
|
|
5827
|
-
if (status2 === "missing") return
|
|
5828
|
-
if (status2 === "outdated") return
|
|
5829
|
-
return
|
|
5848
|
+
if (status2 === "missing") return chalk70.red(status2);
|
|
5849
|
+
if (status2 === "outdated") return chalk70.yellow(status2);
|
|
5850
|
+
return chalk70.green(status2);
|
|
5830
5851
|
}
|
|
5831
5852
|
function formatRow(row, nameWidth) {
|
|
5832
5853
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5840,8 +5861,8 @@ function printReposTable(rows) {
|
|
|
5840
5861
|
"Last Devlog".padEnd(11),
|
|
5841
5862
|
"Status"
|
|
5842
5863
|
].join(" ");
|
|
5843
|
-
console.log(
|
|
5844
|
-
console.log(
|
|
5864
|
+
console.log(chalk70.dim(header));
|
|
5865
|
+
console.log(chalk70.dim("-".repeat(header.length)));
|
|
5845
5866
|
for (const row of rows) {
|
|
5846
5867
|
console.log(formatRow(row, nameWidth));
|
|
5847
5868
|
}
|
|
@@ -5899,14 +5920,14 @@ function repos(options2) {
|
|
|
5899
5920
|
// src/commands/devlog/skip.ts
|
|
5900
5921
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5901
5922
|
import { join as join20 } from "path";
|
|
5902
|
-
import
|
|
5923
|
+
import chalk71 from "chalk";
|
|
5903
5924
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5904
5925
|
function getBlogConfigPath() {
|
|
5905
5926
|
return join20(BLOG_REPO_ROOT, "assist.yml");
|
|
5906
5927
|
}
|
|
5907
5928
|
function skip(date) {
|
|
5908
5929
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5909
|
-
console.log(
|
|
5930
|
+
console.log(chalk71.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5910
5931
|
process.exit(1);
|
|
5911
5932
|
}
|
|
5912
5933
|
const repoName = getRepoName();
|
|
@@ -5917,7 +5938,7 @@ function skip(date) {
|
|
|
5917
5938
|
const skipDays = skip2[repoName] ?? [];
|
|
5918
5939
|
if (skipDays.includes(date)) {
|
|
5919
5940
|
console.log(
|
|
5920
|
-
|
|
5941
|
+
chalk71.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5921
5942
|
);
|
|
5922
5943
|
return;
|
|
5923
5944
|
}
|
|
@@ -5927,20 +5948,20 @@ function skip(date) {
|
|
|
5927
5948
|
devlog.skip = skip2;
|
|
5928
5949
|
config.devlog = devlog;
|
|
5929
5950
|
writeFileSync18(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
5930
|
-
console.log(
|
|
5951
|
+
console.log(chalk71.green(`Added ${date} to skip list for ${repoName}`));
|
|
5931
5952
|
}
|
|
5932
5953
|
|
|
5933
5954
|
// src/commands/devlog/version.ts
|
|
5934
|
-
import
|
|
5955
|
+
import chalk72 from "chalk";
|
|
5935
5956
|
function version() {
|
|
5936
5957
|
const config = loadConfig();
|
|
5937
5958
|
const name = getRepoName();
|
|
5938
5959
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5939
5960
|
const lastVersion = lastInfo?.version ?? null;
|
|
5940
5961
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5941
|
-
console.log(`${
|
|
5942
|
-
console.log(`${
|
|
5943
|
-
console.log(`${
|
|
5962
|
+
console.log(`${chalk72.bold("name:")} ${name}`);
|
|
5963
|
+
console.log(`${chalk72.bold("last:")} ${lastVersion ?? chalk72.dim("none")}`);
|
|
5964
|
+
console.log(`${chalk72.bold("next:")} ${nextVersion ?? chalk72.dim("none")}`);
|
|
5944
5965
|
}
|
|
5945
5966
|
|
|
5946
5967
|
// src/commands/registerDevlog.ts
|
|
@@ -5964,7 +5985,7 @@ function registerDevlog(program2) {
|
|
|
5964
5985
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5965
5986
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5966
5987
|
import { join as join21 } from "path";
|
|
5967
|
-
import
|
|
5988
|
+
import chalk73 from "chalk";
|
|
5968
5989
|
|
|
5969
5990
|
// src/shared/findRepoRoot.ts
|
|
5970
5991
|
import { existsSync as existsSync25 } from "fs";
|
|
@@ -6027,14 +6048,14 @@ function checkBuildLocks(startDir) {
|
|
|
6027
6048
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6028
6049
|
if (locked) {
|
|
6029
6050
|
console.error(
|
|
6030
|
-
|
|
6051
|
+
chalk73.red("Build output locked (is VS debugging?): ") + locked
|
|
6031
6052
|
);
|
|
6032
6053
|
process.exit(1);
|
|
6033
6054
|
}
|
|
6034
6055
|
}
|
|
6035
6056
|
async function checkBuildLocksCommand() {
|
|
6036
6057
|
checkBuildLocks();
|
|
6037
|
-
console.log(
|
|
6058
|
+
console.log(chalk73.green("No build locks detected"));
|
|
6038
6059
|
}
|
|
6039
6060
|
|
|
6040
6061
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6133,30 +6154,30 @@ function escapeRegex(s) {
|
|
|
6133
6154
|
}
|
|
6134
6155
|
|
|
6135
6156
|
// src/commands/dotnet/printTree.ts
|
|
6136
|
-
import
|
|
6157
|
+
import chalk74 from "chalk";
|
|
6137
6158
|
function printNodes(nodes, prefix2) {
|
|
6138
6159
|
for (let i = 0; i < nodes.length; i++) {
|
|
6139
6160
|
const isLast = i === nodes.length - 1;
|
|
6140
6161
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6141
6162
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6142
6163
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6143
|
-
const label2 = isMissing ?
|
|
6164
|
+
const label2 = isMissing ? chalk74.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6144
6165
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6145
6166
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6146
6167
|
}
|
|
6147
6168
|
}
|
|
6148
6169
|
function printTree(tree, totalCount, solutions) {
|
|
6149
|
-
console.log(
|
|
6150
|
-
console.log(
|
|
6170
|
+
console.log(chalk74.bold("\nProject Dependency Tree"));
|
|
6171
|
+
console.log(chalk74.cyan(tree.relativePath));
|
|
6151
6172
|
printNodes(tree.children, "");
|
|
6152
|
-
console.log(
|
|
6173
|
+
console.log(chalk74.dim(`
|
|
6153
6174
|
${totalCount} projects total (including root)`));
|
|
6154
|
-
console.log(
|
|
6175
|
+
console.log(chalk74.bold("\nSolution Membership"));
|
|
6155
6176
|
if (solutions.length === 0) {
|
|
6156
|
-
console.log(
|
|
6177
|
+
console.log(chalk74.yellow(" Not found in any .sln"));
|
|
6157
6178
|
} else {
|
|
6158
6179
|
for (const sln of solutions) {
|
|
6159
|
-
console.log(` ${
|
|
6180
|
+
console.log(` ${chalk74.green(sln)}`);
|
|
6160
6181
|
}
|
|
6161
6182
|
}
|
|
6162
6183
|
console.log();
|
|
@@ -6185,16 +6206,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6185
6206
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6186
6207
|
import { existsSync as existsSync26 } from "fs";
|
|
6187
6208
|
import path24 from "path";
|
|
6188
|
-
import
|
|
6209
|
+
import chalk75 from "chalk";
|
|
6189
6210
|
function resolveCsproj(csprojPath) {
|
|
6190
6211
|
const resolved = path24.resolve(csprojPath);
|
|
6191
6212
|
if (!existsSync26(resolved)) {
|
|
6192
|
-
console.error(
|
|
6213
|
+
console.error(chalk75.red(`File not found: ${resolved}`));
|
|
6193
6214
|
process.exit(1);
|
|
6194
6215
|
}
|
|
6195
6216
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6196
6217
|
if (!repoRoot) {
|
|
6197
|
-
console.error(
|
|
6218
|
+
console.error(chalk75.red("Could not find git repository root"));
|
|
6198
6219
|
process.exit(1);
|
|
6199
6220
|
}
|
|
6200
6221
|
return { resolved, repoRoot };
|
|
@@ -6244,12 +6265,12 @@ function getChangedCsFiles(scope) {
|
|
|
6244
6265
|
}
|
|
6245
6266
|
|
|
6246
6267
|
// src/commands/dotnet/inSln.ts
|
|
6247
|
-
import
|
|
6268
|
+
import chalk76 from "chalk";
|
|
6248
6269
|
async function inSln(csprojPath) {
|
|
6249
6270
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6250
6271
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6251
6272
|
if (solutions.length === 0) {
|
|
6252
|
-
console.log(
|
|
6273
|
+
console.log(chalk76.yellow("Not found in any .sln file"));
|
|
6253
6274
|
process.exit(1);
|
|
6254
6275
|
}
|
|
6255
6276
|
for (const sln of solutions) {
|
|
@@ -6258,7 +6279,7 @@ async function inSln(csprojPath) {
|
|
|
6258
6279
|
}
|
|
6259
6280
|
|
|
6260
6281
|
// src/commands/dotnet/inspect.ts
|
|
6261
|
-
import
|
|
6282
|
+
import chalk82 from "chalk";
|
|
6262
6283
|
|
|
6263
6284
|
// src/shared/formatElapsed.ts
|
|
6264
6285
|
function formatElapsed(ms) {
|
|
@@ -6270,12 +6291,12 @@ function formatElapsed(ms) {
|
|
|
6270
6291
|
}
|
|
6271
6292
|
|
|
6272
6293
|
// src/commands/dotnet/displayIssues.ts
|
|
6273
|
-
import
|
|
6294
|
+
import chalk77 from "chalk";
|
|
6274
6295
|
var SEVERITY_COLOR = {
|
|
6275
|
-
ERROR:
|
|
6276
|
-
WARNING:
|
|
6277
|
-
SUGGESTION:
|
|
6278
|
-
HINT:
|
|
6296
|
+
ERROR: chalk77.red,
|
|
6297
|
+
WARNING: chalk77.yellow,
|
|
6298
|
+
SUGGESTION: chalk77.cyan,
|
|
6299
|
+
HINT: chalk77.dim
|
|
6279
6300
|
};
|
|
6280
6301
|
function groupByFile(issues) {
|
|
6281
6302
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6291,15 +6312,15 @@ function groupByFile(issues) {
|
|
|
6291
6312
|
}
|
|
6292
6313
|
function displayIssues(issues) {
|
|
6293
6314
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6294
|
-
console.log(
|
|
6315
|
+
console.log(chalk77.bold(file));
|
|
6295
6316
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6296
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6317
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk77.white;
|
|
6297
6318
|
console.log(
|
|
6298
|
-
` ${
|
|
6319
|
+
` ${chalk77.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6299
6320
|
);
|
|
6300
6321
|
}
|
|
6301
6322
|
}
|
|
6302
|
-
console.log(
|
|
6323
|
+
console.log(chalk77.dim(`
|
|
6303
6324
|
${issues.length} issue(s) found`));
|
|
6304
6325
|
}
|
|
6305
6326
|
|
|
@@ -6358,12 +6379,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6358
6379
|
// src/commands/dotnet/resolveSolution.ts
|
|
6359
6380
|
import { existsSync as existsSync27 } from "fs";
|
|
6360
6381
|
import path25 from "path";
|
|
6361
|
-
import
|
|
6382
|
+
import chalk79 from "chalk";
|
|
6362
6383
|
|
|
6363
6384
|
// src/commands/dotnet/findSolution.ts
|
|
6364
6385
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6365
6386
|
import { dirname as dirname16, join as join22 } from "path";
|
|
6366
|
-
import
|
|
6387
|
+
import chalk78 from "chalk";
|
|
6367
6388
|
function findSlnInDir(dir) {
|
|
6368
6389
|
try {
|
|
6369
6390
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join22(dir, f));
|
|
@@ -6379,17 +6400,17 @@ function findSolution() {
|
|
|
6379
6400
|
const slnFiles = findSlnInDir(current);
|
|
6380
6401
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6381
6402
|
if (slnFiles.length > 1) {
|
|
6382
|
-
console.error(
|
|
6403
|
+
console.error(chalk78.red(`Multiple .sln files found in ${current}:`));
|
|
6383
6404
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6384
6405
|
console.error(
|
|
6385
|
-
|
|
6406
|
+
chalk78.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6386
6407
|
);
|
|
6387
6408
|
process.exit(1);
|
|
6388
6409
|
}
|
|
6389
6410
|
if (current === ceiling) break;
|
|
6390
6411
|
current = dirname16(current);
|
|
6391
6412
|
}
|
|
6392
|
-
console.error(
|
|
6413
|
+
console.error(chalk78.red("No .sln file found between cwd and repo root"));
|
|
6393
6414
|
process.exit(1);
|
|
6394
6415
|
}
|
|
6395
6416
|
|
|
@@ -6398,7 +6419,7 @@ function resolveSolution(sln) {
|
|
|
6398
6419
|
if (sln) {
|
|
6399
6420
|
const resolved = path25.resolve(sln);
|
|
6400
6421
|
if (!existsSync27(resolved)) {
|
|
6401
|
-
console.error(
|
|
6422
|
+
console.error(chalk79.red(`Solution file not found: ${resolved}`));
|
|
6402
6423
|
process.exit(1);
|
|
6403
6424
|
}
|
|
6404
6425
|
return resolved;
|
|
@@ -6440,14 +6461,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6440
6461
|
import { existsSync as existsSync28, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6441
6462
|
import { tmpdir as tmpdir2 } from "os";
|
|
6442
6463
|
import path26 from "path";
|
|
6443
|
-
import
|
|
6464
|
+
import chalk80 from "chalk";
|
|
6444
6465
|
function assertJbInstalled() {
|
|
6445
6466
|
try {
|
|
6446
6467
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6447
6468
|
} catch {
|
|
6448
|
-
console.error(
|
|
6469
|
+
console.error(chalk80.red("jb is not installed. Install with:"));
|
|
6449
6470
|
console.error(
|
|
6450
|
-
|
|
6471
|
+
chalk80.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6451
6472
|
);
|
|
6452
6473
|
process.exit(1);
|
|
6453
6474
|
}
|
|
@@ -6465,11 +6486,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6465
6486
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6466
6487
|
process.stderr.write(err.stderr);
|
|
6467
6488
|
}
|
|
6468
|
-
console.error(
|
|
6489
|
+
console.error(chalk80.red("jb inspectcode failed"));
|
|
6469
6490
|
process.exit(1);
|
|
6470
6491
|
}
|
|
6471
6492
|
if (!existsSync28(reportPath)) {
|
|
6472
|
-
console.error(
|
|
6493
|
+
console.error(chalk80.red("Report file not generated"));
|
|
6473
6494
|
process.exit(1);
|
|
6474
6495
|
}
|
|
6475
6496
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6479,7 +6500,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6479
6500
|
|
|
6480
6501
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6481
6502
|
import { execSync as execSync24 } from "child_process";
|
|
6482
|
-
import
|
|
6503
|
+
import chalk81 from "chalk";
|
|
6483
6504
|
function resolveMsbuildPath() {
|
|
6484
6505
|
const config = loadConfig();
|
|
6485
6506
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6490,9 +6511,9 @@ function assertMsbuildInstalled() {
|
|
|
6490
6511
|
try {
|
|
6491
6512
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6492
6513
|
} catch {
|
|
6493
|
-
console.error(
|
|
6514
|
+
console.error(chalk81.red(`msbuild not found at: ${msbuild}`));
|
|
6494
6515
|
console.error(
|
|
6495
|
-
|
|
6516
|
+
chalk81.yellow(
|
|
6496
6517
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6497
6518
|
)
|
|
6498
6519
|
);
|
|
@@ -6539,17 +6560,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6539
6560
|
// src/commands/dotnet/inspect.ts
|
|
6540
6561
|
function logScope(changedFiles) {
|
|
6541
6562
|
if (changedFiles === null) {
|
|
6542
|
-
console.log(
|
|
6563
|
+
console.log(chalk82.dim("Inspecting full solution..."));
|
|
6543
6564
|
} else {
|
|
6544
6565
|
console.log(
|
|
6545
|
-
|
|
6566
|
+
chalk82.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6546
6567
|
);
|
|
6547
6568
|
}
|
|
6548
6569
|
}
|
|
6549
6570
|
function reportResults(issues, elapsed) {
|
|
6550
6571
|
if (issues.length > 0) displayIssues(issues);
|
|
6551
|
-
else console.log(
|
|
6552
|
-
console.log(
|
|
6572
|
+
else console.log(chalk82.green("No issues found"));
|
|
6573
|
+
console.log(chalk82.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6553
6574
|
if (issues.length > 0) process.exit(1);
|
|
6554
6575
|
}
|
|
6555
6576
|
async function inspect(sln, options2) {
|
|
@@ -6560,7 +6581,7 @@ async function inspect(sln, options2) {
|
|
|
6560
6581
|
const scope = parseScope(options2.scope);
|
|
6561
6582
|
const changedFiles = getChangedCsFiles(scope);
|
|
6562
6583
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6563
|
-
console.log(
|
|
6584
|
+
console.log(chalk82.green("No changed .cs files found"));
|
|
6564
6585
|
return;
|
|
6565
6586
|
}
|
|
6566
6587
|
logScope(changedFiles);
|
|
@@ -6586,7 +6607,7 @@ function registerDotnet(program2) {
|
|
|
6586
6607
|
}
|
|
6587
6608
|
|
|
6588
6609
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6589
|
-
import
|
|
6610
|
+
import chalk84 from "chalk";
|
|
6590
6611
|
|
|
6591
6612
|
// src/commands/jira/adfToText.ts
|
|
6592
6613
|
function renderInline(node) {
|
|
@@ -6647,7 +6668,7 @@ function adfToText(doc) {
|
|
|
6647
6668
|
|
|
6648
6669
|
// src/commands/jira/fetchIssue.ts
|
|
6649
6670
|
import { execSync as execSync25 } from "child_process";
|
|
6650
|
-
import
|
|
6671
|
+
import chalk83 from "chalk";
|
|
6651
6672
|
function fetchIssue(issueKey, fields) {
|
|
6652
6673
|
let result;
|
|
6653
6674
|
try {
|
|
@@ -6660,15 +6681,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6660
6681
|
const stderr = error.stderr;
|
|
6661
6682
|
if (stderr.includes("unauthorized")) {
|
|
6662
6683
|
console.error(
|
|
6663
|
-
|
|
6684
|
+
chalk83.red("Jira authentication expired."),
|
|
6664
6685
|
"Run",
|
|
6665
|
-
|
|
6686
|
+
chalk83.cyan("assist jira auth"),
|
|
6666
6687
|
"to re-authenticate."
|
|
6667
6688
|
);
|
|
6668
6689
|
process.exit(1);
|
|
6669
6690
|
}
|
|
6670
6691
|
}
|
|
6671
|
-
console.error(
|
|
6692
|
+
console.error(chalk83.red(`Failed to fetch ${issueKey}.`));
|
|
6672
6693
|
process.exit(1);
|
|
6673
6694
|
}
|
|
6674
6695
|
return JSON.parse(result);
|
|
@@ -6682,7 +6703,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6682
6703
|
const parsed = fetchIssue(issueKey, field);
|
|
6683
6704
|
const acValue = parsed?.fields?.[field];
|
|
6684
6705
|
if (!acValue) {
|
|
6685
|
-
console.log(
|
|
6706
|
+
console.log(chalk84.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6686
6707
|
return;
|
|
6687
6708
|
}
|
|
6688
6709
|
if (typeof acValue === "string") {
|
|
@@ -6777,14 +6798,14 @@ async function jiraAuth() {
|
|
|
6777
6798
|
}
|
|
6778
6799
|
|
|
6779
6800
|
// src/commands/jira/viewIssue.ts
|
|
6780
|
-
import
|
|
6801
|
+
import chalk85 from "chalk";
|
|
6781
6802
|
function viewIssue(issueKey) {
|
|
6782
6803
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6783
6804
|
const fields = parsed?.fields;
|
|
6784
6805
|
const summary = fields?.summary;
|
|
6785
6806
|
const description = fields?.description;
|
|
6786
6807
|
if (summary) {
|
|
6787
|
-
console.log(
|
|
6808
|
+
console.log(chalk85.bold(summary));
|
|
6788
6809
|
}
|
|
6789
6810
|
if (description) {
|
|
6790
6811
|
if (summary) console.log();
|
|
@@ -6798,7 +6819,7 @@ function viewIssue(issueKey) {
|
|
|
6798
6819
|
}
|
|
6799
6820
|
if (!summary && !description) {
|
|
6800
6821
|
console.log(
|
|
6801
|
-
|
|
6822
|
+
chalk85.yellow(`No summary or description found on ${issueKey}.`)
|
|
6802
6823
|
);
|
|
6803
6824
|
}
|
|
6804
6825
|
}
|
|
@@ -6812,7 +6833,7 @@ function registerJira(program2) {
|
|
|
6812
6833
|
}
|
|
6813
6834
|
|
|
6814
6835
|
// src/commands/news/add/index.ts
|
|
6815
|
-
import
|
|
6836
|
+
import chalk86 from "chalk";
|
|
6816
6837
|
import enquirer7 from "enquirer";
|
|
6817
6838
|
async function add2(url) {
|
|
6818
6839
|
if (!url) {
|
|
@@ -6835,17 +6856,17 @@ async function add2(url) {
|
|
|
6835
6856
|
const news = config.news ?? {};
|
|
6836
6857
|
const feeds = news.feeds ?? [];
|
|
6837
6858
|
if (feeds.includes(url)) {
|
|
6838
|
-
console.log(
|
|
6859
|
+
console.log(chalk86.yellow("Feed already exists in config"));
|
|
6839
6860
|
return;
|
|
6840
6861
|
}
|
|
6841
6862
|
feeds.push(url);
|
|
6842
6863
|
config.news = { ...news, feeds };
|
|
6843
6864
|
saveGlobalConfig(config);
|
|
6844
|
-
console.log(
|
|
6865
|
+
console.log(chalk86.green(`Added feed: ${url}`));
|
|
6845
6866
|
}
|
|
6846
6867
|
|
|
6847
6868
|
// src/commands/news/web/handleRequest.ts
|
|
6848
|
-
import
|
|
6869
|
+
import chalk87 from "chalk";
|
|
6849
6870
|
|
|
6850
6871
|
// src/commands/news/web/shared.ts
|
|
6851
6872
|
import { decodeHTML } from "entities";
|
|
@@ -6981,17 +7002,17 @@ function prefetch() {
|
|
|
6981
7002
|
const config = loadConfig();
|
|
6982
7003
|
const total = config.news.feeds.length;
|
|
6983
7004
|
if (total === 0) return;
|
|
6984
|
-
process.stdout.write(
|
|
7005
|
+
process.stdout.write(chalk87.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6985
7006
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6986
7007
|
const width = 20;
|
|
6987
7008
|
const filled = Math.round(done2 / t * width);
|
|
6988
7009
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6989
7010
|
process.stdout.write(
|
|
6990
|
-
`\r${
|
|
7011
|
+
`\r${chalk87.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6991
7012
|
);
|
|
6992
7013
|
}).then((items) => {
|
|
6993
7014
|
process.stdout.write(
|
|
6994
|
-
`\r${
|
|
7015
|
+
`\r${chalk87.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6995
7016
|
`
|
|
6996
7017
|
);
|
|
6997
7018
|
cachedItems = items;
|
|
@@ -7352,20 +7373,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7352
7373
|
}
|
|
7353
7374
|
|
|
7354
7375
|
// src/commands/prs/listComments/printComments.ts
|
|
7355
|
-
import
|
|
7376
|
+
import chalk88 from "chalk";
|
|
7356
7377
|
function formatForHuman(comment3) {
|
|
7357
7378
|
if (comment3.type === "review") {
|
|
7358
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7379
|
+
const stateColor = comment3.state === "APPROVED" ? chalk88.green : comment3.state === "CHANGES_REQUESTED" ? chalk88.red : chalk88.yellow;
|
|
7359
7380
|
return [
|
|
7360
|
-
`${
|
|
7381
|
+
`${chalk88.cyan("Review")} by ${chalk88.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7361
7382
|
comment3.body,
|
|
7362
7383
|
""
|
|
7363
7384
|
].join("\n");
|
|
7364
7385
|
}
|
|
7365
7386
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7366
7387
|
return [
|
|
7367
|
-
`${
|
|
7368
|
-
|
|
7388
|
+
`${chalk88.cyan("Line comment")} by ${chalk88.bold(comment3.user)} on ${chalk88.dim(`${comment3.path}${location}`)}`,
|
|
7389
|
+
chalk88.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7369
7390
|
comment3.body,
|
|
7370
7391
|
""
|
|
7371
7392
|
].join("\n");
|
|
@@ -7455,13 +7476,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7455
7476
|
import enquirer8 from "enquirer";
|
|
7456
7477
|
|
|
7457
7478
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7458
|
-
import
|
|
7479
|
+
import chalk89 from "chalk";
|
|
7459
7480
|
var STATUS_MAP = {
|
|
7460
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7461
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
7481
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk89.magenta("merged"), date: pr.mergedAt } : null,
|
|
7482
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk89.red("closed"), date: pr.closedAt } : null
|
|
7462
7483
|
};
|
|
7463
7484
|
function defaultStatus(pr) {
|
|
7464
|
-
return { label:
|
|
7485
|
+
return { label: chalk89.green("opened"), date: pr.createdAt };
|
|
7465
7486
|
}
|
|
7466
7487
|
function getStatus2(pr) {
|
|
7467
7488
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7470,11 +7491,11 @@ function formatDate(dateStr) {
|
|
|
7470
7491
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7471
7492
|
}
|
|
7472
7493
|
function formatPrHeader(pr, status2) {
|
|
7473
|
-
return `${
|
|
7494
|
+
return `${chalk89.cyan(`#${pr.number}`)} ${pr.title} ${chalk89.dim(`(${pr.author.login},`)} ${status2.label} ${chalk89.dim(`${formatDate(status2.date)})`)}`;
|
|
7474
7495
|
}
|
|
7475
7496
|
function logPrDetails(pr) {
|
|
7476
7497
|
console.log(
|
|
7477
|
-
|
|
7498
|
+
chalk89.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7478
7499
|
);
|
|
7479
7500
|
console.log();
|
|
7480
7501
|
}
|
|
@@ -7640,10 +7661,10 @@ function registerPrs(program2) {
|
|
|
7640
7661
|
}
|
|
7641
7662
|
|
|
7642
7663
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7643
|
-
import
|
|
7664
|
+
import chalk95 from "chalk";
|
|
7644
7665
|
|
|
7645
7666
|
// src/shared/createConnectionAuth.ts
|
|
7646
|
-
import
|
|
7667
|
+
import chalk90 from "chalk";
|
|
7647
7668
|
function listConnections(connections, format2) {
|
|
7648
7669
|
if (connections.length === 0) {
|
|
7649
7670
|
console.log("No connections configured.");
|
|
@@ -7656,7 +7677,7 @@ function listConnections(connections, format2) {
|
|
|
7656
7677
|
function removeConnection(connections, name, save) {
|
|
7657
7678
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7658
7679
|
if (filtered.length === connections.length) {
|
|
7659
|
-
console.error(
|
|
7680
|
+
console.error(chalk90.red(`Connection "${name}" not found.`));
|
|
7660
7681
|
process.exit(1);
|
|
7661
7682
|
}
|
|
7662
7683
|
save(filtered);
|
|
@@ -7702,15 +7723,15 @@ function saveConnections(connections) {
|
|
|
7702
7723
|
}
|
|
7703
7724
|
|
|
7704
7725
|
// src/commands/ravendb/promptConnection.ts
|
|
7705
|
-
import
|
|
7726
|
+
import chalk93 from "chalk";
|
|
7706
7727
|
|
|
7707
7728
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7708
|
-
import
|
|
7729
|
+
import chalk92 from "chalk";
|
|
7709
7730
|
import Enquirer2 from "enquirer";
|
|
7710
7731
|
|
|
7711
7732
|
// src/commands/ravendb/searchItems.ts
|
|
7712
7733
|
import { execSync as execSync34 } from "child_process";
|
|
7713
|
-
import
|
|
7734
|
+
import chalk91 from "chalk";
|
|
7714
7735
|
function opExec(args) {
|
|
7715
7736
|
return execSync34(`op ${args}`, {
|
|
7716
7737
|
encoding: "utf-8",
|
|
@@ -7723,7 +7744,7 @@ function searchItems(search) {
|
|
|
7723
7744
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7724
7745
|
} catch {
|
|
7725
7746
|
console.error(
|
|
7726
|
-
|
|
7747
|
+
chalk91.red(
|
|
7727
7748
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7728
7749
|
)
|
|
7729
7750
|
);
|
|
@@ -7737,7 +7758,7 @@ function getItemFields(itemId) {
|
|
|
7737
7758
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7738
7759
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7739
7760
|
} catch {
|
|
7740
|
-
console.error(
|
|
7761
|
+
console.error(chalk91.red("Failed to get item details from 1Password."));
|
|
7741
7762
|
process.exit(1);
|
|
7742
7763
|
}
|
|
7743
7764
|
}
|
|
@@ -7756,7 +7777,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7756
7777
|
}).run();
|
|
7757
7778
|
const items = searchItems(search);
|
|
7758
7779
|
if (items.length === 0) {
|
|
7759
|
-
console.error(
|
|
7780
|
+
console.error(chalk92.red(`No items found matching "${search}".`));
|
|
7760
7781
|
process.exit(1);
|
|
7761
7782
|
}
|
|
7762
7783
|
const itemId = await selectOne(
|
|
@@ -7765,7 +7786,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7765
7786
|
);
|
|
7766
7787
|
const fields = getItemFields(itemId);
|
|
7767
7788
|
if (fields.length === 0) {
|
|
7768
|
-
console.error(
|
|
7789
|
+
console.error(chalk92.red("No fields with references found on this item."));
|
|
7769
7790
|
process.exit(1);
|
|
7770
7791
|
}
|
|
7771
7792
|
const ref = await selectOne(
|
|
@@ -7779,7 +7800,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7779
7800
|
async function promptConnection(existingNames) {
|
|
7780
7801
|
const name = await promptInput("name", "Connection name:");
|
|
7781
7802
|
if (existingNames.includes(name)) {
|
|
7782
|
-
console.error(
|
|
7803
|
+
console.error(chalk93.red(`Connection "${name}" already exists.`));
|
|
7783
7804
|
process.exit(1);
|
|
7784
7805
|
}
|
|
7785
7806
|
const url = await promptInput(
|
|
@@ -7788,22 +7809,22 @@ async function promptConnection(existingNames) {
|
|
|
7788
7809
|
);
|
|
7789
7810
|
const database = await promptInput("database", "Database name:");
|
|
7790
7811
|
if (!name || !url || !database) {
|
|
7791
|
-
console.error(
|
|
7812
|
+
console.error(chalk93.red("All fields are required."));
|
|
7792
7813
|
process.exit(1);
|
|
7793
7814
|
}
|
|
7794
7815
|
const apiKeyRef = await selectOpSecret();
|
|
7795
|
-
console.log(
|
|
7816
|
+
console.log(chalk93.dim(`Using: ${apiKeyRef}`));
|
|
7796
7817
|
return { name, url, database, apiKeyRef };
|
|
7797
7818
|
}
|
|
7798
7819
|
|
|
7799
7820
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7800
|
-
import
|
|
7821
|
+
import chalk94 from "chalk";
|
|
7801
7822
|
function ravendbSetConnection(name) {
|
|
7802
7823
|
const raw = loadGlobalConfigRaw();
|
|
7803
7824
|
const ravendb = raw.ravendb ?? {};
|
|
7804
7825
|
const connections = ravendb.connections ?? [];
|
|
7805
7826
|
if (!connections.some((c) => c.name === name)) {
|
|
7806
|
-
console.error(
|
|
7827
|
+
console.error(chalk94.red(`Connection "${name}" not found.`));
|
|
7807
7828
|
console.error(
|
|
7808
7829
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7809
7830
|
);
|
|
@@ -7819,16 +7840,16 @@ function ravendbSetConnection(name) {
|
|
|
7819
7840
|
var ravendbAuth = createConnectionAuth({
|
|
7820
7841
|
load: loadConnections,
|
|
7821
7842
|
save: saveConnections,
|
|
7822
|
-
format: (c) => `${
|
|
7843
|
+
format: (c) => `${chalk95.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7823
7844
|
promptNew: promptConnection,
|
|
7824
7845
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7825
7846
|
});
|
|
7826
7847
|
|
|
7827
7848
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7828
|
-
import
|
|
7849
|
+
import chalk99 from "chalk";
|
|
7829
7850
|
|
|
7830
7851
|
// src/commands/ravendb/ravenFetch.ts
|
|
7831
|
-
import
|
|
7852
|
+
import chalk97 from "chalk";
|
|
7832
7853
|
|
|
7833
7854
|
// src/commands/ravendb/getAccessToken.ts
|
|
7834
7855
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7865,10 +7886,10 @@ ${errorText}`
|
|
|
7865
7886
|
|
|
7866
7887
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7867
7888
|
import { execSync as execSync35 } from "child_process";
|
|
7868
|
-
import
|
|
7889
|
+
import chalk96 from "chalk";
|
|
7869
7890
|
function resolveOpSecret(reference) {
|
|
7870
7891
|
if (!reference.startsWith("op://")) {
|
|
7871
|
-
console.error(
|
|
7892
|
+
console.error(chalk96.red(`Invalid secret reference: must start with op://`));
|
|
7872
7893
|
process.exit(1);
|
|
7873
7894
|
}
|
|
7874
7895
|
try {
|
|
@@ -7878,7 +7899,7 @@ function resolveOpSecret(reference) {
|
|
|
7878
7899
|
}).trim();
|
|
7879
7900
|
} catch {
|
|
7880
7901
|
console.error(
|
|
7881
|
-
|
|
7902
|
+
chalk96.red(
|
|
7882
7903
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7883
7904
|
)
|
|
7884
7905
|
);
|
|
@@ -7905,7 +7926,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7905
7926
|
if (!response.ok) {
|
|
7906
7927
|
const body = await response.text();
|
|
7907
7928
|
console.error(
|
|
7908
|
-
|
|
7929
|
+
chalk97.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7909
7930
|
);
|
|
7910
7931
|
console.error(body.substring(0, 500));
|
|
7911
7932
|
process.exit(1);
|
|
@@ -7914,7 +7935,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7914
7935
|
}
|
|
7915
7936
|
|
|
7916
7937
|
// src/commands/ravendb/resolveConnection.ts
|
|
7917
|
-
import
|
|
7938
|
+
import chalk98 from "chalk";
|
|
7918
7939
|
function loadRavendb() {
|
|
7919
7940
|
const raw = loadGlobalConfigRaw();
|
|
7920
7941
|
const ravendb = raw.ravendb;
|
|
@@ -7928,7 +7949,7 @@ function resolveConnection(name) {
|
|
|
7928
7949
|
const connectionName = name ?? defaultConnection;
|
|
7929
7950
|
if (!connectionName) {
|
|
7930
7951
|
console.error(
|
|
7931
|
-
|
|
7952
|
+
chalk98.red(
|
|
7932
7953
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7933
7954
|
)
|
|
7934
7955
|
);
|
|
@@ -7936,7 +7957,7 @@ function resolveConnection(name) {
|
|
|
7936
7957
|
}
|
|
7937
7958
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7938
7959
|
if (!connection) {
|
|
7939
|
-
console.error(
|
|
7960
|
+
console.error(chalk98.red(`Connection "${connectionName}" not found.`));
|
|
7940
7961
|
console.error(
|
|
7941
7962
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7942
7963
|
);
|
|
@@ -7967,15 +7988,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7967
7988
|
return;
|
|
7968
7989
|
}
|
|
7969
7990
|
for (const c of collections) {
|
|
7970
|
-
console.log(`${
|
|
7991
|
+
console.log(`${chalk99.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7971
7992
|
}
|
|
7972
7993
|
}
|
|
7973
7994
|
|
|
7974
7995
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7975
|
-
import
|
|
7996
|
+
import chalk101 from "chalk";
|
|
7976
7997
|
|
|
7977
7998
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7978
|
-
import
|
|
7999
|
+
import chalk100 from "chalk";
|
|
7979
8000
|
|
|
7980
8001
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7981
8002
|
function buildQueryPath(opts) {
|
|
@@ -8013,7 +8034,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8013
8034
|
allResults.push(...results);
|
|
8014
8035
|
start3 += results.length;
|
|
8015
8036
|
process.stderr.write(
|
|
8016
|
-
`\r${
|
|
8037
|
+
`\r${chalk100.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8017
8038
|
);
|
|
8018
8039
|
if (start3 >= totalResults) break;
|
|
8019
8040
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8028,7 +8049,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8028
8049
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8029
8050
|
const resolved = resolveArgs(connectionName, collection);
|
|
8030
8051
|
if (!resolved.collection && !options2.query) {
|
|
8031
|
-
console.error(
|
|
8052
|
+
console.error(chalk101.red("Provide a collection name or --query filter."));
|
|
8032
8053
|
process.exit(1);
|
|
8033
8054
|
}
|
|
8034
8055
|
const { collection: col } = resolved;
|
|
@@ -8066,7 +8087,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8066
8087
|
import * as path27 from "path";
|
|
8067
8088
|
|
|
8068
8089
|
// src/commands/refactor/logViolations.ts
|
|
8069
|
-
import
|
|
8090
|
+
import chalk102 from "chalk";
|
|
8070
8091
|
var DEFAULT_MAX_LINES = 100;
|
|
8071
8092
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8072
8093
|
if (violations.length === 0) {
|
|
@@ -8075,43 +8096,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8075
8096
|
}
|
|
8076
8097
|
return;
|
|
8077
8098
|
}
|
|
8078
|
-
console.error(
|
|
8099
|
+
console.error(chalk102.red(`
|
|
8079
8100
|
Refactor check failed:
|
|
8080
8101
|
`));
|
|
8081
|
-
console.error(
|
|
8102
|
+
console.error(chalk102.red(` The following files exceed ${maxLines} lines:
|
|
8082
8103
|
`));
|
|
8083
8104
|
for (const violation of violations) {
|
|
8084
|
-
console.error(
|
|
8105
|
+
console.error(chalk102.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8085
8106
|
}
|
|
8086
8107
|
console.error(
|
|
8087
|
-
|
|
8108
|
+
chalk102.yellow(
|
|
8088
8109
|
`
|
|
8089
8110
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8090
8111
|
way to refactor it, ignore it with:
|
|
8091
8112
|
`
|
|
8092
8113
|
)
|
|
8093
8114
|
);
|
|
8094
|
-
console.error(
|
|
8115
|
+
console.error(chalk102.gray(` assist refactor ignore <file>
|
|
8095
8116
|
`));
|
|
8096
8117
|
if (process.env.CLAUDECODE) {
|
|
8097
|
-
console.error(
|
|
8118
|
+
console.error(chalk102.cyan(`
|
|
8098
8119
|
## Extracting Code to New Files
|
|
8099
8120
|
`));
|
|
8100
8121
|
console.error(
|
|
8101
|
-
|
|
8122
|
+
chalk102.cyan(
|
|
8102
8123
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8103
8124
|
`
|
|
8104
8125
|
)
|
|
8105
8126
|
);
|
|
8106
8127
|
console.error(
|
|
8107
|
-
|
|
8128
|
+
chalk102.cyan(
|
|
8108
8129
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8109
8130
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8110
8131
|
`
|
|
8111
8132
|
)
|
|
8112
8133
|
);
|
|
8113
8134
|
console.error(
|
|
8114
|
-
|
|
8135
|
+
chalk102.cyan(
|
|
8115
8136
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8116
8137
|
domains, move it to a common/shared folder.
|
|
8117
8138
|
`
|
|
@@ -8267,7 +8288,7 @@ async function check(pattern2, options2) {
|
|
|
8267
8288
|
|
|
8268
8289
|
// src/commands/refactor/extract/index.ts
|
|
8269
8290
|
import path33 from "path";
|
|
8270
|
-
import
|
|
8291
|
+
import chalk105 from "chalk";
|
|
8271
8292
|
|
|
8272
8293
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8273
8294
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8814,23 +8835,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8814
8835
|
|
|
8815
8836
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8816
8837
|
import path31 from "path";
|
|
8817
|
-
import
|
|
8838
|
+
import chalk103 from "chalk";
|
|
8818
8839
|
function section(title) {
|
|
8819
8840
|
return `
|
|
8820
|
-
${
|
|
8841
|
+
${chalk103.cyan(title)}`;
|
|
8821
8842
|
}
|
|
8822
8843
|
function displayImporters(plan2, cwd) {
|
|
8823
8844
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8824
8845
|
console.log(section("Update importers:"));
|
|
8825
8846
|
for (const imp of plan2.importersToUpdate) {
|
|
8826
8847
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8827
|
-
console.log(` ${
|
|
8848
|
+
console.log(` ${chalk103.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8828
8849
|
}
|
|
8829
8850
|
}
|
|
8830
8851
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8831
|
-
console.log(
|
|
8852
|
+
console.log(chalk103.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8832
8853
|
`));
|
|
8833
|
-
console.log(` ${
|
|
8854
|
+
console.log(` ${chalk103.cyan("Functions to move:")}`);
|
|
8834
8855
|
for (const name of plan2.extractedNames) {
|
|
8835
8856
|
console.log(` ${name}`);
|
|
8836
8857
|
}
|
|
@@ -8865,7 +8886,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8865
8886
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8866
8887
|
import fs17 from "fs";
|
|
8867
8888
|
import path32 from "path";
|
|
8868
|
-
import
|
|
8889
|
+
import chalk104 from "chalk";
|
|
8869
8890
|
import { Project as Project2 } from "ts-morph";
|
|
8870
8891
|
function findTsConfig(sourcePath) {
|
|
8871
8892
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8896,7 +8917,7 @@ function loadProjectFile(file) {
|
|
|
8896
8917
|
});
|
|
8897
8918
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8898
8919
|
if (!sourceFile) {
|
|
8899
|
-
console.log(
|
|
8920
|
+
console.log(chalk104.red(`File not found in project: ${file}`));
|
|
8900
8921
|
process.exit(1);
|
|
8901
8922
|
}
|
|
8902
8923
|
return { project, sourceFile };
|
|
@@ -8919,19 +8940,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8919
8940
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8920
8941
|
if (options2.apply) {
|
|
8921
8942
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8922
|
-
console.log(
|
|
8943
|
+
console.log(chalk105.green("\nExtraction complete"));
|
|
8923
8944
|
} else {
|
|
8924
|
-
console.log(
|
|
8945
|
+
console.log(chalk105.dim("\nDry run. Use --apply to execute."));
|
|
8925
8946
|
}
|
|
8926
8947
|
}
|
|
8927
8948
|
|
|
8928
8949
|
// src/commands/refactor/ignore.ts
|
|
8929
8950
|
import fs18 from "fs";
|
|
8930
|
-
import
|
|
8951
|
+
import chalk106 from "chalk";
|
|
8931
8952
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8932
8953
|
function ignore(file) {
|
|
8933
8954
|
if (!fs18.existsSync(file)) {
|
|
8934
|
-
console.error(
|
|
8955
|
+
console.error(chalk106.red(`Error: File does not exist: ${file}`));
|
|
8935
8956
|
process.exit(1);
|
|
8936
8957
|
}
|
|
8937
8958
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8947,7 +8968,7 @@ function ignore(file) {
|
|
|
8947
8968
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8948
8969
|
}
|
|
8949
8970
|
console.log(
|
|
8950
|
-
|
|
8971
|
+
chalk106.green(
|
|
8951
8972
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8952
8973
|
)
|
|
8953
8974
|
);
|
|
@@ -8955,26 +8976,26 @@ function ignore(file) {
|
|
|
8955
8976
|
|
|
8956
8977
|
// src/commands/refactor/rename/index.ts
|
|
8957
8978
|
import path34 from "path";
|
|
8958
|
-
import
|
|
8979
|
+
import chalk107 from "chalk";
|
|
8959
8980
|
async function rename(source, destination, options2 = {}) {
|
|
8960
8981
|
const destPath = path34.resolve(destination);
|
|
8961
8982
|
const cwd = process.cwd();
|
|
8962
8983
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8963
8984
|
const relDest = path34.relative(cwd, destPath);
|
|
8964
8985
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8965
|
-
console.log(
|
|
8986
|
+
console.log(chalk107.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8966
8987
|
if (options2.apply) {
|
|
8967
8988
|
sourceFile.move(destPath);
|
|
8968
8989
|
await project.save();
|
|
8969
|
-
console.log(
|
|
8990
|
+
console.log(chalk107.green("Done"));
|
|
8970
8991
|
} else {
|
|
8971
|
-
console.log(
|
|
8992
|
+
console.log(chalk107.dim("Dry run. Use --apply to execute."));
|
|
8972
8993
|
}
|
|
8973
8994
|
}
|
|
8974
8995
|
|
|
8975
8996
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8976
8997
|
import path36 from "path";
|
|
8977
|
-
import
|
|
8998
|
+
import chalk108 from "chalk";
|
|
8978
8999
|
import { Project as Project3 } from "ts-morph";
|
|
8979
9000
|
|
|
8980
9001
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9023,38 +9044,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9023
9044
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9024
9045
|
const sourceFile = project.getSourceFile(filePath);
|
|
9025
9046
|
if (!sourceFile) {
|
|
9026
|
-
console.log(
|
|
9047
|
+
console.log(chalk108.red(`File not found in project: ${file}`));
|
|
9027
9048
|
process.exit(1);
|
|
9028
9049
|
}
|
|
9029
9050
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9030
9051
|
if (!symbol) {
|
|
9031
|
-
console.log(
|
|
9052
|
+
console.log(chalk108.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9032
9053
|
process.exit(1);
|
|
9033
9054
|
}
|
|
9034
9055
|
const grouped = groupReferences(symbol, cwd);
|
|
9035
9056
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9036
9057
|
console.log(
|
|
9037
|
-
|
|
9058
|
+
chalk108.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9038
9059
|
`)
|
|
9039
9060
|
);
|
|
9040
9061
|
for (const [refFile, lines] of grouped) {
|
|
9041
9062
|
console.log(
|
|
9042
|
-
` ${
|
|
9063
|
+
` ${chalk108.dim(refFile)}: lines ${chalk108.cyan(lines.join(", "))}`
|
|
9043
9064
|
);
|
|
9044
9065
|
}
|
|
9045
9066
|
if (options2.apply) {
|
|
9046
9067
|
symbol.rename(newName);
|
|
9047
9068
|
await project.save();
|
|
9048
|
-
console.log(
|
|
9069
|
+
console.log(chalk108.green(`
|
|
9049
9070
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9050
9071
|
} else {
|
|
9051
|
-
console.log(
|
|
9072
|
+
console.log(chalk108.dim("\nDry run. Use --apply to execute."));
|
|
9052
9073
|
}
|
|
9053
9074
|
}
|
|
9054
9075
|
|
|
9055
9076
|
// src/commands/refactor/restructure/index.ts
|
|
9056
9077
|
import path45 from "path";
|
|
9057
|
-
import
|
|
9078
|
+
import chalk111 from "chalk";
|
|
9058
9079
|
|
|
9059
9080
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9060
9081
|
import path37 from "path";
|
|
@@ -9297,50 +9318,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9297
9318
|
|
|
9298
9319
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9299
9320
|
import path41 from "path";
|
|
9300
|
-
import
|
|
9321
|
+
import chalk109 from "chalk";
|
|
9301
9322
|
function relPath(filePath) {
|
|
9302
9323
|
return path41.relative(process.cwd(), filePath);
|
|
9303
9324
|
}
|
|
9304
9325
|
function displayMoves(plan2) {
|
|
9305
9326
|
if (plan2.moves.length === 0) return;
|
|
9306
|
-
console.log(
|
|
9327
|
+
console.log(chalk109.bold("\nFile moves:"));
|
|
9307
9328
|
for (const move of plan2.moves) {
|
|
9308
9329
|
console.log(
|
|
9309
|
-
` ${
|
|
9330
|
+
` ${chalk109.red(relPath(move.from))} \u2192 ${chalk109.green(relPath(move.to))}`
|
|
9310
9331
|
);
|
|
9311
|
-
console.log(
|
|
9332
|
+
console.log(chalk109.dim(` ${move.reason}`));
|
|
9312
9333
|
}
|
|
9313
9334
|
}
|
|
9314
9335
|
function displayRewrites(rewrites) {
|
|
9315
9336
|
if (rewrites.length === 0) return;
|
|
9316
9337
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9317
|
-
console.log(
|
|
9338
|
+
console.log(chalk109.bold(`
|
|
9318
9339
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9319
9340
|
for (const file of affectedFiles) {
|
|
9320
|
-
console.log(` ${
|
|
9341
|
+
console.log(` ${chalk109.cyan(relPath(file))}:`);
|
|
9321
9342
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9322
9343
|
(r) => r.file === file
|
|
9323
9344
|
)) {
|
|
9324
9345
|
console.log(
|
|
9325
|
-
` ${
|
|
9346
|
+
` ${chalk109.red(`"${oldSpecifier}"`)} \u2192 ${chalk109.green(`"${newSpecifier}"`)}`
|
|
9326
9347
|
);
|
|
9327
9348
|
}
|
|
9328
9349
|
}
|
|
9329
9350
|
}
|
|
9330
9351
|
function displayPlan2(plan2) {
|
|
9331
9352
|
if (plan2.warnings.length > 0) {
|
|
9332
|
-
console.log(
|
|
9333
|
-
for (const w of plan2.warnings) console.log(
|
|
9353
|
+
console.log(chalk109.yellow("\nWarnings:"));
|
|
9354
|
+
for (const w of plan2.warnings) console.log(chalk109.yellow(` ${w}`));
|
|
9334
9355
|
}
|
|
9335
9356
|
if (plan2.newDirectories.length > 0) {
|
|
9336
|
-
console.log(
|
|
9357
|
+
console.log(chalk109.bold("\nNew directories:"));
|
|
9337
9358
|
for (const dir of plan2.newDirectories)
|
|
9338
|
-
console.log(
|
|
9359
|
+
console.log(chalk109.green(` ${dir}/`));
|
|
9339
9360
|
}
|
|
9340
9361
|
displayMoves(plan2);
|
|
9341
9362
|
displayRewrites(plan2.rewrites);
|
|
9342
9363
|
console.log(
|
|
9343
|
-
|
|
9364
|
+
chalk109.dim(
|
|
9344
9365
|
`
|
|
9345
9366
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9346
9367
|
)
|
|
@@ -9350,18 +9371,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9350
9371
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9351
9372
|
import fs20 from "fs";
|
|
9352
9373
|
import path42 from "path";
|
|
9353
|
-
import
|
|
9374
|
+
import chalk110 from "chalk";
|
|
9354
9375
|
function executePlan(plan2) {
|
|
9355
9376
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9356
9377
|
for (const [file, content] of updatedContents) {
|
|
9357
9378
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9358
9379
|
console.log(
|
|
9359
|
-
|
|
9380
|
+
chalk110.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9360
9381
|
);
|
|
9361
9382
|
}
|
|
9362
9383
|
for (const dir of plan2.newDirectories) {
|
|
9363
9384
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9364
|
-
console.log(
|
|
9385
|
+
console.log(chalk110.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9365
9386
|
}
|
|
9366
9387
|
for (const move of plan2.moves) {
|
|
9367
9388
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9370,7 +9391,7 @@ function executePlan(plan2) {
|
|
|
9370
9391
|
}
|
|
9371
9392
|
fs20.renameSync(move.from, move.to);
|
|
9372
9393
|
console.log(
|
|
9373
|
-
|
|
9394
|
+
chalk110.white(
|
|
9374
9395
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9375
9396
|
)
|
|
9376
9397
|
);
|
|
@@ -9385,7 +9406,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9385
9406
|
if (entries.length === 0) {
|
|
9386
9407
|
fs20.rmdirSync(dir);
|
|
9387
9408
|
console.log(
|
|
9388
|
-
|
|
9409
|
+
chalk110.dim(
|
|
9389
9410
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9390
9411
|
)
|
|
9391
9412
|
);
|
|
@@ -9518,22 +9539,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9518
9539
|
const targetPattern = pattern2 ?? "src";
|
|
9519
9540
|
const files = findSourceFiles2(targetPattern);
|
|
9520
9541
|
if (files.length === 0) {
|
|
9521
|
-
console.log(
|
|
9542
|
+
console.log(chalk111.yellow("No files found matching pattern"));
|
|
9522
9543
|
return;
|
|
9523
9544
|
}
|
|
9524
9545
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9525
9546
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9526
9547
|
if (plan2.moves.length === 0) {
|
|
9527
|
-
console.log(
|
|
9548
|
+
console.log(chalk111.green("No restructuring needed"));
|
|
9528
9549
|
return;
|
|
9529
9550
|
}
|
|
9530
9551
|
displayPlan2(plan2);
|
|
9531
9552
|
if (options2.apply) {
|
|
9532
|
-
console.log(
|
|
9553
|
+
console.log(chalk111.bold("\nApplying changes..."));
|
|
9533
9554
|
executePlan(plan2);
|
|
9534
|
-
console.log(
|
|
9555
|
+
console.log(chalk111.green("\nRestructuring complete"));
|
|
9535
9556
|
} else {
|
|
9536
|
-
console.log(
|
|
9557
|
+
console.log(chalk111.dim("\nDry run. Use --apply to execute."));
|
|
9537
9558
|
}
|
|
9538
9559
|
}
|
|
9539
9560
|
|
|
@@ -9573,7 +9594,7 @@ function registerRefactor(program2) {
|
|
|
9573
9594
|
}
|
|
9574
9595
|
|
|
9575
9596
|
// src/commands/seq/seqAuth.ts
|
|
9576
|
-
import
|
|
9597
|
+
import chalk113 from "chalk";
|
|
9577
9598
|
|
|
9578
9599
|
// src/commands/seq/loadConnections.ts
|
|
9579
9600
|
function loadConnections2() {
|
|
@@ -9602,11 +9623,11 @@ function setDefaultConnection(name) {
|
|
|
9602
9623
|
}
|
|
9603
9624
|
|
|
9604
9625
|
// src/commands/seq/promptConnection.ts
|
|
9605
|
-
import
|
|
9626
|
+
import chalk112 from "chalk";
|
|
9606
9627
|
async function promptConnection2(existingNames) {
|
|
9607
9628
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9608
9629
|
if (existingNames.includes(name)) {
|
|
9609
|
-
console.error(
|
|
9630
|
+
console.error(chalk112.red(`Connection "${name}" already exists.`));
|
|
9610
9631
|
process.exit(1);
|
|
9611
9632
|
}
|
|
9612
9633
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9618,16 +9639,16 @@ async function promptConnection2(existingNames) {
|
|
|
9618
9639
|
var seqAuth = createConnectionAuth({
|
|
9619
9640
|
load: loadConnections2,
|
|
9620
9641
|
save: saveConnections2,
|
|
9621
|
-
format: (c) => `${
|
|
9642
|
+
format: (c) => `${chalk113.bold(c.name)} ${c.url}`,
|
|
9622
9643
|
promptNew: promptConnection2,
|
|
9623
9644
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9624
9645
|
});
|
|
9625
9646
|
|
|
9626
9647
|
// src/commands/seq/seqQuery.ts
|
|
9627
|
-
import
|
|
9648
|
+
import chalk117 from "chalk";
|
|
9628
9649
|
|
|
9629
9650
|
// src/commands/seq/fetchSeq.ts
|
|
9630
|
-
import
|
|
9651
|
+
import chalk114 from "chalk";
|
|
9631
9652
|
async function fetchSeq(conn, path50, params) {
|
|
9632
9653
|
const url = `${conn.url}${path50}?${params}`;
|
|
9633
9654
|
const response = await fetch(url, {
|
|
@@ -9638,7 +9659,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9638
9659
|
});
|
|
9639
9660
|
if (!response.ok) {
|
|
9640
9661
|
const body = await response.text();
|
|
9641
|
-
console.error(
|
|
9662
|
+
console.error(chalk114.red(`Seq returned ${response.status}: ${body}`));
|
|
9642
9663
|
process.exit(1);
|
|
9643
9664
|
}
|
|
9644
9665
|
return response;
|
|
@@ -9691,23 +9712,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9691
9712
|
}
|
|
9692
9713
|
|
|
9693
9714
|
// src/commands/seq/formatEvent.ts
|
|
9694
|
-
import
|
|
9715
|
+
import chalk115 from "chalk";
|
|
9695
9716
|
function levelColor(level) {
|
|
9696
9717
|
switch (level) {
|
|
9697
9718
|
case "Fatal":
|
|
9698
|
-
return
|
|
9719
|
+
return chalk115.bgRed.white;
|
|
9699
9720
|
case "Error":
|
|
9700
|
-
return
|
|
9721
|
+
return chalk115.red;
|
|
9701
9722
|
case "Warning":
|
|
9702
|
-
return
|
|
9723
|
+
return chalk115.yellow;
|
|
9703
9724
|
case "Information":
|
|
9704
|
-
return
|
|
9725
|
+
return chalk115.cyan;
|
|
9705
9726
|
case "Debug":
|
|
9706
|
-
return
|
|
9727
|
+
return chalk115.gray;
|
|
9707
9728
|
case "Verbose":
|
|
9708
|
-
return
|
|
9729
|
+
return chalk115.dim;
|
|
9709
9730
|
default:
|
|
9710
|
-
return
|
|
9731
|
+
return chalk115.white;
|
|
9711
9732
|
}
|
|
9712
9733
|
}
|
|
9713
9734
|
function levelAbbrev(level) {
|
|
@@ -9748,31 +9769,31 @@ function formatTimestamp(iso) {
|
|
|
9748
9769
|
function formatEvent(event) {
|
|
9749
9770
|
const color = levelColor(event.Level);
|
|
9750
9771
|
const abbrev = levelAbbrev(event.Level);
|
|
9751
|
-
const ts8 =
|
|
9772
|
+
const ts8 = chalk115.dim(formatTimestamp(event.Timestamp));
|
|
9752
9773
|
const msg = renderMessage(event);
|
|
9753
9774
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9754
9775
|
if (event.Exception) {
|
|
9755
9776
|
for (const line of event.Exception.split("\n")) {
|
|
9756
|
-
lines.push(
|
|
9777
|
+
lines.push(chalk115.red(` ${line}`));
|
|
9757
9778
|
}
|
|
9758
9779
|
}
|
|
9759
9780
|
return lines.join("\n");
|
|
9760
9781
|
}
|
|
9761
9782
|
|
|
9762
9783
|
// src/commands/seq/resolveConnection.ts
|
|
9763
|
-
import
|
|
9784
|
+
import chalk116 from "chalk";
|
|
9764
9785
|
function resolveConnection2(name) {
|
|
9765
9786
|
const connections = loadConnections2();
|
|
9766
9787
|
if (connections.length === 0) {
|
|
9767
9788
|
console.error(
|
|
9768
|
-
|
|
9789
|
+
chalk116.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9769
9790
|
);
|
|
9770
9791
|
process.exit(1);
|
|
9771
9792
|
}
|
|
9772
9793
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9773
9794
|
const connection = connections.find((c) => c.name === target);
|
|
9774
9795
|
if (!connection) {
|
|
9775
|
-
console.error(
|
|
9796
|
+
console.error(chalk116.red(`Seq connection "${target}" not found.`));
|
|
9776
9797
|
process.exit(1);
|
|
9777
9798
|
}
|
|
9778
9799
|
return connection;
|
|
@@ -9787,7 +9808,7 @@ async function seqQuery(filter, options2) {
|
|
|
9787
9808
|
new URLSearchParams({ filter, count: String(count) })
|
|
9788
9809
|
);
|
|
9789
9810
|
if (events.length === 0) {
|
|
9790
|
-
console.log(
|
|
9811
|
+
console.log(chalk117.yellow("No events found."));
|
|
9791
9812
|
return;
|
|
9792
9813
|
}
|
|
9793
9814
|
if (options2.json) {
|
|
@@ -9798,11 +9819,11 @@ async function seqQuery(filter, options2) {
|
|
|
9798
9819
|
for (const event of chronological) {
|
|
9799
9820
|
console.log(formatEvent(event));
|
|
9800
9821
|
}
|
|
9801
|
-
console.log(
|
|
9822
|
+
console.log(chalk117.dim(`
|
|
9802
9823
|
${events.length} events`));
|
|
9803
9824
|
if (events.length >= count) {
|
|
9804
9825
|
console.log(
|
|
9805
|
-
|
|
9826
|
+
chalk117.yellow(
|
|
9806
9827
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9807
9828
|
)
|
|
9808
9829
|
);
|
|
@@ -9810,11 +9831,11 @@ ${events.length} events`));
|
|
|
9810
9831
|
}
|
|
9811
9832
|
|
|
9812
9833
|
// src/commands/seq/seqSetConnection.ts
|
|
9813
|
-
import
|
|
9834
|
+
import chalk118 from "chalk";
|
|
9814
9835
|
function seqSetConnection(name) {
|
|
9815
9836
|
const connections = loadConnections2();
|
|
9816
9837
|
if (!connections.find((c) => c.name === name)) {
|
|
9817
|
-
console.error(
|
|
9838
|
+
console.error(chalk118.red(`Connection "${name}" not found.`));
|
|
9818
9839
|
process.exit(1);
|
|
9819
9840
|
}
|
|
9820
9841
|
setDefaultConnection(name);
|
|
@@ -10353,14 +10374,14 @@ import {
|
|
|
10353
10374
|
import { dirname as dirname20, join as join33 } from "path";
|
|
10354
10375
|
|
|
10355
10376
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10356
|
-
import
|
|
10377
|
+
import chalk119 from "chalk";
|
|
10357
10378
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10358
10379
|
function validateStagedContent(filename, content) {
|
|
10359
10380
|
const firstLine = content.split("\n")[0];
|
|
10360
10381
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10361
10382
|
if (!match) {
|
|
10362
10383
|
console.error(
|
|
10363
|
-
|
|
10384
|
+
chalk119.red(
|
|
10364
10385
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10365
10386
|
)
|
|
10366
10387
|
);
|
|
@@ -10369,7 +10390,7 @@ function validateStagedContent(filename, content) {
|
|
|
10369
10390
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10370
10391
|
if (!contentAfterLink) {
|
|
10371
10392
|
console.error(
|
|
10372
|
-
|
|
10393
|
+
chalk119.red(
|
|
10373
10394
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10374
10395
|
)
|
|
10375
10396
|
);
|
|
@@ -10762,7 +10783,7 @@ function registerVoice(program2) {
|
|
|
10762
10783
|
|
|
10763
10784
|
// src/commands/roam/auth.ts
|
|
10764
10785
|
import { randomBytes } from "crypto";
|
|
10765
|
-
import
|
|
10786
|
+
import chalk120 from "chalk";
|
|
10766
10787
|
|
|
10767
10788
|
// src/lib/openBrowser.ts
|
|
10768
10789
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10937,13 +10958,13 @@ async function auth() {
|
|
|
10937
10958
|
saveGlobalConfig(config);
|
|
10938
10959
|
const state = randomBytes(16).toString("hex");
|
|
10939
10960
|
console.log(
|
|
10940
|
-
|
|
10961
|
+
chalk120.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10941
10962
|
);
|
|
10942
|
-
console.log(
|
|
10943
|
-
console.log(
|
|
10944
|
-
console.log(
|
|
10963
|
+
console.log(chalk120.white("http://localhost:14523/callback\n"));
|
|
10964
|
+
console.log(chalk120.blue("Opening browser for authorization..."));
|
|
10965
|
+
console.log(chalk120.dim("Waiting for authorization callback..."));
|
|
10945
10966
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10946
|
-
console.log(
|
|
10967
|
+
console.log(chalk120.dim("Exchanging code for tokens..."));
|
|
10947
10968
|
const tokens = await exchangeToken({
|
|
10948
10969
|
code,
|
|
10949
10970
|
clientId,
|
|
@@ -10959,7 +10980,7 @@ async function auth() {
|
|
|
10959
10980
|
};
|
|
10960
10981
|
saveGlobalConfig(config);
|
|
10961
10982
|
console.log(
|
|
10962
|
-
|
|
10983
|
+
chalk120.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10963
10984
|
);
|
|
10964
10985
|
}
|
|
10965
10986
|
|
|
@@ -11172,7 +11193,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11172
11193
|
import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11173
11194
|
import { tmpdir as tmpdir6 } from "os";
|
|
11174
11195
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11175
|
-
import
|
|
11196
|
+
import chalk121 from "chalk";
|
|
11176
11197
|
|
|
11177
11198
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11178
11199
|
var captureWindowPs1 = `
|
|
@@ -11323,22 +11344,22 @@ function screenshot(processName) {
|
|
|
11323
11344
|
const config = loadConfig();
|
|
11324
11345
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11325
11346
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11326
|
-
console.log(
|
|
11347
|
+
console.log(chalk121.gray(`Capturing window for process "${processName}" ...`));
|
|
11327
11348
|
try {
|
|
11328
11349
|
runPowerShellScript(processName, outputPath);
|
|
11329
|
-
console.log(
|
|
11350
|
+
console.log(chalk121.green(`Screenshot saved: ${outputPath}`));
|
|
11330
11351
|
} catch (error) {
|
|
11331
11352
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11332
|
-
console.error(
|
|
11353
|
+
console.error(chalk121.red(`Failed to capture screenshot: ${msg}`));
|
|
11333
11354
|
process.exit(1);
|
|
11334
11355
|
}
|
|
11335
11356
|
}
|
|
11336
11357
|
|
|
11337
11358
|
// src/commands/statusLine.ts
|
|
11338
|
-
import
|
|
11359
|
+
import chalk123 from "chalk";
|
|
11339
11360
|
|
|
11340
11361
|
// src/commands/buildLimitsSegment.ts
|
|
11341
|
-
import
|
|
11362
|
+
import chalk122 from "chalk";
|
|
11342
11363
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11343
11364
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11344
11365
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11361,10 +11382,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11361
11382
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11362
11383
|
const label2 = `${Math.round(pct)}%`;
|
|
11363
11384
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11364
|
-
if (projected == null) return
|
|
11365
|
-
if (projected > 100) return
|
|
11366
|
-
if (projected > 75) return
|
|
11367
|
-
return
|
|
11385
|
+
if (projected == null) return chalk122.green(label2);
|
|
11386
|
+
if (projected > 100) return chalk122.red(label2);
|
|
11387
|
+
if (projected > 75) return chalk122.yellow(label2);
|
|
11388
|
+
return chalk122.green(label2);
|
|
11368
11389
|
}
|
|
11369
11390
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11370
11391
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11390,14 +11411,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11390
11411
|
}
|
|
11391
11412
|
|
|
11392
11413
|
// src/commands/statusLine.ts
|
|
11393
|
-
|
|
11414
|
+
chalk123.level = 3;
|
|
11394
11415
|
function formatNumber(num) {
|
|
11395
11416
|
return num.toLocaleString("en-US");
|
|
11396
11417
|
}
|
|
11397
11418
|
function colorizePercent(pct) {
|
|
11398
11419
|
const label2 = `${Math.round(pct)}%`;
|
|
11399
|
-
if (pct > 80) return
|
|
11400
|
-
if (pct > 40) return
|
|
11420
|
+
if (pct > 80) return chalk123.red(label2);
|
|
11421
|
+
if (pct > 40) return chalk123.yellow(label2);
|
|
11401
11422
|
return label2;
|
|
11402
11423
|
}
|
|
11403
11424
|
async function statusLine() {
|
|
@@ -11420,7 +11441,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11420
11441
|
// src/commands/sync/syncClaudeMd.ts
|
|
11421
11442
|
import * as fs23 from "fs";
|
|
11422
11443
|
import * as path46 from "path";
|
|
11423
|
-
import
|
|
11444
|
+
import chalk124 from "chalk";
|
|
11424
11445
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11425
11446
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11426
11447
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11429,12 +11450,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11429
11450
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11430
11451
|
if (sourceContent !== targetContent) {
|
|
11431
11452
|
console.log(
|
|
11432
|
-
|
|
11453
|
+
chalk124.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11433
11454
|
);
|
|
11434
11455
|
console.log();
|
|
11435
11456
|
printDiff(targetContent, sourceContent);
|
|
11436
11457
|
const confirm = options2?.yes || await promptConfirm(
|
|
11437
|
-
|
|
11458
|
+
chalk124.red("Overwrite existing CLAUDE.md?"),
|
|
11438
11459
|
false
|
|
11439
11460
|
);
|
|
11440
11461
|
if (!confirm) {
|
|
@@ -11450,7 +11471,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11450
11471
|
// src/commands/sync/syncSettings.ts
|
|
11451
11472
|
import * as fs24 from "fs";
|
|
11452
11473
|
import * as path47 from "path";
|
|
11453
|
-
import
|
|
11474
|
+
import chalk125 from "chalk";
|
|
11454
11475
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11455
11476
|
const source = path47.join(claudeDir, "settings.json");
|
|
11456
11477
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11466,14 +11487,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11466
11487
|
if (mergedContent !== normalizedTarget) {
|
|
11467
11488
|
if (!options2?.yes) {
|
|
11468
11489
|
console.log(
|
|
11469
|
-
|
|
11490
|
+
chalk125.yellow(
|
|
11470
11491
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11471
11492
|
)
|
|
11472
11493
|
);
|
|
11473
11494
|
console.log();
|
|
11474
11495
|
printDiff(targetContent, mergedContent);
|
|
11475
11496
|
const confirm = await promptConfirm(
|
|
11476
|
-
|
|
11497
|
+
chalk125.red("Overwrite existing settings.json?"),
|
|
11477
11498
|
false
|
|
11478
11499
|
);
|
|
11479
11500
|
if (!confirm) {
|