@staff0rd/assist 0.683.0 → 0.684.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/allowed.cli-reads +1 -0
- package/claude/commands/releases-configure.md +73 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +493 -311
- 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.684.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3066,7 +3066,7 @@ var refactorConfigHelp = [
|
|
|
3066
3066
|
var releasesConfigHelp = [
|
|
3067
3067
|
{
|
|
3068
3068
|
key: "releases.streams",
|
|
3069
|
-
setter: "assist releases
|
|
3069
|
+
setter: "assist releases configure --streams <file>",
|
|
3070
3070
|
note: "promotion streams the /releases page draws; each names a repo, its release workflow, its nodes and the edges between them"
|
|
3071
3071
|
}
|
|
3072
3072
|
];
|
|
@@ -12127,7 +12127,7 @@ import { execFile as execFile5 } from "child_process";
|
|
|
12127
12127
|
import { promisify as promisify5 } from "util";
|
|
12128
12128
|
var execFileAsync4 = promisify5(execFile5);
|
|
12129
12129
|
var CACHE_TTL_MS4 = 3e4;
|
|
12130
|
-
function createCachedGhJson(args,
|
|
12130
|
+
function createCachedGhJson(args, parse5, fallback, options2 = {}) {
|
|
12131
12131
|
const { cacheFallback = true } = options2;
|
|
12132
12132
|
const cache6 = /* @__PURE__ */ new Map();
|
|
12133
12133
|
return async (cwd, extraArgs = []) => {
|
|
@@ -12142,7 +12142,7 @@ function createCachedGhJson(args, parse4, fallback, options2 = {}) {
|
|
|
12142
12142
|
windowsHide: true,
|
|
12143
12143
|
cwd: toGitCwd(cwd)
|
|
12144
12144
|
});
|
|
12145
|
-
value =
|
|
12145
|
+
value = parse5(stdout);
|
|
12146
12146
|
} catch {
|
|
12147
12147
|
value = fallback;
|
|
12148
12148
|
}
|
|
@@ -17529,6 +17529,12 @@ function appliesFixStructure(command) {
|
|
|
17529
17529
|
return APPLY_RE.test(command);
|
|
17530
17530
|
}
|
|
17531
17531
|
|
|
17532
|
+
// src/shared/configuresReleases.ts
|
|
17533
|
+
var CONFIGURE_RE = /^assist\s+releases\s+configure\b/;
|
|
17534
|
+
function configuresReleases(command) {
|
|
17535
|
+
return CONFIGURE_RE.test(command);
|
|
17536
|
+
}
|
|
17537
|
+
|
|
17532
17538
|
// src/shared/isGhApiRead.ts
|
|
17533
17539
|
var READ_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
17534
17540
|
var BODY_FLAGS2 = /* @__PURE__ */ new Set(["-f", "-F", "--field", "--raw-field", "--input"]);
|
|
@@ -17716,6 +17722,7 @@ function isApprovedRead(command, toolName = "Bash") {
|
|
|
17716
17722
|
const cdRead = isCdToReadAllowedDir(command);
|
|
17717
17723
|
if (cdRead) return cdRead;
|
|
17718
17724
|
if (appliesFixStructure(command)) return void 0;
|
|
17725
|
+
if (configuresReleases(command)) return void 0;
|
|
17719
17726
|
const matchedRead = findCliRead(command);
|
|
17720
17727
|
if (matchedRead) return `Read-only CLI command: ${matchedRead}`;
|
|
17721
17728
|
const matchedWrite = findCliWrite(command);
|
|
@@ -28744,24 +28751,230 @@ function registerRavendb(program2) {
|
|
|
28744
28751
|
configHelp(cmd, ravendbConfigHelp);
|
|
28745
28752
|
}
|
|
28746
28753
|
|
|
28747
|
-
// src/commands/releases/
|
|
28754
|
+
// src/commands/releases/releasesConfigure.ts
|
|
28755
|
+
import chalk198 from "chalk";
|
|
28756
|
+
|
|
28757
|
+
// src/commands/releases/checkStreamGraph.ts
|
|
28758
|
+
function nodeIds(stream) {
|
|
28759
|
+
const nodes = Array.isArray(stream.nodes) ? stream.nodes : [];
|
|
28760
|
+
return nodes.flatMap(
|
|
28761
|
+
(node) => node !== null && typeof node === "object" && typeof node.id === "string" ? [node.id] : []
|
|
28762
|
+
);
|
|
28763
|
+
}
|
|
28764
|
+
function repeatedIds(ids) {
|
|
28765
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28766
|
+
const repeated = /* @__PURE__ */ new Set();
|
|
28767
|
+
for (const id of ids) {
|
|
28768
|
+
if (seen.has(id)) repeated.add(id);
|
|
28769
|
+
seen.add(id);
|
|
28770
|
+
}
|
|
28771
|
+
return [...repeated];
|
|
28772
|
+
}
|
|
28773
|
+
function unknownEdgeIds(stream, known) {
|
|
28774
|
+
const edges = Array.isArray(stream.edges) ? stream.edges : [];
|
|
28775
|
+
return edges.flatMap(
|
|
28776
|
+
(edge) => (Array.isArray(edge) ? edge : []).filter(
|
|
28777
|
+
(id) => typeof id === "string" && !known.has(id)
|
|
28778
|
+
)
|
|
28779
|
+
);
|
|
28780
|
+
}
|
|
28781
|
+
function checkStreamGraph(streams) {
|
|
28782
|
+
return streams.flatMap((stream, index3) => {
|
|
28783
|
+
const where = typeof stream.name === "string" ? stream.name : `stream ${index3}`;
|
|
28784
|
+
const ids = nodeIds(stream);
|
|
28785
|
+
return [
|
|
28786
|
+
...repeatedIds(ids).map((id) => `${where}: duplicate node id "${id}"`),
|
|
28787
|
+
...unknownEdgeIds(stream, new Set(ids)).map(
|
|
28788
|
+
(id) => `${where}: edge refers to unknown node "${id}"`
|
|
28789
|
+
)
|
|
28790
|
+
];
|
|
28791
|
+
});
|
|
28792
|
+
}
|
|
28793
|
+
|
|
28794
|
+
// src/commands/releases/readStreamsInput.ts
|
|
28795
|
+
import { readFileSync as readFileSync47 } from "fs";
|
|
28796
|
+
import { parse as parse4 } from "yaml";
|
|
28797
|
+
function readSource2(source) {
|
|
28798
|
+
return readFileSync47(source === "-" ? 0 : source, "utf8");
|
|
28799
|
+
}
|
|
28800
|
+
function readStreamsInput(source) {
|
|
28801
|
+
let parsed;
|
|
28802
|
+
try {
|
|
28803
|
+
parsed = parse4(readSource2(source));
|
|
28804
|
+
} catch (error) {
|
|
28805
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
28806
|
+
}
|
|
28807
|
+
if (!Array.isArray(parsed))
|
|
28808
|
+
return { error: `Expected an array of streams, got ${typeof parsed}.` };
|
|
28809
|
+
const bad = parsed.findIndex(
|
|
28810
|
+
(s) => s === null || typeof s !== "object" || Array.isArray(s)
|
|
28811
|
+
);
|
|
28812
|
+
if (bad !== -1) return { error: `Stream ${bad} is not an object.` };
|
|
28813
|
+
return { streams: parsed };
|
|
28814
|
+
}
|
|
28815
|
+
|
|
28816
|
+
// src/commands/releases/reportDerivedStreams.ts
|
|
28748
28817
|
import chalk197 from "chalk";
|
|
28818
|
+
function printDerived(stream) {
|
|
28819
|
+
const environments = stream.nodes.flatMap((n) => n.environment ?? []);
|
|
28820
|
+
const steps = stream.nodes.filter((n) => !n.environment);
|
|
28821
|
+
console.log(
|
|
28822
|
+
`${chalk197.bold(stream.name)} ${chalk197.dim(`${stream.repo} \xB7 ${stream.workflow}`)}`
|
|
28823
|
+
);
|
|
28824
|
+
console.log(
|
|
28825
|
+
` environments: ${environments.join(", ") || chalk197.dim("none")}`
|
|
28826
|
+
);
|
|
28827
|
+
if (steps.length > 0)
|
|
28828
|
+
console.log(
|
|
28829
|
+
` steps: ${steps.map((n) => `${n.id} [${n.kind ?? "step"}]`).join(", ")}`
|
|
28830
|
+
);
|
|
28831
|
+
const edges = stream.edges.map(([from, to]) => `${from} \u2192 ${to}`);
|
|
28832
|
+
console.log(` edges: ${edges.join(", ") || chalk197.dim("none")}`);
|
|
28833
|
+
}
|
|
28834
|
+
function reportDerivedStreams(streams, target) {
|
|
28835
|
+
for (const stream of streams) printDerived(stream);
|
|
28836
|
+
console.log(chalk197.dim(`Written to ${target}`));
|
|
28837
|
+
}
|
|
28838
|
+
|
|
28839
|
+
// src/commands/releases/withCurrentRepo.ts
|
|
28840
|
+
function withCurrentRepo(streams) {
|
|
28841
|
+
if (streams.every((stream) => typeof stream.repo === "string"))
|
|
28842
|
+
return streams;
|
|
28843
|
+
const { org, repo } = getRepoInfo();
|
|
28844
|
+
return streams.map((stream) => ({ repo: `${org}/${repo}`, ...stream }));
|
|
28845
|
+
}
|
|
28846
|
+
|
|
28847
|
+
// src/commands/config/applyConfigWrites.ts
|
|
28848
|
+
function applyConfigWrites(base, writes, schema2) {
|
|
28849
|
+
let updated2 = base;
|
|
28850
|
+
for (const write of writes) {
|
|
28851
|
+
updated2 = setNestedValue(updated2, write.key, write.value);
|
|
28852
|
+
const validation = validateConfig(updated2, write.key, schema2);
|
|
28853
|
+
if (!validation.ok) return validation;
|
|
28854
|
+
}
|
|
28855
|
+
return { ok: true, updated: updated2 };
|
|
28856
|
+
}
|
|
28857
|
+
|
|
28858
|
+
// src/commands/config/writeConfigKeys.ts
|
|
28859
|
+
function writeConfigKeys(writes, scope, cwd = process.cwd(), globalConfigPath) {
|
|
28860
|
+
const globalOnly = writes.filter((write) => isGlobalOnlyConfigKey(write.key));
|
|
28861
|
+
if (globalOnly.length > 0) {
|
|
28862
|
+
return {
|
|
28863
|
+
ok: false,
|
|
28864
|
+
errors: globalOnly.map(
|
|
28865
|
+
(write) => `"${write.key}" is a global-only key. Set it with 'assist config set ${write.key} <value> -g'`
|
|
28866
|
+
)
|
|
28867
|
+
};
|
|
28868
|
+
}
|
|
28869
|
+
if (scope === "repo") return writeRepoBlock(writes, cwd, globalConfigPath);
|
|
28870
|
+
const applied = applyConfigWrites(loadProjectConfig(cwd), writes);
|
|
28871
|
+
if (!applied.ok) return applied;
|
|
28872
|
+
saveConfig(applied.updated, cwd);
|
|
28873
|
+
return { ok: true, target: "project assist.yml" };
|
|
28874
|
+
}
|
|
28875
|
+
function writeRepoBlock(writes, cwd, globalConfigPath) {
|
|
28876
|
+
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
28877
|
+
void 0,
|
|
28878
|
+
cwd,
|
|
28879
|
+
globalConfigPath
|
|
28880
|
+
);
|
|
28881
|
+
const applied = applyConfigWrites(block, writes, repoConfigSchema);
|
|
28882
|
+
if (!applied.ok) return applied;
|
|
28883
|
+
repos2[label2] = applied.updated;
|
|
28884
|
+
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
28885
|
+
return { ok: true, target: `~/.assist.yml, repo: ${label2}` };
|
|
28886
|
+
}
|
|
28887
|
+
|
|
28888
|
+
// src/commands/releases/declaredStreamsInScope.ts
|
|
28889
|
+
function streamsOf(block) {
|
|
28890
|
+
const releases = block.releases;
|
|
28891
|
+
if (releases === null || typeof releases !== "object") return [];
|
|
28892
|
+
const streams = releases.streams;
|
|
28893
|
+
return Array.isArray(streams) ? streams : [];
|
|
28894
|
+
}
|
|
28895
|
+
function declaredStreamsInScope(scope, cwd = process.cwd()) {
|
|
28896
|
+
if (scope === "repo")
|
|
28897
|
+
return streamsOf(resolveRepoConfigBlock(void 0, cwd).block);
|
|
28898
|
+
return streamsOf(loadProjectConfig(cwd));
|
|
28899
|
+
}
|
|
28900
|
+
|
|
28901
|
+
// src/commands/releases/mergeRepoStreams.ts
|
|
28902
|
+
function repoOf(stream) {
|
|
28903
|
+
return typeof stream.repo === "string" ? stream.repo.toLowerCase() : "";
|
|
28904
|
+
}
|
|
28905
|
+
function mergeRepoStreams(declared, incoming) {
|
|
28906
|
+
const replaced = new Set(incoming.map(repoOf));
|
|
28907
|
+
return [
|
|
28908
|
+
...declared.filter((stream) => !replaced.has(repoOf(stream))),
|
|
28909
|
+
...incoming
|
|
28910
|
+
];
|
|
28911
|
+
}
|
|
28912
|
+
|
|
28913
|
+
// src/commands/releases/writeReleaseStreams.ts
|
|
28914
|
+
function writeReleaseStreams(incoming, scope) {
|
|
28915
|
+
return writeConfigKeys(
|
|
28916
|
+
[
|
|
28917
|
+
{
|
|
28918
|
+
key: "releases.streams",
|
|
28919
|
+
value: mergeRepoStreams(declaredStreamsInScope(scope), incoming)
|
|
28920
|
+
}
|
|
28921
|
+
],
|
|
28922
|
+
scope
|
|
28923
|
+
);
|
|
28924
|
+
}
|
|
28925
|
+
|
|
28926
|
+
// src/commands/releases/releasesConfigure.ts
|
|
28927
|
+
function fail6(message3, details = []) {
|
|
28928
|
+
console.error(chalk198.red(message3));
|
|
28929
|
+
for (const detail of details) console.error(chalk198.red(` ${detail}`));
|
|
28930
|
+
process.exitCode = 1;
|
|
28931
|
+
}
|
|
28932
|
+
function reportWritten(incoming, target) {
|
|
28933
|
+
const repos2 = new Set(incoming.map((s) => String(s.repo).toLowerCase()));
|
|
28934
|
+
const declared = loadConfig().releases?.streams ?? [];
|
|
28935
|
+
reportDerivedStreams(
|
|
28936
|
+
declared.filter((s) => repos2.has(s.repo.toLowerCase())),
|
|
28937
|
+
target
|
|
28938
|
+
);
|
|
28939
|
+
}
|
|
28940
|
+
function releasesConfigure(options2 = {}) {
|
|
28941
|
+
const scope = options2.scope === "repo" ? "repo" : "project";
|
|
28942
|
+
const input = readStreamsInput(options2.streams ?? "-");
|
|
28943
|
+
if ("error" in input) return fail6(`Could not read --streams: ${input.error}`);
|
|
28944
|
+
const incoming = withCurrentRepo(input.streams);
|
|
28945
|
+
const broken = checkStreamGraph(incoming);
|
|
28946
|
+
if (broken.length > 0)
|
|
28947
|
+
return fail6(
|
|
28948
|
+
"The graph does not hold together, so nothing was written:",
|
|
28949
|
+
broken
|
|
28950
|
+
);
|
|
28951
|
+
const written = writeReleaseStreams(incoming, scope);
|
|
28952
|
+
if (!written.ok)
|
|
28953
|
+
return fail6(
|
|
28954
|
+
"releases.streams does not validate, so nothing was written:",
|
|
28955
|
+
written.errors
|
|
28956
|
+
);
|
|
28957
|
+
reportWritten(incoming, written.target);
|
|
28958
|
+
}
|
|
28959
|
+
|
|
28960
|
+
// src/commands/releases/releasesList.ts
|
|
28961
|
+
import chalk199 from "chalk";
|
|
28749
28962
|
function describeNode(node) {
|
|
28750
28963
|
if (node.environment) return `${node.id} \u2192 ${node.environment}`;
|
|
28751
28964
|
return `${node.id} (${node.kind ?? "step"})`;
|
|
28752
28965
|
}
|
|
28753
28966
|
function printStream(stream) {
|
|
28754
|
-
console.log(`${
|
|
28755
|
-
console.log(
|
|
28967
|
+
console.log(`${chalk199.bold(stream.name)} ${chalk199.dim(stream.repo)}`);
|
|
28968
|
+
console.log(chalk199.dim(` workflow: ${stream.workflow}`));
|
|
28756
28969
|
for (const node of stream.nodes) console.log(` ${describeNode(node)}`);
|
|
28757
28970
|
for (const [from, to] of stream.edges)
|
|
28758
|
-
console.log(
|
|
28971
|
+
console.log(chalk199.dim(` ${from} \u2192 ${to}`));
|
|
28759
28972
|
}
|
|
28760
28973
|
function releasesList() {
|
|
28761
28974
|
const streams = loadConfig().releases?.streams ?? [];
|
|
28762
28975
|
if (streams.length === 0) {
|
|
28763
28976
|
console.log(
|
|
28764
|
-
|
|
28977
|
+
chalk199.dim("No release streams configured under releases.streams.")
|
|
28765
28978
|
);
|
|
28766
28979
|
return;
|
|
28767
28980
|
}
|
|
@@ -28774,9 +28987,19 @@ function registerReleases(parent) {
|
|
|
28774
28987
|
configHelp(
|
|
28775
28988
|
releasesCommand,
|
|
28776
28989
|
releasesConfigHelp,
|
|
28777
|
-
"Streams are declared by
|
|
28990
|
+
"Streams are declared by '/releases-configure', which derives them from the repo's workflows and writes them with 'assist releases configure', and rendered by the /releases page of the sessions dashboard."
|
|
28778
28991
|
);
|
|
28779
28992
|
releasesCommand.command("list").description("List the declared release streams, their nodes and edges").action(releasesList);
|
|
28993
|
+
releasesCommand.command("configure").description(
|
|
28994
|
+
"Validate release streams and write them to releases.streams for the current repo"
|
|
28995
|
+
).requiredOption(
|
|
28996
|
+
"--streams <file>",
|
|
28997
|
+
"JSON or YAML array of streams to declare; '-' reads stdin"
|
|
28998
|
+
).option(
|
|
28999
|
+
"--scope <project|repo>",
|
|
29000
|
+
"project assist.yml or ~/.assist.yml repo block",
|
|
29001
|
+
"project"
|
|
29002
|
+
).action(releasesConfigure);
|
|
28780
29003
|
}
|
|
28781
29004
|
|
|
28782
29005
|
// src/commands/coverage.ts
|
|
@@ -28796,7 +29019,7 @@ function coverage() {
|
|
|
28796
29019
|
|
|
28797
29020
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
28798
29021
|
import path45 from "path";
|
|
28799
|
-
import
|
|
29022
|
+
import chalk201 from "chalk";
|
|
28800
29023
|
|
|
28801
29024
|
// src/commands/lint/lint/checkFileNames.ts
|
|
28802
29025
|
import fs25 from "fs";
|
|
@@ -28876,7 +29099,7 @@ function checkFileNames() {
|
|
|
28876
29099
|
}
|
|
28877
29100
|
|
|
28878
29101
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
28879
|
-
import
|
|
29102
|
+
import chalk200 from "chalk";
|
|
28880
29103
|
|
|
28881
29104
|
// src/commands/lint/lint/applyMoves.ts
|
|
28882
29105
|
import fs26 from "fs";
|
|
@@ -28961,25 +29184,25 @@ function fixFileNameViolations(moves) {
|
|
|
28961
29184
|
const start3 = performance.now();
|
|
28962
29185
|
const project = createLintProject();
|
|
28963
29186
|
const cwd = process.cwd();
|
|
28964
|
-
applyMoves(project, moves, cwd, (line) => console.log(
|
|
29187
|
+
applyMoves(project, moves, cwd, (line) => console.log(chalk200.green(line)));
|
|
28965
29188
|
const ms = (performance.now() - start3).toFixed(0);
|
|
28966
|
-
console.log(
|
|
29189
|
+
console.log(chalk200.dim(` Done in ${ms}ms`));
|
|
28967
29190
|
}
|
|
28968
29191
|
|
|
28969
29192
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
28970
29193
|
function reportViolations(violations) {
|
|
28971
|
-
console.error(
|
|
29194
|
+
console.error(chalk201.red("\nFile name check failed:\n"));
|
|
28972
29195
|
console.error(
|
|
28973
|
-
|
|
29196
|
+
chalk201.red(
|
|
28974
29197
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
28975
29198
|
)
|
|
28976
29199
|
);
|
|
28977
29200
|
for (const violation of violations) {
|
|
28978
|
-
console.error(
|
|
28979
|
-
console.error(
|
|
29201
|
+
console.error(chalk201.red(` ${violation.filePath}`));
|
|
29202
|
+
console.error(chalk201.gray(` Rename to: ${violation.suggestedName}
|
|
28980
29203
|
`));
|
|
28981
29204
|
}
|
|
28982
|
-
console.error(
|
|
29205
|
+
console.error(chalk201.dim(" Run with -f to auto-fix.\n"));
|
|
28983
29206
|
}
|
|
28984
29207
|
function runFileNameCheck(fix = false) {
|
|
28985
29208
|
const violations = checkFileNames();
|
|
@@ -29008,17 +29231,17 @@ function runFileNameCheck(fix = false) {
|
|
|
29008
29231
|
import fs28 from "fs";
|
|
29009
29232
|
|
|
29010
29233
|
// src/commands/lint/shared.ts
|
|
29011
|
-
import
|
|
29234
|
+
import chalk202 from "chalk";
|
|
29012
29235
|
function reportViolations2(violations, checkName2, errorMessage2, successMessage) {
|
|
29013
29236
|
if (violations.length > 0) {
|
|
29014
|
-
console.error(
|
|
29237
|
+
console.error(chalk202.red(`
|
|
29015
29238
|
${checkName2} failed:
|
|
29016
29239
|
`));
|
|
29017
|
-
console.error(
|
|
29240
|
+
console.error(chalk202.red(` ${errorMessage2}
|
|
29018
29241
|
`));
|
|
29019
29242
|
for (const violation of violations) {
|
|
29020
|
-
console.error(
|
|
29021
|
-
console.error(
|
|
29243
|
+
console.error(chalk202.red(` ${violation.filePath}:${violation.line}`));
|
|
29244
|
+
console.error(chalk202.gray(` ${violation.content}
|
|
29022
29245
|
`));
|
|
29023
29246
|
}
|
|
29024
29247
|
return false;
|
|
@@ -29149,7 +29372,7 @@ import { execSync as execSync57 } from "child_process";
|
|
|
29149
29372
|
import { existsSync as existsSync63, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
29150
29373
|
import { tmpdir as tmpdir9 } from "os";
|
|
29151
29374
|
import { join as join75, resolve as resolve19 } from "path";
|
|
29152
|
-
import
|
|
29375
|
+
import chalk203 from "chalk";
|
|
29153
29376
|
|
|
29154
29377
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
29155
29378
|
var captureWindowPs1 = `
|
|
@@ -29300,19 +29523,19 @@ function screenshot(processName) {
|
|
|
29300
29523
|
const config = loadConfig();
|
|
29301
29524
|
const outputDir = resolve19(config.screenshot.outputDir);
|
|
29302
29525
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
29303
|
-
console.log(
|
|
29526
|
+
console.log(chalk203.gray(`Capturing window for process "${processName}" ...`));
|
|
29304
29527
|
try {
|
|
29305
29528
|
runPowerShellScript(processName, outputPath);
|
|
29306
|
-
console.log(
|
|
29529
|
+
console.log(chalk203.green(`Screenshot saved: ${outputPath}`));
|
|
29307
29530
|
} catch (error) {
|
|
29308
29531
|
const msg = error instanceof Error ? error.message : String(error);
|
|
29309
|
-
console.error(
|
|
29532
|
+
console.error(chalk203.red(`Failed to capture screenshot: ${msg}`));
|
|
29310
29533
|
process.exit(1);
|
|
29311
29534
|
}
|
|
29312
29535
|
}
|
|
29313
29536
|
|
|
29314
29537
|
// src/commands/statusLine.ts
|
|
29315
|
-
import
|
|
29538
|
+
import chalk205 from "chalk";
|
|
29316
29539
|
|
|
29317
29540
|
// src/shared/contextLevel.ts
|
|
29318
29541
|
function contextLevel(pct) {
|
|
@@ -29322,7 +29545,7 @@ function contextLevel(pct) {
|
|
|
29322
29545
|
}
|
|
29323
29546
|
|
|
29324
29547
|
// src/commands/buildLimitsSegment.ts
|
|
29325
|
-
import
|
|
29548
|
+
import chalk204 from "chalk";
|
|
29326
29549
|
|
|
29327
29550
|
// src/shared/rateLimitLevel.ts
|
|
29328
29551
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -29360,9 +29583,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
29360
29583
|
|
|
29361
29584
|
// src/commands/buildLimitsSegment.ts
|
|
29362
29585
|
var LEVEL_COLOR = {
|
|
29363
|
-
ok:
|
|
29364
|
-
warn:
|
|
29365
|
-
over:
|
|
29586
|
+
ok: chalk204.green,
|
|
29587
|
+
warn: chalk204.yellow,
|
|
29588
|
+
over: chalk204.red
|
|
29366
29589
|
};
|
|
29367
29590
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
29368
29591
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -29393,7 +29616,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
29393
29616
|
}
|
|
29394
29617
|
|
|
29395
29618
|
// src/commands/readGitBranch.ts
|
|
29396
|
-
import { readFileSync as
|
|
29619
|
+
import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
|
|
29397
29620
|
import { isAbsolute as isAbsolute5, join as join76, resolve as resolve20 } from "path";
|
|
29398
29621
|
function resolveGitDir(cwd) {
|
|
29399
29622
|
const dotGit = join76(cwd, ".git");
|
|
@@ -29408,7 +29631,7 @@ function resolveGitDir(cwd) {
|
|
|
29408
29631
|
}
|
|
29409
29632
|
let contents;
|
|
29410
29633
|
try {
|
|
29411
|
-
contents =
|
|
29634
|
+
contents = readFileSync48(dotGit, "utf8");
|
|
29412
29635
|
} catch {
|
|
29413
29636
|
return null;
|
|
29414
29637
|
}
|
|
@@ -29426,7 +29649,7 @@ function readGitBranch(cwd) {
|
|
|
29426
29649
|
}
|
|
29427
29650
|
let head;
|
|
29428
29651
|
try {
|
|
29429
|
-
head =
|
|
29652
|
+
head = readFileSync48(join76(gitDir, "HEAD"), "utf8");
|
|
29430
29653
|
} catch {
|
|
29431
29654
|
return null;
|
|
29432
29655
|
}
|
|
@@ -29458,7 +29681,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
29458
29681
|
}
|
|
29459
29682
|
|
|
29460
29683
|
// src/commands/statusLine.ts
|
|
29461
|
-
|
|
29684
|
+
chalk205.level = 3;
|
|
29462
29685
|
function formatNumber(num) {
|
|
29463
29686
|
return num.toLocaleString("en-US");
|
|
29464
29687
|
}
|
|
@@ -29466,9 +29689,9 @@ function colorizePercent(pct) {
|
|
|
29466
29689
|
const label2 = `${Math.round(pct)}%`;
|
|
29467
29690
|
switch (contextLevel(pct)) {
|
|
29468
29691
|
case "red":
|
|
29469
|
-
return
|
|
29692
|
+
return chalk205.red(label2);
|
|
29470
29693
|
case "yellow":
|
|
29471
|
-
return
|
|
29694
|
+
return chalk205.yellow(label2);
|
|
29472
29695
|
default:
|
|
29473
29696
|
return label2;
|
|
29474
29697
|
}
|
|
@@ -29481,7 +29704,7 @@ async function statusLine() {
|
|
|
29481
29704
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
29482
29705
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
29483
29706
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
29484
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
29707
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk205.cyan(branch2)} | ` : "";
|
|
29485
29708
|
console.log(
|
|
29486
29709
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
29487
29710
|
);
|
|
@@ -29584,7 +29807,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
29584
29807
|
import * as path47 from "path";
|
|
29585
29808
|
|
|
29586
29809
|
// src/commands/refactor/logViolations.ts
|
|
29587
|
-
import
|
|
29810
|
+
import chalk206 from "chalk";
|
|
29588
29811
|
var DEFAULT_MAX_LINES2 = 100;
|
|
29589
29812
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
29590
29813
|
if (violations.length === 0) {
|
|
@@ -29593,43 +29816,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
29593
29816
|
}
|
|
29594
29817
|
return;
|
|
29595
29818
|
}
|
|
29596
|
-
console.error(
|
|
29819
|
+
console.error(chalk206.red(`
|
|
29597
29820
|
Refactor check failed:
|
|
29598
29821
|
`));
|
|
29599
|
-
console.error(
|
|
29822
|
+
console.error(chalk206.red(` The following files exceed ${maxLines} lines:
|
|
29600
29823
|
`));
|
|
29601
29824
|
for (const violation of violations) {
|
|
29602
|
-
console.error(
|
|
29825
|
+
console.error(chalk206.red(` ${violation.file} (${violation.lines} lines)`));
|
|
29603
29826
|
}
|
|
29604
29827
|
console.error(
|
|
29605
|
-
|
|
29828
|
+
chalk206.yellow(
|
|
29606
29829
|
`
|
|
29607
29830
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
29608
29831
|
way to refactor it, ignore it with:
|
|
29609
29832
|
`
|
|
29610
29833
|
)
|
|
29611
29834
|
);
|
|
29612
|
-
console.error(
|
|
29835
|
+
console.error(chalk206.gray(` assist refactor ignore <file>
|
|
29613
29836
|
`));
|
|
29614
29837
|
if (process.env.CLAUDECODE) {
|
|
29615
|
-
console.error(
|
|
29838
|
+
console.error(chalk206.cyan(`
|
|
29616
29839
|
## Extracting Code to New Files
|
|
29617
29840
|
`));
|
|
29618
29841
|
console.error(
|
|
29619
|
-
|
|
29842
|
+
chalk206.cyan(
|
|
29620
29843
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
29621
29844
|
`
|
|
29622
29845
|
)
|
|
29623
29846
|
);
|
|
29624
29847
|
console.error(
|
|
29625
|
-
|
|
29848
|
+
chalk206.cyan(
|
|
29626
29849
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
29627
29850
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
29628
29851
|
`
|
|
29629
29852
|
)
|
|
29630
29853
|
);
|
|
29631
29854
|
console.error(
|
|
29632
|
-
|
|
29855
|
+
chalk206.cyan(
|
|
29633
29856
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
29634
29857
|
domains, move it to a common/shared folder.
|
|
29635
29858
|
`
|
|
@@ -29785,7 +30008,7 @@ async function check(pattern2, options2) {
|
|
|
29785
30008
|
|
|
29786
30009
|
// src/commands/refactor/extract/index.ts
|
|
29787
30010
|
import path55 from "path";
|
|
29788
|
-
import
|
|
30011
|
+
import chalk209 from "chalk";
|
|
29789
30012
|
|
|
29790
30013
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
29791
30014
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -30384,23 +30607,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
30384
30607
|
|
|
30385
30608
|
// src/commands/refactor/extract/displayPlan.ts
|
|
30386
30609
|
import path51 from "path";
|
|
30387
|
-
import
|
|
30610
|
+
import chalk207 from "chalk";
|
|
30388
30611
|
function section(title) {
|
|
30389
30612
|
return `
|
|
30390
|
-
${
|
|
30613
|
+
${chalk207.cyan(title)}`;
|
|
30391
30614
|
}
|
|
30392
30615
|
function displayImporters(plan2, cwd) {
|
|
30393
30616
|
if (plan2.importersToUpdate.length === 0) return;
|
|
30394
30617
|
console.log(section("Update importers:"));
|
|
30395
30618
|
for (const imp of plan2.importersToUpdate) {
|
|
30396
30619
|
const rel = path51.relative(cwd, imp.file.getFilePath());
|
|
30397
|
-
console.log(` ${
|
|
30620
|
+
console.log(` ${chalk207.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
30398
30621
|
}
|
|
30399
30622
|
}
|
|
30400
30623
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
30401
|
-
console.log(
|
|
30624
|
+
console.log(chalk207.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
30402
30625
|
`));
|
|
30403
|
-
console.log(` ${
|
|
30626
|
+
console.log(` ${chalk207.cyan("Functions to move:")}`);
|
|
30404
30627
|
for (const name of plan2.extractedNames) {
|
|
30405
30628
|
console.log(` ${name}`);
|
|
30406
30629
|
}
|
|
@@ -30434,7 +30657,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
30434
30657
|
|
|
30435
30658
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
30436
30659
|
import path54 from "path";
|
|
30437
|
-
import
|
|
30660
|
+
import chalk208 from "chalk";
|
|
30438
30661
|
import { Project as Project4 } from "ts-morph";
|
|
30439
30662
|
|
|
30440
30663
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -30526,7 +30749,7 @@ function loadProjectFile(file) {
|
|
|
30526
30749
|
});
|
|
30527
30750
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
30528
30751
|
if (!sourceFile) {
|
|
30529
|
-
console.log(
|
|
30752
|
+
console.log(chalk208.red(`File not found in project: ${file}`));
|
|
30530
30753
|
process.exit(1);
|
|
30531
30754
|
}
|
|
30532
30755
|
return { project, sourceFile };
|
|
@@ -30549,19 +30772,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
30549
30772
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
30550
30773
|
if (options2.apply) {
|
|
30551
30774
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
30552
|
-
console.log(
|
|
30775
|
+
console.log(chalk209.green("\nExtraction complete"));
|
|
30553
30776
|
} else {
|
|
30554
|
-
console.log(
|
|
30777
|
+
console.log(chalk209.dim("\nDry run. Use --apply to execute."));
|
|
30555
30778
|
}
|
|
30556
30779
|
}
|
|
30557
30780
|
|
|
30558
30781
|
// src/commands/refactor/ignore.ts
|
|
30559
30782
|
import fs34 from "fs";
|
|
30560
|
-
import
|
|
30783
|
+
import chalk210 from "chalk";
|
|
30561
30784
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
30562
30785
|
function ignore2(file) {
|
|
30563
30786
|
if (!fs34.existsSync(file)) {
|
|
30564
|
-
console.error(
|
|
30787
|
+
console.error(chalk210.red(`Error: File does not exist: ${file}`));
|
|
30565
30788
|
process.exit(1);
|
|
30566
30789
|
}
|
|
30567
30790
|
const content = fs34.readFileSync(file, "utf8");
|
|
@@ -30577,7 +30800,7 @@ function ignore2(file) {
|
|
|
30577
30800
|
fs34.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
30578
30801
|
}
|
|
30579
30802
|
console.log(
|
|
30580
|
-
|
|
30803
|
+
chalk210.green(
|
|
30581
30804
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
30582
30805
|
)
|
|
30583
30806
|
);
|
|
@@ -30586,12 +30809,12 @@ function ignore2(file) {
|
|
|
30586
30809
|
// src/commands/refactor/rename/index.ts
|
|
30587
30810
|
import fs37 from "fs";
|
|
30588
30811
|
import path60 from "path";
|
|
30589
|
-
import
|
|
30812
|
+
import chalk213 from "chalk";
|
|
30590
30813
|
|
|
30591
30814
|
// src/commands/refactor/rename/applyRename.ts
|
|
30592
30815
|
import fs36 from "fs";
|
|
30593
30816
|
import path57 from "path";
|
|
30594
|
-
import
|
|
30817
|
+
import chalk211 from "chalk";
|
|
30595
30818
|
|
|
30596
30819
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
30597
30820
|
import path56 from "path";
|
|
@@ -30696,13 +30919,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
30696
30919
|
const updatedContents = applyRewrites(rewrites);
|
|
30697
30920
|
for (const [file, content] of updatedContents) {
|
|
30698
30921
|
fs36.writeFileSync(file, content, "utf8");
|
|
30699
|
-
console.log(
|
|
30922
|
+
console.log(chalk211.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
|
|
30700
30923
|
}
|
|
30701
30924
|
const destDir = path57.dirname(destPath);
|
|
30702
30925
|
if (!fs36.existsSync(destDir)) fs36.mkdirSync(destDir, { recursive: true });
|
|
30703
30926
|
fs36.renameSync(sourcePath, destPath);
|
|
30704
30927
|
console.log(
|
|
30705
|
-
|
|
30928
|
+
chalk211.white(
|
|
30706
30929
|
` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
|
|
30707
30930
|
)
|
|
30708
30931
|
);
|
|
@@ -30789,16 +31012,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
30789
31012
|
|
|
30790
31013
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
30791
31014
|
import path59 from "path";
|
|
30792
|
-
import
|
|
31015
|
+
import chalk212 from "chalk";
|
|
30793
31016
|
function printRenamePreview(rewrites, cwd) {
|
|
30794
31017
|
for (const rewrite of rewrites) {
|
|
30795
31018
|
console.log(
|
|
30796
|
-
|
|
31019
|
+
chalk212.dim(
|
|
30797
31020
|
` ${path59.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
30798
31021
|
)
|
|
30799
31022
|
);
|
|
30800
31023
|
}
|
|
30801
|
-
console.log(
|
|
31024
|
+
console.log(chalk212.dim("Dry run. Use --apply to execute."));
|
|
30802
31025
|
}
|
|
30803
31026
|
|
|
30804
31027
|
// src/commands/refactor/rename/index.ts
|
|
@@ -30809,20 +31032,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
30809
31032
|
const relSource = path60.relative(cwd, sourcePath);
|
|
30810
31033
|
const relDest = path60.relative(cwd, destPath);
|
|
30811
31034
|
if (!fs37.existsSync(sourcePath)) {
|
|
30812
|
-
console.log(
|
|
31035
|
+
console.log(chalk213.red(`File not found: ${source}`));
|
|
30813
31036
|
process.exit(1);
|
|
30814
31037
|
}
|
|
30815
31038
|
if (destPath !== sourcePath && fs37.existsSync(destPath)) {
|
|
30816
|
-
console.log(
|
|
31039
|
+
console.log(chalk213.red(`Destination already exists: ${destination}`));
|
|
30817
31040
|
process.exit(1);
|
|
30818
31041
|
}
|
|
30819
|
-
console.log(
|
|
30820
|
-
console.log(
|
|
30821
|
-
console.log(
|
|
31042
|
+
console.log(chalk213.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
31043
|
+
console.log(chalk213.dim("Loading project..."));
|
|
31044
|
+
console.log(chalk213.dim("Scanning imports across the project..."));
|
|
30822
31045
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
30823
31046
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
30824
31047
|
console.log(
|
|
30825
|
-
|
|
31048
|
+
chalk213.dim(
|
|
30826
31049
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
30827
31050
|
)
|
|
30828
31051
|
);
|
|
@@ -30831,11 +31054,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
30831
31054
|
return;
|
|
30832
31055
|
}
|
|
30833
31056
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
30834
|
-
console.log(
|
|
31057
|
+
console.log(chalk213.green("Done"));
|
|
30835
31058
|
}
|
|
30836
31059
|
|
|
30837
31060
|
// src/commands/refactor/renameSymbol/index.ts
|
|
30838
|
-
import
|
|
31061
|
+
import chalk214 from "chalk";
|
|
30839
31062
|
|
|
30840
31063
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
30841
31064
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -30881,33 +31104,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
30881
31104
|
const { project, sourceFile } = loadProjectFile(file);
|
|
30882
31105
|
const symbol = findSymbol(sourceFile, oldName);
|
|
30883
31106
|
if (!symbol) {
|
|
30884
|
-
console.log(
|
|
31107
|
+
console.log(chalk214.red(`Symbol "${oldName}" not found in ${file}`));
|
|
30885
31108
|
process.exit(1);
|
|
30886
31109
|
}
|
|
30887
31110
|
const grouped = groupReferences(symbol, cwd);
|
|
30888
31111
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
30889
31112
|
console.log(
|
|
30890
|
-
|
|
31113
|
+
chalk214.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
30891
31114
|
`)
|
|
30892
31115
|
);
|
|
30893
31116
|
for (const [refFile, lines2] of grouped) {
|
|
30894
31117
|
console.log(
|
|
30895
|
-
` ${
|
|
31118
|
+
` ${chalk214.dim(refFile)}: lines ${chalk214.cyan(lines2.join(", "))}`
|
|
30896
31119
|
);
|
|
30897
31120
|
}
|
|
30898
31121
|
if (options2.apply) {
|
|
30899
31122
|
symbol.rename(newName);
|
|
30900
31123
|
await project.save();
|
|
30901
|
-
console.log(
|
|
31124
|
+
console.log(chalk214.green(`
|
|
30902
31125
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
30903
31126
|
} else {
|
|
30904
|
-
console.log(
|
|
31127
|
+
console.log(chalk214.dim("\nDry run. Use --apply to execute."));
|
|
30905
31128
|
}
|
|
30906
31129
|
}
|
|
30907
31130
|
|
|
30908
31131
|
// src/commands/refactor/restructure/index.ts
|
|
30909
31132
|
import path68 from "path";
|
|
30910
|
-
import
|
|
31133
|
+
import chalk217 from "chalk";
|
|
30911
31134
|
|
|
30912
31135
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
30913
31136
|
import path62 from "path";
|
|
@@ -30986,50 +31209,50 @@ function clusterFiles(graph) {
|
|
|
30986
31209
|
|
|
30987
31210
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
30988
31211
|
import path64 from "path";
|
|
30989
|
-
import
|
|
31212
|
+
import chalk215 from "chalk";
|
|
30990
31213
|
function relPath(filePath) {
|
|
30991
31214
|
return path64.relative(process.cwd(), filePath);
|
|
30992
31215
|
}
|
|
30993
31216
|
function displayMoves(plan2) {
|
|
30994
31217
|
if (plan2.moves.length === 0) return;
|
|
30995
|
-
console.log(
|
|
31218
|
+
console.log(chalk215.bold("\nFile moves:"));
|
|
30996
31219
|
for (const move2 of plan2.moves) {
|
|
30997
31220
|
console.log(
|
|
30998
|
-
` ${
|
|
31221
|
+
` ${chalk215.red(relPath(move2.from))} \u2192 ${chalk215.green(relPath(move2.to))}`
|
|
30999
31222
|
);
|
|
31000
|
-
console.log(
|
|
31223
|
+
console.log(chalk215.dim(` ${move2.reason}`));
|
|
31001
31224
|
}
|
|
31002
31225
|
}
|
|
31003
31226
|
function displayRewrites(rewrites) {
|
|
31004
31227
|
if (rewrites.length === 0) return;
|
|
31005
31228
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
31006
|
-
console.log(
|
|
31229
|
+
console.log(chalk215.bold(`
|
|
31007
31230
|
Import rewrites (${affectedFiles.size} files):`));
|
|
31008
31231
|
for (const file of affectedFiles) {
|
|
31009
|
-
console.log(` ${
|
|
31232
|
+
console.log(` ${chalk215.cyan(relPath(file))}:`);
|
|
31010
31233
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
31011
31234
|
(r) => r.file === file
|
|
31012
31235
|
)) {
|
|
31013
31236
|
console.log(
|
|
31014
|
-
` ${
|
|
31237
|
+
` ${chalk215.red(`"${oldSpecifier}"`)} \u2192 ${chalk215.green(`"${newSpecifier}"`)}`
|
|
31015
31238
|
);
|
|
31016
31239
|
}
|
|
31017
31240
|
}
|
|
31018
31241
|
}
|
|
31019
31242
|
function displayPlan2(plan2) {
|
|
31020
31243
|
if (plan2.warnings.length > 0) {
|
|
31021
|
-
console.log(
|
|
31022
|
-
for (const w of plan2.warnings) console.log(
|
|
31244
|
+
console.log(chalk215.yellow("\nWarnings:"));
|
|
31245
|
+
for (const w of plan2.warnings) console.log(chalk215.yellow(` ${w}`));
|
|
31023
31246
|
}
|
|
31024
31247
|
if (plan2.newDirectories.length > 0) {
|
|
31025
|
-
console.log(
|
|
31248
|
+
console.log(chalk215.bold("\nNew directories:"));
|
|
31026
31249
|
for (const dir of plan2.newDirectories)
|
|
31027
|
-
console.log(
|
|
31250
|
+
console.log(chalk215.green(` ${dir}/`));
|
|
31028
31251
|
}
|
|
31029
31252
|
displayMoves(plan2);
|
|
31030
31253
|
displayRewrites(plan2.rewrites);
|
|
31031
31254
|
console.log(
|
|
31032
|
-
|
|
31255
|
+
chalk215.dim(
|
|
31033
31256
|
`
|
|
31034
31257
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
31035
31258
|
)
|
|
@@ -31039,18 +31262,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
31039
31262
|
// src/commands/refactor/restructure/executePlan.ts
|
|
31040
31263
|
import fs38 from "fs";
|
|
31041
31264
|
import path65 from "path";
|
|
31042
|
-
import
|
|
31265
|
+
import chalk216 from "chalk";
|
|
31043
31266
|
function executePlan(plan2) {
|
|
31044
31267
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
31045
31268
|
for (const [file, content] of updatedContents) {
|
|
31046
31269
|
fs38.writeFileSync(file, content, "utf8");
|
|
31047
31270
|
console.log(
|
|
31048
|
-
|
|
31271
|
+
chalk216.cyan(` Rewrote imports in ${path65.relative(process.cwd(), file)}`)
|
|
31049
31272
|
);
|
|
31050
31273
|
}
|
|
31051
31274
|
for (const dir of plan2.newDirectories) {
|
|
31052
31275
|
fs38.mkdirSync(dir, { recursive: true });
|
|
31053
|
-
console.log(
|
|
31276
|
+
console.log(chalk216.green(` Created ${path65.relative(process.cwd(), dir)}/`));
|
|
31054
31277
|
}
|
|
31055
31278
|
for (const move2 of plan2.moves) {
|
|
31056
31279
|
const targetDir = path65.dirname(move2.to);
|
|
@@ -31059,7 +31282,7 @@ function executePlan(plan2) {
|
|
|
31059
31282
|
}
|
|
31060
31283
|
fs38.renameSync(move2.from, move2.to);
|
|
31061
31284
|
console.log(
|
|
31062
|
-
|
|
31285
|
+
chalk216.white(
|
|
31063
31286
|
` Moved ${path65.relative(process.cwd(), move2.from)} \u2192 ${path65.relative(process.cwd(), move2.to)}`
|
|
31064
31287
|
)
|
|
31065
31288
|
);
|
|
@@ -31074,7 +31297,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
31074
31297
|
if (entries.length === 0) {
|
|
31075
31298
|
fs38.rmdirSync(dir);
|
|
31076
31299
|
console.log(
|
|
31077
|
-
|
|
31300
|
+
chalk216.dim(
|
|
31078
31301
|
` Removed empty directory ${path65.relative(process.cwd(), dir)}`
|
|
31079
31302
|
)
|
|
31080
31303
|
);
|
|
@@ -31207,22 +31430,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
31207
31430
|
const targetPattern = pattern2 ?? "src";
|
|
31208
31431
|
const files = findSourceFiles(targetPattern);
|
|
31209
31432
|
if (files.length === 0) {
|
|
31210
|
-
console.log(
|
|
31433
|
+
console.log(chalk217.yellow("No files found matching pattern"));
|
|
31211
31434
|
return;
|
|
31212
31435
|
}
|
|
31213
31436
|
const tsConfigPath = findTsConfig(path68.resolve(files[0]));
|
|
31214
31437
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
31215
31438
|
if (plan2.moves.length === 0) {
|
|
31216
|
-
console.log(
|
|
31439
|
+
console.log(chalk217.green("No restructuring needed"));
|
|
31217
31440
|
return;
|
|
31218
31441
|
}
|
|
31219
31442
|
displayPlan2(plan2);
|
|
31220
31443
|
if (options2.apply) {
|
|
31221
|
-
console.log(
|
|
31444
|
+
console.log(chalk217.bold("\nApplying changes..."));
|
|
31222
31445
|
executePlan(plan2);
|
|
31223
|
-
console.log(
|
|
31446
|
+
console.log(chalk217.green("\nRestructuring complete"));
|
|
31224
31447
|
} else {
|
|
31225
|
-
console.log(
|
|
31448
|
+
console.log(chalk217.dim("\nDry run. Use --apply to execute."));
|
|
31226
31449
|
}
|
|
31227
31450
|
}
|
|
31228
31451
|
|
|
@@ -31276,7 +31499,7 @@ async function checkoutOnlySession(number) {
|
|
|
31276
31499
|
}
|
|
31277
31500
|
|
|
31278
31501
|
// src/commands/review/highLevel/configureHighLevelReview.ts
|
|
31279
|
-
import
|
|
31502
|
+
import chalk221 from "chalk";
|
|
31280
31503
|
|
|
31281
31504
|
// src/commands/config/promptConfigScope.ts
|
|
31282
31505
|
import Enquirer3 from "enquirer";
|
|
@@ -31302,7 +31525,7 @@ async function promptConfigScope() {
|
|
|
31302
31525
|
}
|
|
31303
31526
|
|
|
31304
31527
|
// src/commands/config/resolveConfigKeyAnswer.ts
|
|
31305
|
-
import
|
|
31528
|
+
import chalk218 from "chalk";
|
|
31306
31529
|
async function resolveConfigKeyAnswer(question, supplied) {
|
|
31307
31530
|
if (supplied !== void 0) return coerceSupplied(question.key, supplied);
|
|
31308
31531
|
for (; ; ) {
|
|
@@ -31310,7 +31533,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
|
|
|
31310
31533
|
if (answer === "") return void 0;
|
|
31311
31534
|
const coercion = coerceCliConfigValue(question.key, answer);
|
|
31312
31535
|
if (coercion.ok) return coercion.value;
|
|
31313
|
-
console.error(
|
|
31536
|
+
console.error(chalk218.red(coercion.error));
|
|
31314
31537
|
}
|
|
31315
31538
|
}
|
|
31316
31539
|
function coerceSupplied(key, supplied) {
|
|
@@ -31320,47 +31543,6 @@ function coerceSupplied(key, supplied) {
|
|
|
31320
31543
|
return coercion.value;
|
|
31321
31544
|
}
|
|
31322
31545
|
|
|
31323
|
-
// src/commands/config/applyConfigWrites.ts
|
|
31324
|
-
function applyConfigWrites(base, writes, schema2) {
|
|
31325
|
-
let updated2 = base;
|
|
31326
|
-
for (const write of writes) {
|
|
31327
|
-
updated2 = setNestedValue(updated2, write.key, write.value);
|
|
31328
|
-
const validation = validateConfig(updated2, write.key, schema2);
|
|
31329
|
-
if (!validation.ok) return validation;
|
|
31330
|
-
}
|
|
31331
|
-
return { ok: true, updated: updated2 };
|
|
31332
|
-
}
|
|
31333
|
-
|
|
31334
|
-
// src/commands/config/writeConfigKeys.ts
|
|
31335
|
-
function writeConfigKeys(writes, scope, cwd = process.cwd(), globalConfigPath) {
|
|
31336
|
-
const globalOnly = writes.filter((write) => isGlobalOnlyConfigKey(write.key));
|
|
31337
|
-
if (globalOnly.length > 0) {
|
|
31338
|
-
return {
|
|
31339
|
-
ok: false,
|
|
31340
|
-
errors: globalOnly.map(
|
|
31341
|
-
(write) => `"${write.key}" is a global-only key. Set it with 'assist config set ${write.key} <value> -g'`
|
|
31342
|
-
)
|
|
31343
|
-
};
|
|
31344
|
-
}
|
|
31345
|
-
if (scope === "repo") return writeRepoBlock(writes, cwd, globalConfigPath);
|
|
31346
|
-
const applied = applyConfigWrites(loadProjectConfig(cwd), writes);
|
|
31347
|
-
if (!applied.ok) return applied;
|
|
31348
|
-
saveConfig(applied.updated, cwd);
|
|
31349
|
-
return { ok: true, target: "project assist.yml" };
|
|
31350
|
-
}
|
|
31351
|
-
function writeRepoBlock(writes, cwd, globalConfigPath) {
|
|
31352
|
-
const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
|
|
31353
|
-
void 0,
|
|
31354
|
-
cwd,
|
|
31355
|
-
globalConfigPath
|
|
31356
|
-
);
|
|
31357
|
-
const applied = applyConfigWrites(block, writes, repoConfigSchema);
|
|
31358
|
-
if (!applied.ok) return applied;
|
|
31359
|
-
repos2[label2] = applied.updated;
|
|
31360
|
-
saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
|
|
31361
|
-
return { ok: true, target: `~/.assist.yml, repo: ${label2}` };
|
|
31362
|
-
}
|
|
31363
|
-
|
|
31364
31546
|
// src/commands/config/configureConfigKeys.ts
|
|
31365
31547
|
async function configureConfigKeys(questions, options2 = {}) {
|
|
31366
31548
|
const scope = options2.scope ?? await promptConfigScope();
|
|
@@ -31412,7 +31594,7 @@ function suggestGlobs(current, proposed) {
|
|
|
31412
31594
|
}
|
|
31413
31595
|
|
|
31414
31596
|
// src/commands/review/highLevel/parseConfigureAnswers.ts
|
|
31415
|
-
import
|
|
31597
|
+
import chalk219 from "chalk";
|
|
31416
31598
|
function parseConfigureAnswers(answers) {
|
|
31417
31599
|
const known = Object.values(highLevelConfigKeys);
|
|
31418
31600
|
const parsed = {};
|
|
@@ -31430,13 +31612,13 @@ function answersCoverEveryKey(answers) {
|
|
|
31430
31612
|
return Object.values(highLevelConfigKeys).every((key) => key in answers);
|
|
31431
31613
|
}
|
|
31432
31614
|
function exitWith(message3) {
|
|
31433
|
-
console.error(
|
|
31615
|
+
console.error(chalk219.red(`Error: ${message3}.`));
|
|
31434
31616
|
process.exit(1);
|
|
31435
31617
|
}
|
|
31436
31618
|
|
|
31437
31619
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
31438
31620
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
31439
|
-
import
|
|
31621
|
+
import chalk220 from "chalk";
|
|
31440
31622
|
|
|
31441
31623
|
// src/commands/review/highLevel/buildGlobProposalPrompt.ts
|
|
31442
31624
|
function buildGlobProposalPrompt(tree) {
|
|
@@ -31529,12 +31711,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
|
|
|
31529
31711
|
const tree = summariseRepoTree(cwd);
|
|
31530
31712
|
if (tree === "") return NOTHING_PROPOSED;
|
|
31531
31713
|
console.log(
|
|
31532
|
-
|
|
31714
|
+
chalk220.dim("Asking Claude to propose globs from the repo's own tree...")
|
|
31533
31715
|
);
|
|
31534
31716
|
const output = askClaude(buildGlobProposalPrompt(tree), cwd);
|
|
31535
31717
|
if (output === void 0) {
|
|
31536
31718
|
console.log(
|
|
31537
|
-
|
|
31719
|
+
chalk220.yellow(
|
|
31538
31720
|
"Claude proposed nothing; answer each key from its current value."
|
|
31539
31721
|
)
|
|
31540
31722
|
);
|
|
@@ -31590,25 +31772,25 @@ function asConfigKeyScope(value) {
|
|
|
31590
31772
|
function reportConfigured(result) {
|
|
31591
31773
|
for (const write of result.written)
|
|
31592
31774
|
console.log(
|
|
31593
|
-
|
|
31775
|
+
chalk221.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
|
|
31594
31776
|
);
|
|
31595
|
-
for (const key of result.skipped) console.log(
|
|
31596
|
-
console.log(
|
|
31777
|
+
for (const key of result.skipped) console.log(chalk221.dim(`Left ${key} unset`));
|
|
31778
|
+
console.log(chalk221.dim(`Written to ${result.target}`));
|
|
31597
31779
|
}
|
|
31598
31780
|
|
|
31599
31781
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
31600
|
-
import
|
|
31782
|
+
import chalk222 from "chalk";
|
|
31601
31783
|
function announceSavedReview(subject, force) {
|
|
31602
31784
|
const head = subject.headSha.slice(0, 7);
|
|
31603
31785
|
if (subject.saved)
|
|
31604
31786
|
console.log(
|
|
31605
|
-
|
|
31787
|
+
chalk222.dim(
|
|
31606
31788
|
`Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
|
|
31607
31789
|
)
|
|
31608
31790
|
);
|
|
31609
31791
|
else if (force)
|
|
31610
31792
|
console.log(
|
|
31611
|
-
|
|
31793
|
+
chalk222.dim(
|
|
31612
31794
|
`Discarding any review saved for ${head} and starting fresh (--force).`
|
|
31613
31795
|
)
|
|
31614
31796
|
);
|
|
@@ -31969,7 +32151,7 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
31969
32151
|
}
|
|
31970
32152
|
|
|
31971
32153
|
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
31972
|
-
import { existsSync as existsSync64, readFileSync as
|
|
32154
|
+
import { existsSync as existsSync64, readFileSync as readFileSync49 } from "fs";
|
|
31973
32155
|
|
|
31974
32156
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
31975
32157
|
import { join as join77 } from "path";
|
|
@@ -31990,7 +32172,7 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
31990
32172
|
const path91 = highLevelReviewPath(repo, headRef, headSha);
|
|
31991
32173
|
if (!existsSync64(path91)) return void 0;
|
|
31992
32174
|
try {
|
|
31993
|
-
return JSON.parse(
|
|
32175
|
+
return JSON.parse(readFileSync49(path91, "utf8"));
|
|
31994
32176
|
} catch {
|
|
31995
32177
|
return void 0;
|
|
31996
32178
|
}
|
|
@@ -32147,55 +32329,55 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32147
32329
|
}
|
|
32148
32330
|
|
|
32149
32331
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
32150
|
-
import
|
|
32332
|
+
import chalk226 from "chalk";
|
|
32151
32333
|
|
|
32152
32334
|
// src/commands/review/highLevel/formatCriticalDiffs.ts
|
|
32153
|
-
import
|
|
32335
|
+
import chalk223 from "chalk";
|
|
32154
32336
|
var PATCH_LINE_COLOURS = {
|
|
32155
|
-
"+":
|
|
32156
|
-
"-":
|
|
32157
|
-
"@":
|
|
32337
|
+
"+": chalk223.green,
|
|
32338
|
+
"-": chalk223.red,
|
|
32339
|
+
"@": chalk223.cyan
|
|
32158
32340
|
};
|
|
32159
32341
|
function formatPatch(patch2) {
|
|
32160
32342
|
return patch2.split("\n").map(
|
|
32161
|
-
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ??
|
|
32343
|
+
(line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk223.dim)(line)}`
|
|
32162
32344
|
);
|
|
32163
32345
|
}
|
|
32164
32346
|
function formatDiff(diff3) {
|
|
32165
32347
|
return [
|
|
32166
32348
|
"",
|
|
32167
|
-
` ${
|
|
32168
|
-
...diff3.patch === null ? [` ${
|
|
32349
|
+
` ${chalk223.bold(diff3.path)} ${chalk223.dim(`(${diff3.status})`)} ${chalk223.green(`+${diff3.additions}`)} ${chalk223.red(`-${diff3.deletions}`)}`,
|
|
32350
|
+
...diff3.patch === null ? [` ${chalk223.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
|
|
32169
32351
|
];
|
|
32170
32352
|
}
|
|
32171
32353
|
function formatCriticalDiffs(diffs, criticalPaths) {
|
|
32172
32354
|
if (criticalPaths.length === 0)
|
|
32173
|
-
return `${
|
|
32174
|
-
${
|
|
32355
|
+
return `${chalk223.bold.underline("Critical diffs")}
|
|
32356
|
+
${chalk223.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
|
|
32175
32357
|
if (diffs.length === 0)
|
|
32176
|
-
return `${
|
|
32177
|
-
${
|
|
32358
|
+
return `${chalk223.bold.underline("Critical diffs")}
|
|
32359
|
+
${chalk223.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
|
|
32178
32360
|
return [
|
|
32179
|
-
|
|
32361
|
+
chalk223.bold.underline("Critical diffs"),
|
|
32180
32362
|
...diffs.flatMap(formatDiff)
|
|
32181
32363
|
].join("\n");
|
|
32182
32364
|
}
|
|
32183
32365
|
|
|
32184
32366
|
// src/commands/review/highLevel/formatHighLevelChecklist.ts
|
|
32185
|
-
import
|
|
32367
|
+
import chalk224 from "chalk";
|
|
32186
32368
|
var MARKERS = {
|
|
32187
|
-
pass: () =>
|
|
32188
|
-
fail: () =>
|
|
32189
|
-
manual: () =>
|
|
32369
|
+
pass: () => chalk224.green("\u2714"),
|
|
32370
|
+
fail: () => chalk224.red("\u2718"),
|
|
32371
|
+
manual: () => chalk224.yellow("\u25A1")
|
|
32190
32372
|
};
|
|
32191
32373
|
function formatCheck(check2) {
|
|
32192
|
-
const title = check2.status === "fail" ?
|
|
32374
|
+
const title = check2.status === "fail" ? chalk224.red(check2.title) : chalk224.bold(check2.title);
|
|
32193
32375
|
return ` ${MARKERS[check2.status]()} ${title}
|
|
32194
|
-
${
|
|
32376
|
+
${chalk224.dim(check2.reason)}`;
|
|
32195
32377
|
}
|
|
32196
32378
|
function formatGroup(heading2, checks2) {
|
|
32197
32379
|
if (checks2.length === 0) return [];
|
|
32198
|
-
return ["",
|
|
32380
|
+
return ["", chalk224.bold.underline(heading2), ...checks2.map(formatCheck)];
|
|
32199
32381
|
}
|
|
32200
32382
|
function formatHighLevelChecklist(checks2) {
|
|
32201
32383
|
const deterministic = checks2.filter(
|
|
@@ -32204,7 +32386,7 @@ function formatHighLevelChecklist(checks2) {
|
|
|
32204
32386
|
const failed2 = deterministic.filter(
|
|
32205
32387
|
(check2) => check2.status === "fail"
|
|
32206
32388
|
).length;
|
|
32207
|
-
const summary = failed2 === 0 ?
|
|
32389
|
+
const summary = failed2 === 0 ? chalk224.green(`All ${deterministic.length} deterministic checks pass`) : chalk224.red(
|
|
32208
32390
|
`${failed2} of ${deterministic.length} deterministic checks fail`
|
|
32209
32391
|
);
|
|
32210
32392
|
return [
|
|
@@ -32219,30 +32401,30 @@ function formatHighLevelChecklist(checks2) {
|
|
|
32219
32401
|
}
|
|
32220
32402
|
|
|
32221
32403
|
// src/commands/review/highLevel/formatHighLevelStructure.ts
|
|
32222
|
-
import
|
|
32404
|
+
import chalk225 from "chalk";
|
|
32223
32405
|
var STATUS_MARKERS = {
|
|
32224
|
-
added: () =>
|
|
32225
|
-
removed: () =>
|
|
32226
|
-
modified: () =>
|
|
32406
|
+
added: () => chalk225.green("A"),
|
|
32407
|
+
removed: () => chalk225.red("D"),
|
|
32408
|
+
modified: () => chalk225.yellow("M")
|
|
32227
32409
|
};
|
|
32228
32410
|
function counts(additions, deletions) {
|
|
32229
|
-
return `${
|
|
32411
|
+
return `${chalk225.green(`+${additions}`)} ${chalk225.red(`-${deletions}`)}`;
|
|
32230
32412
|
}
|
|
32231
32413
|
function formatNode(node, indent3) {
|
|
32232
32414
|
if (node.kind === "file")
|
|
32233
32415
|
return [
|
|
32234
|
-
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${
|
|
32416
|
+
`${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk225.dim(counts(node.additions, node.deletions))}`
|
|
32235
32417
|
];
|
|
32236
32418
|
const dir = node;
|
|
32237
32419
|
return [
|
|
32238
|
-
`${indent3}${
|
|
32420
|
+
`${indent3}${chalk225.bold(`${dir.name}/`)} ${chalk225.dim(counts(dir.additions, dir.deletions))}`,
|
|
32239
32421
|
...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
|
|
32240
32422
|
];
|
|
32241
32423
|
}
|
|
32242
32424
|
function formatHighLevelStructure(structure) {
|
|
32243
32425
|
const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
|
|
32244
32426
|
return [
|
|
32245
|
-
|
|
32427
|
+
chalk225.bold.underline("Structure"),
|
|
32246
32428
|
` ${summary}`,
|
|
32247
32429
|
...structure.tree.flatMap((node) => formatNode(node, " "))
|
|
32248
32430
|
].join("\n");
|
|
@@ -32251,8 +32433,8 @@ function formatHighLevelStructure(structure) {
|
|
|
32251
32433
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
32252
32434
|
function printHighLevelChecklist(subject) {
|
|
32253
32435
|
console.log(
|
|
32254
|
-
|
|
32255
|
-
|
|
32436
|
+
chalk226.bold(`High-level review of ${subject.repo}#${subject.prNumber}`),
|
|
32437
|
+
chalk226.dim(
|
|
32256
32438
|
`\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
|
|
32257
32439
|
)
|
|
32258
32440
|
);
|
|
@@ -32264,12 +32446,12 @@ function printHighLevelChecklist(subject) {
|
|
|
32264
32446
|
formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
|
|
32265
32447
|
);
|
|
32266
32448
|
console.log(
|
|
32267
|
-
|
|
32449
|
+
chalk226.dim(
|
|
32268
32450
|
"\nManual items are for the reviewer to judge; see docs/high-level-review.md."
|
|
32269
32451
|
)
|
|
32270
32452
|
);
|
|
32271
32453
|
console.log(
|
|
32272
|
-
|
|
32454
|
+
chalk226.dim(
|
|
32273
32455
|
"Run this inside an assist session to step through the checklist in the web overlay."
|
|
32274
32456
|
)
|
|
32275
32457
|
);
|
|
@@ -32565,7 +32747,7 @@ function gatherContext() {
|
|
|
32565
32747
|
}
|
|
32566
32748
|
|
|
32567
32749
|
// src/commands/review/postReviewToPr.ts
|
|
32568
|
-
import { readFileSync as
|
|
32750
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
32569
32751
|
|
|
32570
32752
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
32571
32753
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -32903,18 +33085,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
32903
33085
|
}
|
|
32904
33086
|
|
|
32905
33087
|
// src/commands/review/warnOutOfDiff.ts
|
|
32906
|
-
import
|
|
33088
|
+
import chalk227 from "chalk";
|
|
32907
33089
|
function warnOutOfDiff(outOfDiff) {
|
|
32908
33090
|
if (outOfDiff.length === 0) return;
|
|
32909
33091
|
console.warn(
|
|
32910
|
-
|
|
33092
|
+
chalk227.yellow(
|
|
32911
33093
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
32912
33094
|
)
|
|
32913
33095
|
);
|
|
32914
33096
|
for (const finding of outOfDiff) {
|
|
32915
33097
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
32916
33098
|
console.warn(
|
|
32917
|
-
` ${
|
|
33099
|
+
` ${chalk227.yellow("\xB7")} ${finding.title} ${chalk227.dim(
|
|
32918
33100
|
`(${finding.file}:${range})`
|
|
32919
33101
|
)}`
|
|
32920
33102
|
);
|
|
@@ -32938,18 +33120,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
32938
33120
|
}
|
|
32939
33121
|
|
|
32940
33122
|
// src/commands/review/warnUnlocated.ts
|
|
32941
|
-
import
|
|
33123
|
+
import chalk228 from "chalk";
|
|
32942
33124
|
function warnUnlocated(unlocated) {
|
|
32943
33125
|
if (unlocated.length === 0) return;
|
|
32944
33126
|
console.warn(
|
|
32945
|
-
|
|
33127
|
+
chalk228.yellow(
|
|
32946
33128
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
32947
33129
|
)
|
|
32948
33130
|
);
|
|
32949
33131
|
for (const finding of unlocated) {
|
|
32950
|
-
const where = finding.location ||
|
|
33132
|
+
const where = finding.location || chalk228.dim("missing");
|
|
32951
33133
|
console.warn(
|
|
32952
|
-
` ${
|
|
33134
|
+
` ${chalk228.yellow("\xB7")} ${finding.title} ${chalk228.dim(`(${where})`)}`
|
|
32953
33135
|
);
|
|
32954
33136
|
}
|
|
32955
33137
|
}
|
|
@@ -33016,7 +33198,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
33016
33198
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
33017
33199
|
}
|
|
33018
33200
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
33019
|
-
const markdown =
|
|
33201
|
+
const markdown = readFileSync50(synthesisPath, "utf8");
|
|
33020
33202
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
33021
33203
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
33022
33204
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -34036,7 +34218,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
34036
34218
|
}
|
|
34037
34219
|
|
|
34038
34220
|
// src/commands/review/synthesise.ts
|
|
34039
|
-
import { readFileSync as
|
|
34221
|
+
import { readFileSync as readFileSync51 } from "fs";
|
|
34040
34222
|
|
|
34041
34223
|
// src/commands/review/buildSynthesisStdin.ts
|
|
34042
34224
|
var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
|
|
@@ -34101,7 +34283,7 @@ Files:
|
|
|
34101
34283
|
|
|
34102
34284
|
// src/commands/review/synthesise.ts
|
|
34103
34285
|
function printSummary2(synthesisPath) {
|
|
34104
|
-
const markdown =
|
|
34286
|
+
const markdown = readFileSync51(synthesisPath, "utf8");
|
|
34105
34287
|
console.log("");
|
|
34106
34288
|
console.log(buildReviewSummary(markdown));
|
|
34107
34289
|
console.log("");
|
|
@@ -34414,9 +34596,9 @@ function registerReview(program2) {
|
|
|
34414
34596
|
}
|
|
34415
34597
|
|
|
34416
34598
|
// src/commands/rules/addRule.ts
|
|
34417
|
-
import { existsSync as existsSync70, readFileSync as
|
|
34599
|
+
import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
|
|
34418
34600
|
import path73 from "path";
|
|
34419
|
-
import
|
|
34601
|
+
import chalk229 from "chalk";
|
|
34420
34602
|
|
|
34421
34603
|
// src/commands/rules/insertRuleBullet.ts
|
|
34422
34604
|
function ruleBullet({ code, title, text: text18 }) {
|
|
@@ -34439,7 +34621,7 @@ function insertRuleBullet(content, rule) {
|
|
|
34439
34621
|
}
|
|
34440
34622
|
|
|
34441
34623
|
// src/commands/rules/nextRuleCode.ts
|
|
34442
|
-
import { readFileSync as
|
|
34624
|
+
import { readFileSync as readFileSync52 } from "fs";
|
|
34443
34625
|
|
|
34444
34626
|
// src/commands/rules/findClaudeFiles.ts
|
|
34445
34627
|
import { readdirSync as readdirSync14 } from "fs";
|
|
@@ -34463,7 +34645,7 @@ function findClaudeFiles(dir) {
|
|
|
34463
34645
|
var CODE_PREFIX = "R";
|
|
34464
34646
|
function nextRuleCode(root) {
|
|
34465
34647
|
const numbers = findClaudeFiles(root).flatMap(
|
|
34466
|
-
(file) => parseRulesSection(
|
|
34648
|
+
(file) => parseRulesSection(readFileSync52(file, "utf8")).map(
|
|
34467
34649
|
(rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
|
|
34468
34650
|
)
|
|
34469
34651
|
);
|
|
@@ -34489,15 +34671,15 @@ function resolveRuleScope(target) {
|
|
|
34489
34671
|
}
|
|
34490
34672
|
|
|
34491
34673
|
// src/commands/rules/updateScopedRulesIndex.ts
|
|
34492
|
-
import { existsSync as existsSync69, readFileSync as
|
|
34674
|
+
import { existsSync as existsSync69, readFileSync as readFileSync54, writeFileSync as writeFileSync42 } from "fs";
|
|
34493
34675
|
import path72 from "path";
|
|
34494
34676
|
|
|
34495
34677
|
// src/commands/rules/scopedRuleDirectories.ts
|
|
34496
|
-
import { readFileSync as
|
|
34678
|
+
import { readFileSync as readFileSync53 } from "fs";
|
|
34497
34679
|
import path71 from "path";
|
|
34498
34680
|
function scopedRuleDirectories(root) {
|
|
34499
34681
|
return findClaudeFiles(root).filter(
|
|
34500
|
-
(file) => path71.dirname(file) !== root && parseRulesSection(
|
|
34682
|
+
(file) => path71.dirname(file) !== root && parseRulesSection(readFileSync53(file, "utf8")).length > 0
|
|
34501
34683
|
).map(
|
|
34502
34684
|
(file) => `${path71.relative(root, path71.dirname(file)).split(path71.sep).join("/")}/`
|
|
34503
34685
|
).sort();
|
|
@@ -34539,7 +34721,7 @@ function upsertScopedRulesPointer(content, directories) {
|
|
|
34539
34721
|
function updateScopedRulesIndex(root) {
|
|
34540
34722
|
const directories = scopedRuleDirectories(root);
|
|
34541
34723
|
const rootFile = path72.join(root, "CLAUDE.md");
|
|
34542
|
-
const before = existsSync69(rootFile) ?
|
|
34724
|
+
const before = existsSync69(rootFile) ? readFileSync54(rootFile, "utf8") : "";
|
|
34543
34725
|
const after = upsertScopedRulesPointer(before, directories);
|
|
34544
34726
|
if (after !== before) writeFileSync42(rootFile, after);
|
|
34545
34727
|
return directories;
|
|
@@ -34547,12 +34729,12 @@ function updateScopedRulesIndex(root) {
|
|
|
34547
34729
|
|
|
34548
34730
|
// src/commands/rules/addRule.ts
|
|
34549
34731
|
function read2(file) {
|
|
34550
|
-
return existsSync70(file) ?
|
|
34732
|
+
return existsSync70(file) ? readFileSync55(file, "utf8") : "";
|
|
34551
34733
|
}
|
|
34552
34734
|
function addRule(text18, options2) {
|
|
34553
34735
|
const rule = text18.trim();
|
|
34554
34736
|
if (rule === "") {
|
|
34555
|
-
console.error(
|
|
34737
|
+
console.error(chalk229.red("Rule text is required"));
|
|
34556
34738
|
process.exitCode = 1;
|
|
34557
34739
|
return;
|
|
34558
34740
|
}
|
|
@@ -34570,13 +34752,13 @@ function addRule(text18, options2) {
|
|
|
34570
34752
|
);
|
|
34571
34753
|
updateScopedRulesIndex(root);
|
|
34572
34754
|
console.log(
|
|
34573
|
-
`Added ${
|
|
34755
|
+
`Added ${chalk229.cyan(code)} to ${path73.relative(process.cwd(), target) || target}`
|
|
34574
34756
|
);
|
|
34575
34757
|
}
|
|
34576
34758
|
|
|
34577
34759
|
// src/commands/rules/indexRules.ts
|
|
34578
34760
|
import path74 from "path";
|
|
34579
|
-
import
|
|
34761
|
+
import chalk230 from "chalk";
|
|
34580
34762
|
function indexRules() {
|
|
34581
34763
|
const startDir = scopeDirectory(process.cwd());
|
|
34582
34764
|
const root = findRepoRoot(startDir) ?? startDir;
|
|
@@ -34584,24 +34766,24 @@ function indexRules() {
|
|
|
34584
34766
|
const rootFile = path74.relative(process.cwd(), path74.join(root, "CLAUDE.md"));
|
|
34585
34767
|
if (directories.length === 0) {
|
|
34586
34768
|
console.log(
|
|
34587
|
-
|
|
34769
|
+
chalk230.gray(`No directories carry their own \`## Rules\` under ${root}`)
|
|
34588
34770
|
);
|
|
34589
34771
|
return;
|
|
34590
34772
|
}
|
|
34591
34773
|
console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
|
|
34592
34774
|
for (const directory of directories)
|
|
34593
|
-
console.log(` ${
|
|
34775
|
+
console.log(` ${chalk230.cyan(directory)}`);
|
|
34594
34776
|
}
|
|
34595
34777
|
|
|
34596
34778
|
// src/commands/rules/listRules.ts
|
|
34597
34779
|
import path75 from "path";
|
|
34598
|
-
import
|
|
34780
|
+
import chalk231 from "chalk";
|
|
34599
34781
|
function listRules(target, options2 = {}) {
|
|
34600
34782
|
const resolved = path75.resolve(target ?? process.cwd());
|
|
34601
34783
|
const rules3 = readScopedRules(resolved);
|
|
34602
34784
|
if (rules3.length === 0) {
|
|
34603
34785
|
const label2 = path75.relative(process.cwd(), resolved) || ".";
|
|
34604
|
-
console.log(
|
|
34786
|
+
console.log(chalk231.gray(`No rules in scope for ${label2}`));
|
|
34605
34787
|
return;
|
|
34606
34788
|
}
|
|
34607
34789
|
const base = findRepoRoot(scopeDirectory(resolved));
|
|
@@ -34611,14 +34793,14 @@ function listRules(target, options2 = {}) {
|
|
|
34611
34793
|
if (rule.source !== shown) {
|
|
34612
34794
|
shown = rule.source;
|
|
34613
34795
|
console.log(
|
|
34614
|
-
|
|
34796
|
+
chalk231.dim(base ? path75.relative(base, rule.source) : rule.source)
|
|
34615
34797
|
);
|
|
34616
34798
|
}
|
|
34617
34799
|
console.log(
|
|
34618
|
-
` ${
|
|
34800
|
+
` ${chalk231.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
|
|
34619
34801
|
);
|
|
34620
34802
|
if (options2.full && rule.title)
|
|
34621
|
-
console.log(` ${" ".repeat(width)} ${
|
|
34803
|
+
console.log(` ${" ".repeat(width)} ${chalk231.dim(rule.text)}`);
|
|
34622
34804
|
}
|
|
34623
34805
|
}
|
|
34624
34806
|
|
|
@@ -34647,7 +34829,7 @@ function registerRules(program2) {
|
|
|
34647
34829
|
}
|
|
34648
34830
|
|
|
34649
34831
|
// src/commands/seq/seqAuth.ts
|
|
34650
|
-
import
|
|
34832
|
+
import chalk233 from "chalk";
|
|
34651
34833
|
|
|
34652
34834
|
// src/commands/seq/loadConnections.ts
|
|
34653
34835
|
function loadConnections2() {
|
|
@@ -34676,10 +34858,10 @@ function setDefaultConnection(name) {
|
|
|
34676
34858
|
}
|
|
34677
34859
|
|
|
34678
34860
|
// src/shared/assertUniqueName.ts
|
|
34679
|
-
import
|
|
34861
|
+
import chalk232 from "chalk";
|
|
34680
34862
|
function assertUniqueName(existingNames, name) {
|
|
34681
34863
|
if (existingNames.includes(name)) {
|
|
34682
|
-
console.error(
|
|
34864
|
+
console.error(chalk232.red(`Connection "${name}" already exists.`));
|
|
34683
34865
|
process.exit(1);
|
|
34684
34866
|
}
|
|
34685
34867
|
}
|
|
@@ -34697,16 +34879,16 @@ async function promptConnection2(existingNames) {
|
|
|
34697
34879
|
var seqAuth = createConnectionAuth({
|
|
34698
34880
|
load: loadConnections2,
|
|
34699
34881
|
save: saveConnections2,
|
|
34700
|
-
format: (c) => `${
|
|
34882
|
+
format: (c) => `${chalk233.bold(c.name)} ${c.url}`,
|
|
34701
34883
|
promptNew: promptConnection2,
|
|
34702
34884
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
34703
34885
|
});
|
|
34704
34886
|
|
|
34705
34887
|
// src/commands/seq/seqQuery.ts
|
|
34706
|
-
import
|
|
34888
|
+
import chalk237 from "chalk";
|
|
34707
34889
|
|
|
34708
34890
|
// src/commands/seq/fetchSeq.ts
|
|
34709
|
-
import
|
|
34891
|
+
import chalk234 from "chalk";
|
|
34710
34892
|
async function fetchSeq(conn, path91, params) {
|
|
34711
34893
|
const url = `${conn.url}${path91}?${params}`;
|
|
34712
34894
|
const response = await fetch(url, {
|
|
@@ -34717,7 +34899,7 @@ async function fetchSeq(conn, path91, params) {
|
|
|
34717
34899
|
});
|
|
34718
34900
|
if (!response.ok) {
|
|
34719
34901
|
const body = await response.text();
|
|
34720
|
-
console.error(
|
|
34902
|
+
console.error(chalk234.red(`Seq returned ${response.status}: ${body}`));
|
|
34721
34903
|
process.exit(1);
|
|
34722
34904
|
}
|
|
34723
34905
|
return response;
|
|
@@ -34776,23 +34958,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
34776
34958
|
}
|
|
34777
34959
|
|
|
34778
34960
|
// src/commands/seq/formatEvent.ts
|
|
34779
|
-
import
|
|
34961
|
+
import chalk235 from "chalk";
|
|
34780
34962
|
function levelColor(level) {
|
|
34781
34963
|
switch (level) {
|
|
34782
34964
|
case "Fatal":
|
|
34783
|
-
return
|
|
34965
|
+
return chalk235.bgRed.white;
|
|
34784
34966
|
case "Error":
|
|
34785
|
-
return
|
|
34967
|
+
return chalk235.red;
|
|
34786
34968
|
case "Warning":
|
|
34787
|
-
return
|
|
34969
|
+
return chalk235.yellow;
|
|
34788
34970
|
case "Information":
|
|
34789
|
-
return
|
|
34971
|
+
return chalk235.cyan;
|
|
34790
34972
|
case "Debug":
|
|
34791
|
-
return
|
|
34973
|
+
return chalk235.gray;
|
|
34792
34974
|
case "Verbose":
|
|
34793
|
-
return
|
|
34975
|
+
return chalk235.dim;
|
|
34794
34976
|
default:
|
|
34795
|
-
return
|
|
34977
|
+
return chalk235.white;
|
|
34796
34978
|
}
|
|
34797
34979
|
}
|
|
34798
34980
|
function levelAbbrev(level) {
|
|
@@ -34833,12 +35015,12 @@ function formatTimestamp(iso) {
|
|
|
34833
35015
|
function formatEvent(event) {
|
|
34834
35016
|
const color = levelColor(event.Level);
|
|
34835
35017
|
const abbrev = levelAbbrev(event.Level);
|
|
34836
|
-
const ts8 =
|
|
35018
|
+
const ts8 = chalk235.dim(formatTimestamp(event.Timestamp));
|
|
34837
35019
|
const msg = renderMessage(event);
|
|
34838
35020
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
34839
35021
|
if (event.Exception) {
|
|
34840
35022
|
for (const line of event.Exception.split("\n")) {
|
|
34841
|
-
lines2.push(
|
|
35023
|
+
lines2.push(chalk235.red(` ${line}`));
|
|
34842
35024
|
}
|
|
34843
35025
|
}
|
|
34844
35026
|
return lines2.join("\n");
|
|
@@ -34871,11 +35053,11 @@ function rejectTimestampFilter(filter) {
|
|
|
34871
35053
|
}
|
|
34872
35054
|
|
|
34873
35055
|
// src/shared/resolveNamedConnection.ts
|
|
34874
|
-
import
|
|
35056
|
+
import chalk236 from "chalk";
|
|
34875
35057
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
34876
35058
|
if (connections.length === 0) {
|
|
34877
35059
|
console.error(
|
|
34878
|
-
|
|
35060
|
+
chalk236.red(
|
|
34879
35061
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
34880
35062
|
)
|
|
34881
35063
|
);
|
|
@@ -34884,7 +35066,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
34884
35066
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
34885
35067
|
const connection = connections.find((c) => c.name === target);
|
|
34886
35068
|
if (!connection) {
|
|
34887
|
-
console.error(
|
|
35069
|
+
console.error(chalk236.red(`${kind} connection "${target}" not found.`));
|
|
34888
35070
|
process.exit(1);
|
|
34889
35071
|
}
|
|
34890
35072
|
return connection;
|
|
@@ -34913,7 +35095,7 @@ async function seqQuery(filter, options2) {
|
|
|
34913
35095
|
new URLSearchParams({ filter, count: String(count8) })
|
|
34914
35096
|
);
|
|
34915
35097
|
if (events.length === 0) {
|
|
34916
|
-
console.log(
|
|
35098
|
+
console.log(chalk237.yellow("No events found."));
|
|
34917
35099
|
return;
|
|
34918
35100
|
}
|
|
34919
35101
|
if (options2.json) {
|
|
@@ -34924,11 +35106,11 @@ async function seqQuery(filter, options2) {
|
|
|
34924
35106
|
for (const event of chronological) {
|
|
34925
35107
|
console.log(formatEvent(event));
|
|
34926
35108
|
}
|
|
34927
|
-
console.log(
|
|
35109
|
+
console.log(chalk237.dim(`
|
|
34928
35110
|
${events.length} events`));
|
|
34929
35111
|
if (events.length >= count8) {
|
|
34930
35112
|
console.log(
|
|
34931
|
-
|
|
35113
|
+
chalk237.yellow(
|
|
34932
35114
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
34933
35115
|
)
|
|
34934
35116
|
);
|
|
@@ -34936,10 +35118,10 @@ ${events.length} events`));
|
|
|
34936
35118
|
}
|
|
34937
35119
|
|
|
34938
35120
|
// src/shared/setNamedDefaultConnection.ts
|
|
34939
|
-
import
|
|
35121
|
+
import chalk238 from "chalk";
|
|
34940
35122
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
34941
35123
|
if (!connections.find((c) => c.name === name)) {
|
|
34942
|
-
console.error(
|
|
35124
|
+
console.error(chalk238.red(`Connection "${name}" not found.`));
|
|
34943
35125
|
process.exit(1);
|
|
34944
35126
|
}
|
|
34945
35127
|
setDefault(name);
|
|
@@ -35011,12 +35193,12 @@ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync45 } from "fs";
|
|
|
35011
35193
|
import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync44 } from "fs";
|
|
35012
35194
|
|
|
35013
35195
|
// src/commands/slack/readSlackParts.ts
|
|
35014
|
-
import { readFileSync as
|
|
35196
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
35015
35197
|
function readSlackParts(files) {
|
|
35016
35198
|
return files.map((file) => {
|
|
35017
35199
|
let contents;
|
|
35018
35200
|
try {
|
|
35019
|
-
contents =
|
|
35201
|
+
contents = readFileSync56(file, "utf8");
|
|
35020
35202
|
} catch {
|
|
35021
35203
|
console.error(`Error: Part file not found: ${file}`);
|
|
35022
35204
|
process.exit(1);
|
|
@@ -35160,7 +35342,7 @@ function registerSlack(program2) {
|
|
|
35160
35342
|
}
|
|
35161
35343
|
|
|
35162
35344
|
// src/commands/sql/sqlAuth.ts
|
|
35163
|
-
import
|
|
35345
|
+
import chalk240 from "chalk";
|
|
35164
35346
|
|
|
35165
35347
|
// src/commands/sql/loadConnections.ts
|
|
35166
35348
|
function loadConnections3() {
|
|
@@ -35189,7 +35371,7 @@ function setDefaultConnection2(name) {
|
|
|
35189
35371
|
}
|
|
35190
35372
|
|
|
35191
35373
|
// src/commands/sql/promptConnection.ts
|
|
35192
|
-
import
|
|
35374
|
+
import chalk239 from "chalk";
|
|
35193
35375
|
async function promptConnection3(existingNames) {
|
|
35194
35376
|
const name = await promptInput("name", "Connection name:", "default");
|
|
35195
35377
|
assertUniqueName(existingNames, name);
|
|
@@ -35197,7 +35379,7 @@ async function promptConnection3(existingNames) {
|
|
|
35197
35379
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
35198
35380
|
const port = Number.parseInt(portStr, 10);
|
|
35199
35381
|
if (!Number.isFinite(port)) {
|
|
35200
|
-
console.error(
|
|
35382
|
+
console.error(chalk239.red(`Invalid port "${portStr}".`));
|
|
35201
35383
|
process.exit(1);
|
|
35202
35384
|
}
|
|
35203
35385
|
const user = await promptInput("user", "User:");
|
|
@@ -35210,13 +35392,13 @@ async function promptConnection3(existingNames) {
|
|
|
35210
35392
|
var sqlAuth = createConnectionAuth({
|
|
35211
35393
|
load: loadConnections3,
|
|
35212
35394
|
save: saveConnections3,
|
|
35213
|
-
format: (c) => `${
|
|
35395
|
+
format: (c) => `${chalk240.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
35214
35396
|
promptNew: promptConnection3,
|
|
35215
35397
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
35216
35398
|
});
|
|
35217
35399
|
|
|
35218
35400
|
// src/commands/sql/printTable.ts
|
|
35219
|
-
import
|
|
35401
|
+
import chalk241 from "chalk";
|
|
35220
35402
|
function formatCell(value) {
|
|
35221
35403
|
if (value === null || value === void 0) return "";
|
|
35222
35404
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -35225,7 +35407,7 @@ function formatCell(value) {
|
|
|
35225
35407
|
}
|
|
35226
35408
|
function printTable(rows) {
|
|
35227
35409
|
if (rows.length === 0) {
|
|
35228
|
-
console.log(
|
|
35410
|
+
console.log(chalk241.yellow("(no rows)"));
|
|
35229
35411
|
return;
|
|
35230
35412
|
}
|
|
35231
35413
|
const columns = Object.keys(rows[0]);
|
|
@@ -35233,13 +35415,13 @@ function printTable(rows) {
|
|
|
35233
35415
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
35234
35416
|
);
|
|
35235
35417
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
35236
|
-
console.log(
|
|
35237
|
-
console.log(
|
|
35418
|
+
console.log(chalk241.dim(header));
|
|
35419
|
+
console.log(chalk241.dim("-".repeat(header.length)));
|
|
35238
35420
|
for (const row of rows) {
|
|
35239
35421
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
35240
35422
|
console.log(line);
|
|
35241
35423
|
}
|
|
35242
|
-
console.log(
|
|
35424
|
+
console.log(chalk241.dim(`
|
|
35243
35425
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
35244
35426
|
}
|
|
35245
35427
|
|
|
@@ -35299,7 +35481,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
35299
35481
|
}
|
|
35300
35482
|
|
|
35301
35483
|
// src/commands/sql/sqlMutate.ts
|
|
35302
|
-
import
|
|
35484
|
+
import chalk242 from "chalk";
|
|
35303
35485
|
|
|
35304
35486
|
// src/commands/sql/isMutation.ts
|
|
35305
35487
|
var MUTATION_KEYWORDS = [
|
|
@@ -35333,7 +35515,7 @@ function isMutation(sql29) {
|
|
|
35333
35515
|
async function sqlMutate(query2, connectionName) {
|
|
35334
35516
|
if (!isMutation(query2)) {
|
|
35335
35517
|
console.error(
|
|
35336
|
-
|
|
35518
|
+
chalk242.red(
|
|
35337
35519
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
35338
35520
|
)
|
|
35339
35521
|
);
|
|
@@ -35343,18 +35525,18 @@ async function sqlMutate(query2, connectionName) {
|
|
|
35343
35525
|
const pool = await sqlConnect(conn);
|
|
35344
35526
|
try {
|
|
35345
35527
|
const result = await pool.request().query(query2);
|
|
35346
|
-
console.log(
|
|
35528
|
+
console.log(chalk242.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
35347
35529
|
} finally {
|
|
35348
35530
|
await pool.close();
|
|
35349
35531
|
}
|
|
35350
35532
|
}
|
|
35351
35533
|
|
|
35352
35534
|
// src/commands/sql/sqlQuery.ts
|
|
35353
|
-
import
|
|
35535
|
+
import chalk243 from "chalk";
|
|
35354
35536
|
async function sqlQuery(query2, connectionName) {
|
|
35355
35537
|
if (isMutation(query2)) {
|
|
35356
35538
|
console.error(
|
|
35357
|
-
|
|
35539
|
+
chalk243.red(
|
|
35358
35540
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
35359
35541
|
)
|
|
35360
35542
|
);
|
|
@@ -35369,7 +35551,7 @@ async function sqlQuery(query2, connectionName) {
|
|
|
35369
35551
|
printTable(rows);
|
|
35370
35552
|
} else {
|
|
35371
35553
|
console.log(
|
|
35372
|
-
|
|
35554
|
+
chalk243.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
35373
35555
|
);
|
|
35374
35556
|
}
|
|
35375
35557
|
} finally {
|
|
@@ -35743,7 +35925,7 @@ function syncPi(claudeDir, options2) {
|
|
|
35743
35925
|
// src/commands/sync/syncSettings.ts
|
|
35744
35926
|
import * as fs48 from "fs";
|
|
35745
35927
|
import * as path85 from "path";
|
|
35746
|
-
import
|
|
35928
|
+
import chalk244 from "chalk";
|
|
35747
35929
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
35748
35930
|
const source = path85.join(claudeDir, "settings.json");
|
|
35749
35931
|
const target = path85.join(targetBase, "settings.json");
|
|
@@ -35762,7 +35944,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
35762
35944
|
if (mergedContent !== normalizedTarget) {
|
|
35763
35945
|
if (!options2?.yes) {
|
|
35764
35946
|
console.log(
|
|
35765
|
-
|
|
35947
|
+
chalk244.yellow(
|
|
35766
35948
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
35767
35949
|
)
|
|
35768
35950
|
);
|
|
@@ -35770,7 +35952,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
35770
35952
|
printDiff(targetContent, mergedContent);
|
|
35771
35953
|
printAutoConfirmHint();
|
|
35772
35954
|
const confirm = await promptConfirm(
|
|
35773
|
-
|
|
35955
|
+
chalk244.red("Overwrite existing settings.json?"),
|
|
35774
35956
|
false
|
|
35775
35957
|
);
|
|
35776
35958
|
if (!confirm) {
|
|
@@ -36092,9 +36274,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
|
|
|
36092
36274
|
}
|
|
36093
36275
|
|
|
36094
36276
|
// src/commands/transcript/convert/readCleanedCues.ts
|
|
36095
|
-
import { readFileSync as
|
|
36277
|
+
import { readFileSync as readFileSync60 } from "fs";
|
|
36096
36278
|
function readCleanedCues(inputPath) {
|
|
36097
|
-
return deduplicateCues(parseVtt(
|
|
36279
|
+
return deduplicateCues(parseVtt(readFileSync60(inputPath, "utf8")));
|
|
36098
36280
|
}
|
|
36099
36281
|
|
|
36100
36282
|
// src/commands/transcript/clean.ts
|
|
@@ -36400,7 +36582,7 @@ function widenAudience(passages) {
|
|
|
36400
36582
|
}
|
|
36401
36583
|
|
|
36402
36584
|
// src/commands/transcript/merge.ts
|
|
36403
|
-
function
|
|
36585
|
+
function readSource3(file) {
|
|
36404
36586
|
if (!existsSync78(file)) failTranscript(`VTT file not found: ${file}`);
|
|
36405
36587
|
const cues = readCleanedCues(file);
|
|
36406
36588
|
if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
|
|
@@ -36418,7 +36600,7 @@ async function readSelection(source) {
|
|
|
36418
36600
|
return readJsonPayload(source, selectionSchema, "transcript selection");
|
|
36419
36601
|
}
|
|
36420
36602
|
async function merge(files, options2 = {}) {
|
|
36421
|
-
const sources = files.map(
|
|
36603
|
+
const sources = files.map(readSource3);
|
|
36422
36604
|
const selection = await readSelection(options2.select);
|
|
36423
36605
|
const selected = selection ? selectPassages(sources, selection) : wholePassages(sources);
|
|
36424
36606
|
const passages = rebasePassages(
|
|
@@ -36606,14 +36788,14 @@ function devices() {
|
|
|
36606
36788
|
}
|
|
36607
36789
|
|
|
36608
36790
|
// src/commands/voice/logs.ts
|
|
36609
|
-
import { existsSync as existsSync79, readFileSync as
|
|
36791
|
+
import { existsSync as existsSync79, readFileSync as readFileSync61 } from "fs";
|
|
36610
36792
|
function logs(options2) {
|
|
36611
36793
|
if (!existsSync79(voicePaths.log)) {
|
|
36612
36794
|
console.log("No voice log file found");
|
|
36613
36795
|
return;
|
|
36614
36796
|
}
|
|
36615
36797
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
36616
|
-
const content =
|
|
36798
|
+
const content = readFileSync61(voicePaths.log, "utf8").trim();
|
|
36617
36799
|
if (!content) {
|
|
36618
36800
|
console.log("Voice log is empty");
|
|
36619
36801
|
return;
|
|
@@ -36640,7 +36822,7 @@ import { join as join96 } from "path";
|
|
|
36640
36822
|
|
|
36641
36823
|
// src/commands/voice/checkLockFile.ts
|
|
36642
36824
|
import { execSync as execSync66 } from "child_process";
|
|
36643
|
-
import { existsSync as existsSync80, mkdirSync as mkdirSync33, readFileSync as
|
|
36825
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync33, readFileSync as readFileSync62, writeFileSync as writeFileSync51 } from "fs";
|
|
36644
36826
|
import { join as join95 } from "path";
|
|
36645
36827
|
function isProcessAlive2(pid) {
|
|
36646
36828
|
try {
|
|
@@ -36654,7 +36836,7 @@ function checkLockFile() {
|
|
|
36654
36836
|
const lockFile = getLockFile();
|
|
36655
36837
|
if (!existsSync80(lockFile)) return;
|
|
36656
36838
|
try {
|
|
36657
|
-
const lock2 = JSON.parse(
|
|
36839
|
+
const lock2 = JSON.parse(readFileSync62(lockFile, "utf8"));
|
|
36658
36840
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
36659
36841
|
console.error(
|
|
36660
36842
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -36756,7 +36938,7 @@ function start2(options2) {
|
|
|
36756
36938
|
}
|
|
36757
36939
|
|
|
36758
36940
|
// src/commands/voice/status.ts
|
|
36759
|
-
import { existsSync as existsSync81, readFileSync as
|
|
36941
|
+
import { existsSync as existsSync81, readFileSync as readFileSync63 } from "fs";
|
|
36760
36942
|
function isProcessAlive3(pid) {
|
|
36761
36943
|
try {
|
|
36762
36944
|
process.kill(pid, 0);
|
|
@@ -36767,7 +36949,7 @@ function isProcessAlive3(pid) {
|
|
|
36767
36949
|
}
|
|
36768
36950
|
function readRecentLogs(count8) {
|
|
36769
36951
|
if (!existsSync81(voicePaths.log)) return [];
|
|
36770
|
-
const lines2 =
|
|
36952
|
+
const lines2 = readFileSync63(voicePaths.log, "utf8").trim().split("\n");
|
|
36771
36953
|
return lines2.slice(-count8);
|
|
36772
36954
|
}
|
|
36773
36955
|
function status2() {
|
|
@@ -36775,7 +36957,7 @@ function status2() {
|
|
|
36775
36957
|
console.log("Voice daemon: not running (no PID file)");
|
|
36776
36958
|
return;
|
|
36777
36959
|
}
|
|
36778
|
-
const pid = Number.parseInt(
|
|
36960
|
+
const pid = Number.parseInt(readFileSync63(voicePaths.pid, "utf8").trim(), 10);
|
|
36779
36961
|
const alive = isProcessAlive3(pid);
|
|
36780
36962
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
36781
36963
|
const recent = readRecentLogs(5);
|
|
@@ -36794,13 +36976,13 @@ function status2() {
|
|
|
36794
36976
|
}
|
|
36795
36977
|
|
|
36796
36978
|
// src/commands/voice/stop.ts
|
|
36797
|
-
import { existsSync as existsSync82, readFileSync as
|
|
36979
|
+
import { existsSync as existsSync82, readFileSync as readFileSync64, unlinkSync as unlinkSync21 } from "fs";
|
|
36798
36980
|
function stop2() {
|
|
36799
36981
|
if (!existsSync82(voicePaths.pid)) {
|
|
36800
36982
|
console.log("Voice daemon is not running (no PID file)");
|
|
36801
36983
|
return;
|
|
36802
36984
|
}
|
|
36803
|
-
const pid = Number.parseInt(
|
|
36985
|
+
const pid = Number.parseInt(readFileSync64(voicePaths.pid, "utf8").trim(), 10);
|
|
36804
36986
|
try {
|
|
36805
36987
|
process.kill(pid, "SIGTERM");
|
|
36806
36988
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -37512,7 +37694,7 @@ function registerWatch(program2) {
|
|
|
37512
37694
|
|
|
37513
37695
|
// src/commands/roam/auth.ts
|
|
37514
37696
|
import { randomBytes } from "crypto";
|
|
37515
|
-
import
|
|
37697
|
+
import chalk245 from "chalk";
|
|
37516
37698
|
|
|
37517
37699
|
// src/commands/roam/waitForCallback.ts
|
|
37518
37700
|
import { createServer as createServer3 } from "http";
|
|
@@ -37643,13 +37825,13 @@ async function auth() {
|
|
|
37643
37825
|
saveGlobalConfig(config);
|
|
37644
37826
|
const state = randomBytes(16).toString("hex");
|
|
37645
37827
|
console.log(
|
|
37646
|
-
|
|
37828
|
+
chalk245.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
37647
37829
|
);
|
|
37648
|
-
console.log(
|
|
37649
|
-
console.log(
|
|
37650
|
-
console.log(
|
|
37830
|
+
console.log(chalk245.white("http://localhost:14523/callback\n"));
|
|
37831
|
+
console.log(chalk245.blue("Opening browser for authorization..."));
|
|
37832
|
+
console.log(chalk245.dim("Waiting for authorization callback..."));
|
|
37651
37833
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
37652
|
-
console.log(
|
|
37834
|
+
console.log(chalk245.dim("Exchanging code for tokens..."));
|
|
37653
37835
|
const tokens = await exchangeToken({
|
|
37654
37836
|
code,
|
|
37655
37837
|
clientId,
|
|
@@ -37665,13 +37847,13 @@ async function auth() {
|
|
|
37665
37847
|
};
|
|
37666
37848
|
saveGlobalConfig(config);
|
|
37667
37849
|
console.log(
|
|
37668
|
-
|
|
37850
|
+
chalk245.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
37669
37851
|
);
|
|
37670
37852
|
}
|
|
37671
37853
|
|
|
37672
37854
|
// src/commands/roam/postRoamActivity.ts
|
|
37673
37855
|
import { execFileSync as execFileSync23 } from "child_process";
|
|
37674
|
-
import { readdirSync as readdirSync22, readFileSync as
|
|
37856
|
+
import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
|
|
37675
37857
|
import { join as join100 } from "path";
|
|
37676
37858
|
function findPortFile(roamDir) {
|
|
37677
37859
|
let entries;
|
|
@@ -37702,7 +37884,7 @@ function postRoamActivity(app, event) {
|
|
|
37702
37884
|
if (!portFile) return;
|
|
37703
37885
|
let port;
|
|
37704
37886
|
try {
|
|
37705
|
-
port =
|
|
37887
|
+
port = readFileSync65(portFile, "utf8").trim();
|
|
37706
37888
|
} catch {
|
|
37707
37889
|
return;
|
|
37708
37890
|
}
|
|
@@ -38070,11 +38252,11 @@ function applyLine(result, pending, line) {
|
|
|
38070
38252
|
}
|
|
38071
38253
|
|
|
38072
38254
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
38073
|
-
import { readFileSync as
|
|
38255
|
+
import { readFileSync as readFileSync66 } from "fs";
|
|
38074
38256
|
function readDaemonPidFile() {
|
|
38075
38257
|
try {
|
|
38076
38258
|
const pid = Number.parseInt(
|
|
38077
|
-
|
|
38259
|
+
readFileSync66(daemonPaths.pid, "utf8").trim(),
|
|
38078
38260
|
10
|
|
38079
38261
|
);
|
|
38080
38262
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -42270,14 +42452,14 @@ async function defaultConnect() {
|
|
|
42270
42452
|
}
|
|
42271
42453
|
|
|
42272
42454
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
42273
|
-
import { existsSync as existsSync98, readFileSync as
|
|
42455
|
+
import { existsSync as existsSync98, readFileSync as readFileSync68 } from "fs";
|
|
42274
42456
|
import { posix as posix3 } from "path";
|
|
42275
42457
|
function hasPersistedWindowsSessions() {
|
|
42276
42458
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
42277
42459
|
if (!sessionsFile) return false;
|
|
42278
42460
|
try {
|
|
42279
42461
|
if (!existsSync98(sessionsFile)) return false;
|
|
42280
|
-
const data = JSON.parse(
|
|
42462
|
+
const data = JSON.parse(readFileSync68(sessionsFile, "utf8"));
|
|
42281
42463
|
return Array.isArray(data) && data.length > 0;
|
|
42282
42464
|
} catch (error) {
|
|
42283
42465
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -43464,10 +43646,10 @@ async function parseTranscript(sessionId) {
|
|
|
43464
43646
|
if (rollout) return readMessages(rollout, parseCodexTranscriptLines);
|
|
43465
43647
|
return [];
|
|
43466
43648
|
}
|
|
43467
|
-
async function readMessages(filePath,
|
|
43649
|
+
async function readMessages(filePath, parse5) {
|
|
43468
43650
|
try {
|
|
43469
43651
|
const raw = await fs55.promises.readFile(filePath, "utf8");
|
|
43470
|
-
return
|
|
43652
|
+
return parse5(raw.split("\n"));
|
|
43471
43653
|
} catch {
|
|
43472
43654
|
return [];
|
|
43473
43655
|
}
|
|
@@ -43702,7 +43884,7 @@ function handleConnection(socket, manager) {
|
|
|
43702
43884
|
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync54 } from "fs";
|
|
43703
43885
|
|
|
43704
43886
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
43705
|
-
import { readFileSync as
|
|
43887
|
+
import { readFileSync as readFileSync69 } from "fs";
|
|
43706
43888
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
43707
43889
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
43708
43890
|
const timer = setInterval(() => {
|
|
@@ -43713,7 +43895,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
43713
43895
|
}
|
|
43714
43896
|
function ownsPidFile() {
|
|
43715
43897
|
try {
|
|
43716
|
-
return
|
|
43898
|
+
return readFileSync69(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
43717
43899
|
} catch {
|
|
43718
43900
|
return false;
|
|
43719
43901
|
}
|
|
@@ -43995,7 +44177,7 @@ async function renameSession(title) {
|
|
|
43995
44177
|
|
|
43996
44178
|
// src/commands/sessions/summarise/index.ts
|
|
43997
44179
|
import * as fs57 from "fs";
|
|
43998
|
-
import
|
|
44180
|
+
import chalk246 from "chalk";
|
|
43999
44181
|
|
|
44000
44182
|
// src/commands/sessions/summarise/shared.ts
|
|
44001
44183
|
import * as fs56 from "fs";
|
|
@@ -44054,22 +44236,22 @@ ${firstMessage}`);
|
|
|
44054
44236
|
async function summarise2(options2) {
|
|
44055
44237
|
const files = await discoverSessionFiles();
|
|
44056
44238
|
if (files.length === 0) {
|
|
44057
|
-
console.log(
|
|
44239
|
+
console.log(chalk246.yellow("No sessions found."));
|
|
44058
44240
|
return;
|
|
44059
44241
|
}
|
|
44060
44242
|
const toProcess = selectCandidates(files, options2);
|
|
44061
44243
|
if (toProcess.length === 0) {
|
|
44062
|
-
console.log(
|
|
44244
|
+
console.log(chalk246.green("All sessions already summarised."));
|
|
44063
44245
|
return;
|
|
44064
44246
|
}
|
|
44065
44247
|
console.log(
|
|
44066
|
-
|
|
44248
|
+
chalk246.cyan(
|
|
44067
44249
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
44068
44250
|
)
|
|
44069
44251
|
);
|
|
44070
44252
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
44071
44253
|
console.log(
|
|
44072
|
-
|
|
44254
|
+
chalk246.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk246.yellow(`, ${failed2} skipped`) : "")
|
|
44073
44255
|
);
|
|
44074
44256
|
}
|
|
44075
44257
|
function selectCandidates(files, options2) {
|
|
@@ -44089,16 +44271,16 @@ function processSessions(files) {
|
|
|
44089
44271
|
let failed2 = 0;
|
|
44090
44272
|
for (let i = 0; i < files.length; i++) {
|
|
44091
44273
|
const file = files[i];
|
|
44092
|
-
process.stdout.write(
|
|
44274
|
+
process.stdout.write(chalk246.dim(` [${i + 1}/${files.length}] `));
|
|
44093
44275
|
const summary = summariseSession(file);
|
|
44094
44276
|
if (summary) {
|
|
44095
44277
|
writeSummary(file, summary);
|
|
44096
44278
|
succeeded++;
|
|
44097
|
-
process.stdout.write(`${
|
|
44279
|
+
process.stdout.write(`${chalk246.green("\u2713")} ${summary}
|
|
44098
44280
|
`);
|
|
44099
44281
|
} else {
|
|
44100
44282
|
failed2++;
|
|
44101
|
-
process.stdout.write(` ${
|
|
44283
|
+
process.stdout.write(` ${chalk246.yellow("skip")}
|
|
44102
44284
|
`);
|
|
44103
44285
|
}
|
|
44104
44286
|
}
|
|
@@ -44125,10 +44307,10 @@ function registerSessions(program2) {
|
|
|
44125
44307
|
}
|
|
44126
44308
|
|
|
44127
44309
|
// src/reportCliError.ts
|
|
44128
|
-
import
|
|
44310
|
+
import chalk247 from "chalk";
|
|
44129
44311
|
function reportCliError(error) {
|
|
44130
44312
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
44131
|
-
console.error(
|
|
44313
|
+
console.error(chalk247.red(error.message));
|
|
44132
44314
|
} else {
|
|
44133
44315
|
console.error(error);
|
|
44134
44316
|
}
|