-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor changes in Codeanalysis tools, Testing tool added. Support to c…
…hange schema added (#578) Co-authored-by: Viraj <35092918+angrybayblade@users.noreply.github.com>
- Loading branch information
1 parent
55cbba0
commit 386e451
Showing
17 changed files
with
742 additions
and
41 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
""" | ||
Trigger enums. | ||
""" | ||
|
||
from composio.client.enums.base import TRIGGERS_CACHE, TriggerData, _AnnotatedEnum, enum | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"""Tool exceptions.""" | ||
|
||
|
||
from composio.exceptions import ComposioSDKError | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
python/composio/tools/local/shelltool/shell_exec/actions/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Tool for executing shell commands.""" | ||
|
||
import typing as t | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
from composio.tools.base.local import LocalAction | ||
from composio.tools.env.constants import STDERR, STDOUT | ||
from composio.tools.local.shelltool.shell_exec.actions.exec import ShellRequest | ||
|
||
|
||
class TestExecRequest(ShellRequest): | ||
"""Test execution request.""" | ||
|
||
|
||
class TestExecResponse(BaseModel): | ||
"""Shell execution response.""" | ||
|
||
test_response: str = Field( | ||
..., | ||
description="Response from the test command", | ||
) | ||
current_shell_pwd: str = Field( | ||
default="", | ||
description="Current shell's working directory", | ||
) | ||
|
||
|
||
class TestCommand(LocalAction[TestExecRequest, TestExecResponse]): | ||
""" | ||
Run the command for testing the patch. | ||
""" | ||
|
||
_tags = ["workspace", "shell"] | ||
|
||
def execute(self, request: TestExecRequest, metadata: t.Dict) -> TestExecResponse: | ||
"""Execute a shell command.""" | ||
shell = self.shells.get(id=request.shell_id) | ||
project_path = metadata.get("project_path") | ||
command = metadata.get("test_command") | ||
self.logger.debug(f"Executing {command} @ {shell}") | ||
shell.exec(cmd=f"cd {project_path}") | ||
shell.exec(cmd="python -m pip install -e .") | ||
output = shell.exec(cmd=f"{command}") | ||
self.logger.debug(output) | ||
return TestExecResponse( | ||
test_response=output[STDERR], | ||
current_shell_pwd=f"Currently in {shell.exec(cmd='pwd')[STDOUT].strip()}", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.