Metadata-Version: 2.4
Name: paradigx-cli-core
Version: 0.1.0
Summary: Shared core for Paradigx product CLIs — OAuth device-flow, token cache, HTTP client
Project-URL: Homepage, https://github.com/jiangjin11/paradigx-workspace
Author: Paradigx Pte Ltd
License: MIT
Keywords: agent,cli,device-flow,oauth,paradigx
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.28
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: pytest-mock>=3.14; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Description-Content-Type: text/markdown

# paradigx-cli-core

Shared core for [Paradigx](https://github.com/jiangjin11/paradigx-workspace)
product CLIs (`botu`, `tokenroute`, ...).

This is a **library, not a CLI** — it has no command entry point. Product
CLIs depend on it and keep only their command layer.

## What it provides

- **OAuth device-flow** login against Logto (`auth`, `device_flow`)
- **Shared token cache** at `~/.paradigx/auth.json`, keyed by API URL, so
  one login is reused across every Paradigx CLI (`config`)
- **Automatic JWT refresh** — cached tokens are transparently renewed via
  the stored refresh token (`auth.valid_access_token`)
- **HTTP client** with per-product trailing-slash / redirect handling
  (`client`)
- **`--json` output helpers** — rich tables for humans, JSON for agents
  (`output`)

## Usage (by a product CLI)

```python
from paradigx_cli_core import do_login, valid_access_token, request

# login
do_login("https://botu.io/api/auth/discovery/", "https://botu.io",
         on_code=lambda c: print("visit", c.verification_uri_complete))

# authenticated call (auto-refreshes the token)
token = valid_access_token("https://botu.io")
sites = request("GET", "https://botu.io", "/api/sites",
                token=token, trailing_slash=True)
```

See `docs/specs/cli-phase-b.md` in the workspace repo for the design.

---

© 2026 Paradigx. All Rights Reserved.
