@se-studio/contentful-cms 1.2.0 → 1.2.1

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 (148) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/HOSTED.md +1 -1
  3. package/README.md +20 -19
  4. package/dist/commands/backup.js +1 -1
  5. package/dist/commands/backup.js.map +1 -1
  6. package/dist/commands/create-from-json.d.ts.map +1 -1
  7. package/dist/commands/create-from-json.js +11 -7
  8. package/dist/commands/create-from-json.js.map +1 -1
  9. package/dist/commands/create-taxonomy.d.ts +4 -0
  10. package/dist/commands/create-taxonomy.d.ts.map +1 -1
  11. package/dist/commands/create-taxonomy.js +22 -4
  12. package/dist/commands/create-taxonomy.js.map +1 -1
  13. package/dist/commands/create.d.ts.map +1 -1
  14. package/dist/commands/create.js +16 -6
  15. package/dist/commands/create.js.map +1 -1
  16. package/dist/commands/diagnose.d.ts.map +1 -1
  17. package/dist/commands/diagnose.js +1 -1
  18. package/dist/commands/diagnose.js.map +1 -1
  19. package/dist/commands/discard.d.ts.map +1 -1
  20. package/dist/commands/discard.js +1 -1
  21. package/dist/commands/discard.js.map +1 -1
  22. package/dist/commands/ensure.d.ts.map +1 -1
  23. package/dist/commands/ensure.js +8 -0
  24. package/dist/commands/ensure.js.map +1 -1
  25. package/dist/commands/entry-lookup-target.d.ts +113 -0
  26. package/dist/commands/entry-lookup-target.d.ts.map +1 -0
  27. package/dist/commands/entry-lookup-target.js +235 -0
  28. package/dist/commands/entry-lookup-target.js.map +1 -0
  29. package/dist/commands/entry-search.d.ts.map +1 -1
  30. package/dist/commands/entry-search.js +1 -1
  31. package/dist/commands/entry-search.js.map +1 -1
  32. package/dist/commands/help.js +1 -1
  33. package/dist/commands/help.js.map +1 -1
  34. package/dist/commands/index.d.ts.map +1 -1
  35. package/dist/commands/index.js +6 -1
  36. package/dist/commands/index.js.map +1 -1
  37. package/dist/commands/list.d.ts.map +1 -1
  38. package/dist/commands/list.js +31 -9
  39. package/dist/commands/list.js.map +1 -1
  40. package/dist/commands/nav.d.ts.map +1 -1
  41. package/dist/commands/nav.js +39 -22
  42. package/dist/commands/nav.js.map +1 -1
  43. package/dist/commands/open.d.ts.map +1 -1
  44. package/dist/commands/open.js +36 -21
  45. package/dist/commands/open.js.map +1 -1
  46. package/dist/commands/peek.d.ts.map +1 -1
  47. package/dist/commands/peek.js +36 -31
  48. package/dist/commands/peek.js.map +1 -1
  49. package/dist/commands/resolve.d.ts.map +1 -1
  50. package/dist/commands/resolve.js +82 -131
  51. package/dist/commands/resolve.js.map +1 -1
  52. package/dist/commands/screenshot.js +2 -2
  53. package/dist/commands/screenshot.js.map +1 -1
  54. package/dist/commands/set.d.ts.map +1 -1
  55. package/dist/commands/set.js +16 -0
  56. package/dist/commands/set.js.map +1 -1
  57. package/dist/contentful/cda-sync.d.ts +3 -1
  58. package/dist/contentful/cda-sync.d.ts.map +1 -1
  59. package/dist/contentful/cda-sync.js +128 -16
  60. package/dist/contentful/cda-sync.js.map +1 -1
  61. package/dist/contentful/entry-fields.d.ts +1 -0
  62. package/dist/contentful/entry-fields.d.ts.map +1 -1
  63. package/dist/contentful/entry-fields.js +21 -0
  64. package/dist/contentful/entry-fields.js.map +1 -1
  65. package/dist/contentful/entry-lookup.d.ts +16 -0
  66. package/dist/contentful/entry-lookup.d.ts.map +1 -0
  67. package/dist/contentful/entry-lookup.js +273 -0
  68. package/dist/contentful/entry-lookup.js.map +1 -0
  69. package/dist/contentful/fetch.d.ts +1 -1
  70. package/dist/contentful/fetch.d.ts.map +1 -1
  71. package/dist/contentful/fetch.js +8 -2
  72. package/dist/contentful/fetch.js.map +1 -1
  73. package/dist/contentful/reference-record.d.ts +16 -7
  74. package/dist/contentful/reference-record.d.ts.map +1 -1
  75. package/dist/contentful/reference-record.js +57 -16
  76. package/dist/contentful/reference-record.js.map +1 -1
  77. package/dist/contentful/resolve-content-type.d.ts +1 -1
  78. package/dist/contentful/resolve-content-type.d.ts.map +1 -1
  79. package/dist/contentful/resolve-content-type.js +1 -1
  80. package/dist/contentful/resolve-content-type.js.map +1 -1
  81. package/dist/contentful/slug-validation.d.ts +7 -0
  82. package/dist/contentful/slug-validation.d.ts.map +1 -0
  83. package/dist/contentful/slug-validation.js +15 -0
  84. package/dist/contentful/slug-validation.js.map +1 -0
  85. package/dist/generated/hosted-guide.d.ts +1 -1
  86. package/dist/generated/hosted-guide.d.ts.map +1 -1
  87. package/dist/generated/hosted-guide.js +1 -1
  88. package/dist/generated/hosted-guide.js.map +1 -1
  89. package/dist/generated/version.d.ts +1 -1
  90. package/dist/generated/version.js +1 -1
  91. package/dist/index/db.d.ts.map +1 -1
  92. package/dist/index/db.js +17 -0
  93. package/dist/index/db.js.map +1 -1
  94. package/dist/index/query.d.ts +13 -2
  95. package/dist/index/query.d.ts.map +1 -1
  96. package/dist/index/query.js +62 -5
  97. package/dist/index/query.js.map +1 -1
  98. package/dist/index/reference-lookup.d.ts.map +1 -1
  99. package/dist/index/reference-lookup.js +12 -0
  100. package/dist/index/reference-lookup.js.map +1 -1
  101. package/dist/index/require.d.ts.map +1 -1
  102. package/dist/index/require.js +6 -0
  103. package/dist/index/require.js.map +1 -1
  104. package/dist/index/run-sync.d.ts +2 -0
  105. package/dist/index/run-sync.d.ts.map +1 -1
  106. package/dist/index/run-sync.js +25 -4
  107. package/dist/index/run-sync.js.map +1 -1
  108. package/dist/index/schema.d.ts +10 -4
  109. package/dist/index/schema.d.ts.map +1 -1
  110. package/dist/index/schema.js +26 -4
  111. package/dist/index/schema.js.map +1 -1
  112. package/dist/index/sync-lock.d.ts +1 -0
  113. package/dist/index/sync-lock.d.ts.map +1 -1
  114. package/dist/index/sync-lock.js +43 -30
  115. package/dist/index/sync-lock.js.map +1 -1
  116. package/dist/index/sync-log.d.ts +7 -0
  117. package/dist/index/sync-log.d.ts.map +1 -0
  118. package/dist/index/sync-log.js +23 -0
  119. package/dist/index/sync-log.js.map +1 -0
  120. package/dist/index/sync.d.ts.map +1 -1
  121. package/dist/index/sync.js +7 -4
  122. package/dist/index/sync.js.map +1 -1
  123. package/dist/mcp/tools/cms-edit.d.ts +1 -1
  124. package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
  125. package/dist/mcp/tools/cms-edit.js +11 -11
  126. package/dist/session/store.js +2 -2
  127. package/dist/session/store.js.map +1 -1
  128. package/docs/FUNCTIONAL_SPEC.md +9 -8
  129. package/docs/help/create-from-json.md +4 -4
  130. package/docs/help/fields-article.md +2 -2
  131. package/docs/help/fields-collection.md +1 -1
  132. package/docs/help/fields-component.md +1 -1
  133. package/docs/help/fields-page.md +2 -2
  134. package/docs/help/fields-taxonomy.md +8 -4
  135. package/docs/help/index-sync.md +36 -18
  136. package/docs/help/index.md +8 -7
  137. package/docs/help/lookup.md +123 -0
  138. package/docs/help/run.md +1 -1
  139. package/docs/help/taxonomy-from-json.md +2 -2
  140. package/docs/help/workflow.md +6 -6
  141. package/docs/mcp/hosted-guide.md +4 -4
  142. package/package.json +1 -1
  143. package/skills/core/SKILL.md +39 -30
  144. package/skills/templates/SKILL.md +1 -1
  145. package/dist/commands/resolve-options.d.ts +0 -20
  146. package/dist/commands/resolve-options.d.ts.map +0 -1
  147. package/dist/commands/resolve-options.js +0 -51
  148. package/dist/commands/resolve-options.js.map +0 -1
@@ -6,10 +6,12 @@ Taxonomy entries (`tagType`, `articleType`, `tag`) can be created as **drafts**
6
6
  cms-edit create tag-type --slug conference-venue --name "Conference Venue"
7
7
  cms-edit create article-type --slug resources/publications --name "Publications"
8
8
  cms-edit create tag --slug poster-presentation --name "Poster Presentation" --tag-type presentation-type
9
+ cms-edit create tag --slug easl-congress-2026 --name "EASL Congress 2026" --tag-type publication-source \
10
+ --description "Research presented at EASL Congress 2026." --featured-image <logoAssetId>
9
11
 
10
12
  # Idempotent import helpers
11
13
  cms-edit ensure tag-type --slug conference-venue --name "Conference Venue"
12
- cms-edit resolve --type tagType --slug presentation-type
14
+ cms-edit resolve --tag-type-slug presentation-type
13
15
  ```
14
16
 
15
17
  All creates are draft-only. See `cms-edit help taxonomy-from-json` for batch bootstrap.
@@ -21,7 +23,7 @@ All creates are draft-only. See `cms-edit help taxonomy-from-json` for batch boo
21
23
  | Field | Type | Required | Description |
22
24
  |---|---|---|---|
23
25
  | `name` | Text | Yes | Display name |
24
- | `slug` | Text | No | URL slug (normalized; leading `/` stripped) |
26
+ | `slug` | Text | No | URL slug without leading or trailing slash. Example: `part1/part2`. Optional. |
25
27
  | `show` | Boolean | No | Whether tags of this type show visually on cards/detail |
26
28
  | `template` | Link (Entry) | No | Template for tag detail pages |
27
29
  | `topContent` | Array of Links | No | Content above main area on tag detail |
@@ -38,7 +40,7 @@ All creates are draft-only. See `cms-edit help taxonomy-from-json` for batch boo
38
40
  |---|---|---|---|
39
41
  | `name` | Text | Yes | Display name |
40
42
  | `cmsLabel` | Text | Yes | Label in Contentful entry list (defaults to `--name`) |
41
- | `slug` | Text | Yes | URL slug (supports multi-segment paths, e.g. `resources/publications`) |
43
+ | `slug` | Text | Yes | URL slug without leading or trailing slash. Example: `part1/part2/part3`. Use `index` for the home page. |
42
44
  | `indexPageTitle` | Text | Yes | Title on article index page (defaults to `--name`) |
43
45
  | `indexPageDescription` | Text | Yes | Description on article index (defaults to `""`) |
44
46
  | `featuredImage` | Link (Asset) | No | Featured image for index/social |
@@ -71,7 +73,7 @@ All creates are draft-only. See `cms-edit help taxonomy-from-json` for batch boo
71
73
  | `cmsLabel` | Text | Yes | Label in Contentful (defaults to `--name`) |
72
74
  | `name` | Text | Yes | Display name |
73
75
  | `tagType` | Link (Entry) | Yes | Parent tagType entry |
74
- | `slug` | Text | Yes | URL slug within the tag type |
76
+ | `slug` | Text | Yes | URL slug without leading or trailing slash. Example: `part1/part2`. |
75
77
  | `description` | Text | No | Short description |
76
78
  | `featuredImage` | Link (Asset) | No | Featured image |
77
79
  | `visuals` | Array of Links | No | Media/externalVideo entries |
@@ -145,6 +147,8 @@ These top-level keys resolve to Contentful Entry/Asset links (same conventions a
145
147
  | `--slug <slug>` | Required URL slug |
146
148
  | `--name <name>` | Required display name |
147
149
  | `--cms-label <label>` | CMS label (articleType/tag; defaults to name) |
150
+ | `--description <desc>` | Short description (tags only) |
151
+ | `--featured-image <asset-id>` | Asset ID for featured image (tags only) |
148
152
  | `--json-file <path>` | Full field spec (see above) |
149
153
  | `--if-not-exists` | Return existing entry ID when slug matches (exit 0) |
150
154
  | `--dry-run` | Validate field build and link resolution without writing |
@@ -1,6 +1,6 @@
1
1
  # Content index sync
2
2
 
3
- cms-edit keeps a **local SQLite index** per space/environment for fast asset, media, and reference entry discovery. The default index is built from the **Content Preview API** (draft content) — matching cms-edit’s draft-only workflow.
3
+ cms-edit keeps a **local SQLite index** per space/environment for fast asset, media, and **content catalog** discovery. The default index is built from the **Content Preview API** (draft content) — matching cms-edit’s draft-only workflow.
4
4
 
5
5
  ## What gets indexed
6
6
 
@@ -8,7 +8,21 @@ cms-edit keeps a **local SQLite index** per space/environment for fast asset, me
8
8
  |-------|---------|
9
9
  | `assets` | All CDN assets (filename, title, MIME, dimensions) |
10
10
  | `media` | Media wrapper entries linked to assets |
11
- | `reference_entries` | `template`, `articleType`, `tagType`, and `tag` entries (slug, label) |
11
+ | `reference_entries` | Content catalog metadata (no content trees) |
12
+
13
+ ### Catalog content types (schema v3)
14
+
15
+ Typically fewer than ~1000 rows each: `page`, `article`, `pageVariant`, `template`, `articleType`, `tagType`, `tag`, `navigation`, `navigationItem`.
16
+
17
+ Each catalog row stores:
18
+
19
+ | Column | Purpose |
20
+ |--------|---------|
21
+ | `slug` | Normalized URL slug when the type has `slug` |
22
+ | `label` | List line: `title`, `name`, or template cmsLabel |
23
+ | `cmsLabel` | `cmsLabel` when present (page, article, pageVariant, tag, template) |
24
+ | `tagTypeSlug` | Parent tag type slug (tags only) |
25
+ | `articleTypeSlug` | Parent article type slug (articles only) |
12
26
 
13
27
  ## When you need it
14
28
 
@@ -21,18 +35,16 @@ These commands **require** a built index:
21
35
  - `cms-edit asset upload --if-exists-by-filename` (lookup uses the index)
22
36
  - `*AssetFilename` keys in `create from-json`
23
37
 
24
- Reference catalog commands **prefer** the index when present (CMA fallback if missing):
38
+ Catalog commands **prefer** the index when present (CMA fallback if a row is missing):
25
39
 
26
- - `cms-edit list --type template|articleType|tagType|tag` (use `--force-cma` to bypass)
27
- - `cms-edit list --type template --json` — JSON from the index only (no per-row CMA calls)
28
- - `cms-edit resolve --type articleType|tagType|tag --slug …`
29
- - `cms-edit resolve --type template --label …` (or `--slug` as cmsLabel alias)
40
+ - `cms-edit list --type page|article|pageVariant|template|articleType|tagType|tag|navigation|navigationItem`
41
+ - `cms-edit open`, `cms-edit resolve`, `cms-edit nav open` — see [lookup.md](./lookup.md)
30
42
  - `cms-edit create … --if-not-exists` / `ensure` for taxonomy
31
- - `tagTypeSlug` shorthands in JSON create flows
43
+ - `tagTypeSlug` / `tagTypeName` shorthands in JSON create flows
32
44
 
33
- For `--type template`, `--slug` filters by **cmsLabel** (not URL slug). Templates have no slug in the index.
45
+ For `--type template`, `--slug` filters by **cmsLabel** (not URL slug).
34
46
 
35
- General `cms-edit list --type media` without asset filters still uses the management API (entry pagination).
47
+ Use `--force-cma` on `list` to bypass the catalog and paginate via CMA.
36
48
 
37
49
  ## Commands
38
50
 
@@ -40,6 +52,11 @@ General `cms-edit list --type media` without asset filters still uses the manage
40
52
  # Full rebuild (draft/preview content — default)
41
53
  cms-edit index sync
42
54
 
55
+ # Progress on stderr (per-page fetches, catalog types, SQLite write)
56
+ cms-edit index sync --verbose
57
+ # Same via env (also applies to automatic background sync):
58
+ LOG_CMS_INDEX=1 cms-edit index sync
59
+
43
60
  # Check freshness and row counts
44
61
  cms-edit index status
45
62
 
@@ -49,7 +66,7 @@ cms-edit index dump --all
49
66
  cms-edit index dump --type image/ -n 20
50
67
  cms-edit index dump --assets-only --skip 50
51
68
  cms-edit index dump --reference-only
52
- cms-edit index dump --reference-type template
69
+ cms-edit index dump --reference-type page
53
70
 
54
71
  # Published content only (separate database file suffix -published)
55
72
  cms-edit index sync --published
@@ -65,15 +82,15 @@ Commands that depend on the index call **`ensureContentIndex`** internally. You
65
82
  | Condition | Auto-sync behaviour |
66
83
  |-----------|---------------------|
67
84
  | Index missing | **Full** rebuild |
68
- | Schema version outdated (e.g. v1 → v2) | **Full** rebuild |
85
+ | Schema version outdated (e.g. v2 → v3) | **Full** rebuild |
69
86
  | Last sync older than **24 hours** | **Incremental** upsert (`sys.updatedAt[gte]` last `syncedAt`) |
70
87
  | Index fresh | No sync |
71
88
 
72
89
  Manual `cms-edit index sync` always performs a **full** rebuild.
73
90
 
74
- **Incremental limitations:** Only rows changed since the last sync are fetched. Entries deleted in Contentful may remain in the index until the next full `index sync`. Duplicate slug/label rows in the index cause `resolve` to fail with an explicit error (fix in Contentful, then full sync).
91
+ **Incremental limitations:** Only rows changed since the last sync are fetched. Entries deleted in Contentful may remain in the index until the next full `index sync`. Duplicate slug/label/cmsLabel rows in the index cause lookup commands to fail with an explicit error (fix in Contentful, then full sync).
75
92
 
76
- **Single writer:** Only one cms-edit process syncs a given database at a time (file lock beside `media.db`). A second process waits up to 10 minutes, then errors.
93
+ **Single writer:** Only one cms-edit process syncs a given database at a time (file lock beside `media.db`). If another sync is in progress, the command **fails immediately** (exit code 1) with the lock path and holder pid/start time. Stale locks (>30 min or dead pid) are removed automatically.
77
94
 
78
95
  ## Preview / delivery API token
79
96
 
@@ -100,9 +117,10 @@ If CMA cannot read API keys, set `previewAccessToken` or `deliveryAccessToken` m
100
117
  ```bash
