create-ailk 0.46.6 → 0.48.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 (144) hide show
  1. package/README.md +180 -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 +5 -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 +363 -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 +41 -41
  59. package/dist/site-chrome.js +50 -70
  60. package/dist/site-fonts.d.ts +10 -14
  61. package/dist/site-fonts.js +5 -1
  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 +29 -4
  98. package/templates/apps/api/CLAUDE.md +7 -4
  99. package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
  100. package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
  101. package/templates/apps/api/src/vercel-handler.ts +32 -2
  102. package/templates/apps/mcp/.env.example +8 -0
  103. package/templates/apps/mcp/CLAUDE.md +5 -3
  104. package/templates/apps/web/.env.example +10 -3
  105. package/templates/apps/web/CLAUDE.md +31 -4
  106. package/templates/apps/web/app/[locale]/layout.tsx +141 -77
  107. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
  108. package/templates/apps/web/app/not-found.tsx +11 -11
  109. package/templates/apps/web/auth.ts +48 -35
  110. package/templates/apps/web/jest.config.cjs +5 -0
  111. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
  112. package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
  113. package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
  114. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
  115. package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
  116. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
  117. package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
  118. package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
  119. package/templates/apps/web/lib/deck-page.ts +3 -10
  120. package/templates/apps/web/lib/deploy-fonts.ts +12 -0
  121. package/templates/apps/web/lib/hub-site-config.ts +237 -29
  122. package/templates/apps/web/lib/library-fonts.ts +41 -0
  123. package/templates/apps/web/lib/mcp-oauth.ts +11 -4
  124. package/templates/apps/web/lib/page-chrome.ts +105 -20
  125. package/templates/apps/web/lib/section-look.ts +28 -0
  126. package/templates/apps/web/lib/site-design.ts +205 -0
  127. package/templates/apps/web/lib/site-navigation.ts +208 -0
  128. package/templates/apps/web/lib/site-theme-head.ts +98 -13
  129. package/templates/apps/web/lib/site-theme.ts +40 -62
  130. package/templates/apps/web/messages/en.json +0 -6
  131. package/templates/apps/web/next.config.mjs +213 -11
  132. package/templates/apps/web/package.json +2 -0
  133. package/templates/apps/web/site-pages.config.tsx +4 -2
  134. package/templates/content/_site.mdx +0 -26
  135. package/templates/design.yaml +75 -0
  136. package/templates/project.yaml +14 -0
  137. package/versions.json +52 -51
  138. package/site-templates/marketing-site/DESIGN.md +0 -259
  139. package/site-templates/marketing-site-free/DESIGN.md +0 -259
  140. package/site-templates/saas-product/DESIGN.md +0 -259
  141. package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
  142. package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
  143. package/templates/apps/web/lib/site-chrome.ts +0 -46
  144. package/templates/apps/web/lib/site-fonts.ts +0 -15
