srcodex 0.2.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 (52) hide show
  1. srcodex/__init__.py +0 -0
  2. srcodex/backend/__init__.py +0 -0
  3. srcodex/backend/chat.py +79 -0
  4. srcodex/backend/main.py +98 -0
  5. srcodex/backend/services/__init__.py +0 -0
  6. srcodex/backend/services/claude_service.py +754 -0
  7. srcodex/backend/services/config_loader.py +113 -0
  8. srcodex/backend/services/file_access_tools.py +279 -0
  9. srcodex/backend/services/file_tree.py +480 -0
  10. srcodex/backend/services/graph_tools.py +874 -0
  11. srcodex/backend/services/logger_setup.py +91 -0
  12. srcodex/backend/services/session_manager.py +81 -0
  13. srcodex/backend/services/status_tracker.py +91 -0
  14. srcodex/cli.py +255 -0
  15. srcodex/core/__init__.py +0 -0
  16. srcodex/core/config.py +113 -0
  17. srcodex/core/logger.py +23 -0
  18. srcodex/indexer/__init__.py +0 -0
  19. srcodex/indexer/cscope_client.py +183 -0
  20. srcodex/indexer/ctags_compat.py +223 -0
  21. srcodex/indexer/ctags_parser.py +456 -0
  22. srcodex/indexer/explorer.py +135 -0
  23. srcodex/indexer/field_access_analyzer.py +436 -0
  24. srcodex/indexer/indexer.py +664 -0
  25. srcodex/indexer/reference_ingestor.py +293 -0
  26. srcodex/indexer/reference_resolver.py +544 -0
  27. srcodex/tui/__init__.py +0 -0
  28. srcodex/tui/app.py +103 -0
  29. srcodex/tui/app.tcss +24 -0
  30. srcodex/tui/components/__init__.py +0 -0
  31. srcodex/tui/components/bars/__init__.py +0 -0
  32. srcodex/tui/components/bars/chat_header.py +48 -0
  33. srcodex/tui/components/bars/code_tab_bar.py +157 -0
  34. srcodex/tui/components/bars/footer_bar.py +128 -0
  35. srcodex/tui/components/bars/left_tab.py +54 -0
  36. srcodex/tui/components/logger.py +57 -0
  37. srcodex/tui/components/panels/__init__.py +0 -0
  38. srcodex/tui/components/panels/chat_panel.py +523 -0
  39. srcodex/tui/components/panels/code_panel.py +229 -0
  40. srcodex/tui/components/panels/side_panel.py +128 -0
  41. srcodex/tui/components/views/__init__.py +0 -0
  42. srcodex/tui/components/views/explorer_view.py +20 -0
  43. srcodex/tui/components/views/search_view.py +148 -0
  44. srcodex/tui/components/widgets/__init__.py +0 -0
  45. srcodex/tui/components/widgets/file_browser.py +16 -0
  46. srcodex/tui/components/widgets/find_box.py +85 -0
  47. srcodex-0.2.0.dist-info/METADATA +170 -0
  48. srcodex-0.2.0.dist-info/RECORD +52 -0
  49. srcodex-0.2.0.dist-info/WHEEL +5 -0
  50. srcodex-0.2.0.dist-info/entry_points.txt +2 -0
  51. srcodex-0.2.0.dist-info/licenses/LICENSE +21 -0
  52. srcodex-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: srcodex
3
+ Version: 0.2.0
4
+ Summary: Semantic code explorer with AI-powered search and analysis
5
+ Author-email: Jonathan Antoun <jonathan.antoun@amd.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Jonathan03ant/srcodex
8
+ Project-URL: Repository, https://github.com/Jonathan03ant/srcodex
9
+ Project-URL: Issues, https://github.com/Jonathan03ant/srcodex/issues
10
+ Keywords: code-search,semantic-analysis,ai,llm,code-exploration
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: click>=8.1.0
21
+ Requires-Dist: textual[syntax]>=0.47.0
22
+ Requires-Dist: fastapi>=0.100.0
23
+ Requires-Dist: uvicorn>=0.23.0
24
+ Requires-Dist: anthropic>=0.7.0
25
+ Requires-Dist: httpx>=0.24.0
26
+ Requires-Dist: tqdm>=4.66.0
27
+ Dynamic: license-file
28
+
29
+ # srcodex
30
+
31
+ **Semantic code explorer with AI-powered search and analysis**
32
+
33
+ srcodex builds a semantic graph of your codebase and provides AI-powered exploration through natural language queries. Think of it as an intelligent code search that understands relationships, call graphs, and architecture.
34
+
35
+ ## Why srcodex?
36
+
37
+ Unlike generic code assistants (Claude CLI, GitHub Copilot, etc.) that read entire files to answer questions, srcodex uses a **semantic graph database** to understand your code:
38
+
39
+ | Question | Generic Assistant | srcodex |
40
+ |----------|------------------|---------|
41
+ | "Who calls function X?" | Grep entire codebase (20K tokens) | `get_callers('X')` (200 tokens) |
42
+ | "Show call chain A→B" | Read multiple files, manual tracing | Graph query (500 tokens) |
43
+ | "Find all ioctls" | Grep + read matches (15K tokens) | Database search (300 tokens) |
44
+ | "Explain module Y" | Read 10+ files (30K tokens) | Aggregate query (2K tokens) |
45
+
46
+ **Result:** 90% more token-efficient, instant relationship queries, and unique capabilities impossible for file-based tools (call chains, data flow analysis, architecture visualization).
47
+
48
+ ## Features
49
+
50
+ - **Semantic Indexing**: Builds a persistent graph of symbols, functions, types, and their relationships
51
+ - **AI-Powered Search**: Ask questions in natural language about your code
52
+ - **Call Graph Analysis**: Trace function calls, dependencies, and execution paths
53
+ - **Terminal UI**: Beautiful terminal interface with file browser and AI chat
54
+ - **Multi-Language**: Supports C, C++, Python, and more
55
+ - **Fast**: SQLite-backed graph queries with intelligent caching
56
+ - **Portable**: `.srcodex/` directory makes indexed projects shareable
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install srcodex
62
+ ```
63
+
64
+ ## Quick Start
65
+
66
+ ```bash
67
+ # Index your codebase (first time)
68
+ cd /path/to/your/project
69
+ srcodex
70
+
71
+ # Output:
72
+ # No .srcodex/ found. Index this directory? (y/n) y
73
+ # [Indexing happens...]
74
+ # [TUI launches]
75
+
76
+ # Next time - instant launch
77
+ srcodex
78
+ ```
79
+
80
+ ## Usage
81
+
82
+ Once indexed, use the TUI to:
83
+ - Browse files and symbols
84
+ - Search across your codebase
85
+ - Chat with AI about your code architecture
86
+ - Trace call chains and dependencies
87
+
88
+ ### Example AI Queries
89
+
90
+ ```
91
+ "What does the init_system function do?"
92
+ "Show me all functions that call malloc"
93
+ "Trace the execution path from main to shutdown"
94
+ "What structs are defined in config.h?"
95
+ ```
96
+
97
+ ## Configuration
98
+
99
+ Copy `.env.example` to `.env` and configure your API key:
100
+
101
+ ```bash
102
+ # Public Anthropic API
103
+ ANTHROPIC_API_KEY=sk-ant-your-key-here
104
+
105
+ # Or enterprise gateway (if applicable)
106
+ AMD_LLM_API_KEY=your-subscription-key
107
+ ```
108
+
109
+ ## Requirements
110
+
111
+ - Python 3.9+
112
+ - Universal CTags (`brew install universal-ctags` or `apt install universal-ctags`)
113
+ - Cscope (optional, for call graph)
114
+ - Claude API key (Anthropic or enterprise gateway)
115
+
116
+ ## How It Works
117
+
118
+ 1. **Indexing**: Extracts symbols, relationships, and metadata using CTags and Cscope
119
+ 2. **Graph Building**: Creates semantic graph with typed edges (CALLS, INCLUDES, ACCESSES)
120
+ 3. **AI Integration**: Claude queries the graph using specialized tools (not reading full files)
121
+ 4. **Token Efficiency**: **99%+ reduction** in tokens vs. traditional code assistants
122
+ - **Breakthrough caching architecture**: 25-100 tokens per query after initial cache build
123
+ - Aggressive parallel tool batching (20-40 tools per iteration)
124
+ - 3-iteration cache strategy: iterations 1-3 cached, iteration 4 answers with cached data
125
+ - Semantic graph queries instead of file reads (10-100x more efficient)
126
+ - **Real example**: 500 input tokens vs 60,000+ for traditional file-based approaches
127
+ - Cache persists across queries - subsequent questions cost nearly nothing!
128
+
129
+ ## Project Structure
130
+
131
+ After indexing, your project will have:
132
+
133
+ ```
134
+ your-project/
135
+ ├── .srcodex/
136
+ │ ├── metadata.json # Project stats
137
+ │ ├── config.toml # Indexing config
138
+ │ ├── data/
139
+ │ │ └── project.db # Semantic graph
140
+ │ └── logs/ # Debug logs
141
+ └── [your source files...]
142
+ ```
143
+
144
+ ## Development
145
+
146
+ ```bash
147
+ # Clone repository
148
+ git clone https://github.com/Jonathan03ant/srcodex.git
149
+ cd srcodex
150
+
151
+ # Install in development mode
152
+ pip install -e .
153
+
154
+ # Run tests
155
+ pytest
156
+ ```
157
+
158
+ ## License
159
+
160
+ MIT License - see LICENSE file for details
161
+
162
+ ## Contributing
163
+
164
+ Contributions welcome! Please open an issue or pull request.
165
+
166
+ ## Links
167
+
168
+ - [GitHub Repository](https://github.com/Jonathan03ant/srcodex)
169
+ - [Issue Tracker](https://github.com/Jonathan03ant/srcodex/issues)
170
+ - [Documentation](https://github.com/Jonathan03ant/srcodex/wiki)
@@ -0,0 +1,52 @@
1
+ srcodex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ srcodex/cli.py,sha256=YgozQzlpbvLZ89K4eq2DuliKX5Rgn837rK25L_M4BqU,8810
3
+ srcodex/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ srcodex/backend/chat.py,sha256=5A24H6g-0mzdrYYg995UnIDZ2LDFvpKRs19iW_ShXxM,2708
5
+ srcodex/backend/main.py,sha256=n3BiCPZLnJPrxsxITG8WbHgC1wTyGw4EQVUYQrV-p-c,3620
6
+ srcodex/backend/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ srcodex/backend/services/claude_service.py,sha256=id97cqj6WUXWz-lBGc7nPqClchI1ZGA7b7B1OJ1uzBA,35952
8
+ srcodex/backend/services/config_loader.py,sha256=4DqSI7ihlBI3p6GyJKIkrAImN-9juq6SlBdEUWNe8c0,3342
9
+ srcodex/backend/services/file_access_tools.py,sha256=enydn86Z9oHMbndNiYTzCBk3BauP8j8TImtSKF9y6Jg,9523
10
+ srcodex/backend/services/file_tree.py,sha256=MDv_dLesjSDe5jM-Lz3D9bSpTHteBNVSOlAYbeZAvdM,16639
11
+ srcodex/backend/services/graph_tools.py,sha256=PvainlbfePh1qjJzbSNJlb5oWdNzXmCQ8ex7Hl9mSYk,32123
12
+ srcodex/backend/services/logger_setup.py,sha256=I5w_p7YN-qz_K4HVwtA72-RMIz7zcCdKQuLyX2N-wnA,3075
13
+ srcodex/backend/services/session_manager.py,sha256=9cfdiuaXbv6X8lc8Mmj_-th-3VL8vsaM-7o2HCWksTY,2615
14
+ srcodex/backend/services/status_tracker.py,sha256=qMDKKM4_KU9MWe7h_gh2R7kZ6IWgeB2sE_Pg5-IeJrA,2840
15
+ srcodex/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ srcodex/core/config.py,sha256=4DqSI7ihlBI3p6GyJKIkrAImN-9juq6SlBdEUWNe8c0,3342
17
+ srcodex/core/logger.py,sha256=L9o9Iigp7giThv9dPf0rdkPNGWj0Nv66k1j2YYrtY1E,573
18
+ srcodex/indexer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ srcodex/indexer/cscope_client.py,sha256=buD4acWjiYd0tITh16jThqxSp9oMVqe7zSZK6JRPEbc,6025
20
+ srcodex/indexer/ctags_compat.py,sha256=aoZWl8Jf4aVKAms9LNCRJdwDVj2hEiTAWPY7AKbQUwQ,8516
21
+ srcodex/indexer/ctags_parser.py,sha256=CWoRbY--VVdUFfgI8jYhwzBmh8HljslLgjO6SbAp-vQ,17840
22
+ srcodex/indexer/explorer.py,sha256=iYpY6vEY9S4nvIUN32LT1oupa9835e-62ChA047eF3Y,3902
23
+ srcodex/indexer/field_access_analyzer.py,sha256=WQYwOi_A3mEO2tNxgxpk6ipeFNU_KoLu76HDI9SaEWw,15701
24
+ srcodex/indexer/indexer.py,sha256=TNaMdx_kjbbz6IY01w9HK5RA7xnEqcCOBpiP8IovTl4,24929
25
+ srcodex/indexer/reference_ingestor.py,sha256=F_L9CiEtxIaN_YpYnUS7dea1EvPS9ygsIvenLg1Rj9E,11642
26
+ srcodex/indexer/reference_resolver.py,sha256=crXqWcxfmtkCoP0F-wj4h6SgSBtQOt60qsGDST455gA,19859
27
+ srcodex/tui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ srcodex/tui/app.py,sha256=0edfeMFEDJ2eocE65_yUe9PQMfVj1EnyWbvfeMd4uJI,3719
29
+ srcodex/tui/app.tcss,sha256=FztI4lVQFrgrPjGixY5mLyBwFCJBH3__pbapYbP1cuk,346
30
+ srcodex/tui/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ srcodex/tui/components/logger.py,sha256=QP_7eRAEfrB277dIE1XfsxcypM-C2T8VJR2QUE6M5Jw,1648
32
+ srcodex/tui/components/bars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
+ srcodex/tui/components/bars/chat_header.py,sha256=IHF9bttzggbyj-HemzQ5tPRsQ8ACubX8CooiuGTzkog,1182
34
+ srcodex/tui/components/bars/code_tab_bar.py,sha256=LiHLVeKbBaTLdI-ehdgpuSDZKDM8aDCbn2ONsObH0ss,4528
35
+ srcodex/tui/components/bars/footer_bar.py,sha256=yRP2MsZavvnr_m5mHMAAnEtzi9RlHK23bV5u3skLjZs,4326
36
+ srcodex/tui/components/bars/left_tab.py,sha256=wZruoIMpQdlN0Y_cmiGFUcS-whaGf-NcIXbdLlSYO_M,1359
37
+ srcodex/tui/components/panels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ srcodex/tui/components/panels/chat_panel.py,sha256=2wWKXpBU6wip7vQ376T33vsy5NCkwmbWsaTcv_Jd4zk,18613
39
+ srcodex/tui/components/panels/code_panel.py,sha256=0KxOrH8vl5KzJ_R5PW45p1iSBsf6Ef8BTDrFJScFuWw,8424
40
+ srcodex/tui/components/panels/side_panel.py,sha256=49lySjN3w7IXjBhA5A__6olNhuUG5tZSFrkeBlViQjs,4636
41
+ srcodex/tui/components/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
+ srcodex/tui/components/views/explorer_view.py,sha256=SKUARolNsjVTcTjRU21YB5sxrtH4UE_-_FYGoYj2Wic,496
43
+ srcodex/tui/components/views/search_view.py,sha256=0xwOo3M3Uv69jJQnjHw_WowUZfQ5E9_XWdWKqBdvgI4,5023
44
+ srcodex/tui/components/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
+ srcodex/tui/components/widgets/file_browser.py,sha256=siqEu9VEVQ4hG06O5_M7d6O6LW7zP1EXZ6BPkZ_oYr4,363
46
+ srcodex/tui/components/widgets/find_box.py,sha256=S8kxwPxvSqSpRyZiF5b4c7MzCjj7U3MSTjEDMA5KfGQ,2291
47
+ srcodex-0.2.0.dist-info/licenses/LICENSE,sha256=p75i2wt6HFYrFvok9afEIdy2UwUTt7iPxxnON5unYqI,1072
48
+ srcodex-0.2.0.dist-info/METADATA,sha256=lMjf1NW40gqRwUmdp1bmop77xDb_5UjAuyCQ8v9C-xE,5623
49
+ srcodex-0.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
50
+ srcodex-0.2.0.dist-info/entry_points.txt,sha256=5_H5DykVL75PuahLmHjU9YdLQ0l_5nkQr5qqtDSnRCA,45
51
+ srcodex-0.2.0.dist-info/top_level.txt,sha256=TKAhNgUXRNdtqqJeCkEFzq_8ep3FICJjvNxnV_j2xg0,8
52
+ srcodex-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ srcodex = srcodex.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jonathan L'Work
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 @@
1
+ srcodex