@staff0rd/assist 0.216.1 → 0.218.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/claude/commands/next.md +1 -1
- package/dist/index.js +561 -500
- 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.218.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2579,7 +2579,40 @@ async function web2(options2) {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
|
|
2581
2581
|
// src/commands/backlog/launchMode.ts
|
|
2582
|
+
import chalk18 from "chalk";
|
|
2583
|
+
|
|
2584
|
+
// src/commands/backlog/tryRunById.ts
|
|
2582
2585
|
import chalk17 from "chalk";
|
|
2586
|
+
async function tryRunById(id, options2) {
|
|
2587
|
+
const items = loadBacklog();
|
|
2588
|
+
const numericId = Number.parseInt(id, 10);
|
|
2589
|
+
const item = Number.isNaN(numericId) ? void 0 : items.find((i) => i.id === numericId);
|
|
2590
|
+
if (!item) {
|
|
2591
|
+
console.log(chalk17.red(`Item #${id} not found.`));
|
|
2592
|
+
return false;
|
|
2593
|
+
}
|
|
2594
|
+
if (item.status === "done") {
|
|
2595
|
+
console.log(chalk17.red(`Item #${id} is already done.`));
|
|
2596
|
+
return false;
|
|
2597
|
+
}
|
|
2598
|
+
if (item.status === "wontdo") {
|
|
2599
|
+
console.log(chalk17.red(`Item #${id} is marked won't do.`));
|
|
2600
|
+
return false;
|
|
2601
|
+
}
|
|
2602
|
+
if (isBlocked(item, items)) {
|
|
2603
|
+
console.log(
|
|
2604
|
+
chalk17.red(`Item #${id} is blocked by unresolved dependencies.`)
|
|
2605
|
+
);
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
console.log(chalk17.bold(`
|
|
2609
|
+
Running backlog item #${id}...
|
|
2610
|
+
`));
|
|
2611
|
+
await run(id, options2);
|
|
2612
|
+
return true;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
// src/commands/backlog/launchMode.ts
|
|
2583
2616
|
async function launchMode(slashCommand) {
|
|
2584
2617
|
process.env.ASSIST_SESSION_ID = String(process.pid);
|
|
2585
2618
|
const { child, done: done2 } = spawnClaude(`/${slashCommand}`, { allowEdits: true });
|
|
@@ -2589,13 +2622,16 @@ async function launchMode(slashCommand) {
|
|
|
2589
2622
|
const signal = readSignal();
|
|
2590
2623
|
cleanupSignal();
|
|
2591
2624
|
if (signal?.event === "next") {
|
|
2592
|
-
|
|
2625
|
+
if (typeof signal.id === "string" && signal.id) {
|
|
2626
|
+
if (await tryRunById(signal.id, { allowEdits: true })) return;
|
|
2627
|
+
}
|
|
2628
|
+
console.log(chalk18.bold("\nChaining into assist next...\n"));
|
|
2593
2629
|
await next({ allowEdits: true });
|
|
2594
2630
|
}
|
|
2595
2631
|
}
|
|
2596
2632
|
|
|
2597
2633
|
// src/commands/backlog/refine.ts
|
|
2598
|
-
import
|
|
2634
|
+
import chalk19 from "chalk";
|
|
2599
2635
|
import enquirer3 from "enquirer";
|
|
2600
2636
|
async function pickItemForRefine() {
|
|
2601
2637
|
const items = loadBacklog();
|
|
@@ -2603,12 +2639,12 @@ async function pickItemForRefine() {
|
|
|
2603
2639
|
(i) => i.status === "todo" || i.status === "in-progress"
|
|
2604
2640
|
);
|
|
2605
2641
|
if (active.length === 0) {
|
|
2606
|
-
console.log(
|
|
2642
|
+
console.log(chalk19.yellow("No active backlog items to refine."));
|
|
2607
2643
|
return void 0;
|
|
2608
2644
|
}
|
|
2609
2645
|
if (active.length === 1) {
|
|
2610
2646
|
const item = active[0];
|
|
2611
|
-
console.log(
|
|
2647
|
+
console.log(chalk19.bold(`Auto-selecting item #${item.id}: ${item.name}`));
|
|
2612
2648
|
return String(item.id);
|
|
2613
2649
|
}
|
|
2614
2650
|
const { selected } = await exitOnCancel(
|
|
@@ -2727,10 +2763,10 @@ function coverage() {
|
|
|
2727
2763
|
}
|
|
2728
2764
|
|
|
2729
2765
|
// src/commands/verify/init/index.ts
|
|
2730
|
-
import
|
|
2766
|
+
import chalk34 from "chalk";
|
|
2731
2767
|
|
|
2732
2768
|
// src/shared/promptMultiselect.ts
|
|
2733
|
-
import
|
|
2769
|
+
import chalk20 from "chalk";
|
|
2734
2770
|
import enquirer4 from "enquirer";
|
|
2735
2771
|
async function promptMultiselect(message, options2) {
|
|
2736
2772
|
const { selected } = await exitOnCancel(
|
|
@@ -2740,7 +2776,7 @@ async function promptMultiselect(message, options2) {
|
|
|
2740
2776
|
message,
|
|
2741
2777
|
choices: options2.map((opt) => ({
|
|
2742
2778
|
name: opt.value,
|
|
2743
|
-
message: `${opt.name} - ${
|
|
2779
|
+
message: `${opt.name} - ${chalk20.dim(opt.description)}`
|
|
2744
2780
|
})),
|
|
2745
2781
|
// @ts-expect-error - enquirer types don't include symbols but it's supported
|
|
2746
2782
|
symbols: {
|
|
@@ -2757,7 +2793,7 @@ async function promptMultiselect(message, options2) {
|
|
|
2757
2793
|
// src/shared/readPackageJson.ts
|
|
2758
2794
|
import * as fs3 from "fs";
|
|
2759
2795
|
import * as path4 from "path";
|
|
2760
|
-
import
|
|
2796
|
+
import chalk21 from "chalk";
|
|
2761
2797
|
function findPackageJson() {
|
|
2762
2798
|
const packageJsonPath = path4.join(process.cwd(), "package.json");
|
|
2763
2799
|
if (fs3.existsSync(packageJsonPath)) {
|
|
@@ -2771,7 +2807,7 @@ function readPackageJson(filePath) {
|
|
|
2771
2807
|
function requirePackageJson() {
|
|
2772
2808
|
const packageJsonPath = findPackageJson();
|
|
2773
2809
|
if (!packageJsonPath) {
|
|
2774
|
-
console.error(
|
|
2810
|
+
console.error(chalk21.red("No package.json found in current directory"));
|
|
2775
2811
|
process.exit(1);
|
|
2776
2812
|
}
|
|
2777
2813
|
const pkg = readPackageJson(packageJsonPath);
|
|
@@ -2802,7 +2838,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
|
|
|
2802
2838
|
// src/commands/verify/installPackage.ts
|
|
2803
2839
|
import { execSync as execSync4 } from "child_process";
|
|
2804
2840
|
import { writeFileSync as writeFileSync6 } from "fs";
|
|
2805
|
-
import
|
|
2841
|
+
import chalk22 from "chalk";
|
|
2806
2842
|
function writePackageJson(filePath, pkg) {
|
|
2807
2843
|
writeFileSync6(filePath, `${JSON.stringify(pkg, null, 2)}
|
|
2808
2844
|
`);
|
|
@@ -2817,12 +2853,12 @@ function addScript(pkg, name, command) {
|
|
|
2817
2853
|
};
|
|
2818
2854
|
}
|
|
2819
2855
|
function installPackage(name, cwd) {
|
|
2820
|
-
console.log(
|
|
2856
|
+
console.log(chalk22.dim(`Installing ${name}...`));
|
|
2821
2857
|
try {
|
|
2822
2858
|
execSync4(`npm install -D ${name}`, { stdio: "inherit", cwd });
|
|
2823
2859
|
return true;
|
|
2824
2860
|
} catch {
|
|
2825
|
-
console.error(
|
|
2861
|
+
console.error(chalk22.red(`Failed to install ${name}`));
|
|
2826
2862
|
return false;
|
|
2827
2863
|
}
|
|
2828
2864
|
}
|
|
@@ -2876,9 +2912,9 @@ var expectedScripts = {
|
|
|
2876
2912
|
};
|
|
2877
2913
|
|
|
2878
2914
|
// src/commands/verify/setup/setupBuild.ts
|
|
2879
|
-
import
|
|
2915
|
+
import chalk23 from "chalk";
|
|
2880
2916
|
async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
2881
|
-
console.log(
|
|
2917
|
+
console.log(chalk23.blue("\nSetting up build verification..."));
|
|
2882
2918
|
let command;
|
|
2883
2919
|
if (hasVite && hasTypescript) {
|
|
2884
2920
|
command = "tsc -b && vite build --logLevel error";
|
|
@@ -2887,21 +2923,21 @@ async function setupBuild(_packageJsonPath, writer, hasVite, hasTypescript) {
|
|
|
2887
2923
|
} else {
|
|
2888
2924
|
command = "npm run build";
|
|
2889
2925
|
}
|
|
2890
|
-
console.log(
|
|
2926
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
2891
2927
|
writer("verify:build", command);
|
|
2892
2928
|
}
|
|
2893
2929
|
async function setupTypecheck(_packageJsonPath, writer) {
|
|
2894
|
-
console.log(
|
|
2930
|
+
console.log(chalk23.blue("\nSetting up typecheck verification..."));
|
|
2895
2931
|
const command = "tsc --noEmit";
|
|
2896
|
-
console.log(
|
|
2932
|
+
console.log(chalk23.dim(`Using: ${command}`));
|
|
2897
2933
|
writer("verify:typecheck", command);
|
|
2898
2934
|
}
|
|
2899
2935
|
|
|
2900
2936
|
// src/commands/verify/setup/setupDuplicateCode.ts
|
|
2901
2937
|
import * as path5 from "path";
|
|
2902
|
-
import
|
|
2938
|
+
import chalk24 from "chalk";
|
|
2903
2939
|
async function setupDuplicateCode(packageJsonPath, writer) {
|
|
2904
|
-
console.log(
|
|
2940
|
+
console.log(chalk24.blue("\nSetting up jscpd..."));
|
|
2905
2941
|
const cwd = path5.dirname(packageJsonPath);
|
|
2906
2942
|
const pkg = readPackageJson(packageJsonPath);
|
|
2907
2943
|
const hasJscpd = !!pkg.dependencies?.jscpd || !!pkg.devDependencies?.jscpd;
|
|
@@ -2913,12 +2949,12 @@ async function setupDuplicateCode(packageJsonPath, writer) {
|
|
|
2913
2949
|
|
|
2914
2950
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
2915
2951
|
import * as path6 from "path";
|
|
2916
|
-
import
|
|
2952
|
+
import chalk26 from "chalk";
|
|
2917
2953
|
|
|
2918
2954
|
// src/commands/verify/addToKnipIgnoreBinaries.ts
|
|
2919
2955
|
import { existsSync as existsSync13, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
|
|
2920
2956
|
import { join as join13 } from "path";
|
|
2921
|
-
import
|
|
2957
|
+
import chalk25 from "chalk";
|
|
2922
2958
|
function loadKnipConfig(knipJsonPath) {
|
|
2923
2959
|
if (existsSync13(knipJsonPath)) {
|
|
2924
2960
|
return JSON.parse(readFileSync10(knipJsonPath, "utf-8"));
|
|
@@ -2937,16 +2973,16 @@ function addToKnipIgnoreBinaries(cwd, binary) {
|
|
|
2937
2973
|
`${JSON.stringify(knipConfig, null, " ")}
|
|
2938
2974
|
`
|
|
2939
2975
|
);
|
|
2940
|
-
console.log(
|
|
2976
|
+
console.log(chalk25.dim(`Added '${binary}' to knip.json ignoreBinaries`));
|
|
2941
2977
|
}
|
|
2942
2978
|
} catch {
|
|
2943
|
-
console.log(
|
|
2979
|
+
console.log(chalk25.yellow("Warning: Could not update knip.json"));
|
|
2944
2980
|
}
|
|
2945
2981
|
}
|
|
2946
2982
|
|
|
2947
2983
|
// src/commands/verify/setup/setupHardcodedColors.ts
|
|
2948
2984
|
async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
2949
|
-
console.log(
|
|
2985
|
+
console.log(chalk26.blue("\nSetting up hardcoded colors check..."));
|
|
2950
2986
|
const cwd = path6.dirname(packageJsonPath);
|
|
2951
2987
|
if (!hasOpenColor) {
|
|
2952
2988
|
installPackage("open-color", cwd);
|
|
@@ -2957,9 +2993,9 @@ async function setupHardcodedColors(packageJsonPath, writer, hasOpenColor) {
|
|
|
2957
2993
|
|
|
2958
2994
|
// src/commands/verify/setup/setupKnip.ts
|
|
2959
2995
|
import * as path7 from "path";
|
|
2960
|
-
import
|
|
2996
|
+
import chalk27 from "chalk";
|
|
2961
2997
|
async function setupKnip(packageJsonPath, writer) {
|
|
2962
|
-
console.log(
|
|
2998
|
+
console.log(chalk27.blue("\nSetting up knip..."));
|
|
2963
2999
|
const cwd = path7.dirname(packageJsonPath);
|
|
2964
3000
|
const pkg = readPackageJson(packageJsonPath);
|
|
2965
3001
|
if (!pkg.devDependencies?.knip && !installPackage("knip", cwd)) {
|
|
@@ -2970,14 +3006,14 @@ async function setupKnip(packageJsonPath, writer) {
|
|
|
2970
3006
|
|
|
2971
3007
|
// src/commands/verify/setup/setupLint.ts
|
|
2972
3008
|
import * as path8 from "path";
|
|
2973
|
-
import
|
|
3009
|
+
import chalk30 from "chalk";
|
|
2974
3010
|
|
|
2975
3011
|
// src/commands/lint/init.ts
|
|
2976
3012
|
import { execSync as execSync6 } from "child_process";
|
|
2977
3013
|
import { existsSync as existsSync16, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "fs";
|
|
2978
3014
|
import { dirname as dirname11, join as join14 } from "path";
|
|
2979
3015
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2980
|
-
import
|
|
3016
|
+
import chalk29 from "chalk";
|
|
2981
3017
|
|
|
2982
3018
|
// src/shared/promptConfirm.ts
|
|
2983
3019
|
import enquirer5 from "enquirer";
|
|
@@ -3081,7 +3117,7 @@ function removeEslintScripts(scripts, options2) {
|
|
|
3081
3117
|
}
|
|
3082
3118
|
|
|
3083
3119
|
// src/utils/printDiff.ts
|
|
3084
|
-
import
|
|
3120
|
+
import chalk28 from "chalk";
|
|
3085
3121
|
import * as diff from "diff";
|
|
3086
3122
|
function normalizeJson(content) {
|
|
3087
3123
|
try {
|
|
@@ -3099,11 +3135,11 @@ function printDiff(oldContent, newContent) {
|
|
|
3099
3135
|
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
3100
3136
|
for (const line of lines) {
|
|
3101
3137
|
if (change.added) {
|
|
3102
|
-
console.log(
|
|
3138
|
+
console.log(chalk28.green(`+ ${line}`));
|
|
3103
3139
|
} else if (change.removed) {
|
|
3104
|
-
console.log(
|
|
3140
|
+
console.log(chalk28.red(`- ${line}`));
|
|
3105
3141
|
} else {
|
|
3106
|
-
console.log(
|
|
3142
|
+
console.log(chalk28.dim(` ${line}`));
|
|
3107
3143
|
}
|
|
3108
3144
|
}
|
|
3109
3145
|
}
|
|
@@ -3137,10 +3173,10 @@ async function init() {
|
|
|
3137
3173
|
console.log("biome.json already has the correct linter config");
|
|
3138
3174
|
return;
|
|
3139
3175
|
}
|
|
3140
|
-
console.log(
|
|
3176
|
+
console.log(chalk29.yellow("\n\u26A0\uFE0F biome.json will be updated:"));
|
|
3141
3177
|
console.log();
|
|
3142
3178
|
printDiff(oldContent, newContent);
|
|
3143
|
-
const confirm = await promptConfirm(
|
|
3179
|
+
const confirm = await promptConfirm(chalk29.red("Update biome.json?"));
|
|
3144
3180
|
if (!confirm) {
|
|
3145
3181
|
console.log("Skipped biome.json update");
|
|
3146
3182
|
return;
|
|
@@ -3151,7 +3187,7 @@ async function init() {
|
|
|
3151
3187
|
|
|
3152
3188
|
// src/commands/verify/setup/setupLint.ts
|
|
3153
3189
|
async function setupLint(packageJsonPath, writer) {
|
|
3154
|
-
console.log(
|
|
3190
|
+
console.log(chalk30.blue("\nSetting up biome..."));
|
|
3155
3191
|
const cwd = path8.dirname(packageJsonPath);
|
|
3156
3192
|
const pkg = readPackageJson(packageJsonPath);
|
|
3157
3193
|
if (!pkg.devDependencies?.["@biomejs/biome"]) {
|
|
@@ -3165,17 +3201,17 @@ async function setupLint(packageJsonPath, writer) {
|
|
|
3165
3201
|
|
|
3166
3202
|
// src/commands/verify/setup/setupMaintainability.ts
|
|
3167
3203
|
import * as path9 from "path";
|
|
3168
|
-
import
|
|
3204
|
+
import chalk31 from "chalk";
|
|
3169
3205
|
async function setupMaintainability(packageJsonPath, writer) {
|
|
3170
|
-
console.log(
|
|
3206
|
+
console.log(chalk31.blue("\nSetting up maintainability check..."));
|
|
3171
3207
|
addToKnipIgnoreBinaries(path9.dirname(packageJsonPath), "assist");
|
|
3172
3208
|
writer("verify:maintainability", expectedScripts["verify:maintainability"]);
|
|
3173
3209
|
}
|
|
3174
3210
|
|
|
3175
3211
|
// src/commands/verify/setup/setupSkott.ts
|
|
3176
|
-
import
|
|
3212
|
+
import chalk32 from "chalk";
|
|
3177
3213
|
async function setupSkott(_packageJsonPath, writer) {
|
|
3178
|
-
console.log(
|
|
3214
|
+
console.log(chalk32.blue("\nSetting up circular dependency check..."));
|
|
3179
3215
|
writer("verify:circular-deps", expectedScripts["verify:circular-deps"], {
|
|
3180
3216
|
quiet: true
|
|
3181
3217
|
});
|
|
@@ -3183,9 +3219,9 @@ async function setupSkott(_packageJsonPath, writer) {
|
|
|
3183
3219
|
|
|
3184
3220
|
// src/commands/verify/setup/setupTest.ts
|
|
3185
3221
|
import * as path10 from "path";
|
|
3186
|
-
import
|
|
3222
|
+
import chalk33 from "chalk";
|
|
3187
3223
|
async function setupTest(packageJsonPath, writer) {
|
|
3188
|
-
console.log(
|
|
3224
|
+
console.log(chalk33.blue("\nSetting up vitest..."));
|
|
3189
3225
|
const cwd = path10.dirname(packageJsonPath);
|
|
3190
3226
|
const pkg = readPackageJson(packageJsonPath);
|
|
3191
3227
|
if (!pkg.devDependencies?.vitest && !installPackage("vitest", cwd)) {
|
|
@@ -3351,25 +3387,25 @@ async function runSelectedSetups(selected, packageJsonPath, writer, handlers2) {
|
|
|
3351
3387
|
for (const choice of selected) {
|
|
3352
3388
|
await handlers2[choice]?.(packageJsonPath, writer);
|
|
3353
3389
|
}
|
|
3354
|
-
console.log(
|
|
3390
|
+
console.log(chalk34.green(`
|
|
3355
3391
|
Added ${selected.length} verify script(s):`));
|
|
3356
3392
|
for (const choice of selected) {
|
|
3357
|
-
console.log(
|
|
3393
|
+
console.log(chalk34.green(` - verify:${choice}`));
|
|
3358
3394
|
}
|
|
3359
|
-
console.log(
|
|
3395
|
+
console.log(chalk34.dim("\nRun 'assist verify' to run all verify scripts"));
|
|
3360
3396
|
}
|
|
3361
3397
|
async function promptForScripts(availableOptions) {
|
|
3362
3398
|
if (availableOptions.length === 0) {
|
|
3363
|
-
console.log(
|
|
3399
|
+
console.log(chalk34.green("All verify scripts are already configured!"));
|
|
3364
3400
|
return null;
|
|
3365
3401
|
}
|
|
3366
|
-
console.log(
|
|
3402
|
+
console.log(chalk34.bold("Available verify scripts to add:\n"));
|
|
3367
3403
|
const selected = await promptMultiselect(
|
|
3368
3404
|
"Select verify scripts to add:",
|
|
3369
3405
|
availableOptions
|
|
3370
3406
|
);
|
|
3371
3407
|
if (selected.length === 0) {
|
|
3372
|
-
console.log(
|
|
3408
|
+
console.log(chalk34.yellow("No scripts selected"));
|
|
3373
3409
|
return null;
|
|
3374
3410
|
}
|
|
3375
3411
|
return selected;
|
|
@@ -3389,17 +3425,17 @@ async function init2(options2 = {}) {
|
|
|
3389
3425
|
}
|
|
3390
3426
|
|
|
3391
3427
|
// src/commands/vscode/init/index.ts
|
|
3392
|
-
import
|
|
3428
|
+
import chalk36 from "chalk";
|
|
3393
3429
|
|
|
3394
3430
|
// src/commands/vscode/init/createLaunchJson.ts
|
|
3395
3431
|
import * as fs4 from "fs";
|
|
3396
3432
|
import * as path11 from "path";
|
|
3397
|
-
import
|
|
3433
|
+
import chalk35 from "chalk";
|
|
3398
3434
|
function ensureVscodeFolder() {
|
|
3399
3435
|
const vscodeDir = path11.join(process.cwd(), ".vscode");
|
|
3400
3436
|
if (!fs4.existsSync(vscodeDir)) {
|
|
3401
3437
|
fs4.mkdirSync(vscodeDir);
|
|
3402
|
-
console.log(
|
|
3438
|
+
console.log(chalk35.dim("Created .vscode folder"));
|
|
3403
3439
|
}
|
|
3404
3440
|
}
|
|
3405
3441
|
function removeVscodeFromGitignore() {
|
|
@@ -3414,7 +3450,7 @@ function removeVscodeFromGitignore() {
|
|
|
3414
3450
|
);
|
|
3415
3451
|
if (filteredLines.length !== lines.length) {
|
|
3416
3452
|
fs4.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
3417
|
-
console.log(
|
|
3453
|
+
console.log(chalk35.dim("Removed .vscode references from .gitignore"));
|
|
3418
3454
|
}
|
|
3419
3455
|
}
|
|
3420
3456
|
function createLaunchJson(type) {
|
|
@@ -3433,7 +3469,7 @@ function createLaunchJson(type) {
|
|
|
3433
3469
|
const launchPath = path11.join(process.cwd(), ".vscode", "launch.json");
|
|
3434
3470
|
fs4.writeFileSync(launchPath, `${JSON.stringify(launchConfig, null, " ")}
|
|
3435
3471
|
`);
|
|
3436
|
-
console.log(
|
|
3472
|
+
console.log(chalk35.green("Created .vscode/launch.json"));
|
|
3437
3473
|
}
|
|
3438
3474
|
function createSettingsJson() {
|
|
3439
3475
|
const settings = {
|
|
@@ -3446,7 +3482,7 @@ function createSettingsJson() {
|
|
|
3446
3482
|
const settingsPath = path11.join(process.cwd(), ".vscode", "settings.json");
|
|
3447
3483
|
fs4.writeFileSync(settingsPath, `${JSON.stringify(settings, null, " ")}
|
|
3448
3484
|
`);
|
|
3449
|
-
console.log(
|
|
3485
|
+
console.log(chalk35.green("Created .vscode/settings.json"));
|
|
3450
3486
|
}
|
|
3451
3487
|
function createExtensionsJson() {
|
|
3452
3488
|
const extensions = {
|
|
@@ -3458,7 +3494,7 @@ function createExtensionsJson() {
|
|
|
3458
3494
|
`${JSON.stringify(extensions, null, " ")}
|
|
3459
3495
|
`
|
|
3460
3496
|
);
|
|
3461
|
-
console.log(
|
|
3497
|
+
console.log(chalk35.green("Created .vscode/extensions.json"));
|
|
3462
3498
|
}
|
|
3463
3499
|
|
|
3464
3500
|
// src/commands/vscode/init/detectVscodeSetup.ts
|
|
@@ -3515,7 +3551,7 @@ function applySelections(selected, setup2) {
|
|
|
3515
3551
|
for (const choice of selected) handlers2[choice]?.();
|
|
3516
3552
|
}
|
|
3517
3553
|
async function promptForOptions(options2) {
|
|
3518
|
-
console.log(
|
|
3554
|
+
console.log(chalk36.bold("Available VS Code configurations to add:\n"));
|
|
3519
3555
|
return promptMultiselect("Select configurations to add:", options2);
|
|
3520
3556
|
}
|
|
3521
3557
|
async function init3({ all = false } = {}) {
|
|
@@ -3523,17 +3559,17 @@ async function init3({ all = false } = {}) {
|
|
|
3523
3559
|
const setup2 = detectVscodeSetup(pkg);
|
|
3524
3560
|
const options2 = getAvailableOptions2(setup2);
|
|
3525
3561
|
if (options2.length === 0) {
|
|
3526
|
-
console.log(
|
|
3562
|
+
console.log(chalk36.green("VS Code configuration already exists!"));
|
|
3527
3563
|
return;
|
|
3528
3564
|
}
|
|
3529
3565
|
const selected = all ? options2.map((o) => o.value) : await promptForOptions(options2);
|
|
3530
3566
|
if (selected.length === 0) {
|
|
3531
|
-
console.log(
|
|
3567
|
+
console.log(chalk36.yellow("No configurations selected"));
|
|
3532
3568
|
return;
|
|
3533
3569
|
}
|
|
3534
3570
|
applySelections(selected, setup2);
|
|
3535
3571
|
console.log(
|
|
3536
|
-
|
|
3572
|
+
chalk36.green(`
|
|
3537
3573
|
Added ${selected.length} VS Code configuration(s)`)
|
|
3538
3574
|
);
|
|
3539
3575
|
}
|
|
@@ -3546,7 +3582,7 @@ async function init4() {
|
|
|
3546
3582
|
|
|
3547
3583
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
3548
3584
|
import path18 from "path";
|
|
3549
|
-
import
|
|
3585
|
+
import chalk38 from "chalk";
|
|
3550
3586
|
|
|
3551
3587
|
// src/commands/lint/lint/checkFileNames.ts
|
|
3552
3588
|
import fs7 from "fs";
|
|
@@ -3626,7 +3662,7 @@ function checkFileNames() {
|
|
|
3626
3662
|
}
|
|
3627
3663
|
|
|
3628
3664
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
3629
|
-
import
|
|
3665
|
+
import chalk37 from "chalk";
|
|
3630
3666
|
|
|
3631
3667
|
// src/commands/lint/lint/applyMoves.ts
|
|
3632
3668
|
import fs8 from "fs";
|
|
@@ -3711,25 +3747,25 @@ function fixFileNameViolations(moves) {
|
|
|
3711
3747
|
const start3 = performance.now();
|
|
3712
3748
|
const project = createLintProject();
|
|
3713
3749
|
const cwd = process.cwd();
|
|
3714
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
3750
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk37.green(line)));
|
|
3715
3751
|
const ms = (performance.now() - start3).toFixed(0);
|
|
3716
|
-
console.log(
|
|
3752
|
+
console.log(chalk37.dim(` Done in ${ms}ms`));
|
|
3717
3753
|
}
|
|
3718
3754
|
|
|
3719
3755
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
3720
3756
|
function reportViolations(violations) {
|
|
3721
|
-
console.error(
|
|
3757
|
+
console.error(chalk38.red("\nFile name check failed:\n"));
|
|
3722
3758
|
console.error(
|
|
3723
|
-
|
|
3759
|
+
chalk38.red(
|
|
3724
3760
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
3725
3761
|
)
|
|
3726
3762
|
);
|
|
3727
3763
|
for (const violation of violations) {
|
|
3728
|
-
console.error(
|
|
3729
|
-
console.error(
|
|
3764
|
+
console.error(chalk38.red(` ${violation.filePath}`));
|
|
3765
|
+
console.error(chalk38.gray(` Rename to: ${violation.suggestedName}
|
|
3730
3766
|
`));
|
|
3731
3767
|
}
|
|
3732
|
-
console.error(
|
|
3768
|
+
console.error(chalk38.dim(" Run with -f to auto-fix.\n"));
|
|
3733
3769
|
}
|
|
3734
3770
|
function runFileNameCheck(fix = false) {
|
|
3735
3771
|
const violations = checkFileNames();
|
|
@@ -3758,17 +3794,17 @@ function runFileNameCheck(fix = false) {
|
|
|
3758
3794
|
import fs10 from "fs";
|
|
3759
3795
|
|
|
3760
3796
|
// src/commands/lint/shared.ts
|
|
3761
|
-
import
|
|
3797
|
+
import chalk39 from "chalk";
|
|
3762
3798
|
function reportViolations2(violations, checkName, errorMessage, successMessage) {
|
|
3763
3799
|
if (violations.length > 0) {
|
|
3764
|
-
console.error(
|
|
3800
|
+
console.error(chalk39.red(`
|
|
3765
3801
|
${checkName} failed:
|
|
3766
3802
|
`));
|
|
3767
|
-
console.error(
|
|
3803
|
+
console.error(chalk39.red(` ${errorMessage}
|
|
3768
3804
|
`));
|
|
3769
3805
|
for (const violation of violations) {
|
|
3770
|
-
console.error(
|
|
3771
|
-
console.error(
|
|
3806
|
+
console.error(chalk39.red(` ${violation.filePath}:${violation.line}`));
|
|
3807
|
+
console.error(chalk39.gray(` ${violation.content}
|
|
3772
3808
|
`));
|
|
3773
3809
|
}
|
|
3774
3810
|
return false;
|
|
@@ -4259,14 +4295,14 @@ import { existsSync as existsSync20, readFileSync as readFileSync15, writeFileSy
|
|
|
4259
4295
|
|
|
4260
4296
|
// src/commands/deploy/init/index.ts
|
|
4261
4297
|
import { execSync as execSync13 } from "child_process";
|
|
4262
|
-
import
|
|
4298
|
+
import chalk41 from "chalk";
|
|
4263
4299
|
import enquirer6 from "enquirer";
|
|
4264
4300
|
|
|
4265
4301
|
// src/commands/deploy/init/updateWorkflow.ts
|
|
4266
4302
|
import { existsSync as existsSync19, mkdirSync as mkdirSync4, readFileSync as readFileSync14, writeFileSync as writeFileSync13 } from "fs";
|
|
4267
4303
|
import { dirname as dirname16, join as join17 } from "path";
|
|
4268
4304
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4269
|
-
import
|
|
4305
|
+
import chalk40 from "chalk";
|
|
4270
4306
|
var WORKFLOW_PATH = ".github/workflows/build.yml";
|
|
4271
4307
|
var __dirname4 = dirname16(fileURLToPath4(import.meta.url));
|
|
4272
4308
|
function getExistingSiteId() {
|
|
@@ -4291,20 +4327,20 @@ async function updateWorkflow(siteId) {
|
|
|
4291
4327
|
if (existsSync19(WORKFLOW_PATH)) {
|
|
4292
4328
|
const oldContent = readFileSync14(WORKFLOW_PATH, "utf-8");
|
|
4293
4329
|
if (oldContent === newContent) {
|
|
4294
|
-
console.log(
|
|
4330
|
+
console.log(chalk40.green("build.yml is already up to date"));
|
|
4295
4331
|
return;
|
|
4296
4332
|
}
|
|
4297
|
-
console.log(
|
|
4333
|
+
console.log(chalk40.yellow("\nbuild.yml will be updated:"));
|
|
4298
4334
|
console.log();
|
|
4299
4335
|
printDiff(oldContent, newContent);
|
|
4300
|
-
const confirm = await promptConfirm(
|
|
4336
|
+
const confirm = await promptConfirm(chalk40.red("Update build.yml?"));
|
|
4301
4337
|
if (!confirm) {
|
|
4302
4338
|
console.log("Skipped build.yml update");
|
|
4303
4339
|
return;
|
|
4304
4340
|
}
|
|
4305
4341
|
}
|
|
4306
4342
|
writeFileSync13(WORKFLOW_PATH, newContent);
|
|
4307
|
-
console.log(
|
|
4343
|
+
console.log(chalk40.green(`
|
|
4308
4344
|
Created ${WORKFLOW_PATH}`));
|
|
4309
4345
|
}
|
|
4310
4346
|
|
|
@@ -4315,43 +4351,43 @@ async function ensureNetlifyCli() {
|
|
|
4315
4351
|
} catch (error) {
|
|
4316
4352
|
if (!(error instanceof Error) || !error.message.includes("command not found"))
|
|
4317
4353
|
throw error;
|
|
4318
|
-
console.error(
|
|
4354
|
+
console.error(chalk41.red("\nNetlify CLI is not installed.\n"));
|
|
4319
4355
|
const install = await promptConfirm("Would you like to install it now?");
|
|
4320
4356
|
if (!install) {
|
|
4321
4357
|
console.log(
|
|
4322
|
-
|
|
4358
|
+
chalk41.yellow(
|
|
4323
4359
|
"\nInstall it manually with: npm install -g netlify-cli\n"
|
|
4324
4360
|
)
|
|
4325
4361
|
);
|
|
4326
4362
|
process.exit(1);
|
|
4327
4363
|
}
|
|
4328
|
-
console.log(
|
|
4364
|
+
console.log(chalk41.dim("\nInstalling netlify-cli...\n"));
|
|
4329
4365
|
execSync13("npm install -g netlify-cli", { stdio: "inherit" });
|
|
4330
4366
|
console.log();
|
|
4331
4367
|
execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
|
|
4332
4368
|
}
|
|
4333
4369
|
}
|
|
4334
4370
|
function printSetupInstructions() {
|
|
4335
|
-
console.log(
|
|
4371
|
+
console.log(chalk41.bold("\nDeployment initialized successfully!"));
|
|
4336
4372
|
console.log(
|
|
4337
|
-
|
|
4373
|
+
chalk41.yellow("\nTo complete setup, create a personal access token at:")
|
|
4338
4374
|
);
|
|
4339
4375
|
console.log(
|
|
4340
|
-
|
|
4376
|
+
chalk41.cyan(
|
|
4341
4377
|
"https://app.netlify.com/user/applications#personal-access-tokens"
|
|
4342
4378
|
)
|
|
4343
4379
|
);
|
|
4344
4380
|
console.log(
|
|
4345
|
-
|
|
4381
|
+
chalk41.yellow(
|
|
4346
4382
|
"\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets."
|
|
4347
4383
|
)
|
|
4348
4384
|
);
|
|
4349
4385
|
}
|
|
4350
4386
|
async function init5() {
|
|
4351
|
-
console.log(
|
|
4387
|
+
console.log(chalk41.bold("Initializing Netlify deployment...\n"));
|
|
4352
4388
|
const existingSiteId = getExistingSiteId();
|
|
4353
4389
|
if (existingSiteId) {
|
|
4354
|
-
console.log(
|
|
4390
|
+
console.log(chalk41.dim(`Using existing site ID: ${existingSiteId}
|
|
4355
4391
|
`));
|
|
4356
4392
|
await updateWorkflow(existingSiteId);
|
|
4357
4393
|
return;
|
|
@@ -4629,27 +4665,27 @@ function registerActivity(program2) {
|
|
|
4629
4665
|
}
|
|
4630
4666
|
|
|
4631
4667
|
// src/commands/backlog/comment/index.ts
|
|
4632
|
-
import
|
|
4668
|
+
import chalk42 from "chalk";
|
|
4633
4669
|
function comment(id, text) {
|
|
4634
4670
|
const result = loadAndFindItem(id);
|
|
4635
4671
|
if (!result) process.exit(1);
|
|
4636
4672
|
addComment(result.item, text);
|
|
4637
4673
|
saveBacklog(result.items);
|
|
4638
|
-
console.log(
|
|
4674
|
+
console.log(chalk42.green(`Comment added to item #${id}.`));
|
|
4639
4675
|
}
|
|
4640
4676
|
|
|
4641
4677
|
// src/commands/backlog/comments/index.ts
|
|
4642
|
-
import
|
|
4678
|
+
import chalk43 from "chalk";
|
|
4643
4679
|
function comments(id) {
|
|
4644
4680
|
const result = loadAndFindItem(id);
|
|
4645
4681
|
if (!result) process.exit(1);
|
|
4646
4682
|
const { item } = result;
|
|
4647
4683
|
const entries = item.comments ?? [];
|
|
4648
4684
|
if (entries.length === 0) {
|
|
4649
|
-
console.log(
|
|
4685
|
+
console.log(chalk43.dim(`No comments on item #${id}.`));
|
|
4650
4686
|
return;
|
|
4651
4687
|
}
|
|
4652
|
-
console.log(
|
|
4688
|
+
console.log(chalk43.bold(`Comments for #${id}: ${item.name}
|
|
4653
4689
|
`));
|
|
4654
4690
|
for (const entry of entries) {
|
|
4655
4691
|
console.log(`${formatComment(entry)}
|
|
@@ -4658,7 +4694,7 @@ function comments(id) {
|
|
|
4658
4694
|
}
|
|
4659
4695
|
|
|
4660
4696
|
// src/commands/backlog/delete-comment/index.ts
|
|
4661
|
-
import
|
|
4697
|
+
import chalk44 from "chalk";
|
|
4662
4698
|
|
|
4663
4699
|
// src/commands/backlog/deleteComment.ts
|
|
4664
4700
|
function deleteComment(db, itemId, commentId) {
|
|
@@ -4687,16 +4723,16 @@ function deleteCommentCmd(id, commentId) {
|
|
|
4687
4723
|
case "deleted":
|
|
4688
4724
|
exportToJsonl(db, dir);
|
|
4689
4725
|
console.log(
|
|
4690
|
-
|
|
4726
|
+
chalk44.green(`Comment #${commentId} deleted from item #${id}.`)
|
|
4691
4727
|
);
|
|
4692
4728
|
break;
|
|
4693
4729
|
case "not-found":
|
|
4694
|
-
console.log(
|
|
4730
|
+
console.log(chalk44.red(`Comment #${commentId} not found on item #${id}.`));
|
|
4695
4731
|
process.exit(1);
|
|
4696
4732
|
break;
|
|
4697
4733
|
case "is-summary":
|
|
4698
4734
|
console.log(
|
|
4699
|
-
|
|
4735
|
+
chalk44.red(
|
|
4700
4736
|
`Comment #${commentId} is a phase summary and cannot be deleted.`
|
|
4701
4737
|
)
|
|
4702
4738
|
);
|
|
@@ -4713,17 +4749,17 @@ function registerCommentCommands(cmd) {
|
|
|
4713
4749
|
}
|
|
4714
4750
|
|
|
4715
4751
|
// src/commands/backlog/add/index.ts
|
|
4716
|
-
import
|
|
4752
|
+
import chalk46 from "chalk";
|
|
4717
4753
|
|
|
4718
4754
|
// src/commands/backlog/commitBacklog.ts
|
|
4719
4755
|
import { execSync as execSync16 } from "child_process";
|
|
4720
4756
|
import { join as join18 } from "path";
|
|
4721
|
-
import
|
|
4757
|
+
import chalk45 from "chalk";
|
|
4722
4758
|
function commitBacklog(id, name) {
|
|
4723
4759
|
const config = loadConfig();
|
|
4724
4760
|
if (!config.backlog.autoCommit) {
|
|
4725
4761
|
console.log(
|
|
4726
|
-
|
|
4762
|
+
chalk45.yellow(
|
|
4727
4763
|
"Warning: auto-commit is disabled. Stage and commit the backlog file manually."
|
|
4728
4764
|
)
|
|
4729
4765
|
);
|
|
@@ -4735,7 +4771,7 @@ function commitBacklog(id, name) {
|
|
|
4735
4771
|
execSync16(`git add ${shellQuote(jsonlPath)}`, { stdio: "ignore" });
|
|
4736
4772
|
execSync16(`git commit -m ${shellQuote(message)}`, { stdio: "ignore" });
|
|
4737
4773
|
} catch {
|
|
4738
|
-
console.log(
|
|
4774
|
+
console.log(chalk45.yellow("Warning: could not auto-commit backlog file."));
|
|
4739
4775
|
}
|
|
4740
4776
|
}
|
|
4741
4777
|
|
|
@@ -4827,12 +4863,12 @@ async function addFromOptions(options2) {
|
|
|
4827
4863
|
});
|
|
4828
4864
|
saveBacklog(items);
|
|
4829
4865
|
commitBacklog(id, name);
|
|
4830
|
-
console.log(
|
|
4866
|
+
console.log(chalk46.green(`Added item #${id}: ${name}`));
|
|
4831
4867
|
}
|
|
4832
4868
|
async function add(options2) {
|
|
4833
4869
|
if (!backlogExists()) {
|
|
4834
4870
|
console.log(
|
|
4835
|
-
|
|
4871
|
+
chalk46.yellow(
|
|
4836
4872
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4837
4873
|
)
|
|
4838
4874
|
);
|
|
@@ -4842,7 +4878,7 @@ async function add(options2) {
|
|
|
4842
4878
|
}
|
|
4843
4879
|
|
|
4844
4880
|
// src/commands/backlog/addPhase.ts
|
|
4845
|
-
import
|
|
4881
|
+
import chalk48 from "chalk";
|
|
4846
4882
|
|
|
4847
4883
|
// src/commands/backlog/insertPhaseAt.ts
|
|
4848
4884
|
function insertPhaseAt(db, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
|
|
@@ -4879,14 +4915,14 @@ function insertPhaseAt(db, itemId, phaseIdx, name, tasks, manualChecks, currentP
|
|
|
4879
4915
|
}
|
|
4880
4916
|
|
|
4881
4917
|
// src/commands/backlog/resolveInsertPosition.ts
|
|
4882
|
-
import
|
|
4918
|
+
import chalk47 from "chalk";
|
|
4883
4919
|
function resolveInsertPosition(db, itemId, position) {
|
|
4884
4920
|
const { cnt: phaseCount } = db.prepare("SELECT COUNT(*) as cnt FROM plan_phases WHERE item_id = ?").get(itemId);
|
|
4885
4921
|
if (position === void 0) return phaseCount;
|
|
4886
4922
|
const pos = Number.parseInt(position, 10);
|
|
4887
4923
|
if (pos < 1 || pos > phaseCount + 1) {
|
|
4888
4924
|
console.log(
|
|
4889
|
-
|
|
4925
|
+
chalk47.red(
|
|
4890
4926
|
`Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
|
|
4891
4927
|
)
|
|
4892
4928
|
);
|
|
@@ -4907,7 +4943,7 @@ function addPhase(id, name, options2) {
|
|
|
4907
4943
|
if (!result) return;
|
|
4908
4944
|
const tasks = options2.task ?? [];
|
|
4909
4945
|
if (tasks.length === 0) {
|
|
4910
|
-
console.log(
|
|
4946
|
+
console.log(chalk48.red("At least one --task is required."));
|
|
4911
4947
|
process.exitCode = 1;
|
|
4912
4948
|
return;
|
|
4913
4949
|
}
|
|
@@ -4929,25 +4965,25 @@ function addPhase(id, name, options2) {
|
|
|
4929
4965
|
commitBacklog(itemId, result.item.name);
|
|
4930
4966
|
const verb = options2.position !== void 0 ? "Inserted" : "Added";
|
|
4931
4967
|
console.log(
|
|
4932
|
-
|
|
4968
|
+
chalk48.green(
|
|
4933
4969
|
`${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
|
|
4934
4970
|
)
|
|
4935
4971
|
);
|
|
4936
4972
|
}
|
|
4937
4973
|
|
|
4938
4974
|
// src/commands/backlog/init/index.ts
|
|
4939
|
-
import
|
|
4975
|
+
import chalk49 from "chalk";
|
|
4940
4976
|
async function init6() {
|
|
4941
4977
|
if (backlogExists()) {
|
|
4942
|
-
console.log(
|
|
4978
|
+
console.log(chalk49.yellow("Backlog already exists."));
|
|
4943
4979
|
return;
|
|
4944
4980
|
}
|
|
4945
4981
|
saveBacklog([]);
|
|
4946
|
-
console.log(
|
|
4982
|
+
console.log(chalk49.green("Created backlog."));
|
|
4947
4983
|
}
|
|
4948
4984
|
|
|
4949
4985
|
// src/commands/backlog/list/index.ts
|
|
4950
|
-
import
|
|
4986
|
+
import chalk50 from "chalk";
|
|
4951
4987
|
function filterItems(items, options2) {
|
|
4952
4988
|
if (options2.status) return items.filter((i) => i.status === options2.status);
|
|
4953
4989
|
if (!options2.all)
|
|
@@ -4957,7 +4993,7 @@ function filterItems(items, options2) {
|
|
|
4957
4993
|
async function list2(options2) {
|
|
4958
4994
|
if (!backlogExists()) {
|
|
4959
4995
|
console.log(
|
|
4960
|
-
|
|
4996
|
+
chalk50.yellow(
|
|
4961
4997
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
4962
4998
|
)
|
|
4963
4999
|
);
|
|
@@ -4966,12 +5002,12 @@ async function list2(options2) {
|
|
|
4966
5002
|
const allItems = loadBacklog();
|
|
4967
5003
|
const items = filterItems(allItems, options2);
|
|
4968
5004
|
if (items.length === 0) {
|
|
4969
|
-
console.log(
|
|
5005
|
+
console.log(chalk50.dim("Backlog is empty."));
|
|
4970
5006
|
return;
|
|
4971
5007
|
}
|
|
4972
5008
|
for (const item of items) {
|
|
4973
5009
|
console.log(
|
|
4974
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
5010
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk50.dim(`#${item.id}`)} ${item.name}${phaseLabel(item)}${dependencyLabel(item, allItems)}`
|
|
4975
5011
|
);
|
|
4976
5012
|
if (options2.verbose) {
|
|
4977
5013
|
printVerboseDetails(item);
|
|
@@ -4997,7 +5033,7 @@ function registerItemCommands(cmd) {
|
|
|
4997
5033
|
}
|
|
4998
5034
|
|
|
4999
5035
|
// src/commands/backlog/link.ts
|
|
5000
|
-
import
|
|
5036
|
+
import chalk52 from "chalk";
|
|
5001
5037
|
|
|
5002
5038
|
// src/commands/backlog/hasCycle.ts
|
|
5003
5039
|
function hasCycle(items, fromId, toId) {
|
|
@@ -5020,11 +5056,11 @@ function hasCycle(items, fromId, toId) {
|
|
|
5020
5056
|
}
|
|
5021
5057
|
|
|
5022
5058
|
// src/commands/backlog/validateLinkTarget.ts
|
|
5023
|
-
import
|
|
5059
|
+
import chalk51 from "chalk";
|
|
5024
5060
|
function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
5025
5061
|
const toItem = items.find((i) => i.id === toNum);
|
|
5026
5062
|
if (!toItem) {
|
|
5027
|
-
console.log(
|
|
5063
|
+
console.log(chalk51.red(`Item #${toId} not found.`));
|
|
5028
5064
|
return void 0;
|
|
5029
5065
|
}
|
|
5030
5066
|
if (!fromItem.links) fromItem.links = [];
|
|
@@ -5033,7 +5069,7 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
5033
5069
|
);
|
|
5034
5070
|
if (duplicate) {
|
|
5035
5071
|
console.log(
|
|
5036
|
-
|
|
5072
|
+
chalk51.yellow(`Link already exists: #${fromId} ${linkType} #${toId}`)
|
|
5037
5073
|
);
|
|
5038
5074
|
return void 0;
|
|
5039
5075
|
}
|
|
@@ -5044,13 +5080,13 @@ function validateLinkTarget(items, fromItem, fromId, toId, toNum, linkType) {
|
|
|
5044
5080
|
function link(fromId, toId, opts) {
|
|
5045
5081
|
const linkType = opts.type ?? "relates-to";
|
|
5046
5082
|
if (linkType !== "relates-to" && linkType !== "depends-on") {
|
|
5047
|
-
console.log(
|
|
5083
|
+
console.log(chalk52.red(`Invalid link type: ${linkType}`));
|
|
5048
5084
|
return;
|
|
5049
5085
|
}
|
|
5050
5086
|
const fromNum = Number.parseInt(fromId, 10);
|
|
5051
5087
|
const toNum = Number.parseInt(toId, 10);
|
|
5052
5088
|
if (fromNum === toNum) {
|
|
5053
|
-
console.log(
|
|
5089
|
+
console.log(chalk52.red("Cannot link an item to itself."));
|
|
5054
5090
|
return;
|
|
5055
5091
|
}
|
|
5056
5092
|
const result = loadAndFindItem(fromId);
|
|
@@ -5067,7 +5103,7 @@ function link(fromId, toId, opts) {
|
|
|
5067
5103
|
if (!toItem) return;
|
|
5068
5104
|
if (linkType === "depends-on" && hasCycle(items, fromNum, toNum)) {
|
|
5069
5105
|
console.log(
|
|
5070
|
-
|
|
5106
|
+
chalk52.red(
|
|
5071
5107
|
`Cannot add dependency: #${fromId} \u2192 #${toId} would create a circular dependency.`
|
|
5072
5108
|
)
|
|
5073
5109
|
);
|
|
@@ -5077,32 +5113,32 @@ function link(fromId, toId, opts) {
|
|
|
5077
5113
|
fromItem.links.push({ type: linkType, targetId: toNum });
|
|
5078
5114
|
saveBacklog(items);
|
|
5079
5115
|
console.log(
|
|
5080
|
-
|
|
5116
|
+
chalk52.green(`Linked #${fromId} ${linkType} #${toId} (${toItem.name})`)
|
|
5081
5117
|
);
|
|
5082
5118
|
}
|
|
5083
5119
|
|
|
5084
5120
|
// src/commands/backlog/unlink.ts
|
|
5085
|
-
import
|
|
5121
|
+
import chalk53 from "chalk";
|
|
5086
5122
|
function unlink(fromId, toId) {
|
|
5087
5123
|
const toNum = Number.parseInt(toId, 10);
|
|
5088
5124
|
const result = loadAndFindItem(fromId);
|
|
5089
5125
|
if (!result) return;
|
|
5090
5126
|
const { items, item: fromItem } = result;
|
|
5091
5127
|
if (!fromItem.links || fromItem.links.length === 0) {
|
|
5092
|
-
console.log(
|
|
5128
|
+
console.log(chalk53.yellow(`No links found on item #${fromId}.`));
|
|
5093
5129
|
return;
|
|
5094
5130
|
}
|
|
5095
5131
|
const before = fromItem.links.length;
|
|
5096
5132
|
fromItem.links = fromItem.links.filter((l) => l.targetId !== toNum);
|
|
5097
5133
|
if (fromItem.links.length === before) {
|
|
5098
|
-
console.log(
|
|
5134
|
+
console.log(chalk53.yellow(`No link from #${fromId} to #${toId} found.`));
|
|
5099
5135
|
return;
|
|
5100
5136
|
}
|
|
5101
5137
|
if (fromItem.links.length === 0) {
|
|
5102
5138
|
fromItem.links = void 0;
|
|
5103
5139
|
}
|
|
5104
5140
|
saveBacklog(items);
|
|
5105
|
-
console.log(
|
|
5141
|
+
console.log(chalk53.green(`Removed link from #${fromId} to #${toId}.`));
|
|
5106
5142
|
}
|
|
5107
5143
|
|
|
5108
5144
|
// src/commands/backlog/registerLinkCommands.ts
|
|
@@ -5116,7 +5152,7 @@ function registerLinkCommands(cmd) {
|
|
|
5116
5152
|
}
|
|
5117
5153
|
|
|
5118
5154
|
// src/commands/backlog/rewindPhase.ts
|
|
5119
|
-
import
|
|
5155
|
+
import chalk54 from "chalk";
|
|
5120
5156
|
function validateRewind2(item, phaseNumber) {
|
|
5121
5157
|
if (!item.plan || item.plan.length === 0) {
|
|
5122
5158
|
return `Item #${item.id} has no plan phases.`;
|
|
@@ -5138,7 +5174,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
5138
5174
|
const { item } = result;
|
|
5139
5175
|
const error = validateRewind2(item, phaseNumber);
|
|
5140
5176
|
if (error) {
|
|
5141
|
-
console.log(
|
|
5177
|
+
console.log(chalk54.red(error));
|
|
5142
5178
|
process.exitCode = 1;
|
|
5143
5179
|
return;
|
|
5144
5180
|
}
|
|
@@ -5156,7 +5192,7 @@ function rewindPhase(id, phase, opts) {
|
|
|
5156
5192
|
targetPhase: phaseIndex
|
|
5157
5193
|
});
|
|
5158
5194
|
console.log(
|
|
5159
|
-
|
|
5195
|
+
chalk54.green(`Rewound item #${id} to phase ${phaseNumber} (${phaseName}).`)
|
|
5160
5196
|
);
|
|
5161
5197
|
}
|
|
5162
5198
|
|
|
@@ -5173,11 +5209,11 @@ function registerRunCommand(cmd) {
|
|
|
5173
5209
|
}
|
|
5174
5210
|
|
|
5175
5211
|
// src/commands/backlog/search/index.ts
|
|
5176
|
-
import
|
|
5212
|
+
import chalk55 from "chalk";
|
|
5177
5213
|
async function search(query) {
|
|
5178
5214
|
if (!backlogExists()) {
|
|
5179
5215
|
console.log(
|
|
5180
|
-
|
|
5216
|
+
chalk55.yellow(
|
|
5181
5217
|
"No backlog found. Run 'assist backlog init' to create one."
|
|
5182
5218
|
)
|
|
5183
5219
|
);
|
|
@@ -5185,18 +5221,18 @@ async function search(query) {
|
|
|
5185
5221
|
}
|
|
5186
5222
|
const items = searchBacklog(query);
|
|
5187
5223
|
if (items.length === 0) {
|
|
5188
|
-
console.log(
|
|
5224
|
+
console.log(chalk55.dim(`No items matching "${query}".`));
|
|
5189
5225
|
return;
|
|
5190
5226
|
}
|
|
5191
5227
|
console.log(
|
|
5192
|
-
|
|
5228
|
+
chalk55.dim(
|
|
5193
5229
|
`${items.length} item${items.length === 1 ? "" : "s"} matching "${query}":
|
|
5194
5230
|
`
|
|
5195
5231
|
)
|
|
5196
5232
|
);
|
|
5197
5233
|
for (const item of items) {
|
|
5198
5234
|
console.log(
|
|
5199
|
-
`${statusIcon(item.status)} ${typeLabel(item.type)} ${
|
|
5235
|
+
`${statusIcon(item.status)} ${typeLabel(item.type)} ${chalk55.dim(`#${item.id}`)} ${item.name}`
|
|
5200
5236
|
);
|
|
5201
5237
|
}
|
|
5202
5238
|
}
|
|
@@ -5207,16 +5243,16 @@ function registerSearchCommand(cmd) {
|
|
|
5207
5243
|
}
|
|
5208
5244
|
|
|
5209
5245
|
// src/commands/backlog/delete/index.ts
|
|
5210
|
-
import
|
|
5246
|
+
import chalk56 from "chalk";
|
|
5211
5247
|
async function del(id) {
|
|
5212
5248
|
const name = removeItem(id);
|
|
5213
5249
|
if (name) {
|
|
5214
|
-
console.log(
|
|
5250
|
+
console.log(chalk56.green(`Deleted item #${id}: ${name}`));
|
|
5215
5251
|
}
|
|
5216
5252
|
}
|
|
5217
5253
|
|
|
5218
5254
|
// src/commands/backlog/done/index.ts
|
|
5219
|
-
import
|
|
5255
|
+
import chalk57 from "chalk";
|
|
5220
5256
|
async function done(id, summary) {
|
|
5221
5257
|
const result = loadAndFindItem(id);
|
|
5222
5258
|
if (!result) return;
|
|
@@ -5226,12 +5262,12 @@ async function done(id, summary) {
|
|
|
5226
5262
|
const pending = item.plan.slice(completedCount);
|
|
5227
5263
|
if (pending.length > 0) {
|
|
5228
5264
|
console.log(
|
|
5229
|
-
|
|
5265
|
+
chalk57.red(
|
|
5230
5266
|
`Cannot complete item #${id}: ${pending.length} pending phase(s):`
|
|
5231
5267
|
)
|
|
5232
5268
|
);
|
|
5233
5269
|
for (const phase of pending) {
|
|
5234
|
-
console.log(
|
|
5270
|
+
console.log(chalk57.yellow(` - ${phase.name}`));
|
|
5235
5271
|
}
|
|
5236
5272
|
process.exitCode = 1;
|
|
5237
5273
|
return;
|
|
@@ -5243,20 +5279,39 @@ async function done(id, summary) {
|
|
|
5243
5279
|
addPhaseSummary(item, summary, phase);
|
|
5244
5280
|
}
|
|
5245
5281
|
saveBacklog(result.items);
|
|
5246
|
-
console.log(
|
|
5282
|
+
console.log(chalk57.green(`Completed item #${id}: ${item.name}`));
|
|
5247
5283
|
}
|
|
5248
5284
|
|
|
5249
5285
|
// src/commands/backlog/start/index.ts
|
|
5250
|
-
import
|
|
5286
|
+
import chalk58 from "chalk";
|
|
5251
5287
|
async function start(id) {
|
|
5252
5288
|
const name = setStatus(id, "in-progress");
|
|
5253
5289
|
if (name) {
|
|
5254
|
-
console.log(
|
|
5290
|
+
console.log(chalk58.green(`Started item #${id}: ${name}`));
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
// src/commands/backlog/stop/index.ts
|
|
5295
|
+
import chalk59 from "chalk";
|
|
5296
|
+
async function stop() {
|
|
5297
|
+
const items = loadBacklog();
|
|
5298
|
+
const inProgress = items.filter((item) => item.status === "in-progress");
|
|
5299
|
+
if (inProgress.length === 0) {
|
|
5300
|
+
console.log(chalk59.yellow("No in-progress items to stop."));
|
|
5301
|
+
return;
|
|
5302
|
+
}
|
|
5303
|
+
for (const item of inProgress) {
|
|
5304
|
+
item.status = "todo";
|
|
5305
|
+
item.currentPhase = 1;
|
|
5306
|
+
}
|
|
5307
|
+
saveBacklog(items);
|
|
5308
|
+
for (const item of inProgress) {
|
|
5309
|
+
console.log(chalk59.yellow(`Stopped item #${item.id}: ${item.name}`));
|
|
5255
5310
|
}
|
|
5256
5311
|
}
|
|
5257
5312
|
|
|
5258
5313
|
// src/commands/backlog/wontdo/index.ts
|
|
5259
|
-
import
|
|
5314
|
+
import chalk60 from "chalk";
|
|
5260
5315
|
async function wontdo(id, reason) {
|
|
5261
5316
|
const result = loadAndFindItem(id);
|
|
5262
5317
|
if (!result) return;
|
|
@@ -5266,22 +5321,23 @@ async function wontdo(id, reason) {
|
|
|
5266
5321
|
addPhaseSummary(result.item, reason, phase);
|
|
5267
5322
|
}
|
|
5268
5323
|
saveBacklog(result.items);
|
|
5269
|
-
console.log(
|
|
5324
|
+
console.log(chalk60.red(`Won't do item #${id}: ${result.item.name}`));
|
|
5270
5325
|
}
|
|
5271
5326
|
|
|
5272
5327
|
// src/commands/backlog/registerStatusCommands.ts
|
|
5273
5328
|
function registerStatusCommands(cmd) {
|
|
5274
5329
|
cmd.command("start <id>").description("Set a backlog item to in-progress").action(start);
|
|
5330
|
+
cmd.command("stop").description("Revert all in-progress backlog items to todo").action(stop);
|
|
5275
5331
|
cmd.command("done <id> [summary]").description("Set a backlog item to done").action(done);
|
|
5276
5332
|
cmd.command("wontdo <id> [reason]").description("Set a backlog item to won't do").action(wontdo);
|
|
5277
5333
|
cmd.command("delete <id>").alias("remove").description("Delete a backlog item").action(del);
|
|
5278
5334
|
}
|
|
5279
5335
|
|
|
5280
5336
|
// src/commands/backlog/removePhase.ts
|
|
5281
|
-
import
|
|
5337
|
+
import chalk62 from "chalk";
|
|
5282
5338
|
|
|
5283
5339
|
// src/commands/backlog/findPhase.ts
|
|
5284
|
-
import
|
|
5340
|
+
import chalk61 from "chalk";
|
|
5285
5341
|
function findPhase(id, phase) {
|
|
5286
5342
|
const result = loadAndFindItem(id);
|
|
5287
5343
|
if (!result) return void 0;
|
|
@@ -5295,7 +5351,7 @@ function findPhase(id, phase) {
|
|
|
5295
5351
|
).get(itemId, phaseIdx);
|
|
5296
5352
|
if (existing.cnt === 0) {
|
|
5297
5353
|
console.log(
|
|
5298
|
-
|
|
5354
|
+
chalk61.red(`Phase ${phaseNumber} not found on item #${itemId}.`)
|
|
5299
5355
|
);
|
|
5300
5356
|
process.exitCode = 1;
|
|
5301
5357
|
return void 0;
|
|
@@ -5355,24 +5411,24 @@ function removePhase(id, phase) {
|
|
|
5355
5411
|
exportToJsonl(db, dir);
|
|
5356
5412
|
commitBacklog(itemId, result.item.name);
|
|
5357
5413
|
console.log(
|
|
5358
|
-
|
|
5414
|
+
chalk62.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
5359
5415
|
);
|
|
5360
5416
|
}
|
|
5361
5417
|
|
|
5362
5418
|
// src/commands/backlog/update/index.ts
|
|
5363
|
-
import
|
|
5419
|
+
import chalk64 from "chalk";
|
|
5364
5420
|
|
|
5365
5421
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
5366
|
-
import
|
|
5422
|
+
import chalk63 from "chalk";
|
|
5367
5423
|
function buildUpdateSql(options2) {
|
|
5368
5424
|
const { name, desc, type, ac } = options2;
|
|
5369
5425
|
if (!name && !desc && !type && !ac) {
|
|
5370
|
-
console.log(
|
|
5426
|
+
console.log(chalk63.red("Nothing to update. Provide at least one flag."));
|
|
5371
5427
|
process.exitCode = 1;
|
|
5372
5428
|
return void 0;
|
|
5373
5429
|
}
|
|
5374
5430
|
if (type && type !== "story" && type !== "bug") {
|
|
5375
|
-
console.log(
|
|
5431
|
+
console.log(chalk63.red('Invalid type. Must be "story" or "bug".'));
|
|
5376
5432
|
process.exitCode = 1;
|
|
5377
5433
|
return void 0;
|
|
5378
5434
|
}
|
|
@@ -5417,11 +5473,11 @@ function update(id, options2) {
|
|
|
5417
5473
|
);
|
|
5418
5474
|
exportToJsonl(db, dir);
|
|
5419
5475
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
5420
|
-
console.log(
|
|
5476
|
+
console.log(chalk64.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
5421
5477
|
}
|
|
5422
5478
|
|
|
5423
5479
|
// src/commands/backlog/updatePhase.ts
|
|
5424
|
-
import
|
|
5480
|
+
import chalk65 from "chalk";
|
|
5425
5481
|
|
|
5426
5482
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
5427
5483
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -5455,7 +5511,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
5455
5511
|
function updatePhase(id, phase, options2) {
|
|
5456
5512
|
const { name, task, manualCheck } = options2;
|
|
5457
5513
|
if (!name && !task && !manualCheck) {
|
|
5458
|
-
console.log(
|
|
5514
|
+
console.log(chalk65.red("Nothing to update. Provide at least one flag."));
|
|
5459
5515
|
process.exitCode = 1;
|
|
5460
5516
|
return;
|
|
5461
5517
|
}
|
|
@@ -5471,7 +5527,7 @@ function updatePhase(id, phase, options2) {
|
|
|
5471
5527
|
manualCheck && "manual checks"
|
|
5472
5528
|
].filter(Boolean).join(", ");
|
|
5473
5529
|
console.log(
|
|
5474
|
-
|
|
5530
|
+
chalk65.green(
|
|
5475
5531
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
5476
5532
|
)
|
|
5477
5533
|
);
|
|
@@ -6100,11 +6156,11 @@ function assertCliExists(cli) {
|
|
|
6100
6156
|
}
|
|
6101
6157
|
|
|
6102
6158
|
// src/commands/permitCliReads/colorize.ts
|
|
6103
|
-
import
|
|
6159
|
+
import chalk66 from "chalk";
|
|
6104
6160
|
function colorize(plainOutput) {
|
|
6105
6161
|
return plainOutput.split("\n").map((line) => {
|
|
6106
|
-
if (line.startsWith(" R ")) return
|
|
6107
|
-
if (line.startsWith(" W ")) return
|
|
6162
|
+
if (line.startsWith(" R ")) return chalk66.green(line);
|
|
6163
|
+
if (line.startsWith(" W ")) return chalk66.red(line);
|
|
6108
6164
|
return line;
|
|
6109
6165
|
}).join("\n");
|
|
6110
6166
|
}
|
|
@@ -6402,7 +6458,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
6402
6458
|
}
|
|
6403
6459
|
|
|
6404
6460
|
// src/commands/deny/denyAdd.ts
|
|
6405
|
-
import
|
|
6461
|
+
import chalk67 from "chalk";
|
|
6406
6462
|
|
|
6407
6463
|
// src/commands/deny/loadDenyConfig.ts
|
|
6408
6464
|
function loadDenyConfig(global) {
|
|
@@ -6422,16 +6478,16 @@ function loadDenyConfig(global) {
|
|
|
6422
6478
|
function denyAdd(pattern2, message, options2) {
|
|
6423
6479
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6424
6480
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
6425
|
-
console.log(
|
|
6481
|
+
console.log(chalk67.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
6426
6482
|
return;
|
|
6427
6483
|
}
|
|
6428
6484
|
deny.push({ pattern: pattern2, message });
|
|
6429
6485
|
saveDeny(deny);
|
|
6430
|
-
console.log(
|
|
6486
|
+
console.log(chalk67.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
6431
6487
|
}
|
|
6432
6488
|
|
|
6433
6489
|
// src/commands/deny/denyList.ts
|
|
6434
|
-
import
|
|
6490
|
+
import chalk68 from "chalk";
|
|
6435
6491
|
function denyList() {
|
|
6436
6492
|
const globalRaw = loadGlobalConfigRaw();
|
|
6437
6493
|
const projectRaw = loadProjectConfig();
|
|
@@ -6442,7 +6498,7 @@ function denyList() {
|
|
|
6442
6498
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
6443
6499
|
);
|
|
6444
6500
|
if (!merged || merged.length === 0) {
|
|
6445
|
-
console.log(
|
|
6501
|
+
console.log(chalk68.dim("No deny rules configured."));
|
|
6446
6502
|
return;
|
|
6447
6503
|
}
|
|
6448
6504
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -6450,23 +6506,23 @@ function denyList() {
|
|
|
6450
6506
|
for (const rule of merged) {
|
|
6451
6507
|
const inProject = projectPatterns.has(rule.pattern);
|
|
6452
6508
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
6453
|
-
const label2 = inProject && inGlobal ?
|
|
6454
|
-
console.log(`${
|
|
6509
|
+
const label2 = inProject && inGlobal ? chalk68.dim(" (project, overrides global)") : inGlobal ? chalk68.dim(" (global)") : "";
|
|
6510
|
+
console.log(`${chalk68.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
6455
6511
|
}
|
|
6456
6512
|
}
|
|
6457
6513
|
|
|
6458
6514
|
// src/commands/deny/denyRemove.ts
|
|
6459
|
-
import
|
|
6515
|
+
import chalk69 from "chalk";
|
|
6460
6516
|
function denyRemove(pattern2, options2) {
|
|
6461
6517
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6462
6518
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
6463
6519
|
if (index === -1) {
|
|
6464
|
-
console.log(
|
|
6520
|
+
console.log(chalk69.yellow(`No deny rule found for: ${pattern2}`));
|
|
6465
6521
|
return;
|
|
6466
6522
|
}
|
|
6467
6523
|
deny.splice(index, 1);
|
|
6468
6524
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
6469
|
-
console.log(
|
|
6525
|
+
console.log(chalk69.green(`Removed deny rule: ${pattern2}`));
|
|
6470
6526
|
}
|
|
6471
6527
|
|
|
6472
6528
|
// src/commands/registerDeny.ts
|
|
@@ -6495,15 +6551,15 @@ function registerCliHook(program2) {
|
|
|
6495
6551
|
}
|
|
6496
6552
|
|
|
6497
6553
|
// src/commands/complexity/analyze.ts
|
|
6498
|
-
import
|
|
6554
|
+
import chalk75 from "chalk";
|
|
6499
6555
|
|
|
6500
6556
|
// src/commands/complexity/cyclomatic.ts
|
|
6501
|
-
import
|
|
6557
|
+
import chalk71 from "chalk";
|
|
6502
6558
|
|
|
6503
6559
|
// src/commands/complexity/shared/index.ts
|
|
6504
6560
|
import fs14 from "fs";
|
|
6505
6561
|
import path22 from "path";
|
|
6506
|
-
import
|
|
6562
|
+
import chalk70 from "chalk";
|
|
6507
6563
|
import ts5 from "typescript";
|
|
6508
6564
|
|
|
6509
6565
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -6749,7 +6805,7 @@ function createSourceFromFile(filePath) {
|
|
|
6749
6805
|
function withSourceFiles(pattern2, callback) {
|
|
6750
6806
|
const files = findSourceFiles2(pattern2);
|
|
6751
6807
|
if (files.length === 0) {
|
|
6752
|
-
console.log(
|
|
6808
|
+
console.log(chalk70.yellow("No files found matching pattern"));
|
|
6753
6809
|
return void 0;
|
|
6754
6810
|
}
|
|
6755
6811
|
return callback(files);
|
|
@@ -6782,11 +6838,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6782
6838
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
6783
6839
|
for (const { file, name, complexity } of results) {
|
|
6784
6840
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
6785
|
-
const color = exceedsThreshold ?
|
|
6786
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
6841
|
+
const color = exceedsThreshold ? chalk71.red : chalk71.white;
|
|
6842
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk71.cyan(complexity)}`);
|
|
6787
6843
|
}
|
|
6788
6844
|
console.log(
|
|
6789
|
-
|
|
6845
|
+
chalk71.dim(
|
|
6790
6846
|
`
|
|
6791
6847
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6792
6848
|
)
|
|
@@ -6798,7 +6854,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6798
6854
|
}
|
|
6799
6855
|
|
|
6800
6856
|
// src/commands/complexity/halstead.ts
|
|
6801
|
-
import
|
|
6857
|
+
import chalk72 from "chalk";
|
|
6802
6858
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
6803
6859
|
withSourceFiles(pattern2, (files) => {
|
|
6804
6860
|
const results = [];
|
|
@@ -6813,13 +6869,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6813
6869
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
6814
6870
|
for (const { file, name, metrics } of results) {
|
|
6815
6871
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
6816
|
-
const color = exceedsThreshold ?
|
|
6872
|
+
const color = exceedsThreshold ? chalk72.red : chalk72.white;
|
|
6817
6873
|
console.log(
|
|
6818
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
6874
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk72.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk72.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk72.magenta(metrics.effort.toFixed(1))}`
|
|
6819
6875
|
);
|
|
6820
6876
|
}
|
|
6821
6877
|
console.log(
|
|
6822
|
-
|
|
6878
|
+
chalk72.dim(
|
|
6823
6879
|
`
|
|
6824
6880
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6825
6881
|
)
|
|
@@ -6834,28 +6890,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6834
6890
|
import fs15 from "fs";
|
|
6835
6891
|
|
|
6836
6892
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
6837
|
-
import
|
|
6893
|
+
import chalk73 from "chalk";
|
|
6838
6894
|
function displayMaintainabilityResults(results, threshold) {
|
|
6839
6895
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
6840
6896
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
6841
|
-
console.log(
|
|
6897
|
+
console.log(chalk73.green("All files pass maintainability threshold"));
|
|
6842
6898
|
} else {
|
|
6843
6899
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
6844
|
-
const color = threshold !== void 0 ?
|
|
6900
|
+
const color = threshold !== void 0 ? chalk73.red : chalk73.white;
|
|
6845
6901
|
console.log(
|
|
6846
|
-
`${color(file)} \u2192 avg: ${
|
|
6902
|
+
`${color(file)} \u2192 avg: ${chalk73.cyan(avgMaintainability.toFixed(1))}, min: ${chalk73.yellow(minMaintainability.toFixed(1))}`
|
|
6847
6903
|
);
|
|
6848
6904
|
}
|
|
6849
6905
|
}
|
|
6850
|
-
console.log(
|
|
6906
|
+
console.log(chalk73.dim(`
|
|
6851
6907
|
Analyzed ${results.length} files`));
|
|
6852
6908
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
6853
6909
|
console.error(
|
|
6854
|
-
|
|
6910
|
+
chalk73.red(
|
|
6855
6911
|
`
|
|
6856
6912
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
6857
6913
|
|
|
6858
|
-
\u26A0\uFE0F ${
|
|
6914
|
+
\u26A0\uFE0F ${chalk73.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.`
|
|
6859
6915
|
)
|
|
6860
6916
|
);
|
|
6861
6917
|
process.exit(1);
|
|
@@ -6912,7 +6968,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6912
6968
|
|
|
6913
6969
|
// src/commands/complexity/sloc.ts
|
|
6914
6970
|
import fs16 from "fs";
|
|
6915
|
-
import
|
|
6971
|
+
import chalk74 from "chalk";
|
|
6916
6972
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
6917
6973
|
withSourceFiles(pattern2, (files) => {
|
|
6918
6974
|
const results = [];
|
|
@@ -6928,12 +6984,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6928
6984
|
results.sort((a, b) => b.lines - a.lines);
|
|
6929
6985
|
for (const { file, lines } of results) {
|
|
6930
6986
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
6931
|
-
const color = exceedsThreshold ?
|
|
6932
|
-
console.log(`${color(file)} \u2192 ${
|
|
6987
|
+
const color = exceedsThreshold ? chalk74.red : chalk74.white;
|
|
6988
|
+
console.log(`${color(file)} \u2192 ${chalk74.cyan(lines)} lines`);
|
|
6933
6989
|
}
|
|
6934
6990
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
6935
6991
|
console.log(
|
|
6936
|
-
|
|
6992
|
+
chalk74.dim(`
|
|
6937
6993
|
Total: ${total} lines across ${files.length} files`)
|
|
6938
6994
|
);
|
|
6939
6995
|
if (hasViolation) {
|
|
@@ -6947,21 +7003,21 @@ async function analyze(pattern2) {
|
|
|
6947
7003
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
6948
7004
|
const files = findSourceFiles2(searchPattern);
|
|
6949
7005
|
if (files.length === 0) {
|
|
6950
|
-
console.log(
|
|
7006
|
+
console.log(chalk75.yellow("No files found matching pattern"));
|
|
6951
7007
|
return;
|
|
6952
7008
|
}
|
|
6953
7009
|
if (files.length === 1) {
|
|
6954
7010
|
const file = files[0];
|
|
6955
|
-
console.log(
|
|
7011
|
+
console.log(chalk75.bold.underline("SLOC"));
|
|
6956
7012
|
await sloc(file);
|
|
6957
7013
|
console.log();
|
|
6958
|
-
console.log(
|
|
7014
|
+
console.log(chalk75.bold.underline("Cyclomatic Complexity"));
|
|
6959
7015
|
await cyclomatic(file);
|
|
6960
7016
|
console.log();
|
|
6961
|
-
console.log(
|
|
7017
|
+
console.log(chalk75.bold.underline("Halstead Metrics"));
|
|
6962
7018
|
await halstead(file);
|
|
6963
7019
|
console.log();
|
|
6964
|
-
console.log(
|
|
7020
|
+
console.log(chalk75.bold.underline("Maintainability Index"));
|
|
6965
7021
|
await maintainability(file);
|
|
6966
7022
|
return;
|
|
6967
7023
|
}
|
|
@@ -6988,7 +7044,7 @@ function registerComplexity(program2) {
|
|
|
6988
7044
|
}
|
|
6989
7045
|
|
|
6990
7046
|
// src/commands/config/index.ts
|
|
6991
|
-
import
|
|
7047
|
+
import chalk76 from "chalk";
|
|
6992
7048
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
6993
7049
|
|
|
6994
7050
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7051,7 +7107,7 @@ function formatIssuePath(issue, key) {
|
|
|
7051
7107
|
function printValidationErrors(issues, key) {
|
|
7052
7108
|
for (const issue of issues) {
|
|
7053
7109
|
console.error(
|
|
7054
|
-
|
|
7110
|
+
chalk76.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7055
7111
|
);
|
|
7056
7112
|
}
|
|
7057
7113
|
}
|
|
@@ -7068,7 +7124,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7068
7124
|
function assertNotGlobalOnly(key, global) {
|
|
7069
7125
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7070
7126
|
console.error(
|
|
7071
|
-
|
|
7127
|
+
chalk76.red(
|
|
7072
7128
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7073
7129
|
)
|
|
7074
7130
|
);
|
|
@@ -7091,7 +7147,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7091
7147
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7092
7148
|
const target = options2.global ? "global" : "project";
|
|
7093
7149
|
console.log(
|
|
7094
|
-
|
|
7150
|
+
chalk76.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7095
7151
|
);
|
|
7096
7152
|
}
|
|
7097
7153
|
function configList() {
|
|
@@ -7100,7 +7156,7 @@ function configList() {
|
|
|
7100
7156
|
}
|
|
7101
7157
|
|
|
7102
7158
|
// src/commands/config/configGet.ts
|
|
7103
|
-
import
|
|
7159
|
+
import chalk77 from "chalk";
|
|
7104
7160
|
|
|
7105
7161
|
// src/commands/config/getNestedValue.ts
|
|
7106
7162
|
function isTraversable(value) {
|
|
@@ -7132,7 +7188,7 @@ function requireNestedValue(config, key) {
|
|
|
7132
7188
|
return value;
|
|
7133
7189
|
}
|
|
7134
7190
|
function exitKeyNotSet(key) {
|
|
7135
|
-
console.error(
|
|
7191
|
+
console.error(chalk77.red(`Key "${key}" is not set`));
|
|
7136
7192
|
process.exit(1);
|
|
7137
7193
|
}
|
|
7138
7194
|
|
|
@@ -7146,7 +7202,7 @@ function registerConfig(program2) {
|
|
|
7146
7202
|
|
|
7147
7203
|
// src/commands/deploy/redirect.ts
|
|
7148
7204
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
7149
|
-
import
|
|
7205
|
+
import chalk78 from "chalk";
|
|
7150
7206
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7151
7207
|
if (!window.location.pathname.endsWith('/')) {
|
|
7152
7208
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7155,22 +7211,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7155
7211
|
function redirect() {
|
|
7156
7212
|
const indexPath = "index.html";
|
|
7157
7213
|
if (!existsSync24(indexPath)) {
|
|
7158
|
-
console.log(
|
|
7214
|
+
console.log(chalk78.yellow("No index.html found"));
|
|
7159
7215
|
return;
|
|
7160
7216
|
}
|
|
7161
7217
|
const content = readFileSync20(indexPath, "utf-8");
|
|
7162
7218
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7163
|
-
console.log(
|
|
7219
|
+
console.log(chalk78.dim("Trailing slash script already present"));
|
|
7164
7220
|
return;
|
|
7165
7221
|
}
|
|
7166
7222
|
const headCloseIndex = content.indexOf("</head>");
|
|
7167
7223
|
if (headCloseIndex === -1) {
|
|
7168
|
-
console.log(
|
|
7224
|
+
console.log(chalk78.red("Could not find </head> tag in index.html"));
|
|
7169
7225
|
return;
|
|
7170
7226
|
}
|
|
7171
7227
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7172
7228
|
writeFileSync18(indexPath, newContent);
|
|
7173
|
-
console.log(
|
|
7229
|
+
console.log(chalk78.green("Added trailing slash redirect to index.html"));
|
|
7174
7230
|
}
|
|
7175
7231
|
|
|
7176
7232
|
// src/commands/registerDeploy.ts
|
|
@@ -7197,7 +7253,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7197
7253
|
|
|
7198
7254
|
// src/commands/devlog/shared.ts
|
|
7199
7255
|
import { execSync as execSync18 } from "child_process";
|
|
7200
|
-
import
|
|
7256
|
+
import chalk79 from "chalk";
|
|
7201
7257
|
|
|
7202
7258
|
// src/shared/getRepoName.ts
|
|
7203
7259
|
import { existsSync as existsSync25, readFileSync as readFileSync21 } from "fs";
|
|
@@ -7306,13 +7362,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
7306
7362
|
}
|
|
7307
7363
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
7308
7364
|
for (const commit2 of commits) {
|
|
7309
|
-
console.log(` ${
|
|
7365
|
+
console.log(` ${chalk79.yellow(commit2.hash)} ${commit2.message}`);
|
|
7310
7366
|
if (verbose) {
|
|
7311
7367
|
const visibleFiles = commit2.files.filter(
|
|
7312
7368
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
7313
7369
|
);
|
|
7314
7370
|
for (const file of visibleFiles) {
|
|
7315
|
-
console.log(` ${
|
|
7371
|
+
console.log(` ${chalk79.dim(file)}`);
|
|
7316
7372
|
}
|
|
7317
7373
|
}
|
|
7318
7374
|
}
|
|
@@ -7337,15 +7393,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
7337
7393
|
}
|
|
7338
7394
|
|
|
7339
7395
|
// src/commands/devlog/list/printDateHeader.ts
|
|
7340
|
-
import
|
|
7396
|
+
import chalk80 from "chalk";
|
|
7341
7397
|
function printDateHeader(date, isSkipped, entries) {
|
|
7342
7398
|
if (isSkipped) {
|
|
7343
|
-
console.log(`${
|
|
7399
|
+
console.log(`${chalk80.bold.blue(date)} ${chalk80.dim("skipped")}`);
|
|
7344
7400
|
} else if (entries && entries.length > 0) {
|
|
7345
|
-
const entryInfo = entries.map((e) => `${
|
|
7346
|
-
console.log(`${
|
|
7401
|
+
const entryInfo = entries.map((e) => `${chalk80.green(e.version)} ${e.title}`).join(" | ");
|
|
7402
|
+
console.log(`${chalk80.bold.blue(date)} ${entryInfo}`);
|
|
7347
7403
|
} else {
|
|
7348
|
-
console.log(`${
|
|
7404
|
+
console.log(`${chalk80.bold.blue(date)} ${chalk80.red("\u26A0 devlog missing")}`);
|
|
7349
7405
|
}
|
|
7350
7406
|
}
|
|
7351
7407
|
|
|
@@ -7449,24 +7505,24 @@ function bumpVersion(version2, type) {
|
|
|
7449
7505
|
|
|
7450
7506
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
7451
7507
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
7452
|
-
import
|
|
7508
|
+
import chalk82 from "chalk";
|
|
7453
7509
|
|
|
7454
7510
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
7455
|
-
import
|
|
7511
|
+
import chalk81 from "chalk";
|
|
7456
7512
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
7457
7513
|
if (conventional && firstHash) {
|
|
7458
7514
|
const version2 = getVersionAtCommit(firstHash);
|
|
7459
7515
|
if (version2) {
|
|
7460
|
-
console.log(`${
|
|
7516
|
+
console.log(`${chalk81.bold("version:")} ${stripToMinor(version2)}`);
|
|
7461
7517
|
} else {
|
|
7462
|
-
console.log(`${
|
|
7518
|
+
console.log(`${chalk81.bold("version:")} ${chalk81.red("unknown")}`);
|
|
7463
7519
|
}
|
|
7464
7520
|
} else if (patchVersion && minorVersion) {
|
|
7465
7521
|
console.log(
|
|
7466
|
-
`${
|
|
7522
|
+
`${chalk81.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
7467
7523
|
);
|
|
7468
7524
|
} else {
|
|
7469
|
-
console.log(`${
|
|
7525
|
+
console.log(`${chalk81.bold("version:")} v0.1 (initial)`);
|
|
7470
7526
|
}
|
|
7471
7527
|
}
|
|
7472
7528
|
|
|
@@ -7514,16 +7570,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
7514
7570
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
7515
7571
|
}
|
|
7516
7572
|
function logName(repoName) {
|
|
7517
|
-
console.log(`${
|
|
7573
|
+
console.log(`${chalk82.bold("name:")} ${repoName}`);
|
|
7518
7574
|
}
|
|
7519
7575
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
7520
7576
|
logName(ctx.repoName);
|
|
7521
7577
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
7522
|
-
console.log(
|
|
7578
|
+
console.log(chalk82.bold.blue(targetDate));
|
|
7523
7579
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
7524
7580
|
}
|
|
7525
7581
|
function logNoCommits(lastInfo) {
|
|
7526
|
-
console.log(
|
|
7582
|
+
console.log(chalk82.dim(noCommitsMessage(!!lastInfo)));
|
|
7527
7583
|
}
|
|
7528
7584
|
|
|
7529
7585
|
// src/commands/devlog/next/index.ts
|
|
@@ -7564,11 +7620,11 @@ function next2(options2) {
|
|
|
7564
7620
|
import { execSync as execSync20 } from "child_process";
|
|
7565
7621
|
|
|
7566
7622
|
// src/commands/devlog/repos/printReposTable.ts
|
|
7567
|
-
import
|
|
7623
|
+
import chalk83 from "chalk";
|
|
7568
7624
|
function colorStatus(status2) {
|
|
7569
|
-
if (status2 === "missing") return
|
|
7570
|
-
if (status2 === "outdated") return
|
|
7571
|
-
return
|
|
7625
|
+
if (status2 === "missing") return chalk83.red(status2);
|
|
7626
|
+
if (status2 === "outdated") return chalk83.yellow(status2);
|
|
7627
|
+
return chalk83.green(status2);
|
|
7572
7628
|
}
|
|
7573
7629
|
function formatRow(row, nameWidth) {
|
|
7574
7630
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -7582,8 +7638,8 @@ function printReposTable(rows) {
|
|
|
7582
7638
|
"Last Devlog".padEnd(11),
|
|
7583
7639
|
"Status"
|
|
7584
7640
|
].join(" ");
|
|
7585
|
-
console.log(
|
|
7586
|
-
console.log(
|
|
7641
|
+
console.log(chalk83.dim(header));
|
|
7642
|
+
console.log(chalk83.dim("-".repeat(header.length)));
|
|
7587
7643
|
for (const row of rows) {
|
|
7588
7644
|
console.log(formatRow(row, nameWidth));
|
|
7589
7645
|
}
|
|
@@ -7641,14 +7697,14 @@ function repos(options2) {
|
|
|
7641
7697
|
// src/commands/devlog/skip.ts
|
|
7642
7698
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
7643
7699
|
import { join as join26 } from "path";
|
|
7644
|
-
import
|
|
7700
|
+
import chalk84 from "chalk";
|
|
7645
7701
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
7646
7702
|
function getBlogConfigPath() {
|
|
7647
7703
|
return join26(BLOG_REPO_ROOT, "assist.yml");
|
|
7648
7704
|
}
|
|
7649
7705
|
function skip(date) {
|
|
7650
7706
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
7651
|
-
console.log(
|
|
7707
|
+
console.log(chalk84.red("Invalid date format. Use YYYY-MM-DD"));
|
|
7652
7708
|
process.exit(1);
|
|
7653
7709
|
}
|
|
7654
7710
|
const repoName = getRepoName();
|
|
@@ -7659,7 +7715,7 @@ function skip(date) {
|
|
|
7659
7715
|
const skipDays = skip2[repoName] ?? [];
|
|
7660
7716
|
if (skipDays.includes(date)) {
|
|
7661
7717
|
console.log(
|
|
7662
|
-
|
|
7718
|
+
chalk84.yellow(`${date} is already in skip list for ${repoName}`)
|
|
7663
7719
|
);
|
|
7664
7720
|
return;
|
|
7665
7721
|
}
|
|
@@ -7669,20 +7725,20 @@ function skip(date) {
|
|
|
7669
7725
|
devlog.skip = skip2;
|
|
7670
7726
|
config.devlog = devlog;
|
|
7671
7727
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
7672
|
-
console.log(
|
|
7728
|
+
console.log(chalk84.green(`Added ${date} to skip list for ${repoName}`));
|
|
7673
7729
|
}
|
|
7674
7730
|
|
|
7675
7731
|
// src/commands/devlog/version.ts
|
|
7676
|
-
import
|
|
7732
|
+
import chalk85 from "chalk";
|
|
7677
7733
|
function version() {
|
|
7678
7734
|
const config = loadConfig();
|
|
7679
7735
|
const name = getRepoName();
|
|
7680
7736
|
const lastInfo = getLastVersionInfo(name, config);
|
|
7681
7737
|
const lastVersion = lastInfo?.version ?? null;
|
|
7682
7738
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
7683
|
-
console.log(`${
|
|
7684
|
-
console.log(`${
|
|
7685
|
-
console.log(`${
|
|
7739
|
+
console.log(`${chalk85.bold("name:")} ${name}`);
|
|
7740
|
+
console.log(`${chalk85.bold("last:")} ${lastVersion ?? chalk85.dim("none")}`);
|
|
7741
|
+
console.log(`${chalk85.bold("next:")} ${nextVersion ?? chalk85.dim("none")}`);
|
|
7686
7742
|
}
|
|
7687
7743
|
|
|
7688
7744
|
// src/commands/registerDevlog.ts
|
|
@@ -7706,7 +7762,7 @@ function registerDevlog(program2) {
|
|
|
7706
7762
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
7707
7763
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
7708
7764
|
import { join as join27 } from "path";
|
|
7709
|
-
import
|
|
7765
|
+
import chalk86 from "chalk";
|
|
7710
7766
|
|
|
7711
7767
|
// src/shared/findRepoRoot.ts
|
|
7712
7768
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -7769,14 +7825,14 @@ function checkBuildLocks(startDir) {
|
|
|
7769
7825
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
7770
7826
|
if (locked) {
|
|
7771
7827
|
console.error(
|
|
7772
|
-
|
|
7828
|
+
chalk86.red("Build output locked (is VS debugging?): ") + locked
|
|
7773
7829
|
);
|
|
7774
7830
|
process.exit(1);
|
|
7775
7831
|
}
|
|
7776
7832
|
}
|
|
7777
7833
|
async function checkBuildLocksCommand() {
|
|
7778
7834
|
checkBuildLocks();
|
|
7779
|
-
console.log(
|
|
7835
|
+
console.log(chalk86.green("No build locks detected"));
|
|
7780
7836
|
}
|
|
7781
7837
|
|
|
7782
7838
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -7875,30 +7931,30 @@ function escapeRegex(s) {
|
|
|
7875
7931
|
}
|
|
7876
7932
|
|
|
7877
7933
|
// src/commands/dotnet/printTree.ts
|
|
7878
|
-
import
|
|
7934
|
+
import chalk87 from "chalk";
|
|
7879
7935
|
function printNodes(nodes, prefix2) {
|
|
7880
7936
|
for (let i = 0; i < nodes.length; i++) {
|
|
7881
7937
|
const isLast = i === nodes.length - 1;
|
|
7882
7938
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7883
7939
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
7884
7940
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
7885
|
-
const label2 = isMissing ?
|
|
7941
|
+
const label2 = isMissing ? chalk87.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
7886
7942
|
console.log(`${prefix2}${connector}${label2}`);
|
|
7887
7943
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
7888
7944
|
}
|
|
7889
7945
|
}
|
|
7890
7946
|
function printTree(tree, totalCount, solutions) {
|
|
7891
|
-
console.log(
|
|
7892
|
-
console.log(
|
|
7947
|
+
console.log(chalk87.bold("\nProject Dependency Tree"));
|
|
7948
|
+
console.log(chalk87.cyan(tree.relativePath));
|
|
7893
7949
|
printNodes(tree.children, "");
|
|
7894
|
-
console.log(
|
|
7950
|
+
console.log(chalk87.dim(`
|
|
7895
7951
|
${totalCount} projects total (including root)`));
|
|
7896
|
-
console.log(
|
|
7952
|
+
console.log(chalk87.bold("\nSolution Membership"));
|
|
7897
7953
|
if (solutions.length === 0) {
|
|
7898
|
-
console.log(
|
|
7954
|
+
console.log(chalk87.yellow(" Not found in any .sln"));
|
|
7899
7955
|
} else {
|
|
7900
7956
|
for (const sln of solutions) {
|
|
7901
|
-
console.log(` ${
|
|
7957
|
+
console.log(` ${chalk87.green(sln)}`);
|
|
7902
7958
|
}
|
|
7903
7959
|
}
|
|
7904
7960
|
console.log();
|
|
@@ -7927,16 +7983,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
7927
7983
|
// src/commands/dotnet/resolveCsproj.ts
|
|
7928
7984
|
import { existsSync as existsSync27 } from "fs";
|
|
7929
7985
|
import path26 from "path";
|
|
7930
|
-
import
|
|
7986
|
+
import chalk88 from "chalk";
|
|
7931
7987
|
function resolveCsproj(csprojPath) {
|
|
7932
7988
|
const resolved = path26.resolve(csprojPath);
|
|
7933
7989
|
if (!existsSync27(resolved)) {
|
|
7934
|
-
console.error(
|
|
7990
|
+
console.error(chalk88.red(`File not found: ${resolved}`));
|
|
7935
7991
|
process.exit(1);
|
|
7936
7992
|
}
|
|
7937
7993
|
const repoRoot = findRepoRoot(path26.dirname(resolved));
|
|
7938
7994
|
if (!repoRoot) {
|
|
7939
|
-
console.error(
|
|
7995
|
+
console.error(chalk88.red("Could not find git repository root"));
|
|
7940
7996
|
process.exit(1);
|
|
7941
7997
|
}
|
|
7942
7998
|
return { resolved, repoRoot };
|
|
@@ -7986,12 +8042,12 @@ function getChangedCsFiles(scope) {
|
|
|
7986
8042
|
}
|
|
7987
8043
|
|
|
7988
8044
|
// src/commands/dotnet/inSln.ts
|
|
7989
|
-
import
|
|
8045
|
+
import chalk89 from "chalk";
|
|
7990
8046
|
async function inSln(csprojPath) {
|
|
7991
8047
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
7992
8048
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
7993
8049
|
if (solutions.length === 0) {
|
|
7994
|
-
console.log(
|
|
8050
|
+
console.log(chalk89.yellow("Not found in any .sln file"));
|
|
7995
8051
|
process.exit(1);
|
|
7996
8052
|
}
|
|
7997
8053
|
for (const sln of solutions) {
|
|
@@ -8000,7 +8056,7 @@ async function inSln(csprojPath) {
|
|
|
8000
8056
|
}
|
|
8001
8057
|
|
|
8002
8058
|
// src/commands/dotnet/inspect.ts
|
|
8003
|
-
import
|
|
8059
|
+
import chalk95 from "chalk";
|
|
8004
8060
|
|
|
8005
8061
|
// src/shared/formatElapsed.ts
|
|
8006
8062
|
function formatElapsed(ms) {
|
|
@@ -8012,12 +8068,12 @@ function formatElapsed(ms) {
|
|
|
8012
8068
|
}
|
|
8013
8069
|
|
|
8014
8070
|
// src/commands/dotnet/displayIssues.ts
|
|
8015
|
-
import
|
|
8071
|
+
import chalk90 from "chalk";
|
|
8016
8072
|
var SEVERITY_COLOR = {
|
|
8017
|
-
ERROR:
|
|
8018
|
-
WARNING:
|
|
8019
|
-
SUGGESTION:
|
|
8020
|
-
HINT:
|
|
8073
|
+
ERROR: chalk90.red,
|
|
8074
|
+
WARNING: chalk90.yellow,
|
|
8075
|
+
SUGGESTION: chalk90.cyan,
|
|
8076
|
+
HINT: chalk90.dim
|
|
8021
8077
|
};
|
|
8022
8078
|
function groupByFile(issues) {
|
|
8023
8079
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8033,15 +8089,15 @@ function groupByFile(issues) {
|
|
|
8033
8089
|
}
|
|
8034
8090
|
function displayIssues(issues) {
|
|
8035
8091
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8036
|
-
console.log(
|
|
8092
|
+
console.log(chalk90.bold(file));
|
|
8037
8093
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8038
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8094
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk90.white;
|
|
8039
8095
|
console.log(
|
|
8040
|
-
` ${
|
|
8096
|
+
` ${chalk90.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8041
8097
|
);
|
|
8042
8098
|
}
|
|
8043
8099
|
}
|
|
8044
|
-
console.log(
|
|
8100
|
+
console.log(chalk90.dim(`
|
|
8045
8101
|
${issues.length} issue(s) found`));
|
|
8046
8102
|
}
|
|
8047
8103
|
|
|
@@ -8100,12 +8156,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8100
8156
|
// src/commands/dotnet/resolveSolution.ts
|
|
8101
8157
|
import { existsSync as existsSync28 } from "fs";
|
|
8102
8158
|
import path27 from "path";
|
|
8103
|
-
import
|
|
8159
|
+
import chalk92 from "chalk";
|
|
8104
8160
|
|
|
8105
8161
|
// src/commands/dotnet/findSolution.ts
|
|
8106
8162
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8107
8163
|
import { dirname as dirname18, join as join28 } from "path";
|
|
8108
|
-
import
|
|
8164
|
+
import chalk91 from "chalk";
|
|
8109
8165
|
function findSlnInDir(dir) {
|
|
8110
8166
|
try {
|
|
8111
8167
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join28(dir, f));
|
|
@@ -8121,17 +8177,17 @@ function findSolution() {
|
|
|
8121
8177
|
const slnFiles = findSlnInDir(current);
|
|
8122
8178
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8123
8179
|
if (slnFiles.length > 1) {
|
|
8124
|
-
console.error(
|
|
8180
|
+
console.error(chalk91.red(`Multiple .sln files found in ${current}:`));
|
|
8125
8181
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8126
8182
|
console.error(
|
|
8127
|
-
|
|
8183
|
+
chalk91.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8128
8184
|
);
|
|
8129
8185
|
process.exit(1);
|
|
8130
8186
|
}
|
|
8131
8187
|
if (current === ceiling) break;
|
|
8132
8188
|
current = dirname18(current);
|
|
8133
8189
|
}
|
|
8134
|
-
console.error(
|
|
8190
|
+
console.error(chalk91.red("No .sln file found between cwd and repo root"));
|
|
8135
8191
|
process.exit(1);
|
|
8136
8192
|
}
|
|
8137
8193
|
|
|
@@ -8140,7 +8196,7 @@ function resolveSolution(sln) {
|
|
|
8140
8196
|
if (sln) {
|
|
8141
8197
|
const resolved = path27.resolve(sln);
|
|
8142
8198
|
if (!existsSync28(resolved)) {
|
|
8143
|
-
console.error(
|
|
8199
|
+
console.error(chalk92.red(`Solution file not found: ${resolved}`));
|
|
8144
8200
|
process.exit(1);
|
|
8145
8201
|
}
|
|
8146
8202
|
return resolved;
|
|
@@ -8182,14 +8238,14 @@ import { execSync as execSync22 } from "child_process";
|
|
|
8182
8238
|
import { existsSync as existsSync29, readFileSync as readFileSync25, unlinkSync as unlinkSync5 } from "fs";
|
|
8183
8239
|
import { tmpdir as tmpdir3 } from "os";
|
|
8184
8240
|
import path28 from "path";
|
|
8185
|
-
import
|
|
8241
|
+
import chalk93 from "chalk";
|
|
8186
8242
|
function assertJbInstalled() {
|
|
8187
8243
|
try {
|
|
8188
8244
|
execSync22("jb inspectcode --version", { stdio: "pipe" });
|
|
8189
8245
|
} catch {
|
|
8190
|
-
console.error(
|
|
8246
|
+
console.error(chalk93.red("jb is not installed. Install with:"));
|
|
8191
8247
|
console.error(
|
|
8192
|
-
|
|
8248
|
+
chalk93.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8193
8249
|
);
|
|
8194
8250
|
process.exit(1);
|
|
8195
8251
|
}
|
|
@@ -8207,11 +8263,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8207
8263
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
8208
8264
|
process.stderr.write(err.stderr);
|
|
8209
8265
|
}
|
|
8210
|
-
console.error(
|
|
8266
|
+
console.error(chalk93.red("jb inspectcode failed"));
|
|
8211
8267
|
process.exit(1);
|
|
8212
8268
|
}
|
|
8213
8269
|
if (!existsSync29(reportPath)) {
|
|
8214
|
-
console.error(
|
|
8270
|
+
console.error(chalk93.red("Report file not generated"));
|
|
8215
8271
|
process.exit(1);
|
|
8216
8272
|
}
|
|
8217
8273
|
const xml = readFileSync25(reportPath, "utf-8");
|
|
@@ -8221,7 +8277,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8221
8277
|
|
|
8222
8278
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
8223
8279
|
import { execSync as execSync23 } from "child_process";
|
|
8224
|
-
import
|
|
8280
|
+
import chalk94 from "chalk";
|
|
8225
8281
|
function resolveMsbuildPath() {
|
|
8226
8282
|
const { run: run4 } = loadConfig();
|
|
8227
8283
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -8233,9 +8289,9 @@ function assertMsbuildInstalled() {
|
|
|
8233
8289
|
try {
|
|
8234
8290
|
execSync23(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
8235
8291
|
} catch {
|
|
8236
|
-
console.error(
|
|
8292
|
+
console.error(chalk94.red(`msbuild not found at: ${msbuild}`));
|
|
8237
8293
|
console.error(
|
|
8238
|
-
|
|
8294
|
+
chalk94.yellow(
|
|
8239
8295
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
8240
8296
|
)
|
|
8241
8297
|
);
|
|
@@ -8282,17 +8338,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
8282
8338
|
// src/commands/dotnet/inspect.ts
|
|
8283
8339
|
function logScope(changedFiles) {
|
|
8284
8340
|
if (changedFiles === null) {
|
|
8285
|
-
console.log(
|
|
8341
|
+
console.log(chalk95.dim("Inspecting full solution..."));
|
|
8286
8342
|
} else {
|
|
8287
8343
|
console.log(
|
|
8288
|
-
|
|
8344
|
+
chalk95.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
8289
8345
|
);
|
|
8290
8346
|
}
|
|
8291
8347
|
}
|
|
8292
8348
|
function reportResults(issues, elapsed) {
|
|
8293
8349
|
if (issues.length > 0) displayIssues(issues);
|
|
8294
|
-
else console.log(
|
|
8295
|
-
console.log(
|
|
8350
|
+
else console.log(chalk95.green("No issues found"));
|
|
8351
|
+
console.log(chalk95.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
8296
8352
|
if (issues.length > 0) process.exit(1);
|
|
8297
8353
|
}
|
|
8298
8354
|
async function inspect(sln, options2) {
|
|
@@ -8303,7 +8359,7 @@ async function inspect(sln, options2) {
|
|
|
8303
8359
|
const scope = parseScope(options2.scope);
|
|
8304
8360
|
const changedFiles = getChangedCsFiles(scope);
|
|
8305
8361
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
8306
|
-
console.log(
|
|
8362
|
+
console.log(chalk95.green("No changed .cs files found"));
|
|
8307
8363
|
return;
|
|
8308
8364
|
}
|
|
8309
8365
|
logScope(changedFiles);
|
|
@@ -8329,7 +8385,7 @@ function registerDotnet(program2) {
|
|
|
8329
8385
|
}
|
|
8330
8386
|
|
|
8331
8387
|
// src/commands/jira/acceptanceCriteria.ts
|
|
8332
|
-
import
|
|
8388
|
+
import chalk97 from "chalk";
|
|
8333
8389
|
|
|
8334
8390
|
// src/commands/jira/adfToText.ts
|
|
8335
8391
|
function renderInline(node) {
|
|
@@ -8390,7 +8446,7 @@ function adfToText(doc) {
|
|
|
8390
8446
|
|
|
8391
8447
|
// src/commands/jira/fetchIssue.ts
|
|
8392
8448
|
import { execSync as execSync24 } from "child_process";
|
|
8393
|
-
import
|
|
8449
|
+
import chalk96 from "chalk";
|
|
8394
8450
|
function fetchIssue(issueKey, fields) {
|
|
8395
8451
|
let result;
|
|
8396
8452
|
try {
|
|
@@ -8403,15 +8459,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
8403
8459
|
const stderr = error.stderr;
|
|
8404
8460
|
if (stderr.includes("unauthorized")) {
|
|
8405
8461
|
console.error(
|
|
8406
|
-
|
|
8462
|
+
chalk96.red("Jira authentication expired."),
|
|
8407
8463
|
"Run",
|
|
8408
|
-
|
|
8464
|
+
chalk96.cyan("assist jira auth"),
|
|
8409
8465
|
"to re-authenticate."
|
|
8410
8466
|
);
|
|
8411
8467
|
process.exit(1);
|
|
8412
8468
|
}
|
|
8413
8469
|
}
|
|
8414
|
-
console.error(
|
|
8470
|
+
console.error(chalk96.red(`Failed to fetch ${issueKey}.`));
|
|
8415
8471
|
process.exit(1);
|
|
8416
8472
|
}
|
|
8417
8473
|
return JSON.parse(result);
|
|
@@ -8425,7 +8481,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
8425
8481
|
const parsed = fetchIssue(issueKey, field);
|
|
8426
8482
|
const acValue = parsed?.fields?.[field];
|
|
8427
8483
|
if (!acValue) {
|
|
8428
|
-
console.log(
|
|
8484
|
+
console.log(chalk97.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
8429
8485
|
return;
|
|
8430
8486
|
}
|
|
8431
8487
|
if (typeof acValue === "string") {
|
|
@@ -8520,14 +8576,14 @@ async function jiraAuth() {
|
|
|
8520
8576
|
}
|
|
8521
8577
|
|
|
8522
8578
|
// src/commands/jira/viewIssue.ts
|
|
8523
|
-
import
|
|
8579
|
+
import chalk98 from "chalk";
|
|
8524
8580
|
function viewIssue(issueKey) {
|
|
8525
8581
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
8526
8582
|
const fields = parsed?.fields;
|
|
8527
8583
|
const summary = fields?.summary;
|
|
8528
8584
|
const description = fields?.description;
|
|
8529
8585
|
if (summary) {
|
|
8530
|
-
console.log(
|
|
8586
|
+
console.log(chalk98.bold(summary));
|
|
8531
8587
|
}
|
|
8532
8588
|
if (description) {
|
|
8533
8589
|
if (summary) console.log();
|
|
@@ -8541,7 +8597,7 @@ function viewIssue(issueKey) {
|
|
|
8541
8597
|
}
|
|
8542
8598
|
if (!summary && !description) {
|
|
8543
8599
|
console.log(
|
|
8544
|
-
|
|
8600
|
+
chalk98.yellow(`No summary or description found on ${issueKey}.`)
|
|
8545
8601
|
);
|
|
8546
8602
|
}
|
|
8547
8603
|
}
|
|
@@ -8557,15 +8613,15 @@ function registerJira(program2) {
|
|
|
8557
8613
|
// src/commands/mermaid/index.ts
|
|
8558
8614
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync5 } from "fs";
|
|
8559
8615
|
import { resolve as resolve10 } from "path";
|
|
8560
|
-
import
|
|
8616
|
+
import chalk101 from "chalk";
|
|
8561
8617
|
|
|
8562
8618
|
// src/commands/mermaid/exportFile.ts
|
|
8563
8619
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync21 } from "fs";
|
|
8564
8620
|
import { basename as basename7, extname, resolve as resolve9 } from "path";
|
|
8565
|
-
import
|
|
8621
|
+
import chalk100 from "chalk";
|
|
8566
8622
|
|
|
8567
8623
|
// src/commands/mermaid/renderBlock.ts
|
|
8568
|
-
import
|
|
8624
|
+
import chalk99 from "chalk";
|
|
8569
8625
|
async function renderBlock(krokiUrl, source) {
|
|
8570
8626
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
8571
8627
|
method: "POST",
|
|
@@ -8574,7 +8630,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
8574
8630
|
});
|
|
8575
8631
|
if (!response.ok) {
|
|
8576
8632
|
console.error(
|
|
8577
|
-
|
|
8633
|
+
chalk99.red(
|
|
8578
8634
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
8579
8635
|
)
|
|
8580
8636
|
);
|
|
@@ -8592,19 +8648,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8592
8648
|
if (onlyIndex !== void 0) {
|
|
8593
8649
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
8594
8650
|
console.error(
|
|
8595
|
-
|
|
8651
|
+
chalk100.red(
|
|
8596
8652
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
8597
8653
|
)
|
|
8598
8654
|
);
|
|
8599
8655
|
process.exit(1);
|
|
8600
8656
|
}
|
|
8601
8657
|
console.log(
|
|
8602
|
-
|
|
8658
|
+
chalk100.gray(
|
|
8603
8659
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
8604
8660
|
)
|
|
8605
8661
|
);
|
|
8606
8662
|
} else {
|
|
8607
|
-
console.log(
|
|
8663
|
+
console.log(chalk100.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
8608
8664
|
}
|
|
8609
8665
|
for (const [i, source] of blocks.entries()) {
|
|
8610
8666
|
const idx = i + 1;
|
|
@@ -8612,7 +8668,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8612
8668
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
8613
8669
|
const svg = await renderBlock(krokiUrl, source);
|
|
8614
8670
|
writeFileSync21(outPath, svg, "utf8");
|
|
8615
|
-
console.log(
|
|
8671
|
+
console.log(chalk100.green(` \u2192 ${outPath}`));
|
|
8616
8672
|
}
|
|
8617
8673
|
}
|
|
8618
8674
|
function extractMermaidBlocks(markdown) {
|
|
@@ -8628,18 +8684,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
8628
8684
|
if (options2.index !== void 0) {
|
|
8629
8685
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
8630
8686
|
console.error(
|
|
8631
|
-
|
|
8687
|
+
chalk101.red(`--index must be a positive integer (got ${options2.index})`)
|
|
8632
8688
|
);
|
|
8633
8689
|
process.exit(1);
|
|
8634
8690
|
}
|
|
8635
8691
|
if (!file) {
|
|
8636
|
-
console.error(
|
|
8692
|
+
console.error(chalk101.red("--index requires a file argument"));
|
|
8637
8693
|
process.exit(1);
|
|
8638
8694
|
}
|
|
8639
8695
|
}
|
|
8640
8696
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
8641
8697
|
if (files.length === 0) {
|
|
8642
|
-
console.log(
|
|
8698
|
+
console.log(chalk101.gray("No markdown files found in current directory."));
|
|
8643
8699
|
return;
|
|
8644
8700
|
}
|
|
8645
8701
|
for (const f of files) {
|
|
@@ -8662,7 +8718,7 @@ function registerMermaid(program2) {
|
|
|
8662
8718
|
}
|
|
8663
8719
|
|
|
8664
8720
|
// src/commands/news/add/index.ts
|
|
8665
|
-
import
|
|
8721
|
+
import chalk102 from "chalk";
|
|
8666
8722
|
import enquirer8 from "enquirer";
|
|
8667
8723
|
async function add2(url) {
|
|
8668
8724
|
if (!url) {
|
|
@@ -8685,17 +8741,17 @@ async function add2(url) {
|
|
|
8685
8741
|
const news = config.news ?? {};
|
|
8686
8742
|
const feeds = news.feeds ?? [];
|
|
8687
8743
|
if (feeds.includes(url)) {
|
|
8688
|
-
console.log(
|
|
8744
|
+
console.log(chalk102.yellow("Feed already exists in config"));
|
|
8689
8745
|
return;
|
|
8690
8746
|
}
|
|
8691
8747
|
feeds.push(url);
|
|
8692
8748
|
config.news = { ...news, feeds };
|
|
8693
8749
|
saveGlobalConfig(config);
|
|
8694
|
-
console.log(
|
|
8750
|
+
console.log(chalk102.green(`Added feed: ${url}`));
|
|
8695
8751
|
}
|
|
8696
8752
|
|
|
8697
8753
|
// src/commands/news/web/handleRequest.ts
|
|
8698
|
-
import
|
|
8754
|
+
import chalk103 from "chalk";
|
|
8699
8755
|
|
|
8700
8756
|
// src/commands/news/web/shared.ts
|
|
8701
8757
|
import { decodeHTML } from "entities";
|
|
@@ -8831,17 +8887,17 @@ function prefetch() {
|
|
|
8831
8887
|
const config = loadConfig();
|
|
8832
8888
|
const total = config.news.feeds.length;
|
|
8833
8889
|
if (total === 0) return;
|
|
8834
|
-
process.stdout.write(
|
|
8890
|
+
process.stdout.write(chalk103.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
8835
8891
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
8836
8892
|
const width = 20;
|
|
8837
8893
|
const filled = Math.round(done2 / t * width);
|
|
8838
8894
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
8839
8895
|
process.stdout.write(
|
|
8840
|
-
`\r${
|
|
8896
|
+
`\r${chalk103.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
8841
8897
|
);
|
|
8842
8898
|
}).then((items) => {
|
|
8843
8899
|
process.stdout.write(
|
|
8844
|
-
`\r${
|
|
8900
|
+
`\r${chalk103.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
8845
8901
|
`
|
|
8846
8902
|
);
|
|
8847
8903
|
cachedItems = items;
|
|
@@ -8886,7 +8942,7 @@ function registerNews(program2) {
|
|
|
8886
8942
|
}
|
|
8887
8943
|
|
|
8888
8944
|
// src/commands/prompts/printPromptsTable.ts
|
|
8889
|
-
import
|
|
8945
|
+
import chalk104 from "chalk";
|
|
8890
8946
|
function truncate(str, max) {
|
|
8891
8947
|
if (str.length <= max) return str;
|
|
8892
8948
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -8904,14 +8960,14 @@ function printPromptsTable(rows) {
|
|
|
8904
8960
|
"Command".padEnd(commandWidth),
|
|
8905
8961
|
"Repos"
|
|
8906
8962
|
].join(" ");
|
|
8907
|
-
console.log(
|
|
8908
|
-
console.log(
|
|
8963
|
+
console.log(chalk104.dim(header));
|
|
8964
|
+
console.log(chalk104.dim("-".repeat(header.length)));
|
|
8909
8965
|
for (const row of rows) {
|
|
8910
8966
|
const count = String(row.count).padStart(countWidth);
|
|
8911
8967
|
const tool = row.tool.padEnd(toolWidth);
|
|
8912
8968
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
8913
8969
|
console.log(
|
|
8914
|
-
`${
|
|
8970
|
+
`${chalk104.yellow(count)} ${tool} ${command} ${chalk104.dim(row.repos)}`
|
|
8915
8971
|
);
|
|
8916
8972
|
}
|
|
8917
8973
|
}
|
|
@@ -9343,20 +9399,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
9343
9399
|
}
|
|
9344
9400
|
|
|
9345
9401
|
// src/commands/prs/listComments/printComments.ts
|
|
9346
|
-
import
|
|
9402
|
+
import chalk105 from "chalk";
|
|
9347
9403
|
function formatForHuman(comment3) {
|
|
9348
9404
|
if (comment3.type === "review") {
|
|
9349
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
9405
|
+
const stateColor = comment3.state === "APPROVED" ? chalk105.green : comment3.state === "CHANGES_REQUESTED" ? chalk105.red : chalk105.yellow;
|
|
9350
9406
|
return [
|
|
9351
|
-
`${
|
|
9407
|
+
`${chalk105.cyan("Review")} by ${chalk105.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
9352
9408
|
comment3.body,
|
|
9353
9409
|
""
|
|
9354
9410
|
].join("\n");
|
|
9355
9411
|
}
|
|
9356
9412
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
9357
9413
|
return [
|
|
9358
|
-
`${
|
|
9359
|
-
|
|
9414
|
+
`${chalk105.cyan("Line comment")} by ${chalk105.bold(comment3.user)} on ${chalk105.dim(`${comment3.path}${location}`)}`,
|
|
9415
|
+
chalk105.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
9360
9416
|
comment3.body,
|
|
9361
9417
|
""
|
|
9362
9418
|
].join("\n");
|
|
@@ -9446,13 +9502,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
9446
9502
|
import enquirer9 from "enquirer";
|
|
9447
9503
|
|
|
9448
9504
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
9449
|
-
import
|
|
9505
|
+
import chalk106 from "chalk";
|
|
9450
9506
|
var STATUS_MAP = {
|
|
9451
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
9452
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
9507
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk106.magenta("merged"), date: pr.mergedAt } : null,
|
|
9508
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk106.red("closed"), date: pr.closedAt } : null
|
|
9453
9509
|
};
|
|
9454
9510
|
function defaultStatus(pr) {
|
|
9455
|
-
return { label:
|
|
9511
|
+
return { label: chalk106.green("opened"), date: pr.createdAt };
|
|
9456
9512
|
}
|
|
9457
9513
|
function getStatus2(pr) {
|
|
9458
9514
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -9461,11 +9517,11 @@ function formatDate(dateStr) {
|
|
|
9461
9517
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
9462
9518
|
}
|
|
9463
9519
|
function formatPrHeader(pr, status2) {
|
|
9464
|
-
return `${
|
|
9520
|
+
return `${chalk106.cyan(`#${pr.number}`)} ${pr.title} ${chalk106.dim(`(${pr.author.login},`)} ${status2.label} ${chalk106.dim(`${formatDate(status2.date)})`)}`;
|
|
9465
9521
|
}
|
|
9466
9522
|
function logPrDetails(pr) {
|
|
9467
9523
|
console.log(
|
|
9468
|
-
|
|
9524
|
+
chalk106.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
9469
9525
|
);
|
|
9470
9526
|
console.log();
|
|
9471
9527
|
}
|
|
@@ -9632,10 +9688,10 @@ function registerPrs(program2) {
|
|
|
9632
9688
|
}
|
|
9633
9689
|
|
|
9634
9690
|
// src/commands/ravendb/ravendbAuth.ts
|
|
9635
|
-
import
|
|
9691
|
+
import chalk112 from "chalk";
|
|
9636
9692
|
|
|
9637
9693
|
// src/shared/createConnectionAuth.ts
|
|
9638
|
-
import
|
|
9694
|
+
import chalk107 from "chalk";
|
|
9639
9695
|
function listConnections(connections, format2) {
|
|
9640
9696
|
if (connections.length === 0) {
|
|
9641
9697
|
console.log("No connections configured.");
|
|
@@ -9648,7 +9704,7 @@ function listConnections(connections, format2) {
|
|
|
9648
9704
|
function removeConnection(connections, name, save) {
|
|
9649
9705
|
const filtered = connections.filter((c) => c.name !== name);
|
|
9650
9706
|
if (filtered.length === connections.length) {
|
|
9651
|
-
console.error(
|
|
9707
|
+
console.error(chalk107.red(`Connection "${name}" not found.`));
|
|
9652
9708
|
process.exit(1);
|
|
9653
9709
|
}
|
|
9654
9710
|
save(filtered);
|
|
@@ -9694,15 +9750,15 @@ function saveConnections(connections) {
|
|
|
9694
9750
|
}
|
|
9695
9751
|
|
|
9696
9752
|
// src/commands/ravendb/promptConnection.ts
|
|
9697
|
-
import
|
|
9753
|
+
import chalk110 from "chalk";
|
|
9698
9754
|
|
|
9699
9755
|
// src/commands/ravendb/selectOpSecret.ts
|
|
9700
|
-
import
|
|
9756
|
+
import chalk109 from "chalk";
|
|
9701
9757
|
import Enquirer2 from "enquirer";
|
|
9702
9758
|
|
|
9703
9759
|
// src/commands/ravendb/searchItems.ts
|
|
9704
9760
|
import { execSync as execSync34 } from "child_process";
|
|
9705
|
-
import
|
|
9761
|
+
import chalk108 from "chalk";
|
|
9706
9762
|
function opExec(args) {
|
|
9707
9763
|
return execSync34(`op ${args}`, {
|
|
9708
9764
|
encoding: "utf-8",
|
|
@@ -9715,7 +9771,7 @@ function searchItems(search2) {
|
|
|
9715
9771
|
items = JSON.parse(opExec("item list --format=json"));
|
|
9716
9772
|
} catch {
|
|
9717
9773
|
console.error(
|
|
9718
|
-
|
|
9774
|
+
chalk108.red(
|
|
9719
9775
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
9720
9776
|
)
|
|
9721
9777
|
);
|
|
@@ -9729,7 +9785,7 @@ function getItemFields(itemId) {
|
|
|
9729
9785
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
9730
9786
|
return item.fields.filter((f) => f.reference && f.label);
|
|
9731
9787
|
} catch {
|
|
9732
|
-
console.error(
|
|
9788
|
+
console.error(chalk108.red("Failed to get item details from 1Password."));
|
|
9733
9789
|
process.exit(1);
|
|
9734
9790
|
}
|
|
9735
9791
|
}
|
|
@@ -9748,7 +9804,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9748
9804
|
}).run();
|
|
9749
9805
|
const items = searchItems(search2);
|
|
9750
9806
|
if (items.length === 0) {
|
|
9751
|
-
console.error(
|
|
9807
|
+
console.error(chalk109.red(`No items found matching "${search2}".`));
|
|
9752
9808
|
process.exit(1);
|
|
9753
9809
|
}
|
|
9754
9810
|
const itemId = await selectOne(
|
|
@@ -9757,7 +9813,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9757
9813
|
);
|
|
9758
9814
|
const fields = getItemFields(itemId);
|
|
9759
9815
|
if (fields.length === 0) {
|
|
9760
|
-
console.error(
|
|
9816
|
+
console.error(chalk109.red("No fields with references found on this item."));
|
|
9761
9817
|
process.exit(1);
|
|
9762
9818
|
}
|
|
9763
9819
|
const ref = await selectOne(
|
|
@@ -9771,7 +9827,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9771
9827
|
async function promptConnection(existingNames) {
|
|
9772
9828
|
const name = await promptInput("name", "Connection name:");
|
|
9773
9829
|
if (existingNames.includes(name)) {
|
|
9774
|
-
console.error(
|
|
9830
|
+
console.error(chalk110.red(`Connection "${name}" already exists.`));
|
|
9775
9831
|
process.exit(1);
|
|
9776
9832
|
}
|
|
9777
9833
|
const url = await promptInput(
|
|
@@ -9780,22 +9836,22 @@ async function promptConnection(existingNames) {
|
|
|
9780
9836
|
);
|
|
9781
9837
|
const database = await promptInput("database", "Database name:");
|
|
9782
9838
|
if (!name || !url || !database) {
|
|
9783
|
-
console.error(
|
|
9839
|
+
console.error(chalk110.red("All fields are required."));
|
|
9784
9840
|
process.exit(1);
|
|
9785
9841
|
}
|
|
9786
9842
|
const apiKeyRef = await selectOpSecret();
|
|
9787
|
-
console.log(
|
|
9843
|
+
console.log(chalk110.dim(`Using: ${apiKeyRef}`));
|
|
9788
9844
|
return { name, url, database, apiKeyRef };
|
|
9789
9845
|
}
|
|
9790
9846
|
|
|
9791
9847
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
9792
|
-
import
|
|
9848
|
+
import chalk111 from "chalk";
|
|
9793
9849
|
function ravendbSetConnection(name) {
|
|
9794
9850
|
const raw = loadGlobalConfigRaw();
|
|
9795
9851
|
const ravendb = raw.ravendb ?? {};
|
|
9796
9852
|
const connections = ravendb.connections ?? [];
|
|
9797
9853
|
if (!connections.some((c) => c.name === name)) {
|
|
9798
|
-
console.error(
|
|
9854
|
+
console.error(chalk111.red(`Connection "${name}" not found.`));
|
|
9799
9855
|
console.error(
|
|
9800
9856
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9801
9857
|
);
|
|
@@ -9811,16 +9867,16 @@ function ravendbSetConnection(name) {
|
|
|
9811
9867
|
var ravendbAuth = createConnectionAuth({
|
|
9812
9868
|
load: loadConnections,
|
|
9813
9869
|
save: saveConnections,
|
|
9814
|
-
format: (c) => `${
|
|
9870
|
+
format: (c) => `${chalk112.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
9815
9871
|
promptNew: promptConnection,
|
|
9816
9872
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
9817
9873
|
});
|
|
9818
9874
|
|
|
9819
9875
|
// src/commands/ravendb/ravendbCollections.ts
|
|
9820
|
-
import
|
|
9876
|
+
import chalk116 from "chalk";
|
|
9821
9877
|
|
|
9822
9878
|
// src/commands/ravendb/ravenFetch.ts
|
|
9823
|
-
import
|
|
9879
|
+
import chalk114 from "chalk";
|
|
9824
9880
|
|
|
9825
9881
|
// src/commands/ravendb/getAccessToken.ts
|
|
9826
9882
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -9857,10 +9913,10 @@ ${errorText}`
|
|
|
9857
9913
|
|
|
9858
9914
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
9859
9915
|
import { execSync as execSync35 } from "child_process";
|
|
9860
|
-
import
|
|
9916
|
+
import chalk113 from "chalk";
|
|
9861
9917
|
function resolveOpSecret(reference) {
|
|
9862
9918
|
if (!reference.startsWith("op://")) {
|
|
9863
|
-
console.error(
|
|
9919
|
+
console.error(chalk113.red(`Invalid secret reference: must start with op://`));
|
|
9864
9920
|
process.exit(1);
|
|
9865
9921
|
}
|
|
9866
9922
|
try {
|
|
@@ -9870,7 +9926,7 @@ function resolveOpSecret(reference) {
|
|
|
9870
9926
|
}).trim();
|
|
9871
9927
|
} catch {
|
|
9872
9928
|
console.error(
|
|
9873
|
-
|
|
9929
|
+
chalk113.red(
|
|
9874
9930
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
9875
9931
|
)
|
|
9876
9932
|
);
|
|
@@ -9897,7 +9953,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9897
9953
|
if (!response.ok) {
|
|
9898
9954
|
const body = await response.text();
|
|
9899
9955
|
console.error(
|
|
9900
|
-
|
|
9956
|
+
chalk114.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
9901
9957
|
);
|
|
9902
9958
|
console.error(body.substring(0, 500));
|
|
9903
9959
|
process.exit(1);
|
|
@@ -9906,7 +9962,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9906
9962
|
}
|
|
9907
9963
|
|
|
9908
9964
|
// src/commands/ravendb/resolveConnection.ts
|
|
9909
|
-
import
|
|
9965
|
+
import chalk115 from "chalk";
|
|
9910
9966
|
function loadRavendb() {
|
|
9911
9967
|
const raw = loadGlobalConfigRaw();
|
|
9912
9968
|
const ravendb = raw.ravendb;
|
|
@@ -9920,7 +9976,7 @@ function resolveConnection(name) {
|
|
|
9920
9976
|
const connectionName = name ?? defaultConnection;
|
|
9921
9977
|
if (!connectionName) {
|
|
9922
9978
|
console.error(
|
|
9923
|
-
|
|
9979
|
+
chalk115.red(
|
|
9924
9980
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
9925
9981
|
)
|
|
9926
9982
|
);
|
|
@@ -9928,7 +9984,7 @@ function resolveConnection(name) {
|
|
|
9928
9984
|
}
|
|
9929
9985
|
const connection = connections.find((c) => c.name === connectionName);
|
|
9930
9986
|
if (!connection) {
|
|
9931
|
-
console.error(
|
|
9987
|
+
console.error(chalk115.red(`Connection "${connectionName}" not found.`));
|
|
9932
9988
|
console.error(
|
|
9933
9989
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9934
9990
|
);
|
|
@@ -9959,15 +10015,15 @@ async function ravendbCollections(connectionName) {
|
|
|
9959
10015
|
return;
|
|
9960
10016
|
}
|
|
9961
10017
|
for (const c of collections) {
|
|
9962
|
-
console.log(`${
|
|
10018
|
+
console.log(`${chalk116.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
9963
10019
|
}
|
|
9964
10020
|
}
|
|
9965
10021
|
|
|
9966
10022
|
// src/commands/ravendb/ravendbQuery.ts
|
|
9967
|
-
import
|
|
10023
|
+
import chalk118 from "chalk";
|
|
9968
10024
|
|
|
9969
10025
|
// src/commands/ravendb/fetchAllPages.ts
|
|
9970
|
-
import
|
|
10026
|
+
import chalk117 from "chalk";
|
|
9971
10027
|
|
|
9972
10028
|
// src/commands/ravendb/buildQueryPath.ts
|
|
9973
10029
|
function buildQueryPath(opts) {
|
|
@@ -10005,7 +10061,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10005
10061
|
allResults.push(...results);
|
|
10006
10062
|
start3 += results.length;
|
|
10007
10063
|
process.stderr.write(
|
|
10008
|
-
`\r${
|
|
10064
|
+
`\r${chalk117.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
10009
10065
|
);
|
|
10010
10066
|
if (start3 >= totalResults) break;
|
|
10011
10067
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -10020,7 +10076,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10020
10076
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
10021
10077
|
const resolved = resolveArgs(connectionName, collection);
|
|
10022
10078
|
if (!resolved.collection && !options2.query) {
|
|
10023
|
-
console.error(
|
|
10079
|
+
console.error(chalk118.red("Provide a collection name or --query filter."));
|
|
10024
10080
|
process.exit(1);
|
|
10025
10081
|
}
|
|
10026
10082
|
const { collection: col } = resolved;
|
|
@@ -10058,7 +10114,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
10058
10114
|
import * as path29 from "path";
|
|
10059
10115
|
|
|
10060
10116
|
// src/commands/refactor/logViolations.ts
|
|
10061
|
-
import
|
|
10117
|
+
import chalk119 from "chalk";
|
|
10062
10118
|
var DEFAULT_MAX_LINES = 100;
|
|
10063
10119
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
10064
10120
|
if (violations.length === 0) {
|
|
@@ -10067,43 +10123,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
10067
10123
|
}
|
|
10068
10124
|
return;
|
|
10069
10125
|
}
|
|
10070
|
-
console.error(
|
|
10126
|
+
console.error(chalk119.red(`
|
|
10071
10127
|
Refactor check failed:
|
|
10072
10128
|
`));
|
|
10073
|
-
console.error(
|
|
10129
|
+
console.error(chalk119.red(` The following files exceed ${maxLines} lines:
|
|
10074
10130
|
`));
|
|
10075
10131
|
for (const violation of violations) {
|
|
10076
|
-
console.error(
|
|
10132
|
+
console.error(chalk119.red(` ${violation.file} (${violation.lines} lines)`));
|
|
10077
10133
|
}
|
|
10078
10134
|
console.error(
|
|
10079
|
-
|
|
10135
|
+
chalk119.yellow(
|
|
10080
10136
|
`
|
|
10081
10137
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
10082
10138
|
way to refactor it, ignore it with:
|
|
10083
10139
|
`
|
|
10084
10140
|
)
|
|
10085
10141
|
);
|
|
10086
|
-
console.error(
|
|
10142
|
+
console.error(chalk119.gray(` assist refactor ignore <file>
|
|
10087
10143
|
`));
|
|
10088
10144
|
if (process.env.CLAUDECODE) {
|
|
10089
|
-
console.error(
|
|
10145
|
+
console.error(chalk119.cyan(`
|
|
10090
10146
|
## Extracting Code to New Files
|
|
10091
10147
|
`));
|
|
10092
10148
|
console.error(
|
|
10093
|
-
|
|
10149
|
+
chalk119.cyan(
|
|
10094
10150
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
10095
10151
|
`
|
|
10096
10152
|
)
|
|
10097
10153
|
);
|
|
10098
10154
|
console.error(
|
|
10099
|
-
|
|
10155
|
+
chalk119.cyan(
|
|
10100
10156
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
10101
10157
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
10102
10158
|
`
|
|
10103
10159
|
)
|
|
10104
10160
|
);
|
|
10105
10161
|
console.error(
|
|
10106
|
-
|
|
10162
|
+
chalk119.cyan(
|
|
10107
10163
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
10108
10164
|
domains, move it to a common/shared folder.
|
|
10109
10165
|
`
|
|
@@ -10259,7 +10315,7 @@ async function check(pattern2, options2) {
|
|
|
10259
10315
|
|
|
10260
10316
|
// src/commands/refactor/extract/index.ts
|
|
10261
10317
|
import path36 from "path";
|
|
10262
|
-
import
|
|
10318
|
+
import chalk122 from "chalk";
|
|
10263
10319
|
|
|
10264
10320
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
10265
10321
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -10806,23 +10862,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
10806
10862
|
|
|
10807
10863
|
// src/commands/refactor/extract/displayPlan.ts
|
|
10808
10864
|
import path33 from "path";
|
|
10809
|
-
import
|
|
10865
|
+
import chalk120 from "chalk";
|
|
10810
10866
|
function section(title) {
|
|
10811
10867
|
return `
|
|
10812
|
-
${
|
|
10868
|
+
${chalk120.cyan(title)}`;
|
|
10813
10869
|
}
|
|
10814
10870
|
function displayImporters(plan2, cwd) {
|
|
10815
10871
|
if (plan2.importersToUpdate.length === 0) return;
|
|
10816
10872
|
console.log(section("Update importers:"));
|
|
10817
10873
|
for (const imp of plan2.importersToUpdate) {
|
|
10818
10874
|
const rel = path33.relative(cwd, imp.file.getFilePath());
|
|
10819
|
-
console.log(` ${
|
|
10875
|
+
console.log(` ${chalk120.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
10820
10876
|
}
|
|
10821
10877
|
}
|
|
10822
10878
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
10823
|
-
console.log(
|
|
10879
|
+
console.log(chalk120.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
10824
10880
|
`));
|
|
10825
|
-
console.log(` ${
|
|
10881
|
+
console.log(` ${chalk120.cyan("Functions to move:")}`);
|
|
10826
10882
|
for (const name of plan2.extractedNames) {
|
|
10827
10883
|
console.log(` ${name}`);
|
|
10828
10884
|
}
|
|
@@ -10856,7 +10912,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
10856
10912
|
|
|
10857
10913
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
10858
10914
|
import path35 from "path";
|
|
10859
|
-
import
|
|
10915
|
+
import chalk121 from "chalk";
|
|
10860
10916
|
import { Project as Project3 } from "ts-morph";
|
|
10861
10917
|
|
|
10862
10918
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -10916,7 +10972,7 @@ function loadProjectFile(file) {
|
|
|
10916
10972
|
});
|
|
10917
10973
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
10918
10974
|
if (!sourceFile) {
|
|
10919
|
-
console.log(
|
|
10975
|
+
console.log(chalk121.red(`File not found in project: ${file}`));
|
|
10920
10976
|
process.exit(1);
|
|
10921
10977
|
}
|
|
10922
10978
|
return { project, sourceFile };
|
|
@@ -10939,19 +10995,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
10939
10995
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
10940
10996
|
if (options2.apply) {
|
|
10941
10997
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
10942
|
-
console.log(
|
|
10998
|
+
console.log(chalk122.green("\nExtraction complete"));
|
|
10943
10999
|
} else {
|
|
10944
|
-
console.log(
|
|
11000
|
+
console.log(chalk122.dim("\nDry run. Use --apply to execute."));
|
|
10945
11001
|
}
|
|
10946
11002
|
}
|
|
10947
11003
|
|
|
10948
11004
|
// src/commands/refactor/ignore.ts
|
|
10949
11005
|
import fs20 from "fs";
|
|
10950
|
-
import
|
|
11006
|
+
import chalk123 from "chalk";
|
|
10951
11007
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
10952
11008
|
function ignore(file) {
|
|
10953
11009
|
if (!fs20.existsSync(file)) {
|
|
10954
|
-
console.error(
|
|
11010
|
+
console.error(chalk123.red(`Error: File does not exist: ${file}`));
|
|
10955
11011
|
process.exit(1);
|
|
10956
11012
|
}
|
|
10957
11013
|
const content = fs20.readFileSync(file, "utf-8");
|
|
@@ -10967,7 +11023,7 @@ function ignore(file) {
|
|
|
10967
11023
|
fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
10968
11024
|
}
|
|
10969
11025
|
console.log(
|
|
10970
|
-
|
|
11026
|
+
chalk123.green(
|
|
10971
11027
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
10972
11028
|
)
|
|
10973
11029
|
);
|
|
@@ -10975,25 +11031,25 @@ function ignore(file) {
|
|
|
10975
11031
|
|
|
10976
11032
|
// src/commands/refactor/rename/index.ts
|
|
10977
11033
|
import path37 from "path";
|
|
10978
|
-
import
|
|
11034
|
+
import chalk124 from "chalk";
|
|
10979
11035
|
async function rename(source, destination, options2 = {}) {
|
|
10980
11036
|
const destPath = path37.resolve(destination);
|
|
10981
11037
|
const cwd = process.cwd();
|
|
10982
11038
|
const relSource = path37.relative(cwd, path37.resolve(source));
|
|
10983
11039
|
const relDest = path37.relative(cwd, destPath);
|
|
10984
11040
|
const { project, sourceFile } = loadProjectFile(source);
|
|
10985
|
-
console.log(
|
|
11041
|
+
console.log(chalk124.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
10986
11042
|
if (options2.apply) {
|
|
10987
11043
|
sourceFile.move(destPath);
|
|
10988
11044
|
await project.save();
|
|
10989
|
-
console.log(
|
|
11045
|
+
console.log(chalk124.green("Done"));
|
|
10990
11046
|
} else {
|
|
10991
|
-
console.log(
|
|
11047
|
+
console.log(chalk124.dim("Dry run. Use --apply to execute."));
|
|
10992
11048
|
}
|
|
10993
11049
|
}
|
|
10994
11050
|
|
|
10995
11051
|
// src/commands/refactor/renameSymbol/index.ts
|
|
10996
|
-
import
|
|
11052
|
+
import chalk125 from "chalk";
|
|
10997
11053
|
|
|
10998
11054
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
10999
11055
|
import { SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
@@ -11039,33 +11095,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
11039
11095
|
const { project, sourceFile } = loadProjectFile(file);
|
|
11040
11096
|
const symbol = findSymbol(sourceFile, oldName);
|
|
11041
11097
|
if (!symbol) {
|
|
11042
|
-
console.log(
|
|
11098
|
+
console.log(chalk125.red(`Symbol "${oldName}" not found in ${file}`));
|
|
11043
11099
|
process.exit(1);
|
|
11044
11100
|
}
|
|
11045
11101
|
const grouped = groupReferences(symbol, cwd);
|
|
11046
11102
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
11047
11103
|
console.log(
|
|
11048
|
-
|
|
11104
|
+
chalk125.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
11049
11105
|
`)
|
|
11050
11106
|
);
|
|
11051
11107
|
for (const [refFile, lines] of grouped) {
|
|
11052
11108
|
console.log(
|
|
11053
|
-
` ${
|
|
11109
|
+
` ${chalk125.dim(refFile)}: lines ${chalk125.cyan(lines.join(", "))}`
|
|
11054
11110
|
);
|
|
11055
11111
|
}
|
|
11056
11112
|
if (options2.apply) {
|
|
11057
11113
|
symbol.rename(newName);
|
|
11058
11114
|
await project.save();
|
|
11059
|
-
console.log(
|
|
11115
|
+
console.log(chalk125.green(`
|
|
11060
11116
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
11061
11117
|
} else {
|
|
11062
|
-
console.log(
|
|
11118
|
+
console.log(chalk125.dim("\nDry run. Use --apply to execute."));
|
|
11063
11119
|
}
|
|
11064
11120
|
}
|
|
11065
11121
|
|
|
11066
11122
|
// src/commands/refactor/restructure/index.ts
|
|
11067
11123
|
import path47 from "path";
|
|
11068
|
-
import
|
|
11124
|
+
import chalk128 from "chalk";
|
|
11069
11125
|
|
|
11070
11126
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
11071
11127
|
import path39 from "path";
|
|
@@ -11308,50 +11364,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
11308
11364
|
|
|
11309
11365
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
11310
11366
|
import path43 from "path";
|
|
11311
|
-
import
|
|
11367
|
+
import chalk126 from "chalk";
|
|
11312
11368
|
function relPath(filePath) {
|
|
11313
11369
|
return path43.relative(process.cwd(), filePath);
|
|
11314
11370
|
}
|
|
11315
11371
|
function displayMoves(plan2) {
|
|
11316
11372
|
if (plan2.moves.length === 0) return;
|
|
11317
|
-
console.log(
|
|
11373
|
+
console.log(chalk126.bold("\nFile moves:"));
|
|
11318
11374
|
for (const move of plan2.moves) {
|
|
11319
11375
|
console.log(
|
|
11320
|
-
` ${
|
|
11376
|
+
` ${chalk126.red(relPath(move.from))} \u2192 ${chalk126.green(relPath(move.to))}`
|
|
11321
11377
|
);
|
|
11322
|
-
console.log(
|
|
11378
|
+
console.log(chalk126.dim(` ${move.reason}`));
|
|
11323
11379
|
}
|
|
11324
11380
|
}
|
|
11325
11381
|
function displayRewrites(rewrites) {
|
|
11326
11382
|
if (rewrites.length === 0) return;
|
|
11327
11383
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
11328
|
-
console.log(
|
|
11384
|
+
console.log(chalk126.bold(`
|
|
11329
11385
|
Import rewrites (${affectedFiles.size} files):`));
|
|
11330
11386
|
for (const file of affectedFiles) {
|
|
11331
|
-
console.log(` ${
|
|
11387
|
+
console.log(` ${chalk126.cyan(relPath(file))}:`);
|
|
11332
11388
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
11333
11389
|
(r) => r.file === file
|
|
11334
11390
|
)) {
|
|
11335
11391
|
console.log(
|
|
11336
|
-
` ${
|
|
11392
|
+
` ${chalk126.red(`"${oldSpecifier}"`)} \u2192 ${chalk126.green(`"${newSpecifier}"`)}`
|
|
11337
11393
|
);
|
|
11338
11394
|
}
|
|
11339
11395
|
}
|
|
11340
11396
|
}
|
|
11341
11397
|
function displayPlan2(plan2) {
|
|
11342
11398
|
if (plan2.warnings.length > 0) {
|
|
11343
|
-
console.log(
|
|
11344
|
-
for (const w of plan2.warnings) console.log(
|
|
11399
|
+
console.log(chalk126.yellow("\nWarnings:"));
|
|
11400
|
+
for (const w of plan2.warnings) console.log(chalk126.yellow(` ${w}`));
|
|
11345
11401
|
}
|
|
11346
11402
|
if (plan2.newDirectories.length > 0) {
|
|
11347
|
-
console.log(
|
|
11403
|
+
console.log(chalk126.bold("\nNew directories:"));
|
|
11348
11404
|
for (const dir of plan2.newDirectories)
|
|
11349
|
-
console.log(
|
|
11405
|
+
console.log(chalk126.green(` ${dir}/`));
|
|
11350
11406
|
}
|
|
11351
11407
|
displayMoves(plan2);
|
|
11352
11408
|
displayRewrites(plan2.rewrites);
|
|
11353
11409
|
console.log(
|
|
11354
|
-
|
|
11410
|
+
chalk126.dim(
|
|
11355
11411
|
`
|
|
11356
11412
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
11357
11413
|
)
|
|
@@ -11361,18 +11417,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
11361
11417
|
// src/commands/refactor/restructure/executePlan.ts
|
|
11362
11418
|
import fs22 from "fs";
|
|
11363
11419
|
import path44 from "path";
|
|
11364
|
-
import
|
|
11420
|
+
import chalk127 from "chalk";
|
|
11365
11421
|
function executePlan(plan2) {
|
|
11366
11422
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
11367
11423
|
for (const [file, content] of updatedContents) {
|
|
11368
11424
|
fs22.writeFileSync(file, content, "utf-8");
|
|
11369
11425
|
console.log(
|
|
11370
|
-
|
|
11426
|
+
chalk127.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
|
|
11371
11427
|
);
|
|
11372
11428
|
}
|
|
11373
11429
|
for (const dir of plan2.newDirectories) {
|
|
11374
11430
|
fs22.mkdirSync(dir, { recursive: true });
|
|
11375
|
-
console.log(
|
|
11431
|
+
console.log(chalk127.green(` Created ${path44.relative(process.cwd(), dir)}/`));
|
|
11376
11432
|
}
|
|
11377
11433
|
for (const move of plan2.moves) {
|
|
11378
11434
|
const targetDir = path44.dirname(move.to);
|
|
@@ -11381,7 +11437,7 @@ function executePlan(plan2) {
|
|
|
11381
11437
|
}
|
|
11382
11438
|
fs22.renameSync(move.from, move.to);
|
|
11383
11439
|
console.log(
|
|
11384
|
-
|
|
11440
|
+
chalk127.white(
|
|
11385
11441
|
` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
|
|
11386
11442
|
)
|
|
11387
11443
|
);
|
|
@@ -11396,7 +11452,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
11396
11452
|
if (entries.length === 0) {
|
|
11397
11453
|
fs22.rmdirSync(dir);
|
|
11398
11454
|
console.log(
|
|
11399
|
-
|
|
11455
|
+
chalk127.dim(
|
|
11400
11456
|
` Removed empty directory ${path44.relative(process.cwd(), dir)}`
|
|
11401
11457
|
)
|
|
11402
11458
|
);
|
|
@@ -11529,22 +11585,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
11529
11585
|
const targetPattern = pattern2 ?? "src";
|
|
11530
11586
|
const files = findSourceFiles2(targetPattern);
|
|
11531
11587
|
if (files.length === 0) {
|
|
11532
|
-
console.log(
|
|
11588
|
+
console.log(chalk128.yellow("No files found matching pattern"));
|
|
11533
11589
|
return;
|
|
11534
11590
|
}
|
|
11535
11591
|
const tsConfigPath = path47.resolve("tsconfig.json");
|
|
11536
11592
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
11537
11593
|
if (plan2.moves.length === 0) {
|
|
11538
|
-
console.log(
|
|
11594
|
+
console.log(chalk128.green("No restructuring needed"));
|
|
11539
11595
|
return;
|
|
11540
11596
|
}
|
|
11541
11597
|
displayPlan2(plan2);
|
|
11542
11598
|
if (options2.apply) {
|
|
11543
|
-
console.log(
|
|
11599
|
+
console.log(chalk128.bold("\nApplying changes..."));
|
|
11544
11600
|
executePlan(plan2);
|
|
11545
|
-
console.log(
|
|
11601
|
+
console.log(chalk128.green("\nRestructuring complete"));
|
|
11546
11602
|
} else {
|
|
11547
|
-
console.log(
|
|
11603
|
+
console.log(chalk128.dim("\nDry run. Use --apply to execute."));
|
|
11548
11604
|
}
|
|
11549
11605
|
}
|
|
11550
11606
|
|
|
@@ -11995,18 +12051,18 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
11995
12051
|
}
|
|
11996
12052
|
|
|
11997
12053
|
// src/commands/review/warnUnlocated.ts
|
|
11998
|
-
import
|
|
12054
|
+
import chalk129 from "chalk";
|
|
11999
12055
|
function warnUnlocated(unlocated) {
|
|
12000
12056
|
if (unlocated.length === 0) return;
|
|
12001
12057
|
console.warn(
|
|
12002
|
-
|
|
12058
|
+
chalk129.yellow(
|
|
12003
12059
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
12004
12060
|
)
|
|
12005
12061
|
);
|
|
12006
12062
|
for (const finding of unlocated) {
|
|
12007
|
-
const where = finding.location ||
|
|
12063
|
+
const where = finding.location || chalk129.dim("missing");
|
|
12008
12064
|
console.warn(
|
|
12009
|
-
` ${
|
|
12065
|
+
` ${chalk129.yellow("\xB7")} ${finding.title} ${chalk129.dim(`(${where})`)}`
|
|
12010
12066
|
);
|
|
12011
12067
|
}
|
|
12012
12068
|
}
|
|
@@ -12858,7 +12914,7 @@ function registerReview(program2) {
|
|
|
12858
12914
|
}
|
|
12859
12915
|
|
|
12860
12916
|
// src/commands/seq/seqAuth.ts
|
|
12861
|
-
import
|
|
12917
|
+
import chalk131 from "chalk";
|
|
12862
12918
|
|
|
12863
12919
|
// src/commands/seq/loadConnections.ts
|
|
12864
12920
|
function loadConnections2() {
|
|
@@ -12887,10 +12943,10 @@ function setDefaultConnection(name) {
|
|
|
12887
12943
|
}
|
|
12888
12944
|
|
|
12889
12945
|
// src/shared/assertUniqueName.ts
|
|
12890
|
-
import
|
|
12946
|
+
import chalk130 from "chalk";
|
|
12891
12947
|
function assertUniqueName(existingNames, name) {
|
|
12892
12948
|
if (existingNames.includes(name)) {
|
|
12893
|
-
console.error(
|
|
12949
|
+
console.error(chalk130.red(`Connection "${name}" already exists.`));
|
|
12894
12950
|
process.exit(1);
|
|
12895
12951
|
}
|
|
12896
12952
|
}
|
|
@@ -12908,16 +12964,16 @@ async function promptConnection2(existingNames) {
|
|
|
12908
12964
|
var seqAuth = createConnectionAuth({
|
|
12909
12965
|
load: loadConnections2,
|
|
12910
12966
|
save: saveConnections2,
|
|
12911
|
-
format: (c) => `${
|
|
12967
|
+
format: (c) => `${chalk131.bold(c.name)} ${c.url}`,
|
|
12912
12968
|
promptNew: promptConnection2,
|
|
12913
12969
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
12914
12970
|
});
|
|
12915
12971
|
|
|
12916
12972
|
// src/commands/seq/seqQuery.ts
|
|
12917
|
-
import
|
|
12973
|
+
import chalk135 from "chalk";
|
|
12918
12974
|
|
|
12919
12975
|
// src/commands/seq/fetchSeq.ts
|
|
12920
|
-
import
|
|
12976
|
+
import chalk132 from "chalk";
|
|
12921
12977
|
async function fetchSeq(conn, path52, params) {
|
|
12922
12978
|
const url = `${conn.url}${path52}?${params}`;
|
|
12923
12979
|
const response = await fetch(url, {
|
|
@@ -12928,7 +12984,7 @@ async function fetchSeq(conn, path52, params) {
|
|
|
12928
12984
|
});
|
|
12929
12985
|
if (!response.ok) {
|
|
12930
12986
|
const body = await response.text();
|
|
12931
|
-
console.error(
|
|
12987
|
+
console.error(chalk132.red(`Seq returned ${response.status}: ${body}`));
|
|
12932
12988
|
process.exit(1);
|
|
12933
12989
|
}
|
|
12934
12990
|
return response;
|
|
@@ -12983,23 +13039,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
12983
13039
|
}
|
|
12984
13040
|
|
|
12985
13041
|
// src/commands/seq/formatEvent.ts
|
|
12986
|
-
import
|
|
13042
|
+
import chalk133 from "chalk";
|
|
12987
13043
|
function levelColor(level) {
|
|
12988
13044
|
switch (level) {
|
|
12989
13045
|
case "Fatal":
|
|
12990
|
-
return
|
|
13046
|
+
return chalk133.bgRed.white;
|
|
12991
13047
|
case "Error":
|
|
12992
|
-
return
|
|
13048
|
+
return chalk133.red;
|
|
12993
13049
|
case "Warning":
|
|
12994
|
-
return
|
|
13050
|
+
return chalk133.yellow;
|
|
12995
13051
|
case "Information":
|
|
12996
|
-
return
|
|
13052
|
+
return chalk133.cyan;
|
|
12997
13053
|
case "Debug":
|
|
12998
|
-
return
|
|
13054
|
+
return chalk133.gray;
|
|
12999
13055
|
case "Verbose":
|
|
13000
|
-
return
|
|
13056
|
+
return chalk133.dim;
|
|
13001
13057
|
default:
|
|
13002
|
-
return
|
|
13058
|
+
return chalk133.white;
|
|
13003
13059
|
}
|
|
13004
13060
|
}
|
|
13005
13061
|
function levelAbbrev(level) {
|
|
@@ -13040,12 +13096,12 @@ function formatTimestamp(iso) {
|
|
|
13040
13096
|
function formatEvent(event) {
|
|
13041
13097
|
const color = levelColor(event.Level);
|
|
13042
13098
|
const abbrev = levelAbbrev(event.Level);
|
|
13043
|
-
const ts8 =
|
|
13099
|
+
const ts8 = chalk133.dim(formatTimestamp(event.Timestamp));
|
|
13044
13100
|
const msg = renderMessage(event);
|
|
13045
13101
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
13046
13102
|
if (event.Exception) {
|
|
13047
13103
|
for (const line of event.Exception.split("\n")) {
|
|
13048
|
-
lines.push(
|
|
13104
|
+
lines.push(chalk133.red(` ${line}`));
|
|
13049
13105
|
}
|
|
13050
13106
|
}
|
|
13051
13107
|
return lines.join("\n");
|
|
@@ -13078,11 +13134,11 @@ function rejectTimestampFilter(filter) {
|
|
|
13078
13134
|
}
|
|
13079
13135
|
|
|
13080
13136
|
// src/shared/resolveNamedConnection.ts
|
|
13081
|
-
import
|
|
13137
|
+
import chalk134 from "chalk";
|
|
13082
13138
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
13083
13139
|
if (connections.length === 0) {
|
|
13084
13140
|
console.error(
|
|
13085
|
-
|
|
13141
|
+
chalk134.red(
|
|
13086
13142
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
13087
13143
|
)
|
|
13088
13144
|
);
|
|
@@ -13091,7 +13147,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
13091
13147
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
13092
13148
|
const connection = connections.find((c) => c.name === target);
|
|
13093
13149
|
if (!connection) {
|
|
13094
|
-
console.error(
|
|
13150
|
+
console.error(chalk134.red(`${kind} connection "${target}" not found.`));
|
|
13095
13151
|
process.exit(1);
|
|
13096
13152
|
}
|
|
13097
13153
|
return connection;
|
|
@@ -13120,7 +13176,7 @@ async function seqQuery(filter, options2) {
|
|
|
13120
13176
|
new URLSearchParams({ filter, count: String(count) })
|
|
13121
13177
|
);
|
|
13122
13178
|
if (events.length === 0) {
|
|
13123
|
-
console.log(
|
|
13179
|
+
console.log(chalk135.yellow("No events found."));
|
|
13124
13180
|
return;
|
|
13125
13181
|
}
|
|
13126
13182
|
if (options2.json) {
|
|
@@ -13131,11 +13187,11 @@ async function seqQuery(filter, options2) {
|
|
|
13131
13187
|
for (const event of chronological) {
|
|
13132
13188
|
console.log(formatEvent(event));
|
|
13133
13189
|
}
|
|
13134
|
-
console.log(
|
|
13190
|
+
console.log(chalk135.dim(`
|
|
13135
13191
|
${events.length} events`));
|
|
13136
13192
|
if (events.length >= count) {
|
|
13137
13193
|
console.log(
|
|
13138
|
-
|
|
13194
|
+
chalk135.yellow(
|
|
13139
13195
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
13140
13196
|
)
|
|
13141
13197
|
);
|
|
@@ -13143,10 +13199,10 @@ ${events.length} events`));
|
|
|
13143
13199
|
}
|
|
13144
13200
|
|
|
13145
13201
|
// src/shared/setNamedDefaultConnection.ts
|
|
13146
|
-
import
|
|
13202
|
+
import chalk136 from "chalk";
|
|
13147
13203
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
13148
13204
|
if (!connections.find((c) => c.name === name)) {
|
|
13149
|
-
console.error(
|
|
13205
|
+
console.error(chalk136.red(`Connection "${name}" not found.`));
|
|
13150
13206
|
process.exit(1);
|
|
13151
13207
|
}
|
|
13152
13208
|
setDefault(name);
|
|
@@ -13180,8 +13236,17 @@ function registerSeq(program2) {
|
|
|
13180
13236
|
).option("--json", "Output raw JSON").action((filter, options2) => seqQuery(filter, options2));
|
|
13181
13237
|
}
|
|
13182
13238
|
|
|
13239
|
+
// src/commands/registerSignal.ts
|
|
13240
|
+
function registerSignal(program2) {
|
|
13241
|
+
const signalCommand = program2.command("signal").description("Write an assist signal file");
|
|
13242
|
+
signalCommand.command("next").argument("[id]", "Backlog item ID to run directly").description("Write a next signal to chain into assist next").action((id) => {
|
|
13243
|
+
writeSignal("next", id ? { id } : void 0);
|
|
13244
|
+
console.log("Signal written.");
|
|
13245
|
+
});
|
|
13246
|
+
}
|
|
13247
|
+
|
|
13183
13248
|
// src/commands/sql/sqlAuth.ts
|
|
13184
|
-
import
|
|
13249
|
+
import chalk138 from "chalk";
|
|
13185
13250
|
|
|
13186
13251
|
// src/commands/sql/loadConnections.ts
|
|
13187
13252
|
function loadConnections3() {
|
|
@@ -13210,7 +13275,7 @@ function setDefaultConnection2(name) {
|
|
|
13210
13275
|
}
|
|
13211
13276
|
|
|
13212
13277
|
// src/commands/sql/promptConnection.ts
|
|
13213
|
-
import
|
|
13278
|
+
import chalk137 from "chalk";
|
|
13214
13279
|
async function promptConnection3(existingNames) {
|
|
13215
13280
|
const name = await promptInput("name", "Connection name:", "default");
|
|
13216
13281
|
assertUniqueName(existingNames, name);
|
|
@@ -13218,7 +13283,7 @@ async function promptConnection3(existingNames) {
|
|
|
13218
13283
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
13219
13284
|
const port = Number.parseInt(portStr, 10);
|
|
13220
13285
|
if (!Number.isFinite(port)) {
|
|
13221
|
-
console.error(
|
|
13286
|
+
console.error(chalk137.red(`Invalid port "${portStr}".`));
|
|
13222
13287
|
process.exit(1);
|
|
13223
13288
|
}
|
|
13224
13289
|
const user = await promptInput("user", "User:");
|
|
@@ -13231,13 +13296,13 @@ async function promptConnection3(existingNames) {
|
|
|
13231
13296
|
var sqlAuth = createConnectionAuth({
|
|
13232
13297
|
load: loadConnections3,
|
|
13233
13298
|
save: saveConnections3,
|
|
13234
|
-
format: (c) => `${
|
|
13299
|
+
format: (c) => `${chalk138.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
13235
13300
|
promptNew: promptConnection3,
|
|
13236
13301
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
13237
13302
|
});
|
|
13238
13303
|
|
|
13239
13304
|
// src/commands/sql/printTable.ts
|
|
13240
|
-
import
|
|
13305
|
+
import chalk139 from "chalk";
|
|
13241
13306
|
function formatCell(value) {
|
|
13242
13307
|
if (value === null || value === void 0) return "";
|
|
13243
13308
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -13246,7 +13311,7 @@ function formatCell(value) {
|
|
|
13246
13311
|
}
|
|
13247
13312
|
function printTable(rows) {
|
|
13248
13313
|
if (rows.length === 0) {
|
|
13249
|
-
console.log(
|
|
13314
|
+
console.log(chalk139.yellow("(no rows)"));
|
|
13250
13315
|
return;
|
|
13251
13316
|
}
|
|
13252
13317
|
const columns = Object.keys(rows[0]);
|
|
@@ -13254,13 +13319,13 @@ function printTable(rows) {
|
|
|
13254
13319
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
13255
13320
|
);
|
|
13256
13321
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
13257
|
-
console.log(
|
|
13258
|
-
console.log(
|
|
13322
|
+
console.log(chalk139.dim(header));
|
|
13323
|
+
console.log(chalk139.dim("-".repeat(header.length)));
|
|
13259
13324
|
for (const row of rows) {
|
|
13260
13325
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
13261
13326
|
console.log(line);
|
|
13262
13327
|
}
|
|
13263
|
-
console.log(
|
|
13328
|
+
console.log(chalk139.dim(`
|
|
13264
13329
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
13265
13330
|
}
|
|
13266
13331
|
|
|
@@ -13320,7 +13385,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
13320
13385
|
}
|
|
13321
13386
|
|
|
13322
13387
|
// src/commands/sql/sqlMutate.ts
|
|
13323
|
-
import
|
|
13388
|
+
import chalk140 from "chalk";
|
|
13324
13389
|
|
|
13325
13390
|
// src/commands/sql/isMutation.ts
|
|
13326
13391
|
var MUTATION_KEYWORDS = [
|
|
@@ -13354,7 +13419,7 @@ function isMutation(sql2) {
|
|
|
13354
13419
|
async function sqlMutate(query, connectionName) {
|
|
13355
13420
|
if (!isMutation(query)) {
|
|
13356
13421
|
console.error(
|
|
13357
|
-
|
|
13422
|
+
chalk140.red(
|
|
13358
13423
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
13359
13424
|
)
|
|
13360
13425
|
);
|
|
@@ -13364,18 +13429,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
13364
13429
|
const pool = await sqlConnect(conn);
|
|
13365
13430
|
try {
|
|
13366
13431
|
const result = await pool.request().query(query);
|
|
13367
|
-
console.log(
|
|
13432
|
+
console.log(chalk140.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
13368
13433
|
} finally {
|
|
13369
13434
|
await pool.close();
|
|
13370
13435
|
}
|
|
13371
13436
|
}
|
|
13372
13437
|
|
|
13373
13438
|
// src/commands/sql/sqlQuery.ts
|
|
13374
|
-
import
|
|
13439
|
+
import chalk141 from "chalk";
|
|
13375
13440
|
async function sqlQuery(query, connectionName) {
|
|
13376
13441
|
if (isMutation(query)) {
|
|
13377
13442
|
console.error(
|
|
13378
|
-
|
|
13443
|
+
chalk141.red(
|
|
13379
13444
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
13380
13445
|
)
|
|
13381
13446
|
);
|
|
@@ -13390,7 +13455,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
13390
13455
|
printTable(rows);
|
|
13391
13456
|
} else {
|
|
13392
13457
|
console.log(
|
|
13393
|
-
|
|
13458
|
+
chalk141.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
13394
13459
|
);
|
|
13395
13460
|
}
|
|
13396
13461
|
} finally {
|
|
@@ -13970,14 +14035,14 @@ import {
|
|
|
13970
14035
|
import { dirname as dirname22, join as join40 } from "path";
|
|
13971
14036
|
|
|
13972
14037
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
13973
|
-
import
|
|
14038
|
+
import chalk142 from "chalk";
|
|
13974
14039
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
13975
14040
|
function validateStagedContent(filename, content) {
|
|
13976
14041
|
const firstLine = content.split("\n")[0];
|
|
13977
14042
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
13978
14043
|
if (!match) {
|
|
13979
14044
|
console.error(
|
|
13980
|
-
|
|
14045
|
+
chalk142.red(
|
|
13981
14046
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
13982
14047
|
)
|
|
13983
14048
|
);
|
|
@@ -13986,7 +14051,7 @@ function validateStagedContent(filename, content) {
|
|
|
13986
14051
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
13987
14052
|
if (!contentAfterLink) {
|
|
13988
14053
|
console.error(
|
|
13989
|
-
|
|
14054
|
+
chalk142.red(
|
|
13990
14055
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
13991
14056
|
)
|
|
13992
14057
|
);
|
|
@@ -14345,7 +14410,7 @@ function status() {
|
|
|
14345
14410
|
|
|
14346
14411
|
// src/commands/voice/stop.ts
|
|
14347
14412
|
import { existsSync as existsSync44, readFileSync as readFileSync36, unlinkSync as unlinkSync13 } from "fs";
|
|
14348
|
-
function
|
|
14413
|
+
function stop2() {
|
|
14349
14414
|
if (!existsSync44(voicePaths.pid)) {
|
|
14350
14415
|
console.log("Voice daemon is not running (no PID file)");
|
|
14351
14416
|
return;
|
|
@@ -14374,7 +14439,7 @@ function registerVoice(program2) {
|
|
|
14374
14439
|
const voiceCommand = program2.command("voice").description("Voice interaction daemon for hands-free Claude commands");
|
|
14375
14440
|
voiceCommand.command("start").description("Start the voice daemon").option("--foreground", "Run in foreground for debugging").option("--debug", "Enable debug output (live VAD meter, verbose logging)").action((options2) => start2(options2));
|
|
14376
14441
|
voiceCommand.command("setup").description("Download required voice models (VAD, STT)").action(setup);
|
|
14377
|
-
voiceCommand.command("stop").description("Stop the voice daemon").action(
|
|
14442
|
+
voiceCommand.command("stop").description("Stop the voice daemon").action(stop2);
|
|
14378
14443
|
voiceCommand.command("status").description("Check voice daemon status").action(status);
|
|
14379
14444
|
voiceCommand.command("devices").description("List available audio input devices").action(devices);
|
|
14380
14445
|
voiceCommand.command("logs").description("Tail voice daemon logs").option("-n, --lines <count>", "Number of lines to show", "20").action((options2) => logs(options2));
|
|
@@ -14382,7 +14447,7 @@ function registerVoice(program2) {
|
|
|
14382
14447
|
|
|
14383
14448
|
// src/commands/roam/auth.ts
|
|
14384
14449
|
import { randomBytes } from "crypto";
|
|
14385
|
-
import
|
|
14450
|
+
import chalk143 from "chalk";
|
|
14386
14451
|
|
|
14387
14452
|
// src/lib/openBrowser.ts
|
|
14388
14453
|
import { execSync as execSync41 } from "child_process";
|
|
@@ -14557,13 +14622,13 @@ async function auth() {
|
|
|
14557
14622
|
saveGlobalConfig(config);
|
|
14558
14623
|
const state = randomBytes(16).toString("hex");
|
|
14559
14624
|
console.log(
|
|
14560
|
-
|
|
14625
|
+
chalk143.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
14561
14626
|
);
|
|
14562
|
-
console.log(
|
|
14563
|
-
console.log(
|
|
14564
|
-
console.log(
|
|
14627
|
+
console.log(chalk143.white("http://localhost:14523/callback\n"));
|
|
14628
|
+
console.log(chalk143.blue("Opening browser for authorization..."));
|
|
14629
|
+
console.log(chalk143.dim("Waiting for authorization callback..."));
|
|
14565
14630
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
14566
|
-
console.log(
|
|
14631
|
+
console.log(chalk143.dim("Exchanging code for tokens..."));
|
|
14567
14632
|
const tokens = await exchangeToken({
|
|
14568
14633
|
code,
|
|
14569
14634
|
clientId,
|
|
@@ -14579,7 +14644,7 @@ async function auth() {
|
|
|
14579
14644
|
};
|
|
14580
14645
|
saveGlobalConfig(config);
|
|
14581
14646
|
console.log(
|
|
14582
|
-
|
|
14647
|
+
chalk143.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
14583
14648
|
);
|
|
14584
14649
|
}
|
|
14585
14650
|
|
|
@@ -15002,7 +15067,7 @@ import { execSync as execSync43 } from "child_process";
|
|
|
15002
15067
|
import { existsSync as existsSync47, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync32 } from "fs";
|
|
15003
15068
|
import { tmpdir as tmpdir7 } from "os";
|
|
15004
15069
|
import { join as join51, resolve as resolve13 } from "path";
|
|
15005
|
-
import
|
|
15070
|
+
import chalk144 from "chalk";
|
|
15006
15071
|
|
|
15007
15072
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
15008
15073
|
var captureWindowPs1 = `
|
|
@@ -15153,20 +15218,20 @@ function screenshot(processName) {
|
|
|
15153
15218
|
const config = loadConfig();
|
|
15154
15219
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
15155
15220
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
15156
|
-
console.log(
|
|
15221
|
+
console.log(chalk144.gray(`Capturing window for process "${processName}" ...`));
|
|
15157
15222
|
try {
|
|
15158
15223
|
runPowerShellScript(processName, outputPath);
|
|
15159
|
-
console.log(
|
|
15224
|
+
console.log(chalk144.green(`Screenshot saved: ${outputPath}`));
|
|
15160
15225
|
} catch (error) {
|
|
15161
15226
|
const msg = error instanceof Error ? error.message : String(error);
|
|
15162
|
-
console.error(
|
|
15227
|
+
console.error(chalk144.red(`Failed to capture screenshot: ${msg}`));
|
|
15163
15228
|
process.exit(1);
|
|
15164
15229
|
}
|
|
15165
15230
|
}
|
|
15166
15231
|
|
|
15167
15232
|
// src/commands/sessions/summarise/index.ts
|
|
15168
15233
|
import * as fs27 from "fs";
|
|
15169
|
-
import
|
|
15234
|
+
import chalk145 from "chalk";
|
|
15170
15235
|
|
|
15171
15236
|
// src/commands/sessions/summarise/shared.ts
|
|
15172
15237
|
import * as fs25 from "fs";
|
|
@@ -15306,22 +15371,22 @@ ${firstMessage}`);
|
|
|
15306
15371
|
async function summarise3(options2) {
|
|
15307
15372
|
const files = await discoverSessionJsonlPaths();
|
|
15308
15373
|
if (files.length === 0) {
|
|
15309
|
-
console.log(
|
|
15374
|
+
console.log(chalk145.yellow("No sessions found."));
|
|
15310
15375
|
return;
|
|
15311
15376
|
}
|
|
15312
15377
|
const toProcess = selectCandidates(files, options2);
|
|
15313
15378
|
if (toProcess.length === 0) {
|
|
15314
|
-
console.log(
|
|
15379
|
+
console.log(chalk145.green("All sessions already summarised."));
|
|
15315
15380
|
return;
|
|
15316
15381
|
}
|
|
15317
15382
|
console.log(
|
|
15318
|
-
|
|
15383
|
+
chalk145.cyan(
|
|
15319
15384
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
15320
15385
|
)
|
|
15321
15386
|
);
|
|
15322
15387
|
const { succeeded, failed } = processSessions(toProcess);
|
|
15323
15388
|
console.log(
|
|
15324
|
-
|
|
15389
|
+
chalk145.green(`Done: ${succeeded} summarised`) + (failed > 0 ? chalk145.yellow(`, ${failed} skipped`) : "")
|
|
15325
15390
|
);
|
|
15326
15391
|
}
|
|
15327
15392
|
function selectCandidates(files, options2) {
|
|
@@ -15341,16 +15406,16 @@ function processSessions(files) {
|
|
|
15341
15406
|
let failed = 0;
|
|
15342
15407
|
for (let i = 0; i < files.length; i++) {
|
|
15343
15408
|
const file = files[i];
|
|
15344
|
-
process.stdout.write(
|
|
15409
|
+
process.stdout.write(chalk145.dim(` [${i + 1}/${files.length}] `));
|
|
15345
15410
|
const summary = summariseSession(file);
|
|
15346
15411
|
if (summary) {
|
|
15347
15412
|
writeSummary(file, summary);
|
|
15348
15413
|
succeeded++;
|
|
15349
|
-
process.stdout.write(`${
|
|
15414
|
+
process.stdout.write(`${chalk145.green("\u2713")} ${summary}
|
|
15350
15415
|
`);
|
|
15351
15416
|
} else {
|
|
15352
15417
|
failed++;
|
|
15353
|
-
process.stdout.write(` ${
|
|
15418
|
+
process.stdout.write(` ${chalk145.yellow("skip")}
|
|
15354
15419
|
`);
|
|
15355
15420
|
}
|
|
15356
15421
|
}
|
|
@@ -15365,10 +15430,10 @@ function registerSessions(program2) {
|
|
|
15365
15430
|
}
|
|
15366
15431
|
|
|
15367
15432
|
// src/commands/statusLine.ts
|
|
15368
|
-
import
|
|
15433
|
+
import chalk147 from "chalk";
|
|
15369
15434
|
|
|
15370
15435
|
// src/commands/buildLimitsSegment.ts
|
|
15371
|
-
import
|
|
15436
|
+
import chalk146 from "chalk";
|
|
15372
15437
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
15373
15438
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
15374
15439
|
function formatTimeLeft(resetsAt) {
|
|
@@ -15391,10 +15456,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
15391
15456
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
15392
15457
|
const label2 = `${Math.round(pct)}%`;
|
|
15393
15458
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
15394
|
-
if (projected == null) return
|
|
15395
|
-
if (projected > 100) return
|
|
15396
|
-
if (projected > 75) return
|
|
15397
|
-
return
|
|
15459
|
+
if (projected == null) return chalk146.green(label2);
|
|
15460
|
+
if (projected > 100) return chalk146.red(label2);
|
|
15461
|
+
if (projected > 75) return chalk146.yellow(label2);
|
|
15462
|
+
return chalk146.green(label2);
|
|
15398
15463
|
}
|
|
15399
15464
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
15400
15465
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -15420,14 +15485,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
15420
15485
|
}
|
|
15421
15486
|
|
|
15422
15487
|
// src/commands/statusLine.ts
|
|
15423
|
-
|
|
15488
|
+
chalk147.level = 3;
|
|
15424
15489
|
function formatNumber(num) {
|
|
15425
15490
|
return num.toLocaleString("en-US");
|
|
15426
15491
|
}
|
|
15427
15492
|
function colorizePercent(pct) {
|
|
15428
15493
|
const label2 = `${Math.round(pct)}%`;
|
|
15429
|
-
if (pct > 80) return
|
|
15430
|
-
if (pct > 40) return
|
|
15494
|
+
if (pct > 80) return chalk147.red(label2);
|
|
15495
|
+
if (pct > 40) return chalk147.yellow(label2);
|
|
15431
15496
|
return label2;
|
|
15432
15497
|
}
|
|
15433
15498
|
async function statusLine() {
|
|
@@ -15450,7 +15515,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
15450
15515
|
// src/commands/sync/syncClaudeMd.ts
|
|
15451
15516
|
import * as fs28 from "fs";
|
|
15452
15517
|
import * as path48 from "path";
|
|
15453
|
-
import
|
|
15518
|
+
import chalk148 from "chalk";
|
|
15454
15519
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
15455
15520
|
const source = path48.join(claudeDir, "CLAUDE.md");
|
|
15456
15521
|
const target = path48.join(targetBase, "CLAUDE.md");
|
|
@@ -15459,12 +15524,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15459
15524
|
const targetContent = fs28.readFileSync(target, "utf-8");
|
|
15460
15525
|
if (sourceContent !== targetContent) {
|
|
15461
15526
|
console.log(
|
|
15462
|
-
|
|
15527
|
+
chalk148.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
15463
15528
|
);
|
|
15464
15529
|
console.log();
|
|
15465
15530
|
printDiff(targetContent, sourceContent);
|
|
15466
15531
|
const confirm = options2?.yes || await promptConfirm(
|
|
15467
|
-
|
|
15532
|
+
chalk148.red("Overwrite existing CLAUDE.md?"),
|
|
15468
15533
|
false
|
|
15469
15534
|
);
|
|
15470
15535
|
if (!confirm) {
|
|
@@ -15480,7 +15545,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15480
15545
|
// src/commands/sync/syncSettings.ts
|
|
15481
15546
|
import * as fs29 from "fs";
|
|
15482
15547
|
import * as path49 from "path";
|
|
15483
|
-
import
|
|
15548
|
+
import chalk149 from "chalk";
|
|
15484
15549
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
15485
15550
|
const source = path49.join(claudeDir, "settings.json");
|
|
15486
15551
|
const target = path49.join(targetBase, "settings.json");
|
|
@@ -15496,14 +15561,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
15496
15561
|
if (mergedContent !== normalizedTarget) {
|
|
15497
15562
|
if (!options2?.yes) {
|
|
15498
15563
|
console.log(
|
|
15499
|
-
|
|
15564
|
+
chalk149.yellow(
|
|
15500
15565
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
15501
15566
|
)
|
|
15502
15567
|
);
|
|
15503
15568
|
console.log();
|
|
15504
15569
|
printDiff(targetContent, mergedContent);
|
|
15505
15570
|
const confirm = await promptConfirm(
|
|
15506
|
-
|
|
15571
|
+
chalk149.red("Overwrite existing settings.json?"),
|
|
15507
15572
|
false
|
|
15508
15573
|
);
|
|
15509
15574
|
if (!confirm) {
|
|
@@ -15628,9 +15693,5 @@ program.command("next").description("Alias for backlog next -w").action(() => ne
|
|
|
15628
15693
|
program.command("draft").alias("feat").description("Launch Claude in /draft mode, chain into next on /next signal").action(() => launchMode("draft"));
|
|
15629
15694
|
program.command("bug").description("Launch Claude in /bug mode, chain into next on /next signal").action(() => launchMode("bug"));
|
|
15630
15695
|
program.command("refine").argument("[id]", "Backlog item ID").description("Launch Claude in /refine mode to refine a backlog item").action((id) => refine(id));
|
|
15631
|
-
|
|
15632
|
-
signalCommand.command("next").description("Write a next signal to chain into assist next").action(() => {
|
|
15633
|
-
writeSignal("next");
|
|
15634
|
-
console.log("Signal written.");
|
|
15635
|
-
});
|
|
15696
|
+
registerSignal(program);
|
|
15636
15697
|
program.parse();
|