@@ -80,7 +80,7 @@ Import: `import { X } from "@working-theory/ui/sections";` (or from the `@workin
80
80
  | `DecisionSplit` | An honest either-option decision block — use on /vs pages before any comparison. | MDX `type: decision-split` |
81
81
  | `Definition` | A single-term definition callout — use for one prominent 'What is X?' answer-first block. | MDX `type: definition` |
82
82
  | `DocumentChassis` | A long-read document page (privacy policy, terms, DPA, working agreement) — chrome-free header + optional stat strip + a sticky numbered section nav beside continuous prose; one document per page/route. The authored `sections` list drives both the nav and the body. | MDX `type: document-chassis` |
83
- | `DocumentViewer` | A paginated document embedded in a page (a report, a client deliverable) — use for a 10-50 page PDF at a closed 16:9 (deck) or letter (portrait) geometry, rendered by a dynamically-imported PDF.js so it never enters the main bundle. `src` accepts a public path or the authenticated `/v1/deliverables/:grantId` route. Not for long-read prose — that is `document-chassis`. | MDX `type: document-viewer` |
83
+ | `DocumentViewer` | A paginated document embedded in a page (a report, a client deliverable) — use for a 10-50 page PDF at a closed 16:9 (deck) or letter (portrait) geometry, rendered by a dynamically-imported PDF.js so it never enters the main bundle. `src` accepts a public path or a deliverable's grant route, `/v1/deliverables/:grantId`; the grant id is the only key to that file, so anyone who has the link can download it — never put a grant route on a page that will be published. | MDX `type: document-viewer` |
84
84
  | `DocumentViewerCanvas` | The PDF.js renderer for DocumentViewer. This file is reached ONLY via the dynamic import in DocumentViewerClient.tsx — that is deliberate: the static `import "pdfjs-dist"` below is what lands in this file's own route-split chunk instead of the main bundle (a static import of the renderer is a spec violation, not a style preference). | internal — compose from `packages/ui/src/sections/DocumentViewerCanvas.tsx` |
85
85
  | `DocumentViewerClient` | The interactive shell for DocumentViewer. Split out of DocumentViewer.tsx (which stays RSC) for the same reason AlertSection composes AlertSectionDismissIsland: interactivity is contained to one client island. *(weak)* | `import { DocumentViewerClient } from "@working-theory/ui/sections"` |
86
86
  | `FAQ` | Question-and-answer pairs — use to pre-empt buyer objections that are naturally phrased as questions. | MDX `type: faq` · `import { FAQ } from "@working-theory/ui/sections"` |
@@ -1,103 +1,61 @@
1
- import { type HomeSeedOutcome } from "./design-home.js";
2
- import { type UnreadChromeKnob } from "./lib/chrome-readers.js";
3
1
  export interface ApplyDesignOptions {
4
- /** The design: a shipped name, or a directory holding a DESIGN.md. */
2
+ /** The design: a shipped name, or a directory holding a design.yaml. */
5
3
  design: string;
6
4
  /** The existing site (absolute or relative). */
7
5
  targetDir: string;
8
6
  /** Package-rooted inputs, supplied by the caller (cli.ts from its PKG_ROOT). */
9
7
  designsDir: string;
10
8
  siteTemplatesDir: string;
11
- /** The overlay's `templates/` (#7743 D7) — where a treeless shape's home lives. Default: `templates` beside `siteTemplatesDir`. */
12
- templatesDir?: string;
13
9
  catalogPath: string;
14
- /** #7781 — apply the design even when a reader file of the site ignores a chrome knob it sets; the pairs are reported instead of refused. */
15
- allowUnreadChrome?: boolean;
10
+ /** `--api-url`; else `AILK_API_URL`. */
11
+ apiUrl?: string | undefined;
12
+ /** `--workspace`; else `AILK_WORKSPACE_ID`. */
13
+ workspaceId?: string | undefined;
16
14
  /** Where a relative design path resolves from. Default process.cwd(). */
17
15
  cwd?: string;
18
- /** Read for AILK_LICENSE_KEY only (D6). Default process.env. */
16
+ /** Read for AILK_LICENSE_KEY and the three hub variables. Default process.env. */
19
17
  env?: NodeJS.ProcessEnv;
20
18
  /** Forwarded to deriveLevel. Tests inject; the CLI leaves them unset. */
21
19
  registryUrl?: string;
20
+ /** Every request — the licence registry's and the hub's. Default `globalThis.fetch`. */
22
21
  fetchImpl?: typeof fetch;
23
22
  }
24
- export type ApplyDesignChange = {
25
- path: string;
26
- kind: "theme";
27
- } | {
28
- path: string;
29
- kind: "layout";
30
- } | {
31
- path: string;
32
- kind: "fonts";
33
- } | {
34
- path: string;
35
- kind: "design";
36
- } | {
37
- path: string;
38
- kind: "preset";
39
- fields: string[];
40
- } | {
41
- path: string;
42
- kind: "home";
43
- action: "seeded" | "restored";
44
- fields: string[];
45
- } | {
46
- path: string;
47
- kind: "contact";
48
- action: "seeded" | "restored";
49
- fields: string[];
50
- } | {
51
- path: string;
52
- kind: "manifest";
53
- };
54
23
  export interface ApplyDesignResult {
55
24
  targetDir: string;
56
25
  design: string;
57
26
  display: string;
58
- /** In write order (D4); [] when nothing changed. */
59
- changes: ApplyDesignChange[];
60
- manifest: "recorded" | "unchanged" | "no-roster" | "legacy-roster";
61
- /** #7743 D7 — what the design did to the home page's sections. */
62
- home: HomeSeedOutcome;
63
- /** #7743 D7 — the design ships a home arc for this site, so a home it leaves alone is reported. */
64
- homeArc?: true;
65
- /** #8661 D11 — what the design did to the contact page's sections and title. */
66
- contact: HomeSeedOutcome;
67
- /** #8661 D11 — the design ships a contact page for this site, so a contact page it leaves alone is reported. */
68
- contactSeed?: true;
69
- /** The site-relative roster file, when there is one. */
70
- rosterPath?: string;
71
- /** #7720 D4.2 — the distinct families written to site-fonts.ts, display first; set only when faces are written. */
72
- fonts?: string[];
73
- /** #7720 D4.2 — faces were written, but the site's layout.tsx does not read lib/site-fonts. */
74
- fontsUnwired?: true;
75
- /** #7781 — chrome knobs the design set that a reader file of the site does not read; present only when non-empty, which only `allowUnreadChrome` lets through. */
76
- unreadChrome?: UnreadChromeKnob[];
27
+ /** The hub design record written: its new version, the library look it names (`null` for a look of its own), and where. */
28
+ record: {
29
+ version: number;
30
+ look: string | null;
31
+ workspaceId: string;
32
+ origin: string;
33
+ };
77
34
  }
78
- /** #7781 — thrown before any write when the design sets a chrome knob that a reader file of the site does not read. */
79
- export declare class UnreadChromeError extends Error {
80
- readonly unread: readonly UnreadChromeKnob[];
81
- constructor(unread: readonly UnreadChromeKnob[]);
35
+ /** A refusal the CLI exits 2 on, thrown before the hub record is written. */
36
+ export declare class ApplyDesignRefusedError extends Error {
37
+ readonly exitCode = 2;
38
+ constructor(message: string);
82
39
  }
83
40
  export interface ApplyDesignArgs {
84
41
  design: string | undefined;
85
42
  target: string | undefined;
86
- allowUnreadChrome: boolean;
43
+ apiUrl: string | undefined;
44
+ workspaceId: string | undefined;
87
45
  help: boolean;
88
46
  }
89
- export declare const APPLY_DESIGN_HELP = "create-ailk apply-design \u2014 make an existing site wear a design.\n\nUsage:\n create-ailk apply-design <name> [--target <site-dir>]\n create-ailk apply-design <path> [--target <site-dir>]\n\nArguments:\n <name|path> A shipped design (standard, minimalism), or a\n directory holding a DESIGN.md. A relative path\n resolves from the current directory.\n\nOptions:\n --target <site-dir> An already-scaffolded repo (contains\n architecture.yaml). Defaults to the current dir.\n --allow-unread-chrome Apply the design even when a file of the site does\n not read a chrome setting the design sets (a site\n scaffolded before the setting existed). Without it\n that is refused; with it each such file is reported.\n --help, -h Print this message.\n\nWrites only the look: DESIGN.md (replaced whole by the design's, keeping the\nsite's Source template and Version lines), the theme: block of\ncontent/_site.mdx, the generated apps/web/lib/site-chrome.ts, the generated\napps/web/lib/site-fonts.ts, the look fields of sections the site's pages\nalready place, and the design/layout/theme record in .ailk-site-manifest.json.\nNever adds, removes or renames a route or page, never touches a content field\n(except a placeholder home's sections, below) or the brand: block, and leaves\nevery other page's structured data unchanged.\n\nA design may seed the placeholder home's sections \u2014 its home arc \u2014 while they\nare still a placeholder: the shape's own, or a design's arc of them. It never\nchanges a home whose sections were edited; it reports it and leaves it. A\nseeded home takes the design's looks; look values on the sections it replaced\nare not kept. A design that ships no arc restores the shape's own sections on\na home that still wears another design's untouched arc.\n\nA design other than standard needs a Pro or Pro Plus key: the site's own\nailk.key (put one there with create-ailk license set <key>), else\nAILK_LICENSE_KEY. A malformed package, a preset the validator refuses or a\nmissing key is refused before any file is written.\n\nA preset sets the look fields it names and never unsets one: a field it does\nnot name keeps whatever value the page has. Running it again changes nothing.\n";
47
+ export declare const APPLY_DESIGN_HELP = "create-ailk apply-design \u2014 make an existing site wear a design.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk apply-design <name|path> [--target <site-dir>]\n [--api-url <origin>] [--workspace <wksp_id>]\n\nArguments:\n <name|path> The name of a look this installer ships (create-ailk\n --help lists them), or a\n directory holding a design.yaml. A relative path\n resolves from the current directory.\n\nOptions:\n --target <site-dir> An already-scaffolded repo (contains\n architecture.yaml). Defaults to the current dir.\n --api-url <origin> The site's API origin. Else AILK_API_URL. https:\n only (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The site's workspace. Else AILK_WORKSPACE_ID.\n --help, -h Print this message.\n\nWrites the design to the site's hub design record \u2014 the one place a site's\nlook comes from \u2014 and changes no file. A library look is recorded by name and\nversion, keeping the starter's own layout settings as its changes; a design\ngiven as a directory is recorded as a look of the workspace's own. The record's\nheader and footer styles and its brand override are kept as they are.\n\nThe agent key is read from AILK_AGENT_KEY only and needs the site-design\ngrant. On a spoke, the workspace and origin must be the ones its apps/web env\nfiles name. A site whose look is still in its files (content/_site.mdx\ntheme:, apps/web/lib/site-chrome.ts, apps/web/lib/site-fonts.ts) is refused\nuntil its look is imported into the hub.\n\nA design other than standard needs a Pro or Pro Plus key: the site's own\nailk.key (put one there with create-ailk license set <key>), else\nAILK_LICENSE_KEY. A malformed package, a preset the validator refuses, a\nmissing key or credential is refused before anything is written. Exit 2 on a\nrefusal of the site or its credentials, 1 on any other failure.\n";
90
48
  /**
91
49
  * Parse the argv AFTER the `apply-design` word (D1). Strict `node:util`
92
50
  * parseArgs, like `parseSyncRoutesArgs`: exactly one positional, the design
93
- * reference, and an optional `--target`.
51
+ * reference, and the optional `--target`, `--api-url` and `--workspace`.
94
52
  */
95
53
  export declare function parseApplyDesignArgs(argv: string[]): ApplyDesignArgs;
96
54
  /**
97
- * Apply a design to an existing site (D2–D7). Refuses before any write
98
- * (C1–C6); otherwise writes only the files whose text changes — page files,
99
- * `site-chrome.ts`, `site-fonts.ts`, `DESIGN.md`, `_site.mdx`, then the manifest last.
55
+ * Apply a design to an existing site (D5): refuse before the write (C1–C5,
56
+ * the credentials, a site still carrying its look files), then read and
57
+ * write the site's hub design record. Writes no file.
100
58
  */
101
59
  export declare function applyDesign(opts: ApplyDesignOptions): Promise<ApplyDesignResult>;
102
- /** The changed-file report (D9). */
60
+ /** The report (D5 step 5): the record written, and where. No line names a file. */
103
61
  export declare function formatApplyDesignReport(result: ApplyDesignResult): string;