@staff0rd/assist 0.1077.2 → 0.1078.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/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +424 -423
- package/dist/index.js +370 -349
- 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.1078.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1977,10 +1977,10 @@ async function openDaemonConnection(ws, ctx) {
|
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
1979
|
function relayDaemonLines(conn, ws, repoCwd) {
|
|
1980
|
-
const
|
|
1981
|
-
|
|
1980
|
+
const lines = createInterface({ input: conn });
|
|
1981
|
+
lines.on("error", () => {
|
|
1982
1982
|
});
|
|
1983
|
-
|
|
1983
|
+
lines.on("line", (line) => {
|
|
1984
1984
|
if (ws.readyState === ws.OPEN) ws.send(withRepoCwd(line, repoCwd));
|
|
1985
1985
|
});
|
|
1986
1986
|
conn.on("error", () => {
|
|
@@ -3921,15 +3921,15 @@ function summaryEntry(summary) {
|
|
|
3921
3921
|
return summary.phase === null ? summary.text : `**Phase ${summary.phase}:** ${summary.text}`;
|
|
3922
3922
|
}
|
|
3923
3923
|
function storyEntry(story) {
|
|
3924
|
-
const
|
|
3925
|
-
if (story.summaries.length === 0)
|
|
3926
|
-
else
|
|
3924
|
+
const lines = [`### ${formatItemId(story.id)} ${story.name}`, ""];
|
|
3925
|
+
if (story.summaries.length === 0) lines.push("_No done summary._");
|
|
3926
|
+
else lines.push(story.summaries.map(summaryEntry).join("\n\n"));
|
|
3927
3927
|
if (story.commits.length > 0)
|
|
3928
|
-
|
|
3928
|
+
lines.push(
|
|
3929
3929
|
"",
|
|
3930
3930
|
`Commits: ${story.commits.map((c) => `\`${c.slice(0, 8)}\``).join(", ")}`
|
|
3931
3931
|
);
|
|
3932
|
-
return
|
|
3932
|
+
return lines.join("\n");
|
|
3933
3933
|
}
|
|
3934
3934
|
function buildDocsRefreshDescription(stories) {
|
|
3935
3935
|
return [
|
|
@@ -4758,7 +4758,7 @@ function completeLines(text20, windowIsPartial) {
|
|
|
4758
4758
|
if (windowIsPartial) all.shift();
|
|
4759
4759
|
return all;
|
|
4760
4760
|
}
|
|
4761
|
-
function readLogTail(path109,
|
|
4761
|
+
function readLogTail(path109, lines) {
|
|
4762
4762
|
let fd;
|
|
4763
4763
|
try {
|
|
4764
4764
|
fd = openSync2(path109, "r");
|
|
@@ -4770,7 +4770,7 @@ function readLogTail(path109, lines2) {
|
|
|
4770
4770
|
const length = Math.min(size, MAX_TAIL_BYTES);
|
|
4771
4771
|
const buffer = Buffer.alloc(length);
|
|
4772
4772
|
readSync(fd, buffer, 0, length, size - length);
|
|
4773
|
-
return completeLines(buffer.toString("utf8"), length < size).slice(-
|
|
4773
|
+
return completeLines(buffer.toString("utf8"), length < size).slice(-lines);
|
|
4774
4774
|
} finally {
|
|
4775
4775
|
closeSync2(fd);
|
|
4776
4776
|
}
|
|
@@ -5314,10 +5314,10 @@ async function requestDaemonReply(request, replyType, timeoutMs = QUERY_TIMEOUT_
|
|
|
5314
5314
|
resolve34(result);
|
|
5315
5315
|
};
|
|
5316
5316
|
const timer = setTimeout(() => finish2(void 0), timeoutMs);
|
|
5317
|
-
const
|
|
5318
|
-
|
|
5317
|
+
const lines = createInterface2({ input: socket });
|
|
5318
|
+
lines.on("error", () => {
|
|
5319
5319
|
});
|
|
5320
|
-
|
|
5320
|
+
lines.on("line", (line) => {
|
|
5321
5321
|
try {
|
|
5322
5322
|
const data = JSON.parse(line);
|
|
5323
5323
|
if (data.type === replyType) finish2(data);
|
|
@@ -8391,14 +8391,14 @@ function rolloutString(value) {
|
|
|
8391
8391
|
|
|
8392
8392
|
// src/commands/sessions/shared/codex/codexRolloutMeta.ts
|
|
8393
8393
|
var MAX_FIRST_MESSAGE = 2e3;
|
|
8394
|
-
function codexRolloutMeta(
|
|
8394
|
+
function codexRolloutMeta(lines) {
|
|
8395
8395
|
const meta = {
|
|
8396
8396
|
sessionId: "",
|
|
8397
8397
|
cwd: "",
|
|
8398
8398
|
timestamp: "",
|
|
8399
8399
|
firstMessage: ""
|
|
8400
8400
|
};
|
|
8401
|
-
for (const line of
|
|
8401
|
+
for (const line of lines) {
|
|
8402
8402
|
const entry = parseRolloutEntry(line);
|
|
8403
8403
|
if (!entry) continue;
|
|
8404
8404
|
applySessionMeta(meta, entry);
|
|
@@ -8428,19 +8428,19 @@ var DEFAULT_MAX_LINES = 80;
|
|
|
8428
8428
|
async function readCodexHeadLines(filePath, maxLines = DEFAULT_MAX_LINES) {
|
|
8429
8429
|
const stream = fs4.createReadStream(filePath, { encoding: "utf8" });
|
|
8430
8430
|
const reader = readline.createInterface({ input: stream });
|
|
8431
|
-
const
|
|
8431
|
+
const lines = [];
|
|
8432
8432
|
try {
|
|
8433
8433
|
for await (const line of reader) {
|
|
8434
|
-
if (line)
|
|
8435
|
-
if (
|
|
8434
|
+
if (line) lines.push(line);
|
|
8435
|
+
if (lines.length >= maxLines) break;
|
|
8436
8436
|
}
|
|
8437
8437
|
} catch {
|
|
8438
|
-
return
|
|
8438
|
+
return lines;
|
|
8439
8439
|
} finally {
|
|
8440
8440
|
reader.close();
|
|
8441
8441
|
stream.destroy();
|
|
8442
8442
|
}
|
|
8443
|
-
return
|
|
8443
|
+
return lines;
|
|
8444
8444
|
}
|
|
8445
8445
|
|
|
8446
8446
|
// src/commands/sessions/shared/codex/parseCodexSessionFile.ts
|
|
@@ -8472,14 +8472,14 @@ async function mtime(filePath) {
|
|
|
8472
8472
|
import * as fs6 from "fs";
|
|
8473
8473
|
|
|
8474
8474
|
// src/commands/sessions/shared/extractSessionMeta.ts
|
|
8475
|
-
function extractSessionMeta(
|
|
8475
|
+
function extractSessionMeta(lines) {
|
|
8476
8476
|
let sessionId2 = "";
|
|
8477
8477
|
let cwd = "";
|
|
8478
8478
|
let timestamp9 = "";
|
|
8479
8479
|
let name = "";
|
|
8480
8480
|
let commandName = "";
|
|
8481
8481
|
let commandArgs = "";
|
|
8482
|
-
for (const line of
|
|
8482
|
+
for (const line of lines) {
|
|
8483
8483
|
const entry = safeParse(line);
|
|
8484
8484
|
if (!entry) continue;
|
|
8485
8485
|
sessionId2 ||= strField(entry, "sessionId");
|
|
@@ -10202,18 +10202,18 @@ import path12 from "path";
|
|
|
10202
10202
|
var RULES_HEADING = /^##\s+rules\s*$/i;
|
|
10203
10203
|
var SECTION_END = /^#{1,2}\s/;
|
|
10204
10204
|
var RULE_BULLET = /^\s*[-*]\s+\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
|
|
10205
|
-
function rulesSectionRange(
|
|
10206
|
-
const start2 =
|
|
10205
|
+
function rulesSectionRange(lines) {
|
|
10206
|
+
const start2 = lines.findIndex((line) => RULES_HEADING.test(line));
|
|
10207
10207
|
if (start2 === -1) return void 0;
|
|
10208
|
-
const offset =
|
|
10209
|
-
return { start: start2, end: offset === -1 ?
|
|
10208
|
+
const offset = lines.slice(start2 + 1).findIndex((line) => SECTION_END.test(line));
|
|
10209
|
+
return { start: start2, end: offset === -1 ? lines.length : start2 + 1 + offset };
|
|
10210
10210
|
}
|
|
10211
10211
|
function contentLines(content) {
|
|
10212
10212
|
const trimmed = content.replace(/\s+$/, "");
|
|
10213
10213
|
return trimmed === "" ? [] : trimmed.split(/\r?\n/);
|
|
10214
10214
|
}
|
|
10215
|
-
function appendRulesSection(
|
|
10216
|
-
const preamble =
|
|
10215
|
+
function appendRulesSection(lines, entry) {
|
|
10216
|
+
const preamble = lines.length === 0 ? [] : [...lines, ""];
|
|
10217
10217
|
return `${[...preamble, "## Rules", "", entry].join("\n")}
|
|
10218
10218
|
`;
|
|
10219
10219
|
}
|
|
@@ -10228,11 +10228,11 @@ function splitTitle(rest) {
|
|
|
10228
10228
|
return title === "" || text20 === "" ? { text: rest } : { title, text: text20 };
|
|
10229
10229
|
}
|
|
10230
10230
|
function parseRulesSection(content) {
|
|
10231
|
-
const
|
|
10232
|
-
const range = rulesSectionRange(
|
|
10231
|
+
const lines = content.split(/\r?\n/);
|
|
10232
|
+
const range = rulesSectionRange(lines);
|
|
10233
10233
|
if (!range) return [];
|
|
10234
10234
|
const rules2 = [];
|
|
10235
|
-
for (const line of
|
|
10235
|
+
for (const line of lines.slice(range.start + 1, range.end)) {
|
|
10236
10236
|
const match = RULE_BULLET.exec(line);
|
|
10237
10237
|
if (!match) continue;
|
|
10238
10238
|
const code = match[1].trim();
|
|
@@ -13031,13 +13031,13 @@ function parseErrors(body) {
|
|
|
13031
13031
|
}
|
|
13032
13032
|
}
|
|
13033
13033
|
function formatAscError(method, path109, status2, body) {
|
|
13034
|
-
const
|
|
13034
|
+
const lines = [
|
|
13035
13035
|
`App Store Connect ${method} ${path109} failed (${status2})`,
|
|
13036
13036
|
...parseErrors(body).map((line) => ` ${line}`)
|
|
13037
13037
|
];
|
|
13038
13038
|
const hint = statusHints[status2];
|
|
13039
|
-
if (hint)
|
|
13040
|
-
return
|
|
13039
|
+
if (hint) lines.push(hint);
|
|
13040
|
+
return lines.join("\n");
|
|
13041
13041
|
}
|
|
13042
13042
|
|
|
13043
13043
|
// src/commands/testflight/TestflightError.ts
|
|
@@ -13294,14 +13294,14 @@ function readTestflightConfig(config) {
|
|
|
13294
13294
|
const testflight = config.testflight ?? {};
|
|
13295
13295
|
const missing = requiredKeys.filter((key) => !testflight[key]);
|
|
13296
13296
|
if (missing.length > 0) {
|
|
13297
|
-
const
|
|
13297
|
+
const lines = missing.map((key) => {
|
|
13298
13298
|
const entry = testflightConfigHelp.find(
|
|
13299
13299
|
(help) => help.key === `testflight.${key}`
|
|
13300
13300
|
);
|
|
13301
13301
|
return ` testflight.${key} is not set. Set it with: ${entry?.setter}`;
|
|
13302
13302
|
});
|
|
13303
13303
|
throw new TestflightError(
|
|
13304
|
-
["TestFlight is not configured", ...
|
|
13304
|
+
["TestFlight is not configured", ...lines].join("\n")
|
|
13305
13305
|
);
|
|
13306
13306
|
}
|
|
13307
13307
|
return testflight;
|
|
@@ -14312,7 +14312,7 @@ function firstEnabledIndex(items3) {
|
|
|
14312
14312
|
// src/commands/sessions/web/restartMenu/renderRestartMenu.ts
|
|
14313
14313
|
import chalk13 from "chalk";
|
|
14314
14314
|
function renderRestartMenu(items3, selected) {
|
|
14315
|
-
const
|
|
14315
|
+
const lines = [chalk13.bold.cyan("assist \u2014 restart menu")];
|
|
14316
14316
|
items3.forEach((item, i) => {
|
|
14317
14317
|
const active = i === selected;
|
|
14318
14318
|
const pointer = active ? chalk13.cyan("\u276F ") : " ";
|
|
@@ -14321,10 +14321,10 @@ function renderRestartMenu(items3, selected) {
|
|
|
14321
14321
|
let label = item.label;
|
|
14322
14322
|
if (item.disabled) label = chalk13.dim(label);
|
|
14323
14323
|
else if (active) label = chalk13.cyan.bold(label);
|
|
14324
|
-
|
|
14324
|
+
lines.push(`${pointer}${number}${label}${note}`);
|
|
14325
14325
|
});
|
|
14326
|
-
|
|
14327
|
-
return
|
|
14326
|
+
lines.push(chalk13.dim("\u2191/\u2193 move \xB7 1-3 jump \xB7 enter select \xB7 esc close"));
|
|
14327
|
+
return lines.join("\n");
|
|
14328
14328
|
}
|
|
14329
14329
|
|
|
14330
14330
|
// src/commands/sessions/web/restartMenu/createMenuState.ts
|
|
@@ -14450,10 +14450,10 @@ async function connect2() {
|
|
|
14450
14450
|
}
|
|
14451
14451
|
}
|
|
14452
14452
|
function wire(socket) {
|
|
14453
|
-
const
|
|
14454
|
-
|
|
14453
|
+
const lines = createInterface4({ input: socket });
|
|
14454
|
+
lines.on("error", () => {
|
|
14455
14455
|
});
|
|
14456
|
-
|
|
14456
|
+
lines.on("line", emit);
|
|
14457
14457
|
socket.on("error", () => {
|
|
14458
14458
|
});
|
|
14459
14459
|
socket.on("close", scheduleReconnect);
|
|
@@ -15280,8 +15280,8 @@ function printDiff(oldContent, newContent) {
|
|
|
15280
15280
|
normalizeJson(newContent)
|
|
15281
15281
|
);
|
|
15282
15282
|
for (const change of changes) {
|
|
15283
|
-
const
|
|
15284
|
-
for (const line of
|
|
15283
|
+
const lines = change.value.replace(/\n$/, "").split("\n");
|
|
15284
|
+
for (const line of lines) {
|
|
15285
15285
|
if (change.added) {
|
|
15286
15286
|
console.log(chalk23.green(`+ ${line}`));
|
|
15287
15287
|
} else if (change.removed) {
|
|
@@ -15591,11 +15591,11 @@ function removeVscodeFromGitignore() {
|
|
|
15591
15591
|
return;
|
|
15592
15592
|
}
|
|
15593
15593
|
const content = fs9.readFileSync(gitignorePath, "utf8");
|
|
15594
|
-
const
|
|
15595
|
-
const filteredLines =
|
|
15594
|
+
const lines = content.split("\n");
|
|
15595
|
+
const filteredLines = lines.filter(
|
|
15596
15596
|
(line) => !line.trim().toLowerCase().includes(".vscode")
|
|
15597
15597
|
);
|
|
15598
|
-
if (filteredLines.length !==
|
|
15598
|
+
if (filteredLines.length !== lines.length) {
|
|
15599
15599
|
fs9.writeFileSync(gitignorePath, filteredLines.join("\n"));
|
|
15600
15600
|
console.log(chalk31.dim("Removed .vscode references from .gitignore"));
|
|
15601
15601
|
}
|
|
@@ -16512,10 +16512,10 @@ function getDocumentedConfigKeys() {
|
|
|
16512
16512
|
}
|
|
16513
16513
|
function renderConfigHelp(entries, preamble) {
|
|
16514
16514
|
const width2 = Math.max(...entries.map((entry) => entry.setter.length));
|
|
16515
|
-
const
|
|
16515
|
+
const lines = entries.map(
|
|
16516
16516
|
(entry) => ` ${entry.setter.padEnd(width2)} # ${entry.note}`
|
|
16517
16517
|
);
|
|
16518
|
-
const body = preamble ? ["", preamble, "", "Config:", ...
|
|
16518
|
+
const body = preamble ? ["", preamble, "", "Config:", ...lines] : ["", "Config:", ...lines];
|
|
16519
16519
|
return body.join("\n");
|
|
16520
16520
|
}
|
|
16521
16521
|
function configHelp(command, entries, preamble) {
|
|
@@ -17171,6 +17171,14 @@ function formatAskCheckAnswer(title, answers) {
|
|
|
17171
17171
|
Note: ${note}` : line;
|
|
17172
17172
|
}
|
|
17173
17173
|
|
|
17174
|
+
// src/commands/askCheck/formatCheckDismissal.ts
|
|
17175
|
+
function formatCheckDismissal(answers) {
|
|
17176
|
+
const line = "The user dismissed the manual check without a result. Do not assume it passed; ask in chat if the result is essential.";
|
|
17177
|
+
const note = answers?.[CHECK_NOTE_KEY]?.trim();
|
|
17178
|
+
return note ? `${line}
|
|
17179
|
+
Note: ${note}` : line;
|
|
17180
|
+
}
|
|
17181
|
+
|
|
17174
17182
|
// src/commands/askCheck/rejectLongCheck.ts
|
|
17175
17183
|
var MAX_TITLE = 60;
|
|
17176
17184
|
var MAX_STEPS = 4;
|
|
@@ -17335,9 +17343,7 @@ async function askCheck(options2) {
|
|
|
17335
17343
|
{ rejectIsOutcome: true }
|
|
17336
17344
|
);
|
|
17337
17345
|
if (decision.decision === "reject") {
|
|
17338
|
-
console.error(
|
|
17339
|
-
"The user dismissed the manual check without a result. Do not assume it passed; ask in chat if the result is essential."
|
|
17340
|
-
);
|
|
17346
|
+
console.error(formatCheckDismissal(decision.answers));
|
|
17341
17347
|
process.exit(1);
|
|
17342
17348
|
}
|
|
17343
17349
|
const answers = decision.answers ?? {};
|
|
@@ -17643,38 +17649,38 @@ var END_MARKER = "# <<< assist backup schedule <<<";
|
|
|
17643
17649
|
function buildBlock(every, cronLine) {
|
|
17644
17650
|
return [BEGIN_MARKER, `# every ${every}`, cronLine, END_MARKER];
|
|
17645
17651
|
}
|
|
17646
|
-
function findBlockRange(
|
|
17647
|
-
const start2 =
|
|
17652
|
+
function findBlockRange(lines) {
|
|
17653
|
+
const start2 = lines.indexOf(BEGIN_MARKER);
|
|
17648
17654
|
if (start2 === -1) return void 0;
|
|
17649
|
-
const end =
|
|
17655
|
+
const end = lines.indexOf(END_MARKER, start2);
|
|
17650
17656
|
if (end === -1) return void 0;
|
|
17651
17657
|
return { start: start2, end };
|
|
17652
17658
|
}
|
|
17653
17659
|
function upsertScheduleBlock(crontab, every, cronLine) {
|
|
17654
|
-
const
|
|
17660
|
+
const lines = crontab.length === 0 ? [] : crontab.replace(/\n$/, "").split("\n");
|
|
17655
17661
|
const block = buildBlock(every, cronLine);
|
|
17656
|
-
const range = findBlockRange(
|
|
17657
|
-
const next3 = range === void 0 ? [...
|
|
17658
|
-
...
|
|
17662
|
+
const range = findBlockRange(lines);
|
|
17663
|
+
const next3 = range === void 0 ? [...lines, ...block] : [
|
|
17664
|
+
...lines.slice(0, range.start),
|
|
17659
17665
|
...block,
|
|
17660
|
-
...
|
|
17666
|
+
...lines.slice(range.end + 1)
|
|
17661
17667
|
];
|
|
17662
17668
|
return `${next3.join("\n")}
|
|
17663
17669
|
`;
|
|
17664
17670
|
}
|
|
17665
17671
|
function removeScheduleBlock(crontab) {
|
|
17666
|
-
const
|
|
17667
|
-
const range = findBlockRange(
|
|
17672
|
+
const lines = crontab.length === 0 ? [] : crontab.replace(/\n$/, "").split("\n");
|
|
17673
|
+
const range = findBlockRange(lines);
|
|
17668
17674
|
if (range === void 0) return crontab;
|
|
17669
|
-
const next3 = [...
|
|
17675
|
+
const next3 = [...lines.slice(0, range.start), ...lines.slice(range.end + 1)];
|
|
17670
17676
|
return next3.length === 0 ? "" : `${next3.join("\n")}
|
|
17671
17677
|
`;
|
|
17672
17678
|
}
|
|
17673
17679
|
function readScheduleBlock(crontab) {
|
|
17674
|
-
const
|
|
17675
|
-
const range = findBlockRange(
|
|
17680
|
+
const lines = crontab.length === 0 ? [] : crontab.split("\n");
|
|
17681
|
+
const range = findBlockRange(lines);
|
|
17676
17682
|
if (range === void 0) return void 0;
|
|
17677
|
-
const body =
|
|
17683
|
+
const body = lines.slice(range.start + 1, range.end);
|
|
17678
17684
|
const everyLine = body.find((line) => line.startsWith("# every "));
|
|
17679
17685
|
const cronLine = body.find(
|
|
17680
17686
|
(line) => !line.startsWith("#") && line.trim() !== ""
|
|
@@ -17921,9 +17927,9 @@ function chartYRange(values) {
|
|
|
17921
17927
|
}
|
|
17922
17928
|
|
|
17923
17929
|
// src/commands/chart/parseChartSeries.ts
|
|
17924
|
-
function parseChartSeries(
|
|
17930
|
+
function parseChartSeries(lines) {
|
|
17925
17931
|
const points = [];
|
|
17926
|
-
for (const line of
|
|
17932
|
+
for (const line of lines) {
|
|
17927
17933
|
const trimmed = line.trim();
|
|
17928
17934
|
if (trimmed === "") continue;
|
|
17929
17935
|
const parts = trimmed.split(/[,\t ]+/).filter((part) => part !== "");
|
|
@@ -17948,19 +17954,19 @@ async function readStdinLines() {
|
|
|
17948
17954
|
input: process.stdin,
|
|
17949
17955
|
terminal: false
|
|
17950
17956
|
});
|
|
17951
|
-
const
|
|
17957
|
+
const lines = [];
|
|
17952
17958
|
for await (const line of rl) {
|
|
17953
|
-
|
|
17959
|
+
lines.push(line);
|
|
17954
17960
|
}
|
|
17955
|
-
return
|
|
17961
|
+
return lines;
|
|
17956
17962
|
}
|
|
17957
17963
|
|
|
17958
17964
|
// src/commands/chart.ts
|
|
17959
17965
|
async function chart(options2) {
|
|
17960
|
-
const
|
|
17966
|
+
const lines = await readStdinLines();
|
|
17961
17967
|
let points;
|
|
17962
17968
|
try {
|
|
17963
|
-
points = parseChartSeries(
|
|
17969
|
+
points = parseChartSeries(lines);
|
|
17964
17970
|
} catch (error) {
|
|
17965
17971
|
console.error(error instanceof Error ? error.message : String(error));
|
|
17966
17972
|
process.exit(1);
|
|
@@ -18636,11 +18642,11 @@ async function countRows(client, table) {
|
|
|
18636
18642
|
return rows[0].n;
|
|
18637
18643
|
}
|
|
18638
18644
|
function printSummary(tables, current2, incoming) {
|
|
18639
|
-
const
|
|
18645
|
+
const lines = tables.map(
|
|
18640
18646
|
(t, i) => ` ${t.name}: ${current2[i]} \u2192 ${incoming[i]} rows`
|
|
18641
18647
|
);
|
|
18642
18648
|
console.error(chalk53.bold("\nThis will REPLACE all backlog data:"));
|
|
18643
|
-
console.error(`${
|
|
18649
|
+
console.error(`${lines.join("\n")}
|
|
18644
18650
|
`);
|
|
18645
18651
|
}
|
|
18646
18652
|
async function confirmReplace(client, tables, incoming, fromStdin) {
|
|
@@ -23569,13 +23575,13 @@ function saveCliReads(commands) {
|
|
|
23569
23575
|
);
|
|
23570
23576
|
cachedReads = void 0;
|
|
23571
23577
|
}
|
|
23572
|
-
function findMatch(command,
|
|
23578
|
+
function findMatch(command, lines) {
|
|
23573
23579
|
const words = command.split(/\s+/);
|
|
23574
23580
|
if (words.length === 0) return void 0;
|
|
23575
|
-
if (
|
|
23581
|
+
if (lines.includes(words[0])) return words[0];
|
|
23576
23582
|
if (words.length < 2) return void 0;
|
|
23577
23583
|
const prefix2 = `${words[0]} ${words[1]}`;
|
|
23578
|
-
const candidates =
|
|
23584
|
+
const candidates = lines.filter(
|
|
23579
23585
|
(line) => line === prefix2 || line.startsWith(`${prefix2} `)
|
|
23580
23586
|
);
|
|
23581
23587
|
return candidates.sort((a, b) => b.length - a.length).find((rc) => command === rc || command.startsWith(`${rc} `));
|
|
@@ -24384,14 +24390,14 @@ function formatHuman(cli, commands) {
|
|
|
24384
24390
|
const sorted2 = [...commands].sort(
|
|
24385
24391
|
(a, b) => a.path.join(" ").localeCompare(b.path.join(" "))
|
|
24386
24392
|
);
|
|
24387
|
-
const
|
|
24393
|
+
const lines = [`Discovered ${commands.length} commands for "${cli}":
|
|
24388
24394
|
`];
|
|
24389
24395
|
for (const cmd of sorted2) {
|
|
24390
24396
|
const full = `${cli} ${cmd.path.join(" ")}`;
|
|
24391
24397
|
const text20 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
|
|
24392
|
-
|
|
24398
|
+
lines.push(`${prefix(classifyVerb(cmd.path))}${text20}`);
|
|
24393
24399
|
}
|
|
24394
|
-
return
|
|
24400
|
+
return lines.join("\n");
|
|
24395
24401
|
}
|
|
24396
24402
|
|
|
24397
24403
|
// src/commands/permitCliReads/parseCached.ts
|
|
@@ -24646,22 +24652,22 @@ function codeCommentConfirm(pin2) {
|
|
|
24646
24652
|
return;
|
|
24647
24653
|
}
|
|
24648
24654
|
const original = readFileSync36(state.file, "utf8");
|
|
24649
|
-
const
|
|
24655
|
+
const lines = original.split("\n");
|
|
24650
24656
|
const index3 = state.line - 1;
|
|
24651
|
-
if (index3 >
|
|
24657
|
+
if (index3 > lines.length) {
|
|
24652
24658
|
console.error(
|
|
24653
24659
|
chalk120.red(
|
|
24654
|
-
`Line ${state.line} is beyond the end of ${state.file} (${
|
|
24660
|
+
`Line ${state.line} is beyond the end of ${state.file} (${lines.length} lines).`
|
|
24655
24661
|
)
|
|
24656
24662
|
);
|
|
24657
24663
|
process.exitCode = 1;
|
|
24658
24664
|
return;
|
|
24659
24665
|
}
|
|
24660
24666
|
const marker2 = isHashCommentFile(state.file) ? "#" : "//";
|
|
24661
|
-
const indentSource =
|
|
24667
|
+
const indentSource = lines[index3] ?? "";
|
|
24662
24668
|
const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
24663
|
-
|
|
24664
|
-
writeFileSync27(state.file,
|
|
24669
|
+
lines.splice(index3, 0, `${indent4}${marker2} ${state.text}`);
|
|
24670
|
+
writeFileSync27(state.file, lines.join("\n"));
|
|
24665
24671
|
unlinkSync8(getPinStatePath(pin2));
|
|
24666
24672
|
console.log(
|
|
24667
24673
|
chalk120.green(
|
|
@@ -25912,8 +25918,8 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
|
|
|
25912
25918
|
var MAINTAINABILITY_OVERRIDE_MARKER = "assist-maintainability-override";
|
|
25913
25919
|
var OVERRIDE_MARKER = /^\s*\/\/\s*assist-maintainability-override:?\s*(-?\d+)\s*$/;
|
|
25914
25920
|
function parseMaintainabilityOverride(content) {
|
|
25915
|
-
const
|
|
25916
|
-
for (const line of
|
|
25921
|
+
const lines = content.split("\n").slice(0, 10);
|
|
25922
|
+
for (const line of lines) {
|
|
25917
25923
|
const match = line.match(OVERRIDE_MARKER);
|
|
25918
25924
|
if (!match) continue;
|
|
25919
25925
|
const value = Number(match[1]);
|
|
@@ -26098,17 +26104,17 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
|
|
|
26098
26104
|
let hasViolation = false;
|
|
26099
26105
|
for (const file of files) {
|
|
26100
26106
|
const content = fs22.readFileSync(file, "utf8");
|
|
26101
|
-
const
|
|
26102
|
-
results.push({ file, lines
|
|
26103
|
-
if (options2.threshold !== void 0 &&
|
|
26107
|
+
const lines = countSloc(content);
|
|
26108
|
+
results.push({ file, lines });
|
|
26109
|
+
if (options2.threshold !== void 0 && lines > options2.threshold) {
|
|
26104
26110
|
hasViolation = true;
|
|
26105
26111
|
}
|
|
26106
26112
|
}
|
|
26107
26113
|
results.sort((a, b) => b.lines - a.lines);
|
|
26108
|
-
for (const { file, lines
|
|
26109
|
-
const exceedsThreshold = options2.threshold !== void 0 &&
|
|
26114
|
+
for (const { file, lines } of results) {
|
|
26115
|
+
const exceedsThreshold = options2.threshold !== void 0 && lines > options2.threshold;
|
|
26110
26116
|
const color = exceedsThreshold ? chalk130.red : chalk130.white;
|
|
26111
|
-
console.log(`${color(file)} \u2192 ${chalk130.cyan(
|
|
26117
|
+
console.log(`${color(file)} \u2192 ${chalk130.cyan(lines)} lines`);
|
|
26112
26118
|
}
|
|
26113
26119
|
const total2 = results.reduce((sum3, r) => sum3 + r.lines, 0);
|
|
26114
26120
|
console.log(
|
|
@@ -26516,9 +26522,9 @@ function headline(shown, total2, filter) {
|
|
|
26516
26522
|
function formatLeaf(leaf, help) {
|
|
26517
26523
|
const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
|
|
26518
26524
|
if (leaf.secret) meta.push("secret");
|
|
26519
|
-
const
|
|
26520
|
-
if (help)
|
|
26521
|
-
return
|
|
26525
|
+
const lines = [`${chalk140.cyan(leaf.key)} ${chalk140.dim(meta.join(" "))}`];
|
|
26526
|
+
if (help) lines.push(` ${help.note}`, ` ${chalk140.green(help.setter)}`);
|
|
26527
|
+
return lines;
|
|
26522
26528
|
}
|
|
26523
26529
|
function typeText(leaf) {
|
|
26524
26530
|
if (leaf.enumValues) return leaf.enumValues.join(" | ");
|
|
@@ -26750,15 +26756,15 @@ import chalk148 from "chalk";
|
|
|
26750
26756
|
// src/commands/browser/formatInspectMatches.ts
|
|
26751
26757
|
function formatInspectMatches({ matches, total: total2 }, query) {
|
|
26752
26758
|
if (total2 === 0) return [`no elements match ${query}`];
|
|
26753
|
-
const
|
|
26759
|
+
const lines = matches.flatMap((match, index3) => [
|
|
26754
26760
|
`[${index3 + 1}/${total2}] ${match.width}\xD7${match.height} ${JSON.stringify(match.text)}`,
|
|
26755
26761
|
...match.chain.map((step3) => ` ${step3}`)
|
|
26756
26762
|
]);
|
|
26757
26763
|
if (total2 > matches.length)
|
|
26758
|
-
|
|
26764
|
+
lines.push(
|
|
26759
26765
|
`showing the first ${matches.length} of ${total2} matches; narrow the query to see the rest`
|
|
26760
26766
|
);
|
|
26761
|
-
return
|
|
26767
|
+
return lines;
|
|
26762
26768
|
}
|
|
26763
26769
|
|
|
26764
26770
|
// src/commands/browser/requestTab.ts
|
|
@@ -29750,12 +29756,12 @@ function isHeaderLine(line) {
|
|
|
29750
29756
|
return trimmed === "" || trimmed.startsWith("#");
|
|
29751
29757
|
}
|
|
29752
29758
|
function extractShellComments(text20) {
|
|
29753
|
-
const
|
|
29759
|
+
const lines = text20.split("\n");
|
|
29754
29760
|
let firstCodeLine = 0;
|
|
29755
|
-
while (firstCodeLine <
|
|
29761
|
+
while (firstCodeLine < lines.length && isHeaderLine(lines[firstCodeLine])) {
|
|
29756
29762
|
firstCodeLine++;
|
|
29757
29763
|
}
|
|
29758
|
-
return extractYamlComments(
|
|
29764
|
+
return extractYamlComments(lines.slice(firstCodeLine).join("\n"));
|
|
29759
29765
|
}
|
|
29760
29766
|
|
|
29761
29767
|
// src/commands/editHook/selectCommentExtractor.ts
|
|
@@ -30740,18 +30746,18 @@ function row(cells) {
|
|
|
30740
30746
|
}
|
|
30741
30747
|
function imageTable(images) {
|
|
30742
30748
|
if (images.length === 0) return [];
|
|
30743
|
-
const
|
|
30749
|
+
const lines = [];
|
|
30744
30750
|
for (let i = 0; i < images.length; i += 2) {
|
|
30745
30751
|
const pair = images.slice(i, i + 2);
|
|
30746
30752
|
const captions = [0, 1].map((j) => pair[j] ? cell(pair[j].alt) : "");
|
|
30747
30753
|
const refs = [0, 1].map(
|
|
30748
30754
|
(j) => pair[j] ? cell(screenshotReference(pair[j])) : ""
|
|
30749
30755
|
);
|
|
30750
|
-
if (i === 0)
|
|
30751
|
-
else
|
|
30752
|
-
|
|
30756
|
+
if (i === 0) lines.push(row(captions), row(["---", "---"]));
|
|
30757
|
+
else lines.push(row(captions.map((c) => c ? `**${c}**` : "")));
|
|
30758
|
+
lines.push(row(refs));
|
|
30753
30759
|
}
|
|
30754
|
-
return [
|
|
30760
|
+
return [lines.join("\n")];
|
|
30755
30761
|
}
|
|
30756
30762
|
function renderScreenshotBlock(attachments) {
|
|
30757
30763
|
const isVideo = (a) => VIDEO_EXTENSIONS.has(extname3(a.path).toLowerCase());
|
|
@@ -32565,6 +32571,7 @@ var persistedSessionSchema = z20.object({
|
|
|
32565
32571
|
commandType: z20.enum(["claude", "run", "assist"]),
|
|
32566
32572
|
harness: z20.enum(["claude", "codex", "pi"]).optional(),
|
|
32567
32573
|
status: z20.enum(["running", "waiting", "done", "error", "stopped"]).optional(),
|
|
32574
|
+
error: z20.string().optional(),
|
|
32568
32575
|
cwd: z20.string(),
|
|
32569
32576
|
startedAt: z20.number(),
|
|
32570
32577
|
runningMs: z20.number().optional(),
|
|
@@ -32601,6 +32608,7 @@ function toPersistedSession(session) {
|
|
|
32601
32608
|
commandType: session.commandType,
|
|
32602
32609
|
harness: session.harness,
|
|
32603
32610
|
status: session.status,
|
|
32611
|
+
error: session.error,
|
|
32604
32612
|
cwd: session.cwd ?? process.cwd(),
|
|
32605
32613
|
startedAt: session.startedAt,
|
|
32606
32614
|
runningMs: accumulatedRunningMs(session),
|
|
@@ -32663,7 +32671,7 @@ function savePersistedSessions(sessions) {
|
|
|
32663
32671
|
}
|
|
32664
32672
|
function persistLiveSessions(sessions) {
|
|
32665
32673
|
const live = [...sessions.values()].filter(
|
|
32666
|
-
(s) => (s.pty || s.status === "stopped" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
|
|
32674
|
+
(s) => (s.pty || s.status === "stopped" || s.status === "error" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
|
|
32667
32675
|
);
|
|
32668
32676
|
savePersistedSessions(live.map(toPersistedSession));
|
|
32669
32677
|
logPersist(live);
|
|
@@ -34643,9 +34651,9 @@ function extractVoyagerPosts(body) {
|
|
|
34643
34651
|
|
|
34644
34652
|
// src/commands/netcap/extractPostsFromCapture.ts
|
|
34645
34653
|
function captureEntries(captureFile) {
|
|
34646
|
-
const
|
|
34654
|
+
const lines = readFileSync50(captureFile, "utf8").split("\n").filter(Boolean);
|
|
34647
34655
|
const entries = [];
|
|
34648
|
-
for (const line of
|
|
34656
|
+
for (const line of lines) {
|
|
34649
34657
|
let entry;
|
|
34650
34658
|
try {
|
|
34651
34659
|
entry = JSON.parse(line);
|
|
@@ -35526,17 +35534,17 @@ function firstLine(body) {
|
|
|
35526
35534
|
return line.length > summaryLimit ? `${line.slice(0, summaryLimit - 1)}\u2026` : line;
|
|
35527
35535
|
}
|
|
35528
35536
|
function renderResolvedIndex(threads, style) {
|
|
35529
|
-
const
|
|
35537
|
+
const lines = [style.cyan(`Resolved threads (${threads.length})`)];
|
|
35530
35538
|
for (const thread of threads) {
|
|
35531
35539
|
const first = thread.comments[0];
|
|
35532
35540
|
if (!first) continue;
|
|
35533
35541
|
const count10 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
|
|
35534
|
-
|
|
35542
|
+
lines.push(
|
|
35535
35543
|
` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count10}`
|
|
35536
35544
|
);
|
|
35537
35545
|
}
|
|
35538
|
-
|
|
35539
|
-
return
|
|
35546
|
+
lines.push("");
|
|
35547
|
+
return lines.join("\n");
|
|
35540
35548
|
}
|
|
35541
35549
|
|
|
35542
35550
|
// src/commands/prs/listComments/renderThreadBlock.ts
|
|
@@ -35546,16 +35554,16 @@ function indent2(text20) {
|
|
|
35546
35554
|
function renderThreadBlock(thread, style) {
|
|
35547
35555
|
const first = thread.comments[0];
|
|
35548
35556
|
if (!first) return "";
|
|
35549
|
-
const
|
|
35557
|
+
const lines = [
|
|
35550
35558
|
`${style.cyan("Thread")} on ${style.bold(threadLocation(first))}`
|
|
35551
35559
|
];
|
|
35552
35560
|
if (style.diffHunk) {
|
|
35553
|
-
|
|
35561
|
+
lines.push(
|
|
35554
35562
|
indent2(style.dim(first.diff_hunk.split("\n").slice(-3).join("\n")))
|
|
35555
35563
|
);
|
|
35556
35564
|
}
|
|
35557
35565
|
for (const comment3 of thread.comments) {
|
|
35558
|
-
|
|
35566
|
+
lines.push(
|
|
35559
35567
|
indent2(
|
|
35560
35568
|
[
|
|
35561
35569
|
`${style.bold(comment3.user)} ${style.dim(`id ${comment3.id}`)} ${style.dim(comment3.html_url)}`,
|
|
@@ -35565,7 +35573,7 @@ function renderThreadBlock(thread, style) {
|
|
|
35565
35573
|
)
|
|
35566
35574
|
);
|
|
35567
35575
|
}
|
|
35568
|
-
return
|
|
35576
|
+
return lines.join("\n");
|
|
35569
35577
|
}
|
|
35570
35578
|
|
|
35571
35579
|
// src/commands/prs/listComments/renderReview.ts
|
|
@@ -36121,11 +36129,11 @@ function findWallOfText(body) {
|
|
|
36121
36129
|
function splitParagraphs(body) {
|
|
36122
36130
|
const paragraphs = [];
|
|
36123
36131
|
let section2 = "(intro)";
|
|
36124
|
-
let
|
|
36132
|
+
let lines = [];
|
|
36125
36133
|
const flush = () => {
|
|
36126
|
-
if (
|
|
36127
|
-
paragraphs.push({ section: section2, lines
|
|
36128
|
-
|
|
36134
|
+
if (lines.length > 0) {
|
|
36135
|
+
paragraphs.push({ section: section2, lines });
|
|
36136
|
+
lines = [];
|
|
36129
36137
|
}
|
|
36130
36138
|
};
|
|
36131
36139
|
for (const line of body.split("\n")) {
|
|
@@ -36136,17 +36144,17 @@ function splitParagraphs(body) {
|
|
|
36136
36144
|
} else if (line.trim() === "") {
|
|
36137
36145
|
flush();
|
|
36138
36146
|
} else {
|
|
36139
|
-
|
|
36147
|
+
lines.push(line);
|
|
36140
36148
|
}
|
|
36141
36149
|
}
|
|
36142
36150
|
flush();
|
|
36143
36151
|
return paragraphs;
|
|
36144
36152
|
}
|
|
36145
|
-
function isWallOfText(
|
|
36146
|
-
if (
|
|
36153
|
+
function isWallOfText(lines) {
|
|
36154
|
+
if (lines.some(isListLine)) {
|
|
36147
36155
|
return false;
|
|
36148
36156
|
}
|
|
36149
|
-
const text20 =
|
|
36157
|
+
const text20 = lines.join(" ").trim();
|
|
36150
36158
|
return text20.length > MAX_PARAGRAPH_CHARS || countSentences(text20) > MAX_PARAGRAPH_SENTENCES;
|
|
36151
36159
|
}
|
|
36152
36160
|
function countSentences(paragraph) {
|
|
@@ -36990,14 +36998,14 @@ function reviewLine(pr) {
|
|
|
36990
36998
|
return reviewers ? `review: ${decision} | ${reviewers}` : `review: ${decision}`;
|
|
36991
36999
|
}
|
|
36992
37000
|
function checkLines(pr) {
|
|
36993
|
-
const
|
|
37001
|
+
const lines = [];
|
|
36994
37002
|
if (pr.checks.failing.length) {
|
|
36995
|
-
|
|
37003
|
+
lines.push(chalk209.red(`failing: ${pr.checks.failing.join(", ")}`));
|
|
36996
37004
|
}
|
|
36997
37005
|
if (pr.checks.pending.length) {
|
|
36998
|
-
|
|
37006
|
+
lines.push(chalk209.yellow(`pending: ${pr.checks.pending.join(", ")}`));
|
|
36999
37007
|
}
|
|
37000
|
-
return
|
|
37008
|
+
return lines;
|
|
37001
37009
|
}
|
|
37002
37010
|
function threadsLine(pr) {
|
|
37003
37011
|
if (pr.unresolvedThreads === null) {
|
|
@@ -38207,11 +38215,11 @@ ${checkName2} failed:
|
|
|
38207
38215
|
// src/commands/lint/lint/runImportExtensionCheck.ts
|
|
38208
38216
|
function checkForImportExtensions(filePath) {
|
|
38209
38217
|
const content = fs28.readFileSync(filePath, "utf8");
|
|
38210
|
-
const
|
|
38218
|
+
const lines = content.split("\n");
|
|
38211
38219
|
const violations = [];
|
|
38212
38220
|
const importExtensionPattern = /from\s+["']\..*\.(js|ts)["']/;
|
|
38213
|
-
for (let i = 0; i <
|
|
38214
|
-
const line =
|
|
38221
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38222
|
+
const line = lines[i];
|
|
38215
38223
|
if (importExtensionPattern.test(line)) {
|
|
38216
38224
|
violations.push({
|
|
38217
38225
|
filePath,
|
|
@@ -38301,12 +38309,12 @@ function silentCatchClauses(file) {
|
|
|
38301
38309
|
});
|
|
38302
38310
|
}
|
|
38303
38311
|
function findSilentCatches(file) {
|
|
38304
|
-
const
|
|
38312
|
+
const lines = file.getFullText().split("\n");
|
|
38305
38313
|
return [...silentCatchClauses(file), ...silentCatchCallbacks(file)].map(
|
|
38306
38314
|
(node) => ({
|
|
38307
38315
|
filePath: file.getFilePath(),
|
|
38308
38316
|
line: node.getStartLineNumber(),
|
|
38309
|
-
content:
|
|
38317
|
+
content: lines[node.getStartLineNumber() - 1].trim()
|
|
38310
38318
|
})
|
|
38311
38319
|
);
|
|
38312
38320
|
}
|
|
@@ -38336,12 +38344,12 @@ function runSilentCatchCheck() {
|
|
|
38336
38344
|
import fs30 from "fs";
|
|
38337
38345
|
function checkForDynamicImports(filePath) {
|
|
38338
38346
|
const content = fs30.readFileSync(filePath, "utf8");
|
|
38339
|
-
const
|
|
38347
|
+
const lines = content.split("\n");
|
|
38340
38348
|
const violations = [];
|
|
38341
38349
|
const requirePattern = /\brequire\s*\(/;
|
|
38342
38350
|
const dynamicImportPattern = /\bimport\s*\(/;
|
|
38343
|
-
for (let i = 0; i <
|
|
38344
|
-
const line =
|
|
38351
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38352
|
+
const line = lines[i];
|
|
38345
38353
|
if (requirePattern.test(line) || dynamicImportPattern.test(line)) {
|
|
38346
38354
|
violations.push({
|
|
38347
38355
|
filePath,
|
|
@@ -38937,9 +38945,9 @@ function parseRefactorYml() {
|
|
|
38937
38945
|
}
|
|
38938
38946
|
const content = fs31.readFileSync(REFACTOR_YML_PATH, "utf8");
|
|
38939
38947
|
const entries = [];
|
|
38940
|
-
const
|
|
38948
|
+
const lines = content.split("\n");
|
|
38941
38949
|
let currentEntry = {};
|
|
38942
|
-
for (const line of
|
|
38950
|
+
for (const line of lines) {
|
|
38943
38951
|
const trimmed = line.trim();
|
|
38944
38952
|
if (trimmed.startsWith("- file:")) {
|
|
38945
38953
|
if (currentEntry.file) {
|
|
@@ -39536,22 +39544,22 @@ function formatImportLine(imp) {
|
|
|
39536
39544
|
|
|
39537
39545
|
// src/commands/refactor/extract/buildDestinationContent.ts
|
|
39538
39546
|
function buildDestinationContent(functionTexts, imports, sourceRelativePath, sourceImportNames) {
|
|
39539
|
-
const
|
|
39547
|
+
const lines = [];
|
|
39540
39548
|
for (const imp of imports) {
|
|
39541
|
-
|
|
39549
|
+
lines.push(formatImportLine(imp));
|
|
39542
39550
|
}
|
|
39543
39551
|
if (sourceImportNames.length > 0) {
|
|
39544
|
-
|
|
39552
|
+
lines.push(
|
|
39545
39553
|
`import { ${sourceImportNames.join(", ")} } from "${sourceRelativePath}";`
|
|
39546
39554
|
);
|
|
39547
39555
|
}
|
|
39548
|
-
if (
|
|
39556
|
+
if (lines.length > 0) lines.push("");
|
|
39549
39557
|
for (let i = 0; i < functionTexts.length; i++) {
|
|
39550
|
-
if (i > 0)
|
|
39551
|
-
|
|
39558
|
+
if (i > 0) lines.push("");
|
|
39559
|
+
lines.push(functionTexts[i]);
|
|
39552
39560
|
}
|
|
39553
|
-
|
|
39554
|
-
return
|
|
39561
|
+
lines.push("");
|
|
39562
|
+
return lines.join("\n");
|
|
39555
39563
|
}
|
|
39556
39564
|
|
|
39557
39565
|
// src/commands/refactor/extract/getRelativeImportPath.ts
|
|
@@ -40226,9 +40234,9 @@ function groupReferences(symbol, cwd) {
|
|
|
40226
40234
|
const grouped = /* @__PURE__ */ new Map();
|
|
40227
40235
|
for (const ref of refs) {
|
|
40228
40236
|
const refFile = path64.relative(cwd, ref.getSourceFile().getFilePath());
|
|
40229
|
-
const
|
|
40230
|
-
if (!grouped.has(refFile)) grouped.set(refFile,
|
|
40231
|
-
|
|
40237
|
+
const lines = grouped.get(refFile) ?? [];
|
|
40238
|
+
if (!grouped.has(refFile)) grouped.set(refFile, lines);
|
|
40239
|
+
lines.push(ref.getStartLineNumber());
|
|
40232
40240
|
}
|
|
40233
40241
|
return grouped;
|
|
40234
40242
|
}
|
|
@@ -40248,9 +40256,9 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
|
|
|
40248
40256
|
chalk241.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
|
|
40249
40257
|
`)
|
|
40250
40258
|
);
|
|
40251
|
-
for (const [refFile,
|
|
40259
|
+
for (const [refFile, lines] of grouped) {
|
|
40252
40260
|
console.log(
|
|
40253
|
-
` ${chalk241.dim(refFile)}: lines ${chalk241.cyan(
|
|
40261
|
+
` ${chalk241.dim(refFile)}: lines ${chalk241.cyan(lines.join(", "))}`
|
|
40254
40262
|
);
|
|
40255
40263
|
}
|
|
40256
40264
|
if (options2.apply) {
|
|
@@ -40879,23 +40887,23 @@ function insert(root2, parts) {
|
|
|
40879
40887
|
node = child;
|
|
40880
40888
|
}
|
|
40881
40889
|
}
|
|
40882
|
-
function render(node, indent4,
|
|
40890
|
+
function render(node, indent4, lines) {
|
|
40883
40891
|
const entries = [...node].sort(([a, ca], [b, cb]) => {
|
|
40884
40892
|
const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
|
|
40885
40893
|
return dirFirst || a.localeCompare(b);
|
|
40886
40894
|
});
|
|
40887
40895
|
for (const [name, child] of entries) {
|
|
40888
|
-
|
|
40889
|
-
render(child, `${indent4} `,
|
|
40896
|
+
lines.push(`${indent4}${name}${child.size > 0 ? "/" : ""}`);
|
|
40897
|
+
render(child, `${indent4} `, lines);
|
|
40890
40898
|
}
|
|
40891
40899
|
}
|
|
40892
40900
|
function formatTree(files, scopeRoot) {
|
|
40893
40901
|
const root2 = /* @__PURE__ */ new Map();
|
|
40894
40902
|
for (const file of files)
|
|
40895
40903
|
insert(root2, path82.relative(scopeRoot, file).split(path82.sep));
|
|
40896
|
-
const
|
|
40897
|
-
render(root2, "",
|
|
40898
|
-
return
|
|
40904
|
+
const lines = [];
|
|
40905
|
+
render(root2, "", lines);
|
|
40906
|
+
return lines;
|
|
40899
40907
|
}
|
|
40900
40908
|
|
|
40901
40909
|
// src/commands/refactor/restructure/displayPlan.ts
|
|
@@ -41473,16 +41481,16 @@ ${line}`;
|
|
|
41473
41481
|
// src/commands/review/highLevel/capPatchToBudget.ts
|
|
41474
41482
|
function capPatchToBudget(patch2, budget) {
|
|
41475
41483
|
const kept = [];
|
|
41476
|
-
let
|
|
41484
|
+
let lines = 0;
|
|
41477
41485
|
for (const hunk of hunksOf(patch2)) {
|
|
41478
41486
|
const size = hunk.split("\n").length;
|
|
41479
|
-
if (
|
|
41487
|
+
if (lines + size > budget)
|
|
41480
41488
|
return {
|
|
41481
41489
|
...kept.length > 0 ? { patch: kept.join("\n") } : {},
|
|
41482
41490
|
truncated: true
|
|
41483
41491
|
};
|
|
41484
41492
|
kept.push(hunk);
|
|
41485
|
-
|
|
41493
|
+
lines += size;
|
|
41486
41494
|
}
|
|
41487
41495
|
return { patch: patch2, truncated: false };
|
|
41488
41496
|
}
|
|
@@ -42049,18 +42057,18 @@ function gatherHighLevelSlices(head, files, slicing) {
|
|
|
42049
42057
|
// src/commands/review/highLevel/testChangeExcerpts.ts
|
|
42050
42058
|
var CONTEXT_LINES = 3;
|
|
42051
42059
|
function testChangeExcerpts(source, line, changedLines2) {
|
|
42052
|
-
const
|
|
42060
|
+
const lines = source.split("\n");
|
|
42053
42061
|
const windows = [];
|
|
42054
42062
|
for (const changed of [...changedLines2].sort((a, b) => a - b)) {
|
|
42055
42063
|
const start2 = Math.max(0, changed - line - CONTEXT_LINES);
|
|
42056
|
-
const end = Math.min(
|
|
42064
|
+
const end = Math.min(lines.length - 1, changed - line + CONTEXT_LINES);
|
|
42057
42065
|
const last = windows.at(-1);
|
|
42058
42066
|
if (last && start2 <= last.end + 1) last.end = Math.max(last.end, end);
|
|
42059
42067
|
else windows.push({ start: start2, end });
|
|
42060
42068
|
}
|
|
42061
42069
|
return windows.map(({ start: start2, end }) => ({
|
|
42062
42070
|
line: line + start2,
|
|
42063
|
-
source:
|
|
42071
|
+
source: lines.slice(start2, end + 1).join("\n")
|
|
42064
42072
|
}));
|
|
42065
42073
|
}
|
|
42066
42074
|
|
|
@@ -42069,9 +42077,9 @@ var MAX_TEST_SOURCE_LINES = 200;
|
|
|
42069
42077
|
function shownForm(test) {
|
|
42070
42078
|
const { source, changedLines: changedLines2, ...rest } = test;
|
|
42071
42079
|
if (source === void 0) return void 0;
|
|
42072
|
-
const
|
|
42073
|
-
if (
|
|
42074
|
-
return { lines
|
|
42080
|
+
const lines = lineCount(source);
|
|
42081
|
+
if (lines <= MAX_TEST_SOURCE_LINES)
|
|
42082
|
+
return { lines, shown: { ...rest, source } };
|
|
42075
42083
|
if (!changedLines2) return void 0;
|
|
42076
42084
|
const excerpts = testChangeExcerpts(source, test.line, changedLines2);
|
|
42077
42085
|
const excerptLines = excerpts.reduce(
|
|
@@ -42169,14 +42177,14 @@ function dedentedSource(call) {
|
|
|
42169
42177
|
// src/commands/review/highLevel/visitCase.ts
|
|
42170
42178
|
function visitCase(call, context) {
|
|
42171
42179
|
if (!context.changed) return [toCase(call, context)];
|
|
42172
|
-
const
|
|
42173
|
-
if (
|
|
42180
|
+
const lines = changedLines(call, context.changed);
|
|
42181
|
+
if (lines.length === 0) return [];
|
|
42174
42182
|
const total2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
|
|
42175
42183
|
return [
|
|
42176
42184
|
toCase(
|
|
42177
42185
|
call,
|
|
42178
42186
|
context,
|
|
42179
|
-
|
|
42187
|
+
lines.length === total2 ? { change: "added" } : { change: "modified", changedLines: lines }
|
|
42180
42188
|
)
|
|
42181
42189
|
];
|
|
42182
42190
|
}
|
|
@@ -42192,10 +42200,10 @@ function toCase(call, context, change = {}) {
|
|
|
42192
42200
|
};
|
|
42193
42201
|
}
|
|
42194
42202
|
function changedLines(call, changed) {
|
|
42195
|
-
const
|
|
42203
|
+
const lines = [];
|
|
42196
42204
|
for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
|
|
42197
|
-
if (changed.has(line))
|
|
42198
|
-
return
|
|
42205
|
+
if (changed.has(line)) lines.push(line);
|
|
42206
|
+
return lines;
|
|
42199
42207
|
}
|
|
42200
42208
|
|
|
42201
42209
|
// src/commands/review/highLevel/extractTestHierarchy.ts
|
|
@@ -42541,8 +42549,8 @@ function formatReviewComment({
|
|
|
42541
42549
|
quote,
|
|
42542
42550
|
note
|
|
42543
42551
|
}) {
|
|
42544
|
-
const
|
|
42545
|
-
return `- \`${path109}:${
|
|
42552
|
+
const lines = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
|
|
42553
|
+
return `- \`${path109}:${lines}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
|
|
42546
42554
|
}
|
|
42547
42555
|
|
|
42548
42556
|
// src/commands/review/highLevel/formatHighLevelReviewBody.ts
|
|
@@ -42557,8 +42565,8 @@ function formatItem(item) {
|
|
|
42557
42565
|
return `- ${statusMarkers[item.status]} **${item.title}** \u2014 ${comment3}`;
|
|
42558
42566
|
}
|
|
42559
42567
|
function findings(items3) {
|
|
42560
|
-
const
|
|
42561
|
-
return
|
|
42568
|
+
const lines = items3.map(formatItem).filter((line) => line !== void 0);
|
|
42569
|
+
return lines.length > 0 ? lines.join("\n") : void 0;
|
|
42562
42570
|
}
|
|
42563
42571
|
function sliceSections(items3) {
|
|
42564
42572
|
const bySlice = /* @__PURE__ */ new Map();
|
|
@@ -42566,12 +42574,12 @@ function sliceSections(items3) {
|
|
|
42566
42574
|
if (item.slice !== void 0)
|
|
42567
42575
|
bySlice.set(item.slice, [...bySlice.get(item.slice) ?? [], item]);
|
|
42568
42576
|
return [...bySlice].flatMap(([number, sliceItems]) => {
|
|
42569
|
-
const
|
|
42570
|
-
if (!
|
|
42577
|
+
const lines = findings(sliceItems);
|
|
42578
|
+
if (!lines) return [];
|
|
42571
42579
|
const title = sliceItems[0]?.sliceTitle;
|
|
42572
42580
|
return [`**Slice ${number}${title ? `: ${title}` : ""}**
|
|
42573
42581
|
|
|
42574
|
-
${
|
|
42582
|
+
${lines}`];
|
|
42575
42583
|
});
|
|
42576
42584
|
}
|
|
42577
42585
|
function formatHighLevelReviewBody(items3, reviewComments2 = []) {
|
|
@@ -43024,14 +43032,14 @@ function createReviewLogSink() {
|
|
|
43024
43032
|
attach(reviewDir) {
|
|
43025
43033
|
mkdirSync30(reviewDir, { recursive: true });
|
|
43026
43034
|
logPath2 = join93(reviewDir, LOG_FILE);
|
|
43027
|
-
const
|
|
43035
|
+
const lines = [
|
|
43028
43036
|
"",
|
|
43029
43037
|
`=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
|
|
43030
43038
|
`$ ${process.argv.slice(1).join(" ")}`,
|
|
43031
43039
|
...buffered
|
|
43032
43040
|
];
|
|
43033
43041
|
buffered = [];
|
|
43034
|
-
appendFileSync3(logPath2, `${
|
|
43042
|
+
appendFileSync3(logPath2, `${lines.join("\n")}
|
|
43035
43043
|
`);
|
|
43036
43044
|
}
|
|
43037
43045
|
};
|
|
@@ -43483,8 +43491,8 @@ function indent3(text20) {
|
|
|
43483
43491
|
return text20.split(/\r?\n/).map((line) => ` ${line}`);
|
|
43484
43492
|
}
|
|
43485
43493
|
function tailLines(text20, maxLines) {
|
|
43486
|
-
const
|
|
43487
|
-
return
|
|
43494
|
+
const lines = text20.split(/\r?\n/);
|
|
43495
|
+
return lines.length <= maxLines ? text20 : lines.slice(-maxLines).join("\n");
|
|
43488
43496
|
}
|
|
43489
43497
|
function isFastFail(input) {
|
|
43490
43498
|
return input.exitCode !== 0 && input.elapsedMs !== void 0 && input.elapsedMs < FAST_FAIL_MS;
|
|
@@ -43935,13 +43943,13 @@ function summariseSynthesis(markdown) {
|
|
|
43935
43943
|
return { summary: extractSummary(markdown), totals, findingCount };
|
|
43936
43944
|
}
|
|
43937
43945
|
function formatSynthesisSummary(summary) {
|
|
43938
|
-
const
|
|
43946
|
+
const lines = [];
|
|
43939
43947
|
const { totals, findingCount } = summary;
|
|
43940
|
-
|
|
43948
|
+
lines.push(
|
|
43941
43949
|
`Findings: ${findingCount} (blocker ${totals.blocker}, major ${totals.major}, minor ${totals.minor}, nit ${totals.nit})`
|
|
43942
43950
|
);
|
|
43943
|
-
if (summary.summary)
|
|
43944
|
-
return
|
|
43951
|
+
if (summary.summary) lines.push("", summary.summary);
|
|
43952
|
+
return lines.join("\n");
|
|
43945
43953
|
}
|
|
43946
43954
|
|
|
43947
43955
|
// src/commands/review/buildReviewSummary.ts
|
|
@@ -43960,26 +43968,26 @@ function formatLocation(finding) {
|
|
|
43960
43968
|
return `\`${location}\``;
|
|
43961
43969
|
}
|
|
43962
43970
|
function formatUnanchoredFinding(finding) {
|
|
43963
|
-
const
|
|
43971
|
+
const lines = [
|
|
43964
43972
|
`${formatFindingLine(finding)} \u2014 ${formatLocation(finding)}`,
|
|
43965
43973
|
` - Not anchored: ${UNANCHOR_REASONS[finding.reason]}`
|
|
43966
43974
|
];
|
|
43967
|
-
if (finding.impact)
|
|
43975
|
+
if (finding.impact) lines.push(` - Impact: ${finding.impact}`);
|
|
43968
43976
|
if (finding.recommendation)
|
|
43969
|
-
|
|
43970
|
-
return
|
|
43977
|
+
lines.push(` - Recommendation: ${finding.recommendation}`);
|
|
43978
|
+
return lines;
|
|
43971
43979
|
}
|
|
43972
43980
|
function buildReviewSummary(markdown, unanchored = []) {
|
|
43973
43981
|
const summary = summariseSynthesis(markdown);
|
|
43974
43982
|
const findings2 = parseFindings(markdown);
|
|
43975
|
-
const
|
|
43983
|
+
const lines = ["## Code review summary", "", formatSynthesisSummary(summary)];
|
|
43976
43984
|
if (findings2.length > 0) {
|
|
43977
|
-
|
|
43978
|
-
for (const finding of findings2)
|
|
43985
|
+
lines.push("", "### Findings", "");
|
|
43986
|
+
for (const finding of findings2) lines.push(formatFindingLine(finding));
|
|
43979
43987
|
}
|
|
43980
43988
|
const carried = carriedUnanchoredFindings(unanchored);
|
|
43981
43989
|
if (carried.length > 0) {
|
|
43982
|
-
|
|
43990
|
+
lines.push(
|
|
43983
43991
|
"",
|
|
43984
43992
|
"### Findings not anchored to the diff",
|
|
43985
43993
|
"",
|
|
@@ -43987,9 +43995,9 @@ function buildReviewSummary(markdown, unanchored = []) {
|
|
|
43987
43995
|
""
|
|
43988
43996
|
);
|
|
43989
43997
|
for (const finding of carried)
|
|
43990
|
-
|
|
43998
|
+
lines.push(...formatUnanchoredFinding(finding));
|
|
43991
43999
|
}
|
|
43992
|
-
return
|
|
44000
|
+
return lines.join("\n");
|
|
43993
44001
|
}
|
|
43994
44002
|
|
|
43995
44003
|
// src/commands/review/buildSynthesisStdin.ts
|
|
@@ -44257,12 +44265,12 @@ function headerFor(c) {
|
|
|
44257
44265
|
return tags ? `### ${location} [${tags}]` : `### ${location}`;
|
|
44258
44266
|
}
|
|
44259
44267
|
function formatThread(thread) {
|
|
44260
|
-
const
|
|
44268
|
+
const lines = [
|
|
44261
44269
|
headerFor(thread.root),
|
|
44262
44270
|
`**${thread.root.author}**: ${thread.root.body.trim()}`,
|
|
44263
44271
|
...thread.replies.map((r) => `**${r.author}** (reply): ${r.body.trim()}`)
|
|
44264
44272
|
];
|
|
44265
|
-
return
|
|
44273
|
+
return lines.join("\n\n");
|
|
44266
44274
|
}
|
|
44267
44275
|
var INTRO = `The PR already has the review comments below (including resolved and outdated threads). Avoid re-raising findings that a prior comment substantively covers.`;
|
|
44268
44276
|
function formatPriorComments(comments3) {
|
|
@@ -44541,13 +44549,13 @@ function sanitiseReviewerNames(value) {
|
|
|
44541
44549
|
|
|
44542
44550
|
// src/commands/review/postFindings.ts
|
|
44543
44551
|
function buildCommentBody(finding) {
|
|
44544
|
-
const
|
|
44552
|
+
const lines = [];
|
|
44545
44553
|
const severityLabel = finding.severity ?? "finding";
|
|
44546
|
-
|
|
44547
|
-
if (finding.impact)
|
|
44554
|
+
lines.push(`**${severityLabel}: ${finding.title}**`);
|
|
44555
|
+
if (finding.impact) lines.push("", `Impact: ${finding.impact}`);
|
|
44548
44556
|
if (finding.recommendation)
|
|
44549
|
-
|
|
44550
|
-
return sanitiseReviewerNames(
|
|
44557
|
+
lines.push("", `Recommendation: ${finding.recommendation}`);
|
|
44558
|
+
return sanitiseReviewerNames(lines.join("\n"));
|
|
44551
44559
|
}
|
|
44552
44560
|
async function postFindings(findings2) {
|
|
44553
44561
|
let posted = 0;
|
|
@@ -44725,10 +44733,10 @@ function buildDiffLineIndex(diff3) {
|
|
|
44725
44733
|
|
|
44726
44734
|
// src/commands/review/partitionFindingsByDiff.ts
|
|
44727
44735
|
function isWithinDiff(finding, index3) {
|
|
44728
|
-
const
|
|
44729
|
-
if (!
|
|
44730
|
-
if (!
|
|
44731
|
-
if (finding.startLine !== void 0 && !
|
|
44736
|
+
const lines = index3.get(finding.file);
|
|
44737
|
+
if (!lines) return false;
|
|
44738
|
+
if (!lines.has(finding.line)) return false;
|
|
44739
|
+
if (finding.startLine !== void 0 && !lines.has(finding.startLine)) {
|
|
44732
44740
|
return false;
|
|
44733
44741
|
}
|
|
44734
44742
|
return true;
|
|
@@ -45249,29 +45257,29 @@ function pointerLine(directories) {
|
|
|
45249
45257
|
return `${POINTER_PREFIX} ${directories.map((dir) => `\`${dir}\``).join(", ")}`;
|
|
45250
45258
|
}
|
|
45251
45259
|
function upsertScopedRulesPointer(content, directories) {
|
|
45252
|
-
const
|
|
45253
|
-
const range = rulesSectionRange(
|
|
45254
|
-
const existing =
|
|
45260
|
+
const lines = contentLines(content);
|
|
45261
|
+
const range = rulesSectionRange(lines);
|
|
45262
|
+
const existing = lines.findIndex(
|
|
45255
45263
|
(line, index3) => range !== void 0 && index3 > range.start && index3 < range.end && line.startsWith(POINTER_PREFIX)
|
|
45256
45264
|
);
|
|
45257
45265
|
if (directories.length === 0) {
|
|
45258
45266
|
if (existing === -1) return content;
|
|
45259
|
-
const without = [...
|
|
45267
|
+
const without = [...lines.slice(0, existing), ...lines.slice(existing + 1)];
|
|
45260
45268
|
return `${without.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd()}
|
|
45261
45269
|
`;
|
|
45262
45270
|
}
|
|
45263
45271
|
const pointer = pointerLine(directories);
|
|
45264
45272
|
if (existing !== -1) {
|
|
45265
|
-
if (
|
|
45266
|
-
const replaced = [...
|
|
45273
|
+
if (lines[existing] === pointer) return content;
|
|
45274
|
+
const replaced = [...lines];
|
|
45267
45275
|
replaced[existing] = pointer;
|
|
45268
45276
|
return `${replaced.join("\n")}
|
|
45269
45277
|
`;
|
|
45270
45278
|
}
|
|
45271
|
-
if (!range) return appendRulesSection(
|
|
45279
|
+
if (!range) return appendRulesSection(lines, pointer);
|
|
45272
45280
|
let at2 = range.end;
|
|
45273
|
-
while (at2 > range.start + 1 && (
|
|
45274
|
-
return `${[...
|
|
45281
|
+
while (at2 > range.start + 1 && (lines[at2 - 1] ?? "").trim() === "") at2--;
|
|
45282
|
+
return `${[...lines.slice(0, at2), "", pointer, ...lines.slice(at2)].join("\n")}
|
|
45275
45283
|
`;
|
|
45276
45284
|
}
|
|
45277
45285
|
|
|
@@ -45342,17 +45350,17 @@ function ruleBullet({ code, title, text: text20 }) {
|
|
|
45342
45350
|
}
|
|
45343
45351
|
function insertRuleBullet(content, rule) {
|
|
45344
45352
|
const bullet = ruleBullet(rule);
|
|
45345
|
-
const
|
|
45346
|
-
const range = rulesSectionRange(
|
|
45347
|
-
if (!range) return appendRulesSection(
|
|
45348
|
-
const body =
|
|
45353
|
+
const lines = contentLines(content);
|
|
45354
|
+
const range = rulesSectionRange(lines);
|
|
45355
|
+
if (!range) return appendRulesSection(lines, bullet);
|
|
45356
|
+
const body = lines.slice(range.start + 1, range.end);
|
|
45349
45357
|
const lastBullet = body.reduce(
|
|
45350
45358
|
(last, line, index3) => RULE_BULLET.test(line) ? index3 : last,
|
|
45351
45359
|
-1
|
|
45352
45360
|
);
|
|
45353
45361
|
const at2 = lastBullet === -1 ? range.start + 1 : range.start + lastBullet + 2;
|
|
45354
45362
|
const inserted = lastBullet === -1 ? ["", bullet] : [bullet];
|
|
45355
|
-
return `${[...
|
|
45363
|
+
return `${[...lines.slice(0, at2), ...inserted, ...lines.slice(at2)].join("\n")}
|
|
45356
45364
|
`;
|
|
45357
45365
|
}
|
|
45358
45366
|
|
|
@@ -45693,13 +45701,13 @@ function formatEvent(event) {
|
|
|
45693
45701
|
const abbrev = levelAbbrev(event.Level);
|
|
45694
45702
|
const ts10 = chalk271.dim(formatTimestamp(event.Timestamp));
|
|
45695
45703
|
const msg = renderMessage(event);
|
|
45696
|
-
const
|
|
45704
|
+
const lines = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
|
|
45697
45705
|
if (event.Exception) {
|
|
45698
45706
|
for (const line of event.Exception.split("\n")) {
|
|
45699
|
-
|
|
45707
|
+
lines.push(chalk271.red(` ${line}`));
|
|
45700
45708
|
}
|
|
45701
45709
|
}
|
|
45702
|
-
return
|
|
45710
|
+
return lines.join("\n");
|
|
45703
45711
|
}
|
|
45704
45712
|
|
|
45705
45713
|
// src/commands/seq/parseRelativeTime.ts
|
|
@@ -47238,13 +47246,13 @@ function extractSpeaker(fullText) {
|
|
|
47238
47246
|
function isTextLine(line) {
|
|
47239
47247
|
return !!line.trim() && !line.includes("-->");
|
|
47240
47248
|
}
|
|
47241
|
-
function scanTextLines(
|
|
47249
|
+
function scanTextLines(lines, start2) {
|
|
47242
47250
|
let i = start2;
|
|
47243
|
-
while (i <
|
|
47244
|
-
return { texts:
|
|
47251
|
+
while (i < lines.length && isTextLine(lines[i])) i++;
|
|
47252
|
+
return { texts: lines.slice(start2, i).map((l) => l.trim()), end: i };
|
|
47245
47253
|
}
|
|
47246
|
-
function collectTextLines(
|
|
47247
|
-
const { texts, end } = scanTextLines(
|
|
47254
|
+
function collectTextLines(lines, startIndex) {
|
|
47255
|
+
const { texts, end } = scanTextLines(lines, startIndex);
|
|
47248
47256
|
return { text: texts.join(" "), nextIndex: end };
|
|
47249
47257
|
}
|
|
47250
47258
|
function parseTimestampLine(line) {
|
|
@@ -47255,30 +47263,30 @@ function buildCue(startMs, endMs, fullText) {
|
|
|
47255
47263
|
const { speaker, text: text20 } = extractSpeaker(fullText);
|
|
47256
47264
|
return text20 ? { startMs, endMs, speaker, text: text20 } : null;
|
|
47257
47265
|
}
|
|
47258
|
-
function parseCueLine(
|
|
47259
|
-
const { startMs, endMs } = parseTimestampLine(
|
|
47260
|
-
const { text: text20, nextIndex: nextIndex2 } = collectTextLines(
|
|
47266
|
+
function parseCueLine(lines, i) {
|
|
47267
|
+
const { startMs, endMs } = parseTimestampLine(lines[i]);
|
|
47268
|
+
const { text: text20, nextIndex: nextIndex2 } = collectTextLines(lines, i + 1);
|
|
47261
47269
|
return { cue: buildCue(startMs, endMs, text20), nextIndex: nextIndex2 };
|
|
47262
47270
|
}
|
|
47263
47271
|
function isCueSeparator(line) {
|
|
47264
47272
|
return line.trim().includes("-->");
|
|
47265
47273
|
}
|
|
47266
|
-
function skipHeader(
|
|
47274
|
+
function skipHeader(lines) {
|
|
47267
47275
|
let i = 0;
|
|
47268
|
-
while (i <
|
|
47276
|
+
while (i < lines.length && !isCueSeparator(lines[i])) i++;
|
|
47269
47277
|
return i;
|
|
47270
47278
|
}
|
|
47271
|
-
function processLine(cues,
|
|
47272
|
-
if (!isCueSeparator(
|
|
47273
|
-
const { cue, nextIndex: nextIndex2 } = parseCueLine(
|
|
47279
|
+
function processLine(cues, lines, i) {
|
|
47280
|
+
if (!isCueSeparator(lines[i])) return i + 1;
|
|
47281
|
+
const { cue, nextIndex: nextIndex2 } = parseCueLine(lines, i);
|
|
47274
47282
|
if (cue) cues.push(cue);
|
|
47275
47283
|
return nextIndex2;
|
|
47276
47284
|
}
|
|
47277
47285
|
function parseVtt(content) {
|
|
47278
47286
|
const cues = [];
|
|
47279
|
-
const
|
|
47280
|
-
let i = skipHeader(
|
|
47281
|
-
while (i <
|
|
47287
|
+
const lines = content.split(/\r?\n/);
|
|
47288
|
+
let i = skipHeader(lines);
|
|
47289
|
+
while (i < lines.length) i = processLine(cues, lines, i);
|
|
47282
47290
|
return cues;
|
|
47283
47291
|
}
|
|
47284
47292
|
|
|
@@ -47313,8 +47321,8 @@ function formatCue(cue) {
|
|
|
47313
47321
|
return `${timing}
|
|
47314
47322
|
${text20}`;
|
|
47315
47323
|
}
|
|
47316
|
-
function formatNoteBlock(
|
|
47317
|
-
return
|
|
47324
|
+
function formatNoteBlock(lines) {
|
|
47325
|
+
return lines.length ? [lines.map((line) => `NOTE ${line}`).join("\n")] : [];
|
|
47318
47326
|
}
|
|
47319
47327
|
function formatPassage(passage, sourceMarks) {
|
|
47320
47328
|
return [
|
|
@@ -47826,9 +47834,9 @@ function collectBicepComments(content) {
|
|
|
47826
47834
|
comments3.push({ line, text: match });
|
|
47827
47835
|
return blankNonNewline3(match);
|
|
47828
47836
|
});
|
|
47829
|
-
const
|
|
47830
|
-
for (let i = 0; i <
|
|
47831
|
-
const match =
|
|
47837
|
+
const lines = work.split("\n");
|
|
47838
|
+
for (let i = 0; i < lines.length; i++) {
|
|
47839
|
+
const match = lines[i].match(LINE_COMMENT);
|
|
47832
47840
|
if (match) comments3.push({ line: i + 1, text: match[0] });
|
|
47833
47841
|
}
|
|
47834
47842
|
return comments3;
|
|
@@ -47839,11 +47847,11 @@ function closesBlock(trimmed, from) {
|
|
|
47839
47847
|
return trimmed.includes("*/", from);
|
|
47840
47848
|
}
|
|
47841
47849
|
function csharpHeaderLineCount(content) {
|
|
47842
|
-
const
|
|
47850
|
+
const lines = content.split("\n");
|
|
47843
47851
|
let count10 = 0;
|
|
47844
47852
|
let inBlock = false;
|
|
47845
|
-
while (count10 <
|
|
47846
|
-
const trimmed =
|
|
47853
|
+
while (count10 < lines.length) {
|
|
47854
|
+
const trimmed = lines[count10].trim();
|
|
47847
47855
|
if (inBlock) {
|
|
47848
47856
|
inBlock = !closesBlock(trimmed, 0);
|
|
47849
47857
|
} else if (trimmed.startsWith("/*")) {
|
|
@@ -47873,14 +47881,14 @@ function isHeaderLine2(line) {
|
|
|
47873
47881
|
return trimmed === "" || trimmed.startsWith("#");
|
|
47874
47882
|
}
|
|
47875
47883
|
function collectHashComments(content, options2) {
|
|
47876
|
-
const
|
|
47884
|
+
const lines = content.split("\n");
|
|
47877
47885
|
let start2 = 0;
|
|
47878
47886
|
if (options2.skipHeader) {
|
|
47879
|
-
while (start2 <
|
|
47887
|
+
while (start2 < lines.length && isHeaderLine2(lines[start2])) start2++;
|
|
47880
47888
|
}
|
|
47881
47889
|
const comments3 = [];
|
|
47882
|
-
for (let i = start2; i <
|
|
47883
|
-
const work =
|
|
47890
|
+
for (let i = start2; i < lines.length; i++) {
|
|
47891
|
+
const work = lines[i].replace(
|
|
47884
47892
|
/"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'/g,
|
|
47885
47893
|
blankNonNewline4
|
|
47886
47894
|
);
|
|
@@ -47914,12 +47922,12 @@ function collectComments(sourceFile) {
|
|
|
47914
47922
|
function toSingleLine(text20) {
|
|
47915
47923
|
return text20.replace(/\s+/g, " ").trim();
|
|
47916
47924
|
}
|
|
47917
|
-
function collectSourceFindings(file,
|
|
47925
|
+
function collectSourceFindings(file, lines, project) {
|
|
47918
47926
|
const findings2 = [];
|
|
47919
47927
|
const sourceFile = project.addSourceFileAtPath(file);
|
|
47920
47928
|
for (const { pos, text: text20 } of collectComments(sourceFile)) {
|
|
47921
47929
|
const { line } = sourceFile.getLineAndColumnAtPos(pos);
|
|
47922
|
-
if (!
|
|
47930
|
+
if (!lines.has(line)) continue;
|
|
47923
47931
|
if (isCommentExempt(text20)) continue;
|
|
47924
47932
|
findings2.push({ file, line, text: toSingleLine(text20) });
|
|
47925
47933
|
}
|
|
@@ -47939,10 +47947,10 @@ function collectYamlComments(content) {
|
|
|
47939
47947
|
}
|
|
47940
47948
|
|
|
47941
47949
|
// src/commands/verify/blockCodeComments/toFindings.ts
|
|
47942
|
-
function toFindings(file,
|
|
47950
|
+
function toFindings(file, lines, raw, exempt) {
|
|
47943
47951
|
const findings2 = [];
|
|
47944
47952
|
for (const { line, text: text20 } of raw) {
|
|
47945
|
-
if (!
|
|
47953
|
+
if (!lines.has(line)) continue;
|
|
47946
47954
|
if (exempt && isCommentExempt(text20)) continue;
|
|
47947
47955
|
findings2.push({ file, line, text: text20.replace(/\s+/g, " ").trim() });
|
|
47948
47956
|
}
|
|
@@ -47950,29 +47958,29 @@ function toFindings(file, lines2, raw, exempt) {
|
|
|
47950
47958
|
}
|
|
47951
47959
|
|
|
47952
47960
|
// src/commands/verify/blockCodeComments/collectFileComments.ts
|
|
47953
|
-
function collectFileComments(file,
|
|
47961
|
+
function collectFileComments(file, lines, project) {
|
|
47954
47962
|
const read4 = () => fs50.readFileSync(file, "utf8");
|
|
47955
47963
|
if (isYamlFile(file))
|
|
47956
|
-
return toFindings(file,
|
|
47964
|
+
return toFindings(file, lines, collectYamlComments(read4()), false);
|
|
47957
47965
|
if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
|
|
47958
47966
|
return toFindings(
|
|
47959
47967
|
file,
|
|
47960
|
-
|
|
47968
|
+
lines,
|
|
47961
47969
|
collectHashComments(read4(), { skipHeader: isShellFile(file) }),
|
|
47962
47970
|
true
|
|
47963
47971
|
);
|
|
47964
47972
|
if (isBicepFile(file))
|
|
47965
|
-
return toFindings(file,
|
|
47973
|
+
return toFindings(file, lines, collectBicepComments(read4()), true);
|
|
47966
47974
|
if (isCsharpFile(file)) {
|
|
47967
47975
|
const content = read4();
|
|
47968
47976
|
if (isGeneratedCsharpFile(file, content)) return [];
|
|
47969
|
-
return toFindings(file,
|
|
47977
|
+
return toFindings(file, lines, collectCsharpComments(content), true);
|
|
47970
47978
|
}
|
|
47971
47979
|
if (isRazorFile(file))
|
|
47972
|
-
return toFindings(file,
|
|
47980
|
+
return toFindings(file, lines, extractRazorComments(read4()), true);
|
|
47973
47981
|
if (isRustFile(file))
|
|
47974
|
-
return toFindings(file,
|
|
47975
|
-
return collectSourceFindings(file,
|
|
47982
|
+
return toFindings(file, lines, extractRustComments(read4()), true);
|
|
47983
|
+
return collectSourceFindings(file, lines, project);
|
|
47976
47984
|
}
|
|
47977
47985
|
|
|
47978
47986
|
// src/commands/verify/blockCodeComments/parseDiffAddedLines.ts
|
|
@@ -48045,9 +48053,9 @@ function findComments(options2) {
|
|
|
48045
48053
|
compilerOptions: { allowJs: true }
|
|
48046
48054
|
});
|
|
48047
48055
|
const findings2 = [];
|
|
48048
|
-
for (const [file,
|
|
48056
|
+
for (const [file, lines] of addedLines) {
|
|
48049
48057
|
if (!shouldScan(file, options2.ignoreGlobs)) continue;
|
|
48050
|
-
findings2.push(...collectFileComments(file,
|
|
48058
|
+
findings2.push(...collectFileComments(file, lines, project));
|
|
48051
48059
|
}
|
|
48052
48060
|
findings2.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
|
|
48053
48061
|
return findings2;
|
|
@@ -48202,18 +48210,18 @@ function hardcodedColors() {
|
|
|
48202
48210
|
input: `${pattern}
|
|
48203
48211
|
`
|
|
48204
48212
|
});
|
|
48205
|
-
const
|
|
48213
|
+
const lines = output.trim().split("\n").filter((line) => {
|
|
48206
48214
|
const match = line.match(/^(.+?):\d+:/);
|
|
48207
48215
|
if (!match) return true;
|
|
48208
48216
|
const file = match[1];
|
|
48209
48217
|
return !ignoreGlobs.some((glob) => minimatch11(file, glob));
|
|
48210
48218
|
});
|
|
48211
|
-
if (
|
|
48219
|
+
if (lines.length === 0) {
|
|
48212
48220
|
console.log("No hardcoded colors found.");
|
|
48213
48221
|
process.exit(0);
|
|
48214
48222
|
}
|
|
48215
48223
|
console.log("Hardcoded colors found:\n");
|
|
48216
|
-
for (const line of
|
|
48224
|
+
for (const line of lines) {
|
|
48217
48225
|
const match = line.match(/^(.+):(\d+):(.+)$/);
|
|
48218
48226
|
if (match) {
|
|
48219
48227
|
const [, file, lineNum, content] = match;
|
|
@@ -48223,7 +48231,7 @@ function hardcodedColors() {
|
|
|
48223
48231
|
}
|
|
48224
48232
|
}
|
|
48225
48233
|
console.log(`
|
|
48226
|
-
Total: ${
|
|
48234
|
+
Total: ${lines.length} hardcoded color(s)`);
|
|
48227
48235
|
console.log("\nUse colors from the 'open-color' (oc) library instead.");
|
|
48228
48236
|
console.log("\nExample fix:");
|
|
48229
48237
|
console.log(" Before: color: '#228be6'");
|
|
@@ -48824,9 +48832,13 @@ function parseWatchDurations(interval, timeout) {
|
|
|
48824
48832
|
}
|
|
48825
48833
|
|
|
48826
48834
|
// src/commands/watch/readRecentCommits.ts
|
|
48827
|
-
function readRecentCommits(
|
|
48835
|
+
function readRecentCommits(from, cwd) {
|
|
48828
48836
|
const output = runGit3(
|
|
48829
|
-
[
|
|
48837
|
+
[
|
|
48838
|
+
"log",
|
|
48839
|
+
from ? `${from}..HEAD` : "-10",
|
|
48840
|
+
"--pretty=format:%H%x09%h%x09%ar%x09%s"
|
|
48841
|
+
],
|
|
48830
48842
|
cwd
|
|
48831
48843
|
);
|
|
48832
48844
|
if (!output) return [];
|
|
@@ -48841,32 +48853,30 @@ var escapeCell = (text20) => text20.replaceAll("|", String.raw`\|`);
|
|
|
48841
48853
|
function renderWatchReport({
|
|
48842
48854
|
version: version2,
|
|
48843
48855
|
commits: commits2,
|
|
48844
|
-
|
|
48856
|
+
pulled,
|
|
48845
48857
|
restarts,
|
|
48846
48858
|
syncs
|
|
48847
48859
|
}) {
|
|
48848
|
-
const
|
|
48849
|
-
const lines2 = [`**Version** ${version2}`, ""];
|
|
48860
|
+
const lines = [`**Version** ${version2}`, ""];
|
|
48850
48861
|
if (commits2.length === 0) {
|
|
48851
|
-
|
|
48862
|
+
lines.push(pulled ? "_no new commits_" : "_no commits_");
|
|
48852
48863
|
} else {
|
|
48853
|
-
|
|
48864
|
+
lines.push("| SHA | When | Subject |", "| --- | --- | --- |");
|
|
48854
48865
|
for (const commit2 of commits2) {
|
|
48855
|
-
|
|
48856
|
-
|
|
48857
|
-
`| \`${commit2.short}\` | ${commit2.when} | ${escapeCell(commit2.subject)}${marker2} |`
|
|
48866
|
+
lines.push(
|
|
48867
|
+
`| \`${commit2.short}\` | ${commit2.when} | ${escapeCell(commit2.subject)} |`
|
|
48858
48868
|
);
|
|
48859
48869
|
}
|
|
48860
48870
|
}
|
|
48861
|
-
|
|
48862
|
-
|
|
48871
|
+
lines.push("", "**Restarts**", "");
|
|
48872
|
+
lines.push(
|
|
48863
48873
|
...restarts.length === 0 ? ["- none needed"] : restarts.map((restart) => `- ${restart}`)
|
|
48864
48874
|
);
|
|
48865
|
-
|
|
48866
|
-
|
|
48875
|
+
lines.push("", "**Sync**", "");
|
|
48876
|
+
lines.push(
|
|
48867
48877
|
...syncs.length === 0 ? ["- not needed"] : syncs.map((sync2) => `- ${sync2}`)
|
|
48868
48878
|
);
|
|
48869
|
-
return
|
|
48879
|
+
return lines.join("\n");
|
|
48870
48880
|
}
|
|
48871
48881
|
|
|
48872
48882
|
// src/commands/watch/restartAdvice.ts
|
|
@@ -48906,13 +48916,12 @@ function syncAdvice(paths) {
|
|
|
48906
48916
|
}
|
|
48907
48917
|
|
|
48908
48918
|
// src/commands/watch/buildWatchReport.ts
|
|
48909
|
-
var lines = (output) => output.split("\n").filter((line) => line.length > 0);
|
|
48910
48919
|
function buildWatchReport(from, cwd) {
|
|
48911
48920
|
const changed = from ? changedPaths(from, cwd) : [];
|
|
48912
48921
|
return renderWatchReport({
|
|
48913
48922
|
version: readBuiltVersion(cwd),
|
|
48914
|
-
commits: readRecentCommits(
|
|
48915
|
-
|
|
48923
|
+
commits: readRecentCommits(from, cwd),
|
|
48924
|
+
pulled: Boolean(from),
|
|
48916
48925
|
restarts: restartAdvice(changed),
|
|
48917
48926
|
syncs: syncAdvice(changed)
|
|
48918
48927
|
});
|
|
@@ -50001,10 +50010,10 @@ function queryDaemon(socket) {
|
|
|
50001
50010
|
const result = { sessions: [] };
|
|
50002
50011
|
const pending2 = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
50003
50012
|
const timer = setTimeout(() => resolve34(result), STATUS_TIMEOUT_MS2);
|
|
50004
|
-
const
|
|
50005
|
-
|
|
50013
|
+
const lines = createInterface8({ input: socket });
|
|
50014
|
+
lines.on("error", () => {
|
|
50006
50015
|
});
|
|
50007
|
-
|
|
50016
|
+
lines.on("line", (line) => {
|
|
50008
50017
|
applyLine(result, pending2, line);
|
|
50009
50018
|
if (pending2.size === 0) {
|
|
50010
50019
|
clearTimeout(timer);
|
|
@@ -50107,11 +50116,11 @@ function clearPersistedSessionsOnDrain() {
|
|
|
50107
50116
|
}
|
|
50108
50117
|
|
|
50109
50118
|
// src/commands/sessions/daemon/readDaemonMessage.ts
|
|
50110
|
-
function readDaemonMessage(
|
|
50119
|
+
function readDaemonMessage(lines, timeoutMs, fallback, match) {
|
|
50111
50120
|
return new Promise((resolve34) => {
|
|
50112
50121
|
const finish2 = (value) => {
|
|
50113
50122
|
clearTimeout(timer);
|
|
50114
|
-
|
|
50123
|
+
lines.off("line", onLine);
|
|
50115
50124
|
resolve34(value);
|
|
50116
50125
|
};
|
|
50117
50126
|
const timer = setTimeout(() => finish2(fallback), timeoutMs);
|
|
@@ -50122,7 +50131,7 @@ function readDaemonMessage(lines2, timeoutMs, fallback, match) {
|
|
|
50122
50131
|
} catch {
|
|
50123
50132
|
}
|
|
50124
50133
|
};
|
|
50125
|
-
|
|
50134
|
+
lines.on("line", onLine);
|
|
50126
50135
|
});
|
|
50127
50136
|
}
|
|
50128
50137
|
|
|
@@ -50137,10 +50146,10 @@ async function drainDaemon(options2 = {}) {
|
|
|
50137
50146
|
clearPersistedSessionsOnDrain();
|
|
50138
50147
|
return;
|
|
50139
50148
|
}
|
|
50140
|
-
const
|
|
50141
|
-
|
|
50149
|
+
const lines = createInterface9({ input: socket });
|
|
50150
|
+
lines.on("error", () => {
|
|
50142
50151
|
});
|
|
50143
|
-
const live = await liveSessions(
|
|
50152
|
+
const live = await liveSessions(lines);
|
|
50144
50153
|
if (live.length > 0 && options2.yes !== true) {
|
|
50145
50154
|
reportLive(live);
|
|
50146
50155
|
if (!await confirmDrain()) {
|
|
@@ -50148,7 +50157,7 @@ async function drainDaemon(options2 = {}) {
|
|
|
50148
50157
|
return;
|
|
50149
50158
|
}
|
|
50150
50159
|
}
|
|
50151
|
-
const count10 = await requestDrain(socket,
|
|
50160
|
+
const count10 = await requestDrain(socket, lines);
|
|
50152
50161
|
socket.destroy();
|
|
50153
50162
|
console.log(`Drained ${count10} session(s)`);
|
|
50154
50163
|
}
|
|
@@ -50167,9 +50176,9 @@ async function confirmDrain() {
|
|
|
50167
50176
|
console.log("Drain cancelled");
|
|
50168
50177
|
return false;
|
|
50169
50178
|
}
|
|
50170
|
-
function liveSessions(
|
|
50179
|
+
function liveSessions(lines) {
|
|
50171
50180
|
return readDaemonMessage(
|
|
50172
|
-
|
|
50181
|
+
lines,
|
|
50173
50182
|
LIST_TIMEOUT_MS,
|
|
50174
50183
|
[],
|
|
50175
50184
|
(data) => data.type === "sessions" ? (data.sessions ?? []).filter(
|
|
@@ -50177,11 +50186,11 @@ function liveSessions(lines2) {
|
|
|
50177
50186
|
) : void 0
|
|
50178
50187
|
);
|
|
50179
50188
|
}
|
|
50180
|
-
function requestDrain(socket,
|
|
50189
|
+
function requestDrain(socket, lines) {
|
|
50181
50190
|
socket.write(`${JSON.stringify({ type: "drain" })}
|
|
50182
50191
|
`);
|
|
50183
50192
|
return readDaemonMessage(
|
|
50184
|
-
|
|
50193
|
+
lines,
|
|
50185
50194
|
DRAIN_TIMEOUT_MS,
|
|
50186
50195
|
0,
|
|
50187
50196
|
(data) => data.type === "drained" ? data.count ?? 0 : void 0
|
|
@@ -52090,9 +52099,9 @@ function escalateDivergence(ctx, cwd, output) {
|
|
|
52090
52099
|
function lineRecorder(onLine) {
|
|
52091
52100
|
let pending2 = "";
|
|
52092
52101
|
return (text20) => {
|
|
52093
|
-
const
|
|
52094
|
-
pending2 =
|
|
52095
|
-
for (const line of
|
|
52102
|
+
const lines = (pending2 + text20).split(/\r?\n|\r/);
|
|
52103
|
+
pending2 = lines.pop() ?? "";
|
|
52104
|
+
for (const line of lines) {
|
|
52096
52105
|
const clean2 = stripAnsi(line).trimEnd();
|
|
52097
52106
|
if (clean2.trim()) onLine(clean2);
|
|
52098
52107
|
}
|
|
@@ -53487,9 +53496,9 @@ function missingRunConfigCwd(session) {
|
|
|
53487
53496
|
var MAX_TAIL_LINES = 5;
|
|
53488
53497
|
var MAX_TAIL_CHARS = 500;
|
|
53489
53498
|
function exitOutputTail(scrollback) {
|
|
53490
|
-
const
|
|
53491
|
-
if (
|
|
53492
|
-
return
|
|
53499
|
+
const lines = stripAnsi(scrollback).split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
53500
|
+
if (lines.length === 0) return void 0;
|
|
53501
|
+
return lines.slice(-MAX_TAIL_LINES).join(" | ").slice(-MAX_TAIL_CHARS);
|
|
53493
53502
|
}
|
|
53494
53503
|
|
|
53495
53504
|
// src/commands/sessions/daemon/handleErroredExit.ts
|
|
@@ -54280,9 +54289,9 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
|
|
|
54280
54289
|
|
|
54281
54290
|
// src/commands/sessions/shared/transcriptUsage.ts
|
|
54282
54291
|
import * as fs54 from "fs";
|
|
54283
|
-
function transcriptUsage(
|
|
54292
|
+
function transcriptUsage(lines) {
|
|
54284
54293
|
const byId = /* @__PURE__ */ new Map();
|
|
54285
|
-
for (const line of
|
|
54294
|
+
for (const line of lines) {
|
|
54286
54295
|
if (!line.trim()) continue;
|
|
54287
54296
|
let entry;
|
|
54288
54297
|
try {
|
|
@@ -55377,6 +55386,8 @@ function errorSession(id, persisted, error) {
|
|
|
55377
55386
|
pty: null,
|
|
55378
55387
|
runName: persisted.runName,
|
|
55379
55388
|
runArgs: persisted.runArgs,
|
|
55389
|
+
claudeSessionId: persisted.claudeSessionId,
|
|
55390
|
+
activity: persisted.activity,
|
|
55380
55391
|
error,
|
|
55381
55392
|
restored: false
|
|
55382
55393
|
};
|
|
@@ -55794,6 +55805,12 @@ function restoreSession(id, persisted) {
|
|
|
55794
55805
|
if (persisted.awaitingSeed) return relaunchHeldSession(id, persisted);
|
|
55795
55806
|
const base = restoreBase(id, persisted);
|
|
55796
55807
|
if (persisted.status === "stopped") return stoppedSession(base, persisted);
|
|
55808
|
+
if (persisted.status === "error")
|
|
55809
|
+
return errorSession(
|
|
55810
|
+
id,
|
|
55811
|
+
persisted,
|
|
55812
|
+
persisted.error ?? "Session exited with an error"
|
|
55813
|
+
);
|
|
55797
55814
|
if (isUpdate(persisted)) return updatedSession(id, persisted);
|
|
55798
55815
|
const status2 = deriveRestoreStatus(persisted);
|
|
55799
55816
|
if (needsWrapperRelaunch(persisted)) {
|
|
@@ -55817,7 +55834,11 @@ function restoreSession(id, persisted) {
|
|
|
55817
55834
|
function restoreOne(persisted, spawner, sessions) {
|
|
55818
55835
|
try {
|
|
55819
55836
|
const id = spawner.spawn((sid) => restoreSession(sid, persisted));
|
|
55820
|
-
|
|
55837
|
+
if (persisted.status === "error")
|
|
55838
|
+
daemonLog(
|
|
55839
|
+
`restored errored session "${persisted.name}" (id ${id}) as its error card; restart resumes ${persisted.claudeSessionId ?? persisted.harnessSessionId ?? "fresh"}`
|
|
55840
|
+
);
|
|
55841
|
+
else logUnresumable(persisted.name, id, sessions.get(id));
|
|
55821
55842
|
return id;
|
|
55822
55843
|
} catch (error) {
|
|
55823
55844
|
const reason4 = logRestoreError(persisted, error);
|
|
@@ -55972,29 +55993,29 @@ async function describeHeldWork(path109, reason4) {
|
|
|
55972
55993
|
}
|
|
55973
55994
|
async function changedFiles(path109) {
|
|
55974
55995
|
const status2 = await gitResult(path109, ["status", "--porcelain"]);
|
|
55975
|
-
const
|
|
55996
|
+
const lines = status2.ok ? nonEmptyLines(status2.out) : [];
|
|
55976
55997
|
return {
|
|
55977
|
-
summary: `${
|
|
55978
|
-
items: capped2(
|
|
55998
|
+
summary: `${lines.length} uncommitted ${lines.length === 1 ? "file" : "files"}`,
|
|
55999
|
+
items: capped2(lines)
|
|
55979
56000
|
};
|
|
55980
56001
|
}
|
|
55981
56002
|
async function unpushedCommits(path109, reason4) {
|
|
55982
56003
|
const log2 = await gitResult(path109, ["log", "--oneline", "@{upstream}..HEAD"]);
|
|
55983
56004
|
if (!log2.ok) return { summary: reason4, items: [] };
|
|
55984
|
-
const
|
|
56005
|
+
const lines = nonEmptyLines(log2.out);
|
|
55985
56006
|
return {
|
|
55986
|
-
summary: `${
|
|
55987
|
-
items: capped2(
|
|
56007
|
+
summary: `${lines.length} unpushed ${lines.length === 1 ? "commit" : "commits"}`,
|
|
56008
|
+
items: capped2(lines)
|
|
55988
56009
|
};
|
|
55989
56010
|
}
|
|
55990
56011
|
function nonEmptyLines(out) {
|
|
55991
56012
|
return out.split("\n").map((line) => line.trim()).filter((line) => line !== "");
|
|
55992
56013
|
}
|
|
55993
|
-
function capped2(
|
|
55994
|
-
if (
|
|
56014
|
+
function capped2(lines) {
|
|
56015
|
+
if (lines.length <= MAX_ITEMS) return lines;
|
|
55995
56016
|
return [
|
|
55996
|
-
...
|
|
55997
|
-
`\u2026 and ${
|
|
56017
|
+
...lines.slice(0, MAX_ITEMS),
|
|
56018
|
+
`\u2026 and ${lines.length - MAX_ITEMS} more`
|
|
55998
56019
|
];
|
|
55999
56020
|
}
|
|
56000
56021
|
|
|
@@ -57771,9 +57792,9 @@ function condense(value) {
|
|
|
57771
57792
|
}
|
|
57772
57793
|
|
|
57773
57794
|
// src/commands/sessions/shared/codex/parseCodexTranscriptLines.ts
|
|
57774
|
-
function parseCodexTranscriptLines(
|
|
57795
|
+
function parseCodexTranscriptLines(lines) {
|
|
57775
57796
|
const messages2 = [];
|
|
57776
|
-
for (const line of
|
|
57797
|
+
for (const line of lines) {
|
|
57777
57798
|
const entry = line.trim() ? parseRolloutEntry(line) : null;
|
|
57778
57799
|
if (entry) messages2.push(...rolloutMessages(entry));
|
|
57779
57800
|
}
|
|
@@ -57991,11 +58012,11 @@ function toRateLimits(raw) {
|
|
|
57991
58012
|
}
|
|
57992
58013
|
|
|
57993
58014
|
// src/commands/sessions/shared/codex/codexRolloutUsage.ts
|
|
57994
|
-
function codexRolloutUsage(
|
|
58015
|
+
function codexRolloutUsage(lines) {
|
|
57995
58016
|
const usage = { responses: [] };
|
|
57996
58017
|
const byId = /* @__PURE__ */ new Map();
|
|
57997
58018
|
let conversationId = "";
|
|
57998
|
-
for (const line of
|
|
58019
|
+
for (const line of lines) {
|
|
57999
58020
|
const entry = parseRolloutEntry(line);
|
|
58000
58021
|
if (!entry) continue;
|
|
58001
58022
|
conversationId ||= sessionMetaId(entry);
|
|
@@ -58258,9 +58279,9 @@ async function readMessages(filePath, parse5) {
|
|
|
58258
58279
|
return [];
|
|
58259
58280
|
}
|
|
58260
58281
|
}
|
|
58261
|
-
function parseTranscriptLines(
|
|
58282
|
+
function parseTranscriptLines(lines) {
|
|
58262
58283
|
const messages2 = [];
|
|
58263
|
-
for (const line of
|
|
58284
|
+
for (const line of lines) {
|
|
58264
58285
|
const entry = line.trim() ? safeParse2(line) : null;
|
|
58265
58286
|
if (!entry || entry.isSidechain || entry.isMeta) continue;
|
|
58266
58287
|
messages2.push(...entryMessages(entry));
|
|
@@ -58881,10 +58902,10 @@ function handleConnection(socket, manager) {
|
|
|
58881
58902
|
};
|
|
58882
58903
|
manager.addClient(client);
|
|
58883
58904
|
manager.clients.greet(client);
|
|
58884
|
-
const
|
|
58885
|
-
|
|
58905
|
+
const lines = createInterface11({ input: socket });
|
|
58906
|
+
lines.on("error", () => {
|
|
58886
58907
|
});
|
|
58887
|
-
|
|
58908
|
+
lines.on("line", (line) => {
|
|
58888
58909
|
let data;
|
|
58889
58910
|
try {
|
|
58890
58911
|
data = JSON.parse(line);
|
|
@@ -59160,12 +59181,12 @@ async function doctorNodes(name, options2) {
|
|
|
59160
59181
|
}
|
|
59161
59182
|
|
|
59162
59183
|
// src/commands/sessions/nodes/nodeLogs.ts
|
|
59163
|
-
async function fetchLogTail(name,
|
|
59184
|
+
async function fetchLogTail(name, lines) {
|
|
59164
59185
|
if (name === resolveNodeName())
|
|
59165
59186
|
return {
|
|
59166
59187
|
nodeName: name,
|
|
59167
59188
|
path: daemonPaths.log,
|
|
59168
|
-
lines: readLogTail(daemonPaths.log,
|
|
59189
|
+
lines: readLogTail(daemonPaths.log, lines)
|
|
59169
59190
|
};
|
|
59170
59191
|
const link3 = findLinkSpec(name);
|
|
59171
59192
|
if (!link3)
|
|
@@ -59173,7 +59194,7 @@ async function fetchLogTail(name, lines2) {
|
|
|
59173
59194
|
try {
|
|
59174
59195
|
return await fetchPeerJson(
|
|
59175
59196
|
link3.url,
|
|
59176
|
-
`/api/daemon-log?lines=${
|
|
59197
|
+
`/api/daemon-log?lines=${lines}`
|
|
59177
59198
|
);
|
|
59178
59199
|
} catch (error) {
|
|
59179
59200
|
throw new Error(
|
|
@@ -59182,10 +59203,10 @@ async function fetchLogTail(name, lines2) {
|
|
|
59182
59203
|
}
|
|
59183
59204
|
}
|
|
59184
59205
|
async function nodeLogs(name, options2) {
|
|
59185
|
-
const
|
|
59186
|
-
if (!Number.isInteger(
|
|
59206
|
+
const lines = Number.parseInt(options2.lines, 10);
|
|
59207
|
+
if (!Number.isInteger(lines) || lines < 1)
|
|
59187
59208
|
throw new Error(`-n must be a positive integer, got ${options2.lines}`);
|
|
59188
|
-
const tail = await fetchLogTail(name,
|
|
59209
|
+
const tail = await fetchLogTail(name, lines);
|
|
59189
59210
|
if (options2.json) {
|
|
59190
59211
|
console.log(JSON.stringify(tail, null, 2));
|
|
59191
59212
|
return;
|
|
@@ -59539,11 +59560,11 @@ async function requestSessionOutput(target) {
|
|
|
59539
59560
|
throw new Error("No sessions daemon is running");
|
|
59540
59561
|
});
|
|
59541
59562
|
try {
|
|
59542
|
-
const
|
|
59543
|
-
|
|
59563
|
+
const lines = createInterface12({ input: socket });
|
|
59564
|
+
lines.on("error", () => {
|
|
59544
59565
|
});
|
|
59545
59566
|
const reply2 = readDaemonMessage(
|
|
59546
|
-
|
|
59567
|
+
lines,
|
|
59547
59568
|
OUTPUT_TIMEOUT_MS,
|
|
59548
59569
|
{ error: "Timed out waiting for the sessions daemon" },
|
|
59549
59570
|
(data) => data.type === "session-output" ? data : void 0
|
|
@@ -59560,9 +59581,9 @@ async function requestSessionOutput(target) {
|
|
|
59560
59581
|
|
|
59561
59582
|
// src/commands/sessions/lastLines.ts
|
|
59562
59583
|
function lastLines(scrollback, count10) {
|
|
59563
|
-
const
|
|
59564
|
-
if (
|
|
59565
|
-
return
|
|
59584
|
+
const lines = stripAnsi(scrollback).split(/\r?\n/);
|
|
59585
|
+
if (lines.at(-1) === "") lines.pop();
|
|
59586
|
+
return lines.slice(-count10);
|
|
59566
59587
|
}
|
|
59567
59588
|
|
|
59568
59589
|
// src/commands/sessions/sessionOutput.ts
|