create-ailk 0.35.1 → 0.36.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 (96) hide show
  1. package/README.md +1 -1
  2. package/component-catalog.json +12 -1
  3. package/component-catalog.md +6 -5
  4. package/dist/lib/env-catalog.js +8 -0
  5. package/dist/surfaces.js +6 -3
  6. package/dist/topology.d.ts +4 -4
  7. package/dist/topology.js +104 -60
  8. package/package.json +3 -3
  9. package/templates/.env.example +21 -0
  10. package/templates/apps/api/.env.example +7 -0
  11. package/templates/apps/api/CLAUDE.md +9 -4
  12. package/templates/apps/mcp/CLAUDE.md +4 -2
  13. package/templates/apps/web/.env.example +16 -0
  14. package/templates/apps/web/CLAUDE.md +46 -5
  15. package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +2 -0
  16. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +52 -1
  17. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +43 -0
  18. package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +108 -1
  19. package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +36 -3
  20. package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +37 -0
  21. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +90 -33
  22. package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +9 -4
  23. package/templates/apps/web/app/[locale]/(authed)/__tests__/gate.test.tsx +79 -348
  24. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +12 -1
  25. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +55 -2
  26. package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +10 -5
  27. package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +1 -1
  28. package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +60 -6
  29. package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +32 -3
  30. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +8 -1
  31. package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +7 -3
  32. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +215 -0
  33. package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +65 -0
  34. package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +47 -0
  35. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +122 -0
  36. package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +214 -0
  37. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +35 -0
  38. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +266 -0
  39. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +116 -0
  40. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +12 -0
  41. package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +154 -0
  42. package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +6 -4
  43. package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -1
  44. package/templates/apps/web/app/[locale]/(authed)/layout.tsx +15 -13
  45. package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +20 -52
  46. package/templates/apps/web/app/[locale]/layout.tsx +24 -75
  47. package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +50 -0
  48. package/templates/apps/web/app/[locale]/purchase/success/page.tsx +48 -7
  49. package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +749 -0
  50. package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +166 -7
  51. package/templates/apps/web/app/api/auth/hub/authorize/route.ts +96 -30
  52. package/templates/apps/web/app/api/auth/hub/continuation.ts +51 -2
  53. package/templates/apps/web/app/api/auth/hub/email/route.ts +111 -0
  54. package/templates/apps/web/app/api/auth/hub/entry-shared.ts +163 -0
  55. package/templates/apps/web/app/api/auth/hub/purchase/route.ts +230 -0
  56. package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +174 -0
  57. package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +60 -0
  58. package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +97 -0
  59. package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +475 -7
  60. package/templates/apps/web/app/api/hub-session/callback/route.ts +13 -47
  61. package/templates/apps/web/app/api/hub-session/email/route.ts +125 -0
  62. package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +49 -0
  63. package/templates/apps/web/app/api/hub-session/one-tap/route.ts +106 -0
  64. package/templates/apps/web/app/api/hub-session/open/route.ts +111 -0
  65. package/templates/apps/web/app/api/hub-session/sign-in/route.ts +23 -40
  66. package/templates/apps/web/app/api/hub-session/sign-out/route.ts +1 -10
  67. package/templates/apps/web/auth.ts +133 -6
  68. package/templates/apps/web/components/sign-out-trigger.tsx +1 -1
  69. package/templates/apps/web/lib/__tests__/auth-email.test.ts +141 -0
  70. package/templates/apps/web/lib/__tests__/auth-phone.test.ts +445 -0
  71. package/templates/apps/web/lib/__tests__/auth-sms.test.ts +140 -0
  72. package/templates/apps/web/lib/__tests__/fixtures/tsconfig.flow.json +18 -0
  73. package/templates/apps/web/lib/__tests__/site-header.test.ts +13 -0
  74. package/templates/apps/web/lib/__tests__/telemetry-scrub.test.ts +19 -1
  75. package/templates/apps/web/lib/auth-email.ts +62 -6
  76. package/templates/apps/web/lib/auth-env.ts +13 -0
  77. package/templates/apps/web/lib/auth-sms.ts +180 -0
  78. package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +28 -0
  79. package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +332 -0
  80. package/templates/apps/web/lib/hub-session/config.ts +7 -1
  81. package/templates/apps/web/lib/hub-session/entry.ts +238 -0
  82. package/templates/apps/web/lib/hub-session/index.ts +1 -4
  83. package/templates/apps/web/lib/hub-session/one-tap.tsx +148 -0
  84. package/templates/apps/web/lib/hub-session/session.ts +120 -2
  85. package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +277 -0
  86. package/templates/apps/web/lib/site-header.ts +14 -1
  87. package/templates/apps/web/lib/telemetry-scrub.ts +11 -0
  88. package/templates/apps/web/lib/topology.generated.ts +39 -0
  89. package/templates/apps/web/messages/en.json +112 -20
  90. package/templates/apps/web/middleware.ts +34 -2
  91. package/templates/apps/web/security-headers.config.ts +21 -0
  92. package/versions.json +47 -47
  93. package/templates/apps/web/app/[locale]/(authed)/sign-in-gate.tsx +0 -162
  94. package/templates/apps/web/components/signed-in-nav.tsx +0 -79
  95. package/templates/apps/web/lib/hub-session/__tests__/sign-in-gate.test.tsx +0 -180
  96. package/templates/apps/web/lib/hub-session/sign-in-gate.tsx +0 -162
