Skip to content

About

Reusable AffineScript libraries (design stage): a KYAML (Kubernetes YAML) lexer/AST/parser draft, with jq-style query DSLs, Kubernetes lint rules, data structures and FFI bindings planned. Intended core of kcq.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

AffineScript Libraries

What this is

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

Quick start

# 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 Structure

Library Description

Kyaml/

Kubernetes YAML processing (core kyq functionality)

Kyaml/Query/

Query language implementations

Kyaml/Lint/

Lint rule collections

Kyaml/Schema/

Kubernetes schema definitions

Data/

Generic data structures (maps, sets, vectors)

Text/

Text processing and parsing utilities

Json/

JSON serialization/deserialization

Yaml/

Generic YAML support (non-K8s)

Usage with kyq

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

Building

# 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

Project Status

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

Contributing

See CONTRIBUTING.adoc for development guidelines.

License

All code in this repository is licensed under MPL-2.0.

See LICENSE for the full license text.

Repository Metadata

Owner

metadatastician

Primary Language

AffineScript

Target

WebAssembly

RSR Tier

2

About

Reusable AffineScript libraries (design stage): a KYAML (Kubernetes YAML) lexer/AST/parser draft, with jq-style query DSLs, Kubernetes lint rules, data structures and FFI bindings planned. Intended core of kcq.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages