MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _format_module_tree

Function _format_module_tree

codewiki/src/be/prompt_template.py:267–291  ·  view source on GitHub ↗
(module_tree: dict[str, any], indent: int = 0)

Source from the content-addressed store, hash-verified

265Please shortlist the files, folders representing the core functionality and ignore the files, folders that are not essential to the core functionality of the project (e.g. test files, documentation files, etc.) from the list above.
266
267Reasoning at first, then return the list of relative paths in JSON format.
268"""
269
270logger = logging.getLogger(__name__)
271
272# codex rejects any turn whose total input exceeds 1,048,576 characters
273# (input_too_large, code -32602 — server-side, not configurable). Cap the
274# user prompt below that, leaving headroom for the system prompt, tool
275# schemas and protocol overhead.
276MAX_USER_PROMPT_CHARS = 900_000
277
278MODULE_TREE_TRIMMED_NOTE = (
279 "NOTE: per-module component listings were omitted because the full module "
280 "tree exceeds the model input limit. Module names and hierarchy are "
281 "complete; read the referenced modules' documentation files or use your "
282 "code-reading tools when you need component-level detail."
283)
284
285CODE_TRUNCATED_NOTE = (
286 "\n... [file contents truncated to fit the model input limit — use your "
287 "file-reading tools to read the full files]"
288)
289
290# Appended to the user prompt (after USER_PROMPT) when the dependency graph
291# contains artifact nodes. Kept out of USER_PROMPT itself so callers that
292# format the template directly (MCP prompt server) keep working.
293ARTIFACT_USAGE_NOTE = (
294 "* NOTE: when this module's behaviour depends on how the system is built, "

Callers 2

format_user_promptFunction · 0.85
format_cluster_promptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected