Skip to content

kryptobaseddev/ferrous-forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

143 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ”¨ Ferrous Forge

The Aggressive Rust Development Standards Enforcer Crates.io Documentation License CI

"Like a blacksmith forges iron into steel, Ferrous Forge shapes your Rust code into perfection." Ferrous Forge is an opinionated, aggressive Rust development standards enforcer. Unlike other tools that suggest fixes, Forge physically prevents non-compliant code from being committed, pushed, or published. Version: 1.7.6 | MSRV: 1.88 (Rust Edition 2024) | License: MIT OR Apache-2.0

🎯 Core Philosophy

  1. Preconfiguration β€” Professional-grade standards from project creation
  2. Locking β€” Critical settings are immutable without explicit justification
  3. Enforcement β€” Blocks git operations by default when checks fail
  4. Agent-Proof β€” Prevents LLM agents from "workaround-ing" standards
  5. Escape Hatches β€” Bypass available with mandatory audit logging

πŸš€ Quick Start

# Install from crates.io
cargo install ferrous-forge
# Initialize system-wide (one-time setup)
ferrous-forge init
# Create a new project with Forge standards
cargo new my-project
cd my-project
ferrous-forge init --project
# That's it! All your development now follows professional standards
git commit -m "feat: initial commit"  # Will be validated

✨ Features

πŸ”’ Configuration Locking

Lock critical settings to prevent accidental changes:

# Lock the Rust version
ferrous-forge config lock required_rust_version --reason="Team decision to stay on 1.88"
# Try to change it (blocked!)
# Editing Cargo.toml to change rust-version will fail validation
# Unlock with justification
ferrous-forge config unlock required_rust_version --reason="Security patch requires 1.89"
# View all locks
ferrous-forge config lock-status

πŸ›‘οΈ Safety Pipeline

Mandatory blocking hooks that prevent bad code:

# Install blocking hooks
ferrous-forge safety install
# Now git commit runs validation and blocks if failed
git commit -m "feat: add feature"  # Blocked if violations exist!
# Emergency bypass (requires reason)
ferrous-forge safety bypass --stage=pre-commit --reason="WIP commit, will fix later"
# View audit log
ferrous-forge safety audit

πŸ¦€ Rust Toolchain Management

Complete rustup integration:

# Check current version and available updates
ferrous-forge rust check
# List recent releases
ferrous-forge rust list
# Install specific toolchain
ferrous-forge rust install-toolchain nightly
# Switch default toolchain
ferrous-forge rust switch stable
# Update all toolchains
ferrous-forge rust update

πŸ“š Edition Management

Migrate between Rust editions:

# Check edition compliance
ferrous-forge edition check
# Analyze before migrating
ferrous-forge edition analyze
# Migrate to Edition 2024
ferrous-forge edition migrate

πŸ“‹ Project Templates

7 built-in templates with Forge standards pre-configured:

# List available templates
ferrous-forge template list
# Create from template
ferrous-forge template create my-cli --template=cli-app
ferrous-forge template create my-lib --template=library
ferrous-forge template create my-wasm --template=wasm
ferrous-forge template create my-embedded --template=embedded

🎯 CLI Reference

Core Commands

Command Description
ferrous-forge init [--project] Initialize system or project
ferrous-forge status Show installation status
ferrous-forge validate [path] Validate project against standards
ferrous-forge fix [path] Auto-fix code violations

Configuration Commands

Command Description
ferrous-forge config list Show all configuration
ferrous-forge config set key=value Set configuration value
ferrous-forge config lock <key> Lock a configuration value
ferrous-forge config unlock <key> Unlock a configuration value
ferrous-forge config lock-status Show lock status
ferrous-forge config lock-audit View lock audit log
ferrous-forge config export Export config for sharing
ferrous-forge config import Import shared config

Safety Pipeline Commands

Command Description
ferrous-forge safety status Check pipeline status
ferrous-forge safety install Install blocking git hooks
ferrous-forge safety uninstall Remove git hooks
ferrous-forge safety bypass Create emergency bypass
ferrous-forge safety audit View bypass audit log
ferrous-forge safety report View safety reports
ferrous-forge safety stats Display safety statistics

Rust Management Commands

Command Description
ferrous-forge rust check Check version and updates
ferrous-forge rust list List recent releases
ferrous-forge rust update Update toolchains
ferrous-forge rust install-toolchain <channel> Install toolchain
ferrous-forge rust switch <channel> Switch default toolchain

βš™οΈ Configuration

Ferrous Forge uses hierarchical configuration (System β†’ User β†’ Project):

# ~/.config/ferrous-forge/config.toml (User level)
[validation]
max_file_lines = 500
max_function_lines = 100
required_edition = "2024"
ban_underscore_bandaid = true

