Ranvier.Build 0.2.2

dotnet add package Ranvier.Build --version 0.2.2
                    
NuGet\Install-Package Ranvier.Build -Version 0.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ranvier.Build" Version="0.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ranvier.Build" Version="0.2.2" />
                    
Directory.Packages.props
<PackageReference Include="Ranvier.Build" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ranvier.Build --version 0.2.2
                    
#r "nuget: Ranvier.Build, 0.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ranvier.Build@0.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ranvier.Build&version=0.2.2
                    
Install as a Cake Addin
#tool nuget:?package=Ranvier.Build&version=0.2.2
                    
Install as a Cake Tool

Ranvier.Build

Reflection-free, NativeAOT-compatible CLI authoring, incremental build orchestration, isolated subprocess execution, and persistent file caching on net10.0.

Quickstart

open Ranvier.Build

let configOpt =
    Opt.choicesIgnoreCase "--configuration" [ "Release", "Release"; "Debug", "Debug" ]
    |> Opt.alias "-c"
    |> Opt.def "Release"
    |> Opt.description "Build configuration"

let stampRule =
    produceFirewall "git-describe" Ranvier.Dag.Hasher.string {
        return! cmd $"git describe --always --dirty" |> Proc.text
    }

let buildStage =
    stage "build" {
        let! cfg = configOpt
        and! stamp = stampRule
        captureOutput
        cmd $"dotnet build -c {cfg} -p:InformationalVersion={stamp}"
    }
    |> Stage.cacheByFiles
        "build-lib"
        { Root = "."
          Include = [ "src/**/*.fs"; "src/**/*.fsproj" ]
          Exclude = [ "**/obj/**"; "**/bin/**" ] }

[<EntryPoint>]
let main argv =
    runCli argv {
        cliName "build"
        command "ci" { buildStage }
    }

Core Capabilities

1. Unified CLI Inputs (Input<'T>, Opt<'T>, Arg<'T>)

Opt<'T> and Arg<'T> inherit from Input<'T> with monomorphic constructors that compile cleanly under fsc --reflectionfree:

Constructor family Purpose
Opt.flag, Opt.string, Opt.stringOption, Opt.int, Opt.int64, Opt.float Typed scalar options hashed into Ranvier.Dag.Snapshot
Opt.file, Opt.dir, Opt.strings Path options and multi-value string lists
Opt.choices, Opt.choicesIgnoreCase, Opt.manyChoices, Opt.parse Validated enum/DU choices and custom parsers returning exit code 2 on invalid tokens
Opt.sensitive, Opt.defFromEnv, Opt.durability Per-invocation secret masking (***), lazy environment defaults, and Ranvier.Dag durability tiers
Input.map, Input.zip, Input.traverse, input { ... } Applicative option bundles requiring no extra IHasher<'U> on projected F# types

2. Safe Command Construction (cmd & Proc<'T>)

cmd $"..." inspects FormattableString arguments without reflection so arguments with spaces never split accidentally:

  • Scalar holes (string, FileSystemInfo, culture-invariant IFormattable) become one ArgumentList entry (or splice cleanly into adjacent prefixes like -p:OutDir={dir}).

  • Sequence & split holes (seq<string>, Cmd.args, Cmd.split) expand to zero or more discrete arguments when placed standalone.

  • Secret holes (Cmd.secret, Cmd.secretOpt) pass the raw value to the child process while registering it in the invocation's Redactor so logs, --explain, and --report mask it as ***.

  • Windows DOTNET_CLI_HOME safety: Setting DOTNET_CLI_HOME on a child command or stage automatically injects DOTNET_ADD_GLOBAL_TOOLS_TO_PATH=0 unless explicitly overridden.

Proc<'T> separates streaming commands (Proc.run / yielded Cmd) from structured capture (Proc.text, Proc.raw, Proc.lines, Proc.json, and non-throwing Proc.attempt).

3. Single-Block CEs & Disjoint Command Kinds

command "name" { ... } classifies statically into one of three kinds:

Kind Triggered by Built-in behaviour
Group Yielding child Commands Registers --schema and --explain; requires a subcommand (exit 2 when omitted)
Action Binding Inputs / running Cmd, Proc, or CommandContext handlers Plain CLI tool mode: custom int exit codes, zero stage banners, zero unsolicited --json trailer
Stages Yielding Stage / PlainStage workflows Build pipeline mode: stage timings, GHA groups/annotations, --report <path>, and --no-cache when disk-cached

4. Incremental Produce Rules & Persistent Disk Cache

  • produce and produceFirewall: Backed by Ranvier.Dag.Engine single-flight sessions. produceFirewall hashes outputs with an explicit Ranvier.Dag.IHasher<'T> for early cutoff.

  • Stage.cacheByFiles and Produce.cacheByFiles: Compute deterministic xxHash128 digests over sorted relative paths, file contents, bound CLI leaf digests, and upstream producer hashes, persisting entries atomically via Ranvier.Persistence.FileStateStore.

  • Side-effect-free --explain: Inspects warm memory and disk cache readiness and expands Input-bound stages without spawning any child process or mutating files.

5. BuildHost and StageScope Semantics

BuildHost
  • Owned state: Owns DagEngine (Ranvier.Dag.Engine), a dedicated-thread Graph (Ranvier.Graph) publishing ActiveStageCount, ActiveStepCount, and StageStatuses, and optional CacheDir configuration.

  • Activation & resolution: runCli, runScriptCli, and CliApp.Invoke without host create and dispose an ephemeral BuildHost automatically; warm REPLs and test runners construct new BuildHost(?options) explicitly and pass host = host to retain memoized DAG state or customize EngineOptions, DeterminismCheck, CacheDir, or TimeProvider.

  • Invariants & disposal: Graph mutations run solely on the dedicated dispatcher thread, Redactor instances stay invocation-scoped, and Dispose() / DisposeAsync() cancels active invocations, awaits subprocesses, flushes persistence hooks, and disposes Graph and DagEngine.

StageScope
  • Owned state: Owns inherited WorkDir and Env maps (never mutating process globals), linked CancellationTokenSource budgets, step failure captures, and OutputBuffer state.

  • Activation, invariants & disposal: Activated automatically per scheduled stage with downward directive inheritance; distinguishes stage/step timeouts (FailureKind.TimedOut, running onFailure) from external cancellation (skipping onFailure, running finally' under a grace budget), and disposes tokens deterministically in try ... finally.

Packages

Package Description
Ranvier.Build Standard release build (net10.0, --reflectionfree, <IsAotCompatible>true</IsAotCompatible>)
Ranvier.Build.Traced Identical assembly and API surface compiled against the .Traced Ranvier package cohort
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Ranvier.Build:

Package Downloads
Ranvier.Build.Recipes

Standard .NET, ShipIt, docs, and cohort recipes built on Ranvier.Build.

Ranvier.Build.Tui

Interactive terminal UI, live theme switcher, PTY shell passthrough, and low-overhead AI execution socket bridge for Ranvier.Build CLIs.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.2 558 12/3/2026
0.2.1 61 12/3/2026
0.2.0 60 12/3/2026
0.1.0 70 12/2/2026

Pre-1.0 release. The API may change before 1.0.