Skip to content

Commit b7ccb8f

Browse files
committed
fix: industry standards compliance — CLI, npm, CI, git hygiene
- package.json: add publishConfig (public), docs/ in files, main field, prepack script - bin/bug-hunter: add --version/-v flag, doctor exits 1 on failure, errors to stderr - .github/workflows/ci.yml: Node 18+20 matrix, tests, preflight, bin verification - .gitignore: **/.DS_Store pattern, add node_modules/, .ralph/, .claude/settings.local.json - CHANGELOG.md: reformatted to Keep a Changelog with [Unreleased] and comparison URLs - CODE_OF_CONDUCT.md: add enforcement contact email - SECURITY.md: add security report email - Untrack: .claude/settings.local.json, .ralph/, FIX-PLAN-v2.md
1 parent 2a21690 commit b7ccb8f

10 files changed

Lines changed: 134 additions & 403 deletions

File tree

.claude/settings.local.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18, 20]
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- name: Run tests
23+
run: node --test scripts/tests/*.test.cjs
24+
25+
- name: Run preflight check
26+
run: node scripts/run-bug-hunter.cjs preflight --skill-dir .
27+
28+
- name: Verify bin is executable
29+
run: test -x bin/bug-hunter
30+
31+
- name: Verify --version works
32+
run: node bin/bug-hunter --version
33+
34+
- name: Verify --help works
35+
run: node bin/bug-hunter --help

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
.DS_Store
1+
**/.DS_Store
22
*.swp
33
*.swo
44
*~
55
.env
66
.env.local
77
.idea/
88
.vscode/
9+
node_modules/
10+
.ralph/
11+
.claude/settings.local.json
912
.claude/bug-hunter-state.json
1013
.claude/bug-hunter-fix.lock
1114
.claude/bug-hunter-run.log

.ralph/bug-hunter-fix-pipeline-optimization.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 78 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,151 +1,148 @@
11
# Changelog
22

3-
## 3.0.0 — 2026-03-10
3+
All notable changes to this project will be documented in this file.
44

5-
### npm package, worktree-isolated Fixer, and cross-IDE installation
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
**npm global install and CLI:**
8-
- New `package.json` with `@codexstar/bug-hunter` package name
9-
- New `bin/bug-hunter` CLI entry point with `install`, `doctor`, and `info` commands
8+
## [Unreleased]
9+
10+
## [3.0.0] — 2026-03-10
11+
12+
### Added
13+
- `package.json` with `@codexstar/bug-hunter` package name
14+
- `bin/bug-hunter` CLI entry point with `install`, `doctor`, and `info` commands
1015
- `bug-hunter install` auto-detects Claude Code, Codex, Cursor, Kiro, and generic agents directories
1116
- `bug-hunter doctor` checks environment readiness (Node.js, Context Hub, Context7, git)
1217
- Install via: `npm install -g @codexstar/bug-hunter && bug-hunter install`
13-
14-
**Cross-IDE installation via skills.sh:**
1518
- Compatible with `npx skills add codexstar69/bug-hunter` for Cursor, Windsurf, Copilot, Kiro, and Claude Code
16-
- No publish step required — auto-discovered from public GitHub repo with valid SKILL.md
17-
18-
**Worktree-isolated Fixer dispatch (subagent/teams backends):**
19-
- New `scripts/worktree-harvest.cjs` — manages git worktrees for safe, isolated Fixer execution
20-
- 6 subcommands: `prepare`, `harvest`, `checkout-fix`, `cleanup`, `cleanup-all`, `status`
21-
- Fixer edits happen in an isolated worktree; commits land on the fix branch without touching the user's working tree
22-
- Crash recovery via `cleanup-all` with automatic stash preservation
23-
- Meta-file filtering prevents `.worktree-manifest.json` and `.harvest-result.json` from polluting dirty detection
19+
- `scripts/worktree-harvest.cjs` — manages git worktrees for safe, isolated Fixer execution (6 subcommands: `prepare`, `harvest`, `checkout-fix`, `cleanup`, `cleanup-all`, `status`)
20+
- 13 new tests in `scripts/tests/worktree-harvest.test.cjs` (full suite: 25/25 passing)
21+
- 5 new error rows in SKILL.md for worktree failures: prepare, harvest dirty, harvest no-manifest, cleanup, and checkout-fix errors
22+
23+
### Changed
2424
- `modes/fix-pipeline.md` updated with dual-path dispatch: worktree path (prepare → dispatch → harvest → cleanup) and direct path
2525
- `modes/_dispatch.md` updated with Fixer worktree lifecycle diagram and CRITICAL warning about Agent tool's built-in `isolation: "worktree"`
2626
- `templates/subagent-wrapper.md` updated with `{WORKTREE_RULES}` variable for Fixer isolation rules
27-
- 13 new tests in `scripts/tests/worktree-harvest.test.cjs` (full suite: 25/25 passing)
28-
29-
**Context Hub preflight warning:**
30-
- SKILL.md Step 5b now shows a visible `⚠️` warning when `chub` is not installed, with install command
31-
- Previously was a silent suggestion — now impossible to miss
32-
33-
**SKILL.md error table:**
34-
- 5 new error rows for worktree failures: prepare, harvest dirty, harvest no-manifest, cleanup, and checkout-fix errors
35-
36-
---
27+
- SKILL.md Step 5b now shows a visible `⚠️` warning when `chub` is not installed (previously a silent suggestion)
3728

