Skip to main content

Fast code intelligence via SCIP indexes

Project description

scip-cli

PyPI version License: MIT

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

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)

scip-cli can automatically download the required indexing tools when needed, or you can install them globally for faster performance:

Option A: Let scip-cli handle it (recommended)

Just use scip-cli - it will automatically download the required tools via npx on first use. No global installation needed.

Option B: Install globally for better performance

# 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
npm install -g @sourcegraph/scip

Verify installation:

scip-cli --help
scip-typescript --version  # Only if you chose Option B
scip --version             # Only if you chose Option B

Usage

All commands are subcommands of scip-cli:

scip-cli <command> [arguments]

Commands

  • refs <symbol> - Find all references to a symbol
  • def <symbol> - Find symbol definition with source code
  • search <pattern> - Search symbols by name pattern
  • symbols <file> - List all symbols in a file
  • rdeps <file> - Find files that depend on a file
  • members <symbol> - List members of a class/interface
  • reindex - Force re-indexing of the current project
  • skill [path] - Install or dump the SKILL.md

Examples

# Find where useDictation is used
scip-cli refs useDictation

# Get definition of useDictation
scip-cli def useDictation

# Search for symbols matching "Dictation"
scip-cli search Dictation

# List symbols in a file
scip-cli symbols src/hooks/useDictation.ts

# Find files that import from useDictation.ts
scip-cli rdeps src/hooks/useDictation.ts

# List members of a class
scip-cli members UseDictationOptions

# Install skill file
scip-cli skill ~/.claude/skills/scip/SKILL.md

How It Works

  1. On first query, automatically detects project language from package.json (TS/JS) or pyproject.toml/setup.py (Python)
  2. Indexes using scip-typescript (adds --infer-tsconfig for JS-only projects) or scip-python
  3. Converts the SCIP index to SQLite using scip expt-convert
  4. Caches the database in ~/.cache/scip-cli/projects/<hash>/index.db
  5. Subsequent queries are instant SQLite lookups

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
├── lib.py         # Core utilities (indexing, symbol resolution)
└── commands/      # Subcommand implementations
    ├── refs.py
    ├── def_cmd.py
    ├── search.py
    ├── symbols.py
    ├── rdeps.py
    ├── members.py
    ├── reindex.py
    └── skill.py

Development

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scip_cli-1.1.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scip_cli-1.1.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file scip_cli-1.1.0.tar.gz.

File metadata

  • Download URL: scip_cli-1.1.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scip_cli-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f6fd9b691ad7cf4623d5cc3b172810a7af641b8e6ad14101c645b24afe2ffe54
MD5 4f1c1d472acb654bc5b497be1a82fd4c
BLAKE2b-256 e5c48bfcd74fd97014f06eca7ae9d4a4ec6eec563dc6ceea7b554658698ee2cd

See more details on using hashes here.

File details

Details for the file scip_cli-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: scip_cli-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for scip_cli-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 379a389a66d19983ebb70b271a0675850b892a542bd44a76161b8a0a630ad2d7
MD5 fd7806d0a9f837dcfee38969296ee949
BLAKE2b-256 987554347b8c3c7bca2ee18ece590a12814a4badabf9ddf81900a940ebfc38b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page