graph_sitter.cli
The Graph-sitter CLI helps you:
- Parse a local repository into graph summary data
- Diagnose parse time, memory use, and graph size for a local repository
- Initialize Graph-sitter in your repository
- Create and run codemods
- Run one-shot transformations by import path
- Work with AI assistance
For installation instructions, see our Getting Started guide.
Getting Started
- Parse a repository without project initialization:
graph-sitter parse . --format jsonRun the same command from a published package with uvx:
uvx --python 3.13 graph-sitter parse . --format jsonSee uvx workflows for branch-built wheel validation and release gate details.
- Diagnose a repository with timing and memory stats:
uvx --python 3.13 graph-sitter diagnose .- Initialize Graph-sitter in your repository:
graph-sitter init- Create your first codemod:
graph-sitter create my-codemod --description "What you want to accomplish"The --description flag enables AI assistance to help generate your codemod. Be as specific as possible about what you want to achieve.
Available Commands
Initialize Graph-sitter in your repository.
doctorCheck package, parser dependency, and Rust backend readiness.
uvxRun Graph-sitter from a package or wheel in a clean temporary environment.
parseParse a repository and print graph summary counts.
diagnoseReport parse time, memory use, and graph size for a repository.
createCreate new codemods with optional AI assistance.
runExecute registered codemods with check and write modes.
transformRun one-shot codemods by Python import path or file path.
expertUse Graph-sitter docs and project context with an AI assistant.
Working with AI
When using Cursor, you can mention @codegen-sh in any chat or composer window to get:
- Documentation about available APIs
- Context about your active codemod
- Examples of similar codemods
- Relevant code snippets
The AI uses this context to provide accurate and helpful responses about working with Codegen.