|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code when working with code in this repository. |
| 4 | + |
| 5 | +## Critical Rules |
| 6 | + |
| 7 | +These rules override all other instructions: |
| 8 | +1. **NEVER commit directly to main** - Always create a feature branch and submit a pull request |
| 9 | +2. **Conventional commits** - Format: `type(scope): description` |
| 10 | +3. **GitHub Issues for TODOs** - Use `gh` CLI to manage issues, no local TODO files |
| 11 | +4. **Pull Request titles** - Use conventional commit format (same as commits) |
| 12 | +5. **Branch naming** - Use format: `type/scope/short-description` (e.g., `feat/visualizer/add-json-support`) |
| 13 | +6. **Working an issue** - Always create a new branch from an updated main branch |
| 14 | +7. **Check branch status before pushing** - Verify remote tracking branch exists |
| 15 | +8. **No co-authors** - Do not add co-author information on commits or pull requests |
| 16 | +9. **No "generated by" statements** - Do not add generated-by statements on pull requests |
| 17 | +10. **No #pragma warning directives** - Fix warnings properly instead of suppressing them with #pragma directives |
| 18 | +11. **Consistent naming** - Assembly name and root namespace must match the folder/project name |
| 19 | + |
| 20 | +## Project Overview |
| 21 | + |
| 22 | +**Debugalizers** is a Visual Studio extension providing custom debug visualizers for string data. It supports various formats including JSON, XML, YAML, JWT, Base64, and more. |
| 23 | + |
| 24 | +### Technology Stack |
| 25 | + |
| 26 | +- **Framework**: .NET Framework 4.8 |
| 27 | +- **SDK**: CodingWithCalvin.VsixSdk 0.4.0 |
| 28 | +- **Target**: Visual Studio 2022 (17.x) |
| 29 | +- **UI Framework**: WPF |
| 30 | +- **Syntax Highlighting**: AvalonEdit |
| 31 | + |
| 32 | +## Build Commands |
| 33 | + |
| 34 | +```bash |
| 35 | +# Build the solution |
| 36 | +dotnet build src/CodingWithCalvin.Debugalizers.slnx |
| 37 | + |
| 38 | +# Build in Release mode |
| 39 | +dotnet build src/CodingWithCalvin.Debugalizers.slnx --configuration Release |
| 40 | + |
| 41 | +# Run tests |
| 42 | +dotnet test src/CodingWithCalvin.Debugalizers.slnx |
| 43 | +``` |
| 44 | + |
| 45 | +## Project Structure |
| 46 | + |
| 47 | +``` |
| 48 | +src/ |
| 49 | +├── CodingWithCalvin.Debugalizers/ # Main VSIX project |
| 50 | +│ ├── Visualizers/ # Debug visualizer implementations |
| 51 | +│ │ ├── DataFormats/ # JSON, XML, YAML, etc. |
| 52 | +│ │ ├── Encoded/ # Base64, URL encoded, etc. |
| 53 | +│ │ ├── Security/ # JWT, SAML, Certificates |
| 54 | +│ │ ├── Structured/ # URI, Connection strings, etc. |
| 55 | +│ │ └── Binary/ # Hex dump, GUID, Timestamp |
| 56 | +│ ├── UI/ # WPF views and windows |
| 57 | +│ │ └── Views/ # Individual view controls |
| 58 | +│ └── Services/ # Core services |
| 59 | +└── CodingWithCalvin.Debugalizers.Tests/ # Unit tests |
| 60 | +``` |
| 61 | + |
| 62 | +## Architecture |
| 63 | + |
| 64 | +### Visualizer Pattern |
| 65 | + |
| 66 | +All visualizers extend `BaseVisualizer`: |
| 67 | + |
| 68 | +```csharp |
| 69 | +[assembly: DebuggerVisualizer( |
| 70 | + typeof(JsonVisualizer), |
| 71 | + typeof(VisualizerObjectSource), |
| 72 | + Target = typeof(string), |
| 73 | + Description = "Debugalizers: JSON")] |
| 74 | + |
| 75 | +public class JsonVisualizer : BaseVisualizer |
| 76 | +{ |
| 77 | + protected override string Title => "JSON"; |
| 78 | + protected override VisualizerType Type => VisualizerType.Json; |
| 79 | + protected override IEnumerable<ViewType> SupportedViews => |
| 80 | + new[] { ViewType.Formatted, ViewType.Tree, ViewType.Raw }; |
| 81 | +} |
| 82 | +``` |
| 83 | + |
| 84 | +### Core Services |
| 85 | + |
| 86 | +- **FormatDetector**: Auto-detects content type from strings |
| 87 | +- **ContentFormatter**: Pretty-prints and formats various content types |
| 88 | +- **EncodingDecoder**: Decodes Base64, URL encoding, HTML entities, etc. |
| 89 | +- **ImageDecoder**: Decodes Base64/data URI images |
| 90 | +- **SyntaxHighlighter**: Provides AvalonEdit syntax highlighting |
| 91 | + |
| 92 | +## Adding a New Visualizer |
| 93 | + |
| 94 | +1. Create a new class in the appropriate `Visualizers/` subdirectory |
| 95 | +2. Extend `BaseVisualizer` |
| 96 | +3. Add the `[assembly: DebuggerVisualizer(...)]` attribute |
| 97 | +4. Implement the required properties (`Title`, `Type`, `SupportedViews`) |
| 98 | +5. If needed, add parsing logic to the appropriate service |
| 99 | +6. Add unit tests in the Tests project |
| 100 | + |
| 101 | +## Testing |
| 102 | + |
| 103 | +The project uses xUnit with FluentAssertions. Tests cover: |
| 104 | +- Format detection (`FormatDetectorTests`) |
| 105 | +- Content formatting (`ContentFormatterTests`) |
| 106 | +- Encoding/decoding (`EncodingDecoderTests`) |
| 107 | +- Image decoding (`ImageDecoderTests`) |
| 108 | +- Syntax highlighting (`SyntaxHighlighterTests`) |
| 109 | + |
| 110 | +## Dependencies |
| 111 | + |
| 112 | +| Package | Purpose | |
| 113 | +|---------|---------| |
| 114 | +| AvalonEdit | Syntax highlighting | |
| 115 | +| Newtonsoft.Json | JSON parsing | |
| 116 | +| YamlDotNet | YAML parsing | |
| 117 | +| Tomlyn | TOML parsing | |
| 118 | +| System.IdentityModel.Tokens.Jwt | JWT decoding | |
| 119 | +| Markdig | Markdown rendering | |
| 120 | +| NCrontab | Cron expression parsing | |
| 121 | +| CsvHelper | CSV parsing | |
0 commit comments