Use the CLI with AI coding agents

Ask about this Page
Copy for AI
View as Markdown

Check that the CLI is ready for your coding agent and install the commercetools AI plugin from the terminal.

The CLI is designed to be run by AI coding agents as well as by people. Commands print structured output when you ask for it, destructive commands can be previewed, and a single command checks whether everything is set up.

This page covers the commands that connect the CLI with the commercetools AI plugin, which bundles the skills and MCP servers for your coding agent.

Check your setup with doctor

The doctor command reports the CLI version and the authentication status. It also lists the AI coding agents installed on the machine and whether the commercetools AI plugin is installed.
Check your setupbash
commercetools doctor
Use --json for machine-readable output:
Print the result as JSONbash
commercetools doctor --json
Example outputjson
{
  "ok": true,
  "cli": { "version": "0.1.0", "node": "22.23.4", "minVersion": null, "compatible": true },
  "auth": { "authenticated": true, "projectKey": "my-project", "region": "europe-west1.gcp" },
  "agents": [
    { "id": "claude", "detected": true, "pluginInstalled": true },
    { "id": "cursor", "detected": false, "pluginInstalled": null }
  ]
}
The pluginInstalled value is true or false, or null when the CLI cannot determine the state for that agent. Only agents that are detected on the machine are reported as installed or not installed.

Require a minimum CLI version

Skills, scripts, and agents can require a minimum CLI version with --min-version. The command fails if the installed CLI is older, so the caller knows to update it:
Require a minimum versionbash
commercetools doctor --json --min-version 0.1.0
Exit codeMeaning
0The CLI satisfies the minimum version, or no minimum was requested
1The CLI is older than the requested minimum version
2The value of --min-version is not a valid version, for example latest

Install the AI plugin

The ai install command installs the commercetools AI plugin into your coding agent, so you do not need to know the plugin commands of each agent.
Install the plugin for detected agentsbash
commercetools ai install
Without --agent, the command installs the plugin for every agent it detects on the machine. To choose agents yourself, repeat the flag:
Install the plugin for chosen agentsbash
commercetools ai install --agent claude --agent codex
To see the commands without running them, use --dry-run:
Preview the installationbash
commercetools ai install --agent claude --dry-run

Supported agents

Agent (--agent)What the command does
claude (Claude Code)Adds the plugin marketplace and installs the plugin with the claude command
codex (OpenAI Codex)Adds the plugin marketplace and installs the plugin with the codex command
copilot (VS Code/Copilot)Installs the plugin with the GitHub Copilot CLI when it supports plugins. Otherwise it prints the steps for the VS Code Command Palette.
cursor (Cursor)Prints the steps to follow in Cursor, because Cursor installs plugins through its settings
pi (Pi), opencode (OpenCode)Installs only the skills, using the skills CLI
otherInstalls the skills for any agent that reads SKILL.md files. Use --skills-agent <id> to target one agent, for example --skills-agent windsurf.

If the command for an agent is not available on the machine, the CLI prints the steps to follow manually instead of failing.

Flags

FlagDescription
--agentThe agent to install the plugin for. Repeat the flag for several agents. Defaults to every detected agent.
--skills-agentWith --agent other, install the skills for this agent id of the skills CLI
--marketplaceThe source of the plugin marketplace. Defaults to commercetools/commercetools-ai-plugins. You can also set it with the COMMERCETOOLS_AI_MARKETPLACE environment variable, for example to use a mirror.
--dry-runPrint the commands that would run without running them
--jsonPrint the result as JSON. Each agent has a status of installed, planned, manual, or failed.

The command exits with a non-zero code if an installation fails.

Run the CLI from an agent

These behaviors make the CLI easier to run from an agent or a script:

  • Pass --json where it is available to get output you can parse.
  • Run --dry-run first on commands that change or delete resources, and pass --yes to skip confirmation prompts in non-interactive runs.
  • Run commercetools doctor --json --min-version <version> at the start of a workflow to check that the CLI is recent enough.
  • Run commercetools <topic> <command> --help to discover flags and examples.
For the list of commands that support these flags, see Common flags.