package/README.md CHANGED
@@ -298,7 +298,7 @@ outside `apps/web/app/[locale]/` except the local modules those routes import
298
298
 
299
299
  **Scope.** Every core route (`about`, `contact`, `faq`, `thanks/[slug]`,
300
300
  `sign-in`) is always checked, and so is the `(authed)` route GROUP —
301
- `layout.tsx` + `sign-in-gate.tsx`, `account/`, and `waitlist/` — even though
301
+ `layout.tsx`, `account/`, and `waitlist/` — even though
302
302
  it is not itself a `--modules`-gated surface (#5014): a fresh scaffold ships
303
303
  it unconditionally, the same as core, so `sync-routes` checks it
304
304
  unconditionally too. It is reported under its own `authed` identity rather
@@ -33,7 +33,7 @@
33
33
  "importPath": "@working-theory/ui/primitives",
34
34
  "rootBarrel": "@working-theory/ui",
35
35
  "sourceRoot": "packages/ui/src/primitives",
36
- "count": 79
36
+ "count": 80
37
37
  },
38
38
  {
39
39
  "name": "panels",
@@ -2388,6 +2388,17 @@
2388
2388
  "descriptionGrade": "strong",
2389
2389
  "sectionType": null
2390
2390
  },
2391
+ {
2392
+ "name": "ColorSwitch",
2393
+ "tier": "primitives",
2394
+ "sourcePath": "packages/ui/src/primitives/ColorSwitch.tsx",
2395
+ "importPath": "@working-theory/ui/primitives",
2396
+ "exported": true,
2397
+ "description": "A single-axis switch that cycles through N named states (Public · Private · Authenticated), the track colour carrying the state instead of a thumb position; a read-only mode renders it as an inert chip.",
2398
+ "descriptionSource": "doc-comment",
2399
+ "descriptionGrade": "strong",
2400
+ "sectionType": null
2401
+ },
2391
2402
  {
2392
2403
  "name": "Command",
2393
2404
  "tier": "primitives",
@@ -15,13 +15,13 @@ The component inventory of `@working-theory/ui` and the shells of `@working-theo
15
15
  3. Check the Primitives, Panels and Shells tables too — a low-level control, a collapsible layout container, or a route-level frame lives there, not under Sections or Blocks.
16
16
  4. Only then build. If you do build, you are declaring the capability is genuinely absent.
17
17
 
18
- Inventory: **327 component files** across 16 tiers — 60 sections, 110 blocks, 19 chrome, 79 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 12 commerce-blocks, 1 commerce-panels. 324 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
18
+ Inventory: **328 component files** across 16 tiers — 60 sections, 110 blocks, 19 chrome, 80 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 12 commerce-blocks, 1 commerce-panels. 325 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
19
19
 
20
- Description coverage: **323/327** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 243 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
20
+ Description coverage: **324/328** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 244 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
21
21
 
22
- Of those, **290** are *strong* — a capability sentence you could match a requirement against — and **33** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
22
+ Of those, **291** are *strong* — a capability sentence you could match a requirement against — and **33** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
23
23
 
24
- Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives** 64/79 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 12/12 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
24
+ Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives** 65/80 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 12/12 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
25
25
 
26
26
  That grade is **mechanical**. It counts what it can measure — how much a description adds beyond the component's own name, how much of it is spent on wiring, whether the extraction came out damaged — and it cannot tell a fluent paragraph about the wrong subject from a useful one. A person reading these tables will find more rows unusable than the weak count admits. Treat it as a floor on the problem, not a measurement of it, and read the source before concluding a capability is absent.
27
27
 
@@ -275,7 +275,7 @@ Import: `import { X } from "@working-theory/ui/chrome";` (or from the `@working-
275
275
 
276
276
  ---
277
277
 
278
- ## Primitives (79)
278
+ ## Primitives (80)
279
279
 
280
280
  The base control and text vocabulary — Button, Heading, Text, Link, Icon, Input, Dialog, Command, Tooltip, ThemeToggle and the rest. This is the only tier allowed to render raw HTML elements; every tier above it composes these instead. Search here before building any low-level control.
281
281
 
@@ -299,6 +299,7 @@ Import: `import { X } from "@working-theory/ui/primitives";` (or from the `@work
299
299
  | `CitationMarker` | Inline citation/source marker for agent-generated content. Renders a compact numbered or labeled source reference inline with text. Used alongside AI-generated content to surface provenance for individual claims. | `import { CitationMarker } from "@working-theory/ui/primitives"` |
300
300
  | `Code` | Code inline primitive — renders a semantic <code> for code/variable spans inside prose. Inline sibling of Text. | `import { Code } from "@working-theory/ui/primitives"` |
301
301
  | `Collapsible` | Thin re-export of the Radix Collapsible root and content parts, plus the styled CollapsibleTrigger button. | `import { Collapsible } from "@working-theory/ui/primitives"` |
302
+ | `ColorSwitch` | A single-axis switch that cycles through N named states (Public · Private · Authenticated), the track colour carrying the state instead of a thumb position; a read-only mode renders it as an inert chip. | `import { ColorSwitch } from "@working-theory/ui/primitives"` |
302
303
  | `Command` | Keyboard-navigable command palette / search input. Thin wrapper over the `cmdk` library (Command component) with AILK semantic token styling. Provides the full sub-component set: Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator, CommandShortcut. | `import { Command } from "@working-theory/ui/primitives"` |
303
304
  | `ConfidenceIndicator` | Accessible confidence-level badge for AI-generated claims. Bound to the `@working-theory/validation` confidence shape: confidence_level = "low" \| "medium" \| "high" This matches the `overallConfidence` enum in market-landscape-summary and canonical-messaging-summary schemas, and the free-text `confidence_level` on HypothesisClaim. | `import { ConfidenceIndicator } from "@working-theory/ui/primitives"` |
304
305
  | `Container` | _no description in source — read `packages/ui/src/primitives/Container.tsx`_ | `import { Container } from "@working-theory/ui/primitives"` |
@@ -55,6 +55,10 @@ export const ENV_CATALOG = {
55
55
  description: "Seals this spoke's own hub-session cookie (create-ailk writes one; `openssl rand -base64 32` makes another). Never the client secret; rotating it signs every visitor out.",
56
56
  secret: true,
57
57
  },
58
+ AILK_HUB_ONE_TAP: {
59
+ description: 'Set to "on" to offer Google One Tap on a hub sign-in spoke\'s signed-out account page; the hub must set AILK_GOOGLE_ONE_TAP_CLIENT_ID and list this origin with Google. Anything else leaves it off.',
60
+ secret: false,
61
+ },
58
62
  AILK_HUB_SIGN_IN_URL: {
59
63
  description: "The hub's WEB origin where its /sign-in lives (https:, or http: on localhost). Server-only; create-ailk writes it to .env.local.",
60
64
  secret: false,
@@ -79,6 +83,10 @@ export const ENV_CATALOG = {
79
83
  description: "The scope captured leads are stamped with; on a single-tenant install, the default workspace id.",
80
84
  secret: false,
81
85
  },
86
+ AILK_SMS_COUNTRY_CODES: {
87
+ description: 'Comma-separated calling codes a phone-verification code may be texted to (default "1"); the API relay checks the same list.',
88
+ secret: false,
89
+ },
82
90
  AILK_SPOKE_KEY: {
83
91
  description: "The hub-issued key this site sends as x-ailk-spoke-key; the checkout fulfilment refuses to run without it. Never committed.",
84
92
  secret: true,
package/dist/surfaces.js CHANGED
@@ -752,9 +752,9 @@ export const ROUTE_SINCE = {
752
752
  // #8661 D10 — the working-agreement page. Genuinely new, so it attaches at
753
753
  // the fixed group's next release line, the same rule #7430 applied.
754
754
  "working-agreement": "0.42.0",
755
- // #5014 — the (authed) route GROUP: layout.tsx + sign-in-gate.tsx sit
756
- // directly under "(authed)" (a Next.js route group — its parens are not a
757
- // URL segment); account/ and waitlist/ are its two syncable sub-trees.
755
+ // #5014 — the (authed) route GROUP: layout.tsx sits directly under
756
+ // "(authed)" (a Next.js route group — its parens are not a URL segment);
757
+ // account/ and waitlist/ are its two syncable sub-trees.
758
758
  // None of these are attributable to a historical release the way the
759
759
  // "0.0.0 = predates the manifest" entries above are, but they are also not
760
760
  // genuinely new at HEAD — this run resolves them to the CURRENT fixed-group
@@ -802,6 +802,9 @@ export const ROUTE_SINCE = {
802
802
  // #9966 D2 — the hub's consent page. Genuinely new, so it attaches at the
803
803
  // fixed group's next release line.
804
804
  "(authed)/account/connect": "0.50.0",
805
+ // #11106 D5 — the invitation accept page. Genuinely new, so it attaches at
806
+ // the fixed group's next release line.
807
+ "(authed)/account/invitations/[invitationId]": "0.60.0",
805
808
  // #10051 D9 — the templates route family. Genuinely new, so it attaches at
806
809
  // the fixed group's next release line.
807
810
  templates: "0.50.0",
@@ -32,8 +32,8 @@ export declare const SPOKE_EXCLUDED_MODULE_PATHS: readonly string[];
32
32
  * The `(authed)` seeds of the sign-in-through-the-hub mode (#7894 D9): the
33
33
  * whole `(authed)` group goes in the default mode; in the hub mode its account
34
34
  * area, layout and gate seam stay, and only these go — the operator surfaces,
35
- * the Better Auth gate, the hub's own consent page (#9966 D2, a 404 on a
36
- * spoke) and the suites that mock `auth.ts` by path.
35
+ * the hub's own consent page (#9966 D2, a 404 on a spoke) and the suites that
36
+ * mock `auth.ts` by path.
37
37
  */
38
38
  export declare const HUB_MODE_AUTHED_SEEDS: readonly string[];
39
39
  /** The generated seam files (D5; #7874 D12). A seam is rewritten, never removed. */
@@ -145,8 +145,8 @@ export declare function renderWebSeam(topology: Topology, signIn?: SignInMode, o
145
145
  }): string;
146
146
  /**
147
147
  * `apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx` (#7894 D8).
148
- * The hub render is the `(authed)` layout's no-session branch, moved; the
149
- * `signIn: "hub"` render imports only the hub-session gate. A default-mode
148
+ * The hub render redirects to `/sign-in` (#11095 D3); the `signIn: "hub"`
149
+ * render is the spoke's own sign-in form, `SpokeSignIn` (#11096 D1). A default-mode
150
150
  * spoke carries no `(authed)` group, so it has no render.
151
151
  * @throws TopologyError for a spoke in the default mode.
152
152
  */
package/dist/topology.js CHANGED
@@ -90,8 +90,8 @@ export const SPOKE_EXCLUDED_MODULE_PATHS = [
90
90
  * The `(authed)` seeds of the sign-in-through-the-hub mode (#7894 D9): the
91
91
  * whole `(authed)` group goes in the default mode; in the hub mode its account
92
92
  * area, layout and gate seam stay, and only these go — the operator surfaces,
93
- * the Better Auth gate, the hub's own consent page (#9966 D2, a 404 on a
94
- * spoke) and the suites that mock `auth.ts` by path.
93
+ * the hub's own consent page (#9966 D2, a 404 on a spoke) and the suites that
94
+ * mock `auth.ts` by path.
95
95
  */
96
96
  export const HUB_MODE_AUTHED_SEEDS = [
97
97
  "apps/web/app/[locale]/(authed)/__tests__",
@@ -102,7 +102,6 @@ export const HUB_MODE_AUTHED_SEEDS = [
102
102
  "apps/web/app/[locale]/(authed)/edit",
103
103
  "apps/web/app/[locale]/(authed)/leads",
104
104
  "apps/web/app/[locale]/(authed)/waitlist",
105
- "apps/web/app/[locale]/(authed)/sign-in-gate.tsx",
106
105
  ];
107
106
  /** The default mode's one `(authed)` seed, which the hub mode replaces. */
108
107
  const AUTHED_SEED = "apps/web/app/[locale]/(authed)";
@@ -301,7 +300,10 @@ const WEB_SEAM_HEADER = `// topology.generated.ts — how this site reads a sess
301
300
  // loadSpokeBilling reaches the spoke billing action only on a spoke that
302
301
  // signs in through its hub and carries commerce (#8217); elsewhere, null.
303
302
  // readOwnAccounts lists the signed-in person's own sign-in accounts through
304
- // Better Auth on a hub (#8431); a spoke has none here, so it answers null.`;
303
+ // Better Auth on a hub (#8431); a spoke has none here, so it answers null.
304
+ // readPhoneStep and loadPhoneApi read and write the account's phone step
305
+ // through Better Auth on a hub (#11138); a spoke's hub holds the person, so
306
+ // both answer null.`;
305
307
  const MCP_SEAM_HEADER = `// topology.generated.ts — how this MCP server resolves its workspace store.
306
308
  //
307
309
  // GENERATED by create-ailk for this site's topology (#7426). Do not edit:
@@ -351,6 +353,70 @@ function ownAccountsReader(topology) {
351
353
  return Promise.resolve(null);
352
354
  }`;
353
355
  }
356
+ /**
357
+ * The phone step's types (#11106 D9): its state, and the plugin's three calls.
358
+ * Function-typed properties, not methods, so the hub's `auth.api` assignment
359
+ * is checked strictly: a Better Auth change to these endpoints fails `tsc`.
360
+ */
361
+ const PHONE_STEP_TYPES = `export type PhoneStep = {
362
+ available: boolean;
363
+ phone: { number: string; verified: boolean } | null;
364
+ };
365
+
366
+ export type PhoneApi = {
367
+ sendPhoneNumberOTP: (input: { body: { phoneNumber: string }; headers: Headers }) => Promise<unknown>;
368
+ verifyPhoneNumber: (input: {
369
+ body: { phoneNumber: string; code: string; updatePhoneNumber: boolean };
370
+ headers: Headers;
371
+ }) => Promise<unknown>;
372
+ updateUser: (input: { body: { phoneNumber: null }; headers: Headers }) => Promise<unknown>;
373
+ };`;
374
+ /**
375
+ * The account General page's phone step (#11138): `readPhoneStep` is the
376
+ * page's read — whether the phone plugin is installed, and the person's
377
+ * number — and `loadPhoneApi` the actions' writes, Better Auth's phone
378
+ * endpoints when the build turns the step on. The hub render loads `auth.ts`
379
+ * only when one is called; a spoke's hub holds the person, so its renders
380
+ * answer `null` — no phone step, and every action `unavailable` — and import
381
+ * nothing.
382
+ */
383
+ function phoneStep(topology) {
384
+ if (topology === "hub") {
385
+ return `${PHONE_STEP_TYPES}
386
+
387
+ export async function readPhoneStep(headers: Headers): Promise<PhoneStep | null> {
388
+ const { auth } = await import("../auth");
389
+ // Whether the phone plugin is installed on this instance (#11106 D9).
390
+ const api: object = auth.api;
391
+ const available = "sendPhoneNumberOTP" in api;
392
+ if (!available) return { available, phone: null };
393
+ const session = await auth.api.getSession({ headers });
394
+ // The plugin's two user fields, which the conditional install leaves out
395
+ // of the inferred session type.
396
+ const user = (session?.user ?? {}) as { phoneNumber?: unknown; phoneNumberVerified?: unknown };
397
+ const phone =
398
+ typeof user.phoneNumber === "string" && user.phoneNumber !== ""
399
+ ? { number: user.phoneNumber, verified: user.phoneNumberVerified === true }
400
+ : null;
401
+ return { available, phone };
402
+ }
403
+
404
+ export async function loadPhoneApi(): Promise<PhoneApi | null> {
405
+ const { auth, phoneStepActive } = await import("../auth");
406
+ return phoneStepActive() ? auth.api : null;
407
+ }`;
408
+ }
409
+ return `${PHONE_STEP_TYPES}
410
+
411
+ export function readPhoneStep(headers: Headers): Promise<PhoneStep | null> {
412
+ void headers;
413
+ return Promise.resolve(null);
414
+ }
415
+
416
+ export function loadPhoneApi(): Promise<PhoneApi | null> {
417
+ return Promise.resolve(null);
418
+ }`;
419
+ }
354
420
  /** The sign-in exports every web seam render carries (#7894 D8). */
355
421
  function signInExports(values) {
356
422
  const literal = (value) => value === null ? "null" : JSON.stringify(value);
@@ -432,6 +498,8 @@ export async function readSession(headers: Headers): Promise<SiteSession> {
432
498
 
433
499
  ${ownAccountsReader("hub")}
434
500
 
501
+ ${phoneStep("hub")}
502
+
435
503
  export async function registerSiteStores(): Promise<void> {
436
504
  const { registerLicenseKeyStore } = await import("./license-key-store");
437
505
  await registerLicenseKeyStore();
@@ -456,6 +524,8 @@ export function readSession(headers: Headers): Promise<SiteSession> {
456
524
 
457
525
  ${ownAccountsReader("spoke")}
458
526
 
527
+ ${phoneStep("spoke")}
528
+
459
529
  export function registerSiteStores(): Promise<void> {
460
530
  return Promise.resolve();
461
531
  }
@@ -478,6 +548,8 @@ export function readSession(headers: Headers): Promise<SiteSession> {
478
548
 
479
549
  ${ownAccountsReader("spoke")}
480
550
 
551
+ ${phoneStep("spoke")}
552
+
481
553
  export function registerSiteStores(): Promise<void> {
482
554
  return Promise.resolve();
483
555
  }
@@ -488,9 +560,10 @@ ${spokeBillingLoader(false)}
488
560
  const AUTHED_GATE_SEAM_HEADER = `// signed-out-gate.generated.tsx — what the (authed) group shows a signed-out visitor.
489
561
  //
490
562
  // GENERATED by create-ailk for this site's topology and sign-in mode (#7894).
491
- // Do not edit: every scaffold rewrites it. A hub renders its own sign-in —
492
- // the operator gate, or the account area's member gate; a spoke that signs in
493
- // through its hub (\`--hub-sign-in\`) renders the hub-session gate.`;
563
+ // Do not edit: every scaffold rewrites it. A hub redirects to its own
564
+ // /sign-in (an account path with no sign-in method on says so in place); a
565
+ // spoke that signs in through its hub (\`--hub-sign-in\`) redirects to its
566
+ // hub-session sign-in route.`;
494
567
  /**
495
568
  * The packages the gate seam imports. Interpolated, not written inline, for
496
569
  * the reason `CONTENT_ADAPTERS_PACKAGE` below is.
@@ -498,6 +571,7 @@ const AUTHED_GATE_SEAM_HEADER = `// signed-out-gate.generated.tsx — what the (
498
571
  const UI_PACKAGE = "@working-theory/ui";
499
572
  const WEB_I18N_PACKAGE = "@working-theory/web-i18n";
500
573
  const NEXT_INTL_SERVER = "next-intl/server";
574
+ const NEXT_NAVIGATION = "next/navigation";
501
575
  const REACT_PACKAGE = "react";
502
576
  const AUTHED_GATE_PROPS = `export interface SignedOutGateProps {
503
577
  locale: string;
@@ -506,8 +580,8 @@ const AUTHED_GATE_PROPS = `export interface SignedOutGateProps {
506
580
  }`;
507
581
  /**
508
582
  * `apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx` (#7894 D8).
509
- * The hub render is the `(authed)` layout's no-session branch, moved; the
510
- * `signIn: "hub"` render imports only the hub-session gate. A default-mode
583
+ * The hub render redirects to `/sign-in` (#11095 D3); the `signIn: "hub"`
584
+ * render is the spoke's own sign-in form, `SpokeSignIn` (#11096 D1). A default-mode
511
585
  * spoke carries no `(authed)` group, so it has no render.
512
586
  * @throws TopologyError for a spoke in the default mode.
513
587
  */
@@ -516,20 +590,16 @@ export function renderAuthedGateSeam(topology, signIn = "off") {
516
590
  return `${AUTHED_GATE_SEAM_HEADER}
517
591
  import { localeHref } from "${UI_PACKAGE}";
518
592
  import { Button, Heading, Link, Text } from "${UI_PACKAGE}/primitives";
519
- import type { AuthPanelProvider } from "${UI_PACKAGE}/sections";
520
593
  import { readLocales } from "${WEB_I18N_PACKAGE}";
594
+ import { redirect } from "${NEXT_NAVIGATION}";
521
595
  import { getTranslations } from "${NEXT_INTL_SERVER}";
522
596
  import type { ReactElement } from "${REACT_PACKAGE}";
523
597
 
524
- import { legalFootnote } from "../(auth)/legal-footnote";
525
- import { resolveSignInCardText } from "../(auth)/sign-in/sign-in-text";
526
598
  import { getActiveProviderIds } from "../../../lib/auth-env";
527
599
  import { isAccountPath } from "../../../lib/auth-routes";
528
- import { siteLogo } from "../../../lib/site-logo";
529
600
 
530
- import { SignInGate } from "./sign-in-gate";
531
-
532
- const SUPPORTED_PROVIDERS: readonly AuthPanelProvider[] = ["google", "github"];
601
+ /** The methods a member signs in with on /sign-in's card. */
602
+ const MEMBER_METHODS: readonly string[] = ["google", "github", "magic-link"];
533
603
 
534
604
  ${AUTHED_GATE_PROPS}
535
605
 
@@ -537,23 +607,17 @@ export async function SignedOutGate({
537
607
  locale,
538
608
  requestHeaders,
539
609
  }: SignedOutGateProps): Promise<ReactElement> {
540
- // No \`x-pathname\`, no locale read: a render outside the middleware keeps
541
- // the operator gate without touching the locale config.
610
+ // No \`x-pathname\`, no locale read: a render outside the middleware
611
+ // redirects to the bare /sign-in without touching the locale config.
542
612
  const pathname = requestHeaders.get("x-pathname");
543
613
  const isAccount =
544
614
  pathname !== null && isAccountPath(pathname, readLocales());
545
- const t = await getTranslations({
546
- locale,
547
- namespace: isAccount ? "account.gate" : "waitlistDashboard.gate",
548
- });
549
- const active = getActiveProviderIds();
550
- const emailLink = active.includes("magic-link");
551
- const providers = active.filter((id): id is AuthPanelProvider =>
552
- (SUPPORTED_PROVIDERS as readonly string[]).includes(id),
615
+ const hasMemberMethod = getActiveProviderIds().some((id) =>
616
+ MEMBER_METHODS.includes(id),
553
617
  );
554
- const signInPath = localeHref(locale, "/sign-in");
555
618
 
556
- if (isAccount && providers.length === 0 && !emailLink) {
619
+ if (isAccount && !hasMemberMethod) {
620
+ const t = await getTranslations({ locale, namespace: "account.gate" });
557
621
  return (
558
622
  <div
559
623
  className="flex min-h-screen flex-col items-center justify-center gap-4 py-section text-center"
@@ -581,36 +645,13 @@ export async function SignedOutGate({
581
645
  );
582
646
  }
583
647
 
584
- // The sign-in card: with the email link on, and on the member gate, which
585
- // also wears the one card's frame — the mark, the toggle line to /sign-up
586
- // and the Terms + Privacy acknowledgement (#9662).
587
- const text =
588
- emailLink || isAccount ? await resolveSignInCardText(locale) : undefined;
589
- const card = text
590
- ? {
591
- text,
592
- emailLink,
593
- ...(isAccount
594
- ? {
595
- logo: siteLogo(),
596
- prospect: { ...text.prospect, href: localeHref(locale, "/sign-up") },
597
- footnote: legalFootnote(locale, text.acknowledgement),
598
- }
599
- : {}),
600
- }
601
- : undefined;
602
-
603
- return (
604
- <SignInGate
605
- labels={{
606
- emptyHeadline: t("emptyHeadline"),
607
- emptyDescription: t("emptyDescription"),
608
- signInLinkLabel: t("signInLink"),
609
- }}
610
- signInPath={signInPath}
611
- providers={providers}
612
- {...(card ? { card } : {})}
613
- />
648
+ // Every other signed-out render is a redirect to the sign-in card, with the
649
+ // requested path as \`next\` (#11095 D3): \`/sign-in\` sanitizes it.
650
+ const signInPath = localeHref(locale, "/sign-in");
651
+ redirect(
652
+ pathname === null
653
+ ? signInPath
654
+ : \`\${signInPath}?next=\${encodeURIComponent(pathname)}\`,
614
655
  );
615
656
  }
616
657
  `;
@@ -621,15 +662,18 @@ export async function SignedOutGate({
621
662
  return `${AUTHED_GATE_SEAM_HEADER}
622
663
  import type { ReactElement } from "${REACT_PACKAGE}";
623
664
 
624
- import { HubSignInGate } from "../../../lib/hub-session/sign-in-gate";
665
+ import { SpokeSignIn } from "../../../lib/hub-session";
625
666
 
626
667
  ${AUTHED_GATE_PROPS}
627
668
 
669
+ // The spoke's own sign-in form (#11096 D1): email, the hub's agreements and
670
+ // Google, posted to this site's own routes. The person never sees the hub's
671
+ // brand; every hub hop after it is a redirect.
628
672
  export function SignedOutGate({
629
673
  locale,
630
674
  requestHeaders,
631
675
  }: SignedOutGateProps): Promise<ReactElement> {
632
- return HubSignInGate({ locale, requestHeaders });
676
+ return SpokeSignIn({ locale, requestHeaders });
633
677
  }
634
678
  `;
635
679
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ailk",
3
- "version": "0.35.1",
3
+ "version": "0.36.0",
4
4
  "description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "tar": "^7.5.21"
29
29
  },
30
30
  "devDependencies": {
31
- "@working-theory/schema": "0.59.0",
32
- "@working-theory/templates": "0.59.0"
31
+ "@working-theory/schema": "0.60.0",
32
+ "@working-theory/templates": "0.60.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -202,6 +202,27 @@ CONTENT_ADAPTER=mdx
202
202
  # default.
203
203
  # RESEND_AUDIENCE_ID=
204
204
  #
205
+ # ── Text messages (Twilio, apps/api) ─────────────────────────────────────────
206
+ # Phone verification (#11106 D9): a signed-in person sets and verifies a phone
207
+ # on the hub's Account page. apps/web's phone plugin signs one body with
208
+ # AUTH_EMAIL_WEBHOOK_SECRET and POSTs it to apps/api's
209
+ # /v1/auth/transactional-sms, which texts one fixed message ("Your
210
+ # verification code is …") through Twilio's Messages API. With any of the
211
+ # three unset the relay answers 503 sms_not_configured and no text is sent.
212
+ # Budgets (fail closed): 3 per number per hour, 5 per user per day, 200 per
213
+ # deployment per hour.
214
+ # TWILIO_ACCOUNT_SID=
215
+ # TWILIO_AUTH_TOKEN=
216
+ # TWILIO_FROM_NUMBER=
217
+ #
218
+ # The calling codes a code may be texted to, comma-separated (default "1").
219
+ # Read by BOTH apps: apps/web refuses any other number before a code exists,
220
+ # and the apps/api relay re-checks it — set the same value on both.
221
+ # Calling code 1 covers the whole North American Numbering Plan, Caribbean
222
+ # premium-rate destinations included: turn on Twilio's Geo Permissions (US and
223
+ # Canada only) and its SMS pumping protection for the sending account.
224
+ # AILK_SMS_COUNTRY_CODES=1
225
+ #
205
226
  # Request-and-confirm (#5970) — the callback request a site owner confirms by
206
227
  # an emailed link, which mints a Stripe Payment Link for the customer to pay
207
228
  # on. Off by default: with the flag unset the callback route behaves exactly as
@@ -21,6 +21,13 @@ FRONTEND_URL=http://localhost:3000
21
21
  # trust — list only origins the deployment owner operates.
22
22
  # AILK_TRUSTED_ORIGINS=https://admin.your-domain.com,https://spoke.example
23
23
 
24
+ # Google One Tap on a hub's spokes (#11096 D10), off by default: the hub's own
25
+ # Google OAuth client id. Set, POST /v1/hub-sign-in/google verifies a spoke's
26
+ # One Tap ID token against Google's keys with this as its audience, and client
27
+ # info names it to the spoke. List each One Tap spoke's origin on that Google
28
+ # client's authorized JavaScript origins. Unset: the route answers 404.
29
+ # AILK_GOOGLE_ONE_TAP_CLIENT_ID=
30
+
24
31
  # =============================================================================
25
32
  # MCP OAuth issuer (#10912)
26
33
  # =============================================================================