Rust Foundry
Opinionated Rust bootstrapper for production-minded project setup.
foundry generates archetypes, applies layered config policy, and runs validation checks so new projects start with consistent defaults instead of ad-hoc scaffolding.
v0.1 Scope
- Archetypes:
web,tui,tooling - Interfaces:
foundry(CLI)foundry-tui(interactive)
- Commands:
plan,doctor,apply,explain - JSON contract: stable
api_version = "v1"
Desktop/Tauri archetypes are planned for v0.2.
Install
From crates.io (after publish):
From source:
Quick Start (CLI)
Plan files without writing:
Run environment and schema checks:
Generate project (gated by plan + doctor, unless --force):
Explain resolved policy and decision trace:
Quick Start (TUI)
The TUI prompts for:
- archetype
- project name (optional explicit override)
- template engine (
handlebars/mini_jinja) - profile
- post-generation checks toggle
Then it runs plan -> doctor -> apply.
Configuration
Config files:
foundry.toml(project policy)companion.toml(AI/user companion policy)
Optional user-level companion path:
FOUNDRY_COMPANION_PATH=/path/to/companion.toml
Profiles:
profiles/<profile>.toml
Precedence
Lowest to highest:
- built-in defaults
- profile defaults
- project
foundry.toml - companion config
- explicit CLI/TUI inputs
Example foundry.toml
= "my-service"
= "web"
= "mini_jinja"
= "default"
= true
Output Artifacts
apply writes:
- generated files (
README.md,Cargo.toml,src/main.rs) foundry.lock.json(resolved config + artifacts)audit.log(structured JSON: config, artifacts, decision_trace)
For identical inputs, foundry.lock.json and audit.log are deterministic.
JSON Envelope (--json)
All commands return:
api_versioncommandstatuserrors[]warnings[]artifacts[]checks[]resolved_configdecision_trace[]
Validation Model
doctorincludes executable capability checks and schema health checks.applypost-generation checks run where feasible:cargo fmt --checkcargo clippycargo check
Development
Run tests:
The project follows Trial Rite (TDD-first): tests first, then implementation.
License
MIT