create-ailk 0.47.0 → 0.48.1

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 (137) hide show
  1. package/README.md +192 -43
  2. package/component-catalog.json +223 -285
  3. package/component-catalog.md +1 -1
  4. package/dist/apply-design.d.ts +26 -68
  5. package/dist/apply-design.js +150 -322
  6. package/dist/cli.js +152 -17
  7. package/dist/compare-chrome.d.ts +108 -0
  8. package/dist/compare-chrome.js +481 -0
  9. package/dist/compare-look.d.ts +94 -0
  10. package/dist/compare-look.js +378 -0
  11. package/dist/copy.js +1 -1
  12. package/dist/design-compile.d.ts +17 -21
  13. package/dist/design-compile.js +32 -56
  14. package/dist/design-files.d.ts +93 -0
  15. package/dist/design-files.js +312 -0
  16. package/dist/design-home.d.ts +4 -2
  17. package/dist/design-home.js +88 -6
  18. package/dist/design-names.d.ts +13 -0
  19. package/dist/design-names.js +76 -0
  20. package/dist/design-package.d.ts +46 -56
  21. package/dist/design-package.js +285 -288
  22. package/dist/design-presets.d.ts +41 -0
  23. package/dist/design-presets.js +83 -4
  24. package/dist/design-scaffold.d.ts +12 -2
  25. package/dist/design-scaffold.js +72 -34
  26. package/dist/generated/design-settings.d.ts +56 -0
  27. package/dist/generated/design-settings.js +237 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +2 -2
  30. package/dist/inventory.d.ts +3 -2
  31. package/dist/inventory.js +10 -4
  32. package/dist/lib/design-checks.d.ts +46 -0
  33. package/dist/lib/design-checks.js +79 -1
  34. package/dist/lib/env-catalog.js +1 -1
  35. package/dist/lib/module-license-gate.d.ts +1 -1
  36. package/dist/lib/module-license-gate.js +1 -1
  37. package/dist/lib/render-verdict.d.ts +13 -1
  38. package/dist/lib/render-verdict.js +41 -1
  39. package/dist/look-hub.d.ts +44 -0
  40. package/dist/look-hub.js +130 -0
  41. package/dist/look-record.d.ts +35 -0
  42. package/dist/look-record.js +85 -0
  43. package/dist/look-samples.d.ts +66 -0
  44. package/dist/look-samples.js +456 -0
  45. package/dist/look-settings.d.ts +53 -0
  46. package/dist/look-settings.js +807 -0
  47. package/dist/module-architecture.js +12 -0
  48. package/dist/parse-args.d.ts +10 -6
  49. package/dist/parse-args.js +26 -13
  50. package/dist/programmatic.d.ts +1 -19
  51. package/dist/programmatic.js +65 -103
  52. package/dist/retired-design-bodies.d.ts +29 -0
  53. package/dist/retired-design-bodies.js +51 -0
  54. package/dist/seed-flows.d.ts +1 -1
  55. package/dist/seed-flows.js +12 -14
  56. package/dist/seed-workspace.d.ts +4 -1
  57. package/dist/seed-workspace.js +139 -17
  58. package/dist/site-chrome.d.ts +42 -41
  59. package/dist/site-chrome.js +51 -70
  60. package/dist/site-fonts.d.ts +14 -14
  61. package/dist/site-fonts.js +9 -4
  62. package/dist/starter-grid.d.ts +2 -2
  63. package/dist/strip-look-copies.d.ts +67 -0
  64. package/dist/strip-look-copies.js +591 -0
  65. package/dist/template-manifest.d.ts +6 -14
  66. package/dist/template-manifest.js +0 -9
  67. package/dist/template-record.d.ts +3 -1
  68. package/dist/template-record.js +3 -1
  69. package/dist/topology.d.ts +15 -0
  70. package/dist/topology.js +60 -0
  71. package/dist/update.d.ts +57 -1
  72. package/dist/update.js +742 -13
  73. package/package.json +3 -4
  74. package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
  75. package/site-templates/designs/minimalism/DESIGN.md +163 -297
  76. package/site-templates/designs/minimalism/LOOK.md +42 -0
  77. package/site-templates/designs/minimalism/design.yaml +167 -0
  78. package/site-templates/designs/standard/DESIGN.md +145 -149
  79. package/site-templates/designs/standard/LOOK.md +42 -0
  80. package/site-templates/designs/standard/design.yaml +72 -0
  81. package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
  82. package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
  83. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
  84. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
  85. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
  86. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
  87. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
  88. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
  89. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
  90. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
  91. package/site-templates/shapes/person-service/content/_site.mdx +0 -26
  92. package/templates/.claude/rules/extending.md +3 -2
  93. package/templates/.env.example +11 -4
  94. package/templates/CLAUDE.md +1 -1
  95. package/templates/DESIGN.md +145 -149
  96. package/templates/README.md +15 -16
  97. package/templates/apps/api/.env.example +11 -4
  98. package/templates/apps/api/CLAUDE.md +6 -4
  99. package/templates/apps/api/src/lib/__mocks__/prisma.ts +15 -5
  100. package/templates/apps/mcp/CLAUDE.md +4 -2
  101. package/templates/apps/web/.env.example +10 -3
  102. package/templates/apps/web/CLAUDE.md +14 -3
  103. package/templates/apps/web/app/[locale]/layout.tsx +53 -50
  104. package/templates/apps/web/app/not-found.tsx +11 -11
  105. package/templates/apps/web/auth.ts +48 -35
  106. package/templates/apps/web/jest.config.cjs +5 -0
  107. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +179 -31
  108. package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
  109. package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +71 -32
  110. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
  111. package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
  112. package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
  113. package/templates/apps/web/lib/deck-page.ts +3 -10
  114. package/templates/apps/web/lib/deploy-fonts.ts +12 -0
  115. package/templates/apps/web/lib/hub-site-config.ts +97 -14
  116. package/templates/apps/web/lib/library-fonts.ts +41 -0
  117. package/templates/apps/web/lib/mcp-oauth.ts +11 -4
  118. package/templates/apps/web/lib/page-chrome.ts +52 -34
  119. package/templates/apps/web/lib/section-look.ts +28 -0
  120. package/templates/apps/web/lib/site-design.ts +205 -0
  121. package/templates/apps/web/lib/site-theme-head.ts +98 -13
  122. package/templates/apps/web/lib/site-theme.ts +40 -62
  123. package/templates/apps/web/messages/en.json +0 -6
  124. package/templates/apps/web/next.config.mjs +195 -6
  125. package/templates/apps/web/package.json +2 -0
  126. package/templates/apps/web/site-pages.config.tsx +4 -2
  127. package/templates/content/_site.mdx +0 -26
  128. package/templates/design.yaml +75 -0
  129. package/templates/project.yaml +14 -0
  130. package/versions.json +52 -51
  131. package/site-templates/marketing-site/DESIGN.md +0 -259
  132. package/site-templates/marketing-site-free/DESIGN.md +0 -259
  133. package/site-templates/saas-product/DESIGN.md +0 -259
  134. package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
  135. package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
  136. package/templates/apps/web/lib/site-chrome.ts +0 -46
  137. package/templates/apps/web/lib/site-fonts.ts +0 -15
