@staff0rd/assist 0.1112.5 → 0.1112.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +310 -310
- package/dist/index.js +733 -708
- 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.1112.
|
|
9
|
+
version: "0.1112.7",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22504,7 +22504,8 @@ async function reviewProposal(item, sessionId2, confirmed, revises) {
|
|
|
22504
22504
|
prNumber: null,
|
|
22505
22505
|
kind: "backlog-item",
|
|
22506
22506
|
itemType: item.type,
|
|
22507
|
-
canStart: true
|
|
22507
|
+
canStart: true,
|
|
22508
|
+
startOrigin: getOrigin()
|
|
22508
22509
|
});
|
|
22509
22510
|
return toStartApproval(decision);
|
|
22510
22511
|
}
|
|
@@ -22612,12 +22613,12 @@ async function startChainedSession(label, start2) {
|
|
|
22612
22613
|
}
|
|
22613
22614
|
|
|
22614
22615
|
// src/commands/backlog/propose/startProposedRun.ts
|
|
22615
|
-
function startProposedRun(id, startOn) {
|
|
22616
|
+
function startProposedRun(id, startOn, cwd = process.cwd()) {
|
|
22616
22617
|
const itemId2 = formatItemId(id);
|
|
22617
22618
|
const args = ["backlog", "run", itemId2];
|
|
22618
22619
|
return startChainedSession(
|
|
22619
22620
|
`a backlog run session for ${itemId2}`,
|
|
22620
|
-
() => startOn ? requestAssistSession(args, startOn.cwd, { node: startOn.node }) : requestAssistSession(args,
|
|
22621
|
+
() => startOn ? requestAssistSession(args, startOn.cwd, { node: startOn.node }) : requestAssistSession(args, cwd)
|
|
22621
22622
|
);
|
|
22622
22623
|
}
|
|
22623
22624
|
|
|
@@ -25484,7 +25485,7 @@ function registerUpdateFieldCommand(cmd) {
|
|
|
25484
25485
|
}
|
|
25485
25486
|
|
|
25486
25487
|
// src/commands/backlog/updatePlan.ts
|
|
25487
|
-
import
|
|
25488
|
+
import chalk112 from "chalk";
|
|
25488
25489
|
|
|
25489
25490
|
// src/commands/backlog/updatePlan/planUpdateSchema.ts
|
|
25490
25491
|
import { z as z18 } from "zod";
|
|
@@ -25661,7 +25662,8 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
25661
25662
|
prNumber: null,
|
|
25662
25663
|
kind: "backlog-item",
|
|
25663
25664
|
itemType: item.type,
|
|
25664
|
-
canStart: true
|
|
25665
|
+
canStart: true,
|
|
25666
|
+
startOrigin: item.origin
|
|
25665
25667
|
});
|
|
25666
25668
|
return toStartApproval(decision);
|
|
25667
25669
|
}
|
|
@@ -25670,6 +25672,28 @@ async function reviewPlanUpdate(item, phases) {
|
|
|
25670
25672
|
return { autostart: false };
|
|
25671
25673
|
}
|
|
25672
25674
|
|
|
25675
|
+
// src/commands/backlog/updatePlan/startPlanRun.ts
|
|
25676
|
+
import chalk111 from "chalk";
|
|
25677
|
+
function itemRepoCwd(origin) {
|
|
25678
|
+
if (!origin || origin === getOrigin()) return process.cwd();
|
|
25679
|
+
const baseDir = expandTilde(loadConfig().clone.baseDir);
|
|
25680
|
+
return resolveRepoLocation(origin, void 0, baseDir).cwd;
|
|
25681
|
+
}
|
|
25682
|
+
async function startPlanRun(item, approval) {
|
|
25683
|
+
if (!approval.autostart) return;
|
|
25684
|
+
if (approval.startOn) return startProposedRun(item.id, approval.startOn);
|
|
25685
|
+
const cwd = itemRepoCwd(item.origin);
|
|
25686
|
+
if (!cwd) {
|
|
25687
|
+
console.log(
|
|
25688
|
+
chalk111.yellow(
|
|
25689
|
+
`Not starting a run: no clone of ${item.origin} was found. Run \`assist backlog run ${formatItemId(item.id)}\` from a clone of it.`
|
|
25690
|
+
)
|
|
25691
|
+
);
|
|
25692
|
+
return;
|
|
25693
|
+
}
|
|
25694
|
+
await startProposedRun(item.id, void 0, cwd);
|
|
25695
|
+
}
|
|
25696
|
+
|
|
25673
25697
|
// src/commands/backlog/updatePlan.ts
|
|
25674
25698
|
async function updatePlan(id, options2) {
|
|
25675
25699
|
const { phases } = await readPlanUpdate(options2.json);
|
|
@@ -25679,11 +25703,11 @@ async function updatePlan(id, options2) {
|
|
|
25679
25703
|
const approval = await reviewPlanUpdate(item, phases);
|
|
25680
25704
|
await replacePlan(orm, item.id, phases, item.currentPhase);
|
|
25681
25705
|
console.log(
|
|
25682
|
-
|
|
25706
|
+
chalk112.green(
|
|
25683
25707
|
`Replaced the plan on item ${formatItemId(item.id)} with ${phases.length} phase${phases.length === 1 ? "" : "s"}.`
|
|
25684
25708
|
)
|
|
25685
25709
|
);
|
|
25686
|
-
|
|
25710
|
+
await startPlanRun(item, approval);
|
|
25687
25711
|
}
|
|
25688
25712
|
|
|
25689
25713
|
// src/commands/backlog/registerUpdateCommands.ts
|
|
@@ -25715,7 +25739,7 @@ async function web2(options2) {
|
|
|
25715
25739
|
}
|
|
25716
25740
|
|
|
25717
25741
|
// src/commands/backlog/show.ts
|
|
25718
|
-
import
|
|
25742
|
+
import chalk118 from "chalk";
|
|
25719
25743
|
|
|
25720
25744
|
// src/commands/backlog/shortenGithubIssue.ts
|
|
25721
25745
|
var SHORTHAND = /^([^/\s]+)\/([^/\s]+)#(\d+)$/;
|
|
@@ -25730,7 +25754,7 @@ function shortenGithubIssue(githubIssue, origin) {
|
|
|
25730
25754
|
}
|
|
25731
25755
|
|
|
25732
25756
|
// src/commands/backlog/show/printActivity.ts
|
|
25733
|
-
import
|
|
25757
|
+
import chalk114 from "chalk";
|
|
25734
25758
|
|
|
25735
25759
|
// src/commands/backlog/groupActivityRefs.ts
|
|
25736
25760
|
var ACTIVITY_COMMIT_LIMIT = 10;
|
|
@@ -25750,7 +25774,7 @@ function groupActivityRefs(refs, commitLimit = ACTIVITY_COMMIT_LIMIT) {
|
|
|
25750
25774
|
}
|
|
25751
25775
|
|
|
25752
25776
|
// src/commands/backlog/show/printRef.ts
|
|
25753
|
-
import
|
|
25777
|
+
import chalk113 from "chalk";
|
|
25754
25778
|
|
|
25755
25779
|
// src/commands/backlog/refLabel.ts
|
|
25756
25780
|
function refLabel(ref) {
|
|
@@ -25771,9 +25795,9 @@ function refLabel(ref) {
|
|
|
25771
25795
|
|
|
25772
25796
|
// src/commands/backlog/show/printRef.ts
|
|
25773
25797
|
function printRef(ref) {
|
|
25774
|
-
const url = ref.url ? ` ${
|
|
25775
|
-
const approvedAt = isUnlock(ref) && ref.createdAt ? ` ${
|
|
25776
|
-
console.log(` ${
|
|
25798
|
+
const url = ref.url ? ` ${chalk113.dim(ref.url)}` : "";
|
|
25799
|
+
const approvedAt = isUnlock(ref) && ref.createdAt ? ` ${chalk113.dim(ref.createdAt)}` : "";
|
|
25800
|
+
console.log(` ${chalk113.cyan(ref.kind)} ${refLabel(ref)}${url}${approvedAt}`);
|
|
25777
25801
|
}
|
|
25778
25802
|
function isUnlock(ref) {
|
|
25779
25803
|
return ref.kind === "docs-unlock" || ref.kind === "schema-unlock";
|
|
@@ -25804,14 +25828,14 @@ function printActivity(item, options2 = {}) {
|
|
|
25804
25828
|
...sessions
|
|
25805
25829
|
];
|
|
25806
25830
|
if (ordered.length === 0) return;
|
|
25807
|
-
console.log(
|
|
25831
|
+
console.log(chalk114.bold("Activity"));
|
|
25808
25832
|
for (const unlock of unlocks) printRef(unlock);
|
|
25809
25833
|
for (const design of designs) printRef(design);
|
|
25810
25834
|
for (const branch2 of branches) printRef(branch2);
|
|
25811
25835
|
for (const commit2 of commits2) printRef(commit2);
|
|
25812
25836
|
if (overflowCommits.length > 0) {
|
|
25813
25837
|
console.log(
|
|
25814
|
-
` ${
|
|
25838
|
+
` ${chalk114.dim(`\u2026 and ${overflowCommits.length} more commits (--all-commits to show)`)}`
|
|
25815
25839
|
);
|
|
25816
25840
|
}
|
|
25817
25841
|
for (const pr of prs2) printRef(pr);
|
|
@@ -25821,20 +25845,20 @@ function printActivity(item, options2 = {}) {
|
|
|
25821
25845
|
}
|
|
25822
25846
|
|
|
25823
25847
|
// src/commands/backlog/show/printLinks.ts
|
|
25824
|
-
import
|
|
25848
|
+
import chalk115 from "chalk";
|
|
25825
25849
|
function printSection(heading2, links2, targets, label) {
|
|
25826
25850
|
if (links2.length === 0) return;
|
|
25827
|
-
console.log(
|
|
25851
|
+
console.log(chalk115.bold(heading2));
|
|
25828
25852
|
for (const link3 of links2) {
|
|
25829
25853
|
const target = targets.find((i) => i.id === link3.targetId);
|
|
25830
25854
|
const prefix2 = label(link3);
|
|
25831
25855
|
if (target) {
|
|
25832
25856
|
console.log(
|
|
25833
|
-
` ${prefix2}${formatItemId(target.id)} ${target.name} ${
|
|
25857
|
+
` ${prefix2}${formatItemId(target.id)} ${target.name} ${chalk115.dim(`(${target.status})`)}`
|
|
25834
25858
|
);
|
|
25835
25859
|
} else {
|
|
25836
25860
|
console.log(
|
|
25837
|
-
` ${prefix2}${formatItemId(link3.targetId)} ${
|
|
25861
|
+
` ${prefix2}${formatItemId(link3.targetId)} ${chalk115.dim("(not found)")}`
|
|
25838
25862
|
);
|
|
25839
25863
|
}
|
|
25840
25864
|
}
|
|
@@ -25851,7 +25875,7 @@ async function printLinks(orm, item) {
|
|
|
25851
25875
|
"Links",
|
|
25852
25876
|
links2.filter((l) => l.type !== "docs-refresh"),
|
|
25853
25877
|
targets,
|
|
25854
|
-
(link3) => `${link3.type === "depends-on" ?
|
|
25878
|
+
(link3) => `${link3.type === "depends-on" ? chalk115.red(link3.type) : chalk115.blue(link3.type)} `
|
|
25855
25879
|
);
|
|
25856
25880
|
printSection(
|
|
25857
25881
|
"Refreshes docs for",
|
|
@@ -25862,18 +25886,18 @@ async function printLinks(orm, item) {
|
|
|
25862
25886
|
}
|
|
25863
25887
|
|
|
25864
25888
|
// src/commands/backlog/show/printPlan.ts
|
|
25865
|
-
import
|
|
25889
|
+
import chalk117 from "chalk";
|
|
25866
25890
|
|
|
25867
25891
|
// src/commands/backlog/show/printPhaseTasks.ts
|
|
25868
|
-
import
|
|
25892
|
+
import chalk116 from "chalk";
|
|
25869
25893
|
function printPhaseTasks(phase) {
|
|
25870
25894
|
for (const task of phase.tasks) {
|
|
25871
25895
|
console.log(` - ${task.task}`);
|
|
25872
25896
|
}
|
|
25873
25897
|
if (phase.manualChecks && phase.manualChecks.length > 0) {
|
|
25874
|
-
console.log(` ${
|
|
25898
|
+
console.log(` ${chalk116.dim("Manual checks:")}`);
|
|
25875
25899
|
for (const check2 of phase.manualChecks) {
|
|
25876
|
-
console.log(` ${
|
|
25900
|
+
console.log(` ${chalk116.dim(`- ${check2}`)}`);
|
|
25877
25901
|
}
|
|
25878
25902
|
}
|
|
25879
25903
|
}
|
|
@@ -25881,16 +25905,16 @@ function printPhaseTasks(phase) {
|
|
|
25881
25905
|
// src/commands/backlog/show/printPlan.ts
|
|
25882
25906
|
function phaseHeader(index3, name2, isCurrent) {
|
|
25883
25907
|
const phaseNumber = index3 + 1;
|
|
25884
|
-
const marker2 = isCurrent ?
|
|
25885
|
-
const label = isCurrent ?
|
|
25908
|
+
const marker2 = isCurrent ? chalk117.green("\u25B6 ") : " ";
|
|
25909
|
+
const label = isCurrent ? chalk117.green.bold(`Phase ${phaseNumber}: ${name2}`) : `${chalk117.bold(`Phase ${phaseNumber}:`)} ${name2}`;
|
|
25886
25910
|
return `${marker2}${label}`;
|
|
25887
25911
|
}
|
|
25888
25912
|
function printPhaseSessions(sessions) {
|
|
25889
25913
|
if (sessions.length === 0) return;
|
|
25890
|
-
console.log(` ${
|
|
25914
|
+
console.log(` ${chalk117.dim("Sessions:")}`);
|
|
25891
25915
|
for (const s of sessions) {
|
|
25892
25916
|
console.log(
|
|
25893
|
-
` ${
|
|
25917
|
+
` ${chalk117.dim(`- ${s.hostname} / ${s.osUser} / ${s.claudeSessionId}`)}`
|
|
25894
25918
|
);
|
|
25895
25919
|
}
|
|
25896
25920
|
}
|
|
@@ -25915,7 +25939,7 @@ function printPlan(item) {
|
|
|
25915
25939
|
if (!item.plan || item.plan.length === 0) return;
|
|
25916
25940
|
const plan2 = item.plan;
|
|
25917
25941
|
const reviewIdx = reviewPhaseIndex(plan2);
|
|
25918
|
-
console.log(
|
|
25942
|
+
console.log(chalk117.bold("Plan"));
|
|
25919
25943
|
for (const [i, phase] of plan2.entries()) {
|
|
25920
25944
|
const isCurrent = item.currentPhase === i + 1;
|
|
25921
25945
|
const sessions = (item.phaseSessions ?? []).filter(
|
|
@@ -25929,23 +25953,23 @@ function printPlan(item) {
|
|
|
25929
25953
|
|
|
25930
25954
|
// src/commands/backlog/show.ts
|
|
25931
25955
|
function printHeader(item) {
|
|
25932
|
-
console.log(
|
|
25956
|
+
console.log(chalk118.bold(`${formatItemId(item.id)} ${item.name}`));
|
|
25933
25957
|
console.log(
|
|
25934
|
-
`${
|
|
25958
|
+
`${chalk118.dim("Type:")} ${item.type} ${chalk118.dim("Status:")} ${item.status}`
|
|
25935
25959
|
);
|
|
25936
25960
|
if (item.jiraKey) {
|
|
25937
|
-
console.log(`${
|
|
25961
|
+
console.log(`${chalk118.dim("Jira:")} ${item.jiraKey}`);
|
|
25938
25962
|
}
|
|
25939
25963
|
if (item.githubIssue) {
|
|
25940
25964
|
console.log(
|
|
25941
|
-
`${
|
|
25965
|
+
`${chalk118.dim("GitHub:")} ${shortenGithubIssue(item.githubIssue, item.origin)}`
|
|
25942
25966
|
);
|
|
25943
25967
|
}
|
|
25944
25968
|
console.log();
|
|
25945
25969
|
}
|
|
25946
25970
|
function printAcceptanceCriteria(criteria) {
|
|
25947
25971
|
if (criteria.length === 0) return;
|
|
25948
|
-
console.log(
|
|
25972
|
+
console.log(chalk118.bold("Acceptance Criteria"));
|
|
25949
25973
|
for (const [i, ac] of criteria.entries()) {
|
|
25950
25974
|
console.log(` ${i + 1}. ${ac}`);
|
|
25951
25975
|
}
|
|
@@ -25954,7 +25978,7 @@ function printAcceptanceCriteria(criteria) {
|
|
|
25954
25978
|
function printComments(item) {
|
|
25955
25979
|
const entries = item.comments ?? [];
|
|
25956
25980
|
if (entries.length === 0) return;
|
|
25957
|
-
console.log(
|
|
25981
|
+
console.log(chalk118.bold("Comments"));
|
|
25958
25982
|
for (const entry of entries) {
|
|
25959
25983
|
console.log(` ${formatComment(entry)}`);
|
|
25960
25984
|
}
|
|
@@ -25966,7 +25990,7 @@ async function show(id, options2 = {}) {
|
|
|
25966
25990
|
const { orm, item } = found;
|
|
25967
25991
|
printHeader(item);
|
|
25968
25992
|
if (item.description) {
|
|
25969
|
-
console.log(
|
|
25993
|
+
console.log(chalk118.bold("Description"));
|
|
25970
25994
|
console.log(renderMarkdownTerminal(item.description));
|
|
25971
25995
|
console.log();
|
|
25972
25996
|
}
|
|
@@ -27464,11 +27488,11 @@ function assertCliExists(cli) {
|
|
|
27464
27488
|
}
|
|
27465
27489
|
|
|
27466
27490
|
// src/commands/permitCliReads/colorize.ts
|
|
27467
|
-
import
|
|
27491
|
+
import chalk119 from "chalk";
|
|
27468
27492
|
function colorize(plainOutput) {
|
|
27469
27493
|
return plainOutput.split("\n").map((line) => {
|
|
27470
|
-
if (line.startsWith(" R ")) return
|
|
27471
|
-
if (line.startsWith(" W ")) return
|
|
27494
|
+
if (line.startsWith(" R ")) return chalk119.green(line);
|
|
27495
|
+
if (line.startsWith(" W ")) return chalk119.red(line);
|
|
27472
27496
|
return line;
|
|
27473
27497
|
}).join("\n");
|
|
27474
27498
|
}
|
|
@@ -27761,7 +27785,7 @@ async function permitCliReads(cli, options2 = { noCache: false }) {
|
|
|
27761
27785
|
}
|
|
27762
27786
|
|
|
27763
27787
|
// src/commands/deny/denyAdd.ts
|
|
27764
|
-
import
|
|
27788
|
+
import chalk120 from "chalk";
|
|
27765
27789
|
|
|
27766
27790
|
// src/commands/deny/loadDenyConfig.ts
|
|
27767
27791
|
function loadDenyConfig(global) {
|
|
@@ -27781,16 +27805,16 @@ function loadDenyConfig(global) {
|
|
|
27781
27805
|
function denyAdd(pattern2, message4, options2) {
|
|
27782
27806
|
const { deny: deny2, saveDeny } = loadDenyConfig(options2.node);
|
|
27783
27807
|
if (deny2.some((r) => r.pattern === pattern2)) {
|
|
27784
|
-
console.log(
|
|
27808
|
+
console.log(chalk120.yellow(`Deny rule already exists for: ${pattern2}`));
|
|
27785
27809
|
return;
|
|
27786
27810
|
}
|
|
27787
27811
|
deny2.push({ pattern: pattern2, message: message4 });
|
|
27788
27812
|
saveDeny(deny2);
|
|
27789
|
-
console.log(
|
|
27813
|
+
console.log(chalk120.green(`Added deny rule: ${pattern2} \u2192 ${message4}`));
|
|
27790
27814
|
}
|
|
27791
27815
|
|
|
27792
27816
|
// src/commands/deny/denyList.ts
|
|
27793
|
-
import
|
|
27817
|
+
import chalk121 from "chalk";
|
|
27794
27818
|
function denyList() {
|
|
27795
27819
|
const globalRaw = loadGlobalConfigRaw();
|
|
27796
27820
|
const projectRaw = loadProjectConfig();
|
|
@@ -27801,7 +27825,7 @@ function denyList() {
|
|
|
27801
27825
|
projectDeny.length > 0 ? projectDeny : void 0
|
|
27802
27826
|
);
|
|
27803
27827
|
if (!merged || merged.length === 0) {
|
|
27804
|
-
console.log(
|
|
27828
|
+
console.log(chalk121.dim("No deny rules configured."));
|
|
27805
27829
|
return;
|
|
27806
27830
|
}
|
|
27807
27831
|
const projectPatterns = new Set(projectDeny.map((r) => r.pattern));
|
|
@@ -27809,23 +27833,23 @@ function denyList() {
|
|
|
27809
27833
|
for (const rule of merged) {
|
|
27810
27834
|
const inProject = projectPatterns.has(rule.pattern);
|
|
27811
27835
|
const inGlobal = globalPatterns.has(rule.pattern);
|
|
27812
|
-
const label = inProject && inGlobal ?
|
|
27813
|
-
console.log(`${
|
|
27836
|
+
const label = inProject && inGlobal ? chalk121.dim(" (project, overrides global)") : inGlobal ? chalk121.dim(" (global)") : "";
|
|
27837
|
+
console.log(`${chalk121.red(rule.pattern)} \u2192 ${rule.message}${label}`);
|
|
27814
27838
|
}
|
|
27815
27839
|
}
|
|
27816
27840
|
|
|
27817
27841
|
// src/commands/deny/denyRemove.ts
|
|
27818
|
-
import
|
|
27842
|
+
import chalk122 from "chalk";
|
|
27819
27843
|
function denyRemove(pattern2, options2) {
|
|
27820
27844
|
const { deny: deny2, saveDeny } = loadDenyConfig(options2.node);
|
|
27821
27845
|
const index3 = deny2.findIndex((r) => r.pattern === pattern2);
|
|
27822
27846
|
if (index3 === -1) {
|
|
27823
|
-
console.log(
|
|
27847
|
+
console.log(chalk122.yellow(`No deny rule found for: ${pattern2}`));
|
|
27824
27848
|
return;
|
|
27825
27849
|
}
|
|
27826
27850
|
deny2.splice(index3, 1);
|
|
27827
27851
|
saveDeny(deny2.length > 0 ? deny2 : void 0);
|
|
27828
|
-
console.log(
|
|
27852
|
+
console.log(chalk122.green(`Removed deny rule: ${pattern2}`));
|
|
27829
27853
|
}
|
|
27830
27854
|
|
|
27831
27855
|
// src/commands/registerDeny.ts
|
|
@@ -27858,7 +27882,7 @@ function registerCliHook(program) {
|
|
|
27858
27882
|
|
|
27859
27883
|
// src/commands/codeComment/codeCommentConfirm.ts
|
|
27860
27884
|
import { existsSync as existsSync60, readFileSync as readFileSync43, unlinkSync as unlinkSync9, writeFileSync as writeFileSync30 } from "fs";
|
|
27861
|
-
import
|
|
27885
|
+
import chalk123 from "chalk";
|
|
27862
27886
|
|
|
27863
27887
|
// src/shared/isHashCommentFile.ts
|
|
27864
27888
|
import path35 from "path";
|
|
@@ -27930,12 +27954,12 @@ function codeCommentConfirm(pin2) {
|
|
|
27930
27954
|
sweepRestrictedDir();
|
|
27931
27955
|
const state = readPinState(pin2);
|
|
27932
27956
|
if (!state) {
|
|
27933
|
-
console.error(
|
|
27957
|
+
console.error(chalk123.red(`No pending comment for pin: ${pin2}`));
|
|
27934
27958
|
process.exitCode = 1;
|
|
27935
27959
|
return;
|
|
27936
27960
|
}
|
|
27937
27961
|
if (!existsSync60(state.file)) {
|
|
27938
|
-
console.error(
|
|
27962
|
+
console.error(chalk123.red(`Target file no longer exists: ${state.file}`));
|
|
27939
27963
|
process.exitCode = 1;
|
|
27940
27964
|
return;
|
|
27941
27965
|
}
|
|
@@ -27944,7 +27968,7 @@ function codeCommentConfirm(pin2) {
|
|
|
27944
27968
|
const index3 = state.line - 1;
|
|
27945
27969
|
if (index3 > lines.length) {
|
|
27946
27970
|
console.error(
|
|
27947
|
-
|
|
27971
|
+
chalk123.red(
|
|
27948
27972
|
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
27949
27973
|
)
|
|
27950
27974
|
);
|
|
@@ -27958,14 +27982,14 @@ function codeCommentConfirm(pin2) {
|
|
|
27958
27982
|
writeFileSync30(state.file, lines.join("\n"));
|
|
27959
27983
|
unlinkSync9(getPinStatePath(pin2));
|
|
27960
27984
|
console.log(
|
|
27961
|
-
|
|
27985
|
+
chalk123.green(
|
|
27962
27986
|
`Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
|
|
27963
27987
|
)
|
|
27964
27988
|
);
|
|
27965
27989
|
}
|
|
27966
27990
|
|
|
27967
27991
|
// src/commands/codeComment/codeCommentSet.ts
|
|
27968
|
-
import
|
|
27992
|
+
import chalk124 from "chalk";
|
|
27969
27993
|
|
|
27970
27994
|
// src/commands/codeComment/validateCommentText.ts
|
|
27971
27995
|
var MAX_COMMENT_LENGTH = 50;
|
|
@@ -28099,7 +28123,7 @@ function generatePin() {
|
|
|
28099
28123
|
async function codeCommentSet(file, line, text19) {
|
|
28100
28124
|
const lineNumber = Number.parseInt(line, 10);
|
|
28101
28125
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
28102
|
-
console.error(
|
|
28126
|
+
console.error(chalk124.red(`Invalid line number: ${line}`));
|
|
28103
28127
|
process.exitCode = 1;
|
|
28104
28128
|
return;
|
|
28105
28129
|
}
|
|
@@ -28107,20 +28131,20 @@ async function codeCommentSet(file, line, text19) {
|
|
|
28107
28131
|
const marker2 = hash ? "#" : "//";
|
|
28108
28132
|
const validation = validateCommentText(text19, hash);
|
|
28109
28133
|
if (!validation.ok) {
|
|
28110
|
-
console.error(
|
|
28111
|
-
console.error(
|
|
28134
|
+
console.error(chalk124.red(`Refused: ${validation.reason}`));
|
|
28135
|
+
console.error(chalk124.red("No pin issued."));
|
|
28112
28136
|
process.exitCode = 1;
|
|
28113
28137
|
return;
|
|
28114
28138
|
}
|
|
28115
28139
|
console.error(
|
|
28116
|
-
|
|
28140
|
+
chalk124.yellow.bold(
|
|
28117
28141
|
"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."
|
|
28118
28142
|
)
|
|
28119
28143
|
);
|
|
28120
28144
|
const { delivered, node } = await issuePin(file, lineNumber, validation.text);
|
|
28121
28145
|
if (!delivered) {
|
|
28122
28146
|
console.error(
|
|
28123
|
-
|
|
28147
|
+
chalk124.red(
|
|
28124
28148
|
"Could not deliver the confirmation pin via notification.\nThe comment cannot be confirmed until the notification channel works."
|
|
28125
28149
|
)
|
|
28126
28150
|
);
|
|
@@ -28130,7 +28154,7 @@ async function codeCommentSet(file, line, text19) {
|
|
|
28130
28154
|
console.log(
|
|
28131
28155
|
`A confirmation pin was sent to your desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
28132
28156
|
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run in this session:
|
|
28133
|
-
${
|
|
28157
|
+
${chalk124.cyan(" assist code-comment confirm <PIN>")}
|
|
28134
28158
|
using the pin from that notification.`
|
|
28135
28159
|
);
|
|
28136
28160
|
}
|
|
@@ -28609,7 +28633,7 @@ function buildCommitMessage(subject, refs) {
|
|
|
28609
28633
|
|
|
28610
28634
|
// src/shared/warnIfUnexpectedBranch.ts
|
|
28611
28635
|
import { execSync as execSync26 } from "child_process";
|
|
28612
|
-
import
|
|
28636
|
+
import chalk125 from "chalk";
|
|
28613
28637
|
|
|
28614
28638
|
// src/shared/upstreamBranch.ts
|
|
28615
28639
|
import { execSync as execSync25 } from "child_process";
|
|
@@ -28635,7 +28659,7 @@ function warnIfUnexpectedBranch(config) {
|
|
|
28635
28659
|
if (upstreamBranch() === expected) return;
|
|
28636
28660
|
const line = "\u2500".repeat(64);
|
|
28637
28661
|
console.warn(
|
|
28638
|
-
|
|
28662
|
+
chalk125.yellow.bold(
|
|
28639
28663
|
[
|
|
28640
28664
|
"",
|
|
28641
28665
|
line,
|
|
@@ -29137,15 +29161,15 @@ function registerCommit(program) {
|
|
|
29137
29161
|
}
|
|
29138
29162
|
|
|
29139
29163
|
// src/commands/complexity/analyze.ts
|
|
29140
|
-
import
|
|
29164
|
+
import chalk134 from "chalk";
|
|
29141
29165
|
|
|
29142
29166
|
// src/commands/complexity/cyclomatic.ts
|
|
29143
|
-
import
|
|
29167
|
+
import chalk127 from "chalk";
|
|
29144
29168
|
|
|
29145
29169
|
// src/commands/complexity/shared.ts
|
|
29146
29170
|
import fs27 from "fs";
|
|
29147
29171
|
import path41 from "path";
|
|
29148
|
-
import
|
|
29172
|
+
import chalk126 from "chalk";
|
|
29149
29173
|
import ts5 from "typescript";
|
|
29150
29174
|
|
|
29151
29175
|
// src/commands/complexity/findSourceFiles.ts
|
|
@@ -29401,7 +29425,7 @@ function createSourceFromFile(filePath) {
|
|
|
29401
29425
|
function withSourceFiles(pattern2, callback, extraIgnore = []) {
|
|
29402
29426
|
const files = findSourceFiles(pattern2, ".", extraIgnore);
|
|
29403
29427
|
if (files.length === 0) {
|
|
29404
|
-
console.log(
|
|
29428
|
+
console.log(chalk126.yellow("No files found matching pattern"));
|
|
29405
29429
|
return void 0;
|
|
29406
29430
|
}
|
|
29407
29431
|
return callback(files);
|
|
@@ -29434,11 +29458,11 @@ async function cyclomatic(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
29434
29458
|
results.sort((a, b) => b.complexity - a.complexity);
|
|
29435
29459
|
for (const { file, name: name2, complexity } of results) {
|
|
29436
29460
|
const exceedsThreshold = options2.threshold !== void 0 && complexity > options2.threshold;
|
|
29437
|
-
const color = exceedsThreshold ?
|
|
29438
|
-
console.log(`${color(`${file}:${name2}`)} \u2192 ${
|
|
29461
|
+
const color = exceedsThreshold ? chalk127.red : chalk127.white;
|
|
29462
|
+
console.log(`${color(`${file}:${name2}`)} \u2192 ${chalk127.cyan(complexity)}`);
|
|
29439
29463
|
}
|
|
29440
29464
|
console.log(
|
|
29441
|
-
|
|
29465
|
+
chalk127.dim(
|
|
29442
29466
|
`
|
|
29443
29467
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
29444
29468
|
)
|
|
@@ -29450,7 +29474,7 @@ Analyzed ${results.length} functions across ${files.length} files`
|
|
|
29450
29474
|
}
|
|
29451
29475
|
|
|
29452
29476
|
// src/commands/complexity/halstead.ts
|
|
29453
|
-
import
|
|
29477
|
+
import chalk128 from "chalk";
|
|
29454
29478
|
async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
29455
29479
|
withSourceFiles(pattern2, (files) => {
|
|
29456
29480
|
const results = [];
|
|
@@ -29465,13 +29489,13 @@ async function halstead(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
29465
29489
|
results.sort((a, b) => b.metrics.effort - a.metrics.effort);
|
|
29466
29490
|
for (const { file, name: name2, metrics } of results) {
|
|
29467
29491
|
const exceedsThreshold = options2.threshold !== void 0 && metrics.volume > options2.threshold;
|
|
29468
|
-
const color = exceedsThreshold ?
|
|
29492
|
+
const color = exceedsThreshold ? chalk128.red : chalk128.white;
|
|
29469
29493
|
console.log(
|
|
29470
|
-
`${color(`${file}:${name2}`)} \u2192 volume: ${
|
|
29494
|
+
`${color(`${file}:${name2}`)} \u2192 volume: ${chalk128.cyan(metrics.volume.toFixed(1))}, difficulty: ${chalk128.yellow(metrics.difficulty.toFixed(1))}, effort: ${chalk128.magenta(metrics.effort.toFixed(1))}`
|
|
29471
29495
|
);
|
|
29472
29496
|
}
|
|
29473
29497
|
console.log(
|
|
29474
|
-
|
|
29498
|
+
chalk128.dim(
|
|
29475
29499
|
`
|
|
29476
29500
|
Analyzed ${results.length} functions across ${files.length} files`
|
|
29477
29501
|
)
|
|
@@ -29557,15 +29581,15 @@ function collectFileMetrics(files) {
|
|
|
29557
29581
|
}
|
|
29558
29582
|
|
|
29559
29583
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
29560
|
-
import
|
|
29584
|
+
import chalk132 from "chalk";
|
|
29561
29585
|
|
|
29562
29586
|
// src/commands/complexity/maintainability/formatResultLine.ts
|
|
29563
|
-
import
|
|
29587
|
+
import chalk129 from "chalk";
|
|
29564
29588
|
function formatResultLine(entry, failing) {
|
|
29565
29589
|
const { file, avgMaintainability, minMaintainability, override } = entry;
|
|
29566
|
-
const name2 = failing ?
|
|
29567
|
-
const suffix = override !== void 0 ?
|
|
29568
|
-
return `${name2} \u2192 avg: ${
|
|
29590
|
+
const name2 = failing ? chalk129.red(file) : chalk129.white(file);
|
|
29591
|
+
const suffix = override !== void 0 ? chalk129.magenta(` (override: ${override})`) : "";
|
|
29592
|
+
return `${name2} \u2192 avg: ${chalk129.cyan(avgMaintainability.toFixed(1))}, min: ${chalk129.yellow(minMaintainability.toFixed(1))}${suffix}`;
|
|
29569
29593
|
}
|
|
29570
29594
|
|
|
29571
29595
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
@@ -29616,38 +29640,38 @@ function getMaintainabilityGitState() {
|
|
|
29616
29640
|
|
|
29617
29641
|
// src/commands/complexity/maintainability/printMaintainabilityFailure.ts
|
|
29618
29642
|
import path43 from "path";
|
|
29619
|
-
import
|
|
29643
|
+
import chalk130 from "chalk";
|
|
29620
29644
|
var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
|
|
29621
29645
|
function remediationLine(entry) {
|
|
29622
|
-
return ` ${
|
|
29646
|
+
return ` ${chalk130.bold(entry.file)}
|
|
29623
29647
|
Pick a responsibility and extract it:
|
|
29624
|
-
${
|
|
29648
|
+
${chalk130.cyan(extractTemplate)}`;
|
|
29625
29649
|
}
|
|
29626
29650
|
function cheatLine(entry, gitState) {
|
|
29627
29651
|
const shrank = gitState.shrunkFiles.has(path43.resolve(entry.file));
|
|
29628
29652
|
if (!shrank || gitState.newFileCreated) return "";
|
|
29629
29653
|
return `
|
|
29630
|
-
${
|
|
29654
|
+
${chalk130.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.")}`;
|
|
29631
29655
|
}
|
|
29632
29656
|
function printMaintainabilityFailure(failing, gitState) {
|
|
29633
29657
|
const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
|
|
29634
29658
|
console.error(
|
|
29635
|
-
|
|
29659
|
+
chalk130.red(
|
|
29636
29660
|
`
|
|
29637
29661
|
Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
|
|
29638
29662
|
|
|
29639
29663
|
${blocks}
|
|
29640
29664
|
|
|
29641
|
-
${
|
|
29665
|
+
${chalk130.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.`
|
|
29642
29666
|
)
|
|
29643
29667
|
);
|
|
29644
29668
|
}
|
|
29645
29669
|
|
|
29646
29670
|
// src/commands/complexity/maintainability/printMaintainabilityFormula.ts
|
|
29647
|
-
import
|
|
29671
|
+
import chalk131 from "chalk";
|
|
29648
29672
|
var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
|
|
29649
29673
|
function printMaintainabilityFormula() {
|
|
29650
|
-
console.log(
|
|
29674
|
+
console.log(chalk131.dim(MI_FORMULA));
|
|
29651
29675
|
}
|
|
29652
29676
|
|
|
29653
29677
|
// src/commands/complexity/maintainability/displayMaintainabilityResults.ts
|
|
@@ -29656,7 +29680,7 @@ function displayMaintainabilityResults(results, threshold, gitState = getMaintai
|
|
|
29656
29680
|
if (!gating) {
|
|
29657
29681
|
printMaintainabilityFormula();
|
|
29658
29682
|
for (const entry of results) console.log(formatResultLine(entry, false));
|
|
29659
|
-
console.log(
|
|
29683
|
+
console.log(chalk132.dim(`
|
|
29660
29684
|
Analyzed ${results.length} files`));
|
|
29661
29685
|
return;
|
|
29662
29686
|
}
|
|
@@ -29665,14 +29689,14 @@ Analyzed ${results.length} files`));
|
|
|
29665
29689
|
return limit !== void 0 && r.minMaintainability < limit;
|
|
29666
29690
|
});
|
|
29667
29691
|
if (failing.length === 0) {
|
|
29668
|
-
console.log(
|
|
29692
|
+
console.log(chalk132.green("All files pass maintainability threshold"));
|
|
29669
29693
|
}
|
|
29670
29694
|
const passingOverrides = results.filter(
|
|
29671
29695
|
(r) => r.override !== void 0 && !failing.includes(r)
|
|
29672
29696
|
);
|
|
29673
29697
|
for (const entry of passingOverrides)
|
|
29674
29698
|
console.log(formatResultLine(entry, false));
|
|
29675
|
-
console.log(
|
|
29699
|
+
console.log(chalk132.dim(`
|
|
29676
29700
|
Analyzed ${results.length} files`));
|
|
29677
29701
|
if (failing.length > 0) {
|
|
29678
29702
|
printMaintainabilityFailure(failing, gitState);
|
|
@@ -29695,7 +29719,7 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
29695
29719
|
|
|
29696
29720
|
// src/commands/complexity/sloc.ts
|
|
29697
29721
|
import fs29 from "fs";
|
|
29698
|
-
import
|
|
29722
|
+
import chalk133 from "chalk";
|
|
29699
29723
|
async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
29700
29724
|
withSourceFiles(pattern2, (files) => {
|
|
29701
29725
|
const results = [];
|
|
@@ -29711,12 +29735,12 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
29711
29735
|
results.sort((a, b) => b.lines - a.lines);
|
|
29712
29736
|
for (const { file, lines } of results) {
|
|
29713
29737
|
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
29714
|
-
const color = exceedsThreshold ?
|
|
29715
|
-
console.log(`${color(file)} \u2192 ${
|
|
29738
|
+
const color = exceedsThreshold ? chalk133.red : chalk133.white;
|
|
29739
|
+
console.log(`${color(file)} \u2192 ${chalk133.cyan(lines)} lines`);
|
|
29716
29740
|
}
|
|
29717
29741
|
const total2 = results.reduce((sum3, r) => sum3 + r.lines, 0);
|
|
29718
29742
|
console.log(
|
|
29719
|
-
|
|
29743
|
+
chalk133.dim(`
|
|
29720
29744
|
Total: ${total2} lines across ${files.length} files`)
|
|
29721
29745
|
);
|
|
29722
29746
|
if (hasViolation) {
|
|
@@ -29730,25 +29754,25 @@ async function analyze(pattern2) {
|
|
|
29730
29754
|
const searchPattern = pattern2.includes("*") || pattern2.includes("/") ? pattern2 : `**/${pattern2}`;
|
|
29731
29755
|
const files = findSourceFiles(searchPattern);
|
|
29732
29756
|
if (files.length === 0) {
|
|
29733
|
-
console.log(
|
|
29757
|
+
console.log(chalk134.yellow("No files found matching pattern"));
|
|
29734
29758
|
return;
|
|
29735
29759
|
}
|
|
29736
29760
|
if (files.length === 1) {
|
|
29737
29761
|
const file = files[0];
|
|
29738
|
-
console.log(
|
|
29762
|
+
console.log(chalk134.bold.underline("SLOC"));
|
|
29739
29763
|
await sloc(file);
|
|
29740
29764
|
console.log();
|
|
29741
|
-
console.log(
|
|
29765
|
+
console.log(chalk134.bold.underline("Cyclomatic Complexity"));
|
|
29742
29766
|
await cyclomatic(file);
|
|
29743
29767
|
console.log();
|
|
29744
|
-
console.log(
|
|
29768
|
+
console.log(chalk134.bold.underline("Halstead Metrics"));
|
|
29745
29769
|
await halstead(file);
|
|
29746
29770
|
console.log();
|
|
29747
|
-
console.log(
|
|
29771
|
+
console.log(chalk134.bold.underline("Maintainability Index"));
|
|
29748
29772
|
await maintainability(file);
|
|
29749
29773
|
console.log();
|
|
29750
29774
|
console.log(
|
|
29751
|
-
|
|
29775
|
+
chalk134.dim(
|
|
29752
29776
|
"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."
|
|
29753
29777
|
)
|
|
29754
29778
|
);
|
|
@@ -29783,7 +29807,7 @@ function registerComplexity(program) {
|
|
|
29783
29807
|
}
|
|
29784
29808
|
|
|
29785
29809
|
// src/commands/configList.ts
|
|
29786
|
-
import
|
|
29810
|
+
import chalk135 from "chalk";
|
|
29787
29811
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
29788
29812
|
async function configList() {
|
|
29789
29813
|
const config = maskConfigSecrets(
|
|
@@ -29791,7 +29815,7 @@ async function configList() {
|
|
|
29791
29815
|
describeConfigNode(assistConfigSchema)
|
|
29792
29816
|
);
|
|
29793
29817
|
console.log(
|
|
29794
|
-
|
|
29818
|
+
chalk135.dim(
|
|
29795
29819
|
"# Only the keys that are set; run assist config keys for every key and its default"
|
|
29796
29820
|
)
|
|
29797
29821
|
);
|
|
@@ -29799,7 +29823,7 @@ async function configList() {
|
|
|
29799
29823
|
}
|
|
29800
29824
|
|
|
29801
29825
|
// src/commands/config/configGet.ts
|
|
29802
|
-
import
|
|
29826
|
+
import chalk136 from "chalk";
|
|
29803
29827
|
|
|
29804
29828
|
// src/commands/config/formatConfigDefault.ts
|
|
29805
29829
|
function formatConfigDefault(leaf) {
|
|
@@ -29837,7 +29861,7 @@ function printUnset(key) {
|
|
|
29837
29861
|
(candidate) => candidate.key === key
|
|
29838
29862
|
);
|
|
29839
29863
|
if (!leaf) {
|
|
29840
|
-
console.error(
|
|
29864
|
+
console.error(chalk136.red(`Key "${key}" is not set`));
|
|
29841
29865
|
process.exit(1);
|
|
29842
29866
|
}
|
|
29843
29867
|
console.log(
|
|
@@ -29845,16 +29869,16 @@ function printUnset(key) {
|
|
|
29845
29869
|
);
|
|
29846
29870
|
const help = configHelpForKey(key);
|
|
29847
29871
|
if (help) console.log(`${help.note}
|
|
29848
|
-
${
|
|
29872
|
+
${chalk136.green(help.setter)}`);
|
|
29849
29873
|
}
|
|
29850
29874
|
|
|
29851
29875
|
// src/commands/config/configImportRepos.ts
|
|
29852
|
-
import
|
|
29876
|
+
import chalk140 from "chalk";
|
|
29853
29877
|
|
|
29854
29878
|
// src/commands/config/exitWithConfigErrors.ts
|
|
29855
|
-
import
|
|
29879
|
+
import chalk137 from "chalk";
|
|
29856
29880
|
function exitWithConfigErrors(errors) {
|
|
29857
|
-
for (const error of errors) console.error(
|
|
29881
|
+
for (const error of errors) console.error(chalk137.red(error));
|
|
29858
29882
|
process.exit(1);
|
|
29859
29883
|
}
|
|
29860
29884
|
|
|
@@ -29910,27 +29934,27 @@ function isPlainObject5(value) {
|
|
|
29910
29934
|
}
|
|
29911
29935
|
|
|
29912
29936
|
// src/commands/config/printRepoConfigImportPlan.ts
|
|
29913
|
-
import
|
|
29937
|
+
import chalk139 from "chalk";
|
|
29914
29938
|
|
|
29915
29939
|
// src/commands/config/formatConfigLeafChange.ts
|
|
29916
|
-
import
|
|
29940
|
+
import chalk138 from "chalk";
|
|
29917
29941
|
function show2(key, value) {
|
|
29918
29942
|
return JSON.stringify(maskConfigKeySecrets(key, value));
|
|
29919
29943
|
}
|
|
29920
29944
|
function formatConfigLeafChange(change) {
|
|
29921
29945
|
const to = show2(change.key, change.to);
|
|
29922
|
-
return "from" in change ?
|
|
29946
|
+
return "from" in change ? chalk138.yellow(
|
|
29923
29947
|
` ~ ${change.key}: ${show2(change.key, change.from)} \u2192 ${to}`
|
|
29924
|
-
) :
|
|
29948
|
+
) : chalk138.green(` + ${change.key}: ${to}`);
|
|
29925
29949
|
}
|
|
29926
29950
|
|
|
29927
29951
|
// src/commands/config/printRepoConfigImportPlan.ts
|
|
29928
29952
|
function printRepoConfigImportPlan(plans) {
|
|
29929
29953
|
for (const plan2 of plans) {
|
|
29930
|
-
const target = plan2.dbKey === plan2.ymlKey ? "" :
|
|
29931
|
-
console.log(
|
|
29954
|
+
const target = plan2.dbKey === plan2.ymlKey ? "" : chalk139.dim(` \u2192 ${plan2.dbKey}`);
|
|
29955
|
+
console.log(chalk139.bold(`repos.${plan2.ymlKey}${target}`));
|
|
29932
29956
|
if (plan2.changes.length === 0)
|
|
29933
|
-
console.log(
|
|
29957
|
+
console.log(chalk139.dim(" already in the shared db"));
|
|
29934
29958
|
for (const change of plan2.changes)
|
|
29935
29959
|
console.log(formatConfigLeafChange(change));
|
|
29936
29960
|
}
|
|
@@ -29963,7 +29987,7 @@ async function configImportRepos() {
|
|
|
29963
29987
|
saveGlobalConfig(rest);
|
|
29964
29988
|
const keys = changed.reduce((n, plan2) => n + plan2.changes.length, 0);
|
|
29965
29989
|
console.log(
|
|
29966
|
-
|
|
29990
|
+
chalk140.green(
|
|
29967
29991
|
`Imported ${keys} key(s) across ${changed.length} repo(s) and removed repos: from ~/.assist.yml`
|
|
29968
29992
|
)
|
|
29969
29993
|
);
|
|
@@ -29973,7 +29997,7 @@ function isPlainObject6(value) {
|
|
|
29973
29997
|
}
|
|
29974
29998
|
|
|
29975
29999
|
// src/commands/config/configImportUser.ts
|
|
29976
|
-
import
|
|
30000
|
+
import chalk142 from "chalk";
|
|
29977
30001
|
|
|
29978
30002
|
// src/commands/config/planValue.ts
|
|
29979
30003
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
|
|
@@ -30035,14 +30059,14 @@ function planUserConfigImport(ymlRaw, userDb, keys) {
|
|
|
30035
30059
|
}
|
|
30036
30060
|
|
|
30037
30061
|
// src/commands/config/printUserConfigImportPlan.ts
|
|
30038
|
-
import
|
|
30062
|
+
import chalk141 from "chalk";
|
|
30039
30063
|
function printUserConfigImportPlan(plan2) {
|
|
30040
|
-
console.log(
|
|
30064
|
+
console.log(chalk141.bold("~/.assist.yml \u2192 user (db)"));
|
|
30041
30065
|
for (const key of plan2.missing)
|
|
30042
|
-
console.log(
|
|
30066
|
+
console.log(chalk141.dim(` ${key}: not in ~/.assist.yml`));
|
|
30043
30067
|
if (plan2.imported.length > 0 && plan2.changes.length === 0)
|
|
30044
30068
|
console.log(
|
|
30045
|
-
|
|
30069
|
+
chalk141.dim(` ${plan2.imported.join(", ")}: already in user (db)`)
|
|
30046
30070
|
);
|
|
30047
30071
|
for (const change of plan2.changes)
|
|
30048
30072
|
console.log(formatConfigLeafChange(change));
|
|
@@ -30082,24 +30106,24 @@ async function configImportUser(keys) {
|
|
|
30082
30106
|
)
|
|
30083
30107
|
);
|
|
30084
30108
|
console.log(
|
|
30085
|
-
|
|
30109
|
+
chalk142.green(
|
|
30086
30110
|
`Imported ${plan2.imported.join(", ")} into user (db) and removed it from ~/.assist.yml`
|
|
30087
30111
|
)
|
|
30088
30112
|
);
|
|
30089
30113
|
}
|
|
30090
30114
|
|
|
30091
30115
|
// src/commands/config/configKeys.ts
|
|
30092
|
-
import
|
|
30116
|
+
import chalk143 from "chalk";
|
|
30093
30117
|
function configKeys(filter) {
|
|
30094
30118
|
const leaves2 = describeConfigLeaves(assistConfigSchema);
|
|
30095
30119
|
const matches = filter ? leaves2.filter(matching(filter)) : leaves2;
|
|
30096
30120
|
if (matches.length === 0) {
|
|
30097
|
-
console.error(
|
|
30121
|
+
console.error(chalk143.red(`No config key matches "${filter}"`));
|
|
30098
30122
|
process.exit(1);
|
|
30099
30123
|
}
|
|
30100
30124
|
console.log(headline(matches.length, leaves2.length, filter));
|
|
30101
30125
|
console.log(
|
|
30102
|
-
|
|
30126
|
+
chalk143.dim(
|
|
30103
30127
|
"Defaults come from the schema; assist config list shows what is set."
|
|
30104
30128
|
)
|
|
30105
30129
|
);
|
|
@@ -30115,13 +30139,13 @@ function matching(filter) {
|
|
|
30115
30139
|
return (leaf) => leaf.key.toLowerCase().includes(needle);
|
|
30116
30140
|
}
|
|
30117
30141
|
function headline(shown, total2, filter) {
|
|
30118
|
-
return filter ?
|
|
30142
|
+
return filter ? chalk143.bold(`${shown} of ${total2} config keys matching "${filter}"`) : chalk143.bold(`${total2} config keys`);
|
|
30119
30143
|
}
|
|
30120
30144
|
function formatLeaf(leaf, help) {
|
|
30121
30145
|
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
30122
30146
|
if (leaf.secret) meta.push("secret");
|
|
30123
|
-
const lines = [`${
|
|
30124
|
-
if (help) lines.push(` ${help.note}`, ` ${
|
|
30147
|
+
const lines = [`${chalk143.cyan(leaf.key)} ${chalk143.dim(meta.join(" "))}`];
|
|
30148
|
+
if (help) lines.push(` ${help.note}`, ` ${chalk143.green(help.setter)}`);
|
|
30125
30149
|
return lines;
|
|
30126
30150
|
}
|
|
30127
30151
|
function typeText(leaf) {
|
|
@@ -30132,7 +30156,7 @@ function typeText(leaf) {
|
|
|
30132
30156
|
}
|
|
30133
30157
|
|
|
30134
30158
|
// src/commands/config/configSet.ts
|
|
30135
|
-
import
|
|
30159
|
+
import chalk146 from "chalk";
|
|
30136
30160
|
|
|
30137
30161
|
// src/commands/config/coerceCliConfigValue.ts
|
|
30138
30162
|
function coerceCliConfigValue(key, raw) {
|
|
@@ -30174,19 +30198,19 @@ function resolveRepoTarget(key, value, repo) {
|
|
|
30174
30198
|
}
|
|
30175
30199
|
|
|
30176
30200
|
// src/commands/config/setDbBackedConfigKey.ts
|
|
30177
|
-
import
|
|
30201
|
+
import chalk144 from "chalk";
|
|
30178
30202
|
async function setDbBackedConfigKey(key, value, useRepo) {
|
|
30179
30203
|
if (useRepo) exitWithConfigErrors([dbBackedRepoError(key)]);
|
|
30180
30204
|
await dbBackedConfigKeys[key].write(await getDb(), value);
|
|
30181
|
-
console.log(
|
|
30205
|
+
console.log(chalk144.green(`Set ${key} = ${JSON.stringify(value)} (user (db))`));
|
|
30182
30206
|
}
|
|
30183
30207
|
|
|
30184
30208
|
// src/commands/config/setFileConfigKey.ts
|
|
30185
|
-
import
|
|
30209
|
+
import chalk145 from "chalk";
|
|
30186
30210
|
async function setFileConfigKey({ key, useRepo, repoName, node, user }, coerced) {
|
|
30187
30211
|
const target = useRepo ? `${configScopeNames.repo}: ${await applyRepoOrExit(key, coerced, repoName)}` : user ? await applyUserOrExit(key, coerced) : applyOrExit(key, coerced, node);
|
|
30188
30212
|
const shown = JSON.stringify(maskConfigKeySecrets(key, coerced));
|
|
30189
|
-
console.log(
|
|
30213
|
+
console.log(chalk145.green(`Set ${key} = ${shown} (${target})`));
|
|
30190
30214
|
}
|
|
30191
30215
|
function applyOrExit(key, coerced, node) {
|
|
30192
30216
|
const result = applyConfigSet(key, coerced, node);
|
|
@@ -30222,7 +30246,7 @@ async function configSet(key, value, options2 = {}) {
|
|
|
30222
30246
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
30223
30247
|
const resolved = resolveRepoTarget(key, value, options2.repo);
|
|
30224
30248
|
if (resolved.value === void 0) {
|
|
30225
|
-
console.error(
|
|
30249
|
+
console.error(chalk146.red(`Missing required argument for '${resolved.key}'`));
|
|
30226
30250
|
process.exit(1);
|
|
30227
30251
|
}
|
|
30228
30252
|
const coercion = coerceCliConfigValue(resolved.key, resolved.value);
|
|
@@ -30240,7 +30264,7 @@ async function configSet(key, value, options2 = {}) {
|
|
|
30240
30264
|
}
|
|
30241
30265
|
|
|
30242
30266
|
// src/commands/config/configUnset.ts
|
|
30243
|
-
import
|
|
30267
|
+
import chalk149 from "chalk";
|
|
30244
30268
|
|
|
30245
30269
|
// src/commands/config/resolveRepoUnsetTarget.ts
|
|
30246
30270
|
function resolveRepoUnsetTarget(key, repo) {
|
|
@@ -30253,17 +30277,17 @@ function resolveRepoUnsetTarget(key, repo) {
|
|
|
30253
30277
|
}
|
|
30254
30278
|
|
|
30255
30279
|
// src/commands/config/unsetDbBackedConfigKey.ts
|
|
30256
|
-
import
|
|
30280
|
+
import chalk147 from "chalk";
|
|
30257
30281
|
async function unsetDbBackedConfigKey(key, useRepo) {
|
|
30258
30282
|
if (useRepo) exitWithConfigErrors([dbBackedRepoError(key)]);
|
|
30259
30283
|
const removed = await dbBackedConfigKeys[key].unset(await getDb());
|
|
30260
30284
|
console.log(
|
|
30261
|
-
removed ?
|
|
30285
|
+
removed ? chalk147.green(`Unset ${key} (user (db))`) : chalk147.yellow(`${key} is not set in user (db)`)
|
|
30262
30286
|
);
|
|
30263
30287
|
}
|
|
30264
30288
|
|
|
30265
30289
|
// src/commands/config/unsetFileConfigKey.ts
|
|
30266
|
-
import
|
|
30290
|
+
import chalk148 from "chalk";
|
|
30267
30291
|
async function unsetFileConfigKey({
|
|
30268
30292
|
key,
|
|
30269
30293
|
useRepo,
|
|
@@ -30274,10 +30298,10 @@ async function unsetFileConfigKey({
|
|
|
30274
30298
|
const result = useRepo ? await applySharedRepoConfigUnset(key, repoName) : user ? await applyUserConfigUnset(key) : applyConfigUnset(key, node);
|
|
30275
30299
|
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
30276
30300
|
if (!result.removed) {
|
|
30277
|
-
console.log(
|
|
30301
|
+
console.log(chalk148.yellow(`${key} is not set in ${targetLabel(result)}`));
|
|
30278
30302
|
return;
|
|
30279
30303
|
}
|
|
30280
|
-
console.log(
|
|
30304
|
+
console.log(chalk148.green(`Unset ${key} (${targetLabel(result)})`));
|
|
30281
30305
|
}
|
|
30282
30306
|
function targetLabel(result) {
|
|
30283
30307
|
if (result.target === "repo")
|
|
@@ -30291,7 +30315,7 @@ async function configUnset(key, options2 = {}) {
|
|
|
30291
30315
|
if (scopeError) exitWithConfigErrors([scopeError]);
|
|
30292
30316
|
const resolved = resolveRepoUnsetTarget(key, options2.repo);
|
|
30293
30317
|
if (resolved.key === void 0) {
|
|
30294
|
-
console.error(
|
|
30318
|
+
console.error(chalk149.red("Missing required argument 'key'"));
|
|
30295
30319
|
process.exit(1);
|
|
30296
30320
|
return;
|
|
30297
30321
|
}
|
|
@@ -30349,7 +30373,7 @@ function registerConfig(program) {
|
|
|
30349
30373
|
}
|
|
30350
30374
|
|
|
30351
30375
|
// src/commands/browser/browserInspect.ts
|
|
30352
|
-
import
|
|
30376
|
+
import chalk151 from "chalk";
|
|
30353
30377
|
|
|
30354
30378
|
// src/commands/browser/formatInspectMatches.ts
|
|
30355
30379
|
function formatInspectMatches({ matches, total: total2 }, query) {
|
|
@@ -30366,7 +30390,7 @@ function formatInspectMatches({ matches, total: total2 }, query) {
|
|
|
30366
30390
|
}
|
|
30367
30391
|
|
|
30368
30392
|
// src/commands/browser/requestTab.ts
|
|
30369
|
-
import
|
|
30393
|
+
import chalk150 from "chalk";
|
|
30370
30394
|
|
|
30371
30395
|
// src/commands/browser/requestBrowser.ts
|
|
30372
30396
|
var CLI_TIMEOUT_MS = 5e4;
|
|
@@ -30399,7 +30423,7 @@ async function requestBrowser(server, request) {
|
|
|
30399
30423
|
|
|
30400
30424
|
// src/commands/browser/requestTab.ts
|
|
30401
30425
|
function fail6(message4) {
|
|
30402
|
-
console.error(
|
|
30426
|
+
console.error(chalk150.red(`Error: ${message4}`));
|
|
30403
30427
|
process.exit(1);
|
|
30404
30428
|
}
|
|
30405
30429
|
async function requestTab(server, request) {
|
|
@@ -30418,7 +30442,7 @@ async function requestTab(server, request) {
|
|
|
30418
30442
|
async function browserInspect(selector, options2) {
|
|
30419
30443
|
if (!selector === !options2.text) {
|
|
30420
30444
|
console.error(
|
|
30421
|
-
|
|
30445
|
+
chalk151.red("Error: pass either a <selector> or --text <text>, not both")
|
|
30422
30446
|
);
|
|
30423
30447
|
process.exit(1);
|
|
30424
30448
|
}
|
|
@@ -30434,7 +30458,7 @@ async function browserInspect(selector, options2) {
|
|
|
30434
30458
|
|
|
30435
30459
|
// src/commands/browser/browserRun.ts
|
|
30436
30460
|
import { readFileSync as readFileSync45 } from "fs";
|
|
30437
|
-
import
|
|
30461
|
+
import chalk152 from "chalk";
|
|
30438
30462
|
|
|
30439
30463
|
// src/commands/browser/formatRunOutcome.ts
|
|
30440
30464
|
function formatRunOutcome(run5) {
|
|
@@ -30456,7 +30480,7 @@ async function browserRun(options2) {
|
|
|
30456
30480
|
code = readFileSync45(options2.file, "utf8");
|
|
30457
30481
|
} catch (error) {
|
|
30458
30482
|
console.error(
|
|
30459
|
-
|
|
30483
|
+
chalk152.red(
|
|
30460
30484
|
`Error: cannot read ${options2.file}: ${error.message}`
|
|
30461
30485
|
)
|
|
30462
30486
|
);
|
|
@@ -30473,7 +30497,7 @@ async function browserRun(options2) {
|
|
|
30473
30497
|
console.log(message4);
|
|
30474
30498
|
return;
|
|
30475
30499
|
}
|
|
30476
|
-
console.error(
|
|
30500
|
+
console.error(chalk152.red(message4));
|
|
30477
30501
|
process.exit(1);
|
|
30478
30502
|
}
|
|
30479
30503
|
|
|
@@ -30540,7 +30564,7 @@ function parseTopCount(value) {
|
|
|
30540
30564
|
}
|
|
30541
30565
|
|
|
30542
30566
|
// src/commands/browser/browserConsole.ts
|
|
30543
|
-
import
|
|
30567
|
+
import chalk153 from "chalk";
|
|
30544
30568
|
|
|
30545
30569
|
// src/commands/browser/formatConsoleEntries.ts
|
|
30546
30570
|
var pad = (value, width2 = 2) => String(value).padStart(width2, "0");
|
|
@@ -30568,7 +30592,7 @@ function formatConsoleEntries({
|
|
|
30568
30592
|
// src/commands/browser/browserConsole.ts
|
|
30569
30593
|
async function browserConsole(options2) {
|
|
30570
30594
|
if (options2.all && options2.url) {
|
|
30571
|
-
console.error(
|
|
30595
|
+
console.error(chalk153.red("Error: pass either --url or --all, not both"));
|
|
30572
30596
|
process.exit(1);
|
|
30573
30597
|
}
|
|
30574
30598
|
const result = await requestTab(options2.server, {
|
|
@@ -30658,7 +30682,7 @@ function registerBrowser(program) {
|
|
|
30658
30682
|
|
|
30659
30683
|
// src/commands/extension/extension.ts
|
|
30660
30684
|
import { cp } from "fs/promises";
|
|
30661
|
-
import
|
|
30685
|
+
import chalk154 from "chalk";
|
|
30662
30686
|
var WSL_WINDOWS_DIR = "/mnt/c/tools/extension";
|
|
30663
30687
|
var WSL_WINDOWS_PATH = String.raw`C:\tools\extension`;
|
|
30664
30688
|
async function loadPath(source) {
|
|
@@ -30668,23 +30692,23 @@ async function loadPath(source) {
|
|
|
30668
30692
|
return WSL_WINDOWS_PATH;
|
|
30669
30693
|
} catch {
|
|
30670
30694
|
console.log(
|
|
30671
|
-
|
|
30695
|
+
chalk154.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
30672
30696
|
);
|
|
30673
30697
|
return source;
|
|
30674
30698
|
}
|
|
30675
30699
|
}
|
|
30676
30700
|
async function extension() {
|
|
30677
30701
|
const path118 = await loadPath(extensionDir());
|
|
30678
|
-
console.log(
|
|
30679
|
-
console.log(
|
|
30702
|
+
console.log(chalk154.bold("assist \u2014 GitHub browser extension"));
|
|
30703
|
+
console.log(chalk154.dim(`load the unpacked extension from ${path118}`));
|
|
30680
30704
|
}
|
|
30681
30705
|
|
|
30682
30706
|
// src/commands/extension/printExtensionUrl.ts
|
|
30683
|
-
import
|
|
30707
|
+
import chalk155 from "chalk";
|
|
30684
30708
|
async function printExtensionUrl() {
|
|
30685
30709
|
const { updateUrl, latest: latest2 } = await fetchLatestSignedExtension();
|
|
30686
30710
|
if (!latest2) {
|
|
30687
|
-
console.log(
|
|
30711
|
+
console.log(chalk155.red(`no signed build found in ${updateUrl}`));
|
|
30688
30712
|
process.exitCode = 1;
|
|
30689
30713
|
return;
|
|
30690
30714
|
}
|
|
@@ -30695,7 +30719,7 @@ async function printExtensionUrl() {
|
|
|
30695
30719
|
import { rm as rm2 } from "fs/promises";
|
|
30696
30720
|
import { homedir as homedir24, tmpdir as tmpdir4 } from "os";
|
|
30697
30721
|
import { join as join76 } from "path";
|
|
30698
|
-
import
|
|
30722
|
+
import chalk157 from "chalk";
|
|
30699
30723
|
|
|
30700
30724
|
// src/commands/extension/copySignedXpi.ts
|
|
30701
30725
|
import { copyFile } from "fs/promises";
|
|
@@ -30720,7 +30744,7 @@ async function findSignedXpi(dir) {
|
|
|
30720
30744
|
|
|
30721
30745
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
30722
30746
|
import { cp as cp2 } from "fs/promises";
|
|
30723
|
-
import
|
|
30747
|
+
import chalk156 from "chalk";
|
|
30724
30748
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
30725
30749
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
30726
30750
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -30730,7 +30754,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
30730
30754
|
return WSL_WINDOWS_PATH2;
|
|
30731
30755
|
} catch {
|
|
30732
30756
|
console.log(
|
|
30733
|
-
|
|
30757
|
+
chalk156.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
30734
30758
|
);
|
|
30735
30759
|
return xpi;
|
|
30736
30760
|
}
|
|
@@ -30823,15 +30847,15 @@ async function signExtension() {
|
|
|
30823
30847
|
const source = extensionDir();
|
|
30824
30848
|
const problem = signPreflightProblem(source);
|
|
30825
30849
|
if (problem) {
|
|
30826
|
-
console.log(
|
|
30827
|
-
console.log(
|
|
30850
|
+
console.log(chalk157.red(problem.message));
|
|
30851
|
+
console.log(chalk157.dim(problem.hint));
|
|
30828
30852
|
process.exitCode = 1;
|
|
30829
30853
|
return;
|
|
30830
30854
|
}
|
|
30831
30855
|
const { version: version2 } = package_default;
|
|
30832
30856
|
await stageExtension(source, STAGING_DIR, version2);
|
|
30833
30857
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
30834
|
-
console.log(
|
|
30858
|
+
console.log(chalk157.bold(`signing version ${version2} for self-distribution`));
|
|
30835
30859
|
const { done: done2 } = spawnInherit("npx", [
|
|
30836
30860
|
"--yes",
|
|
30837
30861
|
"web-ext",
|
|
@@ -30841,13 +30865,13 @@ async function signExtension() {
|
|
|
30841
30865
|
"--channel=unlisted"
|
|
30842
30866
|
]);
|
|
30843
30867
|
if (await done2 !== 0) {
|
|
30844
|
-
console.log(
|
|
30868
|
+
console.log(chalk157.red("web-ext sign failed"));
|
|
30845
30869
|
process.exitCode = 1;
|
|
30846
30870
|
return;
|
|
30847
30871
|
}
|
|
30848
30872
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
30849
30873
|
if (!xpi) {
|
|
30850
|
-
console.log(
|
|
30874
|
+
console.log(chalk157.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
30851
30875
|
process.exitCode = 1;
|
|
30852
30876
|
return;
|
|
30853
30877
|
}
|
|
@@ -30855,7 +30879,7 @@ async function signExtension() {
|
|
|
30855
30879
|
const path118 = await signedAddonInstallPath(
|
|
30856
30880
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
30857
30881
|
);
|
|
30858
|
-
console.log(
|
|
30882
|
+
console.log(chalk157.dim(`install the signed add-on from ${path118}`));
|
|
30859
30883
|
}
|
|
30860
30884
|
|
|
30861
30885
|
// src/commands/registerExtension.ts
|
|
@@ -30916,11 +30940,11 @@ async function dropRetiredTables(exec3) {
|
|
|
30916
30940
|
}
|
|
30917
30941
|
|
|
30918
30942
|
// src/commands/db/reportRetiredTables.ts
|
|
30919
|
-
import
|
|
30943
|
+
import chalk158 from "chalk";
|
|
30920
30944
|
function reportRetiredTables(tables) {
|
|
30921
30945
|
for (const table of tables) {
|
|
30922
30946
|
console.error(
|
|
30923
|
-
|
|
30947
|
+
chalk158.yellow(
|
|
30924
30948
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
30925
30949
|
)
|
|
30926
30950
|
);
|
|
@@ -30928,40 +30952,40 @@ function reportRetiredTables(tables) {
|
|
|
30928
30952
|
}
|
|
30929
30953
|
|
|
30930
30954
|
// src/commands/db/reportMigrationStatus.ts
|
|
30931
|
-
import
|
|
30955
|
+
import chalk159 from "chalk";
|
|
30932
30956
|
function reportApplied(applied) {
|
|
30933
30957
|
if (applied.length === 0) {
|
|
30934
|
-
console.error(
|
|
30958
|
+
console.error(chalk159.green("Database is up to date; nothing to apply."));
|
|
30935
30959
|
return;
|
|
30936
30960
|
}
|
|
30937
30961
|
for (const migration of applied) {
|
|
30938
30962
|
console.error(
|
|
30939
|
-
|
|
30963
|
+
chalk159.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
30940
30964
|
);
|
|
30941
30965
|
}
|
|
30942
30966
|
}
|
|
30943
30967
|
function reportMigrationStatus(status2) {
|
|
30944
30968
|
if (status2.state === "in-sync") {
|
|
30945
30969
|
console.error(
|
|
30946
|
-
|
|
30970
|
+
chalk159.green(`In sync at migration ${status2.version} (latest).`)
|
|
30947
30971
|
);
|
|
30948
30972
|
return;
|
|
30949
30973
|
}
|
|
30950
30974
|
if (status2.state === "behind") {
|
|
30951
30975
|
console.error(
|
|
30952
|
-
|
|
30976
|
+
chalk159.yellow(
|
|
30953
30977
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
30954
30978
|
)
|
|
30955
30979
|
);
|
|
30956
30980
|
console.error(
|
|
30957
|
-
|
|
30981
|
+
chalk159.yellow(
|
|
30958
30982
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
30959
30983
|
)
|
|
30960
30984
|
);
|
|
30961
30985
|
return;
|
|
30962
30986
|
}
|
|
30963
30987
|
console.error(
|
|
30964
|
-
|
|
30988
|
+
chalk159.red(
|
|
30965
30989
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
30966
30990
|
)
|
|
30967
30991
|
);
|
|
@@ -31003,7 +31027,7 @@ function registerDb(program) {
|
|
|
31003
31027
|
|
|
31004
31028
|
// src/commands/deploy/redirect.ts
|
|
31005
31029
|
import { existsSync as existsSync64, readFileSync as readFileSync46, writeFileSync as writeFileSync33 } from "fs";
|
|
31006
|
-
import
|
|
31030
|
+
import chalk160 from "chalk";
|
|
31007
31031
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
31008
31032
|
if (!window.location.pathname.endsWith('/')) {
|
|
31009
31033
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -31012,23 +31036,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
31012
31036
|
function redirect() {
|
|
31013
31037
|
const indexPath = "index.html";
|
|
31014
31038
|
if (!existsSync64(indexPath)) {
|
|
31015
|
-
console.log(
|
|
31039
|
+
console.log(chalk160.yellow("No index.html found"));
|
|
31016
31040
|
return;
|
|
31017
31041
|
}
|
|
31018
31042
|
const content = readFileSync46(indexPath, "utf8");
|
|
31019
31043
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
31020
|
-
console.log(
|
|
31044
|
+
console.log(chalk160.dim("Trailing slash script already present"));
|
|
31021
31045
|
return;
|
|
31022
31046
|
}
|
|
31023
31047
|
const headCloseIndex = content.indexOf("</head>");
|
|
31024
31048
|
if (headCloseIndex === -1) {
|
|
31025
|
-
console.log(
|
|
31049
|
+
console.log(chalk160.red("Could not find </head> tag in index.html"));
|
|
31026
31050
|
return;
|
|
31027
31051
|
}
|
|
31028
31052
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
31029
31053
|
${content.slice(headCloseIndex)}`;
|
|
31030
31054
|
writeFileSync33(indexPath, newContent);
|
|
31031
|
-
console.log(
|
|
31055
|
+
console.log(chalk160.green("Added trailing slash redirect to index.html"));
|
|
31032
31056
|
}
|
|
31033
31057
|
|
|
31034
31058
|
// src/commands/registerDeploy.ts
|
|
@@ -31081,7 +31105,7 @@ function isCompletedWeek(weekId, today) {
|
|
|
31081
31105
|
}
|
|
31082
31106
|
|
|
31083
31107
|
// src/commands/devlog/list/printWeekHeader.ts
|
|
31084
|
-
import
|
|
31108
|
+
import chalk161 from "chalk";
|
|
31085
31109
|
function formatVersions(entry) {
|
|
31086
31110
|
const { firstVersion: first, lastVersion: last } = entry;
|
|
31087
31111
|
if (!first || !last) return first ?? last;
|
|
@@ -31089,19 +31113,19 @@ function formatVersions(entry) {
|
|
|
31089
31113
|
}
|
|
31090
31114
|
function describeEntry(entry) {
|
|
31091
31115
|
const versions = formatVersions(entry);
|
|
31092
|
-
const title = entry.title ??
|
|
31093
|
-
return versions ? `${
|
|
31116
|
+
const title = entry.title ?? chalk161.dim("untitled");
|
|
31117
|
+
return versions ? `${chalk161.green(versions)} ${title}` : title;
|
|
31094
31118
|
}
|
|
31095
31119
|
function describeWeek({ skipped, inProgress, entry }) {
|
|
31096
|
-
if (skipped) return
|
|
31120
|
+
if (skipped) return chalk161.dim("skipped");
|
|
31097
31121
|
if (entry) return describeEntry(entry);
|
|
31098
|
-
if (inProgress) return
|
|
31099
|
-
return
|
|
31122
|
+
if (inProgress) return chalk161.dim("in progress");
|
|
31123
|
+
return chalk161.red("\u26A0 dev entry missing");
|
|
31100
31124
|
}
|
|
31101
31125
|
function printWeekHeader(week, state) {
|
|
31102
31126
|
const { start: start2, end } = isoWeekRange(week);
|
|
31103
31127
|
console.log(
|
|
31104
|
-
`${
|
|
31128
|
+
`${chalk161.bold.blue(week)} ${chalk161.dim(`${start2} \u2013 ${end}`)} ${describeWeek(state)}`
|
|
31105
31129
|
);
|
|
31106
31130
|
}
|
|
31107
31131
|
|
|
@@ -31147,12 +31171,12 @@ function localToday() {
|
|
|
31147
31171
|
}
|
|
31148
31172
|
|
|
31149
31173
|
// src/commands/devlog/resolveDevDir.ts
|
|
31150
|
-
import
|
|
31174
|
+
import chalk162 from "chalk";
|
|
31151
31175
|
function resolveDevDir() {
|
|
31152
31176
|
const dir = loadConfig().devlog?.dir?.trim();
|
|
31153
31177
|
if (!dir) {
|
|
31154
31178
|
const setter = devlogConfigHelp.find((e) => e.key === "devlog.dir")?.setter;
|
|
31155
|
-
console.error(
|
|
31179
|
+
console.error(chalk162.red(`devlog.dir is not set. Set it with: ${setter}`));
|
|
31156
31180
|
process.exit(1);
|
|
31157
31181
|
}
|
|
31158
31182
|
return expandTilde(dir);
|
|
@@ -31221,7 +31245,7 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
|
|
|
31221
31245
|
}
|
|
31222
31246
|
|
|
31223
31247
|
// src/commands/devlog/shared.ts
|
|
31224
|
-
import
|
|
31248
|
+
import chalk163 from "chalk";
|
|
31225
31249
|
|
|
31226
31250
|
// src/shared/getRepoName.ts
|
|
31227
31251
|
import { existsSync as existsSync65, readFileSync as readFileSync48 } from "fs";
|
|
@@ -31249,21 +31273,21 @@ function getRepoName() {
|
|
|
31249
31273
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
31250
31274
|
for (const commit2 of commits2) {
|
|
31251
31275
|
console.log(
|
|
31252
|
-
` ${
|
|
31276
|
+
` ${chalk163.dim(commit2.date)} ${chalk163.yellow(commit2.hash)} ${commit2.message}`
|
|
31253
31277
|
);
|
|
31254
31278
|
if (verbose) {
|
|
31255
31279
|
const visibleFiles = commit2.files.filter(
|
|
31256
31280
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
31257
31281
|
);
|
|
31258
31282
|
for (const file of visibleFiles) {
|
|
31259
|
-
console.log(` ${
|
|
31283
|
+
console.log(` ${chalk163.dim(file)}`);
|
|
31260
31284
|
}
|
|
31261
31285
|
}
|
|
31262
31286
|
}
|
|
31263
31287
|
}
|
|
31264
31288
|
|
|
31265
31289
|
// src/commands/devlog/list/resolveListAfterDate.ts
|
|
31266
|
-
import
|
|
31290
|
+
import chalk164 from "chalk";
|
|
31267
31291
|
var DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
31268
31292
|
function resolveListAfterDate(options2, today) {
|
|
31269
31293
|
if (options2.since) return addDays(resolveSinceDate(options2.since), -1);
|
|
@@ -31275,7 +31299,7 @@ function resolveSinceDate(since) {
|
|
|
31275
31299
|
if (isValidWeek(since)) return isoWeekRange(since).start;
|
|
31276
31300
|
if (DATE_PATTERN.test(since)) return since;
|
|
31277
31301
|
console.log(
|
|
31278
|
-
|
|
31302
|
+
chalk164.red("Invalid --since. Use YYYY-MM-DD or YYYY-Www (e.g. 2026-W33)")
|
|
31279
31303
|
);
|
|
31280
31304
|
process.exit(1);
|
|
31281
31305
|
}
|
|
@@ -31328,7 +31352,7 @@ function loadDevWeeks(repoName, devDir) {
|
|
|
31328
31352
|
}
|
|
31329
31353
|
|
|
31330
31354
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
31331
|
-
import
|
|
31355
|
+
import chalk166 from "chalk";
|
|
31332
31356
|
|
|
31333
31357
|
// src/commands/devlog/resolveVersionSource.ts
|
|
31334
31358
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
@@ -31428,17 +31452,17 @@ function withVersions(commits2, source, hasTags) {
|
|
|
31428
31452
|
}
|
|
31429
31453
|
|
|
31430
31454
|
// src/commands/devlog/next/printCommits.ts
|
|
31431
|
-
import
|
|
31455
|
+
import chalk165 from "chalk";
|
|
31432
31456
|
function printCommits(commits2, ignore3, verbose) {
|
|
31433
31457
|
for (const commit2 of commits2) {
|
|
31434
|
-
const version2 = commit2.version ? ` ${
|
|
31458
|
+
const version2 = commit2.version ? ` ${chalk165.cyan(commit2.version)}` : "";
|
|
31435
31459
|
console.log(
|
|
31436
|
-
` ${
|
|
31460
|
+
` ${chalk165.dim(commit2.date)} ${chalk165.yellow(commit2.hash)}${version2} ${commit2.message}`
|
|
31437
31461
|
);
|
|
31438
31462
|
if (!verbose) continue;
|
|
31439
31463
|
for (const file of commit2.files) {
|
|
31440
31464
|
if (!ignore3.some((p) => file.startsWith(p))) {
|
|
31441
|
-
console.log(` ${
|
|
31465
|
+
console.log(` ${chalk165.dim(file)}`);
|
|
31442
31466
|
}
|
|
31443
31467
|
}
|
|
31444
31468
|
}
|
|
@@ -31453,7 +31477,7 @@ function versionRange(commits2) {
|
|
|
31453
31477
|
return first === last ? first : `${first} \u2013 ${last}`;
|
|
31454
31478
|
}
|
|
31455
31479
|
function printField(label, value) {
|
|
31456
|
-
console.log(`${
|
|
31480
|
+
console.log(`${chalk166.bold(`${label}:`)} ${value}`);
|
|
31457
31481
|
}
|
|
31458
31482
|
function displayNextEntry(ctx, week, commits2) {
|
|
31459
31483
|
const versioned = withVersions(
|
|
@@ -31463,7 +31487,7 @@ function displayNextEntry(ctx, week, commits2) {
|
|
|
31463
31487
|
);
|
|
31464
31488
|
const { start: start2, end } = isoWeekRange(week);
|
|
31465
31489
|
printField("name", ctx.repoName);
|
|
31466
|
-
printField("week",
|
|
31490
|
+
printField("week", chalk166.bold.blue(week));
|
|
31467
31491
|
printField("range", `${start2} \u2013 ${end}`);
|
|
31468
31492
|
const dates = commits2.map((c) => c.date).sort();
|
|
31469
31493
|
if (dates.length > 0) printField("dates", `${dates[0]} \u2013 ${dates.at(-1)}`);
|
|
@@ -31473,7 +31497,7 @@ function displayNextEntry(ctx, week, commits2) {
|
|
|
31473
31497
|
}
|
|
31474
31498
|
function logNoCommits(lastWeek) {
|
|
31475
31499
|
console.log(
|
|
31476
|
-
|
|
31500
|
+
chalk166.dim(
|
|
31477
31501
|
lastWeek ? `No completed weeks with commits after ${lastWeek}` : "No completed weeks with commits found"
|
|
31478
31502
|
)
|
|
31479
31503
|
);
|
|
@@ -31506,7 +31530,7 @@ function next2(options2) {
|
|
|
31506
31530
|
|
|
31507
31531
|
// src/commands/devlog/posted/posted.ts
|
|
31508
31532
|
import { readFileSync as readFileSync49, writeFileSync as writeFileSync34 } from "fs";
|
|
31509
|
-
import
|
|
31533
|
+
import chalk167 from "chalk";
|
|
31510
31534
|
|
|
31511
31535
|
// src/commands/devlog/posted/setFrontmatterSlack.ts
|
|
31512
31536
|
var FRONTMATTER = /^---\n[\s\S]*?\n(?=---(?:\n|$))/;
|
|
@@ -31522,7 +31546,7 @@ function setFrontmatterSlack(contents, value) {
|
|
|
31522
31546
|
|
|
31523
31547
|
// src/commands/devlog/posted/posted.ts
|
|
31524
31548
|
function fail7(message4) {
|
|
31525
|
-
console.error(
|
|
31549
|
+
console.error(chalk167.red(message4));
|
|
31526
31550
|
process.exit(1);
|
|
31527
31551
|
}
|
|
31528
31552
|
function readEntry(path118) {
|
|
@@ -31550,11 +31574,11 @@ function posted(week, permalink, options2 = {}) {
|
|
|
31550
31574
|
const updated2 = setFrontmatterSlack(readEntry(path118), value);
|
|
31551
31575
|
if (updated2 === null) fail7(`${path118} has no YAML frontmatter`);
|
|
31552
31576
|
writeFileSync34(path118, updated2);
|
|
31553
|
-
console.log(
|
|
31577
|
+
console.log(chalk167.green(`Recorded slack: ${value} in ${path118}`));
|
|
31554
31578
|
}
|
|
31555
31579
|
|
|
31556
31580
|
// src/commands/devlog/skip.ts
|
|
31557
|
-
import
|
|
31581
|
+
import chalk168 from "chalk";
|
|
31558
31582
|
var SKIP_WEEKS_KEY = "devlog.skipWeeks";
|
|
31559
31583
|
async function loadRepoSkipWeeks(cwd) {
|
|
31560
31584
|
const { block } = await resolveSharedRepoBlock(await getDb(), void 0, cwd);
|
|
@@ -31563,12 +31587,12 @@ async function loadRepoSkipWeeks(cwd) {
|
|
|
31563
31587
|
}
|
|
31564
31588
|
async function skip2(week, cwd = process.cwd()) {
|
|
31565
31589
|
if (!isValidWeek(week)) {
|
|
31566
|
-
console.log(
|
|
31590
|
+
console.log(chalk168.red("Invalid week. Use YYYY-Www (e.g. 2026-W33)"));
|
|
31567
31591
|
process.exit(1);
|
|
31568
31592
|
}
|
|
31569
31593
|
const existing = await loadRepoSkipWeeks(cwd);
|
|
31570
31594
|
if (existing.includes(week)) {
|
|
31571
|
-
console.log(
|
|
31595
|
+
console.log(chalk168.yellow(`${week} is already in ${SKIP_WEEKS_KEY}`));
|
|
31572
31596
|
return;
|
|
31573
31597
|
}
|
|
31574
31598
|
const result = await applySharedRepoConfigSet(
|
|
@@ -31578,11 +31602,11 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
31578
31602
|
cwd
|
|
31579
31603
|
);
|
|
31580
31604
|
if (!result.ok) {
|
|
31581
|
-
console.log(
|
|
31605
|
+
console.log(chalk168.red(result.errors.join("\n")));
|
|
31582
31606
|
process.exit(1);
|
|
31583
31607
|
}
|
|
31584
31608
|
console.log(
|
|
31585
|
-
|
|
31609
|
+
chalk168.green(
|
|
31586
31610
|
`Added ${week} to ${SKIP_WEEKS_KEY} for repos.${result.label} (repo db)`
|
|
31587
31611
|
)
|
|
31588
31612
|
);
|
|
@@ -31590,7 +31614,7 @@ async function skip2(week, cwd = process.cwd()) {
|
|
|
31590
31614
|
|
|
31591
31615
|
// src/commands/devlog/slack/slack.ts
|
|
31592
31616
|
import { mkdirSync as mkdirSync24, writeFileSync as writeFileSync37 } from "fs";
|
|
31593
|
-
import
|
|
31617
|
+
import chalk169 from "chalk";
|
|
31594
31618
|
|
|
31595
31619
|
// src/commands/slack/postSlackMessage.ts
|
|
31596
31620
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync36 } from "fs";
|
|
@@ -31849,7 +31873,7 @@ function unpostedWeeks(repoName, devDir) {
|
|
|
31849
31873
|
|
|
31850
31874
|
// src/commands/devlog/slack/slack.ts
|
|
31851
31875
|
function fail8(message4) {
|
|
31852
|
-
console.error(
|
|
31876
|
+
console.error(chalk169.red(message4));
|
|
31853
31877
|
process.exit(1);
|
|
31854
31878
|
}
|
|
31855
31879
|
function writeParts(channel, parts2) {
|
|
@@ -31899,7 +31923,7 @@ async function slack2(week) {
|
|
|
31899
31923
|
// src/commands/devlog/write.ts
|
|
31900
31924
|
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync38 } from "fs";
|
|
31901
31925
|
import { dirname as dirname36 } from "path";
|
|
31902
|
-
import
|
|
31926
|
+
import chalk170 from "chalk";
|
|
31903
31927
|
|
|
31904
31928
|
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
31905
31929
|
import { z as z19 } from "zod";
|
|
@@ -31977,7 +32001,7 @@ function parseInput(raw) {
|
|
|
31977
32001
|
try {
|
|
31978
32002
|
return JSON.parse(raw);
|
|
31979
32003
|
} catch (error) {
|
|
31980
|
-
console.error(
|
|
32004
|
+
console.error(chalk170.red(`Invalid JSON on stdin: ${String(error)}`));
|
|
31981
32005
|
process.exit(1);
|
|
31982
32006
|
}
|
|
31983
32007
|
}
|
|
@@ -31985,7 +32009,7 @@ async function write() {
|
|
|
31985
32009
|
const result = devEntryInputSchema.safeParse(parseInput(await readStdin()));
|
|
31986
32010
|
if (!result.success) {
|
|
31987
32011
|
for (const issue of result.error.issues) {
|
|
31988
|
-
console.error(
|
|
32012
|
+
console.error(chalk170.red(`${issue.path.join(".")}: ${issue.message}`));
|
|
31989
32013
|
}
|
|
31990
32014
|
process.exit(1);
|
|
31991
32015
|
}
|
|
@@ -31994,7 +32018,7 @@ async function write() {
|
|
|
31994
32018
|
const path118 = devEntryPath(repoName, result.data.week, devDir);
|
|
31995
32019
|
mkdirSync25(dirname36(path118), { recursive: true });
|
|
31996
32020
|
writeFileSync38(path118, formatDevEntry(repoName, result.data));
|
|
31997
|
-
console.log(
|
|
32021
|
+
console.log(chalk170.green(`Wrote ${path118}`));
|
|
31998
32022
|
}
|
|
31999
32023
|
|
|
32000
32024
|
// src/commands/devlog/registerDevlogEntryCommands.ts
|
|
@@ -32054,11 +32078,11 @@ function getRepoStatus(lastPush, lastWeek, today) {
|
|
|
32054
32078
|
}
|
|
32055
32079
|
|
|
32056
32080
|
// src/commands/devlog/repos/printReposTable.ts
|
|
32057
|
-
import
|
|
32081
|
+
import chalk171 from "chalk";
|
|
32058
32082
|
function colorStatus(status2) {
|
|
32059
|
-
if (status2 === "missing") return
|
|
32060
|
-
if (status2 === "outdated") return
|
|
32061
|
-
return
|
|
32083
|
+
if (status2 === "missing") return chalk171.red(status2);
|
|
32084
|
+
if (status2 === "outdated") return chalk171.yellow(status2);
|
|
32085
|
+
return chalk171.green(status2);
|
|
32062
32086
|
}
|
|
32063
32087
|
function formatRow(row2, nameWidth) {
|
|
32064
32088
|
const week = (row2.lastWeek ?? "-").padEnd(9);
|
|
@@ -32072,8 +32096,8 @@ function printReposTable(rows) {
|
|
|
32072
32096
|
"Last Week".padEnd(9),
|
|
32073
32097
|
"Status"
|
|
32074
32098
|
].join(" ");
|
|
32075
|
-
console.log(
|
|
32076
|
-
console.log(
|
|
32099
|
+
console.log(chalk171.dim(header));
|
|
32100
|
+
console.log(chalk171.dim("-".repeat(header.length)));
|
|
32077
32101
|
for (const row2 of rows) {
|
|
32078
32102
|
console.log(formatRow(row2, nameWidth));
|
|
32079
32103
|
}
|
|
@@ -32127,9 +32151,9 @@ function repos(options2) {
|
|
|
32127
32151
|
}
|
|
32128
32152
|
|
|
32129
32153
|
// src/commands/devlog/version.ts
|
|
32130
|
-
import
|
|
32154
|
+
import chalk172 from "chalk";
|
|
32131
32155
|
function printField2(label, value) {
|
|
32132
|
-
console.log(`${
|
|
32156
|
+
console.log(`${chalk172.bold(`${label}:`)} ${value ?? chalk172.dim("none")}`);
|
|
32133
32157
|
}
|
|
32134
32158
|
function version() {
|
|
32135
32159
|
const devDir = resolveDevDir();
|
|
@@ -32165,10 +32189,10 @@ function registerDevlog(program) {
|
|
|
32165
32189
|
|
|
32166
32190
|
// src/commands/docs/docsConfirm.ts
|
|
32167
32191
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
32168
|
-
import
|
|
32192
|
+
import chalk174 from "chalk";
|
|
32169
32193
|
|
|
32170
32194
|
// src/commands/backlog/findPhaseUnlockItem.ts
|
|
32171
|
-
import
|
|
32195
|
+
import chalk173 from "chalk";
|
|
32172
32196
|
async function findPhaseUnlockItem(itemId2, phase) {
|
|
32173
32197
|
const found = await findOneItem(String(itemId2));
|
|
32174
32198
|
if (!found) {
|
|
@@ -32178,7 +32202,7 @@ async function findPhaseUnlockItem(itemId2, phase) {
|
|
|
32178
32202
|
const label = `${formatItemId(itemId2)} ${found.item.name}`;
|
|
32179
32203
|
if ((found.item.currentPhase ?? 1) !== phase) {
|
|
32180
32204
|
console.error(
|
|
32181
|
-
|
|
32205
|
+
chalk173.red(
|
|
32182
32206
|
`${label} has moved on from phase ${phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
32183
32207
|
)
|
|
32184
32208
|
);
|
|
@@ -32227,7 +32251,7 @@ async function docsConfirm(pin2) {
|
|
|
32227
32251
|
sweepRestrictedDir();
|
|
32228
32252
|
const state = readDocsUnlockPinState(pin2);
|
|
32229
32253
|
if (!state) {
|
|
32230
|
-
console.error(
|
|
32254
|
+
console.error(chalk174.red(`No pending docs unlock for pin: ${pin2}`));
|
|
32231
32255
|
process.exitCode = 1;
|
|
32232
32256
|
return;
|
|
32233
32257
|
}
|
|
@@ -32236,14 +32260,14 @@ async function docsConfirm(pin2) {
|
|
|
32236
32260
|
if (!found) return;
|
|
32237
32261
|
await recordDocsUnlock(found.orm, state.itemId, state.phase);
|
|
32238
32262
|
console.log(
|
|
32239
|
-
|
|
32263
|
+
chalk174.green(
|
|
32240
32264
|
`Approved docs changes for phase ${state.phase} of ${found.label}. Its sessions may edit and commit docs pages and screenshots until the item moves on from that phase or is done or won't-do.`
|
|
32241
32265
|
)
|
|
32242
32266
|
);
|
|
32243
32267
|
}
|
|
32244
32268
|
|
|
32245
32269
|
// src/commands/docs/docsUnlock.ts
|
|
32246
|
-
import
|
|
32270
|
+
import chalk175 from "chalk";
|
|
32247
32271
|
|
|
32248
32272
|
// src/commands/notify/issueUnlockPin.ts
|
|
32249
32273
|
import { randomInt as randomInt2 } from "crypto";
|
|
@@ -32271,7 +32295,7 @@ async function issueUnlockPin({
|
|
|
32271
32295
|
|
|
32272
32296
|
// src/commands/docs/docsUnlock.ts
|
|
32273
32297
|
function fail9(message4) {
|
|
32274
|
-
console.error(
|
|
32298
|
+
console.error(chalk175.red(message4));
|
|
32275
32299
|
process.exitCode = 1;
|
|
32276
32300
|
}
|
|
32277
32301
|
async function docsUnlock() {
|
|
@@ -32304,7 +32328,7 @@ async function docsUnlock() {
|
|
|
32304
32328
|
console.log(
|
|
32305
32329
|
`A confirmation pin was sent to the user's desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
32306
32330
|
To let this phase of ${label} edit docs pages and screenshots, the user runs in this session:
|
|
32307
|
-
${
|
|
32331
|
+
${chalk175.cyan(" assist docs confirm <PIN>")}
|
|
32308
32332
|
Wait for the user to confirm before editing docs.`
|
|
32309
32333
|
);
|
|
32310
32334
|
}
|
|
@@ -32331,11 +32355,11 @@ function registerDocs(parent) {
|
|
|
32331
32355
|
|
|
32332
32356
|
// src/commands/schema/schemaConfirm.ts
|
|
32333
32357
|
import { unlinkSync as unlinkSync12 } from "fs";
|
|
32334
|
-
import
|
|
32358
|
+
import chalk177 from "chalk";
|
|
32335
32359
|
|
|
32336
32360
|
// src/commands/schema/approveSchemaUnlock.ts
|
|
32337
32361
|
import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync40 } from "fs";
|
|
32338
|
-
import
|
|
32362
|
+
import chalk176 from "chalk";
|
|
32339
32363
|
|
|
32340
32364
|
// src/commands/schema/schemaHarnessLabel.ts
|
|
32341
32365
|
function schemaHarnessLabel(harness) {
|
|
@@ -32356,7 +32380,7 @@ async function approveItemPhase({
|
|
|
32356
32380
|
title: `Database schema files unlocked by PIN for phase ${phase} (${schemaHarnessLabel(harness)})`
|
|
32357
32381
|
});
|
|
32358
32382
|
console.log(
|
|
32359
|
-
|
|
32383
|
+
chalk176.green(
|
|
32360
32384
|
`Approved schema changes for phase ${phase} of ${found.label} on ${schemaHarnessLabel(harness)}. Its ${schemaHarnessLabel(harness)} sessions may edit and commit database schema files until the item moves on from that phase or is done or won't-do.`
|
|
32361
32385
|
)
|
|
32362
32386
|
);
|
|
@@ -32368,7 +32392,7 @@ function approveSession({ harness, conversationId }) {
|
|
|
32368
32392
|
mkdirSync27(getSchemaSessionApprovalDir(), { recursive: true });
|
|
32369
32393
|
writeFileSync40(path118, JSON.stringify(scope));
|
|
32370
32394
|
console.log(
|
|
32371
|
-
|
|
32395
|
+
chalk176.green(
|
|
32372
32396
|
`Approved schema changes for ${schemaHarnessLabel(harness)} session ${conversationId}. It may edit and commit database schema files until the session ends.`
|
|
32373
32397
|
)
|
|
32374
32398
|
);
|
|
@@ -32430,13 +32454,13 @@ async function schemaConfirm(pin2) {
|
|
|
32430
32454
|
sweepRestrictedDir();
|
|
32431
32455
|
const state = readSchemaUnlockPinState(pin2);
|
|
32432
32456
|
if (!state) {
|
|
32433
|
-
console.error(
|
|
32457
|
+
console.error(chalk177.red(`No pending schema unlock for pin: ${pin2}`));
|
|
32434
32458
|
process.exitCode = 1;
|
|
32435
32459
|
return;
|
|
32436
32460
|
}
|
|
32437
32461
|
if (scopeMismatch(state, currentExecutionIdentity())) {
|
|
32438
32462
|
console.error(
|
|
32439
|
-
|
|
32463
|
+
chalk177.red(
|
|
32440
32464
|
"This pin was issued for a different session. Nothing was approved; confirm it in the session that requested it, or request a new unlock here."
|
|
32441
32465
|
)
|
|
32442
32466
|
);
|
|
@@ -32448,12 +32472,12 @@ async function schemaConfirm(pin2) {
|
|
|
32448
32472
|
}
|
|
32449
32473
|
|
|
32450
32474
|
// src/commands/schema/schemaUnlock.ts
|
|
32451
|
-
import
|
|
32475
|
+
import chalk179 from "chalk";
|
|
32452
32476
|
|
|
32453
32477
|
// src/commands/schema/resolveSchemaUnlockScope.ts
|
|
32454
|
-
import
|
|
32478
|
+
import chalk178 from "chalk";
|
|
32455
32479
|
function fail10(message4) {
|
|
32456
|
-
console.error(
|
|
32480
|
+
console.error(chalk178.red(message4));
|
|
32457
32481
|
process.exitCode = 1;
|
|
32458
32482
|
return void 0;
|
|
32459
32483
|
}
|
|
@@ -32503,7 +32527,7 @@ async function schemaUnlock() {
|
|
|
32503
32527
|
});
|
|
32504
32528
|
if (!delivered) {
|
|
32505
32529
|
console.error(
|
|
32506
|
-
|
|
32530
|
+
chalk179.red(
|
|
32507
32531
|
"Could not deliver the confirmation pin via notification.\nSchema files cannot be unlocked until the notification channel works."
|
|
32508
32532
|
)
|
|
32509
32533
|
);
|
|
@@ -32513,7 +32537,7 @@ async function schemaUnlock() {
|
|
|
32513
32537
|
console.log(
|
|
32514
32538
|
`A confirmation pin was sent to the user's desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
32515
32539
|
To let ${scope.scope} change database schema files, the user runs in this session:
|
|
32516
|
-
${
|
|
32540
|
+
${chalk179.cyan(" assist schema confirm <PIN>")}
|
|
32517
32541
|
Wait for the user to confirm before changing the schema.`
|
|
32518
32542
|
);
|
|
32519
32543
|
}
|
|
@@ -32541,7 +32565,7 @@ function registerSchema(parent) {
|
|
|
32541
32565
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
32542
32566
|
import { closeSync as closeSync6, openSync as openSync7, readdirSync as readdirSync14 } from "fs";
|
|
32543
32567
|
import { join as join83 } from "path";
|
|
32544
|
-
import
|
|
32568
|
+
import chalk180 from "chalk";
|
|
32545
32569
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
32546
32570
|
function isLockedDll(debugDir) {
|
|
32547
32571
|
let files;
|
|
@@ -32588,14 +32612,14 @@ function checkBuildLocks(startDir) {
|
|
|
32588
32612
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
32589
32613
|
if (locked) {
|
|
32590
32614
|
console.error(
|
|
32591
|
-
|
|
32615
|
+
chalk180.red("Build output locked (is VS debugging?): ") + locked
|
|
32592
32616
|
);
|
|
32593
32617
|
process.exit(1);
|
|
32594
32618
|
}
|
|
32595
32619
|
}
|
|
32596
32620
|
async function checkBuildLocksCommand() {
|
|
32597
32621
|
checkBuildLocks();
|
|
32598
|
-
console.log(
|
|
32622
|
+
console.log(chalk180.green("No build locks detected"));
|
|
32599
32623
|
}
|
|
32600
32624
|
|
|
32601
32625
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -32694,30 +32718,30 @@ function escapeRegex(s) {
|
|
|
32694
32718
|
}
|
|
32695
32719
|
|
|
32696
32720
|
// src/commands/dotnet/printTree.ts
|
|
32697
|
-
import
|
|
32721
|
+
import chalk181 from "chalk";
|
|
32698
32722
|
function printNodes(nodes, prefix2) {
|
|
32699
32723
|
for (let i = 0; i < nodes.length; i++) {
|
|
32700
32724
|
const isLast = i === nodes.length - 1;
|
|
32701
32725
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
32702
32726
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
32703
32727
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
32704
|
-
const label = isMissing ?
|
|
32728
|
+
const label = isMissing ? chalk181.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
32705
32729
|
console.log(`${prefix2}${connector}${label}`);
|
|
32706
32730
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
32707
32731
|
}
|
|
32708
32732
|
}
|
|
32709
32733
|
function printTree(tree, totalCount, solutions) {
|
|
32710
|
-
console.log(
|
|
32711
|
-
console.log(
|
|
32734
|
+
console.log(chalk181.bold("\nProject Dependency Tree"));
|
|
32735
|
+
console.log(chalk181.cyan(tree.relativePath));
|
|
32712
32736
|
printNodes(tree.children, "");
|
|
32713
|
-
console.log(
|
|
32737
|
+
console.log(chalk181.dim(`
|
|
32714
32738
|
${totalCount} projects total (including root)`));
|
|
32715
|
-
console.log(
|
|
32739
|
+
console.log(chalk181.bold("\nSolution Membership"));
|
|
32716
32740
|
if (solutions.length === 0) {
|
|
32717
|
-
console.log(
|
|
32741
|
+
console.log(chalk181.yellow(" Not found in any .sln"));
|
|
32718
32742
|
} else {
|
|
32719
32743
|
for (const sln of solutions) {
|
|
32720
|
-
console.log(` ${
|
|
32744
|
+
console.log(` ${chalk181.green(sln)}`);
|
|
32721
32745
|
}
|
|
32722
32746
|
}
|
|
32723
32747
|
console.log();
|
|
@@ -32746,16 +32770,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
32746
32770
|
// src/commands/dotnet/resolveCsproj.ts
|
|
32747
32771
|
import { existsSync as existsSync68 } from "fs";
|
|
32748
32772
|
import path46 from "path";
|
|
32749
|
-
import
|
|
32773
|
+
import chalk182 from "chalk";
|
|
32750
32774
|
function resolveCsproj(csprojPath) {
|
|
32751
32775
|
const resolved = path46.resolve(csprojPath);
|
|
32752
32776
|
if (!existsSync68(resolved)) {
|
|
32753
|
-
console.error(
|
|
32777
|
+
console.error(chalk182.red(`File not found: ${resolved}`));
|
|
32754
32778
|
process.exit(1);
|
|
32755
32779
|
}
|
|
32756
32780
|
const repoRoot3 = findRepoRoot(path46.dirname(resolved));
|
|
32757
32781
|
if (!repoRoot3) {
|
|
32758
|
-
console.error(
|
|
32782
|
+
console.error(chalk182.red("Could not find git repository root"));
|
|
32759
32783
|
process.exit(1);
|
|
32760
32784
|
}
|
|
32761
32785
|
return { resolved, repoRoot: repoRoot3 };
|
|
@@ -32805,12 +32829,12 @@ function getChangedCsFiles(scope) {
|
|
|
32805
32829
|
}
|
|
32806
32830
|
|
|
32807
32831
|
// src/commands/dotnet/inSln.ts
|
|
32808
|
-
import
|
|
32832
|
+
import chalk183 from "chalk";
|
|
32809
32833
|
async function inSln(csprojPath) {
|
|
32810
32834
|
const { resolved, repoRoot: repoRoot3 } = resolveCsproj(csprojPath);
|
|
32811
32835
|
const solutions = findContainingSolutions(resolved, repoRoot3);
|
|
32812
32836
|
if (solutions.length === 0) {
|
|
32813
|
-
console.log(
|
|
32837
|
+
console.log(chalk183.yellow("Not found in any .sln file"));
|
|
32814
32838
|
process.exit(1);
|
|
32815
32839
|
}
|
|
32816
32840
|
for (const sln of solutions) {
|
|
@@ -32819,7 +32843,7 @@ async function inSln(csprojPath) {
|
|
|
32819
32843
|
}
|
|
32820
32844
|
|
|
32821
32845
|
// src/commands/dotnet/inspect.ts
|
|
32822
|
-
import
|
|
32846
|
+
import chalk189 from "chalk";
|
|
32823
32847
|
|
|
32824
32848
|
// src/shared/formatElapsed.ts
|
|
32825
32849
|
function formatElapsed(ms) {
|
|
@@ -32831,12 +32855,12 @@ function formatElapsed(ms) {
|
|
|
32831
32855
|
}
|
|
32832
32856
|
|
|
32833
32857
|
// src/commands/dotnet/displayIssues.ts
|
|
32834
|
-
import
|
|
32858
|
+
import chalk184 from "chalk";
|
|
32835
32859
|
var SEVERITY_COLOR = {
|
|
32836
|
-
ERROR:
|
|
32837
|
-
WARNING:
|
|
32838
|
-
SUGGESTION:
|
|
32839
|
-
HINT:
|
|
32860
|
+
ERROR: chalk184.red,
|
|
32861
|
+
WARNING: chalk184.yellow,
|
|
32862
|
+
SUGGESTION: chalk184.cyan,
|
|
32863
|
+
HINT: chalk184.dim
|
|
32840
32864
|
};
|
|
32841
32865
|
function groupByFile(issues) {
|
|
32842
32866
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -32852,15 +32876,15 @@ function groupByFile(issues) {
|
|
|
32852
32876
|
}
|
|
32853
32877
|
function displayIssues(issues) {
|
|
32854
32878
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
32855
|
-
console.log(
|
|
32879
|
+
console.log(chalk184.bold(file));
|
|
32856
32880
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
32857
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
32881
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk184.white;
|
|
32858
32882
|
console.log(
|
|
32859
|
-
` ${
|
|
32883
|
+
` ${chalk184.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
32860
32884
|
);
|
|
32861
32885
|
}
|
|
32862
32886
|
}
|
|
32863
|
-
console.log(
|
|
32887
|
+
console.log(chalk184.dim(`
|
|
32864
32888
|
${issues.length} issue(s) found`));
|
|
32865
32889
|
}
|
|
32866
32890
|
|
|
@@ -32919,12 +32943,12 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
32919
32943
|
// src/commands/dotnet/resolveSolution.ts
|
|
32920
32944
|
import { existsSync as existsSync69 } from "fs";
|
|
32921
32945
|
import path47 from "path";
|
|
32922
|
-
import
|
|
32946
|
+
import chalk186 from "chalk";
|
|
32923
32947
|
|
|
32924
32948
|
// src/commands/dotnet/findSolution.ts
|
|
32925
32949
|
import { readdirSync as readdirSync16 } from "fs";
|
|
32926
32950
|
import { dirname as dirname37, join as join84 } from "path";
|
|
32927
|
-
import
|
|
32951
|
+
import chalk185 from "chalk";
|
|
32928
32952
|
function findSlnInDir(dir) {
|
|
32929
32953
|
try {
|
|
32930
32954
|
return readdirSync16(dir).filter((f) => f.endsWith(".sln")).map((f) => join84(dir, f));
|
|
@@ -32940,17 +32964,17 @@ function findSolution() {
|
|
|
32940
32964
|
const slnFiles = findSlnInDir(current2);
|
|
32941
32965
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
32942
32966
|
if (slnFiles.length > 1) {
|
|
32943
|
-
console.error(
|
|
32967
|
+
console.error(chalk185.red(`Multiple .sln files found in ${current2}:`));
|
|
32944
32968
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
32945
32969
|
console.error(
|
|
32946
|
-
|
|
32970
|
+
chalk185.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
32947
32971
|
);
|
|
32948
32972
|
process.exit(1);
|
|
32949
32973
|
}
|
|
32950
32974
|
if (current2 === ceiling) break;
|
|
32951
32975
|
current2 = dirname37(current2);
|
|
32952
32976
|
}
|
|
32953
|
-
console.error(
|
|
32977
|
+
console.error(chalk185.red("No .sln file found between cwd and repo root"));
|
|
32954
32978
|
process.exit(1);
|
|
32955
32979
|
}
|
|
32956
32980
|
|
|
@@ -32959,7 +32983,7 @@ function resolveSolution(sln) {
|
|
|
32959
32983
|
if (sln) {
|
|
32960
32984
|
const resolved = path47.resolve(sln);
|
|
32961
32985
|
if (!existsSync69(resolved)) {
|
|
32962
|
-
console.error(
|
|
32986
|
+
console.error(chalk186.red(`Solution file not found: ${resolved}`));
|
|
32963
32987
|
process.exit(1);
|
|
32964
32988
|
}
|
|
32965
32989
|
return resolved;
|
|
@@ -33001,14 +33025,14 @@ import { execSync as execSync40 } from "child_process";
|
|
|
33001
33025
|
import { existsSync as existsSync70, readFileSync as readFileSync56, unlinkSync as unlinkSync13 } from "fs";
|
|
33002
33026
|
import { tmpdir as tmpdir5 } from "os";
|
|
33003
33027
|
import path48 from "path";
|
|
33004
|
-
import
|
|
33028
|
+
import chalk187 from "chalk";
|
|
33005
33029
|
function assertJbInstalled() {
|
|
33006
33030
|
try {
|
|
33007
33031
|
execSync40("jb inspectcode --version", { stdio: "pipe" });
|
|
33008
33032
|
} catch {
|
|
33009
|
-
console.error(
|
|
33033
|
+
console.error(chalk187.red("jb is not installed. Install with:"));
|
|
33010
33034
|
console.error(
|
|
33011
|
-
|
|
33035
|
+
chalk187.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
33012
33036
|
);
|
|
33013
33037
|
process.exit(1);
|
|
33014
33038
|
}
|
|
@@ -33026,11 +33050,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
33026
33050
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
33027
33051
|
process.stderr.write(error.stderr);
|
|
33028
33052
|
}
|
|
33029
|
-
console.error(
|
|
33053
|
+
console.error(chalk187.red("jb inspectcode failed"));
|
|
33030
33054
|
process.exit(1);
|
|
33031
33055
|
}
|
|
33032
33056
|
if (!existsSync70(reportPath)) {
|
|
33033
|
-
console.error(
|
|
33057
|
+
console.error(chalk187.red("Report file not generated"));
|
|
33034
33058
|
process.exit(1);
|
|
33035
33059
|
}
|
|
33036
33060
|
const xml = readFileSync56(reportPath, "utf8");
|
|
@@ -33040,7 +33064,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
33040
33064
|
|
|
33041
33065
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
33042
33066
|
import { execSync as execSync41 } from "child_process";
|
|
33043
|
-
import
|
|
33067
|
+
import chalk188 from "chalk";
|
|
33044
33068
|
function resolveMsbuildPath() {
|
|
33045
33069
|
const { run: run5 } = loadConfig();
|
|
33046
33070
|
const configs = resolveRunConfigs(run5, runConfigBaseDir());
|
|
@@ -33052,9 +33076,9 @@ function assertMsbuildInstalled() {
|
|
|
33052
33076
|
try {
|
|
33053
33077
|
execSync41(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
33054
33078
|
} catch {
|
|
33055
|
-
console.error(
|
|
33079
|
+
console.error(chalk188.red(`msbuild not found at: ${msbuild}`));
|
|
33056
33080
|
console.error(
|
|
33057
|
-
|
|
33081
|
+
chalk188.yellow(
|
|
33058
33082
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
33059
33083
|
)
|
|
33060
33084
|
);
|
|
@@ -33101,17 +33125,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
33101
33125
|
// src/commands/dotnet/inspect.ts
|
|
33102
33126
|
function logScope(changedFiles2) {
|
|
33103
33127
|
if (changedFiles2 === null) {
|
|
33104
|
-
console.log(
|
|
33128
|
+
console.log(chalk189.dim("Inspecting full solution..."));
|
|
33105
33129
|
} else {
|
|
33106
33130
|
console.log(
|
|
33107
|
-
|
|
33131
|
+
chalk189.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
33108
33132
|
);
|
|
33109
33133
|
}
|
|
33110
33134
|
}
|
|
33111
33135
|
function reportResults(issues, elapsed) {
|
|
33112
33136
|
if (issues.length > 0) displayIssues(issues);
|
|
33113
|
-
else console.log(
|
|
33114
|
-
console.log(
|
|
33137
|
+
else console.log(chalk189.green("No issues found"));
|
|
33138
|
+
console.log(chalk189.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
33115
33139
|
if (issues.length > 0) process.exit(1);
|
|
33116
33140
|
}
|
|
33117
33141
|
async function inspect(sln, options2) {
|
|
@@ -33122,7 +33146,7 @@ async function inspect(sln, options2) {
|
|
|
33122
33146
|
const scope = parseScope(options2.scope);
|
|
33123
33147
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
33124
33148
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
33125
|
-
console.log(
|
|
33149
|
+
console.log(chalk189.green("No changed .cs files found"));
|
|
33126
33150
|
return;
|
|
33127
33151
|
}
|
|
33128
33152
|
logScope(changedFiles2);
|
|
@@ -34010,25 +34034,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
34010
34034
|
}
|
|
34011
34035
|
|
|
34012
34036
|
// src/commands/github/printCountTable.ts
|
|
34013
|
-
import
|
|
34037
|
+
import chalk190 from "chalk";
|
|
34014
34038
|
function printCountTable(labelHeader, rows) {
|
|
34015
34039
|
const labelWidth = Math.max(
|
|
34016
34040
|
labelHeader.length,
|
|
34017
34041
|
...rows.map((row2) => row2.label.length)
|
|
34018
34042
|
);
|
|
34019
34043
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
34020
|
-
console.log(
|
|
34021
|
-
console.log(
|
|
34044
|
+
console.log(chalk190.dim(header));
|
|
34045
|
+
console.log(chalk190.dim("-".repeat(header.length)));
|
|
34022
34046
|
for (const row2 of rows) {
|
|
34023
34047
|
console.log(`${row2.label.padEnd(labelWidth)} ${row2.count}`);
|
|
34024
34048
|
}
|
|
34025
34049
|
}
|
|
34026
34050
|
|
|
34027
34051
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
34028
|
-
import
|
|
34052
|
+
import chalk191 from "chalk";
|
|
34029
34053
|
function printRepoAuthorBreakdown(repos2) {
|
|
34030
34054
|
for (const repo of repos2) {
|
|
34031
|
-
console.log(
|
|
34055
|
+
console.log(chalk191.bold(repo.name));
|
|
34032
34056
|
const authorWidth = Math.max(
|
|
34033
34057
|
0,
|
|
34034
34058
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -34102,10 +34126,10 @@ function parseSinceDate(value) {
|
|
|
34102
34126
|
}
|
|
34103
34127
|
|
|
34104
34128
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
34105
|
-
import
|
|
34129
|
+
import chalk193 from "chalk";
|
|
34106
34130
|
|
|
34107
34131
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
34108
|
-
import
|
|
34132
|
+
import chalk192 from "chalk";
|
|
34109
34133
|
|
|
34110
34134
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
34111
34135
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -34142,7 +34166,7 @@ function writeLineNow(line) {
|
|
|
34142
34166
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
34143
34167
|
function applyFixStructurePlan(plan2) {
|
|
34144
34168
|
for (const entry of plan2.entries) {
|
|
34145
|
-
const where =
|
|
34169
|
+
const where = chalk192.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
34146
34170
|
const { typeChange, labelRemovals } = entry;
|
|
34147
34171
|
if (typeChange) {
|
|
34148
34172
|
writeLineNow(
|
|
@@ -34412,12 +34436,12 @@ function planSubtree(root2, context) {
|
|
|
34412
34436
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
34413
34437
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
34414
34438
|
applyFixStructurePlan(plan2);
|
|
34415
|
-
writeLineNow(
|
|
34439
|
+
writeLineNow(chalk193.dim("Re-walking the subtree to confirm"));
|
|
34416
34440
|
assertNoResidualDrift(
|
|
34417
34441
|
planSubtree(fetchRootIssue(target), context),
|
|
34418
34442
|
context.chain
|
|
34419
34443
|
);
|
|
34420
|
-
writeLineNow(
|
|
34444
|
+
writeLineNow(chalk193.green("Subtree normalised"));
|
|
34421
34445
|
}
|
|
34422
34446
|
|
|
34423
34447
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -34453,22 +34477,22 @@ function parseTypeChain(value) {
|
|
|
34453
34477
|
}
|
|
34454
34478
|
|
|
34455
34479
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
34456
|
-
import
|
|
34480
|
+
import chalk194 from "chalk";
|
|
34457
34481
|
function annotate(entry) {
|
|
34458
34482
|
const notes = [];
|
|
34459
34483
|
if (entry.level === null) {
|
|
34460
|
-
notes.push(
|
|
34484
|
+
notes.push(chalk194.red("deeper than the leaf level"));
|
|
34461
34485
|
} else if (entry.typeChange) {
|
|
34462
34486
|
notes.push(
|
|
34463
|
-
|
|
34487
|
+
chalk194.yellow(
|
|
34464
34488
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
34465
34489
|
)
|
|
34466
34490
|
);
|
|
34467
34491
|
} else {
|
|
34468
|
-
notes.push(
|
|
34492
|
+
notes.push(chalk194.dim(entry.issue.typeName ?? "no type"));
|
|
34469
34493
|
}
|
|
34470
34494
|
for (const label of entry.labelRemovals) {
|
|
34471
|
-
notes.push(
|
|
34495
|
+
notes.push(chalk194.yellow(`-${label.name}`));
|
|
34472
34496
|
}
|
|
34473
34497
|
return notes;
|
|
34474
34498
|
}
|
|
@@ -34476,22 +34500,22 @@ function formatCount(count10, noun) {
|
|
|
34476
34500
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
34477
34501
|
}
|
|
34478
34502
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
34479
|
-
writeLineNow(
|
|
34503
|
+
writeLineNow(chalk194.dim(`chain: ${chain2.join(" > ")}`));
|
|
34480
34504
|
for (const entry of plan2.entries) {
|
|
34481
34505
|
const indent4 = " ".repeat(entry.issue.depth);
|
|
34482
|
-
const name2 =
|
|
34506
|
+
const name2 = chalk194.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
34483
34507
|
writeLineNow(
|
|
34484
34508
|
`${indent4}${name2} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
34485
34509
|
);
|
|
34486
34510
|
}
|
|
34487
34511
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
34488
|
-
writeLineNow(
|
|
34512
|
+
writeLineNow(chalk194.green("Nothing to change"));
|
|
34489
34513
|
return;
|
|
34490
34514
|
}
|
|
34491
34515
|
writeLineNow(
|
|
34492
34516
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
34493
34517
|
);
|
|
34494
|
-
if (!apply) writeLineNow(
|
|
34518
|
+
if (!apply) writeLineNow(chalk194.dim("Dry run \u2014 nothing written"));
|
|
34495
34519
|
}
|
|
34496
34520
|
|
|
34497
34521
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -35892,25 +35916,25 @@ function registerGithub(program) {
|
|
|
35892
35916
|
import { Option } from "commander";
|
|
35893
35917
|
|
|
35894
35918
|
// src/commands/inbox/list.ts
|
|
35895
|
-
import
|
|
35919
|
+
import chalk195 from "chalk";
|
|
35896
35920
|
async function list3() {
|
|
35897
35921
|
const messages2 = await listInboxMessages(await getDb());
|
|
35898
35922
|
if (messages2.length === 0) {
|
|
35899
|
-
console.log(
|
|
35923
|
+
console.log(chalk195.dim("No flagged messages; run assist inbox scan"));
|
|
35900
35924
|
return;
|
|
35901
35925
|
}
|
|
35902
35926
|
for (const message4 of messages2) {
|
|
35903
35927
|
const when = (message4.receivedAt ?? message4.flaggedAt).toISOString();
|
|
35904
35928
|
console.log(
|
|
35905
|
-
`${
|
|
35929
|
+
`${chalk195.dim(when)} ${chalk195.cyan(message4.source)} ${chalk195.bold(message4.sender)}`
|
|
35906
35930
|
);
|
|
35907
35931
|
console.log(` ${message4.summary}`);
|
|
35908
|
-
console.log(` ${
|
|
35932
|
+
console.log(` ${chalk195.dim(message4.link)}`);
|
|
35909
35933
|
}
|
|
35910
35934
|
}
|
|
35911
35935
|
|
|
35912
35936
|
// src/commands/inbox/scan.ts
|
|
35913
|
-
import
|
|
35937
|
+
import chalk196 from "chalk";
|
|
35914
35938
|
|
|
35915
35939
|
// src/shared/formatTokens.ts
|
|
35916
35940
|
function formatTokens(n) {
|
|
@@ -36323,7 +36347,7 @@ async function runInboxScan(orm, {
|
|
|
36323
36347
|
async function scan(options2 = {}) {
|
|
36324
36348
|
const blocker = inboxScanBlocker(options2.harness);
|
|
36325
36349
|
if (blocker) {
|
|
36326
|
-
console.error(
|
|
36350
|
+
console.error(chalk196.red(blocker));
|
|
36327
36351
|
process.exitCode = 1;
|
|
36328
36352
|
return;
|
|
36329
36353
|
}
|
|
@@ -36336,7 +36360,7 @@ async function scan(options2 = {}) {
|
|
|
36336
36360
|
)
|
|
36337
36361
|
});
|
|
36338
36362
|
console.log(
|
|
36339
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
36363
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk196.bold(added)} new. ${chalk196.dim(formatScanUsage(usage))}`
|
|
36340
36364
|
);
|
|
36341
36365
|
}
|
|
36342
36366
|
|
|
@@ -36356,7 +36380,7 @@ function registerInbox(program) {
|
|
|
36356
36380
|
}
|
|
36357
36381
|
|
|
36358
36382
|
// src/commands/jira/acceptanceCriteria.ts
|
|
36359
|
-
import
|
|
36383
|
+
import chalk197 from "chalk";
|
|
36360
36384
|
|
|
36361
36385
|
// src/commands/jira/adfToText.ts
|
|
36362
36386
|
function renderInline(node) {
|
|
@@ -36423,7 +36447,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
36423
36447
|
const parsed = fetchIssue(issueKey, field);
|
|
36424
36448
|
const acValue = parsed?.fields?.[field];
|
|
36425
36449
|
if (!acValue) {
|
|
36426
|
-
console.log(
|
|
36450
|
+
console.log(chalk197.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
36427
36451
|
return;
|
|
36428
36452
|
}
|
|
36429
36453
|
if (typeof acValue === "string") {
|
|
@@ -36489,14 +36513,14 @@ async function jiraAuth() {
|
|
|
36489
36513
|
}
|
|
36490
36514
|
|
|
36491
36515
|
// src/commands/jira/viewIssue.ts
|
|
36492
|
-
import
|
|
36516
|
+
import chalk198 from "chalk";
|
|
36493
36517
|
function viewIssue2(issueKey) {
|
|
36494
36518
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
36495
36519
|
const fields = parsed?.fields;
|
|
36496
36520
|
const summary = fields?.summary;
|
|
36497
36521
|
const description = fields?.description;
|
|
36498
36522
|
if (summary) {
|
|
36499
|
-
console.log(
|
|
36523
|
+
console.log(chalk198.bold(summary));
|
|
36500
36524
|
}
|
|
36501
36525
|
if (description) {
|
|
36502
36526
|
if (summary) console.log();
|
|
@@ -36510,7 +36534,7 @@ function viewIssue2(issueKey) {
|
|
|
36510
36534
|
}
|
|
36511
36535
|
if (!summary && !description) {
|
|
36512
36536
|
console.log(
|
|
36513
|
-
|
|
36537
|
+
chalk198.yellow(`No summary or description found on ${issueKey}.`)
|
|
36514
36538
|
);
|
|
36515
36539
|
}
|
|
36516
36540
|
}
|
|
@@ -36541,7 +36565,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
36541
36565
|
}
|
|
36542
36566
|
|
|
36543
36567
|
// src/commands/launchPrSkill.ts
|
|
36544
|
-
import
|
|
36568
|
+
import chalk200 from "chalk";
|
|
36545
36569
|
|
|
36546
36570
|
// src/commands/review/checkoutPr.ts
|
|
36547
36571
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
@@ -37247,7 +37271,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
37247
37271
|
}
|
|
37248
37272
|
|
|
37249
37273
|
// src/commands/review/failCheckout.ts
|
|
37250
|
-
import
|
|
37274
|
+
import chalk199 from "chalk";
|
|
37251
37275
|
|
|
37252
37276
|
// src/commands/review/azCliProblem.ts
|
|
37253
37277
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
@@ -37300,14 +37324,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
37300
37324
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
37301
37325
|
if (headRef && stale === "local-work")
|
|
37302
37326
|
console.error(
|
|
37303
|
-
|
|
37327
|
+
chalk199.red(
|
|
37304
37328
|
`Local branch ${headRef} has commits that are not on the remote and cannot fast-forward to PR #${number}'s head; push or reset ${headRef}, then retry.`
|
|
37305
37329
|
)
|
|
37306
37330
|
);
|
|
37307
37331
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
37308
|
-
if (problem) console.error(
|
|
37332
|
+
if (problem) console.error(chalk199.red(problem));
|
|
37309
37333
|
console.error(
|
|
37310
|
-
|
|
37334
|
+
chalk199.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
37311
37335
|
);
|
|
37312
37336
|
process.exit(1);
|
|
37313
37337
|
}
|
|
@@ -37361,7 +37385,7 @@ async function launchPrSkill({
|
|
|
37361
37385
|
const adapter = harnessAdapter(harness);
|
|
37362
37386
|
const blocker = launchBlocker(adapter, feature, resumeSessionId);
|
|
37363
37387
|
if (blocker) {
|
|
37364
|
-
console.error(
|
|
37388
|
+
console.error(chalk200.red(blocker));
|
|
37365
37389
|
process.exitCode = 1;
|
|
37366
37390
|
return;
|
|
37367
37391
|
}
|
|
@@ -37519,18 +37543,18 @@ function registerList(program) {
|
|
|
37519
37543
|
}
|
|
37520
37544
|
|
|
37521
37545
|
// src/commands/litellm/listModels.ts
|
|
37522
|
-
import
|
|
37546
|
+
import chalk202 from "chalk";
|
|
37523
37547
|
|
|
37524
37548
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
37525
|
-
import
|
|
37549
|
+
import chalk201 from "chalk";
|
|
37526
37550
|
function resolveLitellmConfig() {
|
|
37527
37551
|
const { config, missing } = readLitellmConfig();
|
|
37528
37552
|
if (!config) {
|
|
37529
|
-
console.error(
|
|
37553
|
+
console.error(chalk201.red("LiteLLM is not configured"));
|
|
37530
37554
|
for (const key of missing) {
|
|
37531
37555
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
37532
37556
|
console.error(
|
|
37533
|
-
|
|
37557
|
+
chalk201.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
37534
37558
|
);
|
|
37535
37559
|
}
|
|
37536
37560
|
process.exit(1);
|
|
@@ -37556,13 +37580,13 @@ async function listModels(options2) {
|
|
|
37556
37580
|
} catch (error) {
|
|
37557
37581
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
37558
37582
|
console.error(
|
|
37559
|
-
|
|
37583
|
+
chalk202.red(`Failed to reach LiteLLM at ${baseUrl2}: ${reason4}`)
|
|
37560
37584
|
);
|
|
37561
37585
|
process.exit(1);
|
|
37562
37586
|
}
|
|
37563
37587
|
const body = await response.text();
|
|
37564
37588
|
if (!response.ok) {
|
|
37565
|
-
console.error(
|
|
37589
|
+
console.error(chalk202.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
37566
37590
|
process.exit(1);
|
|
37567
37591
|
}
|
|
37568
37592
|
if (options2.json) {
|
|
@@ -37582,15 +37606,15 @@ function registerLitellm(program) {
|
|
|
37582
37606
|
// src/commands/mermaidExport.ts
|
|
37583
37607
|
import { mkdirSync as mkdirSync30, readdirSync as readdirSync17 } from "fs";
|
|
37584
37608
|
import { resolve as resolve24 } from "path";
|
|
37585
|
-
import
|
|
37609
|
+
import chalk205 from "chalk";
|
|
37586
37610
|
|
|
37587
37611
|
// src/commands/mermaid/exportFile.ts
|
|
37588
37612
|
import { readFileSync as readFileSync58, writeFileSync as writeFileSync43 } from "fs";
|
|
37589
37613
|
import { basename as basename23, extname as extname4, resolve as resolve23 } from "path";
|
|
37590
|
-
import
|
|
37614
|
+
import chalk204 from "chalk";
|
|
37591
37615
|
|
|
37592
37616
|
// src/commands/mermaid/renderBlock.ts
|
|
37593
|
-
import
|
|
37617
|
+
import chalk203 from "chalk";
|
|
37594
37618
|
async function renderBlock(krokiUrl, source) {
|
|
37595
37619
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
37596
37620
|
method: "POST",
|
|
@@ -37599,7 +37623,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
37599
37623
|
});
|
|
37600
37624
|
if (!response.ok) {
|
|
37601
37625
|
console.error(
|
|
37602
|
-
|
|
37626
|
+
chalk203.red(
|
|
37603
37627
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
37604
37628
|
)
|
|
37605
37629
|
);
|
|
@@ -37617,19 +37641,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
37617
37641
|
if (onlyIndex !== void 0) {
|
|
37618
37642
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
37619
37643
|
console.error(
|
|
37620
|
-
|
|
37644
|
+
chalk204.red(
|
|
37621
37645
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
37622
37646
|
)
|
|
37623
37647
|
);
|
|
37624
37648
|
process.exit(1);
|
|
37625
37649
|
}
|
|
37626
37650
|
console.log(
|
|
37627
|
-
|
|
37651
|
+
chalk204.gray(
|
|
37628
37652
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
37629
37653
|
)
|
|
37630
37654
|
);
|
|
37631
37655
|
} else {
|
|
37632
|
-
console.log(
|
|
37656
|
+
console.log(chalk204.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
37633
37657
|
}
|
|
37634
37658
|
for (const [i, source] of blocks.entries()) {
|
|
37635
37659
|
const idx = i + 1;
|
|
@@ -37637,7 +37661,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
37637
37661
|
const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
|
|
37638
37662
|
const svg = await renderBlock(krokiUrl, source);
|
|
37639
37663
|
writeFileSync43(outPath, svg, "utf8");
|
|
37640
|
-
console.log(
|
|
37664
|
+
console.log(chalk204.green(` \u2192 ${outPath}`));
|
|
37641
37665
|
}
|
|
37642
37666
|
}
|
|
37643
37667
|
function extractMermaidBlocks(markdown) {
|
|
@@ -37653,18 +37677,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
37653
37677
|
if (options2.index !== void 0) {
|
|
37654
37678
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
37655
37679
|
console.error(
|
|
37656
|
-
|
|
37680
|
+
chalk205.red(`--index must be a positive integer (got ${options2.index})`)
|
|
37657
37681
|
);
|
|
37658
37682
|
process.exit(1);
|
|
37659
37683
|
}
|
|
37660
37684
|
if (!file) {
|
|
37661
|
-
console.error(
|
|
37685
|
+
console.error(chalk205.red("--index requires a file argument"));
|
|
37662
37686
|
process.exit(1);
|
|
37663
37687
|
}
|
|
37664
37688
|
}
|
|
37665
37689
|
const files = file ? [file] : readdirSync17(process.cwd()).filter((name2) => name2.toLowerCase().endsWith(".md")).sort();
|
|
37666
37690
|
if (files.length === 0) {
|
|
37667
|
-
console.log(
|
|
37691
|
+
console.log(chalk205.gray("No markdown files found in current directory."));
|
|
37668
37692
|
return;
|
|
37669
37693
|
}
|
|
37670
37694
|
for (const f of files) {
|
|
@@ -37810,7 +37834,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
37810
37834
|
}
|
|
37811
37835
|
|
|
37812
37836
|
// src/commands/miro/keptTexts.ts
|
|
37813
|
-
import
|
|
37837
|
+
import chalk206 from "chalk";
|
|
37814
37838
|
|
|
37815
37839
|
// src/commands/miro/applyIgnore.ts
|
|
37816
37840
|
function applyIgnore(texts, ignore3) {
|
|
@@ -37849,7 +37873,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
37849
37873
|
if (unmatched.length === 0) return;
|
|
37850
37874
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
37851
37875
|
console.error(
|
|
37852
|
-
|
|
37876
|
+
chalk206.yellow(
|
|
37853
37877
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
37854
37878
|
${entries}`
|
|
37855
37879
|
)
|
|
@@ -38050,7 +38074,7 @@ function readMiroItems(file) {
|
|
|
38050
38074
|
}
|
|
38051
38075
|
|
|
38052
38076
|
// src/commands/miro/resolveExtractOptions.ts
|
|
38053
|
-
import
|
|
38077
|
+
import chalk207 from "chalk";
|
|
38054
38078
|
|
|
38055
38079
|
// src/commands/miro/extractLayers.ts
|
|
38056
38080
|
function extractsIn(layer) {
|
|
@@ -38128,7 +38152,7 @@ function resolveExtractOptions(name2, options2, paths) {
|
|
|
38128
38152
|
paths.cwd,
|
|
38129
38153
|
paths.globalConfigPath
|
|
38130
38154
|
);
|
|
38131
|
-
console.error(
|
|
38155
|
+
console.error(chalk207.dim(`Extract "${name2}" from ${resolved.from}`));
|
|
38132
38156
|
return resolved.options;
|
|
38133
38157
|
}
|
|
38134
38158
|
|
|
@@ -38233,7 +38257,7 @@ function registerMiro(program) {
|
|
|
38233
38257
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
38234
38258
|
import { createServer as createServer2 } from "http";
|
|
38235
38259
|
import { dirname as dirname43 } from "path";
|
|
38236
|
-
import
|
|
38260
|
+
import chalk209 from "chalk";
|
|
38237
38261
|
|
|
38238
38262
|
// src/commands/netcap/corsHeaders.ts
|
|
38239
38263
|
var corsHeaders = {
|
|
@@ -38312,7 +38336,7 @@ function createNetcapHandler(options2) {
|
|
|
38312
38336
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
38313
38337
|
import { networkInterfaces } from "os";
|
|
38314
38338
|
import { join as join91 } from "path";
|
|
38315
|
-
import
|
|
38339
|
+
import chalk208 from "chalk";
|
|
38316
38340
|
|
|
38317
38341
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
38318
38342
|
import { dirname as dirname42, join as join90 } from "path";
|
|
@@ -38356,7 +38380,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
38356
38380
|
const host = lanIPv4();
|
|
38357
38381
|
if (!host) {
|
|
38358
38382
|
console.log(
|
|
38359
|
-
|
|
38383
|
+
chalk208.yellow("could not determine the WSL IP for the extension")
|
|
38360
38384
|
);
|
|
38361
38385
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
38362
38386
|
return source;
|
|
@@ -38367,7 +38391,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
38367
38391
|
return WSL_WINDOWS_PATH3;
|
|
38368
38392
|
} catch {
|
|
38369
38393
|
console.log(
|
|
38370
|
-
|
|
38394
|
+
chalk208.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
38371
38395
|
);
|
|
38372
38396
|
return source;
|
|
38373
38397
|
}
|
|
@@ -38400,30 +38424,30 @@ async function netcap(options2) {
|
|
|
38400
38424
|
let count10 = 0;
|
|
38401
38425
|
const handler = createNetcapHandler({
|
|
38402
38426
|
outPath,
|
|
38403
|
-
onPing: () => console.log(
|
|
38427
|
+
onPing: () => console.log(chalk209.dim("ping from extension")),
|
|
38404
38428
|
onCapture: (entry) => {
|
|
38405
38429
|
count10 += 1;
|
|
38406
38430
|
console.log(
|
|
38407
|
-
|
|
38408
|
-
|
|
38431
|
+
chalk209.green(`captured #${count10}`),
|
|
38432
|
+
chalk209.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
38409
38433
|
);
|
|
38410
38434
|
}
|
|
38411
38435
|
});
|
|
38412
38436
|
const server = createServer2(handler);
|
|
38413
38437
|
server.listen(port, () => {
|
|
38414
38438
|
console.log(
|
|
38415
|
-
|
|
38439
|
+
chalk209.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
38416
38440
|
);
|
|
38417
|
-
console.log(
|
|
38441
|
+
console.log(chalk209.dim(`appending captures to ${outPath}`));
|
|
38418
38442
|
if (filter)
|
|
38419
|
-
console.log(
|
|
38420
|
-
console.log(
|
|
38421
|
-
console.log(
|
|
38443
|
+
console.log(chalk209.dim(`forwarding only URLs matching "${filter}"`));
|
|
38444
|
+
console.log(chalk209.dim(`load the unpacked extension from ${extensionPath}`));
|
|
38445
|
+
console.log(chalk209.dim("press Ctrl-C to stop"));
|
|
38422
38446
|
});
|
|
38423
38447
|
process.on("SIGINT", () => {
|
|
38424
38448
|
server.close();
|
|
38425
38449
|
console.log(
|
|
38426
|
-
|
|
38450
|
+
chalk209.bold(
|
|
38427
38451
|
`
|
|
38428
38452
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
38429
38453
|
)
|
|
@@ -38435,7 +38459,7 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
38435
38459
|
// src/commands/netcap/netcapExtract.ts
|
|
38436
38460
|
import { writeFileSync as writeFileSync45 } from "fs";
|
|
38437
38461
|
import { join as join94 } from "path";
|
|
38438
|
-
import
|
|
38462
|
+
import chalk210 from "chalk";
|
|
38439
38463
|
|
|
38440
38464
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
38441
38465
|
import { readFileSync as readFileSync61 } from "fs";
|
|
@@ -38883,8 +38907,8 @@ function netcapExtract(file) {
|
|
|
38883
38907
|
writeFileSync45(outFile, `${JSON.stringify(posts, null, 2)}
|
|
38884
38908
|
`);
|
|
38885
38909
|
console.log(
|
|
38886
|
-
|
|
38887
|
-
|
|
38910
|
+
chalk210.green(`extracted ${posts.length} posts`),
|
|
38911
|
+
chalk210.dim(`-> ${outFile}`)
|
|
38888
38912
|
);
|
|
38889
38913
|
}
|
|
38890
38914
|
|
|
@@ -38905,7 +38929,7 @@ function registerNetcap(program) {
|
|
|
38905
38929
|
}
|
|
38906
38930
|
|
|
38907
38931
|
// src/commands/news/add.ts
|
|
38908
|
-
import
|
|
38932
|
+
import chalk211 from "chalk";
|
|
38909
38933
|
import enquirer8 from "enquirer";
|
|
38910
38934
|
async function add2(url) {
|
|
38911
38935
|
if (!url) {
|
|
@@ -38926,25 +38950,25 @@ async function add2(url) {
|
|
|
38926
38950
|
}
|
|
38927
38951
|
const added = await addFeed(await getDb(), url);
|
|
38928
38952
|
if (!added) {
|
|
38929
|
-
console.log(
|
|
38953
|
+
console.log(chalk211.yellow("Feed already exists"));
|
|
38930
38954
|
return;
|
|
38931
38955
|
}
|
|
38932
|
-
console.log(
|
|
38956
|
+
console.log(chalk211.green(`Added feed: ${url}`));
|
|
38933
38957
|
}
|
|
38934
38958
|
|
|
38935
38959
|
// src/commands/news/list.ts
|
|
38936
|
-
import
|
|
38960
|
+
import chalk212 from "chalk";
|
|
38937
38961
|
async function list4() {
|
|
38938
38962
|
const urls = await listFeeds(await getDb());
|
|
38939
38963
|
if (urls.length === 0) {
|
|
38940
|
-
console.log(
|
|
38964
|
+
console.log(chalk212.dim("No feeds; add one with assist news add <url>"));
|
|
38941
38965
|
return;
|
|
38942
38966
|
}
|
|
38943
38967
|
for (const url of urls) console.log(url);
|
|
38944
38968
|
}
|
|
38945
38969
|
|
|
38946
38970
|
// src/commands/news/remove.ts
|
|
38947
|
-
import
|
|
38971
|
+
import chalk213 from "chalk";
|
|
38948
38972
|
|
|
38949
38973
|
// src/commands/backlog/removeFeed.ts
|
|
38950
38974
|
import { eq as eq56 } from "drizzle-orm";
|
|
@@ -38957,10 +38981,10 @@ async function removeFeed(db, url) {
|
|
|
38957
38981
|
async function remove(url) {
|
|
38958
38982
|
const removed = await removeFeed(await getDb(), url);
|
|
38959
38983
|
if (!removed) {
|
|
38960
|
-
console.log(
|
|
38984
|
+
console.log(chalk213.yellow(`No feed matches ${url}`));
|
|
38961
38985
|
return;
|
|
38962
38986
|
}
|
|
38963
|
-
console.log(
|
|
38987
|
+
console.log(chalk213.green(`Removed feed: ${url}`));
|
|
38964
38988
|
}
|
|
38965
38989
|
|
|
38966
38990
|
// src/commands/registerNews.ts
|
|
@@ -39012,7 +39036,7 @@ function registerPiHook(program) {
|
|
|
39012
39036
|
}
|
|
39013
39037
|
|
|
39014
39038
|
// src/commands/prompts/printPromptsTable.ts
|
|
39015
|
-
import
|
|
39039
|
+
import chalk214 from "chalk";
|
|
39016
39040
|
function truncate3(str, max) {
|
|
39017
39041
|
if (str.length <= max) return str;
|
|
39018
39042
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -39030,14 +39054,14 @@ function printPromptsTable(rows) {
|
|
|
39030
39054
|
"Command".padEnd(commandWidth),
|
|
39031
39055
|
"Repos"
|
|
39032
39056
|
].join(" ");
|
|
39033
|
-
console.log(
|
|
39034
|
-
console.log(
|
|
39057
|
+
console.log(chalk214.dim(header));
|
|
39058
|
+
console.log(chalk214.dim("-".repeat(header.length)));
|
|
39035
39059
|
for (const row2 of rows) {
|
|
39036
39060
|
const count10 = String(row2.count).padStart(countWidth);
|
|
39037
39061
|
const tool = row2.tool.padEnd(toolWidth);
|
|
39038
39062
|
const command = truncate3(row2.command, 60).padEnd(commandWidth);
|
|
39039
39063
|
console.log(
|
|
39040
|
-
`${
|
|
39064
|
+
`${chalk214.yellow(count10)} ${tool} ${command} ${chalk214.dim(row2.repos)}`
|
|
39041
39065
|
);
|
|
39042
39066
|
}
|
|
39043
39067
|
}
|
|
@@ -39075,13 +39099,13 @@ import { execSync as execSync44 } from "child_process";
|
|
|
39075
39099
|
import enquirer9 from "enquirer";
|
|
39076
39100
|
|
|
39077
39101
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
39078
|
-
import
|
|
39102
|
+
import chalk215 from "chalk";
|
|
39079
39103
|
var STATUS_MAP = {
|
|
39080
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
39081
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
39104
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk215.magenta("merged"), date: pr.mergedAt } : null,
|
|
39105
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk215.red("closed"), date: pr.closedAt } : null
|
|
39082
39106
|
};
|
|
39083
39107
|
function defaultStatus(pr) {
|
|
39084
|
-
return { label:
|
|
39108
|
+
return { label: chalk215.green("opened"), date: pr.createdAt };
|
|
39085
39109
|
}
|
|
39086
39110
|
function getStatus(pr) {
|
|
39087
39111
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -39090,11 +39114,11 @@ function formatDate2(dateStr) {
|
|
|
39090
39114
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
39091
39115
|
}
|
|
39092
39116
|
function formatPrHeader(pr, status2) {
|
|
39093
|
-
return `${
|
|
39117
|
+
return `${chalk215.cyan(`#${pr.number}`)} ${pr.title} ${chalk215.dim(`(${pr.author.login},`)} ${status2.label} ${chalk215.dim(`${formatDate2(status2.date)})`)}`;
|
|
39094
39118
|
}
|
|
39095
39119
|
function logPrDetails(pr) {
|
|
39096
39120
|
console.log(
|
|
39097
|
-
|
|
39121
|
+
chalk215.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
39098
39122
|
);
|
|
39099
39123
|
console.log();
|
|
39100
39124
|
}
|
|
@@ -39662,13 +39686,13 @@ function agentFooter(unresolvedCount) {
|
|
|
39662
39686
|
}
|
|
39663
39687
|
|
|
39664
39688
|
// src/commands/prs/listComments/commentStyle.ts
|
|
39665
|
-
import
|
|
39689
|
+
import chalk216 from "chalk";
|
|
39666
39690
|
var plain = (text19) => text19;
|
|
39667
39691
|
function colouredState(state) {
|
|
39668
39692
|
const label = `[${state}]`;
|
|
39669
|
-
if (state === "APPROVED") return
|
|
39670
|
-
if (state === "CHANGES_REQUESTED") return
|
|
39671
|
-
return
|
|
39693
|
+
if (state === "APPROVED") return chalk216.green(label);
|
|
39694
|
+
if (state === "CHANGES_REQUESTED") return chalk216.red(label);
|
|
39695
|
+
return chalk216.yellow(label);
|
|
39672
39696
|
}
|
|
39673
39697
|
function commentStyle() {
|
|
39674
39698
|
if (isAgentHarness()) {
|
|
@@ -39682,9 +39706,9 @@ function commentStyle() {
|
|
|
39682
39706
|
};
|
|
39683
39707
|
}
|
|
39684
39708
|
return {
|
|
39685
|
-
cyan:
|
|
39686
|
-
bold:
|
|
39687
|
-
dim:
|
|
39709
|
+
cyan: chalk216.cyan,
|
|
39710
|
+
bold: chalk216.bold,
|
|
39711
|
+
dim: chalk216.dim,
|
|
39688
39712
|
state: colouredState,
|
|
39689
39713
|
diffHunk: true,
|
|
39690
39714
|
agent: false
|
|
@@ -41162,16 +41186,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
41162
41186
|
}
|
|
41163
41187
|
|
|
41164
41188
|
// src/commands/prs/status/printPrsStatus.ts
|
|
41165
|
-
import
|
|
41189
|
+
import chalk218 from "chalk";
|
|
41166
41190
|
|
|
41167
41191
|
// src/commands/prs/status/printPrStatus.ts
|
|
41168
|
-
import
|
|
41192
|
+
import chalk217 from "chalk";
|
|
41169
41193
|
function flags(pr) {
|
|
41170
41194
|
const markers = [];
|
|
41171
41195
|
if (pr.isDraft) markers.push("draft");
|
|
41172
41196
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
41173
41197
|
if (pr.isBot) markers.push("bot");
|
|
41174
|
-
return markers.length ? ` ${
|
|
41198
|
+
return markers.length ? ` ${chalk217.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
41175
41199
|
}
|
|
41176
41200
|
function updated(pr) {
|
|
41177
41201
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -41185,35 +41209,35 @@ function reviewLine(pr) {
|
|
|
41185
41209
|
function checkLines(pr) {
|
|
41186
41210
|
const lines = [];
|
|
41187
41211
|
if (pr.checks.failing.length) {
|
|
41188
|
-
lines.push(
|
|
41212
|
+
lines.push(chalk217.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
41189
41213
|
}
|
|
41190
41214
|
if (pr.checks.pending.length) {
|
|
41191
|
-
lines.push(
|
|
41215
|
+
lines.push(chalk217.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
41192
41216
|
}
|
|
41193
41217
|
return lines;
|
|
41194
41218
|
}
|
|
41195
41219
|
function threadsLine(pr) {
|
|
41196
41220
|
if (pr.unresolvedThreads === null) {
|
|
41197
|
-
return
|
|
41221
|
+
return chalk217.dim("unresolved comments: unknown");
|
|
41198
41222
|
}
|
|
41199
41223
|
if (pr.unresolvedThreads === 0) return null;
|
|
41200
|
-
return
|
|
41224
|
+
return chalk217.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
41201
41225
|
}
|
|
41202
41226
|
function mergeableLine(pr) {
|
|
41203
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
41227
|
+
if (pr.mergeable === "CONFLICTING") return chalk217.red("conflicting");
|
|
41204
41228
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
41205
|
-
return
|
|
41229
|
+
return chalk217.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
41206
41230
|
}
|
|
41207
41231
|
function printPrStatus(pr) {
|
|
41208
41232
|
console.log(
|
|
41209
|
-
` ${
|
|
41233
|
+
` ${chalk217.cyan(`#${pr.number}`)} ${pr.title} ${chalk217.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
41210
41234
|
);
|
|
41211
41235
|
const details = [
|
|
41212
41236
|
reviewLine(pr),
|
|
41213
41237
|
...checkLines(pr),
|
|
41214
41238
|
threadsLine(pr),
|
|
41215
41239
|
mergeableLine(pr),
|
|
41216
|
-
|
|
41240
|
+
chalk217.dim(pr.url)
|
|
41217
41241
|
];
|
|
41218
41242
|
for (const detail of details) {
|
|
41219
41243
|
if (detail) console.log(` ${detail}`);
|
|
@@ -41224,17 +41248,17 @@ function printPrStatus(pr) {
|
|
|
41224
41248
|
function printPrsStatus(report) {
|
|
41225
41249
|
for (const repo of report.repos) {
|
|
41226
41250
|
const count10 = repo.pullRequests.length;
|
|
41227
|
-
console.log(`${
|
|
41251
|
+
console.log(`${chalk218.bold(repo.repo)} ${chalk218.dim(`(${count10} open)`)}`);
|
|
41228
41252
|
for (const pr of repo.pullRequests) {
|
|
41229
41253
|
printPrStatus(pr);
|
|
41230
41254
|
}
|
|
41231
|
-
if (count10 === 0) console.log(
|
|
41255
|
+
if (count10 === 0) console.log(chalk218.dim(" no open pull requests"));
|
|
41232
41256
|
console.log();
|
|
41233
41257
|
}
|
|
41234
41258
|
if (report.errors.length === 0) return;
|
|
41235
|
-
console.log(
|
|
41259
|
+
console.log(chalk218.bold("Errors"));
|
|
41236
41260
|
for (const failure2 of report.errors) {
|
|
41237
|
-
console.log(` ${
|
|
41261
|
+
console.log(` ${chalk218.red(failure2.repo)}: ${failure2.error}`);
|
|
41238
41262
|
}
|
|
41239
41263
|
console.log();
|
|
41240
41264
|
}
|
|
@@ -41462,10 +41486,10 @@ function registerPrs(program) {
|
|
|
41462
41486
|
}
|
|
41463
41487
|
|
|
41464
41488
|
// src/commands/ravendb/ravendbAuth.ts
|
|
41465
|
-
import
|
|
41489
|
+
import chalk224 from "chalk";
|
|
41466
41490
|
|
|
41467
41491
|
// src/shared/createConnectionAuth.ts
|
|
41468
|
-
import
|
|
41492
|
+
import chalk219 from "chalk";
|
|
41469
41493
|
function listConnections(connections, format2) {
|
|
41470
41494
|
if (connections.length === 0) {
|
|
41471
41495
|
console.log("No connections configured.");
|
|
@@ -41478,7 +41502,7 @@ function listConnections(connections, format2) {
|
|
|
41478
41502
|
function removeConnection(connections, name2, save) {
|
|
41479
41503
|
const filtered = connections.filter((c) => c.name !== name2);
|
|
41480
41504
|
if (filtered.length === connections.length) {
|
|
41481
|
-
console.error(
|
|
41505
|
+
console.error(chalk219.red(`Connection "${name2}" not found.`));
|
|
41482
41506
|
process.exit(1);
|
|
41483
41507
|
}
|
|
41484
41508
|
save(filtered);
|
|
@@ -41524,15 +41548,15 @@ function saveConnections(connections) {
|
|
|
41524
41548
|
}
|
|
41525
41549
|
|
|
41526
41550
|
// src/commands/ravendb/promptConnection.ts
|
|
41527
|
-
import
|
|
41551
|
+
import chalk222 from "chalk";
|
|
41528
41552
|
|
|
41529
41553
|
// src/commands/ravendb/selectOpSecret.ts
|
|
41530
|
-
import
|
|
41554
|
+
import chalk221 from "chalk";
|
|
41531
41555
|
import Enquirer2 from "enquirer";
|
|
41532
41556
|
|
|
41533
41557
|
// src/commands/ravendb/searchItems.ts
|
|
41534
41558
|
import { execSync as execSync51 } from "child_process";
|
|
41535
|
-
import
|
|
41559
|
+
import chalk220 from "chalk";
|
|
41536
41560
|
function opExec(args) {
|
|
41537
41561
|
return execSync51(`op ${args}`, {
|
|
41538
41562
|
encoding: "utf8",
|
|
@@ -41545,7 +41569,7 @@ function searchItems(search2) {
|
|
|
41545
41569
|
items3 = JSON.parse(opExec("item list --format=json"));
|
|
41546
41570
|
} catch {
|
|
41547
41571
|
console.error(
|
|
41548
|
-
|
|
41572
|
+
chalk220.red(
|
|
41549
41573
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
41550
41574
|
)
|
|
41551
41575
|
);
|
|
@@ -41559,7 +41583,7 @@ function getItemFields(itemId2) {
|
|
|
41559
41583
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
41560
41584
|
return item.fields.filter((f) => f.reference && f.label);
|
|
41561
41585
|
} catch {
|
|
41562
|
-
console.error(
|
|
41586
|
+
console.error(chalk220.red("Failed to get item details from 1Password."));
|
|
41563
41587
|
process.exit(1);
|
|
41564
41588
|
}
|
|
41565
41589
|
}
|
|
@@ -41578,7 +41602,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
41578
41602
|
}).run();
|
|
41579
41603
|
const items3 = searchItems(search2);
|
|
41580
41604
|
if (items3.length === 0) {
|
|
41581
|
-
console.error(
|
|
41605
|
+
console.error(chalk221.red(`No items found matching "${search2}".`));
|
|
41582
41606
|
process.exit(1);
|
|
41583
41607
|
}
|
|
41584
41608
|
const itemId2 = await selectOne(
|
|
@@ -41587,7 +41611,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
41587
41611
|
);
|
|
41588
41612
|
const fields = getItemFields(itemId2);
|
|
41589
41613
|
if (fields.length === 0) {
|
|
41590
|
-
console.error(
|
|
41614
|
+
console.error(chalk221.red("No fields with references found on this item."));
|
|
41591
41615
|
process.exit(1);
|
|
41592
41616
|
}
|
|
41593
41617
|
const ref = await selectOne(
|
|
@@ -41601,7 +41625,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
41601
41625
|
async function promptConnection(existingNames) {
|
|
41602
41626
|
const name2 = await promptInput("name", "Connection name:");
|
|
41603
41627
|
if (existingNames.includes(name2)) {
|
|
41604
|
-
console.error(
|
|
41628
|
+
console.error(chalk222.red(`Connection "${name2}" already exists.`));
|
|
41605
41629
|
process.exit(1);
|
|
41606
41630
|
}
|
|
41607
41631
|
const url = await promptInput(
|
|
@@ -41610,22 +41634,22 @@ async function promptConnection(existingNames) {
|
|
|
41610
41634
|
);
|
|
41611
41635
|
const database = await promptInput("database", "Database name:");
|
|
41612
41636
|
if (!name2 || !url || !database) {
|
|
41613
|
-
console.error(
|
|
41637
|
+
console.error(chalk222.red("All fields are required."));
|
|
41614
41638
|
process.exit(1);
|
|
41615
41639
|
}
|
|
41616
41640
|
const apiKeyRef = await selectOpSecret();
|
|
41617
|
-
console.log(
|
|
41641
|
+
console.log(chalk222.dim(`Using: ${apiKeyRef}`));
|
|
41618
41642
|
return { name: name2, url, database, apiKeyRef };
|
|
41619
41643
|
}
|
|
41620
41644
|
|
|
41621
41645
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
41622
|
-
import
|
|
41646
|
+
import chalk223 from "chalk";
|
|
41623
41647
|
function ravendbSetConnection(name2) {
|
|
41624
41648
|
const raw = loadGlobalConfigRaw();
|
|
41625
41649
|
const ravendb = raw.ravendb ?? {};
|
|
41626
41650
|
const connections = ravendb.connections ?? [];
|
|
41627
41651
|
if (!connections.some((c) => c.name === name2)) {
|
|
41628
|
-
console.error(
|
|
41652
|
+
console.error(chalk223.red(`Connection "${name2}" not found.`));
|
|
41629
41653
|
console.error(
|
|
41630
41654
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
41631
41655
|
);
|
|
@@ -41641,16 +41665,16 @@ function ravendbSetConnection(name2) {
|
|
|
41641
41665
|
var ravendbAuth = createConnectionAuth({
|
|
41642
41666
|
load: loadConnections,
|
|
41643
41667
|
save: saveConnections,
|
|
41644
|
-
format: (c) => `${
|
|
41668
|
+
format: (c) => `${chalk224.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
41645
41669
|
promptNew: promptConnection,
|
|
41646
41670
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
41647
41671
|
});
|
|
41648
41672
|
|
|
41649
41673
|
// src/commands/ravendb/ravendbCollections.ts
|
|
41650
|
-
import
|
|
41674
|
+
import chalk228 from "chalk";
|
|
41651
41675
|
|
|
41652
41676
|
// src/commands/ravendb/ravenFetch.ts
|
|
41653
|
-
import
|
|
41677
|
+
import chalk226 from "chalk";
|
|
41654
41678
|
|
|
41655
41679
|
// src/commands/ravendb/getAccessToken.ts
|
|
41656
41680
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -41687,10 +41711,10 @@ ${errorText}`
|
|
|
41687
41711
|
|
|
41688
41712
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
41689
41713
|
import { execSync as execSync52 } from "child_process";
|
|
41690
|
-
import
|
|
41714
|
+
import chalk225 from "chalk";
|
|
41691
41715
|
function resolveOpSecret(reference) {
|
|
41692
41716
|
if (!reference.startsWith("op://")) {
|
|
41693
|
-
console.error(
|
|
41717
|
+
console.error(chalk225.red(`Invalid secret reference: must start with op://`));
|
|
41694
41718
|
process.exit(1);
|
|
41695
41719
|
}
|
|
41696
41720
|
try {
|
|
@@ -41700,7 +41724,7 @@ function resolveOpSecret(reference) {
|
|
|
41700
41724
|
}).trim();
|
|
41701
41725
|
} catch {
|
|
41702
41726
|
console.error(
|
|
41703
|
-
|
|
41727
|
+
chalk225.red(
|
|
41704
41728
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
41705
41729
|
)
|
|
41706
41730
|
);
|
|
@@ -41727,7 +41751,7 @@ async function ravenFetch(connection, path118) {
|
|
|
41727
41751
|
if (!response.ok) {
|
|
41728
41752
|
const body = await response.text();
|
|
41729
41753
|
console.error(
|
|
41730
|
-
|
|
41754
|
+
chalk226.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
41731
41755
|
);
|
|
41732
41756
|
console.error(body.substring(0, 500));
|
|
41733
41757
|
process.exit(1);
|
|
@@ -41736,7 +41760,7 @@ async function ravenFetch(connection, path118) {
|
|
|
41736
41760
|
}
|
|
41737
41761
|
|
|
41738
41762
|
// src/commands/ravendb/resolveConnection.ts
|
|
41739
|
-
import
|
|
41763
|
+
import chalk227 from "chalk";
|
|
41740
41764
|
function loadRavendb() {
|
|
41741
41765
|
const raw = loadGlobalConfigRaw();
|
|
41742
41766
|
const ravendb = raw.ravendb;
|
|
@@ -41750,7 +41774,7 @@ function resolveConnection(name2) {
|
|
|
41750
41774
|
const connectionName = name2 ?? defaultConnection;
|
|
41751
41775
|
if (!connectionName) {
|
|
41752
41776
|
console.error(
|
|
41753
|
-
|
|
41777
|
+
chalk227.red(
|
|
41754
41778
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
41755
41779
|
)
|
|
41756
41780
|
);
|
|
@@ -41758,7 +41782,7 @@ function resolveConnection(name2) {
|
|
|
41758
41782
|
}
|
|
41759
41783
|
const connection = connections.find((c) => c.name === connectionName);
|
|
41760
41784
|
if (!connection) {
|
|
41761
|
-
console.error(
|
|
41785
|
+
console.error(chalk227.red(`Connection "${connectionName}" not found.`));
|
|
41762
41786
|
console.error(
|
|
41763
41787
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
41764
41788
|
);
|
|
@@ -41789,15 +41813,15 @@ async function ravendbCollections(connectionName) {
|
|
|
41789
41813
|
return;
|
|
41790
41814
|
}
|
|
41791
41815
|
for (const c of collections) {
|
|
41792
|
-
console.log(`${
|
|
41816
|
+
console.log(`${chalk228.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
41793
41817
|
}
|
|
41794
41818
|
}
|
|
41795
41819
|
|
|
41796
41820
|
// src/commands/ravendb/ravendbQuery.ts
|
|
41797
|
-
import
|
|
41821
|
+
import chalk230 from "chalk";
|
|
41798
41822
|
|
|
41799
41823
|
// src/commands/ravendb/fetchAllPages.ts
|
|
41800
|
-
import
|
|
41824
|
+
import chalk229 from "chalk";
|
|
41801
41825
|
|
|
41802
41826
|
// src/commands/ravendb/buildQueryPath.ts
|
|
41803
41827
|
function buildQueryPath(opts) {
|
|
@@ -41835,7 +41859,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
41835
41859
|
allResults.push(...results);
|
|
41836
41860
|
start2 += results.length;
|
|
41837
41861
|
process.stderr.write(
|
|
41838
|
-
`\r${
|
|
41862
|
+
`\r${chalk229.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
41839
41863
|
);
|
|
41840
41864
|
if (start2 >= totalResults) break;
|
|
41841
41865
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -41850,7 +41874,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
41850
41874
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
41851
41875
|
const resolved = resolveArgs(connectionName, collection);
|
|
41852
41876
|
if (!resolved.collection && !options2.query) {
|
|
41853
|
-
console.error(
|
|
41877
|
+
console.error(chalk230.red("Provide a collection name or --query filter."));
|
|
41854
41878
|
process.exit(1);
|
|
41855
41879
|
}
|
|
41856
41880
|
const { collection: col } = resolved;
|
|
@@ -41885,7 +41909,7 @@ function registerRavendb(program) {
|
|
|
41885
41909
|
}
|
|
41886
41910
|
|
|
41887
41911
|
// src/commands/releases/releasesConfigure.ts
|
|
41888
|
-
import
|
|
41912
|
+
import chalk232 from "chalk";
|
|
41889
41913
|
|
|
41890
41914
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
41891
41915
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -41956,26 +41980,26 @@ function readStreamsInput(source) {
|
|
|
41956
41980
|
}
|
|
41957
41981
|
|
|
41958
41982
|
// src/commands/releases/reportDerivedStreams.ts
|
|
41959
|
-
import
|
|
41983
|
+
import chalk231 from "chalk";
|
|
41960
41984
|
function printDerived(stream) {
|
|
41961
41985
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
41962
41986
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
41963
41987
|
console.log(
|
|
41964
|
-
`${
|
|
41988
|
+
`${chalk231.bold(stream.name)} ${chalk231.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
41965
41989
|
);
|
|
41966
41990
|
console.log(
|
|
41967
|
-
` environments: ${environments.join(", ") ||
|
|
41991
|
+
` environments: ${environments.join(", ") || chalk231.dim("none")}`
|
|
41968
41992
|
);
|
|
41969
41993
|
if (steps.length > 0)
|
|
41970
41994
|
console.log(
|
|
41971
41995
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
41972
41996
|
);
|
|
41973
41997
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
41974
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
41998
|
+
console.log(` edges: ${edges.join(", ") || chalk231.dim("none")}`);
|
|
41975
41999
|
}
|
|
41976
42000
|
function reportDerivedStreams(streams, target) {
|
|
41977
42001
|
for (const stream of streams) printDerived(stream);
|
|
41978
|
-
console.log(
|
|
42002
|
+
console.log(chalk231.dim(`Written to ${target}`));
|
|
41979
42003
|
}
|
|
41980
42004
|
|
|
41981
42005
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -42066,8 +42090,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
42066
42090
|
|
|
42067
42091
|
// src/commands/releases/releasesConfigure.ts
|
|
42068
42092
|
function fail11(message4, details = []) {
|
|
42069
|
-
console.error(
|
|
42070
|
-
for (const detail of details) console.error(
|
|
42093
|
+
console.error(chalk232.red(message4));
|
|
42094
|
+
for (const detail of details) console.error(chalk232.red(` ${detail}`));
|
|
42071
42095
|
process.exitCode = 1;
|
|
42072
42096
|
}
|
|
42073
42097
|
function reportWritten(incoming, target) {
|
|
@@ -42100,23 +42124,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
42100
42124
|
}
|
|
42101
42125
|
|
|
42102
42126
|
// src/commands/releases/releasesList.ts
|
|
42103
|
-
import
|
|
42127
|
+
import chalk233 from "chalk";
|
|
42104
42128
|
function describeNode(node) {
|
|
42105
42129
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
42106
42130
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
42107
42131
|
}
|
|
42108
42132
|
function printStream(stream) {
|
|
42109
|
-
console.log(`${
|
|
42110
|
-
console.log(
|
|
42133
|
+
console.log(`${chalk233.bold(stream.name)} ${chalk233.dim(stream.repo)}`);
|
|
42134
|
+
console.log(chalk233.dim(` workflow: ${stream.workflow}`));
|
|
42111
42135
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
42112
42136
|
for (const [from, to] of stream.edges)
|
|
42113
|
-
console.log(
|
|
42137
|
+
console.log(chalk233.dim(` ${from} \u2192 ${to}`));
|
|
42114
42138
|
}
|
|
42115
42139
|
function releasesList() {
|
|
42116
42140
|
const streams = loadConfig().releases?.streams ?? [];
|
|
42117
42141
|
if (streams.length === 0) {
|
|
42118
42142
|
console.log(
|
|
42119
|
-
|
|
42143
|
+
chalk233.dim("No release streams configured under releases.streams.")
|
|
42120
42144
|
);
|
|
42121
42145
|
return;
|
|
42122
42146
|
}
|
|
@@ -42164,7 +42188,7 @@ function coverage() {
|
|
|
42164
42188
|
|
|
42165
42189
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
42166
42190
|
import path54 from "path";
|
|
42167
|
-
import
|
|
42191
|
+
import chalk235 from "chalk";
|
|
42168
42192
|
|
|
42169
42193
|
// src/commands/lint/lint/checkFileNames.ts
|
|
42170
42194
|
import fs32 from "fs";
|
|
@@ -42244,7 +42268,7 @@ function checkFileNames() {
|
|
|
42244
42268
|
}
|
|
42245
42269
|
|
|
42246
42270
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
42247
|
-
import
|
|
42271
|
+
import chalk234 from "chalk";
|
|
42248
42272
|
|
|
42249
42273
|
// src/commands/lint/lint/applyMoves.ts
|
|
42250
42274
|
import fs33 from "fs";
|
|
@@ -42329,25 +42353,25 @@ function fixFileNameViolations(moves) {
|
|
|
42329
42353
|
const start2 = performance.now();
|
|
42330
42354
|
const project = createLintProject();
|
|
42331
42355
|
const cwd = process.cwd();
|
|
42332
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
42356
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk234.green(line)));
|
|
42333
42357
|
const ms = (performance.now() - start2).toFixed(0);
|
|
42334
|
-
console.log(
|
|
42358
|
+
console.log(chalk234.dim(` Done in ${ms}ms`));
|
|
42335
42359
|
}
|
|
42336
42360
|
|
|
42337
42361
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
42338
42362
|
function reportViolations(violations) {
|
|
42339
|
-
console.error(
|
|
42363
|
+
console.error(chalk235.red("\nFile name check failed:\n"));
|
|
42340
42364
|
console.error(
|
|
42341
|
-
|
|
42365
|
+
chalk235.red(
|
|
42342
42366
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
42343
42367
|
)
|
|
42344
42368
|
);
|
|
42345
42369
|
for (const violation of violations) {
|
|
42346
|
-
console.error(
|
|
42347
|
-
console.error(
|
|
42370
|
+
console.error(chalk235.red(` ${violation.filePath}`));
|
|
42371
|
+
console.error(chalk235.gray(` Rename to: ${violation.suggestedName}
|
|
42348
42372
|
`));
|
|
42349
42373
|
}
|
|
42350
|
-
console.error(
|
|
42374
|
+
console.error(chalk235.dim(" Run with -f to auto-fix.\n"));
|
|
42351
42375
|
}
|
|
42352
42376
|
function runFileNameCheck(fix = false) {
|
|
42353
42377
|
const violations = checkFileNames();
|
|
@@ -42376,17 +42400,17 @@ function runFileNameCheck(fix = false) {
|
|
|
42376
42400
|
import fs35 from "fs";
|
|
42377
42401
|
|
|
42378
42402
|
// src/commands/lint/shared.ts
|
|
42379
|
-
import
|
|
42403
|
+
import chalk236 from "chalk";
|
|
42380
42404
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
42381
42405
|
if (violations.length > 0) {
|
|
42382
|
-
console.error(
|
|
42406
|
+
console.error(chalk236.red(`
|
|
42383
42407
|
${checkName2} failed:
|
|
42384
42408
|
`));
|
|
42385
|
-
console.error(
|
|
42409
|
+
console.error(chalk236.red(` ${errorMessage3}
|
|
42386
42410
|
`));
|
|
42387
42411
|
for (const violation of violations) {
|
|
42388
|
-
console.error(
|
|
42389
|
-
console.error(
|
|
42412
|
+
console.error(chalk236.red(` ${violation.filePath}:${violation.line}`));
|
|
42413
|
+
console.error(chalk236.gray(` ${violation.content}
|
|
42390
42414
|
`));
|
|
42391
42415
|
}
|
|
42392
42416
|
return false;
|
|
@@ -42613,7 +42637,7 @@ import { execSync as execSync54 } from "child_process";
|
|
|
42613
42637
|
import { existsSync as existsSync77, mkdirSync as mkdirSync33, unlinkSync as unlinkSync17, writeFileSync as writeFileSync48 } from "fs";
|
|
42614
42638
|
import { tmpdir as tmpdir8 } from "os";
|
|
42615
42639
|
import { join as join98, resolve as resolve28 } from "path";
|
|
42616
|
-
import
|
|
42640
|
+
import chalk237 from "chalk";
|
|
42617
42641
|
|
|
42618
42642
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
42619
42643
|
var captureWindowPs1 = `
|
|
@@ -42764,22 +42788,22 @@ function screenshot(processName) {
|
|
|
42764
42788
|
const config = loadConfig();
|
|
42765
42789
|
const outputDir = resolve28(config.screenshot.outputDir);
|
|
42766
42790
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
42767
|
-
console.log(
|
|
42791
|
+
console.log(chalk237.gray(`Capturing window for process "${processName}" ...`));
|
|
42768
42792
|
try {
|
|
42769
42793
|
runPowerShellScript(processName, outputPath);
|
|
42770
|
-
console.log(
|
|
42794
|
+
console.log(chalk237.green(`Screenshot saved: ${outputPath}`));
|
|
42771
42795
|
} catch (error) {
|
|
42772
42796
|
const msg = error instanceof Error ? error.message : String(error);
|
|
42773
|
-
console.error(
|
|
42797
|
+
console.error(chalk237.red(`Failed to capture screenshot: ${msg}`));
|
|
42774
42798
|
process.exit(1);
|
|
42775
42799
|
}
|
|
42776
42800
|
}
|
|
42777
42801
|
|
|
42778
42802
|
// src/commands/statusLine.ts
|
|
42779
|
-
import
|
|
42803
|
+
import chalk240 from "chalk";
|
|
42780
42804
|
|
|
42781
42805
|
// src/commands/buildLimitsSegment.ts
|
|
42782
|
-
import
|
|
42806
|
+
import chalk238 from "chalk";
|
|
42783
42807
|
|
|
42784
42808
|
// src/shared/rateLimitLevel.ts
|
|
42785
42809
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -42817,9 +42841,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
42817
42841
|
|
|
42818
42842
|
// src/commands/buildLimitsSegment.ts
|
|
42819
42843
|
var LEVEL_COLOR = {
|
|
42820
|
-
ok:
|
|
42821
|
-
warn:
|
|
42822
|
-
over:
|
|
42844
|
+
ok: chalk238.green,
|
|
42845
|
+
warn: chalk238.yellow,
|
|
42846
|
+
over: chalk238.red
|
|
42823
42847
|
};
|
|
42824
42848
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
42825
42849
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -42915,7 +42939,7 @@ async function relayUsage(claudeSessionId, transcriptPath, usedPct) {
|
|
|
42915
42939
|
}
|
|
42916
42940
|
|
|
42917
42941
|
// src/commands/colorizePercent.ts
|
|
42918
|
-
import
|
|
42942
|
+
import chalk239 from "chalk";
|
|
42919
42943
|
|
|
42920
42944
|
// src/shared/contextLevel.ts
|
|
42921
42945
|
var THRESHOLDS = {
|
|
@@ -42935,16 +42959,16 @@ function colorizePercent(pct) {
|
|
|
42935
42959
|
const label = `${Math.round(pct)}%`;
|
|
42936
42960
|
switch (contextLevel(pct)) {
|
|
42937
42961
|
case "red":
|
|
42938
|
-
return
|
|
42962
|
+
return chalk239.red(label);
|
|
42939
42963
|
case "yellow":
|
|
42940
|
-
return
|
|
42964
|
+
return chalk239.yellow(label);
|
|
42941
42965
|
default:
|
|
42942
42966
|
return label;
|
|
42943
42967
|
}
|
|
42944
42968
|
}
|
|
42945
42969
|
|
|
42946
42970
|
// src/commands/statusLine.ts
|
|
42947
|
-
|
|
42971
|
+
chalk240.level = 3;
|
|
42948
42972
|
function formatNumber(num) {
|
|
42949
42973
|
return num.toLocaleString("en-US");
|
|
42950
42974
|
}
|
|
@@ -42956,7 +42980,7 @@ async function statusLine() {
|
|
|
42956
42980
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
42957
42981
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
42958
42982
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
42959
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
42983
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk240.cyan(branch2)} | ` : "";
|
|
42960
42984
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
42961
42985
|
console.log(
|
|
42962
42986
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -43064,7 +43088,7 @@ import { spawn as spawn11 } from "child_process";
|
|
|
43064
43088
|
import * as path57 from "path";
|
|
43065
43089
|
|
|
43066
43090
|
// src/commands/refactor/logViolations.ts
|
|
43067
|
-
import
|
|
43091
|
+
import chalk241 from "chalk";
|
|
43068
43092
|
var DEFAULT_MAX_LINES2 = 100;
|
|
43069
43093
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
43070
43094
|
if (violations.length === 0) {
|
|
@@ -43073,43 +43097,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
43073
43097
|
}
|
|
43074
43098
|
return;
|
|
43075
43099
|
}
|
|
43076
|
-
console.error(
|
|
43100
|
+
console.error(chalk241.red(`
|
|
43077
43101
|
Refactor check failed:
|
|
43078
43102
|
`));
|
|
43079
|
-
console.error(
|
|
43103
|
+
console.error(chalk241.red(` The following files exceed ${maxLines} lines:
|
|
43080
43104
|
`));
|
|
43081
43105
|
for (const violation of violations) {
|
|
43082
|
-
console.error(
|
|
43106
|
+
console.error(chalk241.red(` ${violation.file} (${violation.lines} lines)`));
|
|
43083
43107
|
}
|
|
43084
43108
|
console.error(
|
|
43085
|
-
|
|
43109
|
+
chalk241.yellow(
|
|
43086
43110
|
`
|
|
43087
43111
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
43088
43112
|
way to refactor it, ignore it with:
|
|
43089
43113
|
`
|
|
43090
43114
|
)
|
|
43091
43115
|
);
|
|
43092
|
-
console.error(
|
|
43116
|
+
console.error(chalk241.gray(` assist refactor ignore <file>
|
|
43093
43117
|
`));
|
|
43094
43118
|
if (isAgentHarness()) {
|
|
43095
|
-
console.error(
|
|
43119
|
+
console.error(chalk241.cyan(`
|
|
43096
43120
|
## Extracting Code to New Files
|
|
43097
43121
|
`));
|
|
43098
43122
|
console.error(
|
|
43099
|
-
|
|
43123
|
+
chalk241.cyan(
|
|
43100
43124
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
43101
43125
|
`
|
|
43102
43126
|
)
|
|
43103
43127
|
);
|
|
43104
43128
|
console.error(
|
|
43105
|
-
|
|
43129
|
+
chalk241.cyan(
|
|
43106
43130
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
43107
43131
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
43108
43132
|
`
|
|
43109
43133
|
)
|
|
43110
43134
|
);
|
|
43111
43135
|
console.error(
|
|
43112
|
-
|
|
43136
|
+
chalk241.cyan(
|
|
43113
43137
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
43114
43138
|
domains, move it to a common/shared folder.
|
|
43115
43139
|
`
|
|
@@ -43265,7 +43289,7 @@ async function check(pattern2, options2) {
|
|
|
43265
43289
|
|
|
43266
43290
|
// src/commands/refactor/extract.ts
|
|
43267
43291
|
import path65 from "path";
|
|
43268
|
-
import
|
|
43292
|
+
import chalk244 from "chalk";
|
|
43269
43293
|
|
|
43270
43294
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
43271
43295
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -43873,23 +43897,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
43873
43897
|
|
|
43874
43898
|
// src/commands/refactor/extract/displayPlan.ts
|
|
43875
43899
|
import path61 from "path";
|
|
43876
|
-
import
|
|
43900
|
+
import chalk242 from "chalk";
|
|
43877
43901
|
function section(title) {
|
|
43878
43902
|
return `
|
|
43879
|
-
${
|
|
43903
|
+
${chalk242.cyan(title)}`;
|
|
43880
43904
|
}
|
|
43881
43905
|
function displayImporters(plan2, cwd) {
|
|
43882
43906
|
if (plan2.importersToUpdate.length === 0) return;
|
|
43883
43907
|
console.log(section("Update importers:"));
|
|
43884
43908
|
for (const imp of plan2.importersToUpdate) {
|
|
43885
43909
|
const rel = path61.relative(cwd, imp.file.getFilePath());
|
|
43886
|
-
console.log(` ${
|
|
43910
|
+
console.log(` ${chalk242.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
43887
43911
|
}
|
|
43888
43912
|
}
|
|
43889
43913
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
43890
|
-
console.log(
|
|
43914
|
+
console.log(chalk242.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
43891
43915
|
`));
|
|
43892
|
-
console.log(` ${
|
|
43916
|
+
console.log(` ${chalk242.cyan("Functions to move:")}`);
|
|
43893
43917
|
for (const name2 of plan2.extractedNames) {
|
|
43894
43918
|
console.log(` ${name2}`);
|
|
43895
43919
|
}
|
|
@@ -43923,7 +43947,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
43923
43947
|
|
|
43924
43948
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
43925
43949
|
import path64 from "path";
|
|
43926
|
-
import
|
|
43950
|
+
import chalk243 from "chalk";
|
|
43927
43951
|
import { Project as Project4 } from "ts-morph";
|
|
43928
43952
|
|
|
43929
43953
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -44015,7 +44039,7 @@ function loadProjectFile(file) {
|
|
|
44015
44039
|
});
|
|
44016
44040
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
44017
44041
|
if (!sourceFile) {
|
|
44018
|
-
console.log(
|
|
44042
|
+
console.log(chalk243.red(`File not found in project: ${file}`));
|
|
44019
44043
|
process.exit(1);
|
|
44020
44044
|
}
|
|
44021
44045
|
return { project, sourceFile };
|
|
@@ -44038,19 +44062,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
44038
44062
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
44039
44063
|
if (options2.apply) {
|
|
44040
44064
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
44041
|
-
console.log(
|
|
44065
|
+
console.log(chalk244.green("\nExtraction complete"));
|
|
44042
44066
|
} else {
|
|
44043
|
-
console.log(
|
|
44067
|
+
console.log(chalk244.dim("\nDry run. Use --apply to execute."));
|
|
44044
44068
|
}
|
|
44045
44069
|
}
|
|
44046
44070
|
|
|
44047
44071
|
// src/commands/refactor/ignore.ts
|
|
44048
44072
|
import fs42 from "fs";
|
|
44049
|
-
import
|
|
44073
|
+
import chalk245 from "chalk";
|
|
44050
44074
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
44051
44075
|
function ignore2(file) {
|
|
44052
44076
|
if (!fs42.existsSync(file)) {
|
|
44053
|
-
console.error(
|
|
44077
|
+
console.error(chalk245.red(`Error: File does not exist: ${file}`));
|
|
44054
44078
|
process.exit(1);
|
|
44055
44079
|
}
|
|
44056
44080
|
const content = fs42.readFileSync(file, "utf8");
|
|
@@ -44066,7 +44090,7 @@ function ignore2(file) {
|
|
|
44066
44090
|
fs42.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
44067
44091
|
}
|
|
44068
44092
|
console.log(
|
|
44069
|
-
|
|
44093
|
+
chalk245.green(
|
|
44070
44094
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
44071
44095
|
)
|
|
44072
44096
|
);
|
|
@@ -44075,12 +44099,12 @@ function ignore2(file) {
|
|
|
44075
44099
|
// src/commands/refactor/rename.ts
|
|
44076
44100
|
import fs45 from "fs";
|
|
44077
44101
|
import path71 from "path";
|
|
44078
|
-
import
|
|
44102
|
+
import chalk248 from "chalk";
|
|
44079
44103
|
|
|
44080
44104
|
// src/commands/refactor/rename/applyRename.ts
|
|
44081
44105
|
import fs44 from "fs";
|
|
44082
44106
|
import path67 from "path";
|
|
44083
|
-
import
|
|
44107
|
+
import chalk246 from "chalk";
|
|
44084
44108
|
|
|
44085
44109
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
44086
44110
|
import path66 from "path";
|
|
@@ -44186,13 +44210,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
44186
44210
|
const updatedContents = applyRewrites(rewrites);
|
|
44187
44211
|
for (const [file, content] of updatedContents) {
|
|
44188
44212
|
fs44.writeFileSync(file, content, "utf8");
|
|
44189
|
-
console.log(
|
|
44213
|
+
console.log(chalk246.cyan(` Updated imports in ${path67.relative(cwd, file)}`));
|
|
44190
44214
|
}
|
|
44191
44215
|
const destDir = path67.dirname(destPath);
|
|
44192
44216
|
if (!fs44.existsSync(destDir)) fs44.mkdirSync(destDir, { recursive: true });
|
|
44193
44217
|
fs44.renameSync(sourcePath, destPath);
|
|
44194
44218
|
console.log(
|
|
44195
|
-
|
|
44219
|
+
chalk246.white(
|
|
44196
44220
|
` Moved ${path67.relative(cwd, sourcePath)} \u2192 ${path67.relative(cwd, destPath)}`
|
|
44197
44221
|
)
|
|
44198
44222
|
);
|
|
@@ -44342,16 +44366,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
44342
44366
|
|
|
44343
44367
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
44344
44368
|
import path70 from "path";
|
|
44345
|
-
import
|
|
44369
|
+
import chalk247 from "chalk";
|
|
44346
44370
|
function printRenamePreview(rewrites, cwd) {
|
|
44347
44371
|
for (const rewrite of rewrites) {
|
|
44348
44372
|
console.log(
|
|
44349
|
-
|
|
44373
|
+
chalk247.dim(
|
|
44350
44374
|
` ${path70.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
44351
44375
|
)
|
|
44352
44376
|
);
|
|
44353
44377
|
}
|
|
44354
|
-
console.log(
|
|
44378
|
+
console.log(chalk247.dim("Dry run. Use --apply to execute."));
|
|
44355
44379
|
}
|
|
44356
44380
|
|
|
44357
44381
|
// src/commands/refactor/rename.ts
|
|
@@ -44362,20 +44386,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
44362
44386
|
const relSource = path71.relative(cwd, sourcePath);
|
|
44363
44387
|
const relDest = path71.relative(cwd, destPath);
|
|
44364
44388
|
if (!fs45.existsSync(sourcePath)) {
|
|
44365
|
-
console.log(
|
|
44389
|
+
console.log(chalk248.red(`File not found: ${source}`));
|
|
44366
44390
|
process.exit(1);
|
|
44367
44391
|
}
|
|
44368
44392
|
if (destPath !== sourcePath && fs45.existsSync(destPath)) {
|
|
44369
|
-
console.log(
|
|
44393
|
+
console.log(chalk248.red(`Destination already exists: ${destination}`));
|
|
44370
44394
|
process.exit(1);
|
|
44371
44395
|
}
|
|
44372
|
-
console.log(
|
|
44373
|
-
console.log(
|
|
44374
|
-
console.log(
|
|
44396
|
+
console.log(chalk248.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
44397
|
+
console.log(chalk248.dim("Loading project..."));
|
|
44398
|
+
console.log(chalk248.dim("Scanning imports across the project..."));
|
|
44375
44399
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
44376
44400
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
44377
44401
|
console.log(
|
|
44378
|
-
|
|
44402
|
+
chalk248.dim(
|
|
44379
44403
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
44380
44404
|
)
|
|
44381
44405
|
);
|
|
@@ -44384,11 +44408,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
44384
44408
|
return;
|
|
44385
44409
|
}
|
|
44386
44410
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
44387
|
-
console.log(
|
|
44411
|
+
console.log(chalk248.green("Done"));
|
|
44388
44412
|
}
|
|
44389
44413
|
|
|
44390
44414
|
// src/commands/refactor/renameSymbol.ts
|
|
44391
|
-
import
|
|
44415
|
+
import chalk249 from "chalk";
|
|
44392
44416
|
|
|
44393
44417
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
44394
44418
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -44434,34 +44458,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
44434
44458
|
const { project, sourceFile } = loadProjectFile(file);
|
|
44435
44459
|
const symbol = findSymbol(sourceFile, oldName);
|
|
44436
44460
|
if (!symbol) {
|
|
44437
|
-
console.log(
|
|
44461
|
+
console.log(chalk249.red(`Symbol "${oldName}" not found in ${file}`));
|
|
44438
44462
|
process.exit(1);
|
|
44439
44463
|
}
|
|
44440
44464
|
const grouped = groupReferences(symbol, cwd);
|
|
44441
44465
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
44442
44466
|
console.log(
|
|
44443
|
-
|
|
44467
|
+
chalk249.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
44444
44468
|
`)
|
|
44445
44469
|
);
|
|
44446
44470
|
for (const [refFile, lines] of grouped) {
|
|
44447
44471
|
console.log(
|
|
44448
|
-
` ${
|
|
44472
|
+
` ${chalk249.dim(refFile)}: lines ${chalk249.cyan(lines.join(", "))}`
|
|
44449
44473
|
);
|
|
44450
44474
|
}
|
|
44451
44475
|
if (options2.apply) {
|
|
44452
44476
|
symbol.rename(newName);
|
|
44453
44477
|
await project.save();
|
|
44454
|
-
console.log(
|
|
44478
|
+
console.log(chalk249.green(`
|
|
44455
44479
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
44456
44480
|
} else {
|
|
44457
|
-
console.log(
|
|
44481
|
+
console.log(chalk249.dim("\nDry run. Use --apply to execute."));
|
|
44458
44482
|
}
|
|
44459
44483
|
}
|
|
44460
44484
|
|
|
44461
44485
|
// src/commands/refactor/restructure.ts
|
|
44462
44486
|
import fs47 from "fs";
|
|
44463
44487
|
import path92 from "path";
|
|
44464
|
-
import
|
|
44488
|
+
import chalk259 from "chalk";
|
|
44465
44489
|
|
|
44466
44490
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
44467
44491
|
import path82 from "path";
|
|
@@ -44798,7 +44822,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
44798
44822
|
}
|
|
44799
44823
|
|
|
44800
44824
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
44801
|
-
import
|
|
44825
|
+
import chalk254 from "chalk";
|
|
44802
44826
|
|
|
44803
44827
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
44804
44828
|
import path83 from "path";
|
|
@@ -44809,13 +44833,13 @@ function applyCommand(scopeRoot) {
|
|
|
44809
44833
|
|
|
44810
44834
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
44811
44835
|
import path84 from "path";
|
|
44812
|
-
import
|
|
44836
|
+
import chalk250 from "chalk";
|
|
44813
44837
|
var shownMoves = 20;
|
|
44814
44838
|
function displayDrift(plan2, listMoves) {
|
|
44815
44839
|
const rel = (file) => path84.relative(process.cwd(), file);
|
|
44816
44840
|
if (plan2.moves.length > 0) {
|
|
44817
44841
|
console.log(
|
|
44818
|
-
|
|
44842
|
+
chalk250.red(
|
|
44819
44843
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
44820
44844
|
)
|
|
44821
44845
|
);
|
|
@@ -44823,17 +44847,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
44823
44847
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
44824
44848
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
44825
44849
|
if (plan2.moves.length > shownMoves)
|
|
44826
|
-
console.log(
|
|
44850
|
+
console.log(chalk250.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
44827
44851
|
}
|
|
44828
44852
|
}
|
|
44829
|
-
for (const error of plan2.errors) console.log(
|
|
44853
|
+
for (const error of plan2.errors) console.log(chalk250.red(error));
|
|
44830
44854
|
}
|
|
44831
44855
|
|
|
44832
44856
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
44833
|
-
import
|
|
44857
|
+
import chalk253 from "chalk";
|
|
44834
44858
|
|
|
44835
44859
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
44836
|
-
import
|
|
44860
|
+
import chalk251 from "chalk";
|
|
44837
44861
|
var shownChains = 10;
|
|
44838
44862
|
function formatChain(chain2) {
|
|
44839
44863
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -44843,28 +44867,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
44843
44867
|
if (chains.length === 0) return;
|
|
44844
44868
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
44845
44869
|
console.log(
|
|
44846
|
-
|
|
44870
|
+
chalk251.red(
|
|
44847
44871
|
`
|
|
44848
44872
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
44849
44873
|
)
|
|
44850
44874
|
);
|
|
44851
44875
|
console.log(
|
|
44852
|
-
|
|
44876
|
+
chalk251.bold(
|
|
44853
44877
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
44854
44878
|
)
|
|
44855
44879
|
);
|
|
44856
44880
|
for (const chain2 of chains.slice(0, shownChains))
|
|
44857
44881
|
console.log(formatChain(chain2));
|
|
44858
44882
|
if (chains.length > shownChains)
|
|
44859
|
-
console.log(
|
|
44883
|
+
console.log(chalk251.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
44860
44884
|
}
|
|
44861
44885
|
|
|
44862
44886
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
44863
|
-
import
|
|
44887
|
+
import chalk252 from "chalk";
|
|
44864
44888
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
44865
44889
|
if (longPaths.length === 0) return;
|
|
44866
44890
|
console.log(
|
|
44867
|
-
|
|
44891
|
+
chalk252.red(
|
|
44868
44892
|
`
|
|
44869
44893
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
44870
44894
|
)
|
|
@@ -44892,7 +44916,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
44892
44916
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
44893
44917
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
44894
44918
|
console.log("");
|
|
44895
|
-
for (const line of pinSteps(apply)) console.log(
|
|
44919
|
+
for (const line of pinSteps(apply)) console.log(chalk253.yellow(line));
|
|
44896
44920
|
}
|
|
44897
44921
|
|
|
44898
44922
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -44904,14 +44928,14 @@ function checkPlan(plan2, limits) {
|
|
|
44904
44928
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
44905
44929
|
if (plan2.moves.length > 0) {
|
|
44906
44930
|
console.log(
|
|
44907
|
-
|
|
44931
|
+
chalk254.yellow(
|
|
44908
44932
|
`
|
|
44909
44933
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
44910
44934
|
)
|
|
44911
44935
|
);
|
|
44912
44936
|
process.exit(1);
|
|
44913
44937
|
}
|
|
44914
|
-
console.log(
|
|
44938
|
+
console.log(chalk254.green("Layout matches the restructure plan"));
|
|
44915
44939
|
}
|
|
44916
44940
|
|
|
44917
44941
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -44981,15 +45005,15 @@ function partitionIgnored(files) {
|
|
|
44981
45005
|
}
|
|
44982
45006
|
|
|
44983
45007
|
// src/commands/refactor/restructure/runPlan.ts
|
|
44984
|
-
import
|
|
45008
|
+
import chalk258 from "chalk";
|
|
44985
45009
|
|
|
44986
45010
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
44987
|
-
import
|
|
45011
|
+
import chalk256 from "chalk";
|
|
44988
45012
|
|
|
44989
45013
|
// src/commands/refactor/restructure/executePlan.ts
|
|
44990
45014
|
import fs46 from "fs";
|
|
44991
45015
|
import path88 from "path";
|
|
44992
|
-
import
|
|
45016
|
+
import chalk255 from "chalk";
|
|
44993
45017
|
function relPath(file) {
|
|
44994
45018
|
return path88.relative(process.cwd(), file);
|
|
44995
45019
|
}
|
|
@@ -45006,14 +45030,14 @@ function moveFiles(moves) {
|
|
|
45006
45030
|
fs46.mkdirSync(path88.dirname(move2.to), { recursive: true });
|
|
45007
45031
|
fs46.renameSync(staging, move2.to);
|
|
45008
45032
|
console.log(
|
|
45009
|
-
|
|
45033
|
+
chalk255.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
45010
45034
|
);
|
|
45011
45035
|
}
|
|
45012
45036
|
}
|
|
45013
45037
|
function removeIfEmpty(dir) {
|
|
45014
45038
|
if (!fs46.existsSync(dir) || fs46.readdirSync(dir).length > 0) return false;
|
|
45015
45039
|
fs46.rmdirSync(dir);
|
|
45016
|
-
console.log(
|
|
45040
|
+
console.log(chalk255.dim(` Removed empty directory ${relPath(dir)}`));
|
|
45017
45041
|
return true;
|
|
45018
45042
|
}
|
|
45019
45043
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -45026,7 +45050,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
45026
45050
|
function executePlan(plan2) {
|
|
45027
45051
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
45028
45052
|
fs46.writeFileSync(file, content, "utf8");
|
|
45029
|
-
console.log(
|
|
45053
|
+
console.log(chalk255.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
45030
45054
|
}
|
|
45031
45055
|
moveFiles(plan2.moves);
|
|
45032
45056
|
removeEmptyDirectories(
|
|
@@ -45038,17 +45062,17 @@ function executePlan(plan2) {
|
|
|
45038
45062
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
45039
45063
|
function applyPlan(plan2) {
|
|
45040
45064
|
if (plan2.errors.length > 0) {
|
|
45041
|
-
console.log(
|
|
45065
|
+
console.log(chalk256.red("\nResolve the errors above before applying."));
|
|
45042
45066
|
process.exit(1);
|
|
45043
45067
|
}
|
|
45044
|
-
console.log(
|
|
45068
|
+
console.log(chalk256.bold("\nApplying changes..."));
|
|
45045
45069
|
executePlan(plan2);
|
|
45046
|
-
console.log(
|
|
45070
|
+
console.log(chalk256.green("\nRestructuring complete"));
|
|
45047
45071
|
}
|
|
45048
45072
|
|
|
45049
45073
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
45050
45074
|
import path91 from "path";
|
|
45051
|
-
import
|
|
45075
|
+
import chalk257 from "chalk";
|
|
45052
45076
|
|
|
45053
45077
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
45054
45078
|
import path89 from "path";
|
|
@@ -45099,17 +45123,17 @@ function relPath2(filePath) {
|
|
|
45099
45123
|
}
|
|
45100
45124
|
function displayMoves(plan2) {
|
|
45101
45125
|
if (plan2.moves.length === 0) return;
|
|
45102
|
-
console.log(
|
|
45126
|
+
console.log(chalk257.bold("\nFile moves:"));
|
|
45103
45127
|
for (const move2 of plan2.moves) {
|
|
45104
45128
|
console.log(
|
|
45105
|
-
` ${
|
|
45129
|
+
` ${chalk257.red(relPath2(move2.from))} \u2192 ${chalk257.green(relPath2(move2.to))}`
|
|
45106
45130
|
);
|
|
45107
|
-
console.log(
|
|
45131
|
+
console.log(chalk257.dim(` ${move2.reason}`));
|
|
45108
45132
|
}
|
|
45109
45133
|
}
|
|
45110
45134
|
function displayTree(plan2) {
|
|
45111
45135
|
console.log(
|
|
45112
|
-
|
|
45136
|
+
chalk257.bold(`
|
|
45113
45137
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
45114
45138
|
);
|
|
45115
45139
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -45120,15 +45144,15 @@ function displayDepthStats(plan2) {
|
|
|
45120
45144
|
plan2.targets.values(),
|
|
45121
45145
|
plan2.scopeRoot
|
|
45122
45146
|
);
|
|
45123
|
-
console.log(
|
|
45147
|
+
console.log(chalk257.bold(`
|
|
45124
45148
|
Depth (max ${max}):`));
|
|
45125
45149
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
45126
45150
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
45127
45151
|
}
|
|
45128
45152
|
function displayErrors(errors) {
|
|
45129
45153
|
if (errors.length === 0) return;
|
|
45130
|
-
console.log(
|
|
45131
|
-
for (const error of errors) console.log(
|
|
45154
|
+
console.log(chalk257.red("\nErrors:"));
|
|
45155
|
+
for (const error of errors) console.log(chalk257.red(` ${error}`));
|
|
45132
45156
|
}
|
|
45133
45157
|
function displayPlan2(plan2) {
|
|
45134
45158
|
displayMoves(plan2);
|
|
@@ -45137,7 +45161,7 @@ function displayPlan2(plan2) {
|
|
|
45137
45161
|
displayErrors(plan2.errors);
|
|
45138
45162
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
45139
45163
|
console.log(
|
|
45140
|
-
|
|
45164
|
+
chalk257.dim(
|
|
45141
45165
|
`
|
|
45142
45166
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
45143
45167
|
)
|
|
@@ -45149,11 +45173,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
45149
45173
|
displayPlan2(plan2);
|
|
45150
45174
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
45151
45175
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
45152
|
-
console.log(
|
|
45176
|
+
console.log(chalk258.green("No restructuring needed"));
|
|
45153
45177
|
return;
|
|
45154
45178
|
}
|
|
45155
45179
|
if (!apply) {
|
|
45156
|
-
console.log(
|
|
45180
|
+
console.log(chalk258.dim("\nDry run. Use --apply to execute."));
|
|
45157
45181
|
return;
|
|
45158
45182
|
}
|
|
45159
45183
|
applyPlan(plan2);
|
|
@@ -45163,14 +45187,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
45163
45187
|
async function restructure(root2, options2 = {}) {
|
|
45164
45188
|
const scopeRoot = path92.resolve(root2 ?? "src");
|
|
45165
45189
|
if (!fs47.existsSync(scopeRoot) || !fs47.statSync(scopeRoot).isDirectory()) {
|
|
45166
|
-
console.log(
|
|
45190
|
+
console.log(chalk259.red(`Not a directory: ${root2 ?? "src"}`));
|
|
45167
45191
|
process.exit(1);
|
|
45168
45192
|
}
|
|
45169
45193
|
const found = [];
|
|
45170
45194
|
walkSourceFiles(scopeRoot, found);
|
|
45171
45195
|
const { scoped, ignored } = partitionIgnored(found);
|
|
45172
45196
|
if (scoped.length === 0) {
|
|
45173
|
-
console.log(
|
|
45197
|
+
console.log(chalk259.yellow("No files found under root"));
|
|
45174
45198
|
return;
|
|
45175
45199
|
}
|
|
45176
45200
|
const {
|
|
@@ -45243,7 +45267,7 @@ async function checkoutPrSession(number, { harness, skill } = {}) {
|
|
|
45243
45267
|
}
|
|
45244
45268
|
|
|
45245
45269
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
45246
|
-
import
|
|
45270
|
+
import chalk263 from "chalk";
|
|
45247
45271
|
|
|
45248
45272
|
// src/commands/config/promptConfigScope.ts
|
|
45249
45273
|
import Enquirer3 from "enquirer";
|
|
@@ -45269,7 +45293,7 @@ async function promptConfigScope() {
|
|
|
45269
45293
|
}
|
|
45270
45294
|
|
|
45271
45295
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
45272
|
-
import
|
|
45296
|
+
import chalk260 from "chalk";
|
|
45273
45297
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
45274
45298
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
45275
45299
|
for (; ; ) {
|
|
@@ -45277,7 +45301,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
45277
45301
|
if (answer === "") return void 0;
|
|
45278
45302
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
45279
45303
|
if (coercion.ok) return coercion.value;
|
|
45280
|
-
console.error(
|
|
45304
|
+
console.error(chalk260.red(coercion.error));
|
|
45281
45305
|
}
|
|
45282
45306
|
}
|
|
45283
45307
|
function coerceSupplied(key, supplied) {
|
|
@@ -45357,7 +45381,7 @@ function suggestGlobs(current2, proposed) {
|
|
|
45357
45381
|
}
|
|
45358
45382
|
|
|
45359
45383
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
45360
|
-
import
|
|
45384
|
+
import chalk261 from "chalk";
|
|
45361
45385
|
function parseConfigureAnswers(answers) {
|
|
45362
45386
|
const known = Object.values(highLevelConfigKeys);
|
|
45363
45387
|
const parsed = {};
|
|
@@ -45375,12 +45399,12 @@ function answersCoverEveryKey(answers) {
|
|
|
45375
45399
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
45376
45400
|
}
|
|
45377
45401
|
function exitWith(message4) {
|
|
45378
|
-
console.error(
|
|
45402
|
+
console.error(chalk261.red(`Error: ${message4}.`));
|
|
45379
45403
|
process.exit(1);
|
|
45380
45404
|
}
|
|
45381
45405
|
|
|
45382
45406
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
45383
|
-
import
|
|
45407
|
+
import chalk262 from "chalk";
|
|
45384
45408
|
|
|
45385
45409
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
45386
45410
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -45476,7 +45500,7 @@ async function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
45476
45500
|
const harness = resolveOneShotHarness();
|
|
45477
45501
|
const label = harnessLabel(harness);
|
|
45478
45502
|
console.log(
|
|
45479
|
-
|
|
45503
|
+
chalk262.dim(`Asking ${label} to propose globs from the repo's own tree...`)
|
|
45480
45504
|
);
|
|
45481
45505
|
try {
|
|
45482
45506
|
const output = await runOneShotPrompt(
|
|
@@ -45487,9 +45511,9 @@ async function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
45487
45511
|
return parseProposedGlobs(output);
|
|
45488
45512
|
} catch (error) {
|
|
45489
45513
|
if (error instanceof OneShotUnavailableError)
|
|
45490
|
-
console.log(
|
|
45514
|
+
console.log(chalk262.yellow(error.message));
|
|
45491
45515
|
console.log(
|
|
45492
|
-
|
|
45516
|
+
chalk262.yellow(
|
|
45493
45517
|
`${label} proposed nothing; answer each key from its current value.`
|
|
45494
45518
|
)
|
|
45495
45519
|
);
|
|
@@ -45536,14 +45560,14 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
45536
45560
|
function reportConfigured(result) {
|
|
45537
45561
|
for (const write2 of result.written)
|
|
45538
45562
|
console.log(
|
|
45539
|
-
|
|
45563
|
+
chalk263.green(`Set ${write2.key} = ${JSON.stringify(write2.value)}`)
|
|
45540
45564
|
);
|
|
45541
|
-
for (const key of result.skipped) console.log(
|
|
45542
|
-
console.log(
|
|
45565
|
+
for (const key of result.skipped) console.log(chalk263.dim(`Left ${key} unset`));
|
|
45566
|
+
console.log(chalk263.dim(`Written to ${result.target}`));
|
|
45543
45567
|
}
|
|
45544
45568
|
|
|
45545
45569
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
45546
|
-
import
|
|
45570
|
+
import chalk264 from "chalk";
|
|
45547
45571
|
function savedMessage(subject) {
|
|
45548
45572
|
const head = subject.headSha.slice(0, 7);
|
|
45549
45573
|
if (subject.draft)
|
|
@@ -45554,10 +45578,10 @@ function savedMessage(subject) {
|
|
|
45554
45578
|
}
|
|
45555
45579
|
function announceSavedReview(subject, force) {
|
|
45556
45580
|
const message4 = savedMessage(subject);
|
|
45557
|
-
if (message4) console.log(
|
|
45581
|
+
if (message4) console.log(chalk264.dim(message4));
|
|
45558
45582
|
else if (force)
|
|
45559
45583
|
console.log(
|
|
45560
|
-
|
|
45584
|
+
chalk264.dim(
|
|
45561
45585
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
45562
45586
|
)
|
|
45563
45587
|
);
|
|
@@ -46937,55 +46961,55 @@ async function openHighLevelOverlay(sessionId2, subject, onRestart = async () =>
|
|
|
46937
46961
|
}
|
|
46938
46962
|
|
|
46939
46963
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
46940
|
-
import
|
|
46964
|
+
import chalk269 from "chalk";
|
|
46941
46965
|
|
|
46942
46966
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
46943
|
-
import
|
|
46967
|
+
import chalk265 from "chalk";
|
|
46944
46968
|
var PATCH_LINE_COLOURS = {
|
|
46945
|
-
"+":
|
|
46946
|
-
"-":
|
|
46947
|
-
"@":
|
|
46969
|
+
"+": chalk265.green,
|
|
46970
|
+
"-": chalk265.red,
|
|
46971
|
+
"@": chalk265.cyan
|
|
46948
46972
|
};
|
|
46949
46973
|
function formatPatch(patch2) {
|
|
46950
46974
|
return patch2.split("\n").map(
|
|
46951
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
46975
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk265.dim)(line)}`
|
|
46952
46976
|
);
|
|
46953
46977
|
}
|
|
46954
46978
|
function formatDiff(diff3) {
|
|
46955
46979
|
return [
|
|
46956
46980
|
"",
|
|
46957
|
-
` ${
|
|
46958
|
-
...diff3.patch === null ? [` ${
|
|
46981
|
+
` ${chalk265.bold(diff3.path)} ${chalk265.dim(`(${diff3.status})`)} ${chalk265.green(`+${diff3.additions}`)} ${chalk265.red(`-${diff3.deletions}`)}`,
|
|
46982
|
+
...diff3.patch === null ? [` ${chalk265.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
46959
46983
|
];
|
|
46960
46984
|
}
|
|
46961
46985
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
46962
46986
|
if (criticalPaths.length === 0)
|
|
46963
|
-
return `${
|
|
46964
|
-
${
|
|
46987
|
+
return `${chalk265.bold.underline("Critical diffs")}
|
|
46988
|
+
${chalk265.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
46965
46989
|
if (diffs.length === 0)
|
|
46966
|
-
return `${
|
|
46967
|
-
${
|
|
46990
|
+
return `${chalk265.bold.underline("Critical diffs")}
|
|
46991
|
+
${chalk265.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
46968
46992
|
return [
|
|
46969
|
-
|
|
46993
|
+
chalk265.bold.underline("Critical diffs"),
|
|
46970
46994
|
...diffs.flatMap(formatDiff)
|
|
46971
46995
|
].join("\n");
|
|
46972
46996
|
}
|
|
46973
46997
|
|
|
46974
46998
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
46975
|
-
import
|
|
46999
|
+
import chalk266 from "chalk";
|
|
46976
47000
|
var MARKERS = {
|
|
46977
|
-
pass: () =>
|
|
46978
|
-
fail: () =>
|
|
46979
|
-
manual: () =>
|
|
47001
|
+
pass: () => chalk266.green("\u2714"),
|
|
47002
|
+
fail: () => chalk266.red("\u2718"),
|
|
47003
|
+
manual: () => chalk266.yellow("\u25A1")
|
|
46980
47004
|
};
|
|
46981
47005
|
function formatCheck(check2) {
|
|
46982
|
-
const title = check2.status === "fail" ?
|
|
47006
|
+
const title = check2.status === "fail" ? chalk266.red(check2.title) : chalk266.bold(check2.title);
|
|
46983
47007
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
46984
|
-
${
|
|
47008
|
+
${chalk266.dim(check2.reason)}`;
|
|
46985
47009
|
}
|
|
46986
47010
|
function formatGroup(heading2, checks2) {
|
|
46987
47011
|
if (checks2.length === 0) return [];
|
|
46988
|
-
return ["",
|
|
47012
|
+
return ["", chalk266.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
46989
47013
|
}
|
|
46990
47014
|
function formatHighLevelChecklist(checks2) {
|
|
46991
47015
|
const deterministic = checks2.filter(
|
|
@@ -46994,7 +47018,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
46994
47018
|
const failed3 = deterministic.filter(
|
|
46995
47019
|
(check2) => check2.status === "fail"
|
|
46996
47020
|
).length;
|
|
46997
|
-
const summary = failed3 === 0 ?
|
|
47021
|
+
const summary = failed3 === 0 ? chalk266.green(`All ${deterministic.length} deterministic checks pass`) : chalk266.red(
|
|
46998
47022
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
46999
47023
|
);
|
|
47000
47024
|
return [
|
|
@@ -47009,37 +47033,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
47009
47033
|
}
|
|
47010
47034
|
|
|
47011
47035
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
47012
|
-
import
|
|
47036
|
+
import chalk267 from "chalk";
|
|
47013
47037
|
var STATUS_MARKERS = {
|
|
47014
|
-
added: () =>
|
|
47015
|
-
removed: () =>
|
|
47016
|
-
modified: () =>
|
|
47038
|
+
added: () => chalk267.green("A"),
|
|
47039
|
+
removed: () => chalk267.red("D"),
|
|
47040
|
+
modified: () => chalk267.yellow("M")
|
|
47017
47041
|
};
|
|
47018
47042
|
function counts(additions, deletions) {
|
|
47019
|
-
return `${
|
|
47043
|
+
return `${chalk267.green(`+${additions}`)} ${chalk267.red(`-${deletions}`)}`;
|
|
47020
47044
|
}
|
|
47021
47045
|
function formatNode(node, indent4) {
|
|
47022
47046
|
if (node.kind === "file")
|
|
47023
47047
|
return [
|
|
47024
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
47048
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk267.dim(counts(node.additions, node.deletions))}`
|
|
47025
47049
|
];
|
|
47026
47050
|
const dir = node;
|
|
47027
47051
|
return [
|
|
47028
|
-
`${indent4}${
|
|
47052
|
+
`${indent4}${chalk267.bold(`${dir.name}/`)} ${chalk267.dim(counts(dir.additions, dir.deletions))}`,
|
|
47029
47053
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
47030
47054
|
];
|
|
47031
47055
|
}
|
|
47032
47056
|
function formatHighLevelStructure(structure) {
|
|
47033
47057
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
47034
47058
|
return [
|
|
47035
|
-
|
|
47059
|
+
chalk267.bold.underline("Structure"),
|
|
47036
47060
|
` ${summary}`,
|
|
47037
47061
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
47038
47062
|
].join("\n");
|
|
47039
47063
|
}
|
|
47040
47064
|
|
|
47041
47065
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
47042
|
-
import
|
|
47066
|
+
import chalk268 from "chalk";
|
|
47043
47067
|
function changeMarker(change) {
|
|
47044
47068
|
if (change === "added") return "A";
|
|
47045
47069
|
if (change === "modified") return "M";
|
|
@@ -47048,22 +47072,22 @@ function changeMarker(change) {
|
|
|
47048
47072
|
function formatNode2(node, depth) {
|
|
47049
47073
|
const indent4 = " ".repeat(depth + 2);
|
|
47050
47074
|
if (node.kind === "it")
|
|
47051
|
-
return [`${indent4}${
|
|
47075
|
+
return [`${indent4}${chalk268.dim(changeMarker(node.change))} ${node.name}`];
|
|
47052
47076
|
return [
|
|
47053
|
-
`${indent4}${
|
|
47077
|
+
`${indent4}${chalk268.bold(node.name)}`,
|
|
47054
47078
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
47055
47079
|
];
|
|
47056
47080
|
}
|
|
47057
47081
|
function formatHighLevelTests(files, testPaths) {
|
|
47058
|
-
const heading2 =
|
|
47082
|
+
const heading2 = chalk268.bold.underline("Changed tests");
|
|
47059
47083
|
if (files.length === 0)
|
|
47060
47084
|
return `${heading2}
|
|
47061
|
-
${
|
|
47085
|
+
${chalk268.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
47062
47086
|
return [
|
|
47063
47087
|
heading2,
|
|
47064
47088
|
...files.flatMap((file) => [
|
|
47065
47089
|
"",
|
|
47066
|
-
` ${
|
|
47090
|
+
` ${chalk268.bold(file.path)} ${chalk268.dim(`(${file.status})`)}`,
|
|
47067
47091
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
47068
47092
|
])
|
|
47069
47093
|
].join("\n");
|
|
@@ -47077,10 +47101,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
47077
47101
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
47078
47102
|
function printHighLevelChecklist(subject) {
|
|
47079
47103
|
console.log(
|
|
47080
|
-
|
|
47104
|
+
chalk269.bold(
|
|
47081
47105
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
47082
47106
|
),
|
|
47083
|
-
|
|
47107
|
+
chalk269.dim(
|
|
47084
47108
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
47085
47109
|
)
|
|
47086
47110
|
);
|
|
@@ -47094,12 +47118,12 @@ function printHighLevelChecklist(subject) {
|
|
|
47094
47118
|
console.log("");
|
|
47095
47119
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
47096
47120
|
console.log(
|
|
47097
|
-
|
|
47121
|
+
chalk269.dim(
|
|
47098
47122
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
47099
47123
|
)
|
|
47100
47124
|
);
|
|
47101
47125
|
console.log(
|
|
47102
|
-
|
|
47126
|
+
chalk269.dim(
|
|
47103
47127
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
47104
47128
|
)
|
|
47105
47129
|
);
|
|
@@ -47145,7 +47169,7 @@ async function runHighLevelReview(number, options2 = {}) {
|
|
|
47145
47169
|
|
|
47146
47170
|
// src/commands/review/reviewPr.ts
|
|
47147
47171
|
import { basename as basename28 } from "path";
|
|
47148
|
-
import
|
|
47172
|
+
import chalk272 from "chalk";
|
|
47149
47173
|
|
|
47150
47174
|
// src/commands/review/resolveSynthesisHarness.ts
|
|
47151
47175
|
var DEFAULT_SYNTHESIS_HARNESS = "claude";
|
|
@@ -48574,18 +48598,18 @@ function partitionFindingsByDiff(findings2, index3) {
|
|
|
48574
48598
|
}
|
|
48575
48599
|
|
|
48576
48600
|
// src/commands/review/warnOutOfDiff.ts
|
|
48577
|
-
import
|
|
48601
|
+
import chalk270 from "chalk";
|
|
48578
48602
|
function warnOutOfDiff(outOfDiff) {
|
|
48579
48603
|
if (outOfDiff.length === 0) return;
|
|
48580
48604
|
console.warn(
|
|
48581
|
-
|
|
48605
|
+
chalk270.yellow(
|
|
48582
48606
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
48583
48607
|
)
|
|
48584
48608
|
);
|
|
48585
48609
|
for (const finding of outOfDiff) {
|
|
48586
48610
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
48587
48611
|
console.warn(
|
|
48588
|
-
` ${
|
|
48612
|
+
` ${chalk270.yellow("\xB7")} ${finding.title} ${chalk270.dim(
|
|
48589
48613
|
`(${finding.file}:${range})`
|
|
48590
48614
|
)}`
|
|
48591
48615
|
);
|
|
@@ -48610,18 +48634,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
48610
48634
|
}
|
|
48611
48635
|
|
|
48612
48636
|
// src/commands/review/warnUnlocated.ts
|
|
48613
|
-
import
|
|
48637
|
+
import chalk271 from "chalk";
|
|
48614
48638
|
function warnUnlocated(unlocated) {
|
|
48615
48639
|
if (unlocated.length === 0) return;
|
|
48616
48640
|
console.warn(
|
|
48617
|
-
|
|
48641
|
+
chalk271.yellow(
|
|
48618
48642
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
48619
48643
|
)
|
|
48620
48644
|
);
|
|
48621
48645
|
for (const finding of unlocated) {
|
|
48622
|
-
const where = finding.location ||
|
|
48646
|
+
const where = finding.location || chalk271.dim("missing");
|
|
48623
48647
|
console.warn(
|
|
48624
|
-
` ${
|
|
48648
|
+
` ${chalk271.yellow("\xB7")} ${finding.title} ${chalk271.dim(`(${where})`)}`
|
|
48625
48649
|
);
|
|
48626
48650
|
}
|
|
48627
48651
|
}
|
|
@@ -48751,7 +48775,7 @@ function runPostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
48751
48775
|
async function reviewPr(repoRoot3, options2) {
|
|
48752
48776
|
const blocker = synthesisBlocker(resolveSynthesisHarness());
|
|
48753
48777
|
if (blocker) {
|
|
48754
|
-
console.error(
|
|
48778
|
+
console.error(chalk272.red(blocker));
|
|
48755
48779
|
process.exitCode = 1;
|
|
48756
48780
|
return;
|
|
48757
48781
|
}
|
|
@@ -48835,7 +48859,7 @@ function validateHighLevel(options2) {
|
|
|
48835
48859
|
}
|
|
48836
48860
|
|
|
48837
48861
|
// src/commands/review/sessionBlocked.ts
|
|
48838
|
-
import
|
|
48862
|
+
import chalk273 from "chalk";
|
|
48839
48863
|
|
|
48840
48864
|
// src/commands/review/reviewSessionFeature.ts
|
|
48841
48865
|
function reviewSessionFeature(options2) {
|
|
@@ -48851,7 +48875,7 @@ function sessionBlocked(options2) {
|
|
|
48851
48875
|
if (!feature) return false;
|
|
48852
48876
|
const blocker = launchBlocker(harnessAdapter(options2.harness), feature);
|
|
48853
48877
|
if (!blocker) return false;
|
|
48854
|
-
console.error(
|
|
48878
|
+
console.error(chalk273.red(blocker));
|
|
48855
48879
|
process.exitCode = 1;
|
|
48856
48880
|
return true;
|
|
48857
48881
|
}
|
|
@@ -48984,7 +49008,7 @@ function registerReview(program) {
|
|
|
48984
49008
|
|
|
48985
49009
|
// src/commands/rules/indexRules.ts
|
|
48986
49010
|
import path96 from "path";
|
|
48987
|
-
import
|
|
49011
|
+
import chalk274 from "chalk";
|
|
48988
49012
|
|
|
48989
49013
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
48990
49014
|
import { existsSync as existsSync81, readFileSync as readFileSync71, writeFileSync as writeFileSync51 } from "fs";
|
|
@@ -49071,24 +49095,24 @@ function indexRules() {
|
|
|
49071
49095
|
const rootFile = path96.relative(process.cwd(), path96.join(root2, "CLAUDE.md"));
|
|
49072
49096
|
if (directories.length === 0) {
|
|
49073
49097
|
console.log(
|
|
49074
|
-
|
|
49098
|
+
chalk274.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
49075
49099
|
);
|
|
49076
49100
|
return;
|
|
49077
49101
|
}
|
|
49078
49102
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
49079
49103
|
for (const directory of directories)
|
|
49080
|
-
console.log(` ${
|
|
49104
|
+
console.log(` ${chalk274.cyan(directory)}`);
|
|
49081
49105
|
}
|
|
49082
49106
|
|
|
49083
49107
|
// src/commands/rules/listRules.ts
|
|
49084
49108
|
import path97 from "path";
|
|
49085
|
-
import
|
|
49109
|
+
import chalk275 from "chalk";
|
|
49086
49110
|
function listRules(target, options2 = {}) {
|
|
49087
49111
|
const resolved = path97.resolve(target ?? process.cwd());
|
|
49088
49112
|
const rules2 = readScopedRules(resolved);
|
|
49089
49113
|
if (rules2.length === 0) {
|
|
49090
49114
|
const label = path97.relative(process.cwd(), resolved) || ".";
|
|
49091
|
-
console.log(
|
|
49115
|
+
console.log(chalk275.gray(`No rules in scope for ${label}`));
|
|
49092
49116
|
return;
|
|
49093
49117
|
}
|
|
49094
49118
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -49098,21 +49122,21 @@ function listRules(target, options2 = {}) {
|
|
|
49098
49122
|
if (rule.source !== shown) {
|
|
49099
49123
|
shown = rule.source;
|
|
49100
49124
|
console.log(
|
|
49101
|
-
|
|
49125
|
+
chalk275.dim(base ? path97.relative(base, rule.source) : rule.source)
|
|
49102
49126
|
);
|
|
49103
49127
|
}
|
|
49104
49128
|
console.log(
|
|
49105
|
-
` ${
|
|
49129
|
+
` ${chalk275.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
49106
49130
|
);
|
|
49107
49131
|
if (options2.full && rule.title)
|
|
49108
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
49132
|
+
console.log(` ${" ".repeat(width2)} ${chalk275.dim(rule.text)}`);
|
|
49109
49133
|
}
|
|
49110
49134
|
}
|
|
49111
49135
|
|
|
49112
49136
|
// src/commands/rules/addRule.ts
|
|
49113
49137
|
import { existsSync as existsSync83, readFileSync as readFileSync73, writeFileSync as writeFileSync52 } from "fs";
|
|
49114
49138
|
import path99 from "path";
|
|
49115
|
-
import
|
|
49139
|
+
import chalk276 from "chalk";
|
|
49116
49140
|
|
|
49117
49141
|
// src/commands/rules/insertRuleBullet.ts
|
|
49118
49142
|
function ruleBullet({ code, title, text: text19 }) {
|
|
@@ -49171,7 +49195,7 @@ function read3(file) {
|
|
|
49171
49195
|
function addRule(text19, options2) {
|
|
49172
49196
|
const rule = text19.trim();
|
|
49173
49197
|
if (rule === "") {
|
|
49174
|
-
console.error(
|
|
49198
|
+
console.error(chalk276.red("Rule text is required"));
|
|
49175
49199
|
process.exitCode = 1;
|
|
49176
49200
|
return;
|
|
49177
49201
|
}
|
|
@@ -49189,14 +49213,14 @@ function addRule(text19, options2) {
|
|
|
49189
49213
|
);
|
|
49190
49214
|
updateScopedRulesIndex(root2);
|
|
49191
49215
|
console.log(
|
|
49192
|
-
`Added ${
|
|
49216
|
+
`Added ${chalk276.cyan(code)} to ${path99.relative(process.cwd(), target) || target}`
|
|
49193
49217
|
);
|
|
49194
49218
|
}
|
|
49195
49219
|
|
|
49196
49220
|
// src/commands/rules/addUserRule.ts
|
|
49197
|
-
import
|
|
49221
|
+
import chalk277 from "chalk";
|
|
49198
49222
|
function fail12(message4) {
|
|
49199
|
-
console.error(
|
|
49223
|
+
console.error(chalk277.red(message4));
|
|
49200
49224
|
process.exitCode = 1;
|
|
49201
49225
|
}
|
|
49202
49226
|
function asRules(value) {
|
|
@@ -49215,7 +49239,7 @@ async function addToUserDb(rule) {
|
|
|
49215
49239
|
rule
|
|
49216
49240
|
]);
|
|
49217
49241
|
if (!result.ok) return fail12(result.errors.join("\n"));
|
|
49218
|
-
console.log(`Added ${
|
|
49242
|
+
console.log(`Added ${chalk277.cyan(rule.title)} to advice.rules in user (db)`);
|
|
49219
49243
|
}
|
|
49220
49244
|
function addToUserNode(rule, globalConfigPath) {
|
|
49221
49245
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -49228,7 +49252,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
49228
49252
|
);
|
|
49229
49253
|
if (!result.ok) return fail12(result.errors.join("\n"));
|
|
49230
49254
|
console.log(
|
|
49231
|
-
`Added ${
|
|
49255
|
+
`Added ${chalk277.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
49232
49256
|
);
|
|
49233
49257
|
}
|
|
49234
49258
|
async function addUserRule(text19, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -49283,7 +49307,7 @@ function registerRules(program) {
|
|
|
49283
49307
|
}
|
|
49284
49308
|
|
|
49285
49309
|
// src/commands/seq/seqAuth.ts
|
|
49286
|
-
import
|
|
49310
|
+
import chalk279 from "chalk";
|
|
49287
49311
|
|
|
49288
49312
|
// src/commands/seq/loadConnections.ts
|
|
49289
49313
|
function loadConnections2() {
|
|
@@ -49312,10 +49336,10 @@ function setDefaultConnection(name2) {
|
|
|
49312
49336
|
}
|
|
49313
49337
|
|
|
49314
49338
|
// src/shared/assertUniqueName.ts
|
|
49315
|
-
import
|
|
49339
|
+
import chalk278 from "chalk";
|
|
49316
49340
|
function assertUniqueName(existingNames, name2) {
|
|
49317
49341
|
if (existingNames.includes(name2)) {
|
|
49318
|
-
console.error(
|
|
49342
|
+
console.error(chalk278.red(`Connection "${name2}" already exists.`));
|
|
49319
49343
|
process.exit(1);
|
|
49320
49344
|
}
|
|
49321
49345
|
}
|
|
@@ -49333,16 +49357,16 @@ async function promptConnection2(existingNames) {
|
|
|
49333
49357
|
var seqAuth = createConnectionAuth({
|
|
49334
49358
|
load: loadConnections2,
|
|
49335
49359
|
save: saveConnections2,
|
|
49336
|
-
format: (c) => `${
|
|
49360
|
+
format: (c) => `${chalk279.bold(c.name)} ${c.url}`,
|
|
49337
49361
|
promptNew: promptConnection2,
|
|
49338
49362
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
49339
49363
|
});
|
|
49340
49364
|
|
|
49341
49365
|
// src/commands/seq/seqQuery.ts
|
|
49342
|
-
import
|
|
49366
|
+
import chalk283 from "chalk";
|
|
49343
49367
|
|
|
49344
49368
|
// src/commands/seq/fetchSeq.ts
|
|
49345
|
-
import
|
|
49369
|
+
import chalk280 from "chalk";
|
|
49346
49370
|
async function fetchSeq(conn, path118, params) {
|
|
49347
49371
|
const url = `${conn.url}${path118}?${params}`;
|
|
49348
49372
|
const response = await fetch(url, {
|
|
@@ -49353,7 +49377,7 @@ async function fetchSeq(conn, path118, params) {
|
|
|
49353
49377
|
});
|
|
49354
49378
|
if (!response.ok) {
|
|
49355
49379
|
const body = await response.text();
|
|
49356
|
-
console.error(
|
|
49380
|
+
console.error(chalk280.red(`Seq returned ${response.status}: ${body}`));
|
|
49357
49381
|
process.exit(1);
|
|
49358
49382
|
}
|
|
49359
49383
|
return response;
|
|
@@ -49412,23 +49436,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
49412
49436
|
}
|
|
49413
49437
|
|
|
49414
49438
|
// src/commands/seq/formatEvent.ts
|
|
49415
|
-
import
|
|
49439
|
+
import chalk281 from "chalk";
|
|
49416
49440
|
function levelColor(level) {
|
|
49417
49441
|
switch (level) {
|
|
49418
49442
|
case "Fatal":
|
|
49419
|
-
return
|
|
49443
|
+
return chalk281.bgRed.white;
|
|
49420
49444
|
case "Error":
|
|
49421
|
-
return
|
|
49445
|
+
return chalk281.red;
|
|
49422
49446
|
case "Warning":
|
|
49423
|
-
return
|
|
49447
|
+
return chalk281.yellow;
|
|
49424
49448
|
case "Information":
|
|
49425
|
-
return
|
|
49449
|
+
return chalk281.cyan;
|
|
49426
49450
|
case "Debug":
|
|
49427
|
-
return
|
|
49451
|
+
return chalk281.gray;
|
|
49428
49452
|
case "Verbose":
|
|
49429
|
-
return
|
|
49453
|
+
return chalk281.dim;
|
|
49430
49454
|
default:
|
|
49431
|
-
return
|
|
49455
|
+
return chalk281.white;
|
|
49432
49456
|
}
|
|
49433
49457
|
}
|
|
49434
49458
|
function levelAbbrev(level) {
|
|
@@ -49469,12 +49493,12 @@ function formatTimestamp(iso) {
|
|
|
49469
49493
|
function formatEvent(event) {
|
|
49470
49494
|
const color = levelColor(event.Level);
|
|
49471
49495
|
const abbrev = levelAbbrev(event.Level);
|
|
49472
|
-
const ts10 =
|
|
49496
|
+
const ts10 = chalk281.dim(formatTimestamp(event.Timestamp));
|
|
49473
49497
|
const msg = renderMessage(event);
|
|
49474
49498
|
const lines = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
49475
49499
|
if (event.Exception) {
|
|
49476
49500
|
for (const line of event.Exception.split("\n")) {
|
|
49477
|
-
lines.push(
|
|
49501
|
+
lines.push(chalk281.red(` ${line}`));
|
|
49478
49502
|
}
|
|
49479
49503
|
}
|
|
49480
49504
|
return lines.join("\n");
|
|
@@ -49507,11 +49531,11 @@ function rejectTimestampFilter(filter) {
|
|
|
49507
49531
|
}
|
|
49508
49532
|
|
|
49509
49533
|
// src/shared/resolveNamedConnection.ts
|
|
49510
|
-
import
|
|
49534
|
+
import chalk282 from "chalk";
|
|
49511
49535
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
49512
49536
|
if (connections.length === 0) {
|
|
49513
49537
|
console.error(
|
|
49514
|
-
|
|
49538
|
+
chalk282.red(
|
|
49515
49539
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
49516
49540
|
)
|
|
49517
49541
|
);
|
|
@@ -49520,7 +49544,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
49520
49544
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
49521
49545
|
const connection = connections.find((c) => c.name === target);
|
|
49522
49546
|
if (!connection) {
|
|
49523
|
-
console.error(
|
|
49547
|
+
console.error(chalk282.red(`${kind} connection "${target}" not found.`));
|
|
49524
49548
|
process.exit(1);
|
|
49525
49549
|
}
|
|
49526
49550
|
return connection;
|
|
@@ -49549,7 +49573,7 @@ async function seqQuery(filter, options2) {
|
|
|
49549
49573
|
new URLSearchParams({ filter, count: String(count10) })
|
|
49550
49574
|
);
|
|
49551
49575
|
if (events.length === 0) {
|
|
49552
|
-
console.log(
|
|
49576
|
+
console.log(chalk283.yellow("No events found."));
|
|
49553
49577
|
return;
|
|
49554
49578
|
}
|
|
49555
49579
|
if (options2.json) {
|
|
@@ -49560,11 +49584,11 @@ async function seqQuery(filter, options2) {
|
|
|
49560
49584
|
for (const event of chronological) {
|
|
49561
49585
|
console.log(formatEvent(event));
|
|
49562
49586
|
}
|
|
49563
|
-
console.log(
|
|
49587
|
+
console.log(chalk283.dim(`
|
|
49564
49588
|
${events.length} events`));
|
|
49565
49589
|
if (events.length >= count10) {
|
|
49566
49590
|
console.log(
|
|
49567
|
-
|
|
49591
|
+
chalk283.yellow(
|
|
49568
49592
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
49569
49593
|
)
|
|
49570
49594
|
);
|
|
@@ -49572,10 +49596,10 @@ ${events.length} events`));
|
|
|
49572
49596
|
}
|
|
49573
49597
|
|
|
49574
49598
|
// src/shared/setNamedDefaultConnection.ts
|
|
49575
|
-
import
|
|
49599
|
+
import chalk284 from "chalk";
|
|
49576
49600
|
function setNamedDefaultConnection(connections, name2, setDefault, kind) {
|
|
49577
49601
|
if (!connections.find((c) => c.name === name2)) {
|
|
49578
|
-
console.error(
|
|
49602
|
+
console.error(chalk284.red(`Connection "${name2}" not found.`));
|
|
49579
49603
|
process.exit(1);
|
|
49580
49604
|
}
|
|
49581
49605
|
setDefault(name2);
|
|
@@ -49826,7 +49850,7 @@ function registerSlack(program) {
|
|
|
49826
49850
|
}
|
|
49827
49851
|
|
|
49828
49852
|
// src/commands/sql/sqlAuth.ts
|
|
49829
|
-
import
|
|
49853
|
+
import chalk286 from "chalk";
|
|
49830
49854
|
|
|
49831
49855
|
// src/commands/sql/loadConnections.ts
|
|
49832
49856
|
function loadConnections3() {
|
|
@@ -49855,7 +49879,7 @@ function setDefaultConnection2(name2) {
|
|
|
49855
49879
|
}
|
|
49856
49880
|
|
|
49857
49881
|
// src/commands/sql/promptConnection.ts
|
|
49858
|
-
import
|
|
49882
|
+
import chalk285 from "chalk";
|
|
49859
49883
|
async function promptConnection3(existingNames) {
|
|
49860
49884
|
const name2 = await promptInput("name", "Connection name:", "default");
|
|
49861
49885
|
assertUniqueName(existingNames, name2);
|
|
@@ -49863,7 +49887,7 @@ async function promptConnection3(existingNames) {
|
|
|
49863
49887
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
49864
49888
|
const port = Number.parseInt(portStr, 10);
|
|
49865
49889
|
if (!Number.isFinite(port)) {
|
|
49866
|
-
console.error(
|
|
49890
|
+
console.error(chalk285.red(`Invalid port "${portStr}".`));
|
|
49867
49891
|
process.exit(1);
|
|
49868
49892
|
}
|
|
49869
49893
|
const user = await promptInput("user", "User:");
|
|
@@ -49876,13 +49900,13 @@ async function promptConnection3(existingNames) {
|
|
|
49876
49900
|
var sqlAuth = createConnectionAuth({
|
|
49877
49901
|
load: loadConnections3,
|
|
49878
49902
|
save: saveConnections3,
|
|
49879
|
-
format: (c) => `${
|
|
49903
|
+
format: (c) => `${chalk286.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
49880
49904
|
promptNew: promptConnection3,
|
|
49881
49905
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
49882
49906
|
});
|
|
49883
49907
|
|
|
49884
49908
|
// src/commands/sql/printTable.ts
|
|
49885
|
-
import
|
|
49909
|
+
import chalk287 from "chalk";
|
|
49886
49910
|
function formatCell(value) {
|
|
49887
49911
|
if (value === null || value === void 0) return "";
|
|
49888
49912
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -49891,7 +49915,7 @@ function formatCell(value) {
|
|
|
49891
49915
|
}
|
|
49892
49916
|
function printTable(rows) {
|
|
49893
49917
|
if (rows.length === 0) {
|
|
49894
|
-
console.log(
|
|
49918
|
+
console.log(chalk287.yellow("(no rows)"));
|
|
49895
49919
|
return;
|
|
49896
49920
|
}
|
|
49897
49921
|
const columns = Object.keys(rows[0]);
|
|
@@ -49899,13 +49923,13 @@ function printTable(rows) {
|
|
|
49899
49923
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
49900
49924
|
);
|
|
49901
49925
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
49902
|
-
console.log(
|
|
49903
|
-
console.log(
|
|
49926
|
+
console.log(chalk287.dim(header));
|
|
49927
|
+
console.log(chalk287.dim("-".repeat(header.length)));
|
|
49904
49928
|
for (const row2 of rows) {
|
|
49905
49929
|
const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
|
|
49906
49930
|
console.log(line);
|
|
49907
49931
|
}
|
|
49908
|
-
console.log(
|
|
49932
|
+
console.log(chalk287.dim(`
|
|
49909
49933
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
49910
49934
|
}
|
|
49911
49935
|
|
|
@@ -49965,7 +49989,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
49965
49989
|
}
|
|
49966
49990
|
|
|
49967
49991
|
// src/commands/sql/sqlMutate.ts
|
|
49968
|
-
import
|
|
49992
|
+
import chalk288 from "chalk";
|
|
49969
49993
|
|
|
49970
49994
|
// src/commands/sql/isMutation.ts
|
|
49971
49995
|
var MUTATION_KEYWORDS = [
|
|
@@ -49999,7 +50023,7 @@ function isMutation(sql33) {
|
|
|
49999
50023
|
async function sqlMutate(query, connectionName) {
|
|
50000
50024
|
if (!isMutation(query)) {
|
|
50001
50025
|
console.error(
|
|
50002
|
-
|
|
50026
|
+
chalk288.red(
|
|
50003
50027
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
50004
50028
|
)
|
|
50005
50029
|
);
|
|
@@ -50009,18 +50033,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
50009
50033
|
const pool = await sqlConnect(conn);
|
|
50010
50034
|
try {
|
|
50011
50035
|
const result = await pool.request().query(query);
|
|
50012
|
-
console.log(
|
|
50036
|
+
console.log(chalk288.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
50013
50037
|
} finally {
|
|
50014
50038
|
await pool.close();
|
|
50015
50039
|
}
|
|
50016
50040
|
}
|
|
50017
50041
|
|
|
50018
50042
|
// src/commands/sql/sqlQuery.ts
|
|
50019
|
-
import
|
|
50043
|
+
import chalk289 from "chalk";
|
|
50020
50044
|
async function sqlQuery(query, connectionName) {
|
|
50021
50045
|
if (isMutation(query)) {
|
|
50022
50046
|
console.error(
|
|
50023
|
-
|
|
50047
|
+
chalk289.red(
|
|
50024
50048
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
50025
50049
|
)
|
|
50026
50050
|
);
|
|
@@ -50035,7 +50059,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
50035
50059
|
printTable(rows);
|
|
50036
50060
|
} else {
|
|
50037
50061
|
console.log(
|
|
50038
|
-
|
|
50062
|
+
chalk289.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
50039
50063
|
);
|
|
50040
50064
|
}
|
|
50041
50065
|
} finally {
|
|
@@ -50527,7 +50551,7 @@ function syncPi(claudeDir, options2) {
|
|
|
50527
50551
|
// src/commands/sync/syncSettings.ts
|
|
50528
50552
|
import * as fs58 from "fs";
|
|
50529
50553
|
import * as path113 from "path";
|
|
50530
|
-
import
|
|
50554
|
+
import chalk290 from "chalk";
|
|
50531
50555
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
50532
50556
|
const source = path113.join(claudeDir, "settings.json");
|
|
50533
50557
|
const target = path113.join(targetBase, "settings.json");
|
|
@@ -50546,7 +50570,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
50546
50570
|
if (mergedContent !== normalizedTarget) {
|
|
50547
50571
|
if (!options2?.yes) {
|
|
50548
50572
|
console.log(
|
|
50549
|
-
|
|
50573
|
+
chalk290.yellow(
|
|
50550
50574
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
50551
50575
|
)
|
|
50552
50576
|
);
|
|
@@ -50554,7 +50578,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
50554
50578
|
printDiff(targetContent, mergedContent);
|
|
50555
50579
|
printAutoConfirmHint();
|
|
50556
50580
|
const confirm = await promptConfirm(
|
|
50557
|
-
|
|
50581
|
+
chalk290.red("Overwrite existing settings.json?"),
|
|
50558
50582
|
false
|
|
50559
50583
|
);
|
|
50560
50584
|
if (!confirm) {
|
|
@@ -50622,17 +50646,17 @@ function registerSync(program) {
|
|
|
50622
50646
|
}
|
|
50623
50647
|
|
|
50624
50648
|
// src/commands/testflight/testflightAdd.ts
|
|
50625
|
-
import
|
|
50649
|
+
import chalk291 from "chalk";
|
|
50626
50650
|
async function testflightAdd(email, options2) {
|
|
50627
50651
|
try {
|
|
50628
50652
|
const config = readTestflightConfig(loadConfig());
|
|
50629
50653
|
const { message: message4, waiting: waiting2 } = await addTesterOutcome(config, email, {
|
|
50630
50654
|
internal: options2.internal
|
|
50631
50655
|
});
|
|
50632
|
-
console.log(waiting2 ?
|
|
50656
|
+
console.log(waiting2 ? chalk291.yellow(message4) : chalk291.green(message4));
|
|
50633
50657
|
} catch (error) {
|
|
50634
50658
|
if (!(error instanceof TestflightError)) throw error;
|
|
50635
|
-
console.error(
|
|
50659
|
+
console.error(chalk291.red(error.message));
|
|
50636
50660
|
process.exit(1);
|
|
50637
50661
|
}
|
|
50638
50662
|
}
|
|
@@ -53561,18 +53585,18 @@ function registerRun(program) {
|
|
|
53561
53585
|
}
|
|
53562
53586
|
|
|
53563
53587
|
// src/commands/sessions/nodes/formatLink.ts
|
|
53564
|
-
import
|
|
53588
|
+
import chalk292 from "chalk";
|
|
53565
53589
|
var STATE_COLOURS = {
|
|
53566
|
-
connected:
|
|
53567
|
-
connecting:
|
|
53568
|
-
disconnected:
|
|
53569
|
-
"version-blocked":
|
|
53590
|
+
connected: chalk292.green,
|
|
53591
|
+
connecting: chalk292.yellow,
|
|
53592
|
+
disconnected: chalk292.red,
|
|
53593
|
+
"version-blocked": chalk292.red
|
|
53570
53594
|
};
|
|
53571
53595
|
function formatLink(link3) {
|
|
53572
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
53596
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk292.white;
|
|
53573
53597
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
53574
53598
|
const error = link3.error ? `
|
|
53575
|
-
${
|
|
53599
|
+
${chalk292.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
53576
53600
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
53577
53601
|
}
|
|
53578
53602
|
|
|
@@ -56547,6 +56571,7 @@ function buildPrPreview(d, kind, prNumber) {
|
|
|
56547
56571
|
kind,
|
|
56548
56572
|
itemType: kind === "backlog-item" ? d.itemType === "bug" ? "bug" : "story" : void 0,
|
|
56549
56573
|
canStart: kind === "backlog-item" && d.canStart === true ? true : void 0,
|
|
56574
|
+
startOrigin: kind === "backlog-item" && typeof d.startOrigin === "string" ? d.startOrigin : void 0,
|
|
56550
56575
|
draft: kind === "pr" && prNumber === null ? draft : void 0,
|
|
56551
56576
|
reviewAfter: kind === "pr" && typeof d.reviewAfter === "boolean" ? d.reviewAfter : void 0,
|
|
56552
56577
|
metadata: parsePreviewMetadata(d.metadata),
|
|
@@ -62411,7 +62436,7 @@ async function closeSession2() {
|
|
|
62411
62436
|
}
|
|
62412
62437
|
|
|
62413
62438
|
// src/commands/sessions/nodes/listNodes.ts
|
|
62414
|
-
import
|
|
62439
|
+
import chalk293 from "chalk";
|
|
62415
62440
|
async function nodesReport() {
|
|
62416
62441
|
const live = await queryNodes();
|
|
62417
62442
|
if (live)
|
|
@@ -62428,10 +62453,10 @@ async function listNodes(options2) {
|
|
|
62428
62453
|
console.log(JSON.stringify(report, null, 2));
|
|
62429
62454
|
return;
|
|
62430
62455
|
}
|
|
62431
|
-
console.log(`${report.local} ${
|
|
62456
|
+
console.log(`${report.local} ${chalk293.dim("(this node)")}`);
|
|
62432
62457
|
if (!report.daemonRunning)
|
|
62433
|
-
console.log(
|
|
62434
|
-
if (report.links.length === 0) console.log(
|
|
62458
|
+
console.log(chalk293.dim(" daemon not running; showing configured links"));
|
|
62459
|
+
if (report.links.length === 0) console.log(chalk293.dim(" no links"));
|
|
62435
62460
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
62436
62461
|
}
|
|
62437
62462
|
|
|
@@ -62453,7 +62478,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
62453
62478
|
}
|
|
62454
62479
|
|
|
62455
62480
|
// src/commands/sessions/nodes/printReport.ts
|
|
62456
|
-
import
|
|
62481
|
+
import chalk294 from "chalk";
|
|
62457
62482
|
function printReport(report) {
|
|
62458
62483
|
if (report.links.length === 0) {
|
|
62459
62484
|
console.log(`${report.local} has no links`);
|
|
@@ -62467,11 +62492,11 @@ function printReport(report) {
|
|
|
62467
62492
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
62468
62493
|
}
|
|
62469
62494
|
function printDiagnosis(diagnosis) {
|
|
62470
|
-
console.log(`${
|
|
62495
|
+
console.log(`${chalk294.bold(diagnosis.name)} ${chalk294.dim(diagnosis.url)}`);
|
|
62471
62496
|
for (const hop of diagnosis.hops) {
|
|
62472
|
-
const mark = hop.ok ?
|
|
62497
|
+
const mark = hop.ok ? chalk294.green("\u2713") : chalk294.red("\u2717");
|
|
62473
62498
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
62474
|
-
if (hop.remediation) console.log(` ${
|
|
62499
|
+
if (hop.remediation) console.log(` ${chalk294.yellow(hop.remediation)}`);
|
|
62475
62500
|
}
|
|
62476
62501
|
}
|
|
62477
62502
|
|
|
@@ -62543,14 +62568,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
|
|
|
62543
62568
|
}
|
|
62544
62569
|
|
|
62545
62570
|
// src/commands/sessions/nodes/linkNode.ts
|
|
62546
|
-
import
|
|
62571
|
+
import chalk297 from "chalk";
|
|
62547
62572
|
|
|
62548
62573
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
62549
|
-
import
|
|
62574
|
+
import chalk295 from "chalk";
|
|
62550
62575
|
async function notifyDaemonLinks() {
|
|
62551
62576
|
if (!await isDaemonRunning()) {
|
|
62552
62577
|
console.log(
|
|
62553
|
-
|
|
62578
|
+
chalk295.yellow(
|
|
62554
62579
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
62555
62580
|
)
|
|
62556
62581
|
);
|
|
@@ -62558,11 +62583,11 @@ async function notifyDaemonLinks() {
|
|
|
62558
62583
|
}
|
|
62559
62584
|
try {
|
|
62560
62585
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
62561
|
-
console.log(
|
|
62586
|
+
console.log(chalk295.dim("The sessions daemon reloaded its links."));
|
|
62562
62587
|
} catch (error) {
|
|
62563
62588
|
const message4 = error instanceof Error ? error.message : String(error);
|
|
62564
62589
|
console.log(
|
|
62565
|
-
|
|
62590
|
+
chalk295.yellow(
|
|
62566
62591
|
`Could not notify the sessions daemon (${message4}); run \`assist daemon restart\` to apply the change.`
|
|
62567
62592
|
)
|
|
62568
62593
|
);
|
|
@@ -62570,7 +62595,7 @@ async function notifyDaemonLinks() {
|
|
|
62570
62595
|
}
|
|
62571
62596
|
|
|
62572
62597
|
// src/commands/sessions/nodes/readLinks.ts
|
|
62573
|
-
import
|
|
62598
|
+
import chalk296 from "chalk";
|
|
62574
62599
|
|
|
62575
62600
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
62576
62601
|
async function writeLinks(links2) {
|
|
@@ -62593,7 +62618,7 @@ async function readLinks() {
|
|
|
62593
62618
|
await writeLinks(links2);
|
|
62594
62619
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
62595
62620
|
console.log(
|
|
62596
|
-
|
|
62621
|
+
chalk296.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
62597
62622
|
);
|
|
62598
62623
|
return links2;
|
|
62599
62624
|
}
|
|
@@ -62649,7 +62674,7 @@ async function linkNode(name2, url, options2) {
|
|
|
62649
62674
|
throw new Error(`${name2} is this node; link to a different node`);
|
|
62650
62675
|
const link3 = await buildLink(name2, url, options2);
|
|
62651
62676
|
await writeLinks([...others, link3]);
|
|
62652
|
-
console.log(
|
|
62677
|
+
console.log(chalk297.green(`Linked ${name2} (${link3.url})`));
|
|
62653
62678
|
await notifyDaemonLinks();
|
|
62654
62679
|
}
|
|
62655
62680
|
|
|
@@ -62832,16 +62857,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
|
|
|
62832
62857
|
}
|
|
62833
62858
|
|
|
62834
62859
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
62835
|
-
import
|
|
62860
|
+
import chalk298 from "chalk";
|
|
62836
62861
|
async function unlinkNode(name2) {
|
|
62837
62862
|
const links2 = await readLinks();
|
|
62838
62863
|
const remaining = links2.filter((link3) => link3.name !== name2);
|
|
62839
62864
|
if (remaining.length === links2.length) {
|
|
62840
|
-
console.log(
|
|
62865
|
+
console.log(chalk298.yellow(`No link named ${name2}`));
|
|
62841
62866
|
return;
|
|
62842
62867
|
}
|
|
62843
62868
|
await writeLinks(remaining);
|
|
62844
|
-
console.log(
|
|
62869
|
+
console.log(chalk298.green(`Unlinked ${name2}`));
|
|
62845
62870
|
await notifyDaemonLinks();
|
|
62846
62871
|
}
|
|
62847
62872
|
|
|
@@ -63090,10 +63115,10 @@ function createProgram() {
|
|
|
63090
63115
|
}
|
|
63091
63116
|
|
|
63092
63117
|
// src/reportCliError.ts
|
|
63093
|
-
import
|
|
63118
|
+
import chalk299 from "chalk";
|
|
63094
63119
|
function reportCliError(error) {
|
|
63095
63120
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
63096
|
-
console.error(
|
|
63121
|
+
console.error(chalk299.red(error.message));
|
|
63097
63122
|
} else {
|
|
63098
63123
|
console.error(error);
|
|
63099
63124
|
}
|