@karasu-tools/core
v0.2.0
Published
Compile and render .krs architecture diagrams — the core engine behind karasu (parser, style resolver, SVG renderer, translate).
Readme
@karasu-tools/core
The core engine behind karasu — a text-based architecture modeling tool inspired by the C4 model but with its own vocabulary, separating logical, physical, and organizational structure. This package is the pure-TypeScript parser, style resolver, SVG renderer, and translate library that the karasu CLI and app are built on.
Stability — v0.x (no stability promise). The
.krs/.krs.stylelanguage spec is committed to v1.0 (see ADR-20260616-06), but this TypeScript API is v0.x: breaking changes may land in minor releases. Pin a version if you depend on it.
Install
npm install @karasu-tools/coreUsage
import { compile, buildAllViewsSvg } from "@karasu-tools/core";
const result = compile(`
system Shop {
user Customer [human]
service Checkout
Customer -> Checkout "places an order"
}
`);
if (result.kind === "system") {
console.log(result.diagnostics); // structured, language-neutral diagnostics
const svg = buildAllViewsSvg(result); // render to SVG
}compile(source) parses and resolves a single .krs document; compileProject(...) resolves a multi-file project through a FileSystemProvider. Diagnostics are returned as structured, language-neutral data — render them to text with @karasu-tools/i18n (renderDiagnostic / renderWarning).
