Skip to main content

Attributes

classes

codeowners

current_commit

default_branch

directories

exports

external_modules

functions

github

global_vars

imports

interfaces

language

name

repo_path

symbols

types

Methods

ai

Generates a response from the AI based on the provided prompt, target, and context.

checkout

Checks out a git branch or commit and syncs the codebase graph to the new state.

commit

Commits all staged changes to the codebase graph and synchronizes the graph with the filesystem if specified.

create_directory

Creates a directory at the specified path.

create_file

Creates a new file in the codebase with specified content.

create_pr

Creates a pull request from the current branch to the repository’s default branch.

create_pr_comment

Create a comment on a pull request

create_pr_review_comment

Create a review comment on a pull request.

files

A list property that returns all files in the codebase.

find_by_span

Finds editable objects that overlap with the given source code span.

from_files

Creates a Codebase instance from multiple files.

from_repo

Fetches a codebase from GitHub and returns a Codebase instance.

from_string

Creates a Codebase instance from a string of code.

get_class

Returns a class that matches the given name.

get_directory

Returns Directory by dir_path, or full path to the directory from codebase root.

get_file

Retrieves a file from the codebase by its filepath.

get_function

Retrieves a function from the codebase by its name.

get_modified_symbols_in_pr

Get all modified symbols in a pull request

get_relative_path

Calculates a relative path from one file to another, removing the extension from the target file.

get_symbol

Returns a Symbol by name from the codebase.

get_symbols

Retrieves all symbols in the codebase that match the given symbol name.

git_commit

Stages + commits all changes to the codebase and git.

has_directory

Returns a boolean indicating if a directory exists in the codebase.

has_file

Determines if a file exists in the codebase.

has_symbol

Returns whether a symbol exists in the codebase.

reset

Resets the codebase by

set_ai_key

Sets the OpenAI key for the current Codebase instance.

set_session_options

Sets the session options for the current codebase.

should_fix

Returns True if the flag should be fixed based on the current mode and active group.

visualize

Visualizes a NetworkX graph or Plotly figure.