Lekha Poth CLI (lp) v2
Production Typer + Pydantic client for every Lekha Poth HTTP endpoint,
generated from backend/src/app/api on main (kept in sync — currently
140 routes as of product v0.16.2 / 6d2c833; regenerate with
generate_spec.py after any route change, guarded in CI by
backend/tests/unit/test_agent_spec_current.py).
Replaces the old stdlib scripts/agent/lp.py reader CLI.
Install
Published on PyPI as lekha-poth-cli.
No checkout needed:
uv tool install lekha-poth-cli # → $HOME/.local/bin/lp
uv tool upgrade lekha-poth-cli # later, to pick up new routes and flags
$HOME/.local/bin/lp --version
On macOS /usr/bin/lp is the print spooler and is on PATH, so call the
Lekha Poth CLI by its absolute path ($HOME/.local/bin/lp), or use the
alias entry point lekha-poth, which nothing else claims. To try it without
installing: uvx --from lekha-poth-cli lp --help.
An agent skill that teaches an LLM agent to drive this CLI ships in the
sdist under skills/lp-cli/ (and in the repository at
scripts/agent/lpcli/skills/lp-cli/); its README.md says where to put it.
Developing against a checkout
cd scripts/agent/lpcli
uv venv .venv && uv pip install --python .venv/bin/python -e ".[dev]"
.venv/bin/python -m lekha_poth_cli --version
# or, as a tool that tracks the working tree: uv tool install -e .
Releasing
Actions → Release (lekha-poth-cli) → Run workflow (bump minor by default,
or an exact version). It stamps every copy of the contract version
(scripts/ci/stamp-lpcli-version.py), runs the tests, uv builds, commits
and tags lpcli-vX.Y.Z on main, then uv publishes to PyPI. See
docs/CICD.md → "Releasing the agent CLI".
Configure (once)
lp config set --api-base "$LEKHA_POTH_API_BASE" \
--site-url "$LEKHA_POTH_SITE_URL" \
--api-key lpak_…
# hosted production example:
# --api-base https://api.lekhapoth.com/api/v1 --site-url https://lekhapoth.com
lp config set-defaults --output pretty --default-size 20
lp status
lp whoami
Config file: ~/.config/lekha-poth/config.json (mode 0600).
Existing keys (api_base, api_key, site_url, key_name, created_at) are kept.
Env overrides: LEKHA_POTH_API_BASE, LEKHA_POTH_API_KEY, LEKHA_POTH_SITE_URL, LEKHA_POTH_CONFIG.
Coverage
lp endpoints # every route, from endpoints.json
lp endpoints --admin
lp --help
lp admin items --help
lp items get --help # every query/body field is a flag
Raw escape hatch:
lp api request GET /items --param size=5 --param kind=text
lp api request GET /health --root
Staff media (initiate → direct PUT → complete → poll):
lp upload ./ep.mp4 --visibility public --role original --item-id UUID --wait
Iron rules (from the live API)
- Wire JSON is camelCase except pagination:
{size, next_cursor, has_next}(neverhasNext, nototalon public lists). - Errors:
{"error": {code, message, details, request_id}}— branch onerror.code. coverUrlis stable ornull.assets[].urlmay be presigned (~15 min); match assets byrole.- Legacy
/chaptersand/seriesexist only whenAPP_LEGACY_API_ENABLED. - Never store presigned URLs. Never put
lpak_in git, skills, or Hermes memory.
Regenerating the route catalogue
src/lekha_poth_cli/endpoints.json drives every command, and it is derived
from the live FastAPI app — there is no intermediate artefact to keep in sync:
cd backend
uv run python ../scripts/agent/lpcli/scripts/generate_spec.py # rewrite it
uv run python ../scripts/agent/lpcli/scripts/generate_spec.py --check # verify only
--check writes nothing and exits non-zero when the tracked file is stale.
backend/tests/unit/test_agent_spec_current.py runs the same comparison in CI,
so adding a route to the API without regenerating fails the build.
A new route stops the generator with an error rather than inventing a
command name for it: the id is what a person types, so it is a decision. Add an
entry to NEW_IDENTITY in the generator and re-run. Existing ids, auth values
and hand-shortened flag names (--status for the parameter status_filter) are
preserved on every run — they are the public CLI surface.
Regenerating covers the routes. docs/agent/*, agent/SKILL.md,
public/llms.txt and public/.well-known/agent.json are still updated by hand.
Release files for lekha-poth-cli 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lekha_poth_cli-2.2.0.tar.gz | 97.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lekha_poth_cli-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 125.7 kB
Release files / lekha_poth_cli-2.2.0.tar.gz
| Download URL | lekha_poth_cli-2.2.0.tar.gz |
|---|---|
| Size | 97.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d46e9d65bc9be644a1a1978baa3d09597527055f17710f192b2177cf3a79c9ec
|
|
BLAKE2b-256 checksum How to use checksums |
6b1f85245ce2039e9db20a5aeb2d007b167e6bb8839c835eb4883039b50b11b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / lekha_poth_cli-2.2.0-py3-none-any.whl
| Download URL | lekha_poth_cli-2.2.0-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d12ab5fd1f03a4c56c3f857d428d88e560b3999dbd289a45e88e85f0ec1251e1
|
|
BLAKE2b-256 checksum How to use checksums |
d554b230ebdef93a98c2cce4465f0357739c183e73b0456d90d4c3d4271355fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|