Metadata-Version: 2.4
Name: codeglass
Version: 0.1.2
Summary: Code intelligence engine — extract symbols, references, and structure from codebases using tree-sitter
Author-email: Kiwi AI <engineering@meetkiwi.ai>
License: MIT
Keywords: ast,code-analysis,code-intelligence,references,symbols,tree-sitter
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: tree-sitter-language-pack>=1.10.0
Requires-Dist: tree-sitter>=0.20.0
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Description-Content-Type: text/markdown

# codeglass

Code intelligence engine — extract symbols, references, import graphs, call graphs, type hierarchies, and structural outlines from codebases using tree-sitter.

Language-agnostic core with per-language plugins. 7 languages supported out of the box.

## Quick Start

```bash
pip install codeglass
```

```python
from pylens import CodeLens

lens = CodeLens()

# Get all symbols from a file
outline = lens.get_symbols("src/main.py")
for sym in outline.symbols:
    print(f"{sym.kind:10} {sym.name:30} line {sym.line}")

# Get the import graph of a project
graph = lens.get_import_graph("src/")
print(f"{graph.stats.total_files} files, {graph.stats.total_imports} imports")

# Find what a function calls
calls = lens.get_call_graph("handle_request", "src/server.py", 42)
for callee in calls.callees:
    print(f"  → {callee.name} (line {callee.resolved_line})")

# Get the class hierarchy
hierarchy = lens.get_type_hierarchy("src/")
for name, node in hierarchy.types.items():
    if node.subclasses:
        print(f"{name} → {', '.join(node.subclasses)}")
```

## Features

| Operation | Description | Deterministic |
|---|---|---|
| `get_symbols` | Extract functions, classes, methods with signatures and docstrings | ✅ |
| `get_references` | Find all usages of a symbol across a codebase | ⚠️ cross-file: best-effort |
| `get_outline` | Recursive directory tree with per-file symbol summaries | ✅ |
| `get_import_graph` | Full import graph: imports, imported_by, stats, orphans | ✅ |
| `get_call_graph` | Callees — what does this function call? | ✅ |
| `get_test_coverage` | Find test files and match test functions to source symbols | ⚠️ file matching: heuristic |
| `get_type_hierarchy` | Class inheritance graph with bases, subclasses, abstract detection | ✅ |
| `find_similar` | Find structurally similar functions via AST fingerprinting | ✅ |

## Supported Languages

Python, JavaScript, TypeScript, Go, Rust, C/C++, Ruby

Adding a new language takes ~30 lines of tree-sitter queries.

## Documentation

- [Getting Started](docs/getting-started.md)
- [Operations Guide](docs/operations.md)
- [Languages](docs/languages.md)
- [API Reference](docs/api-reference.md)

## Requirements

- Python 3.11+
- tree-sitter 0.20.x
- tree-sitter-languages 1.10+

## License

MIT
