Metadata-Version: 2.4
Name: powertech-cli
Version: 0.2.0
Summary: PowerTech CLI for batch video upload and result download.
Author: PowerTech
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: alibabacloud-oss-v2<2,>=1.3.2
Requires-Dist: httpx<1,>=0.27
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: ruff<1,>=0.9; extra == "dev"

# PowerTech CLI

Command-line client for uploading video batches and downloading processing results.

## Development install

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```

The same package is used in every environment. Production is the default;
development and staging select another API URL during login and keep their local
CLI state in separate directories.

## Environments

### Development

Start `powertech-api` at `http://127.0.0.1:8000`, then create a CLI token in the
development SaaS web app:

```bash
POWERTECH_CLI_HOME=~/.powertech/development \
powertech login --token <development_token> --api-url http://127.0.0.1:8000
```

### Staging

Use the same package and save staging credentials separately:

```bash
POWERTECH_CLI_HOME=~/.powertech/staging \
powertech login \
  --token <staging_token> \
  --api-url https://api-staging.powertech-ai.com
```

Set the same `POWERTECH_CLI_HOME` when running later commands. The saved
configuration is private to the current operating-system user.

### Production

PyPI releases default to the production API:

```bash
powertech login --token <production_token>
```

Use `--api-url` only for development, staging, or a private deployment. The URL
is saved with the token, so later upload and download commands do not repeat it.

## Upload

Every upload command requires one camera intrinsics JSON. It is validated locally,
then applied to every video selected by that command. Directory inputs recursively
find MP4 and MOV files and preserve relative paths. Interrupted uploads resume from
local checkpoints automatically.

```bash
POWERTECH_CLI_HOME=~/.powertech/staging \
powertech upload ./video.mp4 --intrinsics ./camera-a.json

POWERTECH_CLI_HOME=~/.powertech/staging \
powertech upload ./camera-a-videos --intrinsics ./camera-a.json

POWERTECH_CLI_HOME=~/.powertech/staging powertech status <upload_batch_id>
```

Supported input formats: MP4 and MOV.

Run separate commands when videos use different cameras or intrinsics:

```bash
powertech upload ./camera-a-videos --intrinsics ./camera-a.json
powertech upload ./camera-b-videos --intrinsics ./camera-b.json
```

## Download

```bash
POWERTECH_CLI_HOME=~/.powertech/staging \
powertech download --upload-batch <upload_batch_id> --output ./results
```

The output always contains `manifest.json`. Result files are downloaded into the
paths returned by the API.

## Local Test Mode

The isolated mock adapter does not use RDS or OSS:

```bash
powertech login --token dev_token --api-url local
powertech upload ./videos --intrinsics ./camera-a.json
```

CLI state is stored under `~/.powertech/`. Set `POWERTECH_CLI_HOME` to use another
directory during tests.

## Continuous integration

Pull requests and pushes to `main` run Ruff, the unit tests, and a packaging smoke
test. Staging does not deploy or require a separate CLI package. A `vX.Y.Z` tag
whose commit belongs to `main` and whose value matches the package version publishes
to PyPI through its trusted publisher; manual dispatch remains a recovery path.
