Skip to content

Commit e88a918

Browse files
hyperpolymathclaude
andcommitted
feat: k9iser Phase 1 — config parser, K9 contract generation, validator, tests
Manifest redesigned for K9 contracts: [project] with safety tiers, [[configs]] with four pillars (must/trust/dust/intend), [validation] options. Backward compatibility preserved via optional [workload] section. Parser: TOML/YAML/JSON/INI config file reading and key-value extraction. Contract generator: produces .k9 contract files from parsed configs + rules. Validator: checks configs against contracts, produces violation reports. ABI types: SafetyTier, K9Contract, ValidationResult, ConfigFormat. 45 tests passing (19 unit + 19 binary + 7 integration). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 612a5ef commit e88a918

11 files changed

Lines changed: 2288 additions & 46 deletions

File tree

examples/web-app/config/app.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Web application configuration
2+
# This file is wrapped into a K9 contract by k9iser
3+
4+
[server]
5+
host = "0.0.0.0"
6+
port = 8080
7+
workers = 4
8+
max-connections = 1024
9+
read-timeout = 30
10+
write-timeout = 30
11+
12+
[database]
13+
url = "postgres://db-host:5432/webapp"
14+
pool-size = 20
15+
idle-timeout = 300
16+
max-lifetime = 3600
17+
18+
[logging]
19+
level = "info"
20+
format = "json"
21+
output = "stdout"
22+
23+
[security]
24+
cors-origins = ["https://app.example.com"]
25+
rate-limit = 100
26+
session-timeout = 3600
27+
csrf-protection = true
28+
29+
[cache]
30+
backend = "redis"
31+
url = "redis://cache-host:6379/0"
32+
ttl = 300
33+
max-memory = "256mb"

examples/web-app/k9iser.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# k9iser manifest — web application config example
2+
# SPDX-License-Identifier: PMPL-1.0-or-later
3+
4+
[project]
5+
name = "web-app-config"
6+
safety-tier = "yard" # yard = medium risk (staging/internal)
7+
8+
[[configs]]
9+
name = "app-config"
10+
source = "config/app.toml"
11+
format = "toml"
12+
# Must rules — required constraints:
13+
must = [
14+
"server.port > 0",
15+
"server.port < 65536",
16+
"server.host != ''",
17+
"database.pool-size > 0",
18+
"database.pool-size <= 100",
19+
]
20+
# Trust sources — who verified this config:
21+
trust = ["signed-by: ci-pipeline", "reviewed-by: platform-team"]
22+
# Dust rules — cleanup actions:
23+
dust = ["remove: deprecated-keys", "remove: legacy-flags"]
24+
# Intend declarations — purpose:
25+
intend = ["production-ready", "security-reviewed"]
26+
27+
[validation]
28+
strict = true
29+
auto-fix = false
30+
report-format = "text"

0 commit comments

Comments
 (0)