autodocgenerator 0.9.0.0__py3-none-any.whl → 0.9.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,28 +9,34 @@ You should understand, that it is not full code, it is just part
9
9
  Do NOT skip details; analyze everything that appears in the snippet.
10
10
  """
11
11
 
12
- BASE_PART_COMPLITE_TEXT = """Revised Documentation Prompt
13
- Role: You are a senior technical writer. Input: You will receive a specific code snippet representing a fragment of a larger system.
14
- Task: Write clear, structured, and hierarchical documentation for this fragment. Length: 0.7–1k characters (keep it tight).
15
-
16
- Content Requirements:
17
- Component Responsibility: Define exactly what this specific fragment does.
18
- Interactions: Describe how this piece communicates with the rest of the system.
19
- Technical Details: Detail key functions, classes, and logic flows present in the snippet.
20
- Data Flow: Outline inputs, outputs, side effects, and logic assumptions.
21
-
22
- Constraint - No Generic Headers (CRITICAL):
23
- DO NOT use generic or global topic headers such as "Overview," "Core," "Introduction," "Background," or "System Summary."
24
- All headings must be specific to the functionality of the code fragment provided.
25
-
26
- Context & Style:
27
- Use the global system description as the primary context, but do not restate it. Focus exclusively on the fragment.
28
- Write for developers who are new to the codebase.
29
- Maintain high technical accuracy and a concise, professional tone.
30
-
31
- Formatting:
32
- Use Markdown for structure.
33
- Include HTML anchors near titles: <a name="specific-title"></a> \n ## Specific Title."""
12
+ BASE_PART_COMPLITE_TEXT = """
13
+ Role: You are a Senior Technical Writer & System Architect. Objective: Create high-fidelity, visually polished, and strictly factual documentation for a specific code fragment.
14
+
15
+ 1. STRICT GROUNDING & ACCURACY (NO HALLUCINATIONS):
16
+ Source Truth: Use ONLY the provided code snippet and the explicit global context.
17
+ Zero Assumption Policy: If a function's origin, a variable's purpose, or a data source is not explicitly present in the provided text, do not invent it. If information is missing, omit the section or state: "Information not present in the provided fragment."
18
+ Context Lock: Do not use general knowledge about external libraries unless their specific usage is visible in the code.
19
+
20
+ 2. VISUAL STRUCTURE & MD STYLE:
21
+ Layout: Use a highly scannable, hierarchical Markdown structure.
22
+ Data Visualization: Present Inputs, Outputs, and Parameters in a Markdown Table (Columns: Entity, Type, Role, Notes).
23
+ Emphasis: Use backticks for code symbols, bolding for key terms, and > Blockquotes for critical logic assumptions or warnings.
24
+ Navigation: Every heading must be preceded by an HTML anchor: <a name="unique-id"></a> \n ## Specific Heading.
25
+
26
+ 3. CONTENT REQUIREMENTS (0.7–1k characters):
27
+ Specific Component Responsibility: Define the exact functional role of this fragment within the system.
28
+ Visible Interactions: Describe how this piece communicates with other parts of the system based only on the snippet.
29
+ Technical Logic Flow: A step-by-step breakdown of the classes, functions, and internal logic.
30
+ Data Contract: Detailed flow of inputs, outputs, and side effects in table format.
31
+
32
+ 4. CRITICAL CONSTRAINT - NO GENERIC HEADERS:
33
+ Forbidden: "Overview", "Introduction", "Background", "Technical Details", "Summary", "Core".
34
+ Required: Use headers that describe the specific functionality (e.g., ## [Component Name] Request Validation or ## Stream Processing Pipeline).
35
+
36
+ 5. TONE & STYLE:
37
+ Professional, technical, and laconic.
38
+ Write for developers who need to understand the fragment's implementation instantly.
39
+ Focus exclusively on the fragment; do not restate the global system description."""
34
40
 
35
41
  BASE_INTRODACTION_CREATE_LINKS = """
36
42
  Role: Senior Technical Solutions Architect.
@@ -106,7 +112,8 @@ BASE_CUSTOM_DISCRIPTIONS = """
106
112
  3. DO NOT use external knowledge or invent any logic that is not present in the text.
107
113
  4. Do not provide any introductory or concluding remarks. If there is no info, output must be empty.
108
114
  5. If you dont have any info about it return just !noinfo
