@staff0rd/assist 0.931.0 → 0.932.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/allowed.cli-reads +2 -0
- package/dist/allowed.cli-reads +2 -0
- package/dist/commands/extension/extension/background.js +1 -1
- package/dist/commands/extension/extension/content.js +29 -29
- package/dist/commands/extension/extension/docs.js +21 -21
- package/dist/commands/extension/extension/manifest.json +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +865 -778
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.932.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -4645,11 +4645,17 @@ async function readJsonBody(req) {
|
|
|
4645
4645
|
|
|
4646
4646
|
// src/commands/sessions/web/browser/browserRelay.ts
|
|
4647
4647
|
var RELAY_TIMEOUT_MS = 1e4;
|
|
4648
|
+
function optionalString(value) {
|
|
4649
|
+
return value === void 0 || typeof value === "string";
|
|
4650
|
+
}
|
|
4648
4651
|
function parseBrowserRequest(body) {
|
|
4649
|
-
const { op, url } = body ?? {};
|
|
4650
|
-
if (
|
|
4651
|
-
if (
|
|
4652
|
-
|
|
4652
|
+
const { op, url, selector, text: text17 } = body ?? {};
|
|
4653
|
+
if (!optionalString(url)) return void 0;
|
|
4654
|
+
if (op === "status" || op === "snapshot") return { op, url };
|
|
4655
|
+
if (op !== "inspect") return void 0;
|
|
4656
|
+
if (typeof selector === "string" && selector) return { op, url, selector };
|
|
4657
|
+
if (typeof text17 === "string" && text17) return { op, url, text: text17 };
|
|
4658
|
+
return void 0;
|
|
4653
4659
|
}
|
|
4654
4660
|
async function browserRelay(req, res) {
|
|
4655
4661
|
if (req.headers.origin) {
|
|
@@ -21269,7 +21275,7 @@ function registerCodeComment(parent) {
|
|
|
21269
21275
|
|
|
21270
21276
|
// src/commands/codexHook/parseCodexHookInput.ts
|
|
21271
21277
|
var SUPPORTED_TOOLS = /* @__PURE__ */ new Set(["Bash", "PowerShell"]);
|
|
21272
|
-
function
|
|
21278
|
+
function optionalString2(value) {
|
|
21273
21279
|
return typeof value === "string" ? value : void 0;
|
|
21274
21280
|
}
|
|
21275
21281
|
function parseCodexHookInput(raw) {
|
|
@@ -21277,9 +21283,9 @@ function parseCodexHookInput(raw) {
|
|
|
21277
21283
|
const data = JSON.parse(raw);
|
|
21278
21284
|
const base = {
|
|
21279
21285
|
event: data.hook_event_name ?? "PreToolUse",
|
|
21280
|
-
cwd:
|
|
21286
|
+
cwd: optionalString2(data.cwd)
|
|
21281
21287
|
};
|
|
21282
|
-
const transcriptPath2 =
|
|
21288
|
+
const transcriptPath2 = optionalString2(data.transcript_path);
|
|
21283
21289
|
if (transcriptPath2) base.transcriptPath = transcriptPath2;
|
|
21284
21290
|
const command = data.tool_input?.command;
|
|
21285
21291
|
if (typeof command !== "string" || !command.trim()) return base;
|
|
@@ -22876,7 +22882,24 @@ function registerConfig(program) {
|
|
|
22876
22882
|
).action((filter) => configKeys(filter));
|
|
22877
22883
|
}
|
|
22878
22884
|
|
|
22879
|
-
// src/commands/browser/
|
|
22885
|
+
// src/commands/browser/browserInspect.ts
|
|
22886
|
+
import chalk139 from "chalk";
|
|
22887
|
+
|
|
22888
|
+
// src/commands/browser/formatInspectMatches.ts
|
|
22889
|
+
function formatInspectMatches({ matches, total: total2 }, query) {
|
|
22890
|
+
if (total2 === 0) return [`no elements match ${query}`];
|
|
22891
|
+
const lines2 = matches.flatMap((match, index2) => [
|
|
22892
|
+
`[${index2 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
|
|
22893
|
+
...match.chain.map((step3) => ` ${step3}`)
|
|
22894
|
+
]);
|
|
22895
|
+
if (total2 > matches.length)
|
|
22896
|
+
lines2.push(
|
|
22897
|
+
`showing the first ${matches.length} of ${total2} matches; narrow the query to see the rest`
|
|
22898
|
+
);
|
|
22899
|
+
return lines2;
|
|
22900
|
+
}
|
|
22901
|
+
|
|
22902
|
+
// src/commands/browser/requestTab.ts
|
|
22880
22903
|
import chalk138 from "chalk";
|
|
22881
22904
|
|
|
22882
22905
|
// src/commands/browser/requestBrowser.ts
|
|
@@ -22905,24 +22928,75 @@ async function requestBrowser(server, request) {
|
|
|
22905
22928
|
return data;
|
|
22906
22929
|
}
|
|
22907
22930
|
|
|
22931
|
+
// src/commands/browser/requestTab.ts
|
|
22932
|
+
function fail6(message3) {
|
|
22933
|
+
console.error(chalk138.red(`Error: ${message3}`));
|
|
22934
|
+
process.exit(1);
|
|
22935
|
+
}
|
|
22936
|
+
async function requestTab(server, request) {
|
|
22937
|
+
const reply2 = await requestBrowser(server, request).catch(
|
|
22938
|
+
(error) => fail6(error.message)
|
|
22939
|
+
);
|
|
22940
|
+
if (!reply2.ok) {
|
|
22941
|
+
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
22942
|
+
fail6(reply2.error);
|
|
22943
|
+
}
|
|
22944
|
+
console.log(`tab: ${reply2.result.tabUrl}`);
|
|
22945
|
+
return { ...reply2.result, version: reply2.version };
|
|
22946
|
+
}
|
|
22947
|
+
|
|
22948
|
+
// src/commands/browser/browserInspect.ts
|
|
22949
|
+
async function browserInspect(selector, options2) {
|
|
22950
|
+
if (!selector === !options2.text) {
|
|
22951
|
+
console.error(
|
|
22952
|
+
chalk139.red("Error: pass either a <selector> or --text <text>, not both")
|
|
22953
|
+
);
|
|
22954
|
+
process.exit(1);
|
|
22955
|
+
}
|
|
22956
|
+
const query = options2.text ? { text: options2.text } : { selector };
|
|
22957
|
+
const result = await requestTab(options2.server, {
|
|
22958
|
+
op: "inspect",
|
|
22959
|
+
url: options2.url,
|
|
22960
|
+
...query
|
|
22961
|
+
});
|
|
22962
|
+
const label2 = options2.text ? `text ${JSON.stringify(options2.text)}` : `selector ${selector}`;
|
|
22963
|
+
for (const line of formatInspectMatches(result, label2)) console.log(line);
|
|
22964
|
+
}
|
|
22965
|
+
|
|
22966
|
+
// src/commands/browser/browserSnapshot.ts
|
|
22967
|
+
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
|
|
22968
|
+
import { dirname as dirname28 } from "path";
|
|
22969
|
+
|
|
22970
|
+
// src/commands/browser/snapshotPath.ts
|
|
22971
|
+
import { homedir as homedir21 } from "os";
|
|
22972
|
+
import { join as join54 } from "path";
|
|
22973
|
+
function snapshotPath(tabUrl, now) {
|
|
22974
|
+
const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
|
|
22975
|
+
const timestamp6 = now.toISOString().replace(/[:.]/g, "-");
|
|
22976
|
+
return join54(homedir21(), ".assist", "browser", `${host}-${timestamp6}.html`);
|
|
22977
|
+
}
|
|
22978
|
+
|
|
22979
|
+
// src/commands/browser/browserSnapshot.ts
|
|
22980
|
+
async function browserSnapshot(options2) {
|
|
22981
|
+
const result = await requestTab(options2.server, {
|
|
22982
|
+
op: "snapshot",
|
|
22983
|
+
url: options2.url
|
|
22984
|
+
});
|
|
22985
|
+
const path108 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
|
|
22986
|
+
mkdirSync17(dirname28(path108), { recursive: true });
|
|
22987
|
+
writeFileSync27(path108, result.html);
|
|
22988
|
+
console.log(`snapshot: ${path108}`);
|
|
22989
|
+
}
|
|
22990
|
+
|
|
22908
22991
|
// src/commands/browser/browserStatus.ts
|
|
22909
22992
|
async function browserStatus(options2) {
|
|
22910
|
-
const
|
|
22993
|
+
const result = await requestTab(options2.server, {
|
|
22911
22994
|
op: "status",
|
|
22912
22995
|
url: options2.url
|
|
22913
|
-
}).catch((error) => {
|
|
22914
|
-
console.error(chalk138.red(`Error: ${error.message}`));
|
|
22915
|
-
process.exit(1);
|
|
22916
22996
|
});
|
|
22917
|
-
console.log(`extension: connected (v${
|
|
22918
|
-
if (!reply2.ok) {
|
|
22919
|
-
if (reply2.tabUrl) console.log(`tab: ${reply2.tabUrl}`);
|
|
22920
|
-
console.error(chalk138.red(`Error: ${reply2.error}`));
|
|
22921
|
-
process.exit(1);
|
|
22922
|
-
}
|
|
22923
|
-
console.log(`tab: ${reply2.result.tabUrl}`);
|
|
22997
|
+
console.log(`extension: connected (v${result.version})`);
|
|
22924
22998
|
console.log(
|
|
22925
|
-
`content script: ${
|
|
22999
|
+
`content script: ${result.contentScript ? "running" : "not running (reload the tab, or update the extension)"}`
|
|
22926
23000
|
);
|
|
22927
23001
|
}
|
|
22928
23002
|
|
|
@@ -22946,21 +23020,34 @@ function registerBrowser(program) {
|
|
|
22946
23020
|
"Print the connected extension's version, the target tab's URL and whether the assist content script runs there"
|
|
22947
23021
|
)
|
|
22948
23022
|
).action(browserStatus);
|
|
23023
|
+
withTargetOptions(
|
|
23024
|
+
browser.command("snapshot").description(
|
|
23025
|
+
"Write the target tab's DOM to ~/.assist/browser/<host>-<timestamp>.html and print its path"
|
|
23026
|
+
)
|
|
23027
|
+
).action(browserSnapshot);
|
|
23028
|
+
withTargetOptions(
|
|
23029
|
+
browser.command("inspect [selector]").description(
|
|
23030
|
+
"Print the ancestor chain (tag#id.class), text and size of each element matching a CSS selector or --text, capped"
|
|
23031
|
+
).option(
|
|
23032
|
+
"--text <text>",
|
|
23033
|
+
"Match elements whose own text contains this, instead of a selector"
|
|
23034
|
+
)
|
|
23035
|
+
).action(browserInspect);
|
|
22949
23036
|
}
|
|
22950
23037
|
|
|
22951
23038
|
// src/commands/extension/extension.ts
|
|
22952
23039
|
import { cp } from "fs/promises";
|
|
22953
|
-
import
|
|
23040
|
+
import chalk140 from "chalk";
|
|
22954
23041
|
|
|
22955
23042
|
// src/commands/extension/extensionDir.ts
|
|
22956
23043
|
import { existsSync as existsSync49 } from "fs";
|
|
22957
|
-
import { dirname as
|
|
23044
|
+
import { dirname as dirname29, join as join55 } from "path";
|
|
22958
23045
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
22959
|
-
var moduleDir =
|
|
23046
|
+
var moduleDir = dirname29(fileURLToPath6(import.meta.url));
|
|
22960
23047
|
function extensionDir() {
|
|
22961
|
-
const bundled =
|
|
23048
|
+
const bundled = join55(moduleDir, "commands", "extension", "extension");
|
|
22962
23049
|
if (existsSync49(bundled)) return bundled;
|
|
22963
|
-
return
|
|
23050
|
+
return join55(moduleDir, "..", "..", "..", "extension");
|
|
22964
23051
|
}
|
|
22965
23052
|
|
|
22966
23053
|
// src/commands/extension/extension.ts
|
|
@@ -22973,21 +23060,21 @@ async function loadPath(source) {
|
|
|
22973
23060
|
return WSL_WINDOWS_PATH;
|
|
22974
23061
|
} catch {
|
|
22975
23062
|
console.log(
|
|
22976
|
-
|
|
23063
|
+
chalk140.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
22977
23064
|
);
|
|
22978
23065
|
return source;
|
|
22979
23066
|
}
|
|
22980
23067
|
}
|
|
22981
23068
|
async function extension() {
|
|
22982
23069
|
const path108 = await loadPath(extensionDir());
|
|
22983
|
-
console.log(
|
|
22984
|
-
console.log(
|
|
23070
|
+
console.log(chalk140.bold("assist \u2014 GitHub browser extension"));
|
|
23071
|
+
console.log(chalk140.dim(`load the unpacked extension from ${path108}`));
|
|
22985
23072
|
}
|
|
22986
23073
|
|
|
22987
23074
|
// src/commands/extension/printExtensionUrl.ts
|
|
22988
23075
|
import { readFile as readFile4 } from "fs/promises";
|
|
22989
|
-
import { join as
|
|
22990
|
-
import
|
|
23076
|
+
import { join as join56 } from "path";
|
|
23077
|
+
import chalk141 from "chalk";
|
|
22991
23078
|
|
|
22992
23079
|
// src/commands/extension/latestUpdate.ts
|
|
22993
23080
|
function latestUpdate(manifest, updates2) {
|
|
@@ -23003,14 +23090,14 @@ function latestUpdateLink(manifest, updates2) {
|
|
|
23003
23090
|
// src/commands/extension/printExtensionUrl.ts
|
|
23004
23091
|
async function printExtensionUrl() {
|
|
23005
23092
|
const manifest = await readFile4(
|
|
23006
|
-
|
|
23093
|
+
join56(extensionDir(), "manifest.json"),
|
|
23007
23094
|
"utf8"
|
|
23008
23095
|
);
|
|
23009
23096
|
const { update_url } = JSON.parse(manifest).browser_specific_settings.gecko;
|
|
23010
23097
|
const response = await fetch(update_url);
|
|
23011
23098
|
const link3 = response.ok ? latestUpdateLink(manifest, await response.text()) : void 0;
|
|
23012
23099
|
if (!link3) {
|
|
23013
|
-
console.log(
|
|
23100
|
+
console.log(chalk141.red(`no signed build found in ${update_url}`));
|
|
23014
23101
|
process.exitCode = 1;
|
|
23015
23102
|
return;
|
|
23016
23103
|
}
|
|
@@ -23019,16 +23106,16 @@ async function printExtensionUrl() {
|
|
|
23019
23106
|
|
|
23020
23107
|
// src/commands/extension/signExtension.ts
|
|
23021
23108
|
import { rm as rm2 } from "fs/promises";
|
|
23022
|
-
import { homedir as
|
|
23023
|
-
import { join as
|
|
23024
|
-
import
|
|
23109
|
+
import { homedir as homedir22, tmpdir as tmpdir3 } from "os";
|
|
23110
|
+
import { join as join62 } from "path";
|
|
23111
|
+
import chalk143 from "chalk";
|
|
23025
23112
|
|
|
23026
23113
|
// src/commands/extension/copySignedXpi.ts
|
|
23027
23114
|
import { copyFile } from "fs/promises";
|
|
23028
|
-
import { join as
|
|
23115
|
+
import { join as join57 } from "path";
|
|
23029
23116
|
var SIGNED_XPI_NAME = "assist-extension.xpi";
|
|
23030
23117
|
async function copySignedXpi(xpi, dir) {
|
|
23031
|
-
const fixed2 =
|
|
23118
|
+
const fixed2 = join57(dir, SIGNED_XPI_NAME);
|
|
23032
23119
|
if (fixed2 === xpi) return fixed2;
|
|
23033
23120
|
await copyFile(xpi, fixed2);
|
|
23034
23121
|
return fixed2;
|
|
@@ -23037,16 +23124,16 @@ async function copySignedXpi(xpi, dir) {
|
|
|
23037
23124
|
// src/commands/extension/findSignedXpi.ts
|
|
23038
23125
|
import { existsSync as existsSync50 } from "fs";
|
|
23039
23126
|
import { readdir } from "fs/promises";
|
|
23040
|
-
import { join as
|
|
23127
|
+
import { join as join58 } from "path";
|
|
23041
23128
|
async function findSignedXpi(dir) {
|
|
23042
23129
|
if (!existsSync50(dir)) return null;
|
|
23043
23130
|
const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
|
|
23044
|
-
return name ?
|
|
23131
|
+
return name ? join58(dir, name) : null;
|
|
23045
23132
|
}
|
|
23046
23133
|
|
|
23047
23134
|
// src/commands/extension/signedAddonInstallPath.ts
|
|
23048
23135
|
import { cp as cp2 } from "fs/promises";
|
|
23049
|
-
import
|
|
23136
|
+
import chalk142 from "chalk";
|
|
23050
23137
|
var WSL_WINDOWS_XPI = "/mnt/c/tools/assist-extension.xpi";
|
|
23051
23138
|
var WSL_WINDOWS_PATH2 = String.raw`C:\tools\assist-extension.xpi`;
|
|
23052
23139
|
async function signedAddonInstallPath(xpi) {
|
|
@@ -23056,7 +23143,7 @@ async function signedAddonInstallPath(xpi) {
|
|
|
23056
23143
|
return WSL_WINDOWS_PATH2;
|
|
23057
23144
|
} catch {
|
|
23058
23145
|
console.log(
|
|
23059
|
-
|
|
23146
|
+
chalk142.yellow(`could not copy the add-on to ${WSL_WINDOWS_PATH2}`)
|
|
23060
23147
|
);
|
|
23061
23148
|
return xpi;
|
|
23062
23149
|
}
|
|
@@ -23064,10 +23151,10 @@ async function signedAddonInstallPath(xpi) {
|
|
|
23064
23151
|
|
|
23065
23152
|
// src/commands/extension/signPreflightProblem.ts
|
|
23066
23153
|
import { existsSync as existsSync51 } from "fs";
|
|
23067
|
-
import { join as
|
|
23154
|
+
import { join as join59 } from "path";
|
|
23068
23155
|
var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
|
|
23069
23156
|
function signPreflightProblem(source) {
|
|
23070
|
-
if (!existsSync51(
|
|
23157
|
+
if (!existsSync51(join59(source, "content.js")))
|
|
23071
23158
|
return {
|
|
23072
23159
|
message: `no content.js in ${source}`,
|
|
23073
23160
|
hint: "run npm run build to bundle the content script"
|
|
@@ -23082,7 +23169,7 @@ function signPreflightProblem(source) {
|
|
|
23082
23169
|
|
|
23083
23170
|
// src/commands/extension/stageExtension.ts
|
|
23084
23171
|
import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
|
|
23085
|
-
import { basename as basename14, join as
|
|
23172
|
+
import { basename as basename14, join as join60 } from "path";
|
|
23086
23173
|
|
|
23087
23174
|
// src/commands/extension/stampManifestVersion.ts
|
|
23088
23175
|
function stampManifestVersion(manifest, version2) {
|
|
@@ -23099,7 +23186,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
23099
23186
|
recursive: true,
|
|
23100
23187
|
filter: (path108) => basename14(path108) !== "updates.json"
|
|
23101
23188
|
});
|
|
23102
|
-
const manifest =
|
|
23189
|
+
const manifest = join60(staging, "manifest.json");
|
|
23103
23190
|
const stamped = stampManifestVersion(
|
|
23104
23191
|
await readFile5(manifest, "utf8"),
|
|
23105
23192
|
version2
|
|
@@ -23109,7 +23196,7 @@ async function stageExtension(source, staging, version2) {
|
|
|
23109
23196
|
|
|
23110
23197
|
// src/commands/extension/writeUpdateManifest.ts
|
|
23111
23198
|
import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
23112
|
-
import { join as
|
|
23199
|
+
import { join as join61 } from "path";
|
|
23113
23200
|
|
|
23114
23201
|
// src/commands/extension/buildUpdateManifest.ts
|
|
23115
23202
|
var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
|
|
@@ -23134,30 +23221,30 @@ function buildUpdateManifest(manifest, version2) {
|
|
|
23134
23221
|
// src/commands/extension/writeUpdateManifest.ts
|
|
23135
23222
|
async function writeUpdateManifest(source, dir, version2) {
|
|
23136
23223
|
await writeFile5(
|
|
23137
|
-
|
|
23224
|
+
join61(dir, "updates.json"),
|
|
23138
23225
|
buildUpdateManifest(
|
|
23139
|
-
await readFile6(
|
|
23226
|
+
await readFile6(join61(source, "manifest.json"), "utf8"),
|
|
23140
23227
|
version2
|
|
23141
23228
|
)
|
|
23142
23229
|
);
|
|
23143
23230
|
}
|
|
23144
23231
|
|
|
23145
23232
|
// src/commands/extension/signExtension.ts
|
|
23146
|
-
var ARTIFACTS_DIR =
|
|
23147
|
-
var STAGING_DIR =
|
|
23233
|
+
var ARTIFACTS_DIR = join62(homedir22(), ".assist", "extension");
|
|
23234
|
+
var STAGING_DIR = join62(tmpdir3(), "assist-extension");
|
|
23148
23235
|
async function signExtension() {
|
|
23149
23236
|
const source = extensionDir();
|
|
23150
23237
|
const problem = signPreflightProblem(source);
|
|
23151
23238
|
if (problem) {
|
|
23152
|
-
console.log(
|
|
23153
|
-
console.log(
|
|
23239
|
+
console.log(chalk143.red(problem.message));
|
|
23240
|
+
console.log(chalk143.dim(problem.hint));
|
|
23154
23241
|
process.exitCode = 1;
|
|
23155
23242
|
return;
|
|
23156
23243
|
}
|
|
23157
23244
|
const { version: version2 } = package_default;
|
|
23158
23245
|
await stageExtension(source, STAGING_DIR, version2);
|
|
23159
23246
|
await rm2(ARTIFACTS_DIR, { recursive: true, force: true });
|
|
23160
|
-
console.log(
|
|
23247
|
+
console.log(chalk143.bold(`signing version ${version2} for self-distribution`));
|
|
23161
23248
|
const { done: done2 } = spawnInherit("npx", [
|
|
23162
23249
|
"--yes",
|
|
23163
23250
|
"web-ext",
|
|
@@ -23167,13 +23254,13 @@ async function signExtension() {
|
|
|
23167
23254
|
"--channel=unlisted"
|
|
23168
23255
|
]);
|
|
23169
23256
|
if (await done2 !== 0) {
|
|
23170
|
-
console.log(
|
|
23257
|
+
console.log(chalk143.red("web-ext sign failed"));
|
|
23171
23258
|
process.exitCode = 1;
|
|
23172
23259
|
return;
|
|
23173
23260
|
}
|
|
23174
23261
|
const xpi = await findSignedXpi(ARTIFACTS_DIR);
|
|
23175
23262
|
if (!xpi) {
|
|
23176
|
-
console.log(
|
|
23263
|
+
console.log(chalk143.red(`web-ext wrote no .xpi into ${ARTIFACTS_DIR}`));
|
|
23177
23264
|
process.exitCode = 1;
|
|
23178
23265
|
return;
|
|
23179
23266
|
}
|
|
@@ -23181,7 +23268,7 @@ async function signExtension() {
|
|
|
23181
23268
|
const path108 = await signedAddonInstallPath(
|
|
23182
23269
|
await copySignedXpi(xpi, ARTIFACTS_DIR)
|
|
23183
23270
|
);
|
|
23184
|
-
console.log(
|
|
23271
|
+
console.log(chalk143.dim(`install the signed add-on from ${path108}`));
|
|
23185
23272
|
}
|
|
23186
23273
|
|
|
23187
23274
|
// src/commands/registerExtension.ts
|
|
@@ -23242,11 +23329,11 @@ async function dropRetiredTables(exec3) {
|
|
|
23242
23329
|
}
|
|
23243
23330
|
|
|
23244
23331
|
// src/commands/db/reportRetiredTables.ts
|
|
23245
|
-
import
|
|
23332
|
+
import chalk144 from "chalk";
|
|
23246
23333
|
function reportRetiredTables(tables) {
|
|
23247
23334
|
for (const table of tables) {
|
|
23248
23335
|
console.error(
|
|
23249
|
-
|
|
23336
|
+
chalk144.yellow(
|
|
23250
23337
|
`Retired table ${table.name} still exists (${table.rows} rows). Run \`assist db drop-retired\` to drop it.`
|
|
23251
23338
|
)
|
|
23252
23339
|
);
|
|
@@ -23254,40 +23341,40 @@ function reportRetiredTables(tables) {
|
|
|
23254
23341
|
}
|
|
23255
23342
|
|
|
23256
23343
|
// src/commands/db/reportMigrationStatus.ts
|
|
23257
|
-
import
|
|
23344
|
+
import chalk145 from "chalk";
|
|
23258
23345
|
function reportApplied(applied) {
|
|
23259
23346
|
if (applied.length === 0) {
|
|
23260
|
-
console.error(
|
|
23347
|
+
console.error(chalk145.green("Database is up to date; nothing to apply."));
|
|
23261
23348
|
return;
|
|
23262
23349
|
}
|
|
23263
23350
|
for (const migration of applied) {
|
|
23264
23351
|
console.error(
|
|
23265
|
-
|
|
23352
|
+
chalk145.green(`Applied migration ${migration.id} (${migration.name}).`)
|
|
23266
23353
|
);
|
|
23267
23354
|
}
|
|
23268
23355
|
}
|
|
23269
23356
|
function reportMigrationStatus(status2) {
|
|
23270
23357
|
if (status2.state === "in-sync") {
|
|
23271
23358
|
console.error(
|
|
23272
|
-
|
|
23359
|
+
chalk145.green(`In sync at migration ${status2.version} (latest).`)
|
|
23273
23360
|
);
|
|
23274
23361
|
return;
|
|
23275
23362
|
}
|
|
23276
23363
|
if (status2.state === "behind") {
|
|
23277
23364
|
console.error(
|
|
23278
|
-
|
|
23365
|
+
chalk145.yellow(
|
|
23279
23366
|
`Behind: applied ${status2.applied}, build expects ${status2.expected}.`
|
|
23280
23367
|
)
|
|
23281
23368
|
);
|
|
23282
23369
|
console.error(
|
|
23283
|
-
|
|
23370
|
+
chalk145.yellow(
|
|
23284
23371
|
`Pending: ${status2.pending.join(", ")}. Run \`assist db migrate\`.`
|
|
23285
23372
|
)
|
|
23286
23373
|
);
|
|
23287
23374
|
return;
|
|
23288
23375
|
}
|
|
23289
23376
|
console.error(
|
|
23290
|
-
|
|
23377
|
+
chalk145.red(
|
|
23291
23378
|
`Ahead: applied ${status2.applied}, build knows ${status2.expected}. Update assist.`
|
|
23292
23379
|
)
|
|
23293
23380
|
);
|
|
@@ -23328,16 +23415,16 @@ function registerDb(program) {
|
|
|
23328
23415
|
}
|
|
23329
23416
|
|
|
23330
23417
|
// src/commands/dbMigration/dbMigrationConfirm.ts
|
|
23331
|
-
import { unlinkSync as unlinkSync9, writeFileSync as
|
|
23332
|
-
import
|
|
23418
|
+
import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync28 } from "fs";
|
|
23419
|
+
import chalk146 from "chalk";
|
|
23333
23420
|
|
|
23334
23421
|
// src/commands/dbMigration/getMigrationPinPath.ts
|
|
23335
|
-
import { join as
|
|
23422
|
+
import { join as join63 } from "path";
|
|
23336
23423
|
function getMigrationPinPath(pin2) {
|
|
23337
|
-
return
|
|
23424
|
+
return join63(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
|
|
23338
23425
|
}
|
|
23339
23426
|
function getMigrationApprovalPath(migrationId) {
|
|
23340
|
-
return
|
|
23427
|
+
return join63(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
|
|
23341
23428
|
}
|
|
23342
23429
|
|
|
23343
23430
|
// src/commands/dbMigration/readMigrationPinState.ts
|
|
@@ -23360,26 +23447,26 @@ function dbMigrationConfirm(pin2) {
|
|
|
23360
23447
|
sweepRestrictedDir();
|
|
23361
23448
|
const state = readMigrationPinState(pin2);
|
|
23362
23449
|
if (!state) {
|
|
23363
|
-
console.error(
|
|
23450
|
+
console.error(chalk146.red(`No pending migration unlock for pin: ${pin2}`));
|
|
23364
23451
|
process.exitCode = 1;
|
|
23365
23452
|
return;
|
|
23366
23453
|
}
|
|
23367
|
-
|
|
23454
|
+
writeFileSync28(
|
|
23368
23455
|
getMigrationApprovalPath(state.migrationId),
|
|
23369
23456
|
JSON.stringify({ migrationId: state.migrationId })
|
|
23370
23457
|
);
|
|
23371
23458
|
unlinkSync9(getMigrationPinPath(pin2));
|
|
23372
23459
|
console.log(
|
|
23373
|
-
|
|
23460
|
+
chalk146.green(
|
|
23374
23461
|
`Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
|
|
23375
23462
|
)
|
|
23376
23463
|
);
|
|
23377
23464
|
}
|
|
23378
23465
|
|
|
23379
23466
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
23380
|
-
import { mkdirSync as
|
|
23467
|
+
import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync29 } from "fs";
|
|
23381
23468
|
import { randomInt as randomInt2 } from "crypto";
|
|
23382
|
-
import
|
|
23469
|
+
import chalk147 from "chalk";
|
|
23383
23470
|
|
|
23384
23471
|
// src/commands/dbMigration/nextMigrationId.ts
|
|
23385
23472
|
function nextMigrationId() {
|
|
@@ -23390,11 +23477,11 @@ function nextMigrationId() {
|
|
|
23390
23477
|
function dbMigrationUnlock() {
|
|
23391
23478
|
const migrationId = nextMigrationId();
|
|
23392
23479
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
23393
|
-
|
|
23480
|
+
mkdirSync18(getRestrictedDir(), { recursive: true });
|
|
23394
23481
|
sweepRestrictedDir();
|
|
23395
|
-
|
|
23482
|
+
writeFileSync29(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
|
|
23396
23483
|
console.error(
|
|
23397
|
-
|
|
23484
|
+
chalk147.yellow.bold(
|
|
23398
23485
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
23399
23486
|
)
|
|
23400
23487
|
);
|
|
@@ -23404,7 +23491,7 @@ function dbMigrationUnlock() {
|
|
|
23404
23491
|
});
|
|
23405
23492
|
if (!delivered) {
|
|
23406
23493
|
console.error(
|
|
23407
|
-
|
|
23494
|
+
chalk147.red(
|
|
23408
23495
|
"Could not deliver the confirmation pin via notification.\nThe migration cannot be approved until the notification channel works."
|
|
23409
23496
|
)
|
|
23410
23497
|
);
|
|
@@ -23414,7 +23501,7 @@ function dbMigrationUnlock() {
|
|
|
23414
23501
|
console.log(
|
|
23415
23502
|
`A confirmation pin was sent to your desktop notifications.
|
|
23416
23503
|
To approve creating migration ${migrationId}, run:
|
|
23417
|
-
${
|
|
23504
|
+
${chalk147.cyan(" assist db-migration confirm <PIN>")}
|
|
23418
23505
|
using the pin from that notification.`
|
|
23419
23506
|
);
|
|
23420
23507
|
}
|
|
@@ -23440,8 +23527,8 @@ function registerDbMigration(parent) {
|
|
|
23440
23527
|
}
|
|
23441
23528
|
|
|
23442
23529
|
// src/commands/deploy/redirect.ts
|
|
23443
|
-
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as
|
|
23444
|
-
import
|
|
23530
|
+
import { existsSync as existsSync53, readFileSync as readFileSync34, writeFileSync as writeFileSync30 } from "fs";
|
|
23531
|
+
import chalk148 from "chalk";
|
|
23445
23532
|
var TRAILING_SLASH_SCRIPT = ` <script>
|
|
23446
23533
|
if (!window.location.pathname.endsWith('/')) {
|
|
23447
23534
|
window.location.href = \`\${window.location.pathname}/\${window.location.search}\${window.location.hash}\`;
|
|
@@ -23450,23 +23537,23 @@ var TRAILING_SLASH_SCRIPT = ` <script>
|
|
|
23450
23537
|
function redirect() {
|
|
23451
23538
|
const indexPath = "index.html";
|
|
23452
23539
|
if (!existsSync53(indexPath)) {
|
|
23453
|
-
console.log(
|
|
23540
|
+
console.log(chalk148.yellow("No index.html found"));
|
|
23454
23541
|
return;
|
|
23455
23542
|
}
|
|
23456
23543
|
const content = readFileSync34(indexPath, "utf8");
|
|
23457
23544
|
if (content.includes("window.location.pathname.endsWith('/')")) {
|
|
23458
|
-
console.log(
|
|
23545
|
+
console.log(chalk148.dim("Trailing slash script already present"));
|
|
23459
23546
|
return;
|
|
23460
23547
|
}
|
|
23461
23548
|
const headCloseIndex = content.indexOf("</head>");
|
|
23462
23549
|
if (headCloseIndex === -1) {
|
|
23463
|
-
console.log(
|
|
23550
|
+
console.log(chalk148.red("Could not find </head> tag in index.html"));
|
|
23464
23551
|
return;
|
|
23465
23552
|
}
|
|
23466
23553
|
const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
|
|
23467
23554
|
${content.slice(headCloseIndex)}`;
|
|
23468
|
-
|
|
23469
|
-
console.log(
|
|
23555
|
+
writeFileSync30(indexPath, newContent);
|
|
23556
|
+
console.log(chalk148.green("Added trailing slash redirect to index.html"));
|
|
23470
23557
|
}
|
|
23471
23558
|
|
|
23472
23559
|
// src/commands/registerDeploy.ts
|
|
@@ -23481,11 +23568,11 @@ import { execFileSync as execFileSync7 } from "child_process";
|
|
|
23481
23568
|
import { basename as basename16 } from "path";
|
|
23482
23569
|
|
|
23483
23570
|
// src/commands/devlog/loadBlogSkipDays.ts
|
|
23484
|
-
import { homedir as
|
|
23485
|
-
import { join as
|
|
23486
|
-
var BLOG_REPO_ROOT =
|
|
23571
|
+
import { homedir as homedir23 } from "os";
|
|
23572
|
+
import { join as join64 } from "path";
|
|
23573
|
+
var BLOG_REPO_ROOT = join64(homedir23(), "git/blog");
|
|
23487
23574
|
function loadBlogSkipDays(repoName) {
|
|
23488
|
-
const config = loadRawYaml(
|
|
23575
|
+
const config = loadRawYaml(join64(BLOG_REPO_ROOT, "assist.yml"));
|
|
23489
23576
|
const devlog = config.devlog;
|
|
23490
23577
|
const skip3 = devlog?.skip;
|
|
23491
23578
|
return new Set(skip3?.[repoName]);
|
|
@@ -23493,17 +23580,17 @@ function loadBlogSkipDays(repoName) {
|
|
|
23493
23580
|
|
|
23494
23581
|
// src/commands/devlog/shared.ts
|
|
23495
23582
|
import { execSync as execSync31 } from "child_process";
|
|
23496
|
-
import
|
|
23583
|
+
import chalk149 from "chalk";
|
|
23497
23584
|
|
|
23498
23585
|
// src/shared/getRepoName.ts
|
|
23499
23586
|
import { existsSync as existsSync54, readFileSync as readFileSync35 } from "fs";
|
|
23500
|
-
import { basename as basename15, join as
|
|
23587
|
+
import { basename as basename15, join as join65 } from "path";
|
|
23501
23588
|
function getRepoName() {
|
|
23502
23589
|
const config = loadConfig();
|
|
23503
23590
|
if (config.devlog?.name) {
|
|
23504
23591
|
return config.devlog.name;
|
|
23505
23592
|
}
|
|
23506
|
-
const packageJsonPath =
|
|
23593
|
+
const packageJsonPath = join65(process.cwd(), "package.json");
|
|
23507
23594
|
if (existsSync54(packageJsonPath)) {
|
|
23508
23595
|
try {
|
|
23509
23596
|
const content = readFileSync35(packageJsonPath, "utf8");
|
|
@@ -23519,8 +23606,8 @@ function getRepoName() {
|
|
|
23519
23606
|
|
|
23520
23607
|
// src/commands/devlog/loadDevlogEntries.ts
|
|
23521
23608
|
import { readdirSync as readdirSync8, readFileSync as readFileSync36 } from "fs";
|
|
23522
|
-
import { join as
|
|
23523
|
-
var DEVLOG_DIR =
|
|
23609
|
+
import { join as join66 } from "path";
|
|
23610
|
+
var DEVLOG_DIR = join66(BLOG_REPO_ROOT, "src/content/devlog");
|
|
23524
23611
|
function extractFrontmatter(content) {
|
|
23525
23612
|
const fm = content.match(/^---\n([\s\S]*?)\n---/);
|
|
23526
23613
|
return fm?.[1] ?? null;
|
|
@@ -23548,7 +23635,7 @@ function readDevlogFiles(callback) {
|
|
|
23548
23635
|
try {
|
|
23549
23636
|
const files = readdirSync8(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
|
|
23550
23637
|
for (const file of files) {
|
|
23551
|
-
const content = readFileSync36(
|
|
23638
|
+
const content = readFileSync36(join66(DEVLOG_DIR, file), "utf8");
|
|
23552
23639
|
const parsed = parseFrontmatter(content, file);
|
|
23553
23640
|
if (parsed) callback(parsed);
|
|
23554
23641
|
}
|
|
@@ -23602,13 +23689,13 @@ function shouldIgnoreCommit(files, ignorePaths) {
|
|
|
23602
23689
|
}
|
|
23603
23690
|
function printCommitsWithFiles(commits2, ignore3, verbose) {
|
|
23604
23691
|
for (const commit2 of commits2) {
|
|
23605
|
-
console.log(` ${
|
|
23692
|
+
console.log(` ${chalk149.yellow(commit2.hash)} ${commit2.message}`);
|
|
23606
23693
|
if (verbose) {
|
|
23607
23694
|
const visibleFiles = commit2.files.filter(
|
|
23608
23695
|
(file) => !ignore3.some((p) => file.startsWith(p))
|
|
23609
23696
|
);
|
|
23610
23697
|
for (const file of visibleFiles) {
|
|
23611
|
-
console.log(` ${
|
|
23698
|
+
console.log(` ${chalk149.dim(file)}`);
|
|
23612
23699
|
}
|
|
23613
23700
|
}
|
|
23614
23701
|
}
|
|
@@ -23633,15 +23720,15 @@ function parseGitLogCommits(output, ignore3, afterDate) {
|
|
|
23633
23720
|
}
|
|
23634
23721
|
|
|
23635
23722
|
// src/commands/devlog/list/printDateHeader.ts
|
|
23636
|
-
import
|
|
23723
|
+
import chalk150 from "chalk";
|
|
23637
23724
|
function printDateHeader(date, isSkipped, entries) {
|
|
23638
23725
|
if (isSkipped) {
|
|
23639
|
-
console.log(`${
|
|
23726
|
+
console.log(`${chalk150.bold.blue(date)} ${chalk150.dim("skipped")}`);
|
|
23640
23727
|
} else if (entries && entries.length > 0) {
|
|
23641
|
-
const entryInfo = entries.map((e) => `${
|
|
23642
|
-
console.log(`${
|
|
23728
|
+
const entryInfo = entries.map((e) => `${chalk150.green(e.version)} ${e.title}`).join(" | ");
|
|
23729
|
+
console.log(`${chalk150.bold.blue(date)} ${entryInfo}`);
|
|
23643
23730
|
} else {
|
|
23644
|
-
console.log(`${
|
|
23731
|
+
console.log(`${chalk150.bold.blue(date)} ${chalk150.red("\u26A0 devlog missing")}`);
|
|
23645
23732
|
}
|
|
23646
23733
|
}
|
|
23647
23734
|
|
|
@@ -23745,24 +23832,24 @@ function bumpVersion(version2, type) {
|
|
|
23745
23832
|
|
|
23746
23833
|
// src/commands/devlog/next/displayNextEntry.ts
|
|
23747
23834
|
import { execFileSync as execFileSync9 } from "child_process";
|
|
23748
|
-
import
|
|
23835
|
+
import chalk152 from "chalk";
|
|
23749
23836
|
|
|
23750
23837
|
// src/commands/devlog/next/displayNextEntry/displayVersion.ts
|
|
23751
|
-
import
|
|
23838
|
+
import chalk151 from "chalk";
|
|
23752
23839
|
function displayVersion(conventional, firstHash, patchVersion, minorVersion) {
|
|
23753
23840
|
if (conventional && firstHash) {
|
|
23754
23841
|
const version2 = getVersionAtCommit(firstHash);
|
|
23755
23842
|
if (version2) {
|
|
23756
|
-
console.log(`${
|
|
23843
|
+
console.log(`${chalk151.bold("version:")} ${stripToMinor(version2)}`);
|
|
23757
23844
|
} else {
|
|
23758
|
-
console.log(`${
|
|
23845
|
+
console.log(`${chalk151.bold("version:")} ${chalk151.red("unknown")}`);
|
|
23759
23846
|
}
|
|
23760
23847
|
} else if (patchVersion && minorVersion) {
|
|
23761
23848
|
console.log(
|
|
23762
|
-
`${
|
|
23849
|
+
`${chalk151.bold("version:")} ${patchVersion} (patch) or ${minorVersion} (minor)`
|
|
23763
23850
|
);
|
|
23764
23851
|
} else {
|
|
23765
|
-
console.log(`${
|
|
23852
|
+
console.log(`${chalk151.bold("version:")} v0.1 (initial)`);
|
|
23766
23853
|
}
|
|
23767
23854
|
}
|
|
23768
23855
|
|
|
@@ -23810,16 +23897,16 @@ function noCommitsMessage(hasLastInfo) {
|
|
|
23810
23897
|
return hasLastInfo ? "No commits after last versioned entry" : "No commits found";
|
|
23811
23898
|
}
|
|
23812
23899
|
function logName(repoName) {
|
|
23813
|
-
console.log(`${
|
|
23900
|
+
console.log(`${chalk152.bold("name:")} ${repoName}`);
|
|
23814
23901
|
}
|
|
23815
23902
|
function displayNextEntry(ctx, targetDate, commits2) {
|
|
23816
23903
|
logName(ctx.repoName);
|
|
23817
23904
|
printVersionInfo(ctx.config, ctx.lastInfo, commits2[0]?.hash);
|
|
23818
|
-
console.log(
|
|
23905
|
+
console.log(chalk152.bold.blue(targetDate));
|
|
23819
23906
|
printCommitsWithFiles(commits2, ctx.ignore, ctx.verbose);
|
|
23820
23907
|
}
|
|
23821
23908
|
function logNoCommits(lastInfo) {
|
|
23822
|
-
console.log(
|
|
23909
|
+
console.log(chalk152.dim(noCommitsMessage(!!lastInfo)));
|
|
23823
23910
|
}
|
|
23824
23911
|
|
|
23825
23912
|
// src/commands/devlog/next.ts
|
|
@@ -23860,11 +23947,11 @@ function next2(options2) {
|
|
|
23860
23947
|
import { execSync as execSync33 } from "child_process";
|
|
23861
23948
|
|
|
23862
23949
|
// src/commands/devlog/repos/printReposTable.ts
|
|
23863
|
-
import
|
|
23950
|
+
import chalk153 from "chalk";
|
|
23864
23951
|
function colorStatus(status2) {
|
|
23865
|
-
if (status2 === "missing") return
|
|
23866
|
-
if (status2 === "outdated") return
|
|
23867
|
-
return
|
|
23952
|
+
if (status2 === "missing") return chalk153.red(status2);
|
|
23953
|
+
if (status2 === "outdated") return chalk153.yellow(status2);
|
|
23954
|
+
return chalk153.green(status2);
|
|
23868
23955
|
}
|
|
23869
23956
|
function formatRow(row3, nameWidth) {
|
|
23870
23957
|
const devlog = (row3.lastDevlog ?? "-").padEnd(11);
|
|
@@ -23878,8 +23965,8 @@ function printReposTable(rows) {
|
|
|
23878
23965
|
"Last Devlog".padEnd(11),
|
|
23879
23966
|
"Status"
|
|
23880
23967
|
].join(" ");
|
|
23881
|
-
console.log(
|
|
23882
|
-
console.log(
|
|
23968
|
+
console.log(chalk153.dim(header));
|
|
23969
|
+
console.log(chalk153.dim("-".repeat(header.length)));
|
|
23883
23970
|
for (const row3 of rows) {
|
|
23884
23971
|
console.log(formatRow(row3, nameWidth));
|
|
23885
23972
|
}
|
|
@@ -23935,16 +24022,16 @@ function repos(options2) {
|
|
|
23935
24022
|
}
|
|
23936
24023
|
|
|
23937
24024
|
// src/commands/devlog/skip.ts
|
|
23938
|
-
import { writeFileSync as
|
|
23939
|
-
import { join as
|
|
23940
|
-
import
|
|
24025
|
+
import { writeFileSync as writeFileSync31 } from "fs";
|
|
24026
|
+
import { join as join67 } from "path";
|
|
24027
|
+
import chalk154 from "chalk";
|
|
23941
24028
|
import { stringify as stringifyYaml3 } from "yaml";
|
|
23942
24029
|
function getBlogConfigPath() {
|
|
23943
|
-
return
|
|
24030
|
+
return join67(BLOG_REPO_ROOT, "assist.yml");
|
|
23944
24031
|
}
|
|
23945
24032
|
function skip2(date) {
|
|
23946
24033
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
23947
|
-
console.log(
|
|
24034
|
+
console.log(chalk154.red("Invalid date format. Use YYYY-MM-DD"));
|
|
23948
24035
|
process.exit(1);
|
|
23949
24036
|
}
|
|
23950
24037
|
const repoName = getRepoName();
|
|
@@ -23955,7 +24042,7 @@ function skip2(date) {
|
|
|
23955
24042
|
const skipDays = skip3[repoName] ?? [];
|
|
23956
24043
|
if (skipDays.includes(date)) {
|
|
23957
24044
|
console.log(
|
|
23958
|
-
|
|
24045
|
+
chalk154.yellow(`${date} is already in skip list for ${repoName}`)
|
|
23959
24046
|
);
|
|
23960
24047
|
return;
|
|
23961
24048
|
}
|
|
@@ -23964,21 +24051,21 @@ function skip2(date) {
|
|
|
23964
24051
|
skip3[repoName] = skipDays;
|
|
23965
24052
|
devlog.skip = skip3;
|
|
23966
24053
|
config.devlog = devlog;
|
|
23967
|
-
|
|
23968
|
-
console.log(
|
|
24054
|
+
writeFileSync31(configPath, stringifyYaml3(config, { lineWidth: 0 }));
|
|
24055
|
+
console.log(chalk154.green(`Added ${date} to skip list for ${repoName}`));
|
|
23969
24056
|
}
|
|
23970
24057
|
|
|
23971
24058
|
// src/commands/devlog/version.ts
|
|
23972
|
-
import
|
|
24059
|
+
import chalk155 from "chalk";
|
|
23973
24060
|
function version() {
|
|
23974
24061
|
const config = loadConfig();
|
|
23975
24062
|
const name = getRepoName();
|
|
23976
24063
|
const lastInfo = getLastVersionInfo(name, config);
|
|
23977
24064
|
const lastVersion = lastInfo?.version ?? null;
|
|
23978
24065
|
const nextVersion = lastVersion ? bumpVersion(lastVersion, "patch") : null;
|
|
23979
|
-
console.log(`${
|
|
23980
|
-
console.log(`${
|
|
23981
|
-
console.log(`${
|
|
24066
|
+
console.log(`${chalk155.bold("name:")} ${name}`);
|
|
24067
|
+
console.log(`${chalk155.bold("last:")} ${lastVersion ?? chalk155.dim("none")}`);
|
|
24068
|
+
console.log(`${chalk155.bold("next:")} ${nextVersion ?? chalk155.dim("none")}`);
|
|
23982
24069
|
}
|
|
23983
24070
|
|
|
23984
24071
|
// src/commands/registerDevlog.ts
|
|
@@ -24002,8 +24089,8 @@ function registerDevlog(program) {
|
|
|
24002
24089
|
|
|
24003
24090
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
24004
24091
|
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync9 } from "fs";
|
|
24005
|
-
import { join as
|
|
24006
|
-
import
|
|
24092
|
+
import { join as join68 } from "path";
|
|
24093
|
+
import chalk156 from "chalk";
|
|
24007
24094
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
24008
24095
|
function isLockedDll(debugDir) {
|
|
24009
24096
|
let files;
|
|
@@ -24014,7 +24101,7 @@ function isLockedDll(debugDir) {
|
|
|
24014
24101
|
}
|
|
24015
24102
|
for (const file of files) {
|
|
24016
24103
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
24017
|
-
const dllPath =
|
|
24104
|
+
const dllPath = join68(debugDir, file);
|
|
24018
24105
|
try {
|
|
24019
24106
|
const fd = openSync5(dllPath, "r+");
|
|
24020
24107
|
closeSync4(fd);
|
|
@@ -24032,13 +24119,13 @@ function findFirstLockedDll(dir) {
|
|
|
24032
24119
|
return null;
|
|
24033
24120
|
}
|
|
24034
24121
|
if (entries.includes("bin")) {
|
|
24035
|
-
const locked = isLockedDll(
|
|
24122
|
+
const locked = isLockedDll(join68(dir, "bin", "Debug"));
|
|
24036
24123
|
if (locked) return locked;
|
|
24037
24124
|
}
|
|
24038
24125
|
for (const entry of entries) {
|
|
24039
24126
|
if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
|
|
24040
24127
|
continue;
|
|
24041
|
-
const found = findFirstLockedDll(
|
|
24128
|
+
const found = findFirstLockedDll(join68(dir, entry));
|
|
24042
24129
|
if (found) return found;
|
|
24043
24130
|
}
|
|
24044
24131
|
return null;
|
|
@@ -24050,14 +24137,14 @@ function checkBuildLocks(startDir) {
|
|
|
24050
24137
|
const locked = findFirstLockedDll(startDir ?? getSearchRoot());
|
|
24051
24138
|
if (locked) {
|
|
24052
24139
|
console.error(
|
|
24053
|
-
|
|
24140
|
+
chalk156.red("Build output locked (is VS debugging?): ") + locked
|
|
24054
24141
|
);
|
|
24055
24142
|
process.exit(1);
|
|
24056
24143
|
}
|
|
24057
24144
|
}
|
|
24058
24145
|
async function checkBuildLocksCommand() {
|
|
24059
24146
|
checkBuildLocks();
|
|
24060
|
-
console.log(
|
|
24147
|
+
console.log(chalk156.green("No build locks detected"));
|
|
24061
24148
|
}
|
|
24062
24149
|
|
|
24063
24150
|
// src/commands/dotnet/buildTree.ts
|
|
@@ -24156,30 +24243,30 @@ function escapeRegex(s) {
|
|
|
24156
24243
|
}
|
|
24157
24244
|
|
|
24158
24245
|
// src/commands/dotnet/printTree.ts
|
|
24159
|
-
import
|
|
24246
|
+
import chalk157 from "chalk";
|
|
24160
24247
|
function printNodes(nodes, prefix2) {
|
|
24161
24248
|
for (let i = 0; i < nodes.length; i++) {
|
|
24162
24249
|
const isLast = i === nodes.length - 1;
|
|
24163
24250
|
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
24164
24251
|
const childPrefix = isLast ? " " : "\u2502 ";
|
|
24165
24252
|
const isMissing = nodes[i].relativePath.startsWith("[MISSING]");
|
|
24166
|
-
const label2 = isMissing ?
|
|
24253
|
+
const label2 = isMissing ? chalk157.red(nodes[i].relativePath) : nodes[i].relativePath;
|
|
24167
24254
|
console.log(`${prefix2}${connector}${label2}`);
|
|
24168
24255
|
printNodes(nodes[i].children, prefix2 + childPrefix);
|
|
24169
24256
|
}
|
|
24170
24257
|
}
|
|
24171
24258
|
function printTree(tree, totalCount, solutions) {
|
|
24172
|
-
console.log(
|
|
24173
|
-
console.log(
|
|
24259
|
+
console.log(chalk157.bold("\nProject Dependency Tree"));
|
|
24260
|
+
console.log(chalk157.cyan(tree.relativePath));
|
|
24174
24261
|
printNodes(tree.children, "");
|
|
24175
|
-
console.log(
|
|
24262
|
+
console.log(chalk157.dim(`
|
|
24176
24263
|
${totalCount} projects total (including root)`));
|
|
24177
|
-
console.log(
|
|
24264
|
+
console.log(chalk157.bold("\nSolution Membership"));
|
|
24178
24265
|
if (solutions.length === 0) {
|
|
24179
|
-
console.log(
|
|
24266
|
+
console.log(chalk157.yellow(" Not found in any .sln"));
|
|
24180
24267
|
} else {
|
|
24181
24268
|
for (const sln of solutions) {
|
|
24182
|
-
console.log(` ${
|
|
24269
|
+
console.log(` ${chalk157.green(sln)}`);
|
|
24183
24270
|
}
|
|
24184
24271
|
}
|
|
24185
24272
|
console.log();
|
|
@@ -24208,16 +24295,16 @@ function printJson(tree, totalCount, solutions) {
|
|
|
24208
24295
|
// src/commands/dotnet/resolveCsproj.ts
|
|
24209
24296
|
import { existsSync as existsSync55 } from "fs";
|
|
24210
24297
|
import path37 from "path";
|
|
24211
|
-
import
|
|
24298
|
+
import chalk158 from "chalk";
|
|
24212
24299
|
function resolveCsproj(csprojPath) {
|
|
24213
24300
|
const resolved = path37.resolve(csprojPath);
|
|
24214
24301
|
if (!existsSync55(resolved)) {
|
|
24215
|
-
console.error(
|
|
24302
|
+
console.error(chalk158.red(`File not found: ${resolved}`));
|
|
24216
24303
|
process.exit(1);
|
|
24217
24304
|
}
|
|
24218
24305
|
const repoRoot2 = findRepoRoot(path37.dirname(resolved));
|
|
24219
24306
|
if (!repoRoot2) {
|
|
24220
|
-
console.error(
|
|
24307
|
+
console.error(chalk158.red("Could not find git repository root"));
|
|
24221
24308
|
process.exit(1);
|
|
24222
24309
|
}
|
|
24223
24310
|
return { resolved, repoRoot: repoRoot2 };
|
|
@@ -24267,12 +24354,12 @@ function getChangedCsFiles(scope) {
|
|
|
24267
24354
|
}
|
|
24268
24355
|
|
|
24269
24356
|
// src/commands/dotnet/inSln.ts
|
|
24270
|
-
import
|
|
24357
|
+
import chalk159 from "chalk";
|
|
24271
24358
|
async function inSln(csprojPath) {
|
|
24272
24359
|
const { resolved, repoRoot: repoRoot2 } = resolveCsproj(csprojPath);
|
|
24273
24360
|
const solutions = findContainingSolutions(resolved, repoRoot2);
|
|
24274
24361
|
if (solutions.length === 0) {
|
|
24275
|
-
console.log(
|
|
24362
|
+
console.log(chalk159.yellow("Not found in any .sln file"));
|
|
24276
24363
|
process.exit(1);
|
|
24277
24364
|
}
|
|
24278
24365
|
for (const sln of solutions) {
|
|
@@ -24281,7 +24368,7 @@ async function inSln(csprojPath) {
|
|
|
24281
24368
|
}
|
|
24282
24369
|
|
|
24283
24370
|
// src/commands/dotnet/inspect.ts
|
|
24284
|
-
import
|
|
24371
|
+
import chalk165 from "chalk";
|
|
24285
24372
|
|
|
24286
24373
|
// src/shared/formatElapsed.ts
|
|
24287
24374
|
function formatElapsed(ms) {
|
|
@@ -24293,12 +24380,12 @@ function formatElapsed(ms) {
|
|
|
24293
24380
|
}
|
|
24294
24381
|
|
|
24295
24382
|
// src/commands/dotnet/displayIssues.ts
|
|
24296
|
-
import
|
|
24383
|
+
import chalk160 from "chalk";
|
|
24297
24384
|
var SEVERITY_COLOR = {
|
|
24298
|
-
ERROR:
|
|
24299
|
-
WARNING:
|
|
24300
|
-
SUGGESTION:
|
|
24301
|
-
HINT:
|
|
24385
|
+
ERROR: chalk160.red,
|
|
24386
|
+
WARNING: chalk160.yellow,
|
|
24387
|
+
SUGGESTION: chalk160.cyan,
|
|
24388
|
+
HINT: chalk160.dim
|
|
24302
24389
|
};
|
|
24303
24390
|
function groupByFile(issues) {
|
|
24304
24391
|
const byFile = /* @__PURE__ */ new Map();
|
|
@@ -24314,15 +24401,15 @@ function groupByFile(issues) {
|
|
|
24314
24401
|
}
|
|
24315
24402
|
function displayIssues(issues) {
|
|
24316
24403
|
for (const [file, fileIssues] of groupByFile(issues)) {
|
|
24317
|
-
console.log(
|
|
24404
|
+
console.log(chalk160.bold(file));
|
|
24318
24405
|
for (const issue of fileIssues.sort((a, b) => a.line - b.line)) {
|
|
24319
|
-
const color = SEVERITY_COLOR[issue.severity] ??
|
|
24406
|
+
const color = SEVERITY_COLOR[issue.severity] ?? chalk160.white;
|
|
24320
24407
|
console.log(
|
|
24321
|
-
` ${
|
|
24408
|
+
` ${chalk160.dim(`${issue.line}:`)} ${color(issue.severity)} [${issue.typeId}] ${issue.message}`
|
|
24322
24409
|
);
|
|
24323
24410
|
}
|
|
24324
24411
|
}
|
|
24325
|
-
console.log(
|
|
24412
|
+
console.log(chalk160.dim(`
|
|
24326
24413
|
${issues.length} issue(s) found`));
|
|
24327
24414
|
}
|
|
24328
24415
|
|
|
@@ -24381,15 +24468,15 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
|
|
|
24381
24468
|
// src/commands/dotnet/resolveSolution.ts
|
|
24382
24469
|
import { existsSync as existsSync56 } from "fs";
|
|
24383
24470
|
import path38 from "path";
|
|
24384
|
-
import
|
|
24471
|
+
import chalk162 from "chalk";
|
|
24385
24472
|
|
|
24386
24473
|
// src/commands/dotnet/findSolution.ts
|
|
24387
24474
|
import { readdirSync as readdirSync11 } from "fs";
|
|
24388
|
-
import { dirname as
|
|
24389
|
-
import
|
|
24475
|
+
import { dirname as dirname30, join as join69 } from "path";
|
|
24476
|
+
import chalk161 from "chalk";
|
|
24390
24477
|
function findSlnInDir(dir) {
|
|
24391
24478
|
try {
|
|
24392
|
-
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) =>
|
|
24479
|
+
return readdirSync11(dir).filter((f) => f.endsWith(".sln")).map((f) => join69(dir, f));
|
|
24393
24480
|
} catch {
|
|
24394
24481
|
return [];
|
|
24395
24482
|
}
|
|
@@ -24402,17 +24489,17 @@ function findSolution() {
|
|
|
24402
24489
|
const slnFiles = findSlnInDir(current);
|
|
24403
24490
|
if (slnFiles.length === 1) return slnFiles[0];
|
|
24404
24491
|
if (slnFiles.length > 1) {
|
|
24405
|
-
console.error(
|
|
24492
|
+
console.error(chalk161.red(`Multiple .sln files found in ${current}:`));
|
|
24406
24493
|
for (const f of slnFiles) console.error(` ${f}`);
|
|
24407
24494
|
console.error(
|
|
24408
|
-
|
|
24495
|
+
chalk161.yellow("Specify which one: assist dotnet inspect <sln>")
|
|
24409
24496
|
);
|
|
24410
24497
|
process.exit(1);
|
|
24411
24498
|
}
|
|
24412
24499
|
if (current === ceiling) break;
|
|
24413
|
-
current =
|
|
24500
|
+
current = dirname30(current);
|
|
24414
24501
|
}
|
|
24415
|
-
console.error(
|
|
24502
|
+
console.error(chalk161.red("No .sln file found between cwd and repo root"));
|
|
24416
24503
|
process.exit(1);
|
|
24417
24504
|
}
|
|
24418
24505
|
|
|
@@ -24421,7 +24508,7 @@ function resolveSolution(sln) {
|
|
|
24421
24508
|
if (sln) {
|
|
24422
24509
|
const resolved = path38.resolve(sln);
|
|
24423
24510
|
if (!existsSync56(resolved)) {
|
|
24424
|
-
console.error(
|
|
24511
|
+
console.error(chalk162.red(`Solution file not found: ${resolved}`));
|
|
24425
24512
|
process.exit(1);
|
|
24426
24513
|
}
|
|
24427
24514
|
return resolved;
|
|
@@ -24463,14 +24550,14 @@ import { execSync as execSync35 } from "child_process";
|
|
|
24463
24550
|
import { existsSync as existsSync57, readFileSync as readFileSync39, unlinkSync as unlinkSync10 } from "fs";
|
|
24464
24551
|
import { tmpdir as tmpdir4 } from "os";
|
|
24465
24552
|
import path39 from "path";
|
|
24466
|
-
import
|
|
24553
|
+
import chalk163 from "chalk";
|
|
24467
24554
|
function assertJbInstalled() {
|
|
24468
24555
|
try {
|
|
24469
24556
|
execSync35("jb inspectcode --version", { stdio: "pipe" });
|
|
24470
24557
|
} catch {
|
|
24471
|
-
console.error(
|
|
24558
|
+
console.error(chalk163.red("jb is not installed. Install with:"));
|
|
24472
24559
|
console.error(
|
|
24473
|
-
|
|
24560
|
+
chalk163.yellow(" dotnet tool install -g JetBrains.ReSharper.GlobalTools")
|
|
24474
24561
|
);
|
|
24475
24562
|
process.exit(1);
|
|
24476
24563
|
}
|
|
@@ -24488,11 +24575,11 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24488
24575
|
if (error && typeof error === "object" && "stderr" in error) {
|
|
24489
24576
|
process.stderr.write(error.stderr);
|
|
24490
24577
|
}
|
|
24491
|
-
console.error(
|
|
24578
|
+
console.error(chalk163.red("jb inspectcode failed"));
|
|
24492
24579
|
process.exit(1);
|
|
24493
24580
|
}
|
|
24494
24581
|
if (!existsSync57(reportPath)) {
|
|
24495
|
-
console.error(
|
|
24582
|
+
console.error(chalk163.red("Report file not generated"));
|
|
24496
24583
|
process.exit(1);
|
|
24497
24584
|
}
|
|
24498
24585
|
const xml = readFileSync39(reportPath, "utf8");
|
|
@@ -24502,7 +24589,7 @@ function runInspectCode(slnPath, include, swea) {
|
|
|
24502
24589
|
|
|
24503
24590
|
// src/commands/dotnet/runRoslynInspect.ts
|
|
24504
24591
|
import { execSync as execSync36 } from "child_process";
|
|
24505
|
-
import
|
|
24592
|
+
import chalk164 from "chalk";
|
|
24506
24593
|
function resolveMsbuildPath() {
|
|
24507
24594
|
const { run: run4 } = loadConfig();
|
|
24508
24595
|
const configs = resolveRunConfigs(run4, runConfigBaseDir());
|
|
@@ -24514,9 +24601,9 @@ function assertMsbuildInstalled() {
|
|
|
24514
24601
|
try {
|
|
24515
24602
|
execSync36(`"${msbuild}" -version`, { stdio: "pipe" });
|
|
24516
24603
|
} catch {
|
|
24517
|
-
console.error(
|
|
24604
|
+
console.error(chalk164.red(`msbuild not found at: ${msbuild}`));
|
|
24518
24605
|
console.error(
|
|
24519
|
-
|
|
24606
|
+
chalk164.yellow(
|
|
24520
24607
|
"Configure it via a 'build' run entry in .claude/assist.yml or add msbuild to PATH."
|
|
24521
24608
|
)
|
|
24522
24609
|
);
|
|
@@ -24563,17 +24650,17 @@ function runEngine(resolved, changedFiles2, options2) {
|
|
|
24563
24650
|
// src/commands/dotnet/inspect.ts
|
|
24564
24651
|
function logScope(changedFiles2) {
|
|
24565
24652
|
if (changedFiles2 === null) {
|
|
24566
|
-
console.log(
|
|
24653
|
+
console.log(chalk165.dim("Inspecting full solution..."));
|
|
24567
24654
|
} else {
|
|
24568
24655
|
console.log(
|
|
24569
|
-
|
|
24656
|
+
chalk165.dim(`Inspecting ${changedFiles2.length} changed file(s)...`)
|
|
24570
24657
|
);
|
|
24571
24658
|
}
|
|
24572
24659
|
}
|
|
24573
24660
|
function reportResults(issues, elapsed) {
|
|
24574
24661
|
if (issues.length > 0) displayIssues(issues);
|
|
24575
|
-
else console.log(
|
|
24576
|
-
console.log(
|
|
24662
|
+
else console.log(chalk165.green("No issues found"));
|
|
24663
|
+
console.log(chalk165.dim(`Completed in ${formatElapsed(elapsed)}`));
|
|
24577
24664
|
if (issues.length > 0) process.exit(1);
|
|
24578
24665
|
}
|
|
24579
24666
|
async function inspect(sln, options2) {
|
|
@@ -24584,7 +24671,7 @@ async function inspect(sln, options2) {
|
|
|
24584
24671
|
const scope = parseScope(options2.scope);
|
|
24585
24672
|
const changedFiles2 = getChangedCsFiles(scope);
|
|
24586
24673
|
if (changedFiles2 !== null && changedFiles2.length === 0) {
|
|
24587
|
-
console.log(
|
|
24674
|
+
console.log(chalk165.green("No changed .cs files found"));
|
|
24588
24675
|
return;
|
|
24589
24676
|
}
|
|
24590
24677
|
logScope(changedFiles2);
|
|
@@ -25385,9 +25472,9 @@ function aggregateCommitters(authorLists) {
|
|
|
25385
25472
|
|
|
25386
25473
|
// src/shared/runGhGraphql.ts
|
|
25387
25474
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
25388
|
-
import { unlinkSync as unlinkSync12, writeFileSync as
|
|
25475
|
+
import { unlinkSync as unlinkSync12, writeFileSync as writeFileSync32 } from "fs";
|
|
25389
25476
|
import { tmpdir as tmpdir5 } from "os";
|
|
25390
|
-
import { join as
|
|
25477
|
+
import { join as join70 } from "path";
|
|
25391
25478
|
function buildArgs2(queryFile, vars) {
|
|
25392
25479
|
const args = ["api", "graphql", "-F", `query=@${queryFile}`];
|
|
25393
25480
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -25397,8 +25484,8 @@ function buildArgs2(queryFile, vars) {
|
|
|
25397
25484
|
return args;
|
|
25398
25485
|
}
|
|
25399
25486
|
function runGhGraphql(mutation, vars) {
|
|
25400
|
-
const queryFile =
|
|
25401
|
-
|
|
25487
|
+
const queryFile = join70(tmpdir5(), `gh-query-${Date.now()}.graphql`);
|
|
25488
|
+
writeFileSync32(queryFile, mutation);
|
|
25402
25489
|
try {
|
|
25403
25490
|
const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
|
|
25404
25491
|
encoding: "utf8",
|
|
@@ -25462,25 +25549,25 @@ function fetchRepoCommitAuthors(org, repo, since) {
|
|
|
25462
25549
|
}
|
|
25463
25550
|
|
|
25464
25551
|
// src/commands/github/printCountTable.ts
|
|
25465
|
-
import
|
|
25552
|
+
import chalk166 from "chalk";
|
|
25466
25553
|
function printCountTable(labelHeader, rows) {
|
|
25467
25554
|
const labelWidth = Math.max(
|
|
25468
25555
|
labelHeader.length,
|
|
25469
25556
|
...rows.map((row3) => row3.label.length)
|
|
25470
25557
|
);
|
|
25471
25558
|
const header = `${labelHeader.padEnd(labelWidth)} Commits`;
|
|
25472
|
-
console.log(
|
|
25473
|
-
console.log(
|
|
25559
|
+
console.log(chalk166.dim(header));
|
|
25560
|
+
console.log(chalk166.dim("-".repeat(header.length)));
|
|
25474
25561
|
for (const row3 of rows) {
|
|
25475
25562
|
console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
|
|
25476
25563
|
}
|
|
25477
25564
|
}
|
|
25478
25565
|
|
|
25479
25566
|
// src/commands/github/printRepoAuthorBreakdown.ts
|
|
25480
|
-
import
|
|
25567
|
+
import chalk167 from "chalk";
|
|
25481
25568
|
function printRepoAuthorBreakdown(repos2) {
|
|
25482
25569
|
for (const repo of repos2) {
|
|
25483
|
-
console.log(
|
|
25570
|
+
console.log(chalk167.bold(repo.name));
|
|
25484
25571
|
const authorWidth = Math.max(
|
|
25485
25572
|
0,
|
|
25486
25573
|
...repo.authors.map((a) => a.author.length)
|
|
@@ -25563,10 +25650,10 @@ function parseTopCount(value) {
|
|
|
25563
25650
|
}
|
|
25564
25651
|
|
|
25565
25652
|
// src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
|
|
25566
|
-
import
|
|
25653
|
+
import chalk169 from "chalk";
|
|
25567
25654
|
|
|
25568
25655
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25569
|
-
import
|
|
25656
|
+
import chalk168 from "chalk";
|
|
25570
25657
|
|
|
25571
25658
|
// src/commands/github/issue/fixStructure/removeIssueLabels.ts
|
|
25572
25659
|
var MUTATION2 = `mutation($labelableId: ID!, $labelIds: [ID!]!) {
|
|
@@ -25603,7 +25690,7 @@ function writeLineNow(line) {
|
|
|
25603
25690
|
// src/commands/github/issue/fixStructure/applyFixStructurePlan.ts
|
|
25604
25691
|
function applyFixStructurePlan(plan2) {
|
|
25605
25692
|
for (const entry of plan2.entries) {
|
|
25606
|
-
const where =
|
|
25693
|
+
const where = chalk168.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25607
25694
|
const { typeChange, labelRemovals } = entry;
|
|
25608
25695
|
if (typeChange) {
|
|
25609
25696
|
writeLineNow(
|
|
@@ -25873,12 +25960,12 @@ function planSubtree(root2, context) {
|
|
|
25873
25960
|
function applyAndVerifySubtree(target, plan2, context) {
|
|
25874
25961
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) return;
|
|
25875
25962
|
applyFixStructurePlan(plan2);
|
|
25876
|
-
writeLineNow(
|
|
25963
|
+
writeLineNow(chalk169.dim("Re-walking the subtree to confirm"));
|
|
25877
25964
|
assertNoResidualDrift(
|
|
25878
25965
|
planSubtree(fetchRootIssue(target), context),
|
|
25879
25966
|
context.chain
|
|
25880
25967
|
);
|
|
25881
|
-
writeLineNow(
|
|
25968
|
+
writeLineNow(chalk169.green("Subtree normalised"));
|
|
25882
25969
|
}
|
|
25883
25970
|
|
|
25884
25971
|
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
@@ -25914,22 +26001,22 @@ function parseTypeChain(value) {
|
|
|
25914
26001
|
}
|
|
25915
26002
|
|
|
25916
26003
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
25917
|
-
import
|
|
26004
|
+
import chalk170 from "chalk";
|
|
25918
26005
|
function annotate(entry) {
|
|
25919
26006
|
const notes = [];
|
|
25920
26007
|
if (entry.level === null) {
|
|
25921
|
-
notes.push(
|
|
26008
|
+
notes.push(chalk170.red("deeper than the leaf level"));
|
|
25922
26009
|
} else if (entry.typeChange) {
|
|
25923
26010
|
notes.push(
|
|
25924
|
-
|
|
26011
|
+
chalk170.yellow(
|
|
25925
26012
|
`${entry.typeChange.from ?? "no type"} -> ${entry.typeChange.to}`
|
|
25926
26013
|
)
|
|
25927
26014
|
);
|
|
25928
26015
|
} else {
|
|
25929
|
-
notes.push(
|
|
26016
|
+
notes.push(chalk170.dim(entry.issue.typeName ?? "no type"));
|
|
25930
26017
|
}
|
|
25931
26018
|
for (const label2 of entry.labelRemovals) {
|
|
25932
|
-
notes.push(
|
|
26019
|
+
notes.push(chalk170.yellow(`-${label2.name}`));
|
|
25933
26020
|
}
|
|
25934
26021
|
return notes;
|
|
25935
26022
|
}
|
|
@@ -25937,22 +26024,22 @@ function formatCount(count10, noun) {
|
|
|
25937
26024
|
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
25938
26025
|
}
|
|
25939
26026
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
25940
|
-
writeLineNow(
|
|
26027
|
+
writeLineNow(chalk170.dim(`chain: ${chain2.join(" > ")}`));
|
|
25941
26028
|
for (const entry of plan2.entries) {
|
|
25942
26029
|
const indent3 = " ".repeat(entry.issue.depth);
|
|
25943
|
-
const name =
|
|
26030
|
+
const name = chalk170.cyan(`${entry.issue.repo}#${entry.issue.number}`);
|
|
25944
26031
|
writeLineNow(
|
|
25945
26032
|
`${indent3}${name} ${entry.issue.title} [${annotate(entry).join(", ")}]`
|
|
25946
26033
|
);
|
|
25947
26034
|
}
|
|
25948
26035
|
if (plan2.typeChangeCount === 0 && plan2.labelRemovalCount === 0) {
|
|
25949
|
-
writeLineNow(
|
|
26036
|
+
writeLineNow(chalk170.green("Nothing to change"));
|
|
25950
26037
|
return;
|
|
25951
26038
|
}
|
|
25952
26039
|
writeLineNow(
|
|
25953
26040
|
`${formatCount(plan2.typeChangeCount, "type change")}, ${formatCount(plan2.labelRemovalCount, "label removal")} planned`
|
|
25954
26041
|
);
|
|
25955
|
-
if (!apply) writeLineNow(
|
|
26042
|
+
if (!apply) writeLineNow(chalk170.dim("Dry run \u2014 nothing written"));
|
|
25956
26043
|
}
|
|
25957
26044
|
|
|
25958
26045
|
// src/commands/github/issue/parseRepoSlug.ts
|
|
@@ -26688,10 +26775,10 @@ import { basename as basename17 } from "path";
|
|
|
26688
26775
|
|
|
26689
26776
|
// src/shared/removeStagedAttachments.ts
|
|
26690
26777
|
import { rmSync as rmSync5 } from "fs";
|
|
26691
|
-
import { dirname as
|
|
26778
|
+
import { dirname as dirname31 } from "path";
|
|
26692
26779
|
function removeStagedAttachments(attachments) {
|
|
26693
26780
|
for (const { path: path108 } of attachments) {
|
|
26694
|
-
const dir =
|
|
26781
|
+
const dir = dirname31(path108);
|
|
26695
26782
|
if (!isStagedAttachmentPath(dir)) continue;
|
|
26696
26783
|
rmSync5(dir, { recursive: true, force: true });
|
|
26697
26784
|
}
|
|
@@ -26859,26 +26946,26 @@ function slugFromUrl(url) {
|
|
|
26859
26946
|
}
|
|
26860
26947
|
|
|
26861
26948
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
26862
|
-
import { mkdirSync as
|
|
26949
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
|
|
26863
26950
|
|
|
26864
26951
|
// src/commands/github/issue/issueWorkingFile.ts
|
|
26865
|
-
import { join as
|
|
26952
|
+
import { join as join71 } from "path";
|
|
26866
26953
|
function issueWorkingFile(slug2, number) {
|
|
26867
26954
|
const [owner = "unknown", repo = "unknown"] = slug2.split("/");
|
|
26868
|
-
const dir =
|
|
26955
|
+
const dir = join71(getStoreDir(), "github-issues", owner, repo);
|
|
26869
26956
|
return {
|
|
26870
26957
|
dir,
|
|
26871
|
-
bodyPath:
|
|
26872
|
-
metaPath:
|
|
26958
|
+
bodyPath: join71(dir, `${number}.md`),
|
|
26959
|
+
metaPath: join71(dir, `${number}.json`)
|
|
26873
26960
|
};
|
|
26874
26961
|
}
|
|
26875
26962
|
|
|
26876
26963
|
// src/commands/github/issue/writeIssueWorkingFile.ts
|
|
26877
26964
|
function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
|
|
26878
26965
|
const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26966
|
+
mkdirSync19(dir, { recursive: true });
|
|
26967
|
+
writeFileSync33(bodyPath, body);
|
|
26968
|
+
writeFileSync33(
|
|
26882
26969
|
metaPath,
|
|
26883
26970
|
`${JSON.stringify({ target, updatedAt }, null, 2)}
|
|
26884
26971
|
`
|
|
@@ -27314,7 +27401,7 @@ function registerGithub(program) {
|
|
|
27314
27401
|
}
|
|
27315
27402
|
|
|
27316
27403
|
// src/commands/jira/acceptanceCriteria.ts
|
|
27317
|
-
import
|
|
27404
|
+
import chalk171 from "chalk";
|
|
27318
27405
|
|
|
27319
27406
|
// src/commands/jira/adfToText.ts
|
|
27320
27407
|
function renderInline(node) {
|
|
@@ -27381,7 +27468,7 @@ function acceptanceCriteria(issueKey) {
|
|
|
27381
27468
|
const parsed = fetchIssue(issueKey, field);
|
|
27382
27469
|
const acValue = parsed?.fields?.[field];
|
|
27383
27470
|
if (!acValue) {
|
|
27384
|
-
console.log(
|
|
27471
|
+
console.log(chalk171.yellow(`No acceptance criteria found on ${issueKey}.`));
|
|
27385
27472
|
return;
|
|
27386
27473
|
}
|
|
27387
27474
|
if (typeof acValue === "string") {
|
|
@@ -27447,14 +27534,14 @@ async function jiraAuth() {
|
|
|
27447
27534
|
}
|
|
27448
27535
|
|
|
27449
27536
|
// src/commands/jira/viewIssue.ts
|
|
27450
|
-
import
|
|
27537
|
+
import chalk172 from "chalk";
|
|
27451
27538
|
function viewIssue2(issueKey) {
|
|
27452
27539
|
const parsed = fetchIssue(issueKey, "summary,description");
|
|
27453
27540
|
const fields = parsed?.fields;
|
|
27454
27541
|
const summary = fields?.summary;
|
|
27455
27542
|
const description = fields?.description;
|
|
27456
27543
|
if (summary) {
|
|
27457
|
-
console.log(
|
|
27544
|
+
console.log(chalk172.bold(summary));
|
|
27458
27545
|
}
|
|
27459
27546
|
if (description) {
|
|
27460
27547
|
if (summary) console.log();
|
|
@@ -27468,7 +27555,7 @@ function viewIssue2(issueKey) {
|
|
|
27468
27555
|
}
|
|
27469
27556
|
if (!summary && !description) {
|
|
27470
27557
|
console.log(
|
|
27471
|
-
|
|
27558
|
+
chalk172.yellow(`No summary or description found on ${issueKey}.`)
|
|
27472
27559
|
);
|
|
27473
27560
|
}
|
|
27474
27561
|
}
|
|
@@ -27559,7 +27646,7 @@ function recentDaemonLogLines(includeRelayed = true) {
|
|
|
27559
27646
|
|
|
27560
27647
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27561
27648
|
import { existsSync as existsSync60 } from "fs";
|
|
27562
|
-
import { basename as basename19, dirname as
|
|
27649
|
+
import { basename as basename19, dirname as dirname32 } from "path";
|
|
27563
27650
|
|
|
27564
27651
|
// src/commands/watch/fetchQuietly.ts
|
|
27565
27652
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
@@ -27578,11 +27665,11 @@ function fetchQuietly(cwd, intervalMs) {
|
|
|
27578
27665
|
}
|
|
27579
27666
|
|
|
27580
27667
|
// src/commands/sessions/daemon/worktree/nextWorktreePath.ts
|
|
27581
|
-
import { basename as basename18, join as
|
|
27668
|
+
import { basename as basename18, join as join72 } from "path";
|
|
27582
27669
|
function nextWorktreePath(clone, base, isTaken) {
|
|
27583
27670
|
const name = basename18(clone);
|
|
27584
27671
|
for (let n = 2; n < 1e3; n++) {
|
|
27585
|
-
const candidate =
|
|
27672
|
+
const candidate = join72(base, `${name}-${n}`);
|
|
27586
27673
|
if (!isTaken(candidate)) return candidate;
|
|
27587
27674
|
}
|
|
27588
27675
|
throw new Error(`no free worktree suffix for ${clone}`);
|
|
@@ -27602,7 +27689,7 @@ function cloneTrunkBranch(clone) {
|
|
|
27602
27689
|
|
|
27603
27690
|
// src/commands/sessions/daemon/worktree/createWorktree.ts
|
|
27604
27691
|
function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
|
|
27605
|
-
const base = strategy.root ? expandTilde(strategy.root) :
|
|
27692
|
+
const base = strategy.root ? expandTilde(strategy.root) : dirname32(clone);
|
|
27606
27693
|
const registered = new Set(listWorktreePaths(clone));
|
|
27607
27694
|
const branches = new Set(listLocalBranches(clone));
|
|
27608
27695
|
const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename19(candidate));
|
|
@@ -27834,21 +27921,21 @@ function persistedTreeRoots() {
|
|
|
27834
27921
|
}
|
|
27835
27922
|
|
|
27836
27923
|
// src/commands/sessions/daemon/worktree/seedWorktree.ts
|
|
27837
|
-
import { copyFileSync, existsSync as existsSync62, mkdirSync as
|
|
27838
|
-
import { dirname as
|
|
27924
|
+
import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync20 } from "fs";
|
|
27925
|
+
import { dirname as dirname33, join as join74 } from "path";
|
|
27839
27926
|
|
|
27840
27927
|
// src/commands/sessions/daemon/worktree/runInstall.ts
|
|
27841
27928
|
import { resolve as resolve18 } from "path";
|
|
27842
27929
|
|
|
27843
27930
|
// src/commands/sessions/daemon/worktree/detectInstallCommand.ts
|
|
27844
27931
|
import { existsSync as existsSync61 } from "fs";
|
|
27845
|
-
import { join as
|
|
27932
|
+
import { join as join73 } from "path";
|
|
27846
27933
|
function detectInstallCommand(dir) {
|
|
27847
|
-
if (!existsSync61(
|
|
27848
|
-
if (existsSync61(
|
|
27849
|
-
if (existsSync61(
|
|
27850
|
-
if (existsSync61(
|
|
27851
|
-
if (existsSync61(
|
|
27934
|
+
if (!existsSync61(join73(dir, "package.json"))) return null;
|
|
27935
|
+
if (existsSync61(join73(dir, "pnpm-lock.yaml"))) return "pnpm install";
|
|
27936
|
+
if (existsSync61(join73(dir, "yarn.lock"))) return "yarn install";
|
|
27937
|
+
if (existsSync61(join73(dir, "bun.lockb"))) return "bun install";
|
|
27938
|
+
if (existsSync61(join73(dir, "package-lock.json"))) return "npm ci";
|
|
27852
27939
|
return "npm install";
|
|
27853
27940
|
}
|
|
27854
27941
|
|
|
@@ -28013,11 +28100,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
|
|
|
28013
28100
|
}
|
|
28014
28101
|
function copyConfigFiles(worktreePath, clone, copy) {
|
|
28015
28102
|
for (const rel of copy) {
|
|
28016
|
-
const src =
|
|
28103
|
+
const src = join74(clone, rel);
|
|
28017
28104
|
if (!existsSync62(src)) continue;
|
|
28018
|
-
const dest =
|
|
28105
|
+
const dest = join74(worktreePath, rel);
|
|
28019
28106
|
try {
|
|
28020
|
-
|
|
28107
|
+
mkdirSync20(dirname33(dest), { recursive: true });
|
|
28021
28108
|
copyFileSync(src, dest);
|
|
28022
28109
|
daemonLog(`worktree ${worktreePath} seeded ${rel}`);
|
|
28023
28110
|
} catch (error) {
|
|
@@ -28180,7 +28267,7 @@ function worktreeHoldingBranch(cwd, branch2) {
|
|
|
28180
28267
|
}
|
|
28181
28268
|
|
|
28182
28269
|
// src/commands/review/failCheckout.ts
|
|
28183
|
-
import
|
|
28270
|
+
import chalk173 from "chalk";
|
|
28184
28271
|
|
|
28185
28272
|
// src/commands/review/azCliProblem.ts
|
|
28186
28273
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
@@ -28233,14 +28320,14 @@ function failCheckout(number, headRef, stale, from, checkout) {
|
|
|
28233
28320
|
gitSyncOrNull(process.cwd(), ["checkout", "--quiet", from]);
|
|
28234
28321
|
if (headRef && stale === "local-work")
|
|
28235
28322
|
console.error(
|
|
28236
|
-
|
|
28323
|
+
chalk173.red(
|
|
28237
28324
|
`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.`
|
|
28238
28325
|
)
|
|
28239
28326
|
);
|
|
28240
28327
|
const problem = checkout.file === "az" ? azCliProblem() : null;
|
|
28241
|
-
if (problem) console.error(
|
|
28328
|
+
if (problem) console.error(chalk173.red(problem));
|
|
28242
28329
|
console.error(
|
|
28243
|
-
|
|
28330
|
+
chalk173.red(`${checkout.file} ${checkout.args.join(" ")} failed; aborting.`)
|
|
28244
28331
|
);
|
|
28245
28332
|
process.exit(1);
|
|
28246
28333
|
}
|
|
@@ -28433,18 +28520,18 @@ function registerList(program) {
|
|
|
28433
28520
|
}
|
|
28434
28521
|
|
|
28435
28522
|
// src/commands/litellm/listModels.ts
|
|
28436
|
-
import
|
|
28523
|
+
import chalk175 from "chalk";
|
|
28437
28524
|
|
|
28438
28525
|
// src/commands/litellm/resolveLitellmConfig.ts
|
|
28439
|
-
import
|
|
28526
|
+
import chalk174 from "chalk";
|
|
28440
28527
|
function resolveLitellmConfig() {
|
|
28441
28528
|
const { config, missing } = readLitellmConfig();
|
|
28442
28529
|
if (!config) {
|
|
28443
|
-
console.error(
|
|
28530
|
+
console.error(chalk174.red("LiteLLM is not configured"));
|
|
28444
28531
|
for (const key of missing) {
|
|
28445
28532
|
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
28446
28533
|
console.error(
|
|
28447
|
-
|
|
28534
|
+
chalk174.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
28448
28535
|
);
|
|
28449
28536
|
}
|
|
28450
28537
|
process.exit(1);
|
|
@@ -28470,13 +28557,13 @@ async function listModels(options2) {
|
|
|
28470
28557
|
} catch (error) {
|
|
28471
28558
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
28472
28559
|
console.error(
|
|
28473
|
-
|
|
28560
|
+
chalk175.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
28474
28561
|
);
|
|
28475
28562
|
process.exit(1);
|
|
28476
28563
|
}
|
|
28477
28564
|
const body = await response.text();
|
|
28478
28565
|
if (!response.ok) {
|
|
28479
|
-
console.error(
|
|
28566
|
+
console.error(chalk175.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
28480
28567
|
process.exit(1);
|
|
28481
28568
|
}
|
|
28482
28569
|
if (options2.json) {
|
|
@@ -28494,17 +28581,17 @@ function registerLitellm(program) {
|
|
|
28494
28581
|
}
|
|
28495
28582
|
|
|
28496
28583
|
// src/commands/mermaidExport.ts
|
|
28497
|
-
import { mkdirSync as
|
|
28584
|
+
import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
|
|
28498
28585
|
import { resolve as resolve20 } from "path";
|
|
28499
|
-
import
|
|
28586
|
+
import chalk178 from "chalk";
|
|
28500
28587
|
|
|
28501
28588
|
// src/commands/mermaid/exportFile.ts
|
|
28502
|
-
import { readFileSync as readFileSync41, writeFileSync as
|
|
28589
|
+
import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "fs";
|
|
28503
28590
|
import { basename as basename20, extname as extname4, resolve as resolve19 } from "path";
|
|
28504
|
-
import
|
|
28591
|
+
import chalk177 from "chalk";
|
|
28505
28592
|
|
|
28506
28593
|
// src/commands/mermaid/renderBlock.ts
|
|
28507
|
-
import
|
|
28594
|
+
import chalk176 from "chalk";
|
|
28508
28595
|
async function renderBlock(krokiUrl, source) {
|
|
28509
28596
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
28510
28597
|
method: "POST",
|
|
@@ -28513,7 +28600,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
28513
28600
|
});
|
|
28514
28601
|
if (!response.ok) {
|
|
28515
28602
|
console.error(
|
|
28516
|
-
|
|
28603
|
+
chalk176.red(
|
|
28517
28604
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
28518
28605
|
)
|
|
28519
28606
|
);
|
|
@@ -28531,27 +28618,27 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
28531
28618
|
if (onlyIndex !== void 0) {
|
|
28532
28619
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
28533
28620
|
console.error(
|
|
28534
|
-
|
|
28621
|
+
chalk177.red(
|
|
28535
28622
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
28536
28623
|
)
|
|
28537
28624
|
);
|
|
28538
28625
|
process.exit(1);
|
|
28539
28626
|
}
|
|
28540
28627
|
console.log(
|
|
28541
|
-
|
|
28628
|
+
chalk177.gray(
|
|
28542
28629
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
28543
28630
|
)
|
|
28544
28631
|
);
|
|
28545
28632
|
} else {
|
|
28546
|
-
console.log(
|
|
28633
|
+
console.log(chalk177.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
28547
28634
|
}
|
|
28548
28635
|
for (const [i, source] of blocks.entries()) {
|
|
28549
28636
|
const idx = i + 1;
|
|
28550
28637
|
if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
|
|
28551
28638
|
const outPath = resolve19(outDir, `${stem}-${idx}.svg`);
|
|
28552
28639
|
const svg = await renderBlock(krokiUrl, source);
|
|
28553
|
-
|
|
28554
|
-
console.log(
|
|
28640
|
+
writeFileSync34(outPath, svg, "utf8");
|
|
28641
|
+
console.log(chalk177.green(` \u2192 ${outPath}`));
|
|
28555
28642
|
}
|
|
28556
28643
|
}
|
|
28557
28644
|
function extractMermaidBlocks(markdown) {
|
|
@@ -28563,22 +28650,22 @@ function extractMermaidBlocks(markdown) {
|
|
|
28563
28650
|
async function mermaidExport(file, options2 = {}) {
|
|
28564
28651
|
const { mermaid } = loadConfig();
|
|
28565
28652
|
const outDir = resolve20(process.cwd(), options2.out ?? ".");
|
|
28566
|
-
|
|
28653
|
+
mkdirSync21(outDir, { recursive: true });
|
|
28567
28654
|
if (options2.index !== void 0) {
|
|
28568
28655
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
28569
28656
|
console.error(
|
|
28570
|
-
|
|
28657
|
+
chalk178.red(`--index must be a positive integer (got ${options2.index})`)
|
|
28571
28658
|
);
|
|
28572
28659
|
process.exit(1);
|
|
28573
28660
|
}
|
|
28574
28661
|
if (!file) {
|
|
28575
|
-
console.error(
|
|
28662
|
+
console.error(chalk178.red("--index requires a file argument"));
|
|
28576
28663
|
process.exit(1);
|
|
28577
28664
|
}
|
|
28578
28665
|
}
|
|
28579
28666
|
const files = file ? [file] : readdirSync12(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
28580
28667
|
if (files.length === 0) {
|
|
28581
|
-
console.log(
|
|
28668
|
+
console.log(chalk178.gray("No markdown files found in current directory."));
|
|
28582
28669
|
return;
|
|
28583
28670
|
}
|
|
28584
28671
|
for (const f of files) {
|
|
@@ -28658,8 +28745,8 @@ function boardSource(raw, anchorId, options2) {
|
|
|
28658
28745
|
import { stringify as stringify2 } from "yaml";
|
|
28659
28746
|
|
|
28660
28747
|
// src/commands/miro/writeExtract.ts
|
|
28661
|
-
import { mkdirSync as
|
|
28662
|
-
import { dirname as
|
|
28748
|
+
import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync35 } from "fs";
|
|
28749
|
+
import { dirname as dirname34 } from "path";
|
|
28663
28750
|
import { stringify } from "yaml";
|
|
28664
28751
|
function headerLines(header) {
|
|
28665
28752
|
const { rect } = header;
|
|
@@ -28672,8 +28759,8 @@ function headerLines(header) {
|
|
|
28672
28759
|
];
|
|
28673
28760
|
}
|
|
28674
28761
|
function writeExtract(file, header, texts) {
|
|
28675
|
-
|
|
28676
|
-
|
|
28762
|
+
mkdirSync22(dirname34(file), { recursive: true });
|
|
28763
|
+
writeFileSync35(file, `${headerLines(header).join("\n")}
|
|
28677
28764
|
${stringify(texts)}`);
|
|
28678
28765
|
}
|
|
28679
28766
|
|
|
@@ -28724,7 +28811,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
28724
28811
|
}
|
|
28725
28812
|
|
|
28726
28813
|
// src/commands/miro/keptTexts.ts
|
|
28727
|
-
import
|
|
28814
|
+
import chalk179 from "chalk";
|
|
28728
28815
|
|
|
28729
28816
|
// src/commands/miro/applyIgnore.ts
|
|
28730
28817
|
function applyIgnore(texts, ignore3) {
|
|
@@ -28763,7 +28850,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
28763
28850
|
if (unmatched.length === 0) return;
|
|
28764
28851
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
28765
28852
|
console.error(
|
|
28766
|
-
|
|
28853
|
+
chalk179.yellow(
|
|
28767
28854
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
28768
28855
|
${entries}`
|
|
28769
28856
|
)
|
|
@@ -28964,7 +29051,7 @@ function readMiroItems(file) {
|
|
|
28964
29051
|
}
|
|
28965
29052
|
|
|
28966
29053
|
// src/commands/miro/resolveExtractOptions.ts
|
|
28967
|
-
import
|
|
29054
|
+
import chalk180 from "chalk";
|
|
28968
29055
|
|
|
28969
29056
|
// src/commands/miro/extractLayers.ts
|
|
28970
29057
|
function extractsIn(layer) {
|
|
@@ -29042,7 +29129,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
29042
29129
|
paths.cwd,
|
|
29043
29130
|
paths.globalConfigPath
|
|
29044
29131
|
);
|
|
29045
|
-
console.error(
|
|
29132
|
+
console.error(chalk180.dim(`Extract "${name}" from ${resolved.from}`));
|
|
29046
29133
|
return resolved.options;
|
|
29047
29134
|
}
|
|
29048
29135
|
|
|
@@ -29143,8 +29230,8 @@ function registerMiro(program) {
|
|
|
29143
29230
|
// src/commands/netcap/netcap.ts
|
|
29144
29231
|
import { mkdir as mkdir6 } from "fs/promises";
|
|
29145
29232
|
import { createServer as createServer2 } from "http";
|
|
29146
|
-
import { dirname as
|
|
29147
|
-
import
|
|
29233
|
+
import { dirname as dirname36 } from "path";
|
|
29234
|
+
import chalk182 from "chalk";
|
|
29148
29235
|
|
|
29149
29236
|
// src/commands/netcap/corsHeaders.ts
|
|
29150
29237
|
var corsHeaders = {
|
|
@@ -29222,15 +29309,15 @@ function createNetcapHandler(options2) {
|
|
|
29222
29309
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
29223
29310
|
import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
|
|
29224
29311
|
import { networkInterfaces } from "os";
|
|
29225
|
-
import { join as
|
|
29226
|
-
import
|
|
29312
|
+
import { join as join76 } from "path";
|
|
29313
|
+
import chalk181 from "chalk";
|
|
29227
29314
|
|
|
29228
29315
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
29229
|
-
import { dirname as
|
|
29316
|
+
import { dirname as dirname35, join as join75 } from "path";
|
|
29230
29317
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
29231
|
-
var moduleDir2 =
|
|
29318
|
+
var moduleDir2 = dirname35(fileURLToPath7(import.meta.url));
|
|
29232
29319
|
function netcapExtensionDir() {
|
|
29233
|
-
return
|
|
29320
|
+
return join75(moduleDir2, "commands", "netcap", "netcap-extension");
|
|
29234
29321
|
}
|
|
29235
29322
|
|
|
29236
29323
|
// src/commands/netcap/prepareExtensionForLoad.ts
|
|
@@ -29245,7 +29332,7 @@ function lanIPv4() {
|
|
|
29245
29332
|
return void 0;
|
|
29246
29333
|
}
|
|
29247
29334
|
async function configureBackground(dir, host, port, filter) {
|
|
29248
|
-
const file =
|
|
29335
|
+
const file = join76(dir, "background.js");
|
|
29249
29336
|
const source = await readFile7(file, "utf8");
|
|
29250
29337
|
await writeFile6(
|
|
29251
29338
|
file,
|
|
@@ -29267,7 +29354,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29267
29354
|
const host = lanIPv4();
|
|
29268
29355
|
if (!host) {
|
|
29269
29356
|
console.log(
|
|
29270
|
-
|
|
29357
|
+
chalk181.yellow("could not determine the WSL IP for the extension")
|
|
29271
29358
|
);
|
|
29272
29359
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
29273
29360
|
return source;
|
|
@@ -29278,27 +29365,27 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
29278
29365
|
return WSL_WINDOWS_PATH3;
|
|
29279
29366
|
} catch {
|
|
29280
29367
|
console.log(
|
|
29281
|
-
|
|
29368
|
+
chalk181.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
29282
29369
|
);
|
|
29283
29370
|
return source;
|
|
29284
29371
|
}
|
|
29285
29372
|
}
|
|
29286
29373
|
|
|
29287
29374
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
29288
|
-
import { isAbsolute as isAbsolute5, join as
|
|
29375
|
+
import { isAbsolute as isAbsolute5, join as join78, resolve as resolve22 } from "path";
|
|
29289
29376
|
|
|
29290
29377
|
// src/commands/netcap/defaultCapturePath.ts
|
|
29291
|
-
import { homedir as
|
|
29292
|
-
import { join as
|
|
29378
|
+
import { homedir as homedir24 } from "os";
|
|
29379
|
+
import { join as join77 } from "path";
|
|
29293
29380
|
function defaultCapturePath() {
|
|
29294
|
-
return
|
|
29381
|
+
return join77(homedir24(), ".assist", "netcap", "capture.jsonl");
|
|
29295
29382
|
}
|
|
29296
29383
|
|
|
29297
29384
|
// src/commands/netcap/resolveNetcapOutPath.ts
|
|
29298
29385
|
function resolveNetcapOutPath(out) {
|
|
29299
29386
|
if (!out) return defaultCapturePath();
|
|
29300
29387
|
const dir = isAbsolute5(out) ? out : resolve22(process.cwd(), out);
|
|
29301
|
-
return
|
|
29388
|
+
return join78(dir, "capture.jsonl");
|
|
29302
29389
|
}
|
|
29303
29390
|
|
|
29304
29391
|
// src/commands/netcap/netcap.ts
|
|
@@ -29306,35 +29393,35 @@ async function netcap(options2) {
|
|
|
29306
29393
|
const port = Number(options2.port);
|
|
29307
29394
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
29308
29395
|
const filter = options2.filter ?? "";
|
|
29309
|
-
await mkdir6(
|
|
29396
|
+
await mkdir6(dirname36(outPath), { recursive: true });
|
|
29310
29397
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
29311
29398
|
let count10 = 0;
|
|
29312
29399
|
const handler = createNetcapHandler({
|
|
29313
29400
|
outPath,
|
|
29314
|
-
onPing: () => console.log(
|
|
29401
|
+
onPing: () => console.log(chalk182.dim("ping from extension")),
|
|
29315
29402
|
onCapture: (entry) => {
|
|
29316
29403
|
count10 += 1;
|
|
29317
29404
|
console.log(
|
|
29318
|
-
|
|
29319
|
-
|
|
29405
|
+
chalk182.green(`captured #${count10}`),
|
|
29406
|
+
chalk182.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
29320
29407
|
);
|
|
29321
29408
|
}
|
|
29322
29409
|
});
|
|
29323
29410
|
const server = createServer2(handler);
|
|
29324
29411
|
server.listen(port, () => {
|
|
29325
29412
|
console.log(
|
|
29326
|
-
|
|
29413
|
+
chalk182.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
29327
29414
|
);
|
|
29328
|
-
console.log(
|
|
29415
|
+
console.log(chalk182.dim(`appending captures to ${outPath}`));
|
|
29329
29416
|
if (filter)
|
|
29330
|
-
console.log(
|
|
29331
|
-
console.log(
|
|
29332
|
-
console.log(
|
|
29417
|
+
console.log(chalk182.dim(`forwarding only URLs matching "${filter}"`));
|
|
29418
|
+
console.log(chalk182.dim(`load the unpacked extension from ${extensionPath}`));
|
|
29419
|
+
console.log(chalk182.dim("press Ctrl-C to stop"));
|
|
29333
29420
|
});
|
|
29334
29421
|
process.on("SIGINT", () => {
|
|
29335
29422
|
server.close();
|
|
29336
29423
|
console.log(
|
|
29337
|
-
|
|
29424
|
+
chalk182.bold(
|
|
29338
29425
|
`
|
|
29339
29426
|
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
29340
29427
|
)
|
|
@@ -29344,9 +29431,9 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
|
|
|
29344
29431
|
}
|
|
29345
29432
|
|
|
29346
29433
|
// src/commands/netcap/netcapExtract.ts
|
|
29347
|
-
import { writeFileSync as
|
|
29348
|
-
import { join as
|
|
29349
|
-
import
|
|
29434
|
+
import { writeFileSync as writeFileSync36 } from "fs";
|
|
29435
|
+
import { join as join79 } from "path";
|
|
29436
|
+
import chalk183 from "chalk";
|
|
29350
29437
|
|
|
29351
29438
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
29352
29439
|
import { readFileSync as readFileSync44 } from "fs";
|
|
@@ -29790,12 +29877,12 @@ function extractPostsFromCapture(captureFile) {
|
|
|
29790
29877
|
function netcapExtract(file) {
|
|
29791
29878
|
const captureFile = file ?? defaultCapturePath();
|
|
29792
29879
|
const posts = extractPostsFromCapture(captureFile);
|
|
29793
|
-
const outFile =
|
|
29794
|
-
|
|
29880
|
+
const outFile = join79(captureFile, "..", "posts.json");
|
|
29881
|
+
writeFileSync36(outFile, `${JSON.stringify(posts, null, 2)}
|
|
29795
29882
|
`);
|
|
29796
29883
|
console.log(
|
|
29797
|
-
|
|
29798
|
-
|
|
29884
|
+
chalk183.green(`extracted ${posts.length} posts`),
|
|
29885
|
+
chalk183.dim(`-> ${outFile}`)
|
|
29799
29886
|
);
|
|
29800
29887
|
}
|
|
29801
29888
|
|
|
@@ -29816,7 +29903,7 @@ function registerNetcap(program) {
|
|
|
29816
29903
|
}
|
|
29817
29904
|
|
|
29818
29905
|
// src/commands/news/add.ts
|
|
29819
|
-
import
|
|
29906
|
+
import chalk184 from "chalk";
|
|
29820
29907
|
import enquirer8 from "enquirer";
|
|
29821
29908
|
async function add2(url) {
|
|
29822
29909
|
if (!url) {
|
|
@@ -29837,25 +29924,25 @@ async function add2(url) {
|
|
|
29837
29924
|
}
|
|
29838
29925
|
const added = await addFeed(await getDb(), url);
|
|
29839
29926
|
if (!added) {
|
|
29840
|
-
console.log(
|
|
29927
|
+
console.log(chalk184.yellow("Feed already exists"));
|
|
29841
29928
|
return;
|
|
29842
29929
|
}
|
|
29843
|
-
console.log(
|
|
29930
|
+
console.log(chalk184.green(`Added feed: ${url}`));
|
|
29844
29931
|
}
|
|
29845
29932
|
|
|
29846
29933
|
// src/commands/news/list.ts
|
|
29847
|
-
import
|
|
29934
|
+
import chalk185 from "chalk";
|
|
29848
29935
|
async function list3() {
|
|
29849
29936
|
const urls = await listFeeds(await getDb());
|
|
29850
29937
|
if (urls.length === 0) {
|
|
29851
|
-
console.log(
|
|
29938
|
+
console.log(chalk185.dim("No feeds; add one with assist news add <url>"));
|
|
29852
29939
|
return;
|
|
29853
29940
|
}
|
|
29854
29941
|
for (const url of urls) console.log(url);
|
|
29855
29942
|
}
|
|
29856
29943
|
|
|
29857
29944
|
// src/commands/news/remove.ts
|
|
29858
|
-
import
|
|
29945
|
+
import chalk186 from "chalk";
|
|
29859
29946
|
|
|
29860
29947
|
// src/commands/backlog/removeFeed.ts
|
|
29861
29948
|
import { eq as eq43 } from "drizzle-orm";
|
|
@@ -29868,10 +29955,10 @@ async function removeFeed(db, url) {
|
|
|
29868
29955
|
async function remove(url) {
|
|
29869
29956
|
const removed = await removeFeed(await getDb(), url);
|
|
29870
29957
|
if (!removed) {
|
|
29871
|
-
console.log(
|
|
29958
|
+
console.log(chalk186.yellow(`No feed matches ${url}`));
|
|
29872
29959
|
return;
|
|
29873
29960
|
}
|
|
29874
|
-
console.log(
|
|
29961
|
+
console.log(chalk186.green(`Removed feed: ${url}`));
|
|
29875
29962
|
}
|
|
29876
29963
|
|
|
29877
29964
|
// src/commands/registerNews.ts
|
|
@@ -29924,7 +30011,7 @@ function registerPiHook(program) {
|
|
|
29924
30011
|
}
|
|
29925
30012
|
|
|
29926
30013
|
// src/commands/prompts/printPromptsTable.ts
|
|
29927
|
-
import
|
|
30014
|
+
import chalk187 from "chalk";
|
|
29928
30015
|
function truncate(str, max) {
|
|
29929
30016
|
if (str.length <= max) return str;
|
|
29930
30017
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -29942,14 +30029,14 @@ function printPromptsTable(rows) {
|
|
|
29942
30029
|
"Command".padEnd(commandWidth),
|
|
29943
30030
|
"Repos"
|
|
29944
30031
|
].join(" ");
|
|
29945
|
-
console.log(
|
|
29946
|
-
console.log(
|
|
30032
|
+
console.log(chalk187.dim(header));
|
|
30033
|
+
console.log(chalk187.dim("-".repeat(header.length)));
|
|
29947
30034
|
for (const row3 of rows) {
|
|
29948
30035
|
const count10 = String(row3.count).padStart(countWidth);
|
|
29949
30036
|
const tool = row3.tool.padEnd(toolWidth);
|
|
29950
30037
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
29951
30038
|
console.log(
|
|
29952
|
-
`${
|
|
30039
|
+
`${chalk187.yellow(count10)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
|
|
29953
30040
|
);
|
|
29954
30041
|
}
|
|
29955
30042
|
}
|
|
@@ -29987,13 +30074,13 @@ import { execSync as execSync39 } from "child_process";
|
|
|
29987
30074
|
import enquirer9 from "enquirer";
|
|
29988
30075
|
|
|
29989
30076
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
29990
|
-
import
|
|
30077
|
+
import chalk188 from "chalk";
|
|
29991
30078
|
var STATUS_MAP = {
|
|
29992
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
29993
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
30079
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk188.magenta("merged"), date: pr.mergedAt } : null,
|
|
30080
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk188.red("closed"), date: pr.closedAt } : null
|
|
29994
30081
|
};
|
|
29995
30082
|
function defaultStatus(pr) {
|
|
29996
|
-
return { label:
|
|
30083
|
+
return { label: chalk188.green("opened"), date: pr.createdAt };
|
|
29997
30084
|
}
|
|
29998
30085
|
function getStatus2(pr) {
|
|
29999
30086
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -30002,11 +30089,11 @@ function formatDate(dateStr) {
|
|
|
30002
30089
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
30003
30090
|
}
|
|
30004
30091
|
function formatPrHeader(pr, status2) {
|
|
30005
|
-
return `${
|
|
30092
|
+
return `${chalk188.cyan(`#${pr.number}`)} ${pr.title} ${chalk188.dim(`(${pr.author.login},`)} ${status2.label} ${chalk188.dim(`${formatDate(status2.date)})`)}`;
|
|
30006
30093
|
}
|
|
30007
30094
|
function logPrDetails(pr) {
|
|
30008
30095
|
console.log(
|
|
30009
|
-
|
|
30096
|
+
chalk188.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
30010
30097
|
);
|
|
30011
30098
|
console.log();
|
|
30012
30099
|
}
|
|
@@ -30185,11 +30272,11 @@ async function comment2(path108, line, body, options2 = {}) {
|
|
|
30185
30272
|
}
|
|
30186
30273
|
|
|
30187
30274
|
// src/commands/prs/commentsCachePath.ts
|
|
30188
|
-
import { homedir as
|
|
30189
|
-
import { join as
|
|
30275
|
+
import { homedir as homedir25 } from "os";
|
|
30276
|
+
import { join as join80 } from "path";
|
|
30190
30277
|
function commentsCachePath(org, repo, prNumber) {
|
|
30191
|
-
return
|
|
30192
|
-
|
|
30278
|
+
return join80(
|
|
30279
|
+
homedir25(),
|
|
30193
30280
|
".assist",
|
|
30194
30281
|
"pr-comments",
|
|
30195
30282
|
org,
|
|
@@ -30199,8 +30286,8 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
30199
30286
|
}
|
|
30200
30287
|
|
|
30201
30288
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30202
|
-
import { mkdirSync as
|
|
30203
|
-
import { dirname as
|
|
30289
|
+
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync37 } from "fs";
|
|
30290
|
+
import { dirname as dirname37 } from "path";
|
|
30204
30291
|
import { stringify as stringify3 } from "yaml";
|
|
30205
30292
|
|
|
30206
30293
|
// src/commands/prs/loadCommentsCache.ts
|
|
@@ -30224,10 +30311,10 @@ function deleteCommentsCache(org, repo, prNumber) {
|
|
|
30224
30311
|
|
|
30225
30312
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
30226
30313
|
import { readdirSync as readdirSync13, unlinkSync as unlinkSync14 } from "fs";
|
|
30227
|
-
import { join as
|
|
30314
|
+
import { join as join81 } from "path";
|
|
30228
30315
|
var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
|
|
30229
30316
|
function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
30230
|
-
const dir =
|
|
30317
|
+
const dir = join81(cwd, ".assist");
|
|
30231
30318
|
let entries;
|
|
30232
30319
|
try {
|
|
30233
30320
|
entries = readdirSync13(dir);
|
|
@@ -30235,20 +30322,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
30235
30322
|
return;
|
|
30236
30323
|
}
|
|
30237
30324
|
for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
|
|
30238
|
-
unlinkSync14(
|
|
30325
|
+
unlinkSync14(join81(dir, entry));
|
|
30239
30326
|
}
|
|
30240
30327
|
}
|
|
30241
30328
|
|
|
30242
30329
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
30243
30330
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
30244
30331
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
30245
|
-
|
|
30332
|
+
mkdirSync23(dirname37(cachePath), { recursive: true });
|
|
30246
30333
|
const cacheData = {
|
|
30247
30334
|
prNumber,
|
|
30248
30335
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
30249
30336
|
comments: comments3
|
|
30250
30337
|
};
|
|
30251
|
-
|
|
30338
|
+
writeFileSync37(cachePath, stringify3(cacheData));
|
|
30252
30339
|
}
|
|
30253
30340
|
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
30254
30341
|
removeStaleCommentsCaches();
|
|
@@ -30351,9 +30438,9 @@ function failAzureDevops(error) {
|
|
|
30351
30438
|
|
|
30352
30439
|
// src/commands/prs/azureDevops/invokeAzDevops.ts
|
|
30353
30440
|
import { execFileSync as execFileSync21 } from "child_process";
|
|
30354
|
-
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as
|
|
30441
|
+
import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync38 } from "fs";
|
|
30355
30442
|
import { tmpdir as tmpdir6 } from "os";
|
|
30356
|
-
import { join as
|
|
30443
|
+
import { join as join82 } from "path";
|
|
30357
30444
|
function azDevopsInvokeArgs(request, inFile) {
|
|
30358
30445
|
return [
|
|
30359
30446
|
"devops",
|
|
@@ -30388,10 +30475,10 @@ function runAz2(args) {
|
|
|
30388
30475
|
}
|
|
30389
30476
|
function invokeAzDevops(request) {
|
|
30390
30477
|
if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
|
|
30391
|
-
const dir = mkdtempSync2(
|
|
30392
|
-
const inFile =
|
|
30478
|
+
const dir = mkdtempSync2(join82(tmpdir6(), "assist-az-"));
|
|
30479
|
+
const inFile = join82(dir, "body.json");
|
|
30393
30480
|
try {
|
|
30394
|
-
|
|
30481
|
+
writeFileSync38(inFile, JSON.stringify(request.body));
|
|
30395
30482
|
return runAz2(azDevopsInvokeArgs(request, inFile));
|
|
30396
30483
|
} finally {
|
|
30397
30484
|
rmSync6(dir, { recursive: true, force: true });
|
|
@@ -30575,13 +30662,13 @@ function agentFooter(unresolvedCount) {
|
|
|
30575
30662
|
}
|
|
30576
30663
|
|
|
30577
30664
|
// src/commands/prs/listComments/commentStyle.ts
|
|
30578
|
-
import
|
|
30665
|
+
import chalk189 from "chalk";
|
|
30579
30666
|
var plain = (text17) => text17;
|
|
30580
30667
|
function colouredState(state) {
|
|
30581
30668
|
const label2 = `[${state}]`;
|
|
30582
|
-
if (state === "APPROVED") return
|
|
30583
|
-
if (state === "CHANGES_REQUESTED") return
|
|
30584
|
-
return
|
|
30669
|
+
if (state === "APPROVED") return chalk189.green(label2);
|
|
30670
|
+
if (state === "CHANGES_REQUESTED") return chalk189.red(label2);
|
|
30671
|
+
return chalk189.yellow(label2);
|
|
30585
30672
|
}
|
|
30586
30673
|
function commentStyle() {
|
|
30587
30674
|
if (isClaudeCode()) {
|
|
@@ -30595,9 +30682,9 @@ function commentStyle() {
|
|
|
30595
30682
|
};
|
|
30596
30683
|
}
|
|
30597
30684
|
return {
|
|
30598
|
-
cyan:
|
|
30599
|
-
bold:
|
|
30600
|
-
dim:
|
|
30685
|
+
cyan: chalk189.cyan,
|
|
30686
|
+
bold: chalk189.bold,
|
|
30687
|
+
dim: chalk189.dim,
|
|
30601
30688
|
state: colouredState,
|
|
30602
30689
|
diffHunk: true,
|
|
30603
30690
|
agent: false
|
|
@@ -32071,16 +32158,16 @@ function buildPrsStatusReport(repoArguments, now = Date.now()) {
|
|
|
32071
32158
|
}
|
|
32072
32159
|
|
|
32073
32160
|
// src/commands/prs/status/printPrsStatus.ts
|
|
32074
|
-
import
|
|
32161
|
+
import chalk191 from "chalk";
|
|
32075
32162
|
|
|
32076
32163
|
// src/commands/prs/status/printPrStatus.ts
|
|
32077
|
-
import
|
|
32164
|
+
import chalk190 from "chalk";
|
|
32078
32165
|
function flags(pr) {
|
|
32079
32166
|
const markers = [];
|
|
32080
32167
|
if (pr.isDraft) markers.push("draft");
|
|
32081
32168
|
if (pr.isDoNotMerge) markers.push("do not merge");
|
|
32082
32169
|
if (pr.isBot) markers.push("bot");
|
|
32083
|
-
return markers.length ? ` ${
|
|
32170
|
+
return markers.length ? ` ${chalk190.yellow(`[${markers.join(", ")}]`)}` : "";
|
|
32084
32171
|
}
|
|
32085
32172
|
function updated(pr) {
|
|
32086
32173
|
return pr.ageHours === null ? "updated unknown" : `updated ${pr.age} ago`;
|
|
@@ -32094,35 +32181,35 @@ function reviewLine(pr) {
|
|
|
32094
32181
|
function checkLines(pr) {
|
|
32095
32182
|
const lines2 = [];
|
|
32096
32183
|
if (pr.checks.failing.length) {
|
|
32097
|
-
lines2.push(
|
|
32184
|
+
lines2.push(chalk190.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
32098
32185
|
}
|
|
32099
32186
|
if (pr.checks.pending.length) {
|
|
32100
|
-
lines2.push(
|
|
32187
|
+
lines2.push(chalk190.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
32101
32188
|
}
|
|
32102
32189
|
return lines2;
|
|
32103
32190
|
}
|
|
32104
32191
|
function threadsLine(pr) {
|
|
32105
32192
|
if (pr.unresolvedThreads === null) {
|
|
32106
|
-
return
|
|
32193
|
+
return chalk190.dim("unresolved comments: unknown");
|
|
32107
32194
|
}
|
|
32108
32195
|
if (pr.unresolvedThreads === 0) return null;
|
|
32109
|
-
return
|
|
32196
|
+
return chalk190.yellow(`unresolved comments: ${pr.unresolvedThreads}`);
|
|
32110
32197
|
}
|
|
32111
32198
|
function mergeableLine(pr) {
|
|
32112
|
-
if (pr.mergeable === "CONFLICTING") return
|
|
32199
|
+
if (pr.mergeable === "CONFLICTING") return chalk190.red("conflicting");
|
|
32113
32200
|
if (pr.mergeable === "MERGEABLE") return null;
|
|
32114
|
-
return
|
|
32201
|
+
return chalk190.dim(`mergeable: ${pr.mergeable.toLowerCase()}`);
|
|
32115
32202
|
}
|
|
32116
32203
|
function printPrStatus(pr) {
|
|
32117
32204
|
console.log(
|
|
32118
|
-
` ${
|
|
32205
|
+
` ${chalk190.cyan(`#${pr.number}`)} ${pr.title} ${chalk190.dim(`(${pr.author}, ${updated(pr)})`)}${flags(pr)}`
|
|
32119
32206
|
);
|
|
32120
32207
|
const details = [
|
|
32121
32208
|
reviewLine(pr),
|
|
32122
32209
|
...checkLines(pr),
|
|
32123
32210
|
threadsLine(pr),
|
|
32124
32211
|
mergeableLine(pr),
|
|
32125
|
-
|
|
32212
|
+
chalk190.dim(pr.url)
|
|
32126
32213
|
];
|
|
32127
32214
|
for (const detail of details) {
|
|
32128
32215
|
if (detail) console.log(` ${detail}`);
|
|
@@ -32133,17 +32220,17 @@ function printPrStatus(pr) {
|
|
|
32133
32220
|
function printPrsStatus(report) {
|
|
32134
32221
|
for (const repo of report.repos) {
|
|
32135
32222
|
const count10 = repo.pullRequests.length;
|
|
32136
|
-
console.log(`${
|
|
32223
|
+
console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count10} open)`)}`);
|
|
32137
32224
|
for (const pr of repo.pullRequests) {
|
|
32138
32225
|
printPrStatus(pr);
|
|
32139
32226
|
}
|
|
32140
|
-
if (count10 === 0) console.log(
|
|
32227
|
+
if (count10 === 0) console.log(chalk191.dim(" no open pull requests"));
|
|
32141
32228
|
console.log();
|
|
32142
32229
|
}
|
|
32143
32230
|
if (report.errors.length === 0) return;
|
|
32144
|
-
console.log(
|
|
32231
|
+
console.log(chalk191.bold("Errors"));
|
|
32145
32232
|
for (const failure of report.errors) {
|
|
32146
|
-
console.log(` ${
|
|
32233
|
+
console.log(` ${chalk191.red(failure.repo)}: ${failure.error}`);
|
|
32147
32234
|
}
|
|
32148
32235
|
console.log();
|
|
32149
32236
|
}
|
|
@@ -32371,10 +32458,10 @@ function registerPrs(program) {
|
|
|
32371
32458
|
}
|
|
32372
32459
|
|
|
32373
32460
|
// src/commands/ravendb/ravendbAuth.ts
|
|
32374
|
-
import
|
|
32461
|
+
import chalk197 from "chalk";
|
|
32375
32462
|
|
|
32376
32463
|
// src/shared/createConnectionAuth.ts
|
|
32377
|
-
import
|
|
32464
|
+
import chalk192 from "chalk";
|
|
32378
32465
|
function listConnections(connections, format3) {
|
|
32379
32466
|
if (connections.length === 0) {
|
|
32380
32467
|
console.log("No connections configured.");
|
|
@@ -32387,7 +32474,7 @@ function listConnections(connections, format3) {
|
|
|
32387
32474
|
function removeConnection(connections, name, save) {
|
|
32388
32475
|
const filtered = connections.filter((c) => c.name !== name);
|
|
32389
32476
|
if (filtered.length === connections.length) {
|
|
32390
|
-
console.error(
|
|
32477
|
+
console.error(chalk192.red(`Connection "${name}" not found.`));
|
|
32391
32478
|
process.exit(1);
|
|
32392
32479
|
}
|
|
32393
32480
|
save(filtered);
|
|
@@ -32433,15 +32520,15 @@ function saveConnections(connections) {
|
|
|
32433
32520
|
}
|
|
32434
32521
|
|
|
32435
32522
|
// src/commands/ravendb/promptConnection.ts
|
|
32436
|
-
import
|
|
32523
|
+
import chalk195 from "chalk";
|
|
32437
32524
|
|
|
32438
32525
|
// src/commands/ravendb/selectOpSecret.ts
|
|
32439
|
-
import
|
|
32526
|
+
import chalk194 from "chalk";
|
|
32440
32527
|
import Enquirer2 from "enquirer";
|
|
32441
32528
|
|
|
32442
32529
|
// src/commands/ravendb/searchItems.ts
|
|
32443
32530
|
import { execSync as execSync46 } from "child_process";
|
|
32444
|
-
import
|
|
32531
|
+
import chalk193 from "chalk";
|
|
32445
32532
|
function opExec(args) {
|
|
32446
32533
|
return execSync46(`op ${args}`, {
|
|
32447
32534
|
encoding: "utf8",
|
|
@@ -32454,7 +32541,7 @@ function searchItems(search2) {
|
|
|
32454
32541
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
32455
32542
|
} catch {
|
|
32456
32543
|
console.error(
|
|
32457
|
-
|
|
32544
|
+
chalk193.red(
|
|
32458
32545
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
32459
32546
|
)
|
|
32460
32547
|
);
|
|
@@ -32468,7 +32555,7 @@ function getItemFields(itemId2) {
|
|
|
32468
32555
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
32469
32556
|
return item.fields.filter((f) => f.reference && f.label);
|
|
32470
32557
|
} catch {
|
|
32471
|
-
console.error(
|
|
32558
|
+
console.error(chalk193.red("Failed to get item details from 1Password."));
|
|
32472
32559
|
process.exit(1);
|
|
32473
32560
|
}
|
|
32474
32561
|
}
|
|
@@ -32487,7 +32574,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32487
32574
|
}).run();
|
|
32488
32575
|
const items2 = searchItems(search2);
|
|
32489
32576
|
if (items2.length === 0) {
|
|
32490
|
-
console.error(
|
|
32577
|
+
console.error(chalk194.red(`No items found matching "${search2}".`));
|
|
32491
32578
|
process.exit(1);
|
|
32492
32579
|
}
|
|
32493
32580
|
const itemId2 = await selectOne(
|
|
@@ -32496,7 +32583,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32496
32583
|
);
|
|
32497
32584
|
const fields = getItemFields(itemId2);
|
|
32498
32585
|
if (fields.length === 0) {
|
|
32499
|
-
console.error(
|
|
32586
|
+
console.error(chalk194.red("No fields with references found on this item."));
|
|
32500
32587
|
process.exit(1);
|
|
32501
32588
|
}
|
|
32502
32589
|
const ref = await selectOne(
|
|
@@ -32510,7 +32597,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
32510
32597
|
async function promptConnection(existingNames) {
|
|
32511
32598
|
const name = await promptInput("name", "Connection name:");
|
|
32512
32599
|
if (existingNames.includes(name)) {
|
|
32513
|
-
console.error(
|
|
32600
|
+
console.error(chalk195.red(`Connection "${name}" already exists.`));
|
|
32514
32601
|
process.exit(1);
|
|
32515
32602
|
}
|
|
32516
32603
|
const url = await promptInput(
|
|
@@ -32519,22 +32606,22 @@ async function promptConnection(existingNames) {
|
|
|
32519
32606
|
);
|
|
32520
32607
|
const database = await promptInput("database", "Database name:");
|
|
32521
32608
|
if (!name || !url || !database) {
|
|
32522
|
-
console.error(
|
|
32609
|
+
console.error(chalk195.red("All fields are required."));
|
|
32523
32610
|
process.exit(1);
|
|
32524
32611
|
}
|
|
32525
32612
|
const apiKeyRef = await selectOpSecret();
|
|
32526
|
-
console.log(
|
|
32613
|
+
console.log(chalk195.dim(`Using: ${apiKeyRef}`));
|
|
32527
32614
|
return { name, url, database, apiKeyRef };
|
|
32528
32615
|
}
|
|
32529
32616
|
|
|
32530
32617
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
32531
|
-
import
|
|
32618
|
+
import chalk196 from "chalk";
|
|
32532
32619
|
function ravendbSetConnection(name) {
|
|
32533
32620
|
const raw = loadGlobalConfigRaw();
|
|
32534
32621
|
const ravendb = raw.ravendb ?? {};
|
|
32535
32622
|
const connections = ravendb.connections ?? [];
|
|
32536
32623
|
if (!connections.some((c) => c.name === name)) {
|
|
32537
|
-
console.error(
|
|
32624
|
+
console.error(chalk196.red(`Connection "${name}" not found.`));
|
|
32538
32625
|
console.error(
|
|
32539
32626
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32540
32627
|
);
|
|
@@ -32550,16 +32637,16 @@ function ravendbSetConnection(name) {
|
|
|
32550
32637
|
var ravendbAuth = createConnectionAuth({
|
|
32551
32638
|
load: loadConnections,
|
|
32552
32639
|
save: saveConnections,
|
|
32553
|
-
format: (c) => `${
|
|
32640
|
+
format: (c) => `${chalk197.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
32554
32641
|
promptNew: promptConnection,
|
|
32555
32642
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
32556
32643
|
});
|
|
32557
32644
|
|
|
32558
32645
|
// src/commands/ravendb/ravendbCollections.ts
|
|
32559
|
-
import
|
|
32646
|
+
import chalk201 from "chalk";
|
|
32560
32647
|
|
|
32561
32648
|
// src/commands/ravendb/ravenFetch.ts
|
|
32562
|
-
import
|
|
32649
|
+
import chalk199 from "chalk";
|
|
32563
32650
|
|
|
32564
32651
|
// src/commands/ravendb/getAccessToken.ts
|
|
32565
32652
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -32596,10 +32683,10 @@ ${errorText}`
|
|
|
32596
32683
|
|
|
32597
32684
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
32598
32685
|
import { execSync as execSync47 } from "child_process";
|
|
32599
|
-
import
|
|
32686
|
+
import chalk198 from "chalk";
|
|
32600
32687
|
function resolveOpSecret(reference) {
|
|
32601
32688
|
if (!reference.startsWith("op://")) {
|
|
32602
|
-
console.error(
|
|
32689
|
+
console.error(chalk198.red(`Invalid secret reference: must start with op://`));
|
|
32603
32690
|
process.exit(1);
|
|
32604
32691
|
}
|
|
32605
32692
|
try {
|
|
@@ -32609,7 +32696,7 @@ function resolveOpSecret(reference) {
|
|
|
32609
32696
|
}).trim();
|
|
32610
32697
|
} catch {
|
|
32611
32698
|
console.error(
|
|
32612
|
-
|
|
32699
|
+
chalk198.red(
|
|
32613
32700
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
32614
32701
|
)
|
|
32615
32702
|
);
|
|
@@ -32636,7 +32723,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32636
32723
|
if (!response.ok) {
|
|
32637
32724
|
const body = await response.text();
|
|
32638
32725
|
console.error(
|
|
32639
|
-
|
|
32726
|
+
chalk199.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
32640
32727
|
);
|
|
32641
32728
|
console.error(body.substring(0, 500));
|
|
32642
32729
|
process.exit(1);
|
|
@@ -32645,7 +32732,7 @@ async function ravenFetch(connection, path108) {
|
|
|
32645
32732
|
}
|
|
32646
32733
|
|
|
32647
32734
|
// src/commands/ravendb/resolveConnection.ts
|
|
32648
|
-
import
|
|
32735
|
+
import chalk200 from "chalk";
|
|
32649
32736
|
function loadRavendb() {
|
|
32650
32737
|
const raw = loadGlobalConfigRaw();
|
|
32651
32738
|
const ravendb = raw.ravendb;
|
|
@@ -32659,7 +32746,7 @@ function resolveConnection(name) {
|
|
|
32659
32746
|
const connectionName = name ?? defaultConnection;
|
|
32660
32747
|
if (!connectionName) {
|
|
32661
32748
|
console.error(
|
|
32662
|
-
|
|
32749
|
+
chalk200.red(
|
|
32663
32750
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
32664
32751
|
)
|
|
32665
32752
|
);
|
|
@@ -32667,7 +32754,7 @@ function resolveConnection(name) {
|
|
|
32667
32754
|
}
|
|
32668
32755
|
const connection = connections.find((c) => c.name === connectionName);
|
|
32669
32756
|
if (!connection) {
|
|
32670
|
-
console.error(
|
|
32757
|
+
console.error(chalk200.red(`Connection "${connectionName}" not found.`));
|
|
32671
32758
|
console.error(
|
|
32672
32759
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
32673
32760
|
);
|
|
@@ -32698,15 +32785,15 @@ async function ravendbCollections(connectionName) {
|
|
|
32698
32785
|
return;
|
|
32699
32786
|
}
|
|
32700
32787
|
for (const c of collections) {
|
|
32701
|
-
console.log(`${
|
|
32788
|
+
console.log(`${chalk201.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
32702
32789
|
}
|
|
32703
32790
|
}
|
|
32704
32791
|
|
|
32705
32792
|
// src/commands/ravendb/ravendbQuery.ts
|
|
32706
|
-
import
|
|
32793
|
+
import chalk203 from "chalk";
|
|
32707
32794
|
|
|
32708
32795
|
// src/commands/ravendb/fetchAllPages.ts
|
|
32709
|
-
import
|
|
32796
|
+
import chalk202 from "chalk";
|
|
32710
32797
|
|
|
32711
32798
|
// src/commands/ravendb/buildQueryPath.ts
|
|
32712
32799
|
function buildQueryPath(opts) {
|
|
@@ -32744,7 +32831,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32744
32831
|
allResults.push(...results);
|
|
32745
32832
|
start2 += results.length;
|
|
32746
32833
|
process.stderr.write(
|
|
32747
|
-
`\r${
|
|
32834
|
+
`\r${chalk202.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
32748
32835
|
);
|
|
32749
32836
|
if (start2 >= totalResults) break;
|
|
32750
32837
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -32759,7 +32846,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
32759
32846
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
32760
32847
|
const resolved = resolveArgs(connectionName, collection);
|
|
32761
32848
|
if (!resolved.collection && !options2.query) {
|
|
32762
|
-
console.error(
|
|
32849
|
+
console.error(chalk203.red("Provide a collection name or --query filter."));
|
|
32763
32850
|
process.exit(1);
|
|
32764
32851
|
}
|
|
32765
32852
|
const { collection: col } = resolved;
|
|
@@ -32794,7 +32881,7 @@ function registerRavendb(program) {
|
|
|
32794
32881
|
}
|
|
32795
32882
|
|
|
32796
32883
|
// src/commands/releases/releasesConfigure.ts
|
|
32797
|
-
import
|
|
32884
|
+
import chalk205 from "chalk";
|
|
32798
32885
|
|
|
32799
32886
|
// src/commands/releases/checkStreamGraph.ts
|
|
32800
32887
|
function nodeIds(stream) {
|
|
@@ -32856,26 +32943,26 @@ function readStreamsInput(source) {
|
|
|
32856
32943
|
}
|
|
32857
32944
|
|
|
32858
32945
|
// src/commands/releases/reportDerivedStreams.ts
|
|
32859
|
-
import
|
|
32946
|
+
import chalk204 from "chalk";
|
|
32860
32947
|
function printDerived(stream) {
|
|
32861
32948
|
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
32862
32949
|
const steps = stream.nodes.filter((n) => !n.environment);
|
|
32863
32950
|
console.log(
|
|
32864
|
-
`${
|
|
32951
|
+
`${chalk204.bold(stream.name)} ${chalk204.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
32865
32952
|
);
|
|
32866
32953
|
console.log(
|
|
32867
|
-
` environments: ${environments.join(", ") ||
|
|
32954
|
+
` environments: ${environments.join(", ") || chalk204.dim("none")}`
|
|
32868
32955
|
);
|
|
32869
32956
|
if (steps.length > 0)
|
|
32870
32957
|
console.log(
|
|
32871
32958
|
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
32872
32959
|
);
|
|
32873
32960
|
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
32874
|
-
console.log(` edges: ${edges.join(", ") ||
|
|
32961
|
+
console.log(` edges: ${edges.join(", ") || chalk204.dim("none")}`);
|
|
32875
32962
|
}
|
|
32876
32963
|
function reportDerivedStreams(streams, target) {
|
|
32877
32964
|
for (const stream of streams) printDerived(stream);
|
|
32878
|
-
console.log(
|
|
32965
|
+
console.log(chalk204.dim(`Written to ${target}`));
|
|
32879
32966
|
}
|
|
32880
32967
|
|
|
32881
32968
|
// src/commands/releases/withCurrentRepo.ts
|
|
@@ -32962,9 +33049,9 @@ async function writeReleaseStreams(incoming, scope) {
|
|
|
32962
33049
|
}
|
|
32963
33050
|
|
|
32964
33051
|
// src/commands/releases/releasesConfigure.ts
|
|
32965
|
-
function
|
|
32966
|
-
console.error(
|
|
32967
|
-
for (const detail of details) console.error(
|
|
33052
|
+
function fail7(message3, details = []) {
|
|
33053
|
+
console.error(chalk205.red(message3));
|
|
33054
|
+
for (const detail of details) console.error(chalk205.red(` ${detail}`));
|
|
32968
33055
|
process.exitCode = 1;
|
|
32969
33056
|
}
|
|
32970
33057
|
function reportWritten(incoming, target) {
|
|
@@ -32978,17 +33065,17 @@ function reportWritten(incoming, target) {
|
|
|
32978
33065
|
async function releasesConfigure(options2 = {}) {
|
|
32979
33066
|
const scope = options2.scope === "repo" ? "repo" : "project";
|
|
32980
33067
|
const input = readStreamsInput(options2.streams ?? "-");
|
|
32981
|
-
if ("error" in input) return
|
|
33068
|
+
if ("error" in input) return fail7(`Could not read --streams: ${input.error}`);
|
|
32982
33069
|
const incoming = withCurrentRepo(input.streams);
|
|
32983
33070
|
const broken = checkStreamGraph(incoming);
|
|
32984
33071
|
if (broken.length > 0)
|
|
32985
|
-
return
|
|
33072
|
+
return fail7(
|
|
32986
33073
|
"The graph does not hold together, so nothing was written:",
|
|
32987
33074
|
broken
|
|
32988
33075
|
);
|
|
32989
33076
|
const written = await writeReleaseStreams(incoming, scope);
|
|
32990
33077
|
if (!written.ok)
|
|
32991
|
-
return
|
|
33078
|
+
return fail7(
|
|
32992
33079
|
"releases.streams does not validate, so nothing was written:",
|
|
32993
33080
|
written.errors
|
|
32994
33081
|
);
|
|
@@ -32996,23 +33083,23 @@ async function releasesConfigure(options2 = {}) {
|
|
|
32996
33083
|
}
|
|
32997
33084
|
|
|
32998
33085
|
// src/commands/releases/releasesList.ts
|
|
32999
|
-
import
|
|
33086
|
+
import chalk206 from "chalk";
|
|
33000
33087
|
function describeNode(node) {
|
|
33001
33088
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
33002
33089
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
33003
33090
|
}
|
|
33004
33091
|
function printStream(stream) {
|
|
33005
|
-
console.log(`${
|
|
33006
|
-
console.log(
|
|
33092
|
+
console.log(`${chalk206.bold(stream.name)} ${chalk206.dim(stream.repo)}`);
|
|
33093
|
+
console.log(chalk206.dim(` workflow: ${stream.workflow}`));
|
|
33007
33094
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
33008
33095
|
for (const [from, to] of stream.edges)
|
|
33009
|
-
console.log(
|
|
33096
|
+
console.log(chalk206.dim(` ${from} \u2192 ${to}`));
|
|
33010
33097
|
}
|
|
33011
33098
|
function releasesList() {
|
|
33012
33099
|
const streams = loadConfig().releases?.streams ?? [];
|
|
33013
33100
|
if (streams.length === 0) {
|
|
33014
33101
|
console.log(
|
|
33015
|
-
|
|
33102
|
+
chalk206.dim("No release streams configured under releases.streams.")
|
|
33016
33103
|
);
|
|
33017
33104
|
return;
|
|
33018
33105
|
}
|
|
@@ -33060,7 +33147,7 @@ function coverage() {
|
|
|
33060
33147
|
|
|
33061
33148
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
33062
33149
|
import path45 from "path";
|
|
33063
|
-
import
|
|
33150
|
+
import chalk208 from "chalk";
|
|
33064
33151
|
|
|
33065
33152
|
// src/commands/lint/lint/checkFileNames.ts
|
|
33066
33153
|
import fs23 from "fs";
|
|
@@ -33140,7 +33227,7 @@ function checkFileNames() {
|
|
|
33140
33227
|
}
|
|
33141
33228
|
|
|
33142
33229
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
33143
|
-
import
|
|
33230
|
+
import chalk207 from "chalk";
|
|
33144
33231
|
|
|
33145
33232
|
// src/commands/lint/lint/applyMoves.ts
|
|
33146
33233
|
import fs24 from "fs";
|
|
@@ -33225,25 +33312,25 @@ function fixFileNameViolations(moves) {
|
|
|
33225
33312
|
const start2 = performance.now();
|
|
33226
33313
|
const project = createLintProject();
|
|
33227
33314
|
const cwd = process.cwd();
|
|
33228
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
33315
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk207.green(line)));
|
|
33229
33316
|
const ms = (performance.now() - start2).toFixed(0);
|
|
33230
|
-
console.log(
|
|
33317
|
+
console.log(chalk207.dim(` Done in ${ms}ms`));
|
|
33231
33318
|
}
|
|
33232
33319
|
|
|
33233
33320
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
33234
33321
|
function reportViolations(violations) {
|
|
33235
|
-
console.error(
|
|
33322
|
+
console.error(chalk208.red("\nFile name check failed:\n"));
|
|
33236
33323
|
console.error(
|
|
33237
|
-
|
|
33324
|
+
chalk208.red(
|
|
33238
33325
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
33239
33326
|
)
|
|
33240
33327
|
);
|
|
33241
33328
|
for (const violation of violations) {
|
|
33242
|
-
console.error(
|
|
33243
|
-
console.error(
|
|
33329
|
+
console.error(chalk208.red(` ${violation.filePath}`));
|
|
33330
|
+
console.error(chalk208.gray(` Rename to: ${violation.suggestedName}
|
|
33244
33331
|
`));
|
|
33245
33332
|
}
|
|
33246
|
-
console.error(
|
|
33333
|
+
console.error(chalk208.dim(" Run with -f to auto-fix.\n"));
|
|
33247
33334
|
}
|
|
33248
33335
|
function runFileNameCheck(fix = false) {
|
|
33249
33336
|
const violations = checkFileNames();
|
|
@@ -33272,17 +33359,17 @@ function runFileNameCheck(fix = false) {
|
|
|
33272
33359
|
import fs26 from "fs";
|
|
33273
33360
|
|
|
33274
33361
|
// src/commands/lint/shared.ts
|
|
33275
|
-
import
|
|
33362
|
+
import chalk209 from "chalk";
|
|
33276
33363
|
function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
|
|
33277
33364
|
if (violations.length > 0) {
|
|
33278
|
-
console.error(
|
|
33365
|
+
console.error(chalk209.red(`
|
|
33279
33366
|
${checkName2} failed:
|
|
33280
33367
|
`));
|
|
33281
|
-
console.error(
|
|
33368
|
+
console.error(chalk209.red(` ${errorMessage3}
|
|
33282
33369
|
`));
|
|
33283
33370
|
for (const violation of violations) {
|
|
33284
|
-
console.error(
|
|
33285
|
-
console.error(
|
|
33371
|
+
console.error(chalk209.red(` ${violation.filePath}:${violation.line}`));
|
|
33372
|
+
console.error(chalk209.gray(` ${violation.content}
|
|
33286
33373
|
`));
|
|
33287
33374
|
}
|
|
33288
33375
|
return false;
|
|
@@ -33410,10 +33497,10 @@ async function notify() {
|
|
|
33410
33497
|
|
|
33411
33498
|
// src/commands/screenshot.ts
|
|
33412
33499
|
import { execSync as execSync49 } from "child_process";
|
|
33413
|
-
import { existsSync as existsSync65, mkdirSync as
|
|
33500
|
+
import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
|
|
33414
33501
|
import { tmpdir as tmpdir7 } from "os";
|
|
33415
|
-
import { join as
|
|
33416
|
-
import
|
|
33502
|
+
import { join as join83, resolve as resolve24 } from "path";
|
|
33503
|
+
import chalk210 from "chalk";
|
|
33417
33504
|
|
|
33418
33505
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
33419
33506
|
var captureWindowPs1 = `
|
|
@@ -33543,14 +33630,14 @@ Write-Output $OutputPath
|
|
|
33543
33630
|
// src/commands/screenshot.ts
|
|
33544
33631
|
function buildOutputPath(outputDir, processName) {
|
|
33545
33632
|
if (!existsSync65(outputDir)) {
|
|
33546
|
-
|
|
33633
|
+
mkdirSync24(outputDir, { recursive: true });
|
|
33547
33634
|
}
|
|
33548
33635
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
33549
33636
|
return resolve24(outputDir, `${processName}-${timestamp6}.png`);
|
|
33550
33637
|
}
|
|
33551
33638
|
function runPowerShellScript(processName, outputPath) {
|
|
33552
|
-
const scriptPath =
|
|
33553
|
-
|
|
33639
|
+
const scriptPath = join83(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
|
|
33640
|
+
writeFileSync39(scriptPath, captureWindowPs1, "utf8");
|
|
33554
33641
|
try {
|
|
33555
33642
|
execSync49(
|
|
33556
33643
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -33564,19 +33651,19 @@ function screenshot(processName) {
|
|
|
33564
33651
|
const config = loadConfig();
|
|
33565
33652
|
const outputDir = resolve24(config.screenshot.outputDir);
|
|
33566
33653
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
33567
|
-
console.log(
|
|
33654
|
+
console.log(chalk210.gray(`Capturing window for process "${processName}" ...`));
|
|
33568
33655
|
try {
|
|
33569
33656
|
runPowerShellScript(processName, outputPath);
|
|
33570
|
-
console.log(
|
|
33657
|
+
console.log(chalk210.green(`Screenshot saved: ${outputPath}`));
|
|
33571
33658
|
} catch (error) {
|
|
33572
33659
|
const msg = error instanceof Error ? error.message : String(error);
|
|
33573
|
-
console.error(
|
|
33660
|
+
console.error(chalk210.red(`Failed to capture screenshot: ${msg}`));
|
|
33574
33661
|
process.exit(1);
|
|
33575
33662
|
}
|
|
33576
33663
|
}
|
|
33577
33664
|
|
|
33578
33665
|
// src/commands/statusLine.ts
|
|
33579
|
-
import
|
|
33666
|
+
import chalk212 from "chalk";
|
|
33580
33667
|
|
|
33581
33668
|
// src/shared/contextLevel.ts
|
|
33582
33669
|
var THRESHOLDS = {
|
|
@@ -33592,7 +33679,7 @@ function contextLevel(pct, harness) {
|
|
|
33592
33679
|
}
|
|
33593
33680
|
|
|
33594
33681
|
// src/commands/buildLimitsSegment.ts
|
|
33595
|
-
import
|
|
33682
|
+
import chalk211 from "chalk";
|
|
33596
33683
|
|
|
33597
33684
|
// src/shared/rateLimitLevel.ts
|
|
33598
33685
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -33630,9 +33717,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
33630
33717
|
|
|
33631
33718
|
// src/commands/buildLimitsSegment.ts
|
|
33632
33719
|
var LEVEL_COLOR = {
|
|
33633
|
-
ok:
|
|
33634
|
-
warn:
|
|
33635
|
-
over:
|
|
33720
|
+
ok: chalk211.green,
|
|
33721
|
+
warn: chalk211.yellow,
|
|
33722
|
+
over: chalk211.red
|
|
33636
33723
|
};
|
|
33637
33724
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
33638
33725
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -33664,9 +33751,9 @@ function buildLimitsSegment(rateLimits) {
|
|
|
33664
33751
|
|
|
33665
33752
|
// src/commands/readGitBranch.ts
|
|
33666
33753
|
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
33667
|
-
import { isAbsolute as isAbsolute6, join as
|
|
33754
|
+
import { isAbsolute as isAbsolute6, join as join84, resolve as resolve25 } from "path";
|
|
33668
33755
|
function resolveGitDir(cwd) {
|
|
33669
|
-
const dotGit =
|
|
33756
|
+
const dotGit = join84(cwd, ".git");
|
|
33670
33757
|
let stat5;
|
|
33671
33758
|
try {
|
|
33672
33759
|
stat5 = statSync10(dotGit);
|
|
@@ -33696,7 +33783,7 @@ function readGitBranch(cwd) {
|
|
|
33696
33783
|
}
|
|
33697
33784
|
let head;
|
|
33698
33785
|
try {
|
|
33699
|
-
head = readFileSync48(
|
|
33786
|
+
head = readFileSync48(join84(gitDir, "HEAD"), "utf8");
|
|
33700
33787
|
} catch {
|
|
33701
33788
|
return null;
|
|
33702
33789
|
}
|
|
@@ -33728,7 +33815,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
33728
33815
|
}
|
|
33729
33816
|
|
|
33730
33817
|
// src/commands/statusLine.ts
|
|
33731
|
-
|
|
33818
|
+
chalk212.level = 3;
|
|
33732
33819
|
function formatNumber(num) {
|
|
33733
33820
|
return num.toLocaleString("en-US");
|
|
33734
33821
|
}
|
|
@@ -33736,9 +33823,9 @@ function colorizePercent(pct) {
|
|
|
33736
33823
|
const label2 = `${Math.round(pct)}%`;
|
|
33737
33824
|
switch (contextLevel(pct)) {
|
|
33738
33825
|
case "red":
|
|
33739
|
-
return
|
|
33826
|
+
return chalk212.red(label2);
|
|
33740
33827
|
case "yellow":
|
|
33741
|
-
return
|
|
33828
|
+
return chalk212.yellow(label2);
|
|
33742
33829
|
default:
|
|
33743
33830
|
return label2;
|
|
33744
33831
|
}
|
|
@@ -33751,7 +33838,7 @@ async function statusLine() {
|
|
|
33751
33838
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
33752
33839
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
33753
33840
|
const branch2 = dir ? readGitBranch(dir) : null;
|
|
33754
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
33841
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk212.cyan(branch2)} | ` : "";
|
|
33755
33842
|
console.log(
|
|
33756
33843
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
33757
33844
|
);
|
|
@@ -33858,7 +33945,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
33858
33945
|
import * as path47 from "path";
|
|
33859
33946
|
|
|
33860
33947
|
// src/commands/refactor/logViolations.ts
|
|
33861
|
-
import
|
|
33948
|
+
import chalk213 from "chalk";
|
|
33862
33949
|
var DEFAULT_MAX_LINES2 = 100;
|
|
33863
33950
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
33864
33951
|
if (violations.length === 0) {
|
|
@@ -33867,43 +33954,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
33867
33954
|
}
|
|
33868
33955
|
return;
|
|
33869
33956
|
}
|
|
33870
|
-
console.error(
|
|
33957
|
+
console.error(chalk213.red(`
|
|
33871
33958
|
Refactor check failed:
|
|
33872
33959
|
`));
|
|
33873
|
-
console.error(
|
|
33960
|
+
console.error(chalk213.red(` The following files exceed ${maxLines} lines:
|
|
33874
33961
|
`));
|
|
33875
33962
|
for (const violation of violations) {
|
|
33876
|
-
console.error(
|
|
33963
|
+
console.error(chalk213.red(` ${violation.file} (${violation.lines} lines)`));
|
|
33877
33964
|
}
|
|
33878
33965
|
console.error(
|
|
33879
|
-
|
|
33966
|
+
chalk213.yellow(
|
|
33880
33967
|
`
|
|
33881
33968
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
33882
33969
|
way to refactor it, ignore it with:
|
|
33883
33970
|
`
|
|
33884
33971
|
)
|
|
33885
33972
|
);
|
|
33886
|
-
console.error(
|
|
33973
|
+
console.error(chalk213.gray(` assist refactor ignore <file>
|
|
33887
33974
|
`));
|
|
33888
33975
|
if (process.env.CLAUDECODE) {
|
|
33889
|
-
console.error(
|
|
33976
|
+
console.error(chalk213.cyan(`
|
|
33890
33977
|
## Extracting Code to New Files
|
|
33891
33978
|
`));
|
|
33892
33979
|
console.error(
|
|
33893
|
-
|
|
33980
|
+
chalk213.cyan(
|
|
33894
33981
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
33895
33982
|
`
|
|
33896
33983
|
)
|
|
33897
33984
|
);
|
|
33898
33985
|
console.error(
|
|
33899
|
-
|
|
33986
|
+
chalk213.cyan(
|
|
33900
33987
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
33901
33988
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
33902
33989
|
`
|
|
33903
33990
|
)
|
|
33904
33991
|
);
|
|
33905
33992
|
console.error(
|
|
33906
|
-
|
|
33993
|
+
chalk213.cyan(
|
|
33907
33994
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
33908
33995
|
domains, move it to a common/shared folder.
|
|
33909
33996
|
`
|
|
@@ -34059,7 +34146,7 @@ async function check(pattern2, options2) {
|
|
|
34059
34146
|
|
|
34060
34147
|
// src/commands/refactor/extract.ts
|
|
34061
34148
|
import path55 from "path";
|
|
34062
|
-
import
|
|
34149
|
+
import chalk216 from "chalk";
|
|
34063
34150
|
|
|
34064
34151
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
34065
34152
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -34667,23 +34754,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
34667
34754
|
|
|
34668
34755
|
// src/commands/refactor/extract/displayPlan.ts
|
|
34669
34756
|
import path51 from "path";
|
|
34670
|
-
import
|
|
34757
|
+
import chalk214 from "chalk";
|
|
34671
34758
|
function section(title) {
|
|
34672
34759
|
return `
|
|
34673
|
-
${
|
|
34760
|
+
${chalk214.cyan(title)}`;
|
|
34674
34761
|
}
|
|
34675
34762
|
function displayImporters(plan2, cwd) {
|
|
34676
34763
|
if (plan2.importersToUpdate.length === 0) return;
|
|
34677
34764
|
console.log(section("Update importers:"));
|
|
34678
34765
|
for (const imp of plan2.importersToUpdate) {
|
|
34679
34766
|
const rel = path51.relative(cwd, imp.file.getFilePath());
|
|
34680
|
-
console.log(` ${
|
|
34767
|
+
console.log(` ${chalk214.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
34681
34768
|
}
|
|
34682
34769
|
}
|
|
34683
34770
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
34684
|
-
console.log(
|
|
34771
|
+
console.log(chalk214.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
34685
34772
|
`));
|
|
34686
|
-
console.log(` ${
|
|
34773
|
+
console.log(` ${chalk214.cyan("Functions to move:")}`);
|
|
34687
34774
|
for (const name of plan2.extractedNames) {
|
|
34688
34775
|
console.log(` ${name}`);
|
|
34689
34776
|
}
|
|
@@ -34717,7 +34804,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
34717
34804
|
|
|
34718
34805
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
34719
34806
|
import path54 from "path";
|
|
34720
|
-
import
|
|
34807
|
+
import chalk215 from "chalk";
|
|
34721
34808
|
import { Project as Project3 } from "ts-morph";
|
|
34722
34809
|
|
|
34723
34810
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -34809,7 +34896,7 @@ function loadProjectFile(file) {
|
|
|
34809
34896
|
});
|
|
34810
34897
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
34811
34898
|
if (!sourceFile) {
|
|
34812
|
-
console.log(
|
|
34899
|
+
console.log(chalk215.red(`File not found in project: ${file}`));
|
|
34813
34900
|
process.exit(1);
|
|
34814
34901
|
}
|
|
34815
34902
|
return { project, sourceFile };
|
|
@@ -34832,19 +34919,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
34832
34919
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
34833
34920
|
if (options2.apply) {
|
|
34834
34921
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
34835
|
-
console.log(
|
|
34922
|
+
console.log(chalk216.green("\nExtraction complete"));
|
|
34836
34923
|
} else {
|
|
34837
|
-
console.log(
|
|
34924
|
+
console.log(chalk216.dim("\nDry run. Use --apply to execute."));
|
|
34838
34925
|
}
|
|
34839
34926
|
}
|
|
34840
34927
|
|
|
34841
34928
|
// src/commands/refactor/ignore.ts
|
|
34842
34929
|
import fs32 from "fs";
|
|
34843
|
-
import
|
|
34930
|
+
import chalk217 from "chalk";
|
|
34844
34931
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
34845
34932
|
function ignore2(file) {
|
|
34846
34933
|
if (!fs32.existsSync(file)) {
|
|
34847
|
-
console.error(
|
|
34934
|
+
console.error(chalk217.red(`Error: File does not exist: ${file}`));
|
|
34848
34935
|
process.exit(1);
|
|
34849
34936
|
}
|
|
34850
34937
|
const content = fs32.readFileSync(file, "utf8");
|
|
@@ -34860,7 +34947,7 @@ function ignore2(file) {
|
|
|
34860
34947
|
fs32.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
34861
34948
|
}
|
|
34862
34949
|
console.log(
|
|
34863
|
-
|
|
34950
|
+
chalk217.green(
|
|
34864
34951
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
34865
34952
|
)
|
|
34866
34953
|
);
|
|
@@ -34869,12 +34956,12 @@ function ignore2(file) {
|
|
|
34869
34956
|
// src/commands/refactor/rename.ts
|
|
34870
34957
|
import fs35 from "fs";
|
|
34871
34958
|
import path61 from "path";
|
|
34872
|
-
import
|
|
34959
|
+
import chalk220 from "chalk";
|
|
34873
34960
|
|
|
34874
34961
|
// src/commands/refactor/rename/applyRename.ts
|
|
34875
34962
|
import fs34 from "fs";
|
|
34876
34963
|
import path57 from "path";
|
|
34877
|
-
import
|
|
34964
|
+
import chalk218 from "chalk";
|
|
34878
34965
|
|
|
34879
34966
|
// src/commands/refactor/restructure/computeRewrites.ts
|
|
34880
34967
|
import path56 from "path";
|
|
@@ -34980,13 +35067,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
34980
35067
|
const updatedContents = applyRewrites(rewrites);
|
|
34981
35068
|
for (const [file, content] of updatedContents) {
|
|
34982
35069
|
fs34.writeFileSync(file, content, "utf8");
|
|
34983
|
-
console.log(
|
|
35070
|
+
console.log(chalk218.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
|
|
34984
35071
|
}
|
|
34985
35072
|
const destDir = path57.dirname(destPath);
|
|
34986
35073
|
if (!fs34.existsSync(destDir)) fs34.mkdirSync(destDir, { recursive: true });
|
|
34987
35074
|
fs34.renameSync(sourcePath, destPath);
|
|
34988
35075
|
console.log(
|
|
34989
|
-
|
|
35076
|
+
chalk218.white(
|
|
34990
35077
|
` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
|
|
34991
35078
|
)
|
|
34992
35079
|
);
|
|
@@ -35136,16 +35223,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
35136
35223
|
|
|
35137
35224
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
35138
35225
|
import path60 from "path";
|
|
35139
|
-
import
|
|
35226
|
+
import chalk219 from "chalk";
|
|
35140
35227
|
function printRenamePreview(rewrites, cwd) {
|
|
35141
35228
|
for (const rewrite of rewrites) {
|
|
35142
35229
|
console.log(
|
|
35143
|
-
|
|
35230
|
+
chalk219.dim(
|
|
35144
35231
|
` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
35145
35232
|
)
|
|
35146
35233
|
);
|
|
35147
35234
|
}
|
|
35148
|
-
console.log(
|
|
35235
|
+
console.log(chalk219.dim("Dry run. Use --apply to execute."));
|
|
35149
35236
|
}
|
|
35150
35237
|
|
|
35151
35238
|
// src/commands/refactor/rename.ts
|
|
@@ -35156,20 +35243,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
35156
35243
|
const relSource = path61.relative(cwd, sourcePath);
|
|
35157
35244
|
const relDest = path61.relative(cwd, destPath);
|
|
35158
35245
|
if (!fs35.existsSync(sourcePath)) {
|
|
35159
|
-
console.log(
|
|
35246
|
+
console.log(chalk220.red(`File not found: ${source}`));
|
|
35160
35247
|
process.exit(1);
|
|
35161
35248
|
}
|
|
35162
35249
|
if (destPath !== sourcePath && fs35.existsSync(destPath)) {
|
|
35163
|
-
console.log(
|
|
35250
|
+
console.log(chalk220.red(`Destination already exists: ${destination}`));
|
|
35164
35251
|
process.exit(1);
|
|
35165
35252
|
}
|
|
35166
|
-
console.log(
|
|
35167
|
-
console.log(
|
|
35168
|
-
console.log(
|
|
35253
|
+
console.log(chalk220.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
35254
|
+
console.log(chalk220.dim("Loading project..."));
|
|
35255
|
+
console.log(chalk220.dim("Scanning imports across the project..."));
|
|
35169
35256
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
35170
35257
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
35171
35258
|
console.log(
|
|
35172
|
-
|
|
35259
|
+
chalk220.dim(
|
|
35173
35260
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
35174
35261
|
)
|
|
35175
35262
|
);
|
|
@@ -35178,11 +35265,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
35178
35265
|
return;
|
|
35179
35266
|
}
|
|
35180
35267
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
35181
|
-
console.log(
|
|
35268
|
+
console.log(chalk220.green("Done"));
|
|
35182
35269
|
}
|
|
35183
35270
|
|
|
35184
35271
|
// src/commands/refactor/renameSymbol.ts
|
|
35185
|
-
import
|
|
35272
|
+
import chalk221 from "chalk";
|
|
35186
35273
|
|
|
35187
35274
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
35188
35275
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -35228,34 +35315,34 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
35228
35315
|
const { project, sourceFile } = loadProjectFile(file);
|
|
35229
35316
|
const symbol = findSymbol(sourceFile, oldName);
|
|
35230
35317
|
if (!symbol) {
|
|
35231
|
-
console.log(
|
|
35318
|
+
console.log(chalk221.red(`Symbol "${oldName}" not found in ${file}`));
|
|
35232
35319
|
process.exit(1);
|
|
35233
35320
|
}
|
|
35234
35321
|
const grouped = groupReferences(symbol, cwd);
|
|
35235
35322
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
35236
35323
|
console.log(
|
|
35237
|
-
|
|
35324
|
+
chalk221.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
35238
35325
|
`)
|
|
35239
35326
|
);
|
|
35240
35327
|
for (const [refFile, lines2] of grouped) {
|
|
35241
35328
|
console.log(
|
|
35242
|
-
` ${
|
|
35329
|
+
` ${chalk221.dim(refFile)}: lines ${chalk221.cyan(lines2.join(", "))}`
|
|
35243
35330
|
);
|
|
35244
35331
|
}
|
|
35245
35332
|
if (options2.apply) {
|
|
35246
35333
|
symbol.rename(newName);
|
|
35247
35334
|
await project.save();
|
|
35248
|
-
console.log(
|
|
35335
|
+
console.log(chalk221.green(`
|
|
35249
35336
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
35250
35337
|
} else {
|
|
35251
|
-
console.log(
|
|
35338
|
+
console.log(chalk221.dim("\nDry run. Use --apply to execute."));
|
|
35252
35339
|
}
|
|
35253
35340
|
}
|
|
35254
35341
|
|
|
35255
35342
|
// src/commands/refactor/restructure.ts
|
|
35256
35343
|
import fs37 from "fs";
|
|
35257
35344
|
import path82 from "path";
|
|
35258
|
-
import
|
|
35345
|
+
import chalk231 from "chalk";
|
|
35259
35346
|
|
|
35260
35347
|
// src/commands/refactor/restructure/buildPlan.ts
|
|
35261
35348
|
import path72 from "path";
|
|
@@ -35592,7 +35679,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
|
|
|
35592
35679
|
}
|
|
35593
35680
|
|
|
35594
35681
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
35595
|
-
import
|
|
35682
|
+
import chalk226 from "chalk";
|
|
35596
35683
|
|
|
35597
35684
|
// src/commands/refactor/restructure/applyCommand.ts
|
|
35598
35685
|
import path73 from "path";
|
|
@@ -35603,13 +35690,13 @@ function applyCommand(scopeRoot) {
|
|
|
35603
35690
|
|
|
35604
35691
|
// src/commands/refactor/restructure/displayDrift.ts
|
|
35605
35692
|
import path74 from "path";
|
|
35606
|
-
import
|
|
35693
|
+
import chalk222 from "chalk";
|
|
35607
35694
|
var shownMoves = 20;
|
|
35608
35695
|
function displayDrift(plan2, listMoves) {
|
|
35609
35696
|
const rel = (file) => path74.relative(process.cwd(), file);
|
|
35610
35697
|
if (plan2.moves.length > 0) {
|
|
35611
35698
|
console.log(
|
|
35612
|
-
|
|
35699
|
+
chalk222.red(
|
|
35613
35700
|
`${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
|
|
35614
35701
|
)
|
|
35615
35702
|
);
|
|
@@ -35617,17 +35704,17 @@ function displayDrift(plan2, listMoves) {
|
|
|
35617
35704
|
for (const move2 of plan2.moves.slice(0, shownMoves))
|
|
35618
35705
|
console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
|
|
35619
35706
|
if (plan2.moves.length > shownMoves)
|
|
35620
|
-
console.log(
|
|
35707
|
+
console.log(chalk222.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
|
|
35621
35708
|
}
|
|
35622
35709
|
}
|
|
35623
|
-
for (const error of plan2.errors) console.log(
|
|
35710
|
+
for (const error of plan2.errors) console.log(chalk222.red(error));
|
|
35624
35711
|
}
|
|
35625
35712
|
|
|
35626
35713
|
// src/commands/refactor/restructure/displayLayoutLimits.ts
|
|
35627
|
-
import
|
|
35714
|
+
import chalk225 from "chalk";
|
|
35628
35715
|
|
|
35629
35716
|
// src/commands/refactor/restructure/displayDeepChains.ts
|
|
35630
|
-
import
|
|
35717
|
+
import chalk223 from "chalk";
|
|
35631
35718
|
var shownChains = 10;
|
|
35632
35719
|
function formatChain(chain2) {
|
|
35633
35720
|
const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
|
|
@@ -35637,28 +35724,28 @@ function displayDeepChains(chains, maxDepth) {
|
|
|
35637
35724
|
if (chains.length === 0) return;
|
|
35638
35725
|
const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
|
|
35639
35726
|
console.log(
|
|
35640
|
-
|
|
35727
|
+
chalk223.red(
|
|
35641
35728
|
`
|
|
35642
35729
|
Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
|
|
35643
35730
|
)
|
|
35644
35731
|
);
|
|
35645
35732
|
console.log(
|
|
35646
|
-
|
|
35733
|
+
chalk223.bold(
|
|
35647
35734
|
"Deep chains, as folder (files beneath), most files too deep first:"
|
|
35648
35735
|
)
|
|
35649
35736
|
);
|
|
35650
35737
|
for (const chain2 of chains.slice(0, shownChains))
|
|
35651
35738
|
console.log(formatChain(chain2));
|
|
35652
35739
|
if (chains.length > shownChains)
|
|
35653
|
-
console.log(
|
|
35740
|
+
console.log(chalk223.dim(` \u2026and ${chains.length - shownChains} more`));
|
|
35654
35741
|
}
|
|
35655
35742
|
|
|
35656
35743
|
// src/commands/refactor/restructure/displayLongPaths.ts
|
|
35657
|
-
import
|
|
35744
|
+
import chalk224 from "chalk";
|
|
35658
35745
|
function displayLongPaths(longPaths, maxPathLength) {
|
|
35659
35746
|
if (longPaths.length === 0) return;
|
|
35660
35747
|
console.log(
|
|
35661
|
-
|
|
35748
|
+
chalk224.red(
|
|
35662
35749
|
`
|
|
35663
35750
|
Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
|
|
35664
35751
|
)
|
|
@@ -35686,7 +35773,7 @@ function displayLayoutLimits(limits, apply) {
|
|
|
35686
35773
|
displayDeepChains(limits.chains, limits.maxDepth);
|
|
35687
35774
|
displayLongPaths(limits.longPaths, limits.maxPathLength);
|
|
35688
35775
|
console.log("");
|
|
35689
|
-
for (const line of pinSteps(apply)) console.log(
|
|
35776
|
+
for (const line of pinSteps(apply)) console.log(chalk225.yellow(line));
|
|
35690
35777
|
}
|
|
35691
35778
|
|
|
35692
35779
|
// src/commands/refactor/restructure/checkPlan.ts
|
|
@@ -35698,14 +35785,14 @@ function checkPlan(plan2, limits) {
|
|
|
35698
35785
|
if (exceeds || plan2.errors.length > 0) process.exit(1);
|
|
35699
35786
|
if (plan2.moves.length > 0) {
|
|
35700
35787
|
console.log(
|
|
35701
|
-
|
|
35788
|
+
chalk226.yellow(
|
|
35702
35789
|
`
|
|
35703
35790
|
Run \`${apply}\` to move the files and rewrite their imports.`
|
|
35704
35791
|
)
|
|
35705
35792
|
);
|
|
35706
35793
|
process.exit(1);
|
|
35707
35794
|
}
|
|
35708
|
-
console.log(
|
|
35795
|
+
console.log(chalk226.green("Layout matches the restructure plan"));
|
|
35709
35796
|
}
|
|
35710
35797
|
|
|
35711
35798
|
// src/commands/refactor/restructure/findDeepChains.ts
|
|
@@ -35775,15 +35862,15 @@ function partitionIgnored(files) {
|
|
|
35775
35862
|
}
|
|
35776
35863
|
|
|
35777
35864
|
// src/commands/refactor/restructure/runPlan.ts
|
|
35778
|
-
import
|
|
35865
|
+
import chalk230 from "chalk";
|
|
35779
35866
|
|
|
35780
35867
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35781
|
-
import
|
|
35868
|
+
import chalk228 from "chalk";
|
|
35782
35869
|
|
|
35783
35870
|
// src/commands/refactor/restructure/executePlan.ts
|
|
35784
35871
|
import fs36 from "fs";
|
|
35785
35872
|
import path78 from "path";
|
|
35786
|
-
import
|
|
35873
|
+
import chalk227 from "chalk";
|
|
35787
35874
|
function relPath(file) {
|
|
35788
35875
|
return path78.relative(process.cwd(), file);
|
|
35789
35876
|
}
|
|
@@ -35800,14 +35887,14 @@ function moveFiles(moves) {
|
|
|
35800
35887
|
fs36.mkdirSync(path78.dirname(move2.to), { recursive: true });
|
|
35801
35888
|
fs36.renameSync(staging, move2.to);
|
|
35802
35889
|
console.log(
|
|
35803
|
-
|
|
35890
|
+
chalk227.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
|
|
35804
35891
|
);
|
|
35805
35892
|
}
|
|
35806
35893
|
}
|
|
35807
35894
|
function removeIfEmpty(dir) {
|
|
35808
35895
|
if (!fs36.existsSync(dir) || fs36.readdirSync(dir).length > 0) return false;
|
|
35809
35896
|
fs36.rmdirSync(dir);
|
|
35810
|
-
console.log(
|
|
35897
|
+
console.log(chalk227.dim(` Removed empty directory ${relPath(dir)}`));
|
|
35811
35898
|
return true;
|
|
35812
35899
|
}
|
|
35813
35900
|
function removeEmptyDirectories(dirs, scopeRoot) {
|
|
@@ -35820,7 +35907,7 @@ function removeEmptyDirectories(dirs, scopeRoot) {
|
|
|
35820
35907
|
function executePlan(plan2) {
|
|
35821
35908
|
for (const [file, content] of applyRewrites(plan2.rewrites)) {
|
|
35822
35909
|
fs36.writeFileSync(file, content, "utf8");
|
|
35823
|
-
console.log(
|
|
35910
|
+
console.log(chalk227.cyan(` Rewrote imports in ${relPath(file)}`));
|
|
35824
35911
|
}
|
|
35825
35912
|
moveFiles(plan2.moves);
|
|
35826
35913
|
removeEmptyDirectories(
|
|
@@ -35832,17 +35919,17 @@ function executePlan(plan2) {
|
|
|
35832
35919
|
// src/commands/refactor/restructure/applyPlan.ts
|
|
35833
35920
|
function applyPlan(plan2) {
|
|
35834
35921
|
if (plan2.errors.length > 0) {
|
|
35835
|
-
console.log(
|
|
35922
|
+
console.log(chalk228.red("\nResolve the errors above before applying."));
|
|
35836
35923
|
process.exit(1);
|
|
35837
35924
|
}
|
|
35838
|
-
console.log(
|
|
35925
|
+
console.log(chalk228.bold("\nApplying changes..."));
|
|
35839
35926
|
executePlan(plan2);
|
|
35840
|
-
console.log(
|
|
35927
|
+
console.log(chalk228.green("\nRestructuring complete"));
|
|
35841
35928
|
}
|
|
35842
35929
|
|
|
35843
35930
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
35844
35931
|
import path81 from "path";
|
|
35845
|
-
import
|
|
35932
|
+
import chalk229 from "chalk";
|
|
35846
35933
|
|
|
35847
35934
|
// src/commands/refactor/restructure/computeDepthStats.ts
|
|
35848
35935
|
import path79 from "path";
|
|
@@ -35893,17 +35980,17 @@ function relPath2(filePath) {
|
|
|
35893
35980
|
}
|
|
35894
35981
|
function displayMoves(plan2) {
|
|
35895
35982
|
if (plan2.moves.length === 0) return;
|
|
35896
|
-
console.log(
|
|
35983
|
+
console.log(chalk229.bold("\nFile moves:"));
|
|
35897
35984
|
for (const move2 of plan2.moves) {
|
|
35898
35985
|
console.log(
|
|
35899
|
-
` ${
|
|
35986
|
+
` ${chalk229.red(relPath2(move2.from))} \u2192 ${chalk229.green(relPath2(move2.to))}`
|
|
35900
35987
|
);
|
|
35901
|
-
console.log(
|
|
35988
|
+
console.log(chalk229.dim(` ${move2.reason}`));
|
|
35902
35989
|
}
|
|
35903
35990
|
}
|
|
35904
35991
|
function displayTree(plan2) {
|
|
35905
35992
|
console.log(
|
|
35906
|
-
|
|
35993
|
+
chalk229.bold(`
|
|
35907
35994
|
Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
|
|
35908
35995
|
);
|
|
35909
35996
|
for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
|
|
@@ -35914,15 +36001,15 @@ function displayDepthStats(plan2) {
|
|
|
35914
36001
|
plan2.targets.values(),
|
|
35915
36002
|
plan2.scopeRoot
|
|
35916
36003
|
);
|
|
35917
|
-
console.log(
|
|
36004
|
+
console.log(chalk229.bold(`
|
|
35918
36005
|
Depth (max ${max}):`));
|
|
35919
36006
|
for (const depth of [...distribution.keys()].sort((a, b) => a - b))
|
|
35920
36007
|
console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
|
|
35921
36008
|
}
|
|
35922
36009
|
function displayErrors(errors) {
|
|
35923
36010
|
if (errors.length === 0) return;
|
|
35924
|
-
console.log(
|
|
35925
|
-
for (const error of errors) console.log(
|
|
36011
|
+
console.log(chalk229.red("\nErrors:"));
|
|
36012
|
+
for (const error of errors) console.log(chalk229.red(` ${error}`));
|
|
35926
36013
|
}
|
|
35927
36014
|
function displayPlan2(plan2) {
|
|
35928
36015
|
displayMoves(plan2);
|
|
@@ -35931,7 +36018,7 @@ function displayPlan2(plan2) {
|
|
|
35931
36018
|
displayErrors(plan2.errors);
|
|
35932
36019
|
const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
|
|
35933
36020
|
console.log(
|
|
35934
|
-
|
|
36021
|
+
chalk229.dim(
|
|
35935
36022
|
`
|
|
35936
36023
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
|
|
35937
36024
|
)
|
|
@@ -35943,11 +36030,11 @@ function runPlan(plan2, limits, apply) {
|
|
|
35943
36030
|
displayPlan2(plan2);
|
|
35944
36031
|
displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
|
|
35945
36032
|
if (plan2.moves.length === 0 && plan2.errors.length === 0) {
|
|
35946
|
-
console.log(
|
|
36033
|
+
console.log(chalk230.green("No restructuring needed"));
|
|
35947
36034
|
return;
|
|
35948
36035
|
}
|
|
35949
36036
|
if (!apply) {
|
|
35950
|
-
console.log(
|
|
36037
|
+
console.log(chalk230.dim("\nDry run. Use --apply to execute."));
|
|
35951
36038
|
return;
|
|
35952
36039
|
}
|
|
35953
36040
|
applyPlan(plan2);
|
|
@@ -35957,14 +36044,14 @@ function runPlan(plan2, limits, apply) {
|
|
|
35957
36044
|
async function restructure(root2, options2 = {}) {
|
|
35958
36045
|
const scopeRoot = path82.resolve(root2 ?? "src");
|
|
35959
36046
|
if (!fs37.existsSync(scopeRoot) || !fs37.statSync(scopeRoot).isDirectory()) {
|
|
35960
|
-
console.log(
|
|
36047
|
+
console.log(chalk231.red(`Not a directory: ${root2 ?? "src"}`));
|
|
35961
36048
|
process.exit(1);
|
|
35962
36049
|
}
|
|
35963
36050
|
const found = [];
|
|
35964
36051
|
walkSourceFiles(scopeRoot, found);
|
|
35965
36052
|
const { scoped, ignored } = partitionIgnored(found);
|
|
35966
36053
|
if (scoped.length === 0) {
|
|
35967
|
-
console.log(
|
|
36054
|
+
console.log(chalk231.yellow("No files found under root"));
|
|
35968
36055
|
return;
|
|
35969
36056
|
}
|
|
35970
36057
|
const {
|
|
@@ -36035,7 +36122,7 @@ async function checkoutPrSession(number, prompt = "") {
|
|
|
36035
36122
|
}
|
|
36036
36123
|
|
|
36037
36124
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
36038
|
-
import
|
|
36125
|
+
import chalk235 from "chalk";
|
|
36039
36126
|
|
|
36040
36127
|
// src/commands/config/promptConfigScope.ts
|
|
36041
36128
|
import Enquirer3 from "enquirer";
|
|
@@ -36061,7 +36148,7 @@ async function promptConfigScope() {
|
|
|
36061
36148
|
}
|
|
36062
36149
|
|
|
36063
36150
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
36064
|
-
import
|
|
36151
|
+
import chalk232 from "chalk";
|
|
36065
36152
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
36066
36153
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
36067
36154
|
for (; ; ) {
|
|
@@ -36069,7 +36156,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
36069
36156
|
if (answer === "") return void 0;
|
|
36070
36157
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
36071
36158
|
if (coercion.ok) return coercion.value;
|
|
36072
|
-
console.error(
|
|
36159
|
+
console.error(chalk232.red(coercion.error));
|
|
36073
36160
|
}
|
|
36074
36161
|
}
|
|
36075
36162
|
function coerceSupplied(key, supplied) {
|
|
@@ -36149,7 +36236,7 @@ function suggestGlobs(current, proposed) {
|
|
|
36149
36236
|
}
|
|
36150
36237
|
|
|
36151
36238
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
36152
|
-
import
|
|
36239
|
+
import chalk233 from "chalk";
|
|
36153
36240
|
function parseConfigureAnswers(answers) {
|
|
36154
36241
|
const known = Object.values(highLevelConfigKeys);
|
|
36155
36242
|
const parsed = {};
|
|
@@ -36167,13 +36254,13 @@ function answersCoverEveryKey(answers) {
|
|
|
36167
36254
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
36168
36255
|
}
|
|
36169
36256
|
function exitWith(message3) {
|
|
36170
|
-
console.error(
|
|
36257
|
+
console.error(chalk233.red(`Error: ${message3}.`));
|
|
36171
36258
|
process.exit(1);
|
|
36172
36259
|
}
|
|
36173
36260
|
|
|
36174
36261
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
36175
36262
|
import { execFileSync as execFileSync28 } from "child_process";
|
|
36176
|
-
import
|
|
36263
|
+
import chalk234 from "chalk";
|
|
36177
36264
|
|
|
36178
36265
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
36179
36266
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -36222,7 +36309,7 @@ function readGlobs(value) {
|
|
|
36222
36309
|
|
|
36223
36310
|
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
36224
36311
|
import { execFileSync as execFileSync27 } from "child_process";
|
|
36225
|
-
import { dirname as
|
|
36312
|
+
import { dirname as dirname39, extname as extname6 } from "path";
|
|
36226
36313
|
var MAX_DIRECTORIES = 200;
|
|
36227
36314
|
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
36228
36315
|
function summariseRepoTree(cwd = process.cwd()) {
|
|
@@ -36249,7 +36336,7 @@ function listTrackedFiles(cwd) {
|
|
|
36249
36336
|
function countByDirectory(files) {
|
|
36250
36337
|
const directories = /* @__PURE__ */ new Map();
|
|
36251
36338
|
for (const file of files) {
|
|
36252
|
-
const directory =
|
|
36339
|
+
const directory = dirname39(file) === "." ? "(repo root)" : dirname39(file);
|
|
36253
36340
|
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
36254
36341
|
const extension2 = extname6(file) === "" ? "(no extension)" : extname6(file);
|
|
36255
36342
|
extensions.set(extension2, (extensions.get(extension2) ?? 0) + 1);
|
|
@@ -36267,12 +36354,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
36267
36354
|
const tree = summariseRepoTree(cwd);
|
|
36268
36355
|
if (tree === "") return NOTHING_PROPOSED;
|
|
36269
36356
|
console.log(
|
|
36270
|
-
|
|
36357
|
+
chalk234.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
36271
36358
|
);
|
|
36272
36359
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
36273
36360
|
if (output === void 0) {
|
|
36274
36361
|
console.log(
|
|
36275
|
-
|
|
36362
|
+
chalk234.yellow(
|
|
36276
36363
|
"Claude proposed nothing; answer each key from its current value."
|
|
36277
36364
|
)
|
|
36278
36365
|
);
|
|
@@ -36336,14 +36423,14 @@ function asConfigKeyScope(value) {
|
|
|
36336
36423
|
function reportConfigured(result) {
|
|
36337
36424
|
for (const write of result.written)
|
|
36338
36425
|
console.log(
|
|
36339
|
-
|
|
36426
|
+
chalk235.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
36340
36427
|
);
|
|
36341
|
-
for (const key of result.skipped) console.log(
|
|
36342
|
-
console.log(
|
|
36428
|
+
for (const key of result.skipped) console.log(chalk235.dim(`Left ${key} unset`));
|
|
36429
|
+
console.log(chalk235.dim(`Written to ${result.target}`));
|
|
36343
36430
|
}
|
|
36344
36431
|
|
|
36345
36432
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
36346
|
-
import
|
|
36433
|
+
import chalk236 from "chalk";
|
|
36347
36434
|
function savedMessage(subject) {
|
|
36348
36435
|
const head = subject.headSha.slice(0, 7);
|
|
36349
36436
|
if (subject.draft)
|
|
@@ -36354,10 +36441,10 @@ function savedMessage(subject) {
|
|
|
36354
36441
|
}
|
|
36355
36442
|
function announceSavedReview(subject, force) {
|
|
36356
36443
|
const message3 = savedMessage(subject);
|
|
36357
|
-
if (message3) console.log(
|
|
36444
|
+
if (message3) console.log(chalk236.dim(message3));
|
|
36358
36445
|
else if (force)
|
|
36359
36446
|
console.log(
|
|
36360
|
-
|
|
36447
|
+
chalk236.dim(
|
|
36361
36448
|
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
36362
36449
|
)
|
|
36363
36450
|
);
|
|
@@ -36982,12 +37069,12 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36982
37069
|
}
|
|
36983
37070
|
|
|
36984
37071
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36985
|
-
import { join as
|
|
37072
|
+
import { join as join85 } from "path";
|
|
36986
37073
|
function slug(value) {
|
|
36987
37074
|
return value.replace(/[^\w.-]+/g, "-");
|
|
36988
37075
|
}
|
|
36989
37076
|
function highLevelReviewPath(repo, headRef, headSha) {
|
|
36990
|
-
return
|
|
37077
|
+
return join85(
|
|
36991
37078
|
getStoreDir(),
|
|
36992
37079
|
"high-level-reviews",
|
|
36993
37080
|
slug(repo),
|
|
@@ -37159,11 +37246,11 @@ function clearHighLevelDraft(repo, headRef, headSha) {
|
|
|
37159
37246
|
}
|
|
37160
37247
|
|
|
37161
37248
|
// src/commands/review/highLevel/writeJsonFile.ts
|
|
37162
|
-
import { mkdirSync as
|
|
37163
|
-
import { dirname as
|
|
37249
|
+
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync40 } from "fs";
|
|
37250
|
+
import { dirname as dirname40 } from "path";
|
|
37164
37251
|
function writeJsonFile(path108, data) {
|
|
37165
|
-
|
|
37166
|
-
|
|
37252
|
+
mkdirSync25(dirname40(path108), { recursive: true });
|
|
37253
|
+
writeFileSync40(path108, `${JSON.stringify(data, null, 2)}
|
|
37167
37254
|
`);
|
|
37168
37255
|
return path108;
|
|
37169
37256
|
}
|
|
@@ -37452,55 +37539,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
37452
37539
|
}
|
|
37453
37540
|
|
|
37454
37541
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37455
|
-
import
|
|
37542
|
+
import chalk241 from "chalk";
|
|
37456
37543
|
|
|
37457
37544
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
37458
|
-
import
|
|
37545
|
+
import chalk237 from "chalk";
|
|
37459
37546
|
var PATCH_LINE_COLOURS = {
|
|
37460
|
-
"+":
|
|
37461
|
-
"-":
|
|
37462
|
-
"@":
|
|
37547
|
+
"+": chalk237.green,
|
|
37548
|
+
"-": chalk237.red,
|
|
37549
|
+
"@": chalk237.cyan
|
|
37463
37550
|
};
|
|
37464
37551
|
function formatPatch(patch2) {
|
|
37465
37552
|
return patch2.split("\n").map(
|
|
37466
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
37553
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk237.dim)(line)}`
|
|
37467
37554
|
);
|
|
37468
37555
|
}
|
|
37469
37556
|
function formatDiff(diff3) {
|
|
37470
37557
|
return [
|
|
37471
37558
|
"",
|
|
37472
|
-
` ${
|
|
37473
|
-
...diff3.patch === null ? [` ${
|
|
37559
|
+
` ${chalk237.bold(diff3.path)} ${chalk237.dim(`(${diff3.status})`)} ${chalk237.green(`+${diff3.additions}`)} ${chalk237.red(`-${diff3.deletions}`)}`,
|
|
37560
|
+
...diff3.patch === null ? [` ${chalk237.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
37474
37561
|
];
|
|
37475
37562
|
}
|
|
37476
37563
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
37477
37564
|
if (criticalPaths.length === 0)
|
|
37478
|
-
return `${
|
|
37479
|
-
${
|
|
37565
|
+
return `${chalk237.bold.underline("Critical diffs")}
|
|
37566
|
+
${chalk237.dim("review.highLevel.criticalPaths is empty, so no diffs are shown")}`;
|
|
37480
37567
|
if (diffs.length === 0)
|
|
37481
|
-
return `${
|
|
37482
|
-
${
|
|
37568
|
+
return `${chalk237.bold.underline("Critical diffs")}
|
|
37569
|
+
${chalk237.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
37483
37570
|
return [
|
|
37484
|
-
|
|
37571
|
+
chalk237.bold.underline("Critical diffs"),
|
|
37485
37572
|
...diffs.flatMap(formatDiff)
|
|
37486
37573
|
].join("\n");
|
|
37487
37574
|
}
|
|
37488
37575
|
|
|
37489
37576
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
37490
|
-
import
|
|
37577
|
+
import chalk238 from "chalk";
|
|
37491
37578
|
var MARKERS = {
|
|
37492
|
-
pass: () =>
|
|
37493
|
-
fail: () =>
|
|
37494
|
-
manual: () =>
|
|
37579
|
+
pass: () => chalk238.green("\u2714"),
|
|
37580
|
+
fail: () => chalk238.red("\u2718"),
|
|
37581
|
+
manual: () => chalk238.yellow("\u25A1")
|
|
37495
37582
|
};
|
|
37496
37583
|
function formatCheck(check2) {
|
|
37497
|
-
const title = check2.status === "fail" ?
|
|
37584
|
+
const title = check2.status === "fail" ? chalk238.red(check2.title) : chalk238.bold(check2.title);
|
|
37498
37585
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
37499
|
-
${
|
|
37586
|
+
${chalk238.dim(check2.reason)}`;
|
|
37500
37587
|
}
|
|
37501
37588
|
function formatGroup(heading2, checks2) {
|
|
37502
37589
|
if (checks2.length === 0) return [];
|
|
37503
|
-
return ["",
|
|
37590
|
+
return ["", chalk238.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
37504
37591
|
}
|
|
37505
37592
|
function formatHighLevelChecklist(checks2) {
|
|
37506
37593
|
const deterministic = checks2.filter(
|
|
@@ -37509,7 +37596,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37509
37596
|
const failed3 = deterministic.filter(
|
|
37510
37597
|
(check2) => check2.status === "fail"
|
|
37511
37598
|
).length;
|
|
37512
|
-
const summary = failed3 === 0 ?
|
|
37599
|
+
const summary = failed3 === 0 ? chalk238.green(`All ${deterministic.length} deterministic checks pass`) : chalk238.red(
|
|
37513
37600
|
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
37514
37601
|
);
|
|
37515
37602
|
return [
|
|
@@ -37524,37 +37611,37 @@ function formatHighLevelChecklist(checks2) {
|
|
|
37524
37611
|
}
|
|
37525
37612
|
|
|
37526
37613
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
37527
|
-
import
|
|
37614
|
+
import chalk239 from "chalk";
|
|
37528
37615
|
var STATUS_MARKERS = {
|
|
37529
|
-
added: () =>
|
|
37530
|
-
removed: () =>
|
|
37531
|
-
modified: () =>
|
|
37616
|
+
added: () => chalk239.green("A"),
|
|
37617
|
+
removed: () => chalk239.red("D"),
|
|
37618
|
+
modified: () => chalk239.yellow("M")
|
|
37532
37619
|
};
|
|
37533
37620
|
function counts(additions, deletions) {
|
|
37534
|
-
return `${
|
|
37621
|
+
return `${chalk239.green(`+${additions}`)} ${chalk239.red(`-${deletions}`)}`;
|
|
37535
37622
|
}
|
|
37536
37623
|
function formatNode(node, indent3) {
|
|
37537
37624
|
if (node.kind === "file")
|
|
37538
37625
|
return [
|
|
37539
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
37626
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk239.dim(counts(node.additions, node.deletions))}`
|
|
37540
37627
|
];
|
|
37541
37628
|
const dir = node;
|
|
37542
37629
|
return [
|
|
37543
|
-
`${indent3}${
|
|
37630
|
+
`${indent3}${chalk239.bold(`${dir.name}/`)} ${chalk239.dim(counts(dir.additions, dir.deletions))}`,
|
|
37544
37631
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
37545
37632
|
];
|
|
37546
37633
|
}
|
|
37547
37634
|
function formatHighLevelStructure(structure) {
|
|
37548
37635
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
37549
37636
|
return [
|
|
37550
|
-
|
|
37637
|
+
chalk239.bold.underline("Structure"),
|
|
37551
37638
|
` ${summary}`,
|
|
37552
37639
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
37553
37640
|
].join("\n");
|
|
37554
37641
|
}
|
|
37555
37642
|
|
|
37556
37643
|
// src/commands/review/highLevel/formatHighLevelTests.ts
|
|
37557
|
-
import
|
|
37644
|
+
import chalk240 from "chalk";
|
|
37558
37645
|
function changeMarker(change) {
|
|
37559
37646
|
if (change === "added") return "A";
|
|
37560
37647
|
if (change === "modified") return "M";
|
|
@@ -37563,22 +37650,22 @@ function changeMarker(change) {
|
|
|
37563
37650
|
function formatNode2(node, depth) {
|
|
37564
37651
|
const indent3 = " ".repeat(depth + 2);
|
|
37565
37652
|
if (node.kind === "it")
|
|
37566
|
-
return [`${indent3}${
|
|
37653
|
+
return [`${indent3}${chalk240.dim(changeMarker(node.change))} ${node.name}`];
|
|
37567
37654
|
return [
|
|
37568
|
-
`${indent3}${
|
|
37655
|
+
`${indent3}${chalk240.bold(node.name)}`,
|
|
37569
37656
|
...node.children.flatMap((child) => formatNode2(child, depth + 1))
|
|
37570
37657
|
];
|
|
37571
37658
|
}
|
|
37572
37659
|
function formatHighLevelTests(files, testPaths) {
|
|
37573
|
-
const heading2 =
|
|
37660
|
+
const heading2 = chalk240.bold.underline("Changed tests");
|
|
37574
37661
|
if (files.length === 0)
|
|
37575
37662
|
return `${heading2}
|
|
37576
|
-
${
|
|
37663
|
+
${chalk240.dim(`no changed test in files matching ${testPaths.join(", ")}`)}`;
|
|
37577
37664
|
return [
|
|
37578
37665
|
heading2,
|
|
37579
37666
|
...files.flatMap((file) => [
|
|
37580
37667
|
"",
|
|
37581
|
-
` ${
|
|
37668
|
+
` ${chalk240.bold(file.path)} ${chalk240.dim(`(${file.status})`)}`,
|
|
37582
37669
|
...file.tests.flatMap((node) => formatNode2(node, 0))
|
|
37583
37670
|
])
|
|
37584
37671
|
].join("\n");
|
|
@@ -37592,10 +37679,10 @@ function highLevelChangedFileCount(structure) {
|
|
|
37592
37679
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
37593
37680
|
function printHighLevelChecklist(subject) {
|
|
37594
37681
|
console.log(
|
|
37595
|
-
|
|
37682
|
+
chalk241.bold(
|
|
37596
37683
|
`High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
|
|
37597
37684
|
),
|
|
37598
|
-
|
|
37685
|
+
chalk241.dim(
|
|
37599
37686
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
37600
37687
|
)
|
|
37601
37688
|
);
|
|
@@ -37609,12 +37696,12 @@ function printHighLevelChecklist(subject) {
|
|
|
37609
37696
|
console.log("");
|
|
37610
37697
|
console.log(formatHighLevelTests(subject.tests, subject.testPaths));
|
|
37611
37698
|
console.log(
|
|
37612
|
-
|
|
37699
|
+
chalk241.dim(
|
|
37613
37700
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
37614
37701
|
)
|
|
37615
37702
|
);
|
|
37616
37703
|
console.log(
|
|
37617
|
-
|
|
37704
|
+
chalk241.dim(
|
|
37618
37705
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
37619
37706
|
)
|
|
37620
37707
|
);
|
|
@@ -37900,18 +37987,18 @@ function partitionFindingsByDiff(findings, index2) {
|
|
|
37900
37987
|
}
|
|
37901
37988
|
|
|
37902
37989
|
// src/commands/review/warnOutOfDiff.ts
|
|
37903
|
-
import
|
|
37990
|
+
import chalk242 from "chalk";
|
|
37904
37991
|
function warnOutOfDiff(outOfDiff) {
|
|
37905
37992
|
if (outOfDiff.length === 0) return;
|
|
37906
37993
|
console.warn(
|
|
37907
|
-
|
|
37994
|
+
chalk242.yellow(
|
|
37908
37995
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
37909
37996
|
)
|
|
37910
37997
|
);
|
|
37911
37998
|
for (const finding of outOfDiff) {
|
|
37912
37999
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
37913
38000
|
console.warn(
|
|
37914
|
-
` ${
|
|
38001
|
+
` ${chalk242.yellow("\xB7")} ${finding.title} ${chalk242.dim(
|
|
37915
38002
|
`(${finding.file}:${range})`
|
|
37916
38003
|
)}`
|
|
37917
38004
|
);
|
|
@@ -37935,18 +38022,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
37935
38022
|
}
|
|
37936
38023
|
|
|
37937
38024
|
// src/commands/review/warnUnlocated.ts
|
|
37938
|
-
import
|
|
38025
|
+
import chalk243 from "chalk";
|
|
37939
38026
|
function warnUnlocated(unlocated) {
|
|
37940
38027
|
if (unlocated.length === 0) return;
|
|
37941
38028
|
console.warn(
|
|
37942
|
-
|
|
38029
|
+
chalk243.yellow(
|
|
37943
38030
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
37944
38031
|
)
|
|
37945
38032
|
);
|
|
37946
38033
|
for (const finding of unlocated) {
|
|
37947
|
-
const where = finding.location ||
|
|
38034
|
+
const where = finding.location || chalk243.dim("missing");
|
|
37948
38035
|
console.warn(
|
|
37949
|
-
` ${
|
|
38036
|
+
` ${chalk243.yellow("\xB7")} ${finding.title} ${chalk243.dim(`(${where})`)}`
|
|
37950
38037
|
);
|
|
37951
38038
|
}
|
|
37952
38039
|
}
|
|
@@ -38145,8 +38232,8 @@ function renderEntry(entry, frame) {
|
|
|
38145
38232
|
import { format as format2 } from "util";
|
|
38146
38233
|
|
|
38147
38234
|
// src/commands/review/createReviewLogSink.ts
|
|
38148
|
-
import { appendFileSync as appendFileSync4, mkdirSync as
|
|
38149
|
-
import { join as
|
|
38235
|
+
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync26 } from "fs";
|
|
38236
|
+
import { join as join86 } from "path";
|
|
38150
38237
|
var LOG_FILE = "review.log";
|
|
38151
38238
|
function createReviewLogSink() {
|
|
38152
38239
|
let logPath2;
|
|
@@ -38162,8 +38249,8 @@ function createReviewLogSink() {
|
|
|
38162
38249
|
`);
|
|
38163
38250
|
},
|
|
38164
38251
|
attach(reviewDir) {
|
|
38165
|
-
|
|
38166
|
-
logPath2 =
|
|
38252
|
+
mkdirSync26(reviewDir, { recursive: true });
|
|
38253
|
+
logPath2 = join86(reviewDir, LOG_FILE);
|
|
38167
38254
|
const lines2 = [
|
|
38168
38255
|
"",
|
|
38169
38256
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
@@ -38413,7 +38500,7 @@ function buildCodexModelArgs() {
|
|
|
38413
38500
|
}
|
|
38414
38501
|
|
|
38415
38502
|
// src/commands/review/runClaudeReviewer.ts
|
|
38416
|
-
import { writeFileSync as
|
|
38503
|
+
import { writeFileSync as writeFileSync41 } from "fs";
|
|
38417
38504
|
|
|
38418
38505
|
// src/commands/review/formatToolSummary.ts
|
|
38419
38506
|
function truncate2(value, max = 80) {
|
|
@@ -38852,7 +38939,7 @@ async function runClaudeReviewer(spec) {
|
|
|
38852
38939
|
onLine
|
|
38853
38940
|
});
|
|
38854
38941
|
if (result.exitCode === 0 && state.finalText)
|
|
38855
|
-
|
|
38942
|
+
writeFileSync41(spec.outputPath, state.finalText);
|
|
38856
38943
|
const finalised = finaliseReviewerRun(
|
|
38857
38944
|
{ ...spec, command, model: override?.model },
|
|
38858
38945
|
spinner,
|
|
@@ -39377,11 +39464,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
|
|
|
39377
39464
|
}
|
|
39378
39465
|
|
|
39379
39466
|
// src/commands/review/buildReviewPaths.ts
|
|
39380
|
-
import { homedir as
|
|
39381
|
-
import { basename as basename24, join as
|
|
39467
|
+
import { homedir as homedir26 } from "os";
|
|
39468
|
+
import { basename as basename24, join as join87 } from "path";
|
|
39382
39469
|
function buildReviewPaths(repoRoot2, key) {
|
|
39383
|
-
const reviewDir =
|
|
39384
|
-
|
|
39470
|
+
const reviewDir = join87(
|
|
39471
|
+
homedir26(),
|
|
39385
39472
|
".assist",
|
|
39386
39473
|
"reviews",
|
|
39387
39474
|
basename24(repoRoot2),
|
|
@@ -39389,10 +39476,10 @@ function buildReviewPaths(repoRoot2, key) {
|
|
|
39389
39476
|
);
|
|
39390
39477
|
return {
|
|
39391
39478
|
reviewDir,
|
|
39392
|
-
requestPath:
|
|
39393
|
-
claudePath:
|
|
39394
|
-
codexPath:
|
|
39395
|
-
synthesisPath:
|
|
39479
|
+
requestPath: join87(reviewDir, "request.md"),
|
|
39480
|
+
claudePath: join87(reviewDir, "claude.md"),
|
|
39481
|
+
codexPath: join87(reviewDir, "codex.md"),
|
|
39482
|
+
synthesisPath: join87(reviewDir, "synthesis.md")
|
|
39396
39483
|
};
|
|
39397
39484
|
}
|
|
39398
39485
|
|
|
@@ -39430,16 +39517,16 @@ function fetchExistingComments() {
|
|
|
39430
39517
|
}
|
|
39431
39518
|
|
|
39432
39519
|
// src/commands/review/prepareReviewDir.ts
|
|
39433
|
-
import { existsSync as existsSync69, mkdirSync as
|
|
39520
|
+
import { existsSync as existsSync69, mkdirSync as mkdirSync27, unlinkSync as unlinkSync18, writeFileSync as writeFileSync42 } from "fs";
|
|
39434
39521
|
function clearReviewFiles(paths) {
|
|
39435
39522
|
for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
39436
39523
|
if (existsSync69(path108)) unlinkSync18(path108);
|
|
39437
39524
|
}
|
|
39438
39525
|
}
|
|
39439
39526
|
function prepareReviewDir(paths, requestBody, force) {
|
|
39440
|
-
|
|
39527
|
+
mkdirSync27(paths.reviewDir, { recursive: true });
|
|
39441
39528
|
if (force) clearReviewFiles(paths);
|
|
39442
|
-
|
|
39529
|
+
writeFileSync42(paths.requestPath, requestBody);
|
|
39443
39530
|
}
|
|
39444
39531
|
|
|
39445
39532
|
// src/commands/review/setupReviewDir.ts
|
|
@@ -40087,9 +40174,9 @@ function registerReview(program) {
|
|
|
40087
40174
|
}
|
|
40088
40175
|
|
|
40089
40176
|
// src/commands/rules/addRule.ts
|
|
40090
|
-
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as
|
|
40177
|
+
import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync44 } from "fs";
|
|
40091
40178
|
import path87 from "path";
|
|
40092
|
-
import
|
|
40179
|
+
import chalk244 from "chalk";
|
|
40093
40180
|
|
|
40094
40181
|
// src/commands/rules/insertRuleBullet.ts
|
|
40095
40182
|
function ruleBullet({ code, title, text: text17 }) {
|
|
@@ -40162,7 +40249,7 @@ function resolveRuleScope(target) {
|
|
|
40162
40249
|
}
|
|
40163
40250
|
|
|
40164
40251
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
40165
|
-
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as
|
|
40252
|
+
import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
40166
40253
|
import path86 from "path";
|
|
40167
40254
|
|
|
40168
40255
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
@@ -40214,7 +40301,7 @@ function updateScopedRulesIndex(root2) {
|
|
|
40214
40301
|
const rootFile = path86.join(root2, "CLAUDE.md");
|
|
40215
40302
|
const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
|
|
40216
40303
|
const after = upsertScopedRulesPointer(before, directories);
|
|
40217
|
-
if (after !== before)
|
|
40304
|
+
if (after !== before) writeFileSync43(rootFile, after);
|
|
40218
40305
|
return directories;
|
|
40219
40306
|
}
|
|
40220
40307
|
|
|
@@ -40225,7 +40312,7 @@ function read2(file) {
|
|
|
40225
40312
|
function addRule(text17, options2) {
|
|
40226
40313
|
const rule = text17.trim();
|
|
40227
40314
|
if (rule === "") {
|
|
40228
|
-
console.error(
|
|
40315
|
+
console.error(chalk244.red("Rule text is required"));
|
|
40229
40316
|
process.exitCode = 1;
|
|
40230
40317
|
return;
|
|
40231
40318
|
}
|
|
@@ -40233,7 +40320,7 @@ function addRule(text17, options2) {
|
|
|
40233
40320
|
const targetDir = path87.dirname(target);
|
|
40234
40321
|
const root2 = findRepoRoot(targetDir) ?? targetDir;
|
|
40235
40322
|
const code = nextRuleCode(root2);
|
|
40236
|
-
|
|
40323
|
+
writeFileSync44(
|
|
40237
40324
|
target,
|
|
40238
40325
|
insertRuleBullet(read2(target), {
|
|
40239
40326
|
code,
|
|
@@ -40243,13 +40330,13 @@ function addRule(text17, options2) {
|
|
|
40243
40330
|
);
|
|
40244
40331
|
updateScopedRulesIndex(root2);
|
|
40245
40332
|
console.log(
|
|
40246
|
-
`Added ${
|
|
40333
|
+
`Added ${chalk244.cyan(code)} to ${path87.relative(process.cwd(), target) || target}`
|
|
40247
40334
|
);
|
|
40248
40335
|
}
|
|
40249
40336
|
|
|
40250
40337
|
// src/commands/rules/indexRules.ts
|
|
40251
40338
|
import path88 from "path";
|
|
40252
|
-
import
|
|
40339
|
+
import chalk245 from "chalk";
|
|
40253
40340
|
function indexRules() {
|
|
40254
40341
|
const startDir = scopeDirectory(process.cwd());
|
|
40255
40342
|
const root2 = findRepoRoot(startDir) ?? startDir;
|
|
@@ -40257,24 +40344,24 @@ function indexRules() {
|
|
|
40257
40344
|
const rootFile = path88.relative(process.cwd(), path88.join(root2, "CLAUDE.md"));
|
|
40258
40345
|
if (directories.length === 0) {
|
|
40259
40346
|
console.log(
|
|
40260
|
-
|
|
40347
|
+
chalk245.gray(`No directories carry their own \`## Rules\` under ${root2}`)
|
|
40261
40348
|
);
|
|
40262
40349
|
return;
|
|
40263
40350
|
}
|
|
40264
40351
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
40265
40352
|
for (const directory of directories)
|
|
40266
|
-
console.log(` ${
|
|
40353
|
+
console.log(` ${chalk245.cyan(directory)}`);
|
|
40267
40354
|
}
|
|
40268
40355
|
|
|
40269
40356
|
// src/commands/rules/listRules.ts
|
|
40270
40357
|
import path89 from "path";
|
|
40271
|
-
import
|
|
40358
|
+
import chalk246 from "chalk";
|
|
40272
40359
|
function listRules(target, options2 = {}) {
|
|
40273
40360
|
const resolved = path89.resolve(target ?? process.cwd());
|
|
40274
40361
|
const rules2 = readScopedRules(resolved);
|
|
40275
40362
|
if (rules2.length === 0) {
|
|
40276
40363
|
const label2 = path89.relative(process.cwd(), resolved) || ".";
|
|
40277
|
-
console.log(
|
|
40364
|
+
console.log(chalk246.gray(`No rules in scope for ${label2}`));
|
|
40278
40365
|
return;
|
|
40279
40366
|
}
|
|
40280
40367
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -40284,14 +40371,14 @@ function listRules(target, options2 = {}) {
|
|
|
40284
40371
|
if (rule.source !== shown) {
|
|
40285
40372
|
shown = rule.source;
|
|
40286
40373
|
console.log(
|
|
40287
|
-
|
|
40374
|
+
chalk246.dim(base ? path89.relative(base, rule.source) : rule.source)
|
|
40288
40375
|
);
|
|
40289
40376
|
}
|
|
40290
40377
|
console.log(
|
|
40291
|
-
` ${
|
|
40378
|
+
` ${chalk246.cyan(rule.code.padEnd(width2))} ${rule.title ?? rule.text}`
|
|
40292
40379
|
);
|
|
40293
40380
|
if (options2.full && rule.title)
|
|
40294
|
-
console.log(` ${" ".repeat(width2)} ${
|
|
40381
|
+
console.log(` ${" ".repeat(width2)} ${chalk246.dim(rule.text)}`);
|
|
40295
40382
|
}
|
|
40296
40383
|
}
|
|
40297
40384
|
|
|
@@ -40326,7 +40413,7 @@ function registerRules(program) {
|
|
|
40326
40413
|
}
|
|
40327
40414
|
|
|
40328
40415
|
// src/commands/seq/seqAuth.ts
|
|
40329
|
-
import
|
|
40416
|
+
import chalk248 from "chalk";
|
|
40330
40417
|
|
|
40331
40418
|
// src/commands/seq/loadConnections.ts
|
|
40332
40419
|
function loadConnections2() {
|
|
@@ -40355,10 +40442,10 @@ function setDefaultConnection(name) {
|
|
|
40355
40442
|
}
|
|
40356
40443
|
|
|
40357
40444
|
// src/shared/assertUniqueName.ts
|
|
40358
|
-
import
|
|
40445
|
+
import chalk247 from "chalk";
|
|
40359
40446
|
function assertUniqueName(existingNames, name) {
|
|
40360
40447
|
if (existingNames.includes(name)) {
|
|
40361
|
-
console.error(
|
|
40448
|
+
console.error(chalk247.red(`Connection "${name}" already exists.`));
|
|
40362
40449
|
process.exit(1);
|
|
40363
40450
|
}
|
|
40364
40451
|
}
|
|
@@ -40376,16 +40463,16 @@ async function promptConnection2(existingNames) {
|
|
|
40376
40463
|
var seqAuth = createConnectionAuth({
|
|
40377
40464
|
load: loadConnections2,
|
|
40378
40465
|
save: saveConnections2,
|
|
40379
|
-
format: (c) => `${
|
|
40466
|
+
format: (c) => `${chalk248.bold(c.name)} ${c.url}`,
|
|
40380
40467
|
promptNew: promptConnection2,
|
|
40381
40468
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
40382
40469
|
});
|
|
40383
40470
|
|
|
40384
40471
|
// src/commands/seq/seqQuery.ts
|
|
40385
|
-
import
|
|
40472
|
+
import chalk252 from "chalk";
|
|
40386
40473
|
|
|
40387
40474
|
// src/commands/seq/fetchSeq.ts
|
|
40388
|
-
import
|
|
40475
|
+
import chalk249 from "chalk";
|
|
40389
40476
|
async function fetchSeq(conn, path108, params) {
|
|
40390
40477
|
const url = `${conn.url}${path108}?${params}`;
|
|
40391
40478
|
const response = await fetch(url, {
|
|
@@ -40396,7 +40483,7 @@ async function fetchSeq(conn, path108, params) {
|
|
|
40396
40483
|
});
|
|
40397
40484
|
if (!response.ok) {
|
|
40398
40485
|
const body = await response.text();
|
|
40399
|
-
console.error(
|
|
40486
|
+
console.error(chalk249.red(`Seq returned ${response.status}: ${body}`));
|
|
40400
40487
|
process.exit(1);
|
|
40401
40488
|
}
|
|
40402
40489
|
return response;
|
|
@@ -40455,23 +40542,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
40455
40542
|
}
|
|
40456
40543
|
|
|
40457
40544
|
// src/commands/seq/formatEvent.ts
|
|
40458
|
-
import
|
|
40545
|
+
import chalk250 from "chalk";
|
|
40459
40546
|
function levelColor(level) {
|
|
40460
40547
|
switch (level) {
|
|
40461
40548
|
case "Fatal":
|
|
40462
|
-
return
|
|
40549
|
+
return chalk250.bgRed.white;
|
|
40463
40550
|
case "Error":
|
|
40464
|
-
return
|
|
40551
|
+
return chalk250.red;
|
|
40465
40552
|
case "Warning":
|
|
40466
|
-
return
|
|
40553
|
+
return chalk250.yellow;
|
|
40467
40554
|
case "Information":
|
|
40468
|
-
return
|
|
40555
|
+
return chalk250.cyan;
|
|
40469
40556
|
case "Debug":
|
|
40470
|
-
return
|
|
40557
|
+
return chalk250.gray;
|
|
40471
40558
|
case "Verbose":
|
|
40472
|
-
return
|
|
40559
|
+
return chalk250.dim;
|
|
40473
40560
|
default:
|
|
40474
|
-
return
|
|
40561
|
+
return chalk250.white;
|
|
40475
40562
|
}
|
|
40476
40563
|
}
|
|
40477
40564
|
function levelAbbrev(level) {
|
|
@@ -40512,12 +40599,12 @@ function formatTimestamp(iso) {
|
|
|
40512
40599
|
function formatEvent(event) {
|
|
40513
40600
|
const color = levelColor(event.Level);
|
|
40514
40601
|
const abbrev = levelAbbrev(event.Level);
|
|
40515
|
-
const ts10 =
|
|
40602
|
+
const ts10 = chalk250.dim(formatTimestamp(event.Timestamp));
|
|
40516
40603
|
const msg = renderMessage(event);
|
|
40517
40604
|
const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
40518
40605
|
if (event.Exception) {
|
|
40519
40606
|
for (const line of event.Exception.split("\n")) {
|
|
40520
|
-
lines2.push(
|
|
40607
|
+
lines2.push(chalk250.red(` ${line}`));
|
|
40521
40608
|
}
|
|
40522
40609
|
}
|
|
40523
40610
|
return lines2.join("\n");
|
|
@@ -40550,11 +40637,11 @@ function rejectTimestampFilter(filter) {
|
|
|
40550
40637
|
}
|
|
40551
40638
|
|
|
40552
40639
|
// src/shared/resolveNamedConnection.ts
|
|
40553
|
-
import
|
|
40640
|
+
import chalk251 from "chalk";
|
|
40554
40641
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
40555
40642
|
if (connections.length === 0) {
|
|
40556
40643
|
console.error(
|
|
40557
|
-
|
|
40644
|
+
chalk251.red(
|
|
40558
40645
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
40559
40646
|
)
|
|
40560
40647
|
);
|
|
@@ -40563,7 +40650,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
40563
40650
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
40564
40651
|
const connection = connections.find((c) => c.name === target);
|
|
40565
40652
|
if (!connection) {
|
|
40566
|
-
console.error(
|
|
40653
|
+
console.error(chalk251.red(`${kind} connection "${target}" not found.`));
|
|
40567
40654
|
process.exit(1);
|
|
40568
40655
|
}
|
|
40569
40656
|
return connection;
|
|
@@ -40592,7 +40679,7 @@ async function seqQuery(filter, options2) {
|
|
|
40592
40679
|
new URLSearchParams({ filter, count: String(count10) })
|
|
40593
40680
|
);
|
|
40594
40681
|
if (events.length === 0) {
|
|
40595
|
-
console.log(
|
|
40682
|
+
console.log(chalk252.yellow("No events found."));
|
|
40596
40683
|
return;
|
|
40597
40684
|
}
|
|
40598
40685
|
if (options2.json) {
|
|
@@ -40603,11 +40690,11 @@ async function seqQuery(filter, options2) {
|
|
|
40603
40690
|
for (const event of chronological) {
|
|
40604
40691
|
console.log(formatEvent(event));
|
|
40605
40692
|
}
|
|
40606
|
-
console.log(
|
|
40693
|
+
console.log(chalk252.dim(`
|
|
40607
40694
|
${events.length} events`));
|
|
40608
40695
|
if (events.length >= count10) {
|
|
40609
40696
|
console.log(
|
|
40610
|
-
|
|
40697
|
+
chalk252.yellow(
|
|
40611
40698
|
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
40612
40699
|
)
|
|
40613
40700
|
);
|
|
@@ -40615,10 +40702,10 @@ ${events.length} events`));
|
|
|
40615
40702
|
}
|
|
40616
40703
|
|
|
40617
40704
|
// src/shared/setNamedDefaultConnection.ts
|
|
40618
|
-
import
|
|
40705
|
+
import chalk253 from "chalk";
|
|
40619
40706
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
40620
40707
|
if (!connections.find((c) => c.name === name)) {
|
|
40621
|
-
console.error(
|
|
40708
|
+
console.error(chalk253.red(`Connection "${name}" not found.`));
|
|
40622
40709
|
process.exit(1);
|
|
40623
40710
|
}
|
|
40624
40711
|
setDefault(name);
|
|
@@ -40764,10 +40851,10 @@ function parseSlackThreadRef(value) {
|
|
|
40764
40851
|
}
|
|
40765
40852
|
|
|
40766
40853
|
// src/commands/slack/postSlackMessage.ts
|
|
40767
|
-
import { mkdirSync as
|
|
40854
|
+
import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync46 } from "fs";
|
|
40768
40855
|
|
|
40769
40856
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
40770
|
-
import { mkdirSync as
|
|
40857
|
+
import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync45 } from "fs";
|
|
40771
40858
|
|
|
40772
40859
|
// src/commands/slack/readSlackParts.ts
|
|
40773
40860
|
import { readFileSync as readFileSync57 } from "fs";
|
|
@@ -40813,12 +40900,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
40813
40900
|
}
|
|
40814
40901
|
|
|
40815
40902
|
// src/commands/slack/slackWorkingFile.ts
|
|
40816
|
-
import { join as
|
|
40903
|
+
import { join as join88 } from "path";
|
|
40817
40904
|
function slackWorkingFile(channel, partIndex) {
|
|
40818
40905
|
const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
|
|
40819
|
-
const dir =
|
|
40906
|
+
const dir = join88(getStoreDir(), "slack");
|
|
40820
40907
|
const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
|
|
40821
|
-
return { dir, bodyPath:
|
|
40908
|
+
return { dir, bodyPath: join88(dir, `${name}.md`) };
|
|
40822
40909
|
}
|
|
40823
40910
|
|
|
40824
40911
|
// src/commands/slack/previewSlackThreadParts.ts
|
|
@@ -40830,10 +40917,10 @@ async function previewSlackThreadParts({
|
|
|
40830
40917
|
}) {
|
|
40831
40918
|
const bodies = readSlackParts(partFiles);
|
|
40832
40919
|
const { dir } = slackWorkingFile(channel);
|
|
40833
|
-
|
|
40920
|
+
mkdirSync28(dir, { recursive: true });
|
|
40834
40921
|
const paths = bodies.map((body, index2) => {
|
|
40835
40922
|
const { bodyPath } = slackWorkingFile(channel, index2 + 1);
|
|
40836
|
-
|
|
40923
|
+
writeFileSync45(bodyPath, `${body}
|
|
40837
40924
|
`);
|
|
40838
40925
|
return bodyPath;
|
|
40839
40926
|
});
|
|
@@ -40884,8 +40971,8 @@ async function postSlackMessage(channelArg, options2) {
|
|
|
40884
40971
|
process.exit(1);
|
|
40885
40972
|
}
|
|
40886
40973
|
const { dir, bodyPath } = slackWorkingFile(channel);
|
|
40887
|
-
|
|
40888
|
-
|
|
40974
|
+
mkdirSync29(dir, { recursive: true });
|
|
40975
|
+
writeFileSync46(bodyPath, `${body}
|
|
40889
40976
|
`);
|
|
40890
40977
|
await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
|
|
40891
40978
|
console.log(`Approved for ${target}. The body to post is at:`);
|
|
@@ -40920,7 +41007,7 @@ function registerSlack(program) {
|
|
|
40920
41007
|
}
|
|
40921
41008
|
|
|
40922
41009
|
// src/commands/sql/sqlAuth.ts
|
|
40923
|
-
import
|
|
41010
|
+
import chalk255 from "chalk";
|
|
40924
41011
|
|
|
40925
41012
|
// src/commands/sql/loadConnections.ts
|
|
40926
41013
|
function loadConnections3() {
|
|
@@ -40949,7 +41036,7 @@ function setDefaultConnection2(name) {
|
|
|
40949
41036
|
}
|
|
40950
41037
|
|
|
40951
41038
|
// src/commands/sql/promptConnection.ts
|
|
40952
|
-
import
|
|
41039
|
+
import chalk254 from "chalk";
|
|
40953
41040
|
async function promptConnection3(existingNames) {
|
|
40954
41041
|
const name = await promptInput("name", "Connection name:", "default");
|
|
40955
41042
|
assertUniqueName(existingNames, name);
|
|
@@ -40957,7 +41044,7 @@ async function promptConnection3(existingNames) {
|
|
|
40957
41044
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
40958
41045
|
const port = Number.parseInt(portStr, 10);
|
|
40959
41046
|
if (!Number.isFinite(port)) {
|
|
40960
|
-
console.error(
|
|
41047
|
+
console.error(chalk254.red(`Invalid port "${portStr}".`));
|
|
40961
41048
|
process.exit(1);
|
|
40962
41049
|
}
|
|
40963
41050
|
const user = await promptInput("user", "User:");
|
|
@@ -40970,13 +41057,13 @@ async function promptConnection3(existingNames) {
|
|
|
40970
41057
|
var sqlAuth = createConnectionAuth({
|
|
40971
41058
|
load: loadConnections3,
|
|
40972
41059
|
save: saveConnections3,
|
|
40973
|
-
format: (c) => `${
|
|
41060
|
+
format: (c) => `${chalk255.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
40974
41061
|
promptNew: promptConnection3,
|
|
40975
41062
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
40976
41063
|
});
|
|
40977
41064
|
|
|
40978
41065
|
// src/commands/sql/printTable.ts
|
|
40979
|
-
import
|
|
41066
|
+
import chalk256 from "chalk";
|
|
40980
41067
|
function formatCell(value) {
|
|
40981
41068
|
if (value === null || value === void 0) return "";
|
|
40982
41069
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -40985,7 +41072,7 @@ function formatCell(value) {
|
|
|
40985
41072
|
}
|
|
40986
41073
|
function printTable(rows) {
|
|
40987
41074
|
if (rows.length === 0) {
|
|
40988
|
-
console.log(
|
|
41075
|
+
console.log(chalk256.yellow("(no rows)"));
|
|
40989
41076
|
return;
|
|
40990
41077
|
}
|
|
40991
41078
|
const columns = Object.keys(rows[0]);
|
|
@@ -40993,13 +41080,13 @@ function printTable(rows) {
|
|
|
40993
41080
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
40994
41081
|
);
|
|
40995
41082
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
40996
|
-
console.log(
|
|
40997
|
-
console.log(
|
|
41083
|
+
console.log(chalk256.dim(header));
|
|
41084
|
+
console.log(chalk256.dim("-".repeat(header.length)));
|
|
40998
41085
|
for (const row3 of rows) {
|
|
40999
41086
|
const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
|
|
41000
41087
|
console.log(line);
|
|
41001
41088
|
}
|
|
41002
|
-
console.log(
|
|
41089
|
+
console.log(chalk256.dim(`
|
|
41003
41090
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
41004
41091
|
}
|
|
41005
41092
|
|
|
@@ -41059,7 +41146,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
41059
41146
|
}
|
|
41060
41147
|
|
|
41061
41148
|
// src/commands/sql/sqlMutate.ts
|
|
41062
|
-
import
|
|
41149
|
+
import chalk257 from "chalk";
|
|
41063
41150
|
|
|
41064
41151
|
// src/commands/sql/isMutation.ts
|
|
41065
41152
|
var MUTATION_KEYWORDS = [
|
|
@@ -41093,7 +41180,7 @@ function isMutation(sql27) {
|
|
|
41093
41180
|
async function sqlMutate(query, connectionName) {
|
|
41094
41181
|
if (!isMutation(query)) {
|
|
41095
41182
|
console.error(
|
|
41096
|
-
|
|
41183
|
+
chalk257.red(
|
|
41097
41184
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
41098
41185
|
)
|
|
41099
41186
|
);
|
|
@@ -41103,18 +41190,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
41103
41190
|
const pool = await sqlConnect(conn);
|
|
41104
41191
|
try {
|
|
41105
41192
|
const result = await pool.request().query(query);
|
|
41106
|
-
console.log(
|
|
41193
|
+
console.log(chalk257.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
41107
41194
|
} finally {
|
|
41108
41195
|
await pool.close();
|
|
41109
41196
|
}
|
|
41110
41197
|
}
|
|
41111
41198
|
|
|
41112
41199
|
// src/commands/sql/sqlQuery.ts
|
|
41113
|
-
import
|
|
41200
|
+
import chalk258 from "chalk";
|
|
41114
41201
|
async function sqlQuery(query, connectionName) {
|
|
41115
41202
|
if (isMutation(query)) {
|
|
41116
41203
|
console.error(
|
|
41117
|
-
|
|
41204
|
+
chalk258.red(
|
|
41118
41205
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
41119
41206
|
)
|
|
41120
41207
|
);
|
|
@@ -41129,7 +41216,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
41129
41216
|
printTable(rows);
|
|
41130
41217
|
} else {
|
|
41131
41218
|
console.log(
|
|
41132
|
-
|
|
41219
|
+
chalk258.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
41133
41220
|
);
|
|
41134
41221
|
}
|
|
41135
41222
|
} finally {
|
|
@@ -41544,7 +41631,7 @@ function syncPi(claudeDir, options2) {
|
|
|
41544
41631
|
// src/commands/sync/syncSettings.ts
|
|
41545
41632
|
import * as fs46 from "fs";
|
|
41546
41633
|
import * as path100 from "path";
|
|
41547
|
-
import
|
|
41634
|
+
import chalk259 from "chalk";
|
|
41548
41635
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
41549
41636
|
const source = path100.join(claudeDir, "settings.json");
|
|
41550
41637
|
const target = path100.join(targetBase, "settings.json");
|
|
@@ -41563,7 +41650,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41563
41650
|
if (mergedContent !== normalizedTarget) {
|
|
41564
41651
|
if (!options2?.yes) {
|
|
41565
41652
|
console.log(
|
|
41566
|
-
|
|
41653
|
+
chalk259.yellow(
|
|
41567
41654
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
41568
41655
|
)
|
|
41569
41656
|
);
|
|
@@ -41571,7 +41658,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
41571
41658
|
printDiff(targetContent, mergedContent);
|
|
41572
41659
|
printAutoConfirmHint();
|
|
41573
41660
|
const confirm = await promptConfirm(
|
|
41574
|
-
|
|
41661
|
+
chalk259.red("Overwrite existing settings.json?"),
|
|
41575
41662
|
false
|
|
41576
41663
|
);
|
|
41577
41664
|
if (!confirm) {
|
|
@@ -42001,20 +42088,20 @@ async function configure() {
|
|
|
42001
42088
|
|
|
42002
42089
|
// src/commands/transcript/list.ts
|
|
42003
42090
|
import { existsSync as existsSync78, readdirSync as readdirSync21, statSync as statSync12 } from "fs";
|
|
42004
|
-
import { join as
|
|
42091
|
+
import { join as join100 } from "path";
|
|
42005
42092
|
function list4() {
|
|
42006
42093
|
const { vttDir } = getTranscriptConfig();
|
|
42007
42094
|
if (!existsSync78(vttDir)) return;
|
|
42008
42095
|
for (const entry of readdirSync21(vttDir)) {
|
|
42009
42096
|
if (!entry.endsWith(".vtt")) continue;
|
|
42010
|
-
if (statSync12(
|
|
42097
|
+
if (statSync12(join100(vttDir, entry)).isDirectory()) continue;
|
|
42011
42098
|
console.log(entry);
|
|
42012
42099
|
}
|
|
42013
42100
|
}
|
|
42014
42101
|
|
|
42015
42102
|
// src/commands/transcript/move.ts
|
|
42016
|
-
import { existsSync as existsSync79, mkdirSync as
|
|
42017
|
-
import { basename as basename27, join as
|
|
42103
|
+
import { existsSync as existsSync79, mkdirSync as mkdirSync35, renameSync as renameSync4, writeFileSync as writeFileSync51 } from "fs";
|
|
42104
|
+
import { basename as basename27, join as join101 } from "path";
|
|
42018
42105
|
|
|
42019
42106
|
// src/commands/transcript/convertVttToMarkdown.ts
|
|
42020
42107
|
function convertVttToMarkdown(inputPath) {
|
|
@@ -42024,9 +42111,9 @@ function convertVttToMarkdown(inputPath) {
|
|
|
42024
42111
|
// src/commands/transcript/move.ts
|
|
42025
42112
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
42026
42113
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
42027
|
-
const processedDir =
|
|
42028
|
-
|
|
42029
|
-
renameSync4(sourcePath,
|
|
42114
|
+
const processedDir = join101(vttDir, "processed");
|
|
42115
|
+
mkdirSync35(processedDir, { recursive: true });
|
|
42116
|
+
renameSync4(sourcePath, join101(processedDir, filename));
|
|
42030
42117
|
}
|
|
42031
42118
|
function move(file, options2) {
|
|
42032
42119
|
const { date, client } = options2;
|
|
@@ -42036,25 +42123,25 @@ function move(file, options2) {
|
|
|
42036
42123
|
}
|
|
42037
42124
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
42038
42125
|
const filename = basename27(file);
|
|
42039
|
-
const sourcePath =
|
|
42126
|
+
const sourcePath = join101(vttDir, filename);
|
|
42040
42127
|
if (!existsSync79(sourcePath)) {
|
|
42041
42128
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
42042
42129
|
process.exit(1);
|
|
42043
42130
|
}
|
|
42044
42131
|
const base = basename27(filename, ".vtt").replace(/ Transcription$/, "");
|
|
42045
42132
|
const outputName = `${date} ${base}.md`;
|
|
42046
|
-
const formattedDir =
|
|
42047
|
-
|
|
42048
|
-
const formattedPath =
|
|
42049
|
-
|
|
42133
|
+
const formattedDir = join101(transcriptsDir, client);
|
|
42134
|
+
mkdirSync35(formattedDir, { recursive: true });
|
|
42135
|
+
const formattedPath = join101(formattedDir, outputName);
|
|
42136
|
+
writeFileSync51(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
42050
42137
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
42051
|
-
const summaryPath =
|
|
42138
|
+
const summaryPath = join101(summaryDir, client, outputName);
|
|
42052
42139
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
42053
42140
|
console.log(`Summary target: ${summaryPath}`);
|
|
42054
42141
|
}
|
|
42055
42142
|
|
|
42056
42143
|
// src/commands/transcript/merge.ts
|
|
42057
|
-
import { existsSync as existsSync80, writeFileSync as
|
|
42144
|
+
import { existsSync as existsSync80, writeFileSync as writeFileSync52 } from "fs";
|
|
42058
42145
|
import { basename as basename28 } from "path";
|
|
42059
42146
|
|
|
42060
42147
|
// src/commands/transcript/failTranscript.ts
|
|
@@ -42231,7 +42318,7 @@ async function merge(files, options2 = {}) {
|
|
|
42231
42318
|
console.log(document);
|
|
42232
42319
|
return;
|
|
42233
42320
|
}
|
|
42234
|
-
|
|
42321
|
+
writeFileSync52(options2.out, `${document}
|
|
42235
42322
|
`, "utf8");
|
|
42236
42323
|
console.log(`Merged transcript: ${options2.out}`);
|
|
42237
42324
|
}
|
|
@@ -43714,10 +43801,10 @@ function registerWatchWait(watchCommand) {
|
|
|
43714
43801
|
}
|
|
43715
43802
|
|
|
43716
43803
|
// src/commands/watch/simulateDivergence.ts
|
|
43717
|
-
import { writeFileSync as
|
|
43804
|
+
import { writeFileSync as writeFileSync53 } from "fs";
|
|
43718
43805
|
function simulateDivergence() {
|
|
43719
43806
|
try {
|
|
43720
|
-
|
|
43807
|
+
writeFileSync53(simulatedDivergencePath(), "");
|
|
43721
43808
|
console.log(
|
|
43722
43809
|
`the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
|
|
43723
43810
|
);
|
|
@@ -43811,7 +43898,7 @@ function registerWatch(program) {
|
|
|
43811
43898
|
|
|
43812
43899
|
// src/commands/roam/auth.ts
|
|
43813
43900
|
import { randomBytes } from "crypto";
|
|
43814
|
-
import
|
|
43901
|
+
import chalk260 from "chalk";
|
|
43815
43902
|
|
|
43816
43903
|
// src/commands/roam/waitForCallback.ts
|
|
43817
43904
|
import { createServer as createServer3 } from "http";
|
|
@@ -43942,13 +44029,13 @@ async function auth() {
|
|
|
43942
44029
|
saveGlobalConfig(config);
|
|
43943
44030
|
const state = randomBytes(16).toString("hex");
|
|
43944
44031
|
console.log(
|
|
43945
|
-
|
|
44032
|
+
chalk260.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
43946
44033
|
);
|
|
43947
|
-
console.log(
|
|
43948
|
-
console.log(
|
|
43949
|
-
console.log(
|
|
44034
|
+
console.log(chalk260.white("http://localhost:14523/callback\n"));
|
|
44035
|
+
console.log(chalk260.blue("Opening browser for authorization..."));
|
|
44036
|
+
console.log(chalk260.dim("Waiting for authorization callback..."));
|
|
43950
44037
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
43951
|
-
console.log(
|
|
44038
|
+
console.log(chalk260.dim("Exchanging code for tokens..."));
|
|
43952
44039
|
const tokens = await exchangeToken({
|
|
43953
44040
|
code,
|
|
43954
44041
|
clientId,
|
|
@@ -43964,14 +44051,14 @@ async function auth() {
|
|
|
43964
44051
|
};
|
|
43965
44052
|
saveGlobalConfig(config);
|
|
43966
44053
|
console.log(
|
|
43967
|
-
|
|
44054
|
+
chalk260.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
43968
44055
|
);
|
|
43969
44056
|
}
|
|
43970
44057
|
|
|
43971
44058
|
// src/commands/roam/postRoamActivity.ts
|
|
43972
44059
|
import { execFileSync as execFileSync32 } from "child_process";
|
|
43973
44060
|
import { readdirSync as readdirSync23, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
|
|
43974
|
-
import { join as
|
|
44061
|
+
import { join as join102 } from "path";
|
|
43975
44062
|
function findPortFile(roamDir) {
|
|
43976
44063
|
let entries;
|
|
43977
44064
|
try {
|
|
@@ -43980,7 +44067,7 @@ function findPortFile(roamDir) {
|
|
|
43980
44067
|
return void 0;
|
|
43981
44068
|
}
|
|
43982
44069
|
const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
|
|
43983
|
-
const path108 =
|
|
44070
|
+
const path108 = join102(roamDir, name);
|
|
43984
44071
|
try {
|
|
43985
44072
|
return { path: path108, mtimeMs: statSync13(path108).mtimeMs };
|
|
43986
44073
|
} catch {
|
|
@@ -43997,7 +44084,7 @@ var PID_BY_APP = {
|
|
|
43997
44084
|
function postRoamActivity(app, event) {
|
|
43998
44085
|
const appData = process.env.APPDATA;
|
|
43999
44086
|
if (!appData) return;
|
|
44000
|
-
const portFile = findPortFile(
|
|
44087
|
+
const portFile = findPortFile(join102(appData, "Roam"));
|
|
44001
44088
|
if (!portFile) return;
|
|
44002
44089
|
let port;
|
|
44003
44090
|
try {
|
|
@@ -44182,8 +44269,8 @@ function link2() {
|
|
|
44182
44269
|
}
|
|
44183
44270
|
|
|
44184
44271
|
// src/commands/run/add.ts
|
|
44185
|
-
import { mkdirSync as
|
|
44186
|
-
import { join as
|
|
44272
|
+
import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync54 } from "fs";
|
|
44273
|
+
import { join as join103 } from "path";
|
|
44187
44274
|
|
|
44188
44275
|
// src/commands/run/editRepoRunList.ts
|
|
44189
44276
|
async function editRepoRunList(repoName, cwd, edit2) {
|
|
@@ -44264,7 +44351,7 @@ function parseEnvPairs(pairs) {
|
|
|
44264
44351
|
}
|
|
44265
44352
|
|
|
44266
44353
|
// src/commands/run/parseParamSpecs.ts
|
|
44267
|
-
function
|
|
44354
|
+
function fail8(spec) {
|
|
44268
44355
|
console.error(
|
|
44269
44356
|
`--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
|
|
44270
44357
|
);
|
|
@@ -44274,14 +44361,14 @@ function parseParamSpec(spec) {
|
|
|
44274
44361
|
const eq46 = spec.indexOf("=");
|
|
44275
44362
|
const name = eq46 === -1 ? spec : spec.slice(0, eq46);
|
|
44276
44363
|
if (eq46 !== -1) {
|
|
44277
|
-
if (eq46 === 0 || name.endsWith("!"))
|
|
44364
|
+
if (eq46 === 0 || name.endsWith("!")) fail8(spec);
|
|
44278
44365
|
return { name, default: spec.slice(eq46 + 1) };
|
|
44279
44366
|
}
|
|
44280
44367
|
if (name.endsWith("!")) {
|
|
44281
|
-
if (name.length === 1)
|
|
44368
|
+
if (name.length === 1) fail8(spec);
|
|
44282
44369
|
return { name: name.slice(0, -1), required: true };
|
|
44283
44370
|
}
|
|
44284
|
-
if (name.length === 0)
|
|
44371
|
+
if (name.length === 0) fail8(spec);
|
|
44285
44372
|
return { name };
|
|
44286
44373
|
}
|
|
44287
44374
|
function parseParamSpecs(specs) {
|
|
@@ -44354,16 +44441,16 @@ function saveProjectRunConfig(entry) {
|
|
|
44354
44441
|
saveConfig(config);
|
|
44355
44442
|
}
|
|
44356
44443
|
function createCommandFile(name) {
|
|
44357
|
-
const dir =
|
|
44358
|
-
|
|
44444
|
+
const dir = join103(".claude", "commands");
|
|
44445
|
+
mkdirSync36(dir, { recursive: true });
|
|
44359
44446
|
const content = `---
|
|
44360
44447
|
description: Run ${name}
|
|
44361
44448
|
---
|
|
44362
44449
|
|
|
44363
44450
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
44364
44451
|
`;
|
|
44365
|
-
const filePath =
|
|
44366
|
-
|
|
44452
|
+
const filePath = join103(dir, `${name}.md`);
|
|
44453
|
+
writeFileSync54(filePath, content);
|
|
44367
44454
|
console.log(`Created command file: ${filePath}`);
|
|
44368
44455
|
}
|
|
44369
44456
|
async function add4() {
|
|
@@ -44468,7 +44555,7 @@ function registerRunAdd(runCommand) {
|
|
|
44468
44555
|
|
|
44469
44556
|
// src/commands/run/remove.ts
|
|
44470
44557
|
import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
|
|
44471
|
-
import { join as
|
|
44558
|
+
import { join as join104 } from "path";
|
|
44472
44559
|
|
|
44473
44560
|
// src/commands/run/removeRepoRunConfig.ts
|
|
44474
44561
|
function isNamed(entry, name) {
|
|
@@ -44486,7 +44573,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
|
|
|
44486
44573
|
|
|
44487
44574
|
// src/commands/run/remove.ts
|
|
44488
44575
|
function deleteCommandFile(name) {
|
|
44489
|
-
const filePath =
|
|
44576
|
+
const filePath = join104(".claude", "commands", `${name}.md`);
|
|
44490
44577
|
if (existsSync84(filePath)) {
|
|
44491
44578
|
unlinkSync19(filePath);
|
|
44492
44579
|
console.log(`Deleted command file: ${filePath}`);
|
|
@@ -44540,18 +44627,18 @@ function registerRun(program) {
|
|
|
44540
44627
|
}
|
|
44541
44628
|
|
|
44542
44629
|
// src/commands/sessions/nodes/formatLink.ts
|
|
44543
|
-
import
|
|
44630
|
+
import chalk261 from "chalk";
|
|
44544
44631
|
var STATE_COLOURS = {
|
|
44545
|
-
connected:
|
|
44546
|
-
connecting:
|
|
44547
|
-
disconnected:
|
|
44548
|
-
"version-blocked":
|
|
44632
|
+
connected: chalk261.green,
|
|
44633
|
+
connecting: chalk261.yellow,
|
|
44634
|
+
disconnected: chalk261.red,
|
|
44635
|
+
"version-blocked": chalk261.red
|
|
44549
44636
|
};
|
|
44550
44637
|
function formatLink(link3) {
|
|
44551
|
-
const colour = STATE_COLOURS[link3.state] ??
|
|
44638
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk261.white;
|
|
44552
44639
|
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
44553
44640
|
const error = link3.error ? `
|
|
44554
|
-
${
|
|
44641
|
+
${chalk261.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
44555
44642
|
return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
|
|
44556
44643
|
}
|
|
44557
44644
|
|
|
@@ -44767,7 +44854,7 @@ function requestDrain(socket, lines2) {
|
|
|
44767
44854
|
}
|
|
44768
44855
|
|
|
44769
44856
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
44770
|
-
import { mkdirSync as
|
|
44857
|
+
import { mkdirSync as mkdirSync41 } from "fs";
|
|
44771
44858
|
|
|
44772
44859
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
44773
44860
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -45022,7 +45109,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
45022
45109
|
|
|
45023
45110
|
// src/commands/sessions/daemon/findServerParents.ts
|
|
45024
45111
|
import { existsSync as existsSync86 } from "fs";
|
|
45025
|
-
import { join as
|
|
45112
|
+
import { join as join105, resolve as resolve29 } from "path";
|
|
45026
45113
|
function isLive(session) {
|
|
45027
45114
|
return !!session.pty && session.status !== "done" && session.status !== "error";
|
|
45028
45115
|
}
|
|
@@ -45031,7 +45118,7 @@ function isLiveAgent(session) {
|
|
|
45031
45118
|
}
|
|
45032
45119
|
function serverRunDirs(sessions, file) {
|
|
45033
45120
|
return new Set(
|
|
45034
|
-
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(
|
|
45121
|
+
sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(join105(dir, file)))
|
|
45035
45122
|
);
|
|
45036
45123
|
}
|
|
45037
45124
|
function findServerParents(sessions, file) {
|
|
@@ -45249,7 +45336,7 @@ function sendResizeSnapshot(s, send) {
|
|
|
45249
45336
|
}
|
|
45250
45337
|
|
|
45251
45338
|
// src/commands/sessions/daemon/viewerSize.ts
|
|
45252
|
-
import { readFileSync as readFileSync67, writeFileSync as
|
|
45339
|
+
import { readFileSync as readFileSync67, writeFileSync as writeFileSync55 } from "fs";
|
|
45253
45340
|
var DEFAULT_SIZE = { cols: 120, rows: 30 };
|
|
45254
45341
|
var remembered;
|
|
45255
45342
|
function rememberViewerSize(cols, rows) {
|
|
@@ -45257,7 +45344,7 @@ function rememberViewerSize(cols, rows) {
|
|
|
45257
45344
|
if (remembered?.cols === cols && remembered.rows === rows) return;
|
|
45258
45345
|
remembered = { cols, rows };
|
|
45259
45346
|
try {
|
|
45260
|
-
|
|
45347
|
+
writeFileSync55(daemonPaths.viewerSize, JSON.stringify(remembered));
|
|
45261
45348
|
} catch (error) {
|
|
45262
45349
|
daemonLog(
|
|
45263
45350
|
`viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -45892,12 +45979,12 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
45892
45979
|
}
|
|
45893
45980
|
|
|
45894
45981
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
45895
|
-
import { existsSync as existsSync90, rmSync as rmSync12, writeFileSync as
|
|
45982
|
+
import { existsSync as existsSync90, rmSync as rmSync12, writeFileSync as writeFileSync56 } from "fs";
|
|
45896
45983
|
var paused;
|
|
45897
45984
|
var wake;
|
|
45898
45985
|
function persist2(value) {
|
|
45899
45986
|
try {
|
|
45900
|
-
if (value)
|
|
45987
|
+
if (value) writeFileSync56(daemonPaths.autoUpdatePaused, "");
|
|
45901
45988
|
else rmSync12(daemonPaths.autoUpdatePaused, { force: true });
|
|
45902
45989
|
} catch {
|
|
45903
45990
|
}
|
|
@@ -46022,7 +46109,7 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
|
|
|
46022
46109
|
}
|
|
46023
46110
|
|
|
46024
46111
|
// src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
|
|
46025
|
-
import { readFileSync as readFileSync69, writeFileSync as
|
|
46112
|
+
import { readFileSync as readFileSync69, writeFileSync as writeFileSync57 } from "fs";
|
|
46026
46113
|
var KEEP_TAIL = 256 * 1024;
|
|
46027
46114
|
var MAX_LOG_SIZE = 4 * 1024 * 1024;
|
|
46028
46115
|
function trimWatcherLog(cwd) {
|
|
@@ -46034,17 +46121,17 @@ function trimWatcherLog(cwd) {
|
|
|
46034
46121
|
return;
|
|
46035
46122
|
}
|
|
46036
46123
|
if (log2.length <= MAX_LOG_SIZE) return;
|
|
46037
|
-
|
|
46124
|
+
writeFileSync57(path108, log2.slice(-KEEP_TAIL));
|
|
46038
46125
|
daemonLog(`auto-update: log ${path108} trimmed to its last ${KEEP_TAIL} chars`);
|
|
46039
46126
|
}
|
|
46040
46127
|
|
|
46041
46128
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
46042
|
-
import { appendFileSync as appendFileSync5, mkdirSync as
|
|
46043
|
-
import { dirname as
|
|
46129
|
+
import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync37 } from "fs";
|
|
46130
|
+
import { dirname as dirname45 } from "path";
|
|
46044
46131
|
function appendWatcherLog(cwd, data) {
|
|
46045
46132
|
try {
|
|
46046
46133
|
const path108 = watcherLogPath(cwd);
|
|
46047
|
-
|
|
46134
|
+
mkdirSync37(dirname45(path108), { recursive: true });
|
|
46048
46135
|
appendFileSync5(path108, data);
|
|
46049
46136
|
} catch {
|
|
46050
46137
|
}
|
|
@@ -46398,12 +46485,12 @@ import { basename as basename30 } from "path";
|
|
|
46398
46485
|
|
|
46399
46486
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
46400
46487
|
import { existsSync as existsSync92 } from "fs";
|
|
46401
|
-
import { join as
|
|
46488
|
+
import { join as join109 } from "path";
|
|
46402
46489
|
|
|
46403
46490
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
46404
46491
|
import { statSync as statSync15 } from "fs";
|
|
46405
46492
|
import { rm as rm3 } from "fs/promises";
|
|
46406
|
-
import { join as
|
|
46493
|
+
import { join as join108 } from "path";
|
|
46407
46494
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
46408
46495
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
46409
46496
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -46431,7 +46518,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
46431
46518
|
return { removed: true };
|
|
46432
46519
|
}
|
|
46433
46520
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
46434
|
-
return statSync15(
|
|
46521
|
+
return statSync15(join108(worktreePath, ".git"), {
|
|
46435
46522
|
throwIfNoEntry: false
|
|
46436
46523
|
})?.isDirectory() === true;
|
|
46437
46524
|
}
|
|
@@ -46467,7 +46554,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
46467
46554
|
);
|
|
46468
46555
|
}
|
|
46469
46556
|
function strandedReason(worktreePath, cause) {
|
|
46470
|
-
if (!existsSync92(
|
|
46557
|
+
if (!existsSync92(join109(worktreePath, ".git")))
|
|
46471
46558
|
return "its .git link is already gone";
|
|
46472
46559
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
46473
46560
|
return "git no longer recognises it as a working tree";
|
|
@@ -47515,8 +47602,8 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
47515
47602
|
}
|
|
47516
47603
|
|
|
47517
47604
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
47518
|
-
import { existsSync as existsSync96, mkdirSync as
|
|
47519
|
-
import { dirname as
|
|
47605
|
+
import { existsSync as existsSync96, mkdirSync as mkdirSync38, watch as watch2 } from "fs";
|
|
47606
|
+
import { dirname as dirname46 } from "path";
|
|
47520
47607
|
|
|
47521
47608
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
47522
47609
|
function applyActivityToSession(session, activity2) {
|
|
@@ -47578,9 +47665,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
47578
47665
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
47579
47666
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
47580
47667
|
const path108 = activityPath(session.id);
|
|
47581
|
-
const dir =
|
|
47668
|
+
const dir = dirname46(path108);
|
|
47582
47669
|
try {
|
|
47583
|
-
|
|
47670
|
+
mkdirSync38(dir, { recursive: true });
|
|
47584
47671
|
} catch {
|
|
47585
47672
|
return;
|
|
47586
47673
|
}
|
|
@@ -47745,10 +47832,10 @@ function bindCodexSession(session, notify2) {
|
|
|
47745
47832
|
import { watch as watch3 } from "fs";
|
|
47746
47833
|
|
|
47747
47834
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
47748
|
-
import { mkdirSync as
|
|
47835
|
+
import { mkdirSync as mkdirSync39 } from "fs";
|
|
47749
47836
|
function ensureProjectDirExists(dir, sessionId) {
|
|
47750
47837
|
try {
|
|
47751
|
-
|
|
47838
|
+
mkdirSync39(dir, { recursive: true });
|
|
47752
47839
|
return true;
|
|
47753
47840
|
} catch (error) {
|
|
47754
47841
|
daemonLog(
|
|
@@ -50856,8 +50943,8 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
50856
50943
|
import { existsSync as existsSync100 } from "fs";
|
|
50857
50944
|
|
|
50858
50945
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
50859
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync99, mkdirSync as
|
|
50860
|
-
import { join as
|
|
50946
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync99, mkdirSync as mkdirSync40 } from "fs";
|
|
50947
|
+
import { join as join110 } from "path";
|
|
50861
50948
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
50862
50949
|
const dir = projectDirForCwd(toCwd);
|
|
50863
50950
|
if (dir === projectDirForCwd(fromCwd)) {
|
|
@@ -50866,7 +50953,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50866
50953
|
);
|
|
50867
50954
|
return;
|
|
50868
50955
|
}
|
|
50869
|
-
const dest =
|
|
50956
|
+
const dest = join110(dir, `${claudeSessionId}.jsonl`);
|
|
50870
50957
|
if (existsSync99(dest)) {
|
|
50871
50958
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
50872
50959
|
return;
|
|
@@ -50879,7 +50966,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
50879
50966
|
return;
|
|
50880
50967
|
}
|
|
50881
50968
|
try {
|
|
50882
|
-
|
|
50969
|
+
mkdirSync40(dir, { recursive: true });
|
|
50883
50970
|
copyFileSync4(source, dest);
|
|
50884
50971
|
daemonLog(
|
|
50885
50972
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -51180,10 +51267,10 @@ function autoUpdateReply() {
|
|
|
51180
51267
|
}
|
|
51181
51268
|
|
|
51182
51269
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
51183
|
-
import { rmSync as rmSync14, writeFileSync as
|
|
51270
|
+
import { rmSync as rmSync14, writeFileSync as writeFileSync58 } from "fs";
|
|
51184
51271
|
function signalLap(installDir, marker2) {
|
|
51185
51272
|
const control = watchControlPaths(installDir);
|
|
51186
|
-
if (control)
|
|
51273
|
+
if (control) writeFileSync58(control[marker2], "");
|
|
51187
51274
|
}
|
|
51188
51275
|
function applyAutoUpdateAction(action) {
|
|
51189
51276
|
const installDir = getInstallDir();
|
|
@@ -52115,7 +52202,7 @@ function handleConnection(socket, manager) {
|
|
|
52115
52202
|
}
|
|
52116
52203
|
|
|
52117
52204
|
// src/commands/sessions/daemon/onListening.ts
|
|
52118
|
-
import { unlinkSync as unlinkSync20, writeFileSync as
|
|
52205
|
+
import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync59 } from "fs";
|
|
52119
52206
|
|
|
52120
52207
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
52121
52208
|
import { readFileSync as readFileSync70 } from "fs";
|
|
@@ -52137,7 +52224,7 @@ function ownsPidFile() {
|
|
|
52137
52224
|
|
|
52138
52225
|
// src/commands/sessions/daemon/onListening.ts
|
|
52139
52226
|
function onListening(manager, checkAutoExit) {
|
|
52140
|
-
|
|
52227
|
+
writeFileSync59(daemonPaths.pid, String(process.pid));
|
|
52141
52228
|
startPidFileWatchdog(() => {
|
|
52142
52229
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
52143
52230
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -52226,7 +52313,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
52226
52313
|
|
|
52227
52314
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
52228
52315
|
async function runDaemon() {
|
|
52229
|
-
|
|
52316
|
+
mkdirSync41(daemonPaths.dir, { recursive: true });
|
|
52230
52317
|
daemonLog(
|
|
52231
52318
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
52232
52319
|
);
|
|
@@ -52285,7 +52372,7 @@ async function closeSession() {
|
|
|
52285
52372
|
}
|
|
52286
52373
|
|
|
52287
52374
|
// src/commands/sessions/nodes/listNodes.ts
|
|
52288
|
-
import
|
|
52375
|
+
import chalk262 from "chalk";
|
|
52289
52376
|
async function nodesReport() {
|
|
52290
52377
|
const live = await queryNodes();
|
|
52291
52378
|
if (live)
|
|
@@ -52302,10 +52389,10 @@ async function listNodes(options2) {
|
|
|
52302
52389
|
console.log(JSON.stringify(report, null, 2));
|
|
52303
52390
|
return;
|
|
52304
52391
|
}
|
|
52305
|
-
console.log(`${report.local} ${
|
|
52392
|
+
console.log(`${report.local} ${chalk262.dim("(this node)")}`);
|
|
52306
52393
|
if (!report.daemonRunning)
|
|
52307
|
-
console.log(
|
|
52308
|
-
if (report.links.length === 0) console.log(
|
|
52394
|
+
console.log(chalk262.dim(" daemon not running; showing configured links"));
|
|
52395
|
+
if (report.links.length === 0) console.log(chalk262.dim(" no links"));
|
|
52309
52396
|
for (const link3 of report.links) console.log(formatLink(link3));
|
|
52310
52397
|
}
|
|
52311
52398
|
|
|
@@ -52327,7 +52414,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
|
52327
52414
|
}
|
|
52328
52415
|
|
|
52329
52416
|
// src/commands/sessions/nodes/printReport.ts
|
|
52330
|
-
import
|
|
52417
|
+
import chalk263 from "chalk";
|
|
52331
52418
|
function printReport(report) {
|
|
52332
52419
|
if (report.links.length === 0) {
|
|
52333
52420
|
console.log(`${report.local} has no links`);
|
|
@@ -52341,11 +52428,11 @@ function printReport(report) {
|
|
|
52341
52428
|
for (const diagnosis of report.links) printDiagnosis(diagnosis);
|
|
52342
52429
|
}
|
|
52343
52430
|
function printDiagnosis(diagnosis) {
|
|
52344
|
-
console.log(`${
|
|
52431
|
+
console.log(`${chalk263.bold(diagnosis.name)} ${chalk263.dim(diagnosis.url)}`);
|
|
52345
52432
|
for (const hop of diagnosis.hops) {
|
|
52346
|
-
const mark = hop.ok ?
|
|
52433
|
+
const mark = hop.ok ? chalk263.green("\u2713") : chalk263.red("\u2717");
|
|
52347
52434
|
console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
|
|
52348
|
-
if (hop.remediation) console.log(` ${
|
|
52435
|
+
if (hop.remediation) console.log(` ${chalk263.yellow(hop.remediation)}`);
|
|
52349
52436
|
}
|
|
52350
52437
|
}
|
|
52351
52438
|
|
|
@@ -52417,14 +52504,14 @@ function registerDiagnoseCommands(nodes, calledBy4) {
|
|
|
52417
52504
|
}
|
|
52418
52505
|
|
|
52419
52506
|
// src/commands/sessions/nodes/linkNode.ts
|
|
52420
|
-
import
|
|
52507
|
+
import chalk266 from "chalk";
|
|
52421
52508
|
|
|
52422
52509
|
// src/commands/sessions/nodes/notifyDaemonLinks.ts
|
|
52423
|
-
import
|
|
52510
|
+
import chalk264 from "chalk";
|
|
52424
52511
|
async function notifyDaemonLinks() {
|
|
52425
52512
|
if (!await isDaemonRunning()) {
|
|
52426
52513
|
console.log(
|
|
52427
|
-
|
|
52514
|
+
chalk264.yellow(
|
|
52428
52515
|
"The sessions daemon is not running; it loads the links when it starts."
|
|
52429
52516
|
)
|
|
52430
52517
|
);
|
|
@@ -52432,11 +52519,11 @@ async function notifyDaemonLinks() {
|
|
|
52432
52519
|
}
|
|
52433
52520
|
try {
|
|
52434
52521
|
await sendToDaemonAwaitAck({ type: "reload-links" });
|
|
52435
|
-
console.log(
|
|
52522
|
+
console.log(chalk264.dim("The sessions daemon reloaded its links."));
|
|
52436
52523
|
} catch (error) {
|
|
52437
52524
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
52438
52525
|
console.log(
|
|
52439
|
-
|
|
52526
|
+
chalk264.yellow(
|
|
52440
52527
|
`Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
|
|
52441
52528
|
)
|
|
52442
52529
|
);
|
|
@@ -52444,7 +52531,7 @@ async function notifyDaemonLinks() {
|
|
|
52444
52531
|
}
|
|
52445
52532
|
|
|
52446
52533
|
// src/commands/sessions/nodes/readLinks.ts
|
|
52447
|
-
import
|
|
52534
|
+
import chalk265 from "chalk";
|
|
52448
52535
|
|
|
52449
52536
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
52450
52537
|
async function writeLinks(links2) {
|
|
@@ -52467,7 +52554,7 @@ async function readLinks() {
|
|
|
52467
52554
|
await writeLinks(links2);
|
|
52468
52555
|
const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
|
|
52469
52556
|
console.log(
|
|
52470
|
-
|
|
52557
|
+
chalk265.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
|
|
52471
52558
|
);
|
|
52472
52559
|
return links2;
|
|
52473
52560
|
}
|
|
@@ -52523,7 +52610,7 @@ async function linkNode(name, url, options2) {
|
|
|
52523
52610
|
throw new Error(`${name} is this node; link to a different node`);
|
|
52524
52611
|
const link3 = await buildLink(name, url, options2);
|
|
52525
52612
|
await writeLinks([...others, link3]);
|
|
52526
|
-
console.log(
|
|
52613
|
+
console.log(chalk266.green(`Linked ${name} (${link3.url})`));
|
|
52527
52614
|
await notifyDaemonLinks();
|
|
52528
52615
|
}
|
|
52529
52616
|
|
|
@@ -52588,14 +52675,14 @@ function startPeerAction(name, action) {
|
|
|
52588
52675
|
const line = `nodes ${action} ${name} trace=${traceId}`;
|
|
52589
52676
|
console.log(line);
|
|
52590
52677
|
appendDaemonLog(line);
|
|
52591
|
-
const
|
|
52678
|
+
const fail10 = async (summary, error) => new Error(await describeFailure(name, summary, error));
|
|
52592
52679
|
return {
|
|
52593
52680
|
spec,
|
|
52594
52681
|
traceId,
|
|
52595
|
-
fail:
|
|
52682
|
+
fail: fail10,
|
|
52596
52683
|
async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
|
|
52597
52684
|
const link3 = await awaitLinkReturn(name, { sawDown, timeoutMs });
|
|
52598
|
-
if (!link3) throw await
|
|
52685
|
+
if (!link3) throw await fail10(`${name} did not come back`);
|
|
52599
52686
|
return link3;
|
|
52600
52687
|
}
|
|
52601
52688
|
};
|
|
@@ -52706,16 +52793,16 @@ function registerPeerActionCommands(nodes, calledBy4) {
|
|
|
52706
52793
|
}
|
|
52707
52794
|
|
|
52708
52795
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
52709
|
-
import
|
|
52796
|
+
import chalk267 from "chalk";
|
|
52710
52797
|
async function unlinkNode(name) {
|
|
52711
52798
|
const links2 = await readLinks();
|
|
52712
52799
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
52713
52800
|
if (remaining.length === links2.length) {
|
|
52714
|
-
console.log(
|
|
52801
|
+
console.log(chalk267.yellow(`No link named ${name}`));
|
|
52715
52802
|
return;
|
|
52716
52803
|
}
|
|
52717
52804
|
await writeLinks(remaining);
|
|
52718
|
-
console.log(
|
|
52805
|
+
console.log(chalk267.green(`Unlinked ${name}`));
|
|
52719
52806
|
await notifyDaemonLinks();
|
|
52720
52807
|
}
|
|
52721
52808
|
|
|
@@ -52789,17 +52876,17 @@ function resolveTarget3(sessionId, server) {
|
|
|
52789
52876
|
async function sessionOutput(sessionId, options2) {
|
|
52790
52877
|
const count10 = Number.parseInt(options2.lines, 10);
|
|
52791
52878
|
if (!Number.isInteger(count10) || count10 < 1)
|
|
52792
|
-
return
|
|
52879
|
+
return fail9(`-n must be a positive integer, got ${options2.lines}`);
|
|
52793
52880
|
const target = resolveTarget3(sessionId, options2.server);
|
|
52794
|
-
if (typeof target === "string") return
|
|
52881
|
+
if (typeof target === "string") return fail9(target);
|
|
52795
52882
|
try {
|
|
52796
52883
|
const scrollback = await requestSessionOutput(target);
|
|
52797
52884
|
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
52798
52885
|
} catch (error) {
|
|
52799
|
-
|
|
52886
|
+
fail9(error instanceof Error ? error.message : String(error));
|
|
52800
52887
|
}
|
|
52801
52888
|
}
|
|
52802
|
-
function
|
|
52889
|
+
function fail9(message3) {
|
|
52803
52890
|
console.error(message3);
|
|
52804
52891
|
process.exitCode = 1;
|
|
52805
52892
|
}
|
|
@@ -52950,10 +53037,10 @@ function createProgram() {
|
|
|
52950
53037
|
}
|
|
52951
53038
|
|
|
52952
53039
|
// src/reportCliError.ts
|
|
52953
|
-
import
|
|
53040
|
+
import chalk268 from "chalk";
|
|
52954
53041
|
function reportCliError(error) {
|
|
52955
53042
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
52956
|
-
console.error(
|
|
53043
|
+
console.error(chalk268.red(error.message));
|
|
52957
53044
|
} else {
|
|
52958
53045
|
console.error(error);
|
|
52959
53046
|
}
|