create-ailk 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/README.md +71 -3
  2. package/component-catalog.json +279 -45
  3. package/dist/add-module.d.ts +20 -0
  4. package/dist/add-module.js +43 -7
  5. package/dist/add-route.d.ts +56 -0
  6. package/dist/add-route.js +286 -0
  7. package/dist/apply-design-md.d.ts +7 -0
  8. package/dist/apply-design-md.js +50 -0
  9. package/dist/apply-design.d.ts +64 -0
  10. package/dist/apply-design.js +273 -0
  11. package/dist/claude-md.d.ts +111 -0
  12. package/dist/claude-md.js +334 -0
  13. package/dist/cli.js +104 -5
  14. package/dist/derive-architecture.js +41 -36
  15. package/dist/design-compile.d.ts +71 -0
  16. package/dist/design-compile.js +98 -0
  17. package/dist/design-package.d.ts +83 -0
  18. package/dist/design-package.js +468 -0
  19. package/dist/design-presets.d.ts +86 -0
  20. package/dist/design-presets.js +642 -0
  21. package/dist/design-scaffold.d.ts +76 -0
  22. package/dist/design-scaffold.js +220 -0
  23. package/dist/index.d.ts +2 -1
  24. package/dist/index.js +4 -1
  25. package/dist/legacy-nav-renderers.d.ts +45 -0
  26. package/dist/legacy-nav-renderers.js +545 -0
  27. package/dist/lib/auth-secret-file.d.ts +19 -0
  28. package/dist/lib/auth-secret-file.js +112 -0
  29. package/dist/lib/design-checks.d.ts +78 -0
  30. package/dist/lib/design-checks.js +174 -0
  31. package/dist/lib/license-key-files.d.ts +9 -0
  32. package/dist/lib/license-key-files.js +2 -2
  33. package/dist/lib/module-license-gate.d.ts +48 -32
  34. package/dist/lib/module-license-gate.js +117 -8
  35. package/dist/lib/render-verdict.d.ts +52 -0
  36. package/dist/lib/render-verdict.js +77 -0
  37. package/dist/lib/scaffold-render-sweep.d.ts +105 -0
  38. package/dist/lib/scaffold-render-sweep.js +236 -0
  39. package/dist/module-architecture.d.ts +19 -16
  40. package/dist/module-architecture.js +67 -23
  41. package/dist/parse-args.d.ts +12 -2
  42. package/dist/parse-args.js +74 -13
  43. package/dist/programmatic.d.ts +30 -6
  44. package/dist/programmatic.js +216 -19
  45. package/dist/site-chrome.d.ts +19 -9
  46. package/dist/site-chrome.js +23 -13
  47. package/dist/site-manifest.d.ts +25 -0
  48. package/dist/site-manifest.js +254 -0
  49. package/dist/site-roster.d.ts +41 -0
  50. package/dist/site-roster.js +141 -8
  51. package/dist/starter-grid.d.ts +16 -63
  52. package/dist/starter-grid.js +102 -84
  53. package/dist/surfaces.d.ts +41 -9
  54. package/dist/surfaces.js +200 -83
  55. package/dist/template-manifest.d.ts +30 -13
  56. package/dist/template-manifest.js +53 -28
  57. package/package.json +6 -3
  58. package/release-scope.json +25 -0
  59. package/site-templates/_base/content/en/UseCase/persona-1.mdx +7 -6
  60. package/site-templates/_base/content/en/UseCase/persona-2.mdx +7 -6
  61. package/site-templates/_base/content/en/UseCase/persona-3.mdx +7 -6
  62. package/site-templates/designs/minimalism/DESIGN.md +98 -6
  63. package/site-templates/designs/minimalism/sample/README.md +48 -0
  64. package/site-templates/{minimalism-site → designs/minimalism/sample}/content/en/HomePage/home.mdx +1 -1
  65. package/site-templates/designs/standard/DESIGN.md +98 -6
  66. package/site-templates/marketing-site/DESIGN.md +98 -6
  67. package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +60 -27
  68. package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +50 -30
  69. package/site-templates/marketing-site-free/DESIGN.md +98 -6
  70. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +60 -24
  71. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +44 -27
  72. package/site-templates/marketing-site-free/ailk-template.json +1 -1
  73. package/site-templates/saas-product/DESIGN.md +98 -6
  74. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +127 -18
  75. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +74 -20
  76. package/site-templates/shapes/local-business-service/ailk-template.json +1 -1
  77. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +127 -18
  78. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +74 -20
  79. package/site-templates/shapes/organization-service/ailk-template.json +1 -1
  80. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +127 -18
  81. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +75 -21
  82. package/site-templates/shapes/person-service/ailk-template.json +1 -1
  83. package/site-templates/shapes/person-service/content/en/AboutPage/about.mdx +1 -1
  84. package/site-templates/shapes/person-service/content/en/HomePage/home.mdx +2 -2
  85. package/site-templates/shapes/person-service/content/en/PortfolioList/portfolio.mdx +4 -2
  86. package/site-templates/shapes/person-service/content/en/ServicesList/services.mdx +1 -1
  87. package/templates/.claude/agents/web.md +10 -8
  88. package/templates/.claude/rules/architecture.md +17 -7
  89. package/templates/.claude/skills/README.md +3 -2
  90. package/templates/.claude/skills/add-auth/SKILL.md +142 -90
  91. package/templates/.claude/skills/add-auth/references/env-vars.md +32 -17
  92. package/templates/.claude/skills/add-auth/references/oauth-app-setup.md +17 -8
  93. package/templates/.claude/skills/add-page/SKILL.md +241 -238
  94. package/templates/.claude/skills/add-page/references/page-types.md +94 -86
  95. package/templates/.claude/skills/add-page/scripts/site-pages.mjs +87 -0
  96. package/templates/.claude/skills/add-page/templates/comparison-page.mdx.tmpl +99 -0
  97. package/templates/.claude/skills/add-page/templates/content.mdx.tmpl +8 -18
  98. package/templates/.claude/skills/add-page/templates/flow-landing-page.mdx.tmpl +43 -0
  99. package/templates/.claude/skills/add-page/templates/report-page.mdx.tmpl +52 -0
  100. package/templates/.claude/skills/add-page/templates/reports-list.mdx.tmpl +38 -0
  101. package/templates/.claude/skills/check-site/SKILL.md +51 -18
  102. package/templates/.claude/skills/check-site/references/common-errors.md +12 -9
  103. package/templates/.claude/skills/check-site/references/findings-glossary.md +4 -4
  104. package/templates/.claude/skills/check-site/references/severity-levels.md +3 -3
  105. package/templates/.claude/skills/fill-page/SKILL.md +26 -7
  106. package/templates/.claude/skills/fill-page/profiles/plumbing.yaml +1 -1
  107. package/templates/.claude/skills/setup-deploy/SKILL.md +75 -38
  108. package/templates/.claude/skills/update-page/SKILL.md +117 -0
  109. package/templates/.claude/skills/update-page/scripts/update-page.ts +640 -0
  110. package/templates/.claude/skills/update-page/templates/redirects.mjs.tmpl +31 -0
  111. package/templates/.claude/skills/upgrade-plan/SKILL.md +12 -8
  112. package/templates/.env.example +23 -2
  113. package/templates/.github/workflows/ci.yml +4 -0
  114. package/templates/.prettierignore +1 -0
  115. package/templates/CLAUDE.md +146 -103
  116. package/templates/DESIGN.md +98 -6
  117. package/templates/README.md +50 -38
  118. package/templates/apps/api/.env.example +2 -1
  119. package/templates/apps/api/src/__tests__/commerce-claim-registration.test.ts +2 -0
  120. package/templates/apps/api/src/__tests__/server.test.ts +116 -0
  121. package/templates/apps/api/src/lib/stripe.ts +9 -0
  122. package/templates/apps/api/src/middleware/__tests__/auth.optional-cookie.test.ts +140 -0
  123. package/templates/apps/api/src/middleware/auth.ts +54 -0
  124. package/templates/apps/api/src/routes/checkout/__tests__/session.test.ts +5 -2
  125. package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +628 -0
  126. package/templates/apps/api/src/routes/checkout/sessions.ts +222 -24
  127. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-flow-checkout.test.ts +1 -1
  128. package/templates/apps/api/src/routes/webhooks/__tests__/stripe-org-billing.test.ts +5 -1
  129. package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +521 -20
  130. package/templates/apps/api/src/routes/webhooks/stripe.ts +124 -32
  131. package/templates/apps/api/src/server.ts +28 -0
  132. package/templates/apps/api/src/services/__tests__/revalidation.test.ts +90 -15
  133. package/templates/apps/api/src/services/checkout-buyer.ts +72 -0
  134. package/templates/apps/api/src/services/revalidation.ts +60 -15
  135. package/templates/apps/mcp/__tests__/tools/create_project.test.ts +30 -24
  136. package/templates/apps/mcp/src/tools/purchase.ts +4 -2
  137. package/templates/apps/web/.env.example +13 -0
  138. package/templates/apps/web/CLAUDE.md +22 -28
  139. package/templates/apps/web/app/[locale]/(auth)/layout.tsx +1 -1
  140. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +24 -0
  141. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +17 -6
  142. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +110 -0
  143. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +60 -0
  144. package/templates/apps/web/app/[locale]/[slug]/page.tsx +1 -1
  145. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +161 -0
  146. package/templates/apps/web/app/[locale]/alternatives/page.tsx +104 -0
  147. package/templates/apps/web/app/[locale]/{use-cases → for}/[slug]/page.tsx +4 -3
  148. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +73 -0
  149. package/templates/apps/web/app/[locale]/{use-cases → for}/page.tsx +8 -7
  150. package/templates/apps/web/app/[locale]/glossary/page.tsx +1 -1
  151. package/templates/apps/web/app/[locale]/layout.tsx +35 -19
  152. package/templates/apps/web/app/[locale]/newsletter/page.tsx +1 -1
  153. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +1 -1
  154. package/templates/apps/web/app/[locale]/portfolio/page.tsx +1 -1
  155. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +112 -0
  156. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +70 -0
  157. package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +236 -44
  158. package/templates/apps/web/app/api/revalidate/route.ts +78 -36
  159. package/templates/apps/web/lib/__tests__/site-brand.test.ts +79 -0
  160. package/templates/apps/web/lib/__tests__/site-theme.test.ts +104 -11
  161. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +21 -4
  162. package/templates/apps/web/lib/locale-guard.ts +18 -0
  163. package/templates/apps/web/lib/meet-placeholder.ts +5 -0
  164. package/templates/apps/web/lib/nav-config.ts +14 -13
  165. package/templates/apps/web/lib/site-brand.tsx +13 -9
  166. package/templates/apps/web/lib/site-logo.tsx +36 -0
  167. package/templates/apps/web/lib/site-theme.ts +46 -26
  168. package/templates/apps/web/messages/en.json +23 -9
  169. package/templates/apps/web/middleware.ts +28 -4
  170. package/templates/content/en/BookCall/book-a-call.mdx +80 -0
  171. package/templates/content/en/BookCall/onsite-estimate.mdx +56 -0
  172. package/templates/content/en/BookCall/onsite-service.mdx +56 -0
  173. package/templates/content/en/BookCall/start-project.mdx +56 -0
  174. package/templates/content/en/ContactPage/contact.mdx +40 -1
  175. package/templates/content/en/HomePage/home.mdx +2 -6
  176. package/templates/content/en/LandingPage/meet.mdx +59 -0
  177. package/templates/content/en/UseCasesList/{use-cases.mdx → for.mdx} +19 -18
  178. package/templates/database/CHANGELOG.md +7 -0
  179. package/templates/database/package.json +1 -1
  180. package/templates/package.json +4 -1
  181. package/templates/tools/check-claude-md.ts +128 -0
  182. package/versions.json +33 -33
  183. package/dist/modules/commerce/0.6.0.tar.gz +0 -0
  184. package/dist/modules/commerce/0.6.1.tar.gz +0 -0
  185. package/dist/modules/docs-blog/0.6.0.tar.gz +0 -0
  186. package/dist/modules/docs-blog/0.6.1.tar.gz +0 -0
  187. package/dist/modules/marketing-site/0.6.1.tar.gz +0 -0
  188. package/dist/modules/minimalism-site/0.6.1.tar.gz +0 -0
  189. package/dist/modules/multi-tenant/0.6.0.tar.gz +0 -0
  190. package/dist/modules/multi-tenant/0.6.1.tar.gz +0 -0
  191. package/dist/modules/saas-product/0.6.1.tar.gz +0 -0
  192. package/dist/modules/scheduling/0.6.0.tar.gz +0 -0
  193. package/dist/modules/scheduling/0.6.1.tar.gz +0 -0
  194. package/dist/modules/signal-collectors/0.6.0.tar.gz +0 -0
  195. package/dist/modules/signal-collectors/0.6.1.tar.gz +0 -0
  196. package/dist/modules/simple-service/0.6.1.tar.gz +0 -0
  197. package/dist/modules/workspace/0.6.0.tar.gz +0 -0
  198. package/dist/modules/workspace/0.6.1.tar.gz +0 -0
  199. package/site-templates/_base/content/en/BookCall/book-call.mdx +0 -52
  200. package/site-templates/minimalism-site/DESIGN.md +0 -162
  201. package/site-templates/minimalism-site/TEMPLATE-MANIFEST.json +0 -506
  202. package/site-templates/minimalism-site/TEMPLATE-MANIFEST.md +0 -458
  203. package/site-templates/minimalism-site/ailk-template.json +0 -23
  204. package/site-templates/minimalism-site/content/en/AboutPage/about.mdx +0 -110
  205. package/site-templates/minimalism-site/content/en/BookCall/book-call.mdx +0 -52
  206. package/site-templates/minimalism-site/content/en/ContactPage/contact.mdx +0 -34
  207. package/site-templates/minimalism-site/content/en/FAQPage/faq.mdx +0 -57
  208. package/site-templates/minimalism-site/content/en/LandingPage/referral.mdx +0 -77
  209. package/site-templates/minimalism-site/content/en/LandingPage/reports.mdx +0 -73
  210. package/site-templates/minimalism-site/content/en/PurchasePolicyPage/purchase-policy.mdx +0 -123
  211. package/site-templates/minimalism-site/content/en/ReportPage/annual-letter-2024.mdx +0 -52
  212. package/site-templates/minimalism-site/content/en/ReportPage/field-notes-2023.mdx +0 -52
  213. package/site-templates/minimalism-site/content/en/ReportPage/platform-shift-2025.mdx +0 -52
  214. package/site-templates/minimalism-site/content/en/ReportPage/state-of-the-market-2026.mdx +0 -52
  215. package/site-templates/minimalism-site/content/en/Service/first-engagement.mdx +0 -38
  216. package/site-templates/minimalism-site/content/en/Service/second-engagement.mdx +0 -38
  217. package/site-templates/minimalism-site/content/en/Service/third-engagement.mdx +0 -38
  218. package/site-templates/minimalism-site/content/en/ServicesList/services.mdx +0 -73
  219. package/site-templates/minimalism-site/flows/referral.flow.json +0 -71
  220. package/site-templates/minimalism-site/provenance.json +0 -4
  221. package/templates/.claude/skills/add-page/templates/route.tsx.tmpl +0 -28
  222. package/templates/.claude/skills/setup-deploy/references/env-vars-template.md +0 -175
  223. package/templates/apps/api/.ailk/inbox/2026-09-20T14-57-31.552Z-fallback-1789916251590-037e9005.json +0 -8
  224. package/templates/apps/api/.ailk/inbox/2026-09-20T14-57-33.840Z-fallback-1789916253842-b52659e9.json +0 -12
  225. package/templates/apps/api/.ailk/inbox/2026-09-20T14-57-33.844Z-fallback-1789916253845-6b266f8c.json +0 -12
  226. package/templates/apps/web/app/[locale]/book-a-call/page.tsx +0 -50
  227. package/templates/apps/web/app/[locale]/use-cases/__tests__/page-renderer-migration.test.tsx +0 -72
  228. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-1.svg +0 -0
  229. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-2.svg +0 -0
  230. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-3.svg +0 -0
  231. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-4.svg +0 -0
  232. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-5.svg +0 -0
  233. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/avatar-placeholder-6.svg +0 -0
  234. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/hero-backdrop.svg +0 -0
  235. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/logo-placeholder-1.svg +0 -0
  236. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/logo-placeholder-2.svg +0 -0
  237. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/logo-placeholder-3.svg +0 -0
  238. /package/site-templates/{minimalism-site/assets → designs/minimalism/sample/public}/wordmark-placeholder.svg +0 -0
@@ -0,0 +1,105 @@
1
+ /** One redirect the driver followed: the status and the raw `Location`. */
2
+ export interface RedirectHop {
3
+ status: number;
4
+ location: string | null;
5
+ }
6
+ export interface SweepVerdict {
7
+ ok: boolean;
8
+ reason: string;
9
+ }
10
+ /** A passing page verdict names the own-content marker that matched. */
11
+ export interface PageRenderVerdict extends SweepVerdict {
12
+ marker?: PageMarker;
13
+ }
14
+ export type PageMarker = "h1" | "auth-card" | "sign-in-gate";
15
+ /** More hops than this is a redirect chain, not a render. */
16
+ export declare const MAX_REDIRECTS = 5;
17
+ /**
18
+ * Routes that are correct to answer 404 in every leg, and the licence claim
19
+ * that gates them. No leg's served app holds a signed licence — the driver
20
+ * scrubs `AILK_LICENSE_KEY`, and the mock key is a fixture string, not a JWT —
21
+ * so each entry must answer exactly 404. A 200 means the gate stopped gating.
22
+ */
23
+ export declare const CLAIM_GATED_ROUTES: Readonly<Record<string, string>>;
24
+ /**
25
+ * A route whose live page needs an env var the driver never sets (#6146).
26
+ * While it is unset the route serves its Free placeholder seed instead
27
+ * (#6942): a 200 whose `<h1>` carries the `CONFIG_GATED_PLACEHOLDERS`
28
+ * heading. A 404 is the bug — the site's own nav link dead — and a rendered
29
+ * page without that heading means the gate stopped gating. Unlike
30
+ * `CLAIM_GATED_ROUTES`, a route absent from the route table is not stale: the
31
+ * module that owns it may simply not be installed in this leg.
32
+ */
33
+ export declare const CONFIG_GATED_ROUTES: Readonly<Record<string, string>>;
34
+ /**
35
+ * The placeholder heading each `CONFIG_GATED_ROUTES` entry renders while its
36
+ * env var is unset — for `/meet`, the hero headline of the overlay's
37
+ * `content/en/LandingPage/meet.mdx` seed. A fresh scaffold never edits it.
38
+ */
39
+ export declare const CONFIG_GATED_PLACEHOLDERS: Readonly<Record<string, string>>;
40
+ /** Reachability only — for routes that are not pages (`/og`, `/llms.txt`, …). */
41
+ export declare function assessRouteStatus(input: {
42
+ route: string;
43
+ hops: RedirectHop[];
44
+ status: number | null;
45
+ }): SweepVerdict;
46
+ /**
47
+ * A `CLAIM_GATED_ROUTES` entry: it must be in the route table (a missing one
48
+ * is stale) and answer exactly 404.
49
+ */
50
+ export declare function assessClaimGatedRoute(input: {
51
+ route: string;
52
+ routeTable: string[];
53
+ hops: RedirectHop[];
54
+ status: number | null;
55
+ }): SweepVerdict;
56
+ /**
57
+ * Decide whether a page route rendered, under the real locale, with its own
58
+ * content. The first failed rule is the reason:
59
+ *
60
+ * 1. no self-redirect, and at most `MAX_REDIRECTS` hops;
61
+ * 2. a final 200;
62
+ * 3. an HTML response;
63
+ * 4. `<html lang>` equal to `locale` — a page under a bogus locale fails;
64
+ * 5. no streamed error or not-found digest;
65
+ * 6. an own-content marker — a non-empty `<h1>` (a content page), an
66
+ * `auth-card` testid (an `(auth)` page), or a `sign-in-gate` testid (an
67
+ * `(authed)` page seen anonymously). The layout carries none of them.
68
+ */
69
+ export declare function assessPageRender(input: {
70
+ route: string;
71
+ hops: RedirectHop[];
72
+ status: number | null;
73
+ contentType: string | null;
74
+ html: string;
75
+ locale: string;
76
+ }): PageRenderVerdict;
77
+ /**
78
+ * A `CONFIG_GATED_ROUTES` entry. Unlike `assessClaimGatedRoute`, a route
79
+ * absent from the route table is not stale — the module that owns it may
80
+ * simply not be installed in this leg — so it PASSES, skipped, with no
81
+ * network call needed to decide that (mirroring how `assessClaimGatedRoute`
82
+ * is called with sentinel `hops`/`status` for its own absent case, never
83
+ * fetched). Once the route IS present it is scored as an ordinary page via
84
+ * `assessPageRender`; with its gating env var unset it must ALSO be the
85
+ * placeholder — an `<h1>` carrying its `CONFIG_GATED_PLACEHOLDERS` heading.
86
+ * Every failure with the env var unset names it, pinning the cause.
87
+ */
88
+ export declare function assessConfigGatedRoute(input: {
89
+ route: string;
90
+ envVar: string;
91
+ envSet: boolean;
92
+ routeTable: string[];
93
+ hops: RedirectHop[];
94
+ status: number | null;
95
+ contentType: string | null;
96
+ html: string;
97
+ locale: string;
98
+ }): SweepVerdict;
99
+ /**
100
+ * Every FILE under `dir`, recursing into directories, as sorted slash-joined
101
+ * paths relative to it — so `public/.well-known/security.txt` is listed and
102
+ * the `.well-known` directory never is. Anything that is neither (a symlink,
103
+ * a socket) throws rather than being silently followed or skipped.
104
+ */
105
+ export declare function listPublicFiles(dir: string): string[];
@@ -0,0 +1,236 @@
1
+ /**
2
+ * The verdicts of the scaffold render sweep (#6146).
3
+ *
4
+ * `scripts/verify-scaffold.mjs` serves a built scaffold and fetches every
5
+ * declared route. Until #6146 it served on `-H 127.0.0.1`, which made Next
6
+ * proxy next-intl's locale rewrite as an EXTERNAL one back into the same
7
+ * server, so every locale page answered a 307 to itself — and the driver
8
+ * recorded each as a "known gap" and passed. No request in a leg rendered a
9
+ * page, and a scaffold that 500'd on every page (#6107) stayed green.
10
+ *
11
+ * The rules that decide whether a route really rendered live here, apart from
12
+ * the driver, for the reason `api-boot-assertion.ts` does: proving them must
13
+ * not cost a templates build, an install and a `next build`. Each is a pure
14
+ * function of what the driver observed, so
15
+ * `__tests__/verify-scaffold-render-sweep.test.ts` drives them directly. The
16
+ * driver loads this module from `dist/`. Only `listPublicFiles` touches the
17
+ * filesystem, and none of it touches the network.
18
+ */
19
+ import { readdirSync } from "node:fs";
20
+ import { join } from "node:path";
21
+ /** More hops than this is a redirect chain, not a render. */
22
+ export const MAX_REDIRECTS = 5;
23
+ /**
24
+ * Routes that are correct to answer 404 in every leg, and the licence claim
25
+ * that gates them. No leg's served app holds a signed licence — the driver
26
+ * scrubs `AILK_LICENSE_KEY`, and the mock key is a fixture string, not a JWT —
27
+ * so each entry must answer exactly 404. A 200 means the gate stopped gating.
28
+ */
29
+ export const CLAIM_GATED_ROUTES = {
30
+ "/purchase/success": "commerce",
31
+ "/purchase/cancel": "commerce",
32
+ };
33
+ /**
34
+ * A route whose live page needs an env var the driver never sets (#6146).
35
+ * While it is unset the route serves its Free placeholder seed instead
36
+ * (#6942): a 200 whose `<h1>` carries the `CONFIG_GATED_PLACEHOLDERS`
37
+ * heading. A 404 is the bug — the site's own nav link dead — and a rendered
38
+ * page without that heading means the gate stopped gating. Unlike
39
+ * `CLAIM_GATED_ROUTES`, a route absent from the route table is not stale: the
40
+ * module that owns it may simply not be installed in this leg.
41
+ */
42
+ export const CONFIG_GATED_ROUTES = {
43
+ "/meet": "SCHEDULING_CAL_LINK",
44
+ };
45
+ /**
46
+ * The placeholder heading each `CONFIG_GATED_ROUTES` entry renders while its
47
+ * env var is unset — for `/meet`, the hero headline of the overlay's
48
+ * `content/en/LandingPage/meet.mdx` seed. A fresh scaffold never edits it.
49
+ */
50
+ export const CONFIG_GATED_PLACEHOLDERS = {
51
+ "/meet": "{Book a time with us}",
52
+ };
53
+ const LOOPBACK_BASE = "http://localhost";
54
+ function pathnameOf(location, relativeTo) {
55
+ return new URL(location, new URL(relativeTo, LOOPBACK_BASE)).pathname;
56
+ }
57
+ /**
58
+ * Rules 1 and 2 of every verdict: no self-redirect, at most `MAX_REDIRECTS`
59
+ * hops, and a final 200. A hop is a self-redirect when its `Location`
60
+ * pathname equals the pathname that hop answered — the route itself for the
61
+ * first hop, the previous hop's target after that. Query and host are not
62
+ * compared: the next-intl loop this catches differs from its request in
63
+ * neither.
64
+ */
65
+ function assessReachable(route, hops, status) {
66
+ let answered = route;
67
+ for (const hop of hops) {
68
+ if (hop.location === null)
69
+ break;
70
+ const target = pathnameOf(hop.location, answered);
71
+ if (target === new URL(answered, LOOPBACK_BASE).pathname) {
72
+ return { ok: false, reason: `${answered} -> ${hop.status} self-redirect` };
73
+ }
74
+ answered = target;
75
+ }
76
+ if (hops.length > MAX_REDIRECTS) {
77
+ return { ok: false, reason: `${route} -> redirect chain of more than ${MAX_REDIRECTS} hops` };
78
+ }
79
+ if (status !== 200)
80
+ return { ok: false, reason: `${route} -> status ${status}` };
81
+ return { ok: true, reason: "200" };
82
+ }
83
+ /** Reachability only — for routes that are not pages (`/og`, `/llms.txt`, …). */
84
+ export function assessRouteStatus(input) {
85
+ return assessReachable(input.route, input.hops, input.status);
86
+ }
87
+ /**
88
+ * A `CLAIM_GATED_ROUTES` entry: it must be in the route table (a missing one
89
+ * is stale) and answer exactly 404.
90
+ */
91
+ export function assessClaimGatedRoute(input) {
92
+ const { route, routeTable, hops, status } = input;
93
+ const claim = CLAIM_GATED_ROUTES[route];
94
+ if (!routeTable.some((r) => (r.replace("/[locale]", "") || "/") === route)) {
95
+ return { ok: false, reason: `${route} -> stale CLAIM_GATED_ROUTES entry: not in the route table` };
96
+ }
97
+ if (hops.length > 0 || status !== 404) {
98
+ const first = hops[0];
99
+ const seen = first ? `${first.status} redirect` : `status ${status}`;
100
+ const why = status === 200 ? "gate open in a keyless serve" : `expected 404, got ${seen}`;
101
+ return { ok: false, reason: `${route} -> ${why} (claim-gated: ${claim})` };
102
+ }
103
+ return { ok: true, reason: `404 (claim-gated: ${claim})` };
104
+ }
105
+ /** The `lang` of the document's `<html>` element, or null when it has none. */
106
+ function htmlLang(html) {
107
+ return /<html\b[^>]*\slang="([^"]*)"/i.exec(html)?.[1] ?? null;
108
+ }
109
+ /**
110
+ * The first React Server Components error digest in the flight payload, or
111
+ * null. It is serialized inside a script string as `\"digest\":\"<value>\"`.
112
+ * An error or not-found boundary streamed after the shell answers 200 and can
113
+ * carry its own `<h1>`; this entry is the one reliable trace it leaves.
114
+ */
115
+ function flightDigest(html) {
116
+ return /\\"digest\\":\\"([^"\\]*)\\"/.exec(html)?.[1] ?? null;
117
+ }
118
+ /**
119
+ * Whether an `<h1>`'s inner HTML carries a name: text once tags are stripped,
120
+ * or an image with a non-empty `alt` (the Hero's lockup renders the wordmark
121
+ * inside the `<h1>`, and the heading takes its accessible name from it).
122
+ */
123
+ function headingHasName(inner) {
124
+ if (inner.replace(/<[^>]*>/g, "").trim() !== "")
125
+ return true;
126
+ return [...inner.matchAll(/<img\b[^>]*\salt="([^"]*)"/gi)].some((m) => (m[1] ?? "").trim() !== "");
127
+ }
128
+ /** The first own-content marker the page carries, in the order checked. */
129
+ function ownContentMarker(html) {
130
+ for (const m of html.matchAll(/<h1\b[^>]*>([\s\S]*?)<\/h1>/gi)) {
131
+ if (headingHasName(m[1] ?? ""))
132
+ return "h1";
133
+ }
134
+ if (html.includes('data-testid="auth-card"'))
135
+ return "auth-card";
136
+ if (html.includes('data-testid="sign-in-gate'))
137
+ return "sign-in-gate";
138
+ return null;
139
+ }
140
+ /**
141
+ * Decide whether a page route rendered, under the real locale, with its own
142
+ * content. The first failed rule is the reason:
143
+ *
144
+ * 1. no self-redirect, and at most `MAX_REDIRECTS` hops;
145
+ * 2. a final 200;
146
+ * 3. an HTML response;
147
+ * 4. `<html lang>` equal to `locale` — a page under a bogus locale fails;
148
+ * 5. no streamed error or not-found digest;
149
+ * 6. an own-content marker — a non-empty `<h1>` (a content page), an
150
+ * `auth-card` testid (an `(auth)` page), or a `sign-in-gate` testid (an
151
+ * `(authed)` page seen anonymously). The layout carries none of them.
152
+ */
153
+ export function assessPageRender(input) {
154
+ const { route, hops, status, contentType, html, locale } = input;
155
+ const reachable = assessReachable(route, hops, status);
156
+ if (!reachable.ok)
157
+ return reachable;
158
+ if (!(contentType ?? "").startsWith("text/html")) {
159
+ return { ok: false, reason: `${route} -> not html (${contentType})` };
160
+ }
161
+ const lang = htmlLang(html);
162
+ if (lang !== locale)
163
+ return { ok: false, reason: `${route} -> rendered under locale "${lang}"` };
164
+ const digest = flightDigest(html);
165
+ if (digest !== null) {
166
+ const why = digest.startsWith("NEXT_HTTP_ERROR_FALLBACK;404")
167
+ ? "streamed not-found"
168
+ : `streamed error (digest ${digest})`;
169
+ return { ok: false, reason: `${route} -> ${why}` };
170
+ }
171
+ const marker = ownContentMarker(html);
172
+ if (marker === null) {
173
+ return { ok: false, reason: `${route} -> no own content (no <h1>, auth-card or sign-in-gate)` };
174
+ }
175
+ return { ok: true, reason: marker, marker };
176
+ }
177
+ /**
178
+ * A `CONFIG_GATED_ROUTES` entry. Unlike `assessClaimGatedRoute`, a route
179
+ * absent from the route table is not stale — the module that owns it may
180
+ * simply not be installed in this leg — so it PASSES, skipped, with no
181
+ * network call needed to decide that (mirroring how `assessClaimGatedRoute`
182
+ * is called with sentinel `hops`/`status` for its own absent case, never
183
+ * fetched). Once the route IS present it is scored as an ordinary page via
184
+ * `assessPageRender`; with its gating env var unset it must ALSO be the
185
+ * placeholder — an `<h1>` carrying its `CONFIG_GATED_PLACEHOLDERS` heading.
186
+ * Every failure with the env var unset names it, pinning the cause.
187
+ */
188
+ export function assessConfigGatedRoute(input) {
189
+ const { route, envVar, envSet, routeTable, hops, status, contentType, html, locale } = input;
190
+ if (!routeTable.some((r) => (r.replace("/[locale]", "") || "/") === route)) {
191
+ return { ok: true, reason: `${route} -> skipped: not in the route table (module not installed)` };
192
+ }
193
+ const rendered = assessPageRender({ route, hops, status, contentType, html, locale });
194
+ if (envSet)
195
+ return rendered;
196
+ if (!rendered.ok)
197
+ return { ok: false, reason: `${rendered.reason} (${envVar} unset)` };
198
+ const placeholder = CONFIG_GATED_PLACEHOLDERS[route];
199
+ if (placeholder === undefined) {
200
+ return { ok: false, reason: `${route} -> no CONFIG_GATED_PLACEHOLDERS entry to check with ${envVar} unset` };
201
+ }
202
+ if (!headingTexts(html).some((text) => text.includes(placeholder))) {
203
+ return {
204
+ ok: false,
205
+ reason: `${route} -> expected the "${placeholder}" placeholder with ${envVar} unset, rendered another page`,
206
+ };
207
+ }
208
+ return { ok: true, reason: `placeholder (${envVar} unset)` };
209
+ }
210
+ /** The text of every `<h1>` in the document, tags stripped. */
211
+ function headingTexts(html) {
212
+ return [...html.matchAll(/<h1\b[^>]*>([\s\S]*?)<\/h1>/gi)].map((m) => (m[1] ?? "").replace(/<[^>]*>/g, ""));
213
+ }
214
+ /**
215
+ * Every FILE under `dir`, recursing into directories, as sorted slash-joined
216
+ * paths relative to it — so `public/.well-known/security.txt` is listed and
217
+ * the `.well-known` directory never is. Anything that is neither (a symlink,
218
+ * a socket) throws rather than being silently followed or skipped.
219
+ */
220
+ export function listPublicFiles(dir) {
221
+ return listFilesUnder(dir, "");
222
+ }
223
+ function listFilesUnder(dir, relPrefix) {
224
+ const out = [];
225
+ const entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) => (a.name < b.name ? -1 : 1));
226
+ for (const entry of entries) {
227
+ const rel = relPrefix ? `${relPrefix}/${entry.name}` : entry.name;
228
+ if (entry.isDirectory())
229
+ out.push(...listFilesUnder(join(dir, entry.name), rel));
230
+ else if (entry.isFile())
231
+ out.push(rel);
232
+ else
233
+ throw new Error(`public/${rel} is neither a file nor a directory`);
234
+ }
235
+ return out;
236
+ }
@@ -73,15 +73,19 @@ export interface PageRosterRow {
73
73
  /**
74
74
  * The architecture fragment one module contributes.
75
75
  *
76
- * `apps/web` (the presentation shell) is BASE — always present — so a module
77
- * extends it via `webImports` (packages added to `apps/web.may_import_from`)
78
- * rather than redeclaring it. Additional apps (api, mcp), packages, namespaces,
79
- * and top-level forbidden patterns are contributed outright.
76
+ * `apps/web`, `apps/api` and `apps/mcp` are BASE — always present. A module
77
+ * extends apps/web via `webImports` (added to `apps/web.may_import_from`)
78
+ * rather than redeclaring it; an `apps` entry replaces a base api/mcp block or
79
+ * adds an app (admin). Packages, namespaces and top-level forbidden patterns
80
+ * are contributed outright. `webImports`, `packages` and every `packages/*`
81
+ * entry describe this monorepo's boundaries: a scaffold has no `packages/`
82
+ * tree, so `deriveArchitecture` keeps only the entries naming a path the
83
+ * scaffold carries (#6940).
80
84
  */
81
85
  export interface ModuleSlice {
82
86
  /** Packages this module adds to apps/web.may_import_from (its presentation surface). */
83
87
  webImports?: string[];
84
- /** Additional apps this module introduces (api, mcp). web is BASE, never here. */
88
+ /** Apps this module declares (api, mcp replace the base block; admin is new). web is BASE, never here. */
85
89
  apps?: Record<string, ArchApp>;
86
90
  /** Packages this module contributes. */
87
91
  packages?: Record<string, ArchPackage>;
@@ -308,33 +312,32 @@ export interface AddTransformOp {
308
312
  value: string;
309
313
  }
310
314
  /**
311
- * The module-independent base: `apps/web` (the Next.js presentation shell every
312
- * AILK site has) plus the standalone forbidden-pattern floor. `may_import_from`
313
- * starts EMPTY — the selected modules fill it via `webImports`.
315
+ * The module-independent base: the three apps every scaffold ships on disk
316
+ * (`apps/web`, `apps/api`, `apps/mcp` — template-overlay/apps carries all
317
+ * three whatever the module set, #6940) plus the standalone forbidden-pattern
318
+ * floor. apps/web's `may_import_from` starts EMPTY — the selected modules fill
319
+ * it via `webImports`; a module that declares `api`/`mcp` replaces the base
320
+ * block with its own.
314
321
  */
315
322
  export declare const ARCHITECTURE_BASE: {
316
323
  readonly version: 1;
317
324
  readonly composition_model: {
318
- readonly reference: "claude-setup rules/need-to-know.md § Vocabulary (Module / Surface)";
319
325
  readonly tiers: {
320
326
  readonly data: "database/ — Prisma schema + migrations";
321
327
  readonly api: "apps/api (public HTTP API) + apps/mcp (agent tools)";
322
328
  readonly presentation: "apps/web — frontend surfaces";
323
329
  };
324
330
  };
331
+ /** Every declared app's own forbidden patterns (merged ahead of any the app adds). */
332
+ readonly appForbiddenPatterns: ForbiddenPattern[];
325
333
  /** The base apps/web shell. may_import_from is filled from the selected modules' webImports. */
326
334
  readonly web: {
327
335
  readonly path: "apps/web";
328
336
  readonly description: "Next.js — presentation tier. Frontend surfaces composed from the selected modules.";
329
337
  readonly may_not_import_from: readonly ["apps/api", "apps/mcp"];
330
- readonly forbidden_patterns: readonly [{
331
- readonly pattern: string;
332
- readonly reason: "A scaffolded AILK site is standalone — no upstream-monorepo imports";
333
- }, {
334
- readonly pattern: "@alkit/";
335
- readonly reason: "Renamed to @working-theory/* on extraction";
336
- }];
337
338
  };
339
+ /** The base apps/api and apps/mcp — present in every scaffold (#6940). */
340
+ readonly apps: Record<string, ArchApp>;
338
341
  /** Standalone-site forbidden-pattern floor (top-level, always present). */
339
342
  readonly forbiddenPatterns: ForbiddenPattern[];
340
343
  };
@@ -83,35 +83,59 @@ const PUBLIC_SCHEDULING_VAR_PATTERN = [
83
83
  */
84
84
  const STRIPE_LIVE_KEY_PATTERN = ["(sk|pk|rk)_li", "ve_[A-Za-z0-9]"].join("");
85
85
  /**
86
- * The module-independent base: `apps/web` (the Next.js presentation shell every
87
- * AILK site has) plus the standalone forbidden-pattern floor. `may_import_from`
88
- * starts EMPTY — the selected modules fill it via `webImports`.
86
+ * The per-app forbidden-pattern floor every declared app carries — so each app
87
+ * a scaffold ships has its own rule in `architecture.yaml`, not only the
88
+ * top-level floor below.
89
+ */
90
+ const APP_FORBIDDEN_FLOOR = [
91
+ {
92
+ pattern: NO_UPSTREAM_IMPORT_PATTERN,
93
+ reason: "A scaffolded AILK site is standalone — no upstream-monorepo imports",
94
+ },
95
+ {
96
+ pattern: "@alkit/",
97
+ reason: "Renamed to @working-theory/* on extraction",
98
+ },
99
+ ];
100
+ /**
101
+ * The module-independent base: the three apps every scaffold ships on disk
102
+ * (`apps/web`, `apps/api`, `apps/mcp` — template-overlay/apps carries all
103
+ * three whatever the module set, #6940) plus the standalone forbidden-pattern
104
+ * floor. apps/web's `may_import_from` starts EMPTY — the selected modules fill
105
+ * it via `webImports`; a module that declares `api`/`mcp` replaces the base
106
+ * block with its own.
89
107
  */
90
108
  export const ARCHITECTURE_BASE = {
91
109
  version: 1,
92
110
  composition_model: {
93
- reference: "claude-setup rules/need-to-know.md § Vocabulary (Module / Surface)",
94
111
  tiers: {
95
112
  data: "database/ — Prisma schema + migrations",
96
113
  api: "apps/api (public HTTP API) + apps/mcp (agent tools)",
97
114
  presentation: "apps/web — frontend surfaces",
98
115
  },
99
116
  },
117
+ /** Every declared app's own forbidden patterns (merged ahead of any the app adds). */
118
+ appForbiddenPatterns: APP_FORBIDDEN_FLOOR,
100
119
  /** The base apps/web shell. may_import_from is filled from the selected modules' webImports. */
101
120
  web: {
102
121
  path: "apps/web",
103
122
  description: "Next.js — presentation tier. Frontend surfaces composed from the selected modules.",
104
123
  may_not_import_from: ["apps/api", "apps/mcp"],
105
- forbidden_patterns: [
106
- {
107
- pattern: NO_UPSTREAM_IMPORT_PATTERN,
108
- reason: "A scaffolded AILK site is standalone — no upstream-monorepo imports",
109
- },
110
- {
111
- pattern: "@alkit/",
112
- reason: "Renamed to @working-theory/* on extraction",
113
- },
114
- ],
124
+ },
125
+ /** The base apps/api and apps/mcp — present in every scaffold (#6940). */
126
+ apps: {
127
+ api: {
128
+ path: "apps/api",
129
+ description: "Public HTTP API — routes + services (Fastify).",
130
+ may_import_from: ["database"],
131
+ may_not_import_from: ["apps/mcp", "apps/web"],
132
+ },
133
+ mcp: {
134
+ path: "apps/mcp",
135
+ description: "MCP server — agent-facing tools. Calls apps/api for writes.",
136
+ may_import_from: ["database"],
137
+ may_not_import_from: ["apps/api", "apps/web"],
138
+ },
115
139
  },
116
140
  /** Standalone-site forbidden-pattern floor (top-level, always present). */
117
141
  forbiddenPatterns: [
@@ -595,12 +619,12 @@ export const MODULE_SLICES = {
595
619
  {
596
620
  pattern: "import.*['\"]stripe['\"]",
597
621
  paths_excluded: ["packages/stripe-client/**"],
598
- reason: "Stripe SDK imports go through packages/stripe-client only — single point of config",
622
+ reason: "Stripe SDK imports go through @working-theory/stripe-client only — single point of config",
599
623
  },
600
624
  {
601
625
  pattern: "import.*['\"]resend['\"]|['\"]nodemailer['\"]",
602
626
  paths_excluded: ["packages/email/**"],
603
- reason: "Email provider SDKs go through packages/email — provider swap is a one-package change",
627
+ reason: "Email provider SDKs go through @working-theory/email — provider swap is a one-package change",
604
628
  },
605
629
  ],
606
630
  // ownedFiles (S1, #5088). Verified against the current filesystem and
@@ -1413,6 +1437,9 @@ export const MODULE_SLICES = {
1413
1437
  // upgrade-path fixture to protect either — it is net-new here, so nothing
1414
1438
  // in `templates/` can regress by its absence.
1415
1439
  "apps/web/app/[locale]/reports/[slug]/page.tsx",
1440
+ // spec 6892 D2 — the /reports hub, alongside its reader above: also a
1441
+ // URL segment MODULE_SURFACES["signal-collectors"] does not gate.
1442
+ "apps/web/app/[locale]/reports/page.tsx",
1416
1443
  //
1417
1444
  // The two sections that route composes — `report-header` and
1418
1445
  // `reports-list` — are deliberately NOT owned here. They are
@@ -1446,11 +1473,13 @@ export const MODULE_SLICES = {
1446
1473
  // #5562 — the report reader. Unlike the three rows above, this row's
1447
1474
  // code IS this module's own `ownedFiles` (see the note beside it), so
1448
1475
  // the contribution and the delivery shape carrying it agree here. Its
1449
- // seeds are a directory a template supplies (minimalism-site's four
1450
- // reports), so the row declares that directory (#6646).
1476
+ // seeds are SELF-SEEDING (spec 6892 D3): this module's own `installMap`
1477
+ // lands the four `ReportPage` samples below, so every template taking
1478
+ // the module gets them — `moduleRosterRows` derives the code-route form
1479
+ // for this row rather than requiring a template to ship one (D9).
1451
1480
  { route: "/reports/[slug]", contentDir: "content/en/ReportPage" },
1452
1481
  ],
1453
- // installMap (#5618 D6.3) — the module's ten sample files, moved here out
1482
+ // installMap (#5618 D6.3) — the module's sample files, moved here out
1454
1483
  // of `site-templates/marketing-site/` so the module OWNS its samples
1455
1484
  // (Rule B) and a keyed `--modules signal-collectors` scaffold with no
1456
1485
  // template lands them. Their in-repo home is
@@ -1463,12 +1492,19 @@ export const MODULE_SLICES = {
1463
1492
  // `module-templates/` the two never meet.
1464
1493
  //
1465
1494
  // Four entries are real renames (the flow and waitlist seeds the API
1466
- // reads, and the report PDF under apps/web/public/); the six MDX entries
1495
+ // reads, and the report PDF under apps/web/public/); the ten MDX entries
1467
1496
  // are self-addressed. Their `/projects`, `/projects/[slug]` and
1468
1497
  // `/thanks/[slug]` rows are declared by the templates that install them
1469
1498
  // (`template-manifest.ts`'s signal-collectors sample rows, #6646), not
1470
1499
  // here — a module contribution would change the enabled-surface set and
1471
- // so the Pro scaffold's file set (spec 5618 § 7 finding 7).
1500
+ // so the Pro scaffold's file set (spec 5618 § 7 finding 7). The four
1501
+ // `ReportPage` seeds and the `ReportsList` hub seed are the one exception
1502
+ // (spec 6892 D3): their `/reports/[slug]` and `/reports` rows ARE this
1503
+ // module's own `pageContributions`/`starter-grid.ts` rows respectively,
1504
+ // so this module installs its own seeds for them directly, unlike the
1505
+ // sample rows above. `/referral`'s seed and flow move here the same way,
1506
+ // moved out of a retired template tree (spec 6892 D3), which owned no
1507
+ // code of its own for either route.
1472
1508
  // `generate-sample-report.py` keeps its root-level destination
1473
1509
  // (finding 1 — AC7 forbids changing the Pro file set).
1474
1510
  installMap: {
@@ -1478,7 +1514,14 @@ export const MODULE_SLICES = {
1478
1514
  "packages/create-ailk/module-templates/signal-collectors/content/en/ThankYouPage/contact.mdx": "content/en/ThankYouPage/contact.mdx",
1479
1515
  "packages/create-ailk/module-templates/signal-collectors/content/en/ThankYouPage/newsletter.mdx": "content/en/ThankYouPage/newsletter.mdx",
1480
1516
  "packages/create-ailk/module-templates/signal-collectors/content/en/ThankYouPage/apply.mdx": "content/en/ThankYouPage/apply.mdx",
1517
+ "packages/create-ailk/module-templates/signal-collectors/content/en/ReportPage/annual-letter-2024.mdx": "content/en/ReportPage/annual-letter-2024.mdx",
1518
+ "packages/create-ailk/module-templates/signal-collectors/content/en/ReportPage/field-notes-2023.mdx": "content/en/ReportPage/field-notes-2023.mdx",
1519
+ "packages/create-ailk/module-templates/signal-collectors/content/en/ReportPage/platform-shift-2025.mdx": "content/en/ReportPage/platform-shift-2025.mdx",
1520
+ "packages/create-ailk/module-templates/signal-collectors/content/en/ReportPage/state-of-the-market-2026.mdx": "content/en/ReportPage/state-of-the-market-2026.mdx",
1521
+ "packages/create-ailk/module-templates/signal-collectors/content/en/ReportsList/reports.mdx": "content/en/ReportsList/reports.mdx",
1522
+ "packages/create-ailk/module-templates/signal-collectors/content/en/LandingPage/referral.mdx": "content/en/LandingPage/referral.mdx",
1481
1523
  "packages/create-ailk/module-templates/signal-collectors/flows/fit-check.flow.json": "database/flows/fit-check.flow.json",
1524
+ "packages/create-ailk/module-templates/signal-collectors/flows/referral.flow.json": "database/flows/referral.flow.json",
1482
1525
  "packages/create-ailk/module-templates/signal-collectors/waitlist/launch-waitlist.experiment.json": "database/waitlist/launch-waitlist.experiment.json",
1483
1526
  "packages/create-ailk/module-templates/signal-collectors/reports/sample-report.pdf": "apps/web/public/reports/sample-report.pdf",
1484
1527
  "packages/create-ailk/module-templates/signal-collectors/reports/generate-sample-report.py": "reports/generate-sample-report.py",
@@ -1618,7 +1661,7 @@ export const MODULE_SLICES = {
1618
1661
  // it sits outside build-templates.mjs's SNAPSHOT_DIRS/overlay, so
1619
1662
  // ownedFiles/paidModuleTemplateExclusions cannot reach it) to
1620
1663
  // `module-templates/commerce/.claude/skills/scaffold-commerce/`, and
1621
- // delivered into a keyed scaffold by `installMap` instead. Ten literal
1664
+ // delivered into a keyed scaffold by `installMap` instead. Eleven literal
1622
1665
  // entries, not one directory entry: `extractModuleBundle`'s
1623
1666
  // `validateInstallMap` requires every source to be a FILE the bundle
1624
1667
  // produced (`extract-module-bundle.ts`'s `!sourceStat.isFile()` check) —
@@ -1634,10 +1677,11 @@ export const MODULE_SLICES = {
1634
1677
  "packages/create-ailk/module-templates/commerce/.claude/skills/scaffold-commerce/templates/portal-route.template.ts": ".claude/skills/scaffold-commerce/templates/portal-route.template.ts",
1635
1678
  "packages/create-ailk/module-templates/commerce/.claude/skills/scaffold-commerce/templates/stripe-config.template.ts": ".claude/skills/scaffold-commerce/templates/stripe-config.template.ts",
1636
1679
  "packages/create-ailk/module-templates/commerce/.claude/skills/scaffold-commerce/templates/subscription-route.template.ts": ".claude/skills/scaffold-commerce/templates/subscription-route.template.ts",
1680
+ "packages/create-ailk/module-templates/commerce/.claude/skills/scaffold-commerce/scripts/stripe-catalog.ts": ".claude/skills/scaffold-commerce/scripts/stripe-catalog.ts",
1637
1681
  // The commerce-boundary rule (#6039/#6070, this entry #6041): ships to
1638
1682
  // a commerce-keyed scaffold's project root so an agent working there
1639
1683
  // reads the money/live-mode/personal-data classification before it
1640
- // acts. One more literal entry alongside the ten scaffold-commerce
1684
+ // acts. One more literal entry alongside the eleven scaffold-commerce
1641
1685
  // skill entries above, for the same reason — a directory source is
1642
1686
  // rejected by `validateInstallMap`.
1643
1687
  "packages/create-ailk/module-templates/commerce/.claude/rules/commerce-boundary.md": ".claude/rules/commerce-boundary.md",
@@ -39,8 +39,12 @@ export interface CliOptions {
39
39
  template: string | undefined;
40
40
  /** The starter's shape (`--shape`, #6754), normalized. Never set with `template`. */
41
41
  shape?: ShapeName;
42
- /** The starter's design (`--design`, #6754). Never set with `template`. */
43
- design?: DesignName;
42
+ /**
43
+ * The starter's design (`--design`, #6754; widened to a path #6813 D1/D3):
44
+ * a recognized name, lowercased, or an absolute directory holding a
45
+ * `DESIGN.md`, case preserved. Never set with `template`.
46
+ */
47
+ design?: string;
44
48
  /**
45
49
  * True when a scaffold run named neither `--shape` nor `--template` on a
46
50
  * terminal: `resolveCliShape` must ask before anything is scaffolded.
@@ -66,6 +70,12 @@ export interface CliOptions {
66
70
  * `--sync-architecture`: data-only, one file, an already-scaffolded target.
67
71
  */
68
72
  syncCatalog: boolean;
73
+ /**
74
+ * When set, rewrite the template-owned sections of the target's CLAUDE.md
75
+ * to the template this create-ailk ships and exit (#6904). The same sync
76
+ * shape: one file, an already-scaffolded target.
77
+ */
78
+ syncClaudeMd: boolean;
69
79
  /**
70
80
  * When set, a fresh scaffold ALSO gets COMPONENT-CATALOG.md. Off by default
71
81
  * so a scaffold that does not ask for the catalog is byte-identical to the