101
118
  cms-edit index sync
102
119
  cms-edit asset search --filename-match 'istock.*'
103
- cms-edit list --type media --asset-filename hero.jpg
104
- cms-edit list --type template
105
- cms-edit resolve --type tagType --slug topic
120
+ cms-edit list --type page
121
+ cms-edit list --type article --article-type-name "Publications"
122
+ cms-edit resolve --tag-type-slug topic
123
+ cms-edit open --page-slug /about
106
124
  ```
107
125
 
108
- See [MEDIA_INDEX_PLAN.md](../MEDIA_INDEX_PLAN.md) for architecture details.
126
+ See [lookup.md](./lookup.md) for all `open` / `resolve` flags. See [MEDIA_INDEX_PLAN.md](../MEDIA_INDEX_PLAN.md) for architecture details.
@@ -27,7 +27,8 @@ Available topics for `cms-edit help <topic>`:
27
27
  | `fields-component` | All fields on a `component` entry |
28
28
  | `fields-collection` | All fields on a `collection` entry |
29
29
  | `fields-taxonomy` | All fields on `tagType`, `articleType`, and `tag` entries |
30
- | `index-sync` | Build and use the local media index (CDA sync) |
30
+ | `index-sync` | Build and use the local content index (CDA sync) |
31
+ | `lookup` | Flat flags for `open`, `resolve`, and `nav open` |
31
32
 
32
33
  ---
33
34
 
@@ -38,7 +39,7 @@ Available topics for `cms-edit help <topic>`:
38
39
  cms-edit sitemap
39
40
 
40
41
  # Open a page and inspect it
41
- cms-edit open /about
42
+ cms-edit open --page-slug /about
42
43
  cms-edit snapshot
43
44
 
44
45
  # Edit a field
@@ -67,10 +68,10 @@ cms-edit run --file patch.json
67
68
  ### Navigation & Discovery
68
69
  | Command | Description |
69
70
  |---|---|
70
- | `open <slug>` | Load a page/article into the session by slug |
71
- | `open <id> --id` | Load by Contentful entry ID |
72
- | `peek <slug>` | Print content tree + root field values without creating a session |
73
- | `peek <id> --id` | Same by Contentful entry ID (required for 12-char IDs) |
71
+ | `open --page-slug <slug>` | Load a page into the session (see `help lookup`) |
72
+ | `open --id <id>` | Load by Contentful entry ID |
73
+ | `peek --page-slug <slug>` | Print content tree + root field values without creating a session |
74
+ | `peek --id <id>` | Same by Contentful entry ID |
74
75
  | `snapshot` | Re-print the current session's content tree with @refs |
75
76
  | `read [@ref] [field]` | Read fields from the active session (@refs from snapshot) |
76
77
  | `read <id> --id [field]` | Read entry fields by ID without an open session |
@@ -78,7 +79,7 @@ cms-edit run --file patch.json
78
79
  | `list --type <ct>` | List all entries of a content type |
79
80
  | `search <query>` | Full-text search across entries |
80
81
  | `resolve <id>` | Resolve a Contentful entry or asset ID |
81
- | `resolve --type <type> --slug <slug>` | Resolve an entry by content type and slug (no session) |
82
+ | `resolve --page-slug <slug>` | Resolve an entry by flat lookup flag (no session); see `help lookup` |
82
83
  | `ensure tag-type\|tag\|article-type …` | Idempotent taxonomy create (returns existing entry if slug matches) |
83
84
  | `types` | List valid type-discriminator values |
84
85
  | `colours` | List valid backgroundColour / textColour values |
@@ -0,0 +1,123 @@
1
+ # Flat lookup flags (`open`, `resolve`, `nav open`)
2
+
3
+ cms-edit resolves entries using **explicit flags** — not positional slugs. Provide **exactly one** primary lookup flag per command. Scope flags (for example `--tag-type-name` with `--tag-name`) do not count as a second primary.
4
+
5
+ Run `cms-edit index sync` once per space (or let commands auto-sync) so catalog types resolve from the local index.
6
+
7
+ ## Commands
8
+
9
+ | Command | Purpose |
10
+ |---------|---------|
11
+ | `cms-edit open` | Start an editing session |
12
+ | `cms-edit peek` | Preview tree + root fields without a session |
13
+ | `cms-edit resolve` | Print entry summary or `--json` (no session) |
14
+ | `cms-edit nav open` | Open a `navigation` entry session |
15
+
16
+ ## Entry ID
17
+
18
+ ```bash
19
+ cms-edit open --id 4xKj2abcDefGhijK
20
+ cms-edit resolve --id 4xKj2abcDefGhijK
21
+ ```
22
+
23
+ ## Pages
24
+
25
+ | Flag | Contentful field |
26
+ |------|------------------|
27
+ | `--page-slug` | `slug` (leading/trailing `/` stripped) |
28
+ | `--page-title` | `title` |
29
+ | `--page-cms-label` | `cmsLabel` |
30
+
31
+ ```bash
32
+ cms-edit open --page-slug /pricing/
33
+ cms-edit peek --page-slug /pricing/
34
+ cms-edit open --page-cms-label "Hepatology Solutions Page"
35
+ cms-edit resolve --page-title "Test page for nick"
36
+ ```
37
+
38
+ ## Articles
39
+
40
+ | Flag | Contentful field |
41
+ |------|------------------|
42
+ | `--article-slug` | `slug` |
43
+ | `--article-title` | `title` |
44
+ | `--article-cms-label` | `cmsLabel` |
45
+
46
+ ```bash
47
+ cms-edit open --article-slug resources/publications/my-post
48
+ cms-edit list --type article --article-type-name "Publications"
49
+ ```
50
+
51
+ ## Page variants
52
+
53
+ | Flag | Contentful field |
54
+ |------|------------------|
55
+ | `--page-variant-slug` | `slug` |
56
+ | `--page-variant-title` | `title` |
57
+ | `--page-variant-cms-label` | `cmsLabel` |
58
+
59
+ ## Taxonomy
60
+
61
+ | Type | Slug | Name | cmsLabel |
62
+ |------|------|------|----------|
63
+ | tag | `--tag-slug` | `--tag-name` | `--tag-cms-label` |
64
+ | tagType | `--tag-type-slug` | `--tag-type-name` | — |
65
+ | articleType | `--article-type-slug` | `--article-type-name` | — |
66
+
67
+ Scope tags under a tag type (optional):
68
+
69
+ ```bash
70
+ cms-edit resolve --tag-name "Hepatology" --tag-type-name "Therapeutic Area"
71
+ cms-edit list --type tag --tag-type-slug therapeutic-area
72
+ ```
73
+
74
+ Templates use **cmsLabel** only:
75
+
76
+ ```bash
77
+ cms-edit open --template-label "Default page template"
78
+ cms-edit resolve --label "Default page template" # alias for --template-label
79
+ ```
80
+
81
+ ## Navigation
82
+
83
+ Navigation entries use the **`name`** field (not slug).
84
+
85
+ | Flag | Resolves |
86
+ |------|----------|
87
+ | `--nav-id` | `navigation` entry ID |
88
+ | `--nav-name` | `navigation.fields.name` |
89
+ | `--nav-item-id` | `navigationItem` entry ID |
90
+ | `--nav-item-title` | `navigationItem.fields.title` |
91
+
92
+ When multiple nav items share a title, add **`--nav-id`** to scope:
93
+
94
+ ```bash
95
+ cms-edit nav open --nav-name "Main header"
96
+ cms-edit resolve --nav-item-title "Contact" --nav-id <navigation-entry-id>
97
+ ```
98
+
99
+ ## List filters (index)
100
+
101
+ ```bash
102
+ cms-edit list --type page
103
+ cms-edit list --type article --article-type-slug resources/publications
104
+ cms-edit list --type tag --tag-type-name "Therapeutic Area"
105
+ cms-edit list --type navigation
106
+ cms-edit list --type navigationItem
107
+ ```
108
+
109
+ Use `--force-cma` to paginate via the Management API instead of the catalog.
110
+
111
+ ## Breaking changes (1.x → catalog flags)
112
+
113
+ | Old | New |
114
+ |-----|-----|
115
+ | `cms-edit open /pricing` | `cms-edit open --page-slug pricing` |
116
+ | `cms-edit peek /pricing` | `cms-edit peek --page-slug pricing` |
117
+ | `cms-edit open <id> --id` | `cms-edit open --id <id>` |
118
+ | `cms-edit nav open footer` | `cms-edit nav open --nav-name "Footer"` |
119
+ | `cms-edit resolve --type tag --slug x` | `cms-edit resolve --tag-slug x` |
120
+
121
+ ## Ambiguity
122
+
123
+ If two entries share the same slug, title, or cmsLabel in the index, cms-edit prints all matching IDs and exits with an error. Fix duplicates in Contentful or resolve by `--id`.
package/docs/help/run.md CHANGED
@@ -202,7 +202,7 @@ Run:
202
202
  ```bash