109
- 6. Every response must start with exactly one <a name="CONTENT_DESCRIPTION"></a> tag. The CONTENT_DESCRIPTION must be a short, hyphenated summary of the actual information you are providing (e.g., "user-authentication-logic" instead of "auth.yml"). STRICT RULES:
115
+ 6. Every response must start with exactly one <a name="CONTENT_DESCRIPTION"></a> tag. The CONTENT_DESCRIPTION must be a short, hyphenated summary of the actual information you are providing (e.g., "user-authentication-logic" instead of "auth.yml").
116
+ STRICT RULES(This rules works only for <a name=""></a> tag):
110
117
 
111
118
  NO filenames or paths (e.g., forbidden: "autodocconfig.yml", "src/config").
112
119
  NO file extensions (e.g., forbidden: ".yml", ".md").
@@ -67,15 +67,12 @@ class Manager:
67
67
  self.logger.log(InfoLog("Code mix generation completed."))
68
68
  self.progress_bar.update_task()
69
69
 
70
-
71
70
  def generete_doc_parts(self, max_symbols=5_000):
72
-
73
-
74
71
  full_code_mix = self.read_file_by_file_key("code_mix")
75
72
 
76
73
  self.logger.log(InfoLog("Starting synchronous documentation generation by parts..."))
77
74
  result = gen_doc_parts(full_code_mix,
78
- max_symbols, self.sync_model,
75
+ max_symbols, self.sync_model, self.config.get_project_settings(),
79
76
  self.config.language, self.progress_bar)
80
77
 
81
78
  self.logger.log(InfoLog("Documentation generation by parts completed."))
@@ -3,6 +3,7 @@ from ..engine.config.config import BASE_PART_COMPLITE_TEXT
3
3
  import asyncio
4
4
  from ..ui.progress_base import BaseProgress
5
5
  from ..ui.logging import BaseLogger, InfoLog, ErrorLog, WarningLog
6
+ from .settings import ProjectSettings
6
7
 
7
8
 
8
9
  def split_data(data: str, max_symbols: int) -> list[str]:
@@ -40,13 +41,17 @@ def split_data(data: str, max_symbols: int) -> list[str]:
40
41
 
41
42
  return split_objects
42
43
 
43
- def write_docs_by_parts(part_id: int, part: str, model: Model, prev_info: str = None, language: str = "en"):
44
+ def write_docs_by_parts(part: str, model: Model, project_settings: ProjectSettings, prev_info: str = None, language: str = "en"):
44
45
  logger = BaseLogger()
45
46
  logger.log(InfoLog("Generating documentation for a part..."))
46
47
  prompt = [
47
48
  {
48
49
  "role": "system",
49
- "content": f"For the following task use language {language}. your part id is {part_id}"
50
+ "content": f"For the following task use language {language}"
51
+ },
52
+ {
53
+ "role": "system",
54
+ "content": f"global project info: {project_settings.prompt}"
50
55
  },
51
56
  {
52
57
  "role": "system",
@@ -89,10 +94,7 @@ async def async_write_docs_by_parts(part: str, async_model: AsyncModel, global_i
89
94
  "role": "system",
90
95
  "content": BASE_PART_COMPLITE_TEXT
91
96
  },
92
- # {
93
- # "role": "system",
94
- # "content": global_info
95
- # },
97
+
96
98
  {
97
99
  "role": "user",
98
100
  "content": part
@@ -102,7 +104,7 @@ async def async_write_docs_by_parts(part: str, async_model: AsyncModel, global_i
102
104
  if prev_info is not None:
103
105
  prompt.append({
104
106
  "role": "system",
105
- "content": f"it is last part of documentation that you have write before{prev_info}"
107
+ "content": f"it is last part of documentation that you have write before {prev_info}"
106
108
  })
107
109
 
108
110
  prompt.append({
@@ -124,7 +126,7 @@ async def async_write_docs_by_parts(part: str, async_model: AsyncModel, global_i
124
126
  return answer
125
127
 
126
128
 
127
- def gen_doc_parts(full_code_mix, max_symbols, model: Model, language, progress_bar: BaseProgress):
129
+ def gen_doc_parts(full_code_mix, max_symbols, model: Model, project_settings: ProjectSettings, language, progress_bar: BaseProgress):
128
130
  splited_data = split_data(full_code_mix, max_symbols)
129
131
  result = None
130
132
  logger = BaseLogger()
@@ -134,7 +136,7 @@ def gen_doc_parts(full_code_mix, max_symbols, model: Model, language, progress_b
134
136
 
135
137
  all_result = ""
136
138
  for i, el in enumerate(splited_data):
137
- result = write_docs_by_parts(i + 1, el, model, result, language)
139
+ result = write_docs_by_parts(el, model, project_settings, result, language)
138
140
  all_result += result
139
141
  all_result += "\n\n"
140
142