@staff0rd/assist 0.255.0 → 0.256.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +322 -319
- 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.256.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -7266,7 +7266,7 @@ function registerCliHook(program2) {
|
|
|
7266
7266
|
}
|
|
7267
7267
|
|
|
7268
7268
|
// src/commands/complexity/analyze.ts
|
|
7269
|
-
import
|
|
7269
|
+
import chalk85 from "chalk";
|
|
7270
7270
|
|
|
7271
7271
|
// src/commands/complexity/cyclomatic.ts
|
|
7272
7272
|
import chalk80 from "chalk";
|
|
@@ -7633,6 +7633,13 @@ Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability i
|
|
|
7633
7633
|
}
|
|
7634
7634
|
}
|
|
7635
7635
|
|
|
7636
|
+
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
7637
|
+
import chalk83 from "chalk";
|
|
7638
|
+
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
7639
|
+
function printMaintainabilityFormula() {
|
|
7640
|
+
console.log(chalk83.dim(MI_FORMULA));
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7636
7643
|
// src/commands/complexity/maintainability/index.ts
|
|
7637
7644
|
function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, sloc2) {
|
|
7638
7645
|
if (halsteadVolume === 0 || sloc2 === 0) {
|
|
@@ -7674,6 +7681,7 @@ function aggregateResults(fileMetrics) {
|
|
|
7674
7681
|
return results;
|
|
7675
7682
|
}
|
|
7676
7683
|
async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
7684
|
+
printMaintainabilityFormula();
|
|
7677
7685
|
withSourceFiles(pattern2, (files) => {
|
|
7678
7686
|
const fileMetrics = collectFileMetrics(files);
|
|
7679
7687
|
const results = aggregateResults(fileMetrics);
|
|
@@ -7683,7 +7691,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7683
7691
|
|
|
7684
7692
|
// src/commands/complexity/sloc.ts
|
|
7685
7693
|
import fs14 from "fs";
|
|
7686
|
-
import
|
|
7694
|
+
import chalk84 from "chalk";
|
|
7687
7695
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
7688
7696
|
withSourceFiles(pattern2, (files) => {
|
|
7689
7697
|
const results = [];
|
|
@@ -7699,12 +7707,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
7699
7707
|
results.sort((a, b) => b.lines - a.lines);
|
|
7700
7708
|
for (const { file, lines } of results) {
|
|
7701
7709
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
7702
|
-
const color = exceedsThreshold ?
|
|
7703
|
-
console.log(`${color(file)} \u2192 ${
|
|
7710
|
+
const color = exceedsThreshold ? chalk84.red : chalk84.white;
|
|
7711
|
+
console.log(`${color(file)} \u2192 ${chalk84.cyan(lines)} lines`);
|
|
7704
7712
|
}
|
|
7705
7713
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
7706
7714
|
console.log(
|
|
7707
|
-
|
|
7715
|
+
chalk84.dim(`
|
|
7708
7716
|
Total: ${total} lines across ${files.length} files`)
|
|
7709
7717
|
);
|
|
7710
7718
|
if (hasViolation) {
|
|
@@ -7718,26 +7726,21 @@ async function analyze(pattern2) {
|
|
|
7718
7726
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
7719
7727
|
const files = findSourceFiles2(searchPattern);
|
|
7720
7728
|
if (files.length === 0) {
|
|
7721
|
-
console.log(
|
|
7729
|
+
console.log(chalk85.yellow("No files found matching pattern"));
|
|
7722
7730
|
return;
|
|
7723
7731
|
}
|
|
7724
7732
|
if (files.length === 1) {
|
|
7725
7733
|
const file = files[0];
|
|
7726
|
-
console.log(
|
|
7734
|
+
console.log(chalk85.bold.underline("SLOC"));
|
|
7727
7735
|
await sloc(file);
|
|
7728
7736
|
console.log();
|
|
7729
|
-
console.log(
|
|
7737
|
+
console.log(chalk85.bold.underline("Cyclomatic Complexity"));
|
|
7730
7738
|
await cyclomatic(file);
|
|
7731
7739
|
console.log();
|
|
7732
|
-
console.log(
|
|
7740
|
+
console.log(chalk85.bold.underline("Halstead Metrics"));
|
|
7733
7741
|
await halstead(file);
|
|
7734
7742
|
console.log();
|
|
7735
|
-
console.log(
|
|
7736
|
-
console.log(
|
|
7737
|
-
chalk84.dim(
|
|
7738
|
-
"171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100"
|
|
7739
|
-
)
|
|
7740
|
-
);
|
|
7743
|
+
console.log(chalk85.bold.underline("Maintainability Index"));
|
|
7741
7744
|
await maintainability(file);
|
|
7742
7745
|
return;
|
|
7743
7746
|
}
|
|
@@ -7764,7 +7767,7 @@ function registerComplexity(program2) {
|
|
|
7764
7767
|
}
|
|
7765
7768
|
|
|
7766
7769
|
// src/commands/config/index.ts
|
|
7767
|
-
import
|
|
7770
|
+
import chalk86 from "chalk";
|
|
7768
7771
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
7769
7772
|
|
|
7770
7773
|
// src/commands/config/setNestedValue.ts
|
|
@@ -7827,7 +7830,7 @@ function formatIssuePath(issue, key) {
|
|
|
7827
7830
|
function printValidationErrors(issues, key) {
|
|
7828
7831
|
for (const issue of issues) {
|
|
7829
7832
|
console.error(
|
|
7830
|
-
|
|
7833
|
+
chalk86.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
7831
7834
|
);
|
|
7832
7835
|
}
|
|
7833
7836
|
}
|
|
@@ -7844,7 +7847,7 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
7844
7847
|
function assertNotGlobalOnly(key, global) {
|
|
7845
7848
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
7846
7849
|
console.error(
|
|
7847
|
-
|
|
7850
|
+
chalk86.red(
|
|
7848
7851
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
7849
7852
|
)
|
|
7850
7853
|
);
|
|
@@ -7867,7 +7870,7 @@ function configSet(key, value, options2 = {}) {
|
|
|
7867
7870
|
applyConfigSet(key, coerced, options2.global ?? false);
|
|
7868
7871
|
const target = options2.global ? "global" : "project";
|
|
7869
7872
|
console.log(
|
|
7870
|
-
|
|
7873
|
+
chalk86.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
7871
7874
|
);
|
|
7872
7875
|
}
|
|
7873
7876
|
function configList() {
|
|
@@ -7876,7 +7879,7 @@ function configList() {
|
|
|
7876
7879
|
}
|
|
7877
7880
|
|
|
7878
7881
|
// src/commands/config/configGet.ts
|
|
7879
|
-
import
|
|
7882
|
+
import chalk87 from "chalk";
|
|
7880
7883
|
|
|
7881
7884
|
// src/commands/config/getNestedValue.ts
|
|
7882
7885
|
function isTraversable(value) {
|
|
@@ -7908,7 +7911,7 @@ function requireNestedValue(config, key) {
|
|
|
7908
7911
|
return value;
|
|
7909
7912
|
}
|
|
7910
7913
|
function exitKeyNotSet(key) {
|
|
7911
|
-
console.error(
|
|
7914
|
+
console.error(chalk87.red(`Key "${key}" is not set`));
|
|
7912
7915
|
process.exit(1);
|
|
7913
7916
|
}
|
|
7914
7917
|
|
|
@@ -7922,7 +7925,7 @@ function registerConfig(program2) {
|
|
|
7922
7925
|
|
|
7923
7926
|
// src/commands/deploy/redirect.ts
|
|
7924
7927
|
import { existsSync as existsSync24, readFileSync as readFileSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
7925
|
-
import
|
|
7928
|
+
import chalk88 from "chalk";
|
|
7926
7929
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
7927
7930
|
if (!window.location.pathname.endsWith('/')) {
|
|
7928
7931
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -7931,22 +7934,22 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
7931
7934
|
function redirect() {
|
|
7932
7935
|
const indexPath = "index.html";
|
|
7933
7936
|
if (!existsSync24(indexPath)) {
|
|
7934
|
-
console.log(
|
|
7937
|
+
console.log(chalk88.yellow("No index.html found"));
|
|
7935
7938
|
return;
|
|
7936
7939
|
}
|
|
7937
7940
|
const content = readFileSync19(indexPath, "utf-8");
|
|
7938
7941
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
7939
|
-
console.log(
|
|
7942
|
+
console.log(chalk88.dim("Trailing slash script already present"));
|
|
7940
7943
|
return;
|
|
7941
7944
|
}
|
|
7942
7945
|
const headCloseIndex = content.indexOf("</head>");
|
|
7943
7946
|
if (headCloseIndex === -1) {
|
|
7944
|
-
console.log(
|
|
7947
|
+
console.log(chalk88.red("Could not find </head> tag in index.html"));
|
|
7945
7948
|
return;
|
|
7946
7949
|
}
|
|
7947
7950
|
const newContent = content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT + "\n " + content.slice(headCloseIndex);
|
|
7948
7951
|
writeFileSync17(indexPath, newContent);
|
|
7949
|
-
console.log(
|
|
7952
|
+
console.log(chalk88.green("Added trailing slash redirect to index.html"));
|
|
7950
7953
|
}
|
|
7951
7954
|
|
|
7952
7955
|
// src/commands/registerDeploy.ts
|
|
@@ -7973,7 +7976,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
7973
7976
|
|
|
7974
7977
|
// src/commands/devlog/shared.ts
|
|
7975
7978
|
import { execSync as execSync20 } from "child_process";
|
|
7976
|
-
import
|
|
7979
|
+
import chalk89 from "chalk";
|
|
7977
7980
|
|
|
7978
7981
|
// src/shared/getRepoName.ts
|
|
7979
7982
|
import { existsSync as existsSync25, readFileSync as readFileSync20 } from "fs";
|
|
@@ -8082,13 +8085,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
8082
8085
|
}
|
|
8083
8086
|
function printCommitsWithFiles(commits2, ignore2, verbose) {
|
|
8084
8087
|
for (const commit2 of commits2) {
|
|
8085
|
-
console.log(` ${
|
|
8088
|
+
console.log(` ${chalk89.yellow(commit2.hash)} ${commit2.message}`);
|
|
8086
8089
|
if (verbose) {
|
|
8087
8090
|
const visibleFiles = commit2.files.filter(
|
|
8088
8091
|
(file) => !ignore2.some((p) => file.startsWith(p))
|
|
8089
8092
|
);
|
|
8090
8093
|
for (const file of visibleFiles) {
|
|
8091
|
-
console.log(` ${
|
|
8094
|
+
console.log(` ${chalk89.dim(file)}`);
|
|
8092
8095
|
}
|
|
8093
8096
|
}
|
|
8094
8097
|
}
|
|
@@ -8113,15 +8116,15 @@ function parseGitLogCommits(output, ignore2, afterDate) {
|
|
|
8113
8116
|
}
|
|
8114
8117
|
|
|
8115
8118
|
// src/commands/devlog/list/printDateHeader.ts
|
|
8116
|
-
import
|
|
8119
|
+
import chalk90 from "chalk";
|
|
8117
8120
|
function printDateHeader(date, isSkipped, entries) {
|
|
8118
8121
|
if (isSkipped) {
|
|
8119
|
-
console.log(`${
|
|
8122
|
+
console.log(`${chalk90.bold.blue(date)} ${chalk90.dim("skipped")}`);
|
|
8120
8123
|
} else if (entries && entries.length > 0) {
|
|
8121
|
-
const entryInfo = entries.map((e) => `${
|
|
8122
|
-
console.log(`${
|
|
8124
|
+
const entryInfo = entries.map((e) => `${chalk90.green(e.version)} ${e.title}`).join(" | ");
|
|
8125
|
+
console.log(`${chalk90.bold.blue(date)} ${entryInfo}`);
|
|
8123
8126
|
} else {
|
|
8124
|
-
console.log(`${
|
|
8127
|
+
console.log(`${chalk90.bold.blue(date)} ${chalk90.red("\u26A0 devlog missing")}`);
|
|
8125
8128
|
}
|
|
8126
8129
|
}
|
|
8127
8130
|
|
|
@@ -8225,24 +8228,24 @@ function bumpVersion(version2, type) {
|
|
|
8225
8228
|
|
|
8226
8229
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
8227
8230
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
8228
|
-
import
|
|
8231
|
+
import chalk92 from "chalk";
|
|
8229
8232
|
|
|
8230
8233
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
8231
|
-
import
|
|
8234
|
+
import chalk91 from "chalk";
|
|
8232
8235
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
8233
8236
|
if (conventional && firstHash) {
|
|
8234
8237
|
const version2 = getVersionAtCommit(firstHash);
|
|
8235
8238
|
if (version2) {
|
|
8236
|
-
console.log(`${
|
|
8239
|
+
console.log(`${chalk91.bold("version:")} ${stripToMinor(version2)}`);
|
|
8237
8240
|
} else {
|
|
8238
|
-
console.log(`${
|
|
8241
|
+
console.log(`${chalk91.bold("version:")} ${chalk91.red("unknown")}`);
|
|
8239
8242
|
}
|
|
8240
8243
|
} else if (patchVersion && minorVersion) {
|
|
8241
8244
|
console.log(
|
|
8242
|
-
`${
|
|
8245
|
+
`${chalk91.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
8243
8246
|
);
|
|
8244
8247
|
} else {
|
|
8245
|
-
console.log(`${
|
|
8248
|
+
console.log(`${chalk91.bold("version:")} v0.1 (initial)`);
|
|
8246
8249
|
}
|
|
8247
8250
|
}
|
|
8248
8251
|
|
|
@@ -8290,16 +8293,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
8290
8293
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
8291
8294
|
}
|
|
8292
8295
|
function logName(repoName) {
|
|
8293
|
-
console.log(`${
|
|
8296
|
+
console.log(`${chalk92.bold("name:")} ${repoName}`);
|
|
8294
8297
|
}
|
|
8295
8298
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
8296
8299
|
logName(ctx.repoName);
|
|
8297
8300
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
8298
|
-
console.log(
|
|
8301
|
+
console.log(chalk92.bold.blue(targetDate));
|
|
8299
8302
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
8300
8303
|
}
|
|
8301
8304
|
function logNoCommits(lastInfo) {
|
|
8302
|
-
console.log(
|
|
8305
|
+
console.log(chalk92.dim(noCommitsMessage(!!lastInfo)));
|
|
8303
8306
|
}
|
|
8304
8307
|
|
|
8305
8308
|
// src/commands/devlog/next/index.ts
|
|
@@ -8340,11 +8343,11 @@ function next2(options2) {
|
|
|
8340
8343
|
import { execSync as execSync22 } from "child_process";
|
|
8341
8344
|
|
|
8342
8345
|
// src/commands/devlog/repos/printReposTable.ts
|
|
8343
|
-
import
|
|
8346
|
+
import chalk93 from "chalk";
|
|
8344
8347
|
function colorStatus(status2) {
|
|
8345
|
-
if (status2 === "missing") return
|
|
8346
|
-
if (status2 === "outdated") return
|
|
8347
|
-
return
|
|
8348
|
+
if (status2 === "missing") return chalk93.red(status2);
|
|
8349
|
+
if (status2 === "outdated") return chalk93.yellow(status2);
|
|
8350
|
+
return chalk93.green(status2);
|
|
8348
8351
|
}
|
|
8349
8352
|
function formatRow(row, nameWidth) {
|
|
8350
8353
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -8358,8 +8361,8 @@ function printReposTable(rows) {
|
|
|
8358
8361
|
"Last Devlog".padEnd(11),
|
|
8359
8362
|
"Status"
|
|
8360
8363
|
].join(" ");
|
|
8361
|
-
console.log(
|
|
8362
|
-
console.log(
|
|
8364
|
+
console.log(chalk93.dim(header));
|
|
8365
|
+
console.log(chalk93.dim("-".repeat(header.length)));
|
|
8363
8366
|
for (const row of rows) {
|
|
8364
8367
|
console.log(formatRow(row, nameWidth));
|
|
8365
8368
|
}
|
|
@@ -8417,14 +8420,14 @@ function repos(options2) {
|
|
|
8417
8420
|
// src/commands/devlog/skip.ts
|
|
8418
8421
|
import { writeFileSync as writeFileSync18 } from "fs";
|
|
8419
8422
|
import { join as join25 } from "path";
|
|
8420
|
-
import
|
|
8423
|
+
import chalk94 from "chalk";
|
|
8421
8424
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
8422
8425
|
function getBlogConfigPath() {
|
|
8423
8426
|
return join25(BLOG_REPO_ROOT, "assist.yml");
|
|
8424
8427
|
}
|
|
8425
8428
|
function skip(date) {
|
|
8426
8429
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
8427
|
-
console.log(
|
|
8430
|
+
console.log(chalk94.red("Invalid date format. Use YYYY-MM-DD"));
|
|
8428
8431
|
process.exit(1);
|
|
8429
8432
|
}
|
|
8430
8433
|
const repoName = getRepoName();
|
|
@@ -8435,7 +8438,7 @@ function skip(date) {
|
|
|
8435
8438
|
const skipDays = skip2[repoName] ?? [];
|
|
8436
8439
|
if (skipDays.includes(date)) {
|
|
8437
8440
|
console.log(
|
|
8438
|
-
|
|
8441
|
+
chalk94.yellow(`${date} is already in skip list for ${repoName}`)
|
|
8439
8442
|
);
|
|
8440
8443
|
return;
|
|
8441
8444
|
}
|
|
@@ -8445,20 +8448,20 @@ function skip(date) {
|
|
|
8445
8448
|
devlog.skip = skip2;
|
|
8446
8449
|
config.devlog = devlog;
|
|
8447
8450
|
writeFileSync18(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
8448
|
-
console.log(
|
|
8451
|
+
console.log(chalk94.green(`Added ${date} to skip list for ${repoName}`));
|
|
8449
8452
|
}
|
|
8450
8453
|
|
|
8451
8454
|
// src/commands/devlog/version.ts
|
|
8452
|
-
import
|
|
8455
|
+
import chalk95 from "chalk";
|
|
8453
8456
|
function version() {
|
|
8454
8457
|
const config = loadConfig();
|
|
8455
8458
|
const name = getRepoName();
|
|
8456
8459
|
const lastInfo = getLastVersionInfo(name, config);
|
|
8457
8460
|
const lastVersion = lastInfo?.version ?? null;
|
|
8458
8461
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
8459
|
-
console.log(`${
|
|
8460
|
-
console.log(`${
|
|
8461
|
-
console.log(`${
|
|
8462
|
+
console.log(`${chalk95.bold("name:")} ${name}`);
|
|
8463
|
+
console.log(`${chalk95.bold("last:")} ${lastVersion ?? chalk95.dim("none")}`);
|
|
8464
|
+
console.log(`${chalk95.bold("next:")} ${nextVersion ?? chalk95.dim("none")}`);
|
|
8462
8465
|
}
|
|
8463
8466
|
|
|
8464
8467
|
// src/commands/registerDevlog.ts
|
|
@@ -8482,7 +8485,7 @@ function registerDevlog(program2) {
|
|
|
8482
8485
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
8483
8486
|
import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync2 } from "fs";
|
|
8484
8487
|
import { join as join26 } from "path";
|
|
8485
|
-
import
|
|
8488
|
+
import chalk96 from "chalk";
|
|
8486
8489
|
|
|
8487
8490
|
// src/shared/findRepoRoot.ts
|
|
8488
8491
|
import { existsSync as existsSync26 } from "fs";
|
|
@@ -8545,14 +8548,14 @@ function checkBuildLocks(startDir) {
|
|
|
8545
8548
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
8546
8549
|
if (locked) {
|
|
8547
8550
|
console.error(
|
|
8548
|
-
|
|
8551
|
+
chalk96.red("Build output locked (is VS debugging?): ") + locked
|
|
8549
8552
|
);
|
|
8550
8553
|
process.exit(1);
|
|
8551
8554
|
}
|
|
8552
8555
|
}
|
|
8553
8556
|
async function checkBuildLocksCommand() {
|
|
8554
8557
|
checkBuildLocks();
|
|
8555
|
-
console.log(
|
|
8558
|
+
console.log(chalk96.green("No build locks detected"));
|
|
8556
8559
|
}
|
|
8557
8560
|
|
|
8558
8561
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -8651,30 +8654,30 @@ function escapeRegex(s) {
|
|
|
8651
8654
|
}
|
|
8652
8655
|
|
|
8653
8656
|
// src/commands/dotnet/printTree.ts
|
|
8654
|
-
import
|
|
8657
|
+
import chalk97 from "chalk";
|
|
8655
8658
|
function printNodes(nodes, prefix2) {
|
|
8656
8659
|
for (let i = 0; i < nodes.length; i++) {
|
|
8657
8660
|
const isLast = i === nodes.length - 1;
|
|
8658
8661
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
8659
8662
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
8660
8663
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
8661
|
-
const label2 = isMissing ?
|
|
8664
|
+
const label2 = isMissing ? chalk97.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
8662
8665
|
console.log(`${prefix2}${connector}${label2}`);
|
|
8663
8666
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
8664
8667
|
}
|
|
8665
8668
|
}
|
|
8666
8669
|
function printTree(tree, totalCount, solutions) {
|
|
8667
|
-
console.log(
|
|
8668
|
-
console.log(
|
|
8670
|
+
console.log(chalk97.bold("\nProject Dependency Tree"));
|
|
8671
|
+
console.log(chalk97.cyan(tree.relativePath));
|
|
8669
8672
|
printNodes(tree.children, "");
|
|
8670
|
-
console.log(
|
|
8673
|
+
console.log(chalk97.dim(`
|
|
8671
8674
|
${totalCount} projects total (including root)`));
|
|
8672
|
-
console.log(
|
|
8675
|
+
console.log(chalk97.bold("\nSolution Membership"));
|
|
8673
8676
|
if (solutions.length === 0) {
|
|
8674
|
-
console.log(
|
|
8677
|
+
console.log(chalk97.yellow(" Not found in any .sln"));
|
|
8675
8678
|
} else {
|
|
8676
8679
|
for (const sln of solutions) {
|
|
8677
|
-
console.log(` ${
|
|
8680
|
+
console.log(` ${chalk97.green(sln)}`);
|
|
8678
8681
|
}
|
|
8679
8682
|
}
|
|
8680
8683
|
console.log();
|
|
@@ -8703,16 +8706,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
8703
8706
|
// src/commands/dotnet/resolveCsproj.ts
|
|
8704
8707
|
import { existsSync as existsSync27 } from "fs";
|
|
8705
8708
|
import path23 from "path";
|
|
8706
|
-
import
|
|
8709
|
+
import chalk98 from "chalk";
|
|
8707
8710
|
function resolveCsproj(csprojPath) {
|
|
8708
8711
|
const resolved = path23.resolve(csprojPath);
|
|
8709
8712
|
if (!existsSync27(resolved)) {
|
|
8710
|
-
console.error(
|
|
8713
|
+
console.error(chalk98.red(`File not found: ${resolved}`));
|
|
8711
8714
|
process.exit(1);
|
|
8712
8715
|
}
|
|
8713
8716
|
const repoRoot = findRepoRoot(path23.dirname(resolved));
|
|
8714
8717
|
if (!repoRoot) {
|
|
8715
|
-
console.error(
|
|
8718
|
+
console.error(chalk98.red("Could not find git repository root"));
|
|
8716
8719
|
process.exit(1);
|
|
8717
8720
|
}
|
|
8718
8721
|
return { resolved, repoRoot };
|
|
@@ -8762,12 +8765,12 @@ function getChangedCsFiles(scope) {
|
|
|
8762
8765
|
}
|
|
8763
8766
|
|
|
8764
8767
|
// src/commands/dotnet/inSln.ts
|
|
8765
|
-
import
|
|
8768
|
+
import chalk99 from "chalk";
|
|
8766
8769
|
async function inSln(csprojPath) {
|
|
8767
8770
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
8768
8771
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
8769
8772
|
if (solutions.length === 0) {
|
|
8770
|
-
console.log(
|
|
8773
|
+
console.log(chalk99.yellow("Not found in any .sln file"));
|
|
8771
8774
|
process.exit(1);
|
|
8772
8775
|
}
|
|
8773
8776
|
for (const sln of solutions) {
|
|
@@ -8776,7 +8779,7 @@ async function inSln(csprojPath) {
|
|
|
8776
8779
|
}
|
|
8777
8780
|
|
|
8778
8781
|
// src/commands/dotnet/inspect.ts
|
|
8779
|
-
import
|
|
8782
|
+
import chalk105 from "chalk";
|
|
8780
8783
|
|
|
8781
8784
|
// src/shared/formatElapsed.ts
|
|
8782
8785
|
function formatElapsed(ms) {
|
|
@@ -8788,12 +8791,12 @@ function formatElapsed(ms) {
|
|
|
8788
8791
|
}
|
|
8789
8792
|
|
|
8790
8793
|
// src/commands/dotnet/displayIssues.ts
|
|
8791
|
-
import
|
|
8794
|
+
import chalk100 from "chalk";
|
|
8792
8795
|
var SEVERITY_COLOR = {
|
|
8793
|
-
ERROR:
|
|
8794
|
-
WARNING:
|
|
8795
|
-
SUGGESTION:
|
|
8796
|
-
HINT:
|
|
8796
|
+
ERROR: chalk100.red,
|
|
8797
|
+
WARNING: chalk100.yellow,
|
|
8798
|
+
SUGGESTION: chalk100.cyan,
|
|
8799
|
+
HINT: chalk100.dim
|
|
8797
8800
|
};
|
|
8798
8801
|
function groupByFile(issues) {
|
|
8799
8802
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -8809,15 +8812,15 @@ function groupByFile(issues) {
|
|
|
8809
8812
|
}
|
|
8810
8813
|
function displayIssues(issues) {
|
|
8811
8814
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
8812
|
-
console.log(
|
|
8815
|
+
console.log(chalk100.bold(file));
|
|
8813
8816
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
8814
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
8817
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk100.white;
|
|
8815
8818
|
console.log(
|
|
8816
|
-
` ${
|
|
8819
|
+
` ${chalk100.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
8817
8820
|
);
|
|
8818
8821
|
}
|
|
8819
8822
|
}
|
|
8820
|
-
console.log(
|
|
8823
|
+
console.log(chalk100.dim(`
|
|
8821
8824
|
${issues.length} issue(s) found`));
|
|
8822
8825
|
}
|
|
8823
8826
|
|
|
@@ -8876,12 +8879,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
8876
8879
|
// src/commands/dotnet/resolveSolution.ts
|
|
8877
8880
|
import { existsSync as existsSync28 } from "fs";
|
|
8878
8881
|
import path24 from "path";
|
|
8879
|
-
import
|
|
8882
|
+
import chalk102 from "chalk";
|
|
8880
8883
|
|
|
8881
8884
|
// src/commands/dotnet/findSolution.ts
|
|
8882
8885
|
import { readdirSync as readdirSync4 } from "fs";
|
|
8883
8886
|
import { dirname as dirname18, join as join27 } from "path";
|
|
8884
|
-
import
|
|
8887
|
+
import chalk101 from "chalk";
|
|
8885
8888
|
function findSlnInDir(dir) {
|
|
8886
8889
|
try {
|
|
8887
8890
|
return readdirSync4(dir).filter((f) => f.endsWith(".sln")).map((f) => join27(dir, f));
|
|
@@ -8897,17 +8900,17 @@ function findSolution() {
|
|
|
8897
8900
|
const slnFiles = findSlnInDir(current);
|
|
8898
8901
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
8899
8902
|
if (slnFiles.length > 1) {
|
|
8900
|
-
console.error(
|
|
8903
|
+
console.error(chalk101.red(`Multiple .sln files found in ${current}:`));
|
|
8901
8904
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
8902
8905
|
console.error(
|
|
8903
|
-
|
|
8906
|
+
chalk101.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
8904
8907
|
);
|
|
8905
8908
|
process.exit(1);
|
|
8906
8909
|
}
|
|
8907
8910
|
if (current === ceiling) break;
|
|
8908
8911
|
current = dirname18(current);
|
|
8909
8912
|
}
|
|
8910
|
-
console.error(
|
|
8913
|
+
console.error(chalk101.red("No .sln file found between cwd and repo root"));
|
|
8911
8914
|
process.exit(1);
|
|
8912
8915
|
}
|
|
8913
8916
|
|
|
@@ -8916,7 +8919,7 @@ function resolveSolution(sln) {
|
|
|
8916
8919
|
if (sln) {
|
|
8917
8920
|
const resolved = path24.resolve(sln);
|
|
8918
8921
|
if (!existsSync28(resolved)) {
|
|
8919
|
-
console.error(
|
|
8922
|
+
console.error(chalk102.red(`Solution file not found: ${resolved}`));
|
|
8920
8923
|
process.exit(1);
|
|
8921
8924
|
}
|
|
8922
8925
|
return resolved;
|
|
@@ -8958,14 +8961,14 @@ import { execSync as execSync24 } from "child_process";
|
|
|
8958
8961
|
import { existsSync as existsSync29, readFileSync as readFileSync24, unlinkSync as unlinkSync6 } from "fs";
|
|
8959
8962
|
import { tmpdir as tmpdir3 } from "os";
|
|
8960
8963
|
import path25 from "path";
|
|
8961
|
-
import
|
|
8964
|
+
import chalk103 from "chalk";
|
|
8962
8965
|
function assertJbInstalled() {
|
|
8963
8966
|
try {
|
|
8964
8967
|
execSync24("jb inspectcode --version", { stdio: "pipe" });
|
|
8965
8968
|
} catch {
|
|
8966
|
-
console.error(
|
|
8969
|
+
console.error(chalk103.red("jb is not installed. Install with:"));
|
|
8967
8970
|
console.error(
|
|
8968
|
-
|
|
8971
|
+
chalk103.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
8969
8972
|
);
|
|
8970
8973
|
process.exit(1);
|
|
8971
8974
|
}
|
|
@@ -8983,11 +8986,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8983
8986
|
if (err && typeof err === "object" && "stderr" in err) {
|
|
8984
8987
|
process.stderr.write(err.stderr);
|
|
8985
8988
|
}
|
|
8986
|
-
console.error(
|
|
8989
|
+
console.error(chalk103.red("jb inspectcode failed"));
|
|
8987
8990
|
process.exit(1);
|
|
8988
8991
|
}
|
|
8989
8992
|
if (!existsSync29(reportPath)) {
|
|
8990
|
-
console.error(
|
|
8993
|
+
console.error(chalk103.red("Report file not generated"));
|
|
8991
8994
|
process.exit(1);
|
|
8992
8995
|
}
|
|
8993
8996
|
const xml = readFileSync24(reportPath, "utf-8");
|
|
@@ -8997,7 +9000,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
8997
9000
|
|
|
8998
9001
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
8999
9002
|
import { execSync as execSync25 } from "child_process";
|
|
9000
|
-
import
|
|
9003
|
+
import chalk104 from "chalk";
|
|
9001
9004
|
function resolveMsbuildPath() {
|
|
9002
9005
|
const { run: run4 } = loadConfig();
|
|
9003
9006
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -9009,9 +9012,9 @@ function assertMsbuildInstalled() {
|
|
|
9009
9012
|
try {
|
|
9010
9013
|
execSync25(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
9011
9014
|
} catch {
|
|
9012
|
-
console.error(
|
|
9015
|
+
console.error(chalk104.red(`msbuild not found at: ${msbuild}`));
|
|
9013
9016
|
console.error(
|
|
9014
|
-
|
|
9017
|
+
chalk104.yellow(
|
|
9015
9018
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
9016
9019
|
)
|
|
9017
9020
|
);
|
|
@@ -9058,17 +9061,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
9058
9061
|
// src/commands/dotnet/inspect.ts
|
|
9059
9062
|
function logScope(changedFiles) {
|
|
9060
9063
|
if (changedFiles === null) {
|
|
9061
|
-
console.log(
|
|
9064
|
+
console.log(chalk105.dim("Inspecting full solution..."));
|
|
9062
9065
|
} else {
|
|
9063
9066
|
console.log(
|
|
9064
|
-
|
|
9067
|
+
chalk105.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
9065
9068
|
);
|
|
9066
9069
|
}
|
|
9067
9070
|
}
|
|
9068
9071
|
function reportResults(issues, elapsed) {
|
|
9069
9072
|
if (issues.length > 0) displayIssues(issues);
|
|
9070
|
-
else console.log(
|
|
9071
|
-
console.log(
|
|
9073
|
+
else console.log(chalk105.green("No issues found"));
|
|
9074
|
+
console.log(chalk105.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
9072
9075
|
if (issues.length > 0) process.exit(1);
|
|
9073
9076
|
}
|
|
9074
9077
|
async function inspect(sln, options2) {
|
|
@@ -9079,7 +9082,7 @@ async function inspect(sln, options2) {
|
|
|
9079
9082
|
const scope = parseScope(options2.scope);
|
|
9080
9083
|
const changedFiles = getChangedCsFiles(scope);
|
|
9081
9084
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
9082
|
-
console.log(
|
|
9085
|
+
console.log(chalk105.green("No changed .cs files found"));
|
|
9083
9086
|
return;
|
|
9084
9087
|
}
|
|
9085
9088
|
logScope(changedFiles);
|
|
@@ -9192,25 +9195,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
9192
9195
|
}
|
|
9193
9196
|
|
|
9194
9197
|
// src/commands/github/printCountTable.ts
|
|
9195
|
-
import
|
|
9198
|
+
import chalk106 from "chalk";
|
|
9196
9199
|
function printCountTable(labelHeader, rows) {
|
|
9197
9200
|
const labelWidth = Math.max(
|
|
9198
9201
|
labelHeader.length,
|
|
9199
9202
|
...rows.map((row) => row.label.length)
|
|
9200
9203
|
);
|
|
9201
9204
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
9202
|
-
console.log(
|
|
9203
|
-
console.log(
|
|
9205
|
+
console.log(chalk106.dim(header));
|
|
9206
|
+
console.log(chalk106.dim("-".repeat(header.length)));
|
|
9204
9207
|
for (const row of rows) {
|
|
9205
9208
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
9206
9209
|
}
|
|
9207
9210
|
}
|
|
9208
9211
|
|
|
9209
9212
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
9210
|
-
import
|
|
9213
|
+
import chalk107 from "chalk";
|
|
9211
9214
|
function printRepoAuthorBreakdown(repos2) {
|
|
9212
9215
|
for (const repo of repos2) {
|
|
9213
|
-
console.log(
|
|
9216
|
+
console.log(chalk107.bold(repo.name));
|
|
9214
9217
|
const authorWidth = Math.max(
|
|
9215
9218
|
0,
|
|
9216
9219
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -9535,7 +9538,7 @@ function registerHandover(program2) {
|
|
|
9535
9538
|
}
|
|
9536
9539
|
|
|
9537
9540
|
// src/commands/jira/acceptanceCriteria.ts
|
|
9538
|
-
import
|
|
9541
|
+
import chalk109 from "chalk";
|
|
9539
9542
|
|
|
9540
9543
|
// src/commands/jira/adfToText.ts
|
|
9541
9544
|
function renderInline(node) {
|
|
@@ -9596,7 +9599,7 @@ function adfToText(doc) {
|
|
|
9596
9599
|
|
|
9597
9600
|
// src/commands/jira/fetchIssue.ts
|
|
9598
9601
|
import { execSync as execSync26 } from "child_process";
|
|
9599
|
-
import
|
|
9602
|
+
import chalk108 from "chalk";
|
|
9600
9603
|
function fetchIssue(issueKey, fields) {
|
|
9601
9604
|
let result;
|
|
9602
9605
|
try {
|
|
@@ -9609,15 +9612,15 @@ function fetchIssue(issueKey, fields) {
|
|
|
9609
9612
|
const stderr = error.stderr;
|
|
9610
9613
|
if (stderr.includes("unauthorized")) {
|
|
9611
9614
|
console.error(
|
|
9612
|
-
|
|
9615
|
+
chalk108.red("Jira authentication expired."),
|
|
9613
9616
|
"Run",
|
|
9614
|
-
|
|
9617
|
+
chalk108.cyan("assist jira auth"),
|
|
9615
9618
|
"to re-authenticate."
|
|
9616
9619
|
);
|
|
9617
9620
|
process.exit(1);
|
|
9618
9621
|
}
|
|
9619
9622
|
}
|
|
9620
|
-
console.error(
|
|
9623
|
+
console.error(chalk108.red(`Failed to fetch ${issueKey}.`));
|
|
9621
9624
|
process.exit(1);
|
|
9622
9625
|
}
|
|
9623
9626
|
return JSON.parse(result);
|
|
@@ -9631,7 +9634,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
9631
9634
|
const parsed = fetchIssue(issueKey, field);
|
|
9632
9635
|
const acValue = parsed?.fields?.[field];
|
|
9633
9636
|
if (!acValue) {
|
|
9634
|
-
console.log(
|
|
9637
|
+
console.log(chalk109.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
9635
9638
|
return;
|
|
9636
9639
|
}
|
|
9637
9640
|
if (typeof acValue === "string") {
|
|
@@ -9726,14 +9729,14 @@ async function jiraAuth() {
|
|
|
9726
9729
|
}
|
|
9727
9730
|
|
|
9728
9731
|
// src/commands/jira/viewIssue.ts
|
|
9729
|
-
import
|
|
9732
|
+
import chalk110 from "chalk";
|
|
9730
9733
|
function viewIssue(issueKey) {
|
|
9731
9734
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
9732
9735
|
const fields = parsed?.fields;
|
|
9733
9736
|
const summary = fields?.summary;
|
|
9734
9737
|
const description = fields?.description;
|
|
9735
9738
|
if (summary) {
|
|
9736
|
-
console.log(
|
|
9739
|
+
console.log(chalk110.bold(summary));
|
|
9737
9740
|
}
|
|
9738
9741
|
if (description) {
|
|
9739
9742
|
if (summary) console.log();
|
|
@@ -9747,7 +9750,7 @@ function viewIssue(issueKey) {
|
|
|
9747
9750
|
}
|
|
9748
9751
|
if (!summary && !description) {
|
|
9749
9752
|
console.log(
|
|
9750
|
-
|
|
9753
|
+
chalk110.yellow(`No summary or description found on ${issueKey}.`)
|
|
9751
9754
|
);
|
|
9752
9755
|
}
|
|
9753
9756
|
}
|
|
@@ -9762,13 +9765,13 @@ function registerJira(program2) {
|
|
|
9762
9765
|
|
|
9763
9766
|
// src/commands/reviewComments.ts
|
|
9764
9767
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
9765
|
-
import
|
|
9768
|
+
import chalk111 from "chalk";
|
|
9766
9769
|
async function reviewComments(number) {
|
|
9767
9770
|
if (number) {
|
|
9768
9771
|
try {
|
|
9769
9772
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
9770
9773
|
} catch {
|
|
9771
|
-
console.error(
|
|
9774
|
+
console.error(chalk111.red(`gh pr checkout ${number} failed; aborting.`));
|
|
9772
9775
|
process.exit(1);
|
|
9773
9776
|
}
|
|
9774
9777
|
}
|
|
@@ -9809,15 +9812,15 @@ function registerList(program2) {
|
|
|
9809
9812
|
// src/commands/mermaid/index.ts
|
|
9810
9813
|
import { mkdirSync as mkdirSync10, readdirSync as readdirSync5 } from "fs";
|
|
9811
9814
|
import { resolve as resolve10 } from "path";
|
|
9812
|
-
import
|
|
9815
|
+
import chalk114 from "chalk";
|
|
9813
9816
|
|
|
9814
9817
|
// src/commands/mermaid/exportFile.ts
|
|
9815
9818
|
import { readFileSync as readFileSync28, writeFileSync as writeFileSync21 } from "fs";
|
|
9816
9819
|
import { basename as basename5, extname, resolve as resolve9 } from "path";
|
|
9817
|
-
import
|
|
9820
|
+
import chalk113 from "chalk";
|
|
9818
9821
|
|
|
9819
9822
|
// src/commands/mermaid/renderBlock.ts
|
|
9820
|
-
import
|
|
9823
|
+
import chalk112 from "chalk";
|
|
9821
9824
|
async function renderBlock(krokiUrl, source) {
|
|
9822
9825
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
9823
9826
|
method: "POST",
|
|
@@ -9826,7 +9829,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
9826
9829
|
});
|
|
9827
9830
|
if (!response.ok) {
|
|
9828
9831
|
console.error(
|
|
9829
|
-
|
|
9832
|
+
chalk112.red(
|
|
9830
9833
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
9831
9834
|
)
|
|
9832
9835
|
);
|
|
@@ -9844,19 +9847,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9844
9847
|
if (onlyIndex !== void 0) {
|
|
9845
9848
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
9846
9849
|
console.error(
|
|
9847
|
-
|
|
9850
|
+
chalk113.red(
|
|
9848
9851
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
9849
9852
|
)
|
|
9850
9853
|
);
|
|
9851
9854
|
process.exit(1);
|
|
9852
9855
|
}
|
|
9853
9856
|
console.log(
|
|
9854
|
-
|
|
9857
|
+
chalk113.gray(
|
|
9855
9858
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
9856
9859
|
)
|
|
9857
9860
|
);
|
|
9858
9861
|
} else {
|
|
9859
|
-
console.log(
|
|
9862
|
+
console.log(chalk113.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
9860
9863
|
}
|
|
9861
9864
|
for (const [i, source] of blocks.entries()) {
|
|
9862
9865
|
const idx = i + 1;
|
|
@@ -9864,7 +9867,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
9864
9867
|
const outPath = resolve9(outDir, `${stem}-${idx}.svg`);
|
|
9865
9868
|
const svg = await renderBlock(krokiUrl, source);
|
|
9866
9869
|
writeFileSync21(outPath, svg, "utf8");
|
|
9867
|
-
console.log(
|
|
9870
|
+
console.log(chalk113.green(` \u2192 ${outPath}`));
|
|
9868
9871
|
}
|
|
9869
9872
|
}
|
|
9870
9873
|
function extractMermaidBlocks(markdown) {
|
|
@@ -9880,18 +9883,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
9880
9883
|
if (options2.index !== void 0) {
|
|
9881
9884
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
9882
9885
|
console.error(
|
|
9883
|
-
|
|
9886
|
+
chalk114.red(`--index must be a positive integer (got ${options2.index})`)
|
|
9884
9887
|
);
|
|
9885
9888
|
process.exit(1);
|
|
9886
9889
|
}
|
|
9887
9890
|
if (!file) {
|
|
9888
|
-
console.error(
|
|
9891
|
+
console.error(chalk114.red("--index requires a file argument"));
|
|
9889
9892
|
process.exit(1);
|
|
9890
9893
|
}
|
|
9891
9894
|
}
|
|
9892
9895
|
const files = file ? [file] : readdirSync5(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
9893
9896
|
if (files.length === 0) {
|
|
9894
|
-
console.log(
|
|
9897
|
+
console.log(chalk114.gray("No markdown files found in current directory."));
|
|
9895
9898
|
return;
|
|
9896
9899
|
}
|
|
9897
9900
|
for (const f of files) {
|
|
@@ -9914,7 +9917,7 @@ function registerMermaid(program2) {
|
|
|
9914
9917
|
}
|
|
9915
9918
|
|
|
9916
9919
|
// src/commands/news/add/index.ts
|
|
9917
|
-
import
|
|
9920
|
+
import chalk115 from "chalk";
|
|
9918
9921
|
import enquirer8 from "enquirer";
|
|
9919
9922
|
async function add2(url) {
|
|
9920
9923
|
if (!url) {
|
|
@@ -9937,17 +9940,17 @@ async function add2(url) {
|
|
|
9937
9940
|
const news = config.news ?? {};
|
|
9938
9941
|
const feeds = news.feeds ?? [];
|
|
9939
9942
|
if (feeds.includes(url)) {
|
|
9940
|
-
console.log(
|
|
9943
|
+
console.log(chalk115.yellow("Feed already exists in config"));
|
|
9941
9944
|
return;
|
|
9942
9945
|
}
|
|
9943
9946
|
feeds.push(url);
|
|
9944
9947
|
config.news = { ...news, feeds };
|
|
9945
9948
|
saveGlobalConfig(config);
|
|
9946
|
-
console.log(
|
|
9949
|
+
console.log(chalk115.green(`Added feed: ${url}`));
|
|
9947
9950
|
}
|
|
9948
9951
|
|
|
9949
9952
|
// src/commands/news/web/handleRequest.ts
|
|
9950
|
-
import
|
|
9953
|
+
import chalk116 from "chalk";
|
|
9951
9954
|
|
|
9952
9955
|
// src/commands/news/web/shared.ts
|
|
9953
9956
|
import { decodeHTML } from "entities";
|
|
@@ -10083,17 +10086,17 @@ function prefetch() {
|
|
|
10083
10086
|
const config = loadConfig();
|
|
10084
10087
|
const total = config.news.feeds.length;
|
|
10085
10088
|
if (total === 0) return;
|
|
10086
|
-
process.stdout.write(
|
|
10089
|
+
process.stdout.write(chalk116.dim(`Fetching ${total} feed(s)\u2026 `));
|
|
10087
10090
|
prefetchPromise = fetchFeeds(config.news.feeds, (done2, t) => {
|
|
10088
10091
|
const width = 20;
|
|
10089
10092
|
const filled = Math.round(done2 / t * width);
|
|
10090
10093
|
const bar = `${"\u2588".repeat(filled)}${"\u2591".repeat(width - filled)}`;
|
|
10091
10094
|
process.stdout.write(
|
|
10092
|
-
`\r${
|
|
10095
|
+
`\r${chalk116.dim(`Fetching feeds ${bar} ${done2}/${t}`)}`
|
|
10093
10096
|
);
|
|
10094
10097
|
}).then((items2) => {
|
|
10095
10098
|
process.stdout.write(
|
|
10096
|
-
`\r${
|
|
10099
|
+
`\r${chalk116.green(`Fetched ${items2.length} items from ${total} feed(s)`)}
|
|
10097
10100
|
`
|
|
10098
10101
|
);
|
|
10099
10102
|
cachedItems = items2;
|
|
@@ -10138,7 +10141,7 @@ function registerNews(program2) {
|
|
|
10138
10141
|
}
|
|
10139
10142
|
|
|
10140
10143
|
// src/commands/prompts/printPromptsTable.ts
|
|
10141
|
-
import
|
|
10144
|
+
import chalk117 from "chalk";
|
|
10142
10145
|
function truncate(str, max) {
|
|
10143
10146
|
if (str.length <= max) return str;
|
|
10144
10147
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -10156,14 +10159,14 @@ function printPromptsTable(rows) {
|
|
|
10156
10159
|
"Command".padEnd(commandWidth),
|
|
10157
10160
|
"Repos"
|
|
10158
10161
|
].join(" ");
|
|
10159
|
-
console.log(
|
|
10160
|
-
console.log(
|
|
10162
|
+
console.log(chalk117.dim(header));
|
|
10163
|
+
console.log(chalk117.dim("-".repeat(header.length)));
|
|
10161
10164
|
for (const row of rows) {
|
|
10162
10165
|
const count6 = String(row.count).padStart(countWidth);
|
|
10163
10166
|
const tool = row.tool.padEnd(toolWidth);
|
|
10164
10167
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
10165
10168
|
console.log(
|
|
10166
|
-
`${
|
|
10169
|
+
`${chalk117.yellow(count6)} ${tool} ${command} ${chalk117.dim(row.repos)}`
|
|
10167
10170
|
);
|
|
10168
10171
|
}
|
|
10169
10172
|
}
|
|
@@ -10630,20 +10633,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
10630
10633
|
}
|
|
10631
10634
|
|
|
10632
10635
|
// src/commands/prs/listComments/printComments.ts
|
|
10633
|
-
import
|
|
10636
|
+
import chalk118 from "chalk";
|
|
10634
10637
|
function formatForHuman(comment3) {
|
|
10635
10638
|
if (comment3.type === "review") {
|
|
10636
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
10639
|
+
const stateColor = comment3.state === "APPROVED" ? chalk118.green : comment3.state === "CHANGES_REQUESTED" ? chalk118.red : chalk118.yellow;
|
|
10637
10640
|
return [
|
|
10638
|
-
`${
|
|
10641
|
+
`${chalk118.cyan("Review")} by ${chalk118.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
10639
10642
|
comment3.body,
|
|
10640
10643
|
""
|
|
10641
10644
|
].join("\n");
|
|
10642
10645
|
}
|
|
10643
10646
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
10644
10647
|
return [
|
|
10645
|
-
`${
|
|
10646
|
-
|
|
10648
|
+
`${chalk118.cyan("Line comment")} by ${chalk118.bold(comment3.user)} on ${chalk118.dim(`${comment3.path}${location}`)}`,
|
|
10649
|
+
chalk118.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
10647
10650
|
comment3.body,
|
|
10648
10651
|
""
|
|
10649
10652
|
].join("\n");
|
|
@@ -10733,13 +10736,13 @@ import { execSync as execSync35 } from "child_process";
|
|
|
10733
10736
|
import enquirer9 from "enquirer";
|
|
10734
10737
|
|
|
10735
10738
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
10736
|
-
import
|
|
10739
|
+
import chalk119 from "chalk";
|
|
10737
10740
|
var STATUS_MAP = {
|
|
10738
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
10739
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
10741
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk119.magenta("merged"), date: pr.mergedAt } : null,
|
|
10742
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk119.red("closed"), date: pr.closedAt } : null
|
|
10740
10743
|
};
|
|
10741
10744
|
function defaultStatus(pr) {
|
|
10742
|
-
return { label:
|
|
10745
|
+
return { label: chalk119.green("opened"), date: pr.createdAt };
|
|
10743
10746
|
}
|
|
10744
10747
|
function getStatus2(pr) {
|
|
10745
10748
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -10748,11 +10751,11 @@ function formatDate(dateStr) {
|
|
|
10748
10751
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
10749
10752
|
}
|
|
10750
10753
|
function formatPrHeader(pr, status2) {
|
|
10751
|
-
return `${
|
|
10754
|
+
return `${chalk119.cyan(`#${pr.number}`)} ${pr.title} ${chalk119.dim(`(${pr.author.login},`)} ${status2.label} ${chalk119.dim(`${formatDate(status2.date)})`)}`;
|
|
10752
10755
|
}
|
|
10753
10756
|
function logPrDetails(pr) {
|
|
10754
10757
|
console.log(
|
|
10755
|
-
|
|
10758
|
+
chalk119.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
10756
10759
|
);
|
|
10757
10760
|
console.log();
|
|
10758
10761
|
}
|
|
@@ -10940,10 +10943,10 @@ function registerPrs(program2) {
|
|
|
10940
10943
|
}
|
|
10941
10944
|
|
|
10942
10945
|
// src/commands/ravendb/ravendbAuth.ts
|
|
10943
|
-
import
|
|
10946
|
+
import chalk125 from "chalk";
|
|
10944
10947
|
|
|
10945
10948
|
// src/shared/createConnectionAuth.ts
|
|
10946
|
-
import
|
|
10949
|
+
import chalk120 from "chalk";
|
|
10947
10950
|
function listConnections(connections, format2) {
|
|
10948
10951
|
if (connections.length === 0) {
|
|
10949
10952
|
console.log("No connections configured.");
|
|
@@ -10956,7 +10959,7 @@ function listConnections(connections, format2) {
|
|
|
10956
10959
|
function removeConnection(connections, name, save) {
|
|
10957
10960
|
const filtered = connections.filter((c) => c.name !== name);
|
|
10958
10961
|
if (filtered.length === connections.length) {
|
|
10959
|
-
console.error(
|
|
10962
|
+
console.error(chalk120.red(`Connection "${name}" not found.`));
|
|
10960
10963
|
process.exit(1);
|
|
10961
10964
|
}
|
|
10962
10965
|
save(filtered);
|
|
@@ -11002,15 +11005,15 @@ function saveConnections(connections) {
|
|
|
11002
11005
|
}
|
|
11003
11006
|
|
|
11004
11007
|
// src/commands/ravendb/promptConnection.ts
|
|
11005
|
-
import
|
|
11008
|
+
import chalk123 from "chalk";
|
|
11006
11009
|
|
|
11007
11010
|
// src/commands/ravendb/selectOpSecret.ts
|
|
11008
|
-
import
|
|
11011
|
+
import chalk122 from "chalk";
|
|
11009
11012
|
import Enquirer2 from "enquirer";
|
|
11010
11013
|
|
|
11011
11014
|
// src/commands/ravendb/searchItems.ts
|
|
11012
11015
|
import { execSync as execSync37 } from "child_process";
|
|
11013
|
-
import
|
|
11016
|
+
import chalk121 from "chalk";
|
|
11014
11017
|
function opExec(args) {
|
|
11015
11018
|
return execSync37(`op ${args}`, {
|
|
11016
11019
|
encoding: "utf-8",
|
|
@@ -11023,7 +11026,7 @@ function searchItems(search2) {
|
|
|
11023
11026
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
11024
11027
|
} catch {
|
|
11025
11028
|
console.error(
|
|
11026
|
-
|
|
11029
|
+
chalk121.red(
|
|
11027
11030
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
11028
11031
|
)
|
|
11029
11032
|
);
|
|
@@ -11037,7 +11040,7 @@ function getItemFields(itemId) {
|
|
|
11037
11040
|
const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
|
|
11038
11041
|
return item.fields.filter((f) => f.reference && f.label);
|
|
11039
11042
|
} catch {
|
|
11040
|
-
console.error(
|
|
11043
|
+
console.error(chalk121.red("Failed to get item details from 1Password."));
|
|
11041
11044
|
process.exit(1);
|
|
11042
11045
|
}
|
|
11043
11046
|
}
|
|
@@ -11056,7 +11059,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11056
11059
|
}).run();
|
|
11057
11060
|
const items2 = searchItems(search2);
|
|
11058
11061
|
if (items2.length === 0) {
|
|
11059
|
-
console.error(
|
|
11062
|
+
console.error(chalk122.red(`No items found matching "${search2}".`));
|
|
11060
11063
|
process.exit(1);
|
|
11061
11064
|
}
|
|
11062
11065
|
const itemId = await selectOne(
|
|
@@ -11065,7 +11068,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11065
11068
|
);
|
|
11066
11069
|
const fields = getItemFields(itemId);
|
|
11067
11070
|
if (fields.length === 0) {
|
|
11068
|
-
console.error(
|
|
11071
|
+
console.error(chalk122.red("No fields with references found on this item."));
|
|
11069
11072
|
process.exit(1);
|
|
11070
11073
|
}
|
|
11071
11074
|
const ref = await selectOne(
|
|
@@ -11079,7 +11082,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
11079
11082
|
async function promptConnection(existingNames) {
|
|
11080
11083
|
const name = await promptInput("name", "Connection name:");
|
|
11081
11084
|
if (existingNames.includes(name)) {
|
|
11082
|
-
console.error(
|
|
11085
|
+
console.error(chalk123.red(`Connection "${name}" already exists.`));
|
|
11083
11086
|
process.exit(1);
|
|
11084
11087
|
}
|
|
11085
11088
|
const url = await promptInput(
|
|
@@ -11088,22 +11091,22 @@ async function promptConnection(existingNames) {
|
|
|
11088
11091
|
);
|
|
11089
11092
|
const database = await promptInput("database", "Database name:");
|
|
11090
11093
|
if (!name || !url || !database) {
|
|
11091
|
-
console.error(
|
|
11094
|
+
console.error(chalk123.red("All fields are required."));
|
|
11092
11095
|
process.exit(1);
|
|
11093
11096
|
}
|
|
11094
11097
|
const apiKeyRef = await selectOpSecret();
|
|
11095
|
-
console.log(
|
|
11098
|
+
console.log(chalk123.dim(`Using: ${apiKeyRef}`));
|
|
11096
11099
|
return { name, url, database, apiKeyRef };
|
|
11097
11100
|
}
|
|
11098
11101
|
|
|
11099
11102
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
11100
|
-
import
|
|
11103
|
+
import chalk124 from "chalk";
|
|
11101
11104
|
function ravendbSetConnection(name) {
|
|
11102
11105
|
const raw = loadGlobalConfigRaw();
|
|
11103
11106
|
const ravendb = raw.ravendb ?? {};
|
|
11104
11107
|
const connections = ravendb.connections ?? [];
|
|
11105
11108
|
if (!connections.some((c) => c.name === name)) {
|
|
11106
|
-
console.error(
|
|
11109
|
+
console.error(chalk124.red(`Connection "${name}" not found.`));
|
|
11107
11110
|
console.error(
|
|
11108
11111
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
11109
11112
|
);
|
|
@@ -11119,16 +11122,16 @@ function ravendbSetConnection(name) {
|
|
|
11119
11122
|
var ravendbAuth = createConnectionAuth({
|
|
11120
11123
|
load: loadConnections,
|
|
11121
11124
|
save: saveConnections,
|
|
11122
|
-
format: (c) => `${
|
|
11125
|
+
format: (c) => `${chalk125.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
11123
11126
|
promptNew: promptConnection,
|
|
11124
11127
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
11125
11128
|
});
|
|
11126
11129
|
|
|
11127
11130
|
// src/commands/ravendb/ravendbCollections.ts
|
|
11128
|
-
import
|
|
11131
|
+
import chalk129 from "chalk";
|
|
11129
11132
|
|
|
11130
11133
|
// src/commands/ravendb/ravenFetch.ts
|
|
11131
|
-
import
|
|
11134
|
+
import chalk127 from "chalk";
|
|
11132
11135
|
|
|
11133
11136
|
// src/commands/ravendb/getAccessToken.ts
|
|
11134
11137
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -11165,10 +11168,10 @@ ${errorText}`
|
|
|
11165
11168
|
|
|
11166
11169
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
11167
11170
|
import { execSync as execSync38 } from "child_process";
|
|
11168
|
-
import
|
|
11171
|
+
import chalk126 from "chalk";
|
|
11169
11172
|
function resolveOpSecret(reference) {
|
|
11170
11173
|
if (!reference.startsWith("op://")) {
|
|
11171
|
-
console.error(
|
|
11174
|
+
console.error(chalk126.red(`Invalid secret reference: must start with op://`));
|
|
11172
11175
|
process.exit(1);
|
|
11173
11176
|
}
|
|
11174
11177
|
try {
|
|
@@ -11178,7 +11181,7 @@ function resolveOpSecret(reference) {
|
|
|
11178
11181
|
}).trim();
|
|
11179
11182
|
} catch {
|
|
11180
11183
|
console.error(
|
|
11181
|
-
|
|
11184
|
+
chalk126.red(
|
|
11182
11185
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
11183
11186
|
)
|
|
11184
11187
|
);
|
|
@@ -11205,7 +11208,7 @@ async function ravenFetch(connection, path53) {
|
|
|
11205
11208
|
if (!response.ok) {
|
|
11206
11209
|
const body = await response.text();
|
|
11207
11210
|
console.error(
|
|
11208
|
-
|
|
11211
|
+
chalk127.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
11209
11212
|
);
|
|
11210
11213
|
console.error(body.substring(0, 500));
|
|
11211
11214
|
process.exit(1);
|
|
@@ -11214,7 +11217,7 @@ async function ravenFetch(connection, path53) {
|
|
|
11214
11217
|
}
|
|
11215
11218
|
|
|
11216
11219
|
// src/commands/ravendb/resolveConnection.ts
|
|
11217
|
-
import
|
|
11220
|
+
import chalk128 from "chalk";
|
|
11218
11221
|
function loadRavendb() {
|
|
11219
11222
|
const raw = loadGlobalConfigRaw();
|
|
11220
11223
|
const ravendb = raw.ravendb;
|
|
@@ -11228,7 +11231,7 @@ function resolveConnection(name) {
|
|
|
11228
11231
|
const connectionName = name ?? defaultConnection;
|
|
11229
11232
|
if (!connectionName) {
|
|
11230
11233
|
console.error(
|
|
11231
|
-
|
|
11234
|
+
chalk128.red(
|
|
11232
11235
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
11233
11236
|
)
|
|
11234
11237
|
);
|
|
@@ -11236,7 +11239,7 @@ function resolveConnection(name) {
|
|
|
11236
11239
|
}
|
|
11237
11240
|
const connection = connections.find((c) => c.name === connectionName);
|
|
11238
11241
|
if (!connection) {
|
|
11239
|
-
console.error(
|
|
11242
|
+
console.error(chalk128.red(`Connection "${connectionName}" not found.`));
|
|
11240
11243
|
console.error(
|
|
11241
11244
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
11242
11245
|
);
|
|
@@ -11267,15 +11270,15 @@ async function ravendbCollections(connectionName) {
|
|
|
11267
11270
|
return;
|
|
11268
11271
|
}
|
|
11269
11272
|
for (const c of collections) {
|
|
11270
|
-
console.log(`${
|
|
11273
|
+
console.log(`${chalk129.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
11271
11274
|
}
|
|
11272
11275
|
}
|
|
11273
11276
|
|
|
11274
11277
|
// src/commands/ravendb/ravendbQuery.ts
|
|
11275
|
-
import
|
|
11278
|
+
import chalk131 from "chalk";
|
|
11276
11279
|
|
|
11277
11280
|
// src/commands/ravendb/fetchAllPages.ts
|
|
11278
|
-
import
|
|
11281
|
+
import chalk130 from "chalk";
|
|
11279
11282
|
|
|
11280
11283
|
// src/commands/ravendb/buildQueryPath.ts
|
|
11281
11284
|
function buildQueryPath(opts) {
|
|
@@ -11313,7 +11316,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11313
11316
|
allResults.push(...results);
|
|
11314
11317
|
start3 += results.length;
|
|
11315
11318
|
process.stderr.write(
|
|
11316
|
-
`\r${
|
|
11319
|
+
`\r${chalk130.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
11317
11320
|
);
|
|
11318
11321
|
if (start3 >= totalResults) break;
|
|
11319
11322
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -11328,7 +11331,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
11328
11331
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
11329
11332
|
const resolved = resolveArgs(connectionName, collection);
|
|
11330
11333
|
if (!resolved.collection && !options2.query) {
|
|
11331
|
-
console.error(
|
|
11334
|
+
console.error(chalk131.red("Provide a collection name or --query filter."));
|
|
11332
11335
|
process.exit(1);
|
|
11333
11336
|
}
|
|
11334
11337
|
const { collection: col } = resolved;
|
|
@@ -11366,7 +11369,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
11366
11369
|
import * as path26 from "path";
|
|
11367
11370
|
|
|
11368
11371
|
// src/commands/refactor/logViolations.ts
|
|
11369
|
-
import
|
|
11372
|
+
import chalk132 from "chalk";
|
|
11370
11373
|
var DEFAULT_MAX_LINES = 100;
|
|
11371
11374
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
11372
11375
|
if (violations.length === 0) {
|
|
@@ -11375,43 +11378,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
11375
11378
|
}
|
|
11376
11379
|
return;
|
|
11377
11380
|
}
|
|
11378
|
-
console.error(
|
|
11381
|
+
console.error(chalk132.red(`
|
|
11379
11382
|
Refactor check failed:
|
|
11380
11383
|
`));
|
|
11381
|
-
console.error(
|
|
11384
|
+
console.error(chalk132.red(` The following files exceed ${maxLines} lines:
|
|
11382
11385
|
`));
|
|
11383
11386
|
for (const violation of violations) {
|
|
11384
|
-
console.error(
|
|
11387
|
+
console.error(chalk132.red(` ${violation.file} (${violation.lines} lines)`));
|
|
11385
11388
|
}
|
|
11386
11389
|
console.error(
|
|
11387
|
-
|
|
11390
|
+
chalk132.yellow(
|
|
11388
11391
|
`
|
|
11389
11392
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
11390
11393
|
way to refactor it, ignore it with:
|
|
11391
11394
|
`
|
|
11392
11395
|
)
|
|
11393
11396
|
);
|
|
11394
|
-
console.error(
|
|
11397
|
+
console.error(chalk132.gray(` assist refactor ignore <file>
|
|
11395
11398
|
`));
|
|
11396
11399
|
if (process.env.CLAUDECODE) {
|
|
11397
|
-
console.error(
|
|
11400
|
+
console.error(chalk132.cyan(`
|
|
11398
11401
|
## Extracting Code to New Files
|
|
11399
11402
|
`));
|
|
11400
11403
|
console.error(
|
|
11401
|
-
|
|
11404
|
+
chalk132.cyan(
|
|
11402
11405
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
11403
11406
|
`
|
|
11404
11407
|
)
|
|
11405
11408
|
);
|
|
11406
11409
|
console.error(
|
|
11407
|
-
|
|
11410
|
+
chalk132.cyan(
|
|
11408
11411
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
11409
11412
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
11410
11413
|
`
|
|
11411
11414
|
)
|
|
11412
11415
|
);
|
|
11413
11416
|
console.error(
|
|
11414
|
-
|
|
11417
|
+
chalk132.cyan(
|
|
11415
11418
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
11416
11419
|
domains, move it to a common/shared folder.
|
|
11417
11420
|
`
|
|
@@ -11567,7 +11570,7 @@ async function check(pattern2, options2) {
|
|
|
11567
11570
|
|
|
11568
11571
|
// src/commands/refactor/extract/index.ts
|
|
11569
11572
|
import path33 from "path";
|
|
11570
|
-
import
|
|
11573
|
+
import chalk135 from "chalk";
|
|
11571
11574
|
|
|
11572
11575
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
11573
11576
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -12142,23 +12145,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
12142
12145
|
|
|
12143
12146
|
// src/commands/refactor/extract/displayPlan.ts
|
|
12144
12147
|
import path30 from "path";
|
|
12145
|
-
import
|
|
12148
|
+
import chalk133 from "chalk";
|
|
12146
12149
|
function section(title) {
|
|
12147
12150
|
return `
|
|
12148
|
-
${
|
|
12151
|
+
${chalk133.cyan(title)}`;
|
|
12149
12152
|
}
|
|
12150
12153
|
function displayImporters(plan2, cwd) {
|
|
12151
12154
|
if (plan2.importersToUpdate.length === 0) return;
|
|
12152
12155
|
console.log(section("Update importers:"));
|
|
12153
12156
|
for (const imp of plan2.importersToUpdate) {
|
|
12154
12157
|
const rel = path30.relative(cwd, imp.file.getFilePath());
|
|
12155
|
-
console.log(` ${
|
|
12158
|
+
console.log(` ${chalk133.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
12156
12159
|
}
|
|
12157
12160
|
}
|
|
12158
12161
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
12159
|
-
console.log(
|
|
12162
|
+
console.log(chalk133.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
12160
12163
|
`));
|
|
12161
|
-
console.log(` ${
|
|
12164
|
+
console.log(` ${chalk133.cyan("Functions to move:")}`);
|
|
12162
12165
|
for (const name of plan2.extractedNames) {
|
|
12163
12166
|
console.log(` ${name}`);
|
|
12164
12167
|
}
|
|
@@ -12192,7 +12195,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
12192
12195
|
|
|
12193
12196
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
12194
12197
|
import path32 from "path";
|
|
12195
|
-
import
|
|
12198
|
+
import chalk134 from "chalk";
|
|
12196
12199
|
import { Project as Project3 } from "ts-morph";
|
|
12197
12200
|
|
|
12198
12201
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -12252,7 +12255,7 @@ function loadProjectFile(file) {
|
|
|
12252
12255
|
});
|
|
12253
12256
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
12254
12257
|
if (!sourceFile) {
|
|
12255
|
-
console.log(
|
|
12258
|
+
console.log(chalk134.red(`File not found in project: ${file}`));
|
|
12256
12259
|
process.exit(1);
|
|
12257
12260
|
}
|
|
12258
12261
|
return { project, sourceFile };
|
|
@@ -12275,19 +12278,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
12275
12278
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
12276
12279
|
if (options2.apply) {
|
|
12277
12280
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
12278
|
-
console.log(
|
|
12281
|
+
console.log(chalk135.green("\nExtraction complete"));
|
|
12279
12282
|
} else {
|
|
12280
|
-
console.log(
|
|
12283
|
+
console.log(chalk135.dim("\nDry run. Use --apply to execute."));
|
|
12281
12284
|
}
|
|
12282
12285
|
}
|
|
12283
12286
|
|
|
12284
12287
|
// src/commands/refactor/ignore.ts
|
|
12285
12288
|
import fs19 from "fs";
|
|
12286
|
-
import
|
|
12289
|
+
import chalk136 from "chalk";
|
|
12287
12290
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
12288
12291
|
function ignore(file) {
|
|
12289
12292
|
if (!fs19.existsSync(file)) {
|
|
12290
|
-
console.error(
|
|
12293
|
+
console.error(chalk136.red(`Error: File does not exist: ${file}`));
|
|
12291
12294
|
process.exit(1);
|
|
12292
12295
|
}
|
|
12293
12296
|
const content = fs19.readFileSync(file, "utf-8");
|
|
@@ -12303,7 +12306,7 @@ function ignore(file) {
|
|
|
12303
12306
|
fs19.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
12304
12307
|
}
|
|
12305
12308
|
console.log(
|
|
12306
|
-
|
|
12309
|
+
chalk136.green(
|
|
12307
12310
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
12308
12311
|
)
|
|
12309
12312
|
);
|
|
@@ -12311,25 +12314,25 @@ function ignore(file) {
|
|
|
12311
12314
|
|
|
12312
12315
|
// src/commands/refactor/rename/index.ts
|
|
12313
12316
|
import path34 from "path";
|
|
12314
|
-
import
|
|
12317
|
+
import chalk137 from "chalk";
|
|
12315
12318
|
async function rename(source, destination, options2 = {}) {
|
|
12316
12319
|
const destPath = path34.resolve(destination);
|
|
12317
12320
|
const cwd = process.cwd();
|
|
12318
12321
|
const relSource = path34.relative(cwd, path34.resolve(source));
|
|
12319
12322
|
const relDest = path34.relative(cwd, destPath);
|
|
12320
12323
|
const { project, sourceFile } = loadProjectFile(source);
|
|
12321
|
-
console.log(
|
|
12324
|
+
console.log(chalk137.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
12322
12325
|
if (options2.apply) {
|
|
12323
12326
|
sourceFile.move(destPath);
|
|
12324
12327
|
await project.save();
|
|
12325
|
-
console.log(
|
|
12328
|
+
console.log(chalk137.green("Done"));
|
|
12326
12329
|
} else {
|
|
12327
|
-
console.log(
|
|
12330
|
+
console.log(chalk137.dim("Dry run. Use --apply to execute."));
|
|
12328
12331
|
}
|
|
12329
12332
|
}
|
|
12330
12333
|
|
|
12331
12334
|
// src/commands/refactor/renameSymbol/index.ts
|
|
12332
|
-
import
|
|
12335
|
+
import chalk138 from "chalk";
|
|
12333
12336
|
|
|
12334
12337
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
12335
12338
|
import { SyntaxKind as SyntaxKind14 } from "ts-morph";
|
|
@@ -12375,33 +12378,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
12375
12378
|
const { project, sourceFile } = loadProjectFile(file);
|
|
12376
12379
|
const symbol = findSymbol(sourceFile, oldName);
|
|
12377
12380
|
if (!symbol) {
|
|
12378
|
-
console.log(
|
|
12381
|
+
console.log(chalk138.red(`Symbol "${oldName}" not found in ${file}`));
|
|
12379
12382
|
process.exit(1);
|
|
12380
12383
|
}
|
|
12381
12384
|
const grouped = groupReferences(symbol, cwd);
|
|
12382
12385
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
12383
12386
|
console.log(
|
|
12384
|
-
|
|
12387
|
+
chalk138.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
12385
12388
|
`)
|
|
12386
12389
|
);
|
|
12387
12390
|
for (const [refFile, lines] of grouped) {
|
|
12388
12391
|
console.log(
|
|
12389
|
-
` ${
|
|
12392
|
+
` ${chalk138.dim(refFile)}: lines ${chalk138.cyan(lines.join(", "))}`
|
|
12390
12393
|
);
|
|
12391
12394
|
}
|
|
12392
12395
|
if (options2.apply) {
|
|
12393
12396
|
symbol.rename(newName);
|
|
12394
12397
|
await project.save();
|
|
12395
|
-
console.log(
|
|
12398
|
+
console.log(chalk138.green(`
|
|
12396
12399
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
12397
12400
|
} else {
|
|
12398
|
-
console.log(
|
|
12401
|
+
console.log(chalk138.dim("\nDry run. Use --apply to execute."));
|
|
12399
12402
|
}
|
|
12400
12403
|
}
|
|
12401
12404
|
|
|
12402
12405
|
// src/commands/refactor/restructure/index.ts
|
|
12403
12406
|
import path44 from "path";
|
|
12404
|
-
import
|
|
12407
|
+
import chalk141 from "chalk";
|
|
12405
12408
|
|
|
12406
12409
|
// src/commands/refactor/restructure/buildImportGraph/index.ts
|
|
12407
12410
|
import path36 from "path";
|
|
@@ -12644,50 +12647,50 @@ function computeRewrites(moves, edges, allProjectFiles) {
|
|
|
12644
12647
|
|
|
12645
12648
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
12646
12649
|
import path40 from "path";
|
|
12647
|
-
import
|
|
12650
|
+
import chalk139 from "chalk";
|
|
12648
12651
|
function relPath(filePath) {
|
|
12649
12652
|
return path40.relative(process.cwd(), filePath);
|
|
12650
12653
|
}
|
|
12651
12654
|
function displayMoves(plan2) {
|
|
12652
12655
|
if (plan2.moves.length === 0) return;
|
|
12653
|
-
console.log(
|
|
12656
|
+
console.log(chalk139.bold("\nFile moves:"));
|
|
12654
12657
|
for (const move of plan2.moves) {
|
|
12655
12658
|
console.log(
|
|
12656
|
-
` ${
|
|
12659
|
+
` ${chalk139.red(relPath(move.from))} \u2192 ${chalk139.green(relPath(move.to))}`
|
|
12657
12660
|
);
|
|
12658
|
-
console.log(
|
|
12661
|
+
console.log(chalk139.dim(` ${move.reason}`));
|
|
12659
12662
|
}
|
|
12660
12663
|
}
|
|
12661
12664
|
function displayRewrites(rewrites) {
|
|
12662
12665
|
if (rewrites.length === 0) return;
|
|
12663
12666
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
12664
|
-
console.log(
|
|
12667
|
+
console.log(chalk139.bold(`
|
|
12665
12668
|
Import rewrites (${affectedFiles.size} files):`));
|
|
12666
12669
|
for (const file of affectedFiles) {
|
|
12667
|
-
console.log(` ${
|
|
12670
|
+
console.log(` ${chalk139.cyan(relPath(file))}:`);
|
|
12668
12671
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
12669
12672
|
(r) => r.file === file
|
|
12670
12673
|
)) {
|
|
12671
12674
|
console.log(
|
|
12672
|
-
` ${
|
|
12675
|
+
` ${chalk139.red(`"${oldSpecifier}"`)} \u2192 ${chalk139.green(`"${newSpecifier}"`)}`
|
|
12673
12676
|
);
|
|
12674
12677
|
}
|
|
12675
12678
|
}
|
|
12676
12679
|
}
|
|
12677
12680
|
function displayPlan2(plan2) {
|
|
12678
12681
|
if (plan2.warnings.length > 0) {
|
|
12679
|
-
console.log(
|
|
12680
|
-
for (const w of plan2.warnings) console.log(
|
|
12682
|
+
console.log(chalk139.yellow("\nWarnings:"));
|
|
12683
|
+
for (const w of plan2.warnings) console.log(chalk139.yellow(` ${w}`));
|
|
12681
12684
|
}
|
|
12682
12685
|
if (plan2.newDirectories.length > 0) {
|
|
12683
|
-
console.log(
|
|
12686
|
+
console.log(chalk139.bold("\nNew directories:"));
|
|
12684
12687
|
for (const dir of plan2.newDirectories)
|
|
12685
|
-
console.log(
|
|
12688
|
+
console.log(chalk139.green(` ${dir}/`));
|
|
12686
12689
|
}
|
|
12687
12690
|
displayMoves(plan2);
|
|
12688
12691
|
displayRewrites(plan2.rewrites);
|
|
12689
12692
|
console.log(
|
|
12690
|
-
|
|
12693
|
+
chalk139.dim(
|
|
12691
12694
|
`
|
|
12692
12695
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
12693
12696
|
)
|
|
@@ -12697,18 +12700,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
12697
12700
|
// src/commands/refactor/restructure/executePlan.ts
|
|
12698
12701
|
import fs21 from "fs";
|
|
12699
12702
|
import path41 from "path";
|
|
12700
|
-
import
|
|
12703
|
+
import chalk140 from "chalk";
|
|
12701
12704
|
function executePlan(plan2) {
|
|
12702
12705
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
12703
12706
|
for (const [file, content] of updatedContents) {
|
|
12704
12707
|
fs21.writeFileSync(file, content, "utf-8");
|
|
12705
12708
|
console.log(
|
|
12706
|
-
|
|
12709
|
+
chalk140.cyan(` Rewrote imports in ${path41.relative(process.cwd(), file)}`)
|
|
12707
12710
|
);
|
|
12708
12711
|
}
|
|
12709
12712
|
for (const dir of plan2.newDirectories) {
|
|
12710
12713
|
fs21.mkdirSync(dir, { recursive: true });
|
|
12711
|
-
console.log(
|
|
12714
|
+
console.log(chalk140.green(` Created ${path41.relative(process.cwd(), dir)}/`));
|
|
12712
12715
|
}
|
|
12713
12716
|
for (const move of plan2.moves) {
|
|
12714
12717
|
const targetDir = path41.dirname(move.to);
|
|
@@ -12717,7 +12720,7 @@ function executePlan(plan2) {
|
|
|
12717
12720
|
}
|
|
12718
12721
|
fs21.renameSync(move.from, move.to);
|
|
12719
12722
|
console.log(
|
|
12720
|
-
|
|
12723
|
+
chalk140.white(
|
|
12721
12724
|
` Moved ${path41.relative(process.cwd(), move.from)} \u2192 ${path41.relative(process.cwd(), move.to)}`
|
|
12722
12725
|
)
|
|
12723
12726
|
);
|
|
@@ -12732,7 +12735,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
12732
12735
|
if (entries.length === 0) {
|
|
12733
12736
|
fs21.rmdirSync(dir);
|
|
12734
12737
|
console.log(
|
|
12735
|
-
|
|
12738
|
+
chalk140.dim(
|
|
12736
12739
|
` Removed empty directory ${path41.relative(process.cwd(), dir)}`
|
|
12737
12740
|
)
|
|
12738
12741
|
);
|
|
@@ -12865,22 +12868,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
12865
12868
|
const targetPattern = pattern2 ?? "src";
|
|
12866
12869
|
const files = findSourceFiles2(targetPattern);
|
|
12867
12870
|
if (files.length === 0) {
|
|
12868
|
-
console.log(
|
|
12871
|
+
console.log(chalk141.yellow("No files found matching pattern"));
|
|
12869
12872
|
return;
|
|
12870
12873
|
}
|
|
12871
12874
|
const tsConfigPath = path44.resolve("tsconfig.json");
|
|
12872
12875
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
12873
12876
|
if (plan2.moves.length === 0) {
|
|
12874
|
-
console.log(
|
|
12877
|
+
console.log(chalk141.green("No restructuring needed"));
|
|
12875
12878
|
return;
|
|
12876
12879
|
}
|
|
12877
12880
|
displayPlan2(plan2);
|
|
12878
12881
|
if (options2.apply) {
|
|
12879
|
-
console.log(
|
|
12882
|
+
console.log(chalk141.bold("\nApplying changes..."));
|
|
12880
12883
|
executePlan(plan2);
|
|
12881
|
-
console.log(
|
|
12884
|
+
console.log(chalk141.green("\nRestructuring complete"));
|
|
12882
12885
|
} else {
|
|
12883
|
-
console.log(
|
|
12886
|
+
console.log(chalk141.dim("\nDry run. Use --apply to execute."));
|
|
12884
12887
|
}
|
|
12885
12888
|
}
|
|
12886
12889
|
|
|
@@ -13385,18 +13388,18 @@ async function postAndMaybeSubmit(lineBound, markdown, options2) {
|
|
|
13385
13388
|
}
|
|
13386
13389
|
|
|
13387
13390
|
// src/commands/review/warnUnlocated.ts
|
|
13388
|
-
import
|
|
13391
|
+
import chalk142 from "chalk";
|
|
13389
13392
|
function warnUnlocated(unlocated) {
|
|
13390
13393
|
if (unlocated.length === 0) return;
|
|
13391
13394
|
console.warn(
|
|
13392
|
-
|
|
13395
|
+
chalk142.yellow(
|
|
13393
13396
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
13394
13397
|
)
|
|
13395
13398
|
);
|
|
13396
13399
|
for (const finding of unlocated) {
|
|
13397
|
-
const where = finding.location ||
|
|
13400
|
+
const where = finding.location || chalk142.dim("missing");
|
|
13398
13401
|
console.warn(
|
|
13399
|
-
` ${
|
|
13402
|
+
` ${chalk142.yellow("\xB7")} ${finding.title} ${chalk142.dim(`(${where})`)}`
|
|
13400
13403
|
);
|
|
13401
13404
|
}
|
|
13402
13405
|
}
|
|
@@ -14568,7 +14571,7 @@ function registerReview(program2) {
|
|
|
14568
14571
|
}
|
|
14569
14572
|
|
|
14570
14573
|
// src/commands/seq/seqAuth.ts
|
|
14571
|
-
import
|
|
14574
|
+
import chalk144 from "chalk";
|
|
14572
14575
|
|
|
14573
14576
|
// src/commands/seq/loadConnections.ts
|
|
14574
14577
|
function loadConnections2() {
|
|
@@ -14597,10 +14600,10 @@ function setDefaultConnection(name) {
|
|
|
14597
14600
|
}
|
|
14598
14601
|
|
|
14599
14602
|
// src/shared/assertUniqueName.ts
|
|
14600
|
-
import
|
|
14603
|
+
import chalk143 from "chalk";
|
|
14601
14604
|
function assertUniqueName(existingNames, name) {
|
|
14602
14605
|
if (existingNames.includes(name)) {
|
|
14603
|
-
console.error(
|
|
14606
|
+
console.error(chalk143.red(`Connection "${name}" already exists.`));
|
|
14604
14607
|
process.exit(1);
|
|
14605
14608
|
}
|
|
14606
14609
|
}
|
|
@@ -14618,16 +14621,16 @@ async function promptConnection2(existingNames) {
|
|
|
14618
14621
|
var seqAuth = createConnectionAuth({
|
|
14619
14622
|
load: loadConnections2,
|
|
14620
14623
|
save: saveConnections2,
|
|
14621
|
-
format: (c) => `${
|
|
14624
|
+
format: (c) => `${chalk144.bold(c.name)} ${c.url}`,
|
|
14622
14625
|
promptNew: promptConnection2,
|
|
14623
14626
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
14624
14627
|
});
|
|
14625
14628
|
|
|
14626
14629
|
// src/commands/seq/seqQuery.ts
|
|
14627
|
-
import
|
|
14630
|
+
import chalk148 from "chalk";
|
|
14628
14631
|
|
|
14629
14632
|
// src/commands/seq/fetchSeq.ts
|
|
14630
|
-
import
|
|
14633
|
+
import chalk145 from "chalk";
|
|
14631
14634
|
async function fetchSeq(conn, path53, params) {
|
|
14632
14635
|
const url = `${conn.url}${path53}?${params}`;
|
|
14633
14636
|
const response = await fetch(url, {
|
|
@@ -14638,7 +14641,7 @@ async function fetchSeq(conn, path53, params) {
|
|
|
14638
14641
|
});
|
|
14639
14642
|
if (!response.ok) {
|
|
14640
14643
|
const body = await response.text();
|
|
14641
|
-
console.error(
|
|
14644
|
+
console.error(chalk145.red(`Seq returned ${response.status}: ${body}`));
|
|
14642
14645
|
process.exit(1);
|
|
14643
14646
|
}
|
|
14644
14647
|
return response;
|
|
@@ -14693,23 +14696,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
14693
14696
|
}
|
|
14694
14697
|
|
|
14695
14698
|
// src/commands/seq/formatEvent.ts
|
|
14696
|
-
import
|
|
14699
|
+
import chalk146 from "chalk";
|
|
14697
14700
|
function levelColor(level) {
|
|
14698
14701
|
switch (level) {
|
|
14699
14702
|
case "Fatal":
|
|
14700
|
-
return
|
|
14703
|
+
return chalk146.bgRed.white;
|
|
14701
14704
|
case "Error":
|
|
14702
|
-
return
|
|
14705
|
+
return chalk146.red;
|
|
14703
14706
|
case "Warning":
|
|
14704
|
-
return
|
|
14707
|
+
return chalk146.yellow;
|
|
14705
14708
|
case "Information":
|
|
14706
|
-
return
|
|
14709
|
+
return chalk146.cyan;
|
|
14707
14710
|
case "Debug":
|
|
14708
|
-
return
|
|
14711
|
+
return chalk146.gray;
|
|
14709
14712
|
case "Verbose":
|
|
14710
|
-
return
|
|
14713
|
+
return chalk146.dim;
|
|
14711
14714
|
default:
|
|
14712
|
-
return
|
|
14715
|
+
return chalk146.white;
|
|
14713
14716
|
}
|
|
14714
14717
|
}
|
|
14715
14718
|
function levelAbbrev(level) {
|
|
@@ -14750,12 +14753,12 @@ function formatTimestamp(iso) {
|
|
|
14750
14753
|
function formatEvent(event) {
|
|
14751
14754
|
const color = levelColor(event.Level);
|
|
14752
14755
|
const abbrev = levelAbbrev(event.Level);
|
|
14753
|
-
const ts8 =
|
|
14756
|
+
const ts8 = chalk146.dim(formatTimestamp(event.Timestamp));
|
|
14754
14757
|
const msg = renderMessage(event);
|
|
14755
14758
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
14756
14759
|
if (event.Exception) {
|
|
14757
14760
|
for (const line of event.Exception.split("\n")) {
|
|
14758
|
-
lines.push(
|
|
14761
|
+
lines.push(chalk146.red(` ${line}`));
|
|
14759
14762
|
}
|
|
14760
14763
|
}
|
|
14761
14764
|
return lines.join("\n");
|
|
@@ -14788,11 +14791,11 @@ function rejectTimestampFilter(filter) {
|
|
|
14788
14791
|
}
|
|
14789
14792
|
|
|
14790
14793
|
// src/shared/resolveNamedConnection.ts
|
|
14791
|
-
import
|
|
14794
|
+
import chalk147 from "chalk";
|
|
14792
14795
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
14793
14796
|
if (connections.length === 0) {
|
|
14794
14797
|
console.error(
|
|
14795
|
-
|
|
14798
|
+
chalk147.red(
|
|
14796
14799
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
14797
14800
|
)
|
|
14798
14801
|
);
|
|
@@ -14801,7 +14804,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
14801
14804
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
14802
14805
|
const connection = connections.find((c) => c.name === target);
|
|
14803
14806
|
if (!connection) {
|
|
14804
|
-
console.error(
|
|
14807
|
+
console.error(chalk147.red(`${kind} connection "${target}" not found.`));
|
|
14805
14808
|
process.exit(1);
|
|
14806
14809
|
}
|
|
14807
14810
|
return connection;
|
|
@@ -14830,7 +14833,7 @@ async function seqQuery(filter, options2) {
|
|
|
14830
14833
|
new URLSearchParams({ filter, count: String(count6) })
|
|
14831
14834
|
);
|
|
14832
14835
|
if (events.length === 0) {
|
|
14833
|
-
console.log(
|
|
14836
|
+
console.log(chalk148.yellow("No events found."));
|
|
14834
14837
|
return;
|
|
14835
14838
|
}
|
|
14836
14839
|
if (options2.json) {
|
|
@@ -14841,11 +14844,11 @@ async function seqQuery(filter, options2) {
|
|
|
14841
14844
|
for (const event of chronological) {
|
|
14842
14845
|
console.log(formatEvent(event));
|
|
14843
14846
|
}
|
|
14844
|
-
console.log(
|
|
14847
|
+
console.log(chalk148.dim(`
|
|
14845
14848
|
${events.length} events`));
|
|
14846
14849
|
if (events.length >= count6) {
|
|
14847
14850
|
console.log(
|
|
14848
|
-
|
|
14851
|
+
chalk148.yellow(
|
|
14849
14852
|
`Results limited to ${count6}. Use --count to retrieve more.`
|
|
14850
14853
|
)
|
|
14851
14854
|
);
|
|
@@ -14853,10 +14856,10 @@ ${events.length} events`));
|
|
|
14853
14856
|
}
|
|
14854
14857
|
|
|
14855
14858
|
// src/shared/setNamedDefaultConnection.ts
|
|
14856
|
-
import
|
|
14859
|
+
import chalk149 from "chalk";
|
|
14857
14860
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
14858
14861
|
if (!connections.find((c) => c.name === name)) {
|
|
14859
|
-
console.error(
|
|
14862
|
+
console.error(chalk149.red(`Connection "${name}" not found.`));
|
|
14860
14863
|
process.exit(1);
|
|
14861
14864
|
}
|
|
14862
14865
|
setDefault(name);
|
|
@@ -14904,7 +14907,7 @@ function registerSignal(program2) {
|
|
|
14904
14907
|
}
|
|
14905
14908
|
|
|
14906
14909
|
// src/commands/sql/sqlAuth.ts
|
|
14907
|
-
import
|
|
14910
|
+
import chalk151 from "chalk";
|
|
14908
14911
|
|
|
14909
14912
|
// src/commands/sql/loadConnections.ts
|
|
14910
14913
|
function loadConnections3() {
|
|
@@ -14933,7 +14936,7 @@ function setDefaultConnection2(name) {
|
|
|
14933
14936
|
}
|
|
14934
14937
|
|
|
14935
14938
|
// src/commands/sql/promptConnection.ts
|
|
14936
|
-
import
|
|
14939
|
+
import chalk150 from "chalk";
|
|
14937
14940
|
async function promptConnection3(existingNames) {
|
|
14938
14941
|
const name = await promptInput("name", "Connection name:", "default");
|
|
14939
14942
|
assertUniqueName(existingNames, name);
|
|
@@ -14941,7 +14944,7 @@ async function promptConnection3(existingNames) {
|
|
|
14941
14944
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
14942
14945
|
const port = Number.parseInt(portStr, 10);
|
|
14943
14946
|
if (!Number.isFinite(port)) {
|
|
14944
|
-
console.error(
|
|
14947
|
+
console.error(chalk150.red(`Invalid port "${portStr}".`));
|
|
14945
14948
|
process.exit(1);
|
|
14946
14949
|
}
|
|
14947
14950
|
const user = await promptInput("user", "User:");
|
|
@@ -14954,13 +14957,13 @@ async function promptConnection3(existingNames) {
|
|
|
14954
14957
|
var sqlAuth = createConnectionAuth({
|
|
14955
14958
|
load: loadConnections3,
|
|
14956
14959
|
save: saveConnections3,
|
|
14957
|
-
format: (c) => `${
|
|
14960
|
+
format: (c) => `${chalk151.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
14958
14961
|
promptNew: promptConnection3,
|
|
14959
14962
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
14960
14963
|
});
|
|
14961
14964
|
|
|
14962
14965
|
// src/commands/sql/printTable.ts
|
|
14963
|
-
import
|
|
14966
|
+
import chalk152 from "chalk";
|
|
14964
14967
|
function formatCell(value) {
|
|
14965
14968
|
if (value === null || value === void 0) return "";
|
|
14966
14969
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -14969,7 +14972,7 @@ function formatCell(value) {
|
|
|
14969
14972
|
}
|
|
14970
14973
|
function printTable(rows) {
|
|
14971
14974
|
if (rows.length === 0) {
|
|
14972
|
-
console.log(
|
|
14975
|
+
console.log(chalk152.yellow("(no rows)"));
|
|
14973
14976
|
return;
|
|
14974
14977
|
}
|
|
14975
14978
|
const columns = Object.keys(rows[0]);
|
|
@@ -14977,13 +14980,13 @@ function printTable(rows) {
|
|
|
14977
14980
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
14978
14981
|
);
|
|
14979
14982
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
14980
|
-
console.log(
|
|
14981
|
-
console.log(
|
|
14983
|
+
console.log(chalk152.dim(header));
|
|
14984
|
+
console.log(chalk152.dim("-".repeat(header.length)));
|
|
14982
14985
|
for (const row of rows) {
|
|
14983
14986
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
14984
14987
|
console.log(line);
|
|
14985
14988
|
}
|
|
14986
|
-
console.log(
|
|
14989
|
+
console.log(chalk152.dim(`
|
|
14987
14990
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
14988
14991
|
}
|
|
14989
14992
|
|
|
@@ -15043,7 +15046,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
15043
15046
|
}
|
|
15044
15047
|
|
|
15045
15048
|
// src/commands/sql/sqlMutate.ts
|
|
15046
|
-
import
|
|
15049
|
+
import chalk153 from "chalk";
|
|
15047
15050
|
|
|
15048
15051
|
// src/commands/sql/isMutation.ts
|
|
15049
15052
|
var MUTATION_KEYWORDS = [
|
|
@@ -15077,7 +15080,7 @@ function isMutation(sql4) {
|
|
|
15077
15080
|
async function sqlMutate(query, connectionName) {
|
|
15078
15081
|
if (!isMutation(query)) {
|
|
15079
15082
|
console.error(
|
|
15080
|
-
|
|
15083
|
+
chalk153.red(
|
|
15081
15084
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
15082
15085
|
)
|
|
15083
15086
|
);
|
|
@@ -15087,18 +15090,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
15087
15090
|
const pool = await sqlConnect(conn);
|
|
15088
15091
|
try {
|
|
15089
15092
|
const result = await pool.request().query(query);
|
|
15090
|
-
console.log(
|
|
15093
|
+
console.log(chalk153.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
15091
15094
|
} finally {
|
|
15092
15095
|
await pool.close();
|
|
15093
15096
|
}
|
|
15094
15097
|
}
|
|
15095
15098
|
|
|
15096
15099
|
// src/commands/sql/sqlQuery.ts
|
|
15097
|
-
import
|
|
15100
|
+
import chalk154 from "chalk";
|
|
15098
15101
|
async function sqlQuery(query, connectionName) {
|
|
15099
15102
|
if (isMutation(query)) {
|
|
15100
15103
|
console.error(
|
|
15101
|
-
|
|
15104
|
+
chalk154.red(
|
|
15102
15105
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
15103
15106
|
)
|
|
15104
15107
|
);
|
|
@@ -15113,7 +15116,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
15113
15116
|
printTable(rows);
|
|
15114
15117
|
} else {
|
|
15115
15118
|
console.log(
|
|
15116
|
-
|
|
15119
|
+
chalk154.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
15117
15120
|
);
|
|
15118
15121
|
}
|
|
15119
15122
|
} finally {
|
|
@@ -15693,14 +15696,14 @@ import {
|
|
|
15693
15696
|
import { dirname as dirname22, join as join42 } from "path";
|
|
15694
15697
|
|
|
15695
15698
|
// src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
|
|
15696
|
-
import
|
|
15699
|
+
import chalk155 from "chalk";
|
|
15697
15700
|
var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
|
|
15698
15701
|
function validateStagedContent(filename, content) {
|
|
15699
15702
|
const firstLine = content.split("\n")[0];
|
|
15700
15703
|
const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
|
|
15701
15704
|
if (!match) {
|
|
15702
15705
|
console.error(
|
|
15703
|
-
|
|
15706
|
+
chalk155.red(
|
|
15704
15707
|
`Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
|
|
15705
15708
|
)
|
|
15706
15709
|
);
|
|
@@ -15709,7 +15712,7 @@ function validateStagedContent(filename, content) {
|
|
|
15709
15712
|
const contentAfterLink = content.slice(firstLine.length).trim();
|
|
15710
15713
|
if (!contentAfterLink) {
|
|
15711
15714
|
console.error(
|
|
15712
|
-
|
|
15715
|
+
chalk155.red(
|
|
15713
15716
|
`Staged file ${filename} has no summary content after the transcript link.`
|
|
15714
15717
|
)
|
|
15715
15718
|
);
|
|
@@ -16105,7 +16108,7 @@ function registerVoice(program2) {
|
|
|
16105
16108
|
|
|
16106
16109
|
// src/commands/roam/auth.ts
|
|
16107
16110
|
import { randomBytes } from "crypto";
|
|
16108
|
-
import
|
|
16111
|
+
import chalk156 from "chalk";
|
|
16109
16112
|
|
|
16110
16113
|
// src/lib/openBrowser.ts
|
|
16111
16114
|
import { execSync as execSync45 } from "child_process";
|
|
@@ -16280,13 +16283,13 @@ async function auth() {
|
|
|
16280
16283
|
saveGlobalConfig(config);
|
|
16281
16284
|
const state = randomBytes(16).toString("hex");
|
|
16282
16285
|
console.log(
|
|
16283
|
-
|
|
16286
|
+
chalk156.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
16284
16287
|
);
|
|
16285
|
-
console.log(
|
|
16286
|
-
console.log(
|
|
16287
|
-
console.log(
|
|
16288
|
+
console.log(chalk156.white("http://localhost:14523/callback\n"));
|
|
16289
|
+
console.log(chalk156.blue("Opening browser for authorization..."));
|
|
16290
|
+
console.log(chalk156.dim("Waiting for authorization callback..."));
|
|
16288
16291
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
16289
|
-
console.log(
|
|
16292
|
+
console.log(chalk156.dim("Exchanging code for tokens..."));
|
|
16290
16293
|
const tokens = await exchangeToken({
|
|
16291
16294
|
code,
|
|
16292
16295
|
clientId,
|
|
@@ -16302,7 +16305,7 @@ async function auth() {
|
|
|
16302
16305
|
};
|
|
16303
16306
|
saveGlobalConfig(config);
|
|
16304
16307
|
console.log(
|
|
16305
|
-
|
|
16308
|
+
chalk156.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
16306
16309
|
);
|
|
16307
16310
|
}
|
|
16308
16311
|
|
|
@@ -16754,7 +16757,7 @@ import { execSync as execSync47 } from "child_process";
|
|
|
16754
16757
|
import { existsSync as existsSync50, mkdirSync as mkdirSync19, unlinkSync as unlinkSync16, writeFileSync as writeFileSync32 } from "fs";
|
|
16755
16758
|
import { tmpdir as tmpdir7 } from "os";
|
|
16756
16759
|
import { join as join53, resolve as resolve13 } from "path";
|
|
16757
|
-
import
|
|
16760
|
+
import chalk157 from "chalk";
|
|
16758
16761
|
|
|
16759
16762
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
16760
16763
|
var captureWindowPs1 = `
|
|
@@ -16905,13 +16908,13 @@ function screenshot(processName) {
|
|
|
16905
16908
|
const config = loadConfig();
|
|
16906
16909
|
const outputDir = resolve13(config.screenshot.outputDir);
|
|
16907
16910
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
16908
|
-
console.log(
|
|
16911
|
+
console.log(chalk157.gray(`Capturing window for process "${processName}" ...`));
|
|
16909
16912
|
try {
|
|
16910
16913
|
runPowerShellScript(processName, outputPath);
|
|
16911
|
-
console.log(
|
|
16914
|
+
console.log(chalk157.green(`Screenshot saved: ${outputPath}`));
|
|
16912
16915
|
} catch (error) {
|
|
16913
16916
|
const msg = error instanceof Error ? error.message : String(error);
|
|
16914
|
-
console.error(
|
|
16917
|
+
console.error(chalk157.red(`Failed to capture screenshot: ${msg}`));
|
|
16915
16918
|
process.exit(1);
|
|
16916
16919
|
}
|
|
16917
16920
|
}
|
|
@@ -17972,7 +17975,7 @@ function registerDaemon(program2) {
|
|
|
17972
17975
|
|
|
17973
17976
|
// src/commands/sessions/summarise/index.ts
|
|
17974
17977
|
import * as fs29 from "fs";
|
|
17975
|
-
import
|
|
17978
|
+
import chalk158 from "chalk";
|
|
17976
17979
|
|
|
17977
17980
|
// src/commands/sessions/summarise/shared.ts
|
|
17978
17981
|
import * as fs27 from "fs";
|
|
@@ -18099,22 +18102,22 @@ ${firstMessage}`);
|
|
|
18099
18102
|
async function summarise4(options2) {
|
|
18100
18103
|
const files = await discoverSessionJsonlPaths();
|
|
18101
18104
|
if (files.length === 0) {
|
|
18102
|
-
console.log(
|
|
18105
|
+
console.log(chalk158.yellow("No sessions found."));
|
|
18103
18106
|
return;
|
|
18104
18107
|
}
|
|
18105
18108
|
const toProcess = selectCandidates(files, options2);
|
|
18106
18109
|
if (toProcess.length === 0) {
|
|
18107
|
-
console.log(
|
|
18110
|
+
console.log(chalk158.green("All sessions already summarised."));
|
|
18108
18111
|
return;
|
|
18109
18112
|
}
|
|
18110
18113
|
console.log(
|
|
18111
|
-
|
|
18114
|
+
chalk158.cyan(
|
|
18112
18115
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
18113
18116
|
)
|
|
18114
18117
|
);
|
|
18115
18118
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
18116
18119
|
console.log(
|
|
18117
|
-
|
|
18120
|
+
chalk158.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk158.yellow(`, ${failed2} skipped`) : "")
|
|
18118
18121
|
);
|
|
18119
18122
|
}
|
|
18120
18123
|
function selectCandidates(files, options2) {
|
|
@@ -18134,16 +18137,16 @@ function processSessions(files) {
|
|
|
18134
18137
|
let failed2 = 0;
|
|
18135
18138
|
for (let i = 0; i < files.length; i++) {
|
|
18136
18139
|
const file = files[i];
|
|
18137
|
-
process.stdout.write(
|
|
18140
|
+
process.stdout.write(chalk158.dim(` [${i + 1}/${files.length}] `));
|
|
18138
18141
|
const summary = summariseSession(file);
|
|
18139
18142
|
if (summary) {
|
|
18140
18143
|
writeSummary(file, summary);
|
|
18141
18144
|
succeeded++;
|
|
18142
|
-
process.stdout.write(`${
|
|
18145
|
+
process.stdout.write(`${chalk158.green("\u2713")} ${summary}
|
|
18143
18146
|
`);
|
|
18144
18147
|
} else {
|
|
18145
18148
|
failed2++;
|
|
18146
|
-
process.stdout.write(` ${
|
|
18149
|
+
process.stdout.write(` ${chalk158.yellow("skip")}
|
|
18147
18150
|
`);
|
|
18148
18151
|
}
|
|
18149
18152
|
}
|
|
@@ -18158,10 +18161,10 @@ function registerSessions(program2) {
|
|
|
18158
18161
|
}
|
|
18159
18162
|
|
|
18160
18163
|
// src/commands/statusLine.ts
|
|
18161
|
-
import
|
|
18164
|
+
import chalk160 from "chalk";
|
|
18162
18165
|
|
|
18163
18166
|
// src/commands/buildLimitsSegment.ts
|
|
18164
|
-
import
|
|
18167
|
+
import chalk159 from "chalk";
|
|
18165
18168
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
18166
18169
|
var SEVEN_DAY_SECONDS = 7 * 86400;
|
|
18167
18170
|
function formatTimeLeft(resetsAt) {
|
|
@@ -18184,10 +18187,10 @@ function projectUsage(pct, resetsAt, windowSeconds) {
|
|
|
18184
18187
|
function colorizeRateLimit(pct, resetsAt, windowSeconds) {
|
|
18185
18188
|
const label2 = `${Math.round(pct)}%`;
|
|
18186
18189
|
const projected = projectUsage(pct, resetsAt, windowSeconds);
|
|
18187
|
-
if (projected == null) return
|
|
18188
|
-
if (projected > 100) return
|
|
18189
|
-
if (projected > 75) return
|
|
18190
|
-
return
|
|
18190
|
+
if (projected == null) return chalk159.green(label2);
|
|
18191
|
+
if (projected > 100) return chalk159.red(label2);
|
|
18192
|
+
if (projected > 75) return chalk159.yellow(label2);
|
|
18193
|
+
return chalk159.green(label2);
|
|
18191
18194
|
}
|
|
18192
18195
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel) {
|
|
18193
18196
|
const timeLabel = resetsAt ? formatTimeLeft(resetsAt) : fallbackLabel;
|
|
@@ -18213,14 +18216,14 @@ function buildLimitsSegment(rateLimits) {
|
|
|
18213
18216
|
}
|
|
18214
18217
|
|
|
18215
18218
|
// src/commands/statusLine.ts
|
|
18216
|
-
|
|
18219
|
+
chalk160.level = 3;
|
|
18217
18220
|
function formatNumber(num) {
|
|
18218
18221
|
return num.toLocaleString("en-US");
|
|
18219
18222
|
}
|
|
18220
18223
|
function colorizePercent(pct) {
|
|
18221
18224
|
const label2 = `${Math.round(pct)}%`;
|
|
18222
|
-
if (pct > 80) return
|
|
18223
|
-
if (pct > 40) return
|
|
18225
|
+
if (pct > 80) return chalk160.red(label2);
|
|
18226
|
+
if (pct > 40) return chalk160.yellow(label2);
|
|
18224
18227
|
return label2;
|
|
18225
18228
|
}
|
|
18226
18229
|
async function statusLine() {
|
|
@@ -18243,7 +18246,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
|
|
|
18243
18246
|
// src/commands/sync/syncClaudeMd.ts
|
|
18244
18247
|
import * as fs30 from "fs";
|
|
18245
18248
|
import * as path49 from "path";
|
|
18246
|
-
import
|
|
18249
|
+
import chalk161 from "chalk";
|
|
18247
18250
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
18248
18251
|
const source = path49.join(claudeDir, "CLAUDE.md");
|
|
18249
18252
|
const target = path49.join(targetBase, "CLAUDE.md");
|
|
@@ -18252,12 +18255,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
18252
18255
|
const targetContent = fs30.readFileSync(target, "utf-8");
|
|
18253
18256
|
if (sourceContent !== targetContent) {
|
|
18254
18257
|
console.log(
|
|
18255
|
-
|
|
18258
|
+
chalk161.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
18256
18259
|
);
|
|
18257
18260
|
console.log();
|
|
18258
18261
|
printDiff(targetContent, sourceContent);
|
|
18259
18262
|
const confirm = options2?.yes || await promptConfirm(
|
|
18260
|
-
|
|
18263
|
+
chalk161.red("Overwrite existing CLAUDE.md?"),
|
|
18261
18264
|
false
|
|
18262
18265
|
);
|
|
18263
18266
|
if (!confirm) {
|
|
@@ -18273,7 +18276,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
18273
18276
|
// src/commands/sync/syncSettings.ts
|
|
18274
18277
|
import * as fs31 from "fs";
|
|
18275
18278
|
import * as path50 from "path";
|
|
18276
|
-
import
|
|
18279
|
+
import chalk162 from "chalk";
|
|
18277
18280
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
18278
18281
|
const source = path50.join(claudeDir, "settings.json");
|
|
18279
18282
|
const target = path50.join(targetBase, "settings.json");
|
|
@@ -18289,14 +18292,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
18289
18292
|
if (mergedContent !== normalizedTarget) {
|
|
18290
18293
|
if (!options2?.yes) {
|
|
18291
18294
|
console.log(
|
|
18292
|
-
|
|
18295
|
+
chalk162.yellow(
|
|
18293
18296
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
18294
18297
|
)
|
|
18295
18298
|
);
|
|
18296
18299
|
console.log();
|
|
18297
18300
|
printDiff(targetContent, mergedContent);
|
|
18298
18301
|
const confirm = await promptConfirm(
|
|
18299
|
-
|
|
18302
|
+
chalk162.red("Overwrite existing settings.json?"),
|
|
18300
18303
|
false
|
|
18301
18304
|
);
|
|
18302
18305
|
if (!confirm) {
|