@taprootio/site-authoring 0.42.0 → 0.56.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 (80) hide show
  1. package/README.md +110 -12
  2. package/examples/riverbend-wellness/settings/site-publishing-preferences.json +3 -0
  3. package/examples/riverbend-wellness/settings/taproot-styles.json +11 -0
  4. package/package.json +4 -3
  5. package/src/api.js +242 -23
  6. package/src/appearance-contract.js +264 -3
  7. package/src/authored-tag-names.js +88 -0
  8. package/src/authors-contract.js +71 -3
  9. package/src/block-flow.js +103 -1
  10. package/src/brand-color.js +22 -0
  11. package/src/breadcrumb-artwork.js +234 -0
  12. package/src/breadcrumb-separators.js +11 -0
  13. package/src/changelog.json +160 -0
  14. package/src/chrome-features.js +6 -2
  15. package/src/chrome-input.js +1 -0
  16. package/src/chrome-paint-catalog-taproot.json +3 -3
  17. package/src/chrome-report.js +91 -12
  18. package/src/cli.js +136 -38
  19. package/src/constants.js +1 -0
  20. package/src/content/components.js +27 -4
  21. package/src/content/external-link.js +2 -1
  22. package/src/content/markdown.js +271 -101
  23. package/src/content/tiptap-prosemirror.ts +125 -43
  24. package/src/content/validate-document.js +4 -1
  25. package/src/content-inset.js +48 -0
  26. package/src/errors.js +1 -0
  27. package/src/espalier-shared.js +26 -0
  28. package/src/field-suggestions.js +40 -0
  29. package/src/fixture-init.js +22 -5
  30. package/src/font-catalog.js +11 -1
  31. package/src/footer-brand-inputs.js +22 -3
  32. package/src/footer-content.js +1 -0
  33. package/src/footer-contract.js +11 -0
  34. package/src/footer-cta-styles.js +6 -0
  35. package/src/footer-draft-hash.js +4 -2
  36. package/src/footer-fit.js +62 -15
  37. package/src/footer-workspace.js +44 -7
  38. package/src/latest-posts-tags.js +57 -0
  39. package/src/page-metadata.js +15 -13
  40. package/src/page-structure-checks.js +5 -0
  41. package/src/page-tag-badge-modes.js +6 -0
  42. package/src/page-tag-writes.js +158 -0
  43. package/src/page-type-tags.js +16 -0
  44. package/src/presentation-reference.js +297 -86
  45. package/src/recipe-page-options.js +22 -0
  46. package/src/recipe-step-contract.js +164 -0
  47. package/src/recipe-step-contract.json +65 -0
  48. package/src/reference-help.js +182 -79
  49. package/src/session.js +39 -24
  50. package/src/setting-reference.js +239 -48
  51. package/src/settings-catalog.js +63 -0
  52. package/src/site-check-findings.js +23 -5
  53. package/src/site-check-rules.json +1 -0
  54. package/src/site-health-findings.js +13 -13
  55. package/src/styling-fixed-values.js +71 -0
  56. package/src/tag-destination-warnings.js +35 -0
  57. package/src/template-token-reach.json +242 -0
  58. package/src/theme-proposals.js +18 -27
  59. package/src/theme-resolve.js +265 -23
  60. package/src/theme-validation.js +118 -7
  61. package/src/token-reach.js +222 -0
  62. package/src/typed-page-reference.js +94 -16
  63. package/src/typed-pages.js +233 -74
  64. package/src/verbs/authors.js +198 -33
  65. package/src/verbs/deploy.js +6 -0
  66. package/src/verbs/footer-push.js +30 -5
  67. package/src/verbs/forms-push.js +11 -3
  68. package/src/verbs/index.js +4 -2
  69. package/src/verbs/pages-delete.js +19 -10
  70. package/src/verbs/pages-push.js +225 -71
  71. package/src/verbs/plan.js +10 -4
  72. package/src/verbs/pull.js +324 -69
  73. package/src/verbs/staging-review.js +27 -1
  74. package/src/verbs/status.js +22 -0
  75. package/src/verbs/theme-push.js +93 -25
  76. package/src/verbs/theme-resolve.js +189 -55
  77. package/src/verbs/validate.js +6 -5
  78. package/src/workspace-check.js +35 -3
  79. package/src/workspace.js +73 -2
  80. package/test/fixtures/default-site-theme.json +516 -0
