Skip to main content

A modular toolkit for LLM-powered codebase understanding.

Project description

kit 🛠️ Code Intelligence Toolkit

kit is a production-ready toolkit for codebase mapping, symbol extraction, code search, and building LLM-powered developer tools, agents, and workflows.

Use kit to build things like code reviewers, code generators, even IDEs, all enriched with the right code context. Work with kit directly from Python, or with MCP + function calling, REST, or CLI.

Explore the full documentation for detailed usage, advanced features, and practical examples. Check out docs for kit's local dev MCP server, too.

Quick Installation

Install from PyPI

uv pip install cased-kit

# With ML features for advanced analysis and vector search
uv pip install 'cased-kit[all]'

Install Globally with uv (easiest for CLI usage)

If you want to use the kit CLI globally without affecting your system Python, use uv tool install. This creates an isolated environment for kit while making the CLI available from anywhere:

# Install the base kit CLI globally
uv tool install cased-kit

# Everything (including MCP server and all features)
uv tool install cased-kit[all]

After installation, the kit and kit-dev-mcp commands will be available globally. To manage your uv tool installations:

# List installed tools
uv tool list

# Uninstall if needed
uv tool uninstall cased-kit

Claude Code Plugin

Use kit directly in Claude Code with the official plugin:

/plugin marketplace add cased/claude-code-plugins
/plugin install kit-cli

The plugin gives Claude autonomous access to kit's codebase analysis tools. Claude will automatically use kit when you ask questions like:

  • "How does authentication work in this codebase?"
  • "Find all usages of the UserModel class"
  • "What are the dependencies of this project?"
  • "Show me the file structure of src/"

See the Claude Code Integration Guide for details.

Toolkit Usage

Basic Python API

from kit import Repository

# Load a local repository
repo = Repository("/path/to/your/local/codebase")

# Load a remote public GitHub repo
repo = Repository("https://github.com/owner/repo")

# Load a private GitHub repo (automatically uses KIT_GITHUB_TOKEN if set)
repo = Repository("https://github.com/owner/private-repo")

# Or explicitly
repo = Repository("https://github.com/owner/private-repo", github_token="ghp_...")

# At a specific commit, tag, or branch
# repo = Repository("https://github.com/owner/repo", ref="v1.2.3")
# Explore a repo
print(repo.get_file_tree())
# Output: [{"path": "src/main.py", "is_dir": False, ...}, ...]

print(repo.extract_symbols('src/main.py'))
# Output: [{"name": "main", "type": "function", "file": "src/main.py", ...}, ...]

# Access git metadata
print(f"Current SHA: {repo.current_sha}")
print(f"Branch: {repo.current_branch}")

# Read one file
main_py = repo.get_file_content("src/main.py")

# Read many files in one round-trip
contents = repo.get_file_content([
    "src/main.py",
    "src/utils/helper.py",
    "tests/test_main.py",
])
print(contents["src/utils/helper.py"])

Command Line Interface

kit provides a comprehensive CLI for repository analysis and code exploration.

Repository Analysis:

# Get repository file structure
kit file-tree /path/to/repo

# Extract symbols (functions, classes, etc.)
kit symbols /path/to/repo --format table

# Search for code patterns
kit search /path/to/repo "def main" --pattern "*.py"

# Find symbol usages
kit usages /path/to/repo "MyClass"

# Export data for external tools
kit export /path/to/repo symbols symbols.json

PR Reviews:

# Initialize configuration
kit review --init-config

# Review GitHub PRs
kit review --dry-run https://github.com/owner/repo/pull/123
kit review https://github.com/owner/repo/pull/123

# Review local git diffs (no PR required!)
kit review main..feature  # Compare branches
kit review HEAD~3..HEAD   # Review last 3 commits
kit review --staged       # Review staged changes

PR Summaries:

# Generate PR summaries for quick triage
kit summarize https://github.com/owner/repo/pull/123
kit summarize --update-pr-body https://github.com/owner/repo/pull/123

Commit Messages:

# Generate intelligent commit messages from staged changes
git add .  # Stage your changes first
kit commit  # Analyze and commit with AI-generated message

Package Search (requires Chroma API key):

kit package-search-grep numpy "def.*fft" --max-results 10  # Plain grep-style output
kit package-search-grep numpy "def.*fft" --json           # Structured JSON output
kit package-search-hybrid django "authentication middleware"
kit package-search-read requests "requests/models.py"

See the CLI Documentation for comprehensive usage examples.

Key Toolkit Capabilities

kit helps your apps and agents understand and interact with codebases, with components to build your own AI-powered developer tools.

  • Explore Code Structure:

    • High-level view with repo.get_file_tree() to list all files and directories. You can also pass a subdirectory for a more limited scan.
    • Dive down with repo.extract_symbols() to identify functions, classes, and other code constructs, either across the entire repository or within a single file.
    • Use repo.extract_symbols_incremental() to get fast, cache-aware symbol extraction—best when dealing with small changes to repositories.
  • Pinpoint Information:

    • Run fast regular expression searches across your codebase using repo.search_text() (automatically uses ripgrep when available for 10x speedup).
    • Track specific symbols (like a function or class) with repo.find_symbol_usages().
    • Find code by structure with AST-based pattern matching (async functions, try blocks, class inheritance, etc.).
  • Prepare Code for LLMs & Analysis:

    • Break down large files into manageable pieces for LLM context windows using repo.chunk_file_by_lines() or repo.chunk_file_by_symbols().
    • Get the full definition of a function or class off a line number within it using repo.extract_context_around_line().
  • Generate Code Summaries:

    • Use LLMs to create natural language summaries for files, functions, or classes using the Summarizer (e.g., summarizer.summarize_file(), summarizer.summarize_function()).
    • Build a searchable index of these AI-generated docstrings with DocstringIndexer and query it with SummarySearcher for intelligent code discovery.
  • Analyze Code Dependencies:

    • Map import relationships between modules using repo.get_dependency_analyzer() to understand your codebase structure.
    • Generate dependency reports and LLM-friendly context with analyzer.generate_dependency_report() and analyzer.generate_llm_context().
  • Search Package Source Code (via Chroma):

    • Search through popular package source code using ChromaPackageSearch for regex patterns and semantic queries.
    • Access source code from packages like numpy, django, fastapi, pandas, and more.
    • Integrated into kit-dev MCP for seamless package exploration in AI assistants.
  • Repository Versioning & Historical Analysis:

    • Analyze repositories at specific commits, tags, or branches using the ref parameter.
    • Compare code evolution over time, work with diffs, ensure reproducible analysis results
    • Access git metadata including current SHA, branch, and remote URL with repo.current_sha, repo.current_branch, etc.
  • Multi-Repository Analysis:

    • Analyze multiple repositories together with MultiRepo for microservices, monorepos, or team projects.
    • Unified search, symbol lookup, and dependency auditing across all repos.
    • CLI support: kit multi search, kit multi deps, kit multi summary.

MCP Server (kit-dev MCP)

kit includes an enhanced MCP (Model Context Protocol), kit-dev, designed especially for individual local dev work. It includes kit's production-grade code intelligence and context building, and adds in multi-source documentation research and package searching.

Environment Variables: OPENAI_API_KEY, OPENAI_BASE_URL (for proxies/custom endpoints), ANTHROPIC_API_KEY

→ Full kit-dev MCP Documentation

kit-powered Features & Utilities

As both demonstrations of this library, and as standalone products, kit ships with MIT-licensed, CLI-based pull request review and summarization features.

PR Reviews

The pull request reviewer ranks with the better closed-source paid options, but at a fraction of the cost with cloud models. At Cased we use kit extensively with models like Sonnet 4 and gpt4.1, paying just for the price of tokens.

kit review --init-config
kit review https://github.com/owner/repo/pull/123

→ Complete PR Reviewer Documentation

PR Summaries

For quick PR triage and understanding, kit includes a fast, cost-effective PR summarization feature. Perfect for teams that need to quickly understand what PRs do before deciding on detailed review.

kit summarize https://github.com/owner/repo/pull/123
kit summarize --update-pr-body https://github.com/owner/repo/pull/123

Key Features:

  • 5-10x cheaper than full reviews (~$0.005-0.02 vs $0.01-0.05+)
  • Fast triage: Quick overview of changes, impact, and key modifications

Commit Messages

Generate intelligent commit messages from staged changes using the same repository intelligence:

git add .       # Stage your changes
kit commit      # Analyze and commit with AI-generated message

Documentation

Full Documentation - Detailed usage, advanced features, and practical examples. Full REST documentation is also available.

kit-dev MCP Documentation - Complete guide for the enhanced MCP server

Changelog - Track all changes and improvements across kit releases

License

MIT License

Contributing

  • Local Development: Check out our Running Tests guide to get started with local development.
  • Project Direction: See our Roadmap for future plans and focus areas.

To contribute, fork the repository, make your changes, and submit a pull request.

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

cased_kit-3.5.1.tar.gz (386.6 kB view details)

Uploaded Source

Built Distribution

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

cased_kit-3.5.1-py3-none-any.whl (235.4 kB view details)

Uploaded Python 3

File details

Details for the file cased_kit-3.5.1.tar.gz.

File metadata

  • Download URL: cased_kit-3.5.1.tar.gz
  • Upload date:
  • Size: 386.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cased_kit-3.5.1.tar.gz
Algorithm Hash digest
SHA256 e5e25f543fc220d7b8347339c8af9018c07a3175be087809f254f45b42393cb1
MD5 e0ece6eca8a8434fdaccf1bd65185cb2
BLAKE2b-256 c04ab782370a441bdab98c948b5eaa7b57bf4d22d6402bc60f484c4b9d848f2c

See more details on using hashes here.

File details

Details for the file cased_kit-3.5.1-py3-none-any.whl.

File metadata

  • Download URL: cased_kit-3.5.1-py3-none-any.whl
  • Upload date:
  • Size: 235.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for cased_kit-3.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6364467f0693ab3386fbcd6d5bca8a4ce3e583fb2b6ed3748bd927ccfa87070
MD5 506ddb3d53331c87eec340221e5f9fe5
BLAKE2b-256 17fe219700e93520d1d77af73fff392aebcd6a21c7e9ba6a7d6d37424237a42b

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