@qikdev/mcp 6.12.0 → 6.14.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/build/bin/cli.js +45 -48
- package/build/bin/cli.js.map +1 -1
- package/build/src/config.d.ts +2 -0
- package/build/src/config.d.ts.map +1 -1
- package/build/src/config.js +68 -6
- package/build/src/config.js.map +1 -1
- package/build/src/tools/checkin.d.ts.map +1 -1
- package/build/src/tools/checkin.js +29 -24
- package/build/src/tools/checkin.js.map +1 -1
- package/build/src/tools/content.d.ts.map +1 -1
- package/build/src/tools/content.js +26 -21
- package/build/src/tools/content.js.map +1 -1
- package/build/src/tools/create.d.ts.map +1 -1
- package/build/src/tools/create.js +18 -12
- package/build/src/tools/create.js.map +1 -1
- package/build/src/tools/interface-builder.d.ts +5 -0
- package/build/src/tools/interface-builder.d.ts.map +1 -1
- package/build/src/tools/interface-builder.js +182 -27
- package/build/src/tools/interface-builder.js.map +1 -1
- package/build/src/tools/update.d.ts.map +1 -1
- package/build/src/tools/update.js +29 -12
- package/build/src/tools/update.js.map +1 -1
- package/build/src/tools/utils.d.ts +6 -0
- package/build/src/tools/utils.d.ts.map +1 -1
- package/build/src/tools/utils.js +26 -0
- package/build/src/tools/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigManager } from "../config.js";
|
|
2
|
+
import { withConcurrencyLimit } from "./utils.js";
|
|
2
3
|
export const getContentTool = {
|
|
3
4
|
name: "get_content",
|
|
4
5
|
description: `Get a single content item by ID.
|
|
@@ -88,18 +89,20 @@ export async function handleDeleteContent(args) {
|
|
|
88
89
|
if (!config) {
|
|
89
90
|
throw new Error('Qik MCP server not configured. Run setup first.');
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
const data = await withConcurrencyLimit(async () => {
|
|
93
|
+
const response = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/${args.id}`, {
|
|
94
|
+
method: 'DELETE',
|
|
95
|
+
headers: {
|
|
96
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
const errorText = await response.text();
|
|
102
|
+
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
103
|
+
}
|
|
104
|
+
return await response.json();
|
|
97
105
|
});
|
|
98
|
-
if (!response.ok) {
|
|
99
|
-
const errorText = await response.text();
|
|
100
|
-
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
101
|
-
}
|
|
102
|
-
const data = await response.json();
|
|
103
106
|
return {
|
|
104
107
|
content: [{
|
|
105
108
|
type: "text",
|
|
@@ -123,17 +126,19 @@ export async function handleRestoreContent(args) {
|
|
|
123
126
|
if (!config) {
|
|
124
127
|
throw new Error('Qik MCP server not configured. Run setup first.');
|
|
125
128
|
}
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
const data = await withConcurrencyLimit(async () => {
|
|
130
|
+
const response = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/${args.id}/restore`, {
|
|
131
|
+
headers: {
|
|
132
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
133
|
+
'Content-Type': 'application/json',
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
if (!response.ok) {
|
|
137
|
+
const errorText = await response.text();
|
|
138
|
+
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
139
|
+
}
|
|
140
|
+
return await response.json();
|
|
131
141
|
});
|
|
132
|
-
if (!response.ok) {
|
|
133
|
-
const errorText = await response.text();
|
|
134
|
-
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
135
|
-
}
|
|
136
|
-
const data = await response.json();
|
|
137
142
|
return {
|
|
138
143
|
content: [{
|
|
139
144
|
type: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/tools/content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/tools/content.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE;;+CAEgC;IAC7C,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qBAAqB;aACnC;SACF;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE;;uDAEwC;IACrD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+BAA+B;aAC7C;SACF;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAS;IACtC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;sDAEuC;IACpD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,EAAE,EAAE;gBACF,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAC9C;SACF;QACD,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAoB;IACz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IAAI,EAAE,CAAC,CAAC;iBACxD,CAAC;SACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/tools/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAK1D,eAAO,MAAM,iBAAiB,EAAE,IAkD/B,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA6DhH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConfigManager } from "../config.js";
|
|
2
2
|
import { validateAndCoercePayload } from "./schema-validator.js";
|
|
3
|
+
import { withConcurrencyLimit } from "./utils.js";
|
|
3
4
|
export const createContentTool = {
|
|
4
5
|
name: "create_content",
|
|
5
6
|
description: `Create new content items in Qik.
|
|
@@ -19,6 +20,9 @@ Pass \`tags: ['green', 'red']\` inside fields as string names and the backend au
|
|
|
19
20
|
**Scope:**
|
|
20
21
|
Set \`meta: { scopes: ['scopeId'] }\` inside fields to specify which scope(s) the content belongs to.
|
|
21
22
|
|
|
23
|
+
**Bulk Operations:**
|
|
24
|
+
When performing bulk creates (e.g., importing many items), requests are automatically rate-limited to 3 concurrent operations to avoid hitting backend rate limits. You do not need to manage this yourself.
|
|
25
|
+
|
|
22
26
|
**Example:**
|
|
23
27
|
\`\`\`json
|
|
24
28
|
{
|
|
@@ -71,19 +75,21 @@ export async function handleCreateContent(args) {
|
|
|
71
75
|
}
|
|
72
76
|
// Coerce payload using content type schema (fixes stringified JSON from LLMs)
|
|
73
77
|
const validation = await validateAndCoercePayload(typeKey, rawPayload);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const data = await withConcurrencyLimit(async () => {
|
|
79
|
+
const response = await fetch(`${config.apiUrl || 'https://api.qik.dev'}/content/${typeKey}/create`, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: {
|
|
82
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
83
|
+
'Content-Type': 'application/json',
|
|
84
|
+
},
|
|
85
|
+
body: JSON.stringify(validation.coercedPayload)
|
|
86
|
+
});
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
const errorText = await response.text();
|
|
89
|
+
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
90
|
+
}
|
|
91
|
+
return await response.json();
|
|
81
92
|
});
|
|
82
|
-
if (!response.ok) {
|
|
83
|
-
const errorText = await response.text();
|
|
84
|
-
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
85
|
-
}
|
|
86
|
-
const data = await response.json();
|
|
87
93
|
return {
|
|
88
94
|
content: [{
|
|
89
95
|
type: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/tools/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,CAAC,MAAM,iBAAiB,GAAS;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
|
|
73
|
+
contextVisibility?: any;
|
|
73
74
|
}): Promise<{
|
|
74
75
|
content: Array<{
|
|
75
76
|
type: string;
|
|
@@ -87,6 +88,7 @@ export declare function handleUpdateInterfaceRoute(args: {
|
|
|
87
88
|
title?: string;
|
|
88
89
|
description?: string;
|
|
89
90
|
};
|
|
91
|
+
contextVisibility?: any;
|
|
90
92
|
}): Promise<{
|
|
91
93
|
content: Array<{
|
|
92
94
|
type: string;
|
|
@@ -109,6 +111,8 @@ export declare function handleAddInterfaceSection(args: {
|
|
|
109
111
|
title?: string;
|
|
110
112
|
model?: any;
|
|
111
113
|
componentVersion?: string;
|
|
114
|
+
themes?: string[];
|
|
115
|
+
contextVisibility?: any;
|
|
112
116
|
}): Promise<{
|
|
113
117
|
content: Array<{
|
|
114
118
|
type: string;
|
|
@@ -122,6 +126,7 @@ export declare function handleUpdateInterfaceSection(args: {
|
|
|
122
126
|
title?: string;
|
|
123
127
|
disabled?: boolean;
|
|
124
128
|
themes?: string[];
|
|
129
|
+
contextVisibility?: any;
|
|
125
130
|
}): Promise<{
|
|
126
131
|
content: Array<{
|
|
127
132
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface-builder.d.ts","sourceRoot":"","sources":["../../../src/tools/interface-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAgB1D,UAAU,aAAa;IACrB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,C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,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAiC9D;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAoBzJ"}
|
|
@@ -321,25 +321,35 @@ function summarizeInterface(data) {
|
|
|
321
321
|
const components = data.components || [];
|
|
322
322
|
lines.push(`## Custom Components (${components.length})`);
|
|
323
323
|
for (const comp of components) {
|
|
324
|
-
|
|
324
|
+
const hasProps = comp.js && comp.js.includes('props');
|
|
325
|
+
const propsHint = hasProps ? ' (has props)' : '';
|
|
326
|
+
lines.push(`- \`<${comp.name}/>\` - ${comp.title || comp.name}${propsHint}`);
|
|
325
327
|
}
|
|
326
328
|
lines.push('');
|
|
327
329
|
// Services
|
|
328
330
|
const services = data.services || [];
|
|
329
331
|
lines.push(`## Services (${services.length})`);
|
|
332
|
+
lines.push(`Access via \`this.$sdk.app.services.<name>\` in any component.`);
|
|
330
333
|
for (const svc of services) {
|
|
331
|
-
lines.push(`- **${svc.title || svc.name}** (
|
|
334
|
+
lines.push(`- **${svc.title || svc.name}** (\`${svc.name}\`)`);
|
|
332
335
|
}
|
|
333
336
|
lines.push('');
|
|
334
337
|
// Styles
|
|
335
338
|
const styles = data.styles || {};
|
|
336
339
|
const hasPre = styles.pre && styles.pre.trim().length > 0;
|
|
337
340
|
const hasPost = styles.post && styles.post.trim().length > 0;
|
|
338
|
-
const
|
|
341
|
+
const themes = styles.themes || [];
|
|
339
342
|
lines.push(`## Styles`);
|
|
340
343
|
lines.push(`- Pre-SCSS: ${hasPre ? 'yes' : 'none'}`);
|
|
341
344
|
lines.push(`- Post-SCSS: ${hasPost ? 'yes' : 'none'}`);
|
|
342
|
-
lines.push(`- Themes: ${
|
|
345
|
+
lines.push(`- Themes: ${themes.length}`);
|
|
346
|
+
if (themes.length > 0) {
|
|
347
|
+
lines.push('');
|
|
348
|
+
lines.push('Apply themes to sections via their `themes` array using the UUID:');
|
|
349
|
+
for (const theme of themes) {
|
|
350
|
+
lines.push(` - **${theme.title}** (uuid: \`${theme.uuid}\`)`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
343
353
|
return lines.join('\n');
|
|
344
354
|
}
|
|
345
355
|
function formatSectionDetail(section) {
|
|
@@ -395,9 +405,28 @@ export const createInterfaceTool = {
|
|
|
395
405
|
name: "create_interface",
|
|
396
406
|
description: `Create a new interface (website/app).
|
|
397
407
|
|
|
398
|
-
An interface is a visual page builder document containing routes, sections, menus, components, and styles.
|
|
408
|
+
An interface is a visual page builder document containing routes, sections, menus, components, services, themes, and styles.
|
|
409
|
+
|
|
410
|
+
## Recommended Build Workflow
|
|
411
|
+
|
|
412
|
+
Build interfaces in this order for best results:
|
|
413
|
+
|
|
414
|
+
1. **Create the interface** (this tool)
|
|
415
|
+
2. **Define services** (\`set_interface_service\`) — Shared state and data loading singletons. Create services for fetching content, managing auth state, or holding business details. Components and sections access these via \`this.$sdk.app.services.<name>\`.
|
|
416
|
+
3. **Define custom components** (\`set_interface_custom_component\`) — Reusable UI elements (cards, headers, CTAs) with props. Use these in sections instead of duplicating code.
|
|
417
|
+
4. **Define themes** (\`set_interface_styles\`) — Reusable scoped CSS blocks (e.g., "Primary", "Dark"). Apply to sections via their \`themes\` array so you style consistently without repeating CSS.
|
|
418
|
+
5. **Create menus** (\`set_interface_menu\`) — Navigation menus that reference routes by name. Support auth-based visibility per item.
|
|
419
|
+
6. **Set layout** (\`set_interface_layout\`) — Optionally use a custom component as the page layout wrapper.
|
|
420
|
+
7. **Add routes** (\`add_interface_route\`) — Pages with paths. Use folders for grouping.
|
|
421
|
+
8. **Add sections** (\`add_interface_section\`) — Place marketplace components into routes/header/footer. Prefer dedicated components (Basic Text, Basic Image, Basic Form, Dynamic List, etc.) over Custom Code blocks.
|
|
422
|
+
9. **Publish** (\`publish_interface\`)
|
|
399
423
|
|
|
400
|
-
|
|
424
|
+
**IMPORTANT:** Always check \`list_interface_components\` for a suitable marketplace component before falling back to Custom Code. For example:
|
|
425
|
+
- Use **Basic Text** for rich text content, not Custom Code with HTML
|
|
426
|
+
- Use **Basic Image** for images, not Custom Code with \`<img>\`
|
|
427
|
+
- Use **Basic Form** for forms, not Custom Code with manual form HTML
|
|
428
|
+
- Use **Dynamic List** for content listings, not Custom Code with \`$sdk.content.list\`
|
|
429
|
+
- Use **Horizontal Menu** for navigation, not Custom Code with manual links
|
|
401
430
|
|
|
402
431
|
**Example:**
|
|
403
432
|
\`\`\`json
|
|
@@ -496,7 +525,19 @@ Dynamic segments use \`:param\` syntax (e.g., \`/article/:slug\`).
|
|
|
496
525
|
type: { type: "string", enum: ["route", "folder"], description: "Route type. Default: 'route'" },
|
|
497
526
|
parentRouteName: { type: "string", description: "Name of parent folder route for nesting" },
|
|
498
527
|
headerDisabled: { type: "boolean", description: "Disable the global header on this route" },
|
|
499
|
-
footerDisabled: { type: "boolean", description: "Disable the global footer on this route" }
|
|
528
|
+
footerDisabled: { type: "boolean", description: "Disable the global footer on this route" },
|
|
529
|
+
contextVisibility: {
|
|
530
|
+
type: "object",
|
|
531
|
+
description: "Route-level visibility (e.g., login-only pages). Sets advancedOptions: true automatically.",
|
|
532
|
+
properties: {
|
|
533
|
+
hideAuthenticated: { type: "boolean" },
|
|
534
|
+
hideUnauthenticated: { type: "boolean" },
|
|
535
|
+
visibleTimes: { type: "boolean" },
|
|
536
|
+
times: { type: "array" },
|
|
537
|
+
visibleDates: { type: "boolean" },
|
|
538
|
+
dates: { type: "array" }
|
|
539
|
+
}
|
|
540
|
+
}
|
|
500
541
|
},
|
|
501
542
|
required: ["interfaceId", "title", "path", "name"]
|
|
502
543
|
}
|
|
@@ -524,6 +565,18 @@ export const updateInterfaceRouteTool = {
|
|
|
524
565
|
title: { type: "string" },
|
|
525
566
|
description: { type: "string" }
|
|
526
567
|
}
|
|
568
|
+
},
|
|
569
|
+
contextVisibility: {
|
|
570
|
+
type: "object",
|
|
571
|
+
description: "Route-level visibility rules (e.g., login-only pages). Also sets advancedOptions: true automatically.",
|
|
572
|
+
properties: {
|
|
573
|
+
hideAuthenticated: { type: "boolean", description: "Hide route when user is logged in" },
|
|
574
|
+
hideUnauthenticated: { type: "boolean", description: "Hide route when user is logged out (login-only page)" },
|
|
575
|
+
visibleTimes: { type: "boolean" },
|
|
576
|
+
times: { type: "array" },
|
|
577
|
+
visibleDates: { type: "boolean" },
|
|
578
|
+
dates: { type: "array" }
|
|
579
|
+
}
|
|
527
580
|
}
|
|
528
581
|
},
|
|
529
582
|
required: ["interfaceId", "routeName"]
|
|
@@ -696,7 +749,48 @@ Returns the new section's UUID - save this for updating or nesting into its slot
|
|
|
696
749
|
type: "object",
|
|
697
750
|
description: "Field values for the component. For Custom Code: { html, javascript, scss }. Use get_interface_component_details to see fields."
|
|
698
751
|
},
|
|
699
|
-
componentVersion: { type: "string", description: "Component version: 'latest' (default) or 'draft'" }
|
|
752
|
+
componentVersion: { type: "string", description: "Component version: 'latest' (default) or 'draft'" },
|
|
753
|
+
themes: {
|
|
754
|
+
type: "array",
|
|
755
|
+
items: { type: "string" },
|
|
756
|
+
description: "Theme UUIDs to apply scoped CSS to this section. Get available themes from get_interface."
|
|
757
|
+
},
|
|
758
|
+
contextVisibility: {
|
|
759
|
+
type: "object",
|
|
760
|
+
description: "Control when this section is visible based on auth state, device, time, or date ranges.",
|
|
761
|
+
properties: {
|
|
762
|
+
hideAuthenticated: { type: "boolean", description: "Hide when user is logged in" },
|
|
763
|
+
hideUnauthenticated: { type: "boolean", description: "Hide when user is logged out" },
|
|
764
|
+
hideMobile: { type: "boolean", description: "Hide on mobile devices" },
|
|
765
|
+
hideTablet: { type: "boolean", description: "Hide on tablet devices" },
|
|
766
|
+
hideDesktop: { type: "boolean", description: "Hide on desktop devices" },
|
|
767
|
+
visibleTimes: { type: "boolean", description: "Enable time-based visibility" },
|
|
768
|
+
times: {
|
|
769
|
+
type: "array",
|
|
770
|
+
description: "Time windows when visible (requires visibleTimes: true)",
|
|
771
|
+
items: {
|
|
772
|
+
type: "object",
|
|
773
|
+
properties: {
|
|
774
|
+
weekdays: { type: "array", items: { type: "string" }, description: "e.g. ['monday','wednesday']" },
|
|
775
|
+
start: { type: "string", description: "24h time e.g. '0900'" },
|
|
776
|
+
end: { type: "string", description: "24h time e.g. '1700'" }
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
visibleDates: { type: "boolean", description: "Enable date-range visibility" },
|
|
781
|
+
dates: {
|
|
782
|
+
type: "array",
|
|
783
|
+
description: "Date ranges when visible (requires visibleDates: true)",
|
|
784
|
+
items: {
|
|
785
|
+
type: "object",
|
|
786
|
+
properties: {
|
|
787
|
+
start: { type: "string", description: "ISO date string" },
|
|
788
|
+
end: { type: "string", description: "ISO date string" }
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
700
794
|
},
|
|
701
795
|
required: ["interfaceId", "target", "componentId"]
|
|
702
796
|
}
|
|
@@ -724,7 +818,22 @@ For example, to update just the HTML of a Custom Code section, send \`model: { h
|
|
|
724
818
|
model: { type: "object", description: "Updated field values (merged with existing)" },
|
|
725
819
|
title: { type: "string", description: "New title" },
|
|
726
820
|
disabled: { type: "boolean", description: "Disable/enable the section" },
|
|
727
|
-
themes: { type: "array", items: { type: "string" }, description: "Theme UUIDs to apply" }
|
|
821
|
+
themes: { type: "array", items: { type: "string" }, description: "Theme UUIDs to apply scoped CSS. Get available themes from get_interface." },
|
|
822
|
+
contextVisibility: {
|
|
823
|
+
type: "object",
|
|
824
|
+
description: "Control when this section is visible. Set to {} to clear visibility rules.",
|
|
825
|
+
properties: {
|
|
826
|
+
hideAuthenticated: { type: "boolean" },
|
|
827
|
+
hideUnauthenticated: { type: "boolean" },
|
|
828
|
+
hideMobile: { type: "boolean" },
|
|
829
|
+
hideTablet: { type: "boolean" },
|
|
830
|
+
hideDesktop: { type: "boolean" },
|
|
831
|
+
visibleTimes: { type: "boolean" },
|
|
832
|
+
times: { type: "array" },
|
|
833
|
+
visibleDates: { type: "boolean" },
|
|
834
|
+
dates: { type: "array" }
|
|
835
|
+
}
|
|
836
|
+
}
|
|
728
837
|
},
|
|
729
838
|
required: ["interfaceId", "sectionUuid"]
|
|
730
839
|
}
|
|
@@ -831,8 +940,9 @@ export const setInterfaceMenuTool = {
|
|
|
831
940
|
description: `Create or update a navigation menu in the interface. Always call \`get_interface\` first to see existing menus.
|
|
832
941
|
|
|
833
942
|
Menu items link to routes (by name) or external URLs. Items can be nested for dropdown menus.
|
|
943
|
+
Each item can have \`contextVisibility\` to control when it appears (e.g., show "Dashboard" only to logged-in users, show "Login" only to anonymous visitors).
|
|
834
944
|
|
|
835
|
-
**
|
|
945
|
+
**Examples:**
|
|
836
946
|
\`\`\`json
|
|
837
947
|
{
|
|
838
948
|
"interfaceId": "abc123",
|
|
@@ -840,8 +950,8 @@ Menu items link to routes (by name) or external URLs. Items can be nested for dr
|
|
|
840
950
|
"title": "Primary Menu",
|
|
841
951
|
"items": [
|
|
842
952
|
{ "title": "Home", "type": "route", "route": "home" },
|
|
843
|
-
{ "title": "
|
|
844
|
-
{ "title": "
|
|
953
|
+
{ "title": "Dashboard", "type": "route", "route": "dashboard", "contextVisibility": { "hideUnauthenticated": true } },
|
|
954
|
+
{ "title": "Login", "type": "route", "route": "login", "contextVisibility": { "hideAuthenticated": true } }
|
|
845
955
|
]
|
|
846
956
|
}
|
|
847
957
|
\`\`\``,
|
|
@@ -862,7 +972,22 @@ Menu items link to routes (by name) or external URLs. Items can be nested for dr
|
|
|
862
972
|
route: { type: "string", description: "Route name (when type='route')" },
|
|
863
973
|
url: { type: "string", description: "URL (when type='url')" },
|
|
864
974
|
target: { type: "string", description: "Window target (e.g., '_blank')" },
|
|
865
|
-
items: { type: "array", description: "Submenu items (same structure)" }
|
|
975
|
+
items: { type: "array", description: "Submenu items (same structure)" },
|
|
976
|
+
contextVisibility: {
|
|
977
|
+
type: "object",
|
|
978
|
+
description: "Item visibility rules (e.g., show only to logged-in users)",
|
|
979
|
+
properties: {
|
|
980
|
+
hideAuthenticated: { type: "boolean" },
|
|
981
|
+
hideUnauthenticated: { type: "boolean" },
|
|
982
|
+
hideMobile: { type: "boolean" },
|
|
983
|
+
hideTablet: { type: "boolean" },
|
|
984
|
+
hideDesktop: { type: "boolean" },
|
|
985
|
+
visibleTimes: { type: "boolean" },
|
|
986
|
+
times: { type: "array" },
|
|
987
|
+
visibleDates: { type: "boolean" },
|
|
988
|
+
dates: { type: "array" }
|
|
989
|
+
}
|
|
990
|
+
}
|
|
866
991
|
},
|
|
867
992
|
required: ["title"]
|
|
868
993
|
}
|
|
@@ -877,9 +1002,14 @@ export const setInterfaceStylesTool = {
|
|
|
877
1002
|
|
|
878
1003
|
Only the provided fields are updated; others remain unchanged.
|
|
879
1004
|
|
|
880
|
-
- **pre**: SCSS injected before component styles. Use for CSS custom properties and
|
|
881
|
-
- **post**: SCSS injected after component styles. Use for global rules,
|
|
882
|
-
- **themes**:
|
|
1005
|
+
- **pre**: SCSS injected before component styles. Use for CSS custom properties (\`:root { --primary: #4F46E5; }\`), font imports, and resets.
|
|
1006
|
+
- **post**: SCSS injected after component styles. Use for global rules, typography, layout helpers (e.g., \`.v-wrap\`, \`.h-wrap\`).
|
|
1007
|
+
- **themes**: Reusable scoped CSS blocks applied to sections. Each theme has a \`title\`, \`uuid\` (10-char alphanumeric, auto-generated if omitted), and \`body\` (CSS/SCSS). Sections reference themes by UUID in their \`themes\` array — the theme's CSS is scoped to that section.
|
|
1008
|
+
|
|
1009
|
+
**Theme workflow:**
|
|
1010
|
+
1. Define themes here (e.g., "Primary", "Dark", "Highlight")
|
|
1011
|
+
2. When adding/updating sections, set \`themes: ["<uuid>"]\` to apply the theme's CSS
|
|
1012
|
+
3. Multiple themes can be stacked on a single section
|
|
883
1013
|
|
|
884
1014
|
**Example:**
|
|
885
1015
|
\`\`\`json
|
|
@@ -1120,6 +1250,10 @@ export async function handleAddInterfaceRoute(args) {
|
|
|
1120
1250
|
newRoute.headerDisabled = args.headerDisabled;
|
|
1121
1251
|
if (args.footerDisabled !== undefined)
|
|
1122
1252
|
newRoute.footerDisabled = args.footerDisabled;
|
|
1253
|
+
if (args.contextVisibility) {
|
|
1254
|
+
newRoute.contextVisibility = args.contextVisibility;
|
|
1255
|
+
newRoute.advancedOptions = true;
|
|
1256
|
+
}
|
|
1123
1257
|
// Add to parent or top level
|
|
1124
1258
|
if (args.parentRouteName) {
|
|
1125
1259
|
const parent = findRouteByName(data.routes, args.parentRouteName);
|
|
@@ -1168,6 +1302,10 @@ export async function handleUpdateInterfaceRoute(args) {
|
|
|
1168
1302
|
route.seo = {};
|
|
1169
1303
|
Object.assign(route.seo, args.seo);
|
|
1170
1304
|
}
|
|
1305
|
+
if (args.contextVisibility !== undefined) {
|
|
1306
|
+
route.contextVisibility = args.contextVisibility;
|
|
1307
|
+
route.advancedOptions = true;
|
|
1308
|
+
}
|
|
1171
1309
|
await saveInterface(config, args.interfaceId, data);
|
|
1172
1310
|
return {
|
|
1173
1311
|
content: [{
|
|
@@ -1235,9 +1373,12 @@ export async function handleAddInterfaceSection(args) {
|
|
|
1235
1373
|
componentVersion: args.componentVersion || 'latest',
|
|
1236
1374
|
model,
|
|
1237
1375
|
slots: [],
|
|
1238
|
-
themes: [],
|
|
1376
|
+
themes: args.themes || [],
|
|
1239
1377
|
collapsed: false,
|
|
1240
1378
|
};
|
|
1379
|
+
if (args.contextVisibility) {
|
|
1380
|
+
section.contextVisibility = args.contextVisibility;
|
|
1381
|
+
}
|
|
1241
1382
|
const targetArray = resolveTargetArray(data, args.target);
|
|
1242
1383
|
if (!targetArray) {
|
|
1243
1384
|
if (args.target.area === 'route') {
|
|
@@ -1280,6 +1421,8 @@ export async function handleUpdateInterfaceSection(args) {
|
|
|
1280
1421
|
section.disabled = args.disabled;
|
|
1281
1422
|
if (args.themes !== undefined)
|
|
1282
1423
|
section.themes = args.themes;
|
|
1424
|
+
if (args.contextVisibility !== undefined)
|
|
1425
|
+
section.contextVisibility = args.contextVisibility;
|
|
1283
1426
|
if (args.model) {
|
|
1284
1427
|
const parsedModel = parseNestedJsonStrings(args.model);
|
|
1285
1428
|
section.model = Object.assign(section.model || {}, parsedModel);
|
|
@@ -1406,14 +1549,21 @@ export async function handleSetInterfaceMenu(args) {
|
|
|
1406
1549
|
const items = parseNestedJsonStrings(args.items);
|
|
1407
1550
|
// Normalize menu items
|
|
1408
1551
|
const normalizeItems = (menuItems) => {
|
|
1409
|
-
return (menuItems || []).map((item) =>
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1552
|
+
return (menuItems || []).map((item) => {
|
|
1553
|
+
const normalized = {
|
|
1554
|
+
title: item.title || '',
|
|
1555
|
+
type: item.type || 'route',
|
|
1556
|
+
route: item.route || '',
|
|
1557
|
+
url: item.url || '',
|
|
1558
|
+
target: item.target || '',
|
|
1559
|
+
items: item.items ? normalizeItems(item.items) : [],
|
|
1560
|
+
};
|
|
1561
|
+
if (item.contextVisibility) {
|
|
1562
|
+
normalized.advancedOptions = true;
|
|
1563
|
+
normalized.contextVisibility = item.contextVisibility;
|
|
1564
|
+
}
|
|
1565
|
+
return normalized;
|
|
1566
|
+
});
|
|
1417
1567
|
};
|
|
1418
1568
|
const normalizedItems = normalizeItems(items);
|
|
1419
1569
|
const existing = data.menus.find((m) => m.name === args.name);
|
|
@@ -1450,8 +1600,13 @@ export async function handleSetInterfaceStyles(args) {
|
|
|
1450
1600
|
data.styles.pre = args.pre;
|
|
1451
1601
|
if (args.post !== undefined)
|
|
1452
1602
|
data.styles.post = args.post;
|
|
1453
|
-
if (args.themes !== undefined)
|
|
1454
|
-
|
|
1603
|
+
if (args.themes !== undefined) {
|
|
1604
|
+
// Auto-generate UUIDs for themes that don't have one
|
|
1605
|
+
data.styles.themes = args.themes.map((theme) => ({
|
|
1606
|
+
...theme,
|
|
1607
|
+
uuid: theme.uuid || generateUUID(),
|
|
1608
|
+
}));
|
|
1609
|
+
}
|
|
1455
1610
|
await saveInterface(config, args.interfaceId, data);
|
|
1456
1611
|
const updated = [];
|
|
1457
1612
|
if (args.pre !== undefined)
|