create-ailk 0.40.3 → 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.
- package/README.md +31 -1
- package/component-catalog.json +6 -0
- package/dist/add-route.d.ts +2 -6
- package/dist/add-route.js +2 -43
- package/dist/export-content.js +11 -3
- package/dist/language-import.js +5 -2
- package/dist/lib/env-catalog.js +5 -1
- package/dist/lib/import-mdx.js +10 -7
- package/dist/magnet-page.d.ts +36 -0
- package/dist/magnet-page.js +70 -0
- package/dist/module-architecture.js +14 -48
- package/dist/routes.d.ts +44 -2
- package/dist/routes.js +766 -33
- package/dist/surfaces.d.ts +18 -2
- package/dist/surfaces.js +85 -21
- package/dist/topology.js +0 -1
- package/dist/update.d.ts +16 -1
- package/dist/update.js +273 -7
- package/package.json +3 -3
- package/templates/.claude/hooks/template-guard.sh +145 -36
- package/templates/CLAUDE.md +1 -1
- package/templates/apps/api/.env.example +2 -1
- package/templates/apps/api/CLAUDE.md +1 -0
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/.env.example +5 -6
- package/templates/apps/web/CLAUDE.md +41 -7
- package/templates/apps/web/app/[locale]/layout.tsx +6 -3
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +37 -1
- package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +28 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +17 -0
- package/templates/apps/web/lib/__tests__/magnet-routes.test.ts +1 -0
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +42 -0
- package/templates/apps/web/lib/__tests__/route-paths.test.ts +57 -0
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +22 -7
- package/templates/apps/web/lib/deck-page.ts +20 -1
- package/templates/apps/web/lib/mcp-oauth.ts +14 -10
- package/templates/apps/web/lib/page-chrome.ts +11 -5
- package/templates/apps/web/lib/route-paths.ts +22 -0
- package/templates/apps/web/lib/services-path.ts +27 -18
- package/templates/apps/web/messages/en.json +0 -9
- package/templates/apps/web/middleware.ts +2 -1
- package/templates/apps/web/next.config.mjs +123 -2
- package/templates/apps/web/src/lib/routes.ts +4 -2
- package/versions.json +50 -50
- package/templates/apps/web/lib/deliverable-grant.ts +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ailk",
|
|
3
|
-
"version": "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.
|
|
32
|
-
"@working-theory/templates": "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.
|
|
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
|
-
|
|
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." \
|
package/templates/CLAUDE.md
CHANGED
|
@@ -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" -->
|
|
@@ -78,7 +78,8 @@ STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
|
78
78
|
# When set, POST /v1/checkout/sessions requires the X-Internal-Auth header
|
|
79
79
|
# to match this value. Unset for OSS standalone deployments (no gate applied).
|
|
80
80
|
# Must match OSS_API_INTERNAL_SECRET in apps-paid/marketing-api/.env.local
|
|
81
|
-
# and in apps/web's environment (the
|
|
81
|
+
# and in apps/web's environment (the Offerings buy route,
|
|
82
|
+
# /api/offerings/checkout/<lookupKey>).
|
|
82
83
|
# Generate with: openssl rand -hex 32
|
|
83
84
|
# OSS_API_INTERNAL_SECRET=your-shared-secret-here
|
|
84
85
|
|
|
@@ -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-
|
|
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
|
|
|
@@ -54,7 +54,7 @@ CONTENT_ADAPTER=mdx
|
|
|
54
54
|
# POST /v1/leads/submit, /v1/leads/subscribe, /v1/leads/callback and
|
|
55
55
|
# /v1/schedule/book, and the site's lead, flow and checkout Server Actions
|
|
56
56
|
# (contact, careers, newsletter, flow step, flow checkout, saved
|
|
57
|
-
# recommendation
|
|
57
|
+
# recommendation). A bot is refused (403 bot_detected on the
|
|
58
58
|
# relay; the form's own error from an action), so no lead, booking or Slack
|
|
59
59
|
# invite exists. A real visitor sees no extra step, except that a form posted
|
|
60
60
|
# before the page has finished loading (or with JavaScript off) carries no
|
|
@@ -156,13 +156,12 @@ CONTENT_ADAPTER=mdx
|
|
|
156
156
|
# =============================================================================
|
|
157
157
|
# apps/api internal-auth secret (server-side only) — #6876
|
|
158
158
|
# =============================================================================
|
|
159
|
-
# SERVER-SIDE ONLY — never rename it with a NEXT_PUBLIC_ prefix. The
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
# buyer's Checkout. Must equal OSS_API_INTERNAL_SECRET in apps/api's
|
|
159
|
+
# SERVER-SIDE ONLY — never rename it with a NEXT_PUBLIC_ prefix. The Offerings
|
|
160
|
+
# buy route (/api/offerings/checkout/<lookupKey>) sends it as X-Internal-Auth
|
|
161
|
+
# on POST /v1/checkout/sessions. Must equal OSS_API_INTERNAL_SECRET in apps/api's
|
|
163
162
|
# environment. Unset on both sides for OSS standalone deployments: the API
|
|
164
163
|
# applies no gate and this app sends no header. Set on the API but not here,
|
|
165
|
-
# and the
|
|
164
|
+
# and the API refuses the buy with its 401.
|
|
166
165
|
# Generate with: openssl rand -hex 32 (see apps/api/.env.example)
|
|
167
166
|
# OSS_API_INTERNAL_SECRET=your-shared-secret-here
|
|
168
167
|
|
|
@@ -68,7 +68,7 @@ Don't ship a page after one render. The expected per-page loop:
|
|
|
68
68
|
|
|
69
69
|
## Where the base pages live
|
|
70
70
|
|
|
71
|
-
**The base website's pages ship in `@working-theory/site-pages` (#11259, ADR 0040 phase 4).** The home page and the 62 pages under the 38 base directories (`[slug]`, `about`, … `working-agreement`, `(authed)/leads`) — with the actions, loaders and libs only they read (`hub-children`, `route-family`, `service-listing`, `template-listing`, `meet-placeholder`, `posting-title`, `lead-write`) and their tests — live in `packages/site-pages/src/{pages,lib}/`, at the paths they had here. This app's `app/[locale]/` holds only the 63 route files `create-ailk routes --write` generates from the package's `routes.json` — never hand-edited, pinned by `routes --check` — plus the module
|
|
71
|
+
**The base website's pages ship in `@working-theory/site-pages` (#11259, ADR 0040 phase 4).** The home page and the 62 pages under the 38 base directories (`[slug]`, `about`, … `working-agreement`, `(authed)/leads`) — with the actions, loaders and libs only they read (`hub-children`, `route-family`, `service-listing`, `template-listing`, `meet-placeholder`, `posting-title`, `lead-write`) and their tests — live in `packages/site-pages/src/{pages,lib}/`, at the paths they had here. This app's `app/[locale]/` holds only the 63 route files `create-ailk routes --write` generates from the package's `routes.json` — never hand-edited, pinned by `routes --check` — plus the module routes under those directories (`careers/apply` and `careers/[slug]/apply`, generated from `@working-theory/ui-signal-collectors` since #11657; `projects/apply`) and `contact/error.tsx`. The package reads the site through one typed file, `site-pages.config.tsx`, whose `site` export answers the `@working-theory/site-pages/site` seam (`next.config.mjs` and `jest.config.cjs` alias it); no page takes a customization option. The ten namespaces those pages read ship in the package (`sitePagesMessages`), merged under this app's catalog by `i18n/request.ts`; a key in `messages/en.json` is an override. `lib/site-contact-email.ts` and `lib/site-contact-lines.ts` (the `_site.mdx` readers the layout and the module pages share) stay the site's. The sections below name the pages by their old `app/[locale]/` place.
|
|
72
72
|
|
|
73
73
|
## The `(auth)` route group — which predicate an affordance keys on
|
|
74
74
|
|
|
@@ -500,6 +500,20 @@ Cal.com edit and the page.
|
|
|
500
500
|
|
|
501
501
|
## Magnet pages
|
|
502
502
|
|
|
503
|
+
**Where they live (#11657, ADR 0040).** The flows pages (#11251) and the
|
|
504
|
+
magnet pages — the reports hub, the report reader, its walk, its file proxy
|
|
505
|
+
and the deliverable renderer, the trial pair and the two careers walks — ship
|
|
506
|
+
in `@working-theory/ui-signal-collectors`
|
|
507
|
+
(`packages-paid/ui-signal-collectors/src/pages/{flows,reports,trial,careers}/`),
|
|
508
|
+
with their tests. This app's `app/[locale]/flows/`, `reports/`, `trial/`,
|
|
509
|
+
`careers/apply/` and `careers/[slug]/apply/` hold only the fourteen route
|
|
510
|
+
files `create-ailk routes --write` generates from the package's
|
|
511
|
+
`routes.json` — each `// oss: false`, never hand-edited, pinned by
|
|
512
|
+
`routes --check`. The two careers walks sit under site-pages' `careers`
|
|
513
|
+
prefix, which leaves them to the site (`siteOwned`); the package's manifest
|
|
514
|
+
`adopts` them. The `reports` strings ship in the package (`flowsMessages`).
|
|
515
|
+
The sections below name the pages by their old `app/[locale]/` place.
|
|
516
|
+
|
|
503
517
|
Every multi-step magnet is a page pair (#8840), rendered by one module,
|
|
504
518
|
`app/[locale]/flows/[slug]/magnet-page.tsx`:
|
|
505
519
|
|
|
@@ -534,7 +548,7 @@ Every multi-step magnet is a page pair (#8840), rendered by one module,
|
|
|
534
548
|
(the magnet's `landing.cta`, "Request a free trial") goes to
|
|
535
549
|
`/trial/request` rather than `/trial/start`, and the walk passes a
|
|
536
550
|
`title`, so an absent flow renders the contact email under its own `<h1>`,
|
|
537
|
-
as `/careers/apply` does. Both
|
|
551
|
+
as `/careers/apply` does. Both ship in the package (above).
|
|
538
552
|
Any other pair is written by `create-ailk add-route magnet --path <path>
|
|
539
553
|
--flow <slug>`: two short pages carrying the `Standard magnet page
|
|
540
554
|
(#8840)` marker, which `lib/__tests__/structured-data.test.tsx` exempts
|
|
@@ -577,7 +591,11 @@ Every multi-step magnet is a page pair (#8840), rendered by one module,
|
|
|
577
591
|
`NEXT_PUBLIC_API_URL`) is set —
|
|
578
592
|
reads `not-configured` (set once in `readMagnet`), and the slug 404s, as
|
|
579
593
|
does its `/start` (#9219). `/downloads` and `/downloads/<slug>` are
|
|
580
|
-
permanent redirects into `/reports`
|
|
594
|
+
permanent redirects into `/reports` and `/reports/<slug>`, declared as
|
|
595
|
+
`legacyRoutes` on the routes map's `/reports` rows — the slug held to
|
|
596
|
+
lowercase letters, digits and hyphens — and emitted by `next.config.mjs`'s
|
|
597
|
+
`legacyRedirects()`, each with a locale-prefixed twin (#11657); no page file
|
|
598
|
+
serves them.
|
|
581
599
|
|
|
582
600
|
## Pricing page
|
|
583
601
|
|
|
@@ -723,14 +741,14 @@ A visitor's browser never calls the hub. Lead capture, newsletter signup, callba
|
|
|
723
741
|
- **No cross-site POST.** A `Sec-Fetch-Site` other than `same-origin`, or an `Origin` not on this site's own host, is refused 403 before the hub is called.
|
|
724
742
|
- **Headers are an allow-list.** The visitor's `x-forwarded-for` (else `x-real-ip`) and `user-agent` pass through so per-visitor rate limits still count each visitor; no `authorization`, client-sent `x-ailk-*` or `host` is forwarded, and a `cookie` goes only on `POST /v1/commerce/invoices`, the one session route — and there only one of the two Better Auth session cookies the hub reads (`__Secure-better-auth.session_token` first, else `better-auth.session_token`), never a spoke's sealed `__Host-ailk-hub-session` or any other cookie (#8066).
|
|
725
743
|
- **The relay has its own per-visitor budget (#7707).** Each visitor gets 8 calls per 10 minutes across the five visitor routes, and the session route (`POST /v1/commerce/invoices`, a hub only) gets its own, wider budget of 30 per 10 minutes; the call that exceeds either gets `429 rate_limited` before any hub call. The budget is held in this instance's own process (no shared store, no env variable) and holds only where the site's edge overwrites `x-forwarded-for` and `x-real-ip` — Vercel does; a bare self-hosted Next server does not.
|
|
726
|
-
- **A bot check on the public writes (#9889, #9255).** On Vercel, `lib/bot-check.ts`'s `runBotCheck` asks Vercel BotID for a verdict before the hub is called — in the relay for `POST /v1/leads/{submit,subscribe,callback}` and `POST /v1/schedule/book` (`BOT_CHECKED_ROUTES`: `403 bot_detected`, or `503 bot_check_unavailable` when the check throws, answers no boolean or takes over 5 seconds), and in the contact, careers, newsletter, flow-step, flow-checkout
|
|
744
|
+
- **A bot check on the public writes (#9889, #9255).** On Vercel, `lib/bot-check.ts`'s `runBotCheck` asks Vercel BotID for a verdict before the hub is called — in the relay for `POST /v1/leads/{submit,subscribe,callback}` and `POST /v1/schedule/book` (`BOT_CHECKED_ROUTES`: `403 bot_detected`, or `503 bot_check_unavailable` when the check throws, answers no boolean or takes over 5 seconds), and in the contact, careers, newsletter, flow-step, flow-checkout and saved-recommendation Server Actions immediately before their hub call, which answer their own existing failure variant. The locale layout's `BotIdClient` protects every same-origin POST (`BOT_CLIENT_PROTECT`, `/*`), because a Server Action posts to the page it was submitted from; `next.config.mjs` wraps `withBotId` and `middleware.ts` keeps BotID's proxy prefix out of its matcher. It is on by default and inert off Vercel: `AILK_BOT_CHECK=off` turns every check off, `AILK_BOOKING_BOT_CHECK=off` the booking's alone, and MCP tools never pass through a site, so they are never challenged. A refusal logs `[<source>] bot refused` with BotID's `classificationReason`, `bypassed` and `isVerifiedBot`, the request's `host` and `forwardedHost`, and `proxied` (a `cf-ray` header) — no other header value, no form field (#10715). `AILK_BOT_CHECK=observe` runs the check and logs the same facts plus `isBot` as `observed`, but passes every write — for diagnosis only. **A BotID-protected site must be reached directly — Cloudflare DNS-only, no reverse proxy in front of Vercel (#10715).** Behind a proxy the write reaches Vercel from the proxy's egress rather than the browser that solved the challenge, so BotID refuses every real visitor; the first proxied request per process logs `[<source>] reverse proxy detected` (outcome `proxied`) naming that fix.
|
|
727
745
|
- `/v1` is exempt from next-intl's locale rewrite in `middleware.ts`, as `/api` is.
|
|
728
746
|
|
|
729
747
|
## Where the docs live (`docsPath`)
|
|
730
748
|
|
|
731
749
|
A site serves its docs at `/docs` unless `content/_site.mdx` sets a top-level `docsPath` (one to four lowercase kebab segments, leading slash, no trailing slash — e.g. `docsPath: /working-theory/docs`, #10041). The route never moves: it stays at `app/[locale]/docs/`, and every surface reads the one value through `lib/docs-path.ts` (`DOCS_PATH`, `toPublicDocsHref`).
|
|
732
750
|
|
|
733
|
-
- **Where the pages live (#11254, ADR 0040).** The `/docs` and `/blog` catch-alls ship in `@working-theory/ui-docs-blog` (`packages-paid/ui-docs-blog/src/pages/`), with their loaders — the runtime source and the two blog route adapters — and their tests. This app's `app/[locale]/docs/` and `app/[locale]/blog/` hold only the
|
|
751
|
+
- **Where the pages live (#11254, ADR 0040).** The `/docs` and `/blog` catch-alls ship in `@working-theory/ui-docs-blog` (`packages-paid/ui-docs-blog/src/pages/`), with their loaders — the runtime source and the two blog route adapters — and their tests. This app's `app/[locale]/docs/` and `app/[locale]/blog/` hold only the three route files `create-ailk routes --write` generates from the package's `routes.json` — the docs catch-all, the blog catch-all and the blog category index `blog/category/[tag]` (#11658) — each `// oss: false`, never hand-edited, pinned by `routes --check`. The site keeps what is built from its own content — `source.config.ts`, `lib/source.ts` (which hands the package's runtime source `DOCS_PATH`) and the codegen stub — and passes it in through one typed file, `docs-blog.config.tsx` (`defineDocsBlogConfig({ site })`: the two source resolvers, `DOCS_PATH`, `toPublicDocsHref` and `getOgImageUrl` — the host seam, no extension point), which every generated file passes to the page and to `generateMetadata` as `config`. The `docs` and `blog` strings ship in the package (`docsBlogMessages`), merged under this app's catalog by `i18n/request.ts` through `loadUiDocsBlog()`; a key in `messages/en.json` is an override.
|
|
734
752
|
|
|
735
753
|
- **Build.** `next.config.mjs` reads `docsPath`, bakes it into `NEXT_PUBLIC_AILK_DOCS_PATH`, and fails the build naming the value when it breaks the pattern, starts with `api`, `og`, `v1` or an enabled locale, sits under `/docs`, shadows a `ROUTES` page (a `:param` segment matches any segment, so `/products/docs` is refused) or sits under a catch-all (`/blog/...`), or when this site's `lib/source.ts` does not set `baseUrl: DOCS_PATH` — a site with no docs-blog module, or one whose docs-blog files predate the setting. Links inside a doc's body are re-pointed only on a site that sets `docsPath`; there they render through `Link`, which forwards a fixed prop set, so a body anchor's `title` / `target` / `rel` are not kept.
|
|
736
754
|
- **Request.** `middleware.ts` hands next-intl the internal `/docs/...` path for a request at or under `docsPath` (bare or locale-prefixed), so the browser keeps the public URL, and maps a redirect's `Location` and each hreflang `Link` entry back onto it. `/docs` and `/docs/...` answer with the site's 404 — rewritten to `/_ailk-docs-unmounted`, whose first segment is no locale, so the locale layout calls `notFound()`.
|
|
@@ -748,12 +766,22 @@ A site serves its services at `/services` unless `content/_site.mdx` sets `servi
|
|
|
748
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.
|
|
749
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.
|
|
750
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
|
+
|
|
751
779
|
## Nav-only lists (`navOnly`)
|
|
752
780
|
|
|
753
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.
|
|
754
782
|
|
|
755
783
|
- **Where.** The thirteen hubs inside `hubPageInput` (slug order after `includeChild`; `/services` at `servicePublicPath`), `/alternatives` (`/vs/<slug>`, slug-read order), `/templates`, `/careers` (newest first) and `/reports` (newest first) with one call each, and the childless `/faq`, `/glossary`, `/clients`, `/testimonials` and the `[slug]` `BlogList` teaser, which 404.
|
|
756
|
-
- **Not honoured.** The docs-blog module's Fumadocs `/blog` and `/docs`; `DownloadsList` (`/downloads`
|
|
784
|
+
- **Not honoured.** The docs-blog module's Fumadocs `/blog` and `/docs`; `DownloadsList` (`/downloads` is a routes-map redirect to `/reports`); `LocationsList` (no route). `/sitemap.xml` and `/llms.txt` still list a Nav-only list's URL.
|
|
757
785
|
- **The nav is untouched.** `lib/nav-config.ts` is generated from route surfaces, not from list pages, so the heading and its children stay in the menu.
|
|
758
786
|
|
|
759
787
|
## The owner's discovery switch
|
|
@@ -790,7 +818,13 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
790
818
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
791
819
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
792
820
|
|
|
793
|
-
Last updated: 2026-11-
|
|
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`.
|
|
824
|
+
|
|
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/`.
|
|
826
|
+
|
|
827
|
+
Prior: 2026-11-12 — § The `(auth)` route group: the purchase spend answers this spoke's code, never the hub's verify URL, and the hub's Google provider refuses a raw ID token (#11109) — verified against `packages/auth/src/api/{auth/hub/purchase,hub-session/open}/route.ts` and `auth.ts`.
|
|
794
828
|
|
|
795
829
|
Prior: 2026-11-12 — § The MCP authorization server: a refresh racing a revoke is refused, the forced prompt is what makes a revoked client ask again, `/change-password` signs other devices out, the register limit applies without a trusted proxy, and the sweep runs after an accepted consent (#10459) — verified against `lib/mcp-oauth.ts` and `auth.ts`.
|
|
796
830
|
|
|
@@ -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
|
-
|
|
723
|
-
const
|
|
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) })),
|