create-ailk 0.37.0 → 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 +149 -2
- 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 +7 -2
- package/dist/add-route.js +28 -13
- 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 +28 -1
- package/dist/sync-routes.js +144 -11
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/topology.d.ts +15 -1
- package/dist/topology.js +20 -4
- package/dist/update.d.ts +31 -2
- package/dist/update.js +627 -99
- 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
package/dist/sync-routes.js
CHANGED
|
@@ -30,6 +30,18 @@
|
|
|
30
30
|
* byte-identical to the template record and rewrites the generated
|
|
31
31
|
* billing action off them (`retireLegacySpokeCheckout`); an edited or
|
|
32
32
|
* unrecorded file is reported and left alone.
|
|
33
|
+
* - A route the site declined is its decision, not drift (#11260). A
|
|
34
|
+
* `declined_routes` entry in `customizations.yaml` takes the route and
|
|
35
|
+
* its sub-routes out of scope: reported under "Declined by this site",
|
|
36
|
+
* never missing, and never copied — not by `--apply`, not by an
|
|
37
|
+
* ancestor's subtree copy, not as a file another route imports.
|
|
38
|
+
* - What `--apply` copies, it records (#11213). Every recordable file it
|
|
39
|
+
* writes gets a row in `.ailk-template-files.json` — the sha256 of the
|
|
40
|
+
* bytes written and the create-ailk version doing the copy — so
|
|
41
|
+
* `create-ailk update` carries it forward as the untouched template
|
|
42
|
+
* copy it is, never holding it as "exists, not in the record". A site
|
|
43
|
+
* with no record gets none; a malformed one refuses the run before the
|
|
44
|
+
* first write.
|
|
33
45
|
*
|
|
34
46
|
* Pure module: no `import.meta.url`, so jest can import it directly. The
|
|
35
47
|
* package's own `templates/` dir is supplied by programmatic.ts.
|
|
@@ -38,14 +50,15 @@ import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSyn
|
|
|
38
50
|
import { tmpdir } from "node:os";
|
|
39
51
|
import { basename, dirname, join, posix, resolve, sep } from "node:path";
|
|
40
52
|
import { parseArgs } from "node:util";
|
|
41
|
-
import { copyTemplate, renderTemplateFile } from "./copy.js";
|
|
53
|
+
import { buildScaffoldMarkers, copyTemplate, renderTemplateFile } from "./copy.js";
|
|
54
|
+
import { declinedRouteFor, declinedRouteOfPath, readDeclinedRoutes } from "./declined-routes.js";
|
|
42
55
|
import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
|
|
43
56
|
import { appendEnvRows } from "./lib/declared-env.js";
|
|
44
57
|
import { ENV_CATALOG } from "./lib/env-catalog.js";
|
|
45
58
|
import { publicTreeRemoved } from "./lib/site-modules.js";
|
|
46
59
|
import { BILLING_ACTION, BILLING_ACTION_MARKER, RETIRED_CHECKOUT_E2E_MARKER, RETIRED_CHECKOUT_E2E_WORKFLOW_PATH, RETIRED_SPOKE_CHECKOUT_PATHS, } from "./spoke-checkout.js";
|
|
47
|
-
import { GATEABLE_SURFACES, HUB_KEPT_ROUTE_DIRS, NON_ROUTE_DIRS, ROUTE_DEPENDENCIES, ROUTE_MESSAGE_NAMESPACES, ROUTE_SINCE, surfaceForRouteDir, } from "./surfaces.js";
|
|
48
|
-
import { TEMPLATE_RECORD_PATH, parseTemplateRecord, serializeTemplateRecord, sha256Hex, } from "./template-record.js";
|
|
60
|
+
import { GATEABLE_SURFACES, HUB_KEPT_ROUTE_DIRS, NON_ROUTE_DIRS, pagePackageOfRoute, ROUTE_DEPENDENCIES, ROUTE_MESSAGE_NAMESPACES, ROUTE_SINCE, surfaceForRouteDir, } from "./surfaces.js";
|
|
61
|
+
import { TEMPLATE_RECORD_PATH, parseTemplateRecord, recordCopiedFiles, serializeTemplateRecord, sha256Hex, } from "./template-record.js";
|
|
49
62
|
import { SPOKE_SEAM_FILES, isSpokeExcluded, readSpokeShape, spokeExclusions, } from "./topology.js";
|
|
50
63
|
/** Template-relative prefix every `apps/web` route directory sits under. */
|
|
51
64
|
const ROUTE_ROOT = "apps/web/app/[locale]";
|
|
@@ -176,10 +189,14 @@ function walkRouteImports(route, ctx) {
|
|
|
176
189
|
// A file under a seed the spoke does not carry is never copied, so its
|
|
177
190
|
// imports are not walked (the hub's consent page under a hub sign-in spoke's
|
|
178
191
|
// account, #9966 D2).
|
|
192
|
+
// Nor is one under a route the site declined (#11260).
|
|
179
193
|
const queue = regularFilesUnder(ctx.scratch, route)
|
|
180
194
|
.map((rel) => `${ROUTE_ROOT}/${rel}`)
|
|
181
195
|
.filter((path) => ownerRoute(path, ctx.missingRoutes) === route)
|
|
182
|
-
.filter((path) => ctx.spoke === undefined || !isSpokeExcluded(path, ctx.spoke))
|
|
196
|
+
.filter((path) => ctx.spoke === undefined || !isSpokeExcluded(path, ctx.spoke))
|
|
197
|
+
.filter((path) => declinedRouteOfPath(path, ctx.declined) === undefined)
|
|
198
|
+
// Nor one a page package ships (ADR 0040): an ancestor's copy holds it back.
|
|
199
|
+
.filter((path) => pagePackageOfRoute(posix.dirname(path.slice(ROUTE_ROOT.length + 1))) === undefined);
|
|
183
200
|
const visited = new Set(queue);
|
|
184
201
|
for (let from = queue.shift(); from !== undefined; from = queue.shift()) {
|
|
185
202
|
if (!SOURCE_FILE.test(from))
|
|
@@ -209,6 +226,11 @@ function walkRouteImports(route, ctx) {
|
|
|
209
226
|
unresolved.push({ specifier, from: importer, reason: "the spoke does not carry it" });
|
|
210
227
|
continue;
|
|
211
228
|
}
|
|
229
|
+
const declinedBy = declinedRouteOfPath(path, ctx.declined);
|
|
230
|
+
if (declinedBy !== undefined) {
|
|
231
|
+
unresolved.push({ specifier, from: importer, reason: `it is under ${declinedBy}, which this site declined` });
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
212
234
|
const routeRel = inScratch(path);
|
|
213
235
|
const surface = routeRel === undefined ? "core" : surfaceForRouteDir(routeRel);
|
|
214
236
|
if (surface === undefined || !ctx.carried.has(surface)) {
|
|
@@ -451,6 +473,21 @@ function spokeExcludedUnder(routeRoot, route, spoke) {
|
|
|
451
473
|
});
|
|
452
474
|
return walk("");
|
|
453
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* The files under template route dir `route` that a page package ships
|
|
478
|
+
* (ADR 0040, `pagePackageOfRoute`), relative to `route`: an ancestor's
|
|
479
|
+
* subtree copy holds them back, and a route the package leaves to the site
|
|
480
|
+
* (its `siteOwned`) still lands.
|
|
481
|
+
*/
|
|
482
|
+
function pagePackageFilesUnder(routeRoot, route) {
|
|
483
|
+
const walk = (rel) => readdirSync(join(routeRoot, route, rel), { withFileTypes: true }).flatMap((entry) => {
|
|
484
|
+
const child = rel === "" ? entry.name : `${rel}/${entry.name}`;
|
|
485
|
+
if (entry.isDirectory())
|
|
486
|
+
return walk(child);
|
|
487
|
+
return pagePackageOfRoute(posix.dirname(`${route}/${child}`)) === undefined ? [] : [child];
|
|
488
|
+
});
|
|
489
|
+
return walk("");
|
|
490
|
+
}
|
|
454
491
|
/** The first line of a text file. */
|
|
455
492
|
function firstLine(text) {
|
|
456
493
|
const eol = text.indexOf("\n");
|
|
@@ -631,7 +668,20 @@ export function syncRoutes(opts) {
|
|
|
631
668
|
// tree: every template route dir outside the kept set is out of scope.
|
|
632
669
|
const publicTreeSkipped = [];
|
|
633
670
|
const marketingRemoved = publicTreeRemoved(targetAbs);
|
|
671
|
+
// ADR 0040 — a page package's routes are the route generator's, not this copier's.
|
|
672
|
+
const pagePackageRoutes = [];
|
|
673
|
+
// #11260 — a route the site declined, and its sub-routes, leave scope
|
|
674
|
+
// after every other filter, so `declined` names only routes that would
|
|
675
|
+
// otherwise have been checked.
|
|
676
|
+
const declinedRoutes = readDeclinedRoutes(targetAbs);
|
|
677
|
+
const declined = [];
|
|
634
678
|
const inScope = listTemplateRouteDirs(opts.templatesDir)
|
|
679
|
+
.filter((route) => {
|
|
680
|
+
if (pagePackageOfRoute(route) === undefined)
|
|
681
|
+
return true;
|
|
682
|
+
pagePackageRoutes.push(route);
|
|
683
|
+
return false;
|
|
684
|
+
})
|
|
635
685
|
.filter((route) => {
|
|
636
686
|
if (!marketingRemoved)
|
|
637
687
|
return true;
|
|
@@ -645,7 +695,13 @@ export function syncRoutes(opts) {
|
|
|
645
695
|
// every hub scaffold, the same as "core" — it is checked regardless of
|
|
646
696
|
// `carried`, which only tracks GATEABLE_SURFACES opt-in.
|
|
647
697
|
.filter((r) => r.surface === "core" || r.surface === "authed" || carried.has(r.surface))
|
|
648
|
-
.filter((r) => spoke === undefined || !isSpokeExcluded(`${ROUTE_ROOT}/${r.route}`, spoke))
|
|
698
|
+
.filter((r) => spoke === undefined || !isSpokeExcluded(`${ROUTE_ROOT}/${r.route}`, spoke))
|
|
699
|
+
.filter((r) => {
|
|
700
|
+
if (declinedRouteFor(r.route, declinedRoutes) === undefined)
|
|
701
|
+
return true;
|
|
702
|
+
declined.push(r);
|
|
703
|
+
return false;
|
|
704
|
+
});
|
|
649
705
|
// Identical to scaffoldSync's defaults, so a synced route matches a fresh
|
|
650
706
|
// scaffold of the same target byte-for-byte.
|
|
651
707
|
const markers = {
|
|
@@ -686,6 +742,7 @@ export function syncRoutes(opts) {
|
|
|
686
742
|
markers,
|
|
687
743
|
spoke,
|
|
688
744
|
carried: new Set(["core", "authed", ...carried]),
|
|
745
|
+
declined: declinedRoutes,
|
|
689
746
|
}));
|
|
690
747
|
}
|
|
691
748
|
finally {
|
|
@@ -696,6 +753,20 @@ export function syncRoutes(opts) {
|
|
|
696
753
|
// refused route's copy would write, iterated to a fixpoint. Never upward:
|
|
697
754
|
// an ancestor is still copied without the refused sub-tree.
|
|
698
755
|
const missingRoutes = missing.map((r) => r.route);
|
|
756
|
+
// #11260 — a declared dependency under a declined route is never copied,
|
|
757
|
+
// so the route that needs it refuses, named like an unresolved import.
|
|
758
|
+
for (const walk of walks) {
|
|
759
|
+
const deps = missing.find((m) => m.route === walk.route)?.dependencies ?? [];
|
|
760
|
+
for (const dep of deps) {
|
|
761
|
+
const declinedBy = declinedRouteOfPath(dep, declinedRoutes);
|
|
762
|
+
if (declinedBy === undefined)
|
|
763
|
+
continue;
|
|
764
|
+
walk.unresolved = sortUnresolved([
|
|
765
|
+
...walk.unresolved,
|
|
766
|
+
{ specifier: dep, from: "ROUTE_DEPENDENCIES", reason: `it is under ${declinedBy}, which this site declined` },
|
|
767
|
+
]);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
699
770
|
const refusedSet = new Set(walks.filter((w) => w.unresolved.length > 0).map((w) => w.route));
|
|
700
771
|
for (let changed = true; changed;) {
|
|
701
772
|
changed = false;
|
|
@@ -748,7 +819,32 @@ export function syncRoutes(opts) {
|
|
|
748
819
|
].sort();
|
|
749
820
|
const applied = [];
|
|
750
821
|
const appliedDependencies = [];
|
|
822
|
+
const recorded = [];
|
|
751
823
|
if (opts.apply === true) {
|
|
824
|
+
// #11213 — the site's record, read before the first write: every
|
|
825
|
+
// recordable file copied below is recorded at the create-ailk version
|
|
826
|
+
// doing the copy, so `update` never reads a synced file as "exists, not
|
|
827
|
+
// in the record". A site with no record gets none; a malformed one
|
|
828
|
+
// refuses the run. A row at a path no longer recorded is dropped, as
|
|
829
|
+
// `update` drops it (#10173).
|
|
830
|
+
const recordPath = join(targetAbs, TEMPLATE_RECORD_PATH);
|
|
831
|
+
let recording;
|
|
832
|
+
if (existsSync(recordPath)) {
|
|
833
|
+
let record;
|
|
834
|
+
try {
|
|
835
|
+
record = parseTemplateRecord(readFileSync(recordPath, "utf8"), { onUnrecordable: () => { } });
|
|
836
|
+
}
|
|
837
|
+
catch (err) {
|
|
838
|
+
throw new Error(`${err.message}; nothing copied`, { cause: err });
|
|
839
|
+
}
|
|
840
|
+
const version = opts.version ?? buildScaffoldMarkers(markers.PROJECT_NAME)["CREATE_AILK_VERSION"];
|
|
841
|
+
if (version === undefined) {
|
|
842
|
+
throw new Error(`cannot record the copied files in ${TEMPLATE_RECORD_PATH}: no create-ailk version; nothing copied`);
|
|
843
|
+
}
|
|
844
|
+
recording = { record, version };
|
|
845
|
+
}
|
|
846
|
+
/** Site-relative path → sha256 of the bytes written, for the record. */
|
|
847
|
+
const copied = new Map();
|
|
752
848
|
const writable = missingRoutes.filter((r) => !refusedSet.has(r));
|
|
753
849
|
// #6786 — the closure a fresh spoke scaffold drops, not only its seeds:
|
|
754
850
|
// a template file that imports a seed goes with it here too.
|
|
@@ -776,10 +872,17 @@ export function syncRoutes(opts) {
|
|
|
776
872
|
...refused
|
|
777
873
|
.filter((r) => r.startsWith(route + "/"))
|
|
778
874
|
.map((r) => r.slice(route.length + 1)),
|
|
875
|
+
// #11260 — and each declined sub-route.
|
|
876
|
+
...declinedRoutes
|
|
877
|
+
.filter((r) => r.startsWith(route + "/"))
|
|
878
|
+
.map((r) => r.slice(route.length + 1)),
|
|
879
|
+
// ADR 0040 — and every file a page package ships (`create-ailk routes` writes those).
|
|
880
|
+
...pagePackageFilesUnder(templateRouteRoot, route),
|
|
779
881
|
...(spokeShape === undefined
|
|
780
882
|
? []
|
|
781
883
|
: spokeExcludedUnder(templateRouteRoot, route, spokeShape)),
|
|
782
884
|
],
|
|
885
|
+
onWrite: (rel, bytes) => copied.set(`${ROUTE_ROOT}/${route}/${rel}`, sha256Hex(bytes)),
|
|
783
886
|
});
|
|
784
887
|
}
|
|
785
888
|
for (const dep of missingDependencies) {
|
|
@@ -787,9 +890,18 @@ export function syncRoutes(opts) {
|
|
|
787
890
|
if (!dst.startsWith(targetAbs + sep)) {
|
|
788
891
|
throw new Error(`refusing to write outside target dir: ${dst}`);
|
|
789
892
|
}
|
|
790
|
-
copyDependencyFile(opts.templatesDir, dep, dst, opts.versions, markers);
|
|
893
|
+
const bytes = copyDependencyFile(opts.templatesDir, dep, dst, opts.versions, markers);
|
|
894
|
+
if (bytes !== undefined)
|
|
895
|
+
copied.set(dep, sha256Hex(bytes));
|
|
791
896
|
appliedDependencies.push(dep);
|
|
792
897
|
}
|
|
898
|
+
if (recording !== undefined) {
|
|
899
|
+
const next = recordCopiedFiles(recording.record, copied, recording.version);
|
|
900
|
+
if (next.recorded.length > 0) {
|
|
901
|
+
writeFileSync(recordPath, serializeTemplateRecord(next.record));
|
|
902
|
+
recorded.push(...next.recorded);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
793
905
|
// #7874 D9 — a spoke declares what the copied routes read, as the last
|
|
794
906
|
// write. A malformed env_contract block throws EnvContractError naming
|
|
795
907
|
// its line; the files copied above stay.
|
|
@@ -807,9 +919,12 @@ export function syncRoutes(opts) {
|
|
|
807
919
|
routeImports,
|
|
808
920
|
missingDependencies,
|
|
809
921
|
appliedDependencies,
|
|
922
|
+
recorded,
|
|
810
923
|
missingMessageNamespaces,
|
|
811
924
|
skippedSurfaces,
|
|
925
|
+
declined,
|
|
812
926
|
publicTreeRemoved: publicTreeSkipped,
|
|
927
|
+
pagePackageRoutes,
|
|
813
928
|
structuredDataEntries: structuredDataEntriesFor(targetAbs, opts.templatesDir, applied),
|
|
814
929
|
retiredCheckout: spoke !== undefined
|
|
815
930
|
? retireLegacySpokeCheckout(targetAbs, opts.apply === true)
|
|
@@ -848,14 +963,17 @@ function hasMessageNamespace(targetAbs, namespace) {
|
|
|
848
963
|
* (`./logo.png`, #9406) is copied byte-for-byte. Never overwrites: the caller
|
|
849
964
|
* (`syncRoutes`) only calls this for a path already confirmed absent from the
|
|
850
965
|
* target, but the check is repeated here so this helper is safe to call on
|
|
851
|
-
* its own.
|
|
966
|
+
* its own. Returns the bytes written, for the record (#11213) — `undefined`
|
|
967
|
+
* when the file was already there.
|
|
852
968
|
*/
|
|
853
969
|
function copyDependencyFile(templatesDir, rel, dst, versions, markers) {
|
|
854
970
|
if (existsSync(dst))
|
|
855
|
-
return;
|
|
971
|
+
return undefined;
|
|
856
972
|
mkdirSync(dirname(dst), { recursive: true });
|
|
857
973
|
const bytes = readFileSync(join(templatesDir, ...rel.split("/")));
|
|
858
|
-
|
|
974
|
+
const rendered = renderTemplateFile(bytes, rel, versions, markers);
|
|
975
|
+
writeFileSync(dst, rendered);
|
|
976
|
+
return rendered;
|
|
859
977
|
}
|
|
860
978
|
/** Render the report the CLI prints after a run. Ends with a newline. */
|
|
861
979
|
export function formatSyncRoutesReport(result, apply) {
|
|
@@ -882,9 +1000,16 @@ export function formatSyncRoutesReport(result, apply) {
|
|
|
882
1000
|
if (result.skippedSurfaces.length > 0) {
|
|
883
1001
|
lines.push(`[create-ailk] Surfaces this site does not carry (skipped): ${result.skippedSurfaces.join(", ")}`);
|
|
884
1002
|
}
|
|
1003
|
+
if (result.declined.length > 0) {
|
|
1004
|
+
lines.push(`[create-ailk] Declined by this site (customizations.yaml declined_routes) — ${apply ? "not copied" : "not missing, never copied"}:`);
|
|
1005
|
+
lines.push(...result.declined.map((r) => ` ${r.route} (surface: ${r.surface})`));
|
|
1006
|
+
}
|
|
885
1007
|
if (result.publicTreeRemoved.length > 0) {
|
|
886
1008
|
lines.push(`[create-ailk] Public route tree not carried (marketing removed, #10040): ${result.publicTreeRemoved.length} template route(s) skipped`);
|
|
887
1009
|
}
|
|
1010
|
+
if (result.pagePackageRoutes.length > 0) {
|
|
1011
|
+
lines.push(`[create-ailk] Shipped by a page package (ADR 0040), nothing to sync: ${result.pagePackageRoutes.length} route(s) — \`create-ailk routes --check\` checks their generated files`);
|
|
1012
|
+
}
|
|
888
1013
|
// #9406 DD5 — per missing route, what its imports copy, leave, or cannot
|
|
889
1014
|
// resolve; then the routes a dangling import holds back.
|
|
890
1015
|
if (result.routeImports.length > 0) {
|
|
@@ -919,6 +1044,10 @@ export function formatSyncRoutesReport(result, apply) {
|
|
|
919
1044
|
: `[create-ailk] Also required — ${result.missingDependencies.length} file(s) the above route(s) import:`);
|
|
920
1045
|
lines.push(...result.missingDependencies.map((dep) => ` ${dep}`));
|
|
921
1046
|
}
|
|
1047
|
+
// #11213 — what the record gained, so the next `update` carries it forward.
|
|
1048
|
+
if (result.recorded.length > 0) {
|
|
1049
|
+
lines.push(`[create-ailk] Recorded ${result.recorded.length} copied file(s) in ${TEMPLATE_RECORD_PATH}, so \`create-ailk update\` carries them forward.`);
|
|
1050
|
+
}
|
|
922
1051
|
if (result.missingMessageNamespaces.length > 0) {
|
|
923
1052
|
lines.push(`[create-ailk] Also required — message namespace(s) not found in apps/web/messages/en.json (add manually, not auto-merged):`);
|
|
924
1053
|
lines.push(...result.missingMessageNamespaces.map((ns) => ` ${ns}`));
|
|
@@ -970,10 +1099,14 @@ Options:
|
|
|
970
1099
|
--help, -h Print this message.
|
|
971
1100
|
|
|
972
1101
|
Checks every core route plus the routes of each surface the site carries; a
|
|
973
|
-
surface gated off at scaffold time is skipped, not drift. A route the site
|
|
974
|
-
|
|
1102
|
+
surface gated off at scaffold time is skipped, not drift. A route the site lists
|
|
1103
|
+
in customizations.yaml declined_routes is reported as declined and never copied
|
|
1104
|
+
(#11260). A route the site has changed locally is reported and never
|
|
1105
|
+
overwritten. Nothing is deleted except,
|
|
975
1106
|
on a spoke, the retired legacy checkout's files that still match create-ailk's
|
|
976
1107
|
copy: --apply removes them and rewrites the generated billing action (#9142).
|
|
1108
|
+
Every file --apply copies is recorded in .ailk-template-files.json, when the
|
|
1109
|
+
site has one, so \`create-ailk update\` carries it forward (#11213).
|
|
977
1110
|
`;
|
|
978
1111
|
/**
|
|
979
1112
|
* Parse the argv AFTER the `sync-routes` word. Strict `node:util` parseArgs,
|
|
@@ -85,3 +85,14 @@ export interface PlanTemplateRecordOptions {
|
|
|
85
85
|
* `create-ailk update` keeps current for it.
|
|
86
86
|
*/
|
|
87
87
|
export declare function planTemplateRecord(opts: PlanTemplateRecordOptions): TemplateRecord;
|
|
88
|
+
/**
|
|
89
|
+
* `record` with a row for every recordable path of `copied` at `version`
|
|
90
|
+
* (#11213) — what `sync-routes --apply` (and `add-route`, which runs it)
|
|
91
|
+
* records for the template files it copies, so `update` reads each as the
|
|
92
|
+
* untouched template copy it is. A row already at a copied path is
|
|
93
|
+
* replaced. Pure: the caller reads and writes the file.
|
|
94
|
+
*/
|
|
95
|
+
export declare function recordCopiedFiles(record: TemplateRecord, copied: ReadonlyMap<string, string>, version: string): {
|
|
96
|
+
record: TemplateRecord;
|
|
97
|
+
recorded: string[];
|
|
98
|
+
};
|
package/dist/template-record.js
CHANGED
|
@@ -222,3 +222,21 @@ export function planTemplateRecord(opts) {
|
|
|
222
222
|
}
|
|
223
223
|
return { schema: 1, projectName: opts.projectName, files };
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* `record` with a row for every recordable path of `copied` at `version`
|
|
227
|
+
* (#11213) — what `sync-routes --apply` (and `add-route`, which runs it)
|
|
228
|
+
* records for the template files it copies, so `update` reads each as the
|
|
229
|
+
* untouched template copy it is. A row already at a copied path is
|
|
230
|
+
* replaced. Pure: the caller reads and writes the file.
|
|
231
|
+
*/
|
|
232
|
+
export function recordCopiedFiles(record, copied, version) {
|
|
233
|
+
const files = { ...record.files };
|
|
234
|
+
const recorded = [];
|
|
235
|
+
for (const [path, sha256] of copied) {
|
|
236
|
+
if (!isRecordable(path))
|
|
237
|
+
continue;
|
|
238
|
+
files[path] = { sha256, version };
|
|
239
|
+
recorded.push(path);
|
|
240
|
+
}
|
|
241
|
+
return { record: { ...record, files }, recorded: recorded.sort() };
|
|
242
|
+
}
|
package/dist/topology.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ export declare class TopologyError extends Error {
|
|
|
10
10
|
export declare const SPOKE_REMOVED_ROOTS: readonly string[];
|
|
11
11
|
/** The root `--without-mcp` removes. */
|
|
12
12
|
export declare const SPOKE_MCP_ROOT = "apps/mcp";
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Commerce's apps/web files that reach the hub's own checkout (spoke-intake
|
|
15
|
+
* Rule 3, #7838). The flows `results` routes are generated (#11251): the
|
|
16
|
+
* route generator reads this entry and reports them not carried on a spoke.
|
|
17
|
+
*/
|
|
14
18
|
export declare const SPOKE_HUB_CHECKOUT_SEEDS: readonly string[];
|
|
15
19
|
/**
|
|
16
20
|
* The files a spoke does not carry — files and directories, scaffold-relative:
|
|
@@ -53,6 +57,16 @@ export declare const SPOKE_SEAM_FILES: readonly string[];
|
|
|
53
57
|
* `excludePaths` matches an exact file path).
|
|
54
58
|
*/
|
|
55
59
|
export declare const SPOKE_ONLY_FILES: readonly string[];
|
|
60
|
+
/**
|
|
61
|
+
* A page package's site config (#11219, ADR 0040 rule 4): the one typed file
|
|
62
|
+
* through which the site customizes the pages the package ships, and the
|
|
63
|
+
* host's runtime-services seam its actions read. Since #11227 it imports
|
|
64
|
+
* only `lib/` files every topology carries, never the account area, so a
|
|
65
|
+
* spoke that drops that area (the default mode's `(authed)` seed) drops the
|
|
66
|
+
* config by a seed of that mode, not by the closure. A hub-sign-in spoke
|
|
67
|
+
* keeps both.
|
|
68
|
+
*/
|
|
69
|
+
export declare const PAGE_PACKAGE_CONFIG_FILES: readonly string[];
|
|
56
70
|
/**
|
|
57
71
|
* The closure's allow-list: a file `spokeExclusions` removes must sit under
|
|
58
72
|
* one of these prefixes, or under a `__tests__/` directory. A member outside
|
package/dist/topology.js
CHANGED
|
@@ -48,9 +48,12 @@ export class TopologyError extends Error {
|
|
|
48
48
|
export const SPOKE_REMOVED_ROOTS = ["apps/api", "database"];
|
|
49
49
|
/** The root `--without-mcp` removes. */
|
|
50
50
|
export const SPOKE_MCP_ROOT = "apps/mcp";
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Commerce's apps/web files that reach the hub's own checkout (spoke-intake
|
|
53
|
+
* Rule 3, #7838). The flows `results` routes are generated (#11251): the
|
|
54
|
+
* route generator reads this entry and reports them not carried on a spoke.
|
|
55
|
+
*/
|
|
52
56
|
export const SPOKE_HUB_CHECKOUT_SEEDS = [
|
|
53
|
-
"apps/web/app/[locale]/flows/[slug]/checkout.actions.ts",
|
|
54
57
|
"apps/web/app/[locale]/flows/[slug]/results",
|
|
55
58
|
"apps/web/app/[locale]/dev/purchase",
|
|
56
59
|
];
|
|
@@ -130,18 +133,31 @@ export const SPOKE_ONLY_FILES = [
|
|
|
130
133
|
"tools/declared-env.ts",
|
|
131
134
|
"tools/check-declared-env.ts",
|
|
132
135
|
];
|
|
136
|
+
/**
|
|
137
|
+
* A page package's site config (#11219, ADR 0040 rule 4): the one typed file
|
|
138
|
+
* through which the site customizes the pages the package ships, and the
|
|
139
|
+
* host's runtime-services seam its actions read. Since #11227 it imports
|
|
140
|
+
* only `lib/` files every topology carries, never the account area, so a
|
|
141
|
+
* spoke that drops that area (the default mode's `(authed)` seed) drops the
|
|
142
|
+
* config by a seed of that mode, not by the closure. A hub-sign-in spoke
|
|
143
|
+
* keeps both.
|
|
144
|
+
*/
|
|
145
|
+
export const PAGE_PACKAGE_CONFIG_FILES = ["apps/web/account.config.tsx"];
|
|
133
146
|
/**
|
|
134
147
|
* The closure's allow-list: a file `spokeExclusions` removes must sit under
|
|
135
148
|
* one of these prefixes, or under a `__tests__/` directory. A member outside
|
|
136
149
|
* both is a defect — a shared file started importing a sign-in or database
|
|
137
150
|
* file — and `spokeExclusions` throws naming it rather than cut it silently.
|
|
138
151
|
*/
|
|
139
|
-
export const SPOKE_REMOVABLE_PREFIXES =
|
|
152
|
+
export const SPOKE_REMOVABLE_PREFIXES = [
|
|
153
|
+
...SPOKE_REMOVAL_SEEDS,
|
|
154
|
+
...PAGE_PACKAGE_CONFIG_FILES,
|
|
155
|
+
];
|
|
140
156
|
/** The seeds for a sign-in mode, before the mcp filter. */
|
|
141
157
|
function modeSeeds(signIn) {
|
|
142
158
|
return signIn === "hub"
|
|
143
159
|
? SPOKE_REMOVAL_SEEDS.flatMap((seed) => seed === AUTHED_SEED ? [...HUB_MODE_AUTHED_SEEDS] : [seed])
|
|
144
|
-
: [...SPOKE_REMOVAL_SEEDS];
|
|
160
|
+
: [...SPOKE_REMOVAL_SEEDS, ...PAGE_PACKAGE_CONFIG_FILES];
|
|
145
161
|
}
|
|
146
162
|
function toPosix(path) {
|
|
147
163
|
return path.split("\\").join("/").replace(/^\.\//, "");
|
package/dist/update.d.ts
CHANGED
|
@@ -21,7 +21,10 @@ export interface UpdateSiteOptions {
|
|
|
21
21
|
* of a copied `apps/mcp` declares `@working-theory/mcp-server` and each
|
|
22
22
|
* carried module's paid MCP pack at, and (#9566) the move of a copied
|
|
23
23
|
* `apps/api` declares `@working-theory/api` and the six module packages
|
|
24
|
-
* at. A site already on both boot sets, or a spoke, never reads it
|
|
24
|
+
* at. A site already on both boot sets, or a spoke, never reads it for
|
|
25
|
+
* those. #11392 — the version each `@working-theory/*` package a written
|
|
26
|
+
* `apps/web` file imports, and the site does not declare, is added at; a
|
|
27
|
+
* package it lacks refuses the run before any write.
|
|
25
28
|
*/
|
|
26
29
|
versions?: WorkspaceVersionMap;
|
|
27
30
|
/**
|
|
@@ -71,6 +74,20 @@ export interface UpdateResult {
|
|
|
71
74
|
importers: string[];
|
|
72
75
|
edit: string;
|
|
73
76
|
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Per relative import a moved file names that neither the site nor the
|
|
79
|
+
* template has (#11216): the importers that moved anyway, because their
|
|
80
|
+
* own copies already named it — this run introduced no import.
|
|
81
|
+
*/
|
|
82
|
+
missingImports?: Array<{
|
|
83
|
+
file: string;
|
|
84
|
+
importers: string[];
|
|
85
|
+
}>;
|
|
86
|
+
/** Per lib file written because a moving test's import chain reaches it (#11234): the tests. */
|
|
87
|
+
testLibs?: Array<{
|
|
88
|
+
file: string;
|
|
89
|
+
tests: string[];
|
|
90
|
+
}>;
|
|
74
91
|
/** The recorded files whose bytes were another published template version's copy, moved as untouched (#11147). */
|
|
75
92
|
staleCopies?: Array<{
|
|
76
93
|
path: string;
|
|
@@ -78,6 +95,11 @@ export interface UpdateResult {
|
|
|
78
95
|
}>;
|
|
79
96
|
/** The recorded files whose site edit was comment lines only (#11147): merged, or on a conflict the template's copy. */
|
|
80
97
|
commentOnlyEdits?: string[];
|
|
98
|
+
/** The unrecorded files whose bytes were a published template copy (#11213): recorded and moved forward, with the version each matched. */
|
|
99
|
+
adopted?: Array<{
|
|
100
|
+
path: string;
|
|
101
|
+
version: string;
|
|
102
|
+
}>;
|
|
81
103
|
/** The `project.yaml` `env_contract` rows added for env vars the written files read (#10172). */
|
|
82
104
|
envRowsAdded?: string[];
|
|
83
105
|
/** Record rows dropped because the path is no longer recordable (#10173). */
|
|
@@ -90,6 +112,13 @@ export interface UpdateResult {
|
|
|
90
112
|
headingsAdded: string[];
|
|
91
113
|
/** The mdx-body pages under `content/` whose bare `{` were escaped this run (#10773). */
|
|
92
114
|
bracesEscaped: string[];
|
|
115
|
+
/** The generated route files written from the installed page packages' manifests after the pins moved (#11219). */
|
|
116
|
+
routesWritten?: string[];
|
|
117
|
+
/** The root `devDependencies["create-ailk"]` pin, moved to the running version so the scaffold's `routes:check` renders with the generator that wrote the files (#11219). */
|
|
118
|
+
cliPin?: {
|
|
119
|
+
from: string;
|
|
120
|
+
to: string;
|
|
121
|
+
};
|
|
93
122
|
backfilled?: {
|
|
94
123
|
version: string;
|
|
95
124
|
files: number;
|
|
@@ -127,6 +156,6 @@ export interface UpdateArgs {
|
|
|
127
156
|
target: string | undefined;
|
|
128
157
|
help: boolean;
|
|
129
158
|
}
|
|
130
|
-
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has
|
|
159
|
+
export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has \u2014 also when its recorded\nversion's copy cannot be read \u2014 and is reviewed only when a key is an object\non one side and a value on the other; a written apps/web file that uses\nthrough t(...) a key the catalog then lacks is held with it, listed under\n\"Held back with <catalog>\". Each @working-theory/* package a written apps/web\nfile imports that apps/web/package.json does not declare is added to its\ndependencies at this release's version. An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. A file at a\ntemplate path that is not in the record (one an earlier sync-routes --apply\nor add-route copied without recording it) whose bytes are a published\ncreate-ailk version's copy \u2014 from the version the site was scaffolded at to\nthis one \u2014 is adopted: recorded and moved forward as an untouched file is,\nlisted under \"Adopted\" with the version it matched. One whose bytes match no\npublished copy is a site edit: skipped, never overwritten, and counted under\n\"Held as site edits, not in the record\". No file under a route the site\nlists in customizations.yaml declined_routes is written: each is listed under\n\"Skipped\" naming the declined route. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A skipped file never holds another. A file whose\nown bytes are the record's is not held by what it imports: it moves, unless\nit names an export the held copy lacks, and the held file is listed as\n\"Held back: <file> \u2014 imported by N moved files; the site edit is <hunk\nsummary>\". A written file whose import names a file the site lacks gets it\nadded when this template supplies it; otherwise it is held the same way,\nunder \"Held back with <file> (not in this site)\", unless its own copy\nalready named the file \u2014 then it moves and the path is listed under \"Not in\nthis site or the template: <file>\". A file the template removed is kept\nwhile any file still in the site imports it. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Last, the generated route files of every installed page\npackage (one whose package.json declares \"ailk\": { \"routes\" }) are rewritten\nfrom its manifest, listed under \"Route files regenerated\"; run\n`create-ailk routes --write` after the install when the packages were not\ninstalled yet. Commit before running, and review the diff after.\n";
|
|
131
160
|
/** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
|
|
132
161
|
export declare function parseUpdateArgs(argv: string[]): UpdateArgs;
|