@se-studio/contentful-cms 3.2.1 → 3.4.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/CHANGELOG.md +13 -0
- package/README.md +4 -2
- package/dist/cli/program.d.ts.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +4 -1
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/batch-assignments.d.ts +4 -4
- package/dist/commands/batch-assignments.d.ts.map +1 -1
- package/dist/commands/batch-assignments.js +42 -5
- package/dist/commands/batch-assignments.js.map +1 -1
- package/dist/commands/batch.d.ts.map +1 -1
- package/dist/commands/batch.js +36 -17
- package/dist/commands/batch.js.map +1 -1
- package/dist/commands/media.d.ts +4 -0
- package/dist/commands/media.d.ts.map +1 -0
- package/dist/commands/media.js +124 -0
- package/dist/commands/media.js.map +1 -0
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +40 -4
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/set.d.ts.map +1 -1
- package/dist/commands/set.js +148 -27
- package/dist/commands/set.js.map +1 -1
- package/dist/contentful/set-field-schema.d.ts +5 -0
- package/dist/contentful/set-field-schema.d.ts.map +1 -1
- package/dist/contentful/set-field-schema.js +30 -1
- package/dist/contentful/set-field-schema.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/hosted/index.d.ts +1 -0
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +1 -0
- package/dist/hosted/index.js.map +1 -1
- package/dist/hosted/next/routes/mcp.d.ts.map +1 -1
- package/dist/hosted/next/routes/mcp.js +3 -0
- package/dist/hosted/next/routes/mcp.js.map +1 -1
- package/dist/mcp/prompts/onboarding.d.ts.map +1 -1
- package/dist/mcp/prompts/onboarding.js +11 -8
- package/dist/mcp/prompts/onboarding.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/cms-edit.d.ts +1 -1
- package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
- package/dist/mcp/tools/cms-edit.js +14 -1
- package/dist/mcp/tools/cms-edit.js.map +1 -1
- package/dist/mcp/tools/media.d.ts +4 -0
- package/dist/mcp/tools/media.d.ts.map +1 -0
- package/dist/mcp/tools/media.js +138 -0
- package/dist/mcp/tools/media.js.map +1 -0
- package/dist/media-pipeline/actions.d.ts +30 -0
- package/dist/media-pipeline/actions.d.ts.map +1 -0
- package/dist/media-pipeline/actions.js +257 -0
- package/dist/media-pipeline/actions.js.map +1 -0
- package/dist/media-pipeline/client.d.ts +67 -0
- package/dist/media-pipeline/client.d.ts.map +1 -0
- package/dist/media-pipeline/client.js +75 -0
- package/dist/media-pipeline/client.js.map +1 -0
- package/dist/media-pipeline/config.d.ts +17 -0
- package/dist/media-pipeline/config.d.ts.map +1 -0
- package/dist/media-pipeline/config.js +52 -0
- package/dist/media-pipeline/config.js.map +1 -0
- package/dist/media-pipeline/import.d.ts +19 -0
- package/dist/media-pipeline/import.d.ts.map +1 -0
- package/dist/media-pipeline/import.js +198 -0
- package/dist/media-pipeline/import.js.map +1 -0
- package/dist/media-pipeline/index.d.ts +6 -0
- package/dist/media-pipeline/index.d.ts.map +1 -0
- package/dist/media-pipeline/index.js +6 -0
- package/dist/media-pipeline/index.js.map +1 -0
- package/dist/media-pipeline/job-store.d.ts +41 -0
- package/dist/media-pipeline/job-store.d.ts.map +1 -0
- package/dist/media-pipeline/job-store.js +172 -0
- package/dist/media-pipeline/job-store.js.map +1 -0
- package/dist/media-pipeline/limits.d.ts +14 -0
- package/dist/media-pipeline/limits.d.ts.map +1 -0
- package/dist/media-pipeline/limits.js +14 -0
- package/dist/media-pipeline/limits.js.map +1 -0
- package/dist/media-pipeline/log.d.ts +3 -0
- package/dist/media-pipeline/log.d.ts.map +1 -0
- package/dist/media-pipeline/log.js +12 -0
- package/dist/media-pipeline/log.js.map +1 -0
- package/dist/media-pipeline/validate.d.ts +18 -0
- package/dist/media-pipeline/validate.d.ts.map +1 -0
- package/dist/media-pipeline/validate.js +38 -0
- package/dist/media-pipeline/validate.js.map +1 -0
- package/dist/output/print.d.ts +2 -2
- package/dist/output/print.d.ts.map +1 -1
- package/dist/output/print.js +3 -3
- package/dist/output/print.js.map +1 -1
- package/dist/runtime/context.d.ts +5 -0
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/session/dirty.d.ts +20 -0
- package/dist/session/dirty.d.ts.map +1 -0
- package/dist/session/dirty.js +44 -0
- package/dist/session/dirty.js.map +1 -0
- package/docs/editor-tasks/media-pipeline-prepare.md +65 -69
- package/docs/help/batch.md +29 -13
- package/docs/help/index.md +5 -1
- package/docs/help/workflow.md +47 -0
- package/package.json +1 -1
package/dist/output/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/output/print.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACjC,KAAK,OAAO;YACV,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChC,KAAK,SAAS;YACZ,OAAO,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,OAAO,EAAE,CAAC,IAA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O,CAAC,GAAW;IACjC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW,EAAE,GAAW;IACxC,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import type { CmsEditConfig } from '../config/types.js';
|
|
3
3
|
import type { IndexCacheStore } from '../index/cache-store.js';
|
|
4
|
+
import type { MediaPipelineJobStore } from '../media-pipeline/job-store.js';
|
|
4
5
|
import type { SessionStore } from '../session/session-store.js';
|
|
5
6
|
import type { StagedUploadStore } from '../staged-upload/store.js';
|
|
6
7
|
export interface ContentfulUserIdentity {
|
|
@@ -18,6 +19,10 @@ export interface CmsEditRuntimeContext {
|
|
|
18
19
|
user?: ContentfulUserIdentity;
|
|
19
20
|
/** Staged file uploads for hosted asset upload (Redis). */
|
|
20
21
|
stagedUploadStore?: StagedUploadStore;
|
|
22
|
+
/** Media pipeline job ownership + rate limits (Redis on hosted). */
|
|
23
|
+
mediaPipelineJobStore?: MediaPipelineJobStore;
|
|
24
|
+
/** Hosted project key (e.g. se2026) for media job bindings / logs. */
|
|
25
|
+
projectKey?: string;
|
|
21
26
|
}
|
|
22
27
|
export declare const cmsEditContext: AsyncLocalStorage<CmsEditRuntimeContext>;
|
|
23
28
|
export declare function getRuntimeContext(): CmsEditRuntimeContext | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA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AAE,aAAa,CAAC;IACvB,qEAAqE;IACrE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gEAAgE;IAChE,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,2DAA2D;IAC3D,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,oEAAoE;IACpE,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,0CAAiD,CAAC;AAE7E,wBAAgB,iBAAiB,IAAI,qBAAqB,GAAG,SAAS,CAErE;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,OAAO,EAAE,qBAAqB,EAC9B,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA6BrD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAyB,CAAC;AAE7E,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,OAA8B,EAC9B,EAAwB;IAExB,OAAO,cAAc,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SessionState } from './state.js';
|
|
2
|
+
/** True when the session has staged field edits or pending deletions. */
|
|
3
|
+
export declare function isSessionDirty(session: SessionState): boolean;
|
|
4
|
+
export interface DirtyOpenErrorPayload {
|
|
5
|
+
code: 'SESSION_DIRTY';
|
|
6
|
+
unsavedChanges: number;
|
|
7
|
+
pendingDeletions: number;
|
|
8
|
+
rootEntryId: string;
|
|
9
|
+
rootEntryType: string;
|
|
10
|
+
actions: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface DirtyOpenError {
|
|
13
|
+
message: string;
|
|
14
|
+
payload: DirtyOpenErrorPayload;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Agent-facing hard-fail when `open` would replace a session that still has local work.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatDirtyOpenError(session: SessionState): DirtyOpenError;
|
|
20
|
+
//# sourceMappingURL=dirty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirty.d.ts","sourceRoot":"","sources":["../../src/session/dirty.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,yEAAyE;AACzE,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAE7D;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,eAAe,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,cAAc,CAsC1E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** True when the session has staged field edits or pending deletions. */
|
|
2
|
+
export function isSessionDirty(session) {
|
|
3
|
+
return session.modifiedEntryIds.length > 0 || session.pendingDeletions.length > 0;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Agent-facing hard-fail when `open` would replace a session that still has local work.
|
|
7
|
+
*/
|
|
8
|
+
export function formatDirtyOpenError(session) {
|
|
9
|
+
const unsavedChanges = session.modifiedEntryIds.length;
|
|
10
|
+
const pendingDeletions = session.pendingDeletions.length;
|
|
11
|
+
const rootEntryId = session.rootEntryId;
|
|
12
|
+
const rootEntryType = session.rootEntryType;
|
|
13
|
+
const actions = [
|
|
14
|
+
'cms-edit open --resume',
|
|
15
|
+
'cms-edit diff',
|
|
16
|
+
'cms-edit save',
|
|
17
|
+
'cms-edit discard',
|
|
18
|
+
'cms-edit open --overwrite --id <entryId>',
|
|
19
|
+
];
|
|
20
|
+
const message = [
|
|
21
|
+
`Cannot open: session has ${unsavedChanges} unsaved entry change(s) and ${pendingDeletions} pending deletion(s).`,
|
|
22
|
+
`Root: ${rootEntryId} (${rootEntryType}) — continue this work, or explicitly abandon it.`,
|
|
23
|
+
'',
|
|
24
|
+
' Continue current work: cms-edit open --resume',
|
|
25
|
+
' Review changes: cms-edit diff',
|
|
26
|
+
' Save drafts: cms-edit save',
|
|
27
|
+
' Abandon all staged: cms-edit discard',
|
|
28
|
+
' Abandon and open new: cms-edit open --overwrite --id <entryId>',
|
|
29
|
+
'',
|
|
30
|
+
'Do not re-run open without --overwrite while changes are staged — that previously wiped session field edits.',
|
|
31
|
+
].join('\n');
|
|
32
|
+
return {
|
|
33
|
+
message,
|
|
34
|
+
payload: {
|
|
35
|
+
code: 'SESSION_DIRTY',
|
|
36
|
+
unsavedChanges,
|
|
37
|
+
pendingDeletions,
|
|
38
|
+
rootEntryId,
|
|
39
|
+
rootEntryType,
|
|
40
|
+
actions,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=dirty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirty.js","sourceRoot":"","sources":["../../src/session/dirty.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,OAAqB;IAClD,OAAO,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;AACpF,CAAC;AAgBD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAqB;IACxD,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC;IACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC;IACzD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACxC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAE5C,MAAM,OAAO,GAAG;QACd,wBAAwB;QACxB,eAAe;QACf,eAAe;QACf,kBAAkB;QAClB,0CAA0C;KAC3C,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,4BAA4B,cAAc,gCAAgC,gBAAgB,uBAAuB;QACjH,SAAS,WAAW,KAAK,aAAa,mDAAmD;QACzF,EAAE;QACF,kDAAkD;QAClD,yCAAyC;QACzC,yCAAyC;QACzC,4CAA4C;QAC5C,oEAAoE;QACpE,EAAE;QACF,8GAA8G;KAC/G,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,OAAO;QACL,OAAO;QACP,OAAO,EAAE;YACP,IAAI,EAAE,eAAe;YACrB,cAAc;YACd,gBAAgB;YAChB,WAAW;YACX,aAAa;YACb,OAAO;SACR;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Capability: Media pipeline — prepare pack
|
|
2
2
|
|
|
3
|
-
Normalize a **folder of designer masters**
|
|
3
|
+
Normalize a **folder of designer masters** into short-lived **public HTTPS URLs** under cms-edit upload limits, then import into Contentful with reuse-first.
|
|
4
4
|
|
|
5
|
-
**Never** expect
|
|
5
|
+
**Never** expect the media pipeline service to write Contentful. Pipeline → ready URLs only. **cms-edit** owns assets/entries.
|
|
6
6
|
|
|
7
7
|
## Intent phrases
|
|
8
8
|
|
|
@@ -19,13 +19,14 @@ Normalize a **folder of designer masters** (or inline files) into short-lived **
|
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
22
|
+
- Hosted cms-edit with media pipeline **configured on the host** (ops env):
|
|
23
|
+
- `MEDIA_PIPELINE_BASE_URL`
|
|
24
|
+
- `MEDIA_PIPELINE_SERVICE_KEY` (server-only — **never ask the agent/user for this**)
|
|
25
|
+
- `MEDIA_PIPELINE_TENANT` (e.g. `se`, not the cms-edit projectKey)
|
|
26
|
+
- Drive folder shared **Viewer** with pipeline service account
|
|
26
27
|
`media-pipeline-reader@se-media-pipeline.iam.gserviceaccount.com`
|
|
27
|
-
(or “anyone with the link” if using API-key
|
|
28
|
-
- Profile default: `case-study-v1`
|
|
28
|
+
(or “anyone with the link” if using API-key Drive mode on the pipeline)
|
|
29
|
+
- Profile default: `case-study-v1`
|
|
29
30
|
|
|
30
31
|
## When to use
|
|
31
32
|
|
|
@@ -35,94 +36,89 @@ Normalize a **folder of designer masters** (or inline files) into short-lived **
|
|
|
35
36
|
| Single small image already in library | `task-media-reuse-and-upload` only |
|
|
36
37
|
| Masters already under limits and catalogued | Reuse search only |
|
|
37
38
|
|
|
38
|
-
## Steps
|
|
39
|
+
## Steps (agent — single auth)
|
|
39
40
|
|
|
40
|
-
### 1.
|
|
41
|
+
### 1. Prepare
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
2. Profile (`case-study-v1` unless overridden)
|
|
44
|
-
3. Source:
|
|
45
|
-
- **Preferred:** `google_drive_folder` + folder URL
|
|
46
|
-
- **Dev/test:** `inline_files` with base64 (small files only)
|
|
47
|
-
4. Optional: `ttlHours` (1–24, default 24), `namingPrefix` (defaults from tenant)
|
|
48
|
-
|
|
49
|
-
### 2. Start the pack job
|
|
50
|
-
|
|
51
|
-
```http
|
|
52
|
-
POST {MEDIA_PIPELINE_BASE}/api/v1/jobs
|
|
53
|
-
Authorization: Bearer {MEDIA_PIPELINE_API_KEY}
|
|
54
|
-
Content-Type: application/json
|
|
43
|
+
Call MCP tool **`cms_edit_media`**:
|
|
55
44
|
|
|
45
|
+
```json
|
|
56
46
|
{
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"type": "google_drive_folder",
|
|
61
|
-
"url": "https://drive.google.com/drive/folders/…"
|
|
62
|
-
},
|
|
63
|
-
"options": { "ttlHours": 24 }
|
|
47
|
+
"action": "prepare",
|
|
48
|
+
"driveFolderUrl": "https://drive.google.com/drive/folders/…",
|
|
49
|
+
"profile": "case-study-v1"
|
|
64
50
|
}
|
|
65
51
|
```
|
|
66
52
|
|
|
67
|
-
|
|
53
|
+
CLI: `cms-edit media prepare --drive-folder "https://drive.google.com/drive/folders/…"`
|
|
54
|
+
|
|
55
|
+
Expect `{ ok: true, jobId, status: "queued", pollHint }`.
|
|
56
|
+
|
|
57
|
+
If `{ ok: false, code: "pipeline_unconfigured" }` → host ops must set env vars. **Do not** ask the user for a pipeline API key.
|
|
58
|
+
|
|
59
|
+
### 2. Wait / status
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{ "action": "wait", "jobId": "<jobId>" }
|
|
63
|
+
```
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
or
|
|
70
66
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Authorization: Bearer {MEDIA_PIPELINE_API_KEY}
|
|
67
|
+
```json
|
|
68
|
+
{ "action": "status", "jobId": "<jobId>" }
|
|
74
69
|
```
|
|
75
70
|
|
|
76
71
|
Statuses: `queued` → `running` → `succeeded` | `partial` | `failed`.
|
|
77
72
|
|
|
78
73
|
- **succeeded** — all files ready
|
|
79
|
-
- **partial** — some ready; `gaps[]` lists failures
|
|
74
|
+
- **partial** — some ready; `gaps[]` lists failures
|
|
80
75
|
- **failed** — nothing usable; stop and report gaps
|
|
81
76
|
|
|
82
|
-
**Do not** invent assets for gaps.
|
|
77
|
+
**Do not** invent assets for gaps.
|
|
83
78
|
|
|
84
|
-
###
|
|
85
|
-
|
|
86
|
-
For **each** ready asset in `assets[]`:
|
|
87
|
-
|
|
88
|
-
1. `cms_edit ["index", "sync"]` once per session if catalog may be stale
|
|
89
|
-
2. Search: `asset search` / `--filename-match` using `fileName` or source stem
|
|
90
|
-
3. If no match: **prefer URL upload** (ready URLs are already under limits):
|
|
79
|
+
### 3. Catalog
|
|
91
80
|
|
|
81
|
+
```json
|
|
82
|
+
{ "action": "catalog", "jobId": "<jobId>" }
|
|
92
83
|
```
|
|
93
|
-
cms_edit ["asset", "upload", "--url", "<assets[i].url>", "--mime", "<mime>", "--file-name", "<fileName>", "--title", "<titleDraft>", "--if-exists-by-filename"]
|
|
94
|
-
```
|
|
95
84
|
|
|
96
|
-
|
|
85
|
+
Each asset includes:
|
|
86
|
+
|
|
87
|
+
| Field | Use |
|
|
88
|
+
|-------|-----|
|
|
89
|
+
| `readyUrl` | `asset upload --url` into Contentful |
|
|
90
|
+
| `previewUrl` / `posterUrl` | Agent vision for **title / fileName / alt** (when present) |
|
|
91
|
+
| `altDraft` / `titleDraft` | Filename seeds only — improve before save |
|
|
97
92
|
|
|
98
|
-
4.
|
|
99
|
-
5. Create **Media** wrappers only when needed; **reuse** existing Media entries by asset id
|
|
100
|
-
6. Record map: `sourceName` → `{ assetId, mediaId?, readyUrl }` for the article/page build
|
|
93
|
+
### 4. Import into Contentful (reuse-first)
|
|
101
94
|
|
|
102
|
-
|
|
95
|
+
After drafting titles/alts from **previewUrl** / **posterUrl**:
|
|
103
96
|
|
|
104
|
-
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"action": "import",
|
|
100
|
+
"jobId": "<jobId>",
|
|
101
|
+
"withMedia": true,
|
|
102
|
+
"overrides": [
|
|
103
|
+
{ "sourceName": "OM1_Hero.jpg", "title": "OM1 hero", "alt": "…" }
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
- Soft-proof component order with **real** asset/media ids in the plan
|
|
108
|
+
Optional: `"dryRun": true` to preview the map without writing.
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
CLI: `cms-edit media import --job <id> [--dry-run] [--with-media] [--overrides-json '[…]']`
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
2. Report reuse hits vs new uploads
|
|
113
|
-
3. Do not start multi-block article create until the pack map is complete (or gaps accepted as GO-WITH-GAPS)
|
|
112
|
+
Import:
|
|
114
113
|
|
|
115
|
-
|
|
114
|
+
1. Searches existing assets by fileName
|
|
115
|
+
2. Else uploads from `readyUrl` as the authenticated Contentful user
|
|
116
|
+
3. Returns `map: { sourceName → { assetId, mediaId?, … } }` for page build
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
- Copy rewrite
|
|
119
|
-
- Pipeline writing CMA (forbidden permanently)
|
|
120
|
-
- Video/image creative edits beyond normalize
|
|
118
|
+
Manual `asset upload --url` remains available for one-offs.
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
### Hardening notes (for agents)
|
|
123
121
|
|
|
124
|
-
- `
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
- `task-create-article`
|
|
128
|
-
- `task-preview-verify`
|
|
122
|
+
- Jobs are **owned by the OAuth user** who prepared them — you cannot poll another user’s `jobId`.
|
|
123
|
+
- Rate limits apply (prepares/hour, concurrent jobs).
|
|
124
|
+
- Never document or request `MEDIA_PIPELINE_API_KEY` in chat.
|
package/docs/help/batch.md
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
# Batch edit by entry ID
|
|
2
2
|
|
|
3
|
-
Edit multiple
|
|
3
|
+
Edit multiple Contentful entries by ID with scalar field updates. Useful for link variant sweeps, media flags (`autoplay`/`loop`), navigation tweaks, and other standalone updates.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Sessions
|
|
6
|
+
|
|
7
|
+
| Context | What happens |
|
|
8
|
+
|---------|----------------|
|
|
9
|
+
| Default CLI (`--session` omitted) | Uses session name **`batch`** (does not touch a separate page session) |
|
|
10
|
+
| Page session already open (e.g. MCP `_mcp`) | `batch set` **stages into that page session** — same `diff` / `save` as article work. Do **not** re-`open`. Do **not** `batch discard` (use `cms-edit discard` only if abandoning everything). |
|
|
11
|
+
| Explicit isolation | `cms-edit --session link-sweep batch set …` |
|
|
12
|
+
|
|
13
|
+
You can also stay on the page session without `batch`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cms-edit set <entryId>:autoplay=true <entryId>:loop=true
|
|
17
|
+
# or
|
|
18
|
+
cms-edit set <entryId> autoplay true
|
|
19
|
+
```
|
|
6
20
|
|
|
7
21
|
## Workflow
|
|
8
22
|
|
|
@@ -16,17 +30,25 @@ cms-edit batch diff
|
|
|
16
30
|
# Write all changes as drafts (single save)
|
|
17
31
|
cms-edit batch save
|
|
18
32
|
|
|
19
|
-
# Or discard without saving
|
|
33
|
+
# Or discard without saving (pure batch sessions only)
|
|
20
34
|
cms-edit batch discard
|
|
21
35
|
```
|
|
22
36
|
|
|
37
|
+
Mid-page (MCP / open article session):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cms-edit batch set 5uMh54rIsJRFRQSXDuJiG:autoplay=true
|
|
41
|
+
cms-edit diff
|
|
42
|
+
cms-edit save
|
|
43
|
+
```
|
|
44
|
+
|
|
23
45
|
## Token format
|
|
24
46
|
|
|
25
47
|
```
|
|
26
48
|
<entryId>:<fieldId>=<value>
|
|
27
49
|
```
|
|
28
50
|
|
|
29
|
-
- **entryId** —
|
|
51
|
+
- **entryId** — Contentful entry ID (alphanumeric, optional `_`/`-`, length 1–64; **not** fixed at 22 characters)
|
|
30
52
|
- **fieldId** — field name on that entry's content type
|
|
31
53
|
- **value** — literal token (no shell quotes needed for simple strings). Coercion follows the field type from Contentful:
|
|
32
54
|
- **Symbol** / **Text** — always stored as strings (e.g. `order=42` stays `"42"`)
|
|
@@ -39,6 +61,7 @@ Examples:
|
|
|
39
61
|
|
|
40
62
|
```bash
|
|
41
63
|
cms-edit batch set abcdefghijklmnopqrstuv:variant=link
|
|
64
|
+
cms-edit batch set 5uMh54rIsJRFRQSXDuJiG:autoplay=true
|
|
42
65
|
cms-edit batch set abcdefghijklmnopqrstuv:cmsLabel=Footer CTA
|
|
43
66
|
```
|
|
44
67
|
|
|
@@ -60,7 +83,7 @@ When a page is already open, prefer `cms-edit links set @cN <index> variant link
|
|
|
60
83
|
|
|
61
84
|
Field types and enum validations are loaded from the Contentful Management API. Results are cached:
|
|
62
85
|
|
|
63
|
-
- In the **
|
|
86
|
+
- In the **session file** (`contentTypes` on the session) so `batch set` → save reuse schema without extra API calls
|
|
64
87
|
- On disk at `~/.contentful-cms/content-types/<spaceId>/<environment>/` (24-hour TTL)
|
|
65
88
|
|
|
66
89
|
## v1 limits
|
|
@@ -68,11 +91,4 @@ Field types and enum validations are loaded from the Contentful Management API.
|
|
|
68
91
|
- **Scalar fields only** — no rich text, entry links, asset links, or link arrays
|
|
69
92
|
- **Draft-only** — same as `cms-edit save`; never publishes
|
|
70
93
|
- **No cross-entry link arrays** — use page session + `cms-edit set --links` for parent arrays
|
|
71
|
-
- **Partial save on failure** — if one entry fails during `batch save`, earlier entries may already be saved; the CLI lists failures and reminds you to run
|
|
72
|
-
|
|
73
|
-
## Named sessions
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
cms-edit --session link-sweep batch set idOne123456789012345678:variant=link
|
|
77
|
-
cms-edit --session link-sweep batch save
|
|
78
|
-
```
|
|
94
|
+
- **Partial save on failure** — if one entry fails during `batch save`, earlier entries may already be saved; the CLI lists failures and reminds you to run diff for remaining changes
|
package/docs/help/index.md
CHANGED
|
@@ -84,6 +84,10 @@ cms-edit batch run --json '[...]'
|
|
|
84
84
|
| Command | Description |
|
|
85
85
|
|---|---|
|
|
86
86
|
| `open --page-slug <slug>` | Load a page into the session (see `help lookup`) |
|
|
87
|
+
| `open --resume` | Re-print active session; **keeps** staged edits (no refetch) |
|
|
88
|
+
| `open --overwrite …` | Replace session even if dirty (discards staged field edits) |
|
|
89
|
+
| `set <ref\|id> <field> <value>` | Set field; bare entry IDs allowed mid-session |
|
|
90
|
+
| `set <id>:field=value …` | Scalar multi-set by entry ID (stays on current session) |
|
|
87
91
|
| `open --id <id>` | Load by Contentful entry ID |
|
|
88
92
|
| `peek --page-slug <slug>` | Print content tree + root field values without creating a session |
|
|
89
93
|
| `peek --id <id>` | Same by Contentful entry ID |
|
|
@@ -137,7 +141,7 @@ cms-edit batch run --json '[...]'
|
|
|
137
141
|
### Batch Operations
|
|
138
142
|
| Command | Description |
|
|
139
143
|
|---|---|
|
|
140
|
-
| `batch set <entryId>:field=value …` | Queue scalar updates
|
|
144
|
+
| `batch set <entryId>:field=value …` | Queue scalar updates by ID (page session OK mid-edit; then `save`) |
|
|
141
145
|
| `batch diff` / `batch save` / `batch discard` | Review and commit batch session |
|
|
142
146
|
| `batch run --json <json> or --json-base64 <encoded>` | Execute a JSON batch of operations |
|
|
143
147
|
|
package/docs/help/workflow.md
CHANGED
|
@@ -26,6 +26,25 @@ cms-edit open --id 4xKpzQ2abc123
|
|
|
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`.
|
|
28
28
|
|
|
29
|
+
### Critical: do not re-open while edits are staged
|
|
30
|
+
|
|
31
|
+
`set` / `rtf` / parent links from `add` stay in the session until `save`. Calling `open` again **replaces** the session.
|
|
32
|
+
|
|
33
|
+
| Situation | Command |
|
|
34
|
+
|-----------|---------|
|
|
35
|
+
| Session has unsaved changes, need tree again | `cms-edit open --resume` (no refetch; keeps staged edits) |
|
|
36
|
+
| Intentionally abandon staged work and load another entry | `cms-edit open --overwrite --id <id>` (or `discard` then `open`) |
|
|
37
|
+
| Plain `open` while dirty | **Hard fail** with remediation steps |
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cms-edit open --resume
|
|
41
|
+
cms-edit diff
|
|
42
|
+
cms-edit save
|
|
43
|
+
# or abandon:
|
|
44
|
+
cms-edit discard
|
|
45
|
+
cms-edit open --id <other>
|
|
46
|
+
```
|
|
47
|
+
|
|
29
48
|
**Output:**
|
|
30
49
|
```
|
|
31
50
|
✓ Opened /solutions/hepatology (12 entries)
|
|
@@ -72,6 +91,34 @@ cms-edit set @c2 heading "New Heading"
|
|
|
72
91
|
cms-edit set @c2 backgroundColour "Navy"
|
|
73
92
|
```
|
|
74
93
|
|
|
94
|
+
### Mid-session by Contentful entry ID (e.g. media autoplay)
|
|
95
|
+
|
|
96
|
+
You do **not** need to leave the page session:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Bare entry ID (fetched into the session if not in the tree)
|
|
100
|
+
cms-edit set 5uMh54rIsJRFRQSXDuJiG autoplay true
|
|
101
|
+
|
|
102
|
+
# Same shape as batch set — stays on the current page session
|
|
103
|
+
cms-edit set 5uMh54rIsJRFRQSXDuJiG:autoplay=true 5uMh54rIsJRFRQSXDuJiG:loop=true
|
|
104
|
+
# or: cms-edit batch set … (also allowed mid-page; then cms-edit save)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Entry links: `--link` vs `--links` (strict)
|
|
108
|
+
|
|
109
|
+
| Field shape | Flag | Notes |
|
|
110
|
+
|-------------|------|--------|
|
|
111
|
+
| Single Entry link | `--link` | Exactly one id |
|
|
112
|
+
| Array of Entry links | `--links` | Full replace of the array |
|
|
113
|
+
| Append to array | `--links --append` | Add ids |
|
|
114
|
+
| Wrong flag | hard error | Never silently coerces |
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cms-edit set @c1 visual <mediaEntryId> --link
|
|
118
|
+
cms-edit set @c2 contents <id1>,<id2> --links
|
|
119
|
+
# To change one array item: read the array, edit the list, write all ids back with --links
|
|
120
|
+
```
|
|
121
|
+
|
|
75
122
|
### Rich text fields
|
|
76
123
|
```bash
|
|
77
124
|
# Inline markdown (short content)
|