@se-studio/contentful-cms 3.8.0 → 3.9.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.
Files changed (113) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +7 -6
  3. package/dist/cli/program.d.ts.map +1 -1
  4. package/dist/cli/program.js +15 -9
  5. package/dist/cli/program.js.map +1 -1
  6. package/dist/cli/runner.d.ts +4 -0
  7. package/dist/cli/runner.d.ts.map +1 -1
  8. package/dist/cli/runner.js +29 -3
  9. package/dist/cli/runner.js.map +1 -1
  10. package/dist/commands/apply-from-json.d.ts +4 -0
  11. package/dist/commands/apply-from-json.d.ts.map +1 -0
  12. package/dist/commands/apply-from-json.js +198 -0
  13. package/dist/commands/apply-from-json.js.map +1 -0
  14. package/dist/commands/assignment-value.d.ts +6 -0
  15. package/dist/commands/assignment-value.d.ts.map +1 -0
  16. package/dist/commands/assignment-value.js +13 -0
  17. package/dist/commands/assignment-value.js.map +1 -0
  18. package/dist/commands/batch-assignments.d.ts.map +1 -1
  19. package/dist/commands/batch-assignments.js +2 -1
  20. package/dist/commands/batch-assignments.js.map +1 -1
  21. package/dist/commands/create-from-json.d.ts +9 -0
  22. package/dist/commands/create-from-json.d.ts.map +1 -1
  23. package/dist/commands/create-from-json.js +187 -113
  24. package/dist/commands/create-from-json.js.map +1 -1
  25. package/dist/commands/export-from-json.d.ts +4 -0
  26. package/dist/commands/export-from-json.d.ts.map +1 -0
  27. package/dist/commands/export-from-json.js +28 -0
  28. package/dist/commands/export-from-json.js.map +1 -0
  29. package/dist/commands/help.d.ts.map +1 -1
  30. package/dist/commands/help.js +18 -32
  31. package/dist/commands/help.js.map +1 -1
  32. package/dist/commands/list.d.ts.map +1 -1
  33. package/dist/commands/list.js +9 -3
  34. package/dist/commands/list.js.map +1 -1
  35. package/dist/commands/multiset-assignments.d.ts.map +1 -1
  36. package/dist/commands/multiset-assignments.js +2 -1
  37. package/dist/commands/multiset-assignments.js.map +1 -1
  38. package/dist/commands/schema.d.ts.map +1 -1
  39. package/dist/commands/schema.js +28 -10
  40. package/dist/commands/schema.js.map +1 -1
  41. package/dist/contentful/cma-user-agent.d.ts +1 -1
  42. package/dist/contentful/create-from-json-types.d.ts +56 -0
  43. package/dist/contentful/create-from-json-types.d.ts.map +1 -0
  44. package/dist/contentful/create-from-json-types.js +24 -0
  45. package/dist/contentful/create-from-json-types.js.map +1 -0
  46. package/dist/contentful/entry-fields.d.ts.map +1 -1
  47. package/dist/contentful/entry-fields.js +5 -0
  48. package/dist/contentful/entry-fields.js.map +1 -1
  49. package/dist/contentful/field-value-from-json.d.ts +2 -1
  50. package/dist/contentful/field-value-from-json.d.ts.map +1 -1
  51. package/dist/contentful/field-value-from-json.js +16 -11
  52. package/dist/contentful/field-value-from-json.js.map +1 -1
  53. package/dist/contentful/link-fields.d.ts +4 -1
  54. package/dist/contentful/link-fields.d.ts.map +1 -1
  55. package/dist/contentful/link-fields.js +8 -2
  56. package/dist/contentful/link-fields.js.map +1 -1
  57. package/dist/contentful/media.d.ts +1 -0
  58. package/dist/contentful/media.d.ts.map +1 -1
  59. package/dist/contentful/media.js +1 -1
  60. package/dist/contentful/media.js.map +1 -1
  61. package/dist/contentful/session-to-from-json.d.ts +7 -0
  62. package/dist/contentful/session-to-from-json.d.ts.map +1 -0
  63. package/dist/contentful/session-to-from-json.js +180 -0
  64. package/dist/contentful/session-to-from-json.js.map +1 -0
  65. package/dist/contentful/set-field-schema.d.ts +1 -0
  66. package/dist/contentful/set-field-schema.d.ts.map +1 -1
  67. package/dist/contentful/set-field-schema.js +8 -0
  68. package/dist/contentful/set-field-schema.js.map +1 -1
  69. package/dist/contentful/validate-from-json.d.ts +12 -0
  70. package/dist/contentful/validate-from-json.d.ts.map +1 -0
  71. package/dist/contentful/validate-from-json.js +106 -0
  72. package/dist/contentful/validate-from-json.js.map +1 -0
  73. package/dist/contentful/write.d.ts +8 -4
  74. package/dist/contentful/write.d.ts.map +1 -1
  75. package/dist/contentful/write.js +45 -21
  76. package/dist/contentful/write.js.map +1 -1
  77. package/dist/generated/help-topics.d.ts +3 -0
  78. package/dist/generated/help-topics.d.ts.map +1 -0
  79. package/dist/generated/help-topics.js +4 -0
  80. package/dist/generated/help-topics.js.map +1 -0
  81. package/dist/generated/hosted-guide.d.ts +1 -1
  82. package/dist/generated/hosted-guide.d.ts.map +1 -1
  83. package/dist/generated/hosted-guide.js +1 -1
  84. package/dist/generated/hosted-guide.js.map +1 -1
  85. package/dist/generated/version.d.ts +1 -1
  86. package/dist/generated/version.js +1 -1
  87. package/dist/hosted/index.d.ts +1 -1
  88. package/dist/hosted/index.d.ts.map +1 -1
  89. package/dist/hosted/index.js +1 -1
  90. package/dist/hosted/index.js.map +1 -1
  91. package/dist/index/reference-lookup.d.ts +5 -1
  92. package/dist/index/reference-lookup.d.ts.map +1 -1
  93. package/dist/index/reference-lookup.js +19 -2
  94. package/dist/index/reference-lookup.js.map +1 -1
  95. package/dist/mcp/http-handler.d.ts.map +1 -1
  96. package/dist/mcp/http-handler.js +2 -3
  97. package/dist/mcp/http-handler.js.map +1 -1
  98. package/dist/mcp/server.d.ts.map +1 -1
  99. package/dist/mcp/server.js +2 -3
  100. package/dist/mcp/server.js.map +1 -1
  101. package/dist/mcp/tools/cms-edit.d.ts +1 -1
  102. package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
  103. package/dist/mcp/tools/cms-edit.js +15 -2
  104. package/dist/mcp/tools/cms-edit.js.map +1 -1
  105. package/dist/mcp/tools/help.d.ts.map +1 -1
  106. package/dist/mcp/tools/help.js +47 -6
  107. package/dist/mcp/tools/help.js.map +1 -1
  108. package/docs/editor-tasks/create-page.md +6 -6
  109. package/docs/help/create-from-json.md +24 -1
  110. package/docs/help/index.md +3 -1
  111. package/docs/mcp/hosted-guide.md +18 -7
  112. package/package.json +3 -3
  113. package/skills/core/SKILL.md +22 -25
