This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
src/DiffEngine.slnx
# Build (from repo root)
dotnet build src --configuration Release
# Run all tests
dotnet test --project src/DiffEngine.Tests --configuration Release
dotnet test --project src/DiffEngineTray.Tests --configuration Release
# Run a single test project with filter
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName~ClassName"
# Run a specific test
dotnet test --project src/DiffEngine.Tests --configuration Release --filter "FullyQualifiedName=DiffEngine.Tests.ClassName.TestMethod"SDK Requirements: .NET 10 SDK (see src/global.json). The project uses preview/prerelease SDK features.
Target Frameworks:
- DiffEngine library: net462, net472, net48, net6.0, net7.0, net8.0, net9.0, net10.0 (Windows also includes .NET Framework targets)
- DiffEngineTray: net10.0 Windows Forms application
- Tests: net10.0 (net48 on Windows)
DiffEngine is a library that manages launching and cleanup of diff tools for snapshot/approval testing. It's used by ApprovalTests, Shouldly, and Verify.
DiffEngine Library (src/DiffEngine/):
DiffRunner- Main entry point. Launches diff tools viaLaunch/LaunchAsyncmethods and kills them viaKill. Handles process lifecycle.DiffTools- Registry of available diff tools. Maintains lookups by extension and path. Initialized fromDefinitionsand ordered byOrderReader.Definitions- Static collection of all supported diff tool definitions. Each tool is defined inImplementation/folder.Definition- Record type describing a diff tool: executable paths, command arguments, supported extensions, OS support, MDI behavior, auto-refresh capability.DiffTool- Enum of all supported diff tools (BeyondCompare, P4Merge, VS Code, etc.)ResolvedTool- A diff tool that was found on the system with its resolved executable path.BuildServerDetector- Detects CI/build server environments to disable diff tool launching.
DiffEngineTray (src/DiffEngineTray/):
- Windows Forms tray application that handles pending file diffs
PiperServer- TCP server (localhost) receiving move/delete payloads from DiffEngine libraryTracker- Manages pending file moves and deletes with concurrent dictionaries- Allows accepting/discarding diffs from system tray
- Add enum value to
DiffTool.cs - Create implementation in
src/DiffEngine/Implementation/following existing patterns (seeBeyondCompare.cs) - Register in
Definitions.cscollection - The
Definitionrecord specifies:- Executable name and search paths per OS (
OsSupport) - Argument builders for temp/target file positioning
- Binary file extensions supported
- Whether tool supports auto-refresh, is MDI, requires target file to exist
- Executable name and search paths per OS (
- Tool discovery uses wildcard path matching (
WildcardFileFinder) to find executables in common install locations - Tool order can be customized via
DiffEngine_ToolOrderenvironment variable DisabledCheckerrespectsDiffEngine_Disabledenv var- Tests use TUnit and Verify for snapshot testing