fraim-framework 2.0.30 → 2.0.33

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.
Files changed (67) hide show
  1. package/dist/src/cli/commands/init.js +29 -2
  2. package/dist/src/cli/commands/sync.js +18 -1
  3. package/dist/src/utils/script-sync-utils.js +218 -0
  4. package/dist/tests/debug-tools.js +6 -5
  5. package/dist/tests/test-chalk-regression.js +58 -8
  6. package/dist/tests/test-cli.js +70 -5
  7. package/dist/tests/test-end-to-end-hybrid-validation.js +349 -0
  8. package/dist/tests/test-first-run-journey.js +43 -3
  9. package/dist/tests/test-hybrid-script-execution.js +369 -0
  10. package/dist/tests/test-mcp-connection.js +2 -2
  11. package/dist/tests/test-mcp-issue-integration.js +12 -4
  12. package/dist/tests/test-mcp-lifecycle-methods.js +4 -4
  13. package/dist/tests/test-node-compatibility.js +24 -2
  14. package/dist/tests/test-prep-issue.js +4 -1
  15. package/dist/tests/test-script-location-independence.js +173 -0
  16. package/dist/tests/test-script-sync.js +557 -0
  17. package/dist/tests/test-session-rehydration.js +2 -2
  18. package/dist/tests/test-standalone.js +3 -3
  19. package/dist/tests/test-sync-version-update.js +1 -1
  20. package/dist/tests/test-telemetry.js +2 -2
  21. package/dist/tests/test-user-journey.js +8 -4
  22. package/dist/tests/test-utils.js +13 -0
  23. package/dist/tests/test-wizard.js +2 -2
  24. package/package.json +3 -3
  25. package/registry/rules/agent-testing-guidelines.md +502 -502
  26. package/registry/rules/ephemeral-execution.md +37 -27
  27. package/registry/rules/local-development.md +253 -251
  28. package/registry/rules/successful-debugging-patterns.md +491 -482
  29. package/registry/scripts/prep-issue.sh +468 -468
  30. package/registry/workflows/bootstrap/evaluate-code-quality.md +8 -2
  31. package/registry/workflows/bootstrap/verify-test-coverage.md +8 -2
  32. package/registry/workflows/customer-development/thank-customers.md +203 -193
  33. package/registry/workflows/customer-development/weekly-newsletter.md +366 -362
  34. package/registry/workflows/performance/analyze-performance.md +65 -63
  35. package/registry/workflows/product-building/implement.md +6 -2
  36. package/registry/workflows/product-building/prep-issue.md +11 -24
  37. package/registry/workflows/product-building/resolve.md +5 -1
  38. package/registry/workflows/replicate/replicate-discovery.md +336 -0
  39. package/registry/workflows/replicate/replicate-to-issues.md +319 -0
  40. package/registry/workflows/reviewer/review-implementation-vs-design-spec.md +632 -632
  41. package/.windsurf/rules/windsurf-rules.md +0 -7
  42. package/.windsurf/workflows/resolve-issue.md +0 -6
  43. package/.windsurf/workflows/retrospect.md +0 -6
  44. package/.windsurf/workflows/start-design.md +0 -6
  45. package/.windsurf/workflows/start-impl.md +0 -6
  46. package/.windsurf/workflows/start-spec.md +0 -6
  47. package/.windsurf/workflows/start-tests.md +0 -6
  48. package/bin/fraim.js +0 -23
  49. package/registry/scripts/build-scripts-generator.ts +0 -216
  50. package/registry/scripts/cleanup-branch.ts +0 -303
  51. package/registry/scripts/fraim-config.ts +0 -63
  52. package/registry/scripts/generate-engagement-emails.ts +0 -744
  53. package/registry/scripts/generic-issues-api.ts +0 -110
  54. package/registry/scripts/newsletter-helpers.ts +0 -874
  55. package/registry/scripts/openapi-generator.ts +0 -695
  56. package/registry/scripts/performance/profile-server.ts +0 -370
  57. package/registry/scripts/run-thank-you-workflow.ts +0 -122
  58. package/registry/scripts/send-newsletter-simple.ts +0 -104
  59. package/registry/scripts/send-thank-you-emails.ts +0 -57
  60. package/registry/workflows/replicate/re-implementation-strategy.md +0 -226
  61. package/registry/workflows/replicate/use-case-extraction.md +0 -135
  62. package/registry/workflows/replicate/visual-analysis.md +0 -154
  63. package/registry/workflows/replicate/website-discovery-analysis.md +0 -231
  64. package/sample_package.json +0 -18
  65. /package/registry/scripts/{replicate/comprehensive-explorer.py → comprehensive-explorer.py} +0 -0
  66. /package/registry/scripts/{replicate/interactive-explorer.py → interactive-explorer.py} +0 -0
  67. /package/registry/scripts/{replicate/scrape-site.py → scrape-site.py} +0 -0
