@taprootio/site-authoring 0.8.3 → 0.8.5

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.
@@ -0,0 +1,29 @@
1
+ import { mintStagingPreviewHandoff, withRefusalGuidance } from "../api.js";
2
+ import { VERB_STAGING_REVIEW } from "../constants.js";
3
+ import { openSession, successResult } from "../session.js";
4
+
5
+ export const STAGING_REVIEW_GUIDANCE = "Open the URL once in a browser, then switch the site's theme toggle between "
6
+ + "light and dark to review both schemes; no page draft is needed to review a presentation change.";
7
+
8
+ /**
9
+ * `staging review` — mint a fresh single-use review handoff for the site's
10
+ * acknowledged staging host, and nothing else (TR00800 follow-up).
11
+ *
12
+ * It is the recovery `deploy --staging` names when it could not mint one,
13
+ * and the only such path a managed Docs site can take: `redirects check`
14
+ * inspects a redirect map the Docs shell does not have and needs the
15
+ * Standard surface. Minting is read-only for the site: the handoff is a
16
+ * short-lived capability bound to the current host, reported only in the
17
+ * final JSON and never in progress or GITHUB_OUTPUT.
18
+ */
19
+ export async function stagingReview(invocation) {
20
+ const { client, siteId, now, onProgress } = await openSession(invocation);
21
+ return await withRefusalGuidance(onProgress, "staging review", async () => {
22
+ onProgress("Minting a fresh single-use staging review handoff.");
23
+ const handoff = await mintStagingPreviewHandoff(client, siteId, { now });
24
+ onProgress(`Staging review handoff minted for ${handoff.stagingUrl}. ${STAGING_REVIEW_GUIDANCE}`);
25
+ return successResult(VERB_STAGING_REVIEW, siteId, {
26
+ stagingPreview: { ...handoff, review: STAGING_REVIEW_GUIDANCE },
27
+ });
28
+ });
29
+ }
@@ -6,7 +6,7 @@ import {
6
6
  footerColorOverlay,
7
7
  } from "../appearance-contract.js";
8
8
  import { VERB_THEME_PUSH } from "../constants.js";
9
- import { SiteAuthoringError } from "../errors.js";
9
+ import { MISSING_SETTING_MESSAGE, SiteAuthoringError } from "../errors.js";
10
10
  import { projectFooterSettingsForWorkspace } from "../footer-contract.js";
11
11
  import { computeFooterDraftHash } from "../footer-draft-hash.js";
12
12
  import {
@@ -122,13 +122,13 @@ export async function validateThemeWorkspace(workspaceDir, siteId, knownImageIds
122
122
  if (missing.length > 0) {
123
123
  throw new SiteAuthoringError(
124
124
  "theme.settings_missing",
125
- "Required settings keys are missing. Run 'taproot-site pull' to update this workspace's contract.",
125
+ "Required settings keys are absent from this workspace. Restore them locally, or run 'taproot-site pull' if the workspace is stale; a fresh pull that still omits them means the server projection is incomplete for the listed paths.",
126
126
  {
127
127
  field: missing[0],
128
128
  details: missing.map((field) => ({
129
129
  code: "theme.setting_missing",
130
130
  field,
131
- message: `${field} is missing (added in a later contract; run taproot-site pull)`,
131
+ message: MISSING_SETTING_MESSAGE,
132
132
  })),
133
133
  },
134
134
  );