38-
## 2026-03-10 13:26
29+
## [2.4.1]2026-03-10
3930

31+
### Fixed
4032
- `scripts/triage.cjs`: LOW-only repositories promoted into `scanOrder` so script-heavy codebases do not collapse to zero scannable files
4133
- `scripts/run-bug-hunter.cjs`: `teams` backend name aligned with the documented dispatch mode
4234
- `scripts/run-bug-hunter.cjs`: `code-index.cjs` treated as optional during preflight and gated only when index-backed flows are requested
4335
- `scripts/run-bug-hunter.cjs`: low-confidence delta expansion now reuses the caller's configured `--delta-hops` value
36+
37+
### Added
4438
- `scripts/tests/run-bug-hunter.test.cjs`: regressions for LOW-only triage, optional `code-index`, `teams` backend selection, and delta-hop expansion
4539

46-
## 2.4.0 — 2026-03-10
40+
## [2.4.0] — 2026-03-10
4741

48-
### Context Hub integration — curated docs with Context7 fallback
42+
### Added
43+
- `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
44+
- Requires `@aisuite/chub` installed globally (`npm install -g @aisuite/chub`) — optional but recommended; pipeline works without it via Context7 fallback
4945

50-
- New `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
46+
### Changed
5147
- All agent prompts (hunter, skeptic, fixer, doc-lookup) updated to use `doc-lookup.cjs` as primary with `context7-api.cjs` as explicit fallback
5248
- Preflight smoke test now checks `doc-lookup.cjs` first, falls back to `context7-api.cjs`
5349
- `run-bug-hunter.cjs` validates both scripts exist at startup
54-
- Requires `@aisuite/chub` installed globally (`npm install -g @aisuite/chub`) — optional but recommended; pipeline works without it via Context7 fallback
55-
56-
## 2.3.0 — 2026-03-10
5750

58-
### Loop mode is now on by default
51+
## [2.3.0] — 2026-03-10
5952

53+
### Changed
6054
- `LOOP_MODE=true` is the new default — every `/bug-hunter` invocation iterates until full CRITICAL/HIGH coverage
61-
- Added `--no-loop` flag to opt out and get single-pass behavior
6255
- `--loop` flag still accepted for backwards compatibility (no-op)
6356
- Updated triage warnings, coverage enforcement, and all documentation to reflect the new default
64-
- `/bug-hunter src/` now finds bugs, fixes them, AND loops until full coverage — zero flags needed
6557

66-
## 2.2.1 — 2026-03-10
58+
### Added
59+
- `--no-loop` flag to opt out and get single-pass behavior
6760

68-
### Fix: `--loop` mode now actually loops
61+
## [2.2.1] — 2026-03-10
6962

70-
The `--loop` flag was broken — loop mode files described a "ralph-loop" system but never called `ralph_start`, so the pipeline ran once and stopped. Fixed:
71-
72-
- **`modes/loop.md`**: added explicit `ralph_start` call instructions with correct `taskContent` and `maxIterations` parameters
73-
- **`modes/fix-loop.md`**: same fix for `--loop --fix` combined mode, plus removed manual state file creation (handled by `ralph_start`)
74-
- **`SKILL.md`**: added CRITICAL integration note requiring `ralph_start` call when `LOOP_MODE=true`
63+
### Fixed
64+
- `modes/loop.md`: added explicit `ralph_start` call instructions with correct `taskContent` and `maxIterations` parameters
65+
- `modes/fix-loop.md`: same fix for `--loop --fix` combined mode, plus removed manual state file creation (handled by `ralph_start`)
66+
- `SKILL.md`: added CRITICAL integration note requiring `ralph_start` call when `LOOP_MODE=true`
7567
- Changed completion signal from `<promise>DONE</promise>` to `<promise>COMPLETE</promise>` (correct ralph-loop API)
7668
- Each iteration now calls `ralph_done` to proceed instead of relying on a non-existent hook
7769

