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

> ## Agent Instructions
> To act on Atlan objects, use the Atlan MCP server at https://api.atlan.com/mcp or the atlanai CLI; `atlanai --map json` prints its command map. Run a read-only identity check before any write.
> The docs MCP server at /mcp searches these docs only. It cannot read or change Atlan objects.
> SDK packages: Python `atlanai` (PyPI) and TypeScript `@atlanai/sdk` (npm). Show Python first, then TypeScript.

# Automate with the CLI

> Use structured output, stable exit codes, API-key auth, and the Gateway API escape hatch.

The CLI separates human-readable tables from machine-readable output and keeps
data on stdout while diagnostics go to stderr.

<Note>
  **Preview.** Start automation with read-only calls and validate its behavior
  in a disposable workspace before it publishes or archives Registry content.
</Note>

## Select structured fields

Commands that expose structured output require the field list:

```bash theme={null}
atlanai skill list --json id,name,artifact_status
atlanai skill list --json id,name --jq '.[] | select(.name | contains("review"))'
atlanai workspace list --template '{{range .}}{{.id}}\t{{.display_name}}{{"\n"}}{{end}}'
```

Run the command with `--help` to see its valid JSON fields.

## Use stable exit codes

| Code | Meaning |
| - | - |
| `0` | Success, including an empty result. |
| `1` | Usage or execution error. |
| `2` | The user cancelled or declined confirmation. |
| `4` | Authentication is required or failed. |

Treat exit code `0` as a completed command, not as proof that a later
asynchronous review or trace delivery completed. Read the returned state before
your workflow takes a follow-up action.

## Run non-interactively with an approved credential

Your CI environment must provide `ATLANAI_TOKEN` from its secret store. Do not
put the credential in a workflow file, command argument, or log.

```bash theme={null}
atlanai auth status
atlanai skill publish --changed-since HEAD~1
```

`skill publish` is already non-interactive. The GitHub workflow owns its trigger
and branch policy; configure the allowed branch in `on.push.branches`. Use
`--changed-since <commit>` when the job has an explicit trusted base commit, and
keep `--prune` opt-in because it archives Registry content.

## Discover commands programmatically

```bash theme={null}
atlanai --map compact
atlanai --map json
```

The JSON map returns command paths, summaries, child commands, and local flag
names in one call.

## Call any Gateway endpoint

```bash theme={null}
atlanai api get registry:/auth/whoami
atlanai api get registry:/artifacts/skill --paginate --slurp
atlanai api post registry:/search -F limit=10 -F is_system_included=false
```

Use `--list-ops` to inspect available operations. `--field` sends strings;
`--raw-field` handles numbers, booleans, `null`, and `@file`. `--input -` reads a
body from stdin.

Preview destructive requests before sending them:

```bash theme={null}
atlanai api delete registry:/artifacts/skill/skill_123 --dry-run
```

Destructive methods require confirmation unless `--confirm` is supplied.

Use `--confirm`, `--auto-approve`, `--force`, and `--prune` only when the
automation has resolved the exact target and its approval covers that action.
Send response data to stdout, keep diagnostics on stderr, and select fields
before parsing output in another program.
