create-ailk 0.47.0 → 0.48.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 +180 -43
- package/component-catalog.json +223 -285
- package/component-catalog.md +1 -1
- package/dist/apply-design.d.ts +26 -68
- package/dist/apply-design.js +150 -322
- package/dist/cli.js +152 -17
- package/dist/compare-chrome.d.ts +108 -0
- package/dist/compare-chrome.js +481 -0
- package/dist/compare-look.d.ts +94 -0
- package/dist/compare-look.js +378 -0
- package/dist/copy.js +1 -1
- package/dist/design-compile.d.ts +17 -21
- package/dist/design-compile.js +32 -56
- package/dist/design-files.d.ts +93 -0
- package/dist/design-files.js +312 -0
- package/dist/design-home.d.ts +4 -2
- package/dist/design-home.js +88 -6
- package/dist/design-names.d.ts +13 -0
- package/dist/design-names.js +76 -0
- package/dist/design-package.d.ts +46 -56
- package/dist/design-package.js +285 -288
- package/dist/design-presets.d.ts +41 -0
- package/dist/design-presets.js +83 -4
- package/dist/design-scaffold.d.ts +12 -2
- package/dist/design-scaffold.js +72 -34
- package/dist/generated/design-settings.d.ts +56 -0
- package/dist/generated/design-settings.js +237 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/inventory.d.ts +3 -2
- package/dist/inventory.js +10 -4
- package/dist/lib/design-checks.d.ts +46 -0
- package/dist/lib/design-checks.js +79 -1
- package/dist/lib/env-catalog.js +1 -1
- package/dist/lib/module-license-gate.d.ts +1 -1
- package/dist/lib/module-license-gate.js +1 -1
- package/dist/lib/render-verdict.d.ts +13 -1
- package/dist/lib/render-verdict.js +41 -1
- package/dist/look-hub.d.ts +44 -0
- package/dist/look-hub.js +130 -0
- package/dist/look-record.d.ts +35 -0
- package/dist/look-record.js +85 -0
- package/dist/look-samples.d.ts +66 -0
- package/dist/look-samples.js +456 -0
- package/dist/look-settings.d.ts +53 -0
- package/dist/look-settings.js +363 -0
- package/dist/module-architecture.js +12 -0
- package/dist/parse-args.d.ts +10 -6
- package/dist/parse-args.js +26 -13
- package/dist/programmatic.d.ts +1 -19
- package/dist/programmatic.js +65 -103
- package/dist/retired-design-bodies.d.ts +29 -0
- package/dist/retired-design-bodies.js +51 -0
- package/dist/seed-flows.d.ts +1 -1
- package/dist/seed-flows.js +12 -14
- package/dist/seed-workspace.d.ts +4 -1
- package/dist/seed-workspace.js +139 -17
- package/dist/site-chrome.d.ts +41 -41
- package/dist/site-chrome.js +50 -70
- package/dist/site-fonts.d.ts +10 -14
- package/dist/site-fonts.js +5 -1
- package/dist/starter-grid.d.ts +2 -2
- package/dist/strip-look-copies.d.ts +67 -0
- package/dist/strip-look-copies.js +591 -0
- package/dist/template-manifest.d.ts +6 -14
- package/dist/template-manifest.js +0 -9
- package/dist/template-record.d.ts +3 -1
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +15 -0
- package/dist/topology.js +60 -0
- package/dist/update.d.ts +57 -1
- package/dist/update.js +742 -13
- package/package.json +3 -4
- package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/designs/minimalism/DESIGN.md +163 -297
- package/site-templates/designs/minimalism/LOOK.md +42 -0
- package/site-templates/designs/minimalism/design.yaml +167 -0
- package/site-templates/designs/standard/DESIGN.md +145 -149
- package/site-templates/designs/standard/LOOK.md +42 -0
- package/site-templates/designs/standard/design.yaml +72 -0
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/content/_site.mdx +0 -26
- package/templates/.claude/rules/extending.md +3 -2
- package/templates/.env.example +11 -4
- package/templates/CLAUDE.md +1 -1
- package/templates/DESIGN.md +145 -149
- package/templates/README.md +15 -16
- package/templates/apps/api/.env.example +11 -4
- package/templates/apps/api/CLAUDE.md +6 -4
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +15 -5
- package/templates/apps/mcp/CLAUDE.md +4 -2
- package/templates/apps/web/.env.example +10 -3
- package/templates/apps/web/CLAUDE.md +14 -3
- package/templates/apps/web/app/[locale]/layout.tsx +53 -50
- package/templates/apps/web/app/not-found.tsx +11 -11
- package/templates/apps/web/auth.ts +48 -35
- package/templates/apps/web/jest.config.cjs +5 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +179 -31
- package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +71 -32
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
- package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
- package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
- package/templates/apps/web/lib/deck-page.ts +3 -10
- package/templates/apps/web/lib/deploy-fonts.ts +12 -0
- package/templates/apps/web/lib/hub-site-config.ts +97 -14
- package/templates/apps/web/lib/library-fonts.ts +41 -0
- package/templates/apps/web/lib/mcp-oauth.ts +11 -4
- package/templates/apps/web/lib/page-chrome.ts +52 -34
- package/templates/apps/web/lib/section-look.ts +28 -0
- package/templates/apps/web/lib/site-design.ts +205 -0
- package/templates/apps/web/lib/site-theme-head.ts +98 -13
- package/templates/apps/web/lib/site-theme.ts +40 -62
- package/templates/apps/web/messages/en.json +0 -6
- package/templates/apps/web/next.config.mjs +195 -6
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/site-pages.config.tsx +4 -2
- package/templates/content/_site.mdx +0 -26
- package/templates/design.yaml +75 -0
- package/templates/project.yaml +14 -0
- package/versions.json +52 -51
- package/site-templates/marketing-site/DESIGN.md +0 -259
- package/site-templates/marketing-site-free/DESIGN.md +0 -259
- package/site-templates/saas-product/DESIGN.md +0 -259
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
- package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
- package/templates/apps/web/lib/site-chrome.ts +0 -46
- package/templates/apps/web/lib/site-fonts.ts +0 -15
|
@@ -53,6 +53,23 @@
|
|
|
53
53
|
* and a link (`localeHref` passes any scheme through), so only its parsed
|
|
54
54
|
* output is kept. `identity` and `seo` are parsed as before in every case.
|
|
55
55
|
*
|
|
56
|
+
* Words and links only (#12470 D7): before the parse, the three style keys
|
|
57
|
+
* the record held before — `header.style`, `footer.style`, `families` — are
|
|
58
|
+
* removed (`withoutLegacyNavigationStyles`), so a site ahead of its hub
|
|
59
|
+
* still renders that hub's links.
|
|
60
|
+
*
|
|
61
|
+
* The workspace's design record rides the same read too (#12470 D7, D8):
|
|
62
|
+
* `design` is `{ version, record, settings, look }` when the body carries one
|
|
63
|
+
* that parses, else `null`, with the navigation's warning rule. `record` is
|
|
64
|
+
* checked with `siteDesignSchema` — the one schema the route and the tools
|
|
65
|
+
* use — after every top-level member the site does not render is removed (so
|
|
66
|
+
* a hub that adds one, as #12503 will, does not blank an older site's
|
|
67
|
+
* design); `settings` with `designSettingsSchema` and `look` with
|
|
68
|
+
* `siteDesignLookSchema`, each nullable; every level stays strict. Its
|
|
69
|
+
* grammars are what hold a hub value inside its CSS declaration where #12473
|
|
70
|
+
* writes one (SEC-12470-15). Today the site reads only `record.chrome`
|
|
71
|
+
* (`page-chrome.ts`'s `withDesignChrome`).
|
|
72
|
+
*
|
|
56
73
|
* `site-brand.tsx`, `site-identity.ts`, `site-contact-email.ts` and
|
|
57
74
|
* `site-contact-lines.ts` import this module; it imports none of them.
|
|
58
75
|
*/
|
|
@@ -77,8 +94,16 @@ import {
|
|
|
77
94
|
type SiteIdentity,
|
|
78
95
|
} from "@working-theory/site-config/schema";
|
|
79
96
|
import {
|
|
97
|
+
designSettingsSchema,
|
|
98
|
+
siteDesignLookSchema,
|
|
99
|
+
siteDesignSchema,
|
|
100
|
+
siteDesignVersionSchema,
|
|
80
101
|
siteNavigationSchema,
|
|
81
102
|
siteNavigationVersionSchema,
|
|
103
|
+
withoutLegacyNavigationStyles,
|
|
104
|
+
type DesignSettings,
|
|
105
|
+
type SiteDesign,
|
|
106
|
+
type SiteDesignLook,
|
|
82
107
|
type SiteNavigation,
|
|
83
108
|
} from "@working-theory/validation";
|
|
84
109
|
import { cache } from "react";
|
|
@@ -90,11 +115,20 @@ export interface HubNavigation {
|
|
|
90
115
|
record: SiteNavigation;
|
|
91
116
|
}
|
|
92
117
|
|
|
93
|
-
/** The workspace's
|
|
118
|
+
/** The workspace's design record, the version it was saved at, and the settings and look the hub worked out from it (#12470 D8). */
|
|
119
|
+
export interface HubDesign {
|
|
120
|
+
version: number;
|
|
121
|
+
record: SiteDesign;
|
|
122
|
+
settings: DesignSettings | null;
|
|
123
|
+
look: SiteDesignLook | null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The workspace's identity, seo, navigation and design rows as the site reads them; each `null` when absent or unreadable. */
|
|
94
127
|
export interface HubSite {
|
|
95
128
|
identity: SiteIdentity | null;
|
|
96
129
|
seo: SEO | null;
|
|
97
130
|
navigation: HubNavigation | null;
|
|
131
|
+
design: HubDesign | null;
|
|
98
132
|
}
|
|
99
133
|
|
|
100
134
|
/**
|
|
@@ -102,7 +136,7 @@ export interface HubSite {
|
|
|
102
136
|
* the schema it is checked with changes, so an entry written by older site
|
|
103
137
|
* code is never served as this shape (#12401 D1).
|
|
104
138
|
*/
|
|
105
|
-
const HUB_SITE_SHAPE = "
|
|
139
|
+
const HUB_SITE_SHAPE = "design1";
|
|
106
140
|
|
|
107
141
|
/** How long one hub read is served before it is read again. */
|
|
108
142
|
export const HUB_SITE_REVALIDATE_SECONDS = 300;
|
|
@@ -132,8 +166,8 @@ function parsedOrNull<T>(schema: ZodType<T>, value: unknown): T | null {
|
|
|
132
166
|
return parsed.success ? parsed.data : null;
|
|
133
167
|
}
|
|
134
168
|
|
|
135
|
-
/** The refused navigation field paths this process has warned about. */
|
|
136
|
-
const
|
|
169
|
+
/** The refused navigation and design field paths this process has warned about. */
|
|
170
|
+
const warnedPaths = new Set<string>();
|
|
137
171
|
|
|
138
172
|
/**
|
|
139
173
|
* A refused field's path, with every segment a hub value chose masked — a
|
|
@@ -150,11 +184,12 @@ function fieldPath(path: readonly PropertyKey[]): string {
|
|
|
150
184
|
return parts.length > 0 ? parts.join(".") : "(record)";
|
|
151
185
|
}
|
|
152
186
|
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
187
|
+
function unreadable(member: "navigation" | "design", path: string): null {
|
|
188
|
+
const key = `${member}:${path}`;
|
|
189
|
+
if (!warnedPaths.has(key)) {
|
|
190
|
+
warnedPaths.add(key);
|
|
156
191
|
console.warn(
|
|
157
|
-
`[hub-site-config]
|
|
192
|
+
`[hub-site-config] ${member} unreadable at ${path}; rendering the site's own ${member === "navigation" ? "navigation" : "look"}`,
|
|
158
193
|
);
|
|
159
194
|
}
|
|
160
195
|
return null;
|
|
@@ -164,18 +199,65 @@ function navigationUnreadable(path: string): null {
|
|
|
164
199
|
function navigationOrNull(value: unknown): HubNavigation | null {
|
|
165
200
|
if (value === undefined || value === null) return null;
|
|
166
201
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
167
|
-
return
|
|
202
|
+
return unreadable("navigation", "navigation");
|
|
168
203
|
}
|
|
169
204
|
const { version, record } = value as { version?: unknown; record?: unknown };
|
|
170
205
|
const parsedVersion = siteNavigationVersionSchema.safeParse(version);
|
|
171
|
-
if (!parsedVersion.success) return
|
|
172
|
-
|
|
206
|
+
if (!parsedVersion.success) return unreadable("navigation", "version");
|
|
207
|
+
// #12470 D7 — an older hub's record may still carry the three style keys.
|
|
208
|
+
const parsedRecord = siteNavigationSchema.safeParse(withoutLegacyNavigationStyles(record));
|
|
173
209
|
if (!parsedRecord.success) {
|
|
174
|
-
return
|
|
210
|
+
return unreadable("navigation", fieldPath(parsedRecord.error.issues[0]?.path ?? []));
|
|
175
211
|
}
|
|
176
212
|
return { version: parsedVersion.data, record: parsedRecord.data };
|
|
177
213
|
}
|
|
178
214
|
|
|
215
|
+
/** The design record's top-level members this site renders; any other is removed before the strict parse (#12470 D7). */
|
|
216
|
+
const RENDERED_DESIGN_MEMBERS = ["version", "from", "changes", "settings", "chrome", "brand"] as const;
|
|
217
|
+
|
|
218
|
+
/** `record` with only the top-level members the site renders; any other value passes through to the parse. */
|
|
219
|
+
function renderedDesignMembers(record: unknown): unknown {
|
|
220
|
+
if (typeof record !== "object" || record === null || Array.isArray(record)) return record;
|
|
221
|
+
return Object.fromEntries(
|
|
222
|
+
RENDERED_DESIGN_MEMBERS.filter((key) => Object.hasOwn(record, key)).map((key) => [
|
|
223
|
+
key,
|
|
224
|
+
(record as Record<string, unknown>)[key],
|
|
225
|
+
]),
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** The body's `design`, parsed, else `null` (#12470 D8). */
|
|
230
|
+
function designOrNull(value: unknown): HubDesign | null {
|
|
231
|
+
if (value === undefined || value === null) return null;
|
|
232
|
+
if (typeof value !== "object" || Array.isArray(value)) return unreadable("design", "design");
|
|
233
|
+
const { version, record, settings, look } = value as {
|
|
234
|
+
version?: unknown;
|
|
235
|
+
record?: unknown;
|
|
236
|
+
settings?: unknown;
|
|
237
|
+
look?: unknown;
|
|
238
|
+
};
|
|
239
|
+
const parsedVersion = siteDesignVersionSchema.safeParse(version);
|
|
240
|
+
if (!parsedVersion.success) return unreadable("design", "version");
|
|
241
|
+
const parsedRecord = siteDesignSchema.safeParse(renderedDesignMembers(record));
|
|
242
|
+
if (!parsedRecord.success) {
|
|
243
|
+
return unreadable("design", `record.${fieldPath(parsedRecord.error.issues[0]?.path ?? [])}`);
|
|
244
|
+
}
|
|
245
|
+
const parsedSettings = designSettingsSchema.nullable().safeParse(settings ?? null);
|
|
246
|
+
if (!parsedSettings.success) {
|
|
247
|
+
return unreadable("design", `settings.${fieldPath(parsedSettings.error.issues[0]?.path ?? [])}`);
|
|
248
|
+
}
|
|
249
|
+
const parsedLook = siteDesignLookSchema.nullable().safeParse(look ?? null);
|
|
250
|
+
if (!parsedLook.success) {
|
|
251
|
+
return unreadable("design", `look.${fieldPath(parsedLook.error.issues[0]?.path ?? [])}`);
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
version: parsedVersion.data,
|
|
255
|
+
record: parsedRecord.data,
|
|
256
|
+
settings: parsedSettings.data,
|
|
257
|
+
look: parsedLook.data,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
179
261
|
/**
|
|
180
262
|
* One hub read. Throws on any failure, so the cache writes nothing — except
|
|
181
263
|
* a keyless read's 401, which resolves no rows (#12390 D3).
|
|
@@ -195,7 +277,7 @@ async function fetchHubSite(keyed: boolean): Promise<HubSite> {
|
|
|
195
277
|
console.warn(
|
|
196
278
|
"[hub-site-config] the API refused a keyless read (401); rendering from content/_site.mdx",
|
|
197
279
|
);
|
|
198
|
-
return { identity: null, seo: null, navigation: null };
|
|
280
|
+
return { identity: null, seo: null, navigation: null, design: null };
|
|
199
281
|
}
|
|
200
282
|
if (!res.ok) throw new Error(`hub site-config read answered ${res.status}`);
|
|
201
283
|
const body: unknown = res.body;
|
|
@@ -211,6 +293,7 @@ async function fetchHubSite(keyed: boolean): Promise<HubSite> {
|
|
|
211
293
|
identity: parsedOrNull(SiteIdentitySchema, body.identity),
|
|
212
294
|
seo: parsedOrNull(SEOSchema, body.seo),
|
|
213
295
|
navigation: navigationOrNull("navigation" in body ? body.navigation : undefined),
|
|
296
|
+
design: designOrNull("design" in body ? body.design : undefined),
|
|
214
297
|
};
|
|
215
298
|
} finally {
|
|
216
299
|
clearTimeout(timer);
|
|
@@ -275,5 +358,5 @@ export function heldHubSite(): HubSite | undefined {
|
|
|
275
358
|
export function __resetHubSiteForTests(): void {
|
|
276
359
|
held = undefined;
|
|
277
360
|
keylessRetryAt = 0;
|
|
278
|
-
|
|
361
|
+
warnedPaths.clear();
|
|
279
362
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// library-fonts.ts — the design library's faces, built into every site
|
|
2
|
+
// (#12473 D6, spec docs/specs/12473-a-site-renders-its-colours-spec.md).
|
|
3
|
+
//
|
|
4
|
+
// Hand-written, not generated: one `next/font/local` call per entry of
|
|
5
|
+
// `LIBRARY_FONTS` (@working-theory/theme), each a literal `src` into the
|
|
6
|
+
// face's installed `@fontsource-variable/<slug>` latin variable file, so a
|
|
7
|
+
// build never reaches Google. Every face's `@font-face` rule is in the built
|
|
8
|
+
// stylesheet; none is preloaded, so a browser downloads one only when an
|
|
9
|
+
// element uses its family. The hub design record chooses which face
|
|
10
|
+
// `--font-display` / `--font-body` name, per request, with no build.
|
|
11
|
+
//
|
|
12
|
+
// The locale layout imports this module, so every page's stylesheet carries
|
|
13
|
+
// the rules. A test holds `LIBRARY_FACES`' families equal to `LIBRARY_FONTS`'.
|
|
14
|
+
|
|
15
|
+
import localFont from "next/font/local";
|
|
16
|
+
|
|
17
|
+
/** A built face: the CSS variable its family is read through, and the class that declares it. */
|
|
18
|
+
export interface BuiltFace {
|
|
19
|
+
variable: string;
|
|
20
|
+
className: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const figtree = localFont({
|
|
24
|
+
src: "../node_modules/@fontsource-variable/figtree/files/figtree-latin-wght-normal.woff2",
|
|
25
|
+
variable: "--font-lib-figtree",
|
|
26
|
+
display: "swap",
|
|
27
|
+
preload: false,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const newsreader = localFont({
|
|
31
|
+
src: "../node_modules/@fontsource-variable/newsreader/files/newsreader-latin-wght-normal.woff2",
|
|
32
|
+
variable: "--font-lib-newsreader",
|
|
33
|
+
display: "swap",
|
|
34
|
+
preload: false,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** The library's built faces, by family. */
|
|
38
|
+
export const LIBRARY_FACES: ReadonlyMap<string, BuiltFace> = new Map([
|
|
39
|
+
["Figtree", { variable: "--font-lib-figtree", className: figtree.variable }],
|
|
40
|
+
["Newsreader", { variable: "--font-lib-newsreader", className: newsreader.variable }],
|
|
41
|
+
]);
|
|
@@ -35,12 +35,14 @@ import { createHash, timingSafeEqual } from "node:crypto";
|
|
|
35
35
|
|
|
36
36
|
import {
|
|
37
37
|
ALL_WORKSPACES_SCOPE,
|
|
38
|
+
DEFAULT_MCP_SCOPES,
|
|
38
39
|
ISSUER_SCOPE_PREFIX,
|
|
39
40
|
lowerRole,
|
|
40
41
|
MCP_SCOPES,
|
|
41
42
|
type McpScope,
|
|
42
43
|
type MembershipRole,
|
|
43
44
|
grantsForWorkspace,
|
|
45
|
+
offerableScopes,
|
|
44
46
|
parseGrantedScopes,
|
|
45
47
|
scopesForRole,
|
|
46
48
|
tokenIssuedBy,
|
|
@@ -310,10 +312,14 @@ export function mcpOAuthPlugin(deps: McpOAuthDeps) {
|
|
|
310
312
|
return value;
|
|
311
313
|
}
|
|
312
314
|
|
|
313
|
-
/**
|
|
315
|
+
/**
|
|
316
|
+
* Each workspace with the scopes the request may approve there: the scopes
|
|
317
|
+
* the client named, else `DEFAULT_MCP_SCOPES`, so an opt-in scope is offered
|
|
318
|
+
* only to a client that asks for it by name (#12470 D3, SEC-12470-1).
|
|
319
|
+
*/
|
|
314
320
|
async function offeredWorkspaces(userId: string, requested: string[]) {
|
|
315
321
|
const asked = requested.filter((s): s is McpScope => (MCP_SCOPES as readonly string[]).includes(s));
|
|
316
|
-
const pool = asked
|
|
322
|
+
const pool = offerableScopes(asked);
|
|
317
323
|
const memberships = await deps.readMemberships(userId);
|
|
318
324
|
return memberships.map((m) => {
|
|
319
325
|
const allowed = new Set(scopesForRole(m.role));
|
|
@@ -379,14 +385,15 @@ export function mcpOAuthPlugin(deps: McpOAuthDeps) {
|
|
|
379
385
|
|
|
380
386
|
/**
|
|
381
387
|
* The all-workspaces consent's union (#11607 D1a): every workspace, and the
|
|
382
|
-
* requested scopes any of the person's roles may approve, in `MCP_SCOPES`
|
|
388
|
+
* requested scopes any of the person's roles may approve, in `MCP_SCOPES`
|
|
389
|
+
* order — never an opt-in one, even when named (#12470 D3).
|
|
383
390
|
*/
|
|
384
391
|
async function offeredReach(userId: string, requested: string[]) {
|
|
385
392
|
const workspaces = await offeredWorkspaces(userId, requested);
|
|
386
393
|
const union = new Set(workspaces.flatMap((w) => w.offered));
|
|
387
394
|
return {
|
|
388
395
|
workspaces: workspaces.map(({ id, name, organizationName, role }) => ({ id, name, organizationName, role })),
|
|
389
|
-
offered:
|
|
396
|
+
offered: DEFAULT_MCP_SCOPES.filter((s) => union.has(s)),
|
|
390
397
|
};
|
|
391
398
|
}
|
|
392
399
|
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Four levels, most specific first: the page's own frontmatter (`header:`,
|
|
6
6
|
* `footer:`, `layout:`), its route family's key in `_site.mdx` (`blog:`,
|
|
7
7
|
* `docs:`, …), the site defaults in `_site.mdx` (`header.style`,
|
|
8
|
-
* `footer.style`, `layout`), and last the design's own knobs
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `footer.style`, `layout`), and last the design's own knobs — the hub design
|
|
9
|
+
* record's layout, else `BASE_SITE_LAYOUT` (#12477 D1). A site that sets
|
|
10
|
+
* nothing resolves to exactly the chrome its look gives it.
|
|
11
11
|
*
|
|
12
12
|
* Blog posts and docs pages are served by the docs-blog slice, which this
|
|
13
13
|
* base file must never import, so they take their `blog:` / `docs:` family
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
type SiteLayout,
|
|
39
39
|
} from "@working-theory/site-config/schema";
|
|
40
40
|
import { conventionPath, ROUTES } from "@working-theory/templates/routes";
|
|
41
|
-
import type { SiteNavigation } from "@working-theory/validation";
|
|
41
|
+
import type { SiteDesignChrome, SiteNavigation } from "@working-theory/validation";
|
|
42
42
|
import { readLocales } from "@working-theory/web-i18n";
|
|
43
43
|
import { cache } from "react";
|
|
44
44
|
import { parse as parseYaml } from "yaml";
|
|
@@ -55,6 +55,7 @@ import { toInternalDocsPath } from "./docs-path";
|
|
|
55
55
|
import { readHubSite } from "./hub-site-config";
|
|
56
56
|
import { SERVICES_ROUTE, toInternalServicesPath } from "./services-path";
|
|
57
57
|
import { resolveContentRoot } from "./site-brand";
|
|
58
|
+
import { readSiteDesign, type SiteLayoutKnobs } from "./site-design";
|
|
58
59
|
import { safeNavigationChrome, type NavigationChrome } from "./site-navigation";
|
|
59
60
|
|
|
60
61
|
/** The chrome settings a site sets in `_site.mdx`. */
|
|
@@ -73,13 +74,13 @@ export interface PageChromeFields {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
/**
|
|
76
|
-
* The design knobs the template level reads — a structural slice of
|
|
77
|
-
*
|
|
78
|
-
* `chromeStyle` existed still compiles.
|
|
77
|
+
* The design knobs the template level reads — a structural slice of
|
|
78
|
+
* `SiteLayoutKnobs` (`lib/site-design.ts`).
|
|
79
79
|
*/
|
|
80
80
|
export interface ChromeKnobs {
|
|
81
|
+
nav: HeaderStyle;
|
|
81
82
|
home: SiteLayout;
|
|
82
|
-
footer:
|
|
83
|
+
footer: FooterStyle;
|
|
83
84
|
innerPages?: "bare";
|
|
84
85
|
chromeStyle?: "minimal";
|
|
85
86
|
}
|
|
@@ -171,20 +172,21 @@ export const readSiteChromeSettings = cache(
|
|
|
171
172
|
);
|
|
172
173
|
|
|
173
174
|
/**
|
|
174
|
-
* The file settings with the hub
|
|
175
|
-
* (#12401 D4): the record's header and footer style, and each
|
|
176
|
-
* `header` and `footer`, win where the record sets them; every
|
|
177
|
-
* the layout, a family's `path` — is the file's. Returns new
|
|
178
|
-
* changes `site`, which `readSiteChromeSettings` shares
|
|
175
|
+
* The file settings with the hub design record's `chrome` laid over them
|
|
176
|
+
* (#12470 D7, after #12401 D4): the record's header and footer style, and each
|
|
177
|
+
* route family's `header` and `footer`, win where the record sets them; every
|
|
178
|
+
* other value — the layout, a family's `path` — is the file's. Returns new
|
|
179
|
+
* objects and never changes `site`, which `readSiteChromeSettings` shares
|
|
180
|
+
* across the request.
|
|
179
181
|
*/
|
|
180
|
-
export function
|
|
182
|
+
export function withDesignChrome(
|
|
181
183
|
site: SiteChromeSettings,
|
|
182
|
-
|
|
184
|
+
chrome: SiteDesignChrome | undefined,
|
|
183
185
|
): SiteChromeSettings {
|
|
184
|
-
if (
|
|
186
|
+
if (chrome === undefined) return site;
|
|
185
187
|
const families: SiteChromeSettings["families"] = { ...site.families };
|
|
186
188
|
for (const key of ROUTE_FAMILY_KEYS) {
|
|
187
|
-
const styles =
|
|
189
|
+
const styles = chrome.families?.[key];
|
|
188
190
|
if (styles?.header === undefined && styles?.footer === undefined) continue;
|
|
189
191
|
families[key] = {
|
|
190
192
|
...site.families[key],
|
|
@@ -192,8 +194,8 @@ export function withNavigationStyles(
|
|
|
192
194
|
...(styles.footer !== undefined ? { footer: styles.footer } : {}),
|
|
193
195
|
};
|
|
194
196
|
}
|
|
195
|
-
const headerStyle =
|
|
196
|
-
const footerStyle =
|
|
197
|
+
const headerStyle = chrome.header ?? site.headerStyle;
|
|
198
|
+
const footerStyle = chrome.footer ?? site.footerStyle;
|
|
197
199
|
return {
|
|
198
200
|
...site,
|
|
199
201
|
...(headerStyle !== undefined ? { headerStyle } : {}),
|
|
@@ -419,16 +421,19 @@ export interface PageChromeInput {
|
|
|
419
421
|
|
|
420
422
|
export interface ResolvedChrome {
|
|
421
423
|
header: HeaderStyle;
|
|
422
|
-
/** No page, family or site value set the header — the design's own treatment applies. */
|
|
423
|
-
headerFromTemplate: boolean;
|
|
424
424
|
/** `line` is the design's one-bar footer on a bare inner page; never a site value. */
|
|
425
425
|
footer: FooterStyle | "line";
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* The design's own header and footer for a page (#10049 D3's template table).
|
|
430
|
+
* Where the table gives the design's own bar, it is the look's `nav` (#12470
|
|
431
|
+
* D7), so `mark-only` means the same whether a look, a site, a page or the
|
|
432
|
+
* design record sets it.
|
|
433
|
+
*/
|
|
429
434
|
function templateChrome(
|
|
430
435
|
input: PageChromeInput,
|
|
431
|
-
):
|
|
436
|
+
): ResolvedChrome {
|
|
432
437
|
const { chrome } = input;
|
|
433
438
|
if (input.isHome) {
|
|
434
439
|
if (input.homeIsDeck && chrome.home === "deck") {
|
|
@@ -437,24 +442,30 @@ function templateChrome(
|
|
|
437
442
|
footer: chrome.chromeStyle === "minimal" ? "closing" : chrome.footer,
|
|
438
443
|
};
|
|
439
444
|
}
|
|
440
|
-
return { header:
|
|
445
|
+
return { header: chrome.nav, footer: chrome.footer };
|
|
441
446
|
}
|
|
442
447
|
if (input.closingListed) {
|
|
443
448
|
return {
|
|
444
|
-
header: chrome.innerPages === "bare" ? "bare" :
|
|
449
|
+
header: chrome.innerPages === "bare" ? "bare" : chrome.nav,
|
|
445
450
|
footer: "closing",
|
|
446
451
|
};
|
|
447
452
|
}
|
|
448
453
|
if (chrome.innerPages === "bare") return { header: "bare", footer: "line" };
|
|
449
|
-
return { header:
|
|
454
|
+
return { header: chrome.nav, footer: chrome.footer };
|
|
450
455
|
}
|
|
451
456
|
|
|
452
457
|
/**
|
|
453
458
|
* The home's layout and chrome — the one resolution both the layout and the
|
|
454
459
|
* home page read, so the bar and the landing can never disagree. The site
|
|
455
|
-
* settings are `_site.mdx`'s with the hub
|
|
456
|
-
*
|
|
457
|
-
*
|
|
460
|
+
* settings are `_site.mdx`'s with the hub design record's `chrome` over them
|
|
461
|
+
* (#12470 D7) — whenever the hub read carries a design record, whether or not
|
|
462
|
+
* a navigation record renders: style no longer belongs to the navigation.
|
|
463
|
+
* `navigation` is the rendered navigation record, for the layout.
|
|
464
|
+
*
|
|
465
|
+
* #12473 D4 — the design knobs are the hub design record's layout when it
|
|
466
|
+
* carries one, else `chrome` — the callers' `BASE_SITE_LAYOUT` (#12477 D1);
|
|
467
|
+
* `knobs` answers the record's alone, absent with no record, for the home
|
|
468
|
+
* page's deck knobs.
|
|
458
469
|
*/
|
|
459
470
|
export async function resolveHomeChrome(
|
|
460
471
|
locale: string,
|
|
@@ -464,22 +475,30 @@ export async function resolveHomeChrome(
|
|
|
464
475
|
chrome: ResolvedChrome;
|
|
465
476
|
site: SiteChromeSettings;
|
|
466
477
|
navigation: RecordNavigation | null;
|
|
478
|
+
knobs?: SiteLayoutKnobs;
|
|
467
479
|
}> {
|
|
468
|
-
const navigation = await
|
|
469
|
-
|
|
480
|
+
const [navigation, hub, design] = await Promise.all([
|
|
481
|
+
readRecordNavigation(locale),
|
|
482
|
+
readHubSite(),
|
|
483
|
+
readSiteDesign(),
|
|
484
|
+
]);
|
|
485
|
+
const knobs = design?.layout;
|
|
486
|
+
const designKnobs = knobs ?? chrome;
|
|
487
|
+
const site = withDesignChrome(readSiteChromeSettings(), hub?.design?.record.chrome);
|
|
470
488
|
const page = await resolveChromePage("/", locale);
|
|
471
|
-
const layout = resolveHomeLayout(site, page,
|
|
489
|
+
const layout = resolveHomeLayout(site, page, designKnobs);
|
|
472
490
|
return {
|
|
473
491
|
layout,
|
|
474
492
|
site,
|
|
475
493
|
navigation,
|
|
494
|
+
...(knobs !== undefined && { knobs }),
|
|
476
495
|
chrome: resolvePageChrome({
|
|
477
496
|
isHome: true,
|
|
478
497
|
homeIsDeck: layout === "deck",
|
|
479
498
|
family: null,
|
|
480
499
|
page,
|
|
481
500
|
site,
|
|
482
|
-
chrome,
|
|
501
|
+
chrome: designKnobs,
|
|
483
502
|
closingListed: false,
|
|
484
503
|
}),
|
|
485
504
|
};
|
|
@@ -494,7 +513,6 @@ export function resolvePageChrome(input: PageChromeInput): ResolvedChrome {
|
|
|
494
513
|
const footer = input.page.footer ?? family?.footer ?? input.site.footerStyle;
|
|
495
514
|
return {
|
|
496
515
|
header: header ?? template.header,
|
|
497
|
-
headerFromTemplate: header === undefined,
|
|
498
516
|
footer: footer ?? template.footer,
|
|
499
517
|
};
|
|
500
518
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section look — registers the site's look for its sections with
|
|
3
|
+
* `@working-theory/page-renderer` (#12474 D3), so a section a page does not
|
|
4
|
+
* set a look field for takes the look's value for its page type, and a change
|
|
5
|
+
* of look in the hub reaches every such page with no page written and no
|
|
6
|
+
* deploy.
|
|
7
|
+
*
|
|
8
|
+
* The reader answers the hub's worked-out `settings.sections` of the site's
|
|
9
|
+
* design record (#12470 D7, D8) — never `design.record`, whose `settings` a
|
|
10
|
+
* library-look record does not hold. It is `undefined` when the hub read has
|
|
11
|
+
* no design, or no worked-out settings, or no `sections`: the pages then
|
|
12
|
+
* render as stored. `readHubSite()` is `cache()`-shared within a request and
|
|
13
|
+
* refreshed by the `site-config` purge every design save sends, so the reader
|
|
14
|
+
* adds no read.
|
|
15
|
+
*
|
|
16
|
+
* Registration happens at module load, and only on a hub-connected site
|
|
17
|
+
* (`hubConnected()`); a site that is not registers nothing and makes no call.
|
|
18
|
+
* `app/[locale]/layout.tsx` imports this module beside the other
|
|
19
|
+
* registrations.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { setSectionLookReader } from "@working-theory/page-renderer";
|
|
23
|
+
|
|
24
|
+
import { hubConnected, readHubSite } from "./hub-site-config";
|
|
25
|
+
|
|
26
|
+
if (hubConnected()) {
|
|
27
|
+
setSectionLookReader(async () => (await readHubSite())?.design?.settings?.sections ?? undefined);
|
|
28
|
+
}
|