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,8 +1,3 @@
1
- /**
2
- * Weave Types
3
- *
4
- * Core type definitions for the phase-driven development workflow.
5
- */
6
1
  export type PhaseStatus = 'pending' | 'in_progress' | 'completed' | 'blocked';
7
2
  export interface StructuralIssue {
8
3
  area: string;
@@ -148,11 +143,8 @@ export interface WeaveTask {
148
143
  lastError?: string;
149
144
  maskUsed?: string;
150
145
  }
151
- /** Agent tier for task delegation - maps to subagent_type */
152
146
  export type AgentTier = 'dummy-flash' | 'dummy-human' | 'dummy-premium';
153
- /** Task complexity assessment */
154
147
  export type TaskComplexity = 'simple' | 'standard' | 'complex';
155
- /** Execution plan for a single task within a phase */
156
148
  export interface TaskExecutionPlan {
157
149
  task: WeaveTask;
158
150
  mask: string | null;
@@ -160,7 +152,6 @@ export interface TaskExecutionPlan {
160
152
  complexity: TaskComplexity;
161
153
  troubleshootingHints: string[];
162
154
  }
163
- /** Execution plan for an entire phase */
164
155
  export interface PhaseExecutionPlan {
165
156
  phaseId: string;
166
157
  phaseName: string;
@@ -233,12 +224,6 @@ export interface WeaveLoopOperatorState {
233
224
  lastSummary?: string;
234
225
  }
235
226
  export interface WeavePlan {
236
- /**
237
- * Stable, filesystem-safe identifier for the plan.
238
- * Used for plan filename and state.yaml active_plan.
239
- *
240
- * Example: "emotion-diary"
241
- */
242
227
  planName?: string;
243
228
  projectName: string;
244
229
  createdAt: string;
@@ -250,14 +235,11 @@ export interface WeavePlan {
250
235
  database?: string;
251
236
  notes?: string;
252
237
  };
253
- /** Optional research artifact path generated before planning. */
254
238
  researchPath?: string;
255
239
  researchUpdatedAt?: string;
256
- /** Plan approval gate metadata (required before implementation). */
257
240
  planApproved?: boolean;
258
241
  planApprovedAt?: string;
259
242
  planApprovalNotes?: string;
260
- /** Optional metadata for automatically split plans. */
261
243
  planRole?: 'standalone' | 'shard';
262
244
  parentPlanName?: string;
263
245
  shardIndex?: number;
@@ -265,11 +247,9 @@ export interface WeavePlan {
265
247
  nextPlanName?: string;
266
248
  activeChangeId?: string;
267
249
  changeIds?: string[];
268
- /** Map / codebase analysis metadata. */
269
250
  mapGeneratedAt?: string;
270
251
  mapReportPath?: string;
271
252
  structuralChanges?: StructuralChange[];
272
- /** OpenSpec artifact directory (relative path). */
273
253
  openspecDir?: string;
274
254
  phases: WeavePhase[];
275
255
  currentPhase?: string;
@@ -1,6 +1 @@
1
- /**
2
- * Weave Types
3
- *
4
- * Core type definitions for the phase-driven development workflow.
5
- */
6
1
  export {};
@@ -1,21 +1,9 @@
1
- /**
2
- * Verification Command Recommendation
3
- *
4
- * Weave should not assume `npm run build/test` (web-centric). Instead, it
5
- * recommends build/test commands based on detected project tooling.
6
- *
7
- * This module is intentionally heuristic-based and conservative:
8
- * - Prefer project-defined scripts (package.json scripts)
9
- * - Fall back to common ecosystem defaults when evidence is strong
10
- */
11
1
  export type DetectedProjectType = 'node' | 'go' | 'rust' | 'python' | 'dotnet' | 'unknown';
12
2
  export type VerificationStepName = 'GdcSync' | 'GdcCheck' | 'TypeCheck' | 'Lint' | 'Build' | 'UnitTests';
13
3
  export interface VerificationCommandStep {
14
4
  name: VerificationStepName;
15
5
  cmd: string;
16
- /** If false, this step may be skipped in lenient mode. */
17
6
  required: boolean;
18
- /** Human-readable reason used for logs/debugging. */
19
7
  reason?: string;
20
8
  }
21
9
  export interface VerificationCommandRecommendation {
@@ -1,13 +1,3 @@
1
- /**
2
- * Verification Command Recommendation
3
- *
4
- * Weave should not assume `npm run build/test` (web-centric). Instead, it
5
- * recommends build/test commands based on detected project tooling.
6
- *
7
- * This module is intentionally heuristic-based and conservative:
8
- * - Prefer project-defined scripts (package.json scripts)
9
- * - Fall back to common ecosystem defaults when evidence is strong
10
- */
11
1
  import * as fs from 'node:fs';
12
2
  import * as path from 'node:path';
13
3
  function exists(projectPath, rel) {
@@ -47,7 +37,6 @@ function detectProjectType(projectPath, projectTypeHint) {
47
37
  evidence.push(`hint:${projectTypeHint}`);
48
38
  return { type: hinted, evidence };
49
39
  }
50
- // Prefer strong ecosystem markers over package.json (monorepos often contain a package.json for tooling).
51
40
  if (exists(projectPath, 'go.mod')) {
52
41
  evidence.push('go.mod');
53
42
  return { type: 'go', evidence };
@@ -65,7 +54,6 @@ function detectProjectType(projectPath, projectTypeHint) {
65
54
  evidence.push('setup.py');
66
55
  return { type: 'python', evidence };
67
56
  }
68
- // .NET (top-level scan for typical files)
69
57
  try {
70
58
  const entries = fs.readdirSync(projectPath, { withFileTypes: true });
71
59
  const hasSln = entries.some(e => e.isFile() && e.name.toLowerCase().endsWith('.sln'));
@@ -79,7 +67,6 @@ function detectProjectType(projectPath, projectTypeHint) {
79
67
  }
80
68
  }
81
69
  catch {
82
- // ignore
83
70
  }
84
71
  if (exists(projectPath, 'package.json')) {
85
72
  evidence.push('package.json');
@@ -159,26 +146,21 @@ function recommendNode(projectPath) {
159
146
  }
160
147
  const build = [];
161
148
  const test = [];
162
- // TypeCheck
163
149
  if (scripts.typecheck) {
164
150
  build.push({ name: 'TypeCheck', cmd: pmRun(pm, 'typecheck'), required: true, reason: 'package.json scripts.typecheck' });
165
151
  }
166
152
  else if (scripts.check) {
167
153
  build.push({ name: 'TypeCheck', cmd: pmRun(pm, 'check'), required: true, reason: 'package.json scripts.check' });
168
154
  }
169
- // Lint
170
155
  if (scripts.lint) {
171
156
  build.push({ name: 'Lint', cmd: pmRun(pm, 'lint'), required: true, reason: 'package.json scripts.lint' });
172
157
  }
173
- // Build
174
158
  if (scripts.build) {
175
159
  build.push({ name: 'Build', cmd: pmRun(pm, 'build'), required: true, reason: 'package.json scripts.build' });
176
160
  }
177
161
  else {
178
- // Many Node repos are runtime-only and have no build step.
179
162
  notes.push('No build script detected; skipping Build step recommendation');
180
163
  }
181
- // Unit tests
182
164
  if (scripts.test && !isDefaultNpmInitTestScript(String(scripts.test))) {
183
165
  test.push({ name: 'UnitTests', cmd: pmRun(pm, 'test'), required: true, reason: 'package.json scripts.test' });
184
166
  }
@@ -259,7 +241,6 @@ function recommendPython(projectPath) {
259
241
  if (hasRuff) {
260
242
  build.push({ name: 'Lint', cmd: `${prefix}ruff check .`.trim(), required: true, reason: 'ruff config detected' });
261
243
  }
262
- // "Build" in Python is often packaging-specific; compileall is a safe baseline.
263
244
  build.push({ name: 'Build', cmd: `${prefix}python -m compileall .`.trim(), required: false, reason: 'python compileall baseline' });
264
245
  if (hasPytest) {
265
246
  test.push({ name: 'UnitTests', cmd: `${prefix}pytest`.trim(), required: true, reason: 'pytest config/tests detected' });
@@ -1,8 +1,2 @@
1
- /**
2
- * Weave Verification System
3
- *
4
- * Multi-layer AI verification for zero-defect development.
5
- * Exports platform-specific verification integrations.
6
- */
7
1
  export { checkPlaywrightSetup, initPlaywright, runPlaywrightTests, runPlaywrightTestFile, runVisualRegressionTests, capturePageScreenshot, getTestScreenshots, analyzePlaywrightError, generatePlaywrightConfig, generateExampleTest, type PlaywrightConfig, type PlaywrightTestResult, type PlaywrightFailure, type PlaywrightSetupStatus, type PlaywrightErrorAnalysis, } from './playwright.js';
8
2
  export { recommendVerificationCommands, formatRecommendedCommandsAsBash, type VerificationCommandRecommendation, type VerificationCommandStep, type DetectedProjectType, } from './commands.js';
@@ -1,20 +1,2 @@
1
- /**
2
- * Weave Verification System
3
- *
4
- * Multi-layer AI verification for zero-defect development.
5
- * Exports platform-specific verification integrations.
6
- */
7
- // Playwright E2E Testing (Web)
8
- export {
9
- // Setup & Detection
10
- checkPlaywrightSetup, initPlaywright,
11
- // Test Execution
12
- runPlaywrightTests, runPlaywrightTestFile, runVisualRegressionTests,
13
- // Screenshots
14
- capturePageScreenshot, getTestScreenshots,
15
- // Error Analysis (for Global Knowledge RAG)
16
- analyzePlaywrightError,
17
- // Config Generation
18
- generatePlaywrightConfig, generateExampleTest, } from './playwright.js';
19
- // Generic build/test command recommendations
1
+ export { checkPlaywrightSetup, initPlaywright, runPlaywrightTests, runPlaywrightTestFile, runVisualRegressionTests, capturePageScreenshot, getTestScreenshots, analyzePlaywrightError, generatePlaywrightConfig, generateExampleTest, } from './playwright.js';
20
2
  export { recommendVerificationCommands, formatRecommendedCommandsAsBash, } from './commands.js';
@@ -1,37 +1,14 @@
1
- /**
2
- * Playwright E2E Testing Integration for Weave
3
- *
4
- * Provides automated browser testing for web projects.
5
- * Integrates with the multi-layer verification system.
6
- *
7
- * Key features:
8
- * - Auto-detection of Playwright installation
9
- * - Headless test execution with structured output parsing
10
- * - Screenshot capture on failure for visual debugging
11
- * - Test result integration with Global Knowledge RAG
12
- */
13
1
  export interface PlaywrightConfig {
14
- /** Project root directory */
15
2
  projectPath: string;
16
- /** Base URL for the dev server (e.g., "http://localhost:3000") */
17
3
  devServerUrl?: string;
18
- /** Run in headed mode for debugging */
19
4
  headed?: boolean;
20
- /** Specific test file or pattern to run */
21
5
  testMatch?: string;
22
- /** Browser(s) to test: 'chromium' | 'firefox' | 'webkit' | 'all' */
23
6
  browsers?: 'chromium' | 'firefox' | 'webkit' | 'all';
24
- /** Maximum timeout for tests in milliseconds */
25
7
  timeout?: number;
26
- /** Number of retries for flaky tests */
27
8
  retries?: number;
28
- /** Output directory for screenshots and traces */
29
9
  outputDir?: string;
30
- /** Capture screenshots on failure */
31
10
  screenshotOnFailure?: boolean;
32
- /** Record trace for debugging */
33
11
  traceOnFailure?: boolean;
34
- /** Update snapshots mode */
35
12
  updateSnapshots?: boolean;
36
13
  }
37
14
  export interface PlaywrightTestResult {
@@ -62,36 +39,15 @@ export interface PlaywrightSetupStatus {
62
39
  browsersInstalled: boolean;
63
40
  message: string;
64
41
  }
65
- /**
66
- * Check if Playwright is properly set up in the project
67
- */
68
42
  export declare function checkPlaywrightSetup(projectPath: string): Promise<PlaywrightSetupStatus>;
69
- /**
70
- * Initialize Playwright in a project
71
- */
72
43
  export declare function initPlaywright(projectPath: string): Promise<{
73
44
  success: boolean;
74
45
  message: string;
75
46
  }>;
76
- /**
77
- * Run Playwright E2E tests
78
- */
79
47
  export declare function runPlaywrightTests(config: PlaywrightConfig): Promise<PlaywrightTestResult>;
80
- /**
81
- * Run specific test file
82
- */
83
48
  export declare function runPlaywrightTestFile(projectPath: string, testFile: string, options?: Partial<PlaywrightConfig>): Promise<PlaywrightTestResult>;
84
- /**
85
- * Run tests with visual comparison
86
- */
87
49
  export declare function runVisualRegressionTests(projectPath: string, options?: Partial<PlaywrightConfig>): Promise<PlaywrightTestResult>;
88
- /**
89
- * Capture a screenshot of the current page state
90
- */
91
50
  export declare function capturePageScreenshot(projectPath: string, url: string, outputPath?: string): Promise<string>;
92
- /**
93
- * Get list of screenshots from a test run
94
- */
95
51
  export declare function getTestScreenshots(projectPath: string): Promise<string[]>;
96
52
  export interface PlaywrightErrorAnalysis {
97
53
  errorType: 'timeout' | 'assertion' | 'element' | 'network' | 'navigation' | 'script' | 'unknown';
@@ -102,9 +58,6 @@ export interface PlaywrightErrorAnalysis {
102
58
  suggestedFix?: string;
103
59
  errorSignature: string;
104
60
  }
105
- /**
106
- * Analyze Playwright error for knowledge base indexing
107
- */
108
61
  export declare function analyzePlaywrightError(failure: PlaywrightFailure): PlaywrightErrorAnalysis;
109
62
  declare function generatePlaywrightConfig(projectPath: string): string;
110
63
  declare function generateExampleTest(): string;
@@ -1,24 +1,6 @@
1
- /**
2
- * Playwright E2E Testing Integration for Weave
3
- *
4
- * Provides automated browser testing for web projects.
5
- * Integrates with the multi-layer verification system.
6
- *
7
- * Key features:
8
- * - Auto-detection of Playwright installation
9
- * - Headless test execution with structured output parsing
10
- * - Screenshot capture on failure for visual debugging
11
- * - Test result integration with Global Knowledge RAG
12
- */
13
1
  import { spawn } from 'child_process';
14
2
  import { promises as fs } from 'fs';
15
3
  import * as path from 'path';
16
- // ============================================================================
17
- // Setup & Detection
18
- // ============================================================================
19
- /**
20
- * Check if Playwright is properly set up in the project
21
- */
22
4
  export async function checkPlaywrightSetup(projectPath) {
23
5
  const result = {
24
6
  installed: false,
@@ -26,7 +8,6 @@ export async function checkPlaywrightSetup(projectPath) {
26
8
  browsersInstalled: false,
27
9
  message: '',
28
10
  };
29
- // Check if @playwright/test is in package.json
30
11
  try {
31
12
  const packageJsonPath = path.join(projectPath, 'package.json');
32
13
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
@@ -37,9 +18,7 @@ export async function checkPlaywrightSetup(projectPath) {
37
18
  }
38
19
  }
39
20
  catch {
40
- // package.json not found or parse error
41
21
  }
42
- // Check for playwright.config.ts or playwright.config.js
43
22
  const configFiles = [
44
23
  'playwright.config.ts',
45
24
  'playwright.config.js',
@@ -52,10 +31,8 @@ export async function checkPlaywrightSetup(projectPath) {
52
31
  break;
53
32
  }
54
33
  catch {
55
- // Config file not found
56
34
  }
57
35
  }
58
- // Try to detect if browsers are installed by running playwright --version
59
36
  try {
60
37
  const versionOutput = await runCommand('npx', ['playwright', '--version'], projectPath);
61
38
  if (versionOutput.exitCode === 0) {
@@ -64,9 +41,7 @@ export async function checkPlaywrightSetup(projectPath) {
64
41
  }
65
42
  }
66
43
  catch {
67
- // Playwright not available
68
44
  }
69
- // Generate message
70
45
  if (!result.installed) {
71
46
  result.message = 'Playwright is not installed. Run: npm install -D @playwright/test';
72
47
  }
@@ -81,17 +56,12 @@ export async function checkPlaywrightSetup(projectPath) {
81
56
  }
82
57
  return result;
83
58
  }
84
- /**
85
- * Initialize Playwright in a project
86
- */
87
59
  export async function initPlaywright(projectPath) {
88
- // Check if already set up
89
60
  const status = await checkPlaywrightSetup(projectPath);
90
61
  if (status.installed && status.configExists && status.browsersInstalled) {
91
62
  return { success: true, message: 'Playwright is already set up' };
92
63
  }
93
64
  const steps = [];
94
- // Install @playwright/test if not present
95
65
  if (!status.installed) {
96
66
  const installResult = await runCommand('npm', ['install', '-D', '@playwright/test'], projectPath);
97
67
  if (installResult.exitCode !== 0) {
@@ -99,14 +69,11 @@ export async function initPlaywright(projectPath) {
99
69
  }
100
70
  steps.push('Installed @playwright/test');
101
71
  }
102
- // Initialize config if not present
103
72
  if (!status.configExists) {
104
- // Create a minimal configuration
105
73
  const config = generatePlaywrightConfig(projectPath);
106
74
  await fs.writeFile(path.join(projectPath, 'playwright.config.ts'), config);
107
75
  steps.push('Created playwright.config.ts');
108
76
  }
109
- // Install browsers
110
77
  if (!status.browsersInstalled) {
111
78
  const installResult = await runCommand('npx', ['playwright', 'install', '--with-deps', 'chromium'], projectPath);
112
79
  if (installResult.exitCode !== 0) {
@@ -114,7 +81,6 @@ export async function initPlaywright(projectPath) {
114
81
  }
115
82
  steps.push('Installed Chromium browser');
116
83
  }
117
- // Create example test directory if it doesn't exist
118
84
  const testDir = path.join(projectPath, 'e2e');
119
85
  try {
120
86
  await fs.access(testDir);
@@ -129,16 +95,9 @@ export async function initPlaywright(projectPath) {
129
95
  message: `Playwright setup complete:\n${steps.map(s => ` ✓ ${s}`).join('\n')}`,
130
96
  };
131
97
  }
132
- // ============================================================================
133
- // Test Execution
134
- // ============================================================================
135
- /**
136
- * Run Playwright E2E tests
137
- */
138
98
  export async function runPlaywrightTests(config) {
139
99
  const { projectPath, headed, testMatch, browsers, timeout, retries, outputDir } = config;
140
100
  const args = ['playwright', 'test'];
141
- // Add options
142
101
  if (headed) {
143
102
  args.push('--headed');
144
103
  }
@@ -157,17 +116,12 @@ export async function runPlaywrightTests(config) {
157
116
  if (outputDir) {
158
117
  args.push('--output', outputDir);
159
118
  }
160
- // JSON reporter for structured output
161
119
  args.push('--reporter', 'json');
162
120
  const startTime = Date.now();
163
121
  const result = await runCommand('npx', args, projectPath);
164
122
  const duration = Date.now() - startTime;
165
- // Parse JSON output
166
123
  return parsePlaywrightOutput(result.stdout, result.stderr, duration, projectPath);
167
124
  }
168
- /**
169
- * Run specific test file
170
- */
171
125
  export async function runPlaywrightTestFile(projectPath, testFile, options) {
172
126
  return runPlaywrightTests({
173
127
  projectPath,
@@ -175,9 +129,6 @@ export async function runPlaywrightTestFile(projectPath, testFile, options) {
175
129
  ...options,
176
130
  });
177
131
  }
178
- /**
179
- * Run tests with visual comparison
180
- */
181
132
  export async function runVisualRegressionTests(projectPath, options) {
182
133
  const result = await runPlaywrightTests({
183
134
  projectPath,
@@ -187,16 +138,8 @@ export async function runVisualRegressionTests(projectPath, options) {
187
138
  });
188
139
  return result;
189
140
  }
190
- // ============================================================================
191
- // Screenshot & Trace
192
- // ============================================================================
193
- /**
194
- * Capture a screenshot of the current page state
195
- */
196
141
  export async function capturePageScreenshot(projectPath, url, outputPath) {
197
- // Generate inline script to capture screenshot
198
142
  const screenshotPath = outputPath || path.join(projectPath, '.weave', 'screenshots', `capture-${Date.now()}.png`);
199
- // Ensure directory exists
200
143
  await fs.mkdir(path.dirname(screenshotPath), { recursive: true });
201
144
  const script = `
202
145
  const { chromium } = require('playwright');
@@ -213,19 +156,15 @@ const { chromium } = require('playwright');
213
156
  await fs.mkdir(path.dirname(scriptPath), { recursive: true });
214
157
  await fs.writeFile(scriptPath, script);
215
158
  const result = await runCommand('node', [scriptPath], projectPath);
216
- // Cleanup temp script
217
159
  try {
218
160
  await fs.unlink(scriptPath);
219
161
  }
220
- catch { /* ignore */ }
162
+ catch { }
221
163
  if (result.exitCode !== 0) {
222
164
  throw new Error(`Screenshot capture failed: ${result.stderr}`);
223
165
  }
224
166
  return screenshotPath;
225
167
  }
226
- /**
227
- * Get list of screenshots from a test run
228
- */
229
168
  export async function getTestScreenshots(projectPath) {
230
169
  const screenshotDirs = [
231
170
  path.join(projectPath, 'test-results'),
@@ -238,14 +177,10 @@ export async function getTestScreenshots(projectPath) {
238
177
  await collectScreenshots(dir, screenshots);
239
178
  }
240
179
  catch {
241
- // Directory not found or other error
242
180
  }
243
181
  }
244
182
  return screenshots;
245
183
  }
246
- /**
247
- * Recursively collect screenshot files from a directory
248
- */
249
184
  async function collectScreenshots(dir, screenshots) {
250
185
  const entries = await fs.readdir(dir, { withFileTypes: true });
251
186
  for (const entry of entries) {
@@ -260,9 +195,6 @@ async function collectScreenshots(dir, screenshots) {
260
195
  }
261
196
  }
262
197
  }
263
- // ============================================================================
264
- // Output Parsing
265
- // ============================================================================
266
198
  function parsePlaywrightOutput(stdout, stderr, duration, projectPath) {
267
199
  const result = {
268
200
  passed: true,
@@ -276,9 +208,7 @@ function parsePlaywrightOutput(stdout, stderr, duration, projectPath) {
276
208
  traces: [],
277
209
  rawOutput: stdout + '\n' + stderr,
278
210
  };
279
- // Try to parse JSON output
280
211
  try {
281
- // Find JSON in output (might be mixed with other output)
282
212
  const jsonMatch = stdout.match(/\{[\s\S]*"suites"[\s\S]*\}/);
283
213
  if (jsonMatch) {
284
214
  const json = JSON.parse(jsonMatch[0]);
@@ -287,16 +217,13 @@ function parsePlaywrightOutput(stdout, stderr, duration, projectPath) {
287
217
  result.failedTests = json.stats?.unexpected || 0;
288
218
  result.skippedTests = json.stats?.skipped || 0;
289
219
  result.passed = result.failedTests === 0;
290
- // Extract failures
291
220
  if (json.suites) {
292
221
  extractFailures(json.suites, result.failures);
293
222
  }
294
223
  }
295
224
  }
296
225
  catch {
297
- // Fallback: parse text output
298
226
  result.passed = !stderr.includes('failed') && !stdout.includes('failed');
299
- // Try to extract test counts from text
300
227
  const passedMatch = stdout.match(/(\d+) passed/);
301
228
  const failedMatch = stdout.match(/(\d+) failed/);
302
229
  const skippedMatch = stdout.match(/(\d+) skipped/);
@@ -307,7 +234,6 @@ function parsePlaywrightOutput(stdout, stderr, duration, projectPath) {
307
234
  if (skippedMatch)
308
235
  result.skippedTests = parseInt(skippedMatch[1], 10);
309
236
  result.totalTests = result.passedTests + result.failedTests + result.skippedTests;
310
- // Extract failure details from stderr
311
237
  if (!result.passed) {
312
238
  const errorLines = stderr.split('\n').filter(line => line.includes('Error') || line.includes('expect') || line.includes('Timeout'));
313
239
  if (errorLines.length > 0) {
@@ -347,9 +273,6 @@ function extractFailures(suites, failures) {
347
273
  }
348
274
  }
349
275
  }
350
- /**
351
- * Analyze Playwright error for knowledge base indexing
352
- */
353
276
  export function analyzePlaywrightError(failure) {
354
277
  const error = failure.error.toLowerCase();
355
278
  const analysis = {
@@ -357,7 +280,6 @@ export function analyzePlaywrightError(failure) {
357
280
  errorSignature: '',
358
281
  suggestedFix: '',
359
282
  };
360
- // Timeout errors
361
283
  if (error.includes('timeout') || error.includes('exceeded')) {
362
284
  analysis.errorType = 'timeout';
363
285
  const selectorMatch = failure.error.match(/locator\(['"]([^'"]+)['"]\)/);
@@ -370,7 +292,6 @@ export function analyzePlaywrightError(failure) {
370
292
  }
371
293
  analysis.errorSignature = `playwright:timeout:${analysis.selector || 'page'}`;
372
294
  }
373
- // Assertion errors
374
295
  else if (error.includes('expect') || error.includes('assertion')) {
375
296
  analysis.errorType = 'assertion';
376
297
  analysis.expectedValue = failure.expected;
@@ -378,7 +299,6 @@ export function analyzePlaywrightError(failure) {
378
299
  analysis.suggestedFix = `Expected "${analysis.expectedValue}" but got "${analysis.actualValue}". Verify the application state or update the test.`;
379
300
  analysis.errorSignature = `playwright:assertion:${failure.testName}`;
380
301
  }
381
- // Element not found
382
302
  else if (error.includes('element') || error.includes('locator') || error.includes('selector')) {
383
303
  analysis.errorType = 'element';
384
304
  const selectorMatch = failure.error.match(/['"]([^'"]+)['"]/);
@@ -388,13 +308,11 @@ export function analyzePlaywrightError(failure) {
388
308
  analysis.suggestedFix = 'Element not found. Check if the selector is correct and the element exists in the DOM.';
389
309
  analysis.errorSignature = `playwright:element:${analysis.selector || 'unknown'}`;
390
310
  }
391
- // Network errors
392
311
  else if (error.includes('net::') || error.includes('network') || error.includes('fetch')) {
393
312
  analysis.errorType = 'network';
394
313
  analysis.suggestedFix = 'Network request failed. Check if the server is running and accessible.';
395
314
  analysis.errorSignature = 'playwright:network:failed';
396
315
  }
397
- // Navigation errors
398
316
  else if (error.includes('navigation') || error.includes('goto')) {
399
317
  analysis.errorType = 'navigation';
400
318
  const urlMatch = failure.error.match(/https?:\/\/[^\s'"]+/);
@@ -404,7 +322,6 @@ export function analyzePlaywrightError(failure) {
404
322
  analysis.suggestedFix = `Navigation to "${analysis.url}" failed. Check if the URL is correct and the server is running.`;
405
323
  analysis.errorSignature = `playwright:navigation:${analysis.url || 'unknown'}`;
406
324
  }
407
- // Script errors
408
325
  else if (error.includes('script') || error.includes('evaluate')) {
409
326
  analysis.errorType = 'script';
410
327
  analysis.suggestedFix = 'JavaScript error in the page. Check browser console for details.';
@@ -416,9 +333,6 @@ export function analyzePlaywrightError(failure) {
416
333
  }
417
334
  return analysis;
418
335
  }
419
- // ============================================================================
420
- // Config Generation
421
- // ============================================================================
422
336
  function generatePlaywrightConfig(projectPath) {
423
337
  return `import { defineConfig, devices } from '@playwright/test';
424
338
 
@@ -574,7 +488,4 @@ async function runCommand(command, args, cwd) {
574
488
  });
575
489
  });
576
490
  }
577
- // ============================================================================
578
- // Exports
579
- // ============================================================================
580
491
  export { generatePlaywrightConfig, generateExampleTest, };
@@ -1,30 +1,14 @@
1
- /**
2
- * Weave Worktree Utilities
3
- *
4
- * Provides git worktree helpers tailored for Weave workflows.
5
- *
6
- * Goals:
7
- * - Enable parallel feature/phase work on isolated working directories
8
- * - Bootstrap .opencode/weave artifacts into newly created worktrees
9
- * - Keep "weave init once" principle by copying/creating required files
10
- */
11
1
  import { type WorktreeInfo } from '../shared-context/worktree.js';
12
2
  export interface WeaveWorktreeCreateOptions {
13
- /** Current worktree path (where command is invoked). */
14
3
  basePath: string;
15
- /** Feature/worktree name (kebab-case recommended). */
16
4
  name: string;
17
- /** Base ref to branch from. Defaults to HEAD of basePath worktree. */
18
5
  fromRef?: string;
19
- /** Whether to copy weave artifacts from basePath into new worktree. */
20
6
  bootstrapWeave?: boolean;
21
- /** Whether to copy .gdc/config + node specs into the worktree. */
22
7
  bootstrapGdc?: boolean;
23
8
  }
24
9
  export interface WeaveWorktreeRemoveOptions {
25
10
  basePath: string;
26
11
  name: string;
27
- /** Also delete the worktree branch (default: false). */
28
12
  deleteBranch?: boolean;
29
13
  }
30
14
  export interface WeaveWorktreeListOptions {