retestkit 1.4.1 → 1.5.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 (238) hide show
  1. package/README.md +59 -40
  2. package/dist/config.js +8 -8
  3. package/dist/config.js.map +1 -1
  4. package/dist/logger.js +1 -1
  5. package/dist/logger.js.map +1 -1
  6. package/dist/prompts/index.d.ts +1 -1
  7. package/dist/prompts/index.d.ts.map +1 -1
  8. package/dist/prompts/index.js +21 -21
  9. package/dist/prompts/index.js.map +1 -1
  10. package/dist/prompts/templates/mcp/retest-crawl.md +7 -0
  11. package/{src/prompts/templates/mcp/webtest-discover-flows.md → dist/prompts/templates/mcp/retest-discover-flows.md} +1 -1
  12. package/{src/prompts/templates/mcp/webtest-discover.md → dist/prompts/templates/mcp/retest-discover.md} +2 -2
  13. package/dist/prompts/templates/mcp/retest-full-workflow.md +12 -0
  14. package/{src/prompts/templates/mcp/webtest-generate-tests.md → dist/prompts/templates/mcp/retest-generate-tests.md} +1 -1
  15. package/{src/prompts/templates/mcp/webtest-run-test.md → dist/prompts/templates/mcp/retest-run-test.md} +1 -1
  16. package/{src/prompts/templates/mcp/webtest-start.md → dist/prompts/templates/mcp/retest-start.md} +1 -1
  17. package/{src → dist}/prompts/templates/sampling/system-prefix.md +1 -1
  18. package/dist/resources/index.js +7 -7
  19. package/dist/resources/index.js.map +1 -1
  20. package/dist/schemas/config.js +2 -2
  21. package/dist/schemas/config.js.map +1 -1
  22. package/dist/security/index.js +1 -1
  23. package/dist/security/index.js.map +1 -1
  24. package/dist/server.js +3 -3
  25. package/dist/server.js.map +1 -1
  26. package/dist/test-utils/mock-context.js +22 -22
  27. package/dist/test-utils/mock-context.js.map +1 -1
  28. package/dist/tools/index.d.ts +1 -1
  29. package/dist/tools/index.d.ts.map +1 -1
  30. package/dist/tools/index.js +5 -5
  31. package/dist/tools/index.js.map +1 -1
  32. package/dist/tools/retest/crawl.d.ts.map +1 -0
  33. package/dist/tools/{webtest → retest}/crawl.js +7 -7
  34. package/dist/tools/retest/crawl.js.map +1 -0
  35. package/dist/tools/retest/discover-features.d.ts.map +1 -0
  36. package/dist/tools/{webtest → retest}/discover-features.js +6 -6
  37. package/dist/tools/retest/discover-features.js.map +1 -0
  38. package/dist/tools/retest/discover-flows.d.ts.map +1 -0
  39. package/dist/tools/{webtest → retest}/discover-flows.js +6 -6
  40. package/dist/tools/retest/discover-flows.js.map +1 -0
  41. package/dist/tools/retest/generate-tests.d.ts.map +1 -0
  42. package/dist/tools/{webtest → retest}/generate-tests.js +5 -5
  43. package/dist/tools/retest/generate-tests.js.map +1 -0
  44. package/dist/tools/retest/index.d.ts.map +1 -0
  45. package/dist/tools/retest/index.js.map +1 -0
  46. package/dist/tools/retest/run-test-case.d.ts.map +1 -0
  47. package/dist/tools/{webtest → retest}/run-test-case.js +3 -3
  48. package/dist/tools/retest/run-test-case.js.map +1 -0
  49. package/dist/tools/retest/schemas.d.ts.map +1 -0
  50. package/dist/tools/retest/schemas.js.map +1 -0
  51. package/dist/tools/retest/start-analysis.d.ts.map +1 -0
  52. package/dist/tools/{webtest → retest}/start-analysis.js +5 -5
  53. package/dist/tools/retest/start-analysis.js.map +1 -0
  54. package/dist/workspace/index.js +8 -8
  55. package/dist/workspace/index.js.map +1 -1
  56. package/dist/workspace/types.d.ts +2 -2
  57. package/dist/workspace/types.d.ts.map +1 -1
  58. package/package.json +6 -2
  59. package/.claude/commands/openspec/apply.md +0 -23
  60. package/.claude/commands/openspec/archive.md +0 -27
  61. package/.claude/commands/openspec/proposal.md +0 -28
  62. package/.gemini/commands/openspec/apply.toml +0 -21
  63. package/.gemini/commands/openspec/archive.toml +0 -25
  64. package/.gemini/commands/openspec/proposal.toml +0 -26
  65. package/.github/prompts/openspec-apply.prompt.md +0 -22
  66. package/.github/prompts/openspec-archive.prompt.md +0 -26
  67. package/.github/prompts/openspec-proposal.prompt.md +0 -27
  68. package/.github/workflows/release.yml +0 -33
  69. package/.kilocode/workflows/openspec-apply.md +0 -17
  70. package/.kilocode/workflows/openspec-archive.md +0 -21
  71. package/.kilocode/workflows/openspec-proposal.md +0 -22
  72. package/.mcp.json +0 -23
  73. package/.opencode/command/openspec-apply.md +0 -25
  74. package/.opencode/command/openspec-archive.md +0 -28
  75. package/.opencode/command/openspec-proposal.md +0 -30
  76. package/.roo/commands/openspec-apply.md +0 -20
  77. package/.roo/commands/openspec-archive.md +0 -24
  78. package/.roo/commands/openspec-proposal.md +0 -25
  79. package/.vscode/mcp.json +0 -23
  80. package/AGENTS.md +0 -18
  81. package/CLAUDE.md +0 -18
  82. package/dist/tools/webtest/crawl.d.ts.map +0 -1
  83. package/dist/tools/webtest/crawl.js.map +0 -1
  84. package/dist/tools/webtest/discover-features.d.ts.map +0 -1
  85. package/dist/tools/webtest/discover-features.js.map +0 -1
  86. package/dist/tools/webtest/discover-flows.d.ts.map +0 -1
  87. package/dist/tools/webtest/discover-flows.js.map +0 -1
  88. package/dist/tools/webtest/generate-tests.d.ts.map +0 -1
  89. package/dist/tools/webtest/generate-tests.js.map +0 -1
  90. package/dist/tools/webtest/index.d.ts.map +0 -1
  91. package/dist/tools/webtest/index.js.map +0 -1
  92. package/dist/tools/webtest/run-test-case.d.ts.map +0 -1
  93. package/dist/tools/webtest/run-test-case.js.map +0 -1
  94. package/dist/tools/webtest/schemas.d.ts.map +0 -1
  95. package/dist/tools/webtest/schemas.js.map +0 -1
  96. package/dist/tools/webtest/start-analysis.d.ts.map +0 -1
  97. package/dist/tools/webtest/start-analysis.js.map +0 -1
  98. package/openspec/AGENTS.md +0 -456
  99. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/proposal.md +0 -33
  100. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-resources/spec.md +0 -27
  101. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/specs/webtest-tools/spec.md +0 -304
  102. package/openspec/changes/archive/2025-12-18-add-hybrid-artifact-paths/tasks.md +0 -43
  103. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/design.md +0 -209
  104. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/proposal.md +0 -41
  105. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/specs/mcp-server-core/spec.md +0 -183
  106. package/openspec/changes/archive/2025-12-18-add-mcp-server-foundation/tasks.md +0 -112
  107. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/design.md +0 -333
  108. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/proposal.md +0 -66
  109. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/mcp-server-core/spec.md +0 -129
  110. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-lifecycle/spec.md +0 -138
  111. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-logging/spec.md +0 -211
  112. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-prompts/spec.md +0 -157
  113. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-resources/spec.md +0 -213
  114. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-sampling/spec.md +0 -257
  115. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/specs/webtest-tools/spec.md +0 -501
  116. package/openspec/changes/archive/2025-12-18-add-webtest-orchestrator/tasks.md +0 -264
  117. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/proposal.md +0 -24
  118. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/specs/webtest-tools/spec.md +0 -80
  119. package/openspec/changes/archive/2025-12-18-allow-analysis-of-incomplete-crawls/tasks.md +0 -8
  120. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/design.md +0 -90
  121. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/proposal.md +0 -28
  122. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/specs/webtest-sampling/spec.md +0 -90
  123. package/openspec/changes/archive/2025-12-18-fix-crawl-loop-stability/tasks.md +0 -33
  124. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/design.md +0 -558
  125. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/proposal.md +0 -119
  126. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-resources/spec.md +0 -109
  127. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/specs/webtest-tools/spec.md +0 -121
  128. package/openspec/changes/archive/2025-12-18-use-markdown-artifacts/tasks.md +0 -133
  129. package/openspec/changes/extract-prompts-to-markdown/design.md +0 -86
  130. package/openspec/changes/extract-prompts-to-markdown/proposal.md +0 -50
  131. package/openspec/changes/extract-prompts-to-markdown/specs/webtest-prompts/spec.md +0 -74
  132. package/openspec/changes/extract-prompts-to-markdown/tasks.md +0 -40
  133. package/openspec/changes/refactor-webtest-naming/design.md +0 -95
  134. package/openspec/changes/refactor-webtest-naming/proposal.md +0 -66
  135. package/openspec/changes/refactor-webtest-naming/specs/webtest-prompts/spec.md +0 -79
  136. package/openspec/changes/refactor-webtest-naming/specs/webtest-resources/spec.md +0 -80
  137. package/openspec/changes/refactor-webtest-naming/specs/webtest-sampling/spec.md +0 -122
  138. package/openspec/changes/refactor-webtest-naming/specs/webtest-tools/spec.md +0 -113
  139. package/openspec/changes/refactor-webtest-naming/tasks.md +0 -119
  140. package/openspec/changes/rename-package-to-retest/proposal.md +0 -52
  141. package/openspec/changes/rename-package-to-retest/specs/mcp-server-core/spec.md +0 -53
  142. package/openspec/changes/rename-package-to-retest/specs/retest-lifecycle/spec.md +0 -68
  143. package/openspec/changes/rename-package-to-retest/specs/retest-logging/spec.md +0 -35
  144. package/openspec/changes/rename-package-to-retest/specs/retest-prompts/spec.md +0 -159
  145. package/openspec/changes/rename-package-to-retest/specs/retest-resources/spec.md +0 -251
  146. package/openspec/changes/rename-package-to-retest/specs/retest-sampling/spec.md +0 -99
  147. package/openspec/changes/rename-package-to-retest/specs/retest-tools/spec.md +0 -295
  148. package/openspec/changes/rename-package-to-retest/tasks.md +0 -71
  149. package/openspec/project.md +0 -31
  150. package/openspec/specs/mcp-server-core/spec.md +0 -178
  151. package/openspec/specs/webtest-lifecycle/spec.md +0 -136
  152. package/openspec/specs/webtest-logging/spec.md +0 -209
  153. package/openspec/specs/webtest-prompts/spec.md +0 -155
  154. package/openspec/specs/webtest-resources/spec.md +0 -248
  155. package/openspec/specs/webtest-sampling/spec.md +0 -344
  156. package/openspec/specs/webtest-tools/spec.md +0 -282
  157. package/release.config.js +0 -9
  158. package/src/config.test.ts +0 -96
  159. package/src/config.ts +0 -32
  160. package/src/elicitation/index.test.ts +0 -399
  161. package/src/elicitation/index.ts +0 -171
  162. package/src/elicitation/types.ts +0 -68
  163. package/src/index.ts +0 -83
  164. package/src/lifecycle/index.test.ts +0 -260
  165. package/src/lifecycle/index.ts +0 -101
  166. package/src/logger.redaction.test.ts +0 -322
  167. package/src/logger.test.ts +0 -123
  168. package/src/logger.ts +0 -229
  169. package/src/playwright-client/index.ts +0 -392
  170. package/src/playwright-client/types.ts +0 -99
  171. package/src/progress/index.test.ts +0 -327
  172. package/src/progress/index.ts +0 -170
  173. package/src/progress/types.ts +0 -25
  174. package/src/prompts/index.test.ts +0 -451
  175. package/src/prompts/index.ts +0 -246
  176. package/src/prompts/loader.test.ts +0 -100
  177. package/src/prompts/loader.ts +0 -59
  178. package/src/prompts/templates/mcp/webtest-crawl.md +0 -7
  179. package/src/prompts/templates/mcp/webtest-full-workflow.md +0 -12
  180. package/src/resources/index.ts +0 -250
  181. package/src/resources/subscriptions.ts +0 -37
  182. package/src/sampling/index.test.ts +0 -414
  183. package/src/sampling/index.ts +0 -286
  184. package/src/sampling/prompts.ts +0 -194
  185. package/src/sampling/types.ts +0 -60
  186. package/src/schemas/config.ts +0 -39
  187. package/src/security/index.test.ts +0 -441
  188. package/src/security/index.ts +0 -361
  189. package/src/security/security-scenarios.test.ts +0 -468
  190. package/src/server.ts +0 -211
  191. package/src/test-utils/index.ts +0 -6
  192. package/src/test-utils/mock-context.ts +0 -426
  193. package/src/test-utils/mock-playwright-client.ts +0 -422
  194. package/src/tools/index.ts +0 -11
  195. package/src/tools/webtest/crawl.test.ts +0 -834
  196. package/src/tools/webtest/crawl.ts +0 -901
  197. package/src/tools/webtest/discover-features.ts +0 -412
  198. package/src/tools/webtest/discover-flows.ts +0 -408
  199. package/src/tools/webtest/generate-tests.test.ts +0 -532
  200. package/src/tools/webtest/generate-tests.ts +0 -425
  201. package/src/tools/webtest/index.ts +0 -7
  202. package/src/tools/webtest/integration.test.ts +0 -536
  203. package/src/tools/webtest/run-test-case.test.ts +0 -659
  204. package/src/tools/webtest/run-test-case.ts +0 -508
  205. package/src/tools/webtest/schemas.ts +0 -201
  206. package/src/tools/webtest/start-analysis.test.ts +0 -151
  207. package/src/tools/webtest/start-analysis.ts +0 -158
  208. package/src/transports/http.ts +0 -19
  209. package/src/transports/index.ts +0 -30
  210. package/src/transports/stdio.ts +0 -7
  211. package/src/types/capabilities.test.ts +0 -193
  212. package/src/types/capabilities.ts +0 -50
  213. package/src/types/context.ts +0 -21
  214. package/src/types/tool.ts +0 -11
  215. package/src/workspace/index.ts +0 -945
  216. package/src/workspace/markdown.ts +0 -272
  217. package/src/workspace/types.ts +0 -186
  218. package/tests/integration/server.test.ts +0 -89
  219. package/tests/integration/tools.test.ts +0 -99
  220. package/tsconfig.json +0 -20
  221. package/vitest.config.ts +0 -9
  222. package/vitest.integration.config.ts +0 -10
  223. /package/{src → dist}/prompts/templates/sampling/crawl-action.md +0 -0
  224. /package/{src → dist}/prompts/templates/sampling/feature-discovery.md +0 -0
  225. /package/{src → dist}/prompts/templates/sampling/flow-discovery.md +0 -0
  226. /package/{src → dist}/prompts/templates/sampling/page-content-wrapper.md +0 -0
  227. /package/{src → dist}/prompts/templates/sampling/test-evaluation.md +0 -0
  228. /package/{src → dist}/prompts/templates/sampling/test-generation.md +0 -0
  229. /package/dist/tools/{webtest → retest}/crawl.d.ts +0 -0
  230. /package/dist/tools/{webtest → retest}/discover-features.d.ts +0 -0
  231. /package/dist/tools/{webtest → retest}/discover-flows.d.ts +0 -0
  232. /package/dist/tools/{webtest → retest}/generate-tests.d.ts +0 -0
  233. /package/dist/tools/{webtest → retest}/index.d.ts +0 -0
  234. /package/dist/tools/{webtest → retest}/index.js +0 -0
  235. /package/dist/tools/{webtest → retest}/run-test-case.d.ts +0 -0
  236. /package/dist/tools/{webtest → retest}/schemas.d.ts +0 -0
  237. /package/dist/tools/{webtest → retest}/schemas.js +0 -0
  238. /package/dist/tools/{webtest → retest}/start-analysis.d.ts +0 -0
@@ -1,304 +0,0 @@
1
- ## MODIFIED Requirements
2
-
3
- ### Requirement: webtest_init Tool
4
-
5
- The system SHALL provide a `webtest_init` tool that initializes an analysis workspace for a target URL and focus.
6
-
7
- #### Scenario: Start analysis with valid URL
8
-
9
- - **GIVEN** the tool is called with a valid URL and focus
10
- - **WHEN** execution completes
11
- - **THEN** it SHALL generate a unique `analysisId`
12
- - **AND** create workspace directories
13
- - **AND** write initial `index.json` metadata
14
- - **AND** return `{ analysisId, workspaceRootPath, workspaceRootUri, statusUri }`
15
-
16
- #### Scenario: Start analysis validates URL
17
-
18
- - **GIVEN** the tool is called with an invalid URL
19
- - **WHEN** validation occurs
20
- - **THEN** it SHALL return an error with message "Invalid URL format"
21
-
22
- #### Scenario: Start analysis normalizes domain for allowlist
23
-
24
- - **GIVEN** the tool is called with URL "https://example.com/path"
25
- - **WHEN** workspace is created
26
- - **THEN** the default `allowedDomains` SHALL include "example.com"
27
- - **AND** this SHALL be stored in workspace metadata
28
-
29
- #### Scenario: Start analysis accepts custom limits
30
-
31
- - **GIVEN** the tool is called with `limits: { maxSteps: 50, maxPages: 10, maxMinutes: 5 }`
32
- - **WHEN** workspace is created
33
- - **THEN** limits SHALL be stored in workspace metadata
34
- - **AND** subsequent crawls SHALL respect these limits
35
-
36
- ### Requirement: webtest_crawl_app Tool
37
-
38
- The system SHALL provide a `webtest_crawl_app` tool that dynamically explores a web application to achieve a goal.
39
-
40
- #### Scenario: Crawl navigates to starting URL
41
-
42
- - **GIVEN** the tool is called with a valid analysisId
43
- - **WHEN** crawl begins
44
- - **THEN** it SHALL launch Playwright MCP browser
45
- - **AND** navigate to the URL from analysis metadata
46
-
47
- #### Scenario: Crawl captures artifacts at each checkpoint
48
-
49
- - **GIVEN** a crawl iteration completes an action
50
- - **WHEN** state is captured
51
- - **THEN** it SHALL call Playwright MCP `browser_snapshot` for accessibility tree
52
- - **AND** call `browser_take_screenshot` for visual evidence
53
- - **AND** optionally extract HTML DOM
54
- - **AND** store artifacts in workspace with unique page IDs
55
-
56
- #### Scenario: Crawl uses sampling for next action
57
-
58
- - **GIVEN** crawl has captured current state
59
- - **WHEN** next action is needed
60
- - **THEN** it SHALL construct a sampling prompt with goal, history, current state
61
- - **AND** request next action via `sampling/createMessage`
62
- - **AND** validate and execute returned Playwright actions
63
-
64
- #### Scenario: Crawl terminates when goal satisfied
65
-
66
- - **GIVEN** crawl sampling returns `goalSatisfied: true`
67
- - **WHEN** this is detected
68
- - **THEN** crawl SHALL finalize with success status
69
- - **AND** write crawl summary to workspace
70
-
71
- #### Scenario: Crawl terminates when limits reached
72
-
73
- - **GIVEN** crawl has executed `maxSteps` actions
74
- - **WHEN** limit is checked
75
- - **THEN** crawl SHALL finalize with "limits_reached" status
76
- - **AND** preserve all collected artifacts
77
-
78
- #### Scenario: Crawl handles navigation loops
79
-
80
- - **GIVEN** crawl detects same page state 3 times consecutively
81
- - **WHEN** loop is detected
82
- - **THEN** it SHALL log a warning
83
- - **AND** request alternative action from sampling with loop context
84
-
85
- #### Scenario: Crawl triggers elicitation for cookie consent
86
-
87
- - **GIVEN** crawl detects a cookie consent dialog
88
- - **WHEN** elicitation is supported
89
- - **THEN** it SHALL call elicitation with options: "Accept", "Reject", "Dismiss"
90
- - **AND** execute the chosen action
91
-
92
- #### Scenario: Crawl triggers elicitation for blocking modal
93
-
94
- - **GIVEN** crawl detects a modal blocking navigation
95
- - **WHEN** elicitation is supported
96
- - **THEN** it SHALL call elicitation with options: "Close modal", "Interact with modal content"
97
-
98
- #### Scenario: Crawl triggers elicitation for ambiguous navigation
99
-
100
- - **GIVEN** sampling returns `needsElicitation: { type: "ambiguous", options: [...] }`
101
- - **WHEN** elicitation is supported
102
- - **THEN** it SHALL present the options to the user
103
- - **AND** use the selection to continue crawl
104
-
105
- #### Scenario: Crawl stops on authentication required
106
-
107
- - **GIVEN** crawl detects login form or auth wall
108
- - **WHEN** elicitation is supported
109
- - **THEN** it SHALL call elicitation with options: "Stop analysis", "Continue unauthenticated"
110
- - **AND** never request credentials
111
-
112
- #### Scenario: Crawl emits progress notifications
113
-
114
- - **GIVEN** crawl is running
115
- - **WHEN** each iteration completes
116
- - **THEN** it SHALL emit progress notification with step count, pages discovered, current intent
117
-
118
- #### Scenario: Crawl responds to cancellation
119
-
120
- - **GIVEN** crawl receives `notifications/cancelled`
121
- - **WHEN** cancellation is detected
122
- - **THEN** it SHALL stop the crawl loop promptly
123
- - **AND** finalize with "cancelled" status
124
- - **AND** preserve collected artifacts
125
-
126
- #### Scenario: Crawl returns fallback when sampling unavailable
127
-
128
- - **GIVEN** client does not support sampling
129
- - **WHEN** crawl needs next action
130
- - **THEN** it SHALL return `{ needsManualInput: true, promptUri, currentState }`
131
- - **AND** accept `manualNextActions` input to continue
132
-
133
- #### Scenario: Crawl outputs complete results
134
-
135
- - **GIVEN** crawl has finalized
136
- - **WHEN** output is returned
137
- - **THEN** it SHALL include `crawlId`, `crawlIndexFilePath`, `crawlIndexUri`, `pages[]`, `summaryUri`
138
-
139
- ### Requirement: webtest_analyze_app Tool
140
-
141
- The system SHALL provide a `webtest_analyze_app` tool that reverse-engineers application structure from crawl data.
142
-
143
- #### Scenario: Analyze app loads crawl data
144
-
145
- - **GIVEN** the tool is called with valid analysisId and crawlId
146
- - **WHEN** execution begins
147
- - **THEN** it SHALL load crawl index and artifact references
148
- - **AND** load page snapshots for key pages
149
-
150
- #### Scenario: Analyze app uses sampling for analysis
151
-
152
- - **GIVEN** crawl data is loaded
153
- - **WHEN** analysis is performed
154
- - **THEN** it SHALL construct sampling prompt with crawl summary and snapshots
155
- - **AND** request structured analysis via `sampling/createMessage`
156
-
157
- #### Scenario: Analyze app extracts application purpose
158
-
159
- - **GIVEN** analysis sampling completes
160
- - **WHEN** results are processed
161
- - **THEN** output SHALL include identified app purpose
162
- - **AND** key entities (users, products, orders, etc.)
163
-
164
- #### Scenario: Analyze app identifies user flows
165
-
166
- - **GIVEN** analysis sampling completes
167
- - **WHEN** results are processed
168
- - **THEN** output SHALL include discovered user flows
169
- - **AND** each flow SHALL have id, name, description, steps
170
-
171
- #### Scenario: Analyze app suggests assertions
172
-
173
- - **GIVEN** analysis sampling completes
174
- - **WHEN** results are processed
175
- - **THEN** output SHALL include suggested assertions for testing
176
- - **AND** potential risks or edge cases
177
-
178
- #### Scenario: Analyze app writes markdown report
179
-
180
- - **GIVEN** analysis is complete
181
- - **WHEN** output is generated
182
- - **THEN** it SHALL write `app-analysis.md` resource to workspace
183
-
184
- #### Scenario: Analyze app outputs file paths and URIs
185
-
186
- - **GIVEN** analysis is complete
187
- - **WHEN** tool returns
188
- - **THEN** it SHALL include `appAnalysisFilePath`, `appAnalysisUri`, `flowsFilePath`, and `flowsUri`
189
-
190
- ### Requirement: webtest_generate_tests Tool
191
-
192
- The system SHALL provide a `webtest_generate_tests` tool that produces test cases from application analysis.
193
-
194
- #### Scenario: Generate tests loads analysis
195
-
196
- - **GIVEN** the tool is called with valid analysisId and appAnalysisUri
197
- - **WHEN** execution begins
198
- - **THEN** it SHALL load app analysis and flows from workspace
199
-
200
- #### Scenario: Generate tests uses sampling
201
-
202
- - **GIVEN** analysis is loaded
203
- - **WHEN** test generation is performed
204
- - **THEN** it SHALL construct sampling prompt with analysis, flows, strategy
205
- - **AND** request test cases via `sampling/createMessage`
206
-
207
- #### Scenario: Generate tests applies strategy
208
-
209
- - **GIVEN** tool is called with `testStrategy: { count: 5, types: ["smoke", "negative"] }`
210
- - **WHEN** sampling prompt is built
211
- - **THEN** it SHALL instruct model to generate 5 tests covering smoke and negative scenarios
212
-
213
- #### Scenario: Generate tests outputs structured format
214
-
215
- - **GIVEN** test generation completes
216
- - **WHEN** results are written
217
- - **THEN** it SHALL produce `tests.md` with human-readable format
218
- - **AND** `tests.json` with structured test definitions
219
-
220
- #### Scenario: Test case structure is complete
221
-
222
- - **GIVEN** tests.json is generated
223
- - **WHEN** a test case is examined
224
- - **THEN** it SHALL include: id, name, purpose, preconditions, steps[], expected results, priority
225
-
226
- #### Scenario: Generate tests outputs file paths and URIs
227
-
228
- - **GIVEN** generation is complete
229
- - **WHEN** tool returns
230
- - **THEN** it SHALL include `testsFilePath`, `testsUri`, and `testIndexUri`
231
-
232
- ### Requirement: webtest_run_tests Tool
233
-
234
- The system SHALL provide a `webtest_run_tests` tool that executes a test case with evidence capture.
235
-
236
- #### Scenario: Run test case loads test definition
237
-
238
- - **GIVEN** the tool is called with valid analysisId and testCaseId
239
- - **WHEN** execution begins
240
- - **THEN** it SHALL load test case from tests index
241
- - **AND** validate test case exists
242
-
243
- #### Scenario: Run test case executes steps sequentially
244
-
245
- - **GIVEN** test case has multiple steps
246
- - **WHEN** execution runs
247
- - **THEN** it SHALL execute each step in order
248
- - **AND** capture state before and after each step
249
-
250
- #### Scenario: Run test case uses sampling for step translation
251
-
252
- - **GIVEN** a test step needs execution
253
- - **WHEN** translation is needed
254
- - **THEN** it SHALL use sampling to convert step description to Playwright actions
255
- - **AND** validate actions before execution
256
-
257
- #### Scenario: Run test case captures evidence
258
-
259
- - **GIVEN** a step is executed
260
- - **WHEN** evidence is captured
261
- - **THEN** it SHALL take screenshot after action
262
- - **AND** capture accessibility snapshot
263
- - **AND** store with step identifier
264
-
265
- #### Scenario: Run test case evaluates pass/fail
266
-
267
- - **GIVEN** a step has executed
268
- - **WHEN** evaluation occurs
269
- - **THEN** it SHALL use sampling to compare expected vs actual
270
- - **AND** record pass or fail with reason
271
-
272
- #### Scenario: Run test case continues on step failure
273
-
274
- - **GIVEN** a step fails
275
- - **WHEN** failure is recorded
276
- - **THEN** execution SHALL continue to next step (unless critical)
277
- - **AND** overall test status SHALL be "failed"
278
-
279
- #### Scenario: Run test case emits progress
280
-
281
- - **GIVEN** test is running
282
- - **WHEN** each step completes
283
- - **THEN** it SHALL emit progress notification with step number, status
284
-
285
- #### Scenario: Run test case responds to cancellation
286
-
287
- - **GIVEN** test receives `notifications/cancelled`
288
- - **WHEN** cancellation is detected
289
- - **THEN** it SHALL stop after current step
290
- - **AND** finalize with "cancelled" status and partial results
291
-
292
- #### Scenario: Run test case outputs report
293
-
294
- - **GIVEN** test execution completes
295
- - **WHEN** output is generated
296
- - **THEN** it SHALL write `report.md` with pass/fail summary, step details, evidence links
297
- - **AND** `artifacts.json` with structured run data
298
-
299
- #### Scenario: Run test case returns file paths and URIs
300
-
301
- - **GIVEN** execution is complete
302
- - **WHEN** tool returns
303
- - **THEN** it SHALL include `testRunId`, `reportFilePath`, `reportUri`, `runArtifactsIndexUri`
304
- - **AND** each step result SHALL include `evidenceFilePath` and `evidenceUri` for captured artifacts
@@ -1,43 +0,0 @@
1
- ## 1. Workspace Manager Updates
2
-
3
- - [x] 1.1 Add `workspaceDir` getter to expose base directory path
4
- - [x] 1.2 Update `saveAnalysis` to return `{ appAnalysisFilePath, appAnalysisUri, flowsFilePath, flowsUri }`
5
- - [x] 1.3 Update `saveTests` to return `{ testsFilePath, testsUri, testsMarkdownFilePath }`
6
- - [x] 1.4 Update `savePage` to return `{ snapshotFilePath, screenshotFilePath, domFilePath }` alongside URIs
7
- - [x] 1.5 Update `saveTestStepEvidence` to return file paths alongside URIs
8
- - [x] 1.6 Update `createWorkspace` to return `{ workspacePath, workspaceUri }`
9
- - [x] 1.7 Update `createCrawl` to return `{ crawlPath, crawlIndexUri }`
10
-
11
- ## 2. Type Definitions
12
-
13
- - [x] 2.1 Update workspace types to include FilePath variants in return types
14
- - [x] 2.2 Add TypeScript interfaces for hybrid artifact results
15
-
16
- ## 3. Tool Updates
17
-
18
- - [x] 3.1 Update `webtest_init` to include `workspaceRootPath` in result
19
- - [x] 3.2 Update `webtest_crawl_app` to include `crawlIndexFilePath` in result
20
- - [x] 3.3 Update `webtest_analyze_app` to include `appAnalysisFilePath` and `flowsFilePath` in result
21
- - [x] 3.4 Update `webtest_generate_tests` to include `testsFilePath` in result
22
- - [x] 3.5 Update `webtest_run_tests` to include `reportFilePath` and evidence file paths in result
23
-
24
- ## 4. Tests
25
-
26
- - [x] 4.1 Update workspace manager tests to verify file path return values
27
- - [x] 4.2 Update tool tests to verify file path fields in results
28
- - [x] 4.3 Verify file paths are absolute and valid
29
-
30
- ## 5. Workspace Index Persistence (Fix for handover issue)
31
-
32
- - [x] 5.1 Add `appAnalysisFilePath` and `flowsFilePath` to `AnalysisReference` type
33
- - [x] 5.2 Add `testsFilePath` and `testsMarkdownFilePath` to `TestsReference` type
34
- - [x] 5.3 Update `saveAnalysis` to persist file paths in workspace index
35
- - [x] 5.4 Update `saveTests` to persist file paths in workspace index
36
-
37
- ## 6. Manual Input Support (Fix for fallback mode when sampling unavailable)
38
-
39
- - [x] 6.1 Add `manualAnalysis` parameter to `webtest_analyze_app` input schema
40
- - [x] 6.2 Update `webtest_analyze_app` handler to use manual input when provided
41
- - [x] 6.3 Update fallback instructions to guide calling tool again with manual input
42
- - [x] 6.4 Add `manualTests` parameter to `webtest_generate_tests` input schema
43
- - [x] 6.5 Update `webtest_generate_tests` handler to use manual input when provided
@@ -1,209 +0,0 @@
1
- ## Context
2
-
3
- This MCP Web Testing Server needs a solid foundation that follows MCP protocol best practices while being structured for extensibility. The server will eventually provide tools for automated web application testing, so the initial architecture must support easy addition of testing-specific tools (browser automation, HTTP requests, assertions, etc.).
4
-
5
- **Stakeholders**: Developers building testing workflows, MCP client integrations (Claude Code, ChatGPT desktop, etc.)
6
-
7
- **Constraints**:
8
- - Must follow MCP specification (2025-06-18)
9
- - Must support both stdio and HTTP transports from day one
10
- - Proprietary codebase - no external contributions expected
11
-
12
- ## Goals / Non-Goals
13
-
14
- **Goals:**
15
- - Establish clean, extensible project structure for adding testing tools
16
- - Follow official MCP TypeScript SDK patterns
17
- - Provide pluggable transport layer (stdio + Streamable HTTP)
18
- - Create self-describing tool registry pattern
19
- - Enable rapid development iteration with hot-reloading
20
- - Include comprehensive test infrastructure (unit + integration)
21
- - Production-ready logging and configuration
22
-
23
- **Non-Goals:**
24
- - Authentication/authorization (deferred to future proposal)
25
- - Resource or prompt handlers (tools-focused initially)
26
- - Actual testing functionality (that comes in subsequent proposals)
27
-
28
- ## Decisions
29
-
30
- ### Decision 1: TypeScript with Official MCP SDK
31
-
32
- **What**: Use TypeScript with `@modelcontextprotocol/sdk` and Zod for schemas.
33
-
34
- **Why**:
35
- - Official SDK maintained by protocol authors
36
- - TypeScript provides type safety and IDE support
37
- - Zod is required peer dependency and excellent for runtime validation
38
- - Largest ecosystem of MCP reference implementations
39
-
40
- **Alternatives considered**:
41
- - Python SDK: Good option but TypeScript has better MCP ecosystem maturity
42
- - Go SDK: Less mature, fewer reference implementations to learn from
43
-
44
- ### Decision 2: ESM-Only with Node.js >= 22.18.0
45
-
46
- **What**: Use ECMAScript modules exclusively, recommend Node.js 22.18.0+.
47
-
48
- **Why**:
49
- - Node.js 22.18.0+ has built-in type stripping enabled by default (instant reloads without build step)
50
- - Earlier 22.x versions require `--experimental-strip-types` flag
51
- - ESM is the modern standard and SDK uses ESM imports
52
- - Simplifies tooling configuration
53
-
54
- **Alternatives considered**:
55
- - CommonJS: Legacy, more tooling complexity
56
- - Dual ESM/CJS: Unnecessary complexity for internal project
57
-
58
- ### Decision 3: Pluggable Transport Architecture
59
-
60
- **What**: Abstract transport selection via environment variables with implementations in `src/transports/`.
61
-
62
- ```
63
- TRANSPORT=stdio # Default for local dev
64
- TRANSPORT=http PORT=3000 # For remote deployment
65
- ```
66
-
67
- **Why**:
68
- - Aligns with how the TS SDK frames transports
69
- - stdio for local MCP client integration (Claude Code, etc.)
70
- - Streamable HTTP ready for remote/cloud deployment scenarios
71
- - Easy to add new transports (WebSocket, etc.) following the pattern
72
-
73
- **Structure**:
74
- ```
75
- src/transports/
76
- ├── index.ts # Transport factory based on env config
77
- ├── stdio.ts # StdioServerTransport wrapper
78
- └── http.ts # StreamableHTTPServerTransport wrapper
79
- ```
80
-
81
- ### Decision 4: Project Structure
82
-
83
- **What**: Organize code into modular directories by concern.
84
-
85
- ```
86
- src/
87
- ├── index.ts # Entry point, bootstrap
88
- ├── server.ts # MCP server factory
89
- ├── config.ts # Zod-validated configuration
90
- ├── logger.ts # Structured logging with redaction
91
- ├── transports/ # Transport implementations
92
- │ ├── index.ts # Factory
93
- │ ├── stdio.ts
94
- │ └── http.ts
95
- ├── tools/ # Tool definitions
96
- │ ├── index.ts # Registry
97
- │ └── hello.ts # Demo tool
98
- ├── schemas/ # Shared Zod schemas
99
- └── types/ # TypeScript type definitions
100
- ```
101
-
102
- **Why**:
103
- - Follows patterns from official MCP reference servers
104
- - Tools directory with registry enables easy addition of new tools
105
- - Transports directory encapsulates transport-specific logic
106
- - Separation of concerns for maintainability
107
-
108
- ### Decision 5: Self-Describing Tool Registry
109
-
110
- **What**: Each tool exports a standard interface; registry auto-discovers and registers tools.
111
-
112
- ```typescript
113
- // Tool interface
114
- export interface McpTool<TInput> {
115
- name: string;
116
- description: string;
117
- inputSchema: z.ZodType<TInput>;
118
- handler: (input: TInput) => Promise<ToolResult>;
119
- }
120
-
121
- // tools/index.ts exports all tools
122
- export const tools: McpTool<unknown>[] = [helloTool, /* future tools */];
123
- ```
124
-
125
- **Why**:
126
- - Single source of truth: Zod schema generates both TS types and JSON Schema for MCP
127
- - Consistent pattern for adding new tools
128
- - Easy to test tools in isolation
129
- - Self-documenting tool capabilities
130
-
131
- ### Decision 6: Structured Logging
132
-
133
- **What**: Use structured JSON logging with automatic secret redaction.
134
-
135
- **Why**:
136
- - Machine-parseable logs for production observability
137
- - Secret redaction prevents accidental credential exposure
138
- - Configurable log levels via environment
139
-
140
- **Pattern**:
141
- ```typescript
142
- // Redact known sensitive fields
143
- const REDACT_KEYS = ['password', 'token', 'secret', 'apiKey', 'authorization'];
144
- ```
145
-
146
- ### Decision 7: Vitest for Testing
147
-
148
- **What**: Use Vitest for unit and integration tests.
149
-
150
- **Why**:
151
- - Native ESM support
152
- - Fast execution with built-in watch mode
153
- - TypeScript support out of box
154
- - Compatible with Node.js test patterns
155
-
156
- **Test Strategy**:
157
- - **Unit tests**: Test tool handlers in isolation with mocked inputs
158
- - **Integration tests**: Spawn actual server, connect via StdioServerTransport, execute tools end-to-end
159
-
160
- **Alternatives considered**:
161
- - Jest: Requires more ESM configuration
162
- - Node.js built-in test runner: Less mature feature set
163
-
164
- ### Decision 8: tsx for Development
165
-
166
- **What**: Use `tsx` for development with watch mode.
167
-
168
- **Why**:
169
- - Instant TypeScript execution without separate compile step
170
- - Excellent watch mode for hot-reloading during development
171
- - Works seamlessly with ESM
172
-
173
- ### Decision 9: Package.json Hygiene
174
-
175
- **What**: Proper ESM package configuration with exports map and bin entry.
176
-
177
- ```json
178
- {
179
- "type": "module",
180
- "exports": {
181
- ".": "./dist/index.js"
182
- },
183
- "bin": {
184
- "testing-mcp": "./dist/index.js"
185
- }
186
- }
187
- ```
188
-
189
- **Why**:
190
- - Enables `npx testing-mcp` execution
191
- - Proper exports for potential future library consumption
192
- - Clear module resolution
193
-
194
- ## Risks / Trade-offs
195
-
196
- | Risk | Impact | Mitigation |
197
- |------|--------|------------|
198
- | SDK breaking changes | Medium | Pin SDK version, update intentionally |
199
- | Node.js 22.18.0+ requirement | Low | Recent LTS, document flag for earlier 22.x |
200
- | HTTP transport without auth | Medium | Document as internal-only; auth in future proposal |
201
- | Structured logging overhead | Low | Negligible for typical tool execution volumes |
202
-
203
- ## Migration Plan
204
-
205
- Not applicable - this is a greenfield implementation.
206
-
207
- ## Open Questions
208
-
209
- None - ready for implementation approval.
@@ -1,41 +0,0 @@
1
- # Change: Add MCP Server Foundation
2
-
3
- ## Why
4
-
5
- This project needs a foundational MCP server implementation to support web application testing workflows. Starting with a well-structured foundation enables incremental addition of testing-specific tools while maintaining clean architecture and consistent patterns from the start.
6
-
7
- ## What Changes
8
-
9
- ### Core Infrastructure
10
- - Initialize TypeScript project with modern tooling (Node.js >= 22.18.0 recommended, TypeScript 5.x, ESM modules)
11
- - Implement MCP server using the official `@modelcontextprotocol/sdk` with Zod schema validation
12
- - Create project structure optimized for web testing tool development
13
-
14
- ### Pluggable Transport Layer
15
- - Abstract transport selection behind environment config (`TRANSPORT=stdio|http`, `PORT=...`)
16
- - Implement stdio transport for local dev/integration
17
- - Implement Streamable HTTP transport ready for remote deployment
18
- - Transport modules in `src/transports/` following SDK patterns
19
-
20
- ### Self-Describing Tool Registry
21
- - Create tool registry pattern in `src/tools/index.ts`
22
- - Each tool exports `{ name, description, inputSchema, handler }`
23
- - Generate MCP tool input JSON schema from Zod (single source of truth)
24
- - Add "hello" demonstration tool following the registry pattern
25
-
26
- ### Production-Ready Basics
27
- - Structured logging with secret redaction
28
- - Graceful shutdown handling (SIGINT/SIGTERM)
29
- - Config validation via Zod at startup
30
- - Package.json hygiene: `"type":"module"`, exports map, bin entry for CLI usage
31
-
32
- ### Testing Infrastructure
33
- - Unit tests with Vitest
34
- - Integration tests that spawn server and speak MCP protocol end-to-end
35
- - Test tool execution and error handling via StdioServerTransport
36
-
37
- ## Impact
38
-
39
- - Affected specs: `mcp-server-core` (new capability)
40
- - Affected code: New project structure in `src/`, configuration files at root
41
- - Dependencies: `@modelcontextprotocol/sdk`, `zod`, TypeScript toolchain