@@ -22,7 +22,7 @@ All `save` operations create **drafts only**. A human must review and publish in
22
22
  | `cms_edit` | Run any cms-edit command via an `args` array |
23
23
  | `cms_edit_request_staged_upload` | Get a presigned upload URL for binary files (then `curl` + `asset upload --staged`) |
24
24
  | `cms_edit_version` | Check the installed cms-edit version (no session required) |
25
- | `cms_edit_help` | Read this guide by topic (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) |
25
+ | `cms_edit_help` | Guide topics (`overview`, `workflow`, `commands`, `troubleshooting`, `hosted`) **or** playbooks (`create-from-json`, `fields-component`, …) |
26
26
 
27
27
  ## Customer editor pack (read first)
28
28
 
@@ -183,18 +183,29 @@ Read `cms-edit://customer/defaults` when present. Otherwise:
183
183
 
184
184
  Run `["index", "sync"]` before resolving assets by filename.
185
185
 
186
+ ## JSON payloads (filesystem vs no filesystem)
187
+
188
+ Hosted MCP cannot see your disk. Same commands either way:
189
+
190
+ - **Filesystem client:** write `page.json`, then `cms_edit ["create", "from-json", "--json-base64", "<base64 of file>", "--dry-run", "--strict"]`
191
+ - **No filesystem (Desktop):** put the JSON in `--json` on the tool call
192
+
193
+ Never use a local `cms-edit` binary, `--file`, or stdin for content.
194
+
186
195
  ## Create content
