@staff0rd/assist 0.135.0 → 0.136.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +330 -304
- 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.136.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2299,6 +2299,7 @@ var backlogItemSchema = z2.strictObject({
|
|
|
2299
2299
|
description: z2.string().optional(),
|
|
2300
2300
|
acceptanceCriteria: z2.array(z2.string()),
|
|
2301
2301
|
plan: z2.array(planPhaseSchema).optional(),
|
|
2302
|
+
currentPhase: z2.number().optional(),
|
|
2302
2303
|
status: backlogStatusSchema
|
|
2303
2304
|
});
|
|
2304
2305
|
var backlogFileSchema = z2.array(backlogItemSchema);
|
|
@@ -2351,6 +2352,12 @@ function setStatus(id, status2) {
|
|
|
2351
2352
|
saveBacklog(result.items);
|
|
2352
2353
|
return result.item.name;
|
|
2353
2354
|
}
|
|
2355
|
+
function setCurrentPhase(id, phase) {
|
|
2356
|
+
const result = loadAndFindItem(id);
|
|
2357
|
+
if (!result) return;
|
|
2358
|
+
result.item.currentPhase = phase;
|
|
2359
|
+
saveBacklog(result.items);
|
|
2360
|
+
}
|
|
2354
2361
|
function removeItem(id) {
|
|
2355
2362
|
const result = loadAndFindItem(id);
|
|
2356
2363
|
if (!result) return void 0;
|
|
@@ -2522,6 +2529,9 @@ async function init6() {
|
|
|
2522
2529
|
|
|
2523
2530
|
// src/commands/backlog/list/index.ts
|
|
2524
2531
|
import { existsSync as existsSync15 } from "fs";
|
|
2532
|
+
import chalk31 from "chalk";
|
|
2533
|
+
|
|
2534
|
+
// src/commands/backlog/list/shared.ts
|
|
2525
2535
|
import chalk30 from "chalk";
|
|
2526
2536
|
function statusIcon(status2) {
|
|
2527
2537
|
switch (status2) {
|
|
@@ -2541,6 +2551,12 @@ function typeLabel(type) {
|
|
|
2541
2551
|
return chalk30.cyan("Story");
|
|
2542
2552
|
}
|
|
2543
2553
|
}
|
|
2554
|
+
function phaseLabel(item) {
|
|
2555
|
+
if (!item.plan) return "";
|
|
2556
|
+
return chalk30.dim(
|
|
2557
|
+
` (phase ${(item.currentPhase ?? 0) + 1}/${item.plan.length})`
|
|
2558
|
+
);
|
|
2559
|
+
}
|
|
2544
2560
|
function printVerboseDetails(item) {
|
|
2545
2561
|
if (item.description) {
|
|
2546
2562
|
console.log(` ${chalk30.dim("Description:")} ${item.description}`);
|
|
@@ -2553,16 +2569,17 @@ function printVerboseDetails(item) {
|
|
|
2553
2569
|
}
|
|
2554
2570
|
console.log();
|
|
2555
2571
|
}
|
|
2572
|
+
|
|
2573
|
+
// src/commands/backlog/list/index.ts
|
|
2556
2574
|
function filterItems(items, options2) {
|
|
2557
2575
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
2558
2576
|
if (!options2.all) return items.filter((i) => i.status !== "done");
|
|
2559
2577
|
return items;
|
|
2560
2578
|
}
|
|
2561
2579
|
async function list2(options2) {
|
|
2562
|
-
|
|
2563
|
-
if (!existsSync15(backlogPath)) {
|
|
2580
|
+
if (!existsSync15(getBacklogPath())) {
|
|
2564
2581
|
console.log(
|
|
2565
|
-
|
|
2582
|
+
chalk31.yellow(
|
|
2566
2583
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
2567
2584
|
)
|
|
2568
2585
|
);
|
|
@@ -2570,12 +2587,12 @@ async function list2(options2) {
|
|
|
2570
2587
|
}
|
|
2571
2588
|
const items = filterItems(loadBacklog(), options2);
|
|
2572
2589
|
if (items.length === 0) {
|
|
2573
|
-
console.log(
|
|
2590
|
+
console.log(chalk31.dim("Backlog is empty."));
|
|
2574
2591
|
return;
|
|
2575
2592
|
}
|
|
2576
2593
|
for (const item of items) {
|
|
2577
2594
|
console.log(
|
|
2578
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
2595
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk31.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}`
|
|
2579
2596
|
);
|
|
2580
2597
|
if (options2.verbose) {
|
|
2581
2598
|
printVerboseDetails(item);
|
|
@@ -2584,16 +2601,16 @@ async function list2(options2) {
|
|
|
2584
2601
|
}
|
|
2585
2602
|
|
|
2586
2603
|
// src/commands/backlog/next.ts
|
|
2587
|
-
import
|
|
2604
|
+
import chalk35 from "chalk";
|
|
2588
2605
|
import enquirer6 from "enquirer";
|
|
2589
2606
|
|
|
2590
2607
|
// src/commands/backlog/run.ts
|
|
2591
|
-
import
|
|
2608
|
+
import chalk34 from "chalk";
|
|
2592
2609
|
|
|
2593
2610
|
// src/commands/backlog/executePhase.ts
|
|
2594
2611
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
2595
2612
|
import { existsSync as existsSync16, unlinkSync as unlinkSync3 } from "fs";
|
|
2596
|
-
import
|
|
2613
|
+
import chalk33 from "chalk";
|
|
2597
2614
|
import enquirer5 from "enquirer";
|
|
2598
2615
|
|
|
2599
2616
|
// src/commands/backlog/buildPhasePrompt.ts
|
|
@@ -2625,22 +2642,24 @@ function buildPhasePrompt(item, phaseIndex, phase) {
|
|
|
2625
2642
|
// src/commands/backlog/phaseDone.ts
|
|
2626
2643
|
import { writeFileSync as writeFileSync13 } from "fs";
|
|
2627
2644
|
import { join as join10 } from "path";
|
|
2628
|
-
import
|
|
2645
|
+
import chalk32 from "chalk";
|
|
2629
2646
|
var PHASE_STATUS_FILE = ".assist-phase-status.json";
|
|
2630
2647
|
function getPhaseStatusPath() {
|
|
2631
2648
|
return join10(process.cwd(), PHASE_STATUS_FILE);
|
|
2632
2649
|
}
|
|
2633
2650
|
function phaseDone(id, phase) {
|
|
2651
|
+
const phaseIndex = Number.parseInt(phase, 10);
|
|
2634
2652
|
const statusPath = getPhaseStatusPath();
|
|
2635
2653
|
writeFileSync13(
|
|
2636
2654
|
statusPath,
|
|
2637
2655
|
JSON.stringify({
|
|
2638
2656
|
itemId: Number.parseInt(id, 10),
|
|
2639
|
-
phaseIndex
|
|
2657
|
+
phaseIndex,
|
|
2640
2658
|
completedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2641
2659
|
})
|
|
2642
2660
|
);
|
|
2643
|
-
|
|
2661
|
+
setCurrentPhase(id, phaseIndex + 1);
|
|
2662
|
+
console.log(chalk32.green(`Phase ${phase} of item #${id} marked as complete.`));
|
|
2644
2663
|
}
|
|
2645
2664
|
|
|
2646
2665
|
// src/commands/backlog/spawnClaude.ts
|
|
@@ -2648,8 +2667,7 @@ import { spawn as spawn3 } from "child_process";
|
|
|
2648
2667
|
function spawnClaude(prompt) {
|
|
2649
2668
|
return new Promise((resolve7, reject) => {
|
|
2650
2669
|
const child = spawn3("claude", [prompt], {
|
|
2651
|
-
stdio: "inherit"
|
|
2652
|
-
shell: true
|
|
2670
|
+
stdio: "inherit"
|
|
2653
2671
|
});
|
|
2654
2672
|
child.on("close", (code) => resolve7(code ?? 0));
|
|
2655
2673
|
child.on("error", reject);
|
|
@@ -2673,11 +2691,11 @@ function runVerify() {
|
|
|
2673
2691
|
async function handleCompletedPhase(phaseIndex) {
|
|
2674
2692
|
cleanupMarker();
|
|
2675
2693
|
console.log(
|
|
2676
|
-
|
|
2694
|
+
chalk33.green(`
|
|
2677
2695
|
Phase ${phaseIndex + 1} completed. Running verify...`)
|
|
2678
2696
|
);
|
|
2679
2697
|
if (runVerify()) {
|
|
2680
|
-
console.log(
|
|
2698
|
+
console.log(chalk33.green("Verification passed."));
|
|
2681
2699
|
return true;
|
|
2682
2700
|
}
|
|
2683
2701
|
const { action } = await enquirer5.prompt({
|
|
@@ -2711,7 +2729,7 @@ async function resolvePhaseResult(phaseIndex) {
|
|
|
2711
2729
|
async function executePhase(item, phaseIndex, phases) {
|
|
2712
2730
|
const phase = phases[phaseIndex];
|
|
2713
2731
|
console.log(
|
|
2714
|
-
|
|
2732
|
+
chalk33.bold(
|
|
2715
2733
|
`
|
|
2716
2734
|
--- Phase ${phaseIndex + 1}/${phases.length}: ${phase.name} ---
|
|
2717
2735
|
`
|
|
@@ -2727,7 +2745,7 @@ async function executePhase(item, phaseIndex, phases) {
|
|
|
2727
2745
|
function validatePlan(item) {
|
|
2728
2746
|
if (!item.plan || item.plan.length === 0) {
|
|
2729
2747
|
console.log(
|
|
2730
|
-
|
|
2748
|
+
chalk34.red("Item has no plan. Use /draft to create one with phases.")
|
|
2731
2749
|
);
|
|
2732
2750
|
return void 0;
|
|
2733
2751
|
}
|
|
@@ -2740,17 +2758,25 @@ async function run2(id) {
|
|
|
2740
2758
|
const plan2 = validatePlan(item);
|
|
2741
2759
|
if (!plan2) return;
|
|
2742
2760
|
setStatus(id, "in-progress");
|
|
2743
|
-
|
|
2744
|
-
console.log(
|
|
2761
|
+
const startPhase = item.currentPhase ?? 0;
|
|
2762
|
+
console.log(chalk34.bold(`Running plan for #${id}: ${item.name}`));
|
|
2763
|
+
if (startPhase > 0) {
|
|
2764
|
+
console.log(
|
|
2765
|
+
chalk34.dim(`Resuming from phase ${startPhase + 1}/${plan2.length}
|
|
2766
|
+
`)
|
|
2767
|
+
);
|
|
2768
|
+
} else {
|
|
2769
|
+
console.log(chalk34.dim(`${plan2.length} phase(s)
|
|
2745
2770
|
`));
|
|
2746
|
-
|
|
2771
|
+
}
|
|
2772
|
+
let phaseIndex = startPhase;
|
|
2747
2773
|
while (phaseIndex < plan2.length) {
|
|
2748
2774
|
phaseIndex = await executePhase(item, phaseIndex, plan2);
|
|
2749
2775
|
if (phaseIndex < 0) return;
|
|
2750
2776
|
}
|
|
2751
|
-
console.log(
|
|
2777
|
+
console.log(chalk34.green(`
|
|
2752
2778
|
All phases complete for #${id}: ${item.name}`));
|
|
2753
|
-
console.log(
|
|
2779
|
+
console.log(chalk34.dim("Review the changes, then use /commit when ready."));
|
|
2754
2780
|
}
|
|
2755
2781
|
|
|
2756
2782
|
// src/commands/backlog/next.ts
|
|
@@ -2759,7 +2785,7 @@ async function next() {
|
|
|
2759
2785
|
const inProgress = items.find((i) => i.status === "in-progress" && i.plan);
|
|
2760
2786
|
if (inProgress) {
|
|
2761
2787
|
console.log(
|
|
2762
|
-
|
|
2788
|
+
chalk35.bold(
|
|
2763
2789
|
`Resuming in-progress item #${inProgress.id}: ${inProgress.name}`
|
|
2764
2790
|
)
|
|
2765
2791
|
);
|
|
@@ -2768,7 +2794,7 @@ async function next() {
|
|
|
2768
2794
|
}
|
|
2769
2795
|
const todo = items.filter((i) => i.status === "todo");
|
|
2770
2796
|
if (todo.length === 0) {
|
|
2771
|
-
console.log(
|
|
2797
|
+
console.log(chalk35.dim("No incomplete backlog items. Opening /draft..."));
|
|
2772
2798
|
await spawnClaude("/draft");
|
|
2773
2799
|
return;
|
|
2774
2800
|
}
|
|
@@ -2787,23 +2813,23 @@ async function next() {
|
|
|
2787
2813
|
}
|
|
2788
2814
|
|
|
2789
2815
|
// src/commands/backlog/plan.ts
|
|
2790
|
-
import
|
|
2816
|
+
import chalk36 from "chalk";
|
|
2791
2817
|
function plan(id) {
|
|
2792
2818
|
const result = loadAndFindItem(id);
|
|
2793
2819
|
if (!result) return;
|
|
2794
2820
|
const { item } = result;
|
|
2795
2821
|
if (!item.plan || item.plan.length === 0) {
|
|
2796
|
-
console.log(
|
|
2822
|
+
console.log(chalk36.dim("No plan defined for this item."));
|
|
2797
2823
|
return;
|
|
2798
2824
|
}
|
|
2799
|
-
console.log(
|
|
2825
|
+
console.log(chalk36.bold(item.name));
|
|
2800
2826
|
console.log();
|
|
2801
2827
|
for (const [i, phase] of item.plan.entries()) {
|
|
2802
|
-
console.log(`${
|
|
2828
|
+
console.log(`${chalk36.bold(`Phase ${i + 1}:`)} ${phase.name}`);
|
|
2803
2829
|
for (const task of phase.tasks) {
|
|
2804
2830
|
console.log(` - ${task.task}`);
|
|
2805
2831
|
if (task.verify) {
|
|
2806
|
-
console.log(` ${
|
|
2832
|
+
console.log(` ${chalk36.dim(`verify: ${task.verify}`)}`);
|
|
2807
2833
|
}
|
|
2808
2834
|
}
|
|
2809
2835
|
console.log();
|
|
@@ -2811,11 +2837,11 @@ function plan(id) {
|
|
|
2811
2837
|
}
|
|
2812
2838
|
|
|
2813
2839
|
// src/commands/backlog/start/index.ts
|
|
2814
|
-
import
|
|
2840
|
+
import chalk37 from "chalk";
|
|
2815
2841
|
async function start(id) {
|
|
2816
2842
|
const name = setStatus(id, "in-progress");
|
|
2817
2843
|
if (name) {
|
|
2818
|
-
console.log(
|
|
2844
|
+
console.log(chalk37.green(`Started item #${id}: ${name}`));
|
|
2819
2845
|
}
|
|
2820
2846
|
}
|
|
2821
2847
|
|
|
@@ -2827,7 +2853,7 @@ import {
|
|
|
2827
2853
|
} from "http";
|
|
2828
2854
|
import { dirname as dirname13, join as join11 } from "path";
|
|
2829
2855
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2830
|
-
import
|
|
2856
|
+
import chalk38 from "chalk";
|
|
2831
2857
|
function respondJson(res, status2, data) {
|
|
2832
2858
|
res.writeHead(status2, { "Content-Type": "application/json" });
|
|
2833
2859
|
res.end(JSON.stringify(data));
|
|
@@ -2871,8 +2897,8 @@ function startWebServer(label2, port, handler) {
|
|
|
2871
2897
|
handler(req, res, port);
|
|
2872
2898
|
});
|
|
2873
2899
|
server.listen(port, () => {
|
|
2874
|
-
console.log(
|
|
2875
|
-
console.log(
|
|
2900
|
+
console.log(chalk38.green(`${label2}: ${url}`));
|
|
2901
|
+
console.log(chalk38.dim("Press Ctrl+C to stop"));
|
|
2876
2902
|
exec(`open ${url}`);
|
|
2877
2903
|
});
|
|
2878
2904
|
}
|
|
@@ -3391,11 +3417,11 @@ function assertCliExists(cli) {
|
|
|
3391
3417
|
}
|
|
3392
3418
|
|
|
3393
3419
|
// src/commands/permitCliReads/colorize.ts
|
|
3394
|
-
import
|
|
3420
|
+
import chalk39 from "chalk";
|
|
3395
3421
|
function colorize(plainOutput) {
|
|
3396
3422
|
return plainOutput.split("\n").map((line) => {
|
|
3397
|
-
if (line.startsWith(" R ")) return
|
|
3398
|
-
if (line.startsWith(" W ")) return
|
|
3423
|
+
if (line.startsWith(" R ")) return chalk39.green(line);
|
|
3424
|
+
if (line.startsWith(" W ")) return chalk39.red(line);
|
|
3399
3425
|
return line;
|
|
3400
3426
|
}).join("\n");
|
|
3401
3427
|
}
|
|
@@ -3709,15 +3735,15 @@ function registerCliHook(program2) {
|
|
|
3709
3735
|
}
|
|
3710
3736
|
|
|
3711
3737
|
// src/commands/complexity/analyze.ts
|
|
3712
|
-
import
|
|
3738
|
+
import chalk45 from "chalk";
|
|
3713
3739
|
|
|
3714
3740
|
// src/commands/complexity/cyclomatic.ts
|
|
3715
|
-
import
|
|
3741
|
+
import chalk41 from "chalk";
|
|
3716
3742
|
|
|
3717
3743
|
// src/commands/complexity/shared/index.ts
|
|
3718
3744
|
import fs12 from "fs";
|
|
3719
3745
|
import path20 from "path";
|
|
3720
|
-
import
|
|
3746
|
+
import chalk40 from "chalk";
|
|
3721
3747
|
import ts5 from "typescript";
|
|
3722
3748
|
|
|
3723
3749
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -3963,7 +3989,7 @@ function createSourceFromFile(filePath) {
|
|
|
3963
3989
|
function withSourceFiles(pattern2, callback) {
|
|
3964
3990
|
const files = findSourceFiles2(pattern2);
|
|
3965
3991
|
if (files.length === 0) {
|
|
3966
|
-
console.log(
|
|
3992
|
+
console.log(chalk40.yellow("No files found matching pattern"));
|
|
3967
3993
|
return void 0;
|
|
3968
3994
|
}
|
|
3969
3995
|
return callback(files);
|
|
@@ -3996,11 +4022,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
3996
4022
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
3997
4023
|
for (const { file, name, complexity } of results) {
|
|
3998
4024
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
3999
|
-
const color = exceedsThreshold ?
|
|
4000
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
4025
|
+
const color = exceedsThreshold ? chalk41.red : chalk41.white;
|
|
4026
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk41.cyan(complexity)}`);
|
|
4001
4027
|
}
|
|
4002
4028
|
console.log(
|
|
4003
|
-
|
|
4029
|
+
chalk41.dim(
|
|
4004
4030
|
`
|
|
4005
4031
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4006
4032
|
)
|
|
@@ -4012,7 +4038,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4012
4038
|
}
|
|
4013
4039
|
|
|
4014
4040
|
// src/commands/complexity/halstead.ts
|
|
4015
|
-
import
|
|
4041
|
+
import chalk42 from "chalk";
|
|
4016
4042
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
4017
4043
|
withSourceFiles(pattern2, (files) => {
|
|
4018
4044
|
const results = [];
|
|
@@ -4027,13 +4053,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4027
4053
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
4028
4054
|
for (const { file, name, metrics } of results) {
|
|
4029
4055
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
4030
|
-
const color = exceedsThreshold ?
|
|
4056
|
+
const color = exceedsThreshold ? chalk42.red : chalk42.white;
|
|
4031
4057
|
console.log(
|
|
4032
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
4058
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk42.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk42.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk42.magenta(metrics.effort.toFixed(1))}`
|
|
4033
4059
|
);
|
|
4034
4060
|
}
|
|
4035
4061
|
console.log(
|
|
4036
|
-
|
|
4062
|
+
chalk42.dim(
|
|
4037
4063
|
`
|
|
4038
4064
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
4039
4065
|
)
|
|
@@ -4048,28 +4074,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
4048
4074
|
import fs13 from "fs";
|
|
4049
4075
|
|
|
4050
4076
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
4051
|
-
import
|
|
4077
|
+
import chalk43 from "chalk";
|
|
4052
4078
|
function displayMaintainabilityResults(results, threshold) {
|
|
4053
4079
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
4054
4080
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
4055
|
-
console.log(
|
|
4081
|
+
console.log(chalk43.green("All files pass maintainability threshold"));
|
|
4056
4082
|
} else {
|
|
4057
4083
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
4058
|
-
const color = threshold !== void 0 ?
|
|
4084
|
+
const color = threshold !== void 0 ? chalk43.red : chalk43.white;
|
|
4059
4085
|
console.log(
|
|
4060
|
-
`${color(file)} \u2192 avg: ${
|
|
4086
|
+
`${color(file)} \u2192 avg: ${chalk43.cyan(avgMaintainability.toFixed(1))}, min: ${chalk43.yellow(minMaintainability.toFixed(1))}`
|
|
4061
4087
|
);
|
|
4062
4088
|
}
|
|
4063
4089
|
}
|
|
4064
|
-
console.log(
|
|
4090
|
+
console.log(chalk43.dim(`
|
|
4065
4091
|
Analyzed ${results.length} files`));
|
|
4066
4092
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
4067
4093
|
console.error(
|
|
4068
|
-
|
|
4094
|
+
chalk43.red(
|
|
4069
4095
|
`
|
|
4070
4096
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
4071
4097
|
|
|
4072
|
-
\u26A0\uFE0F ${
|
|
4098
|
+
\u26A0\uFE0F ${chalk43.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.`
|
|
4073
4099
|
)
|
|
4074
4100
|
);
|
|
4075
4101
|
process.exit(1);
|
|
@@ -4126,7 +4152,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4126
4152
|
|
|
4127
4153
|
// src/commands/complexity/sloc.ts
|
|
4128
4154
|
import fs14 from "fs";
|
|
4129
|
-
import
|
|
4155
|
+
import chalk44 from "chalk";
|
|
4130
4156
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
4131
4157
|
withSourceFiles(pattern2, (files) => {
|
|
4132
4158
|
const results = [];
|
|
@@ -4142,12 +4168,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
4142
4168
|
results.sort((a, b) => b.lines - a.lines);
|
|
4143
4169
|
for (const { file, lines } of results) {
|
|
4144
4170
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
4145
|
-
const color = exceedsThreshold ?
|
|
4146
|
-
console.log(`${color(file)} \u2192 ${
|
|
4171
|
+
const color = exceedsThreshold ? chalk44.red : chalk44.white;
|
|
4172
|
+
console.log(`${color(file)} \u2192 ${chalk44.cyan(lines)} lines`);
|
|
4147
4173
|
}
|
|
4148
4174
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
4149
4175
|
console.log(
|
|
4150
|
-
|
|
4176
|
+
chalk44.dim(`
|
|
4151
4177
|
Total: ${total} lines across ${files.length} files`)
|
|
4152
4178
|
);
|
|
4153
4179
|
if (hasViolation) {
|
|
@@ -4161,21 +4187,21 @@ async function analyze(pattern2) {
|
|
|
4161
4187
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
4162
4188
|
const files = findSourceFiles2(searchPattern);
|
|
4163
4189
|
if (files.length === 0) {
|
|
4164
|
-
console.log(
|
|
4190
|
+
console.log(chalk45.yellow("No files found matching pattern"));
|
|
4165
4191
|
return;
|
|
4166
4192
|
}
|
|
4167
4193
|
if (files.length === 1) {
|
|
4168
4194
|
const file = files[0];
|
|
4169
|
-
console.log(
|
|
4195
|
+
console.log(chalk45.bold.underline("SLOC"));
|
|
4170
4196
|
await sloc(file);
|
|
4171
4197
|
console.log();
|
|
4172
|
-
console.log(
|
|
4198
|
+
console.log(chalk45.bold.underline("Cyclomatic Complexity"));
|
|
4173
4199
|
await cyclomatic(file);
|
|
4174
4200
|
console.log();
|
|
4175
|
-
console.log(
|
|
4201
|
+
console.log(chalk45.bold.underline("Halstead Metrics"));
|
|
4176
4202
|
await halstead(file);
|
|
4177
4203
|
console.log();
|
|
4178
|
-
console.log(
|
|
4204
|
+
console.log(chalk45.bold.underline("Maintainability Index"));
|
|
4179
4205
|
await maintainability(file);
|
|
4180
4206
|
return;
|
|
4181
4207
|
}
|
|
@@ -4203,7 +4229,7 @@ function registerComplexity(program2) {
|
|
|
4203
4229
|
|
|
4204
4230
|
// src/commands/deploy/redirect.ts
|
|
4205
4231
|
import { existsSync as existsSync20, readFileSync as readFileSync16, writeFileSync as writeFileSync16 } from "fs";
|
|
4206
|
-
import
|
|
4232
|
+
import chalk46 from "chalk";
|
|
4207
4233
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
4208
4234
|
if (!window.location.pathname.endsWith('/')) {
|
|
4209
4235
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -4212,22 +4238,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
4212
4238
|
function redirect() {
|
|
4213
4239
|
const indexPath = "index.html";
|
|
4214
4240
|
if (!existsSync20(indexPath)) {
|
|
4215
|
-
console.log(
|
|
4241
|
+
console.log(chalk46.yellow("No index.html found"));
|
|
4216
4242
|
return;
|
|
4217
4243
|
}
|
|
4218
4244
|
const content = readFileSync16(indexPath, "utf-8");
|
|
4219
4245
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
4220
|
-
console.log(
|
|
4246
|
+
console.log(chalk46.dim("Trailing slash script already present"));
|
|
4221
4247
|
return;
|
|
4222
4248
|
}
|
|
4223
4249
|
const headCloseIndex = content.indexOf("</head>");
|
|
4224
4250
|
if (headCloseIndex === -1) {
|
|
4225
|
-
console.log(
|
|
4251
|
+
console.log(chalk46.red("Could not find </head> tag in index.html"));
|
|
4226
4252
|
return;
|
|
4227
4253
|
}
|
|
4228
4254
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
4229
4255
|
writeFileSync16(indexPath, newContent);
|
|
4230
|
-
console.log(
|
|
4256
|
+
console.log(chalk46.green("Added trailing slash redirect to index.html"));
|
|
4231
4257
|
}
|
|
4232
4258
|
|
|
4233
4259
|
// src/commands/registerDeploy.ts
|
|
@@ -4254,7 +4280,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
4254
4280
|
|
|
4255
4281
|
// src/commands/devlog/shared.ts
|
|
4256
4282
|
import { execSync as execSync15 } from "child_process";
|
|
4257
|
-
import
|
|
4283
|
+
import chalk47 from "chalk";
|
|
4258
4284
|
|
|
4259
4285
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
4260
4286
|
import { readdirSync, readFileSync as readFileSync17 } from "fs";
|
|
@@ -4341,13 +4367,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
4341
4367
|
}
|
|
4342
4368
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
4343
4369
|
for (const commit2 of commits) {
|
|
4344
|
-
console.log(` ${
|
|
4370
|
+
console.log(` ${chalk47.yellow(commit2.hash)} ${commit2.message}`);
|
|
4345
4371
|
if (verbose) {
|
|
4346
4372
|
const visibleFiles = commit2.files.filter(
|
|
4347
4373
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
4348
4374
|
);
|
|
4349
4375
|
for (const file of visibleFiles) {
|
|
4350
|
-
console.log(` ${
|
|
4376
|
+
console.log(` ${chalk47.dim(file)}`);
|
|
4351
4377
|
}
|
|
4352
4378
|
}
|
|
4353
4379
|
}
|
|
@@ -4372,15 +4398,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
4372
4398
|
}
|
|
4373
4399
|
|
|
4374
4400
|
// src/commands/devlog/list/printDateHeader.ts
|
|
4375
|
-
import
|
|
4401
|
+
import chalk48 from "chalk";
|
|
4376
4402
|
function printDateHeader(date, isSkipped, entries) {
|
|
4377
4403
|
if (isSkipped) {
|
|
4378
|
-
console.log(`${
|
|
4404
|
+
console.log(`${chalk48.bold.blue(date)} ${chalk48.dim("skipped")}`);
|
|
4379
4405
|
} else if (entries && entries.length > 0) {
|
|
4380
|
-
const entryInfo = entries.map((e) => `${
|
|
4381
|
-
console.log(`${
|
|
4406
|
+
const entryInfo = entries.map((e) => `${chalk48.green(e.version)} ${e.title}`).join(" | ");
|
|
4407
|
+
console.log(`${chalk48.bold.blue(date)} ${entryInfo}`);
|
|
4382
4408
|
} else {
|
|
4383
|
-
console.log(`${
|
|
4409
|
+
console.log(`${chalk48.bold.blue(date)} ${chalk48.red("\u26A0 devlog missing")}`);
|
|
4384
4410
|
}
|
|
4385
4411
|
}
|
|
4386
4412
|
|
|
@@ -4483,24 +4509,24 @@ function bumpVersion(version2, type) {
|
|
|
4483
4509
|
|
|
4484
4510
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
4485
4511
|
import { execSync as execSync18 } from "child_process";
|
|
4486
|
-
import
|
|
4512
|
+
import chalk50 from "chalk";
|
|
4487
4513
|
|
|
4488
4514
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
4489
|
-
import
|
|
4515
|
+
import chalk49 from "chalk";
|
|
4490
4516
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
4491
4517
|
if (conventional && firstHash) {
|
|
4492
4518
|
const version2 = getVersionAtCommit(firstHash);
|
|
4493
4519
|
if (version2) {
|
|
4494
|
-
console.log(`${
|
|
4520
|
+
console.log(`${chalk49.bold("version:")} ${stripToMinor(version2)}`);
|
|
4495
4521
|
} else {
|
|
4496
|
-
console.log(`${
|
|
4522
|
+
console.log(`${chalk49.bold("version:")} ${chalk49.red("unknown")}`);
|
|
4497
4523
|
}
|
|
4498
4524
|
} else if (patchVersion && minorVersion) {
|
|
4499
4525
|
console.log(
|
|
4500
|
-
`${
|
|
4526
|
+
`${chalk49.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
4501
4527
|
);
|
|
4502
4528
|
} else {
|
|
4503
|
-
console.log(`${
|
|
4529
|
+
console.log(`${chalk49.bold("version:")} v0.1 (initial)`);
|
|
4504
4530
|
}
|
|
4505
4531
|
}
|
|
4506
4532
|
|
|
@@ -4547,16 +4573,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
4547
4573
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
4548
4574
|
}
|
|
4549
4575
|
function logName(repoName) {
|
|
4550
|
-
console.log(`${
|
|
4576
|
+
console.log(`${chalk50.bold("name:")} ${repoName}`);
|
|
4551
4577
|
}
|
|
4552
4578
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
4553
4579
|
logName(ctx.repoName);
|
|
4554
4580
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
4555
|
-
console.log(
|
|
4581
|
+
console.log(chalk50.bold.blue(targetDate));
|
|
4556
4582
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
4557
4583
|
}
|
|
4558
4584
|
function logNoCommits(lastInfo) {
|
|
4559
|
-
console.log(
|
|
4585
|
+
console.log(chalk50.dim(noCommitsMessage(!!lastInfo)));
|
|
4560
4586
|
}
|
|
4561
4587
|
|
|
4562
4588
|
// src/commands/devlog/next/index.ts
|
|
@@ -4597,11 +4623,11 @@ function next2(options2) {
|
|
|
4597
4623
|
import { execSync as execSync19 } from "child_process";
|
|
4598
4624
|
|
|
4599
4625
|
// src/commands/devlog/repos/printReposTable.ts
|
|
4600
|
-
import
|
|
4626
|
+
import chalk51 from "chalk";
|
|
4601
4627
|
function colorStatus(status2) {
|
|
4602
|
-
if (status2 === "missing") return
|
|
4603
|
-
if (status2 === "outdated") return
|
|
4604
|
-
return
|
|
4628
|
+
if (status2 === "missing") return chalk51.red(status2);
|
|
4629
|
+
if (status2 === "outdated") return chalk51.yellow(status2);
|
|
4630
|
+
return chalk51.green(status2);
|
|
4605
4631
|
}
|
|
4606
4632
|
function formatRow(row, nameWidth) {
|
|
4607
4633
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -4615,8 +4641,8 @@ function printReposTable(rows) {
|
|
|
4615
4641
|
"Last Devlog".padEnd(11),
|
|
4616
4642
|
"Status"
|
|
4617
4643
|
].join(" ");
|
|
4618
|
-
console.log(
|
|
4619
|
-
console.log(
|
|
4644
|
+
console.log(chalk51.dim(header));
|
|
4645
|
+
console.log(chalk51.dim("-".repeat(header.length)));
|
|
4620
4646
|
for (const row of rows) {
|
|
4621
4647
|
console.log(formatRow(row, nameWidth));
|
|
4622
4648
|
}
|
|
@@ -4674,14 +4700,14 @@ function repos(options2) {
|
|
|
4674
4700
|
// src/commands/devlog/skip.ts
|
|
4675
4701
|
import { writeFileSync as writeFileSync17 } from "fs";
|
|
4676
4702
|
import { join as join16 } from "path";
|
|
4677
|
-
import
|
|
4703
|
+
import chalk52 from "chalk";
|
|
4678
4704
|
import { stringify as stringifyYaml4 } from "yaml";
|
|
4679
4705
|
function getBlogConfigPath() {
|
|
4680
4706
|
return join16(BLOG_REPO_ROOT, "assist.yml");
|
|
4681
4707
|
}
|
|
4682
4708
|
function skip(date) {
|
|
4683
4709
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
4684
|
-
console.log(
|
|
4710
|
+
console.log(chalk52.red("Invalid date format. Use YYYY-MM-DD"));
|
|
4685
4711
|
process.exit(1);
|
|
4686
4712
|
}
|
|
4687
4713
|
const repoName = getRepoName();
|
|
@@ -4692,7 +4718,7 @@ function skip(date) {
|
|
|
4692
4718
|
const skipDays = skip2[repoName] ?? [];
|
|
4693
4719
|
if (skipDays.includes(date)) {
|
|
4694
4720
|
console.log(
|
|
4695
|
-
|
|
4721
|
+
chalk52.yellow(`${date} is already in skip list for ${repoName}`)
|
|
4696
4722
|
);
|
|
4697
4723
|
return;
|
|
4698
4724
|
}
|
|
@@ -4702,20 +4728,20 @@ function skip(date) {
|
|
|
4702
4728
|
devlog.skip = skip2;
|
|
4703
4729
|
config.devlog = devlog;
|
|
4704
4730
|
writeFileSync17(configPath, stringifyYaml4(config, { lineWidth: 0 }));
|
|
4705
|
-
console.log(
|
|
4731
|
+
console.log(chalk52.green(`Added ${date} to skip list for ${repoName}`));
|
|
4706
4732
|
}
|
|
4707
4733
|
|
|
4708
4734
|
// src/commands/devlog/version.ts
|
|
4709
|
-
import
|
|
4735
|
+
import chalk53 from "chalk";
|
|
4710
4736
|
function version() {
|
|
4711
4737
|
const config = loadConfig();
|
|
4712
4738
|
const name = getRepoName();
|
|
4713
4739
|
const lastInfo = getLastVersionInfo(name, config);
|
|
4714
4740
|
const lastVersion = lastInfo?.version ?? null;
|
|
4715
4741
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
4716
|
-
console.log(`${
|
|
4717
|
-
console.log(`${
|
|
4718
|
-
console.log(`${
|
|
4742
|
+
console.log(`${chalk53.bold("name:")} ${name}`);
|
|
4743
|
+
console.log(`${chalk53.bold("last:")} ${lastVersion ?? chalk53.dim("none")}`);
|
|
4744
|
+
console.log(`${chalk53.bold("next:")} ${nextVersion ?? chalk53.dim("none")}`);
|
|
4719
4745
|
}
|
|
4720
4746
|
|
|
4721
4747
|
// src/commands/registerDevlog.ts
|
|
@@ -4739,7 +4765,7 @@ function registerDevlog(program2) {
|
|
|
4739
4765
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
4740
4766
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
4741
4767
|
import { join as join17 } from "path";
|
|
4742
|
-
import
|
|
4768
|
+
import chalk54 from "chalk";
|
|
4743
4769
|
|
|
4744
4770
|
// src/shared/findRepoRoot.ts
|
|
4745
4771
|
import { existsSync as existsSync21 } from "fs";
|
|
@@ -4802,14 +4828,14 @@ function checkBuildLocks(startDir) {
|
|
|
4802
4828
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
4803
4829
|
if (locked) {
|
|
4804
4830
|
console.error(
|
|
4805
|
-
|
|
4831
|
+
chalk54.red("Build output locked (is VS debugging?): ") + locked
|
|
4806
4832
|
);
|
|
4807
4833
|
process.exit(1);
|
|
4808
4834
|
}
|
|
4809
4835
|
}
|
|
4810
4836
|
async function checkBuildLocksCommand() {
|
|
4811
4837
|
checkBuildLocks();
|
|
4812
|
-
console.log(
|
|
4838
|
+
console.log(chalk54.green("No build locks detected"));
|
|
4813
4839
|
}
|
|
4814
4840
|
|
|
4815
4841
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -4908,30 +4934,30 @@ function escapeRegex(s) {
|
|
|
4908
4934
|
}
|
|
4909
4935
|
|
|
4910
4936
|
// src/commands/dotnet/printTree.ts
|
|
4911
|
-
import
|
|
4937
|
+
import chalk55 from "chalk";
|
|
4912
4938
|
function printNodes(nodes, prefix2) {
|
|
4913
4939
|
for (let i = 0; i < nodes.length; i++) {
|
|
4914
4940
|
const isLast = i === nodes.length - 1;
|
|
4915
4941
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
4916
4942
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
4917
4943
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
4918
|
-
const label2 = isMissing ?
|
|
4944
|
+
const label2 = isMissing ? chalk55.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
4919
4945
|
console.log(`${prefix2}${connector}${label2}`);
|
|
4920
4946
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
4921
4947
|
}
|
|
4922
4948
|
}
|
|
4923
4949
|
function printTree(tree, totalCount, solutions) {
|
|
4924
|
-
console.log(
|
|
4925
|
-
console.log(
|
|
4950
|
+
console.log(chalk55.bold("\nProject Dependency Tree"));
|
|
4951
|
+
console.log(chalk55.cyan(tree.relativePath));
|
|
4926
4952
|
printNodes(tree.children, "");
|
|
4927
|
-
console.log(
|
|
4953
|
+
console.log(chalk55.dim(`
|
|
4928
4954
|
${totalCount} projects total (including root)`));
|
|
4929
|
-
console.log(
|
|
4955
|
+
console.log(chalk55.bold("\nSolution Membership"));
|
|
4930
4956
|
if (solutions.length === 0) {
|
|
4931
|
-
console.log(
|
|
4957
|
+
console.log(chalk55.yellow(" Not found in any .sln"));
|
|
4932
4958
|
} else {
|
|
4933
4959
|
for (const sln of solutions) {
|
|
4934
|
-
console.log(` ${
|
|
4960
|
+
console.log(` ${chalk55.green(sln)}`);
|
|
4935
4961
|
}
|
|
4936
4962
|
}
|
|
4937
4963
|
console.log();
|
|
@@ -4960,16 +4986,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
4960
4986
|
// src/commands/dotnet/resolveCsproj.ts
|
|
4961
4987
|
import { existsSync as existsSync22 } from "fs";
|
|
4962
4988
|
import path24 from "path";
|
|
4963
|
-
import
|
|
4989
|
+
import chalk56 from "chalk";
|
|
4964
4990
|
function resolveCsproj(csprojPath) {
|
|
4965
4991
|
const resolved = path24.resolve(csprojPath);
|
|
4966
4992
|
if (!existsSync22(resolved)) {
|
|
4967
|
-
console.error(
|
|
4993
|
+
console.error(chalk56.red(`File not found: ${resolved}`));
|
|
4968
4994
|
process.exit(1);
|
|
4969
4995
|
}
|
|
4970
4996
|
const repoRoot = findRepoRoot(path24.dirname(resolved));
|
|
4971
4997
|
if (!repoRoot) {
|
|
4972
|
-
console.error(
|
|
4998
|
+
console.error(chalk56.red("Could not find git repository root"));
|
|
4973
4999
|
process.exit(1);
|
|
4974
5000
|
}
|
|
4975
5001
|
return { resolved, repoRoot };
|
|
@@ -5019,12 +5045,12 @@ function getChangedCsFiles(scope) {
|
|
|
5019
5045
|
}
|
|
5020
5046
|
|
|
5021
5047
|
// src/commands/dotnet/inSln.ts
|
|
5022
|
-
import
|
|
5048
|
+
import chalk57 from "chalk";
|
|
5023
5049
|
async function inSln(csprojPath) {
|
|
5024
5050
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
5025
5051
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
5026
5052
|
if (solutions.length === 0) {
|
|
5027
|
-
console.log(
|
|
5053
|
+
console.log(chalk57.yellow("Not found in any .sln file"));
|
|
5028
5054
|
process.exit(1);
|
|
5029
5055
|
}
|
|
5030
5056
|
for (const sln of solutions) {
|
|
@@ -5033,7 +5059,7 @@ async function inSln(csprojPath) {
|
|
|
5033
5059
|
}
|
|
5034
5060
|
|
|
5035
5061
|
// src/commands/dotnet/inspect.ts
|
|
5036
|
-
import
|
|
5062
|
+
import chalk63 from "chalk";
|
|
5037
5063
|
|
|
5038
5064
|
// src/shared/formatElapsed.ts
|
|
5039
5065
|
function formatElapsed(ms) {
|
|
@@ -5045,12 +5071,12 @@ function formatElapsed(ms) {
|
|
|
5045
5071
|
}
|
|
5046
5072
|
|
|
5047
5073
|
// src/commands/dotnet/displayIssues.ts
|
|
5048
|
-
import
|
|
5074
|
+
import chalk58 from "chalk";
|
|
5049
5075
|
var SEVERITY_COLOR = {
|
|
5050
|
-
ERROR:
|
|
5051
|
-
WARNING:
|
|
5052
|
-
SUGGESTION:
|
|
5053
|
-
HINT:
|
|
5076
|
+
ERROR: chalk58.red,
|
|
5077
|
+
WARNING: chalk58.yellow,
|
|
5078
|
+
SUGGESTION: chalk58.cyan,
|
|
5079
|
+
HINT: chalk58.dim
|
|
5054
5080
|
};
|
|
5055
5081
|
function groupByFile(issues) {
|
|
5056
5082
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -5066,15 +5092,15 @@ function groupByFile(issues) {
|
|
|
5066
5092
|
}
|
|
5067
5093
|
function displayIssues(issues) {
|
|
5068
5094
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
5069
|
-
console.log(
|
|
5095
|
+
console.log(chalk58.bold(file));
|
|
5070
5096
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
5071
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
5097
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk58.white;
|
|
5072
5098
|
console.log(
|
|
5073
|
-
` ${
|
|
5099
|
+
` ${chalk58.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
5074
5100
|
);
|
|
5075
5101
|
}
|
|
5076
5102
|
}
|
|
5077
|
-
console.log(
|
|
5103
|
+
console.log(chalk58.dim(`
|
|
5078
5104
|
${issues.length} issue(s) found`));
|
|
5079
5105
|
}
|
|
5080
5106
|
|
|
@@ -5133,12 +5159,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
5133
5159
|
// src/commands/dotnet/resolveSolution.ts
|
|
5134
5160
|
import { existsSync as existsSync23 } from "fs";
|
|
5135
5161
|
import path25 from "path";
|
|
5136
|
-
import
|
|
5162
|
+
import chalk60 from "chalk";
|
|
5137
5163
|
|
|
5138
5164
|
// src/commands/dotnet/findSolution.ts
|
|
5139
5165
|
import { readdirSync as readdirSync4 } from "fs";
|
|
5140
5166
|
import { dirname as dirname16, join as join18 } from "path";
|
|
5141
|
-
import
|
|
5167
|
+
import chalk59 from "chalk";
|
|
5142
5168
|
function findSlnInDir(dir) {
|
|
5143
5169
|
try {
|
|
5144
5170
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join18(dir, f));
|
|
@@ -5154,17 +5180,17 @@ function findSolution() {
|
|
|
5154
5180
|
const slnFiles = findSlnInDir(current);
|
|
5155
5181
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
5156
5182
|
if (slnFiles.length > 1) {
|
|
5157
|
-
console.error(
|
|
5183
|
+
console.error(chalk59.red(`Multiple .sln files found in ${current}:`));
|
|
5158
5184
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
5159
5185
|
console.error(
|
|
5160
|
-
|
|
5186
|
+
chalk59.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
5161
5187
|
);
|
|
5162
5188
|
process.exit(1);
|
|
5163
5189
|
}
|
|
5164
5190
|
if (current === ceiling) break;
|
|
5165
5191
|
current = dirname16(current);
|
|
5166
5192
|
}
|
|
5167
|
-
console.error(
|
|
5193
|
+
console.error(chalk59.red("No .sln file found between cwd and repo root"));
|
|
5168
5194
|
process.exit(1);
|
|
5169
5195
|
}
|
|
5170
5196
|
|
|
@@ -5173,7 +5199,7 @@ function resolveSolution(sln) {
|
|
|
5173
5199
|
if (sln) {
|
|
5174
5200
|
const resolved = path25.resolve(sln);
|
|
5175
5201
|
if (!existsSync23(resolved)) {
|
|
5176
|
-
console.error(
|
|
5202
|
+
console.error(chalk60.red(`Solution file not found: ${resolved}`));
|
|
5177
5203
|
process.exit(1);
|
|
5178
5204
|
}
|
|
5179
5205
|
return resolved;
|
|
@@ -5215,14 +5241,14 @@ import { execSync as execSync21 } from "child_process";
|
|
|
5215
5241
|
import { existsSync as existsSync24, readFileSync as readFileSync20, unlinkSync as unlinkSync4 } from "fs";
|
|
5216
5242
|
import { tmpdir as tmpdir2 } from "os";
|
|
5217
5243
|
import path26 from "path";
|
|
5218
|
-
import
|
|
5244
|
+
import chalk61 from "chalk";
|
|
5219
5245
|
function assertJbInstalled() {
|
|
5220
5246
|
try {
|
|
5221
5247
|
execSync21("jb inspectcode --version", { stdio: "pipe" });
|
|
5222
5248
|
} catch {
|
|
5223
|
-
console.error(
|
|
5249
|
+
console.error(chalk61.red("jb is not installed. Install with:"));
|
|
5224
5250
|
console.error(
|
|
5225
|
-
|
|
5251
|
+
chalk61.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
5226
5252
|
);
|
|
5227
5253
|
process.exit(1);
|
|
5228
5254
|
}
|
|
@@ -5240,11 +5266,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5240
5266
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
5241
5267
|
process.stderr.write(err.stderr);
|
|
5242
5268
|
}
|
|
5243
|
-
console.error(
|
|
5269
|
+
console.error(chalk61.red("jb inspectcode failed"));
|
|
5244
5270
|
process.exit(1);
|
|
5245
5271
|
}
|
|
5246
5272
|
if (!existsSync24(reportPath)) {
|
|
5247
|
-
console.error(
|
|
5273
|
+
console.error(chalk61.red("Report file not generated"));
|
|
5248
5274
|
process.exit(1);
|
|
5249
5275
|
}
|
|
5250
5276
|
const xml = readFileSync20(reportPath, "utf-8");
|
|
@@ -5254,7 +5280,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
5254
5280
|
|
|
5255
5281
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
5256
5282
|
import { execSync as execSync22 } from "child_process";
|
|
5257
|
-
import
|
|
5283
|
+
import chalk62 from "chalk";
|
|
5258
5284
|
function resolveMsbuildPath() {
|
|
5259
5285
|
const config = loadConfig();
|
|
5260
5286
|
const buildConfig = config.run?.find((r) => r.name === "build");
|
|
@@ -5265,9 +5291,9 @@ function assertMsbuildInstalled() {
|
|
|
5265
5291
|
try {
|
|
5266
5292
|
execSync22(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
5267
5293
|
} catch {
|
|
5268
|
-
console.error(
|
|
5294
|
+
console.error(chalk62.red(`msbuild not found at: ${msbuild}`));
|
|
5269
5295
|
console.error(
|
|
5270
|
-
|
|
5296
|
+
chalk62.yellow(
|
|
5271
5297
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
5272
5298
|
)
|
|
5273
5299
|
);
|
|
@@ -5314,17 +5340,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
5314
5340
|
// src/commands/dotnet/inspect.ts
|
|
5315
5341
|
function logScope(changedFiles) {
|
|
5316
5342
|
if (changedFiles === null) {
|
|
5317
|
-
console.log(
|
|
5343
|
+
console.log(chalk63.dim("Inspecting full solution..."));
|
|
5318
5344
|
} else {
|
|
5319
5345
|
console.log(
|
|
5320
|
-
|
|
5346
|
+
chalk63.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
5321
5347
|
);
|
|
5322
5348
|
}
|
|
5323
5349
|
}
|
|
5324
5350
|
function reportResults(issues, elapsed) {
|
|
5325
5351
|
if (issues.length > 0) displayIssues(issues);
|
|
5326
|
-
else console.log(
|
|
5327
|
-
console.log(
|
|
5352
|
+
else console.log(chalk63.green("No issues found"));
|
|
5353
|
+
console.log(chalk63.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
5328
5354
|
if (issues.length > 0) process.exit(1);
|
|
5329
5355
|
}
|
|
5330
5356
|
async function inspect(sln, options2) {
|
|
@@ -5335,7 +5361,7 @@ async function inspect(sln, options2) {
|
|
|
5335
5361
|
const scope = parseScope(options2.scope);
|
|
5336
5362
|
const changedFiles = getChangedCsFiles(scope);
|
|
5337
5363
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
5338
|
-
console.log(
|
|
5364
|
+
console.log(chalk63.green("No changed .cs files found"));
|
|
5339
5365
|
return;
|
|
5340
5366
|
}
|
|
5341
5367
|
logScope(changedFiles);
|
|
@@ -5361,7 +5387,7 @@ function registerDotnet(program2) {
|
|
|
5361
5387
|
}
|
|
5362
5388
|
|
|
5363
5389
|
// src/commands/jira/acceptanceCriteria.ts
|
|
5364
|
-
import
|
|
5390
|
+
import chalk65 from "chalk";
|
|
5365
5391
|
|
|
5366
5392
|
// src/commands/jira/adfToText.ts
|
|
5367
5393
|
function renderInline(node) {
|
|
@@ -5422,7 +5448,7 @@ function adfToText(doc) {
|
|
|
5422
5448
|
|
|
5423
5449
|
// src/commands/jira/fetchIssue.ts
|
|
5424
5450
|
import { execSync as execSync23 } from "child_process";
|
|
5425
|
-
import
|
|
5451
|
+
import chalk64 from "chalk";
|
|
5426
5452
|
function fetchIssue(issueKey, fields) {
|
|
5427
5453
|
let result;
|
|
5428
5454
|
try {
|
|
@@ -5435,15 +5461,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
5435
5461
|
const stderr = error.stderr;
|
|
5436
5462
|
if (stderr.includes("unauthorized")) {
|
|
5437
5463
|
console.error(
|
|
5438
|
-
|
|
5464
|
+
chalk64.red("Jira authentication expired."),
|
|
5439
5465
|
"Run",
|
|
5440
|
-
|
|
5466
|
+
chalk64.cyan("assist jira auth"),
|
|
5441
5467
|
"to re-authenticate."
|
|
5442
5468
|
);
|
|
5443
5469
|
process.exit(1);
|
|
5444
5470
|
}
|
|
5445
5471
|
}
|
|
5446
|
-
console.error(
|
|
5472
|
+
console.error(chalk64.red(`Failed to fetch ${issueKey}.`));
|
|
5447
5473
|
process.exit(1);
|
|
5448
5474
|
}
|
|
5449
5475
|
return JSON.parse(result);
|
|
@@ -5457,7 +5483,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
5457
5483
|
const parsed = fetchIssue(issueKey, field);
|
|
5458
5484
|
const acValue = parsed?.fields?.[field];
|
|
5459
5485
|
if (!acValue) {
|
|
5460
|
-
console.log(
|
|
5486
|
+
console.log(chalk65.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
5461
5487
|
return;
|
|
5462
5488
|
}
|
|
5463
5489
|
if (typeof acValue === "string") {
|
|
@@ -5552,14 +5578,14 @@ async function jiraAuth() {
|
|
|
5552
5578
|
}
|
|
5553
5579
|
|
|
5554
5580
|
// src/commands/jira/viewIssue.ts
|
|
5555
|
-
import
|
|
5581
|
+
import chalk66 from "chalk";
|
|
5556
5582
|
function viewIssue(issueKey) {
|
|
5557
5583
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
5558
5584
|
const fields = parsed?.fields;
|
|
5559
5585
|
const summary = fields?.summary;
|
|
5560
5586
|
const description = fields?.description;
|
|
5561
5587
|
if (summary) {
|
|
5562
|
-
console.log(
|
|
5588
|
+
console.log(chalk66.bold(summary));
|
|
5563
5589
|
}
|
|
5564
5590
|
if (description) {
|
|
5565
5591
|
if (summary) console.log();
|
|
@@ -5573,7 +5599,7 @@ function viewIssue(issueKey) {
|
|
|
5573
5599
|
}
|
|
5574
5600
|
if (!summary && !description) {
|
|
5575
5601
|
console.log(
|
|
5576
|
-
|
|
5602
|
+
chalk66.yellow(`No summary or description found on ${issueKey}.`)
|
|
5577
5603
|
);
|
|
5578
5604
|
}
|
|
5579
5605
|
}
|
|
@@ -5587,7 +5613,7 @@ function registerJira(program2) {
|
|
|
5587
5613
|
}
|
|
5588
5614
|
|
|
5589
5615
|
// src/commands/news/add/index.ts
|
|
5590
|
-
import
|
|
5616
|
+
import chalk67 from "chalk";
|
|
5591
5617
|
import enquirer7 from "enquirer";
|
|
5592
5618
|
async function add2(url) {
|
|
5593
5619
|
if (!url) {
|
|
@@ -5610,17 +5636,17 @@ async function add2(url) {
|
|
|
5610
5636
|
const news = config.news ?? {};
|
|
5611
5637
|
const feeds = news.feeds ?? [];
|
|
5612
5638
|
if (feeds.includes(url)) {
|
|
5613
|
-
console.log(
|
|
5639
|
+
console.log(chalk67.yellow("Feed already exists in config"));
|
|
5614
5640
|
return;
|
|
5615
5641
|
}
|
|
5616
5642
|
feeds.push(url);
|
|
5617
5643
|
config.news = { ...news, feeds };
|
|
5618
5644
|
saveGlobalConfig(config);
|
|
5619
|
-
console.log(
|
|
5645
|
+
console.log(chalk67.green(`Added feed: ${url}`));
|
|
5620
5646
|
}
|
|
5621
5647
|
|
|
5622
5648
|
// src/commands/news/web/handleRequest.ts
|
|
5623
|
-
import
|
|
5649
|
+
import chalk68 from "chalk";
|
|
5624
5650
|
|
|
5625
5651
|
// src/commands/news/web/shared.ts
|
|
5626
5652
|
import { decodeHTML } from "entities";
|
|
@@ -5756,17 +5782,17 @@ function prefetch() {
|
|
|
5756
5782
|
const config = loadConfig();
|
|
5757
5783
|
const total = config.news.feeds.length;
|
|
5758
5784
|
if (total === 0) return;
|
|
5759
|
-
process.stdout.write(
|
|
5785
|
+
process.stdout.write(chalk68.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
5760
5786
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
5761
5787
|
const width = 20;
|
|
5762
5788
|
const filled = Math.round(done2 / t * width);
|
|
5763
5789
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
5764
5790
|
process.stdout.write(
|
|
5765
|
-
`\r${
|
|
5791
|
+
`\r${chalk68.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
5766
5792
|
);
|
|
5767
5793
|
}).then((items) => {
|
|
5768
5794
|
process.stdout.write(
|
|
5769
|
-
`\r${
|
|
5795
|
+
`\r${chalk68.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
5770
5796
|
`
|
|
5771
5797
|
);
|
|
5772
5798
|
cachedItems = items;
|
|
@@ -6127,20 +6153,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
6127
6153
|
}
|
|
6128
6154
|
|
|
6129
6155
|
// src/commands/prs/listComments/printComments.ts
|
|
6130
|
-
import
|
|
6156
|
+
import chalk69 from "chalk";
|
|
6131
6157
|
function formatForHuman(comment2) {
|
|
6132
6158
|
if (comment2.type === "review") {
|
|
6133
|
-
const stateColor = comment2.state === "APPROVED" ?
|
|
6159
|
+
const stateColor = comment2.state === "APPROVED" ? chalk69.green : comment2.state === "CHANGES_REQUESTED" ? chalk69.red : chalk69.yellow;
|
|
6134
6160
|
return [
|
|
6135
|
-
`${
|
|
6161
|
+
`${chalk69.cyan("Review")} by ${chalk69.bold(comment2.user)} ${stateColor(`[${comment2.state}]`)}`,
|
|
6136
6162
|
comment2.body,
|
|
6137
6163
|
""
|
|
6138
6164
|
].join("\n");
|
|
6139
6165
|
}
|
|
6140
6166
|
const location = comment2.line ? `:${comment2.line}` : "";
|
|
6141
6167
|
return [
|
|
6142
|
-
`${
|
|
6143
|
-
|
|
6168
|
+
`${chalk69.cyan("Line comment")} by ${chalk69.bold(comment2.user)} on ${chalk69.dim(`${comment2.path}${location}`)}`,
|
|
6169
|
+
chalk69.dim(comment2.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
6144
6170
|
comment2.body,
|
|
6145
6171
|
""
|
|
6146
6172
|
].join("\n");
|
|
@@ -6230,13 +6256,13 @@ import { execSync as execSync30 } from "child_process";
|
|
|
6230
6256
|
import enquirer8 from "enquirer";
|
|
6231
6257
|
|
|
6232
6258
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
6233
|
-
import
|
|
6259
|
+
import chalk70 from "chalk";
|
|
6234
6260
|
var STATUS_MAP = {
|
|
6235
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
6236
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
6261
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk70.magenta("merged"), date: pr.mergedAt } : null,
|
|
6262
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk70.red("closed"), date: pr.closedAt } : null
|
|
6237
6263
|
};
|
|
6238
6264
|
function defaultStatus(pr) {
|
|
6239
|
-
return { label:
|
|
6265
|
+
return { label: chalk70.green("opened"), date: pr.createdAt };
|
|
6240
6266
|
}
|
|
6241
6267
|
function getStatus2(pr) {
|
|
6242
6268
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -6245,11 +6271,11 @@ function formatDate(dateStr) {
|
|
|
6245
6271
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
6246
6272
|
}
|
|
6247
6273
|
function formatPrHeader(pr, status2) {
|
|
6248
|
-
return `${
|
|
6274
|
+
return `${chalk70.cyan(`#${pr.number}`)} ${pr.title} ${chalk70.dim(`(${pr.author.login},`)} ${status2.label} ${chalk70.dim(`${formatDate(status2.date)})`)}`;
|
|
6249
6275
|
}
|
|
6250
6276
|
function logPrDetails(pr) {
|
|
6251
6277
|
console.log(
|
|
6252
|
-
|
|
6278
|
+
chalk70.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
6253
6279
|
);
|
|
6254
6280
|
console.log();
|
|
6255
6281
|
}
|
|
@@ -6415,10 +6441,10 @@ function registerPrs(program2) {
|
|
|
6415
6441
|
}
|
|
6416
6442
|
|
|
6417
6443
|
// src/commands/ravendb/ravendbAuth.ts
|
|
6418
|
-
import
|
|
6444
|
+
import chalk76 from "chalk";
|
|
6419
6445
|
|
|
6420
6446
|
// src/shared/createConnectionAuth.ts
|
|
6421
|
-
import
|
|
6447
|
+
import chalk71 from "chalk";
|
|
6422
6448
|
function listConnections(connections, format2) {
|
|
6423
6449
|
if (connections.length === 0) {
|
|
6424
6450
|
console.log("No connections configured.");
|
|
@@ -6431,7 +6457,7 @@ function listConnections(connections, format2) {
|
|
|
6431
6457
|
function removeConnection(connections, name, save) {
|
|
6432
6458
|
const filtered = connections.filter((c) => c.name !== name);
|
|
6433
6459
|
if (filtered.length === connections.length) {
|
|
6434
|
-
console.error(
|
|
6460
|
+
console.error(chalk71.red(`Connection "${name}" not found.`));
|
|
6435
6461
|
process.exit(1);
|
|
6436
6462
|
}
|
|
6437
6463
|
save(filtered);
|
|
@@ -6477,15 +6503,15 @@ function saveConnections(connections) {
|
|
|
6477
6503
|
}
|
|
6478
6504
|
|
|
6479
6505
|
// src/commands/ravendb/promptConnection.ts
|
|
6480
|
-
import
|
|
6506
|
+
import chalk74 from "chalk";
|
|
6481
6507
|
|
|
6482
6508
|
// src/commands/ravendb/selectOpSecret.ts
|
|
6483
|
-
import
|
|
6509
|
+
import chalk73 from "chalk";
|
|
6484
6510
|
import Enquirer2 from "enquirer";
|
|
6485
6511
|
|
|
6486
6512
|
// src/commands/ravendb/searchItems.ts
|
|
6487
6513
|
import { execSync as execSync32 } from "child_process";
|
|
6488
|
-
import
|
|
6514
|
+
import chalk72 from "chalk";
|
|
6489
6515
|
function opExec(args) {
|
|
6490
6516
|
return execSync32(`op ${args}`, {
|
|
6491
6517
|
encoding: "utf-8",
|
|
@@ -6498,7 +6524,7 @@ function searchItems(search) {
|
|
|
6498
6524
|
items = JSON.parse(opExec("item list --format=json"));
|
|
6499
6525
|
} catch {
|
|
6500
6526
|
console.error(
|
|
6501
|
-
|
|
6527
|
+
chalk72.red(
|
|
6502
6528
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
6503
6529
|
)
|
|
6504
6530
|
);
|
|
@@ -6512,7 +6538,7 @@ function getItemFields(itemId) {
|
|
|
6512
6538
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
6513
6539
|
return item.fields.filter((f) => f.reference && f.label);
|
|
6514
6540
|
} catch {
|
|
6515
|
-
console.error(
|
|
6541
|
+
console.error(chalk72.red("Failed to get item details from 1Password."));
|
|
6516
6542
|
process.exit(1);
|
|
6517
6543
|
}
|
|
6518
6544
|
}
|
|
@@ -6531,7 +6557,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6531
6557
|
}).run();
|
|
6532
6558
|
const items = searchItems(search);
|
|
6533
6559
|
if (items.length === 0) {
|
|
6534
|
-
console.error(
|
|
6560
|
+
console.error(chalk73.red(`No items found matching "${search}".`));
|
|
6535
6561
|
process.exit(1);
|
|
6536
6562
|
}
|
|
6537
6563
|
const itemId = await selectOne(
|
|
@@ -6540,7 +6566,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6540
6566
|
);
|
|
6541
6567
|
const fields = getItemFields(itemId);
|
|
6542
6568
|
if (fields.length === 0) {
|
|
6543
|
-
console.error(
|
|
6569
|
+
console.error(chalk73.red("No fields with references found on this item."));
|
|
6544
6570
|
process.exit(1);
|
|
6545
6571
|
}
|
|
6546
6572
|
const ref = await selectOne(
|
|
@@ -6554,7 +6580,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
6554
6580
|
async function promptConnection(existingNames) {
|
|
6555
6581
|
const name = await promptInput("name", "Connection name:");
|
|
6556
6582
|
if (existingNames.includes(name)) {
|
|
6557
|
-
console.error(
|
|
6583
|
+
console.error(chalk74.red(`Connection "${name}" already exists.`));
|
|
6558
6584
|
process.exit(1);
|
|
6559
6585
|
}
|
|
6560
6586
|
const url = await promptInput(
|
|
@@ -6563,22 +6589,22 @@ async function promptConnection(existingNames) {
|
|
|
6563
6589
|
);
|
|
6564
6590
|
const database = await promptInput("database", "Database name:");
|
|
6565
6591
|
if (!name || !url || !database) {
|
|
6566
|
-
console.error(
|
|
6592
|
+
console.error(chalk74.red("All fields are required."));
|
|
6567
6593
|
process.exit(1);
|
|
6568
6594
|
}
|
|
6569
6595
|
const apiKeyRef = await selectOpSecret();
|
|
6570
|
-
console.log(
|
|
6596
|
+
console.log(chalk74.dim(`Using: ${apiKeyRef}`));
|
|
6571
6597
|
return { name, url, database, apiKeyRef };
|
|
6572
6598
|
}
|
|
6573
6599
|
|
|
6574
6600
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
6575
|
-
import
|
|
6601
|
+
import chalk75 from "chalk";
|
|
6576
6602
|
function ravendbSetConnection(name) {
|
|
6577
6603
|
const raw = loadGlobalConfigRaw();
|
|
6578
6604
|
const ravendb = raw.ravendb ?? {};
|
|
6579
6605
|
const connections = ravendb.connections ?? [];
|
|
6580
6606
|
if (!connections.some((c) => c.name === name)) {
|
|
6581
|
-
console.error(
|
|
6607
|
+
console.error(chalk75.red(`Connection "${name}" not found.`));
|
|
6582
6608
|
console.error(
|
|
6583
6609
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6584
6610
|
);
|
|
@@ -6594,16 +6620,16 @@ function ravendbSetConnection(name) {
|
|
|
6594
6620
|
var ravendbAuth = createConnectionAuth({
|
|
6595
6621
|
load: loadConnections,
|
|
6596
6622
|
save: saveConnections,
|
|
6597
|
-
format: (c) => `${
|
|
6623
|
+
format: (c) => `${chalk76.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
6598
6624
|
promptNew: promptConnection,
|
|
6599
6625
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
6600
6626
|
});
|
|
6601
6627
|
|
|
6602
6628
|
// src/commands/ravendb/ravendbCollections.ts
|
|
6603
|
-
import
|
|
6629
|
+
import chalk80 from "chalk";
|
|
6604
6630
|
|
|
6605
6631
|
// src/commands/ravendb/ravenFetch.ts
|
|
6606
|
-
import
|
|
6632
|
+
import chalk78 from "chalk";
|
|
6607
6633
|
|
|
6608
6634
|
// src/commands/ravendb/getAccessToken.ts
|
|
6609
6635
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -6640,10 +6666,10 @@ ${errorText}`
|
|
|
6640
6666
|
|
|
6641
6667
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
6642
6668
|
import { execSync as execSync33 } from "child_process";
|
|
6643
|
-
import
|
|
6669
|
+
import chalk77 from "chalk";
|
|
6644
6670
|
function resolveOpSecret(reference) {
|
|
6645
6671
|
if (!reference.startsWith("op://")) {
|
|
6646
|
-
console.error(
|
|
6672
|
+
console.error(chalk77.red(`Invalid secret reference: must start with op://`));
|
|
6647
6673
|
process.exit(1);
|
|
6648
6674
|
}
|
|
6649
6675
|
try {
|
|
@@ -6653,7 +6679,7 @@ function resolveOpSecret(reference) {
|
|
|
6653
6679
|
}).trim();
|
|
6654
6680
|
} catch {
|
|
6655
6681
|
console.error(
|
|
6656
|
-
|
|
6682
|
+
chalk77.red(
|
|
6657
6683
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
6658
6684
|
)
|
|
6659
6685
|
);
|
|
@@ -6680,7 +6706,7 @@ async function ravenFetch(connection, path44) {
|
|
|
6680
6706
|
if (!response.ok) {
|
|
6681
6707
|
const body = await response.text();
|
|
6682
6708
|
console.error(
|
|
6683
|
-
|
|
6709
|
+
chalk78.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
6684
6710
|
);
|
|
6685
6711
|
console.error(body.substring(0, 500));
|
|
6686
6712
|
process.exit(1);
|
|
@@ -6689,7 +6715,7 @@ async function ravenFetch(connection, path44) {
|
|
|
6689
6715
|
}
|
|
6690
6716
|
|
|
6691
6717
|
// src/commands/ravendb/resolveConnection.ts
|
|
6692
|
-
import
|
|
6718
|
+
import chalk79 from "chalk";
|
|
6693
6719
|
function loadRavendb() {
|
|
6694
6720
|
const raw = loadGlobalConfigRaw();
|
|
6695
6721
|
const ravendb = raw.ravendb;
|
|
@@ -6703,7 +6729,7 @@ function resolveConnection(name) {
|
|
|
6703
6729
|
const connectionName = name ?? defaultConnection;
|
|
6704
6730
|
if (!connectionName) {
|
|
6705
6731
|
console.error(
|
|
6706
|
-
|
|
6732
|
+
chalk79.red(
|
|
6707
6733
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
6708
6734
|
)
|
|
6709
6735
|
);
|
|
@@ -6711,7 +6737,7 @@ function resolveConnection(name) {
|
|
|
6711
6737
|
}
|
|
6712
6738
|
const connection = connections.find((c) => c.name === connectionName);
|
|
6713
6739
|
if (!connection) {
|
|
6714
|
-
console.error(
|
|
6740
|
+
console.error(chalk79.red(`Connection "${connectionName}" not found.`));
|
|
6715
6741
|
console.error(
|
|
6716
6742
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
6717
6743
|
);
|
|
@@ -6742,15 +6768,15 @@ async function ravendbCollections(connectionName) {
|
|
|
6742
6768
|
return;
|
|
6743
6769
|
}
|
|
6744
6770
|
for (const c of collections) {
|
|
6745
|
-
console.log(`${
|
|
6771
|
+
console.log(`${chalk80.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
6746
6772
|
}
|
|
6747
6773
|
}
|
|
6748
6774
|
|
|
6749
6775
|
// src/commands/ravendb/ravendbQuery.ts
|
|
6750
|
-
import
|
|
6776
|
+
import chalk82 from "chalk";
|
|
6751
6777
|
|
|
6752
6778
|
// src/commands/ravendb/fetchAllPages.ts
|
|
6753
|
-
import
|
|
6779
|
+
import chalk81 from "chalk";
|
|
6754
6780
|
|
|
6755
6781
|
// src/commands/ravendb/buildQueryPath.ts
|
|
6756
6782
|
function buildQueryPath(opts) {
|
|
@@ -6788,7 +6814,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6788
6814
|
allResults.push(...results);
|
|
6789
6815
|
start3 += results.length;
|
|
6790
6816
|
process.stderr.write(
|
|
6791
|
-
`\r${
|
|
6817
|
+
`\r${chalk81.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
6792
6818
|
);
|
|
6793
6819
|
if (start3 >= totalResults) break;
|
|
6794
6820
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -6803,7 +6829,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
6803
6829
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
6804
6830
|
const resolved = resolveArgs(connectionName, collection);
|
|
6805
6831
|
if (!resolved.collection && !options2.query) {
|
|
6806
|
-
console.error(
|
|
6832
|
+
console.error(chalk82.red("Provide a collection name or --query filter."));
|
|
6807
6833
|
process.exit(1);
|
|
6808
6834
|
}
|
|
6809
6835
|
const { collection: col } = resolved;
|
|
@@ -6841,7 +6867,7 @@ import { spawn as spawn4 } from "child_process";
|
|
|
6841
6867
|
import * as path27 from "path";
|
|
6842
6868
|
|
|
6843
6869
|
// src/commands/refactor/logViolations.ts
|
|
6844
|
-
import
|
|
6870
|
+
import chalk83 from "chalk";
|
|
6845
6871
|
var DEFAULT_MAX_LINES = 100;
|
|
6846
6872
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
6847
6873
|
if (violations.length === 0) {
|
|
@@ -6850,43 +6876,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
6850
6876
|
}
|
|
6851
6877
|
return;
|
|
6852
6878
|
}
|
|
6853
|
-
console.error(
|
|
6879
|
+
console.error(chalk83.red(`
|
|
6854
6880
|
Refactor check failed:
|
|
6855
6881
|
`));
|
|
6856
|
-
console.error(
|
|
6882
|
+
console.error(chalk83.red(` The following files exceed ${maxLines} lines:
|
|
6857
6883
|
`));
|
|
6858
6884
|
for (const violation of violations) {
|
|
6859
|
-
console.error(
|
|
6885
|
+
console.error(chalk83.red(` ${violation.file} (${violation.lines} lines)`));
|
|
6860
6886
|
}
|
|
6861
6887
|
console.error(
|
|
6862
|
-
|
|
6888
|
+
chalk83.yellow(
|
|
6863
6889
|
`
|
|
6864
6890
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
6865
6891
|
way to refactor it, ignore it with:
|
|
6866
6892
|
`
|
|
6867
6893
|
)
|
|
6868
6894
|
);
|
|
6869
|
-
console.error(
|
|
6895
|
+
console.error(chalk83.gray(` assist refactor ignore <file>
|
|
6870
6896
|
`));
|
|
6871
6897
|
if (process.env.CLAUDECODE) {
|
|
6872
|
-
console.error(
|
|
6898
|
+
console.error(chalk83.cyan(`
|
|
6873
6899
|
## Extracting Code to New Files
|
|
6874
6900
|
`));
|
|
6875
6901
|
console.error(
|
|
6876
|
-
|
|
6902
|
+
chalk83.cyan(
|
|
6877
6903
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
6878
6904
|
`
|
|
6879
6905
|
)
|
|
6880
6906
|
);
|
|
6881
6907
|
console.error(
|
|
6882
|
-
|
|
6908
|
+
chalk83.cyan(
|
|
6883
6909
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
6884
6910
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
6885
6911
|
`
|
|
6886
6912
|
)
|
|
6887
6913
|
);
|
|
6888
6914
|
console.error(
|
|
6889
|
-
|
|
6915
|
+
chalk83.cyan(
|
|
6890
6916
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
6891
6917
|
domains, move it to a common/shared folder.
|
|
6892
6918
|
`
|
|
@@ -7042,11 +7068,11 @@ async function check(pattern2, options2) {
|
|
|
7042
7068
|
|
|
7043
7069
|
// src/commands/refactor/ignore.ts
|
|
7044
7070
|
import fs17 from "fs";
|
|
7045
|
-
import
|
|
7071
|
+
import chalk84 from "chalk";
|
|
7046
7072
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
7047
7073
|
function ignore(file) {
|
|
7048
7074
|
if (!fs17.existsSync(file)) {
|
|
7049
|
-
console.error(
|
|
7075
|
+
console.error(chalk84.red(`Error: File does not exist: ${file}`));
|
|
7050
7076
|
process.exit(1);
|
|
7051
7077
|
}
|
|
7052
7078
|
const content = fs17.readFileSync(file, "utf-8");
|
|
@@ -7062,7 +7088,7 @@ function ignore(file) {
|
|
|
7062
7088
|
fs17.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
7063
7089
|
}
|
|
7064
7090
|
console.log(
|
|
7065
|
-
|
|
7091
|
+
chalk84.green(
|
|
7066
7092
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
7067
7093
|
)
|
|
7068
7094
|
);
|
|
@@ -7070,7 +7096,7 @@ function ignore(file) {
|
|
|
7070
7096
|
|
|
7071
7097
|
// src/commands/refactor/rename/index.ts
|
|
7072
7098
|
import path28 from "path";
|
|
7073
|
-
import
|
|
7099
|
+
import chalk85 from "chalk";
|
|
7074
7100
|
import { Project as Project2 } from "ts-morph";
|
|
7075
7101
|
async function rename(source, destination, options2 = {}) {
|
|
7076
7102
|
const sourcePath = path28.resolve(source);
|
|
@@ -7083,22 +7109,22 @@ async function rename(source, destination, options2 = {}) {
|
|
|
7083
7109
|
});
|
|
7084
7110
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
7085
7111
|
if (!sourceFile) {
|
|
7086
|
-
console.log(
|
|
7112
|
+
console.log(chalk85.red(`File not found in project: ${source}`));
|
|
7087
7113
|
process.exit(1);
|
|
7088
7114
|
}
|
|
7089
|
-
console.log(
|
|
7115
|
+
console.log(chalk85.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
7090
7116
|
if (options2.apply) {
|
|
7091
7117
|
sourceFile.move(destPath);
|
|
7092
7118
|
await project.save();
|
|
7093
|
-
console.log(
|
|
7119
|
+
console.log(chalk85.green("Done"));
|
|
7094
7120
|
} else {
|
|
7095
|
-
console.log(
|
|
7121
|
+
console.log(chalk85.dim("Dry run. Use --apply to execute."));
|
|
7096
7122
|
}
|
|
7097
7123
|
}
|
|
7098
7124
|
|
|
7099
7125
|
// src/commands/refactor/renameSymbol/index.ts
|
|
7100
7126
|
import path30 from "path";
|
|
7101
|
-
import
|
|
7127
|
+
import chalk86 from "chalk";
|
|
7102
7128
|
import { Project as Project3 } from "ts-morph";
|
|
7103
7129
|
|
|
7104
7130
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
@@ -7147,38 +7173,38 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
7147
7173
|
const project = new Project3({ tsConfigFilePath: tsConfigPath });
|
|
7148
7174
|
const sourceFile = project.getSourceFile(filePath);
|
|
7149
7175
|
if (!sourceFile) {
|
|
7150
|
-
console.log(
|
|
7176
|
+
console.log(chalk86.red(`File not found in project: ${file}`));
|
|
7151
7177
|
process.exit(1);
|
|
7152
7178
|
}
|
|
7153
7179
|
const symbol = findSymbol(sourceFile, oldName);
|
|
7154
7180
|
if (!symbol) {
|
|
7155
|
-
console.log(
|
|
7181
|
+
console.log(chalk86.red(`Symbol "${oldName}" not found in ${file}`));
|
|
7156
7182
|
process.exit(1);
|
|
7157
7183
|
}
|
|
7158
7184
|
const grouped = groupReferences(symbol, cwd);
|
|
7159
7185
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
7160
7186
|
console.log(
|
|
7161
|
-
|
|
7187
|
+
chalk86.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
7162
7188
|
`)
|
|
7163
7189
|
);
|
|
7164
7190
|
for (const [refFile, lines] of grouped) {
|
|
7165
7191
|
console.log(
|
|
7166
|
-
` ${
|
|
7192
|
+
` ${chalk86.dim(refFile)}: lines ${chalk86.cyan(lines.join(", "))}`
|
|
7167
7193
|
);
|
|
7168
7194
|
}
|
|
7169
7195
|
if (options2.apply) {
|
|
7170
7196
|
symbol.rename(newName);
|
|
7171
7197
|
await project.save();
|
|
7172
|
-
console.log(
|
|
7198
|
+
console.log(chalk86.green(`
|
|
7173
7199
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
7174
7200
|
} else {
|
|
7175
|
-
console.log(
|
|
7201
|
+
console.log(chalk86.dim("\nDry run. Use --apply to execute."));
|
|
7176
7202
|
}
|
|
7177
7203
|
}
|
|
7178
7204
|
|
|
7179
7205
|
// src/commands/refactor/restructure/index.ts
|
|
7180
7206
|
import path39 from "path";
|
|
7181
|
-
import
|
|
7207
|
+
import chalk89 from "chalk";
|
|
7182
7208
|
|
|
7183
7209
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
7184
7210
|
import path31 from "path";
|
|
@@ -7421,50 +7447,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
7421
7447
|
|
|
7422
7448
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
7423
7449
|
import path35 from "path";
|
|
7424
|
-
import
|
|
7450
|
+
import chalk87 from "chalk";
|
|
7425
7451
|
function relPath(filePath) {
|
|
7426
7452
|
return path35.relative(process.cwd(), filePath);
|
|
7427
7453
|
}
|
|
7428
7454
|
function displayMoves(plan2) {
|
|
7429
7455
|
if (plan2.moves.length === 0) return;
|
|
7430
|
-
console.log(
|
|
7456
|
+
console.log(chalk87.bold("\nFile moves:"));
|
|
7431
7457
|
for (const move of plan2.moves) {
|
|
7432
7458
|
console.log(
|
|
7433
|
-
` ${
|
|
7459
|
+
` ${chalk87.red(relPath(move.from))} \u2192 ${chalk87.green(relPath(move.to))}`
|
|
7434
7460
|
);
|
|
7435
|
-
console.log(
|
|
7461
|
+
console.log(chalk87.dim(` ${move.reason}`));
|
|
7436
7462
|
}
|
|
7437
7463
|
}
|
|
7438
7464
|
function displayRewrites(rewrites) {
|
|
7439
7465
|
if (rewrites.length === 0) return;
|
|
7440
7466
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
7441
|
-
console.log(
|
|
7467
|
+
console.log(chalk87.bold(`
|
|
7442
7468
|
Import rewrites (${affectedFiles.size} files):`));
|
|
7443
7469
|
for (const file of affectedFiles) {
|
|
7444
|
-
console.log(` ${
|
|
7470
|
+
console.log(` ${chalk87.cyan(relPath(file))}:`);
|
|
7445
7471
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
7446
7472
|
(r) => r.file === file
|
|
7447
7473
|
)) {
|
|
7448
7474
|
console.log(
|
|
7449
|
-
` ${
|
|
7475
|
+
` ${chalk87.red(`"${oldSpecifier}"`)} \u2192 ${chalk87.green(`"${newSpecifier}"`)}`
|
|
7450
7476
|
);
|
|
7451
7477
|
}
|
|
7452
7478
|
}
|
|
7453
7479
|
}
|
|
7454
7480
|
function displayPlan(plan2) {
|
|
7455
7481
|
if (plan2.warnings.length > 0) {
|
|
7456
|
-
console.log(
|
|
7457
|
-
for (const w of plan2.warnings) console.log(
|
|
7482
|
+
console.log(chalk87.yellow("\nWarnings:"));
|
|
7483
|
+
for (const w of plan2.warnings) console.log(chalk87.yellow(` ${w}`));
|
|
7458
7484
|
}
|
|
7459
7485
|
if (plan2.newDirectories.length > 0) {
|
|
7460
|
-
console.log(
|
|
7486
|
+
console.log(chalk87.bold("\nNew directories:"));
|
|
7461
7487
|
for (const dir of plan2.newDirectories)
|
|
7462
|
-
console.log(
|
|
7488
|
+
console.log(chalk87.green(` ${dir}/`));
|
|
7463
7489
|
}
|
|
7464
7490
|
displayMoves(plan2);
|
|
7465
7491
|
displayRewrites(plan2.rewrites);
|
|
7466
7492
|
console.log(
|
|
7467
|
-
|
|
7493
|
+
chalk87.dim(
|
|
7468
7494
|
`
|
|
7469
7495
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
7470
7496
|
)
|
|
@@ -7474,18 +7500,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
7474
7500
|
// src/commands/refactor/restructure/executePlan.ts
|
|
7475
7501
|
import fs19 from "fs";
|
|
7476
7502
|
import path36 from "path";
|
|
7477
|
-
import
|
|
7503
|
+
import chalk88 from "chalk";
|
|
7478
7504
|
function executePlan(plan2) {
|
|
7479
7505
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
7480
7506
|
for (const [file, content] of updatedContents) {
|
|
7481
7507
|
fs19.writeFileSync(file, content, "utf-8");
|
|
7482
7508
|
console.log(
|
|
7483
|
-
|
|
7509
|
+
chalk88.cyan(` Rewrote imports in ${path36.relative(process.cwd(), file)}`)
|
|
7484
7510
|
);
|
|
7485
7511
|
}
|
|
7486
7512
|
for (const dir of plan2.newDirectories) {
|
|
7487
7513
|
fs19.mkdirSync(dir, { recursive: true });
|
|
7488
|
-
console.log(
|
|
7514
|
+
console.log(chalk88.green(` Created ${path36.relative(process.cwd(), dir)}/`));
|
|
7489
7515
|
}
|
|
7490
7516
|
for (const move of plan2.moves) {
|
|
7491
7517
|
const targetDir = path36.dirname(move.to);
|
|
@@ -7494,7 +7520,7 @@ function executePlan(plan2) {
|
|
|
7494
7520
|
}
|
|
7495
7521
|
fs19.renameSync(move.from, move.to);
|
|
7496
7522
|
console.log(
|
|
7497
|
-
|
|
7523
|
+
chalk88.white(
|
|
7498
7524
|
` Moved ${path36.relative(process.cwd(), move.from)} \u2192 ${path36.relative(process.cwd(), move.to)}`
|
|
7499
7525
|
)
|
|
7500
7526
|
);
|
|
@@ -7509,7 +7535,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
7509
7535
|
if (entries.length === 0) {
|
|
7510
7536
|
fs19.rmdirSync(dir);
|
|
7511
7537
|
console.log(
|
|
7512
|
-
|
|
7538
|
+
chalk88.dim(
|
|
7513
7539
|
` Removed empty directory ${path36.relative(process.cwd(), dir)}`
|
|
7514
7540
|
)
|
|
7515
7541
|
);
|
|
@@ -7642,22 +7668,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
7642
7668
|
const targetPattern = pattern2 ?? "src";
|
|
7643
7669
|
const files = findSourceFiles2(targetPattern);
|
|
7644
7670
|
if (files.length === 0) {
|
|
7645
|
-
console.log(
|
|
7671
|
+
console.log(chalk89.yellow("No files found matching pattern"));
|
|
7646
7672
|
return;
|
|
7647
7673
|
}
|
|
7648
7674
|
const tsConfigPath = path39.resolve("tsconfig.json");
|
|
7649
7675
|
const plan2 = buildPlan(files, tsConfigPath);
|
|
7650
7676
|
if (plan2.moves.length === 0) {
|
|
7651
|
-
console.log(
|
|
7677
|
+
console.log(chalk89.green("No restructuring needed"));
|
|
7652
7678
|
return;
|
|
7653
7679
|
}
|
|
7654
7680
|
displayPlan(plan2);
|
|
7655
7681
|
if (options2.apply) {
|
|
7656
|
-
console.log(
|
|
7682
|
+
console.log(chalk89.bold("\nApplying changes..."));
|
|
7657
7683
|
executePlan(plan2);
|
|
7658
|
-
console.log(
|
|
7684
|
+
console.log(chalk89.green("\nRestructuring complete"));
|
|
7659
7685
|
} else {
|
|
7660
|
-
console.log(
|
|
7686
|
+
console.log(chalk89.dim("\nDry run. Use --apply to execute."));
|
|
7661
7687
|
}
|
|
7662
7688
|
}
|
|
7663
7689
|
|
|
@@ -7685,7 +7711,7 @@ function registerRefactor(program2) {
|
|
|
7685
7711
|
}
|
|
7686
7712
|
|
|
7687
7713
|
// src/commands/seq/seqAuth.ts
|
|
7688
|
-
import
|
|
7714
|
+
import chalk91 from "chalk";
|
|
7689
7715
|
|
|
7690
7716
|
// src/commands/seq/loadConnections.ts
|
|
7691
7717
|
function loadConnections2() {
|
|
@@ -7714,11 +7740,11 @@ function setDefaultConnection(name) {
|
|
|
7714
7740
|
}
|
|
7715
7741
|
|
|
7716
7742
|
// src/commands/seq/promptConnection.ts
|
|
7717
|
-
import
|
|
7743
|
+
import chalk90 from "chalk";
|
|
7718
7744
|
async function promptConnection2(existingNames) {
|
|
7719
7745
|
const name = await promptInput("name", "Connection name:", "default");
|
|
7720
7746
|
if (existingNames.includes(name)) {
|
|
7721
|
-
console.error(
|
|
7747
|
+
console.error(chalk90.red(`Connection "${name}" already exists.`));
|
|
7722
7748
|
process.exit(1);
|
|
7723
7749
|
}
|
|
7724
7750
|
const url = await promptInput("url", "Seq URL:", "http://localhost:5341");
|
|
@@ -7730,32 +7756,32 @@ async function promptConnection2(existingNames) {
|
|
|
7730
7756
|
var seqAuth = createConnectionAuth({
|
|
7731
7757
|
load: loadConnections2,
|
|
7732
7758
|
save: saveConnections2,
|
|
7733
|
-
format: (c) => `${
|
|
7759
|
+
format: (c) => `${chalk91.bold(c.name)} ${c.url}`,
|
|
7734
7760
|
promptNew: promptConnection2,
|
|
7735
7761
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
7736
7762
|
});
|
|
7737
7763
|
|
|
7738
7764
|
// src/commands/seq/seqQuery.ts
|
|
7739
|
-
import
|
|
7765
|
+
import chalk94 from "chalk";
|
|
7740
7766
|
|
|
7741
7767
|
// src/commands/seq/formatEvent.ts
|
|
7742
|
-
import
|
|
7768
|
+
import chalk92 from "chalk";
|
|
7743
7769
|
function levelColor(level) {
|
|
7744
7770
|
switch (level) {
|
|
7745
7771
|
case "Fatal":
|
|
7746
|
-
return
|
|
7772
|
+
return chalk92.bgRed.white;
|
|
7747
7773
|
case "Error":
|
|
7748
|
-
return
|
|
7774
|
+
return chalk92.red;
|
|
7749
7775
|
case "Warning":
|
|
7750
|
-
return
|
|
7776
|
+
return chalk92.yellow;
|
|
7751
7777
|
case "Information":
|
|
7752
|
-
return
|
|
7778
|
+
return chalk92.cyan;
|
|
7753
7779
|
case "Debug":
|
|
7754
|
-
return
|
|
7780
|
+
return chalk92.gray;
|
|
7755
7781
|
case "Verbose":
|
|
7756
|
-
return
|
|
7782
|
+
return chalk92.dim;
|
|
7757
7783
|
default:
|
|
7758
|
-
return
|
|
7784
|
+
return chalk92.white;
|
|
7759
7785
|
}
|
|
7760
7786
|
}
|
|
7761
7787
|
function levelAbbrev(level) {
|
|
@@ -7796,31 +7822,31 @@ function formatTimestamp(iso) {
|
|
|
7796
7822
|
function formatEvent(event) {
|
|
7797
7823
|
const color = levelColor(event.Level);
|
|
7798
7824
|
const abbrev = levelAbbrev(event.Level);
|
|
7799
|
-
const ts8 =
|
|
7825
|
+
const ts8 = chalk92.dim(formatTimestamp(event.Timestamp));
|
|
7800
7826
|
const msg = renderMessage(event);
|
|
7801
7827
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
7802
7828
|
if (event.Exception) {
|
|
7803
7829
|
for (const line of event.Exception.split("\n")) {
|
|
7804
|
-
lines.push(
|
|
7830
|
+
lines.push(chalk92.red(` ${line}`));
|
|
7805
7831
|
}
|
|
7806
7832
|
}
|
|
7807
7833
|
return lines.join("\n");
|
|
7808
7834
|
}
|
|
7809
7835
|
|
|
7810
7836
|
// src/commands/seq/resolveConnection.ts
|
|
7811
|
-
import
|
|
7837
|
+
import chalk93 from "chalk";
|
|
7812
7838
|
function resolveConnection2(name) {
|
|
7813
7839
|
const connections = loadConnections2();
|
|
7814
7840
|
if (connections.length === 0) {
|
|
7815
7841
|
console.error(
|
|
7816
|
-
|
|
7842
|
+
chalk93.red("No Seq connections configured. Run 'assist seq auth' first.")
|
|
7817
7843
|
);
|
|
7818
7844
|
process.exit(1);
|
|
7819
7845
|
}
|
|
7820
7846
|
const target = name ?? getDefaultConnection() ?? connections[0].name;
|
|
7821
7847
|
const connection = connections.find((c) => c.name === target);
|
|
7822
7848
|
if (!connection) {
|
|
7823
|
-
console.error(
|
|
7849
|
+
console.error(chalk93.red(`Seq connection "${target}" not found.`));
|
|
7824
7850
|
process.exit(1);
|
|
7825
7851
|
}
|
|
7826
7852
|
return connection;
|
|
@@ -7840,12 +7866,12 @@ async function seqQuery(filter, options2) {
|
|
|
7840
7866
|
});
|
|
7841
7867
|
if (!response.ok) {
|
|
7842
7868
|
const body = await response.text();
|
|
7843
|
-
console.error(
|
|
7869
|
+
console.error(chalk94.red(`Seq returned ${response.status}: ${body}`));
|
|
7844
7870
|
process.exit(1);
|
|
7845
7871
|
}
|
|
7846
7872
|
const events = await response.json();
|
|
7847
7873
|
if (events.length === 0) {
|
|
7848
|
-
console.log(
|
|
7874
|
+
console.log(chalk94.yellow("No events found."));
|
|
7849
7875
|
return;
|
|
7850
7876
|
}
|
|
7851
7877
|
if (options2.json) {
|
|
@@ -7856,11 +7882,11 @@ async function seqQuery(filter, options2) {
|
|
|
7856
7882
|
for (const event of chronological) {
|
|
7857
7883
|
console.log(formatEvent(event));
|
|
7858
7884
|
}
|
|
7859
|
-
console.log(
|
|
7885
|
+
console.log(chalk94.dim(`
|
|
7860
7886
|
${events.length} events`));
|
|
7861
7887
|
if (events.length >= count) {
|
|
7862
7888
|
console.log(
|
|
7863
|
-
|
|
7889
|
+
chalk94.yellow(
|
|
7864
7890
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
7865
7891
|
)
|
|
7866
7892
|
);
|
|
@@ -7868,11 +7894,11 @@ ${events.length} events`));
|
|
|
7868
7894
|
}
|
|
7869
7895
|
|
|
7870
7896
|
// src/commands/seq/seqSetConnection.ts
|
|
7871
|
-
import
|
|
7897
|
+
import chalk95 from "chalk";
|
|
7872
7898
|
function seqSetConnection(name) {
|
|
7873
7899
|
const connections = loadConnections2();
|
|
7874
7900
|
if (!connections.find((c) => c.name === name)) {
|
|
7875
|
-
console.error(
|
|
7901
|
+
console.error(chalk95.red(`Connection "${name}" not found.`));
|
|
7876
7902
|
process.exit(1);
|
|
7877
7903
|
}
|
|
7878
7904
|
setDefaultConnection(name);
|
|
@@ -8411,14 +8437,14 @@ import {
|
|
|
8411
8437
|
import { dirname as dirname20, join as join29 } from "path";
|
|
8412
8438
|
|
|
8413
8439
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
8414
|
-
import
|
|
8440
|
+
import chalk96 from "chalk";
|
|
8415
8441
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
8416
8442
|
function validateStagedContent(filename, content) {
|
|
8417
8443
|
const firstLine = content.split("\n")[0];
|
|
8418
8444
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
8419
8445
|
if (!match) {
|
|
8420
8446
|
console.error(
|
|
8421
|
-
|
|
8447
|
+
chalk96.red(
|
|
8422
8448
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
8423
8449
|
)
|
|
8424
8450
|
);
|
|
@@ -8427,7 +8453,7 @@ function validateStagedContent(filename, content) {
|
|
|
8427
8453
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
8428
8454
|
if (!contentAfterLink) {
|
|
8429
8455
|
console.error(
|
|
8430
|
-
|
|
8456
|
+
chalk96.red(
|
|
8431
8457
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
8432
8458
|
)
|
|
8433
8459
|
);
|
|
@@ -8820,7 +8846,7 @@ function registerVoice(program2) {
|
|
|
8820
8846
|
|
|
8821
8847
|
// src/commands/roam/auth.ts
|
|
8822
8848
|
import { randomBytes } from "crypto";
|
|
8823
|
-
import
|
|
8849
|
+
import chalk97 from "chalk";
|
|
8824
8850
|
|
|
8825
8851
|
// src/lib/openBrowser.ts
|
|
8826
8852
|
import { execSync as execSync36 } from "child_process";
|
|
@@ -8995,13 +9021,13 @@ async function auth() {
|
|
|
8995
9021
|
saveGlobalConfig(config);
|
|
8996
9022
|
const state = randomBytes(16).toString("hex");
|
|
8997
9023
|
console.log(
|
|
8998
|
-
|
|
9024
|
+
chalk97.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
8999
9025
|
);
|
|
9000
|
-
console.log(
|
|
9001
|
-
console.log(
|
|
9002
|
-
console.log(
|
|
9026
|
+
console.log(chalk97.white("http://localhost:14523/callback\n"));
|
|
9027
|
+
console.log(chalk97.blue("Opening browser for authorization..."));
|
|
9028
|
+
console.log(chalk97.dim("Waiting for authorization callback..."));
|
|
9003
9029
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
9004
|
-
console.log(
|
|
9030
|
+
console.log(chalk97.dim("Exchanging code for tokens..."));
|
|
9005
9031
|
const tokens = await exchangeToken({
|
|
9006
9032
|
code,
|
|
9007
9033
|
clientId,
|
|
@@ -9017,7 +9043,7 @@ async function auth() {
|
|
|
9017
9043
|
};
|
|
9018
9044
|
saveGlobalConfig(config);
|
|
9019
9045
|
console.log(
|
|
9020
|
-
|
|
9046
|
+
chalk97.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
9021
9047
|
);
|
|
9022
9048
|
}
|
|
9023
9049
|
|
|
@@ -9238,7 +9264,7 @@ import { execSync as execSync38 } from "child_process";
|
|
|
9238
9264
|
import { existsSync as existsSync37, mkdirSync as mkdirSync13, unlinkSync as unlinkSync10, writeFileSync as writeFileSync27 } from "fs";
|
|
9239
9265
|
import { tmpdir as tmpdir6 } from "os";
|
|
9240
9266
|
import { join as join38, resolve as resolve5 } from "path";
|
|
9241
|
-
import
|
|
9267
|
+
import chalk98 from "chalk";
|
|
9242
9268
|
|
|
9243
9269
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
9244
9270
|
var captureWindowPs1 = `
|
|
@@ -9389,22 +9415,22 @@ function screenshot(processName) {
|
|
|
9389
9415
|
const config = loadConfig();
|
|
9390
9416
|
const outputDir = resolve5(config.screenshot.outputDir);
|
|
9391
9417
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
9392
|
-
console.log(
|
|
9418
|
+
console.log(chalk98.gray(`Capturing window for process "${processName}" ...`));
|
|
9393
9419
|
try {
|
|
9394
9420
|
runPowerShellScript(processName, outputPath);
|
|
9395
|
-
console.log(
|
|
9421
|
+
console.log(chalk98.green(`Screenshot saved: ${outputPath}`));
|
|
9396
9422
|
} catch (error) {
|
|
9397
9423
|
const msg = error instanceof Error ? error.message : String(error);
|
|
9398
|
-
console.error(
|
|
9424
|
+
console.error(chalk98.red(`Failed to capture screenshot: ${msg}`));
|
|
9399
9425
|
process.exit(1);
|
|
9400
9426
|
}
|
|
9401
9427
|
}
|
|
9402
9428
|
|
|
9403
9429
|
// src/commands/statusLine.ts
|
|
9404
|
-
import
|
|
9430
|
+
import chalk100 from "chalk";
|
|
9405
9431
|
|
|
9406
9432
|
// src/commands/buildLimitsSegment.ts
|
|
9407
|
-
import
|
|
9433
|
+
import chalk99 from "chalk";
|
|
9408
9434
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
9409
9435
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
9410
9436
|
function formatTimeLeft(resetsAt) {
|
|
@@ -9427,10 +9453,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
9427
9453
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
9428
9454
|
const label2 = `${Math.round(pct)}%`;
|
|
9429
9455
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
9430
|
-
if (projected == null) return
|
|
9431
|
-
if (projected > 100) return
|
|
9432
|
-
if (projected > 75) return
|
|
9433
|
-
return
|
|
9456
|
+
if (projected == null) return chalk99.green(label2);
|
|
9457
|
+
if (projected > 100) return chalk99.red(label2);
|
|
9458
|
+
if (projected > 75) return chalk99.yellow(label2);
|
|
9459
|
+
return chalk99.green(label2);
|
|
9434
9460
|
}
|
|
9435
9461
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
9436
9462
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -9456,14 +9482,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
9456
9482
|
}
|
|
9457
9483
|
|
|
9458
9484
|
// src/commands/statusLine.ts
|
|
9459
|
-
|
|
9485
|
+
chalk100.level = 3;
|
|
9460
9486
|
function formatNumber(num) {
|
|
9461
9487
|
return num.toLocaleString("en-US");
|
|
9462
9488
|
}
|
|
9463
9489
|
function colorizePercent(pct) {
|
|
9464
9490
|
const label2 = `${Math.round(pct)}%`;
|
|
9465
|
-
if (pct > 80) return
|
|
9466
|
-
if (pct > 40) return
|
|
9491
|
+
if (pct > 80) return chalk100.red(label2);
|
|
9492
|
+
if (pct > 40) return chalk100.yellow(label2);
|
|
9467
9493
|
return label2;
|
|
9468
9494
|
}
|
|
9469
9495
|
async function statusLine() {
|
|
@@ -9486,7 +9512,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
9486
9512
|
// src/commands/sync/syncClaudeMd.ts
|
|
9487
9513
|
import * as fs22 from "fs";
|
|
9488
9514
|
import * as path40 from "path";
|
|
9489
|
-
import
|
|
9515
|
+
import chalk101 from "chalk";
|
|
9490
9516
|
async function syncClaudeMd(claudeDir, targetBase) {
|
|
9491
9517
|
const source = path40.join(claudeDir, "CLAUDE.md");
|
|
9492
9518
|
const target = path40.join(targetBase, "CLAUDE.md");
|
|
@@ -9495,12 +9521,12 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
9495
9521
|
const targetContent = fs22.readFileSync(target, "utf-8");
|
|
9496
9522
|
if (sourceContent !== targetContent) {
|
|
9497
9523
|
console.log(
|
|
9498
|
-
|
|
9524
|
+
chalk101.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
9499
9525
|
);
|
|
9500
9526
|
console.log();
|
|
9501
9527
|
printDiff(targetContent, sourceContent);
|
|
9502
9528
|
const confirm = await promptConfirm(
|
|
9503
|
-
|
|
9529
|
+
chalk101.red("Overwrite existing CLAUDE.md?"),
|
|
9504
9530
|
false
|
|
9505
9531
|
);
|
|
9506
9532
|
if (!confirm) {
|
|
@@ -9516,7 +9542,7 @@ async function syncClaudeMd(claudeDir, targetBase) {
|
|
|
9516
9542
|
// src/commands/sync/syncSettings.ts
|
|
9517
9543
|
import * as fs23 from "fs";
|
|
9518
9544
|
import * as path41 from "path";
|
|
9519
|
-
import
|
|
9545
|
+
import chalk102 from "chalk";
|
|
9520
9546
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
9521
9547
|
const source = path41.join(claudeDir, "settings.json");
|
|
9522
9548
|
const target = path41.join(targetBase, "settings.json");
|
|
@@ -9532,14 +9558,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
9532
9558
|
if (mergedContent !== normalizedTarget) {
|
|
9533
9559
|
if (!options2?.yes) {
|
|
9534
9560
|
console.log(
|
|
9535
|
-
|
|
9561
|
+
chalk102.yellow(
|
|
9536
9562
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
9537
9563
|
)
|
|
9538
9564
|
);
|
|
9539
9565
|
console.log();
|
|
9540
9566
|
printDiff(targetContent, mergedContent);
|
|
9541
9567
|
const confirm = await promptConfirm(
|
|
9542
|
-
|
|
9568
|
+
chalk102.red("Overwrite existing settings.json?"),
|
|
9543
9569
|
false
|
|
9544
9570
|
);
|
|
9545
9571
|
if (!confirm) {
|