@W-21102094 - Add PMD XPath custom rule creation tool with AST prompt generation#381
Open
aruntyagiTutu wants to merge 26 commits intomainfrom
Open
@W-21102094 - Add PMD XPath custom rule creation tool with AST prompt generation#381aruntyagiTutu wants to merge 26 commits intomainfrom
aruntyagiTutu wants to merge 26 commits intomainfrom
Conversation
* extractAstNodes from xml implementation * optimize the method using regex * extract ast nodes from xml
* mcp tool added in provider * add GenerateXpathPromptMcpTool in test * update test
* get metadata of ast nodes of apex langugae * pmd apex ast cache
* implemented create custom rule tool * test update
* add validation that this implementation supports pmd only for now * update prompt - optimize for output size * refactor create tool * file name santization * updated action name * update prompt * update prompt optimize for simple xpath * fix tests * fix test with mock
…y methods (#386) * langugae in ruleset template * update telemetry on success * xpath is optional * clean chuncky methods
packages/mcp-provider-code-analyzer/src/tools/create_custom_rule.ts
Outdated
Show resolved
Hide resolved
nikhil-mittal-165
approved these changes
Feb 25, 2026
iowillhoit
reviewed
Mar 5, 2026
| @@ -0,0 +1 @@ | |||
| mcp-provider-code-analyzer No newline at end of file | |||
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.
What does this PR do?
@W-21102094@
What issues does this PR fix or reference?
This PR introduces an end‑to‑end flow for creating PMD XPath custom rules. It generates PMD AST XML from sample Apex code, extracts AST nodes and cached metadata, builds a high‑signal prompt for XPath generation, and then writes a PMD ruleset XML plus updates code-analyzer.yml (with relative custom ruleset paths). It also adds engine strategies/pipeline/adapters to keep the workflow extensible for future engines, along with tests and tool registration updates.
Notes / Future Work
The Apex AST reference JSON is cached locally in the provider to enable prompt enrichment in phase 1. This is a temporary placement and will move into the PMD engine implementation in core once the engine plugin owns AST metadata.
PMD CLI integration is used to generate AST XML in phase 1. This will be replaced by a PMD engine API in core (Java SDK or internal API) so we can avoid external process execution and share logic across tools.