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

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# ancha completion

> Print a shell completion script for zsh, bash or fish that completes ancha's command and subcommand names.

`ancha completion` prints a completion script for your shell. It completes command names such as `run` and `world`, and subcommand names such as `world up`. It does not complete flags or arguments.

```bash theme={null}
ancha completion [options] <shell>
```

| Argument | Description |
| - | - |
| `shell` | zsh, bash or fish |

## Install

```bash theme={null}
ancha completion zsh >> ~/.zshrc                              # zsh
ancha completion bash >> ~/.bashrc                            # bash
ancha completion fish > ~/.config/fish/completions/ancha.fish # fish
```

Open a new shell afterwards. The script only names commands, so regenerate it after upgrading the CLI to pick up new ones.

With `--json`, the output is `{"shell": "zsh", "script": "..."}`.

## Exit codes

`0`. Another shell exits `2`:

```text Output theme={null}
error[USAGE]: unsupported shell: sh
hint: use ancha completion zsh, bash or fish
```


## Related topics

- [CLI overview](https://docs.ancha.io/cli/overview.md)
- [Changelog](https://docs.ancha.io/changelog.md)
- [ancha scene](https://docs.ancha.io/cli/scene.md)
- [Test file (scene.yaml)](https://docs.ancha.io/reference/test-file.md)
- [ancha.yaml](https://docs.ancha.io/reference/ancha-yaml.md)


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