AffineScript Libraries is a collection of reusable libraries for the AffineScript programming language.
This repository provides:
-
KYAML Processing — Kubernetes-native YAML parsing, querying, and manipulation
-
Query Languages — jq-like and custom query DSLs for data extraction
-
Lint Rules — Pluggable linting infrastructure for Kubernetes manifests
-
Utility Libraries — Common data structures and algorithms
-
FFI Bindings — Foreign function interfaces for interoperability
# Clone the repository
git clone https://github.com/metadatastician/affinescript-libraries.git
cd affinescript-libraries
# Build all libraries
just build
# Run tests
just test
# See available libraries
ls src/| Library | Description |
|---|---|
|
Kubernetes YAML processing (core kyq functionality) |
|
Query language implementations |
|
Lint rule collections |
|
Kubernetes schema definitions |
|
Generic data structures (maps, sets, vectors) |
|
Text processing and parsing utilities |
|
JSON serialization/deserialization |
|
Generic YAML support (non-K8s) |
This library is the upstream source for the kyq tool’s core functionality. The kyq tool uses libraries from here.
To use these libraries in your own AffineScript project:
import Kyaml
import Kyaml.Query
import Kyaml.Lint.RequiredFields
// Parse and lint a Kubernetes manifest
let content = readFile "deployment.yaml"
let result = Kyaml.parse content
match result with
| ParseSuccess file ->
let issues = Kyaml.lintFile content
if issues != [] then
printIssues issues
else
let json = Kyaml.toJson file
print json
| ParseFailure errors ->
printErrors errors# Build all libraries
just build
# Build a specific library
just build-kyaml
# Run tests
just test
# Run tests for a specific library
just test-kyaml| Component | Status | Notes |
|---|---|---|
Kyaml.Parser |
🟡 Draft |
Basic parsing in AffineScript |
Kyaml.Lexer |
🟡 Draft |
Tokenization |
Kyaml.Ast |
🟡 Draft |
AST definitions |
Kyaml.Query |
🟢 Planning |
Query language design |
Kyaml.Lint |
🟢 Planning |
Lint rule framework |
Data.Structures |
🟢 Planning |
Maps, sets, vectors |
See CONTRIBUTING.adoc for development guidelines.
All code in this repository is licensed under MPL-2.0.
See LICENSE for the full license text.
-
AffineScript — The language
-
kyq — Kubernetes YAML Query tool
-
affinescript-ecosystem — Ecosystem coordination