Portico 0.2.0
Prefix Reserveddotnet add package Portico --version 0.2.0
NuGet\Install-Package Portico -Version 0.2.0
<PackageReference Include="Portico" Version="0.2.0" />
<PackageVersion Include="Portico" Version="0.2.0" />
<PackageReference Include="Portico" />
paket add Portico --version 0.2.0
#r "nuget: Portico, 0.2.0"
#:package Portico@0.2.0
#addin nuget:?package=Portico&version=0.2.0
#tool nuget:?package=Portico&version=0.2.0
Portico
The command surface for .NET backend services. Contract-first CLI routing where your
examples are executable tests — one CliContractValidator<T> test runs every
[CliCommandExample] through the real pipeline, and Roslyn analyzers check the rest at compile
time. Zero dependencies.
dotnet add package Portico
using Portico;
public interface IAdminTool
{
[CliRoute("db migrate")]
[CliCommandExample("db migrate --connection-string \"Host=db\"")]
int Migrate([CliOption("--connection-string|-c", Sensitive = true)] string connectionString);
}
One CliContractValidator<T> test runs every [CliCommandExample] through the real pipeline,
and a stale one fails the test suite and CI.
Or start from a template — one for a new project, one for a service you already have:
dotnet new install Portico.Templates
dotnet new portico-cli -n MyCli && cd MyCli && dotnet test # a whole new CLI
dotnet new portico-command -n Migrate # one command, into this project
Four operational capabilities
- Secrets stay out of your logs.
[CliOption("--token", Sensitive = true)]— the value is withheld from every message the framework composes. All six others interpolate what the user typed into parse errors, and in a container stderr is the log stream. - Durations the way an operator types them.
--timeout "30 seconds",90s,1h30m,PT30S. A bare--timeout 30is refused rather than silently meaning thirty days, which is what .NET's ownTimeSpanparser does with it. - 17 collection shapes, immutable ones included —
ImmutableArray<T>,ImmutableHashSet<T>and the rest bind directly. So dostring-keyed maps:--shard eu=3(or'--shard[eu]' 3). - Named POSIX exit codes.
CliExitException.UsageErrorExitCode,CancelledExitCode,TerminatedExitCode— so a pipeline reading$?can tell misconfigured from failed.
The whole surface, every entry backed by a test.
For a dated, source-checked comparison with other .NET CLI frameworks, including prior art and the cases where another framework is the better choice, see The alternatives, honestly.
Related packages
| Package | What it adds |
|---|---|
Portico.DependencyInjection |
Resolve contracts from an IServiceProvider, one scope per command |
Portico.Hosting |
Generic Host integration — reuse your service's host, DI, config and logging |
Full documentation: github.com/vvka-141/portico · Issues and feedback: github.com/vvka-141/portico/issues
Portico is 0.x. The API is still being shaped by what breaks, so a rough edge is worth an issue rather than a workaround.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Portico:
| Package | Downloads |
|---|---|
|
Portico.DependencyInjection
Microsoft.Extensions.DependencyInjection integration for Portico, the contract-first CLI framework for .NET. Resolve command contracts and middleware from an IServiceProvider, with one IServiceScope per dispatched command. Command services stay lazy, and scoped resources are disposed after success, failure or cancellation. The core Portico package stays dependency-free; this is the opt-in. |
|
|
Portico.Hosting
Microsoft.Extensions.Hosting integration for Portico, the contract-first CLI framework for .NET. Register command contracts with HostApplicationBuilder and reuse the application's configuration, logging and dependency injection rather than rebuilding them. Graceful shutdown defers to IHostApplicationLifetime, and the command's exit code reaches Main. |
GitHub repositories
This package is not used by any popular GitHub repositories.