create-ailk 0.40.0 → 0.40.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.
@@ -25,6 +25,13 @@
25
25
  * the agent-operator editing workflow — disproportionate for reading two
26
26
  * fields. See docs/specs/4157-scaffold-brand-defaults-spec.md § Design
27
27
  * Decisions (D1) for the full reasoning.
28
+ *
29
+ * #11456 D4 — on a hub-connected site the hub holds the brand: the async
30
+ * `resolveSiteBrand()` answers the hub identity's name, description and legal
31
+ * name, and the seo row's indexing switch, read per request through
32
+ * `lib/hub-site-config.ts`. The constants below are unchanged and are what it
33
+ * answers when there is no hub identity row, a failed read, or no hub
34
+ * connection.
28
35
  */
29
36
 
30
37
  import { existsSync, readFileSync } from "node:fs";
@@ -32,6 +39,8 @@ import { join } from "node:path";
32
39
 
33
40
  import { parse as parseYaml } from "yaml";
34
41
 
42
+ import { readHubSite, type HubSite } from "./hub-site-config";
43
+
35
44
  /** Neutral, non-vendor fallback — see module doc comment point 3. */
36
45
  export const FALLBACK_SITE_NAME = "My Site";
37
46
  /** Neutral, non-vendor fallback — see module doc comment point 3. */
@@ -154,3 +163,60 @@ export const COPYRIGHT_HOLDER = siteFrontmatter?.legalName ?? SITE_NAME;
154
163
  * `SITE_BASE_URL` for the routes that read only those.
155
164
  */
156
165
  export const SITE_LOGOMARK: unknown = siteFrontmatter?.logomark;
166
+
167
+ /** The brand the locale layout and both llms.txt routes render (#11456 D4). */
168
+ export interface SiteBrand {
169
+ siteName: string;
170
+ description: string;
171
+ copyrightHolder: string;
172
+ /** False when the hub's seo row turns search indexing off (`robots.index: false`). */
173
+ indexable: boolean;
174
+ }
175
+
176
+ /**
177
+ * A hub value as one line: every run of control, format (bidi overrides,
178
+ * zero-width characters), line-separator and paragraph-separator characters
179
+ * becomes one space (SEC-11456-5). A hub value is written by any member
180
+ * holding `workspace-settings`, and lands in the plain-text llms.txt heading,
181
+ * where a newline would add lines.
182
+ */
183
+ function oneLine(value: string): string {
184
+ return value.replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+/gu, " ").trim();
185
+ }
186
+
187
+ /**
188
+ * The site's brand for this request (#11456 D4). With a hub identity row, that
189
+ * row is the whole identity: a field the operator cleared is absent, never
190
+ * refilled from `_site.mdx` — `siteName` is `NEXT_PUBLIC_SITE_NAME`, else the
191
+ * hub `name`; `description` the hub's, else the seo row's, else the neutral
192
+ * fallback; `copyrightHolder` the hub `legalName`, else the hub `siteName`.
193
+ * Otherwise the module's constants, exactly. `indexable` reads the seo row
194
+ * whether or not an identity row exists, and fails open. Never rejects.
195
+ */
196
+ export async function resolveSiteBrand(): Promise<SiteBrand> {
197
+ return brandFrom(await readHubSite());
198
+ }
199
+
200
+ /** `resolveSiteBrand`'s rule over one hub read, so a caller holding the read derives the same brand. */
201
+ export function brandFrom(hub: HubSite | undefined): SiteBrand {
202
+ const indexable = hub?.seo?.robots?.index !== false;
203
+ const identity = hub?.identity;
204
+ if (!identity) {
205
+ return {
206
+ siteName: SITE_NAME,
207
+ description: SITE_DESCRIPTION,
208
+ copyrightHolder: COPYRIGHT_HOLDER,
209
+ indexable,
210
+ };
211
+ }
212
+ const siteName =
213
+ oneLine(process.env.NEXT_PUBLIC_SITE_NAME ?? identity.name) || FALLBACK_SITE_NAME;
214
+ return {
215
+ siteName,
216
+ description:
217
+ oneLine(identity.description ?? hub.seo?.description ?? "") ||
218
+ FALLBACK_SITE_DESCRIPTION,
219
+ copyrightHolder: oneLine(identity.legalName ?? "") || siteName,
220
+ indexable,
221
+ };
222
+ }
@@ -13,14 +13,25 @@
13
13
  * the client-safe `/schema` entry. Any failure (no file, no frontmatter, an
14
14
  * invalid address) is `undefined`: the fallback then says the site has
15
15
  * published no contact details, which is true.
16
+ *
17
+ * #11456 D4 — on a hub-connected site that holds a hub identity row, the
18
+ * row's `email` (when valid) comes first, else the file's top-level
19
+ * `contactEmail` (not an identity field, so it stays the fallback). It reads
20
+ * the value `readHubSite` last resolved on this instance (`heldHubSite()`),
21
+ * because the seam is synchronous: the file value on a cold instance's first
22
+ * render.
16
23
  */
17
24
 
18
25
  import { readFileSync } from "node:fs";
19
26
  import { join } from "node:path";
20
27
 
21
- import { SiteConfigSchema } from "@working-theory/site-config/schema";
28
+ import {
29
+ SiteConfigSchema,
30
+ type SiteIdentity,
31
+ } from "@working-theory/site-config/schema";
22
32
  import { parse as parseYaml } from "yaml";
