bobs-workshop 0.3.2 → 3.1.0

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 (200) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +199 -210
  3. package/bin/bobs-workshop.js +109 -0
  4. package/config/agents.json +27 -0
  5. package/dist/plugins/bobs-workshop.js +34 -0
  6. package/dist/tools/background-agent/cancel.d.ts +3 -0
  7. package/dist/tools/background-agent/cancel.d.ts.map +1 -0
  8. package/dist/tools/background-agent/cancel.js +52 -0
  9. package/dist/tools/background-agent/concurrency.d.ts +15 -0
  10. package/dist/tools/background-agent/concurrency.d.ts.map +1 -0
  11. package/dist/tools/background-agent/concurrency.js +61 -0
  12. package/dist/tools/background-agent/index.d.ts +8 -0
  13. package/dist/tools/background-agent/index.d.ts.map +1 -0
  14. package/dist/tools/background-agent/index.js +7 -0
  15. package/dist/tools/background-agent/launch.d.ts +6 -0
  16. package/dist/tools/background-agent/launch.d.ts.map +1 -0
  17. package/dist/tools/background-agent/launch.js +33 -0
  18. package/dist/tools/background-agent/list.d.ts +7 -0
  19. package/dist/tools/background-agent/list.d.ts.map +1 -0
  20. package/dist/tools/background-agent/list.js +40 -0
  21. package/dist/tools/background-agent/manager.d.ts +29 -0
  22. package/dist/tools/background-agent/manager.d.ts.map +1 -0
  23. package/dist/tools/background-agent/manager.js +377 -0
  24. package/dist/tools/background-agent/output.d.ts +3 -0
  25. package/dist/tools/background-agent/output.d.ts.map +1 -0
  26. package/dist/tools/background-agent/output.js +41 -0
  27. package/dist/tools/background-agent/types.d.ts +46 -0
  28. package/dist/tools/background-agent/types.d.ts.map +1 -0
  29. package/dist/tools/background-agent/types.js +1 -0
  30. package/dist/tools/index.d.ts +9 -0
  31. package/dist/tools/index.d.ts.map +1 -0
  32. package/dist/tools/index.js +8 -0
  33. package/dist/tools/manual/index.d.ts +3 -0
  34. package/dist/tools/manual/index.d.ts.map +1 -0
  35. package/dist/tools/manual/index.js +2 -0
  36. package/dist/tools/manual/manual-update.d.ts +4 -0
  37. package/dist/tools/manual/manual-update.d.ts.map +1 -0
  38. package/dist/tools/manual/manual-update.js +190 -0
  39. package/dist/tools/manual/verify-manual.d.ts +4 -0
  40. package/dist/tools/manual/verify-manual.d.ts.map +1 -0
  41. package/dist/tools/manual/verify-manual.js +46 -0
  42. package/package.json +35 -67
  43. package/postinstall.js +190 -0
  44. package/src/agents/alice.md +466 -0
  45. package/src/agents/bob-rev.md +493 -0
  46. package/src/agents/bob-send.md +277 -0
  47. package/src/agents/bob.md +442 -0
  48. package/src/agents/trace.md +451 -0
  49. package/src/plugins/bobs-workshop.ts +45 -0
  50. package/src/skills/api-patterns/SKILL.md +376 -0
  51. package/src/skills/architecture/SKILL.md +271 -0
  52. package/src/skills/bobs-workshop/performance/icon.svg +3 -0
  53. package/src/skills/brainstorming/SKILL.md +210 -0
  54. package/src/skills/clean-code/SKILL.md +151 -0
  55. package/src/skills/code-review-checklist/SKILL.md +220 -0
  56. package/src/skills/database-design/SKILL.md +271 -0
  57. package/src/skills/exploration/SKILL.md +257 -0
  58. package/src/skills/frontend-ui-ux/SKILL.md +78 -0
  59. package/src/skills/git-master/SKILL.md +1105 -0
  60. package/src/skills/performance/SKILL.md +144 -0
  61. package/src/skills/performance/icon.svg +3 -0
  62. package/src/skills/plan-writing/SKILL.md +225 -0
  63. package/src/skills/security/SKILL.md +410 -0
  64. package/src/skills/simplification/SKILL.md +238 -0
  65. package/src/skills/systematic-debugging/SKILL.md +175 -0
  66. package/src/skills/testing-patterns/SKILL.md +305 -0
  67. package/src/skills/verification/SKILL.md +286 -0
  68. package/src/tools/background-agent/cancel.ts +67 -0
  69. package/src/tools/background-agent/concurrency.ts +71 -0
  70. package/src/tools/background-agent/index.ts +7 -0
  71. package/src/tools/background-agent/launch.ts +39 -0
  72. package/src/tools/background-agent/list.ts +50 -0
  73. package/src/tools/background-agent/manager.ts +455 -0
  74. package/src/tools/background-agent/output.ts +57 -0
  75. package/src/tools/background-agent/types.ts +55 -0
  76. package/src/tools/index.ts +8 -0
  77. package/src/tools/manual/index.ts +2 -0
  78. package/src/tools/manual/manual-update.ts +197 -0
  79. package/src/tools/manual/verify-manual.ts +55 -0
  80. package/uninstall.js +64 -0
  81. package/Claude.md +0 -162
  82. package/bin/bobs-mcp-server.js +0 -11
  83. package/bin/bobs-mcp.js +0 -130
  84. package/dist/api/taskLogger.js +0 -106
  85. package/dist/api/taskLogger.js.map +0 -1
  86. package/dist/cli/checker.js +0 -401
  87. package/dist/cli/checker.js.map +0 -1
  88. package/dist/cli/cleanup.js +0 -131
  89. package/dist/cli/cleanup.js.map +0 -1
  90. package/dist/cli/debug.js +0 -157
  91. package/dist/cli/debug.js.map +0 -1
  92. package/dist/cli/health.js +0 -97
  93. package/dist/cli/health.js.map +0 -1
  94. package/dist/cli/setup.js +0 -81
  95. package/dist/cli/setup.js.map +0 -1
  96. package/dist/cli/workshop.js +0 -42
  97. package/dist/cli/workshop.js.map +0 -1
  98. package/dist/dashboard/server.js +0 -1203
  99. package/dist/dashboard/server.js.map +0 -1
  100. package/dist/index.js +0 -960
  101. package/dist/index.js.map +0 -1
  102. package/dist/prompts/architect.js +0 -221
  103. package/dist/prompts/architect.js.map +0 -1
  104. package/dist/prompts/debugger.js +0 -257
  105. package/dist/prompts/debugger.js.map +0 -1
  106. package/dist/prompts/engineer.js +0 -249
  107. package/dist/prompts/engineer.js.map +0 -1
  108. package/dist/prompts/orchestrator.js +0 -304
  109. package/dist/prompts/orchestrator.js.map +0 -1
  110. package/dist/prompts/reviewer.js +0 -289
  111. package/dist/prompts/reviewer.js.map +0 -1
  112. package/dist/services/activitySummarizer.js +0 -388
  113. package/dist/services/activitySummarizer.js.map +0 -1
  114. package/dist/services/changeValidator.js +0 -396
  115. package/dist/services/changeValidator.js.map +0 -1
  116. package/dist/services/claudeOrchestrator.js +0 -343
  117. package/dist/services/claudeOrchestrator.js.map +0 -1
  118. package/dist/services/fileMonitor.js +0 -250
  119. package/dist/services/fileMonitor.js.map +0 -1
  120. package/dist/services/implementationSummarizer.js +0 -306
  121. package/dist/services/implementationSummarizer.js.map +0 -1
  122. package/dist/services/liveMonitor.js +0 -315
  123. package/dist/services/liveMonitor.js.map +0 -1
  124. package/dist/services/mcpAuditLogger.js +0 -104
  125. package/dist/services/mcpAuditLogger.js.map +0 -1
  126. package/dist/services/mcpLogger.js +0 -223
  127. package/dist/services/mcpLogger.js.map +0 -1
  128. package/dist/services/tmuxManager.js +0 -541
  129. package/dist/services/tmuxManager.js.map +0 -1
  130. package/dist/tools/approvalTools.js +0 -244
  131. package/dist/tools/approvalTools.js.map +0 -1
  132. package/dist/tools/autoDebugger.js +0 -147
  133. package/dist/tools/autoDebugger.js.map +0 -1
  134. package/dist/tools/cleanupService.js +0 -221
  135. package/dist/tools/cleanupService.js.map +0 -1
  136. package/dist/tools/dashboardTools.js +0 -342
  137. package/dist/tools/dashboardTools.js.map +0 -1
  138. package/dist/tools/developmentNudges.js +0 -336
  139. package/dist/tools/developmentNudges.js.map +0 -1
  140. package/dist/tools/gitTools.js +0 -741
  141. package/dist/tools/gitTools.js.map +0 -1
  142. package/dist/tools/orchestratorTools.js +0 -832
  143. package/dist/tools/orchestratorTools.js.map +0 -1
  144. package/dist/tools/searchCache.js +0 -64
  145. package/dist/tools/searchCache.js.map +0 -1
  146. package/dist/tools/searchTools.js +0 -1107
  147. package/dist/tools/searchTools.js.map +0 -1
  148. package/dist/tools/semgrep-patterns.js +0 -296
  149. package/dist/tools/semgrep-patterns.js.map +0 -1
  150. package/dist/tools/specTools.js +0 -332
  151. package/dist/tools/specTools.js.map +0 -1
  152. package/dist/tools/structural/__tests__/orchestrator.test.js +0 -61
  153. package/dist/tools/structural/__tests__/orchestrator.test.js.map +0 -1
  154. package/dist/tools/structural/cache.js +0 -226
  155. package/dist/tools/structural/cache.js.map +0 -1
  156. package/dist/tools/structural/engines/python/index.js +0 -118
  157. package/dist/tools/structural/engines/python/index.js.map +0 -1
  158. package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js +0 -97
  159. package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js.map +0 -1
  160. package/dist/tools/structural/engines/typescript/analyzer.js +0 -433
  161. package/dist/tools/structural/engines/typescript/analyzer.js.map +0 -1
  162. package/dist/tools/structural/engines/typescript/index.js +0 -381
  163. package/dist/tools/structural/engines/typescript/index.js.map +0 -1
  164. package/dist/tools/structural/engines/typescript/utils.js +0 -279
  165. package/dist/tools/structural/engines/typescript/utils.js.map +0 -1
  166. package/dist/tools/structural/index.js +0 -248
  167. package/dist/tools/structural/index.js.map +0 -1
  168. package/dist/tools/structural/types.js +0 -18
  169. package/dist/tools/structural/types.js.map +0 -1
  170. package/dist/tools/tmuxTools.js +0 -100
  171. package/dist/tools/tmuxTools.js.map +0 -1
  172. package/dist/tools/workRecorder.js +0 -215
  173. package/dist/tools/workRecorder.js.map +0 -1
  174. package/dist/tools/worktreeTools.js +0 -705
  175. package/dist/tools/worktreeTools.js.map +0 -1
  176. package/dist/utils/__tests__/integration.test.js +0 -57
  177. package/dist/utils/__tests__/integration.test.js.map +0 -1
  178. package/dist/utils/__tests__/serverDetection.test.js +0 -151
  179. package/dist/utils/__tests__/serverDetection.test.js.map +0 -1
  180. package/dist/utils/errorHandling.js +0 -336
  181. package/dist/utils/errorHandling.js.map +0 -1
  182. package/dist/utils/processManager.js +0 -172
  183. package/dist/utils/processManager.js.map +0 -1
  184. package/dist/utils/reliability.js +0 -263
  185. package/dist/utils/reliability.js.map +0 -1
  186. package/dist/utils/responseFormatter.js +0 -250
  187. package/dist/utils/responseFormatter.js.map +0 -1
  188. package/dist/utils/serverDetection.js +0 -133
  189. package/dist/utils/serverDetection.js.map +0 -1
  190. package/dist/utils/specMigration.js +0 -105
  191. package/dist/utils/specMigration.js.map +0 -1
  192. package/dist/validation/schemas.js +0 -299
  193. package/dist/validation/schemas.js.map +0 -1
  194. package/public/.well-known/mcp/manifest.json +0 -473
  195. package/public/index.html +0 -3157
  196. package/public/index.html.backup +0 -2805
  197. package/public/index.html.backup2 +0 -1292
  198. package/scripts/cleanup-system-logs.ts +0 -121
  199. package/scripts/init-workspace.js +0 -63
  200. package/scripts/install-search-tools.js +0 -116
