contexta-ai 2.0.0__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 (50) hide show
  1. contexta_ai-2.0.0/.github/workflows/build-linux.yml +43 -0
  2. contexta_ai-2.0.0/.github/workflows/publish-pypi.yml +33 -0
  3. contexta_ai-2.0.0/.gitignore +17 -0
  4. contexta_ai-2.0.0/CHANGELOG.md +109 -0
  5. contexta_ai-2.0.0/CONTRIBUTING.md +28 -0
  6. contexta_ai-2.0.0/LICENSE +21 -0
  7. contexta_ai-2.0.0/PKG-INFO +299 -0
  8. contexta_ai-2.0.0/README.md +261 -0
  9. contexta_ai-2.0.0/README.pt-BR.md +261 -0
  10. contexta_ai-2.0.0/SECURITY.md +27 -0
  11. contexta_ai-2.0.0/assets/assets/dark.png +0 -0
  12. contexta_ai-2.0.0/assets/assets/white.png +0 -0
  13. contexta_ai-2.0.0/assets/brand_assets.py +321 -0
  14. contexta_ai-2.0.0/assets/dark.png +0 -0
  15. contexta_ai-2.0.0/assets/icon.ico +0 -0
  16. contexta_ai-2.0.0/assets/white.png +0 -0
  17. contexta_ai-2.0.0/build.bat +139 -0
  18. contexta_ai-2.0.0/build.sh +85 -0
  19. contexta_ai-2.0.0/contexta.py +34 -0
  20. contexta_ai-2.0.0/contexta_app/__init__.py +3 -0
  21. contexta_ai-2.0.0/contexta_app/ai_client.py +182 -0
  22. contexta_ai-2.0.0/contexta_app/cache.py +163 -0
  23. contexta_ai-2.0.0/contexta_app/cli.py +188 -0
  24. contexta_ai-2.0.0/contexta_app/context_engine.py +5113 -0
  25. contexta_ai-2.0.0/contexta_app/embedded_icon_data.py +269 -0
  26. contexta_ai-2.0.0/contexta_app/mcp_server.py +327 -0
  27. contexta_ai-2.0.0/contexta_app/renderer.py +1794 -0
  28. contexta_ai-2.0.0/contexta_app/scanner.py +524 -0
  29. contexta_ai-2.0.0/contexta_app/syntax.py +167 -0
  30. contexta_ai-2.0.0/contexta_app/theme.py +126 -0
  31. contexta_ai-2.0.0/contexta_app/ui.py +1283 -0
  32. contexta_ai-2.0.0/contexta_app/utils.py +33 -0
  33. contexta_ai-2.0.0/contexta_mcp.py +12 -0
  34. contexta_ai-2.0.0/docs/contexta-1.6-dependency-proposal.md +372 -0
  35. contexta_ai-2.0.0/mdcodebrief.py +9 -0
  36. contexta_ai-2.0.0/packaging/linux/install-contexta.sh +12 -0
  37. contexta_ai-2.0.0/packaging/pyinstaller/contexta-onefile.spec +43 -0
  38. contexta_ai-2.0.0/packaging/pyinstaller/contexta-safe.spec +53 -0
  39. contexta_ai-2.0.0/packaging/pyinstaller/contexta.spec +69 -0
  40. contexta_ai-2.0.0/packaging/pyinstaller/mdcodebrief.spec +43 -0
  41. contexta_ai-2.0.0/packaging/version_info.txt +31 -0
  42. contexta_ai-2.0.0/packaging/windows/contexta.iss +36 -0
  43. contexta_ai-2.0.0/pyproject.toml +50 -0
  44. contexta_ai-2.0.0/requirements-build.txt +5 -0
  45. contexta_ai-2.0.0/requirements.txt +12 -0
  46. contexta_ai-2.0.0/tests/__init__.py +1 -0
  47. contexta_ai-2.0.0/tests/test_context_engine.py +1782 -0
  48. contexta_ai-2.0.0/tests/test_renderer.py +410 -0
  49. contexta_ai-2.0.0/tests/test_scanner.py +64 -0
  50. contexta_ai-2.0.0/tests/test_ui.py +115 -0
@@ -0,0 +1,43 @@
1
+ name: Build Linux Executable
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ tags:
7
+ - "v*"
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build-linux:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.11"
24
+
25
+ - name: Install Linux GUI dependency
26
+ run: |
27
+ sudo apt-get update
28
+ sudo apt-get install -y python3-tk
29
+
30
+ - name: Install runtime and build dependencies
31
+ run: python -m pip install --upgrade pip -r requirements-build.txt
32
+
33
+ - name: Build native Linux executable
34
+ run: |
35
+ chmod +x build.sh
36
+ ./build.sh
37
+
38
+ - name: Upload Linux package
39
+ uses: actions/upload-artifact@v4
40
+ with:
41
+ name: contexta-linux
42
+ path: dist/contexta-linux.tar.gz
43
+ if-no-files-found: error
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+
17
+ steps:
18
+ - name: Checkout repository
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.11"
25
+
26
+ - name: Install build tools
27
+ run: python -m pip install --upgrade pip build
28
+
29
+ - name: Build package
30
+ run: python -m build
31
+
32
+ - name: Publish to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ venv/
7
+ .venv/
8
+ .venv-linux/
9
+ .venvs/
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .DS_Store
13
+ Thumbs.db
14
+ *.swp
15
+ resume - *.md
16
+ tests/.tmp/
17
+ nuitka-crash-report.xml
@@ -0,0 +1,109 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
5
+ Versioning: [Semantic Versioning](https://semver.org/)
6
+
7
+ ---
8
+
9
+ ## [1.6.0] - 2026-04-19
10
+
11
+ ### Added
12
+ - **Token-Lean compression mode** - new `lean` option exports only file metadata and up to 5 signatures per file (~65 tokens/file). Best for quick orientation or tight API budget constraints
13
+ - **Inline blob sanitization** - any line longer than 400 chars that looks like a base64/binary payload (e.g. embedded icons, encoded assets) is automatically collapsed into a one-line placeholder comment in every compression mode, including Full Content. A 15 000-char base64 constant adds zero review value to any export
14
+ - **Multi-language project detection** - engine now correctly identifies Django (from imports alone, without `manage.py`), Kotlin Android, Spring Boot with Gradle, and more; fixes a long-standing bias where many projects were misclassified as PHP CRUD
15
+ - **Kotlin, Swift, C++, C, Scala, Lua, R, Nim, Zig** - added to language weights and tech labels; Kotlin/Java JVM detection unified so Kotlin-only Android projects are recognized correctly
16
+ - **Domain detection from directory names** - `boards/`, `sprints/`, `patients/`, `products/` and similar folder names now boost the domain classification without requiring manifest files
17
+ - **Syntax-aware parsing foundation** - Contexta now ships with `tree-sitter` and a dedicated syntax layer for stronger multi-language symbol extraction
18
+ - **Foundation runtime dependencies** - `pathspec`, `charset-normalizer`, `tiktoken`, and `rapidfuzz` are now part of the runtime analysis stack
19
+ - **Linux install bundle** - Linux builds now ship as `contexta-linux.tar.gz` with an `install.sh` helper for user-local installs
20
+ - **Optional Windows installer support** - `build.bat` now emits `contexta-setup.exe` whenever Inno Setup is available locally
21
+
22
+ ### Changed
23
+ - **Gitignore handling** - scan filtering now uses Git-style pattern matching via `pathspec` instead of relying only on hand-rolled glob rules
24
+ - **File decoding** - file reading now prefers `charset-normalizer` before strict encoding fallbacks, improving support for real-world mixed encodings
25
+ - **Token estimation** - renderer token sizing now uses `tiktoken` instead of character heuristics alone when available
26
+ - **Test relationship scoring** - related-test detection now uses stronger fuzzy matching instead of substring checks alone
27
+ - **Windows build pipeline** - official Windows builds now use Nuitka onefile output
28
+ - **Linux build pipeline** - Unix builds now package both a portable binary and an installable tarball bundle
29
+ - **File role descriptions** - `requirements.txt`, `build.bat`, `build.sh` now show generic descriptions by default; project-specific text only appears when Contexta analyzes itself
30
+ - **XML file roles** - `AndroidManifest.xml`, `beans.xml`, `web.xml`, `docker-compose.yml`, `logback.xml`, and CI/CD workflow files now get accurate role descriptions
31
+
32
+ ### Fixed
33
+ - **Scope vs insights bug** - `compute_project_type_signals` and `detect_domain_label` were accidentally receiving test and doc files in their input, causing wrong project type scores; now correctly filtered to runtime files only
34
+ - **Multi-language symbol extraction** - added better extraction coverage for Java, C#, Go, and Rust, plus tree-sitter-backed paths for supported languages
35
+ - **Scanner robustness** - unreadable files and legacy encodings now fall back more gracefully instead of being discarded too early
36
+
37
+ ---
38
+
39
+ ## [1.3.1] - 2026-04-11
40
+
41
+ ### Changed
42
+ - **Compact, resizable interface** - reduced the default window size, added proper resize behavior, and tightened spacing so the app feels lighter on smaller screens
43
+ - **App branding refresh** - the GUI now uses the bundled `icon.ico` as the real window/app icon instead of the default feather-style fallback
44
+ - **Safer diff flow** - diff mode now behaves more predictably when there are no changed files, instead of surprising the user with a full-project export
45
+
46
+ ### Added
47
+ - **36 unit tests** - expanded coverage for hidden-file filtering, diff behavior, renderer output, and related safety cases
48
+
49
+ ### Fixed
50
+ - **Hidden file filtering** - dotfiles such as `.env` stay excluded by default when hidden files are not enabled
51
+ - **Git diff detection** - changed-file exports now better reflect staged, unstaged, and new-file workflows
52
+ - **Clipboard reliability** - clipboard writes now happen on the Tk main thread to avoid intermittent GUI issues
53
+
54
+ ---
55
+
56
+ ## [1.3.0] - 2025-04-10
57
+
58
+ ### Changed
59
+ - **Modular architecture** - split into `scanner.py`, `renderer.py`, `theme.py`, `ui.py`, `cli.py`; `mdcodebrief.py` is now a clean 20-line entry point
60
+ - **Improved `.gitignore` parser** - now supports negation (`!`), rooted patterns (`/build`), directory-only patterns (`dist/`), and `**` wildcards
61
+ - **Version consistency** - `__version__` unified across all modules
62
+
63
+ ### Added
64
+ - **33 unit tests** - covering scanner, renderer, gitignore parser, token estimation, and tree building (`unittest`, zero extra dependencies)
65
+ - Screenshot added to README with download button
66
+
67
+ ### Fixed
68
+ - Windows SmartScreen false positive - removed `--add-data` from build scripts (`--noupx` retained)
69
+
70
+ ---
71
+
72
+ ## [1.2.0] - 2025-04-10
73
+
74
+ ### Added
75
+ - Dark / Light theme toggle (instant switch, no rebuild)
76
+ - Pill-style toggle switches replacing checkboxes
77
+ - Two-column layout (AI Instruction + Options side by side)
78
+ - Status pill indicator (shows Scanning... / Done / Error)
79
+
80
+ ### Fixed
81
+ - White Entry field on Windows (readonly state color bug)
82
+ - Progress bar style name incompatible with Python 3.14
83
+
84
+ ---
85
+
86
+ ## [1.1.0] - 2025-04-10
87
+
88
+ ### Added
89
+ - Native `.gitignore` support
90
+ - Copy to clipboard - GUI button + `--copy` / `-c` CLI flag
91
+ - Token estimation with model hints in log and footer
92
+ - Git diff mode - `--diff` and `--staged` flags
93
+ - AI instruction injection - GUI text field + `-p / --prompt` CLI flag
94
+ - Build scripts (`build.bat`, `build.sh`)
95
+
96
+ ---
97
+
98
+ ## [1.0.0] - 2025-04-10
99
+
100
+ ### Added
101
+ - GUI with dark theme (tkinter, zero dependencies)
102
+ - CLI mode
103
+ - Recursive project scanner with smart filtering
104
+ - ASCII directory tree
105
+ - Syntax-highlighted code blocks for 50+ extensions
106
+ - Multi-encoding file reader (UTF-8, latin-1, cp1252, UTF-16)
107
+ - Safety limits: 1 000 lines/file, 2 000 files/scan
108
+ - Cross-platform Desktop path detection
109
+ - MIT License
@@ -0,0 +1,28 @@
1
+ # Contributing to Contexta
2
+
3
+ Thank you for considering a contribution!
4
+
5
+ ## Ground rules
6
+
7
+ - Runtime dependencies should stay small and high-leverage
8
+ - Optional packaging tools such as **Nuitka** or **PyInstaller** must stay out of runtime code paths
9
+ - Python **3.10+** syntax is acceptable
10
+ - Every PR must keep the project runnable with `python contexta.py` after `python -m pip install -r requirements.txt`
11
+
12
+ ## How to contribute
13
+
14
+ 1. Fork and clone
15
+ 2. Create a branch: `git checkout -b feature/short-description`
16
+ 3. Commit: `git commit -m "feat: description"`
17
+ 4. Push and open a Pull Request against `main`
18
+
19
+ ## Adding language extensions
20
+
21
+ ```python
22
+ # In contexta_app/scanner.py → CODE_EXTENSIONS dict
23
+ ".xyz": "xyz",
24
+ ```
25
+
26
+ ## Reporting bugs
27
+
28
+ Open an issue with OS, Python version, and full error traceback.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 pablokaua03
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,299 @@
1
+ Metadata-Version: 2.4
2
+ Name: contexta-ai
3
+ Version: 2.0.0
4
+ Summary: AI-native codebase context engine. Scans projects and serves intelligent context packs to Claude Code, Cursor, Windsurf, and any MCP-compatible tool.
5
+ Project-URL: Homepage, https://github.com/pablokaua03/contexta
6
+ Project-URL: Repository, https://github.com/pablokaua03/contexta
7
+ Author-email: Pablo Kaua <help@spacegroupusa.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,claude,codebase,context,cursor,developer-tools,mcp
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: charset-normalizer<4,>=3.4
20
+ Requires-Dist: mcp[cli]<2,>=1.9
21
+ Requires-Dist: pathspec<1.1,>=0.12
22
+ Requires-Dist: rapidfuzz<4,>=3.14
23
+ Requires-Dist: tiktoken<1,>=0.12
24
+ Requires-Dist: tree-sitter-language-pack<2,>=1.6
25
+ Requires-Dist: tree-sitter<0.26,>=0.25
26
+ Provides-Extra: all-ai
27
+ Requires-Dist: anthropic<1,>=0.52; extra == 'all-ai'
28
+ Requires-Dist: google-genai<2,>=1.14; extra == 'all-ai'
29
+ Requires-Dist: openai<2,>=1.82; extra == 'all-ai'
30
+ Provides-Extra: claude
31
+ Requires-Dist: anthropic<1,>=0.52; extra == 'claude'
32
+ Provides-Extra: gemini
33
+ Requires-Dist: google-genai<2,>=1.14; extra == 'gemini'
34
+ Provides-Extra: gui
35
+ Provides-Extra: openai
36
+ Requires-Dist: openai<2,>=1.82; extra == 'openai'
37
+ Description-Content-Type: text/markdown
38
+
39
+ <div align="center">
40
+
41
+ # Contexta
42
+
43
+ **AI-native codebase context engine. Serves intelligent project context to Claude Code, Cursor, Windsurf, and any MCP-compatible tool — or generates curated context packs for manual use.**
44
+
45
+ [![Python](https://img.shields.io/badge/Python-3.11%2B-blue?logo=python&logoColor=white)](https://python.org)
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
47
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)]()
48
+ [![Version](https://img.shields.io/badge/Version-2.0.0-purple)]()
49
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-orange)]()
50
+
51
+ <br>
52
+
53
+ [<img src="https://img.shields.io/badge/pip%20install%20contexta--ai-3776AB?style=for-the-badge&logo=pypi&logoColor=white" height="42">](https://pypi.org/project/contexta-ai/)
54
+ &nbsp;&nbsp;
55
+ [<img src="https://img.shields.io/badge/Download%20for%20Windows-0078D4?style=for-the-badge&logo=windows&logoColor=white" height="42">](https://github.com/pablokaua03/Contexta/releases/latest/download/contexta.exe)
56
+ &nbsp;&nbsp;
57
+ [<img src="https://img.shields.io/badge/Download%20for%20Linux-E95420?style=for-the-badge&logo=linux&logoColor=white" height="42">](https://github.com/pablokaua03/Contexta/releases/latest/download/contexta-linux.tar.gz)
58
+
59
+ > Install via pip, download the portable executable, or run from source.
60
+
61
+ <br>
62
+
63
+ <picture>
64
+ <source media="(prefers-color-scheme: dark)" srcset="assets/dark.png">
65
+ <source media="(prefers-color-scheme: light)" srcset="assets/white.png">
66
+ <img alt="Contexta interface preview" src="assets/dark.png">
67
+ </picture>
68
+
69
+ </div>
70
+
71
+ ---
72
+
73
+ ## What is Contexta
74
+
75
+ Contexta analyzes codebases and serves intelligent, curated context to AI tools. Instead of dumping files blindly, it understands project structure, detects frameworks, ranks files by importance, and delivers exactly what an AI needs.
76
+
77
+ **Three ways to use it:**
78
+
79
+ | Mode | Command | What it does |
80
+ |---|---|---|
81
+ | **MCP Server** | `contexta serve` | Runs as a tool server — Claude Code, Cursor, Windsurf call it automatically |
82
+ | **CLI** | `contexta ./project --pack onboarding` | Generates a context pack Markdown file |
83
+ | **GUI** | `contexta` | Desktop app with visual controls |
84
+
85
+ ---
86
+
87
+ ## MCP Server (recommended)
88
+
89
+ The MCP server is the primary way to use Contexta. AI coding assistants call it as a tool to understand your project — no copy-paste needed.
90
+
91
+ ### Setup
92
+
93
+ Add to your MCP configuration (Claude Code, Cursor, Windsurf, etc.):
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "contexta": {
99
+ "command": "contexta",
100
+ "args": ["serve"]
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ Or if running from source:
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "contexta": {
112
+ "command": "python",
113
+ "args": ["/path/to/contexta_mcp.py"]
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### Available tools
120
+
121
+ | Tool | What it does |
122
+ |---|---|
123
+ | `scan_project` | Quick fingerprint — type, language, frameworks, deps, entry points |
124
+ | `get_architecture` | Module relationships, folder structure, risks, key patterns |
125
+ | `generate_context` | Full AI-optimized context pack with all preset options |
126
+ | `find_files` | Search files by name, extension, or keyword |
127
+ | `read_files` | Read specific file contents |
128
+ | `list_packs` | List available pack presets |
129
+ | `cache_status` | Show cache hit/miss statistics |
130
+ | `refresh_cache` | Force-refresh cached analysis |
131
+
132
+ ### Smart cache
133
+
134
+ Results are cached in memory with automatic invalidation. First call analyzes the project (~700ms), subsequent calls return in ~2ms until files change on disk. The cache monitors file mtimes and manifest files — when you edit code, the next call recomputes automatically.
135
+
136
+ ---
137
+
138
+ ## Install
139
+
140
+ ### Option A: pip (recommended)
141
+
142
+ ```bash
143
+ pip install contexta-ai
144
+ ```
145
+
146
+ Optional AI API integrations:
147
+
148
+ ```bash
149
+ pip install contexta-ai[claude] # Claude API
150
+ pip install contexta-ai[gemini] # Gemini API
151
+ pip install contexta-ai[openai] # OpenAI API
152
+ pip install contexta-ai[all-ai] # All three
153
+ ```
154
+
155
+ ### Option B: Portable executables
156
+
157
+ - **Windows**: download [`contexta.exe`](https://github.com/pablokaua03/Contexta/releases/latest/download/contexta.exe)
158
+ - **Linux**: download [`contexta-linux.tar.gz`](https://github.com/pablokaua03/Contexta/releases/latest/download/contexta-linux.tar.gz)
159
+
160
+ ### Option C: From source
161
+
162
+ ```bash
163
+ git clone https://github.com/pablokaua03/Contexta.git
164
+ cd Contexta
165
+ pip install -r requirements.txt
166
+ python contexta.py
167
+ ```
168
+
169
+ ---
170
+
171
+ ## CLI usage
172
+
173
+ ```bash
174
+ # Generate context packs
175
+ contexta ./project # default pack
176
+ contexta ./project --pack onboarding # understand a new codebase
177
+ contexta ./project --pack raw_files # clean path + content dump
178
+ contexta ./project --pack pr_review --diff --copy # review changes
179
+ contexta ./project --mode debug --focus "auth flow" # debug a specific area
180
+
181
+ # AI API integration — send context + question directly to an AI
182
+ contexta ./project --ask "what are the main security risks?"
183
+ contexta ./project --ask "explain the architecture" --provider claude
184
+
185
+ # Configure AI API keys
186
+ contexta --configure-ai
187
+ ```
188
+
189
+ ### CLI flags
190
+
191
+ | Flag | Description |
192
+ |---|---|
193
+ | `--pack` | Preset: `custom`, `chatgpt`, `onboarding`, `pr_review`, `risk_review`, `debug`, `backend`, `frontend`, `changes_related`, `raw_files` |
194
+ | `--mode` | Context mode: `full`, `debug`, `feature`, `diff`, `onboarding`, `refactor` |
195
+ | `--compression` | `full`, `balanced`, `focused`, `signatures`, `lean` |
196
+ | `--ai` | Target AI profile: `generic`, `chatgpt`, `claude`, `gemini`, `copilot` |
197
+ | `--task` | Task profile: `general`, `ai_handoff`, `bug_report`, `code_review`, `explain_project`, `risk_analysis`, `refactor_request`, `pr_summary`, `write_tests`, `find_dead_code` |
198
+ | `--focus` | Bias scoring around a topic (e.g. `"auth flow"`, `"database"`) |
199
+ | `--diff` / `--staged` | Use git changes as context |
200
+ | `--ask` | Send context pack + prompt to an AI API |
201
+ | `--provider` | AI provider: `claude`, `gemini`, `openai` |
202
+ | `--api-key` | API key (also reads `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `OPENAI_API_KEY`) |
203
+ | `--configure-ai` | Interactive AI API setup |
204
+ | `-c` / `--copy` | Copy output to clipboard |
205
+ | `-o` / `--output` | Custom output path |
206
+
207
+ ---
208
+
209
+ ## Context packs
210
+
211
+ | Pack | Best for |
212
+ |---|---|
213
+ | `onboarding` | Understanding a new codebase fast |
214
+ | `pr_review` | Code review with change context |
215
+ | `risk_review` | Regression hotspots, missing coverage, broad-impact modules |
216
+ | `debug` | Bug hunting with changed/suspicious files prioritized |
217
+ | `backend` / `frontend` | Bias toward one side of the app |
218
+ | `changes_related` | Git changes + nearby relevant files |
219
+ | `raw_files` | Clean dump of important files — path + full content, no analysis |
220
+ | `chatgpt` | General-purpose ChatGPT preset |
221
+ | `custom` | Full manual control |
222
+
223
+ ---
224
+
225
+ ## What Contexta exports
226
+
227
+ Depending on pack, mode, and task, the output can include:
228
+
229
+ - Project summary with detected technologies, entry points, purpose, and central modules
230
+ - Read-this-first path through the repository
231
+ - Main execution flow narrative
232
+ - Core files, supporting files, related tests, and changed-file context
233
+ - Relationship maps and risk notes
234
+ - Score breakdown explaining why each file was selected
235
+ - Curated Markdown payload ready for any AI tool
236
+
237
+ ---
238
+
239
+ ## Main features
240
+
241
+ | Feature | Detail |
242
+ |---|---|
243
+ | **MCP Server** | `contexta serve` — AI tools call it as a tool server with smart caching |
244
+ | **AI API integration** | `--ask` sends context directly to Claude, Gemini, or OpenAI |
245
+ | **Smart cache** | ~2ms cached responses with automatic mtime-based invalidation |
246
+ | **Raw files pack** | Clean path + content dump for simple AI workflows |
247
+ | **GUI + CLI** | Desktop app for visual use, CLI for scripting and automation |
248
+ | **Project fingerprinting** | Detects stack, frameworks, domain, and project type automatically |
249
+ | **Syntax-aware analysis** | tree-sitter + heuristic fallback for symbol extraction |
250
+ | **Multi-language** | Python, JS/TS, Go, Rust, PHP, Java, C#, Kotlin, Swift, C++ and more |
251
+ | **Token guidance** | tiktoken-backed estimates for pack sizing |
252
+ | **Inline blob protection** | Collapses base64/binary literals automatically |
253
+ | **PyPI package** | `pip install contexta-ai` with optional AI extras |
254
+
255
+ ---
256
+
257
+ ## Build from source
258
+
259
+ ```bash
260
+ # Windows (requires Visual Studio C++ Build Tools)
261
+ .\build.bat
262
+
263
+ # Linux / macOS
264
+ chmod +x build.sh && ./build.sh
265
+ ```
266
+
267
+ Build outputs: `dist/contexta.exe` (Windows), `dist/contexta` (Linux/macOS), `dist/contexta-linux.tar.gz` (Linux bundle).
268
+
269
+ ---
270
+
271
+ ## Run tests
272
+
273
+ ```bash
274
+ python -m pytest tests/ -k "not test_relation_score"
275
+ ```
276
+
277
+ ---
278
+
279
+ ## Security and behavior
280
+
281
+ - Read-only: Contexta does not modify the scanned project
282
+ - No runtime telemetry or network requirement (except optional `--ask` AI calls)
283
+ - Scan limits prevent runaway exports
284
+ - Embedded binary/blob payloads are suppressed automatically
285
+ - AI API keys are stored locally in `~/.contexta/ai_config.json` when using `--configure-ai`
286
+
287
+ ---
288
+
289
+ ## Contributing
290
+
291
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
292
+
293
+ ## Changelog
294
+
295
+ See [CHANGELOG.md](CHANGELOG.md)
296
+
297
+ ## License
298
+
299
+ [MIT](LICENSE) © [pablokaua03](https://github.com/pablokaua03)