maskweaver 0.9.3 → 0.9.5

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 (246) hide show
  1. package/README.ko.md +279 -325
  2. package/README.md +109 -113
  3. package/assets/commands/meta/commands.json +34 -34
  4. package/assets/commands/weave-agents.md +12 -52
  5. package/assets/commands/weave-approve.md +12 -51
  6. package/assets/commands/weave-archive.md +21 -0
  7. package/assets/commands/weave-build.md +20 -89
  8. package/assets/commands/weave-craft.md +22 -43
  9. package/assets/commands/weave-help.md +37 -106
  10. package/assets/commands/weave-init.md +26 -108
  11. package/assets/commands/weave-interview.md +13 -111
  12. package/assets/commands/weave-map.md +13 -99
  13. package/assets/commands/weave-prepare.md +23 -69
  14. package/assets/commands/weave-refine-plan.md +26 -59
  15. package/assets/commands/weave-repair.md +22 -70
  16. package/assets/commands/weave-status.md +22 -155
  17. package/assets/commands/weave-troubleshoot.md +11 -47
  18. package/assets/commands/weave-verify.md +23 -44
  19. package/assets/commands/weave-worktree.md +27 -69
  20. package/dist/cli/doctor.js +5 -21
  21. package/dist/cli/install.d.ts +0 -8
  22. package/dist/cli/install.js +0 -39
  23. package/dist/context/config.d.ts +0 -22
  24. package/dist/context/config.js +0 -28
  25. package/dist/context/feature.d.ts +0 -39
  26. package/dist/context/feature.js +0 -77
  27. package/dist/context/files.d.ts +0 -13
  28. package/dist/context/files.js +1 -24
  29. package/dist/context/index.d.ts +0 -7
  30. package/dist/context/index.js +0 -12
  31. package/dist/context/project.d.ts +0 -21
  32. package/dist/context/project.js +0 -30
  33. package/dist/context/types.d.ts +0 -48
  34. package/dist/context/types.js +0 -12
  35. package/dist/context/utils.d.ts +0 -18
  36. package/dist/context/utils.js +0 -27
  37. package/dist/core/engine/promptBuilder.d.ts +0 -17
  38. package/dist/core/engine/promptBuilder.js +0 -28
  39. package/dist/core/index.d.ts +0 -6
  40. package/dist/core/index.js +0 -9
  41. package/dist/core/loader/MaskLoader.d.ts +0 -23
  42. package/dist/core/loader/MaskLoader.js +0 -29
  43. package/dist/core/schema/types.d.ts +0 -47
  44. package/dist/core/schema/types.js +0 -6
  45. package/dist/core/schema/validator.d.ts +0 -14
  46. package/dist/core/schema/validator.js +0 -18
  47. package/dist/i18n/index.d.ts +0 -18
  48. package/dist/i18n/index.js +4 -23
  49. package/dist/index.d.ts +0 -8
  50. package/dist/index.js +0 -8
  51. package/dist/lib.d.ts +0 -5
  52. package/dist/lib.js +0 -12
  53. package/dist/memory/chunking.d.ts +0 -22
  54. package/dist/memory/chunking.js +2 -37
  55. package/dist/memory/core.d.ts +0 -29
  56. package/dist/memory/core.js +1 -52
  57. package/dist/memory/index.d.ts +0 -5
  58. package/dist/memory/index.js +0 -10
  59. package/dist/memory/indexer.d.ts +0 -21
  60. package/dist/memory/indexer.js +0 -44
  61. package/dist/memory/providers/examples.d.ts +0 -5
  62. package/dist/memory/providers/examples.js +4 -64
  63. package/dist/memory/providers/factory.d.ts +0 -44
  64. package/dist/memory/providers/factory.js +0 -46
  65. package/dist/memory/providers/index.d.ts +0 -26
  66. package/dist/memory/providers/index.js +0 -28
  67. package/dist/memory/providers/ollama.d.ts +0 -6
  68. package/dist/memory/providers/ollama.js +1 -8
  69. package/dist/memory/providers/openai.d.ts +0 -6
  70. package/dist/memory/providers/openai.js +1 -8
  71. package/dist/memory/providers/openrouter.d.ts +0 -6
  72. package/dist/memory/providers/openrouter.js +0 -8
  73. package/dist/memory/providers/text-only.d.ts +0 -13
  74. package/dist/memory/providers/text-only.js +0 -17
  75. package/dist/memory/providers/types.d.ts +0 -39
  76. package/dist/memory/providers/types.js +0 -7
  77. package/dist/memory/providers/voyage.d.ts +0 -22
  78. package/dist/memory/providers/voyage.js +1 -24
  79. package/dist/memory/search/hybrid.d.ts +0 -12
  80. package/dist/memory/search/hybrid.js +1 -22
  81. package/dist/memory/store/sqlite.d.ts +0 -72
  82. package/dist/memory/store/sqlite.js +4 -127
  83. package/dist/plugin/config/index.d.ts +0 -112
  84. package/dist/plugin/config/index.js +0 -115
  85. package/dist/plugin/index.d.ts +0 -13
  86. package/dist/plugin/index.js +1 -124
  87. package/dist/plugin/tools/command-registry.d.ts +0 -6
  88. package/dist/plugin/tools/command-registry.js +0 -14
  89. package/dist/plugin/tools/context.d.ts +0 -12
  90. package/dist/plugin/tools/context.js +0 -58
  91. package/dist/plugin/tools/maskSave.d.ts +0 -3
  92. package/dist/plugin/tools/maskSave.js +0 -3
  93. package/dist/plugin/tools/memoryGet.d.ts +0 -3
  94. package/dist/plugin/tools/memoryGet.js +0 -3
  95. package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
  96. package/dist/plugin/tools/memoryIndexer.js +0 -10
  97. package/dist/plugin/tools/memorySearch.d.ts +0 -31
  98. package/dist/plugin/tools/memorySearch.js +0 -79
  99. package/dist/plugin/tools/memoryWrite.d.ts +0 -8
  100. package/dist/plugin/tools/memoryWrite.js +0 -32
  101. package/dist/plugin/tools/retrospect.d.ts +0 -3
  102. package/dist/plugin/tools/retrospect.js +0 -3
  103. package/dist/plugin/tools/slashcommand.d.ts +0 -11
  104. package/dist/plugin/tools/slashcommand.js +0 -38
  105. package/dist/plugin/tools/squad.d.ts +0 -12
  106. package/dist/plugin/tools/squad.js +11 -83
  107. package/dist/plugin/tools/weave.d.ts +0 -6
  108. package/dist/plugin/tools/weave.js +0 -78
  109. package/dist/plugin/types.d.ts +0 -20
  110. package/dist/plugin/types.js +0 -7
  111. package/dist/retrospect/index.d.ts +0 -7
  112. package/dist/retrospect/index.js +0 -9
  113. package/dist/retrospect/mask-save.d.ts +0 -12
  114. package/dist/retrospect/mask-save.js +1 -80
  115. package/dist/retrospect/retrospect.d.ts +0 -18
  116. package/dist/retrospect/retrospect.js +0 -63
  117. package/dist/retrospect/strategies/base.d.ts +0 -15
  118. package/dist/retrospect/strategies/base.js +0 -7
  119. package/dist/retrospect/strategies/deep.d.ts +0 -12
  120. package/dist/retrospect/strategies/deep.js +0 -24
  121. package/dist/retrospect/strategies/index.d.ts +0 -12
  122. package/dist/retrospect/strategies/index.js +0 -12
  123. package/dist/retrospect/strategies/quick.d.ts +0 -12
  124. package/dist/retrospect/strategies/quick.js +0 -19
  125. package/dist/retrospect/strategies/standard.d.ts +0 -12
  126. package/dist/retrospect/strategies/standard.js +0 -15
  127. package/dist/retrospect/types.d.ts +0 -7
  128. package/dist/retrospect/types.js +0 -7
  129. package/dist/shared/config.d.ts +0 -105
  130. package/dist/shared/config.js +0 -33
  131. package/dist/shared/errors.d.ts +0 -18
  132. package/dist/shared/errors.js +0 -19
  133. package/dist/shared/generate-agents.d.ts +0 -69
  134. package/dist/shared/generate-agents.js +2 -86
  135. package/dist/shared/image.d.ts +0 -67
  136. package/dist/shared/image.js +6 -104
  137. package/dist/shared/index.d.ts +0 -5
  138. package/dist/shared/index.js +0 -7
  139. package/dist/shared/model-registry.d.ts +0 -72
  140. package/dist/shared/model-registry.js +5 -95
  141. package/dist/shared/types.d.ts +0 -15
  142. package/dist/shared/types.js +0 -3
  143. package/dist/shared-context/dag.d.ts +0 -105
  144. package/dist/shared-context/dag.js +3 -114
  145. package/dist/shared-context/index.d.ts +0 -5
  146. package/dist/shared-context/index.js +0 -15
  147. package/dist/shared-context/logger.d.ts +0 -37
  148. package/dist/shared-context/logger.js +0 -41
  149. package/dist/shared-context/parallel-executor.d.ts +0 -54
  150. package/dist/shared-context/parallel-executor.js +4 -56
  151. package/dist/shared-context/session.d.ts +0 -56
  152. package/dist/shared-context/session.js +0 -47
  153. package/dist/shared-context/squad.d.ts +0 -68
  154. package/dist/shared-context/squad.js +0 -63
  155. package/dist/shared-context/storage.d.ts +0 -132
  156. package/dist/shared-context/storage.js +0 -116
  157. package/dist/shared-context/task.d.ts +0 -120
  158. package/dist/shared-context/task.js +0 -152
  159. package/dist/shared-context/test/dag.test.js +9 -14
  160. package/dist/shared-context/test/logger.test.d.ts +0 -8
  161. package/dist/shared-context/test/logger.test.js +0 -52
  162. package/dist/shared-context/test/session.test.d.ts +0 -7
  163. package/dist/shared-context/test/session.test.js +0 -63
  164. package/dist/shared-context/test/squad.test.d.ts +0 -10
  165. package/dist/shared-context/test/squad.test.js +2 -68
  166. package/dist/shared-context/test/storage.test.d.ts +0 -8
  167. package/dist/shared-context/test/storage.test.js +0 -68
  168. package/dist/shared-context/test/task.test.d.ts +0 -7
  169. package/dist/shared-context/test/task.test.js +0 -54
  170. package/dist/shared-context/test/watchdog.test.d.ts +0 -7
  171. package/dist/shared-context/test/watchdog.test.js +3 -58
  172. package/dist/shared-context/types.d.ts +0 -215
  173. package/dist/shared-context/types.js +0 -125
  174. package/dist/shared-context/watchdog.d.ts +0 -127
  175. package/dist/shared-context/watchdog.js +0 -148
  176. package/dist/shared-context/worktree.d.ts +0 -68
  177. package/dist/shared-context/worktree.js +2 -34
  178. package/dist/verify/budget.d.ts +0 -29
  179. package/dist/verify/budget.js +0 -34
  180. package/dist/verify/critical-files.d.ts +0 -17
  181. package/dist/verify/critical-files.js +0 -37
  182. package/dist/verify/escalation.d.ts +0 -20
  183. package/dist/verify/escalation.js +0 -22
  184. package/dist/verify/index.d.ts +0 -5
  185. package/dist/verify/index.js +0 -11
  186. package/dist/verify/prompts.d.ts +0 -20
  187. package/dist/verify/prompts.js +0 -20
  188. package/dist/verify/types.d.ts +0 -26
  189. package/dist/verify/types.js +1 -12
  190. package/dist/verify/verifier.d.ts +0 -29
  191. package/dist/verify/verifier.js +0 -54
  192. package/dist/version.d.ts +1 -16
  193. package/dist/version.js +1 -16
  194. package/dist/weave/bridge.d.ts +0 -35
  195. package/dist/weave/bridge.js +0 -51
  196. package/dist/weave/environment/detector.d.ts +0 -6
  197. package/dist/weave/environment/detector.js +4 -45
  198. package/dist/weave/environment/index.d.ts +0 -19
  199. package/dist/weave/environment/index.js +1 -39
  200. package/dist/weave/environment/issues.d.ts +0 -35
  201. package/dist/weave/environment/issues.js +0 -59
  202. package/dist/weave/git.d.ts +0 -8
  203. package/dist/weave/git.js +0 -8
  204. package/dist/weave/index.d.ts +0 -13
  205. package/dist/weave/index.js +2 -28
  206. package/dist/weave/knowledge/global.d.ts +0 -39
  207. package/dist/weave/knowledge/global.js +2 -78
  208. package/dist/weave/loop.js +0 -3
  209. package/dist/weave/orchestrator.d.ts +0 -69
  210. package/dist/weave/orchestrator.js +1 -101
  211. package/dist/weave/phase-manager.d.ts +0 -64
  212. package/dist/weave/phase-manager.js +0 -89
  213. package/dist/weave/security/secret-scan.d.ts +0 -14
  214. package/dist/weave/security/secret-scan.js +0 -19
  215. package/dist/weave/stages/build.js +0 -15
  216. package/dist/weave/stages/execute.d.ts +0 -42
  217. package/dist/weave/stages/execute.js +4 -86
  218. package/dist/weave/stages/handoff.d.ts +0 -7
  219. package/dist/weave/stages/handoff.js +0 -43
  220. package/dist/weave/stages/index.d.ts +0 -3
  221. package/dist/weave/stages/index.js +0 -3
  222. package/dist/weave/stages/intake.d.ts +0 -8
  223. package/dist/weave/stages/intake.js +5 -65
  224. package/dist/weave/stages/map.d.ts +0 -1
  225. package/dist/weave/stages/openspec.d.ts +0 -1
  226. package/dist/weave/stages/plan.d.ts +0 -11
  227. package/dist/weave/stages/plan.js +1 -53
  228. package/dist/weave/stages/refine.d.ts +0 -7
  229. package/dist/weave/stages/refine.js +0 -7
  230. package/dist/weave/stages/research.d.ts +0 -6
  231. package/dist/weave/stages/research.js +0 -6
  232. package/dist/weave/stages/spec.d.ts +0 -12
  233. package/dist/weave/stages/spec.js +0 -17
  234. package/dist/weave/types.d.ts +0 -20
  235. package/dist/weave/types.js +0 -5
  236. package/dist/weave/verification/commands.d.ts +0 -12
  237. package/dist/weave/verification/commands.js +0 -19
  238. package/dist/weave/verification/index.d.ts +0 -6
  239. package/dist/weave/verification/index.js +1 -19
  240. package/dist/weave/verification/playwright.d.ts +0 -47
  241. package/dist/weave/verification/playwright.js +1 -90
  242. package/dist/weave/worktree.d.ts +0 -16
  243. package/dist/weave/worktree.js +0 -23
  244. package/dist/weave/yaml-repair.d.ts +0 -39
  245. package/dist/weave/yaml-repair.js +13 -116
  246. package/package.json +1 -1
