create-ailk 0.40.0 → 0.40.2

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.
Files changed (72) hide show
  1. package/README.md +26 -4
  2. package/component-catalog.json +1 -1
  3. package/component-catalog.md +1 -1
  4. package/dist/add-module.d.ts +2 -1
  5. package/dist/add-module.js +17 -1
  6. package/dist/cutover.d.ts +7 -3
  7. package/dist/cutover.js +8 -3
  8. package/dist/lib/declared-env.d.ts +5 -1
  9. package/dist/lib/declared-env.js +6 -1
  10. package/dist/lib/env-catalog.d.ts +3 -2
  11. package/dist/lib/env-catalog.js +4 -8
  12. package/dist/module-architecture.js +0 -1
  13. package/dist/programmatic.js +18 -9
  14. package/dist/remove-module.js +1 -1
  15. package/dist/seam-refresh.d.ts +60 -0
  16. package/dist/seam-refresh.js +214 -0
  17. package/dist/spoke-checkout.d.ts +12 -3
  18. package/dist/spoke-checkout.js +14 -5
  19. package/dist/sync-routes.d.ts +10 -1
  20. package/dist/sync-routes.js +61 -6
  21. package/dist/template-record.d.ts +14 -2
  22. package/dist/template-record.js +60 -22
  23. package/dist/topology.js +3 -4
  24. package/dist/update.d.ts +13 -1
  25. package/dist/update.js +100 -8
  26. package/package.json +3 -3
  27. package/templates/.env.example +6 -0
  28. package/templates/.github/workflows/ci.yml +3 -0
  29. package/templates/apps/api/.env.example +12 -0
  30. package/templates/apps/api/CLAUDE.md +10 -7
  31. package/templates/apps/mcp/CLAUDE.md +25 -5
  32. package/templates/apps/web/.env.example +7 -1
  33. package/templates/apps/web/CLAUDE.md +40 -13
  34. package/templates/apps/web/app/[locale]/(authed)/account/connect/__tests__/page.test.tsx +1 -1
  35. package/templates/apps/web/app/[locale]/layout.tsx +41 -24
  36. package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +56 -1
  37. package/templates/apps/web/app/api/revalidate/route.ts +45 -4
  38. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +60 -0
  39. package/templates/apps/web/app/llms.txt/route.ts +17 -4
  40. package/templates/apps/web/app/openapi.json/__tests__/route.test.ts +15 -7
  41. package/templates/apps/web/auth.config.tsx +2 -0
  42. package/templates/apps/web/auth.ts +28 -4
  43. package/templates/apps/web/jest.config.cjs +1 -1
  44. package/templates/apps/web/lib/__tests__/auth-email.test.ts +21 -0
  45. package/templates/apps/web/lib/__tests__/docs-path.test.ts +20 -2
  46. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +246 -0
  47. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +58 -0
  48. package/templates/apps/web/lib/__tests__/relay.test.ts +127 -12
  49. package/templates/apps/web/lib/__tests__/served-pages.test.ts +163 -20
  50. package/templates/apps/web/lib/__tests__/server-api.test.ts +72 -7
  51. package/templates/apps/web/lib/__tests__/services-path.test.ts +22 -1
  52. package/templates/apps/web/lib/__tests__/site-brand.test.ts +77 -0
  53. package/templates/apps/web/lib/__tests__/site-contact-lines.test.ts +64 -0
  54. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +144 -4
  55. package/templates/apps/web/lib/auth-email.ts +19 -0
  56. package/templates/apps/web/lib/docs-path.ts +1 -1
  57. package/templates/apps/web/lib/hub-site-config.ts +154 -0
  58. package/templates/apps/web/lib/mcp-oauth.ts +123 -17
  59. package/templates/apps/web/lib/profile-back-link.ts +49 -12
  60. package/templates/apps/web/lib/relay.ts +48 -9
  61. package/templates/apps/web/lib/served-pages.ts +144 -39
  62. package/templates/apps/web/lib/server-api.ts +37 -4
  63. package/templates/apps/web/lib/services-path.ts +1 -1
  64. package/templates/apps/web/lib/site-brand.tsx +66 -0
  65. package/templates/apps/web/lib/site-contact-email.ts +24 -4
  66. package/templates/apps/web/lib/site-contact-lines.ts +20 -4
  67. package/templates/apps/web/lib/site-identity.ts +38 -2
  68. package/templates/apps/web/messages/en.json +13 -8
  69. package/templates/apps/web/middleware.ts +4 -2
  70. package/templates/apps/web/src/lib/routes.ts +13 -0
  71. package/templates/tools/declared-env.ts +6 -1
  72. package/versions.json +51 -51
