create-ailk 0.36.0 → 0.37.1
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 +20 -2
- package/component-catalog.json +40 -1
- package/component-catalog.md +7 -5
- package/dist/add-route.d.ts +5 -0
- package/dist/add-route.js +10 -2
- package/dist/surfaces.js +60 -19
- package/dist/sync-routes.d.ts +15 -1
- package/dist/sync-routes.js +58 -6
- package/dist/template-record.d.ts +11 -0
- package/dist/template-record.js +18 -0
- package/dist/update.d.ts +33 -1
- package/dist/update.js +439 -56
- package/package.json +3 -3
- package/templates/.env.example +17 -0
- package/templates/apps/api/.env.example +38 -0
- package/templates/apps/api/CLAUDE.md +3 -0
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +7 -0
- package/templates/apps/mcp/CLAUDE.md +1 -1
- package/templates/apps/web/CLAUDE.md +28 -1
- package/templates/apps/web/app/[locale]/(auth)/reset-password/__tests__/return.test.tsx +179 -0
- package/templates/apps/web/app/[locale]/(auth)/reset-password/page.tsx +22 -2
- package/templates/apps/web/app/[locale]/(auth)/reset-password/reset-password-card.tsx +9 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/billing.test.tsx +240 -76
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/general.test.tsx +242 -28
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/hub-mode.test.tsx +369 -196
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/item.test.tsx +26 -1
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/layout.test.tsx +17 -6
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-menu.test.tsx +51 -12
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/new-popups.test.tsx +17 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/notifications.test.tsx +153 -2
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/page.test.tsx +206 -23
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/popups.test.tsx +150 -188
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/privacy.test.tsx +235 -177
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/rich-translator.ts +63 -0
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/security.test.tsx +0 -3
- package/templates/apps/web/app/[locale]/(authed)/account/__tests__/thread.test.tsx +340 -0
- package/templates/apps/web/app/[locale]/(authed)/account/account-data.ts +7 -5
- package/templates/apps/web/app/[locale]/(authed)/account/account-frame.tsx +19 -3
- package/templates/apps/web/app/[locale]/(authed)/account/actions.ts +8 -4
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/[slug]/page.tsx +161 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/__tests__/page.test.tsx +426 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/appointments-data.ts +76 -0
- package/templates/apps/web/app/[locale]/(authed)/account/appointments/page.tsx +139 -0
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/page.tsx +92 -24
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/[pieceId]/versions/[version]/file/route.ts +32 -1
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/file-route.test.ts +76 -3
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/__tests__/page.test.tsx +290 -41
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/artifact-data.ts +109 -11
- package/templates/apps/web/app/[locale]/(authed)/account/artifacts/page.tsx +43 -44
- package/templates/apps/web/app/[locale]/(authed)/account/billing/__tests__/offerings.test.ts +99 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/offerings.ts +123 -0
- package/templates/apps/web/app/[locale]/(authed)/account/billing/page.tsx +309 -113
- package/templates/apps/web/app/[locale]/(authed)/account/billing-source.ts +192 -65
- package/templates/apps/web/app/[locale]/(authed)/account/components/request-quote.tsx +52 -7
- package/templates/apps/web/app/[locale]/(authed)/account/general/account-name.ts +36 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-actions.ts +70 -2
- package/templates/apps/web/app/[locale]/(authed)/account/general/contact-details.tsx +42 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/page.tsx +55 -58
- package/templates/apps/web/app/[locale]/(authed)/account/general/phone-verification.tsx +2 -1
- package/templates/apps/web/app/[locale]/(authed)/account/general/photo-actions.ts +73 -0
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-form.tsx +12 -9
- package/templates/apps/web/app/[locale]/(authed)/account/general/profile-source.ts +18 -4
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/[kind]/[id]/page.tsx +20 -2
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/member-thread-composer.tsx +43 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/page.tsx +125 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-data.ts +88 -0
- package/templates/apps/web/app/[locale]/(authed)/account/inbox/thread/thread-write.ts +31 -0
- package/templates/apps/web/app/[locale]/(authed)/account/layout.tsx +3 -2
- package/templates/apps/web/app/[locale]/(authed)/account/new-menu.tsx +33 -8
- package/templates/apps/web/app/[locale]/(authed)/account/new-popups.tsx +31 -52
- package/templates/apps/web/app/[locale]/(authed)/account/notifications/page.tsx +44 -4
- package/templates/apps/web/app/[locale]/(authed)/account/page.tsx +69 -49
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/__tests__/export-route.test.ts +173 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/actions.ts +42 -4
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/export/route.ts +102 -0
- package/templates/apps/web/app/[locale]/(authed)/account/privacy/page.tsx +147 -137
- package/templates/apps/web/app/[locale]/(authed)/account/security/__tests__/hub-variant.test.tsx +258 -0
- package/templates/apps/web/app/[locale]/(authed)/account/security/page.tsx +18 -21
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-panel.tsx +34 -6
- package/templates/apps/web/app/[locale]/(authed)/account/security/security-source.ts +37 -7
- package/templates/apps/web/app/[locale]/(authed)/account/settings/page.tsx +0 -2
- package/templates/apps/web/app/[locale]/(authed)/account/settings-frame.tsx +8 -5
- package/templates/apps/web/app/[locale]/flows/[slug]/results/[payload]/ResultsClient.tsx +3 -2
- package/templates/apps/web/app/api/auth/hub/password/__tests__/return.test.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/__tests__/route.test.ts +368 -0
- package/templates/apps/web/app/api/auth/hub/password/return.ts +86 -0
- package/templates/apps/web/app/api/auth/hub/password/route.ts +171 -0
- package/templates/apps/web/app/api/hub-session/__tests__/routes.test.ts +263 -0
- package/templates/apps/web/app/api/hub-session/password/return/route.ts +69 -0
- package/templates/apps/web/app/api/hub-session/password/route.ts +106 -0
- package/templates/apps/web/lib/__tests__/account-config.test.ts +129 -1
- package/templates/apps/web/lib/__tests__/offerings-pricing.test.ts +33 -0
- package/templates/apps/web/lib/account-config.ts +132 -8
- package/templates/apps/web/lib/auth-routes.ts +11 -6
- package/templates/apps/web/lib/offerings-pricing.ts +4 -1
- package/templates/apps/web/messages/en.json +156 -80
- package/versions.json +48 -48
- package/templates/apps/web/app/[locale]/(authed)/account/components/schedule-service.tsx +0 -276
- package/templates/apps/web/app/[locale]/(authed)/account/components/send-message.tsx +0 -128
- package/templates/apps/web/app/[locale]/(authed)/account/settings/__tests__/theme-modes.test.ts +0 -42
- package/templates/apps/web/app/[locale]/(authed)/account/settings/theme-modes.ts +0 -40
package/README.md
CHANGED
|
@@ -296,6 +296,14 @@ scaffold's). It never rewrites or deletes an existing file, writes nothing
|
|
|
296
296
|
outside `apps/web/app/[locale]/` except the local modules those routes import
|
|
297
297
|
(below), runs no install, and a second run is a no-op. `--apply` exits 0 on success.
|
|
298
298
|
|
|
299
|
+
**What `--apply` copies, it records.** Every file it writes gets a row in
|
|
300
|
+
`.ailk-template-files.json` — the sha256 of the bytes written and the
|
|
301
|
+
create-ailk version that copied it — so `create-ailk update` (below) reads it
|
|
302
|
+
as the untouched template copy it is and carries it forward, instead of
|
|
303
|
+
holding it as "exists, not in the record" on the next release. A site with no
|
|
304
|
+
record gets none; a malformed record refuses the run before anything is
|
|
305
|
+
copied. `add-route` runs the same sync, so it records what it copies too.
|
|
306
|
+
|
|
299
307
|
**Scope.** Every core route (`about`, `contact`, `faq`, `thanks/[slug]`,
|
|
300
308
|
`sign-in`) is always checked, and so is the `(authed)` route GROUP —
|
|
301
309
|
`layout.tsx`, `account/`, and `waitlist/` — even though
|
|
@@ -403,10 +411,20 @@ merge-file` against the recorded version's own copy as the base. A clean
|
|
|
403
411
|
dropped from the roster after the writes, every other byte of the file
|
|
404
412
|
kept. Reported as **Roster rows dropped, no route serves them**.
|
|
405
413
|
|
|
414
|
+
- A file at a template path that exists on disk but was never recorded —
|
|
415
|
+
one an earlier `sync-routes --apply` or `add-route` copied without
|
|
416
|
+
recording it — is **Adopted** when its bytes are that path's template
|
|
417
|
+
copy in any published create-ailk version from the site's
|
|
418
|
+
`patternVersion` up to the one being applied: its row is written and the
|
|
419
|
+
file moves forward as an untouched copy does, listed under **Adopted**
|
|
420
|
+
with the version it matched. One matching no published copy is the
|
|
421
|
+
site's own: skipped as a site edit, never overwritten, and counted under
|
|
422
|
+
**Held as site edits, not in the record**.
|
|
423
|
+
|
|
406
424
|
A file outside the gated-off surfaces and spoke exclusions the site's scope
|
|
407
425
|
no longer covers is **Skipped**, as is one that exists on disk but was never
|
|
408
|
-
recorded (a module bundle's own file, say) when its bytes
|
|
409
|
-
|
|
426
|
+
recorded (a module bundle's own file, say) when its bytes match no template
|
|
427
|
+
copy. Nothing the base scaffold did not write is ever touched. No
|
|
410
428
|
template change at all means `Already up to date` and zero files written.
|
|
411
429
|
|
|
412
430
|
**Tests are held back with the file they test.** When a file is left under
|
package/component-catalog.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"importPath": "@working-theory/ui/primitives",
|
|
34
34
|
"rootBarrel": "@working-theory/ui",
|
|
35
35
|
"sourceRoot": "packages/ui/src/primitives",
|
|
36
|
-
"count":
|
|
36
|
+
"count": 82
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"name": "panels",
|
|
@@ -2454,6 +2454,17 @@
|
|
|
2454
2454
|
"descriptionGrade": "weak",
|
|
2455
2455
|
"sectionType": null
|
|
2456
2456
|
},
|
|
2457
|
+
{
|
|
2458
|
+
"name": "DateInput",
|
|
2459
|
+
"tier": "primitives",
|
|
2460
|
+
"sourcePath": "packages/ui/src/primitives/DateInput.tsx",
|
|
2461
|
+
"importPath": "@working-theory/ui/primitives",
|
|
2462
|
+
"exported": true,
|
|
2463
|
+
"description": "Calendar-date control that posts one ISO `YYYY-MM-DD` value: a native date input beside a button that opens the package Calendar in a Popover.",
|
|
2464
|
+
"descriptionSource": "doc-comment",
|
|
2465
|
+
"descriptionGrade": "strong",
|
|
2466
|
+
"sectionType": null
|
|
2467
|
+
},
|
|
2457
2468
|
{
|
|
2458
2469
|
"name": "Delta",
|
|
2459
2470
|
"tier": "primitives",
|
|
@@ -2630,6 +2641,17 @@
|
|
|
2630
2641
|
"descriptionGrade": "strong",
|
|
2631
2642
|
"sectionType": null
|
|
2632
2643
|
},
|
|
2644
|
+
{
|
|
2645
|
+
"name": "LocalTime",
|
|
2646
|
+
"tier": "primitives",
|
|
2647
|
+
"sourcePath": "packages/ui/src/primitives/LocalTime.tsx",
|
|
2648
|
+
"importPath": "@working-theory/ui/primitives",
|
|
2649
|
+
"exported": true,
|
|
2650
|
+
"description": "An ISO instant as the viewer reads it: a date or time that renders in UTC on the server, then in the viewer's own time zone once the page hydrates, with the zone's short name on hover.",
|
|
2651
|
+
"descriptionSource": "doc-comment",
|
|
2652
|
+
"descriptionGrade": "strong",
|
|
2653
|
+
"sectionType": null
|
|
2654
|
+
},
|
|
2633
2655
|
{
|
|
2634
2656
|
"name": "MenuItem",
|
|
2635
2657
|
"tier": "primitives",
|
|
@@ -11302,6 +11324,23 @@
|
|
|
11302
11324
|
"type": "string",
|
|
11303
11325
|
"minLength": 1
|
|
11304
11326
|
},
|
|
11327
|
+
"prefill": {
|
|
11328
|
+
"type": "object",
|
|
11329
|
+
"properties": {
|
|
11330
|
+
"email": {
|
|
11331
|
+
"type": "string",
|
|
11332
|
+
"format": "email",
|
|
11333
|
+
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
|
|
11334
|
+
},
|
|
11335
|
+
"name": {
|
|
11336
|
+
"type": "string",
|
|
11337
|
+
"minLength": 1
|
|
11338
|
+
}
|
|
11339
|
+
},
|
|
11340
|
+
"required": [
|
|
11341
|
+
"email"
|
|
11342
|
+
]
|
|
11343
|
+
},
|
|
11305
11344
|
"layout": {
|
|
11306
11345
|
"type": "string",
|
|
11307
11346
|
"enum": [
|
package/component-catalog.md
CHANGED
|
@@ -15,13 +15,13 @@ The component inventory of `@working-theory/ui` and the shells of `@working-theo
|
|
|
15
15
|
3. Check the Primitives, Panels and Shells tables too — a low-level control, a collapsible layout container, or a route-level frame lives there, not under Sections or Blocks.
|
|
16
16
|
4. Only then build. If you do build, you are declaring the capability is genuinely absent.
|
|
17
17
|
|
|
18
|
-
Inventory: **
|
|
18
|
+
Inventory: **330 component files** across 16 tiers — 60 sections, 110 blocks, 19 chrome, 82 primitives, 6 panels, 8 shells, 5 docs-blog-blocks, 1 docs-blog-chrome, 2 docs-blog-shells, 2 scheduling-sections, 6 scheduling-blocks, 5 signal-collectors-sections, 9 signal-collectors-blocks, 2 commerce-sections, 12 commerce-blocks, 1 commerce-panels. 327 distinct names: `SchedulerEmbed`, `Separator`, `Tabs` exist in more than one tier as genuinely different components, listed once per tier with its own source path.
|
|
19
19
|
|
|
20
|
-
Description coverage: **
|
|
20
|
+
Description coverage: **326/330** components carry a capability description derived from source — 45 from the section registry's hand-authored when-to-use text, 246 from the component's own doc-comment header, 35 from its tier barrel's roster line. **4** have none; they are listed under [Undescribed components](#undescribed-components) rather than given a sentence invented from their name.
|
|
21
21
|
|
|
22
|
-
Of those, **
|
|
22
|
+
Of those, **293** are *strong* — a capability sentence you could match a requirement against — and **33** are *weak*: either one short clause, or a long one that spends itself on wiring (client boundaries, class names, which primitives it composes) instead of on what the thing is for. Weak rows are marked `(weak)` and listed in full under [Weak descriptions](#weak-descriptions). Coverage is 99%, but **findable-without-luck coverage is 89%**.
|
|
23
23
|
|
|
24
|
-
Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives**
|
|
24
|
+
Per tier, strong out of total: **Sections** 59/60 · **Blocks** 102/110 · **Chrome** 10/19 · **Primitives** 67/82 (4 undescribed) · **Panels** 6/6 · **Shells** 7/8 · **Docs + Blog Blocks** 5/5 · **Docs + Blog Chrome** 1/1 · **Docs + Blog Shells** 0/2 · **Scheduling Sections** 2/2 · **Scheduling Blocks** 6/6 · **Signal-Collectors Sections** 5/5 · **Signal-Collectors Blocks** 8/9 · **Commerce Sections** 2/2 · **Commerce Blocks** 12/12 · **Commerce Panels** 1/1. A tier low on this line is a tier where a capability search is most likely to come up empty on something that exists.
|
|
25
25
|
|
|
26
26
|
That grade is **mechanical**. It counts what it can measure — how much a description adds beyond the component's own name, how much of it is spent on wiring, whether the extraction came out damaged — and it cannot tell a fluent paragraph about the wrong subject from a useful one. A person reading these tables will find more rows unusable than the weak count admits. Treat it as a floor on the problem, not a measurement of it, and read the source before concluding a capability is absent.
|
|
27
27
|
|
|
@@ -275,7 +275,7 @@ Import: `import { X } from "@working-theory/ui/chrome";` (or from the `@working-
|
|
|
275
275
|
|
|
276
276
|
---
|
|
277
277
|
|
|
278
|
-
## Primitives (
|
|
278
|
+
## Primitives (82)
|
|
279
279
|
|
|
280
280
|
The base control and text vocabulary — Button, Heading, Text, Link, Icon, Input, Dialog, Command, Tooltip, ThemeToggle and the rest. This is the only tier allowed to render raw HTML elements; every tier above it composes these instead. Search here before building any low-level control.
|
|
281
281
|
|
|
@@ -305,6 +305,7 @@ Import: `import { X } from "@working-theory/ui/primitives";` (or from the `@work
|
|
|
305
305
|
| `Container` | _no description in source — read `packages/ui/src/primitives/Container.tsx`_ | `import { Container } from "@working-theory/ui/primitives"` |
|
|
306
306
|
| `ContextMenu` | Right-click / long-press contextual action menu. Thin wrapper over @radix-ui/react-context-menu with AILK semantic token styling. Provides the full Radix sub-component set: Root, Trigger, Portal, Content, Group, Label, Item, CheckboxItem, RadioGroup, RadioItem, ItemIndicator, Separator, Sub, SubTrigger, SubContent, Shortcut. | `import { ContextMenu } from "@working-theory/ui/primitives"` |
|
|
307
307
|
| `CopyButton` | CopyButton Primitive. *(weak)* | `import { CopyButton } from "@working-theory/ui/primitives"` |
|
|
308
|
+
| `DateInput` | Calendar-date control that posts one ISO `YYYY-MM-DD` value: a native date input beside a button that opens the package Calendar in a Popover. | `import { DateInput } from "@working-theory/ui/primitives"` |
|
|
308
309
|
| `Delta` | Sign-driven semantic indicator for numeric change. *(weak)* | `import { Delta } from "@working-theory/ui/primitives"` |
|
|
309
310
|
| `Dialog` | Modal overlay composed from @radix-ui/react-dialog. *(weak)* | `import { Dialog } from "@working-theory/ui/primitives"` |
|
|
310
311
|
| `DropdownMenu` | Contextual action menu anchored to a trigger. Thin wrapper over @radix-ui/react-dropdown-menu with AILK semantic token styling. Provides the full Radix sub-component set: Root, Trigger, Portal, Content, Group, Label, Item, CheckboxItem, RadioGroup, RadioItem, ItemIndicator, Separator, Sub, SubTrigger, SubContent, Shortcut. | `import { DropdownMenu } from "@working-theory/ui/primitives"` |
|
|
@@ -321,6 +322,7 @@ Import: `import { X } from "@working-theory/ui/primitives";` (or from the `@work
|
|
|
321
322
|
| `Label` | Form field label with peer-disabled state styling. Wraps @radix-ui/react-label for correct association with form controls via `htmlFor`. Automatically dims and shows a not-allowed cursor when the associated control carries the `disabled` attribute (peer-disabled). | `import { Label } from "@working-theory/ui/primitives"` |
|
|
322
323
|
| `Link` | _no description in source — read `packages/ui/src/primitives/Link.tsx`_ | `import { Link } from "@working-theory/ui/primitives"` |
|
|
323
324
|
| `LoaderRing` | Compact loading-animation indicator. Renders the three loading animations (spinner, dots, check-transition) and, for terminal status, composes the shared StatusBadge primitive (success/error/warning). Sizes track the AILK icon-size token scale; all colors are AILK Brand 1.3 semantic tokens. | `import { LoaderRing } from "@working-theory/ui/primitives"` |
|
|
325
|
+
| `LocalTime` | An ISO instant as the viewer reads it: a date or time that renders in UTC on the server, then in the viewer's own time zone once the page hydrates, with the zone's short name on hover. | `import { LocalTime } from "@working-theory/ui/primitives"` |
|
|
324
326
|
| `Menubar` | Horizontal application menu bar with keyboard navigation. | `import { Menubar } from "@working-theory/ui/primitives"` |
|
|
325
327
|
| `MenuItem` | Interactive menu item for dropdowns, context menus, etc. Full-width, left-aligned button with support for left/right icons, secondary text, selection state, and destructive variant. | `import { MenuItem } from "@working-theory/ui/primitives"` |
|
|
326
328
|
| `MoneyAmount` | Locale-aware currency display. *(weak)* | `import { MoneyAmount } from "@working-theory/ui/primitives"` |
|
package/dist/add-route.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export interface AddRouteOptions {
|
|
|
19
19
|
templatesDir: string;
|
|
20
20
|
/** The package's `site-templates/` dir — the `_base` layer's seeds. */
|
|
21
21
|
siteTemplatesDir: string;
|
|
22
|
+
/**
|
|
23
|
+
* The create-ailk version the copied route files are recorded at
|
|
24
|
+
* (#11213); defaults to the running package's own, as `syncRoutes` does.
|
|
25
|
+
*/
|
|
26
|
+
version?: string;
|
|
22
27
|
}
|
|
23
28
|
export interface AddRouteResult {
|
|
24
29
|
/** Resolved absolute path to the site. */
|
package/dist/add-route.js
CHANGED
|
@@ -12,8 +12,10 @@
|
|
|
12
12
|
* against the site's module set — a route another module delivers is
|
|
13
13
|
* refused, naming the module and `add-module`, before any write;
|
|
14
14
|
* - the surface's route dirs are synced in (`syncRoutes` with it forced
|
|
15
|
-
* carried
|
|
16
|
-
*
|
|
15
|
+
* carried, which records every file it copies in
|
|
16
|
+
* `.ailk-template-files.json`, #11213), `architecture.yaml` is
|
|
17
|
+
* regenerated with it declared, and the nav follows unless the site has
|
|
18
|
+
* edited it (`syncNavConfig`);
|
|
17
19
|
* - the surface's seed content is written from the two shared layers a
|
|
18
20
|
* fresh scaffold keeps it from (the `templates/` overlay, then `_base`),
|
|
19
21
|
* never over a file the site already has.
|
|
@@ -50,6 +52,7 @@ import { GATEABLE_SURFACES, MODULE_SURFACES, parseSurfaces, resolveSurfaces, } f
|
|
|
50
52
|
import { syncRoutes } from "./sync-routes.js";
|
|
51
53
|
import { BASE_LAYER_DIR } from "./template-manifest.js";
|
|
52
54
|
import { templatePageSeeds } from "./template-pages.js";
|
|
55
|
+
import { TEMPLATE_RECORD_PATH } from "./template-record.js";
|
|
53
56
|
import { TopologyError, readSiteTopology } from "./topology.js";
|
|
54
57
|
/** A refusal the CLI exits 2 on, thrown before anything is written. */
|
|
55
58
|
export class AddRouteRefusedError extends Error {
|
|
@@ -117,6 +120,7 @@ export function addRouteToScaffold(opts) {
|
|
|
117
120
|
versions: opts.versions,
|
|
118
121
|
apply: true,
|
|
119
122
|
forceSurfaces: [route],
|
|
123
|
+
...(opts.version !== undefined ? { version: opts.version } : {}),
|
|
120
124
|
});
|
|
121
125
|
const report = seedSurfaceContent(targetAbs, route, opts);
|
|
122
126
|
seedGeneratedContent(targetAbs, route, report);
|
|
@@ -255,6 +259,7 @@ export function formatAddRouteReport(result) {
|
|
|
255
259
|
applied: [],
|
|
256
260
|
refused: [],
|
|
257
261
|
appliedDependencies: [],
|
|
262
|
+
recorded: [],
|
|
258
263
|
missingMessageNamespaces: [],
|
|
259
264
|
};
|
|
260
265
|
const lines = [
|
|
@@ -273,6 +278,9 @@ export function formatAddRouteReport(result) {
|
|
|
273
278
|
lines.push(`Also copied ${routes.appliedDependencies.length} file(s) those routes import:`);
|
|
274
279
|
lines.push(...routes.appliedDependencies.map((dep) => ` ${dep}`));
|
|
275
280
|
}
|
|
281
|
+
if (routes.recorded.length > 0) {
|
|
282
|
+
lines.push(`Recorded ${routes.recorded.length} copied file(s) in ${TEMPLATE_RECORD_PATH}, so create-ailk update carries them forward.`);
|
|
283
|
+
}
|
|
276
284
|
if (routes.refused.length > 0) {
|
|
277
285
|
lines.push(`Routes not copied (${routes.refused.length}) — an import does not resolve (run create-ailk sync-routes for the paths): ${routes.refused.join(", ")}`);
|
|
278
286
|
}
|
package/dist/surfaces.js
CHANGED
|
@@ -805,6 +805,18 @@ export const ROUTE_SINCE = {
|
|
|
805
805
|
// #11106 D5 — the invitation accept page. Genuinely new, so it attaches at
|
|
806
806
|
// the fixed group's next release line.
|
|
807
807
|
"(authed)/account/invitations/[invitationId]": "0.60.0",
|
|
808
|
+
// #11164 AC-3 — the Privacy tab's data export, re-served by the site's own
|
|
809
|
+
// route handler. Genuinely new, so it attaches at the fixed group's next
|
|
810
|
+
// release line.
|
|
811
|
+
"(authed)/account/privacy/export": "0.60.0",
|
|
812
|
+
// #11154 — the member Appointments list and a type's booking page.
|
|
813
|
+
// Genuinely new, so they attach at the fixed group's next release line.
|
|
814
|
+
"(authed)/account/appointments": "0.60.0",
|
|
815
|
+
"(authed)/account/appointments/[slug]": "0.60.0",
|
|
816
|
+
// #11152 — the member thread page, which the New menu's Send message
|
|
817
|
+
// opens. Genuinely new, so it attaches at the fixed group's next release
|
|
818
|
+
// line.
|
|
819
|
+
"(authed)/account/inbox/thread": "0.60.0",
|
|
808
820
|
// #10051 D9 — the templates route family. Genuinely new, so it attaches at
|
|
809
821
|
// the fixed group's next release line.
|
|
810
822
|
templates: "0.50.0",
|
|
@@ -988,19 +1000,19 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
988
1000
|
// binds the config's actions to the popups, which import the menu and its
|
|
989
1001
|
// server actions. (account-config.ts itself imports none of them — a
|
|
990
1002
|
// spoke without sign-in drops the `(authed)` group and keeps the config.)
|
|
1003
|
+
// #11152 — Send message is a link to the thread page; its popup is gone.
|
|
991
1004
|
`${ROUTE_ROOT}/(authed)/account/new-menu.tsx`,
|
|
992
1005
|
`${ROUTE_ROOT}/(authed)/account/new-actions.ts`,
|
|
993
1006
|
`${ROUTE_ROOT}/(authed)/account/new-popups.tsx`,
|
|
994
|
-
`${ROUTE_ROOT}/(authed)/account/components/schedule-service.tsx`,
|
|
995
1007
|
`${ROUTE_ROOT}/(authed)/account/components/request-quote.tsx`,
|
|
996
|
-
`${ROUTE_ROOT}/(authed)/account/components/send-message.tsx`,
|
|
997
1008
|
],
|
|
998
1009
|
// #7920 — the member file read re-serves the hub's bytes with the
|
|
999
1010
|
// credential `forwardedCookieInit` returns.
|
|
1000
1011
|
"(authed)/account/inbox/message/[id]/file": ["apps/web/lib/server-api.ts"],
|
|
1001
|
-
// #8232 D13 — the settings route is a redirect now
|
|
1002
|
-
//
|
|
1003
|
-
//
|
|
1012
|
+
// #8232 D13 — the settings route is a redirect now. #11167 dropped its
|
|
1013
|
+
// `theme-modes.ts` (Color mode renders on every site), so it imports
|
|
1014
|
+
// nothing outside itself; the brand and theme files it once carried stay
|
|
1015
|
+
// listed so an older scaffold's copies still compile.
|
|
1004
1016
|
"(authed)/account/settings": [
|
|
1005
1017
|
"apps/web/lib/site-brand.tsx",
|
|
1006
1018
|
"apps/web/lib/site-theme.ts",
|
|
@@ -1029,17 +1041,15 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1029
1041
|
`${ROUTE_ROOT}/(authed)/account/settings-frame.tsx`,
|
|
1030
1042
|
`${ROUTE_ROOT}/(authed)/account/sign-in-method.ts`,
|
|
1031
1043
|
`${ROUTE_ROOT}/(authed)/account/profile-actions.ts`,
|
|
1032
|
-
`${ROUTE_ROOT}/(authed)/account/settings/theme-modes.ts`,
|
|
1033
1044
|
// #8233 C9 — the New menu's files beside account-config.ts: new-popups.tsx
|
|
1034
1045
|
// binds the config's actions to the popups, which import the menu and its
|
|
1035
1046
|
// server actions. (account-config.ts itself imports none of them — a
|
|
1036
1047
|
// spoke without sign-in drops the `(authed)` group and keeps the config.)
|
|
1048
|
+
// #11152 — Send message is a link to the thread page; its popup is gone.
|
|
1037
1049
|
`${ROUTE_ROOT}/(authed)/account/new-menu.tsx`,
|
|
1038
1050
|
`${ROUTE_ROOT}/(authed)/account/new-actions.ts`,
|
|
1039
1051
|
`${ROUTE_ROOT}/(authed)/account/new-popups.tsx`,
|
|
1040
|
-
`${ROUTE_ROOT}/(authed)/account/components/schedule-service.tsx`,
|
|
1041
1052
|
`${ROUTE_ROOT}/(authed)/account/components/request-quote.tsx`,
|
|
1042
|
-
`${ROUTE_ROOT}/(authed)/account/components/send-message.tsx`,
|
|
1043
1053
|
],
|
|
1044
1054
|
// #8339 D11 — Security holds the former Sign-in section, moved verbatim
|
|
1045
1055
|
// from General: `sign-in-method.ts` and what it imports. #8431 D8 — the
|
|
@@ -1068,11 +1078,12 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1068
1078
|
`${ROUTE_ROOT}/(authed)/account/settings-frame.tsx`,
|
|
1069
1079
|
`${ROUTE_ROOT}/(authed)/account/privacy/actions.ts`,
|
|
1070
1080
|
],
|
|
1071
|
-
// #8438 D14 — Privacy
|
|
1072
|
-
//
|
|
1073
|
-
//
|
|
1074
|
-
// deletion
|
|
1075
|
-
//
|
|
1081
|
+
// #8438 D14 — Privacy reads the registry through `member.consents`;
|
|
1082
|
+
// #11164 reshapes it (the lead, the data-use row, the training switch and
|
|
1083
|
+
// the Your data table) and drops the deletion request, so General's
|
|
1084
|
+
// deletion files are no longer its dependencies — only `profile-source.ts`
|
|
1085
|
+
// (which decides whether Support may take an account-deletion request) and
|
|
1086
|
+
// the `sign-in-method.ts` it imports, the same cross-directory rule #8339
|
|
1076
1087
|
// D11 applied to Notifications' cookie-settings link.
|
|
1077
1088
|
"(authed)/account/privacy": [
|
|
1078
1089
|
"apps/web/lib/account-config.ts",
|
|
@@ -1081,10 +1092,11 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1081
1092
|
`${ROUTE_ROOT}/(authed)/account/account-data.ts`,
|
|
1082
1093
|
`${ROUTE_ROOT}/(authed)/account/settings-frame.tsx`,
|
|
1083
1094
|
`${ROUTE_ROOT}/(authed)/account/sign-in-method.ts`,
|
|
1084
|
-
`${ROUTE_ROOT}/(authed)/account/profile-actions.ts`,
|
|
1085
|
-
`${ROUTE_ROOT}/(authed)/account/general/deletion-request.tsx`,
|
|
1086
1095
|
`${ROUTE_ROOT}/(authed)/account/general/profile-source.ts`,
|
|
1087
1096
|
],
|
|
1097
|
+
// #11164 AC-3 — the export route re-serves the member API's attachment
|
|
1098
|
+
// with the caller's own credential, the message file route's shape.
|
|
1099
|
+
"(authed)/account/privacy/export": ["apps/web/lib/server-api.ts"],
|
|
1088
1100
|
"(authed)/account/billing": [
|
|
1089
1101
|
"apps/web/lib/account-config.ts",
|
|
1090
1102
|
// #9401 D7 — the site's own Billing sections, the frozen stub the page imports.
|
|
@@ -1100,12 +1112,11 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1100
1112
|
// binds the config's actions to the popups, which import the menu and its
|
|
1101
1113
|
// server actions. (account-config.ts itself imports none of them — a
|
|
1102
1114
|
// spoke without sign-in drops the `(authed)` group and keeps the config.)
|
|
1115
|
+
// #11152 — Send message is a link to the thread page; its popup is gone.
|
|
1103
1116
|
`${ROUTE_ROOT}/(authed)/account/new-menu.tsx`,
|
|
1104
1117
|
`${ROUTE_ROOT}/(authed)/account/new-actions.ts`,
|
|
1105
1118
|
`${ROUTE_ROOT}/(authed)/account/new-popups.tsx`,
|
|
1106
|
-
`${ROUTE_ROOT}/(authed)/account/components/schedule-service.tsx`,
|
|
1107
1119
|
`${ROUTE_ROOT}/(authed)/account/components/request-quote.tsx`,
|
|
1108
|
-
`${ROUTE_ROOT}/(authed)/account/components/send-message.tsx`,
|
|
1109
1120
|
],
|
|
1110
1121
|
// #8234 — the Artifacts pages import files in their parent's directory, as
|
|
1111
1122
|
// #7430's children do; the artifact page also imports its own parent's
|
|
@@ -1129,6 +1140,34 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1129
1140
|
`${ROUTE_ROOT}/(authed)/account/artifacts/artifact-actions.ts`,
|
|
1130
1141
|
],
|
|
1131
1142
|
"(authed)/account/artifacts/[pieceId]/versions/[version]/file": ["apps/web/lib/server-api.ts"],
|
|
1143
|
+
// #11154 — the Appointments pages import files in their parent's directory,
|
|
1144
|
+
// as the Artifacts pages do; the booking page also imports its own parent's
|
|
1145
|
+
// `appointments-data.ts`, which an older synced `appointments/` might lack.
|
|
1146
|
+
"(authed)/account/appointments": [
|
|
1147
|
+
"apps/web/lib/server-api.ts",
|
|
1148
|
+
`${ROUTE_ROOT}/(authed)/account/account-data.ts`,
|
|
1149
|
+
`${ROUTE_ROOT}/(authed)/account/error-row.tsx`,
|
|
1150
|
+
`${ROUTE_ROOT}/(authed)/account/retry-button.tsx`,
|
|
1151
|
+
],
|
|
1152
|
+
"(authed)/account/appointments/[slug]": [
|
|
1153
|
+
"apps/web/lib/server-api.ts",
|
|
1154
|
+
`${ROUTE_ROOT}/(authed)/account/account-data.ts`,
|
|
1155
|
+
`${ROUTE_ROOT}/(authed)/account/error-row.tsx`,
|
|
1156
|
+
`${ROUTE_ROOT}/(authed)/account/retry-button.tsx`,
|
|
1157
|
+
`${ROUTE_ROOT}/(authed)/account/appointments/appointments-data.ts`,
|
|
1158
|
+
],
|
|
1159
|
+
// #11152 — the member thread page imports its parent's reads, error row
|
|
1160
|
+
// and the New menu's server actions (its composer posts through
|
|
1161
|
+
// `sendMessage`), plus the account config the reads come from.
|
|
1162
|
+
"(authed)/account/inbox/thread": [
|
|
1163
|
+
"apps/web/lib/account-config.ts",
|
|
1164
|
+
"apps/web/lib/server-api.ts",
|
|
1165
|
+
`${ROUTE_ROOT}/(authed)/account/account-data.ts`,
|
|
1166
|
+
`${ROUTE_ROOT}/(authed)/account/error-row.tsx`,
|
|
1167
|
+
`${ROUTE_ROOT}/(authed)/account/retry-button.tsx`,
|
|
1168
|
+
`${ROUTE_ROOT}/(authed)/account/new-actions.ts`,
|
|
1169
|
+
`${ROUTE_ROOT}/(authed)/account/new-popups.tsx`,
|
|
1170
|
+
],
|
|
1132
1171
|
// #8515 D12 — the onboarding page imports its parent's account-data.ts
|
|
1133
1172
|
// and error-row.tsx (which renders retry-button.tsx); its actions forward
|
|
1134
1173
|
// the credential `forwardedCookieInit` returns. account-data.ts reads the
|
|
@@ -1149,12 +1188,11 @@ export const ROUTE_DEPENDENCIES = {
|
|
|
1149
1188
|
// binds the config's actions to the popups, which import the menu and its
|
|
1150
1189
|
// server actions. (account-config.ts itself imports none of them — a
|
|
1151
1190
|
// spoke without sign-in drops the `(authed)` group and keeps the config.)
|
|
1191
|
+
// #11152 — Send message is a link to the thread page; its popup is gone.
|
|
1152
1192
|
`${ROUTE_ROOT}/(authed)/account/new-menu.tsx`,
|
|
1153
1193
|
`${ROUTE_ROOT}/(authed)/account/new-actions.ts`,
|
|
1154
1194
|
`${ROUTE_ROOT}/(authed)/account/new-popups.tsx`,
|
|
1155
|
-
`${ROUTE_ROOT}/(authed)/account/components/schedule-service.tsx`,
|
|
1156
1195
|
`${ROUTE_ROOT}/(authed)/account/components/request-quote.tsx`,
|
|
1157
|
-
`${ROUTE_ROOT}/(authed)/account/components/send-message.tsx`,
|
|
1158
1196
|
],
|
|
1159
1197
|
"(authed)/admin": [
|
|
1160
1198
|
"apps/web/lib/server-api.ts",
|
|
@@ -1271,6 +1309,9 @@ export const ROUTE_MESSAGE_NAMESPACES = {
|
|
|
1271
1309
|
// #8234 — the two Artifacts pages; the file route renders no string.
|
|
1272
1310
|
"(authed)/account/artifacts": ["account"],
|
|
1273
1311
|
"(authed)/account/artifacts/[pieceId]": ["account"],
|
|
1312
|
+
// #11154 — the two Appointments pages.
|
|
1313
|
+
"(authed)/account/appointments": ["account"],
|
|
1314
|
+
"(authed)/account/appointments/[slug]": ["account"],
|
|
1274
1315
|
// #8515 — the onboarding page.
|
|
1275
1316
|
"(authed)/account/onboarding": ["account"],
|
|
1276
1317
|
// #9966 D2 — the hub's consent page reads its own namespace.
|
package/dist/sync-routes.d.ts
CHANGED
|
@@ -17,6 +17,13 @@ export interface SyncRoutesOptions {
|
|
|
17
17
|
versions: WorkspaceVersionMap;
|
|
18
18
|
/** Copy the missing routes into the target. Default false = check only. */
|
|
19
19
|
apply?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The create-ailk version the copied files are recorded at in
|
|
22
|
+
* `.ailk-template-files.json` (#11213). Defaults to the running package's
|
|
23
|
+
* own — the scaffold marker `CREATE_AILK_VERSION`, which `scaffold()`
|
|
24
|
+
* records a fresh copy at too. Only read with `apply`.
|
|
25
|
+
*/
|
|
26
|
+
version?: string;
|
|
20
27
|
/**
|
|
21
28
|
* Surface ids to treat as carried whether or not any of their route dirs
|
|
22
29
|
* exists yet (#6653 D8) — `add-module` passes the added module's
|
|
@@ -70,6 +77,13 @@ export interface SyncRoutesResult {
|
|
|
70
77
|
missingDependencies: string[];
|
|
71
78
|
/** Dependency files copied this run. Sorted. */
|
|
72
79
|
appliedDependencies: string[];
|
|
80
|
+
/**
|
|
81
|
+
* The copied files `--apply` recorded in `.ailk-template-files.json`
|
|
82
|
+
* (#11213): every recordable route and dependency file it wrote, when the
|
|
83
|
+
* site has a record. Empty without `apply`, and for a site with none.
|
|
84
|
+
* Sorted.
|
|
85
|
+
*/
|
|
86
|
+
recorded: string[];
|
|
73
87
|
/**
|
|
74
88
|
* `ROUTE_MESSAGE_NAMESPACES` dot-paths, of any route in `missing`, absent
|
|
75
89
|
* from the target's `messages/en.json`. CHECK-ONLY — never copied (see
|
|
@@ -190,7 +204,7 @@ export interface SyncRoutesArgs {
|
|
|
190
204
|
apply: boolean;
|
|
191
205
|
help: boolean;
|
|
192
206
|
}
|
|
193
|
-
export declare const SYNC_ROUTES_HELP = "create-ailk sync-routes \u2014 copy template routes an existing site is missing.\n\nUsage:\n create-ailk sync-routes [<target-dir>] [--apply]\n\nArguments:\n <target-dir> An already-scaffolded repo (contains\n architecture.yaml). Defaults to the current dir.\n\nOptions:\n --apply Copy the missing route directories into the target.\n Without it the command only reports: exit 1 when a\n route is missing, 0 when in sync.\n --help, -h Print this message.\n\nChecks every core route plus the routes of each surface the site carries; a\nsurface gated off at scaffold time is skipped, not drift. A route the site has\nchanged locally is reported and never overwritten. Nothing is deleted except,\non a spoke, the retired legacy checkout's files that still match create-ailk's\ncopy: --apply removes them and rewrites the generated billing action (#9142).\n";
|
|
207
|
+
export declare const SYNC_ROUTES_HELP = "create-ailk sync-routes \u2014 copy template routes an existing site is missing.\n\nUsage:\n create-ailk sync-routes [<target-dir>] [--apply]\n\nArguments:\n <target-dir> An already-scaffolded repo (contains\n architecture.yaml). Defaults to the current dir.\n\nOptions:\n --apply Copy the missing route directories into the target.\n Without it the command only reports: exit 1 when a\n route is missing, 0 when in sync.\n --help, -h Print this message.\n\nChecks every core route plus the routes of each surface the site carries; a\nsurface gated off at scaffold time is skipped, not drift. A route the site has\nchanged locally is reported and never overwritten. Nothing is deleted except,\non a spoke, the retired legacy checkout's files that still match create-ailk's\ncopy: --apply removes them and rewrites the generated billing action (#9142).\nEvery file --apply copies is recorded in .ailk-template-files.json, when the\nsite has one, so `create-ailk update` carries it forward (#11213).\n";
|
|
194
208
|
/**
|
|
195
209
|
* Parse the argv AFTER the `sync-routes` word. Strict `node:util` parseArgs,
|
|
196
210
|
* like `parseCliArgs`; at most one positional.
|
package/dist/sync-routes.js
CHANGED
|
@@ -30,6 +30,13 @@
|
|
|
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
|
+
* - What `--apply` copies, it records (#11213). Every recordable file it
|
|
34
|
+
* writes gets a row in `.ailk-template-files.json` — the sha256 of the
|
|
35
|
+
* bytes written and the create-ailk version doing the copy — so
|
|
36
|
+
* `create-ailk update` carries it forward as the untouched template
|
|
37
|
+
* copy it is, never holding it as "exists, not in the record". A site
|
|
38
|
+
* with no record gets none; a malformed one refuses the run before the
|
|
39
|
+
* first write.
|
|
33
40
|
*
|
|
34
41
|
* Pure module: no `import.meta.url`, so jest can import it directly. The
|
|
35
42
|
* package's own `templates/` dir is supplied by programmatic.ts.
|
|
@@ -38,14 +45,14 @@ import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, readFileSyn
|
|
|
38
45
|
import { tmpdir } from "node:os";
|
|
39
46
|
import { basename, dirname, join, posix, resolve, sep } from "node:path";
|
|
40
47
|
import { parseArgs } from "node:util";
|
|
41
|
-
import { copyTemplate, renderTemplateFile } from "./copy.js";
|
|
48
|
+
import { buildScaffoldMarkers, copyTemplate, renderTemplateFile } from "./copy.js";
|
|
42
49
|
import { SPOKE_BILLING_ACTION_PATH } from "./derive-architecture.js";
|
|
43
50
|
import { appendEnvRows } from "./lib/declared-env.js";
|
|
44
51
|
import { ENV_CATALOG } from "./lib/env-catalog.js";
|
|
45
52
|
import { publicTreeRemoved } from "./lib/site-modules.js";
|
|
46
53
|
import { BILLING_ACTION, BILLING_ACTION_MARKER, RETIRED_CHECKOUT_E2E_MARKER, RETIRED_CHECKOUT_E2E_WORKFLOW_PATH, RETIRED_SPOKE_CHECKOUT_PATHS, } from "./spoke-checkout.js";
|
|
47
54
|
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";
|
|
55
|
+
import { TEMPLATE_RECORD_PATH, parseTemplateRecord, recordCopiedFiles, serializeTemplateRecord, sha256Hex, } from "./template-record.js";
|
|
49
56
|
import { SPOKE_SEAM_FILES, isSpokeExcluded, readSpokeShape, spokeExclusions, } from "./topology.js";
|
|
50
57
|
/** Template-relative prefix every `apps/web` route directory sits under. */
|
|
51
58
|
const ROUTE_ROOT = "apps/web/app/[locale]";
|
|
@@ -748,7 +755,32 @@ export function syncRoutes(opts) {
|
|
|
748
755
|
].sort();
|
|
749
756
|
const applied = [];
|
|
750
757
|
const appliedDependencies = [];
|
|
758
|
+
const recorded = [];
|
|
751
759
|
if (opts.apply === true) {
|
|
760
|
+
// #11213 — the site's record, read before the first write: every
|
|
761
|
+
// recordable file copied below is recorded at the create-ailk version
|
|
762
|
+
// doing the copy, so `update` never reads a synced file as "exists, not
|
|
763
|
+
// in the record". A site with no record gets none; a malformed one
|
|
764
|
+
// refuses the run. A row at a path no longer recorded is dropped, as
|
|
765
|
+
// `update` drops it (#10173).
|
|
766
|
+
const recordPath = join(targetAbs, TEMPLATE_RECORD_PATH);
|
|
767
|
+
let recording;
|
|
768
|
+
if (existsSync(recordPath)) {
|
|
769
|
+
let record;
|
|
770
|
+
try {
|
|
771
|
+
record = parseTemplateRecord(readFileSync(recordPath, "utf8"), { onUnrecordable: () => { } });
|
|
772
|
+
}
|
|
773
|
+
catch (err) {
|
|
774
|
+
throw new Error(`${err.message}; nothing copied`, { cause: err });
|
|
775
|
+
}
|
|
776
|
+
const version = opts.version ?? buildScaffoldMarkers(markers.PROJECT_NAME)["CREATE_AILK_VERSION"];
|
|
777
|
+
if (version === undefined) {
|
|
778
|
+
throw new Error(`cannot record the copied files in ${TEMPLATE_RECORD_PATH}: no create-ailk version; nothing copied`);
|
|
779
|
+
}
|
|
780
|
+
recording = { record, version };
|
|
781
|
+
}
|
|
782
|
+
/** Site-relative path → sha256 of the bytes written, for the record. */
|
|
783
|
+
const copied = new Map();
|
|
752
784
|
const writable = missingRoutes.filter((r) => !refusedSet.has(r));
|
|
753
785
|
// #6786 — the closure a fresh spoke scaffold drops, not only its seeds:
|
|
754
786
|
// a template file that imports a seed goes with it here too.
|
|
@@ -780,6 +812,7 @@ export function syncRoutes(opts) {
|
|
|
780
812
|
? []
|
|
781
813
|
: spokeExcludedUnder(templateRouteRoot, route, spokeShape)),
|
|
782
814
|
],
|
|
815
|
+
onWrite: (rel, bytes) => copied.set(`${ROUTE_ROOT}/${route}/${rel}`, sha256Hex(bytes)),
|
|
783
816
|
});
|
|
784
817
|
}
|
|
785
818
|
for (const dep of missingDependencies) {
|
|
@@ -787,9 +820,18 @@ export function syncRoutes(opts) {
|
|
|
787
820
|
if (!dst.startsWith(targetAbs + sep)) {
|
|
788
821
|
throw new Error(`refusing to write outside target dir: ${dst}`);
|
|
789
822
|
}
|
|
790
|
-
copyDependencyFile(opts.templatesDir, dep, dst, opts.versions, markers);
|
|
823
|
+
const bytes = copyDependencyFile(opts.templatesDir, dep, dst, opts.versions, markers);
|
|
824
|
+
if (bytes !== undefined)
|
|
825
|
+
copied.set(dep, sha256Hex(bytes));
|
|
791
826
|
appliedDependencies.push(dep);
|
|
792
827
|
}
|
|
828
|
+
if (recording !== undefined) {
|
|
829
|
+
const next = recordCopiedFiles(recording.record, copied, recording.version);
|
|
830
|
+
if (next.recorded.length > 0) {
|
|
831
|
+
writeFileSync(recordPath, serializeTemplateRecord(next.record));
|
|
832
|
+
recorded.push(...next.recorded);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
793
835
|
// #7874 D9 — a spoke declares what the copied routes read, as the last
|
|
794
836
|
// write. A malformed env_contract block throws EnvContractError naming
|
|
795
837
|
// its line; the files copied above stay.
|
|
@@ -807,6 +849,7 @@ export function syncRoutes(opts) {
|
|
|
807
849
|
routeImports,
|
|
808
850
|
missingDependencies,
|
|
809
851
|
appliedDependencies,
|
|
852
|
+
recorded,
|
|
810
853
|
missingMessageNamespaces,
|
|
811
854
|
skippedSurfaces,
|
|
812
855
|
publicTreeRemoved: publicTreeSkipped,
|
|
@@ -848,14 +891,17 @@ function hasMessageNamespace(targetAbs, namespace) {
|
|
|
848
891
|
* (`./logo.png`, #9406) is copied byte-for-byte. Never overwrites: the caller
|
|
849
892
|
* (`syncRoutes`) only calls this for a path already confirmed absent from the
|
|
850
893
|
* target, but the check is repeated here so this helper is safe to call on
|
|
851
|
-
* its own.
|
|
894
|
+
* its own. Returns the bytes written, for the record (#11213) — `undefined`
|
|
895
|
+
* when the file was already there.
|
|
852
896
|
*/
|
|
853
897
|
function copyDependencyFile(templatesDir, rel, dst, versions, markers) {
|
|
854
898
|
if (existsSync(dst))
|
|
855
|
-
return;
|
|
899
|
+
return undefined;
|
|
856
900
|
mkdirSync(dirname(dst), { recursive: true });
|
|
857
901
|
const bytes = readFileSync(join(templatesDir, ...rel.split("/")));
|
|
858
|
-
|
|
902
|
+
const rendered = renderTemplateFile(bytes, rel, versions, markers);
|
|
903
|
+
writeFileSync(dst, rendered);
|
|
904
|
+
return rendered;
|
|
859
905
|
}
|
|
860
906
|
/** Render the report the CLI prints after a run. Ends with a newline. */
|
|
861
907
|
export function formatSyncRoutesReport(result, apply) {
|
|
@@ -919,6 +965,10 @@ export function formatSyncRoutesReport(result, apply) {
|
|
|
919
965
|
: `[create-ailk] Also required — ${result.missingDependencies.length} file(s) the above route(s) import:`);
|
|
920
966
|
lines.push(...result.missingDependencies.map((dep) => ` ${dep}`));
|
|
921
967
|
}
|
|
968
|
+
// #11213 — what the record gained, so the next `update` carries it forward.
|
|
969
|
+
if (result.recorded.length > 0) {
|
|
970
|
+
lines.push(`[create-ailk] Recorded ${result.recorded.length} copied file(s) in ${TEMPLATE_RECORD_PATH}, so \`create-ailk update\` carries them forward.`);
|
|
971
|
+
}
|
|
922
972
|
if (result.missingMessageNamespaces.length > 0) {
|
|
923
973
|
lines.push(`[create-ailk] Also required — message namespace(s) not found in apps/web/messages/en.json (add manually, not auto-merged):`);
|
|
924
974
|
lines.push(...result.missingMessageNamespaces.map((ns) => ` ${ns}`));
|
|
@@ -974,6 +1024,8 @@ surface gated off at scaffold time is skipped, not drift. A route the site has
|
|
|
974
1024
|
changed locally is reported and never overwritten. Nothing is deleted except,
|
|
975
1025
|
on a spoke, the retired legacy checkout's files that still match create-ailk's
|
|
976
1026
|
copy: --apply removes them and rewrites the generated billing action (#9142).
|
|
1027
|
+
Every file --apply copies is recorded in .ailk-template-files.json, when the
|
|
1028
|
+
site has one, so \`create-ailk update\` carries it forward (#11213).
|
|
977
1029
|
`;
|
|
978
1030
|
/**
|
|
979
1031
|
* 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
|
+
}
|