create-ailk 0.18.0 → 0.19.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 (167) hide show
  1. package/LICENSE +6 -5
  2. package/NOTICE +2 -0
  3. package/dist/add-module.js +4 -1
  4. package/dist/category-profile.d.ts +10 -0
  5. package/dist/category-profile.js +21 -0
  6. package/dist/derive-architecture.d.ts +5 -1
  7. package/dist/derive-architecture.js +8 -3
  8. package/dist/lib/license-key-files.d.ts +6 -3
  9. package/dist/lib/license-key-files.js +8 -2
  10. package/dist/lib/scaffold-render-sweep.d.ts +9 -0
  11. package/dist/lib/scaffold-render-sweep.js +24 -3
  12. package/dist/license-set.d.ts +1 -1
  13. package/dist/license-set.js +13 -8
  14. package/dist/module-architecture.js +119 -0
  15. package/dist/programmatic.js +3 -0
  16. package/dist/spoke-checkout.d.ts +11 -3
  17. package/dist/spoke-checkout.js +62 -12
  18. package/dist/starter-grid.d.ts +1 -1
  19. package/dist/surfaces.js +140 -1
  20. package/dist/template-manifest.d.ts +4 -3
  21. package/dist/topology.d.ts +7 -2
  22. package/dist/topology.js +60 -3
  23. package/package.json +5 -4
  24. package/templates/.env.example +3 -3
  25. package/templates/.github/workflows/ci.yml +5 -0
  26. package/templates/apps/api/CLAUDE.md +25 -7
  27. package/templates/apps/api/LICENSE +6 -5
  28. package/templates/apps/api/NOTICE +2 -0
  29. package/templates/apps/api/jest.config.cjs +4 -29
  30. package/templates/apps/api/package.json +1 -0
  31. package/templates/apps/api/src/lib/__mocks__/prisma.ts +9 -0
  32. package/templates/apps/api/src/lib/__tests__/deliverable-asset-store.test.ts +38 -0
  33. package/templates/apps/api/src/lib/deliverable-asset-store.ts +5 -4
  34. package/templates/apps/api/src/lib/stripe.ts +81 -0
  35. package/templates/apps/api/src/middleware/__tests__/auth.hub-session-path.test.ts +266 -39
  36. package/templates/apps/api/src/middleware/auth.ts +206 -46
  37. package/templates/apps/api/src/routes/leads/index.ts +4 -0
  38. package/templates/apps/api/src/server.ts +107 -0
  39. package/templates/apps/api/src/services/__tests__/lead-routing.test.ts +58 -0
  40. package/templates/apps/api/src/services/lead-routing.ts +30 -2
  41. package/templates/apps/api/vercel.json +2 -2
  42. package/templates/apps/mcp/.env.example +10 -0
  43. package/templates/apps/mcp/CLAUDE.md +9 -4
  44. package/templates/apps/mcp/LICENSE +6 -5
  45. package/templates/apps/mcp/NOTICE +2 -0
  46. package/templates/apps/mcp/__tests__/abuse/guard.test.ts +198 -0
  47. package/templates/apps/mcp/__tests__/audit-single-page.test.ts +15 -3
  48. package/templates/apps/mcp/__tests__/boot.test.ts +78 -1
  49. package/templates/apps/mcp/__tests__/http-transport.test.ts +291 -2
  50. package/templates/apps/mcp/__tests__/request_callback.test.ts +69 -7
  51. package/templates/apps/mcp/__tests__/submit_lead.test.ts +69 -8
  52. package/templates/apps/mcp/__tests__/subscribe_newsletter.test.ts +69 -7
  53. package/templates/apps/mcp/jest.config.cjs +3 -44
  54. package/templates/apps/mcp/src/abuse/index.ts +117 -21
  55. package/templates/apps/mcp/src/boot.ts +5 -23
  56. package/templates/apps/mcp/src/http-transport.ts +93 -73
  57. package/templates/apps/mcp/src/index.ts +2 -0
  58. package/templates/apps/mcp/src/request-context.ts +52 -0
  59. package/templates/apps/mcp/src/tools/capture_lead.ts +9 -1
  60. package/templates/apps/mcp/src/tools/request_callback.ts +9 -1
  61. package/templates/apps/mcp/src/tools/subscribe_newsletter.ts +9 -1
  62. package/templates/apps/web/LICENSE +6 -5
  63. package/templates/apps/web/NOTICE +2 -0
  64. package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +3 -3
  65. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +288 -0
  66. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +568 -0
  67. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +272 -42
  68. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +11 -13
  69. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +115 -16
  70. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +305 -0
  71. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +82 -0
  72. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +126 -0
  73. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +163 -72
  74. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +451 -0
  75. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +139 -0
  76. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +20 -390
  77. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +16 -11
  78. package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +1 -1
  79. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +114 -50
  80. package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +24 -45
  81. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +253 -0
  82. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +145 -0
  83. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +100 -0
  84. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +179 -0
  85. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +514 -0
  86. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +288 -0
  87. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +123 -0
  88. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +82 -0
  89. package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +177 -0
  90. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +172 -0
  91. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +147 -0
  92. package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +229 -0
  93. package/templates/apps/web/app/[locale]/(authed)/account/components/schedule-service.tsx +276 -0
  94. package/templates/apps/web/app/[locale]/(authed)/account/components/send-message.tsx +128 -0
  95. package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +27 -0
  96. package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +132 -0
  97. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +131 -0
  98. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +104 -0
  99. package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +73 -0
  100. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +18 -8
  101. package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +4 -6
  102. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +4 -1
  103. package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +219 -0
  104. package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +340 -0
  105. package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +107 -0
  106. package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +57 -0
  107. package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +85 -26
  108. package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +116 -0
  109. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +80 -0
  110. package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +13 -354
  111. package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +108 -0
  112. package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +37 -0
  113. package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +9 -10
  114. package/templates/apps/web/app/[locale]/layout.tsx +23 -4
  115. package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +143 -0
  116. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +62 -10
  117. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +22 -7
  118. package/templates/apps/web/app/api/auth/hub/continuation.ts +73 -0
  119. package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +188 -0
  120. package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +53 -0
  121. package/templates/apps/web/app/robots.txt/route.ts +10 -4
  122. package/templates/apps/web/auth.ts +5 -1
  123. package/templates/apps/web/lib/__tests__/account-config.test.ts +258 -46
  124. package/templates/apps/web/lib/account-config.ts +188 -52
  125. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +143 -0
  126. package/templates/apps/web/lib/hub-session/index.ts +1 -0
  127. package/templates/apps/web/lib/hub-session/reseal.ts +90 -0
  128. package/templates/apps/web/lib/hub-session/seal.ts +13 -9
  129. package/templates/apps/web/lib/topology.generated.ts +24 -0
  130. package/templates/apps/web/messages/en.json +156 -35
  131. package/templates/database/CHANGELOG.md +21 -0
  132. package/templates/database/LICENSE +6 -5
  133. package/templates/database/NOTICE +2 -0
  134. package/templates/database/README.md +1 -1
  135. package/templates/database/__tests__/member-area.db.test.ts +15 -3
  136. package/templates/database/__tests__/member-contract-migration.test.ts +85 -0
  137. package/templates/database/__tests__/member-contract.db.test.ts +413 -0
  138. package/templates/database/__tests__/seed.test.ts +54 -2
  139. package/templates/database/inbox/schema.prisma +90 -15
  140. package/templates/database/migrations/20261012120000_member_contract/migration.sql +192 -0
  141. package/templates/database/migrations/20261013120000_lead_spoke_checkout/migration.sql +20 -0
  142. package/templates/database/package.json +3 -2
  143. package/templates/database/seed.ts +34 -2
  144. package/versions.json +36 -36
  145. package/templates/apps/api/src/__tests__/content-write-production-boot.test.ts +0 -104
  146. package/templates/apps/api/src/__tests__/cors.test.ts +0 -276
  147. package/templates/apps/api/src/__tests__/module-exclusion.test.ts +0 -279
  148. package/templates/apps/api/src/__tests__/openapi-keyless-hub.test.ts +0 -122
  149. package/templates/apps/api/src/__tests__/review-surface-registration.test.ts +0 -167
  150. package/templates/apps/api/src/__tests__/root-modules.test.ts +0 -175
  151. package/templates/apps/api/src/__tests__/schedule-forwarded-rate-limit.test.ts +0 -117
  152. package/templates/apps/api/src/__tests__/server.test.ts +0 -591
  153. package/templates/apps/api/src/__tests__/workspace-module-registration.test.ts +0 -175
  154. package/templates/apps/api/src/openapi/__tests__/surface-drift.test.ts +0 -293
  155. package/templates/apps/api/src/routes/leads/__tests__/index.test.ts +0 -1620
  156. package/templates/apps/api/src/routes/project-listings/__tests__/directory.test.ts +0 -528
  157. package/templates/apps/api/src/routes/workspaces/__tests__/inbox-wire-schemas.test.ts +0 -198
  158. package/templates/apps/api/src/services/__tests__/aeo-score.test.ts +0 -652
  159. package/templates/apps/api/src/services/__tests__/lead-promotion.test.ts +0 -408
  160. package/templates/apps/api/src/services/__tests__/leads-inbox.test.ts +0 -476
  161. package/templates/apps/mcp/__tests__/audit.test.ts +0 -346
  162. package/templates/apps/mcp/__tests__/parity.test.ts +0 -325
  163. package/templates/apps/mcp/__tests__/workspace-surface.test.ts +0 -364
  164. package/templates/apps/web/app/[locale]/(authed)/account/settings/color-mode.tsx +0 -68
  165. package/templates/apps/web/app/[locale]/(authed)/account/settings/deletion-request.tsx +0 -55
  166. package/templates/apps/web/app/[locale]/(authed)/account/settings/name-form.tsx +0 -118
  167. package/templates/database/__tests__/build.test.ts +0 -131
@@ -1,198 +0,0 @@
1
- // oss: false
2
- /**
3
- * @file inbox-wire-schemas.test.ts
4
- *
5
- * The ten inbox routes parse their request with `@working-theory/validation`
6
- * exports (#7672, spec 3591 D10), in a form the API ↔ MCP parity guard binds:
7
- * `bindArgs` over each route file's LIVE text yields exactly the D10 export
8
- * for each of params, query and body, and `argsFromBindings` resolves every
9
- * binding to an argument tree — never `unbound`, never `unrepresentable`.
10
- *
11
- * And the id patterns those exports restate (validation imports nothing, so
12
- * it cannot import `@working-theory/ids`) are the registry's own, so a param
13
- * the route accepted before the move is the param it accepts after it.
14
- */
15
- import { readFileSync } from "node:fs";
16
- import { join } from "node:path";
17
-
18
- import { idRegexSource, UUID_V7_SOURCE } from "@working-theory/ids";
19
- import * as validation from "@working-theory/validation";
20
- import { z } from "zod";
21
-
22
- import {
23
- argsFromBindings,
24
- bindArgs,
25
- type ArgBinding,
26
- } from "../../../../../../tests/parity/api-parity/bind-args";
27
-
28
- const REPO_ROOT = join(__dirname, "..", "..", "..", "..", "..", "..");
29
- const routeText = (file: string) => readFileSync(join(REPO_ROOT, file), "utf8");
30
-
31
- const MESSAGES = "apps/api/src/routes/workspaces/messages.ts";
32
- const SUBMISSIONS = "apps/api/src/routes/workspaces/submissions.ts";
33
- const LISTINGS = "apps/api/src/routes/project-listings";
34
-
35
- const ITEM_PARAMS = "<{ Params: { workspaceId: string; leadId: string } }>(\n";
36
-
37
- type Row = {
38
- route: string;
39
- file: string;
40
- anchor: string;
41
- bindings: ArgBinding[];
42
- };
43
-
44
- /** Spec 3591 D10's table — the ten inbox rows, export by export. */
45
- const ROWS: Row[] = [
46
- {
47
- route: "GET /v1/workspaces/:workspaceId/messages",
48
- file: MESSAGES,
49
- anchor: '"/v1/workspaces/:workspaceId/messages",',
50
- bindings: [
51
- { exportName: "inboxWorkspaceParamsSchema", target: "params" },
52
- { exportName: "inboxMessageListQuerySchema", target: "query" },
53
- ],
54
- },
55
- {
56
- route: "GET /v1/workspaces/:workspaceId/messages/:leadId",
57
- file: MESSAGES,
58
- anchor: `fastify.get${ITEM_PARAMS} "/v1/workspaces/:workspaceId/messages/:leadId",`,
59
- bindings: [{ exportName: "inboxMessageParamsSchema", target: "params" }],
60
- },
61
- {
62
- route: "PATCH /v1/workspaces/:workspaceId/messages/:leadId",
63
- file: MESSAGES,
64
- anchor: `fastify.patch${ITEM_PARAMS} "/v1/workspaces/:workspaceId/messages/:leadId",`,
65
- bindings: [
66
- { exportName: "inboxMessageParamsSchema", target: "params" },
67
- { exportName: "inboxHandledBodySchema", target: "body" },
68
- ],
69
- },
70
- {
71
- route: "POST /v1/workspaces/:workspaceId/messages/:leadId/accept",
72
- file: MESSAGES,
73
- anchor: '"/v1/workspaces/:workspaceId/messages/:leadId/accept",',
74
- bindings: [
75
- { exportName: "inboxMessageParamsSchema", target: "params" },
76
- { exportName: "inboxAcceptBodySchema", target: "body" },
77
- ],
78
- },
79
- {
80
- route: "GET /v1/workspaces/:workspaceId/submissions",
81
- file: SUBMISSIONS,
82
- anchor: '"/v1/workspaces/:workspaceId/submissions",',
83
- bindings: [
84
- { exportName: "inboxWorkspaceParamsSchema", target: "params" },
85
- { exportName: "inboxSubmissionListQuerySchema", target: "query" },
86
- ],
87
- },
88
- {
89
- route: "GET /v1/workspaces/:workspaceId/submissions/:leadId",
90
- file: SUBMISSIONS,
91
- anchor: `fastify.get${ITEM_PARAMS} "/v1/workspaces/:workspaceId/submissions/:leadId",`,
92
- bindings: [{ exportName: "inboxSubmissionParamsSchema", target: "params" }],
93
- },
94
- {
95
- route: "PATCH /v1/workspaces/:workspaceId/submissions/:leadId",
96
- file: SUBMISSIONS,
97
- anchor: `fastify.patch${ITEM_PARAMS} "/v1/workspaces/:workspaceId/submissions/:leadId",`,
98
- bindings: [
99
- { exportName: "inboxSubmissionParamsSchema", target: "params" },
100
- { exportName: "inboxHandledBodySchema", target: "body" },
101
- ],
102
- },
103
- {
104
- route: "GET /v1/project-listings",
105
- file: `${LISTINGS}/list.ts`,
106
- anchor: "export async function listProjectListingsHandler(",
107
- bindings: [
108
- { exportName: "projectListingListQuerySchema", target: "query" },
109
- ],
110
- },
111
- {
112
- route: "GET /v1/project-listings/:id",
113
- file: `${LISTINGS}/get.ts`,
114
- anchor: "export async function getProjectListingHandler(",
115
- bindings: [{ exportName: "projectListingParamsSchema", target: "params" }],
116
- },
117
- {
118
- route: "PATCH /v1/project-listings/:id",
119
- file: `${LISTINGS}/patch.ts`,
120
- anchor: "export async function patchProjectListingHandler(",
121
- bindings: [
122
- { exportName: "projectListingParamsSchema", target: "params" },
123
- { exportName: "projectListingPatchSchema", target: "body" },
124
- ],
125
- },
126
- ];
127
-
128
- describe("the inbox routes parse with @working-theory/validation exports (D10)", () => {
129
- it("covers the ten inbox rows", () => {
130
- expect(ROWS).toHaveLength(10);
131
- });
132
-
133
- it.each(ROWS.map((row) => [row.route, row] as const))(
134
- "%s binds exactly its D10 exports",
135
- (_route, row) => {
136
- const bound = bindArgs(routeText(row.file), row.anchor);
137
- expect(bound).toEqual({ bindings: row.bindings });
138
- },
139
- );
140
-
141
- it.each(ROWS.map((row) => [row.route, row] as const))(
142
- "%s resolves to an argument tree",
143
- (_route, row) => {
144
- const args = argsFromBindings(
145
- bindArgs(routeText(row.file), row.anchor),
146
- validation,
147
- z.toJSONSchema as never,
148
- );
149
- expect(args).not.toHaveProperty("unbound");
150
- expect(args).not.toHaveProperty("unrepresentable");
151
- },
152
- );
153
- });
154
-
155
- describe("the exported id patterns are the registry's", () => {
156
- const pattern = (schema: z.ZodType, key: string): unknown =>
157
- (
158
- z.toJSONSchema(schema) as {
159
- properties: Record<string, { pattern?: string }>;
160
- }
161
- ).properties[key]?.pattern;
162
-
163
- it.each([
164
- [
165
- "workspaceId",
166
- validation.inboxWorkspaceParamsSchema,
167
- idRegexSource("workspace"),
168
- ],
169
- [
170
- "workspaceId",
171
- validation.inboxMessageParamsSchema,
172
- idRegexSource("workspace"),
173
- ],
174
- ["leadId", validation.inboxMessageParamsSchema, idRegexSource("lead")],
175
- [
176
- "workspaceId",
177
- validation.inboxSubmissionParamsSchema,
178
- idRegexSource("workspace"),
179
- ],
180
- ["leadId", validation.inboxSubmissionParamsSchema, idRegexSource("lead")],
181
- [
182
- "id",
183
- validation.projectListingParamsSchema,
184
- idRegexSource("projectListing"),
185
- ],
186
- // `routes/magnets/index.ts`'s magnet id — `flow_` is not a registry entity.
187
- [
188
- "magnetId",
189
- validation.inboxSubmissionListQuerySchema,
190
- `^flow_${UUID_V7_SOURCE}$`,
191
- ],
192
- ] as const)(
193
- "%s pattern equals the @working-theory/ids source",
194
- (key, schema, expected) => {
195
- expect(pattern(schema, key)).toBe(expected);
196
- },
197
- );
198
- });