Metadata-Version: 2.4
Name: buildify-publish-cli
Version: 1.0.2
Summary: CLI for Buildify bundle publish server (machine Bearer auth)
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx<1,>=0.27
Requires-Dist: typer<1,>=0.12
Requires-Dist: tomli>=2.0.1; python_version < "3.11"
Requires-Dist: tomli-w<2,>=1.0
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"

# buildify-publish-cli

Command-line client for the **Buildify bundle publish** HTTP API. Use it to check health, validate publish keys, query bundle metadata, and upload JAR bundles from your terminal or CI.

**Requires:** Python 3.10 or newer.

## Install

From [PyPI](https://pypi.org/project/buildify-publish-cli/):

```bash
pip install buildify-publish-cli
```

Other installers:

```bash
pipx install buildify-publish-cli
uv tool install buildify-publish-cli
```

After install, the command is **`buildify-publish`**.

## Authentication

The API uses **Bearer** credentials: `Authorization: Bearer <keyId>.<secret>`.

Set the full secret (both parts after `Bearer`) as:

- Environment variable **`BUILDIFY_PUBLISH_API_KEY`**, or  
- **`buildify-publish config set-api-key`** (reads from stdin — avoids putting the secret on the command line).

Publish keys are **created and rotated in the Buildify console**, not through this CLI.

## Quick start

```bash
export BUILDIFY_PUBLISH_API_KEY='yourKeyId.yourSecret'

buildify-publish health
buildify-publish key test
buildify-publish bundle info --name 'my/group/plugin'
buildify-publish bundle upload \
  --name 'my/group/plugin' \
  --version '1.0.0-SNAPSHOT' \
  --file ./plugin.jar \
  --overwrite
```

### API base URL

Default: **`https://publish.buildify.cn`**

Override for self-hosted or other environments:

```bash
export BUILDIFY_PUBLISH_BASE_URL='https://your-publish-host.example.com'
# or per invocation:
buildify-publish --base-url 'https://your-publish-host.example.com' health
```

Persist in **`~/.buildifyrc`** — **two separate settings** (set either or both; order does not matter):

- **`base_url`** — which publish API host to call (default host above if unset).
- **`api_key`** — your publish credential `keyId.secret`, unrelated to the URL.

```bash
# Set only the API host (skip if the default https://publish.buildify.cn is fine)
buildify-publish config base_url https://publish.buildify.cn

# Set only the key (stdin avoids putting the secret in shell history)
printf '%s' 'keyId.secret' | buildify-publish config set-key api_key

buildify-publish config show
```

Use **`config set-key`** / **`config set_key`** with **`base_url`** or **`api_key`**. For **`api_key`**, omit the value or use `-` to read from stdin.

Shortcuts **`config set-base-url`** and **`config set-api-key`** update the same two fields.

**File:** `~/.buildifyrc` (Unix) or `%USERPROFILE%\.buildifyrc` (Windows). **Precedence:** CLI flags → **`BUILDIFY_PUBLISH_BASE_URL` / `BUILDIFY_PUBLISH_API_KEY`** → file → default base URL.

## Built-in reference

Full Markdown reference (commands, env vars, HTTP mapping, exit codes, JSON schema):

```bash
buildify-publish help
```

Same content ships as `usage.md` inside the package.

## Scripting and CI

Machine-readable output (one JSON object per run):

```bash
export BUILDIFY_PUBLISH_JSON=1
buildify-publish --json key test
```

Environment: `BUILDIFY_PUBLISH_BASE_URL`, `BUILDIFY_PUBLISH_API_KEY`, `BUILDIFY_PUBLISH_JSON`, `NO_COLOR`.

Global flags: `--json`, `--api-key`, `--base-url`, `--quiet`.

## Developing from source

If you have the Git repository checked out:

```bash
cd tools/buildify-publish-cli
python3 -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install .
```

Run without installing into the environment:

```bash
python -m buildify_publish --help
```

## License

Same as the upstream project repository unless stated otherwise.