Configuration Hierarchy

  1. System (/etc/ferrous-forge/config.toml) β€” Organization-wide defaults
  2. User (~/.config/ferrous-forge/config.toml) β€” Personal preferences
  3. Project (./.ferrous-forge/config.toml) β€” Team-agreed standards Later levels override earlier levels. Project config has highest priority.

πŸ›‘οΈ What Gets Enforced

By Default (No Configuration Needed)

  • Edition 2024 β€” Latest Rust edition enforced
  • Zero Underscore Bandaid β€” No _unused parameters
  • No unwrap/expect β€” Proper error handling required
  • No panic/todo/unimplemented β€” Production-ready code
  • File size limits β€” 500 lines max per file
  • Function size limits β€” 100 lines max per function
  • Documentation β€” Public APIs require RustDoc
  • Clippy β€” All, pedantic, and nursery lints enabled

Git Hooks (Blocking)

When you run ferrous-forge safety install: Pre-commit hook:

  • βœ… Code formatting (cargo fmt)
  • βœ… Clippy validation
  • βœ… Ferrous Forge validation Pre-push hook:
  • βœ… All pre-commit checks
  • βœ… Test suite (cargo test)
  • βœ… Security audit (cargo audit) Both hooks:
  • Check for active bypasses before blocking
  • Provide clear error messages
  • Require explicit bypass with reason

πŸ“¦ Installation

From crates.io

cargo install ferrous-forge

Package Managers (Coming Soon)

# Homebrew (macOS/Linux)
brew install ferrous-forge
# Arch Linux (AUR)
yay -S ferrous-forge
# Nix
nix-env -iA ferrous-forge
# Windows (Chocolatey)
choco install ferrous-forge

πŸ”§ Project Setup

New Project

cargo new my-project
cd my-project
ferrous-forge init --project

This creates:

  • .ferrous-forge/config.toml β€” Project configuration
  • rustfmt.toml β€” Formatting rules
  • clippy.toml β€” Lint configuration
  • .git/hooks/pre-commit β€” Blocking pre-commit hook
  • .git/hooks/pre-push β€” Blocking pre-push hook
  • .vscode/settings.json β€” IDE integration
  • .github/workflows/ci.yml β€” CI/CD template

Existing Project

cd existing-project
ferrous-forge init --project
ferrous-forge fix  # Auto-fix what can be fixed

🚫 Banned Patterns

These will cause validation to fail:

// ❌ Underscore bandaid
fn bad_function(_unused: String) {}
// ❌ Ignored results
let _ = some_result;
// ❌ Unwrap in production
some_value.unwrap();
// ❌ Wrong edition
edition = "2021"  // Should be "2024"
// ❌ Too many lines
fn huge_function() {  // 100+ lines
    // ...
}

πŸ”’ Security

  • No unsafe code β€” Ferrous Forge itself is 100% safe Rust
  • Sandboxed execution β€” No elevated privileges required
  • Dependency scanning β€” Automatic vulnerability detection
  • Audit logging β€” All bypasses logged with timestamp and reason

πŸ“– Documentation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Configuration Layers            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ System β†’ User β†’ Project (merge order)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Safety Pipeline                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Pre-commit: Format β†’ Clippy β†’ Validate  β”‚
β”‚ Pre-push: Tests β†’ Audit β†’ Validate      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚
                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Toolchain Management             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Rustup integration, edition management  β”‚
β”‚ GitHub API for release tracking         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines. Priority Areas:

  1. Custom lint rules (Dylint integration)
  2. IDE plugins (IntelliJ, Vim)
  3. Documentation improvements
  4. Bug fixes

πŸ“„ License

Licensed under either of:

πŸŽ‰ My First Rust Crate!

Hey there, fellow Rustaceans! πŸ‘‹ This is my very first Rust crate. After months of teaching myself Rust, I've built something I hope you'll find useful. This tool was born from frustration with inconsistent code standards and LLM agents working around lint rules. I'm super excited to learn and grow with the Rust community! πŸ¦€βœ¨

πŸ’¬ Please, I Need Your Feedback!

  • πŸ€” Think this tool is useful? Please let me know!
  • πŸ˜… Think this is a stupid tool with no real need? Tell me that too!
  • πŸš€ Have ideas for improvements? I'm all ears! Thank you for taking the time to look at my work! πŸ™

Forge better Rust, automatically. πŸ”¨ ⭐ Star us on GitHub β€’ πŸ“¦ Install from Crates.io β€’ πŸ“– Read the Docs

About

System-wide Rust development standards enforcer - My first Rust crate! πŸ¦€

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors