@codexstar/bug-hunter 3.0.5 → 3.0.7
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/CHANGELOG.md +63 -51
- package/SKILL.md +12 -12
- package/package.json +4 -3
- package/scripts/bug-hunter-state.cjs +0 -0
- package/scripts/payload-guard.cjs +0 -0
- package/scripts/prepublish-guard.cjs +82 -0
- package/scripts/run-bug-hunter.cjs +15 -2
- package/scripts/tests/fixtures/flaky-worker.cjs +0 -0
- package/scripts/tests/fixtures/success-worker.cjs +0 -0
- package/scripts/tests/run-bug-hunter.test.cjs +15 -0
- package/scripts/tests/worktree-harvest.test.cjs +1 -1
- package/skills/README.md +39 -14
- package/skills/doc-lookup/SKILL.md +51 -0
- package/skills/fixer/SKILL.md +124 -0
- package/skills/hunter/SKILL.md +172 -0
- package/skills/recon/SKILL.md +166 -0
- package/skills/referee/SKILL.md +143 -0
- package/skills/skeptic/SKILL.md +153 -0
- package/templates/subagent-wrapper.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,45 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [3.0.
|
|
8
|
+
## [3.0.7] - 2026-03-12
|
|
9
|
+
|
|
10
|
+
### Highlights
|
|
11
|
+
- **All agents are now first-class skills.** Hunter, Skeptic, Referee, Fixer, Recon, and Doc-Lookup are bundled under `skills/` with proper frontmatter - no more loose prompt files.
|
|
12
|
+
- **Prepublish guard** prevents publishing to npm without committing and pushing to GitHub first.
|
|
13
|
+
- **CI fully green** on both Node 18 and 20 with portable shell detection and explicit branch naming.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- `skills/hunter/SKILL.md` - deep behavioral code analysis skill (migrated from `prompts/hunter.md`)
|
|
17
|
+
- `skills/skeptic/SKILL.md` - adversarial code reviewer skill (migrated from `prompts/skeptic.md`)
|
|
18
|
+
- `skills/referee/SKILL.md` - independent final arbiter skill (migrated from `prompts/referee.md`)
|
|
19
|
+
- `skills/fixer/SKILL.md` - surgical code repair skill (migrated from `prompts/fixer.md`)
|
|
20
|
+
- `skills/recon/SKILL.md` - codebase reconnaissance skill (migrated from `prompts/recon.md`)
|
|
21
|
+
- `skills/doc-lookup/SKILL.md` - unified documentation access skill (Context Hub + Context7)
|
|
22
|
+
- `scripts/prepublish-guard.cjs` - blocks `npm publish` when git working tree is dirty or commits are unpushed
|
|
23
|
+
- `prepublishOnly` lifecycle hook in `package.json` enforcing the guard
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- `SKILL.md` orchestrator routing table now points to `skills/` instead of `prompts/`
|
|
27
|
+
- `run-bug-hunter.cjs` preflight now validates all 10 bundled skill `SKILL.md` files exist
|
|
28
|
+
- `run-bug-hunter.cjs` uses `process.env.SHELL || '/bin/bash'` instead of hardcoded `/bin/zsh` for CI portability
|
|
29
|
+
- `worktree-harvest.test.cjs` uses `git init --bare -b main` for CI environments where default branch is not `main`
|
|
30
|
+
- `templates/subagent-wrapper.md` references `skills/` paths instead of `prompts/`
|
|
31
|
+
- `skills/README.md` now documents all 10 bundled skills (6 core agents + 4 security skills)
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
- All v3.0.5 code changes that were published to npm but never committed to GitHub (21 new files, 19 updated files recovered)
|
|
35
|
+
- `package.json` version synced to match npm-published 3.0.5→3.0.6→3.0.7
|
|
36
|
+
|
|
37
|
+
## [3.0.6] - 2026-03-12
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
- `scripts/prepublish-guard.cjs` - first version of the publish safety net
|
|
41
|
+
- CI fixes for worktree tests and shell portability
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- Synced all v3.0.5 changes from npm to GitHub (security skills, PR review flow, schemas, images)
|
|
45
|
+
|
|
46
|
+
## [3.0.5] - 2026-03-11
|
|
9
47
|
|
|
10
48
|
### Added
|
|
11
49
|
- `agents/openai.yaml` UI metadata for skill lists and quick-invoke prompts
|
|
@@ -17,33 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
55
|
|
|
18
56
|
## [Unreleased]
|
|
19
57
|
|
|
20
|
-
|
|
21
|
-
- PR review is now a first-class workflow with `--pr`, `--pr current`, `--pr recent`, `--pr 123`, `--last-pr`, and `--pr-security`.
|
|
22
|
-
- Bug Hunter now emits both `fix-strategy.json` and `fix-plan.json` before fix execution so remediation stays reviewable and confidence-gated.
|
|
23
|
-
- The enterprise security pack now ships inside the repository under `skills/`, making PR security review and full security audits portable.
|
|
24
|
-
- Fix execution is now safer through schema-validated planning, atomic lock handling, safer worktree cleanup, stash preservation, and shell-safe templating.
|
|
25
|
-
|
|
26
|
-
### Added
|
|
27
|
-
- GitHub Actions npm publish workflow on release publish or manual dispatch, with version/tag verification before `npm publish`
|
|
28
|
-
- bundled local security skills under `skills/`: `commit-security-scan`, `security-review`, `threat-model-generation`, and `vulnerability-validation`
|
|
29
|
-
- enterprise security entrypoints: `--pr-security`, `--security-review`, and `--validate-security`
|
|
30
|
-
- regression tests and eval coverage for integrated local security-skill routing
|
|
31
|
-
- `schemas/fix-plan.schema.json` plus validation coverage for canonical fix-plan artifacts
|
|
32
|
-
- focused regressions for lock-token ownership, atomic lock acquisition, stale artifact clearing, shell-safe worker paths, failed-chunk fix-plan suppression, managed worktree cleanup, and stash-ref preservation
|
|
33
|
-
|
|
34
|
-
### Changed
|
|
35
|
-
- portable security capabilities now live inside the repository under `skills/` instead of depending on external machine-specific skill paths
|
|
36
|
-
- package metadata now ships the `skills/` directory for self-contained distribution
|
|
37
|
-
- main Bug Hunter orchestration now routes into the bundled local security skills for PR security review, threat-model generation, enterprise security review, and vulnerability validation
|
|
38
|
-
- fix-lock now uses owner tokens for renew/release, atomic acquisition under contention, and safe recovery from corrupted lock files
|
|
39
|
-
- run-bug-hunter now shell-quotes templated command arguments, clears stale artifacts before retries, validates fix-plan artifacts, and skips fix-plan emission when chunks fail
|
|
40
|
-
- worktree cleanup/status now preserve unrelated directories, preserve stash metadata from defensive harvests, and avoid reporting manifest-only worktrees as dirty
|
|
41
|
-
- current-PR git fallback now diffs against the discovered `origin/<default-branch>` ref when the base branch comes from `origin/HEAD`
|
|
42
|
-
- README now opens with a short “New in This Update” and PR-first quick-start section
|
|
43
|
-
- `llms.txt` and `llms-full.txt` now describe the PR review flow, bundled local security pack, current fix artifacts, and the current regression-test coverage
|
|
44
|
-
- `skills/README.md` now explains how the bundled security skills map into Bug Hunter workflows
|
|
45
|
-
|
|
46
|
-
## [3.0.4] — 2026-03-11
|
|
58
|
+
## [3.0.4] - 2026-03-11
|
|
47
59
|
|
|
48
60
|
### Added
|
|
49
61
|
- `schemas/*.schema.json` versioned contracts for recon, findings, skeptic, referee, coverage, fix-report, plus shared definitions and example findings fixtures
|
|
@@ -63,7 +75,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
63
75
|
- preflight now checks all shipped structured-output schemas, not just findings
|
|
64
76
|
- structured-output migration now enforces orchestrated outbound validation beyond the local/manual path
|
|
65
77
|
|
|
66
|
-
## [3.0.1]
|
|
78
|
+
## [3.0.1] - 2026-03-11
|
|
67
79
|
|
|
68
80
|
### Changed
|
|
69
81
|
- Loop and fix-loop completion now require full queued source-file coverage, not just CRITICAL/HIGH coverage
|
|
@@ -71,7 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
83
|
- Loop iteration guidance now scales `maxIterations` from queue size so large audits do not stop early
|
|
72
84
|
- Large-codebase mode now treats LOW domains as part of the default autonomous queue instead of optional skipped work
|
|
73
85
|
|
|
74
|
-
## [3.0.0]
|
|
86
|
+
## [3.0.0] - 2026-03-10
|
|
75
87
|
|
|
76
88
|
### Added
|
|
77
89
|
- `package.json` with `@codexstar/bug-hunter` package name
|
|
@@ -80,7 +92,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
80
92
|
- `bug-hunter doctor` checks environment readiness (Node.js, Context Hub, Context7, git)
|
|
81
93
|
- Install via: `npm install -g @codexstar/bug-hunter && bug-hunter install`
|
|
82
94
|
- Compatible with `npx skills add codexstar69/bug-hunter` for Cursor, Windsurf, Copilot, Kiro, and Claude Code
|
|
83
|
-
- `scripts/worktree-harvest.cjs`
|
|
95
|
+
- `scripts/worktree-harvest.cjs` - manages git worktrees for safe, isolated Fixer execution (6 subcommands: `prepare`, `harvest`, `checkout-fix`, `cleanup`, `cleanup-all`, `status`)
|
|
84
96
|
- 13 new tests in `scripts/tests/worktree-harvest.test.cjs` (full suite: 25/25 passing)
|
|
85
97
|
- 5 new error rows in SKILL.md for worktree failures: prepare, harvest dirty, harvest no-manifest, cleanup, and checkout-fix errors
|
|
86
98
|
|
|
@@ -90,7 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
90
102
|
- `templates/subagent-wrapper.md` updated with `{WORKTREE_RULES}` variable for Fixer isolation rules
|
|
91
103
|
- SKILL.md Step 5b now shows a visible `⚠️` warning when `chub` is not installed (previously a silent suggestion)
|
|
92
104
|
|
|
93
|
-
## [2.4.1]
|
|
105
|
+
## [2.4.1] - 2026-03-10
|
|
94
106
|
|
|
95
107
|
### Fixed
|
|
96
108
|
- `scripts/triage.cjs`: LOW-only repositories promoted into `scanOrder` so script-heavy codebases do not collapse to zero scannable files
|
|
@@ -101,28 +113,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
101
113
|
### Added
|
|
102
114
|
- `scripts/tests/run-bug-hunter.test.cjs`: regressions for LOW-only triage, optional `code-index`, `teams` backend selection, and delta-hop expansion
|
|
103
115
|
|
|
104
|
-
## [2.4.0]
|
|
116
|
+
## [2.4.0] - 2026-03-10
|
|
105
117
|
|
|
106
118
|
### Added
|
|
107
119
|
- `scripts/doc-lookup.cjs`: hybrid documentation lookup that tries [Context Hub](https://github.com/andrewyng/context-hub) (chub) first for curated, versioned, annotatable docs, then falls back to Context7 API when chub doesn't have the library
|
|
108
|
-
- Requires `@aisuite/chub` installed globally (`npm install -g @aisuite/chub`)
|
|
120
|
+
- Requires `@aisuite/chub` installed globally (`npm install -g @aisuite/chub`) - optional but recommended; pipeline works without it via Context7 fallback
|
|
109
121
|
|
|
110
122
|
### Changed
|
|
111
123
|
- All agent prompts (hunter, skeptic, fixer, doc-lookup) updated to use `doc-lookup.cjs` as primary with `context7-api.cjs` as explicit fallback
|
|
112
124
|
- Preflight smoke test now checks `doc-lookup.cjs` first, falls back to `context7-api.cjs`
|
|
113
125
|
- `run-bug-hunter.cjs` validates both scripts exist at startup
|
|
114
126
|
|
|
115
|
-
## [2.3.0]
|
|
127
|
+
## [2.3.0] - 2026-03-10
|
|
116
128
|
|
|
117
129
|
### Changed
|
|
118
|
-
- `LOOP_MODE=true` is the new default
|
|
130
|
+
- `LOOP_MODE=true` is the new default - every `/bug-hunter` invocation iterates until full CRITICAL/HIGH coverage
|
|
119
131
|
- `--loop` flag still accepted for backwards compatibility (no-op)
|
|
120
132
|
- Updated triage warnings, coverage enforcement, and all documentation to reflect the new default
|
|
121
133
|
|
|
122
134
|
### Added
|
|
123
135
|
- `--no-loop` flag to opt out and get single-pass behavior
|
|
124
136
|
|
|
125
|
-
## [2.2.1]
|
|
137
|
+
## [2.2.1] - 2026-03-10
|
|
126
138
|
|
|
127
139
|
### Fixed
|
|
128
140
|
- `modes/loop.md`: added explicit `ralph_start` call instructions with correct `taskContent` and `maxIterations` parameters
|
|
@@ -131,16 +143,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
131
143
|
- Changed completion signal from `<promise>DONE</promise>` to `<promise>COMPLETE</promise>` (correct ralph-loop API)
|
|
132
144
|
- Each iteration now calls `ralph_done` to proceed instead of relying on a non-existent hook
|
|
133
145
|
|
|
134
|
-
## [2.2.0]
|
|
146
|
+
## [2.2.0] - 2026-03-10
|
|
135
147
|
|
|
136
148
|
### Added
|
|
137
149
|
- Rollback timeout guard: `git revert` calls now timeout after 60 seconds; conflicts abort cleanly instead of hanging
|
|
138
150
|
- Dynamic lock TTL: single-writer lock TTL scales with queue size (`max(1800, bugs * 600)`)
|
|
139
151
|
- Lock heartbeat renewal: new `renew` command in `fix-lock.cjs`
|
|
140
|
-
- Fixer context budget: `MAX_BUGS_PER_FIXER = 5`
|
|
152
|
+
- Fixer context budget: `MAX_BUGS_PER_FIXER = 5` - large fix queues split into sequential batches
|
|
141
153
|
- Cross-file dependency ordering: when `code-index.cjs` is available, fixes are ordered by import graph
|
|
142
154
|
- Flaky test detection: baseline tests run twice; non-deterministic failures excluded from revert decisions
|
|
143
|
-
- Dynamic canary sizing: `max(1, min(3, ceil(eligible * 0.2)))`
|
|
155
|
+
- Dynamic canary sizing: `max(1, min(3, ceil(eligible * 0.2)))` - canary group scales with queue size
|
|
144
156
|
- Dry-run mode (`--dry-run`): preview planned fixes without editing files
|
|
145
157
|
- Machine-readable fix report: `.bug-hunter/fix-report.json` for CI/CD gating, dashboards, and ticket automation
|
|
146
158
|
- Circuit breaker: if >50% of fix attempts fail/revert (min 3 attempts), remaining fixes are halted
|
|
@@ -150,7 +162,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
150
162
|
- Per-bug revert granularity: clarified one-commit-per-bug as mandatory; reverts target individual bugs, not clusters
|
|
151
163
|
- Post-fix re-scan severity floor: fixer-introduced bugs below MEDIUM severity are logged but don't trigger `FIXER_BUG` status
|
|
152
164
|
|
|
153
|
-
## [2.1.0]
|
|
165
|
+
## [2.1.0] - 2026-03-10
|
|
154
166
|
|
|
155
167
|
### Added
|
|
156
168
|
- STRIDE/CWE fields in Hunter findings format, with CWE quick-reference mapping for security categories
|
|
@@ -164,14 +176,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
164
176
|
### Fixed
|
|
165
177
|
- `dep-scan.cjs` lockfile-aware audits (`npm`, `pnpm`, `yarn`, `bun`) and non-zero audit exit handling so vulnerability exits are not misreported as scanner failures
|
|
166
178
|
|
|
167
|
-
## [2.0.0]
|
|
179
|
+
## [2.0.0] - 2026-03-10
|
|
168
180
|
|
|
169
181
|
### Changed
|
|
170
|
-
- Triage moved to Step 1 (after arg parse)
|
|
171
|
-
- All mode files consume triage JSON
|
|
172
|
-
- Recon demoted to enrichment
|
|
182
|
+
- Triage moved to Step 1 (after arg parse) - was running before target resolved
|
|
183
|
+
- All mode files consume triage JSON - riskMap, scanOrder, fileBudget flow downstream
|
|
184
|
+
- Recon demoted to enrichment - no longer does file classification when triage exists
|
|
173
185
|
- Mode files compressed: small 7.3→2.9KB, parallel 7.9→4.2KB, extended 7.1→3.3KB, scaled 7.3→2.7KB
|
|
174
|
-
- Skip-file patterns consolidated
|
|
186
|
+
- Skip-file patterns consolidated - single authoritative list in SKILL.md
|
|
175
187
|
- Error handling table updated with correct step references
|
|
176
188
|
- hunter.md: scope rules and security checklist compressed
|
|
177
189
|
- recon.md: output format template and "What to map" sections compressed
|
|
@@ -181,23 +193,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
181
193
|
- single-file.md: local-sequential backend support added
|
|
182
194
|
|
|
183
195
|
### Added
|
|
184
|
-
- `modes/_dispatch.md`
|
|
196
|
+
- `modes/_dispatch.md` - shared dispatch patterns (18 references across modes)
|
|
185
197
|
|
|
186
198
|
### Removed
|
|
187
|
-
- Step 7.0 re-audit gate removed
|
|
199
|
+
- Step 7.0 re-audit gate removed - duplicated Referee's work
|
|
188
200
|
- FIX-PLAN.md deleted (26KB dead planning doc)
|
|
189
201
|
- README.md compressed from 8.5KB to 3.7KB
|
|
190
202
|
- code-index.cjs marked optional
|
|
191
203
|
|
|
192
|
-
## [1.0.0]
|
|
204
|
+
## [1.0.0] - 2026-03-10
|
|
193
205
|
|
|
194
206
|
### Added
|
|
195
|
-
- `scripts/triage.cjs`
|
|
207
|
+
- `scripts/triage.cjs` - zero-token pre-recon triage, runs before any LLM agent (<2s for 2,000+ files)
|
|
196
208
|
- FILE_BUDGET, strategy, and domain map decided by triage, not Recon
|
|
197
209
|
- Writes `.bug-hunter/triage.json` with strategy, fileBudget, domains, riskMap, scanOrder
|
|
198
210
|
- `local-sequential.md` with full phase-by-phase instructions
|
|
199
211
|
- Subagent wrapper template in `templates/subagent-wrapper.md`
|
|
200
|
-
- Coverage enforcement
|
|
212
|
+
- Coverage enforcement - partial audits produce explicit warnings
|
|
201
213
|
- Large codebase strategy with domain-first tiered scanning
|
|
202
214
|
|
|
203
215
|
[Unreleased]: https://github.com/codexstar69/bug-hunter/compare/v3.0.5...HEAD
|
package/SKILL.md
CHANGED
|
@@ -182,7 +182,7 @@ Before doing anything else, verify the environment:
|
|
|
182
182
|
- Fallback probe order: `$HOME/.agents/skills/bug-hunter`, `$HOME/.claude/skills/bug-hunter`, `$HOME/.codex/skills/bug-hunter`.
|
|
183
183
|
- Use this path for ALL Read tool calls and shell commands.
|
|
184
184
|
|
|
185
|
-
2. **Verify skill files exist**: Run `ls "$SKILL_DIR/
|
|
185
|
+
2. **Verify skill files exist**: Run `ls "$SKILL_DIR/skills/hunter/SKILL.md"` via Bash. If this fails, stop and tell the user: "Bug Hunter skill files not found. Reinstall the skill and retry."
|
|
186
186
|
|
|
187
187
|
3. **Node.js available**: Run `node --version` via Bash. If it fails, stop and tell the user: "Node.js is required for doc verification. Please install Node.js to continue."
|
|
188
188
|
|
|
@@ -346,7 +346,7 @@ If `THREAT_MODEL_MODE=true`:
|
|
|
346
346
|
- If it exists but is >90 days old: warn user ("Threat model is N days old — regenerating"), regenerate.
|
|
347
347
|
- If it doesn't exist: generate it.
|
|
348
348
|
2. To generate:
|
|
349
|
-
- Read `$SKILL_DIR/
|
|
349
|
+
- Read `$SKILL_DIR/skills/threat-model-generation/SKILL.md`.
|
|
350
350
|
- Dispatch the threat model generation agent (or execute locally if local-sequential).
|
|
351
351
|
- Input: triage.json (if available) for file structure, or Glob-based discovery.
|
|
352
352
|
- Wait for `.bug-hunter/threat-model.md` to be written.
|
|
@@ -388,13 +388,13 @@ If `.bug-hunter/dep-findings.json` exists with REACHABLE findings, include them
|
|
|
388
388
|
|-------|-----------------|
|
|
389
389
|
| PR security review | `skills/commit-security-scan/SKILL.md` (if `PR_SECURITY_MODE=true` or the user asks for PR-focused security review) |
|
|
390
390
|
| Security review | `skills/security-review/SKILL.md` (if `SECURITY_REVIEW_MODE=true` or the user asks for an enterprise/full security audit) |
|
|
391
|
-
| Threat Model (Step 1b) | `skills/threat-model-generation/SKILL.md`
|
|
392
|
-
| Recon (Step 4) | `
|
|
393
|
-
| Hunters (Step 5) | `
|
|
391
|
+
| Threat Model (Step 1b) | `skills/threat-model-generation/SKILL.md` (only if THREAT_MODEL_MODE=true) |
|
|
392
|
+
| Recon (Step 4) | `skills/recon/SKILL.md` (skip for single-file mode) |
|
|
393
|
+
| Hunters (Step 5) | `skills/hunter/SKILL.md` + `prompts/examples/hunter-examples.md` |
|
|
394
394
|
| Security validation | `skills/vulnerability-validation/SKILL.md` (if `VALIDATE_SECURITY_MODE=true` or confirmed security findings need exploitability validation) |
|
|
395
|
-
| Skeptics (Step 6) | `
|
|
396
|
-
| Referee (Step 7) | `
|
|
397
|
-
| Fixers (Phase 2) | `
|
|
395
|
+
| Skeptics (Step 6) | `skills/skeptic/SKILL.md` + `prompts/examples/skeptic-examples.md` |
|
|
396
|
+
| Referee (Step 7) | `skills/referee/SKILL.md` |
|
|
397
|
+
| Fixers (Phase 2) | `skills/fixer/SKILL.md` (only if FIX_MODE=true) |
|
|
398
398
|
|
|
399
399
|
**Concrete examples for each backend:**
|
|
400
400
|
|
|
@@ -402,8 +402,8 @@ If `.bug-hunter/dep-findings.json` exists with REACHABLE findings, include them
|
|
|
402
402
|
|
|
403
403
|
```
|
|
404
404
|
# Phase B — launching Hunter yourself
|
|
405
|
-
# 1. Read the
|
|
406
|
-
read({ path: "$SKILL_DIR/
|
|
405
|
+
# 1. Read the skill file:
|
|
406
|
+
read({ path: "$SKILL_DIR/skills/hunter/SKILL.md" })
|
|
407
407
|
|
|
408
408
|
# 2. You now have the Hunter's full instructions. Execute them yourself:
|
|
409
409
|
# - Read each file in risk-map order using the Read tool
|
|
@@ -418,8 +418,8 @@ write({ path: ".bug-hunter/findings.json", content: "<your findings json>" })
|
|
|
418
418
|
|
|
419
419
|
```
|
|
420
420
|
# Phase B — launching Hunter via subagent
|
|
421
|
-
# 1. Read the
|
|
422
|
-
read({ path: "$SKILL_DIR/
|
|
421
|
+
# 1. Read the skill:
|
|
422
|
+
read({ path: "$SKILL_DIR/skills/hunter/SKILL.md" })
|
|
423
423
|
# 2. Read the wrapper template:
|
|
424
424
|
read({ path: "$SKILL_DIR/templates/subagent-wrapper.md" })
|
|
425
425
|
# 3. Fill the template with:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexstar/bug-hunter",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"description": "Adversarial AI bug hunter — multi-agent pipeline finds security vulnerabilities, logic errors, and runtime bugs, then fixes them autonomously. Works with Claude Code, Cursor, Codex CLI, Copilot, Kiro, and more.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "bin/bug-hunter",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"static-analysis"
|
|
31
31
|
],
|
|
32
32
|
"files": [
|
|
33
|
-
"agents/",
|
|
34
33
|
"bin/",
|
|
35
34
|
"scripts/",
|
|
36
35
|
"schemas/",
|
|
37
36
|
"prompts/",
|
|
38
37
|
"templates/",
|
|
39
38
|
"modes/",
|
|
40
|
-
"skills/",
|
|
41
39
|
"evals/",
|
|
42
40
|
"docs/",
|
|
41
|
+
"agents/",
|
|
42
|
+
"skills/",
|
|
43
43
|
"SKILL.md",
|
|
44
44
|
"README.md",
|
|
45
45
|
"CHANGELOG.md",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
|
+
"prepublishOnly": "node scripts/prepublish-guard.cjs",
|
|
60
61
|
"prepack": "node --test scripts/tests/*.test.cjs",
|
|
61
62
|
"test": "node --test scripts/tests/*.test.cjs",
|
|
62
63
|
"doctor": "node bin/bug-hunter doctor",
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* prepublish-guard.cjs
|
|
6
|
+
*
|
|
7
|
+
* Blocks `npm publish` unless:
|
|
8
|
+
* 1. Git working tree is clean (no uncommitted changes)
|
|
9
|
+
* 2. Current HEAD is pushed to origin (no unpushed commits)
|
|
10
|
+
* 3. package.json version matches the git tag (if tag exists)
|
|
11
|
+
*
|
|
12
|
+
* This prevents the "published to npm but forgot to commit/push" problem.
|
|
13
|
+
* Bypass with: SKIP_PREPUBLISH_GUARD=1 npm publish
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const { execSync } = require('child_process');
|
|
17
|
+
|
|
18
|
+
if (process.env.SKIP_PREPUBLISH_GUARD === '1') {
|
|
19
|
+
console.log('⚠️ prepublish-guard: SKIPPED (SKIP_PREPUBLISH_GUARD=1)');
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const run = (cmd) => execSync(cmd, { encoding: 'utf8' }).trim();
|
|
24
|
+
|
|
25
|
+
const errors = [];
|
|
26
|
+
|
|
27
|
+
// 1. Check for uncommitted changes
|
|
28
|
+
try {
|
|
29
|
+
const status = run('git status --porcelain');
|
|
30
|
+
if (status) {
|
|
31
|
+
errors.push(
|
|
32
|
+
'❌ Uncommitted changes detected. Commit or stash before publishing.\n' +
|
|
33
|
+
status.split('\n').map(l => ` ${l}`).join('\n')
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
errors.push('❌ Not a git repository or git not available.');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 2. Check for unpushed commits
|
|
41
|
+
try {
|
|
42
|
+
const unpushed = run('git log --oneline origin/main..HEAD 2>/dev/null');
|
|
43
|
+
if (unpushed) {
|
|
44
|
+
errors.push(
|
|
45
|
+
'❌ Unpushed commits. Run `git push` before publishing.\n' +
|
|
46
|
+
unpushed.split('\n').map(l => ` ${l}`).join('\n')
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
// If origin/main doesn't exist, skip this check
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 3. Version/tag consistency check
|
|
54
|
+
try {
|
|
55
|
+
const version = require('../package.json').version;
|
|
56
|
+
const tagExists = (() => {
|
|
57
|
+
try { run(`git rev-parse v${version} 2>/dev/null`); return true; } catch { return false; }
|
|
58
|
+
})();
|
|
59
|
+
if (tagExists) {
|
|
60
|
+
const tagCommit = run(`git rev-parse v${version}`);
|
|
61
|
+
const headCommit = run('git rev-parse HEAD');
|
|
62
|
+
if (tagCommit !== headCommit) {
|
|
63
|
+
errors.push(
|
|
64
|
+
`❌ Tag v${version} exists but points to a different commit.\n` +
|
|
65
|
+
` Tag: ${tagCommit.slice(0, 8)}\n` +
|
|
66
|
+
` HEAD: ${headCommit.slice(0, 8)}\n` +
|
|
67
|
+
` Bump the version or move the tag.`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
// Non-fatal
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (errors.length > 0) {
|
|
76
|
+
console.error('\n🛑 prepublish-guard: publish blocked\n');
|
|
77
|
+
errors.forEach(e => console.error(e + '\n'));
|
|
78
|
+
console.error('Bypass with: SKIP_PREPUBLISH_GUARD=1 npm publish\n');
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log('✅ prepublish-guard: clean tree, all pushed — safe to publish');
|
|
@@ -132,7 +132,19 @@ function requiredScripts(skillDir) {
|
|
|
132
132
|
path.join(skillDir, 'schemas', 'fix-plan.schema.json'),
|
|
133
133
|
path.join(skillDir, 'schemas', 'fix-strategy.schema.json'),
|
|
134
134
|
path.join(skillDir, 'schemas', 'recon.schema.json'),
|
|
135
|
-
path.join(skillDir, 'schemas', 'shared.schema.json')
|
|
135
|
+
path.join(skillDir, 'schemas', 'shared.schema.json'),
|
|
136
|
+
// Core agent skills (migrated from prompts/)
|
|
137
|
+
path.join(skillDir, 'skills', 'hunter', 'SKILL.md'),
|
|
138
|
+
path.join(skillDir, 'skills', 'skeptic', 'SKILL.md'),
|
|
139
|
+
path.join(skillDir, 'skills', 'referee', 'SKILL.md'),
|
|
140
|
+
path.join(skillDir, 'skills', 'fixer', 'SKILL.md'),
|
|
141
|
+
path.join(skillDir, 'skills', 'recon', 'SKILL.md'),
|
|
142
|
+
path.join(skillDir, 'skills', 'doc-lookup', 'SKILL.md'),
|
|
143
|
+
// Security skills
|
|
144
|
+
path.join(skillDir, 'skills', 'threat-model-generation', 'SKILL.md'),
|
|
145
|
+
path.join(skillDir, 'skills', 'commit-security-scan', 'SKILL.md'),
|
|
146
|
+
path.join(skillDir, 'skills', 'security-review', 'SKILL.md'),
|
|
147
|
+
path.join(skillDir, 'skills', 'vulnerability-validation', 'SKILL.md')
|
|
136
148
|
];
|
|
137
149
|
}
|
|
138
150
|
|
|
@@ -205,7 +217,8 @@ function sleep(ms) {
|
|
|
205
217
|
|
|
206
218
|
function runCommandOnce({ command, timeoutMs }) {
|
|
207
219
|
return new Promise((resolve) => {
|
|
208
|
-
const
|
|
220
|
+
const shell = process.env.SHELL || '/bin/bash';
|
|
221
|
+
const child = childProcess.spawn(shell, ['-lc', command], {
|
|
209
222
|
stdio: ['ignore', 'pipe', 'pipe']
|
|
210
223
|
});
|
|
211
224
|
let stdout = '';
|
|
File without changes
|
|
File without changes
|
|
@@ -68,6 +68,21 @@ test('run-bug-hunter preflight tolerates missing optional code-index helper', ()
|
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
// Copy bundled skill SKILL.md files
|
|
72
|
+
const skillNames = [
|
|
73
|
+
'hunter', 'skeptic', 'referee', 'fixer', 'recon', 'doc-lookup',
|
|
74
|
+
'threat-model-generation', 'commit-security-scan', 'security-review',
|
|
75
|
+
'vulnerability-validation'
|
|
76
|
+
];
|
|
77
|
+
for (const name of skillNames) {
|
|
78
|
+
const destDir = path.join(optionalSkillDir, 'skills', name);
|
|
79
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
80
|
+
fs.copyFileSync(
|
|
81
|
+
path.resolve(__dirname, '..', '..', 'skills', name, 'SKILL.md'),
|
|
82
|
+
path.join(destDir, 'SKILL.md')
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
const result = runJson('node', [
|
|
72
87
|
path.join(scriptsDir, 'run-bug-hunter.cjs'),
|
|
73
88
|
'preflight',
|
|
@@ -20,7 +20,7 @@ function makeGitFixture() {
|
|
|
20
20
|
// Bare origin
|
|
21
21
|
const origin = path.join(sandbox, 'origin.git');
|
|
22
22
|
fs.mkdirSync(origin, { recursive: true });
|
|
23
|
-
execFileSync('git', ['init', '--bare'], { cwd: origin, stdio: 'ignore' });
|
|
23
|
+
execFileSync('git', ['init', '--bare', '-b', 'main'], { cwd: origin, stdio: 'ignore' });
|
|
24
24
|
|
|
25
25
|
// Working clone
|
|
26
26
|
const repo = path.join(sandbox, 'repo');
|
package/skills/README.md
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
|
-
# Bundled
|
|
1
|
+
# Bundled Skills
|
|
2
2
|
|
|
3
|
-
Bug Hunter ships with
|
|
3
|
+
Bug Hunter ships with all agent skills under `skills/` so the repository stays portable and self-contained.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- `commit-security-scan`
|
|
7
|
-
- `security-review`
|
|
8
|
-
- `threat-model-generation`
|
|
9
|
-
- `vulnerability-validation`
|
|
5
|
+
## Core Agent Skills
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
These are the primary pipeline agents — migrated from `prompts/` to be first-class skills:
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
| Skill | Purpose |
|
|
10
|
+
|-------|---------|
|
|
11
|
+
| `hunter/` | Deep behavioral code analysis — finds logic errors, security vulnerabilities, race conditions |
|
|
12
|
+
| `skeptic/` | Adversarial code reviewer — challenges each finding to kill false positives |
|
|
13
|
+
| `referee/` | Independent final arbiter — delivers verdicts with CVSS scoring and PoC generation |
|
|
14
|
+
| `fixer/` | Surgical code repair — implements minimal, precise fixes for verified bugs |
|
|
15
|
+
| `recon/` | Codebase reconnaissance — maps architecture, trust boundaries, and risk priorities |
|
|
16
|
+
| `doc-lookup/` | Unified documentation access — Context Hub (chub) + Context7 API for framework verification |
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
## Security Skills
|
|
19
|
+
|
|
20
|
+
Specialized security workflows that integrate with the main Bug Hunter orchestration:
|
|
21
|
+
|
|
22
|
+
| Skill | Purpose | Trigger |
|
|
23
|
+
|-------|---------|---------|
|
|
24
|
+
| `commit-security-scan/` | Diff-scoped PR/commit/staged security review | `--pr-security` |
|
|
25
|
+
| `security-review/` | Full security workflow (threat model + code + deps + validation) | `--security-review` |
|
|
26
|
+
| `threat-model-generation/` | STRIDE threat model bootstrap/refresh | `--threat-model` |
|
|
27
|
+
| `vulnerability-validation/` | Exploitability/reachability/CVSS/PoC validation | `--validate-security` |
|
|
28
|
+
|
|
29
|
+
## How They Connect
|
|
30
|
+
|
|
31
|
+
Bug Hunter remains the top-level orchestrator (`SKILL.md`). The orchestrator reads agent skills at each pipeline phase:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Recon (skills/recon/)
|
|
35
|
+
→ Hunter (skills/hunter/) + doc-lookup (skills/doc-lookup/)
|
|
36
|
+
→ Skeptic (skills/skeptic/) + doc-lookup
|
|
37
|
+
→ Referee (skills/referee/)
|
|
38
|
+
→ Fix Strategy + Fix Plan
|
|
39
|
+
→ Fixer (skills/fixer/) + doc-lookup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
All doc-lookup calls use Context Hub (chub) as the primary documentation source with Context7 API as automatic fallback.
|
|
43
|
+
|
|
44
|
+
All artifacts are written under `.bug-hunter/` using Bug Hunter-native conventions.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-lookup
|
|
3
|
+
description: "Unified documentation lookup for Bug Hunter agents. Uses Context Hub (chub) as primary source with Context7 API fallback. Provides verified library/framework documentation to prevent false positives and ensure correct fix patterns."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Doc Lookup — Verified Documentation Access
|
|
7
|
+
|
|
8
|
+
## Documentation Lookup (Context Hub + Context7 fallback)
|
|
9
|
+
|
|
10
|
+
When you need to verify a claim about how a library, framework, or API actually behaves — do NOT guess from training data. Look it up.
|
|
11
|
+
|
|
12
|
+
### When to use this
|
|
13
|
+
|
|
14
|
+
- "This framework includes X protection by default" — verify it
|
|
15
|
+
- "This ORM parameterizes queries automatically" — verify it
|
|
16
|
+
- "This function validates input" — verify it
|
|
17
|
+
- "The docs say to do X" — verify it
|
|
18
|
+
- Any claim about library behavior that affects your bug verdict
|
|
19
|
+
|
|
20
|
+
### How to use it
|
|
21
|
+
|
|
22
|
+
`SKILL_DIR` is injected by the orchestrator. Use it for all helper script paths.
|
|
23
|
+
|
|
24
|
+
The lookup script tries **Context Hub (chub)** first for curated, versioned docs, then falls back to **Context7** when chub doesn't have the library.
|
|
25
|
+
|
|
26
|
+
**Step 1: Search for the library**
|
|
27
|
+
```bash
|
|
28
|
+
node "$SKILL_DIR/scripts/doc-lookup.cjs" search "<library>" "<what you need to know>"
|
|
29
|
+
```
|
|
30
|
+
Example: `node "$SKILL_DIR/scripts/doc-lookup.cjs" search "prisma" "SQL injection parameterized queries"`
|
|
31
|
+
|
|
32
|
+
This returns results from both sources with a `recommended_source` and `recommended_id`.
|
|
33
|
+
|
|
34
|
+
**Step 2: Fetch documentation**
|
|
35
|
+
```bash
|
|
36
|
+
node "$SKILL_DIR/scripts/doc-lookup.cjs" get "<library-or-id>" "<specific question>"
|
|
37
|
+
```
|
|
38
|
+
Example: `node "$SKILL_DIR/scripts/doc-lookup.cjs" get "prisma/orm" "are raw queries parameterized by default"`
|
|
39
|
+
|
|
40
|
+
This fetches curated docs from chub if available, otherwise Context7 documentation snippets with code examples.
|
|
41
|
+
|
|
42
|
+
**Optional flags:**
|
|
43
|
+
- `--lang js|py` — language variant (for chub docs with multiple languages)
|
|
44
|
+
- `--source chub|context7` — force a specific source
|
|
45
|
+
|
|
46
|
+
### Rules
|
|
47
|
+
|
|
48
|
+
- Only look up docs when you have a SPECIFIC claim to verify. Do not speculatively fetch docs for every library in the codebase.
|
|
49
|
+
- One lookup per claim. Don't chain 5 searches — pick the most impactful one.
|
|
50
|
+
- If the API fails or returns nothing useful, say so explicitly: "Could not verify from docs — proceeding based on code analysis."
|
|
51
|
+
- Cite what you found: "Per Express docs: [quote]" or "Prisma docs confirm that $queryRaw uses parameterized queries."
|