codexa 0.4.0__py3-none-any.whl

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 (189) hide show
  1. codexa-0.4.0.dist-info/METADATA +650 -0
  2. codexa-0.4.0.dist-info/RECORD +189 -0
  3. codexa-0.4.0.dist-info/WHEEL +5 -0
  4. codexa-0.4.0.dist-info/entry_points.txt +2 -0
  5. codexa-0.4.0.dist-info/licenses/LICENSE +21 -0
  6. codexa-0.4.0.dist-info/top_level.txt +1 -0
  7. semantic_code_intelligence/__init__.py +5 -0
  8. semantic_code_intelligence/analysis/__init__.py +21 -0
  9. semantic_code_intelligence/analysis/ai_features.py +351 -0
  10. semantic_code_intelligence/bridge/__init__.py +28 -0
  11. semantic_code_intelligence/bridge/context_provider.py +245 -0
  12. semantic_code_intelligence/bridge/protocol.py +167 -0
  13. semantic_code_intelligence/bridge/server.py +348 -0
  14. semantic_code_intelligence/bridge/vscode.py +271 -0
  15. semantic_code_intelligence/ci/__init__.py +13 -0
  16. semantic_code_intelligence/ci/hooks.py +98 -0
  17. semantic_code_intelligence/ci/hotspots.py +272 -0
  18. semantic_code_intelligence/ci/impact.py +246 -0
  19. semantic_code_intelligence/ci/metrics.py +591 -0
  20. semantic_code_intelligence/ci/pr.py +412 -0
  21. semantic_code_intelligence/ci/quality.py +557 -0
  22. semantic_code_intelligence/ci/templates.py +164 -0
  23. semantic_code_intelligence/ci/trace.py +224 -0
  24. semantic_code_intelligence/cli/__init__.py +0 -0
  25. semantic_code_intelligence/cli/commands/__init__.py +0 -0
  26. semantic_code_intelligence/cli/commands/ask_cmd.py +153 -0
  27. semantic_code_intelligence/cli/commands/benchmark_cmd.py +303 -0
  28. semantic_code_intelligence/cli/commands/chat_cmd.py +252 -0
  29. semantic_code_intelligence/cli/commands/ci_gen_cmd.py +74 -0
  30. semantic_code_intelligence/cli/commands/context_cmd.py +120 -0
  31. semantic_code_intelligence/cli/commands/cross_refactor_cmd.py +113 -0
  32. semantic_code_intelligence/cli/commands/deps_cmd.py +91 -0
  33. semantic_code_intelligence/cli/commands/docs_cmd.py +101 -0
  34. semantic_code_intelligence/cli/commands/doctor_cmd.py +147 -0
  35. semantic_code_intelligence/cli/commands/evolve_cmd.py +171 -0
  36. semantic_code_intelligence/cli/commands/explain_cmd.py +112 -0
  37. semantic_code_intelligence/cli/commands/gate_cmd.py +135 -0
  38. semantic_code_intelligence/cli/commands/grep_cmd.py +234 -0
  39. semantic_code_intelligence/cli/commands/hotspots_cmd.py +119 -0
  40. semantic_code_intelligence/cli/commands/impact_cmd.py +131 -0
  41. semantic_code_intelligence/cli/commands/index_cmd.py +138 -0
  42. semantic_code_intelligence/cli/commands/init_cmd.py +152 -0
  43. semantic_code_intelligence/cli/commands/investigate_cmd.py +163 -0
  44. semantic_code_intelligence/cli/commands/languages_cmd.py +101 -0
  45. semantic_code_intelligence/cli/commands/lsp_cmd.py +49 -0
  46. semantic_code_intelligence/cli/commands/mcp_cmd.py +50 -0
  47. semantic_code_intelligence/cli/commands/metrics_cmd.py +264 -0
  48. semantic_code_intelligence/cli/commands/models_cmd.py +157 -0
  49. semantic_code_intelligence/cli/commands/plugin_cmd.py +275 -0
  50. semantic_code_intelligence/cli/commands/pr_summary_cmd.py +178 -0
  51. semantic_code_intelligence/cli/commands/quality_cmd.py +208 -0
  52. semantic_code_intelligence/cli/commands/refactor_cmd.py +103 -0
  53. semantic_code_intelligence/cli/commands/review_cmd.py +88 -0
  54. semantic_code_intelligence/cli/commands/search_cmd.py +236 -0
  55. semantic_code_intelligence/cli/commands/serve_cmd.py +117 -0
  56. semantic_code_intelligence/cli/commands/suggest_cmd.py +100 -0
  57. semantic_code_intelligence/cli/commands/summary_cmd.py +78 -0
  58. semantic_code_intelligence/cli/commands/tool_cmd.py +282 -0
  59. semantic_code_intelligence/cli/commands/trace_cmd.py +123 -0
  60. semantic_code_intelligence/cli/commands/tui_cmd.py +58 -0
  61. semantic_code_intelligence/cli/commands/viz_cmd.py +127 -0
  62. semantic_code_intelligence/cli/commands/watch_cmd.py +72 -0
  63. semantic_code_intelligence/cli/commands/web_cmd.py +61 -0
  64. semantic_code_intelligence/cli/commands/workspace_cmd.py +250 -0
  65. semantic_code_intelligence/cli/main.py +65 -0
  66. semantic_code_intelligence/cli/router.py +92 -0
  67. semantic_code_intelligence/config/__init__.py +0 -0
  68. semantic_code_intelligence/config/settings.py +260 -0
  69. semantic_code_intelligence/context/__init__.py +19 -0
  70. semantic_code_intelligence/context/engine.py +429 -0
  71. semantic_code_intelligence/context/memory.py +253 -0
  72. semantic_code_intelligence/daemon/__init__.py +1 -0
  73. semantic_code_intelligence/daemon/watcher.py +515 -0
  74. semantic_code_intelligence/docs/__init__.py +1080 -0
  75. semantic_code_intelligence/embeddings/__init__.py +0 -0
  76. semantic_code_intelligence/embeddings/enhanced.py +131 -0
  77. semantic_code_intelligence/embeddings/generator.py +149 -0
  78. semantic_code_intelligence/embeddings/model_registry.py +100 -0
  79. semantic_code_intelligence/evolution/__init__.py +1 -0
  80. semantic_code_intelligence/evolution/budget_guard.py +111 -0
  81. semantic_code_intelligence/evolution/commit_manager.py +88 -0
  82. semantic_code_intelligence/evolution/context_builder.py +131 -0
  83. semantic_code_intelligence/evolution/engine.py +249 -0
  84. semantic_code_intelligence/evolution/patch_generator.py +229 -0
  85. semantic_code_intelligence/evolution/task_selector.py +214 -0
  86. semantic_code_intelligence/evolution/test_runner.py +111 -0
  87. semantic_code_intelligence/indexing/__init__.py +0 -0
  88. semantic_code_intelligence/indexing/chunker.py +174 -0
  89. semantic_code_intelligence/indexing/parallel.py +86 -0
  90. semantic_code_intelligence/indexing/scanner.py +146 -0
  91. semantic_code_intelligence/indexing/semantic_chunker.py +337 -0
  92. semantic_code_intelligence/llm/__init__.py +62 -0
  93. semantic_code_intelligence/llm/cache.py +219 -0
  94. semantic_code_intelligence/llm/cached_provider.py +145 -0
  95. semantic_code_intelligence/llm/conversation.py +190 -0
  96. semantic_code_intelligence/llm/cross_refactor.py +272 -0
  97. semantic_code_intelligence/llm/investigation.py +274 -0
  98. semantic_code_intelligence/llm/mock_provider.py +77 -0
  99. semantic_code_intelligence/llm/ollama_provider.py +122 -0
  100. semantic_code_intelligence/llm/openai_provider.py +100 -0
  101. semantic_code_intelligence/llm/provider.py +92 -0
  102. semantic_code_intelligence/llm/rate_limiter.py +164 -0
  103. semantic_code_intelligence/llm/reasoning.py +438 -0
  104. semantic_code_intelligence/llm/safety.py +110 -0
  105. semantic_code_intelligence/llm/streaming.py +251 -0
  106. semantic_code_intelligence/lsp/__init__.py +609 -0
  107. semantic_code_intelligence/mcp/__init__.py +393 -0
  108. semantic_code_intelligence/parsing/__init__.py +19 -0
  109. semantic_code_intelligence/parsing/parser.py +375 -0
  110. semantic_code_intelligence/plugins/__init__.py +255 -0
  111. semantic_code_intelligence/plugins/examples/__init__.py +1 -0
  112. semantic_code_intelligence/plugins/examples/code_quality.py +73 -0
  113. semantic_code_intelligence/plugins/examples/search_annotator.py +56 -0
  114. semantic_code_intelligence/scalability/__init__.py +205 -0
  115. semantic_code_intelligence/search/__init__.py +0 -0
  116. semantic_code_intelligence/search/formatter.py +123 -0
  117. semantic_code_intelligence/search/grep.py +361 -0
  118. semantic_code_intelligence/search/hybrid_search.py +170 -0
  119. semantic_code_intelligence/search/keyword_search.py +311 -0
  120. semantic_code_intelligence/search/section_expander.py +103 -0
  121. semantic_code_intelligence/services/__init__.py +0 -0
  122. semantic_code_intelligence/services/indexing_service.py +630 -0
  123. semantic_code_intelligence/services/search_service.py +269 -0
  124. semantic_code_intelligence/storage/__init__.py +0 -0
  125. semantic_code_intelligence/storage/chunk_hash_store.py +86 -0
  126. semantic_code_intelligence/storage/hash_store.py +66 -0
  127. semantic_code_intelligence/storage/index_manifest.py +85 -0
  128. semantic_code_intelligence/storage/index_stats.py +138 -0
  129. semantic_code_intelligence/storage/query_history.py +160 -0
  130. semantic_code_intelligence/storage/symbol_registry.py +209 -0
  131. semantic_code_intelligence/storage/vector_store.py +297 -0
  132. semantic_code_intelligence/tests/__init__.py +0 -0
  133. semantic_code_intelligence/tests/test_ai_features.py +351 -0
  134. semantic_code_intelligence/tests/test_chunker.py +119 -0
  135. semantic_code_intelligence/tests/test_cli.py +188 -0
  136. semantic_code_intelligence/tests/test_config.py +154 -0
  137. semantic_code_intelligence/tests/test_context.py +381 -0
  138. semantic_code_intelligence/tests/test_embeddings.py +73 -0
  139. semantic_code_intelligence/tests/test_endtoend.py +1142 -0
  140. semantic_code_intelligence/tests/test_enhanced_embeddings.py +92 -0
  141. semantic_code_intelligence/tests/test_hash_store.py +79 -0
  142. semantic_code_intelligence/tests/test_logging.py +55 -0
  143. semantic_code_intelligence/tests/test_new_cli.py +138 -0
  144. semantic_code_intelligence/tests/test_parser.py +495 -0
  145. semantic_code_intelligence/tests/test_phase10.py +355 -0
  146. semantic_code_intelligence/tests/test_phase11.py +593 -0
  147. semantic_code_intelligence/tests/test_phase12.py +375 -0
  148. semantic_code_intelligence/tests/test_phase13.py +663 -0
  149. semantic_code_intelligence/tests/test_phase14.py +568 -0
  150. semantic_code_intelligence/tests/test_phase15.py +814 -0
  151. semantic_code_intelligence/tests/test_phase16.py +792 -0
  152. semantic_code_intelligence/tests/test_phase17.py +815 -0
  153. semantic_code_intelligence/tests/test_phase18.py +934 -0
  154. semantic_code_intelligence/tests/test_phase19.py +986 -0
  155. semantic_code_intelligence/tests/test_phase20.py +2753 -0
  156. semantic_code_intelligence/tests/test_phase20b.py +2058 -0
  157. semantic_code_intelligence/tests/test_phase20c.py +962 -0
  158. semantic_code_intelligence/tests/test_phase21.py +428 -0
  159. semantic_code_intelligence/tests/test_phase22.py +799 -0
  160. semantic_code_intelligence/tests/test_phase23.py +783 -0
  161. semantic_code_intelligence/tests/test_phase24.py +715 -0
  162. semantic_code_intelligence/tests/test_phase25.py +496 -0
  163. semantic_code_intelligence/tests/test_phase26.py +251 -0
  164. semantic_code_intelligence/tests/test_phase27.py +531 -0
  165. semantic_code_intelligence/tests/test_phase8.py +592 -0
  166. semantic_code_intelligence/tests/test_phase9.py +643 -0
  167. semantic_code_intelligence/tests/test_plugins.py +293 -0
  168. semantic_code_intelligence/tests/test_priority_features.py +727 -0
  169. semantic_code_intelligence/tests/test_router.py +41 -0
  170. semantic_code_intelligence/tests/test_scalability.py +138 -0
  171. semantic_code_intelligence/tests/test_scanner.py +125 -0
  172. semantic_code_intelligence/tests/test_search.py +160 -0
  173. semantic_code_intelligence/tests/test_semantic_chunker.py +255 -0
  174. semantic_code_intelligence/tests/test_tools.py +182 -0
  175. semantic_code_intelligence/tests/test_vector_store.py +151 -0
  176. semantic_code_intelligence/tests/test_watcher.py +211 -0
  177. semantic_code_intelligence/tools/__init__.py +442 -0
  178. semantic_code_intelligence/tools/executor.py +232 -0
  179. semantic_code_intelligence/tools/protocol.py +200 -0
  180. semantic_code_intelligence/tui/__init__.py +454 -0
  181. semantic_code_intelligence/utils/__init__.py +0 -0
  182. semantic_code_intelligence/utils/logging.py +112 -0
  183. semantic_code_intelligence/version.py +3 -0
  184. semantic_code_intelligence/web/__init__.py +11 -0
  185. semantic_code_intelligence/web/api.py +289 -0
  186. semantic_code_intelligence/web/server.py +397 -0
  187. semantic_code_intelligence/web/ui.py +659 -0
  188. semantic_code_intelligence/web/visualize.py +226 -0
  189. semantic_code_intelligence/workspace/__init__.py +427 -0
@@ -0,0 +1,650 @@
1
+ Metadata-Version: 2.4
2
+ Name: codexa
3
+ Version: 0.4.0
4
+ Summary: Developer intelligence CLI — semantic code search, AI-assisted understanding, and agent tooling for codebases
5
+ License: MIT
6
+ Project-URL: Homepage, https://codex-a.dev
7
+ Project-URL: Documentation, https://codex-a.dev
8
+ Project-URL: Repository, https://github.com/M9nx/CodexA
9
+ Project-URL: Issues, https://github.com/M9nx/CodexA/issues
10
+ Project-URL: Changelog, https://github.com/M9nx/CodexA/blob/main/CHANGELOG.md
11
+ Keywords: code-search,semantic-search,developer-tools,code-intelligence,ai-assistant,cli,tree-sitter,faiss,embeddings,mcp
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Text Processing :: Indexing
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: click>=8.1.0
29
+ Requires-Dist: pydantic>=2.0.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: sentence-transformers>=2.2.0
32
+ Requires-Dist: faiss-cpu>=1.7.4
33
+ Requires-Dist: tree-sitter>=0.21.0
34
+ Requires-Dist: radon>=6.0.0
35
+ Requires-Dist: bandit>=1.7.0
36
+ Requires-Dist: mcp>=1.0.0
37
+ Requires-Dist: watchfiles>=1.0.0
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
41
+ Provides-Extra: tui
42
+ Requires-Dist: textual>=0.40.0; extra == "tui"
43
+ Provides-Extra: build
44
+ Requires-Dist: pyinstaller>=6.0.0; extra == "build"
45
+ Dynamic: license-file
46
+
47
+ <p align="center">
48
+ <strong>CodexA — Developer Intelligence Engine</strong><br>
49
+ <em>Semantic code search · AI-assisted understanding · Agent tooling protocol</em>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <a href="https://github.com/M9nx/CodexA/actions"><img src="https://github.com/M9nx/CodexA/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
54
+ <img src="https://img.shields.io/badge/python-3.11%2B-blue" alt="Python 3.11+">
55
+ <img src="https://img.shields.io/badge/version-0.4.0-green" alt="Version">
56
+ <img src="https://img.shields.io/badge/tests-2595-brightgreen" alt="Tests">
57
+ <img src="https://img.shields.io/badge/coverage-79%25-brightgreen" alt="Coverage">
58
+ <img src="https://img.shields.io/badge/mypy-strict-blue" alt="mypy strict">
59
+ <img src="https://img.shields.io/badge/license-MIT-blue" alt="License">
60
+ </p>
61
+
62
+ ---
63
+
64
+ **CodexA** is a lightweight developer intelligence engine designed to cooperate
65
+ with AI coding assistants (GitHub Copilot, Cursor, Cline, etc.) and developer
66
+ tooling. It indexes codebases locally, performs semantic search, and exposes a
67
+ structured tool protocol that any AI agent can call over HTTP or CLI.
68
+
69
+ ## Features
70
+
71
+ | Area | What you get |
72
+ |------|-------------|
73
+ | **Code Indexing** | Scan repos, extract functions/classes, generate vector embeddings (sentence-transformers + FAISS), ONNX runtime option, parallel indexing, `--watch` live re-indexing, `.codexaignore` support |
74
+ | **Multi-Mode Search** | Semantic, keyword (BM25), regex, hybrid (RRF), and raw filesystem grep (ripgrep backend) with full `-A/-B/-C/-w/-v/-c` flags |
75
+ | **Code Context** | Rich context windows — imports, dependencies, AST-based call graphs, surrounding code |
76
+ | **Repository Analysis** | Language breakdown (`codexa languages`), module summaries, component detection |
77
+ | **AI Agent Protocol** | 13 built-in tools exposed via HTTP bridge, MCP server (13 tools), MCP-over-SSE (`--mcp`), or CLI for any AI agent to invoke |
78
+ | **Quality & Metrics** | Complexity analysis, maintainability scoring, quality gates for CI |
79
+ | **Multi-Repo Workspaces** | Link multiple repos under one workspace for cross-repo search & refactoring |
80
+ | **Interactive TUI** | Terminal REPL with mode switching for interactive exploration |
81
+ | **Streaming Responses** | Token-by-token streaming for chat and investigation commands |
82
+ | **Plugin System** | 22 hooks for extending every layer — from indexing to tool invocation |
83
+ | **VS Code Extension** | 4-panel sidebar (Search, Symbols, Quality, Tools), 8 commands, CodeLens, context menus, status bar |
84
+
85
+ ---
86
+
87
+ ## Quick Start
88
+
89
+ ### 1. Install
90
+
91
+ ```bash
92
+ pip install codexa
93
+ ```
94
+
95
+ Or install from source:
96
+
97
+ ```bash
98
+ git clone https://github.com/M9nx/CodexA.git
99
+ cd CodexA
100
+ pip install -e ".[dev]"
101
+ ```
102
+
103
+ **Alternative installation methods:**
104
+
105
+ ```bash
106
+ # Docker
107
+ docker build -t codexa .
108
+ docker run --rm -v /path/to/project:/workspace codexa search "auth"
109
+
110
+ # Homebrew (macOS)
111
+ brew install --formula Formula/codexa.rb
112
+ ```
113
+
114
+ ### 2. Initialize a Project
115
+
116
+ Navigate to any project you want to analyze and run:
117
+
118
+ ```bash
119
+ cd /path/to/your-project
120
+ codexa init
121
+ ```
122
+
123
+ This creates a `.codexa/` directory with configuration, index storage, and session data.
124
+
125
+ ### 3. Index the Codebase
126
+
127
+ ```bash
128
+ codexa index .
129
+ ```
130
+
131
+ This parses all source files (Python, JS/TS, Java, Go, Rust, C#, Ruby, C++),
132
+ extracts symbols, generates embeddings, and stores them in a local FAISS index.
133
+
134
+ ### 4. Semantic Search
135
+
136
+ ```bash
137
+ codexa search "jwt authentication"
138
+ codexa search "database connection pool" --json
139
+ codexa search "error handling" -k 5
140
+ ```
141
+
142
+ ### 5. Explore More
143
+
144
+ ```bash
145
+ codexa explain MyClass # Structural explanation of a symbol
146
+ codexa context parse_config # Rich AI context window
147
+ codexa deps src/auth.py # Import / dependency map
148
+ codexa summary # Full repo summary
149
+ codexa quality src/ # Code quality analysis
150
+ codexa hotspots # High-risk code hotspots
151
+ codexa trace handle_request # Execution trace of a symbol
152
+ codexa evolve # Self-improving development loop
153
+ codexa grep "TODO|FIXME" # Raw filesystem grep (ripgrep or Python)
154
+ codexa benchmark # Performance benchmarking
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Using CodexA with AI Agents (GitHub Copilot, etc.)
160
+
161
+ CodexA is designed to be called by AI coding assistants as an external tool.
162
+ There are **three integration modes**: CLI tool mode, HTTP bridge server, and
163
+ in-process Python API.
164
+
165
+ ### Option A — CLI Tool Mode (Recommended for Copilot Chat)
166
+
167
+ Any AI agent that can run shell commands can use CodexA directly:
168
+
169
+ ```bash
170
+ # List available tools
171
+ codexa tool list --json
172
+
173
+ # Run a tool with arguments
174
+ codexa tool run semantic_search --arg query="authentication middleware" --json
175
+ codexa tool run explain_symbol --arg symbol_name="UserService" --json
176
+ codexa tool run get_call_graph --arg symbol_name="process_payment" --json
177
+ codexa tool run get_dependencies --arg file_path="src/auth.py" --json
178
+
179
+ # Get tool schema (so the agent knows what arguments to pass)
180
+ codexa tool schema semantic_search --json
181
+ ```
182
+
183
+ The `--json` flag ensures machine-readable output. The `--pipe` flag suppresses
184
+ colors and spinners for clean piping.
185
+
186
+ ### Option B — HTTP Bridge Server (For MCP / Long-Running Agents)
187
+
188
+ Start the bridge server to expose all tools over HTTP:
189
+
190
+ ```bash
191
+ codexa serve --port 24842
192
+ ```
193
+
194
+ The server runs on `http://127.0.0.1:24842` and exposes:
195
+
196
+ | Method | Endpoint | Description |
197
+ |--------|----------|-------------|
198
+ | `GET` | `/capabilities` | Full capability manifest — version, tools, supported requests |
199
+ | `GET` | `/health` | Health check → `{"status": "ok"}` |
200
+ | `GET` | `/tools/list` | List all available tools with schemas |
201
+ | `POST` | `/tools/invoke` | Execute a tool by name with arguments |
202
+ | `GET` | `/tools/stream` | SSE stream — tool discovery + heartbeat |
203
+ | `POST` | `/request` | Dispatch any `AgentRequest` (12 request kinds) |
204
+
205
+ **Example — invoke a tool via HTTP:**
206
+
207
+ ```bash
208
+ curl -X POST http://127.0.0.1:24842/tools/invoke \
209
+ -H "Content-Type: application/json" \
210
+ -d '{"tool_name": "semantic_search", "arguments": {"query": "error handling"}}'
211
+ ```
212
+
213
+ **Example — list capabilities:**
214
+
215
+ ```bash
216
+ curl http://127.0.0.1:24842/capabilities
217
+ ```
218
+
219
+ ### Option C — Python API (In-Process)
220
+
221
+ ```python
222
+ from pathlib import Path
223
+ from semantic_code_intelligence.tools.executor import ToolExecutor
224
+ from semantic_code_intelligence.tools.protocol import ToolInvocation
225
+
226
+ executor = ToolExecutor(Path("/path/to/project"))
227
+ invocation = ToolInvocation(tool_name="semantic_search", arguments={"query": "auth"})
228
+ result = executor.execute(invocation)
229
+
230
+ print(result.success) # True
231
+ print(result.result_payload) # dict with search results
232
+ print(result.execution_time_ms) # timing in milliseconds
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Setting Up with VS Code + GitHub Copilot
238
+
239
+ ### Step 1 — Install CodexA globally
240
+
241
+ ```bash
242
+ # Clone the repo
243
+ git clone https://github.com/M9nx/CodexA.git
244
+
245
+ # Install it (makes `codexa` available system-wide in your venv)
246
+ cd CodexA
247
+ pip install -e ".[dev]"
248
+
249
+ # Verify
250
+ codexa --version # → codexa, version 0.4.0
251
+ ```
252
+
253
+ ### Step 2 — Initialize your target project
254
+
255
+ ```bash
256
+ cd /path/to/your-project
257
+ codexa init --index # Creates .codexa/ and indexes immediately
258
+ # Or separately:
259
+ codexa init # Creates .codexa/ directory
260
+ codexa index . # Index the entire codebase
261
+ codexa doctor # Verify everything is healthy
262
+ codexa search "main" # Quick sanity check
263
+ ```
264
+
265
+ ### Step 3 — Add Copilot Custom Instructions (System Prompt)
266
+
267
+ Create the file `.github/copilot-instructions.md` in your project root.
268
+ This file acts as a **system prompt** — GitHub Copilot reads it automatically
269
+ and follows the instructions in every chat and code generation session.
270
+
271
+ ```bash
272
+ mkdir -p .github
273
+ ```
274
+
275
+ Then create `.github/copilot-instructions.md` with this content:
276
+
277
+ ````markdown
278
+ # Copilot Custom Instructions
279
+
280
+ ## CodexA Integration
281
+
282
+ This project uses **CodexA** — a local developer intelligence engine.
283
+ You have access to the `codexa` CLI for semantic code search, symbol
284
+ explanation, dependency analysis, and more.
285
+
286
+ ### Available Commands
287
+
288
+ Before answering questions about this codebase, use CodexA to gather context:
289
+
290
+ - **Search the codebase:**
291
+ ```bash
292
+ codexa search "<natural language query>" --json
293
+ ```
294
+
295
+ - **Explain a symbol (function/class/method):**
296
+ ```bash
297
+ codexa tool run explain_symbol --arg symbol_name="<name>" --json
298
+ ```
299
+
300
+ - **Get the call graph of a function:**
301
+ ```bash
302
+ codexa tool run get_call_graph --arg symbol_name="<name>" --json
303
+ ```
304
+
305
+ - **Get file dependencies/imports:**
306
+ ```bash
307
+ codexa tool run get_dependencies --arg file_path="<path>" --json
308
+ ```
309
+
310
+ - **Find all references to a symbol:**
311
+ ```bash
312
+ codexa tool run find_references --arg symbol_name="<name>" --json
313
+ ```
314
+
315
+ - **Get rich context for a symbol:**
316
+ ```bash
317
+ codexa tool run get_context --arg symbol_name="<name>" --json
318
+ ```
319
+
320
+ - **Summarize the entire repo:**
321
+ ```bash
322
+ codexa tool run summarize_repo --json
323
+ ```
324
+
325
+ - **Explain all symbols in a file:**
326
+ ```bash
327
+ codexa tool run explain_file --arg file_path="<path>" --json
328
+ ```
329
+
330
+ ### Rules
331
+
332
+ 1. Always use `--json` flag for machine-readable output.
333
+ 2. When asked about code structure, search with `codexa search` first.
334
+ 3. When explaining a function or class, use `codexa tool run explain_symbol`.
335
+ 4. When analyzing impact of changes, use `codexa impact`.
336
+ 5. When reviewing code, run `codexa quality <path>` first.
337
+ 6. Prefer CodexA tools over reading large files manually — they provide
338
+ structured, indexed results.
339
+ ````
340
+
341
+ ### Step 4 — Configure Copilot Chat to use CodexA
342
+
343
+ In VS Code, open **Settings** (Ctrl+,) and search for:
344
+
345
+ | Setting | Value | Purpose |
346
+ |---------|-------|---------|
347
+ | `github.copilot.chat.codeGeneration.instructions` | Add `.github/copilot-instructions.md` | Auto-loads custom instructions |
348
+ | `chat.agent.enabled` | `true` | Enables agent mode in Copilot Chat |
349
+
350
+ Or add this to your `.vscode/settings.json`:
351
+
352
+ ```json
353
+ {
354
+ "github.copilot.chat.codeGeneration.instructions": [
355
+ { "file": ".github/copilot-instructions.md" }
356
+ ]
357
+ }
358
+ ```
359
+
360
+ ### Step 5 — Use Copilot Chat with CodexA
361
+
362
+ Open **Copilot Chat** in VS Code (Ctrl+Shift+I or the chat panel) and switch
363
+ to **Agent mode** (the dropdown at the top). Now Copilot can run terminal
364
+ commands and will automatically use CodexA per your instructions.
365
+
366
+ **Example conversations:**
367
+
368
+ > **You:** What does the `process_payment` function do and what calls it?
369
+ >
370
+ > **Copilot** runs:
371
+ > ```
372
+ > codexa tool run explain_symbol --arg symbol_name="process_payment" --json
373
+ > codexa tool run get_call_graph --arg symbol_name="process_payment" --json
374
+ > ```
375
+ > Then gives you a structured answer with callers, callees, and explanation.
376
+
377
+ > **You:** Find all code related to authentication
378
+ >
379
+ > **Copilot** runs: `codexa search "authentication" --json`
380
+ > Returns ranked semantic search results across your entire codebase.
381
+
382
+ > **You:** What would break if I change `UserService`?
383
+ >
384
+ > **Copilot** runs:
385
+ > ```
386
+ > codexa tool run find_references --arg symbol_name="UserService" --json
387
+ > codexa impact
388
+ > ```
389
+ > Shows blast radius and all dependents.
390
+
391
+ > **You:** Review the code quality of src/api/
392
+ >
393
+ > **Copilot** runs: `codexa quality src/api/ --json`
394
+ > Returns complexity scores, dead code, duplicates, and security issues.
395
+
396
+ ### Step 6 — Start the Bridge Server (optional, for MCP)
397
+
398
+ For persistent connections (MCP servers, custom agent frameworks):
399
+
400
+ ```bash
401
+ codexa serve --port 24842
402
+ ```
403
+
404
+ The agent can then call `http://127.0.0.1:24842/tools/invoke` directly.
405
+
406
+ ### Step 7 — Configure LLM provider (optional)
407
+
408
+ For AI-powered commands (`codexa ask`, `codexa review`, `codexa chat`, etc.),
409
+ edit `.codexa/config.json`:
410
+
411
+ ```json
412
+ {
413
+ "llm": {
414
+ "provider": "openai",
415
+ "model": "gpt-4",
416
+ "api_key": "sk-...",
417
+ "temperature": 0.2,
418
+ "max_tokens": 2048
419
+ }
420
+ }
421
+ ```
422
+
423
+ Supported providers: `openai`, `ollama` (local), `mock` (testing).
424
+
425
+ ---
426
+
427
+ ## All CLI Commands
428
+
429
+ CodexA provides **39 commands** (plus subcommands) organized by capability:
430
+
431
+ ### Core
432
+
433
+ | Command | Description |
434
+ |---------|-------------|
435
+ | `codexa init [path]` | Initialize project — creates `.codexa/` directory (supports `--index` and `--vscode`) |
436
+ | `codexa index [path]` | Index codebase for semantic search |
437
+ | `codexa search "<query>"` | Natural-language semantic search |
438
+ | `codexa explain <symbol>` | Structural explanation of a symbol or file |
439
+ | `codexa context <symbol>` | Rich context window for AI consumption |
440
+ | `codexa summary` | Structured repository summary |
441
+ | `codexa deps <file>` | File/project dependency map |
442
+ | `codexa watch` | Background indexing daemon (Rust-backed native file watcher) |
443
+ | `codexa grep "<pattern>"` | Raw filesystem grep — no index required (ripgrep backend) |
444
+ | `codexa benchmark` | Performance benchmarking (indexing, search, memory) |
445
+ | `codexa languages` | List supported tree-sitter languages with grammar status |
446
+
447
+ ### AI-Powered
448
+
449
+ | Command | Description |
450
+ |---------|-------------|
451
+ | `codexa ask "<question>"` | Ask a question about the codebase (LLM) |
452
+ | `codexa review <file>` | AI-powered code review |
453
+ | `codexa refactor <file>` | AI-powered refactoring suggestions |
454
+ | `codexa suggest <symbol>` | Intelligent improvement suggestions |
455
+ | `codexa chat` | Multi-turn conversation with session persistence |
456
+ | `codexa investigate <goal>` | Autonomous multi-step code investigation |
457
+
458
+ ### Quality & Metrics
459
+
460
+ | Command | Description |
461
+ |---------|-------------|
462
+ | `codexa quality [path]` | Code quality analysis |
463
+ | `codexa metrics` | Code metrics, snapshots, and trends |
464
+ | `codexa hotspots` | Identify high-risk code hotspots |
465
+ | `codexa gate` | Enforce quality gates for CI pipelines |
466
+ | `codexa impact` | Blast radius analysis of code changes |
467
+
468
+ ### DevOps & Integration
469
+
470
+ | Command | Description |
471
+ |---------|-------------|
472
+ | `codexa serve` | Start HTTP bridge server for AI agents |
473
+ | `codexa tool list\|run\|schema` | AI Agent Tooling Protocol commands |
474
+ | `codexa pr-summary` | Generate PR intelligence report |
475
+ | `codexa ci-gen` | Generate CI workflow templates |
476
+ | `codexa web` | Start web interface and REST API |
477
+ | `codexa viz` | Generate Mermaid visualizations |
478
+ | `codexa evolve` | Self-improving development loop |
479
+
480
+ ### Workspace & Utilities
481
+
482
+ | Command | Description |
483
+ |---------|-------------|
484
+ | `codexa workspace` | Multi-repo workspace management |
485
+ | `codexa cross-refactor` | Cross-repository refactoring |
486
+ | `codexa trace <symbol>` | Trace execution relationships |
487
+ | `codexa docs` | Generate project documentation |
488
+ | `codexa doctor` | Environment health check |
489
+ | `codexa plugin list\|scaffold\|discover` | Plugin management |
490
+ | `codexa tui` | Interactive terminal REPL |
491
+ | `codexa mcp` | Start MCP (Model Context Protocol) server |
492
+ | `codexa models list\|info\|download\|switch` | Manage embedding models |
493
+
494
+ ### VS Code Extension
495
+
496
+ | Feature | Command / Keybinding |
497
+ |---------|---------------------|
498
+ | Multi-mode search panel (semantic/keyword/hybrid/regex) | Sidebar → Search |
499
+ | Symbol explorer (explain, call graph, deps) | Sidebar → Symbols & Graphs |
500
+ | Code quality dashboard (quality, metrics, hotspots) | Sidebar → Quality |
501
+ | Agent tool runner (doctor, index, models, 13 tools) | Sidebar → Tools |
502
+ | Search codebase | `Ctrl+Shift+F5` |
503
+ | Explain symbol at cursor | `Ctrl+Shift+E` |
504
+ | Code quality analysis | `Ctrl+Shift+Q` |
505
+ | Right-click → Explain / Call Graph | Editor context menu |
506
+
507
+ ---
508
+
509
+ ## Built-in Tools (AI Agent Protocol)
510
+
511
+ These tools can be invoked via CLI (`codexa tool run`), HTTP (`POST /tools/invoke`),
512
+ or Python API (`ToolExecutor.execute()`):
513
+
514
+ | Tool | Arguments | Description |
515
+ |------|-----------|-------------|
516
+ | `semantic_search` | `query` (string) | Search codebase by natural language |
517
+ | `explain_symbol` | `symbol_name` (string) | Structural explanation of a symbol |
518
+ | `explain_file` | `file_path` (string) | Explain all symbols in a file |
519
+ | `summarize_repo` | *(none)* | Full repository summary |
520
+ | `find_references` | `symbol_name` (string) | Find all references to a symbol |
521
+ | `get_dependencies` | `file_path` (string) | Import / dependency map for a file |
522
+ | `get_call_graph` | `symbol_name` (string) | Call graph — callers and callees |
523
+ | `get_context` | `symbol_name` (string) | Rich context window for AI tasks |
524
+ | `get_file_context` | `file_path`, `line` or `symbol_name` | Full-section surrounding code retrieval |
525
+ | `get_quality_score` | `file_path` (string, optional) | Code quality analysis — complexity, dead code, duplicates |
526
+ | `find_duplicates` | `threshold` (float, optional) | Detect near-duplicate code blocks |
527
+ | `grep_files` | `pattern` (string) | Raw filesystem regex search (ripgrep/Python) |
528
+ | `list_languages` | *(none)* | List supported tree-sitter languages and grammar status |
529
+
530
+ Additional tools can be registered via the plugin system using the
531
+ `REGISTER_TOOL` hook.
532
+
533
+ ---
534
+
535
+ ## Architecture
536
+
537
+ ```
538
+ ┌─────────────────────────────────────────────────────┐
539
+ │ CLI Layer (click) │
540
+ │ 39 commands · --json · --pipe · --verbose │
541
+ ├─────────────────────────────────────────────────────┤
542
+ │ AI Agent Tooling Protocol │
543
+ │ ToolExecutor · ToolInvocation · ToolExecutionResult │
544
+ ├─────────────────────────────────────────────────────┤
545
+ │ Bridge Server (HTTP) │
546
+ │ /tools/invoke · /tools/list · /request · SSE stream │
547
+ ├──────────────┬──────────────┬───────────────────────┤
548
+ │ Parsing │ Embedding │ Search │
549
+ │ tree-sitter │ sent-trans │ FAISS │
550
+ ├──────────────┼──────────────┴───────────────────────┤
551
+ │ Evolution │ Self-improving dev loop │
552
+ │ engine │ budget · task · patch · test · commit│
553
+ ├──────────────┴──────────────────────────────────────┤
554
+ │ Plugin System (22 hooks) │
555
+ ├─────────────────────────────────────────────────────┤
556
+ │ Storage (.codexa/ — config, index, cache) │
557
+ └─────────────────────────────────────────────────────┘
558
+ ```
559
+
560
+ ---
561
+
562
+ ## Configuration
563
+
564
+ After `codexa init`, your project has `.codexa/config.json`:
565
+
566
+ ```json
567
+ {
568
+ "embedding": {
569
+ "model_name": "all-MiniLM-L6-v2",
570
+ "chunk_size": 512,
571
+ "chunk_overlap": 64
572
+ },
573
+ "search": {
574
+ "top_k": 10,
575
+ "similarity_threshold": 0.3
576
+ },
577
+ "index": {
578
+ "use_incremental": true,
579
+ "extensions": [".py", ".js", ".ts", ".java", ".go", ".rs", ".rb", ".cpp", ".cs"]
580
+ },
581
+ "llm": {
582
+ "provider": "mock",
583
+ "model": "",
584
+ "api_key": "",
585
+ "temperature": 0.2,
586
+ "max_tokens": 2048
587
+ }
588
+ }
589
+ ```
590
+
591
+ ---
592
+
593
+ ## Documentation
594
+
595
+ CodexA ships with a full VitePress documentation site.
596
+
597
+ ```bash
598
+ # Install docs dependencies
599
+ npm install
600
+
601
+ # Serve locally (live-reload)
602
+ npm run docs:dev
603
+
604
+ # Build static site
605
+ npm run docs:build
606
+
607
+ # Preview the build
608
+ npm run docs:preview
609
+ ```
610
+
611
+ Browse the docs at **http://localhost:5173** after running `npm run docs:dev`.
612
+
613
+ ---
614
+
615
+ ## Development
616
+
617
+ ```bash
618
+ # Install dev dependencies
619
+ pip install -e ".[dev]"
620
+
621
+ # Run all 2595 tests
622
+ pytest
623
+
624
+ # Run with coverage (gate: 70% minimum)
625
+ pytest --cov=semantic_code_intelligence
626
+
627
+ # Run mypy strict type checking
628
+ mypy semantic_code_intelligence --exclude "tests/"
629
+
630
+ # Run specific phase tests
631
+ pytest semantic_code_intelligence/tests/test_phase23.py -v
632
+
633
+ # Run with verbose output
634
+ codexa --verbose search "query"
635
+ ```
636
+
637
+ ## Tech Stack
638
+
639
+ - **Python 3.11+** — No heavy frameworks, stdlib-first design
640
+ - **click** — CLI framework
641
+ - **sentence-transformers** — Embedding generation (`all-MiniLM-L6-v2`)
642
+ - **faiss-cpu** — Vector similarity search (O(1) file-level index, batch reconstruction)
643
+ - **tree-sitter** — Multi-language code parsing
644
+ - **watchfiles** — Rust-backed native file watching (inotify/FSEvents/ReadDirectoryChanges)
645
+ - **pydantic** — Configuration & data models
646
+ - **rich** — Terminal UI and formatting
647
+
648
+ ## License
649
+
650
+ MIT — see [LICENSE](LICENSE) for details.