@taprootio/site-authoring 0.56.0 → 0.59.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 (60) hide show
  1. package/README.md +13 -11
  2. package/package.json +2 -2
  3. package/src/api.js +7 -0
  4. package/src/block-flow.js +4 -2
  5. package/src/changelog.json +87 -0
  6. package/src/chrome-additions.js +106 -0
  7. package/src/chrome-features.js +43 -10
  8. package/src/chrome-input.js +137 -30
  9. package/src/chrome-report.js +4 -2
  10. package/src/cli.js +54 -17
  11. package/src/content/button-styles.js +27 -0
  12. package/src/content/components.js +76 -10
  13. package/src/content/free-form-section-registry.json +9 -0
  14. package/src/content/free-form-sections.js +55 -16
  15. package/src/content/markdown.js +133 -56
  16. package/src/content/media-presentation.js +37 -0
  17. package/src/content/tiptap-prosemirror.ts +26 -10
  18. package/src/credentials.js +2 -1
  19. package/src/delivery-check.js +10 -2
  20. package/src/font-catalog.js +9 -6
  21. package/src/footer-content.js +1 -1
  22. package/src/footer-contract.js +3 -0
  23. package/src/footer-draft-hash.js +1 -0
  24. package/src/heading-outline.js +94 -6
  25. package/src/image-description-contract.js +5 -3
  26. package/src/image-description-write.js +26 -0
  27. package/src/index.js +1 -0
  28. package/src/output.js +2 -1
  29. package/src/page-structure-checks.js +14 -25
  30. package/src/placed-image-ids.js +42 -17
  31. package/src/presentation-reference.js +63 -18
  32. package/src/problems.js +147 -4
  33. package/src/reference-help.js +102 -57
  34. package/src/site-check-findings.js +2 -3
  35. package/src/site-check-rules.json +0 -1
  36. package/src/site-health-findings.js +7 -9
  37. package/src/site-health-image-checks.js +4 -1
  38. package/src/site-health-precheck.js +23 -6
  39. package/src/site-navigation-groups.js +16 -0
  40. package/src/status-warning-paints.js +175 -0
  41. package/src/template-token-reach.json +13 -18
  42. package/src/theme-proposals.js +143 -55
  43. package/src/theme-resolve.js +14 -1
  44. package/src/theme-validation.js +70 -38
  45. package/src/token-reach.js +20 -0
  46. package/src/typed-page-reference.js +3 -2
  47. package/src/typed-pages.js +7 -7
  48. package/src/verbs/changelog.js +23 -2
  49. package/src/verbs/delivery-check.js +43 -9
  50. package/src/verbs/media-images.js +4 -4
  51. package/src/verbs/pages-push.js +38 -32
  52. package/src/verbs/plan.js +28 -20
  53. package/src/verbs/pull.js +179 -24
  54. package/src/verbs/theme-push.js +59 -15
  55. package/src/verbs/theme-resolve.js +109 -11
  56. package/src/verbs/validate.js +97 -16
  57. package/src/workspace-check.js +4 -4
  58. package/src/workspace-context-usage.js +180 -0
  59. package/src/workspace.js +12 -0
  60. package/test/fixtures/default-site-theme.json +1 -1
@@ -1,11 +1,18 @@
1
- import { NAV_ITEM_KIND_EXTERNAL_URL, NAV_ITEM_KIND_PAGE, PAGE_STATUS_PUBLISHED } from "./api.js";
1
+ import {
2
+ NAV_ITEM_KIND_EXTERNAL_URL,
3
+ NAV_ITEM_KIND_GROUP_HEADER,
4
+ NAV_ITEM_KIND_PAGE,
5
+ PAGE_STATUS_APPROVED,
6
+ PAGE_STATUS_PUBLISHED,
7
+ } from "./api.js";
2
8
  import { resolveBrandColors, resolveBrandColorSourceFields, resolveBrandColorToken, resolveFooterBrandColors } from "./brand-color.js";
3
9
  import { chromeFeatures } from "./chrome-features.js";
4
- import { isCanonicalUuid } from "./errors.js";
10
+ import { isCanonicalUuid, sanitizeDiagnostic } from "./errors.js";
5
11
  import { validateFooterDocument } from "./footer-contract.js";
6
12
  import { resolveFooterLogoPairs } from "./footer-branding.js";
7
13
  import { resolveHeaderLogoPairs } from "./header-presentation.js";
8
14
  import { logoInputsFromSettings } from "./logo-inputs.js";
15
+ import { resolveNavigationItems } from "./site-navigation-groups.js";
9
16
  import { sharedDeclaredThemeContextNames } from "./theme-contexts.js";
