@@ -11,7 +11,7 @@ import {HorizontalDivider} from '/snippets/HorizontalDivider.mdx';
11
11
import {GithubLinkNote } from ' /snippets/GithubLinkNote.mdx' ;
12
12
import {Attribute } from ' /snippets/Attribute.mdx' ;
13
13
14
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L117-L1549 " />
14
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L117-L1568 " />
15
15
16
16
17
17
## Attributes
@@ -89,7 +89,7 @@ import {Attribute} from '/snippets/Attribute.mdx';
89
89
<HorizontalDivider />
90
90
### <span className = " text-primary" >ai</span >
91
91
Generates a response from the AI based on the provided prompt, target, and context.
92
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1180-L1267 " />
92
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1199-L1286 " />
93
93
94
94
<ParameterWrapper >
95
95
<Parameter
@@ -124,7 +124,7 @@ Generates a response from the AI based on the provided prompt, target, and conte
124
124
125
125
### <span className = " text-primary" >checkout</span >
126
126
Checks out a git branch or commit and syncs the codebase graph to the new state.
127
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L853-L893 " />
127
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L872-L912 " />
128
128
129
129
<ParameterWrapper >
130
130
<Parameter
@@ -159,7 +159,7 @@ Checks out a git branch or commit and syncs the codebase graph to the new state.
159
159
160
160
### <span className = " text-primary" >commit</span >
161
161
Commits all staged changes to the codebase graph and synchronizes the graph with the filesystem if specified.
162
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L791-L803 " />
162
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L810-L822 " />
163
163
164
164
<ParameterWrapper >
165
165
<Parameter
@@ -176,7 +176,7 @@ Commits all staged changes to the codebase graph and synchronizes the graph with
176
176
177
177
### <span className = " text-primary" >create_directory</span >
178
178
Creates a directory at the specified path.
179
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L512-L528 " />
179
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L518-L534 " />
180
180
181
181
<ParameterWrapper >
182
182
<Parameter
@@ -205,7 +205,7 @@ Creates a directory at the specified path.
205
205
206
206
### <span className = " text-primary" >create_file</span >
207
207
Creates a new file in the codebase with specified content.
208
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L477-L510 " />
208
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L483-L516 " />
209
209
210
210
<ParameterWrapper >
211
211
<Parameter
@@ -234,7 +234,7 @@ Creates a new file in the codebase with specified content.
234
234
235
235
### <span className = " text-primary" >create_pr</span >
236
236
Creates a pull request from the current branch to the repository's default branch.
237
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L958-L990 " />
237
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L977-L1009 " />
238
238
239
239
<ParameterWrapper >
240
240
<Parameter
@@ -257,31 +257,31 @@ Creates a pull request from the current branch to the repository's default branc
257
257
258
258
### <span className = " text-primary" >create_pr_comment</span >
259
259
Create a comment on a pull request
260
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1521-L1523 " />
260
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1540-L1542 " />
261
261
262
262
263
263
<Return return_type = { <code className = " text-sm bg-gray-100 px-2 py-0.5 rounded" >None</code > } description = " " />
264
264
265
265
266
266
### <span className = " text-primary" >create_pr_review_comment</span >
267
267
Create a review comment on a pull request.
268
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1525-L1549 " />
268
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1544-L1568 " />
269
269
270
270
271
271
<Return return_type = { <code className = " text-sm bg-gray-100 px-2 py-0.5 rounded" >None</code > } description = " " />
272
272
273
273
274
274
### <span className = " text-primary" >files</span >
275
275
A list property that returns all files in the codebase.
276
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L289-L323 " />
276
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L293-L329 " />
277
277
278
278
279
279
<Return return_type = { <><span >list[</span > <a href = " /api-reference/core/SourceFile" style = { {fontWeight: " inherit" , fontSize: " inherit" } } >SourceFile</a > <span >] | list[</span > <a href = " /api-reference/core/File" style = { {fontWeight: " inherit" , fontSize: " inherit" } } >File</a > <span >]</span ></> } description = " A sorted list of source files in the codebase." />
280
280
281
281
282
282
### <span className = " text-primary" >find_by_span</span >
283
283
Finds editable objects that overlap with the given source code span.
284
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1277-L1292 " />
284
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1296-L1311 " />
285
285
286
286
<ParameterWrapper >
287
287
<Parameter
@@ -298,15 +298,15 @@ Finds editable objects that overlap with the given source code span.
298
298
299
299
### <span className = " text-primary" >from_files</span >
300
300
Creates a Codebase instance from multiple files.
301
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1431-L1511 " />
301
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1450-L1530 " />
302
302
303
303
304
304
<Return return_type = { <><a href = " /api-reference/core/Codebase" style = { {fontWeight: " inherit" , fontSize: " inherit" } } >Codebase</a ></> } description = " A Codebase instance initialized with the provided files" />
305
305
306
306
307
307
### <span className = " text-primary" >from_repo</span >
308
308
Fetches a codebase from GitHub and returns a Codebase instance.
309
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1315-L1382 " />
309
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1334-L1401 " />
310
310
311
311
<ParameterWrapper >
312
312
<Parameter
@@ -359,15 +359,15 @@ Fetches a codebase from GitHub and returns a Codebase instance.
359
359
360
360
### <span className = " text-primary" >from_string</span >
361
361
Creates a Codebase instance from a string of code.
362
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1385-L1428 " />
362
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1404-L1447 " />
363
363
364
364
365
365
<Return return_type = { <><a href = " /api-reference/core/Codebase" style = { {fontWeight: " inherit" , fontSize: " inherit" } } >Codebase</a ></> } description = " A Codebase instance initialized with the provided code Example: >>> # Python code >>> code = " def add(a, b): return a + b" >>> codebase = Codebase.from_string(code, language=" python" ) >>> # TypeScript code >>> code = " function add(a: number, b: number): number { return a + b; }" >>> codebase = Codebase.from_string(code, language=" typescript" )" />
366
366
367
367
368
368
### <span className = " text-primary" >get_class</span >
369
369
Returns a class that matches the given name.
370
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L675-L697 " />
370
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L694-L716 " />
371
371
372
372
<ParameterWrapper >
373
373
<Parameter
@@ -390,7 +390,7 @@ Returns a class that matches the given name.
390
390
391
391
### <span className = " text-primary" >get_directory</span >
392
392
Returns Directory by ` dir_path ` , or full path to the directory from codebase root.
393
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L597-L617 " />
393
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L616-L636 " />
394
394
395
395
<ParameterWrapper >
396
396
<Parameter
@@ -413,7 +413,7 @@ Returns Directory by `dir_path`, or full path to the directory from codebase roo
413
413
414
414
### <span className = " text-primary" >get_file</span >
415
415
Retrieves a file from the codebase by its filepath.
416
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L546-L582 " />
416
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L558-L601 " />
417
417
418
418
<ParameterWrapper >
419
419
<Parameter
@@ -442,7 +442,7 @@ Retrieves a file from the codebase by its filepath.
442
442
443
443
### <span className = " text-primary" >get_function</span >
444
444
Retrieves a function from the codebase by its name.
445
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L699-L726 " />
445
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L718-L745 " />
446
446
447
447
<ParameterWrapper >
448
448
<Parameter
@@ -465,15 +465,15 @@ Retrieves a function from the codebase by its name.
465
465
466
466
### <span className = " text-primary" >get_modified_symbols_in_pr</span >
467
467
Get all modified symbols in a pull request
468
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1513-L1519 " />
468
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1532-L1538 " />
469
469
470
470
471
471
<Return return_type = { <code className = " text-sm bg-gray-100 px-2 py-0.5 rounded" >tuple[str, dict[str, str], list[str]]</code > } description = " " />
472
472
473
473
474
474
### <span className = " text-primary" >get_relative_path</span >
475
475
Calculates a relative path from one file to another, removing the extension from the target file.
476
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L736-L767 " />
476
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L755-L786 " />
477
477
478
478
<ParameterWrapper >
479
479
<Parameter
@@ -496,7 +496,7 @@ Calculates a relative path from one file to another, removing the extension from
496
496
497
497
### <span className = " text-primary" >get_symbol</span >
498
498
Returns a Symbol by name from the codebase.
499
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L632-L657 " />
499
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L651-L676 " />
500
500
501
501
<ParameterWrapper >
502
502
<Parameter
@@ -519,7 +519,7 @@ Returns a Symbol by name from the codebase.
519
519
520
520
### <span className = " text-primary" >get_symbols</span >
521
521
Retrieves all symbols in the codebase that match the given symbol name.
522
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L659-L673 " />
522
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L678-L692 " />
523
523
524
524
<ParameterWrapper >
525
525
<Parameter
@@ -536,7 +536,7 @@ Retrieves all symbols in the codebase that match the given symbol name.
536
536
537
537
### <span className = " text-primary" >git_commit</span >
538
538
Stages + commits all changes to the codebase and git.
539
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L773-L789 " />
539
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L792-L808 " />
540
540
541
541
<ParameterWrapper >
542
542
<Parameter
@@ -559,7 +559,7 @@ Stages + commits all changes to the codebase and git.
559
559
560
560
### <span className = " text-primary" >has_directory</span >
561
561
Returns a boolean indicating if a directory exists in the codebase.
562
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L584-L595 " />
562
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L603-L614 " />
563
563
564
564
<ParameterWrapper >
565
565
<Parameter
@@ -576,7 +576,7 @@ Returns a boolean indicating if a directory exists in the codebase.
576
576
577
577
### <span className = " text-primary" >has_file</span >
578
578
Determines if a file exists in the codebase.
579
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L530-L540 " />
579
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L536-L552 " />
580
580
581
581
<ParameterWrapper >
582
582
<Parameter
@@ -599,7 +599,7 @@ Determines if a file exists in the codebase.
599
599
600
600
### <span className = " text-primary" >has_symbol</span >
601
601
Returns whether a symbol exists in the codebase.
602
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L619-L630 " />
602
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L638-L649 " />
603
603
604
604
<ParameterWrapper >
605
605
<Parameter
@@ -616,23 +616,23 @@ Returns whether a symbol exists in the codebase.
616
616
617
617
### <span className = " text-primary" >reset</span >
618
618
Resets the codebase by
619
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L834-L851 " />
619
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L853-L870 " />
620
620
621
621
622
622
<Return return_type = { <code className = " text-sm bg-gray-100 px-2 py-0.5 rounded" >None</code > } description = " " />
623
623
624
624
625
625
### <span className = " text-primary" >set_ai_key</span >
626
626
Sets the OpenAI key for the current Codebase instance.
627
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1269-L1275 " />
627
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1288-L1294 " />
628
628
629
629
630
630
<Return return_type = { <code className = " text-sm bg-gray-100 px-2 py-0.5 rounded" >None</code > } description = " " />
631
631
632
632
633
633
### <span className = " text-primary" >set_session_options</span >
634
634
Sets the session options for the current codebase.
635
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1294-L1312 " />
635
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1313-L1331 " />
636
636
637
637
<ParameterWrapper >
638
638
<Parameter
@@ -661,7 +661,7 @@ Sets the session options for the current codebase.
661
661
662
662
### <span className = " text-primary" >should_fix</span >
663
663
Returns True if the flag should be fixed based on the current mode and active group.
664
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1044-L1058 " />
664
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1063-L1077 " />
665
665
666
666
<ParameterWrapper >
667
667
<Parameter
@@ -678,7 +678,7 @@ Returns True if the flag should be fixed based on the current mode and active gr
678
678
679
679
### <span className = " text-primary" >visualize</span >
680
680
Visualizes a NetworkX graph or Plotly figure.
681
- <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L996-L1009 " />
681
+ <GithubLinkNote link = " https://github.com/codegen-sh/codegen/blob/develop/src/codegen/sdk/core/codebase.py#L1015-L1028 " />
682
682
683
683
<ParameterWrapper >
684
684
<Parameter
0 commit comments