23
33
 
34
+ import { heldHubSite } from "./hub-site-config";
24
35
  import { resolveContentRoot } from "./site-brand";
25
36
 
26
37
  const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---/;
@@ -32,23 +43,32 @@ function validEmail(value: unknown): string | undefined {
32
43
  return parsed.success ? parsed.data : undefined;
33
44
  }
34
45
 
46
+ /** The hub identity's `email`, when the identity kind carries one. */
47
+ function hubIdentityEmail(identity: SiteIdentity): string | undefined {
48
+ return "email" in identity ? validEmail(identity.email) : undefined;
49
+ }
50
+
35
51
  export function readSiteContactEmail(): string | undefined {
52
+ const hubIdentity = heldHubSite()?.identity;
53
+ // With a hub identity row, every file failure still answers its email.
54
+ const hubEmail = hubIdentity ? hubIdentityEmail(hubIdentity) : undefined;
36
55
  try {
37
56
  const raw = readFileSync(join(resolveContentRoot(), "_site.mdx"), "utf8");
38
57
  const match = FRONTMATTER_RE.exec(raw);
39
- if (!match) return undefined;
58
+ if (!match) return hubEmail;
40
59
  const fm: unknown = parseYaml(match[1] ?? "");
41
- if (!fm || typeof fm !== "object") return undefined;
60
+ if (!fm || typeof fm !== "object") return hubEmail;
42
61
 
43
62
  const { contactEmail, siteIdentity } = fm as {
44
63
  contactEmail?: unknown;
45
64
  siteIdentity?: { kind?: unknown; email?: unknown };
46
65
  };
66
+ if (hubIdentity) return hubEmail ?? validEmail(contactEmail);
47
67
  return (
48
68
  validEmail(contactEmail) ??
49
69
  (siteIdentity?.kind === "LocalBusiness" ? validEmail(siteIdentity.email) : undefined)
50
70
  );
51
71
  } catch {
52
- return undefined;
72
+ return hubEmail;
53
73
  }
54
74
  }
@@ -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
@@ -778,6 +778,9 @@
778
778
  "bodyCodeOnly": "This page has markup only the Code view can show, so it opens in Code.",
779
779
  "tagPlaceholder": "{kind}: {slug}",
780
780
  "pinnedFaq": "Pinned FAQ: {question}",
781
+ "pinnedProof": "Pinned proof: {name}",
782
+ "referenceNotLive": "Not live",
783
+ "referenceMissing": "Missing",
781
784
  "pulledTag": "FAQs tagged {tag}"
782
785
  },
783
786
  "body": {
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.65.0",
3
+ "@working-theory/admin-ui": "0.65.0",
4
+ "@working-theory/aeo": "0.65.0",
5
+ "@working-theory/agent-context": "0.65.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.65.0",
10
+ "@working-theory/api": "0.65.0",
11
+ "@working-theory/api-client": "0.65.0",
12
+ "@working-theory/auth": "0.65.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.65.0",
15
+ "@working-theory/common": "0.65.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.65.0",
18
+ "@working-theory/content-projection": "0.65.0",
19
+ "@working-theory/email": "0.65.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",
21
+ "@working-theory/eslint-config": "0.65.0",
22
+ "@working-theory/fumadocs-schema": "0.65.0",
23
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",
24
+ "@working-theory/jsonld": "0.65.0",
25
+ "@working-theory/license": "0.65.0",
26
+ "@working-theory/mcp-server": "0.65.0",
27
+ "@working-theory/metadata": "0.65.0",
28
+ "@working-theory/observability": "0.65.0",
29
+ "@working-theory/page-renderer": "0.65.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.65.0",
32
+ "@working-theory/schema-pack-registry": "0.65.0",
33
+ "@working-theory/schema-validator": "0.65.0",
34
+ "@working-theory/sections-registry": "0.65.0",
35
+ "@working-theory/site-config": "0.65.0",
36
+ "@working-theory/site-pages": "0.65.0",
37
+ "@working-theory/spoke-checkout": "0.7.21",
38
+ "@working-theory/stripe-client": "0.65.0",
39
+ "@working-theory/templates": "0.65.0",
40
+ "@working-theory/theme": "0.65.0",
41
+ "@working-theory/ui": "0.65.0",
42
+ "@working-theory/validation": "0.65.0",
43
+ "@working-theory/web-i18n": "0.65.0",
44
+ "@working-theory/admin": "0.17.0",
45
+ "@working-theory/api-commerce": "0.1.19",
46
+ "@working-theory/api-content-write": "0.10.3",
47
+ "@working-theory/api-hub": "0.6.4",
48
+ "@working-theory/api-multi-tenant": "0.3.5",
49
+ "@working-theory/api-scheduling": "0.6.4",
50
+ "@working-theory/api-signal-collectors": "0.6.5",
51
+ "@working-theory/api-workspace": "0.11.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.6",
57
+ "@working-theory/mcp-signal-collectors": "0.2.19",
58
+ "@working-theory/mcp-workspace": "0.9.3",
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.65.0",
62
+ "@working-theory/ui-docs-blog": "0.65.0",
63
+ "@working-theory/ui-scheduling": "0.65.0",
64
+ "@working-theory/ui-signal-collectors": "0.65.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.65.0"
69
69
  }