You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/building-with-codegen/symbol-api.mdx
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ icon: "shapes"
5
5
iconType: "solid"
6
6
---
7
7
8
-
The [`Symbol`](/api-reference/core/Symbol) is the primary way developers interact with code in Codegen. It maps to how developers think about code - as functions, classes, variables, and other named entities.
8
+
The [Symbol](/api-reference/core/Symbol) is the primary way developers interact with code in Codegen. It maps to how developers think about code - as functions, classes, variables, and other named entities.
9
9
10
-
Both the [`Function`](/api-reference/core/Function) and [`Class`](/api-reference/core/Class) symbols are subclasses of the [`Symbol`](/api-reference/core/Symbol) class.
10
+
Both the [Function](/api-reference/core/Function) and [Class](/api-reference/core/Class) symbols are subclasses of the [Symbol](/api-reference/core/Symbol) class.
11
11
12
12
## Accessing Symbols
13
13
14
-
The [`Codebase`](/api-reference/core/Codebase) class provides getters and iterators for functions, classes and symbols:
14
+
The [Codebase](/api-reference/core/Codebase) class provides getters and iterators for functions, classes and symbols:
15
15
16
16
```python
17
17
# Core symbol types
@@ -32,17 +32,17 @@ for symbol in codebase.functions + codebase.classes:
32
32
33
33
All symbols share common APIs for manipulation:
34
34
35
-
- The [`Editable`](/api-reference/core/Editable) API
35
+
- The [Editable](/api-reference/core/Editable) API
Copy file name to clipboardExpand all lines: docs/introduction/community.mdx
-31Lines changed: 0 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,35 +36,6 @@ Join the growing Codegen community! We're excited to have you be part of our jou
36
36
Please help us improve this library and documentation by submitting a PR!
37
37
</Tip>
38
38
39
-
## Community Channels
40
-
41
-
### Slack
42
-
43
-
Our [Slack community](https://community.codegen.com) is where you can:
44
-
45
-
- Get help and support
46
-
- Share your Codegen projects
47
-
- Connect with other developers
48
-
- Stay updated on new features
49
-
50
-
### GitHub
51
-
52
-
Codegen is [open source](https://github.com/codegen-sh/codegen-sdk) and we welcome contributions! On GitHub you can:
53
-
54
-
- Report issues
55
-
- Submit pull requests
56
-
- Star the project
57
-
- Browse the source code
58
-
59
-
### Twitter (X)
60
-
61
-
Follow us on [Twitter/X](https://x.com/codegen) to:
62
-
63
-
- Get the latest updates
64
-
- See community highlights
65
-
- Connect with the team
66
-
- Share your Codegen wins
67
-
68
39
## Contributing
69
40
70
41
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.
@@ -75,5 +46,3 @@ Check out our [Contributing Guide](https://github.com/codegen-sh/codegen-sdk/blo
75
46
- Submit pull requests
76
47
- Report issues
77
48
- Contribute to documentation
78
-
79
-
Together, we can build better tools for code transformation!
Copy file name to clipboardExpand all lines: docs/introduction/how-it-works.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Codegen performs advanced static analysis to build a rich graph representation o
21
21
22
22
## The Codebase Graph
23
23
24
-
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:
24
+
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:
Copy file name to clipboardExpand all lines: docs/introduction/overview.mdx
+15-19Lines changed: 15 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,24 +9,16 @@ iconType: "solid"
9
9
10
10
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/).
file = codebase.files[0] # or .get_file("test.py")
15
-
function = codebase.functions[0] # or .get_symbol("my_func")
16
-
17
-
# print logs
18
-
19
-
print(f'# of files: {len(codebase.files)}')
20
-
print(f'# of functions: {len(codebase.functions)}')
21
-
22
-
# make edits
23
-
24
-
file.edit('🌈' + file.content) # edit contents
25
-
function.rename('new_name') # rename
26
-
function.set_docstring('new docstring') # set docstring
27
-
28
-
# ... etc.
29
-
12
+
exportconst intoSnippet =`# Codegen builds a complete graph connecting
13
+
# functions, classes, imports and their relationships
14
+
from codegen import Codebase
15
+
16
+
# Work with code without dealing with syntax trees or parsing
17
+
for function in codebase.functions:
18
+
# Comprehensive static analysis for references, dependencies, etc.
19
+
if not function.usages:
20
+
# Auto-handles references and imports to maintain correctness
21
+
function.remove()
30
22
`
31
23
32
24
<iframe
@@ -45,7 +37,11 @@ function.set_docstring('new docstring') # set docstring
45
37
## Installation
46
38
47
39
```bash
40
+
# Install CLI
48
41
uv tool install codegen
42
+
43
+
# Install inside existing project
44
+
pip install codegen
49
45
```
50
46
51
47
## Get Started
@@ -86,7 +82,7 @@ Codegen was engineered backwards from real-world refactors we performed for ente
86
82
87
83
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."
88
84
89
-
We built Codegen with a key insight: future AI agents will need to ["act via code,"](https://voyager.minedojo.org/) building their own sophisticated tools for code manipulation. Rather than generating diffs or making direct text changes, these agents will:
85
+
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:
90
86
91
87
1. Express transformations as composable programs
92
88
2. Build higher-level tools by combining primitive operations
0 commit comments