@reddoorla/maintenance 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/bin.js CHANGED
@@ -577,7 +577,9 @@ var init_write_audits_to_airtable = __esm({
577
577
 
578
578
  // src/reports/checklist.ts
579
579
  function checklistFor(type) {
580
- return type === "Maintenance" ? MAINTENANCE_CHECKLIST : type === "Testing" ? TESTING_CHECKLIST : [];
580
+ if (type === "Maintenance") return MAINTENANCE_CHECKLIST;
581
+ if (type === "Testing") return [...MAINTENANCE_CHECKLIST, ...TESTING_CHECKLIST];
582
+ return [];
581
583
  }
582
584
  function isChecklistComplete(report) {
583
585
  return checklistFor(report.reportType).every((i) => report.checklist[i.field] === true);
@@ -5965,6 +5967,17 @@ async function derivePeriodStart(base, siteRow, reportType, today) {
5965
5967
  }
5966
5968
 
5967
5969
  // src/cli/commands/report.ts
5970
+ function parseSingleSiteReportType(raw) {
5971
+ if (raw === void 0 || raw.trim() === "") return "Maintenance";
5972
+ const norm = raw.trim().toLowerCase();
5973
+ if (norm === "maintenance") return "Maintenance";
5974
+ if (norm === "testing") return "Testing";
5975
+ const hint = norm === "launch" ? " \u2014 use the `launch <site>` command" : norm === "announcement" ? " \u2014 use the `announce <site>` command" : "";
5976
+ throw Object.assign(
5977
+ new Error(`--type must be Maintenance or Testing (got ${JSON.stringify(raw)})${hint}`),
5978
+ { exitCode: 2 }
5979
+ );
5980
+ }
5968
5981
  function dashboardBaseUrl() {
5969
5982
  return process.env.DASHBOARD_BASE_URL?.trim() || "https://reddoor-maintenance.netlify.app";
5970
5983
  }
@@ -5981,10 +5994,13 @@ async function runReportCommand(slug, opts) {
5981
5994
  return runDueDraft();
5982
5995
  }
5983
5996
  if (slug) {
5984
- return runSingleSiteDraft(slug, { previewOnly: Boolean(opts.preview) });
5997
+ const reportType = parseSingleSiteReportType(opts.type);
5998
+ return runSingleSiteDraft(slug, { previewOnly: Boolean(opts.preview), reportType });
5985
5999
  }
5986
6000
  throw Object.assign(
5987
- new Error("Usage: reddoor-maint report [<slug>] [--due] [--preview] [--send-ready] [--digest]"),
6001
+ new Error(
6002
+ "Usage: reddoor-maint report [<slug>] [--type <Maintenance|Testing>] [--due] [--preview] [--send-ready] [--digest]"
6003
+ ),
5988
6004
  {
5989
6005
  exitCode: 2
5990
6006
  }
@@ -6065,7 +6081,7 @@ async function runSingleSiteDraft(slug, opts) {
6065
6081
  if (!site) {
6066
6082
  throw Object.assign(new Error(`No Websites row matched slug "${slug}"`), { exitCode: 2 });
6067
6083
  }
6068
- const result = await draftReportForSite(opts.previewOnly ? null : base, site, "Maintenance", {
6084
+ const result = await draftReportForSite(opts.previewOnly ? null : base, site, opts.reportType, {
6069
6085
  previewOnly: opts.previewOnly
6070
6086
  });
6071
6087
  if (opts.previewOnly) {
@@ -6784,7 +6800,7 @@ cli.command(
6784
6800
  ).action(
6785
6801
  async (site, opts) => runOrExit(() => runAnnounceCommand(site, opts), opts)
6786
6802
  );
6787
- cli.command("report [site]", "Draft or send maintenance/testing reports.").option("--due", "Scan all Websites and draft overdue reports.").option(
6803
+ cli.command("report [site]", "Draft or send maintenance/testing reports.").option("--due", "Scan all Websites and draft overdue reports.").option("--type <type>", "Single-site draft report type: Maintenance (default) or Testing.").option(
6788
6804
  "--preview",
6789
6805
  "Single-site dry run; writes reports/<slug>/draft.html, never touches Airtable."
6790
6806
  ).option(