@staff0rd/assist 0.681.0 → 0.682.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 +3 -0
- package/claude/commands/review-config.md +48 -0
- package/dist/commands/sessions/web/bundle.js +361 -361
- package/dist/index.js +227 -155
- 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.682.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -30620,7 +30620,7 @@ async function checkoutOnlySession(number) {
|
|
|
30620
30620
|
}
|
|
30621
30621
|
|
|
30622
30622
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
30623
|
-
import
|
|
30623
|
+
import chalk215 from "chalk";
|
|
30624
30624
|
|
|
30625
30625
|
// src/commands/config/promptConfigScope.ts
|
|
30626
30626
|
import Enquirer3 from "enquirer";
|
|
@@ -30723,21 +30723,28 @@ async function configureConfigKeys(questions, options2 = {}) {
|
|
|
30723
30723
|
return { scope, target: result.target, written, skipped };
|
|
30724
30724
|
}
|
|
30725
30725
|
|
|
30726
|
+
// src/commands/review/highLevel/highLevelConfigKeys.ts
|
|
30727
|
+
var highLevelConfigKeys = {
|
|
30728
|
+
criticalPaths: "review.highLevel.criticalPaths",
|
|
30729
|
+
uiPaths: "review.highLevel.uiPaths",
|
|
30730
|
+
descriptionWordCap: "review.highLevel.descriptionWordCap"
|
|
30731
|
+
};
|
|
30732
|
+
|
|
30726
30733
|
// src/commands/review/highLevel/buildHighLevelQuestions.ts
|
|
30727
30734
|
function buildHighLevelQuestions(current, proposed) {
|
|
30728
30735
|
return [
|
|
30729
30736
|
{
|
|
30730
|
-
key:
|
|
30737
|
+
key: highLevelConfigKeys.criticalPaths,
|
|
30731
30738
|
question: "Critical paths \u2014 comma-separated globs whose full diffs the review shows (blank to leave unset)",
|
|
30732
30739
|
suggest: suggestGlobs(current.criticalPaths, proposed.criticalPaths)
|
|
30733
30740
|
},
|
|
30734
30741
|
{
|
|
30735
|
-
key:
|
|
30742
|
+
key: highLevelConfigKeys.uiPaths,
|
|
30736
30743
|
question: "UI paths \u2014 comma-separated globs that make a change a UI change, so a screenshot or video is required (blank to leave unset)",
|
|
30737
30744
|
suggest: suggestGlobs(current.uiPaths, proposed.uiPaths)
|
|
30738
30745
|
},
|
|
30739
30746
|
{
|
|
30740
|
-
key:
|
|
30747
|
+
key: highLevelConfigKeys.descriptionWordCap,
|
|
30741
30748
|
question: "Description word cap (blank to leave unset)",
|
|
30742
30749
|
suggest: String(current.descriptionWordCap)
|
|
30743
30750
|
}
|
|
@@ -30748,9 +30755,32 @@ function suggestGlobs(current, proposed) {
|
|
|
30748
30755
|
return globs.length > 0 ? globs.join(",") : void 0;
|
|
30749
30756
|
}
|
|
30750
30757
|
|
|
30758
|
+
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
30759
|
+
import chalk213 from "chalk";
|
|
30760
|
+
function parseConfigureAnswers(answers) {
|
|
30761
|
+
const known = Object.values(highLevelConfigKeys);
|
|
30762
|
+
const parsed = {};
|
|
30763
|
+
for (const answer of answers) {
|
|
30764
|
+
const separator = answer.indexOf("=");
|
|
30765
|
+
if (separator <= 0) exitWith(`--answer expects key=value, got '${answer}'`);
|
|
30766
|
+
const key = answer.slice(0, separator).trim();
|
|
30767
|
+
if (!known.includes(key))
|
|
30768
|
+
exitWith(`--answer key '${key}' is not one of ${known.join(", ")}`);
|
|
30769
|
+
parsed[key] = answer.slice(separator + 1);
|
|
30770
|
+
}
|
|
30771
|
+
return parsed;
|
|
30772
|
+
}
|
|
30773
|
+
function answersCoverEveryKey(answers) {
|
|
30774
|
+
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
30775
|
+
}
|
|
30776
|
+
function exitWith(message3) {
|
|
30777
|
+
console.error(chalk213.red(`Error: ${message3}.`));
|
|
30778
|
+
process.exit(1);
|
|
30779
|
+
}
|
|
30780
|
+
|
|
30751
30781
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
30752
30782
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
30753
|
-
import
|
|
30783
|
+
import chalk214 from "chalk";
|
|
30754
30784
|
|
|
30755
30785
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
30756
30786
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -30843,12 +30873,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
30843
30873
|
const tree = summariseRepoTree(cwd);
|
|
30844
30874
|
if (tree === "") return NOTHING_PROPOSED;
|
|
30845
30875
|
console.log(
|
|
30846
|
-
|
|
30876
|
+
chalk214.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
30847
30877
|
);
|
|
30848
30878
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
30849
30879
|
if (output === void 0) {
|
|
30850
30880
|
console.log(
|
|
30851
|
-
|
|
30881
|
+
chalk214.yellow(
|
|
30852
30882
|
"Claude proposed nothing; answer each key from its current value."
|
|
30853
30883
|
)
|
|
30854
30884
|
);
|
|
@@ -30881,33 +30911,48 @@ function resolveHighLevelConfig(config) {
|
|
|
30881
30911
|
}
|
|
30882
30912
|
|
|
30883
30913
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
30884
|
-
|
|
30885
|
-
|
|
30886
|
-
const
|
|
30887
|
-
|
|
30914
|
+
var NOTHING_PROPOSED2 = { criticalPaths: [], uiPaths: [] };
|
|
30915
|
+
async function configureHighLevelReview(options2 = {}) {
|
|
30916
|
+
const answers = parseConfigureAnswers(options2.answer ?? []);
|
|
30917
|
+
const proposed = answersCoverEveryKey(answers) ? NOTHING_PROPOSED2 : proposeHighLevelGlobs();
|
|
30918
|
+
const questions = buildHighLevelQuestions(
|
|
30919
|
+
resolveHighLevelConfig(loadConfig()),
|
|
30920
|
+
proposed
|
|
30921
|
+
);
|
|
30922
|
+
const scope = asConfigKeyScope(options2.scope);
|
|
30923
|
+
reportConfigured(
|
|
30924
|
+
await configureConfigKeys(questions, {
|
|
30925
|
+
answers,
|
|
30926
|
+
...scope ? { scope } : {}
|
|
30927
|
+
})
|
|
30928
|
+
);
|
|
30929
|
+
}
|
|
30930
|
+
function asConfigKeyScope(value) {
|
|
30931
|
+
if (value === "project" || value === "repo") return value;
|
|
30932
|
+
return void 0;
|
|
30888
30933
|
}
|
|
30889
30934
|
function reportConfigured(result) {
|
|
30890
30935
|
for (const write of result.written)
|
|
30891
30936
|
console.log(
|
|
30892
|
-
|
|
30937
|
+
chalk215.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
30893
30938
|
);
|
|
30894
|
-
for (const key of result.skipped) console.log(
|
|
30895
|
-
console.log(
|
|
30939
|
+
for (const key of result.skipped) console.log(chalk215.dim(`Left ${key} unset`));
|
|
30940
|
+
console.log(chalk215.dim(`Written to ${result.target}`));
|
|
30896
30941
|
}
|
|
30897
30942
|
|
|
30898
30943
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
30899
|
-
import
|
|
30944
|
+
import chalk216 from "chalk";
|
|
30900
30945
|
function announceSavedReview(subject, force) {
|
|
30901
30946
|
const head = subject.headSha.slice(0, 7);
|
|
30902
30947
|
if (subject.saved)
|
|
30903
30948
|
console.log(
|
|
30904
|
-
|
|
30949
|
+
chalk216.dim(
|
|
30905
30950
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
30906
30951
|
)
|
|
30907
30952
|
);
|
|
30908
30953
|
else if (force)
|
|
30909
30954
|
console.log(
|
|
30910
|
-
|
|
30955
|
+
chalk216.dim(
|
|
30911
30956
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
30912
30957
|
)
|
|
30913
30958
|
);
|
|
@@ -31446,55 +31491,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
31446
31491
|
}
|
|
31447
31492
|
|
|
31448
31493
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31449
|
-
import
|
|
31494
|
+
import chalk220 from "chalk";
|
|
31450
31495
|
|
|
31451
31496
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
31452
|
-
import
|
|
31497
|
+
import chalk217 from "chalk";
|
|
31453
31498
|
var PATCH_LINE_COLOURS = {
|
|
31454
|
-
"+":
|
|
31455
|
-
"-":
|
|
31456
|
-
"@":
|
|
31499
|
+
"+": chalk217.green,
|
|
31500
|
+
"-": chalk217.red,
|
|
31501
|
+
"@": chalk217.cyan
|
|
31457
31502
|
};
|
|
31458
31503
|
function formatPatch(patch2) {
|
|
31459
31504
|
return patch2.split("\n").map(
|
|
31460
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
31505
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk217.dim)(line)}`
|
|
31461
31506
|
);
|
|
31462
31507
|
}
|
|
31463
31508
|
function formatDiff(diff3) {
|
|
31464
31509
|
return [
|
|
31465
31510
|
"",
|
|
31466
|
-
` ${
|
|
31467
|
-
...diff3.patch === null ? [` ${
|
|
31511
|
+
` ${chalk217.bold(diff3.path)} ${chalk217.dim(`(${diff3.status})`)} ${chalk217.green(`+${diff3.additions}`)} ${chalk217.red(`-${diff3.deletions}`)}`,
|
|
31512
|
+
...diff3.patch === null ? [` ${chalk217.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
31468
31513
|
];
|
|
31469
31514
|
}
|
|
31470
31515
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
31471
31516
|
if (criticalPaths.length === 0)
|
|
31472
|
-
return `${
|
|
31473
|
-
${
|
|
31517
|
+
return `${chalk217.bold.underline("Critical diffs")}
|
|
31518
|
+
${chalk217.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
31474
31519
|
if (diffs.length === 0)
|
|
31475
|
-
return `${
|
|
31476
|
-
${
|
|
31520
|
+
return `${chalk217.bold.underline("Critical diffs")}
|
|
31521
|
+
${chalk217.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
31477
31522
|
return [
|
|
31478
|
-
|
|
31523
|
+
chalk217.bold.underline("Critical diffs"),
|
|
31479
31524
|
...diffs.flatMap(formatDiff)
|
|
31480
31525
|
].join("\n");
|
|
31481
31526
|
}
|
|
31482
31527
|
|
|
31483
31528
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
31484
|
-
import
|
|
31529
|
+
import chalk218 from "chalk";
|
|
31485
31530
|
var MARKERS = {
|
|
31486
|
-
pass: () =>
|
|
31487
|
-
fail: () =>
|
|
31488
|
-
manual: () =>
|
|
31531
|
+
pass: () => chalk218.green("\u2714"),
|
|
31532
|
+
fail: () => chalk218.red("\u2718"),
|
|
31533
|
+
manual: () => chalk218.yellow("\u25A1")
|
|
31489
31534
|
};
|
|
31490
31535
|
function formatCheck(check2) {
|
|
31491
|
-
const title = check2.status === "fail" ?
|
|
31536
|
+
const title = check2.status === "fail" ? chalk218.red(check2.title) : chalk218.bold(check2.title);
|
|
31492
31537
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
31493
|
-
${
|
|
31538
|
+
${chalk218.dim(check2.reason)}`;
|
|
31494
31539
|
}
|
|
31495
31540
|
function formatGroup(heading2, checks2) {
|
|
31496
31541
|
if (checks2.length === 0) return [];
|
|
31497
|
-
return ["",
|
|
31542
|
+
return ["", chalk218.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
31498
31543
|
}
|
|
31499
31544
|
function formatHighLevelChecklist(checks2) {
|
|
31500
31545
|
const deterministic = checks2.filter(
|
|
@@ -31503,7 +31548,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31503
31548
|
const failed2 = deterministic.filter(
|
|
31504
31549
|
(check2) => check2.status === "fail"
|
|
31505
31550
|
).length;
|
|
31506
|
-
const summary = failed2 === 0 ?
|
|
31551
|
+
const summary = failed2 === 0 ? chalk218.green(`All ${deterministic.length} deterministic checks pass`) : chalk218.red(
|
|
31507
31552
|
`${failed2} of ${deterministic.length} deterministic checks fail`
|
|
31508
31553
|
);
|
|
31509
31554
|
return [
|
|
@@ -31518,30 +31563,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31518
31563
|
}
|
|
31519
31564
|
|
|
31520
31565
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
31521
|
-
import
|
|
31566
|
+
import chalk219 from "chalk";
|
|
31522
31567
|
var STATUS_MARKERS = {
|
|
31523
|
-
added: () =>
|
|
31524
|
-
removed: () =>
|
|
31525
|
-
modified: () =>
|
|
31568
|
+
added: () => chalk219.green("A"),
|
|
31569
|
+
removed: () => chalk219.red("D"),
|
|
31570
|
+
modified: () => chalk219.yellow("M")
|
|
31526
31571
|
};
|
|
31527
31572
|
function counts(additions, deletions) {
|
|
31528
|
-
return `${
|
|
31573
|
+
return `${chalk219.green(`+${additions}`)} ${chalk219.red(`-${deletions}`)}`;
|
|
31529
31574
|
}
|
|
31530
31575
|
function formatNode(node, indent3) {
|
|
31531
31576
|
if (node.kind === "file")
|
|
31532
31577
|
return [
|
|
31533
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
31578
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk219.dim(counts(node.additions, node.deletions))}`
|
|
31534
31579
|
];
|
|
31535
31580
|
const dir = node;
|
|
31536
31581
|
return [
|
|
31537
|
-
`${indent3}${
|
|
31582
|
+
`${indent3}${chalk219.bold(`${dir.name}/`)} ${chalk219.dim(counts(dir.additions, dir.deletions))}`,
|
|
31538
31583
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
31539
31584
|
];
|
|
31540
31585
|
}
|
|
31541
31586
|
function formatHighLevelStructure(structure) {
|
|
31542
31587
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
31543
31588
|
return [
|
|
31544
|
-
|
|
31589
|
+
chalk219.bold.underline("Structure"),
|
|
31545
31590
|
` ${summary}`,
|
|
31546
31591
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
31547
31592
|
].join("\n");
|
|
@@ -31550,8 +31595,8 @@ function formatHighLevelStructure(structure) {
|
|
|
31550
31595
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31551
31596
|
function printHighLevelChecklist(subject) {
|
|
31552
31597
|
console.log(
|
|
31553
|
-
|
|
31554
|
-
|
|
31598
|
+
chalk220.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
31599
|
+
chalk220.dim(
|
|
31555
31600
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
31556
31601
|
)
|
|
31557
31602
|
);
|
|
@@ -31563,12 +31608,12 @@ function printHighLevelChecklist(subject) {
|
|
|
31563
31608
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
31564
31609
|
);
|
|
31565
31610
|
console.log(
|
|
31566
|
-
|
|
31611
|
+
chalk220.dim(
|
|
31567
31612
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
31568
31613
|
)
|
|
31569
31614
|
);
|
|
31570
31615
|
console.log(
|
|
31571
|
-
|
|
31616
|
+
chalk220.dim(
|
|
31572
31617
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
31573
31618
|
)
|
|
31574
31619
|
);
|
|
@@ -32202,18 +32247,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
32202
32247
|
}
|
|
32203
32248
|
|
|
32204
32249
|
// src/commands/review/warnOutOfDiff.ts
|
|
32205
|
-
import
|
|
32250
|
+
import chalk221 from "chalk";
|
|
32206
32251
|
function warnOutOfDiff(outOfDiff) {
|
|
32207
32252
|
if (outOfDiff.length === 0) return;
|
|
32208
32253
|
console.warn(
|
|
32209
|
-
|
|
32254
|
+
chalk221.yellow(
|
|
32210
32255
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
32211
32256
|
)
|
|
32212
32257
|
);
|
|
32213
32258
|
for (const finding of outOfDiff) {
|
|
32214
32259
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
32215
32260
|
console.warn(
|
|
32216
|
-
` ${
|
|
32261
|
+
` ${chalk221.yellow("\xB7")} ${finding.title} ${chalk221.dim(
|
|
32217
32262
|
`(${finding.file}:${range})`
|
|
32218
32263
|
)}`
|
|
32219
32264
|
);
|
|
@@ -32237,18 +32282,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
32237
32282
|
}
|
|
32238
32283
|
|
|
32239
32284
|
// src/commands/review/warnUnlocated.ts
|
|
32240
|
-
import
|
|
32285
|
+
import chalk222 from "chalk";
|
|
32241
32286
|
function warnUnlocated(unlocated) {
|
|
32242
32287
|
if (unlocated.length === 0) return;
|
|
32243
32288
|
console.warn(
|
|
32244
|
-
|
|
32289
|
+
chalk222.yellow(
|
|
32245
32290
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
32246
32291
|
)
|
|
32247
32292
|
);
|
|
32248
32293
|
for (const finding of unlocated) {
|
|
32249
|
-
const where = finding.location ||
|
|
32294
|
+
const where = finding.location || chalk222.dim("missing");
|
|
32250
32295
|
console.warn(
|
|
32251
|
-
` ${
|
|
32296
|
+
` ${chalk222.yellow("\xB7")} ${finding.title} ${chalk222.dim(`(${where})`)}`
|
|
32252
32297
|
);
|
|
32253
32298
|
}
|
|
32254
32299
|
}
|
|
@@ -33548,6 +33593,29 @@ async function reviewPr(repoRoot2, options2) {
|
|
|
33548
33593
|
console.log(`Done. Review folder: ${paths.reviewDir}`);
|
|
33549
33594
|
}
|
|
33550
33595
|
|
|
33596
|
+
// src/commands/review/validateConfigureOptions.ts
|
|
33597
|
+
function validateConfigureOptions(options2) {
|
|
33598
|
+
if (!options2.configure) {
|
|
33599
|
+
if (options2.scope || (options2.answer ?? []).length > 0) {
|
|
33600
|
+
console.error("Error: --scope and --answer require --configure.");
|
|
33601
|
+
process.exit(1);
|
|
33602
|
+
}
|
|
33603
|
+
return;
|
|
33604
|
+
}
|
|
33605
|
+
if (!options2.highLevel) {
|
|
33606
|
+
console.error("Error: --configure requires --high-level.");
|
|
33607
|
+
process.exit(1);
|
|
33608
|
+
}
|
|
33609
|
+
if (options2.number) {
|
|
33610
|
+
console.error("Error: --configure takes no PR number.");
|
|
33611
|
+
process.exit(1);
|
|
33612
|
+
}
|
|
33613
|
+
if (options2.scope && options2.scope !== "project" && options2.scope !== "repo") {
|
|
33614
|
+
console.error("Error: --scope must be 'project' or 'repo'.");
|
|
33615
|
+
process.exit(1);
|
|
33616
|
+
}
|
|
33617
|
+
}
|
|
33618
|
+
|
|
33551
33619
|
// src/commands/review/validateReviewOptions.ts
|
|
33552
33620
|
function validateReviewOptions(options2) {
|
|
33553
33621
|
if (options2.apply && options2.refine) {
|
|
@@ -33562,18 +33630,7 @@ function validateReviewOptions(options2) {
|
|
|
33562
33630
|
}
|
|
33563
33631
|
validateCheckoutOnly(options2);
|
|
33564
33632
|
validateHighLevel(options2);
|
|
33565
|
-
|
|
33566
|
-
}
|
|
33567
|
-
function validateConfigure(options2) {
|
|
33568
|
-
if (!options2.configure) return;
|
|
33569
|
-
if (!options2.highLevel) {
|
|
33570
|
-
console.error("Error: --configure requires --high-level.");
|
|
33571
|
-
process.exit(1);
|
|
33572
|
-
}
|
|
33573
|
-
if (options2.number) {
|
|
33574
|
-
console.error("Error: --configure takes no PR number.");
|
|
33575
|
-
process.exit(1);
|
|
33576
|
-
}
|
|
33633
|
+
validateConfigureOptions(options2);
|
|
33577
33634
|
}
|
|
33578
33635
|
function validateCheckoutOnly(options2) {
|
|
33579
33636
|
if (!options2.checkoutOnly) return;
|
|
@@ -33607,7 +33664,11 @@ function resolveRepoRoot() {
|
|
|
33607
33664
|
}
|
|
33608
33665
|
async function review(options2 = {}) {
|
|
33609
33666
|
validateReviewOptions(options2);
|
|
33610
|
-
if (options2.configure)
|
|
33667
|
+
if (options2.configure)
|
|
33668
|
+
return configureHighLevelReview({
|
|
33669
|
+
scope: options2.scope,
|
|
33670
|
+
answer: options2.answer
|
|
33671
|
+
});
|
|
33611
33672
|
startReviewLog();
|
|
33612
33673
|
const invokedIn = resolveRepoRoot();
|
|
33613
33674
|
if (options2.checkoutOnly && options2.number)
|
|
@@ -33632,8 +33693,19 @@ function addReviewModeOptions(command) {
|
|
|
33632
33693
|
).option(
|
|
33633
33694
|
"--configure",
|
|
33634
33695
|
"With --high-level: review nothing and instead ask for review.highLevel.criticalPaths, uiPaths and descriptionWordCap one at a time, each prefilled with its current value or, when unset, globs Claude proposes from this repo's own tree, then write the answers in one pass to either the project assist.yml or this repo's block in ~/.assist.yml. A blank answer leaves that key unset"
|
|
33696
|
+
).option(
|
|
33697
|
+
"--scope <scope>",
|
|
33698
|
+
"With --configure: write to 'project' (the repo's own assist.yml) or 'repo' (this repo's block in ~/.assist.yml) instead of asking which"
|
|
33699
|
+
).option(
|
|
33700
|
+
"--answer <key=value>",
|
|
33701
|
+
"With --configure: answer one key without prompting, for an agent that has already put the choice to the user (repeatable); an empty value leaves that key unset. Answer all three and nothing is prompted for and no globs are proposed",
|
|
33702
|
+
collectAnswer,
|
|
33703
|
+
[]
|
|
33635
33704
|
);
|
|
33636
33705
|
}
|
|
33706
|
+
function collectAnswer(answer, answers) {
|
|
33707
|
+
return [...answers, answer];
|
|
33708
|
+
}
|
|
33637
33709
|
|
|
33638
33710
|
// src/commands/review/addReviewRunOptions.ts
|
|
33639
33711
|
function addReviewRunOptions(command) {
|
|
@@ -33688,7 +33760,7 @@ function registerReview(program2) {
|
|
|
33688
33760
|
// src/commands/rules/addRule.ts
|
|
33689
33761
|
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync42 } from "fs";
|
|
33690
33762
|
import path72 from "path";
|
|
33691
|
-
import
|
|
33763
|
+
import chalk223 from "chalk";
|
|
33692
33764
|
|
|
33693
33765
|
// src/commands/rules/insertRuleBullet.ts
|
|
33694
33766
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -33824,7 +33896,7 @@ function read2(file) {
|
|
|
33824
33896
|
function addRule(text18, options2) {
|
|
33825
33897
|
const rule = text18.trim();
|
|
33826
33898
|
if (rule === "") {
|
|
33827
|
-
console.error(
|
|
33899
|
+
console.error(chalk223.red("Rule text is required"));
|
|
33828
33900
|
process.exitCode = 1;
|
|
33829
33901
|
return;
|
|
33830
33902
|
}
|
|
@@ -33842,13 +33914,13 @@ function addRule(text18, options2) {
|
|
|
33842
33914
|
);
|
|
33843
33915
|
updateScopedRulesIndex(root);
|
|
33844
33916
|
console.log(
|
|
33845
|
-
`Added ${
|
|
33917
|
+
`Added ${chalk223.cyan(code)} to ${path72.relative(process.cwd(), target) || target}`
|
|
33846
33918
|
);
|
|
33847
33919
|
}
|
|
33848
33920
|
|
|
33849
33921
|
// src/commands/rules/indexRules.ts
|
|
33850
33922
|
import path73 from "path";
|
|
33851
|
-
import
|
|
33923
|
+
import chalk224 from "chalk";
|
|
33852
33924
|
function indexRules() {
|
|
33853
33925
|
const startDir = scopeDirectory(process.cwd());
|
|
33854
33926
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
@@ -33856,24 +33928,24 @@ function indexRules() {
|
|
|
33856
33928
|
const rootFile = path73.relative(process.cwd(), path73.join(root, "CLAUDE.md"));
|
|
33857
33929
|
if (directories.length === 0) {
|
|
33858
33930
|
console.log(
|
|
33859
|
-
|
|
33931
|
+
chalk224.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
33860
33932
|
);
|
|
33861
33933
|
return;
|
|
33862
33934
|
}
|
|
33863
33935
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
33864
33936
|
for (const directory of directories)
|
|
33865
|
-
console.log(` ${
|
|
33937
|
+
console.log(` ${chalk224.cyan(directory)}`);
|
|
33866
33938
|
}
|
|
33867
33939
|
|
|
33868
33940
|
// src/commands/rules/listRules.ts
|
|
33869
33941
|
import path74 from "path";
|
|
33870
|
-
import
|
|
33942
|
+
import chalk225 from "chalk";
|
|
33871
33943
|
function listRules(target, options2 = {}) {
|
|
33872
33944
|
const resolved = path74.resolve(target ?? process.cwd());
|
|
33873
33945
|
const rules3 = readScopedRules(resolved);
|
|
33874
33946
|
if (rules3.length === 0) {
|
|
33875
33947
|
const label2 = path74.relative(process.cwd(), resolved) || ".";
|
|
33876
|
-
console.log(
|
|
33948
|
+
console.log(chalk225.gray(`No rules in scope for ${label2}`));
|
|
33877
33949
|
return;
|
|
33878
33950
|
}
|
|
33879
33951
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -33883,14 +33955,14 @@ function listRules(target, options2 = {}) {
|
|
|
33883
33955
|
if (rule.source !== shown) {
|
|
33884
33956
|
shown = rule.source;
|
|
33885
33957
|
console.log(
|
|
33886
|
-
|
|
33958
|
+
chalk225.dim(base ? path74.relative(base, rule.source) : rule.source)
|
|
33887
33959
|
);
|
|
33888
33960
|
}
|
|
33889
33961
|
console.log(
|
|
33890
|
-
` ${
|
|
33962
|
+
` ${chalk225.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
33891
33963
|
);
|
|
33892
33964
|
if (options2.full && rule.title)
|
|
33893
|
-
console.log(` ${" ".repeat(width)} ${
|
|
33965
|
+
console.log(` ${" ".repeat(width)} ${chalk225.dim(rule.text)}`);
|
|
33894
33966
|
}
|
|
33895
33967
|
}
|
|
33896
33968
|
|
|
@@ -33919,7 +33991,7 @@ function registerRules(program2) {
|
|
|
33919
33991
|
}
|
|
33920
33992
|
|
|
33921
33993
|
// src/commands/seq/seqAuth.ts
|
|
33922
|
-
import
|
|
33994
|
+
import chalk227 from "chalk";
|
|
33923
33995
|
|
|
33924
33996
|
// src/commands/seq/loadConnections.ts
|
|
33925
33997
|
function loadConnections2() {
|
|
@@ -33948,10 +34020,10 @@ function setDefaultConnection(name) {
|
|
|
33948
34020
|
}
|
|
33949
34021
|
|
|
33950
34022
|
// src/shared/assertUniqueName.ts
|
|
33951
|
-
import
|
|
34023
|
+
import chalk226 from "chalk";
|
|
33952
34024
|
function assertUniqueName(existingNames, name) {
|
|
33953
34025
|
if (existingNames.includes(name)) {
|
|
33954
|
-
console.error(
|
|
34026
|
+
console.error(chalk226.red(`Connection "${name}" already exists.`));
|
|
33955
34027
|
process.exit(1);
|
|
33956
34028
|
}
|
|
33957
34029
|
}
|
|
@@ -33969,16 +34041,16 @@ async function promptConnection2(existingNames) {
|
|
|
33969
34041
|
var seqAuth = createConnectionAuth({
|
|
33970
34042
|
load: loadConnections2,
|
|
33971
34043
|
save: saveConnections2,
|
|
33972
|
-
format: (c) => `${
|
|
34044
|
+
format: (c) => `${chalk227.bold(c.name)} ${c.url}`,
|
|
33973
34045
|
promptNew: promptConnection2,
|
|
33974
34046
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
33975
34047
|
});
|
|
33976
34048
|
|
|
33977
34049
|
// src/commands/seq/seqQuery.ts
|
|
33978
|
-
import
|
|
34050
|
+
import chalk231 from "chalk";
|
|
33979
34051
|
|
|
33980
34052
|
// src/commands/seq/fetchSeq.ts
|
|
33981
|
-
import
|
|
34053
|
+
import chalk228 from "chalk";
|
|
33982
34054
|
async function fetchSeq(conn, path91, params) {
|
|
33983
34055
|
const url = `${conn.url}${path91}?${params}`;
|
|
33984
34056
|
const response = await fetch(url, {
|
|
@@ -33989,7 +34061,7 @@ async function fetchSeq(conn, path91, params) {
|
|
|
33989
34061
|
});
|
|
33990
34062
|
if (!response.ok) {
|
|
33991
34063
|
const body = await response.text();
|
|
33992
|
-
console.error(
|
|
34064
|
+
console.error(chalk228.red(`Seq returned ${response.status}: ${body}`));
|
|
33993
34065
|
process.exit(1);
|
|
33994
34066
|
}
|
|
33995
34067
|
return response;
|
|
@@ -34048,23 +34120,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
34048
34120
|
}
|
|
34049
34121
|
|
|
34050
34122
|
// src/commands/seq/formatEvent.ts
|
|
34051
|
-
import
|
|
34123
|
+
import chalk229 from "chalk";
|
|
34052
34124
|
function levelColor(level) {
|
|
34053
34125
|
switch (level) {
|
|
34054
34126
|
case "Fatal":
|
|
34055
|
-
return
|
|
34127
|
+
return chalk229.bgRed.white;
|
|
34056
34128
|
case "Error":
|
|
34057
|
-
return
|
|
34129
|
+
return chalk229.red;
|
|
34058
34130
|
case "Warning":
|
|
34059
|
-
return
|
|
34131
|
+
return chalk229.yellow;
|
|
34060
34132
|
case "Information":
|
|
34061
|
-
return
|
|
34133
|
+
return chalk229.cyan;
|
|
34062
34134
|
case "Debug":
|
|
34063
|
-
return
|
|
34135
|
+
return chalk229.gray;
|
|
34064
34136
|
case "Verbose":
|
|
34065
|
-
return
|
|
34137
|
+
return chalk229.dim;
|
|
34066
34138
|
default:
|
|
34067
|
-
return
|
|
34139
|
+
return chalk229.white;
|
|
34068
34140
|
}
|
|
34069
34141
|
}
|
|
34070
34142
|
function levelAbbrev(level) {
|
|
@@ -34105,12 +34177,12 @@ function formatTimestamp(iso) {
|
|
|
34105
34177
|
function formatEvent(event) {
|
|
34106
34178
|
const color = levelColor(event.Level);
|
|
34107
34179
|
const abbrev = levelAbbrev(event.Level);
|
|
34108
|
-
const ts8 =
|
|
34180
|
+
const ts8 = chalk229.dim(formatTimestamp(event.Timestamp));
|
|
34109
34181
|
const msg = renderMessage(event);
|
|
34110
34182
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
34111
34183
|
if (event.Exception) {
|
|
34112
34184
|
for (const line of event.Exception.split("\n")) {
|
|
34113
|
-
lines2.push(
|
|
34185
|
+
lines2.push(chalk229.red(` ${line}`));
|
|
34114
34186
|
}
|
|
34115
34187
|
}
|
|
34116
34188
|
return lines2.join("\n");
|
|
@@ -34143,11 +34215,11 @@ function rejectTimestampFilter(filter) {
|
|
|
34143
34215
|
}
|
|
34144
34216
|
|
|
34145
34217
|
// src/shared/resolveNamedConnection.ts
|
|
34146
|
-
import
|
|
34218
|
+
import chalk230 from "chalk";
|
|
34147
34219
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
34148
34220
|
if (connections.length === 0) {
|
|
34149
34221
|
console.error(
|
|
34150
|
-
|
|
34222
|
+
chalk230.red(
|
|
34151
34223
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
34152
34224
|
)
|
|
34153
34225
|
);
|
|
@@ -34156,7 +34228,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
34156
34228
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
34157
34229
|
const connection = connections.find((c) => c.name === target);
|
|
34158
34230
|
if (!connection) {
|
|
34159
|
-
console.error(
|
|
34231
|
+
console.error(chalk230.red(`${kind} connection "${target}" not found.`));
|
|
34160
34232
|
process.exit(1);
|
|
34161
34233
|
}
|
|
34162
34234
|
return connection;
|
|
@@ -34185,7 +34257,7 @@ async function seqQuery(filter, options2) {
|
|
|
34185
34257
|
new URLSearchParams({ filter, count: String(count8) })
|
|
34186
34258
|
);
|
|
34187
34259
|
if (events.length === 0) {
|
|
34188
|
-
console.log(
|
|
34260
|
+
console.log(chalk231.yellow("No events found."));
|
|
34189
34261
|
return;
|
|
34190
34262
|
}
|
|
34191
34263
|
if (options2.json) {
|
|
@@ -34196,11 +34268,11 @@ async function seqQuery(filter, options2) {
|
|
|
34196
34268
|
for (const event of chronological) {
|
|
34197
34269
|
console.log(formatEvent(event));
|
|
34198
34270
|
}
|
|
34199
|
-
console.log(
|
|
34271
|
+
console.log(chalk231.dim(`
|
|
34200
34272
|
${events.length} events`));
|
|
34201
34273
|
if (events.length >= count8) {
|
|
34202
34274
|
console.log(
|
|
34203
|
-
|
|
34275
|
+
chalk231.yellow(
|
|
34204
34276
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
34205
34277
|
)
|
|
34206
34278
|
);
|
|
@@ -34208,10 +34280,10 @@ ${events.length} events`));
|
|
|
34208
34280
|
}
|
|
34209
34281
|
|
|
34210
34282
|
// src/shared/setNamedDefaultConnection.ts
|
|
34211
|
-
import
|
|
34283
|
+
import chalk232 from "chalk";
|
|
34212
34284
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
34213
34285
|
if (!connections.find((c) => c.name === name)) {
|
|
34214
|
-
console.error(
|
|
34286
|
+
console.error(chalk232.red(`Connection "${name}" not found.`));
|
|
34215
34287
|
process.exit(1);
|
|
34216
34288
|
}
|
|
34217
34289
|
setDefault(name);
|
|
@@ -34432,7 +34504,7 @@ function registerSlack(program2) {
|
|
|
34432
34504
|
}
|
|
34433
34505
|
|
|
34434
34506
|
// src/commands/sql/sqlAuth.ts
|
|
34435
|
-
import
|
|
34507
|
+
import chalk234 from "chalk";
|
|
34436
34508
|
|
|
34437
34509
|
// src/commands/sql/loadConnections.ts
|
|
34438
34510
|
function loadConnections3() {
|
|
@@ -34461,7 +34533,7 @@ function setDefaultConnection2(name) {
|
|
|
34461
34533
|
}
|
|
34462
34534
|
|
|
34463
34535
|
// src/commands/sql/promptConnection.ts
|
|
34464
|
-
import
|
|
34536
|
+
import chalk233 from "chalk";
|
|
34465
34537
|
async function promptConnection3(existingNames) {
|
|
34466
34538
|
const name = await promptInput("name", "Connection name:", "default");
|
|
34467
34539
|
assertUniqueName(existingNames, name);
|
|
@@ -34469,7 +34541,7 @@ async function promptConnection3(existingNames) {
|
|
|
34469
34541
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
34470
34542
|
const port = Number.parseInt(portStr, 10);
|
|
34471
34543
|
if (!Number.isFinite(port)) {
|
|
34472
|
-
console.error(
|
|
34544
|
+
console.error(chalk233.red(`Invalid port "${portStr}".`));
|
|
34473
34545
|
process.exit(1);
|
|
34474
34546
|
}
|
|
34475
34547
|
const user = await promptInput("user", "User:");
|
|
@@ -34482,13 +34554,13 @@ async function promptConnection3(existingNames) {
|
|
|
34482
34554
|
var sqlAuth = createConnectionAuth({
|
|
34483
34555
|
load: loadConnections3,
|
|
34484
34556
|
save: saveConnections3,
|
|
34485
|
-
format: (c) => `${
|
|
34557
|
+
format: (c) => `${chalk234.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
34486
34558
|
promptNew: promptConnection3,
|
|
34487
34559
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
34488
34560
|
});
|
|
34489
34561
|
|
|
34490
34562
|
// src/commands/sql/printTable.ts
|
|
34491
|
-
import
|
|
34563
|
+
import chalk235 from "chalk";
|
|
34492
34564
|
function formatCell(value) {
|
|
34493
34565
|
if (value === null || value === void 0) return "";
|
|
34494
34566
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -34497,7 +34569,7 @@ function formatCell(value) {
|
|
|
34497
34569
|
}
|
|
34498
34570
|
function printTable(rows) {
|
|
34499
34571
|
if (rows.length === 0) {
|
|
34500
|
-
console.log(
|
|
34572
|
+
console.log(chalk235.yellow("(no rows)"));
|
|
34501
34573
|
return;
|
|
34502
34574
|
}
|
|
34503
34575
|
const columns = Object.keys(rows[0]);
|
|
@@ -34505,13 +34577,13 @@ function printTable(rows) {
|
|
|
34505
34577
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
34506
34578
|
);
|
|
34507
34579
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
34508
|
-
console.log(
|
|
34509
|
-
console.log(
|
|
34580
|
+
console.log(chalk235.dim(header));
|
|
34581
|
+
console.log(chalk235.dim("-".repeat(header.length)));
|
|
34510
34582
|
for (const row of rows) {
|
|
34511
34583
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
34512
34584
|
console.log(line);
|
|
34513
34585
|
}
|
|
34514
|
-
console.log(
|
|
34586
|
+
console.log(chalk235.dim(`
|
|
34515
34587
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
34516
34588
|
}
|
|
34517
34589
|
|
|
@@ -34571,7 +34643,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
34571
34643
|
}
|
|
34572
34644
|
|
|
34573
34645
|
// src/commands/sql/sqlMutate.ts
|
|
34574
|
-
import
|
|
34646
|
+
import chalk236 from "chalk";
|
|
34575
34647
|
|
|
34576
34648
|
// src/commands/sql/isMutation.ts
|
|
34577
34649
|
var MUTATION_KEYWORDS = [
|
|
@@ -34605,7 +34677,7 @@ function isMutation(sql29) {
|
|
|
34605
34677
|
async function sqlMutate(query, connectionName) {
|
|
34606
34678
|
if (!isMutation(query)) {
|
|
34607
34679
|
console.error(
|
|
34608
|
-
|
|
34680
|
+
chalk236.red(
|
|
34609
34681
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
34610
34682
|
)
|
|
34611
34683
|
);
|
|
@@ -34615,18 +34687,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
34615
34687
|
const pool = await sqlConnect(conn);
|
|
34616
34688
|
try {
|
|
34617
34689
|
const result = await pool.request().query(query);
|
|
34618
|
-
console.log(
|
|
34690
|
+
console.log(chalk236.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
34619
34691
|
} finally {
|
|
34620
34692
|
await pool.close();
|
|
34621
34693
|
}
|
|
34622
34694
|
}
|
|
34623
34695
|
|
|
34624
34696
|
// src/commands/sql/sqlQuery.ts
|
|
34625
|
-
import
|
|
34697
|
+
import chalk237 from "chalk";
|
|
34626
34698
|
async function sqlQuery(query, connectionName) {
|
|
34627
34699
|
if (isMutation(query)) {
|
|
34628
34700
|
console.error(
|
|
34629
|
-
|
|
34701
|
+
chalk237.red(
|
|
34630
34702
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
34631
34703
|
)
|
|
34632
34704
|
);
|
|
@@ -34641,7 +34713,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
34641
34713
|
printTable(rows);
|
|
34642
34714
|
} else {
|
|
34643
34715
|
console.log(
|
|
34644
|
-
|
|
34716
|
+
chalk237.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
34645
34717
|
);
|
|
34646
34718
|
}
|
|
34647
34719
|
} finally {
|
|
@@ -35015,7 +35087,7 @@ function syncPi(claudeDir, options2) {
|
|
|
35015
35087
|
// src/commands/sync/syncSettings.ts
|
|
35016
35088
|
import * as fs48 from "fs";
|
|
35017
35089
|
import * as path84 from "path";
|
|
35018
|
-
import
|
|
35090
|
+
import chalk238 from "chalk";
|
|
35019
35091
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
35020
35092
|
const source = path84.join(claudeDir, "settings.json");
|
|
35021
35093
|
const target = path84.join(targetBase, "settings.json");
|
|
@@ -35034,7 +35106,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
35034
35106
|
if (mergedContent !== normalizedTarget) {
|
|
35035
35107
|
if (!options2?.yes) {
|
|
35036
35108
|
console.log(
|
|
35037
|
-
|
|
35109
|
+
chalk238.yellow(
|
|
35038
35110
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
35039
35111
|
)
|
|
35040
35112
|
);
|
|
@@ -35042,7 +35114,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
35042
35114
|
printDiff(targetContent, mergedContent);
|
|
35043
35115
|
printAutoConfirmHint();
|
|
35044
35116
|
const confirm = await promptConfirm(
|
|
35045
|
-
|
|
35117
|
+
chalk238.red("Overwrite existing settings.json?"),
|
|
35046
35118
|
false
|
|
35047
35119
|
);
|
|
35048
35120
|
if (!confirm) {
|
|
@@ -36784,7 +36856,7 @@ function registerWatch(program2) {
|
|
|
36784
36856
|
|
|
36785
36857
|
// src/commands/roam/auth.ts
|
|
36786
36858
|
import { randomBytes } from "crypto";
|
|
36787
|
-
import
|
|
36859
|
+
import chalk239 from "chalk";
|
|
36788
36860
|
|
|
36789
36861
|
// src/commands/roam/waitForCallback.ts
|
|
36790
36862
|
import { createServer as createServer3 } from "http";
|
|
@@ -36915,13 +36987,13 @@ async function auth() {
|
|
|
36915
36987
|
saveGlobalConfig(config);
|
|
36916
36988
|
const state = randomBytes(16).toString("hex");
|
|
36917
36989
|
console.log(
|
|
36918
|
-
|
|
36990
|
+
chalk239.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
36919
36991
|
);
|
|
36920
|
-
console.log(
|
|
36921
|
-
console.log(
|
|
36922
|
-
console.log(
|
|
36992
|
+
console.log(chalk239.white("http://localhost:14523/callback\n"));
|
|
36993
|
+
console.log(chalk239.blue("Opening browser for authorization..."));
|
|
36994
|
+
console.log(chalk239.dim("Waiting for authorization callback..."));
|
|
36923
36995
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
36924
|
-
console.log(
|
|
36996
|
+
console.log(chalk239.dim("Exchanging code for tokens..."));
|
|
36925
36997
|
const tokens = await exchangeToken({
|
|
36926
36998
|
code,
|
|
36927
36999
|
clientId,
|
|
@@ -36937,7 +37009,7 @@ async function auth() {
|
|
|
36937
37009
|
};
|
|
36938
37010
|
saveGlobalConfig(config);
|
|
36939
37011
|
console.log(
|
|
36940
|
-
|
|
37012
|
+
chalk239.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
36941
37013
|
);
|
|
36942
37014
|
}
|
|
36943
37015
|
|
|
@@ -37296,7 +37368,7 @@ import { execSync as execSync66 } from "child_process";
|
|
|
37296
37368
|
import { existsSync as existsSync86, mkdirSync as mkdirSync36, unlinkSync as unlinkSync22, writeFileSync as writeFileSync53 } from "fs";
|
|
37297
37369
|
import { tmpdir as tmpdir9 } from "os";
|
|
37298
37370
|
import { join as join101, resolve as resolve21 } from "path";
|
|
37299
|
-
import
|
|
37371
|
+
import chalk240 from "chalk";
|
|
37300
37372
|
|
|
37301
37373
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
37302
37374
|
var captureWindowPs1 = `
|
|
@@ -37447,13 +37519,13 @@ function screenshot(processName) {
|
|
|
37447
37519
|
const config = loadConfig();
|
|
37448
37520
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
37449
37521
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
37450
|
-
console.log(
|
|
37522
|
+
console.log(chalk240.gray(`Capturing window for process "${processName}" ...`));
|
|
37451
37523
|
try {
|
|
37452
37524
|
runPowerShellScript(processName, outputPath);
|
|
37453
|
-
console.log(
|
|
37525
|
+
console.log(chalk240.green(`Screenshot saved: ${outputPath}`));
|
|
37454
37526
|
} catch (error) {
|
|
37455
37527
|
const msg = error instanceof Error ? error.message : String(error);
|
|
37456
|
-
console.error(
|
|
37528
|
+
console.error(chalk240.red(`Failed to capture screenshot: ${msg}`));
|
|
37457
37529
|
process.exit(1);
|
|
37458
37530
|
}
|
|
37459
37531
|
}
|
|
@@ -43434,7 +43506,7 @@ async function renameSession(title) {
|
|
|
43434
43506
|
|
|
43435
43507
|
// src/commands/sessions/summarise/index.ts
|
|
43436
43508
|
import * as fs57 from "fs";
|
|
43437
|
-
import
|
|
43509
|
+
import chalk241 from "chalk";
|
|
43438
43510
|
|
|
43439
43511
|
// src/commands/sessions/summarise/shared.ts
|
|
43440
43512
|
import * as fs56 from "fs";
|
|
@@ -43493,22 +43565,22 @@ ${firstMessage}`);
|
|
|
43493
43565
|
async function summarise2(options2) {
|
|
43494
43566
|
const files = await discoverSessionFiles();
|
|
43495
43567
|
if (files.length === 0) {
|
|
43496
|
-
console.log(
|
|
43568
|
+
console.log(chalk241.yellow("No sessions found."));
|
|
43497
43569
|
return;
|
|
43498
43570
|
}
|
|
43499
43571
|
const toProcess = selectCandidates(files, options2);
|
|
43500
43572
|
if (toProcess.length === 0) {
|
|
43501
|
-
console.log(
|
|
43573
|
+
console.log(chalk241.green("All sessions already summarised."));
|
|
43502
43574
|
return;
|
|
43503
43575
|
}
|
|
43504
43576
|
console.log(
|
|
43505
|
-
|
|
43577
|
+
chalk241.cyan(
|
|
43506
43578
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
43507
43579
|
)
|
|
43508
43580
|
);
|
|
43509
43581
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
43510
43582
|
console.log(
|
|
43511
|
-
|
|
43583
|
+
chalk241.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk241.yellow(`, ${failed2} skipped`) : "")
|
|
43512
43584
|
);
|
|
43513
43585
|
}
|
|
43514
43586
|
function selectCandidates(files, options2) {
|
|
@@ -43528,16 +43600,16 @@ function processSessions(files) {
|
|
|
43528
43600
|
let failed2 = 0;
|
|
43529
43601
|
for (let i = 0; i < files.length; i++) {
|
|
43530
43602
|
const file = files[i];
|
|
43531
|
-
process.stdout.write(
|
|
43603
|
+
process.stdout.write(chalk241.dim(` [${i + 1}/${files.length}] `));
|
|
43532
43604
|
const summary = summariseSession(file);
|
|
43533
43605
|
if (summary) {
|
|
43534
43606
|
writeSummary(file, summary);
|
|
43535
43607
|
succeeded++;
|
|
43536
|
-
process.stdout.write(`${
|
|
43608
|
+
process.stdout.write(`${chalk241.green("\u2713")} ${summary}
|
|
43537
43609
|
`);
|
|
43538
43610
|
} else {
|
|
43539
43611
|
failed2++;
|
|
43540
|
-
process.stdout.write(` ${
|
|
43612
|
+
process.stdout.write(` ${chalk241.yellow("skip")}
|
|
43541
43613
|
`);
|
|
43542
43614
|
}
|
|
43543
43615
|
}
|
|
@@ -43564,7 +43636,7 @@ function registerSessions(program2) {
|
|
|
43564
43636
|
}
|
|
43565
43637
|
|
|
43566
43638
|
// src/commands/statusLine.ts
|
|
43567
|
-
import
|
|
43639
|
+
import chalk243 from "chalk";
|
|
43568
43640
|
|
|
43569
43641
|
// src/shared/contextLevel.ts
|
|
43570
43642
|
function contextLevel(pct) {
|
|
@@ -43574,7 +43646,7 @@ function contextLevel(pct) {
|
|
|
43574
43646
|
}
|
|
43575
43647
|
|
|
43576
43648
|
// src/commands/buildLimitsSegment.ts
|
|
43577
|
-
import
|
|
43649
|
+
import chalk242 from "chalk";
|
|
43578
43650
|
|
|
43579
43651
|
// src/shared/rateLimitLevel.ts
|
|
43580
43652
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -43612,9 +43684,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
43612
43684
|
|
|
43613
43685
|
// src/commands/buildLimitsSegment.ts
|
|
43614
43686
|
var LEVEL_COLOR = {
|
|
43615
|
-
ok:
|
|
43616
|
-
warn:
|
|
43617
|
-
over:
|
|
43687
|
+
ok: chalk242.green,
|
|
43688
|
+
warn: chalk242.yellow,
|
|
43689
|
+
over: chalk242.red
|
|
43618
43690
|
};
|
|
43619
43691
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
43620
43692
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -43710,7 +43782,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
43710
43782
|
}
|
|
43711
43783
|
|
|
43712
43784
|
// src/commands/statusLine.ts
|
|
43713
|
-
|
|
43785
|
+
chalk243.level = 3;
|
|
43714
43786
|
function formatNumber(num) {
|
|
43715
43787
|
return num.toLocaleString("en-US");
|
|
43716
43788
|
}
|
|
@@ -43718,9 +43790,9 @@ function colorizePercent(pct) {
|
|
|
43718
43790
|
const label2 = `${Math.round(pct)}%`;
|
|
43719
43791
|
switch (contextLevel(pct)) {
|
|
43720
43792
|
case "red":
|
|
43721
|
-
return
|
|
43793
|
+
return chalk243.red(label2);
|
|
43722
43794
|
case "yellow":
|
|
43723
|
-
return
|
|
43795
|
+
return chalk243.yellow(label2);
|
|
43724
43796
|
default:
|
|
43725
43797
|
return label2;
|
|
43726
43798
|
}
|
|
@@ -43733,7 +43805,7 @@ async function statusLine() {
|
|
|
43733
43805
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
43734
43806
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
43735
43807
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
43736
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
43808
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk243.cyan(branch2)} | ` : "";
|
|
43737
43809
|
console.log(
|
|
43738
43810
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
43739
43811
|
);
|
|
@@ -43803,10 +43875,10 @@ async function update2() {
|
|
|
43803
43875
|
}
|
|
43804
43876
|
|
|
43805
43877
|
// src/reportCliError.ts
|
|
43806
|
-
import
|
|
43878
|
+
import chalk244 from "chalk";
|
|
43807
43879
|
function reportCliError(error) {
|
|
43808
43880
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
43809
|
-
console.error(
|
|
43881
|
+
console.error(chalk244.red(error.message));
|
|
43810
43882
|
} else {
|
|
43811
43883
|
console.error(error);
|
|
43812
43884
|
}
|