@@ -1,17 +1,27 @@
1
- import { createSiteAuthor, listSiteAuthors, withRefusalGuidance } from "../api.js";
1
+ import { createSiteAuthor, listSiteAuthors, updateSiteAuthor, withRefusalGuidance } from "../api.js";
2
2
  import {
3
3
  AUTHOR_DISPLAY_NAME_MAXIMUM_LENGTH,
4
4
  AUTHOR_HANDLE_MAXIMUM_LENGTH,
5
5
  AUTHORS_FILE_NAME,
6
+ differingAuthorValues,
6
7
  normalizeAuthorEmail,
7
8
  normalizeAuthorHandle,
8
9
  projectAuthorsForWorkspace,
10
+ requireConsistentAuthorOptions,
9
11
  } from "../authors-contract.js";
10
- import { VERB_AUTHORS_ADD, VERB_AUTHORS_LIST } from "../constants.js";
11
- import { sanitizeDiagnostic, SiteAuthoringError } from "../errors.js";
12
- import { boundedList, openSession, successResult } from "../session.js";
12
+ import { VERB_AUTHORS_ADD, VERB_AUTHORS_LIST, VERB_AUTHORS_SET } from "../constants.js";
13
+ import { isCanonicalUuid, sanitizeDiagnostic, SiteAuthoringError } from "../errors.js";
14
+ import { boundedList, openSession, resolveSiteSession, successResult } from "../session.js";
15
+ import { trimSocialLinkInput } from "../social-link-url.js";
13
16
  import { ApiError } from "../transport.js";
14
- import { ensureWorkspaceRoot, writeWorkspaceJson } from "../workspace.js";
17
+ import {
18
+ ensureWorkspaceRoot,
19
+ mediaReferenceCandidates,
20
+ normalizePagePath,
21
+ readManifest,
22
+ readMediaManifest,
23
+ writeWorkspaceJson,
24
+ } from "../workspace.js";
15
25
 
16
26
  const MAXIMUM_REPORTED = 200;
17
27
 
@@ -57,58 +67,154 @@ export async function authorsList(invocation) {
57
67
  });
58
68
  }
59
69
 
