@cmssy/cli 0.13.0 → 0.16.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 +199 -58
- package/dist/cli.js +19 -27
- package/dist/cli.js.map +1 -1
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +29 -12
- package/dist/commands/codegen.js.map +1 -1
- package/dist/commands/publish.d.ts +0 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +2 -146
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/skills.d.ts +4 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +132 -29
- package/dist/commands/skills.js.map +1 -1
- package/dist/skills/claude/cmssy-mcp-content.md +231 -0
- package/dist/test-helpers/index.d.ts +23 -0
- package/dist/test-helpers/index.d.ts.map +1 -0
- package/dist/test-helpers/index.js +50 -0
- package/dist/test-helpers/index.js.map +1 -0
- package/dist/utils/dev-generator/helpers.d.ts.map +1 -1
- package/dist/utils/dev-generator/helpers.js +28 -12
- package/dist/utils/dev-generator/helpers.js.map +1 -1
- package/dist/utils/dev-generator/layout.d.ts.map +1 -1
- package/dist/utils/dev-generator/layout.js +6 -2
- package/dist/utils/dev-generator/layout.js.map +1 -1
- package/dist/utils/dev-generator/next-config.d.ts.map +1 -1
- package/dist/utils/dev-generator/next-config.js +11 -4
- package/dist/utils/dev-generator/next-config.js.map +1 -1
- package/dist/utils/graphql.d.ts +0 -1
- package/dist/utils/graphql.d.ts.map +1 -1
- package/dist/utils/graphql.js +0 -13
- package/dist/utils/graphql.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cmssy-mcp-content
|
|
3
|
+
description: "Rules for managing CMS content via cmssy MCP tools. Use when creating/editing pages, blocks, translations, forms, or layout blocks through MCP. Trigger on words: cmssy MCP, page, block content, translation, form, header, footer, layout, publish page, add_block_to_page, update_block_content, create_page, list_pages, i18n, language."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# cmssy-mcp-content
|
|
7
|
+
|
|
8
|
+
Rules and patterns for working with site content through cmssy MCP tools.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
This skill assumes the `@cmssy/mcp-server` is configured as an MCP server in your Claude Code settings. If the tools below are unavailable, install and configure it:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @cmssy/mcp-server
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Then register it in `~/.claude.json` (or your project `.mcp.json`) with your workspace token and workspace ID. See https://www.npmjs.com/package/@cmssy/mcp-server for the exact config snippet.
|
|
19
|
+
|
|
20
|
+
If the MCP tools (`list_pages`, `update_block_content`, etc.) aren't available in your session, this skill won't work - fall back to the Cmssy editor UI.
|
|
21
|
+
|
|
22
|
+
## When to use this skill
|
|
23
|
+
|
|
24
|
+
- Creating or editing pages via MCP
|
|
25
|
+
- Adding/updating block content or translations
|
|
26
|
+
- Working with layout blocks (header, footer)
|
|
27
|
+
- Managing page settings, SEO, or publishing
|
|
28
|
+
- Creating or managing forms and form submissions
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Rule 0: Discover the workspace's languages BEFORE editing
|
|
33
|
+
|
|
34
|
+
**Cmssy is multi-tenant and language-agnostic.** Every workspace picks its own set of languages — could be `en`, `pl`, `de`, `es`, `fr`, `zh`, `ja`, `ar`, `uk`, anything. **Never assume** a workspace uses `en`/`pl` — they are examples in this doc, not a fixed set.
|
|
35
|
+
|
|
36
|
+
Before any content edit:
|
|
37
|
+
|
|
38
|
+
1. Call `get_site_config` and read **`enabledLanguages`** (array of ISO 639-1 codes) and **`defaultLanguage`**
|
|
39
|
+
2. Use exactly those codes as keys in `content` - and every one of them when adding translations
|
|
40
|
+
3. If the workspace has only one language, content is still keyed by that language code (e.g. `content: { zh: {...} }`), never flat
|
|
41
|
+
|
|
42
|
+
When this rule is violated, you either silently drop a language or write under the wrong key. Both corrupt content.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Rule 1: Always use language-keyed content
|
|
47
|
+
|
|
48
|
+
All block content MUST be keyed by the workspace's enabled language codes (see Rule 0). Examples below show `en` + `pl` purely as an illustration - substitute whatever `enabledLanguages` returns for the actual workspace.
|
|
49
|
+
|
|
50
|
+
```jsonc
|
|
51
|
+
// CORRECT - language-keyed, includes EVERY language the workspace enabled
|
|
52
|
+
// (here en + pl; your workspace might return e.g. ["en","de","zh"] instead)
|
|
53
|
+
{
|
|
54
|
+
"en": { "heading": "Welcome", "subheading": "Hello world" },
|
|
55
|
+
"pl": { "heading": "Witaj", "subheading": "Witaj świecie" }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// WRONG - flat content, no language keys
|
|
59
|
+
{
|
|
60
|
+
"heading": "Welcome",
|
|
61
|
+
"subheading": "Hello world"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// WRONG - adding one language without including the others the workspace enabled
|
|
65
|
+
// If enabledLanguages is ["en","pl","de"], you MUST send all three, not just one
|
|
66
|
+
{
|
|
67
|
+
"pl": { "heading": "Witaj" }
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Critical edge case**: if existing content is flat (no language keys - legacy), you MUST restructure it by providing a key for EVERY enabled language in a single update - the default language gets the existing content, the others get the new translation (or a placeholder copy if the user didn't provide one).
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Rule 2: Layout blocks (header/footer) follow the same i18n rules
|
|
76
|
+
|
|
77
|
+
Layout blocks (header, footer) live in `layoutBlocks` on a page, not in `blocks`. They use the same `update_block_content` tool and the same language-keyed content structure - with the exact same language codes from `enabledLanguages`.
|
|
78
|
+
|
|
79
|
+
### Header translatable fields
|
|
80
|
+
|
|
81
|
+
- `navigation[].label` - top-level nav labels
|
|
82
|
+
- `navigation[].children[].label` - submenu item labels
|
|
83
|
+
- `navigation[].children[].description` - submenu item descriptions
|
|
84
|
+
- `ctaLabel`, `secondaryCtaLabel` - button labels
|
|
85
|
+
- `announcementText` - announcement bar text
|
|
86
|
+
- `logoutButtonText` - logout button
|
|
87
|
+
|
|
88
|
+
### Footer translatable fields
|
|
89
|
+
|
|
90
|
+
- `tagline` - site tagline
|
|
91
|
+
- `linkColumns[].title` - column headings
|
|
92
|
+
- `linkColumns[].links[].name` - link labels
|
|
93
|
+
- `copyrightText` - copyright notice
|
|
94
|
+
|
|
95
|
+
### Non-translatable fields (identical value across all languages)
|
|
96
|
+
|
|
97
|
+
- URLs (`url`, `href`, `ctaUrl`, `announcementLink`)
|
|
98
|
+
- Icons (`icon`)
|
|
99
|
+
- Booleans (`showCta`, `sticky`, `transparent`, `showSocial`)
|
|
100
|
+
- Style values (`announcementBg`, `announcementTextColor`, `logoSize`)
|
|
101
|
+
- `logo` (image URL)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Rule 3: Workflow for content updates
|
|
106
|
+
|
|
107
|
+
1. **Read first**: Always `get_page` or `get_site_config` before editing
|
|
108
|
+
2. **Read `enabledLanguages`**: Language codes vary per workspace - never hardcode
|
|
109
|
+
3. **Inspect existing content shape**: Is it flat or language-keyed?
|
|
110
|
+
4. **Write every enabled language**: When adding translations, include ALL codes returned by `enabledLanguages`, not just the ones the user mentioned
|
|
111
|
+
5. **Verify**: After update, confirm the response has a key for each enabled language
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Rule 4: Page blocks vs Layout blocks
|
|
116
|
+
|
|
117
|
+
| | Page blocks | Layout blocks |
|
|
118
|
+
| -------------- | ---------------------------------- | ---------------------------------- |
|
|
119
|
+
| Location | `blocks[]` | `layoutBlocks[]` |
|
|
120
|
+
| Scope | Single page | Inherited across pages |
|
|
121
|
+
| Content | `content[<lang>]` per enabled lang | `content[<lang>]` per enabled lang |
|
|
122
|
+
| Types | hero, features, faq, cta, etc. | header, footer |
|
|
123
|
+
| Position field | No | Yes (`header`, `footer`) |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Rule 5: Publishing workflow
|
|
128
|
+
|
|
129
|
+
- `update_block_content` creates unpublished changes (draft)
|
|
130
|
+
- Use `publish_page` to make changes live
|
|
131
|
+
- Use `revert_to_published` to discard draft changes
|
|
132
|
+
- Always inform the user about unpublished state after edits
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Rule 6: Available MCP tools quick reference
|
|
137
|
+
|
|
138
|
+
| Tool | Use for |
|
|
139
|
+
| --------------------------------------- | ----------------------------------------------- |
|
|
140
|
+
| `get_site_config` | **Languages**, site name, features |
|
|
141
|
+
| `get_workspace_info` | Plan, limits, usage |
|
|
142
|
+
| `list_pages` | Browse/search pages |
|
|
143
|
+
| `get_page` | Full page with blocks and content |
|
|
144
|
+
| `create_page` | New page |
|
|
145
|
+
| `update_page_settings` | SEO, displayName, description |
|
|
146
|
+
| `update_block_content` | Edit block content (page or layout) |
|
|
147
|
+
| `add_block_to_page` | Add new block |
|
|
148
|
+
| `remove_block_from_page` | Remove block |
|
|
149
|
+
| `update_page_blocks` | Reorder blocks |
|
|
150
|
+
| `update_page_layout` | Change layout blocks |
|
|
151
|
+
| `publish_page` / `unpublish_page` | Publishing |
|
|
152
|
+
| `list_block_types` / `get_block_schema` | Discover available blocks |
|
|
153
|
+
| `list_media` | Browse uploaded media |
|
|
154
|
+
| `list_forms` | Browse forms (filter by status) |
|
|
155
|
+
| `get_form` | Full form with fields, settings, i18n |
|
|
156
|
+
| `create_form` | New form with fields and settings |
|
|
157
|
+
| `update_form` | Edit form name, fields, settings, status |
|
|
158
|
+
| `delete_form` | Delete form and all submissions |
|
|
159
|
+
| `list_form_submissions` | Browse submissions (filter by form/status) |
|
|
160
|
+
| `get_form_submission` | Full submission details |
|
|
161
|
+
| `update_form_submission_status` | Change status (pending/processed/spam/archived) |
|
|
162
|
+
| `delete_form_submission` | Delete a submission |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Rule 7: Forms - field types and settings
|
|
167
|
+
|
|
168
|
+
### Available field types (15)
|
|
169
|
+
|
|
170
|
+
`text`, `email`, `password`, `textarea`, `number`, `phone`, `url`, `date`, `datetime`, `select`, `multiselect`, `checkbox`, `radio`, `file`, `hidden`
|
|
171
|
+
|
|
172
|
+
### Action types
|
|
173
|
+
|
|
174
|
+
- `contact` (default) - standard contact form
|
|
175
|
+
- `login` - authentication form
|
|
176
|
+
- `register` - user registration
|
|
177
|
+
- `newsletter` - email subscription
|
|
178
|
+
- `custom` - custom webhook/processing
|
|
179
|
+
|
|
180
|
+
### Form i18n fields (language-keyed, same rules as blocks)
|
|
181
|
+
|
|
182
|
+
All the following fields are keyed by the workspace's `enabledLanguages` codes - whatever the site uses (`en`, `de`, `zh`, …):
|
|
183
|
+
|
|
184
|
+
- `fields[].label`, `fields[].placeholder`, `fields[].helpText`
|
|
185
|
+
- `fields[].options[].label`
|
|
186
|
+
- `settings.submitButtonLabel`, `settings.successMessage`, `settings.errorMessage`
|
|
187
|
+
|
|
188
|
+
### Form statuses
|
|
189
|
+
|
|
190
|
+
- `draft` - not publicly accessible
|
|
191
|
+
- `published` - live and accepting submissions
|
|
192
|
+
- `archived` - disabled
|
|
193
|
+
|
|
194
|
+
### Creating a form example
|
|
195
|
+
|
|
196
|
+
Below: `en` + `pl` shown for illustration. For a workspace with `enabledLanguages: ["en","de","zh"]` you'd send keys `en`, `de`, `zh` instead - always match whatever `get_site_config` returns.
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"name": "Contact Form",
|
|
201
|
+
"slug": "contact",
|
|
202
|
+
"fields": [
|
|
203
|
+
{
|
|
204
|
+
"id": "name-field",
|
|
205
|
+
"name": "name",
|
|
206
|
+
"fieldType": "text",
|
|
207
|
+
"label": { "en": "Name", "pl": "Imię" },
|
|
208
|
+
"validation": { "required": true }
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "email-field",
|
|
212
|
+
"name": "email",
|
|
213
|
+
"fieldType": "email",
|
|
214
|
+
"label": { "en": "Email", "pl": "Email" },
|
|
215
|
+
"validation": { "required": true }
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"id": "message-field",
|
|
219
|
+
"name": "message",
|
|
220
|
+
"fieldType": "textarea",
|
|
221
|
+
"label": { "en": "Message", "pl": "Wiadomość" },
|
|
222
|
+
"validation": { "required": true, "minLength": 10 }
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
"settings": {
|
|
226
|
+
"actionType": "contact",
|
|
227
|
+
"submitButtonLabel": { "en": "Send", "pl": "Wyślij" },
|
|
228
|
+
"successMessage": { "en": "Thank you!", "pl": "Dziękujemy!" }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test helpers for Cmssy blocks.
|
|
3
|
+
* Usage: import { renderBlock } from "@cmssy/cli/test";
|
|
4
|
+
*/
|
|
5
|
+
interface RenderBlockOptions {
|
|
6
|
+
content: Record<string, unknown>;
|
|
7
|
+
context?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Render a block component with content and optional context.
|
|
11
|
+
* Wraps @testing-library/react render with block-specific props.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderBlock(Component: any, options: RenderBlockOptions): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Validate that preview data has required fields present.
|
|
16
|
+
* Does not check value types - only presence of required fields.
|
|
17
|
+
*/
|
|
18
|
+
export declare function validatePreviewData(schema: Record<string, any>, data: Record<string, unknown>): {
|
|
19
|
+
valid: boolean;
|
|
20
|
+
errors: string[];
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-helpers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAOD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,gBAyB5E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAatC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test helpers for Cmssy blocks.
|
|
3
|
+
* Usage: import { renderBlock } from "@cmssy/cli/test";
|
|
4
|
+
*/
|
|
5
|
+
const DEFAULT_CONTEXT = {
|
|
6
|
+
locale: { current: "en", default: "en", enabled: ["en"] },
|
|
7
|
+
isPreview: true,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Render a block component with content and optional context.
|
|
11
|
+
* Wraps @testing-library/react render with block-specific props.
|
|
12
|
+
*/
|
|
13
|
+
export async function renderBlock(Component, options) {
|
|
14
|
+
let render;
|
|
15
|
+
try {
|
|
16
|
+
const rtl = await import("@testing-library/react");
|
|
17
|
+
render = rtl.render;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
throw new Error("Missing @testing-library/react. Install it:\n npm install -D @testing-library/react");
|
|
21
|
+
}
|
|
22
|
+
let React;
|
|
23
|
+
try {
|
|
24
|
+
React = await import("react");
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new Error("Missing react. Install it:\n npm install react");
|
|
28
|
+
}
|
|
29
|
+
const context = { ...DEFAULT_CONTEXT, ...options.context };
|
|
30
|
+
const element = React.createElement(Component, {
|
|
31
|
+
content: options.content,
|
|
32
|
+
context,
|
|
33
|
+
});
|
|
34
|
+
return render(element);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Validate that preview data has required fields present.
|
|
38
|
+
* Does not check value types - only presence of required fields.
|
|
39
|
+
*/
|
|
40
|
+
export function validatePreviewData(schema, data) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
43
|
+
if (field.required &&
|
|
44
|
+
(data[key] === undefined || data[key] === null || data[key] === "")) {
|
|
45
|
+
errors.push(`Required field "${key}" is missing or empty`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { valid: errors.length === 0, errors };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-helpers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;IACzD,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,SAAc,EAAE,OAA2B;IAC3E,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAC;IACJ,CAAC;IAED,IAAI,KAAU,CAAC;IACf,IAAI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E,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/dev-generator/helpers.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWlE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAwE5B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IACrE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,KAAK,EAAE,GAAG,EAAE,CAAC;CACd,CA+BA;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD"}
|
|
@@ -28,6 +28,9 @@ export function loadTemplateConfigSync(templateDir, projectRoot) {
|
|
|
28
28
|
const configPath = path.join(templateDir, "config.ts");
|
|
29
29
|
if (!fs.existsSync(configPath))
|
|
30
30
|
return null;
|
|
31
|
+
const cacheDir = path.join(projectRoot, ".cmssy", "cache");
|
|
32
|
+
let mockConfigPath = null;
|
|
33
|
+
let tempPath = null;
|
|
31
34
|
try {
|
|
32
35
|
const cliPath = path.dirname(path.dirname(new URL(import.meta.url).pathname));
|
|
33
36
|
const possibleTsxPaths = [
|
|
@@ -38,13 +41,18 @@ export function loadTemplateConfigSync(templateDir, projectRoot) {
|
|
|
38
41
|
let tsxBinary = possibleTsxPaths.find((p) => fs.existsSync(p));
|
|
39
42
|
if (!tsxBinary)
|
|
40
43
|
tsxBinary = "npx -y tsx";
|
|
41
|
-
const cacheDir = path.join(projectRoot, ".cmssy", "cache");
|
|
42
44
|
fs.ensureDirSync(cacheDir);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
mockConfigPath = path.join(cacheDir, "cmssy-cli-config.mjs");
|
|
46
|
+
// Mirror the mock exports in src/utils/block-config.ts - cover every
|
|
47
|
+
// export a user config might import, otherwise the dynamic import
|
|
48
|
+
// throws and preview silently falls back to null.
|
|
49
|
+
fs.writeFileSync(mockConfigPath, "export const defineBlock = (config) => config;\n" +
|
|
50
|
+
"export const defineTemplate = (config) => config;\n" +
|
|
51
|
+
"export const defineTheme = (config) => config;\n" +
|
|
52
|
+
"export const field = (config) => config;\n");
|
|
45
53
|
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
46
54
|
const modified = configContent.replace(/from\s+['"](?:@?cmssy-?(?:\/cli)?\/config|cmssy-cli\/config)['"]/g, `from '${mockConfigPath.replace(/\\/g, "/")}'`);
|
|
47
|
-
|
|
55
|
+
tempPath = path.join(cacheDir, `temp-template-config-${Date.now()}.ts`);
|
|
48
56
|
fs.writeFileSync(tempPath, modified);
|
|
49
57
|
const evalCode = `import cfg from '${tempPath.replace(/\\/g, "/")}'; console.log(JSON.stringify(cfg.default || cfg));`;
|
|
50
58
|
const cmd = tsxBinary.includes("npx")
|
|
@@ -55,20 +63,28 @@ export function loadTemplateConfigSync(templateDir, projectRoot) {
|
|
|
55
63
|
cwd: projectRoot,
|
|
56
64
|
stdio: ["pipe", "pipe", "pipe"],
|
|
57
65
|
});
|
|
58
|
-
try {
|
|
59
|
-
fs.removeSync(tempPath);
|
|
60
|
-
}
|
|
61
|
-
catch { }
|
|
62
|
-
try {
|
|
63
|
-
fs.removeSync(mockConfigPath);
|
|
64
|
-
}
|
|
65
|
-
catch { }
|
|
66
66
|
const lines = output.trim().split("\n");
|
|
67
67
|
return JSON.parse(lines[lines.length - 1]);
|
|
68
68
|
}
|
|
69
69
|
catch {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
+
finally {
|
|
73
|
+
// Always clean up temp files - a throw in execSync / JSON.parse used
|
|
74
|
+
// to leave them lingering in .cmssy/cache which could affect later runs.
|
|
75
|
+
if (tempPath) {
|
|
76
|
+
try {
|
|
77
|
+
fs.removeSync(tempPath);
|
|
78
|
+
}
|
|
79
|
+
catch { }
|
|
80
|
+
}
|
|
81
|
+
if (mockConfigPath) {
|
|
82
|
+
try {
|
|
83
|
+
fs.removeSync(mockConfigPath);
|
|
84
|
+
}
|
|
85
|
+
catch { }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
72
88
|
}
|
|
73
89
|
/**
|
|
74
90
|
* Convert template config (from config.ts defineTemplate) to pages.json format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/utils/dev-generator/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAAiB;IACxD,IAAI,MAAM,GAAG,SAAS,CAAC;IACvB,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;IACpC,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,IAAI,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,WAAmB,EACnB,WAAmB;IAEnB,MAAM,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C,CAAC;IACzD,CAAC;IAED,qBAAqB;IACrB,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC;QACpE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EACF,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC;YACtD,CAAC,CAAC,GAAG;YACL,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBACzB,CAAC,CAAC,IAAI,CAAC,IAAI;gBACX,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;KAC1B,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG;SACP,KAAK,CAAC,SAAS,CAAC;SAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACzE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/utils/dev-generator/layout.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/utils/dev-generator/layout.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,QAyBjD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAsCtE"}
|
|
@@ -2,6 +2,7 @@ import fs from "fs-extra";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
export function generateRootLayout(devRoot) {
|
|
4
4
|
const content = `import type { Metadata } from "next";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
5
6
|
import "./globals.css";
|
|
6
7
|
|
|
7
8
|
export const metadata: Metadata = {
|
|
@@ -14,7 +15,7 @@ export const metadata: Metadata = {
|
|
|
14
15
|
export default function RootLayout({
|
|
15
16
|
children,
|
|
16
17
|
}: {
|
|
17
|
-
children:
|
|
18
|
+
children: ReactNode;
|
|
18
19
|
}) {
|
|
19
20
|
return (
|
|
20
21
|
<html lang="en">
|
|
@@ -26,7 +27,10 @@ export default function RootLayout({
|
|
|
26
27
|
fs.writeFileSync(path.join(devRoot, "app/layout.tsx"), content);
|
|
27
28
|
}
|
|
28
29
|
export function generateGlobalsCss(devRoot, projectRoot) {
|
|
29
|
-
|
|
30
|
+
// Normalize to POSIX so the @import line still works on Windows.
|
|
31
|
+
const rel = path
|
|
32
|
+
.relative(path.join(devRoot, "app"), projectRoot)
|
|
33
|
+
.replaceAll(path.sep, "/");
|
|
30
34
|
// Check for project CSS files that contain Tailwind / theme
|
|
31
35
|
const cssFiles = ["styles/main.css", "styles/globals.css", "app/globals.css"];
|
|
32
36
|
const projectCssFile = cssFiles.find((f) => fs.existsSync(path.join(projectRoot, f)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/utils/dev-generator/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/utils/dev-generator/layout.ts"],"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":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"next-config.d.ts","sourceRoot":"","sources":["../../../src/utils/dev-generator/next-config.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QA6BtE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAsFpE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "fs-extra";
|
|
2
2
|
import path from "path";
|
|
3
3
|
export function generateNextConfig(devRoot, projectRoot) {
|
|
4
|
-
|
|
4
|
+
// Normalize to POSIX so the generated JS works on Windows.
|
|
5
|
+
const rel = path.relative(devRoot, projectRoot).replaceAll(path.sep, "/");
|
|
5
6
|
const content = `import { resolve, dirname } from "path";
|
|
6
7
|
import { fileURLToPath } from "url";
|
|
7
8
|
|
|
@@ -13,7 +14,12 @@ const nextConfig = {
|
|
|
13
14
|
root: resolve(__dirname, "${rel}"),
|
|
14
15
|
},
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// Dev server origin allowlist. Covers loopback + mDNS (*.local) only -
|
|
18
|
+
// a wildcard ('*') was the previous value and accepted any origin.
|
|
19
|
+
// This file is regenerated by @cmssy/cli on every \`cmssy dev\` run,
|
|
20
|
+
// so editing it here won't stick. If you need LAN access from a phone
|
|
21
|
+
// / VM, file an issue asking for a config knob on \`cmssy.config.js\`.
|
|
22
|
+
allowedDevOrigins: ['localhost', '127.0.0.1', '[::1]', '*.local'],
|
|
17
23
|
|
|
18
24
|
images: {
|
|
19
25
|
remotePatterns: [{ protocol: 'https', hostname: '**' }],
|
|
@@ -25,8 +31,9 @@ export default nextConfig;
|
|
|
25
31
|
fs.writeFileSync(path.join(devRoot, "next.config.mjs"), content);
|
|
26
32
|
}
|
|
27
33
|
export function generateTsConfig(devRoot, projectRoot) {
|
|
28
|
-
// Paths must be relative to tsconfig location (.cmssy/dev/)
|
|
29
|
-
|
|
34
|
+
// Paths must be relative to tsconfig location (.cmssy/dev/).
|
|
35
|
+
// Normalize to POSIX so the generated JSON works on Windows.
|
|
36
|
+
const rel = path.relative(devRoot, projectRoot).replaceAll(path.sep, "/");
|
|
30
37
|
// Read project tsconfig to forward user-defined path aliases and includes
|
|
31
38
|
const projectTsConfigPath = path.join(projectRoot, "tsconfig.json");
|
|
32
39
|
let userPaths = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-config.js","sourceRoot":"","sources":["../../../src/utils/dev-generator/next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,WAAmB;IACrE,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"next-config.js","sourceRoot":"","sources":["../../../src/utils/dev-generator/next-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,WAAmB;IACrE,2DAA2D;IAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG;;;;;;;;gCAQc,GAAG;;;;;;;;;;;;;;;;CAgBlC,CAAC;IACA,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAA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AAG,GAAG,qBAAqB;YAC3B,+EAA+E;YAC/E,GAAG,YAAY;SAChB;QACD,OAAO,EAAE,CAAC,cAAc,CAAC;KAC1B,CAAC;IAEF,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,EACnC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CACzC,CAAC;AACJ,CAAC"}
|
package/dist/utils/graphql.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { GraphQLClient } from "graphql-request";
|
|
|
2
2
|
export declare function createClient(): GraphQLClient;
|
|
3
3
|
export declare const IMPORT_BLOCK_MUTATION: string;
|
|
4
4
|
export declare const IMPORT_TEMPLATE_MUTATION = "\n mutation ImportTemplate($input: ImportTemplateInput!) {\n importTemplate(input: $input) {\n success\n block {\n id\n blockType\n name\n version\n }\n pagesCreated\n pagesUpdated\n message\n }\n }\n";
|
|
5
|
-
export declare const ADD_BLOCK_SOURCE_CODE_MUTATION = "\n mutation AddBlockSourceCode($input: AddBlockSourceCodeInput!) {\n addBlockSourceCode(input: $input) {\n id\n blockType\n name\n sourceUrl\n sourceCssUrl\n dependenciesUrl\n }\n }\n";
|
|
6
5
|
export declare const UPDATE_THEME_MUTATION = "\n mutation UpdateTheme($input: ThemeConfigInput!) {\n updateTheme(input: $input) {\n id\n theme {\n fonts {\n heading { family source weights customFontUrl }\n body { family source weights customFontUrl }\n }\n colors {\n primary primaryForeground secondary secondaryForeground\n accent accentForeground background foreground\n muted mutedForeground card cardForeground\n border input ring destructive\n }\n typography { h1 h2 h3 h4 h5 h6 body small }\n spacing\n borderRadius\n customCSS\n }\n }\n }\n";
|
|
7
6
|
export declare const GET_SITE_CONFIG_THEME_QUERY = "\n query GetSiteConfigTheme {\n siteConfig {\n theme {\n fonts {\n heading { family source weights customFontUrl }\n body { family source weights customFontUrl }\n }\n colors {\n primary primaryForeground secondary secondaryForeground\n accent accentForeground background foreground\n muted mutedForeground card cardForeground\n border input ring destructive\n }\n typography { h1 h2 h3 h4 h5 h6 body small }\n spacing\n borderRadius\n customCSS\n }\n }\n }\n";
|
|
8
7
|
export declare const GET_WORKSPACE_BLOCKS_QUERY: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/utils/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,wBAAgB,YAAY,IAAI,aAAa,CAa5C;AAKD,eAAO,MAAM,qBAAqB,QA4BjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,+QAepC,CAAC;AAMF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/utils/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,wBAAgB,YAAY,IAAI,aAAa,CAa5C;AAKD,eAAO,MAAM,qBAAqB,QA4BjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,+QAepC,CAAC;AAMF,eAAO,MAAM,qBAAqB,ioBAsBjC,CAAC;AAEF,eAAO,MAAM,2BAA2B,glBAqBvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAYtC,CAAC"}
|
package/dist/utils/graphql.js
CHANGED
|
@@ -63,18 +63,6 @@ export const IMPORT_TEMPLATE_MUTATION = `
|
|
|
63
63
|
// Note: ImportTemplateInput supports these additional fields:
|
|
64
64
|
// - pageTypes: [TemplatePageTypeInput] - creates page types (e.g. "Blog Post")
|
|
65
65
|
// - resetWorkspace: Boolean - deletes pages, page types, blocks (keeps media)
|
|
66
|
-
export const ADD_BLOCK_SOURCE_CODE_MUTATION = `
|
|
67
|
-
mutation AddBlockSourceCode($input: AddBlockSourceCodeInput!) {
|
|
68
|
-
addBlockSourceCode(input: $input) {
|
|
69
|
-
id
|
|
70
|
-
blockType
|
|
71
|
-
name
|
|
72
|
-
sourceUrl
|
|
73
|
-
sourceCssUrl
|
|
74
|
-
dependenciesUrl
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
`;
|
|
78
66
|
export const UPDATE_THEME_MUTATION = `
|
|
79
67
|
mutation UpdateTheme($input: ThemeConfigInput!) {
|
|
80
68
|
updateTheme(input: $input) {
|
|
@@ -126,7 +114,6 @@ export const GET_WORKSPACE_BLOCKS_QUERY = `
|
|
|
126
114
|
id
|
|
127
115
|
blockType
|
|
128
116
|
name
|
|
129
|
-
sourceUrl
|
|
130
117
|
version
|
|
131
118
|
schemaFields {
|
|
132
119
|
${SCHEMA_FIELDS_FRAGMENT}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/utils/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAE5B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QACtC,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,CAAC,QAAQ,EAAE;SAC3C;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,sBAAsB,GAAG,0BAA0B,EAAE,CAAC;AAE5D,oBAAoB;AACpB,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;UAW3B,sBAAsB;;;;;;;;;;;;;;;;;CAiB/B,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GA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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Unified CLI for building and publishing blocks to Cmssy design library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@cmssy/types": "^0.
|
|
55
|
+
"@cmssy/types": "^0.12.0",
|
|
56
56
|
"@tailwindcss/postcss": "^4.1.18",
|
|
57
57
|
"archiver": "^7.0.1",
|
|
58
58
|
"chalk": "^5.3.0",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
|
+
"@testing-library/react": "^16",
|
|
87
88
|
"@types/archiver": "^7.0.0",
|
|
88
89
|
"@types/form-data": "^2.5.2",
|
|
89
90
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -91,6 +92,8 @@
|
|
|
91
92
|
"@types/node": "^22.10.2",
|
|
92
93
|
"@types/node-fetch": "^2.6.13",
|
|
93
94
|
"@types/postcss-import": "^14.0.3",
|
|
95
|
+
"@types/react": "^19",
|
|
96
|
+
"@types/react-dom": "^19",
|
|
94
97
|
"@types/semver": "^7.7.1",
|
|
95
98
|
"@vitest/coverage-v8": "^3.2.4",
|
|
96
99
|
"typescript": "^5.7.2",
|