OVERVIEW
Monorepo/Core Toolchain/tools/pkg (kale-pm)
v0.1.0 • PlannedSource Code
tools/pkg/

tools/pkg (kale-pm)

Package Manager & Build Automation Tool

The package manager and build orchestrator for the Kale ecosystem. Manages module imports, resolves semantic version constraints, downloads distributed dependencies, and provides reproducible, incremental compiler invocations.

Build GraphDAG Incremental Memoized
Lockfile Formatkale.lock / TOML
RegistryDecentralized Git / HTTPS
MilestoneActive Module
tools/pkg (kale-pm)
Compiler Internal Stages
AOT Emission Latency < 24ms
STAGE 1
Lexer & Token Stream
Single-pass UTF-8 scanner with zero allocations
STAGE 2
Parser & AST Tree
Recursive descent parser emitting strict typed AST nodes
STAGE 3
Type Binder & Inference
Symbol resolution, struct layout, and type deduction
STAGE 4
LLVM IR Emitter
LLVM 18 IR generation linked directly via Clang/LLD
Native C ABI Linker

Zero-Overhead Foreign Function Interface

Kale links directly against native C dynamic libraries with no runtime marshaling wrapper. Functions declared with extern symbols resolve directly through the platform loader (kernel32, user32, opengl32, glfw3, sqlite3).

// Linker Flags
python -m kale.cli build main.kl -o bin/app.exe -lglfw3 -lopengl32 -lsqlite3
Compiler Hardware Architecture
pkg_manifest.toml
toml
[package]
name = "kale_graphics"
version = "0.2.0"
authors = ["Kale Team <team@kale.lang>"]

[dependencies]
std = { path = "packages/std" }
render = { path = "libs/render", version = ">=0.1.0" }
glfw = { path = "libs/glfw" }

[build]
opt_level = 3
target = "x86_64-windows-msvc"
Compilation & Linker Directives

Deterministic command-line invocations to build, link native dynamic dependencies, and run automated regression tests:

$kale-pm new my_project
$kale-pm build --release
$kale-pm test
Monorepo Governance

GPG Key 1B917D4779A6102E • Continuous integration with automated symbol verification.

Architectural Capabilities
Hermetic Dependency Resolution

Produces bit-for-bit reproducible builds with cryptographic SHA-256 package verification.

Monorepo Workspace Aware

Natively navigates Kale monorepo packages, libraries, and apps with intelligent symlinking.

Zero Runtime Overhead

Compiles packages directly into static binary artifacts with zero dynamic interpreter overhead.