@@ -1,39 +1,22 @@
1
- /**
2
- * Squad Management Tool
3
- *
4
- * Multi-agent collaboration session and squad management
5
- *
6
- * Design Principles:
7
- * - Intention-Revealing Code
8
- * - Clear error messages
9
- * - Consistent JSON response format (following context.ts pattern)
10
- *
11
- * @author Martin Fowler's Dummy Human
12
- */
13
1
  import { z } from "zod";
14
2
  import * as shared from '../../shared-context/index.js';
15
3
  import { join } from "path";
16
4
  import { getModelRegistry } from '../../shared/model-registry.js';
17
- // ============================================================================
18
- // Schema Definition
19
- // ============================================================================
20
5
  export const squadSchema = z.object({
21
6
  action: z.enum([
22
- "start", // Start new session (goal required)
23
- "squad", // Create squad (mission required)
24
- "assign", // Assign task (squadId, description, assignee required)
25
- "update", // Update task (squadId, taskId, status required)
26
- "complete", // Complete task (squadId, taskId, result required)
27
- "status", // View session/squad status
28
- "watchdog", // Run watchdog (dryRun optional)
29
- "list", // List all squads
30
- "plan", // Analyze task dependencies and create parallel execution plan
31
- "models" // Query available models and their concurrency status
7
+ "start",
8
+ "squad",
9
+ "assign",
10
+ "update",
11
+ "complete",
12
+ "status",
13
+ "watchdog",
14
+ "list",
15
+ "plan",
16
+ "models"
32
17
  ]).describe("Action to execute"),
33
- // start action params
34
18
  goal: z.string().optional().describe("Session goal (for start action)"),
35
19
  createdBy: z.string().optional().describe("Agent ID creating the session"),
36
- // squad action params
37
20
  mission: z.string().optional().describe("Squad mission (for squad action)"),
38
21
  operator: z.string().optional().describe("Squad operator agent ID"),
39
22
  scope: z.object({
@@ -45,25 +28,21 @@ export const squadSchema = z.object({
45
28
  tokenBudget: z.number().optional(),
46
29
  maxWorkers: z.number().optional(),
47
30
  }).optional().describe("Squad resource constraints"),
48
- // assign action params
49
31
  squadId: z.string().optional().describe("Target squad ID"),
50
32
  assignee: z.string().optional().describe("Agent to assign task to"),
51
33
  description: z.string().optional().describe("Task description"),
52
34
  priority: z.enum(["low", "medium", "high", "critical"]).optional()
53
35
  .describe("Task priority"),
54
- // update action params
55
36
  taskId: z.string().optional().describe("Task ID to update"),
56
37
  status: z.enum(["pending", "active", "paused", "completed", "failed"]).optional()
57
38
  .describe("New task status"),
58
39
  startedAt: z.string().optional().describe("Task start timestamp"),
59
- // complete action params
60
40
  success: z.boolean().optional().describe("Whether task succeeded"),
61
41
  output: z.unknown().optional().describe("Task output data"),
62
42
  error: z.object({
63
43
  code: z.string(),
64
44
  message: z.string(),
65
45
  }).optional().describe("Task error info"),
66
- // watchdog action params
67
46
  dryRun: z.boolean().optional().describe("Run watchdog without side effects"),
68
47
  });
69
48
  function createResponse(success, action, message, data) {
@@ -79,9 +58,6 @@ function successResponse(action, message, data) {
79
58
  function errorResponse(action, message) {
80
59
  return createResponse(false, action, message);
81
60
  }
82
- // ============================================================================
83
- // Active Session Management
84
- // ============================================================================
85
61
  const ACTIVE_SESSION_FILE = "shared/active.json";
86
62
  async function getActiveSessionId(basePath) {
87
63
  const storage = new shared.FileStorageAdapter(join(basePath, ".opencode"));
@@ -104,12 +80,6 @@ async function loadActiveSession(basePath) {
104
80
  const storage = new shared.FileStorageAdapter(join(basePath, ".opencode"));
105
81
  return shared.loadSession(storage, sessionId);
106
82
  }
107
- // ============================================================================
108
- // Tool Factory
109
- // ============================================================================
110
- /**
111
- * Analyze task dependencies and create parallel execution plan
112
- */
113
83
  async function handlePlan(basePath, squadId) {
114
84
  if (!squadId || squadId.trim().length === 0) {
115
85
  return errorResponse("plan", 'Squad ID is required. Example: squadId="squad-abc123"');
@@ -138,7 +108,7 @@ async function handlePlan(basePath, squadId) {
138
108
  criticalPath: plan.dag.criticalPath,
139
109
  hasCycle: plan.dag.hasCycle,
140
110
  waves: plan.waves,
141
- rawOutput: planOutput, // Include a raw string for easier display
111
+ rawOutput: planOutput,
142
112
  });
143
113
  }
144
114
  catch (error) {
@@ -224,14 +194,6 @@ Direct use of assign/update/complete by primary agent pollutes strategic context
224
194
  }
225
195
  };
226
196
  }
227
- // ============================================================================
228
- // Action Handlers
229
- // ============================================================================
230
- /**
231
- * Start a new collaboration session
232
- *
233
- * Creates a session and sets it as the active session.
234
- */
235
197
  async function handleStart(basePath, goal, createdBy) {
236
198
  if (!goal || goal.trim().length === 0) {
237
199
  return errorResponse("start", 'Session goal (goal) is required. Example: goal="Implement OAuth login"');
@@ -242,7 +204,6 @@ async function handleStart(basePath, goal, createdBy) {
242
204
  goal,
243
205
  createdBy: agentId,
244
206
  });
245
- // Set as active session
246
207
  await setActiveSession(basePath, session.manifest.sessionId, goal);
247
208
  return successResponse("start", `Session started: ${goal}`, {
248
209
  sessionId: session.manifest.sessionId,
@@ -252,9 +213,6 @@ async function handleStart(basePath, goal, createdBy) {
252
213
  basePath: session.sessionPath,
253
214
  });
254
215
  }
255
- /**
256
- * Create a new squad within the active session
257
- */
258
216
  async function handleSquad(basePath, mission, operator, scope, constraints) {
259
217
  if (!mission || mission.trim().length === 0) {
260
218
  return errorResponse("squad", 'Squad mission is required. Example: mission="Implement user authentication"');
@@ -282,9 +240,6 @@ async function handleSquad(basePath, mission, operator, scope, constraints) {
282
240
  createdAt: spec.createdAt,
283
241
  });
284
242
  }
285
- /**
286
- * Assign a task to an agent within a squad
287
- */
288
243
  async function handleAssign(basePath, squadId, assignee, description, priority) {
289
244
  if (!squadId || squadId.trim().length === 0) {
290
245
  return errorResponse("assign", 'Squad ID is required. Example: squadId="squad-abc123"');
@@ -313,9 +268,6 @@ async function handleAssign(basePath, squadId, assignee, description, priority)
313
268
  createdAt: task.createdAt,
314
269
  });
315
270
  }
316
- /**
317
- * Update a task's status
318
- */
319
271
  async function handleUpdate(basePath, squadId, taskId, status, startedAt) {
320
272
  if (!squadId || squadId.trim().length === 0) {
321
273
  return errorResponse("update", 'Squad ID is required. Example: squadId="squad-abc123"');
@@ -343,9 +295,6 @@ async function handleUpdate(basePath, squadId, taskId, status, startedAt) {
343
295
  startedAt: updatedTask.startedAt,
344
296
  });
345
297
  }
346
- /**
347
- * Complete a task with result
348
- */
349
298
  async function handleComplete(basePath, squadId, taskId, success, output, error) {
350
299
  if (!squadId || squadId.trim().length === 0) {
351
300
  return errorResponse("complete", 'Squad ID is required. Example: squadId="squad-abc123"');
@@ -360,7 +309,6 @@ async function handleComplete(basePath, squadId, taskId, success, output, error)
360
309
  if (!session) {
361
310
  return errorResponse("complete", 'No active session. Start a session first with action="start"');
362
311
  }
363
- // Build TaskResult
364
312
  const result = success
365
313
  ? { success: true, output }
366
314
  : { success: false, error: error ?? { code: "UNKNOWN", message: "Task failed" } };
@@ -373,9 +321,6 @@ async function handleComplete(basePath, squadId, taskId, success, output, error)
373
321
  result: completedTask.result,
374
322
  });
375
323
  }
376
- /**
377
- * View session or squad status
378
- */
379
324
  async function handleStatus(basePath, squadId) {
380
325
  const session = await loadActiveSession(basePath);
381
326
  if (!session) {
@@ -383,7 +328,6 @@ async function handleStatus(basePath, squadId) {
383
328
  hasActiveSession: false,
384
329
  });
385
330
  }
386
- // If squadId provided, show squad details
387
331
  if (squadId && squadId.trim().length > 0) {
388
332
  const squad = await shared.getSquad(session, squadId);
389
333
  if (!squad) {
@@ -409,7 +353,6 @@ async function handleStatus(basePath, squadId) {
409
353
  updatedAt: squad.state.updatedAt,
410
354
  });
411
355
  }
412
- // Show session overview
413
356
  const squads = [];
414
357
  for (const sid of session.manifest.squads) {
415
358
  const squad = await shared.getSquad(session, sid);
@@ -431,9 +374,6 @@ async function handleStatus(basePath, squadId) {
431
374
  squads,
432
375
  });
433
376
  }
434
- /**
435
- * Run watchdog to detect stuck squads/tasks
436
- */
437
377
  async function handleWatchdog(basePath, dryRun) {
438
378
  const session = await loadActiveSession(basePath);
439
379
  if (!session) {
@@ -455,9 +395,6 @@ async function handleWatchdog(basePath, dryRun) {
455
395
  dryRun: dryRun ?? false,
456
396
  });
457
397
  }
458
- /**
459
- * List all squads in the active session
460
- */
461
398
  async function handleList(basePath) {
462
399
  const session = await loadActiveSession(basePath);
463
400
  if (!session) {
@@ -482,7 +419,6 @@ async function handleList(basePath) {
482
419
  });
483
420
  }
484
421
  }
485
- // Group by status
486
422
  const counts = {
487
423
  pending: squads.filter(s => s.status === "pending").length,
488
424
  active: squads.filter(s => s.status === "active").length,
@@ -497,13 +433,6 @@ async function handleList(basePath) {
497
433
  squads,
498
434
  });
499
435
  }
500
- // ============================================================================
501
- // Models Handler - Query model pool status
502
- // ============================================================================
503
- /**
504
- * Show available models and their concurrency status.
505
- * Used by Squad Operator to make informed assignee decisions.
506
- */
507
436
  async function handleModels() {
508
437
  try {
509
438
  const registry = getModelRegistry();
@@ -521,7 +450,6 @@ async function handleModels() {
521
450
  available: m.available,
522
451
  description: m.entry.description || '',
523
452
  }));
524
- // Group by tier
525
453
  const byTier = {};
526
454
  for (const m of modelDetails) {
527
455
  (byTier[m.tier] ??= []).push(m);
@@ -1,9 +1,3 @@
1
- /**
2
- * Weave Tool for OpenCode Plugin
3
- *
4
- * Integrates Weave workflow into OpenCode as a tool.
5
- * Commands: design, craft, status
6
- */
7
1
  import { z } from 'zod';
8
2
  export declare function createWeaveTool(): {
9
3
  description: string;
@@ -1,11 +1,4 @@
1
- /**
2
- * Weave Tool for OpenCode Plugin
3
- *
4
- * Integrates Weave workflow into OpenCode as a tool.
5
- * Commands: design, craft, status
6
- */
7
1
  import { z } from 'zod';
8
- // Inline shim: tool() is just an identity function in @opencode-ai/plugin
9
2
  const tool = (input) => input;
10
3
  import { createHash } from 'node:crypto';
11
4
  import * as os from 'node:os';
@@ -39,9 +32,6 @@ import { acquireLoopOperatorLock, appendLoopEvent, createLoopRun, ensureLoopCont
39
32
  import { getEffectiveGdcConfig, runGdcMachineCommand, countGdcCheckIssues, getStatsNodeSummary, } from '../../weave/gdc.js';
40
33
  import { generatePoolAgentFilesFromConfig, writeDefaultRuntimeConfig, writeDefaultPluginConfig, } from '../../shared/generate-agents.js';
41
34
  import { resolveCommand, loadCommandsJson } from './command-registry.js';
42
- // ============================================================================
43
- // Tool Factory
44
- // ============================================================================
45
35
  export function createWeaveTool() {
46
36
  return {
47
37
  description: (() => {
@@ -145,7 +135,6 @@ export function createWeaveTool() {
145
135
  execute: async (args, context) => {
146
136
  const { command } = args;
147
137
  const basePath = context.worktree;
148
- // Resolve command aliases and deprecation
149
138
  const resolved = resolveCommand(command);
150
139
  if ('error' in resolved) {
151
140
  return `Error: ${resolved.error}`;
@@ -215,9 +204,6 @@ export function createWeaveTool() {
215
204
  },
216
205
  };
217
206
  }
218
- // ============================================================================
219
- // Command Handlers
220
- // ============================================================================
221
207
  function toWorkspaceRelative(basePath, filePath) {
222
208
  const rel = path.relative(basePath, filePath);
223
209
  if (!rel || rel.startsWith('..'))
@@ -1094,7 +1080,6 @@ async function migrateLegacyPlanIfNeeded(basePath, activePlan) {
1094
1080
  await unlink(legacyPlanPath);
1095
1081
  }
1096
1082
  catch {
1097
- // Non-fatal. Keep migrated plan and continue.
1098
1083
  }
1099
1084
  return {
1100
1085
  migrated: true,
@@ -1241,7 +1226,6 @@ async function handleInit(basePath) {
1241
1226
  lines.push('');
1242
1227
  lines.push(...gdcReport);
1243
1228
  lines.push('');
1244
- // Check global config
1245
1229
  const globalConfigPath = path.join(os.homedir(), '.config', 'opencode', 'maskweaver.config.json');
1246
1230
  if (!fs.existsSync(globalConfigPath)) {
1247
1231
  lines.push('');
@@ -1389,7 +1373,6 @@ async function handleApprovePlan(args, basePath) {
1389
1373
  }
1390
1374
  }
1391
1375
  catch {
1392
- // Optional note file.
1393
1376
  }
1394
1377
  }
1395
1378
  activePlan.planApproved = true;
@@ -1416,7 +1399,6 @@ async function handleDesign(args, basePath) {
1416
1399
  if (!docsPath) {
1417
1400
  return 'Error: docsPath is required for design command. Example: weave design docs/';
1418
1401
  }
1419
- // Step 1: Intake
1420
1402
  const resolvedDocsPath = resolveUnderBase(basePath, docsPath);
1421
1403
  const intakeResult = await intake({ docsPath: resolvedDocsPath });
1422
1404
  const researchResult = await writeResearchReport({
@@ -1425,7 +1407,6 @@ async function handleDesign(args, basePath) {
1425
1407
  basePath,
1426
1408
  projectName: projectName || 'My Project',
1427
1409
  });
1428
- // Check if there are questions
1429
1410
  if (intakeResult.questions.length > 0) {
1430
1411
  const lines = [];
1431
1412
  lines.push(researchResult.summary);
@@ -1449,7 +1430,6 @@ async function handleDesign(args, basePath) {
1449
1430
  lines.push('(또는 기본값으로 진행하려면 "기본값으로 진행해"라고 해주세요)');
1450
1431
  return lines.join('\n');
1451
1432
  }
1452
- // Step 2: Plan (if no questions or defaults accepted)
1453
1433
  const planResult = await plan({
1454
1434
  intake: intakeResult,
1455
1435
  projectName: projectName || 'My Project',
@@ -1508,7 +1488,6 @@ async function handlePrepare(args, basePath) {
1508
1488
  const intakeResult = await intake({ docsPath: resolvedDocsPath });
1509
1489
  const gdcPrepareSync = await runGdcPrepareSync(basePath);
1510
1490
  const normalizedPlanName = normalizePlanName(args.planName, projectName, resolvedDocsPath);
1511
- // Cache-aware skip: skip steps if artifacts already exist
1512
1491
  const researchPath = path.join(basePath, 'tasks', 'research.md');
1513
1492
  const specsDir = path.join(basePath, '.opencode', 'weave', 'specs');
1514
1493
  const plansDir = path.join(basePath, '.opencode', 'weave', 'plans');
@@ -1529,7 +1508,6 @@ async function handlePrepare(args, basePath) {
1529
1508
  return false;
1530
1509
  }
1531
1510
  })();
1532
- // Step 1: Research
1533
1511
  const researchResult = hasResearch
1534
1512
  ? {
1535
1513
  summary: `> ⏭️ Research skipped: \`${toWorkspaceRelative(basePath, researchPath)}\` already exists.`,
@@ -1541,7 +1519,6 @@ async function handlePrepare(args, basePath) {
1541
1519
  basePath,
1542
1520
  projectName: projectName || 'My Project',
1543
1521
  });
1544
- // Step 2: Spec (baseline)
1545
1522
  const specResult = hasSpec
1546
1523
  ? { summary: `> ⏭️ Spec skipped: existing artifact found in \`${toWorkspaceRelative(basePath, specsDir)}\`.` }
1547
1524
  : await createSpec({
@@ -1550,7 +1527,6 @@ async function handlePrepare(args, basePath) {
1550
1527
  specName: normalizedPlanName,
1551
1528
  basePath,
1552
1529
  });
1553
- // Step 3: Plan
1554
1530
  const planResult = hasPlan
1555
1531
  ? { summary: `> ⏭️ Plan skipped: existing artifact found in \`${toWorkspaceRelative(basePath, plansDir)}\`.` }
1556
1532
  : await plan({
@@ -1647,7 +1623,6 @@ async function handleFlow(args, basePath) {
1647
1623
  if (!phaseBeforeCraft) {
1648
1624
  return `Error: Phase not found: ${resolvedPhaseId}`;
1649
1625
  }
1650
- // Legacy plans may not have explicit tasks yet.
1651
1626
  if (!phaseBeforeCraft.tasks || phaseBeforeCraft.tasks.length === 0) {
1652
1627
  await manager.addTasks(resolvedPhaseId, generateDefaultPhaseTasks(phaseBeforeCraft));
1653
1628
  }
@@ -1770,9 +1745,6 @@ async function handleFlow(args, basePath) {
1770
1745
  });
1771
1746
  return lines.join('\n');
1772
1747
  }
1773
- // ============================================================================
1774
- // Handle Map — Codebase Analysis
1775
- // ============================================================================
1776
1748
  async function handleMap(args, basePath) {
1777
1749
  const lines = [];
1778
1750
  lines.push('## 🔍 Codebase Map');
@@ -1803,9 +1775,6 @@ async function handleMap(args, basePath) {
1803
1775
  lines.push('Next: `weave command=interview docsPath="doc"` to discuss the plan.');
1804
1776
  return lines.join('\n');
1805
1777
  }
1806
- // ============================================================================
1807
- // Handle Interview — Multi-step Question Asking
1808
- // ============================================================================
1809
1778
  async function handleInterview(args, basePath) {
1810
1779
  const docsPath = args.docsPath || 'docs';
1811
1780
  const lines = [];
@@ -1858,9 +1827,6 @@ async function handleInterview(args, basePath) {
1858
1827
  }
1859
1828
  return lines.join('\n');
1860
1829
  }
1861
- // ============================================================================
1862
- // Handle Build — Ralph-loop Autonomous Execution
1863
- // ============================================================================
1864
1830
  async function handleBuild(args, basePath) {
1865
1831
  const lines = [];
1866
1832
  lines.push('## 🏗️ Build');
@@ -1908,9 +1874,6 @@ async function handleBuild(args, basePath) {
1908
1874
  }
1909
1875
  return lines.join('\n');
1910
1876
  }
1911
- // ============================================================================
1912
- // Handle Build Resume
1913
- // ============================================================================
1914
1877
  async function handleBuildResume(args, basePath) {
1915
1878
  const lines = [];
1916
1879
  lines.push('## 🔄 Build Resume');
@@ -1957,10 +1920,8 @@ async function handleCraft(args, basePath) {
1957
1920
  return formatPlanApprovalRequired(basePath, activePlan);
1958
1921
  }
1959
1922
  if (!resolvedPhaseId) {
1960
- // Get next phase
1961
1923
  const manager = getPhaseManager(basePath);
1962
1924
  await manager.loadPlan();
1963
- // Show any recovery messages from auto-repair during load
1964
1925
  const recoveryMsgs = manager.getRecoveryMessages();
1965
1926
  recoveryPrefix = recoveryMsgs.length > 0
1966
1927
  ? `> **Auto-repair**: ${recoveryMsgs.join('; ')}\n\n`
@@ -1976,7 +1937,6 @@ async function handleCraft(args, basePath) {
1976
1937
  resolvedPhaseId = nextPhase.id;
1977
1938
  autoSelectedPhase = true;
1978
1939
  }
1979
- // Ensure tasks exist for legacy plans. (Old plans may have empty task arrays.)
1980
1940
  {
1981
1941
  const manager = getPhaseManager(basePath);
1982
1942
  await manager.loadPlan();
@@ -1988,7 +1948,6 @@ async function handleCraft(args, basePath) {
1988
1948
  await manager.addTasks(resolvedPhaseId, generateDefaultPhaseTasks(current));
1989
1949
  }
1990
1950
  }
1991
- // Prepare execution plan (validates, marks in_progress, generates plan)
1992
1951
  const events = [];
1993
1952
  const { plan: executionPlan } = await preparePhaseExecution({
1994
1953
  phaseId: resolvedPhaseId,
@@ -1996,7 +1955,6 @@ async function handleCraft(args, basePath) {
1996
1955
  onEvent: (event) => events.push(event),
1997
1956
  basePath,
1998
1957
  });
1999
- // Format the execution plan as markdown for the Mask Weaver
2000
1958
  const planMarkdown = formatExecutionPlan(executionPlan);
2001
1959
  const manager = getPhaseManager(basePath);
2002
1960
  await manager.loadPlan();
@@ -2086,14 +2044,11 @@ async function handleStatus(basePath) {
2086
2044
  const manager = getPhaseManager(basePath);
2087
2045
  const activePlan = await manager.loadPlan();
2088
2046
  const report = await generateStatusReport(basePath);
2089
- // Show any recovery messages from auto-repair
2090
2047
  const recoveryMsgs = manager.getRecoveryMessages();
2091
- // Add global knowledge stats
2092
2048
  const knowledge = new GlobalKnowledge();
2093
2049
  await knowledge.init();
2094
2050
  const stats = await knowledge.getStats();
2095
2051
  const lines = [];
2096
- // Show recovery warnings at the top
2097
2052
  if (recoveryMsgs.length > 0) {
2098
2053
  lines.push('### YAML Auto-Repair Report\n');
2099
2054
  for (const msg of recoveryMsgs) {
@@ -2247,7 +2202,6 @@ async function handleVerify(args, basePath) {
2247
2202
  return verification.report;
2248
2203
  }
2249
2204
  async function handleTroubleshoot(args) {
2250
- // Unified: record mode (absorbs old 'record' command)
2251
2205
  if (args.record) {
2252
2206
  if (!args.error || !args.solution) {
2253
2207
  return 'Error: error and solution are required when record=true. Example: weave command=troubleshoot record=true error="..." solution="..."';
@@ -2294,17 +2248,6 @@ async function handleRepair(basePath) {
2294
2248
  const { results, summary } = await manager.repairPlans();
2295
2249
  return summary;
2296
2250
  }
2297
- /**
2298
- * Handle `sync-agents` command.
2299
- *
2300
- * Reads maskweaver.config.json (project or global ~/.config/opencode/)
2301
- * and force-overwrites all dummy-human agent .md files in .opencode/agents/.
2302
- *
2303
- * Search order:
2304
- * 1. {projectDir}/maskweaver.config.json
2305
- * 2. {projectDir}/.opencode/maskweaver.config.json
2306
- * 3. ~/.config/opencode/maskweaver.config.json (user global)
2307
- */
2308
2251
  async function handleSyncAgents(basePath) {
2309
2252
  const agentsDir = path.join(basePath, '.opencode', 'agents');
2310
2253
  const result = generatePoolAgentFilesFromConfig(basePath, agentsDir, { force: true });
@@ -2344,18 +2287,10 @@ async function handleSyncAgents(basePath) {
2344
2287
  }
2345
2288
  return lines.join('\n');
2346
2289
  }
2347
- /**
2348
- * Handle `init-config` command.
2349
- *
2350
- * Creates default maskweaver.config.json (runtime config with pool template)
2351
- * and .opencode/maskweaver.json (plugin config) if they don't exist.
2352
- * Does NOT overwrite existing files.
2353
- */
2354
2290
  async function handleInitConfig(basePath) {
2355
2291
  const lines = [];
2356
2292
  lines.push('## 📝 Config Initialization');
2357
2293
  lines.push('');
2358
- // Create runtime config (maskweaver.config.json)
2359
2294
  const runtimePath = writeDefaultRuntimeConfig(basePath);
2360
2295
  if (runtimePath) {
2361
2296
  lines.push(`✅ Created runtime config: ${toWorkspaceRelative(basePath, runtimePath)}`);
@@ -2366,7 +2301,6 @@ async function handleInitConfig(basePath) {
2366
2301
  lines.push('⏭️ maskweaver.config.json already exists (skipped)');
2367
2302
  }
2368
2303
  lines.push('');
2369
- // Create plugin config (.opencode/maskweaver.json)
2370
2304
  const pluginPath = writeDefaultPluginConfig(basePath);
2371
2305
  if (pluginPath) {
2372
2306
  lines.push(`✅ Created plugin config: ${toWorkspaceRelative(basePath, pluginPath)}`);
@@ -2379,9 +2313,6 @@ async function handleInitConfig(basePath) {
2379
2313
  lines.push('> with your model pool, then run `weave sync-agents` in any project to apply it.');
2380
2314
  return lines.join('\n');
2381
2315
  }
2382
- // ============================================================================
2383
- // Unified Build Handler (absorbs build, build-resume, loop-*)
2384
- // ============================================================================
2385
2316
  async function handleBuildUnified(args, basePath) {
2386
2317
  const action = args.action || 'run';
2387
2318
  switch (action) {
@@ -2413,9 +2344,6 @@ async function handleBuildUnified(args, basePath) {
2413
2344
  return `Error: Unknown build action: ${action}. Available: run, status, stop, list, resume, sync.`;
2414
2345
  }
2415
2346
  }
2416
- // ============================================================================
2417
- // Agents Handler (absorbs sync-agents, init-config)
2418
- // ============================================================================
2419
2347
  async function handleAgents(args, basePath) {
2420
2348
  if (!args.sync && !args.init) {
2421
2349
  return 'Error: agents requires an action. Use `sync=true` to regenerate agent files, or `init=true` to create default config.';
@@ -3065,7 +2993,6 @@ async function handleApprove(args, basePath) {
3065
2993
  `Finalization blocked: verification failed for ${resolvedPhaseId}.`,
3066
2994
  ]);
3067
2995
  }
3068
- // If no commands detected, allow finalization but make it explicit.
3069
2996
  if (verification.results.length === 0) {
3070
2997
  await phaseManager.markAllTasksPassed(resolvedPhaseId);
3071
2998
  const result = await handleUserResponse(resolvedPhaseId, 'approve', undefined, basePath);
@@ -3082,7 +3009,6 @@ async function handleApprove(args, basePath) {
3082
3009
  shardSwitch ? 'Advanced to next shard.' : '',
3083
3010
  ].filter(Boolean));
3084
3011
  }
3085
- // Optional: commit during finalization
3086
3012
  if (commit) {
3087
3013
  try {
3088
3014
  await ensureGitRepo(basePath);
@@ -3121,7 +3047,6 @@ async function handleApprove(args, basePath) {
3121
3047
  const secretWarning = findings.length > 0
3122
3048
  ? formatSecretScanReport(findings)
3123
3049
  : null;
3124
- // Commit message fallback: Pn: Phase Name
3125
3050
  const phase = phaseManager.getPhase(resolvedPhaseId);
3126
3051
  const defaultMsg = phase ? `${phase.id}: ${phase.name}` : `${resolvedPhaseId}: complete`;
3127
3052
  const msg = (commitMessage && commitMessage.trim().length > 0)
@@ -3157,7 +3082,6 @@ async function handleApprove(args, basePath) {
3157
3082
  ]);
3158
3083
  }
3159
3084
  }
3160
- // Passed with results: include report in approval output.
3161
3085
  {
3162
3086
  await phaseManager.markAllTasksPassed(resolvedPhaseId);
3163
3087
  }
@@ -3320,7 +3244,6 @@ async function syncWorkflowArtifacts(basePath, manager, options) {
3320
3244
  await writeFile(todoPath, `${lines.join('\n')}\n`, 'utf-8');
3321
3245
  }
3322
3246
  catch {
3323
- // Non-fatal: artifact sync should never break workflow execution.
3324
3247
  }
3325
3248
  }
3326
3249
  function sanitizeLessonText(input, maxLength = 240) {
@@ -3363,7 +3286,6 @@ async function appendWorkflowLesson(basePath, lesson) {
3363
3286
  await writeFile(lessonsPath, `${current.trimEnd()}\n\n${entry}`, 'utf-8');
3364
3287
  }
3365
3288
  catch {
3366
- // Non-fatal: lesson capture should not block workflow execution.
3367
3289
  }
3368
3290
  }
3369
3291
  function resolveUnderBase(basePath, inputPath) {
@@ -1,32 +1,12 @@
1
- /**
2
- * Plugin Types
3
- *
4
- * Shared types for Maskweaver plugin tools
5
- *
6
- * Based on @opencode-ai/plugin tool definitions.
7
- */
8
1
  import type { z } from 'zod';
9
- /**
10
- * Minimal context required by Maskweaver tool factories.
11
- * SDK provides richer context, but factories only need worktree.
12
- */
13
2
  export interface ToolContext {
14
3
  worktree: string;
15
4
  }
16
- /**
17
- * Tool factory interface for creating OpenCode tools
18
- */
19
5
  export interface ToolFactory {
20
- /** Tool description shown to LLM */
21
6
  description: string;
22
- /** Zod schema for argument validation */
23
7
  args: z.ZodType<any>;
24
- /** Execute function that returns string result */
25
8
  execute: (args: any, context: ToolContext) => Promise<string>;
26
9
  }
27
- /**
28
- * Standard tool response format
29
- */
30
10
  export interface ToolResponse<T = unknown> {
31
11
  success: boolean;
32
12
  data?: T;
@@ -1,8 +1 @@
1
- /**
2
- * Plugin Types
3
- *
4
- * Shared types for Maskweaver plugin tools
5
- *
6
- * Based on @opencode-ai/plugin tool definitions.
7
- */
8
1
  export {};
@@ -1,10 +1,3 @@
1
- /**
2
- * Retrospect Package
3
- *
4
- * 회고 및 가면 관리 시스템
5
- *
6
- * "Export only what matters" - Kent Beck
7
- */
8
1
  export type { RetrospectTrigger, RetrospectDepth, MaskUsageRecord, RetrospectInput, RetrospectResult, } from './types.js';
9
2
  export type { RetrospectStrategy } from './strategies/base.js';
10
3
  export { selectStrategy, QuickRetrospectStrategy, StandardRetrospectStrategy, DeepRetrospectStrategy, } from './strategies/index.js';
@@ -1,12 +1,3 @@
1
- /**
2
- * Retrospect Package
3
- *
4
- * 회고 및 가면 관리 시스템
5
- *
6
- * "Export only what matters" - Kent Beck
7
- */
8
1
  export { selectStrategy, QuickRetrospectStrategy, StandardRetrospectStrategy, DeepRetrospectStrategy, } from './strategies/index.js';
9
- // Core functions
10
2
  export { performRetrospect, getMemoryPath, getDbPath } from './retrospect.js';
11
- // Mask save
12
3
  export { saveMask } from './mask-save.js';
@@ -1,10 +1,3 @@
1
- /**
2
- * Mask Save Logic
3
- *
4
- * 효과적인 가면을 MASKS.md에 저장
5
- *
6
- * "Clean code reads like well-written prose" - Kent Beck
7
- */
8
1
  interface MaskSaveInput {
9
2
  name: string;
10
3
  expertise: string;
@@ -21,10 +14,5 @@ interface MaskSaveResult {
21
14
  effectivenessScore?: number;
22
15
  message: string;
23
16
  }
24
- /**
25
- * 가면 저장
26
- *
27
- * "Make each function tell a story" - Kent Beck
28
- */
29
17
  export declare function saveMask(basePath: string, input: MaskSaveInput): MaskSaveResult;
30
18
  export type { MaskSaveInput, MaskSaveResult };