CLI (raggiescript.exe), LSP, VS Code & Multi-Target SDKs
raggiescript.exe is a single zero-dependency static /MT Win32 C++20 executable compiled natively for both Windows 11 ARM64 and Windows 11 x64. It serves simultaneously as the compiler, type checker, formatter, JSON-RPC 2.0 Language Server, ES2022 transpiler, bytecode disassembler, runtime VM, and single-file .exe micro-app packager.
Command-Line Interface Reference (raggiescript.exe)
| Subcommand | Syntax | Exit Codes | Description |
|---|---|---|---|
check | raggiescript.exe check [--diagnostics=json] <file.rssc> [-DKEY=VAL] | 0 = Clean, 1 = Diagnostics, 2 = Bad CLI | Runs preprocessing, parsing, RSW701 phase isolation, RSW702 capability sandboxing, and RSW710–RSW715 gradual type checking without executing code. |
compile | raggiescript.exe compile <in.rssc> <out.rswbc> [-DKEY=VAL] | 0 = Emitted, 1 = Error | Compiles .rssc source into a compact, SHA-256-authenticated RSWBC2 linear stack bytecode binary. |
disasm | raggiescript.exe disasm <in.rssc | in.rswbc | packed.exe> | 0 = Printed, 1 = Tampered/Invalid | Disassembles .rssc source, .rswbc bytecode, or an embedded #225 resource inside a packed .exe into human-readable constant pools and stack opcodes. |
run | raggiescript.exe run <in.rssc | in.rswbc> [--silent] [/l=log.txt] [KEY=VAL] [KEY:VAL] | Script exit code (0, 3010, 1602, 1603, etc.) | Executes the full wizard -> install (or top-level micro-app) lifecycle with automatic .rsw-rollback.jnl protection. |
test | raggiescript.exe test [--json] <file.rssc | directory> | 0 = All passed, 1 = Failure | Discovers and executes top-level test "<Name>" { ... } unit-test blocks across a .rssc file or directory tree, reporting per-test millisecond timings in human or CI JSON format! |
fmt | raggiescript.exe fmt [--write | --check] <file.rssc> | 0 = Formatted/Clean, 1 = Needs formatting | Canonicalizes 4-space indentation, brace spacing, and operator alignment while preserving 100% of // and /* */ comments (fmt(fmt(x)) == fmt(x)). |
lsp | raggiescript.exe lsp | 0 on shutdown/exit | Starts the JSON-RPC 2.0 Language Server over stdin/stdout (Content-Length framed) for VS Code and LSP-compatible IDEs. |
transpile-es2022 | raggiescript.exe transpile-es2022 <in.rssc> <out.mjs> | 0 = Emitted, 1 = Capability/Type error | Compiles a sandboxed use training; script into a pure, zero-eval() ES2022 JavaScript module for SCORM 1.2 & 2004 web players. |
pack-exe | raggiescript.exe pack-exe <in.rssc> <out.exe> [--support-dir=DIR] [--uac=LEVEL] [--icon=ICO] | 0 = Packed, 1 = Error | Clones the native raggiescript.exe host, embeds LZMS-compressed RSWBC2 bytecode (#225) + RSWPAK1 payloads (#220), and stamps PE VERSIONINFO, .ico, and UAC manifest. |
init | raggiescript.exe init [installer | showcase | training | a11y | app] [out.rssc] | 0 = Created | Generates a heavily commented starter .rssc template for the chosen Studio profile. |
Soft Override (KEY=VAL) vs. IT Policy Hard-Lock (KEY:VAL)
Every param declared in a RaggieScript setup is automatically bindable from the command line without writing manual argv parsers:
# Soft Override ('='): sets initial default, but wizard UI or script logic may adjust it
Setup.exe /s installDir="D:\Apps\Workbench" createDesktopLink=false
# Hard IT Policy Lock (':'): locks the parameter immutably!
# Wizard controls bound to 'installDir' are disabled, and script reassignment fails with RSW713!
Setup.exe /s installDir:"C:\Program Files\LockedByEnterpriseIT\Workbench"
JSON Diagnostics Mode (--diagnostics=json)
CI pipelines, InstallerStudio.exe, and AI coding agents can pass --diagnostics=json to receive deterministic structured output:
raggiescript.exe check --diagnostics=json setup.rssc
{
"ok": false,
"file": "setup.rssc",
"diagnostics": [
{
"severity": "error",
"code": "RSW701",
"line": 18,
"column": 9,
"endColumn": 23,
"message": "Phase isolation violation: mutating call 'reg.writeString()' is forbidden inside 'wizard { ... }'."
}
]
}
JSON-RPC 2.0 Language Server (raggiescript.exe lsp)
The built-in LSP server implements the standard Language Server Protocol over stdio with zero Node.js runtime dependencies inside the server binary:
initialize/shutdown/exittextDocument/didOpen,textDocument/didChange,textDocument/didSave-> livetextDocument/publishDiagnostics(RSW700–RSW715)textDocument/completion-> context-aware dot-member IntelliSense across all 21 namespaces (fs.,msi.,ui.,sys., userstructfields, andenumvariants)textDocument/hover-> Markdown signature cards, parameter counts, return types, and[Mutating]/[Read-Only]safety annotationstextDocument/definition-> jump-to-definition for userfn,struct,enum, andparamsymbolstextDocument/formatting-> comment-preserving whole-document formatting
Embedding the C++20 & .NET SDKs
Native Static /MT C++20 Umbrella Header (RaggieScriptSdk.hpp)
#include <raggiescript/RaggieScriptSdk.hpp>
rsw::rssc::ScriptProgram prog;
std::vector<rsw::rssc::ScriptDiagnostic> diags;
if (rsw::rssc::CompileRaggieScriptFile(L"setup.rssc", prog, diags)) {
rsw::rssc::VmExecutionOptions opts{};
opts.silentMode = true;
rsw::rssc::RaggieScriptVm vm(prog, opts);
const auto result = vm.ExecuteFullLifecycle();
}
Two-Way Managed .NET Host SDK (RaggieScript.Core v1.3)
RaggieSoft.RaggieScript.Core (Y:\desktop-apps\raggiescript\dotnet\src\RaggieScript.Core\) is a zero-dependency managed C# compiler, static type/capability binder (RSW700–RSW715), two-way .NET runtime, StoreScript & Story Crossroads host engine, and ES2022 transpiler built for .NET desktop, CLI, and server applications (powering Accessibility Studio, Training Studio, Localization Studio, Document Studio, Launcher, Book Reader, and StoreTrainer).
1. Two-Way Host Interop Surface (RsscHostEnvironment & RsscManagedRuntime)
.NET Type / Member | Direction | Description |
|---|---|---|
RsscHostEnvironment.RegisterFunction(ns, name, Delegate, isMutating?, requiredCapability?) | .NET -> .rssc | Exposes any synchronous (Func<...>, Action<...>) or asynchronous (Func<..., Task<T>>, ValueTask<T>) C# delegate under ns.name(...), automatically injecting CancellationToken parameters and enforcing RSW701 (isMutating), RSW702 (requiredCapability), and RSW712 (arity) at compile time! |
RsscHostEnvironment.RegisterGlobalFunction(name, Delegate, isMutating?) | .NET -> .rssc | Exposes a top-level C# delegate callable directly without a namespace prefix (toSlug("...")). |
RsscHostEnvironment.RegisterService(instance, namespaceOverride?, requiredCapability?) | .NET -> .rssc | Reflects an allowlisted C# service decorated with [RsscHostObject("ns")] and binds both camelCase and PascalCase methods while never exposing System.Object.GetType(). |
RsscHostEnvironment.ExposeObject(name, instance, readOnly = true) | Two-Way | Exposes an allowlisted C# POCO, record, or scalar as a global variable in .rssc. Setting readOnly: false allows scripts to mutate properties (profile.title = "...") and invoke instance methods (profile.addTag("...")) directly on the live .NET object! |
[RsscHostObject(ns, RequiredCapability)], [RsscFunction(name, Mutating)], [RsscIgnore] | Metadata | Declarative C# attributes controlling namespace naming, RSW701 wizard-mutation blocking, and property/method hiding ([RsscIgnore]). |
RsscManagedRuntime.Invoke<T>(fnName, params args) | .rssc -> .NET | Calls a RaggieScript fn synchronously, marshaling C# POCOs/records in and hydrating the returned RaggieScript struct/map into T (including C# record primary constructors, Version, enums, arrays, and List<T>!). |
RsscManagedRuntime.InvokeAsync<T>(fnName, cancellationToken, params args) | .rssc -> .NET | Awaits RaggieScript functions that call async Task<T> C# host delegates without blocking the UI thread. |
RsscManagedRuntime.BindDelegate<TDelegate>(fnOrClosureName) | .rssc -> .NET | Compiles any RaggieScript fn or => closure into a native strongly-typed C# Func<...> / Action<...> delegate via LINQ Expression Trees! |
RsscExecutionOptions (MaxSteps, Timeout, CancellationToken, Defines) | Safety | Bounds AST statement execution (MaxSteps = 250_000 default -> throws RsscExecutionLimitException on runaway while (true) loops), wall-clock timeouts, and cooperative cancellation. |
RsscManagedRuntime.RunTests() | Test Runner | Executes all top-level test "..." { ... } blocks and returns IReadOnlyList<RsscTestResult> (Name, Passed, DurationMs, ErrorMessage). |
RsscManagedRuntime.StoreScript & Crossroads | Consumer Sandboxes | Direct C# host access to RsscStoreScriptEngine (LoadBuffer, GetBuffer, JsonDocumentText) for StoreTrainer and RsscCrossroadsEngine (OfferedOptions, Flags, Stats) for Book Reader. |
RsscEs2022Transpiler.TryTranspile(program, out string mjs, out string err) | .rssc -> ES2022 | Pure-C# in-process transpiler emitting CSP-safe, zero-eval() ES2022 JavaScript modules for SCORM 1.2/2004 courses and Story Crossroads web scenes. |
2. Complete Two-Way C# <-> RaggieScript Example
using RaggieSoft.RaggieScript;
// 1. Decorate a C# service or POCO — [RsscIgnore] hides internal secrets,
// and System.Object.GetType() is NEVER exposed to untrusted scripts!
[RsscHostObject("storetrainer", RequiredCapability = "storetrainer")]
public sealed class StoreTrainerScriptService
{
[RsscFunction("clampSlots")]
public int ClampSlots(int requested) => Math.Clamp(requested, 1, 10);
[RsscFunction("saveAuditAsync", Mutating = true)] // Blocked inside wizard {} via RSW701!
public async Task<string> SaveAuditAsync(string title, CancellationToken ct)
{
await Task.Delay(5, ct);
return $"saved:{title}";
}
[RsscIgnore]
public string InternalSigningSecret => "never-visible-to-scripts";
}
public sealed record AuditSummary(string Title, int Slots, Version EngineVersion);
// 2. Register C# services, async delegates, and live POCOs on RsscHostEnvironment:
var host = new RsscHostEnvironment()
.RegisterService(new StoreTrainerScriptService())
.RegisterGlobalFunction("toSlug", (string s) => s.Trim().ToLowerInvariant().Replace(' ', '-'));
const string rsscSource = """
use storetrainer;
const isPassing = (score: int) => score >= 80;
fn upgradeProfile(name: string, requestedSlots: int): map {
const clamped = storetrainer.clampSlots(requestedSlots);
storetrainer.saveAuditAsync(toSlug(name));
return { title: name, slots: clamped, engineVersion: v"1.1.0.0" };
}
""";
// 3. Compile with full host-aware RSW701/RSW702/RSW712 static verification:
if (RsscCompiler.Compile(rsscSource, out var program, out var diagnostics, host))
{
var options = new RsscExecutionOptions { MaxSteps = 100_000, Timeout = TimeSpan.FromSeconds(2) };
var runtime = new RsscManagedRuntime(program, host, options);
// Await async C# delegates & hydrate RaggieScript map/struct straight into a C# record!
AuditSummary? summary = await runtime.InvokeAsync<AuditSummary>(
"upgradeProfile", cancellationToken, "Cedar Run Collector Profile", 50);
// Or bind a RaggieScript '=>' closure directly as a native C# Func<int, bool>!
Func<int, bool> checkScore = runtime.BindDelegate<Func<int, bool>>("isPassing");
bool passed = checkScore(92); // true
}
raggiescript.exe checkCLI
raggiescript.exe compileCLI
raggiescript.exe disasmCLI
raggiescript.exe runCLI
raggiescript.exe fmtCLI
raggiescript.exe lspCLI
raggiescript.exe transpile-es2022CLI
raggiescript.exe pack-exeCLI
raggiescript.exe initCLI
RsscHostEnvironment (.NET).NET Class
RsscHostEnvironment.RegisterFunction.NET Method
RsscHostEnvironment.RegisterService.NET Method
RsscHostEnvironment.ExposeObject.NET Method
[RsscHostObject] / [RsscFunction] / [RsscIgnore].NET Attr
RsscManagedRuntime.Invoke<T>.NET Method
RsscManagedRuntime.InvokeAsync<T>.NET Async
RsscManagedRuntime.BindDelegate<TDelegate>.NET Method
RsscExecutionOptions (MaxSteps / Timeout / CancellationToken).NET Safety
RsscEs2022Transpiler.TryTranspile.NET Method
raggiescript.exe testCLI