Metadata-Version: 2.4
Name: sia-code
Version: 0.3.1
Summary: Local-first codebase intelligence with semantic search, multi-hop research, and 12-language AST support
Author: Sia Code Contributors
License: MIT
Project-URL: Homepage, https://github.com/DxTa/sia-code
Project-URL: Documentation, https://github.com/DxTa/sia-code#readme
Project-URL: Repository, https://github.com/DxTa/sia-code
Project-URL: Issues, https://github.com/DxTa/sia-code/issues
Keywords: code-search,semantic-search,code-indexing,codebase-intelligence,tree-sitter,ast,code-analysis,developer-tools,cli
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Indexing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: memvid-sdk>=2.0
Requires-Dist: tree-sitter>=0.21.0
Requires-Dist: tree-sitter-python>=0.21.0
Requires-Dist: tree-sitter-javascript>=0.21.0
Requires-Dist: tree-sitter-typescript>=0.21.0
Requires-Dist: tree-sitter-go>=0.21.0
Requires-Dist: tree-sitter-rust>=0.21.0
Requires-Dist: tree-sitter-java>=0.21.0
Requires-Dist: tree-sitter-c>=0.21.0
Requires-Dist: tree-sitter-cpp>=0.21.0
Requires-Dist: tree-sitter-c-sharp>=0.21.0
Requires-Dist: tree-sitter-ruby>=0.21.0
Requires-Dist: tree-sitter-php>=0.21.0
Requires-Dist: click>=8.0
Requires-Dist: rich>=13.0
Requires-Dist: pathspec>=0.11
Requires-Dist: pydantic>=2.0
Requires-Dist: prompt-toolkit>=3.0
Requires-Dist: watchdog>=3.0
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == "openai"
Provides-Extra: pdf
Requires-Dist: pypdf>=3.0; extra == "pdf"
Provides-Extra: all
Requires-Dist: openai>=1.0; extra == "all"
Requires-Dist: pypdf>=3.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: pytest-timeout>=2.1; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"
Requires-Dist: bump-my-version>=0.20; extra == "dev"

# Sia Code

Local-first codebase search with semantic understanding and multi-hop code discovery.

## Features

- **Semantic Search** - Natural language queries with OpenAI embeddings (auto-fallback to lexical)
- **Multi-Hop Research** - Automatically discover code relationships and call graphs
- **Natural Language Questions** - Ask "How does X work?" and get relevant code
- **Project Auto-Detection** - Automatic language detection and indexing strategy
- **Tiered Search** - Filter by project code, dependencies, or both
- **12 Languages** - Python, JS/TS, Go, Rust, Java, C/C++, C#, Ruby, PHP (full AST support)
- **Interactive Mode** - Live search with result navigation and export
- **Watch Mode** - Auto-reindex on file changes
- **Portable** - Single `.mv2` file storage, no database required

## Installation

```bash
# From PyPI (recommended)
pip install sia-code

# Or with uv
uv tool install sia-code

# Or from source
uv tool install git+https://github.com/DxTa/sia-code.git

# Try without installing (ephemeral run)
uvx sia-code --version
uvx sia-code search "authentication logic"

# Verify installation
sia-code --version
```

## Quick Start

```bash
# Initialize and index
sia-code init
sia-code index .

# Search
sia-code search "authentication logic"           # Semantic search
sia-code search --regex "def.*login"             # Regex search

# Multi-hop research (discover relationships)
sia-code research "how does the API handle errors?"

# Check index health
sia-code status
```

## Commands

| Command | Description |
|---------|-------------|
| `sia-code init` | Initialize index in current directory |
| `sia-code init --dry-run` | Preview project analysis without indexing |
| `sia-code index .` | Index codebase (first time) |
| `sia-code index --update` | Re-index only changed files (10x faster) |
| `sia-code index --clean` | Full rebuild from scratch |
| `sia-code index --watch` | Auto-reindex on file changes |
| `sia-code index --parallel` | Use parallel processing (100+ files) |
| `sia-code search "query"` | Semantic or regex search |
| `sia-code search --no-deps` | Exclude dependency code from results |
| `sia-code search --deps-only` | Show only dependency code |
| `sia-code research "question"` | Multi-hop code discovery |
| `sia-code research --hops N` | Set max relationship depth (default: 2) |
| `sia-code research --graph` | Show call graph visualization |
| `sia-code interactive` | Live search mode with result navigation |
| `sia-code status` | Index health and staleness metrics |
| `sia-code compact` | Remove stale chunks when index grows |
| `sia-code config show` | View configuration |

## Configuration

**Semantic search** requires OpenAI API key (optional):

```bash
export OPENAI_API_KEY=sk-your-key-here
sia-code init
sia-code index .
```

**Without API key:** Searches automatically fallback to lexical/regex mode. No crashes.

**Edit config** at `.sia-code/config.json` to:
- Change embedding model (`openai-small`, `openai-large`, `bge-small`)
- Exclude patterns (`node_modules/`, `__pycache__/`, etc.)
- Adjust chunk sizes

View config: `sia-code config show`

## Output Formats

```bash
sia-code search "query" --format json            # JSON output
sia-code search "query" --format table           # Rich table
sia-code search "query" --format csv             # CSV for Excel
sia-code search "query" --output results.json    # Save to file
```

## Supported Languages

**Full AST Support (12):** Python, JavaScript, TypeScript, JSX, TSX, Go, Rust, Java, C, C++, C#, Ruby, PHP

**Recognized:** Kotlin, Groovy, Swift, Bash, Vue, Svelte, and more (indexed as text)

## Troubleshooting

| Issue | Solution |
|-------|----------|
| No API key warning | Normal - searches fallback to lexical mode |
| Index growing large | Run `sia-code compact` to remove stale chunks |
| Slow indexing | Use `sia-code index --update` for incremental |
| Stale search results | Run `sia-code index --clean` to rebuild |

## How It Works

1. **Parse** - Tree-sitter generates AST for each file
2. **Chunk** - cAST algorithm creates semantic chunks (functions, classes)
3. **Embed** - Optional OpenAI embeddings for semantic search
4. **Store** - Single portable `.mv2` file with Memvid
5. **Search** - Hybrid BM25 + vector similarity

## Links

- [ROADMAP.md](ROADMAP.md) - Future development plans
- [KNOWN_LIMITATIONS.md](KNOWN_LIMITATIONS.md) - Current limitations and workarounds

## License

MIT
