@shakecodeslikecray/whiterose 0.2.7 → 1.0.1

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
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@shakecodeslikecray/whiterose.svg)](https://www.npmjs.com/package/@shakecodeslikecray/whiterose)
4
4
  [![License: PolyForm Noncommercial](https://img.shields.io/badge/License-PolyForm%20NC%201.0-blue.svg)](LICENSE)
5
- [![Test Coverage](https://img.shields.io/badge/coverage-93%25-brightgreen.svg)]()
6
5
 
7
6
  > "I've been staring at your code for a long time."
8
7
 
@@ -17,198 +16,40 @@ AI-powered bug hunter that uses your existing LLM subscription. No API keys need
17
16
  ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
18
17
  ```
19
18
 
20
- ## Why whiterose?
21
-
22
- You're already paying for Claude Code Max, Cursor, Codex, or similar AI coding tools. Why pay again for bug detection APIs?
23
-
24
- whiterose piggybacks on your existing subscription to find bugs in your code. Zero additional cost.
25
-
26
- ## Features
27
-
28
- - **Leverages Existing AI Agents**: Uses Claude Code, Aider, or other LLM CLI tools you already have
29
- - **Real-Time Progress**: See exactly which files are being analyzed as it happens
30
- - **Grounded in Reality**: Uses static analysis (tsc, eslint) as signals. Requires code path traces.
31
- - **Intent-Aware**: Merges your existing documentation with AI-generated understanding
32
- - **Provider Agnostic**: Works with Claude Code, Aider, Codex, and more
33
- - **Fix Any Bug**: Fix whiterose-found bugs, import from SARIF files, GitHub issues, or describe manually
34
- - **Interactive Menu**: Just run `whiterose` to get started
35
-
36
19
  ---
37
20
 
38
- ## Three-Layer Architecture
39
-
40
- whiterose operates in three distinct layers:
41
-
42
- ```
43
- ┌─────────────────────────────────────────────────────────────────────┐
44
- │ LAYER 0: DOCUMENTATION │
45
- (whiterose init)
46
- │ │
47
- Reads existing docs: AI generates understanding: │
48
- - README.md - Project type │
49
- - package.json - Framework detection │
50
- - CONTRIBUTING.md - Feature extraction │
51
- - .env.example - Behavioral contracts │
52
- - API docs - Architecture mapping │
53
- │ │
54
- │ Output: .whiterose/intent.md + .whiterose/cache/understanding.json │
55
- └─────────────────────────────────────────────────────────────────────┘
56
-
57
-
58
- ┌─────────────────────────────────────────────────────────────────────┐
59
- │ LAYER 1: BUG FINDING │
60
- │ (whiterose scan) │
61
- │ │
62
- │ 1. Load understanding from Layer 0 │
63
- │ 2. Run static analysis (tsc, eslint) as pre-filter │
64
- │ 3. Spawn LLM agent to explore codebase │
65
- │ 4. Stream progress in real-time │
66
- │ 5. Collect bugs with evidence and code paths │
67
- │ │
68
- │ Output: .whiterose/reports/*.sarif + BUGS.md │
69
- └─────────────────────────────────────────────────────────────────────┘
70
-
71
-
72
- ┌─────────────────────────────────────────────────────────────────────┐
73
- │ LAYER 2: BUG FIXING │
74
- │ (whiterose fix) │
75
- │ │
76
- │ Bug Sources: Fix Actions: │
77
- │ - whiterose scan results - Interactive TUI │
78
- │ - External SARIF files - Single bug by ID │
79
- │ - GitHub issues - Dry-run preview │
80
- │ - Manual description - Branch creation │
81
- │ │
82
- │ Output: Fixed code + commits │
83
- └─────────────────────────────────────────────────────────────────────┘
84
- ```
21
+ ## Table of Contents
22
+
23
+ - [Why whiterose?](#why-whiterose)
24
+ - [Installation](#installation)
25
+ - [Quick Start](#quick-start)
26
+ - [Commands](#commands)
27
+ - [Architecture](#architecture)
28
+ - [Three-Layer Architecture](#three-layer-architecture)
29
+ - [19-Pass Pipeline](#19-pass-pipeline)
30
+ - [LSP-Compliant Provider Abstraction](#lsp-compliant-provider-abstraction)
31
+ - [Static Analysis Integration](#static-analysis-integration)
32
+ - [Configuration](#configuration)
33
+ - [Bug Categories](#bug-categories)
34
+ - [Output Formats](#output-formats)
35
+ - [Contributing](#contributing)
36
+ - [License](#license)
85
37
 
86
38
  ---
87
39
 
88
- ## Architecture: How whiterose Actually Works
89
-
90
- **This section is critical to understanding what whiterose is and isn't.**
91
-
92
- ### What whiterose IS
93
-
94
- whiterose is an **orchestrator/wrapper** that:
95
- 1. Spawns an LLM CLI tool (like Claude Code) as a subprocess
96
- 2. Passes it a specialized prompt with a communication protocol
97
- 3. Streams and parses the LLM's output in real-time
98
- 4. Displays progress to the user
99
- 5. Collects and formats bug reports
100
-
101
- ### What whiterose IS NOT
102
-
103
- whiterose is **NOT** a custom AI agent with its own tool-calling loop. It does not:
104
- - Make direct API calls to Claude/OpenAI/etc.
105
- - Define or execute its own tools
106
- - Implement an LLM-in-a-loop architecture itself
107
-
108
- ### The Real Agent: Your LLM Provider
109
-
110
- The actual "agent" is **Claude Code** (or Aider, etc.). These tools have their own internal agentic architecture:
111
-
112
- ```
113
- ┌─────────────────────────────────────────────────────────────────────┐
114
- │ CLAUDE CODE │
115
- │ (The Actual AI Agent) │
116
- │ │
117
- │ Claude Code runs an internal agent loop: │
118
- │ │
119
- │ while (task not complete): │
120
- │ 1. LLM decides what to do next │
121
- │ 2. LLM issues a tool call (Read, Glob, Grep, Bash, etc.) │
122
- │ 3. Claude Code executes the tool locally │
123
- │ 4. Tool result is sent back to the LLM │
124
- │ 5. LLM processes result and decides next action │
125
- │ 6. Repeat until done │
126
- │ │
127
- │ Built-in Tools: │
128
- │ - Read: Read file contents │
129
- │ - Glob: Find files by pattern │
130
- │ - Grep: Search file contents │
131
- │ - Bash: Execute shell commands │
132
- │ - Write/Edit: Modify files │
133
- │ - Task: Spawn sub-agents │
134
- │ - And more... │
135
- │ │
136
- └─────────────────────────────────────────────────────────────────────┘
137
- ```
138
-
139
- ### The Complete Flow
140
-
141
- ```
142
- ┌─────────────────────────────────────────────────────────────────────┐
143
- │ USER │
144
- │ runs: whiterose scan │
145
- └─────────────────────────────────┬───────────────────────────────────┘
146
-
147
-
148
- ┌─────────────────────────────────────────────────────────────────────┐
149
- │ WHITEROSE CLI │
150
- │ │
151
- │ 1. Loads config from .whiterose/config.yml │
152
- │ 2. Loads codebase understanding from cache │
153
- │ 3. Runs static analysis (tsc, eslint) as pre-filter │
154
- │ 4. Spawns Claude Code as subprocess: │
155
- │ │
156
- │ claude --dangerously-skip-permissions -p "<prompt>" │
157
- │ │
158
- │ 5. Streams stdout from Claude Code │
159
- │ 6. Parses protocol markers in real-time │
160
- │ 7. Updates UI with progress │
161
- │ 8. Collects bug reports │
162
- │ 9. Outputs SARIF + Markdown reports │
163
- │ │
164
- └─────────────────────────────────┬───────────────────────────────────┘
165
- │ spawns
166
-
167
- ┌─────────────────────────────────────────────────────────────────────┐
168
- │ CLAUDE CODE │
169
- │ (runs autonomously) │
170
- │ │
171
- │ Receives prompt telling it to: │
172
- │ - Explore the codebase │
173
- │ - Find bugs in specific categories │
174
- │ - Output progress using protocol markers │
175
- │ - Output bugs as JSON │
176
- │ │
177
- │ Claude Code then: │
178
- │ - Uses its Read tool to examine files │
179
- │ - Uses Glob/Grep to find relevant code │
180
- │ - Analyzes code for bugs │
181
- │ - Outputs markers that whiterose parses │
182
- │ │
183
- └─────────────────────────────────────────────────────────────────────┘
184
- ```
185
-
186
- ### The Communication Protocol
187
-
188
- whiterose and the LLM communicate via stdout using protocol markers:
189
-
190
- ```
191
- ###SCANNING:src/api/users.ts <- LLM is about to analyze this file
192
- ###SCANNING:src/api/auth.ts <- LLM moved to next file
193
- ###BUG:{"file":"src/api/users.ts","line":42,"title":"Null dereference",...}
194
- ###SCANNING:src/hooks/useCart.ts <- LLM continues exploring
195
- ###BUG:{"file":"src/hooks/useCart.ts","line":17,"title":"Missing await",...}
196
- ###COMPLETE <- LLM finished analysis
197
- ```
40
+ ## Why whiterose?
198
41
 
199
- whiterose parses these markers in real-time to:
200
- - Show progress: "Scanning: src/api/users.ts"
201
- - Show findings: "Found: Null dereference (high)"
202
- - Collect bugs for the final report
42
+ You're already paying for Claude Code Max, Cursor, Codex, or similar AI coding tools. Why pay again for bug detection APIs?
203
43
 
204
- ### Why This Architecture?
44
+ whiterose piggybacks on your existing subscription to find bugs in your code. **Zero additional cost.**
205
45
 
206
- 1. **No API Keys Needed**: Uses CLI tools you already have installed and authenticated
207
- 2. **Zero Extra Cost**: Piggybacks on your existing subscriptions (Claude Max, etc.)
208
- 3. **Real Progress**: Streaming output shows exactly what's happening
209
- 4. **Leverages Existing Agents**: Claude Code already knows how to explore codebases intelligently
210
- 5. **Respects .gitignore**: Claude Code automatically ignores files you don't want scanned
211
- 6. **No Token Limits**: Claude Code reads files on-demand, not all at once
46
+ | Feature | whiterose | Traditional SAST |
47
+ |---------|-----------|------------------|
48
+ | Cost | $0 (uses existing subscription) | $100-500/mo |
49
+ | Setup | `npm install -g` | Complex integrations |
50
+ | False positives | Low (LLM understands context) | High (pattern matching) |
51
+ | Fix generation | Yes (agentic) | No |
52
+ | Provider lock-in | None (works with any LLM CLI) | Vendor-specific |
212
53
 
213
54
  ---
214
55
 
@@ -218,18 +59,18 @@ whiterose parses these markers in real-time to:
218
59
  npm install -g @shakecodeslikecray/whiterose
219
60
  ```
220
61
 
221
- The CLI command is `whiterose` (no scope prefix needed).
222
-
223
62
  ### Prerequisites
224
63
 
225
- You need at least one of these LLM CLI tools installed:
64
+ You need at least one LLM CLI tool installed:
226
65
 
227
66
  | Provider | Installation | Status |
228
67
  |----------|-------------|--------|
229
- | Claude Code | `npm install -g @anthropic-ai/claude-code` | Ready |
230
- | Aider | `pip install aider-chat` | Coming Soon |
231
- | Codex | OpenAI CLI | Coming Soon |
232
- | Gemini | Google CLI | Coming Soon |
68
+ | Claude Code | `npm install -g @anthropic-ai/claude-code` | Ready |
69
+ | Codex | `npm install -g @openai/codex` | Ready |
70
+ | Gemini | `npm install -g @google/gemini-cli` | Ready |
71
+ | Aider | `pip install aider-chat` | Ready |
72
+
73
+ ---
233
74
 
234
75
  ## Quick Start
235
76
 
@@ -238,151 +79,298 @@ You need at least one of these LLM CLI tools installed:
238
79
  whiterose
239
80
 
240
81
  # Or use commands directly:
241
- whiterose init # Initialize (explores codebase, generates understanding)
242
- whiterose scan # Scan for bugs
243
- whiterose fix # Fix bugs interactively
82
+ whiterose init # Initialize (explores codebase, generates understanding)
83
+ whiterose scan # Scan for bugs (19-pass pipeline)
84
+ whiterose scan --quick # Quick scan (single pass, for pre-commit)
85
+ whiterose fix # Fix bugs interactively
244
86
  ```
245
87
 
246
- Running `whiterose` without arguments shows an interactive menu:
88
+ **Example output:**
247
89
 
248
90
  ```
249
- ██╗ ██╗██╗ ██╗██╗████████╗███████╗██████╗ ██████╗ ███████╗███████╗
250
- ...
251
-
252
- Project: my-app
253
- Status: initialized
254
-
255
- ? What would you like to do?
256
- > Scan find bugs in the codebase
257
- Fix fix bugs interactively
258
- Status show current status
259
- Report generate bug report
260
- Refresh rebuild codebase understanding
261
- Help show all commands
262
- Exit
91
+ whiterose - thorough scan
92
+
93
+ ◇ Found 64 files to scan
94
+ Static analysis: 37 signals found
95
+
96
+ ════ CORE SCANNER (PIPELINE MODE) ════
97
+ Provider: claude-code
98
+ Passes: 19 (9 unit 5 integration → 5 E2E)
99
+ Findings flow: Unit → Integration → E2E
100
+
101
+ ════ PHASE 1: UNIT ANALYSIS ════
102
+ Looking for: injection, null refs, auth bypass, etc.
103
+ [Batch 1/2] injection, auth-bypass, null-safety, type-safety, resource-leaks
104
+ ✓ injection: 2 bugs
105
+ ✓ auth-bypass: 0 bugs
106
+ ✓ null-safety: 1 bugs
107
+ ...
108
+
109
+ ════ PHASE 2: INTEGRATION ANALYSIS ════
110
+ Building on 5 unit findings
111
+ Looking for: auth flows, data flows, trust boundaries
112
+ ✓ auth-flow-trace: 1 bugs
113
+ ...
114
+
115
+ ════ PHASE 3: E2E ANALYSIS ════
116
+ Building on 5 unit + 2 integration findings
117
+ Looking for: attack chains, privilege escalation
118
+ ✓ attack-chain-analysis: 1 bugs
119
+ ...
120
+
121
+ ════ SCAN COMPLETE ════
122
+ Duration: 4m 32s
123
+ Unit: 5 → Integration: 2 → E2E: 1
124
+ Final bugs: 7
263
125
  ```
264
126
 
127
+ ---
128
+
265
129
  ## Commands
266
130
 
267
131
  ### `whiterose init`
268
132
 
269
- First-time setup. whiterose will:
270
- 1. Detect available LLM providers (claude-code, aider, codex, etc.)
271
- 2. Ask you to select one
272
- 3. Read existing documentation (README, package.json, CONTRIBUTING, etc.)
273
- 4. Spawn the LLM to explore and understand your codebase
274
- 5. Merge existing docs with AI-generated understanding
275
- 6. Show real-time progress as files are examined
276
- 7. Create `.whiterose/` directory with config and understanding
133
+ First-time setup. Explores your codebase and generates understanding.
277
134
 
278
- **What you'll see:**
135
+ ```bash
136
+ whiterose init
279
137
  ```
280
- whiterose - initialization
281
-
282
- ✓ Detected providers: claude-code, aider
283
- ? Which LLM provider should whiterose use?
284
- > claude-code (recommended)
285
- aider
286
-
287
- ✓ Found existing docs: README, package.json, .env.example
288
- Examining: src/index.ts
289
- Examining: src/api/users.ts
290
- ...
291
- ✓ Analysis complete (45s)
292
138
 
293
- Here's what I understand about your codebase:
139
+ Creates `.whiterose/` directory with:
140
+ - `config.yml` - Configuration
141
+ - `intent.md` - Behavioral contracts (editable)
142
+ - `cache/understanding.json` - AI-generated codebase understanding
294
143
 
295
- Type: E-commerce Application
296
- Framework: Next.js
297
- Language: TypeScript
298
- Files: 127
299
- Lines: 15,234
144
+ ### `whiterose scan`
300
145
 
301
- ? Is this understanding accurate? Yes
146
+ Find bugs using the 19-pass pipeline.
302
147
 
303
- whiterose initialized successfully!
148
+ ```bash
149
+ whiterose scan # Incremental scan (changed files only)
150
+ whiterose scan --full # Full scan (all files)
151
+ whiterose scan --quick # Quick scan (single pass, fast)
152
+ whiterose scan --provider codex # Use specific provider
153
+ whiterose scan --json # JSON output
154
+ whiterose scan --ci # CI mode (exit 1 if bugs found)
155
+ whiterose scan src/api/ # Scan specific path
304
156
  ```
305
157
 
306
- ### `whiterose scan`
158
+ ### `whiterose fix`
307
159
 
308
- Find bugs. Uses incremental scanning by default (only changed files).
160
+ Interactive TUI for reviewing and fixing bugs.
309
161
 
310
162
  ```bash
311
- whiterose scan # Incremental scan
312
- whiterose scan --full # Full scan
313
- whiterose scan --json # JSON output
314
- whiterose scan src/api/ # Scan specific path
315
- whiterose scan --unsafe # Bypass LLM permission prompts
316
- ```
163
+ whiterose fix # Interactive dashboard
164
+ whiterose fix WR-001 # Fix specific bug by ID
165
+ whiterose fix --dry-run # Preview without applying
166
+ whiterose fix --provider claude-code # Use specific provider
317
167
 
318
- **What you'll see:**
168
+ # External bug sources:
169
+ whiterose fix --sarif ./semgrep.sarif # Import from SARIF
170
+ whiterose fix --github https://github.com/owner/repo/issues/123
171
+ whiterose fix --describe # Manually describe a bug
319
172
  ```
320
- whiterose - scanning for bugs
321
173
 
322
- Scanning: src/api/users.ts
323
- Scanning: src/api/auth.ts
324
- Found: Null dereference in getUserById (high)
325
- Scanning: src/hooks/useCart.ts
326
- Found: Missing await in checkout (medium)
327
- ...
328
- Analysis complete. Found 3 bugs.
174
+ **Agentic Fix:** whiterose uses an agentic approach - the LLM reads the code, explores context, and applies fixes directly. It can also detect false positives during fix and notify you.
329
175
 
330
- Scan Results
176
+ ### `whiterose refresh`
331
177
 
332
- Critical: 0
333
- ● High: 1
334
- Medium: 2
335
- ● Low: 0
178
+ Rebuild codebase understanding from scratch.
179
+
180
+ ### `whiterose status`
181
+
182
+ Show current status (provider, cache, last scan).
183
+
184
+ ---
185
+
186
+ ## Architecture
187
+
188
+ This section explains how whiterose works internally. **Critical reading for contributors.**
189
+
190
+ ### Three-Layer Architecture
336
191
 
337
- Total: 3 bugs found
192
+ ```
193
+ ┌─────────────────────────────────────────────────────────────────────┐
194
+ │ LAYER 0: UNDERSTANDING │
195
+ │ (whiterose init) │
196
+ │ │
197
+ │ Input: Output: │
198
+ │ - README.md, package.json - .whiterose/intent.md │
199
+ │ - CONTRIBUTING.md - .whiterose/cache/understanding │
200
+ │ - Existing documentation - Project type, framework, etc. │
201
+ └─────────────────────────────────────────────────────────────────────┘
202
+
203
+
204
+ ┌─────────────────────────────────────────────────────────────────────┐
205
+ │ LAYER 1: BUG FINDING │
206
+ │ (whiterose scan) │
207
+ │ │
208
+ │ 1. Load understanding from Layer 0 │
209
+ │ 2. Run static analysis (tsc, eslint) │
210
+ │ 3. Run 19-pass LLM pipeline (Unit → Integration → E2E) │
211
+ │ 4. Deduplicate and merge findings │
212
+ │ 5. Output reports (SARIF, Markdown, JSON) │
213
+ └─────────────────────────────────────────────────────────────────────┘
214
+
215
+
216
+ ┌─────────────────────────────────────────────────────────────────────┐
217
+ │ LAYER 2: BUG FIXING │
218
+ │ (whiterose fix) │
219
+ │ │
220
+ │ 1. Load bugs from scan results (or external sources) │
221
+ │ 2. Interactive TUI for review │
222
+ │ 3. Agentic fix (LLM explores and fixes) │
223
+ │ 4. False positive detection during fix │
224
+ │ 5. Commit changes │
225
+ └─────────────────────────────────────────────────────────────────────┘
338
226
  ```
339
227
 
340
- ### `whiterose fix`
228
+ ### 19-Pass Pipeline
341
229
 
342
- Interactive TUI for reviewing and fixing bugs. Supports multiple bug sources.
230
+ whiterose runs **19 specialized passes** organized into 3 phases, with findings flowing through:
343
231
 
344
- ```bash
345
- # From whiterose scan results (default)
346
- whiterose fix # Interactive dashboard
347
- whiterose fix WR-001 # Fix specific bug
348
- whiterose fix --dry-run # Preview fixes without applying
349
- whiterose fix --branch fix/bugs # Create fixes in new branch
232
+ ```
233
+ Static Analysis (tsc/eslint)
234
+
235
+
236
+ staticResults ─────────────────────────────────────┐
237
+ │ │
238
+ ▼ │
239
+ ════ PHASE 1: UNIT ANALYSIS (9 passes) ════ │
240
+ │ │
241
+ │ Each pass focuses on ONE bug category: │
242
+ │ 1. injection - SQL, XSS, command injection │
243
+ │ 2. auth-bypass - Missing/broken auth checks │
244
+ │ 3. null-safety - Null/undefined dereference │
245
+ │ 4. type-safety - Type coercion bugs │
246
+ │ 5. resource-leaks - Unclosed handles, listeners │
247
+ │ 6. async-issues - Missing await, race conditions │
248
+ │ 7. data-validation - Input validation gaps │
249
+ │ 8. secrets-exposure - Hardcoded secrets, leaks │
250
+ │ 9. logic-errors - Off-by-one, wrong operators │
251
+ │ │
252
+ │ Runs in batches of 5 (parallel within batch) │
253
+ └──────────────────────────────────────────────────────┘
254
+
255
+
256
+ unitFindings ─────────────────────────────┐
257
+ │ │
258
+ ▼ ▼
259
+ ════ PHASE 2: INTEGRATION ANALYSIS (5 passes) ════
260
+ │ Input: staticResults + unitFindings │
261
+ │ │
262
+ │ Prompt includes previous findings: │
263
+ │ "## PREVIOUS FINDINGS TO BUILD ON │
264
+ │ - [high] SQL injection at api.ts:42 │
265
+ │ - [medium] Missing auth at routes.ts:15" │
266
+ │ │
267
+ │ Passes: │
268
+ │ 1. auth-flow-trace - Auth across files │
269
+ │ 2. data-flow-trace - Data propagation │
270
+ │ 3. validation-boundary - Trust boundaries │
271
+ │ 4. error-propagation - Error handling │
272
+ │ 5. trust-boundary-trace - Security bounds │
273
+ └──────────────────────────────────────────────┘
274
+
275
+
276
+ integrationFindings ─────────────────┐
277
+ │ │
278
+ ▼ ▼
279
+ ════ PHASE 3: E2E ANALYSIS (5 passes) ════
280
+ │ Input: staticResults + unitFindings │
281
+ │ + integrationFindings │
282
+ │ │
283
+ │ Builds attack chains from ALL │
284
+ │ previous findings. │
285
+ │ │
286
+ │ Passes: │
287
+ │ 1. attack-chain-analysis │
288
+ │ 2. privilege-escalation-trace │
289
+ │ 3. session-lifecycle-trace │
290
+ │ 4. user-journey-simulation │
291
+ │ 5. api-contract-verification │
292
+ └──────────────────────────────────────┘
293
+
294
+
295
+ ════ POST-PROCESSING ════
296
+ │ 1. Combine all findings │
297
+ │ 2. Deduplicate (file:line:category) │
298
+ │ 3. Merge similar (within 5 lines) │
299
+ └──────────────────────────────────────┘
300
+
301
+
302
+ Final Bugs
303
+ ```
350
304
 
351
- # From external SARIF file
352
- whiterose fix --sarif ./reports/semgrep.sarif
305
+ ### LSP-Compliant Provider Abstraction
353
306
 
354
- # From GitHub issue
355
- whiterose fix --github https://github.com/owner/repo/issues/123
307
+ whiterose follows the **Liskov Substitution Principle** - all providers are interchangeable and get the same 19-pass scanning.
356
308
 
357
- # Manually describe a bug
358
- whiterose fix --describe
309
+ ```
310
+ ┌─────────────────────────────────────────────────────────────────┐
311
+ │ CoreScanner │
312
+ │ src/core/scanner.ts │
313
+ │ ───────────────────────────────────────────────────────────── │
314
+ │ • 19-pass pipeline logic │
315
+ │ • Batching (5 parallel, 2s delay) │
316
+ │ • Phase dependencies (Unit → Integration → E2E) │
317
+ │ • Deduplication & merging │
318
+ │ • Progress callbacks │
319
+ └─────────────────────────────────────────────────────────────────┘
320
+
321
+ │ executor.runPrompt(prompt)
322
+
323
+ ┌─────────────────────────────────────────────────────────────────┐
324
+ │ PromptExecutor (interface) │
325
+ │ src/core/scanner.ts │
326
+ │ ───────────────────────────────────────────────────────────── │
327
+ │ interface PromptExecutor { │
328
+ │ name: string; │
329
+ │ isAvailable(): Promise<boolean>; │
330
+ │ runPrompt(prompt: string, options: PromptOptions): │
331
+ │ Promise<PromptResult>; │
332
+ │ } │
333
+ └─────────────────────────────────────────────────────────────────┘
334
+ │ │ │ │
335
+ ▼ ▼ ▼ ▼
336
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
337
+ │ claude │ │ codex │ │ gemini │ │ aider │
338
+ │ -code │ │ │ │ │ │ │
339
+ └──────────┘ └──────────┘ └──────────┘ └──────────┘
340
+ executors/ executors/ executors/ executors/
359
341
  ```
360
342
 
361
- **External Bug Sources:**
343
+ **Adding a new provider is trivial** - just implement the `PromptExecutor` interface (~30 lines).
362
344
 
363
- | Source | Option | Description |
364
- |--------|--------|-------------|
365
- | whiterose scan | (default) | Bugs from latest scan in `.whiterose/reports/` |
366
- | External SARIF | `--sarif <path>` | Import bugs from any SARIF-compatible tool |
367
- | GitHub Issue | `--github <url>` | Parse bug from GitHub issue (requires `gh` CLI) |
368
- | Manual | `--describe` | Interactive prompts to describe a bug |
345
+ ### Static Analysis Integration
369
346
 
370
- When using `--github`, whiterose:
371
- - Extracts file path and line number from issue body (if present)
372
- - Determines severity from labels (critical, security, bug, etc.)
373
- - Prompts for missing information
347
+ Static analysis runs **first**, deterministically, before any LLM passes:
374
348
 
375
- ### `whiterose refresh`
349
+ ```typescript
350
+ // In scan.ts
351
+ staticResults = await runStaticAnalysis(cwd, filesToScan, config);
376
352
 
377
- Rebuild codebase understanding from scratch.
353
+ // Passed to CoreScanner
354
+ const bugs = await scanner.scan({
355
+ files: filesToScan,
356
+ understanding,
357
+ staticResults, // ← Every pass sees this
358
+ });
359
+ ```
378
360
 
379
- ### `whiterose status`
361
+ Each LLM pass receives static analysis signals in its prompt:
380
362
 
381
- Show current status (provider, cache, last scan).
363
+ ```
364
+ ## STATIC ANALYSIS SIGNALS (from tsc/eslint)
365
+ - typescript: src/api.ts:42 - TS2532: Object is possibly 'undefined'
366
+ - eslint: src/db.ts:15 - @typescript-eslint/no-explicit-any
382
367
 
383
- ### `whiterose report`
368
+ NOTE: Static tools already verified control flow. Don't report issues they would catch.
369
+ ```
384
370
 
385
- Generate bug report from last scan.
371
+ This reduces false positives - the LLM knows what tsc/eslint already flagged.
372
+
373
+ ---
386
374
 
387
375
  ## Configuration
388
376
 
@@ -390,29 +378,35 @@ Generate bug report from last scan.
390
378
 
391
379
  ```yaml
392
380
  version: "1"
393
- provider: claude-code
381
+ provider: claude-code # or codex, gemini, aider
394
382
 
395
383
  include:
396
384
  - "**/*.ts"
397
385
  - "**/*.tsx"
386
+ - "**/*.js"
387
+ - "**/*.jsx"
398
388
 
399
389
  exclude:
400
390
  - node_modules
401
391
  - dist
402
392
  - "**/*.test.*"
393
+ - "**/*.spec.*"
403
394
 
404
395
  priorities:
405
396
  src/api/checkout.ts: critical
406
397
  src/auth/: high
407
398
 
408
399
  categories:
409
- - logic-error
410
- - security
411
- - async-race-condition
412
- - edge-case
400
+ - injection
401
+ - auth-bypass
413
402
  - null-reference
403
+ - logic-error
404
+ - async-issue
405
+ - resource-leak
406
+ - data-validation
407
+ - secrets-exposure
414
408
 
415
- minConfidence: low
409
+ minConfidence: low # low, medium, high
416
410
 
417
411
  staticAnalysis:
418
412
  typescript: true
@@ -421,147 +415,179 @@ staticAnalysis:
421
415
  output:
422
416
  sarif: true
423
417
  markdown: true
418
+ sarifPath: .whiterose/reports
419
+ markdownPath: BUGS.md
424
420
  ```
425
421
 
426
- ## Intent Document
427
-
428
- `.whiterose/intent.md` describes your app's intent and behavioral contracts:
429
-
430
- ```markdown
431
- # App Intent: acme-store
432
-
433
- ## Overview
434
- E-commerce platform for selling widgets.
422
+ ---
435
423
 
436
- ## Critical Features
424
+ ## Bug Categories
437
425
 
438
- ### Checkout [CRITICAL]
439
- Must never double-charge. Must handle payment failures gracefully.
426
+ whiterose looks for bugs in these categories:
440
427
 
441
- **Constraints:**
442
- - Create order record before charging payment
443
- - Rollback order if charge fails
428
+ | Category | Description | Example |
429
+ |----------|-------------|---------|
430
+ | `injection` | SQL, XSS, command injection | `db.query("SELECT * FROM users WHERE id=" + userId)` |
431
+ | `auth-bypass` | Missing/broken authentication | Route handler without auth middleware |
432
+ | `null-reference` | Null/undefined dereference | `user.profile.name` when `profile` might be null |
433
+ | `logic-error` | Off-by-one, wrong operators | `i <= arr.length` instead of `i < arr.length` |
434
+ | `async-issue` | Missing await, race conditions | `const data = fetchData(); use(data);` |
435
+ | `resource-leak` | Unclosed handles, listeners | `db.connect()` without `db.close()` |
436
+ | `data-validation` | Input validation gaps | Missing sanitization on user input |
437
+ | `secrets-exposure` | Hardcoded secrets | `const API_KEY = "sk-..."` |
438
+ | `type-coercion` | Loose equality bugs | `if (value == null)` when 0 is valid |
439
+ | `boundary-error` | Edge case handling | Empty array, zero values |
440
+ | `concurrency` | Thread safety issues | Shared state without locks |
441
+ | `intent-violation` | Violates documented behavior | Code contradicts README/docs |
444
442
 
445
443
  ---
446
444
 
447
- ## Behavioral Contracts
445
+ ## Output Formats
448
446
 
449
- ### `src/api/checkout.ts:processPayment()`
447
+ ### SARIF
450
448
 
451
- **Inputs:**
452
- - `cartId`: string
453
- - `paymentMethod`: stripe | paypal
449
+ Standard format for static analysis tools. Works with:
450
+ - VS Code (SARIF Viewer extension)
451
+ - GitHub Code Scanning
452
+ - Azure DevOps
454
453
 
455
- **Returns:** `PaymentResult`
454
+ ### Markdown
456
455
 
457
- **Invariants:**
458
- - Must not charge if inventory unavailable
459
- - Must create order before charging
460
- - Must rollback if charge fails
461
- ```
456
+ Two formats:
457
+ - `bugs.md` - Technical (for developers)
458
+ - `bugs-human.md` - Tester-friendly (for QA)
462
459
 
463
- ## Supported Providers
460
+ ### JSON
464
461
 
465
- | Provider | Status | Notes |
466
- |----------|--------|-------|
467
- | Claude Code | Ready | Recommended. Uses Max subscription. |
468
- | Aider | Coming Soon | Will support when implemented |
469
- | Codex | Coming Soon | Will support when implemented |
470
- | Gemini | Coming Soon | Will support when implemented |
471
- | Ollama | Coming Soon | Local LLMs |
462
+ Full bug data with code paths, evidence, and confidence scores.
472
463
 
473
- ## Bug Categories
464
+ ---
474
465
 
475
- whiterose looks for bugs in these categories:
466
+ ## Contributing
476
467
 
477
- - **logic-error**: Off-by-one errors, wrong operators, incorrect conditions
478
- - **null-reference**: Accessing properties on potentially null/undefined values
479
- - **security**: Injection, auth bypass, XSS, data exposure
480
- - **async-race-condition**: Missing await, unhandled promises, race conditions
481
- - **edge-case**: Empty arrays, zero values, boundary conditions
482
- - **resource-leak**: Unclosed connections, event listener leaks
483
- - **type-coercion**: Loose equality bugs, implicit conversions
484
- - **intent-violation**: Code that violates documented business rules
468
+ ### Project Structure
485
469
 
486
- ## Output Formats
470
+ ```
471
+ whiterose/
472
+ ├── src/
473
+ │ ├── cli/
474
+ │ │ ├── index.ts # CLI entry point
475
+ │ │ └── commands/
476
+ │ │ ├── init.ts # whiterose init
477
+ │ │ ├── scan.ts # whiterose scan
478
+ │ │ └── fix.ts # whiterose fix
479
+ │ │
480
+ │ ├── core/
481
+ │ │ ├── scanner.ts # CoreScanner + PromptExecutor interface
482
+ │ │ ├── multipass-scanner.ts # Pass configurations (SCAN_PASSES)
483
+ │ │ ├── flow-analyzer.ts # Flow pass configurations (FLOW_PASSES)
484
+ │ │ ├── fixer.ts # Agentic fix logic
485
+ │ │ ├── config.ts # Config loading
486
+ │ │ └── utils.ts # Utilities
487
+ │ │
488
+ │ ├── providers/
489
+ │ │ ├── executors/ # LSP-compliant provider implementations
490
+ │ │ │ ├── index.ts # getExecutor(), getAvailableExecutors()
491
+ │ │ │ ├── claude-code.ts # ClaudeCodeExecutor
492
+ │ │ │ ├── codex.ts # CodexExecutor
493
+ │ │ │ ├── gemini.ts # GeminiExecutor
494
+ │ │ │ └── aider.ts # AiderExecutor
495
+ │ │ │
496
+ │ │ ├── prompts/
497
+ │ │ │ ├── multipass-prompts.ts # Unit pass prompts
498
+ │ │ │ ├── flow-analysis-prompts.ts # Integration/E2E prompts
499
+ │ │ │ └── adversarial.ts # Validation prompts
500
+ │ │ │
501
+ │ │ └── detect.ts # Provider detection
502
+ │ │
503
+ │ ├── analysis/
504
+ │ │ └── static.ts # tsc/eslint integration
505
+ │ │
506
+ │ ├── tui/
507
+ │ │ ├── App.tsx # Main TUI app
508
+ │ │ └── screens/ # TUI screens
509
+ │ │
510
+ │ ├── output/
511
+ │ │ ├── sarif.ts # SARIF output
512
+ │ │ ├── markdown.ts # Technical markdown
513
+ │ │ └── human-readable.ts # Tester-friendly markdown
514
+ │ │
515
+ │ └── types.ts # TypeScript types (Zod schemas)
516
+
517
+ ├── tsup.config.ts # Build config
518
+ └── package.json
519
+ ```
487
520
 
488
- ### SARIF
521
+ ### Key Files for Contributors
489
522
 
490
- Standard format for static analysis tools. Works with:
491
- - VS Code (SARIF Viewer extension)
492
- - GitHub Code Scanning
493
- - Azure DevOps
523
+ | File | Purpose |
524
+ |------|---------|
525
+ | `src/core/scanner.ts` | **Start here.** CoreScanner orchestrates everything. |
526
+ | `src/core/multipass-scanner.ts` | Pass configurations for unit analysis |
527
+ | `src/core/flow-analyzer.ts` | Pass configurations for integration/E2E |
528
+ | `src/providers/executors/*.ts` | Provider implementations (simple!) |
529
+ | `src/providers/prompts/*.ts` | Prompt templates |
494
530
 
495
- ### Markdown
531
+ ### Adding a New Provider
496
532
 
497
- Human-readable report with:
498
- - Bug severity badges
499
- - Code path traces
500
- - Suggested fixes
501
- - Evidence
533
+ 1. Create `src/providers/executors/your-provider.ts`:
502
534
 
503
- ## Philosophy
535
+ ```typescript
536
+ import { PromptExecutor, PromptOptions, PromptResult } from '../../core/scanner.js';
504
537
 
505
- - **SRP**: whiterose finds bugs. It doesn't write tests, lint code, or format files.
506
- - **Leverage, Don't Reinvent**: Uses existing AI agents (Claude Code) rather than building a custom agent loop.
507
- - **Transparency**: Shows exactly what's happening in real-time.
508
- - **Grounded**: Every bug must have evidence and a code path trace.
509
- - **Zero Cost**: Uses your existing LLM subscription.
538
+ export class YourProviderExecutor implements PromptExecutor {
539
+ name = 'your-provider';
510
540
 
511
- ## Technical Details
541
+ async isAvailable(): Promise<boolean> {
542
+ // Check if CLI tool is installed
543
+ }
512
544
 
513
- ### How Provider Detection Works
545
+ async runPrompt(prompt: string, options: PromptOptions): Promise<PromptResult> {
546
+ // Run: your-cli -p "prompt"
547
+ // Return: { output: stdout, error: stderr }
548
+ }
549
+ }
550
+ ```
514
551
 
515
- whiterose checks for installed CLI tools in this order:
516
- 1. Checks if command exists in PATH
517
- 2. Checks common installation locations:
518
- - `~/.local/bin/`
519
- - `/usr/local/bin/`
520
- - `/opt/homebrew/bin/`
552
+ 2. Register in `src/providers/executors/index.ts`
553
+ 3. Add to `ProviderType` in `src/types.ts`
554
+ 4. Add detection in `src/providers/detect.ts`
521
555
 
522
- ### How Streaming Works
556
+ ### Adding a New Pass
523
557
 
524
- 1. whiterose spawns: `claude --verbose -p "<prompt>"` (or with `--dangerously-skip-permissions` if `--unsafe` flag used)
525
- 2. Attaches to stdout stream
526
- 3. Buffers output line-by-line
527
- 4. Parses lines for protocol markers (`###SCANNING:`, `###BUG:`, etc.)
528
- 5. Triggers callbacks for UI updates and bug collection
558
+ 1. Add pass config to `SCAN_PASSES` in `src/core/multipass-scanner.ts` (for unit passes) or `FLOW_PASSES` in `src/core/flow-analyzer.ts` (for integration/E2E)
529
559
 
530
- ### Security Features
560
+ 2. Add to pipeline in `src/providers/prompts/flow-analysis-prompts.ts`:
531
561
 
532
- - **Path traversal prevention**: File paths in bug reports are validated to stay within the project directory
533
- - **Opt-in unsafe mode**: LLM permission prompts are shown by default; use `--unsafe` flag to bypass
534
- - **No external network calls**: All analysis happens locally via your LLM CLI
562
+ ```typescript
563
+ export function getFullAnalysisPipeline() {
564
+ return [
565
+ { phase: 'Unit Analysis', passes: [..., 'your-new-pass'] },
566
+ // ...
567
+ ];
568
+ }
569
+ ```
535
570
 
536
- ### Protocol Markers
571
+ ### Building
537
572
 
538
- | Marker | Purpose | Example |
539
- |--------|---------|---------|
540
- | `###SCANNING:` | File being analyzed | `###SCANNING:src/api/users.ts` |
541
- | `###BUG:` | Bug found (JSON) | `###BUG:{"file":"...","line":42,...}` |
542
- | `###UNDERSTANDING:` | Codebase understanding (JSON) | `###UNDERSTANDING:{"summary":{...}}` |
543
- | `###COMPLETE` | Analysis finished | `###COMPLETE` |
544
- | `###ERROR:` | Error occurred | `###ERROR:Failed to read file` |
573
+ ```bash
574
+ npm run build # Build
575
+ npm run dev # Watch mode
576
+ npm test # Run tests
577
+ ```
545
578
 
546
- ## Roadmap
579
+ ---
547
580
 
548
- ### v0.2 (Coming Soon)
549
- - [ ] VSCode extension for inline bug display
550
- - [ ] GitHub Actions integration for PR scanning
551
- - [ ] Improved monorepo support
552
- - [ ] Custom bug category definitions
581
+ ## Philosophy
553
582
 
554
- ### v0.3
555
- - [ ] Historical bug tracking and trend analysis
556
- - [ ] Team collaboration features
557
- - [ ] Ollama/local LLM support
558
- - [ ] Plugin architecture for custom providers
583
+ - **SRP**: whiterose finds bugs. It doesn't write tests, lint code, or format files.
584
+ - **Leverage, Don't Reinvent**: Uses existing AI agents (Claude Code, Codex) rather than building a custom agent loop.
585
+ - **LSP-Compliant**: All providers are interchangeable. Scanning logic lives in ONE place.
586
+ - **Transparency**: Shows exactly what's happening in real-time.
587
+ - **Grounded**: Every bug must have evidence and a code path trace.
588
+ - **Zero Cost**: Uses your existing LLM subscription.
559
589
 
560
- ### v1.0
561
- - [ ] Production-ready stability
562
- - [ ] Enterprise features
563
- - [ ] Comprehensive documentation site
564
- - [ ] IDE integrations (JetBrains, Neovim)
590
+ ---
565
591
 
566
592
  ## License
567
593
 
@@ -569,10 +595,12 @@ PolyForm Noncommercial 1.0.0
569
595
 
570
596
  This software is free for non-commercial use. See [LICENSE](LICENSE) for details.
571
597
 
598
+ ---
599
+
572
600
  ## Credits
573
601
 
574
602
  Named after the [Mr. Robot](https://en.wikipedia.org/wiki/Mr._Robot) character who sees everything and orchestrates from the shadows.
575
603
 
576
604
  ---
577
605
 
578
- **Required Notice:** Copyright (c) 2024 shakecodeslikecray (https://github.com/shakecodeslikecray)
606
+ **Copyright (c) 2024-2025 shakecodeslikecray (https://github.com/shakecodeslikecray)**