Skip to content

Commit d3d22b5

Browse files
committed
docs
1 parent 6f8557f commit d3d22b5

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

claude.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Solution
6+
7+
`src/DiffEngine.slnx`
8+
9+
## Build and Test Commands
10+
11+
```bash
12+
# Build (from repo root)
13+
dotnet build src --configuration Release
14+
15+
# Run all tests
16+
dotnet test src --configuration Release
17+
18+
# Run a single test file
19+
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName~ClassName"
20+
21+
# Run a specific test
22+
dotnet test src/DiffEngine.Tests --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"
23+
```
24+
25+
**SDK Requirements:** .NET 10 SDK (see `src/global.json`). The project uses preview/prerelease SDK features.
26+
27+
**Target Frameworks:**
28+
- DiffEngine library: net462, net472, net48, net6.0, net7.0, net8.0, net9.0, net10.0 (Windows also includes .NET Framework targets)
29+
- DiffEngineTray: net10.0 Windows Forms application
30+
- Tests: net10.0 (net48 on Windows)
31+
32+
## Architecture Overview
33+
34+
DiffEngine is a library that manages launching and cleanup of diff tools for snapshot/approval testing. It's used by ApprovalTests, Shouldly, and Verify.
35+
36+
### Core Components
37+
38+
**DiffEngine Library (`src/DiffEngine/`):**
39+
- `DiffRunner` - Main entry point. Launches diff tools via `Launch`/`LaunchAsync` methods and kills them via `Kill`. Handles process lifecycle.
40+
- `DiffTools` - Registry of available diff tools. Maintains lookups by extension and path. Initialized from `Definitions` and ordered by `OrderReader`.
41+
- `Definitions` - Static collection of all supported diff tool definitions. Each tool is defined in `Implementation/` folder.
42+
- `Definition` - Record type describing a diff tool: executable paths, command arguments, supported extensions, OS support, MDI behavior, auto-refresh capability.
43+
- `DiffTool` - Enum of all supported diff tools (BeyondCompare, P4Merge, VS Code, etc.)
44+
- `ResolvedTool` - A diff tool that was found on the system with its resolved executable path.
45+
- `BuildServerDetector` - Detects CI/build server environments to disable diff tool launching.
46+
47+
**DiffEngineTray (`src/DiffEngineTray/`):**
48+
- Windows Forms tray application that handles pending file diffs
49+
- `PiperServer` - TCP server (localhost) receiving move/delete payloads from DiffEngine library
50+
- `Tracker` - Manages pending file moves and deletes with concurrent dictionaries
51+
- Allows accepting/discarding diffs from system tray
52+
53+
### Adding a New Diff Tool
54+
55+
1. Add enum value to `DiffTool.cs`
56+
2. Create implementation in `src/DiffEngine/Implementation/` following existing patterns (see `BeyondCompare.cs`)
57+
3. Register in `Definitions.cs` collection
58+
4. The `Definition` record specifies:
59+
- Executable name and search paths per OS (`OsSupport`)
60+
- Argument builders for temp/target file positioning
61+
- Binary file extensions supported
62+
- Whether tool supports auto-refresh, is MDI, requires target file to exist
63+
64+
### Key Patterns
65+
66+
- Tool discovery uses wildcard path matching (`WildcardFileFinder`) to find executables in common install locations
67+
- Tool order can be customized via `DiffEngine_ToolOrder` environment variable
68+
- `DisabledChecker` respects `DiffEngine_Disabled` env var
69+
- Tests use xUnit with XunitContext and Verify for snapshot testing

src/DiffEngine.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</Configurations>
77
<Folder Name="/Solution Items/">
88
<File Path="../appveyor.yml" />
9+
<File Path="../claude.md" />
910
<File Path="../readme.source.md" />
1011
<File Path=".editorconfig" />
1112
<File Path="Directory.Build.props" />

0 commit comments

Comments
 (0)