Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

rust-template

Production-ready Rust workspace template engineered for both human maintainers and AI coding agents, enforcing the Google Rust Style Guide and automated structural hygiene gates out of the box.

Key Capabilities

  • Strictly flat, small-crate workspace: Splits reusable library logic (crates/rust-template) from the binary entrypoint (crates/rust-template-cli). Every crate keeps its .rs sources in a flat src/ directory (< 20 KB per file for single-call agent reads) with externalized tests.rs unit tests.
  • Google Rust Style Guide enforcement: Combines workspace rustc/clippy lints (Cargo.toml, clippy.toml), formatting rules (rustfmt.toml), and pure-Rust structural and workflow test suites (crates/rust-template/tests/hygiene.rs and crates/rust-template/tests/workflow.rs).
  • First-class AI agent customization: Ships canonical routing in AGENTS.md, persistent architectural memory in .ai/memory/README.md, scoped file instructions in .github/instructions/, workflow skills in .github/skills/, specialist agents in .github/agents/, slash prompts in .github/prompts/, and deterministic lifecycle hooks in .github/hooks/guardrails.json.
  • Zero-dependency starter & fast offline gate: Builds and tests in under two seconds using only std, with cross-platform verification, package consumer validation, stripped production artifact packaging, and bootstrap scripts in scripts/ (.sh and .ps1).

Quick Start

1. Bootstrap a New Project

Rename the workspace crates, binary, repository metadata, and documentation in one command:

# Preview changes without modifying files
bash ./scripts/init-project.sh my-project --org my-org --dry-run

# Apply rename and run the verification gate
bash ./scripts/init-project.sh my-project --org my-org

On Windows PowerShell:

pwsh -NoProfile -File ./scripts/init-project.ps1 -Name my-project -Org my-org

2. Library Usage

use rust_template::{Config, Engine, Limit, OutputMode};

fn main() -> rust_template::Result<()> {
    let limit = Limit::try_new(10)?;
    let config = Config::new()
        .output_mode(OutputMode::Detailed)
        .max_items(limit)
        .prefix("item");

    let engine = Engine::new(config);
    let report = engine.process(["alpha", "beta"])?;
    assert_eq!(report.len(), 2);
    println!("{}", report.render());
    Ok(())
}

3. CLI Usage

cargo run -p rust-template-cli -- --mode detailed --limit 5 --prefix item alpha beta

Verification and Consolidation Gate

Run the full verification gate before every commit:

bash ./scripts/check.sh
# or on PowerShell:
pwsh -NoProfile -File ./scripts/check.ps1

Run the read-only codebase health survey at any time:

bash ./.github/skills/codebase-consolidation/survey.sh

License

Dual-licensed under MIT OR Apache-2.0 (LICENSE-MIT and LICENSE-APACHE).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages