Skip to content

PatchWork System Architecture Diagram #1569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
197 changes: 197 additions & 0 deletions diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
graph TD;
A[patchwork/steps/README.md] --> B;
B[patchwork/steps/__init__.py] --> C;
C --> D[patchwork/steps/ExtractCodeMethodForCommentContexts/typed.py];
C --> E[patchwork/steps/ExtractCodeMethodForCommentContexts/README.md];
C --> F[patchwork/steps/ExtractCodeMethodForCommentContexts/ExtractCodeMethodForCommentContexts.py];
C --> G[patchwork/steps/ExtractCodeMethodForCommentContexts/__init__.py];
C --> H[patchwork/steps/PreparePrompt/typed.py];
C --> I[patchwork/steps/PreparePrompt/README.md];
C --> J[patchwork/steps/PreparePrompt/__init__.py];
C --> K[patchwork/steps/PreparePrompt/PreparePrompt.py];
C --> L[patchwork/steps/ExtractCodeContexts/typed.py];
C --> M[patchwork/steps/ExtractCodeContexts/README.md];
C --> N[patchwork/steps/ExtractCodeContexts/ExtractCodeContexts.py];
C --> O[patchwork/steps/ExtractCodeContexts/__init__.py];
C --> P[patchwork/steps/ReadPRs/typed.py];
C --> Q[patchwork/steps/ReadPRs/README.md];
C --> R[patchwork/steps/ReadPRs/__init__.py];
C --> S[patchwork/steps/ReadPRs/ReadPRs.py];
C --> T[patchwork/steps/SlackMessage/typed.py];
C --> U[patchwork/steps/SlackMessage/README.md];
C --> V[patchwork/steps/SlackMessage/__init__.py];
C --> W[patchwork/steps/SlackMessage/SlackMessage.py];
C --> X[patchwork/steps/CallAPI/typed.py];
C --> Y[patchwork/steps/CallAPI/README.md];
C --> Z[patchwork/steps/CallAPI/__init__.py];
C --> AA[patchwork/steps/CallAPI/CallAPI.py];
C --> AB[patchwork/steps/SendEmail/SendEmail.py];
C --> AC[patchwork/steps/SendEmail/typed.py];
C --> AD[patchwork/steps/SendEmail/README.md];
C --> AE[patchwork/steps/SendEmail/__init__.py];
C --> AF[patchwork/steps/CallLLM/typed.py];
C --> AG[patchwork/steps/CallLLM/README.md];
C --> AH[patchwork/steps/CallLLM/CallLLM.py];
C --> AI[patchwork/steps/CallLLM/__init__.py];
C --> AJ[patchwork/steps/ReadFile/typed.py];
C --> AK[patchwork/steps/ReadFile/README.md];
C --> AL[patchwork/steps/ReadFile/__init__.py];
C --> AM[patchwork/steps/ReadFile/ReadFile.py];
C --> AN[patchwork/steps/AgenticLLM/typed.py];
C --> AO[patchwork/steps/AgenticLLM/README.md];
C --> AP[patchwork/steps/AgenticLLM/__init__.py];
C --> AQ[patchwork/steps/AgenticLLM/AgenticLLM.py];
C --> AR[patchwork/steps/LLM/typed.py];
C --> AS[patchwork/steps/LLM/README.md];
C --> AT[patchwork/steps/LLM/__init__.py];
C --> AU[patchwork/steps/LLM/LLM.py];
C --> AV[patchwork/steps/ScanSemgrep/typed.py];
C --> AW[patchwork/steps/ScanSemgrep/README.md];
C --> AX[patchwork/steps/ScanSemgrep/ScanSemgrep.py];
C --> AY[patchwork/steps/ScanSemgrep/__init__.py];
C --> AZ[patchwork/steps/Combine/typed.py];
C --> BA[patchwork/steps/Combine/README.md];
C --> BB[patchwork/steps/Combine/__init__.py];
C --> BC[patchwork/steps/Combine/Combine.py];
C --> BD[patchwork/steps/ReadIssues/typed.py];
C --> BE[patchwork/steps/ReadIssues/README.md];
C --> BF[patchwork/steps/ReadIssues/ReadIssues.py];
C --> BG[patchwork/steps/ReadIssues/__init__.py];
C --> BH[patchwork/steps/FixIssue/typed.py];
C --> BI[patchwork/steps/FixIssue/README.md];
C --> BJ[patchwork/steps/FixIssue/__init__.py];
C --> BK[patchwork/steps/FixIssue/FixIssue.py];
C --> BL[patchwork/steps/FilterBySimilarity/typed.py];
C --> BM[patchwork/steps/FilterBySimilarity/README.md];
C --> BN[patchwork/steps/FilterBySimilarity/FilterBySimilarity.py];
C --> BO[patchwork/steps/FilterBySimilarity/__init__.py];
C --> BP[patchwork/steps/ExtractCode/typed.py];
C --> BQ[patchwork/steps/ExtractCode/README.md];
C --> BR[patchwork/steps/ExtractCode/ExtractCode.py];
C --> BS[patchwork/steps/ExtractCode/__init__.py];
C --> BT[patchwork/steps/AnalyzeImpact/typed.py];
C --> BU[patchwork/steps/AnalyzeImpact/README.md];
C --> BV[patchwork/steps/AnalyzeImpact/AnalyzeImpact.py];
C --> BW[patchwork/steps/AnalyzeImpact/__init__.py];
C --> BX[patchwork/steps/ExtractModelResponse/typed.py];
C --> BY[patchwork/steps/ExtractModelResponse/README.md];
C --> BZ[patchwork/steps/ExtractModelResponse/ExtractModelResponse.py];
C --> CA[patchwork/steps/ExtractModelResponse/__init__.py];
C --> CB[patchwork/steps/CreateIssue/CreateIssue.py];
C --> CC[patchwork/steps/CreateIssue/typed.py];
C --> CD[patchwork/steps/CreateIssue/README.md];
C --> CE[patchwork/steps/CreateIssue/__init__.py];
C --> CF[patchwork/steps/ScanSonar/ScanSonar.py];
C --> CG[patchwork/steps/ScanSonar/typed.py];
C --> CH[patchwork/steps/ScanSonar/README.md];
C --> CI[patchwork/steps/ScanSonar/__init__.py];
C --> CJ[patchwork/steps/PR/PR.py];
C --> CK[patchwork/steps/PR/typed.py];
C --> CL[patchwork/steps/PR/README.md];
C --> CM[patchwork/steps/PR/__init__.py];
C --> CN[patchwork/steps/CallSQL/typed.py];
C --> CO[patchwork/steps/CallSQL/README.md];
C --> CP[patchwork/steps/CallSQL/__init__.py];
C --> CQ[patchwork/steps/CallSQL/CallSQL.py];
C --> CR[patchwork/steps/ModifyCodeOnce/typed.py];
C --> CS[patchwork/steps/ModifyCodeOnce/README.md];
C --> CT[patchwork/steps/ModifyCodeOnce/__init__.py];
C --> CU[patchwork/steps/ModifyCodeOnce/ModifyCodeOnce.py];
C --> CV[patchwork/steps/GetTypescriptTypeInfo/pnpm-lock.yaml];
C --> CW[patchwork/steps/GetTypescriptTypeInfo/typed.py];
C --> CX[patchwork/steps/GetTypescriptTypeInfo/README.md];
C --> CY[patchwork/steps/GetTypescriptTypeInfo/tsconfig.json];
C --> CZ[patchwork/steps/GetTypescriptTypeInfo/package.json];
C --> DA[patchwork/steps/GetTypescriptTypeInfo/get_type_info.ts];
C --> DB[patchwork/steps/GetTypescriptTypeInfo/GetTypescriptTypeInfo.py];
C --> DC[patchwork/steps/GetTypescriptTypeInfo/__init__.py];
C --> DD[patchwork/steps/FileAgent/typed.py];
C --> DE[patchwork/steps/FileAgent/FileAgent.py];
C --> DF[patchwork/steps/FileAgent/__init__.py];
C --> DG[patchwork/steps/CreateIssueComment/typed.py];
C --> DH[patchwork/steps/CreateIssueComment/README.md];
C --> DI[patchwork/steps/CreateIssueComment/CreateIssueComment.py];
C --> DJ[patchwork/steps/CreateIssueComment/__init__.py];
C --> DK[patchwork/steps/BrowserUse/typed.py];
C --> DL[patchwork/steps/BrowserUse/README.md];
C --> DM[patchwork/steps/BrowserUse/BrowserUse.py];
C --> DN[patchwork/steps/BrowserUse/__init__.py];
C --> DO[patchwork/steps/CallCode2Prompt/typed.py];
C --> DP[patchwork/steps/CallCode2Prompt/README.md];
C --> DQ[patchwork/steps/CallCode2Prompt/CallCode2Prompt.py];
C --> DR[patchwork/steps/CallCode2Prompt/__init__.py];
C --> DS[patchwork/steps/CallCode2Prompt/TestCallCode2Prompt.py];
C --> DT[patchwork/steps/PreparePR/typed.py];
C --> DU[patchwork/steps/PreparePR/README.md];
C --> DV[patchwork/steps/PreparePR/PreparePR.py];
C --> DW[patchwork/steps/PreparePR/__init__.py];
C --> DX[patchwork/steps/JoinList/typed.py];
C --> DY[patchwork/steps/JoinList/README.md];
C --> DZ[patchwork/steps/JoinList/__init__.py];
C --> EA[patchwork/steps/JoinList/JoinList.py];
C --> EB[patchwork/steps/CreatePR/CreatePR.py];
C --> EC[patchwork/steps/CreatePR/typed.py];
C --> ED[patchwork/steps/CreatePR/README.md];
C --> EE[patchwork/steps/CreatePR/__init__.py];
C --> EF[patchwork/steps/ScanDepscan/typed.py];
C --> EG[patchwork/steps/ScanDepscan/README.md];
C --> EH[patchwork/steps/ScanDepscan/ScanDepscan.py];
C --> EI[patchwork/steps/ScanDepscan/__init__.py];
C --> EJ[patchwork/steps/SimplifiedLLMOnce/typed.py];
C --> EK[patchwork/steps/SimplifiedLLMOnce/README.md];
C --> EL[patchwork/steps/SimplifiedLLMOnce/__init__.py];
C --> EM[patchwork/steps/SimplifiedLLMOnce/SimplifiedLLMOnce.py];
C --> EN[patchwork/steps/ModifyCode/typed.py];
C --> EO[patchwork/steps/ModifyCode/README.md];
C --> EP[patchwork/steps/ModifyCode/ModifyCode.py];
C --> EQ[patchwork/steps/ModifyCode/__init__.py];
C --> ER[patchwork/steps/ManageEngineAgent/typed.py];
C --> ES[patchwork/steps/ManageEngineAgent/__init__.py];
C --> ET[patchwork/steps/ManageEngineAgent/ManageEngineAgent.py];
C --> EU[patchwork/steps/AgenticLLMV2/typed.py];
C --> EV[patchwork/steps/AgenticLLMV2/README.md];
C --> EW[patchwork/steps/AgenticLLMV2/AgenticLLMV2.py];
C --> EX[patchwork/steps/AgenticLLMV2/__init__.py];
C --> EY[patchwork/steps/ExtractDiff/typed.py];
C --> EZ[patchwork/steps/ExtractDiff/README.md];
C --> FA[patchwork/steps/ExtractDiff/ExtractDiff.py];
C --> FB[patchwork/steps/ExtractDiff/__init__.py];
C --> FC[patchwork/steps/ReadEmail/typed.py];
C --> FD[patchwork/steps/ReadEmail/README.md];
C --> FE[patchwork/steps/ReadEmail/ReadEmail.py];
C --> FF[patchwork/steps/ReadEmail/__init__.py];
C --> FG[patchwork/steps/CreatePRComment/typed.py];
C --> FH[patchwork/steps/CreatePRComment/README.md];
C --> FI[patchwork/steps/CreatePRComment/CreatePRComment.py];
C --> FJ[patchwork/steps/CreatePRComment/__init__.py];
C --> FK[patchwork/steps/ReadPRDiffs/typed.py];
C --> FL[patchwork/steps/ReadPRDiffs/README.md];
C --> FM[patchwork/steps/ReadPRDiffs/ReadPRDiffs.py];
C --> FN[patchwork/steps/ReadPRDiffs/__init__.py];
C --> FO[patchwork/steps/SimplifiedLLM/typed.py];
C --> FP[patchwork/steps/SimplifiedLLM/README.md];
C --> FQ[patchwork/steps/SimplifiedLLM/__init__.py];
C --> FR[patchwork/steps/SimplifiedLLM/SimplifiedLLM.py];
C --> FS[patchwork/steps/CallShell/typed.py];
C --> FT[patchwork/steps/CallShell/README.md];
C --> FU[patchwork/steps/CallShell/CallShell.py];
C --> FV[patchwork/steps/CallShell/__init__.py];
C --> FW[patchwork/steps/DatabaseAgent/DatabaseAgent.py];
C --> FX[patchwork/steps/DatabaseAgent/typed.py];
C --> FY[patchwork/steps/DatabaseAgent/__init__.py];
C --> FZ[patchwork/steps/CommitChanges/typed.py];
C --> GA[patchwork/steps/CommitChanges/README.md];
C --> GB[patchwork/steps/CommitChanges/CommitChanges.py];
C --> GC[patchwork/steps/CommitChanges/__init__.py];
C --> GD[patchwork/steps/ZohoDeskAgent/typed.py];
C --> GE[patchwork/steps/ZohoDeskAgent/README.md];
C --> GF[patchwork/steps/ZohoDeskAgent/ZohoDeskAgent.py];
C --> GG[patchwork/steps/ZohoDeskAgent/__init__.py];
C --> GH[patchwork/steps/GitHubAgent/GitHubAgent.py];
C --> GI[patchwork/steps/GitHubAgent/typed.py];
C --> GJ[patchwork/steps/GitHubAgent/__init__.py];
C --> GK[patchwork/steps/ExtractPackageManagerFile/typed.py];
C --> GL[patchwork/steps/ExtractPackageManagerFile/README.md];
C --> GM[patchwork/steps/ExtractPackageManagerFile/TestExtractPackageManagerFile.py];
C --> GN[patchwork/steps/ExtractPackageManagerFile/__init__.py];
C --> GO[patchwork/steps/ExtractPackageManagerFile/ExtractPackageManagerFile.py];
26 changes: 18 additions & 8 deletions patchwork/common/tools/grep_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def json_schema(self) -> dict:
"name": "find_text",
"description": f"""\
Tool to find text in a file or files in a directory using a pattern based on the Unix shell style.
The current working directory is always {self.__working_dir}.
The current working directory is always {self.__working_dir}.
The path provided should either be absolute or relative to the current working directory.

This tool will match each line of the file with the provided pattern and prints the line number and the line content.
Expand All @@ -135,19 +135,26 @@ def json_schema(self) -> dict:
[!seq] matches any char not in seq

Example:
* '*macs' will match the file '.emacs'
* '*.py' will match all files with the '.py' extension
* 'class T*' will match the line 'class Team:' but not ' class Team:' because the second line is indented.
* '*var1: str' will match the line ' var1: str' but not 'var1: str = "test"'
* '*class Team*' will match both the lines 'class Team:' and 'class TeamMember(BaseTeam):'
* 'TeamMember' will not match 'class TeamMember:' because the pattern should match the entire line

""",
"type": "string",
},
"path": {
"description": """\
The path to the file to find text in.
The path to the file to find text in.
If not given, will search all file content in the current working directory.
If the path is a directory, will search all file content in the directory.
""",
"type": "string",
},
"recursive": {
"description": "Set as False to only search specified file or immediate files in the specified directory. Default is True.",
"type": "boolean",
},
"is_case_sensitive": {
"description": "Whether the pattern should be case-sensitive.",
"type": "boolean",
Expand All @@ -162,6 +169,7 @@ def execute(
pattern: Optional[str] = None,
path: Optional[Path] = None,
is_case_sensitive: bool = False,
recursive: bool = True,
) -> str:
if pattern is None:
return "`pattern` argument is required!"
Expand All @@ -176,12 +184,14 @@ def execute(
try:
path = Path(path).resolve()
except FileNotFoundError:
return f"`path` does not exist"
return "`path` does not exist"
if not path.is_relative_to(self.__working_dir):
return f"Path must be relative to working dir {self.__working_dir}"

if path.is_file():
paths = [path]
elif recursive:
paths = list(set(p for p in path.rglob("*") if p.is_file()))
else:
paths = [p for p in path.iterdir() if p.is_file()]

Expand All @@ -200,17 +210,17 @@ def execute(
content = f"Line {i + 1}: {self.__CHAR_LIMIT_TEXT}"

file_matches[str(path)].append(content)
except Exception as e:
except Exception:
pass

total_file_matches = ""
for path_str, matches in file_matches.items():
total_file_matches += f"\nPattern matches found in '{path}':\n" + "\n".join(matches)
total_file_matches += f"\nPattern matches found in '{path_str}':\n" + "\n".join(matches)

if len(total_file_matches) <= 5000:
return total_file_matches

total_file_matches = ""
for path_str, matches in file_matches.items():
total_file_matches += f"\n {len(matches)} Pattern matches found in '{path}': <TRUNCATED>\n"
total_file_matches += f"\n {len(matches)} Pattern matches found in '{path_str}': <TRUNCATED>\n"
return total_file_matches
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.120"
version = "0.0.121"
description = ""
authors = ["patched.codes"]
license = "AGPL"
Expand Down