create-ailk 0.29.1 → 0.31.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 (101) hide show
  1. package/README.md +71 -3
  2. package/component-catalog.json +524 -8
  3. package/component-catalog.md +8 -5
  4. package/dist/add-route.js +1 -0
  5. package/dist/cli.js +114 -1
  6. package/dist/cutover.d.ts +109 -0
  7. package/dist/cutover.js +494 -0
  8. package/dist/design-presets.js +20 -4
  9. package/dist/export-content.d.ts +55 -0
  10. package/dist/export-content.js +303 -0
  11. package/dist/inventory.d.ts +216 -0
  12. package/dist/inventory.js +833 -0
  13. package/dist/language-import.d.ts +114 -0
  14. package/dist/language-import.js +435 -0
  15. package/dist/lib/env-catalog.js +2 -2
  16. package/dist/lib/import-mdx.d.ts +38 -0
  17. package/dist/lib/import-mdx.js +411 -64
  18. package/dist/lib/render-comparison.d.ts +200 -0
  19. package/dist/lib/render-comparison.js +374 -0
  20. package/dist/lib/scaffold-render-sweep.d.ts +1 -1
  21. package/dist/lib/scaffold-render-sweep.js +1 -1
  22. package/dist/migrate-content.d.ts +6 -2
  23. package/dist/migrate-content.js +60 -14
  24. package/dist/module-architecture.js +6 -1
  25. package/dist/provision-env.d.ts +28 -0
  26. package/dist/provision-env.js +210 -0
  27. package/dist/seed-workspace.d.ts +3 -1
  28. package/dist/seed-workspace.js +45 -16
  29. package/dist/surfaces.js +3 -0
  30. package/dist/topology.d.ts +12 -0
  31. package/dist/topology.js +28 -10
  32. package/package.json +3 -3
  33. package/templates/.claude/cloudparity-repo-hooks.json +5 -0
  34. package/templates/.claude/hooks/content-source-guard.sh +75 -0
  35. package/templates/.claude/settings.json +9 -0
  36. package/templates/.env.example +7 -0
  37. package/templates/.github/workflows/ci.yml +2 -0
  38. package/templates/CLAUDE.md +5 -0
  39. package/templates/apps/api/CLAUDE.md +6 -2
  40. package/templates/apps/mcp/.env.example +20 -0
  41. package/templates/apps/mcp/CLAUDE.md +46 -8
  42. package/templates/apps/web/.env.example +4 -2
  43. package/templates/apps/web/CLAUDE.md +39 -5
  44. package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +9 -1
  45. package/templates/apps/web/app/.well-known/mcp.json/build-manifest.ts +58 -0
  46. package/templates/apps/web/app/.well-known/mcp.json/route.ts +16 -0
  47. package/templates/apps/web/app/.well-known/oauth-authorization-server/route.ts +53 -0
  48. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +8 -1
  49. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +56 -0
  50. package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +164 -0
  51. package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +132 -0
  52. package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +51 -0
  53. package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +144 -0
  54. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +153 -4
  55. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +45 -2
  56. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +2 -2
  57. package/templates/apps/web/app/[locale]/contact/__tests__/site-contact-lines.test.ts +49 -0
  58. package/templates/apps/web/app/[locale]/contact/site-contact-lines.ts +6 -4
  59. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +13 -1
  60. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +120 -0
  61. package/templates/apps/web/app/[locale]/events/page.tsx +11 -0
  62. package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +44 -5
  63. package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +306 -0
  64. package/templates/apps/web/app/[locale]/layout.tsx +122 -27
  65. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +21 -2
  66. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +1 -0
  67. package/templates/apps/web/app/api/auth/hub/continuation.ts +8 -3
  68. package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +92 -0
  69. package/templates/apps/web/app/api/auth/mcp/continuation.ts +89 -0
  70. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +59 -0
  71. package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +41 -0
  72. package/templates/apps/web/app/llms.txt/route.ts +26 -9
  73. package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +40 -0
  74. package/templates/apps/web/app/openapi.json/route.ts +4 -0
  75. package/templates/apps/web/app/robots.txt/route.ts +18 -1
  76. package/templates/apps/web/app/sitemap.xml/route.ts +13 -0
  77. package/templates/apps/web/auth.ts +184 -7
  78. package/templates/apps/web/jest.config.cjs +46 -1
  79. package/templates/apps/web/lib/__tests__/auth-routes.test.ts +2 -1
  80. package/templates/apps/web/lib/__tests__/bot-check.test.ts +247 -4
  81. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +92 -0
  82. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +90 -0
  83. package/templates/apps/web/lib/__tests__/relay.test.ts +33 -8
  84. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +196 -0
  85. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +11 -1
  86. package/templates/apps/web/lib/auth-routes.ts +5 -3
  87. package/templates/apps/web/lib/bot-check.ts +113 -13
  88. package/templates/apps/web/lib/in-page-magnet.ts +4 -1
  89. package/templates/apps/web/lib/mcp-oauth.ts +702 -0
  90. package/templates/apps/web/lib/page-chrome.ts +65 -5
  91. package/templates/apps/web/lib/relay.ts +22 -3
  92. package/templates/apps/web/lib/site-identity.ts +75 -24
  93. package/templates/apps/web/messages/en.json +47 -14
  94. package/templates/apps/web/next.config.mjs +15 -1
  95. package/templates/apps/web/package.json +1 -1
  96. package/templates/apps/web/scripts/assert-content-bundled.ts +36 -8
  97. package/templates/apps/web/scripts/content-snapshot.ts +33 -0
  98. package/templates/database/seed.ts +6 -0
  99. package/templates/package.json +2 -1
  100. package/templates/tools/check-content-source.ts +108 -0
  101. package/versions.json +48 -48
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Content-source check — fails when a site whose pages come from the
4
+ * database (`CONTENT_ADAPTER=database`) carries a page file under
5
+ * `content/en/`.
6
+ *
7
+ * On such a site the page that renders comes from the database, so a
8
+ * `content/en/**\/*.mdx` is a second copy the site never reads. The source is
9
+ * `database` when the environment says so, or when any of Next's eight env
10
+ * files under `apps/web/` (`.env`, `.env.local`, `.env.development`,
11
+ * `.env.development.local`, `.env.production`, `.env.production.local`,
12
+ * `.env.test`, `.env.test.local`) assigns it last in that file. The same rule
13
+ * and the same message as `.claude/hooks/content-source-guard.sh`, which
14
+ * refuses the write. A files site (`CONTENT_ADAPTER` unset or `mdx`) passes.
15
+ *
16
+ * Usage:
17
+ * pnpm content-source:check # or: tsx tools/check-content-source.ts
18
+ *
19
+ * Exit codes:
20
+ * 0 — pages come from files, or from the database with no page file
21
+ * 1 — a page file under `content/en/` on a database-sourced site
22
+ */
23
+
24
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
25
+ import { dirname, join, resolve } from "node:path";
26
+
27
+ const ROOT = resolve(dirname(process.argv[1] ?? "."), "..");
28
+
29
+ const ENV_FILES = [
30
+ ".env",
31
+ ".env.local",
32
+ ".env.development",
33
+ ".env.development.local",
34
+ ".env.production",
35
+ ".env.production.local",
36
+ ".env.test",
37
+ ".env.test.local",
38
+ ];
39
+ const ASSIGNMENT = /^[ \t]*(export[ \t]+)?CONTENT_ADAPTER[ \t]*=/;
40
+
41
+ /** The value of the file's last `CONTENT_ADAPTER` assignment, or undefined. */
42
+ function lastAssignment(text: string): string | undefined {
43
+ let last: string | undefined;
44
+ for (const line of text.split("\n")) {
45
+ if (!ASSIGNMENT.test(line)) continue;
46
+ let value = line.slice(line.indexOf("=") + 1);
47
+ let quote = "";
48
+ for (let i = 0; i < value.length; i++) {
49
+ const c = value[i]!;
50
+ if (quote !== "") {
51
+ if (c === quote) quote = "";
52
+ } else if (c === '"' || c === "'") {
53
+ quote = c;
54
+ } else if (c === "#" && i > 0 && /[ \t]/.test(value[i - 1]!)) {
55
+ value = value.slice(0, i);
56
+ break;
57
+ }
58
+ }
59
+ value = value.replace(/^[ \t\r]+/, "").replace(/[ \t\r]+$/, "");
60
+ const first = value[0];
61
+ if (value.length >= 2 && (first === '"' || first === "'") && value.endsWith(first)) {
62
+ value = value.slice(1, -1);
63
+ }
64
+ last = value;
65
+ }
66
+ return last;
67
+ }
68
+
69
+ /** Where `CONTENT_ADAPTER=database` comes from, or undefined on a files site. */
70
+ function databaseSource(): string | undefined {
71
+ if (process.env.CONTENT_ADAPTER === "database") return "the environment";
72
+ for (const name of ENV_FILES) {
73
+ const file = join(ROOT, "apps", "web", name);
74
+ if (statSync(file, { throwIfNoEntry: false })?.isFile() !== true) continue;
75
+ if (lastAssignment(readFileSync(file, "utf8")) === "database") return `apps/web/${name}`;
76
+ }
77
+ return undefined;
78
+ }
79
+
80
+ function pageFiles(dir: string, rel: string): string[] {
81
+ if (!existsSync(dir)) return [];
82
+ return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
83
+ const childRel = `${rel}/${entry.name}`;
84
+ if (entry.isDirectory()) return pageFiles(join(dir, entry.name), childRel);
85
+ return entry.isFile() && entry.name.endsWith(".mdx") ? [childRel] : [];
86
+ });
87
+ }
88
+
89
+ const source = databaseSource();
90
+ if (source === undefined) {
91
+ console.log("content-source: pages come from files (CONTENT_ADAPTER is not database)");
92
+ process.exit(0);
93
+ }
94
+ const pages = pageFiles(join(ROOT, "content", "en"), "content/en").sort();
95
+ if (pages.length === 0) {
96
+ console.log(`content-source: pages come from the database (${source}); no page file under content/en/`);
97
+ process.exit(0);
98
+ }
99
+ for (const page of pages) {
100
+ console.error(
101
+ `content-source: ${page} is a page file, but this site's pages come from the database (CONTENT_ADAPTER=database in ${source}), so the site never reads it.`,
102
+ );
103
+ }
104
+ console.error(
105
+ "Change a page through the site's MCP tools instead: save_draft writes the draft and publish_draft publishes it; read_content returns the current page.",
106
+ );
107
+ console.error("Pages and layout: words live in the database, layout stays in code (CLAUDE.md § Content).");
108
+ process.exit(1);
package/versions.json CHANGED
@@ -1,66 +1,66 @@
1
1
  {
2
- "@working-theory/admin-ui": "0.52.0",
3
- "@working-theory/aeo": "0.52.0",
4
- "@working-theory/agent-context": "0.52.0",
2
+ "@working-theory/admin-ui": "0.54.0",
3
+ "@working-theory/aeo": "0.54.0",
4
+ "@working-theory/agent-context": "0.54.0",
5
5
  "@working-theory/agent-contract": "0.1.0",
6
6
  "@working-theory/agent-memory": "0.0.0",
7
7
  "@working-theory/ai": "0.1.0",
8
- "@working-theory/analytics": "0.52.0",
9
- "@working-theory/api": "0.52.0",
10
- "@working-theory/api-client": "0.52.0",
8
+ "@working-theory/analytics": "0.54.0",
9
+ "@working-theory/api": "0.54.0",
10
+ "@working-theory/api-client": "0.54.0",
11
11
  "@working-theory/cda-filesystem": "0.0.0",
12
- "@working-theory/cli": "0.52.0",
13
- "@working-theory/common": "0.52.0",
12
+ "@working-theory/cli": "0.54.0",
13
+ "@working-theory/common": "0.54.0",
14
14
  "@working-theory/consent": "0.1.0",
15
- "@working-theory/content-adapters": "0.52.0",
16
- "@working-theory/content-projection": "0.52.0",
17
- "@working-theory/email": "0.52.0",
15
+ "@working-theory/content-adapters": "0.54.0",
16
+ "@working-theory/content-projection": "0.54.0",
17
+ "@working-theory/email": "0.54.0",
18
18
  "@working-theory/env": "0.0.0",
19
- "@working-theory/eslint-config": "0.52.0",
20
- "@working-theory/fumadocs-schema": "0.52.0",
21
- "@working-theory/ids": "0.17.0",
22
- "@working-theory/jsonld": "0.52.0",
23
- "@working-theory/license": "0.52.0",
24
- "@working-theory/mcp-server": "0.52.0",
25
- "@working-theory/metadata": "0.52.0",
26
- "@working-theory/observability": "0.52.0",
27
- "@working-theory/page-renderer": "0.52.0",
19
+ "@working-theory/eslint-config": "0.54.0",
20
+ "@working-theory/fumadocs-schema": "0.54.0",
21
+ "@working-theory/ids": "0.19.0",
22
+ "@working-theory/jsonld": "0.54.0",
23
+ "@working-theory/license": "0.54.0",
24
+ "@working-theory/mcp-server": "0.54.0",
25
+ "@working-theory/metadata": "0.54.0",
26
+ "@working-theory/observability": "0.54.0",
27
+ "@working-theory/page-renderer": "0.54.0",
28
28
  "@working-theory/plugin-mcp": "0.1.3",
29
- "@working-theory/schema": "0.52.0",
30
- "@working-theory/schema-pack-registry": "0.52.0",
31
- "@working-theory/schema-validator": "0.52.0",
32
- "@working-theory/sections-registry": "0.52.0",
33
- "@working-theory/site-config": "0.52.0",
34
- "@working-theory/spoke-checkout": "0.7.8",
35
- "@working-theory/stripe-client": "0.52.0",
36
- "@working-theory/templates": "0.52.0",
37
- "@working-theory/theme": "0.52.0",
38
- "@working-theory/ui": "0.52.0",
39
- "@working-theory/validation": "0.52.0",
40
- "@working-theory/web-i18n": "0.52.0",
41
- "@working-theory/admin": "0.8.1",
42
- "@working-theory/api-commerce": "0.1.6",
43
- "@working-theory/api-content-write": "0.3.0",
44
- "@working-theory/api-hub": "0.3.3",
45
- "@working-theory/api-multi-tenant": "0.2.1",
46
- "@working-theory/api-scheduling": "0.4.3",
47
- "@working-theory/api-signal-collectors": "0.2.5",
48
- "@working-theory/api-workspace": "0.3.2",
29
+ "@working-theory/schema": "0.54.0",
30
+ "@working-theory/schema-pack-registry": "0.54.0",
31
+ "@working-theory/schema-validator": "0.54.0",
32
+ "@working-theory/sections-registry": "0.54.0",
33
+ "@working-theory/site-config": "0.54.0",
34
+ "@working-theory/spoke-checkout": "0.7.10",
35
+ "@working-theory/stripe-client": "0.54.0",
36
+ "@working-theory/templates": "0.54.0",
37
+ "@working-theory/theme": "0.54.0",
38
+ "@working-theory/ui": "0.54.0",
39
+ "@working-theory/validation": "0.54.0",
40
+ "@working-theory/web-i18n": "0.54.0",
41
+ "@working-theory/admin": "0.10.0",
42
+ "@working-theory/api-commerce": "0.1.8",
43
+ "@working-theory/api-content-write": "0.5.0",
44
+ "@working-theory/api-hub": "0.4.0",
45
+ "@working-theory/api-multi-tenant": "0.2.3",
46
+ "@working-theory/api-scheduling": "0.4.5",
47
+ "@working-theory/api-signal-collectors": "0.3.1",
48
+ "@working-theory/api-workspace": "0.5.0",
49
49
  "@working-theory/billing-client": "0.0.0",
50
50
  "@working-theory/branding": "0.0.0",
51
51
  "@working-theory/license-client": "0.0.0",
52
52
  "@working-theory/license-manifest": "0.0.0",
53
- "@working-theory/mcp-scheduling": "0.3.5",
54
- "@working-theory/mcp-signal-collectors": "0.2.6",
55
- "@working-theory/mcp-workspace": "0.4.1",
53
+ "@working-theory/mcp-scheduling": "0.3.7",
54
+ "@working-theory/mcp-signal-collectors": "0.2.8",
55
+ "@working-theory/mcp-workspace": "0.6.0",
56
56
  "@working-theory/partner-session": "0.0.0",
57
57
  "@working-theory/preview-protocol": "0.0.0",
58
- "@working-theory/ui-commerce": "0.23.30",
59
- "@working-theory/ui-docs-blog": "0.23.30",
60
- "@working-theory/ui-scheduling": "0.25.4",
61
- "@working-theory/ui-signal-collectors": "0.27.8",
58
+ "@working-theory/ui-commerce": "0.23.32",
59
+ "@working-theory/ui-docs-blog": "0.23.32",
60
+ "@working-theory/ui-scheduling": "0.25.6",
61
+ "@working-theory/ui-signal-collectors": "0.27.10",
62
62
  "@working-theory/web": "0.0.0",
63
63
  "@working-theory/app-api": "1.0.0",
64
64
  "@working-theory/mcp": "0.0.0",
65
- "@working-theory/database": "0.52.0"
65
+ "@working-theory/database": "0.54.0"
66
66
  }