Forgecroft Docs
Guides

CLI Reference

The Forgecroft CLI manages runs, workspaces, and API keys from the command line. Install it with Homebrew or the curl installer.

Installation

Homebrew:

brew install forgecroft/tap/forgecroft

curl:

curl -fsSL https://forgecroft.com/install.sh | sh

Authentication

The recommended way to authenticate is the browser-based login:

forgecroft login

This opens your browser for OAuth (GitHub or Google), creates an API key, and saves it to ~/.forgecroft/config.json. To use a different provider:

forgecroft login google

Alternatively, set credentials manually:

forgecroft configure --api-url https://api.forgecroft.com --api-key fc_live_...

Or use environment variables (useful in CI):

export FORGECROFT_API_URL=https://api.forgecroft.com
export FORGECROFT_API_KEY=fc_live_...

The CLI stores configuration in ~/.forgecroft/config.json. Environment variables override the stored config.

Global Flags

FlagDescription
--jsonOutput machine-readable JSON instead of human-readable tables
--versionPrint the CLI version

Commands

login

Authenticate via browser OAuth. Opens your default browser, completes the OAuth flow, and saves an API key locally.

forgecroft login           # default: GitHub
forgecroft login google    # use Google OAuth

onboard

Interactive one-click setup. Creates a project, credentials (managed mode), state backend (managed mode), and workspace in a single call.

forgecroft onboard                          # interactive prompts
forgecroft onboard --mode managed \         # non-interactive (scripting/CI)
  --project-name "Infra" \
  --cred-name "AWS Prod" \
  --cred-type aws_static \
  --backend-name "S3 State" \
  --backend-type s3 \
  --bucket my-state-bucket \
  --region us-east-1 \
  --workspace-name production \
  --repo-url https://github.com/org/infra.git
FlagDescription
--modemanaged or agent
--project-nameProject name
--cred-nameCredential config name (managed only)
--cred-typeaws_static, aws_assume_role, gcp_service_account, cloudflare_api_token, generic_env
--backend-nameState backend name (managed only)
--backend-types3, gcs, local
--bucketState bucket name
--regionState bucket region
--workspace-nameWorkspace name
--repo-urlSource repository URL
--branchSource branch (default: main)
--source-rootSubdirectory containing HCL
--state-keyState file key

In agent mode, the response includes the agent API key (shown once) and install instructions.

whoami

Show your current identity, org, role, and API key scopes.

forgecroft whoami

Use --json to parse the output programmatically.

runs plan

Trigger a plan and stream logs until completion. Exits with code 0 on success, 1 on failure.

forgecroft runs plan <workspace-id>
forgecroft runs plan <workspace-id> --no-wait   # print run ID and exit
forgecroft runs plan <workspace-id> --json       # output final run as JSON
FlagDescription
--no-waitPrint the run ID and exit immediately without streaming logs

runs list

List runs across all workspaces you have access to.

forgecroft runs list
forgecroft runs list --workspace <id>
forgecroft runs list --project <id> --status completed
forgecroft runs list --ref abc123 --require-success
FlagDefaultDescription
--workspaceFilter by workspace UUID
--projectFilter by project UUID
--statusFilter by status: queued, in_progress, completed, failed, timed_out
--refFilter by commit SHA
--limit50Max results (up to 200)
--offset0Pagination offset
--require-successfalseExit 1 if no completed run found (see CI gating below)

runs get

Show the status and details of a single run.

forgecroft runs get <run-id>
forgecroft runs get <run-id> --json

runs logs

Fetch or stream run logs.

forgecroft runs logs <run-id>              # fetch all available logs
forgecroft runs logs --follow <run-id>     # stream logs until run completes
FlagDescription
--followKeep polling for new log lines until the run reaches a terminal status

workspaces list

List workspaces you have access to.

forgecroft workspaces list
forgecroft workspaces list --project <id>
FlagDescription
--projectFilter by project UUID

api-keys list

List API keys in the current org.

forgecroft api-keys list

api-keys create

Create a new API key.

forgecroft api-keys create \
  --name "CI Pipeline" \
  --scope-type project \
  --scope-id <project-id> \
  --action-scope write \
  --scopes trigger,read
FlagDescription
--nameKey name (required)
--scope-typeorg, project, or workspace
--scope-idUUID of the project or workspace (omit for org-scoped)
--action-scoperead, write, or admin
--scopesComma-separated verb/capability scopes (e.g., trigger,read,approve)

The raw key value is printed once on creation. Store it securely — it cannot be retrieved again.

api-keys delete

Permanently delete an API key.

forgecroft api-keys delete <key-id>

api-keys suspend / unsuspend

Temporarily disable or re-enable an API key. Suspended keys are immediately rejected on use but can be re-enabled.

forgecroft api-keys suspend <key-id>
forgecroft api-keys unsuspend <key-id>

CI Gating with —require-success

Use runs list --require-success to gate CI pipelines on Forgecroft run results. This is useful for merge checks:

# In a GitHub Actions step:
forgecroft runs list \
  --workspace $WORKSPACE_ID \
  --ref ${{ github.sha }} \
  --require-success

This exits 0 if at least one completed run exists for the given filters, or exits 1 otherwise. Combine with --ref to check the specific commit.

JSON Output

All commands support --json for machine-readable output:

# Get workspace list as JSON
forgecroft --json workspaces list | jq '.[].name'

# Trigger a plan and get the final result as JSON
forgecroft --json runs plan <workspace-id> | jq '{status, added_count}'