@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,24 +1,91 @@
1
- import { parseTheme } from "@taprootio/espalier/shared/theme";
1
+ import { parseTheme, semanticToCSS, wcagRatio } from "@taprootio/espalier/shared/theme";
2
2
 
3
3
  import { APPEARANCE_FILES } from "./appearance-contract.js";
4
+ import { RECIPE_TAGS_BAR_PAINT_DEFAULTS, resolveRecipeTagsBarColor } from "./brand-color.js";
4
5
  import { standaloneFooterActionEntries } from "./chrome-features.js";
5
6
  import { buildChromeInput } from "./chrome-input.js";
6
- import { CHROME_UNAVAILABLE_MESSAGE, displayChromeRatio } from "./chrome-output.js";
7
+ import { CHROME_UNAVAILABLE_MESSAGE, displayChromeContext, displayChromeRatio } from "./chrome-output.js";
7
8
  import taprootCatalog from "./chrome-paint-catalog-taproot.json" with { type: "json" };
8
- import { loadEspalierShared } from "./espalier-shared.js";
9
+ import { CLI_BINARY_NAME } from "./constants.js";
10
+ import { BADGE_FOCUS_RING, loadEspalierShared, supportsBadgeFocusRing } from "./espalier-shared.js";
11
+ import { normalizePageTagBadges } from "./page-tag-badge-modes.js";
12
+ import { normalizeRecipeTagsContent, normalizeRecipeTagsIcon } from "./recipe-page-options.js";
9
13
  import { SETTINGS_TYPE_SITE_HEADER, SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES } from "./settings-catalog.js";
10
14
  import { CONTRAST_TEXT_BELOW_AA, THEME_STYLES_FILE } from "./theme-resolve.js";
11
15
  import { loadFitReport } from "./theme-validation.js";
16
+ import { describeChromeToken } from "./token-reach.js";
12
17
 
13
18
  export { CHROME_UNAVAILABLE_MESSAGE } from "./chrome-output.js";
14
19
 
15
20
  const SCHEMES = ["light", "dark"];
21
+ const THEME_RESOLVE_GUIDANCE = `See ${CLI_BINARY_NAME} theme resolve.`;
22
+
23
+ const RECIPE_BAR_ICON = "recipe-tag-icon";
24
+ export const RECIPE_TAG_ICON_CONTRAST = "theme.recipe_tag_icon_contrast";
25
+
26
+ async function measureBadgePaint(suite, settings, rootSurface) {
27
+ if (settings === undefined) return { light: [], dark: [] };
28
+ const { parsePaintColor, compositePaint, paintRequiredRatio } = await loadEspalierShared("paint-color.js");
29
+ const hasFocusRing = supportsBadgeFocusRing();
30
+ const mode = normalizePageTagBadges(settings.pageTagBadges);
31
+ const barContents = normalizeRecipeTagsContent(settings.recipeTagsContent);
32
+ const hasTagLinks = Object.keys(settings.tagDestinations ?? {}).length > 0;
33
+ const hasMetadataLinks = Object.keys(settings.recipeMetadataDestinations ?? {}).length > 0;
34
+ const barLinks = hasTagLinks || (barContents !== "tags" && hasMetadataLinks);
35
+ const barIcon = normalizeRecipeTagsIcon(settings.recipeTagsIcon) !== "none";
36
+ const resolveBarColor = (value, fallback, colors) => {
37
+ // Theme resolve accepts partially edited preferences as optional evidence.
38
+ if (value != null && typeof value !== "string") return null;
39
+ const paint = resolveRecipeTagsBarColor(value, fallback);
40
+ const absolute = paint.startsWith("var(") ? colors.get(paint.slice(4, -1)) : paint;
41
+ return absolute === undefined ? null : parsePaintColor(absolute);
42
+ };
43
+
44
+ return Object.fromEntries(SCHEMES.map(scheme => [scheme, (suite[scheme] ?? []).flatMap(surface => {
45
+ const context = surface.surface === rootSurface ? null : surface.surface;
46
+ const colors = new Map(surface.tokens.map(({ token, resolved }) => [semanticToCSS(token), resolved]));
47
+ const parsed = (token) => {
48
+ const color = colors.get(token);
49
+ return color === undefined ? null : parsePaintColor(color);
50
+ };
51
+ const page = parsed("--esp-color-background");
52
+ const card = parsed("--esp-color-layer-1");
53
+ const barPaint = resolveBarColor(settings.recipeTagsBarBackground, RECIPE_TAGS_BAR_PAINT_DEFAULTS.background, colors);
54
+ // The tag bar paints over the recipe card's layer 1, including when its authored fill is translucent.
55
+ const bar = barPaint && card ? compositePaint(barPaint, card) : null;
56
+ const authoredRing = surface.componentProperties.find(({ name }) => name === BADGE_FOCUS_RING);
57
+ const ring = !hasFocusRing ? null
58
+ : authoredRing === undefined ? parsed("--esp-color-link") : parsePaintColor(authoredRing.resolved);
59
+ const icon = resolveBarColor(settings.recipeTagsBarColor, RECIPE_TAGS_BAR_PAINT_DEFAULTS.ink, colors);
60
+ const pairs = [];
61
+ const add = (element, foreground, ink, background, ground, state, kind) => {
62
+ if (!ink || !ground) return;
63
+ pairs.push({ element, foreground, background, state, kind,
64
+ required: paintRequiredRatio(kind), ratio: wcagRatio(compositePaint(ink, ground), ground) });
65
+ };
66
+ if (hasTagLinks && mode !== "none") add("linked-badge", BADGE_FOCUS_RING, ring, "page", page, "focus", "ring");
67
+ if (hasTagLinks && mode === "page-and-cards") {
68
+ add("linked-badge", BADGE_FOCUS_RING, ring, "card", card, "focus", "ring");
69
+ add("linked-badge", BADGE_FOCUS_RING, ring, "card-hover", parsed("--esp-color-layer-2"), "hover-focus", "ring");
70
+ }
71
+ if (barLinks) add("linked-badge", BADGE_FOCUS_RING, ring, "recipe-tag-bar", bar, "focus", "ring");
72
+ if (barIcon) add(RECIPE_BAR_ICON, "recipeTagsBarColor", icon, "recipe-tag-bar", bar, "rest", "graphic");
73
+ return pairs.length ? [{ role: "tag-badges", context, pairs }] : [];
74
+ })]));
75
+ }
16
76
 
