Skip to content

Conversation

poltorak
Copy link
Collaborator

Summary

Introduce report-all-violations, an MCP tool that scans a directory for all Design System (DS) deprecated CSS violations across every configured DS component and outputs a consolidated report.

What it does

  • Loads all DS components from the deprecated CSS config.
  • Runs a single coverage analysis for the target directory.
  • Formats results identically to report-violations, respecting groupBy.

Why

  • Avoids N-per-component scans by analyzing once for all components.
  • Produces a unified, refactor-ready view of violations.

Changes

  • Added packages/angular-mcp-server/src/lib/tools/ds/report-violations/report-violations-all.tool.ts.
  • Reused shared utilities:
    • Config loading/validation: loadAndValidateDsComponentsFile.
    • Coverage engine: analyzeProjectCoverage.
    • Output formatting: formatViolations (keeps parity with report-violations).
  • Registered the tool in DS tools registry.

Usage

  • Tool: report-all-violations
  • Params:
    • directory (string): directory to scan
    • groupBy ('file' | 'folder'; default: 'file')

Output format

  • Matches report-violations:
    • groupBy=file: per-file entries with component → lines
    • groupBy=folder: folder summaries consistent with the shared formatter

@poltorak poltorak force-pushed the feature/find-all-violations branch from ad44faa to a58480b Compare August 26, 2025 14:36

1. Run a scan using the report-violations function with the following parameters:
- component: {{COMPONENT_NAME}}
1. Run a scan using the report-all-violations function with the following parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primary method still remains report-violations, this should be mentioned as alternative

Comment on lines 19 to 23
2. Deduplicate violations by file and line:
- Process scanResult to remove duplicate entries that have the same file path and line number
- When combining duplicates, merge the component/class information (e.g., "btn, btn-primary violations on line 10")
- Keep the deduplicated count for accurate violation totals
- Store the deduplicated result and use it for all subsequent processing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedup is a bug, that should be fixed in visitor, we shouldn't mention that here.

2. Run a file-level scan:
- Use the report-violations function with these parameters:
- component: {{COMPONENT_NAME}}
- Use the report-all-violations function with these parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, just violations is primary

Comment on lines 62 to 66
3. Deduplicate violations by file and line:
- Process fileScan to remove duplicate entries that have the same file path and line number
- When combining duplicates, merge the component/class information
- Keep the deduplicated count for accurate violation totals
- Store the deduplicated result and use it for all subsequent processing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have this again?


1. Run a scan using the report-violations function with the following parameters:
- component: {{COMPONENT_NAME}}
1. Run a scan using the report-all-violations function with the following parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave current rule as is and create a separate one.

<component_docs>{{COMPONENT_DOCS}}</component_docs>: The official documentation for the target design-system component
<component_code>{{COMPONENT_CODE}}</component_code>: The source files of the target design-system component
<usage_graph>{{USAGE_GRAPH}}</usage_graph>: A graph showing the usage of the legacy component in the specified folder
<component_docs>{{COMPONENT_DOCS}}</component_docs>: The official documentation for the target design-system components
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, please keep original rule and create new one

Copy link
Collaborator

@rapczynska rapczynska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetic changes related to the order in naming conventions to be done, but nothing blocking that cannot go in a separate PR.

- `02-plan-refactoring.mdc` - Create detailed migration strategy for specific cases

**Option B: Comprehensive Approach** (recommended for large-scale migrations)
- `01a-find-all-violations.mdc` - Scan entire codebase, group by folders, select subfolder for detailed analysis
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option B and file name 01a. Not that critical, but inconsistent.

- `02a-plan-refactoring-for-all-violations.mdc` - Create comprehensive migration plan for all violations in scope

**Continuation Steps** (used with both approaches):
- `03-non-viable-cases.mdc` - Handle non-migratable components by marking them for exclusion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that we have two 03 step files.

@poltorak poltorak merged commit f32cd79 into main Aug 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants