@staff0rd/assist 0.875.1 → 0.875.3
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/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.875.
|
|
9
|
+
version: "0.875.3",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -35840,17 +35840,30 @@ function capHighLevelPatches(files, criticalPaths) {
|
|
|
35840
35840
|
// src/commands/review/highLevel/capHighLevelTestSources.ts
|
|
35841
35841
|
var MAX_TEST_SOURCE_LINES = 200;
|
|
35842
35842
|
var MAX_TOTAL_SOURCE_LINES = 5e3;
|
|
35843
|
-
function
|
|
35843
|
+
function collectCases(nodes) {
|
|
35844
|
+
return nodes.flatMap(
|
|
35845
|
+
(node) => node.kind === "it" ? [node] : collectCases(node.children)
|
|
35846
|
+
);
|
|
35847
|
+
}
|
|
35848
|
+
function shippedCases(files) {
|
|
35849
|
+
const sized = files.flatMap((file) => collectCases(file.tests)).flatMap(
|
|
35850
|
+
(test) => test.source === void 0 ? [] : [{ test, lines: test.source.split("\n").length }]
|
|
35851
|
+
).filter(({ lines: lines2 }) => lines2 <= MAX_TEST_SOURCE_LINES).sort((a, b) => a.lines - b.lines);
|
|
35852
|
+
const shipped = /* @__PURE__ */ new Set();
|
|
35844
35853
|
let remaining = MAX_TOTAL_SOURCE_LINES;
|
|
35854
|
+
for (const { test, lines: lines2 } of sized) {
|
|
35855
|
+
if (lines2 > remaining) break;
|
|
35856
|
+
remaining -= lines2;
|
|
35857
|
+
shipped.add(test);
|
|
35858
|
+
}
|
|
35859
|
+
return shipped;
|
|
35860
|
+
}
|
|
35861
|
+
function capHighLevelTestSources(files) {
|
|
35862
|
+
const shipped = shippedCases(files);
|
|
35845
35863
|
const capCase = (test) => {
|
|
35846
|
-
if (test.source === void 0) return test;
|
|
35847
|
-
const
|
|
35848
|
-
|
|
35849
|
-
remaining -= lines2;
|
|
35850
|
-
return test;
|
|
35851
|
-
}
|
|
35852
|
-
const { source: _dropped, ...rest } = test;
|
|
35853
|
-
return { ...rest, truncated: true };
|
|
35864
|
+
if (test.source === void 0 || shipped.has(test)) return test;
|
|
35865
|
+
const { source, ...rest } = test;
|
|
35866
|
+
return source.split("\n").length > MAX_TEST_SOURCE_LINES ? { ...rest, truncated: true } : { ...rest, overBudget: true };
|
|
35854
35867
|
};
|
|
35855
35868
|
const capNode = (node) => node.kind === "it" ? capCase(node) : { ...node, children: node.children.map(capNode) };
|
|
35856
35869
|
return files.map((file) => ({ ...file, tests: file.tests.map(capNode) }));
|
|
@@ -44171,6 +44184,7 @@ function toSessionInfo(session) {
|
|
|
44171
44184
|
verifying,
|
|
44172
44185
|
seeding,
|
|
44173
44186
|
pendingPrPreview,
|
|
44187
|
+
pendingShow,
|
|
44174
44188
|
undurable,
|
|
44175
44189
|
lastUserMessage,
|
|
44176
44190
|
activeViewer,
|
|
@@ -44198,6 +44212,7 @@ function toSessionInfo(session) {
|
|
|
44198
44212
|
verifying,
|
|
44199
44213
|
seeding,
|
|
44200
44214
|
pendingPrPreview,
|
|
44215
|
+
pendingShow,
|
|
44201
44216
|
undurable,
|
|
44202
44217
|
lastUserMessage,
|
|
44203
44218
|
activeViewer,
|
|
@@ -45896,6 +45911,14 @@ function decidePrPreview(sessions, waiters, notify2, d) {
|
|
|
45896
45911
|
const id = d.sessionId;
|
|
45897
45912
|
const requestId = d.requestId;
|
|
45898
45913
|
const session = sessions.get(id);
|
|
45914
|
+
if (session?.pendingShow?.requestId === requestId) {
|
|
45915
|
+
daemonLog(
|
|
45916
|
+
`pr-preview stacked show closed: id=${id} requestId=${requestId}`
|
|
45917
|
+
);
|
|
45918
|
+
session.pendingShow = void 0;
|
|
45919
|
+
notify2();
|
|
45920
|
+
return;
|
|
45921
|
+
}
|
|
45899
45922
|
if (!session || session.pendingPrPreview?.requestId !== requestId) {
|
|
45900
45923
|
daemonLog(
|
|
45901
45924
|
`pr-decision for stale/unknown preview id=${id} requestId=${requestId} (ignoring)`
|
|
@@ -46014,10 +46037,15 @@ function previewTargetLabel(kind, itemType, prNumber, draft) {
|
|
|
46014
46037
|
return draft ? "create draft" : "create";
|
|
46015
46038
|
}
|
|
46016
46039
|
|
|
46017
|
-
// src/commands/sessions/daemon/
|
|
46018
|
-
function
|
|
46040
|
+
// src/commands/sessions/daemon/placeShowPreview.ts
|
|
46041
|
+
function placeShowPreview(session, show4) {
|
|
46019
46042
|
const pending = session.pendingPrPreview;
|
|
46020
|
-
if (!pending || pending.kind === "show")
|
|
46043
|
+
if (!pending || pending.kind === "show") {
|
|
46044
|
+
session.pendingPrPreview = show4;
|
|
46045
|
+
session.pendingShow = void 0;
|
|
46046
|
+
return false;
|
|
46047
|
+
}
|
|
46048
|
+
session.pendingShow = show4;
|
|
46021
46049
|
const target = previewTargetLabel(
|
|
46022
46050
|
pending.kind ?? "pr",
|
|
46023
46051
|
pending.itemType ?? "story",
|
|
@@ -46025,13 +46053,8 @@ function refuseShowOverApproval(session, client, d) {
|
|
|
46025
46053
|
pending.draft === true
|
|
46026
46054
|
);
|
|
46027
46055
|
daemonLog(
|
|
46028
|
-
`pr-preview show
|
|
46056
|
+
`pr-preview show stacked: id=${session.id} requestId=${show4.requestId} over=${target}`
|
|
46029
46057
|
);
|
|
46030
|
-
sendTo(client, {
|
|
46031
|
-
type: "show-refused",
|
|
46032
|
-
requestId: d.requestId,
|
|
46033
|
-
message: `A ${target} preview is awaiting approval in this session's preview pane; approve or reject it before showing anything else.`
|
|
46034
|
-
});
|
|
46035
46058
|
return true;
|
|
46036
46059
|
}
|
|
46037
46060
|
|
|
@@ -46049,11 +46072,14 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
46049
46072
|
}
|
|
46050
46073
|
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
46051
46074
|
const kind = isPreviewKind(d.kind) ? d.kind : "pr";
|
|
46052
|
-
|
|
46053
|
-
|
|
46054
|
-
if (kind === "show")
|
|
46075
|
+
const preview = buildPrPreview(d, kind, prNumber);
|
|
46076
|
+
if (kind === "show") {
|
|
46055
46077
|
sendTo(client, { type: "show-ack", requestId: d.requestId });
|
|
46056
|
-
|
|
46078
|
+
if (placeShowPreview(session, preview)) return notify2();
|
|
46079
|
+
} else {
|
|
46080
|
+
session.pendingPrPreview = preview;
|
|
46081
|
+
waiters.set(id, client);
|
|
46082
|
+
}
|
|
46057
46083
|
const target = previewTargetLabel(
|
|
46058
46084
|
kind,
|
|
46059
46085
|
d.itemType === "bug" ? "bug" : "story",
|
|
@@ -46061,7 +46087,7 @@ function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
|
46061
46087
|
d.draft === true
|
|
46062
46088
|
);
|
|
46063
46089
|
daemonLog(
|
|
46064
|
-
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target} screenshots=${
|
|
46090
|
+
`pr-preview set: id=${id} requestId=${d.requestId} kind=${kind} target=${target} screenshots=${preview.screenshots?.length ?? 0}`
|
|
46065
46091
|
);
|
|
46066
46092
|
if (autoApprovePreview(sessions, waiters, notify2, session)) return;
|
|
46067
46093
|
notify2();
|