Allium Tools follows a layered architecture designed for multi-editor support, high performance, and robustness.
+-------------------------------------------------------------+
| Editor Clients |
| (VS Code, Neovim, Emacs, or standard LSP clients) |
+-------------------------------------------------------------+
| |
| JSON-RPC (stdio) | Tree-sitter Queries
v v
+-----------------------+ +-----------------------------+
| allium-lsp | | tree-sitter-allium |
| (Language Server) | | (Incremental Parser) |
+-----------+-----------+ +-----------------------------+
| | Highlighting, Folds,
| Function Calls | Indentation, Navigation
v v
+-------------------------------------------------------------+
| language-tools |
| (Core Engine: Analysis, Definitions, Refactors, Formatting) |
+-------------------------------------------------------------+
^
| Function Calls
|
+-----------+-----------+
| allium-cli |
| (Check, Format, etc) |
+-----------------------+
Located in extensions/allium/src/language-tools/, this is the heart of Allium. It is a pure TypeScript library with zero dependencies on editor APIs (like vscode).
- Input: Plain text (the Allium specification).
- Output: Plain data structures (finding lists, edit plans, markdown documentation).
- Features: Diagnostic logic, jump-to-definition resolution, workspace-wide rename planning, and automated refactoring logic.
Located in packages/allium-lsp/, this package provides an LSP-compliant wrapper around language-tools.
- Responsibility: It manages the JSON-RPC lifecycle, document synchronization, and multi-file workspace indexing.
- Protocol: Communicates over
stdiousing standard Language Server Protocol. - Extensibility: It exposes custom requests for features like diagram generation and rule simulation that go beyond the standard LSP.
Located in its own repo (juxt/tree-sitter-allium), this provides a high-performance incremental parser.
- Usage: Editors use Tree-sitter for fast syntax highlighting, code folding, smart indentation, and structural navigation (like "jumping to the next rule").
- Artifacts: Produces a native
.nodelibrary for Node.js and a.wasmfile for web/browser use.
- VS Code: A thin wrapper using
vscode-languageclientto launch the LSP server andtree-sitter-allium.wasmfor highlighting. - Neovim: Integrates via
nvim-lspconfigandnvim-treesitter. - Emacs: Integrates via
eglotorlsp-modeand built-intreesit.el(Emacs 29+).
Standalone command-line tools that consume language-tools directly. They are optimized for speed and machine-readable output (JSON/SARIF), making them ideal for CI/CD pipelines.
- User Edits: The editor sends the updated text to the LSP server.
- Analysis:
allium-lspcalls the appropriate function inlanguage-tools. - Diagnostics:
language-toolsreturns a list of findings, whichallium-lsptranslates into LSPpublishDiagnosticsnotifications. - Interactive Actions: When a user requests a rename or a refactor, the request flows through LSP to
language-tools, which returns aWorkspaceEditthat the editor then applies to the file system.