{"id":32791544,"url":"https://github.com/ozkrgonzalez/unifiedapexvalidator","last_synced_at":"2026-05-15T11:36:09.836Z","repository":{"id":322118460,"uuid":"1070173502","full_name":"ozkrgonzalez/UnifiedApexValidator","owner":"ozkrgonzalez","description":"Next-generation version of Unified Apex Validator, rebuilt entirely in TypeScript for VS Code.","archived":false,"fork":false,"pushed_at":"2025-11-02T16:40:12.000Z","size":6042,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-02T18:18:00.143Z","etag":null,"topics":["agentforce","ai-developer","ai-documentation","apex","salesforce","salesforce-apex","salesforce-code-analyzer","salesforce-developers","typescript","vscode-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=ozkrgonzalez.unifiedapexvalidator","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ozkrgonzalez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-05T12:21:45.000Z","updated_at":"2025-11-02T16:36:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ozkrgonzalez/UnifiedApexValidator","commit_stats":null,"previous_names":["ozkrgonzalez/unifiedapexvalidator"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ozkrgonzalez/UnifiedApexValidator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozkrgonzalez%2FUnifiedApexValidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozkrgonzalez%2FUnifiedApexValidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozkrgonzalez%2FUnifiedApexValidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozkrgonzalez%2FUnifiedApexValidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozkrgonzalez","download_url":"https://codeload.github.com/ozkrgonzalez/UnifiedApexValidator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozkrgonzalez%2FUnifiedApexValidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":282823603,"owners_count":26733133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-05T02:00:05.946Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentforce","ai-developer","ai-documentation","apex","salesforce","salesforce-apex","salesforce-code-analyzer","salesforce-developers","typescript","vscode-extension"],"created_at":"2025-11-05T13:01:12.958Z","updated_at":"2026-05-15T11:36:09.828Z","avatar_url":"https://github.com/ozkrgonzalez.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# 🧩 Unified Apex Validator\n\nA VS Code extension written in TypeScript that helps you **validate, test, and document** your Salesforce Apex projects — all in one place. It scans your `package.xml`, runs tests, checks code quality with Salesforce Code Analyzer (PMD + CPD), and exports slick HTML/PDF reports. You can even plug in **Einstein GPT** for AI-powered feedback and auto-generated ApexDocs.\n\n---\n\n## 🚀 Features\n\n- 🧩 Apex class validation using Salesforce Code Analyzer v5 (PMD + CPD).\n- 🔍 Duplicate code detection across your repo.\n- 🧪 Apex test execution via Salesforce CLI with coverage metrics.\n- 🧠 Optional Einstein GPT insights for risk detection and improvements.\n- 🧾 Automatic HTML/PDF report generation with an integrated VS Code viewer.\n- 🧭 Sidebar views for reports, logs, and dependency checks.\n- ⚡ Quick commands: Validate Apex, Refresh views, Open output folders.\n- 🤖 AI-powered ApexDoc generation (beta) with tag enforcement.\n- 🧱 Allman-style Apex formatter for .cls/.trigger files (leverages workspace prettier + prettier-plugin-apex).\n- 🧹 Command palette action to strip System.debug(...) statements across the active selection or file.\n- 🔄 Compare local metadata vs. your org (Monaco diff view for text assets, size checks for binaries).\n- 🕸️ “Where is Used” report — scans dependencies across Apex Classes, Flows, and LWC, rendered in a clean interactive tree view.\n- 🎨 Unified dark-themed report design — for a consistent visual experience, and interactive search across all HTML reports.\n- 🌐 Multilingual reports — HTML/PDF templates honor your VS Code locale or a workspace override (Spanish/English) with per-report language switching.\n\n---\n\n## 🧰 Requirements\n\n### System\n\n- Node.js 18+ and npm 9+.\n- Salesforce CLI (`sf`) with Java 11 or newer.\n- wkhtmltopdf (for PDF export, Optional, but Recommended).\n- Prettier and Prettier-Plugin-Apex.\n- An authenticated Salesforce org through the CLI.\n- Einstein GPT credentials (Client Id/Secret) if you plan to use AI features.\n\n---\n\n## ⚙️ Settings\n\nYou’ll find them under **Unified Apex Validator** in your VS Code settings.\n\n| Setting | Description |\n| -------- | ----------- |\n| `sfClientId` | Einstein GPT Connected App client id |\n| `sfClientSecret` | Einstein GPT Connected App client secret |\n| `sfDomain` | Salesforce domain (My Domain URL) |\n| `sfRepositoryDir` | Local repo path with your Apex code |\n| `sfCliPath` | Custom Salesforce CLI path (defaults to `sf`) |\n| `pmdPath` | Optional PMD binary path |\n| `outputDir` | Folder for HTML/PDF reports |\n| `skipIAAnalysis` | Skip Einstein GPT analysis |\n| `sfGptEndpoint` | Einstein GPT API endpoint |\n| `sfGptModel` | GPT model name |\n| `iaPromptTemplate` | Custom AI prompt template |\n| `maxIAClassChars` | Max characters per class sent to GPT |\n| `keepLogFiles` | Keep log files after success |\n| `traceAst` | Enable AST tracing (debug) |\n| `classDocTags` | Required ApexDoc tags for classes |\n| `methodDocTags` | Required ApexDoc tags for methods |\n| `apexDocLanguage` | Language used by the AI ApexDoc generator (`spanish` or `english`) |\n| `reportLanguage` | Controls report language: `auto` (follow VS Code locale), `es`, or `en` |\n\nUAV usa automáticamente la org marcada como `isDefaultUsername` en `sf org list --json`. Asegúrate de tener una org por defecto conectada (`sf org login web`) antes de ejecutar el validador.\n\n\n💡 *Dependencies view highlights missing GPT setup fields and disables AI commands until everything’s filled in.*\n\n---\n\n## 🕹️ How to Use\n\n1. Right-click a `package.xml` file.\n2. Select **UAV: Validate Apex Code**.\n3. Track progress in the **Unified Apex Validator** output channel.\n4. Review reports or logs in the sidebar.\n5. (Optional) Run **UAV: Compare Metadata against Org** to diff your local vs. org versions.\n6. (Optional) Use **UAV: Formatear Apex (Allman)** from the explorer/editor context menu to apply Allman braces to selected `.cls`/`.trigger` files (requires `prettier` + `prettier-plugin-apex` in your workspace).\n7. (Optional) Use **UAV: Where is Used** from the editor context menu to run a report that scans dependencies across Apex Classes, Flows, and LWC, showing where each element is referenced.\n8. (Optional) Use **UAV: Remove System.debug Statements** from the command palette to clean debug output in the active editor or current selections.\n\n### 🔄 Metadata Comparison\n\n- Available from the explorer and editor context menus for package.xml manifests and supported metadata files (classes, triggers, flows, Lightning bundles, etc.).\n- From a manifest, UAV retrieves every type/member declared under \u003ctypes\u003e; from a single file it infers the metadata type automatically before running the retrieve.\n- Text assets render in the Monaco diff view with syntax highlighting, while binaries surface size differences so you can decide whether to download them.\n\n📝 HTML/PDF reports render in the language defined by `UnifiedApexValidator.reportLanguage` (default `auto`). The HTML viewer also exposes a globe selector so teammates can switch between Español and English on demand.\n\n---\n\n## 🧭 VS Code Views\n\n### 📊 Reports\nShows all generated reports (HTML/PDF) with options to refresh, open folder, or view inline in VS Code.\n\n### 📜 Logs\nLists `.log` files stored under `~/.uav/logs`. Quick buttons to refresh or open the folder.\n\n### 🔧 Dependencies\nChecks Node.js, CLI, Java, wkhtmltopdf, Code Analyzer, and Einstein GPT configuration. Missing ones show in red and can be fixed from here.\n\n---\n\n## 🤖 Einstein GPT Setup\n\n1. Create an **External Connected App** with scopes `api` and `refresh_token`.\n   📘 Helpful docs:\n   - [Access Models API with REST](https://developer.salesforce.com/docs/einstein/genai/guide/access-models-api-with-rest.html)\n   - [Einstein Generative AI Setup](https://developer.salesforce.com/docs/einstein/genai/guide/org-setup.html)\n2. Assign a user with **API Enabled** and **API Only User** permissions.\n3. Turn on Einstein in Setup → *Einstein Generative AI*.\n4. Configure your VS Code settings (`sfClientId`, `sfClientSecret`, `sfGptEndpoint`, `sfGptModel`, `iaPromptTemplate`).\n5. Authenticate your org via CLI:\n   ```bash\n   sf org login web --alias \u003calias\u003e\n   ```\n6. Refresh the **Dependencies** view — once all fields are set, AI features will unlock automatically.\n\n---\n\n## 🧾 ApexDoc Generation (Beta)\n\n- Command: **UAV: Generate ApexDoc**.\n- Uses Einstein GPT to auto-generate documentation.\n- Ensures required tags (`@param`, `@return`, etc.) are filled.\n- Disabled when Einstein GPT config is incomplete or `skipIAAnalysis` is true.\n\n---\n\n## 🧯 Troubleshooting\n\n### 🧩 Extension not showing\n- Make sure the `.vsix` is installed or from Marketplace.\n- Run **Developer: Reload Window**.\n- Check the **Unified Apex Validator** output channel.\n\n### ⚠️ `sf` or `pmd` not found\n- Run `sf --version` and `java -version`.\n- Update PATH or reinstall if needed.\n\n### 🚫 Default org not connected\n- Ejecuta `sf org list --json` y verifica que alguna org tenga `isDefaultUsername: true`.\n- Si no existe, ejecuta `sf org login web` y marca la org como predeterminada.\n- Una vez conectada, vuelve a lanzar el validador.\n\n### 📄 No reports generated\n- The XML must contain `\u003cname\u003eApexClass\u003c/name\u003e`.\n- Make sure `outputDir` exists and is writable.\n\n### 🤖 AI analysis skipped\n- Check `sfClientId`, `sfClientSecret`, `sfGptEndpoint`, `sfGptModel`, and `iaPromptTemplate`.\n- Ensure `skipIAAnalysis` is `false`.\n\n### 🪵 Logs missing\n- Set `keepLogFiles = true`.\n- Logs live under:\n  ```\n  .../globalStorage/ozkrgonzalez.unifiedapexvalidator/.uav/logs\n  ```\n\n\n### Allman formatter not working\n- Install `prettier` and `prettier-plugin-apex` in the workspace that contains your `.cls`/`.trigger` files (`npm install --save-dev prettier prettier-plugin-apex`).\n- Refresh the **Dependencies** view to confirm both are detected (status should display in green).\n- Run **UAV: Formatear Apex (Allman)** again from the explorer/editor context menu.\n\n---\n\n## 🗺️ Roadmap\n\n- 🎚️ Configurable log levels\n- 💬 Dependency tooltips with detected versions\n- 🤖 Deeper Einstein GPT insights per class\n- 📦 Markdown and CSV export options\n- 🏪 Marketplace release with verified Salesforce badge\n\n---\n\n## 👨‍💻 Author\n\nCreated by **Oscar Gonzalez**\nGitHub: [@ozkrgonzalez](https://github.com/ozkrgonzalez)\n\n---\n\n## 📄 License\n\n**GPL v3 © 2025 – Oscar Gonzalez**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozkrgonzalez%2Funifiedapexvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozkrgonzalez%2Funifiedapexvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozkrgonzalez%2Funifiedapexvalidator/lists"}