Skip to content
CAI
Software that uses CAICheck a score

pdevito3/craftsman

34.8

Weak · 20 September 2026

17.1k

lines of production code

C#

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Craftsman is a .NET CLI scaffolding tool that generates full-stack application infrastructure, including ASP.NET Core Web APIs, Next.js frontends, and Keycloak authentication servers. It automates the creation of domain models, CQRS handlers, API endpoints, and UI components while enforcing role-based permissions and modern architectural patterns like dependency injection and immutability. The system also provisions supporting infrastructure such as Docker configurations, message bus integrations, and comprehensive test suites for the generated code.

How it got here

2020 — CLI modernization and scaffolding expansion

8 changes.

The Craftsman CLI underwent a significant architectural overhaul, migrating to .NET 8 and adopting dependency injection, MediatR, and Spectre.Console for improved structure and user experience. This period focused on enhancing the scaffolding capabilities by introducing comprehensive infrastructure builders, immutable DTOs, and robust error handling through specific exception types. The work also included expanding command support for various domain components and integrating modern testing utilities for generated code.

2021 — Scaffolding modernization and test coverage

9 changes.

The project upgraded its scaffolding infrastructure to target .NET 8 and modernized the test suite by integrating xUnit, NSubstitute, and AutoBogus. It expanded code generation capabilities to include direct DbContext usage with HeimGuard permissions, comprehensive CRUD endpoint scaffolding, and robust functional and integration test builders. These changes established a more secure, standardized, and thoroughly tested foundation for generated applications.

2022–2023 — comprehensive scaffolding engine expansion

15 changes.

The project significantly expanded its code generation capabilities by introducing a robust domain model and centralized service architecture for the Craftsman tool. This period focused on automating the creation of full-stack applications, adding support for Docker infrastructure, Pulumi-based Keycloak authentication, and Next.js frontend components with TypeScript type safety. Additionally, the tool was enhanced to generate C\# 9+ record-based entities and comprehensive integration tests for user roles and permissions.

Features

Generate C\# 9+ record-based entity models with log masking and string array support

The scaffolding tool now generates entity models as immutable C\# records instead of classes, which changes how these data structures behave in the generated code. The builder supports generating both Creation and Update model variants for each entity. It also adds support for string array properties, initializing them with Array.Empty\<string\>(), and allows value objects to be included as properties. Additionally, properties marked for log masking are now annotated with \[LogMasked\] to protect sensitive data in logs.

Craftsman/Builders/EntityModels · high confidence

Introduces Spectre.Console-based console output and new utility helpers

The Craftsman tooling now uses the Spectre.Console library for all user-facing console interactions, providing styled and colored output for information, errors, warnings, and help text via the new ConsoleWriter component. This change also introduces a request for GitHub sponsorship (redirecting to a sponsor page) instead of a simple star request, and adds a suite of helper utilities for file parsing (JSON/YAML), type cleanup, and process execution to support the scaffolding workflow.

Craftsman/Helpers · high confidence

New Next.js scaffolding for entity forms and list tables

The code generator now produces dedicated Next.js components for entity features, including a form builder (\NextJsEntityFormBuilder\) that generates React forms with validation, autosave, and create/update logic, and a list table builder (\NextJsEntityListTableBuilder\) that generates paginated tables with sorting, filtering, and permission-based delete/update actions. An index page builder (\NextJsEntityIndexPageBuilder\) re-exports these components for easy feature integration.

Craftsman/Builders/NextJs/Domain/Features · high confidence

New domain enums for scaffolding configuration

The domain layer now includes a comprehensive set of enums in the \Craftsman.Domain.Enums\ namespace to drive code generation. These include \FeatureType\ (supporting operations like Get, Add, Update, Delete, and a new Job type), \EntityModel\ (distinguishing Creation vs Update models), \ValueObjectEnum\ and \ValueObjectPropertyType\ (defining value object types like Email, Percent, and MonetaryAmount with their pluralization and property handling), \TypescriptPropertyType\ (mapping C\# types to TypeScript definitions and form controls), \NextJsDomainCategory\ (categorizing Next.js artifacts), and supporting enums for \Dto\, \ExchangeType\, \GrantType\, \FormControlType\, \Validator\, and \Verbosity\. These enums provide the structured configuration needed for the scaffolding engine to generate consistent API, UI, and domain code.

Craftsman/Domain/Enums · high confidence

New domain models for scaffolding configuration and relationships

The scaffolding engine now uses a comprehensive set of new domain models in the \Craftsman/Domain\ namespace to define project structure and code generation rules. These include \ApiTemplate\, \AuthServerTemplate\, and \DbProvider\ to configure API settings, authentication, and database providers (Postgres, SqlServer). A new \DbRelationship\ model introduces typed support for entity relationships (1:1, 1:many, many:many, self), and \EntityProperty\ adds support for value objects and string arrays. Additionally, \NextJsEntity\ enables Next.js frontend scaffolding with navigation icons, while \Bus\, \Consumer\, and \Producer\ models support message broker configuration.

Craftsman/Domain · high confidence

New scaffolding for Next.js API layer builders

Added a set of new builder classes in the Next.js domain API scaffolding to generate client-side API hooks and utilities. These builders create TypeScript files for CRUD operations (Add, Get, GetList, Update, Delete) using react-query and axios, along with an index file to export the features and a keys builder for generating consistent query keys. This provides the underlying infrastructure for generating Next.js API client code for new entities.

Craftsman/Builders/NextJs/Domain/Api · high confidence

Next.js scaffolding now generates domain-specific TypeScript files

The code generator now produces specific TypeScript artifacts for Next.js applications, including entity index files, API type definitions (Read, Creation, Update DTOs), and Yup-based validation schemas. This change ensures that generated Next.js features include proper type safety and input validation structures out of the box.

Craftsman/Builders/NextJs/Domain · high confidence

Next.js scaffolding now supports custom navigation icons and permission types

The Next.js code generator has been enhanced to allow customization of the side navigation and permission structures. Users can now specify a Tabler icon for specific entity routes, which the generator will automatically import and assign to the corresponding navigation item. Additionally, the generator can now inject custom permission strings into the application's permission types file, ensuring that newly generated features are correctly associated with the required access controls.

Craftsman/Builders/NextJs · high confidence

Scaffolded API versioning, CORS, MassTransit, OpenTelemetry, and service configuration extensions

The scaffolding tool now generates dedicated extension builders for core infrastructure services. It creates an API versioning extension that configures URL-segment versioning with Swagger support, a CORS extension that allows all origins in development/testing environments, a MassTransit extension for RabbitMQ integration, and an OpenTelemetry extension that configures Jaeger tracing and metrics. Additionally, it generates a central service configuration extension that wires up MediatR, boundary services, health checks, and optionally integrates the Hellang ProblemDetails middleware for error handling.

Craftsman/Builders/ExtensionBuilders · high confidence

Scaffolded ASP.NET Core API endpoints with API versioning and role-based permissions

The scaffolding tool now generates ASP.NET Core controllers with built-in API versioning (v1.0) and supports a comprehensive set of CRUD endpoints (GetList, GetRecord, GetAll, CreateRecord, CreateList, UpdateRecord, DeleteRecord, and PatchRecord). It also scaffolds dedicated controllers for managing Roles and Permissions, including endpoints to retrieve available permissions and the current user's assigned permissions. Authentication is handled via the \[Authorize\] attribute for protected features, and the tool supports batch creation endpoints with foreign key parameters.

Craftsman/Builders/Endpoints · high confidence

Scaffolding for Pulumi-based Keycloak authentication server infrastructure

The AuthServer builder now generates a complete Pulumi program to provision Keycloak resources, including a Realm, Client Scopes, and Clients configured via Code Flow or Client Credentials. It introduces extension methods to automatically apply default OpenID scopes (openid, profile, email, roles, web-origins) and audience protocol mappers to clients, alongside a factory for creating confidential clients with standard redirect and CORS settings. The generated infrastructure also seeds default administrative users (Bob and Alice) and includes a Pulumi YAML configuration for local development, allowing users to define the auth server's structure and initial state through code.

Craftsman/Builders/AuthServer · high confidence

Scaffolding for role-based permissions and user policy handling

The scaffolding tool now generates a \Permissions\ class containing constants for role management actions (such as adding/removing roles and viewing permissions) and a \UserPolicyHandler\ that enforces these permissions. The handler checks user roles against a \RolePermissions\ database table, grants full access to super admins, and automatically seeds a root super-admin user if no users exist in the database.

Craftsman/Builders/Auth · high confidence

Scaffolding now generates Dockerfiles and Compose configurations for new projects

The scaffolding tool now automatically generates Docker support files for new projects. For Web API projects, it creates a Dockerfile based on the .NET 8.0 SDK and ASP.NET Core runtime images. For BFF projects, it generates a Dockerfile using .NET 6.0, including optional Node.js 16 installation steps. Additionally, the tool creates a .dockerignore file to exclude unnecessary artifacts and provides a DockerComposeBuilders component that initializes a base docker-compose.yaml skeleton and dynamically adds services for databases, RabbitMQ (with configurable ports), and Jaeger tracing (with random free ports) to the compose file.

Craftsman/Builders/Docker · high confidence

Scaffolding of new application infrastructure and domain components

The Craftsman scaffolding tool now generates a comprehensive set of foundational application components. This includes configuration files for application settings and development environments, common domain value objects (Address, MonetaryAmount, Percent, Role, PostalCode), and a suite of core exception classes (Validation, NotFound, Forbidden, NoRolesAssigned). It also introduces infrastructure for background processing via Hangfire (CurrentUserFilter, CurrentUserService), message bus integration with MassTransit (ConsumerRegistrationBuilder), and enhanced Entity Framework Core support through dedicated database entity configuration builders and modifiers for relationships, string arrays, and value objects.

Craftsman/Builders · high confidence

Behavioural changes

CLI application restructured with dependency injection and enhanced command scaffolding

The Craftsman CLI has been rewritten to use Microsoft.Extensions.DependencyInjection for dependency injection, replacing the previous global singleton approach. This change introduces a new \TypeRegistrar\ to bridge Spectre.Console.Cli with the DI container and adds an \OperatingSystemInterceptor\ to ensure consistent emoji rendering on Windows. Users benefit from a more robust command structure that now explicitly supports scaffolding entities, bounded contexts, features, message buses, auth servers, and consumers via YAML/JSON templates, along with a new \add next entity\ command for NextJS projects. The application also integrates MediatR for command handling and includes a version checker that runs after execution.

Craftsman · high confidence

CLI commands refactored to use MediatR pipeline and Spectre.Console

The scaffolding commands in the Craftsman CLI have been refactored to adopt a new architecture: command logic is now handled by MediatR handlers (pipelines) rather than direct execution, and the console output has been upgraded to use Spectre.Console for improved formatting and status indicators. This change introduces new commands such as AddAuthServer, AddBus, AddConsumer, AddEntity, AddFeature, AddMessage, AddProducer, and RegisterProducer, which now interact with the scaffolding system through this new mediator-based pattern.

Craftsman/Commands · high confidence

DTOs generated as immutable records with log masking and pagination support

The scaffolding tool now generates Data Transfer Objects (DTOs) as C\# records instead of mutable classes, improving immutability and value-based equality. Read parameters now inherit from a new BasePaginationParameters class (with a max page size of 500) and support nullable filters and sort orders. Additionally, properties marked for log masking are automatically annotated with \[LogMasked\] in the generated code to prevent sensitive data leakage in logs.

Craftsman/Builders/Dtos · high confidence

Input validation for producer, consumer, and message definitions

The Craftsman tool now enforces required fields when generating or modifying message bus components. New validators ensure that Producer, Consumer, and Message definitions include non-empty values for their respective names, exchange names, queue names, and endpoint registration method names, providing clear error messages to guide users in correctly configuring MassTransit bindings.

Craftsman/Validators · high confidence

Introduce centralized scaffolding services and path helpers

The scaffolding logic in the Craftsman tool has been reorganized into dedicated service classes to improve structure and maintainability. A new \ApiScaffoldingService\ now orchestrates the creation of API projects, handling everything from directory setup and MediatR command dispatching to the generation of entities, tests, and configuration files. This is supported by \EntityScaffoldingService\ for detailed entity generation (including relationships and value objects) and \NextJsEntityScaffoldingService\ for frontend scaffolding. Path resolution is now centralized in \ClassPath\ and \ClassPathHelper\, ensuring consistent file locations across the solution, while \ScaffoldingDirectoryStore\ manages directory state. Additional services like \DbMigrator\ and \GitService\ automate database migration and repository initialization steps during the scaffolding process.

Craftsman/Services · high confidence

Introduction of specific exception types for validation and configuration errors

The Craftsman tool now provides a comprehensive set of specific exception classes within the \Craftsman.Exceptions\ namespace to handle various error scenarios more precisely. These include \DataValidationErrorException\ for FluentValidation failures, and distinct exceptions for configuration issues such as \DirectoryAlreadyExistsException\, \FileAlreadyExistsException\, \NextConfigNotFoundException\, \SolutionNotFoundException\, and \InvalidBaseDirectoryException\. Additional typed exceptions cover invalid inputs like \InvalidDbProviderException\, \InvalidEndpointException\, \InvalidExchangeTypeException\, \InvalidFeatureTypeException\, \InvalidMessageBrokerException\, \InvalidPolicyTypeException\, \InvalidSolutionNameException\, and \SolutionNameMismatchException\, as well as logical errors like \DuplicateSingletonException\ and \EntityNotFoundException\. All new exceptions implement the \ICraftsmanException\ interface, enabling better error handling and clearer feedback for users during project scaffolding and command execution.

Craftsman/Exceptions · high confidence

Next.js scaffolding now generates permission-controlled entity pages

The Next.js code generator now produces index, new, and edit pages for entities that enforce role-based access control. These generated pages import the \useHasPermission\ hook and conditionally render the entity forms or tables only when the user holds the required \AddRecord\, \GetList\, or \UpdateRecord\ permissions; otherwise, a \Forbidden\ component is displayed. The scaffolding also includes proper \\<Head\>\ tags for page titles and integrates with the existing \PrivateLayout\, \SearchInput\, and \PaginatedTableProvider\ components.

Craftsman/Builders/NextJs/Domain/Pages · high confidence

Scaffolding for CRUD features now uses DbContext directly with HeimGuard permissions

The feature builders in Craftsman/Builders/Features have been rewritten to generate CQRS commands and queries that interact with the DbContext directly instead of using repository abstractions. All generated handlers now accept the DbContext as a constructor parameter and use AsNoTracking for read operations. Additionally, protected features now include HeimGuard permission checks (MustHavePermission) injected via IHeimGuardClient, and the scaffolding supports new feature types including batch add (CommandAddListBuilder), user role management (CommandAddUserRoleBuilder/CommandRemoveUserRoleBuilder), and background jobs (JobFeatureBuilder).

Craftsman/Builders/Features · high confidence

Scaffolding updates to .NET 8 and modernized test infrastructure

The project scaffolding templates in the Craftsman builders have been upgraded to target .NET 8.0 for the Web API, Functional Tests, Integration Tests, Shared Tests, and Unit Tests projects. The test project builders now utilize xUnit, NSubstitute, and AutoBogusLifesupport, replacing previous testing frameworks. Additionally, the BFF project builder now scaffolds a .NET 6.0 project with Duende BFF and Yarp, while the Auth Server builder generates a .NET 8.0 project with Pulumi.Keycloak.

Craftsman/Builders/Projects · high confidence

Test coverage

Added functional test infrastructure for health checks and foreign key relationships; Added integration test builders for role permissions; Added integration test scaffolding for user role assignment; Added test fakes and builders for entity scaffolding; Generated integration tests for User CRUD operations; Integration test scaffolding for CRUD and list operations; Scaffolding for functional and integration test infrastructure; Scaffolding for generated unit tests.

Dependencies

Craftsman tool upgraded to .NET 8 with modernized dependencies

The Craftsman scaffolding tool has been migrated from .NET Core 3.1 to .NET 8, enabling users to benefit from the latest runtime performance and language features. The project file has been significantly expanded to include explicit package references for core libraries such as MediatR (v12.2.0), Spectre.Console (v0.48.0), and FluentValidation (v11.9.0), alongside configuration for implicit usings and tool packaging metadata. This update ensures the tool remains compatible with current .NET standards and provides a more robust dependency stack for code generation tasks.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 40 → 35 (-5.3)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 49 → 51 (+2.5)
  • Architecture 90 → 77 (-12.9)
  • Maturity 52 → 52 (+0.1)
  • Readiness 27 → 27 (+0.0)
  • Security 65 → 28 (-37.0)

Resolved (35)

  • Change coupling: DeleteRecordEndpointBuilder.cs ↔ GetListEndpointBuilder.cs (Craftsman/Builders/Endpoints/DeleteRecordEndpointBuilder.cs)
  • Change coupling: DeleteRecordEndpointBuilder.cs ↔ GetRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/DeleteRecordEndpointBuilder.cs)
  • Change coupling: DeleteRecordEndpointBuilder.cs ↔ PatchRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/DeleteRecordEndpointBuilder.cs)
  • Change coupling: DeleteRecordEndpointBuilder.cs ↔ PutRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/DeleteRecordEndpointBuilder.cs)
  • Change coupling: EntityBuilder.cs ↔ ModelFileTextGenerator.cs (Craftsman/Builders/EntityBuilder.cs)
  • Change coupling: GetListEndpointBuilder.cs ↔ PatchRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/GetListEndpointBuilder.cs)
  • Change coupling: GetListEndpointBuilder.cs ↔ PutRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/GetListEndpointBuilder.cs)
  • Change coupling: GetRecordEndpointBuilder.cs ↔ PatchRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/GetRecordEndpointBuilder.cs)
  • Change coupling: GetRecordEndpointBuilder.cs ↔ PutRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/GetRecordEndpointBuilder.cs)
  • Change coupling: PatchRecordEndpointBuilder.cs ↔ PutRecordEndpointBuilder.cs (Craftsman/Builders/Endpoints/PatchRecordEndpointBuilder.cs)
  • Duplicated block (10 lines × 2) (Craftsman/Builders/Docker/DockerComposeBuilders.cs)
  • Duplicated block (12 lines × 2) (Craftsman/Builders/DatabaseEntityConfigModifier.cs)
  • Duplicated block (14 lines × 2) (Craftsman/Builders/Features/CommandDeleteRecordBuilder.cs)
  • Duplicated block (15 lines × 2) (Craftsman/Builders/MassTransitModifier.cs)
  • Duplicated block (17 lines × 5) (Craftsman/Builders/Features/CommandPatchRecordBuilder.cs)
  • Duplicated block (18 lines × 2) (Craftsman/Builders/Features/CommandAddRecordBuilder.cs)
  • Duplicated block (24 lines × 2) (Craftsman/Builders/Features/QueryGetAllBuilder.cs)
  • Duplicated block (9 lines × 2) (Craftsman/Builders/Auth/PermissionsModifier.cs)
  • Inconsistent naming for fake creation methods: some use 'Create...Fakes' while others use 'Create...FakesCommand' or 'Create...Faker'. This indicates mixed usage of 'Fakes' and 'Faker' terminology.
  • Inconsistent naming for test builder classes: some use 'CommandTestBuilder' while others use 'Add...TestBuilder'. This creates confusion about whether the class builds commands or tests.
  • …and 15 more

New (75)

  • Change coupling: DbRelationship.cs ↔ EntityScaffoldingService.cs (Craftsman/Domain/DbRelationship.cs)
  • Change coupling: DtoFileTextGenerator.cs ↔ ModelFileTextGenerator.cs (Craftsman/Builders/Dtos/DtoFileTextGenerator.cs)
  • Change coupling: ModelFileTextGenerator.cs ↔ EntityScaffoldingService.cs (Craftsman/Builders/EntityModels/ModelFileTextGenerator.cs)
  • Change-coupling hub: EntityBuilder.cs → DatabaseEntityConfigBuilder.cs, ModelFileTextGenerator.cs, EntityModifier.cs (Craftsman/Builders/EntityBuilder.cs)
  • CommentedOutCode (Craftsman/Domain/Enums/FeatureType.cs)
  • CommentedOutCode (Craftsman/Services/ApiScaffoldingService.cs)
  • Documentation: no installation or build instructions (README.md)
  • Duplicated block (10 lines × 5) (Craftsman/Commands/AddBusCommand.cs)
  • Duplicated block (10 lines × 6) (Craftsman/Builders/EntityModifier.cs)
  • Duplicated block (10 lines × 7) (Craftsman/Builders/Docker/DockerComposeBuilders.cs)
  • Duplicated block (11 lines × 2) (Craftsman/Domain/Consumer.cs)
  • Duplicated block (11 lines × 4) (Craftsman/Builders/DatabaseEntityConfigModifier.cs)
  • Duplicated block (11 lines × 5) (Craftsman/Builders/Docker/DockerComposeBuilders.cs)
  • Duplicated block (11–17 lines × 3) (Craftsman/Builders/Auth/PermissionsModifier.cs)
  • Duplicated block (11–19 lines × 16) (Craftsman/Builders/DatabaseEntityConfigModifier.cs)
  • Duplicated block (12 lines × 2) (Craftsman/Commands/AddEntityCommand.cs)
  • Duplicated block (12 lines × 2) (Craftsman/Domain/Enums/ExampleType.cs)
  • Duplicated block (12 lines × 3) (Craftsman/Builders/Features/CommandAddListBuilder.cs)
  • Duplicated block (12 lines × 6) (Craftsman/Builders/Docker/DockerComposeBuilders.cs)
  • Duplicated block (12–14 lines × 3) (Craftsman/Builders/Docker/DockerComposeBuilders.cs)
  • …and 55 more

Architecture

  • Unchanged — 2 containers · 0 contexts · 0 edges

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

pdevito3/craftsman was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 2a242a06e4a7ae32f76ce9d1a91f8eb342ad6486 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.