@staff0rd/assist 0.420.1 → 0.422.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +507 -459
- 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.422.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5450,7 +5450,8 @@ function resolveDefaultBranch(override, cwd) {
|
|
|
5450
5450
|
// src/commands/branch/createBranch.ts
|
|
5451
5451
|
async function createBranch({
|
|
5452
5452
|
slug,
|
|
5453
|
-
jira
|
|
5453
|
+
jira,
|
|
5454
|
+
from
|
|
5454
5455
|
}) {
|
|
5455
5456
|
const config = loadConfig();
|
|
5456
5457
|
const branchName = buildBranchName({
|
|
@@ -5458,14 +5459,25 @@ async function createBranch({
|
|
|
5458
5459
|
jira,
|
|
5459
5460
|
slug
|
|
5460
5461
|
});
|
|
5461
|
-
const defaultBranch = resolveDefaultBranch(config.branch?.defaultBranch);
|
|
5462
5462
|
execSync25("git fetch", { stdio: "inherit" });
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
{
|
|
5466
|
-
|
|
5463
|
+
let baseRef;
|
|
5464
|
+
if (from) {
|
|
5465
|
+
try {
|
|
5466
|
+
execSync25(`git rev-parse --verify ${shellQuote(from)}`, {
|
|
5467
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
5468
|
+
});
|
|
5469
|
+
} catch {
|
|
5470
|
+
throw new Error(`Ref "${from}" does not resolve to a valid git ref`);
|
|
5471
|
+
}
|
|
5472
|
+
baseRef = from;
|
|
5473
|
+
} else {
|
|
5474
|
+
baseRef = `origin/${resolveDefaultBranch(config.branch?.defaultBranch)}`;
|
|
5475
|
+
}
|
|
5476
|
+
execSync25(`git switch -c ${shellQuote(branchName)} ${shellQuote(baseRef)}`, {
|
|
5477
|
+
stdio: "inherit"
|
|
5478
|
+
});
|
|
5467
5479
|
await recordBranchActivity(branchName);
|
|
5468
|
-
return { branchName,
|
|
5480
|
+
return { branchName, baseRef };
|
|
5469
5481
|
}
|
|
5470
5482
|
async function recordBranchActivity(branchName) {
|
|
5471
5483
|
if (resolveSessionItemId() === null) return;
|
|
@@ -11710,33 +11722,15 @@ async function removePhase(id, phase) {
|
|
|
11710
11722
|
);
|
|
11711
11723
|
}
|
|
11712
11724
|
|
|
11713
|
-
// src/commands/backlog/update/
|
|
11714
|
-
import
|
|
11725
|
+
// src/commands/backlog/update/update.ts
|
|
11726
|
+
import chalk108 from "chalk";
|
|
11715
11727
|
import { eq as eq36 } from "drizzle-orm";
|
|
11716
11728
|
|
|
11717
|
-
// src/commands/backlog/update/applyAcMutations.ts
|
|
11718
|
-
function hasAcMutations(options2) {
|
|
11719
|
-
return hasListMutations({
|
|
11720
|
-
add: options2.addAc,
|
|
11721
|
-
edit: options2.editAc,
|
|
11722
|
-
remove: options2.removeAc
|
|
11723
|
-
});
|
|
11724
|
-
}
|
|
11725
|
-
function applyAcMutations(current, options2) {
|
|
11726
|
-
const result = applyListMutations(
|
|
11727
|
-
current,
|
|
11728
|
-
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
11729
|
-
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
11730
|
-
);
|
|
11731
|
-
if (!result.ok) return result;
|
|
11732
|
-
return { ok: true, criteria: result.items };
|
|
11733
|
-
}
|
|
11734
|
-
|
|
11735
11729
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
11736
11730
|
import chalk105 from "chalk";
|
|
11737
11731
|
function buildUpdateValues(options2) {
|
|
11738
|
-
const { name, desc: desc6, type, ac } = options2;
|
|
11739
|
-
if (!name && !desc6 && !type && !ac) {
|
|
11732
|
+
const { name, desc: desc6, type, ac, origin } = options2;
|
|
11733
|
+
if (!name && !desc6 && !type && !ac && !origin) {
|
|
11740
11734
|
console.log(chalk105.red("Nothing to update. Provide at least one flag."));
|
|
11741
11735
|
process.exitCode = 1;
|
|
11742
11736
|
return void 0;
|
|
@@ -11764,37 +11758,86 @@ function buildUpdateValues(options2) {
|
|
|
11764
11758
|
set.acceptanceCriteria = JSON.stringify(ac);
|
|
11765
11759
|
fieldNames.push("acceptance criteria");
|
|
11766
11760
|
}
|
|
11761
|
+
if (origin) {
|
|
11762
|
+
set.origin = origin;
|
|
11763
|
+
fieldNames.push("origin");
|
|
11764
|
+
}
|
|
11767
11765
|
return { set, fields: fieldNames.join(", ") };
|
|
11768
11766
|
}
|
|
11769
11767
|
|
|
11770
|
-
// src/commands/backlog/update/
|
|
11768
|
+
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
11769
|
+
import chalk106 from "chalk";
|
|
11770
|
+
|
|
11771
|
+
// src/commands/backlog/update/applyAcMutations.ts
|
|
11772
|
+
function hasAcMutations(options2) {
|
|
11773
|
+
return hasListMutations({
|
|
11774
|
+
add: options2.addAc,
|
|
11775
|
+
edit: options2.editAc,
|
|
11776
|
+
remove: options2.removeAc
|
|
11777
|
+
});
|
|
11778
|
+
}
|
|
11779
|
+
function applyAcMutations(current, options2) {
|
|
11780
|
+
const result = applyListMutations(
|
|
11781
|
+
current,
|
|
11782
|
+
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
11783
|
+
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
11784
|
+
);
|
|
11785
|
+
if (!result.ok) return result;
|
|
11786
|
+
return { ok: true, criteria: result.items };
|
|
11787
|
+
}
|
|
11788
|
+
|
|
11789
|
+
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
11790
|
+
function resolveAcUpdate(options2, currentCriteria) {
|
|
11791
|
+
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
11792
|
+
if (options2.ac) {
|
|
11793
|
+
console.log(
|
|
11794
|
+
chalk106.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
11795
|
+
);
|
|
11796
|
+
process.exitCode = 1;
|
|
11797
|
+
return { ok: false };
|
|
11798
|
+
}
|
|
11799
|
+
const mutation = applyAcMutations(currentCriteria, options2);
|
|
11800
|
+
if (!mutation.ok) {
|
|
11801
|
+
console.log(chalk106.red(mutation.error));
|
|
11802
|
+
process.exitCode = 1;
|
|
11803
|
+
return { ok: false };
|
|
11804
|
+
}
|
|
11805
|
+
return { ok: true, ac: mutation.criteria };
|
|
11806
|
+
}
|
|
11807
|
+
|
|
11808
|
+
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
11809
|
+
import chalk107 from "chalk";
|
|
11810
|
+
function resolveOriginUpdate(optionOrigin, item) {
|
|
11811
|
+
if (optionOrigin === void 0 || optionOrigin === false)
|
|
11812
|
+
return { kind: "none" };
|
|
11813
|
+
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
11814
|
+
if (origin === item.origin) {
|
|
11815
|
+
console.log(
|
|
11816
|
+
chalk107.yellow(
|
|
11817
|
+
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
11818
|
+
)
|
|
11819
|
+
);
|
|
11820
|
+
return { kind: "noop" };
|
|
11821
|
+
}
|
|
11822
|
+
return { kind: "set", origin };
|
|
11823
|
+
}
|
|
11824
|
+
|
|
11825
|
+
// src/commands/backlog/update/update.ts
|
|
11771
11826
|
async function update(id, options2) {
|
|
11772
11827
|
const found = await findOneItem(id);
|
|
11773
11828
|
if (!found) return;
|
|
11774
|
-
|
|
11775
|
-
if (
|
|
11776
|
-
|
|
11777
|
-
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
process.exitCode = 1;
|
|
11781
|
-
return;
|
|
11782
|
-
}
|
|
11783
|
-
const mutation = applyAcMutations(found.item.acceptanceCriteria, options2);
|
|
11784
|
-
if (!mutation.ok) {
|
|
11785
|
-
console.log(chalk106.red(mutation.error));
|
|
11786
|
-
process.exitCode = 1;
|
|
11787
|
-
return;
|
|
11788
|
-
}
|
|
11789
|
-
ac = mutation.criteria;
|
|
11790
|
-
}
|
|
11791
|
-
const built = buildUpdateValues({ ...options2, ac });
|
|
11829
|
+
const acResult = resolveAcUpdate(options2, found.item.acceptanceCriteria);
|
|
11830
|
+
if (!acResult.ok) return;
|
|
11831
|
+
const originResult = resolveOriginUpdate(options2.origin, found.item);
|
|
11832
|
+
if (originResult.kind === "noop") return;
|
|
11833
|
+
const origin = originResult.kind === "set" ? originResult.origin : void 0;
|
|
11834
|
+
const built = buildUpdateValues({ ...options2, ac: acResult.ac, origin });
|
|
11792
11835
|
if (!built) return;
|
|
11793
11836
|
const { orm } = found;
|
|
11794
11837
|
const itemId2 = found.item.id;
|
|
11795
11838
|
await orm.update(items).set(built.set).where(eq36(items.id, itemId2));
|
|
11796
11839
|
console.log(
|
|
11797
|
-
|
|
11840
|
+
chalk108.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
11798
11841
|
);
|
|
11799
11842
|
}
|
|
11800
11843
|
|
|
@@ -11814,7 +11857,10 @@ function registerUpdateCommands(cmd) {
|
|
|
11814
11857
|
).option(
|
|
11815
11858
|
"--edit-ac <n> <text...>",
|
|
11816
11859
|
"Replace acceptance criterion n (1-based) in place"
|
|
11817
|
-
).option("--remove-ac <n>", "Remove acceptance criterion n (1-based)").
|
|
11860
|
+
).option("--remove-ac <n>", "Remove acceptance criterion n (1-based)").option(
|
|
11861
|
+
"--origin [origin]",
|
|
11862
|
+
"Retag the item to a different repo (origin URL or key, normalized); with no value, retags to the current repo's origin"
|
|
11863
|
+
).action(update);
|
|
11818
11864
|
registerUpdatePhaseCommand(cmd);
|
|
11819
11865
|
cmd.command("remove-phase <id> <phase>").description("Remove a plan phase from a backlog item").action(removePhase);
|
|
11820
11866
|
cmd.command("move-phase <id> <from> <to>").description(
|
|
@@ -11894,13 +11940,12 @@ async function branch(slug, options2) {
|
|
|
11894
11940
|
process.exit(1);
|
|
11895
11941
|
}
|
|
11896
11942
|
try {
|
|
11897
|
-
const { branchName,
|
|
11943
|
+
const { branchName, baseRef } = await createBranch({
|
|
11898
11944
|
slug: conciseSlug,
|
|
11899
|
-
jira: options2.jira
|
|
11945
|
+
jira: options2.jira,
|
|
11946
|
+
from: options2.from
|
|
11900
11947
|
});
|
|
11901
|
-
console.log(
|
|
11902
|
-
`Created and switched to ${branchName} (from origin/${defaultBranch})`
|
|
11903
|
-
);
|
|
11948
|
+
console.log(`Created and switched to ${branchName} (from ${baseRef})`);
|
|
11904
11949
|
process.exit(0);
|
|
11905
11950
|
} catch (error) {
|
|
11906
11951
|
console.error(
|
|
@@ -11914,7 +11959,10 @@ async function branch(slug, options2) {
|
|
|
11914
11959
|
function registerBranch(program2) {
|
|
11915
11960
|
const branchCommand = program2.command("branch <slug>").description(
|
|
11916
11961
|
"Create and switch to a branch off the fresh remote default branch"
|
|
11917
|
-
).option("--jira <key>", "Jira issue key to include in the branch name").
|
|
11962
|
+
).option("--jira <key>", "Jira issue key to include in the branch name").option(
|
|
11963
|
+
"--from <ref>",
|
|
11964
|
+
"base the branch off <ref> verbatim (local branch, tag, or origin/*) instead of the fresh remote default"
|
|
11965
|
+
).action(
|
|
11918
11966
|
(slug, options2) => branch(slug, options2)
|
|
11919
11967
|
);
|
|
11920
11968
|
configHelp(
|
|
@@ -12599,11 +12647,11 @@ function assertCliExists(cli) {
|
|
|
12599
12647
|
}
|
|
12600
12648
|
|
|
12601
12649
|
// src/commands/permitCliReads/colorize.ts
|
|
12602
|
-
import
|
|
12650
|
+
import chalk109 from "chalk";
|
|
12603
12651
|
function colorize(plainOutput) {
|
|
12604
12652
|
return plainOutput.split("\n").map((line) => {
|
|
12605
|
-
if (line.startsWith(" R ")) return
|
|
12606
|
-
if (line.startsWith(" W ")) return
|
|
12653
|
+
if (line.startsWith(" R ")) return chalk109.green(line);
|
|
12654
|
+
if (line.startsWith(" W ")) return chalk109.red(line);
|
|
12607
12655
|
return line;
|
|
12608
12656
|
}).join("\n");
|
|
12609
12657
|
}
|
|
@@ -12901,7 +12949,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
12901
12949
|
}
|
|
12902
12950
|
|
|
12903
12951
|
// src/commands/deny/denyAdd.ts
|
|
12904
|
-
import
|
|
12952
|
+
import chalk110 from "chalk";
|
|
12905
12953
|
|
|
12906
12954
|
// src/commands/deny/loadDenyConfig.ts
|
|
12907
12955
|
function loadDenyConfig(global) {
|
|
@@ -12921,16 +12969,16 @@ function loadDenyConfig(global) {
|
|
|
12921
12969
|
function denyAdd(pattern2, message, options2) {
|
|
12922
12970
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12923
12971
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
12924
|
-
console.log(
|
|
12972
|
+
console.log(chalk110.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
12925
12973
|
return;
|
|
12926
12974
|
}
|
|
12927
12975
|
deny.push({ pattern: pattern2, message });
|
|
12928
12976
|
saveDeny(deny);
|
|
12929
|
-
console.log(
|
|
12977
|
+
console.log(chalk110.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
12930
12978
|
}
|
|
12931
12979
|
|
|
12932
12980
|
// src/commands/deny/denyList.ts
|
|
12933
|
-
import
|
|
12981
|
+
import chalk111 from "chalk";
|
|
12934
12982
|
function denyList() {
|
|
12935
12983
|
const globalRaw = loadGlobalConfigRaw();
|
|
12936
12984
|
const projectRaw = loadProjectConfig();
|
|
@@ -12941,7 +12989,7 @@ function denyList() {
|
|
|
12941
12989
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
12942
12990
|
);
|
|
12943
12991
|
if (!merged || merged.length === 0) {
|
|
12944
|
-
console.log(
|
|
12992
|
+
console.log(chalk111.dim("No deny rules configured."));
|
|
12945
12993
|
return;
|
|
12946
12994
|
}
|
|
12947
12995
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -12949,23 +12997,23 @@ function denyList() {
|
|
|
12949
12997
|
for (const rule of merged) {
|
|
12950
12998
|
const inProject = projectPatterns.has(rule.pattern);
|
|
12951
12999
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
12952
|
-
const label2 = inProject && inGlobal ?
|
|
12953
|
-
console.log(`${
|
|
13000
|
+
const label2 = inProject && inGlobal ? chalk111.dim(" (project, overrides global)") : inGlobal ? chalk111.dim(" (global)") : "";
|
|
13001
|
+
console.log(`${chalk111.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
12954
13002
|
}
|
|
12955
13003
|
}
|
|
12956
13004
|
|
|
12957
13005
|
// src/commands/deny/denyRemove.ts
|
|
12958
|
-
import
|
|
13006
|
+
import chalk112 from "chalk";
|
|
12959
13007
|
function denyRemove(pattern2, options2) {
|
|
12960
13008
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12961
13009
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
12962
13010
|
if (index3 === -1) {
|
|
12963
|
-
console.log(
|
|
13011
|
+
console.log(chalk112.yellow(`No deny rule found for: ${pattern2}`));
|
|
12964
13012
|
return;
|
|
12965
13013
|
}
|
|
12966
13014
|
deny.splice(index3, 1);
|
|
12967
13015
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
12968
|
-
console.log(
|
|
13016
|
+
console.log(chalk112.green(`Removed deny rule: ${pattern2}`));
|
|
12969
13017
|
}
|
|
12970
13018
|
|
|
12971
13019
|
// src/commands/registerDeny.ts
|
|
@@ -13009,7 +13057,7 @@ function registerCliHook(program2) {
|
|
|
13009
13057
|
|
|
13010
13058
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
13011
13059
|
import { existsSync as existsSync33, readFileSync as readFileSync27, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
13012
|
-
import
|
|
13060
|
+
import chalk113 from "chalk";
|
|
13013
13061
|
|
|
13014
13062
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
13015
13063
|
import { homedir as homedir17 } from "os";
|
|
@@ -13062,12 +13110,12 @@ function codeCommentConfirm(pin) {
|
|
|
13062
13110
|
sweepRestrictedDir();
|
|
13063
13111
|
const state = readPinState(pin);
|
|
13064
13112
|
if (!state) {
|
|
13065
|
-
console.error(
|
|
13113
|
+
console.error(chalk113.red(`No pending comment for pin: ${pin}`));
|
|
13066
13114
|
process.exitCode = 1;
|
|
13067
13115
|
return;
|
|
13068
13116
|
}
|
|
13069
13117
|
if (!existsSync33(state.file)) {
|
|
13070
|
-
console.error(
|
|
13118
|
+
console.error(chalk113.red(`Target file no longer exists: ${state.file}`));
|
|
13071
13119
|
process.exitCode = 1;
|
|
13072
13120
|
return;
|
|
13073
13121
|
}
|
|
@@ -13076,7 +13124,7 @@ function codeCommentConfirm(pin) {
|
|
|
13076
13124
|
const index3 = state.line - 1;
|
|
13077
13125
|
if (index3 > lines.length) {
|
|
13078
13126
|
console.error(
|
|
13079
|
-
|
|
13127
|
+
chalk113.red(
|
|
13080
13128
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
13081
13129
|
)
|
|
13082
13130
|
);
|
|
@@ -13090,14 +13138,14 @@ function codeCommentConfirm(pin) {
|
|
|
13090
13138
|
writeFileSync24(state.file, lines.join("\n"));
|
|
13091
13139
|
unlinkSync8(getPinStatePath(pin));
|
|
13092
13140
|
console.log(
|
|
13093
|
-
|
|
13141
|
+
chalk113.green(
|
|
13094
13142
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
13095
13143
|
)
|
|
13096
13144
|
);
|
|
13097
13145
|
}
|
|
13098
13146
|
|
|
13099
13147
|
// src/commands/codeComment/codeCommentSet.ts
|
|
13100
|
-
import
|
|
13148
|
+
import chalk114 from "chalk";
|
|
13101
13149
|
|
|
13102
13150
|
// src/commands/codeComment/validateCommentText.ts
|
|
13103
13151
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -13148,7 +13196,7 @@ function generatePin() {
|
|
|
13148
13196
|
function codeCommentSet(file, line, text17) {
|
|
13149
13197
|
const lineNumber = Number.parseInt(line, 10);
|
|
13150
13198
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
13151
|
-
console.error(
|
|
13199
|
+
console.error(chalk114.red(`Invalid line number: ${line}`));
|
|
13152
13200
|
process.exitCode = 1;
|
|
13153
13201
|
return;
|
|
13154
13202
|
}
|
|
@@ -13156,20 +13204,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
13156
13204
|
const marker = hash ? "#" : "//";
|
|
13157
13205
|
const validation = validateCommentText(text17, hash);
|
|
13158
13206
|
if (!validation.ok) {
|
|
13159
|
-
console.error(
|
|
13160
|
-
console.error(
|
|
13207
|
+
console.error(chalk114.red(`Refused: ${validation.reason}`));
|
|
13208
|
+
console.error(chalk114.red("No pin issued."));
|
|
13161
13209
|
process.exitCode = 1;
|
|
13162
13210
|
return;
|
|
13163
13211
|
}
|
|
13164
13212
|
console.error(
|
|
13165
|
-
|
|
13213
|
+
chalk114.yellow.bold(
|
|
13166
13214
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
13167
13215
|
)
|
|
13168
13216
|
);
|
|
13169
13217
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
13170
13218
|
if (!delivered) {
|
|
13171
13219
|
console.error(
|
|
13172
|
-
|
|
13220
|
+
chalk114.red(
|
|
13173
13221
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
13174
13222
|
)
|
|
13175
13223
|
);
|
|
@@ -13179,7 +13227,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
13179
13227
|
console.log(
|
|
13180
13228
|
`A confirmation pin was sent to your desktop notifications.
|
|
13181
13229
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
13182
|
-
${
|
|
13230
|
+
${chalk114.cyan(" assist code-comment confirm <PIN>")}
|
|
13183
13231
|
using the pin from that notification.`
|
|
13184
13232
|
);
|
|
13185
13233
|
}
|
|
@@ -13258,15 +13306,15 @@ function registerCodexHook(program2) {
|
|
|
13258
13306
|
}
|
|
13259
13307
|
|
|
13260
13308
|
// src/commands/complexity/analyze.ts
|
|
13261
|
-
import
|
|
13309
|
+
import chalk123 from "chalk";
|
|
13262
13310
|
|
|
13263
13311
|
// src/commands/complexity/cyclomatic.ts
|
|
13264
|
-
import
|
|
13312
|
+
import chalk116 from "chalk";
|
|
13265
13313
|
|
|
13266
13314
|
// src/commands/complexity/shared/index.ts
|
|
13267
13315
|
import fs20 from "fs";
|
|
13268
13316
|
import path27 from "path";
|
|
13269
|
-
import
|
|
13317
|
+
import chalk115 from "chalk";
|
|
13270
13318
|
import ts5 from "typescript";
|
|
13271
13319
|
|
|
13272
13320
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13517,7 +13565,7 @@ function createSourceFromFile(filePath) {
|
|
|
13517
13565
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13518
13566
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13519
13567
|
if (files.length === 0) {
|
|
13520
|
-
console.log(
|
|
13568
|
+
console.log(chalk115.yellow("No files found matching pattern"));
|
|
13521
13569
|
return void 0;
|
|
13522
13570
|
}
|
|
13523
13571
|
return callback(files);
|
|
@@ -13550,11 +13598,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13550
13598
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13551
13599
|
for (const { file, name, complexity } of results) {
|
|
13552
13600
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13553
|
-
const color = exceedsThreshold ?
|
|
13554
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
13601
|
+
const color = exceedsThreshold ? chalk116.red : chalk116.white;
|
|
13602
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk116.cyan(complexity)}`);
|
|
13555
13603
|
}
|
|
13556
13604
|
console.log(
|
|
13557
|
-
|
|
13605
|
+
chalk116.dim(
|
|
13558
13606
|
`
|
|
13559
13607
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13560
13608
|
)
|
|
@@ -13566,7 +13614,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13566
13614
|
}
|
|
13567
13615
|
|
|
13568
13616
|
// src/commands/complexity/halstead.ts
|
|
13569
|
-
import
|
|
13617
|
+
import chalk117 from "chalk";
|
|
13570
13618
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
13571
13619
|
withSourceFiles(pattern2, (files) => {
|
|
13572
13620
|
const results = [];
|
|
@@ -13581,13 +13629,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13581
13629
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
13582
13630
|
for (const { file, name, metrics } of results) {
|
|
13583
13631
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
13584
|
-
const color = exceedsThreshold ?
|
|
13632
|
+
const color = exceedsThreshold ? chalk117.red : chalk117.white;
|
|
13585
13633
|
console.log(
|
|
13586
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
13634
|
+
`${color(`${file}:${name}`)} \u2192 volume: ${chalk117.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk117.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk117.magenta(metrics.effort.toFixed(1))}`
|
|
13587
13635
|
);
|
|
13588
13636
|
}
|
|
13589
13637
|
console.log(
|
|
13590
|
-
|
|
13638
|
+
chalk117.dim(
|
|
13591
13639
|
`
|
|
13592
13640
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13593
13641
|
)
|
|
@@ -13664,15 +13712,15 @@ function collectFileMetrics(files) {
|
|
|
13664
13712
|
}
|
|
13665
13713
|
|
|
13666
13714
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
13667
|
-
import
|
|
13715
|
+
import chalk121 from "chalk";
|
|
13668
13716
|
|
|
13669
13717
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
13670
|
-
import
|
|
13718
|
+
import chalk118 from "chalk";
|
|
13671
13719
|
function formatResultLine(entry, failing) {
|
|
13672
13720
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
13673
|
-
const name = failing ?
|
|
13674
|
-
const suffix = override !== void 0 ?
|
|
13675
|
-
return `${name} \u2192 avg: ${
|
|
13721
|
+
const name = failing ? chalk118.red(file) : chalk118.white(file);
|
|
13722
|
+
const suffix = override !== void 0 ? chalk118.magenta(` (override: ${override})`) : "";
|
|
13723
|
+
return `${name} \u2192 avg: ${chalk118.cyan(avgMaintainability.toFixed(1))}, min: ${chalk118.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
13676
13724
|
}
|
|
13677
13725
|
|
|
13678
13726
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -13723,44 +13771,44 @@ function getMaintainabilityGitState() {
|
|
|
13723
13771
|
|
|
13724
13772
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
13725
13773
|
import path29 from "path";
|
|
13726
|
-
import
|
|
13774
|
+
import chalk119 from "chalk";
|
|
13727
13775
|
function suggestDestination(file, functionName) {
|
|
13728
13776
|
return path29.join(path29.dirname(file), `${functionName}.ts`);
|
|
13729
13777
|
}
|
|
13730
13778
|
function remediationLine(entry) {
|
|
13731
13779
|
const { file, largestFunction } = entry;
|
|
13732
13780
|
if (largestFunction === "" || largestFunction.startsWith("<"))
|
|
13733
|
-
return ` Move the largest responsibility out of ${
|
|
13781
|
+
return ` Move the largest responsibility out of ${chalk119.bold(file)} into a new file with 'assist refactor extract'.`;
|
|
13734
13782
|
const dest = suggestDestination(file, largestFunction);
|
|
13735
13783
|
const command = `assist refactor extract ${file} ${largestFunction} ${dest} --apply`;
|
|
13736
|
-
return ` ${
|
|
13737
|
-
${
|
|
13784
|
+
return ` ${chalk119.bold(file)} \u2192 extract '${largestFunction}' to a new file:
|
|
13785
|
+
${chalk119.cyan(command)}`;
|
|
13738
13786
|
}
|
|
13739
13787
|
function cheatLine(entry, gitState) {
|
|
13740
13788
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
13741
13789
|
if (!shrank || gitState.newFileCreated) return "";
|
|
13742
13790
|
return `
|
|
13743
|
-
${
|
|
13791
|
+
${chalk119.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
|
|
13744
13792
|
}
|
|
13745
13793
|
function printMaintainabilityFailure(failing, gitState) {
|
|
13746
13794
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
13747
13795
|
console.error(
|
|
13748
|
-
|
|
13796
|
+
chalk119.red(
|
|
13749
13797
|
`
|
|
13750
13798
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
13751
13799
|
|
|
13752
13800
|
${blocks}
|
|
13753
13801
|
|
|
13754
|
-
${
|
|
13802
|
+
${chalk119.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
|
|
13755
13803
|
)
|
|
13756
13804
|
);
|
|
13757
13805
|
}
|
|
13758
13806
|
|
|
13759
13807
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
13760
|
-
import
|
|
13808
|
+
import chalk120 from "chalk";
|
|
13761
13809
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
13762
13810
|
function printMaintainabilityFormula() {
|
|
13763
|
-
console.log(
|
|
13811
|
+
console.log(chalk120.dim(MI_FORMULA));
|
|
13764
13812
|
}
|
|
13765
13813
|
|
|
13766
13814
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -13769,7 +13817,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
13769
13817
|
if (!gating) {
|
|
13770
13818
|
printMaintainabilityFormula();
|
|
13771
13819
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
13772
|
-
console.log(
|
|
13820
|
+
console.log(chalk121.dim(`
|
|
13773
13821
|
Analyzed ${results.length} files`));
|
|
13774
13822
|
return;
|
|
13775
13823
|
}
|
|
@@ -13778,14 +13826,14 @@ Analyzed ${results.length} files`));
|
|
|
13778
13826
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
13779
13827
|
});
|
|
13780
13828
|
if (failing.length === 0) {
|
|
13781
|
-
console.log(
|
|
13829
|
+
console.log(chalk121.green("All files pass maintainability threshold"));
|
|
13782
13830
|
}
|
|
13783
13831
|
const passingOverrides = results.filter(
|
|
13784
13832
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
13785
13833
|
);
|
|
13786
13834
|
for (const entry of passingOverrides)
|
|
13787
13835
|
console.log(formatResultLine(entry, false));
|
|
13788
|
-
console.log(
|
|
13836
|
+
console.log(chalk121.dim(`
|
|
13789
13837
|
Analyzed ${results.length} files`));
|
|
13790
13838
|
if (failing.length > 0) {
|
|
13791
13839
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -13808,7 +13856,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13808
13856
|
|
|
13809
13857
|
// src/commands/complexity/sloc.ts
|
|
13810
13858
|
import fs22 from "fs";
|
|
13811
|
-
import
|
|
13859
|
+
import chalk122 from "chalk";
|
|
13812
13860
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
13813
13861
|
withSourceFiles(pattern2, (files) => {
|
|
13814
13862
|
const results = [];
|
|
@@ -13824,12 +13872,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13824
13872
|
results.sort((a, b) => b.lines - a.lines);
|
|
13825
13873
|
for (const { file, lines } of results) {
|
|
13826
13874
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
13827
|
-
const color = exceedsThreshold ?
|
|
13828
|
-
console.log(`${color(file)} \u2192 ${
|
|
13875
|
+
const color = exceedsThreshold ? chalk122.red : chalk122.white;
|
|
13876
|
+
console.log(`${color(file)} \u2192 ${chalk122.cyan(lines)} lines`);
|
|
13829
13877
|
}
|
|
13830
13878
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
13831
13879
|
console.log(
|
|
13832
|
-
|
|
13880
|
+
chalk122.dim(`
|
|
13833
13881
|
Total: ${total} lines across ${files.length} files`)
|
|
13834
13882
|
);
|
|
13835
13883
|
if (hasViolation) {
|
|
@@ -13843,25 +13891,25 @@ async function analyze(pattern2) {
|
|
|
13843
13891
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
13844
13892
|
const files = findSourceFiles2(searchPattern);
|
|
13845
13893
|
if (files.length === 0) {
|
|
13846
|
-
console.log(
|
|
13894
|
+
console.log(chalk123.yellow("No files found matching pattern"));
|
|
13847
13895
|
return;
|
|
13848
13896
|
}
|
|
13849
13897
|
if (files.length === 1) {
|
|
13850
13898
|
const file = files[0];
|
|
13851
|
-
console.log(
|
|
13899
|
+
console.log(chalk123.bold.underline("SLOC"));
|
|
13852
13900
|
await sloc(file);
|
|
13853
13901
|
console.log();
|
|
13854
|
-
console.log(
|
|
13902
|
+
console.log(chalk123.bold.underline("Cyclomatic Complexity"));
|
|
13855
13903
|
await cyclomatic(file);
|
|
13856
13904
|
console.log();
|
|
13857
|
-
console.log(
|
|
13905
|
+
console.log(chalk123.bold.underline("Halstead Metrics"));
|
|
13858
13906
|
await halstead(file);
|
|
13859
13907
|
console.log();
|
|
13860
|
-
console.log(
|
|
13908
|
+
console.log(chalk123.bold.underline("Maintainability Index"));
|
|
13861
13909
|
await maintainability(file);
|
|
13862
13910
|
console.log();
|
|
13863
13911
|
console.log(
|
|
13864
|
-
|
|
13912
|
+
chalk123.dim(
|
|
13865
13913
|
"To improve the maintainability index, extract functions and logic out of this file into separate, smaller modules. Collapsing whitespace or removing comments is not the goal."
|
|
13866
13914
|
)
|
|
13867
13915
|
);
|
|
@@ -13912,7 +13960,7 @@ function configList() {
|
|
|
13912
13960
|
}
|
|
13913
13961
|
|
|
13914
13962
|
// src/commands/config/configGet.ts
|
|
13915
|
-
import
|
|
13963
|
+
import chalk124 from "chalk";
|
|
13916
13964
|
|
|
13917
13965
|
// src/commands/config/getNestedValue.ts
|
|
13918
13966
|
function isTraversable(value) {
|
|
@@ -13944,12 +13992,12 @@ function requireNestedValue(config, key) {
|
|
|
13944
13992
|
return value;
|
|
13945
13993
|
}
|
|
13946
13994
|
function exitKeyNotSet(key) {
|
|
13947
|
-
console.error(
|
|
13995
|
+
console.error(chalk124.red(`Key "${key}" is not set`));
|
|
13948
13996
|
process.exit(1);
|
|
13949
13997
|
}
|
|
13950
13998
|
|
|
13951
13999
|
// src/commands/config/configSet.ts
|
|
13952
|
-
import
|
|
14000
|
+
import chalk126 from "chalk";
|
|
13953
14001
|
|
|
13954
14002
|
// src/commands/config/setNestedValue.ts
|
|
13955
14003
|
function isPlainObject(val) {
|
|
@@ -14000,7 +14048,7 @@ function setNestedValue(obj, path71, value) {
|
|
|
14000
14048
|
}
|
|
14001
14049
|
|
|
14002
14050
|
// src/commands/config/validateConfig.ts
|
|
14003
|
-
import
|
|
14051
|
+
import chalk125 from "chalk";
|
|
14004
14052
|
function validateConfig(updated, key) {
|
|
14005
14053
|
const result = assistConfigSchema.safeParse(updated);
|
|
14006
14054
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
@@ -14013,7 +14061,7 @@ function exitValidationFailed(issues, key) {
|
|
|
14013
14061
|
function printValidationErrors(issues, key) {
|
|
14014
14062
|
for (const issue of issues) {
|
|
14015
14063
|
console.error(
|
|
14016
|
-
|
|
14064
|
+
chalk125.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
14017
14065
|
);
|
|
14018
14066
|
}
|
|
14019
14067
|
}
|
|
@@ -14045,12 +14093,12 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
14045
14093
|
function configSet(key, value, options2 = {}) {
|
|
14046
14094
|
const coerced = coerceValue(value);
|
|
14047
14095
|
if (options2.repo && options2.global) {
|
|
14048
|
-
console.error(
|
|
14096
|
+
console.error(chalk126.red("Use either --repo or --global, not both"));
|
|
14049
14097
|
process.exit(1);
|
|
14050
14098
|
}
|
|
14051
14099
|
const target = options2.repo ? `repo: ${applyRepoConfigSet(key, coerced)}` : applyConfigSet(key, coerced, options2.global ?? false);
|
|
14052
14100
|
console.log(
|
|
14053
|
-
|
|
14101
|
+
chalk126.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14054
14102
|
);
|
|
14055
14103
|
}
|
|
14056
14104
|
function coerceValue(value) {
|
|
@@ -14073,7 +14121,7 @@ function applyConfigSet(key, coerced, global) {
|
|
|
14073
14121
|
function assertNotGlobalOnly(key, global) {
|
|
14074
14122
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14075
14123
|
console.error(
|
|
14076
|
-
|
|
14124
|
+
chalk126.red(
|
|
14077
14125
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14078
14126
|
)
|
|
14079
14127
|
);
|
|
@@ -14093,40 +14141,40 @@ function registerConfig(program2) {
|
|
|
14093
14141
|
}
|
|
14094
14142
|
|
|
14095
14143
|
// src/commands/db/reportMigrationStatus.ts
|
|
14096
|
-
import
|
|
14144
|
+
import chalk127 from "chalk";
|
|
14097
14145
|
function reportApplied(applied) {
|
|
14098
14146
|
if (applied.length === 0) {
|
|
14099
|
-
console.error(
|
|
14147
|
+
console.error(chalk127.green("Database is up to date; nothing to apply."));
|
|
14100
14148
|
return;
|
|
14101
14149
|
}
|
|
14102
14150
|
for (const migration of applied) {
|
|
14103
14151
|
console.error(
|
|
14104
|
-
|
|
14152
|
+
chalk127.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14105
14153
|
);
|
|
14106
14154
|
}
|
|
14107
14155
|
}
|
|
14108
14156
|
function reportMigrationStatus(status3) {
|
|
14109
14157
|
if (status3.state === "in-sync") {
|
|
14110
14158
|
console.error(
|
|
14111
|
-
|
|
14159
|
+
chalk127.green(`In sync at migration ${status3.version} (latest).`)
|
|
14112
14160
|
);
|
|
14113
14161
|
return;
|
|
14114
14162
|
}
|
|
14115
14163
|
if (status3.state === "behind") {
|
|
14116
14164
|
console.error(
|
|
14117
|
-
|
|
14165
|
+
chalk127.yellow(
|
|
14118
14166
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14119
14167
|
)
|
|
14120
14168
|
);
|
|
14121
14169
|
console.error(
|
|
14122
|
-
|
|
14170
|
+
chalk127.yellow(
|
|
14123
14171
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14124
14172
|
)
|
|
14125
14173
|
);
|
|
14126
14174
|
return;
|
|
14127
14175
|
}
|
|
14128
14176
|
console.error(
|
|
14129
|
-
|
|
14177
|
+
chalk127.red(
|
|
14130
14178
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14131
14179
|
)
|
|
14132
14180
|
);
|
|
@@ -14161,7 +14209,7 @@ function registerDb(program2) {
|
|
|
14161
14209
|
|
|
14162
14210
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14163
14211
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14164
|
-
import
|
|
14212
|
+
import chalk128 from "chalk";
|
|
14165
14213
|
|
|
14166
14214
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14167
14215
|
import { join as join34 } from "path";
|
|
@@ -14192,7 +14240,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14192
14240
|
sweepRestrictedDir();
|
|
14193
14241
|
const state = readMigrationPinState(pin);
|
|
14194
14242
|
if (!state) {
|
|
14195
|
-
console.error(
|
|
14243
|
+
console.error(chalk128.red(`No pending migration unlock for pin: ${pin}`));
|
|
14196
14244
|
process.exitCode = 1;
|
|
14197
14245
|
return;
|
|
14198
14246
|
}
|
|
@@ -14202,7 +14250,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14202
14250
|
);
|
|
14203
14251
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14204
14252
|
console.log(
|
|
14205
|
-
|
|
14253
|
+
chalk128.green(
|
|
14206
14254
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14207
14255
|
)
|
|
14208
14256
|
);
|
|
@@ -14211,7 +14259,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14211
14259
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14212
14260
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14213
14261
|
import { randomInt as randomInt2 } from "crypto";
|
|
14214
|
-
import
|
|
14262
|
+
import chalk129 from "chalk";
|
|
14215
14263
|
|
|
14216
14264
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14217
14265
|
function nextMigrationId() {
|
|
@@ -14226,7 +14274,7 @@ function dbMigrationUnlock() {
|
|
|
14226
14274
|
sweepRestrictedDir();
|
|
14227
14275
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14228
14276
|
console.error(
|
|
14229
|
-
|
|
14277
|
+
chalk129.yellow.bold(
|
|
14230
14278
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
14231
14279
|
)
|
|
14232
14280
|
);
|
|
@@ -14236,7 +14284,7 @@ function dbMigrationUnlock() {
|
|
|
14236
14284
|
});
|
|
14237
14285
|
if (!delivered) {
|
|
14238
14286
|
console.error(
|
|
14239
|
-
|
|
14287
|
+
chalk129.red(
|
|
14240
14288
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14241
14289
|
)
|
|
14242
14290
|
);
|
|
@@ -14246,7 +14294,7 @@ function dbMigrationUnlock() {
|
|
|
14246
14294
|
console.log(
|
|
14247
14295
|
`A confirmation pin was sent to your desktop notifications.
|
|
14248
14296
|
To approve creating migration ${migrationId}, run:
|
|
14249
|
-
${
|
|
14297
|
+
${chalk129.cyan(" assist db-migration confirm <PIN>")}
|
|
14250
14298
|
using the pin from that notification.`
|
|
14251
14299
|
);
|
|
14252
14300
|
}
|
|
@@ -14266,7 +14314,7 @@ function registerDbMigration(parent) {
|
|
|
14266
14314
|
|
|
14267
14315
|
// src/commands/deploy/redirect.ts
|
|
14268
14316
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14269
|
-
import
|
|
14317
|
+
import chalk130 from "chalk";
|
|
14270
14318
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14271
14319
|
if (!window.location.pathname.endsWith('/')) {
|
|
14272
14320
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14275,23 +14323,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14275
14323
|
function redirect() {
|
|
14276
14324
|
const indexPath = "index.html";
|
|
14277
14325
|
if (!existsSync35(indexPath)) {
|
|
14278
|
-
console.log(
|
|
14326
|
+
console.log(chalk130.yellow("No index.html found"));
|
|
14279
14327
|
return;
|
|
14280
14328
|
}
|
|
14281
14329
|
const content = readFileSync29(indexPath, "utf8");
|
|
14282
14330
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14283
|
-
console.log(
|
|
14331
|
+
console.log(chalk130.dim("Trailing slash script already present"));
|
|
14284
14332
|
return;
|
|
14285
14333
|
}
|
|
14286
14334
|
const headCloseIndex = content.indexOf("</head>");
|
|
14287
14335
|
if (headCloseIndex === -1) {
|
|
14288
|
-
console.log(
|
|
14336
|
+
console.log(chalk130.red("Could not find </head> tag in index.html"));
|
|
14289
14337
|
return;
|
|
14290
14338
|
}
|
|
14291
14339
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14292
14340
|
${content.slice(headCloseIndex)}`;
|
|
14293
14341
|
writeFileSync28(indexPath, newContent);
|
|
14294
|
-
console.log(
|
|
14342
|
+
console.log(chalk130.green("Added trailing slash redirect to index.html"));
|
|
14295
14343
|
}
|
|
14296
14344
|
|
|
14297
14345
|
// src/commands/registerDeploy.ts
|
|
@@ -14318,7 +14366,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14318
14366
|
|
|
14319
14367
|
// src/commands/devlog/shared.ts
|
|
14320
14368
|
import { execSync as execSync33 } from "child_process";
|
|
14321
|
-
import
|
|
14369
|
+
import chalk131 from "chalk";
|
|
14322
14370
|
|
|
14323
14371
|
// src/shared/getRepoName.ts
|
|
14324
14372
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14427,13 +14475,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14427
14475
|
}
|
|
14428
14476
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14429
14477
|
for (const commit2 of commits2) {
|
|
14430
|
-
console.log(` ${
|
|
14478
|
+
console.log(` ${chalk131.yellow(commit2.hash)} ${commit2.message}`);
|
|
14431
14479
|
if (verbose) {
|
|
14432
14480
|
const visibleFiles = commit2.files.filter(
|
|
14433
14481
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14434
14482
|
);
|
|
14435
14483
|
for (const file of visibleFiles) {
|
|
14436
|
-
console.log(` ${
|
|
14484
|
+
console.log(` ${chalk131.dim(file)}`);
|
|
14437
14485
|
}
|
|
14438
14486
|
}
|
|
14439
14487
|
}
|
|
@@ -14458,15 +14506,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14458
14506
|
}
|
|
14459
14507
|
|
|
14460
14508
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14461
|
-
import
|
|
14509
|
+
import chalk132 from "chalk";
|
|
14462
14510
|
function printDateHeader(date, isSkipped, entries) {
|
|
14463
14511
|
if (isSkipped) {
|
|
14464
|
-
console.log(`${
|
|
14512
|
+
console.log(`${chalk132.bold.blue(date)} ${chalk132.dim("skipped")}`);
|
|
14465
14513
|
} else if (entries && entries.length > 0) {
|
|
14466
|
-
const entryInfo = entries.map((e) => `${
|
|
14467
|
-
console.log(`${
|
|
14514
|
+
const entryInfo = entries.map((e) => `${chalk132.green(e.version)} ${e.title}`).join(" | ");
|
|
14515
|
+
console.log(`${chalk132.bold.blue(date)} ${entryInfo}`);
|
|
14468
14516
|
} else {
|
|
14469
|
-
console.log(`${
|
|
14517
|
+
console.log(`${chalk132.bold.blue(date)} ${chalk132.red("\u26A0 devlog missing")}`);
|
|
14470
14518
|
}
|
|
14471
14519
|
}
|
|
14472
14520
|
|
|
@@ -14570,24 +14618,24 @@ function bumpVersion(version2, type) {
|
|
|
14570
14618
|
|
|
14571
14619
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14572
14620
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14573
|
-
import
|
|
14621
|
+
import chalk134 from "chalk";
|
|
14574
14622
|
|
|
14575
14623
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14576
|
-
import
|
|
14624
|
+
import chalk133 from "chalk";
|
|
14577
14625
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14578
14626
|
if (conventional && firstHash) {
|
|
14579
14627
|
const version2 = getVersionAtCommit(firstHash);
|
|
14580
14628
|
if (version2) {
|
|
14581
|
-
console.log(`${
|
|
14629
|
+
console.log(`${chalk133.bold("version:")} ${stripToMinor(version2)}`);
|
|
14582
14630
|
} else {
|
|
14583
|
-
console.log(`${
|
|
14631
|
+
console.log(`${chalk133.bold("version:")} ${chalk133.red("unknown")}`);
|
|
14584
14632
|
}
|
|
14585
14633
|
} else if (patchVersion && minorVersion) {
|
|
14586
14634
|
console.log(
|
|
14587
|
-
`${
|
|
14635
|
+
`${chalk133.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14588
14636
|
);
|
|
14589
14637
|
} else {
|
|
14590
|
-
console.log(`${
|
|
14638
|
+
console.log(`${chalk133.bold("version:")} v0.1 (initial)`);
|
|
14591
14639
|
}
|
|
14592
14640
|
}
|
|
14593
14641
|
|
|
@@ -14635,16 +14683,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14635
14683
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14636
14684
|
}
|
|
14637
14685
|
function logName(repoName) {
|
|
14638
|
-
console.log(`${
|
|
14686
|
+
console.log(`${chalk134.bold("name:")} ${repoName}`);
|
|
14639
14687
|
}
|
|
14640
14688
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14641
14689
|
logName(ctx.repoName);
|
|
14642
14690
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14643
|
-
console.log(
|
|
14691
|
+
console.log(chalk134.bold.blue(targetDate));
|
|
14644
14692
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14645
14693
|
}
|
|
14646
14694
|
function logNoCommits(lastInfo) {
|
|
14647
|
-
console.log(
|
|
14695
|
+
console.log(chalk134.dim(noCommitsMessage(!!lastInfo)));
|
|
14648
14696
|
}
|
|
14649
14697
|
|
|
14650
14698
|
// src/commands/devlog/next/index.ts
|
|
@@ -14685,11 +14733,11 @@ function next2(options2) {
|
|
|
14685
14733
|
import { execSync as execSync35 } from "child_process";
|
|
14686
14734
|
|
|
14687
14735
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14688
|
-
import
|
|
14736
|
+
import chalk135 from "chalk";
|
|
14689
14737
|
function colorStatus(status3) {
|
|
14690
|
-
if (status3 === "missing") return
|
|
14691
|
-
if (status3 === "outdated") return
|
|
14692
|
-
return
|
|
14738
|
+
if (status3 === "missing") return chalk135.red(status3);
|
|
14739
|
+
if (status3 === "outdated") return chalk135.yellow(status3);
|
|
14740
|
+
return chalk135.green(status3);
|
|
14693
14741
|
}
|
|
14694
14742
|
function formatRow(row, nameWidth) {
|
|
14695
14743
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14703,8 +14751,8 @@ function printReposTable(rows) {
|
|
|
14703
14751
|
"Last Devlog".padEnd(11),
|
|
14704
14752
|
"Status"
|
|
14705
14753
|
].join(" ");
|
|
14706
|
-
console.log(
|
|
14707
|
-
console.log(
|
|
14754
|
+
console.log(chalk135.dim(header));
|
|
14755
|
+
console.log(chalk135.dim("-".repeat(header.length)));
|
|
14708
14756
|
for (const row of rows) {
|
|
14709
14757
|
console.log(formatRow(row, nameWidth));
|
|
14710
14758
|
}
|
|
@@ -14762,14 +14810,14 @@ function repos(options2) {
|
|
|
14762
14810
|
// src/commands/devlog/skip.ts
|
|
14763
14811
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14764
14812
|
import { join as join38 } from "path";
|
|
14765
|
-
import
|
|
14813
|
+
import chalk136 from "chalk";
|
|
14766
14814
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14767
14815
|
function getBlogConfigPath() {
|
|
14768
14816
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14769
14817
|
}
|
|
14770
14818
|
function skip(date) {
|
|
14771
14819
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14772
|
-
console.log(
|
|
14820
|
+
console.log(chalk136.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14773
14821
|
process.exit(1);
|
|
14774
14822
|
}
|
|
14775
14823
|
const repoName = getRepoName();
|
|
@@ -14780,7 +14828,7 @@ function skip(date) {
|
|
|
14780
14828
|
const skipDays = skip2[repoName] ?? [];
|
|
14781
14829
|
if (skipDays.includes(date)) {
|
|
14782
14830
|
console.log(
|
|
14783
|
-
|
|
14831
|
+
chalk136.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14784
14832
|
);
|
|
14785
14833
|
return;
|
|
14786
14834
|
}
|
|
@@ -14790,20 +14838,20 @@ function skip(date) {
|
|
|
14790
14838
|
devlog.skip = skip2;
|
|
14791
14839
|
config.devlog = devlog;
|
|
14792
14840
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14793
|
-
console.log(
|
|
14841
|
+
console.log(chalk136.green(`Added ${date} to skip list for ${repoName}`));
|
|
14794
14842
|
}
|
|
14795
14843
|
|
|
14796
14844
|
// src/commands/devlog/version.ts
|
|
14797
|
-
import
|
|
14845
|
+
import chalk137 from "chalk";
|
|
14798
14846
|
function version() {
|
|
14799
14847
|
const config = loadConfig();
|
|
14800
14848
|
const name = getRepoName();
|
|
14801
14849
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14802
14850
|
const lastVersion = lastInfo?.version ?? null;
|
|
14803
14851
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14804
|
-
console.log(`${
|
|
14805
|
-
console.log(`${
|
|
14806
|
-
console.log(`${
|
|
14852
|
+
console.log(`${chalk137.bold("name:")} ${name}`);
|
|
14853
|
+
console.log(`${chalk137.bold("last:")} ${lastVersion ?? chalk137.dim("none")}`);
|
|
14854
|
+
console.log(`${chalk137.bold("next:")} ${nextVersion ?? chalk137.dim("none")}`);
|
|
14807
14855
|
}
|
|
14808
14856
|
|
|
14809
14857
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14847,7 +14895,7 @@ function registerDevlog(program2) {
|
|
|
14847
14895
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14848
14896
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14849
14897
|
import { join as join39 } from "path";
|
|
14850
|
-
import
|
|
14898
|
+
import chalk138 from "chalk";
|
|
14851
14899
|
|
|
14852
14900
|
// src/shared/findRepoRoot.ts
|
|
14853
14901
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14910,14 +14958,14 @@ function checkBuildLocks(startDir) {
|
|
|
14910
14958
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14911
14959
|
if (locked) {
|
|
14912
14960
|
console.error(
|
|
14913
|
-
|
|
14961
|
+
chalk138.red("Build output locked (is VS debugging?): ") + locked
|
|
14914
14962
|
);
|
|
14915
14963
|
process.exit(1);
|
|
14916
14964
|
}
|
|
14917
14965
|
}
|
|
14918
14966
|
async function checkBuildLocksCommand() {
|
|
14919
14967
|
checkBuildLocks();
|
|
14920
|
-
console.log(
|
|
14968
|
+
console.log(chalk138.green("No build locks detected"));
|
|
14921
14969
|
}
|
|
14922
14970
|
|
|
14923
14971
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -15016,30 +15064,30 @@ function escapeRegex(s) {
|
|
|
15016
15064
|
}
|
|
15017
15065
|
|
|
15018
15066
|
// src/commands/dotnet/printTree.ts
|
|
15019
|
-
import
|
|
15067
|
+
import chalk139 from "chalk";
|
|
15020
15068
|
function printNodes(nodes, prefix2) {
|
|
15021
15069
|
for (let i = 0; i < nodes.length; i++) {
|
|
15022
15070
|
const isLast = i === nodes.length - 1;
|
|
15023
15071
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15024
15072
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15025
15073
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15026
|
-
const label2 = isMissing ?
|
|
15074
|
+
const label2 = isMissing ? chalk139.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15027
15075
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15028
15076
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15029
15077
|
}
|
|
15030
15078
|
}
|
|
15031
15079
|
function printTree(tree, totalCount, solutions) {
|
|
15032
|
-
console.log(
|
|
15033
|
-
console.log(
|
|
15080
|
+
console.log(chalk139.bold("\nProject Dependency Tree"));
|
|
15081
|
+
console.log(chalk139.cyan(tree.relativePath));
|
|
15034
15082
|
printNodes(tree.children, "");
|
|
15035
|
-
console.log(
|
|
15083
|
+
console.log(chalk139.dim(`
|
|
15036
15084
|
${totalCount} projects total (including root)`));
|
|
15037
|
-
console.log(
|
|
15085
|
+
console.log(chalk139.bold("\nSolution Membership"));
|
|
15038
15086
|
if (solutions.length === 0) {
|
|
15039
|
-
console.log(
|
|
15087
|
+
console.log(chalk139.yellow(" Not found in any .sln"));
|
|
15040
15088
|
} else {
|
|
15041
15089
|
for (const sln of solutions) {
|
|
15042
|
-
console.log(` ${
|
|
15090
|
+
console.log(` ${chalk139.green(sln)}`);
|
|
15043
15091
|
}
|
|
15044
15092
|
}
|
|
15045
15093
|
console.log();
|
|
@@ -15068,16 +15116,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15068
15116
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15069
15117
|
import { existsSync as existsSync38 } from "fs";
|
|
15070
15118
|
import path33 from "path";
|
|
15071
|
-
import
|
|
15119
|
+
import chalk140 from "chalk";
|
|
15072
15120
|
function resolveCsproj(csprojPath) {
|
|
15073
15121
|
const resolved = path33.resolve(csprojPath);
|
|
15074
15122
|
if (!existsSync38(resolved)) {
|
|
15075
|
-
console.error(
|
|
15123
|
+
console.error(chalk140.red(`File not found: ${resolved}`));
|
|
15076
15124
|
process.exit(1);
|
|
15077
15125
|
}
|
|
15078
15126
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15079
15127
|
if (!repoRoot) {
|
|
15080
|
-
console.error(
|
|
15128
|
+
console.error(chalk140.red("Could not find git repository root"));
|
|
15081
15129
|
process.exit(1);
|
|
15082
15130
|
}
|
|
15083
15131
|
return { resolved, repoRoot };
|
|
@@ -15127,12 +15175,12 @@ function getChangedCsFiles(scope) {
|
|
|
15127
15175
|
}
|
|
15128
15176
|
|
|
15129
15177
|
// src/commands/dotnet/inSln.ts
|
|
15130
|
-
import
|
|
15178
|
+
import chalk141 from "chalk";
|
|
15131
15179
|
async function inSln(csprojPath) {
|
|
15132
15180
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15133
15181
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15134
15182
|
if (solutions.length === 0) {
|
|
15135
|
-
console.log(
|
|
15183
|
+
console.log(chalk141.yellow("Not found in any .sln file"));
|
|
15136
15184
|
process.exit(1);
|
|
15137
15185
|
}
|
|
15138
15186
|
for (const sln of solutions) {
|
|
@@ -15141,7 +15189,7 @@ async function inSln(csprojPath) {
|
|
|
15141
15189
|
}
|
|
15142
15190
|
|
|
15143
15191
|
// src/commands/dotnet/inspect.ts
|
|
15144
|
-
import
|
|
15192
|
+
import chalk147 from "chalk";
|
|
15145
15193
|
|
|
15146
15194
|
// src/shared/formatElapsed.ts
|
|
15147
15195
|
function formatElapsed(ms) {
|
|
@@ -15153,12 +15201,12 @@ function formatElapsed(ms) {
|
|
|
15153
15201
|
}
|
|
15154
15202
|
|
|
15155
15203
|
// src/commands/dotnet/displayIssues.ts
|
|
15156
|
-
import
|
|
15204
|
+
import chalk142 from "chalk";
|
|
15157
15205
|
var SEVERITY_COLOR = {
|
|
15158
|
-
ERROR:
|
|
15159
|
-
WARNING:
|
|
15160
|
-
SUGGESTION:
|
|
15161
|
-
HINT:
|
|
15206
|
+
ERROR: chalk142.red,
|
|
15207
|
+
WARNING: chalk142.yellow,
|
|
15208
|
+
SUGGESTION: chalk142.cyan,
|
|
15209
|
+
HINT: chalk142.dim
|
|
15162
15210
|
};
|
|
15163
15211
|
function groupByFile(issues) {
|
|
15164
15212
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15174,15 +15222,15 @@ function groupByFile(issues) {
|
|
|
15174
15222
|
}
|
|
15175
15223
|
function displayIssues(issues) {
|
|
15176
15224
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15177
|
-
console.log(
|
|
15225
|
+
console.log(chalk142.bold(file));
|
|
15178
15226
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15179
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15227
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk142.white;
|
|
15180
15228
|
console.log(
|
|
15181
|
-
` ${
|
|
15229
|
+
` ${chalk142.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15182
15230
|
);
|
|
15183
15231
|
}
|
|
15184
15232
|
}
|
|
15185
|
-
console.log(
|
|
15233
|
+
console.log(chalk142.dim(`
|
|
15186
15234
|
${issues.length} issue(s) found`));
|
|
15187
15235
|
}
|
|
15188
15236
|
|
|
@@ -15241,12 +15289,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15241
15289
|
// src/commands/dotnet/resolveSolution.ts
|
|
15242
15290
|
import { existsSync as existsSync39 } from "fs";
|
|
15243
15291
|
import path34 from "path";
|
|
15244
|
-
import
|
|
15292
|
+
import chalk144 from "chalk";
|
|
15245
15293
|
|
|
15246
15294
|
// src/commands/dotnet/findSolution.ts
|
|
15247
15295
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15248
15296
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15249
|
-
import
|
|
15297
|
+
import chalk143 from "chalk";
|
|
15250
15298
|
function findSlnInDir(dir) {
|
|
15251
15299
|
try {
|
|
15252
15300
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15262,17 +15310,17 @@ function findSolution() {
|
|
|
15262
15310
|
const slnFiles = findSlnInDir(current);
|
|
15263
15311
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15264
15312
|
if (slnFiles.length > 1) {
|
|
15265
|
-
console.error(
|
|
15313
|
+
console.error(chalk143.red(`Multiple .sln files found in ${current}:`));
|
|
15266
15314
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15267
15315
|
console.error(
|
|
15268
|
-
|
|
15316
|
+
chalk143.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15269
15317
|
);
|
|
15270
15318
|
process.exit(1);
|
|
15271
15319
|
}
|
|
15272
15320
|
if (current === ceiling) break;
|
|
15273
15321
|
current = dirname22(current);
|
|
15274
15322
|
}
|
|
15275
|
-
console.error(
|
|
15323
|
+
console.error(chalk143.red("No .sln file found between cwd and repo root"));
|
|
15276
15324
|
process.exit(1);
|
|
15277
15325
|
}
|
|
15278
15326
|
|
|
@@ -15281,7 +15329,7 @@ function resolveSolution(sln) {
|
|
|
15281
15329
|
if (sln) {
|
|
15282
15330
|
const resolved = path34.resolve(sln);
|
|
15283
15331
|
if (!existsSync39(resolved)) {
|
|
15284
|
-
console.error(
|
|
15332
|
+
console.error(chalk144.red(`Solution file not found: ${resolved}`));
|
|
15285
15333
|
process.exit(1);
|
|
15286
15334
|
}
|
|
15287
15335
|
return resolved;
|
|
@@ -15323,14 +15371,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15323
15371
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15324
15372
|
import { tmpdir as tmpdir3 } from "os";
|
|
15325
15373
|
import path35 from "path";
|
|
15326
|
-
import
|
|
15374
|
+
import chalk145 from "chalk";
|
|
15327
15375
|
function assertJbInstalled() {
|
|
15328
15376
|
try {
|
|
15329
15377
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15330
15378
|
} catch {
|
|
15331
|
-
console.error(
|
|
15379
|
+
console.error(chalk145.red("jb is not installed. Install with:"));
|
|
15332
15380
|
console.error(
|
|
15333
|
-
|
|
15381
|
+
chalk145.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15334
15382
|
);
|
|
15335
15383
|
process.exit(1);
|
|
15336
15384
|
}
|
|
@@ -15348,11 +15396,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15348
15396
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15349
15397
|
process.stderr.write(error.stderr);
|
|
15350
15398
|
}
|
|
15351
|
-
console.error(
|
|
15399
|
+
console.error(chalk145.red("jb inspectcode failed"));
|
|
15352
15400
|
process.exit(1);
|
|
15353
15401
|
}
|
|
15354
15402
|
if (!existsSync40(reportPath)) {
|
|
15355
|
-
console.error(
|
|
15403
|
+
console.error(chalk145.red("Report file not generated"));
|
|
15356
15404
|
process.exit(1);
|
|
15357
15405
|
}
|
|
15358
15406
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15362,7 +15410,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15362
15410
|
|
|
15363
15411
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15364
15412
|
import { execSync as execSync38 } from "child_process";
|
|
15365
|
-
import
|
|
15413
|
+
import chalk146 from "chalk";
|
|
15366
15414
|
function resolveMsbuildPath() {
|
|
15367
15415
|
const { run: run4 } = loadConfig();
|
|
15368
15416
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15374,9 +15422,9 @@ function assertMsbuildInstalled() {
|
|
|
15374
15422
|
try {
|
|
15375
15423
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15376
15424
|
} catch {
|
|
15377
|
-
console.error(
|
|
15425
|
+
console.error(chalk146.red(`msbuild not found at: ${msbuild}`));
|
|
15378
15426
|
console.error(
|
|
15379
|
-
|
|
15427
|
+
chalk146.yellow(
|
|
15380
15428
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15381
15429
|
)
|
|
15382
15430
|
);
|
|
@@ -15423,17 +15471,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15423
15471
|
// src/commands/dotnet/inspect.ts
|
|
15424
15472
|
function logScope(changedFiles) {
|
|
15425
15473
|
if (changedFiles === null) {
|
|
15426
|
-
console.log(
|
|
15474
|
+
console.log(chalk147.dim("Inspecting full solution..."));
|
|
15427
15475
|
} else {
|
|
15428
15476
|
console.log(
|
|
15429
|
-
|
|
15477
|
+
chalk147.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15430
15478
|
);
|
|
15431
15479
|
}
|
|
15432
15480
|
}
|
|
15433
15481
|
function reportResults(issues, elapsed) {
|
|
15434
15482
|
if (issues.length > 0) displayIssues(issues);
|
|
15435
|
-
else console.log(
|
|
15436
|
-
console.log(
|
|
15483
|
+
else console.log(chalk147.green("No issues found"));
|
|
15484
|
+
console.log(chalk147.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15437
15485
|
if (issues.length > 0) process.exit(1);
|
|
15438
15486
|
}
|
|
15439
15487
|
async function inspect(sln, options2) {
|
|
@@ -15444,7 +15492,7 @@ async function inspect(sln, options2) {
|
|
|
15444
15492
|
const scope = parseScope(options2.scope);
|
|
15445
15493
|
const changedFiles = getChangedCsFiles(scope);
|
|
15446
15494
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15447
|
-
console.log(
|
|
15495
|
+
console.log(chalk147.green("No changed .cs files found"));
|
|
15448
15496
|
return;
|
|
15449
15497
|
}
|
|
15450
15498
|
logScope(changedFiles);
|
|
@@ -15827,25 +15875,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15827
15875
|
}
|
|
15828
15876
|
|
|
15829
15877
|
// src/commands/github/printCountTable.ts
|
|
15830
|
-
import
|
|
15878
|
+
import chalk148 from "chalk";
|
|
15831
15879
|
function printCountTable(labelHeader, rows) {
|
|
15832
15880
|
const labelWidth = Math.max(
|
|
15833
15881
|
labelHeader.length,
|
|
15834
15882
|
...rows.map((row) => row.label.length)
|
|
15835
15883
|
);
|
|
15836
15884
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15837
|
-
console.log(
|
|
15838
|
-
console.log(
|
|
15885
|
+
console.log(chalk148.dim(header));
|
|
15886
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
15839
15887
|
for (const row of rows) {
|
|
15840
15888
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15841
15889
|
}
|
|
15842
15890
|
}
|
|
15843
15891
|
|
|
15844
15892
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15845
|
-
import
|
|
15893
|
+
import chalk149 from "chalk";
|
|
15846
15894
|
function printRepoAuthorBreakdown(repos2) {
|
|
15847
15895
|
for (const repo of repos2) {
|
|
15848
|
-
console.log(
|
|
15896
|
+
console.log(chalk149.bold(repo.name));
|
|
15849
15897
|
const authorWidth = Math.max(
|
|
15850
15898
|
0,
|
|
15851
15899
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16163,7 +16211,7 @@ function registerHandover(program2) {
|
|
|
16163
16211
|
}
|
|
16164
16212
|
|
|
16165
16213
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16166
|
-
import
|
|
16214
|
+
import chalk150 from "chalk";
|
|
16167
16215
|
|
|
16168
16216
|
// src/commands/jira/adfToText.ts
|
|
16169
16217
|
function renderInline(node) {
|
|
@@ -16230,7 +16278,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16230
16278
|
const parsed = fetchIssue(issueKey, field);
|
|
16231
16279
|
const acValue = parsed?.fields?.[field];
|
|
16232
16280
|
if (!acValue) {
|
|
16233
|
-
console.log(
|
|
16281
|
+
console.log(chalk150.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16234
16282
|
return;
|
|
16235
16283
|
}
|
|
16236
16284
|
if (typeof acValue === "string") {
|
|
@@ -16296,14 +16344,14 @@ async function jiraAuth() {
|
|
|
16296
16344
|
}
|
|
16297
16345
|
|
|
16298
16346
|
// src/commands/jira/viewIssue.ts
|
|
16299
|
-
import
|
|
16347
|
+
import chalk151 from "chalk";
|
|
16300
16348
|
function viewIssue(issueKey) {
|
|
16301
16349
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16302
16350
|
const fields = parsed?.fields;
|
|
16303
16351
|
const summary = fields?.summary;
|
|
16304
16352
|
const description = fields?.description;
|
|
16305
16353
|
if (summary) {
|
|
16306
|
-
console.log(
|
|
16354
|
+
console.log(chalk151.bold(summary));
|
|
16307
16355
|
}
|
|
16308
16356
|
if (description) {
|
|
16309
16357
|
if (summary) console.log();
|
|
@@ -16317,7 +16365,7 @@ function viewIssue(issueKey) {
|
|
|
16317
16365
|
}
|
|
16318
16366
|
if (!summary && !description) {
|
|
16319
16367
|
console.log(
|
|
16320
|
-
|
|
16368
|
+
chalk151.yellow(`No summary or description found on ${issueKey}.`)
|
|
16321
16369
|
);
|
|
16322
16370
|
}
|
|
16323
16371
|
}
|
|
@@ -16373,13 +16421,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16373
16421
|
// src/commands/reviewPrComments.ts
|
|
16374
16422
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16375
16423
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16376
|
-
import
|
|
16424
|
+
import chalk152 from "chalk";
|
|
16377
16425
|
async function reviewPrComments(number) {
|
|
16378
16426
|
if (number) {
|
|
16379
16427
|
try {
|
|
16380
16428
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16381
16429
|
} catch {
|
|
16382
|
-
console.error(
|
|
16430
|
+
console.error(chalk152.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16383
16431
|
process.exit(1);
|
|
16384
16432
|
}
|
|
16385
16433
|
}
|
|
@@ -16452,15 +16500,15 @@ function registerList(program2) {
|
|
|
16452
16500
|
// src/commands/mermaid/index.ts
|
|
16453
16501
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16454
16502
|
import { resolve as resolve12 } from "path";
|
|
16455
|
-
import
|
|
16503
|
+
import chalk155 from "chalk";
|
|
16456
16504
|
|
|
16457
16505
|
// src/commands/mermaid/exportFile.ts
|
|
16458
16506
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16459
16507
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16460
|
-
import
|
|
16508
|
+
import chalk154 from "chalk";
|
|
16461
16509
|
|
|
16462
16510
|
// src/commands/mermaid/renderBlock.ts
|
|
16463
|
-
import
|
|
16511
|
+
import chalk153 from "chalk";
|
|
16464
16512
|
async function renderBlock(krokiUrl, source) {
|
|
16465
16513
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16466
16514
|
method: "POST",
|
|
@@ -16469,7 +16517,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16469
16517
|
});
|
|
16470
16518
|
if (!response.ok) {
|
|
16471
16519
|
console.error(
|
|
16472
|
-
|
|
16520
|
+
chalk153.red(
|
|
16473
16521
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16474
16522
|
)
|
|
16475
16523
|
);
|
|
@@ -16487,19 +16535,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16487
16535
|
if (onlyIndex !== void 0) {
|
|
16488
16536
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16489
16537
|
console.error(
|
|
16490
|
-
|
|
16538
|
+
chalk154.red(
|
|
16491
16539
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16492
16540
|
)
|
|
16493
16541
|
);
|
|
16494
16542
|
process.exit(1);
|
|
16495
16543
|
}
|
|
16496
16544
|
console.log(
|
|
16497
|
-
|
|
16545
|
+
chalk154.gray(
|
|
16498
16546
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16499
16547
|
)
|
|
16500
16548
|
);
|
|
16501
16549
|
} else {
|
|
16502
|
-
console.log(
|
|
16550
|
+
console.log(chalk154.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16503
16551
|
}
|
|
16504
16552
|
for (const [i, source] of blocks.entries()) {
|
|
16505
16553
|
const idx = i + 1;
|
|
@@ -16507,7 +16555,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16507
16555
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16508
16556
|
const svg = await renderBlock(krokiUrl, source);
|
|
16509
16557
|
writeFileSync31(outPath, svg, "utf8");
|
|
16510
|
-
console.log(
|
|
16558
|
+
console.log(chalk154.green(` \u2192 ${outPath}`));
|
|
16511
16559
|
}
|
|
16512
16560
|
}
|
|
16513
16561
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16523,18 +16571,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16523
16571
|
if (options2.index !== void 0) {
|
|
16524
16572
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16525
16573
|
console.error(
|
|
16526
|
-
|
|
16574
|
+
chalk155.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16527
16575
|
);
|
|
16528
16576
|
process.exit(1);
|
|
16529
16577
|
}
|
|
16530
16578
|
if (!file) {
|
|
16531
|
-
console.error(
|
|
16579
|
+
console.error(chalk155.red("--index requires a file argument"));
|
|
16532
16580
|
process.exit(1);
|
|
16533
16581
|
}
|
|
16534
16582
|
}
|
|
16535
16583
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16536
16584
|
if (files.length === 0) {
|
|
16537
|
-
console.log(
|
|
16585
|
+
console.log(chalk155.gray("No markdown files found in current directory."));
|
|
16538
16586
|
return;
|
|
16539
16587
|
}
|
|
16540
16588
|
for (const f of files) {
|
|
@@ -16567,7 +16615,7 @@ function registerMermaid(program2) {
|
|
|
16567
16615
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16568
16616
|
import { createServer as createServer2 } from "http";
|
|
16569
16617
|
import { dirname as dirname24 } from "path";
|
|
16570
|
-
import
|
|
16618
|
+
import chalk157 from "chalk";
|
|
16571
16619
|
|
|
16572
16620
|
// src/commands/netcap/corsHeaders.ts
|
|
16573
16621
|
var corsHeaders = {
|
|
@@ -16646,7 +16694,7 @@ function createNetcapHandler(options2) {
|
|
|
16646
16694
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16647
16695
|
import { networkInterfaces } from "os";
|
|
16648
16696
|
import { join as join46 } from "path";
|
|
16649
|
-
import
|
|
16697
|
+
import chalk156 from "chalk";
|
|
16650
16698
|
|
|
16651
16699
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16652
16700
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16690,7 +16738,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16690
16738
|
const host = lanIPv4();
|
|
16691
16739
|
if (!host) {
|
|
16692
16740
|
console.log(
|
|
16693
|
-
|
|
16741
|
+
chalk156.yellow("could not determine the WSL IP for the extension")
|
|
16694
16742
|
);
|
|
16695
16743
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16696
16744
|
return source;
|
|
@@ -16701,7 +16749,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16701
16749
|
return WSL_WINDOWS_PATH;
|
|
16702
16750
|
} catch {
|
|
16703
16751
|
console.log(
|
|
16704
|
-
|
|
16752
|
+
chalk156.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16705
16753
|
);
|
|
16706
16754
|
return source;
|
|
16707
16755
|
}
|
|
@@ -16734,30 +16782,30 @@ async function netcap(options2) {
|
|
|
16734
16782
|
let count7 = 0;
|
|
16735
16783
|
const handler = createNetcapHandler({
|
|
16736
16784
|
outPath,
|
|
16737
|
-
onPing: () => console.log(
|
|
16785
|
+
onPing: () => console.log(chalk157.dim("ping from extension")),
|
|
16738
16786
|
onCapture: (entry) => {
|
|
16739
16787
|
count7 += 1;
|
|
16740
16788
|
console.log(
|
|
16741
|
-
|
|
16742
|
-
|
|
16789
|
+
chalk157.green(`captured #${count7}`),
|
|
16790
|
+
chalk157.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16743
16791
|
);
|
|
16744
16792
|
}
|
|
16745
16793
|
});
|
|
16746
16794
|
const server = createServer2(handler);
|
|
16747
16795
|
server.listen(port, () => {
|
|
16748
16796
|
console.log(
|
|
16749
|
-
|
|
16797
|
+
chalk157.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16750
16798
|
);
|
|
16751
|
-
console.log(
|
|
16799
|
+
console.log(chalk157.dim(`appending captures to ${outPath}`));
|
|
16752
16800
|
if (filter)
|
|
16753
|
-
console.log(
|
|
16754
|
-
console.log(
|
|
16755
|
-
console.log(
|
|
16801
|
+
console.log(chalk157.dim(`forwarding only URLs matching "${filter}"`));
|
|
16802
|
+
console.log(chalk157.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16803
|
+
console.log(chalk157.dim("press Ctrl-C to stop"));
|
|
16756
16804
|
});
|
|
16757
16805
|
process.on("SIGINT", () => {
|
|
16758
16806
|
server.close();
|
|
16759
16807
|
console.log(
|
|
16760
|
-
|
|
16808
|
+
chalk157.bold(
|
|
16761
16809
|
`
|
|
16762
16810
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16763
16811
|
)
|
|
@@ -16769,7 +16817,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16769
16817
|
// src/commands/netcap/netcapExtract.ts
|
|
16770
16818
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16771
16819
|
import { join as join49 } from "path";
|
|
16772
|
-
import
|
|
16820
|
+
import chalk158 from "chalk";
|
|
16773
16821
|
|
|
16774
16822
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16775
16823
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17217,8 +17265,8 @@ function netcapExtract(file) {
|
|
|
17217
17265
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17218
17266
|
`);
|
|
17219
17267
|
console.log(
|
|
17220
|
-
|
|
17221
|
-
|
|
17268
|
+
chalk158.green(`extracted ${posts.length} posts`),
|
|
17269
|
+
chalk158.dim(`-> ${outFile}`)
|
|
17222
17270
|
);
|
|
17223
17271
|
}
|
|
17224
17272
|
|
|
@@ -17239,7 +17287,7 @@ function registerNetcap(program2) {
|
|
|
17239
17287
|
}
|
|
17240
17288
|
|
|
17241
17289
|
// src/commands/news/add/index.ts
|
|
17242
|
-
import
|
|
17290
|
+
import chalk159 from "chalk";
|
|
17243
17291
|
import enquirer8 from "enquirer";
|
|
17244
17292
|
async function add2(url) {
|
|
17245
17293
|
if (!url) {
|
|
@@ -17261,10 +17309,10 @@ async function add2(url) {
|
|
|
17261
17309
|
const { orm } = await getReady();
|
|
17262
17310
|
const added = await addFeed(orm, url);
|
|
17263
17311
|
if (!added) {
|
|
17264
|
-
console.log(
|
|
17312
|
+
console.log(chalk159.yellow("Feed already exists"));
|
|
17265
17313
|
return;
|
|
17266
17314
|
}
|
|
17267
|
-
console.log(
|
|
17315
|
+
console.log(chalk159.green(`Added feed: ${url}`));
|
|
17268
17316
|
}
|
|
17269
17317
|
|
|
17270
17318
|
// src/commands/registerNews.ts
|
|
@@ -17311,7 +17359,7 @@ function registerPiHook(program2) {
|
|
|
17311
17359
|
}
|
|
17312
17360
|
|
|
17313
17361
|
// src/commands/prompts/printPromptsTable.ts
|
|
17314
|
-
import
|
|
17362
|
+
import chalk160 from "chalk";
|
|
17315
17363
|
function truncate(str, max) {
|
|
17316
17364
|
if (str.length <= max) return str;
|
|
17317
17365
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17329,14 +17377,14 @@ function printPromptsTable(rows) {
|
|
|
17329
17377
|
"Command".padEnd(commandWidth),
|
|
17330
17378
|
"Repos"
|
|
17331
17379
|
].join(" ");
|
|
17332
|
-
console.log(
|
|
17333
|
-
console.log(
|
|
17380
|
+
console.log(chalk160.dim(header));
|
|
17381
|
+
console.log(chalk160.dim("-".repeat(header.length)));
|
|
17334
17382
|
for (const row of rows) {
|
|
17335
17383
|
const count7 = String(row.count).padStart(countWidth);
|
|
17336
17384
|
const tool = row.tool.padEnd(toolWidth);
|
|
17337
17385
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17338
17386
|
console.log(
|
|
17339
|
-
`${
|
|
17387
|
+
`${chalk160.yellow(count7)} ${tool} ${command} ${chalk160.dim(row.repos)}`
|
|
17340
17388
|
);
|
|
17341
17389
|
}
|
|
17342
17390
|
}
|
|
@@ -17903,20 +17951,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17903
17951
|
}
|
|
17904
17952
|
|
|
17905
17953
|
// src/commands/prs/listComments/printComments.ts
|
|
17906
|
-
import
|
|
17954
|
+
import chalk161 from "chalk";
|
|
17907
17955
|
function formatForHuman(comment3) {
|
|
17908
17956
|
if (comment3.type === "review") {
|
|
17909
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17957
|
+
const stateColor = comment3.state === "APPROVED" ? chalk161.green : comment3.state === "CHANGES_REQUESTED" ? chalk161.red : chalk161.yellow;
|
|
17910
17958
|
return [
|
|
17911
|
-
`${
|
|
17959
|
+
`${chalk161.cyan("Review")} by ${chalk161.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17912
17960
|
comment3.body,
|
|
17913
17961
|
""
|
|
17914
17962
|
].join("\n");
|
|
17915
17963
|
}
|
|
17916
17964
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17917
17965
|
return [
|
|
17918
|
-
`${
|
|
17919
|
-
|
|
17966
|
+
`${chalk161.cyan("Line comment")} by ${chalk161.bold(comment3.user)} on ${chalk161.dim(`${comment3.path}${location}`)}`,
|
|
17967
|
+
chalk161.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17920
17968
|
comment3.body,
|
|
17921
17969
|
""
|
|
17922
17970
|
].join("\n");
|
|
@@ -18006,13 +18054,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18006
18054
|
import enquirer9 from "enquirer";
|
|
18007
18055
|
|
|
18008
18056
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18009
|
-
import
|
|
18057
|
+
import chalk162 from "chalk";
|
|
18010
18058
|
var STATUS_MAP = {
|
|
18011
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18012
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18059
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk162.magenta("merged"), date: pr.mergedAt } : null,
|
|
18060
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk162.red("closed"), date: pr.closedAt } : null
|
|
18013
18061
|
};
|
|
18014
18062
|
function defaultStatus(pr) {
|
|
18015
|
-
return { label:
|
|
18063
|
+
return { label: chalk162.green("opened"), date: pr.createdAt };
|
|
18016
18064
|
}
|
|
18017
18065
|
function getStatus2(pr) {
|
|
18018
18066
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18021,11 +18069,11 @@ function formatDate(dateStr) {
|
|
|
18021
18069
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18022
18070
|
}
|
|
18023
18071
|
function formatPrHeader(pr, status3) {
|
|
18024
|
-
return `${
|
|
18072
|
+
return `${chalk162.cyan(`#${pr.number}`)} ${pr.title} ${chalk162.dim(`(${pr.author.login},`)} ${status3.label} ${chalk162.dim(`${formatDate(status3.date)})`)}`;
|
|
18025
18073
|
}
|
|
18026
18074
|
function logPrDetails(pr) {
|
|
18027
18075
|
console.log(
|
|
18028
|
-
|
|
18076
|
+
chalk162.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18029
18077
|
);
|
|
18030
18078
|
console.log();
|
|
18031
18079
|
}
|
|
@@ -18592,10 +18640,10 @@ function registerPrs(program2) {
|
|
|
18592
18640
|
}
|
|
18593
18641
|
|
|
18594
18642
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18595
|
-
import
|
|
18643
|
+
import chalk168 from "chalk";
|
|
18596
18644
|
|
|
18597
18645
|
// src/shared/createConnectionAuth.ts
|
|
18598
|
-
import
|
|
18646
|
+
import chalk163 from "chalk";
|
|
18599
18647
|
function listConnections(connections, format) {
|
|
18600
18648
|
if (connections.length === 0) {
|
|
18601
18649
|
console.log("No connections configured.");
|
|
@@ -18608,7 +18656,7 @@ function listConnections(connections, format) {
|
|
|
18608
18656
|
function removeConnection(connections, name, save) {
|
|
18609
18657
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18610
18658
|
if (filtered.length === connections.length) {
|
|
18611
|
-
console.error(
|
|
18659
|
+
console.error(chalk163.red(`Connection "${name}" not found.`));
|
|
18612
18660
|
process.exit(1);
|
|
18613
18661
|
}
|
|
18614
18662
|
save(filtered);
|
|
@@ -18654,15 +18702,15 @@ function saveConnections(connections) {
|
|
|
18654
18702
|
}
|
|
18655
18703
|
|
|
18656
18704
|
// src/commands/ravendb/promptConnection.ts
|
|
18657
|
-
import
|
|
18705
|
+
import chalk166 from "chalk";
|
|
18658
18706
|
|
|
18659
18707
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18660
|
-
import
|
|
18708
|
+
import chalk165 from "chalk";
|
|
18661
18709
|
import Enquirer2 from "enquirer";
|
|
18662
18710
|
|
|
18663
18711
|
// src/commands/ravendb/searchItems.ts
|
|
18664
18712
|
import { execSync as execSync49 } from "child_process";
|
|
18665
|
-
import
|
|
18713
|
+
import chalk164 from "chalk";
|
|
18666
18714
|
function opExec(args) {
|
|
18667
18715
|
return execSync49(`op ${args}`, {
|
|
18668
18716
|
encoding: "utf8",
|
|
@@ -18675,7 +18723,7 @@ function searchItems(search2) {
|
|
|
18675
18723
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18676
18724
|
} catch {
|
|
18677
18725
|
console.error(
|
|
18678
|
-
|
|
18726
|
+
chalk164.red(
|
|
18679
18727
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18680
18728
|
)
|
|
18681
18729
|
);
|
|
@@ -18689,7 +18737,7 @@ function getItemFields(itemId2) {
|
|
|
18689
18737
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18690
18738
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18691
18739
|
} catch {
|
|
18692
|
-
console.error(
|
|
18740
|
+
console.error(chalk164.red("Failed to get item details from 1Password."));
|
|
18693
18741
|
process.exit(1);
|
|
18694
18742
|
}
|
|
18695
18743
|
}
|
|
@@ -18708,7 +18756,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18708
18756
|
}).run();
|
|
18709
18757
|
const items2 = searchItems(search2);
|
|
18710
18758
|
if (items2.length === 0) {
|
|
18711
|
-
console.error(
|
|
18759
|
+
console.error(chalk165.red(`No items found matching "${search2}".`));
|
|
18712
18760
|
process.exit(1);
|
|
18713
18761
|
}
|
|
18714
18762
|
const itemId2 = await selectOne(
|
|
@@ -18717,7 +18765,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18717
18765
|
);
|
|
18718
18766
|
const fields = getItemFields(itemId2);
|
|
18719
18767
|
if (fields.length === 0) {
|
|
18720
|
-
console.error(
|
|
18768
|
+
console.error(chalk165.red("No fields with references found on this item."));
|
|
18721
18769
|
process.exit(1);
|
|
18722
18770
|
}
|
|
18723
18771
|
const ref = await selectOne(
|
|
@@ -18731,7 +18779,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18731
18779
|
async function promptConnection(existingNames) {
|
|
18732
18780
|
const name = await promptInput("name", "Connection name:");
|
|
18733
18781
|
if (existingNames.includes(name)) {
|
|
18734
|
-
console.error(
|
|
18782
|
+
console.error(chalk166.red(`Connection "${name}" already exists.`));
|
|
18735
18783
|
process.exit(1);
|
|
18736
18784
|
}
|
|
18737
18785
|
const url = await promptInput(
|
|
@@ -18740,22 +18788,22 @@ async function promptConnection(existingNames) {
|
|
|
18740
18788
|
);
|
|
18741
18789
|
const database = await promptInput("database", "Database name:");
|
|
18742
18790
|
if (!name || !url || !database) {
|
|
18743
|
-
console.error(
|
|
18791
|
+
console.error(chalk166.red("All fields are required."));
|
|
18744
18792
|
process.exit(1);
|
|
18745
18793
|
}
|
|
18746
18794
|
const apiKeyRef = await selectOpSecret();
|
|
18747
|
-
console.log(
|
|
18795
|
+
console.log(chalk166.dim(`Using: ${apiKeyRef}`));
|
|
18748
18796
|
return { name, url, database, apiKeyRef };
|
|
18749
18797
|
}
|
|
18750
18798
|
|
|
18751
18799
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18752
|
-
import
|
|
18800
|
+
import chalk167 from "chalk";
|
|
18753
18801
|
function ravendbSetConnection(name) {
|
|
18754
18802
|
const raw = loadGlobalConfigRaw();
|
|
18755
18803
|
const ravendb = raw.ravendb ?? {};
|
|
18756
18804
|
const connections = ravendb.connections ?? [];
|
|
18757
18805
|
if (!connections.some((c) => c.name === name)) {
|
|
18758
|
-
console.error(
|
|
18806
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
18759
18807
|
console.error(
|
|
18760
18808
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18761
18809
|
);
|
|
@@ -18771,16 +18819,16 @@ function ravendbSetConnection(name) {
|
|
|
18771
18819
|
var ravendbAuth = createConnectionAuth({
|
|
18772
18820
|
load: loadConnections,
|
|
18773
18821
|
save: saveConnections,
|
|
18774
|
-
format: (c) => `${
|
|
18822
|
+
format: (c) => `${chalk168.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18775
18823
|
promptNew: promptConnection,
|
|
18776
18824
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18777
18825
|
});
|
|
18778
18826
|
|
|
18779
18827
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18780
|
-
import
|
|
18828
|
+
import chalk172 from "chalk";
|
|
18781
18829
|
|
|
18782
18830
|
// src/commands/ravendb/ravenFetch.ts
|
|
18783
|
-
import
|
|
18831
|
+
import chalk170 from "chalk";
|
|
18784
18832
|
|
|
18785
18833
|
// src/commands/ravendb/getAccessToken.ts
|
|
18786
18834
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18817,10 +18865,10 @@ ${errorText}`
|
|
|
18817
18865
|
|
|
18818
18866
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18819
18867
|
import { execSync as execSync50 } from "child_process";
|
|
18820
|
-
import
|
|
18868
|
+
import chalk169 from "chalk";
|
|
18821
18869
|
function resolveOpSecret(reference) {
|
|
18822
18870
|
if (!reference.startsWith("op://")) {
|
|
18823
|
-
console.error(
|
|
18871
|
+
console.error(chalk169.red(`Invalid secret reference: must start with op://`));
|
|
18824
18872
|
process.exit(1);
|
|
18825
18873
|
}
|
|
18826
18874
|
try {
|
|
@@ -18830,7 +18878,7 @@ function resolveOpSecret(reference) {
|
|
|
18830
18878
|
}).trim();
|
|
18831
18879
|
} catch {
|
|
18832
18880
|
console.error(
|
|
18833
|
-
|
|
18881
|
+
chalk169.red(
|
|
18834
18882
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18835
18883
|
)
|
|
18836
18884
|
);
|
|
@@ -18857,7 +18905,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18857
18905
|
if (!response.ok) {
|
|
18858
18906
|
const body = await response.text();
|
|
18859
18907
|
console.error(
|
|
18860
|
-
|
|
18908
|
+
chalk170.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18861
18909
|
);
|
|
18862
18910
|
console.error(body.substring(0, 500));
|
|
18863
18911
|
process.exit(1);
|
|
@@ -18866,7 +18914,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18866
18914
|
}
|
|
18867
18915
|
|
|
18868
18916
|
// src/commands/ravendb/resolveConnection.ts
|
|
18869
|
-
import
|
|
18917
|
+
import chalk171 from "chalk";
|
|
18870
18918
|
function loadRavendb() {
|
|
18871
18919
|
const raw = loadGlobalConfigRaw();
|
|
18872
18920
|
const ravendb = raw.ravendb;
|
|
@@ -18880,7 +18928,7 @@ function resolveConnection(name) {
|
|
|
18880
18928
|
const connectionName = name ?? defaultConnection;
|
|
18881
18929
|
if (!connectionName) {
|
|
18882
18930
|
console.error(
|
|
18883
|
-
|
|
18931
|
+
chalk171.red(
|
|
18884
18932
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18885
18933
|
)
|
|
18886
18934
|
);
|
|
@@ -18888,7 +18936,7 @@ function resolveConnection(name) {
|
|
|
18888
18936
|
}
|
|
18889
18937
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18890
18938
|
if (!connection) {
|
|
18891
|
-
console.error(
|
|
18939
|
+
console.error(chalk171.red(`Connection "${connectionName}" not found.`));
|
|
18892
18940
|
console.error(
|
|
18893
18941
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18894
18942
|
);
|
|
@@ -18919,7 +18967,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18919
18967
|
return;
|
|
18920
18968
|
}
|
|
18921
18969
|
for (const c of collections) {
|
|
18922
|
-
console.log(`${
|
|
18970
|
+
console.log(`${chalk172.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18923
18971
|
}
|
|
18924
18972
|
}
|
|
18925
18973
|
|
|
@@ -18938,10 +18986,10 @@ var ravendbConfigHelp = [
|
|
|
18938
18986
|
];
|
|
18939
18987
|
|
|
18940
18988
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18941
|
-
import
|
|
18989
|
+
import chalk174 from "chalk";
|
|
18942
18990
|
|
|
18943
18991
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18944
|
-
import
|
|
18992
|
+
import chalk173 from "chalk";
|
|
18945
18993
|
|
|
18946
18994
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18947
18995
|
function buildQueryPath(opts) {
|
|
@@ -18979,7 +19027,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18979
19027
|
allResults.push(...results);
|
|
18980
19028
|
start3 += results.length;
|
|
18981
19029
|
process.stderr.write(
|
|
18982
|
-
`\r${
|
|
19030
|
+
`\r${chalk173.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18983
19031
|
);
|
|
18984
19032
|
if (start3 >= totalResults) break;
|
|
18985
19033
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18994,7 +19042,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18994
19042
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18995
19043
|
const resolved = resolveArgs(connectionName, collection);
|
|
18996
19044
|
if (!resolved.collection && !options2.query) {
|
|
18997
|
-
console.error(
|
|
19045
|
+
console.error(chalk174.red("Provide a collection name or --query filter."));
|
|
18998
19046
|
process.exit(1);
|
|
18999
19047
|
}
|
|
19000
19048
|
const { collection: col } = resolved;
|
|
@@ -19033,7 +19081,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19033
19081
|
import * as path36 from "path";
|
|
19034
19082
|
|
|
19035
19083
|
// src/commands/refactor/logViolations.ts
|
|
19036
|
-
import
|
|
19084
|
+
import chalk175 from "chalk";
|
|
19037
19085
|
var DEFAULT_MAX_LINES = 100;
|
|
19038
19086
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19039
19087
|
if (violations.length === 0) {
|
|
@@ -19042,43 +19090,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19042
19090
|
}
|
|
19043
19091
|
return;
|
|
19044
19092
|
}
|
|
19045
|
-
console.error(
|
|
19093
|
+
console.error(chalk175.red(`
|
|
19046
19094
|
Refactor check failed:
|
|
19047
19095
|
`));
|
|
19048
|
-
console.error(
|
|
19096
|
+
console.error(chalk175.red(` The following files exceed ${maxLines} lines:
|
|
19049
19097
|
`));
|
|
19050
19098
|
for (const violation of violations) {
|
|
19051
|
-
console.error(
|
|
19099
|
+
console.error(chalk175.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19052
19100
|
}
|
|
19053
19101
|
console.error(
|
|
19054
|
-
|
|
19102
|
+
chalk175.yellow(
|
|
19055
19103
|
`
|
|
19056
19104
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19057
19105
|
way to refactor it, ignore it with:
|
|
19058
19106
|
`
|
|
19059
19107
|
)
|
|
19060
19108
|
);
|
|
19061
|
-
console.error(
|
|
19109
|
+
console.error(chalk175.gray(` assist refactor ignore <file>
|
|
19062
19110
|
`));
|
|
19063
19111
|
if (process.env.CLAUDECODE) {
|
|
19064
|
-
console.error(
|
|
19112
|
+
console.error(chalk175.cyan(`
|
|
19065
19113
|
## Extracting Code to New Files
|
|
19066
19114
|
`));
|
|
19067
19115
|
console.error(
|
|
19068
|
-
|
|
19116
|
+
chalk175.cyan(
|
|
19069
19117
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19070
19118
|
`
|
|
19071
19119
|
)
|
|
19072
19120
|
);
|
|
19073
19121
|
console.error(
|
|
19074
|
-
|
|
19122
|
+
chalk175.cyan(
|
|
19075
19123
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19076
19124
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19077
19125
|
`
|
|
19078
19126
|
)
|
|
19079
19127
|
);
|
|
19080
19128
|
console.error(
|
|
19081
|
-
|
|
19129
|
+
chalk175.cyan(
|
|
19082
19130
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19083
19131
|
domains, move it to a common/shared folder.
|
|
19084
19132
|
`
|
|
@@ -19234,7 +19282,7 @@ async function check(pattern2, options2) {
|
|
|
19234
19282
|
|
|
19235
19283
|
// src/commands/refactor/extract/index.ts
|
|
19236
19284
|
import path44 from "path";
|
|
19237
|
-
import
|
|
19285
|
+
import chalk178 from "chalk";
|
|
19238
19286
|
|
|
19239
19287
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19240
19288
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19833,23 +19881,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19833
19881
|
|
|
19834
19882
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19835
19883
|
import path40 from "path";
|
|
19836
|
-
import
|
|
19884
|
+
import chalk176 from "chalk";
|
|
19837
19885
|
function section2(title) {
|
|
19838
19886
|
return `
|
|
19839
|
-
${
|
|
19887
|
+
${chalk176.cyan(title)}`;
|
|
19840
19888
|
}
|
|
19841
19889
|
function displayImporters(plan2, cwd) {
|
|
19842
19890
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19843
19891
|
console.log(section2("Update importers:"));
|
|
19844
19892
|
for (const imp of plan2.importersToUpdate) {
|
|
19845
19893
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19846
|
-
console.log(` ${
|
|
19894
|
+
console.log(` ${chalk176.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19847
19895
|
}
|
|
19848
19896
|
}
|
|
19849
19897
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19850
|
-
console.log(
|
|
19898
|
+
console.log(chalk176.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19851
19899
|
`));
|
|
19852
|
-
console.log(` ${
|
|
19900
|
+
console.log(` ${chalk176.cyan("Functions to move:")}`);
|
|
19853
19901
|
for (const name of plan2.extractedNames) {
|
|
19854
19902
|
console.log(` ${name}`);
|
|
19855
19903
|
}
|
|
@@ -19883,7 +19931,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19883
19931
|
|
|
19884
19932
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19885
19933
|
import path43 from "path";
|
|
19886
|
-
import
|
|
19934
|
+
import chalk177 from "chalk";
|
|
19887
19935
|
import { Project as Project4 } from "ts-morph";
|
|
19888
19936
|
|
|
19889
19937
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19975,7 +20023,7 @@ function loadProjectFile(file) {
|
|
|
19975
20023
|
});
|
|
19976
20024
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19977
20025
|
if (!sourceFile) {
|
|
19978
|
-
console.log(
|
|
20026
|
+
console.log(chalk177.red(`File not found in project: ${file}`));
|
|
19979
20027
|
process.exit(1);
|
|
19980
20028
|
}
|
|
19981
20029
|
return { project, sourceFile };
|
|
@@ -19998,19 +20046,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19998
20046
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19999
20047
|
if (options2.apply) {
|
|
20000
20048
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20001
|
-
console.log(
|
|
20049
|
+
console.log(chalk178.green("\nExtraction complete"));
|
|
20002
20050
|
} else {
|
|
20003
|
-
console.log(
|
|
20051
|
+
console.log(chalk178.dim("\nDry run. Use --apply to execute."));
|
|
20004
20052
|
}
|
|
20005
20053
|
}
|
|
20006
20054
|
|
|
20007
20055
|
// src/commands/refactor/ignore.ts
|
|
20008
20056
|
import fs28 from "fs";
|
|
20009
|
-
import
|
|
20057
|
+
import chalk179 from "chalk";
|
|
20010
20058
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20011
20059
|
function ignore2(file) {
|
|
20012
20060
|
if (!fs28.existsSync(file)) {
|
|
20013
|
-
console.error(
|
|
20061
|
+
console.error(chalk179.red(`Error: File does not exist: ${file}`));
|
|
20014
20062
|
process.exit(1);
|
|
20015
20063
|
}
|
|
20016
20064
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20026,7 +20074,7 @@ function ignore2(file) {
|
|
|
20026
20074
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20027
20075
|
}
|
|
20028
20076
|
console.log(
|
|
20029
|
-
|
|
20077
|
+
chalk179.green(
|
|
20030
20078
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20031
20079
|
)
|
|
20032
20080
|
);
|
|
@@ -20035,12 +20083,12 @@ function ignore2(file) {
|
|
|
20035
20083
|
// src/commands/refactor/rename/index.ts
|
|
20036
20084
|
import fs31 from "fs";
|
|
20037
20085
|
import path49 from "path";
|
|
20038
|
-
import
|
|
20086
|
+
import chalk182 from "chalk";
|
|
20039
20087
|
|
|
20040
20088
|
// src/commands/refactor/rename/applyRename.ts
|
|
20041
20089
|
import fs30 from "fs";
|
|
20042
20090
|
import path46 from "path";
|
|
20043
|
-
import
|
|
20091
|
+
import chalk180 from "chalk";
|
|
20044
20092
|
|
|
20045
20093
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20046
20094
|
import path45 from "path";
|
|
@@ -20145,13 +20193,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20145
20193
|
const updatedContents = applyRewrites(rewrites);
|
|
20146
20194
|
for (const [file, content] of updatedContents) {
|
|
20147
20195
|
fs30.writeFileSync(file, content, "utf8");
|
|
20148
|
-
console.log(
|
|
20196
|
+
console.log(chalk180.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20149
20197
|
}
|
|
20150
20198
|
const destDir = path46.dirname(destPath);
|
|
20151
20199
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20152
20200
|
fs30.renameSync(sourcePath, destPath);
|
|
20153
20201
|
console.log(
|
|
20154
|
-
|
|
20202
|
+
chalk180.white(
|
|
20155
20203
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20156
20204
|
)
|
|
20157
20205
|
);
|
|
@@ -20238,16 +20286,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20238
20286
|
|
|
20239
20287
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20240
20288
|
import path48 from "path";
|
|
20241
|
-
import
|
|
20289
|
+
import chalk181 from "chalk";
|
|
20242
20290
|
function printRenamePreview(rewrites, cwd) {
|
|
20243
20291
|
for (const rewrite of rewrites) {
|
|
20244
20292
|
console.log(
|
|
20245
|
-
|
|
20293
|
+
chalk181.dim(
|
|
20246
20294
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20247
20295
|
)
|
|
20248
20296
|
);
|
|
20249
20297
|
}
|
|
20250
|
-
console.log(
|
|
20298
|
+
console.log(chalk181.dim("Dry run. Use --apply to execute."));
|
|
20251
20299
|
}
|
|
20252
20300
|
|
|
20253
20301
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20258,20 +20306,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20258
20306
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20259
20307
|
const relDest = path49.relative(cwd, destPath);
|
|
20260
20308
|
if (!fs31.existsSync(sourcePath)) {
|
|
20261
|
-
console.log(
|
|
20309
|
+
console.log(chalk182.red(`File not found: ${source}`));
|
|
20262
20310
|
process.exit(1);
|
|
20263
20311
|
}
|
|
20264
20312
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20265
|
-
console.log(
|
|
20313
|
+
console.log(chalk182.red(`Destination already exists: ${destination}`));
|
|
20266
20314
|
process.exit(1);
|
|
20267
20315
|
}
|
|
20268
|
-
console.log(
|
|
20269
|
-
console.log(
|
|
20270
|
-
console.log(
|
|
20316
|
+
console.log(chalk182.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20317
|
+
console.log(chalk182.dim("Loading project..."));
|
|
20318
|
+
console.log(chalk182.dim("Scanning imports across the project..."));
|
|
20271
20319
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20272
20320
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20273
20321
|
console.log(
|
|
20274
|
-
|
|
20322
|
+
chalk182.dim(
|
|
20275
20323
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20276
20324
|
)
|
|
20277
20325
|
);
|
|
@@ -20280,11 +20328,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20280
20328
|
return;
|
|
20281
20329
|
}
|
|
20282
20330
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20283
|
-
console.log(
|
|
20331
|
+
console.log(chalk182.green("Done"));
|
|
20284
20332
|
}
|
|
20285
20333
|
|
|
20286
20334
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20287
|
-
import
|
|
20335
|
+
import chalk183 from "chalk";
|
|
20288
20336
|
|
|
20289
20337
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20290
20338
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20330,33 +20378,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20330
20378
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20331
20379
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20332
20380
|
if (!symbol) {
|
|
20333
|
-
console.log(
|
|
20381
|
+
console.log(chalk183.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20334
20382
|
process.exit(1);
|
|
20335
20383
|
}
|
|
20336
20384
|
const grouped = groupReferences(symbol, cwd);
|
|
20337
20385
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20338
20386
|
console.log(
|
|
20339
|
-
|
|
20387
|
+
chalk183.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20340
20388
|
`)
|
|
20341
20389
|
);
|
|
20342
20390
|
for (const [refFile, lines] of grouped) {
|
|
20343
20391
|
console.log(
|
|
20344
|
-
` ${
|
|
20392
|
+
` ${chalk183.dim(refFile)}: lines ${chalk183.cyan(lines.join(", "))}`
|
|
20345
20393
|
);
|
|
20346
20394
|
}
|
|
20347
20395
|
if (options2.apply) {
|
|
20348
20396
|
symbol.rename(newName);
|
|
20349
20397
|
await project.save();
|
|
20350
|
-
console.log(
|
|
20398
|
+
console.log(chalk183.green(`
|
|
20351
20399
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20352
20400
|
} else {
|
|
20353
|
-
console.log(
|
|
20401
|
+
console.log(chalk183.dim("\nDry run. Use --apply to execute."));
|
|
20354
20402
|
}
|
|
20355
20403
|
}
|
|
20356
20404
|
|
|
20357
20405
|
// src/commands/refactor/restructure/index.ts
|
|
20358
20406
|
import path57 from "path";
|
|
20359
|
-
import
|
|
20407
|
+
import chalk186 from "chalk";
|
|
20360
20408
|
|
|
20361
20409
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20362
20410
|
import path51 from "path";
|
|
@@ -20435,50 +20483,50 @@ function clusterFiles(graph) {
|
|
|
20435
20483
|
|
|
20436
20484
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20437
20485
|
import path53 from "path";
|
|
20438
|
-
import
|
|
20486
|
+
import chalk184 from "chalk";
|
|
20439
20487
|
function relPath(filePath) {
|
|
20440
20488
|
return path53.relative(process.cwd(), filePath);
|
|
20441
20489
|
}
|
|
20442
20490
|
function displayMoves(plan2) {
|
|
20443
20491
|
if (plan2.moves.length === 0) return;
|
|
20444
|
-
console.log(
|
|
20492
|
+
console.log(chalk184.bold("\nFile moves:"));
|
|
20445
20493
|
for (const move2 of plan2.moves) {
|
|
20446
20494
|
console.log(
|
|
20447
|
-
` ${
|
|
20495
|
+
` ${chalk184.red(relPath(move2.from))} \u2192 ${chalk184.green(relPath(move2.to))}`
|
|
20448
20496
|
);
|
|
20449
|
-
console.log(
|
|
20497
|
+
console.log(chalk184.dim(` ${move2.reason}`));
|
|
20450
20498
|
}
|
|
20451
20499
|
}
|
|
20452
20500
|
function displayRewrites(rewrites) {
|
|
20453
20501
|
if (rewrites.length === 0) return;
|
|
20454
20502
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20455
|
-
console.log(
|
|
20503
|
+
console.log(chalk184.bold(`
|
|
20456
20504
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20457
20505
|
for (const file of affectedFiles) {
|
|
20458
|
-
console.log(` ${
|
|
20506
|
+
console.log(` ${chalk184.cyan(relPath(file))}:`);
|
|
20459
20507
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20460
20508
|
(r) => r.file === file
|
|
20461
20509
|
)) {
|
|
20462
20510
|
console.log(
|
|
20463
|
-
` ${
|
|
20511
|
+
` ${chalk184.red(`"${oldSpecifier}"`)} \u2192 ${chalk184.green(`"${newSpecifier}"`)}`
|
|
20464
20512
|
);
|
|
20465
20513
|
}
|
|
20466
20514
|
}
|
|
20467
20515
|
}
|
|
20468
20516
|
function displayPlan2(plan2) {
|
|
20469
20517
|
if (plan2.warnings.length > 0) {
|
|
20470
|
-
console.log(
|
|
20471
|
-
for (const w of plan2.warnings) console.log(
|
|
20518
|
+
console.log(chalk184.yellow("\nWarnings:"));
|
|
20519
|
+
for (const w of plan2.warnings) console.log(chalk184.yellow(` ${w}`));
|
|
20472
20520
|
}
|
|
20473
20521
|
if (plan2.newDirectories.length > 0) {
|
|
20474
|
-
console.log(
|
|
20522
|
+
console.log(chalk184.bold("\nNew directories:"));
|
|
20475
20523
|
for (const dir of plan2.newDirectories)
|
|
20476
|
-
console.log(
|
|
20524
|
+
console.log(chalk184.green(` ${dir}/`));
|
|
20477
20525
|
}
|
|
20478
20526
|
displayMoves(plan2);
|
|
20479
20527
|
displayRewrites(plan2.rewrites);
|
|
20480
20528
|
console.log(
|
|
20481
|
-
|
|
20529
|
+
chalk184.dim(
|
|
20482
20530
|
`
|
|
20483
20531
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20484
20532
|
)
|
|
@@ -20488,18 +20536,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20488
20536
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20489
20537
|
import fs32 from "fs";
|
|
20490
20538
|
import path54 from "path";
|
|
20491
|
-
import
|
|
20539
|
+
import chalk185 from "chalk";
|
|
20492
20540
|
function executePlan(plan2) {
|
|
20493
20541
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20494
20542
|
for (const [file, content] of updatedContents) {
|
|
20495
20543
|
fs32.writeFileSync(file, content, "utf8");
|
|
20496
20544
|
console.log(
|
|
20497
|
-
|
|
20545
|
+
chalk185.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20498
20546
|
);
|
|
20499
20547
|
}
|
|
20500
20548
|
for (const dir of plan2.newDirectories) {
|
|
20501
20549
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20502
|
-
console.log(
|
|
20550
|
+
console.log(chalk185.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20503
20551
|
}
|
|
20504
20552
|
for (const move2 of plan2.moves) {
|
|
20505
20553
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20508,7 +20556,7 @@ function executePlan(plan2) {
|
|
|
20508
20556
|
}
|
|
20509
20557
|
fs32.renameSync(move2.from, move2.to);
|
|
20510
20558
|
console.log(
|
|
20511
|
-
|
|
20559
|
+
chalk185.white(
|
|
20512
20560
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20513
20561
|
)
|
|
20514
20562
|
);
|
|
@@ -20523,7 +20571,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20523
20571
|
if (entries.length === 0) {
|
|
20524
20572
|
fs32.rmdirSync(dir);
|
|
20525
20573
|
console.log(
|
|
20526
|
-
|
|
20574
|
+
chalk185.dim(
|
|
20527
20575
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20528
20576
|
)
|
|
20529
20577
|
);
|
|
@@ -20656,22 +20704,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20656
20704
|
const targetPattern = pattern2 ?? "src";
|
|
20657
20705
|
const files = findSourceFiles2(targetPattern);
|
|
20658
20706
|
if (files.length === 0) {
|
|
20659
|
-
console.log(
|
|
20707
|
+
console.log(chalk186.yellow("No files found matching pattern"));
|
|
20660
20708
|
return;
|
|
20661
20709
|
}
|
|
20662
20710
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20663
20711
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20664
20712
|
if (plan2.moves.length === 0) {
|
|
20665
|
-
console.log(
|
|
20713
|
+
console.log(chalk186.green("No restructuring needed"));
|
|
20666
20714
|
return;
|
|
20667
20715
|
}
|
|
20668
20716
|
displayPlan2(plan2);
|
|
20669
20717
|
if (options2.apply) {
|
|
20670
|
-
console.log(
|
|
20718
|
+
console.log(chalk186.bold("\nApplying changes..."));
|
|
20671
20719
|
executePlan(plan2);
|
|
20672
|
-
console.log(
|
|
20720
|
+
console.log(chalk186.green("\nRestructuring complete"));
|
|
20673
20721
|
} else {
|
|
20674
|
-
console.log(
|
|
20722
|
+
console.log(chalk186.dim("\nDry run. Use --apply to execute."));
|
|
20675
20723
|
}
|
|
20676
20724
|
}
|
|
20677
20725
|
|
|
@@ -21254,18 +21302,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21254
21302
|
}
|
|
21255
21303
|
|
|
21256
21304
|
// src/commands/review/warnOutOfDiff.ts
|
|
21257
|
-
import
|
|
21305
|
+
import chalk187 from "chalk";
|
|
21258
21306
|
function warnOutOfDiff(outOfDiff) {
|
|
21259
21307
|
if (outOfDiff.length === 0) return;
|
|
21260
21308
|
console.warn(
|
|
21261
|
-
|
|
21309
|
+
chalk187.yellow(
|
|
21262
21310
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21263
21311
|
)
|
|
21264
21312
|
);
|
|
21265
21313
|
for (const finding of outOfDiff) {
|
|
21266
21314
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21267
21315
|
console.warn(
|
|
21268
|
-
` ${
|
|
21316
|
+
` ${chalk187.yellow("\xB7")} ${finding.title} ${chalk187.dim(
|
|
21269
21317
|
`(${finding.file}:${range})`
|
|
21270
21318
|
)}`
|
|
21271
21319
|
);
|
|
@@ -21284,18 +21332,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
21284
21332
|
}
|
|
21285
21333
|
|
|
21286
21334
|
// src/commands/review/warnUnlocated.ts
|
|
21287
|
-
import
|
|
21335
|
+
import chalk188 from "chalk";
|
|
21288
21336
|
function warnUnlocated(unlocated) {
|
|
21289
21337
|
if (unlocated.length === 0) return;
|
|
21290
21338
|
console.warn(
|
|
21291
|
-
|
|
21339
|
+
chalk188.yellow(
|
|
21292
21340
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21293
21341
|
)
|
|
21294
21342
|
);
|
|
21295
21343
|
for (const finding of unlocated) {
|
|
21296
|
-
const where = finding.location ||
|
|
21344
|
+
const where = finding.location || chalk188.dim("missing");
|
|
21297
21345
|
console.warn(
|
|
21298
|
-
` ${
|
|
21346
|
+
` ${chalk188.yellow("\xB7")} ${finding.title} ${chalk188.dim(`(${where})`)}`
|
|
21299
21347
|
);
|
|
21300
21348
|
}
|
|
21301
21349
|
}
|
|
@@ -22467,7 +22515,7 @@ function registerReview(program2) {
|
|
|
22467
22515
|
}
|
|
22468
22516
|
|
|
22469
22517
|
// src/commands/seq/seqAuth.ts
|
|
22470
|
-
import
|
|
22518
|
+
import chalk190 from "chalk";
|
|
22471
22519
|
|
|
22472
22520
|
// src/commands/seq/loadConnections.ts
|
|
22473
22521
|
function loadConnections2() {
|
|
@@ -22496,10 +22544,10 @@ function setDefaultConnection(name) {
|
|
|
22496
22544
|
}
|
|
22497
22545
|
|
|
22498
22546
|
// src/shared/assertUniqueName.ts
|
|
22499
|
-
import
|
|
22547
|
+
import chalk189 from "chalk";
|
|
22500
22548
|
function assertUniqueName(existingNames, name) {
|
|
22501
22549
|
if (existingNames.includes(name)) {
|
|
22502
|
-
console.error(
|
|
22550
|
+
console.error(chalk189.red(`Connection "${name}" already exists.`));
|
|
22503
22551
|
process.exit(1);
|
|
22504
22552
|
}
|
|
22505
22553
|
}
|
|
@@ -22517,7 +22565,7 @@ async function promptConnection2(existingNames) {
|
|
|
22517
22565
|
var seqAuth = createConnectionAuth({
|
|
22518
22566
|
load: loadConnections2,
|
|
22519
22567
|
save: saveConnections2,
|
|
22520
|
-
format: (c) => `${
|
|
22568
|
+
format: (c) => `${chalk190.bold(c.name)} ${c.url}`,
|
|
22521
22569
|
promptNew: promptConnection2,
|
|
22522
22570
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22523
22571
|
});
|
|
@@ -22537,10 +22585,10 @@ var seqConfigHelp = [
|
|
|
22537
22585
|
];
|
|
22538
22586
|
|
|
22539
22587
|
// src/commands/seq/seqQuery.ts
|
|
22540
|
-
import
|
|
22588
|
+
import chalk194 from "chalk";
|
|
22541
22589
|
|
|
22542
22590
|
// src/commands/seq/fetchSeq.ts
|
|
22543
|
-
import
|
|
22591
|
+
import chalk191 from "chalk";
|
|
22544
22592
|
async function fetchSeq(conn, path71, params) {
|
|
22545
22593
|
const url = `${conn.url}${path71}?${params}`;
|
|
22546
22594
|
const response = await fetch(url, {
|
|
@@ -22551,7 +22599,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22551
22599
|
});
|
|
22552
22600
|
if (!response.ok) {
|
|
22553
22601
|
const body = await response.text();
|
|
22554
|
-
console.error(
|
|
22602
|
+
console.error(chalk191.red(`Seq returned ${response.status}: ${body}`));
|
|
22555
22603
|
process.exit(1);
|
|
22556
22604
|
}
|
|
22557
22605
|
return response;
|
|
@@ -22610,23 +22658,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22610
22658
|
}
|
|
22611
22659
|
|
|
22612
22660
|
// src/commands/seq/formatEvent.ts
|
|
22613
|
-
import
|
|
22661
|
+
import chalk192 from "chalk";
|
|
22614
22662
|
function levelColor(level) {
|
|
22615
22663
|
switch (level) {
|
|
22616
22664
|
case "Fatal":
|
|
22617
|
-
return
|
|
22665
|
+
return chalk192.bgRed.white;
|
|
22618
22666
|
case "Error":
|
|
22619
|
-
return
|
|
22667
|
+
return chalk192.red;
|
|
22620
22668
|
case "Warning":
|
|
22621
|
-
return
|
|
22669
|
+
return chalk192.yellow;
|
|
22622
22670
|
case "Information":
|
|
22623
|
-
return
|
|
22671
|
+
return chalk192.cyan;
|
|
22624
22672
|
case "Debug":
|
|
22625
|
-
return
|
|
22673
|
+
return chalk192.gray;
|
|
22626
22674
|
case "Verbose":
|
|
22627
|
-
return
|
|
22675
|
+
return chalk192.dim;
|
|
22628
22676
|
default:
|
|
22629
|
-
return
|
|
22677
|
+
return chalk192.white;
|
|
22630
22678
|
}
|
|
22631
22679
|
}
|
|
22632
22680
|
function levelAbbrev(level) {
|
|
@@ -22667,12 +22715,12 @@ function formatTimestamp(iso) {
|
|
|
22667
22715
|
function formatEvent(event) {
|
|
22668
22716
|
const color = levelColor(event.Level);
|
|
22669
22717
|
const abbrev = levelAbbrev(event.Level);
|
|
22670
|
-
const ts8 =
|
|
22718
|
+
const ts8 = chalk192.dim(formatTimestamp(event.Timestamp));
|
|
22671
22719
|
const msg = renderMessage(event);
|
|
22672
22720
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22673
22721
|
if (event.Exception) {
|
|
22674
22722
|
for (const line of event.Exception.split("\n")) {
|
|
22675
|
-
lines.push(
|
|
22723
|
+
lines.push(chalk192.red(` ${line}`));
|
|
22676
22724
|
}
|
|
22677
22725
|
}
|
|
22678
22726
|
return lines.join("\n");
|
|
@@ -22705,11 +22753,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22705
22753
|
}
|
|
22706
22754
|
|
|
22707
22755
|
// src/shared/resolveNamedConnection.ts
|
|
22708
|
-
import
|
|
22756
|
+
import chalk193 from "chalk";
|
|
22709
22757
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22710
22758
|
if (connections.length === 0) {
|
|
22711
22759
|
console.error(
|
|
22712
|
-
|
|
22760
|
+
chalk193.red(
|
|
22713
22761
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22714
22762
|
)
|
|
22715
22763
|
);
|
|
@@ -22718,7 +22766,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22718
22766
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22719
22767
|
const connection = connections.find((c) => c.name === target);
|
|
22720
22768
|
if (!connection) {
|
|
22721
|
-
console.error(
|
|
22769
|
+
console.error(chalk193.red(`${kind} connection "${target}" not found.`));
|
|
22722
22770
|
process.exit(1);
|
|
22723
22771
|
}
|
|
22724
22772
|
return connection;
|
|
@@ -22747,7 +22795,7 @@ async function seqQuery(filter, options2) {
|
|
|
22747
22795
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22748
22796
|
);
|
|
22749
22797
|
if (events.length === 0) {
|
|
22750
|
-
console.log(
|
|
22798
|
+
console.log(chalk194.yellow("No events found."));
|
|
22751
22799
|
return;
|
|
22752
22800
|
}
|
|
22753
22801
|
if (options2.json) {
|
|
@@ -22758,11 +22806,11 @@ async function seqQuery(filter, options2) {
|
|
|
22758
22806
|
for (const event of chronological) {
|
|
22759
22807
|
console.log(formatEvent(event));
|
|
22760
22808
|
}
|
|
22761
|
-
console.log(
|
|
22809
|
+
console.log(chalk194.dim(`
|
|
22762
22810
|
${events.length} events`));
|
|
22763
22811
|
if (events.length >= count7) {
|
|
22764
22812
|
console.log(
|
|
22765
|
-
|
|
22813
|
+
chalk194.yellow(
|
|
22766
22814
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22767
22815
|
)
|
|
22768
22816
|
);
|
|
@@ -22770,10 +22818,10 @@ ${events.length} events`));
|
|
|
22770
22818
|
}
|
|
22771
22819
|
|
|
22772
22820
|
// src/shared/setNamedDefaultConnection.ts
|
|
22773
|
-
import
|
|
22821
|
+
import chalk195 from "chalk";
|
|
22774
22822
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22775
22823
|
if (!connections.find((c) => c.name === name)) {
|
|
22776
|
-
console.error(
|
|
22824
|
+
console.error(chalk195.red(`Connection "${name}" not found.`));
|
|
22777
22825
|
process.exit(1);
|
|
22778
22826
|
}
|
|
22779
22827
|
setDefault(name);
|
|
@@ -22822,7 +22870,7 @@ function registerSignal(program2) {
|
|
|
22822
22870
|
}
|
|
22823
22871
|
|
|
22824
22872
|
// src/commands/sql/sqlAuth.ts
|
|
22825
|
-
import
|
|
22873
|
+
import chalk197 from "chalk";
|
|
22826
22874
|
|
|
22827
22875
|
// src/commands/sql/loadConnections.ts
|
|
22828
22876
|
function loadConnections3() {
|
|
@@ -22851,7 +22899,7 @@ function setDefaultConnection2(name) {
|
|
|
22851
22899
|
}
|
|
22852
22900
|
|
|
22853
22901
|
// src/commands/sql/promptConnection.ts
|
|
22854
|
-
import
|
|
22902
|
+
import chalk196 from "chalk";
|
|
22855
22903
|
async function promptConnection3(existingNames) {
|
|
22856
22904
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22857
22905
|
assertUniqueName(existingNames, name);
|
|
@@ -22859,7 +22907,7 @@ async function promptConnection3(existingNames) {
|
|
|
22859
22907
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22860
22908
|
const port = Number.parseInt(portStr, 10);
|
|
22861
22909
|
if (!Number.isFinite(port)) {
|
|
22862
|
-
console.error(
|
|
22910
|
+
console.error(chalk196.red(`Invalid port "${portStr}".`));
|
|
22863
22911
|
process.exit(1);
|
|
22864
22912
|
}
|
|
22865
22913
|
const user = await promptInput("user", "User:");
|
|
@@ -22872,13 +22920,13 @@ async function promptConnection3(existingNames) {
|
|
|
22872
22920
|
var sqlAuth = createConnectionAuth({
|
|
22873
22921
|
load: loadConnections3,
|
|
22874
22922
|
save: saveConnections3,
|
|
22875
|
-
format: (c) => `${
|
|
22923
|
+
format: (c) => `${chalk197.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22876
22924
|
promptNew: promptConnection3,
|
|
22877
22925
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22878
22926
|
});
|
|
22879
22927
|
|
|
22880
22928
|
// src/commands/sql/printTable.ts
|
|
22881
|
-
import
|
|
22929
|
+
import chalk198 from "chalk";
|
|
22882
22930
|
function formatCell(value) {
|
|
22883
22931
|
if (value === null || value === void 0) return "";
|
|
22884
22932
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22887,7 +22935,7 @@ function formatCell(value) {
|
|
|
22887
22935
|
}
|
|
22888
22936
|
function printTable(rows) {
|
|
22889
22937
|
if (rows.length === 0) {
|
|
22890
|
-
console.log(
|
|
22938
|
+
console.log(chalk198.yellow("(no rows)"));
|
|
22891
22939
|
return;
|
|
22892
22940
|
}
|
|
22893
22941
|
const columns = Object.keys(rows[0]);
|
|
@@ -22895,13 +22943,13 @@ function printTable(rows) {
|
|
|
22895
22943
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22896
22944
|
);
|
|
22897
22945
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22898
|
-
console.log(
|
|
22899
|
-
console.log(
|
|
22946
|
+
console.log(chalk198.dim(header));
|
|
22947
|
+
console.log(chalk198.dim("-".repeat(header.length)));
|
|
22900
22948
|
for (const row of rows) {
|
|
22901
22949
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22902
22950
|
console.log(line);
|
|
22903
22951
|
}
|
|
22904
|
-
console.log(
|
|
22952
|
+
console.log(chalk198.dim(`
|
|
22905
22953
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22906
22954
|
}
|
|
22907
22955
|
|
|
@@ -22975,7 +23023,7 @@ var sqlConfigHelp = [
|
|
|
22975
23023
|
];
|
|
22976
23024
|
|
|
22977
23025
|
// src/commands/sql/sqlMutate.ts
|
|
22978
|
-
import
|
|
23026
|
+
import chalk199 from "chalk";
|
|
22979
23027
|
|
|
22980
23028
|
// src/commands/sql/isMutation.ts
|
|
22981
23029
|
var MUTATION_KEYWORDS = [
|
|
@@ -23009,7 +23057,7 @@ function isMutation(sql25) {
|
|
|
23009
23057
|
async function sqlMutate(query, connectionName) {
|
|
23010
23058
|
if (!isMutation(query)) {
|
|
23011
23059
|
console.error(
|
|
23012
|
-
|
|
23060
|
+
chalk199.red(
|
|
23013
23061
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23014
23062
|
)
|
|
23015
23063
|
);
|
|
@@ -23019,18 +23067,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23019
23067
|
const pool = await sqlConnect(conn);
|
|
23020
23068
|
try {
|
|
23021
23069
|
const result = await pool.request().query(query);
|
|
23022
|
-
console.log(
|
|
23070
|
+
console.log(chalk199.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23023
23071
|
} finally {
|
|
23024
23072
|
await pool.close();
|
|
23025
23073
|
}
|
|
23026
23074
|
}
|
|
23027
23075
|
|
|
23028
23076
|
// src/commands/sql/sqlQuery.ts
|
|
23029
|
-
import
|
|
23077
|
+
import chalk200 from "chalk";
|
|
23030
23078
|
async function sqlQuery(query, connectionName) {
|
|
23031
23079
|
if (isMutation(query)) {
|
|
23032
23080
|
console.error(
|
|
23033
|
-
|
|
23081
|
+
chalk200.red(
|
|
23034
23082
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23035
23083
|
)
|
|
23036
23084
|
);
|
|
@@ -23045,7 +23093,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23045
23093
|
printTable(rows);
|
|
23046
23094
|
} else {
|
|
23047
23095
|
console.log(
|
|
23048
|
-
|
|
23096
|
+
chalk200.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23049
23097
|
);
|
|
23050
23098
|
}
|
|
23051
23099
|
} finally {
|
|
@@ -23860,7 +23908,7 @@ function registerVoice(program2) {
|
|
|
23860
23908
|
|
|
23861
23909
|
// src/commands/roam/auth.ts
|
|
23862
23910
|
import { randomBytes } from "crypto";
|
|
23863
|
-
import
|
|
23911
|
+
import chalk201 from "chalk";
|
|
23864
23912
|
|
|
23865
23913
|
// src/commands/roam/waitForCallback.ts
|
|
23866
23914
|
import { createServer as createServer3 } from "http";
|
|
@@ -23991,13 +24039,13 @@ async function auth() {
|
|
|
23991
24039
|
saveGlobalConfig(config);
|
|
23992
24040
|
const state = randomBytes(16).toString("hex");
|
|
23993
24041
|
console.log(
|
|
23994
|
-
|
|
24042
|
+
chalk201.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23995
24043
|
);
|
|
23996
|
-
console.log(
|
|
23997
|
-
console.log(
|
|
23998
|
-
console.log(
|
|
24044
|
+
console.log(chalk201.white("http://localhost:14523/callback\n"));
|
|
24045
|
+
console.log(chalk201.blue("Opening browser for authorization..."));
|
|
24046
|
+
console.log(chalk201.dim("Waiting for authorization callback..."));
|
|
23999
24047
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24000
|
-
console.log(
|
|
24048
|
+
console.log(chalk201.dim("Exchanging code for tokens..."));
|
|
24001
24049
|
const tokens = await exchangeToken({
|
|
24002
24050
|
code,
|
|
24003
24051
|
clientId,
|
|
@@ -24013,7 +24061,7 @@ async function auth() {
|
|
|
24013
24061
|
};
|
|
24014
24062
|
saveGlobalConfig(config);
|
|
24015
24063
|
console.log(
|
|
24016
|
-
|
|
24064
|
+
chalk201.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24017
24065
|
);
|
|
24018
24066
|
}
|
|
24019
24067
|
|
|
@@ -24556,7 +24604,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24556
24604
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24557
24605
|
import { tmpdir as tmpdir7 } from "os";
|
|
24558
24606
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24559
|
-
import
|
|
24607
|
+
import chalk202 from "chalk";
|
|
24560
24608
|
|
|
24561
24609
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24562
24610
|
var captureWindowPs1 = `
|
|
@@ -24707,13 +24755,13 @@ function screenshot(processName) {
|
|
|
24707
24755
|
const config = loadConfig();
|
|
24708
24756
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24709
24757
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24710
|
-
console.log(
|
|
24758
|
+
console.log(chalk202.gray(`Capturing window for process "${processName}" ...`));
|
|
24711
24759
|
try {
|
|
24712
24760
|
runPowerShellScript(processName, outputPath);
|
|
24713
|
-
console.log(
|
|
24761
|
+
console.log(chalk202.green(`Screenshot saved: ${outputPath}`));
|
|
24714
24762
|
} catch (error) {
|
|
24715
24763
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24716
|
-
console.error(
|
|
24764
|
+
console.error(chalk202.red(`Failed to capture screenshot: ${msg}`));
|
|
24717
24765
|
process.exit(1);
|
|
24718
24766
|
}
|
|
24719
24767
|
}
|
|
@@ -28057,7 +28105,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
28057
28105
|
|
|
28058
28106
|
// src/commands/sessions/summarise/index.ts
|
|
28059
28107
|
import * as fs41 from "fs";
|
|
28060
|
-
import
|
|
28108
|
+
import chalk203 from "chalk";
|
|
28061
28109
|
|
|
28062
28110
|
// src/commands/sessions/summarise/shared.ts
|
|
28063
28111
|
import * as fs40 from "fs";
|
|
@@ -28131,22 +28179,22 @@ ${firstMessage}`);
|
|
|
28131
28179
|
async function summarise2(options2) {
|
|
28132
28180
|
const files = await discoverSessionFiles();
|
|
28133
28181
|
if (files.length === 0) {
|
|
28134
|
-
console.log(
|
|
28182
|
+
console.log(chalk203.yellow("No sessions found."));
|
|
28135
28183
|
return;
|
|
28136
28184
|
}
|
|
28137
28185
|
const toProcess = selectCandidates(files, options2);
|
|
28138
28186
|
if (toProcess.length === 0) {
|
|
28139
|
-
console.log(
|
|
28187
|
+
console.log(chalk203.green("All sessions already summarised."));
|
|
28140
28188
|
return;
|
|
28141
28189
|
}
|
|
28142
28190
|
console.log(
|
|
28143
|
-
|
|
28191
|
+
chalk203.cyan(
|
|
28144
28192
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
28145
28193
|
)
|
|
28146
28194
|
);
|
|
28147
28195
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
28148
28196
|
console.log(
|
|
28149
|
-
|
|
28197
|
+
chalk203.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk203.yellow(`, ${failed2} skipped`) : "")
|
|
28150
28198
|
);
|
|
28151
28199
|
}
|
|
28152
28200
|
function selectCandidates(files, options2) {
|
|
@@ -28166,16 +28214,16 @@ function processSessions(files) {
|
|
|
28166
28214
|
let failed2 = 0;
|
|
28167
28215
|
for (let i = 0; i < files.length; i++) {
|
|
28168
28216
|
const file = files[i];
|
|
28169
|
-
process.stdout.write(
|
|
28217
|
+
process.stdout.write(chalk203.dim(` [${i + 1}/${files.length}] `));
|
|
28170
28218
|
const summary = summariseSession(file);
|
|
28171
28219
|
if (summary) {
|
|
28172
28220
|
writeSummary(file, summary);
|
|
28173
28221
|
succeeded++;
|
|
28174
|
-
process.stdout.write(`${
|
|
28222
|
+
process.stdout.write(`${chalk203.green("\u2713")} ${summary}
|
|
28175
28223
|
`);
|
|
28176
28224
|
} else {
|
|
28177
28225
|
failed2++;
|
|
28178
|
-
process.stdout.write(` ${
|
|
28226
|
+
process.stdout.write(` ${chalk203.yellow("skip")}
|
|
28179
28227
|
`);
|
|
28180
28228
|
}
|
|
28181
28229
|
}
|
|
@@ -28217,7 +28265,7 @@ function registerSessions(program2) {
|
|
|
28217
28265
|
}
|
|
28218
28266
|
|
|
28219
28267
|
// src/commands/statusLine.ts
|
|
28220
|
-
import
|
|
28268
|
+
import chalk205 from "chalk";
|
|
28221
28269
|
|
|
28222
28270
|
// src/shared/contextLevel.ts
|
|
28223
28271
|
function contextLevel(pct) {
|
|
@@ -28227,7 +28275,7 @@ function contextLevel(pct) {
|
|
|
28227
28275
|
}
|
|
28228
28276
|
|
|
28229
28277
|
// src/commands/buildLimitsSegment.ts
|
|
28230
|
-
import
|
|
28278
|
+
import chalk204 from "chalk";
|
|
28231
28279
|
|
|
28232
28280
|
// src/shared/rateLimitLevel.ts
|
|
28233
28281
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -28258,9 +28306,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
28258
28306
|
|
|
28259
28307
|
// src/commands/buildLimitsSegment.ts
|
|
28260
28308
|
var LEVEL_COLOR = {
|
|
28261
|
-
ok:
|
|
28262
|
-
warn:
|
|
28263
|
-
over:
|
|
28309
|
+
ok: chalk204.green,
|
|
28310
|
+
warn: chalk204.yellow,
|
|
28311
|
+
over: chalk204.red
|
|
28264
28312
|
};
|
|
28265
28313
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
28266
28314
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -28356,7 +28404,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
28356
28404
|
}
|
|
28357
28405
|
|
|
28358
28406
|
// src/commands/statusLine.ts
|
|
28359
|
-
|
|
28407
|
+
chalk205.level = 3;
|
|
28360
28408
|
function formatNumber(num) {
|
|
28361
28409
|
return num.toLocaleString("en-US");
|
|
28362
28410
|
}
|
|
@@ -28364,9 +28412,9 @@ function colorizePercent(pct) {
|
|
|
28364
28412
|
const label2 = `${Math.round(pct)}%`;
|
|
28365
28413
|
switch (contextLevel(pct)) {
|
|
28366
28414
|
case "red":
|
|
28367
|
-
return
|
|
28415
|
+
return chalk205.red(label2);
|
|
28368
28416
|
case "yellow":
|
|
28369
|
-
return
|
|
28417
|
+
return chalk205.yellow(label2);
|
|
28370
28418
|
default:
|
|
28371
28419
|
return label2;
|
|
28372
28420
|
}
|
|
@@ -28379,7 +28427,7 @@ async function statusLine() {
|
|
|
28379
28427
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
28380
28428
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
28381
28429
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
28382
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
28430
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk205.cyan(branch2)} | ` : "";
|
|
28383
28431
|
console.log(
|
|
28384
28432
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
28385
28433
|
);
|
|
@@ -28400,7 +28448,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
28400
28448
|
// src/commands/sync/syncClaudeMd.ts
|
|
28401
28449
|
import * as fs42 from "fs";
|
|
28402
28450
|
import * as path61 from "path";
|
|
28403
|
-
import
|
|
28451
|
+
import chalk206 from "chalk";
|
|
28404
28452
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28405
28453
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
28406
28454
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -28409,12 +28457,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28409
28457
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
28410
28458
|
if (sourceContent !== targetContent) {
|
|
28411
28459
|
console.log(
|
|
28412
|
-
|
|
28460
|
+
chalk206.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28413
28461
|
);
|
|
28414
28462
|
console.log();
|
|
28415
28463
|
printDiff(targetContent, sourceContent);
|
|
28416
28464
|
const confirm = options2?.yes || await promptConfirm(
|
|
28417
|
-
|
|
28465
|
+
chalk206.red("Overwrite existing CLAUDE.md?"),
|
|
28418
28466
|
false
|
|
28419
28467
|
);
|
|
28420
28468
|
if (!confirm) {
|
|
@@ -28608,7 +28656,7 @@ function syncPi(claudeDir) {
|
|
|
28608
28656
|
// src/commands/sync/syncSettings.ts
|
|
28609
28657
|
import * as fs47 from "fs";
|
|
28610
28658
|
import * as path68 from "path";
|
|
28611
|
-
import
|
|
28659
|
+
import chalk207 from "chalk";
|
|
28612
28660
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28613
28661
|
const source = path68.join(claudeDir, "settings.json");
|
|
28614
28662
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28627,14 +28675,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28627
28675
|
if (mergedContent !== normalizedTarget) {
|
|
28628
28676
|
if (!options2?.yes) {
|
|
28629
28677
|
console.log(
|
|
28630
|
-
|
|
28678
|
+
chalk207.yellow(
|
|
28631
28679
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28632
28680
|
)
|
|
28633
28681
|
);
|
|
28634
28682
|
console.log();
|
|
28635
28683
|
printDiff(targetContent, mergedContent);
|
|
28636
28684
|
const confirm = await promptConfirm(
|
|
28637
|
-
|
|
28685
|
+
chalk207.red("Overwrite existing settings.json?"),
|
|
28638
28686
|
false
|
|
28639
28687
|
);
|
|
28640
28688
|
if (!confirm) {
|
|
@@ -28733,10 +28781,10 @@ async function update2() {
|
|
|
28733
28781
|
}
|
|
28734
28782
|
|
|
28735
28783
|
// src/reportCliError.ts
|
|
28736
|
-
import
|
|
28784
|
+
import chalk208 from "chalk";
|
|
28737
28785
|
function reportCliError(error) {
|
|
28738
28786
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28739
|
-
console.error(
|
|
28787
|
+
console.error(chalk208.red(error.message));
|
|
28740
28788
|
} else {
|
|
28741
28789
|
console.error(error);
|
|
28742
28790
|
}
|