@staff0rd/assist 0.680.1 → 0.682.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 +4 -0
- package/claude/commands/high-level-config.md +48 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +539 -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.682.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -30619,19 +30619,340 @@ 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 chalk215 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/highLevelConfigKeys.ts
|
|
30727
|
+
var highLevelConfigKeys = {
|
|
30728
|
+
criticalPaths: "review.highLevel.criticalPaths",
|
|
30729
|
+
uiPaths: "review.highLevel.uiPaths",
|
|
30730
|
+
descriptionWordCap: "review.highLevel.descriptionWordCap"
|
|
30731
|
+
};
|
|
30732
|
+
|
|
30733
|
+
// src/commands/review/highLevel/buildHighLevelQuestions.ts
|
|
30734
|
+
function buildHighLevelQuestions(current, proposed) {
|
|
30735
|
+
return [
|
|
30736
|
+
{
|
|
30737
|
+
key: highLevelConfigKeys.criticalPaths,
|
|
30738
|
+
question: "Critical paths \u2014 comma-separated globs whose full diffs the review shows (blank to leave unset)",
|
|
30739
|
+
suggest: suggestGlobs(current.criticalPaths, proposed.criticalPaths)
|
|
30740
|
+
},
|
|
30741
|
+
{
|
|
30742
|
+
key: highLevelConfigKeys.uiPaths,
|
|
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)",
|
|
30744
|
+
suggest: suggestGlobs(current.uiPaths, proposed.uiPaths)
|
|
30745
|
+
},
|
|
30746
|
+
{
|
|
30747
|
+
key: highLevelConfigKeys.descriptionWordCap,
|
|
30748
|
+
question: "Description word cap (blank to leave unset)",
|
|
30749
|
+
suggest: String(current.descriptionWordCap)
|
|
30750
|
+
}
|
|
30751
|
+
];
|
|
30752
|
+
}
|
|
30753
|
+
function suggestGlobs(current, proposed) {
|
|
30754
|
+
const globs = current.length > 0 ? current : proposed;
|
|
30755
|
+
return globs.length > 0 ? globs.join(",") : void 0;
|
|
30756
|
+
}
|
|
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
|
+
|
|
30781
|
+
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
30782
|
+
import { execFileSync as execFileSync19 } from "child_process";
|
|
30783
|
+
import chalk214 from "chalk";
|
|
30784
|
+
|
|
30785
|
+
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
30786
|
+
function buildGlobProposalPrompt(tree) {
|
|
30787
|
+
return [
|
|
30788
|
+
"You are proposing configuration for a high-level PR review checklist in a repository.",
|
|
30789
|
+
"",
|
|
30790
|
+
"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.",
|
|
30791
|
+
"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.",
|
|
30792
|
+
"",
|
|
30793
|
+
"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.",
|
|
30794
|
+
"",
|
|
30795
|
+
tree,
|
|
30796
|
+
"",
|
|
30797
|
+
'Reply with JSON only, no prose and no code fence: {"criticalPaths": ["..."], "uiPaths": ["..."]}. Use an empty array where nothing fits. At most 8 globs each.'
|
|
30798
|
+
].join("\n");
|
|
30799
|
+
}
|
|
30800
|
+
|
|
30801
|
+
// src/commands/review/highLevel/parseProposedGlobs.ts
|
|
30802
|
+
var MAX_GLOBS = 8;
|
|
30803
|
+
function parseProposedGlobs(output) {
|
|
30804
|
+
const parsed = parseJsonObject(output);
|
|
30805
|
+
return {
|
|
30806
|
+
criticalPaths: readGlobs(parsed?.criticalPaths),
|
|
30807
|
+
uiPaths: readGlobs(parsed?.uiPaths)
|
|
30808
|
+
};
|
|
30809
|
+
}
|
|
30810
|
+
function parseJsonObject(output) {
|
|
30811
|
+
const start3 = output.indexOf("{");
|
|
30812
|
+
const end = output.lastIndexOf("}");
|
|
30813
|
+
if (start3 === -1 || end <= start3) return void 0;
|
|
30814
|
+
try {
|
|
30815
|
+
const parsed = JSON.parse(output.slice(start3, end + 1));
|
|
30816
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
|
|
30817
|
+
return void 0;
|
|
30818
|
+
return parsed;
|
|
30819
|
+
} catch {
|
|
30820
|
+
return void 0;
|
|
30821
|
+
}
|
|
30822
|
+
}
|
|
30823
|
+
function readGlobs(value) {
|
|
30824
|
+
if (!Array.isArray(value)) return [];
|
|
30825
|
+
const globs = value.filter((item) => typeof item === "string").map((item) => item.trim()).filter((item) => item !== "");
|
|
30826
|
+
return [...new Set(globs)].slice(0, MAX_GLOBS);
|
|
30827
|
+
}
|
|
30828
|
+
|
|
30829
|
+
// src/commands/review/highLevel/summariseRepoTree.ts
|
|
30830
|
+
import { execFileSync as execFileSync18 } from "child_process";
|
|
30831
|
+
import { dirname as dirname34, extname as extname3 } from "path";
|
|
30832
|
+
var MAX_DIRECTORIES = 200;
|
|
30833
|
+
var MAX_EXTENSIONS_PER_DIRECTORY = 6;
|
|
30834
|
+
function summariseRepoTree(cwd = process.cwd()) {
|
|
30835
|
+
const directories = countByDirectory(listTrackedFiles(cwd));
|
|
30836
|
+
return [...directories.entries()].map(([directory, extensions]) => ({
|
|
30837
|
+
directory,
|
|
30838
|
+
extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
|
|
30839
|
+
total: [...extensions.values()].reduce((sum3, count8) => sum3 + count8, 0)
|
|
30840
|
+
})).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
|
|
30841
|
+
(entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
|
|
30842
|
+
).join("\n");
|
|
30843
|
+
}
|
|
30844
|
+
function listTrackedFiles(cwd) {
|
|
30845
|
+
try {
|
|
30846
|
+
return execFileSync18("git", ["ls-files"], {
|
|
30847
|
+
cwd,
|
|
30848
|
+
encoding: "utf8",
|
|
30849
|
+
maxBuffer: 64 * 1024 * 1024
|
|
30850
|
+
}).split("\n").filter((line) => line !== "");
|
|
30851
|
+
} catch {
|
|
30852
|
+
return [];
|
|
30853
|
+
}
|
|
30854
|
+
}
|
|
30855
|
+
function countByDirectory(files) {
|
|
30856
|
+
const directories = /* @__PURE__ */ new Map();
|
|
30857
|
+
for (const file of files) {
|
|
30858
|
+
const directory = dirname34(file) === "." ? "(repo root)" : dirname34(file);
|
|
30859
|
+
const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
|
|
30860
|
+
const extension = extname3(file) === "" ? "(no extension)" : extname3(file);
|
|
30861
|
+
extensions.set(extension, (extensions.get(extension) ?? 0) + 1);
|
|
30862
|
+
directories.set(directory, extensions);
|
|
30863
|
+
}
|
|
30864
|
+
return directories;
|
|
30865
|
+
}
|
|
30866
|
+
function formatExtensions(extensions) {
|
|
30867
|
+
return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension, count8]) => `${extension}(${count8})`).join(", ");
|
|
30868
|
+
}
|
|
30869
|
+
|
|
30870
|
+
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
30871
|
+
var NOTHING_PROPOSED = { criticalPaths: [], uiPaths: [] };
|
|
30872
|
+
function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
30873
|
+
const tree = summariseRepoTree(cwd);
|
|
30874
|
+
if (tree === "") return NOTHING_PROPOSED;
|
|
30875
|
+
console.log(
|
|
30876
|
+
chalk214.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
30877
|
+
);
|
|
30878
|
+
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
30879
|
+
if (output === void 0) {
|
|
30880
|
+
console.log(
|
|
30881
|
+
chalk214.yellow(
|
|
30882
|
+
"Claude proposed nothing; answer each key from its current value."
|
|
30883
|
+
)
|
|
30884
|
+
);
|
|
30885
|
+
return NOTHING_PROPOSED;
|
|
30886
|
+
}
|
|
30887
|
+
return parseProposedGlobs(output);
|
|
30888
|
+
}
|
|
30889
|
+
function askClaude(prompt, cwd) {
|
|
30890
|
+
try {
|
|
30891
|
+
return execFileSync19("claude", ["-p", "--model", "sonnet", prompt], {
|
|
30892
|
+
cwd,
|
|
30893
|
+
encoding: "utf8",
|
|
30894
|
+
timeout: 12e4,
|
|
30895
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
30896
|
+
});
|
|
30897
|
+
} catch {
|
|
30898
|
+
return void 0;
|
|
30899
|
+
}
|
|
30900
|
+
}
|
|
30901
|
+
|
|
30902
|
+
// src/commands/review/highLevel/resolveHighLevelConfig.ts
|
|
30903
|
+
var DEFAULT_DESCRIPTION_WORD_CAP = 300;
|
|
30904
|
+
function resolveHighLevelConfig(config) {
|
|
30905
|
+
const highLevel = config.review?.highLevel;
|
|
30906
|
+
return {
|
|
30907
|
+
criticalPaths: highLevel?.criticalPaths ?? [],
|
|
30908
|
+
uiPaths: highLevel?.uiPaths ?? [],
|
|
30909
|
+
descriptionWordCap: highLevel?.descriptionWordCap ?? DEFAULT_DESCRIPTION_WORD_CAP
|
|
30910
|
+
};
|
|
30911
|
+
}
|
|
30912
|
+
|
|
30913
|
+
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
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;
|
|
30933
|
+
}
|
|
30934
|
+
function reportConfigured(result) {
|
|
30935
|
+
for (const write of result.written)
|
|
30936
|
+
console.log(
|
|
30937
|
+
chalk215.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
30938
|
+
);
|
|
30939
|
+
for (const key of result.skipped) console.log(chalk215.dim(`Left ${key} unset`));
|
|
30940
|
+
console.log(chalk215.dim(`Written to ${result.target}`));
|
|
30941
|
+
}
|
|
30942
|
+
|
|
30943
|
+
// src/commands/review/highLevel/announceSavedReview.ts
|
|
30944
|
+
import chalk216 from "chalk";
|
|
30624
30945
|
function announceSavedReview(subject, force) {
|
|
30625
30946
|
const head = subject.headSha.slice(0, 7);
|
|
30626
30947
|
if (subject.saved)
|
|
30627
30948
|
console.log(
|
|
30628
|
-
|
|
30949
|
+
chalk216.dim(
|
|
30629
30950
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
30630
30951
|
)
|
|
30631
30952
|
);
|
|
30632
30953
|
else if (force)
|
|
30633
30954
|
console.log(
|
|
30634
|
-
|
|
30955
|
+
chalk216.dim(
|
|
30635
30956
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
30636
30957
|
)
|
|
30637
30958
|
);
|
|
@@ -31019,17 +31340,6 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
31019
31340
|
}
|
|
31020
31341
|
}
|
|
31021
31342
|
|
|
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
31343
|
// src/commands/review/highLevel/selectCriticalDiffs.ts
|
|
31034
31344
|
import { minimatch as minimatch9 } from "minimatch";
|
|
31035
31345
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
@@ -31148,10 +31458,10 @@ function highLevelPreviewPayload(subject) {
|
|
|
31148
31458
|
|
|
31149
31459
|
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
31150
31460
|
import { mkdirSync as mkdirSync21, writeFileSync as writeFileSync38 } from "fs";
|
|
31151
|
-
import { dirname as
|
|
31461
|
+
import { dirname as dirname35 } from "path";
|
|
31152
31462
|
function saveHighLevelReview(record) {
|
|
31153
31463
|
const path91 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
|
|
31154
|
-
mkdirSync21(
|
|
31464
|
+
mkdirSync21(dirname35(path91), { recursive: true });
|
|
31155
31465
|
writeFileSync38(path91, `${JSON.stringify(record, null, 2)}
|
|
31156
31466
|
`);
|
|
31157
31467
|
return path91;
|
|
@@ -31181,55 +31491,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
31181
31491
|
}
|
|
31182
31492
|
|
|
31183
31493
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31184
|
-
import
|
|
31494
|
+
import chalk220 from "chalk";
|
|
31185
31495
|
|
|
31186
31496
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
31187
|
-
import
|
|
31497
|
+
import chalk217 from "chalk";
|
|
31188
31498
|
var PATCH_LINE_COLOURS = {
|
|
31189
|
-
"+":
|
|
31190
|
-
"-":
|
|
31191
|
-
"@":
|
|
31499
|
+
"+": chalk217.green,
|
|
31500
|
+
"-": chalk217.red,
|
|
31501
|
+
"@": chalk217.cyan
|
|
31192
31502
|
};
|
|
31193
31503
|
function formatPatch(patch2) {
|
|
31194
31504
|
return patch2.split("\n").map(
|
|
31195
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
31505
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk217.dim)(line)}`
|
|
31196
31506
|
);
|
|
31197
31507
|
}
|
|
31198
31508
|
function formatDiff(diff3) {
|
|
31199
31509
|
return [
|
|
31200
31510
|
"",
|
|
31201
|
-
` ${
|
|
31202
|
-
...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)
|
|
31203
31513
|
];
|
|
31204
31514
|
}
|
|
31205
31515
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
31206
31516
|
if (criticalPaths.length === 0)
|
|
31207
|
-
return `${
|
|
31208
|
-
${
|
|
31517
|
+
return `${chalk217.bold.underline("Critical diffs")}
|
|
31518
|
+
${chalk217.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
31209
31519
|
if (diffs.length === 0)
|
|
31210
|
-
return `${
|
|
31211
|
-
${
|
|
31520
|
+
return `${chalk217.bold.underline("Critical diffs")}
|
|
31521
|
+
${chalk217.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
31212
31522
|
return [
|
|
31213
|
-
|
|
31523
|
+
chalk217.bold.underline("Critical diffs"),
|
|
31214
31524
|
...diffs.flatMap(formatDiff)
|
|
31215
31525
|
].join("\n");
|
|
31216
31526
|
}
|
|
31217
31527
|
|
|
31218
31528
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
31219
|
-
import
|
|
31529
|
+
import chalk218 from "chalk";
|
|
31220
31530
|
var MARKERS = {
|
|
31221
|
-
pass: () =>
|
|
31222
|
-
fail: () =>
|
|
31223
|
-
manual: () =>
|
|
31531
|
+
pass: () => chalk218.green("\u2714"),
|
|
31532
|
+
fail: () => chalk218.red("\u2718"),
|
|
31533
|
+
manual: () => chalk218.yellow("\u25A1")
|
|
31224
31534
|
};
|
|
31225
31535
|
function formatCheck(check2) {
|
|
31226
|
-
const title = check2.status === "fail" ?
|
|
31536
|
+
const title = check2.status === "fail" ? chalk218.red(check2.title) : chalk218.bold(check2.title);
|
|
31227
31537
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
31228
|
-
${
|
|
31538
|
+
${chalk218.dim(check2.reason)}`;
|
|
31229
31539
|
}
|
|
31230
31540
|
function formatGroup(heading2, checks2) {
|
|
31231
31541
|
if (checks2.length === 0) return [];
|
|
31232
|
-
return ["",
|
|
31542
|
+
return ["", chalk218.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
31233
31543
|
}
|
|
31234
31544
|
function formatHighLevelChecklist(checks2) {
|
|
31235
31545
|
const deterministic = checks2.filter(
|
|
@@ -31238,7 +31548,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31238
31548
|
const failed2 = deterministic.filter(
|
|
31239
31549
|
(check2) => check2.status === "fail"
|
|
31240
31550
|
).length;
|
|
31241
|
-
const summary = failed2 === 0 ?
|
|
31551
|
+
const summary = failed2 === 0 ? chalk218.green(`All ${deterministic.length} deterministic checks pass`) : chalk218.red(
|
|
31242
31552
|
`${failed2} of ${deterministic.length} deterministic checks fail`
|
|
31243
31553
|
);
|
|
31244
31554
|
return [
|
|
@@ -31253,30 +31563,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
31253
31563
|
}
|
|
31254
31564
|
|
|
31255
31565
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
31256
|
-
import
|
|
31566
|
+
import chalk219 from "chalk";
|
|
31257
31567
|
var STATUS_MARKERS = {
|
|
31258
|
-
added: () =>
|
|
31259
|
-
removed: () =>
|
|
31260
|
-
modified: () =>
|
|
31568
|
+
added: () => chalk219.green("A"),
|
|
31569
|
+
removed: () => chalk219.red("D"),
|
|
31570
|
+
modified: () => chalk219.yellow("M")
|
|
31261
31571
|
};
|
|
31262
31572
|
function counts(additions, deletions) {
|
|
31263
|
-
return `${
|
|
31573
|
+
return `${chalk219.green(`+${additions}`)} ${chalk219.red(`-${deletions}`)}`;
|
|
31264
31574
|
}
|
|
31265
31575
|
function formatNode(node, indent3) {
|
|
31266
31576
|
if (node.kind === "file")
|
|
31267
31577
|
return [
|
|
31268
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
31578
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk219.dim(counts(node.additions, node.deletions))}`
|
|
31269
31579
|
];
|
|
31270
31580
|
const dir = node;
|
|
31271
31581
|
return [
|
|
31272
|
-
`${indent3}${
|
|
31582
|
+
`${indent3}${chalk219.bold(`${dir.name}/`)} ${chalk219.dim(counts(dir.additions, dir.deletions))}`,
|
|
31273
31583
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
31274
31584
|
];
|
|
31275
31585
|
}
|
|
31276
31586
|
function formatHighLevelStructure(structure) {
|
|
31277
31587
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
31278
31588
|
return [
|
|
31279
|
-
|
|
31589
|
+
chalk219.bold.underline("Structure"),
|
|
31280
31590
|
` ${summary}`,
|
|
31281
31591
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
31282
31592
|
].join("\n");
|
|
@@ -31285,8 +31595,8 @@ function formatHighLevelStructure(structure) {
|
|
|
31285
31595
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
31286
31596
|
function printHighLevelChecklist(subject) {
|
|
31287
31597
|
console.log(
|
|
31288
|
-
|
|
31289
|
-
|
|
31598
|
+
chalk220.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
31599
|
+
chalk220.dim(
|
|
31290
31600
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
31291
31601
|
)
|
|
31292
31602
|
);
|
|
@@ -31298,12 +31608,12 @@ function printHighLevelChecklist(subject) {
|
|
|
31298
31608
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
31299
31609
|
);
|
|
31300
31610
|
console.log(
|
|
31301
|
-
|
|
31611
|
+
chalk220.dim(
|
|
31302
31612
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
31303
31613
|
)
|
|
31304
31614
|
);
|
|
31305
31615
|
console.log(
|
|
31306
|
-
|
|
31616
|
+
chalk220.dim(
|
|
31307
31617
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
31308
31618
|
)
|
|
31309
31619
|
);
|
|
@@ -31937,18 +32247,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
31937
32247
|
}
|
|
31938
32248
|
|
|
31939
32249
|
// src/commands/review/warnOutOfDiff.ts
|
|
31940
|
-
import
|
|
32250
|
+
import chalk221 from "chalk";
|
|
31941
32251
|
function warnOutOfDiff(outOfDiff) {
|
|
31942
32252
|
if (outOfDiff.length === 0) return;
|
|
31943
32253
|
console.warn(
|
|
31944
|
-
|
|
32254
|
+
chalk221.yellow(
|
|
31945
32255
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
31946
32256
|
)
|
|
31947
32257
|
);
|
|
31948
32258
|
for (const finding of outOfDiff) {
|
|
31949
32259
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
31950
32260
|
console.warn(
|
|
31951
|
-
` ${
|
|
32261
|
+
` ${chalk221.yellow("\xB7")} ${finding.title} ${chalk221.dim(
|
|
31952
32262
|
`(${finding.file}:${range})`
|
|
31953
32263
|
)}`
|
|
31954
32264
|
);
|
|
@@ -31972,18 +32282,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
31972
32282
|
}
|
|
31973
32283
|
|
|
31974
32284
|
// src/commands/review/warnUnlocated.ts
|
|
31975
|
-
import
|
|
32285
|
+
import chalk222 from "chalk";
|
|
31976
32286
|
function warnUnlocated(unlocated) {
|
|
31977
32287
|
if (unlocated.length === 0) return;
|
|
31978
32288
|
console.warn(
|
|
31979
|
-
|
|
32289
|
+
chalk222.yellow(
|
|
31980
32290
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
31981
32291
|
)
|
|
31982
32292
|
);
|
|
31983
32293
|
for (const finding of unlocated) {
|
|
31984
|
-
const where = finding.location ||
|
|
32294
|
+
const where = finding.location || chalk222.dim("missing");
|
|
31985
32295
|
console.warn(
|
|
31986
|
-
` ${
|
|
32296
|
+
` ${chalk222.yellow("\xB7")} ${finding.title} ${chalk222.dim(`(${where})`)}`
|
|
31987
32297
|
);
|
|
31988
32298
|
}
|
|
31989
32299
|
}
|
|
@@ -33283,6 +33593,29 @@ async function reviewPr(repoRoot2, options2) {
|
|
|
33283
33593
|
console.log(`Done. Review folder: ${paths.reviewDir}`);
|
|
33284
33594
|
}
|
|
33285
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
|
+
|
|
33286
33619
|
// src/commands/review/validateReviewOptions.ts
|
|
33287
33620
|
function validateReviewOptions(options2) {
|
|
33288
33621
|
if (options2.apply && options2.refine) {
|
|
@@ -33297,6 +33630,7 @@ function validateReviewOptions(options2) {
|
|
|
33297
33630
|
}
|
|
33298
33631
|
validateCheckoutOnly(options2);
|
|
33299
33632
|
validateHighLevel(options2);
|
|
33633
|
+
validateConfigureOptions(options2);
|
|
33300
33634
|
}
|
|
33301
33635
|
function validateCheckoutOnly(options2) {
|
|
33302
33636
|
if (!options2.checkoutOnly) return;
|
|
@@ -33330,6 +33664,11 @@ function resolveRepoRoot() {
|
|
|
33330
33664
|
}
|
|
33331
33665
|
async function review(options2 = {}) {
|
|
33332
33666
|
validateReviewOptions(options2);
|
|
33667
|
+
if (options2.configure)
|
|
33668
|
+
return configureHighLevelReview({
|
|
33669
|
+
scope: options2.scope,
|
|
33670
|
+
answer: options2.answer
|
|
33671
|
+
});
|
|
33333
33672
|
startReviewLog();
|
|
33334
33673
|
const invokedIn = resolveRepoRoot();
|
|
33335
33674
|
if (options2.checkoutOnly && options2.number)
|
|
@@ -33343,14 +33682,34 @@ async function review(options2 = {}) {
|
|
|
33343
33682
|
return reviewPr(resolveRepoRoot(), options2);
|
|
33344
33683
|
}
|
|
33345
33684
|
|
|
33346
|
-
// src/commands/
|
|
33347
|
-
function
|
|
33348
|
-
|
|
33349
|
-
"
|
|
33350
|
-
|
|
33351
|
-
"[number]",
|
|
33352
|
-
"Optional PR number; when provided, runs `gh pr checkout <number>` before reviewing"
|
|
33685
|
+
// src/commands/review/addReviewModeOptions.ts
|
|
33686
|
+
function addReviewModeOptions(command) {
|
|
33687
|
+
return command.option(
|
|
33688
|
+
"--checkout-only",
|
|
33689
|
+
"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
33690
|
).option(
|
|
33691
|
+
"--high-level",
|
|
33692
|
+
"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"
|
|
33693
|
+
).option(
|
|
33694
|
+
"--configure",
|
|
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
|
+
[]
|
|
33704
|
+
);
|
|
33705
|
+
}
|
|
33706
|
+
function collectAnswer(answer, answers) {
|
|
33707
|
+
return [...answers, answer];
|
|
33708
|
+
}
|
|
33709
|
+
|
|
33710
|
+
// src/commands/review/addReviewRunOptions.ts
|
|
33711
|
+
function addReviewRunOptions(command) {
|
|
33712
|
+
return command.option(
|
|
33354
33713
|
"--no-prompt",
|
|
33355
33714
|
"Skip confirmation prompts; use flag defaults non-interactively"
|
|
33356
33715
|
).option(
|
|
@@ -33368,12 +33727,6 @@ function registerReview(program2) {
|
|
|
33368
33727
|
).option(
|
|
33369
33728
|
"--backlog",
|
|
33370
33729
|
"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
33730
|
).option(
|
|
33378
33731
|
"--address-comments",
|
|
33379
33732
|
"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 +33736,18 @@ function registerReview(program2) {
|
|
|
33383
33736
|
).option(
|
|
33384
33737
|
"--verbose",
|
|
33385
33738
|
"Disable spinner UI and use per-line log output (per-tool lines, starting/done lines)"
|
|
33386
|
-
)
|
|
33739
|
+
);
|
|
33740
|
+
}
|
|
33741
|
+
|
|
33742
|
+
// src/commands/registerReview.ts
|
|
33743
|
+
function registerReview(program2) {
|
|
33744
|
+
const reviewCommand = program2.command("review").description(
|
|
33745
|
+
"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"
|
|
33746
|
+
).argument(
|
|
33747
|
+
"[number]",
|
|
33748
|
+
"Optional PR number; when provided, runs `gh pr checkout <number>` before reviewing"
|
|
33749
|
+
);
|
|
33750
|
+
addReviewModeOptions(addReviewRunOptions(reviewCommand)).action(
|
|
33387
33751
|
(number, options2) => review({ ...options2, number })
|
|
33388
33752
|
);
|
|
33389
33753
|
configHelp(
|
|
@@ -33396,7 +33760,7 @@ function registerReview(program2) {
|
|
|
33396
33760
|
// src/commands/rules/addRule.ts
|
|
33397
33761
|
import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync42 } from "fs";
|
|
33398
33762
|
import path72 from "path";
|
|
33399
|
-
import
|
|
33763
|
+
import chalk223 from "chalk";
|
|
33400
33764
|
|
|
33401
33765
|
// src/commands/rules/insertRuleBullet.ts
|
|
33402
33766
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -33532,7 +33896,7 @@ function read2(file) {
|
|
|
33532
33896
|
function addRule(text18, options2) {
|
|
33533
33897
|
const rule = text18.trim();
|
|
33534
33898
|
if (rule === "") {
|
|
33535
|
-
console.error(
|
|
33899
|
+
console.error(chalk223.red("Rule text is required"));
|
|
33536
33900
|
process.exitCode = 1;
|
|
33537
33901
|
return;
|
|
33538
33902
|
}
|
|
@@ -33550,13 +33914,13 @@ function addRule(text18, options2) {
|
|
|
33550
33914
|
);
|
|
33551
33915
|
updateScopedRulesIndex(root);
|
|
33552
33916
|
console.log(
|
|
33553
|
-
`Added ${
|
|
33917
|
+
`Added ${chalk223.cyan(code)} to ${path72.relative(process.cwd(), target) || target}`
|
|
33554
33918
|
);
|
|
33555
33919
|
}
|
|
33556
33920
|
|
|
33557
33921
|
// src/commands/rules/indexRules.ts
|
|
33558
33922
|
import path73 from "path";
|
|
33559
|
-
import
|
|
33923
|
+
import chalk224 from "chalk";
|
|
33560
33924
|
function indexRules() {
|
|
33561
33925
|
const startDir = scopeDirectory(process.cwd());
|
|
33562
33926
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
@@ -33564,24 +33928,24 @@ function indexRules() {
|
|
|
33564
33928
|
const rootFile = path73.relative(process.cwd(), path73.join(root, "CLAUDE.md"));
|
|
33565
33929
|
if (directories.length === 0) {
|
|
33566
33930
|
console.log(
|
|
33567
|
-
|
|
33931
|
+
chalk224.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
33568
33932
|
);
|
|
33569
33933
|
return;
|
|
33570
33934
|
}
|
|
33571
33935
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
33572
33936
|
for (const directory of directories)
|
|
33573
|
-
console.log(` ${
|
|
33937
|
+
console.log(` ${chalk224.cyan(directory)}`);
|
|
33574
33938
|
}
|
|
33575
33939
|
|
|
33576
33940
|
// src/commands/rules/listRules.ts
|
|
33577
33941
|
import path74 from "path";
|
|
33578
|
-
import
|
|
33942
|
+
import chalk225 from "chalk";
|
|
33579
33943
|
function listRules(target, options2 = {}) {
|
|
33580
33944
|
const resolved = path74.resolve(target ?? process.cwd());
|
|
33581
33945
|
const rules3 = readScopedRules(resolved);
|
|
33582
33946
|
if (rules3.length === 0) {
|
|
33583
33947
|
const label2 = path74.relative(process.cwd(), resolved) || ".";
|
|
33584
|
-
console.log(
|
|
33948
|
+
console.log(chalk225.gray(`No rules in scope for ${label2}`));
|
|
33585
33949
|
return;
|
|
33586
33950
|
}
|
|
33587
33951
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -33591,14 +33955,14 @@ function listRules(target, options2 = {}) {
|
|
|
33591
33955
|
if (rule.source !== shown) {
|
|
33592
33956
|
shown = rule.source;
|
|
33593
33957
|
console.log(
|
|
33594
|
-
|
|
33958
|
+
chalk225.dim(base ? path74.relative(base, rule.source) : rule.source)
|
|
33595
33959
|
);
|
|
33596
33960
|
}
|
|
33597
33961
|
console.log(
|
|
33598
|
-
` ${
|
|
33962
|
+
` ${chalk225.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
33599
33963
|
);
|
|
33600
33964
|
if (options2.full && rule.title)
|
|
33601
|
-
console.log(` ${" ".repeat(width)} ${
|
|
33965
|
+
console.log(` ${" ".repeat(width)} ${chalk225.dim(rule.text)}`);
|
|
33602
33966
|
}
|
|
33603
33967
|
}
|
|
33604
33968
|
|
|
@@ -33627,7 +33991,7 @@ function registerRules(program2) {
|
|
|
33627
33991
|
}
|
|
33628
33992
|
|
|
33629
33993
|
// src/commands/seq/seqAuth.ts
|
|
33630
|
-
import
|
|
33994
|
+
import chalk227 from "chalk";
|
|
33631
33995
|
|
|
33632
33996
|
// src/commands/seq/loadConnections.ts
|
|
33633
33997
|
function loadConnections2() {
|
|
@@ -33656,10 +34020,10 @@ function setDefaultConnection(name) {
|
|
|
33656
34020
|
}
|
|
33657
34021
|
|
|
33658
34022
|
// src/shared/assertUniqueName.ts
|
|
33659
|
-
import
|
|
34023
|
+
import chalk226 from "chalk";
|
|
33660
34024
|
function assertUniqueName(existingNames, name) {
|
|
33661
34025
|
if (existingNames.includes(name)) {
|
|
33662
|
-
console.error(
|
|
34026
|
+
console.error(chalk226.red(`Connection "${name}" already exists.`));
|
|
33663
34027
|
process.exit(1);
|
|
33664
34028
|
}
|
|
33665
34029
|
}
|
|
@@ -33677,16 +34041,16 @@ async function promptConnection2(existingNames) {
|
|
|
33677
34041
|
var seqAuth = createConnectionAuth({
|
|
33678
34042
|
load: loadConnections2,
|
|
33679
34043
|
save: saveConnections2,
|
|
33680
|
-
format: (c) => `${
|
|
34044
|
+
format: (c) => `${chalk227.bold(c.name)} ${c.url}`,
|
|
33681
34045
|
promptNew: promptConnection2,
|
|
33682
34046
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
33683
34047
|
});
|
|
33684
34048
|
|
|
33685
34049
|
// src/commands/seq/seqQuery.ts
|
|
33686
|
-
import
|
|
34050
|
+
import chalk231 from "chalk";
|
|
33687
34051
|
|
|
33688
34052
|
// src/commands/seq/fetchSeq.ts
|
|
33689
|
-
import
|
|
34053
|
+
import chalk228 from "chalk";
|
|
33690
34054
|
async function fetchSeq(conn, path91, params) {
|
|
33691
34055
|
const url = `${conn.url}${path91}?${params}`;
|
|
33692
34056
|
const response = await fetch(url, {
|
|
@@ -33697,7 +34061,7 @@ async function fetchSeq(conn, path91, params) {
|
|
|
33697
34061
|
});
|
|
33698
34062
|
if (!response.ok) {
|
|
33699
34063
|
const body = await response.text();
|
|
33700
|
-
console.error(
|
|
34064
|
+
console.error(chalk228.red(`Seq returned ${response.status}: ${body}`));
|
|
33701
34065
|
process.exit(1);
|
|
33702
34066
|
}
|
|
33703
34067
|
return response;
|
|
@@ -33756,23 +34120,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
33756
34120
|
}
|
|
33757
34121
|
|
|
33758
34122
|
// src/commands/seq/formatEvent.ts
|
|
33759
|
-
import
|
|
34123
|
+
import chalk229 from "chalk";
|
|
33760
34124
|
function levelColor(level) {
|
|
33761
34125
|
switch (level) {
|
|
33762
34126
|
case "Fatal":
|
|
33763
|
-
return
|
|
34127
|
+
return chalk229.bgRed.white;
|
|
33764
34128
|
case "Error":
|
|
33765
|
-
return
|
|
34129
|
+
return chalk229.red;
|
|
33766
34130
|
case "Warning":
|
|
33767
|
-
return
|
|
34131
|
+
return chalk229.yellow;
|
|
33768
34132
|
case "Information":
|
|
33769
|
-
return
|
|
34133
|
+
return chalk229.cyan;
|
|
33770
34134
|
case "Debug":
|
|
33771
|
-
return
|
|
34135
|
+
return chalk229.gray;
|
|
33772
34136
|
case "Verbose":
|
|
33773
|
-
return
|
|
34137
|
+
return chalk229.dim;
|
|
33774
34138
|
default:
|
|
33775
|
-
return
|
|
34139
|
+
return chalk229.white;
|
|
33776
34140
|
}
|
|
33777
34141
|
}
|
|
33778
34142
|
function levelAbbrev(level) {
|
|
@@ -33813,12 +34177,12 @@ function formatTimestamp(iso) {
|
|
|
33813
34177
|
function formatEvent(event) {
|
|
33814
34178
|
const color = levelColor(event.Level);
|
|
33815
34179
|
const abbrev = levelAbbrev(event.Level);
|
|
33816
|
-
const ts8 =
|
|
34180
|
+
const ts8 = chalk229.dim(formatTimestamp(event.Timestamp));
|
|
33817
34181
|
const msg = renderMessage(event);
|
|
33818
34182
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
33819
34183
|
if (event.Exception) {
|
|
33820
34184
|
for (const line of event.Exception.split("\n")) {
|
|
33821
|
-
lines2.push(
|
|
34185
|
+
lines2.push(chalk229.red(` ${line}`));
|
|
33822
34186
|
}
|
|
33823
34187
|
}
|
|
33824
34188
|
return lines2.join("\n");
|
|
@@ -33851,11 +34215,11 @@ function rejectTimestampFilter(filter) {
|
|
|
33851
34215
|
}
|
|
33852
34216
|
|
|
33853
34217
|
// src/shared/resolveNamedConnection.ts
|
|
33854
|
-
import
|
|
34218
|
+
import chalk230 from "chalk";
|
|
33855
34219
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
33856
34220
|
if (connections.length === 0) {
|
|
33857
34221
|
console.error(
|
|
33858
|
-
|
|
34222
|
+
chalk230.red(
|
|
33859
34223
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
33860
34224
|
)
|
|
33861
34225
|
);
|
|
@@ -33864,7 +34228,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
33864
34228
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
33865
34229
|
const connection = connections.find((c) => c.name === target);
|
|
33866
34230
|
if (!connection) {
|
|
33867
|
-
console.error(
|
|
34231
|
+
console.error(chalk230.red(`${kind} connection "${target}" not found.`));
|
|
33868
34232
|
process.exit(1);
|
|
33869
34233
|
}
|
|
33870
34234
|
return connection;
|
|
@@ -33893,7 +34257,7 @@ async function seqQuery(filter, options2) {
|
|
|
33893
34257
|
new URLSearchParams({ filter, count: String(count8) })
|
|
33894
34258
|
);
|
|
33895
34259
|
if (events.length === 0) {
|
|
33896
|
-
console.log(
|
|
34260
|
+
console.log(chalk231.yellow("No events found."));
|
|
33897
34261
|
return;
|
|
33898
34262
|
}
|
|
33899
34263
|
if (options2.json) {
|
|
@@ -33904,11 +34268,11 @@ async function seqQuery(filter, options2) {
|
|
|
33904
34268
|
for (const event of chronological) {
|
|
33905
34269
|
console.log(formatEvent(event));
|
|
33906
34270
|
}
|
|
33907
|
-
console.log(
|
|
34271
|
+
console.log(chalk231.dim(`
|
|
33908
34272
|
${events.length} events`));
|
|
33909
34273
|
if (events.length >= count8) {
|
|
33910
34274
|
console.log(
|
|
33911
|
-
|
|
34275
|
+
chalk231.yellow(
|
|
33912
34276
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
33913
34277
|
)
|
|
33914
34278
|
);
|
|
@@ -33916,10 +34280,10 @@ ${events.length} events`));
|
|
|
33916
34280
|
}
|
|
33917
34281
|
|
|
33918
34282
|
// src/shared/setNamedDefaultConnection.ts
|
|
33919
|
-
import
|
|
34283
|
+
import chalk232 from "chalk";
|
|
33920
34284
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
33921
34285
|
if (!connections.find((c) => c.name === name)) {
|
|
33922
|
-
console.error(
|
|
34286
|
+
console.error(chalk232.red(`Connection "${name}" not found.`));
|
|
33923
34287
|
process.exit(1);
|
|
33924
34288
|
}
|
|
33925
34289
|
setDefault(name);
|
|
@@ -34140,7 +34504,7 @@ function registerSlack(program2) {
|
|
|
34140
34504
|
}
|
|
34141
34505
|
|
|
34142
34506
|
// src/commands/sql/sqlAuth.ts
|
|
34143
|
-
import
|
|
34507
|
+
import chalk234 from "chalk";
|
|
34144
34508
|
|
|
34145
34509
|
// src/commands/sql/loadConnections.ts
|
|
34146
34510
|
function loadConnections3() {
|
|
@@ -34169,7 +34533,7 @@ function setDefaultConnection2(name) {
|
|
|
34169
34533
|
}
|
|
34170
34534
|
|
|
34171
34535
|
// src/commands/sql/promptConnection.ts
|
|
34172
|
-
import
|
|
34536
|
+
import chalk233 from "chalk";
|
|
34173
34537
|
async function promptConnection3(existingNames) {
|
|
34174
34538
|
const name = await promptInput("name", "Connection name:", "default");
|
|
34175
34539
|
assertUniqueName(existingNames, name);
|
|
@@ -34177,7 +34541,7 @@ async function promptConnection3(existingNames) {
|
|
|
34177
34541
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
34178
34542
|
const port = Number.parseInt(portStr, 10);
|
|
34179
34543
|
if (!Number.isFinite(port)) {
|
|
34180
|
-
console.error(
|
|
34544
|
+
console.error(chalk233.red(`Invalid port "${portStr}".`));
|
|
34181
34545
|
process.exit(1);
|
|
34182
34546
|
}
|
|
34183
34547
|
const user = await promptInput("user", "User:");
|
|
@@ -34190,13 +34554,13 @@ async function promptConnection3(existingNames) {
|
|
|
34190
34554
|
var sqlAuth = createConnectionAuth({
|
|
34191
34555
|
load: loadConnections3,
|
|
34192
34556
|
save: saveConnections3,
|
|
34193
|
-
format: (c) => `${
|
|
34557
|
+
format: (c) => `${chalk234.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
34194
34558
|
promptNew: promptConnection3,
|
|
34195
34559
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
34196
34560
|
});
|
|
34197
34561
|
|
|
34198
34562
|
// src/commands/sql/printTable.ts
|
|
34199
|
-
import
|
|
34563
|
+
import chalk235 from "chalk";
|
|
34200
34564
|
function formatCell(value) {
|
|
34201
34565
|
if (value === null || value === void 0) return "";
|
|
34202
34566
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -34205,7 +34569,7 @@ function formatCell(value) {
|
|
|
34205
34569
|
}
|
|
34206
34570
|
function printTable(rows) {
|
|
34207
34571
|
if (rows.length === 0) {
|
|
34208
|
-
console.log(
|
|
34572
|
+
console.log(chalk235.yellow("(no rows)"));
|
|
34209
34573
|
return;
|
|
34210
34574
|
}
|
|
34211
34575
|
const columns = Object.keys(rows[0]);
|
|
@@ -34213,13 +34577,13 @@ function printTable(rows) {
|
|
|
34213
34577
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
34214
34578
|
);
|
|
34215
34579
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
34216
|
-
console.log(
|
|
34217
|
-
console.log(
|
|
34580
|
+
console.log(chalk235.dim(header));
|
|
34581
|
+
console.log(chalk235.dim("-".repeat(header.length)));
|
|
34218
34582
|
for (const row of rows) {
|
|
34219
34583
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
34220
34584
|
console.log(line);
|
|
34221
34585
|
}
|
|
34222
|
-
console.log(
|
|
34586
|
+
console.log(chalk235.dim(`
|
|
34223
34587
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
34224
34588
|
}
|
|
34225
34589
|
|
|
@@ -34279,7 +34643,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
34279
34643
|
}
|
|
34280
34644
|
|
|
34281
34645
|
// src/commands/sql/sqlMutate.ts
|
|
34282
|
-
import
|
|
34646
|
+
import chalk236 from "chalk";
|
|
34283
34647
|
|
|
34284
34648
|
// src/commands/sql/isMutation.ts
|
|
34285
34649
|
var MUTATION_KEYWORDS = [
|
|
@@ -34313,7 +34677,7 @@ function isMutation(sql29) {
|
|
|
34313
34677
|
async function sqlMutate(query, connectionName) {
|
|
34314
34678
|
if (!isMutation(query)) {
|
|
34315
34679
|
console.error(
|
|
34316
|
-
|
|
34680
|
+
chalk236.red(
|
|
34317
34681
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
34318
34682
|
)
|
|
34319
34683
|
);
|
|
@@ -34323,18 +34687,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
34323
34687
|
const pool = await sqlConnect(conn);
|
|
34324
34688
|
try {
|
|
34325
34689
|
const result = await pool.request().query(query);
|
|
34326
|
-
console.log(
|
|
34690
|
+
console.log(chalk236.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
34327
34691
|
} finally {
|
|
34328
34692
|
await pool.close();
|
|
34329
34693
|
}
|
|
34330
34694
|
}
|
|
34331
34695
|
|
|
34332
34696
|
// src/commands/sql/sqlQuery.ts
|
|
34333
|
-
import
|
|
34697
|
+
import chalk237 from "chalk";
|
|
34334
34698
|
async function sqlQuery(query, connectionName) {
|
|
34335
34699
|
if (isMutation(query)) {
|
|
34336
34700
|
console.error(
|
|
34337
|
-
|
|
34701
|
+
chalk237.red(
|
|
34338
34702
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
34339
34703
|
)
|
|
34340
34704
|
);
|
|
@@ -34349,7 +34713,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
34349
34713
|
printTable(rows);
|
|
34350
34714
|
} else {
|
|
34351
34715
|
console.log(
|
|
34352
|
-
|
|
34716
|
+
chalk237.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
34353
34717
|
);
|
|
34354
34718
|
}
|
|
34355
34719
|
} finally {
|
|
@@ -34723,7 +35087,7 @@ function syncPi(claudeDir, options2) {
|
|
|
34723
35087
|
// src/commands/sync/syncSettings.ts
|
|
34724
35088
|
import * as fs48 from "fs";
|
|
34725
35089
|
import * as path84 from "path";
|
|
34726
|
-
import
|
|
35090
|
+
import chalk238 from "chalk";
|
|
34727
35091
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
34728
35092
|
const source = path84.join(claudeDir, "settings.json");
|
|
34729
35093
|
const target = path84.join(targetBase, "settings.json");
|
|
@@ -34742,7 +35106,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
34742
35106
|
if (mergedContent !== normalizedTarget) {
|
|
34743
35107
|
if (!options2?.yes) {
|
|
34744
35108
|
console.log(
|
|
34745
|
-
|
|
35109
|
+
chalk238.yellow(
|
|
34746
35110
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
34747
35111
|
)
|
|
34748
35112
|
);
|
|
@@ -34750,7 +35114,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
34750
35114
|
printDiff(targetContent, mergedContent);
|
|
34751
35115
|
printAutoConfirmHint();
|
|
34752
35116
|
const confirm = await promptConfirm(
|
|
34753
|
-
|
|
35117
|
+
chalk238.red("Overwrite existing settings.json?"),
|
|
34754
35118
|
false
|
|
34755
35119
|
);
|
|
34756
35120
|
if (!confirm) {
|
|
@@ -35554,9 +35918,9 @@ import { join as join92 } from "path";
|
|
|
35554
35918
|
|
|
35555
35919
|
// src/commands/voice/shared.ts
|
|
35556
35920
|
import { homedir as homedir25 } from "os";
|
|
35557
|
-
import { dirname as
|
|
35921
|
+
import { dirname as dirname39, join as join91 } from "path";
|
|
35558
35922
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
35559
|
-
var __dirname6 =
|
|
35923
|
+
var __dirname6 = dirname39(fileURLToPath10(import.meta.url));
|
|
35560
35924
|
var VOICE_DIR = join91(homedir25(), ".assist", "voice");
|
|
35561
35925
|
var voicePaths = {
|
|
35562
35926
|
dir: VOICE_DIR,
|
|
@@ -35812,9 +36176,9 @@ function registerVoice(program2) {
|
|
|
35812
36176
|
}
|
|
35813
36177
|
|
|
35814
36178
|
// src/commands/watch/resolveUpstream.ts
|
|
35815
|
-
import { execFileSync as
|
|
36179
|
+
import { execFileSync as execFileSync20 } from "child_process";
|
|
35816
36180
|
function runGit3(args, cwd) {
|
|
35817
|
-
return
|
|
36181
|
+
return execFileSync20("git", args, {
|
|
35818
36182
|
encoding: "utf8",
|
|
35819
36183
|
stdio: ["pipe", "pipe", "pipe"],
|
|
35820
36184
|
cwd
|
|
@@ -36216,14 +36580,14 @@ import { spawn as spawn9 } from "child_process";
|
|
|
36216
36580
|
import { existsSync as existsSync84 } from "fs";
|
|
36217
36581
|
|
|
36218
36582
|
// src/commands/run/resolveCommand.ts
|
|
36219
|
-
import { execFileSync as
|
|
36583
|
+
import { execFileSync as execFileSync21 } from "child_process";
|
|
36220
36584
|
import { existsSync as existsSync83 } from "fs";
|
|
36221
|
-
import { dirname as
|
|
36585
|
+
import { dirname as dirname40, join as join97, resolve as resolve20 } from "path";
|
|
36222
36586
|
function resolveCommand2(command) {
|
|
36223
36587
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
36224
36588
|
try {
|
|
36225
|
-
const gitPath =
|
|
36226
|
-
const gitRoot = resolve20(
|
|
36589
|
+
const gitPath = execFileSync21("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
36590
|
+
const gitRoot = resolve20(dirname40(gitPath), "..");
|
|
36227
36591
|
const gitBash = join97(gitRoot, "bin", "bash.exe");
|
|
36228
36592
|
if (existsSync83(gitBash)) return gitBash;
|
|
36229
36593
|
} catch {
|
|
@@ -36344,11 +36708,11 @@ async function reportSyncOrExit() {
|
|
|
36344
36708
|
}
|
|
36345
36709
|
|
|
36346
36710
|
// src/commands/watch/fetchQuietly.ts
|
|
36347
|
-
import { execFileSync as
|
|
36711
|
+
import { execFileSync as execFileSync22 } from "child_process";
|
|
36348
36712
|
var MIN_FETCH_TIMEOUT_MS = 6e4;
|
|
36349
36713
|
function fetchQuietly(cwd, intervalMs) {
|
|
36350
36714
|
try {
|
|
36351
|
-
|
|
36715
|
+
execFileSync22("git", ["fetch", "--quiet"], {
|
|
36352
36716
|
stdio: ["pipe", "pipe", "pipe"],
|
|
36353
36717
|
cwd,
|
|
36354
36718
|
timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
|
|
@@ -36492,7 +36856,7 @@ function registerWatch(program2) {
|
|
|
36492
36856
|
|
|
36493
36857
|
// src/commands/roam/auth.ts
|
|
36494
36858
|
import { randomBytes } from "crypto";
|
|
36495
|
-
import
|
|
36859
|
+
import chalk239 from "chalk";
|
|
36496
36860
|
|
|
36497
36861
|
// src/commands/roam/waitForCallback.ts
|
|
36498
36862
|
import { createServer as createServer3 } from "http";
|
|
@@ -36623,13 +36987,13 @@ async function auth() {
|
|
|
36623
36987
|
saveGlobalConfig(config);
|
|
36624
36988
|
const state = randomBytes(16).toString("hex");
|
|
36625
36989
|
console.log(
|
|
36626
|
-
|
|
36990
|
+
chalk239.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
36627
36991
|
);
|
|
36628
|
-
console.log(
|
|
36629
|
-
console.log(
|
|
36630
|
-
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..."));
|
|
36631
36995
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
36632
|
-
console.log(
|
|
36996
|
+
console.log(chalk239.dim("Exchanging code for tokens..."));
|
|
36633
36997
|
const tokens = await exchangeToken({
|
|
36634
36998
|
code,
|
|
36635
36999
|
clientId,
|
|
@@ -36645,12 +37009,12 @@ async function auth() {
|
|
|
36645
37009
|
};
|
|
36646
37010
|
saveGlobalConfig(config);
|
|
36647
37011
|
console.log(
|
|
36648
|
-
|
|
37012
|
+
chalk239.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
36649
37013
|
);
|
|
36650
37014
|
}
|
|
36651
37015
|
|
|
36652
37016
|
// src/commands/roam/postRoamActivity.ts
|
|
36653
|
-
import { execFileSync as
|
|
37017
|
+
import { execFileSync as execFileSync23 } from "child_process";
|
|
36654
37018
|
import { readdirSync as readdirSync22, readFileSync as readFileSync63, statSync as statSync12 } from "fs";
|
|
36655
37019
|
import { join as join98 } from "path";
|
|
36656
37020
|
function findPortFile(roamDir) {
|
|
@@ -36689,7 +37053,7 @@ function postRoamActivity(app, event) {
|
|
|
36689
37053
|
const pid = PID_BY_APP[app] ?? 99999;
|
|
36690
37054
|
const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
|
|
36691
37055
|
try {
|
|
36692
|
-
|
|
37056
|
+
execFileSync23("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
|
|
36693
37057
|
stdio: "ignore"
|
|
36694
37058
|
});
|
|
36695
37059
|
} catch {
|
|
@@ -37004,7 +37368,7 @@ import { execSync as execSync66 } from "child_process";
|
|
|
37004
37368
|
import { existsSync as existsSync86, mkdirSync as mkdirSync36, unlinkSync as unlinkSync22, writeFileSync as writeFileSync53 } from "fs";
|
|
37005
37369
|
import { tmpdir as tmpdir9 } from "os";
|
|
37006
37370
|
import { join as join101, resolve as resolve21 } from "path";
|
|
37007
|
-
import
|
|
37371
|
+
import chalk240 from "chalk";
|
|
37008
37372
|
|
|
37009
37373
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
37010
37374
|
var captureWindowPs1 = `
|
|
@@ -37155,23 +37519,23 @@ function screenshot(processName) {
|
|
|
37155
37519
|
const config = loadConfig();
|
|
37156
37520
|
const outputDir = resolve21(config.screenshot.outputDir);
|
|
37157
37521
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
37158
|
-
console.log(
|
|
37522
|
+
console.log(chalk240.gray(`Capturing window for process "${processName}" ...`));
|
|
37159
37523
|
try {
|
|
37160
37524
|
runPowerShellScript(processName, outputPath);
|
|
37161
|
-
console.log(
|
|
37525
|
+
console.log(chalk240.green(`Screenshot saved: ${outputPath}`));
|
|
37162
37526
|
} catch (error) {
|
|
37163
37527
|
const msg = error instanceof Error ? error.message : String(error);
|
|
37164
|
-
console.error(
|
|
37528
|
+
console.error(chalk240.red(`Failed to capture screenshot: ${msg}`));
|
|
37165
37529
|
process.exit(1);
|
|
37166
37530
|
}
|
|
37167
37531
|
}
|
|
37168
37532
|
|
|
37169
37533
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
37170
|
-
import { execFileSync as
|
|
37534
|
+
import { execFileSync as execFileSync24 } from "child_process";
|
|
37171
37535
|
function listDaemonPids() {
|
|
37172
37536
|
if (process.platform === "win32") return [];
|
|
37173
37537
|
try {
|
|
37174
|
-
const out =
|
|
37538
|
+
const out = execFileSync24("ps", ["-eo", "pid=,args="], {
|
|
37175
37539
|
encoding: "utf8"
|
|
37176
37540
|
});
|
|
37177
37541
|
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 +39098,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
38734
39098
|
|
|
38735
39099
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
38736
39100
|
import { existsSync as existsSync94, mkdirSync as mkdirSync37, watch as watch2 } from "fs";
|
|
38737
|
-
import { dirname as
|
|
39101
|
+
import { dirname as dirname42 } from "path";
|
|
38738
39102
|
|
|
38739
39103
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
38740
39104
|
function applyActivityToSession(session, activity2) {
|
|
@@ -38796,7 +39160,7 @@ var DEBOUNCE_MS2 = 50;
|
|
|
38796
39160
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
38797
39161
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
38798
39162
|
const path91 = activityPath(session.id);
|
|
38799
|
-
const dir =
|
|
39163
|
+
const dir = dirname42(path91);
|
|
38800
39164
|
try {
|
|
38801
39165
|
mkdirSync37(dir, { recursive: true });
|
|
38802
39166
|
} catch {
|
|
@@ -42909,7 +43273,7 @@ function cleanupOwnedFiles() {
|
|
|
42909
43273
|
import * as net3 from "net";
|
|
42910
43274
|
|
|
42911
43275
|
// src/commands/sessions/daemon/findPortHolderPid.ts
|
|
42912
|
-
import { execFileSync as
|
|
43276
|
+
import { execFileSync as execFileSync25 } from "child_process";
|
|
42913
43277
|
var PROBE_TIMEOUT_MS = 3e3;
|
|
42914
43278
|
function findPortHolderPid(port) {
|
|
42915
43279
|
try {
|
|
@@ -42919,7 +43283,7 @@ function findPortHolderPid(port) {
|
|
|
42919
43283
|
}
|
|
42920
43284
|
}
|
|
42921
43285
|
function probe(command, args) {
|
|
42922
|
-
return
|
|
43286
|
+
return execFileSync25(command, args, {
|
|
42923
43287
|
encoding: "utf8",
|
|
42924
43288
|
timeout: PROBE_TIMEOUT_MS,
|
|
42925
43289
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -43142,7 +43506,7 @@ async function renameSession(title) {
|
|
|
43142
43506
|
|
|
43143
43507
|
// src/commands/sessions/summarise/index.ts
|
|
43144
43508
|
import * as fs57 from "fs";
|
|
43145
|
-
import
|
|
43509
|
+
import chalk241 from "chalk";
|
|
43146
43510
|
|
|
43147
43511
|
// src/commands/sessions/summarise/shared.ts
|
|
43148
43512
|
import * as fs56 from "fs";
|
|
@@ -43158,7 +43522,7 @@ function summaryPathFor(jsonlPath2) {
|
|
|
43158
43522
|
}
|
|
43159
43523
|
|
|
43160
43524
|
// src/commands/sessions/summarise/summariseSession.ts
|
|
43161
|
-
import { execFileSync as
|
|
43525
|
+
import { execFileSync as execFileSync26 } from "child_process";
|
|
43162
43526
|
function summariseSession(jsonlPath2) {
|
|
43163
43527
|
const firstMessage = extractFirstUserMessage(jsonlPath2);
|
|
43164
43528
|
const backlogIds = scanSessionBacklogRefs(jsonlPath2);
|
|
@@ -43167,7 +43531,7 @@ function summariseSession(jsonlPath2) {
|
|
|
43167
43531
|
}
|
|
43168
43532
|
const prompt = buildPrompt6(firstMessage, backlogIds);
|
|
43169
43533
|
try {
|
|
43170
|
-
const output =
|
|
43534
|
+
const output = execFileSync26("claude", ["-p", "--model", "haiku", prompt], {
|
|
43171
43535
|
encoding: "utf8",
|
|
43172
43536
|
timeout: 3e4,
|
|
43173
43537
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -43201,22 +43565,22 @@ ${firstMessage}`);
|
|
|
43201
43565
|
async function summarise2(options2) {
|
|
43202
43566
|
const files = await discoverSessionFiles();
|
|
43203
43567
|
if (files.length === 0) {
|
|
43204
|
-
console.log(
|
|
43568
|
+
console.log(chalk241.yellow("No sessions found."));
|
|
43205
43569
|
return;
|
|
43206
43570
|
}
|
|
43207
43571
|
const toProcess = selectCandidates(files, options2);
|
|
43208
43572
|
if (toProcess.length === 0) {
|
|
43209
|
-
console.log(
|
|
43573
|
+
console.log(chalk241.green("All sessions already summarised."));
|
|
43210
43574
|
return;
|
|
43211
43575
|
}
|
|
43212
43576
|
console.log(
|
|
43213
|
-
|
|
43577
|
+
chalk241.cyan(
|
|
43214
43578
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
43215
43579
|
)
|
|
43216
43580
|
);
|
|
43217
43581
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
43218
43582
|
console.log(
|
|
43219
|
-
|
|
43583
|
+
chalk241.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk241.yellow(`, ${failed2} skipped`) : "")
|
|
43220
43584
|
);
|
|
43221
43585
|
}
|
|
43222
43586
|
function selectCandidates(files, options2) {
|
|
@@ -43236,16 +43600,16 @@ function processSessions(files) {
|
|
|
43236
43600
|
let failed2 = 0;
|
|
43237
43601
|
for (let i = 0; i < files.length; i++) {
|
|
43238
43602
|
const file = files[i];
|
|
43239
|
-
process.stdout.write(
|
|
43603
|
+
process.stdout.write(chalk241.dim(` [${i + 1}/${files.length}] `));
|
|
43240
43604
|
const summary = summariseSession(file);
|
|
43241
43605
|
if (summary) {
|
|
43242
43606
|
writeSummary(file, summary);
|
|
43243
43607
|
succeeded++;
|
|
43244
|
-
process.stdout.write(`${
|
|
43608
|
+
process.stdout.write(`${chalk241.green("\u2713")} ${summary}
|
|
43245
43609
|
`);
|
|
43246
43610
|
} else {
|
|
43247
43611
|
failed2++;
|
|
43248
|
-
process.stdout.write(` ${
|
|
43612
|
+
process.stdout.write(` ${chalk241.yellow("skip")}
|
|
43249
43613
|
`);
|
|
43250
43614
|
}
|
|
43251
43615
|
}
|
|
@@ -43272,7 +43636,7 @@ function registerSessions(program2) {
|
|
|
43272
43636
|
}
|
|
43273
43637
|
|
|
43274
43638
|
// src/commands/statusLine.ts
|
|
43275
|
-
import
|
|
43639
|
+
import chalk243 from "chalk";
|
|
43276
43640
|
|
|
43277
43641
|
// src/shared/contextLevel.ts
|
|
43278
43642
|
function contextLevel(pct) {
|
|
@@ -43282,7 +43646,7 @@ function contextLevel(pct) {
|
|
|
43282
43646
|
}
|
|
43283
43647
|
|
|
43284
43648
|
// src/commands/buildLimitsSegment.ts
|
|
43285
|
-
import
|
|
43649
|
+
import chalk242 from "chalk";
|
|
43286
43650
|
|
|
43287
43651
|
// src/shared/rateLimitLevel.ts
|
|
43288
43652
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -43320,9 +43684,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
43320
43684
|
|
|
43321
43685
|
// src/commands/buildLimitsSegment.ts
|
|
43322
43686
|
var LEVEL_COLOR = {
|
|
43323
|
-
ok:
|
|
43324
|
-
warn:
|
|
43325
|
-
over:
|
|
43687
|
+
ok: chalk242.green,
|
|
43688
|
+
warn: chalk242.yellow,
|
|
43689
|
+
over: chalk242.red
|
|
43326
43690
|
};
|
|
43327
43691
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
43328
43692
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -43418,7 +43782,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
43418
43782
|
}
|
|
43419
43783
|
|
|
43420
43784
|
// src/commands/statusLine.ts
|
|
43421
|
-
|
|
43785
|
+
chalk243.level = 3;
|
|
43422
43786
|
function formatNumber(num) {
|
|
43423
43787
|
return num.toLocaleString("en-US");
|
|
43424
43788
|
}
|
|
@@ -43426,9 +43790,9 @@ function colorizePercent(pct) {
|
|
|
43426
43790
|
const label2 = `${Math.round(pct)}%`;
|
|
43427
43791
|
switch (contextLevel(pct)) {
|
|
43428
43792
|
case "red":
|
|
43429
|
-
return
|
|
43793
|
+
return chalk243.red(label2);
|
|
43430
43794
|
case "yellow":
|
|
43431
|
-
return
|
|
43795
|
+
return chalk243.yellow(label2);
|
|
43432
43796
|
default:
|
|
43433
43797
|
return label2;
|
|
43434
43798
|
}
|
|
@@ -43441,7 +43805,7 @@ async function statusLine() {
|
|
|
43441
43805
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
43442
43806
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
43443
43807
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
43444
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
43808
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk243.cyan(branch2)} | ` : "";
|
|
43445
43809
|
console.log(
|
|
43446
43810
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
43447
43811
|
);
|
|
@@ -43511,10 +43875,10 @@ async function update2() {
|
|
|
43511
43875
|
}
|
|
43512
43876
|
|
|
43513
43877
|
// src/reportCliError.ts
|
|
43514
|
-
import
|
|
43878
|
+
import chalk244 from "chalk";
|
|
43515
43879
|
function reportCliError(error) {
|
|
43516
43880
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
43517
|
-
console.error(
|
|
43881
|
+
console.error(chalk244.red(error.message));
|
|
43518
43882
|
} else {
|
|
43519
43883
|
console.error(error);
|
|
43520
43884
|
}
|