Metadata-Version: 2.4
Name: kontract
Version: 0.1.0
Summary: Cross-repo fetch of a capability's process/contract tier (ADR-BCM-URBA-0016 / ADR-DSN-0002).
Author: yremy
License: Proprietary
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: kpack<3,>=2.0.0
Requires-Dist: pyyaml<7,>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"

# kontract

Cross-repo fetch of a business capability's **process/contract tier** — the DDD
tactical model (`aggregates.yaml`, `commands.yaml`, `policies.yaml`,
`read-models.yaml`, `bus.yaml`, `api.yaml`, JSON schemas) that says HOW a
capability is actually contracted, plus the `.bcm-provenance.json` pin that says
which corpus commit it derives from (ADR-DSN-0001).

Sibling of [`kpack`](https://github.com/papeete-hub/kpack), sharing its transport
only: `kontract` depends on `kpack` as a library (`kpack.config`, `kpack.registry`,
`kpack.remote`, `kpack.provenance`) and adds the one resolution step kpack doesn't
have — a business context to the *solution* context that `refines` it
(ADR-GCM-URBA-0006). See
[`reliever-design/adr/ADR-DSN-0002`](https://github.com/papeete-foundry/reliever-design/blob/main/adr/ADR-DSN-0002-kontract-resolution.md)
for the design record.

## How it works

```
CAP_ID (e.g. BNK.RLVR.CAP.SUP.002.BEN)
  -> business context (segs 0-1, e.g. BNK.RLVR)     -- kpack's own bootstrap --
  -> ENTERPRISE (seg 0) -> kpack config -> registry repo -> vocab.yaml contexts:
  -> confirm business context is registered                -- new: kontract's own step --
  -> scan contexts for kind: solution, refines: <business context>  (exactly one expected)
  -> that context's repo -> kpack.remote.resolve_repo_root (fetch + cache, same as kpack)
  -> serve process/<CAP_ID>/ from the resolved checkout
```

No caching beyond kpack's own git-clone cache (`--cache-dir` / `--no-fetch` /
`--fresh`) — every call is a fresh fetch by design.

## Install

```bash
pip install -e ".[dev]"
```

## Usage

```bash
kontract fetch <CAP_ID> [--ref REF] [--repo-root PATH] [--cache-dir DIR]
                         [--no-fetch] [--fresh] [--config PATH]
                         [--registry-repo SLUG] [--registry-ref REF] [--compact]
```

Uses the same `~/.config/kpack/config.yaml` / `./.kpack.yaml` / `--config`
enterprise -> registry bootstrap as `kpack` — no separate kontract config file.

## Develop

```bash
make test     # pytest against a fake business+solution repo pair (tests/conftest.py)
```