10
17
  import { validateNavigationWorkspaceDocument } from "./verbs/nav-push.js";
11
18
  import { NAVIGATION_FILE_NAME, normalizePagePath, readWorkspaceJson, WORKSPACE_LIMITS } from "./workspace.js";
@@ -13,8 +20,20 @@ import { NAVIGATION_FILE_NAME, normalizePagePath, readWorkspaceJson, WORKSPACE_L
13
20
  export const CHROME_NAVIGATION_UNAVAILABLE_MESSAGE =
14
21
  "Navigation contrast was not checked because navigation information was unavailable.";
15
22
 
23
+ // Staging links approved pages as well as published ones, so the check does too.
16
24
  export const CHROME_OFFLINE_PAGE_LIMITATION =
17
- "navigation or footer page-link contrast for destinations without a published path in the workspace inventory";
25
+ "navigation or footer page-link contrast for destinations the page inventory cannot resolve to a path "
26
+ + "(approved and published pages count as links; draft pages are reported in skippedNavigationLinks)";
27
+
28
+ export const SKIPPED_LINK_REASONS = Object.freeze(["draft_page", "missing_page", "unknown_path"]);
29
+ const MAXIMUM_SKIPPED_ITEMS = 50;
30
+ const MAXIMUM_SKIPPED_LABEL = 80;
31
+ const LINKED_PAGE_STATUSES = new Set([PAGE_STATUS_PUBLISHED, PAGE_STATUS_APPROVED]);
32
+ const NAVIGATION_KINDS = {
33
+ page: NAV_ITEM_KIND_PAGE,
34
+ externalUrl: NAV_ITEM_KIND_EXTERNAL_URL,
35
+ groupHeader: NAV_ITEM_KIND_GROUP_HEADER,
36
+ };
18
37
 
19
38
  export const CHROME_REPORT_NAME_RULE = "theme.chrome_report_name";
20
39
 
@@ -30,40 +49,127 @@ function isSettingsOnly(resources) {
30
49
  /** Take optional workspace evidence while the caller still owns its read snapshot. */
31
50
  export async function captureChromeResources(resources) {
32
51
  if (resources.workspaceDir === undefined || isSettingsOnly(resources) || Object.hasOwn(resources, "navigation")) return resources;
33
- const { manifest, siteId, workspaceDir, knownPageResourceIds } = resources;
52
+ const { siteId, workspaceDir } = resources;
34
53
  try {
35
54
  const parsed = await readWorkspaceJson(workspaceDir, NAVIGATION_FILE_NAME, WORKSPACE_LIMITS.navigationBytes);
36
- const knownPages = manifest === undefined ? undefined : {
37
- pageIds: new Set(manifest.pages.map((page) => page?.pageId).filter(isCanonicalUuid)),
38
- resourceIds: knownPageResourceIds,
39
- };
40
- const navigation = validateNavigationWorkspaceDocument(parsed, siteId, knownPages);
55
+ // Shape only: a page target the manifest lacks is reported as a skipped link, not as missing navigation.
56
+ const navigation = validateNavigationWorkspaceDocument(parsed, siteId);
41
57
  return { ...resources, navigation };
42
58
  } catch {
43
59
  return { ...resources, navigation: undefined };
44
60
  }
45
61
  }
46
62
 
47
- function workspacePublishedPagePaths(manifest) {
48
- const paths = new Map();
49
- for (const page of manifest?.pages ?? []) {
50
- if (page?.status !== PAGE_STATUS_PUBLISHED || !isCanonicalUuid(page.resourceId)) continue;
63
+ /**
64
+ * The entries a published site links: a canonical page and resource id and a linked status. `path` is the
65
+ * normalized path without slashes ("" for the home page). Chrome checks and delivery routes both read this list
66
+ * (TR01420), so a never-saved entry is neither a link target nor a route to fetch.
67
+ */
68
+ export function linkedPageEntries(pages) {
69
+ const linked = [];
70
+ for (const page of pages ?? []) {
71
+ if (!isCanonicalUuid(page?.resourceId) || !isCanonicalUuid(page?.pageId) || !LINKED_PAGE_STATUSES.has(page.status)) continue;
72
+ const path = normalizePagePath(page.path);
73
+ if (path !== undefined) linked.push({ resourceId: page.resourceId, path, templateType: page.templateType });
74
+ }
75
+ return linked;
76
+ }
77
+
78
+ /**
79
+ * Saved entries a published site does not link: a canonical page and resource id, but a status other than published
80
+ * or approved (a draft or other unapproved page). Entries with no saved page id are not pages yet and are left out.
81
+ */
82
+ export function unlinkedSavedPageEntries(pages) {
83
+ const unlinked = [];
84
+ for (const page of pages ?? []) {
85
+ if (!isCanonicalUuid(page?.resourceId) || !isCanonicalUuid(page?.pageId) || LINKED_PAGE_STATUSES.has(page.status)) continue;
86
+ const path = normalizePagePath(page.path);
87
+ if (path !== undefined) unlinked.push({ path: sanitizeDiagnostic(path === "" ? "/" : `/${path}/`, "(unprintable path)"), status: page.status });
88
+ }
89
+ return unlinked;
90
+ }
91
+
92
+ /**
93
+ * What the pages known to the caller can link to. `pages` are manifest entries or site summaries;
94
+ * `complete` says no page is missing from the list. `knownPaths` covers every entry, drafts included,
95
+ * so a skipped link can say where its page lives.
96
+ */
97
+ export function pageLinkInventory(pages, complete) {
98
+ const statuses = new Map();
99
+ const knownPaths = new Map();
100
+ for (const page of pages ?? []) {
101
+ if (!isCanonicalUuid(page?.resourceId)) continue;
51
102
  const path = normalizePagePath(page.path);
52
- if (path !== undefined) paths.set(page.resourceId, `/${path}`);
103
+ if (path !== undefined) knownPaths.set(page.resourceId, `/${path}`);
104
+ // A pending entry that kept a resourceId after losing its pageId is not a page the site has.
105
+ if (isCanonicalUuid(page.pageId)) statuses.set(page.resourceId, page.status);
106
+ }
107
+ const paths = new Map(linkedPageEntries(pages).map(({ resourceId, path }) => [resourceId, `/${path}`]));
108
+ return { paths, statuses, knownPaths, complete };
109
+ }
110
+
111
+ function skippedReason(inventory, resourceId) {
112
+ const status = inventory.statuses.get(resourceId);
113
+ const [draft, missing, unknown] = SKIPPED_LINK_REASONS;
114
+ if (status === undefined) return inventory.complete ? missing : unknown;
115
+ return LINKED_PAGE_STATUSES.has(status) ? unknown : draft;
116
+ }
117
+
118
+ function* navigationPageItems(items) {
119
+ for (const item of items ?? []) {
120
+ if (item.kind === NAV_ITEM_KIND_PAGE) yield { label: item.title, resourceId: item.resourceId, url: item.url };
121
+ yield* navigationPageItems(item.children);
53
122
  }
54
- return paths;
55
123
  }
56
124
 
57
- function resolveNavigation(items, pagePaths) {
58
- return items?.map((item) => ({
59
- ...item,
60
- url: item.kind === NAV_ITEM_KIND_PAGE
61
- ? (pagePaths === undefined ? "/" : pagePaths.get(item.resourceId) ?? "")
62
- : item.kind === NAV_ITEM_KIND_EXTERNAL_URL
63
- ? item.externalUrl
64
- : "",
65
- children: resolveNavigation(item.children, pagePaths) ?? [],
66
- }));
125
+ function* footerPageTargets(node) {
126
+ if (node === null || typeof node !== "object") return;
127
+ if (typeof node.pageResourceId === "string") yield { label: node.label, resourceId: node.pageResourceId };
128
+ for (const value of Object.values(node)) yield* footerPageTargets(value);
129
+ }
130
+
131
+ /** A path safe to print and to put in a result: control and bidirectional characters removed, null when none is left. */
132
+ function sanitizedPath(path) {
133
+ return typeof path === "string" ? sanitizeDiagnostic(path, "") || null : null;
134
+ }
135
+
136
+ /** The page links the check could not resolve, with the full count and a bounded list. */
137
+ function skippedLinks(inventory, navItems, footerSettings) {
138
+ const skipped = [];
139
+ const note = ({ label, resourceId }, location) => skipped.push({
140
+ label: [...sanitizeDiagnostic(String(label || ""), "(unlabeled link)")].slice(0, MAXIMUM_SKIPPED_LABEL).join(""),
141
+ reason: skippedReason(inventory, resourceId),
142
+ location,
143
+ resourceId: isCanonicalUuid(resourceId) ? resourceId : null,
144
+ path: sanitizedPath(inventory.knownPaths.get(resourceId)),
145
+ });
146
+ for (const item of navigationPageItems(navItems)) if (item.url === "") note(item, "header");
147
+ if (footerSettings?.enabled === true) {
148
+ for (const target of footerPageTargets(footerSettings)) {
149
+ if (!inventory.paths.has(target.resourceId)) note({ ...target, label: target.label || "footer link" }, "footer");
150
+ }
151
+ }
152
+ return {
153
+ count: skipped.length,
154
+ items: skipped.slice(0, MAXIMUM_SKIPPED_ITEMS),
155
+ ...(skipped.length > MAXIMUM_SKIPPED_ITEMS ? { truncated: true } : {}),
156
+ };
157
+ }
158
+
159
+ /** Text for the verbs that print a chrome report; empty when nothing was skipped. */
160
+ export function describeSkippedLinks(skipped) {
161
+ if (skipped === undefined || skipped.count === 0) return "";
162
+ const shown = skipped.items.map(({ label, reason, location, path }) =>
163
+ `${label} (${reason}, ${location}${path === null || path === undefined ? "" : `, ${sanitizeDiagnostic(String(path), "(unprintable path)")}`})`).join(", ");
164
+ return `${skipped.count} navigation or footer page link(s) were not measured: ${shown}${skipped.truncated ? ", and more" : ""}.`;
165
+ }
166
+
167
+ function pageInventoryFor(resources) {
168
+ if (resources.source === "site") {
169
+ // An unavailable listing is an incomplete inventory: page targets are unknown, not assumed linked.
170
+ return pageLinkInventory(resources.pageInventory?.pages, resources.pageInventory !== undefined && resources.pageInventory.truncated !== true);
171
+ }
172
+ return pageLinkInventory(resources.manifest?.pages, resources.manifest !== undefined && resources.manifest.pagesTruncated !== true);
67
173
  }
68
174
 
69
175
  function resolveLogoPairs(style, header, footer, media, delivery) {
@@ -95,7 +201,6 @@ function checkedFooterSettings(publishing, resources) {
95
201
  if (publishing?.footerSettings === undefined) return undefined;
96
202
  try {
97
203
  return validateFooterDocument(publishing.footerSettings, {
98
- knownPageResourceIds: resources.knownPageResourceIds,
99
204
  knownImageIds: resources.knownImageIds,
100
205
  });
101
206
  } catch {
@@ -112,10 +217,10 @@ export function buildChromeInput({ appearance, resources, nameReportEnabled }) {
112
217
  const footer = checkedFooterSettings(publishing, resources);
113
218
  const footerSettings = footer === undefined ? undefined : { ...footer, ...footerPresentation };
114
219
  const settingsOnly = isSettingsOnly(resources);
115
- const footerPagePaths = settingsOnly ? new Map()
116
- : resources.source === "site" ? undefined
117
- : workspacePublishedPagePaths(resources.manifest);
118
- const navItems = settingsOnly ? undefined : resolveNavigation(resources.navigation?.navItems, footerPagePaths);
220
+ const inventory = settingsOnly ? undefined : pageInventoryFor(resources);
221
+ const footerPagePaths = settingsOnly ? new Map() : inventory?.paths;
222
+ const navItems = settingsOnly || resources.navigation === undefined ? undefined
223
+ : resolveNavigationItems(resources.navigation.navItems, footerPagePaths, NAVIGATION_KINDS);
119
224
  const logoPairs = resolveLogoPairs(style, header, footerSettings, resources.mediaManifest?.media, resources.presentation);
120
225
  const headerBrandColors = resolveBrandColors(header, resolveBrandColorToken);
121
226
  const features = chromeFeatures({
@@ -127,6 +232,7 @@ export function buildChromeInput({ appearance, resources, nameReportEnabled }) {
127
232
  searchEnabled: publishing?.allowSearch === true,
128
233
  hasIconSprite: true,
129
234
  nameReportEnabled: footerSettings === undefined ? undefined : nameReportEnabled,
235
+ themes: { light: style?.lightTheme, dark: style?.darkTheme },
130
236
  });
131
237
  const contexts = new Set(sharedDeclaredThemeContextNames(style?.lightTheme, style?.darkTheme));
132
238
  const surfaces = [
@@ -143,5 +249,6 @@ export function buildChromeInput({ appearance, resources, nameReportEnabled }) {
143
249
  brandColorSourceFields: resolveBrandColorSourceFields(header),
144
250
  badgeSettings: settingsOnly ? undefined : resources.badgeSettings ?? publishing,
145
251
  navigationUnavailable: navItems === undefined,
252
+ skippedNavigationLinks: inventory === undefined || settingsOnly ? undefined : skippedLinks(inventory, navItems, footerSettings),
146
253
  };
147
254
  }
@@ -106,10 +106,11 @@ async function extraPaintEntries(nameReportEnabled) {
106
106
  /** Measure optional chrome without changing the command that accepted the appearance. */
107
107
  export async function completeChromeReport(inputs, { loadFit = loadFitReport } = {}) {
108
108
  let navigationUnavailable = true;
109
+ let skippedNavigationLinks;
109
110
  try {
110
111
  const { themes, appearance, resources, nameReportEnabled } = inputs;
111
112
  const input = buildChromeInput({ appearance, resources, nameReportEnabled });
112
- ({ navigationUnavailable } = input);
113
+ ({ navigationUnavailable, skippedNavigationLinks } = input);
113
114
  const light = parseTheme(themes.light);
114
115
  const dark = parseTheme(themes.dark);
115
116
  if (!light || !dark) throw new Error("Missing accepted theme pair.");
@@ -158,7 +159,7 @@ export async function completeChromeReport(inputs, { loadFit = loadFitReport } =
158
159
  }
159
160
  }
160
161
  }
161
- return { entries, badges, flags, warnings, contrast: { pairs, belowAa: flags.filter(({ code }) => code === CONTRAST_TEXT_BELOW_AA).length }, navigationUnavailable, unavailable: false };
162
+ return { entries, badges, flags, warnings, contrast: { pairs, belowAa: flags.filter(({ code }) => code === CONTRAST_TEXT_BELOW_AA).length }, navigationUnavailable, skippedNavigationLinks, unavailable: false };
162
163
  } catch {
163
164
  return {
164
165
  entries: { light: [], dark: [] },
@@ -167,6 +168,7 @@ export async function completeChromeReport(inputs, { loadFit = loadFitReport } =
167
168
  warnings: [CHROME_UNAVAILABLE_MESSAGE],
168
169
  contrast: { pairs: 0, belowAa: 0 },
169
170
  navigationUnavailable,
171
+ skippedNavigationLinks,
170
172
  unavailable: true,
171
173
  };
172
174
  }
package/src/cli.js CHANGED
@@ -84,6 +84,7 @@ import {
84
84
  getDesignBlueprint,
85
85
  getFooterReference,
86
86
  getPageTypeReference,
87
+ getSectionsReference,
87
88
  getSettingsReference,
88
89
  getThemeReference,
89
90
  getTokenReference,
@@ -91,6 +92,7 @@ import {
91
92
  listComponentTypeReferences,
92
93
  listDesignBlueprints,
93
94
  listPageTypeReferences,
95
+ PAGE_SOURCE_CONFLICT_RULE,
94
96
  DESIGN_TYPES,
95
97
  PAGE_TYPES,
96
98
  REFERENCE_TOPICS,
@@ -149,18 +151,31 @@ const VERBS = Object.freeze([
149
151
  "With no directory, checks the pulled workspace taproot-site.json names; with one, checks that directory, which "
150
152
  + "is either an offline fixture (manifest.fixture.json) or a pulled workspace. Every page source, the theme, "
151
153
  + "appearance, header, brand, footer, navigation, redirects, and forms are checked with the validators the "
152
- + "pushes use, and every problem is reported at once in error.problems (each with its file, code, and field) "
153
- + "rather than one per run. A pulled workspace is checked offline against the pages (generated ones included, "
154
+ + "pushes use, and the refusing validators' findings are reported at once in error.problems (each with its code and "
155
+ + "optional field, a file for most findings, and a line for a Markdown page when the problem has a source line) rather than one per run: "
156
+ + "every problem in a .pm.json page, and every section decoration, background and section-owned image problem "
157
+ + "in a free-form Markdown page. An ordinary .pm.json document finding carries a "
158
+ + "file-qualified field (pages/post.pm.json:data.body), so read the source path from field; a refusal that merges "
159
+ + "several files' problems also adds file, and drops field when it only repeats file. A .pm.json recipe step finding "
160
+ + "is the other shape: it carries file plus a document-relative field. Any other Markdown problem "
161
+ + "stops that file at its first, and so does a decoration or background problem in a typed page such as an "
162
+ + "article; recipe steps report all of theirs. The JSON keeps the problems that fit its size budget and reports "
163
+ + "problemCount and problemsTruncated, error.problems holds at most 5,000, and stderr lists the problems kept. "
164
+ + "A pulled workspace is checked offline against the pages (generated ones included, "
154
165
  + "so navigation to a folder index resolves), images, and baselines its manifests recorded at the pull. "
155
166
  + "A link whose address is only http(s):// plus its own text (left by older editor autolinking) is reported in "
156
167
  + "linkWarnings without refusing; pages push reports the same for the pages it sends. "
157
168
  + "The site checks that can run offline are reported in findings (a rule id, severity, file, and the value "
158
169
  + "found, such as link.page_missing for a link to a page the workspace does not have) and never refuse a "
159
170
  + "warning. For a free-form page they include the page-structure rules: seo.h1_missing when no heading, banner "
160
- + "title or hero title is the page's h1, seo.h1_demoted when a # heading is published as an h2 because the "
171
+ + "title or hero title is the page's h1, seo.h1_demoted when a # heading or a hero title is published as an h2 because the "
161
172
  + "banner's overlay text, a hero title or an earlier # heading already is the h1 (detail names which), "
162
173
  + "seo.heading_renumbered and seo.heading_before_title for headings published at another level, "
163
- + "a11y.link_text_empty. Image-default completeness (a11y.image_default_missing) needs the site's own image "
174
+ + "a11y.link_text_empty. validate cannot see an integration placement's rendered h1, because a placement carries no "
175
+ + "HTML in the document: an earlier placement can make a level-1 heading (a Markdown page has no placement syntax) "
176
+ + "or a hero title render as an h2 without an seo.h1_demoted finding, and a page whose only h1 comes from a "
177
+ + "placement can still receive seo.h1_missing, so check the published page for those. Adopted fragments are "
178
+ + "different: their stored HTML is visible to validate and can trigger seo.h1_demoted. Image-default completeness (a11y.image_default_missing) needs the site's own image "
164
179
  + "records, so plain validate lists it in siteChecks.skipped with imageCheckReason; validate --site reads those "
165
180
  + "records and reports each undescribed image the workspace places in imageFindings, with the exact 'media images "
166
181
  + "describe' command for its fix (notInSiteLibrary lists placed ids that are not in the site's library: deleted, another site's, or owned media such as a copied video poster, on which no description can be set). Placement alt strings "
@@ -198,7 +213,8 @@ const VERBS = Object.freeze([
198
213
  + "The issued sign-in is written to credentials.json under $XDG_CONFIG_HOME/taproot-site/ (falling back to "
199
214
  + "~/.config/taproot-site/), directory 0700 and file 0600, one per API origin, replacing any sign-in already "
200
215
  + "stored for that origin. The secret itself is never displayed, logged, or placed in the JSON result: the "
201
- + "result names the credential by id and display prefix only. "
216
+ + "result names the credential by id and display prefix only. The display prefix is tr_live_ for production Taproot "
217
+ + "and tr_test_ for any other Taproot, so a tr_test_ credential can never act on production. "
202
218
  + "The sign-in authorizes nothing on any site — it lists the account's sites and exchanges itself for "
203
219
  + "short-lived site credentials. It expires after 24 hours without a successful exchange, and any "
204
220
  + "expiry the approver chose bounds that: using the CLI keeps it alive, but never past their date. "
@@ -238,9 +254,14 @@ const VERBS = Object.freeze([
238
254
  configFree: true,
239
255
  positionals: "siteSelector",
240
256
  note: "Accepts a site id, an exact name, or an unambiguous case-insensitive name, and records the choice as "
241
- + "siteId in taproot-site.json — creating that file in the current directory when there is not one yet — "
242
- + "together with the site's authoringSurface, which is what lets a later verb refuse offline when the site "
243
- + "cannot take it. Two sites sharing a name is refused rather than guessed: pass the site id instead.",
257
+ + "siteId in the taproot-site.json found in this or a parent directory, keeping its workspaceDir; it creates "
258
+ + "one in the current directory only when none is found. It also records "
259
+ + "the site's authoringSurface, which is what lets a later verb refuse offline when the site "
260
+ + "cannot take it. Two sites sharing a name is refused rather than guessed: pass the site id instead. "
261
+ + "A leading --config <path> chooses the file to rewrite instead: use rewrites that file, keeping its workspaceDir, "
262
+ + "and the file must already exist (config.not_found otherwise); it never creates one there. When the parent "
263
+ + "chain holds more than one taproot-site.json, discovery refuses with config.ambiguous, and a leading "
264
+ + "--config <path> chooses the intended one.",
244
265
  },
245
266
  {
246
267
  name: VERB_WHOAMI,
@@ -255,7 +276,8 @@ const VERBS = Object.freeze([
255
276
  note: "Answers entirely from local state — the stored sign-in and the configuration — so it still works when the "
256
277
  + `network or the credential does not. Reports whether ${PUBLISH_KEY_ENVIRONMENT_VARIABLE} is set, but never `
257
278
  + "its value. The sign-in secret is never printed; the credential is named by id and display prefix, which are "
258
- + "what an owner needs to revoke it.",
279
+ + "what an owner needs to revoke it. The display prefix is tr_live_ for production Taproot and tr_test_ for any "
280
+ + "other Taproot.",
259
281
  },
260
282
  {
261
283
  name: VERB_CHANGELOG,
@@ -300,7 +322,10 @@ const VERBS = Object.freeze([
300
322
  note: "Every page path keeps exactly one authoritative source. A page whose manifest entry names a source that is "
301
323
  + "still on disk keeps that file, so pull never writes a '.pm.json' beside a tracked '.md'. "
302
324
  + "For a page tracked as Markdown the site's own document is kept as internal state under "
303
- + "'.taproot-site-state/' instead; it is never a page source and is never pushed. "
325
+ + "'.taproot-site-state/' instead; it is never a page source and is never pushed, and you can ignore that "
326
+ + "folder in version control. "
327
+ + "A manifest entry that was never saved (no pageId) and whose source is still on disk is kept, not dropped; "
328
+ + "the result lists these as keptPendingPages, and 'pages push' creates them. "
304
329
  + "To change a page's source format, remove the tracked source and author the other format beside it — two "
305
330
  + "editable sources for one path is a refusal, not a guess. "
306
331
  + "Markdown is deliberately one-way, so a page edited on the site since the last pull cannot be rewritten as "
@@ -410,7 +435,8 @@ const VERBS = Object.freeze([
410
435
  + "already has under another name is refused (authors.handle_taken); under the same name it succeeds with "
411
436
  + "existing: true. A link or image is compared only when its option was passed, so repeating a command after "
412
437
  + "someone added a link still succeeds; a passed value that differs is refused with authors.handle_taken and "
413
- + "points at 'authors set'. authors.json is updated with the new author.",
438
+ + "points at 'authors set'. Site authors have no Taproot account or follow button. "
439
+ + "authors.json is updated with the new author.",
414
440
  },
415
441
  {
416
442
  name: VERB_AUTHORS_SET,
@@ -470,6 +496,7 @@ const VERBS = Object.freeze([
470
496
  + "saved, with completedWrites naming what was written; throttling or a denied write stops further writes and "
471
497
  + "exits 0. Once images are set, nextStep is approve while any selected page holds a draft and deploy --staging "
472
498
  + "otherwise. "
499
+ + "Repeating the author a page already has sends no author update. "
473
500
  + "A page is created without an author unless its source names one ('author:' in the front matter, or 'pages "
474
501
  + "meta set --author'); the pages created that way are listed in pages.authorless with how to credit them, except one whose "
475
502
  + "typed source names a displayAuthor (a site author's handle the byline shows instead of the member). "
@@ -843,11 +870,11 @@ const VERBS = Object.freeze([
843
870
  capabilities: [CAPABILITY_CONTENT],
844
871
  surfaceCapabilities: { [SURFACE_DOCS_PRESENTATION]: [CAPABILITY_DESIGN] },
845
872
  tokens: ["media", "images", "describe"],
846
- summary: "Save or clear an image-owned default with its expected revision.",
873
+ summary: "Save or clear an image-owned default, fenced by its revision.",
847
874
  positionals: "imageId",
848
875
  imageDescriptionOptions: true,
849
876
  json: true,
850
- note: "Supply exactly one of --description and --clear, plus --expected-revision from list/get. "
877
+ note: "Supply exactly one of --description and --clear, plus --expected-revision from list/get, or --if-missing alone to write at the revision the CLI reads. "
851
878
  + "Text is outer-trimmed and limited by the server to 1000 Unicode scalar values; blank text clears to null. "
852
879
  + "--if-missing is checked atomically on the server and cannot clear. A conflict never retries or overwrites another edit. "
853
880
  + "This changes the reusable image default, never a page-body override. Existing published output changes only after deployment.",
@@ -901,6 +928,13 @@ const VERBS = Object.freeze([
901
928
  + "the staged release stored and returns it as siteHealth, the object 'health --staging' returns: each warning, the ones "
902
929
  + "new since production marked newSinceProduction, with a fix. A warning never fails the deploy, and a report that cannot be "
903
930
  + "read is siteHealth with available false; fix every new warning and stage again before handing the release to the owner. "
931
+ + "The four page counts differ. deployment.pageCount is the authored pages the release publishes, the number "
932
+ + "counted against the published-pages allowance; on a Standard site it leaves out the home page, the 404 page "
933
+ + "and generated pages. deployment.pagesGenerated is the pages this deployment "
934
+ + "rendered, and is null when the server reports none (a production promotion of a staged output, a failed "
935
+ + "deployment, or an older record); null is not 0. selection.stagedPageCount is the pages selected for this "
936
+ + "deploy. readiness.pageEstimate.plannedPageCount is the pages staging would generate, the number charged "
937
+ + "against the pages-generated allowance. "
904
938
  + STAGING_REVIEW_SESSION_NOTE,
905
939
  },
906
940
  {
@@ -944,7 +978,7 @@ const VERBS = Object.freeze([
944
978
  deliveryOptions: true,
945
979
  note: "A completed deployment job is not a verified delivery. This read-only check reads the target the way a "
946
980
  + "visitor does and reports each dimension separately: the latest completed deployment for the target, HTTP "
947
- + "delivery of the authored routes (from the workspace manifest, bounded), the favicon, images, module "
981
+ + "delivery of the authored routes (the pages the workspace manifest links, bounded), the favicon, images, module "
948
982
  + "preloads and site bundle they reference, internal link targets, accidental local-only references, and the "
949
983
  + "pinned runtime (its version, entry module and capability modules), plus a browser "
950
984
  + "dimension that runs only when Playwright is installed and is reported as unchecked otherwise. --staging "
@@ -1196,8 +1230,8 @@ function verbHelp(verb) {
1196
1230
  : verb.imageDescriptionOptions
1197
1231
  ? `\n --description <text> Set the shared image default; --description=<text> accepts leading hyphens.
1198
1232
  --clear Clear the default instead of supplying --description.
1199
- --expected-revision <n> Required decimal revision from list/get, including 0.
1200
- --if-missing Save only while the stored default is still null; cannot clear.`
1233
+ --expected-revision <n> Decimal revision from list/get, including 0. It counts description text changes, so a cleared description is not 0. Optional with --if-missing, which reads it.
1234
+ --if-missing Save only while the stored default has no text; cannot clear. Without --expected-revision it reads the image first.`
1201
1235
  : "";
1202
1236
  const authorOptions = verb.authorOptions
1203
1237
  ? `\n --name <text> The name readers see on the byline${verb.authorSet ? "" : " (required)"}.
@@ -1441,6 +1475,7 @@ function parseReferenceArguments(arguments_) {
1441
1475
  if (
1442
1476
  (
1443
1477
  topic === "pages"
1478
+ || topic === "sections"
1444
1479
  || topic === "components"
1445
1480
  || topic === "designs"
1446
1481
  || topic === "nav"
@@ -1485,7 +1520,9 @@ function referenceResult(parsed) {
1485
1520
  case "topics":
1486
1521
  return { ...result, topic: "topics", topics: REFERENCE_TOPICS };
1487
1522
  case "pages":
1488
- return { ...result, topic: "page-types", pageTypes: listPageTypeReferences() };
1523
+ return { ...result, topic: "page-types", pageTypes: listPageTypeReferences(), sourceRule: PAGE_SOURCE_CONFLICT_RULE };
1524
+ case "sections":
1525
+ return { ...result, topic: "sections", sections: getSectionsReference() };
1489
1526
  case "components":
1490
1527
  return { ...result, topic: "component-types", components: listComponentTypeReferences() };
1491
1528
  case "designs":
@@ -0,0 +1,27 @@
1
+ // Generated from shared/button-styles.ts by scripts/sync-field-validation.mjs. Do not edit.
2
+ /**
3
+ * The look an author gives a hero action or a call-to-action button (TR01418). One owner for the values, their
4
+ * defaults and the Espalier button attribute each one maps to, read by the CLI table, the renderer, the client
5
+ * elements and the editors.
6
+ */
7
+ export const BUTTON_STYLES = ["solid", "outline", "text"];
8
+ /** What each style looks like, for the CLI's described value lists and the editors' picker help. */
9
+ export const BUTTON_STYLE_DESCRIPTIONS = {
10
+ solid: "A filled button, the theme's button look.",
11
+ outline: "A transparent button with a link-colored border and label. A theme outline fill fills it and fits the resting label and border to the fill; a theme border color sets the resting border with or without a fill. Hover and focus keep the link-hover colors. It casts the theme shadow only when the theme sets --esp-button-outline-background in componentProperties; the link-hover fill an unfilled outline button shows on hover or focus does not enable it.",
12
+ text: "A borderless, transparent button that reads as a text link.",
13
+ };
14
+ export const HERO_PRIMARY_ACTION_STYLE_DEFAULT = "solid";
15
+ export const HERO_SECONDARY_ACTION_STYLE_DEFAULT = "outline";
16
+ export const CTA_BUTTON_STYLE_DEFAULT = "solid";
17
+ export function isButtonStyle(value) {
18
+ return BUTTON_STYLES.some(style => style === value);
19
+ }
20
+ /** The stored style, or the fallback for an absent or unknown one. */
21
+ export function resolveButtonStyle(value, fallback) {
22
+ return isButtonStyle(value) ? value : fallback;
23
+ }
24
+ /** The Espalier `esp-button` attributes a style sets: `outline` for outline, `incognito` for text. */
25
+ export function buttonStyleAttributes(style) {
26
+ return { outline: style === "outline", incognito: style === "text" };
27
+ }