Skip to content

Commit ad84899

Browse files
committed
docs: add project README and update development documentation
Add comprehensive README.md with installation, usage, architecture, and contributing sections. Update CLAUDE.md with expanded test commands, CI verification gate, gotchas, and dev dependency list. Clean up PRD.md formatting. Add REUSE.toml annotation for test snapshot files.
1 parent 3404a3d commit ad84899

4 files changed

Lines changed: 303 additions & 37 deletions

File tree

CLAUDE.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Rust, TypeScript, JavaScript, Python, Go
7070

7171
## File Structure
7272

73-
```
73+
```bash
7474
src/
7575
├── main.rs # Entry point
7676
├── lib.rs # Library exports
@@ -107,32 +107,45 @@ src/
107107

108108
- Rust edition 2024, MSRV 1.85
109109
- License: GPL-3.0-only (REUSE compliant)
110-
- Dev deps: `tempfile`, `assert_cmd`, `predicates`, `wiremock`
110+
- Dev deps: `tempfile`, `assert_cmd`, `predicates`, `wiremock`, `insta`, `proptest`
111111

112112
### REUSE / SPDX Headers
113113

114114
- All files use `reuse annotate` format: blank comment separator between SPDX lines
115115
- `reuse lint` — verify compliance
116116
- `reuse annotate --copyright "Sephyi <me@sephy.io>" --license GPL-3.0-only --year 2026 <file>` — add header
117-
- REUSE.toml `[[annotations]]`only for files that can't have inline headers (e.g., Cargo.lock)
117+
- REUSE.toml `[[annotations]]` — for files that can't have inline headers (Cargo.lock, tests/snapshots/**)
118118

119-
### Running Tests (when implemented)
119+
### Running Tests
120120

121121
```bash
122-
cargo test # All tests
123-
cargo test sanitizer # Specific module
122+
cargo test # All tests (55 tests)
123+
cargo test --test sanitizer # Specific integration test file
124+
cargo test --test safety # Safety module tests
125+
cargo test --test context # ContextBuilder tests
126+
cargo test --test commit_type # CommitType tests
124127
cargo test -- --nocapture # Show println output
125128
```
126129

130+
**Important:** `cargo test sanitizer` matches test *names* across all binaries. Use `cargo test --test <name>` to select a specific integration test file.
131+
127132
### Building
128133

129134
```bash
130135
cargo build --release # Optimized binary
131136
cargo check # Fast syntax check
132-
cargo clippy # Lint checks
137+
cargo clippy --all-targets -- -D warnings # Lint (CI requires zero warnings)
133138
cargo fmt # Format code
134139
```
135140

141+
### CI Verification Gate
142+
143+
Before pushing, run the full CI check locally:
144+
145+
```bash
146+
cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test --all-targets
147+
```
148+
136149
### Testing Manually
137150

138151
```bash
@@ -151,3 +164,17 @@ git add some-file.rs
151164
# Auto-commit
152165
./target/release/commitbee --yes
153166
```
167+
168+
### Gotchas
169+
170+
- `gix` API: use `repo.workdir()` not `repo.work_dir()` (deprecated)
171+
- `CommitType::parse()` not `from_str()` — avoids clippy `should_implement_trait` warning
172+
- Enum variants used only via `CommitType::ALL` const need `#[allow(dead_code)]`
173+
- `CommitSanitizer::clean_text` has a known bug with overlapping preamble patterns (indexes modified string with original offsets) — documented, not yet fixed
174+
- Parallel subagents running `cargo fmt` may create unstaged changes — commit formatting separately
175+
- Secret pattern `sk-[a-zA-Z0-9]{48}` requires exactly 48 chars after `sk-` in test data
176+
177+
### Markdown Conventions
178+
179+
- No `---` horizontal rules before `#` or `##` headers (they provide their own visual separation)
180+
- Tables must use properly aligned columns with `| --- |` separator rows

PRD.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ SPDX-License-Identifier: GPL-3.0-only
1313

1414
**Revision 2.1**: Enhancement review integration (2026-02-17) — incorporated evaluation harness, symbol extraction fallback ladder, cancellation contract, streaming trait abstraction, golden test fixtures, output format contracts, hook edge cases, JSON retry logic, and 12 additional refinements from verification review.
1515

16-
---
17-
1816
## 1. Vision
1917

2018
> **"The commit message generator that actually understands your code."**
@@ -35,8 +33,6 @@ CommitBee is a Rust-native CLI tool that uses tree-sitter semantic analysis and
3533
- **v0.2.0** is a stability release: config format preserved, no breaking CLI changes.
3634
- **v0.3.0+** may introduce breaking changes (new config system via figment, CLI subcommand restructuring). Migration documentation will accompany any breaking release.
3735

38-
---
39-
4036
## 2. Competitive Landscape
4137

4238
### 2.1 Market Position
@@ -68,8 +64,6 @@ CommitBee is a Rust-native CLI tool that uses tree-sitter semantic analysis and
6864
| Custom prompt/instruction files | Growing (Copilot, aicommit2) | Missing |
6965
| Unit/integration tests | Non-negotiable for quality. | Zero tests |
7066

