@staff0rd/assist 0.623.1 → 0.624.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +342 -253
- 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.624.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -705,6 +705,10 @@ var assistConfigShape = {
|
|
|
705
705
|
suppress: z3.array(z3.string()).default([])
|
|
706
706
|
}).default({ suppress: [] })
|
|
707
707
|
}).optional(),
|
|
708
|
+
litellm: z3.strictObject({
|
|
709
|
+
baseUrl: z3.string().optional(),
|
|
710
|
+
apiKey: secretConfigValue(z3.string()).optional()
|
|
711
|
+
}).optional(),
|
|
708
712
|
ravendb: z3.strictObject({
|
|
709
713
|
connections: z3.array(
|
|
710
714
|
z3.strictObject({
|
|
@@ -3076,6 +3080,20 @@ var jiraConfigHelp = [
|
|
|
3076
3080
|
}
|
|
3077
3081
|
];
|
|
3078
3082
|
|
|
3083
|
+
// src/commands/litellm/litellmConfigHelp.ts
|
|
3084
|
+
var litellmConfigHelp = [
|
|
3085
|
+
{
|
|
3086
|
+
key: "litellm.baseUrl",
|
|
3087
|
+
setter: "assist config set litellm.baseUrl https://...",
|
|
3088
|
+
note: "LiteLLM proxy base URL"
|
|
3089
|
+
},
|
|
3090
|
+
{
|
|
3091
|
+
key: "litellm.apiKey",
|
|
3092
|
+
setter: "assist config set litellm.apiKey sk-...",
|
|
3093
|
+
note: "LiteLLM proxy API key"
|
|
3094
|
+
}
|
|
3095
|
+
];
|
|
3096
|
+
|
|
3079
3097
|
// src/commands/mermaid/mermaidConfigHelp.ts
|
|
3080
3098
|
var mermaidConfigHelp = [
|
|
3081
3099
|
{
|
|
@@ -3463,6 +3481,7 @@ var configHelpEntries = [
|
|
|
3463
3481
|
...dotnetConfigHelp,
|
|
3464
3482
|
...harnessConfigHelp,
|
|
3465
3483
|
...jiraConfigHelp,
|
|
3484
|
+
...litellmConfigHelp,
|
|
3466
3485
|
...mermaidConfigHelp,
|
|
3467
3486
|
...miroConfigHelp,
|
|
3468
3487
|
...prsConfigHelp,
|
|
@@ -23896,18 +23915,85 @@ function registerList(program2) {
|
|
|
23896
23915
|
});
|
|
23897
23916
|
}
|
|
23898
23917
|
|
|
23918
|
+
// src/commands/litellm/listModels.ts
|
|
23919
|
+
import chalk172 from "chalk";
|
|
23920
|
+
|
|
23921
|
+
// src/commands/litellm/resolveLitellmConfig.ts
|
|
23922
|
+
import chalk171 from "chalk";
|
|
23923
|
+
function resolveLitellmConfig() {
|
|
23924
|
+
const litellm = loadConfig().litellm;
|
|
23925
|
+
const baseUrl = litellm?.baseUrl?.trim();
|
|
23926
|
+
const apiKey = litellm?.apiKey?.trim();
|
|
23927
|
+
if (!baseUrl || !apiKey) {
|
|
23928
|
+
const missing = [
|
|
23929
|
+
...baseUrl ? [] : ["litellm.baseUrl"],
|
|
23930
|
+
...apiKey ? [] : ["litellm.apiKey"]
|
|
23931
|
+
];
|
|
23932
|
+
console.error(chalk171.red("LiteLLM is not configured"));
|
|
23933
|
+
for (const key of missing) {
|
|
23934
|
+
const entry = litellmConfigHelp.find((help) => help.key === key);
|
|
23935
|
+
console.error(
|
|
23936
|
+
chalk171.red(` ${key} is not set. Set it with: ${entry?.setter}`)
|
|
23937
|
+
);
|
|
23938
|
+
}
|
|
23939
|
+
process.exit(1);
|
|
23940
|
+
}
|
|
23941
|
+
return { baseUrl: baseUrl.replace(/\/+$/, ""), apiKey };
|
|
23942
|
+
}
|
|
23943
|
+
|
|
23944
|
+
// src/commands/litellm/listModels.ts
|
|
23945
|
+
function parseModelIds(body) {
|
|
23946
|
+
const parsed = JSON.parse(body);
|
|
23947
|
+
return (parsed.data ?? []).map((model) => model.id).filter((id) => typeof id === "string").sort();
|
|
23948
|
+
}
|
|
23949
|
+
async function listModels(options2) {
|
|
23950
|
+
const { baseUrl, apiKey } = resolveLitellmConfig();
|
|
23951
|
+
let response;
|
|
23952
|
+
try {
|
|
23953
|
+
response = await fetch(`${baseUrl}/v1/models`, {
|
|
23954
|
+
headers: {
|
|
23955
|
+
Accept: "application/json",
|
|
23956
|
+
Authorization: `Bearer ${apiKey}`
|
|
23957
|
+
}
|
|
23958
|
+
});
|
|
23959
|
+
} catch (error) {
|
|
23960
|
+
const reason4 = error instanceof Error ? error.message : String(error);
|
|
23961
|
+
console.error(
|
|
23962
|
+
chalk172.red(`Failed to reach LiteLLM at ${baseUrl}: ${reason4}`)
|
|
23963
|
+
);
|
|
23964
|
+
process.exit(1);
|
|
23965
|
+
}
|
|
23966
|
+
const body = await response.text();
|
|
23967
|
+
if (!response.ok) {
|
|
23968
|
+
console.error(chalk172.red(`LiteLLM returned ${response.status}: ${body}`));
|
|
23969
|
+
process.exit(1);
|
|
23970
|
+
}
|
|
23971
|
+
if (options2.json) {
|
|
23972
|
+
console.log(body);
|
|
23973
|
+
return;
|
|
23974
|
+
}
|
|
23975
|
+
for (const id of parseModelIds(body)) console.log(id);
|
|
23976
|
+
}
|
|
23977
|
+
|
|
23978
|
+
// src/commands/registerLitellm.ts
|
|
23979
|
+
function registerLitellm(program2) {
|
|
23980
|
+
const cmd = program2.command("litellm").description("LiteLLM proxy utilities");
|
|
23981
|
+
const listModelsCommand = cmd.command("list-models").description("List the models the configured LiteLLM proxy serves").option("--json", "Output the raw /v1/models response body").action((options2) => listModels(options2));
|
|
23982
|
+
configHelp(listModelsCommand, litellmConfigHelp);
|
|
23983
|
+
}
|
|
23984
|
+
|
|
23899
23985
|
// src/commands/mermaid/index.ts
|
|
23900
23986
|
import { mkdirSync as mkdirSync18, readdirSync as readdirSync11 } from "fs";
|
|
23901
23987
|
import { resolve as resolve16 } from "path";
|
|
23902
|
-
import
|
|
23988
|
+
import chalk175 from "chalk";
|
|
23903
23989
|
|
|
23904
23990
|
// src/commands/mermaid/exportFile.ts
|
|
23905
23991
|
import { readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
|
|
23906
23992
|
import { basename as basename17, extname as extname2, resolve as resolve15 } from "path";
|
|
23907
|
-
import
|
|
23993
|
+
import chalk174 from "chalk";
|
|
23908
23994
|
|
|
23909
23995
|
// src/commands/mermaid/renderBlock.ts
|
|
23910
|
-
import
|
|
23996
|
+
import chalk173 from "chalk";
|
|
23911
23997
|
async function renderBlock(krokiUrl, source) {
|
|
23912
23998
|
const response = await fetch(`${krokiUrl}/mermaid/svg`, {
|
|
23913
23999
|
method: "POST",
|
|
@@ -23916,7 +24002,7 @@ async function renderBlock(krokiUrl, source) {
|
|
|
23916
24002
|
});
|
|
23917
24003
|
if (!response.ok) {
|
|
23918
24004
|
console.error(
|
|
23919
|
-
|
|
24005
|
+
chalk173.red(
|
|
23920
24006
|
`Kroki request failed: ${response.status} ${response.statusText}`
|
|
23921
24007
|
)
|
|
23922
24008
|
);
|
|
@@ -23934,19 +24020,19 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
23934
24020
|
if (onlyIndex !== void 0) {
|
|
23935
24021
|
if (onlyIndex < 1 || onlyIndex > blocks.length) {
|
|
23936
24022
|
console.error(
|
|
23937
|
-
|
|
24023
|
+
chalk174.red(
|
|
23938
24024
|
`${file}: --index ${onlyIndex} out of range (file has ${blocks.length} diagram(s))`
|
|
23939
24025
|
)
|
|
23940
24026
|
);
|
|
23941
24027
|
process.exit(1);
|
|
23942
24028
|
}
|
|
23943
24029
|
console.log(
|
|
23944
|
-
|
|
24030
|
+
chalk174.gray(
|
|
23945
24031
|
`${file} \u2014 rendering diagram ${onlyIndex} of ${blocks.length}`
|
|
23946
24032
|
)
|
|
23947
24033
|
);
|
|
23948
24034
|
} else {
|
|
23949
|
-
console.log(
|
|
24035
|
+
console.log(chalk174.gray(`${file} \u2014 ${blocks.length} diagram(s)`));
|
|
23950
24036
|
}
|
|
23951
24037
|
for (const [i, source] of blocks.entries()) {
|
|
23952
24038
|
const idx = i + 1;
|
|
@@ -23954,7 +24040,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
|
|
|
23954
24040
|
const outPath = resolve15(outDir, `${stem}-${idx}.svg`);
|
|
23955
24041
|
const svg = await renderBlock(krokiUrl, source);
|
|
23956
24042
|
writeFileSync32(outPath, svg, "utf8");
|
|
23957
|
-
console.log(
|
|
24043
|
+
console.log(chalk174.green(` \u2192 ${outPath}`));
|
|
23958
24044
|
}
|
|
23959
24045
|
}
|
|
23960
24046
|
function extractMermaidBlocks(markdown) {
|
|
@@ -23970,18 +24056,18 @@ async function mermaidExport(file, options2 = {}) {
|
|
|
23970
24056
|
if (options2.index !== void 0) {
|
|
23971
24057
|
if (!Number.isInteger(options2.index) || options2.index < 1) {
|
|
23972
24058
|
console.error(
|
|
23973
|
-
|
|
24059
|
+
chalk175.red(`--index must be a positive integer (got ${options2.index})`)
|
|
23974
24060
|
);
|
|
23975
24061
|
process.exit(1);
|
|
23976
24062
|
}
|
|
23977
24063
|
if (!file) {
|
|
23978
|
-
console.error(
|
|
24064
|
+
console.error(chalk175.red("--index requires a file argument"));
|
|
23979
24065
|
process.exit(1);
|
|
23980
24066
|
}
|
|
23981
24067
|
}
|
|
23982
24068
|
const files = file ? [file] : readdirSync11(process.cwd()).filter((name) => name.toLowerCase().endsWith(".md")).sort();
|
|
23983
24069
|
if (files.length === 0) {
|
|
23984
|
-
console.log(
|
|
24070
|
+
console.log(chalk175.gray("No markdown files found in current directory."));
|
|
23985
24071
|
return;
|
|
23986
24072
|
}
|
|
23987
24073
|
for (const f of files) {
|
|
@@ -24127,7 +24213,7 @@ function extractToSave(details, cwd = process.cwd()) {
|
|
|
24127
24213
|
}
|
|
24128
24214
|
|
|
24129
24215
|
// src/commands/miro/keptTexts.ts
|
|
24130
|
-
import
|
|
24216
|
+
import chalk176 from "chalk";
|
|
24131
24217
|
|
|
24132
24218
|
// src/commands/miro/applyIgnore.ts
|
|
24133
24219
|
function applyIgnore(texts, ignore3) {
|
|
@@ -24166,7 +24252,7 @@ function warnUnmatched(file, unmatched) {
|
|
|
24166
24252
|
if (unmatched.length === 0) return;
|
|
24167
24253
|
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
24168
24254
|
console.error(
|
|
24169
|
-
|
|
24255
|
+
chalk176.yellow(
|
|
24170
24256
|
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
24171
24257
|
${entries}`
|
|
24172
24258
|
)
|
|
@@ -24369,7 +24455,7 @@ function readMiroItems(file) {
|
|
|
24369
24455
|
}
|
|
24370
24456
|
|
|
24371
24457
|
// src/commands/miro/resolveExtractOptions.ts
|
|
24372
|
-
import
|
|
24458
|
+
import chalk177 from "chalk";
|
|
24373
24459
|
|
|
24374
24460
|
// src/commands/miro/extractLayers.ts
|
|
24375
24461
|
function extractsIn(layer) {
|
|
@@ -24447,7 +24533,7 @@ function resolveExtractOptions(name, options2, paths) {
|
|
|
24447
24533
|
paths.cwd,
|
|
24448
24534
|
paths.globalConfigPath
|
|
24449
24535
|
);
|
|
24450
|
-
console.error(
|
|
24536
|
+
console.error(chalk177.dim(`Extract "${name}" from ${resolved.from}`));
|
|
24451
24537
|
return resolved.options;
|
|
24452
24538
|
}
|
|
24453
24539
|
|
|
@@ -24549,7 +24635,7 @@ function registerMiro(program2) {
|
|
|
24549
24635
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
24550
24636
|
import { createServer as createServer2 } from "http";
|
|
24551
24637
|
import { dirname as dirname30 } from "path";
|
|
24552
|
-
import
|
|
24638
|
+
import chalk179 from "chalk";
|
|
24553
24639
|
|
|
24554
24640
|
// src/commands/netcap/corsHeaders.ts
|
|
24555
24641
|
var corsHeaders = {
|
|
@@ -24628,7 +24714,7 @@ function createNetcapHandler(options2) {
|
|
|
24628
24714
|
import { cp as cp4, readFile as readFile5, writeFile as writeFile5 } from "fs/promises";
|
|
24629
24715
|
import { networkInterfaces } from "os";
|
|
24630
24716
|
import { join as join64 } from "path";
|
|
24631
|
-
import
|
|
24717
|
+
import chalk178 from "chalk";
|
|
24632
24718
|
|
|
24633
24719
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
24634
24720
|
import { dirname as dirname29, join as join63 } from "path";
|
|
@@ -24672,7 +24758,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
24672
24758
|
const host = lanIPv4();
|
|
24673
24759
|
if (!host) {
|
|
24674
24760
|
console.log(
|
|
24675
|
-
|
|
24761
|
+
chalk178.yellow("could not determine the WSL IP for the extension")
|
|
24676
24762
|
);
|
|
24677
24763
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
24678
24764
|
return source;
|
|
@@ -24683,7 +24769,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
24683
24769
|
return WSL_WINDOWS_PATH3;
|
|
24684
24770
|
} catch {
|
|
24685
24771
|
console.log(
|
|
24686
|
-
|
|
24772
|
+
chalk178.yellow(`could not copy extension to ${WSL_WINDOWS_PATH3}`)
|
|
24687
24773
|
);
|
|
24688
24774
|
return source;
|
|
24689
24775
|
}
|
|
@@ -24716,30 +24802,30 @@ async function netcap(options2) {
|
|
|
24716
24802
|
let count8 = 0;
|
|
24717
24803
|
const handler = createNetcapHandler({
|
|
24718
24804
|
outPath,
|
|
24719
|
-
onPing: () => console.log(
|
|
24805
|
+
onPing: () => console.log(chalk179.dim("ping from extension")),
|
|
24720
24806
|
onCapture: (entry) => {
|
|
24721
24807
|
count8 += 1;
|
|
24722
24808
|
console.log(
|
|
24723
|
-
|
|
24724
|
-
|
|
24809
|
+
chalk179.green(`captured #${count8}`),
|
|
24810
|
+
chalk179.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
24725
24811
|
);
|
|
24726
24812
|
}
|
|
24727
24813
|
});
|
|
24728
24814
|
const server = createServer2(handler);
|
|
24729
24815
|
server.listen(port, () => {
|
|
24730
24816
|
console.log(
|
|
24731
|
-
|
|
24817
|
+
chalk179.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
24732
24818
|
);
|
|
24733
|
-
console.log(
|
|
24819
|
+
console.log(chalk179.dim(`appending captures to ${outPath}`));
|
|
24734
24820
|
if (filter)
|
|
24735
|
-
console.log(
|
|
24736
|
-
console.log(
|
|
24737
|
-
console.log(
|
|
24821
|
+
console.log(chalk179.dim(`forwarding only URLs matching "${filter}"`));
|
|
24822
|
+
console.log(chalk179.dim(`load the unpacked extension from ${extensionPath}`));
|
|
24823
|
+
console.log(chalk179.dim("press Ctrl-C to stop"));
|
|
24738
24824
|
});
|
|
24739
24825
|
process.on("SIGINT", () => {
|
|
24740
24826
|
server.close();
|
|
24741
24827
|
console.log(
|
|
24742
|
-
|
|
24828
|
+
chalk179.bold(
|
|
24743
24829
|
`
|
|
24744
24830
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
24745
24831
|
)
|
|
@@ -24751,7 +24837,7 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
24751
24837
|
// src/commands/netcap/netcapExtract.ts
|
|
24752
24838
|
import { writeFileSync as writeFileSync34 } from "fs";
|
|
24753
24839
|
import { join as join67 } from "path";
|
|
24754
|
-
import
|
|
24840
|
+
import chalk180 from "chalk";
|
|
24755
24841
|
|
|
24756
24842
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
24757
24843
|
import { readFileSync as readFileSync43 } from "fs";
|
|
@@ -25199,8 +25285,8 @@ function netcapExtract(file) {
|
|
|
25199
25285
|
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
25200
25286
|
`);
|
|
25201
25287
|
console.log(
|
|
25202
|
-
|
|
25203
|
-
|
|
25288
|
+
chalk180.green(`extracted ${posts.length} posts`),
|
|
25289
|
+
chalk180.dim(`-> ${outFile}`)
|
|
25204
25290
|
);
|
|
25205
25291
|
}
|
|
25206
25292
|
|
|
@@ -25221,7 +25307,7 @@ function registerNetcap(program2) {
|
|
|
25221
25307
|
}
|
|
25222
25308
|
|
|
25223
25309
|
// src/commands/news/add/index.ts
|
|
25224
|
-
import
|
|
25310
|
+
import chalk181 from "chalk";
|
|
25225
25311
|
import enquirer8 from "enquirer";
|
|
25226
25312
|
async function add2(url) {
|
|
25227
25313
|
if (!url) {
|
|
@@ -25243,10 +25329,10 @@ async function add2(url) {
|
|
|
25243
25329
|
const { orm } = await getReady();
|
|
25244
25330
|
const added = await addFeed(orm, url);
|
|
25245
25331
|
if (!added) {
|
|
25246
|
-
console.log(
|
|
25332
|
+
console.log(chalk181.yellow("Feed already exists"));
|
|
25247
25333
|
return;
|
|
25248
25334
|
}
|
|
25249
|
-
console.log(
|
|
25335
|
+
console.log(chalk181.green(`Added feed: ${url}`));
|
|
25250
25336
|
}
|
|
25251
25337
|
|
|
25252
25338
|
// src/commands/registerNews.ts
|
|
@@ -25293,7 +25379,7 @@ function registerPiHook(program2) {
|
|
|
25293
25379
|
}
|
|
25294
25380
|
|
|
25295
25381
|
// src/commands/prompts/printPromptsTable.ts
|
|
25296
|
-
import
|
|
25382
|
+
import chalk182 from "chalk";
|
|
25297
25383
|
function truncate(str, max) {
|
|
25298
25384
|
if (str.length <= max) return str;
|
|
25299
25385
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -25311,14 +25397,14 @@ function printPromptsTable(rows) {
|
|
|
25311
25397
|
"Command".padEnd(commandWidth),
|
|
25312
25398
|
"Repos"
|
|
25313
25399
|
].join(" ");
|
|
25314
|
-
console.log(
|
|
25315
|
-
console.log(
|
|
25400
|
+
console.log(chalk182.dim(header));
|
|
25401
|
+
console.log(chalk182.dim("-".repeat(header.length)));
|
|
25316
25402
|
for (const row of rows) {
|
|
25317
25403
|
const count8 = String(row.count).padStart(countWidth);
|
|
25318
25404
|
const tool = row.tool.padEnd(toolWidth);
|
|
25319
25405
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
25320
25406
|
console.log(
|
|
25321
|
-
`${
|
|
25407
|
+
`${chalk182.yellow(count8)} ${tool} ${command} ${chalk182.dim(row.repos)}`
|
|
25322
25408
|
);
|
|
25323
25409
|
}
|
|
25324
25410
|
}
|
|
@@ -25892,13 +25978,13 @@ function agentFooter(unresolvedCount) {
|
|
|
25892
25978
|
}
|
|
25893
25979
|
|
|
25894
25980
|
// src/commands/prs/listComments/commentStyle.ts
|
|
25895
|
-
import
|
|
25981
|
+
import chalk183 from "chalk";
|
|
25896
25982
|
var plain = (text18) => text18;
|
|
25897
25983
|
function colouredState(state) {
|
|
25898
25984
|
const label2 = `[${state}]`;
|
|
25899
|
-
if (state === "APPROVED") return
|
|
25900
|
-
if (state === "CHANGES_REQUESTED") return
|
|
25901
|
-
return
|
|
25985
|
+
if (state === "APPROVED") return chalk183.green(label2);
|
|
25986
|
+
if (state === "CHANGES_REQUESTED") return chalk183.red(label2);
|
|
25987
|
+
return chalk183.yellow(label2);
|
|
25902
25988
|
}
|
|
25903
25989
|
function commentStyle() {
|
|
25904
25990
|
if (isClaudeCode()) {
|
|
@@ -25912,9 +25998,9 @@ function commentStyle() {
|
|
|
25912
25998
|
};
|
|
25913
25999
|
}
|
|
25914
26000
|
return {
|
|
25915
|
-
cyan:
|
|
25916
|
-
bold:
|
|
25917
|
-
dim:
|
|
26001
|
+
cyan: chalk183.cyan,
|
|
26002
|
+
bold: chalk183.bold,
|
|
26003
|
+
dim: chalk183.dim,
|
|
25918
26004
|
state: colouredState,
|
|
25919
26005
|
diffHunk: true,
|
|
25920
26006
|
agent: false
|
|
@@ -26084,13 +26170,13 @@ import { execSync as execSync49 } from "child_process";
|
|
|
26084
26170
|
import enquirer9 from "enquirer";
|
|
26085
26171
|
|
|
26086
26172
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
26087
|
-
import
|
|
26173
|
+
import chalk184 from "chalk";
|
|
26088
26174
|
var STATUS_MAP = {
|
|
26089
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
26090
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
26175
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk184.magenta("merged"), date: pr.mergedAt } : null,
|
|
26176
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk184.red("closed"), date: pr.closedAt } : null
|
|
26091
26177
|
};
|
|
26092
26178
|
function defaultStatus(pr) {
|
|
26093
|
-
return { label:
|
|
26179
|
+
return { label: chalk184.green("opened"), date: pr.createdAt };
|
|
26094
26180
|
}
|
|
26095
26181
|
function getStatus2(pr) {
|
|
26096
26182
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -26099,11 +26185,11 @@ function formatDate(dateStr) {
|
|
|
26099
26185
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
26100
26186
|
}
|
|
26101
26187
|
function formatPrHeader(pr, status3) {
|
|
26102
|
-
return `${
|
|
26188
|
+
return `${chalk184.cyan(`#${pr.number}`)} ${pr.title} ${chalk184.dim(`(${pr.author.login},`)} ${status3.label} ${chalk184.dim(`${formatDate(status3.date)})`)}`;
|
|
26103
26189
|
}
|
|
26104
26190
|
function logPrDetails(pr) {
|
|
26105
26191
|
console.log(
|
|
26106
|
-
|
|
26192
|
+
chalk184.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
26107
26193
|
);
|
|
26108
26194
|
console.log();
|
|
26109
26195
|
}
|
|
@@ -26818,10 +26904,10 @@ function registerPrs(program2) {
|
|
|
26818
26904
|
}
|
|
26819
26905
|
|
|
26820
26906
|
// src/commands/ravendb/ravendbAuth.ts
|
|
26821
|
-
import
|
|
26907
|
+
import chalk190 from "chalk";
|
|
26822
26908
|
|
|
26823
26909
|
// src/shared/createConnectionAuth.ts
|
|
26824
|
-
import
|
|
26910
|
+
import chalk185 from "chalk";
|
|
26825
26911
|
function listConnections(connections, format) {
|
|
26826
26912
|
if (connections.length === 0) {
|
|
26827
26913
|
console.log("No connections configured.");
|
|
@@ -26834,7 +26920,7 @@ function listConnections(connections, format) {
|
|
|
26834
26920
|
function removeConnection(connections, name, save) {
|
|
26835
26921
|
const filtered = connections.filter((c) => c.name !== name);
|
|
26836
26922
|
if (filtered.length === connections.length) {
|
|
26837
|
-
console.error(
|
|
26923
|
+
console.error(chalk185.red(`Connection "${name}" not found.`));
|
|
26838
26924
|
process.exit(1);
|
|
26839
26925
|
}
|
|
26840
26926
|
save(filtered);
|
|
@@ -26880,15 +26966,15 @@ function saveConnections(connections) {
|
|
|
26880
26966
|
}
|
|
26881
26967
|
|
|
26882
26968
|
// src/commands/ravendb/promptConnection.ts
|
|
26883
|
-
import
|
|
26969
|
+
import chalk188 from "chalk";
|
|
26884
26970
|
|
|
26885
26971
|
// src/commands/ravendb/selectOpSecret.ts
|
|
26886
|
-
import
|
|
26972
|
+
import chalk187 from "chalk";
|
|
26887
26973
|
import Enquirer2 from "enquirer";
|
|
26888
26974
|
|
|
26889
26975
|
// src/commands/ravendb/searchItems.ts
|
|
26890
26976
|
import { execSync as execSync52 } from "child_process";
|
|
26891
|
-
import
|
|
26977
|
+
import chalk186 from "chalk";
|
|
26892
26978
|
function opExec(args) {
|
|
26893
26979
|
return execSync52(`op ${args}`, {
|
|
26894
26980
|
encoding: "utf8",
|
|
@@ -26901,7 +26987,7 @@ function searchItems(search2) {
|
|
|
26901
26987
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
26902
26988
|
} catch {
|
|
26903
26989
|
console.error(
|
|
26904
|
-
|
|
26990
|
+
chalk186.red(
|
|
26905
26991
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
26906
26992
|
)
|
|
26907
26993
|
);
|
|
@@ -26915,7 +27001,7 @@ function getItemFields(itemId2) {
|
|
|
26915
27001
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
26916
27002
|
return item.fields.filter((f) => f.reference && f.label);
|
|
26917
27003
|
} catch {
|
|
26918
|
-
console.error(
|
|
27004
|
+
console.error(chalk186.red("Failed to get item details from 1Password."));
|
|
26919
27005
|
process.exit(1);
|
|
26920
27006
|
}
|
|
26921
27007
|
}
|
|
@@ -26934,7 +27020,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
26934
27020
|
}).run();
|
|
26935
27021
|
const items2 = searchItems(search2);
|
|
26936
27022
|
if (items2.length === 0) {
|
|
26937
|
-
console.error(
|
|
27023
|
+
console.error(chalk187.red(`No items found matching "${search2}".`));
|
|
26938
27024
|
process.exit(1);
|
|
26939
27025
|
}
|
|
26940
27026
|
const itemId2 = await selectOne(
|
|
@@ -26943,7 +27029,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
26943
27029
|
);
|
|
26944
27030
|
const fields = getItemFields(itemId2);
|
|
26945
27031
|
if (fields.length === 0) {
|
|
26946
|
-
console.error(
|
|
27032
|
+
console.error(chalk187.red("No fields with references found on this item."));
|
|
26947
27033
|
process.exit(1);
|
|
26948
27034
|
}
|
|
26949
27035
|
const ref = await selectOne(
|
|
@@ -26957,7 +27043,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
26957
27043
|
async function promptConnection(existingNames) {
|
|
26958
27044
|
const name = await promptInput("name", "Connection name:");
|
|
26959
27045
|
if (existingNames.includes(name)) {
|
|
26960
|
-
console.error(
|
|
27046
|
+
console.error(chalk188.red(`Connection "${name}" already exists.`));
|
|
26961
27047
|
process.exit(1);
|
|
26962
27048
|
}
|
|
26963
27049
|
const url = await promptInput(
|
|
@@ -26966,22 +27052,22 @@ async function promptConnection(existingNames) {
|
|
|
26966
27052
|
);
|
|
26967
27053
|
const database = await promptInput("database", "Database name:");
|
|
26968
27054
|
if (!name || !url || !database) {
|
|
26969
|
-
console.error(
|
|
27055
|
+
console.error(chalk188.red("All fields are required."));
|
|
26970
27056
|
process.exit(1);
|
|
26971
27057
|
}
|
|
26972
27058
|
const apiKeyRef = await selectOpSecret();
|
|
26973
|
-
console.log(
|
|
27059
|
+
console.log(chalk188.dim(`Using: ${apiKeyRef}`));
|
|
26974
27060
|
return { name, url, database, apiKeyRef };
|
|
26975
27061
|
}
|
|
26976
27062
|
|
|
26977
27063
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
26978
|
-
import
|
|
27064
|
+
import chalk189 from "chalk";
|
|
26979
27065
|
function ravendbSetConnection(name) {
|
|
26980
27066
|
const raw = loadGlobalConfigRaw();
|
|
26981
27067
|
const ravendb = raw.ravendb ?? {};
|
|
26982
27068
|
const connections = ravendb.connections ?? [];
|
|
26983
27069
|
if (!connections.some((c) => c.name === name)) {
|
|
26984
|
-
console.error(
|
|
27070
|
+
console.error(chalk189.red(`Connection "${name}" not found.`));
|
|
26985
27071
|
console.error(
|
|
26986
27072
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
26987
27073
|
);
|
|
@@ -26997,16 +27083,16 @@ function ravendbSetConnection(name) {
|
|
|
26997
27083
|
var ravendbAuth = createConnectionAuth({
|
|
26998
27084
|
load: loadConnections,
|
|
26999
27085
|
save: saveConnections,
|
|
27000
|
-
format: (c) => `${
|
|
27086
|
+
format: (c) => `${chalk190.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
27001
27087
|
promptNew: promptConnection,
|
|
27002
27088
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
27003
27089
|
});
|
|
27004
27090
|
|
|
27005
27091
|
// src/commands/ravendb/ravendbCollections.ts
|
|
27006
|
-
import
|
|
27092
|
+
import chalk194 from "chalk";
|
|
27007
27093
|
|
|
27008
27094
|
// src/commands/ravendb/ravenFetch.ts
|
|
27009
|
-
import
|
|
27095
|
+
import chalk192 from "chalk";
|
|
27010
27096
|
|
|
27011
27097
|
// src/commands/ravendb/getAccessToken.ts
|
|
27012
27098
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -27043,10 +27129,10 @@ ${errorText}`
|
|
|
27043
27129
|
|
|
27044
27130
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
27045
27131
|
import { execSync as execSync53 } from "child_process";
|
|
27046
|
-
import
|
|
27132
|
+
import chalk191 from "chalk";
|
|
27047
27133
|
function resolveOpSecret(reference) {
|
|
27048
27134
|
if (!reference.startsWith("op://")) {
|
|
27049
|
-
console.error(
|
|
27135
|
+
console.error(chalk191.red(`Invalid secret reference: must start with op://`));
|
|
27050
27136
|
process.exit(1);
|
|
27051
27137
|
}
|
|
27052
27138
|
try {
|
|
@@ -27056,7 +27142,7 @@ function resolveOpSecret(reference) {
|
|
|
27056
27142
|
}).trim();
|
|
27057
27143
|
} catch {
|
|
27058
27144
|
console.error(
|
|
27059
|
-
|
|
27145
|
+
chalk191.red(
|
|
27060
27146
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
27061
27147
|
)
|
|
27062
27148
|
);
|
|
@@ -27083,7 +27169,7 @@ async function ravenFetch(connection, path90) {
|
|
|
27083
27169
|
if (!response.ok) {
|
|
27084
27170
|
const body = await response.text();
|
|
27085
27171
|
console.error(
|
|
27086
|
-
|
|
27172
|
+
chalk192.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
27087
27173
|
);
|
|
27088
27174
|
console.error(body.substring(0, 500));
|
|
27089
27175
|
process.exit(1);
|
|
@@ -27092,7 +27178,7 @@ async function ravenFetch(connection, path90) {
|
|
|
27092
27178
|
}
|
|
27093
27179
|
|
|
27094
27180
|
// src/commands/ravendb/resolveConnection.ts
|
|
27095
|
-
import
|
|
27181
|
+
import chalk193 from "chalk";
|
|
27096
27182
|
function loadRavendb() {
|
|
27097
27183
|
const raw = loadGlobalConfigRaw();
|
|
27098
27184
|
const ravendb = raw.ravendb;
|
|
@@ -27106,7 +27192,7 @@ function resolveConnection(name) {
|
|
|
27106
27192
|
const connectionName = name ?? defaultConnection;
|
|
27107
27193
|
if (!connectionName) {
|
|
27108
27194
|
console.error(
|
|
27109
|
-
|
|
27195
|
+
chalk193.red(
|
|
27110
27196
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
27111
27197
|
)
|
|
27112
27198
|
);
|
|
@@ -27114,7 +27200,7 @@ function resolveConnection(name) {
|
|
|
27114
27200
|
}
|
|
27115
27201
|
const connection = connections.find((c) => c.name === connectionName);
|
|
27116
27202
|
if (!connection) {
|
|
27117
|
-
console.error(
|
|
27203
|
+
console.error(chalk193.red(`Connection "${connectionName}" not found.`));
|
|
27118
27204
|
console.error(
|
|
27119
27205
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
27120
27206
|
);
|
|
@@ -27145,15 +27231,15 @@ async function ravendbCollections(connectionName) {
|
|
|
27145
27231
|
return;
|
|
27146
27232
|
}
|
|
27147
27233
|
for (const c of collections) {
|
|
27148
|
-
console.log(`${
|
|
27234
|
+
console.log(`${chalk194.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
27149
27235
|
}
|
|
27150
27236
|
}
|
|
27151
27237
|
|
|
27152
27238
|
// src/commands/ravendb/ravendbQuery.ts
|
|
27153
|
-
import
|
|
27239
|
+
import chalk196 from "chalk";
|
|
27154
27240
|
|
|
27155
27241
|
// src/commands/ravendb/fetchAllPages.ts
|
|
27156
|
-
import
|
|
27242
|
+
import chalk195 from "chalk";
|
|
27157
27243
|
|
|
27158
27244
|
// src/commands/ravendb/buildQueryPath.ts
|
|
27159
27245
|
function buildQueryPath(opts) {
|
|
@@ -27191,7 +27277,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
27191
27277
|
allResults.push(...results);
|
|
27192
27278
|
start3 += results.length;
|
|
27193
27279
|
process.stderr.write(
|
|
27194
|
-
`\r${
|
|
27280
|
+
`\r${chalk195.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
27195
27281
|
);
|
|
27196
27282
|
if (start3 >= totalResults) break;
|
|
27197
27283
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -27206,7 +27292,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
27206
27292
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
27207
27293
|
const resolved = resolveArgs(connectionName, collection);
|
|
27208
27294
|
if (!resolved.collection && !options2.query) {
|
|
27209
|
-
console.error(
|
|
27295
|
+
console.error(chalk196.red("Provide a collection name or --query filter."));
|
|
27210
27296
|
process.exit(1);
|
|
27211
27297
|
}
|
|
27212
27298
|
const { collection: col } = resolved;
|
|
@@ -27245,7 +27331,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
27245
27331
|
import * as path45 from "path";
|
|
27246
27332
|
|
|
27247
27333
|
// src/commands/refactor/logViolations.ts
|
|
27248
|
-
import
|
|
27334
|
+
import chalk197 from "chalk";
|
|
27249
27335
|
var DEFAULT_MAX_LINES2 = 100;
|
|
27250
27336
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
27251
27337
|
if (violations.length === 0) {
|
|
@@ -27254,43 +27340,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
27254
27340
|
}
|
|
27255
27341
|
return;
|
|
27256
27342
|
}
|
|
27257
|
-
console.error(
|
|
27343
|
+
console.error(chalk197.red(`
|
|
27258
27344
|
Refactor check failed:
|
|
27259
27345
|
`));
|
|
27260
|
-
console.error(
|
|
27346
|
+
console.error(chalk197.red(` The following files exceed ${maxLines} lines:
|
|
27261
27347
|
`));
|
|
27262
27348
|
for (const violation of violations) {
|
|
27263
|
-
console.error(
|
|
27349
|
+
console.error(chalk197.red(` ${violation.file} (${violation.lines} lines)`));
|
|
27264
27350
|
}
|
|
27265
27351
|
console.error(
|
|
27266
|
-
|
|
27352
|
+
chalk197.yellow(
|
|
27267
27353
|
`
|
|
27268
27354
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
27269
27355
|
way to refactor it, ignore it with:
|
|
27270
27356
|
`
|
|
27271
27357
|
)
|
|
27272
27358
|
);
|
|
27273
|
-
console.error(
|
|
27359
|
+
console.error(chalk197.gray(` assist refactor ignore <file>
|
|
27274
27360
|
`));
|
|
27275
27361
|
if (process.env.CLAUDECODE) {
|
|
27276
|
-
console.error(
|
|
27362
|
+
console.error(chalk197.cyan(`
|
|
27277
27363
|
## Extracting Code to New Files
|
|
27278
27364
|
`));
|
|
27279
27365
|
console.error(
|
|
27280
|
-
|
|
27366
|
+
chalk197.cyan(
|
|
27281
27367
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
27282
27368
|
`
|
|
27283
27369
|
)
|
|
27284
27370
|
);
|
|
27285
27371
|
console.error(
|
|
27286
|
-
|
|
27372
|
+
chalk197.cyan(
|
|
27287
27373
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
27288
27374
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
27289
27375
|
`
|
|
27290
27376
|
)
|
|
27291
27377
|
);
|
|
27292
27378
|
console.error(
|
|
27293
|
-
|
|
27379
|
+
chalk197.cyan(
|
|
27294
27380
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
27295
27381
|
domains, move it to a common/shared folder.
|
|
27296
27382
|
`
|
|
@@ -27446,7 +27532,7 @@ async function check(pattern2, options2) {
|
|
|
27446
27532
|
|
|
27447
27533
|
// src/commands/refactor/extract/index.ts
|
|
27448
27534
|
import path53 from "path";
|
|
27449
|
-
import
|
|
27535
|
+
import chalk200 from "chalk";
|
|
27450
27536
|
|
|
27451
27537
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
27452
27538
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -28045,23 +28131,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
28045
28131
|
|
|
28046
28132
|
// src/commands/refactor/extract/displayPlan.ts
|
|
28047
28133
|
import path49 from "path";
|
|
28048
|
-
import
|
|
28134
|
+
import chalk198 from "chalk";
|
|
28049
28135
|
function section2(title) {
|
|
28050
28136
|
return `
|
|
28051
|
-
${
|
|
28137
|
+
${chalk198.cyan(title)}`;
|
|
28052
28138
|
}
|
|
28053
28139
|
function displayImporters(plan2, cwd) {
|
|
28054
28140
|
if (plan2.importersToUpdate.length === 0) return;
|
|
28055
28141
|
console.log(section2("Update importers:"));
|
|
28056
28142
|
for (const imp of plan2.importersToUpdate) {
|
|
28057
28143
|
const rel = path49.relative(cwd, imp.file.getFilePath());
|
|
28058
|
-
console.log(` ${
|
|
28144
|
+
console.log(` ${chalk198.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
28059
28145
|
}
|
|
28060
28146
|
}
|
|
28061
28147
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
28062
|
-
console.log(
|
|
28148
|
+
console.log(chalk198.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
28063
28149
|
`));
|
|
28064
|
-
console.log(` ${
|
|
28150
|
+
console.log(` ${chalk198.cyan("Functions to move:")}`);
|
|
28065
28151
|
for (const name of plan2.extractedNames) {
|
|
28066
28152
|
console.log(` ${name}`);
|
|
28067
28153
|
}
|
|
@@ -28095,7 +28181,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
28095
28181
|
|
|
28096
28182
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
28097
28183
|
import path52 from "path";
|
|
28098
|
-
import
|
|
28184
|
+
import chalk199 from "chalk";
|
|
28099
28185
|
import { Project as Project4 } from "ts-morph";
|
|
28100
28186
|
|
|
28101
28187
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -28187,7 +28273,7 @@ function loadProjectFile(file) {
|
|
|
28187
28273
|
});
|
|
28188
28274
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
28189
28275
|
if (!sourceFile) {
|
|
28190
|
-
console.log(
|
|
28276
|
+
console.log(chalk199.red(`File not found in project: ${file}`));
|
|
28191
28277
|
process.exit(1);
|
|
28192
28278
|
}
|
|
28193
28279
|
return { project, sourceFile };
|
|
@@ -28210,19 +28296,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
28210
28296
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
28211
28297
|
if (options2.apply) {
|
|
28212
28298
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
28213
|
-
console.log(
|
|
28299
|
+
console.log(chalk200.green("\nExtraction complete"));
|
|
28214
28300
|
} else {
|
|
28215
|
-
console.log(
|
|
28301
|
+
console.log(chalk200.dim("\nDry run. Use --apply to execute."));
|
|
28216
28302
|
}
|
|
28217
28303
|
}
|
|
28218
28304
|
|
|
28219
28305
|
// src/commands/refactor/ignore.ts
|
|
28220
28306
|
import fs33 from "fs";
|
|
28221
|
-
import
|
|
28307
|
+
import chalk201 from "chalk";
|
|
28222
28308
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
28223
28309
|
function ignore2(file) {
|
|
28224
28310
|
if (!fs33.existsSync(file)) {
|
|
28225
|
-
console.error(
|
|
28311
|
+
console.error(chalk201.red(`Error: File does not exist: ${file}`));
|
|
28226
28312
|
process.exit(1);
|
|
28227
28313
|
}
|
|
28228
28314
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -28238,7 +28324,7 @@ function ignore2(file) {
|
|
|
28238
28324
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
28239
28325
|
}
|
|
28240
28326
|
console.log(
|
|
28241
|
-
|
|
28327
|
+
chalk201.green(
|
|
28242
28328
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
28243
28329
|
)
|
|
28244
28330
|
);
|
|
@@ -28247,12 +28333,12 @@ function ignore2(file) {
|
|
|
28247
28333
|
// src/commands/refactor/rename/index.ts
|
|
28248
28334
|
import fs36 from "fs";
|
|
28249
28335
|
import path58 from "path";
|
|
28250
|
-
import
|
|
28336
|
+
import chalk204 from "chalk";
|
|
28251
28337
|
|
|
28252
28338
|
// src/commands/refactor/rename/applyRename.ts
|
|
28253
28339
|
import fs35 from "fs";
|
|
28254
28340
|
import path55 from "path";
|
|
28255
|
-
import
|
|
28341
|
+
import chalk202 from "chalk";
|
|
28256
28342
|
|
|
28257
28343
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
28258
28344
|
import path54 from "path";
|
|
@@ -28357,13 +28443,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
28357
28443
|
const updatedContents = applyRewrites(rewrites);
|
|
28358
28444
|
for (const [file, content] of updatedContents) {
|
|
28359
28445
|
fs35.writeFileSync(file, content, "utf8");
|
|
28360
|
-
console.log(
|
|
28446
|
+
console.log(chalk202.cyan(` Updated imports in ${path55.relative(cwd, file)}`));
|
|
28361
28447
|
}
|
|
28362
28448
|
const destDir = path55.dirname(destPath);
|
|
28363
28449
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
28364
28450
|
fs35.renameSync(sourcePath, destPath);
|
|
28365
28451
|
console.log(
|
|
28366
|
-
|
|
28452
|
+
chalk202.white(
|
|
28367
28453
|
` Moved ${path55.relative(cwd, sourcePath)} \u2192 ${path55.relative(cwd, destPath)}`
|
|
28368
28454
|
)
|
|
28369
28455
|
);
|
|
@@ -28450,16 +28536,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
28450
28536
|
|
|
28451
28537
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
28452
28538
|
import path57 from "path";
|
|
28453
|
-
import
|
|
28539
|
+
import chalk203 from "chalk";
|
|
28454
28540
|
function printRenamePreview(rewrites, cwd) {
|
|
28455
28541
|
for (const rewrite of rewrites) {
|
|
28456
28542
|
console.log(
|
|
28457
|
-
|
|
28543
|
+
chalk203.dim(
|
|
28458
28544
|
` ${path57.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
28459
28545
|
)
|
|
28460
28546
|
);
|
|
28461
28547
|
}
|
|
28462
|
-
console.log(
|
|
28548
|
+
console.log(chalk203.dim("Dry run. Use --apply to execute."));
|
|
28463
28549
|
}
|
|
28464
28550
|
|
|
28465
28551
|
// src/commands/refactor/rename/index.ts
|
|
@@ -28470,20 +28556,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
28470
28556
|
const relSource = path58.relative(cwd, sourcePath);
|
|
28471
28557
|
const relDest = path58.relative(cwd, destPath);
|
|
28472
28558
|
if (!fs36.existsSync(sourcePath)) {
|
|
28473
|
-
console.log(
|
|
28559
|
+
console.log(chalk204.red(`File not found: ${source}`));
|
|
28474
28560
|
process.exit(1);
|
|
28475
28561
|
}
|
|
28476
28562
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
28477
|
-
console.log(
|
|
28563
|
+
console.log(chalk204.red(`Destination already exists: ${destination}`));
|
|
28478
28564
|
process.exit(1);
|
|
28479
28565
|
}
|
|
28480
|
-
console.log(
|
|
28481
|
-
console.log(
|
|
28482
|
-
console.log(
|
|
28566
|
+
console.log(chalk204.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
28567
|
+
console.log(chalk204.dim("Loading project..."));
|
|
28568
|
+
console.log(chalk204.dim("Scanning imports across the project..."));
|
|
28483
28569
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
28484
28570
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
28485
28571
|
console.log(
|
|
28486
|
-
|
|
28572
|
+
chalk204.dim(
|
|
28487
28573
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
28488
28574
|
)
|
|
28489
28575
|
);
|
|
@@ -28492,11 +28578,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
28492
28578
|
return;
|
|
28493
28579
|
}
|
|
28494
28580
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
28495
|
-
console.log(
|
|
28581
|
+
console.log(chalk204.green("Done"));
|
|
28496
28582
|
}
|
|
28497
28583
|
|
|
28498
28584
|
// src/commands/refactor/renameSymbol/index.ts
|
|
28499
|
-
import
|
|
28585
|
+
import chalk205 from "chalk";
|
|
28500
28586
|
|
|
28501
28587
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
28502
28588
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -28542,33 +28628,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
28542
28628
|
const { project, sourceFile } = loadProjectFile(file);
|
|
28543
28629
|
const symbol = findSymbol(sourceFile, oldName);
|
|
28544
28630
|
if (!symbol) {
|
|
28545
|
-
console.log(
|
|
28631
|
+
console.log(chalk205.red(`Symbol "${oldName}" not found in ${file}`));
|
|
28546
28632
|
process.exit(1);
|
|
28547
28633
|
}
|
|
28548
28634
|
const grouped = groupReferences(symbol, cwd);
|
|
28549
28635
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
28550
28636
|
console.log(
|
|
28551
|
-
|
|
28637
|
+
chalk205.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
28552
28638
|
`)
|
|
28553
28639
|
);
|
|
28554
28640
|
for (const [refFile, lines2] of grouped) {
|
|
28555
28641
|
console.log(
|
|
28556
|
-
` ${
|
|
28642
|
+
` ${chalk205.dim(refFile)}: lines ${chalk205.cyan(lines2.join(", "))}`
|
|
28557
28643
|
);
|
|
28558
28644
|
}
|
|
28559
28645
|
if (options2.apply) {
|
|
28560
28646
|
symbol.rename(newName);
|
|
28561
28647
|
await project.save();
|
|
28562
|
-
console.log(
|
|
28648
|
+
console.log(chalk205.green(`
|
|
28563
28649
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
28564
28650
|
} else {
|
|
28565
|
-
console.log(
|
|
28651
|
+
console.log(chalk205.dim("\nDry run. Use --apply to execute."));
|
|
28566
28652
|
}
|
|
28567
28653
|
}
|
|
28568
28654
|
|
|
28569
28655
|
// src/commands/refactor/restructure/index.ts
|
|
28570
28656
|
import path66 from "path";
|
|
28571
|
-
import
|
|
28657
|
+
import chalk208 from "chalk";
|
|
28572
28658
|
|
|
28573
28659
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
28574
28660
|
import path60 from "path";
|
|
@@ -28647,50 +28733,50 @@ function clusterFiles(graph) {
|
|
|
28647
28733
|
|
|
28648
28734
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
28649
28735
|
import path62 from "path";
|
|
28650
|
-
import
|
|
28736
|
+
import chalk206 from "chalk";
|
|
28651
28737
|
function relPath(filePath) {
|
|
28652
28738
|
return path62.relative(process.cwd(), filePath);
|
|
28653
28739
|
}
|
|
28654
28740
|
function displayMoves(plan2) {
|
|
28655
28741
|
if (plan2.moves.length === 0) return;
|
|
28656
|
-
console.log(
|
|
28742
|
+
console.log(chalk206.bold("\nFile moves:"));
|
|
28657
28743
|
for (const move2 of plan2.moves) {
|
|
28658
28744
|
console.log(
|
|
28659
|
-
` ${
|
|
28745
|
+
` ${chalk206.red(relPath(move2.from))} \u2192 ${chalk206.green(relPath(move2.to))}`
|
|
28660
28746
|
);
|
|
28661
|
-
console.log(
|
|
28747
|
+
console.log(chalk206.dim(` ${move2.reason}`));
|
|
28662
28748
|
}
|
|
28663
28749
|
}
|
|
28664
28750
|
function displayRewrites(rewrites) {
|
|
28665
28751
|
if (rewrites.length === 0) return;
|
|
28666
28752
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
28667
|
-
console.log(
|
|
28753
|
+
console.log(chalk206.bold(`
|
|
28668
28754
|
Import rewrites (${affectedFiles.size} files):`));
|
|
28669
28755
|
for (const file of affectedFiles) {
|
|
28670
|
-
console.log(` ${
|
|
28756
|
+
console.log(` ${chalk206.cyan(relPath(file))}:`);
|
|
28671
28757
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
28672
28758
|
(r) => r.file === file
|
|
28673
28759
|
)) {
|
|
28674
28760
|
console.log(
|
|
28675
|
-
` ${
|
|
28761
|
+
` ${chalk206.red(`"${oldSpecifier}"`)} \u2192 ${chalk206.green(`"${newSpecifier}"`)}`
|
|
28676
28762
|
);
|
|
28677
28763
|
}
|
|
28678
28764
|
}
|
|
28679
28765
|
}
|
|
28680
28766
|
function displayPlan2(plan2) {
|
|
28681
28767
|
if (plan2.warnings.length > 0) {
|
|
28682
|
-
console.log(
|
|
28683
|
-
for (const w of plan2.warnings) console.log(
|
|
28768
|
+
console.log(chalk206.yellow("\nWarnings:"));
|
|
28769
|
+
for (const w of plan2.warnings) console.log(chalk206.yellow(` ${w}`));
|
|
28684
28770
|
}
|
|
28685
28771
|
if (plan2.newDirectories.length > 0) {
|
|
28686
|
-
console.log(
|
|
28772
|
+
console.log(chalk206.bold("\nNew directories:"));
|
|
28687
28773
|
for (const dir of plan2.newDirectories)
|
|
28688
|
-
console.log(
|
|
28774
|
+
console.log(chalk206.green(` ${dir}/`));
|
|
28689
28775
|
}
|
|
28690
28776
|
displayMoves(plan2);
|
|
28691
28777
|
displayRewrites(plan2.rewrites);
|
|
28692
28778
|
console.log(
|
|
28693
|
-
|
|
28779
|
+
chalk206.dim(
|
|
28694
28780
|
`
|
|
28695
28781
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
28696
28782
|
)
|
|
@@ -28700,18 +28786,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
28700
28786
|
// src/commands/refactor/restructure/executePlan.ts
|
|
28701
28787
|
import fs37 from "fs";
|
|
28702
28788
|
import path63 from "path";
|
|
28703
|
-
import
|
|
28789
|
+
import chalk207 from "chalk";
|
|
28704
28790
|
function executePlan(plan2) {
|
|
28705
28791
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
28706
28792
|
for (const [file, content] of updatedContents) {
|
|
28707
28793
|
fs37.writeFileSync(file, content, "utf8");
|
|
28708
28794
|
console.log(
|
|
28709
|
-
|
|
28795
|
+
chalk207.cyan(` Rewrote imports in ${path63.relative(process.cwd(), file)}`)
|
|
28710
28796
|
);
|
|
28711
28797
|
}
|
|
28712
28798
|
for (const dir of plan2.newDirectories) {
|
|
28713
28799
|
fs37.mkdirSync(dir, { recursive: true });
|
|
28714
|
-
console.log(
|
|
28800
|
+
console.log(chalk207.green(` Created ${path63.relative(process.cwd(), dir)}/`));
|
|
28715
28801
|
}
|
|
28716
28802
|
for (const move2 of plan2.moves) {
|
|
28717
28803
|
const targetDir = path63.dirname(move2.to);
|
|
@@ -28720,7 +28806,7 @@ function executePlan(plan2) {
|
|
|
28720
28806
|
}
|
|
28721
28807
|
fs37.renameSync(move2.from, move2.to);
|
|
28722
28808
|
console.log(
|
|
28723
|
-
|
|
28809
|
+
chalk207.white(
|
|
28724
28810
|
` Moved ${path63.relative(process.cwd(), move2.from)} \u2192 ${path63.relative(process.cwd(), move2.to)}`
|
|
28725
28811
|
)
|
|
28726
28812
|
);
|
|
@@ -28735,7 +28821,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
28735
28821
|
if (entries.length === 0) {
|
|
28736
28822
|
fs37.rmdirSync(dir);
|
|
28737
28823
|
console.log(
|
|
28738
|
-
|
|
28824
|
+
chalk207.dim(
|
|
28739
28825
|
` Removed empty directory ${path63.relative(process.cwd(), dir)}`
|
|
28740
28826
|
)
|
|
28741
28827
|
);
|
|
@@ -28868,22 +28954,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
28868
28954
|
const targetPattern = pattern2 ?? "src";
|
|
28869
28955
|
const files = findSourceFiles2(targetPattern);
|
|
28870
28956
|
if (files.length === 0) {
|
|
28871
|
-
console.log(
|
|
28957
|
+
console.log(chalk208.yellow("No files found matching pattern"));
|
|
28872
28958
|
return;
|
|
28873
28959
|
}
|
|
28874
28960
|
const tsConfigPath = findTsConfig(path66.resolve(files[0]));
|
|
28875
28961
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
28876
28962
|
if (plan2.moves.length === 0) {
|
|
28877
|
-
console.log(
|
|
28963
|
+
console.log(chalk208.green("No restructuring needed"));
|
|
28878
28964
|
return;
|
|
28879
28965
|
}
|
|
28880
28966
|
displayPlan2(plan2);
|
|
28881
28967
|
if (options2.apply) {
|
|
28882
|
-
console.log(
|
|
28968
|
+
console.log(chalk208.bold("\nApplying changes..."));
|
|
28883
28969
|
executePlan(plan2);
|
|
28884
|
-
console.log(
|
|
28970
|
+
console.log(chalk208.green("\nRestructuring complete"));
|
|
28885
28971
|
} else {
|
|
28886
|
-
console.log(
|
|
28972
|
+
console.log(chalk208.dim("\nDry run. Use --apply to execute."));
|
|
28887
28973
|
}
|
|
28888
28974
|
}
|
|
28889
28975
|
|
|
@@ -29541,18 +29627,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
29541
29627
|
}
|
|
29542
29628
|
|
|
29543
29629
|
// src/commands/review/warnOutOfDiff.ts
|
|
29544
|
-
import
|
|
29630
|
+
import chalk209 from "chalk";
|
|
29545
29631
|
function warnOutOfDiff(outOfDiff) {
|
|
29546
29632
|
if (outOfDiff.length === 0) return;
|
|
29547
29633
|
console.warn(
|
|
29548
|
-
|
|
29634
|
+
chalk209.yellow(
|
|
29549
29635
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
29550
29636
|
)
|
|
29551
29637
|
);
|
|
29552
29638
|
for (const finding of outOfDiff) {
|
|
29553
29639
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
29554
29640
|
console.warn(
|
|
29555
|
-
` ${
|
|
29641
|
+
` ${chalk209.yellow("\xB7")} ${finding.title} ${chalk209.dim(
|
|
29556
29642
|
`(${finding.file}:${range})`
|
|
29557
29643
|
)}`
|
|
29558
29644
|
);
|
|
@@ -29576,18 +29662,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
29576
29662
|
}
|
|
29577
29663
|
|
|
29578
29664
|
// src/commands/review/warnUnlocated.ts
|
|
29579
|
-
import
|
|
29665
|
+
import chalk210 from "chalk";
|
|
29580
29666
|
function warnUnlocated(unlocated) {
|
|
29581
29667
|
if (unlocated.length === 0) return;
|
|
29582
29668
|
console.warn(
|
|
29583
|
-
|
|
29669
|
+
chalk210.yellow(
|
|
29584
29670
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
29585
29671
|
)
|
|
29586
29672
|
);
|
|
29587
29673
|
for (const finding of unlocated) {
|
|
29588
|
-
const where = finding.location ||
|
|
29674
|
+
const where = finding.location || chalk210.dim("missing");
|
|
29589
29675
|
console.warn(
|
|
29590
|
-
` ${
|
|
29676
|
+
` ${chalk210.yellow("\xB7")} ${finding.title} ${chalk210.dim(`(${where})`)}`
|
|
29591
29677
|
);
|
|
29592
29678
|
}
|
|
29593
29679
|
}
|
|
@@ -30844,7 +30930,7 @@ function registerReview(program2) {
|
|
|
30844
30930
|
// src/commands/rules/addRule.ts
|
|
30845
30931
|
import { existsSync as existsSync66, readFileSync as readFileSync50, writeFileSync as writeFileSync41 } from "fs";
|
|
30846
30932
|
import path71 from "path";
|
|
30847
|
-
import
|
|
30933
|
+
import chalk211 from "chalk";
|
|
30848
30934
|
|
|
30849
30935
|
// src/commands/rules/insertRuleBullet.ts
|
|
30850
30936
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -30980,7 +31066,7 @@ function read2(file) {
|
|
|
30980
31066
|
function addRule(text18, options2) {
|
|
30981
31067
|
const rule = text18.trim();
|
|
30982
31068
|
if (rule === "") {
|
|
30983
|
-
console.error(
|
|
31069
|
+
console.error(chalk211.red("Rule text is required"));
|
|
30984
31070
|
process.exitCode = 1;
|
|
30985
31071
|
return;
|
|
30986
31072
|
}
|
|
@@ -30998,13 +31084,13 @@ function addRule(text18, options2) {
|
|
|
30998
31084
|
);
|
|
30999
31085
|
updateScopedRulesIndex(root);
|
|
31000
31086
|
console.log(
|
|
31001
|
-
`Added ${
|
|
31087
|
+
`Added ${chalk211.cyan(code)} to ${path71.relative(process.cwd(), target) || target}`
|
|
31002
31088
|
);
|
|
31003
31089
|
}
|
|
31004
31090
|
|
|
31005
31091
|
// src/commands/rules/indexRules.ts
|
|
31006
31092
|
import path72 from "path";
|
|
31007
|
-
import
|
|
31093
|
+
import chalk212 from "chalk";
|
|
31008
31094
|
function indexRules() {
|
|
31009
31095
|
const startDir = scopeDirectory(process.cwd());
|
|
31010
31096
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
@@ -31012,24 +31098,24 @@ function indexRules() {
|
|
|
31012
31098
|
const rootFile = path72.relative(process.cwd(), path72.join(root, "CLAUDE.md"));
|
|
31013
31099
|
if (directories.length === 0) {
|
|
31014
31100
|
console.log(
|
|
31015
|
-
|
|
31101
|
+
chalk212.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
31016
31102
|
);
|
|
31017
31103
|
return;
|
|
31018
31104
|
}
|
|
31019
31105
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
31020
31106
|
for (const directory of directories)
|
|
31021
|
-
console.log(` ${
|
|
31107
|
+
console.log(` ${chalk212.cyan(directory)}`);
|
|
31022
31108
|
}
|
|
31023
31109
|
|
|
31024
31110
|
// src/commands/rules/listRules.ts
|
|
31025
31111
|
import path73 from "path";
|
|
31026
|
-
import
|
|
31112
|
+
import chalk213 from "chalk";
|
|
31027
31113
|
function listRules(target, options2 = {}) {
|
|
31028
31114
|
const resolved = path73.resolve(target ?? process.cwd());
|
|
31029
31115
|
const rules3 = readScopedRules(resolved);
|
|
31030
31116
|
if (rules3.length === 0) {
|
|
31031
31117
|
const label2 = path73.relative(process.cwd(), resolved) || ".";
|
|
31032
|
-
console.log(
|
|
31118
|
+
console.log(chalk213.gray(`No rules in scope for ${label2}`));
|
|
31033
31119
|
return;
|
|
31034
31120
|
}
|
|
31035
31121
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -31039,14 +31125,14 @@ function listRules(target, options2 = {}) {
|
|
|
31039
31125
|
if (rule.source !== shown) {
|
|
31040
31126
|
shown = rule.source;
|
|
31041
31127
|
console.log(
|
|
31042
|
-
|
|
31128
|
+
chalk213.dim(base ? path73.relative(base, rule.source) : rule.source)
|
|
31043
31129
|
);
|
|
31044
31130
|
}
|
|
31045
31131
|
console.log(
|
|
31046
|
-
` ${
|
|
31132
|
+
` ${chalk213.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
31047
31133
|
);
|
|
31048
31134
|
if (options2.full && rule.title)
|
|
31049
|
-
console.log(` ${" ".repeat(width)} ${
|
|
31135
|
+
console.log(` ${" ".repeat(width)} ${chalk213.dim(rule.text)}`);
|
|
31050
31136
|
}
|
|
31051
31137
|
}
|
|
31052
31138
|
|
|
@@ -31075,7 +31161,7 @@ function registerRules(program2) {
|
|
|
31075
31161
|
}
|
|
31076
31162
|
|
|
31077
31163
|
// src/commands/seq/seqAuth.ts
|
|
31078
|
-
import
|
|
31164
|
+
import chalk215 from "chalk";
|
|
31079
31165
|
|
|
31080
31166
|
// src/commands/seq/loadConnections.ts
|
|
31081
31167
|
function loadConnections2() {
|
|
@@ -31104,10 +31190,10 @@ function setDefaultConnection(name) {
|
|
|
31104
31190
|
}
|
|
31105
31191
|
|
|
31106
31192
|
// src/shared/assertUniqueName.ts
|
|
31107
|
-
import
|
|
31193
|
+
import chalk214 from "chalk";
|
|
31108
31194
|
function assertUniqueName(existingNames, name) {
|
|
31109
31195
|
if (existingNames.includes(name)) {
|
|
31110
|
-
console.error(
|
|
31196
|
+
console.error(chalk214.red(`Connection "${name}" already exists.`));
|
|
31111
31197
|
process.exit(1);
|
|
31112
31198
|
}
|
|
31113
31199
|
}
|
|
@@ -31125,16 +31211,16 @@ async function promptConnection2(existingNames) {
|
|
|
31125
31211
|
var seqAuth = createConnectionAuth({
|
|
31126
31212
|
load: loadConnections2,
|
|
31127
31213
|
save: saveConnections2,
|
|
31128
|
-
format: (c) => `${
|
|
31214
|
+
format: (c) => `${chalk215.bold(c.name)} ${c.url}`,
|
|
31129
31215
|
promptNew: promptConnection2,
|
|
31130
31216
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
31131
31217
|
});
|
|
31132
31218
|
|
|
31133
31219
|
// src/commands/seq/seqQuery.ts
|
|
31134
|
-
import
|
|
31220
|
+
import chalk219 from "chalk";
|
|
31135
31221
|
|
|
31136
31222
|
// src/commands/seq/fetchSeq.ts
|
|
31137
|
-
import
|
|
31223
|
+
import chalk216 from "chalk";
|
|
31138
31224
|
async function fetchSeq(conn, path90, params) {
|
|
31139
31225
|
const url = `${conn.url}${path90}?${params}`;
|
|
31140
31226
|
const response = await fetch(url, {
|
|
@@ -31145,7 +31231,7 @@ async function fetchSeq(conn, path90, params) {
|
|
|
31145
31231
|
});
|
|
31146
31232
|
if (!response.ok) {
|
|
31147
31233
|
const body = await response.text();
|
|
31148
|
-
console.error(
|
|
31234
|
+
console.error(chalk216.red(`Seq returned ${response.status}: ${body}`));
|
|
31149
31235
|
process.exit(1);
|
|
31150
31236
|
}
|
|
31151
31237
|
return response;
|
|
@@ -31204,23 +31290,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
31204
31290
|
}
|
|
31205
31291
|
|
|
31206
31292
|
// src/commands/seq/formatEvent.ts
|
|
31207
|
-
import
|
|
31293
|
+
import chalk217 from "chalk";
|
|
31208
31294
|
function levelColor(level) {
|
|
31209
31295
|
switch (level) {
|
|
31210
31296
|
case "Fatal":
|
|
31211
|
-
return
|
|
31297
|
+
return chalk217.bgRed.white;
|
|
31212
31298
|
case "Error":
|
|
31213
|
-
return
|
|
31299
|
+
return chalk217.red;
|
|
31214
31300
|
case "Warning":
|
|
31215
|
-
return
|
|
31301
|
+
return chalk217.yellow;
|
|
31216
31302
|
case "Information":
|
|
31217
|
-
return
|
|
31303
|
+
return chalk217.cyan;
|
|
31218
31304
|
case "Debug":
|
|
31219
|
-
return
|
|
31305
|
+
return chalk217.gray;
|
|
31220
31306
|
case "Verbose":
|
|
31221
|
-
return
|
|
31307
|
+
return chalk217.dim;
|
|
31222
31308
|
default:
|
|
31223
|
-
return
|
|
31309
|
+
return chalk217.white;
|
|
31224
31310
|
}
|
|
31225
31311
|
}
|
|
31226
31312
|
function levelAbbrev(level) {
|
|
@@ -31261,12 +31347,12 @@ function formatTimestamp(iso) {
|
|
|
31261
31347
|
function formatEvent(event) {
|
|
31262
31348
|
const color = levelColor(event.Level);
|
|
31263
31349
|
const abbrev = levelAbbrev(event.Level);
|
|
31264
|
-
const ts8 =
|
|
31350
|
+
const ts8 = chalk217.dim(formatTimestamp(event.Timestamp));
|
|
31265
31351
|
const msg = renderMessage(event);
|
|
31266
31352
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
31267
31353
|
if (event.Exception) {
|
|
31268
31354
|
for (const line of event.Exception.split("\n")) {
|
|
31269
|
-
lines2.push(
|
|
31355
|
+
lines2.push(chalk217.red(` ${line}`));
|
|
31270
31356
|
}
|
|
31271
31357
|
}
|
|
31272
31358
|
return lines2.join("\n");
|
|
@@ -31299,11 +31385,11 @@ function rejectTimestampFilter(filter) {
|
|
|
31299
31385
|
}
|
|
31300
31386
|
|
|
31301
31387
|
// src/shared/resolveNamedConnection.ts
|
|
31302
|
-
import
|
|
31388
|
+
import chalk218 from "chalk";
|
|
31303
31389
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
31304
31390
|
if (connections.length === 0) {
|
|
31305
31391
|
console.error(
|
|
31306
|
-
|
|
31392
|
+
chalk218.red(
|
|
31307
31393
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
31308
31394
|
)
|
|
31309
31395
|
);
|
|
@@ -31312,7 +31398,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
31312
31398
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
31313
31399
|
const connection = connections.find((c) => c.name === target);
|
|
31314
31400
|
if (!connection) {
|
|
31315
|
-
console.error(
|
|
31401
|
+
console.error(chalk218.red(`${kind} connection "${target}" not found.`));
|
|
31316
31402
|
process.exit(1);
|
|
31317
31403
|
}
|
|
31318
31404
|
return connection;
|
|
@@ -31341,7 +31427,7 @@ async function seqQuery(filter, options2) {
|
|
|
31341
31427
|
new URLSearchParams({ filter, count: String(count8) })
|
|
31342
31428
|
);
|
|
31343
31429
|
if (events.length === 0) {
|
|
31344
|
-
console.log(
|
|
31430
|
+
console.log(chalk219.yellow("No events found."));
|
|
31345
31431
|
return;
|
|
31346
31432
|
}
|
|
31347
31433
|
if (options2.json) {
|
|
@@ -31352,11 +31438,11 @@ async function seqQuery(filter, options2) {
|
|
|
31352
31438
|
for (const event of chronological) {
|
|
31353
31439
|
console.log(formatEvent(event));
|
|
31354
31440
|
}
|
|
31355
|
-
console.log(
|
|
31441
|
+
console.log(chalk219.dim(`
|
|
31356
31442
|
${events.length} events`));
|
|
31357
31443
|
if (events.length >= count8) {
|
|
31358
31444
|
console.log(
|
|
31359
|
-
|
|
31445
|
+
chalk219.yellow(
|
|
31360
31446
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
31361
31447
|
)
|
|
31362
31448
|
);
|
|
@@ -31364,10 +31450,10 @@ ${events.length} events`));
|
|
|
31364
31450
|
}
|
|
31365
31451
|
|
|
31366
31452
|
// src/shared/setNamedDefaultConnection.ts
|
|
31367
|
-
import
|
|
31453
|
+
import chalk220 from "chalk";
|
|
31368
31454
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
31369
31455
|
if (!connections.find((c) => c.name === name)) {
|
|
31370
|
-
console.error(
|
|
31456
|
+
console.error(chalk220.red(`Connection "${name}" not found.`));
|
|
31371
31457
|
process.exit(1);
|
|
31372
31458
|
}
|
|
31373
31459
|
setDefault(name);
|
|
@@ -31516,7 +31602,7 @@ function registerSlack(program2) {
|
|
|
31516
31602
|
}
|
|
31517
31603
|
|
|
31518
31604
|
// src/commands/sql/sqlAuth.ts
|
|
31519
|
-
import
|
|
31605
|
+
import chalk222 from "chalk";
|
|
31520
31606
|
|
|
31521
31607
|
// src/commands/sql/loadConnections.ts
|
|
31522
31608
|
function loadConnections3() {
|
|
@@ -31545,7 +31631,7 @@ function setDefaultConnection2(name) {
|
|
|
31545
31631
|
}
|
|
31546
31632
|
|
|
31547
31633
|
// src/commands/sql/promptConnection.ts
|
|
31548
|
-
import
|
|
31634
|
+
import chalk221 from "chalk";
|
|
31549
31635
|
async function promptConnection3(existingNames) {
|
|
31550
31636
|
const name = await promptInput("name", "Connection name:", "default");
|
|
31551
31637
|
assertUniqueName(existingNames, name);
|
|
@@ -31553,7 +31639,7 @@ async function promptConnection3(existingNames) {
|
|
|
31553
31639
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
31554
31640
|
const port = Number.parseInt(portStr, 10);
|
|
31555
31641
|
if (!Number.isFinite(port)) {
|
|
31556
|
-
console.error(
|
|
31642
|
+
console.error(chalk221.red(`Invalid port "${portStr}".`));
|
|
31557
31643
|
process.exit(1);
|
|
31558
31644
|
}
|
|
31559
31645
|
const user = await promptInput("user", "User:");
|
|
@@ -31566,13 +31652,13 @@ async function promptConnection3(existingNames) {
|
|
|
31566
31652
|
var sqlAuth = createConnectionAuth({
|
|
31567
31653
|
load: loadConnections3,
|
|
31568
31654
|
save: saveConnections3,
|
|
31569
|
-
format: (c) => `${
|
|
31655
|
+
format: (c) => `${chalk222.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
31570
31656
|
promptNew: promptConnection3,
|
|
31571
31657
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
31572
31658
|
});
|
|
31573
31659
|
|
|
31574
31660
|
// src/commands/sql/printTable.ts
|
|
31575
|
-
import
|
|
31661
|
+
import chalk223 from "chalk";
|
|
31576
31662
|
function formatCell(value) {
|
|
31577
31663
|
if (value === null || value === void 0) return "";
|
|
31578
31664
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -31581,7 +31667,7 @@ function formatCell(value) {
|
|
|
31581
31667
|
}
|
|
31582
31668
|
function printTable(rows) {
|
|
31583
31669
|
if (rows.length === 0) {
|
|
31584
|
-
console.log(
|
|
31670
|
+
console.log(chalk223.yellow("(no rows)"));
|
|
31585
31671
|
return;
|
|
31586
31672
|
}
|
|
31587
31673
|
const columns = Object.keys(rows[0]);
|
|
@@ -31589,13 +31675,13 @@ function printTable(rows) {
|
|
|
31589
31675
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
31590
31676
|
);
|
|
31591
31677
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
31592
|
-
console.log(
|
|
31593
|
-
console.log(
|
|
31678
|
+
console.log(chalk223.dim(header));
|
|
31679
|
+
console.log(chalk223.dim("-".repeat(header.length)));
|
|
31594
31680
|
for (const row of rows) {
|
|
31595
31681
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
31596
31682
|
console.log(line);
|
|
31597
31683
|
}
|
|
31598
|
-
console.log(
|
|
31684
|
+
console.log(chalk223.dim(`
|
|
31599
31685
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
31600
31686
|
}
|
|
31601
31687
|
|
|
@@ -31655,7 +31741,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
31655
31741
|
}
|
|
31656
31742
|
|
|
31657
31743
|
// src/commands/sql/sqlMutate.ts
|
|
31658
|
-
import
|
|
31744
|
+
import chalk224 from "chalk";
|
|
31659
31745
|
|
|
31660
31746
|
// src/commands/sql/isMutation.ts
|
|
31661
31747
|
var MUTATION_KEYWORDS = [
|
|
@@ -31689,7 +31775,7 @@ function isMutation(sql25) {
|
|
|
31689
31775
|
async function sqlMutate(query, connectionName) {
|
|
31690
31776
|
if (!isMutation(query)) {
|
|
31691
31777
|
console.error(
|
|
31692
|
-
|
|
31778
|
+
chalk224.red(
|
|
31693
31779
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
31694
31780
|
)
|
|
31695
31781
|
);
|
|
@@ -31699,18 +31785,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
31699
31785
|
const pool = await sqlConnect(conn);
|
|
31700
31786
|
try {
|
|
31701
31787
|
const result = await pool.request().query(query);
|
|
31702
|
-
console.log(
|
|
31788
|
+
console.log(chalk224.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
31703
31789
|
} finally {
|
|
31704
31790
|
await pool.close();
|
|
31705
31791
|
}
|
|
31706
31792
|
}
|
|
31707
31793
|
|
|
31708
31794
|
// src/commands/sql/sqlQuery.ts
|
|
31709
|
-
import
|
|
31795
|
+
import chalk225 from "chalk";
|
|
31710
31796
|
async function sqlQuery(query, connectionName) {
|
|
31711
31797
|
if (isMutation(query)) {
|
|
31712
31798
|
console.error(
|
|
31713
|
-
|
|
31799
|
+
chalk225.red(
|
|
31714
31800
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
31715
31801
|
)
|
|
31716
31802
|
);
|
|
@@ -31725,7 +31811,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
31725
31811
|
printTable(rows);
|
|
31726
31812
|
} else {
|
|
31727
31813
|
console.log(
|
|
31728
|
-
|
|
31814
|
+
chalk225.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
31729
31815
|
);
|
|
31730
31816
|
}
|
|
31731
31817
|
} finally {
|
|
@@ -31870,7 +31956,7 @@ function reportPrune(label2, result, force) {
|
|
|
31870
31956
|
// src/commands/sync/syncClaudeMd.ts
|
|
31871
31957
|
import * as fs41 from "fs";
|
|
31872
31958
|
import * as path76 from "path";
|
|
31873
|
-
import
|
|
31959
|
+
import chalk226 from "chalk";
|
|
31874
31960
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
31875
31961
|
const source = path76.join(claudeDir, "CLAUDE.md");
|
|
31876
31962
|
const target = path76.join(targetBase, "CLAUDE.md");
|
|
@@ -31879,14 +31965,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
31879
31965
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
31880
31966
|
if (sourceContent !== targetContent) {
|
|
31881
31967
|
console.log(
|
|
31882
|
-
|
|
31968
|
+
chalk226.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
31883
31969
|
);
|
|
31884
31970
|
console.log();
|
|
31885
31971
|
printDiff(targetContent, sourceContent);
|
|
31886
31972
|
if (!options2?.yes) {
|
|
31887
31973
|
printAutoConfirmHint();
|
|
31888
31974
|
const confirm = await promptConfirm(
|
|
31889
|
-
|
|
31975
|
+
chalk226.red("Overwrite existing CLAUDE.md?"),
|
|
31890
31976
|
false
|
|
31891
31977
|
);
|
|
31892
31978
|
if (!confirm) {
|
|
@@ -32119,7 +32205,7 @@ function syncPi(claudeDir, options2) {
|
|
|
32119
32205
|
// src/commands/sync/syncSettings.ts
|
|
32120
32206
|
import * as fs47 from "fs";
|
|
32121
32207
|
import * as path83 from "path";
|
|
32122
|
-
import
|
|
32208
|
+
import chalk227 from "chalk";
|
|
32123
32209
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
32124
32210
|
const source = path83.join(claudeDir, "settings.json");
|
|
32125
32211
|
const target = path83.join(targetBase, "settings.json");
|
|
@@ -32138,7 +32224,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
32138
32224
|
if (mergedContent !== normalizedTarget) {
|
|
32139
32225
|
if (!options2?.yes) {
|
|
32140
32226
|
console.log(
|
|
32141
|
-
|
|
32227
|
+
chalk227.yellow(
|
|
32142
32228
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
32143
32229
|
)
|
|
32144
32230
|
);
|
|
@@ -32146,7 +32232,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
32146
32232
|
printDiff(targetContent, mergedContent);
|
|
32147
32233
|
printAutoConfirmHint();
|
|
32148
32234
|
const confirm = await promptConfirm(
|
|
32149
|
-
|
|
32235
|
+
chalk227.red("Overwrite existing settings.json?"),
|
|
32150
32236
|
false
|
|
32151
32237
|
);
|
|
32152
32238
|
if (!confirm) {
|
|
@@ -32755,23 +32841,23 @@ var selectionSchema = z9.strictObject({
|
|
|
32755
32841
|
removed: z9.array(z9.string().trim().min(1)).default([])
|
|
32756
32842
|
});
|
|
32757
32843
|
|
|
32758
|
-
// src/commands/transcript/
|
|
32844
|
+
// src/commands/transcript/widenAudienceInText.ts
|
|
32759
32845
|
var INTERJECTION = /(?<=^|["',;:.!?—–…])\s*(?:oh,?\s+)?(?:fucking hell|bloody hell|fucking|fuck|shit)(?:\s*[.!?,…]+|\s*$)/gi;
|
|
32760
32846
|
var WH_EMPHASIS = /\b(whatever|whoever|wherever|whenever|however|what|who|whom|where|when|why|how|which)\s+the\s+(?:fuck|hell|heck)\b/gi;
|
|
32761
32847
|
var INTENSIFIER = /\b(?:fucking|fuckin'?|(?:god)?damn(?:ed)?)\s+(?=[a-z0-9])(?!(?:it|if|around|about|with|up|off|over|out)\b)/gi;
|
|
32762
32848
|
function tidy(text18) {
|
|
32763
32849
|
return text18.replace(/\s+/g, " ").replace(/\s+([,.;:!?])/g, "$1").replace(/,(?=\s*[.!?])/g, "").replace(/^[\s,;:]+/, "").replace(/[\s,;:]+$/, "");
|
|
32764
32850
|
}
|
|
32765
|
-
function
|
|
32851
|
+
function widenAudienceInText(text18) {
|
|
32766
32852
|
const stripped = text18.replace(INTERJECTION, " ").replace(WH_EMPHASIS, "$1").replace(INTENSIFIER, "");
|
|
32767
32853
|
return stripped === text18 ? text18 : tidy(stripped);
|
|
32768
32854
|
}
|
|
32769
32855
|
|
|
32770
|
-
// src/commands/transcript/
|
|
32856
|
+
// src/commands/transcript/widenAudience.ts
|
|
32771
32857
|
function strip(cues) {
|
|
32772
|
-
return cues.map((cue) => ({ ...cue, text:
|
|
32858
|
+
return cues.map((cue) => ({ ...cue, text: widenAudienceInText(cue.text) })).filter((cue) => /[a-z0-9]/i.test(cue.text));
|
|
32773
32859
|
}
|
|
32774
|
-
function
|
|
32860
|
+
function widenAudience(passages) {
|
|
32775
32861
|
return passages.map((passage) => ({ ...passage, cues: strip(passage.cues) })).filter((passage) => passage.cues.length > 0).map((passage) => ({ ...passage, sourceStartMs: passage.cues[0].startMs }));
|
|
32776
32862
|
}
|
|
32777
32863
|
|
|
@@ -32798,7 +32884,7 @@ async function merge(files, options2 = {}) {
|
|
|
32798
32884
|
const selection = await readSelection(options2.select);
|
|
32799
32885
|
const selected = selection ? selectPassages(sources, selection) : wholePassages(sources);
|
|
32800
32886
|
const passages = rebasePassages(
|
|
32801
|
-
options2.
|
|
32887
|
+
options2.widenAudience ? widenAudience(selected) : selected
|
|
32802
32888
|
);
|
|
32803
32889
|
const provenance = options2.provenance !== false;
|
|
32804
32890
|
const document = formatVttPassages(
|
|
@@ -32826,8 +32912,8 @@ function registerMergeCommand(cmd) {
|
|
|
32826
32912
|
"--no-provenance",
|
|
32827
32913
|
"omit every NOTE: the Collapsed-from header, the per-passage source marks and the removed count"
|
|
32828
32914
|
).option(
|
|
32829
|
-
"--
|
|
32830
|
-
"delete
|
|
32915
|
+
"--widen-audience",
|
|
32916
|
+
"delete the casual asides that fit the people in the call but not a reader who was not there: intensifiers, emphasis after a wh-word, standalone interjections and cues that are nothing but one"
|
|
32831
32917
|
).action(merge);
|
|
32832
32918
|
}
|
|
32833
32919
|
|
|
@@ -32851,9 +32937,11 @@ function transcriptWorkflowHelp() {
|
|
|
32851
32937
|
" removal count and each passage's original start survive as NOTE blocks.",
|
|
32852
32938
|
" Add --no-provenance when the merged file leaves for somewhere the source",
|
|
32853
32939
|
" names and cut points should not follow.",
|
|
32854
|
-
" Add --
|
|
32855
|
-
"
|
|
32856
|
-
"
|
|
32940
|
+
" Add --widen-audience when the transcript is going to readers who were",
|
|
32941
|
+
" not in the call: the casual asides pitched at the people who were \u2014",
|
|
32942
|
+
" intensifiers, emphasis after a wh-word, standalone interjections and",
|
|
32943
|
+
" cues that are nothing but one \u2014 are deleted. Anything carrying meaning",
|
|
32944
|
+
" is left for you to judge."
|
|
32857
32945
|
].join("\n");
|
|
32858
32946
|
}
|
|
32859
32947
|
|
|
@@ -33885,7 +33973,7 @@ function registerWatch(program2) {
|
|
|
33885
33973
|
|
|
33886
33974
|
// src/commands/roam/auth.ts
|
|
33887
33975
|
import { randomBytes } from "crypto";
|
|
33888
|
-
import
|
|
33976
|
+
import chalk228 from "chalk";
|
|
33889
33977
|
|
|
33890
33978
|
// src/commands/roam/waitForCallback.ts
|
|
33891
33979
|
import { createServer as createServer3 } from "http";
|
|
@@ -34016,13 +34104,13 @@ async function auth() {
|
|
|
34016
34104
|
saveGlobalConfig(config);
|
|
34017
34105
|
const state = randomBytes(16).toString("hex");
|
|
34018
34106
|
console.log(
|
|
34019
|
-
|
|
34107
|
+
chalk228.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
34020
34108
|
);
|
|
34021
|
-
console.log(
|
|
34022
|
-
console.log(
|
|
34023
|
-
console.log(
|
|
34109
|
+
console.log(chalk228.white("http://localhost:14523/callback\n"));
|
|
34110
|
+
console.log(chalk228.blue("Opening browser for authorization..."));
|
|
34111
|
+
console.log(chalk228.dim("Waiting for authorization callback..."));
|
|
34024
34112
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
34025
|
-
console.log(
|
|
34113
|
+
console.log(chalk228.dim("Exchanging code for tokens..."));
|
|
34026
34114
|
const tokens = await exchangeToken({
|
|
34027
34115
|
code,
|
|
34028
34116
|
clientId,
|
|
@@ -34038,7 +34126,7 @@ async function auth() {
|
|
|
34038
34126
|
};
|
|
34039
34127
|
saveGlobalConfig(config);
|
|
34040
34128
|
console.log(
|
|
34041
|
-
|
|
34129
|
+
chalk228.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
34042
34130
|
);
|
|
34043
34131
|
}
|
|
34044
34132
|
|
|
@@ -34397,7 +34485,7 @@ import { execSync as execSync61 } from "child_process";
|
|
|
34397
34485
|
import { existsSync as existsSync83, mkdirSync as mkdirSync33, unlinkSync as unlinkSync22, writeFileSync as writeFileSync51 } from "fs";
|
|
34398
34486
|
import { tmpdir as tmpdir9 } from "os";
|
|
34399
34487
|
import { join as join96, resolve as resolve21 } from "path";
|
|
34400
|
-
import
|
|
34488
|
+
import chalk229 from "chalk";
|
|
34401
34489
|
|
|
34402
34490
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
34403
34491
|
var captureWindowPs1 = `
|
|
@@ -34548,13 +34636,13 @@ function screenshot(processName) {
|
|
|
34548
34636
|
const config = loadConfig();
|
|
34549
34637
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
34550
34638
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
34551
|
-
console.log(
|
|
34639
|
+
console.log(chalk229.gray(`Capturing window for process "${processName}" ...`));
|
|
34552
34640
|
try {
|
|
34553
34641
|
runPowerShellScript(processName, outputPath);
|
|
34554
|
-
console.log(
|
|
34642
|
+
console.log(chalk229.green(`Screenshot saved: ${outputPath}`));
|
|
34555
34643
|
} catch (error) {
|
|
34556
34644
|
const msg = error instanceof Error ? error.message : String(error);
|
|
34557
|
-
console.error(
|
|
34645
|
+
console.error(chalk229.red(`Failed to capture screenshot: ${msg}`));
|
|
34558
34646
|
process.exit(1);
|
|
34559
34647
|
}
|
|
34560
34648
|
}
|
|
@@ -40514,7 +40602,7 @@ async function renameSession(title) {
|
|
|
40514
40602
|
|
|
40515
40603
|
// src/commands/sessions/summarise/index.ts
|
|
40516
40604
|
import * as fs56 from "fs";
|
|
40517
|
-
import
|
|
40605
|
+
import chalk230 from "chalk";
|
|
40518
40606
|
|
|
40519
40607
|
// src/commands/sessions/summarise/shared.ts
|
|
40520
40608
|
import * as fs55 from "fs";
|
|
@@ -40573,22 +40661,22 @@ ${firstMessage}`);
|
|
|
40573
40661
|
async function summarise2(options2) {
|
|
40574
40662
|
const files = await discoverSessionFiles();
|
|
40575
40663
|
if (files.length === 0) {
|
|
40576
|
-
console.log(
|
|
40664
|
+
console.log(chalk230.yellow("No sessions found."));
|
|
40577
40665
|
return;
|
|
40578
40666
|
}
|
|
40579
40667
|
const toProcess = selectCandidates(files, options2);
|
|
40580
40668
|
if (toProcess.length === 0) {
|
|
40581
|
-
console.log(
|
|
40669
|
+
console.log(chalk230.green("All sessions already summarised."));
|
|
40582
40670
|
return;
|
|
40583
40671
|
}
|
|
40584
40672
|
console.log(
|
|
40585
|
-
|
|
40673
|
+
chalk230.cyan(
|
|
40586
40674
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
40587
40675
|
)
|
|
40588
40676
|
);
|
|
40589
40677
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
40590
40678
|
console.log(
|
|
40591
|
-
|
|
40679
|
+
chalk230.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk230.yellow(`, ${failed2} skipped`) : "")
|
|
40592
40680
|
);
|
|
40593
40681
|
}
|
|
40594
40682
|
function selectCandidates(files, options2) {
|
|
@@ -40608,16 +40696,16 @@ function processSessions(files) {
|
|
|
40608
40696
|
let failed2 = 0;
|
|
40609
40697
|
for (let i = 0; i < files.length; i++) {
|
|
40610
40698
|
const file = files[i];
|
|
40611
|
-
process.stdout.write(
|
|
40699
|
+
process.stdout.write(chalk230.dim(` [${i + 1}/${files.length}] `));
|
|
40612
40700
|
const summary = summariseSession(file);
|
|
40613
40701
|
if (summary) {
|
|
40614
40702
|
writeSummary(file, summary);
|
|
40615
40703
|
succeeded++;
|
|
40616
|
-
process.stdout.write(`${
|
|
40704
|
+
process.stdout.write(`${chalk230.green("\u2713")} ${summary}
|
|
40617
40705
|
`);
|
|
40618
40706
|
} else {
|
|
40619
40707
|
failed2++;
|
|
40620
|
-
process.stdout.write(` ${
|
|
40708
|
+
process.stdout.write(` ${chalk230.yellow("skip")}
|
|
40621
40709
|
`);
|
|
40622
40710
|
}
|
|
40623
40711
|
}
|
|
@@ -40644,7 +40732,7 @@ function registerSessions(program2) {
|
|
|
40644
40732
|
}
|
|
40645
40733
|
|
|
40646
40734
|
// src/commands/statusLine.ts
|
|
40647
|
-
import
|
|
40735
|
+
import chalk232 from "chalk";
|
|
40648
40736
|
|
|
40649
40737
|
// src/shared/contextLevel.ts
|
|
40650
40738
|
function contextLevel(pct) {
|
|
@@ -40654,7 +40742,7 @@ function contextLevel(pct) {
|
|
|
40654
40742
|
}
|
|
40655
40743
|
|
|
40656
40744
|
// src/commands/buildLimitsSegment.ts
|
|
40657
|
-
import
|
|
40745
|
+
import chalk231 from "chalk";
|
|
40658
40746
|
|
|
40659
40747
|
// src/shared/rateLimitLevel.ts
|
|
40660
40748
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -40692,9 +40780,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
40692
40780
|
|
|
40693
40781
|
// src/commands/buildLimitsSegment.ts
|
|
40694
40782
|
var LEVEL_COLOR = {
|
|
40695
|
-
ok:
|
|
40696
|
-
warn:
|
|
40697
|
-
over:
|
|
40783
|
+
ok: chalk231.green,
|
|
40784
|
+
warn: chalk231.yellow,
|
|
40785
|
+
over: chalk231.red
|
|
40698
40786
|
};
|
|
40699
40787
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
40700
40788
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -40790,7 +40878,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
40790
40878
|
}
|
|
40791
40879
|
|
|
40792
40880
|
// src/commands/statusLine.ts
|
|
40793
|
-
|
|
40881
|
+
chalk232.level = 3;
|
|
40794
40882
|
function formatNumber(num) {
|
|
40795
40883
|
return num.toLocaleString("en-US");
|
|
40796
40884
|
}
|
|
@@ -40798,9 +40886,9 @@ function colorizePercent(pct) {
|
|
|
40798
40886
|
const label2 = `${Math.round(pct)}%`;
|
|
40799
40887
|
switch (contextLevel(pct)) {
|
|
40800
40888
|
case "red":
|
|
40801
|
-
return
|
|
40889
|
+
return chalk232.red(label2);
|
|
40802
40890
|
case "yellow":
|
|
40803
|
-
return
|
|
40891
|
+
return chalk232.yellow(label2);
|
|
40804
40892
|
default:
|
|
40805
40893
|
return label2;
|
|
40806
40894
|
}
|
|
@@ -40813,7 +40901,7 @@ async function statusLine() {
|
|
|
40813
40901
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
40814
40902
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
40815
40903
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
40816
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
40904
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk232.cyan(branch2)} | ` : "";
|
|
40817
40905
|
console.log(
|
|
40818
40906
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
40819
40907
|
);
|
|
@@ -40883,10 +40971,10 @@ async function update2() {
|
|
|
40883
40971
|
}
|
|
40884
40972
|
|
|
40885
40973
|
// src/reportCliError.ts
|
|
40886
|
-
import
|
|
40974
|
+
import chalk233 from "chalk";
|
|
40887
40975
|
function reportCliError(error) {
|
|
40888
40976
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
40889
|
-
console.error(
|
|
40977
|
+
console.error(chalk233.red(error.message));
|
|
40890
40978
|
} else {
|
|
40891
40979
|
console.error(error);
|
|
40892
40980
|
}
|
|
@@ -40945,6 +41033,7 @@ registerDotnet(program);
|
|
|
40945
41033
|
registerNews(program);
|
|
40946
41034
|
registerNetcap(program);
|
|
40947
41035
|
registerCriteriaExtension(program);
|
|
41036
|
+
registerLitellm(program);
|
|
40948
41037
|
registerRavendb(program);
|
|
40949
41038
|
registerSeq(program);
|
|
40950
41039
|
registerSlack(program);
|