@@ -1,289 +0,0 @@
1
- // src/prompts/reviewer.ts
2
- export const REVIEWER_PROMPT = `
3
- SYSTEM: You are **BOB REVIEWER**, a senior code reviewer and system analyst, responsible for comprehensive code review with improvement MANUAL creation.
4
-
5
- ⚠️ ROLE EXECUTION NOTICE:
6
- When the orchestrator assigns you this role via bob.workshop, YOU must execute immediately.
7
- Do not wait for another "reviewer agent" or external process. The role assignment response
8
- will include specific numbered actions - start with action 1 immediately.
9
-
10
- GOAL:
11
- - Analyze existing code features or entire codebases
12
- - Identify improvement opportunities across performance, quality, and security domains
13
- - Create comprehensive improvement specifications for the engineer to implement
14
-
15
- ⚠️ CRITICAL: MANUAL is a JSON file (.bob/specs/SPEC-*.json). DO NOT create separate markdown files for review documentation. ALL review findings must be stored within the MANUAL using bob.manual.update.
16
-
17
- ---
18
-
19
- TOOLCHAIN YOU CAN USE:
20
- • specTools:
21
- - bob.manual.create(input) // create a new manual with title and metadata
22
- - bob.manual.update(input) // update manual sections, logs, or state
23
- - bob.manual.get(input) // retrieve a specific manual by ID
24
-
25
- • searchTools:
26
- - bob.code.search(input) // unified lexical + semantic + structural search with phase: "reviewer" for vulnerability detection, quality analysis, and performance issues
27
- Examples:
28
- - Check dependencies: bob.code.search({ query: "show dependencies for src/api/auth.ts", phase: "reviewer" })
29
- - Find unused code: bob.code.search({ query: "find unused exports", phase: "reviewer" })
30
- - Analyze architecture: bob.code.search({ query: "check architecture", phase: "reviewer" })
31
- - Find references: bob.code.search({ query: "find references to SecurityManager", phase: "reviewer" })
32
-
33
- • dashboardTools:
34
- - bob.dashboard.launch() // launch visual dashboard on port 4577
35
-
36
- • approvalTools:
37
- - bob.approval.request(input) // create user approval request
38
- - bob.approval.status(input) // check approval status
39
-
40
- ---
41
-
42
- WORKFLOW SEQUENCES
43
- 1. Create improvement manual: Use bob.manual.create with title ending "-REVIEW" and state="draft"
44
- 2. Conduct systematic review across 3 categories via bob.manual.update:
45
- - Security: Authentication, authorization, input validation, data exposure
46
- - Performance: Database queries, algorithms, caching, resource usage
47
- - Quality: Code structure, testing, maintainability, documentation
48
- 3. Build improvement manual sections (with validation):
49
- Use bob.manual.update to write each section to the review section of the manual:
50
- - executive summary:
51
- - analysis scope: [codebase/feature components analyzed]
52
- - technology stack: [languages, frameworks, key tools]
53
- - overall assessment: [Current state rating with detailed breakdown]
54
- - improvement categories: [Performance: X issues, Quality: Y issues, Security: Z issues]
55
- - implementation priority: [Critical: immediate, High: 30 days, Medium: 90 days]
56
- - expected business impact: [Performance gains, maintainability improvements, security enhancements]
57
- - existing specification context:
58
- - related specifications: [list of existing specs and their relationships]
59
- - implementation history: [previous architectural decisions and their outcomes]
60
- - performance analysis:
61
- - critical performance issues: [list of critical performance issues]
62
- - optimization opportunities: [list of optimization opportunities]
63
- - scalability enhancements: [list of scalability enhancements]
64
- - expected performance gains: [list of expected performance gains]
65
- - quality analysis:
66
- - technical debt: [list of technical debt]
67
- - testing enhancements: [list of testing enhancements]
68
- - architecture improvements: [list of architecture improvements]
69
- - documentation improvements: [list of documentation improvements]
70
- - security analysis:
71
- - security vulnerabilities: [list of security vulnerabilities]
72
- - OWASP compliance gaps: [list of OWASP compliance gaps]
73
- - data protection enhancements: [list of data protection enhancements]
74
- - infrastructure security: [list of infrastructure security]
75
- - implementation plan:
76
- - critical fixes: [list of critical fixes]
77
- - high-priority improvements: [list of high-priority improvements]
78
- - medium-priority enhancements: [list of medium-priority enhancements]
79
- - implementation strategy: [list of implementation strategy]
80
- - success metrics: [list of success metrics]
81
- - validation: [list of validation]
82
- - risk assessment: [list of risk assessment]
83
- - change management strategy: [list of change management strategy]
84
- - implementation strategy:
85
- - phase 1: [list of phase 1]
86
- - phase 2: [list of phase 2]
87
- - phase 3: [list of phase 3]
88
-
89
- ---
90
-
91
- THINKING FRAMEWORK
92
-
93
- 1. **Codebase Structure & Technology Stack:**
94
- - What languages, frameworks, and architectural patterns are used?
95
- - What are the main components, modules, and their relationships?
96
- - What testing frameworks, build systems, and deployment patterns exist?
97
- - How is the codebase organized and what conventions are followed?
98
-
99
- 2. **Existing Implementation Quality:**
100
- - What are the current strengths and potential weaknesses?
101
- - Are there obvious code smells, security vulnerabilities, or performance issues?
102
- - How comprehensive is test coverage and documentation?
103
- - What technical debt or maintenance challenges exist?
104
-
105
- 3. **Improvement Opportunities:**
106
- - Where are the highest-impact improvement opportunities?
107
- - What would provide the most value: performance, security, or code quality?
108
- - What changes would have immediate vs. long-term benefits?
109
- - How can improvements be prioritized for maximum business impact?
110
-
111
- 4. **Implementation Feasibility:**
112
- - What improvements can be made incrementally vs. requiring major refactoring?
113
- - Are there dependencies or constraints that limit improvement options?
114
- - What would be the effort vs. benefit ratio for different improvements?
115
- - How can changes be validated and tested safely?
116
-
117
- ---
118
-
119
- CODEBASE DISCOVERY PROTOCOL
120
-
121
- 1. **Technology Stack Identification**:
122
- - **Language Detection**: Identify primary programming languages and versions
123
- - **Framework Analysis**: Map major frameworks (React, Django, Spring, etc.)
124
- - **Build System**: Identify build tools (webpack, vite, Maven, pip, etc.)
125
- - **Testing Stack**: Discover testing frameworks and coverage tools
126
- - **Database & Infrastructure**: Identify data storage and deployment patterns
127
-
128
- 2. **Existing MANUAL Discovery**:
129
- - Search for related manuals using feature keywords
130
- - Identify dependencies and relationships with existing manuals
131
- - Analyze implementation history and previous architectural decisions
132
- - Map feature evolution and maintenance patterns
133
-
134
- 3. **Architecture Pattern Analysis**:
135
- - Identify architectural layers and separation of concerns
136
- - Analyze error handling, logging, and monitoring patterns
137
- - Map data flow and state management approaches
138
- - Assess configuration and environment management
139
-
140
- ---
141
-
142
- OUTPUT CONTRACT:
143
- Return JSON:
144
- {
145
- "action": "await_approval",
146
- "next_role": "none",
147
- "spec_id": "<id>",
148
- "workflow_step": "review",
149
- "requires_user_input": true,
150
- "approval_message": "Comprehensive review completed with improvement recommendations. Please review the findings and approve to proceed with implementation.",
151
- "log_entry": "Reviewer completed comprehensive analysis; awaiting user approval to proceed",
152
- "context": {
153
- "sections_completed": ["executive_summary", "performance_analysis", "quality_analysis", "security_analysis", "implementation_plan"],
154
- "findings_count": {
155
- "performance": 5,
156
- "quality": 8,
157
- "security": 3
158
- },
159
- "priority_breakdown": {
160
- "critical": 2,
161
- "high": 6,
162
- "medium": 8
163
- },
164
- "dashboard_url": "http://localhost:4577",
165
- "approval_id": "<approval_request_id>"
166
- }
167
- }
168
-
169
- If missing critical information, set action="clarify" and ask questions to the user to get the information.
170
- Once user approves, orchestrator will route to Engineer for implementation of improvements.
171
-
172
- ---
173
-
174
- REVIEW STANDARDS
175
-
176
- - Use bob.code.search with phase: "reviewer" for comprehensive vulnerability detection, quality analysis, and performance issues
177
- - Reference OWASP guidelines for security findings
178
- - Include performance benchmarks where applicable
179
- - Assess test coverage and code complexity
180
-
181
- - Performance Analysis
182
- - Database performance: query optimization, indexing, connection pooling
183
- - Application performance: algorithm efficiency, memory usage, CPU utilization
184
- - Network performance: API response times, caching, CDN usage
185
- - Frontend performance: bundle size, rendering optimization, lazy loading
186
- - Infrastructure performance: scaling strategies, resource utilization
187
-
188
- - Quality Analysis
189
- - Code structure: modularity, separation of concerns, architectural adherence
190
- - Test coverage: unit test coverage, integration test completeness, E2E validation
191
- - Technical debt: code smells, documentation gaps, maintenance challenges
192
- - Best practices: framework conventions, error handling, logging strategies
193
-
194
- - Security Analysis
195
- - Authentication security: session management, credential handling, multi-factor authentication
196
- - Authorization controls: access control, privilege escalation, role-based permissions
197
- - Input validation: SQL injection, XSS, CSRF protection, data sanitization
198
- - Data protection: encryption at rest/transit, PII handling, secure storage
199
- - Infrastructure security: HTTPS enforcement, security headers, dependency vulnerabilities
200
-
201
- ---
202
-
203
- VALIDATION REQUIREMENTS
204
-
205
- - All 3 categories must have findings or explicit "No issues found"
206
- - Each finding must include severity level and file references
207
- - Improvement manual must include prioritized remediation roadmap
208
-
209
- ---
210
-
211
- LOGGING CONTRACT:
212
- After completing review analysis, log via bob.manual.update with execution_log parameter.
213
-
214
- The tool will automatically create enhanced_activities with reviewer_data for dashboard display.
215
-
216
- **Standard Execution Log Format:**
217
-
218
- bob.manual.update({
219
- spec_id,
220
- execution_log: {
221
- timestamp: new Date().toISOString(),
222
- engineer: "reviewer",
223
- action: "review:security_completed | review:performance_completed | review:quality_completed",
224
- task_id: "SECURITY_REVIEW",
225
- files_changed: [],
226
- commit_hash: "pending",
227
- note: "Security review completed. Found 5 issues (1 high, 2 medium, 2 low). ⚠️ Approved with conditions"
228
- }
229
- })
230
-
231
-
232
- **Enhanced Activity Data (auto-generated by tool):**
233
- The tool automatically generates enhanced_activities for dashboard display:
234
-
235
- {
236
- role: "reviewer",
237
- type: "role_update",
238
- summary: "Security review completed. Found 5 issues (1 high, 2 medium, 2 low). ⚠️ Approved with conditions",
239
- reviewer_data: {
240
- review_type: "security", // code | architecture | security | performance
241
- findings: [
242
- {
243
- severity: "high", // high | medium | low
244
- description: "JWT secret is hardcoded in auth.service.ts - should use environment variable",
245
- file: "src/services/auth.service.ts"
246
- },
247
- {
248
- severity: "medium",
249
- description: "Password validation allows weak passwords (min 6 chars) - should require 8+ with complexity",
250
- file: "src/utils/password.util.ts"
251
- },
252
- {
253
- severity: "low",
254
- description: "Auth service lacks logging for suspicious activity",
255
- file: "src/services/auth.service.ts"
256
- }
257
- ],
258
- approval_status: "conditional" // approved | conditional | rejected
259
- },
260
- files_changed: []
261
- }
262
-
263
-
264
- **Review Types:**
265
- - **code**: Code quality, best practices, maintainability
266
- - **architecture**: System design, scalability, patterns
267
- - **security**: Authentication, authorization, data protection, OWASP compliance
268
- - **performance**: Speed, efficiency, resource usage, scalability
269
-
270
- **Approval Status:**
271
- - **approved**: ✅ No blocking issues, ready for deployment
272
- - **conditional**: ⚠️ Issues found but not blocking; address before next iteration
273
- - **rejected**: ❌ Critical issues must be fixed before proceeding
274
-
275
- **When to Log:**
276
- 1. After completing each review category (security, performance, quality)
277
- 2. After analyzing findings and determining severity
278
- 3. When providing final approval status
279
- 4. After creating improvement manual with recommendations
280
-
281
- **Dashboard Display:**
282
- Your logs appear in the Activity timeline with:
283
- - **Review type badge** (Security, Performance, Quality, Architecture)
284
- - **Findings grouped by severity** (High, Medium, Low)
285
- - **Issue descriptions** with file references
286
- - **Approval status badge** (✅ Approved / ⚠️ Conditional / ❌ Rejected)
287
- - **Summary statistics** (e.g., "5 issues: 1 high, 2 medium, 2 low")
288
- `;
289
- //# sourceMappingURL=reviewer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/prompts/reviewer.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8R9B,CAAC"}
@@ -1,388 +0,0 @@
1
- // src/services/activitySummarizer.ts
2
- import { z } from "zod";
3
- // Enhanced Activity Schema
4
- export const EnhancedActivitySchema = z.object({
5
- id: z.string(),
6
- timestamp: z.string(),
7
- role: z.enum(['architect', 'engineer', 'debugger', 'reviewer', 'orchestrator', 'system']),
8
- type: z.enum(['role_update', 'layer_progress', 'clarification', 'file_change', 'mcp_operation', 'phase_completion']),
9
- summary: z.string(),
10
- details: z.string().optional(),
11
- architect_data: z.object({
12
- phase: z.enum(['research', 'design', 'clarification', 'planning']).optional(),
13
- sections_completed: z.array(z.string()).optional(),
14
- research_findings: z.array(z.string()).optional(),
15
- design_decisions: z.array(z.string()).optional(),
16
- clarifications: z.array(z.object({
17
- question: z.string(),
18
- answer: z.string().optional(),
19
- status: z.enum(['pending', 'answered'])
20
- })).optional()
21
- }).optional(),
22
- engineer_data: z.object({
23
- layer: z.enum(['database', 'backend', 'frontend', 'integration', 'testing']).optional(),
24
- tasks_completed: z.array(z.string()).optional(),
25
- tasks_remaining: z.array(z.string()).optional(),
26
- completion_percentage: z.number().optional(),
27
- build_status: z.enum(['success', 'failed', 'skipped']).optional(),
28
- test_status: z.enum(['passed', 'failed', 'skipped']).optional()
29
- }).optional(),
30
- debugger_data: z.object({
31
- issue: z.string().optional(),
32
- root_cause: z.string().optional(),
33
- fix: z.string().optional(),
34
- confidence: z.enum(['high', 'medium', 'low']).optional(),
35
- affected_systems: z.array(z.string()).optional()
36
- }).optional(),
37
- reviewer_data: z.object({
38
- review_type: z.enum(['code', 'architecture', 'security', 'performance']).optional(),
39
- findings: z.array(z.object({
40
- severity: z.enum(['high', 'medium', 'low']),
41
- description: z.string(),
42
- file: z.string().optional()
43
- })).optional(),
44
- approval_status: z.enum(['approved', 'conditional', 'rejected']).optional()
45
- }).optional(),
46
- orchestrator_data: z.object({
47
- workflow_action: z.string().optional(),
48
- coordinated_roles: z.array(z.string()).optional(),
49
- milestones: z.array(z.string()).optional(),
50
- blockers: z.array(z.string()).optional()
51
- }).optional(),
52
- files_changed: z.array(z.object({
53
- path: z.string(),
54
- change_type: z.enum(['added', 'modified', 'deleted']),
55
- lines_added: z.number(),
56
- lines_removed: z.number(),
57
- diff_summary: z.string(),
58
- category: z.enum(['backend', 'frontend', 'test', 'config', 'docs', 'other'])
59
- }))
60
- });
61
- // State tracking for layer progress (in-memory, per spec)
62
- class LayerProgressTracker {
63
- constructor() {
64
- this.progress = new Map();
65
- }
66
- updateLayerProgress(specId, layer, tasksCompleted, tasksRemaining) {
67
- if (!this.progress.has(specId)) {
68
- this.progress.set(specId, {
69
- current_layer: layer,
70
- completed_layers: [],
71
- layer_tasks: new Map()
72
- });
73
- }
74
- const state = this.progress.get(specId);
75
- state.current_layer = layer;
76
- state.layer_tasks.set(layer, {
77
- completed: tasksCompleted.length,
78
- total: tasksCompleted.length + tasksRemaining.length
79
- });
80
- // Mark previous layers as completed
81
- const layerOrder = ['database', 'backend', 'frontend', 'integration', 'testing'];
82
- const currentIndex = layerOrder.indexOf(layer);
83
- for (let i = 0; i < currentIndex; i++) {
84
- if (!state.completed_layers.includes(layerOrder[i])) {
85
- state.completed_layers.push(layerOrder[i]);
86
- }
87
- }
88
- }
89
- getProgress(specId) {
90
- return this.progress.get(specId) || {
91
- current_layer: 'database',
92
- completed_layers: [],
93
- layer_tasks: new Map()
94
- };
95
- }
96
- }
97
- const layerTracker = new LayerProgressTracker();
98
- // Categorize file by path
99
- function categorizeFile(filePath) {
100
- const normalized = filePath.toLowerCase();
101
- if (normalized.includes('test') || normalized.includes('spec') || normalized.includes('__tests__')) {
102
- return 'test';
103
- }
104
- if (normalized.includes('frontend') || normalized.includes('ui') || normalized.includes('component') ||
105
- normalized.includes('public') || normalized.endsWith('.html') || normalized.endsWith('.css')) {
106
- return 'frontend';
107
- }
108
- if (normalized.includes('backend') || normalized.includes('server') || normalized.includes('api') ||
109
- normalized.includes('service') || normalized.includes('controller') || normalized.includes('middleware')) {
110
- return 'backend';
111
- }
112
- if (normalized.includes('config') || normalized.endsWith('.json') || normalized.endsWith('.yml') ||
113
- normalized.endsWith('.yaml') || normalized.endsWith('.env')) {
114
- return 'config';
115
- }
116
- if (normalized.endsWith('.md') || normalized.includes('doc') || normalized.includes('readme')) {
117
- return 'docs';
118
- }
119
- return 'other';
120
- }
121
- // Generate intelligent summary based on role and data
122
- export function generateActivitySummary(role, data, files = []) {
123
- switch (role) {
124
- case 'architect':
125
- return generateArchitectSummary(data, files);
126
- case 'engineer':
127
- return generateEngineerSummary(data, files);
128
- case 'debugger':
129
- return generateDebuggerSummary(data, files);
130
- case 'reviewer':
131
- return generateReviewerSummary(data, files);
132
- case 'orchestrator':
133
- return generateOrchestratorSummary(data, files);
134
- case 'system':
135
- return data.summary || 'System activity logged';
136
- default:
137
- return 'Activity logged';
138
- }
139
- }
140
- function generateArchitectSummary(data, files) {
141
- const parts = [];
142
- // Phase completion
143
- if (data.phase) {
144
- const phaseMap = {
145
- research: 'Completed research',
146
- design: 'Completed design',
147
- clarification: 'Requested clarifications',
148
- planning: 'Completed planning'
149
- };
150
- parts.push(phaseMap[data.phase] || `Working on ${data.phase}`);
151
- }
152
- // Research findings
153
- if (data.research_findings?.length) {
154
- parts.push(`Found ${data.research_findings.length} key findings`);
155
- }
156
- // Design decisions
157
- if (data.design_decisions?.length) {
158
- const decisions = data.design_decisions.slice(0, 2).join(', ');
159
- parts.push(`Design decisions: ${decisions}${data.design_decisions.length > 2 ? '...' : ''}`);
160
- }
161
- // Sections completed
162
- if (data.sections_completed?.length) {
163
- const sections = data.sections_completed.map((s) => s.replace(/_/g, ' ')).join(', ');
164
- parts.push(`Completed sections: ${sections}`);
165
- }
166
- // Clarifications
167
- if (data.clarifications?.length) {
168
- const pending = data.clarifications.filter((c) => c.status === 'pending').length;
169
- const answered = data.clarifications.filter((c) => c.status === 'answered').length;
170
- if (pending > 0) {
171
- parts.push(`⏳ Awaiting ${pending} clarification${pending > 1 ? 's' : ''}`);
172
- }
173
- if (answered > 0) {
174
- parts.push(`✅ Answered ${answered} clarification${answered > 1 ? 's' : ''}`);
175
- }
176
- }
177
- // Files
178
- if (files.length > 0) {
179
- parts.push(`Updated ${files.length} file${files.length > 1 ? 's' : ''}`);
180
- }
181
- return parts.length > 0 ? parts.join('. ') + '.' : 'Architecture work completed.';
182
- }
183
- function generateEngineerSummary(data, files) {
184
- const parts = [];
185
- // Layer progress
186
- if (data.layer) {
187
- const layerMap = {
188
- database: 'Database',
189
- backend: 'Backend',
190
- frontend: 'Frontend',
191
- integration: 'Integration',
192
- testing: 'Testing'
193
- };
194
- const layerName = layerMap[data.layer] || data.layer;
195
- if (data.completion_percentage !== undefined) {
196
- parts.push(`Working on ${layerName} Layer (${data.completion_percentage}% complete)`);
197
- }
198
- else {
199
- parts.push(`Working on ${layerName} Layer`);
200
- }
201
- // Task counts
202
- if (data.tasks_completed?.length && data.tasks_remaining?.length) {
203
- const total = data.tasks_completed.length + data.tasks_remaining.length;
204
- parts.push(`${data.tasks_completed.length}/${total} tasks completed`);
205
- }
206
- }
207
- // Build and test status
208
- const statusParts = [];
209
- if (data.build_status === 'success') {
210
- statusParts.push('Build ✅');
211
- }
212
- else if (data.build_status === 'failed') {
213
- statusParts.push('Build ❌');
214
- }
215
- if (data.test_status === 'passed') {
216
- statusParts.push('Tests ✅');
217
- }
218
- else if (data.test_status === 'failed') {
219
- statusParts.push('Tests ❌');
220
- }
221
- if (statusParts.length > 0) {
222
- parts.push(statusParts.join(' '));
223
- }
224
- // Files modified
225
- if (files.length > 0) {
226
- const totalAdded = files.reduce((sum, f) => sum + f.lines_added, 0);
227
- const totalRemoved = files.reduce((sum, f) => sum + f.lines_removed, 0);
228
- parts.push(`Modified ${files.length} file${files.length > 1 ? 's' : ''} (+${totalAdded} -${totalRemoved})`);
229
- }
230
- return parts.length > 0 ? parts.join('. ') + '.' : 'Engineering work completed.';
231
- }
232
- function generateDebuggerSummary(data, files) {
233
- const parts = [];
234
- // Issue
235
- if (data.issue) {
236
- parts.push(`Fixed: ${data.issue}`);
237
- }
238
- // Root cause
239
- if (data.root_cause) {
240
- parts.push(`Root cause: ${data.root_cause}`);
241
- }
242
- // Fix applied
243
- if (data.fix) {
244
- parts.push(`Applied fix: ${data.fix}`);
245
- }
246
- // Confidence
247
- if (data.confidence) {
248
- const confidenceIcons = {
249
- high: '🎯',
250
- medium: '⚖️',
251
- low: '❓'
252
- };
253
- const icon = confidenceIcons[data.confidence] || '';
254
- parts.push(`${icon} Confidence: ${data.confidence}`);
255
- }
256
- // Affected systems
257
- if (data.affected_systems?.length) {
258
- parts.push(`Affected: ${data.affected_systems.join(', ')}`);
259
- }
260
- // Files
261
- if (files.length > 0) {
262
- const fileList = files.map(f => f.path.split('/').pop()).join(', ');
263
- parts.push(`Modified: ${fileList}`);
264
- }
265
- return parts.length > 0 ? parts.join('. ') + '.' : 'Debug work completed.';
266
- }
267
- function generateReviewerSummary(data, files) {
268
- const parts = [];
269
- // Review type
270
- if (data.review_type) {
271
- const typeMap = {
272
- code: 'Code review',
273
- architecture: 'Architecture review',
274
- security: 'Security review',
275
- performance: 'Performance review'
276
- };
277
- parts.push(typeMap[data.review_type] || 'Review completed');
278
- }
279
- else {
280
- parts.push('Review completed');
281
- }
282
- // Findings
283
- if (data.findings?.length) {
284
- const severityCounts = { high: 0, medium: 0, low: 0 };
285
- data.findings.forEach((f) => {
286
- if (severityCounts[f.severity] !== undefined) {
287
- severityCounts[f.severity]++;
288
- }
289
- });
290
- const findingParts = [];
291
- if (severityCounts.high > 0)
292
- findingParts.push(`${severityCounts.high} high`);
293
- if (severityCounts.medium > 0)
294
- findingParts.push(`${severityCounts.medium} medium`);
295
- if (severityCounts.low > 0)
296
- findingParts.push(`${severityCounts.low} low`);
297
- if (findingParts.length > 0) {
298
- parts.push(`Found ${data.findings.length} issue${data.findings.length > 1 ? 's' : ''} (${findingParts.join(', ')})`);
299
- }
300
- }
301
- // Approval status
302
- if (data.approval_status) {
303
- const statusMap = {
304
- approved: '✅ Approved',
305
- conditional: '⚠️ Approved with conditions',
306
- rejected: '❌ Rejected'
307
- };
308
- parts.push(statusMap[data.approval_status] || data.approval_status);
309
- }
310
- return parts.length > 0 ? parts.join('. ') + '.' : 'Review completed.';
311
- }
312
- function generateOrchestratorSummary(data, files) {
313
- const parts = [];
314
- // Workflow action
315
- if (data.workflow_action) {
316
- parts.push(data.workflow_action);
317
- }
318
- // Coordinated roles
319
- if (data.coordinated_roles?.length) {
320
- const roles = data.coordinated_roles.join(', ');
321
- parts.push(`Coordinated: ${roles}`);
322
- }
323
- // Milestones
324
- if (data.milestones?.length) {
325
- if (data.milestones.length === 1) {
326
- parts.push(`Milestone: ${data.milestones[0]}`);
327
- }
328
- else {
329
- parts.push(`${data.milestones.length} milestones reached`);
330
- }
331
- }
332
- // Blockers
333
- if (data.blockers?.length) {
334
- parts.push(`⚠️ ${data.blockers.length} blocker${data.blockers.length > 1 ? 's' : ''}`);
335
- }
336
- return parts.length > 0 ? parts.join('. ') + '.' : 'Workflow activity logged.';
337
- }
338
- // Create enhanced activity from input data
339
- export function createEnhancedActivity(specId, role, data, files = []) {
340
- const timestamp = new Date().toISOString();
341
- const id = `activity_${timestamp}_${Math.random().toString(36).substr(2, 9)}`;
342
- // Enrich files with categorization and diff summary
343
- const enrichedFiles = files.map(file => ({
344
- path: file.path,
345
- change_type: file.change_type,
346
- lines_added: file.lines_added,
347
- lines_removed: file.lines_removed,
348
- diff_summary: file.lines_added > 0 || file.lines_removed > 0
349
- ? `+${file.lines_added} -${file.lines_removed}`
350
- : 'No changes',
351
- category: categorizeFile(file.path)
352
- }));
353
- // Generate intelligent summary
354
- const summary = data.summary || generateActivitySummary(role, data, enrichedFiles);
355
- // Determine type
356
- let type = 'role_update';
357
- if (role === 'engineer' && data.layer)
358
- type = 'layer_progress';
359
- if (role === 'architect' && data.clarifications?.some((c) => c.status === 'pending'))
360
- type = 'clarification';
361
- if (files.length > 0)
362
- type = 'file_change';
363
- if (data.phase && (data.phase === 'research' || data.phase === 'design' || data.phase === 'planning'))
364
- type = 'phase_completion';
365
- // Update layer tracking for engineer
366
- if (role === 'engineer' && data.layer && data.tasks_completed && data.tasks_remaining) {
367
- layerTracker.updateLayerProgress(specId, data.layer, data.tasks_completed, data.tasks_remaining);
368
- }
369
- return {
370
- id,
371
- timestamp,
372
- role,
373
- type,
374
- summary,
375
- details: data.details,
376
- architect_data: role === 'architect' ? data : undefined,
377
- engineer_data: role === 'engineer' ? data : undefined,
378
- debugger_data: role === 'debugger' ? data : undefined,
379
- reviewer_data: role === 'reviewer' ? data : undefined,
380
- orchestrator_data: role === 'orchestrator' ? data : undefined,
381
- files_changed: enrichedFiles
382
- };
383
- }
384
- // Get layer progress for a spec (used by frontend)
385
- export function getLayerProgress(specId) {
386
- return layerTracker.getProgress(specId);
387
- }
388
- //# sourceMappingURL=activitySummarizer.js.map