durango-code
v0.14.4
Published
Durango Code CLI: source control, pull requests, and Durango Cloud deploys from your terminal, built for humans and coding agents.
Maintainers
Readme
Durango Code CLI
Operate Durango Code source control and Durango Cloud from the terminal:
durango-code deployThat is the whole thing. The first run creates the cloud repo, pushes your code, queues a server-side build, waits for it, and prints the live URL. Every later run in the same clone updates the same app.
Zero runtime dependencies. Node 20+.
Read the CLI documentation for a task-oriented human guide and a compact agent operating contract.
Install
bun add --global durango-code
# or, without installing:
bunx durango-code deployThe package installs five commands that are the same program: durango-code
(primary); orion-cli and orion-cloud, kept as aliases so existing scripts
and agent instructions keep working; and durango-source / ds, short names
for the Durango Source workflow (ds ws new, ds land). (durango is a
different command that belongs to the separate Durango CLI.)
Coming from orion-cloud / orion-cli
The CLI was renamed from Orion to Durango Code. Nothing you set up breaks:
orion-cli …andorion-cloud …still work, with the same arguments and JSON output.- Your saved login carries over. Credentials from
~/.config/orionare read until the CLI first writes credentials, which copies them into~/.config/durango-code(mode0600); the old file is left in place. A login saved forhttps://code.durango.shorhttps://orioncode.xyzis used forhttps://durango.shand moved to that key: those hosts served the same API, which now lives on durango.sh, and their tokens stay valid there. ORION_TOKEN,ORION_ORIGIN,ORION_CONFIG_DIR, andORION_NO_UPDATE_CHECKare still read; theDURANGO_CODE_*names take precedence when both are set.- Repository links (
orion.cloudrepoid),orion_pat_…tokens, and remotes ongit.orioncode.xyzkeep working.
To switch the installed package, remove the old one first so the alias commands are not claimed twice:
bun remove --global orion-cloud
bun add --global durango-codeSign in
durango-code loginOpens your browser, signs in to Durango Code with your Durango account, and
hands the token back to a loopback listener on 127.0.0.1 (an OAuth-style PKCE
authorization-code flow — the same one the Durango Code desktop app uses). The
consent screen names the client as "Durango Code CLI". The token is verified
before it is written.
For headless machines, CI, and agents:
durango-code login --token <token> # verified, then saved
export DURANGO_CODE_TOKEN=<token> # or skip the file entirely--token and DURANGO_CODE_TOKEN both accept a Durango Code desktop session
token or a personal access token (orion_pat_…).
durango-code whoami # who the saved token belongs to
durango-code logout # clear this machine's saved credentialsBrowser login provisions a durable device token, visible in Settings →
Access tokens. It stays valid until revoked, independently of the account session.
Existing valid saved sessions are upgraded on the next command. If an old session
has expired, an interactive command opens browser authorization and then continues.
JSON and headless commands fail immediately with sign-in instructions; run
durango-code login separately, then retry the command. Browser sign-in alone does
not refresh the CLI credential. whoami only checks the current credential.
DURANGO_CODE_TOKEN (or the legacy ORION_TOKEN) takes precedence over saved
credentials; unset it before browser login, or replace it with a valid token for
the configured origin. It is never replaced or saved. logout revokes automatically provisioned device tokens and
clears local credentials; offline revocation and manually supplied tokens can be
handled in Settings → Access tokens.
Plain git pull, git push and git clone against Durango Source use the same
sign-in. login (and any signed-in command) registers the CLI as git's credential
helper for git.durango.sh in your global git config, the way gh auth setup-git
does; durango-code setup-git does it on demand. Git asks the CLI for the token
each time, so it is never written to git config and logout takes effect at once.
A helper you configured for those hosts yourself is left alone. The Durango Code
desktop app registers an equivalent helper when you sign in there.
For limited or CI access, create a token in Settings with the required scopes:
repo:read to clone/fetch, repo:write to push, repo:admin for repository
settings and collaborators, and cloud:read/cloud:write for hosting. Scopes
are independent; deploying code normally needs repository read/write and Cloud
write access. Use the token as the password for plain Git over HTTPS.
Commands
| Command | What it does |
| --- | --- |
| durango-code deploy | Push the current app and deploy it |
| durango-code build | Work on a Durango Build app locally: clone, status, live database and files |
| durango-code source | Inspect or switch source control to Durango Code and manage GitHub mirroring |
| durango-code pr | Create, inspect, check out, update, and merge pull requests |
| durango-code service | List, provision, configure, status, or deploy managed services |
| durango-code environment | List, create, or delete Cloud environments |
| durango-code preview | Show or configure preview-environment policy |
| durango-code activity / logs | Inspect root-app or managed-service deployments |
| durango-code list | Every repo this token can reach, with app status and URLs |
| durango-code repo | Create, configure, or safely delete repositories |
| durango-code collaborator | Manage repository collaborators and roles |
| durango-code status | Deploy state of the app linked to this folder |
| durango-code open | Open the deployed app in your browser |
| durango-code configure | Show or set monorepo/build configuration |
| durango-code env | List, set, or remove Durango Cloud environment variables |
| durango-code domain | List, add, select the primary, or remove custom domains |
| durango-code bucket | List, create, or safely delete object storage buckets |
| durango-code resources | List or sync managed resources on the Cloud canvas |
| durango-code plan | Publish an HTML plan, or update one in place, and print its link |
| durango-code ws | Create, list, run in, or remove cheap parallel workspaces |
| durango-code change | Open, amend, show, list, revert, approve, archive, reopen, or abandon Durango Source changes |
| durango-code land | Put a change on the train and wait until it is merged and live |
| durango-code approve | Approve a sensitive change (same as change approve) |
| durango-code train | Run the train: build a candidate from queued changes, check, deploy, then merge |
| durango-code run | Run a command with vault secrets in its environment only |
| durango-code secrets check | Report which durango.toml secrets exist in the vault |
| durango-code projection | List, create, attach, or sync read-only projections of a prefix |
| durango-code login | Sign in (browser, or --token) |
| durango-code logout | Clear saved credentials |
| durango-code whoami | Show the signed-in account |
| durango-code setup-git | Let git use this sign-in for Durango Source |
Share a plan
When a user asks for a plan that benefits from a richer visual format, write it as a self-contained HTML file and publish it through the signed-in Durango account:
durango-code plan upload ./plan.html
durango-code plan upload ./plan.html --jsonThe command prints the unlisted public https://plan.durango.sh/p/... link.
JSON mode returns { "ok": true, "id": "...", "url": "...", "revision": 1 }.
Plans are public to anyone with the link, so do not include credentials or
private data. Agents should use this only when the user explicitly requests a
plan, and must include the returned link in their response after uploading.
To revise a plan without changing its link, update it in place. Only the account that published the plan can do this:
durango-code plan update https://plan.durango.sh/p/<id> ./plan.html
durango-code plan update <id> ./plan.html --jsonJSON mode returns the same url with the new revision and updatedAt.
Viewers always receive the latest revision; the API answers with no-cache
and a content ETag.
deploy
--project <repo-id> Deploy into a specific cloud repo (see `durango-code list`)
--name <name> Name for a newly created cloud repo
--path <dir> App directory (default: current directory)
--no-push Deploy what the cloud repo already has; skip pushing
--json One machine-readable JSON line instead of prose
--root <dir> Monorepo root directory
--build-command <cmd> Override the build command
--start-command <cmd> Override the start command
--healthcheck <path> Health-check path (must start with /)
--environment <slug> Target environment (default: production)
--env-sync Sync local dotenv files into the vault first (off by default)
--env-file <file> Dotenv file to sync before deploy; repeatable; implies --env-sync
--no-env-sync Accepted for compatibility; sync is already off by defaultWhat it does, in order:
- Finds a git repo. Not a repo yet? It runs
git initand makes the first commit. No commits yet? It commits. Uncommitted changes? It warns that they will not be deployed and continues withHEAD— it never blocks. - Resolves the cloud repo.
--projectwins; otherwise the link recorded in the local git config (orion.cloudrepoid); otherwise it creates one, named from--name, elsepackage.json'sname, else the folder name. - Pushes
HEADto the cloud repo. - Optionally syncs local environment files to the selected encrypted
Durango Cloud vault. This is opt-in: pass
--env-syncto merge existing.env,.env.local, and.env.<environment>files (later files win), or repeatable--env-fileflags to choose exact files. Without either, the vault is left unchanged (--no-env-syncis still accepted and does nothing). Values never enter git, command-line arguments, or CLI output. - Queues the build and polls until it is
deployedorfailed(up to 20 minutes — first builds are slow), then prints the app URL and the manage URL.
Exit code is 0 only when the app reaches deployed.
Cloud configuration
The same settings available in Durango Cloud are agent-friendly CLI commands:
durango-code configure --root apps/web --build-command "bun run build"
durango-code env push .env.production --environment production
durango-code env push --environment development
durango-code env list --environment production
printf '%s' "$API_KEY" | durango-code env set API_KEY --stdin --environment production
durango-code env reveal API_KEY --environment production
durango-code env environments
durango-code repo list
durango-code repo create my-app --default-branch main
durango-code repo configure my-app --visibility private --description "My app"
durango-code collaborator add @teammate --project my-app --role write
durango-code collaborator role @teammate --project my-app --role admin
durango-code collaborator remove @teammate --project my-app --yes
durango-code repo delete my-app --yes
durango-code domain add example.com --json
durango-code domain primary example.com
durango-code domain add api.example.com --service api
durango-code domain list --service railway:api --json
durango-code bucket list --json
durango-code bucket create my-app-assets
durango-code bucket delete my-app-assets --yes
durango-code resources sync infrastructure.jsonEnvironment values are encrypted in an environment-specific Durango Cloud vault:
env list returns names, never values. Environment-scoped single-value writes
require --stdin, while env push [file] is best for bulk sync; neither puts
plaintext values in process arguments. env reveal is explicit and prints the
plaintext value, so redirect or capture it carefully.
Durango Cloud owns and operates the underlying infrastructure, and resources synced to
the canvas must be credential-free metadata. bucket list
refreshes the app's managed object storage on the canvas. Buckets currently
configured as Durango Cloud release or repository storage cannot be deleted; all other
deletes require --yes and the bucket must already be empty.
repo create provisions a private Durango Code repository without deploying it or
linking the current directory. repo delete accepts an exact name or id, is
owner-only, and requires --yes. The CLI refuses to delete repositories that
still have a Durango Cloud app so provider services cannot be orphaned.
domain targets the app workload by default. Pass --service <name-or-id> to
manage a service card instead; Durango Cloud returns the Railway CNAME and TXT
verification details and keeps that service's primary URL in sync.
Source-control conversion
durango-code source status
durango-code source use-durango
durango-code source mirror status
durango-code source mirror authorize
durango-code source mirror disconnectsource use-durango (also accepted as source use-orion) is the CLI equivalent
of the Durango Code desktop app's source-control switch. It refreshes all GitHub
branches and tags, creates or reuses the Durango Code repository, atomically
imports the refs, changes origin to Durango Code, preserves
GitHub as the github remote, and begins continuous mirroring. Divergent local
refs are retained under collision-safe orion-local/* names. Tokens are passed
to Git through a short-lived askpass helper and are never stored in remote URLs.
Use --no-github-mirror if conversion should not begin mirror authorization.
Pull requests
The pull-request workflow is designed for both humans and coding agents:
durango-code pr list
durango-code pr view 5
durango-code pr create --title "Add repository stars" --body "Ready for review"
durango-code pr checkout 5
durango-code pr update-branch 5
durango-code pr push 5
durango-code pr merge 5 --merge
durango-code pr close 5
durango-code pr reopen 5pr view reports the pinned base/head commits, file summary, mergeability, and
exact conflict paths. pr checkout fetches the PR's pinned head commit rather
than trusting a named ref fetch, so it also works with branch names that the
Durango Code Git smart-HTTP server advertises but cannot fetch directly.
pr update-branch checks out the PR branch, merges its current base, and pushes
the result when clean. If Git finds conflicts, it leaves the merge in progress
and prints the paths to resolve; after committing the resolution, pr push
updates the exact PR head branch. pr merge supports merge commits by default
and --squash. Every command supports --json for agent-safe output.
Parallel workspaces and landing (Durango Source)
Many agents can work on one repository at once without sharing a checkout and
without a full bun install per agent:
ds ws new fix-login # git worktree + copy-on-write deps + ports
cd "$(ds ws path fix-login)"
# …edit, test (ds ws run fix-login -- bun test)…
ds change create --title "Fix login redirect" --description-file pr.md # opens a change (auto-lands if enabled)
ds land # land a held-open change when auto_land is off or approval was needed
ds ws rm fix-loginOnly the train (or server-side continuous landing) moves main: Durango Source
merges on the server ([train] runner = "server"), or a durango-code train
process with runner = "local". An agent finishes a task with change create:
when [approval].auto_land is enabled in durango.toml, eligible changes
auto-land to main automatically; otherwise they stay open until landed.
Production deploys follow each target's deploy_gate ("none", "green", or
"manual" via deploys promote).
Workspaces. ws new <name> [--from <rev>] [--repo <dir>] adds a detached
git worktree at ~/.durango/ws/<repo>/<name> (override the root with
DURANGO_WS_ROOT). Without --from it starts from the default branch as it is
on Durango Source, not from wherever the base checkout was left: it fetches the
tip, moves <remote>/main, and fast-forwards the base checkout when that is
safe (on main, no uncommitted changes to tracked files, no local commits);
otherwise it says why and still starts from Source's main. A repository that is
not linked, or a Source that cannot be reached, falls back to the base
checkout's HEAD. It then clones dependency directories from the base checkout
(the repository's main worktree) with APFS clonefile (cp -c -R; reflinks on
Linux). Clones share blocks with the original until written, so they are
nearly free: cloning a 4.8 GB checkout took 21 s and 16 MB of real disk. What
is cloned comes from [workspace].clone globs in durango.toml, else every
ignored node_modules that is not nested inside another plus Rust target
directories next to a Cargo.toml. .next is never cloned. When a clone is
not possible (another filesystem or volume), or when package.json or a
lockfile changed since the commit the base checkout's dependencies were
installed for, ws new prints the install command. On Linux, set
DURANGO_CLONE_COPY_FALLBACK=1 to allow a full copy if reflinks fail.
ws new copies local .env.local, .dev.vars and declared env_files from
the base checkout by default. It skips symlinks and writes files atomically
with mode 0600. Pass --no-copy-env for one workspace, or set copy_env = false
under [workspace] in durango.toml. Pass --copy-env to override that setting.
ws new <name> --change <changeId> picks up an open (or queued) change, yours
or another agent's: the workspace is checked out at the change's commit with
the change's base as its base, and .durango/change.json points at the change,
so change amend and land there update that same change. Merged,
archived and abandoned changes are refused (reopen an archived or abandoned
one first).
Each workspace gets a port block (workspace N owns 3000 + 100*N up to
[workspace].port_block ports, default 10; blocks with a port already in use are
skipped) and .durango/ws.env with DURANGO_WS, DURANGO_WS_INDEX,
DURANGO_PORT_BASE, PORT, DURANGO_PORT_<TARGET> (each target's port
offset), and DURANGO_DATA_NAMESPACE=ws_<name> for bucket prefixes and database
names. ws run <name> -- <cmd…> runs a command in the workspace with that
environment. The registry ~/.durango/workspaces.json is updated under a file
lock, so parallel ws new calls are safe. ws rm removes the worktree and frees
the ports; it refuses while the tree has unlanded changes unless --force.
ws serve <name> [-- <cmd…>] runs a long-lived dev server in the workspace (default: [workspace] serve from
durango.toml). Servers share one machine-wide queue: at most max_servers ([workspace] max_servers, or the
DURANGO_MAX_SERVERS environment variable; default 3) run at once, and further ws serve calls wait first come,
first served, then start on their own. A slot is held while the ws serve process or anything in the server's
process group is alive, so crashed servers free their slot. ws servers lists holders and the queue; ws stop <name>
stops a workspace's server (its whole process group), and ws rm stops it too.
Changes. A change is one proposed commit with a stable chg_… id, built on
the server from the working tree: tracked edits, local commits, deletions, and
untracked files that are not ignored, relative to the tree's base commit
(binary files are sent as base64, modes and symlinks are kept, .durango/ is
never included).
ds change create --title "…" --description-file <path|-> [--public-description …] [--base <rev>] [--no-checks]
ds change create --snapshot # private backup; never lands
ds change amend [changeId] [--title …] [--description-file <path|->] [--public-description …] [--no-checks] # replace the change's commit with the tree
ds change show [changeId] # status, rejection, deploys vs merges only, checks
ds change attach <image…> # upload screenshots; prints  for the description
ds change list [--status open|queued|landed|abandoned|archived]
ds change revert <changeId> # opens a change that undoes a merged change
ds change approve [changeId] # also `ds approve <changeId>`; owners and admins
ds change unqueue <changeId> # same as `ds land --cancel <changeId>`
ds change abandon [changeId] # discard it
ds change archive [changeId] # park it to revisit later; never lands while archived
ds change reopen [changeId] # archived or abandoned → open againA change needs a description (Markdown, --description-file or --description):
the change's page shows it above the diff, like a pull request's. Snapshots need
none. change create and change amend run the fast command of every target the
edits affect before anything is sent (--no-checks skips them) and record the
results on the change. Statuses: Open → On the train (queued) →
Merged (landed), or Abandoned (discarded) or Archived (parked to
revisit later); change reopen makes either open again. A change the train rejects goes back to
Open with a rejection (code, message, files, targets). The tree remembers its
open change in .durango/change.json, and keeps an archived one there so
change reopen resumes it (change create and land refuse until then). A change that touches sensitive paths
needs an owner's or admin's approval; landing it counts as approval when an
owner or admin does it. Amending a queued change takes it off the train, since
approval and checks cover content. change revert <id> opens a revert change
on top of main; it goes to production like any other change: land it.
A change under a public prefix ([[visibility.public]]) needs a public
description, published with the code. change amend keeps the existing one
unless --public-description is passed, and reminds you on stderr (--json:
publicDescriptionReminder: true) when the amend's new edits touch a public
prefix without it.
Landing. land [changeIds…] [--no-checks] [--no-wait] puts changes on the
train. From a tree with no ids it runs the fast checks, creates or amends the
tree's change, and rebases it onto main on the server (a conflict is caught
here, before the train). With ids it queues those changes. Then it waits,
polling the train and printing its phase (building, checking, deploying
<target>, landing). land never runs the train and never holds its lease,
so killing it changes nothing. When no train is running and durango.toml
says [train] runner = "local", it starts durango-code train
--exit-when-idle fully detached (its own session, log in
~/.durango/train/logs/) and keeps polling; with runner = "server" the
server runner picks the change up. In a workspace the tree then moves to the
merged commit. --no-wait only queues;
land --cancel <id> takes a change off the train unless its departure is
running. Exit codes and JSON codes:
| Exit | code | Meaning |
| --- | --- | --- |
| 0 | | Merged and live; landedOid is the change's commit on main |
| 3 | conflict | The change conflicts with main (at the rebase, or on the train with a change ahead of it). The tree was merged onto the new tip with conflict markers in conflictFiles; resolve them and run land again. The pre-rebase tree is kept as backupOid. |
| 3 | unresolved_conflicts | Conflict markers are still present |
| 1 | rejected | The train sent the change back to open: rejection.code is checks_failed (with targets), deploy_failed, conflict, already_applied, parent_not_landed, land_failed |
| 1 | main_broken | The train kept the change queued without rejecting it: a check it needs fails on main alone too (held, note). It goes once main passes again |
| 1 | deploy_failed_after_merge | Merged, but a deploy_from = "main" target failed to deploy after the merge (failedTargets); tell the repository owner |
| 1 | wrong_branch | The change does not target the default branch |
| 1 | checks_failed | A local fast check failed (output on stderr in --json mode) |
| 1 | needs_approval | Sensitive paths; an owner or admin must land or approve it |
| 1 | leak_detected | Added lines look like secrets (findings has path, line, rule; never the value) |
| 1 | public_dependency / public_description_required | Public-prefix rules |
| 1 | parent_not_landed | A stacked change whose parent is neither merged nor on the train |
| 1 | on_train / not_queued | --cancel of a change on a running departure / not on the train |
| 1 | not_open / snapshot_not_landable / no_changes | Nothing landable |
Train. train [--once] [--dry-run] [--interval 30] [--exit-when-idle]
[--restart-on-engine-change] runs on a machine with deploy credentials, for
repositories with [train] runner = "local" (with "server", Durango Source
merges and the deployer service deploys; see deploys) (the detached background train land
starts uses --exit-when-idle). It claims the repository's train lease
(durango-code@<host>:<pid>, 120 s, heartbeat every 30 s with its phase and
targets) and runs departures while changes are queued, then releases the
lease. A departure:
- Build a candidate: from the
maintip, three-way merge each queued change (oldest first, a stacked child after its parent) withgit merge-tree --merge-base=<change base>. Only changes for the default branch ride the train. A conflicting change is rejected (conflict), one whose edits are already on main is rejected (already_applied), and a child whose parent is neither merged nor on this departure is rejected (parent_not_landed); a child whose parent can't be looked up right now waits for the next departure. - Check in a pooled train workspace (
train-pool-N, kept across departures with theirnode_modules,target/and.next/caches) moved to the candidate: thefullcommand of every target affected bymain..candidate, in parallel (DURANGO_TRAIN_CONCURRENCY, default 3), recorded per change. Before each,bun install --frozen-lockfileruns in every package the target uses, changed or not. Passed checks are cached by input (target, command, object ids of its roots and dependency manifests) in~/.durango/train/cache/, so identical inputs never run twice. If a check fails, only that target is re-run: onmainalone (if main fails too, the changes touching it are held, not rejected), and for each change that touches it alone (or the candidate again when only one does, to rule out a flake); only changes that fail alone are rejected (checks_failed, with the end of the log). Checks time out after 30 minutes (DURANGO_TRAIN_CHECK_TIMEOUT_S), deploys after 45 (DURANGO_TRAIN_DEPLOY_TIMEOUT_S); the whole process group is killed and the run fails. - Deploy each affected target that has a
deploycommand from the candidate, as a graph (independent targets in parallel,afterdependencies first;DURANGO_TRAIN_DEPLOY_CONCURRENCY, default 4), with the values of thetrainvault environment (DURANGO_TRAIN_VAULT_ENV) in the environment of deploy commands only; a target whoseafterdependency failed is skipped, and targets without adeploycommand only merge. Any deploy failure rejects every change in the departure (deploy_failed, naming the failed target and the ones that did deploy);maindoes not move. - Land each change on the server with the lease and the commit the train
checked (a change amended meanwhile is not landed), then check that
mainnow holds exactly the candidate tree (it warns if not). - Deploy from main the targets marked
deploy_from = "main"indurango.toml(and those whoseafterchain reaches one): deploy commands that can only ship whatevermainis, such as a read-only mirror ofmain. They run from a workspace at the newmaintip once it matches the candidate. A failure there can't reject anything (the changes are merged): it is recorded as a failed deploy check andlandexits 1 withdeploy_failed_after_merge.
If main moves outside the train before deploying or landing, the departure
aborts without rejecting anyone and the next one rebuilds. The lease counts as
lost once no heartbeat succeeded for 100 s, and no deploy or land starts
without a heartbeat that just succeeded.
--once runs until the queue is empty and exits (1 if anything was rejected,
aborted, or failed to deploy from main); --dry-run builds and checks and
prints both deploy phases, but deploys, lands, and rejects nothing, and does
not put the changes on the departure (they can still be amended or
unqueued). Logs are kept in ~/.durango/train/logs/.
Every command runs in its own process group that dies with the train (signal
handlers for SIGINT/SIGTERM/SIGHUP, plus a reaper per group for SIGKILL). A
train interrupted while deploying or landing leaves its departure on record;
the next train logs that it is restarting it, finishes deploys from main for
changes it already landed, and runs its still-queued changes first, deploying
every target the interrupted one had deployed. --restart-on-engine-change
exits with code 75 after landing a change under cli/orion/ (the server
runner then rebuilds the CLI from main).
Secrets. run [--environment development] -- <cmd…> exports the vault for
one environment and passes the values to the child process only; nothing is
written to disk or printed. Production needs --allow-production (and a token
with cloud:read); every export is audited. secrets check [--environment
<slug>] lists each [secret.*] from durango.toml and whether it is present
(names only) and exits 1 when one is missing.
Projections. A projection is a read-only repository that follows one
prefix of this repository ([[visibility.public]] for public repos,
[[visibility.mirror]] for private deploy feeds). Run these in the source
(monorepo) checkout, or pass --project <id>:
projection list: each prefix, its target, kind (publicormirror), status, and the last mapped source and target commits.projection create <prefix> [--name <repo>] [--description <text>]: creates the target repository and backfills the prefix's history into it.projection attach <prefix> --repo <name-or-id> --seed-source <oid> --seed-target <oid>: makes an existing repository the projection, so its history continues instead of starting over.--seed-targetmust be the target's current branch tip and its tree must equal<seed-source>:<prefix>(seed_target_not_tip,seed_tree_mismatch, … otherwise). You must be an admin of both repositories, and the target must have no open changes. After that the target refuses pushes; new commits under the prefix arrive as commits on top of its old tip, so existing clonesgit pullnormally.projection sync [<prefix>|--all]: advances one projection, or all of them (the default). Landings and reverts already sync every projection; this is for commits that reached the branch by a plaingit push. Exits 1 when any sync fails.
Managed Cloud services and environments
durango-code service list
durango-code service create api --root services/api --inherit DATABASE_URL
durango-code service configure api --no-deploy-on-push
durango-code service deploy api
durango-code activity --service api
durango-code logs <deployment-id> --service api --stream build
durango-code environment create Staging --slug staging
durango-code environment delete staging --yes
durango-code preview status
durango-code preview configure --enable --branch-previews --ttl 48Service creation uses the same Durango Cloud provisioning handler as the Cloud canvas.
Pass repeatable --env-file flags to supply service-only variables and
repeatable --inherit flags for root-app variables. The first deployment is an
explicit service deploy; that command waits for a terminal deployment state.
Durango Cloud provisions the normal apps-domain subdomain for each public workload;
use domain add ... (and --service for a service card) to attach custom domains.
Working on a Build app locally
Every Durango Build project is a private Durango Source repository. Build it with your own agent (Claude Code, Codex, your editor): clone it, work locally, open a change and land it.
durango-code build list # your Build projects: clone URL, live app, threads
durango-code build clone <project> [dir] # git clone, signed in, linked to the project
durango-code build clone <project> --thread <id> # …on a thread's branch (create/<threadId>)
cd <dir>
bun install && bun dev # local dev server (npm works too); local D1 migrations apply first
# …change things…
durango-code change create --title "…" # open a change (runs the fast checks)
durango-code land # merges into main and publishes the app; waits for the deploy
durango-code build status # live URL, last deploy (and its migrations), threads
git push # on a thread's branch: updates that thread in Build<project> is a project id, repository id or name; inside a clone made by
build clone every build command defaults to that app. git clone
https://git.durango.sh/… works too once durango-code setup-git has run
(login does it).
- Landing publishes.
mainonly moves by landing a change: Durango Source merges it and deploys the app, and refuses a directgit pushtomain. Pushing a thread's branch updates that thread in Build (its preview and history). landwaits for the deploy. It prints the live URL, or the deploy's error (a failed migration too) with thelogs <deployment-id> --stream buildcommand for the build log, and exits 1. The merge stands and a failed deploy leaves the previous release serving.build statusshows the same any time.- Database changes are migrations. The app's D1 database (bound as
DB) is changed only by forward-only files inmigrations/(or the D1 binding'smigrations_dirin the wrangler config), applied in name order whenmaindeploys and recorded in_orion_migrations. Add a new numbered file (0004_add_tags.sql); never edit, rename or delete one that was applied (build db migrationsshows which).bun devapplies them to the local database first. - Production data.
build db query "SELECT …"reads the live database (read-only: SELECT, WITH, VALUES, EXPLAIN and introspection PRAGMAs). Prefer data fixes as migrations too; for a one-off fix, owners and admins can runbuild db query --write "…", which records a D1 Time Travel bookmark first and printsbuild db restore <bookmark> --yesto undo it.build db export --output dump.sqldownloads a SQL dump (the database briefly pauses its queries while it exports). - Files. The app's file storage (R2, bound as
FILES):build files ls [prefix],build files get <key> [dest]; owners and admins canput <key> <file>andrm <key> --yes. Uploads and downloads go straight to storage. The template'sstorage_filestable is not updated byput/rm.
| Command | Who |
| --- | --- |
| build list, build clone, build status | anyone who can write to the project |
| build db query (read-only), db migrations, db export, files ls, files get | anyone who can write to the project (token scope cloud:read) |
| build db query --write, db restore, files put, files rm | project owners and admins (token scope cloud:write) |
status / open
Both act on the repo linked to the current folder, or --project <repo-id>.
Both accept --path <dir>. status takes --json.
For coding agents
One shot, from the app directory:
git add -A && git commit -m "…" # uncommitted changes are not deployed
durango-code deploy --jsonThe last stdout line is a single JSON object:
{
"ok": true,
"origin": "https://durango.sh",
"repoId": "abc123…",
"repoName": "my-app",
"environment": "production",
"branch": "main",
"commit": "7851e39cedefb6089b6ee09b2f516c3c6252b8f8",
"status": "deployed",
"url": "https://my-app-abc123.andromedus.dev",
"manageUrl": "https://durango.sh/repos/abc123…",
"pushed": ["main"],
"error": null
}okistrueonly whenstatus === "deployed"; the exit code matches (0/1).statusis one ofqueued,building,deployed,failed— orerrorwhen the deploy could not be started at all.- On failure,
errorholds the tail of the build log. On timeout,timedOutistrueandstatusis whatever the build was still doing. - Read the live app from
url.
The command blocks until the build settles, so there is nothing to poll. If you
do want to check later, durango-code status --json and durango-code list --json
return the same shapes without deploying.
Headless: set DURANGO_CODE_TOKEN and skip login entirely. Everything works
over bunx durango-code too.
Where things are stored
Credentials live in ~/.config/durango-code/credentials.json, mode 0600,
as a JSON map keyed by origin — so a production login and a local dev login
coexist in one file. If that file does not exist yet, the CLI reads
~/.config/orion/credentials.json and copies it over on the first write.
DURANGO_CODE_TOKEN overrides the file entirely.
The repo → app link lives in the repository's local git config:
git config --local --get orion.cloudrepoid # cloud repo id
git config --local --get orion.cloudreponame # cloud repo nameThese are the same keys the Durango Code desktop app writes, so a clone linked by either
client stays linked for both. Nothing is added to your working tree, and no
token is ever written into .git/config or a remote URL.
Durango Source state lives in ~/.durango/: workspaces.json (the
workspace registry), ws/<repo>/<name> (workspaces), and train/logs/
(train check and deploy logs; the train's state lives on the server). Inside a workspace or checkout, .durango/ws.env and
.durango/change.json hold the workspace environment and its change; .durango/
is added to the repository's .git/info/exclude so it never shows up in
git status or a change.
Environment
| Variable | Meaning |
| --- | --- |
| DURANGO_CODE_ORIGIN | Durango origin (default https://durango.sh) |
| DURANGO_CODE_TOKEN | Bearer token; wins over saved credentials |
| DURANGO_CODE_CONFIG_DIR | Credentials directory (default ~/.config/durango-code) |
| DURANGO_CODE_NO_UPDATE_CHECK | Set to 1 to skip the daily new-version check |
| DURANGO_WS_ROOT | Where workspaces are created (default ~/.durango/ws) |
| NO_COLOR | Disable ANSI colors (also off when not a TTY) |
Each DURANGO_CODE_* variable falls back to its legacy name (ORION_ORIGIN,
ORION_TOKEN, ORION_CONFIG_DIR, ORION_NO_UPDATE_CHECK). When both are set,
the DURANGO_CODE_* value wins.
Development
bun install
bun run build # tsc → dist/
bun run typecheck
node --test test/*.test.mjs
node dist/index.js --helpPublishing
Two packages are published from this repository: durango-code (this
directory) and the deprecated orion-cloud alias in
packages/orion-cloud-shim. The alias depends on
durango-code and exposes only the orion-cli and orion-cloud commands, so
current orion-cloud users, whose update check still polls orion-cloud, keep
receiving releases.
Publish durango-code first, because the alias depends on it:
bun run build && node --test test/*.test.mjs
bun publish # durango-code@<version>
cd packages/orion-cloud-shim
# keep "version" and the durango-code dependency range in step with the release
bun publish # orion-cloud@<version>
# bun has no `deprecate` command; mark the old name on the registry with:
bunx npm deprecate orion-cloud "Renamed to durango-code: bun add --global durango-code"License
MIT