71-
---
72-
7367
## 3. Architecture Requirements
7468

7569
### 3.1 Current Architecture Assessment
@@ -203,8 +197,6 @@ pub struct App {
203197

204198
`generate_stream()` is required for all providers in P1 scope (FR-011, FR-012, FR-013). Providers that do not support streaming should implement `generate_stream()` by wrapping `generate()` as a single-element stream.
205199

206-
---
207-
208200
## 4. Feature Requirements
209201

210202
### 4.1 P0 — Critical (v0.2.0: Stability & Correctness)
@@ -490,8 +482,6 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
490482
- **What**: Analyze existing commit history to match the project's commit style.
491483
- **Rationale**: GitHub Copilot does this. Would allow commitbee to adapt to any project's conventions.
492484

493-
---
494-
495485
## 5. Security Requirements
496486

497487
### SR-001: Secret Scanning (Enhanced)
@@ -529,8 +519,6 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
529519
- `cargo deny` for license compliance
530520
- Minimize dependency tree (remove unused crates)
531521

532-
---
533-
534522
## 6. Performance Requirements
535523

536524
### PR-001: Startup Time
@@ -582,8 +570,6 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
582570
- Git commit is only called after the user confirms the complete message. No intermediate state is written to the repository.
583571
- Temp files (if any) are cleaned up via RAII (`Drop` impl or `tempfile` crate auto-cleanup).
584572

585-
---
586-
587573
## 7. UX Requirements
588574

589575
### UX-001: Error Messages
@@ -665,8 +651,6 @@ Exact output behavior for key flags:
665651
- **`--show-prompt`**: Prints the full LLM prompt to stderr (system prompt + user prompt). API keys and secret patterns are **redacted** (replaced with `[REDACTED]`). Does not call the LLM. Exit code 0.
666652
- **Default (interactive)**: Displays the generated message and a confirm/edit/cancel prompt on stderr. On confirm, commits and prints the commit hash to stdout.
667653

668-
---
669-
670654
## 8. Testing Requirements
671655

672656
### TR-001: Unit Tests
@@ -759,8 +743,6 @@ A developer-facing command (`commitbee eval`) that runs the full pipeline agains
759743

760744
`cargo fuzz` targets for the diff parser, sanitizer, and secret scanner. Priority: P2 — implement after the unit test suite (TR-001) and property tests (TR-004) are stable. Fuzz targets should be added to `fuzz/` directory following standard `cargo-fuzz` conventions.
761745

762-
---
763-
764746
## 9. Distribution Requirements
765747

766748
### DR-001: cargo install
@@ -797,8 +779,6 @@ codegen-units = 1
797779
opt-level = "z" # or "s" — benchmark both
798780
```
799781

800-
---
801-
802782
## 10. Prompt Engineering Requirements
803783

804784
### PE-001: System Prompt
@@ -842,8 +822,6 @@ opt-level = "z" # or "s" — benchmark both
842822
- If the retry also fails, fall back to heuristic extraction: infer commit type from the diff header and file categories, extract the first coherent sentence as the commit message description.
843823
- Never retry more than once (avoid infinite loops with models that consistently produce invalid output).
844824

845-
---
846-
847825
## 11. Phased Roadmap
848826

849827
### Phase 1: Stability (v0.2.0)
@@ -908,8 +886,6 @@ opt-level = "z" # or "s" — benchmark both
908886
- FR-057: Additional language support (feature-gated)
909887
- FR-058: Learning from commit history
910888

911-
---
912-
913889
## 12. Success Metrics
914890

915891
| Metric | Target | How to Measure |
@@ -923,8 +899,6 @@ opt-level = "z" # or "s" — benchmark both
923899
| Secret leak rate | 0 (no secrets sent to cloud LLMs) | Integration tests with known secret patterns |
924900
| MSRV | Rust 1.85 (edition 2024) | CI matrix build (stable + 1.85) |
925901

926-
---
927-
928902
## 13. Non-Goals (Explicit Scope Exclusions)
929903

930904
- **GUI/TUI application** — CommitBee is CLI-first. Editor integration happens via MCP server mode, not a built-in UI.
@@ -934,8 +908,6 @@ opt-level = "z" # or "s" — benchmark both
934908
- **Non-git VCS** — Jujutsu/Mercurial support is not a priority. Git covers > 95% of the market.
935909
- **Shell snippet detection** — Commit messages are never executed by git; shell injection via commit message content is not a real attack vector. Standard sanitization (FR-001, FR-007) is sufficient.
936910

937-
---
938-
939911
## Appendix A: Competitive Feature Matrix
940912

941913
| Feature | commitbee | opencommit | aicommits | aicommit2 | rusty-commit | cocogitto |
@@ -955,8 +927,6 @@ opt-level = "z" # or "s" — benchmark both
955927
| **Version bumping** | Future | No | No | No | No | Yes |
956928
| **Monorepo** | Future | No | No | No | No | Yes |
957929

958-
---
959-
960930
## Appendix B: Research Sources
961931

962932
This PRD was informed by:

0 commit comments

Comments
 (0)