@reddoorla/maintenance 0.75.1 → 0.78.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.
Files changed (157) hide show
  1. package/README.md +34 -7
  2. package/dist/{announce-V6EYPPUR.js → announce-RUT247HS.js} +9 -6
  3. package/dist/{announce-V6EYPPUR.js.map → announce-RUT247HS.js.map} +1 -1
  4. package/dist/{blux-C24OVDDW.js → blux-2P4FGCUL.js} +1867 -277
  5. package/dist/blux-2P4FGCUL.js.map +1 -0
  6. package/dist/{bump-deps-OQR3IXLN.js → bump-deps-XB2LJTVN.js} +3 -3
  7. package/dist/{chunk-RHPDQW6D.js → chunk-2SLED3NB.js} +1 -1
  8. package/dist/{chunk-RHPDQW6D.js.map → chunk-2SLED3NB.js.map} +1 -1
  9. package/dist/chunk-37S6L6G4.js +170 -0
  10. package/dist/chunk-37S6L6G4.js.map +1 -0
  11. package/dist/{chunk-HIN3P4ZN.js → chunk-4SOCPK7A.js} +10 -1
  12. package/dist/chunk-4SOCPK7A.js.map +1 -0
  13. package/dist/{run-migration-LJNNZWIV.js → chunk-6DOFNDXU.js} +5 -3
  14. package/dist/chunk-6DOFNDXU.js.map +1 -0
  15. package/dist/{chunk-NUIBQPB3.js → chunk-6SZBNALD.js} +62 -9
  16. package/dist/chunk-6SZBNALD.js.map +1 -0
  17. package/dist/{chunk-CASCWQQX.js → chunk-73UFRZKY.js} +34 -19
  18. package/dist/chunk-73UFRZKY.js.map +1 -0
  19. package/dist/{chunk-D3DQFC32.js → chunk-ATJ6ZA2V.js} +2 -2
  20. package/dist/{chunk-ZO7WNY57.js → chunk-B5ZUQZFL.js} +2 -2
  21. package/dist/{chunk-PH3AGF4Z.js → chunk-DC5H7KEQ.js} +2 -2
  22. package/dist/chunk-DRDAEELJ.js +197 -0
  23. package/dist/chunk-DRDAEELJ.js.map +1 -0
  24. package/dist/{chunk-IDBMYDVH.js → chunk-FVVGDIGX.js} +6 -4
  25. package/dist/{chunk-IDBMYDVH.js.map → chunk-FVVGDIGX.js.map} +1 -1
  26. package/dist/{chunk-7MJBTV2R.js → chunk-FX7RAMGC.js} +2 -2
  27. package/dist/{chunk-2AUUAJ5X.js → chunk-GWAOX3CU.js} +9 -9
  28. package/dist/{chunk-PKVZMFEB.js → chunk-K5JZ5KLO.js} +2 -2
  29. package/dist/{chunk-6OYICQSJ.js → chunk-KPQXB5CR.js} +9 -4
  30. package/dist/chunk-KPQXB5CR.js.map +1 -0
  31. package/dist/{chunk-BTEBRTW4.js → chunk-LS6QPANO.js} +2 -2
  32. package/dist/{chunk-2X322ZES.js → chunk-MGJ72BA4.js} +2 -2
  33. package/dist/chunk-MNDIED4M.js +137 -0
  34. package/dist/chunk-MNDIED4M.js.map +1 -0
  35. package/dist/{chunk-JCITWZQR.js → chunk-MNE374CZ.js} +2 -50
  36. package/dist/chunk-MNE374CZ.js.map +1 -0
  37. package/dist/chunk-MPBXOJ3N.js +51 -0
  38. package/dist/chunk-MPBXOJ3N.js.map +1 -0
  39. package/dist/{chunk-ZYBOT5PM.js → chunk-NT4WIP7I.js} +2 -2
  40. package/dist/{chunk-JNXCDUYB.js → chunk-Q276MZ7E.js} +3 -4
  41. package/dist/chunk-Q276MZ7E.js.map +1 -0
  42. package/dist/{chunk-GYNRZCM6.js → chunk-QG6OSL4M.js} +2 -2
  43. package/dist/{chunk-IRRZG66U.js → chunk-QMXQUL5Z.js} +34 -18
  44. package/dist/chunk-QMXQUL5Z.js.map +1 -0
  45. package/dist/{chunk-I55YWV6T.js → chunk-QWFHC3VH.js} +3 -3
  46. package/dist/{chunk-KLVMJYZZ.js → chunk-SEQA7MC3.js} +2 -2
  47. package/dist/chunk-UWJZXL2D.js +9 -0
  48. package/dist/chunk-UWJZXL2D.js.map +1 -0
  49. package/dist/{chunk-YEGHUODU.js → chunk-VSHC4HOI.js} +96 -1
  50. package/dist/chunk-VSHC4HOI.js.map +1 -0
  51. package/dist/{chunk-HBFMTM2E.js → chunk-YIQ7IWE3.js} +3 -3
  52. package/dist/{chunk-TDG5Z5OT.js → chunk-YSPA5AUT.js} +86 -13
  53. package/dist/chunk-YSPA5AUT.js.map +1 -0
  54. package/dist/{chunk-XKOZUVK2.js → chunk-ZTPPCHDB.js} +1 -1
  55. package/dist/chunk-ZTPPCHDB.js.map +1 -0
  56. package/dist/cli/bin.js +62 -24
  57. package/dist/cli/bin.js.map +1 -1
  58. package/dist/cli/commands/audit.d.ts +1 -1
  59. package/dist/cli/commands/audit.js +5 -5
  60. package/dist/client-X5WUJWDE.js +11 -0
  61. package/dist/configs/eslint.js +10 -0
  62. package/dist/configs/eslint.js.map +1 -1
  63. package/dist/{convert-to-pnpm-OVMASATZ.js → convert-to-pnpm-FZHSLUQB.js} +3 -3
  64. package/dist/{db-3QW2XEXA.js → db-JSIZYT23.js} +3 -3
  65. package/dist/{digest-LEMZS5ZK.js → digest-NQAQI34P.js} +16 -13
  66. package/dist/{digest-LEMZS5ZK.js.map → digest-NQAQI34P.js.map} +1 -1
  67. package/dist/favicon-SRHSJZ62.js +42 -0
  68. package/dist/favicon-SRHSJZ62.js.map +1 -0
  69. package/dist/forms/index.js.map +1 -1
  70. package/dist/freeze-Y5OJFOST.js +442 -0
  71. package/dist/freeze-Y5OJFOST.js.map +1 -0
  72. package/dist/{github-signals-TF3VSNIN.js → github-signals-4LWQGD5V.js} +5 -5
  73. package/dist/header-image-H4N54DHN.js +95 -0
  74. package/dist/header-image-H4N54DHN.js.map +1 -0
  75. package/dist/{health-endpoint-JZGYCMTV.js → health-endpoint-LFVE26QS.js} +3 -3
  76. package/dist/index.d.ts +65 -3
  77. package/dist/index.js +86 -31
  78. package/dist/index.js.map +1 -1
  79. package/dist/{init-Y2DMKKE7.js → init-KF4QHMWQ.js} +12 -12
  80. package/dist/{launch-ZDX7UA3Y.js → launch-CVCIP5NU.js} +11 -8
  81. package/dist/launch-CVCIP5NU.js.map +1 -0
  82. package/dist/migrate-LJUFGXQZ.js +7 -0
  83. package/dist/{onboard-PX36YDZA.js → onboard-RDGHVCNG.js} +3 -3
  84. package/dist/{orchestrate-NYRYEKQM.js → orchestrate-QOQXOJLI.js} +7 -6
  85. package/dist/{preflight-JCQFKB6M.js → preflight-2PWVVIRR.js} +8 -7
  86. package/dist/{preflight-JCQFKB6M.js.map → preflight-2PWVVIRR.js.map} +1 -1
  87. package/dist/protection-audit-X3BHT2MB.js +140 -0
  88. package/dist/protection-audit-X3BHT2MB.js.map +1 -0
  89. package/dist/recipes/sync-configs.d.ts +1 -1
  90. package/dist/recipes/sync-configs.js +3 -3
  91. package/dist/{renovate-dispatch-6II2JVOX.js → renovate-dispatch-2VYCEH42.js} +2 -2
  92. package/dist/renovate-dispatch-2VYCEH42.js.map +1 -0
  93. package/dist/{report-POHQEV6F.js → report-IU4CLJS5.js} +8 -6
  94. package/dist/{report-POHQEV6F.js.map → report-IU4CLJS5.js.map} +1 -1
  95. package/dist/reports/header-image/assets/plate.png +0 -0
  96. package/dist/run-migration-WP57U5XO.js +9 -0
  97. package/dist/run-migration-WP57U5XO.js.map +1 -0
  98. package/dist/{self-updating-2YSVNMPP.js → self-updating-ALMUWJNX.js} +5 -4
  99. package/dist/{self-updating-2YSVNMPP.js.map → self-updating-ALMUWJNX.js.map} +1 -1
  100. package/dist/{selftest-OO2WDSDM.js → selftest-PJFABZDM.js} +11 -9
  101. package/dist/{selftest-OO2WDSDM.js.map → selftest-PJFABZDM.js.map} +1 -1
  102. package/dist/{smoke-suite-CSP23NZM.js → smoke-suite-SUEJFBYP.js} +3 -3
  103. package/dist/{submissions-MDKWJYMM.js → submissions-3I3GAQAX.js} +13 -5
  104. package/dist/submissions-3I3GAQAX.js.map +1 -0
  105. package/dist/{submissions-BNRGY3JQ.js → submissions-SURN7BV5.js} +3 -3
  106. package/dist/{svelte-codemods-V54KOBWU.js → svelte-codemods-IWO7X3F3.js} +3 -3
  107. package/dist/{sync-configs-UBCJRASZ.js → sync-configs-7XGHFC6P.js} +4 -4
  108. package/dist/{types-0jreMCF5.d.ts → types-DnEL3NRn.d.ts} +1 -1
  109. package/dist/{upgrade-WR6ICPAG.js → upgrade-AM4S7JF3.js} +3 -3
  110. package/dist/webflow-624FEBFD.js +548 -0
  111. package/dist/webflow-624FEBFD.js.map +1 -0
  112. package/package.json +3 -3
  113. package/dist/blux-C24OVDDW.js.map +0 -1
  114. package/dist/chunk-6OYICQSJ.js.map +0 -1
  115. package/dist/chunk-CASCWQQX.js.map +0 -1
  116. package/dist/chunk-HIN3P4ZN.js.map +0 -1
  117. package/dist/chunk-IRRZG66U.js.map +0 -1
  118. package/dist/chunk-JCITWZQR.js.map +0 -1
  119. package/dist/chunk-JNXCDUYB.js.map +0 -1
  120. package/dist/chunk-NUIBQPB3.js.map +0 -1
  121. package/dist/chunk-TDG5Z5OT.js.map +0 -1
  122. package/dist/chunk-XKOZUVK2.js.map +0 -1
  123. package/dist/chunk-YEGHUODU.js.map +0 -1
  124. package/dist/client-NVVQK3HH.js +0 -11
  125. package/dist/launch-ZDX7UA3Y.js.map +0 -1
  126. package/dist/migrate-35DNNF3H.js +0 -7
  127. package/dist/renovate-dispatch-6II2JVOX.js.map +0 -1
  128. package/dist/run-migration-LJNNZWIV.js.map +0 -1
  129. package/dist/submissions-MDKWJYMM.js.map +0 -1
  130. /package/dist/{bump-deps-OQR3IXLN.js.map → bump-deps-XB2LJTVN.js.map} +0 -0
  131. /package/dist/{chunk-D3DQFC32.js.map → chunk-ATJ6ZA2V.js.map} +0 -0
  132. /package/dist/{chunk-ZO7WNY57.js.map → chunk-B5ZUQZFL.js.map} +0 -0
  133. /package/dist/{chunk-PH3AGF4Z.js.map → chunk-DC5H7KEQ.js.map} +0 -0
  134. /package/dist/{chunk-7MJBTV2R.js.map → chunk-FX7RAMGC.js.map} +0 -0
  135. /package/dist/{chunk-2AUUAJ5X.js.map → chunk-GWAOX3CU.js.map} +0 -0
  136. /package/dist/{chunk-PKVZMFEB.js.map → chunk-K5JZ5KLO.js.map} +0 -0
  137. /package/dist/{chunk-BTEBRTW4.js.map → chunk-LS6QPANO.js.map} +0 -0
  138. /package/dist/{chunk-2X322ZES.js.map → chunk-MGJ72BA4.js.map} +0 -0
  139. /package/dist/{chunk-ZYBOT5PM.js.map → chunk-NT4WIP7I.js.map} +0 -0
  140. /package/dist/{chunk-GYNRZCM6.js.map → chunk-QG6OSL4M.js.map} +0 -0
  141. /package/dist/{chunk-I55YWV6T.js.map → chunk-QWFHC3VH.js.map} +0 -0
  142. /package/dist/{chunk-KLVMJYZZ.js.map → chunk-SEQA7MC3.js.map} +0 -0
  143. /package/dist/{chunk-HBFMTM2E.js.map → chunk-YIQ7IWE3.js.map} +0 -0
  144. /package/dist/{client-NVVQK3HH.js.map → client-X5WUJWDE.js.map} +0 -0
  145. /package/dist/{convert-to-pnpm-OVMASATZ.js.map → convert-to-pnpm-FZHSLUQB.js.map} +0 -0
  146. /package/dist/{db-3QW2XEXA.js.map → db-JSIZYT23.js.map} +0 -0
  147. /package/dist/{github-signals-TF3VSNIN.js.map → github-signals-4LWQGD5V.js.map} +0 -0
  148. /package/dist/{health-endpoint-JZGYCMTV.js.map → health-endpoint-LFVE26QS.js.map} +0 -0
  149. /package/dist/{init-Y2DMKKE7.js.map → init-KF4QHMWQ.js.map} +0 -0
  150. /package/dist/{migrate-35DNNF3H.js.map → migrate-LJUFGXQZ.js.map} +0 -0
  151. /package/dist/{onboard-PX36YDZA.js.map → onboard-RDGHVCNG.js.map} +0 -0
  152. /package/dist/{orchestrate-NYRYEKQM.js.map → orchestrate-QOQXOJLI.js.map} +0 -0
  153. /package/dist/{smoke-suite-CSP23NZM.js.map → smoke-suite-SUEJFBYP.js.map} +0 -0
  154. /package/dist/{submissions-BNRGY3JQ.js.map → submissions-SURN7BV5.js.map} +0 -0
  155. /package/dist/{svelte-codemods-V54KOBWU.js.map → svelte-codemods-IWO7X3F3.js.map} +0 -0
  156. /package/dist/{sync-configs-UBCJRASZ.js.map → sync-configs-7XGHFC6P.js.map} +0 -0
  157. /package/dist/{upgrade-WR6ICPAG.js.map → upgrade-AM4S7JF3.js.map} +0 -0
