diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml
index c86c1a64e..4bb44ea1d 100644
--- a/.github/workflows/generate-docs.yml
+++ b/.github/workflows/generate-docs.yml
@@ -6,7 +6,7 @@ on:
- develop
permissions:
- contents: write # Need write permission to commit changes
+ contents: write # Need write permission to commit changes
jobs:
generate-docs:
@@ -22,10 +22,10 @@ jobs:
uses: ./.github/actions/setup-environment
- name: Generate API reference
- run: uv run python src/gscli/cli.py generate docs
+ run: uv run python src/graph-sitter/gscli/cli.py generate docs
- name: Generate System Prompt
- run: uv run python src/gscli/cli.py generate system-prompt
+ run: uv run python src/graph-sitter/gscli/cli.py generate system-prompt
- name: Commit changes
run: |
diff --git a/README.md b/README.md
index 2e711f17b..86fad5318 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
- The SWE that Never Sleeps
+ Scriptable interface to a powerful, multi-lingual language server.
@@ -15,55 +15,79 @@
[](https://pypi.org/project/codegen/)
[](https://docs.codegen.com)
[](https://community.codegen.com)
-[](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file)
+[](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
[](https://x.com/codegen)
-The Codegen SDK provides a programmatic interface to code agents provided by [Codegen](https://codegen.com).
+[Codegen](https://docs.codegen.com) is a python library for manipulating codebases.
```python
-from codegen.agents.agent import Agent
+from codegen import Codebase
+
+# Codegen builds a complete graph connecting
+# functions, classes, imports and their relationships
+codebase = Codebase("./")
+
+# Work with code without dealing with syntax trees or parsing
+for function in codebase.functions:
+ # Comprehensive static analysis for references, dependencies, etc.
+ if not function.usages:
+ # Auto-handles references and imports to maintain correctness
+ function.move_to_file("deprecated.py")
+```
+
+Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale.
-# Initialize the Agent with your organization ID and API token
-agent = Agent(
- org_id="YOUR_ORG_ID", # Find this at codegen.com/developer
- token="YOUR_API_TOKEN", # Get this from codegen.com/developer
- # base_url="https://codegen-sh-rest-api.modal.run", # Optional - defaults to production
-)
+## Installation and Usage
-# Run an agent with a prompt
-task = agent.run(prompt="Implement a new feature to sort users by last login.")
+We support
-# Check the initial status
-print(task.status)
+- Running Codegen in Python 3.12 - 3.13 (recommended: Python 3.13+)
+- macOS and Linux
+ - macOS is supported
+ - Linux is supported on x86_64 and aarch64 with glibc 2.34+
+ - Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details.
+- Python, Typescript, Javascript and React codebases
-# Refresh the task to get updated status (tasks can take time)
-task.refresh()
+```
+# Install inside existing project
+uv pip install codegen
-# Check the updated status
-print(task.status)
+# Install global CLI
+uv tool install codegen --python 3.13
-# Once task is complete, you can access the result
-if task.status == "completed":
- print(task.result) # Result often contains code, summaries, or links
+# Create a codemod for a given repo
+cd path/to/repo
+gs init
+gs create test-function
+
+# Run the codemod
+gs run test-function
+
+# Create an isolated venv with codegen => open jupyter
+gs notebook
```
-## Installation and Usage
+## Usage
-Install the SDK using pip or uv:
+See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial.
-```bash
-pip install codegen
-# or
-uv pip install codegen
```
+from codegen import Codebase
+```
+
+## Troubleshooting
+
+Having issues? Here are some common problems and their solutions:
-Get started at [codegen.com](https://codegen.com) and get your API token at [codegen.com/developer](https://codegen.com/developer).
+- **I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`.
+- **I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`.
+- **I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`.
-You can interact with your AI engineer via API, or chat with it in Slack, Linear, Github, or on our website.
+If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out!
## Resources
@@ -72,6 +96,18 @@ You can interact with your AI engineer via API, or chat with it in Slack, Linear
- [Contributing](CONTRIBUTING.md)
- [Contact Us](https://codegen.com/contact)
+## Why Codegen?
+
+Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves.
+
+We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes:
+
+- **Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management.
+
+- **Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code.
+
+- **Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself.
+
## Contributing
Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions.
diff --git a/codegen-examples/README.md b/codegen-examples/README.md
index ec2ae6cf8..d13002076 100644
--- a/codegen-examples/README.md
+++ b/codegen-examples/README.md
@@ -19,7 +19,7 @@ uv tool install codegen
Initialize Codegen in your project
```bash
-codegen init
+gs init
```
Activate the virtual environment
diff --git a/codegen-examples/examples/ai_impact_analysis/run.py b/codegen-examples/examples/ai_impact_analysis/run.py
index dd8460214..7b786cff1 100644
--- a/codegen-examples/examples/ai_impact_analysis/run.py
+++ b/codegen-examples/examples/ai_impact_analysis/run.py
@@ -46,7 +46,7 @@
if not found_git:
# Option C: Use from_repo method which handles cloning
print("No local git repository found. Cloning a repository...")
- codebase = Codebase.from_repo(repo_full_name="codegen-sh/codegen", language="python")
+ codebase = Codebase.from_repo(repo_full_name="codegen-sh/graph-sitter", language="python")
print(f"Codebase loaded with {len(codebase.files)} files and {len(codebase.symbols)} symbols")
diff --git a/codegen-examples/examples/codegen-mcp-server/README.md b/codegen-examples/examples/codegen-mcp-server/README.md
index ad7d9da42..f56558d11 100644
--- a/codegen-examples/examples/codegen-mcp-server/README.md
+++ b/codegen-examples/examples/codegen-mcp-server/README.md
@@ -14,7 +14,7 @@
[](https://docs.codegen.com)
-[](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file)
+[](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
@@ -36,7 +36,7 @@ This example demonstrates how to run a Model Control Protocol (MCP) server that
1. No installation is necessary, with the following command. Run this command directly or add it your `.json` mcp config file.
```bash
- uvx --from 'git+https://github.com/codegen-sh/codegen-sdk.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server' codegen-mcp-server
+ uvx --from 'git+https://github.com/codegen-sh/graph-sitter.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server' codegen-mcp-server
```
### Example MCP Config
@@ -50,7 +50,7 @@ Here is an example mcp config that can be used with Cline or Claude desktop to i
"command": "uvx",
"args": [
"--from",
- "git+https://github.com/codegen-sh/codegen-sdk.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server",
+ "git+https://github.com/codegen-sh/graph-sitter.git#egg=codegen-mcp-server&subdirectory=codegen-examples/examples/codegen-mcp-server",
"codegen-mcp-server"
],
"disabled": false,
diff --git a/codegen-examples/examples/codegen-mcp-server/llms-install.md b/codegen-examples/examples/codegen-mcp-server/llms-install.md
index 774d315ea..b01cdddcb 100644
--- a/codegen-examples/examples/codegen-mcp-server/llms-install.md
+++ b/codegen-examples/examples/codegen-mcp-server/llms-install.md
@@ -1,6 +1,6 @@
Please read two things before trying to install this codegen MCP server:
-1. [Readme](https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/codegen-examples/examples/codegen-mcp-server/README.md)
+1. [Readme](https://raw.githubusercontent.com/codegen-sh/graph-sitter/refs/heads/develop/codegen-examples/examples/codegen-mcp-server/README.md)
- This contains the instructions for setting up the mcp server
@@ -10,7 +10,7 @@ Please read two things before trying to install this codegen MCP server:
Please use a CURL command to retrieve the contents of the readme and documentation and read both before starting to install the server.
-1. curl -sL "https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/README.md" | cat
+1. curl -sL "https://raw.githubusercontent.com/codegen-sh/graph-sitter/refs/heads/develop/README.md" | cat
1. curl -sL "https://docs.codegen.com/llms.txt" | cat
diff --git a/codegen-examples/examples/linear_webhooks/uv.lock b/codegen-examples/examples/linear_webhooks/uv.lock
index a57f080f5..a58dcf1f7 100644
--- a/codegen-examples/examples/linear_webhooks/uv.lock
+++ b/codegen-examples/examples/linear_webhooks/uv.lock
@@ -231,7 +231,7 @@ wheels = [
[[package]]
name = "codegen"
version = "0.22.2.dev14+g64374f8"
-source = { git = "https://github.com/codegen-sh/codegen-sdk.git?rev=64374f8#64374f832539b137b83859dd88b3f78df3a5c664" }
+source = { git = "https://github.com/codegen-sh/graph-sitter.git?rev=64374f8#64374f832539b137b83859dd88b3f78df3a5c664" }
dependencies = [
{ name = "anthropic" },
{ name = "astor" },
@@ -999,7 +999,7 @@ dependencies = [
[package.metadata]
requires-dist = [
- { name = "codegen", git = "https://github.com/codegen-sh/codegen-sdk.git?rev=64374f8" },
+ { name = "codegen", git = "https://github.com/codegen-sh/graph-sitter.git?rev=64374f8" },
{ name = "modal", specifier = ">=0.73.25" },
]
diff --git a/codegen-examples/examples/modal_repo_rag/README.md b/codegen-examples/examples/modal_repo_rag/README.md
index 0ae5a3862..5209e7529 100644
--- a/codegen-examples/examples/modal_repo_rag/README.md
+++ b/codegen-examples/examples/modal_repo_rag/README.md
@@ -13,7 +13,7 @@
[](https://docs.codegen.com)
-[](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file)
+[](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
diff --git a/codegen-examples/examples/promises_to_async_await/README.md b/codegen-examples/examples/promises_to_async_await/README.md
index 7980a34f3..78c3a75ef 100644
--- a/codegen-examples/examples/promises_to_async_await/README.md
+++ b/codegen-examples/examples/promises_to_async_await/README.md
@@ -101,7 +101,7 @@ Currently, the `promise_chain.convert_to_async_await()` method handles the follo
**IMPORTANT:**
-_There will be cases that the current `promise_chain.convert_to_async_await()` cannot handle. In those cases, either right your own transformation logic using the codegen-sdk or open an issue on the [Codegen](https://github.com/codegen-sh/codegen-sdk) repository._
+_There will be cases that the current `promise_chain.convert_to_async_await()` cannot handle. In those cases, either right your own transformation logic using the codegen-sdk or open an issue on the [Codegen](https://github.com/codegen-sh/graph-sitter) repository._
## Contributing
diff --git a/codegen-examples/examples/repo_analytics/README.md b/codegen-examples/examples/repo_analytics/README.md
index e072eb20e..55e7a83a4 100644
--- a/codegen-examples/examples/repo_analytics/README.md
+++ b/codegen-examples/examples/repo_analytics/README.md
@@ -107,7 +107,7 @@ The script will output a detailed report including:
```
š Repository Analysis Report š
==================================================
-š Repository: codegen-sh/codegen
+š Repository: codegen-sh/graph-sitter
š Description: [Repository description from GitHub]
š Basic Metrics:
diff --git a/codegen-examples/examples/repo_analytics/run.py b/codegen-examples/examples/repo_analytics/run.py
index 79955e089..7d24fce0c 100644
--- a/codegen-examples/examples/repo_analytics/run.py
+++ b/codegen-examples/examples/repo_analytics/run.py
@@ -285,7 +285,7 @@ def analyze_repo(repo_url: str) -> Dict[str, Any]:
if __name__ == "__main__":
- repo_url = "codegen-sh/codegen"
+ repo_url = "codegen-sh/graph-sitter"
results = analyze_repo(repo_url)
print("\nš Repository Analysis Report š")
diff --git a/codegen-examples/examples/slack_chatbot/README.md b/codegen-examples/examples/slack_chatbot/README.md
index 6e115b450..e917abdfc 100644
--- a/codegen-examples/examples/slack_chatbot/README.md
+++ b/codegen-examples/examples/slack_chatbot/README.md
@@ -13,7 +13,7 @@
[](https://docs.codegen.com)
-[](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file)
+[](https://github.com/codegen-sh/graph-sitter/tree/develop?tab=Apache-2.0-1-ov-file)
diff --git a/codegen-examples/examples/slack_chatbot/api.py b/codegen-examples/examples/slack_chatbot/api.py
index 681bb13ac..f24abb17d 100644
--- a/codegen-examples/examples/slack_chatbot/api.py
+++ b/codegen-examples/examples/slack_chatbot/api.py
@@ -20,7 +20,7 @@ def format_response(answer: str, context: list[tuple[str, int]]) -> str:
"""Format the response for Slack with file links."""
response = f"*Answer:*\n{answer}\n\n*Relevant Files:*\n"
for filename, score in context:
- github_link = f"https://github.com/codegen-sh/codegen-sdk/blob/develop/{filename}"
+ github_link = f"https://github.com/codegen-sh/graph-sitter/blob/develop/{filename}"
response += f"⢠<{github_link}|{filename}>\n"
return response
@@ -28,7 +28,7 @@ def format_response(answer: str, context: list[tuple[str, int]]) -> str:
def answer_question(query: str) -> tuple[str, list[tuple[str, int]]]:
"""Use RAG to answer a question about FastAPI."""
# Initialize codebase. Smart about caching.
- codebase = Codebase.from_repo("codegen-sh/codegen-sdk", language="python", tmp_dir="/root")
+ codebase = Codebase.from_repo("codegen-sh/graph-sitter", language="python", tmp_dir="/root")
# Initialize vector index
index = VectorIndex(codebase)
diff --git a/codegen-examples/examples/symbol-attributions/run.py b/codegen-examples/examples/symbol-attributions/run.py
index 56e905ee4..34321ef91 100644
--- a/codegen-examples/examples/symbol-attributions/run.py
+++ b/codegen-examples/examples/symbol-attributions/run.py
@@ -70,7 +70,7 @@ def print_symbol_attribution(codebase):
# Use from_repo method for a well-known repository
print("Using a sample repository...")
codebase = Codebase.from_repo(
- repo_full_name="codegen-sh/codegen",
+ repo_full_name="codegen-sh/graph-sitter",
# commit="", # Using a specific commit for consistency
language="python",
)
diff --git a/docs/_deprecated/graph-sitter/about.mdx b/docs/_deprecated/graph-sitter/about.mdx
deleted file mode 100644
index d7ffe80a1..000000000
--- a/docs/_deprecated/graph-sitter/about.mdx
+++ /dev/null
@@ -1,72 +0,0 @@
----
-title: "Codegen, Inc."
-sidebarTitle: "About Us"
-icon: "building"
-iconType: "solid"
----
-
-
-
-## Our Mission
-
-Our mission is to build fully-autonomous software engineering - the equivalent of self-driving cars for code.
-
-We believe the highest leverage path to autonomous development is enabling AI agents to "act via code."
-
-Just as self-driving cars need sophisticated sensors and controls to navigate the physical world, AI agents need powerful, precise tools to manipulate codebases. We're building that foundational layer: a programmatic interface that lets AI agents express complex code transformations through code itself.
-
-This approach creates a shared language that both humans and AI can use to:
-
-- Express powerful changes with precision and predictability
-- Build sophisticated tools from primitive operations
-- Create and maintain their own abstractions
-- Scale transformations across massive codebases
-
-## The Team
-
-Based in San Francisco, we're a team of engineers and researchers passionate about:
-
-- Making large-scale code changes more accessible
-- Building tools that work the way developers think
-- Creating the infrastructure for AI-powered code manipulation
-- Advancing the state of the art in program transformation
-
-## Open Source
-
-We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/codegen-sdk), is freely available and open to contributions from the community.
-
-## Join Us
-
-
-
- We're hiring! Join us in building the future of code transformation.
-
-
- Connect with other developers and share your Codegen experiences.
-
-
-
-## Connect with Us
-
-
-
- Follow us for updates and announcements
-
-
- Connect with our team and stay updated on company news
-
-
-
-
- Want to learn more about what we're building? Check out our [getting started
- guide](/introduction/getting-started) or join our [community
- Slack](https://community.codegen.com).
-
diff --git a/docs/_deprecated/graph-sitter/advanced-settings.mdx b/docs/_deprecated/graph-sitter/advanced-settings.mdx
deleted file mode 100644
index 0a6e86c91..000000000
--- a/docs/_deprecated/graph-sitter/advanced-settings.mdx
+++ /dev/null
@@ -1,404 +0,0 @@
----
-title: "Advanced Settings"
-sidebarTitle: "Advanced Settings"
-icon: "memory"
-iconType: "solid"
----
-
-Codegen's [Codebase](/api-reference/core/Codebase) constructor accepts a `CodebaseConfig` object which is used to configure more advanced behaviors of the graph construction process.
-
-These flags are helpful for debugging problematic repos, optimizing Codegen's performance, or testing unreleased or experimental (potentially backwards-breaking) features.
-
-
-**These are considered experimental features and may change in the future!**
-
-As such, they may have little to no testing or documentation. Many of these flags may also be unsupported in the future!
-
-If you need help, please visit our [community](/introduction/community).
-
-
-
-These configuration options are defined in [src/codegen/configs/models/codebase.py](https://github.com/codegen-sh/codegen/blob/develop/src/codegen/configs/models/codebase.py).
-
-
-# Usage
-
-You can customize the behavior of the graph construction process when initializing a [Codebase](/api-reference/core/Codebase) by passing a `CodebaseConfig` object with the desired configuration flags.
-
-```python
-from graph_sitter import Codebase
-from codegen.configs import CodebaseConfig
-
-# Initialize a Codebase with custom configuration
-codebase = Codebase(
- "",
- config=CodebaseConfig(
- flag1=...,
- flag2=...,
- ...
- )
-)
-```
-
-# Table of Contents
-
-- [debug](#flag-debug)
-- [verify-graph](#flag-verify-graph)
-- [track-graph](#flag-track-graph)
-- [method-usages](#flag-method-usages)
-- [sync-enabled](#flag-sync-enabled)
-- [full-range-index](#flag-full-range-index)
-- [ignore-process-errors](#flag-ignore-process-errors)
-- [disable-graph](#flag-disable-graph)
-- [disable-file-parse](#flag-disable-file-parse)
-- [exp-lazy-graph](#flag-exp-lazy-graph)
-- [generics](#flag-generics)
-- [import-resolution-paths](#flag-import-resolution-paths)
-- [import-resolution-overrides](#flag-import-resolution-overrides)
-- [py-resolve-syspath](#flag-py-resolve-syspath)
-- [ts-dependency-manager](#flag-ts-dependency-manager)
-- [ts-language-engine](#flag-ts-language-engine)
-- [v8-ts-engine](#flag-v8-ts-engine)
-- [unpacking-assignment-partial-removal](#flag-unpacking-assignment-partial-removal)
-
-# Configuration Flags
-
-## Flag: `debug`
-> **Default: `False`**
-
-Enables verbose logging for debugging purposes. In its current form, it enables:
-- Verbose logging when adding nodes to the graph
-- Verbose logging during initial file parsing
-- Additional assertions on graph creation
-- Additional (costly) debug metrics on codebase construction
-- etc.
-
-
-This flag may be very noisy and significantly impact performance. It is generally not recommended to use.
-
-
-## Flag: `verify_graph`
-> **Default: `False`**
-
-Adds assertions for graph state during reset resync. Used to test and debug graph desyncs after a codebase reset.
-
-Runs `post_reset_validation` after a reset resync.
-
-
-This is an internal debug flag.
-
-
-## Flag: `track_graph`
-> **Default: `False`**
-
-Keeps a copy of the original graph before a resync. Used in conjunction with `verify_graph` to test and debug graph desyncs.
-
-Original graph is saved as `ctx.old_graph`.
-
-
-This is an internal debug flag.
-
-
-## Flag: `method_usages`
-> **Default: `True`**
-
-Enables and disables resolving method usages.
-
-**Example Codebase:**
-```python
-class Foo:
- def bar():
- ...
-
-obj = Foo()
-obj.bar() # Method Usage
-```
-
-**Codemod with `method_usages` on:**
-```python
-bar_func = codebase.get_class("Foo").get_method("bar")
-len(bar_func.usages) # 1
-bar_func.usages # [obj.bar()]
-```
-
-**Codemod with `method_usages` off:**
-```python
-bar_func = codebase.get_class("Foo").get_method("bar")
-len(bar_func.usages) # 0
-bar_func.usages # []
-```
-
-Method usage resolution could be disabled for a marginal performance boost. However, it is generally recommended to leave it enabled.
-
-## Flag: `sync_enabled`
-> **Default: `False`**
-
-Enables or disables graph sync during `codebase.commit`.
-
-
-Implementation-specific details on sync graph can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/6.%20incremental-computation/C.%20Graph%20Recomputation.md).
-
-
-This section won't go into the specific details of sync graph, but the general idea is that enabling sync graph will update the Codebase object to whatever new changes were made.
-
-**Example with `sync_enabled` on:**
-```python
-file = codebase.get_file(...)
-file.insert_after("foobar = 1")
-codebase.commit()
-
-foobar = codebase.get_symbol("foobar")
-assert foobar # foobar is available after commit / graph sync
-```
-
-**Example with `sync_enabled` disabled:**
-```python
-file = codebase.get_file(...)
-file.insert_after("foobar = 1")
-
-foobar = codebase.get_symbol("foobar", optional=True)
-assert not foobar # foobar is not available after commit
-```
-
-
-Enabling sync graph will have a performance impact on codebase commit, but will also unlock a bunch of operations that were previously not possible.
-
-
-## Flag: `full_range_index`
-> **Default: `False`**
-
-By default, Codebase maintains an internal range-to-node index for fast lookups. (i.e. `bytes 120 to 130 maps to node X`).
-For optimization purposes, this only applies to nodes defined and handled by `parser.py`.
-
-Enabling `full_range_index` will create an additional index that maps **all** tree-sitter ranges to nodes.
-This can be useful for debugging or when you need to build any applications that require a full range-to-node index (i.e. a codebase tree lookup).
-
-
-This flag **significantly** increases memory usage!
-
-
-## Flag: `ignore_process_errors`
-> **Default: `True`**
-
-Controls whether to ignore errors that occur during external process execution (such as dependency manager or language engine).
-
-Disabling `ignore_process_errors` would make Codegen fail on errors that would otherwise be logged then ignored.
-
-## Flag: `disable_graph`
-> **Default: `False`**
-
-Disables the graph construction process. Any operations that require the graph will no longer work. (In other words, this turns off import resolution and usage/dependency resolution)
-
-Functions that operate purely on AST such as getting and editing parameters or modifying function and class definitions will still work.
-
-
-For codemods that do not require the graph (aka only AST/Syntax-level changes), **disabling graph parse could yield a 30%-40% decrease in parse time and memory usage**!
-
-
-## Flag: `disable_file_parse`
-> **Default: `False`**
-
-Disables **ALL** parsing, including file and graph parsing. This essentially treats all codebases as the "UNSUPPORTED" language mode.
-
-Nearly all functions except for editing primitives like `codebase.get_file` and `file.edit` will no longer work.
-
-
-This flag is useful for any usages of Codegen that do **NOT** require any AST/CST/Graph parsing. (i.e. using Codegen purely as a file editing harness)
-
-If this is your use case, this **could decrease parse and memory usage by 95%.**
-
-
-## Flag: `exp_lazy_graph`
-> **Default: `False`**
-
-This experimental flag pushes the graph creation back until the graph is needed. This is an experimental feature and may have some unintended consequences.
-
-**Example Codemod:**
-```python
-from graph_sitter import Codebase
-from codegen.configs import CodebaseConfig
-
-# Enable lazy graph parsing
-codebase = Codebase("", config=CodebaseConfig(exp_lazy_graph=True))
-
-# The codebase object will be created immediately with no parsing done
-# These all do not require graph parsing
-codebase.files
-codebase.directories
-codebase.get_file("...")
-
-# These do require graph parsing, and will create the graph only if called
-codebase.get_function("...")
-codebase.get_class("...")
-codebase.imports
-```
-
-
-This may have a very slight performance boost. Use at your own risk!
-
-
-## Flag: `generics`
-> **Default: `True`**
-
-Enables and disables generic type resolution.
-
-**Example Codebase:**
-```python
-class Point:
- def scale(cls, n: int):
- pass
-
-class List[T]():
- def pop(self) -> T:
- ...
-
-l: List[Point] = []
-l.pop().scale(1) # Generic Usage
-```
-
-**Codemod with `generics` on:**
-```python
-bar_func = codebase.get_class("Point").get_method("scale")
-len(bar_func.usages) # 1
-bar_func.usages # [l.pop().scale(1)]
-```
-
-**Codemod with `generics` off:**
-```python
-bar_func = codebase.get_class("Point").get_method("scale")
-len(bar_func.usages) # 0
-bar_func.usages # []
-```
-
-
-Generic resolution is still largely WIP and experimental, and may not work in all cases. In some rare circumstances, disabling generics may result in a significant performance boost.
-
-
-## Flag: `import_resolution_paths`
-> **Default: `[]`**
-
-Controls alternative paths to resolve imports from.
-
-**Example Codebase:**
-```python
-# a/b/c/src.py
-def update():
- pass
-
-# consumer.py
-from c import src as operations
-
-operations.update()
-```
-
-**Codemod:**
-```python
-codebase.ctx.config.import_resolution_paths = ["a/b"]
-```
-
-## Flag: `import_resolution_overrides`
-> **Default: `{}`**
-
-Controls import path overrides during import resolution.
-
-**Example**
-`from a.b.c import d` with the override `a/b` -> `foo/bar` will internally resolve the import as `from foo.bar.c import d`.
-
-## Flag: `py_resolve_syspath`
-> **Default: `False`**
-
-Enables and disables resolution of imports from `sys.path`.
-
-
-For this to properly work, you must also set `allow_external` to `True`.
-
-
-## Flag: `allow_external`
-> **Default: `False`**
-
-Enables resolving imports, files, modules, and directories from outside of the repo path.
-
-
-Turning this flag off may allow for bad actors to access files outside of the repo path! Use with caution!
-
-
-## Flag: `ts_dependency_manager`
-> **Default: `False`**
-
-
-**This is an internal flag used for Codegen Cloud and should not be used externally!**
-
-This flag **WILL** nuke any existing `node_modules` folder!
-
-
-
-This flag also assumes many constants for Codegen Cloud. Very likely this will not work if run locally.
-
-Instead, just install `node_modules` as normal (either through `npm`, `pnpm`, or `yarn`) and skip this setting!
-
-
-Enables Codegen's internal dependency installer for TypeScript. This will modify `package.json` and install the bare minimum set of installable dependencies.
-
-
-More documentation on TypeScript dependency manager can be found [here](https://github.com/codegen-sh/codegen/blob/develop/architecture/external/dependency-manager.md)
-
-
-## Flag: `ts_language_engine`
-> **Default: `False`**
-
-
-This feature was built primarily with Codegen Cloud in mind. As such, this assumes a valid NodeJS and TypeScript environment.
-
-
-Enables using the TypeScript compiler to extract information from the codebase. Enables commands such as `inferred_return_type`.
-
-
-This will increase memory usage and parsing time. Larger repos may even hit resource constraints with the bundled TypeScript compiler integration.
-
-
-## Flag: `v8_ts_engine`
-> **Default: `False`**
-
-
-This feature flag requires `ts_language_engine` to be enabled as well.
-
-
-Enables using the **V8-based TypeScript compiler** to extract information from the codebase. Enables commands such as `inferred_return_type`.
-
-The V8 implementation (as opposed to the default external-process based implementation) is less stable, but provides the entire TypeScript API to be used from within Codegen.
-
-
-This will increase memory usage and parsing time. Larger repos may even hit resource constraints with the V8-based TypeScript compiler integration.
-
-
-## Flag: `unpacking_assignment_partial_removal`
-> **Default: `False`**
-
-Enables smarter removal of unpacking assignments.
-
-**Example Codebase:**
-```python
-a, b, c = (1, 2, 3)
-```
-
-**Codemod with `unpacking_assignment_partial_removal` on:**
-```python
-file = codebase.get_file(...)
-b = file.get_symbol("b")
-b.remove()
-codebase.commit()
-
-file.symbols # [a, c]
-file.source # "a, c = (1, 3)"
-```
-
-**Codemod with `unpacking_assignment_partial_removal` off:**
-```python
-file = codebase.get_file(...)
-b = file.get_symbol("b")
-b.remove()
-codebase.commit()
-
-file.symbols # []
-file.source # ""
-```
diff --git a/docs/_deprecated/graph-sitter/community.mdx b/docs/_deprecated/graph-sitter/community.mdx
deleted file mode 100644
index ed02a4276..000000000
--- a/docs/_deprecated/graph-sitter/community.mdx
+++ /dev/null
@@ -1,48 +0,0 @@
----
-title: "Community & Contributing"
-sidebarTitle: "Community"
-icon: "people-group"
-iconType: "solid"
----
-
-import {
- COMMUNITY_SLACK_URL,
- CODEGEN_SDK_GITHUB_URL,
-} from "/snippets/links.mdx";
-
-Join the growing Codegen community! We're excited to have you be part of our journey to make codebase manipulation and transformation more accessible.
-
-
-
- Connect with the community, get help, and share your Codegen projects in our
- active Slack workspace.
-
-
- Star us on GitHub, report issues, submit PRs, and contribute to the project.
-
-
- Follow us for updates, tips, and community highlights.
-
-
- Learn how to use Codegen effectively with our comprehensive guides.
-
-
-
-
- Please help us improve this library and documentation by submitting a PR!
-
-
-## Contributing
-
-We welcome contributions of all kinds! Whether you're fixing a typo in documentation, reporting a bug, or implementing a new feature, we appreciate your help in making Codegen better.
-
-Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blob/develop/CONTRIBUTING.md) on GitHub to learn how to:
-
-- Set up your development environment
-- Submit pull requests
-- Report issues
-- Contribute to documentation
diff --git a/docs/_deprecated/graph-sitter/faq.mdx b/docs/_deprecated/graph-sitter/faq.mdx
deleted file mode 100644
index d7f3abfba..000000000
--- a/docs/_deprecated/graph-sitter/faq.mdx
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: "Frequently Asked Questions"
-sidebarTitle: "FAQ"
-icon: "square-question"
-iconType: "solid"
----
-
-
-
- Codegen currently parses two languages:
- - [Python](/api-reference/python)
- - [TypeScript](/api-reference/typescript)
-
- We're actively working on expanding language support based on community needs.
-
- Learn more about how Codegen handles language specifics in the [Language
- Support](/building-with-codegen/language-support) guide.
-
-
- Interested in adding support for your language? [Let us know](https://x.com/codegen) or [contribute](/introduction/community)!
-
-
-
-
- Pretty much! Codegen is roughly on par with `mypy` and `tsc`. There are always edge cases in static analysis that are provably impossible to get (for example doing `eval()` on a string), but all of Codegen's APIs are intended to be exact unless otherwise specified. Please reach out if you find an edge case and we will do our best to patch it.
-
-
- Yes! Codegen was developed on multmillion-line Python and Typescript codebases
- and includes optimizations for handling large-scale transformations.
-
- For enterprise support, please reach out to [team@codegen.com](mailto:team@codegen.com)
-
-
-
- Yes - [by design](/introduction/guiding-principles#python-first-composability).
-
- Codegen works like any other python package. It works alongside your IDE, version control system, and other development tools.
-
-
- Start by trying out Codegen, joining our [Slack community](https://community.codegen.com), and looking for
- issues labeled "good first issue" on [GitHub](https://github.com/codegen-sh/codegen-sdk). We welcome contributions to
- documentation, examples, and code improvements.
-
-
- Yes, Codegen is [open source](https://github.com/codegen-sh/codegen-sdk) and free to use under the [Apache 2.0
- license](https://github.com/codegen-sh/codegen-sdk?tab=Apache-2.0-1-ov-file).
- You can use it for both personal and commercial projects.
-
-
- The best places to get help are:
- 1. Our community [Slack channel](https://community.codegen.com)
- 2. [GitHub issues](https://github.com/codegen-sh/codegen-sdk) for bug reports
- 3. Reach out to us on [Twitter](https://x.com/codegen)
-
-
diff --git a/docs/_deprecated/graph-sitter/guiding-principles.mdx b/docs/_deprecated/graph-sitter/guiding-principles.mdx
deleted file mode 100644
index 53201e5c1..000000000
--- a/docs/_deprecated/graph-sitter/guiding-principles.mdx
+++ /dev/null
@@ -1,75 +0,0 @@
----
-title: "Guiding Principles"
-sidebarTitle: "Principles"
-icon: "compass"
-iconType: "solid"
----
-
-Codegen was developed by working backwards from real-world, large-scale codebase migrations. Instead of starting with abstract syntax trees and parser theory, we started with the question: "How do developers actually think about code changes?"
-
-This practical origin led to four core principles that shape Codegen's design:
-
-## Intuitive APIs
-
-Write code that reads like natural language, without worrying about abstract syntax trees or parser internals. Codegen provides high-level APIs that map directly to the transformations developers want to perform:
-
-```python
-# Methods that read like English
-function.rename("new_name") # Not ast.update_node(function_node, "name", "new_name")
-function.move_to_file("new_file.py") # Not ast.relocate_node(function_node, "new_file.py")
-
-# Clean, readable properties
-if function.is_async: # Not ast.get_node_attribute(function_node, "async")
- print(function.name) # Not ast.get_node_name(function_node)
-
-# Natural iteration patterns
-for usage in function.usages: # Not ast.find_references(function_node)
- print(f"Used in {usage.file.name}")
-```
-
-## No Sharp Edges
-
-Focus on your high-level intent while Codegen handles the intricate details.
-
-Codegen operations handle the edge cases - it should be hard to break lint.
-
-```python
-# Moving a function? Codegen handles:
-function.move_to_file("new_file.py")
-# ā Updating all import statements
-# ā Preserving dependencies
-# ā Maintaining references
-# ā Fixing relative imports
-# ā Resolving naming conflicts
-
-# Renaming a symbol? Codegen manages:
-class_def.rename("NewName")
-# ā Updating all usages
-# ā Handling string references
-# ā Preserving docstrings
-# ā Maintaining inheritance
-```
-
-## Performance through Pre-Computation
-
-Codegen frontloads as much as possible to enable fast, efficient transformations.
-
-It is built with the insight that each codebase only needs to be parsed once per commit.
-
-
- Learn more about parsing the codebase graph in the [How it
- Works](/introduction/how-it-works) guide.
-
-
-## Python-First Composability
-
-Codegen embraces Python's strength as a "glue language" - its ability to seamlessly integrate different tools and APIs. This makes it natural to compose Codegen with your existing toolchain:
-
-- Build complex transforms by combining simpler operations
-- Integrate Codegen with your existing tools (linters, type checkers, test frameworks, AI tools)
-
-
- Python's rich ecosystem makes it ideal for code manipulation tasks. Codegen is
- designed to be one tool in your toolbox, not a replacement for your entire
- workflow.
-
diff --git a/docs/_deprecated/graph-sitter/how-it-works.mdx b/docs/_deprecated/graph-sitter/how-it-works.mdx
deleted file mode 100644
index d891a9c08..000000000
--- a/docs/_deprecated/graph-sitter/how-it-works.mdx
+++ /dev/null
@@ -1,89 +0,0 @@
----
-title: "Under the Hood"
-sidebarTitle: "How it Works"
-icon: "gear"
-iconType: "solid"
-subtitle: "How Codegen's codebase graph works"
----
-
-Codegen performs advanced static analysis to build a rich graph representation of your codebase. This pre-computation step analyzes dependencies, references, types, and control flow to enable fast and reliable code manipulation operations.
-
-
- Codegen is built on top of
- [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) and
- [rustworkx](https://github.com/Qiskit/rustworkx) and has implemented most
- language server features from scratch.
-
-
- Codegen is open source. Check out the [source
- code](https://github.com/codegen-sh/codegen-sdk) to learn more!
-
-
-## The Codebase Graph
-
-At the heart of Codegen is a comprehensive graph representation of your code. When you initialize a [Codebase](/api-reference/core/Codebase), it performs static analysis to construct a rich graph structure connecting code elements:
-
-```python
-# Initialize and analyze the codebase
-from graph_sitter import Codebase
-codebase = Codebase("./")
-
-# Access pre-computed relationships
-function = codebase.get_symbol("process_data")
-print(f"Dependencies: {function.dependencies}") # Instant lookup
-print(f"Usages: {function.usages}") # No parsing needed
-```
-
-### Building the Graph
-
-Codegen's graph construction happens in two stages:
-
-1. **AST Parsing**: We use [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) as our foundation for parsing code into Abstract Syntax Trees. Tree-sitter provides fast, reliable parsing across multiple languages.
-
-2. **Multi-file Graph Construction**: Custom parsing logic, implemented in [rustworkx](https://github.com/Qiskit/rustworkx) and Python, analyzes these ASTs to construct a more sophisticated graph structure. This graph captures relationships between [symbols](/building-with-codegen/symbol-api), [files](/building-with-codegen/files-and-directories), [imports](/building-with-codegen/imports), and more.
-
-### Performance Through Pre-computation
-
-Pre-computing a rich index enables Codegen to make certain operations very fast that that are relevant to refactors and code analysis:
-
-- Finding all usages of a symbol
-- Detecting circular dependencies
-- Analyzing the dependency graphs
-- Tracing call graphs
-- Static analysis-based code retrieval for RAG
-- ...etc.
-
-
- Pre-parsing the codebase enables constant-time lookups rather than requiring
- re-parsing or real-time analysis.
-
-
-## Multi-Language Support
-
-One of Codegen's core principles is that many programming tasks are fundamentally similar across languages.
-
-Currently, Codegen supports:
-
-- [Python](/api-reference/python)
-- [TypeScript](/api-reference/typescript)
-- [React & JSX](/building-with-codegen/react-and-jsx)
-
-
- Learn about how Codegen handles language specifics in the [Language
- Support](/building-with-codegen/language-support) guide.
-
-
-We've started with these ecosystems but designed our architecture to be extensible. The graph-based approach provides a consistent interface across languages while handling language-specific details under the hood.
-
-## Build with Us
-
-Codegen is just getting started, and we're excited about the possibilities ahead. We enthusiastically welcome contributions from the community, whether it's:
-
-- Adding support for new languages
-- Implementing new analysis capabilities
-- Improving performance
-- Expanding the API
-- Adding new transformations
-- Improving documentation
-
-Check out our [community guide](/introduction/community) to get involved!
diff --git a/docs/_deprecated/graph-sitter/ide-usage.mdx b/docs/_deprecated/graph-sitter/ide-usage.mdx
deleted file mode 100644
index b1356c21f..000000000
--- a/docs/_deprecated/graph-sitter/ide-usage.mdx
+++ /dev/null
@@ -1,178 +0,0 @@
----
-title: "Using Codegen in Your IDE"
-sidebarTitle: "IDE Usage"
-icon: "window"
-iconType: "solid"
----
-
-Get up and running with Codegen programs in IDEs like VSCode, Cursor and PyCharm.
-
-Make sure to [install and initialize](/introduction/installation) Codegen with `codegen init`
-
-## Configuring your IDE Interpreter
-
-Codegen creates a custom Python environment in `.codegen/.venv`. Configure your IDE to use this environment for the best development experience.
-
-
-
- 1. Install the VSCode Python Extensions for LSP and debugging support. We recommend Python, Pylance and Python Debugger for the best experience.
-
- 2. Open the Command Palette (Cmd/Ctrl + Shift + P)
- 3. Type "Python: Select Interpreter"
-
- 4. Choose "Enter interpreter path"
- 5. Navigate to and select:
- ```bash
- .codegen/.venv/bin/python
- ```
-
- Alternatively, create a `.vscode/settings.json`:
- ```json
- {
- "python.defaultInterpreterPath": "${workspaceFolder}/.codegen/.venv/bin/python",
- "python.analysis.extraPaths": [
- "${workspaceFolder}/.codegen/.venv/lib/python3.12/site-packages"
- ]
- }
- ```
-
-
-
- 1. Open PyCharm Settings/Preferences
- 2. Navigate to "Project > Python Interpreter"
- 3. Click the gear icon āļø and select "Add"
- 4. Choose "Existing Environment"
- 5. Set interpreter path to:
- ```bash
- .codegen/.venv/bin/python
- ```
-
-
-
-
-
-## MCP Server Setup
-This is an optional step but highly recommended if your IDE supports MCP support and you use AI Agents.
-The MCP server is a local server that allows your AI Agent to interact with the Codegen specific tools,
-it will allow an agent to:
-- ask an expert to create a codemod
-- improve a codemod
-- get setup instructions
-
-### IDE Configuration
-#### Cline
-Add this to your cline_mcp_settings.json:
-```json
-{
- "mcpServers": {
- "graph_sitter.cli": {
- "command": "uv",
- "args": [
- "--directory",
- "/codegen-sdk/src/graph_sitter.cli/mcp",
- "run",
- "server.py"
- ]
- }
- }
-}
-```
-
-
-#### Cursor:
-Under the `Settings` > `Feature` > `MCP Servers` section, click "Add New MCP Server" and add the following:
-
-```
-Name: codegen-mcp
-Type: Command
-Command: uv --directory /codegen-sdk/src/graph_sitter.cli/mcp run server.py
-```
-
-
-## Index Codegen Docs
-#### Cursor:
-If you use Cursor you'll be able to configure the IDE to index the Codegen docs. To do so go to `Settings` > `Features` > `Docs`
-and then click on `Add new docs`. We recommend using this url to index the API reference:
-```
-https://docs.codegen.com/api-reference/index
-```
-
-
-## Create a New Codemod
-
-Generate the boilerplate for a new code manipulation program using [codegen create](/cli/create):
-
-```bash
-codegen create organize-types \
- -d "Move all TypeScript types to \
- into a centralized types.ts file"
-```
-
-
- Passing in `-d --description` will get an LLM expert to compose an initial version for you. This requires a Github account registered on [codegen.sh](https://codegen.sh)
-
-
-This will:
-1. Create a new codemod in `.codegen/codemods/organize_types/`
-2. Generate a custom `system-prompt.txt` based on your task
-3. Set up the basic structure for your program
-
-
-The generated codemod includes type hints and docstrings, making it easy to get IDE autocompletion and documentation.
-
-
-## Iterating with Chat Assistants
-
-When you do `codegen init`, you will receive a [system prompt optimized for AI consumption](/introduction/work-with-ai) at `.codegen/codegen-system-prompt.txt`.
-
-If you reference this file in "chat" sessions with Copilot, Cursor, Cody, etc., the assistant will become fluent in Codegen.
-
-
-
- Collaborating with Cursor's assistant and the Codegen system prompt
-
-
-In addition, when you [create](/cli/create) a codemod with "-d", Codegen generates an optimized system prompt in `.codegen/codemods/{name}/{name}-system-prompt.txt`. This prompt contains:
-- Relevant Codegen API documentation
-- Examples of relevant transformations
-- Context about your specific task
-
-
-You can also drag and drop the system prompt ([available here](/introduction/work-with-ai))file directly into chat windows like ChatGPT or Claude for standalone help.
-
-
-## Running and Testing Codemods
-
-```bash
-# Run => write changes to disk
-codegen run organize-types
-
-# Reset changes on disk
-codegen reset
-```
-
-You can also run the program directly via `.codegen/.venv/bin/python path/to/codemod.py` or via your editor's debugger
-
-## Viewing Changes
-
-We recommend viewing changes in your IDE's native diff editor.
-
-
-## What's Next
-
-
-
- See real-world examples of codemods in action.
-
-
- Learn about Codegen's core concepts and features
-
-
diff --git a/docs/_deprecated/graph-sitter/overview.mdx b/docs/_deprecated/graph-sitter/overview.mdx
deleted file mode 100644
index 4a0011d6c..000000000
--- a/docs/_deprecated/graph-sitter/overview.mdx
+++ /dev/null
@@ -1,159 +0,0 @@
----
-title: "Codegen"
-sidebarTitle: "Overview"
-icon: "code"
-iconType: "solid"
----
-
-[Codegen](https://github.com/codegen-sh/codegen-sdk) is a python library for manipulating codebases.
-
-It provides a scriptable interface to a powerful, multi-lingual language server built on top of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/).
-
-```python
-from graph_sitter import Codebase
-
-# Codegen builds a complete graph connecting
-# functions, classes, imports and their relationships
-codebase = Codebase("./")
-
-# Work with code without dealing with syntax trees or parsing
-for function in codebase.functions:
- # Comprehensive static analysis for references, dependencies, etc.
- if not function.usages:
- # Auto-handles references and imports to maintain correctness
- function.remove()
-
-# Fast, in-memory code index
-codebase.commit()
-```
-
-
-
-Codegen handles complex refactors while maintaining correctness, enabling a broad set of advanced code manipulation programs.
-
-
-Codegen works with both Python and Typescript/JSX codebases. Learn more about language support [here](/building-with-codegen/language-support).
-
-## Quick Started
-
-
-Codegen requires Python 3.12 - 3.13 (recommended: Python 3.13+).
-
-
-### Using UV (Recommended)
-```bash
-uv tool install codegen --python 3.13
-```
-
-### Using Pipx
-
-
-Pipx is not officially supported by Codegen, but it should still work.
-
-
-```bash
-pipx install codegen
-```
-
-
-For further & more in depth installation instructions, see the [installation guide](/introduction/installation).
-
-
-## What can I do with Codegen?
-
-Codegen's simple yet powerful APIs enable a range of applications, including:
-
-
-
- Create an intelligent agent that can analyze and manipulate your codebase using natural language.
-
-
- Generate interactive visualizations of your codebase's structure, dependencies, and relationships.
-
-
- Create high-quality training data for fine-tuning LLMs on your codebase.
-
-
- Create powerful code transformations to automate large-scale changes.
-
-
-
-See below for an example call graph visualization generated with Codegen.
-
-
-
-
-
-View source code on [modal/modal-client](https://github.com/modal-labs/modal-client/blob/cbac0d80dfd98588027ecd21850152776be3ab82/modal/client.py#L70). View codemod on [codegen.sh](https://www.codegen.sh/codemod/66e2e195-ceec-4935-876a-ed4cfc1731c7/public/diff)
-
-
-## Get Started
-
-import {
- COMMUNITY_SLACK_URL,
- CODEGEN_SDK_GITHUB_URL,
-} from "/snippets/links.mdx";
-
-
-
- Follow our step-by-step tutorial to start manipulating code with Codegen.
-
-
- Learn how to use Codegen for common code transformation tasks.
-
-
- Star us on GitHub and contribute to the project.
-
-
- Get help and connect with the Codegen community.
-
-
-
-## Why Codegen?
-
-Many software engineering tasks - refactors, enforcing patterns, analyzing control flow, etc. - are fundamentally programmatic operations. Yet the tools we use to express these transformations often feel disconnected from how we think about code.
-
-Codegen was engineered backwards from real-world refactors we performed for enterprises at [Codegen, Inc.](/introduction/about). Instead of starting with theoretical abstractions, we built the set of APIs that map directly to how humans and AI think about code changes:
-
-- **Natural Mental Model**: Express transformations through high-level operations that match how you reason about code changes, not low-level text or AST manipulation.
-- **Clean Business Logic**: Let the engine handle the complexities of imports, references, and cross-file dependencies.
-- **Scale with Confidence**: Make sweeping changes across large codebases consistently across Python, TypeScript, JavaScript, and React.
-
-As AI becomes increasingly sophisticated, we're seeing a fascinating shift: AI agents aren't bottlenecked by their ability to understand code or generate solutions. Instead, they're limited by their ability to efficiently manipulate codebases. The challenge isn't the "brain" - it's the "hands."
-
-We built Codegen with a key insight: future AI agents will need to ["act via code,"](/blog/act-via-code) building their own sophisticated tools for code manipulation. Rather than generating diffs or making direct text changes, these agents will:
-
-1. Express transformations as composable programs
-2. Build higher-level tools by combining primitive operations
-3. Create and maintain their own abstractions for common patterns
-
-This creates a shared language that both humans and AI can reason about effectively, making code changes more predictable, reviewable, and maintainable. Whether you're a developer writing a complex refactoring script or an AI agent building transformation tools, Codegen provides the foundation for expressing code changes as they should be: through code itself.
diff --git a/docs/_deprecated/tutorials/slack-bot.mdx b/docs/_deprecated/tutorials/slack-bot.mdx
deleted file mode 100644
index 9a7b0030e..000000000
--- a/docs/_deprecated/tutorials/slack-bot.mdx
+++ /dev/null
@@ -1,217 +0,0 @@
----
-title: "Building a RAG-powered Slack Bot"
-sidebarTitle: "Slack Bot"
-icon: "slack"
-iconType: "solid"
----
-
-This tutorial demonstrates how to build a Slack bot that can answer code questions using simple RAG (Retrieval Augmented Generation) over a codebase. The bot uses semantic search to find relevant code snippets and generates detailed answers using OpenAI's APIs.
-
-View the full code and setup instructions in our [examples repository](https://github.com/codegen-sh/codegen-sdk/tree/develop/codegen-examples/examples/slack_chatbot)
-
-While this example uses the Codegen codebase, you can adapt it to any repository by changing the repository URL
-
-## Overview
-
-The process involves three main steps:
-
-1. Initializing and indexing the codebase
-2. Finding relevant code snippets for a query
-3. Generating answers using RAG
-
-Let's walk through each step using Codegen.
-
-## Step 1: Initializing the Codebase
-
-First, we initialize the codebase and create a vector index for semantic search:
-
-```python
-from graph_sitter import Codebase
-from graph_sitter.extensions import VectorIndex
-
-def initialize_codebase():
- """Initialize and index the codebase."""
- # Initialize codebase with smart caching
- codebase = Codebase.from_repo(
- "codegen-sh/codegen-sdk",
- language="python",
- tmp_dir="/root"
- )
-
- # Initialize vector index
- index = VectorIndex(codebase)
-
- # Try to load existing index or create new one
- index_path = "/root/E.pkl"
- try:
- index.load(index_path)
- except FileNotFoundError:
- # Create new index if none exists
- index.create()
- index.save(index_path)
-
- return codebase, index
-```
-
-
-The vector index is persisted to disk, so subsequent queries will be much faster.
-See [semantic code search](/building-with-codegen/semantic-code-search) to learn more about VectorIndex.
-
-
-## Step 2: Finding Relevant Code
-
-Next, we use the vector index to find code snippets relevant to a query:
-
-```python
-def find_relevant_code(index: VectorIndex, query: str) -> list[tuple[str, float]]:
- """Find code snippets relevant to the query."""
- # Get top 10 most relevant files
- results = index.similarity_search(query, k=10)
-
- # Clean up chunk references from index
- cleaned_results = []
- for filepath, score in results:
- if "#chunk" in filepath:
- filepath = filepath.split("#chunk")[0]
- cleaned_results.append((filepath, score))
-
- return cleaned_results
-```
-
-
-VectorIndex automatically chunks large files for better search results. We clean up the chunk references to show clean file paths.
-
-
-## Step 3: Generating Answers
-
-Finally, we use GPT-4 to generate answers based on the relevant code:
-
-```python
-from openai import OpenAI
-
-def generate_answer(query: str, context: str) -> str:
- """Generate an answer using RAG."""
- prompt = f"""You are a code expert. Given the following code context and question,
-provide a clear and accurate answer.
-
-Note: Keep it short and sweet - 2 paragraphs max.
-
-Question: {query}
-
-Relevant code:
-{context}
-
-Answer:"""
-
- client = OpenAI()
- response = client.chat.completions.create(
- model="gpt-4o",
- messages=[
- {"role": "system", "content": "You are a code expert. Answer questions about the given repo based on RAG'd results."},
- {"role": "user", "content": prompt},
- ],
- temperature=0,
- )
-
- return response.choices[0].message.content
-```
-
-## Putting It All Together
-
-Here's how the components work together to answer questions:
-
-```python
-def answer_question(query: str) -> tuple[str, list[tuple[str, float]]]:
- """Answer a question about the codebase using RAG."""
- # Initialize or load codebase and index
- codebase, index = initialize_codebase()
-
- # Find relevant files
- results = find_relevant_code(index, query)
-
- # Collect context from relevant files
- context = ""
- for filepath, score in results:
- file = codebase.get_file(filepath)
- context += f"File: {filepath}\n```\n{file.content}\n```\n\n"
-
- # Generate answer
- answer = generate_answer(query, context)
-
- return answer, results
-```
-
-This will:
-1. Load or create the vector index
-2. Find relevant code snippets
-3. Generate a detailed answer
-4. Return both the answer and file references
-
-## Example Usage
-
-Here's what the output looks like:
-
-```python
-answer, files = answer_question("How does VectorIndex handle large files?")
-
-print("Answer:", answer)
-print("\nRelevant files:")
-for filepath, score in files:
- print(f"⢠{filepath} (score: {score:.2f})")
-```
-
-Output:
-```
-Answer:
-VectorIndex handles large files by automatically chunking them into smaller pieces
-using tiktoken. Each chunk is embedded separately and can be searched independently,
-allowing for more precise semantic search results.
-
-Relevant files:
-⢠src/graph_sitter.extensions/vector_index.py (score: 0.92)
-⢠src/graph_sitter.extensions/tools/semantic_search.py (score: 0.85)
-```
-
-## Extensions
-
-While this example demonstrates a simple RAG-based bot, you can extend it to build a more powerful code agent that can:
-- Do more sophisticated code retrieval
-- Make code changes using Codegen's edit APIs
-- Gather further context from Slack channels
-- ... etc.
-
-Check out our [Code Agent tutorial](/tutorials/build-code-agent) to learn how to build an intelligent agent with access to Codegen's full suite of tools
-
-
-## Learn More
-
-
-
- Learn how to use VectorIndex for semantic code search and embeddings.
-
-
- Create a more powerful agent with multi-step reasoning and code manipulation.
-
-
- Learn about OpenAI's text embeddings and how they work.
-
-
- Understand RAG patterns and best practices for better results.
-
-
diff --git a/docs/_deprecated/api-reference/core/Argument.mdx b/docs/api-reference/core/Argument.mdx
similarity index 86%
rename from docs/_deprecated/api-reference/core/Argument.mdx
rename to docs/api-reference/core/Argument.mdx
index 81e631e90..83aab527d 100644
--- a/docs/_deprecated/api-reference/core/Argument.mdx
+++ b/docs/api-reference/core/Argument.mdx
@@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx';
import {GithubLinkNote} from '/snippets/GithubLinkNote.mdx';
import {Attribute} from '/snippets/Attribute.mdx';
-
+
### Inherits from
[HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName), [Editable](/api-reference/core/Editable)
@@ -95,7 +95,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### add_keyword
Converts an unnamed argument to a named argument by adding a keyword.
-
+
ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -120,7 +120,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ Argument ]> } description=""/>
@@ -209,7 +209,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_name
Returns the name node of the object.
-
+
Name | ChainedAttribute | None> } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/>
@@ -217,7 +217,7 @@ Returns the name node of the object.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -330,7 +330,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -338,7 +338,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -346,7 +346,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -354,7 +354,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -362,7 +362,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
rename
Sets the name of an object and updates all its usages.
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_name
Sets the name of a code element.
-
+
set_value
Sets the value of the node's value Expression.
-
+
+
### Inherits from
[HasValue](/api-reference/core/HasValue), [Typeable](/api-reference/core/Typeable), [Symbol](/api-reference/core/Symbol), [Usable](/api-reference/core/Usable), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName)
@@ -115,7 +115,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### add_comment
Adds a comment to the symbol.
-
+
add_keyword
Insert a keyword in the appropriate place before this symbol if it doesn't already exist.
-
+
ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -157,7 +157,7 @@ Find all ancestors of the node of the given type. Does not return itself
### dependencies
Returns a list of symbols that this symbol depends on.
-
+
edit
Replace the source of this node with new_src.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ Assignment ]> } description=""/>
@@ -269,7 +269,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_name
Returns the name node of the object.
-
+
Name | ChainedAttribute | None> } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/>
@@ -277,7 +277,7 @@ Returns the name node of the object.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before the current symbol node in the Abstract Syntax Tree.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -396,7 +396,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -404,7 +404,7 @@ Check if this node is contained another node of the given class
### local_usages
Retrieves all usages of the assigned variable within its code block scope.
-
+
list[ Editable [ Statement ]]> } description="A sorted list of statement nodes where the variable is used."/>
@@ -412,7 +412,7 @@ Retrieves all usages of the assigned variable within its code block scope.
### move_to_file
Moves the given symbol to a new file and updates its imports and references.
-
+
parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -449,7 +449,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -457,7 +457,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Simplifies an assignment expression by reducing it based on a boolean condition and updating all the usages.
-
+
remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
rename
Renames a symbol and updates all its references in the codebase.
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_comment
Sets a comment to the symbol.
-
+
set_inline_comment
Sets an inline comment to the symbol.
-
+
set_name
Sets the name of a code element.
-
+
set_type_annotation
Adds or updates a type annotation for the current assignment.
-
+
set_value
Sets the value of an assignment expression.
-
+
symbol_usages
Returns a list of symbols that use or import the exportable object.
-
+
usages
Returns a list of usages of the exportable object.
-
+
+
### Inherits from
[HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable)
@@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -107,7 +107,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ AssignmentStatement ]> } description=""/>
@@ -196,7 +196,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -309,7 +309,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -317,7 +317,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -325,7 +325,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -333,7 +333,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -341,7 +341,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_value
Sets the value of the node's value Expression.
-
+
+
### Inherits from
[Usable](/api-reference/core/Usable), [AssignmentStatement](/api-reference/core/AssignmentStatement), [Editable](/api-reference/core/Editable), [Importable](/api-reference/core/Importable), [HasValue](/api-reference/core/HasValue), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [HasName](/api-reference/core/HasName)
@@ -119,7 +119,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -127,7 +127,7 @@ Find all ancestors of the node of the given type. Does not return itself
### dependencies
Returns a list of symbols that this symbol depends on.
-
+
edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ Attribute ]> } description=""/>
@@ -239,7 +239,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_name
Returns the name node of the object.
-
+
Name | ChainedAttribute | None> } description="The name node of the object. Can be a Name node for simple names, a ChainedAttribute for names with namespaces (e.g., a.b), or None if the object has no name."/>
@@ -247,7 +247,7 @@ Returns the name node of the object.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -360,7 +360,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -368,7 +368,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -376,7 +376,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -384,7 +384,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -392,7 +392,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
rename
Renames a symbol and updates all its references in the codebase.
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_name
Sets the name of a code element.
-
+
set_value
Sets the value of a node's assignment.
-
+
symbol_usages
Returns a list of symbols that use or import the exportable object.
-
+
usages
Returns a list of usages of the exportable object.
-
+
+
### Inherits from
[HasValue](/api-reference/core/HasValue), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable)
@@ -75,7 +75,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -83,7 +83,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ AwaitExpression ]> } description=""/>
@@ -172,7 +172,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -285,7 +285,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -293,7 +293,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -301,7 +301,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -309,7 +309,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -317,7 +317,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
resolve
Resolves the wrapper expression and returns the first concrete expression.
-
+
Expression> } description=""/>
@@ -395,7 +395,7 @@ Resolves the wrapper expression and returns the first concrete expression.
### search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_value
Sets the value of the node's value Expression.
-
+
+
### Inherits from
[Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable)
@@ -87,7 +87,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -95,7 +95,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ BinaryExpression ]> } description=""/>
@@ -184,7 +184,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -297,7 +297,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -305,7 +305,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -313,7 +313,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -321,7 +321,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Simplifies a binary expression by reducing it based on a boolean condition.
-
+
remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
+
### Inherits from
[HasBlock](/api-reference/core/HasBlock), [Statement](/api-reference/core/Statement), [Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable)
@@ -99,7 +99,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### add_decorator
Adds a decorator to a function or method.
-
+
ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -130,7 +130,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ BlockStatement ]> } description=""/>
@@ -219,7 +219,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -332,7 +332,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -340,7 +340,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -348,7 +348,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -356,7 +356,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -364,7 +364,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+
search
Returns a list of all regex match of `regex_pattern`, similar to python's re.search().
-
+
set_docstring
Sets or updates the docstring for the current entity.
-
+
+
### Inherits from
[Expression](/api-reference/core/Expression), [Editable](/api-reference/core/Editable)
@@ -71,7 +71,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
### ancestors
Find all ancestors of the node of the given type. Does not return itself
-
+
list[ Editable ]> } description=""/>
@@ -79,7 +79,7 @@ Find all ancestors of the node of the given type. Does not return itself
### edit
Replace the source of this `Editable` with `new_src`.
-
+
find
Find and return matching nodes or substrings within an Editable instance.
-
+
find_string_literals
Returns a list of string literals within this node's source that match any of the given
-
+
flag
Adds a visual flag comment to the end of this Editable's source text.
-
+
CodeFlag[ Boolean ]> } description=""/>
@@ -168,7 +168,7 @@ Adds a visual flag comment to the end of this Editable's source text.
### get_variable_usages
Returns Editables for all TreeSitter nodes corresponding to instances of variable usage
-
+
insert_after
Inserts code after this node.
-
+
insert_before
Inserts text before this node's source with optional indentation and newline handling.
-
+
is_child_of
Checks if this node is a descendant of the given editable instance in the AST.
-
+
bool } description=""/>
@@ -281,7 +281,7 @@ Checks if this node is a descendant of the given editable instance in the AST.
### is_wrapped_in
Check if this node is contained another node of the given class
-
+
bool } description=""/>
@@ -289,7 +289,7 @@ Check if this node is contained another node of the given class
### parent_of_type
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -297,7 +297,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### parent_of_types
Find the first ancestor of the node of the given type. Does not return itself
-
+
Editable | None> } description=""/>
@@ -305,7 +305,7 @@ Find the first ancestor of the node of the given type. Does not return itself
### reduce_condition
Reduces an editable to the following condition
-
+
None } description=""/>
@@ -313,7 +313,7 @@ Reduces an editable to the following condition
### remove
Deletes this Node and its related extended nodes (e.g. decorators, comments).
-
+
replace
Search and replace occurrences of text within this node's source and its extended nodes.
-
+