Contentful CLI
$ contentful Official Med RiskContentful CLI (contentful) manages Contentful spaces, environments, content types, and migration scripts. It provides repeatable environment cloning and local JSON exports, though interactive prompts are common unless --management-token and flags are explicitly supplied.
brew install contentful-cli Use contentful CLI for schema migrations, space exports, and environment aliases; use Contentful MCP for reading or authoring individual CMS entries.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Accepts --management-token and explicit ID flags, but lacks universal --json stdout formatting and can fall back to interactive prompts if IDs are omitted.
- Omitting
--space-idtriggers interactive space picker prompts - Outputs human-readable tables rather than structured JSON
Supports environment isolation (--environment-id) and JSON exports before migrations, though master mutations are high-impact.
- Named environments isolate schema changes from
master - Requires Content Management API token
Installable via npm or Homebrew on macOS, Linux, and Windows.
- Published as
contentful-clion npm and Homebrew
Reliable for environment cloning, migrations, and full space JSON backup/restore.
- Standard tool for Contentful CI/CD schema migrations
Official Contentful repository (contentful/contentful-cli) under MIT.
- Official Contentful GitHub organization
Documented in Contentful Developer Docs and repository README.
- Official tutorials and reference docs at contentful.com
Security, Auth & Guardrails
Stores management tokens in ~/.contentfulrc.json or reads CONTENTFUL_MANAGEMENT_TOKEN / --management-token.
CLI is free (MIT); Contentful offers a free community space tier with paid enterprise plans.
# Contentful CLI Agent Rules - Always pass `--space-id` and `--environment-id` targeting a non-`master` environment. - Run `contentful space export` before executing `contentful space migration` or `import`. - Never delete environments or modify `master` environment aliases without explicit human approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
contentful space list
Lists Contentful space IDs and names accessible to the configured management token.
contentful space environment list --space-id <SPACE_ID>
Inspects master and staging environments within the given space.
Controlled Writes & Previews
contentful space export --space-id <SPACE_ID> --environment-id staging
Writes a local JSON snapshot of content types, entries, and assets from staging.
Strengths for Agents
- + Built-in
space exportandspace migrationsupport reproducible Contentful CI/CD pipelines. - + Environment isolation via
--environment-idlets agents test schema changes safely offmaster. - + Supports
CONTENTFUL_MANAGEMENT_TOKENfor headless execution.
Caveats & Pitfalls
- ! Commands prompt interactively if
--space-idor--environment-idis omitted. - ! Table-formatted stdout on list commands lacks a native
--jsonflag.