17
77
  function fieldFor(role, context, scheme, pair, brandColorSourceFields) {
18
78
  const brandColorField = pair.foreground === "brand-color" ? brandColorSourceFields[scheme] : undefined;
19
79
  if (brandColorField !== undefined) {
20
80
  return { field: `site-header.${brandColorField}`, file: APPEARANCE_FILES[SETTINGS_TYPE_SITE_HEADER] };
21
81
  }
82
+ if (pair.element === RECIPE_BAR_ICON) {
83
+ return { field: "site-publishing-preferences.recipeTagsBarColor", file: APPEARANCE_FILES[SETTINGS_TYPE_SITE_PUBLISHING_PREFERENCES] };
84
+ }
85
+ if (role === "tag-badges") {
86
+ const theme = context === null ? `${scheme}Theme` : `${scheme}Theme.contexts.${context}`;
87
+ return { field: `${theme}.componentProperties.${BADGE_FOCUS_RING}`, file: THEME_STYLES_FILE };
88
+ }
22
89
  if (context === null) return { field: `${scheme}Theme`, file: THEME_STYLES_FILE };
23
90
  return role === "header"
24
91
  ? { field: "site-header.context", file: APPEARANCE_FILES[SETTINGS_TYPE_SITE_HEADER] }
@@ -26,9 +93,14 @@ function fieldFor(role, context, scheme, pair, brandColorSourceFields) {
26
93
  }
27
94
 
28
95
  async function extraPaintEntries(nameReportEnabled) {
29
- if (nameReportEnabled !== true) return taprootCatalog;
30
96
  const { PAINT_CATALOG } = await loadEspalierShared("paint-catalog.js");
31
- return { ...taprootCatalog, footer: [...taprootCatalog.footer, ...standaloneFooterActionEntries(PAINT_CATALOG.footer)] };
97
+ const hasFittedFooter = PAINT_CATALOG.footer.some(entry => entry.foreground === "footer-link-ink");
98
+ const footer = hasFittedFooter ? taprootCatalog.footer : taprootCatalog.footer.map(entry =>
99
+ entry.foreground === "footer-link-ink" ? { ...entry, foreground: "link" } : entry);
100
+ return {
101
+ ...taprootCatalog,
102
+ footer: nameReportEnabled === true ? [...footer, ...standaloneFooterActionEntries(PAINT_CATALOG.footer)] : footer,
103
+ };
32
104
  }
33
105
 
34
106
  /** Measure optional chrome without changing the command that accepted the appearance. */
@@ -43,13 +115,15 @@ export async function completeChromeReport(inputs, { loadFit = loadFitReport } =
43
115
  if (!light || !dark) throw new Error("Missing accepted theme pair.");
44
116
  const fit = await loadFit();
45
117
  const extraEntries = await extraPaintEntries(nameReportEnabled);
46
- const { paint: entries } = fit.themeFitReportSuite(light, dark, { paintSurfaces: input.paintSurfaces, extraEntries });
118
+ const suite = fit.themeFitReportSuite(light, dark, { paintSurfaces: input.paintSurfaces, extraEntries });
119
+ const { paint: entries } = suite;
120
+ const badges = await measureBadgePaint(suite, input.badgeSettings, fit.ROOT_SURFACE);
47
121
  const flags = [];
48
122
  const warnings = [];
49
123
  let pairs = 0;
50
124
  for (const scheme of SCHEMES) {
51
- for (const { role, context, pairs: measured } of entries[scheme]) {
52
- pairs += measured.length;
125
+ for (const { role, context, pairs: measured } of [...entries[scheme], ...badges[scheme]]) {
126
+ pairs += measured.filter(({ element }) => element !== RECIPE_BAR_ICON).length;
53
127
  for (const pair of measured) {
54
128
  if (pair.ratio >= pair.required) continue;
55
129
  const { element, foreground, background, state, kind, required } = pair;
@@ -57,8 +131,12 @@ export async function completeChromeReport(inputs, { loadFit = loadFitReport } =
57
131
  const ratio = displayChromeRatio(pair.ratio, required);
58
132
  const shownRatio = ratio.toFixed(2);
59
133
  const shownRequirement = required.toFixed(2);
134
+ const location = role === "tag-badges" && context !== null ? ` in context '${displayChromeContext(context).context}'` : "";
135
+ const decorative = element === RECIPE_BAR_ICON;
136
+ const code = decorative ? RECIPE_TAG_ICON_CONTRAST : CONTRAST_TEXT_BELOW_AA;
137
+ const paint = `${describeChromeToken(foreground, role)} over ${describeChromeToken(background, role)}`;
60
138
  flags.push({
61
- code: CONTRAST_TEXT_BELOW_AA,
139
+ code,
62
140
  area: "presentation",
63
141
  file,
64
142
  field,
@@ -68,22 +146,23 @@ export async function completeChromeReport(inputs, { loadFit = loadFitReport } =
68
146
  context,
69
147
  ratio,
70
148
  required,
71
- message: `${role} ${element}/${state} paints ${foreground} on ${background} at ${shownRatio}:1. It needs ${shownRequirement}:1.`,
149
+ message: `${role} ${element}/${state}${location} paints ${paint} at ${shownRatio}:1. ${decorative ? "Aim for" : "It needs"} ${shownRequirement}:1. ${THEME_RESOLVE_GUIDANCE}`,
72
150
  role,
73
151
  element,
74
152
  state,
75
153
  kind,
76
154
  });
77
155
  warnings.push(
78
- `chrome: ${CONTRAST_TEXT_BELOW_AA}; ${field}; ${scheme} ${role} ${element}/${state}; ${shownRatio}:1 < ${shownRequirement}:1.`,
156
+ `chrome: ${code}; ${field}; ${scheme} ${role} ${element}/${state}${location}; ${shownRatio}:1 < ${shownRequirement}:1. ${paint}. ${THEME_RESOLVE_GUIDANCE}`,
79
157
  );
80
158
  }
81
159
  }
82
160
  }
83
- return { entries, flags, warnings, contrast: { pairs, belowAa: flags.length }, navigationUnavailable, unavailable: false };
161
+ return { entries, badges, flags, warnings, contrast: { pairs, belowAa: flags.filter(({ code }) => code === CONTRAST_TEXT_BELOW_AA).length }, navigationUnavailable, unavailable: false };
84
162
  } catch {
85
163
  return {
86
164
  entries: { light: [], dark: [] },
165
+ badges: { light: [], dark: [] },
87
166
  flags: [],
88
167
  warnings: [CHROME_UNAVAILABLE_MESSAGE],
89
168
  contrast: { pairs: 0, belowAa: 0 },
package/src/cli.js CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  VERB_APPROVE,
24
24
  VERB_AUTHORS_ADD,
25
25
  VERB_AUTHORS_LIST,
26
+ VERB_AUTHORS_SET,
26
27
  VERB_DELIVERY_CHECK,
27
28
  VERB_DEPLOY,
28
29
  VERB_STAGING_REVIEW,
@@ -85,6 +86,7 @@ import {
85
86
  getPageTypeReference,
86
87
  getSettingsReference,
87
88
  getThemeReference,
89
+ getTokenReference,
88
90
  getWorkflowReference,
89
91
  listComponentTypeReferences,
90
92
  listDesignBlueprints,
@@ -100,7 +102,7 @@ import { assertCliCurrent } from "./session.js";
100
102
  import { ApiError } from "./transport.js";
101
103
  import { imageDescriptionOptions, imageListOptions, requireImageId } from "./image-description-contract.js";
102
104
  import { formatThemeResolve } from "./theme-resolve.js";
103
- import { MAXIMUM_THEME_OPEN_MAP_KEY_SCALARS } from "./theme-validation.js";
105
+ import { encodePageTokenReach } from "./token-reach.js";
104
106
  import { VERB_HANDLERS } from "./verbs/index.js";
105
107
  import { siteNeedsWorkspaceError } from "./verbs/validate.js";
106
108
 
@@ -166,7 +168,8 @@ const VERBS = Object.freeze([
166
168
  + "sign-in, so it is refused with a directory argument or --init (validate.site_needs_workspace), and a managed "
167
169
  + "Docs site is not read. Known author-entered metadata also receives missing, "
168
170
  + "short, long and repeated-title description advice (title guidance 15–70 characters; description 50–160). "
169
- + "These are writing suggestions, never requirements. Generated custom values are checked; generated "
171
+ + "These are writing suggestions, never requirements. The terminal lists errors and publishing warnings "
172
+ + "ahead of title and description advice. Generated custom values are checked; generated "
170
173
  + "defaults, home-page settings and unknown fields are listed in siteChecks.deferredToDeployment. "
171
174
  + "siteChecks.checkedInEditor names rules only the page editor evaluates, such as a selected cover; "
172
175
  + "siteChecks.checkedBySite names rules whose evidence comes from site records; 'status' reads their "
@@ -395,10 +398,46 @@ const VERBS = Object.freeze([
395
398
  summary: "Create a site author, someone a page can be credited to who has no Taproot account.",
396
399
  note: "Give the handle (lowercase letters, digits and single hyphens, at most 64 characters; it never changes) "
397
400
  + "and --name, the name readers see on the byline. --email is optional: it is kept private, never published, "
398
- + "and lets the person be linked to a Taproot account later. Then credit pages to the author with "
401
+ + "and lets the person be linked to a Taproot account later. --link-page <site path or resourceId> or "
402
+ + "--link-url <address> gives the byline a link, one or the other (authors.link_conflict): a page is named by "
403
+ + "the path .taproot-site-manifest.json records for it ('/' for the home page) and a web address is an "
404
+ + "absolute http or https address. --image <media path or image id> shows an image from the site's media "
405
+ + "library beside the byline; a path is resolved through .taproot-site-media.json. A page path or media path "
406
+ + "the workspace does not record is refused before any request (authors.link_page_unknown, "
407
+ + "authors.image_unknown); the site refuses an address it cannot link (authors.link_url_invalid) and an id "
408
+ + "that is not this site's page or image (the same codes). Then credit pages to the author with "
399
409
  + "'author: <handle>' in a page's front matter or 'pages meta set <path> --author <handle>'. A handle the site "
400
410
  + "already has under another name is refused (authors.handle_taken); under the same name it succeeds with "
401
- + "existing: true. authors.json is updated with the new author.",
411
+ + "existing: true. A link or image is compared only when its option was passed, so repeating a command after "
412
+ + "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.",
414
+ },
415
+ {
416
+ name: VERB_AUTHORS_SET,
417
+ surface: SURFACE_STANDARD,
418
+ // A change to the name, link or image of an author on published pages
419
+ // queues a deployment, so a content-only credential would always be
420
+ // refused there. One static declaration per verb: an email-only change
421
+ // asks for both too (TR01401).
422
+ capabilities: [CAPABILITY_CONTENT, CAPABILITY_DEPLOYMENTS],
423
+ tokens: ["authors", "set"],
424
+ positionals: "authorHandle",
425
+ authorOptions: true,
426
+ authorSet: true,
427
+ summary: "Change a site author's name, private email, byline link or image.",
428
+ note: "Names one site author by handle and sends only the options given; everything else keeps its stored value. "
429
+ + "--name changes the name readers see and --email the private address (--no-email removes it). --link-page "
430
+ + "<site path or resourceId> or --link-url <address> sets the byline link, replacing the other kind; --no-link "
431
+ + "removes it. --image <media path or image id> sets the image from the site's media library and --no-image "
432
+ + "removes it. With no option the command is refused (authors.set_empty), as are options that contradict each "
433
+ + "other (authors.link_conflict for --link-page with --link-url or --no-link with either, "
434
+ + "authors.image_conflict for --image with --no-image, authors.email_conflict for --email with --no-email), "
435
+ + "before any request. A page or media path the workspace does not record is authors.link_page_unknown or "
436
+ + "authors.image_unknown, and the site refuses an unusable address (authors.link_url_invalid) or id the same "
437
+ + "way. A handle the site does not have is authors.handle_unknown. Changing the name, link or image of an "
438
+ + "author who appears on published pages queues one production deployment, so the credential needs the "
439
+ + "deployments capability and the account must be allowed to deploy; otherwise the change is refused with "
440
+ + "authors.deployment_refused, or while a deployment is running. authors.json is refreshed.",
402
441
  },
403
442
  {
404
443
  name: VERB_PAGES_PUSH,
@@ -432,7 +471,8 @@ const VERBS = Object.freeze([
432
471
  + "exits 0. Once images are set, nextStep is approve while any selected page holds a draft and deploy --staging "
433
472
  + "otherwise. "
434
473
  + "A page is created without an author unless its source names one ('author:' in the front matter, or 'pages "
435
- + "meta set --author'); the pages created that way are listed in pages.authorless with how to credit them. "
474
+ + "meta set --author'); the pages created that way are listed in pages.authorless with how to credit them, except one whose "
475
+ + "typed source names a displayAuthor (a site author's handle the byline shows instead of the member). "
436
476
  + "The homepage is recorded with an empty path, so address it as '/'. "
437
477
  + "A selected path resolves to its one authoritative source from metadata alone, and that page is then validated "
438
478
  + "exactly as a whole push would validate it — site binding, manifest integrity, live create-or-update "
@@ -711,22 +751,36 @@ const VERBS = Object.freeze([
711
751
  tokens: ["theme", "resolve"],
712
752
  json: true,
713
753
  resolveOptions: true,
714
- summary: "Print the colors Espalier compiles from the theme, per scheme and context, with their contrast ratios.",
754
+ summary: "Show resolved theme colors and component properties by scheme and context.",
715
755
  note: "Reads the pulled workspace's settings/taproot-styles.json offline (run pull first; no credential, no network) "
716
756
  + "and compiles it through Espalier's own pipeline, the one theme push lints and the published page renders "
717
- + "through, so a value here cannot differ from the render. For the root page and every declared context in "
757
+ + "through, so a value here cannot differ from the render. For an enabled footer, the report includes its "
758
+ + "resting link and heading inks against the painted layer2 surface. For the root page and every declared context in "
718
759
  + "each scheme it lists every semantic color token as oklch and hex (hex is the sRGB the engine gamut-maps the "
719
760
  + "color to), whether it is compiled from the roles or pinned in semanticMappings (origin compiled, pinned, "
720
- + "or inherited_pin for a root pin a context carries), and the ramp stop or anchor it came from. It also "
721
- + "measures every ink-on-surface pairing Espalier defines (text on background, links, headings, the action "
761
+ + "or inherited_pin for a root pin a context carries), and the ramp stop or anchor it came from. Each token "
762
+ + "names its static role plan and explains any contrast adjustment, including a passing lightness stop when "
763
+ + "one exists. The paint catalog shows where pinned and adjusted colors are used. It also "
764
+ + "measures the semantic ink-on-surface pairings (text on background, links, headings, the action "
722
765
  + "label, and so on): the WCAG ratio against the AA minimum (4.5:1 for text, 3:1 for large text and UI) and "
723
766
  + "the APCA Lc against Espalier's target. A pair under AA is listed in flags with the stable code "
724
767
  + "theme.contrast_text_below_aa and the field to edit (for example "
725
768
  + "darkTheme.contexts.inverted); flags never refuse, so the exit code stays 0. An invalid or incomplete theme "
726
769
  + "is refused with the code theme push and validate use, the first fault in error.code and error.field. Without --json the output "
727
- + "is a readable table; --json writes the stable result (schemes[].surfaces[].tokens and pairs, contrast, flags). "
770
+ + "is a readable table. JSON lists tokens, pairs and componentProperties in schemes[].surfaces[], plus contrast "
771
+ + "and flags. Each component row records its authored and resolved values, whether a context overrides the "
772
+ + "root, and the APCA measurements and adjustment for a paired color. WCAG ratios cover the semantic and site-chrome pairs. "
728
773
  + "--scheme and --context narrow the output only; the whole pair is always validated. A result too large for "
729
- + "the output bound names the surfaces it left out in omittedSurfaces (items, count, truncated). --site reads the site's stored theme "
774
+ + "the output bound lists omittedSurfaces. Retry an omitted named context with --scheme and --context, "
775
+ + "or an omitted root with --scheme. The root retry keeps its scheme's named contexts and chrome. "
776
+ + "omittedSurfaces.retryRootSchemes names roots that fit on retry, even if the omission list is truncated. "
777
+ + "Full context names are under lightTheme.contexts and darkTheme.contexts in settings/taproot-styles.json. "
778
+ + "When using --site, run taproot-site pull in a separate workspace for the same site to preserve local edits. "
779
+ + "The reason surface_too_large means the surface exceeds the output bound under its narrowest selection. "
780
+ + "The command reports theme.resolve_surface_too_large when a single selected surface cannot fit "
781
+ + "or every selected surface is individually oversized. "
782
+ + "If the paint catalog does not fit, omittedTokens lists the missing paint entries. See taproot-site help tokens for the full catalog. "
783
+ + "--site reads the site's stored theme "
730
784
  + "instead of the workspace (the effective theme pull would write), which compares a workspace edit with what is "
731
785
  + "live: run it with and without --site. A pair under AA is a finding to read, not a failure: a brand color "
732
786
  + "may be a deliberate choice. See 'taproot-site help theme'.",
@@ -736,9 +790,11 @@ const VERBS = Object.freeze([
736
790
  surface: SURFACE_DOCS_PRESENTATION,
737
791
  capabilities: [CAPABILITY_DESIGN],
738
792
  tokens: ["footer", "push"],
793
+ dryRun: true,
739
794
  summary: "Validate and replace the workspace's complete footer document.",
740
795
  note: "Run pull first. The command validates the whole closed footer locally, uses the pulled draft hash,"
741
- + " and refuses a concurrent remote edit with re-pull guidance.",
796
+ + " and refuses a concurrent remote edit with re-pull guidance. --dry-run reads the current draft and reports"
797
+ + " changed JSON paths, staleness and fit findings without writing to the site or workspace.",
742
798
  },
743
799
  {
744
800
  name: VERB_MEDIA_UPLOAD,
@@ -828,7 +884,9 @@ const VERBS = Object.freeze([
828
884
  summary: "Deploy to staging, or promote staging to production.",
829
885
  target: true,
830
886
  handoffOptions: true,
831
- note: "deploy --staging does not report a review URL, because the URL is a live single-use credential and this "
887
+ note: "If deploy.hosting_unavailable names Hosting, check stagingHosting in status. Activate the staging "
888
+ + "hostname in Settings > Licence & domain. For a missing Taproot-provided address on a local stack, "
889
+ + "check its user-content domain configuration. deploy --staging does not report a review URL, because the URL is a live single-use credential and this "
832
890
  + "JSON is often saved to logs. Run 'staging review' to mint one, or pass --handoff to get a fresh "
833
891
  + "single-use one in stagingPreview.url (on a managed Docs site too, where it stages settings only): open it "
834
892
  + "once, then switch the site's theme toggle to review both schemes before deploy --production. Without "
@@ -902,9 +960,10 @@ const VERBS = Object.freeze([
902
960
  surface: SURFACE_DOCS_PRESENTATION,
903
961
  capabilities: [CAPABILITY_DEPLOYMENTS],
904
962
  tokens: ["staging", "review"],
905
- summary: "Mint a fresh single-use review handoff for the site's staging host.",
963
+ summary: "Mint a fresh single-use review handoff for the site's first or later acknowledged staging release.",
906
964
  reviewPath: true,
907
- note: "The handoff URL is reported only in the final JSON as stagingPreview.url; keep it private. --path <page> opens the review on that page instead of the "
965
+ note: "Run deploy --staging first. staging.deployment_required means no staging release has been acknowledged yet. "
966
+ + "The handoff URL is reported only in the final JSON as stagingPreview.url; keep it private. --path <page> opens the review on that page instead of the "
908
967
  + "home page: a page path as 'pull' records it ('about', '/posts/one'), optionally with a query. Open it once, then use the site's theme toggle to review both "
909
968
  + "schemes. deploy --staging and redirects check report no review URL unless you pass --handoff, so this is "
910
969
  + "the usual way to get one, on a managed Docs site too. "
@@ -919,7 +978,8 @@ const VERBS = Object.freeze([
919
978
  tokens: ["status"],
920
979
  summary:
921
980
  "Report the platform authoring switch, CLI release, deployments, readiness, image processing, and site health.",
922
- note: "siteHealth summarizes the stored Site Health report of the last production release, with its findings (a rule id, severity, page, and the value found); stagedSiteHealth summarizes the staged release's report."
981
+ note: "stagingHosting reports staging host setup separately from candidate readiness. If the host is missing, "
982
+ + "check the site's Licence & domain settings and local staging host configuration. siteHealth summarizes the stored Site Health report of the last production release, with its findings (a rule id, severity, page, and the value found); stagedSiteHealth summarizes the staged release's report."
923
983
  + " Both read what a release stored when it was generated, so edits made since are outside them; run 'health --staging' or 'health --production' for each finding's file and fix."
924
984
  + " Content permission is required; a refused or failed production read fails status rather than reporting a clean site, and a failed staged read is reported as unavailable.",
925
985
  },
@@ -946,7 +1006,8 @@ const VERBS = Object.freeze([
946
1006
  + "supplies a safe description, and otherwise needsDescription. With --staging each finding says "
947
1007
  + "newSinceProduction, and comparison says whether production had a report to compare with; without one "
948
1008
  + "every finding is listed as not compared. Both lists are bounded by size, with findingsTotal, "
949
- + "imageFindingsTotal and the truncation flags. A site with no stored report says available false and why. "
1009
+ + "imageFindingsTotal and the truncation flags. The terminal output for health and deploy --staging lists errors "
1010
+ + "and publishing warnings ahead of title and description advice. A site with no stored report says available false and why. "
950
1011
  + "A managed Docs site returns covered false. Content permission is required.",
951
1012
  },
952
1013
  ]);
@@ -1089,8 +1150,10 @@ function verbHelp(verb) {
1089
1150
  ? " <page-path>"
1090
1151
  : verb.positionals === "metaPagePath"
1091
1152
  ? " <page-path> [--title <text>] [--description <text>] [--author <handle-or-email>]"
1153
+ : verb.positionals === "authorHandle" && verb.authorSet
1154
+ ? " <handle> [--name <display-name>] [--email <address> | --no-email] [--link-page <path> | --link-url <address> | --no-link] [--image <path> | --no-image]"
1092
1155
  : verb.positionals === "authorHandle"
1093
- ? " <handle> --name <display-name> [--email <address>]"
1156
+ ? " <handle> --name <display-name> [--email <address>] [--link-page <path> | --link-url <address>] [--image <path>]"
1094
1157
  : verb.positionals === "imageId"
1095
1158
  ? " <image-id>"
1096
1159
  : verb.positionals
@@ -1137,8 +1200,16 @@ function verbHelp(verb) {
1137
1200
  --if-missing Save only while the stored default is still null; cannot clear.`
1138
1201
  : "";
1139
1202
  const authorOptions = verb.authorOptions
1140
- ? `\n --name <text> The name readers see on the byline (required).
1141
- --email <address> A private address, kept to link the person to an account later (optional).`
1203
+ ? `\n --name <text> The name readers see on the byline${verb.authorSet ? "" : " (required)"}.
1204
+ --email <address> A private address, kept to link the person to an account later (optional).
1205
+ --link-page <ref> Link the byline to a page: its path from the manifest ('/' for home) or its resourceId.
1206
+ --link-url <address> Link the byline to a web address (absolute http or https). Not with --link-page.
1207
+ --image <ref> Show an image from the media library: its media path or image id.${verb.authorSet
1208
+ ? `
1209
+ --no-email Remove the private address.
1210
+ --no-link Remove the byline link.
1211
+ --no-image Remove the image.`
1212
+ : ""}`
1142
1213
  : "";
1143
1214
  const jsonOption = verb.json && !verb.resolveOptions
1144
1215
  ? "\n --json Emit the stable JSON contract (operational output is always JSON)."
@@ -1273,6 +1344,24 @@ function matchVerb(arguments_) {
1273
1344
  return matched;
1274
1345
  }
1275
1346
 
1347
+ /** The `authors add` and `authors set` options and the invocation field each fills (TR01401). */
1348
+ const AUTHOR_VALUE_OPTIONS = Object.freeze({
1349
+ "--name": "authorName",
1350
+ "--email": "authorEmail",
1351
+ "--link-page": "authorLinkPage",
1352
+ "--link-url": "authorLinkUrl",
1353
+ "--image": "authorImage",
1354
+ });
1355
+ const AUTHOR_CLEAR_OPTIONS = Object.freeze({
1356
+ "--no-email": "authorNoEmail",
1357
+ "--no-link": "authorNoLink",
1358
+ "--no-image": "authorNoImage",
1359
+ });
1360
+ const AUTHOR_INVOCATION_FIELDS = Object.freeze([
1361
+ ...Object.values(AUTHOR_VALUE_OPTIONS),
1362
+ ...Object.values(AUTHOR_CLEAR_OPTIONS),
1363
+ ]);
1364
+
1276
1365
  /** The `link build` options and the invocation field each fills. */
1277
1366
  const LINK_OPTION_FIELDS = Object.freeze({
1278
1367
  "--path": "linkPath",
@@ -1358,6 +1447,7 @@ function parseReferenceArguments(arguments_) {
1358
1447
  || topic === "media"
1359
1448
  || topic === "preview"
1360
1449
  || topic === "theme"
1450
+ || topic === "tokens"
1361
1451
  || topic === "appearance"
1362
1452
  || topic === "settings"
1363
1453
  || topic === "footer"
@@ -1409,7 +1499,11 @@ function referenceResult(parsed) {
1409
1499
  { alternatives: PAGE_TYPES },
1410
1500
  );
1411
1501
  }
1412
- return { ...result, topic: "page", page };
1502
+ return {
1503
+ ...result,
1504
+ topic: "page",
1505
+ page: parsed.json ? { ...page, tokenReach: encodePageTokenReach(page.tokenReach) } : page,
1506
+ };
1413
1507
  }
1414
1508
  case "component": {
1415
1509
  const component = getComponentReference(parsed.subject);
@@ -1464,6 +1558,8 @@ function referenceResult(parsed) {
1464
1558
  }
1465
1559
  case "theme":
1466
1560
  return { ...result, topic: "presentation", referenceKind: "theme", reference: getThemeReference() };
1561
+ case "tokens":
1562
+ return { ...result, topic: "tokens", ...getTokenReference() };
1467
1563
  case "appearance":
1468
1564
  return { ...result, topic: "presentation", referenceKind: "appearance", reference: getAppearanceReference() };
1469
1565
  case "settings":
@@ -1559,7 +1655,7 @@ function parseMetaOption(arguments_, index, option) {
1559
1655
  return candidate;
1560
1656
  }
1561
1657
 
1562
- /** The text after --author, --name (authors add) or --email: one printable value, bounded. */
1658
+ /** The text after --author or an `authors add` / `authors set` option: one printable value, bounded. */
1563
1659
  function parseAuthorOption(arguments_, index, option, { allowEmpty = false } = {}) {
1564
1660
  const candidate = arguments_[index + 1];
1565
1661
  if (
@@ -1607,7 +1703,6 @@ function parseThemeContext(arguments_, index) {
1607
1703
  if (
1608
1704
  typeof candidate !== "string"
1609
1705
  || candidate.length === 0
1610
- || [...candidate].length > MAXIMUM_THEME_OPEN_MAP_KEY_SCALARS
1611
1706
  || hasAsciiControl(candidate)
1612
1707
  || candidate.startsWith("--")
1613
1708
  ) {
@@ -1700,8 +1795,7 @@ function parseArguments(arguments_) {
1700
1795
  let metaTitle;
1701
1796
  let metaDescription;
1702
1797
  let metaAuthor;
1703
- let authorName;
1704
- let authorEmail;
1798
+ const authorValues = {};
1705
1799
  const positionals = [];
1706
1800
  for (let index = 0; index < rest.length; index += 1) {
1707
1801
  const argument = rest[index];
@@ -1873,18 +1967,24 @@ function parseArguments(arguments_) {
1873
1967
  index += 1;
1874
1968
  continue;
1875
1969
  }
1876
- if (verb.authorOptions && (argument === "--name" || argument === "--email")) {
1970
+ if (verb.authorOptions && Object.hasOwn(AUTHOR_VALUE_OPTIONS, argument)) {
1877
1971
  const value = parseAuthorOption(rest, index, argument);
1878
- if (argument === "--name") {
1879
- if (authorName !== undefined) throw usageError("cli.duplicate_option", "--name may be supplied only once.");
1880
- authorName = value;
1881
- } else {
1882
- if (authorEmail !== undefined) throw usageError("cli.duplicate_option", "--email may be supplied only once.");
1883
- authorEmail = value;
1972
+ const field = AUTHOR_VALUE_OPTIONS[argument];
1973
+ if (authorValues[field] !== undefined) {
1974
+ throw usageError("cli.duplicate_option", `${argument} may be supplied only once.`);
1884
1975
  }
1976
+ authorValues[field] = value;
1885
1977
  index += 1;
1886
1978
  continue;
1887
1979
  }
1980
+ if (verb.authorSet && Object.hasOwn(AUTHOR_CLEAR_OPTIONS, argument)) {
1981
+ const field = AUTHOR_CLEAR_OPTIONS[argument];
1982
+ if (authorValues[field] !== undefined) {
1983
+ throw usageError("cli.duplicate_option", `${argument} may be supplied only once.`);
1984
+ }
1985
+ authorValues[field] = true;
1986
+ continue;
1987
+ }
1888
1988
  if (verb.keyName && argument === "--name") {
1889
1989
  if (keyName !== undefined) throw usageError("cli.duplicate_option", "--name may be supplied only once.");
1890
1990
  keyName = parseNameOption(rest, index);
@@ -2020,11 +2120,11 @@ function parseArguments(arguments_) {
2020
2120
  if (verb.imageListOptions) imageListOptions(imageValues);
2021
2121
  if (verb.imageDescriptionOptions) imageDescriptionOptions(imageValues);
2022
2122
  if (verb.positionals === "authorHandle" && positionals.length !== 1) {
2023
- throw usageError("authors.handle_missing", "authors add needs exactly one handle, such as jane-doe.", {
2123
+ throw usageError("authors.handle_missing", `${verb.name} needs exactly one handle, such as jane-doe.`, {
2024
2124
  field: "handle",
2025
2125
  });
2026
2126
  }
2027
- if (verb.authorOptions && authorName === undefined) {
2127
+ if (verb.authorOptions && !verb.authorSet && authorValues.authorName === undefined) {
2028
2128
  throw usageError("authors.name_missing", "authors add needs --name, the name readers see on the byline.", {
2029
2129
  field: "name",
2030
2130
  });
@@ -2094,8 +2194,7 @@ function parseArguments(arguments_) {
2094
2194
  ...(metaTitle === undefined ? {} : { metaTitle }),
2095
2195
  ...(metaDescription === undefined ? {} : { metaDescription }),
2096
2196
  ...(metaAuthor === undefined ? {} : { metaAuthor }),
2097
- ...(authorName === undefined ? {} : { authorName }),
2098
- ...(authorEmail === undefined ? {} : { authorEmail }),
2197
+ ...authorValues,
2099
2198
  positionals: verb.positionals
2100
2199
  ? {
2101
2200
  key: verb.positionals,
@@ -2201,8 +2300,7 @@ export async function runCli({
2201
2300
  ...(parsed.metaTitle === undefined ? {} : { metaTitle: parsed.metaTitle }),
2202
2301
  ...(parsed.metaDescription === undefined ? {} : { metaDescription: parsed.metaDescription }),
2203
2302
  ...(parsed.metaAuthor === undefined ? {} : { metaAuthor: parsed.metaAuthor }),
2204
- ...(parsed.authorName === undefined ? {} : { authorName: parsed.authorName }),
2205
- ...(parsed.authorEmail === undefined ? {} : { authorEmail: parsed.authorEmail }),
2303
+ ...Object.fromEntries(AUTHOR_INVOCATION_FIELDS.filter((field) => parsed[field] !== undefined).map((field) => [field, parsed[field]])),
2206
2304
  ...Object.fromEntries(["pageSize", "pageToken", "missingDescription", "imageDescription", "clearDescription", "expectedRevision", "onlyIfMissing"]
2207
2305
  .filter((field) => parsed[field] !== undefined).map((field) => [field, parsed[field]])),
2208
2306
  capabilities: parsed.capabilities,
package/src/constants.js CHANGED
@@ -87,6 +87,7 @@ export const VERB_PAGES_META_SET = "pages meta set";
87
87
  export const VERB_PAGES_DELETE = "pages delete";
88
88
  export const VERB_AUTHORS_LIST = "authors list";
89
89
  export const VERB_AUTHORS_ADD = "authors add";
90
+ export const VERB_AUTHORS_SET = "authors set";
90
91
  export const VERB_NAV_PUSH = "nav push";
91
92
  export const VERB_REDIRECTS_CHECK = "redirects check";
92
93
  export const VERB_REDIRECTS_PULL = "redirects pull";
@@ -6,6 +6,7 @@
6
6
  import { BUILT_IN_IMAGE_TEXTURES } from "@taprootio/espalier/shared/image-texture-registry";
7
7
  import registry from "./free-form-section-registry.json" with { type: "json" };
8
8
  import { hasAsciiControl } from "../errors.js";
9
+ import { validateAuthoredTagNames } from "../authored-tag-names.js";
9
10
  import { isSocialLinkUrl, SOCIAL_LINK_URL_MAX_LENGTH, trimSocialLinkInput } from "../social-link-url.js";
10
11
  import socialPlatforms from "../social-platforms.json" with { type: "json" };
11
12
  import { IMAGE_DESCRIPTION_MODES } from "./image-description-validation.js";
@@ -271,10 +272,13 @@ const LATEST_POSTS = Object.freeze({
271
272
  integer: true,
272
273
  minimum: 1,
273
274
  maximum: 12,
274
- description: "How many posts to show, 1 to 12; a single post spans the full width.",
275
+ alternate: "all",
276
+ description: 'Show 1 to 12 posts, or "all" for every match. A count of 1 spans the full width.',
275
277
  }),
276
278
  columns: num({ values: Object.freeze([1, 2, 3, 4]) }),
277
279
  pageTypes: list(enumOf(...LATEST_POST_PAGE_TYPES)),
280
+ tags: list(str({ nonWhitespace: true }), { tagNames: true }),
281
+ tagMatch: enumOf("any", "all"),
278
282
  showPinned: bool(),
279
283
  highlightFirst: bool(),
280
284
  showDescription: bool(),
@@ -768,7 +772,7 @@ const COMPONENT_DEFINITIONS = Object.freeze({
768
772
  "latest-posts": component(
769
773
  LATEST_POSTS,
770
774
  "Latest Posts",
771
- "Generation-time list of recent published pages, optionally filtered by page type.",
775
+ "Generation-time list of published pages, optionally filtered by page type and authored tags.",
772
776
  {
773
777
  count: 6,
774
778
  columns: 3,
@@ -781,7 +785,13 @@ const COMPONENT_DEFINITIONS = Object.freeze({
781
785
  borderWidth: 1,
782
786
  bannerScheme: "auto",
783
787
  },
784
- ["Keep descriptions enabled when titles alone do not make each destination clear."],
788
+ [
789
+ "Use tags with tagMatch any (the default) or all. Names are case-insensitive. Omit tags or pass [] for no tag filter.",
790
+ "Assign the tags to pages first or in the same pages push. Validate warns about names absent from the pulled catalog. Pages push refuses them before sending pages, and deploy checks against the current site catalog.",
791
+ "The listing skips its own page. Tagged lists exclude member-only pages. Pinned matches come first by default, then newest by displayed date.",
792
+ "The count defaults to 6. Set count to the string all for every match, with no listing cap or pagination. Thumbnails load lazily.",
793
+ "No matches render no grid. Taproot does not generate tag pages. Create a free-form page and place the listing in its body.",
794
+ ],
785
795
  {
786
796
  count: 6,
787
797
  columns: 3,
@@ -1162,6 +1172,10 @@ function referenceSchema(spec) {
1162
1172
  };
1163
1173
  case "number": {
1164
1174
  const schema = { type: spec.integer ? "integer" : "number" };
1175
+ if (spec.alternate !== undefined) {
1176
+ const { alternate, description, ...numeric } = spec;
1177
+ return { anyOf: [referenceSchema(numeric), { type: "string", enum: [alternate] }], description };
1178
+ }
1165
1179
  if (spec.values) schema.enum = [...spec.values];
1166
1180
  if (spec.minimum !== undefined) schema.minimum = spec.minimum;
1167
1181
  if (spec.maximum !== undefined) schema.maximum = spec.maximum;
@@ -1330,8 +1344,9 @@ function validateValue(spec, value, path, errors) {
1330
1344
  if (typeof value !== "string" || !spec.values.includes(value)) fail(describe(spec));
1331
1345
  return;
1332
1346
  case "number": {
1347
+ if (spec.alternate !== undefined && value === spec.alternate) return;
1333
1348
  if (typeof value !== "number" || !Number.isFinite(value)) {
1334
- fail(describe(spec));
1349
+ fail(spec.alternate === undefined ? describe(spec) : `${describe(spec)} or "${spec.alternate}"`);
1335
1350
  return;
1336
1351
  }
1337
1352
  if (spec.values && !spec.values.includes(value)) {
@@ -1350,6 +1365,14 @@ function validateValue(spec, value, path, errors) {
1350
1365
  return;
1351
1366
  }
1352
1367
  case "array": {
1368
+ if (spec.tagNames) {
1369
+ const result = validateAuthoredTagNames(value);
1370
+ if ("field" in result) {
1371
+ const match = /^tags\[(\d+)\]$/u.exec(result.field);
1372
+ errors.push(contentError(match ? `${path}/${match[1]}` : path, CODES.componentData, result.reason));
1373
+ }
1374
+ return;
1375
+ }
1353
1376
  if (!Array.isArray(value)) {
1354
1377
  fail("an array");
1355
1378
  return;