Skip to content

Commit 536b84a

Browse files
committed
docs: update PRD to v5.1 with keyring backends and API key validation
Documents fixes for platform-native keyring backends (macOS Keychain, Windows Credential Manager, Linux Secret Service) and corrected API key validation ordering. Updates competitive landscape for 2026 and reflects v0.6.0 structural analysis features.
1 parent 42ccf65 commit 536b84a

4 files changed

Lines changed: 127 additions & 189 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ All notable changes to CommitBee are documented here.
3535
- **Token budget rebalance** — Symbol budget reduced from 30% to 20% when structural diffs are available, freeing space for the raw diff. SYSTEM_PROMPT updated to guide the LLM to prefer STRUCTURED CHANGES for signature details.
3636
- **Unsafe constraint rule** — When `unsafe` is added to a function, a CONSTRAINTS rule instructs the LLM to mention safety justification in the commit body.
3737

38+
### Fixes
39+
40+
- **API key validation ordering**`set-key`, `get-key`, `init`, `config`, `completions`, and `hook` commands no longer require an API key to be present. CLI `--provider` flag now applies before keyring lookup.
41+
- **Platform-native keyring backends** — keyring v3 now uses macOS Keychain (`apple-native`), Windows Credential Manager (`windows-native`), and Linux Secret Service (`linux-native`) instead of a mock file-based backend.
42+
3843
### Testing
3944

4045
- **424 tests** total (up from 367 at v0.5.0).

CLAUDE.md

Lines changed: 19 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ cargo build --release
1717

1818
## Architecture
1919

20-
**Pipeline:** git diff → tree-sitter parse → symbol extraction → context building (budget, evidence, connections) → LLM prompt → sanitize → validate+retry → commit
20+
**Pipeline:** git diff → tree-sitter parse → symbol extraction + structural diffing → context building (budget, evidence, connections, imports, intents) → LLM prompt → sanitize → validate+retry → commit
2121

2222
- **Hybrid Git**: gix for repo discovery, git CLI for diffs (documented choice)
2323
- **Tree-sitter**: Full file parsing with hunk mapping (not just +/- lines)
@@ -39,6 +39,11 @@ cargo build --release
3939
10. **Signature extraction** - Two-strategy: `child_by_field_name("body")` primary, `BODY_NODE_KINDS` fallback, first-line final fallback. 200-char cap with `floor_char_boundary`. No `.scm` query changes needed.
4040
11. **Semantic change classification** - Modified symbols classified via character-stream comparison (not bag-of-lines). `build()` restructured: classify → infer_commit_type → format.
4141
12. **Cross-file connections** - `detect_connections` scans added diff lines for `sym_name(` patterns. Min 4-char name filter, capped at 5, sort+dedup.
42+
13. **Parent scope extraction** - `extract_parent_scope` walks up AST through intermediate nodes (declaration_list, class_body) to find impl/class/trait. 7 languages.
43+
14. **Structural AST diffs** - `AstDiffer` compares old/new tree-sitter nodes for modified symbols. Returns owned `SymbolDiff` (no Node lifetime leaks). Runs inside `extract_for_file()` while both Trees alive.
44+
15. **Change intent detection** - `detect_intents` scans diff lines for error handling, test, logging, dependency patterns. Threshold >2 matches. Conservative type refinement (only overrides for `perf`).
45+
16. **Doc-vs-code classification** - `SpanChangeKind` enum (WhitespaceOnly, DocsOnly, Mixed, Semantic). Doc-only symbols suggest `docs` type. `is_doc_comment()` uses line-prefix heuristic.
46+
17. **Adaptive token budget** - Symbol budget 20% with structural diffs, 30% with signatures only, 20% base.
4247

4348
## Commands
4449

