Skip to content

Latest commit

 

History

History
121 lines (95 loc) · 4.48 KB

File metadata and controls

121 lines (95 loc) · 4.48 KB

CLAUDE.md

This file provides guidance to Claude Code when working with code in this repository.

Critical Rules

These rules override all other instructions:

  1. NEVER commit directly to main - Always create a feature branch and submit a pull request
  2. Conventional commits - Format: type(scope): description
  3. GitHub Issues for TODOs - Use gh CLI to manage issues, no local TODO files
  4. Pull Request titles - Use conventional commit format (same as commits)
  5. Branch naming - Use format: type/scope/short-description (e.g., feat/visualizer/add-json-support)
  6. Working an issue - Always create a new branch from an updated main branch
  7. Check branch status before pushing - Verify remote tracking branch exists
  8. No co-authors - Do not add co-author information on commits or pull requests
  9. No "generated by" statements - Do not add generated-by statements on pull requests
  10. No #pragma warning directives - Fix warnings properly instead of suppressing them with #pragma directives
  11. Consistent naming - Assembly name and root namespace must match the folder/project name

Project Overview

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.

Technology Stack

  • Framework: .NET Framework 4.8
  • SDK: CodingWithCalvin.VsixSdk 0.4.0
  • Target: Visual Studio 2022 (17.x)
  • UI Framework: WPF
  • Syntax Highlighting: AvalonEdit

Build Commands

# Build the solution
dotnet build src/CodingWithCalvin.Debugalizers.slnx

# Build in Release mode
dotnet build src/CodingWithCalvin.Debugalizers.slnx --configuration Release

# Run tests
dotnet test src/CodingWithCalvin.Debugalizers.slnx

Project Structure

src/
├── CodingWithCalvin.Debugalizers/          # Main VSIX project
│   ├── Visualizers/                        # Debug visualizer implementations
│   │   ├── DataFormats/                    # JSON, XML, YAML, etc.
│   │   ├── Encoded/                        # Base64, URL encoded, etc.
│   │   ├── Security/                       # JWT, SAML, Certificates
│   │   ├── Structured/                     # URI, Connection strings, etc.
│   │   └── Binary/                         # Hex dump, GUID, Timestamp
│   ├── UI/                                 # WPF views and windows
│   │   └── Views/                          # Individual view controls
│   └── Services/                           # Core services
└── CodingWithCalvin.Debugalizers.Tests/    # Unit tests

Architecture

Visualizer Pattern

All visualizers extend BaseVisualizer:

[assembly: DebuggerVisualizer(
    typeof(JsonVisualizer),
    typeof(VisualizerObjectSource),
    Target = typeof(string),
    Description = "Debugalizers: JSON")]

public class JsonVisualizer : BaseVisualizer
{
    protected override string Title => "JSON";
    protected override VisualizerType Type => VisualizerType.Json;
    protected override IEnumerable<ViewType> SupportedViews =>
        new[] { ViewType.Formatted, ViewType.Tree, ViewType.Raw };
}

Core Services

  • FormatDetector: Auto-detects content type from strings
  • ContentFormatter: Pretty-prints and formats various content types
  • EncodingDecoder: Decodes Base64, URL encoding, HTML entities, etc.
  • ImageDecoder: Decodes Base64/data URI images
  • SyntaxHighlighter: Provides AvalonEdit syntax highlighting

Adding a New Visualizer

  1. Create a new class in the appropriate Visualizers/ subdirectory
  2. Extend BaseVisualizer
  3. Add the [assembly: DebuggerVisualizer(...)] attribute
  4. Implement the required properties (Title, Type, SupportedViews)
  5. If needed, add parsing logic to the appropriate service
  6. Add unit tests in the Tests project

Testing

The project uses xUnit with FluentAssertions. Tests cover:

  • Format detection (FormatDetectorTests)
  • Content formatting (ContentFormatterTests)
  • Encoding/decoding (EncodingDecoderTests)
  • Image decoding (ImageDecoderTests)
  • Syntax highlighting (SyntaxHighlighterTests)

Dependencies

Package Purpose
AvalonEdit Syntax highlighting
Newtonsoft.Json JSON parsing
YamlDotNet YAML parsing
Tomlyn TOML parsing
System.IdentityModel.Tokens.Jwt JWT decoding
Markdig Markdown rendering
NCrontab Cron expression parsing
CsvHelper CSV parsing