@taprootio/site-authoring 0.36.1 → 0.37.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 +170 -16
- package/package.json +2 -2
- package/src/api.js +71 -4
- package/src/appearance-contract.js +4 -4
- package/src/changelog.json +40 -0
- package/src/cli-release.js +1 -1
- package/src/cli.js +110 -19
- package/src/constants.js +1 -0
- package/src/content/blockquote-metadata.js +100 -0
- package/src/content/component-urls.js +59 -0
- package/src/content/free-form-section-registry.json +44 -2
- package/src/content/markdown.js +81 -2
- package/src/content/tiptap-prosemirror.ts +23 -5
- package/src/content/validate-document.js +12 -1
- package/src/content/vocabulary.js +1 -0
- package/src/errors.js +15 -0
- package/src/header-presentation.js +9 -2
- package/src/placed-image-ids.js +243 -0
- package/src/presentation-reference.js +1 -1
- package/src/reference-help.js +56 -16
- package/src/setting-reference.js +8 -3
- package/src/settings-catalog.js +2 -1
- package/src/site-check-findings.js +73 -7
- package/src/site-check-rules.json +2 -2
- package/src/site-health-findings.js +252 -0
- package/src/site-health-image-checks.js +49 -0
- package/src/site-health-precheck.js +341 -0
- package/src/verbs/deploy.js +27 -0
- package/src/verbs/health.js +266 -0
- package/src/verbs/index.js +3 -0
- package/src/verbs/media-images.js +24 -15
- package/src/verbs/pages-push.js +108 -20
- package/src/verbs/status.js +43 -2
- package/src/verbs/validate.js +123 -19
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ renderer would drop.
|
|
|
17
17
|
Taproot cannot yet deliver sign-in email to people outside the team, so no
|
|
18
18
|
one outside it can create an account or approve a sign-in today. The package
|
|
19
19
|
is published ahead of that so it is installed and ready when access opens.
|
|
20
|
-
Until then, `help` and `validate` work fully offline, and `login` will print
|
|
20
|
+
Until then, `help` and `validate` (unless `--site`) work fully offline, and `login` will print
|
|
21
21
|
its approval code and URL and then wait for an approval that cannot yet be
|
|
22
22
|
given, giving up when the approval window closes (about fifteen minutes) with
|
|
23
23
|
`login.timeout`. This note is removed when access opens.
|
|
@@ -158,9 +158,21 @@ publishes as an `<h2>` because the banner's overlay text, a hero title or an ear
|
|
|
158
158
|
`#` heading already is the `<h1>` (`detail` says which); `seo.h1_multiple` for a hero
|
|
159
159
|
title after the `<h1>`; `seo.heading_renumbered` and `seo.heading_before_title` for
|
|
160
160
|
headings published at another level; and `a11y.link_text_empty`. Image-default
|
|
161
|
-
completeness (`a11y.image_default_missing`)
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
completeness (`a11y.image_default_missing`) needs the site's own image records,
|
|
162
|
+
so plain `validate` lists it in `siteChecks.skipped`, with `siteChecks.imageCheckReason`
|
|
163
|
+
(`not_requested`, or `directory_argument` for a directory). `validate --site` reads
|
|
164
|
+
those records and reports each undescribed image the workspace places in
|
|
165
|
+
`imageFindings` (`total`, `items`, `truncated`), with its affected pages and the exact
|
|
166
|
+
`media images describe` command for its fix, and the placed ids that are not in the
|
|
167
|
+
site's library (deleted, another site's, or owned media such as a copied video poster)
|
|
168
|
+
in `notInSiteLibrary`; `siteChecks.imageCheckReason` says `read_failed` or
|
|
169
|
+
`read_partly_failed` when the read did not complete. After staging, the stored
|
|
170
|
+
deployment report (`health --staging`) is the authority, using frozen image defaults.
|
|
171
|
+
Without `--describe-missing-images`, placement alt strings and decorative choices never fill a
|
|
172
|
+
missing reusable default: alt text only suggests the text for the command. Besides `media images describe` and the
|
|
173
|
+
app, `pages push --describe-missing-images` is the only path that fills one, and only when
|
|
174
|
+
the selected custom or unset placements agree on a single text; no other push or validate
|
|
175
|
+
path infers a default from placement alt. Known author-entered metadata receives missing, short and
|
|
164
176
|
long title/description advice, plus `seo.description_matches_title` when the description
|
|
165
177
|
repeats its title. The writing guidance is 15–70 characters for titles and 50–160 for
|
|
166
178
|
descriptions, counted as Unicode characters after outer trimming. These suggestions
|
|
@@ -334,8 +346,9 @@ each step names the reference it relies on.
|
|
|
334
346
|
1. **Select a supported site.** `login`, then `sites` and
|
|
335
347
|
`use <site-name-or-id>`. A standard site takes every verb; a managed Docs
|
|
336
348
|
site takes presentation only (`pull`, `theme push`, `footer push`,
|
|
337
|
-
`media upload`, `deploy`, `status
|
|
338
|
-
|
|
349
|
+
`media upload`, `deploy`, `status`, and `health`, which answers
|
|
350
|
+
`covered: false` there) because its pages, navigation and redirects come
|
|
351
|
+
from the Docs artifact; a prebuilt Docs site takes no verb.
|
|
339
352
|
2. **Pull and keep the baseline.** `pull` writes both schemes' complete
|
|
340
353
|
effective themes, the appearance files and the footer. Edit that pull;
|
|
341
354
|
never build a theme from memory or an example.
|
|
@@ -351,7 +364,9 @@ each step names the reference it relies on.
|
|
|
351
364
|
with your own tools, upload them with `media upload`, then assign
|
|
352
365
|
`lightLogoId`, `darkLogoId` and `brand.faviconId` from the returned ids. There
|
|
353
366
|
is no recolor, crop or SVG upload command.
|
|
354
|
-
5. **Validate, preview, then push.** `validate` checks the whole workspace offline
|
|
367
|
+
5. **Validate, preview, then push.** `validate` checks the whole workspace offline
|
|
368
|
+
(`validate --site` also reads the site's image records, to report placed images with
|
|
369
|
+
no default description);
|
|
355
370
|
`theme resolve` prints, also offline, the colors Espalier compiles from the
|
|
356
371
|
theme for each scheme and context with the contrast of every ink-on-surface
|
|
357
372
|
pair and a flag for each one under WCAG AA (add `--json` for the stable
|
|
@@ -385,13 +400,22 @@ each step names the reference it relies on.
|
|
|
385
400
|
```bash
|
|
386
401
|
taproot-site pull
|
|
387
402
|
# edit site/pages/about.md
|
|
403
|
+
taproot-site validate --site
|
|
388
404
|
taproot-site pages push about
|
|
389
405
|
taproot-site preview page about
|
|
390
406
|
taproot-site approve about
|
|
391
407
|
taproot-site deploy --staging
|
|
408
|
+
taproot-site health --staging
|
|
392
409
|
taproot-site deploy --production
|
|
393
410
|
```
|
|
394
411
|
|
|
412
|
+
After `deploy --staging`, `health --staging` reads the Site Health warnings the
|
|
413
|
+
staged release stored, and `deploy --staging` returns the same report as
|
|
414
|
+
`siteHealth`. Fix every warning marked `newSinceProduction` before handing the
|
|
415
|
+
release over, then stage again: the report belongs to a release, so a fix
|
|
416
|
+
changes it only after another `deploy --staging` (and `approve`, for a page
|
|
417
|
+
edit). See [Site Health from the CLI in 0.37.0](#site-health-from-the-cli-in-0370).
|
|
418
|
+
|
|
395
419
|
`pull` snapshots pages, navigation, redirects, and settings into the
|
|
396
420
|
workspace: `pages/`, `nav.json`, `redirects.json`, `settings/`, `media/`, and
|
|
397
421
|
two dot-prefixed manifests that carry site binding and page identity between
|
|
@@ -403,9 +427,19 @@ Markdown subset with `title`, `path`, and `description` front matter, or
|
|
|
403
427
|
`pages/<name>.pm.json` as a ProseMirror document — and pull never writes a
|
|
404
428
|
generated `.pm.json` beside a tracked `.md`. For a page tracked as Markdown
|
|
405
429
|
the site's own document is kept as internal state under
|
|
406
|
-
`.taproot-site-state/`, which is never a page source and never pushed. A
|
|
407
|
-
|
|
408
|
-
|
|
430
|
+
`.taproot-site-state/`, which is never a page source and never pushed. A tracked
|
|
431
|
+
Markdown page conflicts, with a `pages.pull_conflict` refusal before anything under
|
|
432
|
+
`pages/` changes and both recovery paths named, when the site moved: its stored-state
|
|
433
|
+
revision moved, or its display date moved for a page type that has one. A `.pm.json`
|
|
434
|
+
page is refreshed when the site moved, and conflicts only when it also has unpushed
|
|
435
|
+
local edits (its body, or its title, path, description or author in the manifest). The
|
|
436
|
+
revision covers the stored body, title, path, short description and cover image. For
|
|
437
|
+
an authored page (Markdown or ProseMirror), approve, staging and production
|
|
438
|
+
publication never move it; a legal page's version stamp is written at publication and
|
|
439
|
+
does move it; a place review's effective category is applied only to the release, so
|
|
440
|
+
a category override does not move it. The `Differs at:` paths of a refusal explain it
|
|
441
|
+
and never decide it (an empty list can mean a change to the title, path, description,
|
|
442
|
+
cover image or display date).
|
|
409
443
|
Pull before creating a new JSON source. Once a new page is declared with a
|
|
410
444
|
file, title or path but has no server page ID, save it with `pages push` before
|
|
411
445
|
pulling again, or back up both the source and its manifest entry and move them
|
|
@@ -458,7 +492,8 @@ A `.pm.json` page's title, path, description and author live in the workspace
|
|
|
458
492
|
manifest rather than the file. `pages meta set <path> --title <text>
|
|
459
493
|
--description <text>` changes the title or description there (a Markdown page
|
|
460
494
|
keeps them in its front matter; `--author` is described under *Page authors*); `pull` keeps that edit until `pages push`
|
|
461
|
-
sends it, and a site edit to the same page
|
|
495
|
+
sends it, and a site edit to the same page conflicts only while that edit is unpushed
|
|
496
|
+
(`pages.pull_conflict`; see the pull rule above). A
|
|
462
497
|
description over 160 characters is a warning (`descriptionWarnings`), because
|
|
463
498
|
search results cut it off; over 1000 is refused with
|
|
464
499
|
`pages.description_too_long`, by the CLI and by Taproot.
|
|
@@ -792,16 +827,21 @@ candidate and `deploy --production` promotes that completed staging
|
|
|
792
827
|
deployment. `status` reports the platform authoring switch, the CLI release,
|
|
793
828
|
deployments, readiness, image processing, and site health under Content
|
|
794
829
|
permission. `siteHealth` reads the last successful production deployment's stored
|
|
795
|
-
report
|
|
830
|
+
report, and `stagedSiteHealth` summarizes the staged release's (its status, counts,
|
|
831
|
+
deployment and check time, or `available: false` with the reason, or `covered: false`
|
|
832
|
+
on a managed Docs site); `health` has the findings and their fixes. `siteHealth`
|
|
833
|
+
includes the deployment and output identities, input hash, checked time,
|
|
796
834
|
rule version, coverage, assessed page count and status. Unpublished edits are
|
|
797
835
|
outside that report. Page findings identify the rule, severity, page and value;
|
|
798
836
|
image findings group each missing default description with its affected pages.
|
|
799
837
|
Known reports include `covered: true`, `errors`, `warnings`, `pages` and `findings`.
|
|
800
838
|
Only a complete report with zero findings establishes that the assessed candidate
|
|
801
839
|
has no warnings. Missing, unsupported and incomplete assessments are explicit.
|
|
802
|
-
Output is bounded to 100 page findings, with an explicit `findingsTruncated` flag
|
|
840
|
+
Output is bounded to 100 page findings, with an explicit `findingsTruncated` flag, and
|
|
841
|
+
image findings are bounded by size with `imageFindingsTruncated`.
|
|
803
842
|
Preview URLs appear only in normal output and are omitted from GitHub output.
|
|
804
|
-
A denied, malformed or failed read fails `status` instead of implying a clean site
|
|
843
|
+
A denied, malformed or failed production read fails `status` instead of implying a clean site;
|
|
844
|
+
a failed staged read is reported as unavailable.
|
|
805
845
|
|
|
806
846
|
## Output contract
|
|
807
847
|
|
|
@@ -1090,10 +1130,19 @@ at `site-header.headerHeightMultiplier`. Preserve the file's envelope and other
|
|
|
1090
1130
|
settings, then use `validate` and `theme push` as usual.
|
|
1091
1131
|
|
|
1092
1132
|
The multiplier changes the primary bar. Extra menu rows, navigation text and
|
|
1093
|
-
header controls retain their size. Fixed headers above 1.0 shrink
|
|
1094
|
-
|
|
1133
|
+
header controls retain their size. Fixed headers above 1.0 shrink with scroll
|
|
1134
|
+
distance to their minimum height and expand back at the top. Normal and Sticky retain their
|
|
1095
1135
|
configured height; Fixed at 1.0 keeps the regular logo.
|
|
1096
1136
|
|
|
1137
|
+
From 0.36.2, `settings.headerMinHeightMultiplier` uses the same string range and
|
|
1138
|
+
0.1 steps, with omitted/empty/`"1"`/`"1.0"` meaning 1.0. For example, set the
|
|
1139
|
+
expanded height to `"3.8"` and the minimum to `"1.9"` to stop shrinking at 1.9×.
|
|
1140
|
+
The effective minimum is capped at expanded height, while pull retains the saved
|
|
1141
|
+
minimum if the expanded height is temporarily lower. Normal and Sticky ignore
|
|
1142
|
+
the minimum. Equal or oversized minima keep the regular logo and avoid unused
|
|
1143
|
+
compact imagery. A final minimum above 1.0 keeps the tall header's quiet icon
|
|
1144
|
+
controls and active-item treatment.
|
|
1145
|
+
|
|
1097
1146
|
To use alternate artwork after shrinking, upload it with `media upload` and set
|
|
1098
1147
|
`settings.lightCompactLogoId` and/or `settings.darkCompactLogoId` in the existing
|
|
1099
1148
|
`settings/taproot-styles.json`. The app exposes **Compact logo** for Fixed above
|
|
@@ -1105,6 +1154,111 @@ are read-only server projections. Preview light/dark and desktop/390-wide, then
|
|
|
1105
1154
|
stage and deploy the settings for the published site. `help appearance` and
|
|
1106
1155
|
`help settings` describe both files.
|
|
1107
1156
|
|
|
1157
|
+
### Site Health from the CLI in 0.37.0
|
|
1158
|
+
|
|
1159
|
+
Site Health is compiled when a release is generated, so it can only be read
|
|
1160
|
+
after `deploy --staging`. `taproot-site health --staging` (or `--production`)
|
|
1161
|
+
reads the report the release stored and never recomputes it; drafts and
|
|
1162
|
+
approvals made since are outside it (`unpublishedChangesAssessed: false`). It
|
|
1163
|
+
exits 0 whenever it reads the report, whatever the findings.
|
|
1164
|
+
|
|
1165
|
+
- `findings` are page findings: `rule`, `severity`, `path`, `title`, `file` (the
|
|
1166
|
+
workspace source, when the workspace tracks the page), `subject`, `detail` and
|
|
1167
|
+
a `fix` for the rule. `imageFindings` are one for each image with no default
|
|
1168
|
+
description: `imageId`, `name`, up to ten `affectedPages` (with
|
|
1169
|
+
`affectedPageCount` for the total), and a `fix`.
|
|
1170
|
+
- An image `fix` is the exact command, with the description revision read from
|
|
1171
|
+
the site and the alt text the workspace's own pages place:
|
|
1172
|
+
`taproot-site media images describe <id> --description='<alt>' --expected-revision <n> --if-missing`.
|
|
1173
|
+
The text is single-quoted for a POSIX shell. When no placement gives a usable
|
|
1174
|
+
description (none, over 1000 characters, or with control characters), the
|
|
1175
|
+
finding says `needsDescription: true` and its `fix` is a sentence; write the
|
|
1176
|
+
description yourself. An image the site has since described says
|
|
1177
|
+
`currentlyDescribed: true`, and one the site no longer has says
|
|
1178
|
+
`imageAvailable: false`.
|
|
1179
|
+
- With `--staging`, each finding says `newSinceProduction`, and `comparison`
|
|
1180
|
+
says whether production had a complete, untruncated report to compare with.
|
|
1181
|
+
Without one, every finding is listed as not compared.
|
|
1182
|
+
- Findings are bounded by size (`findingsTotal`, `imageFindingsTotal`,
|
|
1183
|
+
`findingsTruncated`, `imageFindingsTruncated`). A site with no stored report
|
|
1184
|
+
returns `available: false` with the reason. A managed Docs site returns
|
|
1185
|
+
`covered: false`.
|
|
1186
|
+
|
|
1187
|
+
The same image check runs before staging, from what the workspace places.
|
|
1188
|
+
`validate --site` (run from the workspace; it needs a sign-in, so it is no longer
|
|
1189
|
+
offline) and `pages push`, with or without `--dry-run`, read the site's records of
|
|
1190
|
+
the images the pages place, in one read, and report each one with no default
|
|
1191
|
+
description with the same `fix`. `validate --site` adds `imageFindings` and
|
|
1192
|
+
`notInSiteLibrary` (each `total`, `items`, `truncated`) and sets `offline: false`;
|
|
1193
|
+
`pages push` adds `siteHealthPrecheck` with `status` (`checked`, `partial` or
|
|
1194
|
+
`not_checked`), `checkedPages`, `imageFindings`, `notInSiteLibrary`, `skipped`
|
|
1195
|
+
and, when the read did not complete, a `reason` code. A warning never refuses, a
|
|
1196
|
+
failed read never fails the push, and `apply` makes no check. The check misses images
|
|
1197
|
+
an integration places and a video poster a push copies; the stored report after
|
|
1198
|
+
staging covers them.
|
|
1199
|
+
|
|
1200
|
+
`pages push --describe-missing-images` (also with `--dry-run`, which writes nothing)
|
|
1201
|
+
goes one step further for the images in that check: after the pages are saved it sets
|
|
1202
|
+
each image's missing default description from the one alt text its selected placements
|
|
1203
|
+
agree on, with the revision the read returned and a condition that it never overwrites a
|
|
1204
|
+
description. Only custom or unset placements count, so a stale inherited alt never
|
|
1205
|
+
restores a default, and alts differing only by surrounding whitespace are one text. The
|
|
1206
|
+
result gains `describedImages`, present only with the flag: `set` and `skipped`, each
|
|
1207
|
+
`{ total, items, truncated }` (a set item is `{ imageId, description }`, a skipped one
|
|
1208
|
+
`{ imageId, reason }`), and `reason` (the read's code) when the image read did not
|
|
1209
|
+
complete. The skip reasons are `alts_disagree`, `no_alt`, `unusable_alt`,
|
|
1210
|
+
`revision_moved`, `invalid_description`, `write_failed`, `write_unknown` (the write may
|
|
1211
|
+
have committed), `write_denied`, `not_read` and `already_described`. A rejected credential,
|
|
1212
|
+
an outdated CLI or a paused platform fails the command after the pages were saved, with
|
|
1213
|
+
`completedWrites` naming what was written; throttling or a denied write stops further
|
|
1214
|
+
writes and exits 0. After images are set, `nextStep` is `approve` while any selected page
|
|
1215
|
+
holds a draft, and `deploy --staging` otherwise.
|
|
1216
|
+
|
|
1217
|
+
### Attributed quotes in 0.36.2
|
|
1218
|
+
|
|
1219
|
+
Ordinary `>` Markdown stays unchanged, including a final quoted paragraph used
|
|
1220
|
+
for attribution. To put attribution and a source in a caption outside the quote
|
|
1221
|
+
panel, use this envelope with ordinary Markdown inside:
|
|
1222
|
+
|
|
1223
|
+
```markdown
|
|
1224
|
+
:::blockquote {"attribution":"Aldous Huxley","sourceTitle":"Brave New World","cite":"https://www.huxley.net/bnw/four.html"}
|
|
1225
|
+
Words can be like X-rays.
|
|
1226
|
+
:::endblockquote
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
The same ProseMirror node is:
|
|
1230
|
+
|
|
1231
|
+
```json
|
|
1232
|
+
{
|
|
1233
|
+
"type": "blockquote",
|
|
1234
|
+
"attrs": {
|
|
1235
|
+
"attribution": "Aldous Huxley",
|
|
1236
|
+
"sourceTitle": "Brave New World",
|
|
1237
|
+
"cite": "https://www.huxley.net/bnw/four.html"
|
|
1238
|
+
},
|
|
1239
|
+
"content": [
|
|
1240
|
+
{ "type": "paragraph", "content": [{ "type": "text", "text": "Words can be like X-rays." }] }
|
|
1241
|
+
]
|
|
1242
|
+
}
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
All three attrs are optional; absent or null means omitted. Attribution is the
|
|
1246
|
+
person or organization, without introductory punctuation. Source title names the
|
|
1247
|
+
work. Each accepts nonblank single-line plain text up to 200 Unicode characters.
|
|
1248
|
+
The source URL accepts an explicit HTTP(S) address or a root-relative path up to
|
|
1249
|
+
2048 characters. Protocol-relative, mailto, tel, script/data URLs, control
|
|
1250
|
+
characters and backslashes are refused. Unknown attrs and malformed, orphan or
|
|
1251
|
+
unclosed markers produce path or line diagnostics. Fenced-code markers stay
|
|
1252
|
+
code. The envelope keeps ordinary quote nesting and placement limits, including
|
|
1253
|
+
inside sections and columns; tables and sections cannot be nested inside quotes.
|
|
1254
|
+
|
|
1255
|
+
Pull writes `.pm.json` with the metadata. An unchanged push makes no write.
|
|
1256
|
+
A tracked `.md` stays byte-identical on push and pull, with metadata retained in
|
|
1257
|
+
remote JSON and the internal baseline. A browser metadata edit raises the usual
|
|
1258
|
+
tracked-Markdown conflict, and a stale push is refused. There is no reverse
|
|
1259
|
+
Markdown exporter. See `taproot-site help page free-form` for the closed attrs
|
|
1260
|
+
reference and examples.
|
|
1261
|
+
|
|
1108
1262
|
### What changed between releases
|
|
1109
1263
|
|
|
1110
1264
|
Taproot accepts only the latest CLI, so an upgrade can be forced at any time.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/site-authoring",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "ISC",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@taprootio/espalier": "6.
|
|
31
|
+
"@taprootio/espalier": "6.14.0",
|
|
32
32
|
"mediabunny": "1.61.1"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
package/src/api.js
CHANGED
|
@@ -1222,6 +1222,61 @@ export async function listSiteImageDescriptions(client, siteId, { pageSize, page
|
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
+
const IMAGE_IDS_PER_REQUEST = 100;
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Reads this site's own images by id, for the description and revision a Site Health fix needs (TR01363).
|
|
1229
|
+
*
|
|
1230
|
+
* Each batch of 100 succeeds or fails on its own: a failed or denied batch puts its ids in `failedIds` and never
|
|
1231
|
+
* throws, so one bad batch does not hide the rest. `refusalKinds` lists the distinct `ApiError.refusalKind()` values
|
|
1232
|
+
* seen, and `refusalError` is the first `credential_rejected` or `cli_outdated` refusal, for a caller that must
|
|
1233
|
+
* fail with its server description. A cancelled run is rethrown. The server returns only this site's own images,
|
|
1234
|
+
* so an id in a successful batch that is not returned (deleted, owned by another site, or owned media such as a
|
|
1235
|
+
* copied video poster, which `libraryOnly` leaves out because no description can be set on it) is simply absent from
|
|
1236
|
+
* `images`. A default that is empty or `null` on the wire is absent here.
|
|
1237
|
+
*/
|
|
1238
|
+
export async function listSiteImagesByIds(client, siteId, imageIds) {
|
|
1239
|
+
const ids = [...new Set(imageIds)];
|
|
1240
|
+
const images = [];
|
|
1241
|
+
const failedIds = [];
|
|
1242
|
+
const refusalKinds = [];
|
|
1243
|
+
let refusalError;
|
|
1244
|
+
for (let start = 0; start < ids.length; start += IMAGE_IDS_PER_REQUEST) {
|
|
1245
|
+
const batch = ids.slice(start, start + IMAGE_IDS_PER_REQUEST);
|
|
1246
|
+
try {
|
|
1247
|
+
const response = requireObject(
|
|
1248
|
+
await client.request(sitePath(siteId, `images${query([["imageIds", batch], ["libraryOnly", true]])}`)),
|
|
1249
|
+
"api.image_description_contract",
|
|
1250
|
+
"site images",
|
|
1251
|
+
);
|
|
1252
|
+
if (response.images !== undefined && !Array.isArray(response.images)) {
|
|
1253
|
+
throw new SiteAuthoringError("api.image_description_contract", "Taproot returned an invalid image list.");
|
|
1254
|
+
}
|
|
1255
|
+
const read = (response.images ?? []).map((entry) => normalizeDescriptionImage(entry, siteId));
|
|
1256
|
+
for (const image of read) {
|
|
1257
|
+
if (!batch.includes(image.imageId)) continue;
|
|
1258
|
+
images.push({
|
|
1259
|
+
imageId: image.imageId,
|
|
1260
|
+
name: image.uploadedName,
|
|
1261
|
+
descriptionRevision: image.descriptionRevision,
|
|
1262
|
+
...(image.defaultDescription === null ? {} : { defaultDescription: image.defaultDescription }),
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
} catch (error) {
|
|
1266
|
+
if (!(error instanceof SiteAuthoringError) || error.code === "site.cancelled") throw error;
|
|
1267
|
+
failedIds.push(...batch);
|
|
1268
|
+
if (error instanceof ApiError) {
|
|
1269
|
+
const kind = error.refusalKind();
|
|
1270
|
+
if (!refusalKinds.includes(kind)) refusalKinds.push(kind);
|
|
1271
|
+
if (refusalError === undefined && (kind === REFUSAL_CREDENTIAL_REJECTED || kind === REFUSAL_CLI_OUTDATED)) {
|
|
1272
|
+
refusalError = error;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return { images, failedIds, refusalKinds, ...(refusalError === undefined ? {} : { refusalError }) };
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1225
1280
|
export async function getSiteImageDescription(client, siteId, imageId) {
|
|
1226
1281
|
return normalizeDescriptionImage(
|
|
1227
1282
|
await client.request(sitePath(siteId, `images/${encodeURIComponent(imageId)}`)), siteId, imageId);
|
|
@@ -1233,10 +1288,18 @@ export async function updateSiteImageDescription(client, siteId, imageId, body)
|
|
|
1233
1288
|
}), siteId, imageId);
|
|
1234
1289
|
}
|
|
1235
1290
|
|
|
1236
|
-
/**
|
|
1237
|
-
|
|
1291
|
+
/**
|
|
1292
|
+
* One release's stored Site Health report, authorized by Content (`site.pages.edit_any`). It reads what the release
|
|
1293
|
+
* stored when it was generated and never recomputes it, so it does not reflect edits made since. With no
|
|
1294
|
+
* `deploymentId` it is the acknowledged production release; with one, that staged release.
|
|
1295
|
+
*/
|
|
1296
|
+
export async function getSiteHealth(client, siteId, { deploymentId: requestedDeploymentId } = {}) {
|
|
1238
1297
|
const code = "api.site_health_contract";
|
|
1239
|
-
const response = requireObject(
|
|
1298
|
+
const response = requireObject(
|
|
1299
|
+
await client.request(sitePath(siteId, `health${query([["deploymentId", requestedDeploymentId]])}`)),
|
|
1300
|
+
code,
|
|
1301
|
+
"site-health report",
|
|
1302
|
+
);
|
|
1240
1303
|
// Proto3 omits empty repeated fields and zero counts. A present non-array is a
|
|
1241
1304
|
// bad report, not evidence that the site is healthy.
|
|
1242
1305
|
if (response.findings !== undefined && !Array.isArray(response.findings)) {
|
|
@@ -1271,6 +1334,10 @@ export async function getSiteHealth(client, siteId) {
|
|
|
1271
1334
|
detail: text(finding.detail),
|
|
1272
1335
|
};
|
|
1273
1336
|
});
|
|
1337
|
+
// Compared across two reports, so built from the wire values themselves: `subject` above is cut for display, and
|
|
1338
|
+
// two long subjects that differ only after the cut must not compare equal (TR01363).
|
|
1339
|
+
const findingKeys = (response.findings ?? []).map((entry) =>
|
|
1340
|
+
[entry.ruleId, entry.pageId ?? "", typeof entry.subject === "string" ? entry.subject : ""].join("\u0000"));
|
|
1274
1341
|
const statuses = new Set(["not_checked", "complete", "incomplete", "unsupported"]);
|
|
1275
1342
|
const status = statuses.has(response.status) ? response.status : "unknown";
|
|
1276
1343
|
const optionalId = (value, field) => value === undefined || value === "" ? undefined : requireCanonicalUuid(value, code, field);
|
|
@@ -1312,7 +1379,7 @@ export async function getSiteHealth(client, siteId) {
|
|
|
1312
1379
|
throw new SiteAuthoringError(code, "Taproot returned health totals that disagree with the stored findings.");
|
|
1313
1380
|
}
|
|
1314
1381
|
return {
|
|
1315
|
-
findings, images, status, assessmentKnown: status !== "unknown",
|
|
1382
|
+
findings, findingKeys, images, status, assessmentKnown: status !== "unknown",
|
|
1316
1383
|
...(deploymentId ? { deploymentId } : {}), ...(outputReleaseId ? { outputReleaseId } : {}),
|
|
1317
1384
|
inputHash: text(response.inputHash), checkedAt: text(response.checkedAt), ruleVersion: text(response.ruleVersion),
|
|
1318
1385
|
coverage: response.coverage ?? [], assessedPageCount: count(response.assessedPageCount, "assessedPageCount"),
|
|
@@ -131,15 +131,15 @@ export const APPEARANCE_SCALAR_FIELDS = Object.freeze([
|
|
|
131
131
|
values: Object.freeze(["normal", "sticky", "fixed"]),
|
|
132
132
|
default: "normal",
|
|
133
133
|
}),
|
|
134
|
-
Object.freeze({
|
|
134
|
+
...["headerHeightMultiplier", "headerMinHeightMultiplier"].map(name => Object.freeze({
|
|
135
135
|
settingsType: SETTINGS_TYPE_SITE_HEADER,
|
|
136
|
-
name
|
|
137
|
-
path:
|
|
136
|
+
name,
|
|
137
|
+
path: `site-header.${name}`,
|
|
138
138
|
type: "header-height-multiplier",
|
|
139
139
|
...HEADER_HEIGHT_MULTIPLIER_LIMITS,
|
|
140
140
|
optional: true,
|
|
141
141
|
default: "",
|
|
142
|
-
}),
|
|
142
|
+
})),
|
|
143
143
|
Object.freeze({
|
|
144
144
|
settingsType: SETTINGS_TYPE_SITE_HEADER,
|
|
145
145
|
name: "showThemeToggle",
|
package/src/changelog.json
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
{
|
|
4
|
+
"version": "0.37.0",
|
|
5
|
+
"note": "Read Site Health with the new health command and in deploy --staging. Catch undescribed images before staging with validate --site and pages push, and set them with --describe-missing-images. The pull conflict rule is now documented exactly.",
|
|
6
|
+
"behavior": [
|
|
7
|
+
"New taproot-site health --staging | --production [--json] reads the Site Health report a release stored and never recomputes it. It exits 0 whatever the findings. Drafts and approvals made after the release are outside the report.",
|
|
8
|
+
"Each finding names its workspace file and a fix. An image finding carries the exact media images describe command, with the description revision and the alt text the workspace's pages place, when that text is safe to run; otherwise it says needsDescription. With --staging, newSinceProduction marks what production's report lacks, and comparison says whether production could be compared.",
|
|
9
|
+
"deploy --staging returns the staged report as siteHealth (the object health --staging returns, with a smaller size bound) and prints each new warning with its fix. A warning never fails the deploy, and a report that cannot be read is available: false.",
|
|
10
|
+
"status adds stagedSiteHealth, a summary of the staged release's report, and bounds siteHealth.imageFindings by size (imageFindingsTruncated).",
|
|
11
|
+
"Steps 3, 5 and 8 of the workspace AGENTS.md template changed: validate --site in the authoring loop, pages push --describe-missing-images as the quick fix in the push step, and health --staging after staging. Refresh your site's copy of the template.",
|
|
12
|
+
"New taproot-site validate --site reads the site's records of the images the workspace places and reports each one with no default description in imageFindings, with its affected pages and the exact media images describe command; 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). It needs the workspace and a sign-in, so it sets offline to false, and a directory argument or --init is refused (validate.site_needs_workspace). A managed Docs workspace, and a workspace placing no images, are not read.",
|
|
13
|
+
"Plain validate stays offline, but it now lists a11y.image_default_missing under siteChecks.ranOffline instead of checkedBySite, and in siteChecks.skipped with siteChecks.imageCheckReason (not_requested, directory_argument, docs_site, read_failed or read_partly_failed) whenever it did not run.",
|
|
14
|
+
"pages push and pages push --dry-run add siteHealthPrecheck: the same image check over every selected page, from one read of the site's image records after the push's problems are refused and before anything is written. A failed read never fails the push, and apply makes no check. The check misses images an integration places and a video poster a push copies, which health --staging covers after staging.",
|
|
15
|
+
"New pages push --describe-missing-images (also with --dry-run, which writes nothing) sets each placed image's missing default description from the one alt text its selected custom or unset placements agree on, after the pages are saved and never over an existing description. The result's describedImages lists what was set and, with a reason code, what was skipped; a rejected credential, outdated CLI or paused platform fails the command after the pages were saved, with completedWrites. With images set, nextStep is approve while a selected page holds a draft, and deploy --staging otherwise.",
|
|
16
|
+
"The pull conflict rule is now stated exactly. A tracked Markdown page conflicts when the site moved (its revision, or its display date for a page type that has one); a .pm.json page is refreshed when the site moved and conflicts only with unpushed local edits. For an authored page, approve, staging and production publication do not move the revision. A .pm.json page pulled while its published row was still the hydrated render copy and holding unpushed local edits can report pages.pull_conflict once on its next publication, and one pages push settles it.",
|
|
17
|
+
"The help reference version is 58."
|
|
18
|
+
],
|
|
19
|
+
"help": [
|
|
20
|
+
"page",
|
|
21
|
+
"walkthrough",
|
|
22
|
+
"media",
|
|
23
|
+
"import"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"version": "0.36.2",
|
|
28
|
+
"note": "Tall fixed headers follow scrolling, and themed quotes support optional attribution and sources.",
|
|
29
|
+
"behavior": [
|
|
30
|
+
"Above standard height, a Fixed header shrinks with scroll distance until it reaches the configured minimum height (1.0 by default). A ready compact logo appears when shrinking starts; page spacing stays stable.",
|
|
31
|
+
"Set optional headerMinHeightMultiplier in site-header.json from \"1.0\" through \"5.0\" in tenths. A 3.8 expanded header can shrink to 1.9. Minimums above expanded height are capped for rendering while preserving saved intent. Normal and Sticky keep their configured height.",
|
|
32
|
+
"Markdown > quotations now have a themed start border, padding and lead typography in published pages and the editor, including named theme contexts and section columns. Quote panels fill their containing section or column; ordinary prose keeps its reading width. Republish existing pages to apply the new presentation.",
|
|
33
|
+
"Write attribution as an ordinary final quoted paragraph, optionally with existing emphasis or a leading dash. Paragraph order does not create a citation or change the saved content.",
|
|
34
|
+
"For a caption outside the quote panel, author :::blockquote {JSON attrs} / :::endblockquote with ordinary Markdown inside. Optional attribution and sourceTitle are nonblank single-line text up to 200 Unicode characters; cite is an HTTP(S) URL or root-relative path up to 2048. JSON uses the same closed attrs. Invalid settings and malformed markers are refused with their path or line.",
|
|
35
|
+
"Pull preserves quote metadata in .pm.json. A tracked .md stays byte-identical through push/pull, with metadata in remote JSON and the internal baseline. An unchanged push makes no write; a remote browser metadata change raises the existing conflict and refuses a stale push.",
|
|
36
|
+
"The help reference version is 57."
|
|
37
|
+
],
|
|
38
|
+
"help": [
|
|
39
|
+
"page",
|
|
40
|
+
"settings"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
3
43
|
{
|
|
4
44
|
"version": "0.36.1",
|
|
5
45
|
"note": "Maintenance release for the authoring CLI.",
|
package/src/cli-release.js
CHANGED
|
@@ -14,7 +14,7 @@ import { SiteAuthoringError } from "./errors.js";
|
|
|
14
14
|
* CLI that is behind the latest published release at sign-in and at token
|
|
15
15
|
* exchange, so every online verb already gets a definitive answer without any
|
|
16
16
|
* of this. What this file is for is the case where there is no request to be
|
|
17
|
-
* refused: `help`, `validate
|
|
17
|
+
* refused: `help`, `validate` (unless `--site`), and `whoami` run entirely offline, and an agent
|
|
18
18
|
* that keeps authoring against a contract that has moved will happily spend a
|
|
19
19
|
* whole session validating documents the site can no longer accept.
|
|
20
20
|
*
|