@@ -1,259 +0,0 @@
1
- ---
2
- name: Standard
3
- description: "The standard design — the black-on-white foundation any shape wears by default: full navigation, a multi-column footer, the document-scroll home."
4
- colors:
5
- bg: "#ffffff"
6
- fg: "#000000"
7
- surface: "#ffffff"
8
- surface-secondary: "#ffffff"
9
- border: "#000000"
10
- text-muted: "#333333"
11
- brand: "#000000"
12
- fg-on-brand: "#ffffff"
13
- accent: "#000000"
14
- bg-dark: "#000000"
15
- fg-dark: "#ffffff"
16
- border-dark: "#ffffff"
17
- brand-dark: "#ffffff"
18
- text-muted-dark: "#cccccc"
19
- treatments:
20
- corners: square
21
- eyebrowCase: sentence
22
- placeholders: fill
23
- checkmarks: plain
24
- layout:
25
- nav: full
26
- footer: columns
27
- announcementBanner: false
28
- home: default
29
- copy:
30
- density: standard
31
- typography:
32
- display:
33
- fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
34
- fontSize: "3.5rem"
35
- fontWeight: 700
36
- lineHeight: 1.1
37
- letterSpacing: "normal"
38
- heading-section:
39
- fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
40
- fontSize: "3rem"
41
- fontWeight: 700
42
- lineHeight: 1.1
43
- letterSpacing: "normal"
44
- heading-item:
45
- fontSize: "2rem"
46
- fontWeight: 700
47
- lineHeight: 1.375
48
- letterSpacing: "normal"
49
- body:
50
- fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif"
51
- fontSize: "1.125rem"
52
- fontWeight: 400
53
- lineHeight: 1.5
54
- eyebrow:
55
- fontSize: "0.875rem"
56
- fontWeight: 600
57
- lineHeight: 1.4
58
- letterSpacing: "0.05em"
59
- rounded:
60
- button: "0.5rem"
61
- card: "0.75rem"
62
- spacing:
63
- section: "7rem"
64
- section-mobile: "4rem"
65
- card: "1.5rem"
66
- grid: "1.5rem"
67
- container: "1280px"
68
- measure: "36rem"
69
- ---
70
-
71
- <!--
72
- Source template: saas-product
73
- Design: standard
74
- Version: create-ailk {{CREATE_AILK_VERSION}}
75
-
76
- This is the `standard` design's DESIGN.md. Its one authored source is
77
- create-ailk's site-templates/designs/standard/DESIGN.md; every template on
78
- this design ships a copy of it that differs only in the "Source template"
79
- line above, and a template installed with `--template <name>` replaces the
80
- base scaffold's DESIGN.md with its own. The impeccable design skill reads
81
- it at the start of every design session, so an agent building a new page
82
- stays on-system.
83
- Edit the canonical file, never a copy — a test holds every copy to it.
84
-
85
- The tokens above describe what the site RENDERS today. The design's own
86
- colours and shape knobs live in content/_site.mdx `theme:`, which
87
- `create-ailk apply-design` replaces wholesale; the owner's brand colours and
88
- fonts live beside it in `brand.colors` and `brand.fonts`, which applying a
89
- design never rewrites. Radius and spacing are platform defaults a site
90
- cannot override yet — see "Where this is heading" below.
91
- -->
92
-
93
- # Standard
94
-
95
- ## Overview
96
-
97
- The foundation reads like a well-made wireframe: nothing on the page but the words, black on white, with rules where other sites use shadows and colour. It is the look of a site whose owner has not chosen a brand yet and does not pretend otherwise — every placeholder reads as a placeholder, and the structure of the argument is what the visitor sees. A brand is applied on top of it; it is not one.
98
-
99
- Every page is composed from the AI Launch Kit component library (`@working-theory/ui`). Nothing is hand-built: a page is a list of registered sections, each with a bounded set of variants. Each section is one full-width band with a lot of air around it.
100
-
101
- ## Colors
102
-
103
- <!-- generated:begin colors -->
104
-
105
- | Key | Value | Compiles to |
106
- | ------------------- | --------- | -------------------------------------------------------------------------------------------------------------- |
107
- | `bg` | `#ffffff` | `light.bg` |
108
- | `fg` | `#000000` | `light.text` |
109
- | `surface` | `#ffffff` | `light.surface` |
110
- | `surface-secondary` | `#ffffff` | `light.bgMuted` |
111
- | `border` | `#000000` | `light.border` |
112
- | `text-muted` | `#333333` | `light.textMuted` |
113
- | `brand` | `#000000` | `light.primary` |
114
- | `fg-on-brand` | `#ffffff` | `light.primaryFg` |
115
- | `accent` | `#000000` | `light.accent` |
116
- | `bg-dark` | `#000000` | `dark.bg`, `dark.bgMuted` (fallback of L1), `dark.surface` (fallback of L2), `dark.primaryFg` (fallback of L4) |
117
- | `fg-dark` | `#ffffff` | `dark.text` |
118
- | `border-dark` | `#ffffff` | `dark.border` |
119
- | `brand-dark` | `#ffffff` | `dark.primary`, `dark.accent` (fallback of L5) |
120
- | `text-muted-dark` | `#cccccc` | `dark.textMuted` |
121
-
122
- <!-- generated:end -->
123
-
124
- ### Primary
125
-
126
- **Black** (`brand` `#000000`) fills the primary button; its label is white. The secondary button is white with a black hairline and black label.
127
-
128
- ### Neutral
129
-
130
- Pure white ground (`bg` `#ffffff`), pure black ink for headings (`fg` `#000000`), and near-black `#333333` for body copy — well above AA on white. **Borders are black** (`#000000`): card outlines, the rule under the navigation, the rules between sections and the rule above the footer are all 1px black lines. Cards are white, not tinted (`surface-secondary` is white too). There is no accent colour — `accent` is black.
131
-
132
- Dark mode inverts: black ground, white ink, white rules, white primary button with black label.
133
-
134
- ### Named Rules
135
-
136
- - **Rules, not fills.** A container is drawn with a black hairline on the white ground. Grey fills are reserved for image placeholders.
137
-
138
- ## Typography
139
-
140
- <!-- generated:begin typography -->
141
-
142
- | Role | Family | Size | Weight | Line height | Tracking |
143
- | ----------------- | ------------------------------------------------------------------------ | ---------- | ------ | ----------- | -------- |
144
- | `display` | `system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif` | `3.5rem` | 700 | 1.1 | `normal` |
145
- | `heading-section` | `system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif` | `3rem` | 700 | 1.1 | `normal` |
146
- | `heading-item` | — | `2rem` | 700 | 1.375 | `normal` |
147
- | `body` | `system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, sans-serif` | `1.125rem` | 400 | 1.5 | — |
148
- | `eyebrow` | — | `0.875rem` | 600 | 1.4 | `0.05em` |
149
-
150
- <!-- generated:end -->
151
-
152
- System sans throughout; no web font.
153
-
154
- ### Hierarchy
155
-
156
- | Role | Size | Weight | Notes |
157
- | --------------- | -------- | ------ | ------------------------------------------------------------------------------------- |
158
- | Hero headline | 3.5rem | 700 | Normal tracking, line-height 1.1; 2.5rem below 1024px |
159
- | Section heading | 3rem | 700 | Normal tracking, line-height 1.1; 2.25rem below 1024px, always under the hero |
160
- | Item heading | 2rem | 700 | Card, feature and step titles; 1.5rem below 1024px |
161
- | Body | 1.125rem | 400 | `#333333`, line-height 1.5; section copy capped at 36rem (about 70 characters a line) |
162
- | Section label | 0.875rem | 600 | Uppercase, +0.05em tracking today — the small label above a section heading |
163
-
164
- Measured from the rendered scaffold (1440px and 390px wide), not transcribed from tokens. Bold headings at normal tracking follow the foundation's pinned direction (#6493).
165
-
166
- The small label above a section heading is **kept** as part of this foundation's voice (operator-disposed 2026-09-22) and is headed toward the treatment below.
167
-
168
- ## Layout
169
-
170
- <!-- generated:begin layout -->
171
-
172
- | Knob | Value |
173
- | -------------------- | --------- |
174
- | `nav` | `full` |
175
- | `footer` | `columns` |
176
- | `announcementBanner` | `false` |
177
- | `home` | `default` |
178
-
179
- | Spacing | Value |
180
- | ---------------- | -------- |
181
- | `section` | `7rem` |
182
- | `section-mobile` | `4rem` |
183
- | `card` | `1.5rem` |
184
- | `grid` | `1.5rem` |
185
- | `container` | `1280px` |
186
- | `measure` | `36rem` |
187
-
188
- <!-- generated:end -->
189
-
190
- Full navigation; a multi-column footer; the default home. The home-only announcement banner is off by default (`layout.announcementBanner`). Every page this site carries is listed in its roster of record, `.ailk-site-manifest.json` at the site root. Shared foundation: a 1280px container, sections at 7rem (4rem below 1024px), card grids at 1.5rem, breakpoints 320 / 768 / 1024 / 1440.
191
-
192
- ## Copy
193
-
194
- <!-- generated:begin copy -->
195
-
196
- Copy density: standard — pages carry the ordinary amount of body copy for their section.
197
- <!-- generated:end -->
198
-
199
- ## Shapes
200
-
201
- <!-- generated:begin shapes -->
202
-
203
- | Rounded | Value |
204
- | -------- | --------- |
205
- | `button` | `0.5rem` |
206
- | `card` | `0.75rem` |
207
-
208
- | Treatment | Value |
209
- | ------------------------- | ---------- |
210
- | `treatments.corners` | `square` |
211
- | `treatments.eyebrowCase` | `sentence` |
212
- | `treatments.placeholders` | `fill` |
213
- | `treatments.checkmarks` | `plain` |
214
-
215
- <!-- generated:end -->
216
-
217
- Square corners everywhere (`theme.corners: square`) — buttons, cards, the auth card, image placeholders; the tokens above are the base foundation's defaults a site overrides.
218
-
219
- ## Components
220
-
221
- ### Buttons
222
-
223
- Primary: black fill, white label, 0.5rem corners. Secondary: transparent with a black 1px outline and black label. Both are the library `Button`.
224
-
225
- ### Cards / Containers
226
-
227
- White panels with a black 1px outline, 0.75rem corners, `card` (1.5rem) padding. The one exception today: the "how it works" steps render as dark filled cards (see below).
228
-
229
- ### Navigation
230
-
231
- Full navigation: wordmark left, page links, an outlined and a filled button at the far right. A black hairline separates it from the page. Page links are 16px at weight 400. The two buttons are 42px tall on a 44px touch target and keep the 0.5rem button radius; square corners arrive with the platform radius change below, not in the nav alone (#6508). The Product link opens, on hover or keyboard, a 640px two-column panel whose items each show an icon, a title and a one-line description.
232
-
233
- ## Where this is heading
234
-
235
- The foundation's pinned direction is the pacing of a classic wireframe marketing kit — `standardissue.webflow.io` is the reference for rhythm, type scale, spacing density and section pacing only; no image, copy or code is taken from it. The four traits this section used to list as blocked now ship as settings, so the rendered site matches the reference:
236
-
237
- | Trait | How it is set |
238
- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
239
- | Square corners on buttons, cards and inputs | `theme.corners: square` in `_site.mdx` |
240
- | Section label in sentence case, bold, no tracking | `theme.eyebrowCase: sentence` |
241
- | Solid grey image placeholders, no outline | `theme.placeholders: fill` |
242
- | Bare check and cross marks, no circle badge | `theme.checkmarks: plain` |
243
- | Plain, uncarded feature and step items | per section: `itemStyle: plain`, and `variant: steps` for an image beside a numbered list |
244
- | A left hero whose headline wraps at half the container | `measure: narrow` on the hero (pricing); `gapBelow: tight` where a list follows the hero directly |
245
- | A three-up post grid on the blog index | `blog-list` `variant: grid` (cover · date · read time · title · excerpt · Read more) |
246
- | A plans section that leads its page | drop the hero; the pricing section owns the `<h1>` (`ownsPageTitle`) |
247
-
248
- ## Do's and Don'ts
249
-
250
- - **Do** keep every page built from registered sections. If a section you need does not exist, request it rather than writing one-off markup.
251
- - **Do** set your brand colours (`primary`, `primaryFg`, `accent`, per mode) in `content/_site.mdx` `brand.colors` and your fonts (`display`, `body`) in `brand.fonts`; they reach every section and survive applying another design, which replaces `theme:`.
252
- - **Don't** add a colour accent. The foundation's one idea is black on white; a brand pass adds colour deliberately, through `brand.colors`.
253
- - **Don't** replace a black rule with a shadow or a grey fill.
254
- - **Don't** hard-code the "heading toward" values above into a page. They arrive through the platform, or not at all.
255
-
256
- ## Revisions
257
-
258
- - **2026-09-24 — tile hover is outline-only (operator ruling, /build-starter live pass, #6687).** A comparison tile (`items` in `variant: tile`) hovers by shifting its border to the accent only — no lift, no glow — matching the Positionary `/alternatives` ruling of 2026-08-29. Expressed as the bounded `tileHover: "outline"` option (Card `wash-outline`); the library default `lift` is unchanged for every other site.
259
- - **2026-09-25 — the before-after section's rulings (operator, /build-starter live pass, #6687).** One layout, not two variants: a panel body is an image or rows of content under the same label bar. The label bar is the tone's fill (brand → black bar, white text) at the heading-4 role; a `neutral` panel keeps a white bar. The view selector is underline tabs with the underline under the current tab only (no full-width baseline), active black, inactive muted, black on hover. The pager is a ghost "‹ Previous" at the left edge and "Next ›" at the right edge. The catalyst column carries no icon tile — it starts at the arrow, or at an image when one is set. No back-to-all link and no tag chips on the seed pages.
@@ -1,288 +0,0 @@
1
- /**
2
- * The deck-page resolver (#8687 D3, AC-2).
3
- *
4
- * `deckCandidates` and the `DECK_ROUTES` parity are pure functions over the
5
- * real routes map. `resolveDeckPage` and `inputsFor` (captured off the
6
- * `setDeckPages` registration call) are exercised with `getMdxSource` and
7
- * `next/headers` mocked, in `renderPage-extension.test.tsx`'s idiom.
8
- */
9
- import { readFileSync } from "node:fs";
10
- import { createRequire } from "node:module";
11
- import path from "node:path";
12
-
13
- import { ROUTES } from "@working-theory/templates/routes";
14
-
15
- const mockGetMdxSource = jest.fn();
16
- const mockSetDeckPages = jest.fn();
17
-
18
- jest.mock("@working-theory/page-renderer", () => {
19
- const actual = jest.requireActual("@working-theory/page-renderer");
20
- return {
21
- ...actual,
22
- getMdxSource: (...args: unknown[]) => mockGetMdxSource(...args),
23
- setDeckPages: (...args: unknown[]) => mockSetDeckPages(...args),
24
- };
25
- });
26
-
27
- const mockHeaders = jest.fn();
28
- jest.mock("next/headers", () => ({ headers: () => mockHeaders() }));
29
-
30
- const savedLocales = process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
31
-
32
- beforeAll(() => {
33
- process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = "en,es";
34
- });
35
- afterAll(() => {
36
- if (savedLocales === undefined) delete process.env["NEXT_PUBLIC_ENABLED_LOCALES"];
37
- else process.env["NEXT_PUBLIC_ENABLED_LOCALES"] = savedLocales;
38
- });
39
-
40
- import { DECK_ROUTES, deckCandidates, resolveDeckPage } from "../deck-page";
41
- import { siteChrome } from "../site-chrome";
42
-
43
- describe("deckCandidates (#8687 D3, AC-2)", () => {
44
- const LOCALES = ["en", "es"];
45
-
46
- it("/pricing resolves the route row, then the [slug] fallback", () => {
47
- expect(deckCandidates("/pricing", LOCALES)).toEqual([
48
- { type: "Pricing", slug: "pricing" },
49
- { type: "LandingPage", slug: "pricing" },
50
- { type: "BlogList", slug: "pricing" },
51
- ]);
52
- });
53
-
54
- it("/pricing/<offering> resolves the offering's Pricing page (#10044 D14)", () => {
55
- expect(deckCandidates("/pricing/website-rebuild", LOCALES)).toEqual([
56
- { type: "Pricing", slug: "website-rebuild" },
57
- ]);
58
- });
59
-
60
- it("/about (core, always scaffolded) resolves the route row only", () => {
61
- expect(deckCandidates("/about", LOCALES)).toEqual([
62
- { type: "AboutPage", slug: "about" },
63
- ]);
64
- });
65
-
66
- it("/es/offer/ (no route match) falls through to [slug] alone", () => {
67
- expect(deckCandidates("/es/offer/", LOCALES)).toEqual([
68
- { type: "LandingPage", slug: "offer" },
69
- { type: "BlogList", slug: "offer" },
70
- ]);
71
- });
72
-
73
- it("/projects/apollo resolves the detail row's directory type", () => {
74
- expect(deckCandidates("/projects/apollo", LOCALES)).toEqual([
75
- { type: "Project", slug: "apollo" },
76
- ]);
77
- });
78
-
79
- it("/careers (sections mode since #8849) resolves the route row, then the [slug] fallback", () => {
80
- expect(deckCandidates("/careers", LOCALES)).toEqual([
81
- { type: "CareersList", slug: "careers" },
82
- { type: "LandingPage", slug: "careers" },
83
- { type: "BlogList", slug: "careers" },
84
- ]);
85
- });
86
-
87
- it.each(["/", "/software", "/sign-in", "/blog/post", "/edit/LandingPage/x", "/a/b"])(
88
- "%s resolves no candidates",
89
- (pathname) => {
90
- expect(deckCandidates(pathname, LOCALES)).toEqual([]);
91
- },
92
- );
93
- });
94
-
95
- describe("deckCandidates — private pages (#11659)", () => {
96
- const LOCALES = ["en", "es"];
97
-
98
- it("/private/<s> resolves the LandingPage private-<s>", () => {
99
- expect(deckCandidates("/en/private/convo", LOCALES)).toEqual([
100
- { type: "LandingPage", slug: "private-convo" },
101
- ]);
102
- });
103
-
104
- it("a one-segment /private-<s> stays on the [slug] fallback", () => {
105
- expect(deckCandidates("/private-convo", LOCALES)).toEqual([
106
- { type: "LandingPage", slug: "private-convo" },
107
- { type: "BlogList", slug: "private-convo" },
108
- ]);
109
- });
110
- });
111
-
112
- describe("DECK_ROUTES parity (#8687 D3)", () => {
113
- it("contains every routes-map row with seed content whose page.tsx renders sections, minus /", () => {
114
- // DECK_ROUTES is a fixed superset, not a per-scaffold exact set: a shape
115
- // that doesn't ship one of these routes (e.g. a Free scaffold without
116
- // /alternatives) simply has no page.tsx there, so deckCandidates/
117
- // resolveDeckPage never get a request for it (harmless). What would be a
118
- // real bug is the OTHER direction — an actually-shipped sections route
119
- // this build's own tree carries that DECK_ROUTES fails to name.
120
- const appRoot = path.join(__dirname, "..", "..", "app", "[locale]");
121
- const sectionsRoutes = new Set<string>();
122
- for (const row of ROUTES) {
123
- if (row.route === "/" || !row.contentPath?.startsWith("content/en/")) continue;
124
- const dir = row.route
125
- .split("/")
126
- .filter(Boolean)
127
- .map((segment) => (segment.startsWith(":") ? "[slug]" : segment))
128
- .join("/");
129
- let pageSource: string;
130
- try {
131
- pageSource = readFileSync(path.join(appRoot, dir, "page.tsx"), "utf8");
132
- // A generated route file is a re-export (#11259 D8): read the
133
- // package page it re-exports, resolved from apps/web.
134
- const spec = pageSource.startsWith("// Generated by create-ailk routes from ")
135
- ? /from "(@working-theory\/[^"]+)"/.exec(pageSource)?.[1]
136
- : undefined;
137
- if (spec !== undefined) {
138
- pageSource = readFileSync(createRequire(path.join(__dirname, "..", "..", "package.json")).resolve(spec), "utf8");
139
- }
140
- } catch {
141
- continue;
142
- }
143
- // A content hub (#10121) names its body rule in its HubConfig; the
144
- // "mdx-body" and "composed" rules can render the MDX body, as the
145
- // inline `bodyMode` literal they replaced did. "sections" never does.
146
- const rendersMdxBody =
147
- pageSource.includes('bodyMode: "mdx-body"') ||
148
- /\bbody: "(?:mdx-body|composed)"/.test(pageSource);
149
- if (!rendersMdxBody) {
150
- sectionsRoutes.add(row.route);
151
- }
152
- }
153
- const deckRoutesSet = new Set<string>(DECK_ROUTES);
154
- const missing = [...sectionsRoutes].filter((route) => !deckRoutesSet.has(route));
155
- expect(missing).toEqual([]);
156
- });
157
- });
158
-
159
- describe("resolveDeckPage (#8687 D3, AC-2)", () => {
160
- beforeEach(() => {
161
- mockGetMdxSource.mockReset();
162
- });
163
-
164
- it("returns the first candidate with a source", async () => {
165
- mockGetMdxSource.mockImplementation((type: string) =>
166
- Promise.resolve(
167
- type === "LandingPage"
168
- ? null
169
- : type === "BlogList"
170
- ? { frontmatter: { type: "BlogList", slug: "offer" }, body: "" }
171
- : null,
172
- ),
173
- );
174
-
175
- const result = await resolveDeckPage("/es/offer/", "en");
176
-
177
- expect(result).toEqual({
178
- type: "BlogList",
179
- slug: "offer",
180
- frontmatter: { type: "BlogList", slug: "offer" },
181
- });
182
- });
183
-
184
- it("returns null when a read throws", async () => {
185
- mockGetMdxSource.mockRejectedValue(new Error("read failed"));
186
-
187
- expect(await resolveDeckPage("/pricing", "en")).toBeNull();
188
- });
189
-
190
- it("returns null for a path with no candidates, with zero getMdxSource calls (NFR 2)", async () => {
191
- expect(await resolveDeckPage("/software", "en")).toBeNull();
192
- expect(mockGetMdxSource).not.toHaveBeenCalled();
193
- });
194
- });
195
-
196
- describe("the registered inputsFor (#8687 D3, AC-2)", () => {
197
- beforeEach(() => {
198
- mockGetMdxSource.mockReset();
199
- mockHeaders.mockReset();
200
- });
201
-
202
- function registeredInputsFor(): (ctx: {
203
- type: string;
204
- slug: string;
205
- locale: string;
206
- }) => Promise<unknown> {
207
- const call = mockSetDeckPages.mock.calls[mockSetDeckPages.mock.calls.length - 1];
208
- return (
209
- call?.[0] as {
210
- inputsFor: (ctx: { type: string; slug: string; locale: string }) => Promise<unknown>;
211
- }
212
- ).inputsFor;
213
- }
214
-
215
- it("resolves the design's inputs when the resolved page matches and opts in", async () => {
216
- mockHeaders.mockResolvedValue(new Map([["x-pathname", "/pricing"]]));
217
- mockGetMdxSource.mockImplementation((type: string) =>
218
- Promise.resolve(
219
- type === "Pricing"
220
- ? null
221
- : type === "LandingPage"
222
- ? { frontmatter: { type: "LandingPage", slug: "pricing", layout: "deck" }, body: "" }
223
- : null,
224
- ),
225
- );
226
-
227
- const result = await registeredInputsFor()({
228
- type: "LandingPage",
229
- slug: "pricing",
230
- locale: "en",
231
- });
232
-
233
- // The scaffold's generated site-chrome carries the DESIGN's values — minimalism
234
- // presents the deck (deckPresentation true), standard does not — so the expected
235
- // inputs are read from it rather than hard-coded to one design.
236
- const chrome = siteChrome as typeof siteChrome & {
237
- deckGrounds?: unknown;
238
- deckPresentation?: true;
239
- deckAnchors?: "bare";
240
- };
241
- expect(result).toEqual({
242
- ...(chrome.deckGrounds !== undefined ? { deckGrounds: chrome.deckGrounds } : {}),
243
- deckPresentation: chrome.deckPresentation === true,
244
- // #8773 — the design's slide naming rides along only when it presents and chose bare.
245
- ...(chrome.deckPresentation === true && chrome.deckAnchors === "bare"
246
- ? { deckAnchorStyle: "bare" }
247
- : {}),
248
- });
249
- });
250
-
251
- it("returns null when the resolved page does not match this render", async () => {
252
- mockHeaders.mockResolvedValue(new Map([["x-pathname", "/pricing"]]));
253
- mockGetMdxSource.mockResolvedValue(
254
- { frontmatter: { type: "Pricing", slug: "pricing" }, body: "" },
255
- );
256
-
257
- const result = await registeredInputsFor()({
258
- type: "Pricing",
259
- slug: "pricing",
260
- locale: "en",
261
- });
262
-
263
- expect(result).toBeNull();
264
- });
265
-
266
- it("returns null for a resolved page without the field", async () => {
267
- mockHeaders.mockResolvedValue(new Map([["x-pathname", "/pricing"]]));
268
- mockGetMdxSource.mockImplementation((type: string) =>
269
- Promise.resolve(
270
- type === "LandingPage"
271
- ? { frontmatter: { type: "LandingPage", slug: "pricing" }, body: "" }
272
- : null,
273
- ),
274
- );
275
-
276
- expect(
277
- await registeredInputsFor()({ type: "LandingPage", slug: "pricing", locale: "en" }),
278
- ).toBeNull();
279
- });
280
-
281
- it("returns null with no x-pathname header", async () => {
282
- mockHeaders.mockResolvedValue(new Map());
283
-
284
- expect(
285
- await registeredInputsFor()({ type: "LandingPage", slug: "pricing", locale: "en" }),
286
- ).toBeNull();
287
- });
288
- });
@@ -1,70 +0,0 @@
1
- /**
2
- * `siteThemeHead` (#7742 D6 / AC-4) — the one helper behind the locale
3
- * layout's `<style data-ailk="theme-vars">` and `<html>` class and the minimal
4
- * 404's. Pinned against the expressions the layout computed inline before the
5
- * extraction, so moving them into the helper changed no byte of the `<style>`
6
- * text; `layout.test.tsx` and `site-fonts.test.tsx` pin the layout's own
7
- * emitted text over it.
8
- */
9
- import { applyDesignFonts, themeToCssVarsBothModes } from "@working-theory/theme";
10
-
11
- import type { SiteFonts } from "../site-fonts";
12
-
13
- const mockSiteFonts: SiteFonts = { className: "", families: {} };
14
- // eslint-disable-next-line no-restricted-syntax -- #507: `site-fonts.ts` is a generated data module with no external boundary to mock instead; this is the seam the helper reads.
15
- jest.mock("../site-fonts", () => ({
16
- __esModule: true,
17
- siteFonts: mockSiteFonts,
18
- }));
19
-
20
- const mockLoadSiteBrandTokens = jest.fn();
21
- const mockLoadSiteShapeCss = jest.fn();
22
- // eslint-disable-next-line no-restricted-syntax -- #507: the helper's one seam onto `_site.mdx`; the overlay is the test's to set.
23
- jest.mock("../site-theme", () => ({
24
- __esModule: true,
25
- loadSiteBrandTokens: (...args: unknown[]) => mockLoadSiteBrandTokens(...args),
26
- loadSiteShapeCss: (...args: unknown[]) => mockLoadSiteShapeCss(...args),
27
- }));
28
-
29
- import { siteThemeHead } from "../site-theme-head";
30
-
31
- /** The locale layout's pre-#7742 inline computation, verbatim. */
32
- function layoutStyleText(): { css: string; className: string | undefined } {
33
- const designFonts = applyDesignFonts(mockLoadSiteBrandTokens(), mockSiteFonts);
34
- return {
35
- css:
36
- themeToCssVarsBothModes(designFonts.tokens ? { brand: designFonts.tokens } : {}) +
37
- mockLoadSiteShapeCss(),
38
- className: designFonts.className || undefined,
39
- };
40
- }
41
-
42
- beforeEach(() => {
43
- Object.assign(mockSiteFonts, { className: "", families: {} });
44
- mockLoadSiteBrandTokens.mockReset().mockReturnValue(undefined);
45
- mockLoadSiteShapeCss.mockReset().mockReturnValue("");
46
- });
47
-
48
- describe("siteThemeHead (#7742 D6)", () => {
49
- it("no theme and no faces: today's CSS and no class", () => {
50
- const head = siteThemeHead();
51
- expect(head.css).toBe(themeToCssVarsBothModes({}));
52
- expect(head.css).toBe(layoutStyleText().css);
53
- expect(head.fontClassName).toBeUndefined();
54
- });
55
-
56
- it("a brand overlay, shape CSS and design faces: the layout's exact text and class", () => {
57
- mockLoadSiteBrandTokens.mockReturnValue({ font: { body: "Brand" } });
58
- mockLoadSiteShapeCss.mockReturnValue(":root{--radius-control:0}");
59
- Object.assign(mockSiteFonts, {
60
- className: "f1 f2",
61
- families: { display: "var(--font-design-display), Georgia, serif" },
62
- });
63
- const head = siteThemeHead();
64
- const expected = layoutStyleText();
65
- expect(head.css).toBe(expected.css);
66
- expect(head.css).toContain("--font-body: Brand;");
67
- expect(head.css.endsWith(":root{--radius-control:0}")).toBe(true);
68
- expect(head.fontClassName).toBe(expected.className);
69
- });
70
- });
@@ -1,46 +0,0 @@
1
- // site-chrome.ts — resolved template layout knobs.
2
- //
3
- // GENERATED by create-ailk from the declared template's `layout` block
4
- // (#5612). A scaffold with no template, or a template with no `layout`
5
- // block, gets the defaults below (the announcement banner is off unless a
6
- // template turns it on, #6469). `apps/web/app/[locale]/layout.tsx` reads this to decide:
7
- // - nav: "mark-only" → Nav renders the brand mark + right-hand controls
8
- // only (no nav links).
9
- // - footer: "centered" → Footer renders its existing centered variant.
10
- // - announcementBanner: false → the home-only announcement Banner is not
11
- // mounted (the cookie-consent Banner is unaffected — it is not an
12
- // announcement).
13
- // - home: "deck" → the locale-root route mounts MarketingShell with
14
- // snap="mandatory" + deckHero (spec 5426 D7); every other route is
15
- // unaffected.
16
- // - innerPages: "bare" → every non-home page renders the bare header and
17
- // the one-bar footer.
18
- // - deckPresentation → the deck home presents slide by slide: fitted slides, slide anchors, the mark follows the ground
19
- // - deckAnchors: "bare" → the presenting deck names its slides #<id> instead of #slide-<id>
20
- // - colorMode: "light" → the site is pinned to light and shows no theme
21
- // switch; dark appears only as a deck ground.
22
- // - chromeStyle: "minimal" → the deck's closing slide is the wordmark,
23
- // contact lines and one legal line; the consent bar is a hairline bar on
24
- // the page ground; the 404 renders in the site's theme.
25
- // - closingFooterPaths → each listed inner page ends on the closing footer
26
- // (the wordmark, contact lines and legal line) instead of its usual footer.
27
-
28
- export interface SiteChrome {
29
- nav: "full" | "mark-only";
30
- footer: "columns" | "centered";
31
- announcementBanner: boolean;
32
- home: "default" | "deck";
33
- innerPages?: "bare";
34
- deckPresentation?: true;
35
- deckAnchors?: "bare";
36
- colorMode?: "light";
37
- chromeStyle?: "minimal";
38
- closingFooterPaths?: readonly string[];
39
- }
40
-
41
- export const siteChrome: SiteChrome = {
42
- nav: "full",
43
- footer: "columns",
44
- announcementBanner: false,
45
- home: "default",
46
- };