Repository navigation
CLI Tool
Install Ferrous.Tool as a global or local .NET tool:
dotnet tool install -g Ferrous.Tool-
Bootstrap Rust-strict settings in a repo:
dotnet fe init --strict
Generates
.editorconfigentries for allFE0001–FE0502rules (elevating warnings toerrorwhen--strictis passed) and is idempotent on re-runs. -
Enforce build, supply-chain & NativeAOT hygiene in CI:
dotnet fe audit . --packages --allow-licenses MIT --lockfile --semver --aot --cveVerifies
<Nullable>enable</Nullable>,<TreatWarningsAsErrors>true</TreatWarningsAsErrors>,<AnalysisLevel>, pinned package versions, SPDX license allowlists,packages.lock.json,<EnablePackageValidation>true</EnablePackageValidation>, NativeAOT/trimming readiness, anddotnet list package --vulnerable --deprecated. -
Build a zero-config, searchable API docs site (like
cargo doc):dotnet fe doc ./src --output ./docs-site --title "My API Reference" --logo ./assets/icon.png --openGenerates a static HTML site directly from Roslyn syntax trees and
///XML doc comments—no DocFX config needed. Includes:- Roslyn-powered zero-JS C# syntax highlighting (
SyntaxFactory.ParseTokens) - Full XML doc rendering (
<summary>,<remarks>,<typeparam>,<param>,<returns>,<exception>,<value>,<example><code>), clickable cross-page<see cref="..."/>links, and<inheritdoc />resolution from base types/interfaces - Ferrous attribute badges,
[DiscriminatedUnion]variant tables,[Newtype]wrapper cards, and embedded Mermaid[Typestate]graphs - Collapsible left-hand namespace/type outline sidebar, mobile slide-over drawer, client-side instant search (
/), system-aware light/dark theme toggle, content-fingerprinted CSS/JS filenames, and--watchlive-rebuild mode
See Ferrous's own dogfooded site at https://ferrous.westness.cc/api/.
- Roslyn-powered zero-JS C# syntax highlighting (
-
Run executable doc-tests & unit tests together (like
cargo test):dotnet fe doctest ./src dotnet fe test .
Extracts, compiles, and runs
/// <example><code>XML doc blocks and fenced```csharpMarkdown blocks (supportingno_run,ignore,compile_fail, andcompile_fail(FE0200)). -
Generate & verify typestate diagrams:
dotnet fe graph src/ --format mermaid --write README.md
Scans
[Typestate](IsInitial,IsTerminal) and[ConsumesSelf]declarations, emits a MermaidstateDiagram-v2, optionally updates Markdown files in-place, and warns about unreachable or non-terminal dead-end states. -
Inspect generated union & newtype code (like
cargo expand):dotnet fe expand src/PaymentEvent.cs --type PaymentEvent
Runs
Ferrous.Unionsdirectly on your C# files and prints the exact.g.csoutput to stdout.
| Command | Description |
|---|---|
dotnet fe expand <path> [--type <Name>] |
Expand [DiscriminatedUnion] and [Newtype] source-generator output (including generated System.Text.Json converters) to stdout. |
dotnet fe graph <path> [--format mermaid|text] [--write <file>] |
Render [Typestate] state diagrams (including IsInitial and IsTerminal), optionally write them into Markdown docs between markers, and detect unreachable or dead-end states. |
dotnet fe init [dir] [--strict] |
Write FE0001–FE0503 .editorconfig rules (--strict elevates warnings to error). |
dotnet fe audit [dir] [--packages] [--allow-licenses <SPDX,...>] [--lockfile] [--semver] [--aot] [--cve] |
Audit .csproj / Directory.Build.props for Rust-strict build hygiene, pinned package versions, SPDX license allowlists, lockfiles, SemVer validation, NativeAOT readiness, and NuGet CVEs. |
dotnet fe doctest [path] [--no-md] |
Extract, compile, and run /// <example><code> XML doc blocks and fenced ```csharp Markdown doc-tests (no_run, ignore, compile_fail(FE...)). |
dotnet fe test [path] [--no-dotnet-test] [--no-doctest] |
Run dotnet test and dotnet fe doctest together in a single command. |
dotnet fe doc [path] [--output <dir>] [--title <name>] [--logo <file>] [--watch] [--open] |
Generate a searchable static HTML API docs site with Roslyn syntax highlighting, full XML doc rendering, cross-page <see cref> links, <inheritdoc />, outline sidebar, theme switcher, Mermaid [Typestate] graphs, and --watch mode. |
| dotnet fe migrate [path] [--report \| --apply] | Scan a C# codebase for progressive Ferrous migration opportunities (async void, nullable returns, throwing methods, raw lock, mutable static) and optionally apply safe mechanical upgrades. |
In addition to diagnostic quick-fixes, Ferrous.CodeFixes includes on-demand Roslyn Ctrl+. refactorings (supported in Visual Studio, VS Code C# Dev Kit, and JetBrains Rider) for migrating existing code method-by-method:
-
Convert throwing method (sync or
async Task<T>) →Result<T, string>(rewrites return type,return, andthrowstatements) -
Convert nullable-returning method (
T?,async Task<T?>, or expression-bodied) →Option<T>(rewritesreturn null;→Option.None<T>(),return value;→Option.Some(value), orOption.FromNullable(...)) -
Wrap primitive parameter in
[Newtype(typeof(T))](generates thereadonly partial structdeclaration and updates the parameter) -
Convert
abstract recordhierarchy →[DiscriminatedUnion](collapses base + derived records into a zero-boxing union struct) -
Convert
lock (_gate)+ protected field →Mutex<T>(removes the lock object, wraps the field inMutex<T>, and rewriteslockblocks tousing (var guard = _field.Lock()))
Ferrous — Rust quality-of-life primitives, source generators, and analyzers for .NET (.NET 10 / .NET 11, NativeAOT-ready, MIT License).