RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
7 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_CLI_SDK (0x2002)

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)

SubcommandSyntaxExit CodesDescription
checkraggiescript.exe check [--diagnostics=json] <file.rssc> [-DKEY=VAL]0 = Clean, 1 = Diagnostics, 2 = Bad CLIRuns preprocessing, parsing, RSW701 phase isolation, RSW702 capability sandboxing, and RSW710–RSW715 gradual type checking without executing code.
compileraggiescript.exe compile <in.rssc> <out.rswbc> [-DKEY=VAL]0 = Emitted, 1 = ErrorCompiles .rssc source into a compact, SHA-256-authenticated RSWBC2 linear stack bytecode binary.
disasmraggiescript.exe disasm <in.rssc | in.rswbc | packed.exe>0 = Printed, 1 = Tampered/InvalidDisassembles .rssc source, .rswbc bytecode, or an embedded #225 resource inside a packed .exe into human-readable constant pools and stack opcodes.
runraggiescript.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.
testraggiescript.exe test [--json] <file.rssc | directory>0 = All passed, 1 = FailureDiscovers 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!
fmtraggiescript.exe fmt [--write | --check] <file.rssc>0 = Formatted/Clean, 1 = Needs formattingCanonicalizes 4-space indentation, brace spacing, and operator alignment while preserving 100% of // and /* */ comments (fmt(fmt(x)) == fmt(x)).
lspraggiescript.exe lsp0 on shutdown/exitStarts the JSON-RPC 2.0 Language Server over stdin/stdout (Content-Length framed) for VS Code and LSP-compatible IDEs.
transpile-es2022raggiescript.exe transpile-es2022 <in.rssc> <out.mjs>0 = Emitted, 1 = Capability/Type errorCompiles a sandboxed use training; script into a pure, zero-eval() ES2022 JavaScript module for SCORM 1.2 & 2004 web players.
pack-exeraggiescript.exe pack-exe <in.rssc> <out.exe> [--support-dir=DIR] [--uac=LEVEL] [--icon=ICO]0 = Packed, 1 = ErrorClones the native raggiescript.exe host, embeds LZMS-compressed RSWBC2 bytecode (#225) + RSWPAK1 payloads (#220), and stamps PE VERSIONINFO, .ico, and UAC manifest.
initraggiescript.exe init [installer | showcase | training | a11y | app] [out.rssc]0 = CreatedGenerates 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:

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 / MemberDirectionDescription
RsscHostEnvironment.RegisterFunction(ns, name, Delegate, isMutating?, requiredCapability?).NET -> .rsscExposes 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 -> .rsscExposes a top-level C# delegate callable directly without a namespace prefix (toSlug("...")).
RsscHostEnvironment.RegisterService(instance, namespaceOverride?, requiredCapability?).NET -> .rsscReflects 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-WayExposes 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]MetadataDeclarative C# attributes controlling namespace naming, RSW701 wizard-mutation blocking, and property/method hiding ([RsscIgnore]).
RsscManagedRuntime.Invoke<T>(fnName, params args).rssc -> .NETCalls 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 -> .NETAwaits RaggieScript functions that call async Task<T> C# host delegates without blocking the UI thread.
RsscManagedRuntime.BindDelegate<TDelegate>(fnOrClosureName).rssc -> .NETCompiles any RaggieScript fn or => closure into a native strongly-typed C# Func<...> / Action<...> delegate via LINQ Expression Trees!
RsscExecutionOptions (MaxSteps, Timeout, CancellationToken, Defines)SafetyBounds AST statement execution (MaxSteps = 250_000 default -> throws RsscExecutionLimitException on runaway while (true) loops), wall-clock timeouts, and cooperative cancellation.
RsscManagedRuntime.RunTests()Test RunnerExecutes all top-level test "..." { ... } blocks and returns IReadOnlyList<RsscTestResult> (Name, Passed, DurationMs, ErrorMessage).
RsscManagedRuntime.StoreScript & CrossroadsConsumer SandboxesDirect 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 -> ES2022Pure-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
}
Indexed API Calls & Symbols on This Page (20):