bobs-workshop 0.3.3 → 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 +34 -66
  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,244 +0,0 @@
1
- // src/tools/approvalTools.ts
2
- import fs from "fs-extra";
3
- import path from "path";
4
- import { z } from "zod";
5
- import { validateUserApproval } from "../validation/schemas.js";
6
- import { specGetHandler, specUpdateHandler } from "./specTools.js";
7
- export const ApprovalRequestInput = z.object({
8
- spec_id: z.string(),
9
- approval_type: z.enum(["spec_approval", "implementation_approval", "completion_confirmation"]),
10
- message: z.string().describe("Message to display to user for approval"),
11
- context: z.string().optional().describe("Additional context for the approval decision")
12
- });
13
- export const ApprovalResponseInput = z.object({
14
- spec_id: z.string(),
15
- approval_type: z.enum(["spec_approval", "implementation_approval", "completion_confirmation"]),
16
- approved: z.boolean(),
17
- feedback: z.string().optional().describe("User feedback on the approval decision"),
18
- timestamp: z.string().datetime().optional()
19
- });
20
- export const ApprovalTimeoutInput = z.object({
21
- spec_id: z.string(),
22
- timeout_minutes: z.number().default(60).describe("Minutes to wait for approval before timeout")
23
- });
24
- // Create approval request and set spec to awaiting approval state
25
- export async function createApprovalRequest(input) {
26
- const validated = ApprovalRequestInput.parse(input);
27
- try {
28
- // Get current spec
29
- const spec = await specGetHandler({ spec_id: validated.spec_id });
30
- // Determine target state based on approval type
31
- let targetState;
32
- switch (validated.approval_type) {
33
- case "spec_approval":
34
- targetState = "spec_review";
35
- break;
36
- case "implementation_approval":
37
- targetState = "implementation";
38
- break;
39
- case "completion_confirmation":
40
- targetState = "user_review";
41
- break;
42
- default:
43
- throw new Error(`Unknown approval type: ${validated.approval_type}`);
44
- }
45
- // Create approval request file
46
- const approvalDir = path.join(".bob", "approvals");
47
- await fs.ensureDir(approvalDir);
48
- const approvalFile = path.join(approvalDir, `${validated.spec_id}-${validated.approval_type}.json`);
49
- const approvalData = {
50
- spec_id: validated.spec_id,
51
- approval_type: validated.approval_type,
52
- message: validated.message,
53
- context: validated.context,
54
- status: "pending",
55
- created_at: new Date().toISOString(),
56
- expires_at: new Date(Date.now() + 60 * 60 * 1000).toISOString(), // 1 hour default
57
- dashboard_url: "http://localhost:4577"
58
- };
59
- await fs.writeJSON(approvalFile, approvalData, { spaces: 2 });
60
- // Log approval request in spec
61
- await specUpdateHandler({
62
- spec_id: validated.spec_id,
63
- execution_log: {
64
- timestamp: new Date().toISOString(),
65
- engineer: "BOB_APPROVAL_SYSTEM",
66
- action: `approval_requested:${validated.approval_type}`,
67
- task_id: "APPROVAL-REQ",
68
- files_changed: [approvalFile],
69
- commit_hash: "",
70
- note: `Approval requested: ${validated.message}`
71
- }
72
- });
73
- return {
74
- approval_id: `${validated.spec_id}-${validated.approval_type}`,
75
- status: "pending",
76
- dashboard_url: "http://localhost:4577",
77
- approval_file: approvalFile,
78
- expires_at: approvalData.expires_at,
79
- message: validated.message
80
- };
81
- }
82
- catch (error) {
83
- throw new Error(`Failed to create approval request: ${error}`);
84
- }
85
- }
86
- // Process user approval response
87
- export async function processApprovalResponse(input) {
88
- const validated = ApprovalResponseInput.parse(input);
89
- const timestamp = validated.timestamp || new Date().toISOString();
90
- try {
91
- // Validate the approval response
92
- const approvalData = validateUserApproval({
93
- spec_id: validated.spec_id,
94
- approval_type: validated.approval_type,
95
- approved: validated.approved,
96
- feedback: validated.feedback,
97
- timestamp
98
- });
99
- // Update approval file
100
- const approvalFile = path.join(".bob", "approvals", `${validated.spec_id}-${validated.approval_type}.json`);
101
- if (await fs.pathExists(approvalFile)) {
102
- const existingApproval = await fs.readJSON(approvalFile);
103
- existingApproval.status = validated.approved ? "approved" : "rejected";
104
- existingApproval.approved = validated.approved;
105
- existingApproval.feedback = validated.feedback;
106
- existingApproval.resolved_at = timestamp;
107
- await fs.writeJSON(approvalFile, existingApproval, { spaces: 2 });
108
- }
109
- // Determine state transition
110
- let newState;
111
- let actionLog;
112
- if (validated.approved) {
113
- switch (validated.approval_type) {
114
- case "spec_approval":
115
- newState = "approved";
116
- actionLog = "user_approved";
117
- break;
118
- case "implementation_approval":
119
- newState = "implementation";
120
- actionLog = "implementation_approved";
121
- break;
122
- case "completion_confirmation":
123
- newState = "completed";
124
- actionLog = "user_satisfied";
125
- break;
126
- default:
127
- throw new Error(`Unknown approval type: ${validated.approval_type}`);
128
- }
129
- }
130
- else {
131
- // Handle rejection - typically goes back to previous state
132
- switch (validated.approval_type) {
133
- case "spec_approval":
134
- newState = "questioning"; // Back to gathering requirements
135
- actionLog = "spec_rejected";
136
- break;
137
- case "implementation_approval":
138
- newState = "approved"; // Back to approved spec
139
- actionLog = "implementation_rejected";
140
- break;
141
- case "completion_confirmation":
142
- newState = "implementation"; // Back to development
143
- actionLog = "completion_rejected";
144
- break;
145
- default:
146
- throw new Error(`Unknown approval type: ${validated.approval_type}`);
147
- }
148
- }
149
- // Log the approval decision
150
- await specUpdateHandler({
151
- spec_id: validated.spec_id,
152
- execution_log: {
153
- timestamp,
154
- engineer: "BOB_APPROVAL_SYSTEM",
155
- action: actionLog,
156
- task_id: "APPROVAL-RESP",
157
- files_changed: [approvalFile],
158
- commit_hash: "",
159
- note: `${validated.approved ? 'Approved' : 'Rejected'}: ${validated.feedback || 'No feedback provided'}`
160
- }
161
- });
162
- return {
163
- approval_id: `${validated.spec_id}-${validated.approval_type}`,
164
- status: validated.approved ? "approved" : "rejected",
165
- new_state: newState,
166
- feedback: validated.feedback,
167
- timestamp
168
- };
169
- }
170
- catch (error) {
171
- throw new Error(`Failed to process approval response: ${error}`);
172
- }
173
- }
174
- // Check approval status
175
- export async function checkApprovalStatus(spec_id, approval_type) {
176
- try {
177
- const approvalDir = path.join(".bob", "approvals");
178
- if (!await fs.pathExists(approvalDir)) {
179
- return { pending_approvals: [], expired_approvals: [] };
180
- }
181
- const files = await fs.readdir(approvalDir);
182
- const approvals = [];
183
- const now = new Date();
184
- for (const file of files) {
185
- if (file.startsWith(spec_id) && file.endsWith('.json')) {
186
- if (approval_type && !file.includes(approval_type)) {
187
- continue;
188
- }
189
- const approvalData = await fs.readJSON(path.join(approvalDir, file));
190
- const isExpired = new Date(approvalData.expires_at) < now;
191
- approvals.push({
192
- ...approvalData,
193
- is_expired: isExpired,
194
- file_path: file
195
- });
196
- }
197
- }
198
- const pending = approvals.filter(a => a.status === "pending" && !a.is_expired);
199
- const expired = approvals.filter(a => a.status === "pending" && a.is_expired);
200
- return {
201
- pending_approvals: pending,
202
- expired_approvals: expired,
203
- all_approvals: approvals
204
- };
205
- }
206
- catch (error) {
207
- throw new Error(`Failed to check approval status: ${error}`);
208
- }
209
- }
210
- // Handle approval timeout
211
- export async function handleApprovalTimeout(spec_id, approval_type) {
212
- try {
213
- const approvalFile = path.join(".bob", "approvals", `${spec_id}-${approval_type}.json`);
214
- if (await fs.pathExists(approvalFile)) {
215
- const approvalData = await fs.readJSON(approvalFile);
216
- approvalData.status = "expired";
217
- approvalData.expired_at = new Date().toISOString();
218
- await fs.writeJSON(approvalFile, approvalData, { spaces: 2 });
219
- // Log timeout
220
- await specUpdateHandler({
221
- spec_id,
222
- execution_log: {
223
- timestamp: new Date().toISOString(),
224
- engineer: "BOB_APPROVAL_SYSTEM",
225
- action: "approval_timeout",
226
- task_id: "APPROVAL-TIMEOUT",
227
- files_changed: [approvalFile],
228
- commit_hash: "",
229
- note: `Approval request timed out: ${approval_type}`
230
- }
231
- });
232
- return {
233
- approval_id: `${spec_id}-${approval_type}`,
234
- status: "expired",
235
- timeout_at: approvalData.expired_at
236
- };
237
- }
238
- throw new Error(`Approval file not found: ${approvalFile}`);
239
- }
240
- catch (error) {
241
- throw new Error(`Failed to handle approval timeout: ${error}`);
242
- }
243
- }
244
- //# sourceMappingURL=approvalTools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approvalTools.js","sourceRoot":"","sources":["../../src/tools/approvalTools.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAA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AAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;YAE9D,cAAc;YACd,MAAM,iBAAiB,CAAC;gBACtB,OAAO;gBACP,aAAa,EAAE;oBACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;oBACnC,QAAQ,EAAE,qBAAqB;oBAC/B,MAAM,EAAE,kBAAkB;oBAC1B,OAAO,EAAE,kBAAkB;oBAC3B,aAAa,EAAE,CAAC,YAAY,CAAC;oBAC7B,WAAW,EAAE,EAAE;oBACf,IAAI,EAAE,+BAA+B,aAAa,EAAE;iBACrD;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,WAAW,EAAE,GAAG,OAAO,IAAI,aAAa,EAAE;gBAC1C,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,YAAY,CAAC,UAAU;aACpC,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,4BAA4B,YAAY,EAAE,CAAC,CAAC;IAE9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
@@ -1,147 +0,0 @@
1
- // src/tools/autoDebugger.ts
2
- import { specUpdateHandler } from "./specTools.js";
3
- /**
4
- * Automatically analyze an error and create a debug log entry
5
- */
6
- export async function autoDebugError(context) {
7
- const errorMessage = context.error instanceof Error ? context.error.message : context.error;
8
- const errorStack = context.error instanceof Error ? context.error.stack : undefined;
9
- // Analyze the error to provide debugging insights
10
- const analysis = analyzeError(errorMessage, context.operation, errorStack, context.context);
11
- // Automatically create debug log entry
12
- await specUpdateHandler({
13
- spec_id: context.spec_id,
14
- debug_log: {
15
- timestamp: new Date().toISOString(),
16
- issue: analysis.issue,
17
- root_cause: analysis.root_cause,
18
- fix: analysis.fix,
19
- confidence: analysis.confidence
20
- }
21
- });
22
- return analysis;
23
- }
24
- /**
25
- * Analyze error patterns to provide debugging insights
26
- */
27
- function analyzeError(errorMessage, operation, stack, context) {
28
- const lowerError = errorMessage.toLowerCase();
29
- // TypeScript compilation errors
30
- if (lowerError.includes("property") && lowerError.includes("does not exist")) {
31
- return {
32
- issue: `TypeScript property access error during ${operation}: ${errorMessage}`,
33
- root_cause: "Attempting to access property that doesn't exist on the object type. Likely incorrect property name or missing type definition.",
34
- fix: "Check object structure, verify property names match interface/type definitions, or add missing properties to type definitions.",
35
- confidence: "high"
36
- };
37
- }
38
- // Cannot redeclare variable errors
39
- if (lowerError.includes("cannot redeclare") && lowerError.includes("variable")) {
40
- return {
41
- issue: `Variable redeclaration error during ${operation}: ${errorMessage}`,
42
- root_cause: "Block-scoped variable (let/const) is being declared multiple times in the same scope.",
43
- fix: "Rename one of the variables, use different scope blocks, or check for duplicate declarations.",
44
- confidence: "high"
45
- };
46
- }
47
- // Missing module errors
48
- if (lowerError.includes("cannot find module") || lowerError.includes("module not found")) {
49
- return {
50
- issue: `Module resolution error during ${operation}: ${errorMessage}`,
51
- root_cause: "Import statement references a module that cannot be found. Could be missing dependency, incorrect path, or case sensitivity issue.",
52
- fix: "Verify module path exists, check npm dependencies are installed, verify import statement syntax, or check file case sensitivity.",
53
- confidence: "high"
54
- };
55
- }
56
- // Git operation errors
57
- if (lowerError.includes("git") && (lowerError.includes("branch") || lowerError.includes("worktree"))) {
58
- return {
59
- issue: `Git operation error during ${operation}: ${errorMessage}`,
60
- root_cause: "Git command failed. Could be permissions, branch state, merge conflicts, or repository state issues.",
61
- fix: "Check git status, resolve any conflicts, verify branch exists, check repository permissions, or ensure working directory is clean.",
62
- confidence: "medium"
63
- };
64
- }
65
- // File system errors
66
- if (lowerError.includes("enoent") || lowerError.includes("no such file")) {
67
- return {
68
- issue: `File system error during ${operation}: ${errorMessage}`,
69
- root_cause: "Attempting to access a file or directory that doesn't exist.",
70
- fix: "Verify file path exists, check permissions, ensure directory structure is correct, or create missing directories/files.",
71
- confidence: "high"
72
- };
73
- }
74
- // Permission errors
75
- if (lowerError.includes("permission denied") || lowerError.includes("eacces")) {
76
- return {
77
- issue: `Permission error during ${operation}: ${errorMessage}`,
78
- root_cause: "Insufficient permissions to perform the requested operation.",
79
- fix: "Check file/directory permissions, run with appropriate privileges, or modify ownership/permissions.",
80
- confidence: "high"
81
- };
82
- }
83
- // Network/timeout errors
84
- if (lowerError.includes("timeout") || lowerError.includes("network") || lowerError.includes("connection")) {
85
- return {
86
- issue: `Network/timeout error during ${operation}: ${errorMessage}`,
87
- root_cause: "Network connectivity issue, timeout, or service unavailability.",
88
- fix: "Check network connection, verify service endpoints, increase timeout values, or retry the operation.",
89
- confidence: "medium"
90
- };
91
- }
92
- // JSON parsing errors
93
- if (lowerError.includes("json") && lowerError.includes("parse")) {
94
- return {
95
- issue: `JSON parsing error during ${operation}: ${errorMessage}`,
96
- root_cause: "Invalid JSON format or corrupted data structure.",
97
- fix: "Validate JSON structure, check for trailing commas, verify quotes and brackets, or regenerate the JSON data.",
98
- confidence: "high"
99
- };
100
- }
101
- // Generic fallback analysis
102
- return {
103
- issue: `Unhandled error during ${operation}: ${errorMessage}`,
104
- root_cause: "Error type not specifically recognized. May require manual investigation.",
105
- fix: "Review error details, check operation context, examine stack trace if available, and investigate related code/dependencies.",
106
- confidence: "low"
107
- };
108
- }
109
- /**
110
- * Enhanced error wrapper that automatically creates debug logs
111
- */
112
- export async function withAutoDebug(spec_id, operation, fn, context) {
113
- try {
114
- return await fn();
115
- }
116
- catch (error) {
117
- // Auto-create debug log
118
- await autoDebugError({
119
- spec_id,
120
- operation,
121
- error: error,
122
- context
123
- });
124
- // Re-throw the error so calling code can handle it appropriately
125
- throw error;
126
- }
127
- }
128
- /**
129
- * Check if an error indicates a need for debugger intervention
130
- */
131
- export function shouldInvokeDebugger(error) {
132
- const errorMessage = error instanceof Error ? error.message : error;
133
- const lowerError = errorMessage.toLowerCase();
134
- // Critical errors that need immediate debugging
135
- const criticalPatterns = [
136
- "cannot find module",
137
- "permission denied",
138
- "enoent",
139
- "cannot redeclare",
140
- "property does not exist",
141
- "git",
142
- "network",
143
- "timeout"
144
- ];
145
- return criticalPatterns.some(pattern => lowerError.includes(pattern));
146
- }
147
- //# sourceMappingURL=autoDebugger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autoDebugger.js","sourceRoot":"","sources":["../../src/tools/autoDebugger.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAgBnD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAyB;IAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC5F,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpF,kDAAkD;IAClD,MAAM,QAAQ,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5F,uCAAuC;IACvC,MAAM,iBAAiB,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE;YACT,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CACnB,YAAoB,EACpB,SAAiB,EACjB,KAAc,EACd,OAAa;IAEb,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,EA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AE;QAC7D,UAAU,EAAE,2EAA2E;QACvF,GAAG,EAAE,6HAA6H;QAClI,UAAU,EAAE,KAAK;KAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAe,EACf,SAAiB,EACjB,EAAoB,EACpB,OAAa;IAEb,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wBAAwB;QACxB,MAAM,cAAc,CAAC;YACnB,OAAO;YACP,SAAS;YACT,KAAK,EAAE,KAAc;YACrB,OAAO;SACR,CAAC,CAAC;QAEH,iEAAiE;QACjE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAqB;IACxD,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IACpE,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IAE9C,gDAAgD;IAChD,MAAM,gBAAgB,GAAG;QACvB,oBAAoB;QACpB,mBAAmB;QACnB,QAAQ;QACR,kBAAkB;QAClB,yBAAyB;QACzB,KAAK;QACL,SAAS;QACT,SAAS;KACV,CAAC;IAEF,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -1,221 +0,0 @@
1
- // src/tools/cleanupService.ts
2
- import { worktreeListHandler, worktreeRemoveHandler } from "./worktreeTools.js";
3
- import { specListHandler } from "./specTools.js";
4
- /**
5
- * Comprehensive cleanup service for Bob's Workshop
6
- */
7
- export class CleanupService {
8
- constructor() { }
9
- static getInstance() {
10
- if (!CleanupService.instance) {
11
- CleanupService.instance = new CleanupService();
12
- }
13
- return CleanupService.instance;
14
- }
15
- /**
16
- * Start automatic cleanup with periodic maintenance
17
- */
18
- startAutoCleanup(intervalMinutes = 30) {
19
- this.cleanupInterval = setInterval(async () => {
20
- try {
21
- await this.performCleanup({
22
- maxWorktreeAge: 7, // 7 days
23
- cleanTempFiles: true,
24
- stopOrphanedRecorders: true,
25
- forceCleanup: false
26
- });
27
- }
28
- catch (error) {
29
- console.log('[CLEANUP] Auto-cleanup failed:', error);
30
- }
31
- }, intervalMinutes * 60 * 1000);
32
- }
33
- /**
34
- * Stop automatic cleanup
35
- */
36
- stopAutoCleanup() {
37
- if (this.cleanupInterval) {
38
- clearInterval(this.cleanupInterval);
39
- this.cleanupInterval = undefined;
40
- }
41
- }
42
- /**
43
- * Perform comprehensive cleanup
44
- */
45
- async performCleanup(options) {
46
- const result = {
47
- staleWorktrees: 0,
48
- orphanedRecorders: 0,
49
- tempFilesCleared: 0,
50
- errors: []
51
- };
52
- try {
53
- // Clean up stale worktrees
54
- result.staleWorktrees = await this.cleanupStaleWorktrees(options.maxWorktreeAge, options.forceCleanup);
55
- // Stop orphaned work recorders
56
- if (options.stopOrphanedRecorders) {
57
- result.orphanedRecorders = await this.cleanupOrphanedRecorders();
58
- }
59
- // Clean temporary files
60
- if (options.cleanTempFiles) {
61
- result.tempFilesCleared = await this.cleanupTempFiles();
62
- }
63
- }
64
- catch (error) {
65
- const errorMsg = error instanceof Error ? error.message : String(error);
66
- result.errors.push(errorMsg);
67
- }
68
- return result;
69
- }
70
- /**
71
- * Clean up stale worktrees that are no longer needed
72
- */
73
- async cleanupStaleWorktrees(maxAgeDays, forceCleanup) {
74
- try {
75
- const worktrees = await worktreeListHandler();
76
- const cutoffDate = new Date();
77
- cutoffDate.setDate(cutoffDate.getDate() - maxAgeDays);
78
- let cleanedCount = 0;
79
- const allWorktrees = [...(worktrees.committed || []), ...(worktrees.dirty || []), ...(worktrees.clean || [])];
80
- for (const worktree of allWorktrees) {
81
- try {
82
- const lastModified = new Date(worktree.last_modified || worktree.created_at);
83
- const isStale = lastModified < cutoffDate;
84
- const isCompleted = worktree.status === 'completed' || worktree.status === 'merged';
85
- if ((isStale || isCompleted) && (forceCleanup || isCompleted)) {
86
- await worktreeRemoveHandler({ worktree_id: worktree.worktree_id });
87
- cleanedCount++;
88
- console.log(`[CLEANUP] Removed stale worktree: ${worktree.worktree_id}`);
89
- }
90
- }
91
- catch (error) {
92
- console.log(`[CLEANUP] Failed to remove worktree ${worktree.worktree_id}:`, error);
93
- }
94
- }
95
- return cleanedCount;
96
- }
97
- catch (error) {
98
- console.log('[CLEANUP] Failed to cleanup worktrees:', error);
99
- return 0;
100
- }
101
- }
102
- /**
103
- * Stop work recorders for completed or stale specs
104
- * NOTE: WorkRecorder removed - enhanced activities system handles logging now
105
- */
106
- async cleanupOrphanedRecorders() {
107
- // WorkRecorder removed - no-op now
108
- return 0;
109
- }
110
- /**
111
- * Clean up temporary files and directories
112
- */
113
- async cleanupTempFiles() {
114
- try {
115
- // This would clean up temp files, logs, etc.
116
- // For now, just return 0 as a placeholder
117
- // In a real implementation, you'd scan and clean:
118
- // - /tmp/claude/* files older than X days
119
- // - .bob/logs/* files older than X days
120
- // - node_modules/.cache/* files
121
- return 0;
122
- }
123
- catch (error) {
124
- console.log('[CLEANUP] Failed to cleanup temp files:', error);
125
- return 0;
126
- }
127
- }
128
- /**
129
- * Handle critical errors with recovery attempts
130
- */
131
- async handleCriticalError(spec_id, error, operation, recoveryActions) {
132
- console.log(`[CLEANUP] Handling critical error in ${operation} for spec ${spec_id}:`, error.message);
133
- try {
134
- // Attempt recovery actions if provided
135
- if (recoveryActions) {
136
- for (const action of recoveryActions) {
137
- try {
138
- await action();
139
- }
140
- catch (recoveryError) {
141
- console.log('[CLEANUP] Recovery action failed:', recoveryError);
142
- }
143
- }
144
- }
145
- // Force cleanup for this spec's resources
146
- await this.performCleanup({
147
- maxWorktreeAge: 0, // Clean immediately
148
- cleanTempFiles: true,
149
- stopOrphanedRecorders: true,
150
- forceCleanup: true
151
- });
152
- return true;
153
- }
154
- catch (cleanupError) {
155
- console.log('[CLEANUP] Critical error handling failed:', cleanupError);
156
- return false;
157
- }
158
- }
159
- /**
160
- * Get cleanup statistics and recommendations
161
- */
162
- async getCleanupStats() {
163
- try {
164
- const worktrees = await worktreeListHandler();
165
- const specs = await specListHandler({});
166
- const allWorktrees = [...(worktrees.committed || []), ...(worktrees.dirty || []), ...(worktrees.clean || [])];
167
- const totalWorktrees = allWorktrees.length;
168
- const cutoffDate = new Date();
169
- cutoffDate.setDate(cutoffDate.getDate() - 7);
170
- const staleWorktrees = allWorktrees.filter((w) => {
171
- const lastModified = new Date(w.last_modified || w.created_at);
172
- return lastModified < cutoffDate;
173
- }).length;
174
- const activeSpecs = specs.specs?.filter((s) => s.state === 'implementation' || s.state === 'approved').length || 0;
175
- const recommendations = [];
176
- if (staleWorktrees > 0) {
177
- recommendations.push(`Clean up ${staleWorktrees} stale worktrees`);
178
- }
179
- if (totalWorktrees > 10) {
180
- recommendations.push(`Consider cleaning worktrees (${totalWorktrees} total)`);
181
- }
182
- if (activeSpecs > 5) {
183
- recommendations.push(`Consider completing active specs (${activeSpecs} in progress)`);
184
- }
185
- return {
186
- totalWorktrees,
187
- staleWorktrees,
188
- activeRecorders: activeSpecs,
189
- recommendations
190
- };
191
- }
192
- catch (error) {
193
- return {
194
- totalWorktrees: 0,
195
- staleWorktrees: 0,
196
- activeRecorders: 0,
197
- recommendations: ['Unable to get cleanup stats due to error']
198
- };
199
- }
200
- }
201
- }
202
- // Export singleton instance
203
- export const cleanupService = CleanupService.getInstance();
204
- /**
205
- * Enhanced error wrapper with automatic cleanup on critical failures
206
- */
207
- export async function withErrorCleanup(spec_id, operation, fn, recoveryActions) {
208
- try {
209
- return await fn();
210
- }
211
- catch (error) {
212
- // Attempt cleanup and recovery for critical errors
213
- const recovered = await cleanupService.handleCriticalError(spec_id, error, operation, recoveryActions);
214
- if (!recovered) {
215
- console.log(`[CLEANUP] Failed to recover from critical error in ${operation}`);
216
- }
217
- // Re-throw the error so calling code can handle it appropriately
218
- throw error;
219
- }
220
- }
221
- //# sourceMappingURL=cleanupService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cleanupService.js","sourceRoot":"","sources":["../../src/tools/cleanupService.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAgBjD;;GAEG;AACH,MAAM,OAAO,cAAc;IAIzB,gBAAuB,CAAC;IAEjB,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;YAC7B,cAAc,CAAC,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;QACjD,CAAC;QACD,OAAO,cAAc,CAAC,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,kBAA0B,EAAE;QAClD,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;YAC5C,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,cAAc,CAAC;oBACxB,cAAc,EAAE,CAAC,EAAE,SAAS;oBAC5B,cAAc,EAAE,IAAI;oBACpB,qBAAqB,EAAE,IAAI;oBAC3B,YAAY,EAAE,KAAK;iBACpB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,EAAE,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACpC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACnC,CAAC;IACH,CAAC;IAED;;OAEG;IACI,KAAK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