@unrdf/cli
v26.5.5
Published
UNRDF CLI - Command-line Tools for Graph Operations and Context Management
Maintainers
Readme
@unrdf/cli
RDF ontology to code generation. Transform your RDF knowledge graphs into typed code artifacts—Zod schemas, OpenAPI specs, JSDoc types, GraphQL schemas—using SPARQL queries and Nunjucks templates.
Version: [VERSION] | Node.js: >=[VERSION]
Installation
Global Install (recommended for CLI usage)
# Using pnpm (recommended)
pnpm add -g @unrdf/cli
# Using npm
npm install -g @unrdf/cliVerify installation:
unrdf --version
# Output: [VERSION]Quick Start (5 Minutes)
- Initialize Project
unrdf sync init- Run Generation
unrdf sync --config unrdf.tomlFor a detailed walkthrough, see Getting Started Guide.
Key Features
🚀 RDF-Driven Generation
Query your ontology with SPARQL and use the results directly in Nunjucks templates. Access URI local names, namespaces, and datatypes automatically.
🧩 Hygen Parity
Full support for Hygen-style frontmatter directives for surgical file modifications:
inject: Enable line-based modification.before/after: Inject content relative to string or regex anchors.at_line: Insert at specific line numbers.skip_if: Prevent duplication with regex-based existence checks.chmod: Set file permissions (e.g.,755for scripts).sh: Run post-generation shell commands.
🔄 Smart Injection
Automatic detection of per-row vs. summary rendering. Use inject: true to automatically iterate over SPARQL results and update a single file (like an index.ts registry).
CLI Usage
Sync (Project-wide Generation)
unrdf sync # Run all rules in unrdf.toml
unrdf sync --watch # Regenerate on ontology changes
unrdf sync --dry-run # Preview changes without writingTemplate (Ad-hoc Generation)
unrdf template generate data.ttl --template service.njk --batch --class-uri owl:ClassWASM Runtimes (AtomVM)
unrdf atomvm doctor # Check for erlc and packbeam dependencies
unrdf atomvm build <mod> # Compile .erl to .avm bytecode
unrdf atomvm execute <avm> # Run bytecode on WASM runtimeDiagnostics
unrdf doctor # Health check and auto-fixDocumentation
- Getting Started: 5-minute quickstart.
- Sync Command Guide: Configuration reference for
unrdf.toml. - Template Command Reference: Full list of directives and Nunjucks filters.
- Migration Guide: Upgrading from v5 and adopting from other engines.
- API Reference: Stable JSON schemas and configuration specifications.
- Doctor Command: Diagnostic and health checks.
- Examples: Complete pipeline and configuration examples.
API Stability
UNRDF is committed to stable interfaces for automated workflows:
- Versioned JSON: All machine-readable outputs include a
versionfield for compatibility tracking. - Schema Consistency: The
unrdf.tomlschema follows Semantic Versioning; no breaking changes in minor/patch releases. - Backward Compatibility: v6 fully supports legacy
ggen.tomlconfigurations.
