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

Method exec

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

Source from the content-addressed store, hash-verified

852 }
853
854 def exec(self, prep_res):
855 output_path = prep_res["output_path"]
856 index_content = prep_res["index_content"]
857 chapter_files = prep_res["chapter_files"]
858
859 print(f"Combining tutorial into directory: {output_path}")
860 # Rely on Node's built-in retry/fallback
861 os.makedirs(output_path, exist_ok=True)
862
863 # Write index.md
864 index_filepath = os.path.join(output_path, "index.md")
865 with open(index_filepath, "w", encoding="utf-8") as f:
866 f.write(index_content)
867 print(f" - Wrote {index_filepath}")
868
869 # Write chapter files
870 for chapter_info in chapter_files:
871 chapter_filepath = os.path.join(output_path, chapter_info["filename"])
872 with open(chapter_filepath, "w", encoding="utf-8") as f:
873 f.write(chapter_info["content"])
874 print(f" - Wrote {chapter_filepath}")
875
876 return output_path # Return the final path
877
878 def post(self, shared, prep_res, exec_res):
879 shared["final_output_dir"] = exec_res # Store the output path

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected