repobrief 0.1.1__tar.gz

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.
Files changed (68) hide show
  1. repobrief-0.1.1/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  2. repobrief-0.1.1/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
  3. repobrief-0.1.1/.github/workflows/ci.yml +61 -0
  4. repobrief-0.1.1/.gitignore +68 -0
  5. repobrief-0.1.1/CHANGELOG.md +24 -0
  6. repobrief-0.1.1/CONTRIBUTING.md +82 -0
  7. repobrief-0.1.1/LICENSE +21 -0
  8. repobrief-0.1.1/Makefile +36 -0
  9. repobrief-0.1.1/PKG-INFO +256 -0
  10. repobrief-0.1.1/README.md +218 -0
  11. repobrief-0.1.1/docs/ARCHITECTURE_HOW_IT_WORKS.md +126 -0
  12. repobrief-0.1.1/docs/PHASE_10_IMPLEMENTATION_NOTES.md +40 -0
  13. repobrief-0.1.1/docs/PHASE_1_IMPLEMENTATION_NOTES.md +103 -0
  14. repobrief-0.1.1/docs/PHASE_2_IMPLEMENTATION_NOTES.md +80 -0
  15. repobrief-0.1.1/docs/PHASE_3_IMPLEMENTATION_NOTES.md +77 -0
  16. repobrief-0.1.1/docs/PHASE_4_IMPLEMENTATION_NOTES.md +77 -0
  17. repobrief-0.1.1/docs/PHASE_5_IMPLEMENTATION_NOTES.md +65 -0
  18. repobrief-0.1.1/docs/PHASE_6_IMPLEMENTATION_NOTES.md +93 -0
  19. repobrief-0.1.1/docs/PHASE_7_IMPLEMENTATION_NOTES.md +105 -0
  20. repobrief-0.1.1/docs/PHASE_8_IMPLEMENTATION_NOTES.md +90 -0
  21. repobrief-0.1.1/docs/PHASE_9_IMPLEMENTATION_NOTES.md +114 -0
  22. repobrief-0.1.1/docs/README.md +50 -0
  23. repobrief-0.1.1/docs/TEST_REPORT.md +123 -0
  24. repobrief-0.1.1/docs/USER_GUIDE.md +209 -0
  25. repobrief-0.1.1/pyproject.toml +72 -0
  26. repobrief-0.1.1/src/repobrief/__init__.py +3 -0
  27. repobrief-0.1.1/src/repobrief/backends/__init__.py +0 -0
  28. repobrief-0.1.1/src/repobrief/backends/base.py +70 -0
  29. repobrief-0.1.1/src/repobrief/backends/cloud.py +227 -0
  30. repobrief-0.1.1/src/repobrief/backends/ollama.py +209 -0
  31. repobrief-0.1.1/src/repobrief/backends/prompts.py +45 -0
  32. repobrief-0.1.1/src/repobrief/cli.py +515 -0
  33. repobrief-0.1.1/src/repobrief/config/__init__.py +0 -0
  34. repobrief-0.1.1/src/repobrief/config/settings.py +121 -0
  35. repobrief-0.1.1/src/repobrief/errors.py +66 -0
  36. repobrief-0.1.1/src/repobrief/packer/__init__.py +0 -0
  37. repobrief-0.1.1/src/repobrief/packer/formatter.py +298 -0
  38. repobrief-0.1.1/src/repobrief/packer/tree.py +87 -0
  39. repobrief-0.1.1/src/repobrief/scanner/__init__.py +0 -0
  40. repobrief-0.1.1/src/repobrief/scanner/git_utils.py +64 -0
  41. repobrief-0.1.1/src/repobrief/scanner/ignore.py +146 -0
  42. repobrief-0.1.1/src/repobrief/scanner/models.py +31 -0
  43. repobrief-0.1.1/src/repobrief/scanner/walker.py +157 -0
  44. repobrief-0.1.1/src/repobrief/scoring/__init__.py +0 -0
  45. repobrief-0.1.1/src/repobrief/scoring/scorer.py +331 -0
  46. repobrief-0.1.1/src/repobrief/scoring/selector.py +79 -0
  47. repobrief-0.1.1/src/repobrief/scoring/tokenizer.py +64 -0
  48. repobrief-0.1.1/src/repobrief/security/__init__.py +0 -0
  49. repobrief-0.1.1/src/repobrief/security/secret_scanner.py +266 -0
  50. repobrief-0.1.1/src/repobrief/utils/__init__.py +0 -0
  51. repobrief-0.1.1/src/repobrief/utils/clipboard.py +26 -0
  52. repobrief-0.1.1/src/repobrief/utils/console.py +151 -0
  53. repobrief-0.1.1/src/repobrief/utils/github.py +83 -0
  54. repobrief-0.1.1/tests/__init__.py +0 -0
  55. repobrief-0.1.1/tests/conftest.py +54 -0
  56. repobrief-0.1.1/tests/test_backends/__init__.py +0 -0
  57. repobrief-0.1.1/tests/test_backends/test_cloud.py +79 -0
  58. repobrief-0.1.1/tests/test_backends/test_ollama.py +132 -0
  59. repobrief-0.1.1/tests/test_cli.py +88 -0
  60. repobrief-0.1.1/tests/test_errors.py +125 -0
  61. repobrief-0.1.1/tests/test_packer/__init__.py +0 -0
  62. repobrief-0.1.1/tests/test_packer/test_packer.py +165 -0
  63. repobrief-0.1.1/tests/test_scanner/__init__.py +0 -0
  64. repobrief-0.1.1/tests/test_scanner/test_walker.py +92 -0
  65. repobrief-0.1.1/tests/test_scoring/__init__.py +0 -0
  66. repobrief-0.1.1/tests/test_scoring/test_scoring.py +158 -0
  67. repobrief-0.1.1/tests/test_security/__init__.py +0 -0
  68. repobrief-0.1.1/tests/test_security/test_secret_scanner.py +117 -0
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug in RepoBrief
4
+ title: "[BUG] "
5
+ labels: bug
6
+ ---
7
+
8
+ **What happened?**
9
+ A clear description of the bug.
10
+
11
+ **What did you expect?**
12
+ What should have happened instead.
13
+
14
+ **Steps to reproduce:**
15
+ 1. Run `repobrief pack ...`
16
+ 2. ...
17
+
18
+ **Environment:**
19
+ - OS: [e.g., Windows 11, macOS 14, Ubuntu 24.04]
20
+ - Python version: [e.g., 3.11.5]
21
+ - RepoBrief version: [e.g., 0.1.0]
22
+ - Backend: [cloud/ollama/none]
23
+
24
+ **Error output:**
25
+ ```
26
+ Paste any error messages here
27
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature for RepoBrief
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ ---
7
+
8
+ **What problem does this solve?**
9
+ A clear description of the problem.
10
+
11
+ **What solution do you propose?**
12
+ How should it work?
13
+
14
+ **Alternatives considered:**
15
+ Any other approaches you've thought about.
@@ -0,0 +1,61 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ['v*']
7
+ pull_request:
8
+ branches: [main]
9
+
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest, macos-latest]
17
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ uses: actions/setup-python@v5
24
+ with:
25
+ python-version: ${{ matrix.python-version }}
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install -e ".[dev]"
31
+
32
+ - name: Lint
33
+ run: ruff check src/ tests/
34
+
35
+ - name: Test
36
+ run: pytest -v --tb=short
37
+
38
+ publish:
39
+ needs: test
40
+ runs-on: ubuntu-latest
41
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
42
+
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Set up Python
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+
51
+ - name: Install build tools
52
+ run: pip install build twine
53
+
54
+ - name: Build
55
+ run: python -m build
56
+
57
+ - name: Publish to PyPI
58
+ env:
59
+ TWINE_USERNAME: __token__
60
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
61
+ run: twine upload dist/*
@@ -0,0 +1,68 @@
1
+ #planning/
2
+ planning/*
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ *.egg
12
+
13
+ # Virtual environment
14
+ .venv/
15
+ venv/
16
+ env/
17
+
18
+ # IDE
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+
24
+ # OS
25
+ .DS_Store
26
+ Thumbs.db
27
+
28
+ # Testing
29
+ .coverage
30
+ htmlcov/
31
+ .pytest_cache/
32
+
33
+ # MyPy
34
+ .mypy_cache/
35
+
36
+ # Ruff
37
+ .ruff_cache/
38
+ planning
39
+
40
+ # Virtual environments
41
+ fresh-test-env/
42
+ venv/
43
+ .venv/
44
+ env/
45
+
46
+ # Build artifacts
47
+ dist/
48
+ build/
49
+ *.egg-info/
50
+ *.egg
51
+
52
+ # Python cache
53
+ __pycache__/
54
+ *.pyc
55
+ *.pyo
56
+
57
+ # Test / coverage
58
+ .pytest_cache/
59
+ .coverage
60
+ htmlcov/
61
+
62
+ # Type checking
63
+ .mypy_cache/
64
+ .ruff_cache/
65
+
66
+ # IDE
67
+ .vscode/
68
+ .idea/
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to RepoBrief will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] — 2026-09-02
9
+
10
+ ### Added
11
+ - **Core scanner**: Recursive directory walker with `.gitignore` support and binary detection
12
+ - **Secret detection**: Regex-based scanning for API keys, tokens, passwords, and credentials with `--redact` mode
13
+ - **Token counting**: Accurate token counting via `tiktoken` with character-based fallback
14
+ - **File scoring**: Multi-factor relevance scoring (git recency, file size, import centrality, keyword match)
15
+ - **Budget selection**: Greedy file selector that fits files within configurable token budget
16
+ - **Output formats**: Markdown, XML, and plain text digest generation
17
+ - **Export mode**: `repobrief pack` command with file, clipboard, and stdout output
18
+ - **Cloud backend**: Anthropic (Claude) and OpenAI (GPT) API integration with real-time streaming
19
+ - **Ollama backend**: Fully offline local LLM chat via Ollama REST API
20
+ - **Chat mode**: One-shot (`-q`) and interactive REPL modes
21
+ - **GitHub URL support**: Direct packing from `https://github.com/user/repo` URLs
22
+ - **Config file**: `.repobrief.yml` for persistent project-level settings
23
+ - **Error handling**: Graceful degradation, helpful error messages, first-run setup guide
24
+ - **Packaging & CI**: Full PyPI packaging configuration, GitHub Actions CI workflow, issue templates
@@ -0,0 +1,82 @@
1
+ # Contributing to RepoBrief
2
+
3
+ Thanks for your interest in contributing! Here's how to get started.
4
+
5
+ ## Development Setup
6
+
7
+ 1. **Fork and clone the repository**
8
+ ```bash
9
+ git clone https://github.com/yourusername/repobrief.git
10
+ cd repobrief
11
+ ```
12
+
13
+ 2. **Create a virtual environment**
14
+ ```bash
15
+ python -m venv .venv
16
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
17
+ ```
18
+
19
+ 3. **Install in development mode**
20
+ ```bash
21
+ pip install -e ".[dev,cloud]"
22
+ ```
23
+
24
+ 4. **Verify your setup**
25
+ ```bash
26
+ pytest # All tests should pass
27
+ ruff check src/ tests/ # No lint errors
28
+ ```
29
+
30
+ ## Making Changes
31
+
32
+ 1. **Create a feature branch**
33
+ ```bash
34
+ git checkout -b feature/your-feature-name
35
+ ```
36
+
37
+ 2. **Write tests first** — every new feature or bugfix should include tests.
38
+
39
+ 3. **Follow existing code style** — run `ruff format` before committing.
40
+
41
+ 4. **Keep commits focused** — one logical change per commit.
42
+
43
+ ## Running Tests
44
+
45
+ ```bash
46
+ # All tests
47
+ pytest
48
+
49
+ # Specific module
50
+ pytest tests/test_scanner/ -v
51
+
52
+ # With coverage
53
+ pytest --cov=repobrief --cov-report=html
54
+ ```
55
+
56
+ ## Code Style
57
+
58
+ - **Formatter**: `ruff format` (line length: 100)
59
+ - **Linter**: `ruff check` with rules: `E`, `F`, `W`, `I`, `N`, `UP`, `B`, `SIM`
60
+ - **Type hints**: Use type hints for all public function signatures
61
+ - **Docstrings**: Google-style docstrings for all public functions and classes
62
+
63
+ ## Pull Request Process
64
+
65
+ 1. Ensure all tests pass (`pytest`)
66
+ 2. Ensure linting passes (`ruff check src/ tests/`)
67
+ 3. Update the `CHANGELOG.md` if appropriate
68
+ 4. Open a PR against `main` with a clear description of the change
69
+
70
+ ## Adding a New LLM Backend
71
+
72
+ RepoBrief is designed to make adding new backends easy:
73
+
74
+ 1. Create a new file in `src/repobrief/backends/` (e.g., `lmstudio.py`)
75
+ 2. Implement the `LLMBackend` abstract class from `base.py`
76
+ 3. Add the backend option to `cli.py`
77
+ 4. Write tests in `tests/test_backends/`
78
+ 5. Update the README
79
+
80
+ The interface requires only two methods:
81
+ - `generate(system_prompt, user_message, history) -> Iterator[str]`
82
+ - `validate() -> Tuple[bool, str]`
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RepoBrief Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,36 @@
1
+ .PHONY: help install dev test test-cov lint format typecheck build clean check
2
+
3
+ help: ## Show this help message
4
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
5
+ awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
6
+
7
+ install: ## Install the package
8
+ pip install -e .
9
+
10
+ dev: ## Install with all development dependencies
11
+ pip install -e ".[dev,cloud]"
12
+
13
+ test: ## Run all tests
14
+ pytest -v
15
+
16
+ test-cov: ## Run tests with coverage report
17
+ pytest --cov=repobrief --cov-report=html --cov-report=term-missing
18
+
19
+ lint: ## Run linter
20
+ ruff check src/ tests/
21
+
22
+ format: ## Format code
23
+ ruff format src/ tests/
24
+
25
+ typecheck: ## Run type checker
26
+ mypy src/
27
+
28
+ build: ## Build the package for PyPI
29
+ python -m build
30
+
31
+ clean: ## Clean build artifacts
32
+ rm -rf dist/ build/ *.egg-info src/*.egg-info
33
+ find . -type d -name __pycache__ -exec rm -rf {} +
34
+ find . -type f -name "*.pyc" -delete
35
+
36
+ check: lint typecheck test ## Run all checks (lint + typecheck + test)
@@ -0,0 +1,256 @@
1
+ Metadata-Version: 2.5
2
+ Name: repobrief
3
+ Version: 0.1.1
4
+ Summary: Pack any repo into clean LLM context, then chat with it — using Claude, GPT, or a fully offline Ollama model.
5
+ Project-URL: Homepage, https://github.com/Saqlain-mushtaq-alamin/RepoBrief
6
+ Project-URL: Repository, https://github.com/Saqlain-mushtaq-alamin/RepoBrief
7
+ Project-URL: Issues, https://github.com/Saqlain-mushtaq-alamin/RepoBrief/issues
8
+ Author-email: RepoBrief Maintainers <maintainers@repobrief.dev>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,cli,codebase,context,llm,ollama
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Requires-Python: >=3.9
22
+ Requires-Dist: click>=8.0
23
+ Requires-Dist: pathspec>=0.11.0
24
+ Requires-Dist: pyperclip>=1.8.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: requests>=2.28.0
27
+ Requires-Dist: rich>=13.0
28
+ Requires-Dist: tiktoken>=0.5.0
29
+ Provides-Extra: cloud
30
+ Requires-Dist: anthropic>=0.25.0; extra == 'cloud'
31
+ Requires-Dist: openai>=1.0; extra == 'cloud'
32
+ Provides-Extra: dev
33
+ Requires-Dist: mypy>=1.0; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
35
+ Requires-Dist: pytest>=7.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ <div align="center">
40
+
41
+ # 🧠 RepoBrief
42
+
43
+ **Pack any repo into clean LLM context, then chat with it.**
44
+
45
+ *Using Claude, GPT, or a fully offline Ollama model. No vector DB. No GPU. One command.*
46
+
47
+ [![PyPI version](https://img.shields.io/pypi/v/repobrief.svg)](https://pypi.org/project/repobrief/)
48
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
49
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
50
+
51
+ [Installation](#installation) • [Quick Start](#quick-start) • [Chat Mode](#chat-mode) • [Configuration](#configuration) • [How It Works](#how-it-works)
52
+
53
+ </div>
54
+
55
+ ---
56
+
57
+ ## Why RepoBrief?
58
+
59
+ You need to explain your codebase to an LLM — for code review, debugging, onboarding, or docs. Today, you either:
60
+ - **Copy-paste files manually** — slow, error-prone, easy to forget files or include secrets
61
+ - **Use a packing tool** (Repomix, Gitingest) — great, but they just dump text. No follow-up.
62
+ - **Use a RAG chatbot** (ollama-chat, etc.) — needs ChromaDB, embeddings, GPU, and 16GB+ RAM
63
+
64
+ **RepoBrief does both — packing AND chatting — without the RAM cost:**
65
+
66
+ | Feature | Repomix | Gitingest | RAG chatbots | **RepoBrief** |
67
+ |---------|---------|-----------|--------------|---------------|
68
+ | Pack repo into LLM context | ✅ | ✅ | ❌ | ✅ |
69
+ | Chat with codebase | ❌ | ❌ | ✅ | ✅ |
70
+ | No vector DB / embeddings | ✅ | ✅ | ❌ | ✅ |
71
+ | Works on 8GB RAM laptop | ✅ | ✅ | ❌ | ✅ |
72
+ | Cloud + local LLM support | ❌ | ❌ | Partial | ✅ |
73
+ | Secret detection & redaction | ✅ | ❌ | ❌ | ✅ |
74
+ | GitHub repository pack/chat | ✅ | ✅ | ❌ | ✅ |
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ```bash
81
+ pip install repobrief
82
+ ```
83
+
84
+ For cloud LLM support (Claude/GPT):
85
+ ```bash
86
+ pip install repobrief[cloud]
87
+ ```
88
+
89
+ That's it. No Docker, no database, no GPU required.
90
+
91
+ ---
92
+
93
+ ## Quick Start
94
+
95
+ ### Pack a repo (export mode)
96
+
97
+ ```bash
98
+ # Pack the current directory into a markdown digest
99
+ repobrief pack .
100
+
101
+ # Save to a file, limit to 50k tokens
102
+ repobrief pack ./my-project --max-tokens 50000 -o context.md
103
+
104
+ # XML format for structured parsing
105
+ repobrief pack . --format xml -o context.xml
106
+
107
+ # Copy directly to clipboard
108
+ repobrief pack . --clipboard
109
+
110
+ # Pack directly from a GitHub URL
111
+ repobrief pack https://github.com/pallets/flask
112
+ ```
113
+
114
+ ### Chat with a repo
115
+
116
+ ```bash
117
+ # Ask a question using Claude
118
+ export ANTHROPIC_API_KEY=sk-ant-...
119
+ repobrief chat . --backend cloud -q "Where is user authentication handled?"
120
+
121
+ # Fully offline using Ollama (no API key needed)
122
+ repobrief chat . --backend ollama --model llama3.2:3b -q "What does the payment module do?"
123
+
124
+ # Interactive mode — ask follow-up questions
125
+ repobrief chat . --backend ollama --model llama3.2:3b
126
+ > Where is the rate limiter implemented?
127
+ > How would I add a new middleware?
128
+ > exit
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Chat Mode
134
+
135
+ RepoBrief's chat mode doesn't use RAG, embeddings, or vector databases. Instead, it:
136
+
137
+ 1. **Packs** your repo into a token-budgeted digest (like export mode)
138
+ 2. **Scores** files by relevance to your question (keyword matching, git recency, import centrality)
139
+ 3. **Sends** the digest + your question to the chosen LLM backend
140
+ 4. **Streams** the answer back to your terminal with real-time markdown rendering
141
+
142
+ This means it works on any machine that can run Python — even an old laptop with 4GB of free RAM.
143
+
144
+ ### Supported Backends
145
+
146
+ | Backend | Setup | Best For |
147
+ |---------|-------|----------|
148
+ | **Anthropic (Claude)** | `export ANTHROPIC_API_KEY=sk-ant-...` | Best quality, fast streaming |
149
+ | **OpenAI (GPT)** | `export OPENAI_API_KEY=sk-...` | Great quality, widely available |
150
+ | **Ollama (local)** | `ollama pull llama3.2:3b` | Free, 100% private, offline |
151
+
152
+ ---
153
+
154
+ ## Configuration
155
+
156
+ ### CLI Flags
157
+
158
+ | Flag | Description | Default |
159
+ |------|-------------|---------|
160
+ | `--max-tokens` | Token budget for file selection | `100000` |
161
+ | `--format` | Output format: `markdown`, `xml`, `plain` | `markdown` |
162
+ | `-o, --output` | Write digest to file | stdout |
163
+ | `--clipboard` | Copy digest to clipboard | off |
164
+ | `--exclude` | Extra glob patterns to exclude (repeatable) | none |
165
+ | `--redact / --no-redact` | Redact secrets vs exclude files | exclude |
166
+ | `--backend` | LLM backend: `cloud` or `ollama` | `cloud` |
167
+ | `--model` | Model identifier | `claude-sonnet-4-20250514` |
168
+ | `-q, --question` | Question for one-shot chat mode | interactive |
169
+ | `-v, --verbose` | Show detailed debug output | off |
170
+ | `--quiet` | Suppress all output except errors | off |
171
+
172
+ ### Config File
173
+
174
+ Create `.repobrief.yml` in your project root for persistent settings:
175
+
176
+ ```yaml
177
+ backend: ollama
178
+ model: llama3.2:3b
179
+ max_tokens: 40000
180
+ format: markdown
181
+ exclude:
182
+ - "*.test.js"
183
+ - "docs/"
184
+ ```
185
+
186
+ ### Environment Variables
187
+
188
+ | Variable | Purpose |
189
+ |----------|---------|
190
+ | `ANTHROPIC_API_KEY` | Anthropic API key |
191
+ | `OPENAI_API_KEY` | OpenAI API key |
192
+ | `REPOBRIEF_API_KEY` | Generic API key (auto-detects provider) |
193
+ | `OLLAMA_HOST` | Ollama server URL (default: `http://localhost:11434`) |
194
+
195
+ ---
196
+
197
+ ## How It Works
198
+
199
+ ```
200
+ repobrief pack/chat <path>
201
+
202
+
203
+ ┌─── SCAN ──────── Walk repo, respect .gitignore, skip binaries
204
+
205
+ ├─── SECRET SCAN ── Regex detection of API keys, tokens, passwords
206
+
207
+ ├─── SCORE ──────── Rank files by recency, size, centrality, keyword match
208
+
209
+ ├─── SELECT ─────── Greedily pick best files within token budget
210
+
211
+ ├─── PACK ───────── Build directory tree + concatenated file content
212
+
213
+ └─── OUTPUT
214
+ ├── Export: save to file / clipboard / stdout
215
+ └── Chat: send digest + question to Cloud API or local Ollama
216
+ ```
217
+
218
+ ### Secret Detection
219
+
220
+ RepoBrief automatically detects and excludes files containing:
221
+ - AWS access keys, GitHub PATs, OpenAI/Anthropic API keys
222
+ - Private keys (RSA, EC, DSA, OPENSSH)
223
+ - `.env` files with credentials
224
+ - Hardcoded passwords and generic secret assignments
225
+ - Slack tokens, Stripe keys
226
+
227
+ Use `--redact` to include files with secrets replaced by `[REDACTED]` instead of excluding them entirely.
228
+
229
+ ---
230
+
231
+ ## Development
232
+
233
+ ```bash
234
+ # Clone and setup
235
+ git clone https://github.com/yourusername/repobrief.git
236
+ cd repobrief
237
+ python -m venv .venv
238
+ source .venv/bin/activate # or .venv\Scripts\activate on Windows
239
+ pip install -e ".[dev,cloud]"
240
+
241
+ # Run tests
242
+ pytest
243
+
244
+ # Lint and format
245
+ ruff check src/ tests/
246
+ ruff format src/ tests/
247
+
248
+ # Type check
249
+ mypy src/
250
+ ```
251
+
252
+ ---
253
+
254
+ ## License
255
+
256
+ MIT — see [LICENSE](./LICENSE) for details.