Skip to content

Commit 5c3d52a

Browse files
docs(readme): convert README.adoc -> Markdown README.md (#40)
README must be real Markdown to render in GitHub community-health, the GitHub profile, and external MCP directories (Glama) — AsciiDoc shows as raw markup there. pandoc asciidoc->GFM, badges fixed to clickable, SPDX header kept as an HTML comment, duplicate README.adoc removed. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e95a2f4 commit 5c3d52a

2 files changed

Lines changed: 146 additions & 148 deletions

File tree

README.adoc

Lines changed: 0 additions & 148 deletions
This file was deleted.

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<!--
2+
SPDX-License-Identifier: CC-BY-SA-4.0
3+
SPDX-FileCopyrightText: 2025-2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
-->
5+
6+
# What Is This?
7+
8+
**k9iser** analyses configuration files — TOML, YAML, JSON, Nickel —
9+
infers the implicit constraints they embody, generates formal [K9
10+
contracts](https://github.com/hyperpolymath/contractile) from those
11+
constraints, validates configs against the contracts, and attests
12+
compliance with cryptographic signatures.
13+
14+
Think "JSON Schema on steroids with cryptographic attestation." Where a
15+
schema says *"this field is a string,"* a K9 contract says *"this field
16+
is a non-empty DNS hostname that resolves, is not on a blocklist, and
17+
was last changed by a trusted principal — here is the proof."*
18+
19+
Part of the [-iser family](https://github.com/hyperpolymath/iseriser).
20+
21+
# How It Works
22+
23+
Point k9iser at your configs:
24+
25+
```bash
26+
k9iser init # creates k9iser.toml manifest
27+
k9iser generate # analyse configs → infer constraints → emit K9 contracts
28+
k9iser validate # check configs against their contracts
29+
```
30+
31+
The pipeline:
32+
33+
1. **Config analysis** — parse TOML / YAML / JSON / Nickel, extract
34+
structure and value ranges.
35+
36+
2. **Constraint inference** — derive must-rules, trust sources, dust
37+
(cleanup) rules, and intent declarations from observed config
38+
patterns.
39+
40+
3. **K9 contract generation** — emit machine-readable `.k9.ncl`
41+
contracts encoding the inferred constraints.
42+
43+
4. **Validation engine** — check a config against its K9 contract,
44+
collecting pass/fail evidence for every constraint.
45+
46+
5. **Attestation** — sign the validation result so downstream consumers
47+
can verify compliance without re-running the checks.
48+
49+
# K9 Contract Anatomy
50+
51+
A K9 contract is built from four pillars, matching the [contractile
52+
CLI](https://github.com/hyperpolymath/contractile) system:
53+
54+
| **must** | Required constraints — fields that must exist, value ranges, type invariants. Violation = hard failure. |
55+
|----|----|
56+
| **trust** | Verified sources — which principals may change a value, which signing keys are accepted, provenance chains. |
57+
| **dust** | Cleanup rules — stale keys to remove, deprecated fields, migration paths from old config shapes. |
58+
| **intend** | Intent declarations — what the config *means* to do, so validators can catch configs that are syntactically valid but semantically wrong. |
59+
60+
Contracts are tiered by safety level:
61+
62+
- **Kennel** — safe, read-only analysis, no side effects.
63+
64+
- **Yard** — moderate, may write generated files.
65+
66+
- **Hunt** — powerful, may mutate live configs and trigger deployments.
67+
68+
# Use Cases
69+
70+
- **CI/CD config validation** — gate merges on K9 contract compliance.
71+
72+
- **Infrastructure-as-code compliance** — ensure Terraform / Ansible /
73+
Nix configs satisfy organisational policy before apply.
74+
75+
- **Dependency manifest auditing** — validate Cargo.toml / package.json
76+
/ pyproject.toml against known-good constraints.
77+
78+
- **Deployment config gates** — attest that a deployment config
79+
satisfies all must-rules before the deploy pipeline proceeds.
80+
81+
- **Config drift detection** — compare live configs against K9 contracts
82+
to surface unauthorised changes.
83+
84+
# Architecture
85+
86+
Follows the hyperpolymath -iser pattern:
87+
88+
k9iser.toml manifest
89+
→ config analysis (multi-format parser)
90+
→ constraint inference engine
91+
→ Idris2 ABI (proves constraint completeness and soundness)
92+
→ K9 contract codegen (.k9.ncl)
93+
→ Zig FFI bridge (C-ABI validation engine)
94+
→ Rust CLI orchestration
95+
96+
src/
97+
├── main.rs # CLI entry point (clap)
98+
├── lib.rs # Library API
99+
├── manifest/ # k9iser.toml parser
100+
├── codegen/ # K9 contract code generation
101+
├── core/ # Constraint inference, validation engine
102+
├── contracts/ # K9 contract data model
103+
├── definitions/ # Built-in constraint definitions
104+
├── errors/ # Structured error types
105+
├── bridges/ # Format-specific parsers (TOML, YAML, JSON, Nickel)
106+
├── aspects/ # Cross-cutting concerns (logging, attestation)
107+
└── interface/
108+
├── abi/ # Idris2 ABI — proves constraint soundness
109+
│ ├── Types.idr # K9Contract, Constraint, MustRule, ValidationResult
110+
│ ├── Layout.idr # Contract struct layout proofs
111+
│ └── Foreign.idr # FFI declarations for validation engine
112+
├── ffi/ # Zig FFI — C-ABI validation bridge
113+
│ ├── build.zig
114+
│ ├── src/main.zig
115+
│ └── test/integration_test.zig
116+
└── generated/ # Auto-generated C headers from Idris2 ABI
117+
118+
# Integration with Contractile
119+
120+
k9iser is both a *producer* and *consumer* of the contractile CLI
121+
toolchain:
122+
123+
- **Producer** — generates `.k9.ncl` contracts from analysed configs.
124+
125+
- **Consumer** — validates those contracts using the `k9` validator from
126+
[contractile](https://github.com/hyperpolymath/contractile).
127+
128+
- **must** / **trust** / **dust** / **intend** validators can all be
129+
invoked against k9iser-generated contracts.
130+
131+
# Status
132+
133+
**Pre-alpha.** Scaffold complete. Config parser, constraint inference,
134+
and K9 contract codegen are in progress. The Idris2 ABI and Zig FFI
135+
layers carry template placeholders pending domain-specific types.
136+
137+
# Build
138+
139+
```bash
140+
cargo build --release
141+
cargo test
142+
```
143+
144+
# License
145+
146+
SPDX-License-Identifier: CC-BY-SA-4.0

0 commit comments

Comments
 (0)