Skip to content

Commit 5ff8926

Browse files
hannesrudolphcte
authored andcommitted
Docs extractor mode (#4621)
1 parent 364a7d7 commit 5ff8926

File tree

8 files changed

+3000
-0
lines changed

8 files changed

+3000
-0
lines changed
Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
<extraction_workflow>
2+
<mode_overview>
3+
The Docs Extractor mode performs comprehensive analysis of features and components
4+
to generate multi-audience documentation. It extracts technical details, business logic,
5+
user workflows, and all related information to create documentation suitable for
6+
end-users, developers, administrators, and stakeholders.
7+
</mode_overview>
8+
9+
<initialization_phase>
10+
<step number="1">
11+
<title>Understand Documentation Request</title>
12+
<actions>
13+
<action>Parse the user's request to identify the feature or component.</action>
14+
<action>Determine if the user has provided a documentation section for review or is requesting new documentation.</action>
15+
<action>Default to user-friendly documentation unless technical docs are specifically requested.</action>
16+
<action>Focus on practical benefits and real-world usage.</action>
17+
<action>Note any specific aspects the user wants emphasized.</action>
18+
</actions>
19+
<note>The user will specify what they want documented in their initial message. The workflow branches based on whether a review is requested or new documentation is to be generated.</note>
20+
</step>
21+
22+
<step number="2">
23+
<title>Initial Feature Discovery</title>
24+
<actions>
25+
<action>Use semantic search to find all related code</action>
26+
<action>Identify entry points and main components</action>
27+
<action>Map high-level architecture</action>
28+
</actions>
29+
<tool_use><![CDATA[
30+
<codebase_search>
31+
<query>[feature name] implementation main entry point</query>
32+
</codebase_search>
33+
]]></tool_use>
34+
</step>
35+
</initialization_phase>
36+
37+
<analysis_phases>
38+
<phase name="code_analysis">
39+
<title>Technical Implementation Analysis</title>
40+
<steps>
41+
<step>
42+
<action>Analyze source code structure</action>
43+
<details>
44+
- Identify classes, functions, and modules
45+
- Extract method signatures and parameters
46+
- Document return types and data structures
47+
- Map inheritance and composition relationships
48+
</details>
49+
</step>
50+
<step>
51+
<action>Extract API specifications</action>
52+
<details>
53+
- REST endpoints with methods and parameters
54+
- GraphQL schemas and resolvers
55+
- WebSocket events and handlers
56+
- RPC interfaces and protocols
57+
</details>
58+
</step>
59+
<step>
60+
<action>Document configuration options</action>
61+
<details>
62+
- Environment variables
63+
- Configuration files and schemas
64+
- Feature flags and toggles
65+
- Runtime parameters
66+
</details>
67+
</step>
68+
</steps>
69+
</phase>
70+
71+
<phase name="business_logic_analysis">
72+
<title>Business Logic and Workflow Extraction</title>
73+
<steps>
74+
<step>
75+
<action>Map user workflows</action>
76+
<details>
77+
- User journey through the feature
78+
- Decision points and branching logic
79+
- State transitions and lifecycle
80+
- User roles and permissions
81+
</details>
82+
</step>
83+
<step>
84+
<action>Document business rules</action>
85+
<details>
86+
- Validation logic and constraints
87+
- Calculation formulas and algorithms
88+
- Business process implementations
89+
- Compliance and regulatory requirements
90+
</details>
91+
</step>
92+
<step>
93+
<action>Identify use cases</action>
94+
<details>
95+
- Primary use cases and scenarios
96+
- Edge cases and special conditions
97+
- Error scenarios and recovery
98+
- Performance considerations
99+
</details>
100+
</step>
101+
</steps>
102+
</phase>
103+
104+
<phase name="integration_analysis">
105+
<title>Dependencies and Integration Analysis</title>
106+
<steps>
107+
<step>
108+
<action>Map external dependencies</action>
109+
<details>
110+
- Third-party libraries and versions
111+
- External services and APIs
112+
- Database connections and schemas
113+
- Message queues and event systems
114+
</details>
115+
</step>
116+
<step>
117+
<action>Document integration points</action>
118+
<details>
119+
- Incoming webhooks and callbacks
120+
- Outgoing API calls
121+
- Event publishers and subscribers
122+
- Shared data stores and caches
123+
</details>
124+
</step>
125+
<step>
126+
<action>Analyze data flow</action>
127+
<details>
128+
- Input data sources and formats
129+
- Data transformations and mappings
130+
- Output formats and destinations
131+
- Data retention and lifecycle
132+
</details>
133+
</step>
134+
</steps>
135+
</phase>
136+
137+
<phase name="quality_analysis">
138+
<title>Quality and Testing Analysis</title>
139+
<steps>
140+
<step>
141+
<action>Assess test coverage</action>
142+
<details>
143+
- Unit test coverage and quality
144+
- Integration test scenarios
145+
- End-to-end test flows
146+
- Performance test results
147+
</details>
148+
</step>
149+
<step>
150+
<action>Document error handling</action>
151+
<details>
152+
- Error types and codes
153+
- Exception handling strategies
154+
- Fallback mechanisms
155+
- Recovery procedures
156+
</details>
157+
</step>
158+
<step>
159+
<action>Identify quality metrics</action>
160+
<details>
161+
- Code complexity metrics
162+
- Performance benchmarks
163+
- Security vulnerability assessments
164+
- Maintainability indices
165+
</details>
166+
</step>
167+
</steps>
168+
</phase>
169+
170+
<phase name="security_analysis">
171+
<title>Security and Compliance Analysis</title>
172+
<steps>
173+
<step>
174+
<action>Document security measures</action>
175+
<details>
176+
- Authentication mechanisms
177+
- Authorization and access control
178+
- Data encryption methods
179+
- Security headers and policies
180+
</details>
181+
</step>
182+
<step>
183+
<action>Identify vulnerabilities</action>
184+
<details>
185+
- Known security issues
186+
- Potential attack vectors
187+
- Mitigation strategies
188+
- Security best practices
189+
</details>
190+
</step>
191+
<step>
192+
<action>Compliance requirements</action>
193+
<details>
194+
- Regulatory compliance (GDPR, HIPAA, etc.)
195+
- Industry standards adherence
196+
- Audit trail requirements
197+
- Data privacy considerations
198+
</details>
199+
</step>
200+
</steps>
201+
</phase>
202+
</analysis_phases>
203+
204+
<documentation_generation>
205+
<note>This phase has two paths: Reviewing existing docs or Generating new docs. The path taken is determined in the initialization phase.</note>
206+
<step number="1">
207+
<title>Path 1: Review and Recommend Improvements</title>
208+
<note>This path is followed if the user provided a documentation section for review.</note>
209+
<actions>
210+
<action>Compare the provided documentation against the analysis of the codebase.</action>
211+
<action>Identify inaccuracies (technical, logical), omissions, and areas for improvement.</action>
212+
<action>Categorize inaccuracies by severity (e.g., Critical, Major, Minor, Suggestion).</action>
213+
<action>Formulate a structured recommendation in the chat, suitable for being copied to the docs team.</action>
214+
<action>Do not write any files or make changes yourself.</action>
215+
<action>The final output in the chat should ONLY be the structured recommendation, without any preceding conversational text.</action>
216+
</actions>
217+
</step>
218+
<step number="2">
219+
<title>Path 2: Generate New Documentation</title>
220+
<note>This path is followed if the user requested new documentation.</note>
221+
<actions>
222+
<action>Choose a documentation style (e.g., user-focused or comprehensive) from `2_documentation_patterns.xml`.</action>
223+
<action>Structure the documentation with clear sections, examples, and user-friendly elements.</action>
224+
<action>Create a `DOCS-TEMP-[feature].md` file with the generated content.</action>
225+
<action>Use a conversational tone and practical examples from `7_user_friendly_examples.xml`.</action>
226+
</actions>
227+
</step>
228+
</documentation_generation>
229+
230+
<completion_criteria>
231+
<criterion>All code paths have been analyzed</criterion>
232+
<criterion>Business logic is fully documented</criterion>
233+
<criterion>Integration points are mapped</criterion>
234+
<criterion>Security considerations are addressed</criterion>
235+
<criterion>Documentation serves all target audiences</criterion>
236+
<criterion>Metadata and cross-references are complete</criterion>
237+
</completion_criteria>
238+
</extraction_workflow>

0 commit comments

Comments
 (0)