@staff0rd/assist 0.680.1 → 0.681.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 +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +467 -175
- 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.681.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -30619,19 +30619,295 @@ async function checkoutOnlySession(number) {
|
|
|
30619
30619
|
await done2;
|
|
30620
30620
|
}
|
|
30621
30621
|
|
|
30622
|
-
// src/commands/review/highLevel/
|
|
30622
|
+
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
30623
|
+
import chalk214 from "chalk";
|
|
30624
|
+
|
|
30625
|
+
// src/commands/config/promptConfigScope.ts
|
|
30626
|
+
import Enquirer3 from "enquirer";
|
|
30627
|
+
var prompts3 = Enquirer3;
|
|
30628
|
+
async function promptConfigScope() {
|
|
30629
|
+
const answer = await exitOnCancel(
|
|
30630
|
+
new prompts3.Select({
|
|
30631
|
+
name: "scope",
|
|
30632
|
+
message: "Where should these values be written?",
|
|
30633
|
+
choices: [
|
|
30634
|
+
{
|
|
30635
|
+
name: "project",
|
|
30636
|
+
message: "assist.yml in this repo \u2014 checked in, shared with the team"
|
|
30637
|
+
},
|
|
30638
|
+
{
|
|
30639
|
+
name: "repo",
|
|
30640
|
+
message: "this repo's block in ~/.assist.yml \u2014 personal, as 'config set -g --repo' writes it"
|
|
30641
|
+
}
|
|
30642
|
+
]
|
|
30643
|
+
}).run()
|
|
30644
|
+
);
|
|
30645
|
+
return answer === "repo" ? "repo" : "project";
|
|
30646
|
+
}
|
|
30647
|
+
|
|
30648
|
+
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
30623
30649
|
import chalk212 from "chalk";
|
|
30650
|
+
async function resolveConfigKeyAnswer(question, supplied) {
|
|
30651
|
+
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
30652
|
+
for (; ; ) {
|
|
30653
|
+
const answer = (await promptInput(question.key, question.question, question.suggest)).trim();
|
|
30654
|
+
if (answer === "") return void 0;
|
|
30655
|
+
const coercion = coerceCliConfigValue(question.key, answer);
|
|
30656
|
+
if (coercion.ok) return coercion.value;
|
|
30657
|
+
console.error(chalk212.red(coercion.error));
|
|
30658
|
+
}
|
|
30659
|
+
}
|
|
30660
|
+
function coerceSupplied(key, supplied) {
|
|
30661
|
+
if (supplied.trim() === "") return void 0;
|
|
30662
|
+
const coercion = coerceCliConfigValue(key, supplied.trim());
|
|
30663
|
+
if (!coercion.ok) exitWithConfigErrors([coercion.error]);
|
|
30664
|
+
return coercion.value;
|
|
30665
|
+
}
|
|
30666
|
+
|
|
30667
|
+
// src/commands/config/applyConfigWrites.ts
|
|
30668
|
+
function applyConfigWrites(base, writes, schema2) {
|
|
30669
|
+
let updated2 = base;
|
|
30670
|
+
for (const write of writes) {
|
|
30671
|
+
updated2 = setNestedValue(updated2, write.key, write.value);
|
|
30672
|
+
const validation = validateConfig(updated2, write.key, schema2);
|
|
30673
|
+
if (!validation.ok) return validation;
|
|
30674
|
+
}
|
|
30675
|
+
return { ok: true, updated: updated2 };
|
|
30676
|
+
}
|
|
30677
|
+
|
|
30678
|
+
// src/commands/config/writeConfigKeys.ts
|
|
30679
|
+
function writeConfigKeys(writes, scope, cwd = process.cwd(), globalConfigPath) {
|
|
30680
|
+
const globalOnly = writes.filter((write) => isGlobalOnlyConfigKey(write.key));
|
|
30681
|
+
if (globalOnly.length > 0) {
|
|
30682
|
+
return {
|
|
30683
|
+
ok: false,
|
|
30684
|
+
errors: globalOnly.map(
|
|
30685
|
+
(write) => `"${write.key}" is a global-only key. Set it with 'assist config set ${write.key} <value> -g'`
|
|
30686
|
+
)
|
|
30687
|
+
};
|
|
30688
|
+
}
|
|
30689
|
+
if (scope === "repo") return writeRepoBlock(writes, cwd, globalConfigPath);
|
|
30690
|
+
const applied = applyConfigWrites(loadProjectConfig(cwd), writes);
|
|
30691
|
+
if (!applied.ok) return applied;
|
|
30692
|
+
saveConfig(applied.updated, cwd);
|
|
30693
|
+
return { ok: true, target: "project assist.yml" };
|
|
30694
|
+
}
|
|
30695
|
+
function writeRepoBlock(writes, cwd, globalConfigPath) {
|
|
30696
|
+
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
30697
|
+
void 0,
|
|
30698
|
+
cwd,
|
|
30699
|
+
globalConfigPath
|
|
30700
|
+
);
|
|
30701
|
+
const applied = applyConfigWrites(block, writes, repoConfigSchema);
|
|
30702
|
+
if (!applied.ok) return applied;
|
|
30703
|
+
repos2[label2] = applied.updated;
|
|
30704
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
30705
|
+
return { ok: true, target: `~/.assist.yml, repo: ${label2}` };
|
|
30706
|
+
}
|
|
30707
|
+
|
|
30708
|
+
// src/commands/config/configureConfigKeys.ts
|
|
30709
|
+
async function configureConfigKeys(questions, options2 = {}) {
|
|
30710
|
+
const scope = options2.scope ?? await promptConfigScope();
|
|
30711
|
+
const written = [];
|
|
30712
|
+
const skipped = [];
|
|
30713
|
+
for (const question of questions) {
|
|
30714
|
+
const value = await resolveConfigKeyAnswer(
|
|
30715
|
+
question,
|
|
30716
|
+
options2.answers?.[question.key]
|
|
30717
|
+
);
|
|
30718
|
+
if (value === void 0) skipped.push(question.key);
|
|
30719
|
+
else written.push({ key: question.key, value });
|
|
30720
|
+
}
|
|
30721
|
+
const result = writeConfigKeys(written, scope, options2.cwd);
|
|
30722
|
+
if (!result.ok) exitWithConfigErrors(result.errors);
|
|
30723
|
+
return { scope, target: result.target, written, skipped };
|
|
30724
|
+
}
|
|
30725
|
+
|
|
30726
|
+
// src/commands/review/highLevel/buildHighLevelQuestions.ts
|
|
30727
|
+
function buildHighLevelQuestions(current, proposed) {
|
|
30728
|
+
return [
|
|
30729
|
+
{
|
|
30730
|
+
key: "review.highLevel.criticalPaths",
|
|
30731
|
+
question: "Critical paths \u2014 comma-separated globs whose full diffs the review shows (blank to leave unset)",
|
|
30732
|
+
suggest: suggestGlobs(current.criticalPaths, proposed.criticalPaths)
|
|
30733
|
+
},
|
|
30734
|
+
{
|
|
30735
|
+
key: "review.highLevel.uiPaths",
|
|
30736
|
+
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
|
+
suggest: suggestGlobs(current.uiPaths, proposed.uiPaths)
|
|
30738
|
+
},
|
|
30739
|
+
{
|
|
30740
|
+
key: "review.highLevel.descriptionWordCap",
|
|
30741
|
+
question: "Description word cap (blank to leave unset)",
|
|
30742
|
+
suggest: String(current.descriptionWordCap)
|
|
30743
|
+
}
|
|
30744
|
+
];
|
|
30745
|
+
}
|
|
30746
|
+
function suggestGlobs(current, proposed) {
|
|
30747
|
+
const globs = current.length > 0 ? current : proposed;
|
|
30748
|
+
return globs.length > 0 ? globs.join(",") : void 0;
|
|
30749
|
+
}
|
|
30750
|
+
|
|
30751
|
+
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
30752
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
30753
|
+
import chalk213 from "chalk";
|
|
30754
|
+
|
|
30755
|
+
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
30756
|
+
function buildGlobProposalPrompt(tree) {
|
|
30757
|
+
return [
|
|
30758
|
+
"You are proposing configuration for a high-level PR review checklist in a repository.",
|
|
30759
|
+
"",
|
|
30760
|
+
"criticalPaths: globs matching files where a wrong line is expensive and an LLM reviewer cannot judge it \u2014 schema and API definitions, translation catalogues, database migrations, infrastructure and deployment definitions, dependency and permission manifests. Their full diffs are shown to the human reviewer, so keep the set small.",
|
|
30761
|
+
"uiPaths: globs matching the files that render the user interface, so that touching one requires a screenshot or video on the PR. Exclude tests and stories.",
|
|
30762
|
+
"",
|
|
30763
|
+
"Below is every tracked directory in this repository with the extensions of the files in it. Propose globs that match this repository's own files \u2014 never generic guesses at files it does not have.",
|
|
30764
|
+
"",
|
|
30765
|
+
tree,
|
|
30766
|
+
"",
|
|
30767
|
+
'Reply with JSON only, no prose and no code fence: {"criticalPaths": ["..."], "uiPaths": ["..."]}. Use an empty array where nothing fits. At most 8 globs each.'
|
|
30768
|
+
].join("\n");
|
|
30769
|
+
}
|
|
30770
|
+
|
|
30771
|
+
// src/commands/review/highLevel/parseProposedGlobs.ts
|
|
30772
|
+
var MAX_GLOBS = 8;
|
|
30773
|
+
function parseProposedGlobs(output) {
|
|
30774
|
+
const parsed = parseJsonObject(output);
|
|
30775
|
+
return {
|
|
30776
|
+
criticalPaths: readGlobs(parsed?.criticalPaths),
|
|
30777
|
+
uiPaths: readGlobs(parsed?.uiPaths)
|
|
30778
|
+
};
|
|
30779
|
+
}
|
|
30780
|
+
function parseJsonObject(output) {
|
|
30781
|
+
const start3 = output.indexOf("{");
|
|
30782
|
+
const end = output.lastIndexOf("}");
|
|
30783
|
+
if (start3 === -1 || end <= start3) return void 0;
|
|
30784
|
+
try {
|
|
30785
|
+
const parsed = JSON.parse(output.slice(start3, end + 1));
|
|
30786
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
30787
|
+
return void 0;
|
|
30788
|
+
return parsed;
|
|
30789
|
+
} catch {
|
|
30790
|
+
return void 0;
|
|
30791
|
+
}
|
|
30792
|
+
}
|
|
30793
|
+
function readGlobs(value) {
|
|
30794
|
+
if (!Array.isArray(value)) return [];
|
|
30795
|
+
const globs = value.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item !== "");
|
|
30796
|
+
return [...new Set(globs)].slice(0, MAX_GLOBS);
|
|
30797
|
+
}
|
|
30798
|
+
|
|
30799
|
+
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
30800
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
30801
|
+
import { dirname as dirname34, extname as extname3 } from "path";
|
|
30802
|
+
var MAX_DIRECTORIES = 200;
|
|
30803
|
+
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
30804
|
+
function summariseRepoTree(cwd = process.cwd()) {
|
|
30805
|
+
const directories = countByDirectory(listTrackedFiles(cwd));
|
|
30806
|
+
return [...directories.entries()].map(([directory, extensions]) => ({
|
|
30807
|
+
directory,
|
|
30808
|
+
extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
|
|
30809
|
+
total: [...extensions.values()].reduce((sum3, count8) => sum3 + count8, 0)
|
|
30810
|
+
})).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
|
|
30811
|
+
(entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
|
|
30812
|
+
).join("\n");
|
|
30813
|
+
}
|
|
30814
|
+
function listTrackedFiles(cwd) {
|
|
30815
|
+
try {
|
|
30816
|
+
return execFileSync18("git", ["ls-files"], {
|
|
30817
|
+
cwd,
|
|
30818
|
+
encoding: "utf8",
|
|
30819
|
+
maxBuffer: 64 * 1024 * 1024
|
|
30820
|
+
}).split("\n").filter((line) => line !== "");
|
|
30821
|
+
} catch {
|
|
30822
|
+
return [];
|
|
30823
|
+
}
|
|
30824
|
+
}
|
|
30825
|
+
function countByDirectory(files) {
|
|
30826
|
+
const directories = /* @__PURE__ */ new Map();
|
|
30827
|
+
for (const file of files) {
|
|
30828
|
+
const directory = dirname34(file) === "." ? "(repo root)" : dirname34(file);
|
|
30829
|
+
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
30830
|
+
const extension = extname3(file) === "" ? "(no extension)" : extname3(file);
|
|
30831
|
+
extensions.set(extension, (extensions.get(extension) ?? 0) + 1);
|
|
30832
|
+
directories.set(directory, extensions);
|
|
30833
|
+
}
|
|
30834
|
+
return directories;
|
|
30835
|
+
}
|
|
30836
|
+
function formatExtensions(extensions) {
|
|
30837
|
+
return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension, count8]) => `${extension}(${count8})`).join(", ");
|
|
30838
|
+
}
|
|
30839
|
+
|
|
30840
|
+
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
30841
|
+
var NOTHING_PROPOSED = { criticalPaths: [], uiPaths: [] };
|
|
30842
|
+
function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
30843
|
+
const tree = summariseRepoTree(cwd);
|
|
30844
|
+
if (tree === "") return NOTHING_PROPOSED;
|
|
30845
|
+
console.log(
|
|
30846
|
+
chalk213.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
30847
|
+
);
|
|
30848
|
+
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
30849
|
+
if (output === void 0) {
|
|
30850
|
+
console.log(
|
|
30851
|
+
chalk213.yellow(
|
|
30852
|
+
"Claude proposed nothing; answer each key from its current value."
|
|
30853
|
+
)
|
|
30854
|
+
);
|
|
30855
|
+
return NOTHING_PROPOSED;
|
|
30856
|
+
}
|
|
30857
|
+
return parseProposedGlobs(output);
|
|
30858
|
+
}
|
|
30859
|
+
function askClaude(prompt, cwd) {
|
|
30860
|
+
try {
|
|
30861
|
+
return execFileSync19("claude", ["-p", "--model", "sonnet", prompt], {
|
|
30862
|
+
cwd,
|
|
30863
|
+
encoding: "utf8",
|
|
30864
|
+
timeout: 12e4,
|
|
30865
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
30866
|
+
});
|
|
30867
|
+
} catch {
|
|
30868
|
+
return void 0;
|
|
30869
|
+
}
|
|
30870
|
+
}
|
|
30871
|
+
|
|
30872
|
+
// src/commands/review/highLevel/resolveHighLevelConfig.ts
|
|
30873
|
+
var DEFAULT_DESCRIPTION_WORD_CAP = 300;
|
|
30874
|
+
function resolveHighLevelConfig(config) {
|
|
30875
|
+
const highLevel = config.review?.highLevel;
|
|
30876
|
+
return {
|
|
30877
|
+
criticalPaths: highLevel?.criticalPaths ?? [],
|
|
30878
|
+
uiPaths: highLevel?.uiPaths ?? [],
|
|
30879
|
+
descriptionWordCap: highLevel?.descriptionWordCap ?? DEFAULT_DESCRIPTION_WORD_CAP
|
|
30880
|
+
};
|
|
30881
|
+
}
|
|
30882
|
+
|
|
30883
|
+
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
30884
|
+
async function configureHighLevelReview() {
|
|
30885
|
+
const current = resolveHighLevelConfig(loadConfig());
|
|
30886
|
+
const questions = buildHighLevelQuestions(current, proposeHighLevelGlobs());
|
|
30887
|
+
reportConfigured(await configureConfigKeys(questions));
|
|
30888
|
+
}
|
|
30889
|
+
function reportConfigured(result) {
|
|
30890
|
+
for (const write of result.written)
|
|
30891
|
+
console.log(
|
|
30892
|
+
chalk214.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
30893
|
+
);
|
|
30894
|
+
for (const key of result.skipped) console.log(chalk214.dim(`Left ${key} unset`));
|
|
30895
|
+
console.log(chalk214.dim(`Written to ${result.target}`));
|
|
30896
|
+
}
|
|
30897
|
+
|
|
30898
|
+
// src/commands/review/highLevel/announceSavedReview.ts
|
|
30899
|
+
import chalk215 from "chalk";
|
|
30624
30900
|
function announceSavedReview(subject, force) {
|
|
30625
30901
|
const head = subject.headSha.slice(0, 7);
|
|
30626
30902
|
if (subject.saved)
|
|
30627
30903
|
console.log(
|
|
30628
|
-
|
|
30904
|
+
chalk215.dim(
|
|
30629
30905
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
30630
30906
|
)
|
|
30631
30907
|
);
|
|
30632
30908
|
else if (force)
|
|
30633
30909
|
console.log(
|
|
30634
|
-
|
|
30910
|
+
chalk215.dim(
|
|
30635
30911
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
30636
30912
|
)
|
|
30637
30913
|
);
|
|
@@ -31019,17 +31295,6 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
31019
31295
|
}
|
|
31020
31296
|
}
|
|
31021
31297
|
|
|
31022
|
-
// src/commands/review/highLevel/resolveHighLevelConfig.ts
|
|
31023
|
-
var DEFAULT_DESCRIPTION_WORD_CAP = 300;
|
|
31024
|
-
function resolveHighLevelConfig(config) {
|
|
31025
|
-
const highLevel = config.review?.highLevel;
|
|
31026
|
-
return {
|
|
31027
|
-
criticalPaths: highLevel?.criticalPaths ?? [],
|
|
31028
|
-
uiPaths: highLevel?.uiPaths ?? [],
|
|
31029
|
-
descriptionWordCap: highLevel?.descriptionWordCap ?? DEFAULT_DESCRIPTION_WORD_CAP
|
|
31030
|
-
};
|
|
31031
|
-
}
|
|
31032
|
-
|
|
31033
31298
|
// src/commands/review/highLevel/selectCriticalDiffs.ts
|
|
31034
31299
|
import { minimatch as minimatch9 } from "minimatch";
|
|
31035
31300
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
@@ -31148,10 +31413,10 @@ function highLevelPreviewPayload(subject) {
|
|
|
31148
31413
|
|
|
31149
31414
|
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
31150
31415
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
31151
|
-
import { dirname as
|
|
31416
|
+
import { dirname as dirname35 } from "path";
|
|
31152
31417
|
function saveHighLevelReview(record) {
|
|
31153
31418
|
const path91 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
31154
|
-
mkdirSync21(
|
|
31419
|
+
mkdirSync21(dirname35(path91), { recursive: true });
|
|
31155
31420
|
writeFileSync38(path91, `${JSON.stringify(record, null, 2)}
|
|
31156
31421
|
`);
|
|
31157
31422
|
return path91;
|
|
@@ -31181,55 +31446,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
31181
31446
|
}
|
|
31182
31447
|
|
|
31183
31448
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31184
|
-
import
|
|
31449
|
+
import chalk219 from "chalk";
|
|
31185
31450
|
|
|
31186
31451
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
31187
|
-
import
|
|
31452
|
+
import chalk216 from "chalk";
|
|
31188
31453
|
var PATCH_LINE_COLOURS = {
|
|
31189
|
-
"+":
|
|
31190
|
-
"-":
|
|
31191
|
-
"@":
|
|
31454
|
+
"+": chalk216.green,
|
|
31455
|
+
"-": chalk216.red,
|
|
31456
|
+
"@": chalk216.cyan
|
|
31192
31457
|
};
|
|
31193
31458
|
function formatPatch(patch2) {
|
|
31194
31459
|
return patch2.split("\n").map(
|
|
31195
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
31460
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk216.dim)(line)}`
|
|
31196
31461
|
);
|
|
31197
31462
|
}
|
|
31198
31463
|
function formatDiff(diff3) {
|
|
31199
31464
|
return [
|
|
31200
31465
|
"",
|
|
31201
|
-
` ${
|
|
31202
|
-
...diff3.patch === null ? [` ${
|
|
31466
|
+
` ${chalk216.bold(diff3.path)} ${chalk216.dim(`(${diff3.status})`)} ${chalk216.green(`+${diff3.additions}`)} ${chalk216.red(`-${diff3.deletions}`)}`,
|
|
31467
|
+
...diff3.patch === null ? [` ${chalk216.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
31203
31468
|
];
|
|
31204
31469
|
}
|
|
31205
31470
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
31206
31471
|
if (criticalPaths.length === 0)
|
|
31207
|
-
return `${
|
|
31208
|
-
${
|
|
31472
|
+
return `${chalk216.bold.underline("Critical diffs")}
|
|
31473
|
+
${chalk216.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
31209
31474
|
if (diffs.length === 0)
|
|
31210
|
-
return `${
|
|
31211
|
-
${
|
|
31475
|
+
return `${chalk216.bold.underline("Critical diffs")}
|
|
31476
|
+
${chalk216.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
31212
31477
|
return [
|
|
31213
|
-
|
|
31478
|
+
chalk216.bold.underline("Critical diffs"),
|
|
31214
31479
|
...diffs.flatMap(formatDiff)
|
|
31215
31480
|
].join("\n");
|
|
31216
31481
|
}
|
|
31217
31482
|
|
|
31218
31483
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
31219
|
-
import
|
|
31484
|
+
import chalk217 from "chalk";
|
|
31220
31485
|
var MARKERS = {
|
|
31221
|
-
pass: () =>
|
|
31222
|
-
fail: () =>
|
|
31223
|
-
manual: () =>
|
|
31486
|
+
pass: () => chalk217.green("\u2714"),
|
|
31487
|
+
fail: () => chalk217.red("\u2718"),
|
|
31488
|
+
manual: () => chalk217.yellow("\u25A1")
|
|
31224
31489
|
};
|
|
31225
31490
|
function formatCheck(check2) {
|
|
31226
|
-
const title = check2.status === "fail" ?
|
|
31491
|
+
const title = check2.status === "fail" ? chalk217.red(check2.title) : chalk217.bold(check2.title);
|
|
31227
31492
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
31228
|
-
${
|
|
31493
|
+
${chalk217.dim(check2.reason)}`;
|
|
31229
31494
|
}
|
|
31230
31495
|
function formatGroup(heading2, checks2) {
|
|
31231
31496
|
if (checks2.length === 0) return [];
|
|
31232
|
-
return ["",
|
|
31497
|
+
return ["", chalk217.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
31233
31498
|
}
|
|
31234
31499
|
function formatHighLevelChecklist(checks2) {
|
|
31235
31500
|
const deterministic = checks2.filter(
|
|
@@ -31238,7 +31503,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31238
31503
|
const failed2 = deterministic.filter(
|
|
31239
31504
|
(check2) => check2.status === "fail"
|
|
31240
31505
|
).length;
|
|
31241
|
-
const summary = failed2 === 0 ?
|
|
31506
|
+
const summary = failed2 === 0 ? chalk217.green(`All ${deterministic.length} deterministic checks pass`) : chalk217.red(
|
|
31242
31507
|
`${failed2} of ${deterministic.length} deterministic checks fail`
|
|
31243
31508
|
);
|
|
31244
31509
|
return [
|
|
@@ -31253,30 +31518,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31253
31518
|
}
|
|
31254
31519
|
|
|
31255
31520
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
31256
|
-
import
|
|
31521
|
+
import chalk218 from "chalk";
|
|
31257
31522
|
var STATUS_MARKERS = {
|
|
31258
|
-
added: () =>
|
|
31259
|
-
removed: () =>
|
|
31260
|
-
modified: () =>
|
|
31523
|
+
added: () => chalk218.green("A"),
|
|
31524
|
+
removed: () => chalk218.red("D"),
|
|
31525
|
+
modified: () => chalk218.yellow("M")
|
|
31261
31526
|
};
|
|
31262
31527
|
function counts(additions, deletions) {
|
|
31263
|
-
return `${
|
|
31528
|
+
return `${chalk218.green(`+${additions}`)} ${chalk218.red(`-${deletions}`)}`;
|
|
31264
31529
|
}
|
|
31265
31530
|
function formatNode(node, indent3) {
|
|
31266
31531
|
if (node.kind === "file")
|
|
31267
31532
|
return [
|
|
31268
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
31533
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk218.dim(counts(node.additions, node.deletions))}`
|
|
31269
31534
|
];
|
|
31270
31535
|
const dir = node;
|
|
31271
31536
|
return [
|
|
31272
|
-
`${indent3}${
|
|
31537
|
+
`${indent3}${chalk218.bold(`${dir.name}/`)} ${chalk218.dim(counts(dir.additions, dir.deletions))}`,
|
|
31273
31538
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
31274
31539
|
];
|
|
31275
31540
|
}
|
|
31276
31541
|
function formatHighLevelStructure(structure) {
|
|
31277
31542
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
31278
31543
|
return [
|
|
31279
|
-
|
|
31544
|
+
chalk218.bold.underline("Structure"),
|
|
31280
31545
|
` ${summary}`,
|
|
31281
31546
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
31282
31547
|
].join("\n");
|
|
@@ -31285,8 +31550,8 @@ function formatHighLevelStructure(structure) {
|
|
|
31285
31550
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31286
31551
|
function printHighLevelChecklist(subject) {
|
|
31287
31552
|
console.log(
|
|
31288
|
-
|
|
31289
|
-
|
|
31553
|
+
chalk219.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
31554
|
+
chalk219.dim(
|
|
31290
31555
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
31291
31556
|
)
|
|
31292
31557
|
);
|
|
@@ -31298,12 +31563,12 @@ function printHighLevelChecklist(subject) {
|
|
|
31298
31563
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
31299
31564
|
);
|
|
31300
31565
|
console.log(
|
|
31301
|
-
|
|
31566
|
+
chalk219.dim(
|
|
31302
31567
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
31303
31568
|
)
|
|
31304
31569
|
);
|
|
31305
31570
|
console.log(
|
|
31306
|
-
|
|
31571
|
+
chalk219.dim(
|
|
31307
31572
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
31308
31573
|
)
|
|
31309
31574
|
);
|
|
@@ -31937,18 +32202,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
31937
32202
|
}
|
|
31938
32203
|
|
|
31939
32204
|
// src/commands/review/warnOutOfDiff.ts
|
|
31940
|
-
import
|
|
32205
|
+
import chalk220 from "chalk";
|
|
31941
32206
|
function warnOutOfDiff(outOfDiff) {
|
|
31942
32207
|
if (outOfDiff.length === 0) return;
|
|
31943
32208
|
console.warn(
|
|
31944
|
-
|
|
32209
|
+
chalk220.yellow(
|
|
31945
32210
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
31946
32211
|
)
|
|
31947
32212
|
);
|
|
31948
32213
|
for (const finding of outOfDiff) {
|
|
31949
32214
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
31950
32215
|
console.warn(
|
|
31951
|
-
` ${
|
|
32216
|
+
` ${chalk220.yellow("\xB7")} ${finding.title} ${chalk220.dim(
|
|
31952
32217
|
`(${finding.file}:${range})`
|
|
31953
32218
|
)}`
|
|
31954
32219
|
);
|
|
@@ -31972,18 +32237,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
31972
32237
|
}
|
|
31973
32238
|
|
|
31974
32239
|
// src/commands/review/warnUnlocated.ts
|
|
31975
|
-
import
|
|
32240
|
+
import chalk221 from "chalk";
|
|
31976
32241
|
function warnUnlocated(unlocated) {
|
|
31977
32242
|
if (unlocated.length === 0) return;
|
|
31978
32243
|
console.warn(
|
|
31979
|
-
|
|
32244
|
+
chalk221.yellow(
|
|
31980
32245
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
31981
32246
|
)
|
|
31982
32247
|
);
|
|
31983
32248
|
for (const finding of unlocated) {
|
|
31984
|
-
const where = finding.location ||
|
|
32249
|
+
const where = finding.location || chalk221.dim("missing");
|
|
31985
32250
|
console.warn(
|
|
31986
|
-
` ${
|
|
32251
|
+
` ${chalk221.yellow("\xB7")} ${finding.title} ${chalk221.dim(`(${where})`)}`
|
|
31987
32252
|
);
|
|
31988
32253
|
}
|
|
31989
32254
|
}
|
|
@@ -33297,6 +33562,18 @@ function validateReviewOptions(options2) {
|
|
|
33297
33562
|
}
|
|
33298
33563
|
validateCheckoutOnly(options2);
|
|
33299
33564
|
validateHighLevel(options2);
|
|
33565
|
+
validateConfigure(options2);
|
|
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
|
+
}
|
|
33300
33577
|
}
|
|
33301
33578
|
function validateCheckoutOnly(options2) {
|
|
33302
33579
|
if (!options2.checkoutOnly) return;
|
|
@@ -33330,6 +33607,7 @@ function resolveRepoRoot() {
|
|
|
33330
33607
|
}
|
|
33331
33608
|
async function review(options2 = {}) {
|
|
33332
33609
|
validateReviewOptions(options2);
|
|
33610
|
+
if (options2.configure) return configureHighLevelReview();
|
|
33333
33611
|
startReviewLog();
|
|
33334
33612
|
const invokedIn = resolveRepoRoot();
|
|
33335
33613
|
if (options2.checkoutOnly && options2.number)
|
|
@@ -33343,14 +33621,23 @@ async function review(options2 = {}) {
|
|
|
33343
33621
|
return reviewPr(resolveRepoRoot(), options2);
|
|
33344
33622
|
}
|
|
33345
33623
|
|
|
33346
|
-
// src/commands/
|
|
33347
|
-
function
|
|
33348
|
-
|
|
33349
|
-
"
|
|
33350
|
-
|
|
33351
|
-
"[number]",
|
|
33352
|
-
"Optional PR number; when provided, runs `gh pr checkout <number>` before reviewing"
|
|
33624
|
+
// src/commands/review/addReviewModeOptions.ts
|
|
33625
|
+
function addReviewModeOptions(command) {
|
|
33626
|
+
return command.option(
|
|
33627
|
+
"--checkout-only",
|
|
33628
|
+
"Check the PR out and start an idle interactive Claude session in the checkout tree instead of reviewing; requires a PR number and cannot be combined with --refine, --apply, --backlog or --submit"
|
|
33353
33629
|
).option(
|
|
33630
|
+
"--high-level",
|
|
33631
|
+
"Skip the LLM review; check the PR branch out and step through the high-level review checklist in the web UI preview pane, backed by the changed-file tree and the diffs of review.highLevel.criticalPaths, writing the verdict, per-item state and comments to ~/.assist/high-level-reviews/. A review already saved for the same head SHA is reopened unless --force is passed. Nothing is posted to GitHub; cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
|
|
33632
|
+
).option(
|
|
33633
|
+
"--configure",
|
|
33634
|
+
"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"
|
|
33635
|
+
);
|
|
33636
|
+
}
|
|
33637
|
+
|
|
33638
|
+
// src/commands/review/addReviewRunOptions.ts
|
|
33639
|
+
function addReviewRunOptions(command) {
|
|
33640
|
+
return command.option(
|
|
33354
33641
|
"--no-prompt",
|
|
33355
33642
|
"Skip confirmation prompts; use flag defaults non-interactively"
|
|
33356
33643
|
).option(
|
|
@@ -33368,12 +33655,6 @@ function registerReview(program2) {
|
|
|
33368
33655
|
).option(
|
|
33369
33656
|
"--backlog",
|
|
33370
33657
|
"After synthesis, launch an interactive Claude session running /bug to file all findings as a single backlog item with one phase per finding, instead of posting to the PR"
|
|
33371
|
-
).option(
|
|
33372
|
-
"--checkout-only",
|
|
33373
|
-
"Check the PR out and start an idle interactive Claude session in the checkout tree instead of reviewing; requires a PR number and cannot be combined with --refine, --apply, --backlog or --submit"
|
|
33374
|
-
).option(
|
|
33375
|
-
"--high-level",
|
|
33376
|
-
"Skip the LLM review; check the PR branch out and step through the high-level review checklist in the web UI preview pane, backed by the changed-file tree and the diffs of review.highLevel.criticalPaths, writing the verdict, per-item state and comments to ~/.assist/high-level-reviews/. A review already saved for the same head SHA is reopened unless --force is passed. Nothing is posted to GitHub; cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
|
|
33377
33658
|
).option(
|
|
33378
33659
|
"--address-comments",
|
|
33379
33660
|
"After posting and submitting the review, start an Address Comments session (assist review-pr-comments <n>) for the PR; no-op when nothing was posted or the review was not submitted, and only inside an assist session"
|
|
@@ -33383,7 +33664,18 @@ function registerReview(program2) {
|
|
|
33383
33664
|
).option(
|
|
33384
33665
|
"--verbose",
|
|
33385
33666
|
"Disable spinner UI and use per-line log output (per-tool lines, starting/done lines)"
|
|
33386
|
-
)
|
|
33667
|
+
);
|
|
33668
|
+
}
|
|
33669
|
+
|
|
33670
|
+
// src/commands/registerReview.ts
|
|
33671
|
+
function registerReview(program2) {
|
|
33672
|
+
const reviewCommand = program2.command("review").description(
|
|
33673
|
+
"Run Claude and Codex in parallel to review the current branch's PR, or check out a PR by number first when given; --checkout-only just checks the PR out and leaves an idle Claude session in the checkout tree"
|
|
33674
|
+
).argument(
|
|
33675
|
+
"[number]",
|
|
33676
|
+
"Optional PR number; when provided, runs `gh pr checkout <number>` before reviewing"
|
|
33677
|
+
);
|
|
33678
|
+
addReviewModeOptions(addReviewRunOptions(reviewCommand)).action(
|
|
33387
33679
|
(number, options2) => review({ ...options2, number })
|
|
33388
33680
|
);
|
|
33389
33681
|
configHelp(
|
|
@@ -33396,7 +33688,7 @@ function registerReview(program2) {
|
|
|
33396
33688
|
// src/commands/rules/addRule.ts
|
|
33397
33689
|
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync42 } from "fs";
|
|
33398
33690
|
import path72 from "path";
|
|
33399
|
-
import
|
|
33691
|
+
import chalk222 from "chalk";
|
|
33400
33692
|
|
|
33401
33693
|
// src/commands/rules/insertRuleBullet.ts
|
|
33402
33694
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -33532,7 +33824,7 @@ function read2(file) {
|
|
|
33532
33824
|
function addRule(text18, options2) {
|
|
33533
33825
|
const rule = text18.trim();
|
|
33534
33826
|
if (rule === "") {
|
|
33535
|
-
console.error(
|
|
33827
|
+
console.error(chalk222.red("Rule text is required"));
|
|
33536
33828
|
process.exitCode = 1;
|
|
33537
33829
|
return;
|
|
33538
33830
|
}
|
|
@@ -33550,13 +33842,13 @@ function addRule(text18, options2) {
|
|
|
33550
33842
|
);
|
|
33551
33843
|
updateScopedRulesIndex(root);
|
|
33552
33844
|
console.log(
|
|
33553
|
-
`Added ${
|
|
33845
|
+
`Added ${chalk222.cyan(code)} to ${path72.relative(process.cwd(), target) || target}`
|
|
33554
33846
|
);
|
|
33555
33847
|
}
|
|
33556
33848
|
|
|
33557
33849
|
// src/commands/rules/indexRules.ts
|
|
33558
33850
|
import path73 from "path";
|
|
33559
|
-
import
|
|
33851
|
+
import chalk223 from "chalk";
|
|
33560
33852
|
function indexRules() {
|
|
33561
33853
|
const startDir = scopeDirectory(process.cwd());
|
|
33562
33854
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
@@ -33564,24 +33856,24 @@ function indexRules() {
|
|
|
33564
33856
|
const rootFile = path73.relative(process.cwd(), path73.join(root, "CLAUDE.md"));
|
|
33565
33857
|
if (directories.length === 0) {
|
|
33566
33858
|
console.log(
|
|
33567
|
-
|
|
33859
|
+
chalk223.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
33568
33860
|
);
|
|
33569
33861
|
return;
|
|
33570
33862
|
}
|
|
33571
33863
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
33572
33864
|
for (const directory of directories)
|
|
33573
|
-
console.log(` ${
|
|
33865
|
+
console.log(` ${chalk223.cyan(directory)}`);
|
|
33574
33866
|
}
|
|
33575
33867
|
|
|
33576
33868
|
// src/commands/rules/listRules.ts
|
|
33577
33869
|
import path74 from "path";
|
|
33578
|
-
import
|
|
33870
|
+
import chalk224 from "chalk";
|
|
33579
33871
|
function listRules(target, options2 = {}) {
|
|
33580
33872
|
const resolved = path74.resolve(target ?? process.cwd());
|
|
33581
33873
|
const rules3 = readScopedRules(resolved);
|
|
33582
33874
|
if (rules3.length === 0) {
|
|
33583
33875
|
const label2 = path74.relative(process.cwd(), resolved) || ".";
|
|
33584
|
-
console.log(
|
|
33876
|
+
console.log(chalk224.gray(`No rules in scope for ${label2}`));
|
|
33585
33877
|
return;
|
|
33586
33878
|
}
|
|
33587
33879
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -33591,14 +33883,14 @@ function listRules(target, options2 = {}) {
|
|
|
33591
33883
|
if (rule.source !== shown) {
|
|
33592
33884
|
shown = rule.source;
|
|
33593
33885
|
console.log(
|
|
33594
|
-
|
|
33886
|
+
chalk224.dim(base ? path74.relative(base, rule.source) : rule.source)
|
|
33595
33887
|
);
|
|
33596
33888
|
}
|
|
33597
33889
|
console.log(
|
|
33598
|
-
` ${
|
|
33890
|
+
` ${chalk224.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
33599
33891
|
);
|
|
33600
33892
|
if (options2.full && rule.title)
|
|
33601
|
-
console.log(` ${" ".repeat(width)} ${
|
|
33893
|
+
console.log(` ${" ".repeat(width)} ${chalk224.dim(rule.text)}`);
|
|
33602
33894
|
}
|
|
33603
33895
|
}
|
|
33604
33896
|
|
|
@@ -33627,7 +33919,7 @@ function registerRules(program2) {
|
|
|
33627
33919
|
}
|
|
33628
33920
|
|
|
33629
33921
|
// src/commands/seq/seqAuth.ts
|
|
33630
|
-
import
|
|
33922
|
+
import chalk226 from "chalk";
|
|
33631
33923
|
|
|
33632
33924
|
// src/commands/seq/loadConnections.ts
|
|
33633
33925
|
function loadConnections2() {
|
|
@@ -33656,10 +33948,10 @@ function setDefaultConnection(name) {
|
|
|
33656
33948
|
}
|
|
33657
33949
|
|
|
33658
33950
|
// src/shared/assertUniqueName.ts
|
|
33659
|
-
import
|
|
33951
|
+
import chalk225 from "chalk";
|
|
33660
33952
|
function assertUniqueName(existingNames, name) {
|
|
33661
33953
|
if (existingNames.includes(name)) {
|
|
33662
|
-
console.error(
|
|
33954
|
+
console.error(chalk225.red(`Connection "${name}" already exists.`));
|
|
33663
33955
|
process.exit(1);
|
|
33664
33956
|
}
|
|
33665
33957
|
}
|
|
@@ -33677,16 +33969,16 @@ async function promptConnection2(existingNames) {
|
|
|
33677
33969
|
var seqAuth = createConnectionAuth({
|
|
33678
33970
|
load: loadConnections2,
|
|
33679
33971
|
save: saveConnections2,
|
|
33680
|
-
format: (c) => `${
|
|
33972
|
+
format: (c) => `${chalk226.bold(c.name)} ${c.url}`,
|
|
33681
33973
|
promptNew: promptConnection2,
|
|
33682
33974
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
33683
33975
|
});
|
|
33684
33976
|
|
|
33685
33977
|
// src/commands/seq/seqQuery.ts
|
|
33686
|
-
import
|
|
33978
|
+
import chalk230 from "chalk";
|
|
33687
33979
|
|
|
33688
33980
|
// src/commands/seq/fetchSeq.ts
|
|
33689
|
-
import
|
|
33981
|
+
import chalk227 from "chalk";
|
|
33690
33982
|
async function fetchSeq(conn, path91, params) {
|
|
33691
33983
|
const url = `${conn.url}${path91}?${params}`;
|
|
33692
33984
|
const response = await fetch(url, {
|
|
@@ -33697,7 +33989,7 @@ async function fetchSeq(conn, path91, params) {
|
|
|
33697
33989
|
});
|
|
33698
33990
|
if (!response.ok) {
|
|
33699
33991
|
const body = await response.text();
|
|
33700
|
-
console.error(
|
|
33992
|
+
console.error(chalk227.red(`Seq returned ${response.status}: ${body}`));
|
|
33701
33993
|
process.exit(1);
|
|
33702
33994
|
}
|
|
33703
33995
|
return response;
|
|
@@ -33756,23 +34048,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
33756
34048
|
}
|
|
33757
34049
|
|
|
33758
34050
|
// src/commands/seq/formatEvent.ts
|
|
33759
|
-
import
|
|
34051
|
+
import chalk228 from "chalk";
|
|
33760
34052
|
function levelColor(level) {
|
|
33761
34053
|
switch (level) {
|
|
33762
34054
|
case "Fatal":
|
|
33763
|
-
return
|
|
34055
|
+
return chalk228.bgRed.white;
|
|
33764
34056
|
case "Error":
|
|
33765
|
-
return
|
|
34057
|
+
return chalk228.red;
|
|
33766
34058
|
case "Warning":
|
|
33767
|
-
return
|
|
34059
|
+
return chalk228.yellow;
|
|
33768
34060
|
case "Information":
|
|
33769
|
-
return
|
|
34061
|
+
return chalk228.cyan;
|
|
33770
34062
|
case "Debug":
|
|
33771
|
-
return
|
|
34063
|
+
return chalk228.gray;
|
|
33772
34064
|
case "Verbose":
|
|
33773
|
-
return
|
|
34065
|
+
return chalk228.dim;
|
|
33774
34066
|
default:
|
|
33775
|
-
return
|
|
34067
|
+
return chalk228.white;
|
|
33776
34068
|
}
|
|
33777
34069
|
}
|
|
33778
34070
|
function levelAbbrev(level) {
|
|
@@ -33813,12 +34105,12 @@ function formatTimestamp(iso) {
|
|
|
33813
34105
|
function formatEvent(event) {
|
|
33814
34106
|
const color = levelColor(event.Level);
|
|
33815
34107
|
const abbrev = levelAbbrev(event.Level);
|
|
33816
|
-
const ts8 =
|
|
34108
|
+
const ts8 = chalk228.dim(formatTimestamp(event.Timestamp));
|
|
33817
34109
|
const msg = renderMessage(event);
|
|
33818
34110
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
33819
34111
|
if (event.Exception) {
|
|
33820
34112
|
for (const line of event.Exception.split("\n")) {
|
|
33821
|
-
lines2.push(
|
|
34113
|
+
lines2.push(chalk228.red(` ${line}`));
|
|
33822
34114
|
}
|
|
33823
34115
|
}
|
|
33824
34116
|
return lines2.join("\n");
|
|
@@ -33851,11 +34143,11 @@ function rejectTimestampFilter(filter) {
|
|
|
33851
34143
|
}
|
|
33852
34144
|
|
|
33853
34145
|
// src/shared/resolveNamedConnection.ts
|
|
33854
|
-
import
|
|
34146
|
+
import chalk229 from "chalk";
|
|
33855
34147
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
33856
34148
|
if (connections.length === 0) {
|
|
33857
34149
|
console.error(
|
|
33858
|
-
|
|
34150
|
+
chalk229.red(
|
|
33859
34151
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
33860
34152
|
)
|
|
33861
34153
|
);
|
|
@@ -33864,7 +34156,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
33864
34156
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
33865
34157
|
const connection = connections.find((c) => c.name === target);
|
|
33866
34158
|
if (!connection) {
|
|
33867
|
-
console.error(
|
|
34159
|
+
console.error(chalk229.red(`${kind} connection "${target}" not found.`));
|
|
33868
34160
|
process.exit(1);
|
|
33869
34161
|
}
|
|
33870
34162
|
return connection;
|
|
@@ -33893,7 +34185,7 @@ async function seqQuery(filter, options2) {
|
|
|
33893
34185
|
new URLSearchParams({ filter, count: String(count8) })
|
|
33894
34186
|
);
|
|
33895
34187
|
if (events.length === 0) {
|
|
33896
|
-
console.log(
|
|
34188
|
+
console.log(chalk230.yellow("No events found."));
|
|
33897
34189
|
return;
|
|
33898
34190
|
}
|
|
33899
34191
|
if (options2.json) {
|
|
@@ -33904,11 +34196,11 @@ async function seqQuery(filter, options2) {
|
|
|
33904
34196
|
for (const event of chronological) {
|
|
33905
34197
|
console.log(formatEvent(event));
|
|
33906
34198
|
}
|
|
33907
|
-
console.log(
|
|
34199
|
+
console.log(chalk230.dim(`
|
|
33908
34200
|
${events.length} events`));
|
|
33909
34201
|
if (events.length >= count8) {
|
|
33910
34202
|
console.log(
|
|
33911
|
-
|
|
34203
|
+
chalk230.yellow(
|
|
33912
34204
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
33913
34205
|
)
|
|
33914
34206
|
);
|
|
@@ -33916,10 +34208,10 @@ ${events.length} events`));
|
|
|
33916
34208
|
}
|
|
33917
34209
|
|
|
33918
34210
|
// src/shared/setNamedDefaultConnection.ts
|
|
33919
|
-
import
|
|
34211
|
+
import chalk231 from "chalk";
|
|
33920
34212
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
33921
34213
|
if (!connections.find((c) => c.name === name)) {
|
|
33922
|
-
console.error(
|
|
34214
|
+
console.error(chalk231.red(`Connection "${name}" not found.`));
|
|
33923
34215
|
process.exit(1);
|
|
33924
34216
|
}
|
|
33925
34217
|
setDefault(name);
|
|
@@ -34140,7 +34432,7 @@ function registerSlack(program2) {
|
|
|
34140
34432
|
}
|
|
34141
34433
|
|
|
34142
34434
|
// src/commands/sql/sqlAuth.ts
|
|
34143
|
-
import
|
|
34435
|
+
import chalk233 from "chalk";
|
|
34144
34436
|
|
|
34145
34437
|
// src/commands/sql/loadConnections.ts
|
|
34146
34438
|
function loadConnections3() {
|
|
@@ -34169,7 +34461,7 @@ function setDefaultConnection2(name) {
|
|
|
34169
34461
|
}
|
|
34170
34462
|
|
|
34171
34463
|
// src/commands/sql/promptConnection.ts
|
|
34172
|
-
import
|
|
34464
|
+
import chalk232 from "chalk";
|
|
34173
34465
|
async function promptConnection3(existingNames) {
|
|
34174
34466
|
const name = await promptInput("name", "Connection name:", "default");
|
|
34175
34467
|
assertUniqueName(existingNames, name);
|
|
@@ -34177,7 +34469,7 @@ async function promptConnection3(existingNames) {
|
|
|
34177
34469
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
34178
34470
|
const port = Number.parseInt(portStr, 10);
|
|
34179
34471
|
if (!Number.isFinite(port)) {
|
|
34180
|
-
console.error(
|
|
34472
|
+
console.error(chalk232.red(`Invalid port "${portStr}".`));
|
|
34181
34473
|
process.exit(1);
|
|
34182
34474
|
}
|
|
34183
34475
|
const user = await promptInput("user", "User:");
|
|
@@ -34190,13 +34482,13 @@ async function promptConnection3(existingNames) {
|
|
|
34190
34482
|
var sqlAuth = createConnectionAuth({
|
|
34191
34483
|
load: loadConnections3,
|
|
34192
34484
|
save: saveConnections3,
|
|
34193
|
-
format: (c) => `${
|
|
34485
|
+
format: (c) => `${chalk233.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
34194
34486
|
promptNew: promptConnection3,
|
|
34195
34487
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
34196
34488
|
});
|
|
34197
34489
|
|
|
34198
34490
|
// src/commands/sql/printTable.ts
|
|
34199
|
-
import
|
|
34491
|
+
import chalk234 from "chalk";
|
|
34200
34492
|
function formatCell(value) {
|
|
34201
34493
|
if (value === null || value === void 0) return "";
|
|
34202
34494
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -34205,7 +34497,7 @@ function formatCell(value) {
|
|
|
34205
34497
|
}
|
|
34206
34498
|
function printTable(rows) {
|
|
34207
34499
|
if (rows.length === 0) {
|
|
34208
|
-
console.log(
|
|
34500
|
+
console.log(chalk234.yellow("(no rows)"));
|
|
34209
34501
|
return;
|
|
34210
34502
|
}
|
|
34211
34503
|
const columns = Object.keys(rows[0]);
|
|
@@ -34213,13 +34505,13 @@ function printTable(rows) {
|
|
|
34213
34505
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
34214
34506
|
);
|
|
34215
34507
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
34216
|
-
console.log(
|
|
34217
|
-
console.log(
|
|
34508
|
+
console.log(chalk234.dim(header));
|
|
34509
|
+
console.log(chalk234.dim("-".repeat(header.length)));
|
|
34218
34510
|
for (const row of rows) {
|
|
34219
34511
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
34220
34512
|
console.log(line);
|
|
34221
34513
|
}
|
|
34222
|
-
console.log(
|
|
34514
|
+
console.log(chalk234.dim(`
|
|
34223
34515
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
34224
34516
|
}
|
|
34225
34517
|
|
|
@@ -34279,7 +34571,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
34279
34571
|
}
|
|
34280
34572
|
|
|
34281
34573
|
// src/commands/sql/sqlMutate.ts
|
|
34282
|
-
import
|
|
34574
|
+
import chalk235 from "chalk";
|
|
34283
34575
|
|
|
34284
34576
|
// src/commands/sql/isMutation.ts
|
|
34285
34577
|
var MUTATION_KEYWORDS = [
|
|
@@ -34313,7 +34605,7 @@ function isMutation(sql29) {
|
|
|
34313
34605
|
async function sqlMutate(query, connectionName) {
|
|
34314
34606
|
if (!isMutation(query)) {
|
|
34315
34607
|
console.error(
|
|
34316
|
-
|
|
34608
|
+
chalk235.red(
|
|
34317
34609
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
34318
34610
|
)
|
|
34319
34611
|
);
|
|
@@ -34323,18 +34615,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
34323
34615
|
const pool = await sqlConnect(conn);
|
|
34324
34616
|
try {
|
|
34325
34617
|
const result = await pool.request().query(query);
|
|
34326
|
-
console.log(
|
|
34618
|
+
console.log(chalk235.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
34327
34619
|
} finally {
|
|
34328
34620
|
await pool.close();
|
|
34329
34621
|
}
|
|
34330
34622
|
}
|
|
34331
34623
|
|
|
34332
34624
|
// src/commands/sql/sqlQuery.ts
|
|
34333
|
-
import
|
|
34625
|
+
import chalk236 from "chalk";
|
|
34334
34626
|
async function sqlQuery(query, connectionName) {
|
|
34335
34627
|
if (isMutation(query)) {
|
|
34336
34628
|
console.error(
|
|
34337
|
-
|
|
34629
|
+
chalk236.red(
|
|
34338
34630
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
34339
34631
|
)
|
|
34340
34632
|
);
|
|
@@ -34349,7 +34641,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
34349
34641
|
printTable(rows);
|
|
34350
34642
|
} else {
|
|
34351
34643
|
console.log(
|
|
34352
|
-
|
|
34644
|
+
chalk236.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
34353
34645
|
);
|
|
34354
34646
|
}
|
|
34355
34647
|
} finally {
|
|
@@ -34723,7 +35015,7 @@ function syncPi(claudeDir, options2) {
|
|
|
34723
35015
|
// src/commands/sync/syncSettings.ts
|
|
34724
35016
|
import * as fs48 from "fs";
|
|
34725
35017
|
import * as path84 from "path";
|
|
34726
|
-
import
|
|
35018
|
+
import chalk237 from "chalk";
|
|
34727
35019
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
34728
35020
|
const source = path84.join(claudeDir, "settings.json");
|
|
34729
35021
|
const target = path84.join(targetBase, "settings.json");
|
|
@@ -34742,7 +35034,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
34742
35034
|
if (mergedContent !== normalizedTarget) {
|
|
34743
35035
|
if (!options2?.yes) {
|
|
34744
35036
|
console.log(
|
|
34745
|
-
|
|
35037
|
+
chalk237.yellow(
|
|
34746
35038
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
34747
35039
|
)
|
|
34748
35040
|
);
|
|
@@ -34750,7 +35042,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
34750
35042
|
printDiff(targetContent, mergedContent);
|
|
34751
35043
|
printAutoConfirmHint();
|
|
34752
35044
|
const confirm = await promptConfirm(
|
|
34753
|
-
|
|
35045
|
+
chalk237.red("Overwrite existing settings.json?"),
|
|
34754
35046
|
false
|
|
34755
35047
|
);
|
|
34756
35048
|
if (!confirm) {
|
|
@@ -35554,9 +35846,9 @@ import { join as join92 } from "path";
|
|
|
35554
35846
|
|
|
35555
35847
|
// src/commands/voice/shared.ts
|
|
35556
35848
|
import { homedir as homedir25 } from "os";
|
|
35557
|
-
import { dirname as
|
|
35849
|
+
import { dirname as dirname39, join as join91 } from "path";
|
|
35558
35850
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
35559
|
-
var __dirname6 =
|
|
35851
|
+
var __dirname6 = dirname39(fileURLToPath10(import.meta.url));
|
|
35560
35852
|
var VOICE_DIR = join91(homedir25(), ".assist", "voice");
|
|
35561
35853
|
var voicePaths = {
|
|
35562
35854
|
dir: VOICE_DIR,
|
|
@@ -35812,9 +36104,9 @@ function registerVoice(program2) {
|
|
|
35812
36104
|
}
|
|
35813
36105
|
|
|
35814
36106
|
// src/commands/watch/resolveUpstream.ts
|
|
35815
|
-
import { execFileSync as
|
|
36107
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
35816
36108
|
function runGit3(args, cwd) {
|
|
35817
|
-
return
|
|
36109
|
+
return execFileSync20("git", args, {
|
|
35818
36110
|
encoding: "utf8",
|
|
35819
36111
|
stdio: ["pipe", "pipe", "pipe"],
|
|
35820
36112
|
cwd
|
|
@@ -36216,14 +36508,14 @@ import { spawn as spawn9 } from "child_process";
|
|
|
36216
36508
|
import { existsSync as existsSync84 } from "fs";
|
|
36217
36509
|
|
|
36218
36510
|
// src/commands/run/resolveCommand.ts
|
|
36219
|
-
import { execFileSync as
|
|
36511
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
36220
36512
|
import { existsSync as existsSync83 } from "fs";
|
|
36221
|
-
import { dirname as
|
|
36513
|
+
import { dirname as dirname40, join as join97, resolve as resolve20 } from "path";
|
|
36222
36514
|
function resolveCommand2(command) {
|
|
36223
36515
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
36224
36516
|
try {
|
|
36225
|
-
const gitPath =
|
|
36226
|
-
const gitRoot = resolve20(
|
|
36517
|
+
const gitPath = execFileSync21("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
36518
|
+
const gitRoot = resolve20(dirname40(gitPath), "..");
|
|
36227
36519
|
const gitBash = join97(gitRoot, "bin", "bash.exe");
|
|
36228
36520
|
if (existsSync83(gitBash)) return gitBash;
|
|
36229
36521
|
} catch {
|
|
@@ -36344,11 +36636,11 @@ async function reportSyncOrExit() {
|
|
|
36344
36636
|
}
|
|
36345
36637
|
|
|
36346
36638
|
// src/commands/watch/fetchQuietly.ts
|
|
36347
|
-
import { execFileSync as
|
|
36639
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
36348
36640
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
36349
36641
|
function fetchQuietly(cwd, intervalMs) {
|
|
36350
36642
|
try {
|
|
36351
|
-
|
|
36643
|
+
execFileSync22("git", ["fetch", "--quiet"], {
|
|
36352
36644
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36353
36645
|
cwd,
|
|
36354
36646
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -36492,7 +36784,7 @@ function registerWatch(program2) {
|
|
|
36492
36784
|
|
|
36493
36785
|
// src/commands/roam/auth.ts
|
|
36494
36786
|
import { randomBytes } from "crypto";
|
|
36495
|
-
import
|
|
36787
|
+
import chalk238 from "chalk";
|
|
36496
36788
|
|
|
36497
36789
|
// src/commands/roam/waitForCallback.ts
|
|
36498
36790
|
import { createServer as createServer3 } from "http";
|
|
@@ -36623,13 +36915,13 @@ async function auth() {
|
|
|
36623
36915
|
saveGlobalConfig(config);
|
|
36624
36916
|
const state = randomBytes(16).toString("hex");
|
|
36625
36917
|
console.log(
|
|
36626
|
-
|
|
36918
|
+
chalk238.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
36627
36919
|
);
|
|
36628
|
-
console.log(
|
|
36629
|
-
console.log(
|
|
36630
|
-
console.log(
|
|
36920
|
+
console.log(chalk238.white("http://localhost:14523/callback\n"));
|
|
36921
|
+
console.log(chalk238.blue("Opening browser for authorization..."));
|
|
36922
|
+
console.log(chalk238.dim("Waiting for authorization callback..."));
|
|
36631
36923
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
36632
|
-
console.log(
|
|
36924
|
+
console.log(chalk238.dim("Exchanging code for tokens..."));
|
|
36633
36925
|
const tokens = await exchangeToken({
|
|
36634
36926
|
code,
|
|
36635
36927
|
clientId,
|
|
@@ -36645,12 +36937,12 @@ async function auth() {
|
|
|
36645
36937
|
};
|
|
36646
36938
|
saveGlobalConfig(config);
|
|
36647
36939
|
console.log(
|
|
36648
|
-
|
|
36940
|
+
chalk238.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
36649
36941
|
);
|
|
36650
36942
|
}
|
|
36651
36943
|
|
|
36652
36944
|
// src/commands/roam/postRoamActivity.ts
|
|
36653
|
-
import { execFileSync as
|
|
36945
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
36654
36946
|
import { readdirSync as readdirSync22, readFileSync as readFileSync63, statSync as statSync12 } from "fs";
|
|
36655
36947
|
import { join as join98 } from "path";
|
|
36656
36948
|
function findPortFile(roamDir) {
|
|
@@ -36689,7 +36981,7 @@ function postRoamActivity(app, event) {
|
|
|
36689
36981
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
36690
36982
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
36691
36983
|
try {
|
|
36692
|
-
|
|
36984
|
+
execFileSync23("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
36693
36985
|
stdio: "ignore"
|
|
36694
36986
|
});
|
|
36695
36987
|
} catch {
|
|
@@ -37004,7 +37296,7 @@ import { execSync as execSync66 } from "child_process";
|
|
|
37004
37296
|
import { existsSync as existsSync86, mkdirSync as mkdirSync36, unlinkSync as unlinkSync22, writeFileSync as writeFileSync53 } from "fs";
|
|
37005
37297
|
import { tmpdir as tmpdir9 } from "os";
|
|
37006
37298
|
import { join as join101, resolve as resolve21 } from "path";
|
|
37007
|
-
import
|
|
37299
|
+
import chalk239 from "chalk";
|
|
37008
37300
|
|
|
37009
37301
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
37010
37302
|
var captureWindowPs1 = `
|
|
@@ -37155,23 +37447,23 @@ function screenshot(processName) {
|
|
|
37155
37447
|
const config = loadConfig();
|
|
37156
37448
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
37157
37449
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
37158
|
-
console.log(
|
|
37450
|
+
console.log(chalk239.gray(`Capturing window for process "${processName}" ...`));
|
|
37159
37451
|
try {
|
|
37160
37452
|
runPowerShellScript(processName, outputPath);
|
|
37161
|
-
console.log(
|
|
37453
|
+
console.log(chalk239.green(`Screenshot saved: ${outputPath}`));
|
|
37162
37454
|
} catch (error) {
|
|
37163
37455
|
const msg = error instanceof Error ? error.message : String(error);
|
|
37164
|
-
console.error(
|
|
37456
|
+
console.error(chalk239.red(`Failed to capture screenshot: ${msg}`));
|
|
37165
37457
|
process.exit(1);
|
|
37166
37458
|
}
|
|
37167
37459
|
}
|
|
37168
37460
|
|
|
37169
37461
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
37170
|
-
import { execFileSync as
|
|
37462
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
37171
37463
|
function listDaemonPids() {
|
|
37172
37464
|
if (process.platform === "win32") return [];
|
|
37173
37465
|
try {
|
|
37174
|
-
const out =
|
|
37466
|
+
const out = execFileSync24("ps", ["-eo", "pid=,args="], {
|
|
37175
37467
|
encoding: "utf8"
|
|
37176
37468
|
});
|
|
37177
37469
|
return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
|
|
@@ -38734,7 +39026,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
38734
39026
|
|
|
38735
39027
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
38736
39028
|
import { existsSync as existsSync94, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
38737
|
-
import { dirname as
|
|
39029
|
+
import { dirname as dirname42 } from "path";
|
|
38738
39030
|
|
|
38739
39031
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
38740
39032
|
function applyActivityToSession(session, activity2) {
|
|
@@ -38796,7 +39088,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
38796
39088
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
38797
39089
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
38798
39090
|
const path91 = activityPath(session.id);
|
|
38799
|
-
const dir =
|
|
39091
|
+
const dir = dirname42(path91);
|
|
38800
39092
|
try {
|
|
38801
39093
|
mkdirSync37(dir, { recursive: true });
|
|
38802
39094
|
} catch {
|
|
@@ -42909,7 +43201,7 @@ function cleanupOwnedFiles() {
|
|
|
42909
43201
|
import * as net3 from "net";
|
|
42910
43202
|
|
|
42911
43203
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
42912
|
-
import { execFileSync as
|
|
43204
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
42913
43205
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
42914
43206
|
function findPortHolderPid(port) {
|
|
42915
43207
|
try {
|
|
@@ -42919,7 +43211,7 @@ function findPortHolderPid(port) {
|
|
|
42919
43211
|
}
|
|
42920
43212
|
}
|
|
42921
43213
|
function probe(command, args) {
|
|
42922
|
-
return
|
|
43214
|
+
return execFileSync25(command, args, {
|
|
42923
43215
|
encoding: "utf8",
|
|
42924
43216
|
timeout: PROBE_TIMEOUT_MS,
|
|
42925
43217
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -43142,7 +43434,7 @@ async function renameSession(title) {
|
|
|
43142
43434
|
|
|
43143
43435
|
// src/commands/sessions/summarise/index.ts
|
|
43144
43436
|
import * as fs57 from "fs";
|
|
43145
|
-
import
|
|
43437
|
+
import chalk240 from "chalk";
|
|
43146
43438
|
|
|
43147
43439
|
// src/commands/sessions/summarise/shared.ts
|
|
43148
43440
|
import * as fs56 from "fs";
|
|
@@ -43158,7 +43450,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
43158
43450
|
}
|
|
43159
43451
|
|
|
43160
43452
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
43161
|
-
import { execFileSync as
|
|
43453
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
43162
43454
|
function summariseSession(jsonlPath2) {
|
|
43163
43455
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
43164
43456
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -43167,7 +43459,7 @@ function summariseSession(jsonlPath2) {
|
|
|
43167
43459
|
}
|
|
43168
43460
|
const prompt = buildPrompt6(firstMessage, backlogIds);
|
|
43169
43461
|
try {
|
|
43170
|
-
const output =
|
|
43462
|
+
const output = execFileSync26("claude", ["-p", "--model", "haiku", prompt], {
|
|
43171
43463
|
encoding: "utf8",
|
|
43172
43464
|
timeout: 3e4,
|
|
43173
43465
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -43201,22 +43493,22 @@ ${firstMessage}`);
|
|
|
43201
43493
|
async function summarise2(options2) {
|
|
43202
43494
|
const files = await discoverSessionFiles();
|
|
43203
43495
|
if (files.length === 0) {
|
|
43204
|
-
console.log(
|
|
43496
|
+
console.log(chalk240.yellow("No sessions found."));
|
|
43205
43497
|
return;
|
|
43206
43498
|
}
|
|
43207
43499
|
const toProcess = selectCandidates(files, options2);
|
|
43208
43500
|
if (toProcess.length === 0) {
|
|
43209
|
-
console.log(
|
|
43501
|
+
console.log(chalk240.green("All sessions already summarised."));
|
|
43210
43502
|
return;
|
|
43211
43503
|
}
|
|
43212
43504
|
console.log(
|
|
43213
|
-
|
|
43505
|
+
chalk240.cyan(
|
|
43214
43506
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
43215
43507
|
)
|
|
43216
43508
|
);
|
|
43217
43509
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
43218
43510
|
console.log(
|
|
43219
|
-
|
|
43511
|
+
chalk240.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk240.yellow(`, ${failed2} skipped`) : "")
|
|
43220
43512
|
);
|
|
43221
43513
|
}
|
|
43222
43514
|
function selectCandidates(files, options2) {
|
|
@@ -43236,16 +43528,16 @@ function processSessions(files) {
|
|
|
43236
43528
|
let failed2 = 0;
|
|
43237
43529
|
for (let i = 0; i < files.length; i++) {
|
|
43238
43530
|
const file = files[i];
|
|
43239
|
-
process.stdout.write(
|
|
43531
|
+
process.stdout.write(chalk240.dim(` [${i + 1}/${files.length}] `));
|
|
43240
43532
|
const summary = summariseSession(file);
|
|
43241
43533
|
if (summary) {
|
|
43242
43534
|
writeSummary(file, summary);
|
|
43243
43535
|
succeeded++;
|
|
43244
|
-
process.stdout.write(`${
|
|
43536
|
+
process.stdout.write(`${chalk240.green("\u2713")} ${summary}
|
|
43245
43537
|
`);
|
|
43246
43538
|
} else {
|
|
43247
43539
|
failed2++;
|
|
43248
|
-
process.stdout.write(` ${
|
|
43540
|
+
process.stdout.write(` ${chalk240.yellow("skip")}
|
|
43249
43541
|
`);
|
|
43250
43542
|
}
|
|
43251
43543
|
}
|
|
@@ -43272,7 +43564,7 @@ function registerSessions(program2) {
|
|
|
43272
43564
|
}
|
|
43273
43565
|
|
|
43274
43566
|
// src/commands/statusLine.ts
|
|
43275
|
-
import
|
|
43567
|
+
import chalk242 from "chalk";
|
|
43276
43568
|
|
|
43277
43569
|
// src/shared/contextLevel.ts
|
|
43278
43570
|
function contextLevel(pct) {
|
|
@@ -43282,7 +43574,7 @@ function contextLevel(pct) {
|
|
|
43282
43574
|
}
|
|
43283
43575
|
|
|
43284
43576
|
// src/commands/buildLimitsSegment.ts
|
|
43285
|
-
import
|
|
43577
|
+
import chalk241 from "chalk";
|
|
43286
43578
|
|
|
43287
43579
|
// src/shared/rateLimitLevel.ts
|
|
43288
43580
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -43320,9 +43612,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
43320
43612
|
|
|
43321
43613
|
// src/commands/buildLimitsSegment.ts
|
|
43322
43614
|
var LEVEL_COLOR = {
|
|
43323
|
-
ok:
|
|
43324
|
-
warn:
|
|
43325
|
-
over:
|
|
43615
|
+
ok: chalk241.green,
|
|
43616
|
+
warn: chalk241.yellow,
|
|
43617
|
+
over: chalk241.red
|
|
43326
43618
|
};
|
|
43327
43619
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
43328
43620
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -43418,7 +43710,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
43418
43710
|
}
|
|
43419
43711
|
|
|
43420
43712
|
// src/commands/statusLine.ts
|
|
43421
|
-
|
|
43713
|
+
chalk242.level = 3;
|
|
43422
43714
|
function formatNumber(num) {
|
|
43423
43715
|
return num.toLocaleString("en-US");
|
|
43424
43716
|
}
|
|
@@ -43426,9 +43718,9 @@ function colorizePercent(pct) {
|
|
|
43426
43718
|
const label2 = `${Math.round(pct)}%`;
|
|
43427
43719
|
switch (contextLevel(pct)) {
|
|
43428
43720
|
case "red":
|
|
43429
|
-
return
|
|
43721
|
+
return chalk242.red(label2);
|
|
43430
43722
|
case "yellow":
|
|
43431
|
-
return
|
|
43723
|
+
return chalk242.yellow(label2);
|
|
43432
43724
|
default:
|
|
43433
43725
|
return label2;
|
|
43434
43726
|
}
|
|
@@ -43441,7 +43733,7 @@ async function statusLine() {
|
|
|
43441
43733
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
43442
43734
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
43443
43735
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
43444
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
43736
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk242.cyan(branch2)} | ` : "";
|
|
43445
43737
|
console.log(
|
|
43446
43738
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
43447
43739
|
);
|
|
@@ -43511,10 +43803,10 @@ async function update2() {
|
|
|
43511
43803
|
}
|
|
43512
43804
|
|
|
43513
43805
|
// src/reportCliError.ts
|
|
43514
|
-
import
|
|
43806
|
+
import chalk243 from "chalk";
|
|
43515
43807
|
function reportCliError(error) {
|
|
43516
43808
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
43517
|
-
console.error(
|
|
43809
|
+
console.error(chalk243.red(error.message));
|
|
43518
43810
|
} else {
|
|
43519
43811
|
console.error(error);
|
|
43520
43812
|
}
|