Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
%%{init: {"themeVariables": {"edgeLabelBackground":"#ffffff", "tertiaryColor":"#E0E0E0"}, "theme":"base", "themeCSS": ".label { font-size: 12px; }"}}%%

graph TD
subgraph Patchwork
subgraph Steps
A[__init__.py] --> B(AgenticLLM)
A --> C(AgenticLLMV2)
A --> D(AnalyzeImpact)
A --> E(BrowserUse)
A --> F(CallAPI)
A --> G(CallCode2Prompt)
A --> H(CallLLM)
A --> I(CallShell)
A --> J(CallSQL)
A --> K(Combine)
A --> L(CommitChanges)
A --> M(CreateIssue)
A --> N(CreateIssueComment)
A --> O(CreatePR)
A --> P(CreatePRComment)
A --> Q(DatabaseAgent)
A --> R(ExtractCode)
A --> S(ExtractCodeContexts)
A --> T(ExtractCodeMethodForCommentContexts)
A --> U(ExtractDiff)
A --> V(ExtractModelResponse)
A --> W(ExtractPackageManagerFile)
A --> X(FileAgent)
A --> Y(FilterBySimilarity)
A --> Z(FixIssue)
A --> AA(GetTypescriptTypeInfo)
A --> AB(GitHubAgent)
A --> AC(JoinList)
A --> AD(LLM)
A --> AE(ManageEngineAgent)
A --> AF(ModifyCode)
A --> AG(ModifyCodeOnce)
A --> AH(PreparePR)
A --> AI(PreparePrompt)
A --> AJ(PR)
A --> AK(ReadEmail)
A --> AL(ReadFile)
A --> AM(ReadIssues)
A --> AN(ReadPRDiffs)
A --> AO(ReadPRs)
A --> AP(ScanDepscan)
A --> AQ(ScanSemgrep)
A --> AR(ScanSonar)
A --> AS(SendEmail)
A --> AT(SimplifiedLLM)
A --> AU(SimplifiedLLMOnce)
A --> AV(SlackMessage)
A --> AW(ZohoDeskAgent)
end

subgraph Common
B ==> A
C ==> A
D ==> A
E ==> A
F ==> A
G ==> A
H ==> A
I ==> A
J ==> A
K ==> A
L ==> A
M ==> A
N ==> A
O ==> A
P ==> A
Q ==> A
R ==> A
S ==> A
T ==> A
U ==> A
V ==> A
W ==> A
X ==> A
Y ==> A
Z ==> A
AA ==> A
AB ==> A
AC ==> A
AD ==> A
AE ==> A
AF ==> A
AG ==> A
AH ==> A
AI ==> A
AJ ==> A
AK ==> A
AL ==> A
AM ==> A
AN ==> A
AO ==> A
AP ==> A
AQ ==> A
AR ==> A
AS ==> A
AT ==> A
AU ==> A
AV ==> A
AW ==> A
end
end
44 changes: 44 additions & 0 deletions patchwork/common/tools/git_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from __future__ import annotations

import os
import subprocess

from patchwork.common.tools.tool import Tool


class GitTool(Tool, tool_name="git_tool", abc_register=False):
def __init__(self, path: str):
super().__init__()
self.path = path

@property
def json_schema(self) -> dict:
return {
"name": "git_tool",
"description": """\
Access to the Git CLI, the command is also `git` all args provided are used as is
""",
"input_schema": {
"type": "object",
"properties": {
"args": {
"type": "array",
"items": {"type": "string"},
"description": "The args to run `git` command with.",
}
},
"required": ["args"],
},
}

def execute(self, args: list[str]) -> str:
env = os.environ.copy()
p = subprocess.run(
["gh", *args],
env=env,
cwd=self.path,
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
return p.stdout
2 changes: 1 addition & 1 deletion patchwork/common/tools/github_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from patchwork.common.tools.tool import Tool


class GitHubTool(Tool, tool_name="github_tool"):
class GitHubTool(Tool, tool_name="github_tool", abc_register=False):
def __init__(self, path: str, gh_token: str):
super().__init__()
self.path = path
Expand Down
6 changes: 5 additions & 1 deletion patchwork/steps/GitHubAgent/GitHubAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
AgentConfig,
AgenticStrategyV2,
)
from patchwork.common.tools.git_tool import GitTool
from patchwork.common.tools.github_tool import GitHubTool
from patchwork.common.utils.utils import mustache_render
from patchwork.step import Step
Expand Down Expand Up @@ -34,7 +35,10 @@ def __init__(self, inputs):
AgentConfig(
name="Assistant",
model="gemini-2.0-flash",
tool_set=dict(github_tool=GitHubTool(base_path, inputs["github_api_key"])),
tool_set=dict(
github_tool=GitHubTool(base_path, inputs["github_api_key"]),
git_tool=GitTool(base_path),
),
system_prompt="""\
You are a senior software developer helping the program manager to obtain some data from GitHub.
You can access github through the `gh` CLI app.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "patchwork-cli"
version = "0.0.123"
version = "0.0.124"
description = ""
authors = ["patched.codes"]
license = "AGPL"
Expand Down