@@ -8,21 +8,21 @@ import {
8
8
  } from "./chunk-4BHNP6Y2.js";
9
9
  import {
10
10
  init
11
- } from "./chunk-2AUUAJ5X.js";
12
- import "./chunk-2X322ZES.js";
13
- import "./chunk-BTEBRTW4.js";
11
+ } from "./chunk-GWAOX3CU.js";
12
+ import "./chunk-MGJ72BA4.js";
13
+ import "./chunk-LS6QPANO.js";
14
14
  import "./chunk-J7SZQUCW.js";
15
- import "./chunk-7MJBTV2R.js";
16
- import "./chunk-PKVZMFEB.js";
15
+ import "./chunk-FX7RAMGC.js";
16
+ import "./chunk-K5JZ5KLO.js";
17
17
  import "./chunk-KRDLHAKK.js";
18
- import "./chunk-ZYBOT5PM.js";
19
- import "./chunk-JNXCDUYB.js";
20
- import "./chunk-CASCWQQX.js";
21
- import "./chunk-XKOZUVK2.js";
18
+ import "./chunk-NT4WIP7I.js";
19
+ import "./chunk-Q276MZ7E.js";
20
+ import "./chunk-73UFRZKY.js";
21
+ import "./chunk-ZTPPCHDB.js";
22
22
  import "./chunk-OTGB6YQO.js";
23
- import "./chunk-TDG5Z5OT.js";
23
+ import "./chunk-YSPA5AUT.js";
24
24
  import "./chunk-GASBX52O.js";
25
- import "./chunk-YEGHUODU.js";
25
+ import "./chunk-VSHC4HOI.js";
26
26
  import "./chunk-LKGVSM2O.js";
27
27
  import "./chunk-FDIFTIXC.js";
28
28
  import "./chunk-HVOOCK6L.js";
@@ -105,4 +105,4 @@ async function runInitCommand(site, opts) {
105
105
  export {
106
106
  runInitCommand
107
107
  };
108
- //# sourceMappingURL=init-Y2DMKKE7.js.map
108
+ //# sourceMappingURL=init-KF4QHMWQ.js.map
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  selfUpdating
3
- } from "./chunk-IRRZG66U.js";
3
+ } from "./chunk-QMXQUL5Z.js";
4
+ import "./chunk-MNDIED4M.js";
4
5
  import {
5
6
  writeAuditsToAirtable
6
7
  } from "./chunk-JR67FZVC.js";
@@ -14,21 +15,23 @@ import {
14
15
  } from "./chunk-4BHNP6Y2.js";
15
16
  import {
16
17
  queueDraft
17
- } from "./chunk-KLVMJYZZ.js";
18
+ } from "./chunk-SEQA7MC3.js";
18
19
  import {
19
20
  createDraft,
20
21
  findReportByPeriod,
21
22
  renderReportHtml,
22
23
  resolveCopy,
23
- updateReportScores,
24
+ updateReportScores
25
+ } from "./chunk-MNE374CZ.js";
26
+ import {
24
27
  uploadAttachment
25
- } from "./chunk-JCITWZQR.js";
26
- import "./chunk-CASCWQQX.js";
28
+ } from "./chunk-MPBXOJ3N.js";
29
+ import "./chunk-73UFRZKY.js";
27
30
  import {
28
31
  runAudits
29
- } from "./chunk-TDG5Z5OT.js";
32
+ } from "./chunk-YSPA5AUT.js";
30
33
  import "./chunk-GASBX52O.js";
31
- import "./chunk-YEGHUODU.js";
34
+ import "./chunk-VSHC4HOI.js";
32
35
  import "./chunk-LKGVSM2O.js";
33
36
  import "./chunk-FDIFTIXC.js";
34
37
  import "./chunk-HVOOCK6L.js";
