@staff0rd/assist 0.171.0 → 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 +329 -297
- 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: {
|
|
@@ -128,6 +128,22 @@ function deleteItem(db, id) {
|
|
|
128
128
|
import { statSync, writeFileSync } from "fs";
|
|
129
129
|
import { join } from "path";
|
|
130
130
|
|
|
131
|
+
// src/commands/backlog/loadComments.ts
|
|
132
|
+
function loadComments(db, itemId) {
|
|
133
|
+
const rows = db.prepare(
|
|
134
|
+
"SELECT text, phase, timestamp, type FROM comments WHERE item_id = ? ORDER BY idx"
|
|
135
|
+
).all(itemId);
|
|
136
|
+
return rows.map((r) => {
|
|
137
|
+
const c = {
|
|
138
|
+
text: r.text,
|
|
139
|
+
timestamp: r.timestamp,
|
|
140
|
+
type: r.type
|
|
141
|
+
};
|
|
142
|
+
if (r.phase != null) c.phase = r.phase;
|
|
143
|
+
return c;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
131
147
|
// src/commands/backlog/loadPlan.ts
|
|
132
148
|
function toPhase(db, itemId, p) {
|
|
133
149
|
const tasks = db.prepare(
|
|
@@ -154,11 +170,6 @@ function loadPlan(db, itemId) {
|
|
|
154
170
|
}
|
|
155
171
|
|
|
156
172
|
// src/commands/backlog/loadAllItems.ts
|
|
157
|
-
function loadComments(db, itemId) {
|
|
158
|
-
return db.prepare(
|
|
159
|
-
"SELECT text, phase, timestamp, type FROM comments WHERE item_id = ? ORDER BY idx"
|
|
160
|
-
).all(itemId);
|
|
161
|
-
}
|
|
162
173
|
function loadLinks(db, itemId) {
|
|
163
174
|
return db.prepare("SELECT type, target_id as targetId FROM links WHERE item_id = ?").all(itemId);
|
|
164
175
|
}
|
|
@@ -295,7 +306,7 @@ function saveAllItems(db, items) {
|
|
|
295
306
|
|
|
296
307
|
// src/commands/backlog/types.ts
|
|
297
308
|
import { z } from "zod";
|
|
298
|
-
var backlogStatusSchema = z.enum(["todo", "in-progress", "done"]);
|
|
309
|
+
var backlogStatusSchema = z.enum(["todo", "in-progress", "done", "wontdo"]);
|
|
299
310
|
var backlogTypeSchema = z.enum(["story", "bug"]);
|
|
300
311
|
var planTaskSchema = z.strictObject({
|
|
301
312
|
task: z.string(),
|
|
@@ -584,6 +595,8 @@ function statusIcon(status2) {
|
|
|
584
595
|
return chalk2.yellow("[~]");
|
|
585
596
|
case "done":
|
|
586
597
|
return chalk2.green("[x]");
|
|
598
|
+
case "wontdo":
|
|
599
|
+
return chalk2.dim("[-]");
|
|
587
600
|
}
|
|
588
601
|
}
|
|
589
602
|
function typeLabel(type) {
|
|
@@ -3885,7 +3898,8 @@ import { existsSync as existsSync20 } from "fs";
|
|
|
3885
3898
|
import chalk47 from "chalk";
|
|
3886
3899
|
function filterItems(items, options2) {
|
|
3887
3900
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
3888
|
-
if (!options2.all)
|
|
3901
|
+
if (!options2.all)
|
|
3902
|
+
return items.filter((i) => i.status !== "done" && i.status !== "wontdo");
|
|
3889
3903
|
return items;
|
|
3890
3904
|
}
|
|
3891
3905
|
async function list2(options2) {
|
|
@@ -3915,7 +3929,10 @@ async function list2(options2) {
|
|
|
3915
3929
|
// src/commands/backlog/registerItemCommands.ts
|
|
3916
3930
|
function registerItemCommands(cmd) {
|
|
3917
3931
|
cmd.command("init").description("Create an empty assist.backlog.yml").action(init6);
|
|
3918
|
-
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);
|
|
3919
3936
|
cmd.command("add").description("Add a new backlog item").option("--file <path>", "Read item as JSON from a file").action(add);
|
|
3920
3937
|
}
|
|
3921
3938
|
|
|
@@ -4070,10 +4087,25 @@ async function start(id) {
|
|
|
4070
4087
|
}
|
|
4071
4088
|
}
|
|
4072
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
|
+
|
|
4073
4104
|
// src/commands/backlog/registerStatusCommands.ts
|
|
4074
4105
|
function registerStatusCommands(cmd) {
|
|
4075
4106
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
4076
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);
|
|
4077
4109
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
4078
4110
|
}
|
|
4079
4111
|
|
|
@@ -4509,48 +4541,48 @@ ${reasons.join("\n")}`);
|
|
|
4509
4541
|
}
|
|
4510
4542
|
|
|
4511
4543
|
// src/commands/deny/denyAdd.ts
|
|
4512
|
-
import
|
|
4544
|
+
import chalk55 from "chalk";
|
|
4513
4545
|
function denyAdd(pattern2, message) {
|
|
4514
4546
|
const config = loadProjectConfig();
|
|
4515
4547
|
const deny = config.deny ?? [];
|
|
4516
4548
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4517
|
-
console.log(
|
|
4549
|
+
console.log(chalk55.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4518
4550
|
return;
|
|
4519
4551
|
}
|
|
4520
4552
|
deny.push({ pattern: pattern2, message });
|
|
4521
4553
|
config.deny = deny;
|
|
4522
4554
|
saveConfig(config);
|
|
4523
|
-
console.log(
|
|
4555
|
+
console.log(chalk55.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4524
4556
|
}
|
|
4525
4557
|
|
|
4526
4558
|
// src/commands/deny/denyList.ts
|
|
4527
|
-
import
|
|
4559
|
+
import chalk56 from "chalk";
|
|
4528
4560
|
function denyList() {
|
|
4529
4561
|
const config = loadConfig();
|
|
4530
4562
|
const deny = config.deny;
|
|
4531
4563
|
if (!deny || deny.length === 0) {
|
|
4532
|
-
console.log(
|
|
4564
|
+
console.log(chalk56.dim("No deny rules configured."));
|
|
4533
4565
|
return;
|
|
4534
4566
|
}
|
|
4535
4567
|
for (const rule of deny) {
|
|
4536
|
-
console.log(`${
|
|
4568
|
+
console.log(`${chalk56.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4537
4569
|
}
|
|
4538
4570
|
}
|
|
4539
4571
|
|
|
4540
4572
|
// src/commands/deny/denyRemove.ts
|
|
4541
|
-
import
|
|
4573
|
+
import chalk57 from "chalk";
|
|
4542
4574
|
function denyRemove(pattern2) {
|
|
4543
4575
|
const config = loadProjectConfig();
|
|
4544
4576
|
const deny = config.deny ?? [];
|
|
4545
4577
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4546
4578
|
if (index === -1) {
|
|
4547
|
-
console.log(
|
|
4579
|
+
console.log(chalk57.yellow(`No deny rule found for: ${pattern2}`));
|
|
4548
4580
|
return;
|
|
4549
4581
|
}
|
|
4550
4582
|
deny.splice(index, 1);
|
|
4551
4583
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4552
4584
|
saveConfig(config);
|
|
4553
|
-
console.log(
|
|
4585
|
+
console.log(chalk57.green(`Removed deny rule: ${pattern2}`));
|
|
4554
4586
|
}
|
|
4555
4587
|
|
|
4556
4588
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4600,11 +4632,11 @@ function assertCliExists(cli) {
|
|
|
4600
4632
|
}
|
|
4601
4633
|
|
|
4602
4634
|
// src/commands/permitCliReads/colorize.ts
|
|
4603
|
-
import
|
|
4635
|
+
import chalk58 from "chalk";
|
|
4604
4636
|
function colorize(plainOutput) {
|
|
4605
4637
|
return plainOutput.split("\n").map((line) => {
|
|
4606
|
-
if (line.startsWith(" R ")) return
|
|
4607
|
-
if (line.startsWith(" W ")) return
|
|
4638
|
+
if (line.startsWith(" R ")) return chalk58.green(line);
|
|
4639
|
+
if (line.startsWith(" W ")) return chalk58.red(line);
|
|
4608
4640
|
return line;
|
|
4609
4641
|
}).join("\n");
|
|
4610
4642
|
}
|
|
@@ -4922,15 +4954,15 @@ function registerCliHook(program2) {
|
|
|
4922
4954
|
}
|
|
4923
4955
|
|
|
4924
4956
|
// src/commands/complexity/analyze.ts
|
|
4925
|
-
import
|
|
4957
|
+
import chalk64 from "chalk";
|
|
4926
4958
|
|
|
4927
4959
|
// src/commands/complexity/cyclomatic.ts
|
|
4928
|
-
import
|
|
4960
|
+
import chalk60 from "chalk";
|
|
4929
4961
|
|
|
4930
4962
|
// src/commands/complexity/shared/index.ts
|
|
4931
4963
|
import fs12 from "fs";
|
|
4932
4964
|
import path20 from "path";
|
|
4933
|
-
import
|
|
4965
|
+
import chalk59 from "chalk";
|
|
4934
4966
|
import ts5 from "typescript";
|
|
4935
4967
|
|
|
4936
4968
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5176,7 +5208,7 @@ function createSourceFromFile(filePath) {
|
|
|
5176
5208
|
function withSourceFiles(pattern2, callback) {
|
|
5177
5209
|
const files = findSourceFiles2(pattern2);
|
|
5178
5210
|
if (files.length === 0) {
|
|
5179
|
-
console.log(
|
|
5211
|
+
console.log(chalk59.yellow("No files found matching pattern"));
|
|
5180
5212
|
return void 0;
|
|
5181
5213
|
}
|
|
5182
5214
|
return callback(files);
|
|
@@ -5209,11 +5241,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5209
5241
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5210
5242
|
for (const { file, name, complexity } of results) {
|
|
5211
5243
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5212
|
-
const color = exceedsThreshold ?
|
|
5213
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5244
|
+
const color = exceedsThreshold ? chalk60.red : chalk60.white;
|
|
5245
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk60.cyan(complexity)}`);
|
|
5214
5246
|
}
|
|
5215
5247
|
console.log(
|
|
5216
|
-
|
|
5248
|
+
chalk60.dim(
|
|
5217
5249
|
`
|
|
5218
5250
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5219
5251
|
)
|
|
@@ -5225,7 +5257,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5225
5257
|
}
|
|
5226
5258
|
|
|
5227
5259
|
// src/commands/complexity/halstead.ts
|
|
5228
|
-
import
|
|
5260
|
+
import chalk61 from "chalk";
|
|
5229
5261
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5230
5262
|
withSourceFiles(pattern2, (files) => {
|
|
5231
5263
|
const results = [];
|
|
@@ -5240,13 +5272,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5240
5272
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5241
5273
|
for (const { file, name, metrics } of results) {
|
|
5242
5274
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5243
|
-
const color = exceedsThreshold ?
|
|
5275
|
+
const color = exceedsThreshold ? chalk61.red : chalk61.white;
|
|
5244
5276
|
console.log(
|
|
5245
|
-
`${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))}`
|
|
5246
5278
|
);
|
|
5247
5279
|
}
|
|
5248
5280
|
console.log(
|
|
5249
|
-
|
|
5281
|
+
chalk61.dim(
|
|
5250
5282
|
`
|
|
5251
5283
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5252
5284
|
)
|
|
@@ -5261,28 +5293,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5261
5293
|
import fs13 from "fs";
|
|
5262
5294
|
|
|
5263
5295
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5264
|
-
import
|
|
5296
|
+
import chalk62 from "chalk";
|
|
5265
5297
|
function displayMaintainabilityResults(results, threshold) {
|
|
5266
5298
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5267
5299
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5268
|
-
console.log(
|
|
5300
|
+
console.log(chalk62.green("All files pass maintainability threshold"));
|
|
5269
5301
|
} else {
|
|
5270
5302
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5271
|
-
const color = threshold !== void 0 ?
|
|
5303
|
+
const color = threshold !== void 0 ? chalk62.red : chalk62.white;
|
|
5272
5304
|
console.log(
|
|
5273
|
-
`${color(file)} \u2192 avg: ${
|
|
5305
|
+
`${color(file)} \u2192 avg: ${chalk62.cyan(avgMaintainability.toFixed(1))}, min: ${chalk62.yellow(minMaintainability.toFixed(1))}`
|
|
5274
5306
|
);
|
|
5275
5307
|
}
|
|
5276
5308
|
}
|
|
5277
|
-
console.log(
|
|
5309
|
+
console.log(chalk62.dim(`
|
|
5278
5310
|
Analyzed ${results.length} files`));
|
|
5279
5311
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5280
5312
|
console.error(
|
|
5281
|
-
|
|
5313
|
+
chalk62.red(
|
|
5282
5314
|
`
|
|
5283
5315
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5284
5316
|
|
|
5285
|
-
\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.`
|
|
5286
5318
|
)
|
|
5287
5319
|
);
|
|
5288
5320
|
process.exit(1);
|
|
@@ -5339,7 +5371,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5339
5371
|
|
|
5340
5372
|
// src/commands/complexity/sloc.ts
|
|
5341
5373
|
import fs14 from "fs";
|
|
5342
|
-
import
|
|
5374
|
+
import chalk63 from "chalk";
|
|
5343
5375
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5344
5376
|
withSourceFiles(pattern2, (files) => {
|
|
5345
5377
|
const results = [];
|
|
@@ -5355,12 +5387,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5355
5387
|
results.sort((a, b) => b.lines - a.lines);
|
|
5356
5388
|
for (const { file, lines } of results) {
|
|
5357
5389
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5358
|
-
const color = exceedsThreshold ?
|
|
5359
|
-
console.log(`${color(file)} \u2192 ${
|
|
5390
|
+
const color = exceedsThreshold ? chalk63.red : chalk63.white;
|
|
5391
|
+
console.log(`${color(file)} \u2192 ${chalk63.cyan(lines)} lines`);
|
|
5360
5392
|
}
|
|
5361
5393
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5362
5394
|
console.log(
|
|
5363
|
-
|
|
5395
|
+
chalk63.dim(`
|
|
5364
5396
|
Total: ${total} lines across ${files.length} files`)
|
|
5365
5397
|
);
|
|
5366
5398
|
if (hasViolation) {
|
|
@@ -5374,21 +5406,21 @@ async function analyze(pattern2) {
|
|
|
5374
5406
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5375
5407
|
const files = findSourceFiles2(searchPattern);
|
|
5376
5408
|
if (files.length === 0) {
|
|
5377
|
-
console.log(
|
|
5409
|
+
console.log(chalk64.yellow("No files found matching pattern"));
|
|
5378
5410
|
return;
|
|
5379
5411
|
}
|
|
5380
5412
|
if (files.length === 1) {
|
|
5381
5413
|
const file = files[0];
|
|
5382
|
-
console.log(
|
|
5414
|
+
console.log(chalk64.bold.underline("SLOC"));
|
|
5383
5415
|
await sloc(file);
|
|
5384
5416
|
console.log();
|
|
5385
|
-
console.log(
|
|
5417
|
+
console.log(chalk64.bold.underline("Cyclomatic Complexity"));
|
|
5386
5418
|
await cyclomatic(file);
|
|
5387
5419
|
console.log();
|
|
5388
|
-
console.log(
|
|
5420
|
+
console.log(chalk64.bold.underline("Halstead Metrics"));
|
|
5389
5421
|
await halstead(file);
|
|
5390
5422
|
console.log();
|
|
5391
|
-
console.log(
|
|
5423
|
+
console.log(chalk64.bold.underline("Maintainability Index"));
|
|
5392
5424
|
await maintainability(file);
|
|
5393
5425
|
return;
|
|
5394
5426
|
}
|
|
@@ -5416,7 +5448,7 @@ function registerComplexity(program2) {
|
|
|
5416
5448
|
|
|
5417
5449
|
// src/commands/deploy/redirect.ts
|
|
5418
5450
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
|
|
5419
|
-
import
|
|
5451
|
+
import chalk65 from "chalk";
|
|
5420
5452
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5421
5453
|
if (!window.location.pathname.endsWith('/')) {
|
|
5422
5454
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5425,22 +5457,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5425
5457
|
function redirect() {
|
|
5426
5458
|
const indexPath = "index.html";
|
|
5427
5459
|
if (!existsSync24(indexPath)) {
|
|
5428
|
-
console.log(
|
|
5460
|
+
console.log(chalk65.yellow("No index.html found"));
|
|
5429
5461
|
return;
|
|
5430
5462
|
}
|
|
5431
5463
|
const content = readFileSync20(indexPath, "utf-8");
|
|
5432
5464
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5433
|
-
console.log(
|
|
5465
|
+
console.log(chalk65.dim("Trailing slash script already present"));
|
|
5434
5466
|
return;
|
|
5435
5467
|
}
|
|
5436
5468
|
const headCloseIndex = content.indexOf("</head>");
|
|
5437
5469
|
if (headCloseIndex === -1) {
|
|
5438
|
-
console.log(
|
|
5470
|
+
console.log(chalk65.red("Could not find </head> tag in index.html"));
|
|
5439
5471
|
return;
|
|
5440
5472
|
}
|
|
5441
5473
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5442
5474
|
writeFileSync17(indexPath, newContent);
|
|
5443
|
-
console.log(
|
|
5475
|
+
console.log(chalk65.green("Added trailing slash redirect to index.html"));
|
|
5444
5476
|
}
|
|
5445
5477
|
|
|
5446
5478
|
// src/commands/registerDeploy.ts
|
|
@@ -5467,7 +5499,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5467
5499
|
|
|
5468
5500
|
// src/commands/devlog/shared.ts
|
|
5469
5501
|
import { execSync as execSync17 } from "child_process";
|
|
5470
|
-
import
|
|
5502
|
+
import chalk66 from "chalk";
|
|
5471
5503
|
|
|
5472
5504
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5473
5505
|
import { readdirSync, readFileSync as readFileSync21 } from "fs";
|
|
@@ -5554,13 +5586,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5554
5586
|
}
|
|
5555
5587
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5556
5588
|
for (const commit2 of commits) {
|
|
5557
|
-
console.log(` ${
|
|
5589
|
+
console.log(` ${chalk66.yellow(commit2.hash)} ${commit2.message}`);
|
|
5558
5590
|
if (verbose) {
|
|
5559
5591
|
const visibleFiles = commit2.files.filter(
|
|
5560
5592
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5561
5593
|
);
|
|
5562
5594
|
for (const file of visibleFiles) {
|
|
5563
|
-
console.log(` ${
|
|
5595
|
+
console.log(` ${chalk66.dim(file)}`);
|
|
5564
5596
|
}
|
|
5565
5597
|
}
|
|
5566
5598
|
}
|
|
@@ -5585,15 +5617,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5585
5617
|
}
|
|
5586
5618
|
|
|
5587
5619
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5588
|
-
import
|
|
5620
|
+
import chalk67 from "chalk";
|
|
5589
5621
|
function printDateHeader(date, isSkipped, entries) {
|
|
5590
5622
|
if (isSkipped) {
|
|
5591
|
-
console.log(`${
|
|
5623
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.dim("skipped")}`);
|
|
5592
5624
|
} else if (entries && entries.length > 0) {
|
|
5593
|
-
const entryInfo = entries.map((e) => `${
|
|
5594
|
-
console.log(`${
|
|
5625
|
+
const entryInfo = entries.map((e) => `${chalk67.green(e.version)} ${e.title}`).join(" | ");
|
|
5626
|
+
console.log(`${chalk67.bold.blue(date)} ${entryInfo}`);
|
|
5595
5627
|
} else {
|
|
5596
|
-
console.log(`${
|
|
5628
|
+
console.log(`${chalk67.bold.blue(date)} ${chalk67.red("\u26A0 devlog missing")}`);
|
|
5597
5629
|
}
|
|
5598
5630
|
}
|
|
5599
5631
|
|
|
@@ -5697,24 +5729,24 @@ function bumpVersion(version2, type) {
|
|
|
5697
5729
|
|
|
5698
5730
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5699
5731
|
import { execSync as execSync20 } from "child_process";
|
|
5700
|
-
import
|
|
5732
|
+
import chalk69 from "chalk";
|
|
5701
5733
|
|
|
5702
5734
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5703
|
-
import
|
|
5735
|
+
import chalk68 from "chalk";
|
|
5704
5736
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5705
5737
|
if (conventional && firstHash) {
|
|
5706
5738
|
const version2 = getVersionAtCommit(firstHash);
|
|
5707
5739
|
if (version2) {
|
|
5708
|
-
console.log(`${
|
|
5740
|
+
console.log(`${chalk68.bold("version:")} ${stripToMinor(version2)}`);
|
|
5709
5741
|
} else {
|
|
5710
|
-
console.log(`${
|
|
5742
|
+
console.log(`${chalk68.bold("version:")} ${chalk68.red("unknown")}`);
|
|
5711
5743
|
}
|
|
5712
5744
|
} else if (patchVersion && minorVersion) {
|
|
5713
5745
|
console.log(
|
|
5714
|
-
`${
|
|
5746
|
+
`${chalk68.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5715
5747
|
);
|
|
5716
5748
|
} else {
|
|
5717
|
-
console.log(`${
|
|
5749
|
+
console.log(`${chalk68.bold("version:")} v0.1 (initial)`);
|
|
5718
5750
|
}
|
|
5719
5751
|
}
|
|
5720
5752
|
|
|
@@ -5761,16 +5793,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5761
5793
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5762
5794
|
}
|
|
5763
5795
|
function logName(repoName) {
|
|
5764
|
-
console.log(`${
|
|
5796
|
+
console.log(`${chalk69.bold("name:")} ${repoName}`);
|
|
5765
5797
|
}
|
|
5766
5798
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5767
5799
|
logName(ctx.repoName);
|
|
5768
5800
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5769
|
-
console.log(
|
|
5801
|
+
console.log(chalk69.bold.blue(targetDate));
|
|
5770
5802
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5771
5803
|
}
|
|
5772
5804
|
function logNoCommits(lastInfo) {
|
|
5773
|
-
console.log(
|
|
5805
|
+
console.log(chalk69.dim(noCommitsMessage(!!lastInfo)));
|
|
5774
5806
|
}
|
|
5775
5807
|
|
|
5776
5808
|
// src/commands/devlog/next/index.ts
|
|
@@ -5811,11 +5843,11 @@ function next2(options2) {
|
|
|
5811
5843
|
import { execSync as execSync21 } from "child_process";
|
|
5812
5844
|
|
|
5813
5845
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5814
|
-
import
|
|
5846
|
+
import chalk70 from "chalk";
|
|
5815
5847
|
function colorStatus(status2) {
|
|
5816
|
-
if (status2 === "missing") return
|
|
5817
|
-
if (status2 === "outdated") return
|
|
5818
|
-
return
|
|
5848
|
+
if (status2 === "missing") return chalk70.red(status2);
|
|
5849
|
+
if (status2 === "outdated") return chalk70.yellow(status2);
|
|
5850
|
+
return chalk70.green(status2);
|
|
5819
5851
|
}
|
|
5820
5852
|
function formatRow(row, nameWidth) {
|
|
5821
5853
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5829,8 +5861,8 @@ function printReposTable(rows) {
|
|
|
5829
5861
|
"Last Devlog".padEnd(11),
|
|
5830
5862
|
"Status"
|
|
5831
5863
|
].join(" ");
|
|
5832
|
-
console.log(
|
|
5833
|
-
console.log(
|
|
5864
|
+
console.log(chalk70.dim(header));
|
|
5865
|
+
console.log(chalk70.dim("-".repeat(header.length)));
|
|
5834
5866
|
for (const row of rows) {
|
|
5835
5867
|
console.log(formatRow(row, nameWidth));
|
|
5836
5868
|
}
|
|
@@ -5888,14 +5920,14 @@ function repos(options2) {
|
|
|
5888
5920
|
// src/commands/devlog/skip.ts
|
|
5889
5921
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5890
5922
|
import { join as join20 } from "path";
|
|
5891
|
-
import
|
|
5923
|
+
import chalk71 from "chalk";
|
|
5892
5924
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5893
5925
|
function getBlogConfigPath() {
|
|
5894
5926
|
return join20(BLOG_REPO_ROOT, "assist.yml");
|
|
5895
5927
|
}
|
|
5896
5928
|
function skip(date) {
|
|
5897
5929
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5898
|
-
console.log(
|
|
5930
|
+
console.log(chalk71.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5899
5931
|
process.exit(1);
|
|
5900
5932
|
}
|
|
5901
5933
|
const repoName = getRepoName();
|
|
@@ -5906,7 +5938,7 @@ function skip(date) {
|
|
|
5906
5938
|
const skipDays = skip2[repoName] ?? [];
|
|
5907
5939
|
if (skipDays.includes(date)) {
|
|
5908
5940
|
console.log(
|
|
5909
|
-
|
|
5941
|
+
chalk71.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5910
5942
|
);
|
|
5911
5943
|
return;
|
|
5912
5944
|
}
|
|
@@ -5916,20 +5948,20 @@ function skip(date) {
|
|
|
5916
5948
|
devlog.skip = skip2;
|
|
5917
5949
|
config.devlog = devlog;
|
|
5918
5950
|
writeFileSync18(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
5919
|
-
console.log(
|
|
5951
|
+
console.log(chalk71.green(`Added ${date} to skip list for ${repoName}`));
|
|
5920
5952
|
}
|
|
5921
5953
|
|
|
5922
5954
|
// src/commands/devlog/version.ts
|
|
5923
|
-
import
|
|
5955
|
+
import chalk72 from "chalk";
|
|
5924
5956
|
function version() {
|
|
5925
5957
|
const config = loadConfig();
|
|
5926
5958
|
const name = getRepoName();
|
|
5927
5959
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5928
5960
|
const lastVersion = lastInfo?.version ?? null;
|
|
5929
5961
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5930
|
-
console.log(`${
|
|
5931
|
-
console.log(`${
|
|
5932
|
-
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")}`);
|
|
5933
5965
|
}
|
|
5934
5966
|
|
|
5935
5967
|
// src/commands/registerDevlog.ts
|
|
@@ -5953,7 +5985,7 @@ function registerDevlog(program2) {
|
|
|
5953
5985
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5954
5986
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5955
5987
|
import { join as join21 } from "path";
|
|
5956
|
-
import
|
|
5988
|
+
import chalk73 from "chalk";
|
|
5957
5989
|
|
|
5958
5990
|
// src/shared/findRepoRoot.ts
|
|
5959
5991
|
import { existsSync as existsSync25 } from "fs";
|
|
@@ -6016,14 +6048,14 @@ function checkBuildLocks(startDir) {
|
|
|
6016
6048
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6017
6049
|
if (locked) {
|
|
6018
6050
|
console.error(
|
|
6019
|
-
|
|
6051
|
+
chalk73.red("Build output locked (is VS debugging?): ") + locked
|
|
6020
6052
|
);
|
|
6021
6053
|
process.exit(1);
|
|
6022
6054
|
}
|
|
6023
6055
|
}
|
|
6024
6056
|
async function checkBuildLocksCommand() {
|
|
6025
6057
|
checkBuildLocks();
|
|
6026
|
-
console.log(
|
|
6058
|
+
console.log(chalk73.green("No build locks detected"));
|
|
6027
6059
|
}
|
|
6028
6060
|
|
|
6029
6061
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6122,30 +6154,30 @@ function escapeRegex(s) {
|
|
|
6122
6154
|
}
|
|
6123
6155
|
|
|
6124
6156
|
// src/commands/dotnet/printTree.ts
|
|
6125
|
-
import
|
|
6157
|
+
import chalk74 from "chalk";
|
|
6126
6158
|
function printNodes(nodes, prefix2) {
|
|
6127
6159
|
for (let i = 0; i < nodes.length; i++) {
|
|
6128
6160
|
const isLast = i === nodes.length - 1;
|
|
6129
6161
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6130
6162
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6131
6163
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6132
|
-
const label2 = isMissing ?
|
|
6164
|
+
const label2 = isMissing ? chalk74.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6133
6165
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6134
6166
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6135
6167
|
}
|
|
6136
6168
|
}
|
|
6137
6169
|
function printTree(tree, totalCount, solutions) {
|
|
6138
|
-
console.log(
|
|
6139
|
-
console.log(
|
|
6170
|
+
console.log(chalk74.bold("\nProject Dependency Tree"));
|
|
6171
|
+
console.log(chalk74.cyan(tree.relativePath));
|
|
6140
6172
|
printNodes(tree.children, "");
|
|
6141
|
-
console.log(
|
|
6173
|
+
console.log(chalk74.dim(`
|
|
6142
6174
|
${totalCount} projects total (including root)`));
|
|
6143
|
-
console.log(
|
|
6175
|
+
console.log(chalk74.bold("\nSolution Membership"));
|
|
6144
6176
|
if (solutions.length === 0) {
|
|
6145
|
-
console.log(
|
|
6177
|
+
console.log(chalk74.yellow(" Not found in any .sln"));
|
|
6146
6178
|
} else {
|
|
6147
6179
|
for (const sln of solutions) {
|
|
6148
|
-
console.log(` ${
|
|
6180
|
+
console.log(` ${chalk74.green(sln)}`);
|
|
6149
6181
|
}
|
|
6150
6182
|
}
|
|
6151
6183
|
console.log();
|
|
@@ -6174,16 +6206,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6174
6206
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6175
6207
|
import { existsSync as existsSync26 } from "fs";
|
|
6176
6208
|
import path24 from "path";
|
|
6177
|
-
import
|
|
6209
|
+
import chalk75 from "chalk";
|
|
6178
6210
|
function resolveCsproj(csprojPath) {
|
|
6179
6211
|
const resolved = path24.resolve(csprojPath);
|
|
6180
6212
|
if (!existsSync26(resolved)) {
|
|
6181
|
-
console.error(
|
|
6213
|
+
console.error(chalk75.red(`File not found: ${resolved}`));
|
|
6182
6214
|
process.exit(1);
|
|
6183
6215
|
}
|
|
6184
6216
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6185
6217
|
if (!repoRoot) {
|
|
6186
|
-
console.error(
|
|
6218
|
+
console.error(chalk75.red("Could not find git repository root"));
|
|
6187
6219
|
process.exit(1);
|
|
6188
6220
|
}
|
|
6189
6221
|
return { resolved, repoRoot };
|
|
@@ -6233,12 +6265,12 @@ function getChangedCsFiles(scope) {
|
|
|
6233
6265
|
}
|
|
6234
6266
|
|
|
6235
6267
|
// src/commands/dotnet/inSln.ts
|
|
6236
|
-
import
|
|
6268
|
+
import chalk76 from "chalk";
|
|
6237
6269
|
async function inSln(csprojPath) {
|
|
6238
6270
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6239
6271
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6240
6272
|
if (solutions.length === 0) {
|
|
6241
|
-
console.log(
|
|
6273
|
+
console.log(chalk76.yellow("Not found in any .sln file"));
|
|
6242
6274
|
process.exit(1);
|
|
6243
6275
|
}
|
|
6244
6276
|
for (const sln of solutions) {
|
|
@@ -6247,7 +6279,7 @@ async function inSln(csprojPath) {
|
|
|
6247
6279
|
}
|
|
6248
6280
|
|
|
6249
6281
|
// src/commands/dotnet/inspect.ts
|
|
6250
|
-
import
|
|
6282
|
+
import chalk82 from "chalk";
|
|
6251
6283
|
|
|
6252
6284
|
// src/shared/formatElapsed.ts
|
|
6253
6285
|
function formatElapsed(ms) {
|
|
@@ -6259,12 +6291,12 @@ function formatElapsed(ms) {
|
|
|
6259
6291
|
}
|
|
6260
6292
|
|
|
6261
6293
|
// src/commands/dotnet/displayIssues.ts
|
|
6262
|
-
import
|
|
6294
|
+
import chalk77 from "chalk";
|
|
6263
6295
|
var SEVERITY_COLOR = {
|
|
6264
|
-
ERROR:
|
|
6265
|
-
WARNING:
|
|
6266
|
-
SUGGESTION:
|
|
6267
|
-
HINT:
|
|
6296
|
+
ERROR: chalk77.red,
|
|
6297
|
+
WARNING: chalk77.yellow,
|
|
6298
|
+
SUGGESTION: chalk77.cyan,
|
|
6299
|
+
HINT: chalk77.dim
|
|
6268
6300
|
};
|
|
6269
6301
|
function groupByFile(issues) {
|
|
6270
6302
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6280,15 +6312,15 @@ function groupByFile(issues) {
|
|
|
6280
6312
|
}
|
|
6281
6313
|
function displayIssues(issues) {
|
|
6282
6314
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6283
|
-
console.log(
|
|
6315
|
+
console.log(chalk77.bold(file));
|
|
6284
6316
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6285
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6317
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk77.white;
|
|
6286
6318
|
console.log(
|
|
6287
|
-
` ${
|
|
6319
|
+
` ${chalk77.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6288
6320
|
);
|
|
6289
6321
|
}
|
|
6290
6322
|
}
|
|
6291
|
-
console.log(
|
|
6323
|
+
console.log(chalk77.dim(`
|
|
6292
6324
|
${issues.length} issue(s) found`));
|
|
6293
6325
|
}
|
|
6294
6326
|
|
|
@@ -6347,12 +6379,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6347
6379
|
// src/commands/dotnet/resolveSolution.ts
|
|
6348
6380
|
import { existsSync as existsSync27 } from "fs";
|
|
6349
6381
|
import path25 from "path";
|
|
6350
|
-
import
|
|
6382
|
+
import chalk79 from "chalk";
|
|
6351
6383
|
|
|
6352
6384
|
// src/commands/dotnet/findSolution.ts
|
|
6353
6385
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6354
6386
|
import { dirname as dirname16, join as join22 } from "path";
|
|
6355
|
-
import
|
|
6387
|
+
import chalk78 from "chalk";
|
|
6356
6388
|
function findSlnInDir(dir) {
|
|
6357
6389
|
try {
|
|
6358
6390
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join22(dir, f));
|
|
@@ -6368,17 +6400,17 @@ function findSolution() {
|
|
|
6368
6400
|
const slnFiles = findSlnInDir(current);
|
|
6369
6401
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6370
6402
|
if (slnFiles.length > 1) {
|
|
6371
|
-
console.error(
|
|
6403
|
+
console.error(chalk78.red(`Multiple .sln files found in ${current}:`));
|
|
6372
6404
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6373
6405
|
console.error(
|
|
6374
|
-
|
|
6406
|
+
chalk78.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6375
6407
|
);
|
|
6376
6408
|
process.exit(1);
|
|
6377
6409
|
}
|
|
6378
6410
|
if (current === ceiling) break;
|
|
6379
6411
|
current = dirname16(current);
|
|
6380
6412
|
}
|
|
6381
|
-
console.error(
|
|
6413
|
+
console.error(chalk78.red("No .sln file found between cwd and repo root"));
|
|
6382
6414
|
process.exit(1);
|
|
6383
6415
|
}
|
|
6384
6416
|
|
|
@@ -6387,7 +6419,7 @@ function resolveSolution(sln) {
|
|
|
6387
6419
|
if (sln) {
|
|
6388
6420
|
const resolved = path25.resolve(sln);
|
|
6389
6421
|
if (!existsSync27(resolved)) {
|
|
6390
|
-
console.error(
|
|
6422
|
+
console.error(chalk79.red(`Solution file not found: ${resolved}`));
|
|
6391
6423
|
process.exit(1);
|
|
6392
6424
|
}
|
|
6393
6425
|
return resolved;
|
|
@@ -6429,14 +6461,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6429
6461
|
import { existsSync as existsSync28, readFileSync as readFileSync24, unlinkSync as unlinkSync5 } from "fs";
|
|
6430
6462
|
import { tmpdir as tmpdir2 } from "os";
|
|
6431
6463
|
import path26 from "path";
|
|
6432
|
-
import
|
|
6464
|
+
import chalk80 from "chalk";
|
|
6433
6465
|
function assertJbInstalled() {
|
|
6434
6466
|
try {
|
|
6435
6467
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6436
6468
|
} catch {
|
|
6437
|
-
console.error(
|
|
6469
|
+
console.error(chalk80.red("jb is not installed. Install with:"));
|
|
6438
6470
|
console.error(
|
|
6439
|
-
|
|
6471
|
+
chalk80.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6440
6472
|
);
|
|
6441
6473
|
process.exit(1);
|
|
6442
6474
|
}
|
|
@@ -6454,11 +6486,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6454
6486
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6455
6487
|
process.stderr.write(err.stderr);
|
|
6456
6488
|
}
|
|
6457
|
-
console.error(
|
|
6489
|
+
console.error(chalk80.red("jb inspectcode failed"));
|
|
6458
6490
|
process.exit(1);
|
|
6459
6491
|
}
|
|
6460
6492
|
if (!existsSync28(reportPath)) {
|
|
6461
|
-
console.error(
|
|
6493
|
+
console.error(chalk80.red("Report file not generated"));
|
|
6462
6494
|
process.exit(1);
|
|
6463
6495
|
}
|
|
6464
6496
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -6468,7 +6500,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6468
6500
|
|
|
6469
6501
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6470
6502
|
import { execSync as execSync24 } from "child_process";
|
|
6471
|
-
import
|
|
6503
|
+
import chalk81 from "chalk";
|
|
6472
6504
|
function resolveMsbuildPath() {
|
|
6473
6505
|
const config = loadConfig();
|
|
6474
6506
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6479,9 +6511,9 @@ function assertMsbuildInstalled() {
|
|
|
6479
6511
|
try {
|
|
6480
6512
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6481
6513
|
} catch {
|
|
6482
|
-
console.error(
|
|
6514
|
+
console.error(chalk81.red(`msbuild not found at: ${msbuild}`));
|
|
6483
6515
|
console.error(
|
|
6484
|
-
|
|
6516
|
+
chalk81.yellow(
|
|
6485
6517
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6486
6518
|
)
|
|
6487
6519
|
);
|
|
@@ -6528,17 +6560,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6528
6560
|
// src/commands/dotnet/inspect.ts
|
|
6529
6561
|
function logScope(changedFiles) {
|
|
6530
6562
|
if (changedFiles === null) {
|
|
6531
|
-
console.log(
|
|
6563
|
+
console.log(chalk82.dim("Inspecting full solution..."));
|
|
6532
6564
|
} else {
|
|
6533
6565
|
console.log(
|
|
6534
|
-
|
|
6566
|
+
chalk82.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6535
6567
|
);
|
|
6536
6568
|
}
|
|
6537
6569
|
}
|
|
6538
6570
|
function reportResults(issues, elapsed) {
|
|
6539
6571
|
if (issues.length > 0) displayIssues(issues);
|
|
6540
|
-
else console.log(
|
|
6541
|
-
console.log(
|
|
6572
|
+
else console.log(chalk82.green("No issues found"));
|
|
6573
|
+
console.log(chalk82.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6542
6574
|
if (issues.length > 0) process.exit(1);
|
|
6543
6575
|
}
|
|
6544
6576
|
async function inspect(sln, options2) {
|
|
@@ -6549,7 +6581,7 @@ async function inspect(sln, options2) {
|
|
|
6549
6581
|
const scope = parseScope(options2.scope);
|
|
6550
6582
|
const changedFiles = getChangedCsFiles(scope);
|
|
6551
6583
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6552
|
-
console.log(
|
|
6584
|
+
console.log(chalk82.green("No changed .cs files found"));
|
|
6553
6585
|
return;
|
|
6554
6586
|
}
|
|
6555
6587
|
logScope(changedFiles);
|
|
@@ -6575,7 +6607,7 @@ function registerDotnet(program2) {
|
|
|
6575
6607
|
}
|
|
6576
6608
|
|
|
6577
6609
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6578
|
-
import
|
|
6610
|
+
import chalk84 from "chalk";
|
|
6579
6611
|
|
|
6580
6612
|
// src/commands/jira/adfToText.ts
|
|
6581
6613
|
function renderInline(node) {
|
|
@@ -6636,7 +6668,7 @@ function adfToText(doc) {
|
|
|
6636
6668
|
|
|
6637
6669
|
// src/commands/jira/fetchIssue.ts
|
|
6638
6670
|
import { execSync as execSync25 } from "child_process";
|
|
6639
|
-
import
|
|
6671
|
+
import chalk83 from "chalk";
|
|
6640
6672
|
function fetchIssue(issueKey, fields) {
|
|
6641
6673
|
let result;
|
|
6642
6674
|
try {
|
|
@@ -6649,15 +6681,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6649
6681
|
const stderr = error.stderr;
|
|
6650
6682
|
if (stderr.includes("unauthorized")) {
|
|
6651
6683
|
console.error(
|
|
6652
|
-
|
|
6684
|
+
chalk83.red("Jira authentication expired."),
|
|
6653
6685
|
"Run",
|
|
6654
|
-
|
|
6686
|
+
chalk83.cyan("assist jira auth"),
|
|
6655
6687
|
"to re-authenticate."
|
|
6656
6688
|
);
|
|
6657
6689
|
process.exit(1);
|
|
6658
6690
|
}
|
|
6659
6691
|
}
|
|
6660
|
-
console.error(
|
|
6692
|
+
console.error(chalk83.red(`Failed to fetch ${issueKey}.`));
|
|
6661
6693
|
process.exit(1);
|
|
6662
6694
|
}
|
|
6663
6695
|
return JSON.parse(result);
|
|
@@ -6671,7 +6703,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6671
6703
|
const parsed = fetchIssue(issueKey, field);
|
|
6672
6704
|
const acValue = parsed?.fields?.[field];
|
|
6673
6705
|
if (!acValue) {
|
|
6674
|
-
console.log(
|
|
6706
|
+
console.log(chalk84.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6675
6707
|
return;
|
|
6676
6708
|
}
|
|
6677
6709
|
if (typeof acValue === "string") {
|
|
@@ -6766,14 +6798,14 @@ async function jiraAuth() {
|
|
|
6766
6798
|
}
|
|
6767
6799
|
|
|
6768
6800
|
// src/commands/jira/viewIssue.ts
|
|
6769
|
-
import
|
|
6801
|
+
import chalk85 from "chalk";
|
|
6770
6802
|
function viewIssue(issueKey) {
|
|
6771
6803
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6772
6804
|
const fields = parsed?.fields;
|
|
6773
6805
|
const summary = fields?.summary;
|
|
6774
6806
|
const description = fields?.description;
|
|
6775
6807
|
if (summary) {
|
|
6776
|
-
console.log(
|
|
6808
|
+
console.log(chalk85.bold(summary));
|
|
6777
6809
|
}
|
|
6778
6810
|
if (description) {
|
|
6779
6811
|
if (summary) console.log();
|
|
@@ -6787,7 +6819,7 @@ function viewIssue(issueKey) {
|
|
|
6787
6819
|
}
|
|
6788
6820
|
if (!summary && !description) {
|
|
6789
6821
|
console.log(
|
|
6790
|
-
|
|
6822
|
+
chalk85.yellow(`No summary or description found on ${issueKey}.`)
|
|
6791
6823
|
);
|
|
6792
6824
|
}
|
|
6793
6825
|
}
|
|
@@ -6801,7 +6833,7 @@ function registerJira(program2) {
|
|
|
6801
6833
|
}
|
|
6802
6834
|
|
|
6803
6835
|
// src/commands/news/add/index.ts
|
|
6804
|
-
import
|
|
6836
|
+
import chalk86 from "chalk";
|
|
6805
6837
|
import enquirer7 from "enquirer";
|
|
6806
6838
|
async function add2(url) {
|
|
6807
6839
|
if (!url) {
|
|
@@ -6824,17 +6856,17 @@ async function add2(url) {
|
|
|
6824
6856
|
const news = config.news ?? {};
|
|
6825
6857
|
const feeds = news.feeds ?? [];
|
|
6826
6858
|
if (feeds.includes(url)) {
|
|
6827
|
-
console.log(
|
|
6859
|
+
console.log(chalk86.yellow("Feed already exists in config"));
|
|
6828
6860
|
return;
|
|
6829
6861
|
}
|
|
6830
6862
|
feeds.push(url);
|
|
6831
6863
|
config.news = { ...news, feeds };
|
|
6832
6864
|
saveGlobalConfig(config);
|
|
6833
|
-
console.log(
|
|
6865
|
+
console.log(chalk86.green(`Added feed: ${url}`));
|
|
6834
6866
|
}
|
|
6835
6867
|
|
|
6836
6868
|
// src/commands/news/web/handleRequest.ts
|
|
6837
|
-
import
|
|
6869
|
+
import chalk87 from "chalk";
|
|
6838
6870
|
|
|
6839
6871
|
// src/commands/news/web/shared.ts
|
|
6840
6872
|
import { decodeHTML } from "entities";
|
|
@@ -6970,17 +7002,17 @@ function prefetch() {
|
|
|
6970
7002
|
const config = loadConfig();
|
|
6971
7003
|
const total = config.news.feeds.length;
|
|
6972
7004
|
if (total === 0) return;
|
|
6973
|
-
process.stdout.write(
|
|
7005
|
+
process.stdout.write(chalk87.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
6974
7006
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
6975
7007
|
const width = 20;
|
|
6976
7008
|
const filled = Math.round(done2 / t * width);
|
|
6977
7009
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
6978
7010
|
process.stdout.write(
|
|
6979
|
-
`\r${
|
|
7011
|
+
`\r${chalk87.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
6980
7012
|
);
|
|
6981
7013
|
}).then((items) => {
|
|
6982
7014
|
process.stdout.write(
|
|
6983
|
-
`\r${
|
|
7015
|
+
`\r${chalk87.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
6984
7016
|
`
|
|
6985
7017
|
);
|
|
6986
7018
|
cachedItems = items;
|
|
@@ -7341,20 +7373,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7341
7373
|
}
|
|
7342
7374
|
|
|
7343
7375
|
// src/commands/prs/listComments/printComments.ts
|
|
7344
|
-
import
|
|
7376
|
+
import chalk88 from "chalk";
|
|
7345
7377
|
function formatForHuman(comment3) {
|
|
7346
7378
|
if (comment3.type === "review") {
|
|
7347
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7379
|
+
const stateColor = comment3.state === "APPROVED" ? chalk88.green : comment3.state === "CHANGES_REQUESTED" ? chalk88.red : chalk88.yellow;
|
|
7348
7380
|
return [
|
|
7349
|
-
`${
|
|
7381
|
+
`${chalk88.cyan("Review")} by ${chalk88.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7350
7382
|
comment3.body,
|
|
7351
7383
|
""
|
|
7352
7384
|
].join("\n");
|
|
7353
7385
|
}
|
|
7354
7386
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7355
7387
|
return [
|
|
7356
|
-
`${
|
|
7357
|
-
|
|
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")),
|
|
7358
7390
|
comment3.body,
|
|
7359
7391
|
""
|
|
7360
7392
|
].join("\n");
|
|
@@ -7444,13 +7476,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7444
7476
|
import enquirer8 from "enquirer";
|
|
7445
7477
|
|
|
7446
7478
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7447
|
-
import
|
|
7479
|
+
import chalk89 from "chalk";
|
|
7448
7480
|
var STATUS_MAP = {
|
|
7449
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7450
|
-
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
|
|
7451
7483
|
};
|
|
7452
7484
|
function defaultStatus(pr) {
|
|
7453
|
-
return { label:
|
|
7485
|
+
return { label: chalk89.green("opened"), date: pr.createdAt };
|
|
7454
7486
|
}
|
|
7455
7487
|
function getStatus2(pr) {
|
|
7456
7488
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7459,11 +7491,11 @@ function formatDate(dateStr) {
|
|
|
7459
7491
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7460
7492
|
}
|
|
7461
7493
|
function formatPrHeader(pr, status2) {
|
|
7462
|
-
return `${
|
|
7494
|
+
return `${chalk89.cyan(`#${pr.number}`)} ${pr.title} ${chalk89.dim(`(${pr.author.login},`)} ${status2.label} ${chalk89.dim(`${formatDate(status2.date)})`)}`;
|
|
7463
7495
|
}
|
|
7464
7496
|
function logPrDetails(pr) {
|
|
7465
7497
|
console.log(
|
|
7466
|
-
|
|
7498
|
+
chalk89.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7467
7499
|
);
|
|
7468
7500
|
console.log();
|
|
7469
7501
|
}
|
|
@@ -7629,10 +7661,10 @@ function registerPrs(program2) {
|
|
|
7629
7661
|
}
|
|
7630
7662
|
|
|
7631
7663
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7632
|
-
import
|
|
7664
|
+
import chalk95 from "chalk";
|
|
7633
7665
|
|
|
7634
7666
|
// src/shared/createConnectionAuth.ts
|
|
7635
|
-
import
|
|
7667
|
+
import chalk90 from "chalk";
|
|
7636
7668
|
function listConnections(connections, format2) {
|
|
7637
7669
|
if (connections.length === 0) {
|
|
7638
7670
|
console.log("No connections configured.");
|
|
@@ -7645,7 +7677,7 @@ function listConnections(connections, format2) {
|
|
|
7645
7677
|
function removeConnection(connections, name, save) {
|
|
7646
7678
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7647
7679
|
if (filtered.length === connections.length) {
|
|
7648
|
-
console.error(
|
|
7680
|
+
console.error(chalk90.red(`Connection "${name}" not found.`));
|
|
7649
7681
|
process.exit(1);
|
|
7650
7682
|
}
|
|
7651
7683
|
save(filtered);
|
|
@@ -7691,15 +7723,15 @@ function saveConnections(connections) {
|
|
|
7691
7723
|
}
|
|
7692
7724
|
|
|
7693
7725
|
// src/commands/ravendb/promptConnection.ts
|
|
7694
|
-
import
|
|
7726
|
+
import chalk93 from "chalk";
|
|
7695
7727
|
|
|
7696
7728
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7697
|
-
import
|
|
7729
|
+
import chalk92 from "chalk";
|
|
7698
7730
|
import Enquirer2 from "enquirer";
|
|
7699
7731
|
|
|
7700
7732
|
// src/commands/ravendb/searchItems.ts
|
|
7701
7733
|
import { execSync as execSync34 } from "child_process";
|
|
7702
|
-
import
|
|
7734
|
+
import chalk91 from "chalk";
|
|
7703
7735
|
function opExec(args) {
|
|
7704
7736
|
return execSync34(`op ${args}`, {
|
|
7705
7737
|
encoding: "utf-8",
|
|
@@ -7712,7 +7744,7 @@ function searchItems(search) {
|
|
|
7712
7744
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7713
7745
|
} catch {
|
|
7714
7746
|
console.error(
|
|
7715
|
-
|
|
7747
|
+
chalk91.red(
|
|
7716
7748
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7717
7749
|
)
|
|
7718
7750
|
);
|
|
@@ -7726,7 +7758,7 @@ function getItemFields(itemId) {
|
|
|
7726
7758
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7727
7759
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7728
7760
|
} catch {
|
|
7729
|
-
console.error(
|
|
7761
|
+
console.error(chalk91.red("Failed to get item details from 1Password."));
|
|
7730
7762
|
process.exit(1);
|
|
7731
7763
|
}
|
|
7732
7764
|
}
|
|
@@ -7745,7 +7777,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7745
7777
|
}).run();
|
|
7746
7778
|
const items = searchItems(search);
|
|
7747
7779
|
if (items.length === 0) {
|
|
7748
|
-
console.error(
|
|
7780
|
+
console.error(chalk92.red(`No items found matching "${search}".`));
|
|
7749
7781
|
process.exit(1);
|
|
7750
7782
|
}
|
|
7751
7783
|
const itemId = await selectOne(
|
|
@@ -7754,7 +7786,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7754
7786
|
);
|
|
7755
7787
|
const fields = getItemFields(itemId);
|
|
7756
7788
|
if (fields.length === 0) {
|
|
7757
|
-
console.error(
|
|
7789
|
+
console.error(chalk92.red("No fields with references found on this item."));
|
|
7758
7790
|
process.exit(1);
|
|
7759
7791
|
}
|
|
7760
7792
|
const ref = await selectOne(
|
|
@@ -7768,7 +7800,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7768
7800
|
async function promptConnection(existingNames) {
|
|
7769
7801
|
const name = await promptInput("name", "Connection name:");
|
|
7770
7802
|
if (existingNames.includes(name)) {
|
|
7771
|
-
console.error(
|
|
7803
|
+
console.error(chalk93.red(`Connection "${name}" already exists.`));
|
|
7772
7804
|
process.exit(1);
|
|
7773
7805
|
}
|
|
7774
7806
|
const url = await promptInput(
|
|
@@ -7777,22 +7809,22 @@ async function promptConnection(existingNames) {
|
|
|
7777
7809
|
);
|
|
7778
7810
|
const database = await promptInput("database", "Database name:");
|
|
7779
7811
|
if (!name || !url || !database) {
|
|
7780
|
-
console.error(
|
|
7812
|
+
console.error(chalk93.red("All fields are required."));
|
|
7781
7813
|
process.exit(1);
|
|
7782
7814
|
}
|
|
7783
7815
|
const apiKeyRef = await selectOpSecret();
|
|
7784
|
-
console.log(
|
|
7816
|
+
console.log(chalk93.dim(`Using: ${apiKeyRef}`));
|
|
7785
7817
|
return { name, url, database, apiKeyRef };
|
|
7786
7818
|
}
|
|
7787
7819
|
|
|
7788
7820
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7789
|
-
import
|
|
7821
|
+
import chalk94 from "chalk";
|
|
7790
7822
|
function ravendbSetConnection(name) {
|
|
7791
7823
|
const raw = loadGlobalConfigRaw();
|
|
7792
7824
|
const ravendb = raw.ravendb ?? {};
|
|
7793
7825
|
const connections = ravendb.connections ?? [];
|
|
7794
7826
|
if (!connections.some((c) => c.name === name)) {
|
|
7795
|
-
console.error(
|
|
7827
|
+
console.error(chalk94.red(`Connection "${name}" not found.`));
|
|
7796
7828
|
console.error(
|
|
7797
7829
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7798
7830
|
);
|
|
@@ -7808,16 +7840,16 @@ function ravendbSetConnection(name) {
|
|
|
7808
7840
|
var ravendbAuth = createConnectionAuth({
|
|
7809
7841
|
load: loadConnections,
|
|
7810
7842
|
save: saveConnections,
|
|
7811
|
-
format: (c) => `${
|
|
7843
|
+
format: (c) => `${chalk95.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7812
7844
|
promptNew: promptConnection,
|
|
7813
7845
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7814
7846
|
});
|
|
7815
7847
|
|
|
7816
7848
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7817
|
-
import
|
|
7849
|
+
import chalk99 from "chalk";
|
|
7818
7850
|
|
|
7819
7851
|
// src/commands/ravendb/ravenFetch.ts
|
|
7820
|
-
import
|
|
7852
|
+
import chalk97 from "chalk";
|
|
7821
7853
|
|
|
7822
7854
|
// src/commands/ravendb/getAccessToken.ts
|
|
7823
7855
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7854,10 +7886,10 @@ ${errorText}`
|
|
|
7854
7886
|
|
|
7855
7887
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7856
7888
|
import { execSync as execSync35 } from "child_process";
|
|
7857
|
-
import
|
|
7889
|
+
import chalk96 from "chalk";
|
|
7858
7890
|
function resolveOpSecret(reference) {
|
|
7859
7891
|
if (!reference.startsWith("op://")) {
|
|
7860
|
-
console.error(
|
|
7892
|
+
console.error(chalk96.red(`Invalid secret reference: must start with op://`));
|
|
7861
7893
|
process.exit(1);
|
|
7862
7894
|
}
|
|
7863
7895
|
try {
|
|
@@ -7867,7 +7899,7 @@ function resolveOpSecret(reference) {
|
|
|
7867
7899
|
}).trim();
|
|
7868
7900
|
} catch {
|
|
7869
7901
|
console.error(
|
|
7870
|
-
|
|
7902
|
+
chalk96.red(
|
|
7871
7903
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7872
7904
|
)
|
|
7873
7905
|
);
|
|
@@ -7894,7 +7926,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7894
7926
|
if (!response.ok) {
|
|
7895
7927
|
const body = await response.text();
|
|
7896
7928
|
console.error(
|
|
7897
|
-
|
|
7929
|
+
chalk97.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7898
7930
|
);
|
|
7899
7931
|
console.error(body.substring(0, 500));
|
|
7900
7932
|
process.exit(1);
|
|
@@ -7903,7 +7935,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7903
7935
|
}
|
|
7904
7936
|
|
|
7905
7937
|
// src/commands/ravendb/resolveConnection.ts
|
|
7906
|
-
import
|
|
7938
|
+
import chalk98 from "chalk";
|
|
7907
7939
|
function loadRavendb() {
|
|
7908
7940
|
const raw = loadGlobalConfigRaw();
|
|
7909
7941
|
const ravendb = raw.ravendb;
|
|
@@ -7917,7 +7949,7 @@ function resolveConnection(name) {
|
|
|
7917
7949
|
const connectionName = name ?? defaultConnection;
|
|
7918
7950
|
if (!connectionName) {
|
|
7919
7951
|
console.error(
|
|
7920
|
-
|
|
7952
|
+
chalk98.red(
|
|
7921
7953
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7922
7954
|
)
|
|
7923
7955
|
);
|
|
@@ -7925,7 +7957,7 @@ function resolveConnection(name) {
|
|
|
7925
7957
|
}
|
|
7926
7958
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7927
7959
|
if (!connection) {
|
|
7928
|
-
console.error(
|
|
7960
|
+
console.error(chalk98.red(`Connection "${connectionName}" not found.`));
|
|
7929
7961
|
console.error(
|
|
7930
7962
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7931
7963
|
);
|
|
@@ -7956,15 +7988,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7956
7988
|
return;
|
|
7957
7989
|
}
|
|
7958
7990
|
for (const c of collections) {
|
|
7959
|
-
console.log(`${
|
|
7991
|
+
console.log(`${chalk99.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7960
7992
|
}
|
|
7961
7993
|
}
|
|
7962
7994
|
|
|
7963
7995
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7964
|
-
import
|
|
7996
|
+
import chalk101 from "chalk";
|
|
7965
7997
|
|
|
7966
7998
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7967
|
-
import
|
|
7999
|
+
import chalk100 from "chalk";
|
|
7968
8000
|
|
|
7969
8001
|
// src/commands/ravendb/buildQueryPath.ts
|
|
7970
8002
|
function buildQueryPath(opts) {
|
|
@@ -8002,7 +8034,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8002
8034
|
allResults.push(...results);
|
|
8003
8035
|
start3 += results.length;
|
|
8004
8036
|
process.stderr.write(
|
|
8005
|
-
`\r${
|
|
8037
|
+
`\r${chalk100.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8006
8038
|
);
|
|
8007
8039
|
if (start3 >= totalResults) break;
|
|
8008
8040
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8017,7 +8049,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8017
8049
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8018
8050
|
const resolved = resolveArgs(connectionName, collection);
|
|
8019
8051
|
if (!resolved.collection && !options2.query) {
|
|
8020
|
-
console.error(
|
|
8052
|
+
console.error(chalk101.red("Provide a collection name or --query filter."));
|
|
8021
8053
|
process.exit(1);
|
|
8022
8054
|
}
|
|
8023
8055
|
const { collection: col } = resolved;
|
|
@@ -8055,7 +8087,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8055
8087
|
import * as path27 from "path";
|
|
8056
8088
|
|
|
8057
8089
|
// src/commands/refactor/logViolations.ts
|
|
8058
|
-
import
|
|
8090
|
+
import chalk102 from "chalk";
|
|
8059
8091
|
var DEFAULT_MAX_LINES = 100;
|
|
8060
8092
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8061
8093
|
if (violations.length === 0) {
|
|
@@ -8064,43 +8096,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8064
8096
|
}
|
|
8065
8097
|
return;
|
|
8066
8098
|
}
|
|
8067
|
-
console.error(
|
|
8099
|
+
console.error(chalk102.red(`
|
|
8068
8100
|
Refactor check failed:
|
|
8069
8101
|
`));
|
|
8070
|
-
console.error(
|
|
8102
|
+
console.error(chalk102.red(` The following files exceed ${maxLines} lines:
|
|
8071
8103
|
`));
|
|
8072
8104
|
for (const violation of violations) {
|
|
8073
|
-
console.error(
|
|
8105
|
+
console.error(chalk102.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8074
8106
|
}
|
|
8075
8107
|
console.error(
|
|
8076
|
-
|
|
8108
|
+
chalk102.yellow(
|
|
8077
8109
|
`
|
|
8078
8110
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8079
8111
|
way to refactor it, ignore it with:
|
|
8080
8112
|
`
|
|
8081
8113
|
)
|
|
8082
8114
|
);
|
|
8083
|
-
console.error(
|
|
8115
|
+
console.error(chalk102.gray(` assist refactor ignore <file>
|
|
8084
8116
|
`));
|
|
8085
8117
|
if (process.env.CLAUDECODE) {
|
|
8086
|
-
console.error(
|
|
8118
|
+
console.error(chalk102.cyan(`
|
|
8087
8119
|
## Extracting Code to New Files
|
|
8088
8120
|
`));
|
|
8089
8121
|
console.error(
|
|
8090
|
-
|
|
8122
|
+
chalk102.cyan(
|
|
8091
8123
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8092
8124
|
`
|
|
8093
8125
|
)
|
|
8094
8126
|
);
|
|
8095
8127
|
console.error(
|
|
8096
|
-
|
|
8128
|
+
chalk102.cyan(
|
|
8097
8129
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8098
8130
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8099
8131
|
`
|
|
8100
8132
|
)
|
|
8101
8133
|
);
|
|
8102
8134
|
console.error(
|
|
8103
|
-
|
|
8135
|
+
chalk102.cyan(
|
|
8104
8136
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8105
8137
|
domains, move it to a common/shared folder.
|
|
8106
8138
|
`
|
|
@@ -8256,7 +8288,7 @@ async function check(pattern2, options2) {
|
|
|
8256
8288
|
|
|
8257
8289
|
// src/commands/refactor/extract/index.ts
|
|
8258
8290
|
import path33 from "path";
|
|
8259
|
-
import
|
|
8291
|
+
import chalk105 from "chalk";
|
|
8260
8292
|
|
|
8261
8293
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8262
8294
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8803,23 +8835,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8803
8835
|
|
|
8804
8836
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8805
8837
|
import path31 from "path";
|
|
8806
|
-
import
|
|
8838
|
+
import chalk103 from "chalk";
|
|
8807
8839
|
function section(title) {
|
|
8808
8840
|
return `
|
|
8809
|
-
${
|
|
8841
|
+
${chalk103.cyan(title)}`;
|
|
8810
8842
|
}
|
|
8811
8843
|
function displayImporters(plan2, cwd) {
|
|
8812
8844
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8813
8845
|
console.log(section("Update importers:"));
|
|
8814
8846
|
for (const imp of plan2.importersToUpdate) {
|
|
8815
8847
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8816
|
-
console.log(` ${
|
|
8848
|
+
console.log(` ${chalk103.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8817
8849
|
}
|
|
8818
8850
|
}
|
|
8819
8851
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8820
|
-
console.log(
|
|
8852
|
+
console.log(chalk103.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8821
8853
|
`));
|
|
8822
|
-
console.log(` ${
|
|
8854
|
+
console.log(` ${chalk103.cyan("Functions to move:")}`);
|
|
8823
8855
|
for (const name of plan2.extractedNames) {
|
|
8824
8856
|
console.log(` ${name}`);
|
|
8825
8857
|
}
|
|
@@ -8854,7 +8886,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8854
8886
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8855
8887
|
import fs17 from "fs";
|
|
8856
8888
|
import path32 from "path";
|
|
8857
|
-
import
|
|
8889
|
+
import chalk104 from "chalk";
|
|
8858
8890
|
import { Project as Project2 } from "ts-morph";
|
|
8859
8891
|
function findTsConfig(sourcePath) {
|
|
8860
8892
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8885,7 +8917,7 @@ function loadProjectFile(file) {
|
|
|
8885
8917
|
});
|
|
8886
8918
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8887
8919
|
if (!sourceFile) {
|
|
8888
|
-
console.log(
|
|
8920
|
+
console.log(chalk104.red(`File not found in project: ${file}`));
|
|
8889
8921
|
process.exit(1);
|
|
8890
8922
|
}
|
|
8891
8923
|
return { project, sourceFile };
|
|
@@ -8908,19 +8940,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8908
8940
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8909
8941
|
if (options2.apply) {
|
|
8910
8942
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8911
|
-
console.log(
|
|
8943
|
+
console.log(chalk105.green("\nExtraction complete"));
|
|
8912
8944
|
} else {
|
|
8913
|
-
console.log(
|
|
8945
|
+
console.log(chalk105.dim("\nDry run. Use --apply to execute."));
|
|
8914
8946
|
}
|
|
8915
8947
|
}
|
|
8916
8948
|
|
|
8917
8949
|
// src/commands/refactor/ignore.ts
|
|
8918
8950
|
import fs18 from "fs";
|
|
8919
|
-
import
|
|
8951
|
+
import chalk106 from "chalk";
|
|
8920
8952
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8921
8953
|
function ignore(file) {
|
|
8922
8954
|
if (!fs18.existsSync(file)) {
|
|
8923
|
-
console.error(
|
|
8955
|
+
console.error(chalk106.red(`Error: File does not exist: ${file}`));
|
|
8924
8956
|
process.exit(1);
|
|
8925
8957
|
}
|
|
8926
8958
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8936,7 +8968,7 @@ function ignore(file) {
|
|
|
8936
8968
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8937
8969
|
}
|
|
8938
8970
|
console.log(
|
|
8939
|
-
|
|
8971
|
+
chalk106.green(
|
|
8940
8972
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8941
8973
|
)
|
|
8942
8974
|
);
|
|
@@ -8944,26 +8976,26 @@ function ignore(file) {
|
|
|
8944
8976
|
|
|
8945
8977
|
// src/commands/refactor/rename/index.ts
|
|
8946
8978
|
import path34 from "path";
|
|
8947
|
-
import
|
|
8979
|
+
import chalk107 from "chalk";
|
|
8948
8980
|
async function rename(source, destination, options2 = {}) {
|
|
8949
8981
|
const destPath = path34.resolve(destination);
|
|
8950
8982
|
const cwd = process.cwd();
|
|
8951
8983
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8952
8984
|
const relDest = path34.relative(cwd, destPath);
|
|
8953
8985
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8954
|
-
console.log(
|
|
8986
|
+
console.log(chalk107.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8955
8987
|
if (options2.apply) {
|
|
8956
8988
|
sourceFile.move(destPath);
|
|
8957
8989
|
await project.save();
|
|
8958
|
-
console.log(
|
|
8990
|
+
console.log(chalk107.green("Done"));
|
|
8959
8991
|
} else {
|
|
8960
|
-
console.log(
|
|
8992
|
+
console.log(chalk107.dim("Dry run. Use --apply to execute."));
|
|
8961
8993
|
}
|
|
8962
8994
|
}
|
|
8963
8995
|
|
|
8964
8996
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8965
8997
|
import path36 from "path";
|
|
8966
|
-
import
|
|
8998
|
+
import chalk108 from "chalk";
|
|
8967
8999
|
import { Project as Project3 } from "ts-morph";
|
|
8968
9000
|
|
|
8969
9001
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9012,38 +9044,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9012
9044
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9013
9045
|
const sourceFile = project.getSourceFile(filePath);
|
|
9014
9046
|
if (!sourceFile) {
|
|
9015
|
-
console.log(
|
|
9047
|
+
console.log(chalk108.red(`File not found in project: ${file}`));
|
|
9016
9048
|
process.exit(1);
|
|
9017
9049
|
}
|
|
9018
9050
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9019
9051
|
if (!symbol) {
|
|
9020
|
-
console.log(
|
|
9052
|
+
console.log(chalk108.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9021
9053
|
process.exit(1);
|
|
9022
9054
|
}
|
|
9023
9055
|
const grouped = groupReferences(symbol, cwd);
|
|
9024
9056
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9025
9057
|
console.log(
|
|
9026
|
-
|
|
9058
|
+
chalk108.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9027
9059
|
`)
|
|
9028
9060
|
);
|
|
9029
9061
|
for (const [refFile, lines] of grouped) {
|
|
9030
9062
|
console.log(
|
|
9031
|
-
` ${
|
|
9063
|
+
` ${chalk108.dim(refFile)}: lines ${chalk108.cyan(lines.join(", "))}`
|
|
9032
9064
|
);
|
|
9033
9065
|
}
|
|
9034
9066
|
if (options2.apply) {
|
|
9035
9067
|
symbol.rename(newName);
|
|
9036
9068
|
await project.save();
|
|
9037
|
-
console.log(
|
|
9069
|
+
console.log(chalk108.green(`
|
|
9038
9070
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9039
9071
|
} else {
|
|
9040
|
-
console.log(
|
|
9072
|
+
console.log(chalk108.dim("\nDry run. Use --apply to execute."));
|
|
9041
9073
|
}
|
|
9042
9074
|
}
|
|
9043
9075
|
|
|
9044
9076
|
// src/commands/refactor/restructure/index.ts
|
|
9045
9077
|
import path45 from "path";
|
|
9046
|
-
import
|
|
9078
|
+
import chalk111 from "chalk";
|
|
9047
9079
|
|
|
9048
9080
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9049
9081
|
import path37 from "path";
|
|
@@ -9286,50 +9318,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9286
9318
|
|
|
9287
9319
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9288
9320
|
import path41 from "path";
|
|
9289
|
-
import
|
|
9321
|
+
import chalk109 from "chalk";
|
|
9290
9322
|
function relPath(filePath) {
|
|
9291
9323
|
return path41.relative(process.cwd(), filePath);
|
|
9292
9324
|
}
|
|
9293
9325
|
function displayMoves(plan2) {
|
|
9294
9326
|
if (plan2.moves.length === 0) return;
|
|
9295
|
-
console.log(
|
|
9327
|
+
console.log(chalk109.bold("\nFile moves:"));
|
|
9296
9328
|
for (const move of plan2.moves) {
|
|
9297
9329
|
console.log(
|
|
9298
|
-
` ${
|
|
9330
|
+
` ${chalk109.red(relPath(move.from))} \u2192 ${chalk109.green(relPath(move.to))}`
|
|
9299
9331
|
);
|
|
9300
|
-
console.log(
|
|
9332
|
+
console.log(chalk109.dim(` ${move.reason}`));
|
|
9301
9333
|
}
|
|
9302
9334
|
}
|
|
9303
9335
|
function displayRewrites(rewrites) {
|
|
9304
9336
|
if (rewrites.length === 0) return;
|
|
9305
9337
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9306
|
-
console.log(
|
|
9338
|
+
console.log(chalk109.bold(`
|
|
9307
9339
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9308
9340
|
for (const file of affectedFiles) {
|
|
9309
|
-
console.log(` ${
|
|
9341
|
+
console.log(` ${chalk109.cyan(relPath(file))}:`);
|
|
9310
9342
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9311
9343
|
(r) => r.file === file
|
|
9312
9344
|
)) {
|
|
9313
9345
|
console.log(
|
|
9314
|
-
` ${
|
|
9346
|
+
` ${chalk109.red(`"${oldSpecifier}"`)} \u2192 ${chalk109.green(`"${newSpecifier}"`)}`
|
|
9315
9347
|
);
|
|
9316
9348
|
}
|
|
9317
9349
|
}
|
|
9318
9350
|
}
|
|
9319
9351
|
function displayPlan2(plan2) {
|
|
9320
9352
|
if (plan2.warnings.length > 0) {
|
|
9321
|
-
console.log(
|
|
9322
|
-
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}`));
|
|
9323
9355
|
}
|
|
9324
9356
|
if (plan2.newDirectories.length > 0) {
|
|
9325
|
-
console.log(
|
|
9357
|
+
console.log(chalk109.bold("\nNew directories:"));
|
|
9326
9358
|
for (const dir of plan2.newDirectories)
|
|
9327
|
-
console.log(
|
|
9359
|
+
console.log(chalk109.green(` ${dir}/`));
|
|
9328
9360
|
}
|
|
9329
9361
|
displayMoves(plan2);
|
|
9330
9362
|
displayRewrites(plan2.rewrites);
|
|
9331
9363
|
console.log(
|
|
9332
|
-
|
|
9364
|
+
chalk109.dim(
|
|
9333
9365
|
`
|
|
9334
9366
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9335
9367
|
)
|
|
@@ -9339,18 +9371,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9339
9371
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9340
9372
|
import fs20 from "fs";
|
|
9341
9373
|
import path42 from "path";
|
|
9342
|
-
import
|
|
9374
|
+
import chalk110 from "chalk";
|
|
9343
9375
|
function executePlan(plan2) {
|
|
9344
9376
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9345
9377
|
for (const [file, content] of updatedContents) {
|
|
9346
9378
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9347
9379
|
console.log(
|
|
9348
|
-
|
|
9380
|
+
chalk110.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9349
9381
|
);
|
|
9350
9382
|
}
|
|
9351
9383
|
for (const dir of plan2.newDirectories) {
|
|
9352
9384
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9353
|
-
console.log(
|
|
9385
|
+
console.log(chalk110.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9354
9386
|
}
|
|
9355
9387
|
for (const move of plan2.moves) {
|
|
9356
9388
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9359,7 +9391,7 @@ function executePlan(plan2) {
|
|
|
9359
9391
|
}
|
|
9360
9392
|
fs20.renameSync(move.from, move.to);
|
|
9361
9393
|
console.log(
|
|
9362
|
-
|
|
9394
|
+
chalk110.white(
|
|
9363
9395
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9364
9396
|
)
|
|
9365
9397
|
);
|
|
@@ -9374,7 +9406,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9374
9406
|
if (entries.length === 0) {
|
|
9375
9407
|
fs20.rmdirSync(dir);
|
|
9376
9408
|
console.log(
|
|
9377
|
-
|
|
9409
|
+
chalk110.dim(
|
|
9378
9410
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9379
9411
|
)
|
|
9380
9412
|
);
|
|
@@ -9507,22 +9539,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9507
9539
|
const targetPattern = pattern2 ?? "src";
|
|
9508
9540
|
const files = findSourceFiles2(targetPattern);
|
|
9509
9541
|
if (files.length === 0) {
|
|
9510
|
-
console.log(
|
|
9542
|
+
console.log(chalk111.yellow("No files found matching pattern"));
|
|
9511
9543
|
return;
|
|
9512
9544
|
}
|
|
9513
9545
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9514
9546
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9515
9547
|
if (plan2.moves.length === 0) {
|
|
9516
|
-
console.log(
|
|
9548
|
+
console.log(chalk111.green("No restructuring needed"));
|
|
9517
9549
|
return;
|
|
9518
9550
|
}
|
|
9519
9551
|
displayPlan2(plan2);
|
|
9520
9552
|
if (options2.apply) {
|
|
9521
|
-
console.log(
|
|
9553
|
+
console.log(chalk111.bold("\nApplying changes..."));
|
|
9522
9554
|
executePlan(plan2);
|
|
9523
|
-
console.log(
|
|
9555
|
+
console.log(chalk111.green("\nRestructuring complete"));
|
|
9524
9556
|
} else {
|
|
9525
|
-
console.log(
|
|
9557
|
+
console.log(chalk111.dim("\nDry run. Use --apply to execute."));
|
|
9526
9558
|
}
|
|
9527
9559
|
}
|
|
9528
9560
|
|
|
@@ -9562,7 +9594,7 @@ function registerRefactor(program2) {
|
|
|
9562
9594
|
}
|
|
9563
9595
|
|
|
9564
9596
|
// src/commands/seq/seqAuth.ts
|
|
9565
|
-
import
|
|
9597
|
+
import chalk113 from "chalk";
|
|
9566
9598
|
|
|
9567
9599
|
// src/commands/seq/loadConnections.ts
|
|
9568
9600
|
function loadConnections2() {
|
|
@@ -9591,11 +9623,11 @@ function setDefaultConnection(name) {
|
|
|
9591
9623
|
}
|
|
9592
9624
|
|
|
9593
9625
|
// src/commands/seq/promptConnection.ts
|
|
9594
|
-
import
|
|
9626
|
+
import chalk112 from "chalk";
|
|
9595
9627
|
async function promptConnection2(existingNames) {
|
|
9596
9628
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9597
9629
|
if (existingNames.includes(name)) {
|
|
9598
|
-
console.error(
|
|
9630
|
+
console.error(chalk112.red(`Connection "${name}" already exists.`));
|
|
9599
9631
|
process.exit(1);
|
|
9600
9632
|
}
|
|
9601
9633
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9607,16 +9639,16 @@ async function promptConnection2(existingNames) {
|
|
|
9607
9639
|
var seqAuth = createConnectionAuth({
|
|
9608
9640
|
load: loadConnections2,
|
|
9609
9641
|
save: saveConnections2,
|
|
9610
|
-
format: (c) => `${
|
|
9642
|
+
format: (c) => `${chalk113.bold(c.name)} ${c.url}`,
|
|
9611
9643
|
promptNew: promptConnection2,
|
|
9612
9644
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9613
9645
|
});
|
|
9614
9646
|
|
|
9615
9647
|
// src/commands/seq/seqQuery.ts
|
|
9616
|
-
import
|
|
9648
|
+
import chalk117 from "chalk";
|
|
9617
9649
|
|
|
9618
9650
|
// src/commands/seq/fetchSeq.ts
|
|
9619
|
-
import
|
|
9651
|
+
import chalk114 from "chalk";
|
|
9620
9652
|
async function fetchSeq(conn, path50, params) {
|
|
9621
9653
|
const url = `${conn.url}${path50}?${params}`;
|
|
9622
9654
|
const response = await fetch(url, {
|
|
@@ -9627,7 +9659,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9627
9659
|
});
|
|
9628
9660
|
if (!response.ok) {
|
|
9629
9661
|
const body = await response.text();
|
|
9630
|
-
console.error(
|
|
9662
|
+
console.error(chalk114.red(`Seq returned ${response.status}: ${body}`));
|
|
9631
9663
|
process.exit(1);
|
|
9632
9664
|
}
|
|
9633
9665
|
return response;
|
|
@@ -9680,23 +9712,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9680
9712
|
}
|
|
9681
9713
|
|
|
9682
9714
|
// src/commands/seq/formatEvent.ts
|
|
9683
|
-
import
|
|
9715
|
+
import chalk115 from "chalk";
|
|
9684
9716
|
function levelColor(level) {
|
|
9685
9717
|
switch (level) {
|
|
9686
9718
|
case "Fatal":
|
|
9687
|
-
return
|
|
9719
|
+
return chalk115.bgRed.white;
|
|
9688
9720
|
case "Error":
|
|
9689
|
-
return
|
|
9721
|
+
return chalk115.red;
|
|
9690
9722
|
case "Warning":
|
|
9691
|
-
return
|
|
9723
|
+
return chalk115.yellow;
|
|
9692
9724
|
case "Information":
|
|
9693
|
-
return
|
|
9725
|
+
return chalk115.cyan;
|
|
9694
9726
|
case "Debug":
|
|
9695
|
-
return
|
|
9727
|
+
return chalk115.gray;
|
|
9696
9728
|
case "Verbose":
|
|
9697
|
-
return
|
|
9729
|
+
return chalk115.dim;
|
|
9698
9730
|
default:
|
|
9699
|
-
return
|
|
9731
|
+
return chalk115.white;
|
|
9700
9732
|
}
|
|
9701
9733
|
}
|
|
9702
9734
|
function levelAbbrev(level) {
|
|
@@ -9737,31 +9769,31 @@ function formatTimestamp(iso) {
|
|
|
9737
9769
|
function formatEvent(event) {
|
|
9738
9770
|
const color = levelColor(event.Level);
|
|
9739
9771
|
const abbrev = levelAbbrev(event.Level);
|
|
9740
|
-
const ts8 =
|
|
9772
|
+
const ts8 = chalk115.dim(formatTimestamp(event.Timestamp));
|
|
9741
9773
|
const msg = renderMessage(event);
|
|
9742
9774
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9743
9775
|
if (event.Exception) {
|
|
9744
9776
|
for (const line of event.Exception.split("\n")) {
|
|
9745
|
-
lines.push(
|
|
9777
|
+
lines.push(chalk115.red(` ${line}`));
|
|
9746
9778
|
}
|
|
9747
9779
|
}
|
|
9748
9780
|
return lines.join("\n");
|
|
9749
9781
|
}
|
|
9750
9782
|
|
|
9751
9783
|
// src/commands/seq/resolveConnection.ts
|
|
9752
|
-
import
|
|
9784
|
+
import chalk116 from "chalk";
|
|
9753
9785
|
function resolveConnection2(name) {
|
|
9754
9786
|
const connections = loadConnections2();
|
|
9755
9787
|
if (connections.length === 0) {
|
|
9756
9788
|
console.error(
|
|
9757
|
-
|
|
9789
|
+
chalk116.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9758
9790
|
);
|
|
9759
9791
|
process.exit(1);
|
|
9760
9792
|
}
|
|
9761
9793
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9762
9794
|
const connection = connections.find((c) => c.name === target);
|
|
9763
9795
|
if (!connection) {
|
|
9764
|
-
console.error(
|
|
9796
|
+
console.error(chalk116.red(`Seq connection "${target}" not found.`));
|
|
9765
9797
|
process.exit(1);
|
|
9766
9798
|
}
|
|
9767
9799
|
return connection;
|
|
@@ -9776,7 +9808,7 @@ async function seqQuery(filter, options2) {
|
|
|
9776
9808
|
new URLSearchParams({ filter, count: String(count) })
|
|
9777
9809
|
);
|
|
9778
9810
|
if (events.length === 0) {
|
|
9779
|
-
console.log(
|
|
9811
|
+
console.log(chalk117.yellow("No events found."));
|
|
9780
9812
|
return;
|
|
9781
9813
|
}
|
|
9782
9814
|
if (options2.json) {
|
|
@@ -9787,11 +9819,11 @@ async function seqQuery(filter, options2) {
|
|
|
9787
9819
|
for (const event of chronological) {
|
|
9788
9820
|
console.log(formatEvent(event));
|
|
9789
9821
|
}
|
|
9790
|
-
console.log(
|
|
9822
|
+
console.log(chalk117.dim(`
|
|
9791
9823
|
${events.length} events`));
|
|
9792
9824
|
if (events.length >= count) {
|
|
9793
9825
|
console.log(
|
|
9794
|
-
|
|
9826
|
+
chalk117.yellow(
|
|
9795
9827
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9796
9828
|
)
|
|
9797
9829
|
);
|
|
@@ -9799,11 +9831,11 @@ ${events.length} events`));
|
|
|
9799
9831
|
}
|
|
9800
9832
|
|
|
9801
9833
|
// src/commands/seq/seqSetConnection.ts
|
|
9802
|
-
import
|
|
9834
|
+
import chalk118 from "chalk";
|
|
9803
9835
|
function seqSetConnection(name) {
|
|
9804
9836
|
const connections = loadConnections2();
|
|
9805
9837
|
if (!connections.find((c) => c.name === name)) {
|
|
9806
|
-
console.error(
|
|
9838
|
+
console.error(chalk118.red(`Connection "${name}" not found.`));
|
|
9807
9839
|
process.exit(1);
|
|
9808
9840
|
}
|
|
9809
9841
|
setDefaultConnection(name);
|
|
@@ -10342,14 +10374,14 @@ import {
|
|
|
10342
10374
|
import { dirname as dirname20, join as join33 } from "path";
|
|
10343
10375
|
|
|
10344
10376
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10345
|
-
import
|
|
10377
|
+
import chalk119 from "chalk";
|
|
10346
10378
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10347
10379
|
function validateStagedContent(filename, content) {
|
|
10348
10380
|
const firstLine = content.split("\n")[0];
|
|
10349
10381
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10350
10382
|
if (!match) {
|
|
10351
10383
|
console.error(
|
|
10352
|
-
|
|
10384
|
+
chalk119.red(
|
|
10353
10385
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10354
10386
|
)
|
|
10355
10387
|
);
|
|
@@ -10358,7 +10390,7 @@ function validateStagedContent(filename, content) {
|
|
|
10358
10390
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10359
10391
|
if (!contentAfterLink) {
|
|
10360
10392
|
console.error(
|
|
10361
|
-
|
|
10393
|
+
chalk119.red(
|
|
10362
10394
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10363
10395
|
)
|
|
10364
10396
|
);
|
|
@@ -10751,7 +10783,7 @@ function registerVoice(program2) {
|
|
|
10751
10783
|
|
|
10752
10784
|
// src/commands/roam/auth.ts
|
|
10753
10785
|
import { randomBytes } from "crypto";
|
|
10754
|
-
import
|
|
10786
|
+
import chalk120 from "chalk";
|
|
10755
10787
|
|
|
10756
10788
|
// src/lib/openBrowser.ts
|
|
10757
10789
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10926,13 +10958,13 @@ async function auth() {
|
|
|
10926
10958
|
saveGlobalConfig(config);
|
|
10927
10959
|
const state = randomBytes(16).toString("hex");
|
|
10928
10960
|
console.log(
|
|
10929
|
-
|
|
10961
|
+
chalk120.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10930
10962
|
);
|
|
10931
|
-
console.log(
|
|
10932
|
-
console.log(
|
|
10933
|
-
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..."));
|
|
10934
10966
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10935
|
-
console.log(
|
|
10967
|
+
console.log(chalk120.dim("Exchanging code for tokens..."));
|
|
10936
10968
|
const tokens = await exchangeToken({
|
|
10937
10969
|
code,
|
|
10938
10970
|
clientId,
|
|
@@ -10948,7 +10980,7 @@ async function auth() {
|
|
|
10948
10980
|
};
|
|
10949
10981
|
saveGlobalConfig(config);
|
|
10950
10982
|
console.log(
|
|
10951
|
-
|
|
10983
|
+
chalk120.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10952
10984
|
);
|
|
10953
10985
|
}
|
|
10954
10986
|
|
|
@@ -11161,7 +11193,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11161
11193
|
import { existsSync as existsSync41, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11162
11194
|
import { tmpdir as tmpdir6 } from "os";
|
|
11163
11195
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11164
|
-
import
|
|
11196
|
+
import chalk121 from "chalk";
|
|
11165
11197
|
|
|
11166
11198
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11167
11199
|
var captureWindowPs1 = `
|
|
@@ -11312,22 +11344,22 @@ function screenshot(processName) {
|
|
|
11312
11344
|
const config = loadConfig();
|
|
11313
11345
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11314
11346
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11315
|
-
console.log(
|
|
11347
|
+
console.log(chalk121.gray(`Capturing window for process "${processName}" ...`));
|
|
11316
11348
|
try {
|
|
11317
11349
|
runPowerShellScript(processName, outputPath);
|
|
11318
|
-
console.log(
|
|
11350
|
+
console.log(chalk121.green(`Screenshot saved: ${outputPath}`));
|
|
11319
11351
|
} catch (error) {
|
|
11320
11352
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11321
|
-
console.error(
|
|
11353
|
+
console.error(chalk121.red(`Failed to capture screenshot: ${msg}`));
|
|
11322
11354
|
process.exit(1);
|
|
11323
11355
|
}
|
|
11324
11356
|
}
|
|
11325
11357
|
|
|
11326
11358
|
// src/commands/statusLine.ts
|
|
11327
|
-
import
|
|
11359
|
+
import chalk123 from "chalk";
|
|
11328
11360
|
|
|
11329
11361
|
// src/commands/buildLimitsSegment.ts
|
|
11330
|
-
import
|
|
11362
|
+
import chalk122 from "chalk";
|
|
11331
11363
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11332
11364
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11333
11365
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11350,10 +11382,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11350
11382
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11351
11383
|
const label2 = `${Math.round(pct)}%`;
|
|
11352
11384
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11353
|
-
if (projected == null) return
|
|
11354
|
-
if (projected > 100) return
|
|
11355
|
-
if (projected > 75) return
|
|
11356
|
-
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);
|
|
11357
11389
|
}
|
|
11358
11390
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11359
11391
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11379,14 +11411,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11379
11411
|
}
|
|
11380
11412
|
|
|
11381
11413
|
// src/commands/statusLine.ts
|
|
11382
|
-
|
|
11414
|
+
chalk123.level = 3;
|
|
11383
11415
|
function formatNumber(num) {
|
|
11384
11416
|
return num.toLocaleString("en-US");
|
|
11385
11417
|
}
|
|
11386
11418
|
function colorizePercent(pct) {
|
|
11387
11419
|
const label2 = `${Math.round(pct)}%`;
|
|
11388
|
-
if (pct > 80) return
|
|
11389
|
-
if (pct > 40) return
|
|
11420
|
+
if (pct > 80) return chalk123.red(label2);
|
|
11421
|
+
if (pct > 40) return chalk123.yellow(label2);
|
|
11390
11422
|
return label2;
|
|
11391
11423
|
}
|
|
11392
11424
|
async function statusLine() {
|
|
@@ -11409,7 +11441,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11409
11441
|
// src/commands/sync/syncClaudeMd.ts
|
|
11410
11442
|
import * as fs23 from "fs";
|
|
11411
11443
|
import * as path46 from "path";
|
|
11412
|
-
import
|
|
11444
|
+
import chalk124 from "chalk";
|
|
11413
11445
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11414
11446
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11415
11447
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11418,12 +11450,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11418
11450
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11419
11451
|
if (sourceContent !== targetContent) {
|
|
11420
11452
|
console.log(
|
|
11421
|
-
|
|
11453
|
+
chalk124.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11422
11454
|
);
|
|
11423
11455
|
console.log();
|
|
11424
11456
|
printDiff(targetContent, sourceContent);
|
|
11425
11457
|
const confirm = options2?.yes || await promptConfirm(
|
|
11426
|
-
|
|
11458
|
+
chalk124.red("Overwrite existing CLAUDE.md?"),
|
|
11427
11459
|
false
|
|
11428
11460
|
);
|
|
11429
11461
|
if (!confirm) {
|
|
@@ -11439,7 +11471,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11439
11471
|
// src/commands/sync/syncSettings.ts
|
|
11440
11472
|
import * as fs24 from "fs";
|
|
11441
11473
|
import * as path47 from "path";
|
|
11442
|
-
import
|
|
11474
|
+
import chalk125 from "chalk";
|
|
11443
11475
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11444
11476
|
const source = path47.join(claudeDir, "settings.json");
|
|
11445
11477
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11455,14 +11487,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11455
11487
|
if (mergedContent !== normalizedTarget) {
|
|
11456
11488
|
if (!options2?.yes) {
|
|
11457
11489
|
console.log(
|
|
11458
|
-
|
|
11490
|
+
chalk125.yellow(
|
|
11459
11491
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11460
11492
|
)
|
|
11461
11493
|
);
|
|
11462
11494
|
console.log();
|
|
11463
11495
|
printDiff(targetContent, mergedContent);
|
|
11464
11496
|
const confirm = await promptConfirm(
|
|
11465
|
-
|
|
11497
|
+
chalk125.red("Overwrite existing settings.json?"),
|
|
11466
11498
|
false
|
|
11467
11499
|
);
|
|
11468
11500
|
if (!confirm) {
|