# ocx_sdk

*module*

Python SDK for [OCX](https://github.com/ocx-sh/ocx).

`ocx-sdk` drives the ocx binary rather than reimplementing it: ocx owns
resolution, verification, and the identifier grammar, and this package gives
you typed, CWD-independent handles over the commands it exposes.

```python
from ocx_sdk import Ocx, bootstrap

ocx = Ocx(exe=bootstrap.ensure())
project = ocx.project("/srv/build")
project.pull()
project.exec(["task", "verify"])
```

**This module is the API.** Everything listed in `__all__` is the stable
surface; every other module is underscored and package-private, and the one
public submodule is `ocx_sdk.bootstrap`. Reaching into an underscored path
means the next release may move it without notice — pre-1.0, breaking
changes ship without shims.

Start at `Ocx` for the runtime API and `bootstrap.ensure` for provisioning.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/__init__.py#L1-L1)

## ocx_sdk.CommandResult

*class* · *dataclass*

```python
class CommandResult
```

Re-exported from: `ocx_sdk._results`

The outcome of one ocx process, before any typing.

What `invoke()` returns and what every typed method is built on.

**Attributes**

- `argv` (`tuple[str, ...]`) — The argv that ran, with secrets already redacted by `_process`.
- `exit_code` (`int`) — The exit status. `int`, not `ExitCode`: a child killed by a signal reports a code ocx never assigns.
- `stdout` (`str`) — Raw stdout — JSON text for a `--format json` call.
- `stderr` (`str`) — Captured stderr in full, redacted.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L465-L503)

### ocx_sdk.CommandResult.argv

*attribute* · *instance attribute*

```python
argv: tuple[str, ...]
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L479-L479)

### ocx_sdk.CommandResult.exit_code

*attribute* · *instance attribute*

```python
exit_code: int
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L480-L480)

### ocx_sdk.CommandResult.stderr

*attribute* · *instance attribute*

```python
stderr: str
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L482-L482)

### ocx_sdk.CommandResult.stdout

*attribute* · *instance attribute*

```python
stdout: str
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L481-L481)

## ocx_sdk.ConfigSetupReport

*class* · *dataclass*

```python
class ConfigSetupReport
```

Re-exported from: `ocx_sdk._results`

`ocx config setup` — the `managed_config` block of `self setup`'s report.

ocx wraps the block in an envelope; the SDK flattens it, because the
envelope has exactly one key and a `ConfigSetupReport.managed_config.status`
chain says nothing `.status` does not.

**Attributes**

- `status` (`str`) — What the run did or would do, e.g. `"would_adopt"`.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L2950-L2969)

### ocx_sdk.ConfigSetupReport.status

*attribute* · *instance attribute*

```python
status: str
```

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L2962-L2962)

### ocx_sdk.ConfigSetupReport.from_json

*method* · *classmethod*

```python
def from_json(raw: str) -> ConfigSetupReport
```

Parse `ocx --format json config setup` output.

[View source](https://github.com/ocx-sh/ocx-sdk-python/blob/main/src/ocx_sdk/_results.py#L2964-L2969)