@@ -210,4 +213,4 @@ async function runLaunchCommand(site, opts) {
210
213
  export {
211
214
  runLaunchCommand
212
215
  };
213
- //# sourceMappingURL=launch-ZDX7UA3Y.js.map
216
+ //# sourceMappingURL=launch-CVCIP5NU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/commands/launch.ts","../src/recipes/launch.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { launch, type LaunchResult, type LaunchStepResult } from \"../../recipes/launch.js\";\nimport { resolveSites } from \"../fleet/resolve-sites.js\";\n\nexport type LaunchCommandOptions = {\n cwd?: string;\n};\n\nfunction formatStep(name: string, r: LaunchStepResult): string {\n if (r.kind === \"error\") return `${name.padEnd(20)} error: ${r.message}`;\n if (r.kind === \"audit\") {\n const s = r.scores;\n return `${name.padEnd(20)} audited (P=${s.performance} A=${s.accessibility} BP=${s.bestPractices} SEO=${s.seo})`;\n }\n if (r.kind === \"draft\") {\n return `${name.padEnd(20)} drafted ${r.report.reportId}`;\n }\n const rec = r.result;\n if (rec.status === \"noop\") return `${name.padEnd(20)} noop${rec.notes ? ` — ${rec.notes}` : \"\"}`;\n if (rec.status === \"failed\")\n return `${name.padEnd(20)} failed${rec.notes ? ` — ${rec.notes}` : \"\"}`;\n return `${name.padEnd(20)} applied (${rec.commits.length} commit${rec.commits.length === 1 ? \"\" : \"s\"})${rec.notes ? ` — ${rec.notes}` : \"\"}`;\n}\n\nfunction formatResult(r: LaunchResult): string {\n const header = `[${r.site}] launch — ${r.complete ? \"drafted (awaiting approval)\" : \"STOPPED\"}`;\n const body = r.steps.map((s) => formatStep(s.name, s.result)).join(\"\\n\");\n return `${header}\\n${body}`;\n}\n\n/**\n * `launch <site>` — single-site only. Bootstrap (Renovate + protection), first-audit\n * the site, and DRAFT its launch email into the M3 approve queue. Never sends;\n * the operator approves the draft and the next send run delivers the go-live\n * email (flipping Status → maintenance + stamping Launched at).\n */\nexport async function runLaunchCommand(\n site: string,\n opts: LaunchCommandOptions,\n): Promise<{ output: string; code: number }> {\n const cwd = opts.cwd ? resolve(opts.cwd) : process.cwd();\n const sites = await resolveSites({ site, cwd });\n const target = sites[0];\n if (!target) {\n return { output: `No site resolved for \"${site}\".`, code: 1 };\n }\n\n const result = await launch(target);\n return { output: formatResult(result), code: result.complete ? 0 : 1 };\n}\n","import type { AuditResult, RecipeResult, Site } from \"../types.js\";\nimport { siteLabel } from \"../util/site.js\";\nimport { selfUpdating } from \"./self-updating/index.js\";\nimport { runAudits } from \"../audits/index.js\";\nimport { hasRealScores, lighthouseScoresFromResult } from \"../audits/lighthouse-airtable.js\";\nimport { writeAuditsToAirtable } from \"../audits/write-audits-to-airtable.js\";\nimport { openBase, readAirtableConfig } from \"../reports/airtable/client.js\";\nimport type { AirtableBase } from \"../reports/airtable/client.js\";\nimport { listWebsites, siteSlug } from \"../reports/airtable/websites.js\";\nimport type { WebsiteRow } from \"../reports/airtable/websites.js\";\nimport {\n createDraft,\n findReportByPeriod,\n updateReportScores,\n} from \"../reports/airtable/reports.js\";\nimport type { ReportRow } from \"../reports/airtable/reports.js\";\nimport { queueDraft } from \"../reports/queue.js\";\nimport { uploadAttachment } from \"../reports/airtable/attachments.js\";\nimport { renderReportHtml } from \"../reports/render.js\";\nimport { resolveCopy } from \"../reports/copy.js\";\nimport type { LighthouseScores } from \"../reports/types.js\";\n\nexport type LaunchStepResult =\n | { kind: \"recipe\"; result: RecipeResult }\n | { kind: \"audit\"; results: AuditResult[]; scores: LighthouseScores }\n | { kind: \"draft\"; report: ReportRow }\n | { kind: \"error\"; message: string };\n\nexport type LaunchResult = {\n site: string;\n steps: Array<{ name: string; result: LaunchStepResult }>;\n /** True if every step ran (bootstrap + audit + draft); false if a step\n * errored or a recipe `failed` short-circuited the chain. */\n complete: boolean;\n};\n\nexport type LaunchDeps = {\n /** Bootstrap step (Renovate + protection; ci.yml comes from the starter). Defaults to the real `selfUpdating`. */\n bootstrap?: (site: Site) => Promise<RecipeResult>;\n /** Audit step. Defaults to the real `runAudits`. */\n audit?: (site: Site) => Promise<AuditResult[]>;\n /** Airtable handle. Defaults to opening the live base from credentials. */\n base?: AirtableBase;\n};\n\n/**\n * Launch a site: bootstrap → first-audit → DRAFT a launch email. The M3\n * approve loop is what actually sends; `launch` never sends — it stops at a\n * dashboard-queued draft (`reportType: \"Launch\"`) carrying the just-audited\n * Lighthouse scores, so `sendOne`'s `report.lighthouse` guard passes.\n *\n * Step-chain (mirrors `init`), stopping on the first error or `failed` recipe:\n * 1. selfUpdating — Renovate + protection (platform auto-merge OFF; ci.yml is the starter's).\n * 2. runAudits + write the scores to the site's Websites row (reuses the\n * `audit --write-airtable` writer); the Lighthouse scores feed the draft.\n * 3. createDraft — reportType \"Launch\", today's period, the audited scores.\n */\nexport async function launch(site: Site, deps: LaunchDeps = {}): Promise<LaunchResult> {\n const label = siteLabel(site);\n const bootstrap = deps.bootstrap ?? selfUpdating;\n const audit = deps.audit ?? runAudits;\n const base = deps.base ?? openBase(readAirtableConfig());\n\n const steps: Array<{ name: string; result: LaunchStepResult }> = [];\n const stop = (): LaunchResult => ({ site: label, steps, complete: false });\n\n // 1. Bootstrap.\n let recipe: RecipeResult;\n try {\n recipe = await bootstrap(site);\n } catch (err) {\n steps.push({ name: \"self-updating\", result: errorOf(err) });\n return stop();\n }\n steps.push({ name: \"self-updating\", result: { kind: \"recipe\", result: recipe } });\n if (recipe.status === \"failed\") return stop();\n\n // 2. Audit + write scores back to Airtable.\n let results: AuditResult[];\n try {\n results = await audit(site);\n } catch (err) {\n steps.push({ name: \"audit\", result: errorOf(err) });\n return stop();\n }\n const lhResult = results.find((r) => r.audit === \"lighthouse\");\n if (!lhResult || !hasRealScores(lhResult)) {\n steps.push({\n name: \"audit\",\n result: { kind: \"error\", message: \"lighthouse audit produced no real scores\" },\n });\n return stop();\n }\n // The launch announcement renders a numeric score per category; a metric that\n // errored this run (now null from lighthouseScoresFromResult) keeps the prior\n // 0 behavior here rather than propagating null into the launch-email path. The\n // Airtable write path (write-audits-to-airtable) keeps the null → shows \"—\".\n const rawScores = lighthouseScoresFromResult(lhResult);\n const scores: LighthouseScores = {\n performance: rawScores.performance ?? 0,\n accessibility: rawScores.accessibility ?? 0,\n bestPractices: rawScores.bestPractices ?? 0,\n seo: rawScores.seo ?? 0,\n };\n\n const websites = await listWebsites(base);\n const target = websites.find((w) => siteSlug(w.name) === siteSlug(label));\n if (!target) {\n steps.push({\n name: \"audit\",\n result: { kind: \"error\", message: `no Websites row matched site \"${label}\"` },\n });\n return stop();\n }\n try {\n await writeAuditsToAirtable({ base, websites, slug: siteSlug(target.name), results });\n } catch (err) {\n steps.push({ name: \"audit\", result: errorOf(err) });\n return stop();\n }\n steps.push({ name: \"audit\", result: { kind: \"audit\", results, scores } });\n\n // 3. Draft the launch email (reuses draft.ts's reportId/period scheme). DRAFTS\n // ONLY — the M3 approve loop sends it and flips Status on send.\n const today = new Date();\n const period = today.toISOString().slice(0, 7);\n const slug = siteSlug(target.name);\n\n let report: ReportRow;\n try {\n // Re-run dedupe: reuse an existing Launch row for this (site, period) instead\n // of stacking a second draft. findReportByPeriod is the same idempotency\n // lookup draft.ts documents (dashboard/digest point lookup).\n const existing = await findReportByPeriod(base, target.id, \"Launch\", period);\n if (existing) {\n // Reuse path: the row was created on a prior run with THAT run's scores. This\n // re-run just produced fresh audit scores AND will re-render the preview from\n // them — so refresh the row's Lighthouse cells (+ Completed on) to match,\n // otherwise the sent email (which reads the row) ships stale scores. The\n // create path already writes fresh scores via createDraft.\n await updateReportScores(base, existing.id, scores, today);\n report = existing;\n } else {\n report = await createDraft(base, draftInputFor(target, scores, today, period));\n }\n } catch (err) {\n steps.push({ name: \"draft\", result: errorOf(err) });\n return stop();\n }\n\n // Mirror draft.ts:135-154 — render → upload \"Rendered HTML\" preview → flip\n // Draft ready. Without setDraftReady the draft never enters the approve queue\n // (every pending-approval gate requires draftReady true), so it can never be\n // approved or sent. The upload is a review convenience; the ready flag is the\n // critical step.\n try {\n const { html } = await renderReportHtml({\n siteName: target.name,\n siteUrl: target.url,\n reportType: \"Launch\",\n completedOn: today,\n lighthouse: scores,\n lastTestedDate: null,\n commentary: null,\n copy: resolveCopy(target),\n headerImageCid: `${slug}-header`,\n });\n // A preview-upload hiccup must NOT fail the launch — log and continue.\n try {\n await uploadAttachment(\n report.id,\n \"Rendered HTML\",\n html,\n `${slug}-${today.toISOString().slice(0, 10)}.html`,\n \"text/html\",\n );\n } catch (uploadErr) {\n console.warn(\n `⚠ Launch preview upload skipped for ${target.name}: ${\n uploadErr instanceof Error ? uploadErr.message : String(uploadErr)\n }`,\n );\n }\n // Critical: NOT wrapped — a failure here must surface as a failed launch. queueDraft\n // supersedes any lower-tier (Maintenance/Testing) drafts queued for this site; a Launch is\n // top tier so it only stands down if another Launch/Announcement is already queued.\n await queueDraft(base, { id: report.id, siteId: target.id, reportType: \"Launch\" });\n } catch (err) {\n steps.push({ name: \"draft\", result: errorOf(err) });\n return stop();\n }\n\n steps.push({ name: \"draft\", result: { kind: \"draft\", report } });\n\n return { site: label, steps, complete: true };\n}\n\n/** Build the Launch `DraftInput`. reportId/period mirror `draftReportForSite`\n * (draft.ts) — do not invent a new id scheme. `today`/`period` are threaded in\n * from `launch()` so a single timestamp drives the render, the draft, the\n * dedupe lookup, and the preview filename. Launch reports have no period window\n * and no prior maintenance test, so periodStart/periodEnd/completedOn all\n * collapse to \"today\" and `lastTestedDate` is null. */\nfunction draftInputFor(\n target: WebsiteRow,\n scores: LighthouseScores,\n today: Date,\n period: string,\n): Parameters<typeof createDraft>[1] {\n const reportType = \"Launch\" as const;\n const reportId = `${target.name} — ${reportType} — ${today.toISOString().slice(0, 10)}`;\n return {\n reportId,\n siteId: target.id,\n reportType,\n period,\n periodStart: today,\n periodEnd: today,\n completedOn: today,\n lighthouse: scores,\n lastTestedDate: null,\n };\n}\n\nfunction errorOf(err: unknown): LaunchStepResult {\n return { kind: \"error\", message: err instanceof Error ? err.message : String(err) };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;;;ACyDxB,eAAsB,OAAO,MAAY,OAAmB,CAAC,GAA0B;AACrF,QAAM,QAAQ,UAAU,IAAI;AAC5B,QAAM,YAAY,KAAK,aAAa;AACpC,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,OAAO,KAAK,QAAQ,SAAS,mBAAmB,CAAC;AAEvD,QAAM,QAA2D,CAAC;AAClE,QAAM,OAAO,OAAqB,EAAE,MAAM,OAAO,OAAO,UAAU,MAAM;AAGxE,MAAI;AACJ,MAAI;AACF,aAAS,MAAM,UAAU,IAAI;AAAA,EAC/B,SAAS,KAAK;AACZ,UAAM,KAAK,EAAE,MAAM,iBAAiB,QAAQ,QAAQ,GAAG,EAAE,CAAC;AAC1D,WAAO,KAAK;AAAA,EACd;AACA,QAAM,KAAK,EAAE,MAAM,iBAAiB,QAAQ,EAAE,MAAM,UAAU,QAAQ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AAI,WAAW;AACjB,WAAO,GAAG,KAAK,OAAO,EAAE,CAAC,UAAU,IAAI,QAAQ,WAAM,IAAI,KAAK,KAAK,EAAE;AACvE,SAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,IAAI,QAAQ,MAAM,UAAU,IAAI,QAAQ,WAAW,IAAI,KAAK,GAAG,IAAI,IAAI,QAAQ,WAAM,IAAI,KAAK,KAAK,EAAE;AAC7I;AAEA,SAAS,aAAa,GAAyB;AAC7C,QAAM,SAAS,IAAI,EAAE,IAAI,mBAAc,EAAE,WAAW,gCAAgC,SAAS;AAC7F,QAAM,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,IAAI;AACvE,SAAO,GAAG,MAAM;AAAA,EAAK,IAAI;AAC3B;AAQA,eAAsB,iBACpB,MACA,MAC2C;AAC3C,QAAM,MAAM,KAAK,MAAM,QAAQ,KAAK,GAAG,IAAI,QAAQ,IAAI;AACvD,QAAM,QAAQ,MAAM,aAAa,EAAE,MAAM,IAAI,CAAC;AAC9C,QAAM,SAAS,MAAM,CAAC;AACtB,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,QAAQ,yBAAyB,IAAI,MAAM,MAAM,EAAE;AAAA,EAC9D;AAEA,QAAM,SAAS,MAAM,OAAO,MAAM;AAClC,SAAO,EAAE,QAAQ,aAAa,MAAM,GAAG,MAAM,OAAO,WAAW,IAAI,EAAE;AACvE;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ runMigrations
3
+ } from "./chunk-4SOCPK7A.js";
4
+ export {
5
+ runMigrations
6
+ };
7
+ //# sourceMappingURL=migrate-LJUFGXQZ.js.map
@@ -11,8 +11,8 @@ import {
11
11
  } from "./chunk-4BHNP6Y2.js";
