Metadata-Version: 2.4
Name: kpack
Version: 2.0.0
Summary: Single shared knowledge-pack engine for capability-map corpora (ADR-KCM-URBA-0002).
Author: yremy
License: Proprietary
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: rdflib<8,>=7
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"

# kpack

The single shared **knowledge-pack engine** for capability-map corpora — one
installable, one console script (`kpack`) serving every context across every
enterprise. Implements [ADR-KCM-URBA-0002](https://github.com/Banking-PapeeteConsulting/banking-knowledge/blob/main/adr/ADR-KCM-URBA-0002-knowledge-packaging-and-consumption-standard.md);
replaces the per-map CLIs `gov-pack`, `pcm-pack`/`tech`, and `rlv-knowledge`.

Architecture and rationale: [`docs/kpack-design.md`](docs/kpack-design.md).

## How it works

```
id  →  ENTERPRISE (seg 0)  →  kpack config (enterprise → registry repo)
    →  governance repo      →  vocab.yaml contexts: (context → repo)
    →  CONTEXT (seg 0–1)    →  corpus repo  →  knowledge.yaml descriptor  →  fetch + walk
```

Each corpus publishes a **navigation descriptor** (`knowledge.yaml`) declaring how
it is fetched and walked — how many event→carrier layers it has and which fields
link them. The common edges live once in the shared meta-model `cmm.1`
([`docs/examples/cmm.1.yaml`](docs/examples/cmm.1.yaml)). The engine walks the
corpus on demand and emits a uniform, role-keyed JSON envelope; it materialises no
graph and stores no credentials (corpora are fetched with your own git identity).

## Install

```bash
pip install -e ".[dev]"      # from source
# or, as a container (GitHub Packages):
docker run --rm ghcr.io/papeete-consulting/kpack pack BNK.RLVR.CAP.BSP.001.SCO
```

## Commands

```bash
kpack pack <id> [--deep] [--compact]              # capability pack (context from id)
kpack list --context BNK.TECH [--level L1|L2|L3]  # list capabilities
kpack diff <from_ref> [--to <ref>] --context <C>  # semantic by-id diff
kpack process <id> [--list]                       # DDD process model (if declared)
kpack version [--context <C>]                     # engine version / corpus provenance
```

Global flags: `--ref`, `--repo-root` (local dev), `--cache-dir`, `--no-fetch`,
`--fresh`, `--config`, `--registry-repo`, `--registry-ref`.

## Configure

`~/.config/kpack/config.yaml` (or `./.kpack.yaml`, or `--config`):

```yaml
enterprises:
  BNK: { registry_repo: Banking-PapeeteConsulting/banking-governance, registry_ref: main }
  NUN: { registry_repo: naive-unicorn/naive-unicorn-governance,       registry_ref: main }
default_enterprise: BNK
```

## Develop

```bash
make test     # pytest against a fake knowledge stub (tests/conftest.py)
make build    # wheel + sdist
make docker   # build the GHCR image
make smoke REPO=Banking-PapeeteConsulting/reliever-knowledge \
           DESC=docs/examples/knowledge.BNK-RLVR.yaml CAP=BNK.RLVR.CAP.BSP.001.SCO
```
