@staff0rd/assist 0.579.0 → 0.581.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +547 -406
- 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.581.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -3847,9 +3847,9 @@ function extractCsharpComments(content) {
|
|
|
3847
3847
|
|
|
3848
3848
|
// src/commands/verify/blockCodeComments/collectCsharpComments.ts
|
|
3849
3849
|
function collectCsharpComments(content) {
|
|
3850
|
-
const
|
|
3850
|
+
const headerLines2 = csharpHeaderLineCount(content);
|
|
3851
3851
|
return extractCsharpComments(content).filter(
|
|
3852
|
-
(comment3) => comment3.line >
|
|
3852
|
+
(comment3) => comment3.line > headerLines2
|
|
3853
3853
|
);
|
|
3854
3854
|
}
|
|
3855
3855
|
|
|
@@ -3883,7 +3883,7 @@ function collectHashComments(content, options2) {
|
|
|
3883
3883
|
function collectComments(sourceFile) {
|
|
3884
3884
|
const seen = /* @__PURE__ */ new Set();
|
|
3885
3885
|
const comments3 = [];
|
|
3886
|
-
const
|
|
3886
|
+
const collect7 = (node) => {
|
|
3887
3887
|
for (const range of [
|
|
3888
3888
|
...node.getLeadingCommentRanges(),
|
|
3889
3889
|
...node.getTrailingCommentRanges()
|
|
@@ -3894,8 +3894,8 @@ function collectComments(sourceFile) {
|
|
|
3894
3894
|
comments3.push({ pos, text: range.getText() });
|
|
3895
3895
|
}
|
|
3896
3896
|
};
|
|
3897
|
-
|
|
3898
|
-
sourceFile.forEachDescendant(
|
|
3897
|
+
collect7(sourceFile);
|
|
3898
|
+
sourceFile.forEachDescendant(collect7);
|
|
3899
3899
|
return comments3;
|
|
3900
3900
|
}
|
|
3901
3901
|
|
|
@@ -11939,7 +11939,7 @@ import { execFile as execFile5 } from "child_process";
|
|
|
11939
11939
|
import { promisify as promisify5 } from "util";
|
|
11940
11940
|
var execFileAsync4 = promisify5(execFile5);
|
|
11941
11941
|
var CACHE_TTL_MS4 = 3e4;
|
|
11942
|
-
function createCachedGhJson(args,
|
|
11942
|
+
function createCachedGhJson(args, parse4, fallback, options2 = {}) {
|
|
11943
11943
|
const { cacheFallback = true } = options2;
|
|
11944
11944
|
const cache5 = /* @__PURE__ */ new Map();
|
|
11945
11945
|
return async (cwd, extraArgs = []) => {
|
|
@@ -11954,7 +11954,7 @@ function createCachedGhJson(args, parse3, fallback, options2 = {}) {
|
|
|
11954
11954
|
windowsHide: true,
|
|
11955
11955
|
cwd: toGitCwd(cwd)
|
|
11956
11956
|
});
|
|
11957
|
-
value =
|
|
11957
|
+
value = parse4(stdout);
|
|
11958
11958
|
} catch {
|
|
11959
11959
|
value = fallback;
|
|
11960
11960
|
}
|
|
@@ -21042,6 +21042,38 @@ function applyAndVerifySubtree(target, plan2, context) {
|
|
|
21042
21042
|
writeLineNow(chalk163.green("Subtree normalised"));
|
|
21043
21043
|
}
|
|
21044
21044
|
|
|
21045
|
+
// src/commands/github/issue/fixStructure/assertChainTypesExist.ts
|
|
21046
|
+
function assertChainTypesExist(chain2, issueTypes) {
|
|
21047
|
+
const missing = chain2.filter(
|
|
21048
|
+
(level) => !issueTypes.some(
|
|
21049
|
+
(type) => normaliseTypeName(type.name) === normaliseTypeName(level)
|
|
21050
|
+
)
|
|
21051
|
+
);
|
|
21052
|
+
if (missing.length === 0) return;
|
|
21053
|
+
throw new Error(
|
|
21054
|
+
`The organisation has no ${missing.join(", ")} issue type${missing.length === 1 ? "" : "s"}. It has ${issueTypes.map((type) => type.name).join(", ")}`
|
|
21055
|
+
);
|
|
21056
|
+
}
|
|
21057
|
+
|
|
21058
|
+
// src/commands/github/issue/fixStructure/parseTypeChain.ts
|
|
21059
|
+
function parseTypeChain(value) {
|
|
21060
|
+
const chain2 = value.split(/[,>]/).map((name) => name.trim()).filter((name) => name.length > 0);
|
|
21061
|
+
if (chain2.length < 2) {
|
|
21062
|
+
throw new Error(
|
|
21063
|
+
`--type-chain needs at least two levels, like Epic,Story,Subtask, not "${value}"`
|
|
21064
|
+
);
|
|
21065
|
+
}
|
|
21066
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21067
|
+
for (const level of chain2) {
|
|
21068
|
+
const key = normaliseTypeName(level);
|
|
21069
|
+
if (seen.has(key)) {
|
|
21070
|
+
throw new Error(`--type-chain repeats ${level}; each level must differ`);
|
|
21071
|
+
}
|
|
21072
|
+
seen.add(key);
|
|
21073
|
+
}
|
|
21074
|
+
return chain2;
|
|
21075
|
+
}
|
|
21076
|
+
|
|
21045
21077
|
// src/commands/github/issue/fixStructure/printFixStructurePlan.ts
|
|
21046
21078
|
import chalk164 from "chalk";
|
|
21047
21079
|
function annotate(entry) {
|
|
@@ -21175,9 +21207,11 @@ var defaultTypeChain = ["Epic", "Story", "Subtask"];
|
|
|
21175
21207
|
|
|
21176
21208
|
// src/commands/github/issue/fixStructure/fixStructure.ts
|
|
21177
21209
|
function fixStructure(target, options2) {
|
|
21178
|
-
const chain2 = defaultTypeChain;
|
|
21179
21210
|
try {
|
|
21211
|
+
const chain2 = options2.typeChain ? parseTypeChain(options2.typeChain) : defaultTypeChain;
|
|
21180
21212
|
const resolved = resolveFixStructureTarget(target, options2.repo);
|
|
21213
|
+
const issueTypes = resolveOrgIssueTypes(resolved.owner);
|
|
21214
|
+
assertChainTypesExist(chain2, issueTypes);
|
|
21181
21215
|
const root = fetchRootIssue(resolved);
|
|
21182
21216
|
const { index: index3, asserted } = resolveRootLevelIndex(
|
|
21183
21217
|
chain2,
|
|
@@ -21188,8 +21222,8 @@ function fixStructure(target, options2) {
|
|
|
21188
21222
|
chain: chain2,
|
|
21189
21223
|
rootLevelIndex: index3,
|
|
21190
21224
|
rootAsserted: asserted,
|
|
21191
|
-
issueTypes
|
|
21192
|
-
stripLabels: []
|
|
21225
|
+
issueTypes,
|
|
21226
|
+
stripLabels: options2.stripLabel ?? []
|
|
21193
21227
|
};
|
|
21194
21228
|
const plan2 = planSubtree(root, context);
|
|
21195
21229
|
printFixStructurePlan(plan2, chain2, options2.apply === true);
|
|
@@ -21204,18 +21238,31 @@ function fixStructure(target, options2) {
|
|
|
21204
21238
|
// src/commands/github/issue/fixStructure/registerFixStructure.ts
|
|
21205
21239
|
var chain = defaultTypeChain.join(" > ");
|
|
21206
21240
|
var levels = defaultTypeChain.map((name) => name.toLowerCase()).join("|");
|
|
21241
|
+
function collect4(value, previous) {
|
|
21242
|
+
return previous.concat([value]);
|
|
21243
|
+
}
|
|
21207
21244
|
function registerFixStructure(issueCommand) {
|
|
21208
21245
|
issueCommand.command("fix-structure <target>").description("Normalise the issue types across one issue subtree").option(
|
|
21209
21246
|
"-R, --repo <owner/repo>",
|
|
21210
21247
|
"Repository a bare issue number belongs to"
|
|
21211
21248
|
).option(
|
|
21212
21249
|
"--level <level>",
|
|
21213
|
-
|
|
21250
|
+
"The target's own position in the type chain, when it cannot be inferred from its type"
|
|
21251
|
+
).option(
|
|
21252
|
+
"--type-chain <names>",
|
|
21253
|
+
`Comma-separated issue type chain, parent level first (default: ${defaultTypeChain.join(",")})`
|
|
21254
|
+
).option(
|
|
21255
|
+
"--strip-label <label>",
|
|
21256
|
+
"Legacy marker label to remove from every issue in the subtree that carries it (repeatable)",
|
|
21257
|
+
collect4,
|
|
21258
|
+
[]
|
|
21214
21259
|
).option("--apply", "Write the planned changes instead of reporting them").addHelpText(
|
|
21215
21260
|
"after",
|
|
21216
21261
|
`
|
|
21217
|
-
Walks the subtree reachable from <target> via sub-issues and reports the type each issue should carry: every level below the target is typed to the next level down the
|
|
21218
|
-
The
|
|
21262
|
+
Walks the subtree reachable from <target> via sub-issues and reports the type each issue should carry: every level below the target is typed to the next level down the chain. Nothing outside the subtree is ever read or written.
|
|
21263
|
+
The chain defaults to ${chain} and --type-chain replaces it, so a backlog on other type names is normalised the same way; every level named must already exist as an issue type on the organisation, or the run fails listing the ones that do.
|
|
21264
|
+
The target's own level is inferred from its issue type, so aiming at a story types its children as subtasks. When the target's type is not in the chain the level cannot be inferred, and --level ${levels} (or whichever levels --type-chain names) asserts it instead \u2014 which also plans the target's own type.
|
|
21265
|
+
No label is touched unless --strip-label names it; each one is repeatable, matched case-insensitively, and removed by the label id found on that issue, since label ids differ per repository.
|
|
21219
21266
|
The target is owner/repo#number, a github.com issue URL, or a bare number with --repo.
|
|
21220
21267
|
Without --apply nothing is written. With --apply each write is announced before it is issued, and the subtree is re-walked afterwards so any residual drift fails the run.
|
|
21221
21268
|
Anything nested below the leaf level fails the run before a single write, naming the offender and its parent.`
|
|
@@ -22871,7 +22918,8 @@ function registerMermaid(program2) {
|
|
|
22871
22918
|
}
|
|
22872
22919
|
|
|
22873
22920
|
// src/commands/miro/runExtract.ts
|
|
22874
|
-
import
|
|
22921
|
+
import chalk171 from "chalk";
|
|
22922
|
+
import { stringify as stringify2 } from "yaml";
|
|
22875
22923
|
|
|
22876
22924
|
// src/commands/miro/MiroExtractError.ts
|
|
22877
22925
|
var MiroExtractError = class extends Error {
|
|
@@ -22881,6 +22929,52 @@ var MiroExtractError = class extends Error {
|
|
|
22881
22929
|
}
|
|
22882
22930
|
};
|
|
22883
22931
|
|
|
22932
|
+
// src/commands/miro/parseAnchorId.ts
|
|
22933
|
+
function parseAnchorId(value) {
|
|
22934
|
+
const trimmed = value.trim();
|
|
22935
|
+
const link3 = /[?&]moveToWidget=([^&#]+)/.exec(trimmed);
|
|
22936
|
+
return link3 ? decodeURIComponent(link3[1]).trim() : trimmed;
|
|
22937
|
+
}
|
|
22938
|
+
|
|
22939
|
+
// src/commands/miro/anchorSource.ts
|
|
22940
|
+
function anchorSource(options2) {
|
|
22941
|
+
if (options2.topLeft && options2.bottomRight)
|
|
22942
|
+
return {
|
|
22943
|
+
pick: false,
|
|
22944
|
+
topLeft: parseAnchorId(options2.topLeft),
|
|
22945
|
+
bottomRight: parseAnchorId(options2.bottomRight)
|
|
22946
|
+
};
|
|
22947
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22948
|
+
if (process.env.ASSIST_SESSION !== "1" || !sessionId)
|
|
22949
|
+
throw new MiroExtractError(
|
|
22950
|
+
"Both --top-left <id|link> and --bottom-right <id|link> are required: there is no assist session to host the picker pane."
|
|
22951
|
+
);
|
|
22952
|
+
return { pick: true, sessionId };
|
|
22953
|
+
}
|
|
22954
|
+
|
|
22955
|
+
// src/commands/miro/applyIgnore.ts
|
|
22956
|
+
function applyIgnore(texts, ignore3) {
|
|
22957
|
+
const dropped = new Set(ignore3);
|
|
22958
|
+
const present = new Set(texts);
|
|
22959
|
+
return {
|
|
22960
|
+
texts: texts.filter((text18) => !dropped.has(text18)),
|
|
22961
|
+
unmatched: [...new Set(ignore3)].filter((entry) => !present.has(entry))
|
|
22962
|
+
};
|
|
22963
|
+
}
|
|
22964
|
+
|
|
22965
|
+
// src/commands/miro/miroSource.ts
|
|
22966
|
+
function boardId(url) {
|
|
22967
|
+
return url ? /\/board\/([^/?]+)/.exec(url)?.[1] : void 0;
|
|
22968
|
+
}
|
|
22969
|
+
function miroSource(items2, anchorId) {
|
|
22970
|
+
const anchor = items2.find((item) => item.id === anchorId);
|
|
22971
|
+
const ordered = anchor ? [anchor, ...items2] : items2;
|
|
22972
|
+
return {
|
|
22973
|
+
board: boardId(ordered.find((item) => item.miro_url)?.miro_url),
|
|
22974
|
+
frame: ordered.find((item) => item.parent?.id)?.parent?.id
|
|
22975
|
+
};
|
|
22976
|
+
}
|
|
22977
|
+
|
|
22884
22978
|
// src/commands/miro/stripHtml.ts
|
|
22885
22979
|
var namedEntities = {
|
|
22886
22980
|
amp: "&",
|
|
@@ -22939,13 +23033,6 @@ function normaliseItems(items2) {
|
|
|
22939
23033
|
return items2.map(toItem);
|
|
22940
23034
|
}
|
|
22941
23035
|
|
|
22942
|
-
// src/commands/miro/parseAnchorId.ts
|
|
22943
|
-
function parseAnchorId(value) {
|
|
22944
|
-
const trimmed = value.trim();
|
|
22945
|
-
const link3 = /[?&]moveToWidget=([^&#]+)/.exec(trimmed);
|
|
22946
|
-
return link3 ? decodeURIComponent(link3[1]).trim() : trimmed;
|
|
22947
|
-
}
|
|
22948
|
-
|
|
22949
23036
|
// src/commands/miro/pickAnchors.ts
|
|
22950
23037
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
22951
23038
|
|
|
@@ -22985,8 +23072,25 @@ async function pickAnchors(sessionId, items2) {
|
|
|
22985
23072
|
return [selection.topLeft, selection.bottomRight];
|
|
22986
23073
|
}
|
|
22987
23074
|
|
|
23075
|
+
// src/commands/miro/readIgnoreList.ts
|
|
23076
|
+
import { existsSync as existsSync54, readFileSync as readFileSync40 } from "fs";
|
|
23077
|
+
import { parse as parse2 } from "yaml";
|
|
23078
|
+
function readIgnoreList(file) {
|
|
23079
|
+
if (!existsSync54(file))
|
|
23080
|
+
throw new MiroExtractError(
|
|
23081
|
+
`No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
|
|
23082
|
+
);
|
|
23083
|
+
const parsed = parse2(readFileSync40(file, "utf8"));
|
|
23084
|
+
if (parsed === null || parsed === void 0) return [];
|
|
23085
|
+
if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
|
|
23086
|
+
throw new MiroExtractError(
|
|
23087
|
+
`${file} must be a YAML list of box texts to drop, one string per entry.`
|
|
23088
|
+
);
|
|
23089
|
+
return parsed.map((entry) => entry.trim()).filter(Boolean);
|
|
23090
|
+
}
|
|
23091
|
+
|
|
22988
23092
|
// src/commands/miro/readMiroItems.ts
|
|
22989
|
-
import { readFileSync as
|
|
23093
|
+
import { readFileSync as readFileSync41 } from "fs";
|
|
22990
23094
|
function tryParse(text18) {
|
|
22991
23095
|
try {
|
|
22992
23096
|
return JSON.parse(text18);
|
|
@@ -23015,7 +23119,7 @@ function parsePages(raw, file) {
|
|
|
23015
23119
|
return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
|
|
23016
23120
|
}
|
|
23017
23121
|
function readMiroItems(file) {
|
|
23018
|
-
const items2 = parsePages(
|
|
23122
|
+
const items2 = parsePages(readFileSync41(file, "utf8"), file).flatMap(
|
|
23019
23123
|
(page) => page.data ?? []
|
|
23020
23124
|
);
|
|
23021
23125
|
if (items2.length === 0)
|
|
@@ -23048,7 +23152,33 @@ function selectBoxes(items2, topLeftId, bottomRightId) {
|
|
|
23048
23152
|
right: bottomRight.right,
|
|
23049
23153
|
bottom: bottomRight.bottom
|
|
23050
23154
|
};
|
|
23051
|
-
|
|
23155
|
+
const boxes = items2.filter((item) => isBox(item) && centreInside(rect, item)).sort((a, b) => a.left - b.left || a.top - b.top);
|
|
23156
|
+
return { rect, boxes };
|
|
23157
|
+
}
|
|
23158
|
+
|
|
23159
|
+
// src/commands/miro/uniqueTexts.ts
|
|
23160
|
+
function uniqueTexts(boxes) {
|
|
23161
|
+
return [...new Set(boxes.map((box) => box.text))];
|
|
23162
|
+
}
|
|
23163
|
+
|
|
23164
|
+
// src/commands/miro/writeExtract.ts
|
|
23165
|
+
import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
|
|
23166
|
+
import { dirname as dirname27 } from "path";
|
|
23167
|
+
import { stringify } from "yaml";
|
|
23168
|
+
function headerLines(header) {
|
|
23169
|
+
const { rect } = header;
|
|
23170
|
+
return [
|
|
23171
|
+
`# board: ${header.board ?? "unknown"}`,
|
|
23172
|
+
`# frame: ${header.frame ?? "unknown"}`,
|
|
23173
|
+
`# top-left: ${header.topLeft}`,
|
|
23174
|
+
`# bottom-right: ${header.bottomRight}`,
|
|
23175
|
+
`# rectangle: ${rect.left},${rect.top} to ${rect.right},${rect.bottom}`
|
|
23176
|
+
];
|
|
23177
|
+
}
|
|
23178
|
+
function writeExtract(file, header, texts) {
|
|
23179
|
+
mkdirSync19(dirname27(file), { recursive: true });
|
|
23180
|
+
writeFileSync33(file, `${headerLines(header).join("\n")}
|
|
23181
|
+
${stringify(texts)}`);
|
|
23052
23182
|
}
|
|
23053
23183
|
|
|
23054
23184
|
// src/commands/miro/runExtract.ts
|
|
@@ -23059,26 +23189,37 @@ function requireItems(file) {
|
|
|
23059
23189
|
);
|
|
23060
23190
|
return file;
|
|
23061
23191
|
}
|
|
23062
|
-
function
|
|
23063
|
-
if (
|
|
23064
|
-
|
|
23065
|
-
|
|
23066
|
-
|
|
23067
|
-
|
|
23068
|
-
|
|
23069
|
-
|
|
23070
|
-
|
|
23071
|
-
throw new MiroExtractError(
|
|
23072
|
-
"Both --top-left <id|link> and --bottom-right <id|link> are required: there is no assist session to host the picker pane."
|
|
23073
|
-
);
|
|
23074
|
-
return { pick: true, sessionId };
|
|
23192
|
+
function warnUnmatched(file, unmatched) {
|
|
23193
|
+
if (unmatched.length === 0) return;
|
|
23194
|
+
const entries = unmatched.map((entry) => ` - ${entry}`).join("\n");
|
|
23195
|
+
console.error(
|
|
23196
|
+
chalk171.yellow(
|
|
23197
|
+
`${unmatched.length} ${unmatched.length === 1 ? "entry" : "entries"} in ${file} matched no box text:
|
|
23198
|
+
${entries}`
|
|
23199
|
+
)
|
|
23200
|
+
);
|
|
23075
23201
|
}
|
|
23076
23202
|
async function runExtract(options2) {
|
|
23077
23203
|
const source = anchorSource(options2);
|
|
23078
|
-
const
|
|
23204
|
+
const raw = readMiroItems(requireItems(options2.items));
|
|
23205
|
+
const items2 = normaliseItems(raw);
|
|
23079
23206
|
const [topLeft, bottomRight] = source.pick ? await pickAnchors(source.sessionId, items2) : [source.topLeft, source.bottomRight];
|
|
23080
|
-
const
|
|
23081
|
-
|
|
23207
|
+
const selection = selectBoxes(items2, topLeft, bottomRight);
|
|
23208
|
+
const ignore3 = options2.ignore ? readIgnoreList(options2.ignore) : [];
|
|
23209
|
+
const kept = applyIgnore(uniqueTexts(selection.boxes), ignore3);
|
|
23210
|
+
if (options2.ignore) warnUnmatched(options2.ignore, kept.unmatched);
|
|
23211
|
+
if (!options2.out) {
|
|
23212
|
+
process.stdout.write(stringify2(kept.texts));
|
|
23213
|
+
return;
|
|
23214
|
+
}
|
|
23215
|
+
writeExtract(
|
|
23216
|
+
options2.out,
|
|
23217
|
+
{ ...miroSource(raw, topLeft), topLeft, bottomRight, rect: selection.rect },
|
|
23218
|
+
kept.texts
|
|
23219
|
+
);
|
|
23220
|
+
console.log(
|
|
23221
|
+
`Wrote ${kept.texts.length} ${kept.texts.length === 1 ? "box" : "boxes"} to ${options2.out}`
|
|
23222
|
+
);
|
|
23082
23223
|
}
|
|
23083
23224
|
|
|
23084
23225
|
// src/commands/miro/registerMiro.ts
|
|
@@ -23090,14 +23231,14 @@ function registerMiro(program2) {
|
|
|
23090
23231
|
).option(
|
|
23091
23232
|
"--bottom-right <id>",
|
|
23092
23233
|
"Widget id or ?moveToWidget=<id> link of the bottom-right box"
|
|
23093
|
-
).action(runExtract);
|
|
23234
|
+
).option("--ignore <file>", "YAML list of box texts to drop from the output").option("--out <file>", "Write the YAML to this file instead of stdout").action(runExtract);
|
|
23094
23235
|
}
|
|
23095
23236
|
|
|
23096
23237
|
// src/commands/netcap/netcap.ts
|
|
23097
23238
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
23098
23239
|
import { createServer as createServer2 } from "http";
|
|
23099
|
-
import { dirname as
|
|
23100
|
-
import
|
|
23240
|
+
import { dirname as dirname29 } from "path";
|
|
23241
|
+
import chalk173 from "chalk";
|
|
23101
23242
|
|
|
23102
23243
|
// src/commands/netcap/corsHeaders.ts
|
|
23103
23244
|
var corsHeaders = {
|
|
@@ -23176,12 +23317,12 @@ function createNetcapHandler(options2) {
|
|
|
23176
23317
|
import { cp, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
23177
23318
|
import { networkInterfaces } from "os";
|
|
23178
23319
|
import { join as join58 } from "path";
|
|
23179
|
-
import
|
|
23320
|
+
import chalk172 from "chalk";
|
|
23180
23321
|
|
|
23181
23322
|
// src/commands/netcap/netcapExtensionDir.ts
|
|
23182
|
-
import { dirname as
|
|
23323
|
+
import { dirname as dirname28, join as join57 } from "path";
|
|
23183
23324
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
23184
|
-
var moduleDir =
|
|
23325
|
+
var moduleDir = dirname28(fileURLToPath6(import.meta.url));
|
|
23185
23326
|
function netcapExtensionDir() {
|
|
23186
23327
|
return join57(moduleDir, "commands", "netcap", "netcap-extension");
|
|
23187
23328
|
}
|
|
@@ -23220,7 +23361,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
23220
23361
|
const host = lanIPv4();
|
|
23221
23362
|
if (!host) {
|
|
23222
23363
|
console.log(
|
|
23223
|
-
|
|
23364
|
+
chalk172.yellow("could not determine the WSL IP for the extension")
|
|
23224
23365
|
);
|
|
23225
23366
|
await configureBackground(source, "127.0.0.1", port, filter);
|
|
23226
23367
|
return source;
|
|
@@ -23231,7 +23372,7 @@ async function prepareExtensionForLoad(port, filter = "") {
|
|
|
23231
23372
|
return WSL_WINDOWS_PATH;
|
|
23232
23373
|
} catch {
|
|
23233
23374
|
console.log(
|
|
23234
|
-
|
|
23375
|
+
chalk172.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
|
|
23235
23376
|
);
|
|
23236
23377
|
return source;
|
|
23237
23378
|
}
|
|
@@ -23259,35 +23400,35 @@ async function netcap(options2) {
|
|
|
23259
23400
|
const port = Number(options2.port);
|
|
23260
23401
|
const outPath = resolveNetcapOutPath(options2.out);
|
|
23261
23402
|
const filter = options2.filter ?? "";
|
|
23262
|
-
await mkdir4(
|
|
23403
|
+
await mkdir4(dirname29(outPath), { recursive: true });
|
|
23263
23404
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
23264
23405
|
let count8 = 0;
|
|
23265
23406
|
const handler = createNetcapHandler({
|
|
23266
23407
|
outPath,
|
|
23267
|
-
onPing: () => console.log(
|
|
23408
|
+
onPing: () => console.log(chalk173.dim("ping from extension")),
|
|
23268
23409
|
onCapture: (entry) => {
|
|
23269
23410
|
count8 += 1;
|
|
23270
23411
|
console.log(
|
|
23271
|
-
|
|
23272
|
-
|
|
23412
|
+
chalk173.green(`captured #${count8}`),
|
|
23413
|
+
chalk173.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
23273
23414
|
);
|
|
23274
23415
|
}
|
|
23275
23416
|
});
|
|
23276
23417
|
const server = createServer2(handler);
|
|
23277
23418
|
server.listen(port, () => {
|
|
23278
23419
|
console.log(
|
|
23279
|
-
|
|
23420
|
+
chalk173.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
|
|
23280
23421
|
);
|
|
23281
|
-
console.log(
|
|
23422
|
+
console.log(chalk173.dim(`appending captures to ${outPath}`));
|
|
23282
23423
|
if (filter)
|
|
23283
|
-
console.log(
|
|
23284
|
-
console.log(
|
|
23285
|
-
console.log(
|
|
23424
|
+
console.log(chalk173.dim(`forwarding only URLs matching "${filter}"`));
|
|
23425
|
+
console.log(chalk173.dim(`load the unpacked extension from ${extensionPath}`));
|
|
23426
|
+
console.log(chalk173.dim("press Ctrl-C to stop"));
|
|
23286
23427
|
});
|
|
23287
23428
|
process.on("SIGINT", () => {
|
|
23288
23429
|
server.close();
|
|
23289
23430
|
console.log(
|
|
23290
|
-
|
|
23431
|
+
chalk173.bold(
|
|
23291
23432
|
`
|
|
23292
23433
|
netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
23293
23434
|
)
|
|
@@ -23297,12 +23438,12 @@ netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} t
|
|
|
23297
23438
|
}
|
|
23298
23439
|
|
|
23299
23440
|
// src/commands/netcap/netcapExtract.ts
|
|
23300
|
-
import { writeFileSync as
|
|
23441
|
+
import { writeFileSync as writeFileSync34 } from "fs";
|
|
23301
23442
|
import { join as join61 } from "path";
|
|
23302
|
-
import
|
|
23443
|
+
import chalk174 from "chalk";
|
|
23303
23444
|
|
|
23304
23445
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
23305
|
-
import { readFileSync as
|
|
23446
|
+
import { readFileSync as readFileSync42 } from "fs";
|
|
23306
23447
|
|
|
23307
23448
|
// src/commands/netcap/parseRscRows.ts
|
|
23308
23449
|
var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
|
|
@@ -23698,7 +23839,7 @@ function extractVoyagerPosts(body) {
|
|
|
23698
23839
|
|
|
23699
23840
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
23700
23841
|
function captureEntries(captureFile) {
|
|
23701
|
-
const lines2 =
|
|
23842
|
+
const lines2 = readFileSync42(captureFile, "utf8").split("\n").filter(Boolean);
|
|
23702
23843
|
const entries = [];
|
|
23703
23844
|
for (const line of lines2) {
|
|
23704
23845
|
let entry;
|
|
@@ -23744,11 +23885,11 @@ function netcapExtract(file) {
|
|
|
23744
23885
|
const captureFile = file ?? defaultCapturePath();
|
|
23745
23886
|
const posts = extractPostsFromCapture(captureFile);
|
|
23746
23887
|
const outFile = join61(captureFile, "..", "posts.json");
|
|
23747
|
-
|
|
23888
|
+
writeFileSync34(outFile, `${JSON.stringify(posts, null, 2)}
|
|
23748
23889
|
`);
|
|
23749
23890
|
console.log(
|
|
23750
|
-
|
|
23751
|
-
|
|
23891
|
+
chalk174.green(`extracted ${posts.length} posts`),
|
|
23892
|
+
chalk174.dim(`-> ${outFile}`)
|
|
23752
23893
|
);
|
|
23753
23894
|
}
|
|
23754
23895
|
|
|
@@ -23769,7 +23910,7 @@ function registerNetcap(program2) {
|
|
|
23769
23910
|
}
|
|
23770
23911
|
|
|
23771
23912
|
// src/commands/news/add/index.ts
|
|
23772
|
-
import
|
|
23913
|
+
import chalk175 from "chalk";
|
|
23773
23914
|
import enquirer8 from "enquirer";
|
|
23774
23915
|
async function add2(url) {
|
|
23775
23916
|
if (!url) {
|
|
@@ -23791,10 +23932,10 @@ async function add2(url) {
|
|
|
23791
23932
|
const { orm } = await getReady();
|
|
23792
23933
|
const added = await addFeed(orm, url);
|
|
23793
23934
|
if (!added) {
|
|
23794
|
-
console.log(
|
|
23935
|
+
console.log(chalk175.yellow("Feed already exists"));
|
|
23795
23936
|
return;
|
|
23796
23937
|
}
|
|
23797
|
-
console.log(
|
|
23938
|
+
console.log(chalk175.green(`Added feed: ${url}`));
|
|
23798
23939
|
}
|
|
23799
23940
|
|
|
23800
23941
|
// src/commands/registerNews.ts
|
|
@@ -23841,7 +23982,7 @@ function registerPiHook(program2) {
|
|
|
23841
23982
|
}
|
|
23842
23983
|
|
|
23843
23984
|
// src/commands/prompts/printPromptsTable.ts
|
|
23844
|
-
import
|
|
23985
|
+
import chalk176 from "chalk";
|
|
23845
23986
|
function truncate(str, max) {
|
|
23846
23987
|
if (str.length <= max) return str;
|
|
23847
23988
|
return `${str.slice(0, max - 1)}\u2026`;
|
|
@@ -23859,14 +24000,14 @@ function printPromptsTable(rows) {
|
|
|
23859
24000
|
"Command".padEnd(commandWidth),
|
|
23860
24001
|
"Repos"
|
|
23861
24002
|
].join(" ");
|
|
23862
|
-
console.log(
|
|
23863
|
-
console.log(
|
|
24003
|
+
console.log(chalk176.dim(header));
|
|
24004
|
+
console.log(chalk176.dim("-".repeat(header.length)));
|
|
23864
24005
|
for (const row of rows) {
|
|
23865
24006
|
const count8 = String(row.count).padStart(countWidth);
|
|
23866
24007
|
const tool = row.tool.padEnd(toolWidth);
|
|
23867
24008
|
const command = truncate(row.command, 60).padEnd(commandWidth);
|
|
23868
24009
|
console.log(
|
|
23869
|
-
`${
|
|
24010
|
+
`${chalk176.yellow(count8)} ${tool} ${command} ${chalk176.dim(row.repos)}`
|
|
23870
24011
|
);
|
|
23871
24012
|
}
|
|
23872
24013
|
}
|
|
@@ -24267,13 +24408,13 @@ import { execSync as execSync45 } from "child_process";
|
|
|
24267
24408
|
|
|
24268
24409
|
// src/commands/prs/resolveCommentWithReply.ts
|
|
24269
24410
|
import { execSync as execSync44 } from "child_process";
|
|
24270
|
-
import { unlinkSync as unlinkSync14, writeFileSync as
|
|
24411
|
+
import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync35 } from "fs";
|
|
24271
24412
|
import { tmpdir as tmpdir6 } from "os";
|
|
24272
24413
|
import { join as join63 } from "path";
|
|
24273
24414
|
|
|
24274
24415
|
// src/commands/prs/loadCommentsCache.ts
|
|
24275
|
-
import { existsSync as
|
|
24276
|
-
import { parse as
|
|
24416
|
+
import { existsSync as existsSync55, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
|
|
24417
|
+
import { parse as parse3 } from "yaml";
|
|
24277
24418
|
|
|
24278
24419
|
// src/commands/prs/commentsCachePath.ts
|
|
24279
24420
|
import { homedir as homedir21 } from "os";
|
|
@@ -24292,15 +24433,15 @@ function commentsCachePath(org, repo, prNumber) {
|
|
|
24292
24433
|
// src/commands/prs/loadCommentsCache.ts
|
|
24293
24434
|
function loadCommentsCache(org, repo, prNumber) {
|
|
24294
24435
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24295
|
-
if (!
|
|
24436
|
+
if (!existsSync55(cachePath)) {
|
|
24296
24437
|
return null;
|
|
24297
24438
|
}
|
|
24298
|
-
const content =
|
|
24299
|
-
return
|
|
24439
|
+
const content = readFileSync43(cachePath, "utf8");
|
|
24440
|
+
return parse3(content);
|
|
24300
24441
|
}
|
|
24301
24442
|
function deleteCommentsCache(org, repo, prNumber) {
|
|
24302
24443
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24303
|
-
if (
|
|
24444
|
+
if (existsSync55(cachePath)) {
|
|
24304
24445
|
unlinkSync13(cachePath);
|
|
24305
24446
|
console.log("No more unresolved line comments. Cache dropped.");
|
|
24306
24447
|
}
|
|
@@ -24329,7 +24470,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
|
|
|
24329
24470
|
function resolveThread(threadId) {
|
|
24330
24471
|
const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
|
|
24331
24472
|
const queryFile = join63(tmpdir6(), `gh-mutation-${Date.now()}.graphql`);
|
|
24332
|
-
|
|
24473
|
+
writeFileSync35(queryFile, mutation);
|
|
24333
24474
|
try {
|
|
24334
24475
|
execSync44(
|
|
24335
24476
|
`gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
|
|
@@ -24411,13 +24552,13 @@ function fixed(commentId, sha) {
|
|
|
24411
24552
|
|
|
24412
24553
|
// src/commands/prs/fetchThreadIds.ts
|
|
24413
24554
|
import { execSync as execSync46 } from "child_process";
|
|
24414
|
-
import { unlinkSync as unlinkSync15, writeFileSync as
|
|
24555
|
+
import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync36 } from "fs";
|
|
24415
24556
|
import { tmpdir as tmpdir7 } from "os";
|
|
24416
24557
|
import { join as join64 } from "path";
|
|
24417
24558
|
var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
|
|
24418
24559
|
function fetchThreadIds(org, repo, prNumber) {
|
|
24419
24560
|
const queryFile = join64(tmpdir7(), `gh-query-${Date.now()}.graphql`);
|
|
24420
|
-
|
|
24561
|
+
writeFileSync36(queryFile, THREAD_QUERY);
|
|
24421
24562
|
try {
|
|
24422
24563
|
const result = execSync46(
|
|
24423
24564
|
`gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
|
|
@@ -24485,9 +24626,9 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
|
|
|
24485
24626
|
}
|
|
24486
24627
|
|
|
24487
24628
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
24488
|
-
import { mkdirSync as
|
|
24489
|
-
import { dirname as
|
|
24490
|
-
import { stringify as
|
|
24629
|
+
import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync37 } from "fs";
|
|
24630
|
+
import { dirname as dirname30 } from "path";
|
|
24631
|
+
import { stringify as stringify3 } from "yaml";
|
|
24491
24632
|
|
|
24492
24633
|
// src/commands/prs/removeStaleCommentsCaches.ts
|
|
24493
24634
|
import { readdirSync as readdirSync12, unlinkSync as unlinkSync16 } from "fs";
|
|
@@ -24509,13 +24650,13 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
|
|
|
24509
24650
|
// src/commands/prs/listComments/updateCommentsCache.ts
|
|
24510
24651
|
function writeCommentsCache(org, repo, prNumber, comments3) {
|
|
24511
24652
|
const cachePath = commentsCachePath(org, repo, prNumber);
|
|
24512
|
-
|
|
24653
|
+
mkdirSync20(dirname30(cachePath), { recursive: true });
|
|
24513
24654
|
const cacheData = {
|
|
24514
24655
|
prNumber,
|
|
24515
24656
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24516
24657
|
comments: comments3
|
|
24517
24658
|
};
|
|
24518
|
-
|
|
24659
|
+
writeFileSync37(cachePath, stringify3(cacheData));
|
|
24519
24660
|
}
|
|
24520
24661
|
function updateCommentsCache(org, repo, prNumber, comments3) {
|
|
24521
24662
|
removeStaleCommentsCaches();
|
|
@@ -24533,13 +24674,13 @@ function agentFooter(unresolvedCount) {
|
|
|
24533
24674
|
}
|
|
24534
24675
|
|
|
24535
24676
|
// src/commands/prs/listComments/commentStyle.ts
|
|
24536
|
-
import
|
|
24677
|
+
import chalk177 from "chalk";
|
|
24537
24678
|
var plain = (text18) => text18;
|
|
24538
24679
|
function colouredState(state) {
|
|
24539
24680
|
const label2 = `[${state}]`;
|
|
24540
|
-
if (state === "APPROVED") return
|
|
24541
|
-
if (state === "CHANGES_REQUESTED") return
|
|
24542
|
-
return
|
|
24681
|
+
if (state === "APPROVED") return chalk177.green(label2);
|
|
24682
|
+
if (state === "CHANGES_REQUESTED") return chalk177.red(label2);
|
|
24683
|
+
return chalk177.yellow(label2);
|
|
24543
24684
|
}
|
|
24544
24685
|
function commentStyle() {
|
|
24545
24686
|
if (isClaudeCode()) {
|
|
@@ -24553,9 +24694,9 @@ function commentStyle() {
|
|
|
24553
24694
|
};
|
|
24554
24695
|
}
|
|
24555
24696
|
return {
|
|
24556
|
-
cyan:
|
|
24557
|
-
bold:
|
|
24558
|
-
dim:
|
|
24697
|
+
cyan: chalk177.cyan,
|
|
24698
|
+
bold: chalk177.bold,
|
|
24699
|
+
dim: chalk177.dim,
|
|
24559
24700
|
state: colouredState,
|
|
24560
24701
|
diffHunk: true,
|
|
24561
24702
|
agent: false
|
|
@@ -24725,13 +24866,13 @@ import { execSync as execSync48 } from "child_process";
|
|
|
24725
24866
|
import enquirer9 from "enquirer";
|
|
24726
24867
|
|
|
24727
24868
|
// src/commands/prs/prs/displayPaginated/printPr.ts
|
|
24728
|
-
import
|
|
24869
|
+
import chalk178 from "chalk";
|
|
24729
24870
|
var STATUS_MAP = {
|
|
24730
|
-
MERGED: (pr) => pr.mergedAt ? { label:
|
|
24731
|
-
CLOSED: (pr) => pr.closedAt ? { label:
|
|
24871
|
+
MERGED: (pr) => pr.mergedAt ? { label: chalk178.magenta("merged"), date: pr.mergedAt } : null,
|
|
24872
|
+
CLOSED: (pr) => pr.closedAt ? { label: chalk178.red("closed"), date: pr.closedAt } : null
|
|
24732
24873
|
};
|
|
24733
24874
|
function defaultStatus(pr) {
|
|
24734
|
-
return { label:
|
|
24875
|
+
return { label: chalk178.green("opened"), date: pr.createdAt };
|
|
24735
24876
|
}
|
|
24736
24877
|
function getStatus2(pr) {
|
|
24737
24878
|
return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
|
|
@@ -24740,11 +24881,11 @@ function formatDate(dateStr) {
|
|
|
24740
24881
|
return new Date(dateStr).toISOString().split("T")[0];
|
|
24741
24882
|
}
|
|
24742
24883
|
function formatPrHeader(pr, status3) {
|
|
24743
|
-
return `${
|
|
24884
|
+
return `${chalk178.cyan(`#${pr.number}`)} ${pr.title} ${chalk178.dim(`(${pr.author.login},`)} ${status3.label} ${chalk178.dim(`${formatDate(status3.date)})`)}`;
|
|
24744
24885
|
}
|
|
24745
24886
|
function logPrDetails(pr) {
|
|
24746
24887
|
console.log(
|
|
24747
|
-
|
|
24888
|
+
chalk178.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
|
|
24748
24889
|
);
|
|
24749
24890
|
console.log();
|
|
24750
24891
|
}
|
|
@@ -25309,7 +25450,7 @@ ${prConcisenessGuidance}
|
|
|
25309
25450
|
}
|
|
25310
25451
|
|
|
25311
25452
|
// src/commands/registerPrsEdit.ts
|
|
25312
|
-
function
|
|
25453
|
+
function collect5(value, previous) {
|
|
25313
25454
|
return previous.concat([value]);
|
|
25314
25455
|
}
|
|
25315
25456
|
function registerPrsEdit(prsCommand) {
|
|
@@ -25318,7 +25459,7 @@ function registerPrsEdit(prsCommand) {
|
|
|
25318
25459
|
).option("-t, --title <title>", "New title for the pull request").option("--what <what>", "Replace the ## What section").option("--why <why>", "Replace the ## Why section").option("--how <how>", "Replace the ## How section").option(
|
|
25319
25460
|
"--resolves <key>",
|
|
25320
25461
|
"Jira issue key resolved by this PR, appended to ## Why (repeatable)",
|
|
25321
|
-
|
|
25462
|
+
collect5,
|
|
25322
25463
|
[]
|
|
25323
25464
|
).addHelpText("after", () => editHelpText()).action(edit);
|
|
25324
25465
|
}
|
|
@@ -25418,7 +25559,7 @@ ${confirm}
|
|
|
25418
25559
|
}
|
|
25419
25560
|
|
|
25420
25561
|
// src/commands/registerPrsRaise.ts
|
|
25421
|
-
function
|
|
25562
|
+
function collect6(value, previous) {
|
|
25422
25563
|
return previous.concat([value]);
|
|
25423
25564
|
}
|
|
25424
25565
|
function registerPrsRaise(prsCommand) {
|
|
@@ -25427,7 +25568,7 @@ function registerPrsRaise(prsCommand) {
|
|
|
25427
25568
|
).option("-t, --title <title>", "Title for the pull request").option("--what <what>", "What the change does (## What section)").option("--why <why>", "Why the change is needed (## Why section)").option("--how <how>", "How the change works (optional ## How section)").option(
|
|
25428
25569
|
"--resolves <key>",
|
|
25429
25570
|
"Jira issue key resolved by this PR, appended to ## Why (repeatable)",
|
|
25430
|
-
|
|
25571
|
+
collect6,
|
|
25431
25572
|
[]
|
|
25432
25573
|
).option(
|
|
25433
25574
|
"--force",
|
|
@@ -25435,15 +25576,15 @@ function registerPrsRaise(prsCommand) {
|
|
|
25435
25576
|
).option("-B, --base <branch>", "Branch into which the pull request merges").option("-H, --head <branch>", "Branch that contains the commits").option("-d, --draft", "Mark the pull request as a draft").option(
|
|
25436
25577
|
"--no-draft",
|
|
25437
25578
|
"Create a ready-for-review pull request, overriding prs.draft"
|
|
25438
|
-
).option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)",
|
|
25579
|
+
).option("-w, --web", "Open the browser to create the pull request").option("-l, --label <label>", "Add a label (repeatable)", collect6, []).option(
|
|
25439
25580
|
"-a, --assignee <login>",
|
|
25440
25581
|
"Assign a person by login (repeatable)",
|
|
25441
|
-
|
|
25582
|
+
collect6,
|
|
25442
25583
|
[]
|
|
25443
25584
|
).option(
|
|
25444
25585
|
"-r, --reviewer <handle>",
|
|
25445
25586
|
"Request a review (repeatable)",
|
|
25446
|
-
|
|
25587
|
+
collect6,
|
|
25447
25588
|
[]
|
|
25448
25589
|
).option("-m, --milestone <name>", "Add the pull request to a milestone").addHelpText("after", () => raiseHelpText()).action(raise);
|
|
25449
25590
|
configHelp(raiseCommand, prsRaiseConfigHelp);
|
|
@@ -25459,10 +25600,10 @@ function registerPrs(program2) {
|
|
|
25459
25600
|
}
|
|
25460
25601
|
|
|
25461
25602
|
// src/commands/ravendb/ravendbAuth.ts
|
|
25462
|
-
import
|
|
25603
|
+
import chalk184 from "chalk";
|
|
25463
25604
|
|
|
25464
25605
|
// src/shared/createConnectionAuth.ts
|
|
25465
|
-
import
|
|
25606
|
+
import chalk179 from "chalk";
|
|
25466
25607
|
function listConnections(connections, format) {
|
|
25467
25608
|
if (connections.length === 0) {
|
|
25468
25609
|
console.log("No connections configured.");
|
|
@@ -25475,7 +25616,7 @@ function listConnections(connections, format) {
|
|
|
25475
25616
|
function removeConnection(connections, name, save) {
|
|
25476
25617
|
const filtered = connections.filter((c) => c.name !== name);
|
|
25477
25618
|
if (filtered.length === connections.length) {
|
|
25478
|
-
console.error(
|
|
25619
|
+
console.error(chalk179.red(`Connection "${name}" not found.`));
|
|
25479
25620
|
process.exit(1);
|
|
25480
25621
|
}
|
|
25481
25622
|
save(filtered);
|
|
@@ -25521,15 +25662,15 @@ function saveConnections(connections) {
|
|
|
25521
25662
|
}
|
|
25522
25663
|
|
|
25523
25664
|
// src/commands/ravendb/promptConnection.ts
|
|
25524
|
-
import
|
|
25665
|
+
import chalk182 from "chalk";
|
|
25525
25666
|
|
|
25526
25667
|
// src/commands/ravendb/selectOpSecret.ts
|
|
25527
|
-
import
|
|
25668
|
+
import chalk181 from "chalk";
|
|
25528
25669
|
import Enquirer2 from "enquirer";
|
|
25529
25670
|
|
|
25530
25671
|
// src/commands/ravendb/searchItems.ts
|
|
25531
25672
|
import { execSync as execSync51 } from "child_process";
|
|
25532
|
-
import
|
|
25673
|
+
import chalk180 from "chalk";
|
|
25533
25674
|
function opExec(args) {
|
|
25534
25675
|
return execSync51(`op ${args}`, {
|
|
25535
25676
|
encoding: "utf8",
|
|
@@ -25542,7 +25683,7 @@ function searchItems(search2) {
|
|
|
25542
25683
|
items2 = JSON.parse(opExec("item list --format=json"));
|
|
25543
25684
|
} catch {
|
|
25544
25685
|
console.error(
|
|
25545
|
-
|
|
25686
|
+
chalk180.red(
|
|
25546
25687
|
"Failed to search 1Password. Ensure the CLI is installed and you are signed in."
|
|
25547
25688
|
)
|
|
25548
25689
|
);
|
|
@@ -25556,7 +25697,7 @@ function getItemFields(itemId2) {
|
|
|
25556
25697
|
const item = JSON.parse(opExec(`item get "${itemId2}" --format=json`));
|
|
25557
25698
|
return item.fields.filter((f) => f.reference && f.label);
|
|
25558
25699
|
} catch {
|
|
25559
|
-
console.error(
|
|
25700
|
+
console.error(chalk180.red("Failed to get item details from 1Password."));
|
|
25560
25701
|
process.exit(1);
|
|
25561
25702
|
}
|
|
25562
25703
|
}
|
|
@@ -25575,7 +25716,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25575
25716
|
}).run();
|
|
25576
25717
|
const items2 = searchItems(search2);
|
|
25577
25718
|
if (items2.length === 0) {
|
|
25578
|
-
console.error(
|
|
25719
|
+
console.error(chalk181.red(`No items found matching "${search2}".`));
|
|
25579
25720
|
process.exit(1);
|
|
25580
25721
|
}
|
|
25581
25722
|
const itemId2 = await selectOne(
|
|
@@ -25584,7 +25725,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25584
25725
|
);
|
|
25585
25726
|
const fields = getItemFields(itemId2);
|
|
25586
25727
|
if (fields.length === 0) {
|
|
25587
|
-
console.error(
|
|
25728
|
+
console.error(chalk181.red("No fields with references found on this item."));
|
|
25588
25729
|
process.exit(1);
|
|
25589
25730
|
}
|
|
25590
25731
|
const ref = await selectOne(
|
|
@@ -25598,7 +25739,7 @@ async function selectOpSecret(searchTerm) {
|
|
|
25598
25739
|
async function promptConnection(existingNames) {
|
|
25599
25740
|
const name = await promptInput("name", "Connection name:");
|
|
25600
25741
|
if (existingNames.includes(name)) {
|
|
25601
|
-
console.error(
|
|
25742
|
+
console.error(chalk182.red(`Connection "${name}" already exists.`));
|
|
25602
25743
|
process.exit(1);
|
|
25603
25744
|
}
|
|
25604
25745
|
const url = await promptInput(
|
|
@@ -25607,22 +25748,22 @@ async function promptConnection(existingNames) {
|
|
|
25607
25748
|
);
|
|
25608
25749
|
const database = await promptInput("database", "Database name:");
|
|
25609
25750
|
if (!name || !url || !database) {
|
|
25610
|
-
console.error(
|
|
25751
|
+
console.error(chalk182.red("All fields are required."));
|
|
25611
25752
|
process.exit(1);
|
|
25612
25753
|
}
|
|
25613
25754
|
const apiKeyRef = await selectOpSecret();
|
|
25614
|
-
console.log(
|
|
25755
|
+
console.log(chalk182.dim(`Using: ${apiKeyRef}`));
|
|
25615
25756
|
return { name, url, database, apiKeyRef };
|
|
25616
25757
|
}
|
|
25617
25758
|
|
|
25618
25759
|
// src/commands/ravendb/ravendbSetConnection.ts
|
|
25619
|
-
import
|
|
25760
|
+
import chalk183 from "chalk";
|
|
25620
25761
|
function ravendbSetConnection(name) {
|
|
25621
25762
|
const raw = loadGlobalConfigRaw();
|
|
25622
25763
|
const ravendb = raw.ravendb ?? {};
|
|
25623
25764
|
const connections = ravendb.connections ?? [];
|
|
25624
25765
|
if (!connections.some((c) => c.name === name)) {
|
|
25625
|
-
console.error(
|
|
25766
|
+
console.error(chalk183.red(`Connection "${name}" not found.`));
|
|
25626
25767
|
console.error(
|
|
25627
25768
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
25628
25769
|
);
|
|
@@ -25638,16 +25779,16 @@ function ravendbSetConnection(name) {
|
|
|
25638
25779
|
var ravendbAuth = createConnectionAuth({
|
|
25639
25780
|
load: loadConnections,
|
|
25640
25781
|
save: saveConnections,
|
|
25641
|
-
format: (c) => `${
|
|
25782
|
+
format: (c) => `${chalk184.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
|
|
25642
25783
|
promptNew: promptConnection,
|
|
25643
25784
|
onFirst: (c) => ravendbSetConnection(c.name)
|
|
25644
25785
|
});
|
|
25645
25786
|
|
|
25646
25787
|
// src/commands/ravendb/ravendbCollections.ts
|
|
25647
|
-
import
|
|
25788
|
+
import chalk188 from "chalk";
|
|
25648
25789
|
|
|
25649
25790
|
// src/commands/ravendb/ravenFetch.ts
|
|
25650
|
-
import
|
|
25791
|
+
import chalk186 from "chalk";
|
|
25651
25792
|
|
|
25652
25793
|
// src/commands/ravendb/getAccessToken.ts
|
|
25653
25794
|
var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
|
|
@@ -25684,10 +25825,10 @@ ${errorText}`
|
|
|
25684
25825
|
|
|
25685
25826
|
// src/commands/ravendb/resolveOpSecret.ts
|
|
25686
25827
|
import { execSync as execSync52 } from "child_process";
|
|
25687
|
-
import
|
|
25828
|
+
import chalk185 from "chalk";
|
|
25688
25829
|
function resolveOpSecret(reference) {
|
|
25689
25830
|
if (!reference.startsWith("op://")) {
|
|
25690
|
-
console.error(
|
|
25831
|
+
console.error(chalk185.red(`Invalid secret reference: must start with op://`));
|
|
25691
25832
|
process.exit(1);
|
|
25692
25833
|
}
|
|
25693
25834
|
try {
|
|
@@ -25697,7 +25838,7 @@ function resolveOpSecret(reference) {
|
|
|
25697
25838
|
}).trim();
|
|
25698
25839
|
} catch {
|
|
25699
25840
|
console.error(
|
|
25700
|
-
|
|
25841
|
+
chalk185.red(
|
|
25701
25842
|
"Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
|
|
25702
25843
|
)
|
|
25703
25844
|
);
|
|
@@ -25724,7 +25865,7 @@ async function ravenFetch(connection, path80) {
|
|
|
25724
25865
|
if (!response.ok) {
|
|
25725
25866
|
const body = await response.text();
|
|
25726
25867
|
console.error(
|
|
25727
|
-
|
|
25868
|
+
chalk186.red(`RavenDB error: ${response.status} ${response.statusText}`)
|
|
25728
25869
|
);
|
|
25729
25870
|
console.error(body.substring(0, 500));
|
|
25730
25871
|
process.exit(1);
|
|
@@ -25733,7 +25874,7 @@ async function ravenFetch(connection, path80) {
|
|
|
25733
25874
|
}
|
|
25734
25875
|
|
|
25735
25876
|
// src/commands/ravendb/resolveConnection.ts
|
|
25736
|
-
import
|
|
25877
|
+
import chalk187 from "chalk";
|
|
25737
25878
|
function loadRavendb() {
|
|
25738
25879
|
const raw = loadGlobalConfigRaw();
|
|
25739
25880
|
const ravendb = raw.ravendb;
|
|
@@ -25747,7 +25888,7 @@ function resolveConnection(name) {
|
|
|
25747
25888
|
const connectionName = name ?? defaultConnection;
|
|
25748
25889
|
if (!connectionName) {
|
|
25749
25890
|
console.error(
|
|
25750
|
-
|
|
25891
|
+
chalk187.red(
|
|
25751
25892
|
"No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
|
|
25752
25893
|
)
|
|
25753
25894
|
);
|
|
@@ -25755,7 +25896,7 @@ function resolveConnection(name) {
|
|
|
25755
25896
|
}
|
|
25756
25897
|
const connection = connections.find((c) => c.name === connectionName);
|
|
25757
25898
|
if (!connection) {
|
|
25758
|
-
console.error(
|
|
25899
|
+
console.error(chalk187.red(`Connection "${connectionName}" not found.`));
|
|
25759
25900
|
console.error(
|
|
25760
25901
|
`Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
|
|
25761
25902
|
);
|
|
@@ -25786,15 +25927,15 @@ async function ravendbCollections(connectionName) {
|
|
|
25786
25927
|
return;
|
|
25787
25928
|
}
|
|
25788
25929
|
for (const c of collections) {
|
|
25789
|
-
console.log(`${
|
|
25930
|
+
console.log(`${chalk188.bold(c.Name)} ${c.CountOfDocuments} docs`);
|
|
25790
25931
|
}
|
|
25791
25932
|
}
|
|
25792
25933
|
|
|
25793
25934
|
// src/commands/ravendb/ravendbQuery.ts
|
|
25794
|
-
import
|
|
25935
|
+
import chalk190 from "chalk";
|
|
25795
25936
|
|
|
25796
25937
|
// src/commands/ravendb/fetchAllPages.ts
|
|
25797
|
-
import
|
|
25938
|
+
import chalk189 from "chalk";
|
|
25798
25939
|
|
|
25799
25940
|
// src/commands/ravendb/buildQueryPath.ts
|
|
25800
25941
|
function buildQueryPath(opts) {
|
|
@@ -25832,7 +25973,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
25832
25973
|
allResults.push(...results);
|
|
25833
25974
|
start3 += results.length;
|
|
25834
25975
|
process.stderr.write(
|
|
25835
|
-
`\r${
|
|
25976
|
+
`\r${chalk189.dim(`Fetched ${allResults.length}/${totalResults}`)}`
|
|
25836
25977
|
);
|
|
25837
25978
|
if (start3 >= totalResults) break;
|
|
25838
25979
|
if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
|
|
@@ -25847,7 +25988,7 @@ async function fetchAllPages(connection, opts) {
|
|
|
25847
25988
|
async function ravendbQuery(connectionName, collection, options2) {
|
|
25848
25989
|
const resolved = resolveArgs(connectionName, collection);
|
|
25849
25990
|
if (!resolved.collection && !options2.query) {
|
|
25850
|
-
console.error(
|
|
25991
|
+
console.error(chalk190.red("Provide a collection name or --query filter."));
|
|
25851
25992
|
process.exit(1);
|
|
25852
25993
|
}
|
|
25853
25994
|
const { collection: col } = resolved;
|
|
@@ -25886,7 +26027,7 @@ import { spawn as spawn6 } from "child_process";
|
|
|
25886
26027
|
import * as path42 from "path";
|
|
25887
26028
|
|
|
25888
26029
|
// src/commands/refactor/logViolations.ts
|
|
25889
|
-
import
|
|
26030
|
+
import chalk191 from "chalk";
|
|
25890
26031
|
var DEFAULT_MAX_LINES2 = 100;
|
|
25891
26032
|
function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
25892
26033
|
if (violations.length === 0) {
|
|
@@ -25895,43 +26036,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
25895
26036
|
}
|
|
25896
26037
|
return;
|
|
25897
26038
|
}
|
|
25898
|
-
console.error(
|
|
26039
|
+
console.error(chalk191.red(`
|
|
25899
26040
|
Refactor check failed:
|
|
25900
26041
|
`));
|
|
25901
|
-
console.error(
|
|
26042
|
+
console.error(chalk191.red(` The following files exceed ${maxLines} lines:
|
|
25902
26043
|
`));
|
|
25903
26044
|
for (const violation of violations) {
|
|
25904
|
-
console.error(
|
|
26045
|
+
console.error(chalk191.red(` ${violation.file} (${violation.lines} lines)`));
|
|
25905
26046
|
}
|
|
25906
26047
|
console.error(
|
|
25907
|
-
|
|
26048
|
+
chalk191.yellow(
|
|
25908
26049
|
`
|
|
25909
26050
|
Each file needs to be sensibly refactored, or if there is no sensible
|
|
25910
26051
|
way to refactor it, ignore it with:
|
|
25911
26052
|
`
|
|
25912
26053
|
)
|
|
25913
26054
|
);
|
|
25914
|
-
console.error(
|
|
26055
|
+
console.error(chalk191.gray(` assist refactor ignore <file>
|
|
25915
26056
|
`));
|
|
25916
26057
|
if (process.env.CLAUDECODE) {
|
|
25917
|
-
console.error(
|
|
26058
|
+
console.error(chalk191.cyan(`
|
|
25918
26059
|
## Extracting Code to New Files
|
|
25919
26060
|
`));
|
|
25920
26061
|
console.error(
|
|
25921
|
-
|
|
26062
|
+
chalk191.cyan(
|
|
25922
26063
|
` When extracting logic from one file to another, consider where the extracted code belongs:
|
|
25923
26064
|
`
|
|
25924
26065
|
)
|
|
25925
26066
|
);
|
|
25926
26067
|
console.error(
|
|
25927
|
-
|
|
26068
|
+
chalk191.cyan(
|
|
25928
26069
|
` 1. Keep related logic together: If the extracted code is tightly coupled to the
|
|
25929
26070
|
original file's domain, create a new folder containing both the original and extracted files.
|
|
25930
26071
|
`
|
|
25931
26072
|
)
|
|
25932
26073
|
);
|
|
25933
26074
|
console.error(
|
|
25934
|
-
|
|
26075
|
+
chalk191.cyan(
|
|
25935
26076
|
` 2. Share common utilities: If the extracted code can be reused across multiple
|
|
25936
26077
|
domains, move it to a common/shared folder.
|
|
25937
26078
|
`
|
|
@@ -26087,7 +26228,7 @@ async function check(pattern2, options2) {
|
|
|
26087
26228
|
|
|
26088
26229
|
// src/commands/refactor/extract/index.ts
|
|
26089
26230
|
import path50 from "path";
|
|
26090
|
-
import
|
|
26231
|
+
import chalk194 from "chalk";
|
|
26091
26232
|
|
|
26092
26233
|
// src/commands/refactor/extract/applyExtraction.ts
|
|
26093
26234
|
import { SyntaxKind as SyntaxKind4 } from "ts-morph";
|
|
@@ -26686,23 +26827,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
|
|
|
26686
26827
|
|
|
26687
26828
|
// src/commands/refactor/extract/displayPlan.ts
|
|
26688
26829
|
import path46 from "path";
|
|
26689
|
-
import
|
|
26830
|
+
import chalk192 from "chalk";
|
|
26690
26831
|
function section2(title) {
|
|
26691
26832
|
return `
|
|
26692
|
-
${
|
|
26833
|
+
${chalk192.cyan(title)}`;
|
|
26693
26834
|
}
|
|
26694
26835
|
function displayImporters(plan2, cwd) {
|
|
26695
26836
|
if (plan2.importersToUpdate.length === 0) return;
|
|
26696
26837
|
console.log(section2("Update importers:"));
|
|
26697
26838
|
for (const imp of plan2.importersToUpdate) {
|
|
26698
26839
|
const rel = path46.relative(cwd, imp.file.getFilePath());
|
|
26699
|
-
console.log(` ${
|
|
26840
|
+
console.log(` ${chalk192.dim(rel)}: \u2192 import from "${imp.relPath}"`);
|
|
26700
26841
|
}
|
|
26701
26842
|
}
|
|
26702
26843
|
function displayPlan(functionName, relDest, plan2, cwd) {
|
|
26703
|
-
console.log(
|
|
26844
|
+
console.log(chalk192.bold(`Extract: ${functionName} \u2192 ${relDest}
|
|
26704
26845
|
`));
|
|
26705
|
-
console.log(` ${
|
|
26846
|
+
console.log(` ${chalk192.cyan("Functions to move:")}`);
|
|
26706
26847
|
for (const name of plan2.extractedNames) {
|
|
26707
26848
|
console.log(` ${name}`);
|
|
26708
26849
|
}
|
|
@@ -26736,7 +26877,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
|
|
|
26736
26877
|
|
|
26737
26878
|
// src/commands/refactor/extract/loadProjectFile.ts
|
|
26738
26879
|
import path49 from "path";
|
|
26739
|
-
import
|
|
26880
|
+
import chalk193 from "chalk";
|
|
26740
26881
|
import { Project as Project4 } from "ts-morph";
|
|
26741
26882
|
|
|
26742
26883
|
// src/commands/refactor/extract/findTsConfig.ts
|
|
@@ -26828,7 +26969,7 @@ function loadProjectFile(file) {
|
|
|
26828
26969
|
});
|
|
26829
26970
|
const sourceFile = project.getSourceFile(sourcePath);
|
|
26830
26971
|
if (!sourceFile) {
|
|
26831
|
-
console.log(
|
|
26972
|
+
console.log(chalk193.red(`File not found in project: ${file}`));
|
|
26832
26973
|
process.exit(1);
|
|
26833
26974
|
}
|
|
26834
26975
|
return { project, sourceFile };
|
|
@@ -26851,19 +26992,19 @@ async function extract(file, functionName, destination, options2 = {}) {
|
|
|
26851
26992
|
displayPlan(functionName, relDest, plan2, cwd);
|
|
26852
26993
|
if (options2.apply) {
|
|
26853
26994
|
await applyExtraction(functionName, sourceFile, destPath, plan2, project);
|
|
26854
|
-
console.log(
|
|
26995
|
+
console.log(chalk194.green("\nExtraction complete"));
|
|
26855
26996
|
} else {
|
|
26856
|
-
console.log(
|
|
26997
|
+
console.log(chalk194.dim("\nDry run. Use --apply to execute."));
|
|
26857
26998
|
}
|
|
26858
26999
|
}
|
|
26859
27000
|
|
|
26860
27001
|
// src/commands/refactor/ignore.ts
|
|
26861
27002
|
import fs33 from "fs";
|
|
26862
|
-
import
|
|
27003
|
+
import chalk195 from "chalk";
|
|
26863
27004
|
var REFACTOR_YML_PATH2 = "refactor.yml";
|
|
26864
27005
|
function ignore2(file) {
|
|
26865
27006
|
if (!fs33.existsSync(file)) {
|
|
26866
|
-
console.error(
|
|
27007
|
+
console.error(chalk195.red(`Error: File does not exist: ${file}`));
|
|
26867
27008
|
process.exit(1);
|
|
26868
27009
|
}
|
|
26869
27010
|
const content = fs33.readFileSync(file, "utf8");
|
|
@@ -26879,7 +27020,7 @@ function ignore2(file) {
|
|
|
26879
27020
|
fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
|
|
26880
27021
|
}
|
|
26881
27022
|
console.log(
|
|
26882
|
-
|
|
27023
|
+
chalk195.green(
|
|
26883
27024
|
`Added ${file} to refactor ignore list (max ${maxLines} lines)`
|
|
26884
27025
|
)
|
|
26885
27026
|
);
|
|
@@ -26888,12 +27029,12 @@ function ignore2(file) {
|
|
|
26888
27029
|
// src/commands/refactor/rename/index.ts
|
|
26889
27030
|
import fs36 from "fs";
|
|
26890
27031
|
import path55 from "path";
|
|
26891
|
-
import
|
|
27032
|
+
import chalk198 from "chalk";
|
|
26892
27033
|
|
|
26893
27034
|
// src/commands/refactor/rename/applyRename.ts
|
|
26894
27035
|
import fs35 from "fs";
|
|
26895
27036
|
import path52 from "path";
|
|
26896
|
-
import
|
|
27037
|
+
import chalk196 from "chalk";
|
|
26897
27038
|
|
|
26898
27039
|
// src/commands/refactor/restructure/computeRewrites/index.ts
|
|
26899
27040
|
import path51 from "path";
|
|
@@ -26998,13 +27139,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
|
|
|
26998
27139
|
const updatedContents = applyRewrites(rewrites);
|
|
26999
27140
|
for (const [file, content] of updatedContents) {
|
|
27000
27141
|
fs35.writeFileSync(file, content, "utf8");
|
|
27001
|
-
console.log(
|
|
27142
|
+
console.log(chalk196.cyan(` Updated imports in ${path52.relative(cwd, file)}`));
|
|
27002
27143
|
}
|
|
27003
27144
|
const destDir = path52.dirname(destPath);
|
|
27004
27145
|
if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
|
|
27005
27146
|
fs35.renameSync(sourcePath, destPath);
|
|
27006
27147
|
console.log(
|
|
27007
|
-
|
|
27148
|
+
chalk196.white(
|
|
27008
27149
|
` Moved ${path52.relative(cwd, sourcePath)} \u2192 ${path52.relative(cwd, destPath)}`
|
|
27009
27150
|
)
|
|
27010
27151
|
);
|
|
@@ -27091,16 +27232,16 @@ function computeRenameRewrites(sourcePath, destPath) {
|
|
|
27091
27232
|
|
|
27092
27233
|
// src/commands/refactor/rename/printRenamePreview.ts
|
|
27093
27234
|
import path54 from "path";
|
|
27094
|
-
import
|
|
27235
|
+
import chalk197 from "chalk";
|
|
27095
27236
|
function printRenamePreview(rewrites, cwd) {
|
|
27096
27237
|
for (const rewrite of rewrites) {
|
|
27097
27238
|
console.log(
|
|
27098
|
-
|
|
27239
|
+
chalk197.dim(
|
|
27099
27240
|
` ${path54.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
|
|
27100
27241
|
)
|
|
27101
27242
|
);
|
|
27102
27243
|
}
|
|
27103
|
-
console.log(
|
|
27244
|
+
console.log(chalk197.dim("Dry run. Use --apply to execute."));
|
|
27104
27245
|
}
|
|
27105
27246
|
|
|
27106
27247
|
// src/commands/refactor/rename/index.ts
|
|
@@ -27111,20 +27252,20 @@ async function rename(source, destination, options2 = {}) {
|
|
|
27111
27252
|
const relSource = path55.relative(cwd, sourcePath);
|
|
27112
27253
|
const relDest = path55.relative(cwd, destPath);
|
|
27113
27254
|
if (!fs36.existsSync(sourcePath)) {
|
|
27114
|
-
console.log(
|
|
27255
|
+
console.log(chalk198.red(`File not found: ${source}`));
|
|
27115
27256
|
process.exit(1);
|
|
27116
27257
|
}
|
|
27117
27258
|
if (destPath !== sourcePath && fs36.existsSync(destPath)) {
|
|
27118
|
-
console.log(
|
|
27259
|
+
console.log(chalk198.red(`Destination already exists: ${destination}`));
|
|
27119
27260
|
process.exit(1);
|
|
27120
27261
|
}
|
|
27121
|
-
console.log(
|
|
27122
|
-
console.log(
|
|
27123
|
-
console.log(
|
|
27262
|
+
console.log(chalk198.bold(`Rename: ${relSource} \u2192 ${relDest}`));
|
|
27263
|
+
console.log(chalk198.dim("Loading project..."));
|
|
27264
|
+
console.log(chalk198.dim("Scanning imports across the project..."));
|
|
27124
27265
|
const rewrites = computeRenameRewrites(sourcePath, destPath);
|
|
27125
27266
|
const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
|
|
27126
27267
|
console.log(
|
|
27127
|
-
|
|
27268
|
+
chalk198.dim(
|
|
27128
27269
|
`${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
|
|
27129
27270
|
)
|
|
27130
27271
|
);
|
|
@@ -27133,11 +27274,11 @@ async function rename(source, destination, options2 = {}) {
|
|
|
27133
27274
|
return;
|
|
27134
27275
|
}
|
|
27135
27276
|
applyRename(rewrites, sourcePath, destPath, cwd);
|
|
27136
|
-
console.log(
|
|
27277
|
+
console.log(chalk198.green("Done"));
|
|
27137
27278
|
}
|
|
27138
27279
|
|
|
27139
27280
|
// src/commands/refactor/renameSymbol/index.ts
|
|
27140
|
-
import
|
|
27281
|
+
import chalk199 from "chalk";
|
|
27141
27282
|
|
|
27142
27283
|
// src/commands/refactor/renameSymbol/findSymbol.ts
|
|
27143
27284
|
import { SyntaxKind as SyntaxKind15 } from "ts-morph";
|
|
@@ -27183,33 +27324,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
27183
27324
|
const { project, sourceFile } = loadProjectFile(file);
|
|
27184
27325
|
const symbol = findSymbol(sourceFile, oldName);
|
|
27185
27326
|
if (!symbol) {
|
|
27186
|
-
console.log(
|
|
27327
|
+
console.log(chalk199.red(`Symbol "${oldName}" not found in ${file}`));
|
|
27187
27328
|
process.exit(1);
|
|
27188
27329
|
}
|
|
27189
27330
|
const grouped = groupReferences(symbol, cwd);
|
|
27190
27331
|
const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
|
|
27191
27332
|
console.log(
|
|
27192
|
-
|
|
27333
|
+
chalk199.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
27193
27334
|
`)
|
|
27194
27335
|
);
|
|
27195
27336
|
for (const [refFile, lines2] of grouped) {
|
|
27196
27337
|
console.log(
|
|
27197
|
-
` ${
|
|
27338
|
+
` ${chalk199.dim(refFile)}: lines ${chalk199.cyan(lines2.join(", "))}`
|
|
27198
27339
|
);
|
|
27199
27340
|
}
|
|
27200
27341
|
if (options2.apply) {
|
|
27201
27342
|
symbol.rename(newName);
|
|
27202
27343
|
await project.save();
|
|
27203
|
-
console.log(
|
|
27344
|
+
console.log(chalk199.green(`
|
|
27204
27345
|
Renamed ${oldName} \u2192 ${newName}`));
|
|
27205
27346
|
} else {
|
|
27206
|
-
console.log(
|
|
27347
|
+
console.log(chalk199.dim("\nDry run. Use --apply to execute."));
|
|
27207
27348
|
}
|
|
27208
27349
|
}
|
|
27209
27350
|
|
|
27210
27351
|
// src/commands/refactor/restructure/index.ts
|
|
27211
27352
|
import path63 from "path";
|
|
27212
|
-
import
|
|
27353
|
+
import chalk202 from "chalk";
|
|
27213
27354
|
|
|
27214
27355
|
// src/commands/refactor/restructure/clusterDirectories.ts
|
|
27215
27356
|
import path57 from "path";
|
|
@@ -27288,50 +27429,50 @@ function clusterFiles(graph) {
|
|
|
27288
27429
|
|
|
27289
27430
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
27290
27431
|
import path59 from "path";
|
|
27291
|
-
import
|
|
27432
|
+
import chalk200 from "chalk";
|
|
27292
27433
|
function relPath(filePath) {
|
|
27293
27434
|
return path59.relative(process.cwd(), filePath);
|
|
27294
27435
|
}
|
|
27295
27436
|
function displayMoves(plan2) {
|
|
27296
27437
|
if (plan2.moves.length === 0) return;
|
|
27297
|
-
console.log(
|
|
27438
|
+
console.log(chalk200.bold("\nFile moves:"));
|
|
27298
27439
|
for (const move2 of plan2.moves) {
|
|
27299
27440
|
console.log(
|
|
27300
|
-
` ${
|
|
27441
|
+
` ${chalk200.red(relPath(move2.from))} \u2192 ${chalk200.green(relPath(move2.to))}`
|
|
27301
27442
|
);
|
|
27302
|
-
console.log(
|
|
27443
|
+
console.log(chalk200.dim(` ${move2.reason}`));
|
|
27303
27444
|
}
|
|
27304
27445
|
}
|
|
27305
27446
|
function displayRewrites(rewrites) {
|
|
27306
27447
|
if (rewrites.length === 0) return;
|
|
27307
27448
|
const affectedFiles = new Set(rewrites.map((r) => r.file));
|
|
27308
|
-
console.log(
|
|
27449
|
+
console.log(chalk200.bold(`
|
|
27309
27450
|
Import rewrites (${affectedFiles.size} files):`));
|
|
27310
27451
|
for (const file of affectedFiles) {
|
|
27311
|
-
console.log(` ${
|
|
27452
|
+
console.log(` ${chalk200.cyan(relPath(file))}:`);
|
|
27312
27453
|
for (const { oldSpecifier, newSpecifier } of rewrites.filter(
|
|
27313
27454
|
(r) => r.file === file
|
|
27314
27455
|
)) {
|
|
27315
27456
|
console.log(
|
|
27316
|
-
` ${
|
|
27457
|
+
` ${chalk200.red(`"${oldSpecifier}"`)} \u2192 ${chalk200.green(`"${newSpecifier}"`)}`
|
|
27317
27458
|
);
|
|
27318
27459
|
}
|
|
27319
27460
|
}
|
|
27320
27461
|
}
|
|
27321
27462
|
function displayPlan2(plan2) {
|
|
27322
27463
|
if (plan2.warnings.length > 0) {
|
|
27323
|
-
console.log(
|
|
27324
|
-
for (const w of plan2.warnings) console.log(
|
|
27464
|
+
console.log(chalk200.yellow("\nWarnings:"));
|
|
27465
|
+
for (const w of plan2.warnings) console.log(chalk200.yellow(` ${w}`));
|
|
27325
27466
|
}
|
|
27326
27467
|
if (plan2.newDirectories.length > 0) {
|
|
27327
|
-
console.log(
|
|
27468
|
+
console.log(chalk200.bold("\nNew directories:"));
|
|
27328
27469
|
for (const dir of plan2.newDirectories)
|
|
27329
|
-
console.log(
|
|
27470
|
+
console.log(chalk200.green(` ${dir}/`));
|
|
27330
27471
|
}
|
|
27331
27472
|
displayMoves(plan2);
|
|
27332
27473
|
displayRewrites(plan2.rewrites);
|
|
27333
27474
|
console.log(
|
|
27334
|
-
|
|
27475
|
+
chalk200.dim(
|
|
27335
27476
|
`
|
|
27336
27477
|
Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
|
|
27337
27478
|
)
|
|
@@ -27341,18 +27482,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
|
|
|
27341
27482
|
// src/commands/refactor/restructure/executePlan.ts
|
|
27342
27483
|
import fs37 from "fs";
|
|
27343
27484
|
import path60 from "path";
|
|
27344
|
-
import
|
|
27485
|
+
import chalk201 from "chalk";
|
|
27345
27486
|
function executePlan(plan2) {
|
|
27346
27487
|
const updatedContents = applyRewrites(plan2.rewrites);
|
|
27347
27488
|
for (const [file, content] of updatedContents) {
|
|
27348
27489
|
fs37.writeFileSync(file, content, "utf8");
|
|
27349
27490
|
console.log(
|
|
27350
|
-
|
|
27491
|
+
chalk201.cyan(` Rewrote imports in ${path60.relative(process.cwd(), file)}`)
|
|
27351
27492
|
);
|
|
27352
27493
|
}
|
|
27353
27494
|
for (const dir of plan2.newDirectories) {
|
|
27354
27495
|
fs37.mkdirSync(dir, { recursive: true });
|
|
27355
|
-
console.log(
|
|
27496
|
+
console.log(chalk201.green(` Created ${path60.relative(process.cwd(), dir)}/`));
|
|
27356
27497
|
}
|
|
27357
27498
|
for (const move2 of plan2.moves) {
|
|
27358
27499
|
const targetDir = path60.dirname(move2.to);
|
|
@@ -27361,7 +27502,7 @@ function executePlan(plan2) {
|
|
|
27361
27502
|
}
|
|
27362
27503
|
fs37.renameSync(move2.from, move2.to);
|
|
27363
27504
|
console.log(
|
|
27364
|
-
|
|
27505
|
+
chalk201.white(
|
|
27365
27506
|
` Moved ${path60.relative(process.cwd(), move2.from)} \u2192 ${path60.relative(process.cwd(), move2.to)}`
|
|
27366
27507
|
)
|
|
27367
27508
|
);
|
|
@@ -27376,7 +27517,7 @@ function removeEmptyDirectories(dirs) {
|
|
|
27376
27517
|
if (entries.length === 0) {
|
|
27377
27518
|
fs37.rmdirSync(dir);
|
|
27378
27519
|
console.log(
|
|
27379
|
-
|
|
27520
|
+
chalk201.dim(
|
|
27380
27521
|
` Removed empty directory ${path60.relative(process.cwd(), dir)}`
|
|
27381
27522
|
)
|
|
27382
27523
|
);
|
|
@@ -27509,22 +27650,22 @@ async function restructure(pattern2, options2 = {}) {
|
|
|
27509
27650
|
const targetPattern = pattern2 ?? "src";
|
|
27510
27651
|
const files = findSourceFiles2(targetPattern);
|
|
27511
27652
|
if (files.length === 0) {
|
|
27512
|
-
console.log(
|
|
27653
|
+
console.log(chalk202.yellow("No files found matching pattern"));
|
|
27513
27654
|
return;
|
|
27514
27655
|
}
|
|
27515
27656
|
const tsConfigPath = findTsConfig(path63.resolve(files[0]));
|
|
27516
27657
|
const plan2 = buildPlan3(files, tsConfigPath);
|
|
27517
27658
|
if (plan2.moves.length === 0) {
|
|
27518
|
-
console.log(
|
|
27659
|
+
console.log(chalk202.green("No restructuring needed"));
|
|
27519
27660
|
return;
|
|
27520
27661
|
}
|
|
27521
27662
|
displayPlan2(plan2);
|
|
27522
27663
|
if (options2.apply) {
|
|
27523
|
-
console.log(
|
|
27664
|
+
console.log(chalk202.bold("\nApplying changes..."));
|
|
27524
27665
|
executePlan(plan2);
|
|
27525
|
-
console.log(
|
|
27666
|
+
console.log(chalk202.green("\nRestructuring complete"));
|
|
27526
27667
|
} else {
|
|
27527
|
-
console.log(
|
|
27668
|
+
console.log(chalk202.dim("\nDry run. Use --apply to execute."));
|
|
27528
27669
|
}
|
|
27529
27670
|
}
|
|
27530
27671
|
|
|
@@ -27847,7 +27988,7 @@ function gatherContext() {
|
|
|
27847
27988
|
}
|
|
27848
27989
|
|
|
27849
27990
|
// src/commands/review/postReviewToPr.ts
|
|
27850
|
-
import { readFileSync as
|
|
27991
|
+
import { readFileSync as readFileSync44 } from "fs";
|
|
27851
27992
|
|
|
27852
27993
|
// src/commands/review/carriedUnanchoredFindings.ts
|
|
27853
27994
|
function carriedUnanchoredFindings(unanchored) {
|
|
@@ -28182,18 +28323,18 @@ function partitionFindingsByDiff(findings, index3) {
|
|
|
28182
28323
|
}
|
|
28183
28324
|
|
|
28184
28325
|
// src/commands/review/warnOutOfDiff.ts
|
|
28185
|
-
import
|
|
28326
|
+
import chalk203 from "chalk";
|
|
28186
28327
|
function warnOutOfDiff(outOfDiff) {
|
|
28187
28328
|
if (outOfDiff.length === 0) return;
|
|
28188
28329
|
console.warn(
|
|
28189
|
-
|
|
28330
|
+
chalk203.yellow(
|
|
28190
28331
|
`Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
|
|
28191
28332
|
)
|
|
28192
28333
|
);
|
|
28193
28334
|
for (const finding of outOfDiff) {
|
|
28194
28335
|
const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
|
|
28195
28336
|
console.warn(
|
|
28196
|
-
` ${
|
|
28337
|
+
` ${chalk203.yellow("\xB7")} ${finding.title} ${chalk203.dim(
|
|
28197
28338
|
`(${finding.file}:${range})`
|
|
28198
28339
|
)}`
|
|
28199
28340
|
);
|
|
@@ -28217,18 +28358,18 @@ function selectInDiffFindings(lineBound, prDiff) {
|
|
|
28217
28358
|
}
|
|
28218
28359
|
|
|
28219
28360
|
// src/commands/review/warnUnlocated.ts
|
|
28220
|
-
import
|
|
28361
|
+
import chalk204 from "chalk";
|
|
28221
28362
|
function warnUnlocated(unlocated) {
|
|
28222
28363
|
if (unlocated.length === 0) return;
|
|
28223
28364
|
console.warn(
|
|
28224
|
-
|
|
28365
|
+
chalk204.yellow(
|
|
28225
28366
|
`Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
|
|
28226
28367
|
)
|
|
28227
28368
|
);
|
|
28228
28369
|
for (const finding of unlocated) {
|
|
28229
|
-
const where = finding.location ||
|
|
28370
|
+
const where = finding.location || chalk204.dim("missing");
|
|
28230
28371
|
console.warn(
|
|
28231
|
-
` ${
|
|
28372
|
+
` ${chalk204.yellow("\xB7")} ${finding.title} ${chalk204.dim(`(${where})`)}`
|
|
28232
28373
|
);
|
|
28233
28374
|
}
|
|
28234
28375
|
}
|
|
@@ -28295,7 +28436,7 @@ async function confirmPost(prNumber, work, options2) {
|
|
|
28295
28436
|
return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
|
|
28296
28437
|
}
|
|
28297
28438
|
async function postFindingsToPr(prInfo, synthesisPath, options2) {
|
|
28298
|
-
const markdown =
|
|
28439
|
+
const markdown = readFileSync44(synthesisPath, "utf8");
|
|
28299
28440
|
const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
|
|
28300
28441
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
28301
28442
|
if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
|
|
@@ -28431,16 +28572,16 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
|
|
|
28431
28572
|
}
|
|
28432
28573
|
|
|
28433
28574
|
// src/commands/review/prepareReviewDir.ts
|
|
28434
|
-
import { existsSync as
|
|
28575
|
+
import { existsSync as existsSync56, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
|
|
28435
28576
|
function clearReviewFiles(paths) {
|
|
28436
28577
|
for (const path80 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
|
|
28437
|
-
if (
|
|
28578
|
+
if (existsSync56(path80)) unlinkSync17(path80);
|
|
28438
28579
|
}
|
|
28439
28580
|
}
|
|
28440
28581
|
function prepareReviewDir(paths, requestBody, force) {
|
|
28441
|
-
|
|
28582
|
+
mkdirSync21(paths.reviewDir, { recursive: true });
|
|
28442
28583
|
if (force) clearReviewFiles(paths);
|
|
28443
|
-
|
|
28584
|
+
writeFileSync38(paths.requestPath, requestBody);
|
|
28444
28585
|
}
|
|
28445
28586
|
|
|
28446
28587
|
// src/commands/review/cachedReviewerResult.ts
|
|
@@ -28661,7 +28802,7 @@ function printReviewerFailures(results) {
|
|
|
28661
28802
|
}
|
|
28662
28803
|
|
|
28663
28804
|
// src/commands/review/runAndSynthesise.ts
|
|
28664
|
-
import { existsSync as
|
|
28805
|
+
import { existsSync as existsSync58, unlinkSync as unlinkSync19 } from "fs";
|
|
28665
28806
|
|
|
28666
28807
|
// src/commands/review/buildReviewerStdin.ts
|
|
28667
28808
|
var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
|
|
@@ -28736,7 +28877,7 @@ The review request is at: ${requestPath}
|
|
|
28736
28877
|
}
|
|
28737
28878
|
|
|
28738
28879
|
// src/commands/review/runClaudeReviewer.ts
|
|
28739
|
-
import { writeFileSync as
|
|
28880
|
+
import { writeFileSync as writeFileSync39 } from "fs";
|
|
28740
28881
|
|
|
28741
28882
|
// src/commands/review/finaliseReviewerSpinner.ts
|
|
28742
28883
|
var SUMMARY_MAX_LEN = 80;
|
|
@@ -29072,7 +29213,7 @@ async function runClaudeReviewer(spec) {
|
|
|
29072
29213
|
}
|
|
29073
29214
|
});
|
|
29074
29215
|
if (result.exitCode === 0 && finalText)
|
|
29075
|
-
|
|
29216
|
+
writeFileSync39(spec.outputPath, finalText);
|
|
29076
29217
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
29077
29218
|
}
|
|
29078
29219
|
|
|
@@ -29090,7 +29231,7 @@ function resolveClaude(args) {
|
|
|
29090
29231
|
}
|
|
29091
29232
|
|
|
29092
29233
|
// src/commands/review/runCodexReviewer.ts
|
|
29093
|
-
import { existsSync as
|
|
29234
|
+
import { existsSync as existsSync57, unlinkSync as unlinkSync18 } from "fs";
|
|
29094
29235
|
|
|
29095
29236
|
// src/commands/review/parseCodexEvent.ts
|
|
29096
29237
|
function isItemStarted(value) {
|
|
@@ -29142,7 +29283,7 @@ async function runCodexReviewer(spec) {
|
|
|
29142
29283
|
reportReviewerToolUse(spec.name, event, spinner);
|
|
29143
29284
|
}
|
|
29144
29285
|
});
|
|
29145
|
-
if (result.exitCode !== 0 &&
|
|
29286
|
+
if (result.exitCode !== 0 && existsSync57(spec.outputPath)) {
|
|
29146
29287
|
unlinkSync18(spec.outputPath);
|
|
29147
29288
|
}
|
|
29148
29289
|
return finaliseReviewerRun({ ...spec, command }, spinner, result);
|
|
@@ -29184,7 +29325,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
|
|
|
29184
29325
|
}
|
|
29185
29326
|
|
|
29186
29327
|
// src/commands/review/synthesise.ts
|
|
29187
|
-
import { readFileSync as
|
|
29328
|
+
import { readFileSync as readFileSync45 } from "fs";
|
|
29188
29329
|
|
|
29189
29330
|
// src/commands/review/buildSynthesisStdin.ts
|
|
29190
29331
|
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.
|
|
@@ -29249,7 +29390,7 @@ Files:
|
|
|
29249
29390
|
|
|
29250
29391
|
// src/commands/review/synthesise.ts
|
|
29251
29392
|
function printSummary2(synthesisPath) {
|
|
29252
|
-
const markdown =
|
|
29393
|
+
const markdown = readFileSync45(synthesisPath, "utf8");
|
|
29253
29394
|
console.log("");
|
|
29254
29395
|
console.log(buildReviewSummary(markdown));
|
|
29255
29396
|
console.log("");
|
|
@@ -29297,7 +29438,7 @@ async function runAndSynthesise(args) {
|
|
|
29297
29438
|
console.error("Both reviewers failed; skipping synthesis.");
|
|
29298
29439
|
return { ok: false, failures };
|
|
29299
29440
|
}
|
|
29300
|
-
if (anyFresh &&
|
|
29441
|
+
if (anyFresh && existsSync58(paths.synthesisPath)) {
|
|
29301
29442
|
unlinkSync19(paths.synthesisPath);
|
|
29302
29443
|
}
|
|
29303
29444
|
const synthesisResult = await synthesise(paths, { multi });
|
|
@@ -29483,7 +29624,7 @@ function registerReview(program2) {
|
|
|
29483
29624
|
}
|
|
29484
29625
|
|
|
29485
29626
|
// src/commands/seq/seqAuth.ts
|
|
29486
|
-
import
|
|
29627
|
+
import chalk206 from "chalk";
|
|
29487
29628
|
|
|
29488
29629
|
// src/commands/seq/loadConnections.ts
|
|
29489
29630
|
function loadConnections2() {
|
|
@@ -29512,10 +29653,10 @@ function setDefaultConnection(name) {
|
|
|
29512
29653
|
}
|
|
29513
29654
|
|
|
29514
29655
|
// src/shared/assertUniqueName.ts
|
|
29515
|
-
import
|
|
29656
|
+
import chalk205 from "chalk";
|
|
29516
29657
|
function assertUniqueName(existingNames, name) {
|
|
29517
29658
|
if (existingNames.includes(name)) {
|
|
29518
|
-
console.error(
|
|
29659
|
+
console.error(chalk205.red(`Connection "${name}" already exists.`));
|
|
29519
29660
|
process.exit(1);
|
|
29520
29661
|
}
|
|
29521
29662
|
}
|
|
@@ -29533,16 +29674,16 @@ async function promptConnection2(existingNames) {
|
|
|
29533
29674
|
var seqAuth = createConnectionAuth({
|
|
29534
29675
|
load: loadConnections2,
|
|
29535
29676
|
save: saveConnections2,
|
|
29536
|
-
format: (c) => `${
|
|
29677
|
+
format: (c) => `${chalk206.bold(c.name)} ${c.url}`,
|
|
29537
29678
|
promptNew: promptConnection2,
|
|
29538
29679
|
onFirst: (c) => setDefaultConnection(c.name)
|
|
29539
29680
|
});
|
|
29540
29681
|
|
|
29541
29682
|
// src/commands/seq/seqQuery.ts
|
|
29542
|
-
import
|
|
29683
|
+
import chalk210 from "chalk";
|
|
29543
29684
|
|
|
29544
29685
|
// src/commands/seq/fetchSeq.ts
|
|
29545
|
-
import
|
|
29686
|
+
import chalk207 from "chalk";
|
|
29546
29687
|
async function fetchSeq(conn, path80, params) {
|
|
29547
29688
|
const url = `${conn.url}${path80}?${params}`;
|
|
29548
29689
|
const response = await fetch(url, {
|
|
@@ -29553,7 +29694,7 @@ async function fetchSeq(conn, path80, params) {
|
|
|
29553
29694
|
});
|
|
29554
29695
|
if (!response.ok) {
|
|
29555
29696
|
const body = await response.text();
|
|
29556
|
-
console.error(
|
|
29697
|
+
console.error(chalk207.red(`Seq returned ${response.status}: ${body}`));
|
|
29557
29698
|
process.exit(1);
|
|
29558
29699
|
}
|
|
29559
29700
|
return response;
|
|
@@ -29612,23 +29753,23 @@ async function fetchSeqEvents(conn, params) {
|
|
|
29612
29753
|
}
|
|
29613
29754
|
|
|
29614
29755
|
// src/commands/seq/formatEvent.ts
|
|
29615
|
-
import
|
|
29756
|
+
import chalk208 from "chalk";
|
|
29616
29757
|
function levelColor(level) {
|
|
29617
29758
|
switch (level) {
|
|
29618
29759
|
case "Fatal":
|
|
29619
|
-
return
|
|
29760
|
+
return chalk208.bgRed.white;
|
|
29620
29761
|
case "Error":
|
|
29621
|
-
return
|
|
29762
|
+
return chalk208.red;
|
|
29622
29763
|
case "Warning":
|
|
29623
|
-
return
|
|
29764
|
+
return chalk208.yellow;
|
|
29624
29765
|
case "Information":
|
|
29625
|
-
return
|
|
29766
|
+
return chalk208.cyan;
|
|
29626
29767
|
case "Debug":
|
|
29627
|
-
return
|
|
29768
|
+
return chalk208.gray;
|
|
29628
29769
|
case "Verbose":
|
|
29629
|
-
return
|
|
29770
|
+
return chalk208.dim;
|
|
29630
29771
|
default:
|
|
29631
|
-
return
|
|
29772
|
+
return chalk208.white;
|
|
29632
29773
|
}
|
|
29633
29774
|
}
|
|
29634
29775
|
function levelAbbrev(level) {
|
|
@@ -29669,12 +29810,12 @@ function formatTimestamp(iso) {
|
|
|
29669
29810
|
function formatEvent(event) {
|
|
29670
29811
|
const color = levelColor(event.Level);
|
|
29671
29812
|
const abbrev = levelAbbrev(event.Level);
|
|
29672
|
-
const ts8 =
|
|
29813
|
+
const ts8 = chalk208.dim(formatTimestamp(event.Timestamp));
|
|
29673
29814
|
const msg = renderMessage(event);
|
|
29674
29815
|
const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
|
|
29675
29816
|
if (event.Exception) {
|
|
29676
29817
|
for (const line of event.Exception.split("\n")) {
|
|
29677
|
-
lines2.push(
|
|
29818
|
+
lines2.push(chalk208.red(` ${line}`));
|
|
29678
29819
|
}
|
|
29679
29820
|
}
|
|
29680
29821
|
return lines2.join("\n");
|
|
@@ -29707,11 +29848,11 @@ function rejectTimestampFilter(filter) {
|
|
|
29707
29848
|
}
|
|
29708
29849
|
|
|
29709
29850
|
// src/shared/resolveNamedConnection.ts
|
|
29710
|
-
import
|
|
29851
|
+
import chalk209 from "chalk";
|
|
29711
29852
|
function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
|
|
29712
29853
|
if (connections.length === 0) {
|
|
29713
29854
|
console.error(
|
|
29714
|
-
|
|
29855
|
+
chalk209.red(
|
|
29715
29856
|
`No ${kind} connections configured. Run '${authCommand}' first.`
|
|
29716
29857
|
)
|
|
29717
29858
|
);
|
|
@@ -29720,7 +29861,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
|
|
|
29720
29861
|
const target = requested ?? defaultName ?? connections[0].name;
|
|
29721
29862
|
const connection = connections.find((c) => c.name === target);
|
|
29722
29863
|
if (!connection) {
|
|
29723
|
-
console.error(
|
|
29864
|
+
console.error(chalk209.red(`${kind} connection "${target}" not found.`));
|
|
29724
29865
|
process.exit(1);
|
|
29725
29866
|
}
|
|
29726
29867
|
return connection;
|
|
@@ -29749,7 +29890,7 @@ async function seqQuery(filter, options2) {
|
|
|
29749
29890
|
new URLSearchParams({ filter, count: String(count8) })
|
|
29750
29891
|
);
|
|
29751
29892
|
if (events.length === 0) {
|
|
29752
|
-
console.log(
|
|
29893
|
+
console.log(chalk210.yellow("No events found."));
|
|
29753
29894
|
return;
|
|
29754
29895
|
}
|
|
29755
29896
|
if (options2.json) {
|
|
@@ -29760,11 +29901,11 @@ async function seqQuery(filter, options2) {
|
|
|
29760
29901
|
for (const event of chronological) {
|
|
29761
29902
|
console.log(formatEvent(event));
|
|
29762
29903
|
}
|
|
29763
|
-
console.log(
|
|
29904
|
+
console.log(chalk210.dim(`
|
|
29764
29905
|
${events.length} events`));
|
|
29765
29906
|
if (events.length >= count8) {
|
|
29766
29907
|
console.log(
|
|
29767
|
-
|
|
29908
|
+
chalk210.yellow(
|
|
29768
29909
|
`Results limited to ${count8}. Use --count to retrieve more.`
|
|
29769
29910
|
)
|
|
29770
29911
|
);
|
|
@@ -29772,10 +29913,10 @@ ${events.length} events`));
|
|
|
29772
29913
|
}
|
|
29773
29914
|
|
|
29774
29915
|
// src/shared/setNamedDefaultConnection.ts
|
|
29775
|
-
import
|
|
29916
|
+
import chalk211 from "chalk";
|
|
29776
29917
|
function setNamedDefaultConnection(connections, name, setDefault, kind) {
|
|
29777
29918
|
if (!connections.find((c) => c.name === name)) {
|
|
29778
|
-
console.error(
|
|
29919
|
+
console.error(chalk211.red(`Connection "${name}" not found.`));
|
|
29779
29920
|
process.exit(1);
|
|
29780
29921
|
}
|
|
29781
29922
|
setDefault(name);
|
|
@@ -29824,7 +29965,7 @@ function registerSignal(program2) {
|
|
|
29824
29965
|
}
|
|
29825
29966
|
|
|
29826
29967
|
// src/commands/sql/sqlAuth.ts
|
|
29827
|
-
import
|
|
29968
|
+
import chalk213 from "chalk";
|
|
29828
29969
|
|
|
29829
29970
|
// src/commands/sql/loadConnections.ts
|
|
29830
29971
|
function loadConnections3() {
|
|
@@ -29853,7 +29994,7 @@ function setDefaultConnection2(name) {
|
|
|
29853
29994
|
}
|
|
29854
29995
|
|
|
29855
29996
|
// src/commands/sql/promptConnection.ts
|
|
29856
|
-
import
|
|
29997
|
+
import chalk212 from "chalk";
|
|
29857
29998
|
async function promptConnection3(existingNames) {
|
|
29858
29999
|
const name = await promptInput("name", "Connection name:", "default");
|
|
29859
30000
|
assertUniqueName(existingNames, name);
|
|
@@ -29861,7 +30002,7 @@ async function promptConnection3(existingNames) {
|
|
|
29861
30002
|
const portStr = await promptInput("port", "Port:", "1433");
|
|
29862
30003
|
const port = Number.parseInt(portStr, 10);
|
|
29863
30004
|
if (!Number.isFinite(port)) {
|
|
29864
|
-
console.error(
|
|
30005
|
+
console.error(chalk212.red(`Invalid port "${portStr}".`));
|
|
29865
30006
|
process.exit(1);
|
|
29866
30007
|
}
|
|
29867
30008
|
const user = await promptInput("user", "User:");
|
|
@@ -29874,13 +30015,13 @@ async function promptConnection3(existingNames) {
|
|
|
29874
30015
|
var sqlAuth = createConnectionAuth({
|
|
29875
30016
|
load: loadConnections3,
|
|
29876
30017
|
save: saveConnections3,
|
|
29877
|
-
format: (c) => `${
|
|
30018
|
+
format: (c) => `${chalk213.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
|
|
29878
30019
|
promptNew: promptConnection3,
|
|
29879
30020
|
onFirst: (c) => setDefaultConnection2(c.name)
|
|
29880
30021
|
});
|
|
29881
30022
|
|
|
29882
30023
|
// src/commands/sql/printTable.ts
|
|
29883
|
-
import
|
|
30024
|
+
import chalk214 from "chalk";
|
|
29884
30025
|
function formatCell(value) {
|
|
29885
30026
|
if (value === null || value === void 0) return "";
|
|
29886
30027
|
if (value instanceof Date) return value.toISOString();
|
|
@@ -29889,7 +30030,7 @@ function formatCell(value) {
|
|
|
29889
30030
|
}
|
|
29890
30031
|
function printTable(rows) {
|
|
29891
30032
|
if (rows.length === 0) {
|
|
29892
|
-
console.log(
|
|
30033
|
+
console.log(chalk214.yellow("(no rows)"));
|
|
29893
30034
|
return;
|
|
29894
30035
|
}
|
|
29895
30036
|
const columns = Object.keys(rows[0]);
|
|
@@ -29897,13 +30038,13 @@ function printTable(rows) {
|
|
|
29897
30038
|
(col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
|
|
29898
30039
|
);
|
|
29899
30040
|
const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
|
|
29900
|
-
console.log(
|
|
29901
|
-
console.log(
|
|
30041
|
+
console.log(chalk214.dim(header));
|
|
30042
|
+
console.log(chalk214.dim("-".repeat(header.length)));
|
|
29902
30043
|
for (const row of rows) {
|
|
29903
30044
|
const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
|
|
29904
30045
|
console.log(line);
|
|
29905
30046
|
}
|
|
29906
|
-
console.log(
|
|
30047
|
+
console.log(chalk214.dim(`
|
|
29907
30048
|
${rows.length} row${rows.length === 1 ? "" : "s"}`));
|
|
29908
30049
|
}
|
|
29909
30050
|
|
|
@@ -29963,7 +30104,7 @@ async function sqlColumns(table, connectionName) {
|
|
|
29963
30104
|
}
|
|
29964
30105
|
|
|
29965
30106
|
// src/commands/sql/sqlMutate.ts
|
|
29966
|
-
import
|
|
30107
|
+
import chalk215 from "chalk";
|
|
29967
30108
|
|
|
29968
30109
|
// src/commands/sql/isMutation.ts
|
|
29969
30110
|
var MUTATION_KEYWORDS = [
|
|
@@ -29997,7 +30138,7 @@ function isMutation(sql25) {
|
|
|
29997
30138
|
async function sqlMutate(query, connectionName) {
|
|
29998
30139
|
if (!isMutation(query)) {
|
|
29999
30140
|
console.error(
|
|
30000
|
-
|
|
30141
|
+
chalk215.red(
|
|
30001
30142
|
"assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
|
|
30002
30143
|
)
|
|
30003
30144
|
);
|
|
@@ -30007,18 +30148,18 @@ async function sqlMutate(query, connectionName) {
|
|
|
30007
30148
|
const pool = await sqlConnect(conn);
|
|
30008
30149
|
try {
|
|
30009
30150
|
const result = await pool.request().query(query);
|
|
30010
|
-
console.log(
|
|
30151
|
+
console.log(chalk215.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
|
|
30011
30152
|
} finally {
|
|
30012
30153
|
await pool.close();
|
|
30013
30154
|
}
|
|
30014
30155
|
}
|
|
30015
30156
|
|
|
30016
30157
|
// src/commands/sql/sqlQuery.ts
|
|
30017
|
-
import
|
|
30158
|
+
import chalk216 from "chalk";
|
|
30018
30159
|
async function sqlQuery(query, connectionName) {
|
|
30019
30160
|
if (isMutation(query)) {
|
|
30020
30161
|
console.error(
|
|
30021
|
-
|
|
30162
|
+
chalk216.red(
|
|
30022
30163
|
"assist sql query refuses mutating statements. Use `assist sql mutate` instead."
|
|
30023
30164
|
)
|
|
30024
30165
|
);
|
|
@@ -30033,7 +30174,7 @@ async function sqlQuery(query, connectionName) {
|
|
|
30033
30174
|
printTable(rows);
|
|
30034
30175
|
} else {
|
|
30035
30176
|
console.log(
|
|
30036
|
-
|
|
30177
|
+
chalk216.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
|
|
30037
30178
|
);
|
|
30038
30179
|
}
|
|
30039
30180
|
} finally {
|
|
@@ -30178,7 +30319,7 @@ function reportPrune(label2, result, force) {
|
|
|
30178
30319
|
// src/commands/sync/syncClaudeMd.ts
|
|
30179
30320
|
import * as fs41 from "fs";
|
|
30180
30321
|
import * as path66 from "path";
|
|
30181
|
-
import
|
|
30322
|
+
import chalk217 from "chalk";
|
|
30182
30323
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
30183
30324
|
const source = path66.join(claudeDir, "CLAUDE.md");
|
|
30184
30325
|
const target = path66.join(targetBase, "CLAUDE.md");
|
|
@@ -30187,14 +30328,14 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
30187
30328
|
const targetContent = fs41.readFileSync(target, "utf8");
|
|
30188
30329
|
if (sourceContent !== targetContent) {
|
|
30189
30330
|
console.log(
|
|
30190
|
-
|
|
30331
|
+
chalk217.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
30191
30332
|
);
|
|
30192
30333
|
console.log();
|
|
30193
30334
|
printDiff(targetContent, sourceContent);
|
|
30194
30335
|
if (!options2?.yes) {
|
|
30195
30336
|
printAutoConfirmHint();
|
|
30196
30337
|
const confirm = await promptConfirm(
|
|
30197
|
-
|
|
30338
|
+
chalk217.red("Overwrite existing CLAUDE.md?"),
|
|
30198
30339
|
false
|
|
30199
30340
|
);
|
|
30200
30341
|
if (!confirm) {
|
|
@@ -30427,7 +30568,7 @@ function syncPi(claudeDir, options2) {
|
|
|
30427
30568
|
// src/commands/sync/syncSettings.ts
|
|
30428
30569
|
import * as fs47 from "fs";
|
|
30429
30570
|
import * as path73 from "path";
|
|
30430
|
-
import
|
|
30571
|
+
import chalk218 from "chalk";
|
|
30431
30572
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
30432
30573
|
const source = path73.join(claudeDir, "settings.json");
|
|
30433
30574
|
const target = path73.join(targetBase, "settings.json");
|
|
@@ -30446,7 +30587,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30446
30587
|
if (mergedContent !== normalizedTarget) {
|
|
30447
30588
|
if (!options2?.yes) {
|
|
30448
30589
|
console.log(
|
|
30449
|
-
|
|
30590
|
+
chalk218.yellow(
|
|
30450
30591
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
30451
30592
|
)
|
|
30452
30593
|
);
|
|
@@ -30454,7 +30595,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
30454
30595
|
printDiff(targetContent, mergedContent);
|
|
30455
30596
|
printAutoConfirmHint();
|
|
30456
30597
|
const confirm = await promptConfirm(
|
|
30457
|
-
|
|
30598
|
+
chalk218.red("Overwrite existing settings.json?"),
|
|
30458
30599
|
false
|
|
30459
30600
|
);
|
|
30460
30601
|
if (!confirm) {
|
|
@@ -30596,11 +30737,11 @@ async function configure() {
|
|
|
30596
30737
|
}
|
|
30597
30738
|
|
|
30598
30739
|
// src/commands/transcript/list.ts
|
|
30599
|
-
import { existsSync as
|
|
30740
|
+
import { existsSync as existsSync63, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
|
|
30600
30741
|
import { join as join77 } from "path";
|
|
30601
30742
|
function list4() {
|
|
30602
30743
|
const { vttDir } = getTranscriptConfig();
|
|
30603
|
-
if (!
|
|
30744
|
+
if (!existsSync63(vttDir)) return;
|
|
30604
30745
|
for (const entry of readdirSync19(vttDir)) {
|
|
30605
30746
|
if (!entry.endsWith(".vtt")) continue;
|
|
30606
30747
|
if (statSync10(join77(vttDir, entry)).isDirectory()) continue;
|
|
@@ -30610,11 +30751,11 @@ function list4() {
|
|
|
30610
30751
|
|
|
30611
30752
|
// src/commands/transcript/move.ts
|
|
30612
30753
|
import {
|
|
30613
|
-
existsSync as
|
|
30614
|
-
mkdirSync as
|
|
30615
|
-
readFileSync as
|
|
30754
|
+
existsSync as existsSync64,
|
|
30755
|
+
mkdirSync as mkdirSync27,
|
|
30756
|
+
readFileSync as readFileSync50,
|
|
30616
30757
|
renameSync as renameSync2,
|
|
30617
|
-
writeFileSync as
|
|
30758
|
+
writeFileSync as writeFileSync43
|
|
30618
30759
|
} from "fs";
|
|
30619
30760
|
import { basename as basename21, join as join78 } from "path";
|
|
30620
30761
|
|
|
@@ -30824,13 +30965,13 @@ function formatChatLog(messages) {
|
|
|
30824
30965
|
// src/commands/transcript/move.ts
|
|
30825
30966
|
var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
|
|
30826
30967
|
function convertVttToMarkdown(inputPath) {
|
|
30827
|
-
const cues = parseVtt(
|
|
30968
|
+
const cues = parseVtt(readFileSync50(inputPath, "utf8"));
|
|
30828
30969
|
const messages = cuesToChatMessages(deduplicateCues(cues));
|
|
30829
30970
|
return formatChatLog(messages);
|
|
30830
30971
|
}
|
|
30831
30972
|
function archiveRawVtt(vttDir, sourcePath, filename) {
|
|
30832
30973
|
const processedDir = join78(vttDir, "processed");
|
|
30833
|
-
|
|
30974
|
+
mkdirSync27(processedDir, { recursive: true });
|
|
30834
30975
|
renameSync2(sourcePath, join78(processedDir, filename));
|
|
30835
30976
|
}
|
|
30836
30977
|
function move(file, options2) {
|
|
@@ -30842,16 +30983,16 @@ function move(file, options2) {
|
|
|
30842
30983
|
const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
|
|
30843
30984
|
const filename = basename21(file);
|
|
30844
30985
|
const sourcePath = join78(vttDir, filename);
|
|
30845
|
-
if (!
|
|
30986
|
+
if (!existsSync64(sourcePath)) {
|
|
30846
30987
|
console.error(`Error: VTT file not found: ${sourcePath}`);
|
|
30847
30988
|
process.exit(1);
|
|
30848
30989
|
}
|
|
30849
30990
|
const base = basename21(filename, ".vtt").replace(/ Transcription$/, "");
|
|
30850
30991
|
const outputName = `${date} ${base}.md`;
|
|
30851
30992
|
const formattedDir = join78(transcriptsDir, client);
|
|
30852
|
-
|
|
30993
|
+
mkdirSync27(formattedDir, { recursive: true });
|
|
30853
30994
|
const formattedPath = join78(formattedDir, outputName);
|
|
30854
|
-
|
|
30995
|
+
writeFileSync43(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
|
|
30855
30996
|
archiveRawVtt(vttDir, sourcePath, filename);
|
|
30856
30997
|
const summaryPath = join78(summaryDir, client, outputName);
|
|
30857
30998
|
console.log(`Formatted transcript: ${formattedPath}`);
|
|
@@ -30939,9 +31080,9 @@ import { join as join80 } from "path";
|
|
|
30939
31080
|
|
|
30940
31081
|
// src/commands/voice/shared.ts
|
|
30941
31082
|
import { homedir as homedir24 } from "os";
|
|
30942
|
-
import { dirname as
|
|
31083
|
+
import { dirname as dirname35, join as join79 } from "path";
|
|
30943
31084
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
30944
|
-
var __dirname6 =
|
|
31085
|
+
var __dirname6 = dirname35(fileURLToPath8(import.meta.url));
|
|
30945
31086
|
var VOICE_DIR = join79(homedir24(), ".assist", "voice");
|
|
30946
31087
|
var voicePaths = {
|
|
30947
31088
|
dir: VOICE_DIR,
|
|
@@ -30971,14 +31112,14 @@ function devices() {
|
|
|
30971
31112
|
}
|
|
30972
31113
|
|
|
30973
31114
|
// src/commands/voice/logs.ts
|
|
30974
|
-
import { existsSync as
|
|
31115
|
+
import { existsSync as existsSync65, readFileSync as readFileSync51 } from "fs";
|
|
30975
31116
|
function logs(options2) {
|
|
30976
|
-
if (!
|
|
31117
|
+
if (!existsSync65(voicePaths.log)) {
|
|
30977
31118
|
console.log("No voice log file found");
|
|
30978
31119
|
return;
|
|
30979
31120
|
}
|
|
30980
31121
|
const count8 = Number.parseInt(options2.lines ?? "150", 10);
|
|
30981
|
-
const content =
|
|
31122
|
+
const content = readFileSync51(voicePaths.log, "utf8").trim();
|
|
30982
31123
|
if (!content) {
|
|
30983
31124
|
console.log("Voice log is empty");
|
|
30984
31125
|
return;
|
|
@@ -31000,12 +31141,12 @@ function logs(options2) {
|
|
|
31000
31141
|
|
|
31001
31142
|
// src/commands/voice/setup.ts
|
|
31002
31143
|
import { spawnSync as spawnSync9 } from "child_process";
|
|
31003
|
-
import { mkdirSync as
|
|
31144
|
+
import { mkdirSync as mkdirSync29 } from "fs";
|
|
31004
31145
|
import { join as join82 } from "path";
|
|
31005
31146
|
|
|
31006
31147
|
// src/commands/voice/checkLockFile.ts
|
|
31007
31148
|
import { execSync as execSync58 } from "child_process";
|
|
31008
|
-
import { existsSync as
|
|
31149
|
+
import { existsSync as existsSync66, mkdirSync as mkdirSync28, readFileSync as readFileSync52, writeFileSync as writeFileSync44 } from "fs";
|
|
31009
31150
|
import { join as join81 } from "path";
|
|
31010
31151
|
function isProcessAlive2(pid) {
|
|
31011
31152
|
try {
|
|
@@ -31017,9 +31158,9 @@ function isProcessAlive2(pid) {
|
|
|
31017
31158
|
}
|
|
31018
31159
|
function checkLockFile() {
|
|
31019
31160
|
const lockFile = getLockFile();
|
|
31020
|
-
if (!
|
|
31161
|
+
if (!existsSync66(lockFile)) return;
|
|
31021
31162
|
try {
|
|
31022
|
-
const lock2 = JSON.parse(
|
|
31163
|
+
const lock2 = JSON.parse(readFileSync52(lockFile, "utf8"));
|
|
31023
31164
|
if (lock2.pid && isProcessAlive2(lock2.pid)) {
|
|
31024
31165
|
console.error(
|
|
31025
31166
|
`Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
|
|
@@ -31030,7 +31171,7 @@ function checkLockFile() {
|
|
|
31030
31171
|
}
|
|
31031
31172
|
}
|
|
31032
31173
|
function bootstrapVenv() {
|
|
31033
|
-
if (
|
|
31174
|
+
if (existsSync66(getVenvPython())) return;
|
|
31034
31175
|
console.log("Setting up Python environment...");
|
|
31035
31176
|
const pythonDir = getPythonDir();
|
|
31036
31177
|
execSync58(
|
|
@@ -31043,8 +31184,8 @@ function bootstrapVenv() {
|
|
|
31043
31184
|
}
|
|
31044
31185
|
function writeLockFile(pid) {
|
|
31045
31186
|
const lockFile = getLockFile();
|
|
31046
|
-
|
|
31047
|
-
|
|
31187
|
+
mkdirSync28(join81(lockFile, ".."), { recursive: true });
|
|
31188
|
+
writeFileSync44(
|
|
31048
31189
|
lockFile,
|
|
31049
31190
|
JSON.stringify({
|
|
31050
31191
|
pid,
|
|
@@ -31056,7 +31197,7 @@ function writeLockFile(pid) {
|
|
|
31056
31197
|
|
|
31057
31198
|
// src/commands/voice/setup.ts
|
|
31058
31199
|
function setup() {
|
|
31059
|
-
|
|
31200
|
+
mkdirSync29(voicePaths.dir, { recursive: true });
|
|
31060
31201
|
bootstrapVenv();
|
|
31061
31202
|
console.log("\nDownloading models...\n");
|
|
31062
31203
|
const script = join82(getPythonDir(), "setup_models.py");
|
|
@@ -31072,7 +31213,7 @@ function setup() {
|
|
|
31072
31213
|
|
|
31073
31214
|
// src/commands/voice/start.ts
|
|
31074
31215
|
import { spawn as spawn8 } from "child_process";
|
|
31075
|
-
import { mkdirSync as
|
|
31216
|
+
import { mkdirSync as mkdirSync30, writeFileSync as writeFileSync45 } from "fs";
|
|
31076
31217
|
import { join as join83 } from "path";
|
|
31077
31218
|
|
|
31078
31219
|
// src/commands/voice/buildDaemonEnv.ts
|
|
@@ -31101,12 +31242,12 @@ function spawnBackground(python, script, env) {
|
|
|
31101
31242
|
console.error("Failed to start voice daemon");
|
|
31102
31243
|
process.exit(1);
|
|
31103
31244
|
}
|
|
31104
|
-
|
|
31245
|
+
writeFileSync45(voicePaths.pid, String(pid));
|
|
31105
31246
|
writeLockFile(pid);
|
|
31106
31247
|
console.log(`Voice daemon started (PID ${pid})`);
|
|
31107
31248
|
}
|
|
31108
31249
|
function start2(options2) {
|
|
31109
|
-
|
|
31250
|
+
mkdirSync30(voicePaths.dir, { recursive: true });
|
|
31110
31251
|
checkLockFile();
|
|
31111
31252
|
bootstrapVenv();
|
|
31112
31253
|
const debug = options2.debug || options2.foreground || process.platform === "win32";
|
|
@@ -31121,7 +31262,7 @@ function start2(options2) {
|
|
|
31121
31262
|
}
|
|
31122
31263
|
|
|
31123
31264
|
// src/commands/voice/status.ts
|
|
31124
|
-
import { existsSync as
|
|
31265
|
+
import { existsSync as existsSync67, readFileSync as readFileSync53 } from "fs";
|
|
31125
31266
|
function isProcessAlive3(pid) {
|
|
31126
31267
|
try {
|
|
31127
31268
|
process.kill(pid, 0);
|
|
@@ -31131,16 +31272,16 @@ function isProcessAlive3(pid) {
|
|
|
31131
31272
|
}
|
|
31132
31273
|
}
|
|
31133
31274
|
function readRecentLogs(count8) {
|
|
31134
|
-
if (!
|
|
31135
|
-
const lines2 =
|
|
31275
|
+
if (!existsSync67(voicePaths.log)) return [];
|
|
31276
|
+
const lines2 = readFileSync53(voicePaths.log, "utf8").trim().split("\n");
|
|
31136
31277
|
return lines2.slice(-count8);
|
|
31137
31278
|
}
|
|
31138
31279
|
function status2() {
|
|
31139
|
-
if (!
|
|
31280
|
+
if (!existsSync67(voicePaths.pid)) {
|
|
31140
31281
|
console.log("Voice daemon: not running (no PID file)");
|
|
31141
31282
|
return;
|
|
31142
31283
|
}
|
|
31143
|
-
const pid = Number.parseInt(
|
|
31284
|
+
const pid = Number.parseInt(readFileSync53(voicePaths.pid, "utf8").trim(), 10);
|
|
31144
31285
|
const alive = isProcessAlive3(pid);
|
|
31145
31286
|
console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
|
|
31146
31287
|
const recent = readRecentLogs(5);
|
|
@@ -31159,13 +31300,13 @@ function status2() {
|
|
|
31159
31300
|
}
|
|
31160
31301
|
|
|
31161
31302
|
// src/commands/voice/stop.ts
|
|
31162
|
-
import { existsSync as
|
|
31303
|
+
import { existsSync as existsSync68, readFileSync as readFileSync54, unlinkSync as unlinkSync20 } from "fs";
|
|
31163
31304
|
function stop2() {
|
|
31164
|
-
if (!
|
|
31305
|
+
if (!existsSync68(voicePaths.pid)) {
|
|
31165
31306
|
console.log("Voice daemon is not running (no PID file)");
|
|
31166
31307
|
return;
|
|
31167
31308
|
}
|
|
31168
|
-
const pid = Number.parseInt(
|
|
31309
|
+
const pid = Number.parseInt(readFileSync54(voicePaths.pid, "utf8").trim(), 10);
|
|
31169
31310
|
try {
|
|
31170
31311
|
process.kill(pid, "SIGTERM");
|
|
31171
31312
|
console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
|
|
@@ -31178,7 +31319,7 @@ function stop2() {
|
|
|
31178
31319
|
}
|
|
31179
31320
|
try {
|
|
31180
31321
|
const lockFile = getLockFile();
|
|
31181
|
-
if (
|
|
31322
|
+
if (existsSync68(lockFile)) unlinkSync20(lockFile);
|
|
31182
31323
|
} catch {
|
|
31183
31324
|
}
|
|
31184
31325
|
console.log("Voice daemon stopped");
|
|
@@ -31583,7 +31724,7 @@ function resolveParams(params, cliArgs) {
|
|
|
31583
31724
|
}
|
|
31584
31725
|
|
|
31585
31726
|
// src/commands/run/resolveRunCwd.ts
|
|
31586
|
-
import { existsSync as
|
|
31727
|
+
import { existsSync as existsSync69 } from "fs";
|
|
31587
31728
|
import { resolve as resolve18 } from "path";
|
|
31588
31729
|
var MissingRunCwdError = class extends Error {
|
|
31589
31730
|
constructor(runName, cwd) {
|
|
@@ -31596,25 +31737,25 @@ var MissingRunCwdError = class extends Error {
|
|
|
31596
31737
|
function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
|
|
31597
31738
|
if (!config.cwd) return void 0;
|
|
31598
31739
|
const cwd = resolve18(baseDir, config.cwd);
|
|
31599
|
-
if (!
|
|
31740
|
+
if (!existsSync69(cwd)) throw new MissingRunCwdError(config.name, cwd);
|
|
31600
31741
|
return cwd;
|
|
31601
31742
|
}
|
|
31602
31743
|
|
|
31603
31744
|
// src/commands/run/runCommandToCompletion.ts
|
|
31604
31745
|
import { spawn as spawn9 } from "child_process";
|
|
31605
|
-
import { existsSync as
|
|
31746
|
+
import { existsSync as existsSync71 } from "fs";
|
|
31606
31747
|
|
|
31607
31748
|
// src/commands/run/resolveCommand.ts
|
|
31608
31749
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
31609
|
-
import { existsSync as
|
|
31610
|
-
import { dirname as
|
|
31750
|
+
import { existsSync as existsSync70 } from "fs";
|
|
31751
|
+
import { dirname as dirname36, join as join85, resolve as resolve19 } from "path";
|
|
31611
31752
|
function resolveCommand2(command) {
|
|
31612
31753
|
if (process.platform !== "win32" || command !== "bash") return command;
|
|
31613
31754
|
try {
|
|
31614
31755
|
const gitPath = execFileSync16("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
|
|
31615
|
-
const gitRoot = resolve19(
|
|
31756
|
+
const gitRoot = resolve19(dirname36(gitPath), "..");
|
|
31616
31757
|
const gitBash = join85(gitRoot, "bin", "bash.exe");
|
|
31617
|
-
if (
|
|
31758
|
+
if (existsSync70(gitBash)) return gitBash;
|
|
31618
31759
|
} catch {
|
|
31619
31760
|
return command;
|
|
31620
31761
|
}
|
|
@@ -31624,7 +31765,7 @@ function resolveCommand2(command) {
|
|
|
31624
31765
|
// src/commands/run/runCommandToCompletion.ts
|
|
31625
31766
|
function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
31626
31767
|
return new Promise((resolveResult) => {
|
|
31627
|
-
if (cwd && !
|
|
31768
|
+
if (cwd && !existsSync71(cwd)) {
|
|
31628
31769
|
resolveResult({
|
|
31629
31770
|
kind: "failed",
|
|
31630
31771
|
message: `Failed to execute command: cwd ${cwd} does not exist`
|
|
@@ -31881,7 +32022,7 @@ function registerWatch(program2) {
|
|
|
31881
32022
|
|
|
31882
32023
|
// src/commands/roam/auth.ts
|
|
31883
32024
|
import { randomBytes } from "crypto";
|
|
31884
|
-
import
|
|
32025
|
+
import chalk219 from "chalk";
|
|
31885
32026
|
|
|
31886
32027
|
// src/commands/roam/waitForCallback.ts
|
|
31887
32028
|
import { createServer as createServer3 } from "http";
|
|
@@ -32012,13 +32153,13 @@ async function auth() {
|
|
|
32012
32153
|
saveGlobalConfig(config);
|
|
32013
32154
|
const state = randomBytes(16).toString("hex");
|
|
32014
32155
|
console.log(
|
|
32015
|
-
|
|
32156
|
+
chalk219.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
|
|
32016
32157
|
);
|
|
32017
|
-
console.log(
|
|
32018
|
-
console.log(
|
|
32019
|
-
console.log(
|
|
32158
|
+
console.log(chalk219.white("http://localhost:14523/callback\n"));
|
|
32159
|
+
console.log(chalk219.blue("Opening browser for authorization..."));
|
|
32160
|
+
console.log(chalk219.dim("Waiting for authorization callback..."));
|
|
32020
32161
|
const { code, redirectUri } = await authorizeInBrowser(clientId, state);
|
|
32021
|
-
console.log(
|
|
32162
|
+
console.log(chalk219.dim("Exchanging code for tokens..."));
|
|
32022
32163
|
const tokens = await exchangeToken({
|
|
32023
32164
|
code,
|
|
32024
32165
|
clientId,
|
|
@@ -32034,13 +32175,13 @@ async function auth() {
|
|
|
32034
32175
|
};
|
|
32035
32176
|
saveGlobalConfig(config);
|
|
32036
32177
|
console.log(
|
|
32037
|
-
|
|
32178
|
+
chalk219.green("Roam credentials and tokens saved to ~/.assist.yml")
|
|
32038
32179
|
);
|
|
32039
32180
|
}
|
|
32040
32181
|
|
|
32041
32182
|
// src/commands/roam/postRoamActivity.ts
|
|
32042
32183
|
import { execFileSync as execFileSync18 } from "child_process";
|
|
32043
|
-
import { readdirSync as readdirSync20, readFileSync as
|
|
32184
|
+
import { readdirSync as readdirSync20, readFileSync as readFileSync55, statSync as statSync11 } from "fs";
|
|
32044
32185
|
import { join as join86 } from "path";
|
|
32045
32186
|
function findPortFile(roamDir) {
|
|
32046
32187
|
let entries;
|
|
@@ -32066,7 +32207,7 @@ function postRoamActivity(app, event) {
|
|
|
32066
32207
|
if (!portFile) return;
|
|
32067
32208
|
let port;
|
|
32068
32209
|
try {
|
|
32069
|
-
port =
|
|
32210
|
+
port = readFileSync55(portFile, "utf8").trim();
|
|
32070
32211
|
} catch {
|
|
32071
32212
|
return;
|
|
32072
32213
|
}
|
|
@@ -32194,7 +32335,7 @@ async function run3(name, args) {
|
|
|
32194
32335
|
}
|
|
32195
32336
|
|
|
32196
32337
|
// src/commands/run/add.ts
|
|
32197
|
-
import { mkdirSync as
|
|
32338
|
+
import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
|
|
32198
32339
|
import { join as join87 } from "path";
|
|
32199
32340
|
|
|
32200
32341
|
// src/commands/run/extractOption.ts
|
|
@@ -32257,7 +32398,7 @@ function saveNewRunConfig(name, command, args, cwd) {
|
|
|
32257
32398
|
}
|
|
32258
32399
|
function createCommandFile(name) {
|
|
32259
32400
|
const dir = join87(".claude", "commands");
|
|
32260
|
-
|
|
32401
|
+
mkdirSync31(dir, { recursive: true });
|
|
32261
32402
|
const content = `---
|
|
32262
32403
|
description: Run ${name}
|
|
32263
32404
|
---
|
|
@@ -32265,7 +32406,7 @@ description: Run ${name}
|
|
|
32265
32406
|
Run \`assist run ${name} $ARGUMENTS 2>&1\`.
|
|
32266
32407
|
`;
|
|
32267
32408
|
const filePath = join87(dir, `${name}.md`);
|
|
32268
|
-
|
|
32409
|
+
writeFileSync46(filePath, content);
|
|
32269
32410
|
console.log(`Created command file: ${filePath}`);
|
|
32270
32411
|
}
|
|
32271
32412
|
function add3() {
|
|
@@ -32320,7 +32461,7 @@ function link2() {
|
|
|
32320
32461
|
}
|
|
32321
32462
|
|
|
32322
32463
|
// src/commands/run/remove.ts
|
|
32323
|
-
import { existsSync as
|
|
32464
|
+
import { existsSync as existsSync72, unlinkSync as unlinkSync21 } from "fs";
|
|
32324
32465
|
import { join as join88 } from "path";
|
|
32325
32466
|
function findRemoveIndex() {
|
|
32326
32467
|
const idx = process.argv.indexOf("remove");
|
|
@@ -32337,7 +32478,7 @@ function parseRemoveName() {
|
|
|
32337
32478
|
}
|
|
32338
32479
|
function deleteCommandFile(name) {
|
|
32339
32480
|
const filePath = join88(".claude", "commands", `${name}.md`);
|
|
32340
|
-
if (
|
|
32481
|
+
if (existsSync72(filePath)) {
|
|
32341
32482
|
unlinkSync21(filePath);
|
|
32342
32483
|
console.log(`Deleted command file: ${filePath}`);
|
|
32343
32484
|
}
|
|
@@ -32382,10 +32523,10 @@ function registerRun(program2) {
|
|
|
32382
32523
|
|
|
32383
32524
|
// src/commands/screenshot/index.ts
|
|
32384
32525
|
import { execSync as execSync60 } from "child_process";
|
|
32385
|
-
import { existsSync as
|
|
32526
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync32, unlinkSync as unlinkSync22, writeFileSync as writeFileSync47 } from "fs";
|
|
32386
32527
|
import { tmpdir as tmpdir8 } from "os";
|
|
32387
32528
|
import { join as join89, resolve as resolve20 } from "path";
|
|
32388
|
-
import
|
|
32529
|
+
import chalk220 from "chalk";
|
|
32389
32530
|
|
|
32390
32531
|
// src/commands/screenshot/captureWindowPs1.ts
|
|
32391
32532
|
var captureWindowPs1 = `
|
|
@@ -32514,15 +32655,15 @@ Write-Output $OutputPath
|
|
|
32514
32655
|
|
|
32515
32656
|
// src/commands/screenshot/index.ts
|
|
32516
32657
|
function buildOutputPath(outputDir, processName) {
|
|
32517
|
-
if (!
|
|
32518
|
-
|
|
32658
|
+
if (!existsSync73(outputDir)) {
|
|
32659
|
+
mkdirSync32(outputDir, { recursive: true });
|
|
32519
32660
|
}
|
|
32520
32661
|
const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
32521
32662
|
return resolve20(outputDir, `${processName}-${timestamp6}.png`);
|
|
32522
32663
|
}
|
|
32523
32664
|
function runPowerShellScript(processName, outputPath) {
|
|
32524
32665
|
const scriptPath = join89(tmpdir8(), `assist-screenshot-${Date.now()}.ps1`);
|
|
32525
|
-
|
|
32666
|
+
writeFileSync47(scriptPath, captureWindowPs1, "utf8");
|
|
32526
32667
|
try {
|
|
32527
32668
|
execSync60(
|
|
32528
32669
|
`powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
|
|
@@ -32536,13 +32677,13 @@ function screenshot(processName) {
|
|
|
32536
32677
|
const config = loadConfig();
|
|
32537
32678
|
const outputDir = resolve20(config.screenshot.outputDir);
|
|
32538
32679
|
const outputPath = buildOutputPath(outputDir, processName);
|
|
32539
|
-
console.log(
|
|
32680
|
+
console.log(chalk220.gray(`Capturing window for process "${processName}" ...`));
|
|
32540
32681
|
try {
|
|
32541
32682
|
runPowerShellScript(processName, outputPath);
|
|
32542
|
-
console.log(
|
|
32683
|
+
console.log(chalk220.green(`Screenshot saved: ${outputPath}`));
|
|
32543
32684
|
} catch (error) {
|
|
32544
32685
|
const msg = error instanceof Error ? error.message : String(error);
|
|
32545
|
-
console.error(
|
|
32686
|
+
console.error(chalk220.red(`Failed to capture screenshot: ${msg}`));
|
|
32546
32687
|
process.exit(1);
|
|
32547
32688
|
}
|
|
32548
32689
|
}
|
|
@@ -32598,11 +32739,11 @@ function applyLine(result, pending, line) {
|
|
|
32598
32739
|
}
|
|
32599
32740
|
|
|
32600
32741
|
// src/commands/sessions/daemon/readDaemonPidFile.ts
|
|
32601
|
-
import { readFileSync as
|
|
32742
|
+
import { readFileSync as readFileSync56 } from "fs";
|
|
32602
32743
|
function readDaemonPidFile() {
|
|
32603
32744
|
try {
|
|
32604
32745
|
const pid = Number.parseInt(
|
|
32605
|
-
|
|
32746
|
+
readFileSync56(daemonPaths.pid, "utf8").trim(),
|
|
32606
32747
|
10
|
|
32607
32748
|
);
|
|
32608
32749
|
return Number.isInteger(pid) ? pid : void 0;
|
|
@@ -32755,7 +32896,7 @@ function requestDrain(socket, lines2) {
|
|
|
32755
32896
|
}
|
|
32756
32897
|
|
|
32757
32898
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
32758
|
-
import { mkdirSync as
|
|
32899
|
+
import { mkdirSync as mkdirSync36 } from "fs";
|
|
32759
32900
|
|
|
32760
32901
|
// src/commands/sessions/daemon/createAutoExit.ts
|
|
32761
32902
|
var DEFAULT_GRACE_MS = 6e4;
|
|
@@ -32859,12 +33000,12 @@ function toSessionRunInfo({
|
|
|
32859
33000
|
}
|
|
32860
33001
|
|
|
32861
33002
|
// src/commands/sessions/daemon/worktree/joinRefusal.ts
|
|
32862
|
-
import { existsSync as
|
|
33003
|
+
import { existsSync as existsSync74 } from "fs";
|
|
32863
33004
|
function joinRefusal(session) {
|
|
32864
33005
|
if (session.commandType === "run") return "a server run has no agent stream";
|
|
32865
33006
|
if (session.closing === true) return "the session is closing";
|
|
32866
33007
|
if (!session.cwd) return "the session has no working directory";
|
|
32867
|
-
if (!
|
|
33008
|
+
if (!existsSync74(session.cwd))
|
|
32868
33009
|
return "the session's workspace no longer exists";
|
|
32869
33010
|
return void 0;
|
|
32870
33011
|
}
|
|
@@ -33028,11 +33169,11 @@ function sessionBase(id, status3) {
|
|
|
33028
33169
|
}
|
|
33029
33170
|
|
|
33030
33171
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
33031
|
-
import { existsSync as
|
|
33172
|
+
import { existsSync as existsSync76 } from "fs";
|
|
33032
33173
|
import * as pty from "node-pty";
|
|
33033
33174
|
|
|
33034
33175
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
33035
|
-
import { chmodSync, existsSync as
|
|
33176
|
+
import { chmodSync, existsSync as existsSync75, statSync as statSync12 } from "fs";
|
|
33036
33177
|
import { createRequire as createRequire3 } from "module";
|
|
33037
33178
|
import path75 from "path";
|
|
33038
33179
|
var require4 = createRequire3(import.meta.url);
|
|
@@ -33047,7 +33188,7 @@ function ensureSpawnHelperExecutable() {
|
|
|
33047
33188
|
`${process.platform}-${process.arch}`,
|
|
33048
33189
|
"spawn-helper"
|
|
33049
33190
|
);
|
|
33050
|
-
if (!
|
|
33191
|
+
if (!existsSync75(helper)) return;
|
|
33051
33192
|
const mode = statSync12(helper).mode;
|
|
33052
33193
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
33053
33194
|
}
|
|
@@ -33083,7 +33224,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
33083
33224
|
});
|
|
33084
33225
|
}
|
|
33085
33226
|
function refuseMissingCwd(cwd, sessionId) {
|
|
33086
|
-
if (!cwd ||
|
|
33227
|
+
if (!cwd || existsSync76(cwd)) return;
|
|
33087
33228
|
daemonLog(
|
|
33088
33229
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
33089
33230
|
);
|
|
@@ -33265,11 +33406,11 @@ function setStatus2(session, newStatus) {
|
|
|
33265
33406
|
}
|
|
33266
33407
|
|
|
33267
33408
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33268
|
-
import { existsSync as
|
|
33409
|
+
import { existsSync as existsSync78 } from "fs";
|
|
33269
33410
|
import { basename as basename22 } from "path";
|
|
33270
33411
|
|
|
33271
33412
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
33272
|
-
import { existsSync as
|
|
33413
|
+
import { existsSync as existsSync77 } from "fs";
|
|
33273
33414
|
import { join as join92 } from "path";
|
|
33274
33415
|
|
|
33275
33416
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
@@ -33339,7 +33480,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
33339
33480
|
);
|
|
33340
33481
|
}
|
|
33341
33482
|
function strandedReason(worktreePath, cause) {
|
|
33342
|
-
if (!
|
|
33483
|
+
if (!existsSync77(join92(worktreePath, ".git")))
|
|
33343
33484
|
return "its .git link is already gone";
|
|
33344
33485
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
33345
33486
|
return "git no longer recognises it as a working tree";
|
|
@@ -33391,7 +33532,7 @@ function reason3(error) {
|
|
|
33391
33532
|
|
|
33392
33533
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
33393
33534
|
async function reapWorktree(worktreePath, force = false) {
|
|
33394
|
-
if (!
|
|
33535
|
+
if (!existsSync78(worktreePath)) {
|
|
33395
33536
|
forgetWorktree(worktreePath);
|
|
33396
33537
|
daemonLog(
|
|
33397
33538
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -33416,7 +33557,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
33416
33557
|
}
|
|
33417
33558
|
function owningClone(worktreePath) {
|
|
33418
33559
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
33419
|
-
if (recorded &&
|
|
33560
|
+
if (recorded && existsSync78(recorded)) return recorded;
|
|
33420
33561
|
const detected = mainWorktree(worktreePath);
|
|
33421
33562
|
if (detected) return detected;
|
|
33422
33563
|
daemonLog(
|
|
@@ -33547,12 +33688,12 @@ function closeGateApplies(sessions, session) {
|
|
|
33547
33688
|
}
|
|
33548
33689
|
|
|
33549
33690
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
33550
|
-
import { existsSync as
|
|
33691
|
+
import { existsSync as existsSync79, watch } from "fs";
|
|
33551
33692
|
var DEBOUNCE_MS = 500;
|
|
33552
33693
|
var POLL_MS = 3e4;
|
|
33553
33694
|
function watchGitState(cwd, onChange) {
|
|
33554
33695
|
const common = gitCommonDir(cwd);
|
|
33555
|
-
if (!common || !
|
|
33696
|
+
if (!common || !existsSync79(common)) return void 0;
|
|
33556
33697
|
const watchers = [
|
|
33557
33698
|
watchGitDir(common, onChange),
|
|
33558
33699
|
pollGitState(cwd, onChange)
|
|
@@ -34029,10 +34170,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
34029
34170
|
}
|
|
34030
34171
|
|
|
34031
34172
|
// src/commands/sessions/daemon/exitReason.ts
|
|
34032
|
-
import { existsSync as
|
|
34173
|
+
import { existsSync as existsSync80 } from "fs";
|
|
34033
34174
|
import { resolve as resolve21 } from "path";
|
|
34034
34175
|
function exitDetail(session) {
|
|
34035
|
-
if (session.cwd && !
|
|
34176
|
+
if (session.cwd && !existsSync80(session.cwd))
|
|
34036
34177
|
return `working directory ${session.cwd} no longer exists`;
|
|
34037
34178
|
return missingRunConfigCwd(session);
|
|
34038
34179
|
}
|
|
@@ -34046,7 +34187,7 @@ function missingRunConfigCwd(session) {
|
|
|
34046
34187
|
const config = resolveRunConfig(session.runName, dir);
|
|
34047
34188
|
if (!config?.cwd) return void 0;
|
|
34048
34189
|
const configured = resolve21(runConfigBaseDirFrom(dir), config.cwd);
|
|
34049
|
-
if (
|
|
34190
|
+
if (existsSync80(configured)) return void 0;
|
|
34050
34191
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
34051
34192
|
}
|
|
34052
34193
|
|
|
@@ -34087,8 +34228,8 @@ function handleFailedResume(session, exitCode, onStatusChange) {
|
|
|
34087
34228
|
}
|
|
34088
34229
|
|
|
34089
34230
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
34090
|
-
import { existsSync as
|
|
34091
|
-
import { dirname as
|
|
34231
|
+
import { existsSync as existsSync81, mkdirSync as mkdirSync33, watch as watch2 } from "fs";
|
|
34232
|
+
import { dirname as dirname38 } from "path";
|
|
34092
34233
|
|
|
34093
34234
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
34094
34235
|
function applyActivityToSession(session, activity2) {
|
|
@@ -34150,9 +34291,9 @@ var DEBOUNCE_MS2 = 50;
|
|
|
34150
34291
|
function watchActivity(session, notify2, onClaudeSessionId) {
|
|
34151
34292
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
34152
34293
|
const path80 = activityPath(session.id);
|
|
34153
|
-
const dir =
|
|
34294
|
+
const dir = dirname38(path80);
|
|
34154
34295
|
try {
|
|
34155
|
-
|
|
34296
|
+
mkdirSync33(dir, { recursive: true });
|
|
34156
34297
|
} catch {
|
|
34157
34298
|
return;
|
|
34158
34299
|
}
|
|
@@ -34173,7 +34314,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
34173
34314
|
if (timer) clearTimeout(timer);
|
|
34174
34315
|
timer = setTimeout(read2, DEBOUNCE_MS2);
|
|
34175
34316
|
});
|
|
34176
|
-
if (
|
|
34317
|
+
if (existsSync81(path80)) read2();
|
|
34177
34318
|
}
|
|
34178
34319
|
function refreshActivity(session) {
|
|
34179
34320
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -34355,10 +34496,10 @@ function headContainsSessionId(filePath, claudeSessionId) {
|
|
|
34355
34496
|
}
|
|
34356
34497
|
|
|
34357
34498
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
34358
|
-
import { mkdirSync as
|
|
34499
|
+
import { mkdirSync as mkdirSync34 } from "fs";
|
|
34359
34500
|
function ensureProjectDirExists(dir, sessionId) {
|
|
34360
34501
|
try {
|
|
34361
|
-
|
|
34502
|
+
mkdirSync34(dir, { recursive: true });
|
|
34362
34503
|
return true;
|
|
34363
34504
|
} catch (error) {
|
|
34364
34505
|
daemonLog(
|
|
@@ -35795,7 +35936,7 @@ function rearmStoppedSessions(sessions, notify2) {
|
|
|
35795
35936
|
}
|
|
35796
35937
|
|
|
35797
35938
|
// src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
|
|
35798
|
-
import { existsSync as
|
|
35939
|
+
import { existsSync as existsSync84 } from "fs";
|
|
35799
35940
|
import { basename as basename24 } from "path";
|
|
35800
35941
|
|
|
35801
35942
|
// src/commands/sessions/daemon/worktree/accountedTrees.ts
|
|
@@ -35850,9 +35991,9 @@ function bindResumedWorktree(session, cwd, notify2) {
|
|
|
35850
35991
|
}
|
|
35851
35992
|
|
|
35852
35993
|
// src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
|
|
35853
|
-
import { existsSync as
|
|
35994
|
+
import { existsSync as existsSync83 } from "fs";
|
|
35854
35995
|
async function reclaimVanishedWorktrees(clone, paths) {
|
|
35855
|
-
if (!
|
|
35996
|
+
if (!existsSync83(clone)) {
|
|
35856
35997
|
for (const { path: path80 } of paths) forgetWorktree(path80);
|
|
35857
35998
|
daemonLog(
|
|
35858
35999
|
`clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
|
|
@@ -36018,7 +36159,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
|
|
|
36018
36159
|
);
|
|
36019
36160
|
continue;
|
|
36020
36161
|
}
|
|
36021
|
-
if (!
|
|
36162
|
+
if (!existsSync84(path80)) {
|
|
36022
36163
|
logVanishedTree(sessions, path80);
|
|
36023
36164
|
vanished.set(clone, [
|
|
36024
36165
|
...vanished.get(clone) ?? [],
|
|
@@ -36635,14 +36776,14 @@ async function defaultConnect() {
|
|
|
36635
36776
|
}
|
|
36636
36777
|
|
|
36637
36778
|
// src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
|
|
36638
|
-
import { existsSync as
|
|
36779
|
+
import { existsSync as existsSync85, readFileSync as readFileSync58 } from "fs";
|
|
36639
36780
|
import { posix as posix3 } from "path";
|
|
36640
36781
|
function hasPersistedWindowsSessions() {
|
|
36641
36782
|
const sessionsFile = windowsSessionsFileFromWsl();
|
|
36642
36783
|
if (!sessionsFile) return false;
|
|
36643
36784
|
try {
|
|
36644
|
-
if (!
|
|
36645
|
-
const data = JSON.parse(
|
|
36785
|
+
if (!existsSync85(sessionsFile)) return false;
|
|
36786
|
+
const data = JSON.parse(readFileSync58(sessionsFile, "utf8"));
|
|
36646
36787
|
return Array.isArray(data) && data.length > 0;
|
|
36647
36788
|
} catch (error) {
|
|
36648
36789
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
@@ -37376,7 +37517,7 @@ function setAutoAdvance(sessions, id, enabled) {
|
|
|
37376
37517
|
}
|
|
37377
37518
|
|
|
37378
37519
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37379
|
-
import { existsSync as
|
|
37520
|
+
import { existsSync as existsSync88 } from "fs";
|
|
37380
37521
|
|
|
37381
37522
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
37382
37523
|
function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
@@ -37407,10 +37548,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
|
|
|
37407
37548
|
}
|
|
37408
37549
|
|
|
37409
37550
|
// src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
|
|
37410
|
-
import { existsSync as
|
|
37551
|
+
import { existsSync as existsSync87 } from "fs";
|
|
37411
37552
|
|
|
37412
37553
|
// src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
|
|
37413
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
37554
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync86, mkdirSync as mkdirSync35 } from "fs";
|
|
37414
37555
|
import { join as join94 } from "path";
|
|
37415
37556
|
function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
37416
37557
|
const dir = projectDirForCwd(toCwd);
|
|
@@ -37421,7 +37562,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37421
37562
|
return;
|
|
37422
37563
|
}
|
|
37423
37564
|
const dest = join94(dir, `${claudeSessionId}.jsonl`);
|
|
37424
|
-
if (
|
|
37565
|
+
if (existsSync86(dest)) {
|
|
37425
37566
|
daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
|
|
37426
37567
|
return;
|
|
37427
37568
|
}
|
|
@@ -37433,7 +37574,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
|
|
|
37433
37574
|
return;
|
|
37434
37575
|
}
|
|
37435
37576
|
try {
|
|
37436
|
-
|
|
37577
|
+
mkdirSync35(dir, { recursive: true });
|
|
37437
37578
|
copyFileSync7(source, dest);
|
|
37438
37579
|
daemonLog(
|
|
37439
37580
|
`transcript ${source} copied to ${dest} so ${toCwd} can resume it`
|
|
@@ -37472,7 +37613,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
|
|
|
37472
37613
|
}
|
|
37473
37614
|
function cloneForReapedTree(missingCwd) {
|
|
37474
37615
|
const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
|
|
37475
|
-
if (!clone || !
|
|
37616
|
+
if (!clone || !existsSync87(clone))
|
|
37476
37617
|
throw new Error(
|
|
37477
37618
|
`working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
|
|
37478
37619
|
);
|
|
@@ -37481,7 +37622,7 @@ function cloneForReapedTree(missingCwd) {
|
|
|
37481
37622
|
|
|
37482
37623
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
37483
37624
|
function resumeInTree(ctx, sessionId, cwd, name, harness) {
|
|
37484
|
-
if (!
|
|
37625
|
+
if (!existsSync88(cwd))
|
|
37485
37626
|
return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
|
|
37486
37627
|
const id = ctx.spawnWith(
|
|
37487
37628
|
(sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
|
|
@@ -37825,10 +37966,10 @@ async function parseTranscript(sessionId) {
|
|
|
37825
37966
|
if (rollout) return readMessages(rollout, parseCodexTranscriptLines);
|
|
37826
37967
|
return [];
|
|
37827
37968
|
}
|
|
37828
|
-
async function readMessages(filePath,
|
|
37969
|
+
async function readMessages(filePath, parse4) {
|
|
37829
37970
|
try {
|
|
37830
37971
|
const raw = await fs54.promises.readFile(filePath, "utf8");
|
|
37831
|
-
return
|
|
37972
|
+
return parse4(raw.split("\n"));
|
|
37832
37973
|
} catch {
|
|
37833
37974
|
return [];
|
|
37834
37975
|
}
|
|
@@ -38057,10 +38198,10 @@ function handleConnection(socket, manager) {
|
|
|
38057
38198
|
}
|
|
38058
38199
|
|
|
38059
38200
|
// src/commands/sessions/daemon/onListening.ts
|
|
38060
|
-
import { unlinkSync as unlinkSync23, writeFileSync as
|
|
38201
|
+
import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync48 } from "fs";
|
|
38061
38202
|
|
|
38062
38203
|
// src/commands/sessions/daemon/startPidFileWatchdog.ts
|
|
38063
|
-
import { readFileSync as
|
|
38204
|
+
import { readFileSync as readFileSync59 } from "fs";
|
|
38064
38205
|
var WATCHDOG_INTERVAL_MS = 5e3;
|
|
38065
38206
|
function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
38066
38207
|
const timer = setInterval(() => {
|
|
@@ -38071,7 +38212,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
|
|
|
38071
38212
|
}
|
|
38072
38213
|
function ownsPidFile() {
|
|
38073
38214
|
try {
|
|
38074
|
-
return
|
|
38215
|
+
return readFileSync59(daemonPaths.pid, "utf8").trim() === String(process.pid);
|
|
38075
38216
|
} catch {
|
|
38076
38217
|
return false;
|
|
38077
38218
|
}
|
|
@@ -38079,7 +38220,7 @@ function ownsPidFile() {
|
|
|
38079
38220
|
|
|
38080
38221
|
// src/commands/sessions/daemon/onListening.ts
|
|
38081
38222
|
function onListening(manager, checkAutoExit) {
|
|
38082
|
-
|
|
38223
|
+
writeFileSync48(daemonPaths.pid, String(process.pid));
|
|
38083
38224
|
startPidFileWatchdog(() => {
|
|
38084
38225
|
daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
|
|
38085
38226
|
void manager.flushActiveMs().finally(() => {
|
|
@@ -38266,7 +38407,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
|
|
|
38266
38407
|
|
|
38267
38408
|
// src/commands/sessions/daemon/runDaemon.ts
|
|
38268
38409
|
async function runDaemon() {
|
|
38269
|
-
|
|
38410
|
+
mkdirSync36(daemonPaths.dir, { recursive: true });
|
|
38270
38411
|
daemonLog(
|
|
38271
38412
|
`starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
|
|
38272
38413
|
);
|
|
@@ -38321,7 +38462,7 @@ function registerSetStatusCommand(cmd) {
|
|
|
38321
38462
|
|
|
38322
38463
|
// src/commands/sessions/summarise/index.ts
|
|
38323
38464
|
import * as fs56 from "fs";
|
|
38324
|
-
import
|
|
38465
|
+
import chalk221 from "chalk";
|
|
38325
38466
|
|
|
38326
38467
|
// src/commands/sessions/summarise/shared.ts
|
|
38327
38468
|
import * as fs55 from "fs";
|
|
@@ -38380,22 +38521,22 @@ ${firstMessage}`);
|
|
|
38380
38521
|
async function summarise2(options2) {
|
|
38381
38522
|
const files = await discoverSessionFiles();
|
|
38382
38523
|
if (files.length === 0) {
|
|
38383
|
-
console.log(
|
|
38524
|
+
console.log(chalk221.yellow("No sessions found."));
|
|
38384
38525
|
return;
|
|
38385
38526
|
}
|
|
38386
38527
|
const toProcess = selectCandidates(files, options2);
|
|
38387
38528
|
if (toProcess.length === 0) {
|
|
38388
|
-
console.log(
|
|
38529
|
+
console.log(chalk221.green("All sessions already summarised."));
|
|
38389
38530
|
return;
|
|
38390
38531
|
}
|
|
38391
38532
|
console.log(
|
|
38392
|
-
|
|
38533
|
+
chalk221.cyan(
|
|
38393
38534
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
38394
38535
|
)
|
|
38395
38536
|
);
|
|
38396
38537
|
const { succeeded, failed: failed2 } = processSessions(toProcess);
|
|
38397
38538
|
console.log(
|
|
38398
|
-
|
|
38539
|
+
chalk221.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk221.yellow(`, ${failed2} skipped`) : "")
|
|
38399
38540
|
);
|
|
38400
38541
|
}
|
|
38401
38542
|
function selectCandidates(files, options2) {
|
|
@@ -38415,16 +38556,16 @@ function processSessions(files) {
|
|
|
38415
38556
|
let failed2 = 0;
|
|
38416
38557
|
for (let i = 0; i < files.length; i++) {
|
|
38417
38558
|
const file = files[i];
|
|
38418
|
-
process.stdout.write(
|
|
38559
|
+
process.stdout.write(chalk221.dim(` [${i + 1}/${files.length}] `));
|
|
38419
38560
|
const summary = summariseSession(file);
|
|
38420
38561
|
if (summary) {
|
|
38421
38562
|
writeSummary(file, summary);
|
|
38422
38563
|
succeeded++;
|
|
38423
|
-
process.stdout.write(`${
|
|
38564
|
+
process.stdout.write(`${chalk221.green("\u2713")} ${summary}
|
|
38424
38565
|
`);
|
|
38425
38566
|
} else {
|
|
38426
38567
|
failed2++;
|
|
38427
|
-
process.stdout.write(` ${
|
|
38568
|
+
process.stdout.write(` ${chalk221.yellow("skip")}
|
|
38428
38569
|
`);
|
|
38429
38570
|
}
|
|
38430
38571
|
}
|
|
@@ -38445,7 +38586,7 @@ function registerSessions(program2) {
|
|
|
38445
38586
|
}
|
|
38446
38587
|
|
|
38447
38588
|
// src/commands/statusLine.ts
|
|
38448
|
-
import
|
|
38589
|
+
import chalk223 from "chalk";
|
|
38449
38590
|
|
|
38450
38591
|
// src/shared/contextLevel.ts
|
|
38451
38592
|
function contextLevel(pct) {
|
|
@@ -38455,7 +38596,7 @@ function contextLevel(pct) {
|
|
|
38455
38596
|
}
|
|
38456
38597
|
|
|
38457
38598
|
// src/commands/buildLimitsSegment.ts
|
|
38458
|
-
import
|
|
38599
|
+
import chalk222 from "chalk";
|
|
38459
38600
|
|
|
38460
38601
|
// src/shared/rateLimitLevel.ts
|
|
38461
38602
|
var FIVE_HOUR_SECONDS = 5 * 3600;
|
|
@@ -38493,9 +38634,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
|
|
|
38493
38634
|
|
|
38494
38635
|
// src/commands/buildLimitsSegment.ts
|
|
38495
38636
|
var LEVEL_COLOR = {
|
|
38496
|
-
ok:
|
|
38497
|
-
warn:
|
|
38498
|
-
over:
|
|
38637
|
+
ok: chalk222.green,
|
|
38638
|
+
warn: chalk222.yellow,
|
|
38639
|
+
over: chalk222.red
|
|
38499
38640
|
};
|
|
38500
38641
|
function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
|
|
38501
38642
|
const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
|
|
@@ -38526,7 +38667,7 @@ function buildLimitsSegment(rateLimits) {
|
|
|
38526
38667
|
}
|
|
38527
38668
|
|
|
38528
38669
|
// src/commands/readGitBranch.ts
|
|
38529
|
-
import { readFileSync as
|
|
38670
|
+
import { readFileSync as readFileSync61, statSync as statSync15 } from "fs";
|
|
38530
38671
|
import { isAbsolute as isAbsolute4, join as join95, resolve as resolve22 } from "path";
|
|
38531
38672
|
function resolveGitDir(cwd) {
|
|
38532
38673
|
const dotGit = join95(cwd, ".git");
|
|
@@ -38541,7 +38682,7 @@ function resolveGitDir(cwd) {
|
|
|
38541
38682
|
}
|
|
38542
38683
|
let contents;
|
|
38543
38684
|
try {
|
|
38544
|
-
contents =
|
|
38685
|
+
contents = readFileSync61(dotGit, "utf8");
|
|
38545
38686
|
} catch {
|
|
38546
38687
|
return null;
|
|
38547
38688
|
}
|
|
@@ -38559,7 +38700,7 @@ function readGitBranch(cwd) {
|
|
|
38559
38700
|
}
|
|
38560
38701
|
let head;
|
|
38561
38702
|
try {
|
|
38562
|
-
head =
|
|
38703
|
+
head = readFileSync61(join95(gitDir, "HEAD"), "utf8");
|
|
38563
38704
|
} catch {
|
|
38564
38705
|
return null;
|
|
38565
38706
|
}
|
|
@@ -38591,7 +38732,7 @@ async function relayUsage(claudeSessionId, transcriptPath2, usedPct) {
|
|
|
38591
38732
|
}
|
|
38592
38733
|
|
|
38593
38734
|
// src/commands/statusLine.ts
|
|
38594
|
-
|
|
38735
|
+
chalk223.level = 3;
|
|
38595
38736
|
function formatNumber(num) {
|
|
38596
38737
|
return num.toLocaleString("en-US");
|
|
38597
38738
|
}
|
|
@@ -38599,9 +38740,9 @@ function colorizePercent(pct) {
|
|
|
38599
38740
|
const label2 = `${Math.round(pct)}%`;
|
|
38600
38741
|
switch (contextLevel(pct)) {
|
|
38601
38742
|
case "red":
|
|
38602
|
-
return
|
|
38743
|
+
return chalk223.red(label2);
|
|
38603
38744
|
case "yellow":
|
|
38604
|
-
return
|
|
38745
|
+
return chalk223.yellow(label2);
|
|
38605
38746
|
default:
|
|
38606
38747
|
return label2;
|
|
38607
38748
|
}
|
|
@@ -38614,7 +38755,7 @@ async function statusLine() {
|
|
|
38614
38755
|
const usedPct = data.context_window.used_percentage ?? 0;
|
|
38615
38756
|
const dir = data.workspace?.current_dir ?? data.cwd;
|
|
38616
38757
|
const branch2 = dir ? readGitBranch(toGitCwd(dir)) : null;
|
|
38617
|
-
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${
|
|
38758
|
+
const branchSegment = branch2 ? `\u{1F33F}\uFE0F ${chalk223.cyan(branch2)} | ` : "";
|
|
38618
38759
|
console.log(
|
|
38619
38760
|
`${branchSegment}${model} | Tokens - ${formatNumber(totalIn)} \u2191 : ${formatNumber(totalOut)} \u2193 | Context - ${colorizePercent(usedPct)}${buildLimitsSegment(data.rate_limits)}`
|
|
38620
38761
|
);
|
|
@@ -38684,10 +38825,10 @@ async function update2() {
|
|
|
38684
38825
|
}
|
|
38685
38826
|
|
|
38686
38827
|
// src/reportCliError.ts
|
|
38687
|
-
import
|
|
38828
|
+
import chalk224 from "chalk";
|
|
38688
38829
|
function reportCliError(error) {
|
|
38689
38830
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
38690
|
-
console.error(
|
|
38831
|
+
console.error(chalk224.red(error.message));
|
|
38691
38832
|
} else {
|
|
38692
38833
|
console.error(error);
|
|
38693
38834
|
}
|