60
- /**
61
- * `authors add` — creates a site author, someone a page can be credited to who
62
- * has no Taproot account, such as one of an imported blog's authors.
63
- */
64
- export async function authorsAdd(invocation) {
65
- const handle = normalizeAuthorHandle(invocation.authorHandle);
70
+ /** The name readers see, trimmed, or a usage refusal. */
71
+ function requireDisplayName(value) {
72
+ const displayName = typeof value === "string" ? value.trim() : "";
73
+ if (displayName === "" || [...displayName].length > AUTHOR_DISPLAY_NAME_MAXIMUM_LENGTH) {
74
+ throw new SiteAuthoringError(
75
+ "authors.name_invalid",
76
+ `--name must be the name readers see, 1 to ${AUTHOR_DISPLAY_NAME_MAXIMUM_LENGTH} characters.`,
77
+ { field: "name", exitCode: 2 },
78
+ );
79
+ }
80
+ return displayName;
81
+ }
82
+
83
+ function requireHandle(value) {
84
+ const handle = normalizeAuthorHandle(value);
66
85
  if (handle === undefined) {
67
86
  throw new SiteAuthoringError(
68
87
  "authors.handle_invalid",
69
- `'${String(invocation.authorHandle ?? "").slice(0, 80)}' is not a handle. Use lowercase letters and digits `
88
+ `'${String(value ?? "").slice(0, 80)}' is not a handle. Use lowercase letters and digits `
70
89
  + `with single hyphens between them, at most ${AUTHOR_HANDLE_MAXIMUM_LENGTH} characters, such as jane-doe.`,
71
90
  { field: "handle", exitCode: 2 },
72
91
  );
73
92
  }
74
- const displayName = typeof invocation.authorName === "string" ? invocation.authorName.trim() : "";
75
- if (displayName === "" || [...displayName].length > AUTHOR_DISPLAY_NAME_MAXIMUM_LENGTH) {
93
+ return handle;
94
+ }
95
+
96
+ function requireEmail(value) {
97
+ const email = normalizeAuthorEmail(value);
98
+ if (email === undefined) {
99
+ throw new SiteAuthoringError("authors.email_invalid", "--email must be an email address.", {
100
+ field: "email",
101
+ exitCode: 2,
102
+ });
103
+ }
104
+ return email;
105
+ }
106
+
107
+ /**
108
+ * The byline link and image the options name, as the ids and address the site
109
+ * takes. A page or image given by path is looked up in the workspace's
110
+ * manifests, so a path the workspace does not know is refused before any
111
+ * request (TR01401). An id is passed on, and the site decides whether it is
112
+ * this site's.
113
+ */
114
+ async function resolveBylineOptions(invocation, config, siteId) {
115
+ const resolved = {};
116
+ if (invocation.authorLinkUrl !== undefined) {
117
+ // The site stores the address trimmed, so it is sent and compared that way. A blank one names no
118
+ // address, and sending it would read as clearing the link.
119
+ const linkUrl = trimSocialLinkInput(invocation.authorLinkUrl);
120
+ if (linkUrl === "") {
121
+ throw new SiteAuthoringError(
122
+ "authors.link_url_invalid",
123
+ "--link-url needs an absolute http or https address. Use --no-link to remove the link.",
124
+ { field: "link-url", exitCode: 2 },
125
+ );
126
+ }
127
+ resolved.linkUrl = linkUrl;
128
+ }
129
+ if (invocation.authorLinkPage !== undefined) {
130
+ resolved.linkPageResourceId = await resolvePageResourceId(config, siteId, invocation.authorLinkPage);
131
+ }
132
+ if (invocation.authorImage !== undefined) {
133
+ resolved.imageId = await resolveImageId(config, siteId, invocation.authorImage);
134
+ }
135
+ return resolved;
136
+ }
137
+
138
+ async function resolvePageResourceId(config, siteId, reference) {
139
+ if (isCanonicalUuid(reference)) return reference;
140
+ const wanted = normalizePagePath(reference);
141
+ const manifest = await readManifest(config.workspaceDir, siteId, { required: false });
142
+ const entry = wanted === undefined
143
+ ? undefined
144
+ : manifest?.pages.find((page) => page !== null && normalizePagePath(page.path) === wanted);
145
+ if (typeof entry?.resourceId !== "string" || !isCanonicalUuid(entry.resourceId)) {
76
146
  throw new SiteAuthoringError(
77
- "authors.name_invalid",
78
- `--name must be the name readers see, 1 to ${AUTHOR_DISPLAY_NAME_MAXIMUM_LENGTH} characters.`,
79
- { field: "name", exitCode: 2 },
147
+ "authors.link_page_unknown",
148
+ `--link-page '${reference.slice(0, 80)}' is not a page the workspace's manifest records. Give the page's `
149
+ + "path as 'pull' recorded it ('/' for the home page), or its resourceId.",
150
+ { field: "link-page", exitCode: 2 },
80
151
  );
81
152
  }
82
- let email;
83
- if (invocation.authorEmail !== undefined) {
84
- email = normalizeAuthorEmail(invocation.authorEmail);
85
- if (email === undefined) {
86
- throw new SiteAuthoringError("authors.email_invalid", "--email must be an email address.", {
87
- field: "email",
88
- exitCode: 2,
89
- });
90
- }
153
+ return entry.resourceId;
154
+ }
155
+
156
+ async function resolveImageId(config, siteId, reference) {
157
+ if (isCanonicalUuid(reference)) return reference;
158
+ const { media } = await readMediaManifest(config.workspaceDir, siteId);
159
+ for (const candidate of mediaReferenceCandidates(reference)) {
160
+ const imageId = media[candidate]?.imageId;
161
+ if (isCanonicalUuid(imageId)) return imageId;
91
162
  }
163
+ throw new SiteAuthoringError(
164
+ "authors.image_unknown",
165
+ `--image '${reference.slice(0, 80)}' is not an image the workspace's media manifest records. Run 'media upload' `
166
+ + "for the file first, or give the image's id.",
167
+ { field: "image", exitCode: 2 },
168
+ );
169
+ }
92
170
 
93
- const { client, config, siteId, onProgress } = await openSession(invocation);
171
+ /** How an author reads in a result and a progress line: only what it has. */
172
+ function authorResult(author) {
173
+ const { handle, displayName, hasEmail, linkPageResourceId, linkUrl, imageId } = author;
174
+ return {
175
+ handle,
176
+ displayName,
177
+ hasEmail,
178
+ ...(linkPageResourceId === undefined ? {} : { linkPageResourceId }),
179
+ ...(linkUrl === undefined ? {} : { linkUrl }),
180
+ ...(imageId === undefined ? {} : { imageId }),
181
+ };
182
+ }
183
+
184
+ /**
185
+ * `authors add` — creates a site author, someone a page can be credited to who
186
+ * has no Taproot account, such as one of an imported blog's authors. The
187
+ * author may carry a byline link and an image (TR01401).
188
+ */
189
+ export async function authorsAdd(invocation) {
190
+ const handle = requireHandle(invocation.authorHandle);
191
+ const displayName = requireDisplayName(invocation.authorName);
192
+ const email = invocation.authorEmail === undefined ? undefined : requireEmail(invocation.authorEmail);
193
+ requireConsistentAuthorOptions(invocation, { set: false });
194
+
195
+ const session = await resolveSiteSession(invocation);
196
+ const byline = await resolveBylineOptions(invocation, session.config, session.siteId);
197
+ const { client, config, siteId, onProgress } = await session.open();
94
198
  // A handle that is already taken by the same person is a repeat of this
95
199
  // command, not a mistake: a script that adds its authors again succeeds.
96
200
  let existing = false;
97
201
  let known;
98
202
  const created = await withRefusalGuidance(onProgress, "authors add", async () => {
99
203
  try {
100
- return await createSiteAuthor(client, siteId, { handle, displayName, email });
204
+ return await createSiteAuthor(client, siteId, { handle, displayName, email, ...byline });
101
205
  } catch (error) {
102
206
  const refusal = translateAuthorsRefusal(error, handle);
103
207
  if (refusal?.code !== "authors.handle_taken") throw refusal;
104
208
  known = await listSiteAuthors(client, siteId);
105
209
  const held = known.authors.find((author) => author.handle === handle);
106
210
  if (held === undefined) throw refusal;
107
- if (held.displayName !== displayName) {
211
+ const differs = differingAuthorValues(held, { displayName, ...byline });
212
+ if (differs.length > 0) {
108
213
  throw new SiteAuthoringError(
109
214
  "authors.handle_taken",
110
- `A site author with the handle '${handle}' already exists, named '${held.displayName}', not `
111
- + `'${displayName}'. Use another handle, or the existing author.`,
215
+ `A site author with the handle '${handle}' already exists and differs in its ${differs.join(" and ")}: `
216
+ + `it is named '${held.displayName}'. Use another handle, the existing author, or `
217
+ + `'authors set ${handle}' to change it.`,
112
218
  { field: "handle" },
113
219
  );
114
220
  }
@@ -133,7 +239,7 @@ export async function authorsAdd(invocation) {
133
239
  onProgress(`The author was created, but ${AUTHORS_FILE_NAME} could not be refreshed: run 'authors list'.`);
134
240
  }
135
241
  return successResult(VERB_AUTHORS_ADD, siteId, {
136
- author: { handle: created.handle, displayName: created.displayName, hasEmail: created.hasEmail },
242
+ author: authorResult(created),
137
243
  existing,
138
244
  ...(refreshed ? { authorsFile: AUTHORS_FILE_NAME } : {}),
139
245
  nextStep: `Credit pages with 'author: ${created.handle}' in a page's front matter or `
@@ -141,12 +247,66 @@ export async function authorsAdd(invocation) {
141
247
  });
142
248
  }
143
249
 
250
+ /**
251
+ * `authors set` — changes a site author's name, private email, byline link or
252
+ * image. Only what was passed is sent, so the rest keeps its stored value.
253
+ * A change to the byline of an author on published pages queues a deployment
254
+ * (TR01401).
255
+ */
256
+ export async function authorsSet(invocation) {
257
+ const handle = requireHandle(invocation.authorHandle);
258
+ requireConsistentAuthorOptions(invocation, { set: true });
259
+ const displayName = invocation.authorName === undefined ? undefined : requireDisplayName(invocation.authorName);
260
+ const email = invocation.authorEmail === undefined ? undefined : requireEmail(invocation.authorEmail);
261
+
262
+ const session = await resolveSiteSession(invocation);
263
+ const byline = await resolveBylineOptions(invocation, session.config, session.siteId);
264
+ const { client, config, siteId, onProgress } = await session.open();
265
+ const changes = {
266
+ ...(displayName === undefined ? {} : { displayName }),
267
+ ...(email === undefined ? {} : { email }),
268
+ ...(invocation.authorNoEmail ? { email: "" } : {}),
269
+ ...byline,
270
+ ...(invocation.authorNoLink ? { linkPageResourceId: "", linkUrl: "" } : {}),
271
+ ...(invocation.authorNoImage ? { imageId: "" } : {}),
272
+ };
273
+ const author = await withRefusalGuidance(onProgress, "authors set", async () => {
274
+ try {
275
+ return await updateSiteAuthor(client, siteId, handle, changes);
276
+ } catch (error) {
277
+ if (error instanceof ApiError && error.httpStatus === 404) {
278
+ throw new SiteAuthoringError(
279
+ "authors.handle_unknown",
280
+ `This site has no site author with the handle '${handle}'. Run 'authors list' to see the handles, or `
281
+ + "'authors add' to create one.",
282
+ { field: "handle" },
283
+ );
284
+ }
285
+ throw translateAuthorsRefusal(error, handle);
286
+ }
287
+ });
288
+ onProgress(`Changed site author '${author.handle}' (${author.displayName}).`);
289
+
290
+ let refreshed = false;
291
+ try {
292
+ await writeAuthorsFile(config, siteId, await listSiteAuthors(client, siteId));
293
+ refreshed = true;
294
+ } catch (error) {
295
+ if (!(error instanceof SiteAuthoringError)) throw error;
296
+ onProgress(`The author was changed, but ${AUTHORS_FILE_NAME} could not be refreshed: run 'authors list'.`);
297
+ }
298
+ return successResult(VERB_AUTHORS_SET, siteId, {
299
+ author: authorResult(author),
300
+ ...(refreshed ? { authorsFile: AUTHORS_FILE_NAME } : {}),
301
+ });
302
+ }
303
+
144
304
  async function writeAuthorsFile(config, siteId, listing) {
145
305
  await ensureWorkspaceRoot(config);
146
306
  await writeWorkspaceJson(config.workspaceDir, AUTHORS_FILE_NAME, projectAuthorsForWorkspace(siteId, listing));
147
307
  }
148
308
 
149
- /** Gives the site's refusals of a new author the stable codes the CLI documents. */
309
+ /** Gives the site's refusals of a new or changed author the stable codes the CLI documents. */
150
310
  function translateAuthorsRefusal(error, handle) {
151
311
  if (!(error instanceof ApiError)) return error;
152
312
  for (const [field, code, fallback] of [
@@ -154,6 +314,11 @@ function translateAuthorsRefusal(error, handle) {
154
314
  ["Handle", "authors.handle_invalid", `'${handle}' cannot be used as a handle.`],
155
315
  ["DisplayName", "authors.name_invalid", "The name was refused."],
156
316
  ["Email", "authors.email_invalid", "The email address was refused."],
317
+ ["Link", "authors.link_conflict", "Give a page or a web address for the byline link, not both."],
318
+ ["LinkUrl", "authors.link_url_invalid", "The byline link must be an absolute http or https address."],
319
+ ["LinkPageResourceId", "authors.link_page_unknown", "The byline link is not a page on this site."],
320
+ ["ImageId", "authors.image_unknown", "The image is not in this site's media library."],
321
+ ["Deployment", "authors.deployment_refused", "The change could not queue the deployment it needs."],
157
322
  ]) {
158
323
  if (error.hasField(field)) {
159
324
  return new SiteAuthoringError(
@@ -27,6 +27,7 @@ import { SiteAuthoringError } from "../errors.js";
27
27
  import { boundedList, openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
28
28
  import { HANDOFF_NOT_REQUESTED_PROGRESS, handoffNotRequested, inspectStagingPreview } from "../staging-check.js";
29
29
  import { confirmStagingServed, readStagingReleaseBefore, unverifiedStagingServed } from "../staging-served.js";
30
+ import { missingTagDestinations, reportTagDestinationWarnings } from "../tag-destination-warnings.js";
30
31
  import { ApiError } from "../transport.js";
31
32
  import { readManifest, writeManifest } from "../workspace.js";
32
33
  import { DEPLOY_HEALTH_BUDGETS, DOCS_SITE_HEALTH_NOT_COVERED, readFailureCode, readSiteHealthReport } from "./health.js";
@@ -270,6 +271,9 @@ export async function deploy(invocation) {
270
271
  warnIfExternalWritesPaused(session, VERB_DEPLOY);
271
272
  const manifest = await readManifest(config.workspaceDir, siteId, { required: false });
272
273
  const selection = explicitSelection(invocation);
274
+ const tagDestinationWarnings = presentationOnly ? undefined : reportTagDestinationWarnings(
275
+ missingTagDestinations(manifest?.presentation, manifest), onProgress,
276
+ );
273
277
 
274
278
  return await withRefusalGuidance(onProgress, "deploy", async () => {
275
279
  if (target === DEPLOY_TARGET_PRODUCTION) {
@@ -309,6 +313,7 @@ export async function deploy(invocation) {
309
313
  deployment: completed,
310
314
  outcome: created.outcome,
311
315
  readiness: reportReadiness(readiness),
316
+ ...(tagDestinationWarnings === undefined ? {} : { tagDestinationWarnings }),
312
317
  });
313
318
  }
314
319
 
@@ -498,6 +503,7 @@ export async function deploy(invocation) {
498
503
  deployment: completed,
499
504
  outcome: created.outcome,
500
505
  readiness: reportReadiness(readiness),
506
+ ...(tagDestinationWarnings === undefined ? {} : { tagDestinationWarnings }),
501
507
  stagingServed,
502
508
  siteHealth,
503
509
  routeCheck,
@@ -1,17 +1,18 @@
1
- import { PRESENTATION_REVISION, saveSiteFooterSettings, withRefusalGuidance } from "../api.js";
1
+ import { getSettingsGroup, PRESENTATION_REVISION, saveSiteFooterSettings, withRefusalGuidance } from "../api.js";
2
2
  import { VERB_FOOTER_PUSH } from "../constants.js";
3
3
  import { SiteAuthoringError } from "../errors.js";
4
4
  import { FOOTER_PRESENTATION_FIELDS, projectFooterContent } from "../footer-content.js";
5
5
  import { projectFooterSettingsForWorkspace, validateFooterDocument } from "../footer-contract.js";
6
6
  import { computeFooterDraftHash } from "../footer-draft-hash.js";
7
- import { readFooterBrandInputs } from "../footer-brand-inputs.js";
8
- import { buildFooterFitInput } from "../footer-fit.js";
7
+ import { readFooterFitInput } from "../footer-brand-inputs.js";
9
8
  import { evaluateOfflineSiteChecks } from "../site-check-findings.js";
10
9
  import {
11
10
  advanceFooterManifest,
11
+ compareFooterContent,
12
12
  FOOTER_SETTINGS_FILE,
13
13
  readFooterWorkspaceContext,
14
14
  readPresentationBaseline,
15
+ reportFooterPreview,
15
16
  } from "../footer-workspace.js";
16
17
  import { openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
17
18
  import { SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES } from "../settings-catalog.js";
@@ -67,10 +68,11 @@ function translateConcurrency(error) {
67
68
  export async function footerPush(invocation) {
68
69
  const session = await openSession(invocation);
69
70
  const { client, config, siteId, onProgress } = session;
71
+ const dryRun = invocation.dryRun === true;
70
72
  // One advisory line before this verb does any work, and only when the
71
73
  // exchange said the platform is paused. It changes nothing else: the write
72
74
  // still runs and its refusal still classifies as platform_paused (TR00692).
73
- warnIfExternalWritesPaused(session, VERB_FOOTER_PUSH);
75
+ if (!dryRun) warnIfExternalWritesPaused(session, VERB_FOOTER_PUSH);
74
76
  const context = await readFooterWorkspaceContext(config.workspaceDir, siteId);
75
77
  const { document: document_, footerSettings } = validateFooterWorkspaceDocument(
76
78
  await readWorkspaceJson(config.workspaceDir, FOOTER_SETTINGS_FILE, WORKSPACE_LIMITS.settingsBytes),
@@ -85,10 +87,30 @@ export async function footerPush(invocation) {
85
87
  const footerChecks = evaluateOfflineSiteChecks({
86
88
  pagePaths: [],
87
89
  footerOnly: true,
88
- footerInput: buildFooterFitInput(footerSettings, await readFooterBrandInputs(config.workspaceDir, footerSettings)),
90
+ footerInput: await readFooterFitInput(config.workspaceDir, footerSettings),
89
91
  onProgress,
90
92
  });
91
93
 
94
+ if (dryRun) {
95
+ const response = await withRefusalGuidance(onProgress, VERB_FOOTER_PUSH, () =>
96
+ getSettingsGroup(client, siteId, SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES));
97
+ const current = response.sitePublishingPreferences?.footerSettings;
98
+ if (!isPlainObject(current)) {
99
+ throw new SiteAuthoringError("api.footer_settings_contract", "Taproot returned no draft footer document.", {
100
+ field: "footerSettings",
101
+ });
102
+ }
103
+ const preview = compareFooterContent(context.footer, projectFooterSettingsForWorkspace(current), footerSettings);
104
+ reportFooterPreview(preview, onProgress);
105
+ onProgress("Dry run: nothing was written.");
106
+ return successResult(VERB_FOOTER_PUSH, siteId, {
107
+ dryRun: true,
108
+ footerFile: FOOTER_SETTINGS_FILE,
109
+ ...preview,
110
+ ...footerChecks,
111
+ });
112
+ }
113
+
92
114
  let response;
93
115
  try {
94
116
  response = await withRefusalGuidance(onProgress, "footer push", async () =>
@@ -140,6 +162,9 @@ export async function footerPush(invocation) {
140
162
  }
141
163
  await advanceFooterManifest(config.workspaceDir, siteId, saved, footerDraftHash, {
142
164
  presentationRevision: advances ? response.presentationRevision : undefined,
165
+ tagDestinations: context.manifest.presentation?.tagDestinations,
166
+ recipeMetadataDestinations: context.manifest.presentation?.recipeMetadataDestinations,
167
+ authoredTagSlugs: context.manifest.presentation?.authoredTagSlugs,
143
168
  });
144
169
  } catch (error) {
145
170
  if (error instanceof SiteAuthoringError) throw error.withCompletedWrites(["footerSettings"]);
@@ -236,9 +236,17 @@ export async function formsPush(invocation) {
236
236
  } catch (caught) {
237
237
  // The site checks the recorded version and settings under its own lock,
238
238
  // which is what closes the gap between the comparison above and the write.
239
- const error = caught instanceof ApiError && (caught.hasField("ExpectedVersion") || caught.hasField("ExpectedSettings"))
240
- ? changedOnTheSite(form.key, caught, applied)
241
- : caught;
239
+ let error = caught;
240
+ if (caught instanceof ApiError && (caught.hasField("ExpectedVersion") || caught.hasField("ExpectedSettings"))) {
241
+ error = changedOnTheSite(form.key, caught, applied);
242
+ } else if (caught instanceof ApiError && caught.descriptionFor("Sink") === "newsletter_disabled") {
243
+ error = new SiteAuthoringError(
244
+ "forms.newsletter_disabled",
245
+ `${formFileName(form.key)}: Taproot has disabled newsletter capture. Set sink to 'none' to keep collecting `
246
+ + "form submissions, or ask a Taproot administrator to turn on Site Forms → Newsletter sink enabled.",
247
+ { field: `${formFileName(form.key)}:sink`, status: caught.status },
248
+ );
249
+ }
242
250
  if (error instanceof SiteAuthoringError) {
243
251
  const completed = results.filter((item) => item.action !== "unchanged").map((item) => item.key);
244
252
  if (applied.settings || applied.definition) completed.push(form.key);
@@ -3,6 +3,7 @@ import {
3
3
  VERB_APPROVE,
4
4
  VERB_AUTHORS_ADD,
5
5
  VERB_AUTHORS_LIST,
6
+ VERB_AUTHORS_SET,
6
7
  VERB_DELIVERY_CHECK,
7
8
  VERB_DEPLOY,
8
9
  VERB_CHANGELOG,
@@ -47,7 +48,7 @@ import {
47
48
  VERB_WHOAMI,
48
49
  } from "../constants.js";
49
50
  import { approve } from "./approve.js";
50
- import { authorsAdd, authorsList } from "./authors.js";
51
+ import { authorsAdd, authorsList, authorsSet } from "./authors.js";
51
52
  import { changelog } from "./changelog.js";
52
53
  import { deliveryCheck } from "./delivery-check.js";
53
54
  import { deploy } from "./deploy.js";
@@ -137,7 +138,7 @@ import { whoami } from "./whoami.js";
137
138
  * placeId, // places category clear: [placeId]
138
139
  * pagePaths, // approve: narrow to these page paths; with none, every
139
140
  * // draft the workspace manifest tracks is staged
140
- * authorHandle, // authors add: the handle of the site author to create
141
+ * authorHandle, // authors add / set: the handle of the site author to create or change
141
142
  * deletePagePath, // pages delete: the one tracked page to delete
142
143
  * pageId, // preview page: the one persisted draft UUID to render
143
144
  * previewIds, // preview revoke: [page UUID, snapshot UUID]
@@ -175,6 +176,7 @@ export const VERB_HANDLERS = Object.freeze({
175
176
  [VERB_PAGES_DELETE]: pagesDelete,
176
177
  [VERB_AUTHORS_LIST]: authorsList,
177
178
  [VERB_AUTHORS_ADD]: authorsAdd,
179
+ [VERB_AUTHORS_SET]: authorsSet,
178
180
  [VERB_NAV_PUSH]: navPush,
179
181
  [VERB_PLAN]: plan,
180
182
  [VERB_PLACES_SEARCH]: placesSearch,
@@ -14,6 +14,7 @@ import { FOOTER_SETTINGS_FILE } from "../footer-workspace.js";
14
14
  import { afterSubmitPage, FORM_FILE_EXTENSION, FORMS_DIRECTORY, normalizePagePath as normalizeFormPagePath } from "../forms-contract.js";
15
15
  import { normalizeRedirectPath } from "../site-checks.js";
16
16
  import { boundedList, openSession, successResult, warnIfExternalWritesPaused } from "../session.js";
17
+ import { reportTagDestinationWarnings, tagDestinationEntries } from "../tag-destination-warnings.js";
17
18
  import { isAuthorableTemplateType, isGeneratedTemplateType, isLegalTemplateType } from "../typed-pages.js";
18
19
  import {
19
20
  deleteWorkspaceFile,
@@ -131,15 +132,12 @@ async function formsSendingTo(workspaceDir, pagePath, resourceId) {
131
132
  return found;
132
133
  }
133
134
 
134
- async function footerLinks(workspaceDir, resourceId, shown) {
135
- if (!await workspaceFileExists(workspaceDir, FOOTER_SETTINGS_FILE)) return [];
136
- return footerLinksTo(
137
- await readReferenceSource(
138
- async () => await readWorkspaceJson(workspaceDir, FOOTER_SETTINGS_FILE, WORKSPACE_LIMITS.documentBytes),
139
- FOOTER_SETTINGS_FILE,
140
- shown,
141
- ),
142
- resourceId,
135
+ async function readPublishingDocument(workspaceDir, shown) {
136
+ if (!await workspaceFileExists(workspaceDir, FOOTER_SETTINGS_FILE)) return undefined;
137
+ return await readReferenceSource(
138
+ async () => await readWorkspaceJson(workspaceDir, FOOTER_SETTINGS_FILE, WORKSPACE_LIMITS.documentBytes),
139
+ FOOTER_SETTINGS_FILE,
140
+ shown,
143
141
  );
144
142
  }
145
143
 
@@ -259,10 +257,12 @@ export async function pagesDelete(invocation) {
259
257
 
260
258
  const references = { navigation: [], footer: [], forms: [] };
261
259
  let redirects = [];
260
+ let publishingDocument;
262
261
  if (!alreadyGone) {
263
262
  onProgress("Checking what refers to the page.");
264
263
  references.navigation = navigationItemsTo((await getNavigation(client, siteId)).navItems, live.resourceId);
265
- references.footer = await footerLinks(config.workspaceDir, live.resourceId, shown);
264
+ publishingDocument = await readPublishingDocument(config.workspaceDir, shown);
265
+ references.footer = footerLinksTo(publishingDocument, live.resourceId);
266
266
  references.forms = await formsSendingTo(config.workspaceDir, pagePath, live.resourceId);
267
267
  if (references.navigation.length + references.footer.length + references.forms.length > 0) {
268
268
  throw refusal(
@@ -286,7 +286,16 @@ export async function pagesDelete(invocation) {
286
286
  redirects = redirectsLandingOn((await getSiteRedirectMap(client, siteId)).entries, pagePath);
287
287
  }
288
288
 
289
+ const resourceId = live?.resourceId || entry.resourceId;
290
+ const destinations = new Map();
291
+ for (const source of [manifest.presentation, publishingDocument?.settings]) {
292
+ for (const item of tagDestinationEntries(source)) {
293
+ if (item.resourceId === resourceId) destinations.set(item.setting + "." + item.name, item);
294
+ }
295
+ }
296
+ const tagDestinationWarnings = reportTagDestinationWarnings([...destinations.values()], onProgress, shown);
289
297
  const report = {
298
+ ...(tagDestinationWarnings === undefined ? {} : { tagDestinationWarnings }),
290
299
  page: {
291
300
  path: shown,
292
301
  ...(entry.file === undefined ? {} : { file: entry.file }),