78-
## 2.2.0 — 2026-03-10
79-
80-
### Fix pipeline hardening — 12 reliability and safety optimizations
70+
## [2.2.0] — 2026-03-10
8171

82-
- **Rollback timeout guard**: `git revert` calls now timeout after 60 seconds; conflicts abort cleanly instead of hanging the pipeline indefinitely
83-
- **Dynamic lock TTL**: single-writer lock TTL scales with queue size (`max(1800, bugs * 600)`), preventing expiry on large fix runs
84-
- **Lock heartbeat renewal**: new `renew` command in `fix-lock.cjs` — fixer renews the lock after each bug fix to prevent mid-run TTL expiry
85-
- **Fixer context budget**: `MAX_BUGS_PER_FIXER = 5` — large fix queues are split into sequential batches to prevent context window overflow and hallucinated patches
86-
- **Cross-file dependency ordering**: when `code-index.cjs` is available, fixes are ordered by import graph (fix dependencies before dependents)
87-
- **Flaky test detection**: baseline tests run twice; tests that fail non-deterministically are excluded from revert decisions
88-
- **Per-bug revert granularity**: clarified one-commit-per-bug as mandatory; reverts target individual bugs, not clusters
89-
- **Dynamic canary sizing**: `max(1, min(3, ceil(eligible * 0.2)))` — canary group scales with queue size instead of hardcoded 1–3
90-
- **Post-fix re-scan severity floor**: fixer-introduced bugs below MEDIUM severity are logged but don't trigger `FIXER_BUG` status
91-
- **Dry-run mode** (`--dry-run`): preview planned fixes without editing files — Fixer reads code and outputs unified diff previews, no git commits
92-
- **Machine-readable fix report**: `.bug-hunter/fix-report.json` written alongside markdown report for CI/CD gating, dashboards, and ticket automation
93-
- **Circuit breaker**: if >50% of fix attempts fail/revert (min 3 attempts), remaining fixes are halted to prevent token waste on unstable codebases
94-
- **Global Phase 2 timeout**: 30-minute deadline for the entire fix execution phase; unprocessed bugs are marked SKIPPED
72+
### Added
73+
- Rollback timeout guard: `git revert` calls now timeout after 60 seconds; conflicts abort cleanly instead of hanging
74+
- Dynamic lock TTL: single-writer lock TTL scales with queue size (`max(1800, bugs * 600)`)
75+
- Lock heartbeat renewal: new `renew` command in `fix-lock.cjs`
76+
- Fixer context budget: `MAX_BUGS_PER_FIXER = 5` — large fix queues split into sequential batches
77+
- Cross-file dependency ordering: when `code-index.cjs` is available, fixes are ordered by import graph
78+
- Flaky test detection: baseline tests run twice; non-deterministic failures excluded from revert decisions
79+
- Dynamic canary sizing: `max(1, min(3, ceil(eligible * 0.2)))` — canary group scales with queue size
80+
- Dry-run mode (`--dry-run`): preview planned fixes without editing files
81+
- Machine-readable fix report: `.bug-hunter/fix-report.json` for CI/CD gating, dashboards, and ticket automation
82+
- Circuit breaker: if >50% of fix attempts fail/revert (min 3 attempts), remaining fixes are halted
83+
- Global Phase 2 timeout: 30-minute deadline for the entire fix execution phase
9584

96-
## 2.1.0 — 2026-03-10
85+
### Changed
86+
- Per-bug revert granularity: clarified one-commit-per-bug as mandatory; reverts target individual bugs, not clusters
87+
- Post-fix re-scan severity floor: fixer-introduced bugs below MEDIUM severity are logged but don't trigger `FIXER_BUG` status
9788

98-
### v3 security pipeline + dependency scanner reliability
89+
## [2.1.0] — 2026-03-10
9990

91+
### Added
10092
- STRIDE/CWE fields in Hunter findings format, with CWE quick-reference mapping for security categories
10193
- Skeptic hard-exclusion fast path (15 false-positive classes) before deep review
10294
- Referee security enrichment: reachability, exploitability, CVSS 3.1, and PoC blocks for critical/high security bugs
10395
- Threat model support: `--threat-model` flag, `prompts/threat-model.md`, Recon/Hunter threat-context wiring
10496
- Dependency scan support: `--deps` flag and `scripts/dep-scan.cjs` output to `.bug-hunter/dep-findings.json`
10597
- JSON report contract: `.bug-hunter/findings.json` plus canonical `.bug-hunter/report.md`
10698
- Few-shot calibration examples for Hunter and Skeptic in `prompts/examples/`
107-
- `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
10899

109-
## 2.0.0 — 2026-03-10
100+
### Fixed
101+
- `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
110102