187
196
 
188
197
  ### Create a page
189
198
 
190
199
  ```
191
- ["index", "sync"]
192
- ["list", "--type", "template"]
193
- ["create", "page", "--slug", "/about-us", "--title", "About Us", "--template-id", "<id>"]
194
- ["snapshot"]
200
+ ["schema", "component"]
201
+ ["help", "create-from-json"]
202
+ ["create", "from-json", "--json", "{...}", "--dry-run", "--strict"]
203
+ ["create", "from-json", "--json", "{...}"]
195
204
  ```
196
205
 
197
- Or use `create from-json` with `--dry-run --strict` for multi-section pages.
206
+ Use `"components"` (not `"content"`) and nested `"type"` (not `"componentType"`). Peek a live entry or `schema <ct>` before authoring field ids.
207
+
208
+ Empty `components` fails validation. Incremental `add`/`set` is for tiny patches only.
198
209
 
199
210
  ### Create an article
200
211
 
@@ -349,6 +360,6 @@ After upgrading cms-edit, run `["index", "sync"]` once so the local index includ
349
360
 
350
361
  **Editing:** `set <ref> <field> <value>`, `rtf <ref> <field> --content "<md>"`, `diff`, `save`, `discard`
351
362
 
352
- **Creating:** `create page --slug … --title …`, `create article --slug … --title … --article-type-slug …`, `create from-json --file …`, `add <type> --content-type … --parent @c0 --target content`
363
+ **Creating:** `create from-json --json … --dry-run --strict`, `export from-json`, `apply from-json --json …`, `create page` / `create article` for empty shells, `add` for tiny inserts
353
364
 
354
365
  **Other:** `health`, `version`, `guide [topic]`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/contentful-cms",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "CLI tool for AI agents to read and edit Contentful draft content without publish permissions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,9 +72,9 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@biomejs/biome": "^2.5.10",
75
- "@types/node": "^26.2.0",
75
+ "@types/node": "^24.13.3",
76
76
  "@types/react": "^19.2.18",
77
- "@types/react-dom": "^19.2.4",
77
+ "@types/react-dom": "^19.2.5",
78
78
  "@upstash/redis": "^1.38.2",
79
79
  "next": "^16.3.2",
80
80
  "react": "^19.2.8",
@@ -13,14 +13,13 @@ Use this skill when you need to read or edit content in Contentful using **hoste
13
13
 
14
14
  ## Overview
15
15
 
16
- `cms-edit` lets you read and edit Contentful draft content without publishing. It uses a **snapshot → ref → edit → save** workflow:
16
+ `cms-edit` lets you read and edit Contentful draft content without publishing.
17
17
 