@@ -1,63 +1,65 @@
1
- # Performance Analysis Phase
2
-
3
- ## INTENT
4
- To diagnose production performance issues (CPU, Memory, Swap) and provide actionable recommendations for stabilization without performing direct application or infrastructure modifications.
5
-
6
- ## PRINCIPLES
7
- - **Observational Only**: Do not modify code or infrastructure during this phase.
8
- - **Data-Driven**: Base all recommendations on metrics collected from the environment.
9
- - **Non-Invasive**: Use non-destructive commands that do not impact server stability.
10
- - **Actionable**: Provide clear, prioritized recommendations for remediation.
11
-
12
- ## ANALYSIS WORKFLOW
13
-
14
- ### Step 1: Run the Performance Profiler
15
- Execute the profiling script against the production environment to collect plan-level and process-level metrics.
16
- // turbo
17
- ```bash
18
- # 1. Fetch profile-server.ts using get_fraim_file and save to machine temp
19
- # (Agent implementation detail: use os.tmpdir())
20
-
21
- # 2. Run from temp
22
- npx tsx /path/to/temp/profile-server.ts --prod
23
- ```
24
-
25
- ### Step 2: Inspect Automated Diagnosis
26
- Review the "Step 4: Automated Diagnosis" section of the output.
27
- It will specifically check for:
28
- - **Swap Death**: If >95% swap is used, the server is thrashing.
29
- - **Absent Application**: If `server.js` is missing, the infrastructure is healthy but the app is crashed/not starting.
30
- - **Infrastructure Hogs**: If Azure agents (Kudu/dotnet) are consuming excessive RAM.
31
-
32
- ### Step 3: Deep Dive Log Analysis
33
- If a crash loop or high operation frequency is suspected, collect and analyze application logs.
34
- ```bash
35
- npx tsx tmp/profile-server.ts --prod --logs
36
- ```
37
- Look for:
38
- - Frequency of initialization logs (e.g., "Ensured unique index").
39
- - Patterns indicative of OOM events or unhandled exceptions.
40
- - High volume of specific operations (e.g., decryptions) suggesting an infinite loop.
41
-
42
- ### Step 4: Formulate Recommendations
43
- Based on the diagnosis, provide specific recommendations in your response or an implementation plan (if a fix is needed in a subsequent phase).
44
- Examples:
45
- - **Restart**: If swap usage is high or rogue processes are detected.
46
- - **Upgrade Plan**: If physical memory is chronically saturated (B1 to P1v3).
47
- - **Code Optimization**: If log analysis reveals initialization loops or leaks.
48
-
49
- ## EXAMPLES
50
-
51
- ### Good Analysis
52
- > "The profiler shows 98% CPU usage and 'Swap Death'. The logs show 'Ensured unique index' occurring 100 times per minute. I recommend implementing an initialization guard in `PrismaDatabaseService` to break this loop."
53
-
54
- ### Bad Analysis (Do not do)
55
- > "I found a loop, so I've updated `server.ts` to fix it."
56
- > *Correction: Propose the fix first, do not implement it within the analysis workflow.*
57
-
58
- ## COMPLETION CHECKLIST
59
- - [ ] Profiler run successfully on production.
60
- - [ ] Resource bottlenecks (CPU/Mem/Swap) identified.
61
- - [ ] Application process stability verified.
62
- - [ ] Root cause hypothesis formulated based on metrics and logs.
63
- - [ ] Prioritized recommendations delivered to the user.
1
+ # Performance Analysis Phase
2
+
3
+ ## INTENT
4
+ To diagnose production performance issues (CPU, Memory, Swap) and provide actionable recommendations for stabilization without performing direct application or infrastructure modifications.
5
+
6
+ ## PRINCIPLES
7
+ - **Observational Only**: Do not modify code or infrastructure during this phase.
8
+ - **Data-Driven**: Base all recommendations on metrics collected from the environment.
9
+ - **Non-Invasive**: Use non-destructive commands that do not impact server stability.
10
+ - **Actionable**: Provide clear, prioritized recommendations for remediation.
11
+
12
+ ## ANALYSIS WORKFLOW
13
+
14
+ ### Step 1: Run the Performance Profiler
15
+ Execute the profiling script against the production environment to collect plan-level and process-level metrics.
16
+
17
+ **Note**: `profile-server.ts` has FRAIM dependencies and requires ephemeral execution.
18
+
19
+ ```bash
20
+ # Get the profile-server script ephemerally (has FRAIM dependencies)
21
+ # Use get_fraim_file({ path: "scripts/performance/profile-server.ts" }) and save to tmp/profile-server.ts
22
+ npx tsx tmp/profile-server.ts --prod
23
+ ```
24
+
25
+ ### Step 2: Inspect Automated Diagnosis
26
+ Review the "Step 4: Automated Diagnosis" section of the output.
27
+ It will specifically check for:
28
+ - **Swap Death**: If >95% swap is used, the server is thrashing.
29
+ - **Absent Application**: If `server.js` is missing, the infrastructure is healthy but the app is crashed/not starting.
30
+ - **Infrastructure Hogs**: If Azure agents (Kudu/dotnet) are consuming excessive RAM.
31
+
32
+ ### Step 3: Deep Dive Log Analysis
33
+ If a crash loop or high operation frequency is suspected, collect and analyze application logs using the same script with the `--logs` flag.
34
+
35
+ ```bash
36
+ # Use the same ephemeral script with logs flag
37
+ npx tsx tmp/profile-server.ts --prod --logs
38
+ ```
39
+ Look for:
40
+ - Frequency of initialization logs (e.g., "Ensured unique index").
41
+ - Patterns indicative of OOM events or unhandled exceptions.
42
+ - High volume of specific operations (e.g., decryptions) suggesting an infinite loop.
43
+
44
+ ### Step 4: Formulate Recommendations
45
+ Based on the diagnosis, provide specific recommendations in your response or an implementation plan (if a fix is needed in a subsequent phase).
46
+ Examples:
47
+ - **Restart**: If swap usage is high or rogue processes are detected.
48
+ - **Upgrade Plan**: If physical memory is chronically saturated (B1 to P1v3).
49
+ - **Code Optimization**: If log analysis reveals initialization loops or leaks.
50
+
51
+ ## EXAMPLES
52
+
53
+ ### Good Analysis
54
+ > "The profiler shows 98% CPU usage and 'Swap Death'. The logs show 'Ensured unique index' occurring 100 times per minute. I recommend implementing an initialization guard in `PrismaDatabaseService` to break this loop."
55
+
56
+ ### Bad Analysis (Do not do)
57
+ > "I found a loop, so I've updated `server.ts` to fix it."
58
+ > *Correction: Propose the fix first, do not implement it within the analysis workflow.*
59
+
60
+ ## COMPLETION CHECKLIST
61
+ - [ ] Profiler run successfully on production.
62
+ - [ ] Resource bottlenecks (CPU/Mem/Swap) identified.
63
+ - [ ] Application process stability verified.
64
+ - [ ] Root cause hypothesis formulated based on metrics and logs.
65
+ - [ ] Prioritized recommendations delivered to the user.
@@ -122,7 +122,11 @@ Before creating PR evidence, verify:
122
122
  Before marking work ready for review, run the pre-PR quality gate:
