Metadata-Version: 2.4
Name: buildify-cli
Version: 1.2.0
Summary: CLI for the Buildify open API: discover bundle nodes, author and test workflows (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-cli

CLI for the Buildify **open API** (`buildify-open-api-server`): discover installed bundle nodes,
read their form schemas and documentation, reference workspace credentials, and create, validate,
test run and deploy workflows — all with a machine API key, no browser session.

`workflow deploy` publishes a draft to workers that are already bound to the flow. It does not pick
servers. Credentials can be created with `project create-credential` after the user confirms
the project, name/label and form values.

For publishing bundle JARs see the sibling [buildify-publish-cli](../buildify-publish-cli).

## Install

```bash
pip install buildify-cli      # or pipx / uv tool install
buildify help                 # full Markdown reference on stdout
```

Requires Python 3.10+.

## Configure

Create a key in the console (workspace settings → Open API keys). The full `keyId.secret` is shown
**only once**. One key belongs to one workspace. Save each workspace under its own profile:

```bash
printf '%s' 'keyId.secret' | buildify config add-profile acme
buildify config set-key base_url https://openapi.buildify.cn
buildify --json key test
buildify --json config profiles
```

`add-profile` does not change the default. `config use <name>` does, for a person at the terminal.
Agents should pass `--profile <name>` instead. A repo may commit `.buildify-workspace` with only the
public workspace id (`tenantId` from `key test`).

If a command runs with no key: a TTY prompts and saves locally; `--json` / non-TTY exits 2 with
`data.reason=missing_api_key`. Several saved keys and no selection exits 2 with
`data.reason=profile_required`.

Config lives in the `[openapi]` section of `~/.buildifyrc` (mode `600`). Do not pass `--api-key` on
the command line, and do not commit the rc file or paste the secret into the repo.
`BUILDIFY_OPENAPI_BASE_URL` and `BUILDIFY_OPENAPI_API_KEY` override the file at runtime.
`BUILDIFY_OPENAPI_PROFILE` selects a saved profile. `BUILDIFY_OPENAPI_NO_PROMPT=1` disables the
interactive prompt. `config set-key api_key` still updates the current profile, or the legacy single key.

## Commands

| Group | Commands |
|-------|----------|
| — | `health`, `version`, `help` |
| `key` | `test` |
| `bundle` | `list`, `nodes`, `node-properties`, `node-relations`, `doc`, `cred-types`, `cred-properties` |
| `project` | `list`, `create`, `get`, `update`, `delete`, `credentials`, `create-credential`, `update-credential`, `delete-credential`, `credential-workflows`, `workers` |
| `workflow` | `list`, `create`, `get-draft`, `save-draft`, `validate`, `test-run`, `cancel-test`, `deploy`, `published`, `deployments`, `deployment`, `versions`, `get-version` |
| `config` | `init`, `set-key`, `add-profile`, `use`, `profiles`, `remove-profile`, `show` |

Every command accepts `--json` for a single-line envelope
(`{ok, code, msg, http_status, data}`) and maps failures onto stable exit codes:
`0` ok, `1` generic, `2` auth/config, `3` local validation, `4` HTTP 4xx/5xx or validation errors,
`5` network.

## Example

```bash
buildify --json bundle nodes -b official/core
buildify --json bundle node-properties -b official/core -n HttpRequestNode
buildify --json workflow validate -p proj_xxx -f ./flow.json
buildify --json workflow test-run -p proj_xxx -f ./flow.json --worker wk_xxx
buildify --json workflow deploy -p proj_xxx -w wf_xxx --worker wk_xxx --wait
```

## Development

```bash
uv venv && uv pip install -e '.[dev]'
python -m buildify_cli --help
```

`src/buildify_cli/usage.md` is the source of truth for `buildify help`; keep this README aligned
for humans.
