opencloning-cli is the command-line companion to the OpenCloning backend. It provides Alembic-backed schema management, guarded local seeding, stub workflows and admin commands for opencloning-db.
opencloning-cli is a uv workspace member. From the repository root:
uv sync
uv run opencloning-cli --helpUse db migrate to bring the configured database to Alembic head. On an empty database this creates all tables (starts from baseline revision faa1e883e333).
source .env.dev
uv run opencloning-cli db migrateEquivalent to uv run alembic -c packages/opencloning-db/alembic.ini upgrade head with OPENCLONING_DB_URL set. See opencloning-db/README.md for autogenerate workflow.
db seed clears object-storage prefixes, ensures schema at head, truncates application tables, and loads the deterministic demo/test baseline. It only runs when OPENCLONING_TESTING=1.
source .env.dev
OPENCLONING_TESTING=1 uv run opencloning-cli db seedUse --recreate-schema to drop and recreate the public schema before migrating (for broken mid-dev states).
Admin commands read and write the configured database directly. Load .env.dev first.
source .env.dev
uv run opencloning-cli admin list-users
uv run opencloning-cli admin whitelist-list
uv run opencloning-cli admin list-workspaces
uv run opencloning-cli admin assign-user view-only-user@example.com 1 --role editor
uv run opencloning-cli admin set-instance-admin bootstrap@example.comUse db stubs to generate JSON stubs for frontend testing. By default it writes one JSON file per yielded stub request into ./stubs/db (for example, get_primers.json, get_sequences.json, and similar request-specific files).
db stubs writes JSON request/response fixtures for frontend or integration tests. It requires OPENCLONING_TESTING=1 because it calls db seed between cases.
source .env.dev
OPENCLONING_TESTING=1 uv run opencloning-cli db stubs --output-dir ./stubs/dbThe command reseeds the database to the default baseline between stub cases and records the yielded stub requests as separate files in the output directory.