Files
Jaganpro 835106da70 feat: fix Code Analyzer integration and auto-install on sf-skills setup
Three fixes that make sf code-analyzer (PMD/CPD) work end-to-end:

1. Installer: Add copy_code_analyzer() to copy shared/code_analyzer/
   to ~/.claude/code_analyzer/ during install/update. Previously this
   module was never copied, so validators always got "No module named
   'code_analyzer'".

2. Installer: Add ensure_code_analyzer_plugin() to auto-install
   @salesforce/plugin-code-analyzer if missing during install/update.

3. Scanner: Set cwd to the file's directory when running sf code-analyzer
   so workspace resolution works correctly (was defaulting to
   ~/.claude/skills/ which caused "target does not exist underneath
   workspace" errors).

4. Validator path: Fix post-tool-validate.py module resolution to find
   code_analyzer at ~/.claude/code_analyzer/ (installed) or
   shared/code_analyzer/ (dev repo).

Tested: PMD now catches SOQL-in-loop, hardcoded IDs, CRUD violations,
unused variables, and missing ApexDoc — 11 issues that the regex
scorer missed entirely.

Jag Valaiyapathy
2026-03-24 19:54:54 -04:00
..