203
203
  cms-edit run --file patch.json --dry-run # validate first
204
204
  cms-edit run --file patch.json # apply
205
- cms-edit open /solutions # inspect result
205
+ cms-edit open --page-slug /solutions # inspect result
206
206
  ```
207
207
 
208
208
  ---
@@ -95,8 +95,8 @@ Combine batch bootstrap with `ensure` and `resolve` for script-friendly imports:
95
95
  cms-edit create taxonomy-from-json --file taxonomy.json --if-not-exists
96
96
 
97
97
  # Look up IDs in scripts
98
- cms-edit resolve --type tagType --slug presentation-type --json
99
- cms-edit resolve --type tag --slug asco-2025 --json
98
+ cms-edit resolve --tag-type-slug presentation-type --json
99
+ cms-edit resolve --tag-slug asco-2025 --json
100
100
 
101
101
  # Add a single entry idempotently
102
102
  cms-edit ensure tag --slug new-tag --name "New Tag" --tag-type presentation-type
@@ -19,9 +19,9 @@ cms-edit search "hepatology"
19
19
  ## Step 2: Open a Page or Article
20
20
 
21
21
  ```bash
22
- cms-edit open /solutions/hepatology
22
+ cms-edit open --page-slug /solutions/hepatology
23
23
  # or by entry ID:
