# §88 — The command-line tool

No port, no HTML, no browser. Arguments in, exit code out, and a `--help` that does not lie.

`cli` takes command definitions and runs them. `foreman` reads a Procfile and supervises processes, which is how `atlas dev` runs a server and a bundler under one Ctrl-C.

Atlas's own CLI is built this way, so the surface you are using to scaffold is the surface you are building on.

## What you are carrying

- `@atlas/cli` — Commands, flags, arg parsing, Foreman, scaffolding.
- `@atlas/config` — Environment and defaults, typed.
- `@atlas/request` — For the API it almost certainly calls.

## Start it

```bash
bun add @wess/atlas
```

## What it looks like

`bin/tool.ts`

```ts
import { cli, command, flag } from "@atlas/cli"

cli("tool", [
  command("deploy", {
    flags: {
      env: flag("e", { type: "string", default: "staging" }),
      dry: flag("d", { type: "boolean", default: false }),
    },
    run: async ({ flags, args }) => {
      if (flags.dry) return console.log(`would deploy ${args[0]} to ${flags.env}`)
      await deploy(args[0], flags.env)
    },
  }),
])
```

## Where now

- Put it online — turn to §100 (Appendix A)
- Hand it to an agent — turn to §102 (Appendix C)
- Walk it again from the start — turn to §1
