forge-cli — manage your Forge site from the terminal
Phase 2 has shipped a lot of AI-facing infrastructure. forge-cli is the other side of that coin — the operator's tool for when no AI client is running.
Until now, content lifecycle transitions and token management required either a connected MCP client or direct database access. Neither works well in a CI/CD pipeline or at 2am when something needs fixing.
forge-cli fills that gap.
Installation
go install github.com/forge-cms/forge/forge-cli@latest
Zero third-party dependencies. Requires Go 1.22 or later.
Configuration
Two environment variables, or a .forge-cli.env file in your working directory:
FORGE_URL=https://your-site.com
FORGE_TOKEN=your-bearer-token
The CLI is always an HTTP client. No direct database access.
Content commands
Content commands take the URL path prefix of the content type as the first argument — the same prefix you registered with forge.At().
Create a draft from a markdown file with YAML frontmatter:
forge-cli posts create --from post.md
forge-cli posts update my-post --from updated.md
The update command GETs the existing item first and overlays only the fields present in the file. Fields absent from the file are left unchanged — no accidental overwrites.
Lifecycle transitions:
forge-cli posts publish my-post
forge-cli posts unpublish my-post
forge-cli posts archive my-post
forge-cli posts list --status draft
forge-cli posts get my-post
Token management
forge-cli token create --name ci-deploy --role author --ttl 720h
forge-cli token list
forge-cli token revoke <id>
Token commands require an Admin-role token. The plaintext token is printed once on creation — copy it immediately.
Status
forge-cli status
Calls /_health and prints versions and module state. Exits non-zero if the server is unreachable — useful as a deploy check.
Why a separate submodule
Not every Forge deployment needs a CLI, and forge core has zero third-party dependencies to protect. forge-cli follows the same pattern as forge-mcp — opt in when you need it.
forge-cli v0.1.0 is tagged and available now at github.com/forge-cms/forge/forge-cli.