Skip to content

Commit 3b7c4fb

Browse files
committed
docs: claude cleanup
1 parent 96dd995 commit 3b7c4fb

1 file changed

Lines changed: 46 additions & 42 deletions

File tree

CLAUDE.md

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,53 +103,57 @@ The tool's primary function is translating YAML/JSON configuration files into co
103103
}
104104
```
105105

106+
- When creating a `Builder` or `Modifier`, be sure to set it up as a MediatR command with DI in the handler as needed for services like
107+
- `IScaffoldingDirectoryStore` for sln and project info (instead of needing to pass with props)
108+
- `ICraftsmanUtilities` for various Craftsman utilities
109+
- `IFileSystem` for file operations
110+
- `IConsoleWriter` for console output
111+
112+
Here is an example:
113+
114+
```c#
115+
public static class CreatedDomainEventBuilder
116+
{
117+
public class CreatedDomainEventBuilderCommand(string entityName, string entityPlural) : IRequest<bool>
118+
{
119+
public string EntityName { get; set; } = entityName;
120+
public string EntityPlural { get; set; } = entityPlural;
121+
}
106122

107-
108-
- When creating a `Builder` or `Modifier`, be sure to set it up as a MediatR command like with DI in the handler for `IScaffoldingDirectoryStore` or whatever else is needed. Here is an example:
109-
110-
```c#
111-
public static class CreatedDomainEventBuilder
112-
{
113-
public class CreatedDomainEventBuilderCommand(string entityName, string entityPlural) : IRequest<bool>
114-
{
115-
public string EntityName { get; set; } = entityName;
116-
public string EntityPlural { get; set; } = entityPlural;
117-
}
123+
public class Handler(
124+
ICraftsmanUtilities utilities,
125+
IScaffoldingDirectoryStore scaffoldingDirectoryStore)
126+
: IRequestHandler<CreatedDomainEventBuilderCommand, bool>
127+
{
128+
public Task<bool> Handle(CreatedDomainEventBuilderCommand request, CancellationToken cancellationToken)
129+
{
130+
var classPath = ClassPathHelper.DomainEventsClassPath(scaffoldingDirectoryStore.SrcDirectory,
131+
$"{FileNames.EntityCreatedDomainMessage(request.EntityName)}.cs",
132+
request.EntityPlural,
133+
scaffoldingDirectoryStore.ProjectBaseName);
134+
var fileText = GetFileText(classPath.ClassNamespace, request.EntityName);
135+
utilities.CreateFile(classPath, fileText);
136+
return Task.FromResult(true);
137+
}
118138

119-
public class Handler(
120-
ICraftsmanUtilities utilities,
121-
IScaffoldingDirectoryStore scaffoldingDirectoryStore)
122-
: IRequestHandler<CreatedDomainEventBuilderCommand, bool>
123-
{
124-
public Task<bool> Handle(CreatedDomainEventBuilderCommand request, CancellationToken cancellationToken)
125-
{
126-
var classPath = ClassPathHelper.DomainEventsClassPath(scaffoldingDirectoryStore.SrcDirectory,
127-
$"{FileNames.EntityCreatedDomainMessage(request.EntityName)}.cs",
128-
request.EntityPlural,
129-
scaffoldingDirectoryStore.ProjectBaseName);
130-
var fileText = GetFileText(classPath.ClassNamespace, request.EntityName);
131-
utilities.CreateFile(classPath, fileText);
132-
return Task.FromResult(true);
133-
}
139+
private static string GetFileText(string classNamespace, string entityName)
140+
{
141+
// lang=csharp
142+
return $$"""
143+
namespace {{classNamespace}};
134144

135-
private static string GetFileText(string classNamespace, string entityName)
136-
{
137-
// lang=csharp
138-
return $$"""
139-
namespace {{classNamespace}};
140-
141-
public sealed class {{FileNames.EntityCreatedDomainMessage(entityName)}} : DomainEvent
142-
{
143-
public {{entityName}} {{entityName}} { get; set; }
144-
}
145+
public sealed class {{FileNames.EntityCreatedDomainMessage(entityName)}} : DomainEvent
146+
{
147+
public {{entityName}} {{entityName}} { get; set; }
148+
}
145149
146-
""";
147-
}
148-
}
149-
}
150-
```
150+
""";
151+
}
152+
}
153+
}
154+
```
151155

152156

153157

154-
- When a new feature is added, bug is fixed, etc. be sure to add the updates to the Changelog
158+
- When a new feature is added, bug is fixed, etc. be sure to add the updates to the Changelog.
155159

0 commit comments

Comments
 (0)