> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Select a deployment, check and deploy the app tree, act on an installation, write clients and set secrets.

`bijection` speaks the same words as your code. Its verbs are the `ctx`
verbs and the client verbs, its flags are their option keys, and its
addresses are tree paths. Run `bijection --help` to list the commands of
your installed version, and `bijection <command> --help` for one command's
inputs.

| Command | What it does |
| - | - |
| [`bijection check`](https://docs.bijection.com/development/cli/check) | Type and lexicon check, label flow, guard analysis. `--write-lock` writes `bijection.lock`. |
| `bijection dev` | Install the tree on your development installation and watch for changes. |
| `bijection build` | Build an immutable application artifact. |
| `bijection deploy` | Install the tree as an installation's code. |
| `bijection login` | Sign in as a developer. |
| `bijection session login` | Sign in as a person of the app. |
| `bijection status` | Show the selected installation’s state. |
| `bijection describe <path>` | Read one declaration’s contract. |
| `bijection call <path>` | Call an installed function using its typed arguments. |
| `bijection wait <receipt>` | Resume observing a receipt returned by an installed function. |
| `bijection env` | Manage declaration environment values. |
| `bijection credential` | Manage installation credentials. |
| `bijection installation` | Manage and select installations. |
| `bijection infrastructure` | Plan and apply installation infrastructure with Terraform. |
| `bijection export` | Write a portable archive. |
| `bijection import` | Land an archive in an installation. |
| `bijection docs` | Find Bijection documentation. |
| `bijection upgrade` | Upgrade the CLI. |
| [`query`, `mutate`, `trial`](https://docs.bijection.com/development/cli/verbs#call-functions) | Call a function or see what the call would do. |
| [`get`, `list`](https://docs.bijection.com/development/cli/verbs#read) | Read a point or a bounded selection. |
| [`has`, `page`, `count`](https://docs.bijection.com/development/cli/verbs#read) | Check for a point, page through a selection, or count it. |
| [`grant`, `revoke`, `erase`, `branch`, `land`, `discard`, `pin`, `unpin`, `answer`, `withdraw`](https://docs.bijection.com/development/cli/verbs#grave-acts) | The grave acts. |
| [`bijection client <lang>`](#write-a-typed-client) | Write a typed client package for a language. |
| [`bijection secret set <path>`](#set-a-secret) | Set a secret's value as an operator. |

## Select a deployment

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection login
bijection installation select my-app:dev-sam
bijection dev
```

`dev` installs the tree on the selected development deployment and watches
your source. Use `--installation <project>:<name>` to direct one invocation to an
explicit deployment. A Git checkout changes the source on disk; deployment
selection is a separate CLI setting.

## Deploy

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection check
bijection deploy --installation my-project:prod
```

Production takes an explicit target or its deploy key. Deploy refuses a tree
whose derived lock differs from the committed
[`bijection.lock`](https://docs.bijection.com/development/cli/lock) (`AuthorityLockStale`). It also
refuses to remove a release that stored facts still depend on for a pending
lowering. See [Deploys](https://docs.bijection.com/operate/installations/deploys.md) for building an
immutable release and deploying it later.

## Call an installed function

Use the dotted function path from your app tree. The mount supplies the
prefix, so a library mounted at `etl` exposes its refresh as `etl.refresh`.
The selected installation supplies help and argument types using your app
sign-in.

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection call etl.refresh --help
bijection call etl.refresh counts --rebuild --wait --timeout 20m
bijection call etl.status counts --watch
bijection call etl.list counts --count 5
```

Simple named arguments become flags. Use `--args` or `--args-file` for the
complete argument object, including records or lists. Use `--args-file -`
to read it from stdin. `--watch` follows a query. `--wait` calls a mutation
once and follows its declared receipt. If you interrupt the watch or let it
time out, use `bijection wait <receipt>` with the same installation. If the
mutation reply is lost, use the recovery command printed when the call
started. It submits the original request with the original invocation identity.

An application or library can declare positionals in an ordinary function
spec. Other readers can still call the function with the same object of
named arguments.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const status = query({
  allow: [reader],
  args: { invoice: t.key(invoices) },
  cli: { positional: ["invoice"] },
}, (ctx, { invoice }) => ctx.get(invoices(invoice)));
```

If that declaration is mounted at `finance.invoices.status`, run
`bijection call finance.invoices.status <invoice>`. To support `--wait`,
declare a mutation's `completion` query. The query takes one argument
named `receipt` of the mutation's declared return type and reports a
`pending`, `completed`, or `refused` state. The app persists the request
and decides what counts as completion. The installation returns one opaque
receipt that carries the original observer and the launch read floor.

## Write a typed client

In the same repository, a frontend imports the app type and calls
`api<typeof App>()`. For a consumer in another repository or language,
write a client package from the app's exposed tree:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection client ts --name @acme/orders-client --out dist/orders-client
bijection client json --out dist/orders.interface.json
```

`ts` writes an npm package whose `connect(url, options)` pins the app contract
of the committed `bijection.lock`. A deployment whose contract differs refuses
the client's calls with `Conflict`. `json` writes the language-neutral
interface document. See [Publish a typed client](https://docs.bijection.com/development/sdk-distribution.md).

## Set a secret

A `secret()` declared in the tree is named by its path. Only performers open
it; no function, command or console shows its value. Set it as an operator,
from piped stdin or a private file:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
printf '%s' "$STRIPE_KEY" | bijection secret set billing.stripe
bijection secret set billing.stripe/acme --from-file acme.key
```

`path/member` sets one member's value of a `secret({ under: family })`.
Setting a path again rotates its value. `bijection secret list` lists the
secrets, never their values.

A mounted app's secrets are paths of the installer's tree, such as
`payments.provider.key` for an app mounted at `payments`. Its installation
guide names the secrets to set.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.