Ranvier.Build
0.2.0
See the version list below for details.
dotnet add package Ranvier.Build --version 0.2.0
NuGet\Install-Package Ranvier.Build -Version 0.2.0
<PackageReference Include="Ranvier.Build" Version="0.2.0" />
<PackageVersion Include="Ranvier.Build" Version="0.2.0" />
<PackageReference Include="Ranvier.Build" />
paket add Ranvier.Build --version 0.2.0
#r "nuget: Ranvier.Build, 0.2.0"
#:package Ranvier.Build@0.2.0
#addin nuget:?package=Ranvier.Build&version=0.2.0
#tool nuget:?package=Ranvier.Build&version=0.2.0
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-invariantIFormattable) become oneArgumentListentry (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'sRedactorso logs,--explain, and--reportmask it as***.Windows
DOTNET_CLI_HOMEsafety: SettingDOTNET_CLI_HOMEon a child command or stage automatically injectsDOTNET_ADD_GLOBAL_TOOLS_TO_PATH=0unless 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
produceandproduceFirewall: Backed byRanvier.Dag.Enginesingle-flight sessions.produceFirewallhashes outputs with an explicitRanvier.Dag.IHasher<'T>for early cutoff.Stage.cacheByFilesandProduce.cacheByFiles: Compute deterministic xxHash128 digests over sorted relative paths, file contents, bound CLI leaf digests, and upstream producer hashes, persisting entries atomically viaRanvier.Persistence.FileStateStore.Side-effect-free
--explain: Inspects warm memory and disk cache readiness and expandsInput-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-threadGraph(Ranvier.Graph) publishingActiveStageCount,ActiveStepCount, andStageStatuses, and optionalCacheDirconfiguration.Activation & resolution:
runCli,runScriptCli, andCliApp.Invokewithouthostcreate and dispose an ephemeralBuildHostautomatically; warm REPLs and test runners constructnew BuildHost(?options)explicitly and passhost = hostto retain memoized DAG state or customizeEngineOptions,DeterminismCheck,CacheDir, orTimeProvider.Invariants & disposal: Graph mutations run solely on the dedicated dispatcher thread,
Redactorinstances stay invocation-scoped, andDispose()/DisposeAsync()cancels active invocations, awaits subprocesses, flushes persistence hooks, and disposesGraphandDagEngine.
StageScope
Owned state: Owns inherited
WorkDirandEnvmaps (never mutating process globals), linkedCancellationTokenSourcebudgets, step failure captures, andOutputBufferstate.Activation, invariants & disposal: Activated automatically per scheduled stage with downward directive inheritance; distinguishes stage/step timeouts (
FailureKind.TimedOut, runningonFailure) from external cancellation (skippingonFailure, runningfinally'under a grace budget), and disposes tokens deterministically intry ... 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 | Versions 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. |
-
net10.0
- FSharp.Core (>= 9.0.100)
- Ranvier (>= 0.2.7)
- Ranvier.Dag (>= 0.2.0)
- Ranvier.Persistence (>= 0.2.0)
- Ranvier.Terminal (>= 0.1.3)
- Ranvier.Wire (>= 0.2.7)
- System.CommandLine (>= 2.0.12)
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.
Pre-1.0 release. The API may change before 1.0.