glimmervoid 0.52.2-next.682 → 0.52.2-next.683
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/bin/glimmervoid.js +17 -17
- package/dist/chunks/{adapters-BVZYqHuD.js → adapters-B33MPRTY.js} +1 -1
- package/dist/chunks/{adapters-CIL6g9R2.js → adapters-CuQ_RvlA.js} +7 -7
- package/dist/chunks/agent-api-cli-CRUTYJQq.js +1 -0
- package/dist/chunks/{agent-api-cli-7xxfflVL.js → agent-api-cli-D4CfxnZM.js} +7 -3
- package/dist/chunks/{agent-api-core-BxJOL6Ye.js → agent-api-core-BeeBFOwI.js} +12 -3
- package/dist/chunks/{agent-setup-cli-DWGQIduP.js → agent-setup-cli-CEU_RVfh.js} +1 -1
- package/dist/chunks/{config-C43Ovt64.js → config-C8KXay7k.js} +64 -3
- package/dist/chunks/{config-store-Co0IYv_B.js → config-store-1YxK7Fcc.js} +11 -9
- package/dist/chunks/config-store-C_U_TeZA.js +1 -0
- package/dist/chunks/{grok-CstIMQXr.js → grok-TfN6HhpF.js} +2 -2
- package/dist/chunks/kimi-8LeTccgZ.js +1 -0
- package/dist/chunks/{kimi-DjNUuBkC.js → kimi-CVxsh_Id.js} +3 -3
- package/dist/chunks/{main-7iEQ-1lZ.js → main-2BCXYvF3.js} +495 -33
- package/dist/chunks/pack-bridge-DifQHfqf.js +152 -0
- package/dist/chunks/{pair-cli-Dy0bFL9m.js → pair-cli-Bo-NjR4Z.js} +2 -2
- package/dist/chunks/{pr-flows-cli-Bdt0p04k.js → pr-flows-cli-D5gjtXla.js} +14 -72
- package/dist/chunks/{pr-flows-external-CbLPEQzZ.js → pr-flows-external-BRtHbSYM.js} +372 -94
- package/dist/chunks/{remote-config-qbb1pXRE.js → remote-config-JwAqVJzu.js} +2 -2
- package/dist/chunks/{runtime-paths-CYwF658V.js → runtime-paths-DfoHzN15.js} +3 -2
- package/dist/chunks/runtime-paths-j5rMoZKx.js +1 -0
- package/dist/chunks/{session-D0gNPAv6.js → session-BrX33men.js} +17 -4
- package/dist/chunks/{settings-cli-BTzrqRKC.js → settings-cli-BG8y7lry.js} +5 -5
- package/dist/chunks/{settings-readout-core-Be3O8D0x.js → settings-readout-core-D737OjDD.js} +2 -2
- package/dist/chunks/{shown-files-core-DJ4Uu8g4.js → shown-files-core-Dw46r34m.js} +1 -1
- package/dist/chunks/{spawn-env-gxqKNJaO.js → spawn-env-C9TqrBFa.js} +1 -1
- package/dist/chunks/{ssh-sign-cli-B8sdxV3y.js → ssh-sign-cli-TniUat4i.js} +2 -2
- package/dist/client/assets/{action-status-B0E-UYey.js → action-status-CZYIePIi.js} +1 -1
- package/dist/client/assets/action-status-CZYIePIi.js.br +0 -0
- package/dist/client/assets/{benchmark-panel-CeADmzc1.js → benchmark-panel-Bw8N6GK2.js} +1 -1
- package/dist/client/assets/benchmark-panel-Bw8N6GK2.js.br +0 -0
- package/dist/client/assets/boards-view-qc5Ngfb3.js +1 -0
- package/dist/client/assets/boards-view-qc5Ngfb3.js.br +0 -0
- package/dist/client/assets/button-DmPsawUI.js +1 -0
- package/dist/client/assets/button-DmPsawUI.js.br +0 -0
- package/dist/client/assets/{card-actions-unth0mGA.js → card-actions-DqN_LeXp.js} +1 -1
- package/dist/client/assets/{card-registry-W9ss4JHS.js → card-registry-Cv71lBTz.js} +1 -1
- package/dist/client/assets/card-registry-Cv71lBTz.js.br +0 -0
- package/dist/client/assets/community-panel-CWjsICRJ.js +1 -0
- package/dist/client/assets/community-panel-CWjsICRJ.js.br +0 -0
- package/dist/client/assets/{control-ws-t9cKDDGy.js → control-ws-DPZ9etoz.js} +3 -3
- package/dist/client/assets/control-ws-DPZ9etoz.js.br +0 -0
- package/dist/client/assets/dialogs-DDJIQOLH.js +62 -0
- package/dist/client/assets/dialogs-DDJIQOLH.js.br +0 -0
- package/dist/client/assets/{doc-editor-ui-CUmnGPuA.js → doc-editor-ui-CgjO3Lnt.js} +1 -1
- package/dist/client/assets/doc-editor-ui-CgjO3Lnt.js.br +0 -0
- package/dist/client/assets/{feature-hint-CSxFk4_I.js → feature-hint-DK-4CryY.js} +1 -1
- package/dist/client/assets/feature-hint-DK-4CryY.js.br +0 -0
- package/dist/client/assets/{first-run-checklist-Cvy09PVe.js → first-run-checklist-DhoHWVJq.js} +1 -1
- package/dist/client/assets/first-run-checklist-DhoHWVJq.js.br +0 -0
- package/dist/client/assets/{hooks-panel--CPyMcai.js → hooks-panel-Yq_L-te7.js} +1 -1
- package/dist/client/assets/hooks-panel-Yq_L-te7.js.br +0 -0
- package/dist/client/assets/{index-BCYtNn4q.css → index-DuILhRN2.css} +1 -1
- package/dist/client/assets/index-DuILhRN2.css.br +0 -0
- package/dist/client/assets/index-Yn1u5uR-.js +75 -0
- package/dist/client/assets/index-Yn1u5uR-.js.br +0 -0
- package/dist/client/assets/issues-panel-6Gxf7cee.js +1 -0
- package/dist/client/assets/issues-panel-6Gxf7cee.js.br +0 -0
- package/dist/client/assets/lane-read-token-step-DOv8AcER.js +10 -0
- package/dist/client/assets/lane-read-token-step-DOv8AcER.js.br +0 -0
- package/dist/client/assets/{menu-DK4rQWp6.js → menu-Bmp-V2w9.js} +1 -1
- package/dist/client/assets/menu-Bmp-V2w9.js.br +0 -0
- package/dist/client/assets/{modal-C-Lb5-jJ.js → modal-DAKyfQs6.js} +1 -1
- package/dist/client/assets/modal-DAKyfQs6.js.br +0 -0
- package/dist/client/assets/{my-prs-panel-BxhBLlrC.js → my-prs-panel-C5dGa_OW.js} +1 -1
- package/dist/client/assets/my-prs-panel-C5dGa_OW.js.br +0 -0
- package/dist/client/assets/{nyan-cat-C0SuX0Ul.js → nyan-cat-Cw67zd4C.js} +1 -1
- package/dist/client/assets/nyan-cat-Cw67zd4C.js.br +0 -0
- package/dist/client/assets/phone-shell-bUqLE2_q.js +1 -0
- package/dist/client/assets/phone-shell-bUqLE2_q.js.br +0 -0
- package/dist/client/assets/{plan-face-DOHTjQIm.js → plan-face-DBr_qpxa.js} +2 -2
- package/dist/client/assets/plan-face-DBr_qpxa.js.br +0 -0
- package/dist/client/assets/{plan-render-BxqPQmb3.js → plan-render-ysX1IWmF.js} +1 -1
- package/dist/client/assets/plan-render-ysX1IWmF.js.br +0 -0
- package/dist/client/assets/{pr-queue-columns-DUXJglbf.js → pr-queue-columns-BOCHpq03.js} +1 -1
- package/dist/client/assets/pr-queue-columns-BOCHpq03.js.br +5 -0
- package/dist/client/assets/{pr-status-icon-D1RIxNiH.js → pr-status-icon-tznMLhQo.js} +1 -1
- package/dist/client/assets/pr-status-icon-tznMLhQo.js.br +0 -0
- package/dist/client/assets/radar-panel-wqAgTOI3.js +1 -0
- package/dist/client/assets/radar-panel-wqAgTOI3.js.br +0 -0
- package/dist/client/assets/{repo-roots-adder-Bja_yxRQ.js → repo-roots-adder-K4WcaTgy.js} +1 -1
- package/dist/client/assets/repo-roots-adder-K4WcaTgy.js.br +0 -0
- package/dist/client/assets/{resume-dialog-DbmQjZ54.js → resume-dialog-Cqd2khFs.js} +1 -1
- package/dist/client/assets/resume-dialog-Cqd2khFs.js.br +0 -0
- package/dist/client/assets/review-queue-panel-DF9DcX9y.js +1 -0
- package/dist/client/assets/review-queue-panel-DF9DcX9y.js.br +0 -0
- package/dist/client/assets/{session-actions-Cpe0WcNw.js → session-actions-DSNLKleZ.js} +2 -2
- package/dist/client/assets/session-actions-DSNLKleZ.js.br +0 -0
- package/dist/client/assets/{session-row-Bx0e1IqT.js → session-row-CXMMlw0t.js} +2 -2
- package/dist/client/assets/session-row-CXMMlw0t.js.br +0 -0
- package/dist/client/assets/{session-tick-CY_ByGke.js → session-tick-DuSCNqbg.js} +1 -1
- package/dist/client/assets/session-tick-DuSCNqbg.js.br +0 -0
- package/dist/client/assets/settings-panel-BQr7kr-A.js +4 -0
- package/dist/client/assets/settings-panel-BQr7kr-A.js.br +0 -0
- package/dist/client/assets/{setup-step-DTtM5S-5.js → setup-step-CriQNZxc.js} +1 -1
- package/dist/client/assets/setup-step-CriQNZxc.js.br +0 -0
- package/dist/client/assets/shown-face-BXtBnUOJ.js +1 -0
- package/dist/client/assets/shown-face-BXtBnUOJ.js.br +0 -0
- package/dist/client/assets/trace-panel-GIXoh7_b.js +2 -0
- package/dist/client/assets/trace-panel-GIXoh7_b.js.br +0 -0
- package/dist/client/assets/usage-panel-BtWL4_uZ.js +1 -0
- package/dist/client/assets/usage-panel-BtWL4_uZ.js.br +0 -0
- package/dist/client/assets/your-day-tip-BPaWavzg.js +1 -0
- package/dist/client/assets/your-day-tip-BPaWavzg.js.br +0 -0
- package/dist/client/index.html +13 -13
- package/dist/client/index.html.br +0 -0
- package/dist/examples/packs/night-shift/pack.json +42 -0
- package/dist/examples/packs/pr-radar/icon.svg +1 -0
- package/dist/examples/packs/pr-radar/pack.json +17 -0
- package/dist/examples/packs/pr-radar/panel/bridge.js +23 -0
- package/dist/examples/packs/pr-radar/panel/index.html +17 -0
- package/dist/examples/packs/pr-radar/panel/panel.css +12 -0
- package/dist/examples/packs/pr-radar/panel/panel.js +37 -0
- package/dist/examples/packs/pr-radar/review-checklist.mjs +11 -0
- package/dist/examples/packs/session-board/icon.svg +1 -0
- package/dist/examples/packs/session-board/pack.json +11 -0
- package/dist/examples/packs/session-board/panel/bridge.js +23 -0
- package/dist/examples/packs/session-board/panel/index.html +15 -0
- package/dist/examples/packs/session-board/panel/panel.css +12 -0
- package/dist/examples/packs/session-board/panel/panel.js +36 -0
- package/dist/schema/pack.v1.json +502 -0
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/agent-api-cli-ivGOfIyv.js +0 -1
- package/dist/chunks/config-store-CuPthoVo.js +0 -1
- package/dist/chunks/kimi-DgpeyWvz.js +0 -1
- package/dist/chunks/runtime-paths-CKqE4LXP.js +0 -1
- package/dist/client/assets/action-status-B0E-UYey.js.br +0 -0
- package/dist/client/assets/benchmark-panel-CeADmzc1.js.br +0 -0
- package/dist/client/assets/boards-view-B72AQTO3.js +0 -1
- package/dist/client/assets/boards-view-B72AQTO3.js.br +0 -0
- package/dist/client/assets/button-Cnom-MQM.js +0 -1
- package/dist/client/assets/button-Cnom-MQM.js.br +0 -0
- package/dist/client/assets/card-registry-W9ss4JHS.js.br +0 -0
- package/dist/client/assets/community-panel-DqzC7L9D.js +0 -1
- package/dist/client/assets/community-panel-DqzC7L9D.js.br +0 -0
- package/dist/client/assets/control-ws-t9cKDDGy.js.br +0 -0
- package/dist/client/assets/dialogs-CYxttI_-.js +0 -62
- package/dist/client/assets/dialogs-CYxttI_-.js.br +0 -0
- package/dist/client/assets/doc-editor-ui-CUmnGPuA.js.br +0 -0
- package/dist/client/assets/feature-hint-CSxFk4_I.js.br +0 -0
- package/dist/client/assets/first-run-checklist-Cvy09PVe.js.br +0 -0
- package/dist/client/assets/hooks-panel--CPyMcai.js.br +0 -0
- package/dist/client/assets/index-BCYtNn4q.css.br +0 -0
- package/dist/client/assets/index-BJ91HtGW.js +0 -75
- package/dist/client/assets/index-BJ91HtGW.js.br +0 -0
- package/dist/client/assets/issues-panel-DUcdzzVj.js +0 -1
- package/dist/client/assets/issues-panel-DUcdzzVj.js.br +0 -0
- package/dist/client/assets/lane-read-token-step-DafWgu6v.js +0 -10
- package/dist/client/assets/lane-read-token-step-DafWgu6v.js.br +0 -0
- package/dist/client/assets/menu-DK4rQWp6.js.br +0 -0
- package/dist/client/assets/modal-C-Lb5-jJ.js.br +0 -0
- package/dist/client/assets/my-prs-panel-BxhBLlrC.js.br +0 -0
- package/dist/client/assets/nyan-cat-C0SuX0Ul.js.br +0 -0
- package/dist/client/assets/phone-shell-DVuMA67-.js +0 -1
- package/dist/client/assets/phone-shell-DVuMA67-.js.br +0 -0
- package/dist/client/assets/plan-face-DOHTjQIm.js.br +0 -0
- package/dist/client/assets/plan-render-BxqPQmb3.js.br +0 -0
- package/dist/client/assets/pr-queue-columns-DUXJglbf.js.br +0 -0
- package/dist/client/assets/pr-status-icon-D1RIxNiH.js.br +0 -0
- package/dist/client/assets/radar-panel-do7jZZzb.js +0 -1
- package/dist/client/assets/radar-panel-do7jZZzb.js.br +0 -0
- package/dist/client/assets/repo-roots-adder-Bja_yxRQ.js.br +0 -0
- package/dist/client/assets/resume-dialog-DbmQjZ54.js.br +0 -0
- package/dist/client/assets/review-queue-panel-Bj94aFOM.js +0 -1
- package/dist/client/assets/review-queue-panel-Bj94aFOM.js.br +0 -0
- package/dist/client/assets/sandboxed-frame-DDgtJ2Ng.js +0 -1
- package/dist/client/assets/session-actions-Cpe0WcNw.js.br +0 -0
- package/dist/client/assets/session-row-Bx0e1IqT.js.br +0 -0
- package/dist/client/assets/session-tick-CY_ByGke.js.br +0 -0
- package/dist/client/assets/settings-panel-DLFX7wgj.js +0 -4
- package/dist/client/assets/settings-panel-DLFX7wgj.js.br +0 -0
- package/dist/client/assets/setup-step-DTtM5S-5.js.br +0 -0
- package/dist/client/assets/shown-face-Dg0-lsQK.js +0 -1
- package/dist/client/assets/shown-face-Dg0-lsQK.js.br +0 -0
- package/dist/client/assets/trace-panel-CMGxUa6n.js +0 -2
- package/dist/client/assets/trace-panel-CMGxUa6n.js.br +0 -0
- package/dist/client/assets/usage-panel-CH5ByEKC.js +0 -1
- package/dist/client/assets/usage-panel-CH5ByEKC.js.br +0 -0
- package/dist/client/assets/your-day-tip-BX7i62Mj.js +0 -1
- package/dist/client/assets/your-day-tip-BX7i62Mj.js.br +0 -0
- package/dist/schema/pr-pack.v1.json +0 -272
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { r as errorMessage } from "./text-DoirglWV.js";
|
|
2
|
-
import {
|
|
2
|
+
import { An as ReportedPrFlowActionOutcome, Mn as prFlowRulesJsonSchema, Sn as PrFlowRule, Tn as PrFlowsSettings, hn as PrFlowCommand, wn as PrFlowSourceOutput, xn as PrFlowPrAction, yn as PrFlowPackRequires } from "./session-BrX33men.js";
|
|
3
3
|
import { c as runCommandSafely } from "./child-process-safe-BIh8yQ0I.js";
|
|
4
|
+
import { r as ThemePalette, t as PackBridgeTopic } from "./pack-bridge-DifQHfqf.js";
|
|
4
5
|
import { t as parseJsonOrNull } from "./json-core-If8h-Qgy.js";
|
|
5
|
-
import { n as withoutGlimmervoidSecrets } from "./spawn-env-
|
|
6
|
+
import { n as withoutGlimmervoidSecrets } from "./spawn-env-C9TqrBFa.js";
|
|
6
7
|
import fs from "node:fs";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import { z } from "zod";
|
|
@@ -280,7 +281,7 @@ var PACK_DIR_PLACEHOLDER = "{packDir}";
|
|
|
280
281
|
function packCommand(command, loaded) {
|
|
281
282
|
return {
|
|
282
283
|
...command,
|
|
283
|
-
id: `${loaded.
|
|
284
|
+
id: `${loaded.header.name}/${command.id}`,
|
|
284
285
|
command: command.command.map((element) => element.replaceAll(PACK_DIR_PLACEHOLDER, loaded.dir))
|
|
285
286
|
};
|
|
286
287
|
}
|
|
@@ -295,11 +296,11 @@ function packRuleText(rule, packName) {
|
|
|
295
296
|
const { name, ...matchAndAction } = packRule(rule, packName);
|
|
296
297
|
return `${name}: ${JSON.stringify(matchAndAction)}`;
|
|
297
298
|
}
|
|
298
|
-
function packCommands(loaded) {
|
|
299
|
+
function packCommands({ loaded, section }) {
|
|
299
300
|
return {
|
|
300
|
-
sources:
|
|
301
|
-
actions:
|
|
302
|
-
prActions:
|
|
301
|
+
sources: section.sources.map((command) => packCommand(command, loaded)),
|
|
302
|
+
actions: section.actions.map((command) => packCommand(command, loaded)),
|
|
303
|
+
prActions: section.prActions.map((command) => packCommand(command, loaded))
|
|
303
304
|
};
|
|
304
305
|
}
|
|
305
306
|
function kindedCommands(commands) {
|
|
@@ -318,9 +319,10 @@ function kindedCommands(commands) {
|
|
|
318
319
|
}))
|
|
319
320
|
];
|
|
320
321
|
}
|
|
321
|
-
function packApproval(
|
|
322
|
-
const {
|
|
323
|
-
const
|
|
322
|
+
function packApproval(prFlowsPack) {
|
|
323
|
+
const { loaded, section } = prFlowsPack;
|
|
324
|
+
const pack = loaded.header;
|
|
325
|
+
const commands = kindedCommands(packCommands(prFlowsPack)).map(({ kind, command }) => {
|
|
324
326
|
const repos = normalizedRepos(command);
|
|
325
327
|
return {
|
|
326
328
|
kind,
|
|
@@ -342,17 +344,36 @@ function packApproval(loaded) {
|
|
|
342
344
|
requires: pack.requires,
|
|
343
345
|
missing: loaded.missingRequires,
|
|
344
346
|
commands,
|
|
345
|
-
rules:
|
|
347
|
+
rules: section.rules.map((rule) => packRuleText(rule, pack.name))
|
|
346
348
|
}
|
|
347
349
|
};
|
|
348
350
|
}
|
|
349
|
-
function
|
|
351
|
+
function prFlowsPacksOf(packs) {
|
|
352
|
+
const prFlowsPacks = [];
|
|
353
|
+
const warnings = [];
|
|
354
|
+
for (const loaded of packs) {
|
|
355
|
+
if (loaded.prFlows === null) continue;
|
|
356
|
+
if (!loaded.prFlows.ok) {
|
|
357
|
+
warnings.push(`The prFlows section of the pack '${loaded.header.name}' was skipped: ${loaded.prFlows.errors[0] ?? "invalid"}`);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
prFlowsPacks.push({
|
|
361
|
+
loaded,
|
|
362
|
+
section: loaded.prFlows.value
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
prFlowsPacks,
|
|
367
|
+
warnings
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function prFlowSetup(configFile, approvedPackLoad, approvedFingerprints) {
|
|
350
371
|
const personal = prFlowCommands(configFile);
|
|
351
372
|
const approved = new Set(approvedFingerprints);
|
|
352
|
-
const
|
|
353
|
-
const
|
|
354
|
-
const enabledPacks = approvedPacks.filter((loaded) => loaded.missingRequires.length === 0);
|
|
355
|
-
const offNotes = approvedPacks.filter((loaded) => loaded.missingRequires.length > 0).map((loaded) => `The pack '${loaded.
|
|
373
|
+
const { prFlowsPacks: approvedPacks, warnings: sectionWarnings } = prFlowsPacksOf(approvedPackLoad.packs);
|
|
374
|
+
const approvals = pendingApprovals(personal, approved);
|
|
375
|
+
const enabledPacks = approvedPacks.filter(({ loaded }) => loaded.missingRequires.length === 0);
|
|
376
|
+
const offNotes = approvedPacks.filter(({ loaded }) => loaded.missingRequires.length > 0).map(({ loaded }) => `The pack '${loaded.header.name}' is off until this machine has ${loaded.missingRequires.join(", ")}`);
|
|
356
377
|
const enabledCommands = enabledPacks.map(packCommands);
|
|
357
378
|
for (const { kind, command } of enabledCommands.flatMap(kindedCommands)) approved.add(commandFingerprint(kind, command));
|
|
358
379
|
return {
|
|
@@ -362,18 +383,19 @@ function prFlowSetup(configFile, packLoad, approvedFingerprints) {
|
|
|
362
383
|
prActions: [...personal.prActions, ...enabledCommands.flatMap((commands) => commands.prActions)],
|
|
363
384
|
warnings: [
|
|
364
385
|
...personal.warnings,
|
|
365
|
-
...
|
|
386
|
+
...approvedPackLoad.warnings,
|
|
387
|
+
...sectionWarnings,
|
|
366
388
|
...offNotes
|
|
367
389
|
]
|
|
368
390
|
},
|
|
369
391
|
approved,
|
|
370
392
|
approvals,
|
|
371
|
-
packRules: enabledPacks.flatMap((loaded) =>
|
|
393
|
+
packRules: enabledPacks.flatMap(({ loaded, section }) => section.rules.map((rule) => packRule(rule, loaded.header.name)))
|
|
372
394
|
};
|
|
373
395
|
}
|
|
396
|
+
var ConfigFileWithPacks = z.looseObject({ packs: z.array(z.string().min(1)).optional().catch(void 0) });
|
|
374
397
|
function packPathsOf(configFile) {
|
|
375
|
-
|
|
376
|
-
return PrFlowsSettings.safeParse(raw ?? {}).data?.packs ?? [];
|
|
398
|
+
return ConfigFileWithPacks.safeParse(configFile).data?.packs ?? [];
|
|
377
399
|
}
|
|
378
400
|
function pendingApprovals(commands, approvedFingerprints) {
|
|
379
401
|
return [
|
|
@@ -608,29 +630,144 @@ function fixLocallyPrompt(prUrl, item, fence) {
|
|
|
608
630
|
].join("\n\n");
|
|
609
631
|
}
|
|
610
632
|
//#endregion
|
|
611
|
-
//#region
|
|
612
|
-
|
|
613
|
-
|
|
633
|
+
//#region server/packs/core/pack-core.ts
|
|
634
|
+
function packNeeds(pack) {
|
|
635
|
+
return [...pack.header.requires.env.map((name) => `env ${name}`), ...pack.header.requires.programs.map((program) => `program ${program}`)];
|
|
636
|
+
}
|
|
637
|
+
function packThemes(pack) {
|
|
638
|
+
return pack.ui?.ok ? pack.ui.value.themes : [];
|
|
639
|
+
}
|
|
640
|
+
function approvedPackThemes(packs) {
|
|
641
|
+
return packs.flatMap((pack) => packThemes(pack).map(({ id, ...palette }) => ({
|
|
642
|
+
id: `${pack.header.name}/${id}`,
|
|
643
|
+
palette
|
|
644
|
+
})));
|
|
645
|
+
}
|
|
646
|
+
function packPanels(pack) {
|
|
647
|
+
return pack.ui?.ok ? pack.ui.value.panels : [];
|
|
648
|
+
}
|
|
649
|
+
function packFileUrl(pack, accessKey, filePath) {
|
|
650
|
+
return `/packs/${encodeURIComponent(pack.header.name)}/${accessKey}/files/${filePath.split("/").map(encodeURIComponent).join("/")}`;
|
|
651
|
+
}
|
|
652
|
+
function approvedPackPanels(packs, accessKeyOf) {
|
|
653
|
+
return packs.flatMap((pack) => packPanels(pack).map((panel) => ({
|
|
654
|
+
viewId: `pack:${pack.header.name}/${panel.id}`,
|
|
655
|
+
label: panel.label,
|
|
656
|
+
entryUrl: packFileUrl(pack, accessKeyOf(pack), panel.entry),
|
|
657
|
+
iconUrl: panel.icon ? packFileUrl(pack, accessKeyOf(pack), panel.icon) : null,
|
|
658
|
+
reads: panel.reads
|
|
659
|
+
})));
|
|
660
|
+
}
|
|
661
|
+
var PACK_FILE_MIME_BY_EXTENSION = {
|
|
662
|
+
".html": "text/html; charset=utf-8",
|
|
663
|
+
".js": "text/javascript; charset=utf-8",
|
|
664
|
+
".mjs": "text/javascript; charset=utf-8",
|
|
665
|
+
".css": "text/css; charset=utf-8",
|
|
666
|
+
".json": "application/json; charset=utf-8",
|
|
667
|
+
".svg": "image/svg+xml",
|
|
668
|
+
".png": "image/png",
|
|
669
|
+
".jpg": "image/jpeg",
|
|
670
|
+
".jpeg": "image/jpeg",
|
|
671
|
+
".gif": "image/gif",
|
|
672
|
+
".webp": "image/webp",
|
|
673
|
+
".woff2": "font/woff2",
|
|
674
|
+
".txt": "text/plain; charset=utf-8"
|
|
675
|
+
};
|
|
676
|
+
var PACK_PANEL_CONTENT_POLICY = [
|
|
677
|
+
"sandbox allow-scripts allow-forms",
|
|
678
|
+
"default-src 'self' data: blob:",
|
|
679
|
+
"script-src 'self' 'unsafe-inline'",
|
|
680
|
+
"style-src 'self' 'unsafe-inline'",
|
|
681
|
+
"connect-src 'none'",
|
|
682
|
+
"form-action 'none'",
|
|
683
|
+
"frame-src 'none'",
|
|
684
|
+
"base-uri 'none'"
|
|
685
|
+
].join("; ");
|
|
686
|
+
function packFileMime(filePath) {
|
|
687
|
+
return PACK_FILE_MIME_BY_EXTENSION[path.posix.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
688
|
+
}
|
|
689
|
+
function uiSectionErrors(pack) {
|
|
690
|
+
return pack.ui && !pack.ui.ok ? pack.ui.errors : [];
|
|
691
|
+
}
|
|
692
|
+
function validPackRow(pack, approvedFingerprints) {
|
|
693
|
+
const { prFlowsPacks, warnings: prFlowsErrors } = prFlowsPacksOf([pack]);
|
|
694
|
+
const sectionErrors = [...prFlowsErrors, ...uiSectionErrors(pack)];
|
|
695
|
+
const [prFlowsPack] = prFlowsPacks;
|
|
696
|
+
return {
|
|
697
|
+
name: pack.header.name,
|
|
698
|
+
version: pack.header.version,
|
|
699
|
+
description: pack.header.description ?? null,
|
|
700
|
+
dir: pack.dir,
|
|
701
|
+
state: approvedFingerprints.has(pack.fingerprint) ? "approved" : "pending",
|
|
702
|
+
fingerprint: pack.fingerprint,
|
|
703
|
+
files: [...pack.filesByPath.keys()].sort(),
|
|
704
|
+
needs: packNeeds(pack),
|
|
705
|
+
missingRequires: pack.missingRequires,
|
|
706
|
+
prFlows: prFlowsPack ? packApproval(prFlowsPack) : null,
|
|
707
|
+
themes: packThemes(pack).map((theme) => ({
|
|
708
|
+
id: theme.id,
|
|
709
|
+
label: theme.label,
|
|
710
|
+
mode: theme.mode
|
|
711
|
+
})),
|
|
712
|
+
panels: packPanels(pack).map((panel) => ({
|
|
713
|
+
id: panel.id,
|
|
714
|
+
label: panel.label,
|
|
715
|
+
reads: panel.reads
|
|
716
|
+
})),
|
|
717
|
+
errors: sectionErrors
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
function packRow(packDir, read, approvedFingerprints) {
|
|
721
|
+
if (read.ok) return validPackRow(read.pack, approvedFingerprints);
|
|
722
|
+
return {
|
|
723
|
+
name: path.basename(packDir),
|
|
724
|
+
version: null,
|
|
725
|
+
description: null,
|
|
726
|
+
dir: packDir,
|
|
727
|
+
state: "invalid",
|
|
728
|
+
fingerprint: null,
|
|
729
|
+
files: [],
|
|
730
|
+
needs: [],
|
|
731
|
+
missingRequires: [],
|
|
732
|
+
prFlows: null,
|
|
733
|
+
themes: [],
|
|
734
|
+
panels: [],
|
|
735
|
+
errors: read.errors
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
function pendingPackNote(row) {
|
|
739
|
+
return `The pack '${row.name}' waits for your approval in Settings, Packs`;
|
|
740
|
+
}
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region shared/contracts/pack.ts
|
|
743
|
+
var PACK_SCHEMA_URL = "https://glimmervoid.dev/schema/pack.v1.json";
|
|
744
|
+
var PACK_FILE_NAME = "pack.json";
|
|
745
|
+
var PackName = z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}$/, { error: "a pack name is lowercase letters, digits and dashes, at most 40 characters" });
|
|
746
|
+
var PackHeader = z.strictObject({
|
|
614
747
|
$schema: z.string().optional(),
|
|
615
|
-
name:
|
|
748
|
+
name: PackName,
|
|
616
749
|
version: z.number().int().positive(),
|
|
617
750
|
description: z.string().max(500).optional(),
|
|
618
751
|
requires: PrFlowPackRequires.default({
|
|
619
752
|
env: [],
|
|
620
753
|
programs: []
|
|
621
754
|
}),
|
|
755
|
+
prFlows: z.unknown().optional(),
|
|
756
|
+
ui: z.unknown().optional()
|
|
757
|
+
});
|
|
758
|
+
var PackPrFlows = z.strictObject({
|
|
622
759
|
prActions: z.array(PrFlowPrAction).default([]),
|
|
623
760
|
sources: z.array(PrFlowCommand).default([]),
|
|
624
761
|
actions: z.array(PrFlowCommand).default([]),
|
|
625
762
|
rules: z.array(PrFlowRule).default([])
|
|
626
|
-
}).superRefine((
|
|
763
|
+
}).superRefine((section, context) => {
|
|
627
764
|
for (const kind of [
|
|
628
765
|
"prActions",
|
|
629
766
|
"sources",
|
|
630
767
|
"actions"
|
|
631
768
|
]) {
|
|
632
769
|
const seenIds = /* @__PURE__ */ new Set();
|
|
633
|
-
|
|
770
|
+
section[kind].forEach((command, index) => {
|
|
634
771
|
if (seenIds.has(command.id)) context.addIssue({
|
|
635
772
|
code: "custom",
|
|
636
773
|
path: [
|
|
@@ -644,20 +781,65 @@ var PrPack = z.strictObject({
|
|
|
644
781
|
});
|
|
645
782
|
}
|
|
646
783
|
});
|
|
784
|
+
var PackItemId = z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}$/, { error: "an id is lowercase letters, digits and dashes, at most 40 characters" });
|
|
785
|
+
var PackFilePath = z.string().regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-9._/-]{1,200}$/, { error: "a pack file path is relative, inside the pack, and uses letters, digits, dot, dash, underscore and slash" });
|
|
786
|
+
var PackPanel = z.strictObject({
|
|
787
|
+
id: PackItemId,
|
|
788
|
+
label: z.string().trim().min(1).max(24),
|
|
789
|
+
entry: PackFilePath.refine((filePath) => filePath.endsWith(".html"), { error: "a panel entry is an .html file" }),
|
|
790
|
+
icon: PackFilePath.refine((filePath) => filePath.endsWith(".svg"), { error: "a panel icon is an .svg file" }).optional(),
|
|
791
|
+
reads: z.array(PackBridgeTopic).default([])
|
|
792
|
+
});
|
|
793
|
+
var PackUi = z.strictObject({
|
|
794
|
+
themes: z.array(ThemePalette.extend({ id: PackItemId })).max(8).default([]),
|
|
795
|
+
panels: z.array(PackPanel).max(8).default([])
|
|
796
|
+
}).superRefine((section, context) => {
|
|
797
|
+
for (const kind of ["themes", "panels"]) {
|
|
798
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
799
|
+
section[kind].forEach((item, index) => {
|
|
800
|
+
if (seenIds.has(item.id)) context.addIssue({
|
|
801
|
+
code: "custom",
|
|
802
|
+
path: [
|
|
803
|
+
kind,
|
|
804
|
+
index,
|
|
805
|
+
"id"
|
|
806
|
+
],
|
|
807
|
+
message: `the id '${item.id}' is already used in ${kind}`
|
|
808
|
+
});
|
|
809
|
+
seenIds.add(item.id);
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
var PacksState = z.strictObject({ approvedFingerprints: z.array(z.string().min(1)).default([]) });
|
|
814
|
+
var PackManifestForSchema = PackHeader.extend({
|
|
815
|
+
prFlows: PackPrFlows.optional(),
|
|
816
|
+
ui: PackUi.optional()
|
|
817
|
+
});
|
|
818
|
+
function packJsonSchemaText() {
|
|
819
|
+
return `${JSON.stringify({
|
|
820
|
+
$id: PACK_SCHEMA_URL,
|
|
821
|
+
title: "Glimmervoid pack",
|
|
822
|
+
...prFlowRulesJsonSchema(PackManifestForSchema)
|
|
823
|
+
}, null, 2)}\n`;
|
|
824
|
+
}
|
|
647
825
|
//#endregion
|
|
648
|
-
//#region server/
|
|
826
|
+
//#region server/packs/pack-files.ts
|
|
649
827
|
var PACK_MAX_TOTAL_BYTES = 1048576;
|
|
650
828
|
var PACKS_DIR_NAME = "packs";
|
|
829
|
+
var PACKS_STATE_FILE_NAME = "packs-state.json";
|
|
830
|
+
function packsStatePath(homeDir) {
|
|
831
|
+
return path.join(homeDir, PACKS_STATE_FILE_NAME);
|
|
832
|
+
}
|
|
651
833
|
function sha256(bytes) {
|
|
652
834
|
return crypto.createHash("sha256").update(bytes).digest("hex");
|
|
653
835
|
}
|
|
654
|
-
function readPackFiles(packDir) {
|
|
655
|
-
const
|
|
836
|
+
async function readPackFiles(packDir) {
|
|
837
|
+
const filesByPath = /* @__PURE__ */ new Map();
|
|
656
838
|
const pendingDirs = [""];
|
|
657
839
|
let totalBytes = 0;
|
|
658
840
|
while (pendingDirs.length > 0) {
|
|
659
841
|
const relativeDir = pendingDirs.pop() ?? "";
|
|
660
|
-
for (const entry of fs.
|
|
842
|
+
for (const entry of await fs.promises.readdir(path.join(packDir, relativeDir), { withFileTypes: true })) {
|
|
661
843
|
const relativePath = path.posix.join(relativeDir, entry.name);
|
|
662
844
|
if (entry.isSymbolicLink()) return {
|
|
663
845
|
ok: false,
|
|
@@ -671,80 +853,101 @@ function readPackFiles(packDir) {
|
|
|
671
853
|
ok: false,
|
|
672
854
|
error: `${relativePath} is not a regular file`
|
|
673
855
|
};
|
|
674
|
-
totalBytes += fs.
|
|
856
|
+
totalBytes += (await fs.promises.lstat(path.join(packDir, relativePath))).size;
|
|
675
857
|
if (totalBytes > PACK_MAX_TOTAL_BYTES) return {
|
|
676
858
|
ok: false,
|
|
677
859
|
error: "the pack is over 1 MiB"
|
|
678
860
|
};
|
|
679
|
-
|
|
680
|
-
relativePath,
|
|
681
|
-
bytes: fs.readFileSync(path.join(packDir, relativePath))
|
|
682
|
-
});
|
|
861
|
+
filesByPath.set(relativePath, await fs.promises.readFile(path.join(packDir, relativePath)));
|
|
683
862
|
}
|
|
684
863
|
}
|
|
685
864
|
return {
|
|
686
865
|
ok: true,
|
|
687
|
-
|
|
866
|
+
filesByPath
|
|
688
867
|
};
|
|
689
868
|
}
|
|
690
|
-
function packFingerprint(
|
|
691
|
-
const fileHashes =
|
|
869
|
+
function packFingerprint(filesByPath) {
|
|
870
|
+
const fileHashes = [...filesByPath].map(([relativePath, bytes]) => [relativePath, sha256(bytes)]).sort(([left = ""], [right = ""]) => left.localeCompare(right));
|
|
692
871
|
return sha256(JSON.stringify(fileHashes));
|
|
693
872
|
}
|
|
694
|
-
function isProgramOnPath(program, env) {
|
|
695
|
-
|
|
873
|
+
async function isProgramOnPath(program, env) {
|
|
874
|
+
for (const dir of (env.PATH ?? "").split(path.delimiter).filter(Boolean)) {
|
|
696
875
|
const candidate = path.join(dir, program);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
} catch {
|
|
701
|
-
return false;
|
|
702
|
-
}
|
|
703
|
-
});
|
|
876
|
+
if (await fs.promises.access(candidate, fs.constants.X_OK).then(async () => (await fs.promises.stat(candidate)).isFile()).catch(() => false)) return true;
|
|
877
|
+
}
|
|
878
|
+
return false;
|
|
704
879
|
}
|
|
705
|
-
function missingRequires(requires, env) {
|
|
880
|
+
async function missingRequires(requires, env) {
|
|
706
881
|
const commandEnv = withoutGlimmervoidSecrets(env);
|
|
707
|
-
|
|
882
|
+
const missingPrograms = [];
|
|
883
|
+
for (const program of requires.programs) if (!await isProgramOnPath(program, env)) missingPrograms.push(`program ${program}`);
|
|
884
|
+
return [...requires.env.filter((name) => !commandEnv[name]).map((name) => `env ${name}`), ...missingPrograms];
|
|
885
|
+
}
|
|
886
|
+
function withPanelFilesPresent(ui, filesByPath) {
|
|
887
|
+
if (!ui?.ok) return ui;
|
|
888
|
+
const missing = ui.value.panels.flatMap((panel, index) => [panel.entry, ...panel.icon ? [panel.icon] : []].filter((filePath) => !filesByPath.has(filePath)).map((filePath) => `${PACK_FILE_NAME} ui.panels.${index}: ${filePath} is not a file in the pack`));
|
|
889
|
+
return missing.length === 0 ? ui : {
|
|
890
|
+
ok: false,
|
|
891
|
+
errors: missing
|
|
892
|
+
};
|
|
708
893
|
}
|
|
709
|
-
function
|
|
894
|
+
function issueLines(error, sectionLabel) {
|
|
895
|
+
return error.issues.map((issue) => `${[sectionLabel, ...issue.path.map(String)].join(".")}: ${issue.message}`);
|
|
896
|
+
}
|
|
897
|
+
function parseSection(schema, raw, sectionName) {
|
|
898
|
+
if (raw === void 0) return null;
|
|
899
|
+
const parsed = schema.safeParse(raw);
|
|
900
|
+
if (parsed.success) return {
|
|
901
|
+
ok: true,
|
|
902
|
+
value: parsed.data
|
|
903
|
+
};
|
|
904
|
+
return {
|
|
905
|
+
ok: false,
|
|
906
|
+
errors: issueLines(parsed.error, `${PACK_FILE_NAME} ${sectionName}`)
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
async function readPackDirUnguarded(packDir, env) {
|
|
710
910
|
if (/[{}]/.test(packDir)) return {
|
|
711
911
|
ok: false,
|
|
712
912
|
errors: [`${packDir} has { or } in its path, which a command placeholder would misread`]
|
|
713
913
|
};
|
|
714
|
-
const stats = fs.
|
|
914
|
+
const stats = await fs.promises.lstat(packDir);
|
|
715
915
|
if (stats.isSymbolicLink() || !stats.isDirectory()) return {
|
|
716
916
|
ok: false,
|
|
717
917
|
errors: [`${packDir} is not a directory; a symlinked pack is refused`]
|
|
718
918
|
};
|
|
719
|
-
const read = readPackFiles(packDir);
|
|
919
|
+
const read = await readPackFiles(packDir);
|
|
720
920
|
if (!read.ok) return {
|
|
721
921
|
ok: false,
|
|
722
922
|
errors: [read.error]
|
|
723
923
|
};
|
|
724
|
-
const manifest = read.
|
|
924
|
+
const manifest = read.filesByPath.get(PACK_FILE_NAME);
|
|
725
925
|
if (!manifest) return {
|
|
726
926
|
ok: false,
|
|
727
|
-
errors: [`there is no ${
|
|
927
|
+
errors: [`there is no ${PACK_FILE_NAME}`]
|
|
728
928
|
};
|
|
729
|
-
const
|
|
730
|
-
if (!
|
|
929
|
+
const header = PackHeader.safeParse(parseJsonOrNull(manifest.toString("utf8")));
|
|
930
|
+
if (!header.success) return {
|
|
731
931
|
ok: false,
|
|
732
|
-
errors:
|
|
932
|
+
errors: header.error.issues.map((issue) => `${PACK_FILE_NAME} ${issue.path.join(".") || "(root)"}: ${issue.message}`)
|
|
733
933
|
};
|
|
734
934
|
return {
|
|
735
935
|
ok: true,
|
|
736
936
|
pack: {
|
|
737
937
|
dir: packDir,
|
|
738
|
-
|
|
739
|
-
fingerprint: packFingerprint(read.
|
|
740
|
-
|
|
938
|
+
header: header.data,
|
|
939
|
+
fingerprint: packFingerprint(read.filesByPath),
|
|
940
|
+
filesByPath: read.filesByPath,
|
|
941
|
+
prFlows: parseSection(PackPrFlows, header.data.prFlows, "prFlows"),
|
|
942
|
+
ui: withPanelFilesPresent(parseSection(PackUi, header.data.ui, "ui"), read.filesByPath),
|
|
943
|
+
missingRequires: await missingRequires(header.data.requires, env)
|
|
741
944
|
}
|
|
742
945
|
};
|
|
743
946
|
}
|
|
744
|
-
function readPackDir(packDir, env) {
|
|
947
|
+
async function readPackDir(packDir, env) {
|
|
745
948
|
const absoluteDir = path.resolve(packDir);
|
|
746
949
|
try {
|
|
747
|
-
return readPackDirUnguarded(absoluteDir, env);
|
|
950
|
+
return await readPackDirUnguarded(absoluteDir, env);
|
|
748
951
|
} catch (error) {
|
|
749
952
|
return {
|
|
750
953
|
ok: false,
|
|
@@ -752,46 +955,121 @@ function readPackDir(packDir, env) {
|
|
|
752
955
|
};
|
|
753
956
|
}
|
|
754
957
|
}
|
|
755
|
-
function packDirsUnder(homeDir) {
|
|
958
|
+
async function packDirsUnder(homeDir) {
|
|
756
959
|
const packsDir = path.join(homeDir, PACKS_DIR_NAME);
|
|
757
|
-
|
|
960
|
+
const entries = await fs.promises.readdir(packsDir, { withFileTypes: true }).then((dirEntries) => ({
|
|
961
|
+
ok: true,
|
|
962
|
+
dirEntries
|
|
963
|
+
}), (error) => ({
|
|
964
|
+
ok: false,
|
|
965
|
+
error
|
|
966
|
+
}));
|
|
967
|
+
if (!entries.ok && entries.error.code === "ENOENT") return {
|
|
758
968
|
packDirs: [],
|
|
759
969
|
warning: null
|
|
760
970
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
warning: `The packs folder ${packsDir} could not be read, so its packs were skipped: ${errorMessage(error)}`
|
|
770
|
-
};
|
|
971
|
+
if (!entries.ok) return {
|
|
972
|
+
packDirs: [],
|
|
973
|
+
warning: `The packs folder ${packsDir} could not be read, so its packs were skipped: ${errorMessage(entries.error)}`
|
|
974
|
+
};
|
|
975
|
+
const packDirs = [];
|
|
976
|
+
for (const entry of entries.dirEntries) {
|
|
977
|
+
const packDir = path.join(packsDir, entry.name);
|
|
978
|
+
if (await fs.promises.access(path.join(packDir, "pack.json")).then(() => true, () => false)) packDirs.push(packDir);
|
|
771
979
|
}
|
|
980
|
+
return {
|
|
981
|
+
packDirs: packDirs.sort(),
|
|
982
|
+
warning: null
|
|
983
|
+
};
|
|
772
984
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region server/packs/pack-check.ts
|
|
987
|
+
var SOURCE_PLACEHOLDERS = [
|
|
988
|
+
"prUrl",
|
|
989
|
+
"repo",
|
|
990
|
+
"number",
|
|
991
|
+
"head"
|
|
992
|
+
];
|
|
993
|
+
var PR_FLOW_PLACEHOLDERS_BY_KIND = {
|
|
994
|
+
source: SOURCE_PLACEHOLDERS,
|
|
995
|
+
action: [
|
|
996
|
+
...SOURCE_PLACEHOLDERS,
|
|
997
|
+
"itemPath",
|
|
998
|
+
"itemLine"
|
|
999
|
+
],
|
|
1000
|
+
"pr-action": [
|
|
1001
|
+
...SOURCE_PLACEHOLDERS,
|
|
1002
|
+
"headRef",
|
|
1003
|
+
"baseRef"
|
|
1004
|
+
]
|
|
1005
|
+
};
|
|
1006
|
+
async function checkPack(packDir, env, isApprovedFingerprint) {
|
|
1007
|
+
const read = await readPackDir(packDir, env);
|
|
1008
|
+
if (!read.ok) return {
|
|
1009
|
+
packDir: path.resolve(packDir),
|
|
1010
|
+
name: null,
|
|
1011
|
+
isApproved: false,
|
|
1012
|
+
errors: read.errors,
|
|
1013
|
+
missingRequires: [],
|
|
1014
|
+
entries: [],
|
|
1015
|
+
rules: [],
|
|
1016
|
+
panels: [],
|
|
1017
|
+
themes: []
|
|
1018
|
+
};
|
|
1019
|
+
const { pack } = read;
|
|
1020
|
+
const { prFlowsPacks, warnings: prFlowsErrors } = prFlowsPacksOf([pack]);
|
|
1021
|
+
const ui = pack.ui?.ok ? pack.ui.value : {
|
|
1022
|
+
panels: [],
|
|
1023
|
+
themes: []
|
|
1024
|
+
};
|
|
1025
|
+
const report = {
|
|
1026
|
+
packDir: pack.dir,
|
|
1027
|
+
name: `${pack.header.name} v${pack.header.version}`,
|
|
1028
|
+
isApproved: isApprovedFingerprint(pack.fingerprint),
|
|
1029
|
+
errors: [...prFlowsErrors, ...uiSectionErrors(pack)],
|
|
1030
|
+
missingRequires: pack.missingRequires,
|
|
1031
|
+
entries: [],
|
|
1032
|
+
rules: [],
|
|
1033
|
+
panels: ui.panels.map((panel) => `${panel.id} (${panel.label}) opens ${panel.entry}${panel.reads.length === 0 ? ", reads nothing" : `, reads ${panel.reads.join(", ")}`}`),
|
|
1034
|
+
themes: ui.themes.map((theme) => `${theme.id} (${theme.label}, ${theme.mode})`)
|
|
1035
|
+
};
|
|
1036
|
+
const [prFlowsPack] = prFlowsPacks;
|
|
1037
|
+
if (!prFlowsPack) return report;
|
|
1038
|
+
const approval = packApproval(prFlowsPack);
|
|
1039
|
+
const entries = (approval.pack?.commands ?? []).map((command) => {
|
|
1040
|
+
const names = PR_FLOW_PLACEHOLDERS_BY_KIND[command.kind];
|
|
1041
|
+
const expanded = expandPlaceholders(command.command, Object.fromEntries(names.map((placeholderName) => [placeholderName, `{${placeholderName}}`])));
|
|
1042
|
+
const error = expanded.ok ? null : `{${expanded.unknown}} is not a placeholder here; use {packDir}, ${names.map((placeholderName) => `{${placeholderName}}`).join(", ")}`;
|
|
1043
|
+
return {
|
|
1044
|
+
kind: command.kind,
|
|
1045
|
+
id: command.id,
|
|
1046
|
+
label: command.label,
|
|
1047
|
+
argv: command.command,
|
|
1048
|
+
error
|
|
1049
|
+
};
|
|
1050
|
+
});
|
|
1051
|
+
const { section } = prFlowsPack;
|
|
790
1052
|
return {
|
|
791
|
-
|
|
792
|
-
|
|
1053
|
+
...report,
|
|
1054
|
+
errors: [...report.errors, ...unknownActionWarnings(section.rules, new Set(section.actions.map((action) => action.id)))],
|
|
1055
|
+
entries,
|
|
1056
|
+
rules: approval.pack?.rules ?? []
|
|
793
1057
|
};
|
|
794
1058
|
}
|
|
1059
|
+
function packCheckHasProblem(report) {
|
|
1060
|
+
return report.errors.length > 0 || report.missingRequires.length > 0 || report.entries.some((entry) => entry.error !== null);
|
|
1061
|
+
}
|
|
1062
|
+
function packReportText(report) {
|
|
1063
|
+
return [
|
|
1064
|
+
report.name === null ? `Checked the pack at ${report.packDir}` : `Checked pack ${report.name} at ${report.packDir}, ${report.isApproved ? "approved" : "waits for approval in Settings, Packs"}`,
|
|
1065
|
+
...report.panels.map((panel) => `panel ${panel}`),
|
|
1066
|
+
...report.themes.map((theme) => `theme ${theme}`),
|
|
1067
|
+
...report.entries.map((entry) => `${entry.kind} ${entry.id} (${entry.label}): ${entry.error === null ? `valid\n would run ${JSON.stringify(entry.argv)}` : `invalid, ${entry.error}`}`),
|
|
1068
|
+
...report.rules.map((rule) => `rule ${rule}`),
|
|
1069
|
+
...report.errors.map((error) => `error: ${error}`),
|
|
1070
|
+
...report.missingRequires.map((missing) => `missing on this machine: ${missing}, so the pack stays off here`)
|
|
1071
|
+
].join("\n");
|
|
1072
|
+
}
|
|
795
1073
|
//#endregion
|
|
796
1074
|
//#region server/github/pr-flows-external.ts
|
|
797
1075
|
var OUTPUT_MAX_BYTES = 1048576;
|
|
@@ -934,4 +1212,4 @@ function createPrFlowsExternal({ homeDir, baseEnv = () => process.env, runComman
|
|
|
934
1212
|
};
|
|
935
1213
|
}
|
|
936
1214
|
//#endregion
|
|
937
|
-
export {
|
|
1215
|
+
export { prActionRunAfterExit as A, unknownActionWarnings as B, expandPlaceholders as C, mergeItems as D, itemLocation as E, savedRuleFor as F, withPrActionRun as G, withHandled as H, shouldTellBranchMoved as I, withReopened as K, sourceCandidates as L, prFlowCommands as M, prFlowRules as N, packPathsOf as O, prFlowSetup as P, teammateThreadItems as R, commandFingerprint as S, flaggingReviewers as T, withInterruptedRuns as U, visibleRun as V, withOnlyOpenPrs as W, packFileMime as _, packReportText as a, acceptReport as b, packsStatePath as c, PackHeader as d, PacksState as f, approvedPackThemes as g, approvedPackPanels as h, packCheckHasProblem as i, prActionsForRepo as j, plannedActions as k, readPackDir as l, PACK_PANEL_CONTENT_POLICY as m, PR_FLOW_PLACEHOLDERS_BY_KIND as n, PACKS_DIR_NAME as o, packJsonSchemaText as p, withRuleRun as q, checkPack as r, packDirsUnder as s, createPrFlowsExternal as t, PACK_FILE_NAME as u, packRow as v, fixLocallyPrompt as w, branchMovedNote as x, pendingPackNote as y, threadCandidates as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as errorLabel, r as errorMessage } from "./text-DoirglWV.js";
|
|
2
|
-
import {
|
|
2
|
+
import { d as equalsIgnoringCaseOnWindows } from "./runtime-paths-DfoHzN15.js";
|
|
3
3
|
import { n as isRecord } from "./coerce-oz_Z_6E7.js";
|
|
4
4
|
import { a as jsonStateLoadError, d as writeJsonAtomicSync, l as sleepSync, s as loadJsonStateFileSync, u as writeJsonAtomic } from "./json-file-AKRVPqG1.js";
|
|
5
|
-
import { b as DEFAULT_TIMER_FNS, o as glimmervoidHomeDir, wt as canonicalizePath, x as unrefTimer } from "./config-store-
|
|
5
|
+
import { b as DEFAULT_TIMER_FNS, o as glimmervoidHomeDir, wt as canonicalizePath, x as unrefTimer } from "./config-store-1YxK7Fcc.js";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import crypto from "node:crypto";
|
|
@@ -49,6 +49,7 @@ function computeRuntimePaths({ moduleFile, hasPackageJson }) {
|
|
|
49
49
|
assetRoot,
|
|
50
50
|
clientDir: path.join(distDir, "client"),
|
|
51
51
|
cliPath: path.join(assetRoot, "bin", `glimmervoid${sourceExtension}`),
|
|
52
|
+
examplePacksDir: path.join(assetRoot, "examples", "packs"),
|
|
52
53
|
relayPath: (relayName) => path.join(assetRoot, "session", `${relayName}${sourceExtension}`)
|
|
53
54
|
};
|
|
54
55
|
}
|
|
@@ -63,7 +64,7 @@ function hasPackageManifest(directory) {
|
|
|
63
64
|
return false;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
var { assetRoot, bundled, cliPath, clientDir, packageRoot, relayPath } = computeRuntimePaths({
|
|
67
|
+
var { assetRoot, bundled, cliPath, clientDir, examplePacksDir, packageRoot, relayPath } = computeRuntimePaths({
|
|
67
68
|
moduleFile: fileURLToPath(import.meta.url),
|
|
68
69
|
hasPackageJson: hasPackageManifest
|
|
69
70
|
});
|
|
@@ -105,4 +106,4 @@ function readFfmpegPath() {
|
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
//#endregion
|
|
108
|
-
export {
|
|
109
|
+
export { examplePacksDir as a, resolveFfmpegPath as c, equalsIgnoringCaseOnWindows as d, isPathInside as f, clientDir as i, resolvePackageBin as l, sanitizeWorktreeName as m, bundled as n, packageRoot as o, safePathSegment as p, cliPath as r, relayPath as s, assetRoot as t, caseFoldedPathKey as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { l as resolvePackageBin } from "./runtime-paths-DfoHzN15.js";
|