@se-studio/contentful-cms 3.5.3 → 3.6.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 +6 -0
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +2 -2
- package/dist/cli/runner.js.map +1 -1
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +13 -6
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/peek.d.ts.map +1 -1
- package/dist/commands/peek.js +12 -5
- package/dist/commands/peek.js.map +1 -1
- package/dist/config/hosted.d.ts.map +1 -1
- package/dist/config/hosted.js +3 -0
- package/dist/config/hosted.js.map +1 -1
- package/dist/contentful/cda-sync.d.ts.map +1 -1
- package/dist/contentful/cda-sync.js +11 -4
- package/dist/contentful/cda-sync.js.map +1 -1
- package/dist/contentful/client.d.ts +1 -0
- package/dist/contentful/client.d.ts.map +1 -1
- package/dist/contentful/client.js +42 -15
- package/dist/contentful/client.js.map +1 -1
- package/dist/contentful/cma-user-agent.d.ts +1 -1
- package/dist/contentful/fetch.d.ts +3 -1
- package/dist/contentful/fetch.d.ts.map +1 -1
- package/dist/contentful/fetch.js +8 -8
- package/dist/contentful/fetch.js.map +1 -1
- package/dist/contentful/linkedEntryFields.d.ts +3 -1
- package/dist/contentful/linkedEntryFields.d.ts.map +1 -1
- package/dist/contentful/linkedEntryFields.js +8 -6
- package/dist/contentful/linkedEntryFields.js.map +1 -1
- package/dist/generated/hosted-guide.d.ts +1 -1
- package/dist/generated/hosted-guide.d.ts.map +1 -1
- package/dist/generated/hosted-guide.js +1 -1
- package/dist/generated/hosted-guide.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 +3 -1
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +3 -1
- 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 +12 -2
- package/dist/hosted/next/routes/mcp.js.map +1 -1
- package/dist/hosted/oauth/handlers.d.ts.map +1 -1
- package/dist/hosted/oauth/handlers.js +4 -1
- package/dist/hosted/oauth/handlers.js.map +1 -1
- package/dist/hosted/oauth/pat-cache.d.ts +11 -0
- package/dist/hosted/oauth/pat-cache.d.ts.map +1 -0
- package/dist/hosted/oauth/pat-cache.js +42 -0
- package/dist/hosted/oauth/pat-cache.js.map +1 -0
- package/dist/hosted/oauth/store.d.ts +13 -1
- package/dist/hosted/oauth/store.d.ts.map +1 -1
- package/dist/hosted/oauth/store.js +55 -9
- package/dist/hosted/oauth/store.js.map +1 -1
- package/dist/index/hydrate.d.ts +5 -1
- package/dist/index/hydrate.d.ts.map +1 -1
- package/dist/index/hydrate.js +4 -2
- package/dist/index/hydrate.js.map +1 -1
- package/dist/index/invalidate.d.ts +5 -1
- package/dist/index/invalidate.d.ts.map +1 -1
- package/dist/index/invalidate.js +72 -18
- package/dist/index/invalidate.js.map +1 -1
- package/dist/index/patch-index.d.ts.map +1 -1
- package/dist/index/patch-index.js +42 -2
- package/dist/index/patch-index.js.map +1 -1
- package/dist/index/query.d.ts +1 -0
- package/dist/index/query.d.ts.map +1 -1
- package/dist/index/query.js +8 -0
- package/dist/index/query.js.map +1 -1
- package/dist/index/require.d.ts.map +1 -1
- package/dist/index/require.js +4 -1
- package/dist/index/require.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 +2 -1
- package/dist/mcp/tools/cms-edit.js.map +1 -1
- package/dist/runtime/context.d.ts +2 -0
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js.map +1 -1
- package/dist/telemetry/enrich.d.ts.map +1 -1
- package/dist/telemetry/enrich.js +9 -0
- package/dist/telemetry/enrich.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/request-stats.d.ts +15 -0
- package/dist/telemetry/request-stats.d.ts.map +1 -0
- package/dist/telemetry/request-stats.js +34 -0
- package/dist/telemetry/request-stats.js.map +1 -0
- package/dist/telemetry/types.d.ts +6 -0
- package/dist/telemetry/types.d.ts.map +1 -1
- package/docs/help/workflow.md +3 -1
- package/docs/mcp/hosted-guide.md +3 -0
- package/package.json +1 -1
- package/skills/core/SKILL.md +5 -0
package/dist/index/require.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setIndexSyncMode } from '../telemetry/request-stats.js';
|
|
1
2
|
import { ContentIndexSyncError } from './errors.js';
|
|
2
3
|
import { tryHydrateIndexFromCache } from './hydrate.js';
|
|
3
4
|
import { resolveIndexPreview } from './mode.js';
|
|
@@ -29,9 +30,10 @@ function rebuildMessage(reason) {
|
|
|
29
30
|
*/
|
|
30
31
|
export async function ensureContentIndex(space, opts = {}) {
|
|
31
32
|
const preview = resolveIndexPreview(opts.preview);
|
|
32
|
-
await tryHydrateIndexFromCache(space, preview);
|
|
33
|
+
const hydrated = await tryHydrateIndexFromCache(space, preview);
|
|
33
34
|
const reason = await resolveIndexSyncReason(space, preview);
|
|
34
35
|
if (reason === 'current') {
|
|
36
|
+
setIndexSyncMode(hydrated ? 'hydrate' : 'skip');
|
|
35
37
|
const syncedAt = getIndexSyncedAt(space, preview);
|
|
36
38
|
return {
|
|
37
39
|
syncedAt,
|
|
@@ -52,6 +54,7 @@ export async function ensureContentIndex(space, opts = {}) {
|
|
|
52
54
|
mode,
|
|
53
55
|
verbose: isIndexSyncVerbose(),
|
|
54
56
|
});
|
|
57
|
+
setIndexSyncMode(result.syncMode);
|
|
55
58
|
return {
|
|
56
59
|
syncedAt: result.syncedAt,
|
|
57
60
|
stale: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require.js","sourceRoot":"","sources":["../../src/index/require.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACL,kBAAkB,EAClB,cAAc,EAEd,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAenD,SAAS,cAAc,CAAC,MAAuB;IAC7C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,qCAAqC,CAAC;QAC/C,KAAK,QAAQ;YACX,OAAO,6CAA6C,CAAC;QACvD,KAAK,OAAO;YACV,OAAO,qDAAqD,CAAC;QAC/D,KAAK,yBAAyB;YAC5B,OAAO,uDAAuD,CAAC;QACjE,KAAK,kBAAkB;YACrB,OAAO,kDAAkD,CAAC;QAC5D;YACE,OAAO,wBAAwB,CAAC;IACpC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAkB,EAClB,OAAkC,EAAE;IAEpC,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAElD,MAAM,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"require.js","sourceRoot":"","sources":["../../src/index/require.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,O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ACf,CAAC;IACJ,CAAC;AACH,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { HostedMcpInfo } from '../guide.js';
|
|
3
3
|
import type { RunCmsEditFn } from '../types.js';
|
|
4
|
-
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide by topic.\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow: open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCRITICAL \u2014 sessions and open:\n set/rtf field edits are staged until save. Plain open while dirty HARD-FAILS (does not wipe silently).\n [\"open\", \"--resume\"] \u2014 re-print current session; keeps all staged edits (no Contentful refetch)\n [\"open\", \"--overwrite\", \"--id\", \"<id>\"] \u2014 abandon staged work and load a new entry\n [\"discard\"] then open \u2014 also valid abandon path\n Never re-open the same article mid-edit without save/discard \u2014 use --resume if you only need the tree again.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"open\", \"--resume\"] \u2014 keep staged work; re-print snapshot\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"set\", \"<entry-id>\", \"autoplay\", \"true\"] \u2014 mid-session scalar by ID (e.g. media; no re-open)\n [\"set\", \"<entry-id>:autoplay=true\"] \u2014 same, batch-shaped token on page session\n [\"set\", \"@c1\", \"visual\", \"<media-id>\", \"--link\"] \u2014 single Entry link field only\n [\"set\", \"@c2\", \"contents\", \"<id1>,<id2>\", \"--links\"] \u2014 array of links (full replace); never --link on arrays\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"diff\"] \u2014 show pending changes\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 scalar by ID (OK mid-page session; then save)\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets (staging, production, site live preview, Contentful)\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session): use [\"peek\", \"--page-slug\", \"<slug>\"] or [\"peek\", \"--id\", \"<entry-id>\"]. Includes rootFields in JSON \u2014 no follow-up read required.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (any length)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n\nJSON bulk input (create from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (small payloads)\n --json-base64 \"<b64>\" base64-encoded JSON (large payloads)\n\nAsset upload (hosted MCP):\n Large files: [\"staged-upload\", \"request\", \"--file-name\", \"photo.png\", \"--mime\", \"image/png\"] then curl uploadUrl, then [\"asset\", \"upload\", \"--staged\", \"<id>\", ...].\n Or cms_edit_request_staged_upload when available. Small files: --url or --base64 with --mime and --file-name";
|
|
4
|
+
export declare const TOOL_DESCRIPTION = "Run any cms-edit command. cms-edit edits Contentful draft content (no publishing).\n\nUse cms_edit_version (no args) to check the installed version.\nUse cms_edit_help to read the getting-started guide by topic.\nUse cms_edit_customer to read site-specific playbooks (articles, routing, blog-tag-matrix, etc.).\nIf Integrations only exposes cms_edit, use [\"customer\", \"index\"] or [\"customer\", \"resource=index\"] instead.\nRead the cms-edit://guide resource for the full guide.\n\nWorkflow: open \u2192 snapshot \u2192 read/set/rtf/add/remove \u2192 diff \u2192 save\nAll saves create drafts only \u2014 a human must publish in Contentful.\n\nCRITICAL \u2014 sessions and open:\n set/rtf field edits are staged until save. Plain open while dirty HARD-FAILS (does not wipe silently).\n [\"open\", \"--resume\"] \u2014 re-print current session; keeps all staged edits (no Contentful refetch)\n [\"open\", \"--overwrite\", \"--id\", \"<id>\"] \u2014 abandon staged work and load a new entry\n [\"discard\"] then open \u2014 also valid abandon path\n Never re-open the same article mid-edit without save/discard \u2014 use --resume if you only need the tree again.\n\nCommon command sequences:\n [\"open\", \"--page-slug\", \"/\"] \u2014 homepage (CMS slug index; /index is equivalent)\n [\"open\", \"--page-slug\", \"/pricing\"] \u2014 load a page by slug (skips template menu/footer)\n [\"open\", \"--include-chrome\", \"--page-slug\", \"/pricing\"] \u2014 also fetch template nav chrome\n [\"open\", \"--id\", \"<entry-id>\"] \u2014 load by Contentful entry ID\n [\"open\", \"--resume\"] \u2014 keep staged work; re-print snapshot\n [\"snapshot\"] \u2014 print content tree with @refs\n [\"read\", \"@c0\"] \u2014 read all fields of a component (requires open session)\n [\"read\", \"@c0\", \"heading\"] \u2014 read a specific field (requires open session)\n [\"read\", \"@root\"] \u2014 read root entry fields (requires open session)\n [\"read\", \"<entry-id>\", \"--id\"] \u2014 read entry by ID (no session)\n [\"read\", \"<entry-id>\", \"--id\", \"heading\"] \u2014 read one field by entry ID (no session)\n [\"peek\", \"--page-slug\", \"/pricing\"] \u2014 preview tree + root fields (no session)\n [\"peek\", \"--id\", \"<entry-id>\"] \u2014 preview by entry ID with rootFields in JSON\n [\"set\", \"@c0\", \"heading\", \"New heading\"] \u2014 set a scalar field\n [\"set\", \"<entry-id>\", \"autoplay\", \"true\"] \u2014 mid-session scalar by ID (e.g. media; no re-open)\n [\"set\", \"<entry-id>:autoplay=true\"] \u2014 same, batch-shaped token on page session\n [\"set\", \"@c1\", \"visual\", \"<media-id>\", \"--link\"] \u2014 single Entry link field only\n [\"set\", \"@c2\", \"contents\", \"<id1>,<id2>\", \"--links\"] \u2014 array of links (full replace); never --link on arrays\n [\"rtf\", \"@c0\", \"body\", \"--content\", \"# H1\\n\\nBody.\"] \u2014 set rich text (preferred for AI)\n [\"rtf\", \"@c0\", \"body\", \"--base64\", \"<encoded>\"] \u2014 set rich text via base64 (no filesystem)\n [\"diff\"] \u2014 show pending changes\n [\"save\"] \u2014 write drafts to Contentful\n [\"discard\"] \u2014 discard unsaved changes\n [\"links\", \"set\", \"@c0\", \"0\", \"variant\", \"link\"] \u2014 set scalar field on link at index 0\n [\"batch\", \"set\", \"<entry-id>:variant=link\"] \u2014 scalar by ID (OK mid-page session; then save)\n [\"batch\", \"diff\"] \u2014 show pending batch edits\n [\"batch\", \"save\"] \u2014 save all batch edits as drafts\n [\"health\"] \u2014 verify config and connectivity\n [\"diagnose\"] \u2014 session/MCP diagnostics (store, userId, active session)\n [\"version\"] \u2014 print installed cms-edit version\n [\"guide\"] \u2014 print getting-started guide\n [\"guide\", \"workflow\"] \u2014 print a guide section\n [\"customer\", \"index\"] \u2014 list site editor playbooks\n [\"customer\", \"articles\"] \u2014 read articles playbook\n [\"customer\", \"resource=index\"] \u2014 same as index (Integrations fallback)\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\", \"-n\", \"10\"] \u2014 recent articles by publication date\n [\"list\", \"--type\", \"article\", \"--sort\", \"date\"] \u2014 list articles (preview index includes drafts)\n [\"peek\", \"--article-slug\", \"<slug>\"] \u2014 preview draft or published article (CMA)\n [\"preview\", \"url\", \"/pricing\"] \u2014 staging page URL (open in browser MCP)\n [\"preview\", \"urls\", \"/pricing\"] \u2014 all preview targets (staging, production, site live preview, Contentful)\n [\"preview\", \"showcase\", \"--component\", \"HeroSimple\"] \u2014 component showcase URL (mock data)\n [\"preview\", \"showcase\", \"--collection\", \"CardGrid\", \"--param\", \"backgroundColour=Navy\"]\n\nDiscovery notes:\n Visual checks: use preview url / preview showcase, then open the returned URL with a browser MCP (cms-edit does not capture screenshots).\n peek/open/read --id load draft content via CMA \u2014 NOT published-only.\n Only list --published / resolve --published use the published-only Delivery API index.\n Articles: use --article-slug (not --page-slug). search --type article sorts by publication date.\n\nSessions persist between MCP calls (Redis on hosted, disk locally). MCP auto-uses session \"_mcp\" unless you pass --session.\nUse --session <name> before the subcommand to isolate concurrent workflows, e.g. [\"--session\", \"my-work\", \"open\", \"/\"].\nUse --space <name> to target a specific Contentful space (local MCP only \u2014 omit for hosted Integrations).\nStateless read (no open required): [\"read\", \"<entry-id>\", \"--id\"] or [\"read\", \"<entry-id>\", \"--id\", \"heading\"].\npeek is one-shot (no session): use [\"peek\", \"--page-slug\", \"<slug>\"] or [\"peek\", \"--id\", \"<entry-id>\"]. Includes rootFields in JSON \u2014 no follow-up read required.\nOutput is always JSON (CMS_EDIT_JSON=1 is forced by the MCP server).\n\n\nRich text tips:\n --content \"<markdown>\" preferred named flag for inline content (any length)\n --base64 \"<encoded>\" fully environment-agnostic, no filesystem needed\n\nJSON bulk input (create from-json, batch run, taxonomy/person/article-tags imports, set object fields, rtf patch):\n --json \"<string>\" inline JSON (small payloads)\n --json-base64 \"<b64>\" base64-encoded JSON (large payloads)\n\nAsset upload (hosted MCP):\n Large files: [\"staged-upload\", \"request\", \"--file-name\", \"photo.png\", \"--mime\", \"image/png\"] then curl uploadUrl, then [\"asset\", \"upload\", \"--staged\", \"<id>\", ...].\n Or cms_edit_request_staged_upload when available. Small files: --url or --base64 with --mime and --file-name";
|
|
5
5
|
export declare function registerCmsEditTools(server: McpServer, runCmsEdit: RunCmsEditFn, hosted?: HostedMcpInfo): void;
|
|
6
6
|
export declare function getMcpServerInfo(hosted?: HostedMcpInfo): {
|
|
7
7
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"cms-edit.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,gBAAgB,qrPAsFkF,CAAC;AAEhH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,UAAU,EAAE,YAAY,EACxB,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,CAmEN;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAE1F"}
|
|
@@ -23,7 +23,8 @@ CRITICAL — sessions and open:
|
|
|
23
23
|
|
|
24
24
|
Common command sequences:
|
|
25
25
|
["open", "--page-slug", "/"] — homepage (CMS slug index; /index is equivalent)
|
|
26
|
-
["open", "--page-slug", "/pricing"] — load a page by slug
|
|
26
|
+
["open", "--page-slug", "/pricing"] — load a page by slug (skips template menu/footer)
|
|
27
|
+
["open", "--include-chrome", "--page-slug", "/pricing"] — also fetch template nav chrome
|
|
27
28
|
["open", "--id", "<entry-id>"] — load by Contentful entry ID
|
|
28
29
|
["open", "--resume"] — keep staged work; re-print snapshot
|
|
29
30
|
["snapshot"] — print content tree with @refs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms-edit.js","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,CAAC,MAAM,gBAAgB,GAAG
|
|
1
|
+
{"version":3,"file":"cms-edit.js","sourceRoot":"","sources":["../../../src/mcp/tools/cms-edit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BACV,IAAI,EAAE,UAAU,IAAI,MAAM;gBAC1B,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,IAAI;gBACX,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;gBACvC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACxD,CAAC,CAAC;YACH,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;QACxC,MAAM,UAAU,GACd,KAAK;YACL,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACrC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC/B,UAAU,CAAC,eAAe,EAAE;YAC1B,UAAU;YACV,IAAI,EAAE,UAAU,IAAI,MAAM;YAC1B,EAAE,EAAE,CAAC,UAAU;YACf,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACxC,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAsB;IACrD,OAAO,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -23,6 +23,8 @@ export interface CmsEditRuntimeContext {
|
|
|
23
23
|
mediaPipelineJobStore?: MediaPipelineJobStore;
|
|
24
24
|
/** Hosted project key (e.g. se2026) for media job bindings / logs. */
|
|
25
25
|
projectKey?: string;
|
|
26
|
+
/** Drop the cached CMA PAT when a command-time CMA call returns 401. */
|
|
27
|
+
onCmaUnauthorized?: () => Promise<void>;
|
|
26
28
|
}
|
|
27
29
|
export declare const cmsEditContext: AsyncLocalStorage<CmsEditRuntimeContext>;
|
|
28
30
|
export declare function getRuntimeContext(): CmsEditRuntimeContext | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,sEAAsE;IACtE,MAAM,CAAC,EAAE,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;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iB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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;AA+BrD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrich.d.ts","sourceRoot":"","sources":["../../src/telemetry/enrich.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"enrich.d.ts","sourceRoot":"","sources":["../../src/telemetry/enrich.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;AAEnD,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAG3D;AAED,KAAK,mBAAmB,GAAG,IAAI,CAC7B,cAAc,EACd,UAAU,GAAG,kBAAkB,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,GAAG,aAAa,CACvF,GAAG;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAkB/E"}
|
package/dist/telemetry/enrich.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CMS_EDIT_VERSION } from '../version.js';
|
|
2
|
+
import { getContentfulRequestStats } from './request-stats.js';
|
|
2
3
|
export function isHostedMcpMode() {
|
|
3
4
|
return process.env['VERCEL'] === '1' || process.env['CMS_EDIT_HOSTED'] === '1';
|
|
4
5
|
}
|
|
@@ -10,6 +11,7 @@ export function getTelemetryProjectKey() {
|
|
|
10
11
|
return key || undefined;
|
|
11
12
|
}
|
|
12
13
|
export function enrichTelemetryEvent(event) {
|
|
14
|
+
const stats = getContentfulRequestStats();
|
|
13
15
|
return {
|
|
14
16
|
...event,
|
|
15
17
|
event_id: crypto.randomUUID(),
|
|
@@ -18,6 +20,13 @@ export function enrichTelemetryEvent(event) {
|
|
|
18
20
|
project_key: event.project_key ?? getTelemetryProjectKey(),
|
|
19
21
|
node_version: process.version,
|
|
20
22
|
platform: process.platform,
|
|
23
|
+
...(stats
|
|
24
|
+
? {
|
|
25
|
+
cma_requests: stats.cma_requests,
|
|
26
|
+
cpa_requests: stats.cpa_requests,
|
|
27
|
+
...(stats.index_sync_mode ? { index_sync_mode: stats.index_sync_mode } : {}),
|
|
28
|
+
}
|
|
29
|
+
: {}),
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
//# sourceMappingURL=enrich.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrich.js","sourceRoot":"","sources":["../../src/telemetry/enrich.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"enrich.js","sourceRoot":"","sources":["../../src/telemetry/enrich.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAK/D,MAAM,UAAU,eAAe;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,GAAG,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,eAAe,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,OAAO,GAAG,IAAI,SAAS,CAAC;AAC1B,CAAC;AASD,MAAM,UAAU,oBAAoB,CAAC,KAA0B;IAC7D,MAAM,KAAK,GAAG,yBAAyB,EAAE,CAAC;IAC1C,OAAO;QACL,GAAG,KAAK;QACR,QAAQ,EAAE,MAAM,CAAC,UAAU,EAAE;QAC7B,gBAAgB,EAAE,gBAAgB;QAClC,IAAI,EAAE,gBAAgB,EAAE;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,sBAAsB,EAAE;QAC1D,YAAY,EAAE,OAAO,CAAC,OAAO;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,CAAC,KAAK;YACP,CAAC,CAAC;gBACE,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7E;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -5,5 +5,6 @@ export { createTelemetryWriter } from './factory.js';
|
|
|
5
5
|
export { LocalFileTelemetryWriter } from './local.js';
|
|
6
6
|
export { NoOpTelemetryWriter } from './noop.js';
|
|
7
7
|
export { beginTelemetryCommand, flushTelemetry, getTelemetryWriter, recordOAuthTelemetryFailure, recordOAuthTelemetryOutcome, recordOAuthTelemetrySuccess, recordTelemetryOutcome, resetTelemetryStateForTests, } from './record.js';
|
|
8
|
+
export { getContentfulRequestStats, incrementCmaRequests, incrementCpaRequests, runWithContentfulRequestStats, setIndexSyncMode, } from './request-stats.js';
|
|
8
9
|
export type { TelemetryEvent, TelemetryWriter } from './types.js';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/telemetry/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { createTelemetryWriter } from './factory.js';
|
|
|
5
5
|
export { LocalFileTelemetryWriter } from './local.js';
|
|
6
6
|
export { NoOpTelemetryWriter } from './noop.js';
|
|
7
7
|
export { beginTelemetryCommand, flushTelemetry, getTelemetryWriter, recordOAuthTelemetryFailure, recordOAuthTelemetryOutcome, recordOAuthTelemetrySuccess, recordTelemetryOutcome, resetTelemetryStateForTests, } from './record.js';
|
|
8
|
+
export { getContentfulRequestStats, incrementCmaRequests, incrementCpaRequests, runWithContentfulRequestStats, setIndexSyncMode, } from './request-stats.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type IndexSyncTelemetryMode = 'full' | 'incremental' | 'hydrate' | 'skip';
|
|
2
|
+
export interface ContentfulRequestStats {
|
|
3
|
+
cma_requests: number;
|
|
4
|
+
cpa_requests: number;
|
|
5
|
+
index_sync_mode?: IndexSyncTelemetryMode;
|
|
6
|
+
}
|
|
7
|
+
/** Reuse an existing request store so nested CLI-in-MCP does not drop PAT counts. */
|
|
8
|
+
export declare function runWithContentfulRequestStats<T>(fn: () => T): T;
|
|
9
|
+
export declare function getContentfulRequestStats(): ContentfulRequestStats | undefined;
|
|
10
|
+
export declare function incrementCmaRequests(): void;
|
|
11
|
+
export declare function incrementCpaRequests(): void;
|
|
12
|
+
export declare function setIndexSyncMode(mode: IndexSyncTelemetryMode): void;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function resetContentfulRequestStatsForTests(): void;
|
|
15
|
+
//# sourceMappingURL=request-stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-stats.d.ts","sourceRoot":"","sources":["../../src/telemetry/request-stats.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,sBAAsB,CAAC;CAC1C;AAQD,qFAAqF;AACrF,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAG/D;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,GAAG,SAAS,CAE9E;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAGnE;AAED,gBAAgB;AAChB,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const storage = new AsyncLocalStorage();
|
|
3
|
+
function emptyStats() {
|
|
4
|
+
return { cma_requests: 0, cpa_requests: 0 };
|
|
5
|
+
}
|
|
6
|
+
/** Reuse an existing request store so nested CLI-in-MCP does not drop PAT counts. */
|
|
7
|
+
export function runWithContentfulRequestStats(fn) {
|
|
8
|
+
if (storage.getStore())
|
|
9
|
+
return fn();
|
|
10
|
+
return storage.run(emptyStats(), fn);
|
|
11
|
+
}
|
|
12
|
+
export function getContentfulRequestStats() {
|
|
13
|
+
return storage.getStore();
|
|
14
|
+
}
|
|
15
|
+
export function incrementCmaRequests() {
|
|
16
|
+
const stats = storage.getStore();
|
|
17
|
+
if (stats)
|
|
18
|
+
stats.cma_requests += 1;
|
|
19
|
+
}
|
|
20
|
+
export function incrementCpaRequests() {
|
|
21
|
+
const stats = storage.getStore();
|
|
22
|
+
if (stats)
|
|
23
|
+
stats.cpa_requests += 1;
|
|
24
|
+
}
|
|
25
|
+
export function setIndexSyncMode(mode) {
|
|
26
|
+
const stats = storage.getStore();
|
|
27
|
+
if (stats)
|
|
28
|
+
stats.index_sync_mode = mode;
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
export function resetContentfulRequestStatsForTests() {
|
|
32
|
+
// ALS is request-scoped; tests call runWithContentfulRequestStats instead.
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=request-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-stats.js","sourceRoot":"","sources":["../../src/telemetry/request-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAA0B,CAAC;AAEhE,SAAS,UAAU;IACjB,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,6BAA6B,CAAI,EAAW;IAC1D,IAAI,OAAO,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,EAAE,CAAC;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,IAAI,KAAK;QAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,IAAI,KAAK;QAAE,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAA4B;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,IAAI,KAAK;QAAE,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;AAC1C,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,mCAAmC;IACjD,2EAA2E;AAC7E,CAAC"}
|
|
@@ -29,6 +29,12 @@ export interface TelemetryEvent {
|
|
|
29
29
|
node_version: string;
|
|
30
30
|
/** process.platform value. */
|
|
31
31
|
platform: string;
|
|
32
|
+
/** Content Management API origin requests during this command (when counted). */
|
|
33
|
+
cma_requests?: number;
|
|
34
|
+
/** Content Preview API origin requests during this command (when counted). */
|
|
35
|
+
cpa_requests?: number;
|
|
36
|
+
/** How the content index was satisfied for this command. */
|
|
37
|
+
index_sync_mode?: 'full' | 'incremental' | 'hydrate' | 'skip';
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Abstraction for telemetry sinks. Swap out LocalFileTelemetryWriter for a remote
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E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B,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,eAAe,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,GAAG,MAAM,CAAC;CAC/D;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
|
package/docs/help/workflow.md
CHANGED
|
@@ -22,9 +22,11 @@ cms-edit search "hepatology"
|
|
|
22
22
|
cms-edit open --page-slug /solutions/hepatology
|
|
23
23
|
# or by entry ID:
|
|
24
24
|
cms-edit open --id 4xKpzQ2abc123
|
|
25
|
+
# include template menu/footer/nav (off by default):
|
|
26
|
+
cms-edit open --include-chrome --page-slug /solutions/hepatology
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
`open` fetches the
|
|
29
|
+
`open` fetches the page/article tree (and the template entry) and saves it to a local session file. It does **not** walk template menu/footer/navigation unless you pass `--include-chrome`. All subsequent commands operate on this session without re-fetching from Contentful until you `save`.
|
|
28
30
|
|
|
29
31
|
### Critical: do not re-open while edits are staged
|
|
30
32
|
|
package/docs/mcp/hosted-guide.md
CHANGED
|
@@ -85,8 +85,11 @@ Each step is a separate `cms_edit` call. Sessions persist in Redis between calls
|
|
|
85
85
|
["open", "--page-slug", "/"]
|
|
86
86
|
["open", "--page-slug", "/pricing"]
|
|
87
87
|
["open", "--id", "<entry-id>"]
|
|
88
|
+
["open", "--include-chrome", "--page-slug", "/pricing"]
|
|
88
89
|
```
|
|
89
90
|
|
|
91
|
+
Default `open` / `peek` fetch the page or article tree and the template entry, but **not** template menu/footer/navigation. Edit nav with `nav open`. Use `--include-chrome` only when you need those trees.
|
|
92
|
+
|
|
90
93
|
**Homepage (all SE Studio sites):** Contentful stores the marketing homepage slug as `index`. The live site URL is `/`. In cms-edit, `--page-slug /` and `--page-slug /index` are equivalent (both resolve to `index`). Read `cms-edit://customer/routing` for site-specific exceptions (e.g. Pedestal uses `home`).
|
|
91
94
|
|
|
92
95
|
### 2. Snapshot — see the content tree
|
package/package.json
CHANGED
package/skills/core/SKILL.md
CHANGED
|
@@ -62,8 +62,13 @@ cms-edit open --id 4xKj2abcDef
|
|
|
62
62
|
|
|
63
63
|
# Home page (slug is 'index')
|
|
64
64
|
cms-edit open --page-slug /
|
|
65
|
+
|
|
66
|
+
# Include template menu/footer/nav (default open skips site chrome)
|
|
67
|
+
cms-edit open --include-chrome --page-slug /pricing
|
|
65
68
|
```
|
|
66
69
|
|
|
70
|
+
`open` / `peek` fetch the page (or article) tree and the template entry, but **not** template `menu` / `footer` / navigation. Edit nav with `nav open`. Pass `--include-chrome` only when you need those trees.
|
|
71
|
+
|
|
67
72
|
**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.
|
|
68
73
|
|
|
69
74
|
### Step 2: Read the snapshot
|