Skip to content

Commit a3d78fc

Browse files
randleeclaude
andcommitted
docs: Add comprehensive documentation for v0.7.0 and v0.8.0 features
Added detailed documentation for the new impact classification (v0.7.0) and whitespace handling (v0.8.0) features: - Created docs/impact-classification.md (~3,450 words) - Four impact levels with detailed examples - Classification algorithm and decision matrix - CLI options and smart defaults - Caveat warning system - JSON Schema v2 documentation - Real-world use cases and examples - Created docs/whitespace-handling.md (~2,670 words) - Four whitespace modes with detailed behavior - Five whitespace issue types with detection - Language classification (11 significant, 14 insignificant) - Mode selection guide and best practices - Output format coverage for all modes - Updated docs/output-formats.md (~1,150 words added) - Split JSON schema into v1 (legacy) and v2 (current) - Added impact classification across all formats - Added whitespace warnings documentation - New jq examples for v2 schema - Updated README.md with concise overview - Added "Why Roslyn over tree-sitter?" section - Highlighted v0.7.0 and v0.8.0 features prominently - Added screenshot placeholders with links to samples - Documented new CLI options (--impact-level, --whitespace-mode) - Updated JSON example to show schema v2 - Added Synaptic Canvas integration section - Reorganized documentation links by category - Created samples/impact-demo/ with realistic examples - old.cs and new.cs demonstrating all impact levels - Generated output.json, output.html, output-filtered.json - samples/README.md with regeneration instructions - Created screenshot infrastructure - docs/screenshot-requirements.md with specifications - docs/images/ directory with README - Placeholder .TODO files with detailed capture instructions - Regenerated existing samples with v0.8.0 - Updated output-example.json and output-example.html - Now include impact classification and v2 schema Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6713f3f commit a3d78fc

16 files changed

+7654
-1590
lines changed

README.md

Lines changed: 129 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,68 @@ A semantic diff tool for .NET source code using Roslyn.
99

1010
roslyn-diff provides semantic-aware diffing capabilities for .NET source code. Unlike traditional line-by-line diff tools, roslyn-diff understands code structure using the Roslyn compiler platform, enabling it to detect and report changes at the semantic level (classes, methods, properties, etc.).
1111

12+
### Why Roslyn over tree-sitter?
13+
14+
For .NET languages (C# and Visual Basic), roslyn-diff uses Microsoft's Roslyn compiler instead of generic syntax parsers like tree-sitter:
15+
16+
- **Full semantic understanding** - Roslyn provides complete type information, symbol resolution, and semantic analysis, not just syntax trees
17+
- **Rename detection** - Can distinguish between a renamed method vs. delete+add because Roslyn tracks symbol identity
18+
- **Visibility tracking** - Knows if a member is public, internal, private, or protected for impact analysis
19+
- **Type-aware comparisons** - Understands that `int` and `System.Int32` are the same type
20+
- **Reference resolution** - Tracks cross-file dependencies and inheritance hierarchies
21+
- **Official .NET tooling** - Same compiler used by Visual Studio, ensuring 100% compatibility with C# and VB.NET language features
22+
23+
tree-sitter is excellent for general-purpose syntax highlighting and basic structural analysis, but Roslyn provides the deep semantic insight needed for accurate impact classification and change analysis in .NET codebases.
24+
1225
## Features
1326

27+
### Impact Classification (v0.7.0) 🎯
28+
29+
Automatically categorizes every code change by its potential impact on consumers:
30+
31+
- **Breaking Public API** - Changes that break external consumers (method signature changes, removed public members)
32+
- **Breaking Internal API** - Changes that break internal consumers (internal method renames, parameter changes)
33+
- **Non-Breaking** - Safe changes with no execution impact (private field renames, code reordering)
34+
- **Formatting Only** - Pure whitespace/comment changes
35+
36+
Each change includes visibility tracking, caveat warnings (e.g., "parameter rename may break named arguments"), and smart filtering. See [Impact Classification Guide](docs/impact-classification.md) for details.
37+
38+
### Whitespace Intelligence (v0.8.0) 🔍
39+
40+
Fine-grained whitespace handling with language-aware detection:
41+
42+
- **4 whitespace modes**: Exact, IgnoreLeadingTrailing, IgnoreAll, LanguageAware
43+
- **Automatic issue detection**: Indentation changes, mixed tabs/spaces, trailing whitespace, line ending changes
44+
- **Language-specific handling**: Exact mode for Python/YAML (whitespace-significant), normalized for C#/Java
45+
46+
See [Whitespace Handling Guide](docs/whitespace-handling.md) for comprehensive details.
47+
48+
### Core Features
49+
1450
- **Semantic Diff** - Understands code structure, not just text changes
15-
- **C# and VB.NET Support** - Full semantic analysis for both languages
51+
- **C# and VB.NET Support** - Full semantic analysis using Roslyn compiler platform
1652
- **Structural Change Detection** - Identifies changes to classes, methods, properties, and fields
1753
- **Rename Detection** - Detects when symbols are renamed (not just added/removed)
1854
- **Move Detection** - Identifies code that has been moved within a file
19-
- **Multiple Output Formats** - JSON, HTML, text, terminal
55+
- **Multiple Output Formats** - JSON (schema v2), HTML (interactive), text, terminal
2056
- **Class-to-Class Comparison** - Compare specific classes between files with flexible matching
2157
- **Line-by-Line Fallback** - Supports non-.NET files with traditional diff
2258

59+
## Screenshots
60+
61+
### HTML Output with Impact Classification
62+
63+
*Coming soon* - Interactive HTML report showing side-by-side diff with color-coded impact badges, caveat warnings, and IDE integration links. See [docs/images/](docs/images/) for screenshot specifications.
64+
65+
### JSON Output with Impact Breakdown
66+
67+
*Coming soon* - JSON Schema v2 output showing `impactBreakdown` statistics and per-change impact classification. See [docs/images/](docs/images/) for screenshot specifications.
68+
69+
For examples of what the output looks like, check out the [sample outputs](samples/):
70+
- [samples/impact-demo/output.html](samples/impact-demo/output.html) - Full HTML report with impact indicators
71+
- [samples/impact-demo/output.json](samples/impact-demo/output.json) - JSON with impact classification
72+
- [samples/output-example.html](samples/output-example.html) - Calculator example HTML report
73+
2374
## Installation
2475

2576
### As a .NET Tool (Coming Soon)
@@ -109,11 +160,25 @@ roslyn-diff diff <old-file> <new-file> [options]
109160
| `--quiet` | Suppress default console output (for scripting) |
110161
| `--no-color` | Disable colored output even if terminal supports it |
111162

163+
**Impact Filtering Options (v0.7.0):**
164+
| Option | Description | Default |
165+
|--------|-------------|---------|
166+
| `--impact-level <level>` | Filter by impact: `breaking-public`, `breaking-internal`, `non-breaking`, `all` | Format-dependent* |
167+
| `--include-non-impactful` | Include non-breaking and formatting changes (JSON only) | `false` |
168+
| `--include-formatting` | Include formatting-only changes | `false` |
169+
170+
\* JSON defaults to `breaking-internal` (shows breaking changes only), HTML defaults to `all` (shows everything for review)
171+
172+
**Whitespace Options (v0.8.0):**
173+
| Option | Short | Description | Default |
174+
|--------|-------|-------------|---------|
175+
| `--whitespace-mode <mode>` | | Whitespace handling: `exact`, `ignore-leading-trailing`, `ignore-all`, `language-aware` | `exact` |
176+
| `--ignore-whitespace` | `-w` | Shortcut for `--whitespace-mode ignore-all` | `false` |
177+
112178
**Diff Mode Options:**
113179
| Option | Short | Description | Default |
114180
|--------|-------|-------------|---------|
115181
| `--mode <mode>` | `-m` | Diff mode: `auto`, `roslyn`, `line` | `auto` |
116-
| `--ignore-whitespace` | `-w` | Ignore whitespace differences | `false` |
117182
| `--context <lines>` | `-C` | Lines of context to show | `3` |
118183

119184
**Default Behavior:**
@@ -179,37 +244,64 @@ roslyn-diff diff old.cs new.cs --json analysis.json
179244

180245
```json
181246
{
182-
"$schema": "roslyn-diff-output-v1",
247+
"$schema": "roslyn-diff-output-v2",
183248
"metadata": {
184-
"tool": "roslyn-diff",
249+
"version": "0.8.0",
250+
"timestamp": "2026-01-19T22:45:12Z",
185251
"mode": "roslyn",
186-
"oldPath": "old/Calculator.cs",
187-
"newPath": "new/Calculator.cs"
252+
"options": {
253+
"includeNonImpactful": false
254+
}
188255
},
189256
"summary": {
190-
"totalChanges": 3,
257+
"totalChanges": 4,
191258
"additions": 2,
192259
"deletions": 0,
193-
"modifications": 1
260+
"modifications": 2,
261+
"impactBreakdown": {
262+
"breakingPublicApi": 4,
263+
"breakingInternalApi": 0,
264+
"nonBreaking": 0,
265+
"formattingOnly": 0
266+
}
194267
},
195-
"changes": [...]
268+
"files": [{
269+
"changes": [{
270+
"type": "modified",
271+
"kind": "method",
272+
"name": "Process",
273+
"impact": "breakingPublicApi",
274+
"visibility": "public",
275+
"caveats": ["Parameter rename may break callers using named arguments"]
276+
}]
277+
}]
196278
}
197279
```
198280

281+
See [Output Formats Guide](docs/output-formats.md) for complete schema documentation.
282+
199283
### HTML (`--html`)
200284

201285
Interactive HTML report with:
202-
- Side-by-side diff view
203-
- Syntax highlighting
286+
- **Impact classification badges** - Color-coded indicators (Breaking Public API, Breaking Internal API, Non-Breaking, Formatting Only)
287+
- **Caveat warnings** - Yellow warning boxes for edge cases (e.g., "Parameter rename may break named arguments")
288+
- **Whitespace issue indicators** - Warnings for indentation changes, mixed tabs/spaces, etc.
289+
- Side-by-side diff view with syntax highlighting
290+
- Keyboard navigation (Ctrl+J/K for next/previous change)
204291
- Collapsible sections with copy buttons
205292
- IDE integration links (VS Code, Rider, PyCharm, Zed)
206-
- Navigation and summary statistics
293+
- Navigation panel and summary statistics
207294

208295
```bash
209296
# Generate and open in browser
210297
roslyn-diff diff old.cs new.cs --html report.html --open
298+
299+
# Filter to show only breaking changes in HTML
300+
roslyn-diff diff old.cs new.cs --html report.html --impact-level breaking-public
211301
```
212302

303+
See [Output Formats Guide](docs/output-formats.md) for details on all HTML features.
304+
213305
### Text (`--text`)
214306

215307
Structured plain text showing semantic changes:
@@ -413,12 +505,35 @@ var flatChanges = changes.Flatten().ToList();
413505

414506
This change fixes BUG-003 where duplicate nodes could be reported when using the old flat extraction method.
415507

508+
## Synaptic Canvas Integration
509+
510+
roslyn-diff is available as a skill in the Synaptic Canvas Claude Code plugin marketplace:
511+
512+
**[sc-roslyn-diff](https://github.com/randlee/synaptic-canvas/blob/develop/packages/sc-roslyn-diff/README.md)** - Claude Code integration for semantic .NET diff analysis
513+
514+
This plugin enables AI-powered code review and impact analysis:
515+
- Automatically analyzes pull requests for semantic changes
516+
- Generates natural language summaries of code modifications
517+
- Highlights breaking changes and potential impact on consumers
518+
- Integrates with GitHub workflows for automated code review
519+
520+
See the [Synaptic Canvas documentation](https://github.com/randlee/synaptic-canvas) for installation and usage instructions.
521+
416522
## Documentation
417523

524+
### Feature Guides
525+
526+
- **[Impact Classification Guide](docs/impact-classification.md)** - Complete guide to impact levels, filtering, caveats, and use cases (v0.7.0)
527+
- **[Whitespace Handling Guide](docs/whitespace-handling.md)** - Whitespace modes, language-aware detection, and best practices (v0.8.0)
528+
- [Output Formats](docs/output-formats.md) - Format specifications, JSON Schema v2, and feature comparison
529+
- [Sample Outputs](samples/README.md) - Example diffs with impact classification
530+
531+
### Reference Documentation
532+
418533
- [Usage Guide](docs/usage.md) - Detailed CLI usage and examples
419-
- [Output Formats](docs/output-formats.md) - Format specifications and schemas
420534
- [API Reference](docs/api.md) - Programmatic API documentation
421535
- [Architecture](docs/architecture.md) - Project structure and design
536+
- [Screenshot Requirements](docs/screenshot-requirements.md) - Documentation screenshot specifications
422537

423538
## Requirements
424539

docs/images/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# roslyn-diff Documentation Images
2+
3+
This directory contains screenshots and images used in the roslyn-diff documentation.
4+
5+
## Current Status
6+
7+
This directory is currently set up with placeholder files (`.TODO` files) that describe what screenshots need to be captured.
8+
9+
## Required Screenshots
10+
11+
### 1. `html-output-screenshot.png`
12+
**Status**: Pending (see `html-output-screenshot.png.TODO`)
13+
14+
**Purpose**: Showcase the HTML report output with impact badges, caveat warnings, side-by-side diff, and navigation features.
15+
16+
**Source**: `/Users/randlee/Documents/github/roslyn-diff/samples/impact-demo/output.html`
17+
18+
### 2. `json-impact-breakdown.png`
19+
**Status**: Pending (see `json-impact-breakdown.png.TODO`)
20+
21+
**Purpose**: Display the JSON output structure showing the impact classification breakdown and structured data format.
22+
23+
**Source**: `/Users/randlee/Documents/github/roslyn-diff/samples/impact-demo/output.json`
24+
25+
## How to Generate Screenshots
26+
27+
See the comprehensive guide in `/docs/screenshot-requirements.md` for:
28+
- Detailed specifications for each screenshot
29+
- Recommended dimensions and formats
30+
- Browser/tool recommendations
31+
- Quality standards and checklists
32+
- Sample code for browser automation (Playwright/Puppeteer)
33+
34+
## Quick Start
35+
36+
### Option 1: Manual Screenshots
37+
38+
1. Open `samples/impact-demo/output.html` in Chrome/Firefox at 1920x1400 viewport
39+
2. Capture the header + first 2-3 change sections with impact badges visible
40+
3. Save as `html-output-screenshot.png`
41+
42+
4. Open `samples/impact-demo/output.json` in VS Code with JSON formatting
43+
5. Capture metadata + summary (with impactBreakdown) + one sample change object
44+
6. Save as `json-impact-breakdown.png`
45+
46+
### Option 2: Browser Automation
47+
48+
Use Playwright or Puppeteer to generate screenshots programmatically. See examples in `/docs/screenshot-requirements.md`.
49+
50+
### Option 3: Request Screenshots
51+
52+
If you don't have the tools to create these screenshots, open a GitHub issue requesting screenshot generation and tag it with `documentation` and `help-wanted`.
53+
54+
## File Naming Convention
55+
56+
- `html-output-screenshot.png` - Main HTML output showcase
57+
- `json-impact-breakdown.png` - JSON output with impact data
58+
- `whitespace-warning-screenshot.png` - (Optional) Whitespace mode warnings
59+
- `navigation-features-screenshot.png` - (Optional) Interactive features
60+
61+
## Quality Requirements
62+
63+
All screenshots must meet these standards:
64+
- Format: PNG (lossless)
65+
- Max file size: < 500KB (use compression)
66+
- Text must be sharp and readable
67+
- No personal/sensitive information in paths
68+
- Consistent with other documentation images
69+
70+
## Usage
71+
72+
These screenshots are referenced in:
73+
- `README.md` - Main project overview
74+
- `docs/output-formats.md` - Output format documentation
75+
- `docs/usage.md` - User guide
76+
- GitHub releases and announcements
77+
78+
## Contributing
79+
80+
When adding new screenshots:
81+
1. Follow the specifications in `/docs/screenshot-requirements.md`
82+
2. Optimize file size using `pngquant` or similar tools
83+
3. Update this README with the new screenshot description
84+
4. Remove corresponding `.TODO` placeholder files
85+
5. Submit a pull request with the images
86+
87+
## Support
88+
89+
For questions about screenshot requirements or assistance with generation:
90+
- Review `/docs/screenshot-requirements.md`
91+
- Open a GitHub issue
92+
- Contact the maintainers

0 commit comments

Comments
 (0)