@staff0rd/assist 0.173.0 → 0.174.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/backlog/web/bundle.js +20 -20
- package/dist/index.js +368 -305
- 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.174.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -307,9 +307,9 @@ function saveAllItems(db, items) {
|
|
|
307
307
|
import { z } from "zod";
|
|
308
308
|
var backlogStatusSchema = z.enum(["todo", "in-progress", "done", "wontdo"]);
|
|
309
309
|
var backlogTypeSchema = z.enum(["story", "bug"]);
|
|
310
|
-
var planTaskSchema = z.
|
|
310
|
+
var planTaskSchema = z.object({
|
|
311
311
|
task: z.string()
|
|
312
|
-
});
|
|
312
|
+
}).strip();
|
|
313
313
|
var planPhaseSchema = z.strictObject({
|
|
314
314
|
name: z.string(),
|
|
315
315
|
tasks: z.array(planTaskSchema),
|
|
@@ -465,6 +465,25 @@ function openDb(dir) {
|
|
|
465
465
|
return db;
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
+
// src/commands/backlog/searchItemIds.ts
|
|
469
|
+
function searchItemIds(db, query) {
|
|
470
|
+
const pattern2 = `%${query}%`;
|
|
471
|
+
const rows = db.prepare(
|
|
472
|
+
`SELECT DISTINCT id FROM items
|
|
473
|
+
WHERE name LIKE ? COLLATE NOCASE
|
|
474
|
+
OR description LIKE ? COLLATE NOCASE
|
|
475
|
+
OR acceptance_criteria LIKE ? COLLATE NOCASE
|
|
476
|
+
UNION
|
|
477
|
+
SELECT DISTINCT item_id AS id FROM comments
|
|
478
|
+
WHERE text LIKE ? COLLATE NOCASE
|
|
479
|
+
UNION
|
|
480
|
+
SELECT DISTINCT item_id AS id FROM plan_phases
|
|
481
|
+
WHERE name LIKE ? COLLATE NOCASE
|
|
482
|
+
ORDER BY id`
|
|
483
|
+
).all(pattern2, pattern2, pattern2, pattern2, pattern2);
|
|
484
|
+
return rows.map((r) => r.id);
|
|
485
|
+
}
|
|
486
|
+
|
|
468
487
|
// src/commands/backlog/updateCurrentPhase.ts
|
|
469
488
|
function updateCurrentPhase(db, id, phase) {
|
|
470
489
|
const result = db.prepare("UPDATE items SET current_phase = ? WHERE id = ?").run(phase, id);
|
|
@@ -504,6 +523,13 @@ function loadBacklog() {
|
|
|
504
523
|
importFromJsonlIfNeeded(db, getBacklogDir());
|
|
505
524
|
return loadAllItems(db);
|
|
506
525
|
}
|
|
526
|
+
function searchBacklog(query) {
|
|
527
|
+
const db = getDb();
|
|
528
|
+
importFromJsonlIfNeeded(db, getBacklogDir());
|
|
529
|
+
const ids = searchItemIds(db, query);
|
|
530
|
+
const allItems = loadAllItems(db);
|
|
531
|
+
return allItems.filter((item) => ids.includes(item.id));
|
|
532
|
+
}
|
|
507
533
|
function saveBacklog(items) {
|
|
508
534
|
const db = getDb();
|
|
509
535
|
saveAllItems(db, items);
|
|
@@ -1305,8 +1331,10 @@ async function parseStatusBody(req) {
|
|
|
1305
1331
|
}
|
|
1306
1332
|
|
|
1307
1333
|
// src/commands/backlog/web/shared.ts
|
|
1308
|
-
function listItems(
|
|
1309
|
-
|
|
1334
|
+
function listItems(req, res) {
|
|
1335
|
+
const url = new URL(req.url ?? "/", "http://localhost");
|
|
1336
|
+
const q = url.searchParams.get("q");
|
|
1337
|
+
respondJson(res, 200, q ? searchBacklog(q) : loadBacklog());
|
|
1310
1338
|
}
|
|
1311
1339
|
function findItemOr404(res, id) {
|
|
1312
1340
|
const items = loadBacklog();
|
|
@@ -4046,17 +4074,51 @@ function registerLinkCommands(cmd) {
|
|
|
4046
4074
|
cmd.command("unlink <from> <to>").description("Remove a link between two backlog items").action(unlink);
|
|
4047
4075
|
}
|
|
4048
4076
|
|
|
4049
|
-
// src/commands/backlog/
|
|
4077
|
+
// src/commands/backlog/search/index.ts
|
|
4050
4078
|
import chalk51 from "chalk";
|
|
4079
|
+
async function search(query) {
|
|
4080
|
+
if (!backlogExists()) {
|
|
4081
|
+
console.log(
|
|
4082
|
+
chalk51.yellow(
|
|
4083
|
+
"No backlog found. Run 'assist backlog init' to create one."
|
|
4084
|
+
)
|
|
4085
|
+
);
|
|
4086
|
+
return;
|
|
4087
|
+
}
|
|
4088
|
+
const items = searchBacklog(query);
|
|
4089
|
+
if (items.length === 0) {
|
|
4090
|
+
console.log(chalk51.dim(`No items matching "${query}".`));
|
|
4091
|
+
return;
|
|
4092
|
+
}
|
|
4093
|
+
console.log(
|
|
4094
|
+
chalk51.dim(
|
|
4095
|
+
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
4096
|
+
`
|
|
4097
|
+
)
|
|
4098
|
+
);
|
|
4099
|
+
for (const item of items) {
|
|
4100
|
+
console.log(
|
|
4101
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk51.dim(`#${item.id}`)} ${item.name}`
|
|
4102
|
+
);
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
// src/commands/backlog/registerSearchCommand.ts
|
|
4107
|
+
function registerSearchCommand(cmd) {
|
|
4108
|
+
cmd.command("search <query>").description("Search backlog items by keyword").action(search);
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
// src/commands/backlog/delete/index.ts
|
|
4112
|
+
import chalk52 from "chalk";
|
|
4051
4113
|
async function del(id) {
|
|
4052
4114
|
const name = removeItem(id);
|
|
4053
4115
|
if (name) {
|
|
4054
|
-
console.log(
|
|
4116
|
+
console.log(chalk52.green(`Deleted item #${id}: ${name}`));
|
|
4055
4117
|
}
|
|
4056
4118
|
}
|
|
4057
4119
|
|
|
4058
4120
|
// src/commands/backlog/done/index.ts
|
|
4059
|
-
import
|
|
4121
|
+
import chalk53 from "chalk";
|
|
4060
4122
|
async function done(id, summary) {
|
|
4061
4123
|
const result = loadAndFindItem(id);
|
|
4062
4124
|
if (!result) return;
|
|
@@ -4066,20 +4128,20 @@ async function done(id, summary) {
|
|
|
4066
4128
|
addPhaseSummary(result.item, summary, phase);
|
|
4067
4129
|
}
|
|
4068
4130
|
saveBacklog(result.items);
|
|
4069
|
-
console.log(
|
|
4131
|
+
console.log(chalk53.green(`Completed item #${id}: ${result.item.name}`));
|
|
4070
4132
|
}
|
|
4071
4133
|
|
|
4072
4134
|
// src/commands/backlog/start/index.ts
|
|
4073
|
-
import
|
|
4135
|
+
import chalk54 from "chalk";
|
|
4074
4136
|
async function start(id) {
|
|
4075
4137
|
const name = setStatus(id, "in-progress");
|
|
4076
4138
|
if (name) {
|
|
4077
|
-
console.log(
|
|
4139
|
+
console.log(chalk54.green(`Started item #${id}: ${name}`));
|
|
4078
4140
|
}
|
|
4079
4141
|
}
|
|
4080
4142
|
|
|
4081
4143
|
// src/commands/backlog/wontdo/index.ts
|
|
4082
|
-
import
|
|
4144
|
+
import chalk55 from "chalk";
|
|
4083
4145
|
async function wontdo(id, reason) {
|
|
4084
4146
|
const result = loadAndFindItem(id);
|
|
4085
4147
|
if (!result) return;
|
|
@@ -4089,7 +4151,7 @@ async function wontdo(id, reason) {
|
|
|
4089
4151
|
addPhaseSummary(result.item, reason, phase);
|
|
4090
4152
|
}
|
|
4091
4153
|
saveBacklog(result.items);
|
|
4092
|
-
console.log(
|
|
4154
|
+
console.log(chalk55.red(`Won't do item #${id}: ${result.item.name}`));
|
|
4093
4155
|
}
|
|
4094
4156
|
|
|
4095
4157
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -4134,6 +4196,7 @@ function registerBacklog(program2) {
|
|
|
4134
4196
|
registerPlanCommands(cmd);
|
|
4135
4197
|
registerNextCommand(cmd);
|
|
4136
4198
|
registerRunCommand(cmd);
|
|
4199
|
+
registerSearchCommand(cmd);
|
|
4137
4200
|
}
|
|
4138
4201
|
|
|
4139
4202
|
// src/shared/isApprovedRead.ts
|
|
@@ -4541,48 +4604,48 @@ ${reasons.join("\n")}`);
|
|
|
4541
4604
|
}
|
|
4542
4605
|
|
|
4543
4606
|
// src/commands/deny/denyAdd.ts
|
|
4544
|
-
import
|
|
4607
|
+
import chalk56 from "chalk";
|
|
4545
4608
|
function denyAdd(pattern2, message) {
|
|
4546
4609
|
const config = loadProjectConfig();
|
|
4547
4610
|
const deny = config.deny ?? [];
|
|
4548
4611
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
4549
|
-
console.log(
|
|
4612
|
+
console.log(chalk56.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
4550
4613
|
return;
|
|
4551
4614
|
}
|
|
4552
4615
|
deny.push({ pattern: pattern2, message });
|
|
4553
4616
|
config.deny = deny;
|
|
4554
4617
|
saveConfig(config);
|
|
4555
|
-
console.log(
|
|
4618
|
+
console.log(chalk56.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
4556
4619
|
}
|
|
4557
4620
|
|
|
4558
4621
|
// src/commands/deny/denyList.ts
|
|
4559
|
-
import
|
|
4622
|
+
import chalk57 from "chalk";
|
|
4560
4623
|
function denyList() {
|
|
4561
4624
|
const config = loadConfig();
|
|
4562
4625
|
const deny = config.deny;
|
|
4563
4626
|
if (!deny || deny.length === 0) {
|
|
4564
|
-
console.log(
|
|
4627
|
+
console.log(chalk57.dim("No deny rules configured."));
|
|
4565
4628
|
return;
|
|
4566
4629
|
}
|
|
4567
4630
|
for (const rule of deny) {
|
|
4568
|
-
console.log(`${
|
|
4631
|
+
console.log(`${chalk57.red(rule.pattern)} \u2192 ${rule.message}`);
|
|
4569
4632
|
}
|
|
4570
4633
|
}
|
|
4571
4634
|
|
|
4572
4635
|
// src/commands/deny/denyRemove.ts
|
|
4573
|
-
import
|
|
4636
|
+
import chalk58 from "chalk";
|
|
4574
4637
|
function denyRemove(pattern2) {
|
|
4575
4638
|
const config = loadProjectConfig();
|
|
4576
4639
|
const deny = config.deny ?? [];
|
|
4577
4640
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
4578
4641
|
if (index === -1) {
|
|
4579
|
-
console.log(
|
|
4642
|
+
console.log(chalk58.yellow(`No deny rule found for: ${pattern2}`));
|
|
4580
4643
|
return;
|
|
4581
4644
|
}
|
|
4582
4645
|
deny.splice(index, 1);
|
|
4583
4646
|
config.deny = deny.length > 0 ? deny : void 0;
|
|
4584
4647
|
saveConfig(config);
|
|
4585
|
-
console.log(
|
|
4648
|
+
console.log(chalk58.green(`Removed deny rule: ${pattern2}`));
|
|
4586
4649
|
}
|
|
4587
4650
|
|
|
4588
4651
|
// src/commands/permitCliReads/index.ts
|
|
@@ -4632,11 +4695,11 @@ function assertCliExists(cli) {
|
|
|
4632
4695
|
}
|
|
4633
4696
|
|
|
4634
4697
|
// src/commands/permitCliReads/colorize.ts
|
|
4635
|
-
import
|
|
4698
|
+
import chalk59 from "chalk";
|
|
4636
4699
|
function colorize(plainOutput) {
|
|
4637
4700
|
return plainOutput.split("\n").map((line) => {
|
|
4638
|
-
if (line.startsWith(" R ")) return
|
|
4639
|
-
if (line.startsWith(" W ")) return
|
|
4701
|
+
if (line.startsWith(" R ")) return chalk59.green(line);
|
|
4702
|
+
if (line.startsWith(" W ")) return chalk59.red(line);
|
|
4640
4703
|
return line;
|
|
4641
4704
|
}).join("\n");
|
|
4642
4705
|
}
|
|
@@ -4954,15 +5017,15 @@ function registerCliHook(program2) {
|
|
|
4954
5017
|
}
|
|
4955
5018
|
|
|
4956
5019
|
// src/commands/complexity/analyze.ts
|
|
4957
|
-
import
|
|
5020
|
+
import chalk65 from "chalk";
|
|
4958
5021
|
|
|
4959
5022
|
// src/commands/complexity/cyclomatic.ts
|
|
4960
|
-
import
|
|
5023
|
+
import chalk61 from "chalk";
|
|
4961
5024
|
|
|
4962
5025
|
// src/commands/complexity/shared/index.ts
|
|
4963
5026
|
import fs12 from "fs";
|
|
4964
5027
|
import path20 from "path";
|
|
4965
|
-
import
|
|
5028
|
+
import chalk60 from "chalk";
|
|
4966
5029
|
import ts5 from "typescript";
|
|
4967
5030
|
|
|
4968
5031
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -5208,7 +5271,7 @@ function createSourceFromFile(filePath) {
|
|
|
5208
5271
|
function withSourceFiles(pattern2, callback) {
|
|
5209
5272
|
const files = findSourceFiles2(pattern2);
|
|
5210
5273
|
if (files.length === 0) {
|
|
5211
|
-
console.log(
|
|
5274
|
+
console.log(chalk60.yellow("No files found matching pattern"));
|
|
5212
5275
|
return void 0;
|
|
5213
5276
|
}
|
|
5214
5277
|
return callback(files);
|
|
@@ -5241,11 +5304,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5241
5304
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
5242
5305
|
for (const { file, name, complexity } of results) {
|
|
5243
5306
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
5244
|
-
const color = exceedsThreshold ?
|
|
5245
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
5307
|
+
const color = exceedsThreshold ? chalk61.red : chalk61.white;
|
|
5308
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk61.cyan(complexity)}`);
|
|
5246
5309
|
}
|
|
5247
5310
|
console.log(
|
|
5248
|
-
|
|
5311
|
+
chalk61.dim(
|
|
5249
5312
|
`
|
|
5250
5313
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5251
5314
|
)
|
|
@@ -5257,7 +5320,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5257
5320
|
}
|
|
5258
5321
|
|
|
5259
5322
|
// src/commands/complexity/halstead.ts
|
|
5260
|
-
import
|
|
5323
|
+
import chalk62 from "chalk";
|
|
5261
5324
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
5262
5325
|
withSourceFiles(pattern2, (files) => {
|
|
5263
5326
|
const results = [];
|
|
@@ -5272,13 +5335,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5272
5335
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
5273
5336
|
for (const { file, name, metrics } of results) {
|
|
5274
5337
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
5275
|
-
const color = exceedsThreshold ?
|
|
5338
|
+
const color = exceedsThreshold ? chalk62.red : chalk62.white;
|
|
5276
5339
|
console.log(
|
|
5277
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
5340
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk62.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk62.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk62.magenta(metrics.effort.toFixed(1))}`
|
|
5278
5341
|
);
|
|
5279
5342
|
}
|
|
5280
5343
|
console.log(
|
|
5281
|
-
|
|
5344
|
+
chalk62.dim(
|
|
5282
5345
|
`
|
|
5283
5346
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
5284
5347
|
)
|
|
@@ -5293,28 +5356,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
5293
5356
|
import fs13 from "fs";
|
|
5294
5357
|
|
|
5295
5358
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
5296
|
-
import
|
|
5359
|
+
import chalk63 from "chalk";
|
|
5297
5360
|
function displayMaintainabilityResults(results, threshold) {
|
|
5298
5361
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
5299
5362
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
5300
|
-
console.log(
|
|
5363
|
+
console.log(chalk63.green("All files pass maintainability threshold"));
|
|
5301
5364
|
} else {
|
|
5302
5365
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
5303
|
-
const color = threshold !== void 0 ?
|
|
5366
|
+
const color = threshold !== void 0 ? chalk63.red : chalk63.white;
|
|
5304
5367
|
console.log(
|
|
5305
|
-
`${color(file)} \u2192 avg: ${
|
|
5368
|
+
`${color(file)} \u2192 avg: ${chalk63.cyan(avgMaintainability.toFixed(1))}, min: ${chalk63.yellow(minMaintainability.toFixed(1))}`
|
|
5306
5369
|
);
|
|
5307
5370
|
}
|
|
5308
5371
|
}
|
|
5309
|
-
console.log(
|
|
5372
|
+
console.log(chalk63.dim(`
|
|
5310
5373
|
Analyzed ${results.length} files`));
|
|
5311
5374
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
5312
5375
|
console.error(
|
|
5313
|
-
|
|
5376
|
+
chalk63.red(
|
|
5314
5377
|
`
|
|
5315
5378
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
5316
5379
|
|
|
5317
|
-
\u26A0\uFE0F ${
|
|
5380
|
+
\u26A0\uFE0F ${chalk63.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.`
|
|
5318
5381
|
)
|
|
5319
5382
|
);
|
|
5320
5383
|
process.exit(1);
|
|
@@ -5371,7 +5434,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5371
5434
|
|
|
5372
5435
|
// src/commands/complexity/sloc.ts
|
|
5373
5436
|
import fs14 from "fs";
|
|
5374
|
-
import
|
|
5437
|
+
import chalk64 from "chalk";
|
|
5375
5438
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
5376
5439
|
withSourceFiles(pattern2, (files) => {
|
|
5377
5440
|
const results = [];
|
|
@@ -5387,12 +5450,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
5387
5450
|
results.sort((a, b) => b.lines - a.lines);
|
|
5388
5451
|
for (const { file, lines } of results) {
|
|
5389
5452
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
5390
|
-
const color = exceedsThreshold ?
|
|
5391
|
-
console.log(`${color(file)} \u2192 ${
|
|
5453
|
+
const color = exceedsThreshold ? chalk64.red : chalk64.white;
|
|
5454
|
+
console.log(`${color(file)} \u2192 ${chalk64.cyan(lines)} lines`);
|
|
5392
5455
|
}
|
|
5393
5456
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
5394
5457
|
console.log(
|
|
5395
|
-
|
|
5458
|
+
chalk64.dim(`
|
|
5396
5459
|
Total: ${total} lines across ${files.length} files`)
|
|
5397
5460
|
);
|
|
5398
5461
|
if (hasViolation) {
|
|
@@ -5406,21 +5469,21 @@ async function analyze(pattern2) {
|
|
|
5406
5469
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
5407
5470
|
const files = findSourceFiles2(searchPattern);
|
|
5408
5471
|
if (files.length === 0) {
|
|
5409
|
-
console.log(
|
|
5472
|
+
console.log(chalk65.yellow("No files found matching pattern"));
|
|
5410
5473
|
return;
|
|
5411
5474
|
}
|
|
5412
5475
|
if (files.length === 1) {
|
|
5413
5476
|
const file = files[0];
|
|
5414
|
-
console.log(
|
|
5477
|
+
console.log(chalk65.bold.underline("SLOC"));
|
|
5415
5478
|
await sloc(file);
|
|
5416
5479
|
console.log();
|
|
5417
|
-
console.log(
|
|
5480
|
+
console.log(chalk65.bold.underline("Cyclomatic Complexity"));
|
|
5418
5481
|
await cyclomatic(file);
|
|
5419
5482
|
console.log();
|
|
5420
|
-
console.log(
|
|
5483
|
+
console.log(chalk65.bold.underline("Halstead Metrics"));
|
|
5421
5484
|
await halstead(file);
|
|
5422
5485
|
console.log();
|
|
5423
|
-
console.log(
|
|
5486
|
+
console.log(chalk65.bold.underline("Maintainability Index"));
|
|
5424
5487
|
await maintainability(file);
|
|
5425
5488
|
return;
|
|
5426
5489
|
}
|
|
@@ -5448,7 +5511,7 @@ function registerComplexity(program2) {
|
|
|
5448
5511
|
|
|
5449
5512
|
// src/commands/deploy/redirect.ts
|
|
5450
5513
|
import { existsSync as existsSync21, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
5451
|
-
import
|
|
5514
|
+
import chalk66 from "chalk";
|
|
5452
5515
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
5453
5516
|
if (!window.location.pathname.endsWith('/')) {
|
|
5454
5517
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -5457,22 +5520,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
5457
5520
|
function redirect() {
|
|
5458
5521
|
const indexPath = "index.html";
|
|
5459
5522
|
if (!existsSync21(indexPath)) {
|
|
5460
|
-
console.log(
|
|
5523
|
+
console.log(chalk66.yellow("No index.html found"));
|
|
5461
5524
|
return;
|
|
5462
5525
|
}
|
|
5463
5526
|
const content = readFileSync19(indexPath, "utf-8");
|
|
5464
5527
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
5465
|
-
console.log(
|
|
5528
|
+
console.log(chalk66.dim("Trailing slash script already present"));
|
|
5466
5529
|
return;
|
|
5467
5530
|
}
|
|
5468
5531
|
const headCloseIndex = content.indexOf("</head>");
|
|
5469
5532
|
if (headCloseIndex === -1) {
|
|
5470
|
-
console.log(
|
|
5533
|
+
console.log(chalk66.red("Could not find </head> tag in index.html"));
|
|
5471
5534
|
return;
|
|
5472
5535
|
}
|
|
5473
5536
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
5474
5537
|
writeFileSync17(indexPath, newContent);
|
|
5475
|
-
console.log(
|
|
5538
|
+
console.log(chalk66.green("Added trailing slash redirect to index.html"));
|
|
5476
5539
|
}
|
|
5477
5540
|
|
|
5478
5541
|
// src/commands/registerDeploy.ts
|
|
@@ -5499,7 +5562,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
5499
5562
|
|
|
5500
5563
|
// src/commands/devlog/shared.ts
|
|
5501
5564
|
import { execSync as execSync17 } from "child_process";
|
|
5502
|
-
import
|
|
5565
|
+
import chalk67 from "chalk";
|
|
5503
5566
|
|
|
5504
5567
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
5505
5568
|
import { readdirSync, readFileSync as readFileSync20 } from "fs";
|
|
@@ -5586,13 +5649,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
5586
5649
|
}
|
|
5587
5650
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
5588
5651
|
for (const commit2 of commits) {
|
|
5589
|
-
console.log(` ${
|
|
5652
|
+
console.log(` ${chalk67.yellow(commit2.hash)} ${commit2.message}`);
|
|
5590
5653
|
if (verbose) {
|
|
5591
5654
|
const visibleFiles = commit2.files.filter(
|
|
5592
5655
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
5593
5656
|
);
|
|
5594
5657
|
for (const file of visibleFiles) {
|
|
5595
|
-
console.log(` ${
|
|
5658
|
+
console.log(` ${chalk67.dim(file)}`);
|
|
5596
5659
|
}
|
|
5597
5660
|
}
|
|
5598
5661
|
}
|
|
@@ -5617,15 +5680,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
5617
5680
|
}
|
|
5618
5681
|
|
|
5619
5682
|
// src/commands/devlog/list/printDateHeader.ts
|
|
5620
|
-
import
|
|
5683
|
+
import chalk68 from "chalk";
|
|
5621
5684
|
function printDateHeader(date, isSkipped, entries) {
|
|
5622
5685
|
if (isSkipped) {
|
|
5623
|
-
console.log(`${
|
|
5686
|
+
console.log(`${chalk68.bold.blue(date)} ${chalk68.dim("skipped")}`);
|
|
5624
5687
|
} else if (entries && entries.length > 0) {
|
|
5625
|
-
const entryInfo = entries.map((e) => `${
|
|
5626
|
-
console.log(`${
|
|
5688
|
+
const entryInfo = entries.map((e) => `${chalk68.green(e.version)} ${e.title}`).join(" | ");
|
|
5689
|
+
console.log(`${chalk68.bold.blue(date)} ${entryInfo}`);
|
|
5627
5690
|
} else {
|
|
5628
|
-
console.log(`${
|
|
5691
|
+
console.log(`${chalk68.bold.blue(date)} ${chalk68.red("\u26A0 devlog missing")}`);
|
|
5629
5692
|
}
|
|
5630
5693
|
}
|
|
5631
5694
|
|
|
@@ -5729,24 +5792,24 @@ function bumpVersion(version2, type) {
|
|
|
5729
5792
|
|
|
5730
5793
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
5731
5794
|
import { execSync as execSync20 } from "child_process";
|
|
5732
|
-
import
|
|
5795
|
+
import chalk70 from "chalk";
|
|
5733
5796
|
|
|
5734
5797
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
5735
|
-
import
|
|
5798
|
+
import chalk69 from "chalk";
|
|
5736
5799
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
5737
5800
|
if (conventional && firstHash) {
|
|
5738
5801
|
const version2 = getVersionAtCommit(firstHash);
|
|
5739
5802
|
if (version2) {
|
|
5740
|
-
console.log(`${
|
|
5803
|
+
console.log(`${chalk69.bold("version:")} ${stripToMinor(version2)}`);
|
|
5741
5804
|
} else {
|
|
5742
|
-
console.log(`${
|
|
5805
|
+
console.log(`${chalk69.bold("version:")} ${chalk69.red("unknown")}`);
|
|
5743
5806
|
}
|
|
5744
5807
|
} else if (patchVersion && minorVersion) {
|
|
5745
5808
|
console.log(
|
|
5746
|
-
`${
|
|
5809
|
+
`${chalk69.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
5747
5810
|
);
|
|
5748
5811
|
} else {
|
|
5749
|
-
console.log(`${
|
|
5812
|
+
console.log(`${chalk69.bold("version:")} v0.1 (initial)`);
|
|
5750
5813
|
}
|
|
5751
5814
|
}
|
|
5752
5815
|
|
|
@@ -5793,16 +5856,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
5793
5856
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
5794
5857
|
}
|
|
5795
5858
|
function logName(repoName) {
|
|
5796
|
-
console.log(`${
|
|
5859
|
+
console.log(`${chalk70.bold("name:")} ${repoName}`);
|
|
5797
5860
|
}
|
|
5798
5861
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
5799
5862
|
logName(ctx.repoName);
|
|
5800
5863
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
5801
|
-
console.log(
|
|
5864
|
+
console.log(chalk70.bold.blue(targetDate));
|
|
5802
5865
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
5803
5866
|
}
|
|
5804
5867
|
function logNoCommits(lastInfo) {
|
|
5805
|
-
console.log(
|
|
5868
|
+
console.log(chalk70.dim(noCommitsMessage(!!lastInfo)));
|
|
5806
5869
|
}
|
|
5807
5870
|
|
|
5808
5871
|
// src/commands/devlog/next/index.ts
|
|
@@ -5843,11 +5906,11 @@ function next2(options2) {
|
|
|
5843
5906
|
import { execSync as execSync21 } from "child_process";
|
|
5844
5907
|
|
|
5845
5908
|
// src/commands/devlog/repos/printReposTable.ts
|
|
5846
|
-
import
|
|
5909
|
+
import chalk71 from "chalk";
|
|
5847
5910
|
function colorStatus(status2) {
|
|
5848
|
-
if (status2 === "missing") return
|
|
5849
|
-
if (status2 === "outdated") return
|
|
5850
|
-
return
|
|
5911
|
+
if (status2 === "missing") return chalk71.red(status2);
|
|
5912
|
+
if (status2 === "outdated") return chalk71.yellow(status2);
|
|
5913
|
+
return chalk71.green(status2);
|
|
5851
5914
|
}
|
|
5852
5915
|
function formatRow(row, nameWidth) {
|
|
5853
5916
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -5861,8 +5924,8 @@ function printReposTable(rows) {
|
|
|
5861
5924
|
"Last Devlog".padEnd(11),
|
|
5862
5925
|
"Status"
|
|
5863
5926
|
].join(" ");
|
|
5864
|
-
console.log(
|
|
5865
|
-
console.log(
|
|
5927
|
+
console.log(chalk71.dim(header));
|
|
5928
|
+
console.log(chalk71.dim("-".repeat(header.length)));
|
|
5866
5929
|
for (const row of rows) {
|
|
5867
5930
|
console.log(formatRow(row, nameWidth));
|
|
5868
5931
|
}
|
|
@@ -5920,14 +5983,14 @@ function repos(options2) {
|
|
|
5920
5983
|
// src/commands/devlog/skip.ts
|
|
5921
5984
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
5922
5985
|
import { join as join20 } from "path";
|
|
5923
|
-
import
|
|
5986
|
+
import chalk72 from "chalk";
|
|
5924
5987
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
5925
5988
|
function getBlogConfigPath() {
|
|
5926
5989
|
return join20(BLOG_REPO_ROOT, "assist.yml");
|
|
5927
5990
|
}
|
|
5928
5991
|
function skip(date) {
|
|
5929
5992
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
5930
|
-
console.log(
|
|
5993
|
+
console.log(chalk72.red("Invalid date format. Use YYYY-MM-DD"));
|
|
5931
5994
|
process.exit(1);
|
|
5932
5995
|
}
|
|
5933
5996
|
const repoName = getRepoName();
|
|
@@ -5938,7 +6001,7 @@ function skip(date) {
|
|
|
5938
6001
|
const skipDays = skip2[repoName] ?? [];
|
|
5939
6002
|
if (skipDays.includes(date)) {
|
|
5940
6003
|
console.log(
|
|
5941
|
-
|
|
6004
|
+
chalk72.yellow(`${date} is already in skip list for ${repoName}`)
|
|
5942
6005
|
);
|
|
5943
6006
|
return;
|
|
5944
6007
|
}
|
|
@@ -5948,20 +6011,20 @@ function skip(date) {
|
|
|
5948
6011
|
devlog.skip = skip2;
|
|
5949
6012
|
config.devlog = devlog;
|
|
5950
6013
|
writeFileSync18(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
5951
|
-
console.log(
|
|
6014
|
+
console.log(chalk72.green(`Added ${date} to skip list for ${repoName}`));
|
|
5952
6015
|
}
|
|
5953
6016
|
|
|
5954
6017
|
// src/commands/devlog/version.ts
|
|
5955
|
-
import
|
|
6018
|
+
import chalk73 from "chalk";
|
|
5956
6019
|
function version() {
|
|
5957
6020
|
const config = loadConfig();
|
|
5958
6021
|
const name = getRepoName();
|
|
5959
6022
|
const lastInfo = getLastVersionInfo(name, config);
|
|
5960
6023
|
const lastVersion = lastInfo?.version ?? null;
|
|
5961
6024
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
5962
|
-
console.log(`${
|
|
5963
|
-
console.log(`${
|
|
5964
|
-
console.log(`${
|
|
6025
|
+
console.log(`${chalk73.bold("name:")} ${name}`);
|
|
6026
|
+
console.log(`${chalk73.bold("last:")} ${lastVersion ?? chalk73.dim("none")}`);
|
|
6027
|
+
console.log(`${chalk73.bold("next:")} ${nextVersion ?? chalk73.dim("none")}`);
|
|
5965
6028
|
}
|
|
5966
6029
|
|
|
5967
6030
|
// src/commands/registerDevlog.ts
|
|
@@ -5985,7 +6048,7 @@ function registerDevlog(program2) {
|
|
|
5985
6048
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
5986
6049
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
5987
6050
|
import { join as join21 } from "path";
|
|
5988
|
-
import
|
|
6051
|
+
import chalk74 from "chalk";
|
|
5989
6052
|
|
|
5990
6053
|
// src/shared/findRepoRoot.ts
|
|
5991
6054
|
import { existsSync as existsSync22 } from "fs";
|
|
@@ -6048,14 +6111,14 @@ function checkBuildLocks(startDir) {
|
|
|
6048
6111
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
6049
6112
|
if (locked) {
|
|
6050
6113
|
console.error(
|
|
6051
|
-
|
|
6114
|
+
chalk74.red("Build output locked (is VS debugging?): ") + locked
|
|
6052
6115
|
);
|
|
6053
6116
|
process.exit(1);
|
|
6054
6117
|
}
|
|
6055
6118
|
}
|
|
6056
6119
|
async function checkBuildLocksCommand() {
|
|
6057
6120
|
checkBuildLocks();
|
|
6058
|
-
console.log(
|
|
6121
|
+
console.log(chalk74.green("No build locks detected"));
|
|
6059
6122
|
}
|
|
6060
6123
|
|
|
6061
6124
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -6154,30 +6217,30 @@ function escapeRegex(s) {
|
|
|
6154
6217
|
}
|
|
6155
6218
|
|
|
6156
6219
|
// src/commands/dotnet/printTree.ts
|
|
6157
|
-
import
|
|
6220
|
+
import chalk75 from "chalk";
|
|
6158
6221
|
function printNodes(nodes, prefix2) {
|
|
6159
6222
|
for (let i = 0; i < nodes.length; i++) {
|
|
6160
6223
|
const isLast = i === nodes.length - 1;
|
|
6161
6224
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
6162
6225
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
6163
6226
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
6164
|
-
const label2 = isMissing ?
|
|
6227
|
+
const label2 = isMissing ? chalk75.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
6165
6228
|
console.log(`${prefix2}${connector}${label2}`);
|
|
6166
6229
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
6167
6230
|
}
|
|
6168
6231
|
}
|
|
6169
6232
|
function printTree(tree, totalCount, solutions) {
|
|
6170
|
-
console.log(
|
|
6171
|
-
console.log(
|
|
6233
|
+
console.log(chalk75.bold("\nProject Dependency Tree"));
|
|
6234
|
+
console.log(chalk75.cyan(tree.relativePath));
|
|
6172
6235
|
printNodes(tree.children, "");
|
|
6173
|
-
console.log(
|
|
6236
|
+
console.log(chalk75.dim(`
|
|
6174
6237
|
${totalCount} projects total (including root)`));
|
|
6175
|
-
console.log(
|
|
6238
|
+
console.log(chalk75.bold("\nSolution Membership"));
|
|
6176
6239
|
if (solutions.length === 0) {
|
|
6177
|
-
console.log(
|
|
6240
|
+
console.log(chalk75.yellow(" Not found in any .sln"));
|
|
6178
6241
|
} else {
|
|
6179
6242
|
for (const sln of solutions) {
|
|
6180
|
-
console.log(` ${
|
|
6243
|
+
console.log(` ${chalk75.green(sln)}`);
|
|
6181
6244
|
}
|
|
6182
6245
|
}
|
|
6183
6246
|
console.log();
|
|
@@ -6206,16 +6269,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
6206
6269
|
// src/commands/dotnet/resolveCsproj.ts
|
|
6207
6270
|
import { existsSync as existsSync23 } from "fs";
|
|
6208
6271
|
import path24 from "path";
|
|
6209
|
-
import
|
|
6272
|
+
import chalk76 from "chalk";
|
|
6210
6273
|
function resolveCsproj(csprojPath) {
|
|
6211
6274
|
const resolved = path24.resolve(csprojPath);
|
|
6212
6275
|
if (!existsSync23(resolved)) {
|
|
6213
|
-
console.error(
|
|
6276
|
+
console.error(chalk76.red(`File not found: ${resolved}`));
|
|
6214
6277
|
process.exit(1);
|
|
6215
6278
|
}
|
|
6216
6279
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
6217
6280
|
if (!repoRoot) {
|
|
6218
|
-
console.error(
|
|
6281
|
+
console.error(chalk76.red("Could not find git repository root"));
|
|
6219
6282
|
process.exit(1);
|
|
6220
6283
|
}
|
|
6221
6284
|
return { resolved, repoRoot };
|
|
@@ -6265,12 +6328,12 @@ function getChangedCsFiles(scope) {
|
|
|
6265
6328
|
}
|
|
6266
6329
|
|
|
6267
6330
|
// src/commands/dotnet/inSln.ts
|
|
6268
|
-
import
|
|
6331
|
+
import chalk77 from "chalk";
|
|
6269
6332
|
async function inSln(csprojPath) {
|
|
6270
6333
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
6271
6334
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
6272
6335
|
if (solutions.length === 0) {
|
|
6273
|
-
console.log(
|
|
6336
|
+
console.log(chalk77.yellow("Not found in any .sln file"));
|
|
6274
6337
|
process.exit(1);
|
|
6275
6338
|
}
|
|
6276
6339
|
for (const sln of solutions) {
|
|
@@ -6279,7 +6342,7 @@ async function inSln(csprojPath) {
|
|
|
6279
6342
|
}
|
|
6280
6343
|
|
|
6281
6344
|
// src/commands/dotnet/inspect.ts
|
|
6282
|
-
import
|
|
6345
|
+
import chalk83 from "chalk";
|
|
6283
6346
|
|
|
6284
6347
|
// src/shared/formatElapsed.ts
|
|
6285
6348
|
function formatElapsed(ms) {
|
|
@@ -6291,12 +6354,12 @@ function formatElapsed(ms) {
|
|
|
6291
6354
|
}
|
|
6292
6355
|
|
|
6293
6356
|
// src/commands/dotnet/displayIssues.ts
|
|
6294
|
-
import
|
|
6357
|
+
import chalk78 from "chalk";
|
|
6295
6358
|
var SEVERITY_COLOR = {
|
|
6296
|
-
ERROR:
|
|
6297
|
-
WARNING:
|
|
6298
|
-
SUGGESTION:
|
|
6299
|
-
HINT:
|
|
6359
|
+
ERROR: chalk78.red,
|
|
6360
|
+
WARNING: chalk78.yellow,
|
|
6361
|
+
SUGGESTION: chalk78.cyan,
|
|
6362
|
+
HINT: chalk78.dim
|
|
6300
6363
|
};
|
|
6301
6364
|
function groupByFile(issues) {
|
|
6302
6365
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -6312,15 +6375,15 @@ function groupByFile(issues) {
|
|
|
6312
6375
|
}
|
|
6313
6376
|
function displayIssues(issues) {
|
|
6314
6377
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
6315
|
-
console.log(
|
|
6378
|
+
console.log(chalk78.bold(file));
|
|
6316
6379
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
6317
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
6380
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk78.white;
|
|
6318
6381
|
console.log(
|
|
6319
|
-
` ${
|
|
6382
|
+
` ${chalk78.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
6320
6383
|
);
|
|
6321
6384
|
}
|
|
6322
6385
|
}
|
|
6323
|
-
console.log(
|
|
6386
|
+
console.log(chalk78.dim(`
|
|
6324
6387
|
${issues.length} issue(s) found`));
|
|
6325
6388
|
}
|
|
6326
6389
|
|
|
@@ -6379,12 +6442,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
6379
6442
|
// src/commands/dotnet/resolveSolution.ts
|
|
6380
6443
|
import { existsSync as existsSync24 } from "fs";
|
|
6381
6444
|
import path25 from "path";
|
|
6382
|
-
import
|
|
6445
|
+
import chalk80 from "chalk";
|
|
6383
6446
|
|
|
6384
6447
|
// src/commands/dotnet/findSolution.ts
|
|
6385
6448
|
import { readdirSync as readdirSync4 } from "fs";
|
|
6386
6449
|
import { dirname as dirname16, join as join22 } from "path";
|
|
6387
|
-
import
|
|
6450
|
+
import chalk79 from "chalk";
|
|
6388
6451
|
function findSlnInDir(dir) {
|
|
6389
6452
|
try {
|
|
6390
6453
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join22(dir, f));
|
|
@@ -6400,17 +6463,17 @@ function findSolution() {
|
|
|
6400
6463
|
const slnFiles = findSlnInDir(current);
|
|
6401
6464
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
6402
6465
|
if (slnFiles.length > 1) {
|
|
6403
|
-
console.error(
|
|
6466
|
+
console.error(chalk79.red(`Multiple .sln files found in ${current}:`));
|
|
6404
6467
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
6405
6468
|
console.error(
|
|
6406
|
-
|
|
6469
|
+
chalk79.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
6407
6470
|
);
|
|
6408
6471
|
process.exit(1);
|
|
6409
6472
|
}
|
|
6410
6473
|
if (current === ceiling) break;
|
|
6411
6474
|
current = dirname16(current);
|
|
6412
6475
|
}
|
|
6413
|
-
console.error(
|
|
6476
|
+
console.error(chalk79.red("No .sln file found between cwd and repo root"));
|
|
6414
6477
|
process.exit(1);
|
|
6415
6478
|
}
|
|
6416
6479
|
|
|
@@ -6419,7 +6482,7 @@ function resolveSolution(sln) {
|
|
|
6419
6482
|
if (sln) {
|
|
6420
6483
|
const resolved = path25.resolve(sln);
|
|
6421
6484
|
if (!existsSync24(resolved)) {
|
|
6422
|
-
console.error(
|
|
6485
|
+
console.error(chalk80.red(`Solution file not found: ${resolved}`));
|
|
6423
6486
|
process.exit(1);
|
|
6424
6487
|
}
|
|
6425
6488
|
return resolved;
|
|
@@ -6461,14 +6524,14 @@ import { execSync as execSync23 } from "child_process";
|
|
|
6461
6524
|
import { existsSync as existsSync25, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
|
|
6462
6525
|
import { tmpdir as tmpdir2 } from "os";
|
|
6463
6526
|
import path26 from "path";
|
|
6464
|
-
import
|
|
6527
|
+
import chalk81 from "chalk";
|
|
6465
6528
|
function assertJbInstalled() {
|
|
6466
6529
|
try {
|
|
6467
6530
|
execSync23("jb inspectcode --version", { stdio: "pipe" });
|
|
6468
6531
|
} catch {
|
|
6469
|
-
console.error(
|
|
6532
|
+
console.error(chalk81.red("jb is not installed. Install with:"));
|
|
6470
6533
|
console.error(
|
|
6471
|
-
|
|
6534
|
+
chalk81.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
6472
6535
|
);
|
|
6473
6536
|
process.exit(1);
|
|
6474
6537
|
}
|
|
@@ -6486,11 +6549,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6486
6549
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
6487
6550
|
process.stderr.write(err.stderr);
|
|
6488
6551
|
}
|
|
6489
|
-
console.error(
|
|
6552
|
+
console.error(chalk81.red("jb inspectcode failed"));
|
|
6490
6553
|
process.exit(1);
|
|
6491
6554
|
}
|
|
6492
6555
|
if (!existsSync25(reportPath)) {
|
|
6493
|
-
console.error(
|
|
6556
|
+
console.error(chalk81.red("Report file not generated"));
|
|
6494
6557
|
process.exit(1);
|
|
6495
6558
|
}
|
|
6496
6559
|
const xml = readFileSync23(reportPath, "utf-8");
|
|
@@ -6500,7 +6563,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
6500
6563
|
|
|
6501
6564
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
6502
6565
|
import { execSync as execSync24 } from "child_process";
|
|
6503
|
-
import
|
|
6566
|
+
import chalk82 from "chalk";
|
|
6504
6567
|
function resolveMsbuildPath() {
|
|
6505
6568
|
const config = loadConfig();
|
|
6506
6569
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -6511,9 +6574,9 @@ function assertMsbuildInstalled() {
|
|
|
6511
6574
|
try {
|
|
6512
6575
|
execSync24(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
6513
6576
|
} catch {
|
|
6514
|
-
console.error(
|
|
6577
|
+
console.error(chalk82.red(`msbuild not found at: ${msbuild}`));
|
|
6515
6578
|
console.error(
|
|
6516
|
-
|
|
6579
|
+
chalk82.yellow(
|
|
6517
6580
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
6518
6581
|
)
|
|
6519
6582
|
);
|
|
@@ -6560,17 +6623,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
6560
6623
|
// src/commands/dotnet/inspect.ts
|
|
6561
6624
|
function logScope(changedFiles) {
|
|
6562
6625
|
if (changedFiles === null) {
|
|
6563
|
-
console.log(
|
|
6626
|
+
console.log(chalk83.dim("Inspecting full solution..."));
|
|
6564
6627
|
} else {
|
|
6565
6628
|
console.log(
|
|
6566
|
-
|
|
6629
|
+
chalk83.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
6567
6630
|
);
|
|
6568
6631
|
}
|
|
6569
6632
|
}
|
|
6570
6633
|
function reportResults(issues, elapsed) {
|
|
6571
6634
|
if (issues.length > 0) displayIssues(issues);
|
|
6572
|
-
else console.log(
|
|
6573
|
-
console.log(
|
|
6635
|
+
else console.log(chalk83.green("No issues found"));
|
|
6636
|
+
console.log(chalk83.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
6574
6637
|
if (issues.length > 0) process.exit(1);
|
|
6575
6638
|
}
|
|
6576
6639
|
async function inspect(sln, options2) {
|
|
@@ -6581,7 +6644,7 @@ async function inspect(sln, options2) {
|
|
|
6581
6644
|
const scope = parseScope(options2.scope);
|
|
6582
6645
|
const changedFiles = getChangedCsFiles(scope);
|
|
6583
6646
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
6584
|
-
console.log(
|
|
6647
|
+
console.log(chalk83.green("No changed .cs files found"));
|
|
6585
6648
|
return;
|
|
6586
6649
|
}
|
|
6587
6650
|
logScope(changedFiles);
|
|
@@ -6607,7 +6670,7 @@ function registerDotnet(program2) {
|
|
|
6607
6670
|
}
|
|
6608
6671
|
|
|
6609
6672
|
// src/commands/jira/acceptanceCriteria.ts
|
|
6610
|
-
import
|
|
6673
|
+
import chalk85 from "chalk";
|
|
6611
6674
|
|
|
6612
6675
|
// src/commands/jira/adfToText.ts
|
|
6613
6676
|
function renderInline(node) {
|
|
@@ -6668,7 +6731,7 @@ function adfToText(doc) {
|
|
|
6668
6731
|
|
|
6669
6732
|
// src/commands/jira/fetchIssue.ts
|
|
6670
6733
|
import { execSync as execSync25 } from "child_process";
|
|
6671
|
-
import
|
|
6734
|
+
import chalk84 from "chalk";
|
|
6672
6735
|
function fetchIssue(issueKey, fields) {
|
|
6673
6736
|
let result;
|
|
6674
6737
|
try {
|
|
@@ -6681,15 +6744,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
6681
6744
|
const stderr = error.stderr;
|
|
6682
6745
|
if (stderr.includes("unauthorized")) {
|
|
6683
6746
|
console.error(
|
|
6684
|
-
|
|
6747
|
+
chalk84.red("Jira authentication expired."),
|
|
6685
6748
|
"Run",
|
|
6686
|
-
|
|
6749
|
+
chalk84.cyan("assist jira auth"),
|
|
6687
6750
|
"to re-authenticate."
|
|
6688
6751
|
);
|
|
6689
6752
|
process.exit(1);
|
|
6690
6753
|
}
|
|
6691
6754
|
}
|
|
6692
|
-
console.error(
|
|
6755
|
+
console.error(chalk84.red(`Failed to fetch ${issueKey}.`));
|
|
6693
6756
|
process.exit(1);
|
|
6694
6757
|
}
|
|
6695
6758
|
return JSON.parse(result);
|
|
@@ -6703,7 +6766,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
6703
6766
|
const parsed = fetchIssue(issueKey, field);
|
|
6704
6767
|
const acValue = parsed?.fields?.[field];
|
|
6705
6768
|
if (!acValue) {
|
|
6706
|
-
console.log(
|
|
6769
|
+
console.log(chalk85.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
6707
6770
|
return;
|
|
6708
6771
|
}
|
|
6709
6772
|
if (typeof acValue === "string") {
|
|
@@ -6798,14 +6861,14 @@ async function jiraAuth() {
|
|
|
6798
6861
|
}
|
|
6799
6862
|
|
|
6800
6863
|
// src/commands/jira/viewIssue.ts
|
|
6801
|
-
import
|
|
6864
|
+
import chalk86 from "chalk";
|
|
6802
6865
|
function viewIssue(issueKey) {
|
|
6803
6866
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
6804
6867
|
const fields = parsed?.fields;
|
|
6805
6868
|
const summary = fields?.summary;
|
|
6806
6869
|
const description = fields?.description;
|
|
6807
6870
|
if (summary) {
|
|
6808
|
-
console.log(
|
|
6871
|
+
console.log(chalk86.bold(summary));
|
|
6809
6872
|
}
|
|
6810
6873
|
if (description) {
|
|
6811
6874
|
if (summary) console.log();
|
|
@@ -6819,7 +6882,7 @@ function viewIssue(issueKey) {
|
|
|
6819
6882
|
}
|
|
6820
6883
|
if (!summary && !description) {
|
|
6821
6884
|
console.log(
|
|
6822
|
-
|
|
6885
|
+
chalk86.yellow(`No summary or description found on ${issueKey}.`)
|
|
6823
6886
|
);
|
|
6824
6887
|
}
|
|
6825
6888
|
}
|
|
@@ -6833,7 +6896,7 @@ function registerJira(program2) {
|
|
|
6833
6896
|
}
|
|
6834
6897
|
|
|
6835
6898
|
// src/commands/news/add/index.ts
|
|
6836
|
-
import
|
|
6899
|
+
import chalk87 from "chalk";
|
|
6837
6900
|
import enquirer7 from "enquirer";
|
|
6838
6901
|
async function add2(url) {
|
|
6839
6902
|
if (!url) {
|
|
@@ -6856,17 +6919,17 @@ async function add2(url) {
|
|
|
6856
6919
|
const news = config.news ?? {};
|
|
6857
6920
|
const feeds = news.feeds ?? [];
|
|
6858
6921
|
if (feeds.includes(url)) {
|
|
6859
|
-
console.log(
|
|
6922
|
+
console.log(chalk87.yellow("Feed already exists in config"));
|
|
6860
6923
|
return;
|
|
6861
6924
|
}
|
|
6862
6925
|
feeds.push(url);
|
|
6863
6926
|
config.news = { ...news, feeds };
|
|
6864
6927
|
saveGlobalConfig(config);
|
|
6865
|
-
console.log(
|
|
6928
|
+
console.log(chalk87.green(`Added feed: ${url}`));
|
|
6866
6929
|
}
|
|
6867
6930
|
|
|
6868
6931
|
// src/commands/news/web/handleRequest.ts
|
|
6869
|
-
import
|
|
6932
|
+
import chalk88 from "chalk";
|
|
6870
6933
|
|
|
6871
6934
|
// src/commands/news/web/shared.ts
|
|
6872
6935
|
import { decodeHTML } from "entities";
|
|
@@ -7002,17 +7065,17 @@ function prefetch() {
|
|
|
7002
7065
|
const config = loadConfig();
|
|
7003
7066
|
const total = config.news.feeds.length;
|
|
7004
7067
|
if (total === 0) return;
|
|
7005
|
-
process.stdout.write(
|
|
7068
|
+
process.stdout.write(chalk88.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
7006
7069
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
7007
7070
|
const width = 20;
|
|
7008
7071
|
const filled = Math.round(done2 / t * width);
|
|
7009
7072
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
7010
7073
|
process.stdout.write(
|
|
7011
|
-
`\r${
|
|
7074
|
+
`\r${chalk88.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
7012
7075
|
);
|
|
7013
7076
|
}).then((items) => {
|
|
7014
7077
|
process.stdout.write(
|
|
7015
|
-
`\r${
|
|
7078
|
+
`\r${chalk88.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
7016
7079
|
`
|
|
7017
7080
|
);
|
|
7018
7081
|
cachedItems = items;
|
|
@@ -7373,20 +7436,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
7373
7436
|
}
|
|
7374
7437
|
|
|
7375
7438
|
// src/commands/prs/listComments/printComments.ts
|
|
7376
|
-
import
|
|
7439
|
+
import chalk89 from "chalk";
|
|
7377
7440
|
function formatForHuman(comment3) {
|
|
7378
7441
|
if (comment3.type === "review") {
|
|
7379
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
7442
|
+
const stateColor = comment3.state === "APPROVED" ? chalk89.green : comment3.state === "CHANGES_REQUESTED" ? chalk89.red : chalk89.yellow;
|
|
7380
7443
|
return [
|
|
7381
|
-
`${
|
|
7444
|
+
`${chalk89.cyan("Review")} by ${chalk89.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
7382
7445
|
comment3.body,
|
|
7383
7446
|
""
|
|
7384
7447
|
].join("\n");
|
|
7385
7448
|
}
|
|
7386
7449
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
7387
7450
|
return [
|
|
7388
|
-
`${
|
|
7389
|
-
|
|
7451
|
+
`${chalk89.cyan("Line comment")} by ${chalk89.bold(comment3.user)} on ${chalk89.dim(`${comment3.path}${location}`)}`,
|
|
7452
|
+
chalk89.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
7390
7453
|
comment3.body,
|
|
7391
7454
|
""
|
|
7392
7455
|
].join("\n");
|
|
@@ -7476,13 +7539,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
7476
7539
|
import enquirer8 from "enquirer";
|
|
7477
7540
|
|
|
7478
7541
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
7479
|
-
import
|
|
7542
|
+
import chalk90 from "chalk";
|
|
7480
7543
|
var STATUS_MAP = {
|
|
7481
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
7482
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
7544
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk90.magenta("merged"), date: pr.mergedAt } : null,
|
|
7545
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk90.red("closed"), date: pr.closedAt } : null
|
|
7483
7546
|
};
|
|
7484
7547
|
function defaultStatus(pr) {
|
|
7485
|
-
return { label:
|
|
7548
|
+
return { label: chalk90.green("opened"), date: pr.createdAt };
|
|
7486
7549
|
}
|
|
7487
7550
|
function getStatus2(pr) {
|
|
7488
7551
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -7491,11 +7554,11 @@ function formatDate(dateStr) {
|
|
|
7491
7554
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
7492
7555
|
}
|
|
7493
7556
|
function formatPrHeader(pr, status2) {
|
|
7494
|
-
return `${
|
|
7557
|
+
return `${chalk90.cyan(`#${pr.number}`)} ${pr.title} ${chalk90.dim(`(${pr.author.login},`)} ${status2.label} ${chalk90.dim(`${formatDate(status2.date)})`)}`;
|
|
7495
7558
|
}
|
|
7496
7559
|
function logPrDetails(pr) {
|
|
7497
7560
|
console.log(
|
|
7498
|
-
|
|
7561
|
+
chalk90.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
7499
7562
|
);
|
|
7500
7563
|
console.log();
|
|
7501
7564
|
}
|
|
@@ -7661,10 +7724,10 @@ function registerPrs(program2) {
|
|
|
7661
7724
|
}
|
|
7662
7725
|
|
|
7663
7726
|
// src/commands/ravendb/ravendbAuth.ts
|
|
7664
|
-
import
|
|
7727
|
+
import chalk96 from "chalk";
|
|
7665
7728
|
|
|
7666
7729
|
// src/shared/createConnectionAuth.ts
|
|
7667
|
-
import
|
|
7730
|
+
import chalk91 from "chalk";
|
|
7668
7731
|
function listConnections(connections, format2) {
|
|
7669
7732
|
if (connections.length === 0) {
|
|
7670
7733
|
console.log("No connections configured.");
|
|
@@ -7677,7 +7740,7 @@ function listConnections(connections, format2) {
|
|
|
7677
7740
|
function removeConnection(connections, name, save) {
|
|
7678
7741
|
const filtered = connections.filter((c) => c.name !== name);
|
|
7679
7742
|
if (filtered.length === connections.length) {
|
|
7680
|
-
console.error(
|
|
7743
|
+
console.error(chalk91.red(`Connection "${name}" not found.`));
|
|
7681
7744
|
process.exit(1);
|
|
7682
7745
|
}
|
|
7683
7746
|
save(filtered);
|
|
@@ -7723,34 +7786,34 @@ function saveConnections(connections) {
|
|
|
7723
7786
|
}
|
|
7724
7787
|
|
|
7725
7788
|
// src/commands/ravendb/promptConnection.ts
|
|
7726
|
-
import
|
|
7789
|
+
import chalk94 from "chalk";
|
|
7727
7790
|
|
|
7728
7791
|
// src/commands/ravendb/selectOpSecret.ts
|
|
7729
|
-
import
|
|
7792
|
+
import chalk93 from "chalk";
|
|
7730
7793
|
import Enquirer2 from "enquirer";
|
|
7731
7794
|
|
|
7732
7795
|
// src/commands/ravendb/searchItems.ts
|
|
7733
7796
|
import { execSync as execSync34 } from "child_process";
|
|
7734
|
-
import
|
|
7797
|
+
import chalk92 from "chalk";
|
|
7735
7798
|
function opExec(args) {
|
|
7736
7799
|
return execSync34(`op ${args}`, {
|
|
7737
7800
|
encoding: "utf-8",
|
|
7738
7801
|
stdio: ["pipe", "pipe", "pipe"]
|
|
7739
7802
|
}).trim();
|
|
7740
7803
|
}
|
|
7741
|
-
function searchItems(
|
|
7804
|
+
function searchItems(search2) {
|
|
7742
7805
|
let items;
|
|
7743
7806
|
try {
|
|
7744
7807
|
items = JSON.parse(opExec("item list --format=json"));
|
|
7745
7808
|
} catch {
|
|
7746
7809
|
console.error(
|
|
7747
|
-
|
|
7810
|
+
chalk92.red(
|
|
7748
7811
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
7749
7812
|
)
|
|
7750
7813
|
);
|
|
7751
7814
|
process.exit(1);
|
|
7752
7815
|
}
|
|
7753
|
-
const lower =
|
|
7816
|
+
const lower = search2.toLowerCase();
|
|
7754
7817
|
return items.filter((i) => i.title.toLowerCase().includes(lower));
|
|
7755
7818
|
}
|
|
7756
7819
|
function getItemFields(itemId) {
|
|
@@ -7758,7 +7821,7 @@ function getItemFields(itemId) {
|
|
|
7758
7821
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
7759
7822
|
return item.fields.filter((f) => f.reference && f.label);
|
|
7760
7823
|
} catch {
|
|
7761
|
-
console.error(
|
|
7824
|
+
console.error(chalk92.red("Failed to get item details from 1Password."));
|
|
7762
7825
|
process.exit(1);
|
|
7763
7826
|
}
|
|
7764
7827
|
}
|
|
@@ -7771,13 +7834,13 @@ async function selectOne(message, choices) {
|
|
|
7771
7834
|
return choices.find((c) => c.name === selected)?.value ?? selected;
|
|
7772
7835
|
}
|
|
7773
7836
|
async function selectOpSecret(searchTerm) {
|
|
7774
|
-
const
|
|
7837
|
+
const search2 = searchTerm ?? await new Input({
|
|
7775
7838
|
name: "search",
|
|
7776
7839
|
message: "Search 1Password for API key item:"
|
|
7777
7840
|
}).run();
|
|
7778
|
-
const items = searchItems(
|
|
7841
|
+
const items = searchItems(search2);
|
|
7779
7842
|
if (items.length === 0) {
|
|
7780
|
-
console.error(
|
|
7843
|
+
console.error(chalk93.red(`No items found matching "${search2}".`));
|
|
7781
7844
|
process.exit(1);
|
|
7782
7845
|
}
|
|
7783
7846
|
const itemId = await selectOne(
|
|
@@ -7786,7 +7849,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7786
7849
|
);
|
|
7787
7850
|
const fields = getItemFields(itemId);
|
|
7788
7851
|
if (fields.length === 0) {
|
|
7789
|
-
console.error(
|
|
7852
|
+
console.error(chalk93.red("No fields with references found on this item."));
|
|
7790
7853
|
process.exit(1);
|
|
7791
7854
|
}
|
|
7792
7855
|
const ref = await selectOne(
|
|
@@ -7800,7 +7863,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
7800
7863
|
async function promptConnection(existingNames) {
|
|
7801
7864
|
const name = await promptInput("name", "Connection name:");
|
|
7802
7865
|
if (existingNames.includes(name)) {
|
|
7803
|
-
console.error(
|
|
7866
|
+
console.error(chalk94.red(`Connection "${name}" already exists.`));
|
|
7804
7867
|
process.exit(1);
|
|
7805
7868
|
}
|
|
7806
7869
|
const url = await promptInput(
|
|
@@ -7809,22 +7872,22 @@ async function promptConnection(existingNames) {
|
|
|
7809
7872
|
);
|
|
7810
7873
|
const database = await promptInput("database", "Database name:");
|
|
7811
7874
|
if (!name || !url || !database) {
|
|
7812
|
-
console.error(
|
|
7875
|
+
console.error(chalk94.red("All fields are required."));
|
|
7813
7876
|
process.exit(1);
|
|
7814
7877
|
}
|
|
7815
7878
|
const apiKeyRef = await selectOpSecret();
|
|
7816
|
-
console.log(
|
|
7879
|
+
console.log(chalk94.dim(`Using: ${apiKeyRef}`));
|
|
7817
7880
|
return { name, url, database, apiKeyRef };
|
|
7818
7881
|
}
|
|
7819
7882
|
|
|
7820
7883
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
7821
|
-
import
|
|
7884
|
+
import chalk95 from "chalk";
|
|
7822
7885
|
function ravendbSetConnection(name) {
|
|
7823
7886
|
const raw = loadGlobalConfigRaw();
|
|
7824
7887
|
const ravendb = raw.ravendb ?? {};
|
|
7825
7888
|
const connections = ravendb.connections ?? [];
|
|
7826
7889
|
if (!connections.some((c) => c.name === name)) {
|
|
7827
|
-
console.error(
|
|
7890
|
+
console.error(chalk95.red(`Connection "${name}" not found.`));
|
|
7828
7891
|
console.error(
|
|
7829
7892
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7830
7893
|
);
|
|
@@ -7840,16 +7903,16 @@ function ravendbSetConnection(name) {
|
|
|
7840
7903
|
var ravendbAuth = createConnectionAuth({
|
|
7841
7904
|
load: loadConnections,
|
|
7842
7905
|
save: saveConnections,
|
|
7843
|
-
format: (c) => `${
|
|
7906
|
+
format: (c) => `${chalk96.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
7844
7907
|
promptNew: promptConnection,
|
|
7845
7908
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
7846
7909
|
});
|
|
7847
7910
|
|
|
7848
7911
|
// src/commands/ravendb/ravendbCollections.ts
|
|
7849
|
-
import
|
|
7912
|
+
import chalk100 from "chalk";
|
|
7850
7913
|
|
|
7851
7914
|
// src/commands/ravendb/ravenFetch.ts
|
|
7852
|
-
import
|
|
7915
|
+
import chalk98 from "chalk";
|
|
7853
7916
|
|
|
7854
7917
|
// src/commands/ravendb/getAccessToken.ts
|
|
7855
7918
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -7886,10 +7949,10 @@ ${errorText}`
|
|
|
7886
7949
|
|
|
7887
7950
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
7888
7951
|
import { execSync as execSync35 } from "child_process";
|
|
7889
|
-
import
|
|
7952
|
+
import chalk97 from "chalk";
|
|
7890
7953
|
function resolveOpSecret(reference) {
|
|
7891
7954
|
if (!reference.startsWith("op://")) {
|
|
7892
|
-
console.error(
|
|
7955
|
+
console.error(chalk97.red(`Invalid secret reference: must start with op://`));
|
|
7893
7956
|
process.exit(1);
|
|
7894
7957
|
}
|
|
7895
7958
|
try {
|
|
@@ -7899,7 +7962,7 @@ function resolveOpSecret(reference) {
|
|
|
7899
7962
|
}).trim();
|
|
7900
7963
|
} catch {
|
|
7901
7964
|
console.error(
|
|
7902
|
-
|
|
7965
|
+
chalk97.red(
|
|
7903
7966
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
7904
7967
|
)
|
|
7905
7968
|
);
|
|
@@ -7926,7 +7989,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7926
7989
|
if (!response.ok) {
|
|
7927
7990
|
const body = await response.text();
|
|
7928
7991
|
console.error(
|
|
7929
|
-
|
|
7992
|
+
chalk98.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
7930
7993
|
);
|
|
7931
7994
|
console.error(body.substring(0, 500));
|
|
7932
7995
|
process.exit(1);
|
|
@@ -7935,7 +7998,7 @@ async function ravenFetch(connection, path50) {
|
|
|
7935
7998
|
}
|
|
7936
7999
|
|
|
7937
8000
|
// src/commands/ravendb/resolveConnection.ts
|
|
7938
|
-
import
|
|
8001
|
+
import chalk99 from "chalk";
|
|
7939
8002
|
function loadRavendb() {
|
|
7940
8003
|
const raw = loadGlobalConfigRaw();
|
|
7941
8004
|
const ravendb = raw.ravendb;
|
|
@@ -7949,7 +8012,7 @@ function resolveConnection(name) {
|
|
|
7949
8012
|
const connectionName = name ?? defaultConnection;
|
|
7950
8013
|
if (!connectionName) {
|
|
7951
8014
|
console.error(
|
|
7952
|
-
|
|
8015
|
+
chalk99.red(
|
|
7953
8016
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
7954
8017
|
)
|
|
7955
8018
|
);
|
|
@@ -7957,7 +8020,7 @@ function resolveConnection(name) {
|
|
|
7957
8020
|
}
|
|
7958
8021
|
const connection = connections.find((c) => c.name === connectionName);
|
|
7959
8022
|
if (!connection) {
|
|
7960
|
-
console.error(
|
|
8023
|
+
console.error(chalk99.red(`Connection "${connectionName}" not found.`));
|
|
7961
8024
|
console.error(
|
|
7962
8025
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
7963
8026
|
);
|
|
@@ -7988,15 +8051,15 @@ async function ravendbCollections(connectionName) {
|
|
|
7988
8051
|
return;
|
|
7989
8052
|
}
|
|
7990
8053
|
for (const c of collections) {
|
|
7991
|
-
console.log(`${
|
|
8054
|
+
console.log(`${chalk100.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
7992
8055
|
}
|
|
7993
8056
|
}
|
|
7994
8057
|
|
|
7995
8058
|
// src/commands/ravendb/ravendbQuery.ts
|
|
7996
|
-
import
|
|
8059
|
+
import chalk102 from "chalk";
|
|
7997
8060
|
|
|
7998
8061
|
// src/commands/ravendb/fetchAllPages.ts
|
|
7999
|
-
import
|
|
8062
|
+
import chalk101 from "chalk";
|
|
8000
8063
|
|
|
8001
8064
|
// src/commands/ravendb/buildQueryPath.ts
|
|
8002
8065
|
function buildQueryPath(opts) {
|
|
@@ -8034,7 +8097,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8034
8097
|
allResults.push(...results);
|
|
8035
8098
|
start3 += results.length;
|
|
8036
8099
|
process.stderr.write(
|
|
8037
|
-
`\r${
|
|
8100
|
+
`\r${chalk101.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
8038
8101
|
);
|
|
8039
8102
|
if (start3 >= totalResults) break;
|
|
8040
8103
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -8049,7 +8112,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
8049
8112
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
8050
8113
|
const resolved = resolveArgs(connectionName, collection);
|
|
8051
8114
|
if (!resolved.collection && !options2.query) {
|
|
8052
|
-
console.error(
|
|
8115
|
+
console.error(chalk102.red("Provide a collection name or --query filter."));
|
|
8053
8116
|
process.exit(1);
|
|
8054
8117
|
}
|
|
8055
8118
|
const { collection: col } = resolved;
|
|
@@ -8087,7 +8150,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
8087
8150
|
import * as path27 from "path";
|
|
8088
8151
|
|
|
8089
8152
|
// src/commands/refactor/logViolations.ts
|
|
8090
|
-
import
|
|
8153
|
+
import chalk103 from "chalk";
|
|
8091
8154
|
var DEFAULT_MAX_LINES = 100;
|
|
8092
8155
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
8093
8156
|
if (violations.length === 0) {
|
|
@@ -8096,43 +8159,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
8096
8159
|
}
|
|
8097
8160
|
return;
|
|
8098
8161
|
}
|
|
8099
|
-
console.error(
|
|
8162
|
+
console.error(chalk103.red(`
|
|
8100
8163
|
Refactor check failed:
|
|
8101
8164
|
`));
|
|
8102
|
-
console.error(
|
|
8165
|
+
console.error(chalk103.red(` The following files exceed ${maxLines} lines:
|
|
8103
8166
|
`));
|
|
8104
8167
|
for (const violation of violations) {
|
|
8105
|
-
console.error(
|
|
8168
|
+
console.error(chalk103.red(` ${violation.file} (${violation.lines} lines)`));
|
|
8106
8169
|
}
|
|
8107
8170
|
console.error(
|
|
8108
|
-
|
|
8171
|
+
chalk103.yellow(
|
|
8109
8172
|
`
|
|
8110
8173
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
8111
8174
|
way to refactor it, ignore it with:
|
|
8112
8175
|
`
|
|
8113
8176
|
)
|
|
8114
8177
|
);
|
|
8115
|
-
console.error(
|
|
8178
|
+
console.error(chalk103.gray(` assist refactor ignore <file>
|
|
8116
8179
|
`));
|
|
8117
8180
|
if (process.env.CLAUDECODE) {
|
|
8118
|
-
console.error(
|
|
8181
|
+
console.error(chalk103.cyan(`
|
|
8119
8182
|
## Extracting Code to New Files
|
|
8120
8183
|
`));
|
|
8121
8184
|
console.error(
|
|
8122
|
-
|
|
8185
|
+
chalk103.cyan(
|
|
8123
8186
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
8124
8187
|
`
|
|
8125
8188
|
)
|
|
8126
8189
|
);
|
|
8127
8190
|
console.error(
|
|
8128
|
-
|
|
8191
|
+
chalk103.cyan(
|
|
8129
8192
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
8130
8193
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
8131
8194
|
`
|
|
8132
8195
|
)
|
|
8133
8196
|
);
|
|
8134
8197
|
console.error(
|
|
8135
|
-
|
|
8198
|
+
chalk103.cyan(
|
|
8136
8199
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
8137
8200
|
domains, move it to a common/shared folder.
|
|
8138
8201
|
`
|
|
@@ -8288,7 +8351,7 @@ async function check(pattern2, options2) {
|
|
|
8288
8351
|
|
|
8289
8352
|
// src/commands/refactor/extract/index.ts
|
|
8290
8353
|
import path33 from "path";
|
|
8291
|
-
import
|
|
8354
|
+
import chalk106 from "chalk";
|
|
8292
8355
|
|
|
8293
8356
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
8294
8357
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -8835,23 +8898,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
8835
8898
|
|
|
8836
8899
|
// src/commands/refactor/extract/displayPlan.ts
|
|
8837
8900
|
import path31 from "path";
|
|
8838
|
-
import
|
|
8901
|
+
import chalk104 from "chalk";
|
|
8839
8902
|
function section(title) {
|
|
8840
8903
|
return `
|
|
8841
|
-
${
|
|
8904
|
+
${chalk104.cyan(title)}`;
|
|
8842
8905
|
}
|
|
8843
8906
|
function displayImporters(plan2, cwd) {
|
|
8844
8907
|
if (plan2.importersToUpdate.length === 0) return;
|
|
8845
8908
|
console.log(section("Update importers:"));
|
|
8846
8909
|
for (const imp of plan2.importersToUpdate) {
|
|
8847
8910
|
const rel = path31.relative(cwd, imp.file.getFilePath());
|
|
8848
|
-
console.log(` ${
|
|
8911
|
+
console.log(` ${chalk104.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
8849
8912
|
}
|
|
8850
8913
|
}
|
|
8851
8914
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
8852
|
-
console.log(
|
|
8915
|
+
console.log(chalk104.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
8853
8916
|
`));
|
|
8854
|
-
console.log(` ${
|
|
8917
|
+
console.log(` ${chalk104.cyan("Functions to move:")}`);
|
|
8855
8918
|
for (const name of plan2.extractedNames) {
|
|
8856
8919
|
console.log(` ${name}`);
|
|
8857
8920
|
}
|
|
@@ -8886,7 +8949,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
8886
8949
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
8887
8950
|
import fs17 from "fs";
|
|
8888
8951
|
import path32 from "path";
|
|
8889
|
-
import
|
|
8952
|
+
import chalk105 from "chalk";
|
|
8890
8953
|
import { Project as Project2 } from "ts-morph";
|
|
8891
8954
|
function findTsConfig(sourcePath) {
|
|
8892
8955
|
const rootConfig = path32.resolve("tsconfig.json");
|
|
@@ -8917,7 +8980,7 @@ function loadProjectFile(file) {
|
|
|
8917
8980
|
});
|
|
8918
8981
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
8919
8982
|
if (!sourceFile) {
|
|
8920
|
-
console.log(
|
|
8983
|
+
console.log(chalk105.red(`File not found in project: ${file}`));
|
|
8921
8984
|
process.exit(1);
|
|
8922
8985
|
}
|
|
8923
8986
|
return { project, sourceFile };
|
|
@@ -8940,19 +9003,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
8940
9003
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
8941
9004
|
if (options2.apply) {
|
|
8942
9005
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
8943
|
-
console.log(
|
|
9006
|
+
console.log(chalk106.green("\nExtraction complete"));
|
|
8944
9007
|
} else {
|
|
8945
|
-
console.log(
|
|
9008
|
+
console.log(chalk106.dim("\nDry run. Use --apply to execute."));
|
|
8946
9009
|
}
|
|
8947
9010
|
}
|
|
8948
9011
|
|
|
8949
9012
|
// src/commands/refactor/ignore.ts
|
|
8950
9013
|
import fs18 from "fs";
|
|
8951
|
-
import
|
|
9014
|
+
import chalk107 from "chalk";
|
|
8952
9015
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
8953
9016
|
function ignore(file) {
|
|
8954
9017
|
if (!fs18.existsSync(file)) {
|
|
8955
|
-
console.error(
|
|
9018
|
+
console.error(chalk107.red(`Error: File does not exist: ${file}`));
|
|
8956
9019
|
process.exit(1);
|
|
8957
9020
|
}
|
|
8958
9021
|
const content = fs18.readFileSync(file, "utf-8");
|
|
@@ -8968,7 +9031,7 @@ function ignore(file) {
|
|
|
8968
9031
|
fs18.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
8969
9032
|
}
|
|
8970
9033
|
console.log(
|
|
8971
|
-
|
|
9034
|
+
chalk107.green(
|
|
8972
9035
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
8973
9036
|
)
|
|
8974
9037
|
);
|
|
@@ -8976,26 +9039,26 @@ function ignore(file) {
|
|
|
8976
9039
|
|
|
8977
9040
|
// src/commands/refactor/rename/index.ts
|
|
8978
9041
|
import path34 from "path";
|
|
8979
|
-
import
|
|
9042
|
+
import chalk108 from "chalk";
|
|
8980
9043
|
async function rename(source, destination, options2 = {}) {
|
|
8981
9044
|
const destPath = path34.resolve(destination);
|
|
8982
9045
|
const cwd = process.cwd();
|
|
8983
9046
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
8984
9047
|
const relDest = path34.relative(cwd, destPath);
|
|
8985
9048
|
const { project, sourceFile } = loadProjectFile(source);
|
|
8986
|
-
console.log(
|
|
9049
|
+
console.log(chalk108.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
8987
9050
|
if (options2.apply) {
|
|
8988
9051
|
sourceFile.move(destPath);
|
|
8989
9052
|
await project.save();
|
|
8990
|
-
console.log(
|
|
9053
|
+
console.log(chalk108.green("Done"));
|
|
8991
9054
|
} else {
|
|
8992
|
-
console.log(
|
|
9055
|
+
console.log(chalk108.dim("Dry run. Use --apply to execute."));
|
|
8993
9056
|
}
|
|
8994
9057
|
}
|
|
8995
9058
|
|
|
8996
9059
|
// src/commands/refactor/renameSymbol/index.ts
|
|
8997
9060
|
import path36 from "path";
|
|
8998
|
-
import
|
|
9061
|
+
import chalk109 from "chalk";
|
|
8999
9062
|
import { Project as Project3 } from "ts-morph";
|
|
9000
9063
|
|
|
9001
9064
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -9044,38 +9107,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
9044
9107
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
9045
9108
|
const sourceFile = project.getSourceFile(filePath);
|
|
9046
9109
|
if (!sourceFile) {
|
|
9047
|
-
console.log(
|
|
9110
|
+
console.log(chalk109.red(`File not found in project: ${file}`));
|
|
9048
9111
|
process.exit(1);
|
|
9049
9112
|
}
|
|
9050
9113
|
const symbol = findSymbol(sourceFile, oldName);
|
|
9051
9114
|
if (!symbol) {
|
|
9052
|
-
console.log(
|
|
9115
|
+
console.log(chalk109.red(`Symbol "${oldName}" not found in ${file}`));
|
|
9053
9116
|
process.exit(1);
|
|
9054
9117
|
}
|
|
9055
9118
|
const grouped = groupReferences(symbol, cwd);
|
|
9056
9119
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
9057
9120
|
console.log(
|
|
9058
|
-
|
|
9121
|
+
chalk109.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
9059
9122
|
`)
|
|
9060
9123
|
);
|
|
9061
9124
|
for (const [refFile, lines] of grouped) {
|
|
9062
9125
|
console.log(
|
|
9063
|
-
` ${
|
|
9126
|
+
` ${chalk109.dim(refFile)}: lines ${chalk109.cyan(lines.join(", "))}`
|
|
9064
9127
|
);
|
|
9065
9128
|
}
|
|
9066
9129
|
if (options2.apply) {
|
|
9067
9130
|
symbol.rename(newName);
|
|
9068
9131
|
await project.save();
|
|
9069
|
-
console.log(
|
|
9132
|
+
console.log(chalk109.green(`
|
|
9070
9133
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
9071
9134
|
} else {
|
|
9072
|
-
console.log(
|
|
9135
|
+
console.log(chalk109.dim("\nDry run. Use --apply to execute."));
|
|
9073
9136
|
}
|
|
9074
9137
|
}
|
|
9075
9138
|
|
|
9076
9139
|
// src/commands/refactor/restructure/index.ts
|
|
9077
9140
|
import path45 from "path";
|
|
9078
|
-
import
|
|
9141
|
+
import chalk112 from "chalk";
|
|
9079
9142
|
|
|
9080
9143
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
9081
9144
|
import path37 from "path";
|
|
@@ -9318,50 +9381,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
9318
9381
|
|
|
9319
9382
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
9320
9383
|
import path41 from "path";
|
|
9321
|
-
import
|
|
9384
|
+
import chalk110 from "chalk";
|
|
9322
9385
|
function relPath(filePath) {
|
|
9323
9386
|
return path41.relative(process.cwd(), filePath);
|
|
9324
9387
|
}
|
|
9325
9388
|
function displayMoves(plan2) {
|
|
9326
9389
|
if (plan2.moves.length === 0) return;
|
|
9327
|
-
console.log(
|
|
9390
|
+
console.log(chalk110.bold("\nFile moves:"));
|
|
9328
9391
|
for (const move of plan2.moves) {
|
|
9329
9392
|
console.log(
|
|
9330
|
-
` ${
|
|
9393
|
+
` ${chalk110.red(relPath(move.from))} \u2192 ${chalk110.green(relPath(move.to))}`
|
|
9331
9394
|
);
|
|
9332
|
-
console.log(
|
|
9395
|
+
console.log(chalk110.dim(` ${move.reason}`));
|
|
9333
9396
|
}
|
|
9334
9397
|
}
|
|
9335
9398
|
function displayRewrites(rewrites) {
|
|
9336
9399
|
if (rewrites.length === 0) return;
|
|
9337
9400
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
9338
|
-
console.log(
|
|
9401
|
+
console.log(chalk110.bold(`
|
|
9339
9402
|
Import rewrites (${affectedFiles.size} files):`));
|
|
9340
9403
|
for (const file of affectedFiles) {
|
|
9341
|
-
console.log(` ${
|
|
9404
|
+
console.log(` ${chalk110.cyan(relPath(file))}:`);
|
|
9342
9405
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
9343
9406
|
(r) => r.file === file
|
|
9344
9407
|
)) {
|
|
9345
9408
|
console.log(
|
|
9346
|
-
` ${
|
|
9409
|
+
` ${chalk110.red(`"${oldSpecifier}"`)} \u2192 ${chalk110.green(`"${newSpecifier}"`)}`
|
|
9347
9410
|
);
|
|
9348
9411
|
}
|
|
9349
9412
|
}
|
|
9350
9413
|
}
|
|
9351
9414
|
function displayPlan2(plan2) {
|
|
9352
9415
|
if (plan2.warnings.length > 0) {
|
|
9353
|
-
console.log(
|
|
9354
|
-
for (const w of plan2.warnings) console.log(
|
|
9416
|
+
console.log(chalk110.yellow("\nWarnings:"));
|
|
9417
|
+
for (const w of plan2.warnings) console.log(chalk110.yellow(` ${w}`));
|
|
9355
9418
|
}
|
|
9356
9419
|
if (plan2.newDirectories.length > 0) {
|
|
9357
|
-
console.log(
|
|
9420
|
+
console.log(chalk110.bold("\nNew directories:"));
|
|
9358
9421
|
for (const dir of plan2.newDirectories)
|
|
9359
|
-
console.log(
|
|
9422
|
+
console.log(chalk110.green(` ${dir}/`));
|
|
9360
9423
|
}
|
|
9361
9424
|
displayMoves(plan2);
|
|
9362
9425
|
displayRewrites(plan2.rewrites);
|
|
9363
9426
|
console.log(
|
|
9364
|
-
|
|
9427
|
+
chalk110.dim(
|
|
9365
9428
|
`
|
|
9366
9429
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
9367
9430
|
)
|
|
@@ -9371,18 +9434,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
9371
9434
|
// src/commands/refactor/restructure/executePlan.ts
|
|
9372
9435
|
import fs20 from "fs";
|
|
9373
9436
|
import path42 from "path";
|
|
9374
|
-
import
|
|
9437
|
+
import chalk111 from "chalk";
|
|
9375
9438
|
function executePlan(plan2) {
|
|
9376
9439
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
9377
9440
|
for (const [file, content] of updatedContents) {
|
|
9378
9441
|
fs20.writeFileSync(file, content, "utf-8");
|
|
9379
9442
|
console.log(
|
|
9380
|
-
|
|
9443
|
+
chalk111.cyan(` Rewrote imports in ${path42.relative(process.cwd(), file)}`)
|
|
9381
9444
|
);
|
|
9382
9445
|
}
|
|
9383
9446
|
for (const dir of plan2.newDirectories) {
|
|
9384
9447
|
fs20.mkdirSync(dir, { recursive: true });
|
|
9385
|
-
console.log(
|
|
9448
|
+
console.log(chalk111.green(` Created ${path42.relative(process.cwd(), dir)}/`));
|
|
9386
9449
|
}
|
|
9387
9450
|
for (const move of plan2.moves) {
|
|
9388
9451
|
const targetDir = path42.dirname(move.to);
|
|
@@ -9391,7 +9454,7 @@ function executePlan(plan2) {
|
|
|
9391
9454
|
}
|
|
9392
9455
|
fs20.renameSync(move.from, move.to);
|
|
9393
9456
|
console.log(
|
|
9394
|
-
|
|
9457
|
+
chalk111.white(
|
|
9395
9458
|
` Moved ${path42.relative(process.cwd(), move.from)} \u2192 ${path42.relative(process.cwd(), move.to)}`
|
|
9396
9459
|
)
|
|
9397
9460
|
);
|
|
@@ -9406,7 +9469,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
9406
9469
|
if (entries.length === 0) {
|
|
9407
9470
|
fs20.rmdirSync(dir);
|
|
9408
9471
|
console.log(
|
|
9409
|
-
|
|
9472
|
+
chalk111.dim(
|
|
9410
9473
|
` Removed empty directory ${path42.relative(process.cwd(), dir)}`
|
|
9411
9474
|
)
|
|
9412
9475
|
);
|
|
@@ -9539,22 +9602,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
9539
9602
|
const targetPattern = pattern2 ?? "src";
|
|
9540
9603
|
const files = findSourceFiles2(targetPattern);
|
|
9541
9604
|
if (files.length === 0) {
|
|
9542
|
-
console.log(
|
|
9605
|
+
console.log(chalk112.yellow("No files found matching pattern"));
|
|
9543
9606
|
return;
|
|
9544
9607
|
}
|
|
9545
9608
|
const tsConfigPath = path45.resolve("tsconfig.json");
|
|
9546
9609
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
9547
9610
|
if (plan2.moves.length === 0) {
|
|
9548
|
-
console.log(
|
|
9611
|
+
console.log(chalk112.green("No restructuring needed"));
|
|
9549
9612
|
return;
|
|
9550
9613
|
}
|
|
9551
9614
|
displayPlan2(plan2);
|
|
9552
9615
|
if (options2.apply) {
|
|
9553
|
-
console.log(
|
|
9616
|
+
console.log(chalk112.bold("\nApplying changes..."));
|
|
9554
9617
|
executePlan(plan2);
|
|
9555
|
-
console.log(
|
|
9618
|
+
console.log(chalk112.green("\nRestructuring complete"));
|
|
9556
9619
|
} else {
|
|
9557
|
-
console.log(
|
|
9620
|
+
console.log(chalk112.dim("\nDry run. Use --apply to execute."));
|
|
9558
9621
|
}
|
|
9559
9622
|
}
|
|
9560
9623
|
|
|
@@ -9594,7 +9657,7 @@ function registerRefactor(program2) {
|
|
|
9594
9657
|
}
|
|
9595
9658
|
|
|
9596
9659
|
// src/commands/seq/seqAuth.ts
|
|
9597
|
-
import
|
|
9660
|
+
import chalk114 from "chalk";
|
|
9598
9661
|
|
|
9599
9662
|
// src/commands/seq/loadConnections.ts
|
|
9600
9663
|
function loadConnections2() {
|
|
@@ -9623,11 +9686,11 @@ function setDefaultConnection(name) {
|
|
|
9623
9686
|
}
|
|
9624
9687
|
|
|
9625
9688
|
// src/commands/seq/promptConnection.ts
|
|
9626
|
-
import
|
|
9689
|
+
import chalk113 from "chalk";
|
|
9627
9690
|
async function promptConnection2(existingNames) {
|
|
9628
9691
|
const name = await promptInput("name", "Connection name:", "default");
|
|
9629
9692
|
if (existingNames.includes(name)) {
|
|
9630
|
-
console.error(
|
|
9693
|
+
console.error(chalk113.red(`Connection "${name}" already exists.`));
|
|
9631
9694
|
process.exit(1);
|
|
9632
9695
|
}
|
|
9633
9696
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -9639,16 +9702,16 @@ async function promptConnection2(existingNames) {
|
|
|
9639
9702
|
var seqAuth = createConnectionAuth({
|
|
9640
9703
|
load: loadConnections2,
|
|
9641
9704
|
save: saveConnections2,
|
|
9642
|
-
format: (c) => `${
|
|
9705
|
+
format: (c) => `${chalk114.bold(c.name)} ${c.url}`,
|
|
9643
9706
|
promptNew: promptConnection2,
|
|
9644
9707
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
9645
9708
|
});
|
|
9646
9709
|
|
|
9647
9710
|
// src/commands/seq/seqQuery.ts
|
|
9648
|
-
import
|
|
9711
|
+
import chalk118 from "chalk";
|
|
9649
9712
|
|
|
9650
9713
|
// src/commands/seq/fetchSeq.ts
|
|
9651
|
-
import
|
|
9714
|
+
import chalk115 from "chalk";
|
|
9652
9715
|
async function fetchSeq(conn, path50, params) {
|
|
9653
9716
|
const url = `${conn.url}${path50}?${params}`;
|
|
9654
9717
|
const response = await fetch(url, {
|
|
@@ -9659,7 +9722,7 @@ async function fetchSeq(conn, path50, params) {
|
|
|
9659
9722
|
});
|
|
9660
9723
|
if (!response.ok) {
|
|
9661
9724
|
const body = await response.text();
|
|
9662
|
-
console.error(
|
|
9725
|
+
console.error(chalk115.red(`Seq returned ${response.status}: ${body}`));
|
|
9663
9726
|
process.exit(1);
|
|
9664
9727
|
}
|
|
9665
9728
|
return response;
|
|
@@ -9712,23 +9775,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
9712
9775
|
}
|
|
9713
9776
|
|
|
9714
9777
|
// src/commands/seq/formatEvent.ts
|
|
9715
|
-
import
|
|
9778
|
+
import chalk116 from "chalk";
|
|
9716
9779
|
function levelColor(level) {
|
|
9717
9780
|
switch (level) {
|
|
9718
9781
|
case "Fatal":
|
|
9719
|
-
return
|
|
9782
|
+
return chalk116.bgRed.white;
|
|
9720
9783
|
case "Error":
|
|
9721
|
-
return
|
|
9784
|
+
return chalk116.red;
|
|
9722
9785
|
case "Warning":
|
|
9723
|
-
return
|
|
9786
|
+
return chalk116.yellow;
|
|
9724
9787
|
case "Information":
|
|
9725
|
-
return
|
|
9788
|
+
return chalk116.cyan;
|
|
9726
9789
|
case "Debug":
|
|
9727
|
-
return
|
|
9790
|
+
return chalk116.gray;
|
|
9728
9791
|
case "Verbose":
|
|
9729
|
-
return
|
|
9792
|
+
return chalk116.dim;
|
|
9730
9793
|
default:
|
|
9731
|
-
return
|
|
9794
|
+
return chalk116.white;
|
|
9732
9795
|
}
|
|
9733
9796
|
}
|
|
9734
9797
|
function levelAbbrev(level) {
|
|
@@ -9769,31 +9832,31 @@ function formatTimestamp(iso) {
|
|
|
9769
9832
|
function formatEvent(event) {
|
|
9770
9833
|
const color = levelColor(event.Level);
|
|
9771
9834
|
const abbrev = levelAbbrev(event.Level);
|
|
9772
|
-
const ts8 =
|
|
9835
|
+
const ts8 = chalk116.dim(formatTimestamp(event.Timestamp));
|
|
9773
9836
|
const msg = renderMessage(event);
|
|
9774
9837
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
9775
9838
|
if (event.Exception) {
|
|
9776
9839
|
for (const line of event.Exception.split("\n")) {
|
|
9777
|
-
lines.push(
|
|
9840
|
+
lines.push(chalk116.red(` ${line}`));
|
|
9778
9841
|
}
|
|
9779
9842
|
}
|
|
9780
9843
|
return lines.join("\n");
|
|
9781
9844
|
}
|
|
9782
9845
|
|
|
9783
9846
|
// src/commands/seq/resolveConnection.ts
|
|
9784
|
-
import
|
|
9847
|
+
import chalk117 from "chalk";
|
|
9785
9848
|
function resolveConnection2(name) {
|
|
9786
9849
|
const connections = loadConnections2();
|
|
9787
9850
|
if (connections.length === 0) {
|
|
9788
9851
|
console.error(
|
|
9789
|
-
|
|
9852
|
+
chalk117.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
9790
9853
|
);
|
|
9791
9854
|
process.exit(1);
|
|
9792
9855
|
}
|
|
9793
9856
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
9794
9857
|
const connection = connections.find((c) => c.name === target);
|
|
9795
9858
|
if (!connection) {
|
|
9796
|
-
console.error(
|
|
9859
|
+
console.error(chalk117.red(`Seq connection "${target}" not found.`));
|
|
9797
9860
|
process.exit(1);
|
|
9798
9861
|
}
|
|
9799
9862
|
return connection;
|
|
@@ -9808,7 +9871,7 @@ async function seqQuery(filter, options2) {
|
|
|
9808
9871
|
new URLSearchParams({ filter, count: String(count) })
|
|
9809
9872
|
);
|
|
9810
9873
|
if (events.length === 0) {
|
|
9811
|
-
console.log(
|
|
9874
|
+
console.log(chalk118.yellow("No events found."));
|
|
9812
9875
|
return;
|
|
9813
9876
|
}
|
|
9814
9877
|
if (options2.json) {
|
|
@@ -9819,11 +9882,11 @@ async function seqQuery(filter, options2) {
|
|
|
9819
9882
|
for (const event of chronological) {
|
|
9820
9883
|
console.log(formatEvent(event));
|
|
9821
9884
|
}
|
|
9822
|
-
console.log(
|
|
9885
|
+
console.log(chalk118.dim(`
|
|
9823
9886
|
${events.length} events`));
|
|
9824
9887
|
if (events.length >= count) {
|
|
9825
9888
|
console.log(
|
|
9826
|
-
|
|
9889
|
+
chalk118.yellow(
|
|
9827
9890
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
9828
9891
|
)
|
|
9829
9892
|
);
|
|
@@ -9831,11 +9894,11 @@ ${events.length} events`));
|
|
|
9831
9894
|
}
|
|
9832
9895
|
|
|
9833
9896
|
// src/commands/seq/seqSetConnection.ts
|
|
9834
|
-
import
|
|
9897
|
+
import chalk119 from "chalk";
|
|
9835
9898
|
function seqSetConnection(name) {
|
|
9836
9899
|
const connections = loadConnections2();
|
|
9837
9900
|
if (!connections.find((c) => c.name === name)) {
|
|
9838
|
-
console.error(
|
|
9901
|
+
console.error(chalk119.red(`Connection "${name}" not found.`));
|
|
9839
9902
|
process.exit(1);
|
|
9840
9903
|
}
|
|
9841
9904
|
setDefaultConnection(name);
|
|
@@ -10374,14 +10437,14 @@ import {
|
|
|
10374
10437
|
import { dirname as dirname20, join as join33 } from "path";
|
|
10375
10438
|
|
|
10376
10439
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
10377
|
-
import
|
|
10440
|
+
import chalk120 from "chalk";
|
|
10378
10441
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
10379
10442
|
function validateStagedContent(filename, content) {
|
|
10380
10443
|
const firstLine = content.split("\n")[0];
|
|
10381
10444
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
10382
10445
|
if (!match) {
|
|
10383
10446
|
console.error(
|
|
10384
|
-
|
|
10447
|
+
chalk120.red(
|
|
10385
10448
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
10386
10449
|
)
|
|
10387
10450
|
);
|
|
@@ -10390,7 +10453,7 @@ function validateStagedContent(filename, content) {
|
|
|
10390
10453
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
10391
10454
|
if (!contentAfterLink) {
|
|
10392
10455
|
console.error(
|
|
10393
|
-
|
|
10456
|
+
chalk120.red(
|
|
10394
10457
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
10395
10458
|
)
|
|
10396
10459
|
);
|
|
@@ -10783,7 +10846,7 @@ function registerVoice(program2) {
|
|
|
10783
10846
|
|
|
10784
10847
|
// src/commands/roam/auth.ts
|
|
10785
10848
|
import { randomBytes } from "crypto";
|
|
10786
|
-
import
|
|
10849
|
+
import chalk121 from "chalk";
|
|
10787
10850
|
|
|
10788
10851
|
// src/lib/openBrowser.ts
|
|
10789
10852
|
import { execSync as execSync38 } from "child_process";
|
|
@@ -10958,13 +11021,13 @@ async function auth() {
|
|
|
10958
11021
|
saveGlobalConfig(config);
|
|
10959
11022
|
const state = randomBytes(16).toString("hex");
|
|
10960
11023
|
console.log(
|
|
10961
|
-
|
|
11024
|
+
chalk121.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
10962
11025
|
);
|
|
10963
|
-
console.log(
|
|
10964
|
-
console.log(
|
|
10965
|
-
console.log(
|
|
11026
|
+
console.log(chalk121.white("http://localhost:14523/callback\n"));
|
|
11027
|
+
console.log(chalk121.blue("Opening browser for authorization..."));
|
|
11028
|
+
console.log(chalk121.dim("Waiting for authorization callback..."));
|
|
10966
11029
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
10967
|
-
console.log(
|
|
11030
|
+
console.log(chalk121.dim("Exchanging code for tokens..."));
|
|
10968
11031
|
const tokens = await exchangeToken({
|
|
10969
11032
|
code,
|
|
10970
11033
|
clientId,
|
|
@@ -10980,7 +11043,7 @@ async function auth() {
|
|
|
10980
11043
|
};
|
|
10981
11044
|
saveGlobalConfig(config);
|
|
10982
11045
|
console.log(
|
|
10983
|
-
|
|
11046
|
+
chalk121.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
10984
11047
|
);
|
|
10985
11048
|
}
|
|
10986
11049
|
|
|
@@ -11193,7 +11256,7 @@ import { execSync as execSync40 } from "child_process";
|
|
|
11193
11256
|
import { existsSync as existsSync38, mkdirSync as mkdirSync14, unlinkSync as unlinkSync11, writeFileSync as writeFileSync28 } from "fs";
|
|
11194
11257
|
import { tmpdir as tmpdir6 } from "os";
|
|
11195
11258
|
import { join as join42, resolve as resolve5 } from "path";
|
|
11196
|
-
import
|
|
11259
|
+
import chalk122 from "chalk";
|
|
11197
11260
|
|
|
11198
11261
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
11199
11262
|
var captureWindowPs1 = `
|
|
@@ -11344,22 +11407,22 @@ function screenshot(processName) {
|
|
|
11344
11407
|
const config = loadConfig();
|
|
11345
11408
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
11346
11409
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
11347
|
-
console.log(
|
|
11410
|
+
console.log(chalk122.gray(`Capturing window for process "${processName}" ...`));
|
|
11348
11411
|
try {
|
|
11349
11412
|
runPowerShellScript(processName, outputPath);
|
|
11350
|
-
console.log(
|
|
11413
|
+
console.log(chalk122.green(`Screenshot saved: ${outputPath}`));
|
|
11351
11414
|
} catch (error) {
|
|
11352
11415
|
const msg = error instanceof Error ? error.message : String(error);
|
|
11353
|
-
console.error(
|
|
11416
|
+
console.error(chalk122.red(`Failed to capture screenshot: ${msg}`));
|
|
11354
11417
|
process.exit(1);
|
|
11355
11418
|
}
|
|
11356
11419
|
}
|
|
11357
11420
|
|
|
11358
11421
|
// src/commands/statusLine.ts
|
|
11359
|
-
import
|
|
11422
|
+
import chalk124 from "chalk";
|
|
11360
11423
|
|
|
11361
11424
|
// src/commands/buildLimitsSegment.ts
|
|
11362
|
-
import
|
|
11425
|
+
import chalk123 from "chalk";
|
|
11363
11426
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
11364
11427
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
11365
11428
|
function formatTimeLeft(resetsAt) {
|
|
@@ -11382,10 +11445,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
11382
11445
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
11383
11446
|
const label2 = `${Math.round(pct)}%`;
|
|
11384
11447
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
11385
|
-
if (projected == null) return
|
|
11386
|
-
if (projected > 100) return
|
|
11387
|
-
if (projected > 75) return
|
|
11388
|
-
return
|
|
11448
|
+
if (projected == null) return chalk123.green(label2);
|
|
11449
|
+
if (projected > 100) return chalk123.red(label2);
|
|
11450
|
+
if (projected > 75) return chalk123.yellow(label2);
|
|
11451
|
+
return chalk123.green(label2);
|
|
11389
11452
|
}
|
|
11390
11453
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
11391
11454
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -11411,14 +11474,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
11411
11474
|
}
|
|
11412
11475
|
|
|
11413
11476
|
// src/commands/statusLine.ts
|
|
11414
|
-
|
|
11477
|
+
chalk124.level = 3;
|
|
11415
11478
|
function formatNumber(num) {
|
|
11416
11479
|
return num.toLocaleString("en-US");
|
|
11417
11480
|
}
|
|
11418
11481
|
function colorizePercent(pct) {
|
|
11419
11482
|
const label2 = `${Math.round(pct)}%`;
|
|
11420
|
-
if (pct > 80) return
|
|
11421
|
-
if (pct > 40) return
|
|
11483
|
+
if (pct > 80) return chalk124.red(label2);
|
|
11484
|
+
if (pct > 40) return chalk124.yellow(label2);
|
|
11422
11485
|
return label2;
|
|
11423
11486
|
}
|
|
11424
11487
|
async function statusLine() {
|
|
@@ -11441,7 +11504,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
11441
11504
|
// src/commands/sync/syncClaudeMd.ts
|
|
11442
11505
|
import * as fs23 from "fs";
|
|
11443
11506
|
import * as path46 from "path";
|
|
11444
|
-
import
|
|
11507
|
+
import chalk125 from "chalk";
|
|
11445
11508
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
11446
11509
|
const source = path46.join(claudeDir, "CLAUDE.md");
|
|
11447
11510
|
const target = path46.join(targetBase, "CLAUDE.md");
|
|
@@ -11450,12 +11513,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11450
11513
|
const targetContent = fs23.readFileSync(target, "utf-8");
|
|
11451
11514
|
if (sourceContent !== targetContent) {
|
|
11452
11515
|
console.log(
|
|
11453
|
-
|
|
11516
|
+
chalk125.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
11454
11517
|
);
|
|
11455
11518
|
console.log();
|
|
11456
11519
|
printDiff(targetContent, sourceContent);
|
|
11457
11520
|
const confirm = options2?.yes || await promptConfirm(
|
|
11458
|
-
|
|
11521
|
+
chalk125.red("Overwrite existing CLAUDE.md?"),
|
|
11459
11522
|
false
|
|
11460
11523
|
);
|
|
11461
11524
|
if (!confirm) {
|
|
@@ -11471,7 +11534,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
11471
11534
|
// src/commands/sync/syncSettings.ts
|
|
11472
11535
|
import * as fs24 from "fs";
|
|
11473
11536
|
import * as path47 from "path";
|
|
11474
|
-
import
|
|
11537
|
+
import chalk126 from "chalk";
|
|
11475
11538
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
11476
11539
|
const source = path47.join(claudeDir, "settings.json");
|
|
11477
11540
|
const target = path47.join(targetBase, "settings.json");
|
|
@@ -11487,14 +11550,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
11487
11550
|
if (mergedContent !== normalizedTarget) {
|
|
11488
11551
|
if (!options2?.yes) {
|
|
11489
11552
|
console.log(
|
|
11490
|
-
|
|
11553
|
+
chalk126.yellow(
|
|
11491
11554
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
11492
11555
|
)
|
|
11493
11556
|
);
|
|
11494
11557
|
console.log();
|
|
11495
11558
|
printDiff(targetContent, mergedContent);
|
|
11496
11559
|
const confirm = await promptConfirm(
|
|
11497
|
-
|
|
11560
|
+
chalk126.red("Overwrite existing settings.json?"),
|
|
11498
11561
|
false
|
|
11499
11562
|
);
|
|
11500
11563
|
if (!confirm) {
|