Deco CLI

raw JSON →
0.29.0 verified Sat Apr 25 auth: no javascript

Deco CLI v0.29.0 is the command-line interface for managing AI-native projects on decocms.com. It supports authentication, project scaffolding, local development with live preview via deco link, type generation, and deployment to Cloudflare Workers. The package is distributed as an npm package requiring Node.js >=24.0.0. It uses ESM-only exports and ships TypeScript declarations. Unlike generic CMS CLIs, it is tailored for the Deco platform with built-in MCP (Model Context Protocol) integration and self-hostable hosting features.

error Error [ERR_REQUIRE_ESM]: require() of ES Module from CommonJS not supported.
cause Using require('deco-cli') in a CommonJS file.
fix
Use import syntax: import deco from 'deco-cli'
error Error: Cannot find module 'deco-cli/commands'
cause The import path is incorrect or the version does not have commands in subpaths.
fix
Install version >=0.29.0 and use correct subpath imports.
error Error: login is not a function
cause Importing login directly from 'deco-cli' instead of 'deco-cli/commands'.
fix
Use import { login } from 'deco-cli/commands'
error Error: The engine 'node' is incompatible with this module.
cause Node.js version is below 24.0.0.
fix
Upgrade Node.js to version >=24.0.0.
breaking ESM-only: This package requires Node.js >=24.0.0 and does not support CommonJS require().
fix Use import syntax and update Node.js to >=24.0.0.
gotcha Commands are in subpaths: The main export only provides the CLI runner; individual commands must be imported from specific paths like 'deco-cli/commands'.
fix Import commands from their respective subpaths, e.g., import { deploy } from 'deco-cli/commands'.
deprecated The 'deco dev' command is experimental and may change or be removed in future versions.
fix Use npm run dev instead for a stable development experience.
gotcha Authentication token must be set via environment variable DECO_CHAT_API_TOKEN; the login command also stores it locally but the env var takes precedence.
fix Set process.env.DECO_CHAT_API_TOKEN if you need to override the stored token.
breaking Node.js version requirement: Node.js >=24.0.0 is strictly enforced; older versions will produce import errors.
fix Update Node.js to the latest LTS or version 24+.
npm install deco-cli
yarn add deco-cli
pnpm add deco-cli

Demonstrates programmatic authentication and running the deploy command using the deco-cli API.

import { run } from 'deco-cli';
import { login } from 'deco-cli/commands';

// Authenticate with a token
process.env.DECO_CHAT_API_TOKEN = 'your-token-here';
await login();

// Or run the CLI programmatically
await run(['deploy', '-w', 'my-workspace'], {
  cwd: process.cwd(),
  stdio: 'inherit'
});