24
- cms-edit open 4xKpzQ2abc123
24
+ cms-edit open --id 4xKpzQ2abc123
25
25
  ```
26
26
 
27
27
  `open` fetches the full entry tree and saves it to a local session file. All subsequent commands operate on this session without re-fetching from Contentful until you `save`.
@@ -136,7 +136,7 @@ Writes all changes to Contentful as **drafts**. Nothing is published. A human mu
136
136
 
137
137
  ### Edit a specific component's heading and body
138
138
  ```bash
139
- cms-edit open /about
139
+ cms-edit open --page-slug /about
140
140
  cms-edit snapshot
141
141
  cms-edit set @c3 heading "Updated heading"
142
142
  cms-edit rtf @c3 body "New body text\n\nSecond paragraph."
@@ -146,7 +146,7 @@ cms-edit save
146
146
 
147
147
  ### Add a new section to an existing page
148
148
  ```bash
149
- cms-edit open /home
149
+ cms-edit open --page-slug /home
150
150
  cms-edit snapshot
151
151
  # Add a new Text Block after @c2
152
152
  cms-edit add TextBlock component --after @c2
@@ -159,11 +159,11 @@ cms-edit save
159
159
  ### Fix a field on multiple pages
160
160
  Use `--session` to work on multiple pages without losing state:
161
161
  ```bash
