create-ailk 0.41.0 → 0.42.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.
Files changed (35) hide show
  1. package/README.md +31 -1
  2. package/component-catalog.json +6 -0
  3. package/dist/add-route.d.ts +2 -6
  4. package/dist/add-route.js +2 -43
  5. package/dist/export-content.js +11 -3
  6. package/dist/language-import.js +5 -2
  7. package/dist/lib/env-catalog.js +4 -0
  8. package/dist/lib/import-mdx.js +10 -7
  9. package/dist/magnet-page.d.ts +36 -0
  10. package/dist/magnet-page.js +70 -0
  11. package/dist/routes.d.ts +38 -2
  12. package/dist/routes.js +586 -27
  13. package/dist/surfaces.d.ts +16 -0
  14. package/dist/surfaces.js +36 -0
  15. package/dist/update.d.ts +1 -1
  16. package/dist/update.js +24 -2
  17. package/package.json +3 -3
  18. package/templates/.claude/hooks/template-guard.sh +145 -36
  19. package/templates/CLAUDE.md +1 -1
  20. package/templates/apps/api/CLAUDE.md +1 -0
  21. package/templates/apps/mcp/CLAUDE.md +5 -3
  22. package/templates/apps/web/CLAUDE.md +13 -1
  23. package/templates/apps/web/app/[locale]/layout.tsx +6 -3
  24. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +28 -0
  25. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +28 -0
  26. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +24 -0
  27. package/templates/apps/web/lib/__tests__/route-paths.test.ts +57 -0
  28. package/templates/apps/web/lib/mcp-oauth.ts +14 -10
  29. package/templates/apps/web/lib/page-chrome.ts +8 -5
  30. package/templates/apps/web/lib/route-paths.ts +22 -0
  31. package/templates/apps/web/lib/services-path.ts +27 -18
  32. package/templates/apps/web/middleware.ts +2 -1
  33. package/templates/apps/web/next.config.mjs +123 -2
  34. package/templates/apps/web/src/lib/routes.ts +4 -2
  35. package/versions.json +50 -50
@@ -55,6 +55,22 @@ export declare const PAGE_PACKAGE_ROUTES: readonly {
55
55
  }[];
56
56
  /** The page package that ships `route` (a ROUTE_ROOT-relative dir), or `undefined` when no page package does. */
57
57
  export declare function pagePackageOfRoute(route: string): string | undefined;
58
+ /**
59
+ * #11385 D6 — the route families a site may rename with `<family>: { path:
60
+ * /<segment> }` in `content/_site.mdx`, family key → convention segment. A
61
+ * copy of `@working-theory/site-config`'s record (create-ailk imports nothing
62
+ * at runtime); `tests/routes/route-renames-parity.test.ts` pins the two equal.
63
+ */
64
+ export declare const RENAMABLE_ROUTE_FAMILIES: Readonly<Record<string, string>>;
65
+ /** #11385 D6 — first segments no rename may take; a copy of site-config's `RESERVED_ROUTE_SEGMENTS`. */
66
+ export declare const RESERVED_ROUTE_SEGMENTS: readonly string[];
67
+ /**
68
+ * #11385 D7 — the first segment of every `@working-theory/templates` `ROUTES`
69
+ * row and of every legacy route it still redirects from, sorted: the routes a
70
+ * rename may not take. A copy (create-ailk cannot
71
+ * read `ROUTES` at runtime); the parity test pins it to the routes map.
72
+ */
73
+ export declare const ROUTES_FIRST_SEGMENTS: readonly string[];
58
74
  /** Template-relative route directories that are always copied. */
59
75
  export declare const CORE_ROUTE_DIRS: readonly string[];
60
76
  /**
package/dist/surfaces.js CHANGED
@@ -250,6 +250,42 @@ export function pagePackageOfRoute(route) {
250
250
  }
251
251
  return best?.package;
252
252
  }
253
+ /**
254
+ * #11385 D6 — the route families a site may rename with `<family>: { path:
255
+ * /<segment> }` in `content/_site.mdx`, family key → convention segment. A
256
+ * copy of `@working-theory/site-config`'s record (create-ailk imports nothing
257
+ * at runtime); `tests/routes/route-renames-parity.test.ts` pins the two equal.
258
+ */
259
+ export const RENAMABLE_ROUTE_FAMILIES = Object.freeze({
260
+ meet: "meet",
261
+ caseStudies: "case-studies",
262
+ portfolio: "portfolio",
263
+ team: "team",
264
+ courses: "courses",
265
+ events: "events",
266
+ integrations: "integrations",
267
+ partners: "partners",
268
+ features: "features",
269
+ products: "products",
270
+ resources: "resources",
271
+ for: "for",
272
+ });
273
+ /** #11385 D6 — first segments no rename may take; a copy of site-config's `RESERVED_ROUTE_SEGMENTS`. */
274
+ export const RESERVED_ROUTE_SEGMENTS = Object.freeze(["api", "og", "v1", "apple-icon"]);
275
+ /**
276
+ * #11385 D7 — the first segment of every `@working-theory/templates` `ROUTES`
277
+ * row and of every legacy route it still redirects from, sorted: the routes a
278
+ * rename may not take. A copy (create-ailk cannot
279
+ * read `ROUTES` at runtime); the parity test pins it to the routes map.
280
+ */
281
+ export const ROUTES_FIRST_SEGMENTS = Object.freeze([
282
+ "about", "account", "alternatives", "appointments", "blog", "careers", "case-studies", "clients", "consent",
283
+ "contact", "courses", "docs", "downloads", "events", "faq", "features", "flows", "for", "forgot-password", "glossary",
284
+ "how-to", "integrations", "launch-service", "meet", "newsletter", "partners", "portfolio", "pricing", "privacy",
285
+ "private", "products", "projects", "purchase", "purchase-policy", "reports", "reset-password", "resources",
286
+ "schedule", "services", "sign-in", "sign-up", "software", "team", "tech-articles", "templates", "terms", "testimonials",
287
+ "thanks", "trial", "unsubscribe", "verify-email", "vs", "whitepapers", "working-agreement",
288
+ ]);
253
289
  /** Template-relative route directories that are always copied. */
