@se-studio/contentful-cms 1.0.81 → 1.0.82
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 +6 -0
- package/HOSTED.md +121 -0
- package/INSTALL.md +22 -5
- package/README.md +2 -0
- package/dist/bin/cms-edit.js +8 -143
- package/dist/bin/cms-edit.js.map +1 -1
- package/dist/cli/program.d.ts +9 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +159 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/runner.d.ts +15 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +93 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/commands/add.js +2 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/asset.js +5 -5
- package/dist/commands/asset.js.map +1 -1
- package/dist/commands/backup.js +1 -1
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/create-from-json.js +1 -1
- package/dist/commands/create-from-json.js.map +1 -1
- package/dist/commands/create.js +4 -4
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/diff.js +2 -2
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/discard.js +4 -4
- package/dist/commands/discard.js.map +1 -1
- package/dist/commands/guide.d.ts +4 -0
- package/dist/commands/guide.d.ts.map +1 -0
- package/dist/commands/guide.js +18 -0
- package/dist/commands/guide.js.map +1 -0
- package/dist/commands/links.js +10 -10
- package/dist/commands/links.js.map +1 -1
- package/dist/commands/move.js +3 -3
- package/dist/commands/move.js.map +1 -1
- package/dist/commands/nav.js +3 -3
- package/dist/commands/nav.js.map +1 -1
- package/dist/commands/open.js +1 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/peek.d.ts.map +1 -1
- package/dist/commands/peek.js +8 -2
- package/dist/commands/peek.js.map +1 -1
- package/dist/commands/preview.js +1 -1
- package/dist/commands/preview.js.map +1 -1
- package/dist/commands/read.js +2 -2
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/remove.js +2 -2
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/revert.js +5 -5
- package/dist/commands/revert.js.map +1 -1
- package/dist/commands/rtf.js +11 -11
- package/dist/commands/rtf.js.map +1 -1
- package/dist/commands/run.js +8 -8
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/save.js +3 -3
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/screenshot.js +2 -2
- package/dist/commands/screenshot.js.map +1 -1
- package/dist/commands/set.js +7 -7
- package/dist/commands/set.js.map +1 -1
- package/dist/commands/snapshot.js +1 -1
- package/dist/commands/snapshot.js.map +1 -1
- package/dist/commands/version.d.ts +4 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +17 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/config/hosted.d.ts +28 -0
- package/dist/config/hosted.d.ts.map +1 -0
- package/dist/config/hosted.js +94 -0
- package/dist/config/hosted.js.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +5 -0
- package/dist/config/load.js.map +1 -1
- package/dist/hosted/index.d.ts +13 -0
- package/dist/hosted/index.d.ts.map +1 -0
- package/dist/hosted/index.js +12 -0
- package/dist/hosted/index.js.map +1 -0
- package/dist/mcp/guide.d.ts +20 -0
- package/dist/mcp/guide.d.ts.map +1 -0
- package/dist/mcp/guide.js +91 -0
- package/dist/mcp/guide.js.map +1 -0
- package/dist/mcp/http-handler.d.ts +13 -0
- package/dist/mcp/http-handler.d.ts.map +1 -0
- package/dist/mcp/http-handler.js +28 -0
- package/dist/mcp/http-handler.js.map +1 -0
- package/dist/mcp/prompts/onboarding.d.ts +4 -0
- package/dist/mcp/prompts/onboarding.d.ts.map +1 -0
- package/dist/mcp/prompts/onboarding.js +77 -0
- package/dist/mcp/prompts/onboarding.js.map +1 -0
- package/dist/mcp/resources/guide.d.ts +4 -0
- package/dist/mcp/resources/guide.d.ts.map +1 -0
- package/dist/mcp/resources/guide.js +16 -0
- package/dist/mcp/resources/guide.js.map +1 -0
- package/dist/mcp/server.d.ts +13 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +20 -92
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/cms-edit.d.ts +9 -0
- package/dist/mcp/tools/cms-edit.d.ts.map +1 -0
- package/dist/mcp/tools/cms-edit.js +57 -0
- package/dist/mcp/tools/cms-edit.js.map +1 -0
- package/dist/mcp/tools/help.d.ts +4 -0
- package/dist/mcp/tools/help.d.ts.map +1 -0
- package/dist/mcp/tools/help.js +22 -0
- package/dist/mcp/tools/help.js.map +1 -0
- package/dist/mcp/types.d.ts +2 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/runtime/context.d.ts +19 -0
- package/dist/runtime/context.d.ts.map +1 -0
- package/dist/runtime/context.js +9 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/session/file-session-store.d.ts +10 -0
- package/dist/session/file-session-store.d.ts.map +1 -0
- package/dist/session/file-session-store.js +92 -0
- package/dist/session/file-session-store.js.map +1 -0
- package/dist/session/redis-session-store.d.ts +21 -0
- package/dist/session/redis-session-store.d.ts.map +1 -0
- package/dist/session/redis-session-store.js +121 -0
- package/dist/session/redis-session-store.js.map +1 -0
- package/dist/session/session-store.d.ts +19 -0
- package/dist/session/session-store.d.ts.map +1 -0
- package/dist/session/session-store.js +9 -0
- package/dist/session/session-store.js.map +1 -0
- package/dist/session/store.d.ts +5 -5
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js +16 -74
- package/dist/session/store.js.map +1 -1
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +19 -0
- package/dist/version.js.map +1 -0
- package/docs/FEATURE_REQUESTS_ARCHIVE.md +141 -0
- package/docs/FUNCTIONAL_SPEC.md +271 -0
- package/docs/mcp/hosted-guide.md +149 -0
- package/package.json +14 -6
package/CHANGELOG.md
CHANGED
package/HOSTED.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Hosted cms-edit for Claude Desktop
|
|
2
|
+
|
|
3
|
+
Use this guide when your team hosts cms-edit on Vercel (one deployment per client). **You do not need Node.js or any config files** — only Claude Desktop, the extension file SE sends you, and a Contentful account.
|
|
4
|
+
|
|
5
|
+
Edits you make appear in Contentful under **your name**, because you use your own personal access token.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What SE sends you
|
|
10
|
+
|
|
11
|
+
1. A **`.mcpb` file** (e.g. `cms-edit-om1.mcpb`) — the cms-edit desktop extension for your site
|
|
12
|
+
2. This guide
|
|
13
|
+
|
|
14
|
+
You do **not** need to edit JSON, install Node.js, or configure connector URLs yourself.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Before you start (SE team)
|
|
19
|
+
|
|
20
|
+
For each editor:
|
|
21
|
+
|
|
22
|
+
1. Invite them to the Contentful space.
|
|
23
|
+
2. Assign the **AI Editor** role (draft edit only — no publish). See [README — Contentful Role Setup](./README.md#contentful-role-setup-required).
|
|
24
|
+
3. Deploy `apps/cms-edit-host` to Vercel for this client (see [cms-edit-host README](../../apps/cms-edit-host/README.md)).
|
|
25
|
+
4. Build the desktop extension: `pnpm mcpb:pack -- --customer <projectKey>` (see [mcpb/README.md](./mcpb/README.md)).
|
|
26
|
+
5. Send them the `.mcpb` file and this guide.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Step 1 — Get your Contentful token
|
|
31
|
+
|
|
32
|
+
1. Log in to [contentful.com](https://app.contentful.com).
|
|
33
|
+
2. Open the correct space (top-left selector).
|
|
34
|
+
3. Go to **Settings → CMA tokens** (Content management tokens).
|
|
35
|
+
4. Click **Create personal access token**.
|
|
36
|
+
5. Name it `Claude Desktop` and click **Generate**.
|
|
37
|
+
6. **Copy the token now** — you will not see it again.
|
|
38
|
+
|
|
39
|
+
This token is tied to **you**. Changes you save through Claude will show your name in Contentful.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Step 2 — Install the cms-edit extension
|
|
44
|
+
|
|
45
|
+
1. Install [Claude Desktop](https://claude.ai/download) if you have not already.
|
|
46
|
+
2. Install the extension SE sent you:
|
|
47
|
+
- **Option A:** Double-click the `.mcpb` file, or drag it into the Claude Desktop window.
|
|
48
|
+
- **Option B:** Open Claude Desktop → **Settings → Extensions** → **Install Extension…** → select the `.mcpb` file.
|
|
49
|
+
3. When prompted, paste your **Contentful personal access token** from Step 1.
|
|
50
|
+
4. Confirm the extension appears as **cms-edit (Your Site Name)** and is enabled.
|
|
51
|
+
5. Fully **quit** Claude Desktop and reopen it (on Mac: right-click Dock icon → Quit).
|
|
52
|
+
|
|
53
|
+
Your token is stored securely on your machine (Claude Desktop treats it as sensitive configuration).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Step 3 — Try it
|
|
58
|
+
|
|
59
|
+
**Getting started:** Ask Claude to read the **cms-edit guide** (`cms-edit://guide` resource) or use the **`cms_edit_verify`** prompt to check version and connectivity. No separate skill install is required — onboarding lives on the MCP server.
|
|
60
|
+
|
|
61
|
+
In a new Claude conversation:
|
|
62
|
+
|
|
63
|
+
> Read the cms-edit guide and verify the connection.
|
|
64
|
+
|
|
65
|
+
or:
|
|
66
|
+
|
|
67
|
+
> Open the homepage and show me the content tree.
|
|
68
|
+
|
|
69
|
+
or:
|
|
70
|
+
|
|
71
|
+
> List all pages on the site.
|
|
72
|
+
|
|
73
|
+
If Claude returns JSON with page content or a snapshot with `@c0`, `@c1` refs, you are connected.
|
|
74
|
+
|
|
75
|
+
**Typical edit workflow:** `open /` → `snapshot` → `read @c1` → `set @c1 heading "New title"` → `diff` → `save`. Each step uses the same session automatically — you do not need to pass `--session` unless you are juggling multiple pages at once.
|
|
76
|
+
|
|
77
|
+
To edit copy:
|
|
78
|
+
|
|
79
|
+
> Open `/pricing`, change the main heading to "Simple pricing", show me the diff, then save.
|
|
80
|
+
|
|
81
|
+
Remember: **save creates drafts only**. You or a colleague must **publish in Contentful** for changes to go live.
|
|
82
|
+
|
|
83
|
+
**Do not pass `--space`** when using the hosted extension. The deployment is already configured for your site. The `--space` flag is only for local multi-space setups.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Troubleshooting
|
|
88
|
+
|
|
89
|
+
| Problem | What to do |
|
|
90
|
+
|---------|------------|
|
|
91
|
+
| **401 / invalid token** | Generate a new CMA token in Contentful. In Claude Desktop → Settings → Extensions, open the cms-edit extension and update your token. |
|
|
92
|
+
| **No cms_edit tool in Claude** | Quit Claude fully and reopen. Confirm the extension is installed and enabled under Settings → Extensions. |
|
|
93
|
+
| **No active session** (after `open` worked) | Do not pass `--space` — the hosted extension targets one space already. If you use `--session <name>`, pass the same name on every command in that workflow. Otherwise run `open` again, then `snapshot` or `read @c1`. |
|
|
94
|
+
| **Wrong space** | Your token must belong to the space this deployment is configured for. Ask SE if unsure. Do not use `--space` with the hosted extension. |
|
|
95
|
+
| **Lost laptop** | Revoke your token in Contentful → Settings → CMA tokens. |
|
|
96
|
+
| **Check cms-edit version** | Ask Claude to use the `cms_edit_version` tool, or run `curl -s "https://YOUR-DEPLOYMENT.vercel.app/api/health" | jq .cmsEdit`. Version comes from the hosted server — no `.mcpb` reinstall needed. |
|
|
97
|
+
|
|
98
|
+
### Health check
|
|
99
|
+
|
|
100
|
+
Ask SE to run (or run yourself if you have curl):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
curl -s -H "Authorization: Bearer YOUR_TOKEN" \
|
|
104
|
+
"https://YOUR-DEPLOYMENT.vercel.app/api/health"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
All checks should show `"ok": true`. The response includes a `cmsEdit` object with the deployed cms-edit version.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Security notes
|
|
112
|
+
|
|
113
|
+
- Your token is stored in Claude Desktop on your machine — same sensitivity as the local setup wizard.
|
|
114
|
+
- The hosted server **does not store** your token; it is sent on each request over HTTPS.
|
|
115
|
+
- Use a token with the **AI Editor** role only — not an admin token.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Local setup (developers)
|
|
120
|
+
|
|
121
|
+
Developers can still use the local MCP wizard: see [INSTALL.md](./INSTALL.md).
|
package/INSTALL.md
CHANGED
|
@@ -2,16 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
This guide sets up Claude Desktop so it can read and edit your Contentful content.
|
|
4
4
|
|
|
5
|
+
There are two setup paths:
|
|
6
|
+
|
|
7
|
+
| Path | Who | Requirements |
|
|
8
|
+
|------|-----|--------------|
|
|
9
|
+
| **Hosted** | Content editors on a client site | Claude Desktop + `.mcpb` extension from SE — **no Node.js** |
|
|
10
|
+
| **Local** | Developers / multi-space workflows | Node.js + setup wizard |
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Hosted setup (content editors)
|
|
15
|
+
|
|
16
|
+
If SE sent you a **`.mcpb` file**, follow [HOSTED.md](./HOSTED.md). You install the extension in Claude Desktop and enter your Contentful personal access token — no terminal or Node.js required.
|
|
17
|
+
|
|
5
18
|
---
|
|
6
19
|
|
|
7
|
-
##
|
|
20
|
+
## Local setup (developers)
|
|
21
|
+
|
|
22
|
+
### What you'll need
|
|
8
23
|
|
|
9
24
|
- **Contentful Management Token** — a secret key that gives Claude permission to edit content (the setup wizard will discover your Space ID and environments automatically)
|
|
10
25
|
- **Node.js** — required to run the setup wizard and for screenshot support. Download the LTS version from [nodejs.org](https://nodejs.org) if you don't have it
|
|
11
26
|
|
|
12
27
|
---
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
### Step 1 — Get your Contentful Management Token
|
|
15
30
|
|
|
16
31
|
1. Log in to [contentful.com](https://app.contentful.com)
|
|
17
32
|
2. Click **Settings** in the top menu → **API keys**
|
|
@@ -22,7 +37,7 @@ This guide sets up Claude Desktop so it can read and edit your Contentful conten
|
|
|
22
37
|
|
|
23
38
|
---
|
|
24
39
|
|
|
25
|
-
|
|
40
|
+
### Step 2 — Run the setup wizard
|
|
26
41
|
|
|
27
42
|
Open a terminal and run:
|
|
28
43
|
|
|
@@ -40,7 +55,7 @@ That's it — no need to find your Space ID manually.
|
|
|
40
55
|
|
|
41
56
|
---
|
|
42
57
|
|
|
43
|
-
|
|
58
|
+
### Step 3 — Restart Claude Desktop
|
|
44
59
|
|
|
45
60
|
Fully quit Claude Desktop and reopen it.
|
|
46
61
|
|
|
@@ -49,7 +64,7 @@ Fully quit Claude Desktop and reopen it.
|
|
|
49
64
|
|
|
50
65
|
---
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
### Step 4 — Test it
|
|
53
68
|
|
|
54
69
|
In a new Claude conversation, type:
|
|
55
70
|
|
|
@@ -125,6 +140,8 @@ Add (or merge) this into the file:
|
|
|
125
140
|
|
|
126
141
|
Replace `/Users/YourName` with your actual home folder path.
|
|
127
142
|
|
|
143
|
+
**Onboarding:** Local stdio MCP exposes the same getting-started surfaces as hosted — read the `cms-edit://guide` resource, call `cms_edit_help`, or use prompts `cms_edit_verify`, `cms_edit_explore`, and `cms_edit_edit_page`. Run `cms-edit guide` in the terminal for the full guide.
|
|
144
|
+
|
|
128
145
|
</details>
|
|
129
146
|
|
|
130
147
|
---
|
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ npx @se-studio/contentful-cms@latest setup
|
|
|
31
31
|
|
|
32
32
|
It discovers your Contentful spaces and environments automatically from your management token, writes `~/.contentful-cms.json`, and updates the Claude Desktop config. See [INSTALL.md](./INSTALL.md) for a full walkthrough.
|
|
33
33
|
|
|
34
|
+
**Hosted mode (no Node.js for editors):** deploy [apps/cms-edit-host](../../apps/cms-edit-host) to Vercel, build a per-client `.mcpb` extension (`pnpm mcpb:pack -- --customer <key>` — see [mcpb/README.md](./mcpb/README.md)), and share the `.mcpb` file plus [HOSTED.md](./HOSTED.md) with your content team.
|
|
35
|
+
|
|
34
36
|
**Manual config** — if you'd prefer to configure by hand, add this to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
35
37
|
|
|
36
38
|
```json
|
package/dist/bin/cms-edit.js
CHANGED
|
@@ -2,150 +2,13 @@
|
|
|
2
2
|
/** biome-ignore-all lint/suspicious/noConsole: Console output is intentional in CLI */
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { registerAuditCommand } from '../commands/audit.js';
|
|
9
|
-
import { registerBackupCommand } from '../commands/backup.js';
|
|
10
|
-
import { registerColoursCommand } from '../commands/colours.js';
|
|
11
|
-
import { registerCreateCommand } from '../commands/create.js';
|
|
12
|
-
import { registerCreateFromJsonCommand } from '../commands/create-from-json.js';
|
|
13
|
-
import { registerDiffCommand } from '../commands/diff.js';
|
|
14
|
-
import { registerDiscardCommand } from '../commands/discard.js';
|
|
15
|
-
import { registerEntrySearchCommand } from '../commands/entry-search.js';
|
|
16
|
-
import { registerHealthCommand } from '../commands/health.js';
|
|
17
|
-
import { registerHelpCommand } from '../commands/help.js';
|
|
18
|
-
import { registerLinksCommand } from '../commands/links.js';
|
|
19
|
-
import { registerListCommand } from '../commands/list.js';
|
|
20
|
-
import { registerMoveCommand } from '../commands/move.js';
|
|
21
|
-
import { registerNavCommand } from '../commands/nav.js';
|
|
22
|
-
import { registerOpenCommand } from '../commands/open.js';
|
|
23
|
-
import { registerPeekCommand } from '../commands/peek.js';
|
|
24
|
-
import { registerPreviewCommand } from '../commands/preview.js';
|
|
25
|
-
import { registerReadCommand } from '../commands/read.js';
|
|
26
|
-
import { registerRemoveCommand } from '../commands/remove.js';
|
|
27
|
-
import { registerResolveCommand } from '../commands/resolve.js';
|
|
28
|
-
import { registerRestoreCommand } from '../commands/restore.js';
|
|
29
|
-
import { registerRevertCommand } from '../commands/revert.js';
|
|
30
|
-
import { registerRtfCommand } from '../commands/rtf.js';
|
|
31
|
-
import { registerRunCommand } from '../commands/run.js';
|
|
32
|
-
import { registerSaveCommand } from '../commands/save.js';
|
|
33
|
-
import { registerSchemaCommand } from '../commands/schema.js';
|
|
34
|
-
import { registerScreenshotCommand } from '../commands/screenshot.js';
|
|
35
|
-
import { registerSetCommand } from '../commands/set.js';
|
|
36
|
-
import { registerSitemapCommand } from '../commands/sitemap.js';
|
|
37
|
-
import { registerSkillCommand } from '../commands/skill.js';
|
|
38
|
-
import { registerSnapshotCommand } from '../commands/snapshot.js';
|
|
39
|
-
import { registerTypesCommand } from '../commands/types.js';
|
|
40
|
-
import { setJsonMode } from '../output/mode.js';
|
|
41
|
-
import { runSetupWizard } from '../setup/wizard.js';
|
|
42
|
-
import { createTelemetryWriter } from '../telemetry/index.js';
|
|
43
|
-
const program = new Command('cms-edit');
|
|
44
|
-
const LLM_INTRO = 'Opinionated CLI for editing Contentful draft content (pages, articles, templates, navigation). No publish — all saves create drafts.\n' +
|
|
45
|
-
'Workflow: open → snapshot → read/set/rtf/add/remove/move → diff → save. Use @refs from snapshot (e.g. @c0); re-snapshot after add/remove/move.\n' +
|
|
46
|
-
'Detailed help: cms-edit help <topic> Topics: workflow, create-from-json, run, fields, fields-page, fields-article, fields-component, fields-collection\n' +
|
|
47
|
-
'Single-shot page/article creation: cms-edit help create-from-json\n' +
|
|
48
|
-
'Full README: cms-edit --docs. Install skills: cms-edit skill install.\n' +
|
|
49
|
-
'Check your work: cms-edit screenshot [@ref|/slug] (requires agent-browser).';
|
|
50
|
-
program
|
|
51
|
-
.name('cms-edit')
|
|
52
|
-
.version('1.0.0')
|
|
53
|
-
.description(LLM_INTRO)
|
|
54
|
-
.option('--space <name>', 'Contentful space to use (overrides defaultSpace in config)')
|
|
55
|
-
.option('--config <path>', 'Path to .contentful-cms.json config file')
|
|
56
|
-
.option('--session <name>', 'Named session for concurrent isolation (also CONTENTFUL_CMS_SESSION env var). ' +
|
|
57
|
-
'Use the same name in all commands for a given workflow.')
|
|
58
|
-
.option('--json', 'Output all results as machine-readable JSON (also enabled by CMS_EDIT_JSON=1 env var)')
|
|
59
|
-
.option('--docs', 'Print absolute path to package README and exit (for LLM tooling)');
|
|
60
|
-
// ---------------------------------------------------------------------------
|
|
61
|
-
// Telemetry — records command name, outcome, and duration to a local log file.
|
|
62
|
-
// No PII is stored (no slugs, entry IDs, field values, query text).
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
const telemetry = createTelemetryWriter();
|
|
65
|
-
let _telemetryCommand;
|
|
66
|
-
let _telemetrySubcommand;
|
|
67
|
-
let _telemetryStart;
|
|
68
|
-
let _telemetryRecorded = false;
|
|
69
|
-
function recordTelemetry(outcome, exitCode, errName) {
|
|
70
|
-
if (_telemetryRecorded || !_telemetryCommand)
|
|
71
|
-
return;
|
|
72
|
-
_telemetryRecorded = true;
|
|
73
|
-
telemetry.record({
|
|
74
|
-
timestamp: new Date().toISOString(),
|
|
75
|
-
command: _telemetryCommand,
|
|
76
|
-
subcommand: _telemetrySubcommand,
|
|
77
|
-
outcome,
|
|
78
|
-
exit_code: exitCode,
|
|
79
|
-
error_name: errName,
|
|
80
|
-
duration_ms: _telemetryStart !== undefined ? Date.now() - _telemetryStart : 0,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
// Override process.exit to capture exit-path telemetry (commands call process.exit(1) on error)
|
|
5
|
+
import { createCmsEditProgram } from '../cli/program.js';
|
|
6
|
+
import { CMS_EDIT_VERSION } from '../version.js';
|
|
7
|
+
const program = createCmsEditProgram();
|
|
84
8
|
const _origExit = process.exit.bind(process);
|
|
85
9
|
process.exit = ((code) => {
|
|
86
10
|
const numCode = typeof code === 'string' ? Number.parseInt(code, 10) : (code ?? 0);
|
|
87
|
-
|
|
88
|
-
_origExit(numCode);
|
|
89
|
-
});
|
|
90
|
-
// ---------------------------------------------------------------------------
|
|
91
|
-
// Pre/post action hooks
|
|
92
|
-
// ---------------------------------------------------------------------------
|
|
93
|
-
program.hook('preAction', (_thisCmd, actionCmd) => {
|
|
94
|
-
const opts = program.opts();
|
|
95
|
-
if (opts.json)
|
|
96
|
-
setJsonMode(true);
|
|
97
|
-
// Propagate --session into env var so all commands pick it up via resolveSessionName()
|
|
98
|
-
if (opts.session)
|
|
99
|
-
process.env['CONTENTFUL_CMS_SESSION'] = opts.session;
|
|
100
|
-
// Capture command context for telemetry
|
|
101
|
-
_telemetryCommand =
|
|
102
|
-
actionCmd.parent?.name() !== 'cms-edit' ? actionCmd.parent?.name() : actionCmd.name();
|
|
103
|
-
_telemetrySubcommand = actionCmd.parent?.name() !== 'cms-edit' ? actionCmd.name() : undefined;
|
|
104
|
-
_telemetryStart = Date.now();
|
|
105
|
-
_telemetryRecorded = false;
|
|
106
|
-
});
|
|
107
|
-
program.hook('postAction', () => {
|
|
108
|
-
recordTelemetry('success');
|
|
109
|
-
});
|
|
110
|
-
registerOpenCommand(program);
|
|
111
|
-
registerPeekCommand(program);
|
|
112
|
-
registerSnapshotCommand(program);
|
|
113
|
-
registerReadCommand(program);
|
|
114
|
-
registerSetCommand(program);
|
|
115
|
-
registerRtfCommand(program);
|
|
116
|
-
registerDiffCommand(program);
|
|
117
|
-
registerSaveCommand(program);
|
|
118
|
-
registerDiscardCommand(program);
|
|
119
|
-
registerLinksCommand(program);
|
|
120
|
-
registerAddCommand(program);
|
|
121
|
-
registerRemoveCommand(program);
|
|
122
|
-
registerMoveCommand(program);
|
|
123
|
-
registerBackupCommand(program);
|
|
124
|
-
registerRestoreCommand(program);
|
|
125
|
-
registerRevertCommand(program);
|
|
126
|
-
const createCmd = registerCreateCommand(program);
|
|
127
|
-
registerCreateFromJsonCommand(createCmd);
|
|
128
|
-
registerNavCommand(program);
|
|
129
|
-
registerAssetCommand(program);
|
|
130
|
-
registerAuditCommand(program);
|
|
131
|
-
registerTypesCommand(program);
|
|
132
|
-
registerColoursCommand(program);
|
|
133
|
-
registerEntrySearchCommand(program);
|
|
134
|
-
registerHealthCommand(program);
|
|
135
|
-
registerSchemaCommand(program);
|
|
136
|
-
registerListCommand(program);
|
|
137
|
-
registerResolveCommand(program);
|
|
138
|
-
registerPreviewCommand(program);
|
|
139
|
-
registerScreenshotCommand(program);
|
|
140
|
-
registerRunCommand(program);
|
|
141
|
-
registerSitemapCommand(program);
|
|
142
|
-
registerSkillCommand(program);
|
|
143
|
-
registerHelpCommand(program);
|
|
144
|
-
program
|
|
145
|
-
.command('setup')
|
|
146
|
-
.description('Interactive wizard to configure Claude Desktop with your Contentful credentials')
|
|
147
|
-
.action(async () => {
|
|
148
|
-
await runSetupWizard();
|
|
11
|
+
_origExit(Number.isNaN(numCode) ? 1 : numCode);
|
|
149
12
|
});
|
|
150
13
|
if (process.argv.includes('--docs')) {
|
|
151
14
|
const dir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -154,7 +17,10 @@ if (process.argv.includes('--docs')) {
|
|
|
154
17
|
console.log(path.resolve(readmePath));
|
|
155
18
|
process.exit(0);
|
|
156
19
|
}
|
|
157
|
-
|
|
20
|
+
if (process.argv.includes('--version') || process.argv.includes('-V')) {
|
|
21
|
+
console.log(CMS_EDIT_VERSION);
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
158
24
|
const argv = process.argv.slice(2);
|
|
159
25
|
let idx = 0;
|
|
160
26
|
let firstPositional;
|
|
@@ -174,7 +40,6 @@ if (firstPositional === undefined || firstPositional === 'help') {
|
|
|
174
40
|
process.exit(0);
|
|
175
41
|
}
|
|
176
42
|
program.parseAsync(process.argv).catch((err) => {
|
|
177
|
-
recordTelemetry('error', 1, err instanceof Error ? err.constructor.name : 'UnknownError');
|
|
178
43
|
console.error(err instanceof Error ? err.message : String(err));
|
|
179
44
|
_origExit(1);
|
|
180
45
|
});
|
package/dist/bin/cms-edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.js","sourceRoot":"","sources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,EAAE,EAAE;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,SAAS,CAAC,CAAC,CAAC,CAAC;AACf,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noConsole: Console output is intentional in CLI */
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
export interface CmsEditProgramHooks {
|
|
4
|
+
onPreAction?: (command: string, subcommand?: string) => void;
|
|
5
|
+
onPostAction?: () => void;
|
|
6
|
+
onError?: (err: unknown) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCmsEditProgram(hooks?: CmsEditProgramHooks): Command;
|
|
9
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkDpC,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,GAAE,mBAAwB,GAAG,OAAO,CAsH7E"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noConsole: Console output is intentional in CLI */
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { registerAddCommand } from '../commands/add.js';
|
|
4
|
+
import { registerAssetCommand } from '../commands/asset.js';
|
|
5
|
+
import { registerAuditCommand } from '../commands/audit.js';
|
|
6
|
+
import { registerBackupCommand } from '../commands/backup.js';
|
|
7
|
+
import { registerColoursCommand } from '../commands/colours.js';
|
|
8
|
+
import { registerCreateCommand } from '../commands/create.js';
|
|
9
|
+
import { registerCreateFromJsonCommand } from '../commands/create-from-json.js';
|
|
10
|
+
import { registerDiffCommand } from '../commands/diff.js';
|
|
11
|
+
import { registerDiscardCommand } from '../commands/discard.js';
|
|
12
|
+
import { registerEntrySearchCommand } from '../commands/entry-search.js';
|
|
13
|
+
import { registerGuideCommand } from '../commands/guide.js';
|
|
14
|
+
import { registerHealthCommand } from '../commands/health.js';
|
|
15
|
+
import { registerHelpCommand } from '../commands/help.js';
|
|
16
|
+
import { registerLinksCommand } from '../commands/links.js';
|
|
17
|
+
import { registerListCommand } from '../commands/list.js';
|
|
18
|
+
import { registerMoveCommand } from '../commands/move.js';
|
|
19
|
+
import { registerNavCommand } from '../commands/nav.js';
|
|
20
|
+
import { registerOpenCommand } from '../commands/open.js';
|
|
21
|
+
import { registerPeekCommand } from '../commands/peek.js';
|
|
22
|
+
import { registerPreviewCommand } from '../commands/preview.js';
|
|
23
|
+
import { registerReadCommand } from '../commands/read.js';
|
|
24
|
+
import { registerRemoveCommand } from '../commands/remove.js';
|
|
25
|
+
import { registerResolveCommand } from '../commands/resolve.js';
|
|
26
|
+
import { registerRestoreCommand } from '../commands/restore.js';
|
|
27
|
+
import { registerRevertCommand } from '../commands/revert.js';
|
|
28
|
+
import { registerRtfCommand } from '../commands/rtf.js';
|
|
29
|
+
import { registerRunCommand } from '../commands/run.js';
|
|
30
|
+
import { registerSaveCommand } from '../commands/save.js';
|
|
31
|
+
import { registerSchemaCommand } from '../commands/schema.js';
|
|
32
|
+
import { registerScreenshotCommand } from '../commands/screenshot.js';
|
|
33
|
+
import { registerSetCommand } from '../commands/set.js';
|
|
34
|
+
import { registerSitemapCommand } from '../commands/sitemap.js';
|
|
35
|
+
import { registerSkillCommand } from '../commands/skill.js';
|
|
36
|
+
import { registerSnapshotCommand } from '../commands/snapshot.js';
|
|
37
|
+
import { registerTypesCommand } from '../commands/types.js';
|
|
38
|
+
import { registerVersionCommand } from '../commands/version.js';
|
|
39
|
+
import { setJsonMode } from '../output/mode.js';
|
|
40
|
+
import { runSetupWizard } from '../setup/wizard.js';
|
|
41
|
+
import { createTelemetryWriter } from '../telemetry/index.js';
|
|
42
|
+
import { CMS_EDIT_VERSION } from '../version.js';
|
|
43
|
+
const LLM_INTRO = 'Opinionated CLI for editing Contentful draft content (pages, articles, templates, navigation). No publish — all saves create drafts.\n' +
|
|
44
|
+
'Workflow: open → snapshot → read/set/rtf/add/remove/move → diff → save. Use @refs from snapshot (e.g. @c0); re-snapshot after add/remove/move.\n' +
|
|
45
|
+
'Detailed help: cms-edit help <topic> Topics: workflow, create-from-json, run, fields, fields-page, fields-article, fields-component, fields-collection\n' +
|
|
46
|
+
'Single-shot page/article creation: cms-edit help create-from-json\n' +
|
|
47
|
+
'Full README: cms-edit --docs. Install skills: cms-edit skill install.\n' +
|
|
48
|
+
'Check your work: cms-edit screenshot [@ref|/slug] (requires agent-browser).';
|
|
49
|
+
export function createCmsEditProgram(hooks = {}) {
|
|
50
|
+
const telemetry = createTelemetryWriter();
|
|
51
|
+
let telemetryCommand;
|
|
52
|
+
let telemetrySubcommand;
|
|
53
|
+
let telemetryStart;
|
|
54
|
+
let telemetryRecorded = false;
|
|
55
|
+
const recordTelemetry = (outcome, exitCode, errName) => {
|
|
56
|
+
if (telemetryRecorded || !telemetryCommand)
|
|
57
|
+
return;
|
|
58
|
+
telemetryRecorded = true;
|
|
59
|
+
telemetry.record({
|
|
60
|
+
timestamp: new Date().toISOString(),
|
|
61
|
+
command: telemetryCommand,
|
|
62
|
+
subcommand: telemetrySubcommand,
|
|
63
|
+
outcome,
|
|
64
|
+
exit_code: exitCode,
|
|
65
|
+
error_name: errName,
|
|
66
|
+
duration_ms: telemetryStart !== undefined ? Date.now() - telemetryStart : 0,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const program = new Command('cms-edit');
|
|
70
|
+
program
|
|
71
|
+
.name('cms-edit')
|
|
72
|
+
.version(CMS_EDIT_VERSION)
|
|
73
|
+
.description(LLM_INTRO)
|
|
74
|
+
.option('--space <name>', 'Contentful space to use (overrides defaultSpace in config)')
|
|
75
|
+
.option('--config <path>', 'Path to .contentful-cms.json config file')
|
|
76
|
+
.option('--session <name>', 'Named session for concurrent isolation (also CONTENTFUL_CMS_SESSION env var). ' +
|
|
77
|
+
'Use the same name in all commands for a given workflow.')
|
|
78
|
+
.option('--json', 'Output all results as machine-readable JSON (also enabled by CMS_EDIT_JSON=1 env var)')
|
|
79
|
+
.option('--docs', 'Print absolute path to package README and exit (for LLM tooling)');
|
|
80
|
+
program.hook('preAction', (_thisCmd, actionCmd) => {
|
|
81
|
+
const opts = program.opts();
|
|
82
|
+
if (opts.json ||
|
|
83
|
+
process.env['CMS_EDIT_JSON'] === '1' ||
|
|
84
|
+
process.env['CMS_EDIT_JSON'] === 'true') {
|
|
85
|
+
setJsonMode(true);
|
|
86
|
+
}
|
|
87
|
+
if (opts.session)
|
|
88
|
+
process.env['CONTENTFUL_CMS_SESSION'] = opts.session;
|
|
89
|
+
telemetryCommand =
|
|
90
|
+
actionCmd.parent?.name() !== 'cms-edit' ? actionCmd.parent?.name() : actionCmd.name();
|
|
91
|
+
telemetrySubcommand = actionCmd.parent?.name() !== 'cms-edit' ? actionCmd.name() : undefined;
|
|
92
|
+
telemetryStart = Date.now();
|
|
93
|
+
telemetryRecorded = false;
|
|
94
|
+
hooks.onPreAction?.(telemetryCommand ?? 'unknown', telemetrySubcommand);
|
|
95
|
+
});
|
|
96
|
+
program.hook('postAction', () => {
|
|
97
|
+
recordTelemetry('success');
|
|
98
|
+
hooks.onPostAction?.();
|
|
99
|
+
});
|
|
100
|
+
registerOpenCommand(program);
|
|
101
|
+
registerPeekCommand(program);
|
|
102
|
+
registerSnapshotCommand(program);
|
|
103
|
+
registerReadCommand(program);
|
|
104
|
+
registerSetCommand(program);
|
|
105
|
+
registerRtfCommand(program);
|
|
106
|
+
registerDiffCommand(program);
|
|
107
|
+
registerSaveCommand(program);
|
|
108
|
+
registerDiscardCommand(program);
|
|
109
|
+
registerLinksCommand(program);
|
|
110
|
+
registerAddCommand(program);
|
|
111
|
+
registerRemoveCommand(program);
|
|
112
|
+
registerMoveCommand(program);
|
|
113
|
+
registerBackupCommand(program);
|
|
114
|
+
registerRestoreCommand(program);
|
|
115
|
+
registerRevertCommand(program);
|
|
116
|
+
const createCmd = registerCreateCommand(program);
|
|
117
|
+
registerCreateFromJsonCommand(createCmd);
|
|
118
|
+
registerNavCommand(program);
|
|
119
|
+
registerAssetCommand(program);
|
|
120
|
+
registerAuditCommand(program);
|
|
121
|
+
registerTypesCommand(program);
|
|
122
|
+
registerColoursCommand(program);
|
|
123
|
+
registerEntrySearchCommand(program);
|
|
124
|
+
registerHealthCommand(program);
|
|
125
|
+
registerVersionCommand(program);
|
|
126
|
+
registerGuideCommand(program);
|
|
127
|
+
registerSchemaCommand(program);
|
|
128
|
+
registerListCommand(program);
|
|
129
|
+
registerResolveCommand(program);
|
|
130
|
+
registerPreviewCommand(program);
|
|
131
|
+
registerScreenshotCommand(program);
|
|
132
|
+
registerRunCommand(program);
|
|
133
|
+
registerSitemapCommand(program);
|
|
134
|
+
registerSkillCommand(program);
|
|
135
|
+
registerHelpCommand(program);
|
|
136
|
+
program
|
|
137
|
+
.command('setup')
|
|
138
|
+
.description('Interactive wizard to configure Claude Desktop with your Contentful credentials')
|
|
139
|
+
.action(async () => {
|
|
140
|
+
await runSetupWizard();
|
|
141
|
+
});
|
|
142
|
+
program.parseAsync = wrapParseAsync(program.parseAsync.bind(program), (err) => {
|
|
143
|
+
recordTelemetry('error', 1, err instanceof Error ? err.constructor.name : 'UnknownError');
|
|
144
|
+
hooks.onError?.(err);
|
|
145
|
+
});
|
|
146
|
+
return program;
|
|
147
|
+
}
|
|
148
|
+
function wrapParseAsync(original, onError) {
|
|
149
|
+
return async (...args) => {
|
|
150
|
+
try {
|
|
151
|
+
return await original(...args);
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
onError(err);
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAA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,CAAC;IAC5B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE7B,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,iFAAiF,CAAC;SAC9F,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEL,OAAO,CAAC,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;QAC5E,eAAe,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC1F,KAAK,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,cAAc,CACrB,QAA+B,EAC/B,OAA+B;IAE/B,OAAO,KAAK,EAAE,GAAG,IAAuC,EAAE,EAAE;QAC1D,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,CAAC;YACb,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noConsole: Console output is intentional in CLI */
|
|
2
|
+
export declare class CmsEditProcessExit extends Error {
|
|
3
|
+
readonly exitCode: number;
|
|
4
|
+
constructor(exitCode: number);
|
|
5
|
+
}
|
|
6
|
+
export interface RunCmsEditArgsResult {
|
|
7
|
+
exitCode: number;
|
|
8
|
+
output: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runs cms-edit commands in-process, capturing stdout/stderr instead of spawning a child.
|
|
12
|
+
* Used by the hosted MCP server on Vercel.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runCmsEditArgs(args: string[]): Promise<RunCmsEditArgsResult>;
|
|
15
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/cli/runner.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAIvF,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,EAAE,MAAM;CAK7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AA2BD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAclF"}
|