123
123
 
124
124
  ```bash
125
- Retrieve and run quality check (retrieve via `get_fraim_file({ path: "scripts/code-quality-check.sh" })`)
125
+ # Execute code quality check script directly from synced location
126
+ ~/.fraim/scripts/code-quality-check.sh pre-pr
127
+
128
+ # On Windows:
129
+ # %USERPROFILE%\.fraim\scripts\code-quality-check.sh pre-pr
126
130
  ```
127
131
 
128
132
  ### Step 6: PR Monitoring
@@ -154,7 +158,7 @@ After submitting/updating PR:
154
158
 
155
159
  ### Pre-PR Check Results
156
160
  ```bash
157
- Retrieve and run quality check (retrieve via `get_fraim_file({ path: "scripts/code-quality-check.sh" })`)
161
+ ~/.fraim/scripts/code-quality-check.sh pre-pr
158
162
  ✅ GATE 1: No 'as any' Type Bypassing
159
163
  ✅ GATE 2: TypeScript Compilation
160
164
  ⚠️ GATE 3: Linter (2 warnings - documented below)
@@ -12,21 +12,12 @@ This workflow prepares the local development environment for working on a specif
12
12
  1. **Execute Preparation Script**:
13
13
  Fetch and run cleanup/setup scripts ephemerally.
14
14
 
15
- ```javascript
16
- // 1. Fetch script
17
- const script = await get_fraim_file({ path: "scripts/prep-issue.sh" });
15
+ ```bash
16
+ # Execute the prep-issue script directly from synced location
17
+ ~/.fraim/scripts/prep-issue.sh {issue_number}
18
18
 
19
- // 2. Save to machine temp
20
- const os = require('os');
21
- const path = require('path');
22
- const fs = require('fs');
23
- const fraimTmp = path.join(os.homedir(), '.fraim', 'tmp');
24
- if (!fs.existsSync(fraimTmp)) fs.mkdirSync(fraimTmp, { recursive: true });
25
- const tempPath = path.join(fraimTmp, 'prep-issue.sh');
26
- fs.writeFileSync(tempPath, script);
27
-
28
- // 3. Make executable (if needed) and run
29
- await run_command({ command: `bash ${tempPath} ${issueNumber}` });
19
+ # On Windows:
20
+ # %USERPROFILE%\.fraim\scripts\prep-issue.sh {issue_number}
30
21
  ```
