Fast code intelligence via SCIP indexes
Project description
scip-cli
Fast code intelligence CLI for TypeScript/JavaScript and Python projects. Query SCIP indexes directly via SQLite for instant results.
Features
- Fast: Direct SQLite queries, eliminating skippable overhead
- Simple: Single binary with subcommands
- Auto-indexing: Automatically indexes projects on first query
- Token-efficient: Clean, minimal output optimized for AI consumption
For AI Agents
If you're an AI agent, run this to see the quick reference:
scip-cli skill
Or install it to your skills folder:
scip-cli skill ~/.claude/skills/scip-cli/SKILL.md
This enables commands like def, refs, search, symbols, rdeps, and members - just ask "where is X?" or "find references to X".
Installation
1. Install scip-cli
From PyPI:
pip install scip-cli
From source (local development):
git clone https://github.com/flesler/scip-cli.git
cd scip-cli
pip install .
For editable development (where pip install -e . fails due to permissions):
export PYTHONPATH=/path/to/scip-cli:$PYTHONPATH
python -m scip_cli --help
2. Install prerequisites (optional)
On first index, scip-cli runs language indexers and builds a SQLite cache. You can let it fetch tools on demand, or install them globally ahead of time so the first run does not download via npx:
Option A: Zero extra setup (recommended)
Install scip-cli and run it. On first index, scip-cli will:
- Download
scip-typescript/scip-pythonvianpxwhen not already on PATH - Download the
scipconverter binary from GitHub releases into~/.cache/scip-cli/bin/when not already on PATH - Walk the repo for
tsconfig*.jsonproject roots (TypeScript monorepos), runscip-typescriptper project (parallel by default), convert each partial index, then merge into oneindex.db
No .scip-cli.json required for discovery. Subsequent queries read the cached database only.
Option B: Install indexers globally ahead of time
Same indexing steps as Option A; this only avoids npx download on the first run:
# TypeScript/JavaScript indexer (also handles plain JS via --infer-tsconfig)
npm install -g @sourcegraph/scip-typescript
# Python indexer
npm install -g @sourcegraph/scip-python
# SCIP CLI for index conversion (GitHub release — not on npm)
# https://github.com/scip-code/scip/releases (v0.8.1+ recommended)
Verify installation:
scip-cli --help
scip-typescript --version # Only if you chose Option B
scip --version # Install from GitHub releases; v0.8.1+ recommended
Usage
All commands are subcommands of scip-cli:
scip-cli <command> [arguments]
Commands
refs <symbol>- Find all references to a symbol (--pathto scope)def <symbol>- Find symbol definition with source code (--path,--max-lines)search <pattern>- Search symbols by name pattern (--path)symbols <file>- List all symbols in a file (--path; bare filename OK)rdeps <file>- Find files that depend on a file (--path)members <symbol>- List members of a class/interface (--path)reindex- Force re-indexing of the current project (--pathto limit scope; repeatable)skill [path]- Install or dump the SKILL.md
Examples
# Find where greet is used
scip-cli refs greet
# Get definition of greet
scip-cli def greet
# Search for symbols matching "Widget"
scip-cli search Widget
# Scope to a subdirectory
scip-cli def greet --path packages/api
# List symbols by bare filename
scip-cli symbols helper.ts
# Find files that import from a module
scip-cli rdeps src/helper.ts
# List members of a class
scip-cli members Widget
# Install skill file
scip-cli skill ~/.claude/skills/scip-cli/SKILL.md
Pipelines
Stdout is one record per line; stderr carries warnings and ambiguity notices. Kinds are lowercase (function, class, method, property, variable). Pipe-friendly flags: refs --paths-only, search --names-only / --paths-only, members --names-only. rdeps already prints bare file paths.
# What do importers of this file export?
scip-cli rdeps src/helper.ts | xargs -I{} scip-cli symbols {}
# Which files reference a symbol?
scip-cli refs greet --paths-only
# Classes matching a name → list their members
scip-cli search Handler --kind class --names-only | xargs -I{} scip-cli members {}
# Walk class members to their definitions
scip-cli members Widget --names-only | xargs -I{} scip-cli def Widget.{}
How It Works
- On first query, automatically detects project language from
package.json(TS/JS) orpyproject.toml/setup.py(Python) - For TypeScript monorepos, walks the repository for
tsconfig*.jsonproject roots (nested ancestors deduped; root included only when itsincludeis broad) - Runs
scip-typescriptper project (in parallel when there are multiple projects; setSCIP_CLI_INDEX_WORKERS=1to force serial), orscip-pythonfor Python - Converts each SCIP output to SQLite with
scip expt-convert, then merges partial databases when needed - Caches the result in
~/.cache/scip-cli/projects/<dirname>-<hash>/index.db(e.g.my-monorepo-1a3f7a) - Subsequent queries are SQLite lookups against that cache (not re-indexing)
Configuration
Optional .scip-cli.json in the project root:
{
"maxHeapMb": 8192,
"indexRoots": ["packages/core", "apps/worker"],
"onlyIndexRoots": false
}
maxHeapMb— Node heap forscip-typescript/scip-python(default 8192 MB when omitted). Overridden bySCIP_CLI_MAX_HEAP_MB. This is the V8 heap cap, not total RAM usage.indexRoots— extra TypeScript project directories to include on first index, merged with auto-discovered projects.onlyIndexRoots— skip auto-discovery and index onlyindexRoots(smaller initial index when you only care about part of a monorepo).
SCIP_CLI_INDEX_WORKERS controls parallel scip-typescript runs during first index (default: up to 8). Merge into one database is always serial.
Scoped indexing without editing .scip-cli.json:
scip-cli reindex --path entrypoints/server
scip-cli reindex --path packages/api --path packages/worker
--path limits which discovered tsconfig projects are indexed (prefix match, same idea as query --path). The scope is saved as index-scope.json next to index.db and reused until you run a full scip-cli reindex with no --path.
Run scip-cli reindex after changing scope, .scip-cli.json index settings, or when you want a fresh index.
This is separate from .scipquery.json, which belongs to scip-query and configures its analyzers, watch mode, and diff-gate — not read by scip-cli.
Performance
Inspired by scip-query, scip-cli is a lightweight Python reimplementation optimized for speed. Compared to the original bash wrapper scripts:
refs: 6.4s → 0.03s (213x faster)def: 2.8s → 0.05s (56x faster)search: 2.6s → 0.03s (87x faster)symbols: 0.3s → 0.02s (15x faster)rdeps: 0.2s → 0.02s (10x faster)members: 3.1s → 0.03s (103x faster)
The speedup comes from direct SQLite queries instead of shell command chains, eliminating subprocess overhead.
Architecture
scip_cli/
├── __init__.py
├── __main__.py # CLI entry point
├── cli_args.py # Shared argparse helpers
├── config.py # .scip-cli.json loader
├── discover.py # TypeScript project discovery
├── merge.py # SQLite index merging
├── scip_tool.py # scip binary download
├── constants.py # Shared constants
├── sql.py # SQLite helpers
├── paths.py # --path scope filtering
├── project.py # Project root + language detection
├── cache.py # Index cache paths
├── indexing.py # SCIP index build + get_db
├── symbols.py # Symbol parsing and kinds
├── queries.py # Symbol/file SQL queries
├── source.py # Filesystem source reads
├── output.py # CLI formatting helpers
├── session.py # setup() and single-match resolution
└── commands/ # Subcommand implementations
Development
pip install -e .
pytest tests/ -q
pytest tests/ -m integration -q # indexes tests/fixtures/sample-project (needs scip-typescript)
Debug Logging
Set SCIP_CLI_DEBUG=1 to enable SQL query logging to stderr:
SCIP_CLI_DEBUG=1 scip-cli refs MyFunction
# Shows: SQL: SELECT ... | params: (...)
This is useful for testing and debugging SQL queries without exposing a --debug flag to users.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scip_cli-1.3.0.tar.gz.
File metadata
- Download URL: scip_cli-1.3.0.tar.gz
- Upload date:
- Size: 44.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
130487fc3b52c4eb3091019efa24e1c49e73f81b5875f050c569155f476bbf9d
|
|
| MD5 |
e01e35e6b69702920e32ee4a8249e7d2
|
|
| BLAKE2b-256 |
fef0a030d98cb07510c70c27564fed82f7da5c969073323e1f0875e8eb38e9d6
|
File details
Details for the file scip_cli-1.3.0-py3-none-any.whl.
File metadata
- Download URL: scip_cli-1.3.0-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bce58a3d82752343b55687b21d6126a4cb05fb10b80272aeecf2a3fe65bb412c
|
|
| MD5 |
4456aa2d4b8270f37016306171e6d1bc
|
|
| BLAKE2b-256 |
6bfab2726a4a3e1a9e511b42b96bd8c2e6399e865b861f12418cf7cf599ca63e
|