[tools] Add compare_styles_tool for style comparison#52
Merged
mattpodwysocki merged 2 commits intomainfrom Jan 12, 2026
Merged
Conversation
Implements a comprehensive style comparison tool that performs deep structural comparison of two Mapbox styles, identifying additions, removals, and modifications in layers, sources, and properties. Key features: - Deep object comparison with detailed diff reporting - Layer comparison by ID instead of array index - Metadata filtering (ignoreMetadata flag) - Support for JSON strings or objects as input - Structured output with difference paths and summaries The tool extends BaseTool for offline operation (no API calls). Special handling for Mapbox style layers ensures layers are compared by their ID property rather than position in the array. Test coverage: 16 comprehensive test cases covering all features including identical detection, property/layer differences, metadata handling, error cases, and nested changes. Documentation: Added comprehensive README documentation for all three validation tools (validate_geojson_tool, validate_expression_tool, compare_styles_tool) with usage examples and feature descriptions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This was referenced Jan 8, 2026
mattpodwysocki
added a commit
that referenced
this pull request
Jan 9, 2026
…roduction prompt Adds comprehensive style quality validation capabilities: Skill: - Created mapbox-style-quality skill document (390+ lines) - Pre-production checklist and validation best practices - Guidance on expression validation, GeoJSON validation, and accessibility - Optimization strategies and workflow recommendations - Integration patterns for Git hooks, CI/CD, and code review Prompt: - Created prepare-style-for-production prompt - Orchestrates validation workflow using 5 quality tools: * validate_expression_tool - Validate expressions in filters/paint/layout * validate_geojson_tool - Validate GeoJSON sources * check_color_contrast_tool - WCAG accessibility compliance * optimize_style_tool - Remove redundancies and optimize * compare_styles_tool - Compare versions (implicit in workflow) - Configurable WCAG level (AA/AAA) and optional optimization skip - Generates comprehensive quality report with deployment readiness assessment Testing: - 15 test cases for PrepareStyleForProductionPrompt - All 386 tests passing - Updated prompt registry tests Documentation: - Updated README with new skill listing - Added prompt documentation with usage examples - Cross-referenced skill and prompt Related PRs: - PR #50: validate_geojson_tool - PR #51: validate_expression_tool - PR #52: compare_styles_tool - PR #53: check_color_contrast_tool - PR #54: optimize_style_tool Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Valiunia
previously approved these changes
Jan 12, 2026
Valiunia
approved these changes
Jan 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a comprehensive style comparison tool that performs deep structural comparison of two Mapbox styles, identifying additions, removals, and modifications.
Key Features
ignoreMetadataflag to ignore metadata fields (id, owner, created, modified, draft, visibility)Implementation Details
BaseToolfor offline operation (no API calls required)Testing
All tests passing ✅
Documentation
Added comprehensive README documentation for all three validation tools:
validate_geojson_tool(PR Add validate_geojson_tool for offline GeoJSON validation #50)validate_expression_tool(PR Add validate_expression_tool for Mapbox expression validation #51)compare_styles_tool(this PR)Each tool is documented with parameters, features, return values, and example prompts.
Testing
Test 1: Identical Styles
Purpose: Verify that two identical styles are detected as identical
Prompt to Claude:
Compare these two Mapbox styles using compare_styles_tool:
Style A:
Style B: (same as Style A)
Expected Result:
Test 2: Color Change in Layer
Purpose: Detect a modified paint property
Prompt to Claude:
Compare these two styles where the background color changed:
Style A:
Style B:
Expected Result:
Test 3: Layer Added
Purpose: Detect when a new layer is added
Prompt to Claude:
Compare these styles where Style B has an additional water layer:
Style A:
Style B:
Expected Result:
Test 4: Layer Removed
Purpose: Detect when a layer is removed
Prompt to Claude:
Compare these styles where the water layer was removed in Style B:
Style A:
Style B:
Expected Result:
Test #5: Metadata Changes with ignoreMetadata=true
Purpose: Verify that metadata fields can be ignored
Prompt to Claude:
Compare these styles with ignoreMetadata=true. They differ only in metadata:
Style A:
Style B:
Use ignoreMetadata: true
Expected Result:
Test #6: Metadata Changes with ignoreMetadata=false
Purpose: Verify that metadata differences are detected when not ignored
Prompt to Claude:
Compare the same styles from Test #5, but with ignoreMetadata=false or omitted.
Expected Result:
Test #7: Layer Reordering (ID-based comparison)
Purpose: Verify that layers are compared by ID, not array position
Prompt to Claude:
Compare these styles where layers are in different order:
Style A:
Style B:
Expected Result:
Related PRs
Part of the offline validation tools initiative: