Skip to content

Commit f4286e4

Browse files
docs(readme): convert README.adoc -> Markdown README.md (#23)
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 53d0028 commit f4286e4

2 files changed

Lines changed: 85 additions & 91 deletions

File tree

README.adoc

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

README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
Haskell library for parsing and rendering K9 self-validating
7+
configuration components — Hackage-ready, purely functional, typed AST.
8+
9+
# Overview
10+
11+
K9 is a configuration format for software component declarations with
12+
built-in provenance tracking, security classification, build recipes,
13+
and runtime contracts. `k9-haskell` provides a purely functional parser
14+
and renderer for both K9 surface formats:
15+
16+
- `.k9` — YAML-like plain-text format, identified by the `K9!` magic
17+
number
18+
19+
- `.k9.ncl` — Nickel format; detected and parsed via `parseK9Nickel`
20+
21+
The library exports typed Haskell data structures: `Component`,
22+
`Pedigree`, `SecurityLevel`, `SecurityPolicy`, `Target`, `Recipes`,
23+
`Validation`, `Contract`, `ContractClause`.
24+
25+
# Security Levels
26+
27+
| Level | Meaning |
28+
|----------|------------------------------------------------------|
29+
| `Kennel` | Pure data. No code execution. Safe to open anywhere. |
30+
| `Yard` | Controlled execution with limited permissions. |
31+
| `Hunt` | Full execution. Explicit authorisation required. |
32+
33+
`SecurityPolicy` wraps the level with explicit permission flags, so a
34+
`Yard`-level component can carry fine-grained capability declarations
35+
beyond the three-tier classification.
36+
37+
# Usage
38+
39+
```haskell
40+
import Data.K9 (parseK9, render)
41+
42+
main :: IO ()
43+
main = do
44+
txt <- readFile "component.k9"
45+
case parseK9 txt of
46+
Left err -> putStrLn $ "Parse error: " <> show err
47+
Right cmp -> putStrLn $ render cmp
48+
```
49+
50+
# Format Detection
51+
52+
```haskell
53+
import Data.K9.Parser (detectFormat, K9Format(..))
54+
55+
-- Returns K9Yaml or K9Nickel based on file content
56+
fmt <- detectFormat <$> readFile "component.k9.ncl"
57+
```
58+
59+
# Modules
60+
61+
| Module | Purpose |
62+
|----|----|
63+
| `Data.K9` | Top-level re-export |
64+
| `Data.K9.Types` | All AST types |
65+
| `Data.K9.Parser` | `parseK9`, `parseK9File`, `parseK9Nickel`, `detectFormat` |
66+
| `Data.K9.Renderer` | `render` `::` `Component` `` `Text` |
67+
68+
# Related
69+
70+
- [k9-rs](https://github.com/hyperpolymath/k9-rs) — Rust implementation
71+
72+
- [pandoc-k9](https://github.com/hyperpolymath/pandoc-k9) — Pandoc Lua
73+
reader/writer for `.k9.ncl`
74+
75+
# Building
76+
77+
```sh
78+
cabal build
79+
cabal test
80+
```
81+
82+
# License
83+
84+
MPL-2.0 (MPL-2.0 preferred; MPL-2.0 required for Hackage). See
85+
[LICENSE](LICENSE).

0 commit comments

Comments
 (0)