@@ -16,16 +16,24 @@
16
16
  * or two lines. The same local `_site.mdx` frontmatter read as its sibling
17
17
  * `site-contact-email.ts`, for the same reason (see that file's header). Any
18
18
  * failure is `[]`.
19
+ *
20
+ * On a hub-connected site holding a hub identity row (#11456 D4), line 1
21
+ * comes from that row's `address` (the value `readHubSite` last resolved,
22
+ * which the layout awaits first) and line 2 from `readSiteContactEmail`,
23
+ * which reads the same row.
19
24
  */
20
25
 
21
26
  import { readFileSync } from "node:fs";
22
27
  import { join } from "node:path";
23
28
 
24
- import { SiteIdentitySchema } from "@working-theory/site-config/schema";
29
+ import {
30
+ SiteIdentitySchema,
31
+ type SiteIdentity,
32
+ } from "@working-theory/site-config/schema";
25
33
  import { parse as parseYaml } from "yaml";
26
34
 
35
+ import { heldHubSite } from "./hub-site-config";
27
36
  import { resolveContentRoot } from "./site-brand";
28
-
29
37
  import { readSiteContactEmail } from "./site-contact-email";
30
38
 
31
39
  const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
@@ -39,8 +47,13 @@ function nonEmpty(value: unknown): string | undefined {
39
47
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
40
48
  }
41
49
 
42
- /** The locality line of a LocalBusiness or Person identity, or `undefined`. */
50
+ /**
51
+ * The locality line of a LocalBusiness or Person identity — the held hub
52
+ * row's, else the file's — or `undefined`.
53
+ */
43
54
  function readLocalityLine(): string | undefined {
55
+ const hubIdentity = heldHubSite()?.identity;
56
+ if (hubIdentity) return localityOf(hubIdentity);
44
57
  const raw = readFileSync(join(resolveContentRoot(), "_site.mdx"), "utf8");
45
58
  const match = FRONTMATTER_RE.exec(raw);
46
59
  if (!match) return undefined;
@@ -48,7 +61,10 @@ function readLocalityLine(): string | undefined {
48
61
  if (!fm || typeof fm !== "object") return undefined;
49
62
  const parsed = SiteIdentitySchema.safeParse((fm as { siteIdentity?: unknown }).siteIdentity);
50
63
  if (!parsed.success) return undefined;
51
- const identity = parsed.data;
64
+ return localityOf(parsed.data);
65
+ }
66
+
67
+ function localityOf(identity: SiteIdentity): string | undefined {
52
68
  if (identity.kind !== "LocalBusiness" && identity.kind !== "Person") return undefined;
53
69
  const parts = [nonEmpty(identity.address?.addressLocality), nonEmpty(identity.address?.addressRegion)].filter(
54
70
  (part): part is string => part !== undefined,
@@ -15,6 +15,12 @@
15
15
  * module, and Next.js evaluates a layout module before any page under it
16
16
  * renders, so every `renderPage` / `pageToJsonLd` call sees the identity
17
17
  * without a per-route prop.
18
+ *
19
+ * #11456 D4 — a hub-connected site (`hubConnected()`) also registers a
20
+ * reader, which `pageToJsonLd` awaits per render: the hub identity row with
21
+ * the file registration's `baseUrl` (never the hub `url`, so no workspace
22
+ * value moves an `@id`), else the module-load registration. A site that is not
23
+ * hub-connected registers no reader and composes exactly as before.
18
24
  */
19
25
 
20
26
  import { readdirSync, readFileSync } from "node:fs";
@@ -28,13 +34,15 @@ import {
28
34
  getContentAdapter,
29
35
  setSiteFeatureListReader,
30
36
  setSiteIdentity,
37
+ setSiteIdentityReader,
31
38
  type SiteIdentityRegistration,
32
39
  } from "@working-theory/page-renderer";
33
40
  import { featureListFromSections } from "@working-theory/schema";
34
41
  import { SiteIdentitySchema } from "@working-theory/site-config/schema";
35
42
  import { parse as parseYaml } from "yaml";
36
43
 
37
- import { resolveContentRoot } from "./site-brand";
44
+ import { hubConnected, readHubSite } from "./hub-site-config";
45
+ import { brandFrom, resolveContentRoot, SITE_BASE_URL } from "./site-brand";
38
46
 
39
47
  const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
40
48
 
@@ -184,7 +192,35 @@ export function readSiteIdentity(
184
192
  return registration;
185
193
  }
186
194
 
187
- setSiteIdentity(readSiteIdentity());
195
+ /**
196
+ * The JSON-LD registration from the hub identity row (#11456 D4), or
197
+ * `undefined` when there is none. `siteName` is the brand's from the same
198
+ * read (one line);
199
+ * `baseUrl` is the file registration's, else `SITE_BASE_URL`; the file's
200
+ * featureList is kept only when the hub identity carries a product.
201
+ */
202
+ async function readHubSiteIdentity(
203
+ file: SiteIdentityRegistration | undefined,
204
+ ): Promise<SiteIdentityRegistration | undefined> {
205
+ const hub = await readHubSite();
206
+ const identity = hub?.identity;
207
+ if (!identity) return undefined;
208
+ const registration: SiteIdentityRegistration = {
209
+ siteName: brandFrom(hub).siteName,
210
+ baseUrl: file?.baseUrl ?? SITE_BASE_URL,
211
+ identity,
212
+ };
213
+ if (carriesProduct(identity) && file?.featureList !== undefined) {
214
+ registration.featureList = file.featureList;
215
+ }
216
+ return registration;
217
+ }
218
+
219
+ const fileRegistration = readSiteIdentity();
220
+ setSiteIdentity(fileRegistration);
221
+ if (hubConnected()) {
222
+ setSiteIdentityReader(() => readHubSiteIdentity(fileRegistration));
223
+ }
188
224
 
189
225
  // #10644 D3, D4 — under the database adapter the product's featureList is
190
226
  // read through the adapter each time a page's JSON-LD is composed: an async
@@ -689,15 +689,19 @@
689
689
  "editor": {
690
690
  "toolChanges": "Show unsaved changes",
691
691
  "backLabel": "Pages",
692
+ "statusLive": "Live",
692
693
  "statusDraft": "Draft",
693
- "statusPublished": "Published",
694
- "statusPublishedNewer": "Published, newer changes not live",
694
+ "statusDraftHint": "Someone who can publish needs to publish it.",
695
+ "publishButton": "Publish",
696
+ "publishing": "Publishing…",
697
+ "publishMenu": "More publish options",
698
+ "discardChanges": "Discard changes",
699
+ "discardConfirm": "Discard all unpublished changes?",
700
+ "discardConfirmDetail": "The page goes back to what's live.",
701
+ "discardCancel": "Cancel",
702
+ "discardError": "Could not discard the changes. Try again.",
695
703
  "publishedSwitch": "Published",
696
704
  "publishBlockedHint": "Publish waits until the page is ready.",
697
- "publishChanges": "Publish changes",
698
- "unsaved": "Unsaved",
699
- "unsavedChanges": "Unsaved changes",
700
- "discardButton": "Discard",
701
705
  "loading": "Loading…",
702
706
  "loadError": "Could not load this page. Try again.",
703
707
  "retryButton": "Try again",
@@ -760,9 +764,7 @@
760
764
  "altWhy": "Screen readers and search engines can't see an image without alt text.",
761
765
  "altOutcome": "Every reader gets the image's meaning, and the page is easier to find."
762
766
  },
763
- "saveButton": "Save",
764
767
  "saving": "Saving…",
765
- "saved": "Saved",
766
768
  "saveError": "Could not save. Try again.",
767
769
  "publishError": "Could not publish. Try again.",
768
770
  "unpublishError": "Could not unpublish. Try again.",
@@ -778,6 +780,9 @@
778
780
  "bodyCodeOnly": "This page has markup only the Code view can show, so it opens in Code.",
779
781
  "tagPlaceholder": "{kind}: {slug}",
780
782
  "pinnedFaq": "Pinned FAQ: {question}",
783
+ "pinnedProof": "Pinned proof: {name}",
784
+ "referenceNotLive": "Not live",
785
+ "referenceMissing": "Missing",
781
786
  "pulledTag": "FAQs tagged {tag}"
782
787
  },
783
788
  "body": {
@@ -20,8 +20,9 @@
20
20
  // the security headers are stamped.
21
21
  //
22
22
  // The spoke file routes (#9162) — `/reports/<slug>/file`,
23
- // `/account/inbox/message/<id>/file` and
24
- // `/account/artifacts/<pieceId>/versions/<version>/file` — get every baseline
23
+ // `/account/inbox/message/<id>/file`,
24
+ // `/account/artifacts/<pieceId>/versions/<version>/file` and the data export
25
+ // `/account/privacy/export` (#11164) — get every baseline
25
26
  // header but the CSP. Their handlers set the hub's sandbox policy, and this
26
27
  // middleware runs before them: Next puts its headers on the response first and
27
28
  // adds a handler header only where none is set yet, so a site CSP stamped here
@@ -120,6 +121,7 @@ const FILE_ROUTE_PATHS = [
120
121
  /^\/reports\/[^/]+\/file$/,
121
122
  /^\/account\/inbox\/message\/[^/]+\/file$/,
122
123
  /^\/account\/artifacts\/[^/]+\/versions\/[^/]+\/file$/,
124
+ /^\/account\/privacy\/export$/,
123
125
  ];
124
126
 
125
127
  const LOCALE_PREFIX = new RegExp(`^/(${enabledLocales.join("|")})(?=/)`);
@@ -59,3 +59,16 @@ export function pagePathFor(page: {
59
59
  }): string {
60
60
  return pagePath(page, SERVICES_PATH);
61
61
  }
62
+
63
+ /** The agent-contact block llms.txt ends with on a site that serves /contact (#11423). */
64
+ export function agentContactLines(baseUrl: string, siteName: string): string[] {
65
+ return [
66
+ "## For agents",
67
+ "",
68
+ `- Contact page: ${baseUrl}/contact`,
69
+ ` To reach ${siteName} for a person, send their message through this page's form. Send one message per person, not one per attempt.`,
70
+ `- MCP manifest: ${baseUrl}/.well-known/mcp.json`,
71
+ ` Where it names an mcpEndpoint, that server's capture_lead tool sends the message without the form: give the person's email, put their name and message in payload, and send source "mcp".`,
72
+ "",
73
+ ];
74
+ }
@@ -27,11 +27,16 @@
27
27
  import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
28
28
  import { join } from "node:path";
29
29
 
30
- /** Names the platform sets, which need no row (D4). Fixed: a site cannot extend it. */
30
+ /**
31
+ * Names the platform sets, which need no row (D4). Fixed: a site cannot extend it.
32
+ * `__NEXT_RELATIVE_DIST_DIR` is Next's own: it sets it for the build it runs, and
33
+ * `apps/web/lib/served-pages.ts` reads it to find the build's routes manifest.
34
+ */
31
35
  export const PLATFORM_ENV_NAMES: readonly string[] = [
32
36
  "NODE_ENV",
33
37
  "NEXT_RUNTIME",
34
38
  "NEXT_PHASE",
39
+ "__NEXT_RELATIVE_DIST_DIR",
35
40
  "CI",
36
41
  "PORT",
37
42
  "VERCEL",
package/versions.json CHANGED
@@ -1,69 +1,69 @@
1
1
  {
2
- "@working-theory/account": "0.64.0",
3
- "@working-theory/admin-ui": "0.64.0",
4
- "@working-theory/aeo": "0.64.0",
5
- "@working-theory/agent-context": "0.64.0",
2
+ "@working-theory/account": "0.66.0",
3
+ "@working-theory/admin-ui": "0.66.0",
4
+ "@working-theory/aeo": "0.66.0",
5
+ "@working-theory/agent-context": "0.66.0",
6
6
  "@working-theory/agent-contract": "0.1.0",
7
7
  "@working-theory/agent-memory": "0.0.0",
8
8
  "@working-theory/ai": "0.1.0",
9
- "@working-theory/analytics": "0.64.0",
10
- "@working-theory/api": "0.64.0",
11
- "@working-theory/api-client": "0.64.0",
12
- "@working-theory/auth": "0.64.0",
9
+ "@working-theory/analytics": "0.66.0",
10
+ "@working-theory/api": "0.66.0",
11
+ "@working-theory/api-client": "0.66.0",
12
+ "@working-theory/auth": "0.66.0",
13
13
  "@working-theory/cda-filesystem": "0.0.0",
14
- "@working-theory/cli": "0.64.0",
15
- "@working-theory/common": "0.64.0",
14
+ "@working-theory/cli": "0.66.0",
15
+ "@working-theory/common": "0.66.0",
16
16
  "@working-theory/consent": "0.1.0",
17
- "@working-theory/content-adapters": "0.64.0",
18
- "@working-theory/content-projection": "0.64.0",
19
- "@working-theory/email": "0.64.0",
17
+ "@working-theory/content-adapters": "0.66.0",
18
+ "@working-theory/content-projection": "0.66.0",
19
+ "@working-theory/email": "0.66.0",
20
20
  "@working-theory/env": "0.0.0",
21
- "@working-theory/eslint-config": "0.64.0",
22
- "@working-theory/fumadocs-schema": "0.64.0",
23
- "@working-theory/ids": "0.20.1",
24
- "@working-theory/jsonld": "0.64.0",
25
- "@working-theory/license": "0.64.0",
26
- "@working-theory/mcp-server": "0.64.0",
27
- "@working-theory/metadata": "0.64.0",
28
- "@working-theory/observability": "0.64.0",
29
- "@working-theory/page-renderer": "0.64.0",
21
+ "@working-theory/eslint-config": "0.66.0",
22
+ "@working-theory/fumadocs-schema": "0.66.0",
23
+ "@working-theory/ids": "0.21.0",
24
+ "@working-theory/jsonld": "0.66.0",
25
+ "@working-theory/license": "0.66.0",
26
+ "@working-theory/mcp-server": "0.66.0",
27
+ "@working-theory/metadata": "0.66.0",
28
+ "@working-theory/observability": "0.66.0",
29
+ "@working-theory/page-renderer": "0.66.0",
30
30
  "@working-theory/plugin-mcp": "0.1.3",
31
- "@working-theory/schema": "0.64.0",
32
- "@working-theory/schema-pack-registry": "0.64.0",
33
- "@working-theory/schema-validator": "0.64.0",
34
- "@working-theory/sections-registry": "0.64.0",
35
- "@working-theory/site-config": "0.64.0",
36
- "@working-theory/site-pages": "0.64.0",
37
- "@working-theory/spoke-checkout": "0.7.20",
38
- "@working-theory/stripe-client": "0.64.0",
39
- "@working-theory/templates": "0.64.0",
40
- "@working-theory/theme": "0.64.0",
41
- "@working-theory/ui": "0.64.0",
42
- "@working-theory/validation": "0.64.0",
43
- "@working-theory/web-i18n": "0.64.0",
44
- "@working-theory/admin": "0.16.2",
45
- "@working-theory/api-commerce": "0.1.18",
46
- "@working-theory/api-content-write": "0.10.2",
47
- "@working-theory/api-hub": "0.6.3",
48
- "@working-theory/api-multi-tenant": "0.3.4",
49
- "@working-theory/api-scheduling": "0.6.3",
50
- "@working-theory/api-signal-collectors": "0.6.4",
51
- "@working-theory/api-workspace": "0.10.2",
31
+ "@working-theory/schema": "0.66.0",
32
+ "@working-theory/schema-pack-registry": "0.66.0",
33
+ "@working-theory/schema-validator": "0.66.0",
34
+ "@working-theory/sections-registry": "0.66.0",
35
+ "@working-theory/site-config": "0.66.0",
36
+ "@working-theory/site-pages": "0.66.0",
37
+ "@working-theory/spoke-checkout": "0.7.22",
38
+ "@working-theory/stripe-client": "0.66.0",
39
+ "@working-theory/templates": "0.66.0",
40
+ "@working-theory/theme": "0.66.0",
41
+ "@working-theory/ui": "0.66.0",
42
+ "@working-theory/validation": "0.66.0",
43
+ "@working-theory/web-i18n": "0.66.0",
44
+ "@working-theory/admin": "0.18.0",
45
+ "@working-theory/api-commerce": "0.2.0",
46
+ "@working-theory/api-content-write": "0.11.0",
47
+ "@working-theory/api-hub": "0.7.0",
48
+ "@working-theory/api-multi-tenant": "0.4.0",
49
+ "@working-theory/api-scheduling": "0.6.5",
50
+ "@working-theory/api-signal-collectors": "0.6.6",
51
+ "@working-theory/api-workspace": "0.12.0",
52
52
  "@working-theory/billing-client": "0.0.0",
53
53
  "@working-theory/branding": "0.0.0",
54
54
  "@working-theory/license-client": "0.0.0",
55
55
  "@working-theory/license-manifest": "0.0.0",
56
- "@working-theory/mcp-scheduling": "0.4.5",
57
- "@working-theory/mcp-signal-collectors": "0.2.18",
58
- "@working-theory/mcp-workspace": "0.9.2",
56
+ "@working-theory/mcp-scheduling": "0.4.7",
57
+ "@working-theory/mcp-signal-collectors": "0.2.20",
58
+ "@working-theory/mcp-workspace": "0.10.0",
59
59
  "@working-theory/partner-session": "0.0.0",
60
60
  "@working-theory/preview-protocol": "0.0.0",
61
- "@working-theory/ui-commerce": "0.64.0",
62
- "@working-theory/ui-docs-blog": "0.64.0",
63
- "@working-theory/ui-scheduling": "0.64.0",
64
- "@working-theory/ui-signal-collectors": "0.64.0",
61
+ "@working-theory/ui-commerce": "0.66.0",
62
+ "@working-theory/ui-docs-blog": "0.66.0",
63
+ "@working-theory/ui-scheduling": "0.66.0",
64
+ "@working-theory/ui-signal-collectors": "0.66.0",
65
65
  "@working-theory/web": "0.0.0",
66
66
  "@working-theory/app-api": "1.0.0",
67
67
  "@working-theory/mcp": "0.0.0",
68
- "@working-theory/database": "0.64.0"
68
+ "@working-theory/database": "0.66.0"
69
69
  }