pmd-ruleset-visualizer 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,216 @@
1
- # Temporary Holding Version
1
+ # PMD Ruleset Visualizer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A local-first Node.js app for exploring, visualizing, editing, and running PMD XML rulesets. No data is sent to any third-party service.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ ### 1. Java
10
+
11
+ PMD requires Java 11 or later. Install Java 17 via Homebrew on macOS:
12
+
13
+ ```bash
14
+ brew install openjdk@17
15
+ ```
16
+
17
+ After installation, check the path:
18
+
19
+ ```bash
20
+ which java
21
+ # /opt/homebrew/opt/openjdk@17/bin/java
22
+ java -version
23
+ # openjdk version "17.x.x" ...
24
+ ```
25
+
26
+ If `java` is not found, add it to your PATH (Homebrew will print the exact command after install):
27
+
28
+ ```bash
29
+ echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
30
+ source ~/.zshrc
31
+ ```
32
+
33
+ ---
34
+
35
+ ### 2. PMD
36
+
37
+ Download and install PMD 7 from the official GitHub releases:
38
+
39
+ ```bash
40
+ cd $HOME
41
+ curl -OL https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.18.0/pmd-dist-7.18.0-bin.zip
42
+ unzip pmd-dist-7.18.0-bin.zip
43
+ ```
44
+
45
+ Add a convenient alias (add to `~/.zshrc` to make it permanent):
46
+
47
+ ```bash
48
+ alias pmd="$HOME/pmd-bin-7.18.0/bin/pmd"
49
+ ```
50
+
51
+ Verify:
52
+
53
+ ```bash
54
+ pmd --version
55
+ # PMD 7.18.0
56
+ ```
57
+
58
+ Quick test run:
59
+
60
+ ```bash
61
+ pmd check -d /usr/src -R rulesets/java/quickstart.xml -f text
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Installation
67
+
68
+ Requires **Node.js 18+**.
69
+
70
+ ```bash
71
+ npm install -f pmd-ruleset-visualizer
72
+ ```
73
+
74
+ The bundled `public/sample-ruleset.xml` is loaded automatically on first open so the app is never blank. It is included in the published npm package via the `files` field in `package.json`.
75
+
76
+ ---
77
+
78
+ ## Start
79
+
80
+ ```bash
81
+
82
+ pmd-ruleset-visualizer -p 4933 --open
83
+ ---
84
+
85
+ ## CLI Flags
86
+
87
+ | Flag | Description |
88
+ |------|-------------|
89
+ | `-p <port>` / `--port <port>` | Port to listen on (default: `3000` or `$PORT`) |
90
+ | `--open` | Open the app in the default browser after starting |
91
+ | `-h` / `--help` | Show help and exit |
92
+
93
+ ---
94
+
95
+ ## Features
96
+
97
+ ### Splash Screen & Guided Tour
98
+ - A branded splash screen appears on every load with an animated progress bar (2.5 s auto-dismiss).
99
+ - **"Start Tour ▶"** launches a 9-step guided tour of the entire app.
100
+ - **"Get Started →"** skips straight to the app.
101
+ - The **◉** button in the top-right restarts the tour at any time.
102
+ - Each tour step highlights the relevant element, scrolls it into view, and shows an auto-positioned tooltip with Prev / Next / ✕ controls. Press `Esc` to exit.
103
+
104
+ ### Explore Tab
105
+ - Upload or paste PMD ruleset XML (drag-and-drop supported).
106
+ - Cards and list view with search, category filter, and priority filter.
107
+ - Rule detail panel: view/edit priority and enabled state.
108
+ - Bulk edit mode: select multiple rules and apply priority or enable/disable.
109
+
110
+ ### Graph Tab
111
+ - **Category doughnut** — rules grouped by PMD category.
112
+ - **Priority bar chart** — distribution across Priority 1–5 and Unset.
113
+
114
+ ### Health Tab
115
+ - Rule health dashboard with category and priority distribution summaries.
116
+
117
+ ### Treemap Tab
118
+ - SVG slice-and-dice treemap of rule categories sized by rule count.
119
+
120
+ ### Compare Tab
121
+ - Load a second ruleset to see **added**, **removed**, and **modified** rules side-by-side.
122
+ - Keyed on `ref` attribute; reports priority, message, and property changes.
123
+
124
+ ### Catalog Tab
125
+ - Upload PMD category XML files to validate that every `ref` in your ruleset actually exists in those files.
126
+
127
+ ### Merge Tab
128
+ - Import a second ruleset and cherry-pick individual rules to merge into the current one.
129
+
130
+ ### Run Tab
131
+ - Run PMD against a local source directory using your installed PMD binary.
132
+ - Results include a **TIME TAKEN** stat alongside violation counts.
133
+ - Rendered as:
134
+ - **Priority doughnut** — violations grouped by severity.
135
+ - **Top-10 rules bar chart** — rules with the most violations.
136
+ - **Per-file violation list** — click a file to open it in Monaco.
137
+ - Pre-built **Apex presets**: `apex-security`, `apex-bestpractices`, `apex-performance`, `apex-all`.
138
+ - **Export XLSX** — downloads a workbook with three data sheets (Violations, By Priority, By Rule) plus a Charts sheet with the priority and rule PNG images embedded. Sheets use green header rows and zebra-stripe row coloring.
139
+
140
+ ### Monaco Code Viewer
141
+ - Apex source file displayed with syntax highlighting.
142
+ - Violation lines highlighted in red with gutter markers.
143
+ - Clickable violation list on the left to jump to specific lines.
144
+ - **Resizable panel** — drag the left edge to adjust width.
145
+ - Lazy-loaded — only fetches Monaco (~2 MB) on first use.
146
+
147
+ ---
148
+
149
+ ## On First Load
150
+
151
+ The app auto-loads a ruleset in this priority order:
152
+
153
+ 1. **URL hash** — if the URL contains `#v=1&r=…` (shared link), that ruleset is decompressed and loaded.
154
+ 2. **Default ruleset** — if a path is saved in Settings → Default ruleset path, the server reads that file and loads it.
155
+ 3. **Sample ruleset** — `public/sample-ruleset.xml` is loaded and visualized automatically so the app is never blank.
156
+
157
+ When you open a ruleset file via the file picker and successfully visualize it, a dialog asks:
158
+ > *"Save as default ruleset?"*
159
+
160
+ Enter the full file path and click **Save as default** — the server will read it automatically on every subsequent startup.
161
+
162
+ ---
163
+
164
+ ## Settings
165
+
166
+ Click the **⚙** button (top-right) to open the settings panel. All settings are saved to `localStorage`.
167
+
168
+ | Setting | Description |
169
+ |---------|-------------|
170
+ | PMD Binary Path | Full path to the `pmd` executable |
171
+ | Source Directory | Directory to scan when running PMD |
172
+ | Language | Force-language for PMD (e.g., `apex`) |
173
+ | Minimum Priority | Only report violations at or above this priority |
174
+ | Default Ruleset Path | Absolute file path — loaded automatically on startup via the server |
175
+
176
+ ---
177
+
178
+ ## Keyboard Shortcuts
179
+
180
+ | Key | Action |
181
+ |-----|--------|
182
+ | `/` | Focus search |
183
+ | `j` / `k` | Navigate rule list |
184
+ | `e` | Open rule detail |
185
+ | `Esc` | Close detail / modal / code view / tour |
186
+ | `?` | Show keyboard help |
187
+
188
+ ---
189
+
190
+ ## URL Sharing
191
+
192
+ Click **Share** to generate a URL with the current ruleset compressed into the hash. Recipients open the URL and the ruleset loads automatically — no server required.
193
+
194
+ ---
195
+
196
+ ## Dark Mode
197
+
198
+ Click the ☽/☀ button (top-right) to toggle dark mode. The preference is saved to `localStorage`.
199
+
200
+ ---
201
+
202
+
203
+
204
+ ## Important Notes
205
+
206
+ - All XML parsing is local. No ruleset content is sent to any external service.
207
+ - PMD is invoked as a local subprocess via `execFile`. PMD exit code `4` means violations were found — this is expected behavior, not an error.
208
+ - Catalog validation is opt-in: it checks names against uploaded category files; it does not run PMD.
209
+ - Export XML applies in-app edits to the raw XML. Review before using in CI/CD.
210
+ - XLSX export is server-side (ExcelJS). Chart images are captured from the live Chart.js canvases and embedded as PNGs.
211
+
212
+ ---
213
+
214
+ ## License
215
+
216
+ MIT — Author: Mohan Chinnappan
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "pmd-ruleset-visualizer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "Local graphical explorer and runner for PMD XML rulesets with Monaco editor integration",
6
+ "main": "server.js",
7
+ "author": "Mohan Chinnappan",
8
+ "license": "MIT",
9
+ "keywords": [
10
+ "pmd",
11
+ "ruleset",
12
+ "visualizer",
13
+ "apex",
14
+ "salesforce",
15
+ "static-analysis",
16
+ "code-quality",
17
+ "linting",
18
+ "xml",
19
+ "monaco-editor",
20
+ "chart.js",
21
+ "nodejs"
22
+ ],
23
+ "files": [
24
+ "server.js",
25
+ "public/",
26
+ "public/sample-ruleset.xml",
27
+ "README.md"
28
+ ],
29
+ "bin": {
30
+ "pmd-ruleset-visualizer": "./server.js",
31
+ "pmd-rv":"./server.js"
32
+ },
33
+ "scripts": {
34
+ "start": "node server.js",
35
+ "dev": "node --watch server.js",
36
+ "build": "obfuscli build -p . -o ./dist --preset medium --exclude 'node_modules,dist,.git,*.xml,*.md,*.json,*.css,*.ico,*.html' && rm -f dist/CLAUDE.md dist/SKILLS.md"
37
+ },
38
+ "dependencies": {
39
+ "exceljs": "^4.4.0",
40
+ "express": "^5.1.0",
41
+ "fast-xml-parser": "^5.2.5",
42
+ "multer": "^2.0.2"
43
+ }
44
+ }