MCPcopy Index your code
hub / github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge / exec

Method exec

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

Source from the content-addressed store, hash-verified

116 ) # Return all parameters
117
118 def exec(self, prep_res):
119 (
120 context,
121 file_listing_for_prompt,
122 file_count,
123 project_name,
124 language,
125 use_cache,
126 max_abstraction_num,
127 ) = prep_res # Unpack all parameters
128 print(f"Identifying abstractions using LLM...")
129
130 # Add language instruction and hints only if not English
131 language_instruction = ""
132 name_lang_hint = ""
133 desc_lang_hint = ""
134 if language.lower() != "english":
135 language_instruction = f"IMPORTANT: Generate the `name` and `description` for each abstraction in **{language.capitalize()}** language. Do NOT use English for these fields.\n\n"
136 # Keep specific hints here as name/description are primary targets
137 name_lang_hint = f" (value in {language.capitalize()})"
138 desc_lang_hint = f" (value in {language.capitalize()})"
139
140 prompt = f"""
141For the project `{project_name}`:
142
143Codebase Context:
144{context}
145
146{language_instruction}Analyze the codebase context.
147Identify the top 5-{max_abstraction_num} core most important abstractions to help those new to the codebase.
148
149For each abstraction, provide:
1501. A concise `name`{name_lang_hint}.
1512. A beginner-friendly `description` explaining what it is with a simple analogy, in around 100 words{desc_lang_hint}.
1523. A list of relevant `file_indices` (integers) using the format `idx # path/comment`.
153
154List of file indices and paths present in the context:
155{file_listing_for_prompt}
156
157Format the output as a YAML list of dictionaries:
158
159```yaml
160- name: |
161 Query Processing{name_lang_hint}
162 description: |
163 Explains what the abstraction does.
164 It's like a central dispatcher routing requests.{desc_lang_hint}
165 file_indices:
166 - 0 # path/to/file1.py
167 - 3 # path/to/related.py
168- name: |
169 Query Optimization{name_lang_hint}
170 description: |
171 Another core concept, similar to a blueprint for objects.{desc_lang_hint}
172 file_indices:
173 - 5 # path/to/another.js
174# ... up to {max_abstraction_num} abstractions
175```"""

Callers

nothing calls this directly

Calls 1

call_llmFunction · 0.90

Tested by

no test coverage detected