18
- 1. `open` a page to load the content tree into a session
19
- 2. `snapshot` to see the tree with `@ref` labels
20
- 3. `read` an entry to inspect its fields
21
- 4. `set` / `rtf` to modify fields
22
- 5. `diff` to review changes
23
- 6. `save` to write drafts to Contentful (NEVER publishes)
18
+ **New page/article:** `schema` for this space → `create from-json --dry-run --strict` → `create from-json` (`--json` or `--json-base64`). Nested tree key is `components`; discriminator is `type`.
19
+
20
+ **Edit a tree:** `open` → `export from-json` → edit JSON → `apply from-json`. Tiny patches: `set` / `rtf` / `add` then `diff` → `save`.
21
+
22
+ **Never publish.** Hosted MCP cannot see your disk — send JSON in the tool call.
24
23
 
25
24
  ## Safety Rules
26
25
 
@@ -159,15 +158,10 @@ Markdown support:
159
158
  - `` `inline code` ``
160
159
  - `---` for horizontal rule
161
160
 
162
- For any content with multiple paragraphs or newlines, use `printf` piped to stdin — `\n` in a double-quoted shell string is **not** interpreted as a newline by bash:
161
+ For multi-paragraph Markdown, pass `--content` or `--base64` on MCP (no stdin, no `--file`):
163
162
 
164
- ```bash
165
- # Correct — printf interprets \n properly
166
- printf '## Why it matters\n\nOur platform helps teams **move faster**.\n\n- Instant setup\n- No code required\n' | cms-edit rtf @c1 body --markdown -
167
-
168
- # Also correct — file input
169
- cms-edit rtf @c1 body --markdown --content "# Heading\n\nBody."
170
- cms-edit rtf @c1 body --markdown - < path/to/file.md
163
+ ```
164
+ cms_edit ["rtf", "@c1", "body", "--content", "## Why it matters\n\nOur platform helps teams **move faster**."]
171
165
  ```
172
166
 
173
167
  Single-line content (no newlines) can be passed as a quoted argument directly:
@@ -679,12 +673,11 @@ cms-edit peek --id <entryId> # Look up by entry ID
679
673
 
680
674
  ## Batch Operations (batch run)
681
675
 
682
- Run a sequence of operations from a JSON file or stdin.
676
+ Run a sequence of operations from `--json` or `--json-base64` (hosted MCP).
683
677
 
684
- ```bash
685
- cms-edit batch run --json '[...]' # Run batch ops from inline JSON
686
- echo '[...]' | cms-edit batch run # Pipe from stdin
687
- cms-edit batch run --json '[...]' --dry-run # Validate without saving
678
+ ```
679
+ cms_edit ["batch", "run", "--json", "[...]"]
680
+ cms_edit ["batch", "run", "--json-base64", "<b64>", "--dry-run"]
688
681
  ```
689
682
 
690
683
  Supported ops: `open`, `set`, `rtf`, `rtf-replace`, `save`, `add`, `links-add`.
@@ -715,13 +708,17 @@ Example `ops.json` — update an existing page with a new CTA that has two butto
715
708
 
716
709
  ## Create Page or Article from JSON
717
710
 
718
- Create a complete page or article — including all components, fields, and CTA links — from a single declarative JSON file. This is the recommended approach for creating multiple pages or articles in bulk.
711
+ Create a complete page or article from `--json` or `--json-base64`. Dry-run is local (no CMA) once the index is warm.
719
712
 
720
- ```bash
721
- cms-edit create from-json --json '{...}' # Create from inline JSON
722
- cms-edit create from-json --json '{...}' --dry-run # Preview without writing
723
- cat page.json | cms-edit create from-json # Pipe from stdin
724
713
  ```
714
+ cms_edit ["help", "create-from-json"]
715
+ cms_edit ["create", "from-json", "--json", "{...}", "--dry-run", "--strict"]
716
+ cms_edit ["create", "from-json", "--json-base64", "<b64>"]
717
+ cms_edit ["export", "from-json"]
718
+ cms_edit ["apply", "from-json", "--json-base64", "<b64>"]
719
+ ```
720
+
721
+ Use `"components"` not `"content"`. Nested discriminator is `"type"` not `"componentType"`. Empty `components` fails. `schema <contentType>` for this space’s field ids.
725
722
 
726
723
  **Page JSON schema:**
727
724