@staff0rd/assist 0.1016.1 → 0.1016.2
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/claude/commands/devlog.md +26 -23
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +850 -766
- 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.1016.
|
|
9
|
+
version: "0.1016.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1742,7 +1742,7 @@ function createPendingReplies() {
|
|
|
1742
1742
|
return entry;
|
|
1743
1743
|
}
|
|
1744
1744
|
return {
|
|
1745
|
-
send(ws, timeoutMs,
|
|
1745
|
+
send(ws, timeoutMs, write2) {
|
|
1746
1746
|
const id = randomUUID();
|
|
1747
1747
|
return new Promise((resolve32, reject) => {
|
|
1748
1748
|
const timer = setTimeout(() => {
|
|
@@ -1755,7 +1755,7 @@ function createPendingReplies() {
|
|
|
1755
1755
|
);
|
|
1756
1756
|
}, timeoutMs);
|
|
1757
1757
|
pending.set(id, { ws, timer, resolve: resolve32, reject });
|
|
1758
|
-
|
|
1758
|
+
write2(id);
|
|
1759
1759
|
});
|
|
1760
1760
|
},
|
|
1761
1761
|
settle(id, reply2) {
|
|
@@ -11434,7 +11434,7 @@ var configScopeNames = {
|
|
|
11434
11434
|
};
|
|
11435
11435
|
|
|
11436
11436
|
// src/commands/config/applyDbBackedConfigWrite.ts
|
|
11437
|
-
async function applyDbBackedConfigWrite(key, scope,
|
|
11437
|
+
async function applyDbBackedConfigWrite(key, scope, write2) {
|
|
11438
11438
|
const target = configScopeNames.user;
|
|
11439
11439
|
if (scope !== "user")
|
|
11440
11440
|
return {
|
|
@@ -11443,12 +11443,12 @@ async function applyDbBackedConfigWrite(key, scope, write) {
|
|
|
11443
11443
|
};
|
|
11444
11444
|
const handler = dbBackedConfigKeys[key];
|
|
11445
11445
|
const db = await getDb();
|
|
11446
|
-
if ("unset" in
|
|
11446
|
+
if ("unset" in write2)
|
|
11447
11447
|
return {
|
|
11448
11448
|
ok: true,
|
|
11449
11449
|
payload: { target, removed: await handler.unset(db) }
|
|
11450
11450
|
};
|
|
11451
|
-
await handler.write(db,
|
|
11451
|
+
await handler.write(db, write2.value);
|
|
11452
11452
|
return { ok: true, payload: { target } };
|
|
11453
11453
|
}
|
|
11454
11454
|
|
|
@@ -25633,6 +25633,127 @@ function next2(options2) {
|
|
|
25633
25633
|
);
|
|
25634
25634
|
}
|
|
25635
25635
|
|
|
25636
|
+
// src/commands/devlog/skip.ts
|
|
25637
|
+
import { writeFileSync as writeFileSync32 } from "fs";
|
|
25638
|
+
import { join as join69 } from "path";
|
|
25639
|
+
import chalk162 from "chalk";
|
|
25640
|
+
import { stringify as stringifyYaml3 } from "yaml";
|
|
25641
|
+
function getBlogConfigPath() {
|
|
25642
|
+
return join69(BLOG_REPO_ROOT, "assist.yml");
|
|
25643
|
+
}
|
|
25644
|
+
function skip2(week) {
|
|
25645
|
+
if (!isValidWeek(week)) {
|
|
25646
|
+
console.log(chalk162.red("Invalid week. Use YYYY-Www (e.g. 2026-W33)"));
|
|
25647
|
+
process.exit(1);
|
|
25648
|
+
}
|
|
25649
|
+
const repoName = getRepoName();
|
|
25650
|
+
const configPath = getBlogConfigPath();
|
|
25651
|
+
const config = loadRawYaml(configPath);
|
|
25652
|
+
const devlog = config.devlog ?? {};
|
|
25653
|
+
const skip3 = devlog.skip ?? {};
|
|
25654
|
+
const skipWeeks = skip3[repoName] ?? [];
|
|
25655
|
+
if (skipWeeks.includes(week)) {
|
|
25656
|
+
console.log(
|
|
25657
|
+
chalk162.yellow(`${week} is already in skip list for ${repoName}`)
|
|
25658
|
+
);
|
|
25659
|
+
return;
|
|
25660
|
+
}
|
|
25661
|
+
skipWeeks.push(week);
|
|
25662
|
+
skipWeeks.sort();
|
|
25663
|
+
skip3[repoName] = skipWeeks;
|
|
25664
|
+
devlog.skip = skip3;
|
|
25665
|
+
config.devlog = devlog;
|
|
25666
|
+
writeFileSync32(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25667
|
+
console.log(chalk162.green(`Added ${week} to skip list for ${repoName}`));
|
|
25668
|
+
}
|
|
25669
|
+
|
|
25670
|
+
// src/commands/devlog/write.ts
|
|
25671
|
+
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync33 } from "fs";
|
|
25672
|
+
import { dirname as dirname31, join as join70 } from "path";
|
|
25673
|
+
import chalk163 from "chalk";
|
|
25674
|
+
|
|
25675
|
+
// src/commands/devlog/write/devEntryInputSchema.ts
|
|
25676
|
+
import { z as z14 } from "zod";
|
|
25677
|
+
var oneLine = z14.string().trim().min(1).refine((value) => !value.includes("\n"), "must be a single line");
|
|
25678
|
+
var changeItems = z14.array(z14.object({ text: oneLine, version: oneLine.optional() }).strict()).default([]);
|
|
25679
|
+
var devEntryInputSchema = z14.object({
|
|
25680
|
+
week: z14.string().refine(isValidWeek, "must be an ISO week like 2026-W33"),
|
|
25681
|
+
title: oneLine,
|
|
25682
|
+
versions: z14.object({ first: oneLine, last: oneLine }).strict().optional(),
|
|
25683
|
+
aiGenerated: oneLine,
|
|
25684
|
+
added: changeItems,
|
|
25685
|
+
changed: changeItems,
|
|
25686
|
+
fixed: changeItems,
|
|
25687
|
+
lede: z14.string().trim().min(1)
|
|
25688
|
+
}).strict();
|
|
25689
|
+
|
|
25690
|
+
// src/commands/devlog/write/formatDevEntry.ts
|
|
25691
|
+
import { parse as parseYaml4, stringify as stringifyYaml4 } from "yaml";
|
|
25692
|
+
function buildFrontmatter(project, entry) {
|
|
25693
|
+
const frontmatter2 = {
|
|
25694
|
+
project,
|
|
25695
|
+
week: entry.week,
|
|
25696
|
+
title: entry.title
|
|
25697
|
+
};
|
|
25698
|
+
if (entry.versions) frontmatter2.versions = entry.versions;
|
|
25699
|
+
frontmatter2["ai-generated"] = entry.aiGenerated;
|
|
25700
|
+
for (const key of ["added", "changed", "fixed"]) {
|
|
25701
|
+
if (entry[key].length > 0) frontmatter2[key] = entry[key];
|
|
25702
|
+
}
|
|
25703
|
+
return frontmatter2;
|
|
25704
|
+
}
|
|
25705
|
+
function formatDevEntry(project, entry) {
|
|
25706
|
+
const frontmatter2 = buildFrontmatter(project, entry);
|
|
25707
|
+
const yaml = stringifyYaml4(frontmatter2, {
|
|
25708
|
+
lineWidth: 0,
|
|
25709
|
+
defaultKeyType: "PLAIN",
|
|
25710
|
+
defaultStringType: "QUOTE_DOUBLE"
|
|
25711
|
+
});
|
|
25712
|
+
if (JSON.stringify(parseYaml4(yaml)) !== JSON.stringify(frontmatter2)) {
|
|
25713
|
+
throw new Error("Generated frontmatter does not round-trip");
|
|
25714
|
+
}
|
|
25715
|
+
return `---
|
|
25716
|
+
${yaml}---
|
|
25717
|
+
|
|
25718
|
+
${entry.lede.trim()}
|
|
25719
|
+
`;
|
|
25720
|
+
}
|
|
25721
|
+
|
|
25722
|
+
// src/commands/devlog/write.ts
|
|
25723
|
+
function parseInput(raw) {
|
|
25724
|
+
try {
|
|
25725
|
+
return JSON.parse(raw);
|
|
25726
|
+
} catch (error) {
|
|
25727
|
+
console.error(chalk163.red(`Invalid JSON on stdin: ${String(error)}`));
|
|
25728
|
+
process.exit(1);
|
|
25729
|
+
}
|
|
25730
|
+
}
|
|
25731
|
+
async function write() {
|
|
25732
|
+
const result = devEntryInputSchema.safeParse(parseInput(await readStdin()));
|
|
25733
|
+
if (!result.success) {
|
|
25734
|
+
for (const issue of result.error.issues) {
|
|
25735
|
+
console.error(chalk163.red(`${issue.path.join(".")}: ${issue.message}`));
|
|
25736
|
+
}
|
|
25737
|
+
process.exit(1);
|
|
25738
|
+
}
|
|
25739
|
+
const repoName = getRepoName();
|
|
25740
|
+
const path109 = join70(DEV_DIR, repoName, `${result.data.week.toLowerCase()}.md`);
|
|
25741
|
+
mkdirSync20(dirname31(path109), { recursive: true });
|
|
25742
|
+
writeFileSync33(path109, formatDevEntry(repoName, result.data));
|
|
25743
|
+
console.log(chalk163.green(`Wrote ${path109}`));
|
|
25744
|
+
}
|
|
25745
|
+
|
|
25746
|
+
// src/commands/devlog/registerDevlogEntryCommands.ts
|
|
25747
|
+
function registerDevlogEntryCommands(devlogCommand) {
|
|
25748
|
+
devlogCommand.command("next").description(
|
|
25749
|
+
"Show commits for the next completed ISO week after the last dev entry"
|
|
25750
|
+
).option("-v, --verbose", "Show file names for each commit").action(next2);
|
|
25751
|
+
devlogCommand.command("skip <week>").description("Add an ISO week (YYYY-Www) to the skip list").action(skip2);
|
|
25752
|
+
devlogCommand.command("write").description(
|
|
25753
|
+
"Write a dev entry from JSON on stdin (week, title, versions, aiGenerated, added/changed/fixed, lede)"
|
|
25754
|
+
).action(write);
|
|
25755
|
+
}
|
|
25756
|
+
|
|
25636
25757
|
// src/commands/devlog/repos.ts
|
|
25637
25758
|
import { execSync as execSync34 } from "child_process";
|
|
25638
25759
|
|
|
@@ -25663,11 +25784,11 @@ function getRepoStatus(lastPush, lastWeek, today) {
|
|
|
25663
25784
|
}
|
|
25664
25785
|
|
|
25665
25786
|
// src/commands/devlog/repos/printReposTable.ts
|
|
25666
|
-
import
|
|
25787
|
+
import chalk164 from "chalk";
|
|
25667
25788
|
function colorStatus(status2) {
|
|
25668
|
-
if (status2 === "missing") return
|
|
25669
|
-
if (status2 === "outdated") return
|
|
25670
|
-
return
|
|
25789
|
+
if (status2 === "missing") return chalk164.red(status2);
|
|
25790
|
+
if (status2 === "outdated") return chalk164.yellow(status2);
|
|
25791
|
+
return chalk164.green(status2);
|
|
25671
25792
|
}
|
|
25672
25793
|
function formatRow(row3, nameWidth) {
|
|
25673
25794
|
const week = (row3.lastWeek ?? "-").padEnd(9);
|
|
@@ -25681,8 +25802,8 @@ function printReposTable(rows) {
|
|
|
25681
25802
|
"Last Week".padEnd(9),
|
|
25682
25803
|
"Status"
|
|
25683
25804
|
].join(" ");
|
|
25684
|
-
console.log(
|
|
25685
|
-
console.log(
|
|
25805
|
+
console.log(chalk164.dim(header));
|
|
25806
|
+
console.log(chalk164.dim("-".repeat(header.length)));
|
|
25686
25807
|
for (const row3 of rows) {
|
|
25687
25808
|
console.log(formatRow(row3, nameWidth));
|
|
25688
25809
|
}
|
|
@@ -25734,44 +25855,10 @@ function repos(options2) {
|
|
|
25734
25855
|
printReposTable(sortRows(rows));
|
|
25735
25856
|
}
|
|
25736
25857
|
|
|
25737
|
-
// src/commands/devlog/skip.ts
|
|
25738
|
-
import { writeFileSync as writeFileSync32 } from "fs";
|
|
25739
|
-
import { join as join69 } from "path";
|
|
25740
|
-
import chalk163 from "chalk";
|
|
25741
|
-
import { stringify as stringifyYaml3 } from "yaml";
|
|
25742
|
-
function getBlogConfigPath() {
|
|
25743
|
-
return join69(BLOG_REPO_ROOT, "assist.yml");
|
|
25744
|
-
}
|
|
25745
|
-
function skip2(week) {
|
|
25746
|
-
if (!isValidWeek(week)) {
|
|
25747
|
-
console.log(chalk163.red("Invalid week. Use YYYY-Www (e.g. 2026-W33)"));
|
|
25748
|
-
process.exit(1);
|
|
25749
|
-
}
|
|
25750
|
-
const repoName = getRepoName();
|
|
25751
|
-
const configPath = getBlogConfigPath();
|
|
25752
|
-
const config = loadRawYaml(configPath);
|
|
25753
|
-
const devlog = config.devlog ?? {};
|
|
25754
|
-
const skip3 = devlog.skip ?? {};
|
|
25755
|
-
const skipWeeks = skip3[repoName] ?? [];
|
|
25756
|
-
if (skipWeeks.includes(week)) {
|
|
25757
|
-
console.log(
|
|
25758
|
-
chalk163.yellow(`${week} is already in skip list for ${repoName}`)
|
|
25759
|
-
);
|
|
25760
|
-
return;
|
|
25761
|
-
}
|
|
25762
|
-
skipWeeks.push(week);
|
|
25763
|
-
skipWeeks.sort();
|
|
25764
|
-
skip3[repoName] = skipWeeks;
|
|
25765
|
-
devlog.skip = skip3;
|
|
25766
|
-
config.devlog = devlog;
|
|
25767
|
-
writeFileSync32(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
25768
|
-
console.log(chalk163.green(`Added ${week} to skip list for ${repoName}`));
|
|
25769
|
-
}
|
|
25770
|
-
|
|
25771
25858
|
// src/commands/devlog/version.ts
|
|
25772
|
-
import
|
|
25859
|
+
import chalk165 from "chalk";
|
|
25773
25860
|
function printField2(label, value) {
|
|
25774
|
-
console.log(`${
|
|
25861
|
+
console.log(`${chalk165.bold(`${label}:`)} ${value ?? chalk165.dim("none")}`);
|
|
25775
25862
|
}
|
|
25776
25863
|
function version() {
|
|
25777
25864
|
const name = getRepoName();
|
|
@@ -25796,10 +25883,7 @@ function registerDevlog(program) {
|
|
|
25796
25883
|
"Only show commits since this date (YYYY-MM-DD) or week (YYYY-Www)"
|
|
25797
25884
|
).option("-r, --reverse", "Show earliest weeks first").option("-v, --verbose", "Show file names for each commit").action(list2);
|
|
25798
25885
|
devlogCommand.command("version").description("Show the repo name, its latest dev entry week and versions").action(version);
|
|
25799
|
-
devlogCommand
|
|
25800
|
-
"Show commits for the next completed ISO week after the last dev entry"
|
|
25801
|
-
).option("-v, --verbose", "Show file names for each commit").action(next2);
|
|
25802
|
-
devlogCommand.command("skip <week>").description("Add an ISO week (YYYY-Www) to the skip list").action(skip2);
|
|
25886
|
+
registerDevlogEntryCommands(devlogCommand);
|
|
25803
25887
|
devlogCommand.command("repos").description("Show repos missing weekly dev entries").option(
|
|
25804
25888
|
"--days <number>",
|
|
25805
25889
|
"Only show repos pushed within N days (default: 30)",
|
|
@@ -25809,7 +25893,7 @@ function registerDevlog(program) {
|
|
|
25809
25893
|
}
|
|
25810
25894
|
|
|
25811
25895
|
// src/commands/docs/docsConfirm.ts
|
|
25812
|
-
import
|
|
25896
|
+
import chalk166 from "chalk";
|
|
25813
25897
|
|
|
25814
25898
|
// src/commands/notify/forwardPinConfirm.ts
|
|
25815
25899
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
@@ -25829,9 +25913,9 @@ async function forwardPinConfirm(area, pin2) {
|
|
|
25829
25913
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
25830
25914
|
|
|
25831
25915
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
25832
|
-
import { join as
|
|
25916
|
+
import { join as join71 } from "path";
|
|
25833
25917
|
function getDocsUnlockPinPath(pin2) {
|
|
25834
|
-
return
|
|
25918
|
+
return join71(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
|
|
25835
25919
|
}
|
|
25836
25920
|
|
|
25837
25921
|
// src/commands/docs/readDocsUnlockPinState.ts
|
|
@@ -25896,22 +25980,22 @@ async function approveDocsUnlock(pin2) {
|
|
|
25896
25980
|
async function docsConfirm(pin2) {
|
|
25897
25981
|
const result = await approveDocsUnlock(pin2) ?? await forwardPinConfirm("docs", pin2);
|
|
25898
25982
|
if (!result) {
|
|
25899
|
-
console.error(
|
|
25983
|
+
console.error(chalk166.red(`No pending docs unlock for pin: ${pin2}`));
|
|
25900
25984
|
process.exitCode = 1;
|
|
25901
25985
|
return;
|
|
25902
25986
|
}
|
|
25903
25987
|
if (result.ok) {
|
|
25904
|
-
console.log(
|
|
25988
|
+
console.log(chalk166.green(result.message));
|
|
25905
25989
|
return;
|
|
25906
25990
|
}
|
|
25907
|
-
console.error(
|
|
25991
|
+
console.error(chalk166.red(result.message));
|
|
25908
25992
|
process.exitCode = 1;
|
|
25909
25993
|
}
|
|
25910
25994
|
|
|
25911
25995
|
// src/commands/docs/docsUnlock.ts
|
|
25912
25996
|
import { randomInt as randomInt3 } from "crypto";
|
|
25913
|
-
import { mkdirSync as
|
|
25914
|
-
import
|
|
25997
|
+
import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as writeFileSync34 } from "fs";
|
|
25998
|
+
import chalk167 from "chalk";
|
|
25915
25999
|
|
|
25916
26000
|
// src/commands/notify/deliverPinNotification.ts
|
|
25917
26001
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
@@ -25937,7 +26021,7 @@ async function deliverPinNotification(notification) {
|
|
|
25937
26021
|
|
|
25938
26022
|
// src/commands/docs/docsUnlock.ts
|
|
25939
26023
|
function fail7(message3) {
|
|
25940
|
-
console.error(
|
|
26024
|
+
console.error(chalk167.red(message3));
|
|
25941
26025
|
process.exitCode = 1;
|
|
25942
26026
|
}
|
|
25943
26027
|
async function docsUnlock() {
|
|
@@ -25956,10 +26040,10 @@ async function docsUnlock() {
|
|
|
25956
26040
|
const phase = found.item.currentPhase ?? 1;
|
|
25957
26041
|
const label = `${formatItemId(itemId2)} ${found.item.name} (phase ${phase})`;
|
|
25958
26042
|
const pin2 = randomInt3(0, 1e3).toString().padStart(3, "0");
|
|
25959
|
-
|
|
26043
|
+
mkdirSync21(getRestrictedDir(), { recursive: true });
|
|
25960
26044
|
sweepRestrictedDir();
|
|
25961
26045
|
const pinPath = getDocsUnlockPinPath(pin2);
|
|
25962
|
-
|
|
26046
|
+
writeFileSync34(pinPath, JSON.stringify({ pin: pin2, itemId: itemId2, phase }));
|
|
25963
26047
|
const { delivered, node } = await deliverPinNotification({
|
|
25964
26048
|
area: "docs",
|
|
25965
26049
|
pin: pin2,
|
|
@@ -25976,7 +26060,7 @@ async function docsUnlock() {
|
|
|
25976
26060
|
console.log(
|
|
25977
26061
|
`A confirmation pin was sent to the user's desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
25978
26062
|
To let this phase of ${label} edit docs pages and screenshots, the user runs${node ? ` on ${node}` : ""}:
|
|
25979
|
-
${
|
|
26063
|
+
${chalk167.cyan(" assist docs confirm <PIN>")}
|
|
25980
26064
|
Wait for the user to confirm before editing docs.`
|
|
25981
26065
|
);
|
|
25982
26066
|
}
|
|
@@ -26003,8 +26087,8 @@ function registerDocs(parent) {
|
|
|
26003
26087
|
|
|
26004
26088
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
26005
26089
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync10 } from "fs";
|
|
26006
|
-
import { join as
|
|
26007
|
-
import
|
|
26090
|
+
import { join as join72 } from "path";
|
|
26091
|
+
import chalk168 from "chalk";
|
|
26008
26092
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
26009
26093
|
function isLockedDll(debugDir) {
|
|
26010
26094
|
let files;
|
|
@@ -26015,7 +26099,7 @@ function isLockedDll(debugDir) {
|
|
|
26015
26099
|
}
|
|
26016
26100
|
for (const file of files) {
|
|
26017
26101
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
26018
|
-
const dllPath =
|
|
26102
|
+
const dllPath = join72(debugDir, file);
|
|
26019
26103
|
try {
|
|
26020
26104
|
const fd = openSync5(dllPath, "r+");
|
|
26021
26105
|
closeSync4(fd);
|
|
@@ -26033,13 +26117,13 @@ function findFirstLockedDll(dir) {
|
|
|
26033
26117
|
return null;
|
|
26034
26118
|
}
|
|
26035
26119
|
if (entries.includes("bin")) {
|
|
26036
|
-
const locked = isLockedDll(
|
|
26120
|
+
const locked = isLockedDll(join72(dir, "bin", "Debug"));
|
|
26037
26121
|
if (locked) return locked;
|
|
26038
26122
|
}
|
|
26039
26123
|
for (const entry of entries) {
|
|
26040
26124
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
26041
26125
|
continue;
|
|
26042
|
-
const found = findFirstLockedDll(
|
|
26126
|
+
const found = findFirstLockedDll(join72(dir, entry));
|
|
26043
26127
|
if (found) return found;
|
|
26044
26128
|
}
|
|
26045
26129
|
return null;
|
|
@@ -26051,14 +26135,14 @@ function checkBuildLocks(startDir) {
|
|
|
26051
26135
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
26052
26136
|
if (locked) {
|
|
26053
26137
|
console.error(
|
|
26054
|
-
|
|
26138
|
+
chalk168.red("Build output locked (is VS debugging?): ") + locked
|
|
26055
26139
|
);
|
|
26056
26140
|
process.exit(1);
|
|
26057
26141
|
}
|
|
26058
26142
|
}
|
|
26059
26143
|
async function checkBuildLocksCommand() {
|
|
26060
26144
|
checkBuildLocks();
|
|
26061
|
-
console.log(
|
|
26145
|
+
console.log(chalk168.green("No build locks detected"));
|
|
26062
26146
|
}
|
|
26063
26147
|
|
|
26064
26148
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -26157,30 +26241,30 @@ function escapeRegex(s) {
|
|
|
26157
26241
|
}
|
|
26158
26242
|
|
|
26159
26243
|
// src/commands/dotnet/printTree.ts
|
|
26160
|
-
import
|
|
26244
|
+
import chalk169 from "chalk";
|
|
26161
26245
|
function printNodes(nodes, prefix2) {
|
|
26162
26246
|
for (let i = 0; i < nodes.length; i++) {
|
|
26163
26247
|
const isLast = i === nodes.length - 1;
|
|
26164
26248
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
26165
26249
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
26166
26250
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
26167
|
-
const label = isMissing ?
|
|
26251
|
+
const label = isMissing ? chalk169.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
26168
26252
|
console.log(`${prefix2}${connector}${label}`);
|
|
26169
26253
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
26170
26254
|
}
|
|
26171
26255
|
}
|
|
26172
26256
|
function printTree(tree, totalCount, solutions) {
|
|
26173
|
-
console.log(
|
|
26174
|
-
console.log(
|
|
26257
|
+
console.log(chalk169.bold("\nProject Dependency Tree"));
|
|
26258
|
+
console.log(chalk169.cyan(tree.relativePath));
|
|
26175
26259
|
printNodes(tree.children, "");
|
|
26176
|
-
console.log(
|
|
26260
|
+
console.log(chalk169.dim(`
|
|
26177
26261
|
${totalCount} projects total (including root)`));
|
|
26178
|
-
console.log(
|
|
26262
|
+
console.log(chalk169.bold("\nSolution Membership"));
|
|
26179
26263
|
if (solutions.length === 0) {
|
|
26180
|
-
console.log(
|
|
26264
|
+
console.log(chalk169.yellow(" Not found in any .sln"));
|
|
26181
26265
|
} else {
|
|
26182
26266
|
for (const sln of solutions) {
|
|
26183
|
-
console.log(` ${
|
|
26267
|
+
console.log(` ${chalk169.green(sln)}`);
|
|
26184
26268
|
}
|
|
26185
26269
|
}
|
|
26186
26270
|
console.log();
|
|
@@ -26209,16 +26293,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
26209
26293
|
// src/commands/dotnet/resolveCsproj.ts
|
|
26210
26294
|
import { existsSync as existsSync56 } from "fs";
|
|
26211
26295
|
import path37 from "path";
|
|
26212
|
-
import
|
|
26296
|
+
import chalk170 from "chalk";
|
|
26213
26297
|
function resolveCsproj(csprojPath) {
|
|
26214
26298
|
const resolved = path37.resolve(csprojPath);
|
|
26215
26299
|
if (!existsSync56(resolved)) {
|
|
26216
|
-
console.error(
|
|
26300
|
+
console.error(chalk170.red(`File not found: ${resolved}`));
|
|
26217
26301
|
process.exit(1);
|
|
26218
26302
|
}
|
|
26219
26303
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
26220
26304
|
if (!repoRoot2) {
|
|
26221
|
-
console.error(
|
|
26305
|
+
console.error(chalk170.red("Could not find git repository root"));
|
|
26222
26306
|
process.exit(1);
|
|
26223
26307
|
}
|
|
26224
26308
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -26268,12 +26352,12 @@ function getChangedCsFiles(scope) {
|
|
|
26268
26352
|
}
|
|
26269
26353
|
|
|
26270
26354
|
// src/commands/dotnet/inSln.ts
|
|
26271
|
-
import
|
|
26355
|
+
import chalk171 from "chalk";
|
|
26272
26356
|
async function inSln(csprojPath) {
|
|
26273
26357
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
26274
26358
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
26275
26359
|
if (solutions.length === 0) {
|
|
26276
|
-
console.log(
|
|
26360
|
+
console.log(chalk171.yellow("Not found in any .sln file"));
|
|
26277
26361
|
process.exit(1);
|
|
26278
26362
|
}
|
|
26279
26363
|
for (const sln of solutions) {
|
|
@@ -26282,7 +26366,7 @@ async function inSln(csprojPath) {
|
|
|
26282
26366
|
}
|
|
26283
26367
|
|
|
26284
26368
|
// src/commands/dotnet/inspect.ts
|
|
26285
|
-
import
|
|
26369
|
+
import chalk177 from "chalk";
|
|
26286
26370
|
|
|
26287
26371
|
// src/shared/formatElapsed.ts
|
|
26288
26372
|
function formatElapsed(ms) {
|
|
@@ -26294,12 +26378,12 @@ function formatElapsed(ms) {
|
|
|
26294
26378
|
}
|
|
26295
26379
|
|
|
26296
26380
|
// src/commands/dotnet/displayIssues.ts
|
|
26297
|
-
import
|
|
26381
|
+
import chalk172 from "chalk";
|
|
26298
26382
|
var SEVERITY_COLOR = {
|
|
26299
|
-
ERROR:
|
|
26300
|
-
WARNING:
|
|
26301
|
-
SUGGESTION:
|
|
26302
|
-
HINT:
|
|
26383
|
+
ERROR: chalk172.red,
|
|
26384
|
+
WARNING: chalk172.yellow,
|
|
26385
|
+
SUGGESTION: chalk172.cyan,
|
|
26386
|
+
HINT: chalk172.dim
|
|
26303
26387
|
};
|
|
26304
26388
|
function groupByFile(issues) {
|
|
26305
26389
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -26315,15 +26399,15 @@ function groupByFile(issues) {
|
|
|
26315
26399
|
}
|
|
26316
26400
|
function displayIssues(issues) {
|
|
26317
26401
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
26318
|
-
console.log(
|
|
26402
|
+
console.log(chalk172.bold(file));
|
|
26319
26403
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
26320
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
26404
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk172.white;
|
|
26321
26405
|
console.log(
|
|
26322
|
-
` ${
|
|
26406
|
+
` ${chalk172.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
26323
26407
|
);
|
|
26324
26408
|
}
|
|
26325
26409
|
}
|
|
26326
|
-
console.log(
|
|
26410
|
+
console.log(chalk172.dim(`
|
|
26327
26411
|
${issues.length} issue(s) found`));
|
|
26328
26412
|
}
|
|
26329
26413
|
|
|
@@ -26382,15 +26466,15 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
26382
26466
|
// src/commands/dotnet/resolveSolution.ts
|
|
26383
26467
|
import { existsSync as existsSync57 } from "fs";
|
|
26384
26468
|
import path38 from "path";
|
|
26385
|
-
import
|
|
26469
|
+
import chalk174 from "chalk";
|
|
26386
26470
|
|
|
26387
26471
|
// src/commands/dotnet/findSolution.ts
|
|
26388
26472
|
import { readdirSync as readdirSync12 } from "fs";
|
|
26389
|
-
import { dirname as
|
|
26390
|
-
import
|
|
26473
|
+
import { dirname as dirname32, join as join73 } from "path";
|
|
26474
|
+
import chalk173 from "chalk";
|
|
26391
26475
|
function findSlnInDir(dir) {
|
|
26392
26476
|
try {
|
|
26393
|
-
return readdirSync12(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
26477
|
+
return readdirSync12(dir).filter((f) => f.endsWith(".sln")).map((f) => join73(dir, f));
|
|
26394
26478
|
} catch {
|
|
26395
26479
|
return [];
|
|
26396
26480
|
}
|
|
@@ -26403,17 +26487,17 @@ function findSolution() {
|
|
|
26403
26487
|
const slnFiles = findSlnInDir(current);
|
|
26404
26488
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
26405
26489
|
if (slnFiles.length > 1) {
|
|
26406
|
-
console.error(
|
|
26490
|
+
console.error(chalk173.red(`Multiple .sln files found in ${current}:`));
|
|
26407
26491
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
26408
26492
|
console.error(
|
|
26409
|
-
|
|
26493
|
+
chalk173.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
26410
26494
|
);
|
|
26411
26495
|
process.exit(1);
|
|
26412
26496
|
}
|
|
26413
26497
|
if (current === ceiling) break;
|
|
26414
|
-
current =
|
|
26498
|
+
current = dirname32(current);
|
|
26415
26499
|
}
|
|
26416
|
-
console.error(
|
|
26500
|
+
console.error(chalk173.red("No .sln file found between cwd and repo root"));
|
|
26417
26501
|
process.exit(1);
|
|
26418
26502
|
}
|
|
26419
26503
|
|
|
@@ -26422,7 +26506,7 @@ function resolveSolution(sln) {
|
|
|
26422
26506
|
if (sln) {
|
|
26423
26507
|
const resolved = path38.resolve(sln);
|
|
26424
26508
|
if (!existsSync57(resolved)) {
|
|
26425
|
-
console.error(
|
|
26509
|
+
console.error(chalk174.red(`Solution file not found: ${resolved}`));
|
|
26426
26510
|
process.exit(1);
|
|
26427
26511
|
}
|
|
26428
26512
|
return resolved;
|
|
@@ -26464,14 +26548,14 @@ import { execSync as execSync36 } from "child_process";
|
|
|
26464
26548
|
import { existsSync as existsSync58, readFileSync as readFileSync42, unlinkSync as unlinkSync12 } from "fs";
|
|
26465
26549
|
import { tmpdir as tmpdir4 } from "os";
|
|
26466
26550
|
import path39 from "path";
|
|
26467
|
-
import
|
|
26551
|
+
import chalk175 from "chalk";
|
|
26468
26552
|
function assertJbInstalled() {
|
|
26469
26553
|
try {
|
|
26470
26554
|
execSync36("jb inspectcode --version", { stdio: "pipe" });
|
|
26471
26555
|
} catch {
|
|
26472
|
-
console.error(
|
|
26556
|
+
console.error(chalk175.red("jb is not installed. Install with:"));
|
|
26473
26557
|
console.error(
|
|
26474
|
-
|
|
26558
|
+
chalk175.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
26475
26559
|
);
|
|
26476
26560
|
process.exit(1);
|
|
26477
26561
|
}
|
|
@@ -26489,11 +26573,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26489
26573
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
26490
26574
|
process.stderr.write(error.stderr);
|
|
26491
26575
|
}
|
|
26492
|
-
console.error(
|
|
26576
|
+
console.error(chalk175.red("jb inspectcode failed"));
|
|
26493
26577
|
process.exit(1);
|
|
26494
26578
|
}
|
|
26495
26579
|
if (!existsSync58(reportPath)) {
|
|
26496
|
-
console.error(
|
|
26580
|
+
console.error(chalk175.red("Report file not generated"));
|
|
26497
26581
|
process.exit(1);
|
|
26498
26582
|
}
|
|
26499
26583
|
const xml = readFileSync42(reportPath, "utf8");
|
|
@@ -26503,7 +26587,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
26503
26587
|
|
|
26504
26588
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
26505
26589
|
import { execSync as execSync37 } from "child_process";
|
|
26506
|
-
import
|
|
26590
|
+
import chalk176 from "chalk";
|
|
26507
26591
|
function resolveMsbuildPath() {
|
|
26508
26592
|
const { run: run4 } = loadConfig();
|
|
26509
26593
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -26515,9 +26599,9 @@ function assertMsbuildInstalled() {
|
|
|
26515
26599
|
try {
|
|
26516
26600
|
execSync37(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
26517
26601
|
} catch {
|
|
26518
|
-
console.error(
|
|
26602
|
+
console.error(chalk176.red(`msbuild not found at: ${msbuild}`));
|
|
26519
26603
|
console.error(
|
|
26520
|
-
|
|
26604
|
+
chalk176.yellow(
|
|
26521
26605
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
26522
26606
|
)
|
|
26523
26607
|
);
|
|
@@ -26564,17 +26648,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
26564
26648
|
// src/commands/dotnet/inspect.ts
|
|
26565
26649
|
function logScope(changedFiles2) {
|
|
26566
26650
|
if (changedFiles2 === null) {
|
|
26567
|
-
console.log(
|
|
26651
|
+
console.log(chalk177.dim("Inspecting full solution..."));
|
|
26568
26652
|
} else {
|
|
26569
26653
|
console.log(
|
|
26570
|
-
|
|
26654
|
+
chalk177.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
26571
26655
|
);
|
|
26572
26656
|
}
|
|
26573
26657
|
}
|
|
26574
26658
|
function reportResults(issues, elapsed) {
|
|
26575
26659
|
if (issues.length > 0) displayIssues(issues);
|
|
26576
|
-
else console.log(
|
|
26577
|
-
console.log(
|
|
26660
|
+
else console.log(chalk177.green("No issues found"));
|
|
26661
|
+
console.log(chalk177.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
26578
26662
|
if (issues.length > 0) process.exit(1);
|
|
26579
26663
|
}
|
|
26580
26664
|
async function inspect(sln, options2) {
|
|
@@ -26585,7 +26669,7 @@ async function inspect(sln, options2) {
|
|
|
26585
26669
|
const scope = parseScope(options2.scope);
|
|
26586
26670
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
26587
26671
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
26588
|
-
console.log(
|
|
26672
|
+
console.log(chalk177.green("No changed .cs files found"));
|
|
26589
26673
|
return;
|
|
26590
26674
|
}
|
|
26591
26675
|
logScope(changedFiles2);
|
|
@@ -27396,9 +27480,9 @@ function aggregateCommitters(authorLists) {
|
|
|
27396
27480
|
|
|
27397
27481
|
// src/shared/runGhGraphql.ts
|
|
27398
27482
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
27399
|
-
import { unlinkSync as unlinkSync14, writeFileSync as
|
|
27483
|
+
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
27400
27484
|
import { tmpdir as tmpdir5 } from "os";
|
|
27401
|
-
import { join as
|
|
27485
|
+
import { join as join74 } from "path";
|
|
27402
27486
|
function buildArgs2(queryFile, vars) {
|
|
27403
27487
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
27404
27488
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -27408,8 +27492,8 @@ function buildArgs2(queryFile, vars) {
|
|
|
27408
27492
|
return args;
|
|
27409
27493
|
}
|
|
27410
27494
|
function runGhGraphql(mutation, vars) {
|
|
27411
|
-
const queryFile =
|
|
27412
|
-
|
|
27495
|
+
const queryFile = join74(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
27496
|
+
writeFileSync35(queryFile, mutation);
|
|
27413
27497
|
try {
|
|
27414
27498
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
27415
27499
|
encoding: "utf8",
|
|
@@ -27473,25 +27557,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
27473
27557
|
}
|
|
27474
27558
|
|
|
27475
27559
|
// src/commands/github/printCountTable.ts
|
|
27476
|
-
import
|
|
27560
|
+
import chalk178 from "chalk";
|
|
27477
27561
|
function printCountTable(labelHeader, rows) {
|
|
27478
27562
|
const labelWidth = Math.max(
|
|
27479
27563
|
labelHeader.length,
|
|
27480
27564
|
...rows.map((row3) => row3.label.length)
|
|
27481
27565
|
);
|
|
27482
27566
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
27483
|
-
console.log(
|
|
27484
|
-
console.log(
|
|
27567
|
+
console.log(chalk178.dim(header));
|
|
27568
|
+
console.log(chalk178.dim("-".repeat(header.length)));
|
|
27485
27569
|
for (const row3 of rows) {
|
|
27486
27570
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
27487
27571
|
}
|
|
27488
27572
|
}
|
|
27489
27573
|
|
|
27490
27574
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
27491
|
-
import
|
|
27575
|
+
import chalk179 from "chalk";
|
|
27492
27576
|
function printRepoAuthorBreakdown(repos2) {
|
|
27493
27577
|
for (const repo of repos2) {
|
|
27494
|
-
console.log(
|
|
27578
|
+
console.log(chalk179.bold(repo.name));
|
|
27495
27579
|
const authorWidth = Math.max(
|
|
27496
27580
|
0,
|
|
27497
27581
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -27565,10 +27649,10 @@ function parseSinceDate(value) {
|
|
|
27565
27649
|
}
|
|
27566
27650
|
|
|
27567
27651
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
27568
|
-
import
|
|
27652
|
+
import chalk181 from "chalk";
|
|
27569
27653
|
|
|
27570
27654
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27571
|
-
import
|
|
27655
|
+
import chalk180 from "chalk";
|
|
27572
27656
|
|
|
27573
27657
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
27574
27658
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -27605,7 +27689,7 @@ function writeLineNow(line) {
|
|
|
27605
27689
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
27606
27690
|
function applyFixStructurePlan(plan2) {
|
|
27607
27691
|
for (const entry of plan2.entries) {
|
|
27608
|
-
const where =
|
|
27692
|
+
const where = chalk180.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27609
27693
|
const { typeChange, labelRemovals } = entry;
|
|
27610
27694
|
if (typeChange) {
|
|
27611
27695
|
writeLineNow(
|
|
@@ -27875,12 +27959,12 @@ function planSubtree(root2, context) {
|
|
|
27875
27959
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
27876
27960
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
27877
27961
|
applyFixStructurePlan(plan2);
|
|
27878
|
-
writeLineNow(
|
|
27962
|
+
writeLineNow(chalk181.dim("Re-walking the subtree to confirm"));
|
|
27879
27963
|
assertNoResidualDrift(
|
|
27880
27964
|
planSubtree(fetchRootIssue(target), context),
|
|
27881
27965
|
context.chain
|
|
27882
27966
|
);
|
|
27883
|
-
writeLineNow(
|
|
27967
|
+
writeLineNow(chalk181.green("Subtree normalised"));
|
|
27884
27968
|
}
|
|
27885
27969
|
|
|
27886
27970
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -27916,22 +28000,22 @@ function parseTypeChain(value) {
|
|
|
27916
28000
|
}
|
|
27917
28001
|
|
|
27918
28002
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
27919
|
-
import
|
|
28003
|
+
import chalk182 from "chalk";
|
|
27920
28004
|
function annotate(entry) {
|
|
27921
28005
|
const notes = [];
|
|
27922
28006
|
if (entry.level === null) {
|
|
27923
|
-
notes.push(
|
|
28007
|
+
notes.push(chalk182.red("deeper than the leaf level"));
|
|
27924
28008
|
} else if (entry.typeChange) {
|
|
27925
28009
|
notes.push(
|
|
27926
|
-
|
|
28010
|
+
chalk182.yellow(
|
|
27927
28011
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
27928
28012
|
)
|
|
27929
28013
|
);
|
|
27930
28014
|
} else {
|
|
27931
|
-
notes.push(
|
|
28015
|
+
notes.push(chalk182.dim(entry.issue.typeName ?? "no type"));
|
|
27932
28016
|
}
|
|
27933
28017
|
for (const label of entry.labelRemovals) {
|
|
27934
|
-
notes.push(
|
|
28018
|
+
notes.push(chalk182.yellow(`-${label.name}`));
|
|
27935
28019
|
}
|
|
27936
28020
|
return notes;
|
|
27937
28021
|
}
|
|
@@ -27939,22 +28023,22 @@ function formatCount(count10, noun) {
|
|
|
27939
28023
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
27940
28024
|
}
|
|
27941
28025
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
27942
|
-
writeLineNow(
|
|
28026
|
+
writeLineNow(chalk182.dim(`chain: ${chain2.join(" > ")}`));
|
|
27943
28027
|
for (const entry of plan2.entries) {
|
|
27944
28028
|
const indent4 = " ".repeat(entry.issue.depth);
|
|
27945
|
-
const name =
|
|
28029
|
+
const name = chalk182.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
27946
28030
|
writeLineNow(
|
|
27947
28031
|
`${indent4}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
27948
28032
|
);
|
|
27949
28033
|
}
|
|
27950
28034
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
27951
|
-
writeLineNow(
|
|
28035
|
+
writeLineNow(chalk182.green("Nothing to change"));
|
|
27952
28036
|
return;
|
|
27953
28037
|
}
|
|
27954
28038
|
writeLineNow(
|
|
27955
28039
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
27956
28040
|
);
|
|
27957
|
-
if (!apply) writeLineNow(
|
|
28041
|
+
if (!apply) writeLineNow(chalk182.dim("Dry run \u2014 nothing written"));
|
|
27958
28042
|
}
|
|
27959
28043
|
|
|
27960
28044
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -28690,10 +28774,10 @@ import { basename as basename18 } from "path";
|
|
|
28690
28774
|
|
|
28691
28775
|
// src/shared/removeStagedAttachments.ts
|
|
28692
28776
|
import { rmSync as rmSync5 } from "fs";
|
|
28693
|
-
import { dirname as
|
|
28777
|
+
import { dirname as dirname33 } from "path";
|
|
28694
28778
|
function removeStagedAttachments(attachments) {
|
|
28695
28779
|
for (const { path: path109 } of attachments) {
|
|
28696
|
-
const dir =
|
|
28780
|
+
const dir = dirname33(path109);
|
|
28697
28781
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
28698
28782
|
rmSync5(dir, { recursive: true, force: true });
|
|
28699
28783
|
}
|
|
@@ -28856,26 +28940,26 @@ function slugFromUrl(url) {
|
|
|
28856
28940
|
}
|
|
28857
28941
|
|
|
28858
28942
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
28859
|
-
import { mkdirSync as
|
|
28943
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync36 } from "fs";
|
|
28860
28944
|
|
|
28861
28945
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
28862
|
-
import { join as
|
|
28946
|
+
import { join as join75 } from "path";
|
|
28863
28947
|
function issueWorkingFile(slug2, number) {
|
|
28864
28948
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
28865
|
-
const dir =
|
|
28949
|
+
const dir = join75(getStoreDir(), "github-issues", owner, repo);
|
|
28866
28950
|
return {
|
|
28867
28951
|
dir,
|
|
28868
|
-
bodyPath:
|
|
28869
|
-
metaPath:
|
|
28952
|
+
bodyPath: join75(dir, `${number}.md`),
|
|
28953
|
+
metaPath: join75(dir, `${number}.json`)
|
|
28870
28954
|
};
|
|
28871
28955
|
}
|
|
28872
28956
|
|
|
28873
28957
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
28874
28958
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
28875
28959
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
|
|
28960
|
+
mkdirSync22(dir, { recursive: true });
|
|
28961
|
+
writeFileSync36(bodyPath, body);
|
|
28962
|
+
writeFileSync36(
|
|
28879
28963
|
metaPath,
|
|
28880
28964
|
`${JSON.stringify({ target, updatedAt }, null, 2)}
|
|
28881
28965
|
`
|
|
@@ -29361,25 +29445,25 @@ function registerGithub(program) {
|
|
|
29361
29445
|
}
|
|
29362
29446
|
|
|
29363
29447
|
// src/commands/inbox/list.ts
|
|
29364
|
-
import
|
|
29448
|
+
import chalk183 from "chalk";
|
|
29365
29449
|
async function list3() {
|
|
29366
29450
|
const messages = await listInboxMessages(await getDb());
|
|
29367
29451
|
if (messages.length === 0) {
|
|
29368
|
-
console.log(
|
|
29452
|
+
console.log(chalk183.dim("No flagged messages; run assist inbox scan"));
|
|
29369
29453
|
return;
|
|
29370
29454
|
}
|
|
29371
29455
|
for (const message3 of messages) {
|
|
29372
29456
|
const when = (message3.receivedAt ?? message3.flaggedAt).toISOString();
|
|
29373
29457
|
console.log(
|
|
29374
|
-
`${
|
|
29458
|
+
`${chalk183.dim(when)} ${chalk183.cyan(message3.source)} ${chalk183.bold(message3.sender)}`
|
|
29375
29459
|
);
|
|
29376
29460
|
console.log(` ${message3.summary}`);
|
|
29377
|
-
console.log(` ${
|
|
29461
|
+
console.log(` ${chalk183.dim(message3.link)}`);
|
|
29378
29462
|
}
|
|
29379
29463
|
}
|
|
29380
29464
|
|
|
29381
29465
|
// src/commands/inbox/scan.ts
|
|
29382
|
-
import
|
|
29466
|
+
import chalk184 from "chalk";
|
|
29383
29467
|
|
|
29384
29468
|
// src/shared/formatTokens.ts
|
|
29385
29469
|
function formatTokens(n) {
|
|
@@ -29421,7 +29505,7 @@ async function writeInboxLastScan(orm, at2) {
|
|
|
29421
29505
|
|
|
29422
29506
|
// src/commands/inbox/runInboxScanClaude.ts
|
|
29423
29507
|
import { spawn as spawn6 } from "child_process";
|
|
29424
|
-
import { z as
|
|
29508
|
+
import { z as z16 } from "zod";
|
|
29425
29509
|
|
|
29426
29510
|
// src/commands/review/attachLineParser.ts
|
|
29427
29511
|
function flushBuffer(buffer, onLine) {
|
|
@@ -29602,17 +29686,17 @@ function createScanUsageTracker() {
|
|
|
29602
29686
|
}
|
|
29603
29687
|
|
|
29604
29688
|
// src/commands/inbox/inboxScanSchema.ts
|
|
29605
|
-
import { z as
|
|
29606
|
-
var flaggedMessageSchema =
|
|
29607
|
-
source:
|
|
29608
|
-
messageId:
|
|
29609
|
-
sender:
|
|
29610
|
-
summary:
|
|
29611
|
-
link:
|
|
29612
|
-
receivedAt:
|
|
29689
|
+
import { z as z15 } from "zod";
|
|
29690
|
+
var flaggedMessageSchema = z15.object({
|
|
29691
|
+
source: z15.enum(["gmail", "slack"]),
|
|
29692
|
+
messageId: z15.string().min(1),
|
|
29693
|
+
sender: z15.string().min(1),
|
|
29694
|
+
summary: z15.string().min(1),
|
|
29695
|
+
link: z15.string().min(1),
|
|
29696
|
+
receivedAt: z15.string().optional()
|
|
29613
29697
|
});
|
|
29614
|
-
var inboxScanSchema =
|
|
29615
|
-
messages:
|
|
29698
|
+
var inboxScanSchema = z15.object({
|
|
29699
|
+
messages: z15.array(flaggedMessageSchema)
|
|
29616
29700
|
});
|
|
29617
29701
|
|
|
29618
29702
|
// src/commands/inbox/parseInboxScanOutput.ts
|
|
@@ -29731,7 +29815,7 @@ function buildInboxScanArgs(since) {
|
|
|
29731
29815
|
"stream-json",
|
|
29732
29816
|
"--verbose",
|
|
29733
29817
|
"--json-schema",
|
|
29734
|
-
JSON.stringify(
|
|
29818
|
+
JSON.stringify(z16.toJSONSchema(inboxScanSchema, { target: "draft-07" })),
|
|
29735
29819
|
"--",
|
|
29736
29820
|
buildInboxScanPrompt(since)
|
|
29737
29821
|
];
|
|
@@ -29791,7 +29875,7 @@ async function scan() {
|
|
|
29791
29875
|
)
|
|
29792
29876
|
});
|
|
29793
29877
|
console.log(
|
|
29794
|
-
`Flagged ${flagged} message(s) needing a reply, ${
|
|
29878
|
+
`Flagged ${flagged} message(s) needing a reply, ${chalk184.bold(added)} new. ${chalk184.dim(formatScanUsage(usage))}`
|
|
29795
29879
|
);
|
|
29796
29880
|
}
|
|
29797
29881
|
|
|
@@ -29806,7 +29890,7 @@ function registerInbox(program) {
|
|
|
29806
29890
|
}
|
|
29807
29891
|
|
|
29808
29892
|
// src/commands/jira/acceptanceCriteria.ts
|
|
29809
|
-
import
|
|
29893
|
+
import chalk185 from "chalk";
|
|
29810
29894
|
|
|
29811
29895
|
// src/commands/jira/adfToText.ts
|
|
29812
29896
|
function renderInline(node) {
|
|
@@ -29873,7 +29957,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
29873
29957
|
const parsed = fetchIssue(issueKey, field);
|
|
29874
29958
|
const acValue = parsed?.fields?.[field];
|
|
29875
29959
|
if (!acValue) {
|
|
29876
|
-
console.log(
|
|
29960
|
+
console.log(chalk185.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
29877
29961
|
return;
|
|
29878
29962
|
}
|
|
29879
29963
|
if (typeof acValue === "string") {
|
|
@@ -29939,14 +30023,14 @@ async function jiraAuth() {
|
|
|
29939
30023
|
}
|
|
29940
30024
|
|
|
29941
30025
|
// src/commands/jira/viewIssue.ts
|
|
29942
|
-
import
|
|
30026
|
+
import chalk186 from "chalk";
|
|
29943
30027
|
function viewIssue2(issueKey) {
|
|
29944
30028
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
29945
30029
|
const fields = parsed?.fields;
|
|
29946
30030
|
const summary = fields?.summary;
|
|
29947
30031
|
const description = fields?.description;
|
|
29948
30032
|
if (summary) {
|
|
29949
|
-
console.log(
|
|
30033
|
+
console.log(chalk186.bold(summary));
|
|
29950
30034
|
}
|
|
29951
30035
|
if (description) {
|
|
29952
30036
|
if (summary) console.log();
|
|
@@ -29960,7 +30044,7 @@ function viewIssue2(issueKey) {
|
|
|
29960
30044
|
}
|
|
29961
30045
|
if (!summary && !description) {
|
|
29962
30046
|
console.log(
|
|
29963
|
-
|
|
30047
|
+
chalk186.yellow(`No summary or description found on ${issueKey}.`)
|
|
29964
30048
|
);
|
|
29965
30049
|
}
|
|
29966
30050
|
}
|
|
@@ -30051,14 +30135,14 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
30051
30135
|
|
|
30052
30136
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
30053
30137
|
import { existsSync as existsSync61 } from "fs";
|
|
30054
|
-
import { basename as basename20, dirname as
|
|
30138
|
+
import { basename as basename20, dirname as dirname34 } from "path";
|
|
30055
30139
|
|
|
30056
30140
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
30057
|
-
import { basename as basename19, join as
|
|
30141
|
+
import { basename as basename19, join as join76 } from "path";
|
|
30058
30142
|
function nextWorktreePath(clone, base, isTaken) {
|
|
30059
30143
|
const name = basename19(clone);
|
|
30060
30144
|
for (let n = 2; n < 1e3; n++) {
|
|
30061
|
-
const candidate =
|
|
30145
|
+
const candidate = join76(base, `${name}-${n}`);
|
|
30062
30146
|
if (!isTaken(candidate)) return candidate;
|
|
30063
30147
|
}
|
|
30064
30148
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -30079,7 +30163,7 @@ async function cloneTrunkBranch(clone) {
|
|
|
30079
30163
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
30080
30164
|
var FETCH_TIMEOUT_MS = 6e4;
|
|
30081
30165
|
function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
30082
|
-
const base = strategy.root ? expandTilde(strategy.root) :
|
|
30166
|
+
const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
|
|
30083
30167
|
const registered = new Set(listWorktreePaths(clone));
|
|
30084
30168
|
const branches = new Set(listLocalBranches(clone));
|
|
30085
30169
|
const isTaken = (candidate) => registered.has(candidate) || existsSync61(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
|
|
@@ -30187,39 +30271,39 @@ function stringOrUndefined(value) {
|
|
|
30187
30271
|
}
|
|
30188
30272
|
|
|
30189
30273
|
// src/commands/sessions/daemon/persistedSessionSchema.ts
|
|
30190
|
-
import { z as
|
|
30191
|
-
var persistedSessionSchema =
|
|
30192
|
-
id:
|
|
30193
|
-
name:
|
|
30194
|
-
title:
|
|
30195
|
-
generatedTitle:
|
|
30196
|
-
subtitle:
|
|
30197
|
-
commandType:
|
|
30198
|
-
harness:
|
|
30199
|
-
status:
|
|
30200
|
-
cwd:
|
|
30201
|
-
startedAt:
|
|
30202
|
-
runningMs:
|
|
30203
|
-
claudeSessionId:
|
|
30204
|
-
harnessSessionId:
|
|
30205
|
-
initialPrompt:
|
|
30206
|
-
runName:
|
|
30207
|
-
runArgs:
|
|
30208
|
-
assistArgs:
|
|
30274
|
+
import { z as z17 } from "zod";
|
|
30275
|
+
var persistedSessionSchema = z17.object({
|
|
30276
|
+
id: z17.string().optional(),
|
|
30277
|
+
name: z17.string(),
|
|
30278
|
+
title: z17.string().optional(),
|
|
30279
|
+
generatedTitle: z17.string().optional(),
|
|
30280
|
+
subtitle: z17.string().optional(),
|
|
30281
|
+
commandType: z17.enum(["claude", "run", "assist"]),
|
|
30282
|
+
harness: z17.enum(["claude", "codex", "pi"]).optional(),
|
|
30283
|
+
status: z17.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
30284
|
+
cwd: z17.string(),
|
|
30285
|
+
startedAt: z17.number(),
|
|
30286
|
+
runningMs: z17.number().optional(),
|
|
30287
|
+
claudeSessionId: z17.string().optional(),
|
|
30288
|
+
harnessSessionId: z17.string().optional(),
|
|
30289
|
+
initialPrompt: z17.string().optional(),
|
|
30290
|
+
runName: z17.string().optional(),
|
|
30291
|
+
runArgs: z17.array(z17.string()).optional(),
|
|
30292
|
+
assistArgs: z17.array(z17.string()).optional(),
|
|
30209
30293
|
activity: activitySchema.optional(),
|
|
30210
|
-
starred:
|
|
30211
|
-
watcher:
|
|
30212
|
-
divergenceEscalation:
|
|
30213
|
-
design:
|
|
30214
|
-
auto:
|
|
30215
|
-
autoAdvance:
|
|
30216
|
-
autoApprove:
|
|
30217
|
-
reviewStarted:
|
|
30218
|
-
launchedFrom:
|
|
30219
|
-
pendingPrompts:
|
|
30220
|
-
interrupted:
|
|
30221
|
-
awaitingSeed:
|
|
30222
|
-
undurable:
|
|
30294
|
+
starred: z17.boolean().optional(),
|
|
30295
|
+
watcher: z17.boolean().optional(),
|
|
30296
|
+
divergenceEscalation: z17.boolean().optional(),
|
|
30297
|
+
design: z17.boolean().optional(),
|
|
30298
|
+
auto: z17.boolean().optional(),
|
|
30299
|
+
autoAdvance: z17.boolean().optional(),
|
|
30300
|
+
autoApprove: z17.boolean().optional(),
|
|
30301
|
+
reviewStarted: z17.boolean().optional(),
|
|
30302
|
+
launchedFrom: z17.string().optional(),
|
|
30303
|
+
pendingPrompts: z17.array(z17.string()).optional(),
|
|
30304
|
+
interrupted: z17.object({ reason: z17.string(), at: z17.number() }).optional(),
|
|
30305
|
+
awaitingSeed: z17.boolean().optional(),
|
|
30306
|
+
undurable: z17.object({ reason: z17.string(), removesTree: z17.boolean().optional() }).optional()
|
|
30223
30307
|
});
|
|
30224
30308
|
|
|
30225
30309
|
// src/commands/sessions/daemon/toPersistedSession.ts
|
|
@@ -30320,21 +30404,21 @@ function persistedTreeRoots() {
|
|
|
30320
30404
|
}
|
|
30321
30405
|
|
|
30322
30406
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
30323
|
-
import { copyFileSync, existsSync as existsSync63, mkdirSync as
|
|
30324
|
-
import { dirname as
|
|
30407
|
+
import { copyFileSync, existsSync as existsSync63, mkdirSync as mkdirSync23 } from "fs";
|
|
30408
|
+
import { dirname as dirname35, join as join78 } from "path";
|
|
30325
30409
|
|
|
30326
30410
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
30327
30411
|
import { resolve as resolve19 } from "path";
|
|
30328
30412
|
|
|
30329
30413
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
30330
30414
|
import { existsSync as existsSync62 } from "fs";
|
|
30331
|
-
import { join as
|
|
30415
|
+
import { join as join77 } from "path";
|
|
30332
30416
|
function detectInstallCommand(dir) {
|
|
30333
|
-
if (!existsSync62(
|
|
30334
|
-
if (existsSync62(
|
|
30335
|
-
if (existsSync62(
|
|
30336
|
-
if (existsSync62(
|
|
30337
|
-
if (existsSync62(
|
|
30417
|
+
if (!existsSync62(join77(dir, "package.json"))) return null;
|
|
30418
|
+
if (existsSync62(join77(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
30419
|
+
if (existsSync62(join77(dir, "yarn.lock"))) return "yarn install";
|
|
30420
|
+
if (existsSync62(join77(dir, "bun.lockb"))) return "bun install";
|
|
30421
|
+
if (existsSync62(join77(dir, "package-lock.json"))) return "npm ci";
|
|
30338
30422
|
return "npm install";
|
|
30339
30423
|
}
|
|
30340
30424
|
|
|
@@ -30499,11 +30583,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
30499
30583
|
}
|
|
30500
30584
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
30501
30585
|
for (const rel of copy) {
|
|
30502
|
-
const src =
|
|
30586
|
+
const src = join78(clone, rel);
|
|
30503
30587
|
if (!existsSync63(src)) continue;
|
|
30504
|
-
const dest =
|
|
30588
|
+
const dest = join78(worktreePath, rel);
|
|
30505
30589
|
try {
|
|
30506
|
-
|
|
30590
|
+
mkdirSync23(dirname35(dest), { recursive: true });
|
|
30507
30591
|
copyFileSync(src, dest);
|
|
30508
30592
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
30509
30593
|
} catch (error) {
|
|
@@ -30667,7 +30751,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
30667
30751
|
}
|
|
30668
30752
|
|
|
30669
30753
|
// src/commands/review/failCheckout.ts
|
|
30670
|
-
import
|
|
30754
|
+
import chalk187 from "chalk";
|
|
30671
30755
|
|
|
30672
30756
|
// src/commands/review/azCliProblem.ts
|
|
30673
30757
|
import { execFileSync as execFileSync15 } from "child_process";
|
|
@@ -30720,14 +30804,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
30720
30804
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
30721
30805
|
if (headRef && stale === "local-work")
|
|
30722
30806
|
console.error(
|
|
30723
|
-
|
|
30807
|
+
chalk187.red(
|
|
30724
30808
|
`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.`
|
|
30725
30809
|
)
|
|
30726
30810
|
);
|
|
30727
30811
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
30728
|
-
if (problem) console.error(
|
|
30812
|
+
if (problem) console.error(chalk187.red(problem));
|
|
30729
30813
|
console.error(
|
|
30730
|
-
|
|
30814
|
+
chalk187.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
30731
30815
|
);
|
|
30732
30816
|
process.exit(1);
|
|
30733
30817
|
}
|
|
@@ -30920,18 +31004,18 @@ function registerList(program) {
|
|
|
30920
31004
|
}
|
|
30921
31005
|
|
|
30922
31006
|
// src/commands/litellm/listModels.ts
|
|
30923
|
-
import
|
|
31007
|
+
import chalk189 from "chalk";
|
|
30924
31008
|
|
|
30925
31009
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
30926
|
-
import
|
|
31010
|
+
import chalk188 from "chalk";
|
|
30927
31011
|
function resolveLitellmConfig() {
|
|
30928
31012
|
const { config, missing } = readLitellmConfig();
|
|
30929
31013
|
if (!config) {
|
|
30930
|
-
console.error(
|
|
31014
|
+
console.error(chalk188.red("LiteLLM is not configured"));
|
|
30931
31015
|
for (const key of missing) {
|
|
30932
31016
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
30933
31017
|
console.error(
|
|
30934
|
-
|
|
31018
|
+
chalk188.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
30935
31019
|
);
|
|
30936
31020
|
}
|
|
30937
31021
|
process.exit(1);
|
|
@@ -30957,13 +31041,13 @@ async function listModels(options2) {
|
|
|
30957
31041
|
} catch (error) {
|
|
30958
31042
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
30959
31043
|
console.error(
|
|
30960
|
-
|
|
31044
|
+
chalk189.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
30961
31045
|
);
|
|
30962
31046
|
process.exit(1);
|
|
30963
31047
|
}
|
|
30964
31048
|
const body = await response.text();
|
|
30965
31049
|
if (!response.ok) {
|
|
30966
|
-
console.error(
|
|
31050
|
+
console.error(chalk189.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
30967
31051
|
process.exit(1);
|
|
30968
31052
|
}
|
|
30969
31053
|
if (options2.json) {
|
|
@@ -30981,17 +31065,17 @@ function registerLitellm(program) {
|
|
|
30981
31065
|
}
|
|
30982
31066
|
|
|
30983
31067
|
// src/commands/mermaidExport.ts
|
|
30984
|
-
import { mkdirSync as
|
|
31068
|
+
import { mkdirSync as mkdirSync24, readdirSync as readdirSync13 } from "fs";
|
|
30985
31069
|
import { resolve as resolve21 } from "path";
|
|
30986
|
-
import
|
|
31070
|
+
import chalk192 from "chalk";
|
|
30987
31071
|
|
|
30988
31072
|
// src/commands/mermaid/exportFile.ts
|
|
30989
|
-
import { readFileSync as readFileSync44, writeFileSync as
|
|
31073
|
+
import { readFileSync as readFileSync44, writeFileSync as writeFileSync37 } from "fs";
|
|
30990
31074
|
import { basename as basename21, extname as extname4, resolve as resolve20 } from "path";
|
|
30991
|
-
import
|
|
31075
|
+
import chalk191 from "chalk";
|
|
30992
31076
|
|
|
30993
31077
|
// src/commands/mermaid/renderBlock.ts
|
|
30994
|
-
import
|
|
31078
|
+
import chalk190 from "chalk";
|
|
30995
31079
|
async function renderBlock(krokiUrl, source) {
|
|
30996
31080
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
30997
31081
|
method: "POST",
|
|
@@ -31000,7 +31084,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
31000
31084
|
});
|
|
31001
31085
|
if (!response.ok) {
|
|
31002
31086
|
console.error(
|
|
31003
|
-
|
|
31087
|
+
chalk190.red(
|
|
31004
31088
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
31005
31089
|
)
|
|
31006
31090
|
);
|
|
@@ -31018,27 +31102,27 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
31018
31102
|
if (onlyIndex !== void 0) {
|
|
31019
31103
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
31020
31104
|
console.error(
|
|
31021
|
-
|
|
31105
|
+
chalk191.red(
|
|
31022
31106
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
31023
31107
|
)
|
|
31024
31108
|
);
|
|
31025
31109
|
process.exit(1);
|
|
31026
31110
|
}
|
|
31027
31111
|
console.log(
|
|
31028
|
-
|
|
31112
|
+
chalk191.gray(
|
|
31029
31113
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
31030
31114
|
)
|
|
31031
31115
|
);
|
|
31032
31116
|
} else {
|
|
31033
|
-
console.log(
|
|
31117
|
+
console.log(chalk191.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
31034
31118
|
}
|
|
31035
31119
|
for (const [i, source] of blocks.entries()) {
|
|
31036
31120
|
const idx = i + 1;
|
|
31037
31121
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
31038
31122
|
const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
|
|
31039
31123
|
const svg = await renderBlock(krokiUrl, source);
|
|
31040
|
-
|
|
31041
|
-
console.log(
|
|
31124
|
+
writeFileSync37(outPath, svg, "utf8");
|
|
31125
|
+
console.log(chalk191.green(` \u2192 ${outPath}`));
|
|
31042
31126
|
}
|
|
31043
31127
|
}
|
|
31044
31128
|
function extractMermaidBlocks(markdown) {
|
|
@@ -31050,22 +31134,22 @@ function extractMermaidBlocks(markdown) {
|
|
|
31050
31134
|
async function mermaidExport(file, options2 = {}) {
|
|
31051
31135
|
const { mermaid } = loadConfig();
|
|
31052
31136
|
const outDir = resolve21(process.cwd(), options2.out ?? ".");
|
|
31053
|
-
|
|
31137
|
+
mkdirSync24(outDir, { recursive: true });
|
|
31054
31138
|
if (options2.index !== void 0) {
|
|
31055
31139
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
31056
31140
|
console.error(
|
|
31057
|
-
|
|
31141
|
+
chalk192.red(`--index must be a positive integer (got ${options2.index})`)
|
|
31058
31142
|
);
|
|
31059
31143
|
process.exit(1);
|
|
31060
31144
|
}
|
|
31061
31145
|
if (!file) {
|
|
31062
|
-
console.error(
|
|
31146
|
+
console.error(chalk192.red("--index requires a file argument"));
|
|
31063
31147
|
process.exit(1);
|
|
31064
31148
|
}
|
|
31065
31149
|
}
|
|
31066
31150
|
const files = file ? [file] : readdirSync13(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
31067
31151
|
if (files.length === 0) {
|
|
31068
|
-
console.log(
|
|
31152
|
+
console.log(chalk192.gray("No markdown files found in current directory."));
|
|
31069
31153
|
return;
|
|
31070
31154
|
}
|
|
31071
31155
|
for (const f of files) {
|
|
@@ -31145,8 +31229,8 @@ function boardSource(raw, anchorId, options2) {
|
|
|
31145
31229
|
import { stringify as stringify2 } from "yaml";
|
|
31146
31230
|
|
|
31147
31231
|
// src/commands/miro/writeExtract.ts
|
|
31148
|
-
import { mkdirSync as
|
|
31149
|
-
import { dirname as
|
|
31232
|
+
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync38 } from "fs";
|
|
31233
|
+
import { dirname as dirname36 } from "path";
|
|
31150
31234
|
import { stringify } from "yaml";
|
|
31151
31235
|
function headerLines(header) {
|
|
31152
31236
|
const { rect } = header;
|
|
@@ -31159,8 +31243,8 @@ function headerLines(header) {
|
|
|
31159
31243
|
];
|
|
31160
31244
|
}
|
|
31161
31245
|
function writeExtract(file, header, texts) {
|
|
31162
|
-
|
|
31163
|
-
|
|
31246
|
+
mkdirSync25(dirname36(file), { recursive: true });
|
|
31247
|
+
writeFileSync38(file, `${headerLines(header).join("\n")}
|
|
31164
31248
|
${stringify(texts)}`);
|
|
31165
31249
|
}
|
|
31166
31250
|
|
|
@@ -31211,7 +31295,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
31211
31295
|
}
|
|
31212
31296
|
|
|
31213
31297
|
// src/commands/miro/keptTexts.ts
|
|
31214
|
-
import
|
|
31298
|
+
import chalk193 from "chalk";
|
|
31215
31299
|
|
|
31216
31300
|
// src/commands/miro/applyIgnore.ts
|
|
31217
31301
|
function applyIgnore(texts, ignore3) {
|
|
@@ -31250,7 +31334,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
31250
31334
|
if (unmatched.length === 0) return;
|
|
31251
31335
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
31252
31336
|
console.error(
|
|
31253
|
-
|
|
31337
|
+
chalk193.yellow(
|
|
31254
31338
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
31255
31339
|
${entries}`
|
|
31256
31340
|
)
|
|
@@ -31451,7 +31535,7 @@ function readMiroItems(file) {
|
|
|
31451
31535
|
}
|
|
31452
31536
|
|
|
31453
31537
|
// src/commands/miro/resolveExtractOptions.ts
|
|
31454
|
-
import
|
|
31538
|
+
import chalk194 from "chalk";
|
|
31455
31539
|
|
|
31456
31540
|
// src/commands/miro/extractLayers.ts
|
|
31457
31541
|
function extractsIn(layer) {
|
|
@@ -31529,7 +31613,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
31529
31613
|
paths.cwd,
|
|
31530
31614
|
paths.globalConfigPath
|
|
31531
31615
|
);
|
|
31532
|
-
console.error(
|
|
31616
|
+
console.error(chalk194.dim(`Extract "${name}" from ${resolved.from}`));
|
|
31533
31617
|
return resolved.options;
|
|
31534
31618
|
}
|
|
31535
31619
|
|
|
@@ -31633,8 +31717,8 @@ function registerMiro(program) {
|
|
|
31633
31717
|
// src/commands/netcap/netcap.ts
|
|
31634
31718
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
31635
31719
|
import { createServer as createServer2 } from "http";
|
|
31636
|
-
import { dirname as
|
|
31637
|
-
import
|
|
31720
|
+
import { dirname as dirname38 } from "path";
|
|
31721
|
+
import chalk196 from "chalk";
|
|
31638
31722
|
|
|
31639
31723
|
// src/commands/netcap/corsHeaders.ts
|
|
31640
31724
|
var corsHeaders = {
|
|
@@ -31712,15 +31796,15 @@ function createNetcapHandler(options2) {
|
|
|
31712
31796
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
31713
31797
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
31714
31798
|
import { networkInterfaces } from "os";
|
|
31715
|
-
import { join as
|
|
31716
|
-
import
|
|
31799
|
+
import { join as join80 } from "path";
|
|
31800
|
+
import chalk195 from "chalk";
|
|
31717
31801
|
|
|
31718
31802
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
31719
|
-
import { dirname as
|
|
31803
|
+
import { dirname as dirname37, join as join79 } from "path";
|
|
31720
31804
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
31721
|
-
var moduleDir2 =
|
|
31805
|
+
var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
|
|
31722
31806
|
function netcapExtensionDir() {
|
|
31723
|
-
return
|
|
31807
|
+
return join79(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
31724
31808
|
}
|
|
31725
31809
|
|
|
31726
31810
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -31735,7 +31819,7 @@ function lanIPv4() {
|
|
|
31735
31819
|
return void 0;
|
|
31736
31820
|
}
|
|
31737
31821
|
async function configureBackground(dir, host, port, filter) {
|
|
31738
|
-
const file =
|
|
31822
|
+
const file = join80(dir, "background.js");
|
|
31739
31823
|
const source = await readFile7(file, "utf8");
|
|
31740
31824
|
await writeFile6(
|
|
31741
31825
|
file,
|
|
@@ -31757,7 +31841,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31757
31841
|
const host = lanIPv4();
|
|
31758
31842
|
if (!host) {
|
|
31759
31843
|
console.log(
|
|
31760
|
-
|
|
31844
|
+
chalk195.yellow("could not determine the WSL IP for the extension")
|
|
31761
31845
|
);
|
|
31762
31846
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
31763
31847
|
return source;
|
|
@@ -31768,27 +31852,27 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
31768
31852
|
return WSL_WINDOWS_PATH3;
|
|
31769
31853
|
} catch {
|
|
31770
31854
|
console.log(
|
|
31771
|
-
|
|
31855
|
+
chalk195.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
31772
31856
|
);
|
|
31773
31857
|
return source;
|
|
31774
31858
|
}
|
|
31775
31859
|
}
|
|
31776
31860
|
|
|
31777
31861
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31778
|
-
import { isAbsolute as isAbsolute5, join as
|
|
31862
|
+
import { isAbsolute as isAbsolute5, join as join82, resolve as resolve23 } from "path";
|
|
31779
31863
|
|
|
31780
31864
|
// src/commands/netcap/defaultCapturePath.ts
|
|
31781
31865
|
import { homedir as homedir25 } from "os";
|
|
31782
|
-
import { join as
|
|
31866
|
+
import { join as join81 } from "path";
|
|
31783
31867
|
function defaultCapturePath() {
|
|
31784
|
-
return
|
|
31868
|
+
return join81(homedir25(), ".assist", "netcap", "capture.jsonl");
|
|
31785
31869
|
}
|
|
31786
31870
|
|
|
31787
31871
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
31788
31872
|
function resolveNetcapOutPath(out) {
|
|
31789
31873
|
if (!out) return defaultCapturePath();
|
|
31790
31874
|
const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
|
|
31791
|
-
return
|
|
31875
|
+
return join82(dir, "capture.jsonl");
|
|
31792
31876
|
}
|
|
31793
31877
|
|
|
31794
31878
|
// src/commands/netcap/netcap.ts
|
|
@@ -31796,35 +31880,35 @@ async function netcap(options2) {
|
|
|
31796
31880
|
const port = Number(options2.port);
|
|
31797
31881
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
31798
31882
|
const filter = options2.filter ?? "";
|
|
31799
|
-
await mkdir6(
|
|
31883
|
+
await mkdir6(dirname38(outPath), { recursive: true });
|
|
31800
31884
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
31801
31885
|
let count10 = 0;
|
|
31802
31886
|
const handler = createNetcapHandler({
|
|
31803
31887
|
outPath,
|
|
31804
|
-
onPing: () => console.log(
|
|
31888
|
+
onPing: () => console.log(chalk196.dim("ping from extension")),
|
|
31805
31889
|
onCapture: (entry) => {
|
|
31806
31890
|
count10 += 1;
|
|
31807
31891
|
console.log(
|
|
31808
|
-
|
|
31809
|
-
|
|
31892
|
+
chalk196.green(`captured #${count10}`),
|
|
31893
|
+
chalk196.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
31810
31894
|
);
|
|
31811
31895
|
}
|
|
31812
31896
|
});
|
|
31813
31897
|
const server = createServer2(handler);
|
|
31814
31898
|
server.listen(port, () => {
|
|
31815
31899
|
console.log(
|
|
31816
|
-
|
|
31900
|
+
chalk196.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
31817
31901
|
);
|
|
31818
|
-
console.log(
|
|
31902
|
+
console.log(chalk196.dim(`appending captures to ${outPath}`));
|
|
31819
31903
|
if (filter)
|
|
31820
|
-
console.log(
|
|
31821
|
-
console.log(
|
|
31822
|
-
console.log(
|
|
31904
|
+
console.log(chalk196.dim(`forwarding only URLs matching "${filter}"`));
|
|
31905
|
+
console.log(chalk196.dim(`load the unpacked extension from ${extensionPath}`));
|
|
31906
|
+
console.log(chalk196.dim("press Ctrl-C to stop"));
|
|
31823
31907
|
});
|
|
31824
31908
|
process.on("SIGINT", () => {
|
|
31825
31909
|
server.close();
|
|
31826
31910
|
console.log(
|
|
31827
|
-
|
|
31911
|
+
chalk196.bold(
|
|
31828
31912
|
`
|
|
31829
31913
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
31830
31914
|
)
|
|
@@ -31834,9 +31918,9 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
31834
31918
|
}
|
|
31835
31919
|
|
|
31836
31920
|
// src/commands/netcap/netcapExtract.ts
|
|
31837
|
-
import { writeFileSync as
|
|
31838
|
-
import { join as
|
|
31839
|
-
import
|
|
31921
|
+
import { writeFileSync as writeFileSync39 } from "fs";
|
|
31922
|
+
import { join as join83 } from "path";
|
|
31923
|
+
import chalk197 from "chalk";
|
|
31840
31924
|
|
|
31841
31925
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
31842
31926
|
import { readFileSync as readFileSync47 } from "fs";
|
|
@@ -32280,12 +32364,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
32280
32364
|
function netcapExtract(file) {
|
|
32281
32365
|
const captureFile = file ?? defaultCapturePath();
|
|
32282
32366
|
const posts = extractPostsFromCapture(captureFile);
|
|
32283
|
-
const outFile =
|
|
32284
|
-
|
|
32367
|
+
const outFile = join83(captureFile, "..", "posts.json");
|
|
32368
|
+
writeFileSync39(outFile, `${JSON.stringify(posts, null, 2)}
|
|
32285
32369
|
`);
|
|
32286
32370
|
console.log(
|
|
32287
|
-
|
|
32288
|
-
|
|
32371
|
+
chalk197.green(`extracted ${posts.length} posts`),
|
|
32372
|
+
chalk197.dim(`-> ${outFile}`)
|
|
32289
32373
|
);
|
|
32290
32374
|
}
|
|
32291
32375
|
|
|
@@ -32306,7 +32390,7 @@ function registerNetcap(program) {
|
|
|
32306
32390
|
}
|
|
32307
32391
|
|
|
32308
32392
|
// src/commands/news/add.ts
|
|
32309
|
-
import
|
|
32393
|
+
import chalk198 from "chalk";
|
|
32310
32394
|
import enquirer8 from "enquirer";
|
|
32311
32395
|
async function add2(url) {
|
|
32312
32396
|
if (!url) {
|
|
@@ -32327,25 +32411,25 @@ async function add2(url) {
|
|
|
32327
32411
|
}
|
|
32328
32412
|
const added = await addFeed(await getDb(), url);
|
|
32329
32413
|
if (!added) {
|
|
32330
|
-
console.log(
|
|
32414
|
+
console.log(chalk198.yellow("Feed already exists"));
|
|
32331
32415
|
return;
|
|
32332
32416
|
}
|
|
32333
|
-
console.log(
|
|
32417
|
+
console.log(chalk198.green(`Added feed: ${url}`));
|
|
32334
32418
|
}
|
|
32335
32419
|
|
|
32336
32420
|
// src/commands/news/list.ts
|
|
32337
|
-
import
|
|
32421
|
+
import chalk199 from "chalk";
|
|
32338
32422
|
async function list4() {
|
|
32339
32423
|
const urls = await listFeeds(await getDb());
|
|
32340
32424
|
if (urls.length === 0) {
|
|
32341
|
-
console.log(
|
|
32425
|
+
console.log(chalk199.dim("No feeds; add one with assist news add <url>"));
|
|
32342
32426
|
return;
|
|
32343
32427
|
}
|
|
32344
32428
|
for (const url of urls) console.log(url);
|
|
32345
32429
|
}
|
|
32346
32430
|
|
|
32347
32431
|
// src/commands/news/remove.ts
|
|
32348
|
-
import
|
|
32432
|
+
import chalk200 from "chalk";
|
|
32349
32433
|
|
|
32350
32434
|
// src/commands/backlog/removeFeed.ts
|
|
32351
32435
|
import { eq as eq50 } from "drizzle-orm";
|
|
@@ -32358,10 +32442,10 @@ async function removeFeed(db, url) {
|
|
|
32358
32442
|
async function remove(url) {
|
|
32359
32443
|
const removed = await removeFeed(await getDb(), url);
|
|
32360
32444
|
if (!removed) {
|
|
32361
|
-
console.log(
|
|
32445
|
+
console.log(chalk200.yellow(`No feed matches ${url}`));
|
|
32362
32446
|
return;
|
|
32363
32447
|
}
|
|
32364
|
-
console.log(
|
|
32448
|
+
console.log(chalk200.green(`Removed feed: ${url}`));
|
|
32365
32449
|
}
|
|
32366
32450
|
|
|
32367
32451
|
// src/commands/registerNews.ts
|
|
@@ -32378,7 +32462,7 @@ var TOOL_MAP = {
|
|
|
32378
32462
|
bash: "Bash",
|
|
32379
32463
|
powershell: "PowerShell"
|
|
32380
32464
|
};
|
|
32381
|
-
function
|
|
32465
|
+
function parseInput2(raw) {
|
|
32382
32466
|
try {
|
|
32383
32467
|
const data = JSON.parse(raw);
|
|
32384
32468
|
const command = data.command;
|
|
@@ -32391,7 +32475,7 @@ function parseInput(raw) {
|
|
|
32391
32475
|
}
|
|
32392
32476
|
}
|
|
32393
32477
|
async function piHook() {
|
|
32394
|
-
const input =
|
|
32478
|
+
const input = parseInput2(await readStdin());
|
|
32395
32479
|
if (!input) return;
|
|
32396
32480
|
const decision = decideCommand(input.toolName, input.command);
|
|
32397
32481
|
const output = decision ? {
|
|
@@ -32414,7 +32498,7 @@ function registerPiHook(program) {
|
|
|
32414
32498
|
}
|
|
32415
32499
|
|
|
32416
32500
|
// src/commands/prompts/printPromptsTable.ts
|
|
32417
|
-
import
|
|
32501
|
+
import chalk201 from "chalk";
|
|
32418
32502
|
function truncate2(str, max) {
|
|
32419
32503
|
if (str.length <= max) return str;
|
|
32420
32504
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -32432,14 +32516,14 @@ function printPromptsTable(rows) {
|
|
|
32432
32516
|
"Command".padEnd(commandWidth),
|
|
32433
32517
|
"Repos"
|
|
32434
32518
|
].join(" ");
|
|
32435
|
-
console.log(
|
|
32436
|
-
console.log(
|
|
32519
|
+
console.log(chalk201.dim(header));
|
|
32520
|
+
console.log(chalk201.dim("-".repeat(header.length)));
|
|
32437
32521
|
for (const row3 of rows) {
|
|
32438
32522
|
const count10 = String(row3.count).padStart(countWidth);
|
|
32439
32523
|
const tool = row3.tool.padEnd(toolWidth);
|
|
32440
32524
|
const command = truncate2(row3.command, 60).padEnd(commandWidth);
|
|
32441
32525
|
console.log(
|
|
32442
|
-
`${
|
|
32526
|
+
`${chalk201.yellow(count10)} ${tool} ${command} ${chalk201.dim(row3.repos)}`
|
|
32443
32527
|
);
|
|
32444
32528
|
}
|
|
32445
32529
|
}
|
|
@@ -32477,13 +32561,13 @@ import { execSync as execSync40 } from "child_process";
|
|
|
32477
32561
|
import enquirer9 from "enquirer";
|
|
32478
32562
|
|
|
32479
32563
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
32480
|
-
import
|
|
32564
|
+
import chalk202 from "chalk";
|
|
32481
32565
|
var STATUS_MAP = {
|
|
32482
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
32483
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
32566
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk202.magenta("merged"), date: pr.mergedAt } : null,
|
|
32567
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk202.red("closed"), date: pr.closedAt } : null
|
|
32484
32568
|
};
|
|
32485
32569
|
function defaultStatus(pr) {
|
|
32486
|
-
return { label:
|
|
32570
|
+
return { label: chalk202.green("opened"), date: pr.createdAt };
|
|
32487
32571
|
}
|
|
32488
32572
|
function getStatus(pr) {
|
|
32489
32573
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -32492,11 +32576,11 @@ function formatDate2(dateStr) {
|
|
|
32492
32576
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
32493
32577
|
}
|
|
32494
32578
|
function formatPrHeader(pr, status2) {
|
|
32495
|
-
return `${
|
|
32579
|
+
return `${chalk202.cyan(`#${pr.number}`)} ${pr.title} ${chalk202.dim(`(${pr.author.login},`)} ${status2.label} ${chalk202.dim(`${formatDate2(status2.date)})`)}`;
|
|
32496
32580
|
}
|
|
32497
32581
|
function logPrDetails(pr) {
|
|
32498
32582
|
console.log(
|
|
32499
|
-
|
|
32583
|
+
chalk202.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
32500
32584
|
);
|
|
32501
32585
|
console.log();
|
|
32502
32586
|
}
|
|
@@ -32676,9 +32760,9 @@ async function comment2(path109, line, body, options2 = {}) {
|
|
|
32676
32760
|
|
|
32677
32761
|
// src/commands/prs/commentsCachePath.ts
|
|
32678
32762
|
import { homedir as homedir26 } from "os";
|
|
32679
|
-
import { join as
|
|
32763
|
+
import { join as join84 } from "path";
|
|
32680
32764
|
function commentsCachePath(org, repo, prNumber) {
|
|
32681
|
-
return
|
|
32765
|
+
return join84(
|
|
32682
32766
|
homedir26(),
|
|
32683
32767
|
".assist",
|
|
32684
32768
|
"pr-comments",
|
|
@@ -32689,8 +32773,8 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
32689
32773
|
}
|
|
32690
32774
|
|
|
32691
32775
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
32692
|
-
import { mkdirSync as
|
|
32693
|
-
import { dirname as
|
|
32776
|
+
import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync40 } from "fs";
|
|
32777
|
+
import { dirname as dirname39 } from "path";
|
|
32694
32778
|
import { stringify as stringify3 } from "yaml";
|
|
32695
32779
|
|
|
32696
32780
|
// src/commands/prs/loadCommentsCache.ts
|
|
@@ -32714,10 +32798,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
32714
32798
|
|
|
32715
32799
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
32716
32800
|
import { readdirSync as readdirSync14, unlinkSync as unlinkSync16 } from "fs";
|
|
32717
|
-
import { join as
|
|
32801
|
+
import { join as join85 } from "path";
|
|
32718
32802
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
32719
32803
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
32720
|
-
const dir =
|
|
32804
|
+
const dir = join85(cwd, ".assist");
|
|
32721
32805
|
let entries;
|
|
32722
32806
|
try {
|
|
32723
32807
|
entries = readdirSync14(dir);
|
|
@@ -32725,20 +32809,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
32725
32809
|
return;
|
|
32726
32810
|
}
|
|
32727
32811
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
32728
|
-
unlinkSync16(
|
|
32812
|
+
unlinkSync16(join85(dir, entry));
|
|
32729
32813
|
}
|
|
32730
32814
|
}
|
|
32731
32815
|
|
|
32732
32816
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
32733
32817
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
32734
32818
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
32735
|
-
|
|
32819
|
+
mkdirSync26(dirname39(cachePath), { recursive: true });
|
|
32736
32820
|
const cacheData = {
|
|
32737
32821
|
prNumber,
|
|
32738
32822
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
32739
32823
|
comments: comments3
|
|
32740
32824
|
};
|
|
32741
|
-
|
|
32825
|
+
writeFileSync40(cachePath, stringify3(cacheData));
|
|
32742
32826
|
}
|
|
32743
32827
|
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
32744
32828
|
removeStaleCommentsCaches();
|
|
@@ -32841,9 +32925,9 @@ function failAzureDevops(error) {
|
|
|
32841
32925
|
|
|
32842
32926
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
32843
32927
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32844
|
-
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as
|
|
32928
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync41 } from "fs";
|
|
32845
32929
|
import { tmpdir as tmpdir6 } from "os";
|
|
32846
|
-
import { join as
|
|
32930
|
+
import { join as join86 } from "path";
|
|
32847
32931
|
function azDevopsInvokeArgs(request, inFile) {
|
|
32848
32932
|
return [
|
|
32849
32933
|
"devops",
|
|
@@ -32878,10 +32962,10 @@ function runAz2(args) {
|
|
|
32878
32962
|
}
|
|
32879
32963
|
function invokeAzDevops(request) {
|
|
32880
32964
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
32881
|
-
const dir = mkdtempSync2(
|
|
32882
|
-
const inFile =
|
|
32965
|
+
const dir = mkdtempSync2(join86(tmpdir6(), "assist-az-"));
|
|
32966
|
+
const inFile = join86(dir, "body.json");
|
|
32883
32967
|
try {
|
|
32884
|
-
|
|
32968
|
+
writeFileSync41(inFile, JSON.stringify(request.body));
|
|
32885
32969
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
32886
32970
|
} finally {
|
|
32887
32971
|
rmSync6(dir, { recursive: true, force: true });
|
|
@@ -33065,13 +33149,13 @@ function agentFooter(unresolvedCount) {
|
|
|
33065
33149
|
}
|
|
33066
33150
|
|
|
33067
33151
|
// src/commands/prs/listComments/commentStyle.ts
|
|
33068
|
-
import
|
|
33152
|
+
import chalk203 from "chalk";
|
|
33069
33153
|
var plain = (text18) => text18;
|
|
33070
33154
|
function colouredState(state) {
|
|
33071
33155
|
const label = `[${state}]`;
|
|
33072
|
-
if (state === "APPROVED") return
|
|
33073
|
-
if (state === "CHANGES_REQUESTED") return
|
|
33074
|
-
return
|
|
33156
|
+
if (state === "APPROVED") return chalk203.green(label);
|
|
33157
|
+
if (state === "CHANGES_REQUESTED") return chalk203.red(label);
|
|
33158
|
+
return chalk203.yellow(label);
|
|
33075
33159
|
}
|
|
33076
33160
|
function commentStyle() {
|
|
33077
33161
|
if (isClaudeCode()) {
|
|
@@ -33085,9 +33169,9 @@ function commentStyle() {
|
|
|
33085
33169
|
};
|
|
33086
33170
|
}
|
|
33087
33171
|
return {
|
|
33088
|
-
cyan:
|
|
33089
|
-
bold:
|
|
33090
|
-
dim:
|
|
33172
|
+
cyan: chalk203.cyan,
|
|
33173
|
+
bold: chalk203.bold,
|
|
33174
|
+
dim: chalk203.dim,
|
|
33091
33175
|
state: colouredState,
|
|
33092
33176
|
diffHunk: true,
|
|
33093
33177
|
agent: false
|
|
@@ -34561,16 +34645,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
34561
34645
|
}
|
|
34562
34646
|
|
|
34563
34647
|
// src/commands/prs/status/printPrsStatus.ts
|
|
34564
|
-
import
|
|
34648
|
+
import chalk205 from "chalk";
|
|
34565
34649
|
|
|
34566
34650
|
// src/commands/prs/status/printPrStatus.ts
|
|
34567
|
-
import
|
|
34651
|
+
import chalk204 from "chalk";
|
|
34568
34652
|
function flags(pr) {
|
|
34569
34653
|
const markers = [];
|
|
34570
34654
|
if (pr.isDraft) markers.push("draft");
|
|
34571
34655
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
34572
34656
|
if (pr.isBot) markers.push("bot");
|
|
34573
|
-
return markers.length ? ` ${
|
|
34657
|
+
return markers.length ? ` ${chalk204.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
34574
34658
|
}
|
|
34575
34659
|
function updated(pr) {
|
|
34576
34660
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -34584,35 +34668,35 @@ function reviewLine(pr) {
|
|
|
34584
34668
|
function checkLines(pr) {
|
|
34585
34669
|
const lines2 = [];
|
|
34586
34670
|
if (pr.checks.failing.length) {
|
|
34587
|
-
lines2.push(
|
|
34671
|
+
lines2.push(chalk204.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
34588
34672
|
}
|
|
34589
34673
|
if (pr.checks.pending.length) {
|
|
34590
|
-
lines2.push(
|
|
34674
|
+
lines2.push(chalk204.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
34591
34675
|
}
|
|
34592
34676
|
return lines2;
|
|
34593
34677
|
}
|
|
34594
34678
|
function threadsLine(pr) {
|
|
34595
34679
|
if (pr.unresolvedThreads === null) {
|
|
34596
|
-
return
|
|
34680
|
+
return chalk204.dim("unresolved comments: unknown");
|
|
34597
34681
|
}
|
|
34598
34682
|
if (pr.unresolvedThreads === 0) return null;
|
|
34599
|
-
return
|
|
34683
|
+
return chalk204.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
34600
34684
|
}
|
|
34601
34685
|
function mergeableLine(pr) {
|
|
34602
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
34686
|
+
if (pr.mergeable === "CONFLICTING") return chalk204.red("conflicting");
|
|
34603
34687
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
34604
|
-
return
|
|
34688
|
+
return chalk204.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
34605
34689
|
}
|
|
34606
34690
|
function printPrStatus(pr) {
|
|
34607
34691
|
console.log(
|
|
34608
|
-
` ${
|
|
34692
|
+
` ${chalk204.cyan(`#${pr.number}`)} ${pr.title} ${chalk204.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
34609
34693
|
);
|
|
34610
34694
|
const details = [
|
|
34611
34695
|
reviewLine(pr),
|
|
34612
34696
|
...checkLines(pr),
|
|
34613
34697
|
threadsLine(pr),
|
|
34614
34698
|
mergeableLine(pr),
|
|
34615
|
-
|
|
34699
|
+
chalk204.dim(pr.url)
|
|
34616
34700
|
];
|
|
34617
34701
|
for (const detail of details) {
|
|
34618
34702
|
if (detail) console.log(` ${detail}`);
|
|
@@ -34623,17 +34707,17 @@ function printPrStatus(pr) {
|
|
|
34623
34707
|
function printPrsStatus(report) {
|
|
34624
34708
|
for (const repo of report.repos) {
|
|
34625
34709
|
const count10 = repo.pullRequests.length;
|
|
34626
|
-
console.log(`${
|
|
34710
|
+
console.log(`${chalk205.bold(repo.repo)} ${chalk205.dim(`(${count10} open)`)}`);
|
|
34627
34711
|
for (const pr of repo.pullRequests) {
|
|
34628
34712
|
printPrStatus(pr);
|
|
34629
34713
|
}
|
|
34630
|
-
if (count10 === 0) console.log(
|
|
34714
|
+
if (count10 === 0) console.log(chalk205.dim(" no open pull requests"));
|
|
34631
34715
|
console.log();
|
|
34632
34716
|
}
|
|
34633
34717
|
if (report.errors.length === 0) return;
|
|
34634
|
-
console.log(
|
|
34718
|
+
console.log(chalk205.bold("Errors"));
|
|
34635
34719
|
for (const failure of report.errors) {
|
|
34636
|
-
console.log(` ${
|
|
34720
|
+
console.log(` ${chalk205.red(failure.repo)}: ${failure.error}`);
|
|
34637
34721
|
}
|
|
34638
34722
|
console.log();
|
|
34639
34723
|
}
|
|
@@ -34861,10 +34945,10 @@ function registerPrs(program) {
|
|
|
34861
34945
|
}
|
|
34862
34946
|
|
|
34863
34947
|
// src/commands/ravendb/ravendbAuth.ts
|
|
34864
|
-
import
|
|
34948
|
+
import chalk211 from "chalk";
|
|
34865
34949
|
|
|
34866
34950
|
// src/shared/createConnectionAuth.ts
|
|
34867
|
-
import
|
|
34951
|
+
import chalk206 from "chalk";
|
|
34868
34952
|
function listConnections(connections, format3) {
|
|
34869
34953
|
if (connections.length === 0) {
|
|
34870
34954
|
console.log("No connections configured.");
|
|
@@ -34877,7 +34961,7 @@ function listConnections(connections, format3) {
|
|
|
34877
34961
|
function removeConnection(connections, name, save) {
|
|
34878
34962
|
const filtered = connections.filter((c) => c.name !== name);
|
|
34879
34963
|
if (filtered.length === connections.length) {
|
|
34880
|
-
console.error(
|
|
34964
|
+
console.error(chalk206.red(`Connection "${name}" not found.`));
|
|
34881
34965
|
process.exit(1);
|
|
34882
34966
|
}
|
|
34883
34967
|
save(filtered);
|
|
@@ -34923,15 +35007,15 @@ function saveConnections(connections) {
|
|
|
34923
35007
|
}
|
|
34924
35008
|
|
|
34925
35009
|
// src/commands/ravendb/promptConnection.ts
|
|
34926
|
-
import
|
|
35010
|
+
import chalk209 from "chalk";
|
|
34927
35011
|
|
|
34928
35012
|
// src/commands/ravendb/selectOpSecret.ts
|
|
34929
|
-
import
|
|
35013
|
+
import chalk208 from "chalk";
|
|
34930
35014
|
import Enquirer2 from "enquirer";
|
|
34931
35015
|
|
|
34932
35016
|
// src/commands/ravendb/searchItems.ts
|
|
34933
35017
|
import { execSync as execSync47 } from "child_process";
|
|
34934
|
-
import
|
|
35018
|
+
import chalk207 from "chalk";
|
|
34935
35019
|
function opExec(args) {
|
|
34936
35020
|
return execSync47(`op ${args}`, {
|
|
34937
35021
|
encoding: "utf8",
|
|
@@ -34944,7 +35028,7 @@ function searchItems(search2) {
|
|
|
34944
35028
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
34945
35029
|
} catch {
|
|
34946
35030
|
console.error(
|
|
34947
|
-
|
|
35031
|
+
chalk207.red(
|
|
34948
35032
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
34949
35033
|
)
|
|
34950
35034
|
);
|
|
@@ -34958,7 +35042,7 @@ function getItemFields(itemId2) {
|
|
|
34958
35042
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
34959
35043
|
return item.fields.filter((f) => f.reference && f.label);
|
|
34960
35044
|
} catch {
|
|
34961
|
-
console.error(
|
|
35045
|
+
console.error(chalk207.red("Failed to get item details from 1Password."));
|
|
34962
35046
|
process.exit(1);
|
|
34963
35047
|
}
|
|
34964
35048
|
}
|
|
@@ -34977,7 +35061,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34977
35061
|
}).run();
|
|
34978
35062
|
const items2 = searchItems(search2);
|
|
34979
35063
|
if (items2.length === 0) {
|
|
34980
|
-
console.error(
|
|
35064
|
+
console.error(chalk208.red(`No items found matching "${search2}".`));
|
|
34981
35065
|
process.exit(1);
|
|
34982
35066
|
}
|
|
34983
35067
|
const itemId2 = await selectOne(
|
|
@@ -34986,7 +35070,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
34986
35070
|
);
|
|
34987
35071
|
const fields = getItemFields(itemId2);
|
|
34988
35072
|
if (fields.length === 0) {
|
|
34989
|
-
console.error(
|
|
35073
|
+
console.error(chalk208.red("No fields with references found on this item."));
|
|
34990
35074
|
process.exit(1);
|
|
34991
35075
|
}
|
|
34992
35076
|
const ref = await selectOne(
|
|
@@ -35000,7 +35084,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
35000
35084
|
async function promptConnection(existingNames) {
|
|
35001
35085
|
const name = await promptInput("name", "Connection name:");
|
|
35002
35086
|
if (existingNames.includes(name)) {
|
|
35003
|
-
console.error(
|
|
35087
|
+
console.error(chalk209.red(`Connection "${name}" already exists.`));
|
|
35004
35088
|
process.exit(1);
|
|
35005
35089
|
}
|
|
35006
35090
|
const url = await promptInput(
|
|
@@ -35009,22 +35093,22 @@ async function promptConnection(existingNames) {
|
|
|
35009
35093
|
);
|
|
35010
35094
|
const database = await promptInput("database", "Database name:");
|
|
35011
35095
|
if (!name || !url || !database) {
|
|
35012
|
-
console.error(
|
|
35096
|
+
console.error(chalk209.red("All fields are required."));
|
|
35013
35097
|
process.exit(1);
|
|
35014
35098
|
}
|
|
35015
35099
|
const apiKeyRef = await selectOpSecret();
|
|
35016
|
-
console.log(
|
|
35100
|
+
console.log(chalk209.dim(`Using: ${apiKeyRef}`));
|
|
35017
35101
|
return { name, url, database, apiKeyRef };
|
|
35018
35102
|
}
|
|
35019
35103
|
|
|
35020
35104
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
35021
|
-
import
|
|
35105
|
+
import chalk210 from "chalk";
|
|
35022
35106
|
function ravendbSetConnection(name) {
|
|
35023
35107
|
const raw = loadGlobalConfigRaw();
|
|
35024
35108
|
const ravendb = raw.ravendb ?? {};
|
|
35025
35109
|
const connections = ravendb.connections ?? [];
|
|
35026
35110
|
if (!connections.some((c) => c.name === name)) {
|
|
35027
|
-
console.error(
|
|
35111
|
+
console.error(chalk210.red(`Connection "${name}" not found.`));
|
|
35028
35112
|
console.error(
|
|
35029
35113
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
35030
35114
|
);
|
|
@@ -35040,16 +35124,16 @@ function ravendbSetConnection(name) {
|
|
|
35040
35124
|
var ravendbAuth = createConnectionAuth({
|
|
35041
35125
|
load: loadConnections,
|
|
35042
35126
|
save: saveConnections,
|
|
35043
|
-
format: (c) => `${
|
|
35127
|
+
format: (c) => `${chalk211.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
35044
35128
|
promptNew: promptConnection,
|
|
35045
35129
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
35046
35130
|
});
|
|
35047
35131
|
|
|
35048
35132
|
// src/commands/ravendb/ravendbCollections.ts
|
|
35049
|
-
import
|
|
35133
|
+
import chalk215 from "chalk";
|
|
35050
35134
|
|
|
35051
35135
|
// src/commands/ravendb/ravenFetch.ts
|
|
35052
|
-
import
|
|
35136
|
+
import chalk213 from "chalk";
|
|
35053
35137
|
|
|
35054
35138
|
// src/commands/ravendb/getAccessToken.ts
|
|
35055
35139
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -35086,10 +35170,10 @@ ${errorText}`
|
|
|
35086
35170
|
|
|
35087
35171
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
35088
35172
|
import { execSync as execSync48 } from "child_process";
|
|
35089
|
-
import
|
|
35173
|
+
import chalk212 from "chalk";
|
|
35090
35174
|
function resolveOpSecret(reference) {
|
|
35091
35175
|
if (!reference.startsWith("op://")) {
|
|
35092
|
-
console.error(
|
|
35176
|
+
console.error(chalk212.red(`Invalid secret reference: must start with op://`));
|
|
35093
35177
|
process.exit(1);
|
|
35094
35178
|
}
|
|
35095
35179
|
try {
|
|
@@ -35099,7 +35183,7 @@ function resolveOpSecret(reference) {
|
|
|
35099
35183
|
}).trim();
|
|
35100
35184
|
} catch {
|
|
35101
35185
|
console.error(
|
|
35102
|
-
|
|
35186
|
+
chalk212.red(
|
|
35103
35187
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
35104
35188
|
)
|
|
35105
35189
|
);
|
|
@@ -35126,7 +35210,7 @@ async function ravenFetch(connection, path109) {
|
|
|
35126
35210
|
if (!response.ok) {
|
|
35127
35211
|
const body = await response.text();
|
|
35128
35212
|
console.error(
|
|
35129
|
-
|
|
35213
|
+
chalk213.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
35130
35214
|
);
|
|
35131
35215
|
console.error(body.substring(0, 500));
|
|
35132
35216
|
process.exit(1);
|
|
@@ -35135,7 +35219,7 @@ async function ravenFetch(connection, path109) {
|
|
|
35135
35219
|
}
|
|
35136
35220
|
|
|
35137
35221
|
// src/commands/ravendb/resolveConnection.ts
|
|
35138
|
-
import
|
|
35222
|
+
import chalk214 from "chalk";
|
|
35139
35223
|
function loadRavendb() {
|
|
35140
35224
|
const raw = loadGlobalConfigRaw();
|
|
35141
35225
|
const ravendb = raw.ravendb;
|
|
@@ -35149,7 +35233,7 @@ function resolveConnection(name) {
|
|
|
35149
35233
|
const connectionName = name ?? defaultConnection;
|
|
35150
35234
|
if (!connectionName) {
|
|
35151
35235
|
console.error(
|
|
35152
|
-
|
|
35236
|
+
chalk214.red(
|
|
35153
35237
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
35154
35238
|
)
|
|
35155
35239
|
);
|
|
@@ -35157,7 +35241,7 @@ function resolveConnection(name) {
|
|
|
35157
35241
|
}
|
|
35158
35242
|
const connection = connections.find((c) => c.name === connectionName);
|
|
35159
35243
|
if (!connection) {
|
|
35160
|
-
console.error(
|
|
35244
|
+
console.error(chalk214.red(`Connection "${connectionName}" not found.`));
|
|
35161
35245
|
console.error(
|
|
35162
35246
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
35163
35247
|
);
|
|
@@ -35188,15 +35272,15 @@ async function ravendbCollections(connectionName) {
|
|
|
35188
35272
|
return;
|
|
35189
35273
|
}
|
|
35190
35274
|
for (const c of collections) {
|
|
35191
|
-
console.log(`${
|
|
35275
|
+
console.log(`${chalk215.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
35192
35276
|
}
|
|
35193
35277
|
}
|
|
35194
35278
|
|
|
35195
35279
|
// src/commands/ravendb/ravendbQuery.ts
|
|
35196
|
-
import
|
|
35280
|
+
import chalk217 from "chalk";
|
|
35197
35281
|
|
|
35198
35282
|
// src/commands/ravendb/fetchAllPages.ts
|
|
35199
|
-
import
|
|
35283
|
+
import chalk216 from "chalk";
|
|
35200
35284
|
|
|
35201
35285
|
// src/commands/ravendb/buildQueryPath.ts
|
|
35202
35286
|
function buildQueryPath(opts) {
|
|
@@ -35234,7 +35318,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
35234
35318
|
allResults.push(...results);
|
|
35235
35319
|
start2 += results.length;
|
|
35236
35320
|
process.stderr.write(
|
|
35237
|
-
`\r${
|
|
35321
|
+
`\r${chalk216.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
35238
35322
|
);
|
|
35239
35323
|
if (start2 >= totalResults) break;
|
|
35240
35324
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -35249,7 +35333,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
35249
35333
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
35250
35334
|
const resolved = resolveArgs(connectionName, collection);
|
|
35251
35335
|
if (!resolved.collection && !options2.query) {
|
|
35252
|
-
console.error(
|
|
35336
|
+
console.error(chalk217.red("Provide a collection name or --query filter."));
|
|
35253
35337
|
process.exit(1);
|
|
35254
35338
|
}
|
|
35255
35339
|
const { collection: col } = resolved;
|
|
@@ -35284,7 +35368,7 @@ function registerRavendb(program) {
|
|
|
35284
35368
|
}
|
|
35285
35369
|
|
|
35286
35370
|
// src/commands/releases/releasesConfigure.ts
|
|
35287
|
-
import
|
|
35371
|
+
import chalk219 from "chalk";
|
|
35288
35372
|
|
|
35289
35373
|
// src/commands/config/parseRepoScopeFlag.ts
|
|
35290
35374
|
var REPO_SCOPE_FLAGS = {
|
|
@@ -35355,26 +35439,26 @@ function readStreamsInput(source) {
|
|
|
35355
35439
|
}
|
|
35356
35440
|
|
|
35357
35441
|
// src/commands/releases/reportDerivedStreams.ts
|
|
35358
|
-
import
|
|
35442
|
+
import chalk218 from "chalk";
|
|
35359
35443
|
function printDerived(stream) {
|
|
35360
35444
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
35361
35445
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
35362
35446
|
console.log(
|
|
35363
|
-
`${
|
|
35447
|
+
`${chalk218.bold(stream.name)} ${chalk218.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
35364
35448
|
);
|
|
35365
35449
|
console.log(
|
|
35366
|
-
` environments: ${environments.join(", ") ||
|
|
35450
|
+
` environments: ${environments.join(", ") || chalk218.dim("none")}`
|
|
35367
35451
|
);
|
|
35368
35452
|
if (steps.length > 0)
|
|
35369
35453
|
console.log(
|
|
35370
35454
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
35371
35455
|
);
|
|
35372
35456
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
35373
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
35457
|
+
console.log(` edges: ${edges.join(", ") || chalk218.dim("none")}`);
|
|
35374
35458
|
}
|
|
35375
35459
|
function reportDerivedStreams(streams, target) {
|
|
35376
35460
|
for (const stream of streams) printDerived(stream);
|
|
35377
|
-
console.log(
|
|
35461
|
+
console.log(chalk218.dim(`Written to ${target}`));
|
|
35378
35462
|
}
|
|
35379
35463
|
|
|
35380
35464
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -35388,9 +35472,9 @@ function withCurrentRepo(streams) {
|
|
|
35388
35472
|
// src/commands/config/applyConfigWrites.ts
|
|
35389
35473
|
function applyConfigWrites(base, writes, schema2) {
|
|
35390
35474
|
let updated2 = base;
|
|
35391
|
-
for (const
|
|
35392
|
-
updated2 = setNestedValue(updated2,
|
|
35393
|
-
const validation = validateConfig(updated2,
|
|
35475
|
+
for (const write2 of writes) {
|
|
35476
|
+
updated2 = setNestedValue(updated2, write2.key, write2.value);
|
|
35477
|
+
const validation = validateConfig(updated2, write2.key, schema2);
|
|
35394
35478
|
if (!validation.ok) return validation;
|
|
35395
35479
|
}
|
|
35396
35480
|
return { ok: true, updated: updated2 };
|
|
@@ -35398,12 +35482,12 @@ function applyConfigWrites(base, writes, schema2) {
|
|
|
35398
35482
|
|
|
35399
35483
|
// src/commands/config/writeConfigKeys.ts
|
|
35400
35484
|
async function writeConfigKeys(writes, scope, cwd = process.cwd()) {
|
|
35401
|
-
const globalOnly = writes.filter((
|
|
35485
|
+
const globalOnly = writes.filter((write2) => isGlobalOnlyConfigKey(write2.key));
|
|
35402
35486
|
if (globalOnly.length > 0) {
|
|
35403
35487
|
return {
|
|
35404
35488
|
ok: false,
|
|
35405
35489
|
errors: globalOnly.map(
|
|
35406
|
-
(
|
|
35490
|
+
(write2) => `"${write2.key}" is a user (node)-only key. Set it with 'assist config set ${write2.key} <value> --node'`
|
|
35407
35491
|
)
|
|
35408
35492
|
};
|
|
35409
35493
|
}
|
|
@@ -35465,8 +35549,8 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
35465
35549
|
|
|
35466
35550
|
// src/commands/releases/releasesConfigure.ts
|
|
35467
35551
|
function fail8(message3, details = []) {
|
|
35468
|
-
console.error(
|
|
35469
|
-
for (const detail of details) console.error(
|
|
35552
|
+
console.error(chalk219.red(message3));
|
|
35553
|
+
for (const detail of details) console.error(chalk219.red(` ${detail}`));
|
|
35470
35554
|
process.exitCode = 1;
|
|
35471
35555
|
}
|
|
35472
35556
|
function reportWritten(incoming, target) {
|
|
@@ -35499,23 +35583,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
35499
35583
|
}
|
|
35500
35584
|
|
|
35501
35585
|
// src/commands/releases/releasesList.ts
|
|
35502
|
-
import
|
|
35586
|
+
import chalk220 from "chalk";
|
|
35503
35587
|
function describeNode(node) {
|
|
35504
35588
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
35505
35589
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
35506
35590
|
}
|
|
35507
35591
|
function printStream(stream) {
|
|
35508
|
-
console.log(`${
|
|
35509
|
-
console.log(
|
|
35592
|
+
console.log(`${chalk220.bold(stream.name)} ${chalk220.dim(stream.repo)}`);
|
|
35593
|
+
console.log(chalk220.dim(` workflow: ${stream.workflow}`));
|
|
35510
35594
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
35511
35595
|
for (const [from, to] of stream.edges)
|
|
35512
|
-
console.log(
|
|
35596
|
+
console.log(chalk220.dim(` ${from} \u2192 ${to}`));
|
|
35513
35597
|
}
|
|
35514
35598
|
function releasesList() {
|
|
35515
35599
|
const streams = loadConfig().releases?.streams ?? [];
|
|
35516
35600
|
if (streams.length === 0) {
|
|
35517
35601
|
console.log(
|
|
35518
|
-
|
|
35602
|
+
chalk220.dim("No release streams configured under releases.streams.")
|
|
35519
35603
|
);
|
|
35520
35604
|
return;
|
|
35521
35605
|
}
|
|
@@ -35563,7 +35647,7 @@ function coverage() {
|
|
|
35563
35647
|
|
|
35564
35648
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
35565
35649
|
import path45 from "path";
|
|
35566
|
-
import
|
|
35650
|
+
import chalk222 from "chalk";
|
|
35567
35651
|
|
|
35568
35652
|
// src/commands/lint/lint/checkFileNames.ts
|
|
35569
35653
|
import fs23 from "fs";
|
|
@@ -35643,7 +35727,7 @@ function checkFileNames() {
|
|
|
35643
35727
|
}
|
|
35644
35728
|
|
|
35645
35729
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
35646
|
-
import
|
|
35730
|
+
import chalk221 from "chalk";
|
|
35647
35731
|
|
|
35648
35732
|
// src/commands/lint/lint/applyMoves.ts
|
|
35649
35733
|
import fs24 from "fs";
|
|
@@ -35728,25 +35812,25 @@ function fixFileNameViolations(moves) {
|
|
|
35728
35812
|
const start2 = performance.now();
|
|
35729
35813
|
const project = createLintProject();
|
|
35730
35814
|
const cwd = process.cwd();
|
|
35731
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
35815
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk221.green(line)));
|
|
35732
35816
|
const ms = (performance.now() - start2).toFixed(0);
|
|
35733
|
-
console.log(
|
|
35817
|
+
console.log(chalk221.dim(` Done in ${ms}ms`));
|
|
35734
35818
|
}
|
|
35735
35819
|
|
|
35736
35820
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
35737
35821
|
function reportViolations(violations) {
|
|
35738
|
-
console.error(
|
|
35822
|
+
console.error(chalk222.red("\nFile name check failed:\n"));
|
|
35739
35823
|
console.error(
|
|
35740
|
-
|
|
35824
|
+
chalk222.red(
|
|
35741
35825
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
35742
35826
|
)
|
|
35743
35827
|
);
|
|
35744
35828
|
for (const violation of violations) {
|
|
35745
|
-
console.error(
|
|
35746
|
-
console.error(
|
|
35829
|
+
console.error(chalk222.red(` ${violation.filePath}`));
|
|
35830
|
+
console.error(chalk222.gray(` Rename to: ${violation.suggestedName}
|
|
35747
35831
|
`));
|
|
35748
35832
|
}
|
|
35749
|
-
console.error(
|
|
35833
|
+
console.error(chalk222.dim(" Run with -f to auto-fix.\n"));
|
|
35750
35834
|
}
|
|
35751
35835
|
function runFileNameCheck(fix = false) {
|
|
35752
35836
|
const violations = checkFileNames();
|
|
@@ -35775,17 +35859,17 @@ function runFileNameCheck(fix = false) {
|
|
|
35775
35859
|
import fs26 from "fs";
|
|
35776
35860
|
|
|
35777
35861
|
// src/commands/lint/shared.ts
|
|
35778
|
-
import
|
|
35862
|
+
import chalk223 from "chalk";
|
|
35779
35863
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
35780
35864
|
if (violations.length > 0) {
|
|
35781
|
-
console.error(
|
|
35865
|
+
console.error(chalk223.red(`
|
|
35782
35866
|
${checkName2} failed:
|
|
35783
35867
|
`));
|
|
35784
|
-
console.error(
|
|
35868
|
+
console.error(chalk223.red(` ${errorMessage3}
|
|
35785
35869
|
`));
|
|
35786
35870
|
for (const violation of violations) {
|
|
35787
|
-
console.error(
|
|
35788
|
-
console.error(
|
|
35871
|
+
console.error(chalk223.red(` ${violation.filePath}:${violation.line}`));
|
|
35872
|
+
console.error(chalk223.gray(` ${violation.content}
|
|
35789
35873
|
`));
|
|
35790
35874
|
}
|
|
35791
35875
|
return false;
|
|
@@ -36007,10 +36091,10 @@ async function notify() {
|
|
|
36007
36091
|
|
|
36008
36092
|
// src/commands/screenshot.ts
|
|
36009
36093
|
import { execSync as execSync50 } from "child_process";
|
|
36010
|
-
import { existsSync as existsSync66, mkdirSync as
|
|
36094
|
+
import { existsSync as existsSync66, mkdirSync as mkdirSync27, unlinkSync as unlinkSync17, writeFileSync as writeFileSync42 } from "fs";
|
|
36011
36095
|
import { tmpdir as tmpdir7 } from "os";
|
|
36012
|
-
import { join as
|
|
36013
|
-
import
|
|
36096
|
+
import { join as join87, resolve as resolve25 } from "path";
|
|
36097
|
+
import chalk224 from "chalk";
|
|
36014
36098
|
|
|
36015
36099
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
36016
36100
|
var captureWindowPs1 = `
|
|
@@ -36140,14 +36224,14 @@ Write-Output $OutputPath
|
|
|
36140
36224
|
// src/commands/screenshot.ts
|
|
36141
36225
|
function buildOutputPath(outputDir, processName) {
|
|
36142
36226
|
if (!existsSync66(outputDir)) {
|
|
36143
|
-
|
|
36227
|
+
mkdirSync27(outputDir, { recursive: true });
|
|
36144
36228
|
}
|
|
36145
36229
|
const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
36146
36230
|
return resolve25(outputDir, `${processName}-${timestamp8}.png`);
|
|
36147
36231
|
}
|
|
36148
36232
|
function runPowerShellScript(processName, outputPath) {
|
|
36149
|
-
const scriptPath =
|
|
36150
|
-
|
|
36233
|
+
const scriptPath = join87(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
36234
|
+
writeFileSync42(scriptPath, captureWindowPs1, "utf8");
|
|
36151
36235
|
try {
|
|
36152
36236
|
execSync50(
|
|
36153
36237
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -36161,22 +36245,22 @@ function screenshot(processName) {
|
|
|
36161
36245
|
const config = loadConfig();
|
|
36162
36246
|
const outputDir = resolve25(config.screenshot.outputDir);
|
|
36163
36247
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
36164
|
-
console.log(
|
|
36248
|
+
console.log(chalk224.gray(`Capturing window for process "${processName}" ...`));
|
|
36165
36249
|
try {
|
|
36166
36250
|
runPowerShellScript(processName, outputPath);
|
|
36167
|
-
console.log(
|
|
36251
|
+
console.log(chalk224.green(`Screenshot saved: ${outputPath}`));
|
|
36168
36252
|
} catch (error) {
|
|
36169
36253
|
const msg = error instanceof Error ? error.message : String(error);
|
|
36170
|
-
console.error(
|
|
36254
|
+
console.error(chalk224.red(`Failed to capture screenshot: ${msg}`));
|
|
36171
36255
|
process.exit(1);
|
|
36172
36256
|
}
|
|
36173
36257
|
}
|
|
36174
36258
|
|
|
36175
36259
|
// src/commands/statusLine.ts
|
|
36176
|
-
import
|
|
36260
|
+
import chalk227 from "chalk";
|
|
36177
36261
|
|
|
36178
36262
|
// src/commands/buildLimitsSegment.ts
|
|
36179
|
-
import
|
|
36263
|
+
import chalk225 from "chalk";
|
|
36180
36264
|
|
|
36181
36265
|
// src/shared/rateLimitLevel.ts
|
|
36182
36266
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -36214,9 +36298,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
36214
36298
|
|
|
36215
36299
|
// src/commands/buildLimitsSegment.ts
|
|
36216
36300
|
var LEVEL_COLOR = {
|
|
36217
|
-
ok:
|
|
36218
|
-
warn:
|
|
36219
|
-
over:
|
|
36301
|
+
ok: chalk225.green,
|
|
36302
|
+
warn: chalk225.yellow,
|
|
36303
|
+
over: chalk225.red
|
|
36220
36304
|
};
|
|
36221
36305
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
36222
36306
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -36248,9 +36332,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
36248
36332
|
|
|
36249
36333
|
// src/commands/readGitBranch.ts
|
|
36250
36334
|
import { readFileSync as readFileSync51, statSync as statSync10 } from "fs";
|
|
36251
|
-
import { isAbsolute as isAbsolute6, join as
|
|
36335
|
+
import { isAbsolute as isAbsolute6, join as join88, resolve as resolve26 } from "path";
|
|
36252
36336
|
function resolveGitDir(cwd) {
|
|
36253
|
-
const dotGit =
|
|
36337
|
+
const dotGit = join88(cwd, ".git");
|
|
36254
36338
|
let stat5;
|
|
36255
36339
|
try {
|
|
36256
36340
|
stat5 = statSync10(dotGit);
|
|
@@ -36280,7 +36364,7 @@ function readGitBranch(cwd) {
|
|
|
36280
36364
|
}
|
|
36281
36365
|
let head;
|
|
36282
36366
|
try {
|
|
36283
|
-
head = readFileSync51(
|
|
36367
|
+
head = readFileSync51(join88(gitDir, "HEAD"), "utf8");
|
|
36284
36368
|
} catch {
|
|
36285
36369
|
return null;
|
|
36286
36370
|
}
|
|
@@ -36312,7 +36396,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
36312
36396
|
}
|
|
36313
36397
|
|
|
36314
36398
|
// src/commands/colorizePercent.ts
|
|
36315
|
-
import
|
|
36399
|
+
import chalk226 from "chalk";
|
|
36316
36400
|
|
|
36317
36401
|
// src/shared/contextLevel.ts
|
|
36318
36402
|
var THRESHOLDS = {
|
|
@@ -36332,16 +36416,16 @@ function colorizePercent(pct) {
|
|
|
36332
36416
|
const label = `${Math.round(pct)}%`;
|
|
36333
36417
|
switch (contextLevel(pct)) {
|
|
36334
36418
|
case "red":
|
|
36335
|
-
return
|
|
36419
|
+
return chalk226.red(label);
|
|
36336
36420
|
case "yellow":
|
|
36337
|
-
return
|
|
36421
|
+
return chalk226.yellow(label);
|
|
36338
36422
|
default:
|
|
36339
36423
|
return label;
|
|
36340
36424
|
}
|
|
36341
36425
|
}
|
|
36342
36426
|
|
|
36343
36427
|
// src/commands/statusLine.ts
|
|
36344
|
-
|
|
36428
|
+
chalk227.level = 3;
|
|
36345
36429
|
function formatNumber(num) {
|
|
36346
36430
|
return num.toLocaleString("en-US");
|
|
36347
36431
|
}
|
|
@@ -36353,7 +36437,7 @@ async function statusLine() {
|
|
|
36353
36437
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
36354
36438
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
36355
36439
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
36356
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
36440
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk227.cyan(branch2)} | ` : "";
|
|
36357
36441
|
const limitsSegment = process.env.ASSIST_SESSION === "1" ? "" : buildLimitsSegment(data.rate_limits);
|
|
36358
36442
|
console.log(
|
|
36359
36443
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${limitsSegment}`
|
|
@@ -36461,7 +36545,7 @@ import { spawn as spawn8 } from "child_process";
|
|
|
36461
36545
|
import * as path48 from "path";
|
|
36462
36546
|
|
|
36463
36547
|
// src/commands/refactor/logViolations.ts
|
|
36464
|
-
import
|
|
36548
|
+
import chalk228 from "chalk";
|
|
36465
36549
|
var DEFAULT_MAX_LINES2 = 100;
|
|
36466
36550
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
36467
36551
|
if (violations.length === 0) {
|
|
@@ -36470,43 +36554,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
36470
36554
|
}
|
|
36471
36555
|
return;
|
|
36472
36556
|
}
|
|
36473
|
-
console.error(
|
|
36557
|
+
console.error(chalk228.red(`
|
|
36474
36558
|
Refactor check failed:
|
|
36475
36559
|
`));
|
|
36476
|
-
console.error(
|
|
36560
|
+
console.error(chalk228.red(` The following files exceed ${maxLines} lines:
|
|
36477
36561
|
`));
|
|
36478
36562
|
for (const violation of violations) {
|
|
36479
|
-
console.error(
|
|
36563
|
+
console.error(chalk228.red(` ${violation.file} (${violation.lines} lines)`));
|
|
36480
36564
|
}
|
|
36481
36565
|
console.error(
|
|
36482
|
-
|
|
36566
|
+
chalk228.yellow(
|
|
36483
36567
|
`
|
|
36484
36568
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
36485
36569
|
way to refactor it, ignore it with:
|
|
36486
36570
|
`
|
|
36487
36571
|
)
|
|
36488
36572
|
);
|
|
36489
|
-
console.error(
|
|
36573
|
+
console.error(chalk228.gray(` assist refactor ignore <file>
|
|
36490
36574
|
`));
|
|
36491
36575
|
if (process.env.CLAUDECODE) {
|
|
36492
|
-
console.error(
|
|
36576
|
+
console.error(chalk228.cyan(`
|
|
36493
36577
|
## Extracting Code to New Files
|
|
36494
36578
|
`));
|
|
36495
36579
|
console.error(
|
|
36496
|
-
|
|
36580
|
+
chalk228.cyan(
|
|
36497
36581
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
36498
36582
|
`
|
|
36499
36583
|
)
|
|
36500
36584
|
);
|
|
36501
36585
|
console.error(
|
|
36502
|
-
|
|
36586
|
+
chalk228.cyan(
|
|
36503
36587
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
36504
36588
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
36505
36589
|
`
|
|
36506
36590
|
)
|
|
36507
36591
|
);
|
|
36508
36592
|
console.error(
|
|
36509
|
-
|
|
36593
|
+
chalk228.cyan(
|
|
36510
36594
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
36511
36595
|
domains, move it to a common/shared folder.
|
|
36512
36596
|
`
|
|
@@ -36662,7 +36746,7 @@ async function check(pattern2, options2) {
|
|
|
36662
36746
|
|
|
36663
36747
|
// src/commands/refactor/extract.ts
|
|
36664
36748
|
import path56 from "path";
|
|
36665
|
-
import
|
|
36749
|
+
import chalk231 from "chalk";
|
|
36666
36750
|
|
|
36667
36751
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
36668
36752
|
import { SyntaxKind as SyntaxKind8 } from "ts-morph";
|
|
@@ -37270,23 +37354,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
37270
37354
|
|
|
37271
37355
|
// src/commands/refactor/extract/displayPlan.ts
|
|
37272
37356
|
import path52 from "path";
|
|
37273
|
-
import
|
|
37357
|
+
import chalk229 from "chalk";
|
|
37274
37358
|
function section(title) {
|
|
37275
37359
|
return `
|
|
37276
|
-
${
|
|
37360
|
+
${chalk229.cyan(title)}`;
|
|
37277
37361
|
}
|
|
37278
37362
|
function displayImporters(plan2, cwd) {
|
|
37279
37363
|
if (plan2.importersToUpdate.length === 0) return;
|
|
37280
37364
|
console.log(section("Update importers:"));
|
|
37281
37365
|
for (const imp of plan2.importersToUpdate) {
|
|
37282
37366
|
const rel = path52.relative(cwd, imp.file.getFilePath());
|
|
37283
|
-
console.log(` ${
|
|
37367
|
+
console.log(` ${chalk229.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
37284
37368
|
}
|
|
37285
37369
|
}
|
|
37286
37370
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
37287
|
-
console.log(
|
|
37371
|
+
console.log(chalk229.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
37288
37372
|
`));
|
|
37289
|
-
console.log(` ${
|
|
37373
|
+
console.log(` ${chalk229.cyan("Functions to move:")}`);
|
|
37290
37374
|
for (const name of plan2.extractedNames) {
|
|
37291
37375
|
console.log(` ${name}`);
|
|
37292
37376
|
}
|
|
@@ -37320,7 +37404,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
37320
37404
|
|
|
37321
37405
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
37322
37406
|
import path55 from "path";
|
|
37323
|
-
import
|
|
37407
|
+
import chalk230 from "chalk";
|
|
37324
37408
|
import { Project as Project4 } from "ts-morph";
|
|
37325
37409
|
|
|
37326
37410
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -37412,7 +37496,7 @@ function loadProjectFile(file) {
|
|
|
37412
37496
|
});
|
|
37413
37497
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
37414
37498
|
if (!sourceFile) {
|
|
37415
|
-
console.log(
|
|
37499
|
+
console.log(chalk230.red(`File not found in project: ${file}`));
|
|
37416
37500
|
process.exit(1);
|
|
37417
37501
|
}
|
|
37418
37502
|
return { project, sourceFile };
|
|
@@ -37435,19 +37519,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
37435
37519
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
37436
37520
|
if (options2.apply) {
|
|
37437
37521
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
37438
|
-
console.log(
|
|
37522
|
+
console.log(chalk231.green("\nExtraction complete"));
|
|
37439
37523
|
} else {
|
|
37440
|
-
console.log(
|
|
37524
|
+
console.log(chalk231.dim("\nDry run. Use --apply to execute."));
|
|
37441
37525
|
}
|
|
37442
37526
|
}
|
|
37443
37527
|
|
|
37444
37528
|
// src/commands/refactor/ignore.ts
|
|
37445
37529
|
import fs33 from "fs";
|
|
37446
|
-
import
|
|
37530
|
+
import chalk232 from "chalk";
|
|
37447
37531
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
37448
37532
|
function ignore2(file) {
|
|
37449
37533
|
if (!fs33.existsSync(file)) {
|
|
37450
|
-
console.error(
|
|
37534
|
+
console.error(chalk232.red(`Error: File does not exist: ${file}`));
|
|
37451
37535
|
process.exit(1);
|
|
37452
37536
|
}
|
|
37453
37537
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -37463,7 +37547,7 @@ function ignore2(file) {
|
|
|
37463
37547
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
37464
37548
|
}
|
|
37465
37549
|
console.log(
|
|
37466
|
-
|
|
37550
|
+
chalk232.green(
|
|
37467
37551
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
37468
37552
|
)
|
|
37469
37553
|
);
|
|
@@ -37472,12 +37556,12 @@ function ignore2(file) {
|
|
|
37472
37556
|
// src/commands/refactor/rename.ts
|
|
37473
37557
|
import fs36 from "fs";
|
|
37474
37558
|
import path62 from "path";
|
|
37475
|
-
import
|
|
37559
|
+
import chalk235 from "chalk";
|
|
37476
37560
|
|
|
37477
37561
|
// src/commands/refactor/rename/applyRename.ts
|
|
37478
37562
|
import fs35 from "fs";
|
|
37479
37563
|
import path58 from "path";
|
|
37480
|
-
import
|
|
37564
|
+
import chalk233 from "chalk";
|
|
37481
37565
|
|
|
37482
37566
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
37483
37567
|
import path57 from "path";
|
|
@@ -37583,13 +37667,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
37583
37667
|
const updatedContents = applyRewrites(rewrites);
|
|
37584
37668
|
for (const [file, content] of updatedContents) {
|
|
37585
37669
|
fs35.writeFileSync(file, content, "utf8");
|
|
37586
|
-
console.log(
|
|
37670
|
+
console.log(chalk233.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
|
|
37587
37671
|
}
|
|
37588
37672
|
const destDir = path58.dirname(destPath);
|
|
37589
37673
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
37590
37674
|
fs35.renameSync(sourcePath, destPath);
|
|
37591
37675
|
console.log(
|
|
37592
|
-
|
|
37676
|
+
chalk233.white(
|
|
37593
37677
|
` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
|
|
37594
37678
|
)
|
|
37595
37679
|
);
|
|
@@ -37739,16 +37823,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
37739
37823
|
|
|
37740
37824
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
37741
37825
|
import path61 from "path";
|
|
37742
|
-
import
|
|
37826
|
+
import chalk234 from "chalk";
|
|
37743
37827
|
function printRenamePreview(rewrites, cwd) {
|
|
37744
37828
|
for (const rewrite of rewrites) {
|
|
37745
37829
|
console.log(
|
|
37746
|
-
|
|
37830
|
+
chalk234.dim(
|
|
37747
37831
|
` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
37748
37832
|
)
|
|
37749
37833
|
);
|
|
37750
37834
|
}
|
|
37751
|
-
console.log(
|
|
37835
|
+
console.log(chalk234.dim("Dry run. Use --apply to execute."));
|
|
37752
37836
|
}
|
|
37753
37837
|
|
|
37754
37838
|
// src/commands/refactor/rename.ts
|
|
@@ -37759,20 +37843,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37759
37843
|
const relSource = path62.relative(cwd, sourcePath);
|
|
37760
37844
|
const relDest = path62.relative(cwd, destPath);
|
|
37761
37845
|
if (!fs36.existsSync(sourcePath)) {
|
|
37762
|
-
console.log(
|
|
37846
|
+
console.log(chalk235.red(`File not found: ${source}`));
|
|
37763
37847
|
process.exit(1);
|
|
37764
37848
|
}
|
|
37765
37849
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
37766
|
-
console.log(
|
|
37850
|
+
console.log(chalk235.red(`Destination already exists: ${destination}`));
|
|
37767
37851
|
process.exit(1);
|
|
37768
37852
|
}
|
|
37769
|
-
console.log(
|
|
37770
|
-
console.log(
|
|
37771
|
-
console.log(
|
|
37853
|
+
console.log(chalk235.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
37854
|
+
console.log(chalk235.dim("Loading project..."));
|
|
37855
|
+
console.log(chalk235.dim("Scanning imports across the project..."));
|
|
37772
37856
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
37773
37857
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
37774
37858
|
console.log(
|
|
37775
|
-
|
|
37859
|
+
chalk235.dim(
|
|
37776
37860
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
37777
37861
|
)
|
|
37778
37862
|
);
|
|
@@ -37781,11 +37865,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
37781
37865
|
return;
|
|
37782
37866
|
}
|
|
37783
37867
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
37784
|
-
console.log(
|
|
37868
|
+
console.log(chalk235.green("Done"));
|
|
37785
37869
|
}
|
|
37786
37870
|
|
|
37787
37871
|
// src/commands/refactor/renameSymbol.ts
|
|
37788
|
-
import
|
|
37872
|
+
import chalk236 from "chalk";
|
|
37789
37873
|
|
|
37790
37874
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
37791
37875
|
import { SyntaxKind as SyntaxKind19 } from "ts-morph";
|
|
@@ -37831,34 +37915,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
37831
37915
|
const { project, sourceFile } = loadProjectFile(file);
|
|
37832
37916
|
const symbol = findSymbol(sourceFile, oldName);
|
|
37833
37917
|
if (!symbol) {
|
|
37834
|
-
console.log(
|
|
37918
|
+
console.log(chalk236.red(`Symbol "${oldName}" not found in ${file}`));
|
|
37835
37919
|
process.exit(1);
|
|
37836
37920
|
}
|
|
37837
37921
|
const grouped = groupReferences(symbol, cwd);
|
|
37838
37922
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
37839
37923
|
console.log(
|
|
37840
|
-
|
|
37924
|
+
chalk236.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
37841
37925
|
`)
|
|
37842
37926
|
);
|
|
37843
37927
|
for (const [refFile, lines2] of grouped) {
|
|
37844
37928
|
console.log(
|
|
37845
|
-
` ${
|
|
37929
|
+
` ${chalk236.dim(refFile)}: lines ${chalk236.cyan(lines2.join(", "))}`
|
|
37846
37930
|
);
|
|
37847
37931
|
}
|
|
37848
37932
|
if (options2.apply) {
|
|
37849
37933
|
symbol.rename(newName);
|
|
37850
37934
|
await project.save();
|
|
37851
|
-
console.log(
|
|
37935
|
+
console.log(chalk236.green(`
|
|
37852
37936
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
37853
37937
|
} else {
|
|
37854
|
-
console.log(
|
|
37938
|
+
console.log(chalk236.dim("\nDry run. Use --apply to execute."));
|
|
37855
37939
|
}
|
|
37856
37940
|
}
|
|
37857
37941
|
|
|
37858
37942
|
// src/commands/refactor/restructure.ts
|
|
37859
37943
|
import fs38 from "fs";
|
|
37860
37944
|
import path83 from "path";
|
|
37861
|
-
import
|
|
37945
|
+
import chalk246 from "chalk";
|
|
37862
37946
|
|
|
37863
37947
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
37864
37948
|
import path73 from "path";
|
|
@@ -38195,7 +38279,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
38195
38279
|
}
|
|
38196
38280
|
|
|
38197
38281
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
38198
|
-
import
|
|
38282
|
+
import chalk241 from "chalk";
|
|
38199
38283
|
|
|
38200
38284
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
38201
38285
|
import path74 from "path";
|
|
@@ -38206,13 +38290,13 @@ function applyCommand(scopeRoot) {
|
|
|
38206
38290
|
|
|
38207
38291
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
38208
38292
|
import path75 from "path";
|
|
38209
|
-
import
|
|
38293
|
+
import chalk237 from "chalk";
|
|
38210
38294
|
var shownMoves = 20;
|
|
38211
38295
|
function displayDrift(plan2, listMoves) {
|
|
38212
38296
|
const rel = (file) => path75.relative(process.cwd(), file);
|
|
38213
38297
|
if (plan2.moves.length > 0) {
|
|
38214
38298
|
console.log(
|
|
38215
|
-
|
|
38299
|
+
chalk237.red(
|
|
38216
38300
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
38217
38301
|
)
|
|
38218
38302
|
);
|
|
@@ -38220,17 +38304,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
38220
38304
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
38221
38305
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
38222
38306
|
if (plan2.moves.length > shownMoves)
|
|
38223
|
-
console.log(
|
|
38307
|
+
console.log(chalk237.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
38224
38308
|
}
|
|
38225
38309
|
}
|
|
38226
|
-
for (const error of plan2.errors) console.log(
|
|
38310
|
+
for (const error of plan2.errors) console.log(chalk237.red(error));
|
|
38227
38311
|
}
|
|
38228
38312
|
|
|
38229
38313
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
38230
|
-
import
|
|
38314
|
+
import chalk240 from "chalk";
|
|
38231
38315
|
|
|
38232
38316
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
38233
|
-
import
|
|
38317
|
+
import chalk238 from "chalk";
|
|
38234
38318
|
var shownChains = 10;
|
|
38235
38319
|
function formatChain(chain2) {
|
|
38236
38320
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -38240,28 +38324,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
38240
38324
|
if (chains.length === 0) return;
|
|
38241
38325
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
38242
38326
|
console.log(
|
|
38243
|
-
|
|
38327
|
+
chalk238.red(
|
|
38244
38328
|
`
|
|
38245
38329
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
38246
38330
|
)
|
|
38247
38331
|
);
|
|
38248
38332
|
console.log(
|
|
38249
|
-
|
|
38333
|
+
chalk238.bold(
|
|
38250
38334
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
38251
38335
|
)
|
|
38252
38336
|
);
|
|
38253
38337
|
for (const chain2 of chains.slice(0, shownChains))
|
|
38254
38338
|
console.log(formatChain(chain2));
|
|
38255
38339
|
if (chains.length > shownChains)
|
|
38256
|
-
console.log(
|
|
38340
|
+
console.log(chalk238.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
38257
38341
|
}
|
|
38258
38342
|
|
|
38259
38343
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
38260
|
-
import
|
|
38344
|
+
import chalk239 from "chalk";
|
|
38261
38345
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
38262
38346
|
if (longPaths.length === 0) return;
|
|
38263
38347
|
console.log(
|
|
38264
|
-
|
|
38348
|
+
chalk239.red(
|
|
38265
38349
|
`
|
|
38266
38350
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
38267
38351
|
)
|
|
@@ -38289,7 +38373,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
38289
38373
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
38290
38374
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
38291
38375
|
console.log("");
|
|
38292
|
-
for (const line of pinSteps(apply)) console.log(
|
|
38376
|
+
for (const line of pinSteps(apply)) console.log(chalk240.yellow(line));
|
|
38293
38377
|
}
|
|
38294
38378
|
|
|
38295
38379
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -38301,14 +38385,14 @@ function checkPlan(plan2, limits) {
|
|
|
38301
38385
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
38302
38386
|
if (plan2.moves.length > 0) {
|
|
38303
38387
|
console.log(
|
|
38304
|
-
|
|
38388
|
+
chalk241.yellow(
|
|
38305
38389
|
`
|
|
38306
38390
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
38307
38391
|
)
|
|
38308
38392
|
);
|
|
38309
38393
|
process.exit(1);
|
|
38310
38394
|
}
|
|
38311
|
-
console.log(
|
|
38395
|
+
console.log(chalk241.green("Layout matches the restructure plan"));
|
|
38312
38396
|
}
|
|
38313
38397
|
|
|
38314
38398
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -38378,15 +38462,15 @@ function partitionIgnored(files) {
|
|
|
38378
38462
|
}
|
|
38379
38463
|
|
|
38380
38464
|
// src/commands/refactor/restructure/runPlan.ts
|
|
38381
|
-
import
|
|
38465
|
+
import chalk245 from "chalk";
|
|
38382
38466
|
|
|
38383
38467
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
38384
|
-
import
|
|
38468
|
+
import chalk243 from "chalk";
|
|
38385
38469
|
|
|
38386
38470
|
// src/commands/refactor/restructure/executePlan.ts
|
|
38387
38471
|
import fs37 from "fs";
|
|
38388
38472
|
import path79 from "path";
|
|
38389
|
-
import
|
|
38473
|
+
import chalk242 from "chalk";
|
|
38390
38474
|
function relPath(file) {
|
|
38391
38475
|
return path79.relative(process.cwd(), file);
|
|
38392
38476
|
}
|
|
@@ -38403,14 +38487,14 @@ function moveFiles(moves) {
|
|
|
38403
38487
|
fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
|
|
38404
38488
|
fs37.renameSync(staging, move2.to);
|
|
38405
38489
|
console.log(
|
|
38406
|
-
|
|
38490
|
+
chalk242.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
38407
38491
|
);
|
|
38408
38492
|
}
|
|
38409
38493
|
}
|
|
38410
38494
|
function removeIfEmpty(dir) {
|
|
38411
38495
|
if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
|
|
38412
38496
|
fs37.rmdirSync(dir);
|
|
38413
|
-
console.log(
|
|
38497
|
+
console.log(chalk242.dim(` Removed empty directory ${relPath(dir)}`));
|
|
38414
38498
|
return true;
|
|
38415
38499
|
}
|
|
38416
38500
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -38423,7 +38507,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
38423
38507
|
function executePlan(plan2) {
|
|
38424
38508
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
38425
38509
|
fs37.writeFileSync(file, content, "utf8");
|
|
38426
|
-
console.log(
|
|
38510
|
+
console.log(chalk242.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
38427
38511
|
}
|
|
38428
38512
|
moveFiles(plan2.moves);
|
|
38429
38513
|
removeEmptyDirectories(
|
|
@@ -38435,17 +38519,17 @@ function executePlan(plan2) {
|
|
|
38435
38519
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
38436
38520
|
function applyPlan(plan2) {
|
|
38437
38521
|
if (plan2.errors.length > 0) {
|
|
38438
|
-
console.log(
|
|
38522
|
+
console.log(chalk243.red("\nResolve the errors above before applying."));
|
|
38439
38523
|
process.exit(1);
|
|
38440
38524
|
}
|
|
38441
|
-
console.log(
|
|
38525
|
+
console.log(chalk243.bold("\nApplying changes..."));
|
|
38442
38526
|
executePlan(plan2);
|
|
38443
|
-
console.log(
|
|
38527
|
+
console.log(chalk243.green("\nRestructuring complete"));
|
|
38444
38528
|
}
|
|
38445
38529
|
|
|
38446
38530
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
38447
38531
|
import path82 from "path";
|
|
38448
|
-
import
|
|
38532
|
+
import chalk244 from "chalk";
|
|
38449
38533
|
|
|
38450
38534
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
38451
38535
|
import path80 from "path";
|
|
@@ -38496,17 +38580,17 @@ function relPath2(filePath) {
|
|
|
38496
38580
|
}
|
|
38497
38581
|
function displayMoves(plan2) {
|
|
38498
38582
|
if (plan2.moves.length === 0) return;
|
|
38499
|
-
console.log(
|
|
38583
|
+
console.log(chalk244.bold("\nFile moves:"));
|
|
38500
38584
|
for (const move2 of plan2.moves) {
|
|
38501
38585
|
console.log(
|
|
38502
|
-
` ${
|
|
38586
|
+
` ${chalk244.red(relPath2(move2.from))} \u2192 ${chalk244.green(relPath2(move2.to))}`
|
|
38503
38587
|
);
|
|
38504
|
-
console.log(
|
|
38588
|
+
console.log(chalk244.dim(` ${move2.reason}`));
|
|
38505
38589
|
}
|
|
38506
38590
|
}
|
|
38507
38591
|
function displayTree(plan2) {
|
|
38508
38592
|
console.log(
|
|
38509
|
-
|
|
38593
|
+
chalk244.bold(`
|
|
38510
38594
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
38511
38595
|
);
|
|
38512
38596
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -38517,15 +38601,15 @@ function displayDepthStats(plan2) {
|
|
|
38517
38601
|
plan2.targets.values(),
|
|
38518
38602
|
plan2.scopeRoot
|
|
38519
38603
|
);
|
|
38520
|
-
console.log(
|
|
38604
|
+
console.log(chalk244.bold(`
|
|
38521
38605
|
Depth (max ${max}):`));
|
|
38522
38606
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
38523
38607
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
38524
38608
|
}
|
|
38525
38609
|
function displayErrors(errors) {
|
|
38526
38610
|
if (errors.length === 0) return;
|
|
38527
|
-
console.log(
|
|
38528
|
-
for (const error of errors) console.log(
|
|
38611
|
+
console.log(chalk244.red("\nErrors:"));
|
|
38612
|
+
for (const error of errors) console.log(chalk244.red(` ${error}`));
|
|
38529
38613
|
}
|
|
38530
38614
|
function displayPlan2(plan2) {
|
|
38531
38615
|
displayMoves(plan2);
|
|
@@ -38534,7 +38618,7 @@ function displayPlan2(plan2) {
|
|
|
38534
38618
|
displayErrors(plan2.errors);
|
|
38535
38619
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
38536
38620
|
console.log(
|
|
38537
|
-
|
|
38621
|
+
chalk244.dim(
|
|
38538
38622
|
`
|
|
38539
38623
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
38540
38624
|
)
|
|
@@ -38546,11 +38630,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
38546
38630
|
displayPlan2(plan2);
|
|
38547
38631
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
38548
38632
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
38549
|
-
console.log(
|
|
38633
|
+
console.log(chalk245.green("No restructuring needed"));
|
|
38550
38634
|
return;
|
|
38551
38635
|
}
|
|
38552
38636
|
if (!apply) {
|
|
38553
|
-
console.log(
|
|
38637
|
+
console.log(chalk245.dim("\nDry run. Use --apply to execute."));
|
|
38554
38638
|
return;
|
|
38555
38639
|
}
|
|
38556
38640
|
applyPlan(plan2);
|
|
@@ -38560,14 +38644,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
38560
38644
|
async function restructure(root2, options2 = {}) {
|
|
38561
38645
|
const scopeRoot = path83.resolve(root2 ?? "src");
|
|
38562
38646
|
if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
|
|
38563
|
-
console.log(
|
|
38647
|
+
console.log(chalk246.red(`Not a directory: ${root2 ?? "src"}`));
|
|
38564
38648
|
process.exit(1);
|
|
38565
38649
|
}
|
|
38566
38650
|
const found = [];
|
|
38567
38651
|
walkSourceFiles(scopeRoot, found);
|
|
38568
38652
|
const { scoped, ignored } = partitionIgnored(found);
|
|
38569
38653
|
if (scoped.length === 0) {
|
|
38570
|
-
console.log(
|
|
38654
|
+
console.log(chalk246.yellow("No files found under root"));
|
|
38571
38655
|
return;
|
|
38572
38656
|
}
|
|
38573
38657
|
const {
|
|
@@ -38638,7 +38722,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
38638
38722
|
}
|
|
38639
38723
|
|
|
38640
38724
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
38641
|
-
import
|
|
38725
|
+
import chalk250 from "chalk";
|
|
38642
38726
|
|
|
38643
38727
|
// src/commands/config/promptConfigScope.ts
|
|
38644
38728
|
import Enquirer3 from "enquirer";
|
|
@@ -38664,7 +38748,7 @@ async function promptConfigScope() {
|
|
|
38664
38748
|
}
|
|
38665
38749
|
|
|
38666
38750
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
38667
|
-
import
|
|
38751
|
+
import chalk247 from "chalk";
|
|
38668
38752
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
38669
38753
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
38670
38754
|
for (; ; ) {
|
|
@@ -38672,7 +38756,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
38672
38756
|
if (answer === "") return void 0;
|
|
38673
38757
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
38674
38758
|
if (coercion.ok) return coercion.value;
|
|
38675
|
-
console.error(
|
|
38759
|
+
console.error(chalk247.red(coercion.error));
|
|
38676
38760
|
}
|
|
38677
38761
|
}
|
|
38678
38762
|
function coerceSupplied(key, supplied) {
|
|
@@ -38752,7 +38836,7 @@ function suggestGlobs(current, proposed) {
|
|
|
38752
38836
|
}
|
|
38753
38837
|
|
|
38754
38838
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
38755
|
-
import
|
|
38839
|
+
import chalk248 from "chalk";
|
|
38756
38840
|
function parseConfigureAnswers(answers) {
|
|
38757
38841
|
const known = Object.values(highLevelConfigKeys);
|
|
38758
38842
|
const parsed = {};
|
|
@@ -38770,13 +38854,13 @@ function answersCoverEveryKey(answers) {
|
|
|
38770
38854
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
38771
38855
|
}
|
|
38772
38856
|
function exitWith(message3) {
|
|
38773
|
-
console.error(
|
|
38857
|
+
console.error(chalk248.red(`Error: ${message3}.`));
|
|
38774
38858
|
process.exit(1);
|
|
38775
38859
|
}
|
|
38776
38860
|
|
|
38777
38861
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
38778
38862
|
import { execFileSync as execFileSync25 } from "child_process";
|
|
38779
|
-
import
|
|
38863
|
+
import chalk249 from "chalk";
|
|
38780
38864
|
|
|
38781
38865
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
38782
38866
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -38825,7 +38909,7 @@ function readGlobs(value) {
|
|
|
38825
38909
|
|
|
38826
38910
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
38827
38911
|
import { execFileSync as execFileSync24 } from "child_process";
|
|
38828
|
-
import { dirname as
|
|
38912
|
+
import { dirname as dirname41, extname as extname6 } from "path";
|
|
38829
38913
|
var MAX_DIRECTORIES = 200;
|
|
38830
38914
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
38831
38915
|
function summariseRepoTree(cwd = process.cwd()) {
|
|
@@ -38852,7 +38936,7 @@ function listTrackedFiles(cwd) {
|
|
|
38852
38936
|
function countByDirectory(files) {
|
|
38853
38937
|
const directories = /* @__PURE__ */ new Map();
|
|
38854
38938
|
for (const file of files) {
|
|
38855
|
-
const directory =
|
|
38939
|
+
const directory = dirname41(file) === "." ? "(repo root)" : dirname41(file);
|
|
38856
38940
|
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
38857
38941
|
const extension2 = extname6(file) === "" ? "(no extension)" : extname6(file);
|
|
38858
38942
|
extensions.set(extension2, (extensions.get(extension2) ?? 0) + 1);
|
|
@@ -38870,12 +38954,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
38870
38954
|
const tree = summariseRepoTree(cwd);
|
|
38871
38955
|
if (tree === "") return NOTHING_PROPOSED;
|
|
38872
38956
|
console.log(
|
|
38873
|
-
|
|
38957
|
+
chalk249.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
38874
38958
|
);
|
|
38875
38959
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
38876
38960
|
if (output === void 0) {
|
|
38877
38961
|
console.log(
|
|
38878
|
-
|
|
38962
|
+
chalk249.yellow(
|
|
38879
38963
|
"Claude proposed nothing; answer each key from its current value."
|
|
38880
38964
|
)
|
|
38881
38965
|
);
|
|
@@ -38933,16 +39017,16 @@ async function configureHighLevelReview(options2 = {}) {
|
|
|
38933
39017
|
);
|
|
38934
39018
|
}
|
|
38935
39019
|
function reportConfigured(result) {
|
|
38936
|
-
for (const
|
|
39020
|
+
for (const write2 of result.written)
|
|
38937
39021
|
console.log(
|
|
38938
|
-
|
|
39022
|
+
chalk250.green(`Set ${write2.key} = ${JSON.stringify(write2.value)}`)
|
|
38939
39023
|
);
|
|
38940
|
-
for (const key of result.skipped) console.log(
|
|
38941
|
-
console.log(
|
|
39024
|
+
for (const key of result.skipped) console.log(chalk250.dim(`Left ${key} unset`));
|
|
39025
|
+
console.log(chalk250.dim(`Written to ${result.target}`));
|
|
38942
39026
|
}
|
|
38943
39027
|
|
|
38944
39028
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
38945
|
-
import
|
|
39029
|
+
import chalk251 from "chalk";
|
|
38946
39030
|
function savedMessage(subject) {
|
|
38947
39031
|
const head = subject.headSha.slice(0, 7);
|
|
38948
39032
|
if (subject.draft)
|
|
@@ -38953,10 +39037,10 @@ function savedMessage(subject) {
|
|
|
38953
39037
|
}
|
|
38954
39038
|
function announceSavedReview(subject, force) {
|
|
38955
39039
|
const message3 = savedMessage(subject);
|
|
38956
|
-
if (message3) console.log(
|
|
39040
|
+
if (message3) console.log(chalk251.dim(message3));
|
|
38957
39041
|
else if (force)
|
|
38958
39042
|
console.log(
|
|
38959
|
-
|
|
39043
|
+
chalk251.dim(
|
|
38960
39044
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
38961
39045
|
)
|
|
38962
39046
|
);
|
|
@@ -39627,12 +39711,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
39627
39711
|
}
|
|
39628
39712
|
|
|
39629
39713
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
39630
|
-
import { join as
|
|
39714
|
+
import { join as join89 } from "path";
|
|
39631
39715
|
function slug(value) {
|
|
39632
39716
|
return value.replace(/[^\w.-]+/g, "-");
|
|
39633
39717
|
}
|
|
39634
39718
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
39635
|
-
return
|
|
39719
|
+
return join89(
|
|
39636
39720
|
getStoreDir(),
|
|
39637
39721
|
"high-level-reviews",
|
|
39638
39722
|
slug(repo),
|
|
@@ -39804,11 +39888,11 @@ function clearHighLevelDraft(repo, headRef, headSha) {
|
|
|
39804
39888
|
}
|
|
39805
39889
|
|
|
39806
39890
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
39807
|
-
import { mkdirSync as
|
|
39808
|
-
import { dirname as
|
|
39891
|
+
import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync43 } from "fs";
|
|
39892
|
+
import { dirname as dirname42 } from "path";
|
|
39809
39893
|
function writeJsonFile(path109, data) {
|
|
39810
|
-
|
|
39811
|
-
|
|
39894
|
+
mkdirSync28(dirname42(path109), { recursive: true });
|
|
39895
|
+
writeFileSync43(path109, `${JSON.stringify(data, null, 2)}
|
|
39812
39896
|
`);
|
|
39813
39897
|
return path109;
|
|
39814
39898
|
}
|
|
@@ -40097,55 +40181,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
40097
40181
|
}
|
|
40098
40182
|
|
|
40099
40183
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
40100
|
-
import
|
|
40184
|
+
import chalk256 from "chalk";
|
|
40101
40185
|
|
|
40102
40186
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
40103
|
-
import
|
|
40187
|
+
import chalk252 from "chalk";
|
|
40104
40188
|
var PATCH_LINE_COLOURS = {
|
|
40105
|
-
"+":
|
|
40106
|
-
"-":
|
|
40107
|
-
"@":
|
|
40189
|
+
"+": chalk252.green,
|
|
40190
|
+
"-": chalk252.red,
|
|
40191
|
+
"@": chalk252.cyan
|
|
40108
40192
|
};
|
|
40109
40193
|
function formatPatch(patch2) {
|
|
40110
40194
|
return patch2.split("\n").map(
|
|
40111
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
40195
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk252.dim)(line)}`
|
|
40112
40196
|
);
|
|
40113
40197
|
}
|
|
40114
40198
|
function formatDiff(diff3) {
|
|
40115
40199
|
return [
|
|
40116
40200
|
"",
|
|
40117
|
-
` ${
|
|
40118
|
-
...diff3.patch === null ? [` ${
|
|
40201
|
+
` ${chalk252.bold(diff3.path)} ${chalk252.dim(`(${diff3.status})`)} ${chalk252.green(`+${diff3.additions}`)} ${chalk252.red(`-${diff3.deletions}`)}`,
|
|
40202
|
+
...diff3.patch === null ? [` ${chalk252.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
40119
40203
|
];
|
|
40120
40204
|
}
|
|
40121
40205
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
40122
40206
|
if (criticalPaths.length === 0)
|
|
40123
|
-
return `${
|
|
40124
|
-
${
|
|
40207
|
+
return `${chalk252.bold.underline("Critical diffs")}
|
|
40208
|
+
${chalk252.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
40125
40209
|
if (diffs.length === 0)
|
|
40126
|
-
return `${
|
|
40127
|
-
${
|
|
40210
|
+
return `${chalk252.bold.underline("Critical diffs")}
|
|
40211
|
+
${chalk252.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
40128
40212
|
return [
|
|
40129
|
-
|
|
40213
|
+
chalk252.bold.underline("Critical diffs"),
|
|
40130
40214
|
...diffs.flatMap(formatDiff)
|
|
40131
40215
|
].join("\n");
|
|
40132
40216
|
}
|
|
40133
40217
|
|
|
40134
40218
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
40135
|
-
import
|
|
40219
|
+
import chalk253 from "chalk";
|
|
40136
40220
|
var MARKERS = {
|
|
40137
|
-
pass: () =>
|
|
40138
|
-
fail: () =>
|
|
40139
|
-
manual: () =>
|
|
40221
|
+
pass: () => chalk253.green("\u2714"),
|
|
40222
|
+
fail: () => chalk253.red("\u2718"),
|
|
40223
|
+
manual: () => chalk253.yellow("\u25A1")
|
|
40140
40224
|
};
|
|
40141
40225
|
function formatCheck(check2) {
|
|
40142
|
-
const title = check2.status === "fail" ?
|
|
40226
|
+
const title = check2.status === "fail" ? chalk253.red(check2.title) : chalk253.bold(check2.title);
|
|
40143
40227
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
40144
|
-
${
|
|
40228
|
+
${chalk253.dim(check2.reason)}`;
|
|
40145
40229
|
}
|
|
40146
40230
|
function formatGroup(heading2, checks2) {
|
|
40147
40231
|
if (checks2.length === 0) return [];
|
|
40148
|
-
return ["",
|
|
40232
|
+
return ["", chalk253.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
40149
40233
|
}
|
|
40150
40234
|
function formatHighLevelChecklist(checks2) {
|
|
40151
40235
|
const deterministic = checks2.filter(
|
|
@@ -40154,7 +40238,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
40154
40238
|
const failed3 = deterministic.filter(
|
|
40155
40239
|
(check2) => check2.status === "fail"
|
|
40156
40240
|
).length;
|
|
40157
|
-
const summary = failed3 === 0 ?
|
|
40241
|
+
const summary = failed3 === 0 ? chalk253.green(`All ${deterministic.length} deterministic checks pass`) : chalk253.red(
|
|
40158
40242
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
40159
40243
|
);
|
|
40160
40244
|
return [
|
|
@@ -40169,37 +40253,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
40169
40253
|
}
|
|
40170
40254
|
|
|
40171
40255
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
40172
|
-
import
|
|
40256
|
+
import chalk254 from "chalk";
|
|
40173
40257
|
var STATUS_MARKERS = {
|
|
40174
|
-
added: () =>
|
|
40175
|
-
removed: () =>
|
|
40176
|
-
modified: () =>
|
|
40258
|
+
added: () => chalk254.green("A"),
|
|
40259
|
+
removed: () => chalk254.red("D"),
|
|
40260
|
+
modified: () => chalk254.yellow("M")
|
|
40177
40261
|
};
|
|
40178
40262
|
function counts(additions, deletions) {
|
|
40179
|
-
return `${
|
|
40263
|
+
return `${chalk254.green(`+${additions}`)} ${chalk254.red(`-${deletions}`)}`;
|
|
40180
40264
|
}
|
|
40181
40265
|
function formatNode(node, indent4) {
|
|
40182
40266
|
if (node.kind === "file")
|
|
40183
40267
|
return [
|
|
40184
|
-
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
40268
|
+
`${indent4}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk254.dim(counts(node.additions, node.deletions))}`
|
|
40185
40269
|
];
|
|
40186
40270
|
const dir = node;
|
|
40187
40271
|
return [
|
|
40188
|
-
`${indent4}${
|
|
40272
|
+
`${indent4}${chalk254.bold(`${dir.name}/`)} ${chalk254.dim(counts(dir.additions, dir.deletions))}`,
|
|
40189
40273
|
...dir.children.flatMap((child) => formatNode(child, `${indent4} `))
|
|
40190
40274
|
];
|
|
40191
40275
|
}
|
|
40192
40276
|
function formatHighLevelStructure(structure) {
|
|
40193
40277
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
40194
40278
|
return [
|
|
40195
|
-
|
|
40279
|
+
chalk254.bold.underline("Structure"),
|
|
40196
40280
|
` ${summary}`,
|
|
40197
40281
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
40198
40282
|
].join("\n");
|
|
40199
40283
|
}
|
|
40200
40284
|
|
|
40201
40285
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
40202
|
-
import
|
|
40286
|
+
import chalk255 from "chalk";
|
|
40203
40287
|
function changeMarker(change) {
|
|
40204
40288
|
if (change === "added") return "A";
|
|
40205
40289
|
if (change === "modified") return "M";
|
|
@@ -40208,22 +40292,22 @@ function changeMarker(change) {
|
|
|
40208
40292
|
function formatNode2(node, depth) {
|
|
40209
40293
|
const indent4 = " ".repeat(depth + 2);
|
|
40210
40294
|
if (node.kind === "it")
|
|
40211
|
-
return [`${indent4}${
|
|
40295
|
+
return [`${indent4}${chalk255.dim(changeMarker(node.change))} ${node.name}`];
|
|
40212
40296
|
return [
|
|
40213
|
-
`${indent4}${
|
|
40297
|
+
`${indent4}${chalk255.bold(node.name)}`,
|
|
40214
40298
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
40215
40299
|
];
|
|
40216
40300
|
}
|
|
40217
40301
|
function formatHighLevelTests(files, testPaths) {
|
|
40218
|
-
const heading2 =
|
|
40302
|
+
const heading2 = chalk255.bold.underline("Changed tests");
|
|
40219
40303
|
if (files.length === 0)
|
|
40220
40304
|
return `${heading2}
|
|
40221
|
-
${
|
|
40305
|
+
${chalk255.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
40222
40306
|
return [
|
|
40223
40307
|
heading2,
|
|
40224
40308
|
...files.flatMap((file) => [
|
|
40225
40309
|
"",
|
|
40226
|
-
` ${
|
|
40310
|
+
` ${chalk255.bold(file.path)} ${chalk255.dim(`(${file.status})`)}`,
|
|
40227
40311
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
40228
40312
|
])
|
|
40229
40313
|
].join("\n");
|
|
@@ -40237,10 +40321,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
40237
40321
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
40238
40322
|
function printHighLevelChecklist(subject) {
|
|
40239
40323
|
console.log(
|
|
40240
|
-
|
|
40324
|
+
chalk256.bold(
|
|
40241
40325
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
40242
40326
|
),
|
|
40243
|
-
|
|
40327
|
+
chalk256.dim(
|
|
40244
40328
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
40245
40329
|
)
|
|
40246
40330
|
);
|
|
@@ -40254,12 +40338,12 @@ function printHighLevelChecklist(subject) {
|
|
|
40254
40338
|
console.log("");
|
|
40255
40339
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
40256
40340
|
console.log(
|
|
40257
|
-
|
|
40341
|
+
chalk256.dim(
|
|
40258
40342
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
40259
40343
|
)
|
|
40260
40344
|
);
|
|
40261
40345
|
console.log(
|
|
40262
|
-
|
|
40346
|
+
chalk256.dim(
|
|
40263
40347
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
40264
40348
|
)
|
|
40265
40349
|
);
|
|
@@ -40545,18 +40629,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
40545
40629
|
}
|
|
40546
40630
|
|
|
40547
40631
|
// src/commands/review/warnOutOfDiff.ts
|
|
40548
|
-
import
|
|
40632
|
+
import chalk257 from "chalk";
|
|
40549
40633
|
function warnOutOfDiff(outOfDiff) {
|
|
40550
40634
|
if (outOfDiff.length === 0) return;
|
|
40551
40635
|
console.warn(
|
|
40552
|
-
|
|
40636
|
+
chalk257.yellow(
|
|
40553
40637
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
40554
40638
|
)
|
|
40555
40639
|
);
|
|
40556
40640
|
for (const finding of outOfDiff) {
|
|
40557
40641
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
40558
40642
|
console.warn(
|
|
40559
|
-
` ${
|
|
40643
|
+
` ${chalk257.yellow("\xB7")} ${finding.title} ${chalk257.dim(
|
|
40560
40644
|
`(${finding.file}:${range})`
|
|
40561
40645
|
)}`
|
|
40562
40646
|
);
|
|
@@ -40583,18 +40667,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
40583
40667
|
}
|
|
40584
40668
|
|
|
40585
40669
|
// src/commands/review/warnUnlocated.ts
|
|
40586
|
-
import
|
|
40670
|
+
import chalk258 from "chalk";
|
|
40587
40671
|
function warnUnlocated(unlocated) {
|
|
40588
40672
|
if (unlocated.length === 0) return;
|
|
40589
40673
|
console.warn(
|
|
40590
|
-
|
|
40674
|
+
chalk258.yellow(
|
|
40591
40675
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
40592
40676
|
)
|
|
40593
40677
|
);
|
|
40594
40678
|
for (const finding of unlocated) {
|
|
40595
|
-
const where = finding.location ||
|
|
40679
|
+
const where = finding.location || chalk258.dim("missing");
|
|
40596
40680
|
console.warn(
|
|
40597
|
-
` ${
|
|
40681
|
+
` ${chalk258.yellow("\xB7")} ${finding.title} ${chalk258.dim(`(${where})`)}`
|
|
40598
40682
|
);
|
|
40599
40683
|
}
|
|
40600
40684
|
}
|
|
@@ -40796,8 +40880,8 @@ function renderEntry(entry, frame) {
|
|
|
40796
40880
|
import { format as format2 } from "util";
|
|
40797
40881
|
|
|
40798
40882
|
// src/commands/review/createReviewLogSink.ts
|
|
40799
|
-
import { appendFileSync as appendFileSync4, mkdirSync as
|
|
40800
|
-
import { join as
|
|
40883
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
|
|
40884
|
+
import { join as join90 } from "path";
|
|
40801
40885
|
var LOG_FILE = "review.log";
|
|
40802
40886
|
function createReviewLogSink() {
|
|
40803
40887
|
let logPath2;
|
|
@@ -40813,8 +40897,8 @@ function createReviewLogSink() {
|
|
|
40813
40897
|
`);
|
|
40814
40898
|
},
|
|
40815
40899
|
attach(reviewDir) {
|
|
40816
|
-
|
|
40817
|
-
logPath2 =
|
|
40900
|
+
mkdirSync29(reviewDir, { recursive: true });
|
|
40901
|
+
logPath2 = join90(reviewDir, LOG_FILE);
|
|
40818
40902
|
const lines2 = [
|
|
40819
40903
|
"",
|
|
40820
40904
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -41064,7 +41148,7 @@ function buildCodexModelArgs() {
|
|
|
41064
41148
|
}
|
|
41065
41149
|
|
|
41066
41150
|
// src/commands/review/runClaudeReviewer.ts
|
|
41067
|
-
import { writeFileSync as
|
|
41151
|
+
import { writeFileSync as writeFileSync44 } from "fs";
|
|
41068
41152
|
|
|
41069
41153
|
// src/commands/review/formatToolSummary.ts
|
|
41070
41154
|
function truncate3(value, max = 80) {
|
|
@@ -41448,7 +41532,7 @@ async function runClaudeReviewer(spec) {
|
|
|
41448
41532
|
onLine
|
|
41449
41533
|
});
|
|
41450
41534
|
if (result.exitCode === 0 && state.finalText)
|
|
41451
|
-
|
|
41535
|
+
writeFileSync44(spec.outputPath, state.finalText);
|
|
41452
41536
|
const finalised = finaliseReviewerRun(
|
|
41453
41537
|
{ ...spec, command, model: override?.model },
|
|
41454
41538
|
spinner,
|
|
@@ -41974,9 +42058,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
41974
42058
|
|
|
41975
42059
|
// src/commands/review/buildReviewPaths.ts
|
|
41976
42060
|
import { homedir as homedir27 } from "os";
|
|
41977
|
-
import { basename as basename25, join as
|
|
42061
|
+
import { basename as basename25, join as join91 } from "path";
|
|
41978
42062
|
function buildReviewPaths(repoRoot2, key) {
|
|
41979
|
-
const reviewDir =
|
|
42063
|
+
const reviewDir = join91(
|
|
41980
42064
|
homedir27(),
|
|
41981
42065
|
".assist",
|
|
41982
42066
|
"reviews",
|
|
@@ -41985,10 +42069,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
41985
42069
|
);
|
|
41986
42070
|
return {
|
|
41987
42071
|
reviewDir,
|
|
41988
|
-
requestPath:
|
|
41989
|
-
claudePath:
|
|
41990
|
-
codexPath:
|
|
41991
|
-
synthesisPath:
|
|
42072
|
+
requestPath: join91(reviewDir, "request.md"),
|
|
42073
|
+
claudePath: join91(reviewDir, "claude.md"),
|
|
42074
|
+
codexPath: join91(reviewDir, "codex.md"),
|
|
42075
|
+
synthesisPath: join91(reviewDir, "synthesis.md")
|
|
41992
42076
|
};
|
|
41993
42077
|
}
|
|
41994
42078
|
|
|
@@ -42026,16 +42110,16 @@ function fetchExistingComments() {
|
|
|
42026
42110
|
}
|
|
42027
42111
|
|
|
42028
42112
|
// src/commands/review/prepareReviewDir.ts
|
|
42029
|
-
import { existsSync as existsSync70, mkdirSync as
|
|
42113
|
+
import { existsSync as existsSync70, mkdirSync as mkdirSync30, unlinkSync as unlinkSync20, writeFileSync as writeFileSync45 } from "fs";
|
|
42030
42114
|
function clearReviewFiles(paths) {
|
|
42031
42115
|
for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
42032
42116
|
if (existsSync70(path109)) unlinkSync20(path109);
|
|
42033
42117
|
}
|
|
42034
42118
|
}
|
|
42035
42119
|
function prepareReviewDir(paths, requestBody, force) {
|
|
42036
|
-
|
|
42120
|
+
mkdirSync30(paths.reviewDir, { recursive: true });
|
|
42037
42121
|
if (force) clearReviewFiles(paths);
|
|
42038
|
-
|
|
42122
|
+
writeFileSync45(paths.requestPath, requestBody);
|
|
42039
42123
|
}
|
|
42040
42124
|
|
|
42041
42125
|
// src/commands/review/setupReviewDir.ts
|
|
@@ -42684,10 +42768,10 @@ function registerReview(program) {
|
|
|
42684
42768
|
|
|
42685
42769
|
// src/commands/rules/indexRules.ts
|
|
42686
42770
|
import path87 from "path";
|
|
42687
|
-
import
|
|
42771
|
+
import chalk259 from "chalk";
|
|
42688
42772
|
|
|
42689
42773
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
42690
|
-
import { existsSync as existsSync71, readFileSync as readFileSync57, writeFileSync as
|
|
42774
|
+
import { existsSync as existsSync71, readFileSync as readFileSync57, writeFileSync as writeFileSync46 } from "fs";
|
|
42691
42775
|
import path86 from "path";
|
|
42692
42776
|
|
|
42693
42777
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -42759,7 +42843,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
42759
42843
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
42760
42844
|
const before = existsSync71(rootFile) ? readFileSync57(rootFile, "utf8") : "";
|
|
42761
42845
|
const after = upsertScopedRulesPointer(before, directories);
|
|
42762
|
-
if (after !== before)
|
|
42846
|
+
if (after !== before) writeFileSync46(rootFile, after);
|
|
42763
42847
|
return directories;
|
|
42764
42848
|
}
|
|
42765
42849
|
|
|
@@ -42771,24 +42855,24 @@ function indexRules() {
|
|
|
42771
42855
|
const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
|
|
42772
42856
|
if (directories.length === 0) {
|
|
42773
42857
|
console.log(
|
|
42774
|
-
|
|
42858
|
+
chalk259.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
42775
42859
|
);
|
|
42776
42860
|
return;
|
|
42777
42861
|
}
|
|
42778
42862
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
42779
42863
|
for (const directory of directories)
|
|
42780
|
-
console.log(` ${
|
|
42864
|
+
console.log(` ${chalk259.cyan(directory)}`);
|
|
42781
42865
|
}
|
|
42782
42866
|
|
|
42783
42867
|
// src/commands/rules/listRules.ts
|
|
42784
42868
|
import path88 from "path";
|
|
42785
|
-
import
|
|
42869
|
+
import chalk260 from "chalk";
|
|
42786
42870
|
function listRules(target, options2 = {}) {
|
|
42787
42871
|
const resolved = path88.resolve(target ?? process.cwd());
|
|
42788
42872
|
const rules2 = readScopedRules(resolved);
|
|
42789
42873
|
if (rules2.length === 0) {
|
|
42790
42874
|
const label = path88.relative(process.cwd(), resolved) || ".";
|
|
42791
|
-
console.log(
|
|
42875
|
+
console.log(chalk260.gray(`No rules in scope for ${label}`));
|
|
42792
42876
|
return;
|
|
42793
42877
|
}
|
|
42794
42878
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -42798,21 +42882,21 @@ function listRules(target, options2 = {}) {
|
|
|
42798
42882
|
if (rule.source !== shown) {
|
|
42799
42883
|
shown = rule.source;
|
|
42800
42884
|
console.log(
|
|
42801
|
-
|
|
42885
|
+
chalk260.dim(base ? path88.relative(base, rule.source) : rule.source)
|
|
42802
42886
|
);
|
|
42803
42887
|
}
|
|
42804
42888
|
console.log(
|
|
42805
|
-
` ${
|
|
42889
|
+
` ${chalk260.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
42806
42890
|
);
|
|
42807
42891
|
if (options2.full && rule.title)
|
|
42808
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
42892
|
+
console.log(` ${" ".repeat(width2)} ${chalk260.dim(rule.text)}`);
|
|
42809
42893
|
}
|
|
42810
42894
|
}
|
|
42811
42895
|
|
|
42812
42896
|
// src/commands/rules/addRule.ts
|
|
42813
|
-
import { existsSync as existsSync73, readFileSync as readFileSync59, writeFileSync as
|
|
42897
|
+
import { existsSync as existsSync73, readFileSync as readFileSync59, writeFileSync as writeFileSync47 } from "fs";
|
|
42814
42898
|
import path90 from "path";
|
|
42815
|
-
import
|
|
42899
|
+
import chalk261 from "chalk";
|
|
42816
42900
|
|
|
42817
42901
|
// src/commands/rules/insertRuleBullet.ts
|
|
42818
42902
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -42871,7 +42955,7 @@ function read2(file) {
|
|
|
42871
42955
|
function addRule(text18, options2) {
|
|
42872
42956
|
const rule = text18.trim();
|
|
42873
42957
|
if (rule === "") {
|
|
42874
|
-
console.error(
|
|
42958
|
+
console.error(chalk261.red("Rule text is required"));
|
|
42875
42959
|
process.exitCode = 1;
|
|
42876
42960
|
return;
|
|
42877
42961
|
}
|
|
@@ -42879,7 +42963,7 @@ function addRule(text18, options2) {
|
|
|
42879
42963
|
const targetDir = path90.dirname(target);
|
|
42880
42964
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
42881
42965
|
const code = nextRuleCode(root2);
|
|
42882
|
-
|
|
42966
|
+
writeFileSync47(
|
|
42883
42967
|
target,
|
|
42884
42968
|
insertRuleBullet(read2(target), {
|
|
42885
42969
|
code,
|
|
@@ -42889,14 +42973,14 @@ function addRule(text18, options2) {
|
|
|
42889
42973
|
);
|
|
42890
42974
|
updateScopedRulesIndex(root2);
|
|
42891
42975
|
console.log(
|
|
42892
|
-
`Added ${
|
|
42976
|
+
`Added ${chalk261.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
|
|
42893
42977
|
);
|
|
42894
42978
|
}
|
|
42895
42979
|
|
|
42896
42980
|
// src/commands/rules/addUserRule.ts
|
|
42897
|
-
import
|
|
42981
|
+
import chalk262 from "chalk";
|
|
42898
42982
|
function fail9(message3) {
|
|
42899
|
-
console.error(
|
|
42983
|
+
console.error(chalk262.red(message3));
|
|
42900
42984
|
process.exitCode = 1;
|
|
42901
42985
|
}
|
|
42902
42986
|
function asRules(value) {
|
|
@@ -42915,7 +42999,7 @@ async function addToUserDb(rule) {
|
|
|
42915
42999
|
rule
|
|
42916
43000
|
]);
|
|
42917
43001
|
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42918
|
-
console.log(`Added ${
|
|
43002
|
+
console.log(`Added ${chalk262.cyan(rule.title)} to advice.rules in user (db)`);
|
|
42919
43003
|
}
|
|
42920
43004
|
function addToUserNode(rule, globalConfigPath) {
|
|
42921
43005
|
const advice = loadGlobalConfigRaw(globalConfigPath).advice;
|
|
@@ -42928,7 +43012,7 @@ function addToUserNode(rule, globalConfigPath) {
|
|
|
42928
43012
|
);
|
|
42929
43013
|
if (!result.ok) return fail9(result.errors.join("\n"));
|
|
42930
43014
|
console.log(
|
|
42931
|
-
`Added ${
|
|
43015
|
+
`Added ${chalk262.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
|
|
42932
43016
|
);
|
|
42933
43017
|
}
|
|
42934
43018
|
async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
|
|
@@ -42983,7 +43067,7 @@ function registerRules(program) {
|
|
|
42983
43067
|
}
|
|
42984
43068
|
|
|
42985
43069
|
// src/commands/seq/seqAuth.ts
|
|
42986
|
-
import
|
|
43070
|
+
import chalk264 from "chalk";
|
|
42987
43071
|
|
|
42988
43072
|
// src/commands/seq/loadConnections.ts
|
|
42989
43073
|
function loadConnections2() {
|
|
@@ -43012,10 +43096,10 @@ function setDefaultConnection(name) {
|
|
|
43012
43096
|
}
|
|
43013
43097
|
|
|
43014
43098
|
// src/shared/assertUniqueName.ts
|
|
43015
|
-
import
|
|
43099
|
+
import chalk263 from "chalk";
|
|
43016
43100
|
function assertUniqueName(existingNames, name) {
|
|
43017
43101
|
if (existingNames.includes(name)) {
|
|
43018
|
-
console.error(
|
|
43102
|
+
console.error(chalk263.red(`Connection "${name}" already exists.`));
|
|
43019
43103
|
process.exit(1);
|
|
43020
43104
|
}
|
|
43021
43105
|
}
|
|
@@ -43033,16 +43117,16 @@ async function promptConnection2(existingNames) {
|
|
|
43033
43117
|
var seqAuth = createConnectionAuth({
|
|
43034
43118
|
load: loadConnections2,
|
|
43035
43119
|
save: saveConnections2,
|
|
43036
|
-
format: (c) => `${
|
|
43120
|
+
format: (c) => `${chalk264.bold(c.name)} ${c.url}`,
|
|
43037
43121
|
promptNew: promptConnection2,
|
|
43038
43122
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
43039
43123
|
});
|
|
43040
43124
|
|
|
43041
43125
|
// src/commands/seq/seqQuery.ts
|
|
43042
|
-
import
|
|
43126
|
+
import chalk268 from "chalk";
|
|
43043
43127
|
|
|
43044
43128
|
// src/commands/seq/fetchSeq.ts
|
|
43045
|
-
import
|
|
43129
|
+
import chalk265 from "chalk";
|
|
43046
43130
|
async function fetchSeq(conn, path109, params) {
|
|
43047
43131
|
const url = `${conn.url}${path109}?${params}`;
|
|
43048
43132
|
const response = await fetch(url, {
|
|
@@ -43053,7 +43137,7 @@ async function fetchSeq(conn, path109, params) {
|
|
|
43053
43137
|
});
|
|
43054
43138
|
if (!response.ok) {
|
|
43055
43139
|
const body = await response.text();
|
|
43056
|
-
console.error(
|
|
43140
|
+
console.error(chalk265.red(`Seq returned ${response.status}: ${body}`));
|
|
43057
43141
|
process.exit(1);
|
|
43058
43142
|
}
|
|
43059
43143
|
return response;
|
|
@@ -43112,23 +43196,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
43112
43196
|
}
|
|
43113
43197
|
|
|
43114
43198
|
// src/commands/seq/formatEvent.ts
|
|
43115
|
-
import
|
|
43199
|
+
import chalk266 from "chalk";
|
|
43116
43200
|
function levelColor(level) {
|
|
43117
43201
|
switch (level) {
|
|
43118
43202
|
case "Fatal":
|
|
43119
|
-
return
|
|
43203
|
+
return chalk266.bgRed.white;
|
|
43120
43204
|
case "Error":
|
|
43121
|
-
return
|
|
43205
|
+
return chalk266.red;
|
|
43122
43206
|
case "Warning":
|
|
43123
|
-
return
|
|
43207
|
+
return chalk266.yellow;
|
|
43124
43208
|
case "Information":
|
|
43125
|
-
return
|
|
43209
|
+
return chalk266.cyan;
|
|
43126
43210
|
case "Debug":
|
|
43127
|
-
return
|
|
43211
|
+
return chalk266.gray;
|
|
43128
43212
|
case "Verbose":
|
|
43129
|
-
return
|
|
43213
|
+
return chalk266.dim;
|
|
43130
43214
|
default:
|
|
43131
|
-
return
|
|
43215
|
+
return chalk266.white;
|
|
43132
43216
|
}
|
|
43133
43217
|
}
|
|
43134
43218
|
function levelAbbrev(level) {
|
|
@@ -43169,12 +43253,12 @@ function formatTimestamp(iso) {
|
|
|
43169
43253
|
function formatEvent(event) {
|
|
43170
43254
|
const color = levelColor(event.Level);
|
|
43171
43255
|
const abbrev = levelAbbrev(event.Level);
|
|
43172
|
-
const ts10 =
|
|
43256
|
+
const ts10 = chalk266.dim(formatTimestamp(event.Timestamp));
|
|
43173
43257
|
const msg = renderMessage(event);
|
|
43174
43258
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
43175
43259
|
if (event.Exception) {
|
|
43176
43260
|
for (const line of event.Exception.split("\n")) {
|
|
43177
|
-
lines2.push(
|
|
43261
|
+
lines2.push(chalk266.red(` ${line}`));
|
|
43178
43262
|
}
|
|
43179
43263
|
}
|
|
43180
43264
|
return lines2.join("\n");
|
|
@@ -43207,11 +43291,11 @@ function rejectTimestampFilter(filter) {
|
|
|
43207
43291
|
}
|
|
43208
43292
|
|
|
43209
43293
|
// src/shared/resolveNamedConnection.ts
|
|
43210
|
-
import
|
|
43294
|
+
import chalk267 from "chalk";
|
|
43211
43295
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
43212
43296
|
if (connections.length === 0) {
|
|
43213
43297
|
console.error(
|
|
43214
|
-
|
|
43298
|
+
chalk267.red(
|
|
43215
43299
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
43216
43300
|
)
|
|
43217
43301
|
);
|
|
@@ -43220,7 +43304,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
43220
43304
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
43221
43305
|
const connection = connections.find((c) => c.name === target);
|
|
43222
43306
|
if (!connection) {
|
|
43223
|
-
console.error(
|
|
43307
|
+
console.error(chalk267.red(`${kind} connection "${target}" not found.`));
|
|
43224
43308
|
process.exit(1);
|
|
43225
43309
|
}
|
|
43226
43310
|
return connection;
|
|
@@ -43249,7 +43333,7 @@ async function seqQuery(filter, options2) {
|
|
|
43249
43333
|
new URLSearchParams({ filter, count: String(count10) })
|
|
43250
43334
|
);
|
|
43251
43335
|
if (events.length === 0) {
|
|
43252
|
-
console.log(
|
|
43336
|
+
console.log(chalk268.yellow("No events found."));
|
|
43253
43337
|
return;
|
|
43254
43338
|
}
|
|
43255
43339
|
if (options2.json) {
|
|
@@ -43260,11 +43344,11 @@ async function seqQuery(filter, options2) {
|
|
|
43260
43344
|
for (const event of chronological) {
|
|
43261
43345
|
console.log(formatEvent(event));
|
|
43262
43346
|
}
|
|
43263
|
-
console.log(
|
|
43347
|
+
console.log(chalk268.dim(`
|
|
43264
43348
|
${events.length} events`));
|
|
43265
43349
|
if (events.length >= count10) {
|
|
43266
43350
|
console.log(
|
|
43267
|
-
|
|
43351
|
+
chalk268.yellow(
|
|
43268
43352
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
43269
43353
|
)
|
|
43270
43354
|
);
|
|
@@ -43272,10 +43356,10 @@ ${events.length} events`));
|
|
|
43272
43356
|
}
|
|
43273
43357
|
|
|
43274
43358
|
// src/shared/setNamedDefaultConnection.ts
|
|
43275
|
-
import
|
|
43359
|
+
import chalk269 from "chalk";
|
|
43276
43360
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
43277
43361
|
if (!connections.find((c) => c.name === name)) {
|
|
43278
|
-
console.error(
|
|
43362
|
+
console.error(chalk269.red(`Connection "${name}" not found.`));
|
|
43279
43363
|
process.exit(1);
|
|
43280
43364
|
}
|
|
43281
43365
|
setDefault(name);
|
|
@@ -43530,10 +43614,10 @@ function parseSlackThreadRef(value) {
|
|
|
43530
43614
|
}
|
|
43531
43615
|
|
|
43532
43616
|
// src/commands/slack/postSlackMessage.ts
|
|
43533
|
-
import { mkdirSync as
|
|
43617
|
+
import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync49 } from "fs";
|
|
43534
43618
|
|
|
43535
43619
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
43536
|
-
import { mkdirSync as
|
|
43620
|
+
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync48 } from "fs";
|
|
43537
43621
|
|
|
43538
43622
|
// src/commands/slack/readSlackParts.ts
|
|
43539
43623
|
import { readFileSync as readFileSync61 } from "fs";
|
|
@@ -43579,12 +43663,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43579
43663
|
}
|
|
43580
43664
|
|
|
43581
43665
|
// src/commands/slack/slackWorkingFile.ts
|
|
43582
|
-
import { join as
|
|
43666
|
+
import { join as join92 } from "path";
|
|
43583
43667
|
function slackWorkingFile(channel, partIndex) {
|
|
43584
43668
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
43585
|
-
const dir =
|
|
43669
|
+
const dir = join92(getStoreDir(), "slack");
|
|
43586
43670
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
43587
|
-
return { dir, bodyPath:
|
|
43671
|
+
return { dir, bodyPath: join92(dir, `${name}.md`) };
|
|
43588
43672
|
}
|
|
43589
43673
|
|
|
43590
43674
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -43596,10 +43680,10 @@ async function previewSlackThreadParts({
|
|
|
43596
43680
|
}) {
|
|
43597
43681
|
const bodies = readSlackParts(partFiles);
|
|
43598
43682
|
const { dir } = slackWorkingFile(channel);
|
|
43599
|
-
|
|
43683
|
+
mkdirSync31(dir, { recursive: true });
|
|
43600
43684
|
const paths = bodies.map((body, index2) => {
|
|
43601
43685
|
const { bodyPath } = slackWorkingFile(channel, index2 + 1);
|
|
43602
|
-
|
|
43686
|
+
writeFileSync48(bodyPath, `${body}
|
|
43603
43687
|
`);
|
|
43604
43688
|
return bodyPath;
|
|
43605
43689
|
});
|
|
@@ -43650,8 +43734,8 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
43650
43734
|
process.exit(1);
|
|
43651
43735
|
}
|
|
43652
43736
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
43653
|
-
|
|
43654
|
-
|
|
43737
|
+
mkdirSync32(dir, { recursive: true });
|
|
43738
|
+
writeFileSync49(bodyPath, `${body}
|
|
43655
43739
|
`);
|
|
43656
43740
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
43657
43741
|
console.log(`Approved for ${target}. The body to post is at:`);
|
|
@@ -43686,7 +43770,7 @@ function registerSlack(program) {
|
|
|
43686
43770
|
}
|
|
43687
43771
|
|
|
43688
43772
|
// src/commands/sql/sqlAuth.ts
|
|
43689
|
-
import
|
|
43773
|
+
import chalk271 from "chalk";
|
|
43690
43774
|
|
|
43691
43775
|
// src/commands/sql/loadConnections.ts
|
|
43692
43776
|
function loadConnections3() {
|
|
@@ -43715,7 +43799,7 @@ function setDefaultConnection2(name) {
|
|
|
43715
43799
|
}
|
|
43716
43800
|
|
|
43717
43801
|
// src/commands/sql/promptConnection.ts
|
|
43718
|
-
import
|
|
43802
|
+
import chalk270 from "chalk";
|
|
43719
43803
|
async function promptConnection3(existingNames) {
|
|
43720
43804
|
const name = await promptInput("name", "Connection name:", "default");
|
|
43721
43805
|
assertUniqueName(existingNames, name);
|
|
@@ -43723,7 +43807,7 @@ async function promptConnection3(existingNames) {
|
|
|
43723
43807
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
43724
43808
|
const port = Number.parseInt(portStr, 10);
|
|
43725
43809
|
if (!Number.isFinite(port)) {
|
|
43726
|
-
console.error(
|
|
43810
|
+
console.error(chalk270.red(`Invalid port "${portStr}".`));
|
|
43727
43811
|
process.exit(1);
|
|
43728
43812
|
}
|
|
43729
43813
|
const user = await promptInput("user", "User:");
|
|
@@ -43736,13 +43820,13 @@ async function promptConnection3(existingNames) {
|
|
|
43736
43820
|
var sqlAuth = createConnectionAuth({
|
|
43737
43821
|
load: loadConnections3,
|
|
43738
43822
|
save: saveConnections3,
|
|
43739
|
-
format: (c) => `${
|
|
43823
|
+
format: (c) => `${chalk271.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
43740
43824
|
promptNew: promptConnection3,
|
|
43741
43825
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
43742
43826
|
});
|
|
43743
43827
|
|
|
43744
43828
|
// src/commands/sql/printTable.ts
|
|
43745
|
-
import
|
|
43829
|
+
import chalk272 from "chalk";
|
|
43746
43830
|
function formatCell(value) {
|
|
43747
43831
|
if (value === null || value === void 0) return "";
|
|
43748
43832
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -43751,7 +43835,7 @@ function formatCell(value) {
|
|
|
43751
43835
|
}
|
|
43752
43836
|
function printTable(rows) {
|
|
43753
43837
|
if (rows.length === 0) {
|
|
43754
|
-
console.log(
|
|
43838
|
+
console.log(chalk272.yellow("(no rows)"));
|
|
43755
43839
|
return;
|
|
43756
43840
|
}
|
|
43757
43841
|
const columns = Object.keys(rows[0]);
|
|
@@ -43759,13 +43843,13 @@ function printTable(rows) {
|
|
|
43759
43843
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
43760
43844
|
);
|
|
43761
43845
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
43762
|
-
console.log(
|
|
43763
|
-
console.log(
|
|
43846
|
+
console.log(chalk272.dim(header));
|
|
43847
|
+
console.log(chalk272.dim("-".repeat(header.length)));
|
|
43764
43848
|
for (const row3 of rows) {
|
|
43765
43849
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
43766
43850
|
console.log(line);
|
|
43767
43851
|
}
|
|
43768
|
-
console.log(
|
|
43852
|
+
console.log(chalk272.dim(`
|
|
43769
43853
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
43770
43854
|
}
|
|
43771
43855
|
|
|
@@ -43825,7 +43909,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
43825
43909
|
}
|
|
43826
43910
|
|
|
43827
43911
|
// src/commands/sql/sqlMutate.ts
|
|
43828
|
-
import
|
|
43912
|
+
import chalk273 from "chalk";
|
|
43829
43913
|
|
|
43830
43914
|
// src/commands/sql/isMutation.ts
|
|
43831
43915
|
var MUTATION_KEYWORDS = [
|
|
@@ -43859,7 +43943,7 @@ function isMutation(sql31) {
|
|
|
43859
43943
|
async function sqlMutate(query, connectionName) {
|
|
43860
43944
|
if (!isMutation(query)) {
|
|
43861
43945
|
console.error(
|
|
43862
|
-
|
|
43946
|
+
chalk273.red(
|
|
43863
43947
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
43864
43948
|
)
|
|
43865
43949
|
);
|
|
@@ -43869,18 +43953,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
43869
43953
|
const pool = await sqlConnect(conn);
|
|
43870
43954
|
try {
|
|
43871
43955
|
const result = await pool.request().query(query);
|
|
43872
|
-
console.log(
|
|
43956
|
+
console.log(chalk273.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
43873
43957
|
} finally {
|
|
43874
43958
|
await pool.close();
|
|
43875
43959
|
}
|
|
43876
43960
|
}
|
|
43877
43961
|
|
|
43878
43962
|
// src/commands/sql/sqlQuery.ts
|
|
43879
|
-
import
|
|
43963
|
+
import chalk274 from "chalk";
|
|
43880
43964
|
async function sqlQuery(query, connectionName) {
|
|
43881
43965
|
if (isMutation(query)) {
|
|
43882
43966
|
console.error(
|
|
43883
|
-
|
|
43967
|
+
chalk274.red(
|
|
43884
43968
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
43885
43969
|
)
|
|
43886
43970
|
);
|
|
@@ -43895,7 +43979,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
43895
43979
|
printTable(rows);
|
|
43896
43980
|
} else {
|
|
43897
43981
|
console.log(
|
|
43898
|
-
|
|
43982
|
+
chalk274.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
43899
43983
|
);
|
|
43900
43984
|
}
|
|
43901
43985
|
} finally {
|
|
@@ -44310,7 +44394,7 @@ function syncPi(claudeDir, options2) {
|
|
|
44310
44394
|
// src/commands/sync/syncSettings.ts
|
|
44311
44395
|
import * as fs47 from "fs";
|
|
44312
44396
|
import * as path101 from "path";
|
|
44313
|
-
import
|
|
44397
|
+
import chalk275 from "chalk";
|
|
44314
44398
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
44315
44399
|
const source = path101.join(claudeDir, "settings.json");
|
|
44316
44400
|
const target = path101.join(targetBase, "settings.json");
|
|
@@ -44329,7 +44413,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
44329
44413
|
if (mergedContent !== normalizedTarget) {
|
|
44330
44414
|
if (!options2?.yes) {
|
|
44331
44415
|
console.log(
|
|
44332
|
-
|
|
44416
|
+
chalk275.yellow(
|
|
44333
44417
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
44334
44418
|
)
|
|
44335
44419
|
);
|
|
@@ -44337,7 +44421,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
44337
44421
|
printDiff(targetContent, mergedContent);
|
|
44338
44422
|
printAutoConfirmHint();
|
|
44339
44423
|
const confirm = await promptConfirm(
|
|
44340
|
-
|
|
44424
|
+
chalk275.red("Overwrite existing settings.json?"),
|
|
44341
44425
|
false
|
|
44342
44426
|
);
|
|
44343
44427
|
if (!confirm) {
|
|
@@ -44767,20 +44851,20 @@ async function configure() {
|
|
|
44767
44851
|
|
|
44768
44852
|
// src/commands/transcript/list.ts
|
|
44769
44853
|
import { existsSync as existsSync79, readdirSync as readdirSync22, statSync as statSync12 } from "fs";
|
|
44770
|
-
import { join as
|
|
44854
|
+
import { join as join104 } from "path";
|
|
44771
44855
|
function list5() {
|
|
44772
44856
|
const { vttDir } = getTranscriptConfig();
|
|
44773
44857
|
if (!existsSync79(vttDir)) return;
|
|
44774
44858
|
for (const entry of readdirSync22(vttDir)) {
|
|
44775
44859
|
if (!entry.endsWith(".vtt")) continue;
|
|
44776
|
-
if (statSync12(
|
|
44860
|
+
if (statSync12(join104(vttDir, entry)).isDirectory()) continue;
|
|
44777
44861
|
console.log(entry);
|
|
44778
44862
|
}
|
|
44779
44863
|
}
|
|
44780
44864
|
|
|
44781
44865
|
// src/commands/transcript/move.ts
|
|
44782
|
-
import { existsSync as existsSync80, mkdirSync as
|
|
44783
|
-
import { basename as basename28, join as
|
|
44866
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync54 } from "fs";
|
|
44867
|
+
import { basename as basename28, join as join105 } from "path";
|
|
44784
44868
|
|
|
44785
44869
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
44786
44870
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -44790,9 +44874,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
44790
44874
|
// src/commands/transcript/move.ts
|
|
44791
44875
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
44792
44876
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
44793
|
-
const processedDir =
|
|
44794
|
-
|
|
44795
|
-
renameSync5(sourcePath,
|
|
44877
|
+
const processedDir = join105(vttDir, "processed");
|
|
44878
|
+
mkdirSync38(processedDir, { recursive: true });
|
|
44879
|
+
renameSync5(sourcePath, join105(processedDir, filename));
|
|
44796
44880
|
}
|
|
44797
44881
|
function move(file, options2) {
|
|
44798
44882
|
const { date, client } = options2;
|
|
@@ -44802,25 +44886,25 @@ function move(file, options2) {
|
|
|
44802
44886
|
}
|
|
44803
44887
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
44804
44888
|
const filename = basename28(file);
|
|
44805
|
-
const sourcePath =
|
|
44889
|
+
const sourcePath = join105(vttDir, filename);
|
|
44806
44890
|
if (!existsSync80(sourcePath)) {
|
|
44807
44891
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
44808
44892
|
process.exit(1);
|
|
44809
44893
|
}
|
|
44810
44894
|
const base = basename28(filename, ".vtt").replace(/ Transcription$/, "");
|
|
44811
44895
|
const outputName = `${date} ${base}.md`;
|
|
44812
|
-
const formattedDir =
|
|
44813
|
-
|
|
44814
|
-
const formattedPath =
|
|
44815
|
-
|
|
44896
|
+
const formattedDir = join105(transcriptsDir, client);
|
|
44897
|
+
mkdirSync38(formattedDir, { recursive: true });
|
|
44898
|
+
const formattedPath = join105(formattedDir, outputName);
|
|
44899
|
+
writeFileSync54(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
44816
44900
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
44817
|
-
const summaryPath =
|
|
44901
|
+
const summaryPath = join105(summaryDir, client, outputName);
|
|
44818
44902
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
44819
44903
|
console.log(`Summary target: ${summaryPath}`);
|
|
44820
44904
|
}
|
|
44821
44905
|
|
|
44822
44906
|
// src/commands/transcript/merge.ts
|
|
44823
|
-
import { existsSync as existsSync81, writeFileSync as
|
|
44907
|
+
import { existsSync as existsSync81, writeFileSync as writeFileSync55 } from "fs";
|
|
44824
44908
|
import { basename as basename29 } from "path";
|
|
44825
44909
|
|
|
44826
44910
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -44930,16 +45014,16 @@ function selectPassages(sources, selection) {
|
|
|
44930
45014
|
}
|
|
44931
45015
|
|
|
44932
45016
|
// src/commands/transcript/selectionSchema.ts
|
|
44933
|
-
import { z as
|
|
44934
|
-
var selectionSchema =
|
|
44935
|
-
keep:
|
|
44936
|
-
|
|
44937
|
-
file:
|
|
44938
|
-
from:
|
|
44939
|
-
to:
|
|
45017
|
+
import { z as z18 } from "zod";
|
|
45018
|
+
var selectionSchema = z18.strictObject({
|
|
45019
|
+
keep: z18.array(
|
|
45020
|
+
z18.strictObject({
|
|
45021
|
+
file: z18.string().trim().min(1, "file is required"),
|
|
45022
|
+
from: z18.string().trim().min(1, "from is required"),
|
|
45023
|
+
to: z18.string().trim().min(1, "to is required")
|
|
44940
45024
|
})
|
|
44941
45025
|
).min(1, "a selection needs at least one keep range"),
|
|
44942
|
-
removed:
|
|
45026
|
+
removed: z18.array(z18.string().trim().min(1)).default([])
|
|
44943
45027
|
});
|
|
44944
45028
|
|
|
44945
45029
|
// src/commands/transcript/widenAudienceInText.ts
|
|
@@ -44997,7 +45081,7 @@ async function merge(files, options2 = {}) {
|
|
|
44997
45081
|
console.log(document);
|
|
44998
45082
|
return;
|
|
44999
45083
|
}
|
|
45000
|
-
|
|
45084
|
+
writeFileSync55(options2.out, `${document}
|
|
45001
45085
|
`, "utf8");
|
|
45002
45086
|
console.log(`Merged transcript: ${options2.out}`);
|
|
45003
45087
|
}
|
|
@@ -46025,7 +46109,7 @@ ${result.reason}`
|
|
|
46025
46109
|
}
|
|
46026
46110
|
|
|
46027
46111
|
// src/commands/watch/markSyncPending.ts
|
|
46028
|
-
import { existsSync as existsSync83, writeFileSync as
|
|
46112
|
+
import { existsSync as existsSync83, writeFileSync as writeFileSync56 } from "fs";
|
|
46029
46113
|
|
|
46030
46114
|
// src/commands/watch/gitMarkerPath.ts
|
|
46031
46115
|
import { resolve as resolve28 } from "path";
|
|
@@ -46051,7 +46135,7 @@ function pendingFromEarlierLap() {
|
|
|
46051
46135
|
}
|
|
46052
46136
|
function writePendingMarker() {
|
|
46053
46137
|
try {
|
|
46054
|
-
|
|
46138
|
+
writeFileSync56(syncPendingPath(), "");
|
|
46055
46139
|
} catch {
|
|
46056
46140
|
}
|
|
46057
46141
|
}
|
|
@@ -46545,10 +46629,10 @@ function registerWatchWait(watchCommand) {
|
|
|
46545
46629
|
}
|
|
46546
46630
|
|
|
46547
46631
|
// src/commands/watch/simulateDivergence.ts
|
|
46548
|
-
import { writeFileSync as
|
|
46632
|
+
import { writeFileSync as writeFileSync57 } from "fs";
|
|
46549
46633
|
function simulateDivergence() {
|
|
46550
46634
|
try {
|
|
46551
|
-
|
|
46635
|
+
writeFileSync57(simulatedDivergencePath(), "");
|
|
46552
46636
|
console.log(
|
|
46553
46637
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
46554
46638
|
);
|
|
@@ -46643,7 +46727,7 @@ function registerWatch(program) {
|
|
|
46643
46727
|
// src/commands/roam/postRoamActivity.ts
|
|
46644
46728
|
import { execFileSync as execFileSync30 } from "child_process";
|
|
46645
46729
|
import { readdirSync as readdirSync24, readFileSync as readFileSync69, statSync as statSync13 } from "fs";
|
|
46646
|
-
import { join as
|
|
46730
|
+
import { join as join106 } from "path";
|
|
46647
46731
|
function findPortFile(roamDir) {
|
|
46648
46732
|
let entries;
|
|
46649
46733
|
try {
|
|
@@ -46652,7 +46736,7 @@ function findPortFile(roamDir) {
|
|
|
46652
46736
|
return void 0;
|
|
46653
46737
|
}
|
|
46654
46738
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
46655
|
-
const path109 =
|
|
46739
|
+
const path109 = join106(roamDir, name);
|
|
46656
46740
|
try {
|
|
46657
46741
|
return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
|
|
46658
46742
|
} catch {
|
|
@@ -46669,7 +46753,7 @@ var PID_BY_APP = {
|
|
|
46669
46753
|
function postRoamActivity(app, event) {
|
|
46670
46754
|
const appData = process.env.APPDATA;
|
|
46671
46755
|
if (!appData) return;
|
|
46672
|
-
const portFile = findPortFile(
|
|
46756
|
+
const portFile = findPortFile(join106(appData, "Roam"));
|
|
46673
46757
|
if (!portFile) return;
|
|
46674
46758
|
let port;
|
|
46675
46759
|
try {
|
|
@@ -46852,8 +46936,8 @@ function link2() {
|
|
|
46852
46936
|
}
|
|
46853
46937
|
|
|
46854
46938
|
// src/commands/run/add.ts
|
|
46855
|
-
import { mkdirSync as
|
|
46856
|
-
import { dirname as
|
|
46939
|
+
import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync58 } from "fs";
|
|
46940
|
+
import { dirname as dirname46 } from "path";
|
|
46857
46941
|
|
|
46858
46942
|
// src/commands/run/editRepoRunList.ts
|
|
46859
46943
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -47012,11 +47096,11 @@ function requireParsedArgs() {
|
|
|
47012
47096
|
}
|
|
47013
47097
|
|
|
47014
47098
|
// src/commands/run/runCommandFilePath.ts
|
|
47015
|
-
import { join as
|
|
47099
|
+
import { join as join107 } from "path";
|
|
47016
47100
|
function runCommandFilePath(name) {
|
|
47017
47101
|
const segments = name.split(":");
|
|
47018
47102
|
const file = `${segments.pop()}.md`;
|
|
47019
|
-
return
|
|
47103
|
+
return join107(".claude", "commands", ...segments, file);
|
|
47020
47104
|
}
|
|
47021
47105
|
|
|
47022
47106
|
// src/commands/run/add.ts
|
|
@@ -47033,14 +47117,14 @@ function saveProjectRunConfig(entry) {
|
|
|
47033
47117
|
}
|
|
47034
47118
|
function createCommandFile(name) {
|
|
47035
47119
|
const filePath = runCommandFilePath(name);
|
|
47036
|
-
|
|
47120
|
+
mkdirSync39(dirname46(filePath), { recursive: true });
|
|
47037
47121
|
const content = `---
|
|
47038
47122
|
description: Run ${name}
|
|
47039
47123
|
---
|
|
47040
47124
|
|
|
47041
47125
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
47042
47126
|
`;
|
|
47043
|
-
|
|
47127
|
+
writeFileSync58(filePath, content);
|
|
47044
47128
|
console.log(`Created command file: ${filePath}`);
|
|
47045
47129
|
}
|
|
47046
47130
|
async function add4() {
|
|
@@ -47145,7 +47229,7 @@ function registerRunAdd(runCommand) {
|
|
|
47145
47229
|
|
|
47146
47230
|
// src/commands/run/remove.ts
|
|
47147
47231
|
import { existsSync as existsSync86, readdirSync as readdirSync25, rmdirSync, unlinkSync as unlinkSync21 } from "fs";
|
|
47148
|
-
import { dirname as
|
|
47232
|
+
import { dirname as dirname47, join as join108 } from "path";
|
|
47149
47233
|
|
|
47150
47234
|
// src/commands/run/removeRepoRunConfig.ts
|
|
47151
47235
|
function isNamed(entry, name) {
|
|
@@ -47163,15 +47247,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
47163
47247
|
|
|
47164
47248
|
// src/commands/run/remove.ts
|
|
47165
47249
|
function removeEmptyNamespaceDirs(filePath) {
|
|
47166
|
-
const root2 =
|
|
47167
|
-
for (let dir =
|
|
47250
|
+
const root2 = join108(".claude", "commands");
|
|
47251
|
+
for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
|
|
47168
47252
|
if (!existsSync86(dir) || readdirSync25(dir).length > 0) return;
|
|
47169
47253
|
rmdirSync(dir);
|
|
47170
47254
|
}
|
|
47171
47255
|
}
|
|
47172
47256
|
function deleteCommandFile(name) {
|
|
47173
47257
|
const filePath = runCommandFilePath(name);
|
|
47174
|
-
const legacyPath =
|
|
47258
|
+
const legacyPath = join108(".claude", "commands", `${name}.md`);
|
|
47175
47259
|
for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
|
|
47176
47260
|
if (existsSync86(path109)) {
|
|
47177
47261
|
unlinkSync21(path109);
|
|
@@ -47228,18 +47312,18 @@ function registerRun(program) {
|
|
|
47228
47312
|
}
|
|
47229
47313
|
|
|
47230
47314
|
// src/commands/sessions/nodes/formatLink.ts
|
|
47231
|
-
import
|
|
47315
|
+
import chalk276 from "chalk";
|
|
47232
47316
|
var STATE_COLOURS = {
|
|
47233
|
-
connected:
|
|
47234
|
-
connecting:
|
|
47235
|
-
disconnected:
|
|
47236
|
-
"version-blocked":
|
|
47317
|
+
connected: chalk276.green,
|
|
47318
|
+
connecting: chalk276.yellow,
|
|
47319
|
+
disconnected: chalk276.red,
|
|
47320
|
+
"version-blocked": chalk276.red
|
|
47237
47321
|
};
|
|
47238
47322
|
function formatLink(link3) {
|
|
47239
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
47323
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk276.white;
|
|
47240
47324
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
47241
47325
|
const error = link3.error ? `
|
|
47242
|
-
${
|
|
47326
|
+
${chalk276.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
47243
47327
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
47244
47328
|
}
|
|
47245
47329
|
|
|
@@ -47455,7 +47539,7 @@ function requestDrain(socket, lines2) {
|
|
|
47455
47539
|
}
|
|
47456
47540
|
|
|
47457
47541
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
47458
|
-
import { mkdirSync as
|
|
47542
|
+
import { mkdirSync as mkdirSync44 } from "fs";
|
|
47459
47543
|
|
|
47460
47544
|
// src/commands/sessions/daemon/broadcast.ts
|
|
47461
47545
|
function sendTo(client, msg) {
|
|
@@ -47764,9 +47848,9 @@ async function refreshRepoConfigCacheOnStart() {
|
|
|
47764
47848
|
}
|
|
47765
47849
|
|
|
47766
47850
|
// src/commands/sessions/daemon/loadActiveSelection.ts
|
|
47767
|
-
import { z as
|
|
47851
|
+
import { z as z19 } from "zod";
|
|
47768
47852
|
var ACTIVE_FILE = "active.json";
|
|
47769
|
-
var activeSelectionSchema =
|
|
47853
|
+
var activeSelectionSchema = z19.record(z19.string(), z19.string());
|
|
47770
47854
|
function loadActiveSelection() {
|
|
47771
47855
|
const parsed = activeSelectionSchema.safeParse(
|
|
47772
47856
|
loadJson(ACTIVE_FILE)
|
|
@@ -47963,7 +48047,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
47963
48047
|
|
|
47964
48048
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
47965
48049
|
import { existsSync as existsSync88 } from "fs";
|
|
47966
|
-
import { join as
|
|
48050
|
+
import { join as join109, resolve as resolve30 } from "path";
|
|
47967
48051
|
function isLive(session) {
|
|
47968
48052
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
47969
48053
|
}
|
|
@@ -47972,7 +48056,7 @@ function isLiveAgent(session) {
|
|
|
47972
48056
|
}
|
|
47973
48057
|
function serverRunDirs(sessions, file) {
|
|
47974
48058
|
return new Set(
|
|
47975
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync88(
|
|
48059
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync88(join109(dir, file)))
|
|
47976
48060
|
);
|
|
47977
48061
|
}
|
|
47978
48062
|
function findServerParents(sessions, file) {
|
|
@@ -48166,7 +48250,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
48166
48250
|
}
|
|
48167
48251
|
|
|
48168
48252
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
48169
|
-
import { readFileSync as readFileSync71, writeFileSync as
|
|
48253
|
+
import { readFileSync as readFileSync71, writeFileSync as writeFileSync59 } from "fs";
|
|
48170
48254
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
48171
48255
|
var remembered;
|
|
48172
48256
|
function rememberViewerSize(cols, rows) {
|
|
@@ -48174,7 +48258,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
48174
48258
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
48175
48259
|
remembered = { cols, rows };
|
|
48176
48260
|
try {
|
|
48177
|
-
|
|
48261
|
+
writeFileSync59(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
48178
48262
|
} catch (error) {
|
|
48179
48263
|
daemonLog(
|
|
48180
48264
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -48239,7 +48323,7 @@ function pasteAndSubmit(sendInput, sessionId, text18) {
|
|
|
48239
48323
|
}
|
|
48240
48324
|
|
|
48241
48325
|
// src/commands/sessions/daemon/flushPendingPrompts.ts
|
|
48242
|
-
function flushPendingPrompts(session,
|
|
48326
|
+
function flushPendingPrompts(session, write2) {
|
|
48243
48327
|
if (!session?.pendingPrompts?.length || session.permissionActive)
|
|
48244
48328
|
return false;
|
|
48245
48329
|
if (session.status === "done" || !session.pty) return false;
|
|
@@ -48248,12 +48332,12 @@ function flushPendingPrompts(session, write) {
|
|
|
48248
48332
|
`session ${session.id} typed ${session.pendingPrompts.length} queued prompt(s)`
|
|
48249
48333
|
);
|
|
48250
48334
|
session.pendingPrompts = void 0;
|
|
48251
|
-
pasteAndSubmit(
|
|
48335
|
+
pasteAndSubmit(write2, session.id, text18);
|
|
48252
48336
|
return true;
|
|
48253
48337
|
}
|
|
48254
48338
|
|
|
48255
48339
|
// src/commands/sessions/daemon/typePromptIntoSession.ts
|
|
48256
|
-
function typePromptIntoSession(sessions, id, text18,
|
|
48340
|
+
function typePromptIntoSession(sessions, id, text18, write2) {
|
|
48257
48341
|
const session = sessions.get(id);
|
|
48258
48342
|
if (!session) return { refused: `assist session ${id} was not found` };
|
|
48259
48343
|
if (session.status === "done" || !session.pty)
|
|
@@ -48265,7 +48349,7 @@ function typePromptIntoSession(sessions, id, text18, write) {
|
|
|
48265
48349
|
);
|
|
48266
48350
|
return { queued: true };
|
|
48267
48351
|
}
|
|
48268
|
-
pasteAndSubmit(
|
|
48352
|
+
pasteAndSubmit(write2, id, text18);
|
|
48269
48353
|
daemonLog(`session ${id} typed prompt: ${JSON.stringify(text18)}`);
|
|
48270
48354
|
return { queued: false };
|
|
48271
48355
|
}
|
|
@@ -48929,13 +49013,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
48929
49013
|
}
|
|
48930
49014
|
|
|
48931
49015
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
48932
|
-
import { existsSync as existsSync92, rmSync as rmSync13, writeFileSync as
|
|
49016
|
+
import { existsSync as existsSync92, rmSync as rmSync13, writeFileSync as writeFileSync60 } from "fs";
|
|
48933
49017
|
var paused;
|
|
48934
49018
|
var wake;
|
|
48935
49019
|
var holdReleased = false;
|
|
48936
49020
|
function persist2(value) {
|
|
48937
49021
|
try {
|
|
48938
|
-
if (value)
|
|
49022
|
+
if (value) writeFileSync60(daemonPaths.autoUpdatePaused, "");
|
|
48939
49023
|
else rmSync13(daemonPaths.autoUpdatePaused, { force: true });
|
|
48940
49024
|
} catch {
|
|
48941
49025
|
}
|
|
@@ -49076,7 +49160,7 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
49076
49160
|
}
|
|
49077
49161
|
|
|
49078
49162
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
49079
|
-
import { readFileSync as readFileSync73, writeFileSync as
|
|
49163
|
+
import { readFileSync as readFileSync73, writeFileSync as writeFileSync61 } from "fs";
|
|
49080
49164
|
var KEEP_TAIL = 256 * 1024;
|
|
49081
49165
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
49082
49166
|
function trimWatcherLog(cwd) {
|
|
@@ -49088,17 +49172,17 @@ function trimWatcherLog(cwd) {
|
|
|
49088
49172
|
return;
|
|
49089
49173
|
}
|
|
49090
49174
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
49091
|
-
|
|
49175
|
+
writeFileSync61(path109, log2.slice(-KEEP_TAIL));
|
|
49092
49176
|
daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
|
|
49093
49177
|
}
|
|
49094
49178
|
|
|
49095
49179
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
49096
|
-
import { appendFileSync as appendFileSync5, mkdirSync as
|
|
49097
|
-
import { dirname as
|
|
49180
|
+
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync40 } from "fs";
|
|
49181
|
+
import { dirname as dirname49 } from "path";
|
|
49098
49182
|
function appendWatcherLog(cwd, data) {
|
|
49099
49183
|
try {
|
|
49100
49184
|
const path109 = watcherLogPath(cwd);
|
|
49101
|
-
|
|
49185
|
+
mkdirSync40(dirname49(path109), { recursive: true });
|
|
49102
49186
|
appendFileSync5(path109, data);
|
|
49103
49187
|
} catch {
|
|
49104
49188
|
}
|
|
@@ -49473,12 +49557,12 @@ import { basename as basename31 } from "path";
|
|
|
49473
49557
|
|
|
49474
49558
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
49475
49559
|
import { existsSync as existsSync94 } from "fs";
|
|
49476
|
-
import { join as
|
|
49560
|
+
import { join as join113 } from "path";
|
|
49477
49561
|
|
|
49478
49562
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
49479
49563
|
import { statSync as statSync15 } from "fs";
|
|
49480
49564
|
import { rm as rm3 } from "fs/promises";
|
|
49481
|
-
import { join as
|
|
49565
|
+
import { join as join112 } from "path";
|
|
49482
49566
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
49483
49567
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
49484
49568
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -49506,7 +49590,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
49506
49590
|
return { removed: true };
|
|
49507
49591
|
}
|
|
49508
49592
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
49509
|
-
return statSync15(
|
|
49593
|
+
return statSync15(join112(worktreePath, ".git"), {
|
|
49510
49594
|
throwIfNoEntry: false
|
|
49511
49595
|
})?.isDirectory() === true;
|
|
49512
49596
|
}
|
|
@@ -49542,7 +49626,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
49542
49626
|
);
|
|
49543
49627
|
}
|
|
49544
49628
|
function strandedReason(worktreePath, cause) {
|
|
49545
|
-
if (!existsSync94(
|
|
49629
|
+
if (!existsSync94(join113(worktreePath, ".git")))
|
|
49546
49630
|
return "its .git link is already gone";
|
|
49547
49631
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
49548
49632
|
return "git no longer recognises it as a working tree";
|
|
@@ -50431,9 +50515,9 @@ function buildPrompt5(prompt) {
|
|
|
50431
50515
|
}
|
|
50432
50516
|
|
|
50433
50517
|
// src/commands/sessions/shared/loadSessionTitles.ts
|
|
50434
|
-
import { z as
|
|
50518
|
+
import { z as z20 } from "zod";
|
|
50435
50519
|
var TITLES_FILE = "session-titles.json";
|
|
50436
|
-
var sessionTitlesSchema =
|
|
50520
|
+
var sessionTitlesSchema = z20.record(z20.string(), z20.string());
|
|
50437
50521
|
function loadSessionTitles() {
|
|
50438
50522
|
const parsed = sessionTitlesSchema.safeParse(
|
|
50439
50523
|
loadJson(TITLES_FILE)
|
|
@@ -50624,8 +50708,8 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
50624
50708
|
}
|
|
50625
50709
|
|
|
50626
50710
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
50627
|
-
import { existsSync as existsSync98, mkdirSync as
|
|
50628
|
-
import { dirname as
|
|
50711
|
+
import { existsSync as existsSync98, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
|
|
50712
|
+
import { dirname as dirname50 } from "path";
|
|
50629
50713
|
|
|
50630
50714
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
50631
50715
|
function applyActivityToSession(session, activity2) {
|
|
@@ -50686,9 +50770,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
50686
50770
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
50687
50771
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
50688
50772
|
const path109 = activityPath(session.id);
|
|
50689
|
-
const dir =
|
|
50773
|
+
const dir = dirname50(path109);
|
|
50690
50774
|
try {
|
|
50691
|
-
|
|
50775
|
+
mkdirSync41(dir, { recursive: true });
|
|
50692
50776
|
} catch {
|
|
50693
50777
|
return;
|
|
50694
50778
|
}
|
|
@@ -50853,10 +50937,10 @@ function bindCodexSession(session, notify2) {
|
|
|
50853
50937
|
import { watch as watch3 } from "fs";
|
|
50854
50938
|
|
|
50855
50939
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
50856
|
-
import { mkdirSync as
|
|
50940
|
+
import { mkdirSync as mkdirSync42 } from "fs";
|
|
50857
50941
|
function ensureProjectDirExists(dir, sessionId) {
|
|
50858
50942
|
try {
|
|
50859
|
-
|
|
50943
|
+
mkdirSync42(dir, { recursive: true });
|
|
50860
50944
|
return true;
|
|
50861
50945
|
} catch (error) {
|
|
50862
50946
|
daemonLog(
|
|
@@ -54091,8 +54175,8 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
54091
54175
|
import { existsSync as existsSync102 } from "fs";
|
|
54092
54176
|
|
|
54093
54177
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
54094
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync101, mkdirSync as
|
|
54095
|
-
import { join as
|
|
54178
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync101, mkdirSync as mkdirSync43 } from "fs";
|
|
54179
|
+
import { join as join114 } from "path";
|
|
54096
54180
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
54097
54181
|
const dir = projectDirForCwd(toCwd);
|
|
54098
54182
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -54101,7 +54185,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
54101
54185
|
);
|
|
54102
54186
|
return;
|
|
54103
54187
|
}
|
|
54104
|
-
const dest =
|
|
54188
|
+
const dest = join114(dir, `${claudeSessionId}.jsonl`);
|
|
54105
54189
|
if (existsSync101(dest)) {
|
|
54106
54190
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
54107
54191
|
return;
|
|
@@ -54114,7 +54198,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
54114
54198
|
return;
|
|
54115
54199
|
}
|
|
54116
54200
|
try {
|
|
54117
|
-
|
|
54201
|
+
mkdirSync43(dir, { recursive: true });
|
|
54118
54202
|
copyFileSync4(source, dest);
|
|
54119
54203
|
daemonLog(
|
|
54120
54204
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -54420,10 +54504,10 @@ function autoUpdateReply() {
|
|
|
54420
54504
|
}
|
|
54421
54505
|
|
|
54422
54506
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
54423
|
-
import { rmSync as rmSync15, writeFileSync as
|
|
54507
|
+
import { rmSync as rmSync15, writeFileSync as writeFileSync62 } from "fs";
|
|
54424
54508
|
function signalLap(installDir, marker2) {
|
|
54425
54509
|
const control = watchControlPaths(installDir);
|
|
54426
|
-
if (control)
|
|
54510
|
+
if (control) writeFileSync62(control[marker2], "");
|
|
54427
54511
|
}
|
|
54428
54512
|
function applyAutoUpdateAction(action) {
|
|
54429
54513
|
const installDir = getInstallDir();
|
|
@@ -55498,7 +55582,7 @@ function handleConnection(socket, manager) {
|
|
|
55498
55582
|
}
|
|
55499
55583
|
|
|
55500
55584
|
// src/commands/sessions/daemon/onListening.ts
|
|
55501
|
-
import { unlinkSync as unlinkSync22, writeFileSync as
|
|
55585
|
+
import { unlinkSync as unlinkSync22, writeFileSync as writeFileSync63 } from "fs";
|
|
55502
55586
|
|
|
55503
55587
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
55504
55588
|
import { readFileSync as readFileSync74 } from "fs";
|
|
@@ -55520,7 +55604,7 @@ function ownsPidFile() {
|
|
|
55520
55604
|
|
|
55521
55605
|
// src/commands/sessions/daemon/onListening.ts
|
|
55522
55606
|
function onListening(manager, checkAutoExit) {
|
|
55523
|
-
|
|
55607
|
+
writeFileSync63(daemonPaths.pid, String(process.pid));
|
|
55524
55608
|
startPidFileWatchdog(() => {
|
|
55525
55609
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
55526
55610
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -55609,7 +55693,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
55609
55693
|
|
|
55610
55694
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
55611
55695
|
async function runDaemon() {
|
|
55612
|
-
|
|
55696
|
+
mkdirSync44(daemonPaths.dir, { recursive: true });
|
|
55613
55697
|
daemonLog(
|
|
55614
55698
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
55615
55699
|
);
|
|
@@ -55669,7 +55753,7 @@ async function closeSession2() {
|
|
|
55669
55753
|
}
|
|
55670
55754
|
|
|
55671
55755
|
// src/commands/sessions/nodes/listNodes.ts
|
|
55672
|
-
import
|
|
55756
|
+
import chalk277 from "chalk";
|
|
55673
55757
|
async function nodesReport() {
|
|
55674
55758
|
const live = await queryNodes();
|
|
55675
55759
|
if (live)
|
|
@@ -55686,10 +55770,10 @@ async function listNodes(options2) {
|
|
|
55686
55770
|
console.log(JSON.stringify(report, null, 2));
|
|
55687
55771
|
return;
|
|
55688
55772
|
}
|
|
55689
|
-
console.log(`${report.local} ${
|
|
55773
|
+
console.log(`${report.local} ${chalk277.dim("(this node)")}`);
|
|
55690
55774
|
if (!report.daemonRunning)
|
|
55691
|
-
console.log(
|
|
55692
|
-
if (report.links.length === 0) console.log(
|
|
55775
|
+
console.log(chalk277.dim(" daemon not running; showing configured links"));
|
|
55776
|
+
if (report.links.length === 0) console.log(chalk277.dim(" no links"));
|
|
55693
55777
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
55694
55778
|
}
|
|
55695
55779
|
|
|
@@ -55711,7 +55795,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
55711
55795
|
}
|
|
55712
55796
|
|
|
55713
55797
|
// src/commands/sessions/nodes/printReport.ts
|
|
55714
|
-
import
|
|
55798
|
+
import chalk278 from "chalk";
|
|
55715
55799
|
function printReport(report) {
|
|
55716
55800
|
if (report.links.length === 0) {
|
|
55717
55801
|
console.log(`${report.local} has no links`);
|
|
@@ -55725,11 +55809,11 @@ function printReport(report) {
|
|
|
55725
55809
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
55726
55810
|
}
|
|
55727
55811
|
function printDiagnosis(diagnosis) {
|
|
55728
|
-
console.log(`${
|
|
55812
|
+
console.log(`${chalk278.bold(diagnosis.name)} ${chalk278.dim(diagnosis.url)}`);
|
|
55729
55813
|
for (const hop of diagnosis.hops) {
|
|
55730
|
-
const mark = hop.ok ?
|
|
55814
|
+
const mark = hop.ok ? chalk278.green("\u2713") : chalk278.red("\u2717");
|
|
55731
55815
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
55732
|
-
if (hop.remediation) console.log(` ${
|
|
55816
|
+
if (hop.remediation) console.log(` ${chalk278.yellow(hop.remediation)}`);
|
|
55733
55817
|
}
|
|
55734
55818
|
}
|
|
55735
55819
|
|
|
@@ -55801,14 +55885,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
|
|
|
55801
55885
|
}
|
|
55802
55886
|
|
|
55803
55887
|
// src/commands/sessions/nodes/linkNode.ts
|
|
55804
|
-
import
|
|
55888
|
+
import chalk281 from "chalk";
|
|
55805
55889
|
|
|
55806
55890
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
55807
|
-
import
|
|
55891
|
+
import chalk279 from "chalk";
|
|
55808
55892
|
async function notifyDaemonLinks() {
|
|
55809
55893
|
if (!await isDaemonRunning()) {
|
|
55810
55894
|
console.log(
|
|
55811
|
-
|
|
55895
|
+
chalk279.yellow(
|
|
55812
55896
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
55813
55897
|
)
|
|
55814
55898
|
);
|
|
@@ -55816,11 +55900,11 @@ async function notifyDaemonLinks() {
|
|
|
55816
55900
|
}
|
|
55817
55901
|
try {
|
|
55818
55902
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
55819
|
-
console.log(
|
|
55903
|
+
console.log(chalk279.dim("The sessions daemon reloaded its links."));
|
|
55820
55904
|
} catch (error) {
|
|
55821
55905
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
55822
55906
|
console.log(
|
|
55823
|
-
|
|
55907
|
+
chalk279.yellow(
|
|
55824
55908
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
55825
55909
|
)
|
|
55826
55910
|
);
|
|
@@ -55828,7 +55912,7 @@ async function notifyDaemonLinks() {
|
|
|
55828
55912
|
}
|
|
55829
55913
|
|
|
55830
55914
|
// src/commands/sessions/nodes/readLinks.ts
|
|
55831
|
-
import
|
|
55915
|
+
import chalk280 from "chalk";
|
|
55832
55916
|
|
|
55833
55917
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
55834
55918
|
async function writeLinks(links2) {
|
|
@@ -55851,7 +55935,7 @@ async function readLinks() {
|
|
|
55851
55935
|
await writeLinks(links2);
|
|
55852
55936
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
55853
55937
|
console.log(
|
|
55854
|
-
|
|
55938
|
+
chalk280.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
55855
55939
|
);
|
|
55856
55940
|
return links2;
|
|
55857
55941
|
}
|
|
@@ -55907,7 +55991,7 @@ async function linkNode(name, url, options2) {
|
|
|
55907
55991
|
throw new Error(`${name} is this node; link to a different node`);
|
|
55908
55992
|
const link3 = await buildLink(name, url, options2);
|
|
55909
55993
|
await writeLinks([...others, link3]);
|
|
55910
|
-
console.log(
|
|
55994
|
+
console.log(chalk281.green(`Linked ${name} (${link3.url})`));
|
|
55911
55995
|
await notifyDaemonLinks();
|
|
55912
55996
|
}
|
|
55913
55997
|
|
|
@@ -56090,16 +56174,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
|
|
|
56090
56174
|
}
|
|
56091
56175
|
|
|
56092
56176
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
56093
|
-
import
|
|
56177
|
+
import chalk282 from "chalk";
|
|
56094
56178
|
async function unlinkNode(name) {
|
|
56095
56179
|
const links2 = await readLinks();
|
|
56096
56180
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
56097
56181
|
if (remaining.length === links2.length) {
|
|
56098
|
-
console.log(
|
|
56182
|
+
console.log(chalk282.yellow(`No link named ${name}`));
|
|
56099
56183
|
return;
|
|
56100
56184
|
}
|
|
56101
56185
|
await writeLinks(remaining);
|
|
56102
|
-
console.log(
|
|
56186
|
+
console.log(chalk282.green(`Unlinked ${name}`));
|
|
56103
56187
|
await notifyDaemonLinks();
|
|
56104
56188
|
}
|
|
56105
56189
|
|
|
@@ -56337,10 +56421,10 @@ function createProgram() {
|
|
|
56337
56421
|
}
|
|
56338
56422
|
|
|
56339
56423
|
// src/reportCliError.ts
|
|
56340
|
-
import
|
|
56424
|
+
import chalk283 from "chalk";
|
|
56341
56425
|
function reportCliError(error) {
|
|
56342
56426
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError) {
|
|
56343
|
-
console.error(
|
|
56427
|
+
console.error(chalk283.red(error.message));
|
|
56344
56428
|
} else {
|
|
56345
56429
|
console.error(error);
|
|
56346
56430
|
}
|