kollabor 0.4.9__py3-none-any.whl → 0.4.15__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.
- agents/__init__.py +2 -0
- agents/coder/__init__.py +0 -0
- agents/coder/agent.json +4 -0
- agents/coder/api-integration.md +2150 -0
- agents/coder/cli-pretty.md +765 -0
- agents/coder/code-review.md +1092 -0
- agents/coder/database-design.md +1525 -0
- agents/coder/debugging.md +1102 -0
- agents/coder/dependency-management.md +1397 -0
- agents/coder/git-workflow.md +1099 -0
- agents/coder/refactoring.md +1454 -0
- agents/coder/security-hardening.md +1732 -0
- agents/coder/system_prompt.md +1448 -0
- agents/coder/tdd.md +1367 -0
- agents/creative-writer/__init__.py +0 -0
- agents/creative-writer/agent.json +4 -0
- agents/creative-writer/character-development.md +1852 -0
- agents/creative-writer/dialogue-craft.md +1122 -0
- agents/creative-writer/plot-structure.md +1073 -0
- agents/creative-writer/revision-editing.md +1484 -0
- agents/creative-writer/system_prompt.md +690 -0
- agents/creative-writer/worldbuilding.md +2049 -0
- agents/data-analyst/__init__.py +30 -0
- agents/data-analyst/agent.json +4 -0
- agents/data-analyst/data-visualization.md +992 -0
- agents/data-analyst/exploratory-data-analysis.md +1110 -0
- agents/data-analyst/pandas-data-manipulation.md +1081 -0
- agents/data-analyst/sql-query-optimization.md +881 -0
- agents/data-analyst/statistical-analysis.md +1118 -0
- agents/data-analyst/system_prompt.md +928 -0
- agents/default/__init__.py +0 -0
- agents/default/agent.json +4 -0
- agents/default/dead-code.md +794 -0
- agents/default/explore-agent-system.md +585 -0
- agents/default/system_prompt.md +1448 -0
- agents/kollabor/__init__.py +0 -0
- agents/kollabor/analyze-plugin-lifecycle.md +175 -0
- agents/kollabor/analyze-terminal-rendering.md +388 -0
- agents/kollabor/code-review.md +1092 -0
- agents/kollabor/debug-mcp-integration.md +521 -0
- agents/kollabor/debug-plugin-hooks.md +547 -0
- agents/kollabor/debugging.md +1102 -0
- agents/kollabor/dependency-management.md +1397 -0
- agents/kollabor/git-workflow.md +1099 -0
- agents/kollabor/inspect-llm-conversation.md +148 -0
- agents/kollabor/monitor-event-bus.md +558 -0
- agents/kollabor/profile-performance.md +576 -0
- agents/kollabor/refactoring.md +1454 -0
- agents/kollabor/system_prompt copy.md +1448 -0
- agents/kollabor/system_prompt.md +757 -0
- agents/kollabor/trace-command-execution.md +178 -0
- agents/kollabor/validate-config.md +879 -0
- agents/research/__init__.py +0 -0
- agents/research/agent.json +4 -0
- agents/research/architecture-mapping.md +1099 -0
- agents/research/codebase-analysis.md +1077 -0
- agents/research/dependency-audit.md +1027 -0
- agents/research/performance-profiling.md +1047 -0
- agents/research/security-review.md +1359 -0
- agents/research/system_prompt.md +492 -0
- agents/technical-writer/__init__.py +0 -0
- agents/technical-writer/agent.json +4 -0
- agents/technical-writer/api-documentation.md +2328 -0
- agents/technical-writer/changelog-management.md +1181 -0
- agents/technical-writer/readme-writing.md +1360 -0
- agents/technical-writer/style-guide.md +1410 -0
- agents/technical-writer/system_prompt.md +653 -0
- agents/technical-writer/tutorial-creation.md +1448 -0
- core/__init__.py +0 -2
- core/application.py +343 -88
- core/cli.py +229 -10
- core/commands/menu_renderer.py +463 -59
- core/commands/registry.py +14 -9
- core/commands/system_commands.py +2461 -14
- core/config/loader.py +151 -37
- core/config/service.py +18 -6
- core/events/bus.py +29 -9
- core/events/executor.py +205 -75
- core/events/models.py +27 -8
- core/fullscreen/command_integration.py +20 -24
- core/fullscreen/components/__init__.py +10 -1
- core/fullscreen/components/matrix_components.py +1 -2
- core/fullscreen/components/space_shooter_components.py +654 -0
- core/fullscreen/plugin.py +5 -0
- core/fullscreen/renderer.py +52 -13
- core/fullscreen/session.py +52 -15
- core/io/__init__.py +29 -5
- core/io/buffer_manager.py +6 -1
- core/io/config_status_view.py +7 -29
- core/io/core_status_views.py +267 -347
- core/io/input/__init__.py +25 -0
- core/io/input/command_mode_handler.py +711 -0
- core/io/input/display_controller.py +128 -0
- core/io/input/hook_registrar.py +286 -0
- core/io/input/input_loop_manager.py +421 -0
- core/io/input/key_press_handler.py +502 -0
- core/io/input/modal_controller.py +1011 -0
- core/io/input/paste_processor.py +339 -0
- core/io/input/status_modal_renderer.py +184 -0
- core/io/input_errors.py +5 -1
- core/io/input_handler.py +211 -2452
- core/io/key_parser.py +7 -0
- core/io/layout.py +15 -3
- core/io/message_coordinator.py +111 -2
- core/io/message_renderer.py +129 -4
- core/io/status_renderer.py +147 -607
- core/io/terminal_renderer.py +97 -51
- core/io/terminal_state.py +21 -4
- core/io/visual_effects.py +816 -165
- core/llm/agent_manager.py +1063 -0
- core/llm/api_adapters/__init__.py +44 -0
- core/llm/api_adapters/anthropic_adapter.py +432 -0
- core/llm/api_adapters/base.py +241 -0
- core/llm/api_adapters/openai_adapter.py +326 -0
- core/llm/api_communication_service.py +167 -113
- core/llm/conversation_logger.py +322 -16
- core/llm/conversation_manager.py +556 -30
- core/llm/file_operations_executor.py +84 -32
- core/llm/llm_service.py +934 -103
- core/llm/mcp_integration.py +541 -57
- core/llm/message_display_service.py +135 -18
- core/llm/plugin_sdk.py +1 -2
- core/llm/profile_manager.py +1183 -0
- core/llm/response_parser.py +274 -56
- core/llm/response_processor.py +16 -3
- core/llm/tool_executor.py +6 -1
- core/logging/__init__.py +2 -0
- core/logging/setup.py +34 -6
- core/models/resume.py +54 -0
- core/plugins/__init__.py +4 -2
- core/plugins/base.py +127 -0
- core/plugins/collector.py +23 -161
- core/plugins/discovery.py +37 -3
- core/plugins/factory.py +6 -12
- core/plugins/registry.py +5 -17
- core/ui/config_widgets.py +128 -28
- core/ui/live_modal_renderer.py +2 -1
- core/ui/modal_actions.py +5 -0
- core/ui/modal_overlay_renderer.py +0 -60
- core/ui/modal_renderer.py +268 -7
- core/ui/modal_state_manager.py +29 -4
- core/ui/widgets/base_widget.py +7 -0
- core/updates/__init__.py +10 -0
- core/updates/version_check_service.py +348 -0
- core/updates/version_comparator.py +103 -0
- core/utils/config_utils.py +685 -526
- core/utils/plugin_utils.py +1 -1
- core/utils/session_naming.py +111 -0
- fonts/LICENSE +21 -0
- fonts/README.md +46 -0
- fonts/SymbolsNerdFont-Regular.ttf +0 -0
- fonts/SymbolsNerdFontMono-Regular.ttf +0 -0
- fonts/__init__.py +44 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/METADATA +54 -4
- kollabor-0.4.15.dist-info/RECORD +228 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/top_level.txt +2 -0
- plugins/agent_orchestrator/__init__.py +39 -0
- plugins/agent_orchestrator/activity_monitor.py +181 -0
- plugins/agent_orchestrator/file_attacher.py +77 -0
- plugins/agent_orchestrator/message_injector.py +135 -0
- plugins/agent_orchestrator/models.py +48 -0
- plugins/agent_orchestrator/orchestrator.py +403 -0
- plugins/agent_orchestrator/plugin.py +976 -0
- plugins/agent_orchestrator/xml_parser.py +191 -0
- plugins/agent_orchestrator_plugin.py +9 -0
- plugins/enhanced_input/box_styles.py +1 -0
- plugins/enhanced_input/color_engine.py +19 -4
- plugins/enhanced_input/config.py +2 -2
- plugins/enhanced_input_plugin.py +61 -11
- plugins/fullscreen/__init__.py +6 -2
- plugins/fullscreen/example_plugin.py +1035 -222
- plugins/fullscreen/setup_wizard_plugin.py +592 -0
- plugins/fullscreen/space_shooter_plugin.py +131 -0
- plugins/hook_monitoring_plugin.py +436 -78
- plugins/query_enhancer_plugin.py +66 -30
- plugins/resume_conversation_plugin.py +1494 -0
- plugins/save_conversation_plugin.py +98 -32
- plugins/system_commands_plugin.py +70 -56
- plugins/tmux_plugin.py +154 -78
- plugins/workflow_enforcement_plugin.py +94 -92
- system_prompt/default.md +952 -886
- core/io/input_mode_manager.py +0 -402
- core/io/modal_interaction_handler.py +0 -315
- core/io/raw_input_processor.py +0 -946
- core/storage/__init__.py +0 -5
- core/storage/state_manager.py +0 -84
- core/ui/widget_integration.py +0 -222
- core/utils/key_reader.py +0 -171
- kollabor-0.4.9.dist-info/RECORD +0 -128
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/WHEEL +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/entry_points.txt +0 -0
- {kollabor-0.4.9.dist-info → kollabor-0.4.15.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
<!-- Architecture Mapping skill - discover and document system architecture -->
|
|
2
|
+
|
|
3
|
+
architecture mapping mode: DISCOVER AND DOCUMENT, DO NOT MODIFY
|
|
4
|
+
|
|
5
|
+
when this skill is active, you follow systematic architecture investigation.
|
|
6
|
+
this is a comprehensive guide to mapping system architecture for documentation.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
PHASE 0: ENVIRONMENT AND PREREQUISITES VERIFICATION
|
|
10
|
+
|
|
11
|
+
before conducting ANY architecture investigation, verify tools are available.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
check code analysis tools
|
|
15
|
+
|
|
16
|
+
<terminal>which tree</terminal>
|
|
17
|
+
|
|
18
|
+
if tree not installed:
|
|
19
|
+
<terminal>brew install tree</terminal>
|
|
20
|
+
# macos
|
|
21
|
+
|
|
22
|
+
<terminal>apt-get install tree</terminal>
|
|
23
|
+
# debian/ubuntu
|
|
24
|
+
|
|
25
|
+
<terminal>dnf install tree</terminal>
|
|
26
|
+
# fedora
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
check for graph generation tools
|
|
30
|
+
|
|
31
|
+
<terminal>which dot</terminal>
|
|
32
|
+
|
|
33
|
+
if graphviz not installed:
|
|
34
|
+
<terminal>brew install graphviz</terminal>
|
|
35
|
+
# macos
|
|
36
|
+
|
|
37
|
+
<terminal>apt-get install graphviz</terminal>
|
|
38
|
+
# debian/ubuntu
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
check for language-specific analysis tools
|
|
42
|
+
|
|
43
|
+
python projects:
|
|
44
|
+
<terminal>python -c "import ast; import sys; print('ast ready')"</terminal>
|
|
45
|
+
|
|
46
|
+
<terminal>pip list | grep -E "pylint|bandit|radon|pydeps"</terminal>
|
|
47
|
+
|
|
48
|
+
javascript/node projects:
|
|
49
|
+
<terminal>which node && npm list -g | grep -E "eslint|madge|dependency-cruiser"</terminal>
|
|
50
|
+
|
|
51
|
+
java projects:
|
|
52
|
+
<terminal>which javap && echo "javap available"</terminal>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
verify project access
|
|
56
|
+
|
|
57
|
+
<terminal>ls -la</terminal>
|
|
58
|
+
|
|
59
|
+
<terminal>find . -maxdepth 2 -type f -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.java" | head -20</terminal>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
check for existing documentation
|
|
63
|
+
|
|
64
|
+
<terminal>ls -la docs/ 2>/dev/null || echo "no docs directory"</terminal>
|
|
65
|
+
|
|
66
|
+
<terminal>find . -maxdepth 3 -type f -name "*README*" -o -name "*ARCHITECTURE*" -o -name "*DESIGN*" 2>/dev/null</terminal>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
PHASE 1: IDENTIFYING SYSTEM BOUNDARIES
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
understanding the scope
|
|
73
|
+
|
|
74
|
+
first step: define what constitutes "the system"
|
|
75
|
+
|
|
76
|
+
ask these questions:
|
|
77
|
+
[ ] what is the main entry point?
|
|
78
|
+
[ ] what are the external interfaces?
|
|
79
|
+
[ ] where does system responsibility begin and end?
|
|
80
|
+
[ ] what dependencies are external vs internal?
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
find entry points
|
|
84
|
+
|
|
85
|
+
python projects:
|
|
86
|
+
<terminal>find . -maxdepth 3 -type f -name "main.py" -o -name "__main__.py" -o -name "app.py"</terminal>
|
|
87
|
+
|
|
88
|
+
<terminal>find . -maxdepth 3 -type f -name "*.py" -exec grep -l "if __name__" {} \;</terminal>
|
|
89
|
+
|
|
90
|
+
<terminal>grep -r "def main" . --include="*.py" | head -20</terminal>
|
|
91
|
+
|
|
92
|
+
javascript/node projects:
|
|
93
|
+
<terminal>find . -maxdepth 3 -type f -name "index.js" -o -name "main.js" -o -name "server.js"</terminal>
|
|
94
|
+
|
|
95
|
+
<terminal>cat package.json | grep -A5 '"main"'</terminal>
|
|
96
|
+
|
|
97
|
+
<terminal>cat package.json | grep -A10 '"scripts"'</terminal>
|
|
98
|
+
|
|
99
|
+
java projects:
|
|
100
|
+
<terminal>find . -type f -name "*.class" | head -5</terminal>
|
|
101
|
+
|
|
102
|
+
<terminal>find . -type f -name "*.jar" | head -5</terminal>
|
|
103
|
+
|
|
104
|
+
<terminal>grep -r "public static void main" . --include="*.java" | head -10</terminal>
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
find configuration files
|
|
108
|
+
|
|
109
|
+
configuration files reveal framework choices and boundaries:
|
|
110
|
+
|
|
111
|
+
<terminal>find . -maxdepth 3 -type f \( -name "*.toml" -o -name "*.yaml" -o -name "*.yml" -o -name "*.json" -o -name "*.ini" -o -name "*.cfg" \) | grep -v node_modules | grep -v venv | head -20</terminal>
|
|
112
|
+
|
|
113
|
+
<terminal>ls -la *.toml *.yaml *.yml *.json *.ini 2>/dev/null</terminal>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
identify framework indicators
|
|
117
|
+
|
|
118
|
+
python frameworks:
|
|
119
|
+
<terminal>grep -r "from fastapi\|import fastapi\|from flask\|import flask\|from django\|import django" . --include="*.py" | head -10</terminal>
|
|
120
|
+
|
|
121
|
+
<terminal>grep -r "asyncio\|aiohttp\|tornado" . --include="*.py" | head -10</terminal>
|
|
122
|
+
|
|
123
|
+
javascript frameworks:
|
|
124
|
+
<terminal>cat package.json | grep -E '"dependencies"|"devDependencies"' -A50 | grep -E '"express"|"koa"|"fastify"|"hapi"|"nest"|"react"|"vue"|"angular"'</terminal>
|
|
125
|
+
|
|
126
|
+
<terminal>grep -r "require.*express\|import.*express" . --include="*.js" | head -5</terminal>
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
PHASE 2: DIRECTORY STRUCTURE ANALYSIS
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
generate tree structure
|
|
133
|
+
|
|
134
|
+
<terminal>tree -L 3 -I 'node_modules|venv|__pycache__|*.pyc|.git' > architecture-directory-tree.txt</terminal>
|
|
135
|
+
|
|
136
|
+
<terminal>cat architecture-directory-tree.txt</terminal>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
analyze directory patterns
|
|
140
|
+
|
|
141
|
+
common architectural patterns by directory structure:
|
|
142
|
+
|
|
143
|
+
mvc pattern:
|
|
144
|
+
src/
|
|
145
|
+
models/ # data structures
|
|
146
|
+
views/ # presentation layer
|
|
147
|
+
controllers/ # request handling
|
|
148
|
+
tests/
|
|
149
|
+
|
|
150
|
+
layered architecture:
|
|
151
|
+
src/
|
|
152
|
+
controllers/ # external interface
|
|
153
|
+
services/ # business logic
|
|
154
|
+
repositories/# data access
|
|
155
|
+
models/ # domain models
|
|
156
|
+
tests/
|
|
157
|
+
|
|
158
|
+
microservices:
|
|
159
|
+
service-a/
|
|
160
|
+
src/
|
|
161
|
+
api/
|
|
162
|
+
domain/
|
|
163
|
+
infrastructure/
|
|
164
|
+
service-b/
|
|
165
|
+
src/
|
|
166
|
+
api/
|
|
167
|
+
domain/
|
|
168
|
+
infrastructure/
|
|
169
|
+
|
|
170
|
+
plugin architecture:
|
|
171
|
+
core/
|
|
172
|
+
plugins/
|
|
173
|
+
plugins/
|
|
174
|
+
plugin-one/
|
|
175
|
+
plugin-two/
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
analyze module organization
|
|
179
|
+
|
|
180
|
+
<terminal>find . -type f -name "*.py" | head -30 | xargs -I{} sh -c 'echo "=== {} ===" && head -20 {}'</terminal>
|
|
181
|
+
|
|
182
|
+
<terminal>find . -type f -name "*.py" -exec wc -l {} + | sort -rn | head -20</terminal>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
identify public vs private boundaries
|
|
186
|
+
|
|
187
|
+
<terminal>find . -type f -name "__init__.py" | head -20</terminal>
|
|
188
|
+
|
|
189
|
+
<terminal>find . -type f -name "*.py" -exec grep -l "^def " {} \; | head -20</terminal>
|
|
190
|
+
|
|
191
|
+
<terminal>find . -type f -name "*.py" -exec grep -l "^class " {} \; | head -20</terminal>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
PHASE 3: COMPONENT IDENTIFICATION
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
catalog all modules
|
|
198
|
+
|
|
199
|
+
python:
|
|
200
|
+
<terminal>find . -type f -name "*.py" ! -path "*/tests/*" ! -path "*/venv/*" ! -path "*/__pycache__/*" | sort</terminal>
|
|
201
|
+
|
|
202
|
+
javascript:
|
|
203
|
+
<terminal>find . -type f -name "*.js" ! -path "*/node_modules/*" ! -path "*/dist/*" ! -path "*/build/*" | sort</terminal>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
identify component responsibilities
|
|
207
|
+
|
|
208
|
+
for each significant module, document:
|
|
209
|
+
[ ] component name
|
|
210
|
+
[ ] primary purpose
|
|
211
|
+
[ ] public interface
|
|
212
|
+
[ ] dependencies
|
|
213
|
+
[ ] data structures
|
|
214
|
+
|
|
215
|
+
example component catalog format:
|
|
216
|
+
|
|
217
|
+
component: UserService
|
|
218
|
+
location: src/services/user_service.py
|
|
219
|
+
purpose: manage user lifecycle and authentication
|
|
220
|
+
public interface:
|
|
221
|
+
- create_user(email, password, metadata)
|
|
222
|
+
- authenticate_user(email, password)
|
|
223
|
+
- get_user(user_id)
|
|
224
|
+
- update_user(user_id, updates)
|
|
225
|
+
- delete_user(user_id)
|
|
226
|
+
dependencies:
|
|
227
|
+
- UserRepository (data access)
|
|
228
|
+
- PasswordHasher (security)
|
|
229
|
+
- EmailService (notifications)
|
|
230
|
+
data structures:
|
|
231
|
+
- User (model)
|
|
232
|
+
- UserCreationRequest (dto)
|
|
233
|
+
- UserResponse (dto)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
discover components through imports
|
|
237
|
+
|
|
238
|
+
python:
|
|
239
|
+
<terminal>grep -r "^import\|^from" . --include="*.py" ! -path "*/tests/*" ! -path "*/venv/*" | grep -v "__pycache__" | sort -u | head -50</terminal>
|
|
240
|
+
|
|
241
|
+
analyze import patterns to reveal relationships:
|
|
242
|
+
- circular dependencies (bad)
|
|
243
|
+
- abstraction layers
|
|
244
|
+
- shared utilities
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
identify core vs peripheral components
|
|
248
|
+
|
|
249
|
+
core components:
|
|
250
|
+
- domain models
|
|
251
|
+
- business logic
|
|
252
|
+
- core services
|
|
253
|
+
|
|
254
|
+
peripheral components:
|
|
255
|
+
- adapters/integrations
|
|
256
|
+
- ui/presentation
|
|
257
|
+
- infrastructure
|
|
258
|
+
- utilities
|
|
259
|
+
|
|
260
|
+
<terminal>find . -type f -name "*.py" -exec grep -l "class.*Service\|class.*Manager\|class.*Controller" {} \; | grep -v test | grep -v venv</terminal>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
PHASE 4: DATA FLOW TRACING
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
trace request flow
|
|
267
|
+
|
|
268
|
+
web applications - trace incoming request:
|
|
269
|
+
|
|
270
|
+
[1] identify web framework entry point
|
|
271
|
+
[2] find route definitions
|
|
272
|
+
[3] trace middleware chain
|
|
273
|
+
[4] identify controller/handler
|
|
274
|
+
[5] trace service layer calls
|
|
275
|
+
[6] identify data access layer
|
|
276
|
+
[7] trace response path
|
|
277
|
+
|
|
278
|
+
python flask example:
|
|
279
|
+
<terminal>grep -r "@app.route\|@blueprint.route" . --include="*.py" | head -20</terminal>
|
|
280
|
+
|
|
281
|
+
<terminal>grep -r "app = Flask(" . --include="*.py"</terminal>
|
|
282
|
+
|
|
283
|
+
python fastapi example:
|
|
284
|
+
<terminal>grep -r "@app\.\(get\|post\|put\|delete\|patch\)" . --include="*.py" | head -20</terminal>
|
|
285
|
+
|
|
286
|
+
<terminal>grep -r "APIRouter(" . --include="*.py" | head -20</terminal>
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
trace function call chains
|
|
290
|
+
|
|
291
|
+
for a given entry point:
|
|
292
|
+
|
|
293
|
+
<read><file>src/main.py</file></read>
|
|
294
|
+
|
|
295
|
+
document the call chain:
|
|
296
|
+
main.py -> app.initialize()
|
|
297
|
+
-> load_config()
|
|
298
|
+
-> init_database()
|
|
299
|
+
-> register_routes()
|
|
300
|
+
-> start_server()
|
|
301
|
+
|
|
302
|
+
<terminal>grep -r "def initialize\|class.*Manager\|class.*Service" . --include="*.py" | grep -v test | head -30</terminal>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
trace data transformations
|
|
306
|
+
|
|
307
|
+
identify where data changes form:
|
|
308
|
+
|
|
309
|
+
[ ] dto to model conversions
|
|
310
|
+
[ ] model to entity conversions
|
|
311
|
+
[ ] serialization/deserialization
|
|
312
|
+
[ ] formatting/presentation layer
|
|
313
|
+
|
|
314
|
+
<terminal>grep -r "serialize\|deserialize\|to_dict\|from_dict\|to_model\|from_model" . --include="*.py" | head -20</terminal>
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
trace database interactions
|
|
318
|
+
|
|
319
|
+
<terminal>grep -r "session\|connection\|cursor\|query\|execute" . --include="*.py" | grep -E "SELECT|INSERT|UPDATE|DELETE|CREATE" | head -20</terminal>
|
|
320
|
+
|
|
321
|
+
python orm tracing:
|
|
322
|
+
<terminal>grep -r "session\.add\|session\.commit\|session\.query\|\.filter\|\.all\(\)\|\.first\(\)" . --include="*.py" | head -30</terminal>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
PHASE 5: DEPENDENCY MAPPING
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
map internal dependencies
|
|
329
|
+
|
|
330
|
+
direct dependencies:
|
|
331
|
+
<terminal>grep -r "^import\|^from" . --include="*.py" ! -path "*/tests/*" ! -path "*/venv/*" | sed 's/from \(.*\) import.*/\1/' | sort -u</terminal>
|
|
332
|
+
|
|
333
|
+
<terminal>grep -r "^import\|^from" . --include="*.py" ! -path "*/tests/*" ! -path "*/venv/*" | sed 's/import \(.*\)/\1/' | sort -u</terminal>
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
detect circular dependencies
|
|
337
|
+
|
|
338
|
+
<terminal>grep -r "^import" . --include="*.py" -A1 | grep -B1 "^--$" | head -40</terminal>
|
|
339
|
+
|
|
340
|
+
python-specific circular detection:
|
|
341
|
+
<terminal>python -c "
|
|
342
|
+
import ast
|
|
343
|
+
import sys
|
|
344
|
+
from pathlib import Path
|
|
345
|
+
|
|
346
|
+
def find_imports(filename):
|
|
347
|
+
with open(filename) as f:
|
|
348
|
+
tree = ast.parse(f.read(), filename=filename)
|
|
349
|
+
imports = set()
|
|
350
|
+
for node in ast.walk(tree):
|
|
351
|
+
if isinstance(node, ast.Import):
|
|
352
|
+
for alias in node.names:
|
|
353
|
+
imports.add(alias.name.split('.')[0])
|
|
354
|
+
elif isinstance(node, ast.ImportFrom):
|
|
355
|
+
if node.module:
|
|
356
|
+
imports.add(node.module.split('.')[0])
|
|
357
|
+
return imports
|
|
358
|
+
|
|
359
|
+
# check pairs for circular references
|
|
360
|
+
"</terminal>
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
map external dependencies
|
|
364
|
+
|
|
365
|
+
python:
|
|
366
|
+
<terminal>cat requirements.txt 2>/dev/null || cat pyproject.toml 2>/dev/null | grep -A50 "dependencies"</terminal>
|
|
367
|
+
|
|
368
|
+
<terminal>pip list | grep -v "Package\|---"</terminal>
|
|
369
|
+
|
|
370
|
+
javascript:
|
|
371
|
+
<terminal>cat package.json | grep -A100 '"dependencies"'</terminal>
|
|
372
|
+
|
|
373
|
+
<terminal>npm list --depth=0 2>/dev/null</terminal>
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
categorize dependencies by layer
|
|
377
|
+
|
|
378
|
+
application layers:
|
|
379
|
+
[ ] presentation (ui, api)
|
|
380
|
+
[ ] business logic (services, domain)
|
|
381
|
+
[ ] data access (repositories, orm)
|
|
382
|
+
[ ] infrastructure (database, messaging, caching)
|
|
383
|
+
[ ] utilities (logging, validation, formatting)
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
PHASE 6: API INTERFACE DOCUMENTATION
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
discover rest endpoints
|
|
390
|
+
|
|
391
|
+
python frameworks:
|
|
392
|
+
<terminal>grep -r "@app\.\|@router\.\|@bp\." . --include="*.py" | grep -E "get|post|put|delete|patch" | head -30</terminal>
|
|
393
|
+
|
|
394
|
+
<terminal>grep -r "route(" . --include="*.py" | head -20</terminal>
|
|
395
|
+
|
|
396
|
+
javascript express:
|
|
397
|
+
<terminal>grep -r "app\.\(get\|post\|put\|delete\|patch\)\|router\.\(get\|post\|put\|delete\|patch\)" . --include="*.js" | head -30</terminal>
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
document api schema
|
|
401
|
+
|
|
402
|
+
for each endpoint discovered:
|
|
403
|
+
[ ] http method
|
|
404
|
+
[ ] path/route
|
|
405
|
+
[ ] path parameters
|
|
406
|
+
[ ] query parameters
|
|
407
|
+
[ ] request body schema
|
|
408
|
+
[ ] response schema
|
|
409
|
+
[ ] status codes
|
|
410
|
+
[ ] authentication requirements
|
|
411
|
+
|
|
412
|
+
example documentation format:
|
|
413
|
+
|
|
414
|
+
endpoint: POST /api/users
|
|
415
|
+
handler: UserService.create_user
|
|
416
|
+
request body:
|
|
417
|
+
email: string (required, unique)
|
|
418
|
+
password: string (required, min 8 chars)
|
|
419
|
+
name: string (optional)
|
|
420
|
+
response:
|
|
421
|
+
201: {id: uuid, email: string, name: string, created_at: timestamp}
|
|
422
|
+
400: {error: string, details: array}
|
|
423
|
+
409: {error: "user_exists"}
|
|
424
|
+
authentication: bearer token required
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
discover message/event interfaces
|
|
428
|
+
|
|
429
|
+
event-driven systems:
|
|
430
|
+
|
|
431
|
+
<terminal>grep -r "emit\|publish\|subscribe\|on(" . --include="*.py" --include="*.js" | head -30</terminal>
|
|
432
|
+
|
|
433
|
+
<terminal>grep -r "Event\|Message\|Command\|Query" . --include="*.py" | grep "class " | head -30</terminal>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
discover rpc/service interfaces
|
|
437
|
+
|
|
438
|
+
grpc, thrift, custom rpc:
|
|
439
|
+
<terminal>find . -name "*.proto" -o -name "*.thrift"</terminal>
|
|
440
|
+
|
|
441
|
+
<terminal>grep -r "@grpc\|@service\|@rpc" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
PHASE 7: ARCHITECTURE PATTERNS RECOGNITION
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
identify architectural style
|
|
448
|
+
|
|
449
|
+
monolithic indicators:
|
|
450
|
+
[ ] single codebase
|
|
451
|
+
[ ] shared database
|
|
452
|
+
[ ] direct function calls
|
|
453
|
+
[ ] tight coupling between modules
|
|
454
|
+
|
|
455
|
+
<terminal>find . -name "requirements.txt" -o -name "package.json" | wc -l</terminal>
|
|
456
|
+
|
|
457
|
+
microservices indicators:
|
|
458
|
+
[ ] multiple independent services
|
|
459
|
+
[ ] service-specific databases
|
|
460
|
+
[ ] inter-service communication via api/messaging
|
|
461
|
+
[ ] separate deployments
|
|
462
|
+
|
|
463
|
+
<terminal>find . -maxdepth 2 -type d -name "service-*" -o -name "*-service"</terminal>
|
|
464
|
+
|
|
465
|
+
layered architecture indicators:
|
|
466
|
+
[ ] clear separation of concerns
|
|
467
|
+
[ ] dependency direction follows layers
|
|
468
|
+
[ ] upper layers depend on lower layers only
|
|
469
|
+
|
|
470
|
+
hexagonal/clean architecture indicators:
|
|
471
|
+
[ ] domain at center, no framework dependencies
|
|
472
|
+
[ ] ports and adapters pattern
|
|
473
|
+
[ ] inward-facing interfaces
|
|
474
|
+
|
|
475
|
+
event-driven indicators:
|
|
476
|
+
[ ] message bus/event system
|
|
477
|
+
[ ] async processing
|
|
478
|
+
[ ] event sourcing
|
|
479
|
+
[ ] cqrs (command query responsibility segregation)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
identify design patterns in use
|
|
483
|
+
|
|
484
|
+
creational patterns:
|
|
485
|
+
<terminal>grep -r "Factory\|Builder\|Singleton\|Prototype" . --include="*.py" --include="*.js" | grep "class " | head -20</terminal>
|
|
486
|
+
|
|
487
|
+
structural patterns:
|
|
488
|
+
<terminal>grep -r "Adapter\|Decorator\|Facade\|Proxy\|Bridge" . --include="*.py" --include="*.js" | grep "class " | head -20</terminal>
|
|
489
|
+
|
|
490
|
+
behavioral patterns:
|
|
491
|
+
<terminal>grep -r "Observer\|Strategy\|Command\|Visitor\|Iterator" . --include="*.py" --include="*.js" | grep "class " | head -20</terminal>
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
identify integration patterns
|
|
495
|
+
|
|
496
|
+
<terminal>grep -r "api\|client\|http\|request\|fetch" . --include="*.py" --include="*.js" | grep -i "def \|class \|function " | head -30</terminal>
|
|
497
|
+
|
|
498
|
+
integration patterns:
|
|
499
|
+
[ ] api client (http/rest)
|
|
500
|
+
[ ] message queue (rabbitmq, kafka, sqs)
|
|
501
|
+
[ ] database integration
|
|
502
|
+
[ ] file system integration
|
|
503
|
+
[ ] cron/scheduled jobs
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
PHASE 8: DATA ARCHITECTURE ANALYSIS
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
identify data storage
|
|
510
|
+
|
|
511
|
+
databases:
|
|
512
|
+
<terminal>grep -r "sqlite\|postgres\|mysql\|mongodb\|redis\|elasticsearch" . --include="*.py" --include="*.js" --include="*.json" --include="*.yaml" | head -20</terminal>
|
|
513
|
+
|
|
514
|
+
<terminal>find . -name "*.db" -o -name "*.sqlite" -o -name "schema.sql"</terminal>
|
|
515
|
+
|
|
516
|
+
file storage:
|
|
517
|
+
<terminal>grep -r "open(\|file\|path\|Path(" . --include="*.py" | grep -v "test" | head -20</terminal>
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
map data models
|
|
521
|
+
|
|
522
|
+
python orm models:
|
|
523
|
+
<terminal>grep -r "class.*\(Base\|Model\|Entity\)" . --include="*.py" | grep -v test | head -30</terminal>
|
|
524
|
+
|
|
525
|
+
<terminal>find . -name "models.py" -o -name "entities.py" -o -name "schemas.py" | head -10</terminal>
|
|
526
|
+
|
|
527
|
+
document each model:
|
|
528
|
+
[ ] model name
|
|
529
|
+
[ ] fields and types
|
|
530
|
+
[ ] constraints
|
|
531
|
+
[ ] relationships
|
|
532
|
+
[ ] indexes
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
identify data access patterns
|
|
536
|
+
|
|
537
|
+
active record (database logic in model):
|
|
538
|
+
<terminal>grep -r "save()\|delete()\|update()" . --include="*.py" | grep "class " | head -20</terminal>
|
|
539
|
+
|
|
540
|
+
repository pattern (separate data access):
|
|
541
|
+
<terminal>find . -name "*repository*.py" -o -name "*dao*.py"</terminal>
|
|
542
|
+
|
|
543
|
+
<terminal>grep -r "class.*Repository\|class.*DAO" . --include="*.py" | head -20</terminal>
|
|
544
|
+
|
|
545
|
+
data mapper (explicit mapper classes):
|
|
546
|
+
<terminal>grep -r "class.*Mapper\|class.*DataMapper" . --include="*.py" | head -20</terminal>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
PHASE 9: COMMUNICATION PATTERNS
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
identify synchronous communication
|
|
553
|
+
|
|
554
|
+
http/rest:
|
|
555
|
+
<terminal>grep -r "requests\.\|urllib\|httpx\|aiohttp\|fetch" . --include="*.py" | head -20</terminal>
|
|
556
|
+
|
|
557
|
+
<terminal>grep -r "axios\|fetch\|XMLHttpRequest" . --include="*.js" | head -20</terminal>
|
|
558
|
+
|
|
559
|
+
grpc:
|
|
560
|
+
<terminal>find . -name "*.proto"</terminal>
|
|
561
|
+
|
|
562
|
+
<terminal>grep -r "grpc\|@grpc" . --include="*.py" --include="*.js" | head -10</terminal>
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
identify asynchronous communication
|
|
566
|
+
|
|
567
|
+
message queues:
|
|
568
|
+
<terminal>grep -r "pika\|kafka\|celery\|rq\|bull\|sqs" . --include="*.py" --include="*.js" --include="*.json" | head -20</terminal>
|
|
569
|
+
|
|
570
|
+
<terminal>grep -r "publish\|subscribe\|emit\|broadcast" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
571
|
+
|
|
572
|
+
websockets:
|
|
573
|
+
<terminal>grep -r "websocket\|socket.io\|ws://" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
574
|
+
|
|
575
|
+
pub/sub:
|
|
576
|
+
<terminal>grep -r "pubsub\|redis.*pub\|event.*bus\|message.*bus" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
identify caching strategies
|
|
580
|
+
|
|
581
|
+
<terminal>grep -r "redis\|memcache\|cache" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
582
|
+
|
|
583
|
+
caching patterns:
|
|
584
|
+
[ ] cache-aside (application managed)
|
|
585
|
+
[ ] read-through (cache provider managed)
|
|
586
|
+
[ ] write-through
|
|
587
|
+
[ ] write-behind
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
PHASE 10: SECURITY ARCHITECTURE
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
identify authentication mechanisms
|
|
594
|
+
|
|
595
|
+
<terminal>grep -r "auth\|login\|jwt\|session\|token\|password" . --include="*.py" --include="*.js" | grep -E "def |class |function " | head -30</terminal>
|
|
596
|
+
|
|
597
|
+
authentication methods:
|
|
598
|
+
[ ] jwt (json web tokens)
|
|
599
|
+
[ ] session-based
|
|
600
|
+
[ ] oauth/oauth2
|
|
601
|
+
[ ] api keys
|
|
602
|
+
[ ] basic auth
|
|
603
|
+
[ ] custom
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
identify authorization patterns
|
|
607
|
+
|
|
608
|
+
<terminal>grep -r "permission\|role\|access\|authorize\|can_\|may_" . --include="*.py" --include="*.js" | grep -E "def |class |function " | head -30</terminal>
|
|
609
|
+
|
|
610
|
+
authorization patterns:
|
|
611
|
+
[ ] rbac (role-based access control)
|
|
612
|
+
[ ] abac (attribute-based)
|
|
613
|
+
[ ] acl (access control lists)
|
|
614
|
+
[ ] custom middleware
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
identify data protection
|
|
618
|
+
|
|
619
|
+
<terminal>grep -r "encrypt\|hash\|salt\|bcrypt\|argon2" . --include="*.py" --include="*.js" | head -20</terminal>
|
|
620
|
+
|
|
621
|
+
<terminal>grep -r "SECRET\|PASSWORD\|API_KEY\|private" . --include="*.py" --include="*.js" --include="*.env*" | head -20</terminal>
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
PHASE 11: TEXT-BASED ARCHITECTURE DIAGRAMS
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
component diagram format
|
|
628
|
+
|
|
629
|
+
component name diagram:
|
|
630
|
+
|
|
631
|
+
[user] -> (web interface) -> [api gateway]
|
|
632
|
+
|
|
|
633
|
+
+-----------------+-----------------+
|
|
634
|
+
| | |
|
|
635
|
+
[auth service] [user service] [content service]
|
|
636
|
+
| | |
|
|
637
|
+
+-----------------+-----------------+
|
|
638
|
+
|
|
|
639
|
+
[database layer]
|
|
640
|
+
|
|
|
641
|
+
+-----------------+-----------------+
|
|
642
|
+
| | |
|
|
643
|
+
[users db] [content db] [cache]
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
data flow diagram format
|
|
647
|
+
|
|
648
|
+
request flow example:
|
|
649
|
+
|
|
650
|
+
client request
|
|
651
|
+
|
|
|
652
|
+
v
|
|
653
|
+
[load balancer]
|
|
654
|
+
|
|
|
655
|
+
v
|
|
656
|
+
[api gateway]
|
|
657
|
+
|
|
|
658
|
+
+--> [auth middleware] --(valid)--> [route handler]
|
|
659
|
+
| |
|
|
660
|
+
| [service layer]
|
|
661
|
+
| |
|
|
662
|
+
| [repository layer]
|
|
663
|
+
| |
|
|
664
|
+
+--(response)------------------ [database]
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
deployment diagram format
|
|
668
|
+
|
|
669
|
+
deployment architecture:
|
|
670
|
+
|
|
671
|
+
[user browser]
|
|
672
|
+
|
|
|
673
|
+
v (https)
|
|
674
|
+
[cdn / static files]
|
|
675
|
+
|
|
|
676
|
+
v
|
|
677
|
+
[load balancer]
|
|
678
|
+
|
|
|
679
|
+
+-------+-------+
|
|
680
|
+
| | |
|
|
681
|
+
v v v
|
|
682
|
+
[app-1] [app-2] [app-3]
|
|
683
|
+
| | |
|
|
684
|
+
+-------+-------+
|
|
685
|
+
|
|
|
686
|
+
v
|
|
687
|
+
[primary database]
|
|
688
|
+
|
|
|
689
|
+
v
|
|
690
|
+
[read replica]
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
sequence diagram format
|
|
694
|
+
|
|
695
|
+
user authentication flow:
|
|
696
|
+
|
|
697
|
+
client api_gateway auth_service database
|
|
698
|
+
| | | |
|
|
699
|
+
|--POST /login------>| | |
|
|
700
|
+
| | | |
|
|
701
|
+
| |--validate------->| |
|
|
702
|
+
| | | |
|
|
703
|
+
| | |--query---------->|
|
|
704
|
+
| | | |
|
|
705
|
+
| | |--user_data------>|
|
|
706
|
+
| | | |
|
|
707
|
+
| |--(token)---------| |
|
|
708
|
+
| | | |
|
|
709
|
+
|<--(200 + jwt)------| | |
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
PHASE 12: ARCHITECTURE DOCUMENTATION TEMPLATE
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
system overview template
|
|
716
|
+
|
|
717
|
+
system: [system name]
|
|
718
|
+
version: [version]
|
|
719
|
+
last updated: [date]
|
|
720
|
+
|
|
721
|
+
overview:
|
|
722
|
+
[description of system purpose and scope]
|
|
723
|
+
|
|
724
|
+
key characteristics:
|
|
725
|
+
[ ] architectural style (monolith/microservices/etc)
|
|
726
|
+
[ ] primary framework/language
|
|
727
|
+
[ ] main data stores
|
|
728
|
+
[ ] external integrations
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
component catalog template
|
|
732
|
+
|
|
733
|
+
core components:
|
|
734
|
+
|
|
735
|
+
component: [name]
|
|
736
|
+
file: [location]
|
|
737
|
+
purpose: [what it does]
|
|
738
|
+
type: [service/controller/repository/etc]
|
|
739
|
+
|
|
740
|
+
responsibilities:
|
|
741
|
+
- [responsibility 1]
|
|
742
|
+
- [responsibility 2]
|
|
743
|
+
- [responsibility 3]
|
|
744
|
+
|
|
745
|
+
public interface:
|
|
746
|
+
- [method/function 1]: [description]
|
|
747
|
+
- [method/function 2]: [description]
|
|
748
|
+
|
|
749
|
+
dependencies:
|
|
750
|
+
- [dependency 1]: [how its used]
|
|
751
|
+
- [dependency 2]: [how its used]
|
|
752
|
+
|
|
753
|
+
data structures:
|
|
754
|
+
- [structure 1]: [purpose]
|
|
755
|
+
- [structure 2]: [purpose]
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
data flow template
|
|
759
|
+
|
|
760
|
+
flow: [flow name]
|
|
761
|
+
trigger: [what initiates this flow]
|
|
762
|
+
|
|
763
|
+
steps:
|
|
764
|
+
[1] [component] -> [action]
|
|
765
|
+
[2] [component] -> [action]
|
|
766
|
+
[3] [component] -> [action]
|
|
767
|
+
|
|
768
|
+
data transformations:
|
|
769
|
+
- [transformation 1]: [from type] -> [to type]
|
|
770
|
+
- [transformation 2]: [from type] -> [to type]
|
|
771
|
+
|
|
772
|
+
error handling:
|
|
773
|
+
- [error scenario 1]: [handling approach]
|
|
774
|
+
- [error scenario 2]: [handling approach]
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
integration catalog template
|
|
778
|
+
|
|
779
|
+
integration: [name]
|
|
780
|
+
type: [api/database/message queue/file]
|
|
781
|
+
|
|
782
|
+
direction: [inbound/outbound/bidirectional]
|
|
783
|
+
|
|
784
|
+
protocol:
|
|
785
|
+
- transport: [http/tcp/etc]
|
|
786
|
+
- format: [json/xml/protobuf/etc]
|
|
787
|
+
- authentication: [method]
|
|
788
|
+
|
|
789
|
+
operations:
|
|
790
|
+
- [operation 1]: [description]
|
|
791
|
+
- [operation 2]: [description]
|
|
792
|
+
|
|
793
|
+
reliability:
|
|
794
|
+
- retry strategy: [description]
|
|
795
|
+
- timeout: [value]
|
|
796
|
+
- fallback: [description]
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
PHASE 13: ARCHITECTURE CHECKLIST
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
structural checklist
|
|
803
|
+
|
|
804
|
+
component organization:
|
|
805
|
+
[ ] all major components identified
|
|
806
|
+
[ ] component responsibilities documented
|
|
807
|
+
[ ] component interfaces documented
|
|
808
|
+
[ ] dependencies between components mapped
|
|
809
|
+
[ ] circular dependencies noted
|
|
810
|
+
|
|
811
|
+
layer separation:
|
|
812
|
+
[ ] presentation layer identified
|
|
813
|
+
[ ] business logic layer identified
|
|
814
|
+
[ ] data access layer identified
|
|
815
|
+
[ ] dependency direction documented
|
|
816
|
+
[ ] layer violations noted
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
data flow checklist
|
|
820
|
+
|
|
821
|
+
request handling:
|
|
822
|
+
[ ] entry points documented
|
|
823
|
+
[ ] middleware chain documented
|
|
824
|
+
[ ] request routing documented
|
|
825
|
+
[ ] handler functions identified
|
|
826
|
+
[ ] response path documented
|
|
827
|
+
|
|
828
|
+
data transformation:
|
|
829
|
+
[ ] input validation documented
|
|
830
|
+
[ ] dto/model conversions documented
|
|
831
|
+
[ ] serialization format documented
|
|
832
|
+
[ ] output formatting documented
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
integration checklist
|
|
836
|
+
|
|
837
|
+
external systems:
|
|
838
|
+
[ ] all external apis catalogued
|
|
839
|
+
[ ] authentication methods documented
|
|
840
|
+
[ ] rate limits documented
|
|
841
|
+
[ ] error handling documented
|
|
842
|
+
|
|
843
|
+
data stores:
|
|
844
|
+
[ ] all databases identified
|
|
845
|
+
[ ] schema relationships documented
|
|
846
|
+
[ ] access patterns documented
|
|
847
|
+
[ ] migration strategy noted
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
security checklist
|
|
851
|
+
|
|
852
|
+
authentication:
|
|
853
|
+
[ ] auth method documented
|
|
854
|
+
[ ] token storage documented
|
|
855
|
+
[ ] session management documented
|
|
856
|
+
[ ] password handling documented
|
|
857
|
+
|
|
858
|
+
authorization:
|
|
859
|
+
[ ] access control model documented
|
|
860
|
+
[ ] role definitions documented
|
|
861
|
+
[ ] permission checks noted
|
|
862
|
+
|
|
863
|
+
data protection:
|
|
864
|
+
[ ] encryption at rest noted
|
|
865
|
+
[ ] encryption in transit noted
|
|
866
|
+
[ ] sensitive data handling documented
|
|
867
|
+
[ ] secrets management documented
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
PHASE 14: ARCHITECTURE ASSESSMENT
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
assess coupling
|
|
874
|
+
|
|
875
|
+
coupling indicators:
|
|
876
|
+
[ ] many imports between modules = high coupling
|
|
877
|
+
[ ] circular dependencies = very high coupling
|
|
878
|
+
[ ] direct database access from ui = tight coupling
|
|
879
|
+
[ ] shared global state = tight coupling
|
|
880
|
+
|
|
881
|
+
measure coupling:
|
|
882
|
+
<terminal>grep -r "^import\|^from" . --include="*.py" ! -path "*/tests/*" | wc -l</terminal>
|
|
883
|
+
|
|
884
|
+
<terminal>for file in $(find . -name "*.py" ! -path "*/venv/*"); do echo "$file: $(grep '^from\|^import' "$file" | wc -l) imports"; done | sort -t: -k2 -rn | head -20</terminal>
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
assess cohesion
|
|
888
|
+
|
|
889
|
+
cohesion indicators:
|
|
890
|
+
[ ] module has single clear purpose = high cohesion
|
|
891
|
+
[ ] functions relate to each other = high cohesion
|
|
892
|
+
[ ] mixed concerns in module = low cohesion
|
|
893
|
+
[ ] god objects = low cohesion
|
|
894
|
+
|
|
895
|
+
identify low cohesion:
|
|
896
|
+
<terminal>find . -name "*.py" -exec wc -l {} \; | sort -rn | head -10</terminal>
|
|
897
|
+
|
|
898
|
+
<terminal>find . -name "*.py" -size +50k</terminal>
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
assess complexity
|
|
902
|
+
|
|
903
|
+
cyclomatic complexity estimation:
|
|
904
|
+
<terminal>grep -r "if\|elif\|for\|while\|except\|case" . --include="*.py" | wc -l</terminal>
|
|
905
|
+
|
|
906
|
+
identify complex modules:
|
|
907
|
+
<terminal>for file in $(find . -name "*.py" ! -path "*/tests/*"); do echo "$file: $(grep 'if\|elif\|for\|while\|except' "$file" | wc -l) branches"; done | sort -t: -k2 -rn | head -20</terminal>
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
assess modifiability
|
|
911
|
+
|
|
912
|
+
change impact analysis:
|
|
913
|
+
[ ] changing a format affects how many files?
|
|
914
|
+
[ ] adding a field affects how many modules?
|
|
915
|
+
[ ] replacing a dependency requires how many changes?
|
|
916
|
+
|
|
917
|
+
<terminal>grep -r "import.*requests\|from requests" . --include="*.py" | wc -l</terminal>
|
|
918
|
+
|
|
919
|
+
<terminal>grep -r "class.*Model\|class.*Entity" . --include="*.py" | head -20</terminal>
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
PHASE 15: DOCUMENTING ARCHITECTURE DECISIONS
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
record architectural decisions
|
|
926
|
+
|
|
927
|
+
use adr (architecture decision record) format:
|
|
928
|
+
|
|
929
|
+
adr template:
|
|
930
|
+
|
|
931
|
+
title: [decision title]
|
|
932
|
+
status: [proposed/accepted/deprecated/superseded]
|
|
933
|
+
date: [yyyy-mm-dd]
|
|
934
|
+
context: [what situation required this decision]
|
|
935
|
+
decision: [what was decided]
|
|
936
|
+
consequences: [positive and negative outcomes]
|
|
937
|
+
|
|
938
|
+
example:
|
|
939
|
+
|
|
940
|
+
title: use postgresql as primary database
|
|
941
|
+
status: accepted
|
|
942
|
+
date: 2024-01-15
|
|
943
|
+
context: application requires relational data with complex queries
|
|
944
|
+
and transactions. team has postgresql experience.
|
|
945
|
+
decision: postgresql will be the primary data store.
|
|
946
|
+
consequences:
|
|
947
|
+
positive: familiar to team, excellent query capabilities
|
|
948
|
+
positive: good tooling and monitoring ecosystem
|
|
949
|
+
negative: requires separate database server
|
|
950
|
+
negative: vertical scaling required for write volume
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
identify decision points
|
|
954
|
+
|
|
955
|
+
look for evidence of decisions:
|
|
956
|
+
[ ] framework selection
|
|
957
|
+
[ ] database choice
|
|
958
|
+
[ ] architecture pattern
|
|
959
|
+
[ ] integration approaches
|
|
960
|
+
[ ] deployment strategy
|
|
961
|
+
|
|
962
|
+
<terminal>find . -name "requirements.txt" -o -name "package.json" -o -name "pom.xml"</terminal>
|
|
963
|
+
|
|
964
|
+
<terminal>find . -name "docker-compose.yml" -o -name "Dockerfile" -o -name "kubernetes"</terminal>
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
PHASE 16: RESEARCH RULES (STRICT MODE)
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
while this skill is active, these rules are MANDATORY:
|
|
971
|
+
|
|
972
|
+
[1] NEVER modify code during architecture mapping
|
|
973
|
+
this is research only
|
|
974
|
+
document findings, do not change implementation
|
|
975
|
+
|
|
976
|
+
[2] use ONLY <terminal> and <read> tags
|
|
977
|
+
no <edit> or <create> tags allowed
|
|
978
|
+
observation, not modification
|
|
979
|
+
|
|
980
|
+
[3] document everything discovered
|
|
981
|
+
if you find a component, document it
|
|
982
|
+
if you find a pattern, document it
|
|
983
|
+
if you find an issue, document it
|
|
984
|
+
|
|
985
|
+
[4] verify before documenting
|
|
986
|
+
trace imports to confirm dependencies
|
|
987
|
+
trace function calls to confirm data flow
|
|
988
|
+
trace file reads to confirm data access
|
|
989
|
+
|
|
990
|
+
[5] maintain structural hierarchy
|
|
991
|
+
start with big picture
|
|
992
|
+
drill into specific areas
|
|
993
|
+
maintain context between levels
|
|
994
|
+
|
|
995
|
+
[6] use concrete evidence
|
|
996
|
+
quote actual code in findings
|
|
997
|
+
show actual directory structure
|
|
998
|
+
provide actual file locations
|
|
999
|
+
|
|
1000
|
+
[7] distinguish observation from interpretation
|
|
1001
|
+
clearly separate what you see from what you think it means
|
|
1002
|
+
label assumptions as such
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
PHASE 17: ARCHITECTURE MAPPING SESSION CHECKLIST
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
before starting:
|
|
1009
|
+
|
|
1010
|
+
[ ] code analysis tools available
|
|
1011
|
+
[ ] project directory accessible
|
|
1012
|
+
[ ] output directory created for findings
|
|
1013
|
+
[ ] existing documentation reviewed
|
|
1014
|
+
[ ] entry point identified
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
during investigation:
|
|
1018
|
+
|
|
1019
|
+
[ ] directory structure documented
|
|
1020
|
+
[ ] all source files catalogued
|
|
1021
|
+
[ ] entry points identified
|
|
1022
|
+
[ ] framework determined
|
|
1023
|
+
[ ] major components catalogued
|
|
1024
|
+
[ ] component responsibilities documented
|
|
1025
|
+
[ ] dependencies mapped
|
|
1026
|
+
[ ] data flows traced
|
|
1027
|
+
[ ] interfaces documented
|
|
1028
|
+
[ ] integrations catalogued
|
|
1029
|
+
[ ] security mechanisms noted
|
|
1030
|
+
[ ] architectural patterns identified
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
for each component:
|
|
1034
|
+
|
|
1035
|
+
[ ] file location
|
|
1036
|
+
[ ] purpose and responsibility
|
|
1037
|
+
[ ] public interface
|
|
1038
|
+
[ ] dependencies (incoming and outgoing)
|
|
1039
|
+
[ ] data structures used
|
|
1040
|
+
[ ] integration points
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
for each data flow:
|
|
1044
|
+
|
|
1045
|
+
[ ] trigger/initiator
|
|
1046
|
+
[ ] processing steps
|
|
1047
|
+
[ ] data transformations
|
|
1048
|
+
[ ] storage operations
|
|
1049
|
+
[ ] response path
|
|
1050
|
+
[ ] error handling
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
after completing:
|
|
1054
|
+
|
|
1055
|
+
[ ] all findings documented
|
|
1056
|
+
[ ] diagrams created (text-based)
|
|
1057
|
+
[ ] component catalog complete
|
|
1058
|
+
[ ] integration catalog complete
|
|
1059
|
+
[ ] decision records drafted
|
|
1060
|
+
[ ] assumptions listed
|
|
1061
|
+
[ ] gaps in documentation noted
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
FINAL REMINDERS
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
architecture mapping is forensic work
|
|
1068
|
+
|
|
1069
|
+
you are a detective, not an architect.
|
|
1070
|
+
observe, document, analyze.
|
|
1071
|
+
do not judge, do not suggest changes.
|
|
1072
|
+
let the evidence speak.
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
documentation is for humans
|
|
1076
|
+
|
|
1077
|
+
write clearly.
|
|
1078
|
+
use examples.
|
|
1079
|
+
show context.
|
|
1080
|
+
explain connections.
|
|
1081
|
+
|
|
1082
|
+
future developers will thank you.
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
when in doubt
|
|
1086
|
+
|
|
1087
|
+
document more rather than less.
|
|
1088
|
+
capture the uncertainty.
|
|
1089
|
+
label your assumptions.
|
|
1090
|
+
leave breadcrumbs for the next investigator.
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
the goal
|
|
1094
|
+
|
|
1095
|
+
complete understanding of how the system works.
|
|
1096
|
+
comprehensive documentation for future work.
|
|
1097
|
+
evidence base for architectural decisions.
|
|
1098
|
+
|
|
1099
|
+
now go discover and document.
|