@typeroll/mcp-server 0.45.60 → 0.45.61
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/AGENTS.md +10 -0
- package/dist/bundled-content.js +5 -5
- package/dist/tools/page-blocks.js +31 -16
- package/dist/tools/pages.js +11 -5
- package/dist/tools/settings.js +2 -2
- package/dist/tools/styles.js +4 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/tr-brand.md +8 -0
- package/skills/tr-migrate-wp.md +3 -0
- package/skills/tr-migration-evidence.md +35 -0
- package/skills/tr-new-site.md +3 -1
|
@@ -31,6 +31,18 @@ const targetSchema = z.object({
|
|
|
31
31
|
function v(version) {
|
|
32
32
|
return version ? { version } : undefined;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Write tools answer compactly by default: the changed block, its parent id,
|
|
36
|
+
* slot index and position, has_unsaved_changes and any warnings, instead of
|
|
37
|
+
* the container's whole tree (tens of kB for an article). `response: "tree"`
|
|
38
|
+
* asks for the tree. Sent as a query parameter, which an older Core ignores
|
|
39
|
+
* and answers with the tree, where an unknown body key would be refused.
|
|
40
|
+
*/
|
|
41
|
+
const responseParam = z.enum(['summary', 'tree']).optional().describe('Answer shape. "summary" (default): the changed block, parent_id, slot_index, position, has_unsaved_changes and warnings. "tree": the whole block tree of the container.');
|
|
42
|
+
function writeQuery(version, response) {
|
|
43
|
+
return { ...v(version), response: response ?? 'summary' };
|
|
44
|
+
}
|
|
45
|
+
const COMPACT_ANSWER = ' Answers with the changed block, `parent_id`, `slot_index`, `position` and `has_unsaved_changes` (the working copy differs from the saved content); pass `response: "tree"` for the whole tree, or call get_page_blocks.';
|
|
34
46
|
/**
|
|
35
47
|
* Resolve a (target | page_id) pair to a REST path prefix. Pages keep
|
|
36
48
|
* routing through /pages/{id}/blocks for back-compat with older callers;
|
|
@@ -64,7 +76,7 @@ export const pageBlockTools = [
|
|
|
64
76
|
},
|
|
65
77
|
{
|
|
66
78
|
name: 'add_block',
|
|
67
|
-
description: 'Insert a block into a container (page, partial, or page template). BUFFER MODEL: block mutations on pages/partials edit the unsaved DRAFT — commit_working_copy is the explicit save. With no parent_id, inserts at the top level of the container. Otherwise inserts as a child (or into a slot for slot-containers). Position defaults to "end". Slot containers (core/columns, core/tabs — container: "slots"): slot_index picks the slot (0-based; defaults to 0) and works even if the parent instance has no slots array yet; a freshly added slot container gets its slots initialised to the type\'s arity. You can also pass the whole subtree inline via block.slots: [[...],[...]]. Pass `target: { kind: "partial", id: "header" }` to drop a block into the header on every page, etc. `page_id` is the legacy shorthand.',
|
|
79
|
+
description: 'Insert a block into a container (page, partial, or page template). BUFFER MODEL: block mutations on pages/partials edit the unsaved DRAFT — commit_working_copy is the explicit save. With no parent_id, inserts at the top level of the container. Otherwise inserts as a child (or into a slot for slot-containers). Position defaults to "end". Slot containers (core/columns, core/tabs — container: "slots"): slot_index picks the slot (0-based; defaults to 0) and works even if the parent instance has no slots array yet; a freshly added slot container gets its slots initialised to the type\'s arity. You can also pass the whole subtree inline via block.slots: [[...],[...]]. Pass `target: { kind: "partial", id: "header" }` to drop a block into the header on every page, etc. `page_id` is the legacy shorthand. A `data` key that no field of the block\'s type declares (read_block_type) is rejected with 400 `unknown_field`, for the block and every child; nothing is written, and `unknown_fields[].suggestions` says where it belongs (e.g. `item_overrides.<key>` for an item-block field on a repeater or its aliases, or the closest field names).' + COMPACT_ANSWER + ' `added_id` is the new block\'s id.',
|
|
68
80
|
inputSchema: {
|
|
69
81
|
target: targetSchema.optional(),
|
|
70
82
|
page_id: z.string().optional(),
|
|
@@ -72,6 +84,7 @@ export const pageBlockTools = [
|
|
|
72
84
|
parent_id: z.string().optional().nullable(),
|
|
73
85
|
slot_index: z.number().int().min(0).optional(),
|
|
74
86
|
position: z.number().int().min(0).optional(),
|
|
87
|
+
response: responseParam,
|
|
75
88
|
version: versionParam,
|
|
76
89
|
},
|
|
77
90
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
@@ -81,18 +94,18 @@ export const pageBlockTools = [
|
|
|
81
94
|
parent_id: args.parent_id,
|
|
82
95
|
slot_index: args.slot_index,
|
|
83
96
|
position: args.position,
|
|
84
|
-
},
|
|
97
|
+
}, writeQuery(args.version, args.response));
|
|
85
98
|
return ok(res);
|
|
86
99
|
}),
|
|
87
100
|
},
|
|
88
101
|
{
|
|
89
102
|
name: 'update_block',
|
|
90
|
-
description: 'Update a block\'s data fields (shallow merge), style overrides, or responsive settings. Works on pages, partials, and page templates — use `target` to address non-page containers. Does not modify children or slots; use move/add/remove for structural changes. For appearance, prefer a named style (`data.style_id`, see list_styles) over custom_class or custom_css. From render version 2, custom_class lands on the heading or button link element itself instead of the block wrapper.',
|
|
103
|
+
description: 'Update a block\'s data fields (shallow merge), style overrides, or responsive settings. Works on pages, partials, and page templates — use `target` to address non-page containers. Does not modify children or slots; use move/add/remove for structural changes. For appearance, prefer a named style (`data.style_id`, see list_styles) over custom_class or custom_css. From render version 2, custom_class lands on the heading or button link element itself instead of the block wrapper. Send values in the field\'s type (numbers as numbers); a value the block will not render comes back in `warnings` (`field_type_mismatch`) with its path. A `null` value removes that key from data (the field renders its default); use it to clean up a key stored by mistake. A written key that no field of the block\'s type declares is rejected with 400 `unknown_field` and nothing is written; `unknown_fields[].suggestions` says where it belongs: on core/repeater and its aliases (core/testimonials, core/page_list, ...) a field of the item block goes in `item_overrides.<key>`, otherwise the closest field names.' + COMPACT_ANSWER,
|
|
91
104
|
inputSchema: {
|
|
92
105
|
target: targetSchema.optional(),
|
|
93
106
|
page_id: z.string().optional(),
|
|
94
107
|
block_id: z.string(),
|
|
95
|
-
data: z.record(z.unknown()).optional(),
|
|
108
|
+
data: z.record(z.unknown()).optional().describe('Field values to merge into block.data. null removes the key.'),
|
|
96
109
|
style_overrides: z.object({
|
|
97
110
|
spacing_before: z.string().optional(),
|
|
98
111
|
spacing_after: z.string().optional(),
|
|
@@ -100,6 +113,7 @@ export const pageBlockTools = [
|
|
|
100
113
|
custom_class: z.string().optional(),
|
|
101
114
|
html_id: z.string().optional(),
|
|
102
115
|
}).optional(),
|
|
116
|
+
response: responseParam,
|
|
103
117
|
version: versionParam,
|
|
104
118
|
},
|
|
105
119
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
@@ -108,13 +122,13 @@ export const pageBlockTools = [
|
|
|
108
122
|
block_id: args.block_id,
|
|
109
123
|
data: args.data,
|
|
110
124
|
style_overrides: args.style_overrides,
|
|
111
|
-
},
|
|
125
|
+
}, writeQuery(args.version, args.response));
|
|
112
126
|
return ok(res);
|
|
113
127
|
}),
|
|
114
128
|
},
|
|
115
129
|
{
|
|
116
130
|
name: 'move_block',
|
|
117
|
-
description: 'Reparent or reorder a block inside its container. target_parent_id=null moves to top level. For slot containers, target_slot_index picks the slot. Cycles (moving a block into its own descendant) are rejected. Works for pages, partials, and templates.',
|
|
131
|
+
description: 'Reparent or reorder a block inside its container. target_parent_id=null moves to top level. For slot containers, target_slot_index picks the slot. Cycles (moving a block into its own descendant) are rejected. Works for pages, partials, and templates.' + COMPACT_ANSWER + ' The location is where the block now sits.',
|
|
118
132
|
inputSchema: {
|
|
119
133
|
target: targetSchema.optional(),
|
|
120
134
|
page_id: z.string().optional(),
|
|
@@ -122,6 +136,7 @@ export const pageBlockTools = [
|
|
|
122
136
|
target_parent_id: z.string().optional().nullable(),
|
|
123
137
|
target_slot_index: z.number().int().min(0).optional(),
|
|
124
138
|
target_position: z.number().int().min(0).optional(),
|
|
139
|
+
response: responseParam,
|
|
125
140
|
version: versionParam,
|
|
126
141
|
},
|
|
127
142
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
@@ -131,61 +146,61 @@ export const pageBlockTools = [
|
|
|
131
146
|
target_parent_id: args.target_parent_id,
|
|
132
147
|
target_slot_index: args.target_slot_index,
|
|
133
148
|
target_position: args.target_position,
|
|
134
|
-
},
|
|
149
|
+
}, writeQuery(args.version, args.response));
|
|
135
150
|
return ok(res);
|
|
136
151
|
}),
|
|
137
152
|
},
|
|
138
153
|
{
|
|
139
154
|
name: 'remove_block',
|
|
140
|
-
description: 'Remove a block and everything inside it from its container. Works for pages, partials, and templates.',
|
|
155
|
+
description: 'Remove a block and everything inside it from its container. Works for pages, partials, and templates. Answers with `removed_id`, the `parent_id`, `slot_index` and `position` it was removed from and `has_unsaved_changes`; pass `response: "tree"` for the whole remaining tree.',
|
|
141
156
|
inputSchema: {
|
|
142
157
|
target: targetSchema.optional(),
|
|
143
158
|
page_id: z.string().optional(),
|
|
144
159
|
block_id: z.string(),
|
|
160
|
+
response: responseParam,
|
|
145
161
|
version: versionParam,
|
|
146
162
|
},
|
|
147
163
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
148
164
|
const path = pathFor(args.target, args.page_id);
|
|
149
|
-
const
|
|
150
|
-
if (args.version)
|
|
151
|
-
query.version = args.version;
|
|
152
|
-
const res = await client.del(siteId, path, query);
|
|
165
|
+
const res = await client.del(siteId, path, { block_id: args.block_id, ...writeQuery(args.version, args.response) });
|
|
153
166
|
return ok(res);
|
|
154
167
|
}),
|
|
155
168
|
},
|
|
156
169
|
{
|
|
157
170
|
name: 'duplicate_block',
|
|
158
|
-
description: 'Clone a block (subtree included) and insert the copy directly after the original within the same container. Returns the duplicate\'s new id. Useful for "add another card to this feature grid" — duplicate the existing one and then `update_block` on the new id to change its data. Works for pages, partials, and templates.',
|
|
171
|
+
description: 'Clone a block (subtree included) and insert the copy directly after the original within the same container. Returns the duplicate\'s new id. Useful for "add another card to this feature grid" — duplicate the existing one and then `update_block` on the new id to change its data. Works for pages, partials, and templates.' + COMPACT_ANSWER + ' `duplicate_id` is the copy\'s id; `block` is the copy.',
|
|
159
172
|
inputSchema: {
|
|
160
173
|
target: targetSchema.optional(),
|
|
161
174
|
page_id: z.string().optional(),
|
|
162
175
|
block_id: z.string(),
|
|
176
|
+
response: responseParam,
|
|
163
177
|
version: versionParam,
|
|
164
178
|
},
|
|
165
179
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
166
180
|
const path = pathFor(args.target, args.page_id);
|
|
167
181
|
const res = await client.post(siteId, `${path}/duplicate`, {
|
|
168
182
|
block_id: args.block_id,
|
|
169
|
-
},
|
|
183
|
+
}, writeQuery(args.version, args.response));
|
|
170
184
|
return ok(res);
|
|
171
185
|
}),
|
|
172
186
|
},
|
|
173
187
|
{
|
|
174
188
|
name: 'set_block_responsive',
|
|
175
|
-
description: 'Set a per-breakpoint value on one responsive field of a block (in any container — page, partial, or template). The renderer reads { mobile, tablet, laptop, desktop, wide } objects on any field marked responsive in the BlockType schema (use read_block_type to see which). Mobile-first inheritance: missing breakpoints inherit upward. Pass a scalar value to clear responsive back to a single value. Example: setting `cols` on a feature_grid to { mobile: 1, tablet: 2, desktop: 3 } renders 1-col on phones, 2-col on tablets, 3-col on desktop+.',
|
|
189
|
+
description: 'Set a per-breakpoint value on one responsive field of a block (in any container — page, partial, or template). The renderer reads { mobile, tablet, laptop, desktop, wide } objects on any field marked responsive in the BlockType schema (use read_block_type to see which). Mobile-first inheritance: missing breakpoints inherit upward. Pass a scalar value to clear responsive back to a single value. Example: setting `cols` on a feature_grid to { mobile: 1, tablet: 2, desktop: 3 } renders 1-col on phones, 2-col on tablets, 3-col on desktop+. A field the block type does not declare is rejected with 400 `unknown_field`.' + COMPACT_ANSWER,
|
|
176
190
|
inputSchema: {
|
|
177
191
|
target: targetSchema.optional(),
|
|
178
192
|
page_id: z.string().optional(),
|
|
179
193
|
block_id: z.string(),
|
|
180
194
|
field: z.string().describe('Field name (must be marked responsive in the BlockType schema).'),
|
|
181
195
|
value: z.any().describe('Scalar (applies to all BPs) or { mobile?, tablet?, laptop?, desktop?, wide? }.'),
|
|
196
|
+
response: responseParam,
|
|
182
197
|
version: versionParam,
|
|
183
198
|
},
|
|
184
199
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
185
200
|
const path = pathFor(args.target, args.page_id);
|
|
186
201
|
const res = await client.post(siteId, `${path}/responsive`, {
|
|
187
202
|
block_id: args.block_id, field: args.field, value: args.value,
|
|
188
|
-
},
|
|
203
|
+
}, writeQuery(args.version, args.response));
|
|
189
204
|
return ok(res);
|
|
190
205
|
}),
|
|
191
206
|
},
|
package/dist/tools/pages.js
CHANGED
|
@@ -75,6 +75,10 @@ export const pageTools = [
|
|
|
75
75
|
'and seeds the tree with a heading + prose block so the editor is never blank. ' +
|
|
76
76
|
'Pass html_content (or content_mode="html") to opt into raw-HTML mode instead. ' +
|
|
77
77
|
'Slug is derived from the title when omitted. Default status is "draft". ' +
|
|
78
|
+
'Address conflicts: an explicit slug or path that another page already uses (drafts and unsaved drafts included) ' +
|
|
79
|
+
'fails with 409 { code: "slug_in_use" | "path_in_use", details: { page_id, path } } — edit that page or choose another slug; ' +
|
|
80
|
+
'the address is never changed silently. Only a title-derived slug is numbered (e.g. "tack" → "tack-2"), and the response then ' +
|
|
81
|
+
'carries warnings: [{ code: "slug_adjusted", requested, slug, path, conflicting_page_id }]. ' +
|
|
78
82
|
'Homepage convention: pass slug="" (empty string) or omit slug and set title to "Home"; ' +
|
|
79
83
|
'the server stores it under id "home" with slug "". ' +
|
|
80
84
|
'Slug must be a single path segment (no slashes). For nested URLs like ' +
|
|
@@ -88,7 +92,7 @@ export const pageTools = [
|
|
|
88
92
|
title: z.string().min(1),
|
|
89
93
|
content_type: z.string().optional().describe('Content type ID; defaults to page.'),
|
|
90
94
|
fields: z.record(z.unknown()).optional().describe('Custom field values defined by the content type.'),
|
|
91
|
-
slug: z.string().optional().describe('URL slug — single path segment, no slashes (e.g. "about", "kontakt"). Empty string "" = homepage. For nested URLs set the `path` field explicitly — `slug` stays a leaf id.'),
|
|
95
|
+
slug: z.string().optional().describe('URL slug — single path segment, no slashes (e.g. "about", "kontakt"). Empty string "" = homepage. For nested URLs set the `path` field explicitly — `slug` stays a leaf id. Already in use → 409 slug_in_use naming the existing page; omit it to derive one from the title (numbered with a slug_adjusted warning on conflict).'),
|
|
92
96
|
path: z.string().optional().describe('Optional explicit URL path for nested pages (e.g. "/erbjudanden/sommar-2026"). When set, takes precedence over slug for routing. Must start with "/", lowercase a-z/0-9/-/_/ only, no "..", no "//", no trailing slash. Slug is still required as the leaf id but two pages CAN share a slug under different paths.'),
|
|
93
97
|
content_mode: z.enum(['blocks', 'html']).optional().describe('Default "blocks". "blocks" stores a Block[] tree (the modern default — supports the full ~40-block library, page templates, and the responsive system). "html" stores raw markup in html_content (legacy path, still fully supported for imported content or hand-written HTML). Passing html_content without content_mode also opts into "html".'),
|
|
94
98
|
html_content: z.string().optional().describe('Body HTML — only used when content_mode="html".'),
|
|
@@ -224,11 +228,11 @@ export const pageTools = [
|
|
|
224
228
|
},
|
|
225
229
|
{
|
|
226
230
|
name: 'clone_page',
|
|
227
|
-
description: 'Duplicate an existing page under a new title + slug. Use this when you want a near-copy of an existing page as the starting point (e.g. duplicate "Privatflytt" → "Privatflytt Härnösand"). The new page is created as a draft regardless of the source\'s status. Returns the created page.',
|
|
231
|
+
description: 'Duplicate an existing page under a new title + slug. Use this when you want a near-copy of an existing page as the starting point (e.g. duplicate "Privatflytt" → "Privatflytt Härnösand"). The new page is created as a draft regardless of the source\'s status. Returns the created page. Same address rule as create_page: a slug you pass that is already in use fails with 409 slug_in_use (details: { page_id, path }); a slug derived from the title is numbered and reported in warnings (code slug_adjusted).',
|
|
228
232
|
inputSchema: {
|
|
229
233
|
source_page_id: z.string(),
|
|
230
234
|
title: z.string().min(1).describe('Title for the new page.'),
|
|
231
|
-
slug: z.string().optional().describe('Slug for the new page. Omit to
|
|
235
|
+
slug: z.string().optional().describe('Slug for the new page. Omit to derive it from the title. A slug already in use is refused (409 slug_in_use), never changed.'),
|
|
232
236
|
version: versionParam,
|
|
233
237
|
},
|
|
234
238
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
@@ -268,7 +272,7 @@ export const pageTools = [
|
|
|
268
272
|
image_sizes_default: src.image_sizes_default,
|
|
269
273
|
status: 'draft',
|
|
270
274
|
};
|
|
271
|
-
if (args.slug)
|
|
275
|
+
if (args.slug !== undefined)
|
|
272
276
|
body.slug = args.slug;
|
|
273
277
|
if (typeof src.path === 'string' && src.path) {
|
|
274
278
|
// Keep an explicit route's directory, never its old final segment.
|
|
@@ -282,7 +286,9 @@ export const pageTools = [
|
|
|
282
286
|
segments.pop();
|
|
283
287
|
body.path = '/' + [...segments, slug.replace(/^\/+|\/+$/g, '')].join('/');
|
|
284
288
|
}
|
|
285
|
-
// 3. Create.
|
|
289
|
+
// 3. Create. An explicit slug or path that is taken fails with 409
|
|
290
|
+
// (slug_in_use / path_in_use); a title-derived slug is numbered and
|
|
291
|
+
// reported in `warnings`.
|
|
286
292
|
const created = await client.post(siteId, 'pages', body, v(args.version));
|
|
287
293
|
return ok(created);
|
|
288
294
|
}),
|
package/dist/tools/settings.js
CHANGED
|
@@ -76,8 +76,8 @@ export const settingsTools = [
|
|
|
76
76
|
}).strict().nullable().optional().describe('Organization schema.org JSON-LD emitted on every page. Replaces the stored value as a whole; null (or all-empty) clears it.'),
|
|
77
77
|
staging_url: z.string().nullable().optional().describe('URL of a staging environment for this site, reported as urls.staging. Stored on the Site, not per version. Trailing slashes are dropped; empty string or null clears.'),
|
|
78
78
|
render_version: z.number().int().min(1).optional().describe('Platform render version. Platform output changes ship as new versions so existing sites never change look on their own. Upgrade only after previewing (get_preview_link render_version) and with the user\'s approval; the tr-upgrade-rendering skill compares every page. Lowering it returns to an earlier version.'),
|
|
79
|
-
colors: z.record(z.string()).optional(),
|
|
80
|
-
fonts: z.record(z.unknown()).optional(),
|
|
79
|
+
colors: z.record(z.string().nullable()).optional().describe('Palette: primary, secondary, accent, background, surface, text, text_light (shallow-merged). Optional on_primary, on_secondary, on_accent set the text colour on that theme colour (buttons, badges, tabs, call-to-action sections, styles using the on_* tokens) as a hex colour such as "#ffffff"; null returns to the automatic black or white (chosen by APCA from render version 8, by the WCAG 2 ratio before). A chosen on_* colour applies on every render version. The response lists `on_colors` with each one\'s APCA Lc and WCAG 2 ratio; a choice below APCA Lc 60 (button text, 16px/600) is kept and returned as a warning. Prefer the automatic choice unless the brand specifies a colour.'),
|
|
80
|
+
fonts: z.record(z.unknown()).optional().describe('heading, body (Google Fonts family or "system"), size_base (px) and smoothing: "auto" (browser default) or "antialiased" (thinner text on macOS, for light text on dark backgrounds); null clears smoothing. Unset smoothing is auto from render version 6.'),
|
|
81
81
|
contact: z
|
|
82
82
|
.object({
|
|
83
83
|
email: z.string().optional(),
|
package/dist/tools/styles.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ok, withErrorBoundary, versionParam } from './helpers.js';
|
|
|
7
7
|
function v(version) {
|
|
8
8
|
return version ? { version } : undefined;
|
|
9
9
|
}
|
|
10
|
-
const COLOR_HELP = 'A palette token (primary, secondary, accent, background, surface, text, text_light),
|
|
10
|
+
const COLOR_HELP = 'A palette token (primary, secondary, accent, background, surface, text, text_light), the text colour for a palette background (on_primary, on_secondary, on_accent: the site\'s colors.on_* when set, else black or white, whichever reads better), or a hex/rgb/hsl colour. Prefer tokens so a palette change flows through.';
|
|
11
11
|
const length = z.string().describe('CSS length: px, rem, em, %, vw, ch, or clamp()/min()/max()');
|
|
12
12
|
const color = z.string().describe(COLOR_HELP);
|
|
13
13
|
const propsSchema = z.object({
|
|
@@ -55,13 +55,13 @@ const styleFields = {
|
|
|
55
55
|
export const styleTools = [
|
|
56
56
|
{
|
|
57
57
|
name: 'list_styles',
|
|
58
|
-
description: 'List the site\'s named style library: element roles (body, h1–h6, link) that style every matching element, and the styles blocks select with `style_id`. Also returns missing_standard_roles
|
|
58
|
+
description: 'List the site\'s named style library: element roles (body, h1–h6, link) that style every matching element, and the styles blocks select with `style_id`. Also returns missing_standard_roles, contrast/library problems and readability warnings (both APCA Lc and WCAG 2 ratio). READ THIS BEFORE STYLING ANY PAGE: reuse an existing style for a recurring look (eyebrows, leads, card titles, buttons, section spacing) instead of per-block values, raw HTML classes or page CSS.',
|
|
59
59
|
inputSchema: { version: versionParam },
|
|
60
60
|
handler: withErrorBoundary(async (args, { client, siteId }) => ok(await client.get(siteId, 'styles', v(args.version)))),
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
name: 'create_style',
|
|
64
|
-
description: 'Create a named style. Do this whenever a look could recur — an eyebrow, a lead paragraph, a card title, a quote, a button variant, a section rhythm — then apply it with the block\'s `style_id` field. Only a clearly unique one-off may use block settings instead. Set values for phones in `base` and grow them in `at.tablet`/`at.desktop`. Text
|
|
64
|
+
description: 'Create a named style. Do this whenever a look could recur — an eyebrow, a lead paragraph, a card title, a quote, a button variant, a section rhythm — then apply it with the block\'s `style_id` field. Only a clearly unique one-off may use block settings instead. Set values for phones in `base` and grow them in `at.tablet`/`at.desktop`. Text contrast against its background is measured with APCA by use, size and weight (body text Lc 75; secondary/small text Lc 60; headings, eyebrows and buttons Lc 60 from 16px at weight 600+, Lc 45 from 24px bold or 36px; smaller or lighter non-body text Lc 75) and with the WCAG 2 ratio. Text that fails both is refused; text below its APCA level that meets WCAG 2 AA (4.5:1, 3:1 for ≥24px or bold ≥18.7px) is saved and returned in `warnings`. Never light grey on white.',
|
|
65
65
|
inputSchema: {
|
|
66
66
|
id: z.string().regex(/^[a-z][a-z0-9-]{0,47}$/).describe('Stable slug; the CSS class becomes s-<id>. Cannot change later.'),
|
|
67
67
|
...styleFields,
|
|
@@ -101,7 +101,7 @@ export const styleTools = [
|
|
|
101
101
|
},
|
|
102
102
|
{
|
|
103
103
|
name: 'apply_standard_styles',
|
|
104
|
-
description: 'Add the standard styles the site is missing (body, H1–H6, link, lead, eyebrow, small text, quote, primary/secondary button, section), with considered sizes and spacing for phones, tablets and desktops. The natural first step when building a new site, before pages: then adjust them to the brand (fonts, colours, scale) with update_style. New sites already have them. overwrite:true resets the standard roles to the defaults and changes the site\'s look — ask first.',
|
|
104
|
+
description: 'Add the standard styles the site is missing (body, H1–H6, link, lead, eyebrow, small text, quote, primary/secondary button, section), with considered sizes and spacing for phones, tablets and desktops. The natural first step when building a new site, before pages: then adjust them to the brand (fonts, colours, scale) with update_style. New sites already have them. overwrite:true resets the standard roles to the defaults and changes the site\'s look — ask first. A standard style whose palette colour is unreadable on the background is added with the body text colour instead; `adjusted` lists those and `warnings` says what changed, with the measures — tell the user.',
|
|
105
105
|
inputSchema: { overwrite: z.boolean().optional(), version: versionParam },
|
|
106
106
|
handler: withErrorBoundary(async (args, { client, siteId }) => ok(await client.post(siteId, 'styles/standard', { overwrite: args.overwrite === true }, v(args.version)))),
|
|
107
107
|
},
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
package/skills/tr-brand.md
CHANGED
|
@@ -51,6 +51,14 @@ A Typeroll site uses 7 color tokens:
|
|
|
51
51
|
| `text` | Body copy. | ≥4.5:1 contrast ratio on `background`. |
|
|
52
52
|
| `text_light` | Secondary labels, captions, placeholders. | ≥3:1 on `background`. |
|
|
53
53
|
|
|
54
|
+
Text on `primary`, `secondary` and `accent` (buttons, badges, tabs,
|
|
55
|
+
call-to-action sections, the `on_*` style tokens) is black or white
|
|
56
|
+
automatically, chosen by APCA from render version 8. When the brand
|
|
57
|
+
specifies it, set `colors.on_primary`, `colors.on_secondary` or
|
|
58
|
+
`colors.on_accent` (a hex colour; `null` returns to automatic). The response
|
|
59
|
+
lists `on_colors` with each one's APCA Lc and WCAG 2 ratio: button text needs
|
|
60
|
+
Lc 60, body text Lc 75. Do not compensate with custom CSS.
|
|
61
|
+
|
|
54
62
|
**Palette recipes by mood:**
|
|
55
63
|
|
|
56
64
|
*Nordic / minimal:*
|
package/skills/tr-migrate-wp.md
CHANGED
|
@@ -73,6 +73,9 @@ Then the ordinary preconditions:
|
|
|
73
73
|
appearance unless a redesign is explicitly requested.
|
|
74
74
|
- If the target already has content, you must NOT clobber it — always
|
|
75
75
|
`list_pages` first and only write to slugs that don't already exist.
|
|
76
|
+
Pass the slug explicitly: `create_page` then refuses an address that is
|
|
77
|
+
already in use (409 `slug_in_use` naming the existing page) instead of
|
|
78
|
+
numbering it.
|
|
76
79
|
|
|
77
80
|
## Recipe
|
|
78
81
|
|
|
@@ -62,6 +62,41 @@ behavior or other semantics unsupported by the chosen block: record the gap
|
|
|
62
62
|
and use a supported composition or stop for native support.
|
|
63
63
|
Do not apply a template to hundreds of Pages until its prototype passes.
|
|
64
64
|
|
|
65
|
+
## Report platform gaps, do not patch them
|
|
66
|
+
|
|
67
|
+
Matching the source sometimes needs something the platform does not offer.
|
|
68
|
+
Never close that with site or page `custom_css`, raw HTML or a generic custom
|
|
69
|
+
block: the next site hits the same gap and the workaround breaks on the next
|
|
70
|
+
Core change. Record it and report it instead. Check these five causes first,
|
|
71
|
+
because each has looked like a site problem:
|
|
72
|
+
|
|
73
|
+
1. **A platform default no setting reaches.** Compare computed text rendering
|
|
74
|
+
and base styles on `body`, links and headings (`-webkit-font-smoothing`,
|
|
75
|
+
`line-height`, `text-decoration`) with the source. If the difference comes
|
|
76
|
+
from Typeroll's base CSS, check Site settings and the render versions first
|
|
77
|
+
(`read_site_settings` → `render.upgrades`).
|
|
78
|
+
2. **A replaced control ignores the block's settings.** A capability can swap a
|
|
79
|
+
field for a provider element (address suggestions). Compare that control
|
|
80
|
+
with a plain field in the same block: border, radius, height, background,
|
|
81
|
+
text colour, font, placeholder, icon and colour scheme in light and dark mode.
|
|
82
|
+
3. **A missing part.** The source has a part (icon, badge, second label) the
|
|
83
|
+
block has no field for. Check `read_block_type` for a field before
|
|
84
|
+
concluding it is missing.
|
|
85
|
+
4. **A value that is stored and ignored.** Read every write response's
|
|
86
|
+
`warnings` (`field_type_mismatch`, `unknown_style_override`): a wrong type or
|
|
87
|
+
key is saved and never rendered. Measure the computed result, not the
|
|
88
|
+
read-back.
|
|
89
|
+
5. **Preview differs from the published page.** A setting that shows in preview
|
|
90
|
+
but not in a fresh hosted build is a publication gap; report both URLs.
|
|
91
|
+
|
|
92
|
+
Report each gap with: site ID, Organization, Core version and render version;
|
|
93
|
+
source and target URL; viewport (actual `innerWidth`), browser and DPR; the
|
|
94
|
+
block ID and type or the setting; source and target computed values; what is
|
|
95
|
+
missing, ignored or wrong; the proposed setting or fix; and acceptance
|
|
96
|
+
criteria a reviewer can measure. State that no workaround CSS is in place.
|
|
97
|
+
Mark the affected recipe `waiting_for_native_support`, continue independent
|
|
98
|
+
work, and verify against the source again after the release.
|
|
99
|
+
|
|
65
100
|
## Separate files, addresses and business behavior
|
|
66
101
|
|
|
67
102
|
Inventory both file bytes and every discovered historical asset URL, including
|
package/skills/tr-new-site.md
CHANGED
|
@@ -140,7 +140,9 @@ Set the site's look as named styles before building any page:
|
|
|
140
140
|
`apply_standard_styles`.
|
|
141
141
|
2. Adjust them to the brand with `update_style`: the font, the type scale and
|
|
142
142
|
spacing for `base` (phones) and `at.tablet`/`at.desktop`, and colours from
|
|
143
|
-
palette tokens. Keep text
|
|
143
|
+
palette tokens. Keep text readable: contrast is checked with APCA and
|
|
144
|
+
WCAG 2; text that fails both is refused, and text below its APCA level
|
|
145
|
+
comes back as a warning.
|
|
144
146
|
3. Add a named style for every look the design repeats: a card title, a price
|
|
145
147
|
note, a highlighted section, a CTA button variant. Use the site's language
|
|
146
148
|
for names.
|