CLI: forge login
npm i -g @forgecommerce/cliThe CLI is generated from the same registry as everything else, so it carries no list of its own: a command that exists in the kernel is callable the day it lands.
1. Log in
Section titled “1. Log in”forge login --url https://your-instance.exampleIt asks for an API key and stores it under a name:
logged in to https://your-instance.example as instance "your-instance.example" (key read from environment)stored in ~/.forge/config.jsonSet FORGE_TOKEN and it takes the key from the environment instead of prompting — which is how you would do
this in CI.
2. See what you are pointed at
Section titled “2. See what you are pointed at”forge instances* your-instance.example https://your-instance.example (key stored)The * is the current one. --instance <name> switches per call; --url <url> talks to a box that was never
stored at all.
3. Read something
Section titled “3. Read something”forge read whoami --internal{ "actor_id": "act_…", "tenant_id": "…", "scopes": ["catalog.admin.read", "logistics.read", "order.read"]}--internal is what picks the operator face of a read. Without it the call goes to the public face, which
is a different answer rather than an error:
forge read products --input '{"store": "sto_…", "limit": 1, "projection": "feed"}'Both writes and reads take --input. There is no --params.
4. Refusals are visible from a script
Section titled “4. Refusals are visible from a script”forge read api_keys --internal{ "error": { "code": "forbidden", "message": "read requires the admin.users.write scope" } }echo $? # 1A refusal prints the code and exits non-zero, so a shell script notices without parsing JSON. A success
exits 0.
5. Write something
Section titled “5. Write something”forge <command> --input '<json>'The name is the same one the API, MCP and the SDK use. forge --help prints every command with its scope and
summary; each one’s reference page carries the input schema the kernel validates against.
Useful flags
Section titled “Useful flags”| Flag | What it does |
|---|---|
--instance <name> |
Which stored box to talk to |
--url <url> |
Talk to a box that is not stored |
--store <id> |
Which store a command acts on |
--idempotency-key <k> |
Make a retry safe |
--internal |
Ask the operator face of a read |
Every one of them also has an environment variable — FORGE_INSTANCE, FORGE_URL, FORGE_TOKEN — and the
flag wins over the environment, which wins over ~/.forge.
- MCP: connect an agent — the same registry as tools.
- Operate via CLI — the day-to-day recipes.