launch-doctor 0.4.0 → 0.4.2

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
@@ -13,6 +13,18 @@
13
13
 
14
14
  Launch Doctor scans your project for common problems that hurt apps after launch: leaked API keys, databases anyone can read, endpoints that let one user reach another user's data, payments that can be faked, emails that land in spam, AI endpoints that can run up your bill, missing legal pages, and leftover template defaults. It is built for developers who ship with AI coding tools (Claude Code, Cursor, Lovable, Bolt, Windsurf) and may not read every line of generated code. Every finding is explained in plain English and includes a prompt you can paste straight back into your AI assistant. It has no runtime dependencies, requires no account, sends no telemetry, and your code never leaves your machine.
15
15
 
16
+ ## Quick start
17
+
18
+ 1. In your app's folder, run `npx launch-doctor` (Node.js 22 or newer). Try `npx launch-doctor --demo` first to see a sample app full of mistakes.
19
+ 2. Read the verdict and the two grades: Security, and Launch readiness.
20
+ 3. Fix the problems under FIX THESE FIRST, one at a time: `npx launch-doctor prompt 1 --copy` puts the first fix prompt on your clipboard to paste into Claude Code, Cursor, Lovable or Bolt. Every prompt is also in `LAUNCH_FIXES.md`.
21
+ 4. If a key leaked, rotate it first: the report says where (a link to the provider's page when it knows one).
22
+ 5. Run `npx launch-doctor` again and watch the grade change. `--verbose` shows every finding.
23
+
24
+ On a Node.js version older than 22 it says so, with how to update, and stops. The automated tests run on Node.js 22 and 24.
25
+
26
+ More: [all commands and options](docs/cli.md) · [CI and pull request comments](docs/ci.md) · [hooks and the MCP server](docs/ai-tools.md) · [configuration](docs/configuration.md).
27
+
16
28
  ## Read this first
17
29
 
18
30
  Launch Doctor is a **quick checklist with teeth, not a security audit**. Please trust it accordingly:
@@ -24,149 +36,55 @@ Launch Doctor is a **quick checklist with teeth, not a security audit**. Please
24
36
 
25
37
  The full list is in [What it cannot do](#what-it-cannot-do).
26
38
 
27
- ## Quick start
39
+ ## Example output
40
+
41
+ This is the `--demo` report. It shows the verdict, a Security grade and a Launch readiness grade, the three things to fix first, and what to do next. `--verbose` prints the full report with every category and every finding (`--ci`, `--changed`, `--staged`, `--pr-comment` and `scan <url>` always print the full report). On a real project, the Next lines also point to `LAUNCH_FIXES.md`, which starts with one prompt for all the critical problems. The banner only appears in an interactive terminal; in a pipe, in CI or with `--no-banner` the report starts at the "Launch Doctor" line.
28
42
 
29
- ```bash
30
- npx launch-doctor
31
43
  ```
44
+ ██╗ █████╗ ██╗ ██╗███╗ ██╗ ██████╗██╗ ██╗
45
+ ██║ ██╔══██╗██║ ██║████╗ ██║██╔════╝██║ ██║
46
+ ██║ ███████║██║ ██║██╔██╗ ██║██║ ███████║
47
+ ██║ ██╔══██║██║ ██║██║╚██╗██║██║ ██╔══██║
48
+ ███████╗██║ ██║╚██████╔╝██║ ╚████║╚██████╗██║ ██║
49
+ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝
32
50
 
33
- Scan the built-in sample app full of common mistakes:
51
+ ██████╗ ██████╗ ██████╗████████╗ ██████╗ ██████╗
52
+ ██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔══██╗
53
+ ██║ ██║██║ ██║██║ ██║ ██║ ██║██████╔╝
54
+ ██║ ██║██║ ██║██║ ██║ ██║ ██║██╔══██╗
55
+ ██████╔╝╚██████╔╝╚██████╗ ██║ ╚██████╔╝██║ ██║
56
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
57
+ Launch Doctor v0.4.2 · my-weekend-saas · 13 files · Vite, React, Supabase +2
34
58
 
35
- ```bash
36
- npx launch-doctor --demo
37
- ```
59
+ NOT READY TO LAUNCH: 6 critical problems
38
60
 
39
- Initialize configuration and GitHub Actions files:
61
+ Security F 6 critical · 3 warnings
62
+ Launch readiness D 13 polish items
40
63
 
41
- ```bash
42
- npx launch-doctor init
43
- ```
64
+ FIX THESE FIRST
44
65
 
45
- Requires Node.js 22 or newer. That is the version range the automated tests cover (22 and 24). In a manual check it also ran on Node 18 and 20, but those versions are not tested on every change, so they are not officially supported.
66
+ 1. Anyone can use your Stripe account: the live secret key is in your code
67
+ src/lib/stripe.ts:1 sent to every visitor's browser
68
+ Rotate the key first: https://dashboard.stripe.com/apikeys
46
69
 
47
- ## Example output
70
+ 2. Anyone can run up your OpenAI bill: the key is public in your website
71
+ .env:3 VITE_OPENAI_API_KEY is copied into your site's JavaScript
72
+ Rotate the key first: https://platform.openai.com/api-keys
48
73
 
49
- This is the `--demo` report, shortened. On a real project the last line tells you where `LAUNCH_FIXES.md` was saved (the demo doesn't write it).
74
+ 3. Anyone can read, change or delete every row in the profiles table
75
+ supabase/migrations/20260101000000_init.sql:1 Row Level Security is off
50
76
 
51
- ```
52
- Launch Doctor v0.4.0
53
- Checked my-weekend-saas · 13 files · Vite, React, Supabase, Stripe, OpenAI
54
-
55
- Overall grade F Not ready to launch: fix 6 critical issues first
56
-
57
- F Secrets & keys 2 critical · 1 to fix · 1 to check
58
- F Database & backups 2 critical · 1 to check
59
- B Access control 1 to fix · 1 to check
60
- F Payments 1 critical · 2 to check
61
- F AI & API costs 1 critical · 1 to fix · 1 to check
62
- B Email delivery 1 to fix · 3 to check
63
- C Errors & monitoring 2 to fix · 2 to check
64
- D Legal & trust 5 to fix
65
- D First impressions 5 to fix · 3 to check
66
-
67
- MUST FIX BEFORE LAUNCH (6)
68
-
69
- [CRITICAL] Stripe live secret key is written directly in your code
70
- src/lib/stripe.ts:1
71
- This file is sent to every visitor's browser, so anyone can copy the key
72
- (sk_live_…exe9) and use your account.
73
-
74
- [CRITICAL] Secret exposed through the public variable VITE_OPENAI_API_KEY
75
- .env:3
76
- Anything starting with VITE_ gets copied into your website's JavaScript,
77
- so every visitor can read it. That prefix is only for values that are safe
78
- to be public.
79
- ...
80
- ```
77
+ Also: 3 more critical · 3 warnings · 13 polish items · 14 to check yourself
81
78
 
82
- ## Project workflow
83
-
84
- Launch Doctor operates across two integrated workflows: an automated internal analysis pipeline that inspects your repository, and a developer-in-the-loop remediation lifecycle designed to pair with AI coding assistants.
85
-
86
- ### 1. Internal analysis pipeline
87
-
88
- The following diagram outlines the multi-stage static analysis pipeline executed on every scan:
89
-
90
- ```mermaid
91
- flowchart TD
92
- Start["User / CI triggers: launch-doctor"] --> ParseArgs["1. Argument & Option Parsing"]
93
- ParseArgs --> LoadContext["2. Project Ingestion & File Discovery"]
94
- LoadContext --> DetectStack["3. Technology Stack & Environment Detection"]
95
- DetectStack --> ChecksSuite
96
-
97
- subgraph ChecksSuite["4. Evaluation across 9 Check Modules"]
98
- direction TB
99
- C1["Secrets & Keys Scan"]
100
- C2["Database Security & RLS"]
101
- C2b["Access Control & Ownership"]
102
- C3["Payment Webhooks & Verification"]
103
- C4["AI Endpoints & Cost Controls"]
104
- C5["Email DNS & Configuration"]
105
- C6["Error Boundaries & Monitoring"]
106
- C7["Legal & Compliance Pages"]
107
- C8["First Impressions & Defaults"]
108
- C_Hist["Optional: Git History Commit Walk"]
109
- end
110
-
111
- ChecksSuite --> FilterIgnore["5. Suppression & Baseline Filtering"]
112
- FilterIgnore --> ScoringEngine["6. Scoring & Grading Engine"]
113
- ScoringEngine --> OutputDispatch
114
-
115
- subgraph OutputDispatch["7. Multi-Target Outputs"]
116
- direction TB
117
- Out1["Terminal Dashboard Output"]
118
- Out2["LAUNCH_FIXES.md Prompt Catalog"]
119
- Out3["JSON / SARIF 2.1.0 Reports"]
120
- Out4["GitHub Actions Step Summary"]
121
- end
122
-
123
- OutputDispatch --> ExitEval["8. Exit Code Evaluation (0, 1, or 2)"]
124
- ```
79
+ Next
80
+ npx launch-doctor prompt 1 --demo --copy copy the fix prompt for 1
81
+ npx launch-doctor --demo --verbose the full report
82
+ On your own project, every fix prompt is saved to LAUNCH_FIXES.md.
125
83
 
126
- #### Pipeline stages in detail
127
-
128
- 1. **Argument parsing and validation (`src/cli.ts`):**
129
- Evaluates CLI flags, path arguments, targeted categories (`--only`, `--skip`), severity thresholds (`--fail-on`), output destinations (`--out`, `--sarif`), and runtime modifiers (`--ci`, `--offline`, `--history`, `--demo`).
130
- 2. **Project ingestion and tree traversal (`src/project.ts`):**
131
- Walks the project root, automatically skipping `node_modules`, build artifacts (`dist`, `build`, `.next`), binary formats, and hidden folders (except `.github`). Ingests package manifests (`package.json`, `requirements.txt`, `pyproject.toml`), git status, and `.launchdoctorignore` patterns. Limits: files over 1 MB are skipped, at most 20,000 files are read, and reading stops after 128 MB of text in total; the report says when either limit is hit (`truncated` and `byteLimitReached` in `--json`).
132
- 3. **Stack and environment detection (`src/detect.ts`, `src/comments.ts`):**
133
- Identifies frameworks (Next.js, Vite, React, Vue, Express, FastAPI, Flask, Django), server routes, database configurations (Supabase, Firebase, Prisma), payment gateways (Stripe, Razorpay), error trackers (Sentry, PostHog), and email services. Prepares a comment-stripped view of source files so commented-out code is not mistaken for active protection.
134
- 4. **Multi-category check execution (`src/checks/`):**
135
- Runs audits across all 9 categories. If `--history` is enabled, an incremental git commit walker inspects the last `n` commits (default 500) for secrets that were removed from HEAD but remain exposed in commit history.
136
- 5. **Suppression and baseline matching (`src/baseline.ts`):**
137
- Applies inline `launch-doctor-ignore <id>` comments and `.launchdoctorignore` path or id rules. If `.launchdoctor-baseline.json` is present and baseline mode is active, matches existing findings by ID, relative file path, and line content fingerprint.
138
- 6. **Scoring and grading engine (`src/grade.ts`):**
139
- Calculates category and overall scores from weighted deductions. Strict scoring ceilings ensure that any critical finding caps both the category score and the overall score at 39 (grade F).
140
- 7. **Multi-target reporting and artifact generation (`src/report.ts`, `src/fixes.ts`, `src/sarif.ts`, `src/summary.ts`):**
141
- Renders the CLI terminal dashboard, generates `LAUNCH_FIXES.md` with copy-paste prompts for AI models, outputs structured JSON or SARIF 2.1.0 files when requested, and populates GitHub Actions job summaries via `GITHUB_STEP_SUMMARY`.
142
- 8. **Process exit resolution (`src/cli.ts`):**
143
- Returns exit code 0 whenever the scan finishes (with `--ci`, only when nothing is at or above `--fail-on`), code 1 for CI gate failures, and code 2 for invalid arguments or unexpected runtime errors.
144
-
145
- ---
146
-
147
- ### 2. Developer and AI remediation lifecycle
148
-
149
- Launch Doctor is built to fit directly into your daily development cycle, especially when pairing with AI assistants:
150
-
151
- ```mermaid
152
- flowchart LR
153
- Dev["1. Local Development (AI / Human)"] --> Scan["2. Run npx launch-doctor"]
154
- Scan --> Check{"Grade & Findings?"}
155
- Check -- "Issues Found (Grade < A)" --> ReadFixes["3. Open LAUNCH_FIXES.md"]
156
- ReadFixes --> PastePrompt["4. Paste Prompts to AI Tool"]
157
- PastePrompt --> ReScan["5. Re-run Scan to Verify"]
158
- ReScan --> Check
159
- Check -- "Clean (Grade A or Baseline)" --> Commit["6. Commit & Push Code"]
160
- Commit --> CI["7. CI/CD PR Gate (--ci)"]
161
- CI --> Deploy["8. Deploy (and check the manual checklist)"]
84
+ Wrong finding? https://github.com/SHARAJ379/Launch-Doctor/issues
162
85
  ```
163
86
 
164
- 1. **Pre-flight scan:** Before shipping changes or merging a branch, run `npx launch-doctor` in your workspace.
165
- 2. **Review findings:** Check your letter grade (A-F), category breakdown, and critical blockers in the terminal.
166
- 3. **Copy prompts to AI tools:** Open `LAUNCH_FIXES.md`. Copy the specific problem prompt or the single batch prompt and paste it into Claude Code, Cursor, Windsurf, Lovable, or Bolt.
167
- 4. **Verify remediation:** Re-run `npx launch-doctor` to verify the fixes and watch your grade increase.
168
- 5. **Establish baseline for legacy debt:** If you are adopting Launch Doctor on an existing project, run `npx launch-doctor --update-baseline` so CI only reports new issues.
169
- 6. **Automate CI gating:** Add `npx launch-doctor --ci` to your pull request workflow to catch regressions before they merge.
87
+ `npx launch-doctor prompt 1 --copy` puts fix prompt 1 on the clipboard and tells you which finding it is for. In an empty folder, or in a project in a language the checks don't read (Rust, Java, .NET and so on), Launch Doctor explains that instead of showing a grade.
170
88
 
171
89
  ## What it checks
172
90
 
@@ -188,20 +106,12 @@ Monitoring, legal, and first impressions checks run on web apps (a frontend fram
188
106
 
189
107
  ## Live site scan
190
108
 
191
- `npx launch-doctor scan https://myapp.com` checks your deployed site from the outside for a few things attackers and bots look for first. It makes a few dozen ordinary `GET` requests (at most about 90, when Supabase tables are tested) and never changes anything. Only scan sites you own or are allowed to test.
192
-
193
- What it looks at: your home page, up to 20 JavaScript files that page loads, their source maps, a fixed list of file paths (`/.env`, `/.git/...`, `backup.sql` and similar), and Supabase tables named in that JavaScript. It does not crawl other pages, log in, fill in forms, or call your API, and it only tests whether Supabase tables can be **read**, not written.
194
-
195
- | Category | What it catches | Severity range |
196
- |---|---|---|
197
- | Exposed files & keys (`live-exposure`) | `/.env`, `/.git` and SQL backups that can be downloaded (the content is verified, so single-page apps that answer 200 for every path are not flagged); public source maps; API keys inside the JavaScript every visitor downloads | Warning to critical |
198
- | Open database (`live-database`) | Supabase `service_role` key in the page; tables that return rows to anyone holding the public anon key (only `GET`, one row per table, and rows are never saved or shown) | Critical |
199
- | HTTPS & headers (`live-headers`) | Plain http; http that doesn't redirect to https; missing HSTS, Content-Security-Policy, `X-Content-Type-Options`, frame protection and `Referrer-Policy` | Warning to critical |
200
-
201
- The report uses the same grades and `--json`, `--ci`, `--fail-on`, `--out` and `--no-file` options. Fix prompts go to `LAUNCH_FIXES_LIVE.md` in the current folder. Run `npx launch-doctor scan --help` for the options.
109
+ `npx launch-doctor scan https://myapp.com` checks your deployed site from the outside: files that should not be public (`/.env`, `/.git`, SQL backups), source maps, API keys in the JavaScript every visitor downloads, Supabase tables anyone can read, and HTTPS and security headers. It makes a few dozen ordinary `GET` requests and never changes anything. Only scan sites you own or are allowed to test. Details: [docs/live-scan.md](docs/live-scan.md).
202
110
 
203
111
  ## Grading
204
112
 
113
+ The report shows two grades: **Security** (secrets, database, access control, payments, AI costs) and **Launch readiness** (email, monitoring, legal, first impressions). Each is worked out from its categories with the same rules as the overall grade below, which `--verbose` and `--json` still show.
114
+
205
115
  - **Category score** = 100 − 50 per critical finding − 15 per warning.
206
116
  - Any critical finding caps the category at 39, which is an F.
207
117
  - Without a critical finding the score never drops below 40, so warnings alone cannot produce an F.
@@ -214,264 +124,49 @@ The report uses the same grades and `--json`, `--ci`, `--fail-on`, `--out` and `
214
124
  - **Grade tiers:** A ≥ 90, B ≥ 75, C ≥ 60, D ≥ 40, F < 40.
215
125
  - "Check yourself" items do not alter the numerical grade. Baseline findings count toward the grade for awareness, but are ignored by the `--ci` exit code.
216
126
 
217
- ## CLI reference
218
-
219
- ```
220
- npx launch-doctor [folder] [options]
221
- npx launch-doctor init [folder] [--hooks]
222
- npx launch-doctor scan <url> [options]
223
- npx launch-doctor mcp
224
- npx launch-doctor hook <claude|cursor>
225
- ```
127
+ ## Commands
226
128
 
227
- | Flag | Default | Description |
228
- |---|---|---|
229
- | `[folder]` | `.` | Project folder to check |
230
- | `--domain <domain>` | auto-detected | Domain you send email from; checks SPF, DKIM and DMARC |
231
- | `--out <file>` | `LAUNCH_FIXES.md` in the project | Where to save the fix prompts |
232
- | `--no-file` | off | Don't write the fix prompts file |
233
- | `--json` | off | Print the full report as JSON (no fix file unless `--out` is given) |
234
- | `--sarif <file>` | off | Also write a SARIF 2.1.0 file for GitHub code scanning |
235
- | `--pr-comment` | off | On a GitHub pull request, post a summary comment and inline fix prompts (see [Pull request comments](#pull-request-comments)) |
236
- | `--offline` | off | Skip network checks (email DNS) |
237
- | `--ci` | off | Exit with code 1 on findings at or above `--fail-on` (no fix file unless `--out`) |
238
- | `--fail-on <level>` | `critical` | With `--ci`, the lowest severity that fails: `critical` or `warning` |
239
- | `--only <ids>` | all | Run only these categories (comma-separated) |
240
- | `--skip <ids>` | none | Skip these categories (comma-separated) |
241
- | `--history` | off | Also look for keys still in git history |
242
- | `--history-depth <n>` | `500` | How many commits `--history` reads |
243
- | `--update-baseline` | off | Save today's findings to `.launchdoctor-baseline.json` as accepted |
244
- | `--no-baseline` | off | Ignore `.launchdoctor-baseline.json` and show every finding |
245
- | `--config-from <ref>` | off | Read `.launchdoctorignore` and `.launchdoctor-baseline.json` from this git ref (branch, tag or commit) instead of the folder, and ignore inline `launch-doctor-ignore` comments on lines changed since that ref. The GitHub Action passes the pull request's base commit |
246
- | `--changed` | off | Only report on files changed since the last commit (edited, staged or new). Fast, for hooks. See [Hooks and fast mode](#hooks-and-fast-mode) |
247
- | `--staged` | off | Only report on files staged for the next commit. For a pre-commit hook |
248
- | `--demo` | off | Scan a built-in sample app full of mistakes |
249
- | `-h`, `--help` | | Show help |
250
- | `-v`, `--version` | | Show the version |
251
- | `init [folder]` | `.` | Create `.launchdoctorignore` and `.github/workflows/launch-doctor.yml` (never overwrites) |
252
- | `init --hooks` | `.` | Set up the Claude Code, Cursor and git pre-commit hooks (merges into existing files, never overwrites) |
253
- | `hook <claude|cursor>` | | What the Claude Code and Cursor hooks run. Reads the tool's JSON from stdin; you don't run it yourself |
254
- | `scan <url>` | | Check your deployed site from the outside (see [Live site scan](#live-site-scan)) |
255
- | `mcp` | | Start an MCP server so AI coding tools can run checks themselves (see [MCP server](#mcp-server)) |
256
- | `--no-db` | off | With `scan`, don't test Supabase tables with the public key found in the page |
257
-
258
- Category ids for `--only` and `--skip`: `secrets`, `database`, `access`, `payments`, `costs`, `email`, `monitoring`, `legal`, `first-impressions`. Skipped categories show as "skipped" and don't count toward the grade.
259
-
260
- **Exit codes**
261
-
262
- | Code | Meaning |
129
+ | Command | What it does |
263
130
  |---|---|
264
- | `0` | The scan finished (and with `--ci`, no findings at or above `--fail-on`) |
265
- | `1` | `--ci` was given and there are findings at or above `--fail-on` (baseline findings excluded) |
266
- | `2` | Usage error (unknown flag, invalid argument, folder not found) or a crash |
267
-
268
- ## Configuration
269
-
270
- ### `.launchdoctorignore`
271
-
272
- One entry per line. Run `npx launch-doctor init` to generate a starter template.
273
-
274
- ```
275
- no-error-tracking
276
- no-account-deletion
277
- legacy/
278
- scripts/seed.ts
279
- **/*.fixture.ts
280
- ```
281
-
282
- A plain word without path characters represents a finding id. Anything containing `/`, `*`, or `.`, or matching an existing file or folder on disk, is treated as a path pattern. Finding ids that do not correspond to any known check produce a warning to catch typos. Only the first 1,000 entries are used; if the file has more, the report says how many were skipped (and `--json` has `ignoreLinesSkipped`). The file is read only when it is a regular file in the project, not a symlink.
283
-
284
- ### Inline ignores
131
+ | `npx launch-doctor [folder]` | Check a project: the short report, and `LAUNCH_FIXES.md` with a fix prompt for every problem |
132
+ | `npx launch-doctor --verbose` | The full report: every category and every finding |
133
+ | `npx launch-doctor --demo` | Check a built-in sample app full of mistakes |
134
+ | `npx launch-doctor prompt <n> --copy` | Copy fix prompt n to the clipboard |
135
+ | `npx launch-doctor --ci` | Exit with code 1 on critical problems, for CI |
136
+ | `npx launch-doctor scan <url>` | Check your deployed site from the outside |
137
+ | `npx launch-doctor init` | Create `.launchdoctorignore` and a GitHub Actions workflow |
138
+ | `npx launch-doctor init --hooks` | Check every AI edit and every commit (`--upgrade` moves them to a new version) |
285
139
 
286
- To silence a specific finding at a single line, place a `launch-doctor-ignore <id>` directive on that line or the line directly above it. All directive styles are supported (`//`, `#`, `/* */`, `<!-- -->`, SQL `--`), and multiple ids can be separated by commas:
287
-
288
- ```ts
289
- // launch-doctor-ignore stripe-test-key
290
- const STRIPE_TEST_KEY = 'sk_test_...';
291
- ```
292
-
293
- ### Baseline
294
-
295
- When adding Launch Doctor to an existing codebase, record current findings so CI checks focus exclusively on new issues:
296
-
297
- ```bash
298
- npx launch-doctor --update-baseline
299
- ```
300
-
301
- On subsequent runs:
302
- - Matching findings are tagged with `baseline: true` in JSON output.
303
- - They are summarized in terminal output as a single "N existing issues (baseline)" line.
304
- - They are excluded from `--ci` / `--fail-on` failure checks.
305
-
306
- Findings are tracked by check ID, file path, and a fingerprint of the offending line, preserving baseline matches even as line numbers shift. Run with `--no-baseline` to display all suppressed findings.
307
-
308
- ## CI integration
309
-
310
- The `npx launch-doctor init` command creates this GitHub Actions workflow:
311
-
312
- ```yaml
313
- name: Launch Doctor
314
- on: [pull_request]
315
- jobs:
316
- check:
317
- runs-on: ubuntu-latest
318
- steps:
319
- - uses: actions/checkout@v7
320
- - uses: actions/setup-node@v7
321
- with:
322
- node-version: 22
323
- - run: npx launch-doctor --ci
324
- ```
325
-
326
- - **Severity gating:** By default, `--ci` exits with code 1 only on critical findings. Add `--fail-on warning` to fail builds on warnings as well.
327
- - **Job summaries:** When running in GitHub Actions, Launch Doctor automatically writes a markdown summary (including overall grade, category scorecard, and itemized issues with their file and line) to the GitHub Actions job summary tab via `GITHUB_STEP_SUMMARY`.
328
- - **Step outputs:** When `GITHUB_OUTPUT` is set, the `grade`, `score`, `critical` and `warnings` values are saved as step outputs.
329
- - **Code scanning alerts:** Export findings to SARIF 2.1.0 format to populate alerts directly in your repository Security tab. The upload step needs permission to write security events, so add it to the job:
330
-
331
- ```yaml
332
- permissions:
333
- contents: read
334
- security-events: write
335
- steps:
336
- # ...checkout and setup-node as above...
337
- - run: npx launch-doctor --sarif launch-doctor.sarif --no-file
338
- - uses: github/codeql-action/upload-sarif@v3
339
- if: always()
340
- with:
341
- sarif_file: launch-doctor.sarif
342
- ```
343
-
344
- ### Pull request comments
345
-
346
- The Launch Doctor GitHub Action reviews each pull request like a teammate would:
347
-
348
- - **Inline comments** on the lines the pull request adds, each with the plain-English risk, a fix prompt you can paste into your AI tool, and the `launch-doctor-ignore` comment that silences it.
349
- - **One summary comment** with the grade, what this pull request added, what was already in the project, and the category scorecard. It is edited in place on every push, not posted again.
350
- - Findings that were already commented on are not repeated, findings in `.launchdoctor-baseline.json` are left out, and each run posts at most 20 inline comments (the rest are listed in the summary).
351
- - `.launchdoctorignore` and `.launchdoctor-baseline.json` are read from the base branch (with `--config-from`), not from the pull request, so a pull request can't silence its own findings by adding lines to them. An ignore or baseline change takes effect once it is merged. Inline `launch-doctor-ignore` comments on lines the pull request adds or changes are ignored too (so are all comments in files it adds); comments that were already on the base branch keep working, even if the pull request moves them down the file. To accept a finding, merge the comment (or the ignore line) first.
352
-
353
- ```yaml
354
- name: Launch Doctor
355
- on: [pull_request]
356
- permissions:
357
- contents: read
358
- pull-requests: write
359
- jobs:
360
- check:
361
- runs-on: ubuntu-latest
362
- steps:
363
- - uses: actions/checkout@v7
364
- - uses: SHARAJ379/Launch-Doctor@v0
365
- ```
366
-
367
- | Input | Default | Description |
368
- |---|---|---|
369
- | `path` | `.` | Folder to check, relative to the repository root |
370
- | `fail-on` | `critical` | Lowest severity that fails the check: `critical`, `warning` or `never` |
371
- | `comment` | `true` | Post the summary and inline comments on pull requests |
372
- | `args` | | Extra options, for example `--offline --skip legal` |
373
- | `github-token` | `${{ github.token }}` | Token used for the comments |
374
-
375
- The action also sets the `grade`, `score`, `critical` and `warnings` outputs. Pull requests from forks get a read-only token, so they can't be commented on; the check still runs and the job summary still has the results.
376
-
377
- Using the CLI directly instead? Add `--pr-comment` and pass the token: `npx launch-doctor --ci --pr-comment` with `env: GITHUB_TOKEN: ${{ github.token }}`.
140
+ Every option, the exit codes and the rarely used flags (`--history-depth`, `--config-from`, `--sarif` and others) are in [docs/cli.md](docs/cli.md).
378
141
 
379
142
  ## Using with AI coding tools
380
143
 
381
- Launch Doctor outputs `LAUNCH_FIXES.md` directly into your project root. Each entry includes the exact file and line number, an explanation of the risk, and a tailored prompt ready to paste into your AI assistant. It also includes a single batch prompt at the top of the file.
382
-
383
- ### With Claude Code
384
-
385
- ```bash
386
- ! npx launch-doctor
387
- Fix the issues in LAUNCH_FIXES.md one at a time, starting with the critical ones. Explain each change before making it.
388
- ```
389
-
390
- ### With Cursor, Windsurf, Lovable, or Bolt
391
-
392
- 1. Run `npx launch-doctor` in your integrated terminal.
393
- 2. Open `LAUNCH_FIXES.md`.
394
- 3. Copy one fix prompt into the chat window.
395
- 4. Review and accept the code edit.
396
- 5. Re-run `npx launch-doctor` to observe your score improve.
144
+ `LAUNCH_FIXES.md` starts with one prompt for all the critical problems, then has one prompt per problem with the file, the line and the risk in plain English. Paste them one at a time into Claude Code, Cursor, Windsurf, Lovable or Bolt, or copy one with `npx launch-doctor prompt <n> --copy`. `npx launch-doctor init --hooks` makes Claude Code and Cursor run the check after every edit, and `npx launch-doctor mcp` lets your AI tool run it itself. Details: [docs/ai-tools.md](docs/ai-tools.md).
397
145
 
398
- ### Hooks and fast mode
399
-
400
- An MCP tool only runs when the AI decides to call it. Hooks run every time, so problems are caught while the AI is still working on the file:
401
-
402
- ```bash
403
- npx launch-doctor init --hooks
404
- ```
405
-
406
- This sets up three things, merging into files you already have (it never replaces them, and a settings file that isn't valid JSON is left alone):
407
-
408
- | Where | What it does |
409
- |---|---|
410
- | `.claude/settings.json` | A Claude Code `PostToolUse` hook. After Claude writes or edits a file, Launch Doctor checks that one file. If it finds a problem, Claude gets the problem and the fix prompt straight away (exit code 2), so it can fix it in the same turn. |
411
- | `.cursor/hooks.json` | A Cursor `stop` hook. When the agent finishes, Launch Doctor checks the files changed since the last commit and, if it finds problems, sends them back to the agent as a follow-up message. (Cursor's `afterFileEdit` hook is not used: its documentation doesn't say that its output reaches the agent.) |
412
- | `.git/hooks/pre-commit` (or wherever `core.hooksPath` points) | Checks the staged files before each commit. Only critical problems stop the commit; it prints nothing when all is well. Skip it once with `git commit --no-verify`. If the tool itself fails (for example npx can't reach npm), you see the error and the commit goes ahead. An existing shell hook keeps its content and the check is added at the top; a hook written in another language is left alone. |
413
-
414
- The hooks run `npx --yes "launch-doctor@^X.Y.0"`, pinned to the minor version that wrote them (for example `launch-doctor@^0.4.0`), so a hook never silently starts running a newer minor or major release. npx uses your installed copy if it matches, and otherwise downloads it from npm the first time. To move to a newer version, edit the version in the hook files or delete the Launch Doctor entries and run `init --hooks` again. Everything else stays local.
415
-
416
- **`--changed` and `--staged`** are the fast mode the hooks use. You can run them yourself too:
417
-
418
- ```bash
419
- npx launch-doctor --changed # edited, staged and new files since the last commit
420
- npx launch-doctor --staged --ci # what the next commit will contain; exit code 1 on critical problems
421
- ```
146
+ ## Documentation
422
147
 
423
- The whole project is still read, so checks that look across files (is there a middleware, does this route check who is calling) keep working. Then only findings *in the changed files* are reported. The email DNS lookups are skipped, `LAUNCH_FIXES.md` is not written (unless you pass `--out`), and the report says that it covers only some files. The grade is for those files, not for the project. `--changed` and `--staged` can't be combined with `--update-baseline`, `--pr-comment` or `--history`.
424
-
425
- **What fast mode can miss compared with a full scan:**
426
- - Problems with no single file: no error tracking, no privacy policy, no rate limiting, a missing `.env` entry in `.gitignore`, and the "check yourself" list.
427
- - Problems that appear in a file you didn't touch because of a change elsewhere. If you delete the middleware that protected your API routes, the routes are reported as unprotected only when they are in the changed set.
428
- - The Claude Code hook checks one file at a time, so it won't mention an older problem in another file.
429
- - `--staged` reads the files as they are on disk. If you staged only part of a file (`git add -p`), the unstaged part is checked too.
430
- - Deleted files are not checked, and files git ignores are not reported.
431
-
432
- Run a full `npx launch-doctor` before you launch, and keep `--ci` on pull requests (see [CI integration](#ci-integration)).
433
-
434
- ### MCP server
435
-
436
- `launch-doctor mcp` starts a [Model Context Protocol](https://modelcontextprotocol.io) server, so your AI assistant can run the checkup itself, read the findings and fix them without you copying anything.
437
-
438
- **Claude Code:**
439
-
440
- ```bash
441
- claude mcp add launch-doctor -- npx -y launch-doctor mcp
442
- ```
443
-
444
- **Cursor** (`.cursor/mcp.json`) and other tools that use the same format:
445
-
446
- ```json
447
- {
448
- "mcpServers": {
449
- "launch-doctor": { "command": "npx", "args": ["-y", "launch-doctor", "mcp"] }
450
- }
451
- }
452
- ```
453
-
454
- Then ask: *"Run Launch Doctor on this project and fix the critical findings one at a time."*
455
-
456
- | Tool | What it does |
457
- |---|---|
458
- | `scan_project` | Checks a folder (default: the one the assistant works in). Returns the grade, every finding with its file, line, explanation and fix prompt, and the checklist of things to verify by hand. Options: `path`, `only`, `skip`, `offline`, `domain`, `history`, `includeBaseline`. |
459
- | `scan_url` | Checks a deployed site from the outside, like `launch-doctor scan <url>`. Options: `url`, `skipDatabase`. |
460
- | `list_checks` | Lists the categories and every finding id, for `only`, `skip` and `.launchdoctorignore`. |
461
-
462
- The tools only read: nothing is written to your project, and results also come back as structured data for clients that use it. The server speaks MCP over stdio (protocol versions 2024-11-05 to 2025-11-25) and has no dependencies.
148
+ - [CLI reference](docs/cli.md): every command, option and exit code
149
+ - [Configuration](docs/configuration.md): `.launchdoctorignore`, inline ignores, the baseline, grade history and the badge
150
+ - [CI integration](docs/ci.md): GitHub Actions, SARIF code scanning, scheduled monitoring and pull request comments
151
+ - [AI coding tools](docs/ai-tools.md): Claude Code, Cursor and others, hooks and fast mode, the MCP server
152
+ - [Live site scan](docs/live-scan.md): what `scan <url>` checks
153
+ - [How it works](docs/how-it-works.md): the analysis pipeline and the fix loop
154
+ - [Using it as a library](docs/library.md) (experimental)
155
+ - [Coverage](docs/coverage.md), [roadmap](docs/roadmap.md) and [architecture](docs/architecture.md)
463
156
 
464
157
  ## Privacy and network use
465
158
 
466
159
  Launch Doctor analyzes your codebase locally on your device. Your source code, findings, and credentials are never uploaded to any remote server. Detected secrets are masked in reports (for example, `sk_live_…exe9`).
467
160
 
468
161
  - **Email DNS validation:** This is the only network check a folder scan performs. When your project sends transactional email and a domain is identified (either discovered in code or specified via `--domain`), Launch Doctor queries your system DNS resolver for NS and TXT records (including root SPF, `send.<domain>`, `_dmarc.<domain>`, and common DKIM selectors). No code or private data is transmitted. Pass `--offline` to disable DNS lookups entirely. The `--demo` command never touches the network.
469
- - **Live site scan (`scan <url>`):** sends ordinary `GET` requests to the address you give, to the JavaScript files and source maps that page loads (which may be on another domain, such as a CDN), and to your Supabase project when the page uses one. For the Supabase test it sends the public anon key it found in your page back to your own Supabase project. Nothing else is sent, and nothing is uploaded. When the address you give is a public site, the scan never sends a request to a private or local network address (your router, the cloud metadata address, `localhost`), even if the page or a redirect points there; you can still scan your own dev server by giving its address. See [SECURITY.md](SECURITY.md) for the details and one known gap.
162
+ - **Live site scan (`scan <url>`):** sends ordinary `GET` requests to the address you give, to the JavaScript files and source maps that page loads (which may be on another domain, such as a CDN), and to your Supabase project when the page uses one. For the Supabase test it sends the public anon key it found in your page back to your own Supabase project. Nothing else is sent, and nothing is uploaded. When the address you give is a public site, the scan never sends a request to a private or local network address (your router, the cloud metadata address, `localhost`), even if the page or a redirect points there; you can still scan your own dev server by giving its address. Each request connects only to the address that was checked for it, so a DNS server can't switch it to a private one afterwards (DNS rebinding). See [SECURITY.md](SECURITY.md) for the details.
470
163
  - **No telemetry:** Launch Doctor does not collect usage data or phone home.
471
164
  - **Git history analysis (`--history`):** Runs local `git log` commands directly on your system without network requests.
472
165
  - **Pull request comments (`--pr-comment`):** calls the GitHub API with the workflow's token to read the pull request's changed files and post comments. It only runs on GitHub Actions and sends finding titles, explanations, fix prompts and file paths, never your source code.
473
166
  - **MCP server (`mcp`):** talks to your AI tool over stdin and stdout only; it opens no port. Its tools make the same network calls as the CLI: email DNS lookups for `scan_project` (unless `offline`), and the requests to the site you name for `scan_url`, which only accepts public sites.
474
167
  - **Hooks (`init --hooks`):** the hooks themselves make no network requests beyond `npx --yes "launch-doctor@^X.Y.0"`, which downloads the package from the npm registry the first time if it isn't installed. `--changed` and `--staged` skip the email DNS lookups.
168
+ - **Grade history and badge (`--record`):** written to `.launchdoctor/` in your project. No badge service is involved and nothing is sent anywhere.
169
+ - **Scheduled monitoring (`init --monitor`):** the workflow runs on GitHub's servers and makes the same requests as the commands it runs (`npx`, the email DNS lookups, and `scan` when `LAUNCH_DOCTOR_URL` is set), then pushes its commit to the `launch-doctor-grades` branch of your repository.
475
170
  - **Package installation:** standard `npx` retrieval via the npm registry.
476
171
 
477
172
  ## What it cannot do
@@ -479,7 +174,7 @@ Launch Doctor analyzes your codebase locally on your device. Your source code, f
479
174
  Launch Doctor is useful because it is fast and specific. That also means it has clear blind spots. If any of these matter for your app, use another tool or a human review as well.
480
175
 
481
176
  **Fast mode and hooks check less than a full scan**
482
- - `--changed`, `--staged` and the hooks report only on the files that changed, so project-wide problems and anything caused by a change in another file are missed. See [Hooks and fast mode](#hooks-and-fast-mode) for the list. They are a safety net while you work, not a replacement for a full run before launch.
177
+ - `--changed`, `--staged` and the hooks report only on the files that changed, so project-wide problems and anything caused by a change in another file are missed. See [Hooks and fast mode](docs/ai-tools.md#hooks-and-fast-mode) for the list. They are a safety net while you work, not a replacement for a full run before launch.
483
178
 
484
179
  **It doesn't see your running app or your production settings**
485
180
  - Production environment variables (Vercel, Netlify, Render and others) are invisible. A malformed URL, a wrong key or a bad model name in production will not be caught.
@@ -505,7 +200,7 @@ Launch Doctor is useful because it is fast and specific. That also means it has
505
200
  - **Basic:** Ruby, PHP and Go are scanned for hard-coded secrets and a few patterns, but their frameworks and dependency files are not understood.
506
201
 
507
202
  **It skips some files**
508
- - `node_modules`, `dist`, `build`, `out`, `coverage`, `vendor`, `venv`, `target`, `generated` and a few other build or dependency folders, and hidden folders other than `.github` (such as `.venv` and `.next`).
203
+ - `node_modules`, `dist`, `build`, `out`, `coverage`, `vendor`, `venv`, `target`, `generated` and a few other build or dependency folders, and hidden folders other than `.github` (such as `.venv`, `.next` and Launch Doctor's own `.launchdoctor`).
509
204
  - Files over 1 MB, minified `.min.js` files, source maps and binary files.
510
205
  - Everything after the first 20,000 files, or after 128 MB of text in total (the report says when either happens).
511
206
  - Symlinks, FIFOs and other special files.
@@ -514,7 +209,7 @@ For apps that handle significant money or sensitive personal or health data, use
514
209
 
515
210
  ## How it is tested
516
211
 
517
- - 334 automated tests run on every change, on Windows, macOS and Linux, with Node.js 22 and 24.
212
+ - 386 automated tests run on every change, on Windows, macOS and Linux, with Node.js 22 and 24.
518
213
  - A stress-test harness (`scripts/stress/`, see [CONTRIBUTING.md](CONTRIBUTING.md#stress-tests)) runs Launch Doctor against hostile inputs: repositories whose git settings try to run programs, symlink loops and FIFOs, files built to make a regular expression backtrack, terminal escape sequences, hostile servers for `scan`, and MCP requests to private addresses. Before 0.4.0 it found 10 security problems; each is fixed and has a regression test, and the whole suite now passes on Windows and Linux.
519
214
  - Every check that existed in 0.2 has been confirmed against a small project (or fake site) that contains exactly that problem, and every command in this README has been run (the `scan` examples against a local test site rather than a real one).
520
215
  - The features new in 0.3.0 (the GitHub Action, the MCP server, mobile apps, and Clerk, Convex, Appwrite, Paddle and Lemon Squeezy) have their own tests and were spot-checked by hand, which found and fixed two bugs before release. They have been tried less than the older checks. Posting pull request comments is tested against a fake GitHub API; it has not yet run on many real pull requests.
@@ -527,33 +222,18 @@ For apps that handle significant money or sensitive personal or health data, use
527
222
 
528
223
  If Launch Doctor reports something that is fine, misses a real problem, or crashes, please open an issue: [report a false alarm](https://github.com/SHARAJ379/Launch-Doctor/issues/new?template=false_positive.yml) or [report a bug](https://github.com/SHARAJ379/Launch-Doctor/issues/new?template=bug_report.yml). A short code snippet that reproduces it (with any keys removed) is the most helpful thing you can include. Fixes are released as small patch versions.
529
224
 
530
- Meanwhile you can silence a finding with `.launchdoctorignore` or an inline `launch-doctor-ignore` comment (see [Configuration](#configuration)).
225
+ Meanwhile you can silence a finding with `.launchdoctorignore` or an inline `launch-doctor-ignore` comment (see [Configuration](docs/configuration.md)).
531
226
 
532
227
  ## Roadmap
533
228
 
534
- Planned work, in no fixed order and without dates:
229
+ What comes next (the 0.5.0 engine rewrite, then milestones such as coverage reporting, more rules for the mistakes AI tools make, opt-in supply-chain and production-settings checks), and what is deliberately not planned, is in [docs/roadmap.md](docs/roadmap.md). What is checked today, mapped to the OWASP Top 10, and what is not covered, is in [docs/coverage.md](docs/coverage.md). Done so far:
535
230
 
536
231
  - [x] Live URL inspection (`launch-doctor scan <url>`: exposed `.env`, source maps, security headers, open Supabase tables via anonymous key)
537
- - [x] GitHub Action that posts a summary and inline fix prompts on pull requests ([Pull request comments](#pull-request-comments))
538
- - [x] Model Context Protocol (MCP) server for direct Claude Code and Cursor integration ([MCP server](#mcp-server))
232
+ - [x] GitHub Action that posts a summary and inline fix prompts on pull requests ([Pull request comments](docs/ci.md#pull-request-comments))
233
+ - [x] Model Context Protocol (MCP) server for direct Claude Code and Cursor integration ([MCP server](docs/ai-tools.md#mcp-server))
539
234
  - [x] Extended provider coverage (Clerk, Convex, Appwrite, Lemon Squeezy, Paddle)
540
235
  - [x] Mobile framework support (Expo, React Native)
541
-
542
- ## Using it as a library (experimental)
543
-
544
- The package can also be imported. This API is **experimental**: the names and signatures below keep working through 0.5.0, and any change after that is announced in the changelog first.
545
-
546
- ```ts
547
- import { runDoctor, renderReport, renderFixes } from 'launch-doctor';
548
-
549
- const report = await runDoctor('./my-app', { offline: true });
550
- console.log(report.grade, report.counts);
551
- process.stdout.write(renderReport(report));
552
- ```
553
-
554
- - `runDoctor(folder, options)` returns the same report as `--json`. The options include `offline`, `only`, `skip`, `onlyFiles`, `configFrom`, `history`, `baseline`, `maxFiles` and `maxBytes`.
555
- - `renderReport(report)`, `renderFixes(report)` (the text of `LAUNCH_FIXES.md`), `renderPrComment(...)`, `postPrFeedback(...)` and `prContextFromEnv(...)` are the renderers the CLI and the GitHub Action use.
556
- - `ProjectContext`, `CHECKS`, `CATEGORY_IDS()` and `isInlineIgnored()` give lower-level access, and the report types are exported too.
236
+ - [x] Grade history, a README badge and weekly monitoring ([Grade history and badge](docs/configuration.md#grade-history-and-badge), [Scheduled monitoring](docs/ci.md#scheduled-monitoring))
557
237
 
558
238
  ## Contributing
559
239
 
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The ASCII banner shown at the top of an interactive full scan.
3
+ *
4
+ * Pre-rendered in the "ANSI Shadow" figlet font (two lines, because one line would be about 100
5
+ * columns wide and wrap in an 80-column terminal). It is a plain string constant on purpose: no
6
+ * figlet dependency. The test suite checks the shape (width, line count); the letters were checked
7
+ * against the real font when it was added.
8
+ */
9
+ export declare const BANNER: readonly string[];
10
+ /** Spaces in front of every banner line (the same indent as the rest of the report). */
11
+ export declare const BANNER_INDENT = " ";
12
+ /** Columns the terminal needs to show the banner without wrapping. */
13
+ export declare const BANNER_WIDTH: number;
14
+ export interface BannerContext {
15
+ /** The caller's say-so: this is a full scan with none of --json, --ci, --sarif, --out, --changed, --staged, --pr-comment or --no-banner. */
16
+ wanted: boolean;
17
+ isTTY: boolean;
18
+ columns: number | undefined;
19
+ env: NodeJS.ProcessEnv;
20
+ }
21
+ /** Show the banner only on an interactive terminal that is wide enough, and never in CI. */
22
+ export declare function shouldShowBanner(ctx: BannerContext): boolean;