@taprootio/site-authoring 0.38.1 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -1
- package/examples/riverbend-wellness/settings/site-publishing-preferences.json +29 -4
- package/package.json +2 -2
- package/src/atomic-file.js +2 -1
- package/src/changelog.json +19 -0
- package/src/display-scale.js +17 -0
- package/src/footer-alignment.js +97 -0
- package/src/footer-brand-inputs.js +26 -0
- package/src/footer-branding.js +38 -0
- package/src/footer-contract.js +118 -4
- package/src/footer-draft-hash.js +19 -1
- package/src/footer-fit-widths.js +10 -0
- package/src/footer-fit.js +328 -0
- package/src/footer-font-metrics.js +8345 -0
- package/src/header-presentation.js +4 -15
- package/src/presentation-reference.js +68 -3
- package/src/reference-help.js +1 -1
- package/src/site-check-findings.js +42 -10
- package/src/site-check-rules.json +3 -2
- package/src/verbs/footer-push.js +11 -0
- package/src/verbs/validate.js +17 -11
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
// Generated from shared/header-presentation.ts by scripts/sync-field-validation.mjs. Do not edit.
|
|
2
|
-
|
|
2
|
+
import { DISPLAY_SCALE_LIMITS, parseDisplayScale } from "./display-scale.js";
|
|
3
|
+
export const HEADER_HEIGHT_MULTIPLIER_LIMITS = DISPLAY_SCALE_LIMITS;
|
|
3
4
|
const STANDARD_HEIGHT = Object.freeze({ tenths: 10, scale: 1, canonical: "" });
|
|
4
|
-
const HEIGHT_MULTIPLIER = /^(?:[1-4](?:\.[0-9])?|5(?:\.0)?)$/u;
|
|
5
5
|
/** Parse the authored string without floating-point remainder or whitespace normalization. */
|
|
6
6
|
export function parseHeaderHeightMultiplier(value) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (typeof value !== "string")
|
|
10
|
-
return null;
|
|
11
|
-
// JavaScript's end anchor also matches before a final newline; require the entire value.
|
|
12
|
-
if (HEIGHT_MULTIPLIER.exec(value)?.[0] !== value)
|
|
13
|
-
return null;
|
|
14
|
-
const whole = value.charCodeAt(0) - 48;
|
|
15
|
-
const fraction = value.length === 3 ? value.charCodeAt(2) - 48 : 0;
|
|
16
|
-
const tenths = whole * 10 + fraction;
|
|
17
|
-
return tenths === 10
|
|
18
|
-
? STANDARD_HEIGHT
|
|
19
|
-
: Object.freeze({ tenths, scale: tenths / 10, canonical: `${whole}.${fraction}` });
|
|
7
|
+
const parsed = parseDisplayScale(value);
|
|
8
|
+
return parsed?.tenths === 10 ? STANDARD_HEIGHT : parsed;
|
|
20
9
|
}
|
|
21
10
|
/** Read old or omitted settings as standard height; writes use the strict parser. */
|
|
22
11
|
export function resolveHeaderHeightMultiplier(value) {
|
|
@@ -28,6 +28,8 @@ import {
|
|
|
28
28
|
APPEARANCE_SCALAR_FIELDS,
|
|
29
29
|
} from "./appearance-contract.js";
|
|
30
30
|
import { CLI_BINARY_NAME } from "./constants.js";
|
|
31
|
+
import { FOOTER_LOGO_BOX, FOOTER_LOGO_SCALE_LIMITS } from "./footer-branding.js";
|
|
32
|
+
import { FOOTER_ALIGNMENT_LAYOUTS, FOOTER_POSITION_VALUES, FOOTER_TEXT_ALIGN_VALUES } from "./footer-alignment.js";
|
|
31
33
|
import {
|
|
32
34
|
FOOTER_BACKGROUND_PRESENTATIONS,
|
|
33
35
|
FOOTER_EXAMPLE,
|
|
@@ -579,6 +581,32 @@ const FOOTER_FIELD_DETAILS = Object.freeze({
|
|
|
579
581
|
"FooterSettings.enabled": { type: "boolean", default: false },
|
|
580
582
|
"FooterSettings.showBrand": { type: "boolean", default: true },
|
|
581
583
|
"FooterSettings.showBrandText": { type: "boolean", default: true },
|
|
584
|
+
"FooterSettings.brandSpan": { type: "integer", default: 1, minimum: 1, maximum: FOOTER_LIMITS.brandSpanMax },
|
|
585
|
+
"FooterSettings.asideSpan": { type: "integer", default: 1, minimum: 1, maximum: FOOTER_LIMITS.asideSpanMax },
|
|
586
|
+
"FooterSettings.brandSize": { type: "enum", default: "standard", values: ["standard", "large"], description: "Brand text size; logoScale independently sets the logo size." },
|
|
587
|
+
"FooterSettings.logoScale": {
|
|
588
|
+
type: "decimal-string",
|
|
589
|
+
default: "1.0",
|
|
590
|
+
...FOOTER_LOGO_SCALE_LIMITS,
|
|
591
|
+
description: "Logo size from 1.0 through 5.0 in 0.1 steps. Empty and 1 normalize to 1.0. An old absent or null value migrates to 1.5 for large brand text, otherwise 1.0; pull and footer push materialize it. Whitespace, exponents, numeric JSON values and extra decimal places are refused.",
|
|
592
|
+
},
|
|
593
|
+
"FooterSettings.logoBox": {
|
|
594
|
+
type: "enum", default: "fixed", values: ["fixed", "natural"],
|
|
595
|
+
description: "Fixed keeps scaled logo height, including unused image-box space. Natural fits the constrained artwork dimensions without cropping alpha padding. Omitted, null or empty is fixed.",
|
|
596
|
+
},
|
|
597
|
+
...Object.fromEntries(["alignment", "brandAlignment", "asideAlignment"].map(name => [
|
|
598
|
+
`FooterSettings.${name}`, { type: "FooterResponsiveAlignment|null", inheritedWhenOmitted: true },
|
|
599
|
+
])),
|
|
600
|
+
"FooterSettings.bottomAlignment": { type: "FooterResponsiveInlineAlignment|null", inheritedWhenOmitted: true },
|
|
601
|
+
...Object.fromEntries(["FooterResponsiveAlignment", "FooterResponsiveInlineAlignment"].flatMap(type =>
|
|
602
|
+
FOOTER_ALIGNMENT_LAYOUTS.map(layout => [
|
|
603
|
+
`${type}.${layout}`, { type: type === "FooterResponsiveAlignment" ? "FooterAlignment|null" : "FooterInlineAlignment|null", inheritedWhenOmitted: true },
|
|
604
|
+
]))),
|
|
605
|
+
...Object.fromEntries(["FooterAlignment", "FooterInlineAlignment"].flatMap(type => [
|
|
606
|
+
[`${type}.horizontal`, { type: "enum", values: ["", ...FOOTER_POSITION_VALUES], inheritedWhenOmitted: true }],
|
|
607
|
+
[`${type}.textAlign`, { type: "enum", values: ["", ...FOOTER_TEXT_ALIGN_VALUES], inheritedWhenOmitted: true }],
|
|
608
|
+
])),
|
|
609
|
+
"FooterAlignment.vertical": { type: "enum", values: ["", ...FOOTER_POSITION_VALUES], inheritedWhenOmitted: true },
|
|
582
610
|
"FooterSettings.linkColumns": { type: "FooterLinkColumn[]", default: [], maximumItems: FOOTER_LIMITS.linkColumns },
|
|
583
611
|
"FooterSettings.asideHeadingContent": {
|
|
584
612
|
type: "FooterRichText",
|
|
@@ -609,6 +637,8 @@ const FOOTER_FIELD_DETAILS = Object.freeze({
|
|
|
609
637
|
"FooterSettings.dark": { type: "FooterSchemeSettings", default: "scheme defaults" },
|
|
610
638
|
"FooterSettings.featureImage": { type: "FooterFeatureImageSettings|null", default: null },
|
|
611
639
|
"FooterLinkColumn.id": { type: "canonical-lowercase-uuid", required: true },
|
|
640
|
+
"FooterLinkColumn.span": { type: "integer", default: 1, minimum: 1, maximum: FOOTER_LIMITS.columnSpanMax },
|
|
641
|
+
"FooterLinkColumn.alignment": { type: "FooterResponsiveAlignment|null", inheritedWhenOmitted: true },
|
|
612
642
|
"FooterLinkColumn.groups": { type: "FooterLinkGroup[]", default: [], maximumItems: FOOTER_LIMITS.groupsPerColumn },
|
|
613
643
|
"FooterLinkGroup.id": { type: "canonical-lowercase-uuid", required: true },
|
|
614
644
|
"FooterLinkGroup.heading": {
|
|
@@ -671,6 +701,12 @@ const FOOTER_FIELD_DETAILS = Object.freeze({
|
|
|
671
701
|
...appearanceColorReference(APPEARANCE_FOOTER_COLOR_FIELDS.find((field) => field.name === "linkHoverColor")),
|
|
672
702
|
default: "",
|
|
673
703
|
},
|
|
704
|
+
"FooterSchemeSettings.logoId": {
|
|
705
|
+
type: "site-owned-png-or-webp-image-uuid",
|
|
706
|
+
default: "",
|
|
707
|
+
description: "An optional footer logo override for this scheme. Empty inherits that scheme's site logo; clearing an override leaves the site logo and media unchanged.",
|
|
708
|
+
},
|
|
709
|
+
"FooterSchemeSettings.logoUrl": { type: "url", readOnly: true },
|
|
674
710
|
"FooterSchemeSettings.backgroundImageId": { type: "site-owned-image-uuid", default: "" },
|
|
675
711
|
"FooterSchemeSettings.backgroundImageUrl": { type: "url", readOnly: true },
|
|
676
712
|
"FooterSchemeSettings.backgroundImageOpacity": { type: "number", default: 1, minimum: 0, maximum: 1 },
|
|
@@ -732,10 +768,36 @@ export function getFooterReference() {
|
|
|
732
768
|
+ "with accented or non-English letters are not supported here; use a bottom link for that site. "
|
|
733
769
|
+ "The row renders between the bottom content and the bottom links.",
|
|
734
770
|
imageRule:
|
|
735
|
-
"Image ids come from pull or media upload.
|
|
771
|
+
"Image ids come from pull or media upload. Each scheme's logoId is an optional site-owned PNG/WebP override; "
|
|
772
|
+
+ "an empty id inherits the site's logo for that scheme independently. logoUrl is response-only metadata. "
|
|
773
|
+
+ "Feature images require alt text; background art is decorative.",
|
|
774
|
+
layoutRule: "Brand, link columns and aside share equal tracks; each span adds tracks, with no total limit. "
|
|
775
|
+
+ "The brand gets its own row at tablet width, and all regions stack on phones. brandSize changes only brand text; "
|
|
776
|
+
+ `logoScale independently scales the logo's normal ${FOOTER_LOGO_BOX.heightRem}rem height and ${FOOTER_LOGO_BOX.maxWidthRem}rem maximum width at every width. `
|
|
777
|
+
+ "The available width still constrains it.",
|
|
778
|
+
alignmentRule: "Save sparse wide, wrapped (Brand row) and stacked profiles on alignment (whole-footer default), "
|
|
779
|
+
+ "brandAlignment, asideAlignment and each column's alignment. bottomAlignment has horizontal and textAlign only. "
|
|
780
|
+
+ "For each axis, search from the active layout toward wider layouts, trying the region then whole-footer choice "
|
|
781
|
+
+ "at each layout. Empty or omitted axes inherit; null or empty profiles disappear on pull. Explicit start stays "
|
|
782
|
+
+ "authored intent. Horizontal and vertical accept start, center and end; start/end are logical and reverse "
|
|
783
|
+
+ "physical sides in RTL. Text also accepts auto and justify. Auto follows current horizontal alignment and can "
|
|
784
|
+
+ "reset inherited justification. Justify affects prose with a normal last line; headings, brand, menus and CTA "
|
|
785
|
+
+ "labels follow horizontal placement. Invalid, whitespace-padded, non-string and wrong-axis values are refused.",
|
|
786
|
+
logoSpaceRule: "logoBox fixed preserves scaled image height; start moves spare height below the artwork. "
|
|
787
|
+
+ "Natural fits the width-constrained artwork, including its loading reservation, without changing scale or "
|
|
788
|
+
+ "cropping transparent padding. Absent, null or empty logoBox is fixed. Header geometry is unchanged.",
|
|
789
|
+
fitCheck: "validate reports footer.word_breaks at five widths: desktop, small desktop, tablet, phone and Small phone (320px); footer push "
|
|
790
|
+
+ "prints the same warnings before saving. At most 12 are shown, with the true count and any remainder. "
|
|
791
|
+
+ "Estimates use generated default-font advances, the default type scale and gaps; custom fonts or scale may differ. "
|
|
792
|
+
+ "Supported whitespace, hyphen and zero-width break opportunities are estimated; contextual shaping is bounded, "
|
|
793
|
+
+ "and Han, Kana or Thai fragments are skipped. The CLI cannot measure logos and assumes their maximum "
|
|
794
|
+
+ "4:1 ratio, so it can over-report brand words beside a narrow logo. Warnings never refuse a save. "
|
|
795
|
+
+ "The deployment check covers standard and profile sites; managed Docs sites use validate and the Footer tab.",
|
|
736
796
|
readOnlyProjections: FOOTER_READ_ONLY_FIELDS,
|
|
737
797
|
concurrency:
|
|
738
|
-
"pull records
|
|
798
|
+
"pull records the footer-draft-v7 expectedDraftHash, including effective logoScale, logoBox, all sparse profiles "
|
|
799
|
+
+ "and both logo ids, but no response URLs or effective inherited choices. Old v6 baselines are refused; upgrade and pull again. A conflict returns "
|
|
800
|
+
+ "footer.concurrent_modification; pull, reconcile, and retry.",
|
|
739
801
|
themeInteraction:
|
|
740
802
|
"theme push overlays its ten scheme colors onto the site's current footer document inside its atomic save and "
|
|
741
803
|
+ "rewrites this file from the saved result. It refuses while unpushed footer-content edits exist "
|
|
@@ -862,12 +924,15 @@ export function formatPresentationReference(reference) {
|
|
|
862
924
|
if (reference.referenceKind === "footer") {
|
|
863
925
|
const messages = reference.messages.map((message) =>
|
|
864
926
|
message.name + " (unlisted fields rejected)\n"
|
|
865
|
-
+ message.fields.map((field) => " " + field.name.padEnd(30) + fieldConstraint(field)
|
|
927
|
+
+ message.fields.map((field) => " " + field.name.padEnd(30) + fieldConstraint(field)
|
|
928
|
+
+ (field.description ? "; " + field.description : "")).join("\n")
|
|
866
929
|
).join("\n\n");
|
|
867
930
|
return reference.title + "\nUsage: " + reference.usage + "\nWorkspace: "
|
|
868
931
|
+ reference.workspaceFile + " :: " + reference.workspacePath + "\n\nClosed schema:\n"
|
|
869
932
|
+ messages + "\n\nTargets: " + reference.targetRule + "\nSocial links: " + reference.socialLinkRule
|
|
870
933
|
+ "\nImages: " + reference.imageRule
|
|
934
|
+
+ "\nLayout: " + reference.layoutRule + "\nAlignment: " + reference.alignmentRule
|
|
935
|
+
+ "\nLogo space: " + reference.logoSpaceRule + "\nFit check: " + reference.fitCheck
|
|
871
936
|
+ "\nConcurrency: " + reference.concurrency
|
|
872
937
|
+ "\nTheme interaction: " + reference.themeInteraction + "\nRead-only projections: "
|
|
873
938
|
+ reference.readOnlyProjections.join(", ") + "\n\nWorkflow:\n"
|
package/src/reference-help.js
CHANGED
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
|
|
96
96
|
export { getAppearanceReference, getFooterReference, getSettingsReference, getThemeReference };
|
|
97
97
|
|
|
98
|
-
export const REFERENCE_VERSION =
|
|
98
|
+
export const REFERENCE_VERSION = 60;
|
|
99
99
|
|
|
100
100
|
// The date-limit examples `help forms` prints; tests run them through the form validator.
|
|
101
101
|
export const FORM_DATE_WINDOW_FIELD = Object.freeze({
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { FOOTER_FIT_WIDTH_LABELS, footerFitFindings } from "./footer-fit.js";
|
|
2
|
+
import { FOOTER_SETTINGS_FILE } from "./footer-workspace.js";
|
|
1
3
|
import { sanitizeDiagnostic } from "./errors.js";
|
|
2
4
|
import { boundedByBytes } from "./session.js";
|
|
3
5
|
import rules from "./site-check-rules.json" with { type: "json" };
|
|
@@ -79,6 +81,7 @@ export const SITE_CHECK_WORDING = Object.freeze({
|
|
|
79
81
|
"seo.description_short": (finding) => `has a description of ${finding.detail} characters; consider adding useful detail (guidance: ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH})`,
|
|
80
82
|
"seo.description_long": (finding) => `has a description of ${finding.detail} characters; consider shortening it (guidance: ${DESCRIPTION_MINIMUM_LENGTH}–${DESCRIPTION_WARN_LENGTH})`,
|
|
81
83
|
"seo.description_matches_title": () => "has a description that repeats its title; explain what readers will find",
|
|
84
|
+
"footer.word_breaks": (finding) => footerFindingWords(finding),
|
|
82
85
|
"seo.social_image_fallback": (finding) =>
|
|
83
86
|
finding.detail === "first_image"
|
|
84
87
|
? "has no cover image; link previews use the page's first image only when it is public and at least 1200 pixels wide"
|
|
@@ -92,6 +95,7 @@ export const SITE_CHECK_WORDING = Object.freeze({
|
|
|
92
95
|
export const AFTER_PAGE_FIX =
|
|
93
96
|
"then, for a page edit, run taproot-site pages push and taproot-site approve, and run taproot-site deploy --staging to refresh the report";
|
|
94
97
|
export const SITE_CHECK_REMEDIES = Object.freeze({
|
|
98
|
+
"footer.word_breaks": "Widen the named footer region or shorten its text in settings/site-publishing-preferences.json, run taproot-site footer push, then taproot-site deploy --staging to refresh the report.",
|
|
95
99
|
"link.page_missing": `Change the link to a page this site has, or create that page, ${AFTER_PAGE_FIX}.`,
|
|
96
100
|
"image.missing": `Remove the image from the page or replace it with one from the site's library, ${AFTER_PAGE_FIX}.`,
|
|
97
101
|
// Built for each image, because the command carries the image's own revision and text.
|
|
@@ -127,6 +131,21 @@ const H1_CLAIMANT = Object.freeze({
|
|
|
127
131
|
hero: "the hero title",
|
|
128
132
|
});
|
|
129
133
|
|
|
134
|
+
const FOOTER_REGION_ADVICE = Object.freeze({
|
|
135
|
+
column: "Widen its column or shorten the label",
|
|
136
|
+
aside: "Widen the aside or shorten the text",
|
|
137
|
+
brand: "Widen the brand or shorten its text",
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
function footerFindingWords(finding) {
|
|
141
|
+
const [width, region] = String(finding.detail ?? "").split(":");
|
|
142
|
+
const widthName = Object.hasOwn(FOOTER_FIT_WIDTH_LABELS, width)
|
|
143
|
+
? FOOTER_FIT_WIDTH_LABELS[width].toLowerCase()
|
|
144
|
+
: undefined;
|
|
145
|
+
const advice = FOOTER_REGION_ADVICE[region] ?? "Widen the region or shorten the text";
|
|
146
|
+
return `'${finding.subject}' may break mid-word ${widthName === undefined ? "at this width" : `at ${widthName} width`}. ${advice}`;
|
|
147
|
+
}
|
|
148
|
+
|
|
130
149
|
/** The sentence for a finding, falling back to the rule id for a rule this release has no words for. */
|
|
131
150
|
export function describeSiteFinding(finding) {
|
|
132
151
|
const words = Object.hasOwn(SITE_CHECK_WORDING, finding.ruleId) ? SITE_CHECK_WORDING[finding.ruleId] : undefined;
|
|
@@ -164,7 +183,8 @@ function structureFindingsFor(page) {
|
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
/**
|
|
167
|
-
* Evaluates
|
|
186
|
+
* Evaluates offline page and footer rules. `footerOnly` checks settings workspaces without claiming page coverage.
|
|
187
|
+
* `pagePaths` is every
|
|
168
188
|
* page path the workspace knows, and `pagesComplete` says whether that list is
|
|
169
189
|
* the whole site: a truncated manifest cannot say a link is broken.
|
|
170
190
|
*/
|
|
@@ -173,19 +193,24 @@ export function evaluateOfflineSiteChecks({
|
|
|
173
193
|
pagePaths,
|
|
174
194
|
pagesComplete = true,
|
|
175
195
|
formKeysChecked = true,
|
|
196
|
+
footerInput,
|
|
197
|
+
footerOnly = false,
|
|
176
198
|
// Whether `validate --site` ran the image description rule (TR01371), or why it did not.
|
|
177
199
|
imageCheck = imageCheckSkipped(IMAGE_CHECK_NOT_REQUESTED),
|
|
178
200
|
onProgress = () => {},
|
|
179
201
|
}) {
|
|
180
202
|
const known = normalizedPathSet([...pagePaths, ...(planned ?? []).map((page) => page.pagePath)]);
|
|
203
|
+
const footer = footerInput === undefined ? { findings: [], total: 0 } : footerFitFindings(footerInput);
|
|
204
|
+
const hiddenFooter = footer.total - footer.findings.length;
|
|
181
205
|
|
|
182
206
|
const found = [];
|
|
183
|
-
for (const page of planned ?? []) {
|
|
207
|
+
for (const page of footerOnly ? [] : planned ?? []) {
|
|
184
208
|
if (page.document === null || typeof page.document !== "object") continue;
|
|
185
209
|
// The link rule needs every page path; the structure rules read only the page itself.
|
|
186
210
|
const linkFindings = pagesComplete ? missingPageLinkFindings(page.document, page.pagePath ?? "", known) : [];
|
|
187
211
|
for (const finding of [...linkFindings, ...structureFindingsFor(page)]) found.push({ page, finding });
|
|
188
212
|
}
|
|
213
|
+
for (const finding of footer.findings) found.push({ finding });
|
|
189
214
|
// Errors first, then in catalogue order, so the bounded list and the progress lines keep the rules that
|
|
190
215
|
// matter most when a large site raises a frequent one (a missing description) on every page.
|
|
191
216
|
const catalogueOrder = (ruleId) => SITE_CHECK_RULES.findIndex((rule) => rule.id === ruleId);
|
|
@@ -201,8 +226,8 @@ export function evaluateOfflineSiteChecks({
|
|
|
201
226
|
const item = {
|
|
202
227
|
rule: finding.ruleId,
|
|
203
228
|
severity: finding.severity,
|
|
204
|
-
file: page.file,
|
|
205
|
-
path: displayPagePath(page.pagePath),
|
|
229
|
+
file: page === undefined ? FOOTER_SETTINGS_FILE : page.file,
|
|
230
|
+
...(page === undefined ? {} : { path: displayPagePath(page.pagePath) }),
|
|
206
231
|
subject,
|
|
207
232
|
...(finding.detail === "" ? {} : { detail: finding.detail }),
|
|
208
233
|
};
|
|
@@ -214,17 +239,23 @@ export function evaluateOfflineSiteChecks({
|
|
|
214
239
|
if (items.length > MAXIMUM_PROGRESS_LINES) {
|
|
215
240
|
onProgress(`Warning: ${items.length - MAXIMUM_PROGRESS_LINES} more site check finding(s); see findings.`);
|
|
216
241
|
}
|
|
242
|
+
if (hiddenFooter > 0) onProgress(`Warning: and ${hiddenFooter} more footer fit finding(s); widen or shorten the footer text and run validate again.`);
|
|
217
243
|
const reported = boundedByBytes(items, 8 * 1024);
|
|
244
|
+
const total = items.length + hiddenFooter;
|
|
245
|
+
const footerSkipped = footerInput !== undefined && footerInput.enabled !== true ? ["footer.word_breaks"] : [];
|
|
218
246
|
const errors = items.filter((item) => item.severity === "error").length;
|
|
219
247
|
return {
|
|
220
248
|
findings: {
|
|
221
|
-
total
|
|
249
|
+
total,
|
|
222
250
|
errors,
|
|
223
|
-
warnings:
|
|
251
|
+
warnings: total - errors,
|
|
224
252
|
items: reported.items,
|
|
225
|
-
...(reported.truncated ? { truncated: true } : {}),
|
|
253
|
+
...(reported.truncated || hiddenFooter > 0 ? { truncated: true } : {}),
|
|
226
254
|
},
|
|
227
|
-
siteChecks: {
|
|
255
|
+
siteChecks: footerOnly ? {
|
|
256
|
+
ranOffline: footerInput === undefined ? [] : ["footer.word_breaks"],
|
|
257
|
+
...(footerSkipped.length === 0 ? {} : { skipped: footerSkipped }),
|
|
258
|
+
} : {
|
|
228
259
|
ranOffline: rulesRunningAt("validate"),
|
|
229
260
|
// Local values are checked above; only a deployment knows every effective fallback.
|
|
230
261
|
deferredToDeployment: [...METADATA_RULE_IDS],
|
|
@@ -241,14 +272,15 @@ export function evaluateOfflineSiteChecks({
|
|
|
241
272
|
&& rule.runsAt.includes("edit")
|
|
242
273
|
).map((rule) => rule.id),
|
|
243
274
|
// A rule that had nothing to read: a truncated page manifest, no site read for the images, or a workspace
|
|
244
|
-
// with no form files. In catalogue order.
|
|
245
|
-
...(pagesComplete && formKeysChecked && imageCheck.ran
|
|
275
|
+
// with no form files, or a disabled footer. In catalogue order.
|
|
276
|
+
...(pagesComplete && formKeysChecked && imageCheck.ran && footerSkipped.length === 0
|
|
246
277
|
? {}
|
|
247
278
|
: {
|
|
248
279
|
skipped: [
|
|
249
280
|
...(pagesComplete ? [] : ["link.page_missing"]),
|
|
250
281
|
...(imageCheck.ran ? [] : [RULE_IMAGE_DEFAULT_MISSING]),
|
|
251
282
|
...(formKeysChecked ? [] : ["form.key_unknown"]),
|
|
283
|
+
...footerSkipped,
|
|
252
284
|
],
|
|
253
285
|
}),
|
|
254
286
|
...(imageCheck.ran
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 2,
|
|
3
|
-
"about": "The catalogue of site checks (TR01085, TR00947). Severity: 'error' blocks a deploy, 'warning' informs. Scope: 'page' rules read one page body plus cheap site lookups, 'site' rules read the site's own records, 'document' rules read only one document and its metadata, so the editor and the CLI evaluate them from shared/page-structure-checks.ts and the generator compiles deployment advice from the same pure evaluator. runsAt names the run points that evaluate the rule: save, validate (the CLI, offline unless --site), deploy, health, edit (the editor, over the open
|
|
3
|
+
"about": "The catalogue of site checks (TR01085, TR00947). Severity: 'error' blocks a deploy, 'warning' informs. Scope: 'page' rules read one page body plus cheap site lookups, 'site' rules read the site's own records, 'document' rules read only one document and its metadata, so the editor and the CLI evaluate them from shared/page-structure-checks.ts and the generator compiles deployment advice from the same pure evaluator. runsAt names the run points that evaluate the rule: save, validate (the CLI, offline unless --site), deploy, health, edit (the page or Footer editor, over the open design in the browser). appliesTo, when present, limits a rule to those page types. subject and detail say what a finding's two values hold. The footer.word_breaks deploy check covers standard and profile sites; managed Docs sites are checked in the Footer editor and CLI. The typed registry in Taproot.Domain/SiteChecks/SiteCheckRules.cs must list the same rules; SiteCheckTests fails on a difference.",
|
|
4
4
|
"runPoints": ["save", "validate", "deploy", "health", "edit"],
|
|
5
5
|
"rules": [
|
|
6
6
|
{ "id": "link.page_missing", "severity": "warning", "scope": "page", "runsAt": ["save", "validate", "health"], "subject": "page_path", "detail": "none" },
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
{ "id": "seo.description_short", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "character_count" },
|
|
34
34
|
{ "id": "seo.description_long", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "character_count" },
|
|
35
35
|
{ "id": "seo.description_matches_title", "severity": "warning", "scope": "document", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "none", "detail": "none" },
|
|
36
|
-
{ "id": "seo.social_image_fallback", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["edit"], "subject": "none", "detail": "social_image_source" }
|
|
36
|
+
{ "id": "seo.social_image_fallback", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["edit"], "subject": "none", "detail": "social_image_source" },
|
|
37
|
+
{ "id": "footer.word_breaks", "severity": "warning", "scope": "site", "runsAt": ["validate", "edit", "deploy", "health"], "subject": "footer_word", "detail": "width_and_region" }
|
|
37
38
|
]
|
|
38
39
|
}
|
package/src/verbs/footer-push.js
CHANGED
|
@@ -3,6 +3,9 @@ import { VERB_FOOTER_PUSH } from "../constants.js";
|
|
|
3
3
|
import { SiteAuthoringError } from "../errors.js";
|
|
4
4
|
import { projectFooterSettingsForWorkspace, validateFooterDocument } from "../footer-contract.js";
|
|
5
5
|
import { computeFooterDraftHash } from "../footer-draft-hash.js";
|
|
6
|
+
import { readFooterBrandInputs } from "../footer-brand-inputs.js";
|
|
7
|
+
import { buildFooterFitInput } from "../footer-fit.js";
|
|
8
|
+
import { evaluateOfflineSiteChecks } from "../site-check-findings.js";
|
|
6
9
|
import {
|
|
7
10
|
advanceFooterManifest,
|
|
8
11
|
FOOTER_SETTINGS_FILE,
|
|
@@ -78,6 +81,13 @@ export async function footerPush(invocation) {
|
|
|
78
81
|
);
|
|
79
82
|
onProgress("Validated the complete footer document, stable page targets, and site-owned image references locally.");
|
|
80
83
|
|
|
84
|
+
const footerChecks = evaluateOfflineSiteChecks({
|
|
85
|
+
pagePaths: [],
|
|
86
|
+
footerOnly: true,
|
|
87
|
+
footerInput: buildFooterFitInput(footerSettings, await readFooterBrandInputs(config.workspaceDir, footerSettings)),
|
|
88
|
+
onProgress,
|
|
89
|
+
});
|
|
90
|
+
|
|
81
91
|
let response;
|
|
82
92
|
try {
|
|
83
93
|
response = await withRefusalGuidance(onProgress, "footer push", async () =>
|
|
@@ -140,6 +150,7 @@ export async function footerPush(invocation) {
|
|
|
140
150
|
return successResult(VERB_FOOTER_PUSH, siteId, {
|
|
141
151
|
footerFile: FOOTER_SETTINGS_FILE,
|
|
142
152
|
footerDraftHash,
|
|
153
|
+
...footerChecks,
|
|
143
154
|
written: { items: ["footerSettings"], count: 1 },
|
|
144
155
|
});
|
|
145
156
|
}
|
package/src/verbs/validate.js
CHANGED
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
FIXTURE_ROOT_FIELDS,
|
|
17
17
|
} from "../fixture-contract.js";
|
|
18
18
|
import { initializeFixture } from "../fixture-init.js";
|
|
19
|
+
import { readFooterBrandInputs } from "../footer-brand-inputs.js";
|
|
20
|
+
import { buildFooterFitInput } from "../footer-fit.js";
|
|
19
21
|
import { appearanceManifestEntry, footerManifestEntry } from "../footer-workspace.js";
|
|
20
22
|
import { FORMS_DIRECTORY } from "../forms-contract.js";
|
|
21
23
|
import { authorWarnings, descriptionWarnings } from "../page-metadata.js";
|
|
@@ -682,11 +684,15 @@ function pageHints(checked, onProgress) {
|
|
|
682
684
|
* The offline site checks (TR01085) over the planned pages: the rules the shared
|
|
683
685
|
* catalogue lists for `validate`, with the rest named as checked by the site.
|
|
684
686
|
*/
|
|
685
|
-
function offlineSiteChecks(checked, manifest, onProgress, imageCheck) {
|
|
686
|
-
|
|
687
|
+
async function offlineSiteChecks(checked, manifest, onProgress, imageCheck, workspaceDir) {
|
|
688
|
+
const footerInput = checked.footer === undefined
|
|
689
|
+
? undefined
|
|
690
|
+
: buildFooterFitInput(checked.footer.footerSettings, await readFooterBrandInputs(workspaceDir, checked.footer.footerSettings));
|
|
687
691
|
return evaluateOfflineSiteChecks({
|
|
688
|
-
planned: checked.pages?.planned,
|
|
689
|
-
|
|
692
|
+
planned: checked.settingsOnly ? [] : checked.pages?.planned,
|
|
693
|
+
footerInput,
|
|
694
|
+
footerOnly: checked.settingsOnly,
|
|
695
|
+
pagePaths: checked.settingsOnly ? [] : manifest.pages.map((entry) => normalizePagePath(entry?.path)).filter((value) => value !== undefined),
|
|
690
696
|
pagesComplete: manifest.pagesTruncated !== true,
|
|
691
697
|
formKeysChecked: checked.formKeysChecked === true,
|
|
692
698
|
imageCheck,
|
|
@@ -828,7 +834,7 @@ export async function validateFixture(invocation = {}) {
|
|
|
828
834
|
...autolinkWarnings(checked.pages?.planned, onProgress),
|
|
829
835
|
...descriptionWarnings(checked.pages?.planned, onProgress),
|
|
830
836
|
...authorWarnings(checked.pages?.planned, onProgress),
|
|
831
|
-
...offlineSiteChecks(checked, manifest, onProgress, imageCheckSkipped(IMAGE_CHECK_DIRECTORY_ARGUMENT)),
|
|
837
|
+
...await offlineSiteChecks(checked, manifest, onProgress, imageCheckSkipped(IMAGE_CHECK_DIRECTORY_ARGUMENT), fixtureRoot),
|
|
832
838
|
};
|
|
833
839
|
onProgress(
|
|
834
840
|
`Validated ${validatedPages.length} page(s), ${checked.navigation.items} navigation item(s), two themes, appearance, and footer without credentials or mutation.`,
|
|
@@ -893,15 +899,15 @@ async function validatePulledWorkspace(workspaceDir, siteId, invocation, onProgr
|
|
|
893
899
|
? []
|
|
894
900
|
: checked.pages.planned.map((page) => ({ file: page.file, path: displayPagePath(page.pagePath) }));
|
|
895
901
|
const hints = pageHints(checked, onProgress);
|
|
896
|
-
const warnings =
|
|
897
|
-
? {}
|
|
898
|
-
: {
|
|
902
|
+
const warnings = {
|
|
903
|
+
...(checked.settingsOnly ? {} : {
|
|
899
904
|
...autolinkWarnings(checked.pages.planned, onProgress),
|
|
900
905
|
...descriptionWarnings(checked.pages.planned, onProgress),
|
|
901
906
|
...authorWarnings(checked.pages.planned, onProgress),
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
907
|
+
}),
|
|
908
|
+
...await offlineSiteChecks(checked, manifest, onProgress, site.imageCheck, workspaceDir),
|
|
909
|
+
};
|
|
910
|
+
// Docs runs only the footer rule; its skipped image check belongs outside that footer-only report.
|
|
905
911
|
const docsReason = checked.settingsOnly && invocation.fromSite === true
|
|
906
912
|
? {
|
|
907
913
|
imageCheckReason: {
|