31
22
 
32
23
 
@@ -40,16 +31,12 @@ This workflow prepares the local development environment for working on a specif
40
31
  ## Implementation Detail (Agent Guidance)
41
32
 
42
33
  Execute:
43
- ```javascript
44
- const scriptContent = await get_fraim_file({ path: "scripts/prep-issue.sh" });
45
- const os = require('os');
46
- const path = require('path');
47
- const fs = require('fs');
48
- const fraimTmp = path.join(os.homedir(), '.fraim', 'tmp');
49
- if (!fs.existsSync(fraimTmp)) fs.mkdirSync(fraimTmp, { recursive: true });
50
- const tempPath = path.join(fraimTmp, 'prep-issue.sh');
51
- fs.writeFileSync(tempPath, scriptContent);
52
- await run_command({ command: `bash ${tempPath} ${issueNumber}` });
34
+ ```bash
35
+ # Execute the prep-issue script directly from synced location
36
+ ~/.fraim/scripts/prep-issue.sh {issue_number}
37
+
38
+ # On Windows:
39
+ # %USERPROFILE%\.fraim\scripts\prep-issue.sh {issue_number}
53
40
  ```
54
41
 
55
42
  > [!NOTE]
@@ -122,7 +122,11 @@ gh issue close <ISSUE_NUMBER> --comment "✅ Issue resolved and merged to master
122
122
 
123
123
  **Cleanup Branch:**
124
124
  ```bash
