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