Building with Codegen
Learn how to use Codegen's core APIs to analyze and transform code.
Core Concepts
Understand how Graph-sitter parses and analyzes different programming languages.
Files & DirectoriesLearn how to work with files, directories, and navigate the codebase structure.
The Editable APILearn how to safely modify code while preserving formatting and comments.
Symbols, Functions and ClassesMaster the core abstractions for manipulating code safely and effectively.
Navigating the Code Graph
Analyze relationships between code elements and track symbol references.
Function Calls & CallsitesUnderstand function call patterns and manipulate call sites.
ImportsWork with module imports and manage dependencies.
Traversing the Call GraphNavigate function call relationships and analyze code flow.
Code Manipulation
Relocate functions, classes, and other symbols while updating references.
Statements & Code BlocksWork with code blocks, control flow, and statement manipulation.
Variable AssignmentsHandle variable declarations, assignments, and scope.
CollectionsWork with groups of related code elements like functions, classes, and imports.
Special Features
Work with React components, JSX syntax, and component transformations.
Local VariablesAnalyze and manipulate local variable usage and scope.
Calling Out to LLMsIntegrate AI assistance into your code transformations.
Codebase VisualizationVisualize code relationships and dependencies.
Each guide includes practical examples and best practices. Start with core concepts or jump directly to the topics most relevant to your needs.