@farthershore/cli
v0.52.0
Published
FartherShore CLI — create and operate software businesses
Maintainers
Readme
@farthershore/cli
Create and operate FartherShore software businesses from the terminal.
Status: 0.52.0. Pre-1.0 — the command surface is stable but may still
change between minor versions. Pin an exact version in CI.
FartherShore lets you define a software business as code, then sells, meters,
and bills access to it at the edge. Business behavior — plans, pricing, limits,
routes and meters — is authored in your GitHub repo with
@farthershore/business
and reconciled through repository checks and the apply timeline after you push.
This CLI is the tool layer around that repo: provision a managed business repo,
validate it locally before you push, inspect publication state, and run
day-to-day operations (consumers, secrets, backends, webhooks, promo codes,
usage). It is designed to be safe for both humans and agents — every command
takes --format json for non-interactive scripting.
Install
npm install -g @farthershore/[email protected]Or run it directly with npx:
npx -p @farthershore/[email protected] farthershore --helpAuthentication
Sign in through your browser. The CLI opens the sign-in page in your browser, receives the result on this machine, and stores a sign-in that it renews for you. It holds no secret:
farthershore login
farthershore auth whoami --format jsonOver SSH, in CI, or anywhere a browser cannot reach this machine, the CLI
prints a verification URL and a code to enter in a browser on another device
instead. Ask
for that explicitly with --device; --headless is the same and never tries
to open a browser here. Only approve a code for a sign-in you started yourself:
farthershore login --deviceA sign-in is for one platform address. A command pointed elsewhere with
--api-url refuses and says where you are signed in. farthershore logout
ends the sign-in everywhere, not only on this machine.
A sign-in is user-bound: it is yours, not an organization's. It uses your live role in each organization instead of copying a permission list into the credential, and it covers all of your current and future organization memberships and all businesses in them. Normal login has no permission or scope choices: use an organization-scoped access token when automation needs narrower access.
The organization commands act in is fixed when you sign in: login stores your
organization at that moment, and every later command sends that same
organization, even if your default changes elsewhere. Choose another one for a
single command with --organization <id-or-slug>, or change the stored one:
farthershore auth organization list
farthershore auth organization use <id-or-slug>For a separately issued organization-scoped access token, pipe it through bounded stdin:
printf %s "$FARTHERSHORE_MAKER_TOKEN" | farthershore login --token-stdinFARTHERSHORE_TOKEN accepts an organization-scoped access token as an ephemeral
process override and is never persisted automatically. An access token acts
only in its own organization. farthershore logout ends a sign-in and deletes
the stored credential; for a stored access token it only deletes it here
(revoke the token itself with farthershore access_tokens revoke). A platform address
with no browser sign-in (a local platform) takes an access token only.
Where the stored credential lives: on macOS in your login Keychain and on
Linux desktops in the Secret Service (GNOME Keyring, KWallet), with only its
settings (which platform address, organization, expiry) in
~/.farthershore/credentials.json. Where there is no keychain (Windows, CI,
SSH sessions, containers) the credential stays in that file, readable only by
you, and the CLI says so once. Set FARTHERSHORE_CREDENTIAL_STORE=file to
keep it in the file without the note.
Membership and role changes take effect on the next authenticated request. A
restricted access token remains available through --token-stdin or
FARTHERSHORE_TOKEN. Never write
credentials into the managed repository.
Quickstart
Create a managed business repo, author the business, validate it, and push:
# 1. Create the managed repo. The command prints its URL.
farthershore businesses create weather-api
# 2. Clone it and author business/ from scratch.
git clone <printed-repository-url>
cd weather-api
# ...author business/ with @farthershore/business...
# 3. Check the business, then that production can move to it, before pushing
farthershore validate
farthershore validate --transition
# 4. Push — the GitHub bot validates and records apply state
git push --set-upstream origin feature/pricing
farthershore timeline list weather-api # inspect checks + apply state
# 5. Inspect accepted state, then use the CLI for platform operations.
farthershore businesses status weather-api --format json
farthershore operations list --format jsonDo not infer a successful apply from a push alone. A default-branch runtime-only change may publish after validation; an economic change is deferred to a GitHub Release. Preview-environment branches publish only to that environment. Inspect the repository checks and apply timeline for the actual outcome.
Plans, prices, limits, routes, and meters are repo-controlled: change them
by editing the program under business/ and pushing. Presentation and origin bindings
are platform-owned operating state. The CLI's
write commands cover operational state that lives outside the manifest
(consumers, secrets, backends, webhooks, promo codes, brand presentation).
Global flags
| Flag | Description |
| --------------------- | -------------------------------------------------------- |
| --api-url <url> | Override platform Core API URL |
| --env <environment> | Environment scope (production/prod/main aliases) |
| --format <format> | json for machine-readable output (default for non-TTY) |
| --no-input | Never prompt; use non-interactive, agent-safe paths |
| --version | Show version |
| --help | Show help |
Environment variables
| Variable | Description |
| ----------------------------------------- | --------------------------------------------------------------------- |
| FARTHERSHORE_TOKEN | Ephemeral organization-scoped access token; never persisted |
| FARTHERSHORE_API_URL | Platform Core API URL (default https://core.farthershore.com) |
| FARTHERSHORE_ENV | Default environment scope when --env is omitted |
| FARTHERSHORE_CONSUMER_TOKEN | Ephemeral portal consumer session for svcaccount; never persisted |
| FARTHERSHORE_ENVIRONMENT_ID | Portal environment UUID fallback for svcaccount |
| FARTHERSHORE_SUBSCRIBER_ORGANIZATION_ID | Subscriber organization UUID fallback for svcaccount |
| FS_CLI_CHANNEL | stage enables stage-channel commands for one invocation (see below) |
| FS_CLI_STAGE_HOSTS | Extra hosts (comma separated) the stage-channel gate treats as stage |
Directory links (business, organization, and environment) and the saved default
organization apply only to the API base URL where they were selected. Switching
--api-url or FARTHERSHORE_API_URL does not reuse another API's context. Existing
unscoped directory links must be recreated with farthershore link; select a
default organization again with farthershore auth organization use.
Configuration writes use an atomic replacement. If an existing
~/.farthershore/config.json is corrupt or lacks a valid API URL, commands fail
with a repair message; restore or repair the file before continuing.
Stage-channel commands
A few operations exist only to service stage. farthershore businesses delete is
the only one today: deleting a business is unrecoverable, and there is no
builder reason to do it from a terminal against production — the dashboard owns
that path.
The published production build excludes this command and its raw deletion request.
Build the internal stage CLI with FS_CLI_BUILD_CHANNEL=stage pnpm --filter @farthershore/cli build.
The stage build is gated twice:
- Registration. The command is registered only when the CLI runs in the
stage channel.
make cli-stagewrites{"channel":"stage"}into~/.farthershore/config.json(make cli-prodwrites"prod"), andFS_CLI_CHANNEL=stagedoes the same for a single invocation. Without the marker the command is absent fromfarthershore businesses --helpand invoking it is an unknown-command error — so the published CLI, as a builder installs it, does not have it at all. - Target. Even in the stage channel, the command refuses when the api-url
it would call is not a stage host —
--api-url https://core.farthershore.com, orFARTHERSHORE_API_URLpointed at production. It exits 2 withCOMMAND_NOT_AVAILABLE_IN_PRODUCTIONbefore any request is made.
Human-only actions have no client method or command in any channel, including stage. Business deletion for teardown uses only the stage command’s raw request.
The raw api command applies both gates too: a request that the platform
serves as businesses delete (-X DELETE /businesses/<id>, or its
/agent/v1/... forms) is refused with
COMMAND_NOT_AVAILABLE_IN_PRODUCTION outside the stage channel and against a
non-stage api-url, before any request and whatever --yes says.
Delete a production business from the dashboard instead.
Commands
Browse platform documentation (no login)
Docs are a read-only virtual filesystem: collections are root folders, sidebar sections are directories, and pages are files. Listing a page shows its heading anchors. Paths come from the published docs index, not your working directory.
farthershore docs ls --format json
farthershore docs ls sdks --format json
farthershore docs tree sdks --format json
farthershore docs ls sdks/connect-your-application --format json
farthershore docs read sdks/connect-your-application/metering --format json
farthershore docs ls sdks/connect-your-application/metering --format json
farthershore docs read backend/metering --section "choose-the-correct-metering-channel" --format json
farthershore docs search "secret key" --collection sdks --limit 10 --format json
farthershore docs collection sdks --format jsonUse an anchor returned by docs ls <page> for --section. read also accepts the canonical slug or an
official docs URL with a #heading fragment, so links in skills can be used
directly. get aliases read; list aliases ls. A section includes all its
child headings and complete code fences. Full pages and collections are not
truncated; search results are bounded and include a total match count.
farthershore docs --stage ls selects stage; production is the default and
--api-url does not change the documentation origin. No credentials or
organization context are sent. JSON includes source URL and, for content reads,
the docs source commit. Human output is available with --format table.
The collection-aware llms.txt and corpus artifacts must be published first;
unavailable artifacts produce an error, not stale bundled guidance. Business
knowledge commands are separate authenticated resources.
Run farthershore <group> --help for the full flag set of any command.
Database-backed list commands use Core's shared query contract: repeat
--filter field=value for exact AND filters, pass one
--sort field[:asc|desc] (ascending when omitted), and use
--search <text> for case-insensitive text search. Core applies all three
before pagination; the CLI does not sort or filter a partial page locally.
Each command rejects fields outside its endpoint-specific allowlist shown by
--help.
farthershore backends scaffold
Scaffold a starter backend into api/ inside a managed builder repo, by
downloading the public Node template tarball, then patch the repo root
.gitignore. It runs locally and needs no login.
farthershore backends scaffold
farthershore backends scaffold --path ../weather-api
farthershore backends scaffold --force
farthershore backends scaffold --node --ref v0.1.0 --format json--node is the default language today: Node (TypeScript + Express). --ref
accepts a template tag or branch name, trying tags first. More languages are
planned.
farthershore build
Compile the program under business/ to a Manifest IR envelope locally (default
output business-build.json). The CLI uses the Business SDK installed under
business/, falling back to a root install. This is local compilation only;
server-side validation and apply happen when you push business/** changes.
farthershore build
farthershore build --entry business/business.ts --out business-build.json
farthershore build --format jsonfarthershore validate
Run the same verdict the pull request bot produces, before you push. It answers two questions, each from one server dry run of the compiler that never accepts or publishes anything, so it is safe to repeat:
farthershore validate: is this a valid business? It buildsbusiness/on your machine twice and checks that both builds match (the determinism check the PR check enforces), then has the server check the compiled definition and your docs. These are the problems the PR's Business SDK and Docs comments list.farthershore validate --transition: can production move to it as is, and what would change? Adds the problems that only appear when the candidate is compared with what is live (for example a route live subscribers still use), and the change report the PR's impact report shows (--env <name>compares with that environment instead of production).
What leaves your machine: only the compiled business definition (the output
of the local build) and your docs files (docs/_index.yaml and the .mdx
pages under docs/). Your business/ source code never leaves it.
--local-only sends nothing and runs the local build checks alone. Without a
docs/ folder, nothing is sent for docs. Docs over the size the check accepts
(500 files, 1,000,000 bytes per file, 10,000,000 bytes in all) are reported as
a Docs problem without being sent.
Which business: --business, else FARTHERSHORE_BUSINESS, else the directory
link (farthershore link), else the business connected to the repo's GitHub
origin remote. A named or linked business that is connected to a different
repo is refused rather than compared. When the check cannot run, validate
fails with exit 1 and a code saying why, never a pass:
| Code | Why | What fixes it |
| ------------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| NOT_SIGNED_IN | no credential | farthershore login (or FARTHERSHORE_TOKEN) |
| LOGIN_EXPIRED | the credential was refused | farthershore login |
| BUSINESS_NOT_FOUND | no business for this repo in the organization | --organization, farthershore auth organization use, farthershore link <business> or --business |
| BUSINESS_REPO_MISMATCH | the business is connected to another repo | farthershore link <business> here, or fix --business / FARTHERSHORE_BUSINESS |
The output has the sections Business SDK, Docs and, with
--transition, Transition, each listing problems the way the PR comment
does. Every problem has code, message, and where known file, line,
column and path (the location in the business definition), so an agent can
go straight to what to change. With --format json they are in
data.businessSdk / data.docs / data.transition (or the same keys under
error.details when there are problems), each { issues, checked }, where
checked is local, server or skipped; --transition adds
changes (riskLevel, hasChanges, semanticChanges, markdown). Every
result and error carries nextActions: the commands that fix it or come next.
Any problem exits 2 (TRANSITION_BLOCKED when only the transition is blocked).
The docs check can also return warnings and info notes. They never fail
farthershore validate: the Docs section lists them after the problems,
labelled Warning: or Info:, and a run with only notes exits 0. In JSON they
are in the same issues list, after the problems, each with a severity of
warning or info; an issue without a severity is a problem. A build that
could not run at all (for example, business/ dependencies not installed)
exits 1.
farthershore validate # is the business valid?
farthershore validate --transition # can production move to it?
farthershore validate --transition --env preview
farthershore validate --business weather-api # check against a named business
farthershore validate --local-only --format jsonfarthershore businesses
Business lifecycle. Creation provisions a managed GitHub repo as the source of truth for business behavior and returns its URL. A new business starts as a DRAFT with repository tooling but no predefined business program.
farthershore businesses list --format json
farthershore businesses list --filter status=ACTIVE --sort updatedAt:desc --search weather --format json
farthershore businesses show weather-api --format json
farthershore businesses show weather-api --env preview --format json
# Is the slug free? (normalized, blocked-word and collision checked)
farthershore businesses subdomain weather-api --format json
farthershore businesses create weather-api \
--display-name "Weather API" \
--format json
farthershore businesses publish weather-api --format jsonDeleting a business is stage only — the command is not registered in the
published CLI at all (see Stage-channel commands).
Run make cli-stage first; production businesses are deleted from the
dashboard.
farthershore businesses delete weather-api --yes --format jsonThe JSON result includes data.business, data.repoUrl, and recovery metadata.
Gather the product requirements, create the business/ program, and author its
plans, prices, limits, routes, and meters from scratch.
businesses update changes platform-owned fields such as display name,
description, icon, logo (icon/logo accept PNG, JPEG, or WEBP), and whether the
product is listed on the organization's public page
(https://farthershore.io/organization/<org-slug>, listed by default). Plans,
prices, limits, routes, and meters are repo-controlled and must be changed
through the Business SDK code path.
farthershore businesses update weather-api \
--display-name "Weather" \
--description "Weather API for agents" \
--icon-file ./brand/icon.png \
--logo-file ./brand/logo.webp \
--format json
farthershore businesses update weather-api \
--clear-icon --clear-logo --format json
farthershore businesses update weather-api \
--unlist-from-org-page --format jsonbusinesses publish enforces the same go-live gates as the dashboard and returns
stable remediation errors when a prerequisite is missing.
businesses publish takes a draft business live with its first release. After
that, businesses release releases what is on the default branch: it compares
the branch with the last release that deployed, picks major, minor or patch,
runs the same go-live checks against the contract being released, and cuts the
release at that exact commit. In a terminal it shows the commit, version and
reasons and asks first; --no-input skips the question.
farthershore businesses release weather-api --dry-run --format json
farthershore businesses release weather-api --wait --format json
farthershore businesses release weather-api --version 2.0.0 --accept-breaking --no-input--dry-run shows the plan and cuts nothing. --wait follows the release, and
the release commit's frontend build when frontend/ changed, until it is live
(--timeout, default 900 seconds). --bump major|minor|patch or
--version X.Y.Z (above the current release) override the version; pass one,
not both. It refuses with NOTHING_TO_RELEASE when nothing changed since the
last deployed release, and RELEASE_SOURCE_NOT_READY while the latest change
under business/ is still being checked.
Release tags are <prefix>X.Y.Z, v by default. Changing the prefix continues
the version numbers and never renames existing tags:
farthershore businesses tag set weather-api --prefix release- --format json
farthershore businesses tag set weather-api --clear --format jsonRecover a Business contract by correcting or reverting its program in Git,
validating it in preview, and publishing a new release. Use businesses status
and Apply Timeline to verify the expected release is serving.
businesses rbac reads a business's Managed-RBAC state — the platform-owned
rbacEnabled flag. businesses rbac enable / disable toggle that flag (like
docsEnabled, it is platform-owned and never repo-authored); once enabled,
subscriber organizations manage roles in their portal. Both toggles are
safe to repeat. Subscriber role and assignment state is kept server-side on
disable, so re-enabling is a pure flag flip.
farthershore businesses rbac weather-api --format json
farthershore businesses rbac enable weather-api --format json
farthershore businesses rbac disable weather-api --yes --format jsonbusinesses rbac subjects list lists the custom permission vocabulary: subjects
whose <subject>:<verb> permissions are grantable to subscriber roles
alongside the route-derived catalog. Subjects are repo-owned — declared via
a permission-carrying fs.group(id, routes, { permission: { verbs, escalatory,
description } }) in the business repo's business/ folder and synced from the
accepted spec. To change them, edit the group declaration, run
farthershore validate, and push; there are no CLI write commands.
farthershore businesses rbac subjects list weather-api --format jsonfarthershore timeline
Inspect repo-backed applies — PRs, pushes, releases, checks, semantic diffs, and apply state — for a business.
farthershore timeline list weather-api --format json
farthershore timeline inspect weather-api 42 --format json # by id, PR #, branch, or SHAfarthershore environments
Manage preview/production environments. Production is the default scope when
--env is omitted (production, prod, and main are aliases).
farthershore environments list weather-api --format json
farthershore environments list weather-api --filter branch=env/preview --sort createdAt:desc --search preview --format json
farthershore environments create weather-api --branch env/preview --format json
farthershore environments delete weather-api preview --yes --format jsonfarthershore organizations
Read your organizations, their members, roles and invitations, and accept an invitation. Built-in and custom roles use the same list contract. Inviting members, revoking invitations, creating, changing or deleting roles, changing a member's role and removing a member happen in the dashboard (Team), as do deletion and ownership transfer.
farthershore organizations roles list <organizationId> --filter builtIn=true --sort name --search security --format json
farthershore organizations members <organizationId> --filter roleKey=auditor --sort email:asc --search person --format json
Selecting the default organization is a local credential concern, not an API
call: farthershore auth organization use <id-or-slug> changes the stored
default, and --organization <id-or-slug> overrides it for one command.
farthershore access_tokens
List and revoke access tokens: the credentials for running the CLI with no one
signed in (CI, scripts, agents). Every access token is owned by the
organization and keeps working if the person who created it leaves. Creating a
token, changing its permissions and rotating it happen in the dashboard
(Settings → Access tokens); a token's secret is shown there once. These
commands require a signed-in person (farthershore login); an existing access
token cannot list, revoke, or otherwise administer credentials.
# Exact permissions a token can be given.
farthershore access_tokens permissions --format json
farthershore access_tokens list --format json
farthershore access_tokens revoke <tokenId> --yes --format jsonRevoking stops the token working at once and cannot be undone.
farthershore stripe
Read the Stripe account a business bills through. Reading status requires a signed-in owner session. Connecting Stripe, finishing its setup, opening payout settings, disconnecting and closing require a person in the dashboard after a fresh sign-in; disconnecting and closing also ask for the name to be typed. The CLI does not perform these actions.
farthershore stripe status weather-api --format jsonfarthershore service_accounts
Manage service accounts owned by a subscriber organization. This is a separate
subscriber-plane trust boundary: it requires a current identity-provider portal
consumer session in FARTHERSHORE_CONSUMER_TOKEN, plus the exact environment
and subscriber organization context. The consumer bearer has no argv flag and
is never exchanged or persisted by the CLI. A builder login or access token cannot
substitute for it.
export FARTHERSHORE_CONSUMER_TOKEN='<current portal session token>'
export FARTHERSHORE_ENVIRONMENT_ID='<environment UUID>'
export FARTHERSHORE_SUBSCRIBER_ORGANIZATION_ID='<subscriber organization UUID>'
farthershore service_accounts list <businessId> --format json
farthershore service_accounts create <businessId> deploy-bot \
--permissions '["route:read","route:write"]' \
--scopes '["production"]' --format json
farthershore service_accounts update <businessId> <serviceAccountId> \
--permissions '["route:read"]' --format json
farthershore service_accounts approvals <businessId> --format json
farthershore service_accounts approve <businessId> <approvalId> \
--permissions '["route:read"]' --format json # optional trim
farthershore service_accounts deny <businessId> <approvalId> --format json
farthershore service_accounts rotate <businessId> <serviceAccountId> --format json
farthershore service_accounts revoke <businessId> <serviceAccountId> --yes --format jsonPass --environment-id and --subscriber-organization to override the two
context environment variables for one command. PENDING create/update responses
never print plaintext. ACTIVE creates
and rotations print the one-time key once. If one of these commands times out,
run service_accounts list before trying again.
This group is registered directly rather than through the operation registry: that registry carries builder principals, not portal consumer sessions.
farthershore limits
Manage subscriber-owned usage limits with a portal consumer session. list
reads the current limits; set creates a limit when --limit-id is omitted and
updates that limit when --limit-id is present; remove deletes a limit.
farthershore limits list <business-id> --format json
farthershore limits set <business-id> \
--quantity requests --mode BLOCK --scope ORG --units 10000 \
--format json
farthershore limits set <business-id> \
--limit-id <limit-id> --mode NOTIFY --units 20000 \
--notify-at 0.8 --format json
farthershore limits remove <business-id> <limit-id> --format jsonChanging a limit's scope, subject, or quantity requires removing and recreating the limit with the new target.
Every limit command requires FARTHERSHORE_CONSUMER_TOKEN, containing the
current portal consumer session token. Pass --environment-id and
--subscriber-organization, or set their respective fallbacks
FARTHERSHORE_ENVIRONMENT_ID and
FARTHERSHORE_SUBSCRIBER_ORGANIZATION_ID. These subscriber-portal credentials
are separate from the organization-scoped access token used by the rest of the
CLI and are never persisted automatically.
farthershore plans
Read code-managed plans. The CLI does not create, update, or delete plan definitions — edit the Business SDK program for that.
farthershore plans list weather-api # table (default in TTY)
farthershore plans list weather-api --format jsonPlan listings show recurring fees, trial days, and status. The v2 listing no longer includes plan kind, a free flag, or a monthly spend cap.
farthershore frontend
Managed Frontend Hosting status, rollback, and a local preview. Builds are
Git-triggered: production builds on a GitHub Release and preview environments
build on pushes to their environment branch. preview runs the generated
frontend/'s vite dev with an injected window.__FS_CONFIG__ shim so the
portal renders locally exactly as it serves in production. Pass --mock to
inject { mock: true } instead of Core/Clerk config for local page inspection
with placeholder data and auth bypassed.
A build is published only when its output ships the SDK's managed sign-in.
A refused build never replaces what is live; frontend status shows the
reason, and builds[].diagnostics[].code is FRONTEND_SIGN_IN_MISSING (mount
<FartherShoreRoot> and render <FsSignIn />), FRONTEND_SDK_TOO_OLD
(upgrade @farthershore/farthershore-js) or FRONTEND_DEPENDENCY_MISSING
(the frontend leaves out a piece your customers need: one entry per piece,
each with its fix; farthershore validate finds them before you push).
--wait exits BUILD_FAILED with that code in details.reasonCode. Mock mode is for this local preview only: a
hosted portal ignores it, and always uses the platform's sign-in.
farthershore frontend status weather-api --format json
farthershore frontend status weather-api --wait --ref <commitSha> --format json
farthershore frontend rollback weather-api --release-id <hash> --yes --format json
# Local preview (shells out to vite; needs a frontend/ project)
farthershore frontend dev # hot-reloading dev server, mock mode by default
farthershore frontend preview # production build served as-is, mock mode by default
farthershore frontend dev --live # against the real platform
farthershore frontend preview --core-url http://localhost:8787
# Local preview signed in as a test persona (hot reload against the real platform)
farthershore frontend dev --live --business acme --env preview --persona alice
farthershore frontend dev --live --business acme --env preview --persona persona_123 --port 4321--live --business --env --persona (all three required, not combinable with
--mock or --core-url) opens http://localhost:<port> (default 5173)
already signed in as that test persona, exactly as the hosted portal would
be. The CLI issues a short-lived, origin-bound preview lease from Core and
holds it only in its own process memory; Vite runs on a private random
loopback port behind a CLI-owned proxy that attaches the lease to portal
requests and serves the secret-free sign-in bridge. Nothing secret ever
reaches the browser URL, DOM, storage, or logs — the browser only ever holds
the same HttpOnly session cookie the hosted portal uses. The lease renews
automatically while the command runs and is revoked when it exits (Ctrl-C
included); a lease that cannot be revoked expires within five minutes. Core
is always the one selected for the authenticated CLI (--api-url /
FARTHERSHORE_API_URL).
farthershore personas
Create temporary subscriber users in a test-strategy environment so an agent can exercise the same customer RBAC, browser session, and gateway paths as a human. The Business SDK contributes raw permissions; the subscribing organization composes those permissions into its own product roles.
# First persona creates and owns a temporary subscriber workspace.
farthershore personas bootstrap weather-api --env preview --plan pro --format json
farthershore personas list weather-api --env preview --format json
farthershore personas login weather-api <ownerPersonaId> --env preview --format json
# Join the same subscriber after its owner has enabled subscriber RBAC and
# created roles/defaults through the normal customer RBAC surface.
farthershore personas bootstrap weather-api --env preview --plan pro \
--subscriber-id <subscriberId> --account-role member --role viewer \
--format json
farthershore personas rotate weather-api <personaId> --env preview --yes --format json
farthershore personas delete weather-api <personaId> --env preview --yes --format jsonBootstrap and rotation return a key once. login sends the 60-second,
single-use handoff only in the browser URL fragment to the platform-owned
/persona-sign-in bridge. The bridge establishes an HttpOnly browser session
and returns to the exact original portal path, query, and fragment. CLI output
contains portal metadata but never the handoff or a session bearer. login
emits opened: true only after the system browser launcher (open /
xdg-open) has exited successfully, so the URL has been handed off before the
command returns; a launcher failure is reported as an error. The wait is capped
at 20 seconds: a launcher still running then (for example xdg-open running
the browser in the foreground) is detached, and login emits opened: false
with a stderr notice instead of hanging until the browser closes. Product
role keys must already exist in that subscriber's role catalog; omit --role to use its
configured default. Deletion tears down the temporary user and credential, and
deleting the environment also removes the remaining persona-owned workspace.
After an environment-branch apply, existing personas remain available but are
detached from the superseded subscription. Use personas login with the same
persona id and select a plan from the new branch contract; the CLI does not
fall back to a production plan. The old raw test key stays invalid. After the
persona is reattached, run personas rotate to mint a replacement key for
gateway testing; its product roles and explicit scope ceiling are preserved.
farthershore usage
Read recent usage off the management API.
farthershore usage summary weather-api --format jsonfarthershore consumers
Manage live business users. These are operational actions, not repo-authored behavior.
farthershore consumers list weather-api --format json
farthershore consumers block weather-api <subscriberId> --yes --format json
farthershore consumers remove weather-api <subscriberId> --yes --format jsonUse consumers list first to find a subscriberId. block suspends a user and
revokes active API keys. remove is irreversible and tears down subscriber state
across billing, edge credentials, and subscriptions.
farthershore variables
Manage platform-owned variables. The name is the class: an FS_PUBLIC_ prefix
makes a value public (inlined into the frontend bundle, readable by every
visitor); any other name is a write-only secret — available to the isolated
managed build (leak-scanned from its artifact) and injected by Gateway for any
compiled integration that references it.
farthershore variables list weather-api --format json
printf '%s' "$SENTRY_AUTH_TOKEN" | farthershore variables set weather-api \
SENTRY_AUTH_TOKEN --format json
printf '%s' "$PROVIDER_SECRET" | farthershore variables set weather-api \
PROVIDER_SECRET --production-only --format json
printf '%s' "$POSTHOG_PROJECT_KEY" | farthershore variables set weather-api \
FS_PUBLIC_POSTHOG_KEY --format json
farthershore variables revoke weather-api POSTHOG_SECRET --yes --format json
farthershore variables rm weather-api POSTHOG_SECRET --yes --format jsonValues are read from stdin. Secret plaintext is never returned; listing returns
public FS_PUBLIC_* values and secret metadata. Business-wide variables are
inherited by previews unless an environment override exists. Inherited secrets
require a verified repository pusher with write access; fork previews and
previews without verified identity cannot use them. Rotation updates the source
value without copying secrets into previews. A preview stops using inherited
secrets within 15 seconds of GitHub reporting that the pusher was removed or their
access changed, for example a lowered collaborator permission or a team losing
the repository. Write access is also checked again every 15 minutes, so a change
GitHub does not report stops them within about 20 minutes.
Revoke, rotate and delete take effect for live requests within 15 seconds of being acknowledged; until then a request may still use the previous value.
Use --production-only when creating a business-wide secret to exclude it from
previews. The flag cannot be used for public variables or with a preview
--env, and rotation preserves it. To change this scope, revoke, delete, and
recreate the binding. variables list displays business-wide, environment,
production-only, or inherited scope. JSON includes productionOnly,
inheritedFrom (main or null), and an unavailableReason when a preview
cannot use the inherited secret.
farthershore backends
Create bring-your-own backends and provision secret keys for your upstream
services. Only token hashes are stored; the raw token is returned once and should
be deployed as FS_SECRET_KEY.
farthershore backends list weather-api --format json
farthershore backends create weather-api \
--name "Production API" \
--origin-url https://api.example.com \
--format json
farthershore backends bind weather-api api \
--env preview-42 \
--origin https://api-pr-42.example.com \
--format json
farthershore backends keys create weather-api --backend <backendId> --format json
farthershore backends keys rotate weather-api <tokenId> --yes --format json
farthershore backends keys revoke weather-api <tokenId> --yes --format jsonPair the token with
@farthershore/backend in
your upstream:
import { fartherShore } from "@farthershore/backend";
const fs = fartherShore.initFromEnv();
export async function POST(request: Request) {
const url = new URL(request.url);
const body = await request.clone().arrayBuffer();
const ctx = await fs.verifyRequest({
method: request.method,
path: url.pathname,
query: url.search.slice(1), // the query after "?", exactly as signed
headers: request.headers,
body: new Uint8Array(body),
});
const result = await runWorkflow(await request.json());
await ctx.report({
meter: "tokens_used",
values: { tokens_used: result.tokensUsed },
});
return Response.json(result);
}farthershore webhooks
Provision outbound webhook endpoints and inspect delivery health. Endpoints are platform-owned operate records: they never live in the managed repo, so these writes work the same for every business regardless of repo linkage.
farthershore webhooks list weather-api --format json
farthershore webhooks create weather-api \
--url https://hooks.example.com/farthershore \
--events subscription.created,payment.failed \
--format json
farthershore webhooks update weather-api <webhookId> --disable --format json
farthershore webhooks test weather-api <webhookId> --format json
farthershore webhooks trigger weather-api <webhookId> --type payment.failed --format json
farthershore webhooks deliveries weather-api <webhookId> --limit 20 --format json
farthershore webhooks delivery weather-api <webhookId> <deliveryId> --format json
farthershore webhooks rotate weather-api <webhookId> --yes --format json
farthershore webhooks delete weather-api <webhookId> --yes --format jsonwebhooks create and webhooks rotate return the signing secret once; store it
in the receiving app. In human mode they also print it as an
FS_WEBHOOK_SECRET= line plus a createWebhookHandler snippet.
webhooks test sends the plain webhook.test ping. webhooks trigger --type
sends a signed, realistic sample of one catalog event (the deliveries log
records it under that type) so every handler branch can be exercised locally.
webhooks deliveries lists recent attempts; webhooks delivery shows one by its
id (the webhook-id header your endpoint received, also the deliveryId that
webhooks test / webhooks trigger return): its status, attempts, last HTTP
status and when the next attempt is due. A failed delivery with no next
attempt (a test send) is final. Lists omit payloads and response bodies. Single-delivery reads include the exact sent event envelope and the last response diagnostic for owners and admins. Diagnostics are capped at 4096 characters; unreachable endpoints get a plain-language reason that never names a host or IP. Access tokens receive metadata only.
Use farthershore webhooks payload <businessId> <webhookId> <deliveryId> to explicitly require payload access with a user session.
For a receiver on your machine, webhooks listen is the Stripe-CLI-style loop:
it opens a Cloudflare quick tunnel to --forward-to, creates a temporary
endpoint on it, prints the endpoint id / tunnel URL / (with --print-secret)
the FS_WEBHOOK_SECRET= line, tails deliveries as
time type status responseStatus id, and deletes the endpoint on Ctrl-C.
farthershore webhooks listen weather-api \
--forward-to http://localhost:3000/webhooks/farthershore \
--print-secret --trigger payment.failed
farthershore webhooks listen weather-api --forward-to localhost:3000/webhooks \
--events subscription.created,payment.failed --format jsonlisten needs the bundled tunnel helper, installed as an optional CLI
dependency. If it is missing, reinstall
the CLI with optional dependencies enabled; the listener does not search your
repository or PATH for an executable. A listener
killed hard leaves an
endpoint with a *.trycloudflare.com URL; webhooks delete --yes removes it.
farthershore promo_codes
Manage checkout promo codes (operational state, not part of the manifest).
farthershore promo_codes list weather-api --format json
farthershore promo_codes create weather-api \
--code LAUNCH25 --kind percent_off --percent 25 --duration-months 3 \
--plan <planId> --format json
farthershore promo_codes create weather-api \
--code SAVE500 --kind amount_off --amount-cents 500 --duration-months 1 --format json
farthershore promo_codes archive weather-api <promoCodeId> --format json
farthershore promo_codes reactivate weather-api <promoCodeId> --format jsonBecause a Stripe coupon change requires a complete discount spec, promo-code
update requires --kind, --duration-months, and the amount flag for that kind
whenever you change the code, amount, dates, plan scope, or redemption limits.
Use --all-plans to clear plan scoping.
Farther Shore agent skills
Install or refresh the platform-verified skills bundle together. The platform pins this immutable release, and CI plus a daily repository check compare it to GitHub's latest stable release so the guidance cannot silently drift.
The v4.0.0 bundle replaces five prior workflow names with the six current
workflows. After a successful install, exact Farther Shore-owned retired
entries are moved to recoverable .farthershore-retired-skills-* backups only
in directories containing the complete verified new bundle. Incomplete installs,
custom and unrecognized skills are left in place.
set -euo pipefail
farthershore skills install --help
farthershore skills installIf the platform-owned skills installer is unavailable, stop and ask the human to run
npm install -g @farthershore/[email protected], then repeat the installer help check.
The CLI keeps itself current (see Staying up to date); do not otherwise install
or upgrade global tooling autonomously.
The Farther Shore CLI downloads the exact installer archive and verifies this SHA-512 before it extracts or executes any installer code.
farthershore operations
Print the machine-readable action boundary: which operations are repo-authored
(contract) and which are CLI/API operations (operate).
farthershore operations list --format jsonfarthershore api
Send a raw authenticated request to any platform API endpoint and print the
response, like gh api. Use it for endpoints a typed command does not cover
yet. Every endpoint is described in the platform's OpenAPI document
(farthershore api /openapi.json).
farthershore api /businesses
farthershore api 'businesses/{business}/environments' --paginate
farthershore api -X PATCH 'businesses/{business}' -f displayName='Weather API'
farthershore api 'agent/v1/businesses/{business}/backends' -f name=api -f originUrl=https://api.example.com -F isDefault=true --dry-run
farthershore api -X POST 'businesses/{business}/promo-codes' --input promo.json
farthershore api -X DELETE 'businesses/{business}/environments/{env}' --env preview-1 --yes
farthershore api 'builder/organizations/{org}/members' --include
farthershore api /businesses --format json | jq '.[].id'- Endpoint. A path on the configured API (
--api-url/FARTHERSHORE_API_URL). Absolute URLs and other hosts are refused, so the credential never leaves the platform, and redirects are never followed: a 3xx answer is an error (REDIRECT_NOT_FOLLOWED), so the credential and-Hheaders never reach another location. Placeholders in the path and its query are filled from the current context:{business}from--business,FARTHERSHORE_BUSINESSor the linked directory;{org}/{organization}from the selected organization;{env}from--env,FARTHERSHORE_ENVor the linked environment. - Method.
-X, --method; defaultGET, orPOSTwhen fields or--inputare given. - Fields.
-f key=valuesends a string;-F key=valueconvertstrue,false,nulland numbers, and reads@file(or@-for stdin). Nest withkey[sub]=value, append to an array withkey[]=value.GETfields become query parameters; otherwise they form the JSON body. --input <file|->sends a JSON body as-is (not combinable with fields).-H 'Name: value'adds a header.Authorization,x-fs-surface,x-fs-clientand the organization headers belong to the CLI and are refused.--paginatefollows offset (pagination.hasMore) and cursor (nextCursor) pages and prints one object with the lists concatenated;--max-pages <n>(default 100) bounds it.-i, --includeprints the HTTP status and response headers first.--dry-runappendsdry_run=true.--yesconfirms a destructive request (see the guard below).
Guard. A raw request gets the guard of the command for the same operation, so it is never weaker. The CLI matches the method and path to the operation the platform serves there, then:
| Request | Needs |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| read (GET), or a write of a non-destructive operation | nothing |
| a destructive operation (a delete, a revoke, a rollback, ...) | --yes (else DESTRUCTIVE_OP_REQUIRES_YES) |
| --dry-run of a destructive operation that previews | nothing — it changes nothing |
| a write to a path no known operation serves | --yes (else DESTRUCTIVE_OP_REQUIRES_YES, details.reason: "unknown_write") |
| a stage-only operation (business delete) | also the stage channel and a stage api-url (else COMMAND_NOT_AVAILABLE_IN_PRODUCTION) |
A path that serves several operations takes the strictest of their guards. Every refusal happens before anything is sent.
The body is printed as-is (pretty in a terminal, compact with --format json),
never wrapped in the CLI envelope; there is no --jq, so pipe to jq. Errors
print the error envelope and use the exit codes below. Reads retry on transient
failures; a write is never repeated: a 5xx or lost answer exits 5 and its
error has outcomeUnknown: true (the code may be the server's own, e.g.
TEARDOWN_FAILED; key on outcomeUnknown), so read current state before
sending it again. -i also prints the status line and headers of a failed
answer, before the error envelope.
Chaining commands (no script runner)
The CLI has no code command: an agent chains plain commands in its shell and
reads each --format json envelope. To find the command for a task:
# Every platform operation, with its class, permission and exact CLI command.
farthershore operations list --format json
# The arguments and flags of one group or command.
farthershore backends keys --help
# The guide for the task, then the whole page.
farthershore docs search "secret key" --limit 10 --format json
farthershore docs read backend/secret-keysA write runs when you run its command. A destructive command needs --yes;
--dry-run previews where the command supports it; a command that issues a
one-time secret shows it once. For typed scripting in your own program, use
@farthershore/sdk.
Errors and exit codes
In --format json mode, every command prints a single canonical envelope to
stdout — { ok, op, data } on success, or { ok: false, op, error } on failure,
where error carries a stable code, message, HTTP status, a retryable
flag, a remediation hint when one is registered, and the requestId the API
logged the request under. Diagnostics go to stderr.
In table mode, failures print Error [CODE]: message plus a Hint: line and,
for an API error, a Reference: line. The bracketed code is stable across
releases — quote it, and the reference, in support threads.
Exit codes are a branchable taxonomy so a script can tell failure classes apart without parsing text:
| Exit | Meaning |
| ---- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0 | Success |
| 2 | Validation error (HTTP 400/422) — fix your input |
| 3 | Auth / permission error (401/403) — re-authenticate |
| 4 | MANAGED_BY_CODE (409 with that code only) — the contract is managed as code; change it in the repo and push |
| 5 | Server error (5xx), or OUTCOME_UNKNOWN — a write whose outcome is unknown; never repeat it blindly (see below) |
| 1 | Any other failure: local errors, 402/404, argument errors, and every other 409 (CONFLICT, RELEASE_PENDING_ACCEPTANCE, ROLLBACK_IN_FLIGHT, …) |
A 409 other than MANAGED_BY_CODE means the server refused a repeat or a
conflicting change (an existing name, a release still being applied, a rollback
already running). Wait or reconcile; do not edit business/ for it.
Exit 5 covers two different cases. Branch on error.retryDisposition:
reconcile_before_repeat. The write may or may not have run. Run the read named inerror.details.reconcile(also listed per command byfarthershore operations list) and repeat only if that read shows it did not happen. The error can retain a server code such asUPSTREAM_TIMEOUT; a lost response usesOUTCOME_UNKNOWN. Neither code alone decides whether repeating the write is safe.safe_to_repeat. Retry only whenerror.retryableis also true.
The CLI retries reads automatically. It retries a write only on 429, or when
the server marks the failure retryable with a safe_to_repeat verdict.
CI and agent usage
Authenticate before unattended work, or supply an organization-scoped
access token through FARTHERSHORE_TOKEN. Signing in waits for human approval; use
--headless when the CLI cannot open a browser. farthershore build and
farthershore validate --local-only need no network or auth and are safe to
run in CI.
Learn more
- Platform documentation: farthershore.com
- Author business behavior:
@farthershore/business - Report usage from your backend:
@farthershore/backend
License
MIT
Managed webhook receivers are listed by backend slug and receiver address. A
tunnel receiver shows /_fs/webhooks; a direct receiver shows its public HTTPS
URL. Change a managed receiver's destination by connecting its backend.
Find guides with farthershore docs search "secret key" and read one in full
with farthershore docs read agents/overview. Use --stage on docs to
select stage docs; production is the default. For operations, filter
farthershore operations list --format json with your shell's JSON tools.
farthershore docs search "secret key" uses the platform's public docs search
(no sign-in; --stage searches the stage platform) and falls back to
literal text when unavailable. --literal or --collection forces literal search.
A credit usage unit's customer-facing name is declared in the business
program, not set here: fs.usageUnit.credits("tokens", { display: "Requests" }).
Change it and release; reporting keys and balances do not change.
Export your data
Run farthershore account export --format json > personal-data.json with your personal session to export your account data. Organization credentials cannot use this command.
Export a customer’s business-scoped data: farthershore consumers export <businessIdOrSlug> <subscriberId> --format json.
Check a request without changing customer data: farthershore consumers erasure <businessIdOrSlug> <subscriberId> --format json. A person must request erasure in the dashboard.
Staying up to date
Global npm installs on macOS and Linux (including a custom npm prefix set
in ~/.npmrc) update automatically to npm latest in
the background after a successful command, at most once an hour. A command
refused because the CLI is too old updates immediately and re-runs once; a
command that read standard input is not re-run, so run it again yourself.
Updates only move forward, use the official npm registry, and never change
command stdout. pnpm installs, Windows, CI, source checkouts, project
dependencies, and npx runs are not updated automatically; update those with
the tool you used to install the CLI.
To opt out, set FARTHERSHORE_NO_UPDATE=1 or add "autoUpdate": false to
~/.farthershore/config.json. A config file containing only
{"autoUpdate": false} is valid. If that file exists but cannot be read,
automatic updates stay off. Automation should set the environment variable.
Run farthershore update to check and update explicitly, ignoring the hourly
window and opt-outs (including CI); --format json reports
{ from, to, updated }.
What is out of date in your business repository
farthershore outdated, run from the root of your business repository,
compares the Farther Shore packages the repository uses with the latest
releases and says what each update brings and the exact command to run. It
never changes a file and needs no sign-in.
- Business SDK (
@farthershore/businessinbusiness/), Frontend SDK (@farthershore/farthershore-jsinfrontend/), Backend SDK (@farthershore/backendinapi/): the version inpackage-lock.json, or the version inpackage.jsonwhen there is no lockfile, against npmlatest. An update that needs code changes says so and lists the breaking entries; others say "safe update". - The CLI itself, against npm
latestand against the oldest version Farther Shore still accepts. Below that is an error: runfarthershore update.
It sends one request per package to the public npm registry, naming only the
package, and one request naming only this CLI's version; no credential, no
file contents. Exit code 0 when everything checked is up to date, 1 when
something is behind or the CLI is too old, so it can run in CI. A check that
could not run (offline, a version range with no version in it) is listed
under "Skipped" with its reason and does not change the exit code; it is
never reported as up to date. --format json returns { status, checks,
skipped } (in error.details when the exit code is 1).
farthershore outdated
farthershore outdated --format json