12
12
  import {
13
13
  onboard
14
- } from "./chunk-ZYBOT5PM.js";
15
- import "./chunk-XKOZUVK2.js";
14
+ } from "./chunk-NT4WIP7I.js";
15
+ import "./chunk-ZTPPCHDB.js";
16
16
  import "./chunk-OTGB6YQO.js";
17
17
  import "./chunk-LKGVSM2O.js";
18
18
  import "./chunk-FDIFTIXC.js";
@@ -70,4 +70,4 @@ async function runOnboardCommand(site, opts) {
70
70
  export {
71
71
  runOnboardCommand
72
72
  };
73
- //# sourceMappingURL=onboard-PX36YDZA.js.map
73
+ //# sourceMappingURL=onboard-RDGHVCNG.js.map
@@ -4,13 +4,14 @@ import {
4
4
  parseAddresses,
5
5
  sendApprovedReports,
6
6
  withGlobalCc
7
- } from "./chunk-IDBMYDVH.js";
7
+ } from "./chunk-FVVGDIGX.js";
8
8
  import "./chunk-GECESMVS.js";
9
- import "./chunk-JCITWZQR.js";
9
+ import "./chunk-MNE374CZ.js";
10
+ import "./chunk-MPBXOJ3N.js";
10
11
  import "./chunk-WEKL2HYJ.js";
11
- import "./chunk-GYNRZCM6.js";
12
- import "./chunk-PH3AGF4Z.js";
13
- import "./chunk-HIN3P4ZN.js";
12
+ import "./chunk-QG6OSL4M.js";
13
+ import "./chunk-DC5H7KEQ.js";
14
+ import "./chunk-4SOCPK7A.js";
14
15
  import "./chunk-U5SZ4FOP.js";
15
16
  import "./chunk-GXVX4HUH.js";
16
17
  import "./chunk-HN6I2XWI.js";
@@ -22,4 +23,4 @@ export {
22
23
  sendApprovedReports,
23
24
  withGlobalCc
24
25
  };
25
- //# sourceMappingURL=orchestrate-NYRYEKQM.js.map
26
+ //# sourceMappingURL=orchestrate-QOQXOJLI.js.map
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  preflight
3
- } from "./chunk-HBFMTM2E.js";
3
+ } from "./chunk-YIQ7IWE3.js";
4
4
  import "./chunk-D4FVAIEJ.js";
5
- import "./chunk-IDBMYDVH.js";
5
+ import "./chunk-FVVGDIGX.js";
6
6
  import "./chunk-GECESMVS.js";
7
- import "./chunk-JCITWZQR.js";
7
+ import "./chunk-MNE374CZ.js";
8
+ import "./chunk-MPBXOJ3N.js";
8
9
  import "./chunk-WEKL2HYJ.js";
9
- import "./chunk-GYNRZCM6.js";
10
- import "./chunk-PH3AGF4Z.js";
11
- import "./chunk-HIN3P4ZN.js";
10
+ import "./chunk-QG6OSL4M.js";
11
+ import "./chunk-DC5H7KEQ.js";
12
+ import "./chunk-4SOCPK7A.js";
12
13
  import "./chunk-U5SZ4FOP.js";
13
14
  import "./chunk-GXVX4HUH.js";
14
15
  import "./chunk-HN6I2XWI.js";
