MCPcopy Create free account
hub / github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge / exec

Method exec

nodes.py:51–78  ·  view source on GitHub ↗
(self, prep_res)

Source from the content-addressed store, hash-verified

49 }
50
51 def exec(self, prep_res):
52 if prep_res["repo_url"]:
53 print(f"Crawling repository: {prep_res['repo_url']}...")
54 result = crawl_github_files(
55 repo_url=prep_res["repo_url"],
56 token=prep_res["token"],
57 include_patterns=prep_res["include_patterns"],
58 exclude_patterns=prep_res["exclude_patterns"],
59 max_file_size=prep_res["max_file_size"],
60 use_relative_paths=prep_res["use_relative_paths"],
61 )
62 else:
63 print(f"Crawling directory: {prep_res['local_dir']}...")
64
65 result = crawl_local_files(
66 directory=prep_res["local_dir"],
67 include_patterns=prep_res["include_patterns"],
68 exclude_patterns=prep_res["exclude_patterns"],
69 max_file_size=prep_res["max_file_size"],
70 use_relative_paths=prep_res["use_relative_paths"]
71 )
72
73 # Convert dict to list of tuples: [(path, content), ...]
74 files_list = list(result.get("files", {}).items())
75 if len(files_list) == 0:
76 raise (ValueError("Failed to fetch files"))
77 print(f"Fetched {len(files_list)} files.")
78 return files_list
79
80 def post(self, shared, prep_res, exec_res):
81 shared["files"] = exec_res # List of (path, content) tuples

Callers

nothing calls this directly

Calls 2

crawl_github_filesFunction · 0.90
crawl_local_filesFunction · 0.90

Tested by

no test coverage detected