@staff0rd/assist 0.878.0 → 0.879.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/commands/sessions/web/bundle.js +3 -3
- package/dist/index.js +136 -50
- 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.879.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -35684,18 +35684,21 @@ function reportConfigured(result) {
|
|
|
35684
35684
|
|
|
35685
35685
|
// src/commands/review/highLevel/announceSavedReview.ts
|
|
35686
35686
|
import chalk236 from "chalk";
|
|
35687
|
-
function
|
|
35687
|
+
function savedMessage(subject) {
|
|
35688
35688
|
const head = subject.headSha.slice(0, 7);
|
|
35689
|
+
if (subject.draft)
|
|
35690
|
+
return `Reopening the review left open for ${head} at ${subject.draft.savedAt}; pass --force to start fresh.`;
|
|
35689
35691
|
if (subject.saved)
|
|
35690
|
-
|
|
35691
|
-
|
|
35692
|
-
|
|
35693
|
-
|
|
35694
|
-
|
|
35692
|
+
return `Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`;
|
|
35693
|
+
return void 0;
|
|
35694
|
+
}
|
|
35695
|
+
function announceSavedReview(subject, force) {
|
|
35696
|
+
const message3 = savedMessage(subject);
|
|
35697
|
+
if (message3) console.log(chalk236.dim(message3));
|
|
35695
35698
|
else if (force)
|
|
35696
35699
|
console.log(
|
|
35697
35700
|
chalk236.dim(
|
|
35698
|
-
`Discarding any review saved for ${
|
|
35701
|
+
`Discarding any review saved for ${subject.headSha.slice(0, 7)} and starting fresh (--force).`
|
|
35699
35702
|
)
|
|
35700
35703
|
);
|
|
35701
35704
|
}
|
|
@@ -36318,9 +36321,6 @@ function fetchHighLevelPr(prNumber, repo) {
|
|
|
36318
36321
|
};
|
|
36319
36322
|
}
|
|
36320
36323
|
|
|
36321
|
-
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
36322
|
-
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
36323
|
-
|
|
36324
36324
|
// src/commands/review/highLevel/highLevelReviewPath.ts
|
|
36325
36325
|
import { join as join83 } from "path";
|
|
36326
36326
|
function slug(value) {
|
|
@@ -36335,9 +36335,17 @@ function highLevelReviewPath(repo, headRef, headSha) {
|
|
|
36335
36335
|
);
|
|
36336
36336
|
}
|
|
36337
36337
|
|
|
36338
|
-
// src/commands/review/highLevel/
|
|
36339
|
-
function
|
|
36340
|
-
|
|
36338
|
+
// src/commands/review/highLevel/highLevelDraftPath.ts
|
|
36339
|
+
function highLevelDraftPath(repo, headRef, headSha) {
|
|
36340
|
+
return highLevelReviewPath(repo, headRef, headSha).replace(
|
|
36341
|
+
/\.json$/,
|
|
36342
|
+
".draft.json"
|
|
36343
|
+
);
|
|
36344
|
+
}
|
|
36345
|
+
|
|
36346
|
+
// src/commands/review/highLevel/readJsonFile.ts
|
|
36347
|
+
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
36348
|
+
function readJsonFile(path109) {
|
|
36341
36349
|
if (!existsSync66(path109)) return void 0;
|
|
36342
36350
|
try {
|
|
36343
36351
|
return JSON.parse(readFileSync49(path109, "utf8"));
|
|
@@ -36346,6 +36354,26 @@ function loadHighLevelReview(repo, headRef, headSha) {
|
|
|
36346
36354
|
}
|
|
36347
36355
|
}
|
|
36348
36356
|
|
|
36357
|
+
// src/commands/review/highLevel/loadHighLevelDraft.ts
|
|
36358
|
+
function loadHighLevelDraft(repo, headRef, headSha) {
|
|
36359
|
+
return readJsonFile(highLevelDraftPath(repo, headRef, headSha));
|
|
36360
|
+
}
|
|
36361
|
+
|
|
36362
|
+
// src/commands/review/highLevel/loadHighLevelReview.ts
|
|
36363
|
+
function loadHighLevelReview(repo, headRef, headSha) {
|
|
36364
|
+
return readJsonFile(highLevelReviewPath(repo, headRef, headSha));
|
|
36365
|
+
}
|
|
36366
|
+
|
|
36367
|
+
// src/commands/review/highLevel/loadReopenedReview.ts
|
|
36368
|
+
function loadReopenedReview(repo, headRef, headSha) {
|
|
36369
|
+
const saved = loadHighLevelReview(repo, headRef, headSha);
|
|
36370
|
+
const draft = loadHighLevelDraft(repo, headRef, headSha);
|
|
36371
|
+
return {
|
|
36372
|
+
...saved ? { saved } : {},
|
|
36373
|
+
...draft ? { draft } : {}
|
|
36374
|
+
};
|
|
36375
|
+
}
|
|
36376
|
+
|
|
36349
36377
|
// src/commands/review/highLevel/selectCriticalDiffs.ts
|
|
36350
36378
|
import { minimatch as minimatch8 } from "minimatch";
|
|
36351
36379
|
function selectCriticalDiffs(files, criticalPaths) {
|
|
@@ -36371,7 +36399,6 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
36371
36399
|
const config = resolveHighLevelConfig(loadConfig());
|
|
36372
36400
|
const fetched = fetchHighLevelFiles(prNumber, slug2);
|
|
36373
36401
|
const files = capHighLevelPatches(fetched, config.criticalPaths);
|
|
36374
|
-
const saved = force ? void 0 : loadHighLevelReview(slug2, pr.headRef, pr.headSha);
|
|
36375
36402
|
return {
|
|
36376
36403
|
repo: slug2,
|
|
36377
36404
|
prNumber,
|
|
@@ -36398,25 +36425,14 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
36398
36425
|
),
|
|
36399
36426
|
testPaths: config.testPaths,
|
|
36400
36427
|
collapsedPaths: config.collapsedPaths,
|
|
36401
|
-
...
|
|
36428
|
+
...force ? {} : loadReopenedReview(slug2, pr.headRef, pr.headSha)
|
|
36402
36429
|
};
|
|
36403
36430
|
}
|
|
36404
36431
|
|
|
36405
36432
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
36406
36433
|
import { randomUUID as randomUUID20 } from "crypto";
|
|
36407
36434
|
|
|
36408
|
-
// src/commands/review/highLevel/
|
|
36409
|
-
function highLevelReviewEvent(decision) {
|
|
36410
|
-
if (decision.reviewEvent) return decision.reviewEvent;
|
|
36411
|
-
return decision.decision === "approve" ? "APPROVE" : "REQUEST_CHANGES";
|
|
36412
|
-
}
|
|
36413
|
-
|
|
36414
|
-
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
36415
|
-
var VERDICTS = {
|
|
36416
|
-
APPROVE: "approve",
|
|
36417
|
-
COMMENT: "comment",
|
|
36418
|
-
REQUEST_CHANGES: "request-changes"
|
|
36419
|
-
};
|
|
36435
|
+
// src/commands/review/highLevel/highLevelProgress.ts
|
|
36420
36436
|
function toItem2(check2, decision) {
|
|
36421
36437
|
const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
|
|
36422
36438
|
const comment3 = ticked?.comment?.trim();
|
|
@@ -36430,9 +36446,41 @@ function toItem2(check2, decision) {
|
|
|
36430
36446
|
...comment3 ? { comment: comment3 } : {}
|
|
36431
36447
|
};
|
|
36432
36448
|
}
|
|
36449
|
+
function highLevelProgress(checks2, decision) {
|
|
36450
|
+
const reviewComments = decision.reviewComments ?? [];
|
|
36451
|
+
return {
|
|
36452
|
+
items: checks2.map((check2) => toItem2(check2, decision)),
|
|
36453
|
+
...reviewComments.length > 0 ? { reviewComments } : {}
|
|
36454
|
+
};
|
|
36455
|
+
}
|
|
36456
|
+
|
|
36457
|
+
// src/commands/review/highLevel/buildHighLevelDraft.ts
|
|
36458
|
+
function buildHighLevelDraft(subject, decision) {
|
|
36459
|
+
const { checks: checks2, repo, prNumber, headRef, headSha } = subject;
|
|
36460
|
+
return {
|
|
36461
|
+
repo,
|
|
36462
|
+
prNumber,
|
|
36463
|
+
headRef,
|
|
36464
|
+
headSha,
|
|
36465
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36466
|
+
...highLevelProgress(checks2, decision)
|
|
36467
|
+
};
|
|
36468
|
+
}
|
|
36469
|
+
|
|
36470
|
+
// src/commands/review/highLevel/highLevelReviewEvent.ts
|
|
36471
|
+
function highLevelReviewEvent(decision) {
|
|
36472
|
+
if (decision.reviewEvent) return decision.reviewEvent;
|
|
36473
|
+
return decision.decision === "approve" ? "APPROVE" : "REQUEST_CHANGES";
|
|
36474
|
+
}
|
|
36475
|
+
|
|
36476
|
+
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
36477
|
+
var VERDICTS = {
|
|
36478
|
+
APPROVE: "approve",
|
|
36479
|
+
COMMENT: "comment",
|
|
36480
|
+
REQUEST_CHANGES: "request-changes"
|
|
36481
|
+
};
|
|
36433
36482
|
function buildHighLevelRecord(subject, decision) {
|
|
36434
36483
|
const { checks: checks2, repo, prNumber, headRef, headSha } = subject;
|
|
36435
|
-
const reviewComments = decision.reviewComments ?? [];
|
|
36436
36484
|
return {
|
|
36437
36485
|
repo,
|
|
36438
36486
|
prNumber,
|
|
@@ -36440,17 +36488,44 @@ function buildHighLevelRecord(subject, decision) {
|
|
|
36440
36488
|
headSha,
|
|
36441
36489
|
verdict: VERDICTS[highLevelReviewEvent(decision)],
|
|
36442
36490
|
reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36443
|
-
|
|
36444
|
-
...reviewComments.length > 0 ? { reviewComments } : {}
|
|
36491
|
+
...highLevelProgress(checks2, decision)
|
|
36445
36492
|
};
|
|
36446
36493
|
}
|
|
36447
36494
|
|
|
36495
|
+
// src/commands/review/highLevel/clearHighLevelDraft.ts
|
|
36496
|
+
import { rmSync as rmSync6 } from "fs";
|
|
36497
|
+
function clearHighLevelDraft(repo, headRef, headSha) {
|
|
36498
|
+
rmSync6(highLevelDraftPath(repo, headRef, headSha), { force: true });
|
|
36499
|
+
}
|
|
36500
|
+
|
|
36501
|
+
// src/commands/review/highLevel/writeJsonFile.ts
|
|
36502
|
+
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync38 } from "fs";
|
|
36503
|
+
import { dirname as dirname38 } from "path";
|
|
36504
|
+
function writeJsonFile(path109, data) {
|
|
36505
|
+
mkdirSync23(dirname38(path109), { recursive: true });
|
|
36506
|
+
writeFileSync38(path109, `${JSON.stringify(data, null, 2)}
|
|
36507
|
+
`);
|
|
36508
|
+
return path109;
|
|
36509
|
+
}
|
|
36510
|
+
|
|
36511
|
+
// src/commands/review/highLevel/saveHighLevelDraft.ts
|
|
36512
|
+
function saveHighLevelDraft(draft) {
|
|
36513
|
+
return writeJsonFile(
|
|
36514
|
+
highLevelDraftPath(draft.repo, draft.headRef, draft.headSha),
|
|
36515
|
+
draft
|
|
36516
|
+
);
|
|
36517
|
+
}
|
|
36518
|
+
|
|
36448
36519
|
// src/commands/review/highLevel/highLevelPreviewMetadata.ts
|
|
36520
|
+
function reopenedFrom(subject) {
|
|
36521
|
+
const at2 = subject.draft?.savedAt ?? subject.saved?.reviewedAt;
|
|
36522
|
+
return at2 ? [{ label: "Reopened from", value: at2 }] : [];
|
|
36523
|
+
}
|
|
36449
36524
|
function highLevelPreviewMetadata(subject) {
|
|
36450
36525
|
return [
|
|
36451
36526
|
{ label: "Branch", value: subject.headRef },
|
|
36452
36527
|
{ label: "Head", value: subject.headSha.slice(0, 7) },
|
|
36453
|
-
...subject
|
|
36528
|
+
...reopenedFrom(subject)
|
|
36454
36529
|
];
|
|
36455
36530
|
}
|
|
36456
36531
|
|
|
@@ -36467,7 +36542,8 @@ function highLevelPreviewPayload(subject) {
|
|
|
36467
36542
|
tests,
|
|
36468
36543
|
testPaths,
|
|
36469
36544
|
collapsedPaths,
|
|
36470
|
-
saved
|
|
36545
|
+
saved,
|
|
36546
|
+
draft
|
|
36471
36547
|
} = subject;
|
|
36472
36548
|
return {
|
|
36473
36549
|
repo,
|
|
@@ -36480,19 +36556,17 @@ function highLevelPreviewPayload(subject) {
|
|
|
36480
36556
|
tests,
|
|
36481
36557
|
testPaths,
|
|
36482
36558
|
collapsedPaths,
|
|
36483
|
-
...saved ? { saved } : {}
|
|
36559
|
+
...saved ? { saved } : {},
|
|
36560
|
+
...draft ? { draft } : {}
|
|
36484
36561
|
};
|
|
36485
36562
|
}
|
|
36486
36563
|
|
|
36487
36564
|
// src/commands/review/highLevel/saveHighLevelReview.ts
|
|
36488
|
-
import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync38 } from "fs";
|
|
36489
|
-
import { dirname as dirname38 } from "path";
|
|
36490
36565
|
function saveHighLevelReview(record) {
|
|
36491
|
-
|
|
36492
|
-
|
|
36493
|
-
|
|
36494
|
-
|
|
36495
|
-
return path109;
|
|
36566
|
+
return writeJsonFile(
|
|
36567
|
+
highLevelReviewPath(record.repo, record.headRef, record.headSha),
|
|
36568
|
+
record
|
|
36569
|
+
);
|
|
36496
36570
|
}
|
|
36497
36571
|
|
|
36498
36572
|
// src/commands/review/highLevel/formatReviewComment.ts
|
|
@@ -36703,11 +36777,15 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
36703
36777
|
{ rejectIsOutcome: true }
|
|
36704
36778
|
);
|
|
36705
36779
|
if (decision.dismissed) {
|
|
36706
|
-
|
|
36780
|
+
saveHighLevelDraft(buildHighLevelDraft(subject, decision));
|
|
36781
|
+
console.log(
|
|
36782
|
+
"Review closed without a verdict. Your progress is kept for when you reopen it; nothing was posted."
|
|
36783
|
+
);
|
|
36707
36784
|
return void 0;
|
|
36708
36785
|
}
|
|
36709
36786
|
const record = buildHighLevelRecord(subject, decision);
|
|
36710
36787
|
saveHighLevelReview(record);
|
|
36788
|
+
clearHighLevelDraft(record.repo, record.headRef, record.headSha);
|
|
36711
36789
|
console.log(`Verdict: ${record.verdict}`);
|
|
36712
36790
|
await submitHighLevelReview(sessionId, record);
|
|
36713
36791
|
return record;
|
|
@@ -42871,11 +42949,11 @@ ${buildWatchReport(from)}`);
|
|
|
42871
42949
|
}
|
|
42872
42950
|
|
|
42873
42951
|
// src/commands/watch/consumeMarker.ts
|
|
42874
|
-
import { existsSync as existsSync83, rmSync as
|
|
42952
|
+
import { existsSync as existsSync83, rmSync as rmSync10 } from "fs";
|
|
42875
42953
|
function consumeMarker(path109) {
|
|
42876
42954
|
try {
|
|
42877
42955
|
if (!existsSync83(path109)) return false;
|
|
42878
|
-
|
|
42956
|
+
rmSync10(path109);
|
|
42879
42957
|
return true;
|
|
42880
42958
|
} catch {
|
|
42881
42959
|
return false;
|
|
@@ -44127,6 +44205,13 @@ function promptIssueRef(prompt) {
|
|
|
44127
44205
|
return match ? `${match[1]}#${match[2]}` : void 0;
|
|
44128
44206
|
}
|
|
44129
44207
|
|
|
44208
|
+
// src/commands/sessions/shared/promptPrNumber.ts
|
|
44209
|
+
var prUrlPrompt = /^https?:\/\/(?:www\.)?github\.com\/[^\s/#?]+\/[^\s/#?]+\/pull\/(\d+)(?![^\s/?#])/;
|
|
44210
|
+
function promptPrNumber(prompt) {
|
|
44211
|
+
const match = prompt ? prUrlPrompt.exec(prompt.trim()) : null;
|
|
44212
|
+
return match ? Number(match[1]) : void 0;
|
|
44213
|
+
}
|
|
44214
|
+
|
|
44130
44215
|
// src/commands/sessions/daemon/toSessionRunInfo.ts
|
|
44131
44216
|
function toSessionRunInfo({
|
|
44132
44217
|
status: status2,
|
|
@@ -44232,6 +44317,7 @@ function toSessionInfo(session) {
|
|
|
44232
44317
|
activeViewer,
|
|
44233
44318
|
activeViewerNode,
|
|
44234
44319
|
promptIssue: promptIssueRef(session.initialPrompt),
|
|
44320
|
+
promptPr: promptPrNumber(session.initialPrompt),
|
|
44235
44321
|
joinable: joinRefusal(session) === void 0
|
|
44236
44322
|
};
|
|
44237
44323
|
}
|
|
@@ -44884,13 +44970,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
44884
44970
|
}
|
|
44885
44971
|
|
|
44886
44972
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
44887
|
-
import { existsSync as existsSync88, rmSync as
|
|
44973
|
+
import { existsSync as existsSync88, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
|
|
44888
44974
|
var paused;
|
|
44889
44975
|
var wake;
|
|
44890
44976
|
function persist2(value) {
|
|
44891
44977
|
try {
|
|
44892
44978
|
if (value) writeFileSync54(daemonPaths.autoUpdatePaused, "");
|
|
44893
|
-
else
|
|
44979
|
+
else rmSync11(daemonPaths.autoUpdatePaused, { force: true });
|
|
44894
44980
|
} catch {
|
|
44895
44981
|
}
|
|
44896
44982
|
}
|
|
@@ -45230,12 +45316,12 @@ function noteAutoUpdate(installDir, text18) {
|
|
|
45230
45316
|
|
|
45231
45317
|
// src/commands/sessions/daemon/autoUpdate/runUpdateLap.ts
|
|
45232
45318
|
import { spawn as spawn11 } from "child_process";
|
|
45233
|
-
import { rmSync as
|
|
45319
|
+
import { rmSync as rmSync12 } from "fs";
|
|
45234
45320
|
function clearLapSignals(cwd) {
|
|
45235
45321
|
const control = watchControlPaths(cwd);
|
|
45236
45322
|
if (!control) return;
|
|
45237
45323
|
for (const path109 of [control.check, control.stop])
|
|
45238
|
-
|
|
45324
|
+
rmSync12(path109, { force: true });
|
|
45239
45325
|
}
|
|
45240
45326
|
function runUpdateLap(cwd, onOutput) {
|
|
45241
45327
|
clearLapSignals(cwd);
|
|
@@ -50167,7 +50253,7 @@ function autoUpdateReply() {
|
|
|
50167
50253
|
}
|
|
50168
50254
|
|
|
50169
50255
|
// src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
|
|
50170
|
-
import { rmSync as
|
|
50256
|
+
import { rmSync as rmSync13, writeFileSync as writeFileSync56 } from "fs";
|
|
50171
50257
|
function signalLap(installDir, marker2) {
|
|
50172
50258
|
const control = watchControlPaths(installDir);
|
|
50173
50259
|
if (control) writeFileSync56(control[marker2], "");
|
|
@@ -50178,7 +50264,7 @@ function applyAutoUpdateAction(action) {
|
|
|
50178
50264
|
if (action === "resume") {
|
|
50179
50265
|
if (!autoUpdateControl.paused()) return void 0;
|
|
50180
50266
|
const control = watchControlPaths(installDir);
|
|
50181
|
-
if (control)
|
|
50267
|
+
if (control) rmSync13(control.stop, { force: true });
|
|
50182
50268
|
autoUpdateControl.setPaused(false);
|
|
50183
50269
|
noteAutoUpdate(installDir, "resumed from Updates");
|
|
50184
50270
|
return void 0;
|