| Crates.io | rgen-tool |
| lib.rs | rgen-tool |
| version | 0.1.0 |
| created_at | 2025-10-09 05:40:37.909452+00 |
| updated_at | 2025-10-09 05:40:37.909452+00 |
| description | rgen is a deterministic, language-agnostic code generation framework that treats software artifacts as projections of knowledge graphs. |
| homepage | https://github.com/seanchatmangpt/rgen |
| repository | https://github.com/seanchatmangpt/rgen |
| max_upload_size | |
| id | 1875113 |
| size | 1,725,587 |
Table of Contents
Language-agnostic generator for reproducible code projections.
rgen turns one ontology into CLI subcommands, APIs, schema files, and docs for any target language.
Developers repeat the same scaffolding logic across stacks. rgen removes the language barrier.
You describe the intent (command, type, or system capability) once as a graph or RDF-like metadata block.
rgen projects that intent into any target framework or language.
brew tap rgen-dev/tap
brew install rgen
rgen --version
cargo install rgen
Goal: generate a new CLI subcommand for any language.
# Search for CLI subcommand templates
rgen search rust cli
# Install a high-quality rpack
rgen add io.rgen.rust.cli-subcommand
# Generate using the installed rpack
rgen gen io.rgen.rust.cli-subcommand:cli/subcommand/rust.tmpl name=hello description="Print a greeting"
rgen gen cli subcommand --vars cmd=hello summary="Print a greeting"
Output depends on your template set (Rust, Python, Bash, etc). Each output is produced deterministically from the same RDF description.
The rgen marketplace provides a curated ecosystem of reusable code generation packs (rpacks) served directly from the GitHub repository. Discover, install, and use high-quality templates from the community.
Marketplace Source: seanchatmangpt/rgen
Registry URL: https://raw.githubusercontent.com/seanchatmangpt/rgen/master/registry/
Configuration: Set RGEN_REGISTRY_URL environment variable to override the default URL
# Search for templates by language and type
rgen search rust cli
rgen search python api
rgen search typescript react
# Browse popular categories
rgen categories
# Get detailed information about a specific rpack
rgen show io.rgen.rust.cli-subcommand
# Install the latest version
rgen add io.rgen.rust.cli-subcommand
# Install specific version
rgen add io.rgen.rust.cli-subcommand@0.2.0
# List installed rpacks
rgen packs
# Update to latest versions
rgen update
# Use installed rpack templates
rgen gen io.rgen.rust.cli-subcommand:cli/subcommand/rust.tmpl name=Users
Rpacks include templates, RDF schemas, SPARQL queries, and dependencies. They're versioned, tested, and maintained by the community.
Templates are self-contained in their directories with local RDF graphs:
templates/
cli/
subcommand/
rust.tmpl # Template file
graphs/ # Local RDF data
cli.ttl
shapes/
cli.shacl.ttl
Each .tmpl has a YAML frontmatter header that describes:
to: β where to write the filevars: β default variablesrdf: β RDF files (relative to template directory)shape: β SHACL shape files for validationsparql: β queries to extract variables from graph datadeterminism: β optional seed for reproducibilitytemplates/cli/subcommand/rust.tmpl---
to: src/cmds/{{ cmd }}.rs
vars:
cmd: "hello"
summary: "Print a greeting"
rdf:
- "graphs/cli.ttl"
shape:
- "graphs/shapes/cli.shacl.ttl"
sparql:
- "SELECT ?cmd ?summary WHERE { ?cmd rdfs:label ?summary }"
determinism:
seed: "cli-subcommand"
sort_order: ["cmd", "summary"]
---
use clap::Args;
use utils::error::Result;
#[derive(Args, Debug)]
pub struct {{ cmd|title }}Args {
/// {{ summary }}
#[arg(value_name = "INPUT")]
pub input: Option<String>,
}
pub async fn run(args: &{{ cmd|title }}Args) -> Result<()> {
println!("{{ summary }}");
Ok(())
}
Same RDF + seed β identical files every run.
| Command | Description |
|---|---|
| Marketplace | |
rgen search <query> |
Search for rpacks in registry |
rgen categories |
Show popular categories and keywords |
rgen add <rpack> |
Install an rpack to the project |
rgen remove <rpack> |
Remove an rpack from the project |
rgen packs |
List installed rpacks |
rgen update [rpack] |
Update rpacks to latest versions |
| Generation | |
rgen gen <template> |
Generate code from templates |
rgen list |
List available template scopes and actions |
rgen show <template> |
Show template and resolved context |
| Validation | |
rgen validate <template> |
Validate RDF/SHACL graphs |
rgen lint <template> |
Lint template with schema validation |
| Utilities | |
rgen graph export |
Merge RDF sources into a single graph |
rgen hazard |
Generate hazard report |
rgen completion <shell> |
Generate shell completion scripts |
rgen computes a manifest hash over:
graph data + shape + frontmatter + template + seed
The same graph + seed = byte-identical results.
# Install multi-language CLI rpacks
rgen add io.rgen.rust.cli-subcommand
rgen add io.rgen.python.cli-subcommand
rgen add io.rgen.bash.cli-subcommand
# Generate for each language
rgen gen io.rgen.rust.cli-subcommand:cli/subcommand/rust.tmpl name=status description="Show app status"
rgen gen io.rgen.python.cli-subcommand:cli/subcommand/python.tmpl name=status description="Show app status"
rgen gen io.rgen.bash.cli-subcommand:cli/subcommand/bash.tmpl name=status description="Show app status"
rgen gen cli subcommand --vars cmd=status summary="Show app status"
Both approaches create:
src/cmds/status.rs
commands/status.py
commands/status.sh
All derived from one ontology. No duplicated logic, no language bias.
rgen doesnβt care about runtime:
Add your own generator:
mkdir -p templates/api/endpoint
cp templates/cli/subcommand/rust.tmpl templates/api/endpoint/rust.tmpl
Edit frontmatter and target path. rgen will detect and render automatically.
Share your templates with the community:
# Initialize new rpack
rgen pack init
# Lint and test your rpack
rgen pack lint
rgen pack test
# Publish to registry
rgen pack publish
Rpacks support versioning, dependencies, and comprehensive testing. See the marketplace documentation for details.
MIT Β© rgen contributors
rgen β one intent, many projections. Code is just a projection of knowledge.