@se-studio/contentful-cms 1.0.59 → 1.0.63
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/CHANGELOG.md +12 -0
- package/dist/bin/cms-edit.js +5 -1
- package/dist/bin/cms-edit.js.map +1 -1
- package/dist/commands/create-from-json.d.ts.map +1 -1
- package/dist/commands/create-from-json.js +116 -28
- package/dist/commands/create-from-json.js.map +1 -1
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +48 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +57 -3
- package/dist/commands/run.js.map +1 -1
- package/dist/rtf/fromMarkdown.js +10 -12
- package/dist/rtf/fromMarkdown.js.map +1 -1
- package/dist/setup/wizard.js +2 -2
- package/dist/setup/wizard.js.map +1 -1
- package/docs/help/create-from-json.md +329 -0
- package/docs/help/fields-article.md +90 -0
- package/docs/help/fields-collection.md +133 -0
- package/docs/help/fields-component.md +150 -0
- package/docs/help/fields-page.md +121 -0
- package/docs/help/fields.md +60 -0
- package/docs/help/index.md +136 -0
- package/docs/help/run.md +222 -0
- package/docs/help/workflow.md +190 -0
- package/package.json +6 -5
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# cms-edit — Article Field Reference
|
|
2
|
+
|
|
3
|
+
An `article` entry is a blog post or news item. It has a slug, date, article type classification, and a content array.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Fields
|
|
8
|
+
|
|
9
|
+
| Field | Type | Required | Description |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| `slug` | Text | Yes | URL slug without leading slash. Example: `news/2025-hepatology-study` |
|
|
12
|
+
| `title` | Text | Yes | Article title |
|
|
13
|
+
| `description` | Text | No | SEO meta description / article summary |
|
|
14
|
+
| `cmsLabel` | Text | No | Label in Contentful's entry list. Defaults to `title` |
|
|
15
|
+
| `date` | Date | Yes | Publication date in `YYYY-MM-DD` format. Defaults to today in `create from-json` |
|
|
16
|
+
| `articleType` | Link (Entry) | Yes | Link to an `articleType` entry (categorises the article) |
|
|
17
|
+
| `content` | Array of Links | No | Content components (same as page content) |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Finding Valid articleType IDs
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cms-edit list --type articleType
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This lists all article type entries with their IDs and slugs. Use the `sys.id` value as `articleTypeId` in `create from-json`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Reading Article Fields
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cms-edit open /news/2025-hepatology-study
|
|
35
|
+
cms-edit read @c0 # all fields
|
|
36
|
+
cms-edit read @c0 date
|
|
37
|
+
cms-edit read @c0 description
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Setting Article Fields
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cms-edit set @c0 title "Updated Article Title"
|
|
46
|
+
cms-edit set @c0 description "New meta description."
|
|
47
|
+
cms-edit set @c0 date "2025-06-01"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Adding Content to an Article
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Add a component to the article's content array
|
|
56
|
+
cms-edit add TextBlock component
|
|
57
|
+
|
|
58
|
+
# Add a collection
|
|
59
|
+
cms-edit add CardGrid collection
|
|
60
|
+
|
|
61
|
+
# Insert after a specific component
|
|
62
|
+
cms-edit add Generic component --after @c3
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## In create from-json
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"type": "article",
|
|
72
|
+
"slug": "news/2025-hepatology-study",
|
|
73
|
+
"title": "New Hepatology Cohort Study Published",
|
|
74
|
+
"description": "A landmark study on hepatology cohort data.",
|
|
75
|
+
"date": "2025-06-01",
|
|
76
|
+
"articleTypeId": "<articleType entry ID>",
|
|
77
|
+
"components": [
|
|
78
|
+
{
|
|
79
|
+
"contentType": "component",
|
|
80
|
+
"type": "TextBlock",
|
|
81
|
+
"fields": {
|
|
82
|
+
"heading": "Study Overview",
|
|
83
|
+
"body": "The study included 1,200 patients.\n\nResults showed significant improvement."
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Auto-detection: if `articleTypeId` is present and `type` is omitted, the entry is automatically created as an article.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# cms-edit — Collection Field Reference
|
|
2
|
+
|
|
3
|
+
A `collection` entry is a group of components — a card grid, timeline, category explorer, etc. The `collectionType` field picks which visual layout to use. Children are stored in the `contents` field.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Fields
|
|
8
|
+
|
|
9
|
+
| Field | Type | Description |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `cmsLabel` | Text | Human-readable label in Contentful's entry list |
|
|
12
|
+
| `collectionType` | Text | Variant discriminator — e.g. `CardGrid`, `Timeline`, `CategoryExplorer`. Run `cms-edit types` to see valid values |
|
|
13
|
+
| `heading` | Text | Section heading |
|
|
14
|
+
| `preHeading` | Text | Small label above the heading. Rendered as `<p>`, not a heading tag |
|
|
15
|
+
| `postHeading` | Text | Small label below the heading. Rendered as `<p>`, not a heading tag |
|
|
16
|
+
| `body` | RichText | Introductory body text for the collection |
|
|
17
|
+
| `links` | Array of Links | CTA link entries for the collection as a whole |
|
|
18
|
+
| `contents` | Array of Links | The child component/collection entries in display order |
|
|
19
|
+
| `backgroundColour` | Text | Named background colour |
|
|
20
|
+
| `textColour` | Text | Named text colour |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Reading Collection Fields
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cms-edit open /solutions
|
|
28
|
+
cms-edit snapshot
|
|
29
|
+
# A collection appears as a nested group in the tree, e.g.:
|
|
30
|
+
# @c3 collection [draft] CardGrid
|
|
31
|
+
# @c4 component [draft] Card — Hepatology
|
|
32
|
+
# @c5 component [draft] Card — Dermatology
|
|
33
|
+
|
|
34
|
+
cms-edit read @c3 # all fields on the collection
|
|
35
|
+
cms-edit read @c3 heading # just the heading
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Setting Collection Fields
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cms-edit set @c3 heading "Our Solutions"
|
|
44
|
+
cms-edit set @c3 preHeading "What We Do"
|
|
45
|
+
cms-edit rtf @c3 body "An overview of our capabilities.\n\nSelect a speciality below."
|
|
46
|
+
cms-edit set @c3 backgroundColour "Grey"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Adding Child Items
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Add a new child component inside a collection
|
|
55
|
+
cms-edit add Generic component --parent @c3
|
|
56
|
+
|
|
57
|
+
# Re-snapshot after add — refs are renumbered
|
|
58
|
+
cms-edit snapshot
|
|
59
|
+
|
|
60
|
+
# Then set fields on the new child
|
|
61
|
+
cms-edit set @c4 heading "New Card Heading"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Important:** After any `add --parent` operation, all entries that come after the collection in the depth-first tree are renumbered. Always re-snapshot or use variable binding in `run` batches. See `cms-edit help run`.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Reordering Children
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Move a child to a specific position (0-indexed) within its parent
|
|
72
|
+
cms-edit move @c5 0 # move to first position
|
|
73
|
+
cms-edit move @c4 2 # move to third position
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Removing a Child
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cms-edit remove @c5 # unlinks from parent; does not delete the entry
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## In create from-json
|
|
87
|
+
|
|
88
|
+
Collections use `"contentType": "collection"` and their children go in `"items"`. The `items` array maps to the `contents` field in Contentful:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"contentType": "collection",
|
|
93
|
+
"type": "CardGrid",
|
|
94
|
+
"cmsLabel": "Solutions Cards",
|
|
95
|
+
"fields": {
|
|
96
|
+
"heading": "Our Solutions",
|
|
97
|
+
"preHeading": "What We Offer",
|
|
98
|
+
"body": "Choose a speciality area below.\n\n",
|
|
99
|
+
"backgroundColour": "Grey"
|
|
100
|
+
},
|
|
101
|
+
"links": [
|
|
102
|
+
{ "type": "internal", "label": "See All Solutions", "slug": "/solutions" }
|
|
103
|
+
],
|
|
104
|
+
"items": [
|
|
105
|
+
{
|
|
106
|
+
"contentType": "component",
|
|
107
|
+
"type": "Generic",
|
|
108
|
+
"cmsLabel": "Card — Hepatology",
|
|
109
|
+
"fields": {
|
|
110
|
+
"heading": "Hepatology",
|
|
111
|
+
"body": "Evidence generation for liver disease.\n\n"
|
|
112
|
+
},
|
|
113
|
+
"links": [
|
|
114
|
+
{ "type": "internal", "label": "Learn More", "slug": "/solutions/hepatology" }
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"contentType": "component",
|
|
119
|
+
"type": "Generic",
|
|
120
|
+
"cmsLabel": "Card — Dermatology",
|
|
121
|
+
"fields": {
|
|
122
|
+
"heading": "Dermatology",
|
|
123
|
+
"body": "Real-world data for skin conditions.\n\n"
|
|
124
|
+
},
|
|
125
|
+
"links": [
|
|
126
|
+
{ "type": "internal", "label": "Learn More", "slug": "/solutions/dermatology" }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Note:** Internal links in `items[].links` must resolve — the target pages must exist in Contentful before running `create from-json`. Use `--dry-run` to validate all slugs first. See `cms-edit help create-from-json`.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# cms-edit — Component Field Reference
|
|
2
|
+
|
|
3
|
+
A `component` entry is an individual content section — a hero, text block, card, timeline item, etc. The `componentType` field picks which visual variant to render.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Fields
|
|
8
|
+
|
|
9
|
+
| Field | Type | Description |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `cmsLabel` | Text | Human-readable label in Contentful's entry list |
|
|
12
|
+
| `componentType` | Text | Variant discriminator — e.g. `HeroSimple`, `TextBlock`, `Generic`. Run `cms-edit types` to see valid values |
|
|
13
|
+
| `heading` | Text | Main heading text |
|
|
14
|
+
| `preHeading` | Text | Small label above the heading. Rendered as `<p>`, not a heading tag |
|
|
15
|
+
| `postHeading` | Text | Small label below the heading. Rendered as `<p>`, not a heading tag |
|
|
16
|
+
| `body` | RichText | Main body content. Accepts markdown in `create from-json` and `run rtf` |
|
|
17
|
+
| `links` | Array of Links | CTA link entries attached to this component |
|
|
18
|
+
| `visual` | Link (Asset or Entry) | Primary visual: image asset or responsive visual entry |
|
|
19
|
+
| `mobileVisual` | Link (Asset or Entry) | Alternative visual for mobile viewports |
|
|
20
|
+
| `backgroundColour` | Text | Named colour. Run `cms-edit colours` to see valid values |
|
|
21
|
+
| `textColour` | Text | Named colour for text. Run `cms-edit colours` to see valid values |
|
|
22
|
+
|
|
23
|
+
Not all components use all fields — unused fields are simply null.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Reading Component Fields
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cms-edit open /solutions/hepatology
|
|
31
|
+
cms-edit snapshot
|
|
32
|
+
cms-edit read @c1 # all fields on the first component
|
|
33
|
+
cms-edit read @c1 heading # just the heading
|
|
34
|
+
cms-edit read @c1 body # rich text summary
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Setting Scalar Fields
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cms-edit set @c1 heading "New Heading"
|
|
43
|
+
cms-edit set @c1 preHeading "Our Speciality"
|
|
44
|
+
cms-edit set @c1 postHeading null # clear the field
|
|
45
|
+
cms-edit set @c1 backgroundColour "Navy"
|
|
46
|
+
cms-edit set @c1 textColour "White"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Setting Rich Text (body)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Inline markdown
|
|
55
|
+
cms-edit rtf @c1 body "## Overview\n\nFirst paragraph.\n\nSecond paragraph."
|
|
56
|
+
|
|
57
|
+
# From a file
|
|
58
|
+
cms-edit rtf @c1 body --file content/body.md
|
|
59
|
+
|
|
60
|
+
# Find and replace within existing rich text
|
|
61
|
+
cms-edit rtf replace @c1 body --find "old text" --replace-plain "new text"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Rich text rules:**
|
|
65
|
+
- Single sentences must include `\n\n` to be converted to a paragraph: `"One sentence.\n\n"`
|
|
66
|
+
- The `body` field is always RichText — the schema ensures correct conversion
|
|
67
|
+
- Headings, lists, bold, italic, and links are all supported in markdown
|
|
68
|
+
|
|
69
|
+
**Markdown examples:**
|
|
70
|
+
```
|
|
71
|
+
# Heading 1
|
|
72
|
+
## Heading 2
|
|
73
|
+
|
|
74
|
+
Plain paragraph text.
|
|
75
|
+
|
|
76
|
+
**Bold text** and _italic text_.
|
|
77
|
+
|
|
78
|
+
- List item one
|
|
79
|
+
- List item two
|
|
80
|
+
- Nested item
|
|
81
|
+
|
|
82
|
+
[Link text](https://example.com)
|
|
83
|
+
|
|
84
|
+
> A blockquote
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Managing CTA Links
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# List existing links
|
|
93
|
+
cms-edit links list @c1
|
|
94
|
+
|
|
95
|
+
# Add a new external link
|
|
96
|
+
cms-edit links add @c1 --type external --label "Learn More" --href "https://example.com"
|
|
97
|
+
|
|
98
|
+
# Add an internal link (resolves slug to entry)
|
|
99
|
+
cms-edit links add @c1 --type internal --label "Our Team" --slug /about/team
|
|
100
|
+
|
|
101
|
+
# Add a download link
|
|
102
|
+
cms-edit links add @c1 --type download --label "Download PDF" --asset-id <assetId>
|
|
103
|
+
|
|
104
|
+
# Remove a link (by index)
|
|
105
|
+
cms-edit links remove @c1 0
|
|
106
|
+
|
|
107
|
+
# Reorder links
|
|
108
|
+
cms-edit links move @c1 1 0 # move index 1 to index 0
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Setting Visuals
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Link an asset directly
|
|
117
|
+
cms-edit set @c1 visual --asset <assetId>
|
|
118
|
+
|
|
119
|
+
# Search for assets
|
|
120
|
+
cms-edit asset search "hepatology"
|
|
121
|
+
|
|
122
|
+
# Get asset info
|
|
123
|
+
cms-edit asset info <assetId>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## In create from-json
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"contentType": "component",
|
|
133
|
+
"type": "HeroSimple",
|
|
134
|
+
"cmsLabel": "Homepage Hero",
|
|
135
|
+
"fields": {
|
|
136
|
+
"heading": "Headline text",
|
|
137
|
+
"preHeading": "Label above",
|
|
138
|
+
"postHeading": "Label below",
|
|
139
|
+
"body": "Opening paragraph.\n\nSecond paragraph.",
|
|
140
|
+
"backgroundColour": "Navy",
|
|
141
|
+
"textColour": "White"
|
|
142
|
+
},
|
|
143
|
+
"links": [
|
|
144
|
+
{ "type": "internal", "label": "Learn More", "slug": "/about" },
|
|
145
|
+
{ "type": "external", "label": "Contact", "href": "https://example.com/contact" }
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Visual fields (images) cannot be set directly in `create from-json` — link them afterwards with `cms-edit set @cN visual --asset <assetId>`.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# cms-edit — Page Field Reference
|
|
2
|
+
|
|
3
|
+
A `page` entry is the root of a web page's content tree. It has a slug, metadata, and arrays of content components.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Top-Level Fields
|
|
8
|
+
|
|
9
|
+
| Field | Type | Required | Description |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| `slug` | Text | Yes | URL slug without leading slash. Example: `solutions/hepatology` |
|
|
12
|
+
| `title` | Text | Yes | Page title used in `<title>` and headings |
|
|
13
|
+
| `description` | Text | No | SEO meta description |
|
|
14
|
+
| `cmsLabel` | Text | No | Label shown in Contentful's entry list. Defaults to `title` |
|
|
15
|
+
| `indexed` | Boolean | No | Whether the page is indexed by search engines |
|
|
16
|
+
| `hidden` | Boolean | No | Whether the page is excluded from the sitemap |
|
|
17
|
+
| `template` | Link (Entry) | No | Link to a `template` entry for shared layout slots |
|
|
18
|
+
| `featuredImage` | Link (Asset) | No | Featured image asset for social sharing |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Content Arrays
|
|
23
|
+
|
|
24
|
+
A page has three content slot arrays. Components are rendered in order within each slot.
|
|
25
|
+
|
|
26
|
+
| Field | Type | Description |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `topContent` | Array of Links | Content rendered above the main content area (e.g. sticky nav, announcement bar) |
|
|
29
|
+
| `content` | Array of Links | Main content area. **Default target for `add` and `create from-json`** |
|
|
30
|
+
| `bottomContent` | Array of Links | Content rendered below the main content area (e.g. newsletter signup) |
|
|
31
|
+
|
|
32
|
+
Each array entry is a link to a `component`, `collection`, or `externalComponent` entry.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Reading Page Fields
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cms-edit open /solutions
|
|
40
|
+
cms-edit read @c0 # read all fields on the page entry
|
|
41
|
+
cms-edit read @c0 title # read just the title
|
|
42
|
+
cms-edit read @c0 slug
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Setting Page Fields
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cms-edit set @c0 title "New Title"
|
|
51
|
+
cms-edit set @c0 description "Updated SEO description."
|
|
52
|
+
cms-edit set @c0 indexed true
|
|
53
|
+
cms-edit set @c0 hidden false
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Linking a Template
|
|
59
|
+
|
|
60
|
+
To link a template to a page, use the template entry ID:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
cms-edit set @c0 template --link <templateEntryId>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Or in `create from-json`:
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"slug": "/new-page",
|
|
70
|
+
"title": "New Page",
|
|
71
|
+
"templateId": "<templateEntryId>"
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Find template IDs with:
|
|
76
|
+
```bash
|
|
77
|
+
cms-edit list --type template
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Adding Content to a Page
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Add a new component to the default content array
|
|
86
|
+
cms-edit add HeroSimple component
|
|
87
|
+
|
|
88
|
+
# Add to topContent
|
|
89
|
+
cms-edit add AnnouncementBar component --target topContent
|
|
90
|
+
|
|
91
|
+
# Add to bottomContent
|
|
92
|
+
cms-edit add NewsletterSignup component --target bottomContent
|
|
93
|
+
|
|
94
|
+
# Insert after a specific entry
|
|
95
|
+
cms-edit add TextBlock component --after @c3
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## In create from-json
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"type": "page",
|
|
105
|
+
"slug": "/solutions/hepatology",
|
|
106
|
+
"title": "Hepatology Solutions",
|
|
107
|
+
"description": "Evidence generation for hepatology research.",
|
|
108
|
+
"cmsLabel": "Hepatology Solutions Page",
|
|
109
|
+
"templateId": "optionalTemplateId",
|
|
110
|
+
"indexed": true,
|
|
111
|
+
"hidden": false,
|
|
112
|
+
"components": [
|
|
113
|
+
{
|
|
114
|
+
"contentType": "component",
|
|
115
|
+
"type": "HeroSimple",
|
|
116
|
+
"target": "content",
|
|
117
|
+
"fields": { "heading": "Hepatology Solutions" }
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# cms-edit — Content Type Field Reference
|
|
2
|
+
|
|
3
|
+
This page lists the content types managed by `cms-edit` and links to their field references.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Content Types
|
|
8
|
+
|
|
9
|
+
| Content Type | Used For | Detail |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `page` | Web pages with a slug and content tree | `cms-edit help fields-page` |
|
|
12
|
+
| `article` | Blog posts and news items | `cms-edit help fields-article` |
|
|
13
|
+
| `component` | Individual content sections (hero, text block, card, etc.) | `cms-edit help fields-component` |
|
|
14
|
+
| `collection` | Groups of components (card grids, timelines, etc.) | `cms-edit help fields-collection` |
|
|
15
|
+
| `link` | CTA button entries | Managed via `cms-edit links` |
|
|
16
|
+
| `template` | Reusable page shell (header, footer slots) | Used via `templateId` in `create from-json` |
|
|
17
|
+
| `navigation` | Site navigation entries | Managed via `cms-edit nav` |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Type Discriminators
|
|
22
|
+
|
|
23
|
+
Many content types have a `*Type` field that picks a specific variant:
|
|
24
|
+
|
|
25
|
+
| Content Type | Discriminator Field | Values |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `component` | `componentType` | `HeroSimple`, `TextBlock`, `CardGrid`, `Generic`, etc. |
|
|
28
|
+
| `collection` | `collectionType` | `CardGrid`, `Timeline`, `CategoryExplorer`, etc. |
|
|
29
|
+
|
|
30
|
+
Run `cms-edit types` to see all valid discriminator values for the current space.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Colour Fields
|
|
35
|
+
|
|
36
|
+
The `backgroundColour` and `textColour` fields accept named values, not hex codes.
|
|
37
|
+
|
|
38
|
+
Run `cms-edit colours` to see valid values for the current space.
|
|
39
|
+
|
|
40
|
+
Common values: `"Navy"`, `"White"`, `"Grey"`, `"Black"`, `"Brand"`.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Ref Addressing
|
|
45
|
+
|
|
46
|
+
When a session is open (after `cms-edit open`), entries are addressed by `@ref`:
|
|
47
|
+
|
|
48
|
+
- `@c0` — the root page/article entry
|
|
49
|
+
- `@c1`, `@c2`, ... — entries in depth-first traversal order
|
|
50
|
+
|
|
51
|
+
Run `cms-edit snapshot` to see current refs.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Field Detail Pages
|
|
56
|
+
|
|
57
|
+
- `cms-edit help fields-page` — page entry fields
|
|
58
|
+
- `cms-edit help fields-article` — article entry fields
|
|
59
|
+
- `cms-edit help fields-component` — component entry fields
|
|
60
|
+
- `cms-edit help fields-collection` — collection entry fields
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# cms-edit — Help Index
|
|
2
|
+
|
|
3
|
+
`cms-edit` is an opinionated CLI for reading and editing Contentful draft content across SE Studio apps. It provides a snapshot → ref → edit → save workflow. **All writes create drafts — nothing is published automatically.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## How to Get Help
|
|
8
|
+
|
|
9
|
+
| Command | What you get |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `cms-edit` | Command list + one-line descriptions |
|
|
12
|
+
| `cms-edit <command> --help` | Options and synopsis for a command |
|
|
13
|
+
| `cms-edit help <topic>` | Full narrative help with examples |
|
|
14
|
+
|
|
15
|
+
Available topics for `cms-edit help <topic>`:
|
|
16
|
+
|
|
17
|
+
| Topic | Contents |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `workflow` | Standard editing workflow — open, snapshot, edit, save |
|
|
20
|
+
| `create-from-json` | Create a new page or article from a JSON file (single-shot) |
|
|
21
|
+
| `run` | Execute a batch of operations from a JSON file |
|
|
22
|
+
| `fields` | Overview of all content types |
|
|
23
|
+
| `fields-page` | All fields on a `page` entry |
|
|
24
|
+
| `fields-article` | All fields on an `article` entry |
|
|
25
|
+
| `fields-component` | All fields on a `component` entry |
|
|
26
|
+
| `fields-collection` | All fields on a `collection` entry |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick-Start One-Liners
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# See what pages exist
|
|
34
|
+
cms-edit sitemap
|
|
35
|
+
|
|
36
|
+
# Open a page and inspect it
|
|
37
|
+
cms-edit open /about
|
|
38
|
+
cms-edit snapshot
|
|
39
|
+
|
|
40
|
+
# Edit a field
|
|
41
|
+
cms-edit set @c1 heading "New heading"
|
|
42
|
+
cms-edit save
|
|
43
|
+
|
|
44
|
+
# Create a complete new page from a JSON definition
|
|
45
|
+
cms-edit create from-json --file my-page.json
|
|
46
|
+
|
|
47
|
+
# Validate a JSON file without writing anything
|
|
48
|
+
cms-edit create from-json --file my-page.json --dry-run
|
|
49
|
+
|
|
50
|
+
# Run a batch of edits
|
|
51
|
+
cms-edit run --file patch.json
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Commands by Category
|
|
57
|
+
|
|
58
|
+
### Navigation & Discovery
|
|
59
|
+
| Command | Description |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `open <slug\|id>` | Load a page/article into the session |
|
|
62
|
+
| `peek <slug\|id>` | Fetch and print a content tree without creating a session |
|
|
63
|
+
| `snapshot` | Re-print the current session's content tree with @refs |
|
|
64
|
+
| `read [@ref] [field]` | Read all fields of a ref, or a specific field |
|
|
65
|
+
| `sitemap` | List all pages with their slugs |
|
|
66
|
+
| `list --type <ct>` | List all entries of a content type |
|
|
67
|
+
| `search <query>` | Full-text search across entries |
|
|
68
|
+
| `resolve <id>` | Resolve a Contentful entry or asset ID |
|
|
69
|
+
| `types` | List valid type-discriminator values |
|
|
70
|
+
| `colours` | List valid backgroundColour / textColour values |
|
|
71
|
+
| `schema` | Display the content model schema |
|
|
72
|
+
| `health` | Check Contentful API connectivity |
|
|
73
|
+
|
|
74
|
+
### Editing
|
|
75
|
+
| Command | Description |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `set <ref> <field> <value>` | Set a scalar, link, or array field |
|
|
78
|
+
| `rtf <ref> <field> <markdown>` | Set a rich text field from markdown |
|
|
79
|
+
| `add <type> <contentType>` | Create and link a new child entry |
|
|
80
|
+
| `remove <ref>` | Unlink an entry from its parent |
|
|
81
|
+
| `move <ref> <position>` | Reorder an entry in its parent array |
|
|
82
|
+
| `links <subcommand>` | Manage CTA link entries |
|
|
83
|
+
| `nav <subcommand>` | Manage navigation entries |
|
|
84
|
+
| `asset <subcommand>` | Work with assets |
|
|
85
|
+
|
|
86
|
+
### Session Management
|
|
87
|
+
| Command | Description |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `diff` | Show unsaved changes |
|
|
90
|
+
| `save` | Write changes to Contentful as drafts |
|
|
91
|
+
| `discard` | Discard unsaved changes |
|
|
92
|
+
| `revert` | Revert an entry to its published version |
|
|
93
|
+
|
|
94
|
+
### Content Creation
|
|
95
|
+
| Command | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `create from-json` | Create a page/article from a JSON file |
|
|
98
|
+
| `create page` | Create a blank page interactively |
|
|
99
|
+
| `create article` | Create a blank article interactively |
|
|
100
|
+
|
|
101
|
+
### Batch Operations
|
|
102
|
+
| Command | Description |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `run --file <path>` | Execute a JSON batch of operations |
|
|
105
|
+
|
|
106
|
+
### Utilities
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `backup` | Snapshot Contentful state |
|
|
110
|
+
| `audit` | Audit content issues (images, alt-text, orphaned) |
|
|
111
|
+
| `screenshot` | Capture a page screenshot |
|
|
112
|
+
| `preview` | Generate preview URLs |
|
|
113
|
+
| `skill` | Manage installed skills |
|
|
114
|
+
| `setup` | Configure Claude Desktop with your credentials |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Global Options
|
|
119
|
+
|
|
120
|
+
| Option | Description |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `--space <name>` | Override the default space from config |
|
|
123
|
+
| `--config <path>` | Path to `.contentful-cms.json` |
|
|
124
|
+
| `--session <name>` | Named session for concurrent workflows |
|
|
125
|
+
| `--json` | Machine-readable JSON output |
|
|
126
|
+
| `--docs` | Print path to the full README |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Further Reading
|
|
131
|
+
|
|
132
|
+
- `cms-edit help workflow` — step-by-step editing guide
|
|
133
|
+
- `cms-edit help create-from-json` — single-shot page creation
|
|
134
|
+
- `cms-edit help run` — batch operations and variable binding
|
|
135
|
+
- `cms-edit help fields-page` — complete page field reference
|
|
136
|
+
- `cms-edit --docs` — full README path (for reading in an editor)
|