Skip to content

adaptocms/adapto-cms-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adapto CMS CLI

Command-line interface for the Adapto CMS management API.

Install

Quick install (macOS/Linux)

curl -sSL https://raw.githubusercontent.com/adaptocms/adapto-cms-cli/main/scripts/install.sh | bash

From source

go install github.com/adaptocms/adapto-cms-cli@latest

From releases

Download the binary for your platform from GitHub Releases.

Configuration

Set these environment variables:

Variable Description Required
ADAPTO_TOKEN Bearer token (from adapto auth login) Yes (for management commands)
ADAPTO_API_URL API base URL (default: https://api.adaptocms.com) No
ADAPTO_TENANT_ID Tenant ID for multi-tenant setups No

All variables can also be passed as flags: --token, --api-url, --tenant-id.

Quick Start

# Login (credentials are saved automatically)
adapto auth login --email you@example.com --password yourpassword

# List articles
adapto articles list

# Get JSON output
adapto articles list --json

# Create an article (interactive prompts for missing fields)
adapto articles create

# Create with flags
adapto articles create \
  --title "My Article" \
  --content "Hello world" \
  --slug "my-article" \
  --author "Jane" \
  --language "en"

File Upload

Upload files directly from the CLI:

# Single-step upload (creates metadata + uploads content)
adapto files upload ./photo.jpg

# Two-step: create metadata first, then upload by ID
adapto files create-metadata --filename photo.jpg --content-type image/jpeg
adapto files upload-by-id FILE_ID ./photo.jpg

Media Objects

Articles, pages, and collection items support attaching media (images, videos, embeds) via the --media-json flag on create, update, and create-translation commands:

adapto articles create \
  --title "My Post" \
  --content "<p>Hello</p>" \
  --slug my-post \
  --author "Jane" \
  --language en \
  --media-json '[{
    "placement_key": "hero_image",
    "media_object": {
      "id": "m1",
      "file_id": "FILE_ID",
      "url": "https://cdn.example.com/photo.jpg",
      "type": "image"
    },
    "alt_text": "Hero image"
  }]'

Each placement object supports:

  • placement_key — where the media goes (e.g. hero_image, body_image_1)
  • media_objectid, file_id, url, type (image/video/audio/document/other/youtube/vimeo/tiktok/instagram_reel/instagram_post), title, description
  • caption, alt_text, meta_data — optional metadata

The same --media-json flag works on adapto pages create/update and adapto collections items create/update.

Commands

adapto
├── version                          Print CLI version
├── llm-info                         Full CLI reference for LLM agents
├── auth
│   ├── login                        Login with email/password
│   ├── register                     Register new account
│   ├── logout                       Revoke refresh token
│   ├── refresh                      Refresh access token
│   ├── me                           Current user info
│   ├── change-password              Change password
│   ├── request-password-reset       Request reset email
│   ├── reset-password               Reset with token
│   ├── activate                     Activate account
│   ├── resend-activation            Resend activation email
│   ├── login-github                 GitHub OAuth
│   ├── callback-github              GitHub OAuth callback
│   ├── login-google                 Google OAuth
│   ├── switch-tenant                Switch active tenant
│   └── orgs                         List organizations/tenants
├── articles
│   ├── list                         List articles
│   ├── create                       Create article
│   ├── get <id>                     Get by ID
│   ├── get-by-slug <slug>           Get by slug
│   ├── update <id>                  Update article
│   ├── delete <id>                  Delete article
│   ├── publish <id>                 Publish
│   ├── archive <id>                 Archive
│   ├── translations <id>            List translations
│   ├── create-translation <id>      Create translation
│   └── categories <id>              List categories
├── categories
│   ├── list / create / get / update / delete
│   ├── get-by-slug / subcategories
│   ├── articles / add-article / remove-article
│   └── translations / create-translation
├── pages
│   ├── list / create / get / update / delete
│   ├── get-by-slug / publish / archive
│   └── translations / create-translation
├── collections
│   ├── list / create / get / update / delete
│   ├── get-by-slug
│   └── items
│       ├── list / create / get / update / delete
│       ├── create-batch / get-by-slug
│       ├── publish / archive
│       └── translations / create-translation
├── files
│   ├── list / get / update / delete
│   ├── create-metadata
│   ├── upload / upload-by-id
│   └── multipart-init / multipart-complete / multipart-abort
├── microcopy
│   ├── list / count / create / get / update / delete
│   ├── get-by-key / get-by-language
│   └── translations / create-translation
└── status
    └── version                      API version info

Output

By default, commands output formatted tables. Use --json for JSON output:

adapto articles list --json
adapto articles get abc123 --json

Interactive Mode

When running in a terminal (TTY), missing required parameters will be prompted interactively. When piped or in scripts, missing parameters produce an error with usage hints.

Development

# Build
make build

# Run tests
make test

# Regenerate API client from OpenAPI spec
make generate

Releasing

Every push to main automatically bumps the patch version and creates a release. For intentional minor/major bumps, use make release:

make release              # patch bump (v0.1.0 → v0.1.1)
make release BUMP=minor   # minor bump (v0.1.1 → v0.2.0)
make release BUMP=major   # major bump (v0.2.0 → v1.0.0)

Releases are built for all platforms and published to GitHub Releases:

  • adapto-linux-amd64
  • adapto-linux-arm64
  • adapto-darwin-amd64
  • adapto-darwin-arm64
  • adapto-windows-amd64.exe

LLM Integration

To give an LLM agent full knowledge of the CLI (for MCP/tool-use scenarios):

adapto llm-info

This prints a comprehensive markdown reference of every command, flag, and workflow.

License

MIT

About

Command-line interface for the Adapto CMS management API. Give LLM agents full knowledge of the CLI (for MCP/tool-use scenarios).

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors