Skip to content

yonasBSD/engine.rs

Repository files navigation

engine.rs

engine.rs logo

Licenses Linting Testing Packaging Cross-Build

Security Audit Scorecard Audit Quality Gate Status Security Rating Vulnerabilities

GitHub last commit Dependency Status Rust GitHub Release License

engine.rs - Core Engine Generator


Core Engine Generator

This tool initializes a specialized, deep-hierarchy Rust workspace (12-level tree) designed for any Rust project.

It solves the "multiple workspace roots" collision by establishing a single source of truth at the features level while maintaining modularity across nested packages.

🛡 Cryptographic Integrity (BLAKE3)

Unlike standard scaffolders, this engine implements a Deep-Hash Manifest system:

Atomic Generation: Files are written with specific, compiler-ready boilerplate.

Manifesting: Every file's content is hashed using the BLAKE3 algorithm during creation.

Fail-Fast Verification: Before the process completes, the engine performs a second pass, reading every file from the disk to verify its hash against the manifest.

Zero-Tolerance: If a single byte is corrupted or a file fails to write, the engine triggers an immediate exit to prevent building on a broken foundation.

🏗 Directory Architecture

The generator builds the following structure to ensure the Rust compiler correctly recognizes nested modules across the filesystem:


engines/
└── yonasBSD/
    └── models/
        └── model-A/
            └── features/ [Workspace Root]
                ├── Cargo.toml
                └── feature-A/
                    └── packages/
                        ├── traits/
                        │   ├── Cargo.toml
                        │   └── src/ (lib.rs)
                        └── package-A/
                            ├── Cargo.toml
                            ├── mod.rs
                            ├── benches/
                            ├── examples/
                            ├── src/
                            ├── vendor/
                            ├── tests/
                            │   └── common/
                            ├── enums/
                            │   ├── mod.rs
                            │   └── tests/ (unit, integration)
                            ├── utils/
                            │   ├── mod.rs
                            │   └── tests/ (unit, integration)
                            ├── traits/
                            │   ├── mod.rs
                            │   └── tests/ (unit, integration)
                            └── core/
                                ├── mod.rs
                                ├── internal/
                                │   ├── mod.rs
                                │   └── tests/ (unit, integration)
                                ├── backends/
                                │   ├── mod.rs
                                │   └── tests/ (unit, integration)
                                └── frontends/
                                    ├── Cargo.toml
                                    ├── src/ (lib.rs)
                                    └── tests/ (unit, integration)

🚀 Getting Started

Prerequisites

  • Rust: 1.56+ (2021 Edition)

Execution

To generate the project structure:

cargo run --release

🛠 Workspace Logic

Unified Root

Cargo restricts workspaces to a single root. This structure bypasses nested workspace errors by:

  • Workspace Anchoring: The [workspace] definition is placed at the features level to allow deep nesting without root collisions.
  • Boilerplate Injection: Automatically populates mod.rs and lib.rs to ensure every level is reachable by the compiler via pub mod declarations.
  • Fail-Fast Verification: If any generated file does not match the hardcoded BLAKE3 hash, the build is flagged as compromised.

Module Wiring

The generator automatically populates mod.rs and lib.rs files to ensure every directory in the 12-level tree is reachable by the compiler. It adheres to a strict "one declaration per line" format for pub mod and use statements.

📝 Components Created

  • Traits Package: Defines the core ModelComponent trait.
  • Logic Tests: Pre-configured integration_logic.rs and structure.rs for immediate validation.
  • Support Trees: Comprehensive directory mapping for unit and integration tests across all sub-modules.

Note

Every generated directory includes a README.md anchor to ensure directory persistence across version control systems.

About

Engine-based scaffolding for Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages