diff --git a/patchwork/app.py b/patchwork/app.py index 4149959a6..ba54fd4c5 100644 --- a/patchwork/app.py +++ b/patchwork/app.py @@ -59,6 +59,9 @@ def list_option_callback(ctx: click.Context, param: click.Parameter, value: str def find_patchflow(possible_module_paths: Iterable[str], patchflow: str) -> Any | None: + # Define a whitelist of allowed module paths + allowed_modules = {'allowed_module1', 'allowed_module2', 'allowed_module3'} + for module_path in possible_module_paths: try: spec = importlib.util.spec_from_file_location("custom_module", module_path) @@ -72,9 +75,12 @@ def find_patchflow(possible_module_paths: Iterable[str], patchflow: str) -> Any logger.debug(f"Patchflow {patchflow} not found as a file/directory in {module_path}") try: - module = importlib.import_module(module_path) - logger.info(f"Patchflow {patchflow} loaded from {module_path}") - return getattr(module, patchflow) + if module_path in allowed_modules: + module = importlib.import_module(module_path) + logger.info(f"Patchflow {patchflow} loaded from {module_path}") + return getattr(module, patchflow) + else: + logger.debug(f"Module {module_path} is not in the whitelist.") except ModuleNotFoundError: logger.debug(f"Patchflow {patchflow} not found as a module in {module_path}") except AttributeError: diff --git a/patchwork/common/tools/bash_tool.py b/patchwork/common/tools/bash_tool.py index 8440f179a..2ca5e7333 100644 --- a/patchwork/common/tools/bash_tool.py +++ b/patchwork/common/tools/bash_tool.py @@ -1,5 +1,6 @@ from __future__ import annotations +import shlex import subprocess from pathlib import Path @@ -45,7 +46,7 @@ def execute( try: result = subprocess.run( - command, shell=True, cwd=self.path, capture_output=True, text=True, timeout=60 # Add timeout for safety + shlex.split(command), shell=False, cwd=self.path, capture_output=True, text=True, timeout=60 # Add timeout for safety ) return result.stdout if result.returncode == 0 else f"Error: {result.stderr}" except subprocess.TimeoutExpired: diff --git a/patchwork/common/tools/csvkit_tool.py b/patchwork/common/tools/csvkit_tool.py index a1ef8dc59..5d905022f 100644 --- a/patchwork/common/tools/csvkit_tool.py +++ b/patchwork/common/tools/csvkit_tool.py @@ -118,8 +118,9 @@ def execute(self, files: list[str], query: str) -> str: if db_path.is_file(): with sqlite3.connect(str(db_path)) as conn: for file in files: + table_name = file.removesuffix('.csv') res = conn.execute( - f"SELECT 1 from {file.removesuffix('.csv')}", + "SELECT 1 FROM ?", (table_name,) ) if res.fetchone() is None: files_to_insert.append(file) diff --git a/patchwork/common/utils/dependency.py b/patchwork/common/utils/dependency.py index 27b89bfed..112c14b1c 100644 --- a/patchwork/common/utils/dependency.py +++ b/patchwork/common/utils/dependency.py @@ -6,9 +6,12 @@ "notification": ["slack_sdk"], } +__WHITELISTED_MODULES = {"semgrep", "depscan", "slack_sdk"} @lru_cache(maxsize=None) def import_with_dependency_group(name): + if name not in __WHITELISTED_MODULES: + raise ImportError(f"Module {name} is not allowed for import.") try: return importlib.import_module(name) except ImportError: @@ -20,6 +23,5 @@ def import_with_dependency_group(name): error_msg = f"Please `pip install patchwork-cli[{dependency_group}]` to use this step" raise ImportError(error_msg) - def slack_sdk(): return import_with_dependency_group("slack_sdk") diff --git a/patchwork/common/utils/step_typing.py b/patchwork/common/utils/step_typing.py index d349f7fc1..424fe2d41 100644 --- a/patchwork/common/utils/step_typing.py +++ b/patchwork/common/utils/step_typing.py @@ -105,8 +105,14 @@ def validate_step_type_config_with_inputs( return True, step_type_config.msg +ALLOWED_MODULES = {"expected_module1", "expected_module2"} + def validate_step_with_inputs(input_keys: Set[str], step: Type[Step]) -> Tuple[Set[str], Dict[str, str]]: module_path, _, _ = step.__module__.rpartition(".") + + if module_path not in ALLOWED_MODULES: + raise ValueError(f"Unauthorized module path: {module_path}") + step_name = step.__name__ type_module = importlib.import_module(f"{module_path}.typed") step_input_model = getattr(type_module, f"{step_name}Inputs", __NOT_GIVEN) diff --git a/patchwork/steps/CallShell/CallShell.py b/patchwork/steps/CallShell/CallShell.py index 98ee55a74..c59f0aa89 100644 --- a/patchwork/steps/CallShell/CallShell.py +++ b/patchwork/steps/CallShell/CallShell.py @@ -46,7 +46,8 @@ def __parse_env_text(env_text: str) -> dict[str, str]: return env def run(self) -> dict: - p = subprocess.run(self.script, shell=True, capture_output=True, text=True, cwd=self.working_dir, env=self.env) + command = shlex.split(self.script) + p = subprocess.run(command, shell=False, capture_output=True, text=True, cwd=self.working_dir, env=self.env) try: p.check_returncode() except subprocess.CalledProcessError as e: diff --git a/patchwork/steps/GetTypescriptTypeInfo/GetTypescriptTypeInfo.py b/patchwork/steps/GetTypescriptTypeInfo/GetTypescriptTypeInfo.py deleted file mode 100644 index 91a9af712..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/GetTypescriptTypeInfo.py +++ /dev/null @@ -1,36 +0,0 @@ -import os -import subprocess -from pathlib import Path - -from patchwork.step import Step -from patchwork.steps.GetTypescriptTypeInfo.typed import ( - GetTypescriptTypeInfoInputs, - GetTypescriptTypeInfoOutputs, -) - -_DEFAULT_TS_FILE = Path(__file__).parent / "get_type_info.ts" - - -class GetTypescriptTypeInfo(Step, input_class=GetTypescriptTypeInfoInputs, output_class=GetTypescriptTypeInfoOutputs): - def __init__(self, inputs: dict): - super().__init__(inputs) - - self.inputs = inputs - - def run(self) -> dict: - file_path = self.inputs["file_path"] - variable_name = self.inputs["variable_name"] - cwd = Path.cwd() - full_file_path = os.path.join(cwd, file_path) - - subprocess.run(["tsx", _DEFAULT_TS_FILE, full_file_path, variable_name], check=True, cwd=cwd) - - # Read the output file - output_path = os.path.join(cwd, "temp_output_declaration.txt") - with open(output_path, "r") as f: - type_info = f.read() - - # Clean up the temporary file - os.remove(output_path) - - return {"type_information": type_info} diff --git a/patchwork/steps/GetTypescriptTypeInfo/README.md b/patchwork/steps/GetTypescriptTypeInfo/README.md deleted file mode 100644 index c9c44fcc6..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/README.md +++ /dev/null @@ -1,21 +0,0 @@ -## GetTypescriptTypeInfo Code Documentation - -### Inputs -The `GetTypescriptTypeInfo` class takes the following inputs in its constructor: -- `file_path` (str): The path to the TypeScript file to analyze. -- `variable_name` (str): The name of the variable to get type information for. - -### Outputs -The `run()` method of the `GetTypescriptTypeInfo` class returns a dictionary with the following key: -- `type_information` (str): A string containing the type information of the specified variable. - -### Usage -The `GetTypescriptTypeInfo` step is used to analyze TypeScript files and extract type information for specified variables. It utilizes the `tsx` command to run a TypeScript script (`get_type_info.ts`) that performs the actual type analysis. - -1. The step first constructs the full file path and the path to the `get_type_info.ts` script. -2. It then runs the `tsx` command with the `get_type_info.ts` script, passing the file path and variable name as arguments. -3. The script writes the type information to a temporary file (`temp_output_declaration.txt`). -4. The step reads this temporary file to get the type information. -5. Finally, it cleans up by removing the temporary file and returns the type information. - -This step is useful for static analysis of TypeScript code, allowing you to programmatically extract detailed type information for variables in your TypeScript projects. diff --git a/patchwork/steps/GetTypescriptTypeInfo/__init__.py b/patchwork/steps/GetTypescriptTypeInfo/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/patchwork/steps/GetTypescriptTypeInfo/get_type_info.ts b/patchwork/steps/GetTypescriptTypeInfo/get_type_info.ts deleted file mode 100644 index 756385f68..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/get_type_info.ts +++ /dev/null @@ -1,285 +0,0 @@ -import fs from "fs"; -import path from "path"; -import { - ClassDeclaration, - EnumDeclaration, - FunctionDeclaration, - InterfaceDeclaration, - Project, - PropertyDeclaration, - Type, - TypeAliasDeclaration, - VariableDeclaration, -} from "ts-morph"; - -class TypeInfo { - private maxDepth: number; - - private project: Project; - - constructor(maxDepth: number) { - this.maxDepth = maxDepth; - this.project = new Project(); - } - - public describe(identifier: string, filePath: string): string { - const sourceFile = this.project.addSourceFileAtPath(filePath); - - const classDeclaration = sourceFile.getClass(identifier); - if (classDeclaration) { - return this.describeClass(classDeclaration, 0); - } - - const interfaceDeclaration = sourceFile.getInterface(identifier); - if (interfaceDeclaration) { - return this.describeInterface(interfaceDeclaration, 0); - } - - const typeAlias = sourceFile.getTypeAlias(identifier); - if (typeAlias) { - return this.describeTypeAlias(typeAlias, 0); - } - - const variable = sourceFile.getVariableDeclaration(identifier); - if (variable) { - return this.describeVariable(variable, 0); - } - - const functionDeclaration = sourceFile.getFunction(identifier); - if (functionDeclaration) { - return this.describeFunction(functionDeclaration, 0); - } - - const enumDeclaration = sourceFile.getEnum(identifier); - if (enumDeclaration) { - return this.describeEnum(enumDeclaration, 0); - } - - throw new Error(`Identifier ${identifier} not found in ${filePath}`); - } - - private describeVariable( - variable: VariableDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}const ${variable.getName()}: ${this.describeType( - variable.getType(), - depth + 1 - )}`; - } - - private describeFunction( - functionDeclaration: FunctionDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}function ${functionDeclaration.getName()}(${functionDeclaration - .getParameters() - .map( - (param) => - `${param.getName()}: ${this.describeType(param.getType(), depth + 1)}` - ) - .join(", ")}): ${this.describeType( - functionDeclaration.getReturnType(), - depth + 1 - )}`; - } - - private describeClass( - classDeclaration: ClassDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}class ${classDeclaration.getName()} { -${classDeclaration - .getProperties() - .map((property) => this.describeProperty(property, depth + 1)) - .join("\n")} -${classDeclaration - .getMethods() - .map((method) => - this.describeFunction(method as unknown as FunctionDeclaration, depth + 1) - ) - .join("\n")} -${indent}}`; - } - - private describeProperty( - property: PropertyDeclaration, - depth: number - ): string { - const indent = " ".repeat(depth); - return `${indent} ${property.getName()}: ${this.describeType( - property.getType(), - depth + 1 - )}`; - } - - private describeInterface( - interfaceDeclaration: InterfaceDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}interface ${interfaceDeclaration.getName()} { -${interfaceDeclaration - .getProperties() - .map((property) => - this.describeProperty(property as unknown as PropertyDeclaration, depth + 1) - ) - .join("\n")} -${interfaceDeclaration - .getMethods() - .map((method) => - this.describeFunction(method as unknown as FunctionDeclaration, depth + 1) - ) - .join("\n")} -${indent}}`; - } - - private describeTypeAlias( - typeAlias: TypeAliasDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}type ${typeAlias.getName()} = ${this.describeType( - typeAlias.getType(), - depth + 1 - )}`; - } - - private describeEnum( - enumDeclaration: EnumDeclaration, - depth: number - ): string { - if (depth > this.maxDepth) { - return ""; - } - const indent = " ".repeat(depth); - return `${indent}enum ${enumDeclaration.getName()} { -${enumDeclaration - .getMembers() - .map((member) => `${indent} ${member.getName()} = ${member.getValue()}`) - .join(",\n")} -${indent}}`; - } - - private describeType(type: Type, depth: number): string { - if (depth > this.maxDepth) { - return "..."; - } - const indent = " ".repeat(depth); - - if (type.isUnion()) { - return type - .getUnionTypes() - .map((t) => this.describeType(t, depth)) - .join(" | "); - } - - if (type.isIntersection()) { - return type - .getIntersectionTypes() - .map((t) => this.describeType(t, depth)) - .join(" & "); - } - - if (type.isArray()) { - return `${this.describeType(type.getArrayElementType()!, depth)}[]`; - } - - if (type.isObject() && !type.isInterface()) { - const properties = type.getProperties(); - if (properties.length === 0) { - return "{}"; - } - return `{ -${properties - .map((prop) => { - const valueDeclaration = prop.getValueDeclaration(); - if (!valueDeclaration) { - return `${indent} ${prop.getName()}: unknown`; - } - return `${indent} ${prop.getName()}: ${this.describeType( - prop.getTypeAtLocation(valueDeclaration), - depth + 1 - )}`; - }) - .join(",\n")} -${indent}}`; - } - - return type.getText(); - } -} - -function getTypeDescriptor( - identifier: string, - filePath: string, - maxDepth: number -): string { - return new TypeInfo(maxDepth).describe(identifier, filePath); -} - -function main() { - const args = process.argv.slice(2); - let maxDepth = 5; - let filePath, identifier; - - for (let i = 0; i < args.length; i++) { - if (args[i].startsWith("--max-depth=")) { - maxDepth = parseInt(args[i].split("=")[1], 10); - if (isNaN(maxDepth)) { - console.error("Invalid max depth value"); - process.exit(1); - } - } else if (!filePath) { - filePath = args[i]; - } else if (!identifier) { - identifier = args[i]; - } - } - - if (!filePath || !identifier) { - console.error( - "Usage: node script.js [--max-depth=]" - ); - process.exit(1); - } - - console.log( - "Getting type info for", - identifier, - "in", - filePath, - "with max depth", - maxDepth - ); - const typeString = getTypeDescriptor(identifier, filePath, maxDepth); - - const outputPath = path.join(process.cwd(), "temp_output_declaration.txt"); - - try { - fs.writeFileSync(outputPath, typeString, "utf8"); - console.log(`Type information has been written to ${outputPath}`); - } catch (error) { - console.error(`Error writing to file: ${error}`); - } -} - -main(); diff --git a/patchwork/steps/GetTypescriptTypeInfo/package.json b/patchwork/steps/GetTypescriptTypeInfo/package.json deleted file mode 100644 index 575b3c054..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "get-typescript-type-info", - "version": "0.0.1", - "description": "A simple cli to get typescript type info for a given variable in a file", - "license": "ISC", - "scripts": { - "get-type-info": "tsx get_type_info.ts" - }, - "dependencies": { - "ts-morph": "^23.0.0" - }, - "devDependencies": { - "@types/node": "^22.5.0", - "tsx": "^4.18.0", - "typescript": "^5.5.4" - }, - "packageManager": "pnpm@9.9.0+sha256.7a4261e50d9a44d9240baf6c9d6e10089dcf0a79d0007f2a26985a6927324177" -} diff --git a/patchwork/steps/GetTypescriptTypeInfo/pnpm-lock.yaml b/patchwork/steps/GetTypescriptTypeInfo/pnpm-lock.yaml deleted file mode 100644 index 42e33ab19..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/pnpm-lock.yaml +++ /dev/null @@ -1,515 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - ts-morph: - specifier: ^23.0.0 - version: 23.0.0 - devDependencies: - '@types/node': - specifier: ^22.5.0 - version: 22.5.0 - tsx: - specifier: ^4.18.0 - version: 4.18.0 - typescript: - specifier: ^5.5.4 - version: 5.5.4 - -packages: - - '@esbuild/aix-ppc64@0.23.1': - resolution: {integrity: sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - - '@esbuild/android-arm64@0.23.1': - resolution: {integrity: sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - - '@esbuild/android-arm@0.23.1': - resolution: {integrity: sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - - '@esbuild/android-x64@0.23.1': - resolution: {integrity: sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - - '@esbuild/darwin-arm64@0.23.1': - resolution: {integrity: sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - - '@esbuild/darwin-x64@0.23.1': - resolution: {integrity: sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - - '@esbuild/freebsd-arm64@0.23.1': - resolution: {integrity: sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - - '@esbuild/freebsd-x64@0.23.1': - resolution: {integrity: sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - - '@esbuild/linux-arm64@0.23.1': - resolution: {integrity: sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - - '@esbuild/linux-arm@0.23.1': - resolution: {integrity: sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - - '@esbuild/linux-ia32@0.23.1': - resolution: {integrity: sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - - '@esbuild/linux-loong64@0.23.1': - resolution: {integrity: sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - - '@esbuild/linux-mips64el@0.23.1': - resolution: {integrity: sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - - '@esbuild/linux-ppc64@0.23.1': - resolution: {integrity: sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - - '@esbuild/linux-riscv64@0.23.1': - resolution: {integrity: sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - - '@esbuild/linux-s390x@0.23.1': - resolution: {integrity: sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - - '@esbuild/linux-x64@0.23.1': - resolution: {integrity: sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - - '@esbuild/netbsd-x64@0.23.1': - resolution: {integrity: sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - - '@esbuild/openbsd-arm64@0.23.1': - resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - - '@esbuild/openbsd-x64@0.23.1': - resolution: {integrity: sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - - '@esbuild/sunos-x64@0.23.1': - resolution: {integrity: sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - - '@esbuild/win32-arm64@0.23.1': - resolution: {integrity: sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - - '@esbuild/win32-ia32@0.23.1': - resolution: {integrity: sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - - '@esbuild/win32-x64@0.23.1': - resolution: {integrity: sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - - '@ts-morph/common@0.24.0': - resolution: {integrity: sha512-c1xMmNHWpNselmpIqursHeOHHBTIsJLbB+NuovbTTRCNiTLEr/U9dbJ8qy0jd/O2x5pc3seWuOUN5R2IoOTp8A==} - - '@types/node@22.5.0': - resolution: {integrity: sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==} - - balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - - brace-expansion@2.0.1: - resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - - braces@3.0.3: - resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} - engines: {node: '>=8'} - - code-block-writer@13.0.2: - resolution: {integrity: sha512-XfXzAGiStXSmCIwrkdfvc7FS5Dtj8yelCtyOf2p2skCAfvLd6zu0rGzuS9NSCO3bq1JKpFZ7tbKdKlcd5occQA==} - - esbuild@0.23.1: - resolution: {integrity: sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==} - engines: {node: '>=18'} - hasBin: true - - fast-glob@3.3.2: - resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} - engines: {node: '>=8.6.0'} - - fastq@1.17.1: - resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - - fill-range@7.1.1: - resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} - engines: {node: '>=8'} - - fsevents@2.3.3: - resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - - get-tsconfig@4.7.6: - resolution: {integrity: sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==} - - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - - is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - - is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - - is-number@7.0.0: - resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} - engines: {node: '>=0.12.0'} - - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - - micromatch@4.0.8: - resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} - engines: {node: '>=8.6'} - - minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} - - mkdirp@3.0.1: - resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} - engines: {node: '>=10'} - hasBin: true - - path-browserify@1.0.1: - resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==} - - picomatch@2.3.1: - resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} - engines: {node: '>=8.6'} - - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - - resolve-pkg-maps@1.0.0: - resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - - reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - - to-regex-range@5.0.1: - resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} - engines: {node: '>=8.0'} - - ts-morph@23.0.0: - resolution: {integrity: sha512-FcvFx7a9E8TUe6T3ShihXJLiJOiqyafzFKUO4aqIHDUCIvADdGNShcbc2W5PMr3LerXRv7mafvFZ9lRENxJmug==} - - tsx@4.18.0: - resolution: {integrity: sha512-a1jaKBSVQkd6yEc1/NI7G6yHFfefIcuf3QJST7ZEyn4oQnxLYrZR5uZAM8UrwUa3Ge8suiZHcNS1gNrEvmobqg==} - engines: {node: '>=18.0.0'} - hasBin: true - - typescript@5.5.4: - resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==} - engines: {node: '>=14.17'} - hasBin: true - - undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - -snapshots: - - '@esbuild/aix-ppc64@0.23.1': - optional: true - - '@esbuild/android-arm64@0.23.1': - optional: true - - '@esbuild/android-arm@0.23.1': - optional: true - - '@esbuild/android-x64@0.23.1': - optional: true - - '@esbuild/darwin-arm64@0.23.1': - optional: true - - '@esbuild/darwin-x64@0.23.1': - optional: true - - '@esbuild/freebsd-arm64@0.23.1': - optional: true - - '@esbuild/freebsd-x64@0.23.1': - optional: true - - '@esbuild/linux-arm64@0.23.1': - optional: true - - '@esbuild/linux-arm@0.23.1': - optional: true - - '@esbuild/linux-ia32@0.23.1': - optional: true - - '@esbuild/linux-loong64@0.23.1': - optional: true - - '@esbuild/linux-mips64el@0.23.1': - optional: true - - '@esbuild/linux-ppc64@0.23.1': - optional: true - - '@esbuild/linux-riscv64@0.23.1': - optional: true - - '@esbuild/linux-s390x@0.23.1': - optional: true - - '@esbuild/linux-x64@0.23.1': - optional: true - - '@esbuild/netbsd-x64@0.23.1': - optional: true - - '@esbuild/openbsd-arm64@0.23.1': - optional: true - - '@esbuild/openbsd-x64@0.23.1': - optional: true - - '@esbuild/sunos-x64@0.23.1': - optional: true - - '@esbuild/win32-arm64@0.23.1': - optional: true - - '@esbuild/win32-ia32@0.23.1': - optional: true - - '@esbuild/win32-x64@0.23.1': - optional: true - - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 - - '@ts-morph/common@0.24.0': - dependencies: - fast-glob: 3.3.2 - minimatch: 9.0.5 - mkdirp: 3.0.1 - path-browserify: 1.0.1 - - '@types/node@22.5.0': - dependencies: - undici-types: 6.19.8 - - balanced-match@1.0.2: {} - - brace-expansion@2.0.1: - dependencies: - balanced-match: 1.0.2 - - braces@3.0.3: - dependencies: - fill-range: 7.1.1 - - code-block-writer@13.0.2: {} - - esbuild@0.23.1: - optionalDependencies: - '@esbuild/aix-ppc64': 0.23.1 - '@esbuild/android-arm': 0.23.1 - '@esbuild/android-arm64': 0.23.1 - '@esbuild/android-x64': 0.23.1 - '@esbuild/darwin-arm64': 0.23.1 - '@esbuild/darwin-x64': 0.23.1 - '@esbuild/freebsd-arm64': 0.23.1 - '@esbuild/freebsd-x64': 0.23.1 - '@esbuild/linux-arm': 0.23.1 - '@esbuild/linux-arm64': 0.23.1 - '@esbuild/linux-ia32': 0.23.1 - '@esbuild/linux-loong64': 0.23.1 - '@esbuild/linux-mips64el': 0.23.1 - '@esbuild/linux-ppc64': 0.23.1 - '@esbuild/linux-riscv64': 0.23.1 - '@esbuild/linux-s390x': 0.23.1 - '@esbuild/linux-x64': 0.23.1 - '@esbuild/netbsd-x64': 0.23.1 - '@esbuild/openbsd-arm64': 0.23.1 - '@esbuild/openbsd-x64': 0.23.1 - '@esbuild/sunos-x64': 0.23.1 - '@esbuild/win32-arm64': 0.23.1 - '@esbuild/win32-ia32': 0.23.1 - '@esbuild/win32-x64': 0.23.1 - - fast-glob@3.3.2: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - - fastq@1.17.1: - dependencies: - reusify: 1.0.4 - - fill-range@7.1.1: - dependencies: - to-regex-range: 5.0.1 - - fsevents@2.3.3: - optional: true - - get-tsconfig@4.7.6: - dependencies: - resolve-pkg-maps: 1.0.0 - - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - - is-extglob@2.1.1: {} - - is-glob@4.0.3: - dependencies: - is-extglob: 2.1.1 - - is-number@7.0.0: {} - - merge2@1.4.1: {} - - micromatch@4.0.8: - dependencies: - braces: 3.0.3 - picomatch: 2.3.1 - - minimatch@9.0.5: - dependencies: - brace-expansion: 2.0.1 - - mkdirp@3.0.1: {} - - path-browserify@1.0.1: {} - - picomatch@2.3.1: {} - - queue-microtask@1.2.3: {} - - resolve-pkg-maps@1.0.0: {} - - reusify@1.0.4: {} - - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - - to-regex-range@5.0.1: - dependencies: - is-number: 7.0.0 - - ts-morph@23.0.0: - dependencies: - '@ts-morph/common': 0.24.0 - code-block-writer: 13.0.2 - - tsx@4.18.0: - dependencies: - esbuild: 0.23.1 - get-tsconfig: 4.7.6 - optionalDependencies: - fsevents: 2.3.3 - - typescript@5.5.4: {} - - undici-types@6.19.8: {} diff --git a/patchwork/steps/GetTypescriptTypeInfo/tsconfig.json b/patchwork/steps/GetTypescriptTypeInfo/tsconfig.json deleted file mode 100644 index c70495e72..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "rootDir": "./", - "resolveJsonModule": true, - "declaration": true, - "sourceMap": true - }, - "include": [ - "*.ts", - "**/*.ts" - ], - "exclude": [ - "node_modules", - ] -} diff --git a/patchwork/steps/GetTypescriptTypeInfo/typed.py b/patchwork/steps/GetTypescriptTypeInfo/typed.py deleted file mode 100644 index 03da115c8..000000000 --- a/patchwork/steps/GetTypescriptTypeInfo/typed.py +++ /dev/null @@ -1,10 +0,0 @@ -from typing_extensions import TypedDict - - -class GetTypescriptTypeInfoInputs(TypedDict): - file_path: str - variable_name: str - - -class GetTypescriptTypeInfoOutputs(TypedDict): - type_information: str diff --git a/patchwork/steps/__init__.py b/patchwork/steps/__init__.py index 2b0d740cb..319c4bd66 100644 --- a/patchwork/steps/__init__.py +++ b/patchwork/steps/__init__.py @@ -28,9 +28,6 @@ from patchwork.steps.FileAgent.FileAgent import FileAgent from patchwork.steps.FilterBySimilarity.FilterBySimilarity import FilterBySimilarity from patchwork.steps.FixIssue.FixIssue import FixIssue -from patchwork.steps.GetTypescriptTypeInfo.GetTypescriptTypeInfo import ( - GetTypescriptTypeInfo, -) from patchwork.steps.GitHubAgent.GitHubAgent import GitHubAgent from patchwork.steps.JoinList.JoinList import JoinList from patchwork.steps.LLM.LLM import LLM @@ -110,7 +107,6 @@ "SlackMessage", "JoinList", "JoinListPB", - "GetTypescriptTypeInfo", "BrowserUse", "ManageEngineAgent", "ZohoDeskAgent",