The CLI Isn't Just for Humans Anymore
The significant change was not Ruby to TypeScript. The definition of a useful CLI changed — humans, CI and AI agents all became first-class callers.
The decision framework we applied to the Forge modernisation programme assigned the CLI a rewrite verdict.
The reasoning was straightforward. The old Ruby CLI had a small surface area. The authentication model no longer matched how Forge worked. The deploy model had moved on. There were few compatibility constraints worth preserving in the implementation itself — the interface to customers was the Forge platform, not the Ruby code that happened to talk to it.
That made the rewrite the correct call. But describing it as a language migration from Ruby to TypeScript misses what actually changed.
The job changed. A CLI that worked well for a developer typing commands in a terminal had become insufficient for everything we needed it to be. By the time the rewrite was complete, the definition of a useful Forge CLI included developers at a terminal, CI pipelines running automated deployments, and AI agents executing deployment actions without a human in the loop.
Those are three different caller types. They have different requirements. Building a CLI that serves all three without compromising any of them is a different design problem than building a CLI that serves one.
Why the rewrite verdict held
The old Ruby CLI was small. That is worth dwelling on because it shaped the decision.
A large, well-tested CLI codebase with deep business logic baked into the implementation carries real costs if you rewrite it. The logic has to be rediscovered, reimplemented, and revalidated. The test surface expands. The risk of behavioural regression is higher.
The Forge Ruby CLI did not present those costs at meaningful scale. Its surface was thin: authenticate, deploy, check status. The logic that mattered lived in the Forge API, not in the CLI wrapper. The CLI was not where the value was. The value was in the platform contract the CLI exposed — and that contract was going to survive intact into the rewrite.
That is the framing from post 2: when the value lives in the interface rather than the implementation, and when the implementation has accumulated risk without accumulating proportionate value, the rewrite verdict follows. The CLI was the clearest case in the whole programme.
What @beachio/forge-cli is
The new CLI is a TypeScript/Node package published as @beachio/forge-cli.
The implementation choice matters less than what it enables. TypeScript gives us a type-safe client for the Forge API with structured error types, predictable serialisation behaviour, and a clean path to the JSON output model that machine callers require. Node gives us a runtime that is already present in most development environments and CI pipelines without additional setup.
The CLI is a structured client over the Forge API. It does not contain business logic that runs independently of the API. What the CLI can do is determined by what the API exposes. That relationship is deliberate: the CLI is one interface into the platform, not a parallel implementation of it.
Three callers with different requirements
When you think about who calls a CLI, the first image is a developer at a terminal. That image is correct but incomplete.
A developer typing forge deploy in a terminal wants readable output. Progress as it happens. Error messages that explain what went wrong and suggest what to try next. The experience of using the tool should feel responsive and informative.
A CI pipeline calling forge deploy as part of an automated workflow wants something different. It needs a deterministic exit code it can branch on. It needs output it can parse without writing a text parser. It needs errors that carry enough information to log usefully without producing noise that clutters the pipeline output. Interactive prompts are a failure mode, not a feature — a prompt waiting for input in a CI step hangs the pipeline.
An AI agent calling forge deploy as part of a multi-step task needs something different again. It needs to know whether the operation succeeded or failed, with a structured error type it can reason about. It needs to distinguish between a transient failure it should retry and an authorisation failure that requires escalation. It needs output it can pass to the next step in the task without post-processing. Like a CI pipeline, it cannot handle interactive prompts — but it also cannot handle ambiguous or inconsistent responses, because ambiguity forces the agent to make assumptions that may be wrong.
Building for all three means making explicit choices about output format, exit codes, and interaction model that a terminal-only CLI would leave implicit.
JSON output and structured exit codes
The Forge CLI uses JSON output as its primary machine-readable mode.
This is not unusual. GitHub's gh CLI, the AWS CLI, and the Azure CLI all treat JSON as a first-class output format precisely because it is the format that automated callers can reliably parse. A human reading terminal output can extract information from a paragraph. A script, a pipeline step, or an agent cannot — at least not without string parsing that breaks when the output format changes.
JSON output means the response to a deploy command is a structured object: status, site identifier, deploy URL, timestamps, any warnings. A CI pipeline can read the status field and branch accordingly. An agent can extract the deploy URL and pass it to the next step. Neither requires a parser that knows where in the output to look for the information.
Exit codes carry the same principle into the process return value. Exit 0 means the operation succeeded. Non-zero means it did not — but the specific code carries meaning. A pipeline that receives a non-zero exit can distinguish between a network timeout (worth retrying) and a permission error (not worth retrying without intervention). An agent can make the same distinction and surface the right signal to the user.
The combination — structured output and structured exit codes — means that every caller gets a response it can act on, regardless of whether that caller is a human reading a screen or a system reading a pipe.
Scoped credentials
Long-lived, broad credentials are a risk in any automated context. A CI secret that carries permission to deploy every project in an organisation is a large blast radius if it is leaked. An agent credential with broad access is a larger attack surface than the task it is running requires.
The Forge CLI is built around scoped credentials. Tokens are limited to specific operations and specific scopes: deploy to this project, read status from this organisation. The scope is matched to the task.
For CI pipelines, that means per-project deploy tokens rather than organisation-wide credentials. If a repository secret is compromised, the exposure is bounded to that project. For agent use, it means the credential the agent holds carries exactly the access it needs for the task it is executing. This is not a novel pattern — AWS IAM roles, GitHub App installation tokens, and Kubernetes workload identity all implement variants of it. The Forge credential model applies the same principle to deployment operations.
Org and project context
CLI operations that require context — which organisation, which project, which environment — can be resolved via explicit flags, environment variables, or configuration files.
For human use, configuration file defaults make this ergonomic: run forge login once, set a default project, and subsequent commands resolve context without requiring it to be spelled out every time.
For automated callers, explicit flags and environment variables are more reliable than defaults. A CI pipeline or agent script that passes --org and --project explicitly is less fragile than one that depends on a config file being present in the right location with the right content. The CLI supports both modes; the choice of which to use is a question of what the caller can reliably provide.
Direct S3 deploy
The deploy architecture changed in the rewrite.
The previous model sent the build output through the Forge API, which then wrote it to storage. That puts the API in the data path for the upload itself, adding latency and creating a potential bottleneck for large builds.
The new model separates the data path from the control path. When a deploy is triggered, the CLI authenticates with the API and receives a short-lived, scoped credential for a specific upload location in S3. The build output goes directly from the CLI to S3 using that credential. The API records the deploy and triggers post-upload processing once the upload completes.
The credential is scoped to the upload location and expires after the operation. There is nothing persistent to clean up. The pattern is the same one used in the Hammer Cloud build architecture — short-lived credentials, scoped to a specific operation, expiring automatically.
From a caller's perspective, the interface is unchanged: trigger a deploy, get a result. What changed is where the payload bytes go and how the upload credential is managed.
Streaming
Long-running operations produce output over time. A build that takes two minutes does not produce a single result at the end — it produces progress events throughout.
The CLI streams that output in real-time. For a developer at a terminal, streaming means seeing build progress as it happens: which step is running, what output it produced, whether something went wrong and where.
For automated callers, streaming can mean something more structured. A CI pipeline can consume streamed output to produce a running log. An agent working through a deployment task can receive progress events and decide whether to wait or to check back — without polling a status endpoint on a fixed interval. The events are structured, which means the caller can parse them rather than display them verbatim.
Feedback workflows
The CLI exposes more than deploy operations. Forge's feedback surface — review comments, staging and production deploy status, site health — is queryable through the CLI with the same structured output model.
For human use, that means being able to check the status of a deploy or review a list of recent feedback comments without opening a browser. For an agent working on content or configuration changes, it means being able to check deploy status as part of a multi-step workflow and surface relevant information to the user without requiring them to leave the context they are in.
This is part of what we mean when we describe Forge as a programmable deploy surface. It is not just that you can trigger a deploy from a script. It is that the full feedback loop — deploy, validate, review, iterate — is accessible through a structured interface that automated callers can participate in reliably.
MCP and the platform contract
The Model Context Protocol has emerged as a standard for connecting AI agents to tools and data sources. A Forge MCP server would expose Forge operations as agent-callable tools: deploy, check status, list sites, query feedback.
There is an argument worth making explicitly about the relationship between MCP and the underlying platform.
MCP tools are only as reliable as the platform they wrap. If the Forge CLI has inconsistent exit codes, an MCP tool built on it inherits that inconsistency. If the API returns ambiguous error shapes, the MCP tool cannot give agents reliable error handling. If credential management is complex or authentication behaviour is unpredictable, those problems surface in the agent experience.
The correct order is: build a good platform contract first, then expose it via MCP. A structured CLI with deterministic exit codes, JSON output, scoped credentials, and consistent error shapes is the foundation. MCP on top of that foundation amplifies the strength of the contract. MCP attempting to compensate for a weak foundation makes the agent experience worse — agents retry on confused signals, receive misleading error information, and accumulate ambiguity that propagates through the task.
The CLI rewrite was partly about building the foundation that makes agent integration worth doing. Forge should be a platform that agents can call with confidence, in the same way that developers and CI pipelines can. As we have covered previously, the API surface is where agents do their work — and the quality of that surface determines the quality of the agent experience built on top of it.
Forge as a programmable deploy surface
This is the first post in this series to use that framing explicitly, so it is worth being direct about what it means.
A hosting platform is where you put things. You build a site, you upload it, it is hosted. The workflow is manual and the interaction model is human-first.
A programmable deploy surface is something other systems call. The deployment workflow is an API call with structured inputs and outputs. The callers can be developers, CI pipelines, or agents — and the platform does not distinguish between them in terms of the reliability or structure of what it returns.
Forge was always closer to the second description than the first. Forge has deployed from git branches on push since the early days, which is already an automated, non-human-initiated deployment. The CLI rewrite made that programmability first-class: structured output, scoped credentials, machine-readable responses at every step.
Gleo builds on this foundation. Gleo agents execute tasks that include deployment steps as part of larger workflows. The reliability of those steps depends on Forge being callable with confidence by automated systems. A Gleo agent that deploys a site through Forge is relying on the same platform contract that a CI pipeline relies on: deterministic, structured, predictable.
The CLI rewrite is the product story for that programmability. It is not the most visible part of the Forge modernisation programme — the Rails upgrade and the Hammer Cloud architecture are more technically dramatic. But the CLI is the interface where the programmability becomes tangible. It is where the decision to treat agents, CI, and developers as equal first-class callers is expressed in a form that you can install, run, and build against.
The decision framework gave the CLI a rewrite verdict because the implementation had little worth preserving. The rewrite gave the CLI a new job description. The job was always to let you deploy to Forge. What changed is who we mean when we say "you."
If you are building systems that deploy to Forge programmatically — CI pipelines, agent workflows, or automated tooling — Forge and Gleo are the surfaces those systems call. The CLI is the starting point.