Skip to content

Nehonix-Team/xru

Repository files navigation

XRU: XyPriss Rule Unit

XRU is a Domain-Specific Language (DSL) designed for Structured Text Transformation. It operates as a Structured Text Patcher (STP), preserving formatting, comments, and non-standard syntaxes while applying complex mutations.


Quick Install

Linux / macOS

curl -sL https://raw.githubusercontent.com/Nehonix-Team/xru/master/install.sh | bash

Windows (PowerShell)

irm https://raw.githubusercontent.com/Nehonix-Team/xru/master/install.ps1 | iex

Key Features

  • Structured Patching: Precise manipulation of JSON, YAML, and source code while preserving formatting.
  • Inception Mode: Execute nested XRU logic (#FOR, #IF) directly within template blocks.
  • Universal Injection: Support for @TSINJECT, @GOINJECT, etc., with automatic language detection.
  • Recursive Orchestration: Nested action execution across file-targeting blocks.
  • Strict Scoping: Isolated execution environments for templates and loops.

Documentation

The documentation is modularized for better maintainability:

  1. Syntax Overview: General rules and log colorization.
  2. Directives: Scoping (#BEGIN, #SELECT) and Utility (#LOG, #EXEC) directives.
  3. Actions: Patching operations, symbols (++, >>), and code injections.
  4. Variables: Scoping rules, declarations, and interpolation.
  5. CLI Usage: Command line options and examples.

Usage Example

Create a file named patch.xru:

let app = "MyProject"

#SELECT: ./src
#LOG: "<cyan>[INFO]</> Patching {app}..."

#BEGIN: config.json
  SET version "1.0.0"
  MERGE metadata {
    "author": "XyPriss"
  }
#END

#LOG: "<green>[SUCCESS]</> Done."

Apply it:

xru patch.xru .

CLI Commands

  • xru build <file.xru>: Transpile an XRU script into standalone .sh (Unix) and .ps1 (Windows) scripts.
  • xru run <file.xru> [target]: Execute rules on a target directory.

VS Code Support

For syntax highlighting, install the XRU extension. To build and install it locally:

  1. Navigate to the extension directory: cd pkg/ext/vscode
  2. Ensure you have XFPM installed.
  3. Run the build command:
    xfpm run build:ext

The XRU engine supports both direct execution and standalone compilation into native shell scripts.


License

MIT © Nehonix-Team

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors