An intelligent QA agent that actually runs against your app, finds real bugs, and fixes them.
Not a linter. Not a static analyzer. bugscout spins up your Next.js app, hits your API endpoints without auth tokens, queries your Supabase tables as an anonymous user, fires malformed payloads at your routes, checks if your Stripe webhook verifies signatures β and then tells you exactly what's broken and how to fix it.
βββββββββββββββββββββββββ
β bugscout v1.0.0 β
βββββββββββββββββββββββββ
Health Score: ββββββββββββββββββββ 62/100
π¨ Critical: 3 β οΈ High: 4 π Medium+Low: 6
β¨ Auto-fixable: 7 of 13
Top issues:
β’ [CRITICAL] Unprotected API route returns data without authentication
β’ [CRITICAL] Supabase table "users" readable without authentication (RLS missing)
β’ [CRITICAL] Stripe webhook endpoint does not verify signatures
- Every API route called without a token β does it return data?
- IDOR: authenticated as User A, request User B's data β does it leak?
- Supabase RLS: query your tables as anon β can you read rows you shouldn't?
- Token storage: are JWTs in
localStorage(XSS-vulnerable) or httpOnly cookies? - Supabase
service_rolekey used in client-side code? - Protected pages that render before redirecting
- Every mutation endpoint: empty body, SQL injection strings, 10MB strings, type confusion
- Database constraints: does your schema have
NOT NULL,UNIQUE,CHECKβ or is it relying on frontend validation only? - Race conditions: fire the same mutation 10Γ simultaneously β do you get duplicate records?
- Multi-step DB operations without transactions
- Unbounded queries with no
LIMITor pagination
- Webhook endpoints: do they call
stripe.webhooks.constructEvent()or trust any POST? - Price manipulation: is the amount taken from the request body (user-controllable)?
- Subscription status: premium routes that check auth but not whether the subscription is active
- CORS on webhook endpoints
- HTTP method handling:
DELETE /api/userswhen onlyGETis supported β crash or 405? - Rate limiting: 20 rapid requests β any 429s, or is your API wide open?
- Error leakage: do 500 responses contain stack traces, Postgres errors, or Prisma objects?
- Response times: any endpoint taking >3s?
- CORS policy: open
*vs restricted origins
- Hardcoded secrets in source: Stripe live keys, JWTs, AWS credentials
NEXT_PUBLIC_prefixed secrets (embedded in client bundle).env.localnot in.gitignore- Missing
next.config.jssecurity headers dangerouslyAllowSVGenabled
- Route segments missing
error.tsx(unhandled render errors crash the whole page) - Data-heavy pages missing
loading.tsx - List rendering without empty state handling
- Missing
metadataexport inlayout.tsx(no title, description, OG tags) - Images without
alttext, icon buttons withoutaria-label
bugscout fires real HTTP requests including SQL injection strings, XSS payloads, and rapid-fire requests at the target app. Only run it against apps you own or have explicit written permission to test.
- Use staging/dev environments, not production
- Never point
--urlat someone else's app - The
runcommand executesnpm run build && npm startβ only run on codebases you trust
npm install -g bugscout
# or run directly without installing
npx bugscout run .Requirements: Node.js 18+
npx bugscout run .Starts your app, runs all checks, writes qa-diagnosis.md.
npx bugscout run . --url https://your-staging-url.comSkip the local build β run against an already-running app.
npx bugscout fix .Runs diagnosis, then for each auto-fixable issue shows the diff and asks for confirmation. Verifies the build still passes after each fix. Commits each fix with a descriptive message.
npx bugscout fix . --yes # skip confirmation prompts
npx bugscout fix . --dry # show diffs only, don't apply
npx bugscout fix . --verbose # show diffs + applynpx bugscout scan .No app startup, no API calls. Just file analysis, stack detection, risk scoring. Completes in seconds.
npx bugscout generate .
npx bugscout generate . --provider openai --model gpt-4o
npx bugscout generate . --goal "focus on auth and payment flows"Analyzes your codebase with Claude or GPT-4 and produces a prioritized test strategy.
npx bugscout watch .Re-runs relevant checks on every file save. Like ESLint but for real security issues.
npx bugscout report .
npx bugscout report . --output ./docs/qa-report.mdEvery run produces a qa-diagnosis.md:
# π QA Diagnosis β my-app
## Run: 3/30/2026, 4:11 PM | Duration: 47.3s | Findings: 13
### Health Score
ββββββββββββββββββββ 62/100
### π¨ Critical Issues (Fix These Now)
**Unprotected API route returns data without authentication**
The route /api/users returned HTTP 200 with a data payload when called
with no authentication token.
π File: `app/api/users/route.ts`
π₯ Impact: Any unauthenticated user can retrieve data from /api/users.
π§ Fix: Add auth middleware to the route handler...
> β¨ Auto-fixable β run `npx bugscout fix .` to apply this fix
...
### β
What's Good
- Auth middleware present on /api/payments β
- Stripe webhook verifies signatures β
- Environment variables properly separated β
### π Coverage Summary
| Area | Checks Run | Passed | Failed | Skipped |
|-----------|-----------|--------|--------|---------|
| Auth | 6 | 3 | 3 | 0 |
| Payments | 4 | 3 | 1 | 0 |
| API | 5 | 4 | 1 | 0 |
...
### πΊοΈ Next Steps
1. Add session validation to /api/users/route.ts (~2 min, auto-fixable)
2. Enable RLS on users table (~15 min)
3. Add webhook signature verification (~15 min)
> Fixing these 3 issues would bring your health score from 62 to 92.When bugscout can safely fix an issue, it generates and applies the code change, verifies the build still passes, then commits:
| Fix | What it does |
|---|---|
addAuthCheck |
Injects getServerSession() + 401 guard at the top of an unprotected route |
addValidation |
Adds Zod schema + safeParse() to a POST handler |
addRateLimit |
Injects rate limiting middleware |
addErrorBoundary |
Creates error.tsx in route segments missing one |
addLoadingState |
Creates loading.tsx for data-heavy pages |
fixEnvExposure |
Removes NEXT_PUBLIC_ prefix from server-only secrets |
addMethodHandler |
Adds 405 Method Not Allowed for unhandled HTTP methods |
addCorsHeaders |
Replaces Access-Control-Allow-Origin: * with env-var origin |
addMetaTags |
Adds metadata export to app/layout.tsx |
Fixes that are recommended but not auto-applied (too risky):
- Supabase RLS policies
- Stripe webhook secret setup
- Database schema migrations
- Anything touching payment transaction logic
Set your API key in the environment:
# Claude (default β recommended)
export ANTHROPIC_API_KEY=sk-ant-...
npx bugscout generate .
# OpenAI
export OPENAI_API_KEY=sk-...
npx bugscout generate . --provider openaiFor the run and fix commands, no API key is needed β all checks are deterministic.
bugscout is purpose-built for the modern TypeScript/Next.js stack:
- Next.js 13/14/15 (App Router)
- Supabase β Auth, Database, RLS, Storage
- Prisma or Drizzle or raw Supabase client
- Stripe β payments, webhooks, subscriptions
- Vercel deployment
- TypeScript throughout
The scanner also handles Python (Django/Flask/FastAPI), Ruby (Rails), Go (Gin/Echo), Rust, Java, and PHP for static analysis and stack detection.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β bugscout run . β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
β Scanner (Phase 1) β
β fileAnalyzer stackDetector β
β testDetector ciDetector β
β riskAnalyzer β
ββββββββββββββββββ¬βββββββββββββββββ
β ScanResult
ββββββββββββββββββΌβββββββββββββββββ
β Engine (Phase 2) β
β Starts your app locally β
β ββββββββββββββββββββββββββββ β
β β auth data payment β β
β β api config frontend β β
β ββββββββββββββββββββββββββββ β
β Real HTTP calls + Supabase β
ββββββββββββββββββ¬βββββββββββββββββ
β EngineResult (findings[])
ββββββββββββββββββΌβββββββββββββββββ
β Reporter (Phase 3) β
β Health score calculation β
β qa-diagnosis.md generation β
ββββββββββββββββββ¬βββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
β Fixer (Phase 4) β β bugscout fix
β Show diff β confirm β apply β
β Verify build β git commit β
βββββββββββββββββββββββββββββββββββ
The checks run against the real app. Not static guesses. bugscout:
- Starts your Next.js app on a free port (
npm run build && npm start) - Creates temporary Supabase test users, gets real auth tokens
- Fires real HTTP requests to your real endpoints
- Queries your real Supabase tables with the anon key
- Cleans up all test data after
Add to your GitHub Actions workflow:
- name: QA Diagnosis
run: npx bugscout run . --json > qa-result.json
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Upload QA Report
uses: actions/upload-artifact@v4
with:
name: qa-diagnosis
path: qa-diagnosis.md
# Fail the build on critical findings
- name: Check health score
run: |
SCORE=$(node -e "const r=require('./qa-result.json'); process.exit(r.healthScore < 70 ? 1 : 0)")src/
βββ types/index.ts β all shared TypeScript interfaces
βββ scanner/
β βββ fileAnalyzer.ts β recursive walker, import/export extraction
β βββ stackDetector.ts β framework, ORM, auth, payment, DB detection
β βββ testDetector.ts β existing tests, coverage gaps
β βββ ciDetector.ts β GitHub Actions, GitLab, CircleCI, Jenkins
β βββ riskAnalyzer.ts β 0-100 risk score with typed reasons
β βββ index.ts β scanner orchestrator
βββ brain/
β βββ contextBuilder.ts β compacts scan output for LLM
β βββ prompts/stackAnalysis.ts β Handlebars system + user prompt templates
β βββ providers/claude.ts β Anthropic SDK, streaming, retry
β βββ providers/openai.ts β OpenAI SDK, same interface
β βββ index.ts β brain orchestrator
βββ engine/
β βββ checks/
β β βββ auth.ts β auth holes, IDOR, RLS, service_role
β β βββ data.ts β input validation, constraints, race conditions
β β βββ payment.ts β webhook verification, price manipulation
β β βββ api.ts β HTTP methods, rate limiting, error leakage
β β βββ config.ts β hardcoded secrets, env separation, next.config
β β βββ frontend.ts β error boundaries, loading states, meta tags
β βββ results/
β β βββ types.ts β Finding, CheckResult, EngineResult interfaces
β β βββ collector.ts β aggregates results, calculates health score
β βββ utils/
β β βββ httpClient.ts β fetch wrapper with timing
β β βββ supabaseClient.ts β test user management, RLS checks
β β βββ appStarter.ts β npm install + build + start + port detection
β βββ runner.ts β loads env vars, builds AppContext
β βββ index.ts β engine orchestrator
βββ reporter/
β βββ diagnosis.ts β Markdown report builder, terminal summary
βββ fixer/
β βββ applier.ts β 9 fix templates
β βββ diffDisplay.ts β terminal diff renderer
β βββ verifier.ts β build verification
β βββ index.ts β fix orchestrator
βββ bin/
βββ qa-agent.ts β CLI (commander.js)
Issues and PRs are welcome.
git clone https://github.com/BassamAA/qa-agent
cd qa-agent # (the repo is still called qa-agent on GitHub)
npm install
npm test # 49 tests
npm run build # compile TypeScriptWhen adding a new check:
- Create/extend a check file in
src/engine/checks/ - Return
CheckResult[]from your function - Register it in
src/engine/index.ts - Add the finding type to
src/engine/results/types.tsif needed
When adding a new auto-fix:
- Add a case to
src/fixer/applier.ts - Add the template name to the
FixTemplateunion type - Set
autoFixable: trueandfixTemplate: 'yourTemplate'in the finding
MIT