@@ -61,4 +62,4 @@ async function runPreflightCommand(site, opts) {
61
62
  export {
62
63
  runPreflightCommand
63
64
  };
64
- //# sourceMappingURL=preflight-JCQFKB6M.js.map
65
+ //# sourceMappingURL=preflight-2PWVVIRR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/preflight.ts"],"sourcesContent":["import {\n preflight,\n type PreflightSiteResult,\n type PreflightFinding,\n} from \"../../reports/preflight.js\";\nimport type { ReportType } from \"../../reports/types.js\";\n\nexport type PreflightCommandOptions = {\n type?: string;\n all?: boolean;\n cwd?: string;\n};\n\nconst TYPES: Record<string, ReportType> = {\n announcement: \"Announcement\",\n maintenance: \"Maintenance\",\n testing: \"Testing\",\n};\n\nconst MARK: Record<PreflightFinding[\"level\"], string> = { fail: \"✗\", warn: \"⚠\", info: \"ℹ\" };\n\nfunction formatSite(r: PreflightSiteResult): string {\n if (r.findings.length === 0) return `[${r.site}] ✓ clean`;\n return r.findings.map((f) => `[${r.site}] ${MARK[f.level]} ${f.check}: ${f.message}`).join(\"\\n\");\n}\n\n/**\n * `preflight [site]` — read-only pre-send checks over the live Airtable rows: everything\n * that would make a report send fail, reach the wrong inbox, or surprise the operator.\n * Exit 0 = safe (warnings allowed, printed), 1 = at least one hard failure, 2 = bad args.\n */\nexport async function runPreflightCommand(\n site: string | undefined,\n opts: PreflightCommandOptions,\n): Promise<{ output: string; code: number }> {\n if (Boolean(site) === Boolean(opts.all)) {\n return { output: \"Provide exactly one of <site> or --all.\", code: 2 };\n }\n const typeKey = (opts.type ?? \"announcement\").toLowerCase();\n const type = TYPES[typeKey];\n if (!type) {\n return {\n output: `Unknown --type '${opts.type}'. Supported: ${Object.keys(TYPES).join(\", \")}`,\n code: 2,\n };\n }\n\n try {\n const { results, fleet } = await preflight({\n ...(site ? { site } : {}),\n ...(opts.all ? { all: true } : {}),\n type,\n });\n if (results.length === 0) return { output: \"No matching sites.\", code: 1 };\n\n const lines = results.map(formatSite);\n for (const f of fleet) lines.push(`[fleet] ${MARK[f.level]} ${f.check}: ${f.message}`);\n\n const all = [...results.flatMap((r) => r.findings), ...fleet];\n const fails = all.filter((f) => f.level === \"fail\").length;\n const warns = all.filter((f) => f.level === \"warn\").length;\n lines.push(\n `Preflight: ${results.length} site(s) — ${fails} fail, ${warns} warn. ${\n fails > 0 ? \"NOT safe to send.\" : \"Safe to send (review warnings).\"\n }`,\n );\n return { output: lines.join(\"\\n\"), code: fails > 0 ? 1 : 0 };\n } catch (err) {\n const e = err as { message?: string; exitCode?: number };\n return { output: e.message ?? String(err), code: e.exitCode ?? 1 };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAaA,IAAM,QAAoC;AAAA,EACxC,cAAc;AAAA,EACd,aAAa;AAAA,EACb,SAAS;AACX;AAEA,IAAM,OAAkD,EAAE,MAAM,UAAK,MAAM,UAAK,MAAM,SAAI;AAE1F,SAAS,WAAW,GAAgC;AAClD,MAAI,EAAE,SAAS,WAAW,EAAG,QAAO,IAAI,EAAE,IAAI;AAC9C,SAAO,EAAE,SAAS,IAAI,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,IAAI;AACjG;AAOA,eAAsB,oBACpB,MACA,MAC2C;AAC3C,MAAI,QAAQ,IAAI,MAAM,QAAQ,KAAK,GAAG,GAAG;AACvC,WAAO,EAAE,QAAQ,2CAA2C,MAAM,EAAE;AAAA,EACtE;AACA,QAAM,WAAW,KAAK,QAAQ,gBAAgB,YAAY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flight,\n type PreflightSiteResult,\n type PreflightFinding,\n} from \"../../reports/preflight.js\";\nimport type { ReportType } from \"../../reports/types.js\";\n\nexport type PreflightCommandOptions = {\n type?: string;\n all?: boolean;\n cwd?: string;\n};\n\nconst TYPES: Record<string, ReportType> = {\n announcement: \"Announcement\",\n maintenance: \"Maintenance\",\n testing: \"Testing\",\n};\n\nconst MARK: Record<PreflightFinding[\"level\"], string> = { fail: \"✗\", warn: \"⚠\", info: \"ℹ\" };\n\nfunction formatSite(r: PreflightSiteResult): string {\n if (r.findings.length === 0) return `[${r.site}] ✓ clean`;\n return r.findings.map((f) => `[${r.site}] ${MARK[f.level]} ${f.check}: ${f.message}`).join(\"\\n\");\n}\n\n/**\n * `preflight [site]` — read-only pre-send checks over the live Airtable rows: everything\n * that would make a report send fail, reach the wrong inbox, or surprise the operator.\n * Exit 0 = safe (warnings allowed, printed), 1 = at least one hard failure, 2 = bad args.\n */\nexport async function runPreflightCommand(\n site: string | undefined,\n opts: PreflightCommandOptions,\n): Promise<{ output: string; code: number }> {\n if (Boolean(site) === Boolean(opts.all)) {\n return { output: \"Provide exactly one of <site> or --all.\", code: 2 };\n }\n const typeKey = (opts.type ?? \"announcement\").toLowerCase();\n const type = TYPES[typeKey];\n if (!type) {\n return {\n output: `Unknown --type '${opts.type}'. Supported: ${Object.keys(TYPES).join(\", \")}`,\n code: 2,\n };\n }\n\n try {\n const { results, fleet } = await preflight({\n ...(site ? { site } : {}),\n ...(opts.all ? { all: true } : {}),\n type,\n });\n if (results.length === 0) return { output: \"No matching sites.\", code: 1 };\n\n const lines = results.map(formatSite);\n for (const f of fleet) lines.push(`[fleet] ${MARK[f.level]} ${f.check}: ${f.message}`);\n\n const all = [...results.flatMap((r) => r.findings), ...fleet];\n const fails = all.filter((f) => f.level === \"fail\").length;\n const warns = all.filter((f) => f.level === \"warn\").length;\n lines.push(\n `Preflight: ${results.length} site(s) — ${fails} fail, ${warns} warn. ${\n fails > 0 ? \"NOT safe to send.\" : \"Safe to send (review warnings).\"\n }`,\n );\n return { output: lines.join(\"\\n\"), code: fails > 0 ? 1 : 0 };\n } catch (err) {\n const e = err as { message?: string; exitCode?: number };\n return { output: e.message ?? String(err), code: e.exitCode ?? 1 };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,IAAM,QAAoC;AAAA,EACxC,cAAc;AAAA,EACd,aAAa;AAAA,EACb,SAAS;AACX;AAEA,IAAM,OAAkD,EAAE,MAAM,UAAK,MAAM,UAAK,MAAM,SAAI;AAE1F,SAAS,WAAW,GAAgC;AAClD,MAAI,EAAE,SAAS,WAAW,EAAG,QAAO,IAAI,EAAE,IAAI;AAC9C,SAAO,EAAE,SAAS,IAAI,CAAC,MAAM,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,IAAI;AACjG;AAOA,eAAsB,oBACpB,MACA,MAC2C;AAC3C,MAAI,QAAQ,IAAI,MAAM,QAAQ,KAAK,GAAG,GAAG;AACvC,WAAO,EAAE,QAAQ,2CAA2C,MAAM,EAAE;AAAA,EACtE;AACA,QAAM,WAAW,KAAK,QAAQ,gBAAgB,YAAY;AAC1D,QAAM,OAAO,MAAM,OAAO;AAC1B,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,MACL,QAAQ,mBAAmB,KAAK,IAAI,iBAAiB,OAAO,KAAK,KAAK,EAAE,KAAK,IAAI,CAAC;AAAA,MAClF,MAAM;AAAA,IACR;AAAA,EACF;AAEA,MAAI;AACF,UAAM,EAAE,SAAS,MAAM,IAAI,MAAM,UAAU;AAAA,MACzC,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,MACvB,GAAI,KAAK,MAAM,EAAE,KAAK,KAAK,IAAI,CAAC;AAAA,MAChC;AAAA,IACF,CAAC;AACD,QAAI,QAAQ,WAAW,EAAG,QAAO,EAAE,QAAQ,sBAAsB,MAAM,EAAE;AAEzE,UAAM,QAAQ,QAAQ,IAAI,UAAU;AACpC,eAAW,KAAK,MAAO,OAAM,KAAK,WAAW,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,KAAK,EAAE,OAAO,EAAE;AAErF,UAAM,MAAM,CAAC,GAAG,QAAQ,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,GAAG,KAAK;AAC5D,UAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,MAAM,EAAE;AACpD,UAAM,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,MAAM,EAAE;AACpD,UAAM;AAAA,MACJ,cAAc,QAAQ,MAAM,mBAAc,KAAK,UAAU,KAAK,UAC5D,QAAQ,IAAI,sBAAsB,iCACpC;AAAA,IACF;AACA,WAAO,EAAE,QAAQ,MAAM,KAAK,IAAI,GAAG,MAAM,QAAQ,IAAI,IAAI,EAAE;AAAA,EAC7D,SAAS,KAAK;AACZ,UAAM,IAAI;AACV,WAAO,EAAE,QAAQ,EAAE,WAAW,OAAO,GAAG,GAAG,MAAM,EAAE,YAAY,EAAE;AAAA,EACnE;AACF;","names":[]}
@@ -0,0 +1,140 @@
1
+ import {
2
+ rulesetGaps
3
+ } from "./chunk-MNDIED4M.js";
4
+ import {
5
+ makeGitHub
6
+ } from "./chunk-VSHC4HOI.js";
7
+ import "./chunk-HVOOCK6L.js";
8
+
9
+ // src/audits/protection-coverage.ts
10
+ var RENOVATE_WORKFLOW_FILE = "renovate.yml";
11
+ var RENOVATE_STALE_AFTER_DAYS = 3;
12
+ var ACCEPTED_GAPS = [];
13
+ function partitionAcceptedGaps(repo, gaps, now, accepted = ACCEPTED_GAPS) {
14
+ const live = [];
15
+ const acceptedOut = [];
16
+ for (const gap of gaps) {
17
+ const match = accepted.find(
18
+ (a) => a.repo === repo && gap.startsWith(a.detailPrefix) && now < new Date(a.until)
19
+ );
20
+ if (match) acceptedOut.push(`${gap} [accepted until ${match.until}: ${match.reason}]`);
21
+ else live.push(gap);
22
+ }
23
+ return { live, accepted: acceptedOut };
24
+ }
25
+ function secretScanningGaps(repo) {
26
+ const gaps = [];
27
+ if (repo.secretScanning !== "enabled")
28
+ gaps.push(`secret scanning ${repo.secretScanning} (fleet floor is enabled)`);
29
+ if (repo.pushProtection !== "enabled")
30
+ gaps.push(`push protection ${repo.pushProtection} (fleet floor is enabled)`);
31
+ return gaps;
32
+ }
33
+ function renovateGaps(health, now) {
34
+ if (!health.present) return ["no renovate workflow (dependency updates never run here)"];
35
+ if (health.state !== "active")
36
+ return [
37
+ // A disabled workflow REJECTS workflow_dispatch (HTTP 403) — it must be
38
+ // re-enabled first; "just dispatch it" is a dead-end runbook line here.
39
+ `renovate workflow is ${health.state} (re-enable it: \`gh workflow enable renovate.yml -R <repo>\`, then dispatch once)`
40
+ ];
41
+ if (health.lastSuccessAt === null)
42
+ return [
43
+ "renovate workflow has never succeeded (dispatch it once; if this gap returns, the schedule never registered \u2014 push a commit touching the workflow file)"
44
+ ];
45
+ const succeededAt = Date.parse(health.lastSuccessAt);
46
+ if (Number.isNaN(succeededAt))
47
+ return [`renovate last-success timestamp unreadable: ${health.lastSuccessAt}`];
48
+ const days = (now.getTime() - succeededAt) / 864e5;
49
+ if (days > RENOVATE_STALE_AFTER_DAYS)
50
+ return [`renovate last succeeded ${Math.floor(days)}d ago (cron is twice daily)`];
51
+ return [];
52
+ }
53
+ async function collectProtectionCoverage(org, deps, now = /* @__PURE__ */ new Date(), accepted = ACCEPTED_GAPS) {
54
+ const rows = [];
55
+ for (const r of await deps.listOrgRepos(org)) {
56
+ const repo = `${org}/${r.name}`;
57
+ if (r.archived || r.visibility !== "public") {
58
+ rows.push({
59
+ repo,
60
+ status: "skipped",
61
+ detail: r.archived ? "archived" : `${r.visibility} (rulesets need a paid plan)`
62
+ });
63
+ continue;
64
+ }
65
+ try {
66
+ const gaps = [];
67
+ let coveredDetail = "";
68
+ const rulesets = await deps.listRepoRulesets(repo);
69
+ if (rulesets.length === 0) {
70
+ gaps.push("no repo rulesets at all");
71
+ } else {
72
+ const judged = await Promise.all(
73
+ rulesets.map(async (rs) => {
74
+ const full = await deps.getRuleset(repo, rs.id);
75
+ return { name: rs.name, full, gaps: rulesetGaps(full, null) };
76
+ })
77
+ );
78
+ const covering = judged.find((j) => j.gaps.length === 0);
79
+ if (covering) {
80
+ const ciGated = (covering.full.rules ?? []).some(
81
+ (rule) => rule.type === "required_status_checks"
82
+ );
83
+ coveredDetail = `"${covering.name}"${ciGated ? "" : " \u2014 NO CI gate (refs rules only)"}`;
84
+ } else {
85
+ gaps.push(judged.map((j) => `"${j.name}": ${j.gaps.join("; ")}`).join(" | "));
86
+ }
87
+ }
88
+ gaps.push(...secretScanningGaps(r));
89
+ gaps.push(...renovateGaps(await deps.workflowHealth(repo, RENOVATE_WORKFLOW_FILE), now));
90
+ const { live, accepted: acked } = partitionAcceptedGaps(repo, gaps, now, accepted);
91
+ if (live.length > 0) {
92
+ rows.push({ repo, status: "gap", detail: [...live, ...acked].join(" | ") });
93
+ } else if (acked.length > 0) {
94
+ rows.push({ repo, status: "skipped", detail: acked.join(" | ") });
95
+ } else {
96
+ rows.push({ repo, status: "covered", detail: coveredDetail });
97
+ }
98
+ } catch (e) {
99
+ rows.push({
100
+ repo,
101
+ status: "gap",
102
+ detail: `probe failed: ${e instanceof Error ? e.message : String(e)}`
103
+ });
104
+ }
105
+ }
106
+ return rows;
107
+ }
108
+
109
+ // src/cli/commands/protection-audit.ts
110
+ function protectionAuditExitCode(gaps) {
111
+ return gaps > 0 ? 1 : 0;
112
+ }
113
+ async function runProtectionAuditCommand(opts, depsOverride) {
114
+ const org = opts.org?.trim();
115
+ if (!org) {
116
+ return { output: "protection-audit requires --org <org>", code: 2 };
117
+ }
118
+ const token = process.env.RENOVATE_TOKEN?.trim() || process.env.GH_TOKEN?.trim();
119
+ if (!depsOverride && !token) {
120
+ return {
121
+ output: "protection-audit skipped: no RENOVATE_TOKEN/GH_TOKEN (fleet read) configured.",
122
+ code: 0
123
+ };
124
+ }
125
+ const deps = depsOverride ?? makeGitHub({ token });
126
+ const rows = await collectProtectionCoverage(org, deps);
127
+ const gaps = rows.filter((r) => r.status === "gap");
128
+ const covered = rows.filter((r) => r.status === "covered");
129
+ const skipped = rows.filter((r) => r.status === "skipped");
130
+ const lines = rows.map((r) => `${r.status.toUpperCase().padEnd(7)} ${r.repo} \u2014 ${r.detail}`);
131
+ lines.push(
132
+ `PROTECTION_AUDIT gaps=${gaps.length} covered=${covered.length} skipped=${skipped.length} total=${rows.length}`
133
+ );
134
+ return { output: lines.join("\n"), code: protectionAuditExitCode(gaps.length) };
135
+ }
136
+ export {
137
+ protectionAuditExitCode,
138
+ runProtectionAuditCommand
139
+ };
140
+ //# sourceMappingURL=protection-audit-X3BHT2MB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/audits/protection-coverage.ts","../src/cli/commands/protection-audit.ts"],"sourcesContent":["import { rulesetGaps, type ExistingRuleset } from \"../github/rulesets.js\";\nimport type { WorkflowHealth } from \"../github/gh.js\";\n\n/**\n * Org-wide protection-coverage sweep (spec:\n * docs/superpowers/specs/2026-08-02-ruleset-self-healing-design.md).\n *\n * The `self-updating` recipe HEALS fleet sites, but it runs only when someone\n * runs it, and only over Airtable-listed sites — which is exactly how the\n * `.github` repo (no Airtable row) sat with zero protection until 2026-08-01.\n * This sweep is the layer that would have caught that on its own: it\n * enumerates the org FROM THE GITHUB API — never a hand-typed or\n * Airtable-scoped list, both of which have already produced false \"all\n * clear\"s — and judges every public repo's protection by SHAPE, not by name,\n * so a differently-named but sound ruleset (reddoor-maintenance's \"Main\n * Protection\") counts.\n *\n * Since 2026-08-02 the same sweep also verifies two more posture surfaces per\n * public repo, because both regress silently and neither has any other\n * watcher:\n * - secret scanning + push protection stay ENABLED (a repo transferred in,\n * or an org-default flip, arrives with them off);\n * - the renovate workflow is registered, active, and has actually RUN\n * recently. GitHub auto-disables schedules after 60 quiet days, and\n * schedule triggers in template-cloned files may never register at all —\n * either way a fully-quiet repo stops receiving updates with zero signal\n * (the 2026-08-02 sweep found two never-run and two 5-days-stale repos on\n * its first pass).\n */\nexport type ProtectionCoverageRow = {\n repo: string; // owner/repo\n status: \"covered\" | \"gap\" | \"skipped\";\n /** Human-readable: covering ruleset + whether it gates on CI, the specific\n * gaps, or why the repo was skipped. */\n detail: string;\n};\n\n/** The reads the sweep needs — a subset of the GitHub factory, injected so the\n * sweep is pure + testable (same pattern as collectGitHubSignals). */\nexport type ProtectionCoverageDeps = {\n listOrgRepos: (org: string) => Promise<\n Array<{\n name: string;\n visibility: string;\n archived: boolean;\n secretScanning: string;\n pushProtection: string;\n }>\n >;\n listRepoRulesets: (repo: string) => Promise<Array<{ id: number; name: string }>>;\n getRuleset: (repo: string, id: number) => Promise<ExistingRuleset>;\n workflowHealth: (repo: string, filename: string) => Promise<WorkflowHealth>;\n};\n\nexport const RENOVATE_WORKFLOW_FILE = \"renovate.yml\";\n\n/** Cron is twice daily, so 3 days without a SUCCESSFUL run = 6+ consecutive\n * missed-or-failing runs — dead scheduling, dead credential, or broken\n * config, never jitter. (Success, not run-existence: a revoked App key still\n * creates a fresh failing run every tick.) */\nexport const RENOVATE_STALE_AFTER_DAYS = 3;\n\n/**\n * Operator-accepted gaps — the protection-audit analogue of the cockpit's\n * accepted-Watch acks: a KNOWN condition pending a real decision must not\n * comment the tracking issue every night, or the channel is tuned out by the\n * time a genuinely new gap lands in it. Constraints that keep this honest:\n * every entry is PR-reviewed, names ONE repo + ONE surface (never a blanket\n * mute), states the pending decision, and EXPIRES — past `until` the gap\n * returns on its own, so an acceptance can never quietly become permanent.\n */\nexport type AcceptedGap = {\n repo: string; // owner/repo\n /** Matched as a prefix of the gap detail line — surface-scoped, so an\n * accepted renovate gap never swallows a ruleset or secret-scanning gap. */\n detailPrefix: string;\n reason: string;\n until: string; // ISO date; exclusive — the gap is live again ON this date\n};\n\n// Currently EMPTY — the only two entries (no-renovate on reddoor-maintenance\n// and .github, pending an operator supply-chain call) were retired 2026-08-02\n// when the operator approved planting Renovate on both. Add entries only for\n// a named pending decision, never as a mute.\nexport const ACCEPTED_GAPS: AcceptedGap[] = [];\n\n/** Split gaps into live vs accepted-for-now. Acceptance is per-surface (detail\n * prefix) and expires: an entry past `until` accepts nothing. */\nexport function partitionAcceptedGaps(\n repo: string,\n gaps: string[],\n now: Date,\n accepted: AcceptedGap[] = ACCEPTED_GAPS,\n): { live: string[]; accepted: string[] } {\n const live: string[] = [];\n const acceptedOut: string[] = [];\n for (const gap of gaps) {\n const match = accepted.find(\n (a) => a.repo === repo && gap.startsWith(a.detailPrefix) && now < new Date(a.until),\n );\n if (match) acceptedOut.push(`${gap} [accepted until ${match.until}: ${match.reason}]`);\n else live.push(gap);\n }\n return { live, accepted: acceptedOut };\n}\n\n/** Public repos only — secret scanning is plan-gated off on private Free\n * repos, and those are skipped before this is consulted. \"unavailable\" means\n * the listing couldn't read security_and_analysis (token lacks admin read),\n * which must read as unverified, not as fine. */\nexport function secretScanningGaps(repo: {\n secretScanning: string;\n pushProtection: string;\n}): string[] {\n const gaps: string[] = [];\n if (repo.secretScanning !== \"enabled\")\n gaps.push(`secret scanning ${repo.secretScanning} (fleet floor is enabled)`);\n if (repo.pushProtection !== \"enabled\")\n gaps.push(`push protection ${repo.pushProtection} (fleet floor is enabled)`);\n return gaps;\n}\n\n/** Renovate liveness verdict — judged on the last SUCCESSFUL run. The cron IS\n * the merge cadence (platform auto-merge is off fleet-wide), so a workflow\n * that isn't succeeding means the repo silently stops updating — the exact\n * class the 2026-07-26 incident review called \"zero-run blindness\". */\nexport function renovateGaps(health: WorkflowHealth, now: Date): string[] {\n if (!health.present) return [\"no renovate workflow (dependency updates never run here)\"];\n if (health.state !== \"active\")\n return [\n // A disabled workflow REJECTS workflow_dispatch (HTTP 403) — it must be\n // re-enabled first; \"just dispatch it\" is a dead-end runbook line here.\n `renovate workflow is ${health.state} (re-enable it: \\`gh workflow enable renovate.yml -R <repo>\\`, then dispatch once)`,\n ];\n if (health.lastSuccessAt === null)\n return [\n \"renovate workflow has never succeeded (dispatch it once; if this gap returns, the schedule never registered — push a commit touching the workflow file)\",\n ];\n const succeededAt = Date.parse(health.lastSuccessAt);\n if (Number.isNaN(succeededAt))\n return [`renovate last-success timestamp unreadable: ${health.lastSuccessAt}`];\n const days = (now.getTime() - succeededAt) / 86_400_000;\n if (days > RENOVATE_STALE_AFTER_DAYS)\n return [`renovate last succeeded ${Math.floor(days)}d ago (cron is twice daily)`];\n return [];\n}\n\n/**\n * One row per org repo. Coverage = SOME repo-sourced ruleset with zero\n * stage-1 gaps (active, empty bypass, default branch covered, deletion +\n * non_fast_forward + pull_request) AND secret scanning enabled AND a live\n * renovate workflow. Whether a covering ruleset also gates on CI is reported\n * as detail, not judged: each repo's required context differs (and\n * reddoor-maintenance deliberately has none pending release-path review), so\n * the CI-gate invariant belongs to the per-site heal, which has the evidence\n * to require the RIGHT context safely.\n *\n * Private/archived repos are skipped (rulesets on private repos need a paid\n * plan; archived repos are read-only). A repo whose probe THROWS is a `gap`,\n * not a skip — \"couldn't verify\" reading as \"fine\" is the silent-green\n * failure mode this sweep exists to kill, and the tracking issue auto-closes\n * on the next clean pass, so a transient API blip costs one issue-comment.\n */\nexport async function collectProtectionCoverage(\n org: string,\n deps: ProtectionCoverageDeps,\n now: Date = new Date(),\n accepted: AcceptedGap[] = ACCEPTED_GAPS,\n): Promise<ProtectionCoverageRow[]> {\n const rows: ProtectionCoverageRow[] = [];\n for (const r of await deps.listOrgRepos(org)) {\n const repo = `${org}/${r.name}`;\n if (r.archived || r.visibility !== \"public\") {\n rows.push({\n repo,\n status: \"skipped\",\n detail: r.archived ? \"archived\" : `${r.visibility} (rulesets need a paid plan)`,\n });\n continue;\n }\n try {\n const gaps: string[] = [];\n let coveredDetail = \"\";\n const rulesets = await deps.listRepoRulesets(repo);\n if (rulesets.length === 0) {\n gaps.push(\"no repo rulesets at all\");\n } else {\n const judged = await Promise.all(\n rulesets.map(async (rs) => {\n const full = await deps.getRuleset(repo, rs.id);\n return { name: rs.name, full, gaps: rulesetGaps(full, null) };\n }),\n );\n const covering = judged.find((j) => j.gaps.length === 0);\n if (covering) {\n const ciGated = (covering.full.rules ?? []).some(\n (rule) => rule.type === \"required_status_checks\",\n );\n coveredDetail = `\"${covering.name}\"${ciGated ? \"\" : \" — NO CI gate (refs rules only)\"}`;\n } else {\n gaps.push(judged.map((j) => `\"${j.name}\": ${j.gaps.join(\"; \")}`).join(\" | \"));\n }\n }\n gaps.push(...secretScanningGaps(r));\n gaps.push(...renovateGaps(await deps.workflowHealth(repo, RENOVATE_WORKFLOW_FILE), now));\n const { live, accepted: acked } = partitionAcceptedGaps(repo, gaps, now, accepted);\n if (live.length > 0) {\n // Accepted annotations still ride along for context, but only LIVE\n // gaps make the row a gap (and thus the sweep exit 1).\n rows.push({ repo, status: \"gap\", detail: [...live, ...acked].join(\" | \") });\n } else if (acked.length > 0) {\n // Judged, found wanting, deliberately acked — reported as skipped\n // (visible every night with the reason + expiry), never as covered.\n rows.push({ repo, status: \"skipped\", detail: acked.join(\" | \") });\n } else {\n rows.push({ repo, status: \"covered\", detail: coveredDetail });\n }\n } catch (e) {\n rows.push({\n repo,\n status: \"gap\",\n detail: `probe failed: ${e instanceof Error ? e.message : String(e)}`,\n });\n }\n }\n return rows;\n}\n","import {\n collectProtectionCoverage,\n type ProtectionCoverageDeps,\n} from \"../../audits/protection-coverage.js\";\nimport { makeGitHub } from \"../../github/gh.js\";\n\n/** Exit 1 on ANY gap: unlike the fleet write sweeps (majority-rule), a single\n * unprotected public repo is a real hole, not a flake to tolerate. */\nexport function protectionAuditExitCode(gaps: number): number {\n return gaps > 0 ? 1 : 0;\n}\n\n/** `protection-audit --org <org>`: verify every public repo in the org carries\n * a sound branch ruleset, live secret scanning + push protection, and a\n * renovate workflow that actually runs (see collectProtectionCoverage for the\n * verdicts). Emits one line per repo + a machine-readable PROTECTION_AUDIT\n * summary the nightly workflow gates its tracking issue on. A missing fleet\n * token is a clean skip (local runs), matching github-signals. */\nexport async function runProtectionAuditCommand(\n opts: { org?: string | undefined },\n // Injected in tests; defaults to the real gh-CLI-backed factory.\n depsOverride?: ProtectionCoverageDeps,\n): Promise<{ output: string; code: number }> {\n const org = opts.org?.trim();\n if (!org) {\n return { output: \"protection-audit requires --org <org>\", code: 2 };\n }\n const token = process.env.RENOVATE_TOKEN?.trim() || process.env.GH_TOKEN?.trim();\n if (!depsOverride && !token) {\n return {\n output: \"protection-audit skipped: no RENOVATE_TOKEN/GH_TOKEN (fleet read) configured.\",\n code: 0,\n };\n }\n const deps = depsOverride ?? makeGitHub({ token: token! });\n\n const rows = await collectProtectionCoverage(org, deps);\n const gaps = rows.filter((r) => r.status === \"gap\");\n const covered = rows.filter((r) => r.status === \"covered\");\n const skipped = rows.filter((r) => r.status === \"skipped\");\n\n const lines = rows.map((r) => `${r.status.toUpperCase().padEnd(7)} ${r.repo} — ${r.detail}`);\n lines.push(\n `PROTECTION_AUDIT gaps=${gaps.length} covered=${covered.length} skipped=${skipped.length} total=${rows.length}`,\n );\n return { output: lines.join(\"\\n\"), code: protectionAuditExitCode(gaps.length) };\n}\n"],"mappings":";;;;;;;;;AAsDO,IAAM,yBAAyB;AAM/B,IAAM,4BAA4B;AAwBlC,IAAM,gBAA+B,CAAC;AAItC,SAAS,sBACd,MACA,MACA,KACA,WAA0B,eACc;AACxC,QAAM,OAAiB,CAAC;AACxB,QAAM,cAAwB,CAAC;AAC/B,aAAW,OAAO,MAAM;AACtB,UAAM,QAAQ,SAAS;AAAA,MACrB,CAAC,MAAM,EAAE,SAAS,QAAQ,IAAI,WAAW,EAAE,YAAY,KAAK,MAAM,IAAI,KAAK,EAAE,KAAK;AAAA,IACpF;AACA,QAAI,MAAO,aAAY,KAAK,GAAG,GAAG,oBAAoB,MAAM,KAAK,KAAK,MAAM,MAAM,GAAG;AAAA,QAChF,MAAK,KAAK,GAAG;AAAA,EACpB;AACA,SAAO,EAAE,MAAM,UAAU,YAAY;AACvC;AAMO,SAAS,mBAAmB,MAGtB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eResult } from '../types-0jreMCF5.js';
1
+ import { C as ConfigName, S as Site, b as RecipeResult } from '../types-DnEL3NRn.js';
2
2
 
3
3
  type SyncConfigsOptions = {
4
4
  which?: ConfigName[];
@@ -2,9 +2,9 @@ import {
2
2
  ALL_CONFIG_NAMES,
3
3
  isConfigName,
4
4
  syncConfigs
5
- } from "../chunk-JNXCDUYB.js";
6
- import "../chunk-CASCWQQX.js";
7
- import "../chunk-XKOZUVK2.js";
5
+ } from "../chunk-Q276MZ7E.js";
6
+ import "../chunk-73UFRZKY.js";
7
+ import "../chunk-ZTPPCHDB.js";
8
8
  import "../chunk-XXTZBPUY.js";
9
9
  import "../chunk-XTK5VIQB.js";
10
10
  export {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-PZQ3WED2.js";
4
4
  import {
5
5
  makeGitHub
6
- } from "./chunk-YEGHUODU.js";
6
+ } from "./chunk-VSHC4HOI.js";
7
7
  import "./chunk-HVOOCK6L.js";
8
8
  import {
9
9
  isDashboardVisible,
@@ -138,4 +138,4 @@ async function runRenovateDispatchCommand(opts) {
138
138
  export {
139
139
  runRenovateDispatchCommand
140
140
  };
141
- //# sourceMappingURL=renovate-dispatch-6II2JVOX.js.map
141
+ //# sourceMappingURL=renovate-dispatch-2VYCEH42.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/github/renovate-dispatch.ts","../src/cli/commands/renovate-dispatch.ts"],"sourcesContent":["import { isDashboardVisible, type WebsiteRow } from \"../reports/airtable/websites.js\";\nimport { isRenovatePR } from \"../alerts/renovate.js\";\nimport type { PullRequestSummary } from \"./gh.js\";\n\n/**\n * On-demand Renovate trigger for fleet sites.\n *\n * The nightly security sweep (`fleet-security.yml`) writes each active site's\n * vulnerability counts to Airtable. This module turns that into action: for the\n * sites the sweep just flagged with *actionable* (critical or high) vulns, it\n * dispatches that repo's `renovate.yml` `workflow_dispatch` so Renovate runs off\n * its twice-daily schedule. Renovate's OSV vulnerability alerts bypass the\n * schedule, so the remediation PR opens immediately — and because GitHub's\n * platform auto-merge is disabled fleet-wide, Renovate merges it from inside that\n * same run (or a later scheduled one) per the shared preset, which is what keeps\n * the preset's \"majors are never auto-merged\" rule authoritative. Moderate/low\n * vulns are left to the normal schedule — not urgent enough to dispatch + churn\n * CI nightly.\n */\n\n/** The per-repo workflow file the fleet uses for its self-hosted Renovate run. */\nexport const RENOVATE_WORKFLOW_FILE = \"renovate.yml\";\n\n/**\n * Does the repo have a HEALTHY open Renovate PR — one that is NOT conflicting?\n *\n * A healthy PR means remediation is genuinely in flight (moving toward merge), so\n * re-dispatching would just churn CI — skip it. A CONFLICTING Renovate PR is STUCK\n * (its branch fell behind the base after another PR merged the same lockfile), so\n * it does NOT count as healthy: re-dispatching triggers Renovate to rebase it.\n * `UNKNOWN` mergeability (GitHub still computing it) is treated as healthy — don't\n * churn on uncertainty. Reuses {@link isRenovatePR} for the branch-prefix check.\n */\nexport function hasHealthyRenovatePr(prs: PullRequestSummary[]): boolean {\n return prs.some((pr) => isRenovatePR(pr) && pr.mergeable !== \"CONFLICTING\");\n}\n\n/** A site selected for an on-demand Renovate run, with the reason (vuln counts). */\nexport type RenovateDispatchTarget = {\n repo: string; // owner/repo, from the Websites \"Git repo\" field\n siteName: string;\n critical: number;\n high: number;\n};\n\n/**\n * Pick the active, repo-backed sites whose latest security sweep found a\n * critical or high vulnerability. A `null` vuln count is treated as zero (a site\n * that was never swept, or had its counts cleared, is not dispatched). Inactive\n * sites and sites without a `Git repo` are excluded — there's nothing to kick.\n *\n * Counts are only guaranteed fresh for sites the sweep actually audited (active +\n * URL present); a site whose write-back failed/was skipped this run is selected on\n * its last-known counts. That's safe — a stale-high false dispatch is an idempotent\n * Renovate no-op, and the open-PR skip in `dispatchRenovateAcross` avoids re-firing\n * when remediation is already in flight.\n */\nexport function selectRenovateTargets(sites: WebsiteRow[]): RenovateDispatchTarget[] {\n const targets: RenovateDispatchTarget[] = [];\n for (const s of sites) {\n if (!isDashboardVisible(s)) continue; // active (maintenance / launch period) only\n const repo = s.gitRepo?.trim();\n if (!repo) continue; // repo-backed only — the dispatch target is its renovate.yml\n const critical = s.securityVulnsCritical ?? 0;\n const high = s.securityVulnsHigh ?? 0;\n if (critical + high <= 0) continue; // actionable (critical/high) vulns only\n targets.push({ repo, siteName: s.name, critical, high });\n }\n return targets;\n}\n\n/** Injected GitHub operations — real ones come from `makeGitHub`, fakes from tests. */\nexport type RenovateDispatchDeps = {\n /** True iff the repo has a HEALTHY (non-conflicting) open Renovate PR —\n * remediation in flight, so don't re-dispatch. A conflicting/stuck PR returns\n * false so the dispatch goes through and Renovate rebases it. */\n hasHealthyOpenRenovatePr: (repo: string) => Promise<boolean>;\n defaultBranch: (repo: string) => Promise<string>;\n dispatch: (repo: string, workflow: string, ref: string) => Promise<void>;\n};\n\nexport type RenovateDispatchResult = {\n dispatched: string[];\n /** Repos skipped because a Renovate PR is already open — no point re-firing. */\n skipped: string[];\n failed: { repo: string; error: string }[];\n};\n\n/**\n * Dispatch `renovate.yml` for each target on its default branch.\n *\n * Skips a repo with a HEALTHY (non-conflicting) open Renovate PR — remediation is\n * in flight, so re-dispatching would just churn CI (keeps a persistent vuln from\n * re-firing every nightly run while its fix PR waits, e.g. a human-gated major\n * bump). A repo whose open Renovate PR is CONFLICTING/stuck is NOT skipped:\n * dispatching triggers Renovate to rebase it. Best-effort and isolated: a repo\n * that lacks `renovate.yml`, or whose\n * dispatch/PR-check is refused (the token's `actions:write` scope), is recorded in\n * `failed` and the rest still run. Never throws — the caller (a follow-up step on\n * the security sweep) must not be able to fail the sweep over a dispatch hiccup.\n */\nexport async function dispatchRenovateAcross(\n targets: RenovateDispatchTarget[],\n deps: RenovateDispatchDeps,\n): Promise<RenovateDispatchResult> {\n const dispatched: string[] = [];\n const skipped: string[] = [];\n const failed: { repo: string; error: string }[] = [];\n for (const t of targets) {\n try {\n if (await deps.hasHealthyOpenRenovatePr(t.repo)) {\n skipped.push(t.repo);\n continue;\n }\n const ref = await deps.defaultBranch(t.repo);\n await deps.dispatch(t.repo, RENOVATE_WORKFLOW_FILE, ref);\n dispatched.push(t.repo);\n } catch (e) {\n failed.push({ repo: t.repo, error: e instanceof Error ? e.message : String(e) });\n }\n }\n return { dispatched, skipped, failed };\n}\n\n/** Machine-readable counts line the workflow greps to annotate partial failures. */\nexport function formatRenovateDispatchSummary(result: RenovateDispatchResult): string {\n return `RENOVATE_DISPATCH_SUMMARY dispatched=${result.dispatched.length} skipped=${result.skipped.length} failed=${result.failed.length}`;\n}\n\n/**\n * Plan the per-site auto-fix-attempt counter writes from a dispatch result. PURE.\n * For each site:\n * - vulns now 0 (or never counted) → reset to 0 (episode resolved)\n * - else dispatched this run → attempts + 1 (a fresh failed-so-far attempt)\n * - else (skipped / failed / untouched) → unchanged\n * The RESET applies fleet-wide — regardless of Status or Git repo — so a site\n * archived or un-repo'd after its episode can't carry a stale counter into its\n * next vuln (Alamo sat at 7 from a long-closed episode). A null vuln count\n * (never-audited) reads as zero, consistent with the existing null-as-zero\n * semantics, so a lingering counter on such a row also clears. The INCREMENT\n * keeps its active + repo-backed filters (only those sites are dispatched).\n * Returns only the rows whose value CHANGES (a steady fleet writes nothing —\n * a 0→0 site emits no write). A skipped repo (healthy Renovate PR in flight) is\n * NOT a failed attempt — a fix is genuinely moving toward merge — so its counter\n * holds.\n */\nexport function computeAutoFixAttemptUpdates(\n sites: WebsiteRow[],\n result: RenovateDispatchResult,\n): { id: string; attempts: number }[] {\n const dispatched = new Set(result.dispatched);\n const updates: { id: string; attempts: number }[] = [];\n for (const s of sites) {\n const current = s.securityAutoFixAttempts ?? 0;\n const vulns = (s.securityVulnsCritical ?? 0) + (s.securityVulnsHigh ?? 0);\n if (vulns === 0) {\n // Episode resolved (or never confirmed): reset REGARDLESS of status/repo —\n // a site archived or un-repo'd after its episode must not carry a stale\n // counter into its next vuln (Alamo sat at 7 from a long-closed episode).\n if (current !== 0) updates.push({ id: s.id, attempts: 0 });\n continue;\n }\n if (!isDashboardVisible(s)) continue; // increments stay active-only\n const repo = s.gitRepo?.trim();\n if (!repo) continue; // …and repo-backed-only\n if (dispatched.has(repo)) updates.push({ id: s.id, attempts: current + 1 });\n }\n return updates;\n}\n\n/**\n * Apply the planned counter updates with an injected writer, BEST-EFFORT: a writer\n * that throws (e.g. the Airtable field not yet created, or a transient error) is\n * counted in `failed` and never propagates — the security sweep must not fail over\n * counter bookkeeping. Returns the applied/failed tallies for the summary line.\n */\nexport async function applyAutoFixAttemptUpdates(\n updates: { id: string; attempts: number }[],\n write: (id: string, attempts: number) => Promise<void>,\n): Promise<{ written: number; failed: number }> {\n let written = 0;\n let failed = 0;\n for (const u of updates) {\n try {\n await write(u.id, u.attempts);\n written++;\n } catch {\n failed++;\n }\n }\n return { written, failed };\n}\n\n/** Machine-readable counts line the workflow can grep, mirroring RENOVATE_DISPATCH_SUMMARY. */\nexport function formatAutoFixAttemptsSummary(tally: { written: number; failed: number }): string {\n return `AUTO_FIX_ATTEMPTS_SUMMARY written=${tally.written} failed=${tally.failed}`;\n}\n","import { openBase, readAirtableConfig, type AirtableBase } from \"../../reports/airtable/client.js\";\nimport { listWebsites, updateAutoFixAttempts } from \"../../reports/airtable/websites.js\";\nimport { makeGitHub } from \"../../github/gh.js\";\nimport {\n selectRenovateTargets,\n dispatchRenovateAcross,\n formatRenovateDispatchSummary,\n hasHealthyRenovatePr,\n computeAutoFixAttemptUpdates,\n applyAutoFixAttemptUpdates,\n formatAutoFixAttemptsSummary,\n type RenovateDispatchResult,\n} from \"../../github/renovate-dispatch.js\";\n\n/**\n * `renovate-dispatch --fleet`: read the Websites table, pick the active,\n * repo-backed sites the latest security sweep flagged with critical/high vulns,\n * and fire each one's `renovate.yml` `workflow_dispatch` so Renovate's OSV\n * vulnerability alerts open the remediation PR now (instead of waiting for the\n * weekly schedule). Designed to run as a best-effort follow-up step on\n * `fleet-security.yml` AFTER the sweep has written fresh counts to Airtable.\n *\n * Always exits 0: a missing token is a clean skip; a partial dispatch failure\n * (a repo without `renovate.yml`, or a token lacking `actions:write`) is reported\n * in the summary for the workflow to annotate, never failing the security sweep.\n */\nexport async function runRenovateDispatchCommand(opts: {\n fleet?: boolean | undefined;\n /** Inject a pre-opened Airtable base (tests). Defaults to env config. */\n base?: AirtableBase;\n}): Promise<{ output: string; code: number }> {\n if (!opts.fleet) {\n return { output: \"renovate-dispatch currently supports only --fleet\", code: 2 };\n }\n const token = process.env.RENOVATE_TOKEN?.trim() || process.env.GH_TOKEN?.trim();\n if (!token) {\n return {\n output: \"renovate-dispatch skipped: no RENOVATE_TOKEN/GH_TOKEN (fleet dispatch) configured.\",\n code: 0,\n };\n }\n\n const base = opts.base ?? openBase(readAirtableConfig());\n const websites = await listWebsites(base);\n const targets = selectRenovateTargets(websites);\n\n const lines: string[] = [];\n let result: RenovateDispatchResult = { dispatched: [], skipped: [], failed: [] };\n if (targets.length === 0) {\n lines.push(\n \"No active repo-backed sites with critical/high vulnerabilities — nothing to dispatch.\",\n );\n } else {\n const gh = makeGitHub({ token });\n result = await dispatchRenovateAcross(targets, {\n hasHealthyOpenRenovatePr: async (repo) =>\n hasHealthyRenovatePr(await gh.openPullRequests(repo)),\n defaultBranch: (repo) => gh.defaultBranch(repo),\n dispatch: (repo, workflow, ref) => gh.dispatchWorkflow(repo, workflow, ref),\n });\n\n const failedRepos = new Set(result.failed.map((f) => f.repo));\n const skippedRepos = new Set(result.skipped);\n for (const t of targets) {\n const status = failedRepos.has(t.repo)\n ? \"FAILED \"\n : skippedRepos.has(t.repo)\n ? \"skipped (open Renovate PR) \"\n : \"dispatched \";\n lines.push(`${status} ${t.repo} (critical=${t.critical} high=${t.high}) — ${t.siteName}`);\n }\n for (const f of result.failed) lines.push(` ↳ ${f.repo}: ${f.error}`);\n }\n\n // Counter bookkeeping runs on EVERY fleet run — the reset-on-clean branch was\n // previously unreachable behind the zero-targets early return, so a fully-clean\n // fleet never cleared stale counters (Alamo stuck at 7, 2026-07). Best-effort:\n // a failed write is tallied, never thrown. Uses the full `websites` list so\n // 0-vuln sites reset.\n const attemptUpdates = computeAutoFixAttemptUpdates(websites, result);\n const attemptTally = await applyAutoFixAttemptUpdates(attemptUpdates, (id, attempts) =>\n updateAutoFixAttempts(base, id, attempts),\n );\n\n lines.push(formatRenovateDispatchSummary(result));\n lines.push(formatAutoFixAttemptsSummary(attemptTally));\n\n return { output: lines.join(\"\\n\"), code: 0 };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBO,IAAM,yBAAyB;AAY/B,SAAS,qBAAqB,KAAoC;AACvE,SAAO,IAAI,KAAK,CAAC,OAAO,aAAa,EAAE,KAAK,GAAG,cAAc,aAAa;AAC5E;AAsBO,SAAS,sBAAsB,OAA+C;AACnF,QAAM,UAAoC,CAAC;AAC3C,aAAW,KAAK,OAAO;AACrB,QAAI,CAAC,mBAAmB,CAAC,EAAG;AAC5B,UAAM,OAAO,EAAE,SAAS,KAAK;AAC7B,QAAI,CAAC,KAAM;AACX,UAAM,WAAW,EAAE,yBAAyB;AAC5C,UAAM,OAAO,EAAE,qBAAqB;AACpC,QAAI,WAAW,QAAQ,EAAG;AAC1B,YAAQ,KAAK,EAAE,MAAM,UAAU,EAAE,MAAM,UAAU,KAAK,CAAC;AAAA,EACzD;AACA,SAAO;AACT;AAgCA,eAAsB,uBACpB,SACA,MACiC;AACjC,QAAM,aAAuB,CAAC;AAC9B,QAAM,UAAoB,CAAC;AAC3B,QAAM,SAA4C,CAAC;AACnD,aAAW,KAAK,SAAS;AACvB,QAAI;AACF,UAAI,MAAM,KAAK,yBAAyB,EAAE,IAAI,GAAG;AAC/C,gBAAQ,KAAK,EAAE,IAAI;AACnB;AAAA,MACF;AACA,YAAM,MAAM,MAAM,KAAK,cAAc,EAAE,IAAI;AAC3C,YAAM,KAAK,SAAS,EAAE,MAAM,wBAAwB,GAAG;AACvD,iBAAW,KAAK,EAAE,IAAI;AAAA,IACxB,SAAS,GAAG;AACV,aAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,aAAa,QAAQ,EAAE,U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6B,UAAU,MAAM;AACpE,QAAM,eAAe,MAAM;AAAA,IAA2B;AAAA,IAAgB,CAAC,IAAI,aACzE,sBAAsB,MAAM,IAAI,QAAQ;AAAA,EAC1C;AAEA,QAAM,KAAK,8BAA8B,MAAM,CAAC;AAChD,QAAM,KAAK,6BAA6B,YAAY,CAAC;AAErD,SAAO,EAAE,QAAQ,MAAM,KAAK,IAAI,GAAG,MAAM,EAAE;AAC7C;","names":[]}
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  draftReportForSite,
3
3
  readGaConfig
4
- } from "./chunk-NUIBQPB3.js";
4
+ } from "./chunk-6SZBNALD.js";
5
5
  import {
6
6
  reportTier
7
- } from "./chunk-KLVMJYZZ.js";
7
+ } from "./chunk-SEQA7MC3.js";
8
+ import "./chunk-37S6L6G4.js";
8
9
  import {
9
10
  findDueReports,
10
11
  nextDueDate,
@@ -13,7 +14,8 @@ import {
13
14
  import {
14
15
  escapeHtml,
15
16
  listAllReports
16
- } from "./chunk-JCITWZQR.js";
17
+ } from "./chunk-MNE374CZ.js";
18
+ import "./chunk-MPBXOJ3N.js";
17
19
  import "./chunk-U5SZ4FOP.js";
18
20
  import {
19
21
  listWebsites,
@@ -69,11 +71,11 @@ function dashboardBaseUrl() {
69
71
  }
70
72
  async function runReportCommand(slug, opts) {
71
73
  if (opts.digest) {
72
- const { runDigest } = await import("./digest-LEMZS5ZK.js");
74
+ const { runDigest } = await import("./digest-NQAQI34P.js");
73
75
  return runDigest({ baseUrl: dashboardBaseUrl() });
74
76
  }
75
77
  if (opts.sendReady) {
76
- const { sendApprovedReports } = await import("./orchestrate-NYRYEKQM.js");
78
+ const { sendApprovedReports } = await import("./orchestrate-QOQXOJLI.js");
77
79
  return sendApprovedReports();
78
80
  }
79
81
  if (opts.due) {
@@ -268,4 +270,4 @@ export {
268
270
  parseSingleSiteReportType,
269
271
  runReportCommand
270
272
  };
271
- //# sourceMappingURL=report-POHQEV6F.js.map
273
+ //# sourceMappingURL=report-IU4CLJS5.js.map