create-ailk 0.37.1 → 0.38.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 +129 -0
- package/component-catalog.json +44 -6
- package/component-catalog.md +6 -5
- package/dist/add-module.js +16 -1
- package/dist/add-route.d.ts +2 -2
- package/dist/add-route.js +18 -11
- package/dist/cli.js +52 -0
- package/dist/declined-routes.d.ts +13 -0
- package/dist/declined-routes.js +74 -0
- package/dist/derive-architecture.d.ts +0 -6
- package/dist/derive-architecture.js +9 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/language-import.d.ts +93 -0
- package/dist/language-import.js +270 -43
- package/dist/lib/import-mdx.js +1 -1
- package/dist/lib/scaffold-render-sweep.d.ts +6 -3
- package/dist/lib/scaffold-render-sweep.js +8 -4
- package/dist/migrate-content.d.ts +6 -2
- package/dist/migrate-content.js +62 -5
- package/dist/module-architecture.js +139 -103
- package/dist/paid-sections.d.ts +13 -0
- package/dist/paid-sections.js +35 -5
- package/dist/programmatic.js +6 -16
- package/dist/remove-module.js +67 -0
- package/dist/routes.d.ts +103 -0
- package/dist/routes.js +708 -0
- package/dist/site-manifest.js +1 -1
- package/dist/site-roster.d.ts +2 -1
- package/dist/site-roster.js +30 -8
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +18 -0
- package/dist/surfaces.js +47 -282
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +86 -5
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +17 -2
- package/dist/update.js +480 -77
- package/package.json +3 -3
- package/templates/README.md +1 -1
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/CLAUDE.md +62 -20
- package/templates/apps/web/account.config.tsx +101 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +3 -161
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +3 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +3 -406
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +2 -190
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +3 -182
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +8 -420
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +8 -214
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +8 -115
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/route.ts +2 -80
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +8 -121
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/page.tsx +3 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +7 -149
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +3 -143
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/page.tsx +3 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +8 -302
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +2 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +3 -240
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +3 -131
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +2 -24
- package/templates/apps/web/app/[locale]/(authed)/account/support/page.tsx +3 -60
- package/templates/apps/web/app/[locale]/layout.tsx +45 -28
- package/templates/apps/web/app/apple-icon.tsx +72 -0
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +22 -12
- package/templates/apps/web/app/og/__tests__/__snapshots__/card.test.tsx.snap +3 -0
- package/templates/apps/web/app/og/__tests__/card.test.tsx +129 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +3 -4
- package/templates/apps/web/app/og/route.tsx +155 -72
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +12 -0
- package/templates/apps/web/i18n/request.ts +44 -1
- package/templates/apps/web/jest.config.cjs +13 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +70 -0
- package/templates/apps/web/lib/__tests__/nav-label-keys.test.ts +14 -0
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +148 -61
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +77 -0
- package/templates/apps/web/lib/__tests__/server-api.test.ts +37 -5
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +26 -13
- package/templates/apps/web/lib/listings.tsx +2 -2
- package/templates/apps/web/lib/nav-label-keys.ts +16 -2
- package/templates/apps/web/lib/paid-section-contracts.ts +35 -6
- package/templates/apps/web/lib/paid-sections.generated.ts +8 -0
- package/templates/apps/web/lib/profile-back-link.ts +105 -32
- package/templates/apps/web/lib/served-pages.ts +95 -0
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/messages/en.json +8 -684
- package/templates/apps/web/middleware.ts +3 -1
- package/templates/apps/web/next.config.mjs +27 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +48 -47
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx +0 -175
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/agreements-prompt.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +0 -515
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +0 -883
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +0 -758
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +0 -264
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout-sign-out.test.tsx +0 -167
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +0 -730
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +0 -355
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +0 -97
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +0 -375
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/onboarding.test.tsx +0 -323
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +0 -1208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +0 -418
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +0 -462
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +0 -63
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -406
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/settings.test.tsx +0 -93
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/support.test.tsx +0 -208
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +0 -340
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +0 -182
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +0 -353
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +0 -57
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-actions.ts +0 -58
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-gate.ts +0 -61
- package/templates/apps/web/app/[locale]/(authed)/account/agreements-prompt.tsx +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +0 -426
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +0 -76
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/pay-form.tsx +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/review-form.tsx +0 -172
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +0 -333
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +0 -936
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/pay.test.tsx +0 -193
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/review.test.tsx +0 -476
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-actions.ts +0 -184
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +0 -197
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +0 -99
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +0 -123
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +0 -303
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +0 -274
- package/templates/apps/web/app/[locale]/(authed)/account/error-row.tsx +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/for-you-labels.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/phone-verification.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/__tests__/seam-imports.test.ts +0 -65
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +0 -36
- package/templates/apps/web/app/[locale]/(authed)/account/general/billing-anchor.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +0 -149
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/general/deletion-request.tsx +0 -132
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-actions.ts +0 -122
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +0 -73
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +0 -107
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +0 -87
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/message/[id]/file/__tests__/route.test.ts +0 -215
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +0 -43
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +0 -88
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +0 -31
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/invitation-id.test.ts +0 -35
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/__tests__/page.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/invitations/[invitationId]/invitation-id.ts +0 -12
- package/templates/apps/web/app/[locale]/(authed)/account/new-actions.ts +0 -219
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +0 -365
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +0 -86
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/actions.ts +0 -120
- package/templates/apps/web/app/[locale]/(authed)/account/onboarding/onboarding-form.tsx +0 -322
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +0 -173
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +0 -103
- package/templates/apps/web/app/[locale]/(authed)/account/profile-actions.ts +0 -116
- package/templates/apps/web/app/[locale]/(authed)/account/retry-button.tsx +0 -27
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +0 -258
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +0 -130
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +0 -92
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +0 -121
- package/templates/apps/web/app/[locale]/(authed)/account/sign-in-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(authed)/account/support/support-form.tsx +0 -98
- package/templates/apps/web/app/[locale]/(authed)/account/support-actions.ts +0 -100
- package/templates/apps/web/app/[locale]/checkout/__tests__/pages.test.tsx +0 -139
- package/templates/apps/web/app/[locale]/checkout/__tests__/thank-you-account.test.tsx +0 -146
- package/templates/apps/web/app/[locale]/checkout/thank-you/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/checkout/unavailable/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/flows/[slug]/FlowStepperClient.tsx +0 -614
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.count.test.tsx +0 -43
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.deliverable.test.tsx +0 -214
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.ending.test.tsx +0 -197
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.invite.test.tsx +0 -286
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.permalink.test.tsx +0 -520
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.test.tsx +0 -376
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/FlowStepperClient.thanks-by-tier.test.tsx +0 -306
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/account-invite.actions.test.ts +0 -69
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/flow.actions.test.ts +0 -398
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/magnet-page.test.tsx +0 -704
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/save.actions.test.ts +0 -173
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/two-route-tool.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/flows/[slug]/__tests__/verify.test.tsx +0 -249
- package/templates/apps/web/app/[locale]/flows/[slug]/account-invite.actions.ts +0 -35
- package/templates/apps/web/app/[locale]/flows/[slug]/email-moment.ts +0 -92
- package/templates/apps/web/app/[locale]/flows/[slug]/flow.actions.ts +0 -177
- package/templates/apps/web/app/[locale]/flows/[slug]/magnet-page.tsx +0 -472
- package/templates/apps/web/app/[locale]/flows/[slug]/page.tsx +0 -48
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/LevelChart.tsx +0 -100
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsCard.tsx +0 -99
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +0 -820
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsEmailStep.tsx +0 -203
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.no-commerce.test.tsx +0 -194
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/ResultsClient.report.test.tsx +0 -284
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/by-result.test.tsx +0 -302
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/cards.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/landing.test.tsx +0 -293
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/page.test.tsx +0 -485
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/__tests__/score.test.tsx +0 -231
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/checkout-seam.ts +0 -74
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/meeting-seam.ts +0 -36
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/page.tsx +0 -420
- package/templates/apps/web/app/[locale]/flows/[slug]/save.actions.ts +0 -85
- package/templates/apps/web/app/[locale]/flows/[slug]/served-flow.ts +0 -91
- package/templates/apps/web/app/[locale]/flows/[slug]/start/page.tsx +0 -32
- package/templates/apps/web/app/[locale]/flows/[slug]/verify/page.tsx +0 -153
- package/templates/apps/web/app/[locale]/flows/[slug]/verify.actions.ts +0 -151
- package/templates/apps/web/app/[locale]/meet/confirmed/BookingHandOff.tsx +0 -128
- package/templates/apps/web/app/[locale]/meet/confirmed/__tests__/BookingHandOff.test.tsx +0 -126
- package/templates/apps/web/app/[locale]/purchase/__tests__/cancel.test.tsx +0 -162
- package/templates/apps/web/app/[locale]/purchase/__tests__/module-scope.test.ts +0 -68
- package/templates/apps/web/app/[locale]/purchase/__tests__/success.test.tsx +0 -411
- package/templates/apps/web/app/[locale]/purchase/cancel/page.tsx +0 -115
- package/templates/apps/web/app/[locale]/purchase/success/page.tsx +0 -348
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -97,7 +97,9 @@ const intlMiddleware = createMiddleware({
|
|
|
97
97
|
|
|
98
98
|
// Top-level app/ route directories that live outside [locale]. Kept in step
|
|
99
99
|
// with app/ by the drift test in __tests__/i18n/middleware.test.ts.
|
|
100
|
-
|
|
100
|
+
// /apple-icon is the touch-icon metadata route app/apple-icon.tsx emits
|
|
101
|
+
// (`/apple-icon?<hash>`); without it next-intl rewrites it to a 404 (#11244).
|
|
102
|
+
export const NON_LOCALE_ROUTE_PREFIXES = ["/api", "/apple-icon", "/og", "/v1"] as const;
|
|
101
103
|
|
|
102
104
|
// Segment-bound: /og and /og/x are exempt; /ogden and /og-image are not.
|
|
103
105
|
export function isNonLocaleRoute(pathname: string): boolean {
|
|
@@ -327,6 +327,10 @@ const nextConfig = {
|
|
|
327
327
|
// Keep this list in sync with package.json workspace:* dependencies.
|
|
328
328
|
// Mirror of the transpilePackages list in apps-paid/marketing-web/next.config.ts.
|
|
329
329
|
transpilePackages: [
|
|
330
|
+
// #11219 (ADR 0040): the account page package ships TypeScript source,
|
|
331
|
+
// like @working-theory/admin does for the Admin shell; the generated
|
|
332
|
+
// route files under app/[locale]/(authed)/account/ re-export it.
|
|
333
|
+
"@working-theory/account",
|
|
330
334
|
"@working-theory/analytics",
|
|
331
335
|
"@working-theory/api-client",
|
|
332
336
|
"@working-theory/content-adapters",
|
|
@@ -352,6 +356,29 @@ const nextConfig = {
|
|
|
352
356
|
// Marking better-auth as a server external prevents webpack from statically
|
|
353
357
|
// bundling it (and the unused kysely adapter) into the server chunk.
|
|
354
358
|
serverExternalPackages: ["better-auth"],
|
|
359
|
+
// #11219 (ADR 0040) — the account page package's site seam. Its pages and
|
|
360
|
+
// its "use server" actions import the fixed specifier
|
|
361
|
+
// `@working-theory/account/site`; this site answers it with
|
|
362
|
+
// account.config.tsx, whose `site` export carries the runtime services the
|
|
363
|
+
// package types (`AccountSite`). jest.config.cjs maps the same specifier.
|
|
364
|
+
// #11251 — the flows pages' seam, the same way: their pages and actions
|
|
365
|
+
// import `@working-theory/ui-signal-collectors/site`, answered by
|
|
366
|
+
// signal-collectors.config.tsx (`SignalCollectorsSite`). A site without the
|
|
367
|
+
// module has no such file and no importer of the specifier.
|
|
368
|
+
webpack(config) {
|
|
369
|
+
config.resolve.alias["@working-theory/account/site$"] = join(process.cwd(), "account.config.tsx");
|
|
370
|
+
config.resolve.alias["@working-theory/ui-signal-collectors/site$"] = join(
|
|
371
|
+
process.cwd(),
|
|
372
|
+
"signal-collectors.config.tsx",
|
|
373
|
+
);
|
|
374
|
+
// The package ships TypeScript source whose relative imports name `.js`
|
|
375
|
+
// (TypeScript's ESM convention): resolve each to its `.ts`/`.tsx` source.
|
|
376
|
+
config.resolve.extensionAlias = {
|
|
377
|
+
...config.resolve.extensionAlias,
|
|
378
|
+
".js": [".ts", ".tsx", ".js"],
|
|
379
|
+
};
|
|
380
|
+
return config;
|
|
381
|
+
},
|
|
355
382
|
// Disable Next 16's auto-generated AGENTS.md / CLAUDE.md agent-rules
|
|
356
383
|
// block. Default true: `next dev`, on detecting an AI coding agent in
|
|
357
384
|
// the environment, upserts a managed `<!-- BEGIN:nextjs-agent-rules -->`
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@prisma/adapter-pg": "^7.8.0",
|
|
19
19
|
"@sentry/nextjs": "^10.58.0",
|
|
20
|
+
"@working-theory/account": "workspace:*",
|
|
20
21
|
"@working-theory/analytics": "workspace:*",
|
|
21
22
|
"@working-theory/api-client": "workspace:*",
|
|
22
23
|
"@working-theory/content-adapters": "workspace:*",
|
|
@@ -24,6 +24,15 @@
|
|
|
24
24
|
# the future (strictly after today, UTC):
|
|
25
25
|
# undecided_ok_until: 2027-01-31
|
|
26
26
|
#
|
|
27
|
+
# A template route this site deliberately does not carry (optional):
|
|
28
|
+
# declined_routes:
|
|
29
|
+
# - route: "pricing/[slug]" # under apps/web/app/[locale]/
|
|
30
|
+
# reason: "this site sells from /pricing alone"
|
|
31
|
+
# decided: "Site Owner, 2026-11-02" # <decider>, <YYYY-MM-DD>
|
|
32
|
+
# sync-routes reports it declined, never missing, and never copies it back;
|
|
33
|
+
# update never writes under it. `pnpm architecture` refuses an entry with no
|
|
34
|
+
# reason, no decided line, or naming no route the template carries.
|
|
35
|
+
#
|
|
27
36
|
# Seeding an existing site:
|
|
28
37
|
# 1. Copy tools/lint-architecture.ts (and this file, if absent) from a fresh
|
|
29
38
|
# scaffold of this create-ailk version.
|
package/templates/package.json
CHANGED
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"claude-md:check": "tsx tools/check-claude-md.ts",
|
|
23
23
|
"content-source:check": "tsx tools/check-content-source.ts",
|
|
24
24
|
"mdx-body:check": "tsx tools/check-mdx-body.ts",
|
|
25
|
-
"
|
|
25
|
+
"routes:check": "create-ailk routes --check",
|
|
26
|
+
"preflight": "pnpm architecture && pnpm routes:check && pnpm claude-md:check && pnpm content-source:check && pnpm mdx-body:check && pnpm type-check && pnpm lint && pnpm build"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
"zod": "^4.2.1",
|
|
68
69
|
"zod-to-ts": "^2.1.0",
|
|
69
70
|
"@working-theory/cli": "workspace:*",
|
|
71
|
+
"create-ailk": "{{CREATE_AILK_VERSION}}",
|
|
70
72
|
"@working-theory/database": "workspace:*",
|
|
71
73
|
"@working-theory/validation": "workspace:*",
|
|
72
74
|
"@prisma/adapter-pg": "^7.8.0",
|
|
@@ -32,7 +32,13 @@
|
|
|
32
32
|
* `undecided_ok_until` is in the future; a `build-in: ailk#N` entry whose
|
|
33
33
|
* paths still match the site's own test files is refused (tests belong
|
|
34
34
|
* in AILK); a malformed or missing manifest is refused naming the field.
|
|
35
|
-
* With no template record the lint warns and skips the file rules
|
|
35
|
+
* With no template record the lint warns and skips the file rules.
|
|
36
|
+
* The manifest's optional `declined_routes` list (#11260) records a
|
|
37
|
+
* template route the site deliberately does not carry — create-ailk
|
|
38
|
+
* sync-routes and update never copy it back; each entry names a route
|
|
39
|
+
* the template carries (read from the installed create-ailk's
|
|
40
|
+
* templates, and from the template record) with a non-empty `reason`
|
|
41
|
+
* and a `decided: <decider>, <YYYY-MM-DD>` line, or it is refused;
|
|
36
42
|
* - the shadow-copy rule (#9201), under the same block and record — a
|
|
37
43
|
* site-authored file under `apps/` most of whose substantive lines are a
|
|
38
44
|
* module's that an installed `@working-theory/*` package ships (found
|
|
@@ -538,6 +544,19 @@ interface Entry {
|
|
|
538
544
|
decision: string;
|
|
539
545
|
}
|
|
540
546
|
|
|
547
|
+
/** A `declined_routes` entry (#11260): a template route the site does not carry. */
|
|
548
|
+
interface DeclinedRoute {
|
|
549
|
+
route: string;
|
|
550
|
+
line: number;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** Site-relative prefix every `apps/web` route directory sits under. */
|
|
554
|
+
const ROUTE_ROOT = "apps/web/app/[locale]";
|
|
555
|
+
/** Directories under a route that are not routes of their own. */
|
|
556
|
+
const NON_ROUTE_DIRS = new Set(["__tests__", "components"]);
|
|
557
|
+
const DECIDED_RE = /^[^,]+, (\d{4}-\d{2}-\d{2})$/;
|
|
558
|
+
const ROUTE_RE = /^[^/\s*\\][^\s*\\]*$/;
|
|
559
|
+
|
|
541
560
|
/**
|
|
542
561
|
* A path pattern as a regex: `**` matches zero or more whole segments, `*`
|
|
543
562
|
* matches within one segment, and every other character is literal — route
|
|
@@ -575,12 +594,25 @@ function readRecord(): Set<string> | null {
|
|
|
575
594
|
}
|
|
576
595
|
}
|
|
577
596
|
|
|
597
|
+
/**
|
|
598
|
+
* A route file `create-ailk routes --write` wrote: its first line — or its
|
|
599
|
+
* second, behind a page package's `// oss: false` marker — is the generator's
|
|
600
|
+
* header. It is the installed page package's code, never the site's (ADR 0040
|
|
601
|
+
* rule 3), and the template record never lists it: the template snapshot
|
|
602
|
+
* excludes it and the generator writes it after install (#11251, #11252).
|
|
603
|
+
*/
|
|
604
|
+
const GENERATED_ROUTE_HEADER = "// Generated by create-ailk routes from ";
|
|
605
|
+
function isGeneratedRoute(p: string): boolean {
|
|
606
|
+
const [first = "", second = ""] = readFileSync(join(ROOT, p), "utf8").split("\n", 2);
|
|
607
|
+
return first.startsWith(GENERATED_ROUTE_HEADER) || (first === "// oss: false" && second.startsWith(GENERATED_ROUTE_HEADER));
|
|
608
|
+
}
|
|
609
|
+
|
|
578
610
|
/** Every site-authored code file under `apps/`, root-relative, sorted. */
|
|
579
611
|
function siteAuthoredFiles(record: Set<string>, scaffoldPaths: string[]): string[] {
|
|
580
612
|
const shipped = scaffoldPaths.map(globToRegExp);
|
|
581
613
|
return walk(join(ROOT, "apps"), CODE_FILE_RE)
|
|
582
614
|
.map(rel)
|
|
583
|
-
.filter((p) => !record.has(p) && !shipped.some((re) => re.test(p)))
|
|
615
|
+
.filter((p) => !record.has(p) && !shipped.some((re) => re.test(p)) && !isGeneratedRoute(p))
|
|
584
616
|
.sort();
|
|
585
617
|
}
|
|
586
618
|
|
|
@@ -590,9 +622,12 @@ function siteAuthoredFiles(record: Set<string>, scaffoldPaths: string[]): string
|
|
|
590
622
|
* and `paths`, so one fault never turns its files into unmatched ones.
|
|
591
623
|
*/
|
|
592
624
|
/** Null when the manifest is missing — the caller reports only that. */
|
|
593
|
-
function readManifest(
|
|
625
|
+
function readManifest(
|
|
626
|
+
out: Violation[],
|
|
627
|
+
): { entries: Entry[]; graceUntil: string | undefined; declined: DeclinedRoute[] } | null {
|
|
594
628
|
const file = join(ROOT, MANIFEST_PATH);
|
|
595
629
|
const entries: Entry[] = [];
|
|
630
|
+
const declined: DeclinedRoute[] = [];
|
|
596
631
|
let graceUntil: string | undefined;
|
|
597
632
|
if (!existsSync(file)) {
|
|
598
633
|
out.push({
|
|
@@ -613,12 +648,12 @@ function readManifest(out: Violation[]): { entries: Entry[]; graceUntil: string
|
|
|
613
648
|
if (doc.errors.length > 0) {
|
|
614
649
|
const err = doc.errors[0]!;
|
|
615
650
|
fault(err.linePos?.[0]?.line ?? 1, `${MANIFEST_PATH} does not parse: ${err.message.split("\n")[0]}`, "make it valid YAML — copy the shape from a fresh scaffold's customizations.yaml.");
|
|
616
|
-
return { entries, graceUntil };
|
|
651
|
+
return { entries, graceUntil, declined };
|
|
617
652
|
}
|
|
618
653
|
const root = doc.contents;
|
|
619
654
|
if (!isMap(root)) {
|
|
620
|
-
fault(1, `${MANIFEST_PATH} is not a map`, "the file holds `undecided_ok_until` (optional) and `customizations` (a list).");
|
|
621
|
-
return { entries, graceUntil };
|
|
655
|
+
fault(1, `${MANIFEST_PATH} is not a map`, "the file holds `undecided_ok_until` (optional), `declined_routes` (optional, a list) and `customizations` (a list).");
|
|
656
|
+
return { entries, graceUntil, declined };
|
|
622
657
|
}
|
|
623
658
|
const scalarText = (node: unknown): string | undefined => {
|
|
624
659
|
if (!isScalar(node)) return undefined;
|
|
@@ -627,6 +662,8 @@ function readManifest(out: Violation[]): { entries: Entry[]; graceUntil: string
|
|
|
627
662
|
};
|
|
628
663
|
let list: unknown;
|
|
629
664
|
let listLine = 1;
|
|
665
|
+
let declinedRoutes: unknown;
|
|
666
|
+
let declinedLine = 1;
|
|
630
667
|
for (const pair of root.items) {
|
|
631
668
|
const key = scalarText(pair.key);
|
|
632
669
|
const keyLine = lineOf(pair.key as Node);
|
|
@@ -640,17 +677,69 @@ function readManifest(out: Violation[]): { entries: Entry[]; graceUntil: string
|
|
|
640
677
|
} else if (key === "customizations") {
|
|
641
678
|
list = pair.value;
|
|
642
679
|
listLine = keyLine;
|
|
680
|
+
} else if (key === "declined_routes") {
|
|
681
|
+
declinedRoutes = pair.value;
|
|
682
|
+
declinedLine = keyLine;
|
|
683
|
+
} else {
|
|
684
|
+
fault(keyLine, `unknown key ${JSON.stringify(key)} — the keys are undecided_ok_until, declined_routes and customizations`, "remove it, or move it under the entry it describes.");
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
// #11260 — declined_routes, when present: a list of { route, reason, decided }.
|
|
688
|
+
if (declinedRoutes !== undefined && !(isScalar(declinedRoutes) && declinedRoutes.value === null)) {
|
|
689
|
+
if (!isSeq(declinedRoutes)) {
|
|
690
|
+
fault(lineOf(declinedRoutes as Node, declinedLine), "declined_routes is not a list", "write a sequence of entries (- route: … / reason: … / decided: …), or remove the key.");
|
|
691
|
+
} else if (declinedRoutes.flow && declinedRoutes.items.length > 0) {
|
|
692
|
+
// create-ailk reads this list by line: only the block layout reaches it.
|
|
693
|
+
fault(lineOf(declinedRoutes, declinedLine), "declined_routes is a flow list ([…])", "write one block entry per route (- route: … / reason: … / decided: …) — create-ailk sync-routes and update read only that layout.");
|
|
643
694
|
} else {
|
|
644
|
-
|
|
695
|
+
const seenRoutes = new Set<string>();
|
|
696
|
+
declinedRoutes.items.forEach((item, index) => {
|
|
697
|
+
if (!isMap(item)) {
|
|
698
|
+
fault(lineOf(item as Node, declinedLine), `declined_routes[${index}] is not a map`, "an entry is a map with route, reason and decided.");
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
if (item.flow) {
|
|
702
|
+
fault(lineOf(item, declinedLine), `declined_routes[${index}] is a flow map ({…})`, "write the entry as block lines (route: … / reason: … / decided: …) — create-ailk sync-routes and update read only that layout.");
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
for (const pair of item.items) {
|
|
706
|
+
if (isScalar(pair.value) && (pair.value.type === "BLOCK_LITERAL" || pair.value.type === "BLOCK_FOLDED")) {
|
|
707
|
+
fault(lineOf(pair.value, declinedLine), `declined_routes[${index}].${scalarText(pair.key) ?? "?"} is a block scalar (| or >)`, "write the value on one line, quoted.");
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const line = lineOf(item);
|
|
711
|
+
const fields = new Map<string, unknown>();
|
|
712
|
+
for (const pair of item.items) {
|
|
713
|
+
const key = scalarText(pair.key) ?? "";
|
|
714
|
+
if (["route", "reason", "decided"].includes(key)) fields.set(key, pair.value);
|
|
715
|
+
else fault(lineOf(pair.key as Node, line), `unknown key ${JSON.stringify(key)} — a declined route's keys are route, reason, decided`, "remove it.");
|
|
716
|
+
}
|
|
717
|
+
const route = scalarText(fields.get("route"))?.replace(/^\/+|\/+$/g, "");
|
|
718
|
+
if (!fields.has("route")) fault(line, "route is required on every declined route", `name the template route under ${ROUTE_ROOT}/, e.g. route: "pricing/[slug]".`);
|
|
719
|
+
else if (route === undefined || !ROUTE_RE.test(route) || route.split("/").includes("..")) fault(lineOf(fields.get("route") as Node, line), `declined route ${JSON.stringify(route ?? null)} is not a route path`, `write the route as it sits under ${ROUTE_ROOT}/, with / separators and no glob, e.g. "pricing/[slug]".`);
|
|
720
|
+
else if (seenRoutes.has(route)) fault(lineOf(fields.get("route") as Node, line), `duplicate declined route ${JSON.stringify(route)}`, "list each route once.");
|
|
721
|
+
else {
|
|
722
|
+
seenRoutes.add(route);
|
|
723
|
+
declined.push({ route, line: lineOf(fields.get("route") as Node, line) });
|
|
724
|
+
}
|
|
725
|
+
const reason = scalarText(fields.get("reason"))?.trim();
|
|
726
|
+
if (reason === undefined || reason === "") fault(fields.has("reason") ? lineOf(fields.get("reason") as Node, line) : line, "reason is required on every declined route (a non-empty string)", "say why this site does not carry the route, e.g. reason: \"this site sells from /pricing alone\".");
|
|
727
|
+
const decided = scalarText(fields.get("decided"));
|
|
728
|
+
if (!fields.has("decided")) fault(line, "decided is required on every declined route (<decider>, <YYYY-MM-DD>)", "record who decided and when, e.g. decided: \"Site Owner, 2026-11-02\".");
|
|
729
|
+
else {
|
|
730
|
+
const date = decided === undefined ? undefined : DECIDED_RE.exec(decided)?.[1];
|
|
731
|
+
if (date === undefined || Number.isNaN(Date.parse(date))) fault(lineOf(fields.get("decided") as Node, line), `decided ${JSON.stringify(decided ?? null)} is not <decider>, <YYYY-MM-DD>`, "write who decided and the date, e.g. decided: \"Site Owner, 2026-11-02\".");
|
|
732
|
+
}
|
|
733
|
+
});
|
|
645
734
|
}
|
|
646
735
|
}
|
|
647
736
|
if (list === undefined) {
|
|
648
737
|
fault(1, "customizations is required (a list; [] when the site has none)", "add `customizations: []`.");
|
|
649
|
-
return { entries, graceUntil };
|
|
738
|
+
return { entries, graceUntil, declined };
|
|
650
739
|
}
|
|
651
740
|
if (!isSeq(list)) {
|
|
652
741
|
fault(lineOf(list as Node, listLine), "customizations is not a list", "write `customizations: []` or a sequence of entries (- id: … / paths: … / request: … / decision: …).");
|
|
653
|
-
return { entries, graceUntil };
|
|
742
|
+
return { entries, graceUntil, declined };
|
|
654
743
|
}
|
|
655
744
|
const seen = new Set<string>();
|
|
656
745
|
list.items.forEach((item, index) => {
|
|
@@ -700,7 +789,50 @@ function readManifest(out: Violation[]): { entries: Entry[]; graceUntil: string
|
|
|
700
789
|
entries.push({ id, line, patterns, decision });
|
|
701
790
|
}
|
|
702
791
|
});
|
|
703
|
-
return { entries, graceUntil };
|
|
792
|
+
return { entries, graceUntil, declined };
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* The template routes a site-relative file sits in — its route directory and
|
|
797
|
+
* every ancestor of it, since a declined route covers its sub-routes.
|
|
798
|
+
*/
|
|
799
|
+
function templateRoutesOf(path: string): string[] {
|
|
800
|
+
if (!path.startsWith(`${ROUTE_ROOT}/`)) return [];
|
|
801
|
+
const dirs = path.slice(ROUTE_ROOT.length + 1).split("/").slice(0, -1);
|
|
802
|
+
const cut = dirs.findIndex((d) => NON_ROUTE_DIRS.has(d));
|
|
803
|
+
const route = cut === -1 ? dirs : dirs.slice(0, cut);
|
|
804
|
+
return route.map((_, i) => route.slice(0, i + 1).join("/"));
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* The template routes this site can know of (#11260): every route directory
|
|
809
|
+
* of the installed create-ailk's `templates/` (the root `devDependencies`
|
|
810
|
+
* pin, resolved the way node resolves it — the nearest `node_modules` at or
|
|
811
|
+
* above the site), plus every route a template record row sits in. Null
|
|
812
|
+
* when neither is there to read.
|
|
813
|
+
*/
|
|
814
|
+
function knownTemplateRoutes(record: Set<string> | null): Set<string> | null {
|
|
815
|
+
const out = new Set<string>();
|
|
816
|
+
let readable = record !== null;
|
|
817
|
+
for (let at = ROOT; ; at = dirname(at)) {
|
|
818
|
+
const pkg = join(at, "node_modules", "create-ailk");
|
|
819
|
+
if (existsSync(join(pkg, "package.json"))) {
|
|
820
|
+
const templates = join(pkg, "templates");
|
|
821
|
+
const routes = join(templates, ...ROUTE_ROOT.split("/"));
|
|
822
|
+
if (existsSync(routes)) {
|
|
823
|
+
readable = true;
|
|
824
|
+
for (const file of walk(routes, /./)) {
|
|
825
|
+
for (const route of templateRoutesOf(toPosix(relative(templates, file)))) out.add(route);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
break;
|
|
829
|
+
}
|
|
830
|
+
if (dirname(at) === at) break;
|
|
831
|
+
}
|
|
832
|
+
for (const path of record ?? []) {
|
|
833
|
+
for (const route of templateRoutesOf(path)) out.add(route);
|
|
834
|
+
}
|
|
835
|
+
return readable ? out : null;
|
|
704
836
|
}
|
|
705
837
|
|
|
706
838
|
function checkCustomizations(cfg: ArchConfig): Violation[] {
|
|
@@ -709,7 +841,7 @@ function checkCustomizations(cfg: ArchConfig): Violation[] {
|
|
|
709
841
|
const out: Violation[] = [];
|
|
710
842
|
const parsed = readManifest(out);
|
|
711
843
|
if (parsed === null) return out;
|
|
712
|
-
const { entries, graceUntil } = parsed;
|
|
844
|
+
const { entries, graceUntil, declined } = parsed;
|
|
713
845
|
const manifest = join(ROOT, MANIFEST_PATH);
|
|
714
846
|
const today = new Date().toISOString().slice(0, 10);
|
|
715
847
|
|
|
@@ -727,6 +859,27 @@ function checkCustomizations(cfg: ArchConfig): Violation[] {
|
|
|
727
859
|
}
|
|
728
860
|
|
|
729
861
|
const record = readRecord();
|
|
862
|
+
|
|
863
|
+
// #11260 — a declined route names a route the template carries.
|
|
864
|
+
if (declined.length > 0) {
|
|
865
|
+
const known = knownTemplateRoutes(record);
|
|
866
|
+
if (known === null) {
|
|
867
|
+
warnings.push(
|
|
868
|
+
`architecture: warning — no installed create-ailk and no ${RECORD_PATH}: the declined_routes entries cannot be checked against the template's routes`,
|
|
869
|
+
);
|
|
870
|
+
} else {
|
|
871
|
+
for (const d of declined) {
|
|
872
|
+
if (known.has(d.route)) continue;
|
|
873
|
+
out.push({
|
|
874
|
+
file: manifest,
|
|
875
|
+
line: d.line,
|
|
876
|
+
rule: `declined route ${JSON.stringify(d.route)} is not a template route`,
|
|
877
|
+
reason: `Fix: name a route the template carries, as it sits under ${ROUTE_ROOT}/ (e.g. "pricing/[slug]"), or remove the entry.`,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
730
883
|
if (record === null) {
|
|
731
884
|
warnings.push(NO_RECORD_WARNING);
|
|
732
885
|
return out;
|
package/versions.json
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@working-theory/
|
|
3
|
-
"@working-theory/
|
|
4
|
-
"@working-theory/
|
|
2
|
+
"@working-theory/account": "0.62.0",
|
|
3
|
+
"@working-theory/admin-ui": "0.62.0",
|
|
4
|
+
"@working-theory/aeo": "0.62.0",
|
|
5
|
+
"@working-theory/agent-context": "0.62.0",
|
|
5
6
|
"@working-theory/agent-contract": "0.1.0",
|
|
6
7
|
"@working-theory/agent-memory": "0.0.0",
|
|
7
8
|
"@working-theory/ai": "0.1.0",
|
|
8
|
-
"@working-theory/analytics": "0.
|
|
9
|
-
"@working-theory/api": "0.
|
|
10
|
-
"@working-theory/api-client": "0.
|
|
9
|
+
"@working-theory/analytics": "0.62.0",
|
|
10
|
+
"@working-theory/api": "0.62.0",
|
|
11
|
+
"@working-theory/api-client": "0.62.0",
|
|
11
12
|
"@working-theory/cda-filesystem": "0.0.0",
|
|
12
|
-
"@working-theory/cli": "0.
|
|
13
|
-
"@working-theory/common": "0.
|
|
13
|
+
"@working-theory/cli": "0.62.0",
|
|
14
|
+
"@working-theory/common": "0.62.0",
|
|
14
15
|
"@working-theory/consent": "0.1.0",
|
|
15
|
-
"@working-theory/content-adapters": "0.
|
|
16
|
-
"@working-theory/content-projection": "0.
|
|
17
|
-
"@working-theory/email": "0.
|
|
16
|
+
"@working-theory/content-adapters": "0.62.0",
|
|
17
|
+
"@working-theory/content-projection": "0.62.0",
|
|
18
|
+
"@working-theory/email": "0.62.0",
|
|
18
19
|
"@working-theory/env": "0.0.0",
|
|
19
|
-
"@working-theory/eslint-config": "0.
|
|
20
|
-
"@working-theory/fumadocs-schema": "0.
|
|
20
|
+
"@working-theory/eslint-config": "0.62.0",
|
|
21
|
+
"@working-theory/fumadocs-schema": "0.62.0",
|
|
21
22
|
"@working-theory/ids": "0.20.1",
|
|
22
|
-
"@working-theory/jsonld": "0.
|
|
23
|
-
"@working-theory/license": "0.
|
|
24
|
-
"@working-theory/mcp-server": "0.
|
|
25
|
-
"@working-theory/metadata": "0.
|
|
26
|
-
"@working-theory/observability": "0.
|
|
27
|
-
"@working-theory/page-renderer": "0.
|
|
23
|
+
"@working-theory/jsonld": "0.62.0",
|
|
24
|
+
"@working-theory/license": "0.62.0",
|
|
25
|
+
"@working-theory/mcp-server": "0.62.0",
|
|
26
|
+
"@working-theory/metadata": "0.62.0",
|
|
27
|
+
"@working-theory/observability": "0.62.0",
|
|
28
|
+
"@working-theory/page-renderer": "0.62.0",
|
|
28
29
|
"@working-theory/plugin-mcp": "0.1.3",
|
|
29
|
-
"@working-theory/schema": "0.
|
|
30
|
-
"@working-theory/schema-pack-registry": "0.
|
|
31
|
-
"@working-theory/schema-validator": "0.
|
|
32
|
-
"@working-theory/sections-registry": "0.
|
|
33
|
-
"@working-theory/site-config": "0.
|
|
34
|
-
"@working-theory/spoke-checkout": "0.7.
|
|
35
|
-
"@working-theory/stripe-client": "0.
|
|
36
|
-
"@working-theory/templates": "0.
|
|
37
|
-
"@working-theory/theme": "0.
|
|
38
|
-
"@working-theory/ui": "0.
|
|
39
|
-
"@working-theory/validation": "0.
|
|
40
|
-
"@working-theory/web-i18n": "0.
|
|
41
|
-
"@working-theory/admin": "0.
|
|
42
|
-
"@working-theory/api-commerce": "0.1.
|
|
43
|
-
"@working-theory/api-content-write": "0.
|
|
44
|
-
"@working-theory/api-hub": "0.6.
|
|
45
|
-
"@working-theory/api-multi-tenant": "0.3.
|
|
46
|
-
"@working-theory/api-scheduling": "0.6.
|
|
47
|
-
"@working-theory/api-signal-collectors": "0.6.
|
|
48
|
-
"@working-theory/api-workspace": "0.
|
|
30
|
+
"@working-theory/schema": "0.62.0",
|
|
31
|
+
"@working-theory/schema-pack-registry": "0.62.0",
|
|
32
|
+
"@working-theory/schema-validator": "0.62.0",
|
|
33
|
+
"@working-theory/sections-registry": "0.62.0",
|
|
34
|
+
"@working-theory/site-config": "0.62.0",
|
|
35
|
+
"@working-theory/spoke-checkout": "0.7.18",
|
|
36
|
+
"@working-theory/stripe-client": "0.62.0",
|
|
37
|
+
"@working-theory/templates": "0.62.0",
|
|
38
|
+
"@working-theory/theme": "0.62.0",
|
|
39
|
+
"@working-theory/ui": "0.62.0",
|
|
40
|
+
"@working-theory/validation": "0.62.0",
|
|
41
|
+
"@working-theory/web-i18n": "0.62.0",
|
|
42
|
+
"@working-theory/admin": "0.16.0",
|
|
43
|
+
"@working-theory/api-commerce": "0.1.16",
|
|
44
|
+
"@working-theory/api-content-write": "0.10.0",
|
|
45
|
+
"@working-theory/api-hub": "0.6.1",
|
|
46
|
+
"@working-theory/api-multi-tenant": "0.3.2",
|
|
47
|
+
"@working-theory/api-scheduling": "0.6.1",
|
|
48
|
+
"@working-theory/api-signal-collectors": "0.6.2",
|
|
49
|
+
"@working-theory/api-workspace": "0.10.0",
|
|
49
50
|
"@working-theory/billing-client": "0.0.0",
|
|
50
51
|
"@working-theory/branding": "0.0.0",
|
|
51
52
|
"@working-theory/license-client": "0.0.0",
|
|
52
53
|
"@working-theory/license-manifest": "0.0.0",
|
|
53
|
-
"@working-theory/mcp-scheduling": "0.4.
|
|
54
|
-
"@working-theory/mcp-signal-collectors": "0.2.
|
|
55
|
-
"@working-theory/mcp-workspace": "0.
|
|
54
|
+
"@working-theory/mcp-scheduling": "0.4.3",
|
|
55
|
+
"@working-theory/mcp-signal-collectors": "0.2.16",
|
|
56
|
+
"@working-theory/mcp-workspace": "0.9.0",
|
|
56
57
|
"@working-theory/partner-session": "0.0.0",
|
|
57
58
|
"@working-theory/preview-protocol": "0.0.0",
|
|
58
|
-
"@working-theory/ui-commerce": "0.
|
|
59
|
-
"@working-theory/ui-docs-blog": "0.
|
|
60
|
-
"@working-theory/ui-scheduling": "0.
|
|
61
|
-
"@working-theory/ui-signal-collectors": "0.
|
|
59
|
+
"@working-theory/ui-commerce": "0.62.0",
|
|
60
|
+
"@working-theory/ui-docs-blog": "0.62.0",
|
|
61
|
+
"@working-theory/ui-scheduling": "0.62.0",
|
|
62
|
+
"@working-theory/ui-signal-collectors": "0.62.0",
|
|
62
63
|
"@working-theory/web": "0.0.0",
|
|
63
64
|
"@working-theory/app-api": "1.0.0",
|
|
64
65
|
"@working-theory/mcp": "0.0.0",
|
|
65
|
-
"@working-theory/database": "0.
|
|
66
|
+
"@working-theory/database": "0.62.0"
|
|
66
67
|
}
|
package/templates/apps/web/app/[locale]/(authed)/account/__tests__/account-frame-sign-out.test.tsx
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Log out in AccountFrame (#8465).
|
|
3
|
-
*
|
|
4
|
-
* A spoke that signs in through its hub holds its session in the sealed
|
|
5
|
-
* hub-session cookie, which only `POST /api/hub-session/sign-out` clears
|
|
6
|
-
* (and which also revokes the hub credential); Better Auth's `signOut()` hits
|
|
7
|
-
* a route that spoke does not serve. The server layout hands the seam's
|
|
8
|
-
* `SIGN_OUT_ENDPOINT` down as `signOutEndpoint`:
|
|
9
|
-
*
|
|
10
|
-
* - with an endpoint, Log out POSTs it (same-origin), never calls Better
|
|
11
|
-
* Auth, and lands on the sign-in page once the answer is 2xx;
|
|
12
|
-
* - a refused or failed sign-out (403 on an Origin mismatch, 5xx, a
|
|
13
|
-
* rejected fetch) stays on the page, shows the translated error, and
|
|
14
|
-
* navigates nowhere — the cookie is still valid (#8467 review addendum);
|
|
15
|
-
* - without an endpoint (a hub or a single site) it calls Better Auth and
|
|
16
|
-
* routes home, as before.
|
|
17
|
-
*/
|
|
18
|
-
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
19
|
-
import type { ReactNode } from "react";
|
|
20
|
-
|
|
21
|
-
const mockSignOut = jest.fn();
|
|
22
|
-
jest.mock("better-auth/react", () => ({
|
|
23
|
-
__esModule: true,
|
|
24
|
-
createAuthClient: () => ({
|
|
25
|
-
signOut: (...args: unknown[]) => mockSignOut(...args),
|
|
26
|
-
}),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
const mockPush = jest.fn();
|
|
30
|
-
const mockRefresh = jest.fn();
|
|
31
|
-
jest.mock("next/navigation", () => ({
|
|
32
|
-
__esModule: true,
|
|
33
|
-
useRouter: () => ({ push: mockPush, refresh: mockRefresh }),
|
|
34
|
-
usePathname: () => "/account",
|
|
35
|
-
useSearchParams: () => new URLSearchParams(""),
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
jest.mock("@working-theory/templates/shells", () => ({
|
|
39
|
-
__esModule: true,
|
|
40
|
-
SignedInShell: ({
|
|
41
|
-
onSignOut,
|
|
42
|
-
children,
|
|
43
|
-
}: {
|
|
44
|
-
onSignOut: () => void;
|
|
45
|
-
children: ReactNode;
|
|
46
|
-
}) => (
|
|
47
|
-
<div>
|
|
48
|
-
<button type="button" data-testid="sign-out" onClick={onSignOut} />
|
|
49
|
-
{children}
|
|
50
|
-
</div>
|
|
51
|
-
),
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
jest.mock("@working-theory/templates/account", () => ({
|
|
55
|
-
__esModule: true,
|
|
56
|
-
ForYouPanel: () => null,
|
|
57
|
-
PhoneTabProvider: ({ children }: { children: ReactNode }) => children,
|
|
58
|
-
useForYouDismissed: () => [new Set<string>(), jest.fn()],
|
|
59
|
-
}));
|
|
60
|
-
|
|
61
|
-
import { AccountFrame, type AccountFrameProps } from "../account-frame";
|
|
62
|
-
|
|
63
|
-
const ENDPOINT = "/api/hub-session/sign-out";
|
|
64
|
-
const FAILED = "We couldn't log you out. You're still signed in; try again.";
|
|
65
|
-
const mockFetch = jest.fn();
|
|
66
|
-
|
|
67
|
-
function renderFrame(extra: Partial<AccountFrameProps> = {}): void {
|
|
68
|
-
render(
|
|
69
|
-
<AccountFrame
|
|
70
|
-
locale="en"
|
|
71
|
-
user={{ name: "Ada", email: "ada@example.com" }}
|
|
72
|
-
logo={null}
|
|
73
|
-
helpItems={[]}
|
|
74
|
-
// eslint-disable-next-line no-restricted-syntax -- partial fixture: the suite exercises only the sign-out form, so the full forYou/labels shapes are not built
|
|
75
|
-
forYou={{ items: [] } as unknown as AccountFrameProps["forYou"]}
|
|
76
|
-
labels={
|
|
77
|
-
// eslint-disable-next-line no-restricted-syntax -- partial fixture (see forYou above)
|
|
78
|
-
{
|
|
79
|
-
home: "Home",
|
|
80
|
-
signOutFailed: FAILED,
|
|
81
|
-
} as unknown as AccountFrameProps["labels"]
|
|
82
|
-
}
|
|
83
|
-
{...extra}
|
|
84
|
-
>
|
|
85
|
-
<p>page</p>
|
|
86
|
-
</AccountFrame>,
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
beforeEach(() => {
|
|
91
|
-
jest.clearAllMocks();
|
|
92
|
-
globalThis.fetch = mockFetch.mockResolvedValue({ ok: true, status: 204 });
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
describe("AccountFrame Log out — a spoke that signs in through its hub", () => {
|
|
96
|
-
it("POSTs the hub sign-out endpoint, never Better Auth, then lands on the sign-in page and refreshes", async () => {
|
|
97
|
-
renderFrame({ signOutEndpoint: ENDPOINT, signInHref: "/account" });
|
|
98
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
99
|
-
await waitFor(() => expect(mockPush).toHaveBeenCalledWith("/account"));
|
|
100
|
-
expect(mockFetch).toHaveBeenCalledWith(ENDPOINT, {
|
|
101
|
-
method: "POST",
|
|
102
|
-
credentials: "same-origin",
|
|
103
|
-
});
|
|
104
|
-
expect(mockSignOut).not.toHaveBeenCalled();
|
|
105
|
-
expect(mockRefresh).toHaveBeenCalledTimes(1);
|
|
106
|
-
expect(
|
|
107
|
-
screen.queryByTestId("account-sign-out-error"),
|
|
108
|
-
).not.toBeInTheDocument();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("falls back to the site home when no sign-in href is given", async () => {
|
|
112
|
-
renderFrame({ signOutEndpoint: ENDPOINT });
|
|
113
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
114
|
-
await waitFor(() => expect(mockPush).toHaveBeenCalledWith("/"));
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it.each([
|
|
118
|
-
["a 403 (Origin mismatch)", { ok: false, status: 403 }],
|
|
119
|
-
["a 500", { ok: false, status: 500 }],
|
|
120
|
-
["a 404", { ok: false, status: 404 }],
|
|
121
|
-
])(
|
|
122
|
-
"%s stays on the page with the error and routes nowhere",
|
|
123
|
-
async (_label, response) => {
|
|
124
|
-
mockFetch.mockResolvedValue(response);
|
|
125
|
-
renderFrame({ signOutEndpoint: ENDPOINT, signInHref: "/account" });
|
|
126
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
127
|
-
expect(
|
|
128
|
-
await screen.findByTestId("account-sign-out-error"),
|
|
129
|
-
).toHaveTextContent(FAILED);
|
|
130
|
-
expect(mockPush).not.toHaveBeenCalled();
|
|
131
|
-
expect(mockRefresh).not.toHaveBeenCalled();
|
|
132
|
-
expect(mockSignOut).not.toHaveBeenCalled();
|
|
133
|
-
},
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
it("a rejected request stays on the page with the error and routes nowhere", async () => {
|
|
137
|
-
mockFetch.mockRejectedValue(new TypeError("network down"));
|
|
138
|
-
renderFrame({ signOutEndpoint: ENDPOINT, signInHref: "/account" });
|
|
139
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
140
|
-
expect(
|
|
141
|
-
await screen.findByTestId("account-sign-out-error"),
|
|
142
|
-
).toHaveTextContent(FAILED);
|
|
143
|
-
expect(mockPush).not.toHaveBeenCalled();
|
|
144
|
-
expect(mockRefresh).not.toHaveBeenCalled();
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it("a retry that succeeds clears the error and lands on the sign-in page", async () => {
|
|
148
|
-
mockFetch.mockResolvedValueOnce({ ok: false, status: 500 });
|
|
149
|
-
renderFrame({ signOutEndpoint: ENDPOINT, signInHref: "/account" });
|
|
150
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
151
|
-
await screen.findByTestId("account-sign-out-error");
|
|
152
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
153
|
-
await waitFor(() => expect(mockPush).toHaveBeenCalledWith("/account"));
|
|
154
|
-
expect(
|
|
155
|
-
screen.queryByTestId("account-sign-out-error"),
|
|
156
|
-
).not.toBeInTheDocument();
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
describe("AccountFrame Log out — a hub or a single site", () => {
|
|
161
|
-
it.each([
|
|
162
|
-
["absent", {}],
|
|
163
|
-
["null", { signOutEndpoint: null }],
|
|
164
|
-
])(
|
|
165
|
-
"with the endpoint %s calls Better Auth, then routes home and refreshes",
|
|
166
|
-
async (_label, extra) => {
|
|
167
|
-
renderFrame(extra);
|
|
168
|
-
fireEvent.click(screen.getByTestId("sign-out"));
|
|
169
|
-
await waitFor(() => expect(mockPush).toHaveBeenCalledWith("/"));
|
|
170
|
-
expect(mockSignOut).toHaveBeenCalledTimes(1);
|
|
171
|
-
expect(mockFetch).not.toHaveBeenCalled();
|
|
172
|
-
expect(mockRefresh).toHaveBeenCalledTimes(1);
|
|
173
|
-
},
|
|
174
|
-
);
|
|
175
|
-
});
|