@staff0rd/assist 0.216.0 → 0.217.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/draft.md +2 -2
- package/claude/commands/next.md +1 -1
- package/dist/index.js +539 -498
- 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.217.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,20 @@ 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}`));
|
|
5255
5291
|
}
|
|
5256
5292
|
}
|
|
5257
5293
|
|
|
5258
5294
|
// src/commands/backlog/wontdo/index.ts
|
|
5259
|
-
import
|
|
5295
|
+
import chalk59 from "chalk";
|
|
5260
5296
|
async function wontdo(id, reason) {
|
|
5261
5297
|
const result = loadAndFindItem(id);
|
|
5262
5298
|
if (!result) return;
|
|
@@ -5266,7 +5302,7 @@ async function wontdo(id, reason) {
|
|
|
5266
5302
|
addPhaseSummary(result.item, reason, phase);
|
|
5267
5303
|
}
|
|
5268
5304
|
saveBacklog(result.items);
|
|
5269
|
-
console.log(
|
|
5305
|
+
console.log(chalk59.red(`Won't do item #${id}: ${result.item.name}`));
|
|
5270
5306
|
}
|
|
5271
5307
|
|
|
5272
5308
|
// src/commands/backlog/registerStatusCommands.ts
|
|
@@ -5278,10 +5314,10 @@ function registerStatusCommands(cmd) {
|
|
|
5278
5314
|
}
|
|
5279
5315
|
|
|
5280
5316
|
// src/commands/backlog/removePhase.ts
|
|
5281
|
-
import
|
|
5317
|
+
import chalk61 from "chalk";
|
|
5282
5318
|
|
|
5283
5319
|
// src/commands/backlog/findPhase.ts
|
|
5284
|
-
import
|
|
5320
|
+
import chalk60 from "chalk";
|
|
5285
5321
|
function findPhase(id, phase) {
|
|
5286
5322
|
const result = loadAndFindItem(id);
|
|
5287
5323
|
if (!result) return void 0;
|
|
@@ -5295,7 +5331,7 @@ function findPhase(id, phase) {
|
|
|
5295
5331
|
).get(itemId, phaseIdx);
|
|
5296
5332
|
if (existing.cnt === 0) {
|
|
5297
5333
|
console.log(
|
|
5298
|
-
|
|
5334
|
+
chalk60.red(`Phase ${phaseNumber} not found on item #${itemId}.`)
|
|
5299
5335
|
);
|
|
5300
5336
|
process.exitCode = 1;
|
|
5301
5337
|
return void 0;
|
|
@@ -5355,24 +5391,24 @@ function removePhase(id, phase) {
|
|
|
5355
5391
|
exportToJsonl(db, dir);
|
|
5356
5392
|
commitBacklog(itemId, result.item.name);
|
|
5357
5393
|
console.log(
|
|
5358
|
-
|
|
5394
|
+
chalk61.green(`Removed phase ${phaseIdx + 1} from item #${itemId}.`)
|
|
5359
5395
|
);
|
|
5360
5396
|
}
|
|
5361
5397
|
|
|
5362
5398
|
// src/commands/backlog/update/index.ts
|
|
5363
|
-
import
|
|
5399
|
+
import chalk63 from "chalk";
|
|
5364
5400
|
|
|
5365
5401
|
// src/commands/backlog/update/buildUpdateSql.ts
|
|
5366
|
-
import
|
|
5402
|
+
import chalk62 from "chalk";
|
|
5367
5403
|
function buildUpdateSql(options2) {
|
|
5368
5404
|
const { name, desc, type, ac } = options2;
|
|
5369
5405
|
if (!name && !desc && !type && !ac) {
|
|
5370
|
-
console.log(
|
|
5406
|
+
console.log(chalk62.red("Nothing to update. Provide at least one flag."));
|
|
5371
5407
|
process.exitCode = 1;
|
|
5372
5408
|
return void 0;
|
|
5373
5409
|
}
|
|
5374
5410
|
if (type && type !== "story" && type !== "bug") {
|
|
5375
|
-
console.log(
|
|
5411
|
+
console.log(chalk62.red('Invalid type. Must be "story" or "bug".'));
|
|
5376
5412
|
process.exitCode = 1;
|
|
5377
5413
|
return void 0;
|
|
5378
5414
|
}
|
|
@@ -5417,11 +5453,11 @@ function update(id, options2) {
|
|
|
5417
5453
|
);
|
|
5418
5454
|
exportToJsonl(db, dir);
|
|
5419
5455
|
commitBacklog(itemId, options2.name ?? result.item.name);
|
|
5420
|
-
console.log(
|
|
5456
|
+
console.log(chalk63.green(`Updated ${built.fields} on item #${itemId}.`));
|
|
5421
5457
|
}
|
|
5422
5458
|
|
|
5423
5459
|
// src/commands/backlog/updatePhase.ts
|
|
5424
|
-
import
|
|
5460
|
+
import chalk64 from "chalk";
|
|
5425
5461
|
|
|
5426
5462
|
// src/commands/backlog/applyPhaseUpdate.ts
|
|
5427
5463
|
function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
@@ -5455,7 +5491,7 @@ function applyPhaseUpdate(db, itemId, phaseIdx, fields) {
|
|
|
5455
5491
|
function updatePhase(id, phase, options2) {
|
|
5456
5492
|
const { name, task, manualCheck } = options2;
|
|
5457
5493
|
if (!name && !task && !manualCheck) {
|
|
5458
|
-
console.log(
|
|
5494
|
+
console.log(chalk64.red("Nothing to update. Provide at least one flag."));
|
|
5459
5495
|
process.exitCode = 1;
|
|
5460
5496
|
return;
|
|
5461
5497
|
}
|
|
@@ -5471,7 +5507,7 @@ function updatePhase(id, phase, options2) {
|
|
|
5471
5507
|
manualCheck && "manual checks"
|
|
5472
5508
|
].filter(Boolean).join(", ");
|
|
5473
5509
|
console.log(
|
|
5474
|
-
|
|
5510
|
+
chalk64.green(
|
|
5475
5511
|
`Updated ${fields} on phase ${phaseIdx + 1} of item #${itemId}.`
|
|
5476
5512
|
)
|
|
5477
5513
|
);
|
|
@@ -6100,11 +6136,11 @@ function assertCliExists(cli) {
|
|
|
6100
6136
|
}
|
|
6101
6137
|
|
|
6102
6138
|
// src/commands/permitCliReads/colorize.ts
|
|
6103
|
-
import
|
|
6139
|
+
import chalk65 from "chalk";
|
|
6104
6140
|
function colorize(plainOutput) {
|
|
6105
6141
|
return plainOutput.split("\n").map((line) => {
|
|
6106
|
-
if (line.startsWith(" R ")) return
|
|
6107
|
-
if (line.startsWith(" W ")) return
|
|
6142
|
+
if (line.startsWith(" R ")) return chalk65.green(line);
|
|
6143
|
+
if (line.startsWith(" W ")) return chalk65.red(line);
|
|
6108
6144
|
return line;
|
|
6109
6145
|
}).join("\n");
|
|
6110
6146
|
}
|
|
@@ -6402,7 +6438,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
6402
6438
|
}
|
|
6403
6439
|
|
|
6404
6440
|
// src/commands/deny/denyAdd.ts
|
|
6405
|
-
import
|
|
6441
|
+
import chalk66 from "chalk";
|
|
6406
6442
|
|
|
6407
6443
|
// src/commands/deny/loadDenyConfig.ts
|
|
6408
6444
|
function loadDenyConfig(global) {
|
|
@@ -6422,16 +6458,16 @@ function loadDenyConfig(global) {
|
|
|
6422
6458
|
function denyAdd(pattern2, message, options2) {
|
|
6423
6459
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6424
6460
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
6425
|
-
console.log(
|
|
6461
|
+
console.log(chalk66.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
6426
6462
|
return;
|
|
6427
6463
|
}
|
|
6428
6464
|
deny.push({ pattern: pattern2, message });
|
|
6429
6465
|
saveDeny(deny);
|
|
6430
|
-
console.log(
|
|
6466
|
+
console.log(chalk66.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
6431
6467
|
}
|
|
6432
6468
|
|
|
6433
6469
|
// src/commands/deny/denyList.ts
|
|
6434
|
-
import
|
|
6470
|
+
import chalk67 from "chalk";
|
|
6435
6471
|
function denyList() {
|
|
6436
6472
|
const globalRaw = loadGlobalConfigRaw();
|
|
6437
6473
|
const projectRaw = loadProjectConfig();
|
|
@@ -6442,7 +6478,7 @@ function denyList() {
|
|
|
6442
6478
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
6443
6479
|
);
|
|
6444
6480
|
if (!merged || merged.length === 0) {
|
|
6445
|
-
console.log(
|
|
6481
|
+
console.log(chalk67.dim("No deny rules configured."));
|
|
6446
6482
|
return;
|
|
6447
6483
|
}
|
|
6448
6484
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -6450,23 +6486,23 @@ function denyList() {
|
|
|
6450
6486
|
for (const rule of merged) {
|
|
6451
6487
|
const inProject = projectPatterns.has(rule.pattern);
|
|
6452
6488
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
6453
|
-
const label2 = inProject && inGlobal ?
|
|
6454
|
-
console.log(`${
|
|
6489
|
+
const label2 = inProject && inGlobal ? chalk67.dim(" (project, overrides global)") : inGlobal ? chalk67.dim(" (global)") : "";
|
|
6490
|
+
console.log(`${chalk67.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
6455
6491
|
}
|
|
6456
6492
|
}
|
|
6457
6493
|
|
|
6458
6494
|
// src/commands/deny/denyRemove.ts
|
|
6459
|
-
import
|
|
6495
|
+
import chalk68 from "chalk";
|
|
6460
6496
|
function denyRemove(pattern2, options2) {
|
|
6461
6497
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
6462
6498
|
const index = deny.findIndex((r) => r.pattern === pattern2);
|
|
6463
6499
|
if (index === -1) {
|
|
6464
|
-
console.log(
|
|
6500
|
+
console.log(chalk68.yellow(`No deny rule found for: ${pattern2}`));
|
|
6465
6501
|
return;
|
|
6466
6502
|
}
|
|
6467
6503
|
deny.splice(index, 1);
|
|
6468
6504
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
6469
|
-
console.log(
|
|
6505
|
+
console.log(chalk68.green(`Removed deny rule: ${pattern2}`));
|
|
6470
6506
|
}
|
|
6471
6507
|
|
|
6472
6508
|
// src/commands/registerDeny.ts
|
|
@@ -6495,15 +6531,15 @@ function registerCliHook(program2) {
|
|
|
6495
6531
|
}
|
|
6496
6532
|
|
|
6497
6533
|
// src/commands/complexity/analyze.ts
|
|
6498
|
-
import
|
|
6534
|
+
import chalk74 from "chalk";
|
|
6499
6535
|
|
|
6500
6536
|
// src/commands/complexity/cyclomatic.ts
|
|
6501
|
-
import
|
|
6537
|
+
import chalk70 from "chalk";
|
|
6502
6538
|
|
|
6503
6539
|
// src/commands/complexity/shared/index.ts
|
|
6504
6540
|
import fs14 from "fs";
|
|
6505
6541
|
import path22 from "path";
|
|
6506
|
-
import
|
|
6542
|
+
import chalk69 from "chalk";
|
|
6507
6543
|
import ts5 from "typescript";
|
|
6508
6544
|
|
|
6509
6545
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -6749,7 +6785,7 @@ function createSourceFromFile(filePath) {
|
|
|
6749
6785
|
function withSourceFiles(pattern2, callback) {
|
|
6750
6786
|
const files = findSourceFiles2(pattern2);
|
|
6751
6787
|
if (files.length === 0) {
|
|
6752
|
-
console.log(
|
|
6788
|
+
console.log(chalk69.yellow("No files found matching pattern"));
|
|
6753
6789
|
return void 0;
|
|
6754
6790
|
}
|
|
6755
6791
|
return callback(files);
|
|
@@ -6782,11 +6818,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6782
6818
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
6783
6819
|
for (const { file, name, complexity } of results) {
|
|
6784
6820
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
6785
|
-
const color = exceedsThreshold ?
|
|
6786
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
6821
|
+
const color = exceedsThreshold ? chalk70.red : chalk70.white;
|
|
6822
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk70.cyan(complexity)}`);
|
|
6787
6823
|
}
|
|
6788
6824
|
console.log(
|
|
6789
|
-
|
|
6825
|
+
chalk70.dim(
|
|
6790
6826
|
`
|
|
6791
6827
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6792
6828
|
)
|
|
@@ -6798,7 +6834,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6798
6834
|
}
|
|
6799
6835
|
|
|
6800
6836
|
// src/commands/complexity/halstead.ts
|
|
6801
|
-
import
|
|
6837
|
+
import chalk71 from "chalk";
|
|
6802
6838
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
6803
6839
|
withSourceFiles(pattern2, (files) => {
|
|
6804
6840
|
const results = [];
|
|
@@ -6813,13 +6849,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6813
6849
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
6814
6850
|
for (const { file, name, metrics } of results) {
|
|
6815
6851
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
6816
|
-
const color = exceedsThreshold ?
|
|
6852
|
+
const color = exceedsThreshold ? chalk71.red : chalk71.white;
|
|
6817
6853
|
console.log(
|
|
6818
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
6854
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk71.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk71.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk71.magenta(metrics.effort.toFixed(1))}`
|
|
6819
6855
|
);
|
|
6820
6856
|
}
|
|
6821
6857
|
console.log(
|
|
6822
|
-
|
|
6858
|
+
chalk71.dim(
|
|
6823
6859
|
`
|
|
6824
6860
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
6825
6861
|
)
|
|
@@ -6834,28 +6870,28 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
6834
6870
|
import fs15 from "fs";
|
|
6835
6871
|
|
|
6836
6872
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
6837
|
-
import
|
|
6873
|
+
import chalk72 from "chalk";
|
|
6838
6874
|
function displayMaintainabilityResults(results, threshold) {
|
|
6839
6875
|
const filtered = threshold !== void 0 ? results.filter((r) => r.minMaintainability < threshold) : results;
|
|
6840
6876
|
if (threshold !== void 0 && filtered.length === 0) {
|
|
6841
|
-
console.log(
|
|
6877
|
+
console.log(chalk72.green("All files pass maintainability threshold"));
|
|
6842
6878
|
} else {
|
|
6843
6879
|
for (const { file, avgMaintainability, minMaintainability } of filtered) {
|
|
6844
|
-
const color = threshold !== void 0 ?
|
|
6880
|
+
const color = threshold !== void 0 ? chalk72.red : chalk72.white;
|
|
6845
6881
|
console.log(
|
|
6846
|
-
`${color(file)} \u2192 avg: ${
|
|
6882
|
+
`${color(file)} \u2192 avg: ${chalk72.cyan(avgMaintainability.toFixed(1))}, min: ${chalk72.yellow(minMaintainability.toFixed(1))}`
|
|
6847
6883
|
);
|
|
6848
6884
|
}
|
|
6849
6885
|
}
|
|
6850
|
-
console.log(
|
|
6886
|
+
console.log(chalk72.dim(`
|
|
6851
6887
|
Analyzed ${results.length} files`));
|
|
6852
6888
|
if (filtered.length > 0 && threshold !== void 0) {
|
|
6853
6889
|
console.error(
|
|
6854
|
-
|
|
6890
|
+
chalk72.red(
|
|
6855
6891
|
`
|
|
6856
6892
|
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
6857
6893
|
|
|
6858
|
-
\u26A0\uFE0F ${
|
|
6894
|
+
\u26A0\uFE0F ${chalk72.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
6895
|
)
|
|
6860
6896
|
);
|
|
6861
6897
|
process.exit(1);
|
|
@@ -6912,7 +6948,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6912
6948
|
|
|
6913
6949
|
// src/commands/complexity/sloc.ts
|
|
6914
6950
|
import fs16 from "fs";
|
|
6915
|
-
import
|
|
6951
|
+
import chalk73 from "chalk";
|
|
6916
6952
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
6917
6953
|
withSourceFiles(pattern2, (files) => {
|
|
6918
6954
|
const results = [];
|
|
@@ -6928,12 +6964,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
6928
6964
|
results.sort((a, b) => b.lines - a.lines);
|
|
6929
6965
|
for (const { file, lines } of results) {
|
|
6930
6966
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
6931
|
-
const color = exceedsThreshold ?
|
|
6932
|
-
console.log(`${color(file)} \u2192 ${
|
|
6967
|
+
const color = exceedsThreshold ? chalk73.red : chalk73.white;
|
|
6968
|
+
console.log(`${color(file)} \u2192 ${chalk73.cyan(lines)} lines`);
|
|
6933
6969
|
}
|
|
6934
6970
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
6935
6971
|
console.log(
|
|
6936
|
-
|
|
6972
|
+
chalk73.dim(`
|
|
6937
6973
|
Total: ${total} lines across ${files.length} files`)
|
|
6938
6974
|
);
|
|
6939
6975
|
if (hasViolation) {
|
|
@@ -6947,21 +6983,21 @@ async function analyze(pattern2) {
|
|
|
6947
6983
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
6948
6984
|
const files = findSourceFiles2(searchPattern);
|
|
6949
6985
|
if (files.length === 0) {
|
|
6950
|
-
console.log(
|
|
6986
|
+
console.log(chalk74.yellow("No files found matching pattern"));
|
|
6951
6987
|
return;
|
|
6952
6988
|
}
|
|
6953
6989
|
if (files.length === 1) {
|
|
6954
6990
|
const file = files[0];
|
|
6955
|
-
console.log(
|
|
6991
|
+
console.log(chalk74.bold.underline("SLOC"));
|
|
6956
6992
|
await sloc(file);
|
|
6957
6993
|
console.log();
|
|
6958
|
-
console.log(
|
|
6994
|
+
console.log(chalk74.bold.underline("Cyclomatic Complexity"));
|
|
6959
6995
|
await cyclomatic(file);
|
|
6960
6996
|
console.log();
|
|
6961
|
-
console.log(
|
|
6997
|
+
console.log(chalk74.bold.underline("Halstead Metrics"));
|
|
6962
6998
|
await halstead(file);
|
|
6963
6999
|
console.log();
|
|
6964
|
-
console.log(
|
|
7000
|
+
console.log(chalk74.bold.underline("Maintainability Index"));
|
|
6965
7001
|
await maintainability(file);
|
|
6966
7002
|
return;
|
|
6967
7003
|
}
|
|
@@ -6988,7 +7024,7 @@ function registerComplexity(program2) {
|
|
|
6988
7024
|
}
|
|
6989
7025
|
|
|
6990
7026
|
// src/commands/config/index.ts
|
|
6991
|
-
import
|
|
7027
|
+
import chalk75 from "chalk";
|
|
6992
7028
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
6993
7029
|
|
|
6994
7030
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7051,7 +7087,7 @@ function formatIssuePath(issue, key) {
|
|
|
7051
7087
|
function printValidationErrors(issues, key) {
|
|
7052
7088
|
for (const issue of issues) {
|
|
7053
7089
|
console.error(
|
|
7054
|
-
|
|
7090
|
+
chalk75.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7055
7091
|
);
|
|
7056
7092
|
}
|
|
7057
7093
|
}
|
|
@@ -7068,7 +7104,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7068
7104
|
function assertNotGlobalOnly(key, global) {
|
|
7069
7105
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7070
7106
|
console.error(
|
|
7071
|
-
|
|
7107
|
+
chalk75.red(
|
|
7072
7108
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7073
7109
|
)
|
|
7074
7110
|
);
|
|
@@ -7091,7 +7127,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7091
7127
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7092
7128
|
const target = options2.global ? "global" : "project";
|
|
7093
7129
|
console.log(
|
|
7094
|
-
|
|
7130
|
+
chalk75.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7095
7131
|
);
|
|
7096
7132
|
}
|
|
7097
7133
|
function configList() {
|
|
@@ -7100,7 +7136,7 @@ function configList() {
|
|
|
7100
7136
|
}
|
|
7101
7137
|
|
|
7102
7138
|
// src/commands/config/configGet.ts
|
|
7103
|
-
import
|
|
7139
|
+
import chalk76 from "chalk";
|
|
7104
7140
|
|
|
7105
7141
|
// src/commands/config/getNestedValue.ts
|
|
7106
7142
|
function isTraversable(value) {
|
|
@@ -7132,7 +7168,7 @@ function requireNestedValue(config, key) {
|
|
|
7132
7168
|
return value;
|
|
7133
7169
|
}
|
|
7134
7170
|
function exitKeyNotSet(key) {
|
|
7135
|
-
console.error(
|
|
7171
|
+
console.error(chalk76.red(`Key "${key}" is not set`));
|
|
7136
7172
|
process.exit(1);
|
|
7137
7173
|
}
|
|
7138
7174
|
|
|
@@ -7146,7 +7182,7 @@ function registerConfig(program2) {
|
|
|
7146
7182
|
|
|
7147
7183
|
// src/commands/deploy/redirect.ts
|
|
7148
7184
|
import { existsSync as existsSync24, readFileSync as readFileSync20, writeFileSync as writeFileSync18 } from "fs";
|
|
7149
|
-
import
|
|
7185
|
+
import chalk77 from "chalk";
|
|
7150
7186
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7151
7187
|
if (!window.location.pathname.endsWith('/')) {
|
|
7152
7188
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7155,22 +7191,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7155
7191
|
function redirect() {
|
|
7156
7192
|
const indexPath = "index.html";
|
|
7157
7193
|
if (!existsSync24(indexPath)) {
|
|
7158
|
-
console.log(
|
|
7194
|
+
console.log(chalk77.yellow("No index.html found"));
|
|
7159
7195
|
return;
|
|
7160
7196
|
}
|
|
7161
7197
|
const content = readFileSync20(indexPath, "utf-8");
|
|
7162
7198
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7163
|
-
console.log(
|
|
7199
|
+
console.log(chalk77.dim("Trailing slash script already present"));
|
|
7164
7200
|
return;
|
|
7165
7201
|
}
|
|
7166
7202
|
const headCloseIndex = content.indexOf("</head>");
|
|
7167
7203
|
if (headCloseIndex === -1) {
|
|
7168
|
-
console.log(
|
|
7204
|
+
console.log(chalk77.red("Could not find </head> tag in index.html"));
|
|
7169
7205
|
return;
|
|
7170
7206
|
}
|
|
7171
7207
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7172
7208
|
writeFileSync18(indexPath, newContent);
|
|
7173
|
-
console.log(
|
|
7209
|
+
console.log(chalk77.green("Added trailing slash redirect to index.html"));
|
|
7174
7210
|
}
|
|
7175
7211
|
|
|
7176
7212
|
// src/commands/registerDeploy.ts
|
|
@@ -7197,7 +7233,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7197
7233
|
|
|
7198
7234
|
// src/commands/devlog/shared.ts
|
|
7199
7235
|
import { execSync as execSync18 } from "child_process";
|
|
7200
|
-
import
|
|
7236
|
+
import chalk78 from "chalk";
|
|
7201
7237
|
|
|
7202
7238
|
// src/shared/getRepoName.ts
|
|
7203
7239
|
import { existsSync as existsSync25, readFileSync as readFileSync21 } from "fs";
|
|
@@ -7306,13 +7342,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
7306
7342
|
}
|
|
7307
7343
|
function printCommitsWithFiles(commits, ignore2, verbose) {
|
|
7308
7344
|
for (const commit2 of commits) {
|
|
7309
|
-
console.log(` ${
|
|
7345
|
+
console.log(` ${chalk78.yellow(commit2.hash)} ${commit2.message}`);
|
|
7310
7346
|
if (verbose) {
|
|
7311
7347
|
const visibleFiles = commit2.files.filter(
|
|
7312
7348
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
7313
7349
|
);
|
|
7314
7350
|
for (const file of visibleFiles) {
|
|
7315
|
-
console.log(` ${
|
|
7351
|
+
console.log(` ${chalk78.dim(file)}`);
|
|
7316
7352
|
}
|
|
7317
7353
|
}
|
|
7318
7354
|
}
|
|
@@ -7337,15 +7373,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
7337
7373
|
}
|
|
7338
7374
|
|
|
7339
7375
|
// src/commands/devlog/list/printDateHeader.ts
|
|
7340
|
-
import
|
|
7376
|
+
import chalk79 from "chalk";
|
|
7341
7377
|
function printDateHeader(date, isSkipped, entries) {
|
|
7342
7378
|
if (isSkipped) {
|
|
7343
|
-
console.log(`${
|
|
7379
|
+
console.log(`${chalk79.bold.blue(date)} ${chalk79.dim("skipped")}`);
|
|
7344
7380
|
} else if (entries && entries.length > 0) {
|
|
7345
|
-
const entryInfo = entries.map((e) => `${
|
|
7346
|
-
console.log(`${
|
|
7381
|
+
const entryInfo = entries.map((e) => `${chalk79.green(e.version)} ${e.title}`).join(" | ");
|
|
7382
|
+
console.log(`${chalk79.bold.blue(date)} ${entryInfo}`);
|
|
7347
7383
|
} else {
|
|
7348
|
-
console.log(`${
|
|
7384
|
+
console.log(`${chalk79.bold.blue(date)} ${chalk79.red("\u26A0 devlog missing")}`);
|
|
7349
7385
|
}
|
|
7350
7386
|
}
|
|
7351
7387
|
|
|
@@ -7449,24 +7485,24 @@ function bumpVersion(version2, type) {
|
|
|
7449
7485
|
|
|
7450
7486
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
7451
7487
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
7452
|
-
import
|
|
7488
|
+
import chalk81 from "chalk";
|
|
7453
7489
|
|
|
7454
7490
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
7455
|
-
import
|
|
7491
|
+
import chalk80 from "chalk";
|
|
7456
7492
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
7457
7493
|
if (conventional && firstHash) {
|
|
7458
7494
|
const version2 = getVersionAtCommit(firstHash);
|
|
7459
7495
|
if (version2) {
|
|
7460
|
-
console.log(`${
|
|
7496
|
+
console.log(`${chalk80.bold("version:")} ${stripToMinor(version2)}`);
|
|
7461
7497
|
} else {
|
|
7462
|
-
console.log(`${
|
|
7498
|
+
console.log(`${chalk80.bold("version:")} ${chalk80.red("unknown")}`);
|
|
7463
7499
|
}
|
|
7464
7500
|
} else if (patchVersion && minorVersion) {
|
|
7465
7501
|
console.log(
|
|
7466
|
-
`${
|
|
7502
|
+
`${chalk80.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
7467
7503
|
);
|
|
7468
7504
|
} else {
|
|
7469
|
-
console.log(`${
|
|
7505
|
+
console.log(`${chalk80.bold("version:")} v0.1 (initial)`);
|
|
7470
7506
|
}
|
|
7471
7507
|
}
|
|
7472
7508
|
|
|
@@ -7514,16 +7550,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
7514
7550
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
7515
7551
|
}
|
|
7516
7552
|
function logName(repoName) {
|
|
7517
|
-
console.log(`${
|
|
7553
|
+
console.log(`${chalk81.bold("name:")} ${repoName}`);
|
|
7518
7554
|
}
|
|
7519
7555
|
function displayNextEntry(ctx, targetDate, commits) {
|
|
7520
7556
|
logName(ctx.repoName);
|
|
7521
7557
|
printVersionInfo(ctx.config, ctx.lastInfo, commits[0]?.hash);
|
|
7522
|
-
console.log(
|
|
7558
|
+
console.log(chalk81.bold.blue(targetDate));
|
|
7523
7559
|
printCommitsWithFiles(commits, ctx.ignore, ctx.verbose);
|
|
7524
7560
|
}
|
|
7525
7561
|
function logNoCommits(lastInfo) {
|
|
7526
|
-
console.log(
|
|
7562
|
+
console.log(chalk81.dim(noCommitsMessage(!!lastInfo)));
|
|
7527
7563
|
}
|
|
7528
7564
|
|
|
7529
7565
|
// src/commands/devlog/next/index.ts
|
|
@@ -7564,11 +7600,11 @@ function next2(options2) {
|
|
|
7564
7600
|
import { execSync as execSync20 } from "child_process";
|
|
7565
7601
|
|
|
7566
7602
|
// src/commands/devlog/repos/printReposTable.ts
|
|
7567
|
-
import
|
|
7603
|
+
import chalk82 from "chalk";
|
|
7568
7604
|
function colorStatus(status2) {
|
|
7569
|
-
if (status2 === "missing") return
|
|
7570
|
-
if (status2 === "outdated") return
|
|
7571
|
-
return
|
|
7605
|
+
if (status2 === "missing") return chalk82.red(status2);
|
|
7606
|
+
if (status2 === "outdated") return chalk82.yellow(status2);
|
|
7607
|
+
return chalk82.green(status2);
|
|
7572
7608
|
}
|
|
7573
7609
|
function formatRow(row, nameWidth) {
|
|
7574
7610
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -7582,8 +7618,8 @@ function printReposTable(rows) {
|
|
|
7582
7618
|
"Last Devlog".padEnd(11),
|
|
7583
7619
|
"Status"
|
|
7584
7620
|
].join(" ");
|
|
7585
|
-
console.log(
|
|
7586
|
-
console.log(
|
|
7621
|
+
console.log(chalk82.dim(header));
|
|
7622
|
+
console.log(chalk82.dim("-".repeat(header.length)));
|
|
7587
7623
|
for (const row of rows) {
|
|
7588
7624
|
console.log(formatRow(row, nameWidth));
|
|
7589
7625
|
}
|
|
@@ -7641,14 +7677,14 @@ function repos(options2) {
|
|
|
7641
7677
|
// src/commands/devlog/skip.ts
|
|
7642
7678
|
import { writeFileSync as writeFileSync19 } from "fs";
|
|
7643
7679
|
import { join as join26 } from "path";
|
|
7644
|
-
import
|
|
7680
|
+
import chalk83 from "chalk";
|
|
7645
7681
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
7646
7682
|
function getBlogConfigPath() {
|
|
7647
7683
|
return join26(BLOG_REPO_ROOT, "assist.yml");
|
|
7648
7684
|
}
|
|
7649
7685
|
function skip(date) {
|
|
7650
7686
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
7651
|
-
console.log(
|
|
7687
|
+
console.log(chalk83.red("Invalid date format. Use YYYY-MM-DD"));
|
|
7652
7688
|
process.exit(1);
|
|
7653
7689
|
}
|
|
7654
7690
|
const repoName = getRepoName();
|
|
@@ -7659,7 +7695,7 @@ function skip(date) {
|
|
|
7659
7695
|
const skipDays = skip2[repoName] ?? [];
|
|
7660
7696
|
if (skipDays.includes(date)) {
|
|
7661
7697
|
console.log(
|
|
7662
|
-
|
|
7698
|
+
chalk83.yellow(`${date} is already in skip list for ${repoName}`)
|
|
7663
7699
|
);
|
|
7664
7700
|
return;
|
|
7665
7701
|
}
|
|
@@ -7669,20 +7705,20 @@ function skip(date) {
|
|
|
7669
7705
|
devlog.skip = skip2;
|
|
7670
7706
|
config.devlog = devlog;
|
|
7671
7707
|
writeFileSync19(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
7672
|
-
console.log(
|
|
7708
|
+
console.log(chalk83.green(`Added ${date} to skip list for ${repoName}`));
|
|
7673
7709
|
}
|
|
7674
7710
|
|
|
7675
7711
|
// src/commands/devlog/version.ts
|
|
7676
|
-
import
|
|
7712
|
+
import chalk84 from "chalk";
|
|
7677
7713
|
function version() {
|
|
7678
7714
|
const config = loadConfig();
|
|
7679
7715
|
const name = getRepoName();
|
|
7680
7716
|
const lastInfo = getLastVersionInfo(name, config);
|
|
7681
7717
|
const lastVersion = lastInfo?.version ?? null;
|
|
7682
7718
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
7683
|
-
console.log(`${
|
|
7684
|
-
console.log(`${
|
|
7685
|
-
console.log(`${
|
|
7719
|
+
console.log(`${chalk84.bold("name:")} ${name}`);
|
|
7720
|
+
console.log(`${chalk84.bold("last:")} ${lastVersion ?? chalk84.dim("none")}`);
|
|
7721
|
+
console.log(`${chalk84.bold("next:")} ${nextVersion ?? chalk84.dim("none")}`);
|
|
7686
7722
|
}
|
|
7687
7723
|
|
|
7688
7724
|
// src/commands/registerDevlog.ts
|
|
@@ -7706,7 +7742,7 @@ function registerDevlog(program2) {
|
|
|
7706
7742
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
7707
7743
|
import { closeSync, openSync, readdirSync as readdirSync2 } from "fs";
|
|
7708
7744
|
import { join as join27 } from "path";
|
|
7709
|
-
import
|
|
7745
|
+
import chalk85 from "chalk";
|
|
7710
7746
|
|
|
7711
7747
|
// src/shared/findRepoRoot.ts
|
|
7712
7748
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -7769,14 +7805,14 @@ function checkBuildLocks(startDir) {
|
|
|
7769
7805
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
7770
7806
|
if (locked) {
|
|
7771
7807
|
console.error(
|
|
7772
|
-
|
|
7808
|
+
chalk85.red("Build output locked (is VS debugging?): ") + locked
|
|
7773
7809
|
);
|
|
7774
7810
|
process.exit(1);
|
|
7775
7811
|
}
|
|
7776
7812
|
}
|
|
7777
7813
|
async function checkBuildLocksCommand() {
|
|
7778
7814
|
checkBuildLocks();
|
|
7779
|
-
console.log(
|
|
7815
|
+
console.log(chalk85.green("No build locks detected"));
|
|
7780
7816
|
}
|
|
7781
7817
|
|
|
7782
7818
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -7875,30 +7911,30 @@ function escapeRegex(s) {
|
|
|
7875
7911
|
}
|
|
7876
7912
|
|
|
7877
7913
|
// src/commands/dotnet/printTree.ts
|
|
7878
|
-
import
|
|
7914
|
+
import chalk86 from "chalk";
|
|
7879
7915
|
function printNodes(nodes, prefix2) {
|
|
7880
7916
|
for (let i = 0; i < nodes.length; i++) {
|
|
7881
7917
|
const isLast = i === nodes.length - 1;
|
|
7882
7918
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
7883
7919
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
7884
7920
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
7885
|
-
const label2 = isMissing ?
|
|
7921
|
+
const label2 = isMissing ? chalk86.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
7886
7922
|
console.log(`${prefix2}${connector}${label2}`);
|
|
7887
7923
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
7888
7924
|
}
|
|
7889
7925
|
}
|
|
7890
7926
|
function printTree(tree, totalCount, solutions) {
|
|
7891
|
-
console.log(
|
|
7892
|
-
console.log(
|
|
7927
|
+
console.log(chalk86.bold("\nProject Dependency Tree"));
|
|
7928
|
+
console.log(chalk86.cyan(tree.relativePath));
|
|
7893
7929
|
printNodes(tree.children, "");
|
|
7894
|
-
console.log(
|
|
7930
|
+
console.log(chalk86.dim(`
|
|
7895
7931
|
${totalCount} projects total (including root)`));
|
|
7896
|
-
console.log(
|
|
7932
|
+
console.log(chalk86.bold("\nSolution Membership"));
|
|
7897
7933
|
if (solutions.length === 0) {
|
|
7898
|
-
console.log(
|
|
7934
|
+
console.log(chalk86.yellow(" Not found in any .sln"));
|
|
7899
7935
|
} else {
|
|
7900
7936
|
for (const sln of solutions) {
|
|
7901
|
-
console.log(` ${
|
|
7937
|
+
console.log(` ${chalk86.green(sln)}`);
|
|
7902
7938
|
}
|
|
7903
7939
|
}
|
|
7904
7940
|
console.log();
|
|
@@ -7927,16 +7963,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
7927
7963
|
// src/commands/dotnet/resolveCsproj.ts
|
|
7928
7964
|
import { existsSync as existsSync27 } from "fs";
|
|
7929
7965
|
import path26 from "path";
|
|
7930
|
-
import
|
|
7966
|
+
import chalk87 from "chalk";
|
|
7931
7967
|
function resolveCsproj(csprojPath) {
|
|
7932
7968
|
const resolved = path26.resolve(csprojPath);
|
|
7933
7969
|
if (!existsSync27(resolved)) {
|
|
7934
|
-
console.error(
|
|
7970
|
+
console.error(chalk87.red(`File not found: ${resolved}`));
|
|
7935
7971
|
process.exit(1);
|
|
7936
7972
|
}
|
|
7937
7973
|
const repoRoot = findRepoRoot(path26.dirname(resolved));
|
|
7938
7974
|
if (!repoRoot) {
|
|
7939
|
-
console.error(
|
|
7975
|
+
console.error(chalk87.red("Could not find git repository root"));
|
|
7940
7976
|
process.exit(1);
|
|
7941
7977
|
}
|
|
7942
7978
|
return { resolved, repoRoot };
|
|
@@ -7986,12 +8022,12 @@ function getChangedCsFiles(scope) {
|
|
|
7986
8022
|
}
|
|
7987
8023
|
|
|
7988
8024
|
// src/commands/dotnet/inSln.ts
|
|
7989
|
-
import
|
|
8025
|
+
import chalk88 from "chalk";
|
|
7990
8026
|
async function inSln(csprojPath) {
|
|
7991
8027
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
7992
8028
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
7993
8029
|
if (solutions.length === 0) {
|
|
7994
|
-
console.log(
|
|
8030
|
+
console.log(chalk88.yellow("Not found in any .sln file"));
|
|
7995
8031
|
process.exit(1);
|
|
7996
8032
|
}
|
|
7997
8033
|
for (const sln of solutions) {
|
|
@@ -8000,7 +8036,7 @@ async function inSln(csprojPath) {
|
|
|
8000
8036
|
}
|
|
8001
8037
|
|
|
8002
8038
|
// src/commands/dotnet/inspect.ts
|
|
8003
|
-
import
|
|
8039
|
+
import chalk94 from "chalk";
|
|
8004
8040
|
|
|
8005
8041
|
// src/shared/formatElapsed.ts
|
|
8006
8042
|
function formatElapsed(ms) {
|
|
@@ -8012,12 +8048,12 @@ function formatElapsed(ms) {
|
|
|
8012
8048
|
}
|
|
8013
8049
|
|
|
8014
8050
|
// src/commands/dotnet/displayIssues.ts
|
|
8015
|
-
import
|
|
8051
|
+
import chalk89 from "chalk";
|
|
8016
8052
|
var SEVERITY_COLOR = {
|
|
8017
|
-
ERROR:
|
|
8018
|
-
WARNING:
|
|
8019
|
-
SUGGESTION:
|
|
8020
|
-
HINT:
|
|
8053
|
+
ERROR: chalk89.red,
|
|
8054
|
+
WARNING: chalk89.yellow,
|
|
8055
|
+
SUGGESTION: chalk89.cyan,
|
|
8056
|
+
HINT: chalk89.dim
|
|
8021
8057
|
};
|
|
8022
8058
|
function groupByFile(issues) {
|
|
8023
8059
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8033,15 +8069,15 @@ function groupByFile(issues) {
|
|
|
8033
8069
|
}
|
|
8034
8070
|
function displayIssues(issues) {
|
|
8035
8071
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8036
|
-
console.log(
|
|
8072
|
+
console.log(chalk89.bold(file));
|
|
8037
8073
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8038
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8074
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk89.white;
|
|
8039
8075
|
console.log(
|
|
8040
|
-
` ${
|
|
8076
|
+
` ${chalk89.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8041
8077
|
);
|
|
8042
8078
|
}
|
|
8043
8079
|
}
|
|
8044
|
-
console.log(
|
|
8080
|
+
console.log(chalk89.dim(`
|
|
8045
8081
|
${issues.length} issue(s) found`));
|
|
8046
8082
|
}
|
|
8047
8083
|
|
|
@@ -8100,12 +8136,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8100
8136
|
// src/commands/dotnet/resolveSolution.ts
|
|
8101
8137
|
import { existsSync as existsSync28 } from "fs";
|
|
8102
8138
|
import path27 from "path";
|
|
8103
|
-
import
|
|
8139
|
+
import chalk91 from "chalk";
|
|
8104
8140
|
|
|
8105
8141
|
// src/commands/dotnet/findSolution.ts
|
|
8106
8142
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8107
8143
|
import { dirname as dirname18, join as join28 } from "path";
|
|
8108
|
-
import
|
|
8144
|
+
import chalk90 from "chalk";
|
|
8109
8145
|
function findSlnInDir(dir) {
|
|
8110
8146
|
try {
|
|
8111
8147
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join28(dir, f));
|
|
@@ -8121,17 +8157,17 @@ function findSolution() {
|
|
|
8121
8157
|
const slnFiles = findSlnInDir(current);
|
|
8122
8158
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8123
8159
|
if (slnFiles.length > 1) {
|
|
8124
|
-
console.error(
|
|
8160
|
+
console.error(chalk90.red(`Multiple .sln files found in ${current}:`));
|
|
8125
8161
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8126
8162
|
console.error(
|
|
8127
|
-
|
|
8163
|
+
chalk90.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8128
8164
|
);
|
|
8129
8165
|
process.exit(1);
|
|
8130
8166
|
}
|
|
8131
8167
|
if (current === ceiling) break;
|
|
8132
8168
|
current = dirname18(current);
|
|
8133
8169
|
}
|
|
8134
|
-
console.error(
|
|
8170
|
+
console.error(chalk90.red("No .sln file found between cwd and repo root"));
|
|
8135
8171
|
process.exit(1);
|
|
8136
8172
|
}
|
|
8137
8173
|
|
|
@@ -8140,7 +8176,7 @@ function resolveSolution(sln) {
|
|
|
8140
8176
|
if (sln) {
|
|
8141
8177
|
const resolved = path27.resolve(sln);
|
|
8142
8178
|
if (!existsSync28(resolved)) {
|
|
8143
|
-
console.error(
|
|
8179
|
+
console.error(chalk91.red(`Solution file not found: ${resolved}`));
|
|
8144
8180
|
process.exit(1);
|
|
8145
8181
|
}
|
|
8146
8182
|
return resolved;
|
|
@@ -8182,14 +8218,14 @@ import { execSync as execSync22 } from "child_process";
|
|
|
8182
8218
|
import { existsSync as existsSync29, readFileSync as readFileSync25, unlinkSync as unlinkSync5 } from "fs";
|
|
8183
8219
|
import { tmpdir as tmpdir3 } from "os";
|
|
8184
8220
|
import path28 from "path";
|
|
8185
|
-
import
|
|
8221
|
+
import chalk92 from "chalk";
|
|
8186
8222
|
function assertJbInstalled() {
|
|
8187
8223
|
try {
|
|
8188
8224
|
execSync22("jb inspectcode --version", { stdio: "pipe" });
|
|
8189
8225
|
} catch {
|
|
8190
|
-
console.error(
|
|
8226
|
+
console.error(chalk92.red("jb is not installed. Install with:"));
|
|
8191
8227
|
console.error(
|
|
8192
|
-
|
|
8228
|
+
chalk92.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8193
8229
|
);
|
|
8194
8230
|
process.exit(1);
|
|
8195
8231
|
}
|
|
@@ -8207,11 +8243,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8207
8243
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
8208
8244
|
process.stderr.write(err.stderr);
|
|
8209
8245
|
}
|
|
8210
|
-
console.error(
|
|
8246
|
+
console.error(chalk92.red("jb inspectcode failed"));
|
|
8211
8247
|
process.exit(1);
|
|
8212
8248
|
}
|
|
8213
8249
|
if (!existsSync29(reportPath)) {
|
|
8214
|
-
console.error(
|
|
8250
|
+
console.error(chalk92.red("Report file not generated"));
|
|
8215
8251
|
process.exit(1);
|
|
8216
8252
|
}
|
|
8217
8253
|
const xml = readFileSync25(reportPath, "utf-8");
|
|
@@ -8221,7 +8257,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8221
8257
|
|
|
8222
8258
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
8223
8259
|
import { execSync as execSync23 } from "child_process";
|
|
8224
|
-
import
|
|
8260
|
+
import chalk93 from "chalk";
|
|
8225
8261
|
function resolveMsbuildPath() {
|
|
8226
8262
|
const { run: run4 } = loadConfig();
|
|
8227
8263
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -8233,9 +8269,9 @@ function assertMsbuildInstalled() {
|
|
|
8233
8269
|
try {
|
|
8234
8270
|
execSync23(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
8235
8271
|
} catch {
|
|
8236
|
-
console.error(
|
|
8272
|
+
console.error(chalk93.red(`msbuild not found at: ${msbuild}`));
|
|
8237
8273
|
console.error(
|
|
8238
|
-
|
|
8274
|
+
chalk93.yellow(
|
|
8239
8275
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
8240
8276
|
)
|
|
8241
8277
|
);
|
|
@@ -8282,17 +8318,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
8282
8318
|
// src/commands/dotnet/inspect.ts
|
|
8283
8319
|
function logScope(changedFiles) {
|
|
8284
8320
|
if (changedFiles === null) {
|
|
8285
|
-
console.log(
|
|
8321
|
+
console.log(chalk94.dim("Inspecting full solution..."));
|
|
8286
8322
|
} else {
|
|
8287
8323
|
console.log(
|
|
8288
|
-
|
|
8324
|
+
chalk94.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
8289
8325
|
);
|
|
8290
8326
|
}
|
|
8291
8327
|
}
|
|
8292
8328
|
function reportResults(issues, elapsed) {
|
|
8293
8329
|
if (issues.length > 0) displayIssues(issues);
|
|
8294
|
-
else console.log(
|
|
8295
|
-
console.log(
|
|
8330
|
+
else console.log(chalk94.green("No issues found"));
|
|
8331
|
+
console.log(chalk94.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
8296
8332
|
if (issues.length > 0) process.exit(1);
|
|
8297
8333
|
}
|
|
8298
8334
|
async function inspect(sln, options2) {
|
|
@@ -8303,7 +8339,7 @@ async function inspect(sln, options2) {
|
|
|
8303
8339
|
const scope = parseScope(options2.scope);
|
|
8304
8340
|
const changedFiles = getChangedCsFiles(scope);
|
|
8305
8341
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
8306
|
-
console.log(
|
|
8342
|
+
console.log(chalk94.green("No changed .cs files found"));
|
|
8307
8343
|
return;
|
|
8308
8344
|
}
|
|
8309
8345
|
logScope(changedFiles);
|
|
@@ -8329,7 +8365,7 @@ function registerDotnet(program2) {
|
|
|
8329
8365
|
}
|
|
8330
8366
|
|
|
8331
8367
|
// src/commands/jira/acceptanceCriteria.ts
|
|
8332
|
-
import
|
|
8368
|
+
import chalk96 from "chalk";
|
|
8333
8369
|
|
|
8334
8370
|
// src/commands/jira/adfToText.ts
|
|
8335
8371
|
function renderInline(node) {
|
|
@@ -8390,7 +8426,7 @@ function adfToText(doc) {
|
|
|
8390
8426
|
|
|
8391
8427
|
// src/commands/jira/fetchIssue.ts
|
|
8392
8428
|
import { execSync as execSync24 } from "child_process";
|
|
8393
|
-
import
|
|
8429
|
+
import chalk95 from "chalk";
|
|
8394
8430
|
function fetchIssue(issueKey, fields) {
|
|
8395
8431
|
let result;
|
|
8396
8432
|
try {
|
|
@@ -8403,15 +8439,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
8403
8439
|
const stderr = error.stderr;
|
|
8404
8440
|
if (stderr.includes("unauthorized")) {
|
|
8405
8441
|
console.error(
|
|
8406
|
-
|
|
8442
|
+
chalk95.red("Jira authentication expired."),
|
|
8407
8443
|
"Run",
|
|
8408
|
-
|
|
8444
|
+
chalk95.cyan("assist jira auth"),
|
|
8409
8445
|
"to re-authenticate."
|
|
8410
8446
|
);
|
|
8411
8447
|
process.exit(1);
|
|
8412
8448
|
}
|
|
8413
8449
|
}
|
|
8414
|
-
console.error(
|
|
8450
|
+
console.error(chalk95.red(`Failed to fetch ${issueKey}.`));
|
|
8415
8451
|
process.exit(1);
|
|
8416
8452
|
}
|
|
8417
8453
|
return JSON.parse(result);
|
|
@@ -8425,7 +8461,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
8425
8461
|
const parsed = fetchIssue(issueKey, field);
|
|
8426
8462
|
const acValue = parsed?.fields?.[field];
|
|
8427
8463
|
if (!acValue) {
|
|
8428
|
-
console.log(
|
|
8464
|
+
console.log(chalk96.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
8429
8465
|
return;
|
|
8430
8466
|
}
|
|
8431
8467
|
if (typeof acValue === "string") {
|
|
@@ -8520,14 +8556,14 @@ async function jiraAuth() {
|
|
|
8520
8556
|
}
|
|
8521
8557
|
|
|
8522
8558
|
// src/commands/jira/viewIssue.ts
|
|
8523
|
-
import
|
|
8559
|
+
import chalk97 from "chalk";
|
|
8524
8560
|
function viewIssue(issueKey) {
|
|
8525
8561
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
8526
8562
|
const fields = parsed?.fields;
|
|
8527
8563
|
const summary = fields?.summary;
|
|
8528
8564
|
const description = fields?.description;
|
|
8529
8565
|
if (summary) {
|
|
8530
|
-
console.log(
|
|
8566
|
+
console.log(chalk97.bold(summary));
|
|
8531
8567
|
}
|
|
8532
8568
|
if (description) {
|
|
8533
8569
|
if (summary) console.log();
|
|
@@ -8541,7 +8577,7 @@ function viewIssue(issueKey) {
|
|
|
8541
8577
|
}
|
|
8542
8578
|
if (!summary && !description) {
|
|
8543
8579
|
console.log(
|
|
8544
|
-
|
|
8580
|
+
chalk97.yellow(`No summary or description found on ${issueKey}.`)
|
|
8545
8581
|
);
|
|
8546
8582
|
}
|
|
8547
8583
|
}
|
|
@@ -8557,15 +8593,15 @@ function registerJira(program2) {
|
|
|
8557
8593
|
// src/commands/mermaid/index.ts
|
|
8558
8594
|
import { mkdirSync as mkdirSync8, readdirSync as readdirSync5 } from "fs";
|
|
8559
8595
|
import { resolve as resolve10 } from "path";
|
|
8560
|
-
import
|
|
8596
|
+
import chalk100 from "chalk";
|
|
8561
8597
|
|
|
8562
8598
|
// src/commands/mermaid/exportFile.ts
|
|
8563
8599
|
import { readFileSync as readFileSync27, writeFileSync as writeFileSync21 } from "fs";
|
|
8564
8600
|
import { basename as basename7, extname, resolve as resolve9 } from "path";
|
|
8565
|
-
import
|
|
8601
|
+
import chalk99 from "chalk";
|
|
8566
8602
|
|
|
8567
8603
|
// src/commands/mermaid/renderBlock.ts
|
|
8568
|
-
import
|
|
8604
|
+
import chalk98 from "chalk";
|
|
8569
8605
|
async function renderBlock(krokiUrl, source) {
|
|
8570
8606
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
8571
8607
|
method: "POST",
|
|
@@ -8574,7 +8610,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
8574
8610
|
});
|
|
8575
8611
|
if (!response.ok) {
|
|
8576
8612
|
console.error(
|
|
8577
|
-
|
|
8613
|
+
chalk98.red(
|
|
8578
8614
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
8579
8615
|
)
|
|
8580
8616
|
);
|
|
@@ -8592,19 +8628,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8592
8628
|
if (onlyIndex !== void 0) {
|
|
8593
8629
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
8594
8630
|
console.error(
|
|
8595
|
-
|
|
8631
|
+
chalk99.red(
|
|
8596
8632
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
8597
8633
|
)
|
|
8598
8634
|
);
|
|
8599
8635
|
process.exit(1);
|
|
8600
8636
|
}
|
|
8601
8637
|
console.log(
|
|
8602
|
-
|
|
8638
|
+
chalk99.gray(
|
|
8603
8639
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
8604
8640
|
)
|
|
8605
8641
|
);
|
|
8606
8642
|
} else {
|
|
8607
|
-
console.log(
|
|
8643
|
+
console.log(chalk99.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
8608
8644
|
}
|
|
8609
8645
|
for (const [i, source] of blocks.entries()) {
|
|
8610
8646
|
const idx = i + 1;
|
|
@@ -8612,7 +8648,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
8612
8648
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
8613
8649
|
const svg = await renderBlock(krokiUrl, source);
|
|
8614
8650
|
writeFileSync21(outPath, svg, "utf8");
|
|
8615
|
-
console.log(
|
|
8651
|
+
console.log(chalk99.green(` \u2192 ${outPath}`));
|
|
8616
8652
|
}
|
|
8617
8653
|
}
|
|
8618
8654
|
function extractMermaidBlocks(markdown) {
|
|
@@ -8628,18 +8664,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
8628
8664
|
if (options2.index !== void 0) {
|
|
8629
8665
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
8630
8666
|
console.error(
|
|
8631
|
-
|
|
8667
|
+
chalk100.red(`--index must be a positive integer (got ${options2.index})`)
|
|
8632
8668
|
);
|
|
8633
8669
|
process.exit(1);
|
|
8634
8670
|
}
|
|
8635
8671
|
if (!file) {
|
|
8636
|
-
console.error(
|
|
8672
|
+
console.error(chalk100.red("--index requires a file argument"));
|
|
8637
8673
|
process.exit(1);
|
|
8638
8674
|
}
|
|
8639
8675
|
}
|
|
8640
8676
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
8641
8677
|
if (files.length === 0) {
|
|
8642
|
-
console.log(
|
|
8678
|
+
console.log(chalk100.gray("No markdown files found in current directory."));
|
|
8643
8679
|
return;
|
|
8644
8680
|
}
|
|
8645
8681
|
for (const f of files) {
|
|
@@ -8662,7 +8698,7 @@ function registerMermaid(program2) {
|
|
|
8662
8698
|
}
|
|
8663
8699
|
|
|
8664
8700
|
// src/commands/news/add/index.ts
|
|
8665
|
-
import
|
|
8701
|
+
import chalk101 from "chalk";
|
|
8666
8702
|
import enquirer8 from "enquirer";
|
|
8667
8703
|
async function add2(url) {
|
|
8668
8704
|
if (!url) {
|
|
@@ -8685,17 +8721,17 @@ async function add2(url) {
|
|
|
8685
8721
|
const news = config.news ?? {};
|
|
8686
8722
|
const feeds = news.feeds ?? [];
|
|
8687
8723
|
if (feeds.includes(url)) {
|
|
8688
|
-
console.log(
|
|
8724
|
+
console.log(chalk101.yellow("Feed already exists in config"));
|
|
8689
8725
|
return;
|
|
8690
8726
|
}
|
|
8691
8727
|
feeds.push(url);
|
|
8692
8728
|
config.news = { ...news, feeds };
|
|
8693
8729
|
saveGlobalConfig(config);
|
|
8694
|
-
console.log(
|
|
8730
|
+
console.log(chalk101.green(`Added feed: ${url}`));
|
|
8695
8731
|
}
|
|
8696
8732
|
|
|
8697
8733
|
// src/commands/news/web/handleRequest.ts
|
|
8698
|
-
import
|
|
8734
|
+
import chalk102 from "chalk";
|
|
8699
8735
|
|
|
8700
8736
|
// src/commands/news/web/shared.ts
|
|
8701
8737
|
import { decodeHTML } from "entities";
|
|
@@ -8831,17 +8867,17 @@ function prefetch() {
|
|
|
8831
8867
|
const config = loadConfig();
|
|
8832
8868
|
const total = config.news.feeds.length;
|
|
8833
8869
|
if (total === 0) return;
|
|
8834
|
-
process.stdout.write(
|
|
8870
|
+
process.stdout.write(chalk102.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
8835
8871
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
8836
8872
|
const width = 20;
|
|
8837
8873
|
const filled = Math.round(done2 / t * width);
|
|
8838
8874
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
8839
8875
|
process.stdout.write(
|
|
8840
|
-
`\r${
|
|
8876
|
+
`\r${chalk102.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
8841
8877
|
);
|
|
8842
8878
|
}).then((items) => {
|
|
8843
8879
|
process.stdout.write(
|
|
8844
|
-
`\r${
|
|
8880
|
+
`\r${chalk102.green(`Fetched ${items.length} items from ${total} feed(s)`)}
|
|
8845
8881
|
`
|
|
8846
8882
|
);
|
|
8847
8883
|
cachedItems = items;
|
|
@@ -8886,7 +8922,7 @@ function registerNews(program2) {
|
|
|
8886
8922
|
}
|
|
8887
8923
|
|
|
8888
8924
|
// src/commands/prompts/printPromptsTable.ts
|
|
8889
|
-
import
|
|
8925
|
+
import chalk103 from "chalk";
|
|
8890
8926
|
function truncate(str, max) {
|
|
8891
8927
|
if (str.length <= max) return str;
|
|
8892
8928
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -8904,14 +8940,14 @@ function printPromptsTable(rows) {
|
|
|
8904
8940
|
"Command".padEnd(commandWidth),
|
|
8905
8941
|
"Repos"
|
|
8906
8942
|
].join(" ");
|
|
8907
|
-
console.log(
|
|
8908
|
-
console.log(
|
|
8943
|
+
console.log(chalk103.dim(header));
|
|
8944
|
+
console.log(chalk103.dim("-".repeat(header.length)));
|
|
8909
8945
|
for (const row of rows) {
|
|
8910
8946
|
const count = String(row.count).padStart(countWidth);
|
|
8911
8947
|
const tool = row.tool.padEnd(toolWidth);
|
|
8912
8948
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
8913
8949
|
console.log(
|
|
8914
|
-
`${
|
|
8950
|
+
`${chalk103.yellow(count)} ${tool} ${command} ${chalk103.dim(row.repos)}`
|
|
8915
8951
|
);
|
|
8916
8952
|
}
|
|
8917
8953
|
}
|
|
@@ -9343,20 +9379,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
9343
9379
|
}
|
|
9344
9380
|
|
|
9345
9381
|
// src/commands/prs/listComments/printComments.ts
|
|
9346
|
-
import
|
|
9382
|
+
import chalk104 from "chalk";
|
|
9347
9383
|
function formatForHuman(comment3) {
|
|
9348
9384
|
if (comment3.type === "review") {
|
|
9349
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
9385
|
+
const stateColor = comment3.state === "APPROVED" ? chalk104.green : comment3.state === "CHANGES_REQUESTED" ? chalk104.red : chalk104.yellow;
|
|
9350
9386
|
return [
|
|
9351
|
-
`${
|
|
9387
|
+
`${chalk104.cyan("Review")} by ${chalk104.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
9352
9388
|
comment3.body,
|
|
9353
9389
|
""
|
|
9354
9390
|
].join("\n");
|
|
9355
9391
|
}
|
|
9356
9392
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
9357
9393
|
return [
|
|
9358
|
-
`${
|
|
9359
|
-
|
|
9394
|
+
`${chalk104.cyan("Line comment")} by ${chalk104.bold(comment3.user)} on ${chalk104.dim(`${comment3.path}${location}`)}`,
|
|
9395
|
+
chalk104.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
9360
9396
|
comment3.body,
|
|
9361
9397
|
""
|
|
9362
9398
|
].join("\n");
|
|
@@ -9446,13 +9482,13 @@ import { execSync as execSync32 } from "child_process";
|
|
|
9446
9482
|
import enquirer9 from "enquirer";
|
|
9447
9483
|
|
|
9448
9484
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
9449
|
-
import
|
|
9485
|
+
import chalk105 from "chalk";
|
|
9450
9486
|
var STATUS_MAP = {
|
|
9451
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
9452
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
9487
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk105.magenta("merged"), date: pr.mergedAt } : null,
|
|
9488
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk105.red("closed"), date: pr.closedAt } : null
|
|
9453
9489
|
};
|
|
9454
9490
|
function defaultStatus(pr) {
|
|
9455
|
-
return { label:
|
|
9491
|
+
return { label: chalk105.green("opened"), date: pr.createdAt };
|
|
9456
9492
|
}
|
|
9457
9493
|
function getStatus2(pr) {
|
|
9458
9494
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -9461,11 +9497,11 @@ function formatDate(dateStr) {
|
|
|
9461
9497
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
9462
9498
|
}
|
|
9463
9499
|
function formatPrHeader(pr, status2) {
|
|
9464
|
-
return `${
|
|
9500
|
+
return `${chalk105.cyan(`#${pr.number}`)} ${pr.title} ${chalk105.dim(`(${pr.author.login},`)} ${status2.label} ${chalk105.dim(`${formatDate(status2.date)})`)}`;
|
|
9465
9501
|
}
|
|
9466
9502
|
function logPrDetails(pr) {
|
|
9467
9503
|
console.log(
|
|
9468
|
-
|
|
9504
|
+
chalk105.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
9469
9505
|
);
|
|
9470
9506
|
console.log();
|
|
9471
9507
|
}
|
|
@@ -9632,10 +9668,10 @@ function registerPrs(program2) {
|
|
|
9632
9668
|
}
|
|
9633
9669
|
|
|
9634
9670
|
// src/commands/ravendb/ravendbAuth.ts
|
|
9635
|
-
import
|
|
9671
|
+
import chalk111 from "chalk";
|
|
9636
9672
|
|
|
9637
9673
|
// src/shared/createConnectionAuth.ts
|
|
9638
|
-
import
|
|
9674
|
+
import chalk106 from "chalk";
|
|
9639
9675
|
function listConnections(connections, format2) {
|
|
9640
9676
|
if (connections.length === 0) {
|
|
9641
9677
|
console.log("No connections configured.");
|
|
@@ -9648,7 +9684,7 @@ function listConnections(connections, format2) {
|
|
|
9648
9684
|
function removeConnection(connections, name, save) {
|
|
9649
9685
|
const filtered = connections.filter((c) => c.name !== name);
|
|
9650
9686
|
if (filtered.length === connections.length) {
|
|
9651
|
-
console.error(
|
|
9687
|
+
console.error(chalk106.red(`Connection "${name}" not found.`));
|
|
9652
9688
|
process.exit(1);
|
|
9653
9689
|
}
|
|
9654
9690
|
save(filtered);
|
|
@@ -9694,15 +9730,15 @@ function saveConnections(connections) {
|
|
|
9694
9730
|
}
|
|
9695
9731
|
|
|
9696
9732
|
// src/commands/ravendb/promptConnection.ts
|
|
9697
|
-
import
|
|
9733
|
+
import chalk109 from "chalk";
|
|
9698
9734
|
|
|
9699
9735
|
// src/commands/ravendb/selectOpSecret.ts
|
|
9700
|
-
import
|
|
9736
|
+
import chalk108 from "chalk";
|
|
9701
9737
|
import Enquirer2 from "enquirer";
|
|
9702
9738
|
|
|
9703
9739
|
// src/commands/ravendb/searchItems.ts
|
|
9704
9740
|
import { execSync as execSync34 } from "child_process";
|
|
9705
|
-
import
|
|
9741
|
+
import chalk107 from "chalk";
|
|
9706
9742
|
function opExec(args) {
|
|
9707
9743
|
return execSync34(`op ${args}`, {
|
|
9708
9744
|
encoding: "utf-8",
|
|
@@ -9715,7 +9751,7 @@ function searchItems(search2) {
|
|
|
9715
9751
|
items = JSON.parse(opExec("item list --format=json"));
|
|
9716
9752
|
} catch {
|
|
9717
9753
|
console.error(
|
|
9718
|
-
|
|
9754
|
+
chalk107.red(
|
|
9719
9755
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
9720
9756
|
)
|
|
9721
9757
|
);
|
|
@@ -9729,7 +9765,7 @@ function getItemFields(itemId) {
|
|
|
9729
9765
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
9730
9766
|
return item.fields.filter((f) => f.reference && f.label);
|
|
9731
9767
|
} catch {
|
|
9732
|
-
console.error(
|
|
9768
|
+
console.error(chalk107.red("Failed to get item details from 1Password."));
|
|
9733
9769
|
process.exit(1);
|
|
9734
9770
|
}
|
|
9735
9771
|
}
|
|
@@ -9748,7 +9784,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9748
9784
|
}).run();
|
|
9749
9785
|
const items = searchItems(search2);
|
|
9750
9786
|
if (items.length === 0) {
|
|
9751
|
-
console.error(
|
|
9787
|
+
console.error(chalk108.red(`No items found matching "${search2}".`));
|
|
9752
9788
|
process.exit(1);
|
|
9753
9789
|
}
|
|
9754
9790
|
const itemId = await selectOne(
|
|
@@ -9757,7 +9793,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9757
9793
|
);
|
|
9758
9794
|
const fields = getItemFields(itemId);
|
|
9759
9795
|
if (fields.length === 0) {
|
|
9760
|
-
console.error(
|
|
9796
|
+
console.error(chalk108.red("No fields with references found on this item."));
|
|
9761
9797
|
process.exit(1);
|
|
9762
9798
|
}
|
|
9763
9799
|
const ref = await selectOne(
|
|
@@ -9771,7 +9807,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
9771
9807
|
async function promptConnection(existingNames) {
|
|
9772
9808
|
const name = await promptInput("name", "Connection name:");
|
|
9773
9809
|
if (existingNames.includes(name)) {
|
|
9774
|
-
console.error(
|
|
9810
|
+
console.error(chalk109.red(`Connection "${name}" already exists.`));
|
|
9775
9811
|
process.exit(1);
|
|
9776
9812
|
}
|
|
9777
9813
|
const url = await promptInput(
|
|
@@ -9780,22 +9816,22 @@ async function promptConnection(existingNames) {
|
|
|
9780
9816
|
);
|
|
9781
9817
|
const database = await promptInput("database", "Database name:");
|
|
9782
9818
|
if (!name || !url || !database) {
|
|
9783
|
-
console.error(
|
|
9819
|
+
console.error(chalk109.red("All fields are required."));
|
|
9784
9820
|
process.exit(1);
|
|
9785
9821
|
}
|
|
9786
9822
|
const apiKeyRef = await selectOpSecret();
|
|
9787
|
-
console.log(
|
|
9823
|
+
console.log(chalk109.dim(`Using: ${apiKeyRef}`));
|
|
9788
9824
|
return { name, url, database, apiKeyRef };
|
|
9789
9825
|
}
|
|
9790
9826
|
|
|
9791
9827
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
9792
|
-
import
|
|
9828
|
+
import chalk110 from "chalk";
|
|
9793
9829
|
function ravendbSetConnection(name) {
|
|
9794
9830
|
const raw = loadGlobalConfigRaw();
|
|
9795
9831
|
const ravendb = raw.ravendb ?? {};
|
|
9796
9832
|
const connections = ravendb.connections ?? [];
|
|
9797
9833
|
if (!connections.some((c) => c.name === name)) {
|
|
9798
|
-
console.error(
|
|
9834
|
+
console.error(chalk110.red(`Connection "${name}" not found.`));
|
|
9799
9835
|
console.error(
|
|
9800
9836
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9801
9837
|
);
|
|
@@ -9811,16 +9847,16 @@ function ravendbSetConnection(name) {
|
|
|
9811
9847
|
var ravendbAuth = createConnectionAuth({
|
|
9812
9848
|
load: loadConnections,
|
|
9813
9849
|
save: saveConnections,
|
|
9814
|
-
format: (c) => `${
|
|
9850
|
+
format: (c) => `${chalk111.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
9815
9851
|
promptNew: promptConnection,
|
|
9816
9852
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
9817
9853
|
});
|
|
9818
9854
|
|
|
9819
9855
|
// src/commands/ravendb/ravendbCollections.ts
|
|
9820
|
-
import
|
|
9856
|
+
import chalk115 from "chalk";
|
|
9821
9857
|
|
|
9822
9858
|
// src/commands/ravendb/ravenFetch.ts
|
|
9823
|
-
import
|
|
9859
|
+
import chalk113 from "chalk";
|
|
9824
9860
|
|
|
9825
9861
|
// src/commands/ravendb/getAccessToken.ts
|
|
9826
9862
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -9857,10 +9893,10 @@ ${errorText}`
|
|
|
9857
9893
|
|
|
9858
9894
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
9859
9895
|
import { execSync as execSync35 } from "child_process";
|
|
9860
|
-
import
|
|
9896
|
+
import chalk112 from "chalk";
|
|
9861
9897
|
function resolveOpSecret(reference) {
|
|
9862
9898
|
if (!reference.startsWith("op://")) {
|
|
9863
|
-
console.error(
|
|
9899
|
+
console.error(chalk112.red(`Invalid secret reference: must start with op://`));
|
|
9864
9900
|
process.exit(1);
|
|
9865
9901
|
}
|
|
9866
9902
|
try {
|
|
@@ -9870,7 +9906,7 @@ function resolveOpSecret(reference) {
|
|
|
9870
9906
|
}).trim();
|
|
9871
9907
|
} catch {
|
|
9872
9908
|
console.error(
|
|
9873
|
-
|
|
9909
|
+
chalk112.red(
|
|
9874
9910
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
9875
9911
|
)
|
|
9876
9912
|
);
|
|
@@ -9897,7 +9933,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9897
9933
|
if (!response.ok) {
|
|
9898
9934
|
const body = await response.text();
|
|
9899
9935
|
console.error(
|
|
9900
|
-
|
|
9936
|
+
chalk113.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
9901
9937
|
);
|
|
9902
9938
|
console.error(body.substring(0, 500));
|
|
9903
9939
|
process.exit(1);
|
|
@@ -9906,7 +9942,7 @@ async function ravenFetch(connection, path52) {
|
|
|
9906
9942
|
}
|
|
9907
9943
|
|
|
9908
9944
|
// src/commands/ravendb/resolveConnection.ts
|
|
9909
|
-
import
|
|
9945
|
+
import chalk114 from "chalk";
|
|
9910
9946
|
function loadRavendb() {
|
|
9911
9947
|
const raw = loadGlobalConfigRaw();
|
|
9912
9948
|
const ravendb = raw.ravendb;
|
|
@@ -9920,7 +9956,7 @@ function resolveConnection(name) {
|
|
|
9920
9956
|
const connectionName = name ?? defaultConnection;
|
|
9921
9957
|
if (!connectionName) {
|
|
9922
9958
|
console.error(
|
|
9923
|
-
|
|
9959
|
+
chalk114.red(
|
|
9924
9960
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
9925
9961
|
)
|
|
9926
9962
|
);
|
|
@@ -9928,7 +9964,7 @@ function resolveConnection(name) {
|
|
|
9928
9964
|
}
|
|
9929
9965
|
const connection = connections.find((c) => c.name === connectionName);
|
|
9930
9966
|
if (!connection) {
|
|
9931
|
-
console.error(
|
|
9967
|
+
console.error(chalk114.red(`Connection "${connectionName}" not found.`));
|
|
9932
9968
|
console.error(
|
|
9933
9969
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
9934
9970
|
);
|
|
@@ -9959,15 +9995,15 @@ async function ravendbCollections(connectionName) {
|
|
|
9959
9995
|
return;
|
|
9960
9996
|
}
|
|
9961
9997
|
for (const c of collections) {
|
|
9962
|
-
console.log(`${
|
|
9998
|
+
console.log(`${chalk115.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
9963
9999
|
}
|
|
9964
10000
|
}
|
|
9965
10001
|
|
|
9966
10002
|
// src/commands/ravendb/ravendbQuery.ts
|
|
9967
|
-
import
|
|
10003
|
+
import chalk117 from "chalk";
|
|
9968
10004
|
|
|
9969
10005
|
// src/commands/ravendb/fetchAllPages.ts
|
|
9970
|
-
import
|
|
10006
|
+
import chalk116 from "chalk";
|
|
9971
10007
|
|
|
9972
10008
|
// src/commands/ravendb/buildQueryPath.ts
|
|
9973
10009
|
function buildQueryPath(opts) {
|
|
@@ -10005,7 +10041,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10005
10041
|
allResults.push(...results);
|
|
10006
10042
|
start3 += results.length;
|
|
10007
10043
|
process.stderr.write(
|
|
10008
|
-
`\r${
|
|
10044
|
+
`\r${chalk116.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
10009
10045
|
);
|
|
10010
10046
|
if (start3 >= totalResults) break;
|
|
10011
10047
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -10020,7 +10056,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
10020
10056
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
10021
10057
|
const resolved = resolveArgs(connectionName, collection);
|
|
10022
10058
|
if (!resolved.collection && !options2.query) {
|
|
10023
|
-
console.error(
|
|
10059
|
+
console.error(chalk117.red("Provide a collection name or --query filter."));
|
|
10024
10060
|
process.exit(1);
|
|
10025
10061
|
}
|
|
10026
10062
|
const { collection: col } = resolved;
|
|
@@ -10058,7 +10094,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
10058
10094
|
import * as path29 from "path";
|
|
10059
10095
|
|
|
10060
10096
|
// src/commands/refactor/logViolations.ts
|
|
10061
|
-
import
|
|
10097
|
+
import chalk118 from "chalk";
|
|
10062
10098
|
var DEFAULT_MAX_LINES = 100;
|
|
10063
10099
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
10064
10100
|
if (violations.length === 0) {
|
|
@@ -10067,43 +10103,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
10067
10103
|
}
|
|
10068
10104
|
return;
|
|
10069
10105
|
}
|
|
10070
|
-
console.error(
|
|
10106
|
+
console.error(chalk118.red(`
|
|
10071
10107
|
Refactor check failed:
|
|
10072
10108
|
`));
|
|
10073
|
-
console.error(
|
|
10109
|
+
console.error(chalk118.red(` The following files exceed ${maxLines} lines:
|
|
10074
10110
|
`));
|
|
10075
10111
|
for (const violation of violations) {
|
|
10076
|
-
console.error(
|
|
10112
|
+
console.error(chalk118.red(` ${violation.file} (${violation.lines} lines)`));
|
|
10077
10113
|
}
|
|
10078
10114
|
console.error(
|
|
10079
|
-
|
|
10115
|
+
chalk118.yellow(
|
|
10080
10116
|
`
|
|
10081
10117
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
10082
10118
|
way to refactor it, ignore it with:
|
|
10083
10119
|
`
|
|
10084
10120
|
)
|
|
10085
10121
|
);
|
|
10086
|
-
console.error(
|
|
10122
|
+
console.error(chalk118.gray(` assist refactor ignore <file>
|
|
10087
10123
|
`));
|
|
10088
10124
|
if (process.env.CLAUDECODE) {
|
|
10089
|
-
console.error(
|
|
10125
|
+
console.error(chalk118.cyan(`
|
|
10090
10126
|
## Extracting Code to New Files
|
|
10091
10127
|
`));
|
|
10092
10128
|
console.error(
|
|
10093
|
-
|
|
10129
|
+
chalk118.cyan(
|
|
10094
10130
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
10095
10131
|
`
|
|
10096
10132
|
)
|
|
10097
10133
|
);
|
|
10098
10134
|
console.error(
|
|
10099
|
-
|
|
10135
|
+
chalk118.cyan(
|
|
10100
10136
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
10101
10137
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
10102
10138
|
`
|
|
10103
10139
|
)
|
|
10104
10140
|
);
|
|
10105
10141
|
console.error(
|
|
10106
|
-
|
|
10142
|
+
chalk118.cyan(
|
|
10107
10143
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
10108
10144
|
domains, move it to a common/shared folder.
|
|
10109
10145
|
`
|
|
@@ -10259,7 +10295,7 @@ async function check(pattern2, options2) {
|
|
|
10259
10295
|
|
|
10260
10296
|
// src/commands/refactor/extract/index.ts
|
|
10261
10297
|
import path36 from "path";
|
|
10262
|
-
import
|
|
10298
|
+
import chalk121 from "chalk";
|
|
10263
10299
|
|
|
10264
10300
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
10265
10301
|
import { SyntaxKind as SyntaxKind3 } from "ts-morph";
|
|
@@ -10806,23 +10842,23 @@ function buildPlan(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
10806
10842
|
|
|
10807
10843
|
// src/commands/refactor/extract/displayPlan.ts
|
|
10808
10844
|
import path33 from "path";
|
|
10809
|
-
import
|
|
10845
|
+
import chalk119 from "chalk";
|
|
10810
10846
|
function section(title) {
|
|
10811
10847
|
return `
|
|
10812
|
-
${
|
|
10848
|
+
${chalk119.cyan(title)}`;
|
|
10813
10849
|
}
|
|
10814
10850
|
function displayImporters(plan2, cwd) {
|
|
10815
10851
|
if (plan2.importersToUpdate.length === 0) return;
|
|
10816
10852
|
console.log(section("Update importers:"));
|
|
10817
10853
|
for (const imp of plan2.importersToUpdate) {
|
|
10818
10854
|
const rel = path33.relative(cwd, imp.file.getFilePath());
|
|
10819
|
-
console.log(` ${
|
|
10855
|
+
console.log(` ${chalk119.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
10820
10856
|
}
|
|
10821
10857
|
}
|
|
10822
10858
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
10823
|
-
console.log(
|
|
10859
|
+
console.log(chalk119.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
10824
10860
|
`));
|
|
10825
|
-
console.log(` ${
|
|
10861
|
+
console.log(` ${chalk119.cyan("Functions to move:")}`);
|
|
10826
10862
|
for (const name of plan2.extractedNames) {
|
|
10827
10863
|
console.log(` ${name}`);
|
|
10828
10864
|
}
|
|
@@ -10856,7 +10892,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
10856
10892
|
|
|
10857
10893
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
10858
10894
|
import path35 from "path";
|
|
10859
|
-
import
|
|
10895
|
+
import chalk120 from "chalk";
|
|
10860
10896
|
import { Project as Project3 } from "ts-morph";
|
|
10861
10897
|
|
|
10862
10898
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -10916,7 +10952,7 @@ function loadProjectFile(file) {
|
|
|
10916
10952
|
});
|
|
10917
10953
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
10918
10954
|
if (!sourceFile) {
|
|
10919
|
-
console.log(
|
|
10955
|
+
console.log(chalk120.red(`File not found in project: ${file}`));
|
|
10920
10956
|
process.exit(1);
|
|
10921
10957
|
}
|
|
10922
10958
|
return { project, sourceFile };
|
|
@@ -10939,19 +10975,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
10939
10975
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
10940
10976
|
if (options2.apply) {
|
|
10941
10977
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
10942
|
-
console.log(
|
|
10978
|
+
console.log(chalk121.green("\nExtraction complete"));
|
|
10943
10979
|
} else {
|
|
10944
|
-
console.log(
|
|
10980
|
+
console.log(chalk121.dim("\nDry run. Use --apply to execute."));
|
|
10945
10981
|
}
|
|
10946
10982
|
}
|
|
10947
10983
|
|
|
10948
10984
|
// src/commands/refactor/ignore.ts
|
|
10949
10985
|
import fs20 from "fs";
|
|
10950
|
-
import
|
|
10986
|
+
import chalk122 from "chalk";
|
|
10951
10987
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
10952
10988
|
function ignore(file) {
|
|
10953
10989
|
if (!fs20.existsSync(file)) {
|
|
10954
|
-
console.error(
|
|
10990
|
+
console.error(chalk122.red(`Error: File does not exist: ${file}`));
|
|
10955
10991
|
process.exit(1);
|
|
10956
10992
|
}
|
|
10957
10993
|
const content = fs20.readFileSync(file, "utf-8");
|
|
@@ -10967,7 +11003,7 @@ function ignore(file) {
|
|
|
10967
11003
|
fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
10968
11004
|
}
|
|
10969
11005
|
console.log(
|
|
10970
|
-
|
|
11006
|
+
chalk122.green(
|
|
10971
11007
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
10972
11008
|
)
|
|
10973
11009
|
);
|
|
@@ -10975,25 +11011,25 @@ function ignore(file) {
|
|
|
10975
11011
|
|
|
10976
11012
|
// src/commands/refactor/rename/index.ts
|
|
10977
11013
|
import path37 from "path";
|
|
10978
|
-
import
|
|
11014
|
+
import chalk123 from "chalk";
|
|
10979
11015
|
async function rename(source, destination, options2 = {}) {
|
|
10980
11016
|
const destPath = path37.resolve(destination);
|
|
10981
11017
|
const cwd = process.cwd();
|
|
10982
11018
|
const relSource = path37.relative(cwd, path37.resolve(source));
|
|
10983
11019
|
const relDest = path37.relative(cwd, destPath);
|
|
10984
11020
|
const { project, sourceFile } = loadProjectFile(source);
|
|
10985
|
-
console.log(
|
|
11021
|
+
console.log(chalk123.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
10986
11022
|
if (options2.apply) {
|
|
10987
11023
|
sourceFile.move(destPath);
|
|
10988
11024
|
await project.save();
|
|
10989
|
-
console.log(
|
|
11025
|
+
console.log(chalk123.green("Done"));
|
|
10990
11026
|
} else {
|
|
10991
|
-
console.log(
|
|
11027
|
+
console.log(chalk123.dim("Dry run. Use --apply to execute."));
|
|
10992
11028
|
}
|
|
10993
11029
|
}
|
|
10994
11030
|
|
|
10995
11031
|
// src/commands/refactor/renameSymbol/index.ts
|
|
10996
|
-
import
|
|
11032
|
+
import chalk124 from "chalk";
|
|
10997
11033
|
|
|
10998
11034
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
10999
11035
|
import { SyntaxKind as SyntaxKind13 } from "ts-morph";
|
|
@@ -11039,33 +11075,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
11039
11075
|
const { project, sourceFile } = loadProjectFile(file);
|
|
11040
11076
|
const symbol = findSymbol(sourceFile, oldName);
|
|
11041
11077
|
if (!symbol) {
|
|
11042
|
-
console.log(
|
|
11078
|
+
console.log(chalk124.red(`Symbol "${oldName}" not found in ${file}`));
|
|
11043
11079
|
process.exit(1);
|
|
11044
11080
|
}
|
|
11045
11081
|
const grouped = groupReferences(symbol, cwd);
|
|
11046
11082
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
11047
11083
|
console.log(
|
|
11048
|
-
|
|
11084
|
+
chalk124.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
11049
11085
|
`)
|
|
11050
11086
|
);
|
|
11051
11087
|
for (const [refFile, lines] of grouped) {
|
|
11052
11088
|
console.log(
|
|
11053
|
-
` ${
|
|
11089
|
+
` ${chalk124.dim(refFile)}: lines ${chalk124.cyan(lines.join(", "))}`
|
|
11054
11090
|
);
|
|
11055
11091
|
}
|
|
11056
11092
|
if (options2.apply) {
|
|
11057
11093
|
symbol.rename(newName);
|
|
11058
11094
|
await project.save();
|
|
11059
|
-
console.log(
|
|
11095
|
+
console.log(chalk124.green(`
|
|
11060
11096
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
11061
11097
|
} else {
|
|
11062
|
-
console.log(
|
|
11098
|
+
console.log(chalk124.dim("\nDry run. Use --apply to execute."));
|
|
11063
11099
|
}
|
|
11064
11100
|
}
|
|
11065
11101
|
|
|
11066
11102
|
// src/commands/refactor/restructure/index.ts
|
|
11067
11103
|
import path47 from "path";
|
|
11068
|
-
import
|
|
11104
|
+
import chalk127 from "chalk";
|
|
11069
11105
|
|
|
11070
11106
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
11071
11107
|
import path39 from "path";
|
|
@@ -11308,50 +11344,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
11308
11344
|
|
|
11309
11345
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
11310
11346
|
import path43 from "path";
|
|
11311
|
-
import
|
|
11347
|
+
import chalk125 from "chalk";
|
|
11312
11348
|
function relPath(filePath) {
|
|
11313
11349
|
return path43.relative(process.cwd(), filePath);
|
|
11314
11350
|
}
|
|
11315
11351
|
function displayMoves(plan2) {
|
|
11316
11352
|
if (plan2.moves.length === 0) return;
|
|
11317
|
-
console.log(
|
|
11353
|
+
console.log(chalk125.bold("\nFile moves:"));
|
|
11318
11354
|
for (const move of plan2.moves) {
|
|
11319
11355
|
console.log(
|
|
11320
|
-
` ${
|
|
11356
|
+
` ${chalk125.red(relPath(move.from))} \u2192 ${chalk125.green(relPath(move.to))}`
|
|
11321
11357
|
);
|
|
11322
|
-
console.log(
|
|
11358
|
+
console.log(chalk125.dim(` ${move.reason}`));
|
|
11323
11359
|
}
|
|
11324
11360
|
}
|
|
11325
11361
|
function displayRewrites(rewrites) {
|
|
11326
11362
|
if (rewrites.length === 0) return;
|
|
11327
11363
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
11328
|
-
console.log(
|
|
11364
|
+
console.log(chalk125.bold(`
|
|
11329
11365
|
Import rewrites (${affectedFiles.size} files):`));
|
|
11330
11366
|
for (const file of affectedFiles) {
|
|
11331
|
-
console.log(` ${
|
|
11367
|
+
console.log(` ${chalk125.cyan(relPath(file))}:`);
|
|
11332
11368
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
11333
11369
|
(r) => r.file === file
|
|
11334
11370
|
)) {
|
|
11335
11371
|
console.log(
|
|
11336
|
-
` ${
|
|
11372
|
+
` ${chalk125.red(`"${oldSpecifier}"`)} \u2192 ${chalk125.green(`"${newSpecifier}"`)}`
|
|
11337
11373
|
);
|
|
11338
11374
|
}
|
|
11339
11375
|
}
|
|
11340
11376
|
}
|
|
11341
11377
|
function displayPlan2(plan2) {
|
|
11342
11378
|
if (plan2.warnings.length > 0) {
|
|
11343
|
-
console.log(
|
|
11344
|
-
for (const w of plan2.warnings) console.log(
|
|
11379
|
+
console.log(chalk125.yellow("\nWarnings:"));
|
|
11380
|
+
for (const w of plan2.warnings) console.log(chalk125.yellow(` ${w}`));
|
|
11345
11381
|
}
|
|
11346
11382
|
if (plan2.newDirectories.length > 0) {
|
|
11347
|
-
console.log(
|
|
11383
|
+
console.log(chalk125.bold("\nNew directories:"));
|
|
11348
11384
|
for (const dir of plan2.newDirectories)
|
|
11349
|
-
console.log(
|
|
11385
|
+
console.log(chalk125.green(` ${dir}/`));
|
|
11350
11386
|
}
|
|
11351
11387
|
displayMoves(plan2);
|
|
11352
11388
|
displayRewrites(plan2.rewrites);
|
|
11353
11389
|
console.log(
|
|
11354
|
-
|
|
11390
|
+
chalk125.dim(
|
|
11355
11391
|
`
|
|
11356
11392
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
11357
11393
|
)
|
|
@@ -11361,18 +11397,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
11361
11397
|
// src/commands/refactor/restructure/executePlan.ts
|
|
11362
11398
|
import fs22 from "fs";
|
|
11363
11399
|
import path44 from "path";
|
|
11364
|
-
import
|
|
11400
|
+
import chalk126 from "chalk";
|
|
11365
11401
|
function executePlan(plan2) {
|
|
11366
11402
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
11367
11403
|
for (const [file, content] of updatedContents) {
|
|
11368
11404
|
fs22.writeFileSync(file, content, "utf-8");
|
|
11369
11405
|
console.log(
|
|
11370
|
-
|
|
11406
|
+
chalk126.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
|
|
11371
11407
|
);
|
|
11372
11408
|
}
|
|
11373
11409
|
for (const dir of plan2.newDirectories) {
|
|
11374
11410
|
fs22.mkdirSync(dir, { recursive: true });
|
|
11375
|
-
console.log(
|
|
11411
|
+
console.log(chalk126.green(` Created ${path44.relative(process.cwd(), dir)}/`));
|
|
11376
11412
|
}
|
|
11377
11413
|
for (const move of plan2.moves) {
|
|
11378
11414
|
const targetDir = path44.dirname(move.to);
|
|
@@ -11381,7 +11417,7 @@ function executePlan(plan2) {
|
|
|
11381
11417
|
}
|
|
11382
11418
|
fs22.renameSync(move.from, move.to);
|
|
11383
11419
|
console.log(
|
|
11384
|
-
|
|
11420
|
+
chalk126.white(
|
|
11385
11421
|
` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
|
|
11386
11422
|
)
|
|
11387
11423
|
);
|
|
@@ -11396,7 +11432,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
11396
11432
|
if (entries.length === 0) {
|
|
11397
11433
|
fs22.rmdirSync(dir);
|
|
11398
11434
|
console.log(
|
|
11399
|
-
|
|
11435
|
+
chalk126.dim(
|
|
11400
11436
|
` Removed empty directory ${path44.relative(process.cwd(), dir)}`
|
|
11401
11437
|
)
|
|
11402
11438
|
);
|
|
@@ -11529,22 +11565,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
11529
11565
|
const targetPattern = pattern2 ?? "src";
|
|
11530
11566
|
const files = findSourceFiles2(targetPattern);
|
|
11531
11567
|
if (files.length === 0) {
|
|
11532
|
-
console.log(
|
|
11568
|
+
console.log(chalk127.yellow("No files found matching pattern"));
|
|
11533
11569
|
return;
|
|
11534
11570
|
}
|
|
11535
11571
|
const tsConfigPath = path47.resolve("tsconfig.json");
|
|
11536
11572
|
const plan2 = buildPlan2(files, tsConfigPath);
|
|
11537
11573
|
if (plan2.moves.length === 0) {
|
|
11538
|
-
console.log(
|
|
11574
|
+
console.log(chalk127.green("No restructuring needed"));
|
|
11539
11575
|
return;
|
|
11540
11576
|
}
|
|
11541
11577
|
displayPlan2(plan2);
|
|
11542
11578
|
if (options2.apply) {
|
|
11543
|
-
console.log(
|
|
11579
|
+
console.log(chalk127.bold("\nApplying changes..."));
|
|
11544
11580
|
executePlan(plan2);
|
|
11545
|
-
console.log(
|
|
11581
|
+
console.log(chalk127.green("\nRestructuring complete"));
|
|
11546
11582
|
} else {
|
|
11547
|
-
console.log(
|
|
11583
|
+
console.log(chalk127.dim("\nDry run. Use --apply to execute."));
|
|
11548
11584
|
}
|
|
11549
11585
|
}
|
|
11550
11586
|
|
|
@@ -11995,18 +12031,18 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
11995
12031
|
}
|
|
11996
12032
|
|
|
11997
12033
|
// src/commands/review/warnUnlocated.ts
|
|
11998
|
-
import
|
|
12034
|
+
import chalk128 from "chalk";
|
|
11999
12035
|
function warnUnlocated(unlocated) {
|
|
12000
12036
|
if (unlocated.length === 0) return;
|
|
12001
12037
|
console.warn(
|
|
12002
|
-
|
|
12038
|
+
chalk128.yellow(
|
|
12003
12039
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
12004
12040
|
)
|
|
12005
12041
|
);
|
|
12006
12042
|
for (const finding of unlocated) {
|
|
12007
|
-
const where = finding.location ||
|
|
12043
|
+
const where = finding.location || chalk128.dim("missing");
|
|
12008
12044
|
console.warn(
|
|
12009
|
-
` ${
|
|
12045
|
+
` ${chalk128.yellow("\xB7")} ${finding.title} ${chalk128.dim(`(${where})`)}`
|
|
12010
12046
|
);
|
|
12011
12047
|
}
|
|
12012
12048
|
}
|
|
@@ -12858,7 +12894,7 @@ function registerReview(program2) {
|
|
|
12858
12894
|
}
|
|
12859
12895
|
|
|
12860
12896
|
// src/commands/seq/seqAuth.ts
|
|
12861
|
-
import
|
|
12897
|
+
import chalk130 from "chalk";
|
|
12862
12898
|
|
|
12863
12899
|
// src/commands/seq/loadConnections.ts
|
|
12864
12900
|
function loadConnections2() {
|
|
@@ -12887,10 +12923,10 @@ function setDefaultConnection(name) {
|
|
|
12887
12923
|
}
|
|
12888
12924
|
|
|
12889
12925
|
// src/shared/assertUniqueName.ts
|
|
12890
|
-
import
|
|
12926
|
+
import chalk129 from "chalk";
|
|
12891
12927
|
function assertUniqueName(existingNames, name) {
|
|
12892
12928
|
if (existingNames.includes(name)) {
|
|
12893
|
-
console.error(
|
|
12929
|
+
console.error(chalk129.red(`Connection "${name}" already exists.`));
|
|
12894
12930
|
process.exit(1);
|
|
12895
12931
|
}
|
|
12896
12932
|
}
|
|
@@ -12908,16 +12944,16 @@ async function promptConnection2(existingNames) {
|
|
|
12908
12944
|
var seqAuth = createConnectionAuth({
|
|
12909
12945
|
load: loadConnections2,
|
|
12910
12946
|
save: saveConnections2,
|
|
12911
|
-
format: (c) => `${
|
|
12947
|
+
format: (c) => `${chalk130.bold(c.name)} ${c.url}`,
|
|
12912
12948
|
promptNew: promptConnection2,
|
|
12913
12949
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
12914
12950
|
});
|
|
12915
12951
|
|
|
12916
12952
|
// src/commands/seq/seqQuery.ts
|
|
12917
|
-
import
|
|
12953
|
+
import chalk134 from "chalk";
|
|
12918
12954
|
|
|
12919
12955
|
// src/commands/seq/fetchSeq.ts
|
|
12920
|
-
import
|
|
12956
|
+
import chalk131 from "chalk";
|
|
12921
12957
|
async function fetchSeq(conn, path52, params) {
|
|
12922
12958
|
const url = `${conn.url}${path52}?${params}`;
|
|
12923
12959
|
const response = await fetch(url, {
|
|
@@ -12928,7 +12964,7 @@ async function fetchSeq(conn, path52, params) {
|
|
|
12928
12964
|
});
|
|
12929
12965
|
if (!response.ok) {
|
|
12930
12966
|
const body = await response.text();
|
|
12931
|
-
console.error(
|
|
12967
|
+
console.error(chalk131.red(`Seq returned ${response.status}: ${body}`));
|
|
12932
12968
|
process.exit(1);
|
|
12933
12969
|
}
|
|
12934
12970
|
return response;
|
|
@@ -12983,23 +13019,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
12983
13019
|
}
|
|
12984
13020
|
|
|
12985
13021
|
// src/commands/seq/formatEvent.ts
|
|
12986
|
-
import
|
|
13022
|
+
import chalk132 from "chalk";
|
|
12987
13023
|
function levelColor(level) {
|
|
12988
13024
|
switch (level) {
|
|
12989
13025
|
case "Fatal":
|
|
12990
|
-
return
|
|
13026
|
+
return chalk132.bgRed.white;
|
|
12991
13027
|
case "Error":
|
|
12992
|
-
return
|
|
13028
|
+
return chalk132.red;
|
|
12993
13029
|
case "Warning":
|
|
12994
|
-
return
|
|
13030
|
+
return chalk132.yellow;
|
|
12995
13031
|
case "Information":
|
|
12996
|
-
return
|
|
13032
|
+
return chalk132.cyan;
|
|
12997
13033
|
case "Debug":
|
|
12998
|
-
return
|
|
13034
|
+
return chalk132.gray;
|
|
12999
13035
|
case "Verbose":
|
|
13000
|
-
return
|
|
13036
|
+
return chalk132.dim;
|
|
13001
13037
|
default:
|
|
13002
|
-
return
|
|
13038
|
+
return chalk132.white;
|
|
13003
13039
|
}
|
|
13004
13040
|
}
|
|
13005
13041
|
function levelAbbrev(level) {
|
|
@@ -13040,12 +13076,12 @@ function formatTimestamp(iso) {
|
|
|
13040
13076
|
function formatEvent(event) {
|
|
13041
13077
|
const color = levelColor(event.Level);
|
|
13042
13078
|
const abbrev = levelAbbrev(event.Level);
|
|
13043
|
-
const ts8 =
|
|
13079
|
+
const ts8 = chalk132.dim(formatTimestamp(event.Timestamp));
|
|
13044
13080
|
const msg = renderMessage(event);
|
|
13045
13081
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
13046
13082
|
if (event.Exception) {
|
|
13047
13083
|
for (const line of event.Exception.split("\n")) {
|
|
13048
|
-
lines.push(
|
|
13084
|
+
lines.push(chalk132.red(` ${line}`));
|
|
13049
13085
|
}
|
|
13050
13086
|
}
|
|
13051
13087
|
return lines.join("\n");
|
|
@@ -13078,11 +13114,11 @@ function rejectTimestampFilter(filter) {
|
|
|
13078
13114
|
}
|
|
13079
13115
|
|
|
13080
13116
|
// src/shared/resolveNamedConnection.ts
|
|
13081
|
-
import
|
|
13117
|
+
import chalk133 from "chalk";
|
|
13082
13118
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
13083
13119
|
if (connections.length === 0) {
|
|
13084
13120
|
console.error(
|
|
13085
|
-
|
|
13121
|
+
chalk133.red(
|
|
13086
13122
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
13087
13123
|
)
|
|
13088
13124
|
);
|
|
@@ -13091,7 +13127,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
13091
13127
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
13092
13128
|
const connection = connections.find((c) => c.name === target);
|
|
13093
13129
|
if (!connection) {
|
|
13094
|
-
console.error(
|
|
13130
|
+
console.error(chalk133.red(`${kind} connection "${target}" not found.`));
|
|
13095
13131
|
process.exit(1);
|
|
13096
13132
|
}
|
|
13097
13133
|
return connection;
|
|
@@ -13120,7 +13156,7 @@ async function seqQuery(filter, options2) {
|
|
|
13120
13156
|
new URLSearchParams({ filter, count: String(count) })
|
|
13121
13157
|
);
|
|
13122
13158
|
if (events.length === 0) {
|
|
13123
|
-
console.log(
|
|
13159
|
+
console.log(chalk134.yellow("No events found."));
|
|
13124
13160
|
return;
|
|
13125
13161
|
}
|
|
13126
13162
|
if (options2.json) {
|
|
@@ -13131,11 +13167,11 @@ async function seqQuery(filter, options2) {
|
|
|
13131
13167
|
for (const event of chronological) {
|
|
13132
13168
|
console.log(formatEvent(event));
|
|
13133
13169
|
}
|
|
13134
|
-
console.log(
|
|
13170
|
+
console.log(chalk134.dim(`
|
|
13135
13171
|
${events.length} events`));
|
|
13136
13172
|
if (events.length >= count) {
|
|
13137
13173
|
console.log(
|
|
13138
|
-
|
|
13174
|
+
chalk134.yellow(
|
|
13139
13175
|
`Results limited to ${count}. Use --count to retrieve more.`
|
|
13140
13176
|
)
|
|
13141
13177
|
);
|
|
@@ -13143,10 +13179,10 @@ ${events.length} events`));
|
|
|
13143
13179
|
}
|
|
13144
13180
|
|
|
13145
13181
|
// src/shared/setNamedDefaultConnection.ts
|
|
13146
|
-
import
|
|
13182
|
+
import chalk135 from "chalk";
|
|
13147
13183
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
13148
13184
|
if (!connections.find((c) => c.name === name)) {
|
|
13149
|
-
console.error(
|
|
13185
|
+
console.error(chalk135.red(`Connection "${name}" not found.`));
|
|
13150
13186
|
process.exit(1);
|
|
13151
13187
|
}
|
|
13152
13188
|
setDefault(name);
|
|
@@ -13180,8 +13216,17 @@ function registerSeq(program2) {
|
|
|
13180
13216
|
).option("--json", "Output raw JSON").action((filter, options2) => seqQuery(filter, options2));
|
|
13181
13217
|
}
|
|
13182
13218
|
|
|
13219
|
+
// src/commands/registerSignal.ts
|
|
13220
|
+
function registerSignal(program2) {
|
|
13221
|
+
const signalCommand = program2.command("signal").description("Write an assist signal file");
|
|
13222
|
+
signalCommand.command("next").argument("[id]", "Backlog item ID to run directly").description("Write a next signal to chain into assist next").action((id) => {
|
|
13223
|
+
writeSignal("next", id ? { id } : void 0);
|
|
13224
|
+
console.log("Signal written.");
|
|
13225
|
+
});
|
|
13226
|
+
}
|
|
13227
|
+
|
|
13183
13228
|
// src/commands/sql/sqlAuth.ts
|
|
13184
|
-
import
|
|
13229
|
+
import chalk137 from "chalk";
|
|
13185
13230
|
|
|
13186
13231
|
// src/commands/sql/loadConnections.ts
|
|
13187
13232
|
function loadConnections3() {
|
|
@@ -13210,7 +13255,7 @@ function setDefaultConnection2(name) {
|
|
|
13210
13255
|
}
|
|
13211
13256
|
|
|
13212
13257
|
// src/commands/sql/promptConnection.ts
|
|
13213
|
-
import
|
|
13258
|
+
import chalk136 from "chalk";
|
|
13214
13259
|
async function promptConnection3(existingNames) {
|
|
13215
13260
|
const name = await promptInput("name", "Connection name:", "default");
|
|
13216
13261
|
assertUniqueName(existingNames, name);
|
|
@@ -13218,7 +13263,7 @@ async function promptConnection3(existingNames) {
|
|
|
13218
13263
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
13219
13264
|
const port = Number.parseInt(portStr, 10);
|
|
13220
13265
|
if (!Number.isFinite(port)) {
|
|
13221
|
-
console.error(
|
|
13266
|
+
console.error(chalk136.red(`Invalid port "${portStr}".`));
|
|
13222
13267
|
process.exit(1);
|
|
13223
13268
|
}
|
|
13224
13269
|
const user = await promptInput("user", "User:");
|
|
@@ -13231,13 +13276,13 @@ async function promptConnection3(existingNames) {
|
|
|
13231
13276
|
var sqlAuth = createConnectionAuth({
|
|
13232
13277
|
load: loadConnections3,
|
|
13233
13278
|
save: saveConnections3,
|
|
13234
|
-
format: (c) => `${
|
|
13279
|
+
format: (c) => `${chalk137.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
13235
13280
|
promptNew: promptConnection3,
|
|
13236
13281
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
13237
13282
|
});
|
|
13238
13283
|
|
|
13239
13284
|
// src/commands/sql/printTable.ts
|
|
13240
|
-
import
|
|
13285
|
+
import chalk138 from "chalk";
|
|
13241
13286
|
function formatCell(value) {
|
|
13242
13287
|
if (value === null || value === void 0) return "";
|
|
13243
13288
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -13246,7 +13291,7 @@ function formatCell(value) {
|
|
|
13246
13291
|
}
|
|
13247
13292
|
function printTable(rows) {
|
|
13248
13293
|
if (rows.length === 0) {
|
|
13249
|
-
console.log(
|
|
13294
|
+
console.log(chalk138.yellow("(no rows)"));
|
|
13250
13295
|
return;
|
|
13251
13296
|
}
|
|
13252
13297
|
const columns = Object.keys(rows[0]);
|
|
@@ -13254,13 +13299,13 @@ function printTable(rows) {
|
|
|
13254
13299
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
13255
13300
|
);
|
|
13256
13301
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
13257
|
-
console.log(
|
|
13258
|
-
console.log(
|
|
13302
|
+
console.log(chalk138.dim(header));
|
|
13303
|
+
console.log(chalk138.dim("-".repeat(header.length)));
|
|
13259
13304
|
for (const row of rows) {
|
|
13260
13305
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
13261
13306
|
console.log(line);
|
|
13262
13307
|
}
|
|
13263
|
-
console.log(
|
|
13308
|
+
console.log(chalk138.dim(`
|
|
13264
13309
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
13265
13310
|
}
|
|
13266
13311
|
|
|
@@ -13320,7 +13365,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
13320
13365
|
}
|
|
13321
13366
|
|
|
13322
13367
|
// src/commands/sql/sqlMutate.ts
|
|
13323
|
-
import
|
|
13368
|
+
import chalk139 from "chalk";
|
|
13324
13369
|
|
|
13325
13370
|
// src/commands/sql/isMutation.ts
|
|
13326
13371
|
var MUTATION_KEYWORDS = [
|
|
@@ -13354,7 +13399,7 @@ function isMutation(sql2) {
|
|
|
13354
13399
|
async function sqlMutate(query, connectionName) {
|
|
13355
13400
|
if (!isMutation(query)) {
|
|
13356
13401
|
console.error(
|
|
13357
|
-
|
|
13402
|
+
chalk139.red(
|
|
13358
13403
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
13359
13404
|
)
|
|
13360
13405
|
);
|
|
@@ -13364,18 +13409,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
13364
13409
|
const pool = await sqlConnect(conn);
|
|
13365
13410
|
try {
|
|
13366
13411
|
const result = await pool.request().query(query);
|
|
13367
|
-
console.log(
|
|
13412
|
+
console.log(chalk139.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
13368
13413
|
} finally {
|
|
13369
13414
|
await pool.close();
|
|
13370
13415
|
}
|
|
13371
13416
|
}
|
|
13372
13417
|
|
|
13373
13418
|
// src/commands/sql/sqlQuery.ts
|
|
13374
|
-
import
|
|
13419
|
+
import chalk140 from "chalk";
|
|
13375
13420
|
async function sqlQuery(query, connectionName) {
|
|
13376
13421
|
if (isMutation(query)) {
|
|
13377
13422
|
console.error(
|
|
13378
|
-
|
|
13423
|
+
chalk140.red(
|
|
13379
13424
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
13380
13425
|
)
|
|
13381
13426
|
);
|
|
@@ -13390,7 +13435,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
13390
13435
|
printTable(rows);
|
|
13391
13436
|
} else {
|
|
13392
13437
|
console.log(
|
|
13393
|
-
|
|
13438
|
+
chalk140.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
13394
13439
|
);
|
|
13395
13440
|
}
|
|
13396
13441
|
} finally {
|
|
@@ -13970,14 +14015,14 @@ import {
|
|
|
13970
14015
|
import { dirname as dirname22, join as join40 } from "path";
|
|
13971
14016
|
|
|
13972
14017
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
13973
|
-
import
|
|
14018
|
+
import chalk141 from "chalk";
|
|
13974
14019
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
13975
14020
|
function validateStagedContent(filename, content) {
|
|
13976
14021
|
const firstLine = content.split("\n")[0];
|
|
13977
14022
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
13978
14023
|
if (!match) {
|
|
13979
14024
|
console.error(
|
|
13980
|
-
|
|
14025
|
+
chalk141.red(
|
|
13981
14026
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
13982
14027
|
)
|
|
13983
14028
|
);
|
|
@@ -13986,7 +14031,7 @@ function validateStagedContent(filename, content) {
|
|
|
13986
14031
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
13987
14032
|
if (!contentAfterLink) {
|
|
13988
14033
|
console.error(
|
|
13989
|
-
|
|
14034
|
+
chalk141.red(
|
|
13990
14035
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
13991
14036
|
)
|
|
13992
14037
|
);
|
|
@@ -14382,7 +14427,7 @@ function registerVoice(program2) {
|
|
|
14382
14427
|
|
|
14383
14428
|
// src/commands/roam/auth.ts
|
|
14384
14429
|
import { randomBytes } from "crypto";
|
|
14385
|
-
import
|
|
14430
|
+
import chalk142 from "chalk";
|
|
14386
14431
|
|
|
14387
14432
|
// src/lib/openBrowser.ts
|
|
14388
14433
|
import { execSync as execSync41 } from "child_process";
|
|
@@ -14557,13 +14602,13 @@ async function auth() {
|
|
|
14557
14602
|
saveGlobalConfig(config);
|
|
14558
14603
|
const state = randomBytes(16).toString("hex");
|
|
14559
14604
|
console.log(
|
|
14560
|
-
|
|
14605
|
+
chalk142.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
14561
14606
|
);
|
|
14562
|
-
console.log(
|
|
14563
|
-
console.log(
|
|
14564
|
-
console.log(
|
|
14607
|
+
console.log(chalk142.white("http://localhost:14523/callback\n"));
|
|
14608
|
+
console.log(chalk142.blue("Opening browser for authorization..."));
|
|
14609
|
+
console.log(chalk142.dim("Waiting for authorization callback..."));
|
|
14565
14610
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
14566
|
-
console.log(
|
|
14611
|
+
console.log(chalk142.dim("Exchanging code for tokens..."));
|
|
14567
14612
|
const tokens = await exchangeToken({
|
|
14568
14613
|
code,
|
|
14569
14614
|
clientId,
|
|
@@ -14579,7 +14624,7 @@ async function auth() {
|
|
|
14579
14624
|
};
|
|
14580
14625
|
saveGlobalConfig(config);
|
|
14581
14626
|
console.log(
|
|
14582
|
-
|
|
14627
|
+
chalk142.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
14583
14628
|
);
|
|
14584
14629
|
}
|
|
14585
14630
|
|
|
@@ -15002,7 +15047,7 @@ import { execSync as execSync43 } from "child_process";
|
|
|
15002
15047
|
import { existsSync as existsSync47, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync32 } from "fs";
|
|
15003
15048
|
import { tmpdir as tmpdir7 } from "os";
|
|
15004
15049
|
import { join as join51, resolve as resolve13 } from "path";
|
|
15005
|
-
import
|
|
15050
|
+
import chalk143 from "chalk";
|
|
15006
15051
|
|
|
15007
15052
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
15008
15053
|
var captureWindowPs1 = `
|
|
@@ -15153,20 +15198,20 @@ function screenshot(processName) {
|
|
|
15153
15198
|
const config = loadConfig();
|
|
15154
15199
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
15155
15200
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
15156
|
-
console.log(
|
|
15201
|
+
console.log(chalk143.gray(`Capturing window for process "${processName}" ...`));
|
|
15157
15202
|
try {
|
|
15158
15203
|
runPowerShellScript(processName, outputPath);
|
|
15159
|
-
console.log(
|
|
15204
|
+
console.log(chalk143.green(`Screenshot saved: ${outputPath}`));
|
|
15160
15205
|
} catch (error) {
|
|
15161
15206
|
const msg = error instanceof Error ? error.message : String(error);
|
|
15162
|
-
console.error(
|
|
15207
|
+
console.error(chalk143.red(`Failed to capture screenshot: ${msg}`));
|
|
15163
15208
|
process.exit(1);
|
|
15164
15209
|
}
|
|
15165
15210
|
}
|
|
15166
15211
|
|
|
15167
15212
|
// src/commands/sessions/summarise/index.ts
|
|
15168
15213
|
import * as fs27 from "fs";
|
|
15169
|
-
import
|
|
15214
|
+
import chalk144 from "chalk";
|
|
15170
15215
|
|
|
15171
15216
|
// src/commands/sessions/summarise/shared.ts
|
|
15172
15217
|
import * as fs25 from "fs";
|
|
@@ -15306,22 +15351,22 @@ ${firstMessage}`);
|
|
|
15306
15351
|
async function summarise3(options2) {
|
|
15307
15352
|
const files = await discoverSessionJsonlPaths();
|
|
15308
15353
|
if (files.length === 0) {
|
|
15309
|
-
console.log(
|
|
15354
|
+
console.log(chalk144.yellow("No sessions found."));
|
|
15310
15355
|
return;
|
|
15311
15356
|
}
|
|
15312
15357
|
const toProcess = selectCandidates(files, options2);
|
|
15313
15358
|
if (toProcess.length === 0) {
|
|
15314
|
-
console.log(
|
|
15359
|
+
console.log(chalk144.green("All sessions already summarised."));
|
|
15315
15360
|
return;
|
|
15316
15361
|
}
|
|
15317
15362
|
console.log(
|
|
15318
|
-
|
|
15363
|
+
chalk144.cyan(
|
|
15319
15364
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
15320
15365
|
)
|
|
15321
15366
|
);
|
|
15322
15367
|
const { succeeded, failed } = processSessions(toProcess);
|
|
15323
15368
|
console.log(
|
|
15324
|
-
|
|
15369
|
+
chalk144.green(`Done: ${succeeded} summarised`) + (failed > 0 ? chalk144.yellow(`, ${failed} skipped`) : "")
|
|
15325
15370
|
);
|
|
15326
15371
|
}
|
|
15327
15372
|
function selectCandidates(files, options2) {
|
|
@@ -15341,16 +15386,16 @@ function processSessions(files) {
|
|
|
15341
15386
|
let failed = 0;
|
|
15342
15387
|
for (let i = 0; i < files.length; i++) {
|
|
15343
15388
|
const file = files[i];
|
|
15344
|
-
process.stdout.write(
|
|
15389
|
+
process.stdout.write(chalk144.dim(` [${i + 1}/${files.length}] `));
|
|
15345
15390
|
const summary = summariseSession(file);
|
|
15346
15391
|
if (summary) {
|
|
15347
15392
|
writeSummary(file, summary);
|
|
15348
15393
|
succeeded++;
|
|
15349
|
-
process.stdout.write(`${
|
|
15394
|
+
process.stdout.write(`${chalk144.green("\u2713")} ${summary}
|
|
15350
15395
|
`);
|
|
15351
15396
|
} else {
|
|
15352
15397
|
failed++;
|
|
15353
|
-
process.stdout.write(` ${
|
|
15398
|
+
process.stdout.write(` ${chalk144.yellow("skip")}
|
|
15354
15399
|
`);
|
|
15355
15400
|
}
|
|
15356
15401
|
}
|
|
@@ -15365,10 +15410,10 @@ function registerSessions(program2) {
|
|
|
15365
15410
|
}
|
|
15366
15411
|
|
|
15367
15412
|
// src/commands/statusLine.ts
|
|
15368
|
-
import
|
|
15413
|
+
import chalk146 from "chalk";
|
|
15369
15414
|
|
|
15370
15415
|
// src/commands/buildLimitsSegment.ts
|
|
15371
|
-
import
|
|
15416
|
+
import chalk145 from "chalk";
|
|
15372
15417
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
15373
15418
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
15374
15419
|
function formatTimeLeft(resetsAt) {
|
|
@@ -15391,10 +15436,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
15391
15436
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
15392
15437
|
const label2 = `${Math.round(pct)}%`;
|
|
15393
15438
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
15394
|
-
if (projected == null) return
|
|
15395
|
-
if (projected > 100) return
|
|
15396
|
-
if (projected > 75) return
|
|
15397
|
-
return
|
|
15439
|
+
if (projected == null) return chalk145.green(label2);
|
|
15440
|
+
if (projected > 100) return chalk145.red(label2);
|
|
15441
|
+
if (projected > 75) return chalk145.yellow(label2);
|
|
15442
|
+
return chalk145.green(label2);
|
|
15398
15443
|
}
|
|
15399
15444
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
15400
15445
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -15420,14 +15465,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
15420
15465
|
}
|
|
15421
15466
|
|
|
15422
15467
|
// src/commands/statusLine.ts
|
|
15423
|
-
|
|
15468
|
+
chalk146.level = 3;
|
|
15424
15469
|
function formatNumber(num) {
|
|
15425
15470
|
return num.toLocaleString("en-US");
|
|
15426
15471
|
}
|
|
15427
15472
|
function colorizePercent(pct) {
|
|
15428
15473
|
const label2 = `${Math.round(pct)}%`;
|
|
15429
|
-
if (pct > 80) return
|
|
15430
|
-
if (pct > 40) return
|
|
15474
|
+
if (pct > 80) return chalk146.red(label2);
|
|
15475
|
+
if (pct > 40) return chalk146.yellow(label2);
|
|
15431
15476
|
return label2;
|
|
15432
15477
|
}
|
|
15433
15478
|
async function statusLine() {
|
|
@@ -15450,7 +15495,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
15450
15495
|
// src/commands/sync/syncClaudeMd.ts
|
|
15451
15496
|
import * as fs28 from "fs";
|
|
15452
15497
|
import * as path48 from "path";
|
|
15453
|
-
import
|
|
15498
|
+
import chalk147 from "chalk";
|
|
15454
15499
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
15455
15500
|
const source = path48.join(claudeDir, "CLAUDE.md");
|
|
15456
15501
|
const target = path48.join(targetBase, "CLAUDE.md");
|
|
@@ -15459,12 +15504,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15459
15504
|
const targetContent = fs28.readFileSync(target, "utf-8");
|
|
15460
15505
|
if (sourceContent !== targetContent) {
|
|
15461
15506
|
console.log(
|
|
15462
|
-
|
|
15507
|
+
chalk147.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
15463
15508
|
);
|
|
15464
15509
|
console.log();
|
|
15465
15510
|
printDiff(targetContent, sourceContent);
|
|
15466
15511
|
const confirm = options2?.yes || await promptConfirm(
|
|
15467
|
-
|
|
15512
|
+
chalk147.red("Overwrite existing CLAUDE.md?"),
|
|
15468
15513
|
false
|
|
15469
15514
|
);
|
|
15470
15515
|
if (!confirm) {
|
|
@@ -15480,7 +15525,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
15480
15525
|
// src/commands/sync/syncSettings.ts
|
|
15481
15526
|
import * as fs29 from "fs";
|
|
15482
15527
|
import * as path49 from "path";
|
|
15483
|
-
import
|
|
15528
|
+
import chalk148 from "chalk";
|
|
15484
15529
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
15485
15530
|
const source = path49.join(claudeDir, "settings.json");
|
|
15486
15531
|
const target = path49.join(targetBase, "settings.json");
|
|
@@ -15496,14 +15541,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
15496
15541
|
if (mergedContent !== normalizedTarget) {
|
|
15497
15542
|
if (!options2?.yes) {
|
|
15498
15543
|
console.log(
|
|
15499
|
-
|
|
15544
|
+
chalk148.yellow(
|
|
15500
15545
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
15501
15546
|
)
|
|
15502
15547
|
);
|
|
15503
15548
|
console.log();
|
|
15504
15549
|
printDiff(targetContent, mergedContent);
|
|
15505
15550
|
const confirm = await promptConfirm(
|
|
15506
|
-
|
|
15551
|
+
chalk148.red("Overwrite existing settings.json?"),
|
|
15507
15552
|
false
|
|
15508
15553
|
);
|
|
15509
15554
|
if (!confirm) {
|
|
@@ -15628,9 +15673,5 @@ program.command("next").description("Alias for backlog next -w").action(() => ne
|
|
|
15628
15673
|
program.command("draft").alias("feat").description("Launch Claude in /draft mode, chain into next on /next signal").action(() => launchMode("draft"));
|
|
15629
15674
|
program.command("bug").description("Launch Claude in /bug mode, chain into next on /next signal").action(() => launchMode("bug"));
|
|
15630
15675
|
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
|
-
});
|
|
15676
|
+
registerSignal(program);
|
|
15636
15677
|
program.parse();
|