# 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.CascadeRepairReport

*class* · *dataclass*

```python
class CascadeRepairReport
```

Re-exported from: `ocx_sdk._results`

`ocx package cascade repair` — what was re-pointed, or would be.

**Report-then-fail** like `check`: exit 65 with this document when a
finding remains — including on a `dry_run`, where "planned anything"
is the finding — so `exit_code` rather than an exception says whether
the registry now agrees with itself.

**Attributes**

- `entries` (`tuple[RepairEntry, ...]`) — One entry per package, in input order.
- `dry_run` (`bool`) — `True` when nothing was written because the run was a preview.
- `announce_tags_path` (`str | None`) — Where `--announce-tags` was written, when given.
- `exit_code` (`int`) — `0` when every attempted write succeeded and nothing remains, `65` otherwise.

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

### ocx_sdk.CascadeRepairReport.announce_tags_path

*attribute* · *instance attribute*

```python
announce_tags_path: str | None
```

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

### ocx_sdk.CascadeRepairReport.dry_run

*attribute* · *instance attribute*

```python
dry_run: bool
```

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

### ocx_sdk.CascadeRepairReport.entries

*attribute* · *instance attribute*

```python
entries: tuple[RepairEntry, ...]
```

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

### ocx_sdk.CascadeRepairReport.exit_code

*attribute* · *class attribute* · *instance attribute*

```python
exit_code: int = 0
```

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

### ocx_sdk.CascadeRepairReport.clean

*property*

```python
clean: bool
```

Whether no finding remains — the exit code's answer.

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

### ocx_sdk.CascadeRepairReport.from_json

*method* · *classmethod*

```python
def from_json(raw: str, *, exit_code: int = 0) -> CascadeRepairReport
```

Parse `ocx --format json package cascade repair` output.

**Parameters**

- `raw` (`str`) — Captured stdout.
- `exit_code` (`int`) (default: `0`) — The process's exit status, carried onto the result.

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