162
- cms-edit --session fix-1 open /page-one
162
+ cms-edit --session fix-1 open --page-slug /page-one
163
163
  cms-edit --session fix-1 set @c1 heading "Fixed"
164
164
  cms-edit --session fix-1 save
165
165
 
166
- cms-edit --session fix-2 open /page-two
166
+ cms-edit --session fix-2 open --page-slug /page-two
167
167
  cms-edit --session fix-2 set @c1 heading "Fixed"
168
168
  cms-edit --session fix-2 save
169
169
  ```
@@ -146,13 +146,13 @@ Asset search and media-by-filename list **require** the index. Template/taxonomy
146
146
 
147
147
  | Goal | MCP args |
148
148
  |------|----------|
149
- | Edit workflow (session) | `["open", "/"]` then `["read", "@c0"]` |
150
- | Preview tree + fields, no session | `["peek", "/pricing"]` or `["peek", "<entry-id>", "--id"]` (JSON includes `rootFields`) |
149
+ | Edit workflow (session) | `["open", "--page-slug", "/"]` then `["read", "@c0"]` |
150
+ | Preview tree + fields, no session | `["peek", "--page-slug", "/pricing"]` or `["peek", "--id", "<entry-id>"]` (JSON includes `rootFields`) |
151
151
  | Read fields by entry ID, no session | `["read", "<entry-id>", "--id"]` or `["read", "<entry-id>", "--id", "heading"]` |
152
152
  | Debug session persistence | `["diagnose"]` — reports store, userId, active session key |
153
153
 
154
154
  - **`peek` is one-shot** — prints tree and **root field values** (`rootFields` in JSON). No session is created; do not chain `read @ref` afterward.
155
- - **Entry IDs need `--id`** for both `open` and `peek` (bare IDs are treated as slugs).
155
+ - **Use flat lookup flags** for `open` and `peek` — same as CLI (`--page-slug`, `--id`, etc.). See `help lookup`.
156
156
  - **`read @root`** only works after `open` (uses the active session). The hint in peek output is for terminal users who already ran `open`.
157
157
  - **Do not invent flags** — there is no `--read`, `--then`, or chained peek+read syntax. One command per `cms_edit` call.
158
158
 
@@ -170,7 +170,7 @@ Asset search and media-by-filename list **require** the index. Template/taxonomy
170
170
 
171
171
  **Discovery:** `sitemap`, `list --type <type>`, `search <query>`, `schema <contentType>`, `index sync`, `index status`
172
172
 
173
- **Reading:** `open <slug>`, `open <id> --id`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`, `peek <slug>`, `peek <id> --id`
173
+ **Reading:** `open --page-slug <slug>`, `open --id <id>`, `peek --page-slug <slug>`, `peek --id <id>`, `snapshot`, `read <ref>`, `read <ref> <field>`, `read <id> --id [field]`
174
174
 
175
175
  **Diagnostics:** `diagnose` — session store, userId, active session (after open/read issues)
176
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/contentful-cms",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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",
@@ -40,20 +40,23 @@ To get the path to the full README (e.g. for an LLM to read): `cms-edit --docs`
40
40
  ### Step 1: Open a page
41
41
 
42
42
  ```bash
43
- # By slug
44
- cms-edit open /pricing
43
+ # By page slug (trailing slash OK)
44
+ cms-edit open --page-slug /pricing
45
+
46
+ # By page cmsLabel (when editors use cmsLabel heavily)
47
+ cms-edit open --page-cms-label "Pricing page"
45
48
 
46
49
  # By slug with explicit space
47
- cms-edit --space om1 open /pricing
50
+ cms-edit --space om1 open --page-slug /pricing
48
51
 
49
52
  # By Contentful entry ID
50
- cms-edit open 4xKj2abcDef --id
53
+ cms-edit open --id 4xKj2abcDef
51
54
 
52
55
  # Home page (slug is 'index')
53
- cms-edit open /
56
+ cms-edit open --page-slug /
54
57
  ```
55
58
 
56
- **Slug `open`:** matches **page**, **article**, **articleType**, and **tag** by `fields.slug` (in that order; first match wins). For **template** or **navigation**, use `open <id> --id` or `cms-edit nav open`.
59
+ **Flat lookup flags:** provide **exactly one** primary flag per `open` / `resolve` / `nav open`. See `cms-edit help lookup`. Run `cms-edit index sync` so catalog types resolve from the local index.
57
60
 
