Strawhats.Framework.Cli
0.6.0
dotnet tool install --global Strawhats.Framework.Cli --version 0.6.0
dotnet new tool-manifest
dotnet tool install --local Strawhats.Framework.Cli --version 0.6.0
#tool dotnet:?package=Strawhats.Framework.Cli&version=0.6.0
nuke :add-package Strawhats.Framework.Cli --version 0.6.0
Strawhats.Framework.Cli (strawhats)
A dotnet tool that scaffolds a Clean Architecture feature slice into a solution built on
Strawhats.Framework. It generates files only and
leaves // TODO (strawhats) wiring markers — it never edits existing files or runs migrations.
Install
dotnet tool install --global Strawhats.Framework.Cli
# or, per-repo: dotnet tool install Strawhats.Framework.Cli
Usage
Run it from your solution root (it locates the layer projects via the nearest .slnx):
strawhats feature add Order
This generates, for a feature named Order (foldered under Orders):
Domain/Orders/Order.cs AggregateRoot + sample Name property, raises OrderCreated
Domain/Orders/OrderCreated.cs domain event
Business/Orders/CreateOrderCommand.cs + handler + validator + result
Business/Orders/GetOrderByIdQuery.cs + handler + OrderDto (omit with --no-query)
Persistence/Configurations/OrderConfiguration.cs IEntityTypeConfiguration (if a Persistence project exists)
Api/Contracts/CreateOrderRequest.cs request body (if an Api project exists)
Api/Endpoints/OrderEndpoints.cs minimal-API endpoints
The aggregate, command, query, and configuration mirror the framework's reference slice and compile as
generated. The tool then prints the manual wiring steps (register the configuration / DbSet and the
repository, map the endpoints, add a migration), each also marked with a // TODO (strawhats) comment.
Other generators
strawhats valueobject add Money # a Domain ValueObject (Domain/ValueObjects/Money.cs)
strawhats specification add ActiveOrders --for=Order # a Specification<Order> (Business/Orders/…Specification.cs)
strawhats handler add OrderCreated --for=Order # an INotificationHandler<DomainEventNotification<OrderCreated>>
strawhats route list # list the Api project's HTTP routes (method + path)
specification and handler take --for=<Aggregate> so the generated type lands in that aggregate's
folder/namespace. Notification handlers need no wiring — they are discovered by AddCqrs's assembly scan.
Options
| Option | Effect |
|---|---|
--for=<Aggregate> |
(specification, handler) the aggregate the generated type belongs to. |
--no-query |
Skip the query side (Get<Name>ById query/handler/DTO and its endpoint). |
--no-api |
Skip the Api layer (endpoints + request contract). |
--result-pattern |
(feature) emit the Result<>+errors+ToHttpResult style instead of plain records. Needs a ToHttpResult host (strawhats-api, reference app — not the microservice). |
--dry-run |
Print what would be generated without writing any files. |
--force |
Overwrite existing files (otherwise the tool refuses and lists conflicts). |
--root=<dir> |
Solution root to generate into (default: current directory). |
-h, --help |
Show help. |
Layer detection
Projects are classified by name: *.Domain / Domain, *.Business / Business, anything containing
Persistence, and *.Api / WebApi / Api. Test projects (*Tests) are ignored. Domain and Business
are required; Persistence and Api are optional (skipped if absent). Generated namespaces follow each
project's root namespace.
The generated handlers use the framework's repository / unit-of-work pattern
(IRepository<T, TId> / IReadRepository<T, TId>), so they compile in repository-based hosts such as
strawhats-microservice and the reference app. The auth-only strawhats-api uses the Identity stores
rather than generic repositories, so to host a generated aggregate slice its Business project must first
reference Strawhats.Framework.Persistence.Abstractions (and register the generic repository / UoW).
| 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. |
This package has no dependencies.