@@ -63,87 +68,6 @@ commitbee hook uninstall # Remove prepare-commit-msg hook
6368
commitbee hook status # Check if hook is installed
6469
```
6570

66-
## Config
67-
68-
Location: platform-dependent (use `commitbee init` to create, `commitbee doctor` to show path)
69-
70-
```toml
71-
provider = "ollama"
72-
model = "qwen3.5:4b"
73-
ollama_host = "http://localhost:11434"
74-
max_diff_lines = 500
75-
max_file_lines = 100
76-
max_context_chars = 24000
77-
temperature = 0.3
78-
num_predict = 256
79-
timeout_secs = 300
80-
think = false
81-
rename_threshold = 70
82-
learn_from_history = false
83-
history_sample_size = 50
84-
# locale = "de"
85-
# exclude_patterns = ["*.lock", "**/*.generated.*"]
86-
# system_prompt_path = "/path/to/system.txt"
87-
# template_path = "/path/to/template.txt"
88-
89-
[format]
90-
include_body = true
91-
include_scope = true
92-
lowercase_subject = true
93-
94-
[safety]
95-
# custom_secret_patterns = ["CUSTOM_KEY_[a-zA-Z0-9]{32}"]
96-
# disabled_secret_patterns = ["Generic Secret (unquoted)"]
97-
```
98-
99-
## Environment Variables
100-
101-
- `COMMITBEE_PROVIDER` - ollama, openai, anthropic
102-
- `COMMITBEE_MODEL` - Model name
103-
- `COMMITBEE_OLLAMA_HOST` - Ollama server URL
104-
- `COMMITBEE_API_KEY` - API key for cloud providers
105-
106-
## Supported Languages (tree-sitter)
107-
108-
Rust, TypeScript, JavaScript, Python, Go, Java, C, C++, Ruby, C#
109-
110-
All 10 languages are individually feature-gated (`lang-rust`, `lang-typescript`, `lang-javascript`, `lang-python`, `lang-go`, `lang-java`, `lang-c`, `lang-cpp`, `lang-ruby`, `lang-csharp`) and enabled by default. Build with `--no-default-features --features lang-rust,lang-go` to include only specific languages.
111-
112-
## File Structure
113-
114-
```bash
115-
src/
116-
├── main.rs # Entry point
117-
├── lib.rs # Library exports
118-
├── app.rs # Application orchestrator
119-
├── cli.rs # CLI arguments (clap)
120-
├── config.rs # Configuration (figment layered)
121-
├── error.rs # Error types (thiserror + miette)
122-
├── queries/ # Tree-sitter .scm patterns (10 languages)
123-
├── domain/
124-
│ ├── mod.rs
125-
│ ├── change.rs # FileChange, StagedChanges, ChangeStatus
126-
│ ├── symbol.rs # CodeSymbol, SymbolKind, SymbolChangeType
127-
│ ├── context.rs # PromptContext (includes connections, evidence flags)
128-
│ └── commit.rs # CommitType
129-
└── services/
130-
├── mod.rs
131-
├── git.rs # GitService (gix + git CLI, concurrent content fetching)
132-
├── analyzer.rs # AnalyzerService (tree-sitter queries, parallel via rayon)
133-
├── context.rs # ContextBuilder (token budget)
134-
├── history.rs # HistoryService (commit style learning)
135-
├── safety.rs # Secret scanning (24 patterns), conflict detection
136-
├── sanitizer.rs # CommitSanitizer (JSON + plain text, BREAKING CHANGE footer)
137-
├── splitter.rs # CommitSplitter (multi-commit detection)
138-
├── template.rs # TemplateService (custom prompt templates)
139-
├── progress.rs # Progress indicators (indicatif spinners, TTY-aware)
140-
└── llm/
141-
├── mod.rs # LlmProvider trait + enum dispatch + shared SYSTEM_PROMPT
142-
├── ollama.rs # OllamaProvider (streaming NDJSON)
143-
├── openai.rs # OpenAiProvider (SSE streaming)
144-
└── anthropic.rs # AnthropicProvider (SSE streaming)
145-
```
146-
14771
## References
14872

14973
- **PRD & Roadmap**: `PRD.md`
@@ -192,7 +116,7 @@ src/
192116
### Running Tests
193117

194118
```bash
195-
cargo test # All tests (359 tests)
119+
cargo test # All tests (424 tests)
196120
cargo test --test sanitizer # CommitSanitizer tests
197121
cargo test --test safety # Safety module tests
198122
cargo test --test context # ContextBuilder tests
@@ -301,6 +225,9 @@ Common mistake: calling a new safeguard/check `fix` — if there was no bug, it'
301225
- Parallel subagents touching the same file will conflict — only parallelize when files don't overlap
302226
- `SymbolKey` uses `(kind, name, file)` — do NOT add `line` (lines shift between HEAD/staged, breaks modified-symbol matching)
303227
- `classify_span_change` uses new-file line range — old-file lines may differ when code shifts; known limitation (deferred #9)
228+
- `extract_symbols()` returns `(Vec<CodeSymbol>, Vec<SymbolDiff>)` — all callers must destructure or use `.0`
229+
- `ChangeDetail` has 25 variants (15 structural + 10 semantic markers) — keep `format_short()` in sync when adding new ones
230+
- `infer_commit_type` takes `all_modified_docs_only: bool` parameter — must be computed in `build()` before calling
304231

305232
### Known Issues
306233

@@ -333,4 +260,12 @@ A tracked list of review findings, design decisions, and improvement ideas that
333260

334261
### Documentation Sync
335262

336-
Keep test counts in sync across README.md, DOCS.md, PRD.md, CLAUDE.md (currently 339).
263+
Test counts and version references must stay in sync across multiple files. After adding/removing tests or bumping version:
264+
265+
- **README.md** — test count in features list + testing section + changelog current version
266+
- **DOCS.md** — test count in description + testing section
267+
- **PRD.md** — test count in §2.3 (feature status table), §8 (testing header), §11 (roadmap table), §12 (success metrics). Also: PRD version header, changelog entry, and compatibility policy table on version bumps.
268+
- **CHANGELOG.md** — test count in current version's testing section
269+
- **CLAUDE.md** — test count in Running Tests section
270+
271+
Use `cargo test --all-targets 2>&1 | grep "^test result" | awk '{sum += $4} END {print sum}'` to get the actual count. Don't guess from memory — counts drift easily.

DOCS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,16 @@ export ANTHROPIC_API_KEY=sk-ant-...
356356

357357
### Secure Key Storage
358358

359-
If built with the `secure-storage` feature, CommitBee can store API keys in your OS keychain:
359+
If built with the `secure-storage` feature, CommitBee can store API keys in your OS keychain using platform-native backends (macOS Keychain, Windows Credential Manager, Linux Secret Service):
360360

361361
```bash
362362
cargo install commitbee --features secure-storage
363-
commitbee set-key openai # Prompts for key, stores in keychain
364-
commitbee set-key anthropic # Same for Anthropic
365-
commitbee get-key openai # Check if key exists
363+
commitbee config set-key openai # Prompts for key, stores in keychain
364+
commitbee config set-key anthropic # Same for Anthropic
365+
commitbee config get-key openai # Check if key exists
366366
```
367367

368-
Key lookup order: config file → environment variable → keychain.
368+
Key lookup order: CLI `--provider` flag → config file → environment variable → keychain. The `set-key` and `get-key` commands do not require an API key to already be configured.
369369

370370
## ✂️ Commit Splitting
371371

0 commit comments

Comments
 (0)