Metadata-Version: 2.4
Name: sonnet-cli
Version: 0.1.0
Summary: Library of terminal building blocks for Petrarca Labs backend service CLIs
Author-email: Wolfgang Miller <wolfgang.miller@petrarca-labs.com>
License-Expression: Apache-2.0
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries
Requires-Python: <4.0,>=3.14
Description-Content-Type: text/markdown
Requires-Dist: typer>=0.24.1
Requires-Dist: rich>=13.8.0
Provides-Extra: dev
Requires-Dist: ruff>=0.3.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"

# sonnet-cli

A **library** of terminal building blocks for Petrarca Labs backend services.

> **Not a CLI application.** It ships no console script and is not run directly.
> Consuming apps (lauro, sestina, coco-rag, ...) import it to build *their own*
> command-line interfaces -- each app owns its Typer application and its entry
> point. sonnet-cli only provides the reusable pieces.

> **Status: placeholder.** This release claims the name and proves the release
> pipeline. The implementation follows -- see *Planned scope* below.

## Install

```bash
pip install sonnet-cli
```

## Planned scope

### Reusable toolkit -- framework-agnostic

`typer` + `rich` + the standard library. No server concepts.

| Component | What |
|---|---|
| `multiselect` | Arrow-key checkbox picker with a numbered fallback when stdin is not a TTY |
| `console` / `utils` | Shared rich console and path helpers |
| model editing | Edit a Pydantic model as an annotated YAML document in `$EDITOR`, validating on save and re-opening with the error -- the `kubectl edit` pattern |

### Command-group factories -- mounted by an app

Pieces an app adds to its own Typer app. These drive a
[sonnet-server](https://pypi.org/project/sonnet-server/) application and depend
on it accordingly.

| Component | What |
|---|---|
| `resource_cli` | Uniform `list` / `get` / `set` for a `ResourceSpec`-backed resource |
| `db` commands | Database init / check / upgrade, given the app's Alembic config |
| `checks` | Readiness-pipeline runner and builders |

## Why a separate library

The code currently lives in `sonnet_server.cli`. It is a pure leaf -- nothing in
`sonnet_server` imports it -- and it is consumed by several services, three of
which use an identical surface. Extracting it:

- lets a pure API consumer stop pulling `typer` and `rich`;
- gives the toolkit a home that does not require a web framework;
- makes the layering explicit rather than conventional.

It is a library, not a binary: there is no `sonnet-cli` command. A consuming app
is where a runnable CLI (and its `[project.scripts]`) lives.

## Licence

Apache-2.0
