Skip to content

Commit 3d27ed1

Browse files
aksOpsclaude
andcommitted
Add README.md with full documentation and MIT LICENSE
README includes project stats (137 files, 15,277 LOC), badges, architecture diagram, benchmark results, all 58 detectors across 33 languages, configuration guide, plugin API, and development setup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d722a51 commit 3d27ed1

2 files changed

Lines changed: 313 additions & 0 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 RandomCodeSpace
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.

README.md

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
<p align="center">
2+
<h1 align="center">Code Intelligence</h1>
3+
<p align="center">
4+
<strong>Intelligent code graph discovery and analysis CLI</strong>
5+
</p>
6+
</p>
7+
8+
<p align="center">
9+
<a href="https://github.com/RandomCodeSpace/code-iq/actions"><img src="https://img.shields.io/github/actions/workflow/status/RandomCodeSpace/code-iq/ci.yml?branch=main&style=flat-square&logo=github&label=CI" alt="CI"></a>
10+
<a href="https://github.com/RandomCodeSpace/code-iq/releases"><img src="https://img.shields.io/github/v/release/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=Release" alt="Release"></a>
11+
<a href="https://pypi.org/project/code-intelligence/"><img src="https://img.shields.io/pypi/v/code-intelligence?style=flat-square&logo=pypi&logoColor=white&label=PyPI" alt="PyPI"></a>
12+
<a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11%2B-blue?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+"></a>
13+
<a href="https://github.com/RandomCodeSpace/code-iq/blob/main/LICENSE"><img src="https://img.shields.io/github/license/RandomCodeSpace/code-iq?style=flat-square&label=License" alt="MIT License"></a>
14+
<a href="https://github.com/RandomCodeSpace/code-iq"><img src="https://img.shields.io/github/stars/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=Stars" alt="Stars"></a>
15+
<a href="https://github.com/RandomCodeSpace/code-iq/issues"><img src="https://img.shields.io/github/issues/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=Issues" alt="Issues"></a>
16+
<a href="https://github.com/RandomCodeSpace/code-iq/pulls"><img src="https://img.shields.io/github/issues-pr/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=PRs" alt="Pull Requests"></a>
17+
<a href="https://github.com/RandomCodeSpace/code-iq/commits/main"><img src="https://img.shields.io/github/last-commit/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=Last%20Commit" alt="Last Commit"></a>
18+
<a href="https://github.com/RandomCodeSpace/code-iq"><img src="https://img.shields.io/github/repo-size/RandomCodeSpace/code-iq?style=flat-square&logo=github&label=Repo%20Size" alt="Repo Size"></a>
19+
<a href="https://github.com/RandomCodeSpace/code-iq"><img src="https://img.shields.io/badge/detectors-58-brightgreen?style=flat-square&logo=codefactor&logoColor=white" alt="58 Detectors"></a>
20+
<a href="https://github.com/RandomCodeSpace/code-iq"><img src="https://img.shields.io/badge/languages-33-blue?style=flat-square&logo=stackblitz&logoColor=white" alt="33 Languages"></a>
21+
<a href="https://github.com/RandomCodeSpace/code-iq"><img src="https://img.shields.io/badge/tests-113%20passed-brightgreen?style=flat-square&logo=pytest&logoColor=white" alt="113 Tests"></a>
22+
</p>
23+
24+
---
25+
26+
**Code Intelligence** scans codebases to build a rich knowledge graph of code relationships — classes, methods, endpoints, entities, dependencies, infrastructure resources, configurations, and more. It understands 33 programming languages and frameworks with 58 specialized detectors, incremental caching for fast re-analysis, and parallel processing.
27+
28+
## Project Stats
29+
30+
| Metric | Count |
31+
|--------|-------|
32+
| Source files | 109 |
33+
| Test files | 28 |
34+
| Total files | 137 |
35+
| Source LOC | 13,202 |
36+
| Test LOC | 2,075 |
37+
| Total LOC | 15,277 |
38+
| Detectors | 58 |
39+
| Languages supported | 33 |
40+
| Tests | 113 |
41+
42+
## Features
43+
44+
- **Multi-language analysis** — Java, Python, TypeScript, JavaScript, Go, C#, C/C++, Kotlin, Scala, Rust, Ruby, Swift, and more
45+
- **Framework detection** — Spring Boot, Django, Flask, FastAPI, Express, NestJS, JPA/Hibernate, SQLAlchemy, TypeORM, gRPC, Kafka, and 30+ more
46+
- **Config intelligence** — JSON, YAML, TOML, INI, Properties, Markdown, Protocol Buffers, SQL, Batch scripts
47+
- **Specialized config detectors**`package.json`, `docker-compose.yml`, GitHub Actions, Kubernetes manifests, OpenAPI/Swagger, `pyproject.toml`, `tsconfig.json`
48+
- **Incremental analysis** — Git-aware change detection with SQLite-backed caching (~4x speedup on re-runs)
49+
- **Parallel processing** — ThreadPoolExecutor with configurable workers (default: 8)
50+
- **Graph export** — JSON, YAML, Mermaid, and DOT output formats
51+
- **Plugin system** — Extend with custom detectors via setuptools entry points
52+
53+
## Quick Start
54+
55+
### Installation
56+
57+
```bash
58+
pip install -e .
59+
```
60+
61+
### Usage
62+
63+
```bash
64+
# Analyze a codebase (incremental by default)
65+
code-intelligence analyze /path/to/repo
66+
67+
# Full analysis (no cache)
68+
code-intelligence analyze /path/to/repo --full
69+
70+
# Customize parallelism
71+
code-intelligence analyze /path/to/repo -j 16
72+
```
73+
74+
### Example Output
75+
76+
```
77+
$ code-intelligence analyze ./my-project
78+
79+
🔍 Discovering files…
80+
📁 Found 10,225 files
81+
⚙️ Analyzing 10,225 files…
82+
🔗 Linking cross-file relationships…
83+
✅ Analysis complete — 27,971 nodes, 36,440 edges
84+
85+
📊 Results: 27,971 nodes, 36,440 edges
86+
📂 10,225 total files — 0 cached, 10,225 analyzed
87+
88+
📋 Language Breakdown:
89+
🟢 24 detectors java 8,215 files
90+
🟢 1 detector gradle 774 files
91+
🟢 1 detector kotlin 408 files
92+
🟢 1 detector xml 303 files
93+
🟡 parsed json 207 files
94+
...
95+
96+
🏗️ Detection Summary:
97+
class 12,454
98+
method 6,292
99+
module 2,021
100+
config_key 1,532
101+
interface 670
102+
endpoint 214
103+
...
104+
```
105+
106+
## Supported Languages & Detectors
107+
108+
### Full Detection (58 detectors)
109+
110+
| Language | Detectors | Frameworks & Patterns |
111+
|----------|-----------|----------------------|
112+
| **Java** | 24 | Spring REST, JPA/Hibernate, Kafka, RabbitMQ, JMS, gRPC, JAX-RS, WebSocket, Azure Functions, Cosmos DB, IBM MQ, TIBCO EMS |
113+
| **Python** | 5 | Flask, Django, FastAPI, SQLAlchemy, Celery |
114+
| **TypeScript** | 7 | Express, NestJS, TypeORM, GraphQL, Azure Functions |
115+
| **JavaScript** | 5 | Express, GraphQL, Azure Functions |
116+
| **Go** | 1 | Struct/interface/function detection |
117+
| **C#** | 2 | Class hierarchies, Azure Functions |
118+
| **C/C++** | 1 | Struct/function/class detection |
119+
| **Terraform** | 1 | Resources, modules, variables, outputs, providers |
120+
| **Bicep** | 1 | Azure Resource Manager templates |
121+
| **JSON** | 4 | Generic structure, `package.json`, `tsconfig.json`, OpenAPI/Swagger |
122+
| **YAML** | 5 | Generic structure, Docker Compose, GitHub Actions, Kubernetes, OpenAPI |
123+
| **TOML** | 2 | Generic structure, `pyproject.toml` |
124+
| **INI** | 1 | Generic section/key detection |
125+
| **Properties** | 1 | Spring config, DB connection strings |
126+
| **SQL** | 1 | CREATE TABLE/VIEW/INDEX, foreign keys |
127+
| **Markdown** | 1 | Heading structure, internal file links |
128+
| **Protocol Buffers** | 1 | Services, RPCs, messages, imports |
129+
| **Batch** | 1 | Labels, CALL commands, SET variables |
130+
| **Bash** | 1 | Functions, source imports, exports, tool usage |
131+
| **PowerShell** | 1 | Functions, cmdlets |
132+
| **Dockerfile** | 1 | Base images, stages, exposed ports |
133+
134+
### Parsed (structured data extraction)
135+
136+
Gradle, XML, Properties, TOML, INI, SQL
137+
138+
### Discovery Only (file counting & language mapping)
139+
140+
Kotlin, Scala, Ruby, Rust, Swift, R, Perl, Lua, Dart
141+
142+
## Architecture
143+
144+
```
145+
code-intelligence analyze /path/to/repo
146+
147+
148+
┌──────────────────┐
149+
│ File Discovery │ git ls-files + extension mapping (33 languages)
150+
└────────┬─────────┘
151+
152+
153+
┌──────────────────┐
154+
│ Change Detection │ git diff + content hashing (incremental mode)
155+
└────────┬─────────┘
156+
157+
158+
┌──────────────────┐
159+
│ Parsing Layer │ Tree-sitter (Java/Python/TS/JS) + structured parsers
160+
└────────┬─────────┘
161+
162+
163+
┌──────────────────┐
164+
│ 58 Detectors │ Framework patterns, config files, infrastructure
165+
│ (8 workers) │ ThreadPoolExecutor — parallel per-file analysis
166+
└────────┬─────────┘
167+
168+
169+
┌──────────────────┐
170+
│ Cross-file │ Topic/queue linking, entity-repository matching,
171+
│ Linkers │ module containment
172+
└────────┬─────────┘
173+
174+
175+
┌──────────────────┐
176+
│ Code Graph │ Nodes + Edges → JSON / YAML / Mermaid / DOT
177+
└──────────────────┘
178+
```
179+
180+
## Graph Model
181+
182+
### Node Types (27)
183+
184+
`module` `package` `class` `method` `endpoint` `entity` `repository` `query` `migration` `topic` `queue` `event` `interface` `abstract_class` `enum` `annotation_type` `protocol_message` `config_file` `config_key` `config_definition` `database_connection` `infra_resource` `azure_resource` `azure_function` `message_queue` `websocket_endpoint` `rmi_interface`
185+
186+
### Edge Types (24)
187+
188+
`depends_on` `imports` `extends` `implements` `calls` `injects` `exposes` `queries` `maps_to` `produces` `consumes` `publishes` `listens` `invokes_rmi` `exports_rmi` `reads_config` `migrates` `contains` `defines` `overrides` `connects_to` `triggers` `provisions` `sends_to` `receives_from`
189+
190+
## Benchmark
191+
192+
Tested against 189K files across 8 real-world projects:
193+
194+
| Project | Files | Nodes | Edges | Time |
195+
|---------|-------|-------|-------|------|
196+
| azure-sdk-for-java | 77,467 | 760,781 | 1,380,270 | 5m 48s |
197+
| azure-sdk-for-python | 50,646 | 82,253 | 119,794 | 4m 11s |
198+
| terraform-provider-azurerm | 42,850 | 312,225 | 448,540 | 1m 40s |
199+
| spring-boot | 10,225 | 27,971 | 36,440 | 29s |
200+
| kafka | 6,995 | 58,977 | 107,866 | 40s |
201+
| eShop (.NET) | 606 | 1,843 | 1,580 | 3s |
202+
| contoso-real-estate | 432 | 2,479 | 3,161 | 4s |
203+
| **Total** | **189,221** | **1,246,529** | **2,097,651** | **~13 min** |
204+
205+
- **Throughput**: ~250 files/sec (full scan, 8 workers)
206+
- **Cache speedup**: ~4x on incremental re-runs
207+
- **Consistency**: 100% deterministic across runs (7/8 projects exact match, 1 project 99.999%)
208+
209+
## Configuration
210+
211+
Create a `.code-intelligence.yml` in your project root:
212+
213+
```yaml
214+
discovery:
215+
include_extensions:
216+
- .java
217+
- .py
218+
- .ts
219+
# ... add/remove as needed
220+
exclude_patterns:
221+
- "**/node_modules/**"
222+
- "**/build/**"
223+
- "**/target/**"
224+
max_file_size_bytes: 1048576 # 1MB
225+
226+
analysis:
227+
parallelism: 8
228+
incremental: true
229+
230+
cache:
231+
enabled: true
232+
directory: .code-intelligence
233+
db_name: cache.db
234+
```
235+
236+
## Extending with Plugins
237+
238+
Create custom detectors by implementing the `Detector` protocol:
239+
240+
```python
241+
from code_intelligence.detectors.base import DetectorContext, DetectorResult
242+
from code_intelligence.models.graph import GraphNode, NodeKind, SourceLocation
243+
244+
class MyCustomDetector:
245+
name = "my_custom"
246+
supported_languages = ("python",)
247+
248+
def detect(self, ctx: DetectorContext) -> DetectorResult:
249+
result = DetectorResult()
250+
# Your detection logic here
251+
# Access: ctx.file_path, ctx.content, ctx.parsed_data, ctx.tree
252+
return result
253+
```
254+
255+
Register via `pyproject.toml` entry point:
256+
257+
```toml
258+
[project.entry-points."code_intelligence.detectors"]
259+
my_custom = "my_package.my_module:MyCustomDetector"
260+
```
261+
262+
## Development
263+
264+
```bash
265+
# Clone
266+
git clone https://github.com/RandomCodeSpace/code-iq.git
267+
cd code-iq
268+
269+
# Install in development mode
270+
pip install -e ".[dev]"
271+
272+
# Run tests
273+
pytest
274+
275+
# Run analysis on this repo
276+
code-intelligence analyze .
277+
```
278+
279+
## Requirements
280+
281+
- Python 3.11+
282+
- Dependencies: typer, rich, tree-sitter, networkx, lxml, pyyaml, sqlparse, pydantic
283+
284+
## License
285+
286+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
287+
288+
---
289+
290+
<p align="center">
291+
Built with intelligence.
292+
</p>

0 commit comments

Comments
 (0)