254
290
  export const CORE_ROUTE_DIRS = [
255
291
  `${ROUTE_ROOT}/about`,
package/dist/update.d.ts CHANGED
@@ -183,6 +183,6 @@ export interface UpdateArgs {
183
183
  target: string | undefined;
184
184
  help: boolean;
185
185
  }
186
- 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 are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published 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. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. 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\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. 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";
186
+ 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 are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published 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. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. 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\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. 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. Each hand-written page `routes --check` then fails on \u2014 no\ndecided customizations.yaml entry, under a package's prefix, or at a\npackage's own route \u2014 is listed under \"Needs review\". Commit before running,\nand review the diff after.\n";
187
187
  /** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
188
188
  export declare function parseUpdateArgs(argv: string[]): UpdateArgs;
package/dist/update.js CHANGED
@@ -117,7 +117,7 @@ import { escapeBareBraces, findBareBraces } from "./mdx-braces.js";
117
117
  import { MODULE_SLICES } from "./module-architecture.js";
118
118
  import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, renderSitePaidSections, writeModuleFlags, writePaidMcpTools, writePaidSectionsRegistry, } from "./paid-sections.js";
119
119
  import { ParseError } from "./parse-args.js";
120
- import { RoutesRefusedError, customizationsRecord, isGenerated, writeRoutes } from "./routes.js";
120
+ import { PAGE_DECISION_GUIDANCE, RoutesRefusedError, checkRoutes, customizationsRecord, isGenerated, writeRoutes } from "./routes.js";
121
121
  import { planSeamRefresh, seamRow, siteSeamRenders } from "./seam-refresh.js";
122
122
  import { SITE_LISTING_PATH } from "./site-listing-path.js";
123
123
  import { SITE_ROSTER_PATH, planServedRoster, readRosterPageRoutes } from "./site-roster.js";
@@ -2647,6 +2647,25 @@ export async function updateSite(opts) {
2647
2647
  let routesWritten = [];
2648
2648
  try {
2649
2649
  routesWritten = writeRoutes(targetDir).written;
2650
+ // #11700 D10 — each hand-written page the routes check fails on is a
2651
+ // review row, so the bump PR carries the list, not only a red preflight.
2652
+ const drift = checkRoutes(targetDir);
2653
+ const pageRow = (path, what) => {
2654
+ const suggestion = drift.routeSuggestions[path];
2655
+ review.push({
2656
+ path,
2657
+ reason: `${what} — routes --check fails on it; ${PAGE_DECISION_GUIDANCE}${suggestion === undefined ? "" : `; ${suggestion}`}`,
2658
+ });
2659
+ };
2660
+ for (const { path, id } of drift.undecidedPages) {
2661
+ pageRow(path, id === undefined ? "a site page with no decided customizations.yaml entry" : `a page whose customizations.yaml entry "${id}" is not decided`);
2662
+ }
2663
+ for (const path of drift.stray)
2664
+ pageRow(path, "a site page under a page package's route prefix");
2665
+ for (const path of drift.stale) {
2666
+ if (!isGenerated(readFileSync(join(targetDir, path), "utf8")))
2667
+ pageRow(path, "a site page at a page package's own route");
2668
+ }
2650
2669
  }
2651
2670
  catch (err) {
2652
2671
  if (!(err instanceof RoutesRefusedError))
@@ -2956,7 +2975,10 @@ records; one edited by hand, or with no recorded render, is listed under
2956
2975
  package (one whose package.json declares "ailk": { "routes" }) are rewritten
2957
2976
  from its manifest, listed under "Route files regenerated"; run
2958
2977
  \`create-ailk routes --write\` after the install when the packages were not
2959
- installed yet. Commit before running, and review the diff after.
2978
+ installed yet. Each hand-written page \`routes --check\` then fails on — no
2979
+ decided customizations.yaml entry, under a package's prefix, or at a
2980
+ package's own route — is listed under "Needs review". Commit before running,
2981
+ and review the diff after.
2960
2982
  `;
2961
2983
  /** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
2962
2984
  export function parseUpdateArgs(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ailk",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "tar": "^7.5.21"
29
29
  },
30
30
  "devDependencies": {
31
- "@working-theory/schema": "0.68.0",
32
- "@working-theory/templates": "0.68.0"
31
+ "@working-theory/schema": "0.69.0",
32
+ "@working-theory/templates": "0.69.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -4,7 +4,15 @@
4
4
  # still match the template's sha256, is refused (exit 2) unless an entry in
5
5
  # customizations.yaml names it; the refusal on stderr names the file, the
6
6
  # entry to add and the upstream route. An edited, unrecorded or manifest-named
7
- # file passes. A site with no record warns and passes. Pure bash, grep, awk
7
+ # file passes. A site with no record warns and passes.
8
+ #
9
+ # A NEW routing file under apps/web/app/[locale]/ (page.tsx, layout.tsx,
10
+ # route.ts) that is not a record key and matches no architecture.yaml
11
+ # customizations.scaffold_paths glob is refused (exit 2) unless a
12
+ # customizations.yaml entry names it with a decided decision (build-in: site —
13
+ # <decider>, <YYYY-MM-DD>, <reason>, or build-in: ailk#<N>); undecided does not
14
+ # count. The refusal names the package page and generator to use instead. An
15
+ # Edit of an existing page is left to routes --check. Pure bash, grep, awk
8
16
  # and sha256sum/shasum — nothing a scaffold has to install. Registered in
9
17
  # .claude/settings.json and declared in .claude/cloudparity-repo-hooks.json;
10
18
  # keep the two in step.
@@ -38,6 +46,140 @@ if [ ! -f "$record" ]; then
38
46
  printf '%s\n' '{"systemMessage":"template-guard: warning — no .ailk-template-files.json, so template files cannot be told from site files and edits under apps/ are not guarded; run create-ailk update to write it"}'
39
47
  exit 0
40
48
  fi
49
+ # A glob, matched against $rel: `**` spans segments, `*` stays inside one and
50
+ # all else is literal. Shared by the awk programs below.
51
+ matches_awk='
52
+ function matches(pat, n, seg, i, j, c, re, s) {
53
+ if (pat !~ /^apps\//) return 0
54
+ n = split(pat, seg, "/")
55
+ re = "^"
56
+ for (i = 1; i <= n; i++) {
57
+ s = seg[i]
58
+ if (s == "**") { re = re (i == n ? ".*" : "([^/]+/)*"); continue }
59
+ for (j = 1; j <= length(s); j++) {
60
+ c = substr(s, j, 1)
61
+ if (c == "*") re = re "[^/]*"
62
+ else if (c == "]") re = re "[]]"
63
+ else if (c == "^") re = re "\\^"
64
+ else if (c == "\\") re = re "\\\\"
65
+ else if (index(".[()+?{}|$", c)) re = re "[" c "]"
66
+ else re = re c
67
+ }
68
+ if (i < n) re = re "/"
69
+ }
70
+ return rel ~ (re "$")
71
+ }
72
+ '
73
+
74
+ # The seed id (#9223's rule) and the issue title, percent-encoded byte by byte.
75
+ seed() {
76
+ out=$(awk -v rel="$rel" '
77
+ BEGIN {
78
+ id = tolower(rel); gsub(/[^a-z0-9]+/, "-", id); sub(/^-/, "", id); sub(/-$/, "", id)
79
+ for (i = 1; i < 256; i++) ord[sprintf("%c", i)] = i
80
+ s = "Template change: " rel
81
+ for (i = 1; i <= length(s); i++) {
82
+ c = substr(s, i, 1)
83
+ title = title (c ~ /[A-Za-z0-9._~-]/ ? c : sprintf("%%%02X", ord[c]))
84
+ }
85
+ print id; print title
86
+ }')
87
+ id=${out%%$'\n'*}
88
+ title=${out#*$'\n'}
89
+ }
90
+
91
+ # A new routing file under app/[locale]/ needs a decided customizations.yaml
92
+ # entry (#11700): a package page or a generator covers most pages, and a site
93
+ # page is kept only on a recorded decision.
94
+ routing=
95
+ case $rel in
96
+ "apps/web/app/[locale]/page.tsx"|"apps/web/app/[locale]/layout.tsx"|"apps/web/app/[locale]/route.ts") routing=1 ;;
97
+ "apps/web/app/[locale]/"*/page.tsx|"apps/web/app/[locale]/"*/layout.tsx|"apps/web/app/[locale]/"*/route.ts) routing=1 ;;
98
+ esac
99
+ if [ -n "$routing" ] && [ ! -e "$rel" ] && ! grep -F -x -q -- " \"$rel\": {" "$record"; then
100
+ # On architecture.yaml's customizations.scaffold_paths: a generator's or a
101
+ # module bundle's file, never a site page.
102
+ if [ -f architecture.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
103
+ /^[^ \t-]/ { incust = ($0 ~ /^customizations:/); inlist = 0; next }
104
+ incust && /^ [^ \t]/ { inlist = ($0 ~ /^ scaffold_paths:[ \t]*$/); next }
105
+ inlist && match($0, /^ - /) {
106
+ item = substr($0, RLENGTH + 1); sub(/[ \t]+$/, "", item)
107
+ if (item ~ /^".*"$/ || item ~ ("^" sq ".*" sq "$")) item = substr(item, 2, length(item) - 2)
108
+ if (matches(item)) { found = 1; exit }
109
+ }
110
+ END { exit !found }
111
+ ' architecture.yaml; then
112
+ exit 0
113
+ fi
114
+ # A customizations.yaml entry with an id, whose paths match and whose decision is one of
115
+ # the two decided forms. Under LC_ALL=C the em dash is three bytes, so the
116
+ # separator is matched as whole strings, never as a bracket.
117
+ if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
118
+ function unq(v) {
119
+ sub(/^[ \t]+/, "", v); sub(/[ \t]+$/, "", v)
120
+ if (v ~ /^".*"$/ || v ~ ("^" sq ".*" sq "$")) v = substr(v, 2, length(v) - 2)
121
+ return v
122
+ }
123
+ function decided(d) {
124
+ return d ~ /^build-in: ailk#[0-9]+$/ || d ~ /^build-in: ailk#[0-9]+( — | - ).+$/ ||
125
+ d ~ /^build-in: site( — | - )[^,]+, [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9], .+$/
126
+ }
127
+ function close_entry() { if (hit && dec && hasid) found = 1; hit = 0; dec = 0; hasid = 0; inpaths = 0 }
128
+ /^[ \t]*#/ { next }
129
+ /^[^ \t-]/ { close_entry(); inlist = ($0 ~ /^customizations:/); next }
130
+ !inlist { next }
131
+ {
132
+ # YAML ends a value at " #" only outside quotes, so a quoted value keeps
133
+ # its " #12" and loses only what follows its closing quote.
134
+ line = $0
135
+ if (match(line, /:[ \t]*["\047]/)) {
136
+ q = substr(line, RSTART + RLENGTH - 1, 1); head = substr(line, 1, RSTART + RLENGTH - 1)
137
+ rest = substr(line, RSTART + RLENGTH); endq = index(rest, q)
138
+ if (endq > 0) line = head substr(rest, 1, endq)
139
+ } else sub(/[ \t]+#.*$/, "", line)
140
+ if (match(line, /^[ \t]*- [A-Za-z_]+:/) && match(line, /^[ \t]*- /) && (ind == "" || RLENGTH == ind)) {
141
+ close_entry(); ind = RLENGTH; line = substr(line, RLENGTH + 1)
142
+ }
143
+ if (line ~ /^[ \t]*paths:/) {
144
+ sub(/^[ \t]*paths:/, "", line)
145
+ if (line ~ /^[ \t]*\[/) {
146
+ sub(/^[ \t]*\[/, "", line); sub(/\][ \t]*$/, "", line)
147
+ n = split(line, items, ",")
148
+ for (i = 1; i <= n; i++) if (matches(unq(items[i]))) hit = 1
149
+ inpaths = 0
150
+ } else inpaths = 1
151
+ } else if (line ~ /^[ \t]*decision:/) {
152
+ sub(/^[ \t]*decision:/, "", line)
153
+ if (decided(unq(line))) dec = 1
154
+ inpaths = 0
155
+ } else if (line ~ /^[ \t]*[A-Za-z_]+:/) {
156
+ if (line ~ /^[ \t]*id:/) hasid = 1
157
+ inpaths = 0
158
+ } else if (inpaths && match(line, /^[ \t]*- /)) {
159
+ if (matches(unq(substr(line, RLENGTH + 1)))) hit = 1
160
+ }
161
+ }
162
+ END { close_entry(); exit !found }
163
+ ' customizations.yaml; then
164
+ exit 0
165
+ fi
166
+ seed
167
+ printf '%s\n' >&2 \
168
+ "template-guard: $rel is a new routing file, and no customizations.yaml entry names it with a decided decision." \
169
+ "Before you add a page, look up its page type and the package route that serves it, and use that package page when it exists. Otherwise record the decision in customizations.yaml (build-in: site — <decider>, <YYYY-MM-DD>, <reason>) before you write the file." \
170
+ "Fix, one of:" \
171
+ " 1. A package page: if an installed page package ships this page, write nothing here; run create-ailk routes --write." \
172
+ " 2. A magnet page pair: create-ailk add-route magnet --path <path> --flow <slug>" \
173
+ " 3. Keep it as the site's own page: add this entry under customizations: in customizations.yaml, then retry." \
174
+ " - id: $id" \
175
+ " paths:" \
176
+ " - \"$rel\"" \
177
+ " request: \"<owner>/<repo>#<issue>\"" \
178
+ " decision: \"build-in: site — <decider>, <YYYY-MM-DD>, <reason>\"" \
179
+ " An undecided entry does not count for a page; create-ailk routes --check fails it."
180
+ exit 2
181
+ fi
182
+
41
183
  # The record is written by serializeTemplateRecord only: one ` "<path>": {`
42
184
  # line per file, its `"sha256"` on the next.
43
185
  row=$(grep -F -x -A1 -- " \"$rel\": {" "$record") || exit 0
@@ -59,27 +201,7 @@ fi
59
201
  # Named by a customizations.yaml pattern? Read lexically: every quoted scalar
60
202
  # and every `- <plain>` item outside a comment that starts `apps/`, matched as
61
203
  # a glob where `**` spans segments, `*` stays inside one and all else is literal.
62
- if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" '
63
- function matches(pat, n, seg, i, j, c, re, s) {
64
- if (pat !~ /^apps\//) return 0
65
- n = split(pat, seg, "/")
66
- re = "^"
67
- for (i = 1; i <= n; i++) {
68
- s = seg[i]
69
- if (s == "**") { re = re (i == n ? ".*" : "([^/]+/)*"); continue }
70
- for (j = 1; j <= length(s); j++) {
71
- c = substr(s, j, 1)
72
- if (c == "*") re = re "[^/]*"
73
- else if (c == "]") re = re "[]]"
74
- else if (c == "^") re = re "\\^"
75
- else if (c == "\\") re = re "\\\\"
76
- else if (index(".[()+?{}|$", c)) re = re "[" c "]"
77
- else re = re c
78
- }
79
- if (i < n) re = re "/"
80
- }
81
- return rel ~ (re "$")
82
- }
204
+ if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" "$matches_awk"'
83
205
  /^[ \t]*#/ { next }
84
206
  {
85
207
  line = $0; n = length(line); quote = ""; cut = n
@@ -106,20 +228,7 @@ if [ -f customizations.yaml ] && awk -v rel="$rel" -v sq="'" '
106
228
  exit 0
107
229
  fi
108
230
 
109
- # The seed id (#9223's rule) and the issue title, percent-encoded byte by byte.
110
- out=$(awk -v rel="$rel" '
111
- BEGIN {
112
- id = tolower(rel); gsub(/[^a-z0-9]+/, "-", id); sub(/^-/, "", id); sub(/-$/, "", id)
113
- for (i = 1; i < 256; i++) ord[sprintf("%c", i)] = i
114
- s = "Template change: " rel
115
- for (i = 1; i <= length(s); i++) {
116
- c = substr(s, i, 1)
117
- title = title (c ~ /[A-Za-z0-9._~-]/ ? c : sprintf("%%%02X", ord[c]))
118
- }
119
- print id; print title
120
- }')
121
- id=${out%%$'\n'*}
122
- title=${out#*$'\n'}
231
+ seed
123
232
 
124
233
  printf '%s\n' >&2 \
125
234
  "template-guard: $rel is a template file, unchanged since create-ailk wrote it, and no customizations.yaml entry names it." \
@@ -32,7 +32,7 @@ patch or pin it: a copy stops taking fixes. `pnpm architecture` refuses each.
32
32
 
33
33
  Before you write a new source file under `apps/`, record it in `customizations.yaml`:
34
34
  its paths, the request issue, and the build-in decision. AILK builds a customization
35
- in unless it decides not to. `pnpm architecture` refuses site code with no entry.
35
+ in unless it decides not to. `pnpm architecture` refuses site code with no entry. Before you add a page, look up its page type and the package route that serves it, and use that package page when it exists. Otherwise record the decision in customizations.yaml (build-in: site — <decider>, <YYYY-MM-DD>, <reason>) before you write the file.
36
36
  <!-- /ailk:template id="repo-shape" -->
37
37
 
38
38
  <!-- ailk:template id="architecture" -->
@@ -99,6 +99,7 @@ Routes are versioned under `/v1/*`:
99
99
  - `GET /v1/workspaces/:workspaceId/discovery` and `PUT /v1/workspaces/:workspaceId/discovery` — the owner's discovery switch, whether AI and search tools can find the workspace's site (#10510, `src/routes/workspaces/discovery.ts`, `// oss: false`, over `packages/api/src/services/site-discovery.ts`). Both parse `:workspaceId` with `inboxWorkspaceParamsSchema` (`400 validation_failed`) and act on `request.tenant.workspaceId` only. The GET needs any tenant, an agent included, and answers `{ ok: true, data: { discoverable } }`; the PUT needs `workspace-settings` (owner, admin — an agent is refused, `403`), checked before the strict `{ discoverable: boolean }` body (`400 validation_failed` on anything else), and answers the stored value. The GET's MCP twin is `get_site_discovery`; the PUT has no tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`, one `tenant:settings` row).
100
100
  - `/v1/workspaces/:workspaceId/content` (GET, POST), `/v1/workspaces/:workspaceId/content/:type/:slug` (GET, PATCH), `/v1/workspaces/:workspaceId/content/:type/:slug/{publish,unpublish}` (POST) — the tenant-guarded content editor's write surface (#5853, `src/routes/workspaces/content.ts`): list, create, read/save the draft tip (under `X-Draft-Version`; `If-Match` still accepted for one release, #10264), and publish/unpublish, all over `Artifact`/`ArtifactVersion`. `:type` is validated against the page-type registry (`z.enum(SCHEMA_ORG_TYPES)`) rather than accepted as a free string on every addressed operation — an unregistered type is a 400 before any lookup, since it is echoed back and passed to `notifyRevalidate` as the site's cache tag. Role floors from `@working-theory/validation`'s permission table (#7636 D2): publish and unpublish need `content-publish`, and create, read and save need `content-edit` (both owner, admin — an admin builds, a member operates). The list serves `content-edit` the editor's full view and a caller holding only `docs-read` (a member) a published-only projection (D4): draft rows dropped, every row `status: "published"`, `version: null`, `valid: true`, and a `published_with_draft` page's `type`/`tags` read from its PUBLISHED version — applied before every filter, so a member's `?status=draft` or a draft tip's `?tag=` matches nothing. **The GET list is a UNION of page artifacts and DOCUMENT assets** (#6093, D1/D9 — "one store, two views"): every row carries `tags: string[]` (never null, read from the draft tip's stored content for a page, from `Asset.tags` for a file) and a DERIVED `kind: "page" | "post" | "file"` (`BlogPosting` alone maps to `"post"`; an asset row is always `"file"`) — an optional `?tag=<slug>` filters the union AFTER it is built, so a file is returned under either its own tag or a shared one. The asset half of the union (`DOCUMENT_CONTENT_TYPES`, i.e. `application/pdf`) is skipped entirely when `locale`/`type` is supplied or `status` names anything but `"published"`, since a file row can never satisfy those. A foreign `:workspaceId` costs zero artifact **and** zero asset queries. MCP parity: on `/mcp/workspace`, the create's twin is `create_page` (#10956), the draft read and save are `read_report` and `save_draft` (#10336), and the publish is `publish_draft` (#10661); the list and unpublish have none, as `tests/parity/README.md` and the registry record.
101
101
  - `/v1/workspaces/:workspaceId/library/pages` (GET, `?type=&status=&limit=&page=`) and `/v1/workspaces/:workspaceId/library/assets` (GET, `?tag=&type=&limit=&page=`) — the library reads, each answering `{ workspace: { id, name }, items, total, page, nextPage }` newest first (`limit` 1–200, default 50; `page` from 1; `libraryPageListQuerySchema` / `libraryAssetListQuerySchema` in `@working-theory/validation`). The page list (`packages-paid/api-content-write/src/routes/workspaces/library-pages.ts`, in the content-write tenant scope) serves every page, drafts included, as `{ id, type, slug, locale, title, status, updatedAt }`; `status` is the Docs list's rule — `disabled` when switched off, else `live` when a version is published (a newer draft included), else `draft` — and the route needs `content-edit` (`allows`, so an agent needs the grant). A disabled page is asked for only on a person's behalf: `tenantDb` keeps every disabled row from an agent. The asset list (`packages-paid/api-workspace/src/routes/assets/manage.ts`, beside the manage list, `assets-read`) serves `{ id, key, filename, type, tags, url, updatedAt }` — `type` is the content type, `url` the public read's path, `updatedAt` when the current file was uploaded — the `createdAt` of the version `currentVersion` names (`tenantDb.assets.currentVersionTimes`), so a replace moves it, a restore takes the restored version's upload time, and a metadata edit does not move it; the list is ordered by it, newest first — narrowed by an exact `tag` and a `type` that is a whole content type (`image/png`) or its top-level part (`image`); a file tagged `private` never lists, `?tag=private` included. MCP parity: `list_workspace_pages` and `list_assets` on `/mcp/workspace`.
102
+ - `/v1/workspaces/:workspaceId/page-types` (GET) and `/v1/workspaces/:workspaceId/tag-vocabulary` (GET) — the site-vocabulary reads (#11680; `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`, in the content-write tenant scope), any tenant of the workspace, no query, no row read. `page-types` answers `{ types: [{ type, route, fixed, template, headings }] }`: every page-type registry entry that is a page, in registry order, with its template's headings as `PAGE_TEMPLATES` states them (`key`, `text`, `required`, `section`, `hint`), filtered per request by the module map `pageTypeModule` in `@working-theory/validation` (the one create-ailk's page-types reference generator reads): `marketing` types always, `scheduling` and `signal-collectors` types when `isModuleEnabled`, and `docs-blog` types when `AILK_ENABLED_MODULES` names `docs-blog` — a site that carries the blog and docs sets that key, since `docs-blog` has no API module. `tag-vocabulary` answers `tagVocabulary()`: `{ classes, topics, status }`, each a list of `{ tag, means, setBy }`. MCP parity: `list_page_types` and `get_tag_vocabulary` on `/mcp/workspace`.
102
103
  - `/v1/workspaces/:workspaceId/assets` (GET, POST), `/v1/workspaces/:workspaceId/assets/:assetId` (PATCH, DELETE), `/v1/assets/:assetId` (GET, public/anonymous) — the workspace asset store (#5854 upload/read; #6093 list/PATCH/DELETE, `src/routes/assets/{index,upload,read,manage}.ts`). Upload accepts an allowlisted union of three named classes (`src/routes/assets/index.ts`): five RASTER images (`image/png`, `image/jpeg`, `image/gif`, `image/webp`, `image/avif`), one VECTOR image (`image/svg+xml`, admitted under the operator's 2026-09-18 `allow-svg-assets` ruling — issue #6093 comment `5731573595` — superseding #5854's original SVG exclusion) and one DOCUMENT type (`application/pdf`), all under the existing 20 MB cap; `?tags=<slug>[,<slug>…]` stores tags on the row. The public read serves a RASTER type `inline` exactly as before; every OTHER admitted type (SVG, PDF) is served `attachment`, with the filename's extension pinned to the stored content type (closing extension spoofing) and a five-directive `Content-Security-Policy` (`default-src 'none'; sandbox; frame-ancestors 'none'; form-action 'none'; base-uri 'none'`) that makes the bytes never a document on this origin — this is what makes admitting SVG safe with NO server-side sanitizer. `GET …/assets` (`assets-read` — every role, a member included) lists a workspace's assets, metadata only, never `bytes`, with an optional `?tag=<slug>` filter; this is what narrows the store's prior "nothing lists assets" premise to its precise form — no ANONYMOUS and no CROSS-TENANT enumeration, both still true. `PATCH …/assets/:assetId` updates `title`/`description`/`tags` (`assets-write`, owner and admin, the upload's permission too; `null` clears a text field to SQL `NULL`, `""` stores empty; the asset's `id` and public URL are untouched). `DELETE …/assets/:assetId` (`assets-write`) removes the row and the bytes at the ORIGIN only — already-cached copies elsewhere are not recallable under the year-long `immutable` promise, and no reference check protects a page that still embeds the URL; absent and foreign ids both take the same 404. Every tenant route here is identity-bound; no MCP twin (#3591 exception). The public read has no MCP twin either — it serves bytes to an `<img>`/download, the same boundary `upload.ts` records for its own sibling. **A client's file is never in the library's public life (#7877 D18):** the default `GET …/assets` listing leaves out every asset tagged `private` — only `?tag=private` lists them (the Admin's Compose) — and the public read answers its uniform 404 for an asset tagged `private`, attached to any member-area message, or (#8171 D3) named by a delivered piece version (one `pieceVersion.count`, since the tag can be removed after delivery), so such a file's bytes are served only by its owner's member reads.
103
104
  - `/v1/subscription/me` (GET) — `?include=billing` (#8171 D7), from a cookie session only, adds the optional `planName` and `paymentMethod` (brand, last four, expiry) read from Stripe through `lib/stripe.ts`'s `readCustomerBillingSummary` for the caller's own resolved customer: cached per customer for 60 s (a failure too), one read in flight per customer, bounded at 3 s; a failure leaves both keys absent, a value outside the schema's bounds is `null`, and no id is served or logged. A bearer token, another value or none answers exactly as before.
104
105
  - `/v1/billing` (GET), `/v1/billing/portal-session` (POST) — org-scoped billing read + Stripe customer-portal session creation. The read stays open to every member (the Admin's plan gate reads it); the portal needs `billing-manage` — the owner alone (`@working-theory/validation`'s permission table (#7636 D2); an admin is refused before any Stripe call). `/v1/billing/usage` (GET) needs `billing-read` (owner, admin). **The read's `commerce` field (#8907 D14)** is the deployment's commerce claim, `claimed | unclaimed | undetermined` (`resolveCommerceClaim()`; a rejected read is `undetermined` and the answer stays `200`) — what the Admin's Billing card reads (#8908 D10). **`?include=billing` (#9067 D1)** — exactly that string, never an array — adds `details` only for a caller holding `billing-manage` (the owner; an agent never qualifies): `licenseExpiresAt` (`checkLicense().expiresAt`, `null` on a failed read) always, and for an Organization with a Stripe customer `renewsAt` (the current subscription's first item's `current_period_end`, only while it will renew), `sites` (its quantity) and `paymentMethod` (brand, last four, expiry), read through `lib/stripe.ts`'s `readCustomerBillingSummary` by `services/entitlements.ts`'s `readOrgBillingSummary` — cached per customer for 60 s (a failure too), one read in flight per customer, bounded at 3 s; a failure answers `details: { licenseExpiresAt }` and still `200`, a value outside `orgBillingDetailsSchema`'s bounds is `null`, no id is served or logged, and the reply carries `Cache-Control: private, no-store`. Every other request is answered exactly as before, with no Stripe or licence read. **`POST /v1/billing/plan-checkout` (#9067 D3, `routes/billing/plan-checkout.ts`)** is the Billing tab's Purchase plan: a subscription Checkout for the caller's own Organization's plan (`planPurchaseLookupKey` — `ailk-pro_monthly` / `ailk-pro-plus_monthly`, `PLAN_PURCHASE_LOOKUP_KEYS` built by the Offerings lookup-key grammar, #9338 DD1), on the admitted key like the portal (#8463). **It sells only an Offerings plan (#9338 DD4):** `createCheckoutSession` gets a `refuseProduct` that refuses every Product whose `metadata.ailk_group` is not exactly `plan` (`isOfferingsPlanProduct`, `services/offerings/catalog.ts`), checked on the same expanded Price it sells; a refused or unexpanded Product answers `500 plan_price_missing`. Check order: tenant → `billing-manage` (403 before any lookup) → write budget (`chargeWriteBudget` scope `plancheckout`, 10 an hour per Organization and per person, `429` with `Retry-After`) → the commerce claim (`409 purchase_unavailable`, `503 license_undetermined`) → a strict `{ returnUrl }` (`bodyLimit` 4 KiB, `400 validation_failed`) → the return URL (canonical, no userinfo, query, fragment or `//` path, `https:` or a local `http:`, on `config.TRUSTED_ORIGINS`; `400 return_url_refused`, `500 config-error` when none is trusted) → no customer yet (`409 billing_customer_exists`) and a purchasable tier (`409 plan_not_purchasable`) → `STRIPE_SECRET_KEY` and `assertAdmittedStripeKey` → one payable session (an open earlier one is expired first, a completed one is `409 purchase_pending`) → `createCheckoutSession` with `mode: "subscription"`, 1–50 sites, `metadata` and `subscriptionMetadata` `{ organizationId, ...siteStamp() }` and `PLATFORM_TERMS_OF_SERVICE`, never a `buyer` → a Checkout URL only → the session id recorded on `Organization.planCheckoutSessionId` by compare-and-set (a lost race or a failed write expires the new session). It answers `{ url }` with `Cache-Control: private, no-store`; no body or log line carries the return URL, an id or a Stripe message. **The webhook's Organization arm binds only that recorded session (#9067 D13):** a `checkout.session.completed` with `metadata.organizationId` links `session.customer` through one guarded `updateMany` on `{ id, planCheckoutSessionId: session.id, billingCustomerId: null }` (clearing the session); anything else — an unrecorded session, a bound customer, every `customer.created` — writes nothing and logs `org_bind_unproven`. No MCP twin for the purchase — owner-only, recorded in `tests/parity/README.md`.
@@ -209,7 +209,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
209
209
  tools, `list_proposals` and `create_proposal`, twinning `GET`/`POST
210
210
  /v1/workspaces/:workspaceId/people/:personId/proposals` with the same grant: a proposal is
211
211
  private to one client, `payments` says whether approval leads to a Stripe page, and an agent's
212
- price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address), never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the seven Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `delete_language_item`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT`/`DELETE …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed, and the delete `content-publish` too — it removes the item from every Live page, no route restores it, and its slug stays taken; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and `PATCH …/magnets/:id` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the PATCH body whole, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot change what a magnet charges (`403 magnet_pricing_needs_person`); create and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's public path, for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live (and `delete_language_item`, with the same grant, clears it) — the access route answers every agent 403 `agent_refused`, and the publish, Live and Language delete routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
212
+ price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address), never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the seven Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `delete_language_item`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT`/`DELETE …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed, and the delete `content-publish` too — it removes the item from every Live page, no route restores it, and its slug stays taken; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and `PATCH …/magnets/:id` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the PATCH body whole, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot change what a magnet charges (`403 magnet_pricing_needs_person`); create and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's public path, for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool — and (#11680) the two site-vocabulary reads, `list_page_types` and `get_tag_vocabulary` (`mcp-workspace`'s `site_vocabulary.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"` — any tenant of the workspace, no grant), twinning `GET …/page-types` and `GET …/tag-vocabulary`: the page types this hub's site can serve (the registry filtered by the modules the hub runs), each with its address, whether a site has only one, its template and that template's headings, and the context classes, Knowledge topic tags and status tags, each with what it means and who may set it; both are platform data and read no row. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live (and `delete_language_item`, with the same grant, clears it) — the access route answers every agent 403 `agent_refused`, and the publish, Live and Language delete routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
213
213
  `data`. They are in the parity guard like every other tool, and never in
214
214
  `/.well-known/mcp.json`.
215
215
  - **The OAuth bearer branch (#10391).** When `BETTER_AUTH_URL` (the site's origin, its OAuth
@@ -250,7 +250,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
250
250
  all-workspaces token 503 `authorization_unavailable`.
251
251
  - **Handlers forward, nothing else.** `workspace-server.ts` resolves each tool from
252
252
  `@working-theory/mcp-workspace`'s `workspaceTools` (`agent_context.ts`, `knowledge.ts`, `inbox_messages.ts`,
253
- `inbox_submissions.ts`, `inbox_applications.ts`, `people_list.ts`, `person_notes.ts`, `person_thread.ts`, `person_memory.ts`, `proposals.ts`, `slack_connection.ts`, `page_suggestions.ts`, `content_draft.ts`, `content_publish.ts`, `knowledge_base.ts`, `workspace_settings.ts`, `library.ts`, all
253
+ `inbox_submissions.ts`, `inbox_applications.ts`, `people_list.ts`, `person_notes.ts`, `person_thread.ts`, `person_memory.ts`, `proposals.ts`, `slack_connection.ts`, `page_suggestions.ts`, `content_draft.ts`, `content_publish.ts`, `knowledge_base.ts`, `workspace_settings.ts`, `library.ts`, `site_vocabulary.ts`, all
254
254
  `// oss: false`) and, for the two prospect-channel settings tools, `@working-theory/mcp-scheduling`'s
255
255
  `workspaceTools` (`prospect_channel_settings.ts`, #9749, and the three meeting tools in `meetings.ts`, #10950 — the pack the scheduling module carries, so a
256
256
  scheduling-only build serves what it lists), loaded through the site's generated registry, as `server.ts` resolves the
@@ -334,7 +334,9 @@ Example (lead routing):
334
334
  - Don't add a tool without the matching `apps/api` endpoint.
335
335
  - Don't put business logic in tool handlers — they're adapters.
336
336
 
337
- Last updated: 2026-11-12 — #10986: `list_appointments` needs the `people-read` grant for an agent (its gate is the `appointments-read` role floor and that grant, the route's own check) — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-scheduling/src/routes/schedule/appointments.ts`.
337
+ Last updated: 2026-11-14 — #11680: `list_page_types` and `get_tag_vocabulary` added to the signed-in workspace surface (`gate: "tenant"`, `site_vocabulary.ts`) — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`.
338
+
339
+ Prior: 2026-11-12 — #10986: `list_appointments` needs the `people-read` grant for an agent (its gate is the `appointments-read` role floor and that grant, the route's own check) — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-scheduling/src/routes/schedule/appointments.ts`.
338
340
 
339
341
  Prior: 2026-11-08 — #11122 (D4, D5, D12): `list_meeting_types` loses `include` and its rows carry `visibility`, `providerEventTypeId`, `createdAt` and (manage view) `providerEditUrl`; `save_meeting_types`' two lists are exclusive; `list_appointments` takes `eventTypeId` — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `tests/parity/api-parity/fixtures/site-wire.ts`.
340
342
 
@@ -766,6 +766,16 @@ A site serves its services at `/services` unless `content/_site.mdx` sets `servi
766
766
  - **Surfaces.** The canonical, hreflang and `BreadcrumbList` (the base's title-cased last segment, then the category's title), `/sitemap.xml` and `/llms.txt` (`pagePathFor`), every nav and footer entry at `/services` (mapped in the locale layout), the hub's own section links, and route-family chrome (`lib/page-chrome.ts`) all follow it. A site that sets neither `services.path` nor any `parent` serves every URL exactly as before.
767
767
  - **Moving it.** `/ailk:growth-ops page rename` moves the base (`--from <current base> --to <new base>`): it writes `services.path` and keeps a previous moved base redirecting.
768
768
 
769
+ ## Renaming a route family (`<family>.path`)
770
+
771
+ A site serves a route family at its convention segment (`/portfolio`, `/meet`) unless that family's `content/_site.mdx` entry sets `path`, for example `portfolio: { path: /writing-samples }` or `meet: { path: /meetings }` (#11385). The key sits beside the family's `header` / `footer`. Twelve families take it: `meet`, `caseStudies`, `portfolio`, `team`, `courses`, `events`, `integrations`, `partners`, `features`, `products`, `resources` and `for`. The value is exactly one lowercase kebab segment, never `api`, `og`, `v1` or `apple-icon`. `docs` and `services` move through `docsPath` and `services.path` instead. Every other family refuses the key, because its package still writes its own links.
772
+
773
+ - **Generate first.** `create-ailk routes --write` writes the family's route files under the new segment (`app/[locale]/meetings/…`) and deletes its generated files from the old directory, listing them under `removed`. Unlike `services.path`, the route files themselves move. The command refuses, before it writes anything, a rename onto a served route, a reserved segment, another family's target, a renamed family's old segment, the family's own segment, or a content page `[slug]` serves. It also refuses when a non-generated file would be left behind in the old directory, when a `customizations.yaml` record names a file there, when the target directory already holds a file that is not one of the family's own generated route files, or when either directory holds a symbolic link.
774
+ - **Build.** `next.config.mjs` reads each family's `path`, checks it against the same rules plus the enabled locales and the docs and services segments, and bakes the result into `NEXT_PUBLIC_AILK_ROUTE_PATHS` (`{"portfolio":"writing-samples"}`, or `{}`). It fails the build, naming the value, when the files were not regenerated: a rename whose `app/[locale]/<new>/page.tsx` is not a generated route file, or a generated route file that re-exports a family's page from a directory where that family is not served. Both name `create-ailk routes --write`.
775
+ - **Request.** `legacyRedirects()`, which `redirects()` returns unchanged, adds four 308s per rename: `/<old>`, `/<old>/…` and their locale-prefixed twins onto the same rest under the new segment. A legacy route into the family (`/schedule/confirmed`) lands on the new segment in one hop. Links inside authored content are not rewritten; they keep working through the 308.
776
+ - **Surfaces.** Every surface reads the renames through `@working-theory/templates/route-paths` (re-exported from `./routes`): `renamedPath`, `conventionPath` and `routeSegment`. That covers the canonical and hreflang (`pagePath`), `/sitemap.xml` and `/llms.txt` (`pagePathFor`, with no `SITE_LISTING` row needed), the nav and footer (`lib/route-paths.ts`, mapped in the locale layout), breadcrumbs, the site-pages hub cards, family and page chrome (`lib/page-chrome.ts`), and the booking pages. A renamed `meet` keeps the chrome-free frame and the Cal.com CSP at its new path (`isBookingPath`'s third argument), and the scheduling package's cards, ItemList, one-meeting redirect and confirmation hand-off point there. `routeFor` does not change: it is the path the hub stores a page under.
777
+ - **Rollout.** A `@working-theory/site-config` older than this setting rejects a `_site.mdx` carrying it, because its schema is strict. `@working-theory/api` and `@working-theory/mcp-server` then read the site as having no config. Set `path` only once the site's packages carry it.
778
+
769
779
  ## Nav-only lists (`navOnly`)
770
780
 
771
781
  A list page whose frontmatter sets `navOnly: true` (valid on a registry list type only, #10200) has no page of its own: `honourNavOnly` (`lib/hub-children.tsx`) answers `permanentRedirect` (308) to the first child in the route's own child order (a hub's is slug order after `includeChild`, not the order of links its authored sections carry), at the card's public path with the locale prefix kept, and `notFound()` when it lists none. Only an exact `true` acts; anything else renders as before.
@@ -808,7 +818,9 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
808
818
  - Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
809
819
  - Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
810
820
 
811
- Last updated: 2026-11-13 — § Magnet pages: the magnet pages ship in `@working-theory/ui-signal-collectors` beside the flows pages, the careers walks adopted from site-pages' prefix, the `reports` strings in the package, and `/downloads` a routes-map redirect; `/dev/purchase` and its Server Action are retired (#11657) — verified against `packages-paid/ui-signal-collectors/{routes.json,src/pages/}`, `app/[locale]/{reports,trial,careers/apply,careers/[slug]/apply}/`, `packages/templates/src/routes-map.ts` and `next.config.mjs`.
821
+ Last updated: 2026-11-14 — § Renaming a route family: one `path` key on a family's `_site.mdx` entry moves its route files, public URLs, nav, breadcrumbs, hub cards and booking CSP, with a 308 from the old segment (#11385) — verified against `packages/templates/src/{route-paths,routes-map}.ts`, `packages/create-ailk/src/routes.ts`, `next.config.mjs`, `middleware.ts` and `lib/{route-paths,page-chrome}.ts`.
822
+
823
+ Prior: 2026-11-13 — § Magnet pages: the magnet pages ship in `@working-theory/ui-signal-collectors` beside the flows pages, the careers walks adopted from site-pages' prefix, the `reports` strings in the package, and `/downloads` a routes-map redirect; `/dev/purchase` and its Server Action are retired (#11657) — verified against `packages-paid/ui-signal-collectors/{routes.json,src/pages/}`, `app/[locale]/{reports,trial,careers/apply,careers/[slug]/apply}/`, `packages/templates/src/routes-map.ts` and `next.config.mjs`.
812
824
 
813
825
  Prior: 2026-11-13 — § Where the docs live: the blog category index `/blog/category/[tag]` ships as its own route in `@working-theory/ui-docs-blog`, so `app/[locale]/blog/` holds two generated route files (#11658) — verified against `packages-paid/ui-docs-blog/routes.json` and `app/[locale]/blog/`.
814
826
 
@@ -35,6 +35,7 @@ import {
35
35
  SiteConsentSchema,
36
36
  type ConsentAppearance,
37
37
  } from "@working-theory/site-config/schema";
38
+ import { routeSegment } from "@working-theory/templates/routes";
38
39
  import { MarketingShell } from "@working-theory/templates/shells";
39
40
  import { themeToShellCss } from "@working-theory/theme";
40
41
  import { Link, NewsletterSignupProvider, isRtl, localeHref } from "@working-theory/ui";
@@ -105,6 +106,7 @@ import {
105
106
  parentHref,
106
107
  servedParent,
107
108
  } from "../../lib/profile-back-link";
109
+ import { withRenamedColumns, withRenamedNavPaths } from "../../lib/route-paths";
108
110
  import { servedPages } from "../../lib/served-pages";
109
111
  import {
110
112
  withPublicServicesColumns,
@@ -633,7 +635,7 @@ export default async function LocaleLayout({
633
635
  // the marketing frame; /meet/confirmed keeps it too. The consent Banner
634
636
  // stays, as on the auth branch. The same fail-safe direction: an absent
635
637
  // `x-pathname` keeps the full frame.
636
- const isBookingRoute = SCHEDULING_PAGES && isBookingPath(pathname, enabledLocales);
638
+ const isBookingRoute = SCHEDULING_PAGES && isBookingPath(pathname, enabledLocales, routeSegment("meet"));
637
639
 
638
640
  // #8840 D10 — a magnet's walk (`/<magnet>/start`, `/careers/apply`,
639
641
  // `/careers/<posting>/apply`) renders full-screen: the auth branch's frame,
@@ -719,8 +721,9 @@ export default async function LocaleLayout({
719
721
  // #10041 D10 — every nav and footer path at `/docs` is rendered at the
720
722
  // site's docs path; `nav-config.ts` itself is never edited.
721
723
  // #10043 D9 — likewise every path at `/services`, at the services base.
722
- const publicNavItems = withPublicServicesPaths(withPublicDocsPaths(navItems));
723
- const footerColumnDefs = withPublicServicesColumns(withPublicDocsColumns(footerColumns)).map((col) => ({
724
+ // #11385 D8 — a renamed route family's links follow its served segment.
725
+ const publicNavItems = withRenamedNavPaths(withPublicServicesPaths(withPublicDocsPaths(navItems)));
726
+ const footerColumnDefs = withRenamedColumns(withPublicServicesColumns(withPublicDocsColumns(footerColumns))).map((col) => ({
724
727
  heading: labelFor(col.headingKey),
725
728
  headingKey: col.headingKey,
726
729
  items: col.items.map((item) => ({ ...item, label: labelFor(item.labelKey) })),
@@ -198,3 +198,31 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
198
198
  expect(mockSiteConfigGet).not.toHaveBeenCalled();
199
199
  });
200
200
  });
201
+
202
+ // #11385 D3, AC-1, AC-3 — one site-config entry renames the portfolio's
203
+ // segment: llms.txt lists every PortfolioItem at /writing-samples with no
204
+ // listing row, and no URL keeps the old segment.
205
+ describe.each(ROUTES)("GET /llms.txt (%s) — a renamed route family (#11385)", (path) => {
206
+ const saved = process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
207
+ beforeEach(() => {
208
+ process.env.CONTENT_ADAPTER = "database";
209
+ process.env.NEXT_PUBLIC_ENABLED_LOCALES = "en";
210
+ process.env.NEXT_PUBLIC_BASE_URL = BASE;
211
+ process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = '{"portfolio":"writing-samples"}';
212
+ });
213
+ afterEach(() => {
214
+ delete process.env.CONTENT_ADAPTER;
215
+ delete process.env.NEXT_PUBLIC_ENABLED_LOCALES;
216
+ delete process.env.NEXT_PUBLIC_BASE_URL;
217
+ if (saved === undefined) delete process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS;
218
+ else process.env.NEXT_PUBLIC_AILK_ROUTE_PATHS = saved;
219
+ });
220
+
221
+ it("lists the PortfolioItem at /writing-samples/acme and nothing under /portfolio", async () => {
222
+ const text = await llms(path, {
223
+ PortfolioItem: [{ type: "PortfolioItem", slug: "acme", title: "Acme" }],
224
+ });
225
+ expect(urls(text)).toContain(`${BASE}/writing-samples/acme`);
226
+ expect(urls(text).filter((url) => url.includes("/portfolio"))).toEqual([]);
227
+ });
228
+ });