create-ailk 0.35.1 → 0.37.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.
- package/README.md +1 -1
- package/component-catalog.json +51 -1
- package/component-catalog.md +8 -5
- package/dist/lib/env-catalog.js +8 -0
- package/dist/surfaces.js +66 -22
- package/dist/topology.d.ts +4 -4
- package/dist/topology.js +104 -60
- package/dist/update.d.ts +19 -1
- package/dist/update.js +293 -35
- package/package.json +3 -3
- package/templates/.env.example +38 -0
- package/templates/apps/api/.env.example +45 -0
- package/templates/apps/api/CLAUDE.md +12 -4
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +7 -0
- package/templates/apps/mcp/CLAUDE.md +4 -2
- package/templates/apps/web/.env.example +16 -0
- package/templates/apps/web/CLAUDE.md +73 -5
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +2 -0
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +179 -0
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +22 -2
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +9 -2
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +52 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +43 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +108 -1
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +36 -3
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +37 -0
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +90 -33
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +9 -4
- package/templates/apps/web/app/[locale]/(authed)/__tests__/gate.test.tsx +79 -348
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +241 -66
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +242 -28
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +377 -151
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +26 -1
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +10 -5
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +17 -6
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +51 -12
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +17 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +153 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +206 -23
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +150 -188
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +235 -177
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +63 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +340 -0
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +7 -5
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +20 -4
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +8 -4
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +161 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +426 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +76 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +139 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +92 -24
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +32 -1
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +76 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +290 -41
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +109 -11
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +43 -44
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +99 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +123 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +323 -73
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +199 -43
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +52 -7
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +8 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +7 -3
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +65 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +36 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +70 -2
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +42 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +97 -53
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +122 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +215 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +73 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +12 -9
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +18 -4
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +20 -2
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +43 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +125 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +88 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +31 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +35 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +266 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +116 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +12 -0
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +154 -0
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +9 -6
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +33 -8
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +31 -52
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +44 -4
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +69 -49
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +173 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +42 -4
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +102 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +147 -137
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +258 -0
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +21 -22
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +34 -6
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +37 -7
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +8 -5
- package/templates/apps/web/app/[locale]/(authed)/layout.tsx +15 -13
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +20 -52
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +3 -2
- package/templates/apps/web/app/[locale]/layout.tsx +24 -75
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +50 -0
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +48 -7
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +749 -0
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +166 -7
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +96 -30
- package/templates/apps/web/app/api/auth/hub/continuation.ts +51 -2
- package/templates/apps/web/app/api/auth/hub/email/route.ts +111 -0
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +163 -0
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +368 -0
- package/templates/apps/web/app/api/auth/hub/password/return.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/route.ts +171 -0
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +230 -0
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +174 -0
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +60 -0
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +97 -0
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +738 -7
- package/templates/apps/web/app/api/hub-session/callback/route.ts +13 -47
- package/templates/apps/web/app/api/hub-session/email/route.ts +125 -0
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +49 -0
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/open/route.ts +111 -0
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +69 -0
- package/templates/apps/web/app/api/hub-session/password/route.ts +106 -0
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +23 -40
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +1 -10
- package/templates/apps/web/auth.ts +133 -6
- package/templates/apps/web/components/sign-out-trigger.tsx +1 -1
- package/templates/apps/web/lib/__tests__/account-config.test.ts +129 -1
- package/templates/apps/web/lib/__tests__/auth-email.test.ts +141 -0
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +445 -0
- package/templates/apps/web/lib/__tests__/auth-sms.test.ts +140 -0
- package/templates/apps/web/lib/__tests__/fixtures/tsconfig.flow.json +18 -0
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +33 -0
- package/templates/apps/web/lib/__tests__/site-header.test.ts +13 -0
- package/templates/apps/web/lib/__tests__/telemetry-scrub.test.ts +19 -1
- package/templates/apps/web/lib/account-config.ts +132 -8
- package/templates/apps/web/lib/auth-email.ts +62 -6
- package/templates/apps/web/lib/auth-env.ts +13 -0
- package/templates/apps/web/lib/auth-routes.ts +11 -6
- package/templates/apps/web/lib/auth-sms.ts +180 -0
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +28 -0
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +332 -0
- package/templates/apps/web/lib/hub-session/config.ts +7 -1
- package/templates/apps/web/lib/hub-session/entry.ts +238 -0
- package/templates/apps/web/lib/hub-session/index.ts +1 -4
- package/templates/apps/web/lib/hub-session/one-tap.tsx +148 -0
- package/templates/apps/web/lib/hub-session/session.ts +120 -2
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +277 -0
- package/templates/apps/web/lib/offerings-pricing.ts +4 -1
- package/templates/apps/web/lib/site-header.ts +14 -1
- package/templates/apps/web/lib/telemetry-scrub.ts +11 -0
- package/templates/apps/web/lib/topology.generated.ts +39 -0
- package/templates/apps/web/messages/en.json +264 -96
- package/templates/apps/web/middleware.ts +34 -2
- package/templates/apps/web/security-headers.config.ts +21 -0
- package/versions.json +48 -48
- package/templates/apps/web/app/[locale]/(authed)/account/components/schedule-service.tsx +0 -276
- package/templates/apps/web/app/[locale]/(authed)/account/components/send-message.tsx +0 -128
- package/templates/apps/web/app/[locale]/(authed)/account/settings/__tests__/theme-modes.test.ts +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/settings/theme-modes.ts +0 -40
- package/templates/apps/web/app/[locale]/(authed)/sign-in-gate.tsx +0 -162
- package/templates/apps/web/components/signed-in-nav.tsx +0 -79
- package/templates/apps/web/lib/hub-session/__tests__/sign-in-gate.test.tsx +0 -180
- package/templates/apps/web/lib/hub-session/sign-in-gate.tsx +0 -162
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
|
|
94
|
-
*
|
|
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
|
|
492
|
-
//
|
|
493
|
-
// through its hub (\`--hub-sign-in\`)
|
|
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
|
|
510
|
-
*
|
|
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
|
-
|
|
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
|
|
541
|
-
// the
|
|
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
|
|
546
|
-
|
|
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 &&
|
|
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
|
-
//
|
|
585
|
-
//
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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 {
|
|
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
|
|
676
|
+
return SpokeSignIn({ locale, requestHeaders });
|
|
633
677
|
}
|
|
634
678
|
`;
|
|
635
679
|
}
|
package/dist/update.d.ts
CHANGED
|
@@ -60,6 +60,24 @@ export interface UpdateResult {
|
|
|
60
60
|
importers?: string[];
|
|
61
61
|
missing?: true;
|
|
62
62
|
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Per file left alone that a moved file imports (#11147): the importers
|
|
65
|
+
* that moved anyway, because their own bytes were the record's, and what
|
|
66
|
+
* holds the file — `the site edit is <hunk summary>` where the record's
|
|
67
|
+
* copy could be read, else the reason the file was left alone.
|
|
68
|
+
*/
|
|
69
|
+
heldImports?: Array<{
|
|
70
|
+
file: string;
|
|
71
|
+
importers: string[];
|
|
72
|
+
edit: string;
|
|
73
|
+
}>;
|
|
74
|
+
/** The recorded files whose bytes were another published template version's copy, moved as untouched (#11147). */
|
|
75
|
+
staleCopies?: Array<{
|
|
76
|
+
path: string;
|
|
77
|
+
version: string;
|
|
78
|
+
}>;
|
|
79
|
+
/** The recorded files whose site edit was comment lines only (#11147): merged, or on a conflict the template's copy. */
|
|
80
|
+
commentOnlyEdits?: string[];
|
|
63
81
|
/** The `project.yaml` `env_contract` rows added for env vars the written files read (#10172). */
|
|
64
82
|
envRowsAdded?: string[];
|
|
65
83
|
/** Record rows dropped because the path is no longer recordable (#10173). */
|
|
@@ -109,6 +127,6 @@ export interface UpdateArgs {
|
|
|
109
127
|
target: string | undefined;
|
|
110
128
|
help: boolean;
|
|
111
129
|
}
|
|
112
|
-
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has, and is reviewed only when a\nkey is an object on one side and a value on the other.
|
|
130
|
+
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has, and is reviewed only when a\nkey is an object on one side and a value on the other. An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" or \"Skipped\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A file whose own bytes are the record's is not\nheld by what it imports: it moves, unless it names an export the held copy\nlacks, and the held file is listed as \"Held back: <file> \u2014 imported by N\nmoved files; the site edit is <hunk summary>\". A written file whose import\nnames a file the site will not have is held the same way, under \"Held back\nwith <file> (not in this site)\", and a file the template removed is kept\nwhile any file still in the site imports it. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Commit before running, and review the diff after.\n";
|
|
113
131
|
/** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
|
|
114
132
|
export declare function parseUpdateArgs(argv: string[]): UpdateArgs;
|