create-ailk 0.37.1 → 0.39.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 +19 -12
- 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 +12 -16
- 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 +73 -2
- package/dist/routes.d.ts +130 -0
- package/dist/routes.js +954 -0
- package/dist/site-manifest.js +6 -4
- package/dist/site-roster.d.ts +11 -2
- package/dist/site-roster.js +63 -21
- package/dist/spoke-checkout.d.ts +28 -27
- package/dist/spoke-checkout.js +71 -102
- package/dist/surfaces.d.ts +26 -0
- package/dist/surfaces.js +105 -293
- package/dist/sync-routes.d.ts +14 -1
- package/dist/sync-routes.js +108 -10
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +26 -1
- package/dist/topology.js +273 -7
- 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 +87 -23
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +5 -1
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +5 -1
- package/templates/apps/web/__tests__/auth/seam.test.ts +34 -0
- package/templates/apps/web/account.config.tsx +100 -0
- package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
- package/templates/apps/web/app/[locale]/(authed)/account/connect/page.tsx +2 -2
- package/templates/apps/web/app/[locale]/(authed)/signed-out-gate.generated.tsx +1 -1
- package/templates/apps/web/app/[locale]/layout.tsx +46 -29
- 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/auth.config.tsx +107 -0
- package/templates/apps/web/auth.ts +2 -1
- package/templates/apps/web/i18n/request.ts +51 -1
- package/templates/apps/web/jest.config.cjs +17 -1
- package/templates/apps/web/lib/__tests__/auth-phone.test.ts +11 -0
- package/templates/apps/web/lib/__tests__/fixtures/site-topology.ts +73 -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/server-api.ts +1 -1
- package/templates/apps/web/lib/site-brand.tsx +3 -5
- package/templates/apps/web/lib/topology.generated.ts +5 -0
- package/templates/apps/web/messages/en.json +8 -836
- package/templates/apps/web/middleware.ts +15 -26
- package/templates/apps/web/next.config.mjs +35 -0
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/types/messages.d.ts +6 -1
- package/templates/customizations.yaml +9 -0
- package/templates/package.json +3 -1
- package/templates/tools/lint-architecture.ts +164 -11
- package/versions.json +49 -47
- package/templates/apps/web/app/[locale]/(auth)/__tests__/auth-pages.test.tsx +0 -322
- package/templates/apps/web/app/[locale]/(auth)/__tests__/password-reset.test.tsx +0 -554
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/consent-actions.test.ts +0 -56
- package/templates/apps/web/app/[locale]/(auth)/consent/__tests__/page.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/(auth)/consent/consent-form.tsx +0 -132
- package/templates/apps/web/app/[locale]/(auth)/consent/consent.actions.ts +0 -51
- package/templates/apps/web/app/[locale]/(auth)/consent/page.tsx +0 -144
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/forgot-password-card.tsx +0 -101
- package/templates/apps/web/app/[locale]/(auth)/forgot-password/page.tsx +0 -111
- package/templates/apps/web/app/[locale]/(auth)/layout.tsx +0 -81
- package/templates/apps/web/app/[locale]/(auth)/legal-footnote.tsx +0 -35
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +0 -179
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +0 -157
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +0 -126
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/next-path.test.ts +0 -54
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/page.test.tsx +0 -628
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/remembered-method.test.ts +0 -43
- package/templates/apps/web/app/[locale]/(auth)/sign-in/__tests__/sign-in-card.test.tsx +0 -266
- package/templates/apps/web/app/[locale]/(auth)/sign-in/next-path.ts +0 -20
- package/templates/apps/web/app/[locale]/(auth)/sign-in/page.tsx +0 -234
- package/templates/apps/web/app/[locale]/(auth)/sign-in/remembered-method.ts +0 -37
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-card.tsx +0 -323
- package/templates/apps/web/app/[locale]/(auth)/sign-in/sign-in-text.ts +0 -93
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/page.test.tsx +0 -301
- package/templates/apps/web/app/[locale]/(auth)/sign-up/__tests__/sign-up-card.test.tsx +0 -309
- package/templates/apps/web/app/[locale]/(auth)/sign-up/page.tsx +0 -201
- package/templates/apps/web/app/[locale]/(auth)/sign-up/sign-up-card.tsx +0 -366
- package/templates/apps/web/app/[locale]/(auth)/use-auth-card-flow.ts +0 -116
- package/templates/apps/web/app/[locale]/(auth)/verify-email/__tests__/actions.test.ts +0 -94
- package/templates/apps/web/app/[locale]/(auth)/verify-email/actions.ts +0 -77
- package/templates/apps/web/app/[locale]/(auth)/verify-email/page.tsx +0 -154
- 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/[slug]/page.tsx +0 -161
- 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/appointments/page.tsx +0 -139
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +0 -406
- 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/[pieceId]/versions/[version]/file/route.ts +0 -190
- 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/artifacts/page.tsx +0 -182
- 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/page.tsx +0 -424
- 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/page.tsx +0 -218
- 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/[kind]/[id]/page.tsx +0 -119
- 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/message/[id]/file/route.ts +0 -80
- 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/page.tsx +0 -125
- 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/invitations/[invitationId]/page.tsx +0 -154
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +0 -152
- 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/notifications/page.tsx +0 -143
- 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/onboarding/page.tsx +0 -126
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +0 -306
- 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/privacy/export/route.ts +0 -102
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +0 -240
- 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/page.tsx +0 -131
- 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/page.tsx +0 -24
- 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/page.tsx +0 -60
- 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/app/api/auth/[...all]/route.ts +0 -16
- package/templates/apps/web/app/api/auth/hub/__tests__/continuation.test.ts +0 -143
- package/templates/apps/web/app/api/auth/hub/__tests__/entry-routes.test.ts +0 -749
- package/templates/apps/web/app/api/auth/hub/authorize/__tests__/route.test.ts +0 -964
- package/templates/apps/web/app/api/auth/hub/authorize/route.ts +0 -390
- package/templates/apps/web/app/api/auth/hub/continuation.ts +0 -127
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/__tests__/route.test.ts +0 -188
- package/templates/apps/web/app/api/auth/hub/continue/[ref]/route.ts +0 -53
- package/templates/apps/web/app/api/auth/hub/email/route.ts +0 -111
- package/templates/apps/web/app/api/auth/hub/entry-shared.ts +0 -163
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +0 -368
- package/templates/apps/web/app/api/auth/hub/password/return.ts +0 -86
- package/templates/apps/web/app/api/auth/hub/password/route.ts +0 -171
- package/templates/apps/web/app/api/auth/hub/purchase/route.ts +0 -230
- package/templates/apps/web/app/api/auth/hub/purchase-link/route.ts +0 -174
- package/templates/apps/web/app/api/auth/hub/sign-up/route.ts +0 -60
- package/templates/apps/web/app/api/auth/hub/sign-up-evidence.ts +0 -97
- package/templates/apps/web/app/api/auth/mcp/__tests__/continuation.test.ts +0 -92
- package/templates/apps/web/app/api/auth/mcp/continuation.ts +0 -89
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/__tests__/route.test.ts +0 -59
- package/templates/apps/web/app/api/auth/mcp/continue/[ref]/route.ts +0 -41
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +0 -1166
- package/templates/apps/web/app/api/hub-session/callback/route.ts +0 -134
- package/templates/apps/web/app/api/hub-session/email/route.ts +0 -125
- package/templates/apps/web/app/api/hub-session/one-tap/nonce/route.ts +0 -49
- package/templates/apps/web/app/api/hub-session/one-tap/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/open/route.ts +0 -111
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +0 -69
- package/templates/apps/web/app/api/hub-session/password/route.ts +0 -106
- package/templates/apps/web/app/api/hub-session/sign-in/route.ts +0 -91
- package/templates/apps/web/app/api/hub-session/sign-out/route.ts +0 -54
- package/templates/apps/web/components/sign-out-trigger.tsx +0 -62
- package/templates/apps/web/lib/__tests__/account-config.test.ts +0 -704
- package/templates/apps/web/lib/__tests__/auth-routes.test.ts +0 -140
- package/templates/apps/web/lib/account-config.ts +0 -678
- package/templates/apps/web/lib/auth-routes.ts +0 -125
- package/templates/apps/web/lib/checkout-config.ts +0 -16
- package/templates/apps/web/lib/hub-session/__tests__/hub-session.test.ts +0 -433
- package/templates/apps/web/lib/hub-session/__tests__/spoke-sign-in.test.tsx +0 -332
- package/templates/apps/web/lib/hub-session/config.ts +0 -110
- package/templates/apps/web/lib/hub-session/entry.ts +0 -238
- package/templates/apps/web/lib/hub-session/index.ts +0 -21
- package/templates/apps/web/lib/hub-session/one-tap.tsx +0 -148
- package/templates/apps/web/lib/hub-session/reseal.ts +0 -90
- package/templates/apps/web/lib/hub-session/seal.ts +0 -86
- package/templates/apps/web/lib/hub-session/session.ts +0 -298
- package/templates/apps/web/lib/hub-session/spoke-sign-in.tsx +0 -277
- package/templates/apps/web/lib/next-path.ts +0 -35
- package/templates/apps/web/src/lib/__tests__/commerce-sections.test.ts +0 -57
- package/templates/apps/web/src/lib/commerce-sections.ts +0 -55
|
@@ -18,9 +18,9 @@ import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH } from "./pa
|
|
|
18
18
|
import { SITE_CHROME_PATH } from "./site-chrome.js";
|
|
19
19
|
import { SITE_FONTS_PATH } from "./site-fonts.js";
|
|
20
20
|
import { SITE_LISTING_PATH } from "./site-listing-path.js";
|
|
21
|
-
import { SPOKE_CHECKOUT_CONFIG_PATH
|
|
21
|
+
import { SPOKE_CHECKOUT_CONFIG_PATH } from "./spoke-checkout.js";
|
|
22
22
|
import { CORE_SURFACE_PATHS, NAV_CONFIG_PATH, RECOGNIZED_SURFACES, resolveSurfaces, } from "./surfaces.js";
|
|
23
|
-
import { SPOKE_SEAM_FILES } from "./topology.js";
|
|
23
|
+
import { AUTH_CONFIG_PATH, SPOKE_SEAM_FILES } from "./topology.js";
|
|
24
24
|
/** The npm scope a site consumes and never forks (#9191). */
|
|
25
25
|
const PACKAGE_SCOPE = "@working-theory/";
|
|
26
26
|
/** Apps whose `package.json` name is not `@working-theory/<dir>`, because the published package took it (#9564, #9570). */
|
|
@@ -51,14 +51,6 @@ export const SPOKE_BILLING_ACTION_PATH = "apps/web/app/[locale]/(authed)/account
|
|
|
51
51
|
export const SPOKE_CHECKOUT_ROUTE_FILES = Object.freeze([
|
|
52
52
|
SPOKE_BILLING_ACTION_PATH,
|
|
53
53
|
]);
|
|
54
|
-
/**
|
|
55
|
-
* The spoke files that may import @working-theory/spoke-checkout to READ a
|
|
56
|
-
* paid session, and nothing else: the thank-you page's `readPaidCheckoutEmail`
|
|
57
|
-
* (#8757 D13).
|
|
58
|
-
*/
|
|
59
|
-
export const SPOKE_CHECKOUT_READER_FILES = Object.freeze([
|
|
60
|
-
"apps/web/app/[locale]/checkout/thank-you/page.tsx",
|
|
61
|
-
]);
|
|
62
54
|
/**
|
|
63
55
|
* A line-level regex for an import of `specifier` or one of its subpaths, in
|
|
64
56
|
* every form the line can take: `from "…"` (a static or re-export, including
|
|
@@ -75,7 +67,7 @@ function specifierForm(specifier) {
|
|
|
75
67
|
/** P1 with no exclusions — a kept apps/mcp's form; apps/web adds the route files. */
|
|
76
68
|
const SPOKE_CHECKOUT_PATTERN = Object.freeze({
|
|
77
69
|
pattern: specifierForm("@working-theory/spoke-checkout"),
|
|
78
|
-
reason: "Spoke checkout: only the billing action
|
|
70
|
+
reason: "Spoke checkout: only the billing action may import @working-theory/spoke-checkout (brief Part 2 §2, #7873, #8217, #8757, #9142, #11253)",
|
|
79
71
|
});
|
|
80
72
|
const STRIPE_CLIENT_PATTERN = Object.freeze({
|
|
81
73
|
pattern: specifierForm("@working-theory/stripe-client"),
|
|
@@ -89,7 +81,9 @@ const STRIPE_SDK_PATTERN = Object.freeze({
|
|
|
89
81
|
export const SPOKE_WEB_FORBIDDEN_PATTERNS = Object.freeze([
|
|
90
82
|
Object.freeze({
|
|
91
83
|
...SPOKE_CHECKOUT_PATTERN,
|
|
92
|
-
|
|
84
|
+
// #11253 D8 — the thank-you page's paid-session read now ships in
|
|
85
|
+
// @working-theory/ui-commerce; no file in a spoke's apps/web reads one.
|
|
86
|
+
paths_excluded: [...SPOKE_CHECKOUT_ROUTE_FILES],
|
|
93
87
|
}),
|
|
94
88
|
STRIPE_CLIENT_PATTERN,
|
|
95
89
|
STRIPE_SDK_PATTERN,
|
|
@@ -353,6 +347,8 @@ export function deriveArchitecture(modules = ["marketing"], surfaces, options =
|
|
|
353
347
|
MODULE_FLAGS_PATH,
|
|
354
348
|
PAID_MCP_TOOLS_PATH,
|
|
355
349
|
...SPOKE_SEAM_FILES,
|
|
350
|
+
// #11257 D4 — rewritten in its spoke shape on a spoke, as the seams are.
|
|
351
|
+
AUTH_CONFIG_PATH,
|
|
356
352
|
SPOKE_CHECKOUT_CONFIG_PATH,
|
|
357
353
|
SPOKE_BILLING_ACTION_PATH,
|
|
358
354
|
SITE_LISTING_PATH,
|
|
@@ -365,12 +361,12 @@ export function deriveArchitecture(modules = ["marketing"], surfaces, options =
|
|
|
365
361
|
modulePaths.push(`${s.installRoot.replace(/\/$/, "")}/**`);
|
|
366
362
|
modulePaths.push(...(s.patches ?? []).map((p) => p.target));
|
|
367
363
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
// #11253 — the checkout and purchase route files are generated, which the
|
|
365
|
+
// site's lint admits by their header (`isGeneratedRoute`, #11252); the
|
|
366
|
+
// config and the stamp are commerce `ownedFiles`, so neither needs a glob.
|
|
371
367
|
const customizations = {
|
|
372
368
|
manifest: "customizations.yaml",
|
|
373
|
-
scaffold_paths: sortedUnion(generatorPaths,
|
|
369
|
+
scaffold_paths: sortedUnion(generatorPaths, modulePaths.filter((p) => p.startsWith("apps/") && inScaffold(p))),
|
|
374
370
|
};
|
|
375
371
|
const doc = {
|
|
376
372
|
version: ARCHITECTURE_BASE.version,
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { APPLY_DESIGN_HELP, UnreadChromeError, applyDesign, formatApplyDesignRep
|
|
|
14
14
|
export type { HomeSeedOutcome } from "./design-home.js";
|
|
15
15
|
export { SITE_ROSTER_PATH, readSiteRoster, siteRosterProblems, } from "./site-roster.js";
|
|
16
16
|
export { SYNC_ROUTES_HELP, formatSyncRoutesReport, listTemplateRouteDirs, parseSyncRoutesArgs, syncRoutes, type RouteReport, type SyncRoutesOptions, type SyncRoutesResult, } from "./sync-routes.js";
|
|
17
|
+
export { ROUTES_APP_DIR, ROUTES_HELP, RoutesRefusedError, checkRoutes, formatRoutesReport, parseRouteManifest, parseRoutesArgs, readRouteManifests, renderRouteFile, routesFailing, writeRoutes, type ManifestMessages, type RecordedRoute, type RouteEntry, type RouteKind, type RouteManifest, type RoutesArgs, type RoutesDrift, type WriteRoutesResult, } from "./routes.js";
|
|
17
18
|
export { deriveArchitecture } from "./derive-architecture.js";
|
|
18
19
|
export { CORE_ROUTE_DIRS, CORE_SURFACE_PATHS, NAV_CONFIG_PATH, GATEABLE_SURFACES, MODULE_SURFACES, RECOGNIZED_SURFACES, ROUTE_SINCE, SurfaceError, excludedContentPaths, excludedRoutePaths, isUnservedSurfaceContent, isUnservedSurfaceRoute, parseSurfaces, renderNavConfig, resolveSurfaces, surfaceForRouteDir, type Surface, } from "./surfaces.js";
|
|
19
20
|
export { substituteMarkers, substituteWorkspaceVersions, type MarkerMap, type WorkspaceVersionMap, } from "./substitute.js";
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,9 @@ export { SITE_ROSTER_PATH, readSiteRoster, siteRosterProblems, } from "./site-ro
|
|
|
25
25
|
// `create-ailk sync-routes` (#4986) — the template-route drift check + copy.
|
|
26
26
|
// The pure module is exported so tooling can run it against any template dir.
|
|
27
27
|
export { SYNC_ROUTES_HELP, formatSyncRoutesReport, listTemplateRouteDirs, parseSyncRoutesArgs, syncRoutes, } from "./sync-routes.js";
|
|
28
|
+
// `create-ailk routes --write | --check` (#11219, ADR 0040) — the one
|
|
29
|
+
// route-file generator over the installed page packages' manifests.
|
|
30
|
+
export { ROUTES_APP_DIR, ROUTES_HELP, RoutesRefusedError, checkRoutes, formatRoutesReport, parseRouteManifest, parseRoutesArgs, readRouteManifests, renderRouteFile, routesFailing, writeRoutes, } from "./routes.js";
|
|
28
31
|
// The module-set → architecture.yaml derivation. Exported so the sync path
|
|
29
32
|
// (re-derive after a module is added) can re-run it (spec #3787 §2.1). The
|
|
30
33
|
// module→slice registry it composes is an internal detail, deliberately not
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
* the collection (D6), and an API without it (`402`, `403`, `404`) turns the
|
|
20
20
|
* pass off for the run, so pages import inline as they did before.
|
|
21
21
|
*
|
|
22
|
+
* `seedTopics` (below) is the seed file's other half: each of its `topics[]`
|
|
23
|
+
* becomes one Topic holding all its keywords (lang-topic-fields).
|
|
24
|
+
*
|
|
22
25
|
* The key travels only as `authorization: Bearer <key>`, never across a
|
|
23
26
|
* redirect; of an API answer only a status and a `[a-z0-9_]` code reach a
|
|
24
27
|
* line, and no line carries an answer's words (SEC-7876-S1).
|
|
@@ -124,4 +127,94 @@ export declare function renderChangeLine(c: LanguageImportResult["renderChanges"
|
|
|
124
127
|
export declare function languageCountsLine(result: LanguageImportResult, apply: boolean): string;
|
|
125
128
|
/** Every line D7 prints, in order: items, counts, render changes, collisions, top-ups, dropped kickers, displacements. */
|
|
126
129
|
export declare function languageLines(result: LanguageImportResult, apply: boolean): string[];
|
|
130
|
+
/** One keyword of a seed topic, as the seed file carries it. */
|
|
131
|
+
export interface SeedTopicKeyword {
|
|
132
|
+
phrase: string;
|
|
133
|
+
monthlySearches?: number;
|
|
134
|
+
/** `YYYY-MM` or `YYYY-MM-DD`: when the number was read. */
|
|
135
|
+
asOf?: string;
|
|
136
|
+
primary?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/** One seed topic, as the seed file carries it. */
|
|
139
|
+
export interface SeedTopic {
|
|
140
|
+
slug: string;
|
|
141
|
+
name: string;
|
|
142
|
+
/** The site path of the topic's pillar page. */
|
|
143
|
+
pillar?: string;
|
|
144
|
+
keywords: SeedTopicKeyword[];
|
|
145
|
+
}
|
|
146
|
+
/** One stored keyword row (`languageTopicKeywordSchema`, restated: no runtime dep). */
|
|
147
|
+
export interface TopicRow {
|
|
148
|
+
phrase: string;
|
|
149
|
+
searches: number | null;
|
|
150
|
+
competition: "low" | "medium" | "high" | null;
|
|
151
|
+
competitionIndex: number | null;
|
|
152
|
+
topBid: number | null;
|
|
153
|
+
yoyChange: number | "∞" | null;
|
|
154
|
+
threeMonthChange: number | "∞" | null;
|
|
155
|
+
pulledAt: string | null;
|
|
156
|
+
note?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface TopicKeyword extends TopicRow {
|
|
159
|
+
primary?: true;
|
|
160
|
+
variants: (TopicRow & {
|
|
161
|
+
keep: boolean;
|
|
162
|
+
})[];
|
|
163
|
+
}
|
|
164
|
+
/** A Topic's words (`languageTopicWordsSchema`, restated); other stored keys pass through untouched. */
|
|
165
|
+
export interface TopicWords {
|
|
166
|
+
title: string;
|
|
167
|
+
pillar?: string;
|
|
168
|
+
keywords: TopicKeyword[];
|
|
169
|
+
[key: string]: unknown;
|
|
170
|
+
}
|
|
171
|
+
export type TopicSeedResult = "created" | "updated" | "unchanged" | "failed";
|
|
172
|
+
export interface TopicSeedReport {
|
|
173
|
+
topics: {
|
|
174
|
+
slug: string;
|
|
175
|
+
result: TopicSeedResult;
|
|
176
|
+
added: number;
|
|
177
|
+
updated: number;
|
|
178
|
+
reason?: string;
|
|
179
|
+
}[];
|
|
180
|
+
counts: Record<TopicSeedResult, number>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* A seed keyword's `asOf` as the pull datetime it stands for (midnight UTC on
|
|
184
|
+
* its day, or on the 1st of its month), or `null` for none or a date that is
|
|
185
|
+
* not a real one.
|
|
186
|
+
*/
|
|
187
|
+
export declare function asOfDatetime(asOf: string | undefined): string | null;
|
|
188
|
+
/**
|
|
189
|
+
* A seed file's `topics[]`, checked: `[]` when the file has none. Throws,
|
|
190
|
+
* naming the topic, on a shape the hub would refuse, so nothing is sent from
|
|
191
|
+
* a bad file.
|
|
192
|
+
*/
|
|
193
|
+
export declare function seedTopicsOf(seed: unknown): SeedTopic[];
|
|
194
|
+
/**
|
|
195
|
+
* A seed topic applied to a Topic's words (`null` for none yet). Each seed
|
|
196
|
+
* keyword matching a stored row (trimmed, case- and space-insensitive) keeps
|
|
197
|
+
* the stored spelling, place, variants and note, and takes the seed's number
|
|
198
|
+
* only when the seed's `asOf` is newer than the row's last pull, so a later
|
|
199
|
+
* Keyword Planner import is never overwritten by an older seed. Every other
|
|
200
|
+
* seed keyword becomes a keyword of its own, in the seed's spelling — the
|
|
201
|
+
* primary first. The seed's primary is marked only when the Topic has none
|
|
202
|
+
* and the phrase is a keyword rather than a variant; its pillar is set only
|
|
203
|
+
* when the Topic has none; its name titles only a new Topic. Pure; applying
|
|
204
|
+
* the same seed twice changes nothing the second time.
|
|
205
|
+
*/
|
|
206
|
+
export declare function applySeedTopic(stored: TopicWords | null, seed: SeedTopic): {
|
|
207
|
+
words: TopicWords;
|
|
208
|
+
added: number;
|
|
209
|
+
updated: number;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Write each seed topic to the workspace as one Topic (`PUT …/language/topic/<slug>`):
|
|
213
|
+
* created when the workspace has none, saved over its draft tip when the seed
|
|
214
|
+
* changes it, untouched when it does not. A topic that fails is reported and
|
|
215
|
+
* the rest still run.
|
|
216
|
+
*/
|
|
217
|
+
export declare function seedTopics(topics: readonly SeedTopic[], options: LanguageImportOptions): Promise<TopicSeedReport>;
|
|
218
|
+
/** One line per seed topic, then the counts, in the dry run's verbs or `--apply`'s. */
|
|
219
|
+
export declare function topicSeedLines(report: TopicSeedReport, apply: boolean): string[];
|
|
127
220
|
export {};
|
package/dist/language-import.js
CHANGED
|
@@ -106,6 +106,50 @@ function entriesOf(section) {
|
|
|
106
106
|
function reasonOf(answer) {
|
|
107
107
|
return "network" in answer ? answer.network : `${answer.status} ${answer.code}`;
|
|
108
108
|
}
|
|
109
|
+
/** One API call: the key as a bearer, no redirect, a timeout, and up to three rate-limited retries. */
|
|
110
|
+
async function callApi(options, sleep, method, url, body) {
|
|
111
|
+
for (let retry = 0;; retry++) {
|
|
112
|
+
let response;
|
|
113
|
+
try {
|
|
114
|
+
response = await options.fetch(url, {
|
|
115
|
+
method,
|
|
116
|
+
headers: {
|
|
117
|
+
authorization: `Bearer ${options.apiKey}`,
|
|
118
|
+
...(body !== undefined && { "content-type": "application/json" }),
|
|
119
|
+
},
|
|
120
|
+
...(body !== undefined && { body: JSON.stringify(body) }),
|
|
121
|
+
redirect: "error",
|
|
122
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
const name = err instanceof Error ? err.name.toLowerCase() : "";
|
|
127
|
+
return { network: `network ${SAFE_CODE.test(name) ? name : "unknown"}` };
|
|
128
|
+
}
|
|
129
|
+
if (response.status === 429 && retry < RATE_LIMIT_RETRIES) {
|
|
130
|
+
const header = response.headers.get("retry-after");
|
|
131
|
+
const asked = header !== null && /^\d+$/.test(header) ? Number(header) : 0;
|
|
132
|
+
const seconds = asked >= 1 && asked <= RATE_LIMIT_WAIT_MAX_S ? asked : RATE_LIMIT_WAIT_MAX_S;
|
|
133
|
+
options.onLine?.(`rate limited — waiting ${seconds}s`);
|
|
134
|
+
await sleep(seconds * 1000);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
let envelope = {};
|
|
138
|
+
try {
|
|
139
|
+
envelope = ((await response.json()) ?? {});
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// No JSON body: the status alone is reported.
|
|
143
|
+
}
|
|
144
|
+
const code = envelope.error?.code;
|
|
145
|
+
const data = envelope.data;
|
|
146
|
+
return {
|
|
147
|
+
status: response.status,
|
|
148
|
+
code: typeof code === "string" && SAFE_CODE.test(code) ? code : "unknown",
|
|
149
|
+
data: data !== null && typeof data === "object" ? data : {},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
109
153
|
export function withLanguage(adapters, options) {
|
|
110
154
|
const base = `${options.apiOrigin}/v1/workspaces/${encodeURIComponent(options.workspaceId)}/language`;
|
|
111
155
|
const query = `?locale=${encodeURIComponent(options.locale)}`;
|
|
@@ -120,49 +164,7 @@ export function withLanguage(adapters, options) {
|
|
|
120
164
|
const kickers = [];
|
|
121
165
|
const displaced = [];
|
|
122
166
|
const collisions = [];
|
|
123
|
-
|
|
124
|
-
for (let retry = 0;; retry++) {
|
|
125
|
-
let response;
|
|
126
|
-
try {
|
|
127
|
-
response = await options.fetch(url, {
|
|
128
|
-
method,
|
|
129
|
-
headers: {
|
|
130
|
-
authorization: `Bearer ${options.apiKey}`,
|
|
131
|
-
...(body !== undefined && { "content-type": "application/json" }),
|
|
132
|
-
},
|
|
133
|
-
...(body !== undefined && { body: JSON.stringify(body) }),
|
|
134
|
-
redirect: "error",
|
|
135
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
catch (err) {
|
|
139
|
-
const name = err instanceof Error ? err.name.toLowerCase() : "";
|
|
140
|
-
return { network: `network ${SAFE_CODE.test(name) ? name : "unknown"}` };
|
|
141
|
-
}
|
|
142
|
-
if (response.status === 429 && retry < RATE_LIMIT_RETRIES) {
|
|
143
|
-
const header = response.headers.get("retry-after");
|
|
144
|
-
const asked = header !== null && /^\d+$/.test(header) ? Number(header) : 0;
|
|
145
|
-
const seconds = asked >= 1 && asked <= RATE_LIMIT_WAIT_MAX_S ? asked : RATE_LIMIT_WAIT_MAX_S;
|
|
146
|
-
options.onLine?.(`rate limited — waiting ${seconds}s`);
|
|
147
|
-
await sleep(seconds * 1000);
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
let envelope = {};
|
|
151
|
-
try {
|
|
152
|
-
envelope = ((await response.json()) ?? {});
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
// No JSON body: the status alone is reported.
|
|
156
|
-
}
|
|
157
|
-
const code = envelope.error?.code;
|
|
158
|
-
const data = envelope.data;
|
|
159
|
-
return {
|
|
160
|
-
status: response.status,
|
|
161
|
-
code: typeof code === "string" && SAFE_CODE.test(code) ? code : "unknown",
|
|
162
|
-
data: data !== null && typeof data === "object" ? data : {},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
167
|
+
const call = (method, url, body) => callApi(options, sleep, method, url, body);
|
|
166
168
|
const itemUrl = (kind, slug) => `${base}/${kind}/${encodeURIComponent(slug)}`;
|
|
167
169
|
/** The stored item at a slug, `null` for none; throws on any other answer. */
|
|
168
170
|
async function read(kind, slug) {
|
|
@@ -449,3 +451,228 @@ export function languageLines(result, apply) {
|
|
|
449
451
|
...result.displaced.map((d) => `language: faq/${d.slug}: the workspace holds a different question here; the file's is ${d.next}`),
|
|
450
452
|
];
|
|
451
453
|
}
|
|
454
|
+
/** `normalizeTopicPhrase` (`@working-theory/validation`), restated. */
|
|
455
|
+
function topicPhraseKey(phrase) {
|
|
456
|
+
return phrase.trim().toLowerCase().replace(/\s+/g, " ");
|
|
457
|
+
}
|
|
458
|
+
const SEED_PHRASE_MAX = 200;
|
|
459
|
+
const SEED_NAME_MAX = 200;
|
|
460
|
+
const SEED_TOPICS_MAX = 500;
|
|
461
|
+
const SEED_KEYWORDS_MAX = 1000;
|
|
462
|
+
/** `TOPIC_PILLAR_PATTERN` plus the pillar's 200-character cap, restated; control characters are refused separately. */
|
|
463
|
+
const PILLAR = /^\/(?![/\\])[^\s\\]{0,199}$/;
|
|
464
|
+
const AS_OF = /^([0-9]{4})-([0-9]{2})(?:-([0-9]{2}))?$/;
|
|
465
|
+
// eslint-disable-next-line no-control-regex -- matching control characters is the point
|
|
466
|
+
const SEED_CONTROL = /[\u0000-\u001F\u007F-\u009F]/;
|
|
467
|
+
/**
|
|
468
|
+
* A seed keyword's `asOf` as the pull datetime it stands for (midnight UTC on
|
|
469
|
+
* its day, or on the 1st of its month), or `null` for none or a date that is
|
|
470
|
+
* not a real one.
|
|
471
|
+
*/
|
|
472
|
+
export function asOfDatetime(asOf) {
|
|
473
|
+
const match = asOf === undefined ? null : AS_OF.exec(asOf);
|
|
474
|
+
if (match === null)
|
|
475
|
+
return null;
|
|
476
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3] ?? "1")];
|
|
477
|
+
const at = new Date(Date.UTC(year, month - 1, day));
|
|
478
|
+
const real = at.getUTCFullYear() === year && at.getUTCMonth() === month - 1 && at.getUTCDate() === day;
|
|
479
|
+
return real ? at.toISOString() : null;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* A seed file's `topics[]`, checked: `[]` when the file has none. Throws,
|
|
483
|
+
* naming the topic, on a shape the hub would refuse, so nothing is sent from
|
|
484
|
+
* a bad file.
|
|
485
|
+
*/
|
|
486
|
+
export function seedTopicsOf(seed) {
|
|
487
|
+
const raw = seed?.topics;
|
|
488
|
+
if (raw === undefined)
|
|
489
|
+
return [];
|
|
490
|
+
if (!Array.isArray(raw) || raw.length > SEED_TOPICS_MAX) {
|
|
491
|
+
throw new Error(`language seed: "topics" is not a list of at most ${SEED_TOPICS_MAX} topics`);
|
|
492
|
+
}
|
|
493
|
+
const text = (v, max) => typeof v === "string" && v.trim() !== "" && v.length <= max && !SEED_CONTROL.test(v);
|
|
494
|
+
const slugs = new Set();
|
|
495
|
+
return raw.map((topic, index) => {
|
|
496
|
+
const t = (topic ?? {});
|
|
497
|
+
const label = typeof t["slug"] === "string" && ITEM_SLUG.test(t["slug"]) ? t["slug"] : `#${index + 1}`;
|
|
498
|
+
const bad = (why) => new Error(`language seed: topic ${label}: ${why}`);
|
|
499
|
+
const slug = t["slug"];
|
|
500
|
+
if (typeof slug !== "string" || !ITEM_SLUG.test(slug))
|
|
501
|
+
throw bad("no valid slug");
|
|
502
|
+
if (slugs.has(slug))
|
|
503
|
+
throw bad("the slug appears twice");
|
|
504
|
+
slugs.add(slug);
|
|
505
|
+
const name = t["name"];
|
|
506
|
+
if (!text(name, SEED_NAME_MAX))
|
|
507
|
+
throw bad("no name");
|
|
508
|
+
const pillar = t["pillar"];
|
|
509
|
+
if (pillar !== undefined && (typeof pillar !== "string" || !PILLAR.test(pillar) || SEED_CONTROL.test(pillar))) {
|
|
510
|
+
throw bad("the pillar is not a site path");
|
|
511
|
+
}
|
|
512
|
+
const keywords = t["keywords"];
|
|
513
|
+
if (!Array.isArray(keywords) || keywords.length > SEED_KEYWORDS_MAX)
|
|
514
|
+
throw bad("no keyword list");
|
|
515
|
+
const phrases = new Set();
|
|
516
|
+
let primaries = 0;
|
|
517
|
+
const parsed = keywords.map((k, at) => {
|
|
518
|
+
const kw = (k ?? {});
|
|
519
|
+
const phrase = kw["phrase"];
|
|
520
|
+
if (!text(phrase, SEED_PHRASE_MAX))
|
|
521
|
+
throw bad(`keyword ${at + 1} has no phrase`);
|
|
522
|
+
if (phrases.has(topicPhraseKey(phrase)))
|
|
523
|
+
throw bad(`keyword ${at + 1} repeats a phrase`);
|
|
524
|
+
phrases.add(topicPhraseKey(phrase));
|
|
525
|
+
const searches = kw["monthlySearches"];
|
|
526
|
+
if (searches !== undefined && (typeof searches !== "number" || !Number.isFinite(searches) || searches < 0)) {
|
|
527
|
+
throw bad(`keyword ${at + 1} has no valid monthlySearches`);
|
|
528
|
+
}
|
|
529
|
+
const asOf = kw["asOf"];
|
|
530
|
+
if (asOf !== undefined && (typeof asOf !== "string" || asOfDatetime(asOf) === null)) {
|
|
531
|
+
throw bad(`keyword ${at + 1} has no valid asOf`);
|
|
532
|
+
}
|
|
533
|
+
if (kw["primary"] === true)
|
|
534
|
+
primaries += 1;
|
|
535
|
+
return {
|
|
536
|
+
phrase: phrase.trim(),
|
|
537
|
+
...(searches !== undefined && { monthlySearches: searches }),
|
|
538
|
+
...(asOf !== undefined && { asOf }),
|
|
539
|
+
...(kw["primary"] === true && { primary: true }),
|
|
540
|
+
};
|
|
541
|
+
});
|
|
542
|
+
if (primaries > 1)
|
|
543
|
+
throw bad("more than one keyword is primary");
|
|
544
|
+
return { slug, name: name.trim(), ...(pillar !== undefined && { pillar }), keywords: parsed };
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* A seed topic applied to a Topic's words (`null` for none yet). Each seed
|
|
549
|
+
* keyword matching a stored row (trimmed, case- and space-insensitive) keeps
|
|
550
|
+
* the stored spelling, place, variants and note, and takes the seed's number
|
|
551
|
+
* only when the seed's `asOf` is newer than the row's last pull, so a later
|
|
552
|
+
* Keyword Planner import is never overwritten by an older seed. Every other
|
|
553
|
+
* seed keyword becomes a keyword of its own, in the seed's spelling — the
|
|
554
|
+
* primary first. The seed's primary is marked only when the Topic has none
|
|
555
|
+
* and the phrase is a keyword rather than a variant; its pillar is set only
|
|
556
|
+
* when the Topic has none; its name titles only a new Topic. Pure; applying
|
|
557
|
+
* the same seed twice changes nothing the second time.
|
|
558
|
+
*/
|
|
559
|
+
export function applySeedTopic(stored, seed) {
|
|
560
|
+
const words = stored === null
|
|
561
|
+
? { title: seed.name, keywords: [] }
|
|
562
|
+
: {
|
|
563
|
+
...stored,
|
|
564
|
+
keywords: stored.keywords.map((k) => ({ ...k, variants: k.variants.map((v) => ({ ...v })) })),
|
|
565
|
+
};
|
|
566
|
+
if (seed.pillar !== undefined && words.pillar === undefined)
|
|
567
|
+
words.pillar = seed.pillar;
|
|
568
|
+
const rows = new Map();
|
|
569
|
+
for (const keyword of words.keywords) {
|
|
570
|
+
rows.set(topicPhraseKey(keyword.phrase), { row: keyword, keyword });
|
|
571
|
+
for (const variant of keyword.variants) {
|
|
572
|
+
if (!rows.has(topicPhraseKey(variant.phrase)))
|
|
573
|
+
rows.set(topicPhraseKey(variant.phrase), { row: variant });
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const hasPrimary = words.keywords.some((k) => k.primary === true);
|
|
577
|
+
const fresh = [];
|
|
578
|
+
let updated = 0;
|
|
579
|
+
for (const kw of seed.keywords) {
|
|
580
|
+
const pulledAt = asOfDatetime(kw.asOf);
|
|
581
|
+
const found = rows.get(topicPhraseKey(kw.phrase));
|
|
582
|
+
if (found === undefined) {
|
|
583
|
+
fresh.push({
|
|
584
|
+
phrase: kw.phrase,
|
|
585
|
+
searches: kw.monthlySearches ?? null,
|
|
586
|
+
competition: null,
|
|
587
|
+
competitionIndex: null,
|
|
588
|
+
topBid: null,
|
|
589
|
+
yoyChange: null,
|
|
590
|
+
threeMonthChange: null,
|
|
591
|
+
pulledAt,
|
|
592
|
+
...(kw.primary === true && !hasPrimary && { primary: true }),
|
|
593
|
+
variants: [],
|
|
594
|
+
});
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
let changed = false;
|
|
598
|
+
if (kw.monthlySearches !== undefined &&
|
|
599
|
+
pulledAt !== null &&
|
|
600
|
+
(found.row.pulledAt === null || Date.parse(pulledAt) > Date.parse(found.row.pulledAt))) {
|
|
601
|
+
found.row.searches = kw.monthlySearches;
|
|
602
|
+
found.row.pulledAt = pulledAt;
|
|
603
|
+
changed = true;
|
|
604
|
+
}
|
|
605
|
+
if (kw.primary === true && !hasPrimary && found.keyword !== undefined) {
|
|
606
|
+
found.keyword.primary = true;
|
|
607
|
+
changed = true;
|
|
608
|
+
}
|
|
609
|
+
if (changed)
|
|
610
|
+
updated += 1;
|
|
611
|
+
}
|
|
612
|
+
words.keywords = [
|
|
613
|
+
...fresh.filter((k) => k.primary === true),
|
|
614
|
+
...words.keywords,
|
|
615
|
+
...fresh.filter((k) => k.primary !== true),
|
|
616
|
+
];
|
|
617
|
+
return { words, added: fresh.length, updated };
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Write each seed topic to the workspace as one Topic (`PUT …/language/topic/<slug>`):
|
|
621
|
+
* created when the workspace has none, saved over its draft tip when the seed
|
|
622
|
+
* changes it, untouched when it does not. A topic that fails is reported and
|
|
623
|
+
* the rest still run.
|
|
624
|
+
*/
|
|
625
|
+
export async function seedTopics(topics, options) {
|
|
626
|
+
const base = `${options.apiOrigin}/v1/workspaces/${encodeURIComponent(options.workspaceId)}/language/topic`;
|
|
627
|
+
const query = `?locale=${encodeURIComponent(options.locale)}`;
|
|
628
|
+
const sleep = options.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
629
|
+
const report = { topics: [], counts: { created: 0, updated: 0, unchanged: 0, failed: 0 } };
|
|
630
|
+
const ok = (a) => !("network" in a) && (a.status === 200 || a.status === 201);
|
|
631
|
+
for (const topic of topics) {
|
|
632
|
+
const url = `${base}/${encodeURIComponent(topic.slug)}${query}`;
|
|
633
|
+
const done = (result, added = 0, updated = 0, reason) => {
|
|
634
|
+
report.topics.push({ slug: topic.slug, result, added, updated, ...(reason !== undefined && { reason }) });
|
|
635
|
+
report.counts[result] += 1;
|
|
636
|
+
};
|
|
637
|
+
const read = await callApi(options, sleep, "GET", url);
|
|
638
|
+
const item = "network" in read ? undefined : read.data["item"];
|
|
639
|
+
let stored;
|
|
640
|
+
let version;
|
|
641
|
+
if (!("network" in read) && read.status === 404) {
|
|
642
|
+
stored = null;
|
|
643
|
+
version = null;
|
|
644
|
+
}
|
|
645
|
+
else if (ok(read) &&
|
|
646
|
+
item !== undefined &&
|
|
647
|
+
typeof item.version === "string" &&
|
|
648
|
+
Array.isArray(item.words?.keywords)) {
|
|
649
|
+
stored = item.words;
|
|
650
|
+
version = item.version;
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
done("failed", 0, 0, reasonOf(read));
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
const next = applySeedTopic(stored, topic);
|
|
657
|
+
if (stored !== null && next.added === 0 && next.updated === 0 && stored.pillar === next.words.pillar) {
|
|
658
|
+
done("unchanged");
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
const saved = await callApi(options, sleep, "PUT", url, { words: next.words, version });
|
|
662
|
+
if (!ok(saved)) {
|
|
663
|
+
done("failed", 0, 0, reasonOf(saved));
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
done(stored === null ? "created" : "updated", next.added, next.updated);
|
|
667
|
+
}
|
|
668
|
+
return report;
|
|
669
|
+
}
|
|
670
|
+
/** One line per seed topic, then the counts, in the dry run's verbs or `--apply`'s. */
|
|
671
|
+
export function topicSeedLines(report, apply) {
|
|
672
|
+
const verb = (r) => (apply ? r : r === "created" ? "create" : r === "updated" ? "update" : r);
|
|
673
|
+
const { created, updated, unchanged, failed } = report.counts;
|
|
674
|
+
return [
|
|
675
|
+
...report.topics.map((t) => `language: topic/${t.slug}: ${verb(t.result)}${t.result === "created" || t.result === "updated" ? ` (${t.added} added, ${t.updated} updated)` : ""}${t.reason === undefined ? "" : ` — ${t.reason}`}`),
|
|
676
|
+
`language: topics ${apply ? "created" : "create"} ${created} · ${apply ? "updated" : "update"} ${updated} · unchanged ${unchanged} · failed ${failed}`,
|
|
677
|
+
];
|
|
678
|
+
}
|
package/dist/lib/import-mdx.js
CHANGED
|
@@ -100,7 +100,7 @@ const INDEX_OWN_SLUG = new Map(Object.entries(EDITORIAL_TYPES).map(([dir, k]) =>
|
|
|
100
100
|
/** `PAGE_TAG_TYPES` (the validation package's `site-fields.ts`), restated: the blog collection keeps a sent `tags`. */
|
|
101
101
|
const PAGE_TAG_TYPES = new Set(["BlogPosting", "BlogList"]);
|
|
102
102
|
/**
|
|
103
|
-
* `fumadocsToArtifactFrontmatter` (`
|
|
103
|
+
* `fumadocsToArtifactFrontmatter` (`@working-theory/ui-docs-blog`'s `src/runtime-source.ts`, #11254) restated —
|
|
104
104
|
* fumadocs key to stored key — less `tags`, which only a blog page sends, plus
|
|
105
105
|
* `sections`, which `convert` moves. Any other key rides in `siteFields`
|
|
106
106
|
* (#10806 D4).
|
|
@@ -31,7 +31,7 @@ export declare const CLAIM_GATED_ROUTES: Readonly<Record<string, string>>;
|
|
|
31
31
|
export declare const HUB_GATED_ROUTES: Readonly<Record<string, string>>;
|
|
32
32
|
/**
|
|
33
33
|
* The API origin names `apps/web` reads, in step with `apiOriginConfigured()`
|
|
34
|
-
* in `
|
|
34
|
+
* in `packages-paid/ui-signal-collectors/src/pages/flows/[slug]/served-flow.ts`.
|
|
35
35
|
*/
|
|
36
36
|
export declare const HUB_ORIGIN_ENV_NAMES: readonly ["AILK_API_URL", "NEXT_PUBLIC_AILK_API_URL", "NEXT_PUBLIC_API_URL"];
|
|
37
37
|
/**
|
|
@@ -78,12 +78,15 @@ export declare function assessRouteStatus(input: {
|
|
|
78
78
|
status: number | null;
|
|
79
79
|
}): SweepVerdict;
|
|
80
80
|
/**
|
|
81
|
-
* A `CLAIM_GATED_ROUTES` entry: it must
|
|
82
|
-
*
|
|
81
|
+
* A `CLAIM_GATED_ROUTES` entry: it must answer exactly 404. Its page ships in
|
|
82
|
+
* a page package (`@working-theory/ui-commerce`, #11253), so a leg that does
|
|
83
|
+
* not carry that package (`carried: false`) has no such route and passes;
|
|
84
|
+
* one that does must list it in the route table (a missing one is stale).
|
|
83
85
|
*/
|
|
84
86
|
export declare function assessClaimGatedRoute(input: {
|
|
85
87
|
route: string;
|
|
86
88
|
routeTable: string[];
|
|
89
|
+
carried: boolean;
|
|
87
90
|
hops: RedirectHop[];
|
|
88
91
|
status: number | null;
|
|
89
92
|
}): SweepVerdict;
|
|
@@ -49,7 +49,7 @@ export const HUB_GATED_ROUTES = {
|
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* The API origin names `apps/web` reads, in step with `apiOriginConfigured()`
|
|
52
|
-
* in `
|
|
52
|
+
* in `packages-paid/ui-signal-collectors/src/pages/flows/[slug]/served-flow.ts`.
|
|
53
53
|
*/
|
|
54
54
|
export const HUB_ORIGIN_ENV_NAMES = ["AILK_API_URL", "NEXT_PUBLIC_AILK_API_URL", "NEXT_PUBLIC_API_URL"];
|
|
55
55
|
/**
|
|
@@ -134,13 +134,17 @@ export function assessRouteStatus(input) {
|
|
|
134
134
|
return assessReachable(input.route, input.hops, input.status);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* A `CLAIM_GATED_ROUTES` entry: it must
|
|
138
|
-
*
|
|
137
|
+
* A `CLAIM_GATED_ROUTES` entry: it must answer exactly 404. Its page ships in
|
|
138
|
+
* a page package (`@working-theory/ui-commerce`, #11253), so a leg that does
|
|
139
|
+
* not carry that package (`carried: false`) has no such route and passes;
|
|
140
|
+
* one that does must list it in the route table (a missing one is stale).
|
|
139
141
|
*/
|
|
140
142
|
export function assessClaimGatedRoute(input) {
|
|
141
|
-
const { route, routeTable, hops, status } = input;
|
|
143
|
+
const { route, routeTable, carried, hops, status } = input;
|
|
142
144
|
const claim = CLAIM_GATED_ROUTES[route];
|
|
143
145
|
if (!routeTable.some((r) => (r.replace("/[locale]", "") || "/") === route)) {
|
|
146
|
+
if (!carried)
|
|
147
|
+
return { ok: true, reason: "not served: the module is not carried" };
|
|
144
148
|
return { ok: false, reason: `${route} -> stale CLAIM_GATED_ROUTES entry: not in the route table` };
|
|
145
149
|
}
|
|
146
150
|
if (hops.length > 0 || status !== 404) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LanguageImportResult } from "./language-import.js";
|
|
1
|
+
import { type LanguageImportResult, type TopicSeedReport } from "./language-import.js";
|
|
2
2
|
import { type ImportMdxResult, type MdxAdapterModule } from "./lib/import-mdx.js";
|
|
3
3
|
/** A refusal the CLI exits 2 on, thrown before any request is sent. */
|
|
4
4
|
export declare class MigrateContentRefusedError extends Error {
|
|
@@ -14,6 +14,8 @@ export interface MigrateContentOptions {
|
|
|
14
14
|
apiUrl?: string | undefined;
|
|
15
15
|
/** `--workspace`. */
|
|
16
16
|
workspaceId?: string | undefined;
|
|
17
|
+
/** `--language-seed`: a Language seed file whose `topics[]` become Topics (lang-topic-fields). */
|
|
18
|
+
languageSeed?: string | undefined;
|
|
17
19
|
/** Injectable for tests; defaults to `process.env`. */
|
|
18
20
|
env?: NodeJS.ProcessEnv;
|
|
19
21
|
/** Injectable for tests; defaults to the site's installed adapter. */
|
|
@@ -39,13 +41,15 @@ export declare function migrateContent(opts: MigrateContentOptions): Promise<{
|
|
|
39
41
|
result: ImportMdxResult;
|
|
40
42
|
exitCode: 0 | 1;
|
|
41
43
|
language?: LanguageImportResult;
|
|
44
|
+
topics?: TopicSeedReport;
|
|
42
45
|
}>;
|
|
43
46
|
export interface MigrateContentArgs {
|
|
44
47
|
target: string | undefined;
|
|
45
48
|
apply: boolean;
|
|
46
49
|
apiUrl: string | undefined;
|
|
47
50
|
workspaceId: string | undefined;
|
|
51
|
+
languageSeed: string | undefined;
|
|
48
52
|
help: boolean;
|
|
49
53
|
}
|
|
50
|
-
export declare const MIGRATE_CONTENT_HELP = "create-ailk migrate-content \u2014 import an existing site's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk migrate-content [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --apply Write the pages. Without it the command reads the\n workspace, prints what it would do, and writes\n nothing.\n --api-url <origin> The API origin that holds the workspace \u2014 on a\n spoke, its hub's. Else AILK_API_URL. https: only\n (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page (and each legacy\ncontent/<Type>/<slug>.mdx) is written to the workspace as a draft through\nthe API's content routes, with the agent key, which is read from\nAILK_AGENT_KEY only and needs the content-edit grant. Nothing is published,\nso the live site does not change. The site needs no .ailk-site-manifest.json\nand may be a spoke; its dependencies must be installed. A page whose\nfrontmatter carries sections is converted: its words are written to the\npage's Markdown and its sections to its layout.\n\nEach FAQ item and glossary-index term becomes one Language item of its kind,\nset Live when the run creates it, and its section pins the items in the\norder the file lists them. A question on several pages is one item, with\nthe FAQ page's words (the glossary page's, for a term). Lines prefixed\nlanguage: report each item, and each page the database read will not show\nas its file does. An API with no Language collection leaves them inline.\n\nWhen the site has apps/web/content, each blog post and docs page in it is\nwritten too: apps/web/content/en/blog/<slug>.mdx (or <slug>/index.mdx) as a\nBlogPosting, or one series down, blog/<series>/<post>.mdx, as a BlogPosting\nwhose parent is the series; the same under docs as a DocsDetail, and each\ndirectory's own index.mdx as its BlogList or DocsList index. A file the walk\nskips is listed with the rule it failed. Their lines are prefixed\neditorial: \u2014 each outcome's root is content or editorial.\n\nA dry run prints create, update, unchanged, skipped or failed per page. It\ncannot see a write the API would refuse at --apply (a conflict or a server\nerror), nor a layout change on a page whose words did not change, and a\npage whose content fails its page type is planned and saved\nwith errors the editor shows, not failed. --apply prints created, updated,\nunchanged, skipped or failed per page, so a re-run is safe. Exit 0 when no\npage failed, 1 when any did, 2 on a refusal (nothing is sent).\n\nEvery page is written with a live-source mark: its words already ship on the\nlive site, so the hub lists a heading the page type's template asks for and\nthe page lacks as advisory, and publish takes the page. Editing the page's\nwords in the hub drops the mark. A dry run prints a publish line after each\npage: publishable, the advisory headings the hub will list, or the status and\nfindings that will stop the publish. The verdict is the site's installed\n@working-theory/validation's, not the hub's; it sees no library-file finding\nand no layout the hub repairs differently. A site whose validation predates\nthe live-source report prints one \"publish: not checked\" line instead.\n";
|
|
54
|
+
export declare const MIGRATE_CONTENT_HELP = "create-ailk migrate-content \u2014 import an existing site's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk migrate-content [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>] [--language-seed <file>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --apply Write the pages. Without it the command reads the\n workspace, prints what it would do, and writes\n nothing.\n --api-url <origin> The API origin that holds the workspace \u2014 on a\n spoke, its hub's. Else AILK_API_URL. https: only\n (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n --language-seed <file> A Language seed file (language/<entity>.json).\n Each of its topics becomes one Topic holding all\n its keywords. Its items are not read.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page (and each legacy\ncontent/<Type>/<slug>.mdx) is written to the workspace as a draft through\nthe API's content routes, with the agent key, which is read from\nAILK_AGENT_KEY only and needs the content-edit grant. Nothing is published,\nso the live site does not change. The site needs no .ailk-site-manifest.json\nand may be a spoke; its dependencies must be installed. A page whose\nfrontmatter carries sections is converted: its words are written to the\npage's Markdown and its sections to its layout.\n\nEach FAQ item and glossary-index term becomes one Language item of its kind,\nset Live when the run creates it, and its section pins the items in the\norder the file lists them. A question on several pages is one item, with\nthe FAQ page's words (the glossary page's, for a term). Lines prefixed\nlanguage: report each item, and each page the database read will not show\nas its file does. An API with no Language collection leaves them inline.\n\nWith --language-seed, each topic in the seed file is written after the\npages as one Topic: its name, its pillar page, and every keyword with its\nmonthly searches and as-of date, its primary marked. A Topic the workspace\nalready holds keeps its spelling, notes and newer numbers, and gains what it\nlacks. Lines prefixed language: topic/ report each one; a second --apply\nreports every topic unchanged. A seed file that is not readable, or whose\ntopics the hub would refuse, is refused before anything is sent.\n\nWhen the site has apps/web/content, each blog post and docs page in it is\nwritten too: apps/web/content/en/blog/<slug>.mdx (or <slug>/index.mdx) as a\nBlogPosting, or one series down, blog/<series>/<post>.mdx, as a BlogPosting\nwhose parent is the series; the same under docs as a DocsDetail, and each\ndirectory's own index.mdx as its BlogList or DocsList index. A file the walk\nskips is listed with the rule it failed. Their lines are prefixed\neditorial: \u2014 each outcome's root is content or editorial.\n\nA dry run prints create, update, unchanged, skipped or failed per page. It\ncannot see a write the API would refuse at --apply (a conflict or a server\nerror), nor a layout change on a page whose words did not change, and a\npage whose content fails its page type is planned and saved\nwith errors the editor shows, not failed. --apply prints created, updated,\nunchanged, skipped or failed per page, so a re-run is safe. Exit 0 when no\npage failed, 1 when any did, 2 on a refusal (nothing is sent).\n\nEvery page is written with a live-source mark: its words already ship on the\nlive site, so the hub lists a heading the page type's template asks for and\nthe page lacks as advisory, and publish takes the page. Editing the page's\nwords in the hub drops the mark. A dry run prints a publish line after each\npage: publishable, the advisory headings the hub will list, or the status and\nfindings that will stop the publish. The verdict is the site's installed\n@working-theory/validation's, not the hub's; it sees no library-file finding\nand no layout the hub repairs differently. A site whose validation predates\nthe live-source report prints one \"publish: not checked\" line instead.\n";
|
|
51
55
|
export declare function parseMigrateContentArgs(argv: string[]): MigrateContentArgs;
|