@staff0rd/assist 0.420.0 → 0.421.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 +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +495 -452
- 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.421.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -11710,33 +11710,15 @@ async function removePhase(id, phase) {
|
|
|
11710
11710
|
);
|
|
11711
11711
|
}
|
|
11712
11712
|
|
|
11713
|
-
// src/commands/backlog/update/
|
|
11714
|
-
import
|
|
11713
|
+
// src/commands/backlog/update/update.ts
|
|
11714
|
+
import chalk108 from "chalk";
|
|
11715
11715
|
import { eq as eq36 } from "drizzle-orm";
|
|
11716
11716
|
|
|
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
11717
|
// src/commands/backlog/update/buildUpdateValues.ts
|
|
11736
11718
|
import chalk105 from "chalk";
|
|
11737
11719
|
function buildUpdateValues(options2) {
|
|
11738
|
-
const { name, desc: desc6, type, ac } = options2;
|
|
11739
|
-
if (!name && !desc6 && !type && !ac) {
|
|
11720
|
+
const { name, desc: desc6, type, ac, origin } = options2;
|
|
11721
|
+
if (!name && !desc6 && !type && !ac && !origin) {
|
|
11740
11722
|
console.log(chalk105.red("Nothing to update. Provide at least one flag."));
|
|
11741
11723
|
process.exitCode = 1;
|
|
11742
11724
|
return void 0;
|
|
@@ -11764,37 +11746,86 @@ function buildUpdateValues(options2) {
|
|
|
11764
11746
|
set.acceptanceCriteria = JSON.stringify(ac);
|
|
11765
11747
|
fieldNames.push("acceptance criteria");
|
|
11766
11748
|
}
|
|
11749
|
+
if (origin) {
|
|
11750
|
+
set.origin = origin;
|
|
11751
|
+
fieldNames.push("origin");
|
|
11752
|
+
}
|
|
11767
11753
|
return { set, fields: fieldNames.join(", ") };
|
|
11768
11754
|
}
|
|
11769
11755
|
|
|
11770
|
-
// src/commands/backlog/update/
|
|
11756
|
+
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
11757
|
+
import chalk106 from "chalk";
|
|
11758
|
+
|
|
11759
|
+
// src/commands/backlog/update/applyAcMutations.ts
|
|
11760
|
+
function hasAcMutations(options2) {
|
|
11761
|
+
return hasListMutations({
|
|
11762
|
+
add: options2.addAc,
|
|
11763
|
+
edit: options2.editAc,
|
|
11764
|
+
remove: options2.removeAc
|
|
11765
|
+
});
|
|
11766
|
+
}
|
|
11767
|
+
function applyAcMutations(current, options2) {
|
|
11768
|
+
const result = applyListMutations(
|
|
11769
|
+
current,
|
|
11770
|
+
{ add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
|
|
11771
|
+
{ add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
|
|
11772
|
+
);
|
|
11773
|
+
if (!result.ok) return result;
|
|
11774
|
+
return { ok: true, criteria: result.items };
|
|
11775
|
+
}
|
|
11776
|
+
|
|
11777
|
+
// src/commands/backlog/update/resolveAcUpdate.ts
|
|
11778
|
+
function resolveAcUpdate(options2, currentCriteria) {
|
|
11779
|
+
if (!hasAcMutations(options2)) return { ok: true, ac: options2.ac };
|
|
11780
|
+
if (options2.ac) {
|
|
11781
|
+
console.log(
|
|
11782
|
+
chalk106.red("Cannot combine --ac with --add-ac/--edit-ac/--remove-ac.")
|
|
11783
|
+
);
|
|
11784
|
+
process.exitCode = 1;
|
|
11785
|
+
return { ok: false };
|
|
11786
|
+
}
|
|
11787
|
+
const mutation = applyAcMutations(currentCriteria, options2);
|
|
11788
|
+
if (!mutation.ok) {
|
|
11789
|
+
console.log(chalk106.red(mutation.error));
|
|
11790
|
+
process.exitCode = 1;
|
|
11791
|
+
return { ok: false };
|
|
11792
|
+
}
|
|
11793
|
+
return { ok: true, ac: mutation.criteria };
|
|
11794
|
+
}
|
|
11795
|
+
|
|
11796
|
+
// src/commands/backlog/update/resolveOriginUpdate.ts
|
|
11797
|
+
import chalk107 from "chalk";
|
|
11798
|
+
function resolveOriginUpdate(optionOrigin, item) {
|
|
11799
|
+
if (optionOrigin === void 0 || optionOrigin === false)
|
|
11800
|
+
return { kind: "none" };
|
|
11801
|
+
const origin = typeof optionOrigin === "string" ? normalizeOrigin(optionOrigin) : getOrigin();
|
|
11802
|
+
if (origin === item.origin) {
|
|
11803
|
+
console.log(
|
|
11804
|
+
chalk107.yellow(
|
|
11805
|
+
`Item ${formatItemId(item.id)} is already on origin "${origin}"; nothing to change.`
|
|
11806
|
+
)
|
|
11807
|
+
);
|
|
11808
|
+
return { kind: "noop" };
|
|
11809
|
+
}
|
|
11810
|
+
return { kind: "set", origin };
|
|
11811
|
+
}
|
|
11812
|
+
|
|
11813
|
+
// src/commands/backlog/update/update.ts
|
|
11771
11814
|
async function update(id, options2) {
|
|
11772
11815
|
const found = await findOneItem(id);
|
|
11773
11816
|
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 });
|
|
11817
|
+
const acResult = resolveAcUpdate(options2, found.item.acceptanceCriteria);
|
|
11818
|
+
if (!acResult.ok) return;
|
|
11819
|
+
const originResult = resolveOriginUpdate(options2.origin, found.item);
|
|
11820
|
+
if (originResult.kind === "noop") return;
|
|
11821
|
+
const origin = originResult.kind === "set" ? originResult.origin : void 0;
|
|
11822
|
+
const built = buildUpdateValues({ ...options2, ac: acResult.ac, origin });
|
|
11792
11823
|
if (!built) return;
|
|
11793
11824
|
const { orm } = found;
|
|
11794
11825
|
const itemId2 = found.item.id;
|
|
11795
11826
|
await orm.update(items).set(built.set).where(eq36(items.id, itemId2));
|
|
11796
11827
|
console.log(
|
|
11797
|
-
|
|
11828
|
+
chalk108.green(`Updated ${built.fields} on item ${formatItemId(itemId2)}.`)
|
|
11798
11829
|
);
|
|
11799
11830
|
}
|
|
11800
11831
|
|
|
@@ -11814,7 +11845,10 @@ function registerUpdateCommands(cmd) {
|
|
|
11814
11845
|
).option(
|
|
11815
11846
|
"--edit-ac <n> <text...>",
|
|
11816
11847
|
"Replace acceptance criterion n (1-based) in place"
|
|
11817
|
-
).option("--remove-ac <n>", "Remove acceptance criterion n (1-based)").
|
|
11848
|
+
).option("--remove-ac <n>", "Remove acceptance criterion n (1-based)").option(
|
|
11849
|
+
"--origin [origin]",
|
|
11850
|
+
"Retag the item to a different repo (origin URL or key, normalized); with no value, retags to the current repo's origin"
|
|
11851
|
+
).action(update);
|
|
11818
11852
|
registerUpdatePhaseCommand(cmd);
|
|
11819
11853
|
cmd.command("remove-phase <id> <phase>").description("Remove a plan phase from a backlog item").action(removePhase);
|
|
11820
11854
|
cmd.command("move-phase <id> <from> <to>").description(
|
|
@@ -12599,11 +12633,11 @@ function assertCliExists(cli) {
|
|
|
12599
12633
|
}
|
|
12600
12634
|
|
|
12601
12635
|
// src/commands/permitCliReads/colorize.ts
|
|
12602
|
-
import
|
|
12636
|
+
import chalk109 from "chalk";
|
|
12603
12637
|
function colorize(plainOutput) {
|
|
12604
12638
|
return plainOutput.split("\n").map((line) => {
|
|
12605
|
-
if (line.startsWith(" R ")) return
|
|
12606
|
-
if (line.startsWith(" W ")) return
|
|
12639
|
+
if (line.startsWith(" R ")) return chalk109.green(line);
|
|
12640
|
+
if (line.startsWith(" W ")) return chalk109.red(line);
|
|
12607
12641
|
return line;
|
|
12608
12642
|
}).join("\n");
|
|
12609
12643
|
}
|
|
@@ -12901,7 +12935,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
12901
12935
|
}
|
|
12902
12936
|
|
|
12903
12937
|
// src/commands/deny/denyAdd.ts
|
|
12904
|
-
import
|
|
12938
|
+
import chalk110 from "chalk";
|
|
12905
12939
|
|
|
12906
12940
|
// src/commands/deny/loadDenyConfig.ts
|
|
12907
12941
|
function loadDenyConfig(global) {
|
|
@@ -12921,16 +12955,16 @@ function loadDenyConfig(global) {
|
|
|
12921
12955
|
function denyAdd(pattern2, message, options2) {
|
|
12922
12956
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12923
12957
|
if (deny.some((r) => r.pattern === pattern2)) {
|
|
12924
|
-
console.log(
|
|
12958
|
+
console.log(chalk110.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
12925
12959
|
return;
|
|
12926
12960
|
}
|
|
12927
12961
|
deny.push({ pattern: pattern2, message });
|
|
12928
12962
|
saveDeny(deny);
|
|
12929
|
-
console.log(
|
|
12963
|
+
console.log(chalk110.green(`Added deny rule: ${pattern2} \u2192 ${message}`));
|
|
12930
12964
|
}
|
|
12931
12965
|
|
|
12932
12966
|
// src/commands/deny/denyList.ts
|
|
12933
|
-
import
|
|
12967
|
+
import chalk111 from "chalk";
|
|
12934
12968
|
function denyList() {
|
|
12935
12969
|
const globalRaw = loadGlobalConfigRaw();
|
|
12936
12970
|
const projectRaw = loadProjectConfig();
|
|
@@ -12941,7 +12975,7 @@ function denyList() {
|
|
|
12941
12975
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
12942
12976
|
);
|
|
12943
12977
|
if (!merged || merged.length === 0) {
|
|
12944
|
-
console.log(
|
|
12978
|
+
console.log(chalk111.dim("No deny rules configured."));
|
|
12945
12979
|
return;
|
|
12946
12980
|
}
|
|
12947
12981
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -12949,23 +12983,23 @@ function denyList() {
|
|
|
12949
12983
|
for (const rule of merged) {
|
|
12950
12984
|
const inProject = projectPatterns.has(rule.pattern);
|
|
12951
12985
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
12952
|
-
const label2 = inProject && inGlobal ?
|
|
12953
|
-
console.log(`${
|
|
12986
|
+
const label2 = inProject && inGlobal ? chalk111.dim(" (project, overrides global)") : inGlobal ? chalk111.dim(" (global)") : "";
|
|
12987
|
+
console.log(`${chalk111.red(rule.pattern)} \u2192 ${rule.message}${label2}`);
|
|
12954
12988
|
}
|
|
12955
12989
|
}
|
|
12956
12990
|
|
|
12957
12991
|
// src/commands/deny/denyRemove.ts
|
|
12958
|
-
import
|
|
12992
|
+
import chalk112 from "chalk";
|
|
12959
12993
|
function denyRemove(pattern2, options2) {
|
|
12960
12994
|
const { deny, saveDeny } = loadDenyConfig(options2.global);
|
|
12961
12995
|
const index3 = deny.findIndex((r) => r.pattern === pattern2);
|
|
12962
12996
|
if (index3 === -1) {
|
|
12963
|
-
console.log(
|
|
12997
|
+
console.log(chalk112.yellow(`No deny rule found for: ${pattern2}`));
|
|
12964
12998
|
return;
|
|
12965
12999
|
}
|
|
12966
13000
|
deny.splice(index3, 1);
|
|
12967
13001
|
saveDeny(deny.length > 0 ? deny : void 0);
|
|
12968
|
-
console.log(
|
|
13002
|
+
console.log(chalk112.green(`Removed deny rule: ${pattern2}`));
|
|
12969
13003
|
}
|
|
12970
13004
|
|
|
12971
13005
|
// src/commands/registerDeny.ts
|
|
@@ -13009,7 +13043,7 @@ function registerCliHook(program2) {
|
|
|
13009
13043
|
|
|
13010
13044
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
13011
13045
|
import { existsSync as existsSync33, readFileSync as readFileSync27, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
|
|
13012
|
-
import
|
|
13046
|
+
import chalk113 from "chalk";
|
|
13013
13047
|
|
|
13014
13048
|
// src/commands/codeComment/getRestrictedDir.ts
|
|
13015
13049
|
import { homedir as homedir17 } from "os";
|
|
@@ -13062,12 +13096,12 @@ function codeCommentConfirm(pin) {
|
|
|
13062
13096
|
sweepRestrictedDir();
|
|
13063
13097
|
const state = readPinState(pin);
|
|
13064
13098
|
if (!state) {
|
|
13065
|
-
console.error(
|
|
13099
|
+
console.error(chalk113.red(`No pending comment for pin: ${pin}`));
|
|
13066
13100
|
process.exitCode = 1;
|
|
13067
13101
|
return;
|
|
13068
13102
|
}
|
|
13069
13103
|
if (!existsSync33(state.file)) {
|
|
13070
|
-
console.error(
|
|
13104
|
+
console.error(chalk113.red(`Target file no longer exists: ${state.file}`));
|
|
13071
13105
|
process.exitCode = 1;
|
|
13072
13106
|
return;
|
|
13073
13107
|
}
|
|
@@ -13076,7 +13110,7 @@ function codeCommentConfirm(pin) {
|
|
|
13076
13110
|
const index3 = state.line - 1;
|
|
13077
13111
|
if (index3 > lines.length) {
|
|
13078
13112
|
console.error(
|
|
13079
|
-
|
|
13113
|
+
chalk113.red(
|
|
13080
13114
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
13081
13115
|
)
|
|
13082
13116
|
);
|
|
@@ -13090,14 +13124,14 @@ function codeCommentConfirm(pin) {
|
|
|
13090
13124
|
writeFileSync24(state.file, lines.join("\n"));
|
|
13091
13125
|
unlinkSync8(getPinStatePath(pin));
|
|
13092
13126
|
console.log(
|
|
13093
|
-
|
|
13127
|
+
chalk113.green(
|
|
13094
13128
|
`Inserted "${marker} ${state.text}" at ${state.file}:${state.line}`
|
|
13095
13129
|
)
|
|
13096
13130
|
);
|
|
13097
13131
|
}
|
|
13098
13132
|
|
|
13099
13133
|
// src/commands/codeComment/codeCommentSet.ts
|
|
13100
|
-
import
|
|
13134
|
+
import chalk114 from "chalk";
|
|
13101
13135
|
|
|
13102
13136
|
// src/commands/codeComment/validateCommentText.ts
|
|
13103
13137
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -13148,7 +13182,7 @@ function generatePin() {
|
|
|
13148
13182
|
function codeCommentSet(file, line, text17) {
|
|
13149
13183
|
const lineNumber = Number.parseInt(line, 10);
|
|
13150
13184
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
13151
|
-
console.error(
|
|
13185
|
+
console.error(chalk114.red(`Invalid line number: ${line}`));
|
|
13152
13186
|
process.exitCode = 1;
|
|
13153
13187
|
return;
|
|
13154
13188
|
}
|
|
@@ -13156,20 +13190,20 @@ function codeCommentSet(file, line, text17) {
|
|
|
13156
13190
|
const marker = hash ? "#" : "//";
|
|
13157
13191
|
const validation = validateCommentText(text17, hash);
|
|
13158
13192
|
if (!validation.ok) {
|
|
13159
|
-
console.error(
|
|
13160
|
-
console.error(
|
|
13193
|
+
console.error(chalk114.red(`Refused: ${validation.reason}`));
|
|
13194
|
+
console.error(chalk114.red("No pin issued."));
|
|
13161
13195
|
process.exitCode = 1;
|
|
13162
13196
|
return;
|
|
13163
13197
|
}
|
|
13164
13198
|
console.error(
|
|
13165
|
-
|
|
13199
|
+
chalk114.yellow.bold(
|
|
13166
13200
|
"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
13201
|
)
|
|
13168
13202
|
);
|
|
13169
13203
|
const delivered = issuePin(file, lineNumber, validation.text);
|
|
13170
13204
|
if (!delivered) {
|
|
13171
13205
|
console.error(
|
|
13172
|
-
|
|
13206
|
+
chalk114.red(
|
|
13173
13207
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
13174
13208
|
)
|
|
13175
13209
|
);
|
|
@@ -13179,7 +13213,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
13179
13213
|
console.log(
|
|
13180
13214
|
`A confirmation pin was sent to your desktop notifications.
|
|
13181
13215
|
To insert "${marker} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
13182
|
-
${
|
|
13216
|
+
${chalk114.cyan(" assist code-comment confirm <PIN>")}
|
|
13183
13217
|
using the pin from that notification.`
|
|
13184
13218
|
);
|
|
13185
13219
|
}
|
|
@@ -13258,15 +13292,15 @@ function registerCodexHook(program2) {
|
|
|
13258
13292
|
}
|
|
13259
13293
|
|
|
13260
13294
|
// src/commands/complexity/analyze.ts
|
|
13261
|
-
import
|
|
13295
|
+
import chalk123 from "chalk";
|
|
13262
13296
|
|
|
13263
13297
|
// src/commands/complexity/cyclomatic.ts
|
|
13264
|
-
import
|
|
13298
|
+
import chalk116 from "chalk";
|
|
13265
13299
|
|
|
13266
13300
|
// src/commands/complexity/shared/index.ts
|
|
13267
13301
|
import fs20 from "fs";
|
|
13268
13302
|
import path27 from "path";
|
|
13269
|
-
import
|
|
13303
|
+
import chalk115 from "chalk";
|
|
13270
13304
|
import ts5 from "typescript";
|
|
13271
13305
|
|
|
13272
13306
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -13517,7 +13551,7 @@ function createSourceFromFile(filePath) {
|
|
|
13517
13551
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
13518
13552
|
const files = findSourceFiles2(pattern2, ".", extraIgnore);
|
|
13519
13553
|
if (files.length === 0) {
|
|
13520
|
-
console.log(
|
|
13554
|
+
console.log(chalk115.yellow("No files found matching pattern"));
|
|
13521
13555
|
return void 0;
|
|
13522
13556
|
}
|
|
13523
13557
|
return callback(files);
|
|
@@ -13550,11 +13584,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13550
13584
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
13551
13585
|
for (const { file, name, complexity } of results) {
|
|
13552
13586
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
13553
|
-
const color = exceedsThreshold ?
|
|
13554
|
-
console.log(`${color(`${file}:${name}`)} \u2192 ${
|
|
13587
|
+
const color = exceedsThreshold ? chalk116.red : chalk116.white;
|
|
13588
|
+
console.log(`${color(`${file}:${name}`)} \u2192 ${chalk116.cyan(complexity)}`);
|
|
13555
13589
|
}
|
|
13556
13590
|
console.log(
|
|
13557
|
-
|
|
13591
|
+
chalk116.dim(
|
|
13558
13592
|
`
|
|
13559
13593
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13560
13594
|
)
|
|
@@ -13566,7 +13600,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
13566
13600
|
}
|
|
13567
13601
|
|
|
13568
13602
|
// src/commands/complexity/halstead.ts
|
|
13569
|
-
import
|
|
13603
|
+
import chalk117 from "chalk";
|
|
13570
13604
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
13571
13605
|
withSourceFiles(pattern2, (files) => {
|
|
13572
13606
|
const results = [];
|
|
@@ -13581,13 +13615,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13581
13615
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
13582
13616
|
for (const { file, name, metrics } of results) {
|
|
13583
13617
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
13584
|
-
const color = exceedsThreshold ?
|
|
13618
|
+
const color = exceedsThreshold ? chalk117.red : chalk117.white;
|
|
13585
13619
|
console.log(
|
|
13586
|
-
`${color(`${file}:${name}`)} \u2192 volume: ${
|
|
13620
|
+
`${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
13621
|
);
|
|
13588
13622
|
}
|
|
13589
13623
|
console.log(
|
|
13590
|
-
|
|
13624
|
+
chalk117.dim(
|
|
13591
13625
|
`
|
|
13592
13626
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
13593
13627
|
)
|
|
@@ -13664,15 +13698,15 @@ function collectFileMetrics(files) {
|
|
|
13664
13698
|
}
|
|
13665
13699
|
|
|
13666
13700
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
13667
|
-
import
|
|
13701
|
+
import chalk121 from "chalk";
|
|
13668
13702
|
|
|
13669
13703
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
13670
|
-
import
|
|
13704
|
+
import chalk118 from "chalk";
|
|
13671
13705
|
function formatResultLine(entry, failing) {
|
|
13672
13706
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
13673
|
-
const name = failing ?
|
|
13674
|
-
const suffix = override !== void 0 ?
|
|
13675
|
-
return `${name} \u2192 avg: ${
|
|
13707
|
+
const name = failing ? chalk118.red(file) : chalk118.white(file);
|
|
13708
|
+
const suffix = override !== void 0 ? chalk118.magenta(` (override: ${override})`) : "";
|
|
13709
|
+
return `${name} \u2192 avg: ${chalk118.cyan(avgMaintainability.toFixed(1))}, min: ${chalk118.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
13676
13710
|
}
|
|
13677
13711
|
|
|
13678
13712
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -13723,44 +13757,44 @@ function getMaintainabilityGitState() {
|
|
|
13723
13757
|
|
|
13724
13758
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
13725
13759
|
import path29 from "path";
|
|
13726
|
-
import
|
|
13760
|
+
import chalk119 from "chalk";
|
|
13727
13761
|
function suggestDestination(file, functionName) {
|
|
13728
13762
|
return path29.join(path29.dirname(file), `${functionName}.ts`);
|
|
13729
13763
|
}
|
|
13730
13764
|
function remediationLine(entry) {
|
|
13731
13765
|
const { file, largestFunction } = entry;
|
|
13732
13766
|
if (largestFunction === "" || largestFunction.startsWith("<"))
|
|
13733
|
-
return ` Move the largest responsibility out of ${
|
|
13767
|
+
return ` Move the largest responsibility out of ${chalk119.bold(file)} into a new file with 'assist refactor extract'.`;
|
|
13734
13768
|
const dest = suggestDestination(file, largestFunction);
|
|
13735
13769
|
const command = `assist refactor extract ${file} ${largestFunction} ${dest} --apply`;
|
|
13736
|
-
return ` ${
|
|
13737
|
-
${
|
|
13770
|
+
return ` ${chalk119.bold(file)} \u2192 extract '${largestFunction}' to a new file:
|
|
13771
|
+
${chalk119.cyan(command)}`;
|
|
13738
13772
|
}
|
|
13739
13773
|
function cheatLine(entry, gitState) {
|
|
13740
13774
|
const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
|
|
13741
13775
|
if (!shrank || gitState.newFileCreated) return "";
|
|
13742
13776
|
return `
|
|
13743
|
-
${
|
|
13777
|
+
${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
13778
|
}
|
|
13745
13779
|
function printMaintainabilityFailure(failing, gitState) {
|
|
13746
13780
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
13747
13781
|
console.error(
|
|
13748
|
-
|
|
13782
|
+
chalk119.red(
|
|
13749
13783
|
`
|
|
13750
13784
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
13751
13785
|
|
|
13752
13786
|
${blocks}
|
|
13753
13787
|
|
|
13754
|
-
${
|
|
13788
|
+
${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
13789
|
)
|
|
13756
13790
|
);
|
|
13757
13791
|
}
|
|
13758
13792
|
|
|
13759
13793
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
13760
|
-
import
|
|
13794
|
+
import chalk120 from "chalk";
|
|
13761
13795
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
13762
13796
|
function printMaintainabilityFormula() {
|
|
13763
|
-
console.log(
|
|
13797
|
+
console.log(chalk120.dim(MI_FORMULA));
|
|
13764
13798
|
}
|
|
13765
13799
|
|
|
13766
13800
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -13769,7 +13803,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
13769
13803
|
if (!gating) {
|
|
13770
13804
|
printMaintainabilityFormula();
|
|
13771
13805
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
13772
|
-
console.log(
|
|
13806
|
+
console.log(chalk121.dim(`
|
|
13773
13807
|
Analyzed ${results.length} files`));
|
|
13774
13808
|
return;
|
|
13775
13809
|
}
|
|
@@ -13778,14 +13812,14 @@ Analyzed ${results.length} files`));
|
|
|
13778
13812
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
13779
13813
|
});
|
|
13780
13814
|
if (failing.length === 0) {
|
|
13781
|
-
console.log(
|
|
13815
|
+
console.log(chalk121.green("All files pass maintainability threshold"));
|
|
13782
13816
|
}
|
|
13783
13817
|
const passingOverrides = results.filter(
|
|
13784
13818
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
13785
13819
|
);
|
|
13786
13820
|
for (const entry of passingOverrides)
|
|
13787
13821
|
console.log(formatResultLine(entry, false));
|
|
13788
|
-
console.log(
|
|
13822
|
+
console.log(chalk121.dim(`
|
|
13789
13823
|
Analyzed ${results.length} files`));
|
|
13790
13824
|
if (failing.length > 0) {
|
|
13791
13825
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -13808,7 +13842,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13808
13842
|
|
|
13809
13843
|
// src/commands/complexity/sloc.ts
|
|
13810
13844
|
import fs22 from "fs";
|
|
13811
|
-
import
|
|
13845
|
+
import chalk122 from "chalk";
|
|
13812
13846
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
13813
13847
|
withSourceFiles(pattern2, (files) => {
|
|
13814
13848
|
const results = [];
|
|
@@ -13824,12 +13858,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
13824
13858
|
results.sort((a, b) => b.lines - a.lines);
|
|
13825
13859
|
for (const { file, lines } of results) {
|
|
13826
13860
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
13827
|
-
const color = exceedsThreshold ?
|
|
13828
|
-
console.log(`${color(file)} \u2192 ${
|
|
13861
|
+
const color = exceedsThreshold ? chalk122.red : chalk122.white;
|
|
13862
|
+
console.log(`${color(file)} \u2192 ${chalk122.cyan(lines)} lines`);
|
|
13829
13863
|
}
|
|
13830
13864
|
const total = results.reduce((sum, r) => sum + r.lines, 0);
|
|
13831
13865
|
console.log(
|
|
13832
|
-
|
|
13866
|
+
chalk122.dim(`
|
|
13833
13867
|
Total: ${total} lines across ${files.length} files`)
|
|
13834
13868
|
);
|
|
13835
13869
|
if (hasViolation) {
|
|
@@ -13843,25 +13877,25 @@ async function analyze(pattern2) {
|
|
|
13843
13877
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
13844
13878
|
const files = findSourceFiles2(searchPattern);
|
|
13845
13879
|
if (files.length === 0) {
|
|
13846
|
-
console.log(
|
|
13880
|
+
console.log(chalk123.yellow("No files found matching pattern"));
|
|
13847
13881
|
return;
|
|
13848
13882
|
}
|
|
13849
13883
|
if (files.length === 1) {
|
|
13850
13884
|
const file = files[0];
|
|
13851
|
-
console.log(
|
|
13885
|
+
console.log(chalk123.bold.underline("SLOC"));
|
|
13852
13886
|
await sloc(file);
|
|
13853
13887
|
console.log();
|
|
13854
|
-
console.log(
|
|
13888
|
+
console.log(chalk123.bold.underline("Cyclomatic Complexity"));
|
|
13855
13889
|
await cyclomatic(file);
|
|
13856
13890
|
console.log();
|
|
13857
|
-
console.log(
|
|
13891
|
+
console.log(chalk123.bold.underline("Halstead Metrics"));
|
|
13858
13892
|
await halstead(file);
|
|
13859
13893
|
console.log();
|
|
13860
|
-
console.log(
|
|
13894
|
+
console.log(chalk123.bold.underline("Maintainability Index"));
|
|
13861
13895
|
await maintainability(file);
|
|
13862
13896
|
console.log();
|
|
13863
13897
|
console.log(
|
|
13864
|
-
|
|
13898
|
+
chalk123.dim(
|
|
13865
13899
|
"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
13900
|
)
|
|
13867
13901
|
);
|
|
@@ -13912,7 +13946,7 @@ function configList() {
|
|
|
13912
13946
|
}
|
|
13913
13947
|
|
|
13914
13948
|
// src/commands/config/configGet.ts
|
|
13915
|
-
import
|
|
13949
|
+
import chalk124 from "chalk";
|
|
13916
13950
|
|
|
13917
13951
|
// src/commands/config/getNestedValue.ts
|
|
13918
13952
|
function isTraversable(value) {
|
|
@@ -13944,12 +13978,12 @@ function requireNestedValue(config, key) {
|
|
|
13944
13978
|
return value;
|
|
13945
13979
|
}
|
|
13946
13980
|
function exitKeyNotSet(key) {
|
|
13947
|
-
console.error(
|
|
13981
|
+
console.error(chalk124.red(`Key "${key}" is not set`));
|
|
13948
13982
|
process.exit(1);
|
|
13949
13983
|
}
|
|
13950
13984
|
|
|
13951
13985
|
// src/commands/config/configSet.ts
|
|
13952
|
-
import
|
|
13986
|
+
import chalk126 from "chalk";
|
|
13953
13987
|
|
|
13954
13988
|
// src/commands/config/setNestedValue.ts
|
|
13955
13989
|
function isPlainObject(val) {
|
|
@@ -14000,7 +14034,7 @@ function setNestedValue(obj, path71, value) {
|
|
|
14000
14034
|
}
|
|
14001
14035
|
|
|
14002
14036
|
// src/commands/config/validateConfig.ts
|
|
14003
|
-
import
|
|
14037
|
+
import chalk125 from "chalk";
|
|
14004
14038
|
function validateConfig(updated, key) {
|
|
14005
14039
|
const result = assistConfigSchema.safeParse(updated);
|
|
14006
14040
|
if (!result.success) return exitValidationFailed(result.error.issues, key);
|
|
@@ -14013,7 +14047,7 @@ function exitValidationFailed(issues, key) {
|
|
|
14013
14047
|
function printValidationErrors(issues, key) {
|
|
14014
14048
|
for (const issue of issues) {
|
|
14015
14049
|
console.error(
|
|
14016
|
-
|
|
14050
|
+
chalk125.red(`${formatIssuePath(issue, key)}: ${issue.message}`)
|
|
14017
14051
|
);
|
|
14018
14052
|
}
|
|
14019
14053
|
}
|
|
@@ -14045,12 +14079,12 @@ var GLOBAL_ONLY_KEYS = ["sync.autoConfirm"];
|
|
|
14045
14079
|
function configSet(key, value, options2 = {}) {
|
|
14046
14080
|
const coerced = coerceValue(value);
|
|
14047
14081
|
if (options2.repo && options2.global) {
|
|
14048
|
-
console.error(
|
|
14082
|
+
console.error(chalk126.red("Use either --repo or --global, not both"));
|
|
14049
14083
|
process.exit(1);
|
|
14050
14084
|
}
|
|
14051
14085
|
const target = options2.repo ? `repo: ${applyRepoConfigSet(key, coerced)}` : applyConfigSet(key, coerced, options2.global ?? false);
|
|
14052
14086
|
console.log(
|
|
14053
|
-
|
|
14087
|
+
chalk126.green(`Set ${key} = ${JSON.stringify(coerced)} (${target})`)
|
|
14054
14088
|
);
|
|
14055
14089
|
}
|
|
14056
14090
|
function coerceValue(value) {
|
|
@@ -14073,7 +14107,7 @@ function applyConfigSet(key, coerced, global) {
|
|
|
14073
14107
|
function assertNotGlobalOnly(key, global) {
|
|
14074
14108
|
if (!global && GLOBAL_ONLY_KEYS.some((k) => key.startsWith(k))) {
|
|
14075
14109
|
console.error(
|
|
14076
|
-
|
|
14110
|
+
chalk126.red(
|
|
14077
14111
|
`"${key}" is a global-only key. Use --global to set it in ~/.assist.yml`
|
|
14078
14112
|
)
|
|
14079
14113
|
);
|
|
@@ -14093,40 +14127,40 @@ function registerConfig(program2) {
|
|
|
14093
14127
|
}
|
|
14094
14128
|
|
|
14095
14129
|
// src/commands/db/reportMigrationStatus.ts
|
|
14096
|
-
import
|
|
14130
|
+
import chalk127 from "chalk";
|
|
14097
14131
|
function reportApplied(applied) {
|
|
14098
14132
|
if (applied.length === 0) {
|
|
14099
|
-
console.error(
|
|
14133
|
+
console.error(chalk127.green("Database is up to date; nothing to apply."));
|
|
14100
14134
|
return;
|
|
14101
14135
|
}
|
|
14102
14136
|
for (const migration of applied) {
|
|
14103
14137
|
console.error(
|
|
14104
|
-
|
|
14138
|
+
chalk127.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
14105
14139
|
);
|
|
14106
14140
|
}
|
|
14107
14141
|
}
|
|
14108
14142
|
function reportMigrationStatus(status3) {
|
|
14109
14143
|
if (status3.state === "in-sync") {
|
|
14110
14144
|
console.error(
|
|
14111
|
-
|
|
14145
|
+
chalk127.green(`In sync at migration ${status3.version} (latest).`)
|
|
14112
14146
|
);
|
|
14113
14147
|
return;
|
|
14114
14148
|
}
|
|
14115
14149
|
if (status3.state === "behind") {
|
|
14116
14150
|
console.error(
|
|
14117
|
-
|
|
14151
|
+
chalk127.yellow(
|
|
14118
14152
|
`Behind: applied ${status3.applied}, build expects ${status3.expected}.`
|
|
14119
14153
|
)
|
|
14120
14154
|
);
|
|
14121
14155
|
console.error(
|
|
14122
|
-
|
|
14156
|
+
chalk127.yellow(
|
|
14123
14157
|
`Pending: ${status3.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
14124
14158
|
)
|
|
14125
14159
|
);
|
|
14126
14160
|
return;
|
|
14127
14161
|
}
|
|
14128
14162
|
console.error(
|
|
14129
|
-
|
|
14163
|
+
chalk127.red(
|
|
14130
14164
|
`Ahead: applied ${status3.applied}, build knows ${status3.expected}. Update assist.`
|
|
14131
14165
|
)
|
|
14132
14166
|
);
|
|
@@ -14161,7 +14195,7 @@ function registerDb(program2) {
|
|
|
14161
14195
|
|
|
14162
14196
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
14163
14197
|
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync26 } from "fs";
|
|
14164
|
-
import
|
|
14198
|
+
import chalk128 from "chalk";
|
|
14165
14199
|
|
|
14166
14200
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
14167
14201
|
import { join as join34 } from "path";
|
|
@@ -14192,7 +14226,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14192
14226
|
sweepRestrictedDir();
|
|
14193
14227
|
const state = readMigrationPinState(pin);
|
|
14194
14228
|
if (!state) {
|
|
14195
|
-
console.error(
|
|
14229
|
+
console.error(chalk128.red(`No pending migration unlock for pin: ${pin}`));
|
|
14196
14230
|
process.exitCode = 1;
|
|
14197
14231
|
return;
|
|
14198
14232
|
}
|
|
@@ -14202,7 +14236,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14202
14236
|
);
|
|
14203
14237
|
unlinkSync9(getMigrationPinPath(pin));
|
|
14204
14238
|
console.log(
|
|
14205
|
-
|
|
14239
|
+
chalk128.green(
|
|
14206
14240
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
14207
14241
|
)
|
|
14208
14242
|
);
|
|
@@ -14211,7 +14245,7 @@ function dbMigrationConfirm(pin) {
|
|
|
14211
14245
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
14212
14246
|
import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync27 } from "fs";
|
|
14213
14247
|
import { randomInt as randomInt2 } from "crypto";
|
|
14214
|
-
import
|
|
14248
|
+
import chalk129 from "chalk";
|
|
14215
14249
|
|
|
14216
14250
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
14217
14251
|
function nextMigrationId() {
|
|
@@ -14226,7 +14260,7 @@ function dbMigrationUnlock() {
|
|
|
14226
14260
|
sweepRestrictedDir();
|
|
14227
14261
|
writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
|
|
14228
14262
|
console.error(
|
|
14229
|
-
|
|
14263
|
+
chalk129.yellow.bold(
|
|
14230
14264
|
"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
14265
|
)
|
|
14232
14266
|
);
|
|
@@ -14236,7 +14270,7 @@ function dbMigrationUnlock() {
|
|
|
14236
14270
|
});
|
|
14237
14271
|
if (!delivered) {
|
|
14238
14272
|
console.error(
|
|
14239
|
-
|
|
14273
|
+
chalk129.red(
|
|
14240
14274
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
14241
14275
|
)
|
|
14242
14276
|
);
|
|
@@ -14246,7 +14280,7 @@ function dbMigrationUnlock() {
|
|
|
14246
14280
|
console.log(
|
|
14247
14281
|
`A confirmation pin was sent to your desktop notifications.
|
|
14248
14282
|
To approve creating migration ${migrationId}, run:
|
|
14249
|
-
${
|
|
14283
|
+
${chalk129.cyan(" assist db-migration confirm <PIN>")}
|
|
14250
14284
|
using the pin from that notification.`
|
|
14251
14285
|
);
|
|
14252
14286
|
}
|
|
@@ -14266,7 +14300,7 @@ function registerDbMigration(parent) {
|
|
|
14266
14300
|
|
|
14267
14301
|
// src/commands/deploy/redirect.ts
|
|
14268
14302
|
import { existsSync as existsSync35, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "fs";
|
|
14269
|
-
import
|
|
14303
|
+
import chalk130 from "chalk";
|
|
14270
14304
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
14271
14305
|
if (!window.location.pathname.endsWith('/')) {
|
|
14272
14306
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -14275,23 +14309,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
14275
14309
|
function redirect() {
|
|
14276
14310
|
const indexPath = "index.html";
|
|
14277
14311
|
if (!existsSync35(indexPath)) {
|
|
14278
|
-
console.log(
|
|
14312
|
+
console.log(chalk130.yellow("No index.html found"));
|
|
14279
14313
|
return;
|
|
14280
14314
|
}
|
|
14281
14315
|
const content = readFileSync29(indexPath, "utf8");
|
|
14282
14316
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
14283
|
-
console.log(
|
|
14317
|
+
console.log(chalk130.dim("Trailing slash script already present"));
|
|
14284
14318
|
return;
|
|
14285
14319
|
}
|
|
14286
14320
|
const headCloseIndex = content.indexOf("</head>");
|
|
14287
14321
|
if (headCloseIndex === -1) {
|
|
14288
|
-
console.log(
|
|
14322
|
+
console.log(chalk130.red("Could not find </head> tag in index.html"));
|
|
14289
14323
|
return;
|
|
14290
14324
|
}
|
|
14291
14325
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
14292
14326
|
${content.slice(headCloseIndex)}`;
|
|
14293
14327
|
writeFileSync28(indexPath, newContent);
|
|
14294
|
-
console.log(
|
|
14328
|
+
console.log(chalk130.green("Added trailing slash redirect to index.html"));
|
|
14295
14329
|
}
|
|
14296
14330
|
|
|
14297
14331
|
// src/commands/registerDeploy.ts
|
|
@@ -14318,7 +14352,7 @@ function loadBlogSkipDays(repoName) {
|
|
|
14318
14352
|
|
|
14319
14353
|
// src/commands/devlog/shared.ts
|
|
14320
14354
|
import { execSync as execSync33 } from "child_process";
|
|
14321
|
-
import
|
|
14355
|
+
import chalk131 from "chalk";
|
|
14322
14356
|
|
|
14323
14357
|
// src/shared/getRepoName.ts
|
|
14324
14358
|
import { existsSync as existsSync36, readFileSync as readFileSync30 } from "fs";
|
|
@@ -14427,13 +14461,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
14427
14461
|
}
|
|
14428
14462
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
14429
14463
|
for (const commit2 of commits2) {
|
|
14430
|
-
console.log(` ${
|
|
14464
|
+
console.log(` ${chalk131.yellow(commit2.hash)} ${commit2.message}`);
|
|
14431
14465
|
if (verbose) {
|
|
14432
14466
|
const visibleFiles = commit2.files.filter(
|
|
14433
14467
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
14434
14468
|
);
|
|
14435
14469
|
for (const file of visibleFiles) {
|
|
14436
|
-
console.log(` ${
|
|
14470
|
+
console.log(` ${chalk131.dim(file)}`);
|
|
14437
14471
|
}
|
|
14438
14472
|
}
|
|
14439
14473
|
}
|
|
@@ -14458,15 +14492,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
14458
14492
|
}
|
|
14459
14493
|
|
|
14460
14494
|
// src/commands/devlog/list/printDateHeader.ts
|
|
14461
|
-
import
|
|
14495
|
+
import chalk132 from "chalk";
|
|
14462
14496
|
function printDateHeader(date, isSkipped, entries) {
|
|
14463
14497
|
if (isSkipped) {
|
|
14464
|
-
console.log(`${
|
|
14498
|
+
console.log(`${chalk132.bold.blue(date)} ${chalk132.dim("skipped")}`);
|
|
14465
14499
|
} else if (entries && entries.length > 0) {
|
|
14466
|
-
const entryInfo = entries.map((e) => `${
|
|
14467
|
-
console.log(`${
|
|
14500
|
+
const entryInfo = entries.map((e) => `${chalk132.green(e.version)} ${e.title}`).join(" | ");
|
|
14501
|
+
console.log(`${chalk132.bold.blue(date)} ${entryInfo}`);
|
|
14468
14502
|
} else {
|
|
14469
|
-
console.log(`${
|
|
14503
|
+
console.log(`${chalk132.bold.blue(date)} ${chalk132.red("\u26A0 devlog missing")}`);
|
|
14470
14504
|
}
|
|
14471
14505
|
}
|
|
14472
14506
|
|
|
@@ -14570,24 +14604,24 @@ function bumpVersion(version2, type) {
|
|
|
14570
14604
|
|
|
14571
14605
|
// src/commands/devlog/next/displayNextEntry/index.ts
|
|
14572
14606
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
14573
|
-
import
|
|
14607
|
+
import chalk134 from "chalk";
|
|
14574
14608
|
|
|
14575
14609
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
14576
|
-
import
|
|
14610
|
+
import chalk133 from "chalk";
|
|
14577
14611
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
14578
14612
|
if (conventional && firstHash) {
|
|
14579
14613
|
const version2 = getVersionAtCommit(firstHash);
|
|
14580
14614
|
if (version2) {
|
|
14581
|
-
console.log(`${
|
|
14615
|
+
console.log(`${chalk133.bold("version:")} ${stripToMinor(version2)}`);
|
|
14582
14616
|
} else {
|
|
14583
|
-
console.log(`${
|
|
14617
|
+
console.log(`${chalk133.bold("version:")} ${chalk133.red("unknown")}`);
|
|
14584
14618
|
}
|
|
14585
14619
|
} else if (patchVersion && minorVersion) {
|
|
14586
14620
|
console.log(
|
|
14587
|
-
`${
|
|
14621
|
+
`${chalk133.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
14588
14622
|
);
|
|
14589
14623
|
} else {
|
|
14590
|
-
console.log(`${
|
|
14624
|
+
console.log(`${chalk133.bold("version:")} v0.1 (initial)`);
|
|
14591
14625
|
}
|
|
14592
14626
|
}
|
|
14593
14627
|
|
|
@@ -14635,16 +14669,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
14635
14669
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
14636
14670
|
}
|
|
14637
14671
|
function logName(repoName) {
|
|
14638
|
-
console.log(`${
|
|
14672
|
+
console.log(`${chalk134.bold("name:")} ${repoName}`);
|
|
14639
14673
|
}
|
|
14640
14674
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
14641
14675
|
logName(ctx.repoName);
|
|
14642
14676
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
14643
|
-
console.log(
|
|
14677
|
+
console.log(chalk134.bold.blue(targetDate));
|
|
14644
14678
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
14645
14679
|
}
|
|
14646
14680
|
function logNoCommits(lastInfo) {
|
|
14647
|
-
console.log(
|
|
14681
|
+
console.log(chalk134.dim(noCommitsMessage(!!lastInfo)));
|
|
14648
14682
|
}
|
|
14649
14683
|
|
|
14650
14684
|
// src/commands/devlog/next/index.ts
|
|
@@ -14685,11 +14719,11 @@ function next2(options2) {
|
|
|
14685
14719
|
import { execSync as execSync35 } from "child_process";
|
|
14686
14720
|
|
|
14687
14721
|
// src/commands/devlog/repos/printReposTable.ts
|
|
14688
|
-
import
|
|
14722
|
+
import chalk135 from "chalk";
|
|
14689
14723
|
function colorStatus(status3) {
|
|
14690
|
-
if (status3 === "missing") return
|
|
14691
|
-
if (status3 === "outdated") return
|
|
14692
|
-
return
|
|
14724
|
+
if (status3 === "missing") return chalk135.red(status3);
|
|
14725
|
+
if (status3 === "outdated") return chalk135.yellow(status3);
|
|
14726
|
+
return chalk135.green(status3);
|
|
14693
14727
|
}
|
|
14694
14728
|
function formatRow(row, nameWidth) {
|
|
14695
14729
|
const devlog = (row.lastDevlog ?? "-").padEnd(11);
|
|
@@ -14703,8 +14737,8 @@ function printReposTable(rows) {
|
|
|
14703
14737
|
"Last Devlog".padEnd(11),
|
|
14704
14738
|
"Status"
|
|
14705
14739
|
].join(" ");
|
|
14706
|
-
console.log(
|
|
14707
|
-
console.log(
|
|
14740
|
+
console.log(chalk135.dim(header));
|
|
14741
|
+
console.log(chalk135.dim("-".repeat(header.length)));
|
|
14708
14742
|
for (const row of rows) {
|
|
14709
14743
|
console.log(formatRow(row, nameWidth));
|
|
14710
14744
|
}
|
|
@@ -14762,14 +14796,14 @@ function repos(options2) {
|
|
|
14762
14796
|
// src/commands/devlog/skip.ts
|
|
14763
14797
|
import { writeFileSync as writeFileSync29 } from "fs";
|
|
14764
14798
|
import { join as join38 } from "path";
|
|
14765
|
-
import
|
|
14799
|
+
import chalk136 from "chalk";
|
|
14766
14800
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
14767
14801
|
function getBlogConfigPath() {
|
|
14768
14802
|
return join38(BLOG_REPO_ROOT, "assist.yml");
|
|
14769
14803
|
}
|
|
14770
14804
|
function skip(date) {
|
|
14771
14805
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
14772
|
-
console.log(
|
|
14806
|
+
console.log(chalk136.red("Invalid date format. Use YYYY-MM-DD"));
|
|
14773
14807
|
process.exit(1);
|
|
14774
14808
|
}
|
|
14775
14809
|
const repoName = getRepoName();
|
|
@@ -14780,7 +14814,7 @@ function skip(date) {
|
|
|
14780
14814
|
const skipDays = skip2[repoName] ?? [];
|
|
14781
14815
|
if (skipDays.includes(date)) {
|
|
14782
14816
|
console.log(
|
|
14783
|
-
|
|
14817
|
+
chalk136.yellow(`${date} is already in skip list for ${repoName}`)
|
|
14784
14818
|
);
|
|
14785
14819
|
return;
|
|
14786
14820
|
}
|
|
@@ -14790,20 +14824,20 @@ function skip(date) {
|
|
|
14790
14824
|
devlog.skip = skip2;
|
|
14791
14825
|
config.devlog = devlog;
|
|
14792
14826
|
writeFileSync29(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
14793
|
-
console.log(
|
|
14827
|
+
console.log(chalk136.green(`Added ${date} to skip list for ${repoName}`));
|
|
14794
14828
|
}
|
|
14795
14829
|
|
|
14796
14830
|
// src/commands/devlog/version.ts
|
|
14797
|
-
import
|
|
14831
|
+
import chalk137 from "chalk";
|
|
14798
14832
|
function version() {
|
|
14799
14833
|
const config = loadConfig();
|
|
14800
14834
|
const name = getRepoName();
|
|
14801
14835
|
const lastInfo = getLastVersionInfo(name, config);
|
|
14802
14836
|
const lastVersion = lastInfo?.version ?? null;
|
|
14803
14837
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
14804
|
-
console.log(`${
|
|
14805
|
-
console.log(`${
|
|
14806
|
-
console.log(`${
|
|
14838
|
+
console.log(`${chalk137.bold("name:")} ${name}`);
|
|
14839
|
+
console.log(`${chalk137.bold("last:")} ${lastVersion ?? chalk137.dim("none")}`);
|
|
14840
|
+
console.log(`${chalk137.bold("next:")} ${nextVersion ?? chalk137.dim("none")}`);
|
|
14807
14841
|
}
|
|
14808
14842
|
|
|
14809
14843
|
// src/commands/devlog/devlogConfigHelp.ts
|
|
@@ -14847,7 +14881,7 @@ function registerDevlog(program2) {
|
|
|
14847
14881
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
14848
14882
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync5 } from "fs";
|
|
14849
14883
|
import { join as join39 } from "path";
|
|
14850
|
-
import
|
|
14884
|
+
import chalk138 from "chalk";
|
|
14851
14885
|
|
|
14852
14886
|
// src/shared/findRepoRoot.ts
|
|
14853
14887
|
import { existsSync as existsSync37 } from "fs";
|
|
@@ -14910,14 +14944,14 @@ function checkBuildLocks(startDir) {
|
|
|
14910
14944
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
14911
14945
|
if (locked) {
|
|
14912
14946
|
console.error(
|
|
14913
|
-
|
|
14947
|
+
chalk138.red("Build output locked (is VS debugging?): ") + locked
|
|
14914
14948
|
);
|
|
14915
14949
|
process.exit(1);
|
|
14916
14950
|
}
|
|
14917
14951
|
}
|
|
14918
14952
|
async function checkBuildLocksCommand() {
|
|
14919
14953
|
checkBuildLocks();
|
|
14920
|
-
console.log(
|
|
14954
|
+
console.log(chalk138.green("No build locks detected"));
|
|
14921
14955
|
}
|
|
14922
14956
|
|
|
14923
14957
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -15016,30 +15050,30 @@ function escapeRegex(s) {
|
|
|
15016
15050
|
}
|
|
15017
15051
|
|
|
15018
15052
|
// src/commands/dotnet/printTree.ts
|
|
15019
|
-
import
|
|
15053
|
+
import chalk139 from "chalk";
|
|
15020
15054
|
function printNodes(nodes, prefix2) {
|
|
15021
15055
|
for (let i = 0; i < nodes.length; i++) {
|
|
15022
15056
|
const isLast = i === nodes.length - 1;
|
|
15023
15057
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
15024
15058
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
15025
15059
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
15026
|
-
const label2 = isMissing ?
|
|
15060
|
+
const label2 = isMissing ? chalk139.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
15027
15061
|
console.log(`${prefix2}${connector}${label2}`);
|
|
15028
15062
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
15029
15063
|
}
|
|
15030
15064
|
}
|
|
15031
15065
|
function printTree(tree, totalCount, solutions) {
|
|
15032
|
-
console.log(
|
|
15033
|
-
console.log(
|
|
15066
|
+
console.log(chalk139.bold("\nProject Dependency Tree"));
|
|
15067
|
+
console.log(chalk139.cyan(tree.relativePath));
|
|
15034
15068
|
printNodes(tree.children, "");
|
|
15035
|
-
console.log(
|
|
15069
|
+
console.log(chalk139.dim(`
|
|
15036
15070
|
${totalCount} projects total (including root)`));
|
|
15037
|
-
console.log(
|
|
15071
|
+
console.log(chalk139.bold("\nSolution Membership"));
|
|
15038
15072
|
if (solutions.length === 0) {
|
|
15039
|
-
console.log(
|
|
15073
|
+
console.log(chalk139.yellow(" Not found in any .sln"));
|
|
15040
15074
|
} else {
|
|
15041
15075
|
for (const sln of solutions) {
|
|
15042
|
-
console.log(` ${
|
|
15076
|
+
console.log(` ${chalk139.green(sln)}`);
|
|
15043
15077
|
}
|
|
15044
15078
|
}
|
|
15045
15079
|
console.log();
|
|
@@ -15068,16 +15102,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
15068
15102
|
// src/commands/dotnet/resolveCsproj.ts
|
|
15069
15103
|
import { existsSync as existsSync38 } from "fs";
|
|
15070
15104
|
import path33 from "path";
|
|
15071
|
-
import
|
|
15105
|
+
import chalk140 from "chalk";
|
|
15072
15106
|
function resolveCsproj(csprojPath) {
|
|
15073
15107
|
const resolved = path33.resolve(csprojPath);
|
|
15074
15108
|
if (!existsSync38(resolved)) {
|
|
15075
|
-
console.error(
|
|
15109
|
+
console.error(chalk140.red(`File not found: ${resolved}`));
|
|
15076
15110
|
process.exit(1);
|
|
15077
15111
|
}
|
|
15078
15112
|
const repoRoot = findRepoRoot(path33.dirname(resolved));
|
|
15079
15113
|
if (!repoRoot) {
|
|
15080
|
-
console.error(
|
|
15114
|
+
console.error(chalk140.red("Could not find git repository root"));
|
|
15081
15115
|
process.exit(1);
|
|
15082
15116
|
}
|
|
15083
15117
|
return { resolved, repoRoot };
|
|
@@ -15127,12 +15161,12 @@ function getChangedCsFiles(scope) {
|
|
|
15127
15161
|
}
|
|
15128
15162
|
|
|
15129
15163
|
// src/commands/dotnet/inSln.ts
|
|
15130
|
-
import
|
|
15164
|
+
import chalk141 from "chalk";
|
|
15131
15165
|
async function inSln(csprojPath) {
|
|
15132
15166
|
const { resolved, repoRoot } = resolveCsproj(csprojPath);
|
|
15133
15167
|
const solutions = findContainingSolutions(resolved, repoRoot);
|
|
15134
15168
|
if (solutions.length === 0) {
|
|
15135
|
-
console.log(
|
|
15169
|
+
console.log(chalk141.yellow("Not found in any .sln file"));
|
|
15136
15170
|
process.exit(1);
|
|
15137
15171
|
}
|
|
15138
15172
|
for (const sln of solutions) {
|
|
@@ -15141,7 +15175,7 @@ async function inSln(csprojPath) {
|
|
|
15141
15175
|
}
|
|
15142
15176
|
|
|
15143
15177
|
// src/commands/dotnet/inspect.ts
|
|
15144
|
-
import
|
|
15178
|
+
import chalk147 from "chalk";
|
|
15145
15179
|
|
|
15146
15180
|
// src/shared/formatElapsed.ts
|
|
15147
15181
|
function formatElapsed(ms) {
|
|
@@ -15153,12 +15187,12 @@ function formatElapsed(ms) {
|
|
|
15153
15187
|
}
|
|
15154
15188
|
|
|
15155
15189
|
// src/commands/dotnet/displayIssues.ts
|
|
15156
|
-
import
|
|
15190
|
+
import chalk142 from "chalk";
|
|
15157
15191
|
var SEVERITY_COLOR = {
|
|
15158
|
-
ERROR:
|
|
15159
|
-
WARNING:
|
|
15160
|
-
SUGGESTION:
|
|
15161
|
-
HINT:
|
|
15192
|
+
ERROR: chalk142.red,
|
|
15193
|
+
WARNING: chalk142.yellow,
|
|
15194
|
+
SUGGESTION: chalk142.cyan,
|
|
15195
|
+
HINT: chalk142.dim
|
|
15162
15196
|
};
|
|
15163
15197
|
function groupByFile(issues) {
|
|
15164
15198
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -15174,15 +15208,15 @@ function groupByFile(issues) {
|
|
|
15174
15208
|
}
|
|
15175
15209
|
function displayIssues(issues) {
|
|
15176
15210
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
15177
|
-
console.log(
|
|
15211
|
+
console.log(chalk142.bold(file));
|
|
15178
15212
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
15179
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
15213
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk142.white;
|
|
15180
15214
|
console.log(
|
|
15181
|
-
` ${
|
|
15215
|
+
` ${chalk142.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
15182
15216
|
);
|
|
15183
15217
|
}
|
|
15184
15218
|
}
|
|
15185
|
-
console.log(
|
|
15219
|
+
console.log(chalk142.dim(`
|
|
15186
15220
|
${issues.length} issue(s) found`));
|
|
15187
15221
|
}
|
|
15188
15222
|
|
|
@@ -15241,12 +15275,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
15241
15275
|
// src/commands/dotnet/resolveSolution.ts
|
|
15242
15276
|
import { existsSync as existsSync39 } from "fs";
|
|
15243
15277
|
import path34 from "path";
|
|
15244
|
-
import
|
|
15278
|
+
import chalk144 from "chalk";
|
|
15245
15279
|
|
|
15246
15280
|
// src/commands/dotnet/findSolution.ts
|
|
15247
15281
|
import { readdirSync as readdirSync7 } from "fs";
|
|
15248
15282
|
import { dirname as dirname22, join as join40 } from "path";
|
|
15249
|
-
import
|
|
15283
|
+
import chalk143 from "chalk";
|
|
15250
15284
|
function findSlnInDir(dir) {
|
|
15251
15285
|
try {
|
|
15252
15286
|
return readdirSync7(dir).filter((f) => f.endsWith(".sln")).map((f) => join40(dir, f));
|
|
@@ -15262,17 +15296,17 @@ function findSolution() {
|
|
|
15262
15296
|
const slnFiles = findSlnInDir(current);
|
|
15263
15297
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
15264
15298
|
if (slnFiles.length > 1) {
|
|
15265
|
-
console.error(
|
|
15299
|
+
console.error(chalk143.red(`Multiple .sln files found in ${current}:`));
|
|
15266
15300
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
15267
15301
|
console.error(
|
|
15268
|
-
|
|
15302
|
+
chalk143.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
15269
15303
|
);
|
|
15270
15304
|
process.exit(1);
|
|
15271
15305
|
}
|
|
15272
15306
|
if (current === ceiling) break;
|
|
15273
15307
|
current = dirname22(current);
|
|
15274
15308
|
}
|
|
15275
|
-
console.error(
|
|
15309
|
+
console.error(chalk143.red("No .sln file found between cwd and repo root"));
|
|
15276
15310
|
process.exit(1);
|
|
15277
15311
|
}
|
|
15278
15312
|
|
|
@@ -15281,7 +15315,7 @@ function resolveSolution(sln) {
|
|
|
15281
15315
|
if (sln) {
|
|
15282
15316
|
const resolved = path34.resolve(sln);
|
|
15283
15317
|
if (!existsSync39(resolved)) {
|
|
15284
|
-
console.error(
|
|
15318
|
+
console.error(chalk144.red(`Solution file not found: ${resolved}`));
|
|
15285
15319
|
process.exit(1);
|
|
15286
15320
|
}
|
|
15287
15321
|
return resolved;
|
|
@@ -15323,14 +15357,14 @@ import { execSync as execSync37 } from "child_process";
|
|
|
15323
15357
|
import { existsSync as existsSync40, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
|
|
15324
15358
|
import { tmpdir as tmpdir3 } from "os";
|
|
15325
15359
|
import path35 from "path";
|
|
15326
|
-
import
|
|
15360
|
+
import chalk145 from "chalk";
|
|
15327
15361
|
function assertJbInstalled() {
|
|
15328
15362
|
try {
|
|
15329
15363
|
execSync37("jb inspectcode --version", { stdio: "pipe" });
|
|
15330
15364
|
} catch {
|
|
15331
|
-
console.error(
|
|
15365
|
+
console.error(chalk145.red("jb is not installed. Install with:"));
|
|
15332
15366
|
console.error(
|
|
15333
|
-
|
|
15367
|
+
chalk145.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
15334
15368
|
);
|
|
15335
15369
|
process.exit(1);
|
|
15336
15370
|
}
|
|
@@ -15348,11 +15382,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15348
15382
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
15349
15383
|
process.stderr.write(error.stderr);
|
|
15350
15384
|
}
|
|
15351
|
-
console.error(
|
|
15385
|
+
console.error(chalk145.red("jb inspectcode failed"));
|
|
15352
15386
|
process.exit(1);
|
|
15353
15387
|
}
|
|
15354
15388
|
if (!existsSync40(reportPath)) {
|
|
15355
|
-
console.error(
|
|
15389
|
+
console.error(chalk145.red("Report file not generated"));
|
|
15356
15390
|
process.exit(1);
|
|
15357
15391
|
}
|
|
15358
15392
|
const xml = readFileSync34(reportPath, "utf8");
|
|
@@ -15362,7 +15396,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
15362
15396
|
|
|
15363
15397
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
15364
15398
|
import { execSync as execSync38 } from "child_process";
|
|
15365
|
-
import
|
|
15399
|
+
import chalk146 from "chalk";
|
|
15366
15400
|
function resolveMsbuildPath() {
|
|
15367
15401
|
const { run: run4 } = loadConfig();
|
|
15368
15402
|
const configs = resolveRunConfigs(run4, getConfigDir());
|
|
@@ -15374,9 +15408,9 @@ function assertMsbuildInstalled() {
|
|
|
15374
15408
|
try {
|
|
15375
15409
|
execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
15376
15410
|
} catch {
|
|
15377
|
-
console.error(
|
|
15411
|
+
console.error(chalk146.red(`msbuild not found at: ${msbuild}`));
|
|
15378
15412
|
console.error(
|
|
15379
|
-
|
|
15413
|
+
chalk146.yellow(
|
|
15380
15414
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
15381
15415
|
)
|
|
15382
15416
|
);
|
|
@@ -15423,17 +15457,17 @@ function runEngine(resolved, changedFiles, options2) {
|
|
|
15423
15457
|
// src/commands/dotnet/inspect.ts
|
|
15424
15458
|
function logScope(changedFiles) {
|
|
15425
15459
|
if (changedFiles === null) {
|
|
15426
|
-
console.log(
|
|
15460
|
+
console.log(chalk147.dim("Inspecting full solution..."));
|
|
15427
15461
|
} else {
|
|
15428
15462
|
console.log(
|
|
15429
|
-
|
|
15463
|
+
chalk147.dim(`Inspecting ${changedFiles.length} changed file(s)...`)
|
|
15430
15464
|
);
|
|
15431
15465
|
}
|
|
15432
15466
|
}
|
|
15433
15467
|
function reportResults(issues, elapsed) {
|
|
15434
15468
|
if (issues.length > 0) displayIssues(issues);
|
|
15435
|
-
else console.log(
|
|
15436
|
-
console.log(
|
|
15469
|
+
else console.log(chalk147.green("No issues found"));
|
|
15470
|
+
console.log(chalk147.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
15437
15471
|
if (issues.length > 0) process.exit(1);
|
|
15438
15472
|
}
|
|
15439
15473
|
async function inspect(sln, options2) {
|
|
@@ -15444,7 +15478,7 @@ async function inspect(sln, options2) {
|
|
|
15444
15478
|
const scope = parseScope(options2.scope);
|
|
15445
15479
|
const changedFiles = getChangedCsFiles(scope);
|
|
15446
15480
|
if (changedFiles !== null && changedFiles.length === 0) {
|
|
15447
|
-
console.log(
|
|
15481
|
+
console.log(chalk147.green("No changed .cs files found"));
|
|
15448
15482
|
return;
|
|
15449
15483
|
}
|
|
15450
15484
|
logScope(changedFiles);
|
|
@@ -15827,25 +15861,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
15827
15861
|
}
|
|
15828
15862
|
|
|
15829
15863
|
// src/commands/github/printCountTable.ts
|
|
15830
|
-
import
|
|
15864
|
+
import chalk148 from "chalk";
|
|
15831
15865
|
function printCountTable(labelHeader, rows) {
|
|
15832
15866
|
const labelWidth = Math.max(
|
|
15833
15867
|
labelHeader.length,
|
|
15834
15868
|
...rows.map((row) => row.label.length)
|
|
15835
15869
|
);
|
|
15836
15870
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
15837
|
-
console.log(
|
|
15838
|
-
console.log(
|
|
15871
|
+
console.log(chalk148.dim(header));
|
|
15872
|
+
console.log(chalk148.dim("-".repeat(header.length)));
|
|
15839
15873
|
for (const row of rows) {
|
|
15840
15874
|
console.log(`${row.label.padEnd(labelWidth)} ${row.count}`);
|
|
15841
15875
|
}
|
|
15842
15876
|
}
|
|
15843
15877
|
|
|
15844
15878
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
15845
|
-
import
|
|
15879
|
+
import chalk149 from "chalk";
|
|
15846
15880
|
function printRepoAuthorBreakdown(repos2) {
|
|
15847
15881
|
for (const repo of repos2) {
|
|
15848
|
-
console.log(
|
|
15882
|
+
console.log(chalk149.bold(repo.name));
|
|
15849
15883
|
const authorWidth = Math.max(
|
|
15850
15884
|
0,
|
|
15851
15885
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -16163,7 +16197,7 @@ function registerHandover(program2) {
|
|
|
16163
16197
|
}
|
|
16164
16198
|
|
|
16165
16199
|
// src/commands/jira/acceptanceCriteria.ts
|
|
16166
|
-
import
|
|
16200
|
+
import chalk150 from "chalk";
|
|
16167
16201
|
|
|
16168
16202
|
// src/commands/jira/adfToText.ts
|
|
16169
16203
|
function renderInline(node) {
|
|
@@ -16230,7 +16264,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
16230
16264
|
const parsed = fetchIssue(issueKey, field);
|
|
16231
16265
|
const acValue = parsed?.fields?.[field];
|
|
16232
16266
|
if (!acValue) {
|
|
16233
|
-
console.log(
|
|
16267
|
+
console.log(chalk150.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
16234
16268
|
return;
|
|
16235
16269
|
}
|
|
16236
16270
|
if (typeof acValue === "string") {
|
|
@@ -16296,14 +16330,14 @@ async function jiraAuth() {
|
|
|
16296
16330
|
}
|
|
16297
16331
|
|
|
16298
16332
|
// src/commands/jira/viewIssue.ts
|
|
16299
|
-
import
|
|
16333
|
+
import chalk151 from "chalk";
|
|
16300
16334
|
function viewIssue(issueKey) {
|
|
16301
16335
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
16302
16336
|
const fields = parsed?.fields;
|
|
16303
16337
|
const summary = fields?.summary;
|
|
16304
16338
|
const description = fields?.description;
|
|
16305
16339
|
if (summary) {
|
|
16306
|
-
console.log(
|
|
16340
|
+
console.log(chalk151.bold(summary));
|
|
16307
16341
|
}
|
|
16308
16342
|
if (description) {
|
|
16309
16343
|
if (summary) console.log();
|
|
@@ -16317,7 +16351,7 @@ function viewIssue(issueKey) {
|
|
|
16317
16351
|
}
|
|
16318
16352
|
if (!summary && !description) {
|
|
16319
16353
|
console.log(
|
|
16320
|
-
|
|
16354
|
+
chalk151.yellow(`No summary or description found on ${issueKey}.`)
|
|
16321
16355
|
);
|
|
16322
16356
|
}
|
|
16323
16357
|
}
|
|
@@ -16373,13 +16407,13 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
16373
16407
|
// src/commands/reviewPrComments.ts
|
|
16374
16408
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
16375
16409
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
16376
|
-
import
|
|
16410
|
+
import chalk152 from "chalk";
|
|
16377
16411
|
async function reviewPrComments(number) {
|
|
16378
16412
|
if (number) {
|
|
16379
16413
|
try {
|
|
16380
16414
|
execFileSync5("gh", ["pr", "checkout", number], { stdio: "inherit" });
|
|
16381
16415
|
} catch {
|
|
16382
|
-
console.error(
|
|
16416
|
+
console.error(chalk152.red(`gh pr checkout ${number} failed; aborting.`));
|
|
16383
16417
|
process.exit(1);
|
|
16384
16418
|
}
|
|
16385
16419
|
}
|
|
@@ -16452,15 +16486,15 @@ function registerList(program2) {
|
|
|
16452
16486
|
// src/commands/mermaid/index.ts
|
|
16453
16487
|
import { mkdirSync as mkdirSync16, readdirSync as readdirSync9 } from "fs";
|
|
16454
16488
|
import { resolve as resolve12 } from "path";
|
|
16455
|
-
import
|
|
16489
|
+
import chalk155 from "chalk";
|
|
16456
16490
|
|
|
16457
16491
|
// src/commands/mermaid/exportFile.ts
|
|
16458
16492
|
import { readFileSync as readFileSync36, writeFileSync as writeFileSync31 } from "fs";
|
|
16459
16493
|
import { basename as basename11, extname, resolve as resolve11 } from "path";
|
|
16460
|
-
import
|
|
16494
|
+
import chalk154 from "chalk";
|
|
16461
16495
|
|
|
16462
16496
|
// src/commands/mermaid/renderBlock.ts
|
|
16463
|
-
import
|
|
16497
|
+
import chalk153 from "chalk";
|
|
16464
16498
|
async function renderBlock(krokiUrl, source) {
|
|
16465
16499
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
16466
16500
|
method: "POST",
|
|
@@ -16469,7 +16503,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
16469
16503
|
});
|
|
16470
16504
|
if (!response.ok) {
|
|
16471
16505
|
console.error(
|
|
16472
|
-
|
|
16506
|
+
chalk153.red(
|
|
16473
16507
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
16474
16508
|
)
|
|
16475
16509
|
);
|
|
@@ -16487,19 +16521,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16487
16521
|
if (onlyIndex !== void 0) {
|
|
16488
16522
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
16489
16523
|
console.error(
|
|
16490
|
-
|
|
16524
|
+
chalk154.red(
|
|
16491
16525
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
16492
16526
|
)
|
|
16493
16527
|
);
|
|
16494
16528
|
process.exit(1);
|
|
16495
16529
|
}
|
|
16496
16530
|
console.log(
|
|
16497
|
-
|
|
16531
|
+
chalk154.gray(
|
|
16498
16532
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
16499
16533
|
)
|
|
16500
16534
|
);
|
|
16501
16535
|
} else {
|
|
16502
|
-
console.log(
|
|
16536
|
+
console.log(chalk154.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
16503
16537
|
}
|
|
16504
16538
|
for (const [i, source] of blocks.entries()) {
|
|
16505
16539
|
const idx = i + 1;
|
|
@@ -16507,7 +16541,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
16507
16541
|
const outPath = resolve11(outDir, `${stem}-${idx}.svg`);
|
|
16508
16542
|
const svg = await renderBlock(krokiUrl, source);
|
|
16509
16543
|
writeFileSync31(outPath, svg, "utf8");
|
|
16510
|
-
console.log(
|
|
16544
|
+
console.log(chalk154.green(` \u2192 ${outPath}`));
|
|
16511
16545
|
}
|
|
16512
16546
|
}
|
|
16513
16547
|
function extractMermaidBlocks(markdown) {
|
|
@@ -16523,18 +16557,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
16523
16557
|
if (options2.index !== void 0) {
|
|
16524
16558
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
16525
16559
|
console.error(
|
|
16526
|
-
|
|
16560
|
+
chalk155.red(`--index must be a positive integer (got ${options2.index})`)
|
|
16527
16561
|
);
|
|
16528
16562
|
process.exit(1);
|
|
16529
16563
|
}
|
|
16530
16564
|
if (!file) {
|
|
16531
|
-
console.error(
|
|
16565
|
+
console.error(chalk155.red("--index requires a file argument"));
|
|
16532
16566
|
process.exit(1);
|
|
16533
16567
|
}
|
|
16534
16568
|
}
|
|
16535
16569
|
const files = file ? [file] : readdirSync9(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
16536
16570
|
if (files.length === 0) {
|
|
16537
|
-
console.log(
|
|
16571
|
+
console.log(chalk155.gray("No markdown files found in current directory."));
|
|
16538
16572
|
return;
|
|
16539
16573
|
}
|
|
16540
16574
|
for (const f of files) {
|
|
@@ -16567,7 +16601,7 @@ function registerMermaid(program2) {
|
|
|
16567
16601
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
16568
16602
|
import { createServer as createServer2 } from "http";
|
|
16569
16603
|
import { dirname as dirname24 } from "path";
|
|
16570
|
-
import
|
|
16604
|
+
import chalk157 from "chalk";
|
|
16571
16605
|
|
|
16572
16606
|
// src/commands/netcap/corsHeaders.ts
|
|
16573
16607
|
var corsHeaders = {
|
|
@@ -16646,7 +16680,7 @@ function createNetcapHandler(options2) {
|
|
|
16646
16680
|
import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|
|
16647
16681
|
import { networkInterfaces } from "os";
|
|
16648
16682
|
import { join as join46 } from "path";
|
|
16649
|
-
import
|
|
16683
|
+
import chalk156 from "chalk";
|
|
16650
16684
|
|
|
16651
16685
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
16652
16686
|
import { dirname as dirname23, join as join45 } from "path";
|
|
@@ -16690,7 +16724,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16690
16724
|
const host = lanIPv4();
|
|
16691
16725
|
if (!host) {
|
|
16692
16726
|
console.log(
|
|
16693
|
-
|
|
16727
|
+
chalk156.yellow("could not determine the WSL IP for the extension")
|
|
16694
16728
|
);
|
|
16695
16729
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
16696
16730
|
return source;
|
|
@@ -16701,7 +16735,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
16701
16735
|
return WSL_WINDOWS_PATH;
|
|
16702
16736
|
} catch {
|
|
16703
16737
|
console.log(
|
|
16704
|
-
|
|
16738
|
+
chalk156.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
16705
16739
|
);
|
|
16706
16740
|
return source;
|
|
16707
16741
|
}
|
|
@@ -16734,30 +16768,30 @@ async function netcap(options2) {
|
|
|
16734
16768
|
let count7 = 0;
|
|
16735
16769
|
const handler = createNetcapHandler({
|
|
16736
16770
|
outPath,
|
|
16737
|
-
onPing: () => console.log(
|
|
16771
|
+
onPing: () => console.log(chalk157.dim("ping from extension")),
|
|
16738
16772
|
onCapture: (entry) => {
|
|
16739
16773
|
count7 += 1;
|
|
16740
16774
|
console.log(
|
|
16741
|
-
|
|
16742
|
-
|
|
16775
|
+
chalk157.green(`captured #${count7}`),
|
|
16776
|
+
chalk157.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
16743
16777
|
);
|
|
16744
16778
|
}
|
|
16745
16779
|
});
|
|
16746
16780
|
const server = createServer2(handler);
|
|
16747
16781
|
server.listen(port, () => {
|
|
16748
16782
|
console.log(
|
|
16749
|
-
|
|
16783
|
+
chalk157.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
16750
16784
|
);
|
|
16751
|
-
console.log(
|
|
16785
|
+
console.log(chalk157.dim(`appending captures to ${outPath}`));
|
|
16752
16786
|
if (filter)
|
|
16753
|
-
console.log(
|
|
16754
|
-
console.log(
|
|
16755
|
-
console.log(
|
|
16787
|
+
console.log(chalk157.dim(`forwarding only URLs matching "${filter}"`));
|
|
16788
|
+
console.log(chalk157.dim(`load the unpacked extension from ${extensionPath}`));
|
|
16789
|
+
console.log(chalk157.dim("press Ctrl-C to stop"));
|
|
16756
16790
|
});
|
|
16757
16791
|
process.on("SIGINT", () => {
|
|
16758
16792
|
server.close();
|
|
16759
16793
|
console.log(
|
|
16760
|
-
|
|
16794
|
+
chalk157.bold(
|
|
16761
16795
|
`
|
|
16762
16796
|
netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
16763
16797
|
)
|
|
@@ -16769,7 +16803,7 @@ netcap stopped \u2014 captured ${count7} ${count7 === 1 ? "entry" : "entries"} t
|
|
|
16769
16803
|
// src/commands/netcap/netcapExtract.ts
|
|
16770
16804
|
import { writeFileSync as writeFileSync32 } from "fs";
|
|
16771
16805
|
import { join as join49 } from "path";
|
|
16772
|
-
import
|
|
16806
|
+
import chalk158 from "chalk";
|
|
16773
16807
|
|
|
16774
16808
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
16775
16809
|
import { readFileSync as readFileSync37 } from "fs";
|
|
@@ -17217,8 +17251,8 @@ function netcapExtract(file) {
|
|
|
17217
17251
|
writeFileSync32(outFile, `${JSON.stringify(posts, null, 2)}
|
|
17218
17252
|
`);
|
|
17219
17253
|
console.log(
|
|
17220
|
-
|
|
17221
|
-
|
|
17254
|
+
chalk158.green(`extracted ${posts.length} posts`),
|
|
17255
|
+
chalk158.dim(`-> ${outFile}`)
|
|
17222
17256
|
);
|
|
17223
17257
|
}
|
|
17224
17258
|
|
|
@@ -17239,7 +17273,7 @@ function registerNetcap(program2) {
|
|
|
17239
17273
|
}
|
|
17240
17274
|
|
|
17241
17275
|
// src/commands/news/add/index.ts
|
|
17242
|
-
import
|
|
17276
|
+
import chalk159 from "chalk";
|
|
17243
17277
|
import enquirer8 from "enquirer";
|
|
17244
17278
|
async function add2(url) {
|
|
17245
17279
|
if (!url) {
|
|
@@ -17261,10 +17295,10 @@ async function add2(url) {
|
|
|
17261
17295
|
const { orm } = await getReady();
|
|
17262
17296
|
const added = await addFeed(orm, url);
|
|
17263
17297
|
if (!added) {
|
|
17264
|
-
console.log(
|
|
17298
|
+
console.log(chalk159.yellow("Feed already exists"));
|
|
17265
17299
|
return;
|
|
17266
17300
|
}
|
|
17267
|
-
console.log(
|
|
17301
|
+
console.log(chalk159.green(`Added feed: ${url}`));
|
|
17268
17302
|
}
|
|
17269
17303
|
|
|
17270
17304
|
// src/commands/registerNews.ts
|
|
@@ -17311,7 +17345,7 @@ function registerPiHook(program2) {
|
|
|
17311
17345
|
}
|
|
17312
17346
|
|
|
17313
17347
|
// src/commands/prompts/printPromptsTable.ts
|
|
17314
|
-
import
|
|
17348
|
+
import chalk160 from "chalk";
|
|
17315
17349
|
function truncate(str, max) {
|
|
17316
17350
|
if (str.length <= max) return str;
|
|
17317
17351
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -17329,14 +17363,14 @@ function printPromptsTable(rows) {
|
|
|
17329
17363
|
"Command".padEnd(commandWidth),
|
|
17330
17364
|
"Repos"
|
|
17331
17365
|
].join(" ");
|
|
17332
|
-
console.log(
|
|
17333
|
-
console.log(
|
|
17366
|
+
console.log(chalk160.dim(header));
|
|
17367
|
+
console.log(chalk160.dim("-".repeat(header.length)));
|
|
17334
17368
|
for (const row of rows) {
|
|
17335
17369
|
const count7 = String(row.count).padStart(countWidth);
|
|
17336
17370
|
const tool = row.tool.padEnd(toolWidth);
|
|
17337
17371
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
17338
17372
|
console.log(
|
|
17339
|
-
`${
|
|
17373
|
+
`${chalk160.yellow(count7)} ${tool} ${command} ${chalk160.dim(row.repos)}`
|
|
17340
17374
|
);
|
|
17341
17375
|
}
|
|
17342
17376
|
}
|
|
@@ -17903,20 +17937,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
17903
17937
|
}
|
|
17904
17938
|
|
|
17905
17939
|
// src/commands/prs/listComments/printComments.ts
|
|
17906
|
-
import
|
|
17940
|
+
import chalk161 from "chalk";
|
|
17907
17941
|
function formatForHuman(comment3) {
|
|
17908
17942
|
if (comment3.type === "review") {
|
|
17909
|
-
const stateColor = comment3.state === "APPROVED" ?
|
|
17943
|
+
const stateColor = comment3.state === "APPROVED" ? chalk161.green : comment3.state === "CHANGES_REQUESTED" ? chalk161.red : chalk161.yellow;
|
|
17910
17944
|
return [
|
|
17911
|
-
`${
|
|
17945
|
+
`${chalk161.cyan("Review")} by ${chalk161.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
|
|
17912
17946
|
comment3.body,
|
|
17913
17947
|
""
|
|
17914
17948
|
].join("\n");
|
|
17915
17949
|
}
|
|
17916
17950
|
const location = comment3.line ? `:${comment3.line}` : "";
|
|
17917
17951
|
return [
|
|
17918
|
-
`${
|
|
17919
|
-
|
|
17952
|
+
`${chalk161.cyan("Line comment")} by ${chalk161.bold(comment3.user)} on ${chalk161.dim(`${comment3.path}${location}`)}`,
|
|
17953
|
+
chalk161.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
|
|
17920
17954
|
comment3.body,
|
|
17921
17955
|
""
|
|
17922
17956
|
].join("\n");
|
|
@@ -18006,13 +18040,13 @@ import { execSync as execSync46 } from "child_process";
|
|
|
18006
18040
|
import enquirer9 from "enquirer";
|
|
18007
18041
|
|
|
18008
18042
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
18009
|
-
import
|
|
18043
|
+
import chalk162 from "chalk";
|
|
18010
18044
|
var STATUS_MAP = {
|
|
18011
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
18012
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
18045
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk162.magenta("merged"), date: pr.mergedAt } : null,
|
|
18046
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk162.red("closed"), date: pr.closedAt } : null
|
|
18013
18047
|
};
|
|
18014
18048
|
function defaultStatus(pr) {
|
|
18015
|
-
return { label:
|
|
18049
|
+
return { label: chalk162.green("opened"), date: pr.createdAt };
|
|
18016
18050
|
}
|
|
18017
18051
|
function getStatus2(pr) {
|
|
18018
18052
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -18021,11 +18055,11 @@ function formatDate(dateStr) {
|
|
|
18021
18055
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
18022
18056
|
}
|
|
18023
18057
|
function formatPrHeader(pr, status3) {
|
|
18024
|
-
return `${
|
|
18058
|
+
return `${chalk162.cyan(`#${pr.number}`)} ${pr.title} ${chalk162.dim(`(${pr.author.login},`)} ${status3.label} ${chalk162.dim(`${formatDate(status3.date)})`)}`;
|
|
18025
18059
|
}
|
|
18026
18060
|
function logPrDetails(pr) {
|
|
18027
18061
|
console.log(
|
|
18028
|
-
|
|
18062
|
+
chalk162.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
18029
18063
|
);
|
|
18030
18064
|
console.log();
|
|
18031
18065
|
}
|
|
@@ -18592,10 +18626,10 @@ function registerPrs(program2) {
|
|
|
18592
18626
|
}
|
|
18593
18627
|
|
|
18594
18628
|
// src/commands/ravendb/ravendbAuth.ts
|
|
18595
|
-
import
|
|
18629
|
+
import chalk168 from "chalk";
|
|
18596
18630
|
|
|
18597
18631
|
// src/shared/createConnectionAuth.ts
|
|
18598
|
-
import
|
|
18632
|
+
import chalk163 from "chalk";
|
|
18599
18633
|
function listConnections(connections, format) {
|
|
18600
18634
|
if (connections.length === 0) {
|
|
18601
18635
|
console.log("No connections configured.");
|
|
@@ -18608,7 +18642,7 @@ function listConnections(connections, format) {
|
|
|
18608
18642
|
function removeConnection(connections, name, save) {
|
|
18609
18643
|
const filtered = connections.filter((c) => c.name !== name);
|
|
18610
18644
|
if (filtered.length === connections.length) {
|
|
18611
|
-
console.error(
|
|
18645
|
+
console.error(chalk163.red(`Connection "${name}" not found.`));
|
|
18612
18646
|
process.exit(1);
|
|
18613
18647
|
}
|
|
18614
18648
|
save(filtered);
|
|
@@ -18654,15 +18688,15 @@ function saveConnections(connections) {
|
|
|
18654
18688
|
}
|
|
18655
18689
|
|
|
18656
18690
|
// src/commands/ravendb/promptConnection.ts
|
|
18657
|
-
import
|
|
18691
|
+
import chalk166 from "chalk";
|
|
18658
18692
|
|
|
18659
18693
|
// src/commands/ravendb/selectOpSecret.ts
|
|
18660
|
-
import
|
|
18694
|
+
import chalk165 from "chalk";
|
|
18661
18695
|
import Enquirer2 from "enquirer";
|
|
18662
18696
|
|
|
18663
18697
|
// src/commands/ravendb/searchItems.ts
|
|
18664
18698
|
import { execSync as execSync49 } from "child_process";
|
|
18665
|
-
import
|
|
18699
|
+
import chalk164 from "chalk";
|
|
18666
18700
|
function opExec(args) {
|
|
18667
18701
|
return execSync49(`op ${args}`, {
|
|
18668
18702
|
encoding: "utf8",
|
|
@@ -18675,7 +18709,7 @@ function searchItems(search2) {
|
|
|
18675
18709
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
18676
18710
|
} catch {
|
|
18677
18711
|
console.error(
|
|
18678
|
-
|
|
18712
|
+
chalk164.red(
|
|
18679
18713
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
18680
18714
|
)
|
|
18681
18715
|
);
|
|
@@ -18689,7 +18723,7 @@ function getItemFields(itemId2) {
|
|
|
18689
18723
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
18690
18724
|
return item.fields.filter((f) => f.reference && f.label);
|
|
18691
18725
|
} catch {
|
|
18692
|
-
console.error(
|
|
18726
|
+
console.error(chalk164.red("Failed to get item details from 1Password."));
|
|
18693
18727
|
process.exit(1);
|
|
18694
18728
|
}
|
|
18695
18729
|
}
|
|
@@ -18708,7 +18742,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18708
18742
|
}).run();
|
|
18709
18743
|
const items2 = searchItems(search2);
|
|
18710
18744
|
if (items2.length === 0) {
|
|
18711
|
-
console.error(
|
|
18745
|
+
console.error(chalk165.red(`No items found matching "${search2}".`));
|
|
18712
18746
|
process.exit(1);
|
|
18713
18747
|
}
|
|
18714
18748
|
const itemId2 = await selectOne(
|
|
@@ -18717,7 +18751,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18717
18751
|
);
|
|
18718
18752
|
const fields = getItemFields(itemId2);
|
|
18719
18753
|
if (fields.length === 0) {
|
|
18720
|
-
console.error(
|
|
18754
|
+
console.error(chalk165.red("No fields with references found on this item."));
|
|
18721
18755
|
process.exit(1);
|
|
18722
18756
|
}
|
|
18723
18757
|
const ref = await selectOne(
|
|
@@ -18731,7 +18765,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
18731
18765
|
async function promptConnection(existingNames) {
|
|
18732
18766
|
const name = await promptInput("name", "Connection name:");
|
|
18733
18767
|
if (existingNames.includes(name)) {
|
|
18734
|
-
console.error(
|
|
18768
|
+
console.error(chalk166.red(`Connection "${name}" already exists.`));
|
|
18735
18769
|
process.exit(1);
|
|
18736
18770
|
}
|
|
18737
18771
|
const url = await promptInput(
|
|
@@ -18740,22 +18774,22 @@ async function promptConnection(existingNames) {
|
|
|
18740
18774
|
);
|
|
18741
18775
|
const database = await promptInput("database", "Database name:");
|
|
18742
18776
|
if (!name || !url || !database) {
|
|
18743
|
-
console.error(
|
|
18777
|
+
console.error(chalk166.red("All fields are required."));
|
|
18744
18778
|
process.exit(1);
|
|
18745
18779
|
}
|
|
18746
18780
|
const apiKeyRef = await selectOpSecret();
|
|
18747
|
-
console.log(
|
|
18781
|
+
console.log(chalk166.dim(`Using: ${apiKeyRef}`));
|
|
18748
18782
|
return { name, url, database, apiKeyRef };
|
|
18749
18783
|
}
|
|
18750
18784
|
|
|
18751
18785
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
18752
|
-
import
|
|
18786
|
+
import chalk167 from "chalk";
|
|
18753
18787
|
function ravendbSetConnection(name) {
|
|
18754
18788
|
const raw = loadGlobalConfigRaw();
|
|
18755
18789
|
const ravendb = raw.ravendb ?? {};
|
|
18756
18790
|
const connections = ravendb.connections ?? [];
|
|
18757
18791
|
if (!connections.some((c) => c.name === name)) {
|
|
18758
|
-
console.error(
|
|
18792
|
+
console.error(chalk167.red(`Connection "${name}" not found.`));
|
|
18759
18793
|
console.error(
|
|
18760
18794
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18761
18795
|
);
|
|
@@ -18771,16 +18805,16 @@ function ravendbSetConnection(name) {
|
|
|
18771
18805
|
var ravendbAuth = createConnectionAuth({
|
|
18772
18806
|
load: loadConnections,
|
|
18773
18807
|
save: saveConnections,
|
|
18774
|
-
format: (c) => `${
|
|
18808
|
+
format: (c) => `${chalk168.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
18775
18809
|
promptNew: promptConnection,
|
|
18776
18810
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
18777
18811
|
});
|
|
18778
18812
|
|
|
18779
18813
|
// src/commands/ravendb/ravendbCollections.ts
|
|
18780
|
-
import
|
|
18814
|
+
import chalk172 from "chalk";
|
|
18781
18815
|
|
|
18782
18816
|
// src/commands/ravendb/ravenFetch.ts
|
|
18783
|
-
import
|
|
18817
|
+
import chalk170 from "chalk";
|
|
18784
18818
|
|
|
18785
18819
|
// src/commands/ravendb/getAccessToken.ts
|
|
18786
18820
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -18817,10 +18851,10 @@ ${errorText}`
|
|
|
18817
18851
|
|
|
18818
18852
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
18819
18853
|
import { execSync as execSync50 } from "child_process";
|
|
18820
|
-
import
|
|
18854
|
+
import chalk169 from "chalk";
|
|
18821
18855
|
function resolveOpSecret(reference) {
|
|
18822
18856
|
if (!reference.startsWith("op://")) {
|
|
18823
|
-
console.error(
|
|
18857
|
+
console.error(chalk169.red(`Invalid secret reference: must start with op://`));
|
|
18824
18858
|
process.exit(1);
|
|
18825
18859
|
}
|
|
18826
18860
|
try {
|
|
@@ -18830,7 +18864,7 @@ function resolveOpSecret(reference) {
|
|
|
18830
18864
|
}).trim();
|
|
18831
18865
|
} catch {
|
|
18832
18866
|
console.error(
|
|
18833
|
-
|
|
18867
|
+
chalk169.red(
|
|
18834
18868
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
18835
18869
|
)
|
|
18836
18870
|
);
|
|
@@ -18857,7 +18891,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18857
18891
|
if (!response.ok) {
|
|
18858
18892
|
const body = await response.text();
|
|
18859
18893
|
console.error(
|
|
18860
|
-
|
|
18894
|
+
chalk170.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
18861
18895
|
);
|
|
18862
18896
|
console.error(body.substring(0, 500));
|
|
18863
18897
|
process.exit(1);
|
|
@@ -18866,7 +18900,7 @@ async function ravenFetch(connection, path71) {
|
|
|
18866
18900
|
}
|
|
18867
18901
|
|
|
18868
18902
|
// src/commands/ravendb/resolveConnection.ts
|
|
18869
|
-
import
|
|
18903
|
+
import chalk171 from "chalk";
|
|
18870
18904
|
function loadRavendb() {
|
|
18871
18905
|
const raw = loadGlobalConfigRaw();
|
|
18872
18906
|
const ravendb = raw.ravendb;
|
|
@@ -18880,7 +18914,7 @@ function resolveConnection(name) {
|
|
|
18880
18914
|
const connectionName = name ?? defaultConnection;
|
|
18881
18915
|
if (!connectionName) {
|
|
18882
18916
|
console.error(
|
|
18883
|
-
|
|
18917
|
+
chalk171.red(
|
|
18884
18918
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
18885
18919
|
)
|
|
18886
18920
|
);
|
|
@@ -18888,7 +18922,7 @@ function resolveConnection(name) {
|
|
|
18888
18922
|
}
|
|
18889
18923
|
const connection = connections.find((c) => c.name === connectionName);
|
|
18890
18924
|
if (!connection) {
|
|
18891
|
-
console.error(
|
|
18925
|
+
console.error(chalk171.red(`Connection "${connectionName}" not found.`));
|
|
18892
18926
|
console.error(
|
|
18893
18927
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
18894
18928
|
);
|
|
@@ -18919,7 +18953,7 @@ async function ravendbCollections(connectionName) {
|
|
|
18919
18953
|
return;
|
|
18920
18954
|
}
|
|
18921
18955
|
for (const c of collections) {
|
|
18922
|
-
console.log(`${
|
|
18956
|
+
console.log(`${chalk172.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
18923
18957
|
}
|
|
18924
18958
|
}
|
|
18925
18959
|
|
|
@@ -18938,10 +18972,10 @@ var ravendbConfigHelp = [
|
|
|
18938
18972
|
];
|
|
18939
18973
|
|
|
18940
18974
|
// src/commands/ravendb/ravendbQuery.ts
|
|
18941
|
-
import
|
|
18975
|
+
import chalk174 from "chalk";
|
|
18942
18976
|
|
|
18943
18977
|
// src/commands/ravendb/fetchAllPages.ts
|
|
18944
|
-
import
|
|
18978
|
+
import chalk173 from "chalk";
|
|
18945
18979
|
|
|
18946
18980
|
// src/commands/ravendb/buildQueryPath.ts
|
|
18947
18981
|
function buildQueryPath(opts) {
|
|
@@ -18979,7 +19013,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18979
19013
|
allResults.push(...results);
|
|
18980
19014
|
start3 += results.length;
|
|
18981
19015
|
process.stderr.write(
|
|
18982
|
-
`\r${
|
|
19016
|
+
`\r${chalk173.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
18983
19017
|
);
|
|
18984
19018
|
if (start3 >= totalResults) break;
|
|
18985
19019
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -18994,7 +19028,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
18994
19028
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
18995
19029
|
const resolved = resolveArgs(connectionName, collection);
|
|
18996
19030
|
if (!resolved.collection && !options2.query) {
|
|
18997
|
-
console.error(
|
|
19031
|
+
console.error(chalk174.red("Provide a collection name or --query filter."));
|
|
18998
19032
|
process.exit(1);
|
|
18999
19033
|
}
|
|
19000
19034
|
const { collection: col } = resolved;
|
|
@@ -19033,7 +19067,7 @@ import { spawn as spawn5 } from "child_process";
|
|
|
19033
19067
|
import * as path36 from "path";
|
|
19034
19068
|
|
|
19035
19069
|
// src/commands/refactor/logViolations.ts
|
|
19036
|
-
import
|
|
19070
|
+
import chalk175 from "chalk";
|
|
19037
19071
|
var DEFAULT_MAX_LINES = 100;
|
|
19038
19072
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
19039
19073
|
if (violations.length === 0) {
|
|
@@ -19042,43 +19076,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
|
|
|
19042
19076
|
}
|
|
19043
19077
|
return;
|
|
19044
19078
|
}
|
|
19045
|
-
console.error(
|
|
19079
|
+
console.error(chalk175.red(`
|
|
19046
19080
|
Refactor check failed:
|
|
19047
19081
|
`));
|
|
19048
|
-
console.error(
|
|
19082
|
+
console.error(chalk175.red(` The following files exceed ${maxLines} lines:
|
|
19049
19083
|
`));
|
|
19050
19084
|
for (const violation of violations) {
|
|
19051
|
-
console.error(
|
|
19085
|
+
console.error(chalk175.red(` ${violation.file} (${violation.lines} lines)`));
|
|
19052
19086
|
}
|
|
19053
19087
|
console.error(
|
|
19054
|
-
|
|
19088
|
+
chalk175.yellow(
|
|
19055
19089
|
`
|
|
19056
19090
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
19057
19091
|
way to refactor it, ignore it with:
|
|
19058
19092
|
`
|
|
19059
19093
|
)
|
|
19060
19094
|
);
|
|
19061
|
-
console.error(
|
|
19095
|
+
console.error(chalk175.gray(` assist refactor ignore <file>
|
|
19062
19096
|
`));
|
|
19063
19097
|
if (process.env.CLAUDECODE) {
|
|
19064
|
-
console.error(
|
|
19098
|
+
console.error(chalk175.cyan(`
|
|
19065
19099
|
## Extracting Code to New Files
|
|
19066
19100
|
`));
|
|
19067
19101
|
console.error(
|
|
19068
|
-
|
|
19102
|
+
chalk175.cyan(
|
|
19069
19103
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
19070
19104
|
`
|
|
19071
19105
|
)
|
|
19072
19106
|
);
|
|
19073
19107
|
console.error(
|
|
19074
|
-
|
|
19108
|
+
chalk175.cyan(
|
|
19075
19109
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
19076
19110
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
19077
19111
|
`
|
|
19078
19112
|
)
|
|
19079
19113
|
);
|
|
19080
19114
|
console.error(
|
|
19081
|
-
|
|
19115
|
+
chalk175.cyan(
|
|
19082
19116
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
19083
19117
|
domains, move it to a common/shared folder.
|
|
19084
19118
|
`
|
|
@@ -19234,7 +19268,7 @@ async function check(pattern2, options2) {
|
|
|
19234
19268
|
|
|
19235
19269
|
// src/commands/refactor/extract/index.ts
|
|
19236
19270
|
import path44 from "path";
|
|
19237
|
-
import
|
|
19271
|
+
import chalk178 from "chalk";
|
|
19238
19272
|
|
|
19239
19273
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
19240
19274
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -19833,23 +19867,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
19833
19867
|
|
|
19834
19868
|
// src/commands/refactor/extract/displayPlan.ts
|
|
19835
19869
|
import path40 from "path";
|
|
19836
|
-
import
|
|
19870
|
+
import chalk176 from "chalk";
|
|
19837
19871
|
function section2(title) {
|
|
19838
19872
|
return `
|
|
19839
|
-
${
|
|
19873
|
+
${chalk176.cyan(title)}`;
|
|
19840
19874
|
}
|
|
19841
19875
|
function displayImporters(plan2, cwd) {
|
|
19842
19876
|
if (plan2.importersToUpdate.length === 0) return;
|
|
19843
19877
|
console.log(section2("Update importers:"));
|
|
19844
19878
|
for (const imp of plan2.importersToUpdate) {
|
|
19845
19879
|
const rel = path40.relative(cwd, imp.file.getFilePath());
|
|
19846
|
-
console.log(` ${
|
|
19880
|
+
console.log(` ${chalk176.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
19847
19881
|
}
|
|
19848
19882
|
}
|
|
19849
19883
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
19850
|
-
console.log(
|
|
19884
|
+
console.log(chalk176.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
19851
19885
|
`));
|
|
19852
|
-
console.log(` ${
|
|
19886
|
+
console.log(` ${chalk176.cyan("Functions to move:")}`);
|
|
19853
19887
|
for (const name of plan2.extractedNames) {
|
|
19854
19888
|
console.log(` ${name}`);
|
|
19855
19889
|
}
|
|
@@ -19883,7 +19917,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
19883
19917
|
|
|
19884
19918
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
19885
19919
|
import path43 from "path";
|
|
19886
|
-
import
|
|
19920
|
+
import chalk177 from "chalk";
|
|
19887
19921
|
import { Project as Project4 } from "ts-morph";
|
|
19888
19922
|
|
|
19889
19923
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -19975,7 +20009,7 @@ function loadProjectFile(file) {
|
|
|
19975
20009
|
});
|
|
19976
20010
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
19977
20011
|
if (!sourceFile) {
|
|
19978
|
-
console.log(
|
|
20012
|
+
console.log(chalk177.red(`File not found in project: ${file}`));
|
|
19979
20013
|
process.exit(1);
|
|
19980
20014
|
}
|
|
19981
20015
|
return { project, sourceFile };
|
|
@@ -19998,19 +20032,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
19998
20032
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
19999
20033
|
if (options2.apply) {
|
|
20000
20034
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
20001
|
-
console.log(
|
|
20035
|
+
console.log(chalk178.green("\nExtraction complete"));
|
|
20002
20036
|
} else {
|
|
20003
|
-
console.log(
|
|
20037
|
+
console.log(chalk178.dim("\nDry run. Use --apply to execute."));
|
|
20004
20038
|
}
|
|
20005
20039
|
}
|
|
20006
20040
|
|
|
20007
20041
|
// src/commands/refactor/ignore.ts
|
|
20008
20042
|
import fs28 from "fs";
|
|
20009
|
-
import
|
|
20043
|
+
import chalk179 from "chalk";
|
|
20010
20044
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
20011
20045
|
function ignore2(file) {
|
|
20012
20046
|
if (!fs28.existsSync(file)) {
|
|
20013
|
-
console.error(
|
|
20047
|
+
console.error(chalk179.red(`Error: File does not exist: ${file}`));
|
|
20014
20048
|
process.exit(1);
|
|
20015
20049
|
}
|
|
20016
20050
|
const content = fs28.readFileSync(file, "utf8");
|
|
@@ -20026,7 +20060,7 @@ function ignore2(file) {
|
|
|
20026
20060
|
fs28.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
20027
20061
|
}
|
|
20028
20062
|
console.log(
|
|
20029
|
-
|
|
20063
|
+
chalk179.green(
|
|
20030
20064
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
20031
20065
|
)
|
|
20032
20066
|
);
|
|
@@ -20035,12 +20069,12 @@ function ignore2(file) {
|
|
|
20035
20069
|
// src/commands/refactor/rename/index.ts
|
|
20036
20070
|
import fs31 from "fs";
|
|
20037
20071
|
import path49 from "path";
|
|
20038
|
-
import
|
|
20072
|
+
import chalk182 from "chalk";
|
|
20039
20073
|
|
|
20040
20074
|
// src/commands/refactor/rename/applyRename.ts
|
|
20041
20075
|
import fs30 from "fs";
|
|
20042
20076
|
import path46 from "path";
|
|
20043
|
-
import
|
|
20077
|
+
import chalk180 from "chalk";
|
|
20044
20078
|
|
|
20045
20079
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
20046
20080
|
import path45 from "path";
|
|
@@ -20145,13 +20179,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
20145
20179
|
const updatedContents = applyRewrites(rewrites);
|
|
20146
20180
|
for (const [file, content] of updatedContents) {
|
|
20147
20181
|
fs30.writeFileSync(file, content, "utf8");
|
|
20148
|
-
console.log(
|
|
20182
|
+
console.log(chalk180.cyan(` Updated imports in ${path46.relative(cwd, file)}`));
|
|
20149
20183
|
}
|
|
20150
20184
|
const destDir = path46.dirname(destPath);
|
|
20151
20185
|
if (!fs30.existsSync(destDir)) fs30.mkdirSync(destDir, { recursive: true });
|
|
20152
20186
|
fs30.renameSync(sourcePath, destPath);
|
|
20153
20187
|
console.log(
|
|
20154
|
-
|
|
20188
|
+
chalk180.white(
|
|
20155
20189
|
` Moved ${path46.relative(cwd, sourcePath)} \u2192 ${path46.relative(cwd, destPath)}`
|
|
20156
20190
|
)
|
|
20157
20191
|
);
|
|
@@ -20238,16 +20272,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
20238
20272
|
|
|
20239
20273
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
20240
20274
|
import path48 from "path";
|
|
20241
|
-
import
|
|
20275
|
+
import chalk181 from "chalk";
|
|
20242
20276
|
function printRenamePreview(rewrites, cwd) {
|
|
20243
20277
|
for (const rewrite of rewrites) {
|
|
20244
20278
|
console.log(
|
|
20245
|
-
|
|
20279
|
+
chalk181.dim(
|
|
20246
20280
|
` ${path48.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
20247
20281
|
)
|
|
20248
20282
|
);
|
|
20249
20283
|
}
|
|
20250
|
-
console.log(
|
|
20284
|
+
console.log(chalk181.dim("Dry run. Use --apply to execute."));
|
|
20251
20285
|
}
|
|
20252
20286
|
|
|
20253
20287
|
// src/commands/refactor/rename/index.ts
|
|
@@ -20258,20 +20292,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20258
20292
|
const relSource = path49.relative(cwd, sourcePath);
|
|
20259
20293
|
const relDest = path49.relative(cwd, destPath);
|
|
20260
20294
|
if (!fs31.existsSync(sourcePath)) {
|
|
20261
|
-
console.log(
|
|
20295
|
+
console.log(chalk182.red(`File not found: ${source}`));
|
|
20262
20296
|
process.exit(1);
|
|
20263
20297
|
}
|
|
20264
20298
|
if (destPath !== sourcePath && fs31.existsSync(destPath)) {
|
|
20265
|
-
console.log(
|
|
20299
|
+
console.log(chalk182.red(`Destination already exists: ${destination}`));
|
|
20266
20300
|
process.exit(1);
|
|
20267
20301
|
}
|
|
20268
|
-
console.log(
|
|
20269
|
-
console.log(
|
|
20270
|
-
console.log(
|
|
20302
|
+
console.log(chalk182.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
20303
|
+
console.log(chalk182.dim("Loading project..."));
|
|
20304
|
+
console.log(chalk182.dim("Scanning imports across the project..."));
|
|
20271
20305
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
20272
20306
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
20273
20307
|
console.log(
|
|
20274
|
-
|
|
20308
|
+
chalk182.dim(
|
|
20275
20309
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
20276
20310
|
)
|
|
20277
20311
|
);
|
|
@@ -20280,11 +20314,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
20280
20314
|
return;
|
|
20281
20315
|
}
|
|
20282
20316
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
20283
|
-
console.log(
|
|
20317
|
+
console.log(chalk182.green("Done"));
|
|
20284
20318
|
}
|
|
20285
20319
|
|
|
20286
20320
|
// src/commands/refactor/renameSymbol/index.ts
|
|
20287
|
-
import
|
|
20321
|
+
import chalk183 from "chalk";
|
|
20288
20322
|
|
|
20289
20323
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
20290
20324
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -20330,33 +20364,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
20330
20364
|
const { project, sourceFile } = loadProjectFile(file);
|
|
20331
20365
|
const symbol = findSymbol(sourceFile, oldName);
|
|
20332
20366
|
if (!symbol) {
|
|
20333
|
-
console.log(
|
|
20367
|
+
console.log(chalk183.red(`Symbol "${oldName}" not found in ${file}`));
|
|
20334
20368
|
process.exit(1);
|
|
20335
20369
|
}
|
|
20336
20370
|
const grouped = groupReferences(symbol, cwd);
|
|
20337
20371
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
20338
20372
|
console.log(
|
|
20339
|
-
|
|
20373
|
+
chalk183.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
20340
20374
|
`)
|
|
20341
20375
|
);
|
|
20342
20376
|
for (const [refFile, lines] of grouped) {
|
|
20343
20377
|
console.log(
|
|
20344
|
-
` ${
|
|
20378
|
+
` ${chalk183.dim(refFile)}: lines ${chalk183.cyan(lines.join(", "))}`
|
|
20345
20379
|
);
|
|
20346
20380
|
}
|
|
20347
20381
|
if (options2.apply) {
|
|
20348
20382
|
symbol.rename(newName);
|
|
20349
20383
|
await project.save();
|
|
20350
|
-
console.log(
|
|
20384
|
+
console.log(chalk183.green(`
|
|
20351
20385
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
20352
20386
|
} else {
|
|
20353
|
-
console.log(
|
|
20387
|
+
console.log(chalk183.dim("\nDry run. Use --apply to execute."));
|
|
20354
20388
|
}
|
|
20355
20389
|
}
|
|
20356
20390
|
|
|
20357
20391
|
// src/commands/refactor/restructure/index.ts
|
|
20358
20392
|
import path57 from "path";
|
|
20359
|
-
import
|
|
20393
|
+
import chalk186 from "chalk";
|
|
20360
20394
|
|
|
20361
20395
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
20362
20396
|
import path51 from "path";
|
|
@@ -20435,50 +20469,50 @@ function clusterFiles(graph) {
|
|
|
20435
20469
|
|
|
20436
20470
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
20437
20471
|
import path53 from "path";
|
|
20438
|
-
import
|
|
20472
|
+
import chalk184 from "chalk";
|
|
20439
20473
|
function relPath(filePath) {
|
|
20440
20474
|
return path53.relative(process.cwd(), filePath);
|
|
20441
20475
|
}
|
|
20442
20476
|
function displayMoves(plan2) {
|
|
20443
20477
|
if (plan2.moves.length === 0) return;
|
|
20444
|
-
console.log(
|
|
20478
|
+
console.log(chalk184.bold("\nFile moves:"));
|
|
20445
20479
|
for (const move2 of plan2.moves) {
|
|
20446
20480
|
console.log(
|
|
20447
|
-
` ${
|
|
20481
|
+
` ${chalk184.red(relPath(move2.from))} \u2192 ${chalk184.green(relPath(move2.to))}`
|
|
20448
20482
|
);
|
|
20449
|
-
console.log(
|
|
20483
|
+
console.log(chalk184.dim(` ${move2.reason}`));
|
|
20450
20484
|
}
|
|
20451
20485
|
}
|
|
20452
20486
|
function displayRewrites(rewrites) {
|
|
20453
20487
|
if (rewrites.length === 0) return;
|
|
20454
20488
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
20455
|
-
console.log(
|
|
20489
|
+
console.log(chalk184.bold(`
|
|
20456
20490
|
Import rewrites (${affectedFiles.size} files):`));
|
|
20457
20491
|
for (const file of affectedFiles) {
|
|
20458
|
-
console.log(` ${
|
|
20492
|
+
console.log(` ${chalk184.cyan(relPath(file))}:`);
|
|
20459
20493
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
20460
20494
|
(r) => r.file === file
|
|
20461
20495
|
)) {
|
|
20462
20496
|
console.log(
|
|
20463
|
-
` ${
|
|
20497
|
+
` ${chalk184.red(`"${oldSpecifier}"`)} \u2192 ${chalk184.green(`"${newSpecifier}"`)}`
|
|
20464
20498
|
);
|
|
20465
20499
|
}
|
|
20466
20500
|
}
|
|
20467
20501
|
}
|
|
20468
20502
|
function displayPlan2(plan2) {
|
|
20469
20503
|
if (plan2.warnings.length > 0) {
|
|
20470
|
-
console.log(
|
|
20471
|
-
for (const w of plan2.warnings) console.log(
|
|
20504
|
+
console.log(chalk184.yellow("\nWarnings:"));
|
|
20505
|
+
for (const w of plan2.warnings) console.log(chalk184.yellow(` ${w}`));
|
|
20472
20506
|
}
|
|
20473
20507
|
if (plan2.newDirectories.length > 0) {
|
|
20474
|
-
console.log(
|
|
20508
|
+
console.log(chalk184.bold("\nNew directories:"));
|
|
20475
20509
|
for (const dir of plan2.newDirectories)
|
|
20476
|
-
console.log(
|
|
20510
|
+
console.log(chalk184.green(` ${dir}/`));
|
|
20477
20511
|
}
|
|
20478
20512
|
displayMoves(plan2);
|
|
20479
20513
|
displayRewrites(plan2.rewrites);
|
|
20480
20514
|
console.log(
|
|
20481
|
-
|
|
20515
|
+
chalk184.dim(
|
|
20482
20516
|
`
|
|
20483
20517
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
20484
20518
|
)
|
|
@@ -20488,18 +20522,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
20488
20522
|
// src/commands/refactor/restructure/executePlan.ts
|
|
20489
20523
|
import fs32 from "fs";
|
|
20490
20524
|
import path54 from "path";
|
|
20491
|
-
import
|
|
20525
|
+
import chalk185 from "chalk";
|
|
20492
20526
|
function executePlan(plan2) {
|
|
20493
20527
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
20494
20528
|
for (const [file, content] of updatedContents) {
|
|
20495
20529
|
fs32.writeFileSync(file, content, "utf8");
|
|
20496
20530
|
console.log(
|
|
20497
|
-
|
|
20531
|
+
chalk185.cyan(` Rewrote imports in ${path54.relative(process.cwd(), file)}`)
|
|
20498
20532
|
);
|
|
20499
20533
|
}
|
|
20500
20534
|
for (const dir of plan2.newDirectories) {
|
|
20501
20535
|
fs32.mkdirSync(dir, { recursive: true });
|
|
20502
|
-
console.log(
|
|
20536
|
+
console.log(chalk185.green(` Created ${path54.relative(process.cwd(), dir)}/`));
|
|
20503
20537
|
}
|
|
20504
20538
|
for (const move2 of plan2.moves) {
|
|
20505
20539
|
const targetDir = path54.dirname(move2.to);
|
|
@@ -20508,7 +20542,7 @@ function executePlan(plan2) {
|
|
|
20508
20542
|
}
|
|
20509
20543
|
fs32.renameSync(move2.from, move2.to);
|
|
20510
20544
|
console.log(
|
|
20511
|
-
|
|
20545
|
+
chalk185.white(
|
|
20512
20546
|
` Moved ${path54.relative(process.cwd(), move2.from)} \u2192 ${path54.relative(process.cwd(), move2.to)}`
|
|
20513
20547
|
)
|
|
20514
20548
|
);
|
|
@@ -20523,7 +20557,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
20523
20557
|
if (entries.length === 0) {
|
|
20524
20558
|
fs32.rmdirSync(dir);
|
|
20525
20559
|
console.log(
|
|
20526
|
-
|
|
20560
|
+
chalk185.dim(
|
|
20527
20561
|
` Removed empty directory ${path54.relative(process.cwd(), dir)}`
|
|
20528
20562
|
)
|
|
20529
20563
|
);
|
|
@@ -20656,22 +20690,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
20656
20690
|
const targetPattern = pattern2 ?? "src";
|
|
20657
20691
|
const files = findSourceFiles2(targetPattern);
|
|
20658
20692
|
if (files.length === 0) {
|
|
20659
|
-
console.log(
|
|
20693
|
+
console.log(chalk186.yellow("No files found matching pattern"));
|
|
20660
20694
|
return;
|
|
20661
20695
|
}
|
|
20662
20696
|
const tsConfigPath = findTsConfig(path57.resolve(files[0]));
|
|
20663
20697
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
20664
20698
|
if (plan2.moves.length === 0) {
|
|
20665
|
-
console.log(
|
|
20699
|
+
console.log(chalk186.green("No restructuring needed"));
|
|
20666
20700
|
return;
|
|
20667
20701
|
}
|
|
20668
20702
|
displayPlan2(plan2);
|
|
20669
20703
|
if (options2.apply) {
|
|
20670
|
-
console.log(
|
|
20704
|
+
console.log(chalk186.bold("\nApplying changes..."));
|
|
20671
20705
|
executePlan(plan2);
|
|
20672
|
-
console.log(
|
|
20706
|
+
console.log(chalk186.green("\nRestructuring complete"));
|
|
20673
20707
|
} else {
|
|
20674
|
-
console.log(
|
|
20708
|
+
console.log(chalk186.dim("\nDry run. Use --apply to execute."));
|
|
20675
20709
|
}
|
|
20676
20710
|
}
|
|
20677
20711
|
|
|
@@ -21254,18 +21288,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
21254
21288
|
}
|
|
21255
21289
|
|
|
21256
21290
|
// src/commands/review/warnOutOfDiff.ts
|
|
21257
|
-
import
|
|
21291
|
+
import chalk187 from "chalk";
|
|
21258
21292
|
function warnOutOfDiff(outOfDiff) {
|
|
21259
21293
|
if (outOfDiff.length === 0) return;
|
|
21260
21294
|
console.warn(
|
|
21261
|
-
|
|
21295
|
+
chalk187.yellow(
|
|
21262
21296
|
`Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
|
|
21263
21297
|
)
|
|
21264
21298
|
);
|
|
21265
21299
|
for (const finding of outOfDiff) {
|
|
21266
21300
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
21267
21301
|
console.warn(
|
|
21268
|
-
` ${
|
|
21302
|
+
` ${chalk187.yellow("\xB7")} ${finding.title} ${chalk187.dim(
|
|
21269
21303
|
`(${finding.file}:${range})`
|
|
21270
21304
|
)}`
|
|
21271
21305
|
);
|
|
@@ -21284,18 +21318,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
21284
21318
|
}
|
|
21285
21319
|
|
|
21286
21320
|
// src/commands/review/warnUnlocated.ts
|
|
21287
|
-
import
|
|
21321
|
+
import chalk188 from "chalk";
|
|
21288
21322
|
function warnUnlocated(unlocated) {
|
|
21289
21323
|
if (unlocated.length === 0) return;
|
|
21290
21324
|
console.warn(
|
|
21291
|
-
|
|
21325
|
+
chalk188.yellow(
|
|
21292
21326
|
`Skipped ${unlocated.length} finding(s) without a parseable file:line:`
|
|
21293
21327
|
)
|
|
21294
21328
|
);
|
|
21295
21329
|
for (const finding of unlocated) {
|
|
21296
|
-
const where = finding.location ||
|
|
21330
|
+
const where = finding.location || chalk188.dim("missing");
|
|
21297
21331
|
console.warn(
|
|
21298
|
-
` ${
|
|
21332
|
+
` ${chalk188.yellow("\xB7")} ${finding.title} ${chalk188.dim(`(${where})`)}`
|
|
21299
21333
|
);
|
|
21300
21334
|
}
|
|
21301
21335
|
}
|
|
@@ -22467,7 +22501,7 @@ function registerReview(program2) {
|
|
|
22467
22501
|
}
|
|
22468
22502
|
|
|
22469
22503
|
// src/commands/seq/seqAuth.ts
|
|
22470
|
-
import
|
|
22504
|
+
import chalk190 from "chalk";
|
|
22471
22505
|
|
|
22472
22506
|
// src/commands/seq/loadConnections.ts
|
|
22473
22507
|
function loadConnections2() {
|
|
@@ -22496,10 +22530,10 @@ function setDefaultConnection(name) {
|
|
|
22496
22530
|
}
|
|
22497
22531
|
|
|
22498
22532
|
// src/shared/assertUniqueName.ts
|
|
22499
|
-
import
|
|
22533
|
+
import chalk189 from "chalk";
|
|
22500
22534
|
function assertUniqueName(existingNames, name) {
|
|
22501
22535
|
if (existingNames.includes(name)) {
|
|
22502
|
-
console.error(
|
|
22536
|
+
console.error(chalk189.red(`Connection "${name}" already exists.`));
|
|
22503
22537
|
process.exit(1);
|
|
22504
22538
|
}
|
|
22505
22539
|
}
|
|
@@ -22517,7 +22551,7 @@ async function promptConnection2(existingNames) {
|
|
|
22517
22551
|
var seqAuth = createConnectionAuth({
|
|
22518
22552
|
load: loadConnections2,
|
|
22519
22553
|
save: saveConnections2,
|
|
22520
|
-
format: (c) => `${
|
|
22554
|
+
format: (c) => `${chalk190.bold(c.name)} ${c.url}`,
|
|
22521
22555
|
promptNew: promptConnection2,
|
|
22522
22556
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
22523
22557
|
});
|
|
@@ -22537,10 +22571,10 @@ var seqConfigHelp = [
|
|
|
22537
22571
|
];
|
|
22538
22572
|
|
|
22539
22573
|
// src/commands/seq/seqQuery.ts
|
|
22540
|
-
import
|
|
22574
|
+
import chalk194 from "chalk";
|
|
22541
22575
|
|
|
22542
22576
|
// src/commands/seq/fetchSeq.ts
|
|
22543
|
-
import
|
|
22577
|
+
import chalk191 from "chalk";
|
|
22544
22578
|
async function fetchSeq(conn, path71, params) {
|
|
22545
22579
|
const url = `${conn.url}${path71}?${params}`;
|
|
22546
22580
|
const response = await fetch(url, {
|
|
@@ -22551,7 +22585,7 @@ async function fetchSeq(conn, path71, params) {
|
|
|
22551
22585
|
});
|
|
22552
22586
|
if (!response.ok) {
|
|
22553
22587
|
const body = await response.text();
|
|
22554
|
-
console.error(
|
|
22588
|
+
console.error(chalk191.red(`Seq returned ${response.status}: ${body}`));
|
|
22555
22589
|
process.exit(1);
|
|
22556
22590
|
}
|
|
22557
22591
|
return response;
|
|
@@ -22610,23 +22644,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
22610
22644
|
}
|
|
22611
22645
|
|
|
22612
22646
|
// src/commands/seq/formatEvent.ts
|
|
22613
|
-
import
|
|
22647
|
+
import chalk192 from "chalk";
|
|
22614
22648
|
function levelColor(level) {
|
|
22615
22649
|
switch (level) {
|
|
22616
22650
|
case "Fatal":
|
|
22617
|
-
return
|
|
22651
|
+
return chalk192.bgRed.white;
|
|
22618
22652
|
case "Error":
|
|
22619
|
-
return
|
|
22653
|
+
return chalk192.red;
|
|
22620
22654
|
case "Warning":
|
|
22621
|
-
return
|
|
22655
|
+
return chalk192.yellow;
|
|
22622
22656
|
case "Information":
|
|
22623
|
-
return
|
|
22657
|
+
return chalk192.cyan;
|
|
22624
22658
|
case "Debug":
|
|
22625
|
-
return
|
|
22659
|
+
return chalk192.gray;
|
|
22626
22660
|
case "Verbose":
|
|
22627
|
-
return
|
|
22661
|
+
return chalk192.dim;
|
|
22628
22662
|
default:
|
|
22629
|
-
return
|
|
22663
|
+
return chalk192.white;
|
|
22630
22664
|
}
|
|
22631
22665
|
}
|
|
22632
22666
|
function levelAbbrev(level) {
|
|
@@ -22667,12 +22701,12 @@ function formatTimestamp(iso) {
|
|
|
22667
22701
|
function formatEvent(event) {
|
|
22668
22702
|
const color = levelColor(event.Level);
|
|
22669
22703
|
const abbrev = levelAbbrev(event.Level);
|
|
22670
|
-
const ts8 =
|
|
22704
|
+
const ts8 = chalk192.dim(formatTimestamp(event.Timestamp));
|
|
22671
22705
|
const msg = renderMessage(event);
|
|
22672
22706
|
const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
22673
22707
|
if (event.Exception) {
|
|
22674
22708
|
for (const line of event.Exception.split("\n")) {
|
|
22675
|
-
lines.push(
|
|
22709
|
+
lines.push(chalk192.red(` ${line}`));
|
|
22676
22710
|
}
|
|
22677
22711
|
}
|
|
22678
22712
|
return lines.join("\n");
|
|
@@ -22705,11 +22739,11 @@ function rejectTimestampFilter(filter) {
|
|
|
22705
22739
|
}
|
|
22706
22740
|
|
|
22707
22741
|
// src/shared/resolveNamedConnection.ts
|
|
22708
|
-
import
|
|
22742
|
+
import chalk193 from "chalk";
|
|
22709
22743
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
22710
22744
|
if (connections.length === 0) {
|
|
22711
22745
|
console.error(
|
|
22712
|
-
|
|
22746
|
+
chalk193.red(
|
|
22713
22747
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
22714
22748
|
)
|
|
22715
22749
|
);
|
|
@@ -22718,7 +22752,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
22718
22752
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
22719
22753
|
const connection = connections.find((c) => c.name === target);
|
|
22720
22754
|
if (!connection) {
|
|
22721
|
-
console.error(
|
|
22755
|
+
console.error(chalk193.red(`${kind} connection "${target}" not found.`));
|
|
22722
22756
|
process.exit(1);
|
|
22723
22757
|
}
|
|
22724
22758
|
return connection;
|
|
@@ -22747,7 +22781,7 @@ async function seqQuery(filter, options2) {
|
|
|
22747
22781
|
new URLSearchParams({ filter, count: String(count7) })
|
|
22748
22782
|
);
|
|
22749
22783
|
if (events.length === 0) {
|
|
22750
|
-
console.log(
|
|
22784
|
+
console.log(chalk194.yellow("No events found."));
|
|
22751
22785
|
return;
|
|
22752
22786
|
}
|
|
22753
22787
|
if (options2.json) {
|
|
@@ -22758,11 +22792,11 @@ async function seqQuery(filter, options2) {
|
|
|
22758
22792
|
for (const event of chronological) {
|
|
22759
22793
|
console.log(formatEvent(event));
|
|
22760
22794
|
}
|
|
22761
|
-
console.log(
|
|
22795
|
+
console.log(chalk194.dim(`
|
|
22762
22796
|
${events.length} events`));
|
|
22763
22797
|
if (events.length >= count7) {
|
|
22764
22798
|
console.log(
|
|
22765
|
-
|
|
22799
|
+
chalk194.yellow(
|
|
22766
22800
|
`Results limited to ${count7}. Use --count to retrieve more.`
|
|
22767
22801
|
)
|
|
22768
22802
|
);
|
|
@@ -22770,10 +22804,10 @@ ${events.length} events`));
|
|
|
22770
22804
|
}
|
|
22771
22805
|
|
|
22772
22806
|
// src/shared/setNamedDefaultConnection.ts
|
|
22773
|
-
import
|
|
22807
|
+
import chalk195 from "chalk";
|
|
22774
22808
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
22775
22809
|
if (!connections.find((c) => c.name === name)) {
|
|
22776
|
-
console.error(
|
|
22810
|
+
console.error(chalk195.red(`Connection "${name}" not found.`));
|
|
22777
22811
|
process.exit(1);
|
|
22778
22812
|
}
|
|
22779
22813
|
setDefault(name);
|
|
@@ -22822,7 +22856,7 @@ function registerSignal(program2) {
|
|
|
22822
22856
|
}
|
|
22823
22857
|
|
|
22824
22858
|
// src/commands/sql/sqlAuth.ts
|
|
22825
|
-
import
|
|
22859
|
+
import chalk197 from "chalk";
|
|
22826
22860
|
|
|
22827
22861
|
// src/commands/sql/loadConnections.ts
|
|
22828
22862
|
function loadConnections3() {
|
|
@@ -22851,7 +22885,7 @@ function setDefaultConnection2(name) {
|
|
|
22851
22885
|
}
|
|
22852
22886
|
|
|
22853
22887
|
// src/commands/sql/promptConnection.ts
|
|
22854
|
-
import
|
|
22888
|
+
import chalk196 from "chalk";
|
|
22855
22889
|
async function promptConnection3(existingNames) {
|
|
22856
22890
|
const name = await promptInput("name", "Connection name:", "default");
|
|
22857
22891
|
assertUniqueName(existingNames, name);
|
|
@@ -22859,7 +22893,7 @@ async function promptConnection3(existingNames) {
|
|
|
22859
22893
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
22860
22894
|
const port = Number.parseInt(portStr, 10);
|
|
22861
22895
|
if (!Number.isFinite(port)) {
|
|
22862
|
-
console.error(
|
|
22896
|
+
console.error(chalk196.red(`Invalid port "${portStr}".`));
|
|
22863
22897
|
process.exit(1);
|
|
22864
22898
|
}
|
|
22865
22899
|
const user = await promptInput("user", "User:");
|
|
@@ -22872,13 +22906,13 @@ async function promptConnection3(existingNames) {
|
|
|
22872
22906
|
var sqlAuth = createConnectionAuth({
|
|
22873
22907
|
load: loadConnections3,
|
|
22874
22908
|
save: saveConnections3,
|
|
22875
|
-
format: (c) => `${
|
|
22909
|
+
format: (c) => `${chalk197.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
22876
22910
|
promptNew: promptConnection3,
|
|
22877
22911
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
22878
22912
|
});
|
|
22879
22913
|
|
|
22880
22914
|
// src/commands/sql/printTable.ts
|
|
22881
|
-
import
|
|
22915
|
+
import chalk198 from "chalk";
|
|
22882
22916
|
function formatCell(value) {
|
|
22883
22917
|
if (value === null || value === void 0) return "";
|
|
22884
22918
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -22887,7 +22921,7 @@ function formatCell(value) {
|
|
|
22887
22921
|
}
|
|
22888
22922
|
function printTable(rows) {
|
|
22889
22923
|
if (rows.length === 0) {
|
|
22890
|
-
console.log(
|
|
22924
|
+
console.log(chalk198.yellow("(no rows)"));
|
|
22891
22925
|
return;
|
|
22892
22926
|
}
|
|
22893
22927
|
const columns = Object.keys(rows[0]);
|
|
@@ -22895,13 +22929,13 @@ function printTable(rows) {
|
|
|
22895
22929
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
22896
22930
|
);
|
|
22897
22931
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
22898
|
-
console.log(
|
|
22899
|
-
console.log(
|
|
22932
|
+
console.log(chalk198.dim(header));
|
|
22933
|
+
console.log(chalk198.dim("-".repeat(header.length)));
|
|
22900
22934
|
for (const row of rows) {
|
|
22901
22935
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
22902
22936
|
console.log(line);
|
|
22903
22937
|
}
|
|
22904
|
-
console.log(
|
|
22938
|
+
console.log(chalk198.dim(`
|
|
22905
22939
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
22906
22940
|
}
|
|
22907
22941
|
|
|
@@ -22975,7 +23009,7 @@ var sqlConfigHelp = [
|
|
|
22975
23009
|
];
|
|
22976
23010
|
|
|
22977
23011
|
// src/commands/sql/sqlMutate.ts
|
|
22978
|
-
import
|
|
23012
|
+
import chalk199 from "chalk";
|
|
22979
23013
|
|
|
22980
23014
|
// src/commands/sql/isMutation.ts
|
|
22981
23015
|
var MUTATION_KEYWORDS = [
|
|
@@ -23009,7 +23043,7 @@ function isMutation(sql25) {
|
|
|
23009
23043
|
async function sqlMutate(query, connectionName) {
|
|
23010
23044
|
if (!isMutation(query)) {
|
|
23011
23045
|
console.error(
|
|
23012
|
-
|
|
23046
|
+
chalk199.red(
|
|
23013
23047
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
23014
23048
|
)
|
|
23015
23049
|
);
|
|
@@ -23019,18 +23053,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
23019
23053
|
const pool = await sqlConnect(conn);
|
|
23020
23054
|
try {
|
|
23021
23055
|
const result = await pool.request().query(query);
|
|
23022
|
-
console.log(
|
|
23056
|
+
console.log(chalk199.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
23023
23057
|
} finally {
|
|
23024
23058
|
await pool.close();
|
|
23025
23059
|
}
|
|
23026
23060
|
}
|
|
23027
23061
|
|
|
23028
23062
|
// src/commands/sql/sqlQuery.ts
|
|
23029
|
-
import
|
|
23063
|
+
import chalk200 from "chalk";
|
|
23030
23064
|
async function sqlQuery(query, connectionName) {
|
|
23031
23065
|
if (isMutation(query)) {
|
|
23032
23066
|
console.error(
|
|
23033
|
-
|
|
23067
|
+
chalk200.red(
|
|
23034
23068
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
23035
23069
|
)
|
|
23036
23070
|
);
|
|
@@ -23045,7 +23079,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
23045
23079
|
printTable(rows);
|
|
23046
23080
|
} else {
|
|
23047
23081
|
console.log(
|
|
23048
|
-
|
|
23082
|
+
chalk200.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
23049
23083
|
);
|
|
23050
23084
|
}
|
|
23051
23085
|
} finally {
|
|
@@ -23860,7 +23894,7 @@ function registerVoice(program2) {
|
|
|
23860
23894
|
|
|
23861
23895
|
// src/commands/roam/auth.ts
|
|
23862
23896
|
import { randomBytes } from "crypto";
|
|
23863
|
-
import
|
|
23897
|
+
import chalk201 from "chalk";
|
|
23864
23898
|
|
|
23865
23899
|
// src/commands/roam/waitForCallback.ts
|
|
23866
23900
|
import { createServer as createServer3 } from "http";
|
|
@@ -23991,13 +24025,13 @@ async function auth() {
|
|
|
23991
24025
|
saveGlobalConfig(config);
|
|
23992
24026
|
const state = randomBytes(16).toString("hex");
|
|
23993
24027
|
console.log(
|
|
23994
|
-
|
|
24028
|
+
chalk201.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
23995
24029
|
);
|
|
23996
|
-
console.log(
|
|
23997
|
-
console.log(
|
|
23998
|
-
console.log(
|
|
24030
|
+
console.log(chalk201.white("http://localhost:14523/callback\n"));
|
|
24031
|
+
console.log(chalk201.blue("Opening browser for authorization..."));
|
|
24032
|
+
console.log(chalk201.dim("Waiting for authorization callback..."));
|
|
23999
24033
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
24000
|
-
console.log(
|
|
24034
|
+
console.log(chalk201.dim("Exchanging code for tokens..."));
|
|
24001
24035
|
const tokens = await exchangeToken({
|
|
24002
24036
|
code,
|
|
24003
24037
|
clientId,
|
|
@@ -24013,7 +24047,7 @@ async function auth() {
|
|
|
24013
24047
|
};
|
|
24014
24048
|
saveGlobalConfig(config);
|
|
24015
24049
|
console.log(
|
|
24016
|
-
|
|
24050
|
+
chalk201.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
24017
24051
|
);
|
|
24018
24052
|
}
|
|
24019
24053
|
|
|
@@ -24556,7 +24590,7 @@ import { execSync as execSync58 } from "child_process";
|
|
|
24556
24590
|
import { existsSync as existsSync56, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
|
|
24557
24591
|
import { tmpdir as tmpdir7 } from "os";
|
|
24558
24592
|
import { join as join66, resolve as resolve16 } from "path";
|
|
24559
|
-
import
|
|
24593
|
+
import chalk202 from "chalk";
|
|
24560
24594
|
|
|
24561
24595
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
24562
24596
|
var captureWindowPs1 = `
|
|
@@ -24707,13 +24741,13 @@ function screenshot(processName) {
|
|
|
24707
24741
|
const config = loadConfig();
|
|
24708
24742
|
const outputDir = resolve16(config.screenshot.outputDir);
|
|
24709
24743
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
24710
|
-
console.log(
|
|
24744
|
+
console.log(chalk202.gray(`Capturing window for process "${processName}" ...`));
|
|
24711
24745
|
try {
|
|
24712
24746
|
runPowerShellScript(processName, outputPath);
|
|
24713
|
-
console.log(
|
|
24747
|
+
console.log(chalk202.green(`Screenshot saved: ${outputPath}`));
|
|
24714
24748
|
} catch (error) {
|
|
24715
24749
|
const msg = error instanceof Error ? error.message : String(error);
|
|
24716
|
-
console.error(
|
|
24750
|
+
console.error(chalk202.red(`Failed to capture screenshot: ${msg}`));
|
|
24717
24751
|
process.exit(1);
|
|
24718
24752
|
}
|
|
24719
24753
|
}
|
|
@@ -26401,14 +26435,23 @@ function restoreInteractiveSession(id, persisted, base, idle) {
|
|
|
26401
26435
|
return notRestoredStub(base, persisted);
|
|
26402
26436
|
}
|
|
26403
26437
|
function resumeViaClaude(id, persisted, base, idle) {
|
|
26404
|
-
const pty2 = spawnClaude2(
|
|
26405
|
-
|
|
26406
|
-
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
|
|
26438
|
+
const pty2 = spawnClaude2(
|
|
26439
|
+
hasTranscriptOnDisk(persisted) ? {
|
|
26440
|
+
resumeSessionId: persisted.claudeSessionId,
|
|
26441
|
+
prompt: idle ? void 0 : buildResumePrompt(),
|
|
26442
|
+
cwd: persisted.cwd,
|
|
26443
|
+
sessionId: id
|
|
26444
|
+
} : {
|
|
26445
|
+
claudeSessionId: persisted.claudeSessionId,
|
|
26446
|
+
cwd: persisted.cwd,
|
|
26447
|
+
sessionId: id
|
|
26448
|
+
}
|
|
26449
|
+
);
|
|
26410
26450
|
return idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2);
|
|
26411
26451
|
}
|
|
26452
|
+
function hasTranscriptOnDisk(persisted) {
|
|
26453
|
+
return !!persisted.claudeSessionId && !!findTranscriptPathSync(persisted.cwd, persisted.claudeSessionId);
|
|
26454
|
+
}
|
|
26412
26455
|
function unrecoverableClaude(id, persisted) {
|
|
26413
26456
|
return errorSession(
|
|
26414
26457
|
id,
|
|
@@ -28048,7 +28091,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
28048
28091
|
|
|
28049
28092
|
// src/commands/sessions/summarise/index.ts
|
|
28050
28093
|
import * as fs41 from "fs";
|
|
28051
|
-
import
|
|
28094
|
+
import chalk203 from "chalk";
|
|
28052
28095
|
|
|
28053
28096
|
// src/commands/sessions/summarise/shared.ts
|
|
28054
28097
|
import * as fs40 from "fs";
|
|
@@ -28122,22 +28165,22 @@ ${firstMessage}`);
|
|
|
28122
28165
|
async function summarise2(options2) {
|
|
28123
28166
|
const files = await discoverSessionFiles();
|
|
28124
28167
|
if (files.length === 0) {
|
|
28125
|
-
console.log(
|
|
28168
|
+
console.log(chalk203.yellow("No sessions found."));
|
|
28126
28169
|
return;
|
|
28127
28170
|
}
|
|
28128
28171
|
const toProcess = selectCandidates(files, options2);
|
|
28129
28172
|
if (toProcess.length === 0) {
|
|
28130
|
-
console.log(
|
|
28173
|
+
console.log(chalk203.green("All sessions already summarised."));
|
|
28131
28174
|
return;
|
|
28132
28175
|
}
|
|
28133
28176
|
console.log(
|
|
28134
|
-
|
|
28177
|
+
chalk203.cyan(
|
|
28135
28178
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
28136
28179
|
)
|
|
28137
28180
|
);
|
|
28138
28181
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
28139
28182
|
console.log(
|
|
28140
|
-
|
|
28183
|
+
chalk203.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk203.yellow(`, ${failed2} skipped`) : "")
|
|
28141
28184
|
);
|
|
28142
28185
|
}
|
|
28143
28186
|
function selectCandidates(files, options2) {
|
|
@@ -28157,16 +28200,16 @@ function processSessions(files) {
|
|
|
28157
28200
|
let failed2 = 0;
|
|
28158
28201
|
for (let i = 0; i < files.length; i++) {
|
|
28159
28202
|
const file = files[i];
|
|
28160
|
-
process.stdout.write(
|
|
28203
|
+
process.stdout.write(chalk203.dim(` [${i + 1}/${files.length}] `));
|
|
28161
28204
|
const summary = summariseSession(file);
|
|
28162
28205
|
if (summary) {
|
|
28163
28206
|
writeSummary(file, summary);
|
|
28164
28207
|
succeeded++;
|
|
28165
|
-
process.stdout.write(`${
|
|
28208
|
+
process.stdout.write(`${chalk203.green("\u2713")} ${summary}
|
|
28166
28209
|
`);
|
|
28167
28210
|
} else {
|
|
28168
28211
|
failed2++;
|
|
28169
|
-
process.stdout.write(` ${
|
|
28212
|
+
process.stdout.write(` ${chalk203.yellow("skip")}
|
|
28170
28213
|
`);
|
|
28171
28214
|
}
|
|
28172
28215
|
}
|
|
@@ -28208,7 +28251,7 @@ function registerSessions(program2) {
|
|
|
28208
28251
|
}
|
|
28209
28252
|
|
|
28210
28253
|
// src/commands/statusLine.ts
|
|
28211
|
-
import
|
|
28254
|
+
import chalk205 from "chalk";
|
|
28212
28255
|
|
|
28213
28256
|
// src/shared/contextLevel.ts
|
|
28214
28257
|
function contextLevel(pct) {
|
|
@@ -28218,7 +28261,7 @@ function contextLevel(pct) {
|
|
|
28218
28261
|
}
|
|
28219
28262
|
|
|
28220
28263
|
// src/commands/buildLimitsSegment.ts
|
|
28221
|
-
import
|
|
28264
|
+
import chalk204 from "chalk";
|
|
28222
28265
|
|
|
28223
28266
|
// src/shared/rateLimitLevel.ts
|
|
28224
28267
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -28249,9 +28292,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
28249
28292
|
|
|
28250
28293
|
// src/commands/buildLimitsSegment.ts
|
|
28251
28294
|
var LEVEL_COLOR = {
|
|
28252
|
-
ok:
|
|
28253
|
-
warn:
|
|
28254
|
-
over:
|
|
28295
|
+
ok: chalk204.green,
|
|
28296
|
+
warn: chalk204.yellow,
|
|
28297
|
+
over: chalk204.red
|
|
28255
28298
|
};
|
|
28256
28299
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
28257
28300
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -28347,7 +28390,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
28347
28390
|
}
|
|
28348
28391
|
|
|
28349
28392
|
// src/commands/statusLine.ts
|
|
28350
|
-
|
|
28393
|
+
chalk205.level = 3;
|
|
28351
28394
|
function formatNumber(num) {
|
|
28352
28395
|
return num.toLocaleString("en-US");
|
|
28353
28396
|
}
|
|
@@ -28355,9 +28398,9 @@ function colorizePercent(pct) {
|
|
|
28355
28398
|
const label2 = `${Math.round(pct)}%`;
|
|
28356
28399
|
switch (contextLevel(pct)) {
|
|
28357
28400
|
case "red":
|
|
28358
|
-
return
|
|
28401
|
+
return chalk205.red(label2);
|
|
28359
28402
|
case "yellow":
|
|
28360
|
-
return
|
|
28403
|
+
return chalk205.yellow(label2);
|
|
28361
28404
|
default:
|
|
28362
28405
|
return label2;
|
|
28363
28406
|
}
|
|
@@ -28370,7 +28413,7 @@ async function statusLine() {
|
|
|
28370
28413
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
28371
28414
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
28372
28415
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
28373
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
28416
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk205.cyan(branch2)} | ` : "";
|
|
28374
28417
|
console.log(
|
|
28375
28418
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
28376
28419
|
);
|
|
@@ -28391,7 +28434,7 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
28391
28434
|
// src/commands/sync/syncClaudeMd.ts
|
|
28392
28435
|
import * as fs42 from "fs";
|
|
28393
28436
|
import * as path61 from "path";
|
|
28394
|
-
import
|
|
28437
|
+
import chalk206 from "chalk";
|
|
28395
28438
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
28396
28439
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
28397
28440
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -28400,12 +28443,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
28400
28443
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
28401
28444
|
if (sourceContent !== targetContent) {
|
|
28402
28445
|
console.log(
|
|
28403
|
-
|
|
28446
|
+
chalk206.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
28404
28447
|
);
|
|
28405
28448
|
console.log();
|
|
28406
28449
|
printDiff(targetContent, sourceContent);
|
|
28407
28450
|
const confirm = options2?.yes || await promptConfirm(
|
|
28408
|
-
|
|
28451
|
+
chalk206.red("Overwrite existing CLAUDE.md?"),
|
|
28409
28452
|
false
|
|
28410
28453
|
);
|
|
28411
28454
|
if (!confirm) {
|
|
@@ -28599,7 +28642,7 @@ function syncPi(claudeDir) {
|
|
|
28599
28642
|
// src/commands/sync/syncSettings.ts
|
|
28600
28643
|
import * as fs47 from "fs";
|
|
28601
28644
|
import * as path68 from "path";
|
|
28602
|
-
import
|
|
28645
|
+
import chalk207 from "chalk";
|
|
28603
28646
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
28604
28647
|
const source = path68.join(claudeDir, "settings.json");
|
|
28605
28648
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -28618,14 +28661,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
28618
28661
|
if (mergedContent !== normalizedTarget) {
|
|
28619
28662
|
if (!options2?.yes) {
|
|
28620
28663
|
console.log(
|
|
28621
|
-
|
|
28664
|
+
chalk207.yellow(
|
|
28622
28665
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
28623
28666
|
)
|
|
28624
28667
|
);
|
|
28625
28668
|
console.log();
|
|
28626
28669
|
printDiff(targetContent, mergedContent);
|
|
28627
28670
|
const confirm = await promptConfirm(
|
|
28628
|
-
|
|
28671
|
+
chalk207.red("Overwrite existing settings.json?"),
|
|
28629
28672
|
false
|
|
28630
28673
|
);
|
|
28631
28674
|
if (!confirm) {
|
|
@@ -28724,10 +28767,10 @@ async function update2() {
|
|
|
28724
28767
|
}
|
|
28725
28768
|
|
|
28726
28769
|
// src/reportCliError.ts
|
|
28727
|
-
import
|
|
28770
|
+
import chalk208 from "chalk";
|
|
28728
28771
|
function reportCliError(error) {
|
|
28729
28772
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError) {
|
|
28730
|
-
console.error(
|
|
28773
|
+
console.error(chalk208.red(error.message));
|
|
28731
28774
|
} else {
|
|
28732
28775
|
console.error(error);
|
|
28733
28776
|
}
|