Skip to content

feat: implement AI training ban and major CLI/Build pipeline overhaul#308

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:feat/add-ai.txt-policy-and-completely-overhaul-CLI-build-pipeline
Mar 27, 2026
Merged

feat: implement AI training ban and major CLI/Build pipeline overhaul#308
LunaStev merged 1 commit into
wavefnd:masterfrom
LunaStev:feat/add-ai.txt-policy-and-completely-overhaul-CLI-build-pipeline

Conversation

@LunaStev
Copy link
Copy Markdown
Member

This PR introduces a strict "No-AI-Training" policy across the repository and executes a foundational redesign of the wavec CLI and compilation pipeline. By moving to a structured BuildPlan architecture and adding professional-grade compiler flags, Wave is now a much more capable toolchain for systems-level development and CI/CD integration.


Key Changes

1. AI/ML Training Prohibition & Policy Enforcement

  • Explicit Policy: Added ai.txt to the repository root. This file explicitly prohibits the use of the codebase for crawling, scraping, pretraining, fine-tuning, or dataset construction without prior written permission.
  • File Headers: Applied the AI TRAINING NOTICE header across all source files, including .rs, .wave, .py, .sh, and Dockerfile, to ensure the policy is visible at the source level.

2. Professional CLI & Build System Redesign

The CLI has been completely refactored from an imperative argument loop to a structured BuildRequest and BuildPlan architecture:

  • Granular Output Control: Added the --emit=<kinds> flag. Supported outputs include ast, ir, bc, asm, obj, bin, and check.
  • Fast Validation: Introduced the check command (alias for build --emit=check) to perform rapid syntax and semantic validation without the overhead of code generation.
  • Advanced Linking & Compilation:
    • Added support for --shared, --static, --pie, --no-pie, and --freestanding.
    • Introduced low-level control with --entry, --linker-script, and --no-start-files.
  • Multi-Format Input: The compiler can now process non-Wave files via --input-type=<wave|ir|bc|asm|obj>, allowing wavec to act as a wrapper for linking LLVM IR or assembly files.
  • Introspection: Added the print command to query toolchain capabilities such as target-list, sysroot, cpu-list, and target-features.
  • Dry-Run & JSON Formatting: Added a --dry-run mode and supported --error-format=json for better integration with IDEs and automation tools.

3. LLVM Backend & Runner Enhancements

  • Model Configuration: Exposed code-model and relocation-model through the -C (Codegen) flags.
  • Modular Frontend: Refactored src/runner.rs to expose modular functions like frontend_prepare_wave_ast and emit_wave_ast_text. This allows the compiler to handle complex multi-step build plans more efficiently.
  • CI/CD Optimization: Updated CliError to return structured exit codes (1 for general, 2 for syntax/semantic, 3 for backend errors) to simplify pipeline logic.

Example Usage

Emitting LLVM IR and Assembly:

wavec build main.wave --emit=ir,asm

Rapid Semantic Checking:

wavec check main.wave

Linking with a custom linker script for a freestanding target:

wavec build kernel.wave --freestanding --linker-script link.ld --no-start-files

Querying supported targets:

wavec print target-list

Benefits

  • Legal Protection: Explicitly protects the project's intellectual property from unauthorized AI ingestion.
  • Toolchain Professionalism: The new --emit and linking flags bring wavec closer to the capabilities of clang or rustc.
  • Pipeline Flexibility: Structured exit codes and JSON error formats make it significantly easier to use Wave in automated environments.

This commit enforces a strict No-AI-Training policy across the entire repository and introduces a massive redesign of the `wavec` CLI and compilation pipeline.

[Details]

1. AI/ML Training Prohibition
  - Added `ai.txt` to explicitly disallow crawling, scraping, pretraining, fine-tuning, and dataset construction for AI models without prior written permission (includes multilingual notices).
  - Injected an `AI TRAINING NOTICE` header into almost all source files (`.rs`, `.wave`, `.py`, `.sh`, `Dockerfile`).

2. CLI & Build System Overhaul (`src/cli.rs`)
  - Replaced basic run/build logic with a highly configurable `BuildRequest` and `BuildPlan` architecture.
  - Introduced `--emit` flag targeting specific outputs: `ast`, `ir`, `bc`, `asm`, `obj`, `bin`, and `check`.
  - Added `check` command (alias for `--emit=check`) for rapid semantic validation.
  - Added advanced linking and compilation flags: `--shared`, `--static`, `--pie`, `--no-pie`, `--freestanding`, `--entry`, `--linker-script`, `--no-start-files`.
  - Added support for lowering and linking non-Wave inputs (IR, Bitcode, Assembly, Object files) using Clang as a backend tool via `--input-type`.
  - Added `--dry-run` execution mode with both Human and JSON (`--error-format=json`) output formats.
  - Added `print` command to query compiler details (e.g., `target-list`, `sysroot`).

3. LLVM Backend Enhancements
  - Plumbed `code_model` and `relocation_model` options through LLVM configuration flags (`-C code-model`, `-C relocation-model`).

4. Error Handling & Runner Refactoring
  - Updated `CliError` to return specific exit codes (1, 2, 3) depending on the error type.
  - Refactored `runner.rs` to expose modular AST/IR generation functions (`frontend_prepare_wave_ast`, `emit_wave_ast_text`, etc.) to support the new build plans.

Signed-off-by: LunaStev <luna@lunastev.org>
@LunaStev LunaStev merged commit c09fc31 into wavefnd:master Mar 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant