88
99from codegen import Codebase
1010from codegen .extensions .linear .linear_client import LinearClient
11- from codegen .extensions .tools .linear_tools import (
11+ from codegen .extensions .tools .linear . linear import (
1212 linear_comment_on_issue_tool ,
1313 linear_create_issue_tool ,
1414 linear_get_issue_comments_tool ,
@@ -354,19 +354,24 @@ def _run(self, query: str, k: int = 5, preview_length: int = 200) -> str:
354354 return json .dumps (result , indent = 2 )
355355
356356
357- class CreatePRInput (BaseModel ):
357+ ########################################################################################################################
358+ # GITHUB
359+ ########################################################################################################################
360+
361+
362+ class GithubCreatePRInput (BaseModel ):
358363 """Input for creating a PR"""
359364
360365 title : str = Field (..., description = "The title of the PR" )
361366 body : str = Field (..., description = "The body of the PR" )
362367
363368
364- class CreatePRTool (BaseTool ):
369+ class GithubCreatePRTool (BaseTool ):
365370 """Tool for creating a PR."""
366371
367372 name : ClassVar [str ] = "create_pr"
368373 description : ClassVar [str ] = "Create a PR for the current branch"
369- args_schema : ClassVar [type [BaseModel ]] = CreatePRInput
374+ args_schema : ClassVar [type [BaseModel ]] = GithubCreatePRInput
370375 codebase : Codebase = Field (exclude = True )
371376
372377 def __init__ (self , codebase : Codebase ) -> None :
@@ -377,18 +382,18 @@ def _run(self, title: str, body: str) -> str:
377382 return json .dumps (result , indent = 2 )
378383
379384
380- class GetPRContentsInput (BaseModel ):
385+ class GithubViewPRInput (BaseModel ):
381386 """Input for getting PR contents."""
382387
383388 pr_id : int = Field (..., description = "Number of the PR to get the contents for" )
384389
385390
386- class GetPRcontentsTool (BaseTool ):
391+ class GithubViewPRTool (BaseTool ):
387392 """Tool for getting PR data."""
388393
389- name : ClassVar [str ] = "get_pr_contents "
390- description : ClassVar [str ] = "Get the diff and modified symbols of a PR along with the dependencies of the modified symbols "
391- args_schema : ClassVar [type [BaseModel ]] = GetPRContentsInput
394+ name : ClassVar [str ] = "view_pr "
395+ description : ClassVar [str ] = "View the diff and associated context for a pull request "
396+ args_schema : ClassVar [type [BaseModel ]] = GithubViewPRInput
392397 codebase : Codebase = Field (exclude = True )
393398
394399 def __init__ (self , codebase : Codebase ) -> None :
@@ -399,19 +404,19 @@ def _run(self, pr_id: int) -> str:
399404 return json .dumps (result , indent = 2 )
400405
401406
402- class CreatePRCommentInput (BaseModel ):
407+ class GithubCreatePRCommentInput (BaseModel ):
403408 """Input for creating a PR comment"""
404409
405410 pr_number : int = Field (..., description = "The PR number to comment on" )
406411 body : str = Field (..., description = "The comment text" )
407412
408413
409- class CreatePRCommentTool (BaseTool ):
414+ class GithubCreatePRCommentTool (BaseTool ):
410415 """Tool for creating a general PR comment."""
411416
412417 name : ClassVar [str ] = "create_pr_comment"
413418 description : ClassVar [str ] = "Create a general comment on a pull request"
414- args_schema : ClassVar [type [BaseModel ]] = CreatePRCommentInput
419+ args_schema : ClassVar [type [BaseModel ]] = GithubCreatePRCommentInput
415420 codebase : Codebase = Field (exclude = True )
416421
417422 def __init__ (self , codebase : Codebase ) -> None :
@@ -422,7 +427,7 @@ def _run(self, pr_number: int, body: str) -> str:
422427 return json .dumps (result , indent = 2 )
423428
424429
425- class CreatePRReviewCommentInput (BaseModel ):
430+ class GithubCreatePRReviewCommentInput (BaseModel ):
426431 """Input for creating an inline PR review comment"""
427432
428433 pr_number : int = Field (..., description = "The PR number to comment on" )
@@ -434,12 +439,12 @@ class CreatePRReviewCommentInput(BaseModel):
434439 start_line : int | None = Field (None , description = "For multi-line comments, the starting line" )
435440
436441
437- class CreatePRReviewCommentTool (BaseTool ):
442+ class GithubCreatePRReviewCommentTool (BaseTool ):
438443 """Tool for creating inline PR review comments."""
439444
440445 name : ClassVar [str ] = "create_pr_review_comment"
441446 description : ClassVar [str ] = "Create an inline review comment on a specific line in a pull request"
442- args_schema : ClassVar [type [BaseModel ]] = CreatePRReviewCommentInput
447+ args_schema : ClassVar [type [BaseModel ]] = GithubCreatePRReviewCommentInput
443448 codebase : Codebase = Field (exclude = True )
444449
445450 def __init__ (self , codebase : Codebase ) -> None :
@@ -468,6 +473,11 @@ def _run(
468473 return json .dumps (result , indent = 2 )
469474
470475
476+ ########################################################################################################################
477+ # LINEAR
478+ ########################################################################################################################
479+
480+
471481class LinearGetIssueInput (BaseModel ):
472482 """Input for getting a Linear issue."""
473483
@@ -597,6 +607,11 @@ def _run(self) -> str:
597607 return json .dumps (result , indent = 2 )
598608
599609
610+ ########################################################################################################################
611+ # EXPORT
612+ ########################################################################################################################
613+
614+
600615def get_workspace_tools (codebase : Codebase ) -> list ["BaseTool" ]:
601616 """Get all workspace tools initialized with a codebase.
602617
@@ -609,12 +624,9 @@ def get_workspace_tools(codebase: Codebase) -> list["BaseTool"]:
609624 return [
610625 CommitTool (codebase ),
611626 CreateFileTool (codebase ),
612- CreatePRTool (codebase ),
613- CreatePRCommentTool (codebase ),
614- CreatePRReviewCommentTool (codebase ),
615627 DeleteFileTool (codebase ),
616628 EditFileTool (codebase ),
617- GetPRcontentsTool (codebase ),
629+ GithubViewPRTool (codebase ),
618630 ListDirectoryTool (codebase ),
619631 MoveSymbolTool (codebase ),
620632 RenameFileTool (codebase ),
@@ -623,6 +635,12 @@ def get_workspace_tools(codebase: Codebase) -> list["BaseTool"]:
623635 SemanticEditTool (codebase ),
624636 SemanticSearchTool (codebase ),
625637 ViewFileTool (codebase ),
638+ # Github
639+ GithubCreatePRTool (codebase ),
640+ GithubCreatePRCommentTool (codebase ),
641+ GithubCreatePRReviewCommentTool (codebase ),
642+ GithubViewPRTool (codebase ),
643+ # Linear
626644 LinearGetIssueTool (codebase ),
627645 LinearGetIssueCommentsTool (codebase ),
628646 LinearCommentOnIssueTool (codebase ),
0 commit comments