Forge is a Lua-powered project scaffolder.
It runs templates from local (.forge/templates/), global (~/.forge/templates/), or package (~/.forge/packages/) directories, renders files, prompts for inputs, and can run controlled command workflows.
- Scaffold projects with Lua templates
- Render templated files (
{{ expr }}) and literal escaped blocks (%{{...}}%) - Template trust model with checksum invalidation
- Fine-grained execution controls:
- raw execution:
forge.exec(execution+commands) - curated execution:
forge.prog.*(programs)
- raw execution:
- Config support (
~/.forge/config.toml) including[user]defaults for template creation and[templates]default scope - Template validation before execution
cargo install --path .Or run directly in this repo:
cargo run -- <command>forge list
forge list --local
forge list --globalforge new rust my-appUse defaults for all prompts:
forge new rust my-app --defaultforge info rust
forge check rustforge new <template> <name> [--local|--global] [--default]
forge list [--local|--global]
forge info <template> [--local|--global]
forge create <name> [--local|--global]
forge remove <template>... [--local|--global]
forge check <template> [--local|--global]forge trust add <template> [--local|--global]
forge trust remove <template> [--local|--global]
forge trust listforge package probe <repo>
forge package install <repo> <template>...
forge package remove [template]...
forge package update [template]...
forge package listforge config set user.name "Alice"
forge config set user.email "alice@example.com"
forge config set templates.default_scope global
forge config get user.name
forge config list
forge config edittemplates.default_scope accepts local or global. Unscoped template commands
try that scope first and then package-installed templates. forge list shows
local, global, and package-installed templates unless filtered with --local or
--global.
Templates can declare requirements in manifest.toml:
[requires]
commands = ["git", "npm"]
programs = ["git"]
permissions = ["execution", "escape_cwd", "network", "read_env"]commands: allowlist for rawforge.execprograms: allowlist for curatedforge.prog.*APIspermissions: elevated capability flags
When a template requests elevated capabilities and is not trusted, Forge shows a summary and prompts:
y: trust and persist checksum in~/.forge/trust.jsonn: run once (no trust persisted)q: abort
If template contents change later, trust is invalidated automatically.
Template layout:
.forge/templates/<name>/
manifest.toml
main.lua
files/
Remote template package repositories use the same template entries in a root
index.json file:
{
"version": 1,
"templates": [
{ "name": "rust", "path": "templates/rust" }
]
}.tplfiles infiles/are rendered and.tplis stripped- non-
.tplfiles are copied as-is - expression interpolation in
.tpl:{{ forge.project.name }}%{{github.ref_name}}%to emit literal{{github.ref_name}}
Curated program API example:
forge.prog.git.init()
forge.prog.git.add("-A")
forge.prog.git.commit("chore: initial scaffold")Stdlib helpers exposed on forge:
forge.str.*:upper,lower,snake,kebab,pascal,camel,trim,split,starts_with,ends_with,joinforge.table.*:merge,deep_merge,contains,keys,map,filterforge.path.*:join,basename,stem,ext
For detailed API and manifest docs:
docs/lua/index.mddocs/manifests.md
See project license files/repo policy.