125
- # Retrieve and run cleanup script: `get_fraim_file({ path: "scripts/cleanup-branch.ts" })`
125
+ # Execute cleanup script directly from synced location
126
+ npx tsx ~/.fraim/scripts/cleanup-branch.ts {branch_name}
127
+
128
+ # On Windows:
129
+ # npx tsx %USERPROFILE%\.fraim\scripts\cleanup-branch.ts {branch_name}
126
130
  ```
127
131
 
128
132
  ### 7. Celebrate
@@ -0,0 +1,336 @@
1
+ # Replicate Discovery Workflow
2
+
3
+ ## INTENT
4
+ To systematically discover, analyze, and document an existing web application for replication, producing a complete analysis package that can be converted into implementation issues.
5
+
6
+ ## PRINCIPLES
7
+ - **Comprehensive Discovery**: Capture all features, UI patterns, and user workflows
8
+ - **Systematic Analysis**: Follow structured phases from technical scraping to use case extraction
9
+ - **Organized Documentation**: Create well-structured artifacts for downstream workflows
10
+ - **Technology Awareness**: Document the tech stack and architectural patterns
11
+
12
+ ## Overview
13
+ This workflow guides agents through discovering and analyzing an existing web application, producing comprehensive documentation including screenshots, use cases, UI patterns, and technology analysis. The output feeds into the `replicate-to-issues.md` workflow to create GitHub issues for implementation.
14
+
15
+ ## When to Use This Workflow
16
+
17
+ Use this workflow when:
18
+ - Re-implementing an existing application
19
+ - Migrating an application to a new technology stack
20
+ - Creating a feature-complete replica of an application
21
+ - Documenting an existing application for modernization
22
+
23
+ ## Prerequisites
24
+ - Access to the target website URL
25
+ - Python 3.8 or higher
26
+ - Basic understanding of web technologies (HTML, CSS, JavaScript, React)
27
+
28
+ ### Required Python Packages
29
+ The Python scraping scripts are synced to `~/.fraim/scripts/` during `fraim init` or `fraim sync`.
30
+
31
+ Install required packages:
32
+ ```bash
33
+ pip install playwright beautifulsoup4 requests
34
+ ```
35
+
36
+ For Playwright browser automation, install browser binaries:
37
+ ```bash
38
+ playwright install chromium
39
+ ```
40
+
41
+ ## Workflow Steps
42
+
43
+ ### Phase 1: Initial Site Scraping
44
+
45
+ **Objective**: Get a comprehensive understanding of the site structure, pages, and resources.
46
+
47
+ 1. **Create Output Directory Structure**
48
+ ```
49
+ docs/replicate/
50
+ ├── analysis/ # JSON analysis files
51
+ ├── screenshots/ # Organized screenshots
52
+ ├── reports/ # Generated documentation
53
+ └── artifacts/ # Additional artifacts
54
+ ```
55
+
56
+ 2. **Run Basic Site Scraper**
57
+ ```bash
58
+ python ~/.fraim/scripts/scrape-site.py <target_url> --output-dir docs/replicate/analysis [--max-pages N]
59
+ ```
60
+ - **Options**:
61
+ - `target_url`: Base URL of the website to scrape (required)
62
+ - `--max-pages N`: Maximum number of pages to scrape (default: 50)
63
+ - `--output-dir`: Output directory for results
64
+ - `--output-file`: Output filename (default: site_analysis.json)
65
+
66
+ This generates:
67
+ - `docs/replicate/analysis/site_analysis.json` - Page structure, forms, CSS/JS files, images, links
68
+
69
+ 3. **Review Initial Findings**
70
+ - Check `site_analysis.json` for:
71
+ - Total pages discovered
72
+ - Common navigation patterns
73
+ - Form structures
74
+ - Resource dependencies
75
+ - Technology indicators (React, Vue, Angular, etc.)
76
+
77
+ ### Phase 2: Interactive Browser Analysis
78
+
79
+ **Objective**: Understand dynamic behavior, user interactions, and SPA patterns.
80
+
81
+ 1. **Run Interactive Explorer**
82
+ ```bash
83
+ python ~/.fraim/scripts/interactive-explorer.py <target_url> --output-dir docs/replicate [--headless] [--max-clicks N]
84
+ ```
85
+ - **Options**:
86
+ - `target_url`: Base URL of the website to explore (required)
87
+ - `--output-dir`: Output directory for results
88
+ - `--headless`: Run browser in headless mode
89
+ - `--max-clicks N`: Maximum number of clicks to perform (default: 20)
90
+
91
+ This generates:
92
+ - `docs/replicate/analysis/interaction_analysis.json` - Pages visited, interactions, use case hints
93
+ - `docs/replicate/screenshots/` - Screenshots of each state
94
+
95
+ 2. **Run Comprehensive Explorer**
96
+ ```bash
97
+ python ~/.fraim/scripts/comprehensive-explorer.py <target_url> --output-dir docs/replicate [--headless]
98
+ ```
99
+
100
+ This generates:
101
+ - `docs/replicate/analysis/comprehensive_analysis.json` - Detailed page content, routes, use cases
102
+ - Additional screenshots in `docs/replicate/screenshots/`
103
+
104
+ ### Phase 3: Screenshot Organization & Visual Analysis
105
+
106
+ **Objective**: Organize visual assets and identify UI/UX patterns.
107
+
108
+ 1. **Organize Screenshots by Category**
109
+ Create folder structure within `docs/replicate/screenshots/`:
110
+ ```
111
+ screenshots/
112
+ ├── authentication/
113
+ ├── navigation/
114
+ ├── forms/
115
+ ├── lists/
116
+ ├── details/
117
+ └── [feature-specific]/
118
+ ```
119
+
120
+ 2. **Identify UI Component Patterns**
121
+ Document in `docs/replicate/reports/component-catalog.md`:
122
+ - Navigation components (header, sidebar, footer)
123
+ - Form components (inputs, buttons, validation)
124
+ - Card/List components
125
+ - Modal/Dialog patterns
126
+ - Button styles and states
127
+ - Input styles and variations
128
+
129
+ 3. **Analyze Layout Patterns**
130
+ Document in `docs/replicate/reports/layout-patterns.md`:
131
+ - Page layout structures
132
+ - Responsive design patterns
133
+ - Grid systems
134
+ - Spacing and typography
135
+ - Color palette
136
+ - Visual hierarchy
137
+
138
+ 4. **Create Screenshot Index**
139
+ Generate `docs/replicate/reports/screenshot-index.md`:
140
+ - Filename and path
141
+ - Page/Route
142
+ - Description
143
+ - Related use case
144
+ - Key UI elements visible
145
+
146
+ ### Phase 4: Technology Stack Analysis
147
+
148
+ **Objective**: Identify and document the technology stack and architectural patterns.
149
+
150
+ 1. **Analyze Technology Indicators**
151
+ From analysis JSON files, identify:
152
+ - **Frontend Framework**: React, Vue, Angular, vanilla JS
153
+ - **Build Tools**: Webpack, Vite, Parcel
154
+ - **CSS Framework**: Bootstrap, Tailwind, Material-UI, custom
155
+ - **State Management**: Redux, MobX, Context API
156
+ - **Routing**: React Router, Vue Router, etc.
157
+ - **API Patterns**: REST, GraphQL, WebSocket
158
+
159
+ 2. **Document Architecture Patterns**
160
+ Create `docs/replicate/reports/technology-stack.md`:
161
+ - Identified technologies
162
+ - Architectural patterns (SPA, MPA, SSR)
163
+ - Component structure
164
+ - Data flow patterns
165
+ - Authentication approach
166
+ - API integration patterns
167
+
168
+ 3. **Infer Data Models**
169
+ From forms and content, document in `docs/replicate/reports/data-models.md`:
170
+ - Entity types (User, Event, Organization, etc.)
171
+ - Field structures
172
+ - Relationships
173
+ - Validation rules
174
+
175
+ ### Phase 5: Use Case Extraction
176
+
177
+ **Objective**: Systematically identify and document all user workflows.
178
+
179
+ 1. **Identify User Roles**
180
+ From analysis data, identify:
181
+ - Guest/Anonymous users
182
+ - Authenticated users
183
+ - Admin/Moderator roles
184
+ - Organization/Group roles
185
+ - Special roles (Volunteer, Member, etc.)
186
+
187
+ 2. **Extract Use Cases from Data**
188
+ Review all analysis files and:
189
+ - Map user journeys through the application
190
+ - Identify user actions (buttons, forms, links)
191
+ - Group related actions into use cases
192
+ - Document workflows and flows
193
+
194
+ 3. **Organize Use Cases by Category**
195
+ Common categories:
196
+ - **Authentication & Account Management**
197
+ - **Content Discovery & Browsing**
198
+ - **Content Creation & Management**
199
+ - **Search & Filtering**
200
+ - **Data Collection & Reporting**
201
+ - **Administration & Configuration**
202
+ - **Communication & Collaboration**
203
+
204
+ 4. **Document Each Use Case**
205
+ Create `docs/replicate/reports/use-cases.md` with structure:
206
+ ```markdown
207
+ ## Use Case: [Name]
208
+
209
+ **ID**: UC-[number]
210
+ **Actor**: [Who performs this]
211
+ **Category**: [Category name]
212
+ **Priority**: High/Medium/Low
213
+
214
+ **Preconditions**:
215
+ - [What must be true before]
216
+
217
+ **Steps**:
218
+ 1. [Step description]
219
+ 2. [Step description]
220
+ 3. [Step description]
221
+
222
+ **Postconditions**:
223
+ - [Expected outcomes]
224
+
225
+ **Screenshots**:
226
+ - `screenshots/[category]/[filename].png`
227
+
228
+ **Technical Notes**:
229
+ - [API endpoints, data models, etc.]
230
+
231
+ **Acceptance Criteria**:
232
+ - [ ] [Testable criterion]
233
+ - [ ] [Testable criterion]
234
+ ```
235
+
236
+ 5. **Validate Completeness**
237
+ - Every page has associated use cases
238
+ - Every form has documented workflow
239
+ - All navigation paths are covered
240
+ - All user roles are represented
241
+ - Edge cases and error scenarios documented
242
+
243
+ ### Phase 6: Create Master Report
244
+
245
+ **Objective**: Consolidate all findings into a comprehensive report.
246
+
247
+ 1. **Generate Master Report**
248
+ Create `docs/replicate/REPLICATION_ANALYSIS.md`:
249
+ - **Executive Summary**: High-level overview
250
+ - **Technology Stack**: Identified technologies
251
+ - **User Roles**: All identified roles
252
+ - **Use Case Summary**: Count by category and priority
253
+ - **Component Inventory**: UI components identified
254
+ - **Data Models**: Inferred data structures
255
+ - **Implementation Recommendations**: Suggested approach
256
+ - **Next Steps**: Link to replicate-to-issues workflow
257
+
258
+ 2. **Create Quick Reference Index**
259
+ Generate `docs/replicate/INDEX.md`:
260
+ - Links to all reports
261
+ - Use case index with IDs
262
+ - Screenshot index
263
+ - Technology summary
264
+ - Statistics (page count, use case count, etc.)
265
+
266
+ ## Output Artifacts
267
+
268
+ After completing this workflow, you should have in `docs/replicate/`:
269
+
270
+ ### Analysis Data (`analysis/`)
271
+ - `site_analysis.json` - Basic site structure
272
+ - `interaction_analysis.json` - Interactive behavior
273
+ - `comprehensive_analysis.json` - Deep content analysis
274
+
275
+ ### Screenshots (`screenshots/`)
276
+ - Organized by category/feature
277
+ - Named descriptively
278
+ - Cover all pages and key interactions
279
+
280
+ ### Reports (`reports/`)
281
+ - `use-cases.md` - Complete use case documentation
282
+ - `component-catalog.md` - UI component inventory
283
+ - `layout-patterns.md` - Layout and design patterns
284
+ - `technology-stack.md` - Technology analysis
285
+ - `data-models.md` - Inferred data structures
286
+ - `screenshot-index.md` - Screenshot reference
287
+
288
+ ### Master Documents
289
+ - `REPLICATION_ANALYSIS.md` - Comprehensive master report
290
+ - `INDEX.md` - Quick reference index
291
+
292
+ ## Best Practices
293
+
294
+ 1. **Be Thorough**: Don't skip pages or features
295
+ 2. **Document Everything**: Better to have too much information
296
+ 3. **Validate Manually**: Review automated findings manually
297
+ 4. **Organize Early**: Keep structure clean from the start
298
+ 5. **Iterate**: Run scripts multiple times as you discover new routes
299
+ 6. **Be Respectful**: Include delays between requests, respect robots.txt
300
+ 7. **Start Small**: Use limits on initial runs, expand as needed
301
+
302
+ ## Common Challenges
303
+
304
+ 1. **SPA Routing**: React/SPA apps may not expose all routes in HTML
305
+ - **Solution**: Use browser navigation to discover routes
306
+
307
+ 2. **Authentication**: Some pages require login
308
+ - **Solution**: Document login flows, consider authenticated scraping
309
+
310
+ 3. **Dynamic Content**: Content loaded via JavaScript
311
+ - **Solution**: Use browser automation (Playwright)
312
+
313
+ 4. **Rate Limiting**: Too many requests too fast
314
+ - **Solution**: Scripts include delays, adjust as needed
315
+
316
+ ## Troubleshooting
317
+
318
+ ### Browser Installation Issues
319
+ ```bash
320
+ playwright install chromium --force
321
+ ```
322
+
323
+ ### Import Errors
324
+ ```bash
325
+ pip install --upgrade playwright beautifulsoup4 requests
326
+ ```
327
+
328
+ ### Network Timeouts
329
+ - Check internet connection
330
+ - Verify target URL is accessible
331
+ - Increase timeout values in scripts
332
+
333
+ ## Next Steps
334
+
335
+ After completing this workflow, get user feedback and once in agreement, suggest that the user proceed to:
336
+ - **Replicate to Issues** workflow (`workflows/replicate/replicate-to-issues.md`)