58
61
  ### Step 2: Read the snapshot
59
62
 
@@ -236,7 +239,7 @@ Same as Component plus:
236
239
 
237
240
  When adding body content and a CTA (e.g. PDF download) to an article:
238
241
 
239
- 1. `cms-edit open <article-slug>` (or `open <id> --id`)
242
+ 1. `cms-edit open --article-slug <slug>` (or `open --id <id>`)
240
243
  2. Set body: `cms-edit rtf @<ref> body --markdown "..."` or `--markdown --file path/to.md`. If you need to add a body component first, use `add` then `rtf`.
241
244
  3. `cms-edit add CTA --target bottomContent`
242
245
  4. Set CTA links: use `--type external --label "Download PDF" --href <url>` for an external PDF URL, or `--type download --label "Download PDF" --asset-id <asset-id>` for a Contentful asset (get the ID from `cms-edit asset search "..."` or `asset info <id>`).
@@ -341,13 +344,14 @@ cms-edit set @c5 links linkId4 --links --append
341
344
 
342
345
  ## Assets
343
346
 
344
- **Content index:** Run `cms-edit index sync` once per space before asset search, media-by-filename list, asset audit, or `--if-exists-by-filename`. The same sync also indexes **templates**, **articleType**, **tagType**, and **tag** for fast `list --type` and taxonomy `--if-not-exists`. Default sync uses the **Preview API** (draft content). See `cms-edit help index-sync`.
347
+ **Content index:** Run `cms-edit index sync` once per space before asset search, media-by-filename list, asset audit, or `--if-exists-by-filename`. The same sync indexes the full **content catalog** (pages, articles, taxonomy, navigation, templates) for fast `list`, `open`, and `resolve`. Default sync uses the **Preview API** (draft content). See `cms-edit help index-sync` and `cms-edit help lookup`.
345
348
 
