@brandon_m_behring/book-scaffold-astro 5.0.0 → 5.2.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/CLAUDE.md +46 -3
- package/README.md +55 -0
- package/assets/og-fonts/Inter-Bold.ttf +0 -0
- package/assets/og-fonts/Inter-Regular.ttf +0 -0
- package/assets/og-fonts/LICENSE.txt +89 -0
- package/assets/og-fonts/SOURCE.md +13 -0
- package/bin/book-scaffold.mjs +4 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +894 -8
- package/dist/schemas.d.ts +1 -1
- package/dist/{types-D1QZgKMO.d.ts → types-DjqMnwHw.d.ts} +22 -4
- package/layouts/Base.astro +101 -3
- package/package.json +5 -1
- package/recipes/25-qa-readiness.md +197 -0
- package/recipes/26-generated-og-cards.md +205 -0
- package/recipes/README.md +2 -0
- package/scripts/init-qa.mjs +209 -0
- package/scripts/qa-core.mjs +1511 -0
- package/scripts/qa.mjs +293 -0
- package/scripts/resolve-book-config.mjs +39 -0
- package/scripts/validate-core.mjs +1675 -0
- package/scripts/validate.mjs +18 -1492
- package/scripts/validation-artifacts.mjs +23 -0
- package/src/lib/og-cards.ts +1135 -0
- package/src/types.ts +22 -3
package/CLAUDE.md
CHANGED
|
@@ -50,9 +50,11 @@ those directories belong to scaffold content collections, not chapter owners.
|
|
|
50
50
|
Keep every lookup book-scoped: navigation/previous-next, labels, references,
|
|
51
51
|
tips, exercises, questions, and glossary entries must select the current
|
|
52
52
|
manifest book. Corpus JSON is `{ schemaVersion: 1, books: { [id]: payload } }`;
|
|
53
|
-
single-book JSON remains flat.
|
|
54
|
-
`build-
|
|
55
|
-
|
|
53
|
+
single-book JSON remains flat. The content-derived `build-labels`, `build-bib`,
|
|
54
|
+
`build-tips`, `build-exercises`, and `validate` commands accept `--book <id>`
|
|
55
|
+
in corpus mode. `qa` defaults to all manifest books, accepts either one exact
|
|
56
|
+
`--book <id>` or `--all`, and rejects `--book` in single-book mode. Figures and
|
|
57
|
+
notebooks remain application-wide.
|
|
56
58
|
|
|
57
59
|
Convergence collateral lives at `changelog/<book>/patterns.yaml` and
|
|
58
60
|
`changelog/<book>/tools/*.yaml`; root-level v4 collateral is single-book only.
|
|
@@ -201,6 +203,7 @@ npm install # once after clone
|
|
|
201
203
|
npm run dev # localhost:4321
|
|
202
204
|
npm run build # astro build + pagefind index → dist/
|
|
203
205
|
npm run validate # pre-flight check (recipe 09)
|
|
206
|
+
npm exec -- book-scaffold qa # content-readiness verdict (recipe 25)
|
|
204
207
|
npm run build:bib # rebuild references.json after .bib edit
|
|
205
208
|
npm run pdf # render dist-pdf/book.pdf via Paged.js
|
|
206
209
|
```
|
|
@@ -227,6 +230,46 @@ A consumer `public/_headers` wins unchanged. Use
|
|
|
227
230
|
or `securityHeaders: false` when another layer owns all headers. Recipe 05 has
|
|
228
231
|
the full precedence and customization contract.
|
|
229
232
|
|
|
233
|
+
## Build-time Open Graph cards (v5.2, opt-in)
|
|
234
|
+
|
|
235
|
+
Set `seo: { ogCards: true }` in `defineBookConfig` to generate deterministic
|
|
236
|
+
1200×630 PNG social cards for eligible static HTML that has no authored image.
|
|
237
|
+
The object form accepts `{ enabled?: boolean, exclude?: string[] }`; exclusions
|
|
238
|
+
are base-relative exact routes or whole-segment globs (`*` crosses one segment,
|
|
239
|
+
`**` crosses zero or more). Invalid patterns fail configuration.
|
|
240
|
+
|
|
241
|
+
Rendered image precedence is page/layout `ogImage` (including chapter
|
|
242
|
+
frontmatter `image`) → current corpus book manifest `image` → static
|
|
243
|
+
`seo.ogImage` → generated card. Generation runs after every consumer
|
|
244
|
+
integration and patches only missing OG/Twitter image tags. It writes
|
|
245
|
+
content-addressed `_og/<hash>.png` assets using package-owned local fonts and
|
|
246
|
+
no network request. Corpus pages retain their resolved book identity; corpus
|
|
247
|
+
surfaces use corpus identity; metadata combines `site` and Astro `base`
|
|
248
|
+
exactly once. A requested card that cannot render, write, or patch fails the
|
|
249
|
+
build. See Recipe 26 before changing card metadata, exclusion matching,
|
|
250
|
+
post-render ordering, or output paths.
|
|
251
|
+
|
|
252
|
+
## QA and content readiness
|
|
253
|
+
|
|
254
|
+
Run `npm exec -- book-scaffold qa` after substantive content changes. It calls
|
|
255
|
+
the same content-contract library as `validate`, then reports stable chapter,
|
|
256
|
+
link, learning-objective, component, and JSON-fixture facts. Human output is
|
|
257
|
+
the default. For CI use `npm --offline exec -- book-scaffold qa --format json`;
|
|
258
|
+
JSON stdout contains only the schema-v1 result, while progress/fatal details go
|
|
259
|
+
to stderr. Exit `0` means no blocking failure, `1` means a red selected/shared
|
|
260
|
+
result, and `2` means the invocation or execution failed.
|
|
261
|
+
|
|
262
|
+
In a corpus, omission checks every manifest book in order; `--book <id>` checks
|
|
263
|
+
one and `--all` states the default explicitly. Schema v1 always includes a
|
|
264
|
+
top-level `shared: { verdict, checks, diagnostics }` aggregate for corpus-wide
|
|
265
|
+
fixture data. Its exact single-book value is
|
|
266
|
+
`{ "verdict": "not_applicable", "checks": {}, "diagnostics": [] }`.
|
|
267
|
+
|
|
268
|
+
Run `npm exec -- book-scaffold init-qa` only when a portfolio QA engine needs
|
|
269
|
+
`guide_qa.yaml`. It emits one deterministic offline command per manifest book,
|
|
270
|
+
or one implicit `book` entry without `--book`. It preserves an existing file;
|
|
271
|
+
`--force` replaces that whole file and no other path. See Recipe 25.
|
|
272
|
+
|
|
230
273
|
## Validation
|
|
231
274
|
|
|
232
275
|
`npm run validate` (also runs in prebuild) catches:
|
package/README.md
CHANGED
|
@@ -49,12 +49,67 @@ local `<BookLink>` targets, and Pagefind results remain book-scoped. See
|
|
|
49
49
|
[Recipe 21](./recipes/21-multi-guide-single-app.md) for content layout, route
|
|
50
50
|
ownership, `--book` tooling, shared sources, and migration.
|
|
51
51
|
|
|
52
|
+
## Content readiness and CLI
|
|
53
|
+
|
|
54
|
+
`book-scaffold qa` combines the existing validation contract with stable
|
|
55
|
+
chapter, link, learning-objective, component, and JSON-fixture metrics. Human
|
|
56
|
+
output is the default; schema-v1 JSON is deterministic and keeps stdout clean
|
|
57
|
+
for CI:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm exec -- book-scaffold qa
|
|
61
|
+
npm --offline exec -- book-scaffold qa --format json
|
|
62
|
+
npm exec -- book-scaffold init-qa
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
In corpus mode `qa` checks every manifest book by default, while `--book <id>`
|
|
66
|
+
selects one exact id. `init-qa` creates the portfolio-engine interoperability
|
|
67
|
+
file `guide_qa.yaml`; its generated checks use `npm --offline exec` and an
|
|
68
|
+
existing file is preserved unless `--force` is explicit. See
|
|
69
|
+
[Recipe 25](./recipes/25-qa-readiness.md) for verdicts, exit codes, the
|
|
70
|
+
top-level `shared` aggregate, and CI wiring.
|
|
71
|
+
|
|
72
|
+
The installed `book-scaffold` dispatcher owns these commands:
|
|
73
|
+
|
|
74
|
+
| Command | Purpose |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `validate` | Pre-flight authored content, references, figures, and links |
|
|
77
|
+
| `qa` | Emit a human or schema-v1 readiness verdict |
|
|
78
|
+
| `init-qa` | Generate deterministic `guide_qa.yaml` interoperability config |
|
|
79
|
+
| `build-labels` | Build cross-reference and heading indexes |
|
|
80
|
+
| `build-bib` | Build bibliography and source-manifest data |
|
|
81
|
+
| `build-tips` | Build the tips index |
|
|
82
|
+
| `build-exercises` | Build the exercises index |
|
|
83
|
+
| `build-figures` | Convert and theme application-wide figure assets |
|
|
84
|
+
| `render-notebooks` | Render application-wide notebook companions |
|
|
85
|
+
|
|
52
86
|
Astro builds emit a Cloudflare-compatible `dist/_headers` with audited
|
|
53
87
|
security defaults. A consumer-owned `public/_headers` wins unchanged;
|
|
54
88
|
`defineBookConfig({ securityHeaders: false })` disables scaffold emission,
|
|
55
89
|
and `securityHeaders.contentSecurityPolicy` replaces only the default CSP.
|
|
56
90
|
See [Recipe 05](./recipes/05-deploy-cloudflare.md#default-security-headers).
|
|
57
91
|
|
|
92
|
+
## Build-time Open Graph cards
|
|
93
|
+
|
|
94
|
+
Social cards are an explicit, offline build feature:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
seo: {
|
|
98
|
+
ogCards: true,
|
|
99
|
+
// or: { enabled: true, exclude: ['/print/', '/private/*/', '/archive/**'] }
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Eligible static pages without a page image, corpus-book manifest image, or
|
|
104
|
+
static `seo.ogImage` receive a deterministic 1200×630 PNG at a
|
|
105
|
+
content-addressed `_og/<hash>.png` URL. Exact exclusions, one-segment `*`, and
|
|
106
|
+
cross-segment `**` are matched after Astro-base normalization. Package-owned
|
|
107
|
+
local fonts keep generation network-free; corpus identity and `site`/`base`
|
|
108
|
+
are applied exactly once. Requested-card failures fail the build instead of
|
|
109
|
+
emitting broken metadata. See
|
|
110
|
+
[Recipe 26](./recipes/26-generated-og-cards.md) for precedence, exclusion
|
|
111
|
+
grammar, output, and verification.
|
|
112
|
+
|
|
58
113
|
## Interactive demos
|
|
59
114
|
|
|
60
115
|
The opt-in `@brandon_m_behring/book-scaffold-astro/demo` entry exports
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The fonts,
|
|
20
|
+
including any derivative works, can be bundled, embedded, redistributed
|
|
21
|
+
and/or sold with any software provided that any reserved names are not used
|
|
22
|
+
by derivative works. The fonts and derivatives, however, cannot be released
|
|
23
|
+
under any other type of license. The requirement for fonts to remain under
|
|
24
|
+
this license does not apply to any document created using the fonts or their
|
|
25
|
+
derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may include
|
|
30
|
+
source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting, or
|
|
39
|
+
substituting -- in part or in whole -- any of the components of the Original
|
|
40
|
+
Version, by changing formats or by porting the Font Software to a new
|
|
41
|
+
environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical writer or
|
|
44
|
+
other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
+
of the Font Software, to use, study, copy, merge, embed, modify, redistribute,
|
|
49
|
+
and sell modified and unmodified copies of the Font Software, subject to the
|
|
50
|
+
following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components, in
|
|
53
|
+
Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy contains
|
|
57
|
+
the above copyright notice and this license. These can be included either as
|
|
58
|
+
stand-alone text files, human-readable headers or in the appropriate
|
|
59
|
+
machine-readable metadata fields within text or binary files as long as
|
|
60
|
+
those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font Name(s)
|
|
63
|
+
unless explicit written permission is granted by the corresponding Copyright
|
|
64
|
+
Holder. This restriction only applies to the primary font name as presented
|
|
65
|
+
to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any Modified
|
|
69
|
+
Version, except to acknowledge the contribution(s) of the Copyright Holder(s)
|
|
70
|
+
and the Author(s) or with their explicit written permission.
|
|
71
|
+
|
|
72
|
+
5) The Font Software, modified or unmodified, in part or in whole, must be
|
|
73
|
+
distributed entirely under this license, and must not be distributed under
|
|
74
|
+
any other license. The requirement for fonts to remain under this license
|
|
75
|
+
does not apply to any document created using the Font Software.
|
|
76
|
+
|
|
77
|
+
TERMINATION
|
|
78
|
+
This license becomes null and void if any of the above conditions are not
|
|
79
|
+
met.
|
|
80
|
+
|
|
81
|
+
DISCLAIMER
|
|
82
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
83
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
|
84
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
|
85
|
+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
|
|
86
|
+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL,
|
|
87
|
+
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF
|
|
88
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE
|
|
89
|
+
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Inter font provenance
|
|
2
|
+
|
|
3
|
+
The renderer vendors the unmodified static TTF files from the official Inter
|
|
4
|
+
4.1 release. Builds never download a font or read a system font.
|
|
5
|
+
|
|
6
|
+
- Release: <https://github.com/rsms/inter/releases/tag/v4.1>
|
|
7
|
+
- Archive: <https://github.com/rsms/inter/releases/download/v4.1/Inter-4.1.zip>
|
|
8
|
+
- Archive SHA-256: `9883fdd4a49d4fb66bd8177ba6625ef9a64aa45899767dde3d36aa425756b11e`
|
|
9
|
+
- `extras/ttf/Inter-Regular.ttf` SHA-256: `40d692fce188e4471e2b3cba937be967878f631ad3ebbbdcd587687c7ebe0c82`
|
|
10
|
+
- `extras/ttf/Inter-Bold.ttf` SHA-256: `288316099b1e0a47a4716d159098005eef7c0066921f34e3200393dbdb01947f`
|
|
11
|
+
|
|
12
|
+
The adjacent `LICENSE.txt` is copied verbatim from that release (SIL Open Font
|
|
13
|
+
License 1.1).
|
package/bin/book-scaffold.mjs
CHANGED
|
@@ -14,6 +14,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
14
14
|
|
|
15
15
|
const handlers = {
|
|
16
16
|
validate: '../scripts/validate.mjs',
|
|
17
|
+
qa: '../scripts/qa.mjs',
|
|
18
|
+
'init-qa': '../scripts/init-qa.mjs',
|
|
17
19
|
'build-labels': '../scripts/build-labels.mjs',
|
|
18
20
|
'build-bib': '../scripts/build-bib.mjs',
|
|
19
21
|
'build-figures': '../scripts/build-figures.mjs',
|
|
@@ -26,6 +28,8 @@ const HELP = `Usage: book-scaffold <sub-command> [args...]
|
|
|
26
28
|
|
|
27
29
|
Sub-commands:
|
|
28
30
|
validate Pre-flight content validator (XRef ids, Cite keys, Figure srcs).
|
|
31
|
+
qa Content-health and readiness report (human or schema-v1 JSON).
|
|
32
|
+
init-qa Generate deterministic guide_qa.yaml interoperability config.
|
|
29
33
|
build-labels Emit src/data/labels.json for cross-references (Phase C).
|
|
30
34
|
build-bib BibTeX -> references.json (+ sources/manifest.yaml -> sources.json).
|
|
31
35
|
build-figures PDF -> SVG via pdftocairo / pdftoppm fallback (+ TikZ in v4.2.0).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstroUserConfig, AstroIntegration, MarkdownHeading } from 'astro';
|
|
2
|
-
import { c as BookConfigOptions, h as BookScaffoldIntegrationOptions, d as BookCorpus, l as CorpusApparatusRoute, e as BookCorpusInput, m as CorpusBook, k as ChaptersRenderer, v as SiblingBooks, x as Style } from './types-
|
|
3
|
-
export { B as BOOK_PRESETS, a as BOOK_PROFILES, b as BookConfigError, f as BookPreset, g as BookProfile, i as BookSchemasOptions, C as CORPUS_APPARATUS_ROUTES, j as ChapterFor, n as CorpusBookInput, F as FreshnessAffordance, o as FrontmatterRouteConfig, N as NUMBER_STYLES, p as NumberStyle, P as PartKey, q as PartialRouteToggles, r as ProfileDefinition, R as ReleaseStatusConfig, s as RouteToggles, S as SecurityHeadersConfig, t as SiblingBookDescriptor, u as SiblingBookEntry, w as StatusBadge, y as StyleInput, V as VolatilityBadge, z as composeStyles, A as defineProfile, D as defineStyle, E as normalizeFrontmatterConfig, G as resolvePreset, H as resolveProfile } from './types-
|
|
2
|
+
import { c as BookConfigOptions, h as BookScaffoldIntegrationOptions, d as BookCorpus, l as CorpusApparatusRoute, e as BookCorpusInput, m as CorpusBook, k as ChaptersRenderer, v as SiblingBooks, x as Style } from './types-DjqMnwHw.js';
|
|
3
|
+
export { B as BOOK_PRESETS, a as BOOK_PROFILES, b as BookConfigError, f as BookPreset, g as BookProfile, i as BookSchemasOptions, C as CORPUS_APPARATUS_ROUTES, j as ChapterFor, n as CorpusBookInput, F as FreshnessAffordance, o as FrontmatterRouteConfig, N as NUMBER_STYLES, p as NumberStyle, O as OgCardsConfig, P as PartKey, q as PartialRouteToggles, r as ProfileDefinition, R as ReleaseStatusConfig, s as RouteToggles, S as SecurityHeadersConfig, t as SiblingBookDescriptor, u as SiblingBookEntry, w as StatusBadge, y as StyleInput, V as VolatilityBadge, z as composeStyles, A as defineProfile, D as defineStyle, E as normalizeFrontmatterConfig, G as resolvePreset, H as resolveProfile } from './types-DjqMnwHw.js';
|
|
4
4
|
import { E as volatilityLevels, c as academicParts, Q as Question } from './schemas-CKipJ5Ie.js';
|
|
5
5
|
export { A as AcademicChapter, B as BloomLevel, C as CourseNotesChapter, G as GlossaryTerm, M as MinimalChapter, P as Provenance, a as QuestionType, R as ResearchPortfolioChapter, T as ToolsChapter, b as academicChapterSchema, d as bloomLevels, e as changeKinds, f as changelogSchema, g as chapterStatus, h as citationBackstops, i as courseNotesChapterSchema, j as glossarySchema, l as layoutModes, m as minimalChapterSchema, p as patternCategories, k as patternsSchema, n as provenanceObject, o as provenanceSchema, q as questionDifficulties, r as questionSchema, s as questionTypes, t as refineQuestion, u as refinedQuestionSchema, v as researchPortfolioChapterSchema, w as sourceTiers, x as sourceTiersResearch, y as sourcesSchema, z as toolSlugs, D as toolsChapterSchema } from './schemas-CKipJ5Ie.js';
|
|
6
6
|
export { KIND_LABEL, ResolvedTheoremLabel, THEOREM_KINDS, TheoremKind, TheoremLabelProps, resolveTheoremNumber, theoremLabel } from './lib/theorem-label.js';
|