Table of Contents
- CLI
CLI
Marketplace Commands
Search and Discovery
# Search for gpacks by keywords
ggen search <query>
# Examples:
ggen search rust cli
ggen search python api
ggen search typescript react
# Browse popular categories
ggen categories
# Get detailed gpack information
ggen show <gpack-id>
Installation and Management
# Install gpack (latest version)
ggen add <gpack-id>
# Install specific version
ggen add <gpack-id>@<version>
# Examples:
ggen add io.ggen.rust.cli-subcommand
ggen add io.ggen.rust.cli-subcommand@0.2.0
# List installed gpacks
ggen packs
# Update all gpacks to latest compatible versions
ggen update
# Update specific gpack
ggen update <gpack-id>
# Remove gpack
ggen remove <gpack-id>
Gpack Publishing (for authors)
# Initialize new gpack
ggen pack init
# Lint gpack for publishing
ggen pack lint
# Run tests
ggen pack test
# Publish to registry
ggen pack publish
AI Commands
ggen-ai v1.0.0 provides intelligent code generation using advanced LLMs with multi-provider support (OpenAI, Anthropic, Ollama, Gemini, Groq, Cohere).
AI Template Generation
# Generate templates from natural language descriptions
ggen ai generate <description> [--language LANG] [--framework FRAMEWORK] [--output FILE]
# Examples:
ggen ai generate "A Rust REST API controller for user management" --language rust --framework axum --output user_controller.tmpl
ggen ai generate "Python CLI tool for data processing" --language python --output data_tool.py.tmpl
ggen ai generate "React component for user profiles" --language typescript --framework react --output profile.tsx.tmpl
AI SPARQL Generation
# Generate SPARQL queries from natural language intent
ggen ai sparql <intent> [--graph FILE] [--output FILE] [--prefixes PREFIX=URI]
# Examples:
ggen ai sparql "Find all users with admin role" --graph data.ttl --output admin_query.sparql
ggen ai sparql "Get all properties of a resource" --graph ontology.ttl --output properties.sparql
AI RDF Graph Generation
# Generate RDF ontologies from domain descriptions
ggen ai graph <description> [--output FILE] [--format FORMAT]
# Examples:
ggen ai graph "Person management system with roles and permissions" --output person.ttl
ggen ai graph "E-commerce product catalog" --output catalog.ttl --format jsonld
AI Project Scaffolding
# Generate complete project structures
ggen ai project <description> --name NAME --language LANG [--framework FRAMEWORK] [--output DIR] [--tests] [--docs] [--ci]
# Examples:
ggen ai project "E-commerce API with authentication" --name shop-api --language rust --framework axum --tests --docs --output generated-shop-api/
ggen ai project "Python web application" --name webapp --language python --framework fastapi --output webapp/
AI Source File Analysis
# Generate templates from existing source files
ggen ai from-source <file> [--language LANG] [--output FILE] [--extract-variables] [--include-rdf]
# Examples:
ggen ai from-source src/main.rs --language rust --output main_template.tmpl
ggen ai from-source lib/utils.js --language javascript --extract-variables --output utils.tmpl
AI Model Management
# List available AI models and providers
ggen ai models
# Output shows supported models across all providers
AI Template Validation
# Validate templates with AI assistance
ggen ai validate <template> [--vars KEY=VALUE]
# Examples:
ggen ai validate templates/api.tmpl
ggen ai validate templates/cli.tmpl --vars name=hello
AI Demo
# Run the AI template demo
ggen ai demo
# Examples:
ggen ai demo --model qwen3-coder:30b
AI Frontmatter Generation
# Generate frontmatter for templates using AI
ggen ai frontmatter <template-file> [--description DESC] [--model MODEL]
# Examples:
ggen ai frontmatter api_controller.tmpl --description "REST API controller for user management"
ggen ai frontmatter data_processor.py.tmpl --model gpt-4o
Generation Commands
Template Generation
# Generate from gpack template
ggen gen <gpack-id>:<template-path> [--vars k=v ...] [--dry]
# Generate from local template
ggen gen <scope> <action> [--vars k=v ...] [--dry]
# Examples:
ggen gen io.ggen.rust.cli-subcommand:cli/subcommand/rust.tmpl name=hello
ggen gen cli subcommand --vars cmd=hello summary="Print greeting"
Template Discovery
# List available templates (local + gpacks)
ggen list
# Show template details
ggen show <template-ref> [--vars k=v ...]
# Examples:
ggen show io.ggen.rust.cli-subcommand:cli/subcommand/rust.tmpl
ggen show cli subcommand
Validation Commands
# Validate template frontmatter
ggen validate <template-ref> [--vars k=v ...]
# Lint template with schema validation
ggen lint <template-ref>
# Examples:
ggen validate io.ggen.rust.cli-subcommand:cli/subcommand/rust.tmpl
ggen lint cli subcommand
Utility Commands
# Export RDF graph
ggen graph export <template-ref> --fmt ttl|jsonld
# Generate hazard report
ggen hazard
# Generate shell completion scripts
ggen completion bash|zsh|fish
Variable Precedence
Variables are resolved in this order (later values override earlier):
- CLI arguments (
--var key=value
) - Environment variables (from
.env
files) - System environment (
$HOME
,$USER
, etc.) - Gpack variables (from gpack
ggen.toml
) - Template frontmatter (
vars:
section) - SPARQL variables (from queries)
Gpack Template Reference Syntax
When using gpack templates, use the format:
<gpack-id>:<template-path>
Examples:
io.ggen.rust.cli-subcommand:cli/subcommand/rust.tmpl
io.ggen.python.api:api/endpoint/fastapi.tmpl
io.ggen.typescript.react:components/button.tsx.tmpl
Dry-Run Mode
Preview template rendering without writing files:
ggen gen --template templates/api/endpoint/rust.tmpl --var name=User --dry
Dry-run behavior:
- RDF graphs are loaded (read-only)
- SPARQL queries execute normally
- Templates render completely
- Output shows what would be written
- No files are created or modified
- No shell commands execute (when implemented)
- No injections occur (when implemented)