346
349
  ```bash
347
350
  cms-edit index sync
348
351
  cms-edit index status
352
+ cms-edit list --type page
349
353
  cms-edit list --type template
350
- cms-edit resolve --type tagType --slug topic
354
+ cms-edit resolve --tag-type-slug topic
351
355
 
352
356
  # Published-only index (optional)
353
357
  cms-edit index sync --published
@@ -381,8 +385,8 @@ JSON output for upload (`CMS_EDIT_JSON=1`): `{ ok, id, fileName, url, mediaId?,
381
385
  ## Navigation
382
386
 
383
387
  ```bash
384
- # Open a navigation entry
385
- cms-edit nav open main-navigation
388
+ # Open a navigation entry (navigation uses `name`, not slug)
389
+ cms-edit nav open --nav-name "Main navigation"
386
390
 
387
391
  # Add a new item
388
392
  cms-edit nav add --label "Pricing" --slug /pricing
@@ -414,7 +418,10 @@ cms-edit create article --slug /blog/my-post --title "My Post" --article-type-id
414
418
  # Create taxonomy entries (draft only)
415
419
  cms-edit create tag-type --slug conference-venue --name "Conference Venue"
416
420
  cms-edit create article-type --slug resources/publications --name "Publications"
417
- cms-edit create tag --slug poster-presentation --name "Poster Presentation" --tag-type presentation-type
421
+ cms-edit create tag --slug poster-presentation --name "Poster Presentation" --tag-type-slug presentation-type
422
+ # cmsLabel defaults to "<tagType name> — <tag name>" when --cms-label omitted
423
+ cms-edit create tag --slug easl-congress-2026 --name "EASL Congress 2026" --tag-type publication-source \
424
+ --description "Research presented at EASL Congress 2026." --featured-image <logoAssetId>
418
425
 
419
426
  # Full fields via JSON
420
427
  cms-edit create tag --json-file tag.json --tag-type presentation-type --if-not-exists
@@ -424,7 +431,8 @@ cms-edit create taxonomy-from-json --file taxonomy.json --if-not-exists
424
431
 
425
432
  # Idempotent single-entry creates
426
433
  cms-edit ensure tag-type --slug conference-venue --name "Conference Venue"
427
- cms-edit ensure tag --slug asco-2025 --name "ASCO 2025" --tag-type conference-venue
434
+ cms-edit ensure tag --slug asco-2025 --name "ASCO 2025" --tag-type conference-venue \
435
+ --description "Annual ASCO conference." --featured-image <logoAssetId>
428
436
  ```
429
437
 
430
438
  See `cms-edit help fields-taxonomy` and `cms-edit help taxonomy-from-json` for field reference and batch schema.
@@ -433,10 +441,11 @@ See `cms-edit help fields-taxonomy` and `cms-edit help taxonomy-from-json` for f
433
441
 
434
442
  ```bash
435
443
  # Resolve taxonomy IDs without a session
436
- cms-edit resolve --type tag-type --slug presentation-type
444
+ cms-edit resolve --tag-type-slug presentation-type
445
+ cms-edit resolve --tag-name "ASCO 2025" --tag-type-name "Conference Venue"
437
446
  ```
438
447
 
439
- `resolve --type` accepts `page`, `article`, `articleType`, `tagType`, `tag` (kebab aliases such as `tag-type`).
448
+ Use flat flags: `--page-slug`, `--article-cms-label`, `--tag-slug`, `--template-label`, etc. (`cms-edit help lookup`).
440
449
 
441
450
  ## Search and Discovery
442
451
 
@@ -455,11 +464,11 @@ cms-edit list --type article --slug my-article # article with a specific slug
455
464
  cms-edit list --type article --has-field tags # articles where tags field is non-empty
456
465
 
457
466
  # Resolve any entry or asset by ID (no open session required)
458
- cms-edit resolve 4xKj2abcDefGhijK # entry: shows type, title, slug, status
459
- cms-edit resolve 7pQrStuvWxyzAbc # asset: shows title, fileName, URL
460
- cms-edit resolve --type tagType --slug presentation-type
461
- cms-edit resolve --type tag --slug asco-2025
462
- cms-edit resolve <id> --json # full Contentful object
467
+ cms-edit resolve --id 4xKj2abcDefGhijK # entry: shows type, title, slug, status
468
+ cms-edit resolve --id 7pQrStuvWxyzAbc # asset: shows title, fileName, URL
469
+ cms-edit resolve --tag-type-slug presentation-type
470
+ cms-edit resolve --tag-slug asco-2025 --tag-type-slug conference-venue
471
+ cms-edit resolve --tag-type-slug presentation-type --json
463
472
 
464
473
  # Find Media entries by asset
465
474
  cms-edit list --type media --asset-id 7pQrStuvWxyzAbc
@@ -479,8 +488,8 @@ cms-edit resolve <tag-entry-id>
479
488
 
480
489
  ```bash
481
490
  # Specify space explicitly
482
- cms-edit --space brightline open /home
483
- cms-edit --space om1 open /pricing
491
+ cms-edit --space brightline open --page-slug /home
492
+ cms-edit --space om1 open --page-slug /pricing
484
493
  ```
485
494
 
486
495
  Or set `CMS_EDIT_SPACE=om1` environment variable.
@@ -489,7 +498,7 @@ Or set `CMS_EDIT_SPACE=om1` environment variable.
489
498
 
490
499
  ```bash
491
500
  # 1. Open the page
492
- cms-edit open /about-us
501
+ cms-edit open --page-slug /about-us
493
502
 
494
503
  # 2. Find the hero component
495
504
  cms-edit snapshot
@@ -515,7 +524,7 @@ cms-edit save
515
524
 
516
525
  ### Update an existing article
517
526
  ```bash
518
- cms-edit open /blog/old-title --id # or by slug
527
+ cms-edit open --article-slug /blog/old-title # or cms-edit open --id <id>
519
528
  cms-edit set @p0 title "New Article Title" # @p0 works in article sessions too
520
529
  cms-edit set @p0 slug new-article-slug
521
530
  cms-edit set @p0 description "Updated description"
@@ -524,7 +533,7 @@ cms-edit save
524
533
 
525
534
  ### Add a new section to a page
526
535
  ```bash
527
- cms-edit open /products
536
+ cms-edit open --page-slug /products
528
537
  cms-edit types component # discover what's available
529
538
  cms-edit add CTA --after @c3
530
539
  cms-edit set @c4 heading "Ready to get started?"
@@ -535,7 +544,7 @@ cms-edit save
535
544
 
536
545
  ### Reorder page sections
537
546
  ```bash
538
- cms-edit open /home
547
+ cms-edit open --page-slug /home
539
548
  cms-edit snapshot # see current order
540
549
  cms-edit move @c3 --after @c1 # move section 3 to position 2
541
550
  cms-edit save
@@ -682,8 +691,8 @@ cms-edit sitemap --include page,article # Include articles too
682
691
  Inspect a page without affecting your active session.
683
692
 
684
693
  ```bash
685
- cms-edit peek /pricing # Show snapshot of /pricing; your active session is unchanged
686
- cms-edit peek <id> --id # Look up by entry ID
694
+ cms-edit peek --page-slug /pricing # Show snapshot of /pricing; your active session is unchanged
695
+ cms-edit peek --id <entryId> # Look up by entry ID
687
696
  ```
688
697
 
689
698
  ## Batch Operations (run)
@@ -864,8 +873,8 @@ cms-edit sitemap --include page,article # Include articles
864
873
  Use `--session <name>` or `CONTENTFUL_CMS_SESSION=<name>` to isolate parallel workflows.
865
874
 
866
875
  ```bash
867
- cms-edit --session agent-1 open /pricing
868
- cms-edit --session agent-2 open /blog
876
+ cms-edit --session agent-1 open --page-slug /pricing
877
+ cms-edit --session agent-2 open --article-slug /blog
869
878
  ```
870
879
 
871
880
  ## Related skills
@@ -11,7 +11,7 @@ Use this skill when creating or editing **templates** (layout shells with preCon
11
11
 
12
12
  1. **Create** a template: `cms-edit create template --label 'Campaign Landing'`
13
13
  2. **List** templates: `cms-edit list --type template`
14
- 3. **Open** by ID: `cms-edit open <template-id> --id`
14
+ 3. **Open** by cmsLabel or ID: `cms-edit open --template-label "Default"` or `cms-edit open --id <template-id>`
15
15
  4. Edit content: set **preContent** and **postContent** (content arrays) via session snapshot refs; use `add`, `set`, `remove`, `move` as for pages. Set **menu** and **footer** (single navigation links) with `cms-edit set @ref menu <nav-entry-id> --link` and same for `footer`.
16
16
  5. Set **colours**: `cms-edit set @ref backgroundColour Navy`, `cms-edit set @ref textColour White` (or project colour names).
17
17
  6. **Save**: `cms-edit save`
@@ -1,20 +0,0 @@
1
- export type ResolveMode = 'by-slug' | 'by-id';
2
- /**
3
- * Determines how `resolve` should run. Returns null when options are invalid or incomplete.
4
- */
5
- export declare function getResolveMode(id: string | undefined, opts: {
6
- type?: string;
7
- slug?: string;
8
- label?: string;
9
- }): ResolveMode | null;
10
- export declare function resolveBySlugWarning(opts: {
11
- type?: string;
12
- slug?: string;
13
- label?: string;
14
- }, hasPositionalId: boolean): string | null;
15
- export declare function resolveModeErrorMessage(opts: {
16
- type?: string;
17
- slug?: string;
18
- label?: string;
19
- }): string;
20
- //# sourceMappingURL=resolve-options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.ts","sourceRoot":"","sources":["../../src/commands/resolve-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;AAE9C;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACrD,WAAW,GAAG,IAAI,CAuBpB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,eAAe,EAAE,OAAO,GACvB,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAgBT"}