Metadata-Version: 2.4
Name: rgw-cli-contract
Version: 0.1.0
Summary: Shared runtime and scaffolding contract for Python CLI/TUI apps
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# rgw-cli-contract

`rgw-cli-contract` is the shared runtime and scaffolding contract for Ryan's
Python CLI/TUI apps.

It has two jobs:

- provide a small runtime layer for exact `-h`, `-v`, `-u`, and `conf`
- sync canonical root files such as `install.sh`, `push_release_upgrade.sh`,
  and baseline contract tests into app repos

## Runtime

```python
from pathlib import Path

from rgw_cli_contract import AppSpec, run_app

APP_SPEC = AppSpec(
    app_name="demo",
    version="0.0.0",
    help_text="demo\n",
    install_script_path=Path(__file__).resolve().with_name("install.sh"),
    no_args_mode="dispatch",
)


def dispatch(argv: list[str]) -> int:
    print(argv)
    return 0


raise SystemExit(run_app(APP_SPEC, ["-h"], dispatch))
```

## Sync

Create `cli_contract.toml` in an app repo, then run:

```bash
PYTHONPATH=src python -m rgw_cli_contract.sync /path/to/app
```

Use `--check` to fail when managed files have drifted.
