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

# Recipes

> Practical patterns for real-world CLIs built with Runegraft.

Use these snippets as starting points. Copy, adjust, and ship.

## Installer-style command

```python theme={null}
from runegraft import CLI, opt

cli = CLI("installr")

@cli.command("install <url:url>")
def install(
    url: str,
    force: bool = opt("--force", "-f", default=False, help="Overwrite existing installs"),
    target: str = opt("--target", "-t", default="~/.installr", help="Install directory"),
):
    print(f"Installing {url} into {target} (force={force})")
```

* The `<url:url>` converter validates the input before running.
* `--force` + `--target` make the command discoverable via generated help.

## Git-style subcommands

```python theme={null}
@cli.command("task add <name:str>")
def task_add(name: str):
    print(f"Added task '{name}'")

@cli.command("task list")
def task_list():
    print("Listing tasks...")
```

Route prefixes (`task add`, `task list`) keep related commands grouped in the shell and in help output.

## Script repeatable workflows

Drop frequently used commands into a `.rg` file and run it with `source` inside the shell:

```text theme={null}
# team-setup.rg
install https://example.com/pkg.zip -f
alias set deploy-prod "deploy production --region us-east-1"
history save
```

In the shell:

```bash theme={null}
runegraft> source ./team-setup.rg
```

Everyone on your team can share the same scripts to bootstrap their environment in one command.
