@staff0rd/assist 0.859.2 → 0.860.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/claude/skills/review-ci/scripts/review.mjs +113 -113
- package/dist/commands/sessions/web/bundle.js +444 -444
- package/dist/index.js +248 -190
- 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.860.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -2885,13 +2885,13 @@ async function activity(options2) {
|
|
|
2885
2885
|
const activeDays = data.filter((d) => d.count > 0).length;
|
|
2886
2886
|
console.log(`${total2} commits across ${activeDays} active days.`);
|
|
2887
2887
|
const weekly = /* @__PURE__ */ new Map();
|
|
2888
|
-
for (const { date, count:
|
|
2888
|
+
for (const { date, count: count10 } of data) {
|
|
2889
2889
|
const d = new Date(date);
|
|
2890
2890
|
d.setDate(d.getDate() - d.getDay());
|
|
2891
2891
|
const weekStart = d.toISOString().slice(0, 10);
|
|
2892
|
-
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) +
|
|
2892
|
+
weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count10);
|
|
2893
2893
|
}
|
|
2894
|
-
const weeklyData = [...weekly.entries()].map(([date,
|
|
2894
|
+
const weeklyData = [...weekly.entries()].map(([date, count10]) => ({ date, count: count10 })).sort((a, b) => a.date.localeCompare(b.date));
|
|
2895
2895
|
const until = data[data.length - 1].date;
|
|
2896
2896
|
renderLineChart({
|
|
2897
2897
|
title: "Commit Activity",
|
|
@@ -3291,30 +3291,40 @@ function toAttachments(value) {
|
|
|
3291
3291
|
function toChecklist(value) {
|
|
3292
3292
|
if (!Array.isArray(value)) return void 0;
|
|
3293
3293
|
return value.flatMap((entry) => {
|
|
3294
|
-
const { id, ticked, comment: comment3
|
|
3294
|
+
const { id, ticked, comment: comment3 } = entry ?? {};
|
|
3295
3295
|
if (typeof id !== "string") return [];
|
|
3296
|
-
const parsedNotes = toNotes(notes);
|
|
3297
3296
|
return [
|
|
3298
3297
|
{
|
|
3299
3298
|
id,
|
|
3300
3299
|
ticked: ticked === true,
|
|
3301
|
-
...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {}
|
|
3302
|
-
...parsedNotes.length > 0 ? { notes: parsedNotes } : {}
|
|
3300
|
+
...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {}
|
|
3303
3301
|
}
|
|
3304
3302
|
];
|
|
3305
3303
|
});
|
|
3306
3304
|
}
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3305
|
+
|
|
3306
|
+
// src/commands/sessions/shared/toReviewComments.ts
|
|
3307
|
+
function isReviewComment(value) {
|
|
3308
|
+
const comment3 = value;
|
|
3309
|
+
return typeof comment3?.path === "string" && Number.isInteger(comment3.startLine) && Number.isInteger(comment3.endLine) && typeof comment3.quote === "string" && typeof comment3.note === "string" && comment3.note.trim() !== "";
|
|
3310
|
+
}
|
|
3311
|
+
function toReviewComments(value) {
|
|
3312
|
+
if (!Array.isArray(value)) return void 0;
|
|
3313
|
+
return value.filter(isReviewComment).map(({ path: path109, startLine, endLine, quote, note }) => ({
|
|
3314
|
+
path: path109,
|
|
3315
|
+
startLine,
|
|
3316
|
+
endLine,
|
|
3317
|
+
quote,
|
|
3318
|
+
note
|
|
3319
|
+
}));
|
|
3315
3320
|
}
|
|
3316
3321
|
|
|
3317
3322
|
// src/commands/sessions/shared/toPreviewDecision.ts
|
|
3323
|
+
var REVIEW_EVENTS = [
|
|
3324
|
+
"APPROVE",
|
|
3325
|
+
"COMMENT",
|
|
3326
|
+
"REQUEST_CHANGES"
|
|
3327
|
+
];
|
|
3318
3328
|
function toSelection(value) {
|
|
3319
3329
|
const selection = value;
|
|
3320
3330
|
if (typeof selection?.topLeft !== "string" || typeof selection.bottomRight !== "string")
|
|
@@ -3336,6 +3346,8 @@ function toPreviewDecision(msg) {
|
|
|
3336
3346
|
autostart: msg.autostart === true,
|
|
3337
3347
|
selection: toSelection(msg.selection),
|
|
3338
3348
|
checklist: toChecklist(msg.checklist),
|
|
3349
|
+
reviewEvent: REVIEW_EVENTS.find((event) => event === msg.reviewEvent),
|
|
3350
|
+
reviewComments: toReviewComments(msg.reviewComments),
|
|
3339
3351
|
dismissed: msg.dismissed === true
|
|
3340
3352
|
};
|
|
3341
3353
|
}
|
|
@@ -15592,8 +15604,8 @@ function listUsageHistory(req, res) {
|
|
|
15592
15604
|
// src/shared/db/countItemUsageByOrigin.ts
|
|
15593
15605
|
import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-orm";
|
|
15594
15606
|
async function countItemUsageByOrigin(db) {
|
|
15595
|
-
const
|
|
15596
|
-
const rows = await db.select({ origin: items.origin, count:
|
|
15607
|
+
const count10 = sql19`count(distinct ${phaseUsage.itemId})::int`;
|
|
15608
|
+
const rows = await db.select({ origin: items.origin, count: count10 }).from(items).innerJoin(phaseUsage, eq41(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc4(count10), asc11(items.origin));
|
|
15597
15609
|
return rows.map((row3) => ({ origin: row3.origin, count: Number(row3.count) }));
|
|
15598
15610
|
}
|
|
15599
15611
|
|
|
@@ -16306,8 +16318,8 @@ async function commitsBehind(cwd, repo, base, shas) {
|
|
|
16306
16318
|
]);
|
|
16307
16319
|
const ref = response.data?.repository?.ref;
|
|
16308
16320
|
for (const [index2, sha] of shas.entries()) {
|
|
16309
|
-
const
|
|
16310
|
-
behind.set(sha, typeof
|
|
16321
|
+
const count10 = ref?.[`c${index2}`]?.behindBy;
|
|
16322
|
+
behind.set(sha, typeof count10 === "number" ? count10 : null);
|
|
16311
16323
|
}
|
|
16312
16324
|
} catch {
|
|
16313
16325
|
return behind;
|
|
@@ -16424,9 +16436,9 @@ function deploymentsQuery(environments) {
|
|
|
16424
16436
|
function headCommit2(node) {
|
|
16425
16437
|
return node?.oid ? releaseCommit(node.oid, node) : null;
|
|
16426
16438
|
}
|
|
16427
|
-
function environmentNodes(repository,
|
|
16439
|
+
function environmentNodes(repository, count10) {
|
|
16428
16440
|
return Array.from(
|
|
16429
|
-
{ length:
|
|
16441
|
+
{ length: count10 },
|
|
16430
16442
|
(_, index2) => repository[deploymentsAlias(index2)]?.nodes ?? []
|
|
16431
16443
|
).flat();
|
|
16432
16444
|
}
|
|
@@ -21795,7 +21807,7 @@ function calculateHalstead(node) {
|
|
|
21795
21807
|
// src/commands/complexity/shared/countSloc.ts
|
|
21796
21808
|
function countSloc(content) {
|
|
21797
21809
|
let inMultiLineComment = false;
|
|
21798
|
-
let
|
|
21810
|
+
let count10 = 0;
|
|
21799
21811
|
for (const line of content.split("\n")) {
|
|
21800
21812
|
const trimmed = line.trim();
|
|
21801
21813
|
if (inMultiLineComment) {
|
|
@@ -21803,7 +21815,7 @@ function countSloc(content) {
|
|
|
21803
21815
|
inMultiLineComment = false;
|
|
21804
21816
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
21805
21817
|
if (afterComment.trim().length > 0) {
|
|
21806
|
-
|
|
21818
|
+
count10++;
|
|
21807
21819
|
}
|
|
21808
21820
|
}
|
|
21809
21821
|
continue;
|
|
@@ -21815,7 +21827,7 @@ function countSloc(content) {
|
|
|
21815
21827
|
if (trimmed.includes("*/")) {
|
|
21816
21828
|
const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
|
|
21817
21829
|
if (afterComment.trim().length > 0) {
|
|
21818
|
-
|
|
21830
|
+
count10++;
|
|
21819
21831
|
}
|
|
21820
21832
|
} else {
|
|
21821
21833
|
inMultiLineComment = true;
|
|
@@ -21823,10 +21835,10 @@ function countSloc(content) {
|
|
|
21823
21835
|
continue;
|
|
21824
21836
|
}
|
|
21825
21837
|
if (trimmed.length > 0) {
|
|
21826
|
-
|
|
21838
|
+
count10++;
|
|
21827
21839
|
}
|
|
21828
21840
|
}
|
|
21829
|
-
return
|
|
21841
|
+
return count10;
|
|
21830
21842
|
}
|
|
21831
21843
|
|
|
21832
21844
|
// src/commands/complexity/shared.ts
|
|
@@ -22854,10 +22866,10 @@ async function findRetiredTables(exec3) {
|
|
|
22854
22866
|
const found = [];
|
|
22855
22867
|
for (const row3 of present) {
|
|
22856
22868
|
const name = String(row3.table_name);
|
|
22857
|
-
const [
|
|
22869
|
+
const [count10] = await exec3.query(
|
|
22858
22870
|
`SELECT count(*)::int AS rows FROM "${name}"`
|
|
22859
22871
|
);
|
|
22860
|
-
found.push({ name, rows: Number(
|
|
22872
|
+
found.push({ name, rows: Number(count10.rows) });
|
|
22861
22873
|
}
|
|
22862
22874
|
return found;
|
|
22863
22875
|
}
|
|
@@ -25565,8 +25577,8 @@ function annotate(entry) {
|
|
|
25565
25577
|
}
|
|
25566
25578
|
return notes;
|
|
25567
25579
|
}
|
|
25568
|
-
function formatCount(
|
|
25569
|
-
return `${
|
|
25580
|
+
function formatCount(count10, noun) {
|
|
25581
|
+
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
25570
25582
|
}
|
|
25571
25583
|
function printFixStructurePlan(plan2, chain2, apply) {
|
|
25572
25584
|
writeLineNow(chalk172.dim(`chain: ${chain2.join(" > ")}`));
|
|
@@ -28834,14 +28846,14 @@ async function netcap(options2) {
|
|
|
28834
28846
|
const filter = options2.filter ?? "";
|
|
28835
28847
|
await mkdir6(dirname34(outPath), { recursive: true });
|
|
28836
28848
|
const extensionPath = await prepareExtensionForLoad(port, filter);
|
|
28837
|
-
let
|
|
28849
|
+
let count10 = 0;
|
|
28838
28850
|
const handler = createNetcapHandler({
|
|
28839
28851
|
outPath,
|
|
28840
28852
|
onPing: () => console.log(chalk184.dim("ping from extension")),
|
|
28841
28853
|
onCapture: (entry) => {
|
|
28842
|
-
|
|
28854
|
+
count10 += 1;
|
|
28843
28855
|
console.log(
|
|
28844
|
-
chalk184.green(`captured #${
|
|
28856
|
+
chalk184.green(`captured #${count10}`),
|
|
28845
28857
|
chalk184.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
|
|
28846
28858
|
);
|
|
28847
28859
|
}
|
|
@@ -28862,7 +28874,7 @@ async function netcap(options2) {
|
|
|
28862
28874
|
console.log(
|
|
28863
28875
|
chalk184.bold(
|
|
28864
28876
|
`
|
|
28865
|
-
netcap stopped \u2014 captured ${
|
|
28877
|
+
netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
|
|
28866
28878
|
)
|
|
28867
28879
|
);
|
|
28868
28880
|
process.exit(0);
|
|
@@ -29103,8 +29115,8 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
|
|
|
29103
29115
|
related: []
|
|
29104
29116
|
};
|
|
29105
29117
|
walkPostRow(rows[id], resolve30, raw);
|
|
29106
|
-
const
|
|
29107
|
-
if (
|
|
29118
|
+
const post2 = buildPost(raw, mentionMap, author);
|
|
29119
|
+
if (post2) posts.push(post2);
|
|
29108
29120
|
}
|
|
29109
29121
|
return posts;
|
|
29110
29122
|
}
|
|
@@ -29263,8 +29275,8 @@ function extractVoyagerPosts(body) {
|
|
|
29263
29275
|
for (const ref of elementUrns(rootObj)) {
|
|
29264
29276
|
const update3 = byUrn.get(ref);
|
|
29265
29277
|
if (!update3) continue;
|
|
29266
|
-
const
|
|
29267
|
-
if (
|
|
29278
|
+
const post2 = buildVoyagerPost(update3, profiles);
|
|
29279
|
+
if (post2) posts.push(post2);
|
|
29268
29280
|
}
|
|
29269
29281
|
return posts;
|
|
29270
29282
|
}
|
|
@@ -29289,14 +29301,14 @@ function captureEntries(captureFile) {
|
|
|
29289
29301
|
function dedupeByActivity(posts) {
|
|
29290
29302
|
const byUrn = /* @__PURE__ */ new Map();
|
|
29291
29303
|
const noUrn = [];
|
|
29292
|
-
for (const
|
|
29293
|
-
if (!
|
|
29294
|
-
noUrn.push(
|
|
29304
|
+
for (const post2 of posts) {
|
|
29305
|
+
if (!post2.activityUrn) {
|
|
29306
|
+
noUrn.push(post2);
|
|
29295
29307
|
continue;
|
|
29296
29308
|
}
|
|
29297
|
-
const existing = byUrn.get(
|
|
29298
|
-
if (!existing ||
|
|
29299
|
-
byUrn.set(
|
|
29309
|
+
const existing = byUrn.get(post2.activityUrn);
|
|
29310
|
+
if (!existing || post2.text.length > existing.text.length)
|
|
29311
|
+
byUrn.set(post2.activityUrn, post2);
|
|
29300
29312
|
}
|
|
29301
29313
|
return [...byUrn.values(), ...noUrn];
|
|
29302
29314
|
}
|
|
@@ -29436,11 +29448,11 @@ function printPromptsTable(rows) {
|
|
|
29436
29448
|
console.log(chalk187.dim(header));
|
|
29437
29449
|
console.log(chalk187.dim("-".repeat(header.length)));
|
|
29438
29450
|
for (const row3 of rows) {
|
|
29439
|
-
const
|
|
29451
|
+
const count10 = String(row3.count).padStart(countWidth);
|
|
29440
29452
|
const tool = row3.tool.padEnd(toolWidth);
|
|
29441
29453
|
const command = truncate(row3.command, 60).padEnd(commandWidth);
|
|
29442
29454
|
console.log(
|
|
29443
|
-
`${chalk187.yellow(
|
|
29455
|
+
`${chalk187.yellow(count10)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
|
|
29444
29456
|
);
|
|
29445
29457
|
}
|
|
29446
29458
|
}
|
|
@@ -29550,8 +29562,8 @@ async function promptNavigation(currentPage, totalPages) {
|
|
|
29550
29562
|
});
|
|
29551
29563
|
return parseAction(action);
|
|
29552
29564
|
}
|
|
29553
|
-
function computeTotalPages(
|
|
29554
|
-
return Math.ceil(
|
|
29565
|
+
function computeTotalPages(count10) {
|
|
29566
|
+
return Math.ceil(count10 / PAGE_SIZE2);
|
|
29555
29567
|
}
|
|
29556
29568
|
async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
|
|
29557
29569
|
const delta = await promptNavigation(currentPage, totalPages);
|
|
@@ -30037,9 +30049,9 @@ function renderResolvedIndex(threads, style) {
|
|
|
30037
30049
|
for (const thread of threads) {
|
|
30038
30050
|
const first = thread.comments[0];
|
|
30039
30051
|
if (!first) continue;
|
|
30040
|
-
const
|
|
30052
|
+
const count10 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
|
|
30041
30053
|
lines2.push(
|
|
30042
|
-
` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${
|
|
30054
|
+
` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count10}`
|
|
30043
30055
|
);
|
|
30044
30056
|
}
|
|
30045
30057
|
lines2.push("");
|
|
@@ -31338,12 +31350,12 @@ function printPrStatus(pr) {
|
|
|
31338
31350
|
// src/commands/prs/status/printPrsStatus.ts
|
|
31339
31351
|
function printPrsStatus(report) {
|
|
31340
31352
|
for (const repo of report.repos) {
|
|
31341
|
-
const
|
|
31342
|
-
console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${
|
|
31353
|
+
const count10 = repo.pullRequests.length;
|
|
31354
|
+
console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count10} open)`)}`);
|
|
31343
31355
|
for (const pr of repo.pullRequests) {
|
|
31344
31356
|
printPrStatus(pr);
|
|
31345
31357
|
}
|
|
31346
|
-
if (
|
|
31358
|
+
if (count10 === 0) console.log(chalk191.dim(" no open pull requests"));
|
|
31347
31359
|
console.log();
|
|
31348
31360
|
}
|
|
31349
31361
|
if (report.errors.length === 0) return;
|
|
@@ -33263,16 +33275,16 @@ import {
|
|
|
33263
33275
|
} from "ts-morph";
|
|
33264
33276
|
var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
|
|
33265
33277
|
function countLeadingSuppressions(sourceFile) {
|
|
33266
|
-
let
|
|
33278
|
+
let count10 = 0;
|
|
33267
33279
|
for (const stmt of sourceFile.getStatementsWithComments()) {
|
|
33268
33280
|
const kind = stmt.getKind();
|
|
33269
33281
|
if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
|
|
33270
|
-
|
|
33282
|
+
count10++;
|
|
33271
33283
|
} else {
|
|
33272
33284
|
break;
|
|
33273
33285
|
}
|
|
33274
33286
|
}
|
|
33275
|
-
return
|
|
33287
|
+
return count10;
|
|
33276
33288
|
}
|
|
33277
33289
|
function addImportPreservingSuppressions(sourceFile, structure) {
|
|
33278
33290
|
if (sourceFile.getImportDeclarations().length > 0) {
|
|
@@ -35409,7 +35421,7 @@ function summariseRepoTree(cwd = process.cwd()) {
|
|
|
35409
35421
|
return [...directories.entries()].map(([directory, extensions]) => ({
|
|
35410
35422
|
directory,
|
|
35411
35423
|
extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
|
|
35412
|
-
total: [...extensions.values()].reduce((sum3,
|
|
35424
|
+
total: [...extensions.values()].reduce((sum3, count10) => sum3 + count10, 0)
|
|
35413
35425
|
})).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
|
|
35414
35426
|
(entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
|
|
35415
35427
|
).join("\n");
|
|
@@ -35437,7 +35449,7 @@ function countByDirectory(files) {
|
|
|
35437
35449
|
return directories;
|
|
35438
35450
|
}
|
|
35439
35451
|
function formatExtensions(extensions) {
|
|
35440
|
-
return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2,
|
|
35452
|
+
return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count10]) => `${extension2}(${count10})`).join(", ");
|
|
35441
35453
|
}
|
|
35442
35454
|
|
|
35443
35455
|
// src/commands/review/highLevel/proposeHighLevelGlobs.ts
|
|
@@ -35754,10 +35766,10 @@ function dedentedSource(call) {
|
|
|
35754
35766
|
// src/commands/review/highLevel/visitCase.ts
|
|
35755
35767
|
function visitCase(call, context) {
|
|
35756
35768
|
if (!context.changed) return [toCase(call, context, void 0)];
|
|
35757
|
-
const
|
|
35758
|
-
if (
|
|
35769
|
+
const count10 = changedLines(call, context.changed);
|
|
35770
|
+
if (count10 === 0) return [];
|
|
35759
35771
|
const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
|
|
35760
|
-
return [toCase(call, context,
|
|
35772
|
+
return [toCase(call, context, count10 === lines2 ? "added" : "modified")];
|
|
35761
35773
|
}
|
|
35762
35774
|
function toCase(call, context, change) {
|
|
35763
35775
|
const line = call.getStartLineNumber();
|
|
@@ -35771,10 +35783,10 @@ function toCase(call, context, change) {
|
|
|
35771
35783
|
};
|
|
35772
35784
|
}
|
|
35773
35785
|
function changedLines(call, changed) {
|
|
35774
|
-
let
|
|
35786
|
+
let count10 = 0;
|
|
35775
35787
|
for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
|
|
35776
|
-
if (changed.has(line))
|
|
35777
|
-
return
|
|
35788
|
+
if (changed.has(line)) count10++;
|
|
35789
|
+
return count10;
|
|
35778
35790
|
}
|
|
35779
35791
|
|
|
35780
35792
|
// src/commands/review/highLevel/extractTestHierarchy.ts
|
|
@@ -35934,8 +35946,8 @@ function countEvidence(body) {
|
|
|
35934
35946
|
0
|
|
35935
35947
|
);
|
|
35936
35948
|
}
|
|
35937
|
-
function plural(
|
|
35938
|
-
return `${
|
|
35949
|
+
function plural(count10, noun) {
|
|
35950
|
+
return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
|
|
35939
35951
|
}
|
|
35940
35952
|
function checkUiEvidence(body, changedFiles2, uiPaths) {
|
|
35941
35953
|
if (uiPaths.length === 0)
|
|
@@ -36207,34 +36219,23 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
36207
36219
|
}
|
|
36208
36220
|
|
|
36209
36221
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
36210
|
-
import { randomUUID as
|
|
36222
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
36211
36223
|
|
|
36212
|
-
// src/commands/review/highLevel/
|
|
36213
|
-
function
|
|
36214
|
-
|
|
36215
|
-
|
|
36216
|
-
const title = [...parents, node.name];
|
|
36217
|
-
if (node.kind === "it")
|
|
36218
|
-
index2.set(node.id, { path: path109, line: node.line, title });
|
|
36219
|
-
else for (const child of node.children) walk2(path109, child, title);
|
|
36220
|
-
};
|
|
36221
|
-
for (const file of files)
|
|
36222
|
-
for (const node of file.tests) walk2(file.path, node, []);
|
|
36223
|
-
return index2;
|
|
36224
|
+
// src/commands/review/highLevel/highLevelReviewEvent.ts
|
|
36225
|
+
function highLevelReviewEvent(decision) {
|
|
36226
|
+
if (decision.reviewEvent) return decision.reviewEvent;
|
|
36227
|
+
return decision.decision === "approve" ? "APPROVE" : "REQUEST_CHANGES";
|
|
36224
36228
|
}
|
|
36225
36229
|
|
|
36226
36230
|
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
36227
|
-
|
|
36228
|
-
|
|
36229
|
-
|
|
36230
|
-
|
|
36231
|
-
|
|
36232
|
-
|
|
36233
|
-
}
|
|
36234
|
-
function toItem2(check2, decision, tests) {
|
|
36231
|
+
var VERDICTS = {
|
|
36232
|
+
APPROVE: "approve",
|
|
36233
|
+
COMMENT: "comment",
|
|
36234
|
+
REQUEST_CHANGES: "request-changes"
|
|
36235
|
+
};
|
|
36236
|
+
function toItem2(check2, decision) {
|
|
36235
36237
|
const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
|
|
36236
36238
|
const comment3 = ticked?.comment?.trim();
|
|
36237
|
-
const notes = testComments(ticked?.notes ?? [], tests);
|
|
36238
36239
|
return {
|
|
36239
36240
|
id: check2.id,
|
|
36240
36241
|
kind: check2.kind,
|
|
@@ -36242,44 +36243,24 @@ function toItem2(check2, decision, tests) {
|
|
|
36242
36243
|
status: check2.status,
|
|
36243
36244
|
reason: check2.reason,
|
|
36244
36245
|
ticked: ticked?.ticked ?? check2.status === "pass",
|
|
36245
|
-
...comment3 ? { comment: comment3 } : {}
|
|
36246
|
-
...notes.length > 0 ? { testComments: notes } : {}
|
|
36246
|
+
...comment3 ? { comment: comment3 } : {}
|
|
36247
36247
|
};
|
|
36248
36248
|
}
|
|
36249
36249
|
function buildHighLevelRecord(subject, decision) {
|
|
36250
36250
|
const { checks: checks2, repo, prNumber, headRef, headSha } = subject;
|
|
36251
|
-
const
|
|
36251
|
+
const reviewComments = decision.reviewComments ?? [];
|
|
36252
36252
|
return {
|
|
36253
36253
|
repo,
|
|
36254
36254
|
prNumber,
|
|
36255
36255
|
headRef,
|
|
36256
36256
|
headSha,
|
|
36257
|
-
verdict: decision
|
|
36257
|
+
verdict: VERDICTS[highLevelReviewEvent(decision)],
|
|
36258
36258
|
reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36259
|
-
items: checks2.map((check2) => toItem2(check2, decision
|
|
36259
|
+
items: checks2.map((check2) => toItem2(check2, decision)),
|
|
36260
|
+
...reviewComments.length > 0 ? { reviewComments } : {}
|
|
36260
36261
|
};
|
|
36261
36262
|
}
|
|
36262
36263
|
|
|
36263
|
-
// src/commands/review/highLevel/formatHighLevelApprovalBody.ts
|
|
36264
|
-
function indentContinuation(text18) {
|
|
36265
|
-
return text18.replace(/\n/g, "\n ");
|
|
36266
|
-
}
|
|
36267
|
-
function formatTestComment(note) {
|
|
36268
|
-
const title = note.title.join(" \u203A ");
|
|
36269
|
-
return `- \`${note.path}:${note.line}\` ${title}: ${indentContinuation(note.comment)}`;
|
|
36270
|
-
}
|
|
36271
|
-
function formatItem(item) {
|
|
36272
|
-
const notes = item.testComments ?? [];
|
|
36273
|
-
if (!item.comment && notes.length === 0) return void 0;
|
|
36274
|
-
const sections = [`**${item.title}**`];
|
|
36275
|
-
if (item.comment) sections.push(item.comment);
|
|
36276
|
-
if (notes.length > 0) sections.push(notes.map(formatTestComment).join("\n"));
|
|
36277
|
-
return sections.join("\n\n");
|
|
36278
|
-
}
|
|
36279
|
-
function formatHighLevelApprovalBody(items2) {
|
|
36280
|
-
return items2.map(formatItem).filter((section2) => section2 !== void 0).join("\n\n");
|
|
36281
|
-
}
|
|
36282
|
-
|
|
36283
36264
|
// src/commands/review/highLevel/highLevelChangedFileCount.ts
|
|
36284
36265
|
function highLevelChangedFileCount(structure) {
|
|
36285
36266
|
return structure.added + structure.removed + structure.modified;
|
|
@@ -36342,13 +36323,6 @@ function highLevelPreviewPayload(subject) {
|
|
|
36342
36323
|
};
|
|
36343
36324
|
}
|
|
36344
36325
|
|
|
36345
|
-
// src/commands/review/highLevel/postHighLevelApproval.ts
|
|
36346
|
-
function postHighLevelApproval(repo, prNumber, body) {
|
|
36347
|
-
const args = ["pr", "review", String(prNumber), "--repo", repo, "--approve"];
|
|
36348
|
-
if (body) args.push("--body", body);
|
|
36349
|
-
runGhOrThrow(args, `Could not approve ${repo}#${prNumber}`);
|
|
36350
|
-
}
|
|
36351
|
-
|
|
36352
36326
|
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
36353
36327
|
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync38 } from "fs";
|
|
36354
36328
|
import { dirname as dirname38 } from "path";
|
|
@@ -36360,13 +36334,107 @@ function saveHighLevelReview(record) {
|
|
|
36360
36334
|
return path109;
|
|
36361
36335
|
}
|
|
36362
36336
|
|
|
36337
|
+
// src/commands/review/highLevel/submitHighLevelReview.ts
|
|
36338
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
36339
|
+
|
|
36340
|
+
// src/commands/review/highLevel/formatHighLevelReviewBody.ts
|
|
36341
|
+
function indentContinuation(text18) {
|
|
36342
|
+
return text18.replace(/\n/g, "\n ");
|
|
36343
|
+
}
|
|
36344
|
+
function formatItem(item) {
|
|
36345
|
+
if (!item.comment) return void 0;
|
|
36346
|
+
return `**${item.title}**
|
|
36347
|
+
|
|
36348
|
+
${item.comment}`;
|
|
36349
|
+
}
|
|
36350
|
+
function formatReviewComment({
|
|
36351
|
+
path: path109,
|
|
36352
|
+
startLine,
|
|
36353
|
+
endLine,
|
|
36354
|
+
quote,
|
|
36355
|
+
note
|
|
36356
|
+
}) {
|
|
36357
|
+
const lines2 = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
|
|
36358
|
+
return `- \`${path109}:${lines2}\` ${quote}: ${indentContinuation(note)}`;
|
|
36359
|
+
}
|
|
36360
|
+
function formatHighLevelReviewBody(items2, reviewComments = []) {
|
|
36361
|
+
const sections = items2.map(formatItem).filter((section2) => section2 !== void 0);
|
|
36362
|
+
if (reviewComments.length > 0)
|
|
36363
|
+
sections.push(
|
|
36364
|
+
`**Comments**
|
|
36365
|
+
|
|
36366
|
+
${reviewComments.map(formatReviewComment).join("\n")}`
|
|
36367
|
+
);
|
|
36368
|
+
return sections.join("\n\n");
|
|
36369
|
+
}
|
|
36370
|
+
|
|
36371
|
+
// src/commands/review/highLevel/postHighLevelReview.ts
|
|
36372
|
+
var FLAGS = {
|
|
36373
|
+
APPROVE: "--approve",
|
|
36374
|
+
COMMENT: "--comment",
|
|
36375
|
+
REQUEST_CHANGES: "--request-changes"
|
|
36376
|
+
};
|
|
36377
|
+
function postHighLevelReview(repo, prNumber, event, body) {
|
|
36378
|
+
const args = ["pr", "review", String(prNumber), "--repo", repo, FLAGS[event]];
|
|
36379
|
+
if (body) args.push("--body", body);
|
|
36380
|
+
runGhOrThrow(args, `Could not review ${repo}#${prNumber}`);
|
|
36381
|
+
}
|
|
36382
|
+
|
|
36383
|
+
// src/commands/review/highLevel/submitHighLevelReview.ts
|
|
36384
|
+
var EVENTS = {
|
|
36385
|
+
approve: "APPROVE",
|
|
36386
|
+
comment: "COMMENT",
|
|
36387
|
+
"request-changes": "REQUEST_CHANGES"
|
|
36388
|
+
};
|
|
36389
|
+
var LABELS = {
|
|
36390
|
+
APPROVE: "Approve",
|
|
36391
|
+
COMMENT: "Comment on",
|
|
36392
|
+
REQUEST_CHANGES: "Request changes on"
|
|
36393
|
+
};
|
|
36394
|
+
function post(record, event, body) {
|
|
36395
|
+
const target = `${record.repo}#${record.prNumber}`;
|
|
36396
|
+
try {
|
|
36397
|
+
postHighLevelReview(record.repo, record.prNumber, event, body);
|
|
36398
|
+
} catch (error) {
|
|
36399
|
+
console.error(
|
|
36400
|
+
`Could not post the review to ${target}: ${error.message}`
|
|
36401
|
+
);
|
|
36402
|
+
process.exit(1);
|
|
36403
|
+
}
|
|
36404
|
+
console.log(`Review (${event}) posted to ${target}.`);
|
|
36405
|
+
}
|
|
36406
|
+
async function previewApproved(sessionId, record, event, body) {
|
|
36407
|
+
const decision = await awaitPreviewApproval(
|
|
36408
|
+
"Review",
|
|
36409
|
+
{
|
|
36410
|
+
sessionId,
|
|
36411
|
+
requestId: randomUUID19(),
|
|
36412
|
+
title: `${LABELS[event]} ${record.repo}#${record.prNumber}`,
|
|
36413
|
+
body,
|
|
36414
|
+
prNumber: record.prNumber,
|
|
36415
|
+
kind: "pr-comment"
|
|
36416
|
+
},
|
|
36417
|
+
{ rejectIsOutcome: true }
|
|
36418
|
+
);
|
|
36419
|
+
return decision.decision === "approve" && !decision.dismissed;
|
|
36420
|
+
}
|
|
36421
|
+
async function submitHighLevelReview(sessionId, record) {
|
|
36422
|
+
const event = EVENTS[record.verdict];
|
|
36423
|
+
const body = formatHighLevelReviewBody(record.items, record.reviewComments);
|
|
36424
|
+
if (event === "APPROVE" && !record.reviewComments?.length)
|
|
36425
|
+
return post(record, event, body);
|
|
36426
|
+
if (body && await previewApproved(sessionId, record, event, body))
|
|
36427
|
+
return post(record, event, body);
|
|
36428
|
+
console.log("Nothing was posted to GitHub.");
|
|
36429
|
+
}
|
|
36430
|
+
|
|
36363
36431
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
36364
36432
|
async function openHighLevelOverlay(sessionId, subject) {
|
|
36365
36433
|
const decision = await awaitPreviewApproval(
|
|
36366
36434
|
"High-level review",
|
|
36367
36435
|
{
|
|
36368
36436
|
sessionId,
|
|
36369
|
-
requestId:
|
|
36437
|
+
requestId: randomUUID20(),
|
|
36370
36438
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
36371
36439
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
36372
36440
|
prNumber: subject.prNumber,
|
|
@@ -36382,26 +36450,9 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
36382
36450
|
const record = buildHighLevelRecord(subject, decision);
|
|
36383
36451
|
saveHighLevelReview(record);
|
|
36384
36452
|
console.log(`Verdict: ${record.verdict}`);
|
|
36385
|
-
|
|
36386
|
-
else console.log("Nothing was posted to GitHub.");
|
|
36453
|
+
await submitHighLevelReview(sessionId, record);
|
|
36387
36454
|
return record;
|
|
36388
36455
|
}
|
|
36389
|
-
function approveOnGitHub(record) {
|
|
36390
|
-
const target = `${record.repo}#${record.prNumber}`;
|
|
36391
|
-
try {
|
|
36392
|
-
postHighLevelApproval(
|
|
36393
|
-
record.repo,
|
|
36394
|
-
record.prNumber,
|
|
36395
|
-
formatHighLevelApprovalBody(record.items)
|
|
36396
|
-
);
|
|
36397
|
-
} catch (error) {
|
|
36398
|
-
console.error(
|
|
36399
|
-
`Could not post the approval to ${target}: ${error.message}`
|
|
36400
|
-
);
|
|
36401
|
-
process.exit(1);
|
|
36402
|
-
}
|
|
36403
|
-
console.log(`Approval posted to ${target}.`);
|
|
36404
|
-
}
|
|
36405
36456
|
|
|
36406
36457
|
// src/commands/review/highLevel/printHighLevelChecklist.ts
|
|
36407
36458
|
import chalk241 from "chalk";
|
|
@@ -38390,9 +38441,9 @@ function setupReviewDir(repoRoot2, context, force) {
|
|
|
38390
38441
|
console.log(`Review folder: ${paths.reviewDir}`);
|
|
38391
38442
|
return paths;
|
|
38392
38443
|
}
|
|
38393
|
-
function logPriorComments(
|
|
38394
|
-
if (
|
|
38395
|
-
console.log(`Including ${
|
|
38444
|
+
function logPriorComments(count10) {
|
|
38445
|
+
if (count10 === 0) return;
|
|
38446
|
+
console.log(`Including ${count10} prior review comment(s) in request.md.`);
|
|
38396
38447
|
}
|
|
38397
38448
|
|
|
38398
38449
|
// src/commands/review/gatherContext.ts
|
|
@@ -38932,7 +38983,7 @@ function addReviewModeOptions(command) {
|
|
|
38932
38983
|
"Check the PR out and start an idle interactive Claude session in the checkout tree instead of reviewing; requires a PR number and cannot be combined with --refine, --apply, --backlog or --submit"
|
|
38933
38984
|
).option(
|
|
38934
38985
|
"--high-level",
|
|
38935
|
-
"
|
|
38986
|
+
"Check the PR out and open the high-level review checklist in the web UI preview pane, then post it to the PR as an Approve, Comment or Request changes review. Outside a Claude session it starts one running /review-high-level <number>. A review saved for the same head SHA is reopened unless --force is passed. Cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
|
|
38936
38987
|
).option(
|
|
38937
38988
|
"--configure",
|
|
38938
38989
|
"With --high-level: review nothing and instead ask for review.highLevel.criticalPaths, uiPaths and descriptionWordCap one at a time, each prefilled with its current value or, when unset, globs Claude proposes from this repo's own tree, then write the answers in one pass to either this repo's override in the shared assist database or the project assist.yml. A blank answer leaves that key unset"
|
|
@@ -39316,16 +39367,16 @@ function filterToSql(filter) {
|
|
|
39316
39367
|
}
|
|
39317
39368
|
|
|
39318
39369
|
// src/commands/seq/fetchSeqData.ts
|
|
39319
|
-
function buildDataParams(filter,
|
|
39370
|
+
function buildDataParams(filter, count10, from, to) {
|
|
39320
39371
|
const sqlFilter = filterToSql(filter);
|
|
39321
|
-
const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${
|
|
39372
|
+
const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count10}`;
|
|
39322
39373
|
const params = new URLSearchParams({ q: sql29 });
|
|
39323
39374
|
if (from) params.set("rangeStartUtc", from);
|
|
39324
39375
|
if (to) params.set("rangeEndUtc", to);
|
|
39325
39376
|
return params;
|
|
39326
39377
|
}
|
|
39327
|
-
async function fetchSeqData(conn, filter,
|
|
39328
|
-
const params = buildDataParams(filter,
|
|
39378
|
+
async function fetchSeqData(conn, filter, count10, from, to) {
|
|
39379
|
+
const params = buildDataParams(filter, count10, from, to);
|
|
39329
39380
|
const response = await fetchSeq(conn, "/api/data", params);
|
|
39330
39381
|
const data = await response.json();
|
|
39331
39382
|
return mapDataToEvents(data);
|
|
@@ -39492,12 +39543,12 @@ function resolveConnection2(name) {
|
|
|
39492
39543
|
async function seqQuery(filter, options2) {
|
|
39493
39544
|
rejectTimestampFilter(filter);
|
|
39494
39545
|
const conn = resolveConnection2(options2.connection);
|
|
39495
|
-
const
|
|
39546
|
+
const count10 = Number.parseInt(options2.count ?? "1000", 10);
|
|
39496
39547
|
const from = options2.from ? parseRelativeTime(options2.from) : void 0;
|
|
39497
39548
|
const to = options2.to ? parseRelativeTime(options2.to) : void 0;
|
|
39498
|
-
const events = from || to ? await fetchSeqData(conn, filter,
|
|
39549
|
+
const events = from || to ? await fetchSeqData(conn, filter, count10, from, to) : await fetchSeqEvents(
|
|
39499
39550
|
conn,
|
|
39500
|
-
new URLSearchParams({ filter, count: String(
|
|
39551
|
+
new URLSearchParams({ filter, count: String(count10) })
|
|
39501
39552
|
);
|
|
39502
39553
|
if (events.length === 0) {
|
|
39503
39554
|
console.log(chalk252.yellow("No events found."));
|
|
@@ -39513,10 +39564,10 @@ async function seqQuery(filter, options2) {
|
|
|
39513
39564
|
}
|
|
39514
39565
|
console.log(chalk252.dim(`
|
|
39515
39566
|
${events.length} events`));
|
|
39516
|
-
if (events.length >=
|
|
39567
|
+
if (events.length >= count10) {
|
|
39517
39568
|
console.log(
|
|
39518
39569
|
chalk252.yellow(
|
|
39519
|
-
`Results limited to ${
|
|
39570
|
+
`Results limited to ${count10}. Use --count to retrieve more.`
|
|
39520
39571
|
)
|
|
39521
39572
|
);
|
|
39522
39573
|
}
|
|
@@ -39562,7 +39613,7 @@ function registerSeq(program2) {
|
|
|
39562
39613
|
}
|
|
39563
39614
|
|
|
39564
39615
|
// src/commands/show.ts
|
|
39565
|
-
import { randomUUID as
|
|
39616
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
39566
39617
|
|
|
39567
39618
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
39568
39619
|
async function sendShowPreview(request) {
|
|
@@ -39614,7 +39665,7 @@ async function show3(options2) {
|
|
|
39614
39665
|
try {
|
|
39615
39666
|
await sendShowPreview({
|
|
39616
39667
|
sessionId,
|
|
39617
|
-
requestId:
|
|
39668
|
+
requestId: randomUUID21(),
|
|
39618
39669
|
title: options2.title ?? "Show",
|
|
39619
39670
|
body
|
|
39620
39671
|
});
|
|
@@ -39689,7 +39740,7 @@ function readSlackParts(files) {
|
|
|
39689
39740
|
}
|
|
39690
39741
|
|
|
39691
39742
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
39692
|
-
import { randomUUID as
|
|
39743
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
39693
39744
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
39694
39745
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
39695
39746
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -39699,7 +39750,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
39699
39750
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
39700
39751
|
{
|
|
39701
39752
|
sessionId,
|
|
39702
|
-
requestId:
|
|
39753
|
+
requestId: randomUUID22(),
|
|
39703
39754
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
39704
39755
|
body,
|
|
39705
39756
|
prNumber: null,
|
|
@@ -41283,10 +41334,10 @@ function closesBlock(trimmed, from) {
|
|
|
41283
41334
|
}
|
|
41284
41335
|
function csharpHeaderLineCount(content) {
|
|
41285
41336
|
const lines2 = content.split("\n");
|
|
41286
|
-
let
|
|
41337
|
+
let count10 = 0;
|
|
41287
41338
|
let inBlock = false;
|
|
41288
|
-
while (
|
|
41289
|
-
const trimmed = lines2[
|
|
41339
|
+
while (count10 < lines2.length) {
|
|
41340
|
+
const trimmed = lines2[count10].trim();
|
|
41290
41341
|
if (inBlock) {
|
|
41291
41342
|
inBlock = !closesBlock(trimmed, 0);
|
|
41292
41343
|
} else if (trimmed.startsWith("/*")) {
|
|
@@ -41294,9 +41345,9 @@ function csharpHeaderLineCount(content) {
|
|
|
41294
41345
|
} else if (trimmed !== "" && !trimmed.startsWith("//")) {
|
|
41295
41346
|
break;
|
|
41296
41347
|
}
|
|
41297
|
-
|
|
41348
|
+
count10++;
|
|
41298
41349
|
}
|
|
41299
|
-
return
|
|
41350
|
+
return count10;
|
|
41300
41351
|
}
|
|
41301
41352
|
|
|
41302
41353
|
// src/commands/verify/blockCodeComments/collectCsharpComments.ts
|
|
@@ -42071,9 +42122,9 @@ async function watchLoop() {
|
|
|
42071
42122
|
}
|
|
42072
42123
|
|
|
42073
42124
|
// src/commands/watch/readRecentCommits.ts
|
|
42074
|
-
function readRecentCommits(
|
|
42125
|
+
function readRecentCommits(count10 = 10, cwd) {
|
|
42075
42126
|
const output = runGit3(
|
|
42076
|
-
["log", `-${
|
|
42127
|
+
["log", `-${count10}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
|
|
42077
42128
|
cwd
|
|
42078
42129
|
);
|
|
42079
42130
|
if (!output) return [];
|
|
@@ -42541,10 +42592,10 @@ function consumeSimulatedDivergence(cwd) {
|
|
|
42541
42592
|
}
|
|
42542
42593
|
|
|
42543
42594
|
// src/commands/watch/detectMovement.ts
|
|
42544
|
-
function detectMovement(from, to,
|
|
42595
|
+
function detectMovement(from, to, count10) {
|
|
42545
42596
|
if (from === to) return void 0;
|
|
42546
|
-
if (!Number.isFinite(
|
|
42547
|
-
return { from, to, count:
|
|
42597
|
+
if (!Number.isFinite(count10) || count10 <= 0) return void 0;
|
|
42598
|
+
return { from, to, count: count10 };
|
|
42548
42599
|
}
|
|
42549
42600
|
|
|
42550
42601
|
// src/commands/watch/readMovement.ts
|
|
@@ -42552,8 +42603,8 @@ function readMovement(cwd) {
|
|
|
42552
42603
|
try {
|
|
42553
42604
|
const from = runGit3(["rev-parse", "@"], cwd);
|
|
42554
42605
|
const to = runGit3(["rev-parse", "@{u}"], cwd);
|
|
42555
|
-
const
|
|
42556
|
-
return detectMovement(from, to,
|
|
42606
|
+
const count10 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
|
|
42607
|
+
return detectMovement(from, to, count10);
|
|
42557
42608
|
} catch {
|
|
42558
42609
|
return void 0;
|
|
42559
42610
|
}
|
|
@@ -43477,9 +43528,9 @@ async function drainDaemon(options2 = {}) {
|
|
|
43477
43528
|
return;
|
|
43478
43529
|
}
|
|
43479
43530
|
}
|
|
43480
|
-
const
|
|
43531
|
+
const count10 = await requestDrain(socket, lines2);
|
|
43481
43532
|
socket.destroy();
|
|
43482
|
-
console.log(`Drained ${
|
|
43533
|
+
console.log(`Drained ${count10} session(s)`);
|
|
43483
43534
|
}
|
|
43484
43535
|
function reportLive(live) {
|
|
43485
43536
|
console.log(`${live.length} live session(s) would be closed:`);
|
|
@@ -43544,11 +43595,11 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
|
|
|
43544
43595
|
inFlight2 = true;
|
|
43545
43596
|
try {
|
|
43546
43597
|
const before = JSON.stringify(readRepoConfigCache());
|
|
43547
|
-
const
|
|
43598
|
+
const count10 = await refreshRepoConfigCache();
|
|
43548
43599
|
if (failing) daemonLog("repo config cache poll recovered");
|
|
43549
43600
|
failing = false;
|
|
43550
43601
|
if (JSON.stringify(readRepoConfigCache()) !== before)
|
|
43551
|
-
daemonLog(`repo config cache updated (${
|
|
43602
|
+
daemonLog(`repo config cache updated (${count10} repos)`);
|
|
43552
43603
|
} catch (error) {
|
|
43553
43604
|
if (!failing)
|
|
43554
43605
|
daemonLog(
|
|
@@ -43567,8 +43618,8 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
|
|
|
43567
43618
|
// src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
|
|
43568
43619
|
async function refreshRepoConfigCacheOnStart() {
|
|
43569
43620
|
try {
|
|
43570
|
-
const
|
|
43571
|
-
daemonLog(`repo config cache refreshed (${
|
|
43621
|
+
const count10 = await refreshRepoConfigCache();
|
|
43622
|
+
daemonLog(`repo config cache refreshed (${count10} repos)`);
|
|
43572
43623
|
} catch (error) {
|
|
43573
43624
|
daemonLog(
|
|
43574
43625
|
`repo config cache refresh failed; keeping the last snapshot: ${String(error)}`
|
|
@@ -44127,7 +44178,7 @@ var ClientHub = class extends Set {
|
|
|
44127
44178
|
};
|
|
44128
44179
|
|
|
44129
44180
|
// src/commands/sessions/daemon/createSession.ts
|
|
44130
|
-
import { randomUUID as
|
|
44181
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
44131
44182
|
|
|
44132
44183
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
44133
44184
|
function sessionBase(id, status2) {
|
|
@@ -44350,7 +44401,7 @@ function spawnRun(opts) {
|
|
|
44350
44401
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
44351
44402
|
if (harness && harness !== "claude")
|
|
44352
44403
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
44353
|
-
const claudeSessionId =
|
|
44404
|
+
const claudeSessionId = randomUUID23();
|
|
44354
44405
|
return {
|
|
44355
44406
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
44356
44407
|
name: `Session ${id}`,
|
|
@@ -45401,6 +45452,16 @@ function greetClient(client, sessions, links2) {
|
|
|
45401
45452
|
links2.sendNodes(client);
|
|
45402
45453
|
}
|
|
45403
45454
|
|
|
45455
|
+
// src/commands/sessions/daemon/logPrDecision.ts
|
|
45456
|
+
function count9(value) {
|
|
45457
|
+
return Array.isArray(value) ? value.length : 0;
|
|
45458
|
+
}
|
|
45459
|
+
function logPrDecision(id, requestId, d) {
|
|
45460
|
+
daemonLog(
|
|
45461
|
+
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${count9(d.comments)} screenshots=${count9(d.screenshots)} checklist=${count9(d.checklist)} reviewEvent=${d.reviewEvent} reviewComments=${count9(d.reviewComments)} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true}`
|
|
45462
|
+
);
|
|
45463
|
+
}
|
|
45464
|
+
|
|
45404
45465
|
// src/commands/sessions/daemon/decidePrPreview.ts
|
|
45405
45466
|
function decidePrPreview(sessions, waiters, notify2, d) {
|
|
45406
45467
|
const id = d.sessionId;
|
|
@@ -45412,12 +45473,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
45412
45473
|
);
|
|
45413
45474
|
return;
|
|
45414
45475
|
}
|
|
45415
|
-
|
|
45416
|
-
const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
|
|
45417
|
-
const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
|
|
45418
|
-
daemonLog(
|
|
45419
|
-
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} checklist=${checklistCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true}`
|
|
45420
|
-
);
|
|
45476
|
+
logPrDecision(id, requestId, d);
|
|
45421
45477
|
const waiter = waiters.get(id);
|
|
45422
45478
|
if (waiter)
|
|
45423
45479
|
sendTo(waiter, {
|
|
@@ -45434,6 +45490,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
45434
45490
|
autoMerge: d.autoMerge,
|
|
45435
45491
|
autostart: d.autostart,
|
|
45436
45492
|
checklist: d.checklist,
|
|
45493
|
+
reviewEvent: d.reviewEvent,
|
|
45494
|
+
reviewComments: d.reviewComments,
|
|
45437
45495
|
dismissed: d.dismissed
|
|
45438
45496
|
});
|
|
45439
45497
|
waiters.delete(id);
|
|
@@ -47111,7 +47169,7 @@ function codexRespawnPlan(session) {
|
|
|
47111
47169
|
}
|
|
47112
47170
|
|
|
47113
47171
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
47114
|
-
import { randomUUID as
|
|
47172
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
47115
47173
|
|
|
47116
47174
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
47117
47175
|
function hasTranscriptOnDisk(session) {
|
|
@@ -47138,7 +47196,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
47138
47196
|
return null;
|
|
47139
47197
|
}
|
|
47140
47198
|
function freshClaudePlan(session, prompt, cwd) {
|
|
47141
|
-
const claudeSessionId =
|
|
47199
|
+
const claudeSessionId = randomUUID24();
|
|
47142
47200
|
return {
|
|
47143
47201
|
spawn: () => {
|
|
47144
47202
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -51028,10 +51086,10 @@ async function requestSessionOutput(target) {
|
|
|
51028
51086
|
}
|
|
51029
51087
|
|
|
51030
51088
|
// src/commands/sessions/lastLines.ts
|
|
51031
|
-
function lastLines(scrollback,
|
|
51089
|
+
function lastLines(scrollback, count10) {
|
|
51032
51090
|
const lines2 = stripAnsi(scrollback).split(/\r?\n/);
|
|
51033
51091
|
if (lines2.at(-1) === "") lines2.pop();
|
|
51034
|
-
return lines2.slice(-
|
|
51092
|
+
return lines2.slice(-count10);
|
|
51035
51093
|
}
|
|
51036
51094
|
|
|
51037
51095
|
// src/commands/sessions/sessionOutput.ts
|
|
@@ -51051,14 +51109,14 @@ function resolveTarget3(sessionId, server) {
|
|
|
51051
51109
|
return { sessionId };
|
|
51052
51110
|
}
|
|
51053
51111
|
async function sessionOutput(sessionId, options2) {
|
|
51054
|
-
const
|
|
51055
|
-
if (!Number.isInteger(
|
|
51112
|
+
const count10 = Number.parseInt(options2.lines, 10);
|
|
51113
|
+
if (!Number.isInteger(count10) || count10 < 1)
|
|
51056
51114
|
return fail7(`-n must be a positive integer, got ${options2.lines}`);
|
|
51057
51115
|
const target = resolveTarget3(sessionId, options2.server);
|
|
51058
51116
|
if (typeof target === "string") return fail7(target);
|
|
51059
51117
|
try {
|
|
51060
51118
|
const scrollback = await requestSessionOutput(target);
|
|
51061
|
-
for (const line of lastLines(scrollback,
|
|
51119
|
+
for (const line of lastLines(scrollback, count10)) console.log(line);
|
|
51062
51120
|
} catch (error) {
|
|
51063
51121
|
fail7(error instanceof Error ? error.message : String(error));
|
|
51064
51122
|
}
|