Skip to main content

A modular toolkit for LLM-powered codebase understanding.

Project description

kit 🛠️ Code Intelligence Toolkit

kit is a production-ready Python 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 via MCP, with LLM function-calling, or (soon) from the kit REST server.

Quick Installation

Install from PyPI

# Standard installation (all features, including the kit-mcp server)
pip install cased-kit

Install from Source

git clone https://github.com/cased/kit.git
cd kit
uv venv .venv
source .venv/bin/activate
uv pip install -e .

Basic Usage

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")

# Explore the 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", ...}, ...]

Key Features & 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.
    • Dive down with repo.extract_symbols() to identify functions, classes, and other code constructs, either across the entire repository or within a single file.
  • Pinpoint Information:

    • Run regular expression searches across your codebase using repo.search_text().
    • Track specific symbols (like a function or class) with repo.find_symbol_usages().
  • 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 semantic index of these AI-generated docstrings with DocstringIndexer and query it with SummarySearcher to find code based on intent and meaning.
  • 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().
  • And much more... kit also offers capabilities for semantic search on raw code, building custom context for LLMs, and more.

MCP Server

The kit tool includes an MCP (Model Context Protocol) server that allows AI agents and other development tools to interact with a codebase programmatically.

MCP support is currently in alpha. Add a stanza like this to your MCP tool:

{
  "mcpServers": {
    "kit-mcp": {
      "command": "python",
      "args": ["-m", "kit.mcp"]
    }
  }
}

The python executable invoked must be the one where cased-kit is installed. If you see ModuleNotFoundError: No module named 'kit', ensure the Python interpreter your MCP client is using is the correct one.

Documentation

Explore the Full Documentation for detailed usage, advanced features, and practical examples.

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-0.3.0.tar.gz (85.5 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-0.3.0-py3-none-any.whl (67.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cased_kit-0.3.0.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cased_kit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 df76d79fc5d409630f12a7bf92ddc41ef293ce041426cbd2addc7d3f01e02df2
MD5 c54df52f034d1ffdc967ee357cf17e17
BLAKE2b-256 a00f9eb29efdd0c563f40c0f2a15a2d12c23c006aebf99808b54488e72620df4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cased_kit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 67.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cased_kit-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b870e9f8a4bfc5c247ed260835563c659d75cc8f3ff9c5316d66d8286a53d6a6
MD5 6c60b26f3a5365216cec627b39e7ee2d
BLAKE2b-256 27b05a36efab2cc1c14cfa03968e47f9f1af74b4acc0806543dd039de32e1151

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