111-
### Structural overhaul — triage pipeline + 36% token reduction
103+
## [2.0.0] — 2026-03-10
112104

113-
**Pipeline restructure:**
105+
### Changed
114106
- Triage moved to Step 1 (after arg parse) — was running before target resolved
115107
- All mode files consume triage JSON — riskMap, scanOrder, fileBudget flow downstream
116108
- Recon demoted to enrichment — no longer does file classification when triage exists
117-
- Step 7.0 re-audit gate removed — duplicated Referee's work
118-
119-
**Deduplication:**
120-
- `modes/_dispatch.md` — shared dispatch patterns (18 references across modes)
121109
- Mode files compressed: small 7.3→2.9KB, parallel 7.9→4.2KB, extended 7.1→3.3KB, scaled 7.3→2.7KB
122110
- Skip-file patterns consolidated — single authoritative list in SKILL.md
123111
- Error handling table updated with correct step references
124-
125-
**Dead weight removed:**
126-
- FIX-PLAN.md deleted (26KB dead planning doc)
127-
- README.md compressed from 8.5KB to 3.7KB
128-
- code-index.cjs marked optional
129-
130-
**Prompt compression:**
131112
- hunter.md: scope rules and security checklist compressed
132113
- recon.md: output format template and "What to map" sections compressed
133114
- referee.md: tiering rules, re-check section, output format compressed
134115
- skeptic.md: false-positive patterns compressed to inline format
135-
136-
**Logic gaps fixed:**
137116
- Branch-diff/staged optimization note in Step 3
138117
- single-file.md: local-sequential backend support added
139118

140-
**Size:** 187,964 → 119,825 bytes (36% reduction, ~30K tokens)
119+
### Added
120+
- `modes/_dispatch.md` — shared dispatch patterns (18 references across modes)
121+
122+
### Removed
123+
- Step 7.0 re-audit gate removed — duplicated Referee's work
124+
- FIX-PLAN.md deleted (26KB dead planning doc)
125+
- README.md compressed from 8.5KB to 3.7KB
126+
- code-index.cjs marked optional
141127

142-
## 1.0.0 — 2026-03-10
128+
## [1.0.0] — 2026-03-10
143129

144-
### Zero-token pre-recon triage (`triage.cjs`)
145-
- `scripts/triage.cjs` runs before any LLM agent — 0 tokens, <2s for 2,000+ files
130+
### Added
131+
- `scripts/triage.cjs` — zero-token pre-recon triage, runs before any LLM agent (<2s for 2,000+ files)
146132
- FILE_BUDGET, strategy, and domain map decided by triage, not Recon
147133
- Writes `.bug-hunter/triage.json` with strategy, fileBudget, domains, riskMap, scanOrder
148134
- `local-sequential.md` with full phase-by-phase instructions
149135
- Subagent wrapper template in `templates/subagent-wrapper.md`
150136
- Coverage enforcement — partial audits produce explicit warnings
151137
- Large codebase strategy with domain-first tiered scanning
138+
139+
[Unreleased]: https://github.com/codexstar69/bug-hunter/compare/v3.0.0...HEAD
140+
[3.0.0]: https://github.com/codexstar69/bug-hunter/compare/v2.4.1...v3.0.0
141+
[2.4.1]: https://github.com/codexstar69/bug-hunter/compare/v2.4.0...v2.4.1
142+
[2.4.0]: https://github.com/codexstar69/bug-hunter/compare/v2.3.0...v2.4.0
143+
[2.3.0]: https://github.com/codexstar69/bug-hunter/compare/v2.2.1...v2.3.0
144+
[2.2.1]: https://github.com/codexstar69/bug-hunter/compare/v2.2.0...v2.2.1
145+
[2.2.0]: https://github.com/codexstar69/bug-hunter/compare/v2.1.0...v2.2.0
146+
[2.1.0]: https://github.com/codexstar69/bug-hunter/compare/v2.0.0...v2.1.0
147+
[2.0.0]: https://github.com/codexstar69/bug-hunter/compare/v1.0.0...v2.0.0
148+
[1.0.0]: https://github.com/codexstar69/bug-hunter/releases/tag/v1.0.0

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This Code of Conduct applies within all community spaces, and also applies when
3232

3333
## Enforcement
3434

35-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers. All complaints will be reviewed and investigated promptly and fairly.
35+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers at **conduct@codexstar.dev**. All complaints will be reviewed and investigated promptly and fairly.
3636

3737
## Attribution
3838

0 commit comments

Comments
 (0)