webmcp-cli 1.0.0 → 1.2.1

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 (347) hide show
  1. package/dist/agent/features/agent-simulator.d.ts +67 -0
  2. package/dist/agent/features/agent-simulator.js +368 -0
  3. package/dist/agent/features/agent-simulator.js.map +1 -0
  4. package/dist/agent/features/index.d.ts +8 -0
  5. package/dist/agent/features/index.js +9 -0
  6. package/dist/agent/features/index.js.map +1 -0
  7. package/dist/agent/features/simulation-judge.d.ts +78 -0
  8. package/dist/agent/features/simulation-judge.js +276 -0
  9. package/dist/agent/features/simulation-judge.js.map +1 -0
  10. package/dist/agent/features/test-case-generator.d.ts +35 -0
  11. package/dist/agent/features/test-case-generator.js +257 -0
  12. package/dist/agent/features/test-case-generator.js.map +1 -0
  13. package/dist/agent/index.d.ts +7 -0
  14. package/dist/agent/index.js +10 -0
  15. package/dist/agent/index.js.map +1 -0
  16. package/dist/agent/llm-client.d.ts +76 -0
  17. package/dist/agent/llm-client.js +198 -0
  18. package/dist/agent/llm-client.js.map +1 -0
  19. package/dist/audit/run-single-page-audit.d.ts +41 -0
  20. package/dist/audit/run-single-page-audit.js +103 -0
  21. package/dist/audit/run-single-page-audit.js.map +1 -0
  22. package/dist/bin/webmcp.d.ts +5 -0
  23. package/dist/bin/webmcp.js +14 -0
  24. package/dist/bin/webmcp.js.map +1 -0
  25. package/dist/browser/audit-runner.d.ts +30 -0
  26. package/dist/browser/audit-runner.js +77 -0
  27. package/dist/browser/audit-runner.js.map +1 -0
  28. package/dist/browser/index.d.ts +6 -0
  29. package/dist/browser/index.js +7 -0
  30. package/dist/browser/index.js.map +1 -0
  31. package/dist/browser/interceptor.d.ts +68 -0
  32. package/dist/browser/interceptor.js +257 -0
  33. package/dist/browser/interceptor.js.map +1 -0
  34. package/dist/browser/playwright.d.ts +98 -0
  35. package/dist/browser/playwright.js +158 -0
  36. package/dist/browser/playwright.js.map +1 -0
  37. package/dist/cli/commands/audit.d.ts +12 -0
  38. package/dist/cli/commands/audit.js +349 -0
  39. package/dist/cli/commands/audit.js.map +1 -0
  40. package/dist/cli/commands/interactive.d.ts +10 -0
  41. package/dist/cli/commands/interactive.js +34 -0
  42. package/dist/cli/commands/interactive.js.map +1 -0
  43. package/dist/cli/index.d.ts +17 -0
  44. package/dist/cli/index.js +84 -0
  45. package/dist/cli/index.js.map +1 -0
  46. package/dist/cli/options/parse-audit-options.d.ts +12 -0
  47. package/dist/cli/options/parse-audit-options.js +64 -0
  48. package/dist/cli/options/parse-audit-options.js.map +1 -0
  49. package/dist/core/constants.d.ts +102 -0
  50. package/dist/core/constants.js +214 -0
  51. package/dist/core/constants.js.map +1 -0
  52. package/dist/core/types/audit.d.ts +260 -0
  53. package/dist/core/types/audit.js +5 -0
  54. package/dist/core/types/audit.js.map +1 -0
  55. package/dist/core/types/index.d.ts +6 -0
  56. package/dist/core/types/index.js +7 -0
  57. package/dist/core/types/index.js.map +1 -0
  58. package/dist/core/types/rule.d.ts +190 -0
  59. package/dist/core/types/rule.js +26 -0
  60. package/dist/core/types/rule.js.map +1 -0
  61. package/dist/core/types/tool.d.ts +312 -0
  62. package/dist/core/types/tool.js +6 -0
  63. package/dist/core/types/tool.js.map +1 -0
  64. package/dist/detection/declarative.d.ts +27 -0
  65. package/dist/detection/declarative.js +343 -0
  66. package/dist/detection/declarative.js.map +1 -0
  67. package/dist/detection/imperative.d.ts +38 -0
  68. package/dist/detection/imperative.js +99 -0
  69. package/dist/detection/imperative.js.map +1 -0
  70. package/dist/detection/index.d.ts +5 -0
  71. package/dist/detection/index.js +6 -0
  72. package/dist/detection/index.js.map +1 -0
  73. package/dist/index.d.ts +12 -0
  74. package/dist/index.js +19 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/llm/advice-service.d.ts +38 -0
  77. package/dist/llm/advice-service.js +243 -0
  78. package/dist/llm/advice-service.js.map +1 -0
  79. package/dist/llm/evaluator.d.ts +89 -0
  80. package/dist/llm/evaluator.js +274 -0
  81. package/dist/llm/evaluator.js.map +1 -0
  82. package/dist/llm/index.d.ts +11 -0
  83. package/dist/llm/index.js +15 -0
  84. package/dist/llm/index.js.map +1 -0
  85. package/dist/llm/json-response.d.ts +12 -0
  86. package/dist/llm/json-response.js +67 -0
  87. package/dist/llm/json-response.js.map +1 -0
  88. package/dist/llm/providers/mock.d.ts +29 -0
  89. package/dist/llm/providers/mock.js +324 -0
  90. package/dist/llm/providers/mock.js.map +1 -0
  91. package/dist/llm/providers/openrouter.d.ts +53 -0
  92. package/dist/llm/providers/openrouter.js +321 -0
  93. package/dist/llm/providers/openrouter.js.map +1 -0
  94. package/dist/llm/request-cache.d.ts +28 -0
  95. package/dist/llm/request-cache.js +99 -0
  96. package/dist/llm/request-cache.js.map +1 -0
  97. package/dist/llm/types.d.ts +233 -0
  98. package/dist/llm/types.js +7 -0
  99. package/dist/llm/types.js.map +1 -0
  100. package/dist/rules/best-practices/BP-001.d.ts +11 -0
  101. package/dist/rules/best-practices/BP-001.js +56 -0
  102. package/dist/rules/best-practices/BP-001.js.map +1 -0
  103. package/dist/rules/best-practices/BP-002.d.ts +11 -0
  104. package/dist/rules/best-practices/BP-002.js +63 -0
  105. package/dist/rules/best-practices/BP-002.js.map +1 -0
  106. package/dist/rules/best-practices/BP-003.d.ts +11 -0
  107. package/dist/rules/best-practices/BP-003.js +68 -0
  108. package/dist/rules/best-practices/BP-003.js.map +1 -0
  109. package/dist/rules/coverage/COV-001.d.ts +8 -0
  110. package/dist/rules/coverage/COV-001.js +51 -0
  111. package/dist/rules/coverage/COV-001.js.map +1 -0
  112. package/dist/rules/description/DESC-003.d.ts +13 -0
  113. package/dist/rules/description/DESC-003.js +96 -0
  114. package/dist/rules/description/DESC-003.js.map +1 -0
  115. package/dist/rules/description/DESC-004.d.ts +8 -0
  116. package/dist/rules/description/DESC-004.js +61 -0
  117. package/dist/rules/description/DESC-004.js.map +1 -0
  118. package/dist/rules/description/DESC-005.d.ts +12 -0
  119. package/dist/rules/description/DESC-005.js +70 -0
  120. package/dist/rules/description/DESC-005.js.map +1 -0
  121. package/dist/rules/description/index.d.ts +4 -0
  122. package/dist/rules/description/index.js +5 -0
  123. package/dist/rules/description/index.js.map +1 -0
  124. package/dist/rules/implementation/IMP-001.d.ts +10 -0
  125. package/dist/rules/implementation/IMP-001.js +36 -0
  126. package/dist/rules/implementation/IMP-001.js.map +1 -0
  127. package/dist/rules/implementation/IMP-003.d.ts +9 -0
  128. package/dist/rules/implementation/IMP-003.js +45 -0
  129. package/dist/rules/implementation/IMP-003.js.map +1 -0
  130. package/dist/rules/implementation/IMP-004.d.ts +9 -0
  131. package/dist/rules/implementation/IMP-004.js +48 -0
  132. package/dist/rules/implementation/IMP-004.js.map +1 -0
  133. package/dist/rules/implementation/IMP-005.d.ts +9 -0
  134. package/dist/rules/implementation/IMP-005.js +54 -0
  135. package/dist/rules/implementation/IMP-005.js.map +1 -0
  136. package/dist/rules/implementation/IMP-007.d.ts +8 -0
  137. package/dist/rules/implementation/IMP-007.js +79 -0
  138. package/dist/rules/implementation/IMP-007.js.map +1 -0
  139. package/dist/rules/implementation/IMP-013.d.ts +9 -0
  140. package/dist/rules/implementation/IMP-013.js +55 -0
  141. package/dist/rules/implementation/IMP-013.js.map +1 -0
  142. package/dist/rules/implementation/index.d.ts +9 -0
  143. package/dist/rules/implementation/index.js +10 -0
  144. package/dist/rules/implementation/index.js.map +1 -0
  145. package/dist/rules/index.d.ts +51 -0
  146. package/dist/rules/index.js +100 -0
  147. package/dist/rules/index.js.map +1 -0
  148. package/dist/rules/llm/LLM-001.d.ts +14 -0
  149. package/dist/rules/llm/LLM-001.js +78 -0
  150. package/dist/rules/llm/LLM-001.js.map +1 -0
  151. package/dist/rules/llm/LLM-002.d.ts +14 -0
  152. package/dist/rules/llm/LLM-002.js +77 -0
  153. package/dist/rules/llm/LLM-002.js.map +1 -0
  154. package/dist/rules/llm/LLM-003.d.ts +16 -0
  155. package/dist/rules/llm/LLM-003.js +82 -0
  156. package/dist/rules/llm/LLM-003.js.map +1 -0
  157. package/dist/rules/llm/LLM-004.d.ts +14 -0
  158. package/dist/rules/llm/LLM-004.js +87 -0
  159. package/dist/rules/llm/LLM-004.js.map +1 -0
  160. package/dist/rules/llm/LLM-005.d.ts +16 -0
  161. package/dist/rules/llm/LLM-005.js +105 -0
  162. package/dist/rules/llm/LLM-005.js.map +1 -0
  163. package/dist/rules/llm/index.d.ts +10 -0
  164. package/dist/rules/llm/index.js +11 -0
  165. package/dist/rules/llm/index.js.map +1 -0
  166. package/dist/rules/runner.d.ts +54 -0
  167. package/dist/rules/runner.js +138 -0
  168. package/dist/rules/runner.js.map +1 -0
  169. package/dist/rules/schema/SCHEMA-001.d.ts +9 -0
  170. package/dist/rules/schema/SCHEMA-001.js +57 -0
  171. package/dist/rules/schema/SCHEMA-001.js.map +1 -0
  172. package/dist/rules/schema/SCHEMA-002.d.ts +9 -0
  173. package/dist/rules/schema/SCHEMA-002.js +59 -0
  174. package/dist/rules/schema/SCHEMA-002.js.map +1 -0
  175. package/dist/rules/schema/SCHEMA-003.d.ts +10 -0
  176. package/dist/rules/schema/SCHEMA-003.js +66 -0
  177. package/dist/rules/schema/SCHEMA-003.js.map +1 -0
  178. package/dist/rules/schema/SCHEMA-011.d.ts +10 -0
  179. package/dist/rules/schema/SCHEMA-011.js +62 -0
  180. package/dist/rules/schema/SCHEMA-011.js.map +1 -0
  181. package/dist/rules/security/SEC-001.d.ts +12 -0
  182. package/dist/rules/security/SEC-001.js +66 -0
  183. package/dist/rules/security/SEC-001.js.map +1 -0
  184. package/dist/rules/utils/keywords.d.ts +35 -0
  185. package/dist/rules/utils/keywords.js +100 -0
  186. package/dist/rules/utils/keywords.js.map +1 -0
  187. package/dist/scoring/calculator.d.ts +27 -0
  188. package/dist/scoring/calculator.js +194 -0
  189. package/dist/scoring/calculator.js.map +1 -0
  190. package/dist/scoring/grades.d.ts +34 -0
  191. package/dist/scoring/grades.js +167 -0
  192. package/dist/scoring/grades.js.map +1 -0
  193. package/dist/scoring/index.d.ts +5 -0
  194. package/dist/scoring/index.js +6 -0
  195. package/dist/scoring/index.js.map +1 -0
  196. package/dist/ui/banner.d.ts +21 -0
  197. package/dist/ui/banner.js +60 -0
  198. package/dist/ui/banner.js.map +1 -0
  199. package/dist/ui/design-tokens.d.ts +23 -0
  200. package/dist/ui/design-tokens.js +58 -0
  201. package/dist/ui/design-tokens.js.map +1 -0
  202. package/dist/ui/findings.d.ts +23 -0
  203. package/dist/ui/findings.js +190 -0
  204. package/dist/ui/findings.js.map +1 -0
  205. package/dist/ui/index.d.ts +9 -0
  206. package/dist/ui/index.js +10 -0
  207. package/dist/ui/index.js.map +1 -0
  208. package/dist/ui/ink/App.d.ts +14 -0
  209. package/dist/ui/ink/App.js +113 -0
  210. package/dist/ui/ink/App.js.map +1 -0
  211. package/dist/ui/ink/FullScreenLayout.d.ts +16 -0
  212. package/dist/ui/ink/FullScreenLayout.js +29 -0
  213. package/dist/ui/ink/FullScreenLayout.js.map +1 -0
  214. package/dist/ui/ink/InteractiveApp.d.ts +28 -0
  215. package/dist/ui/ink/InteractiveApp.js +229 -0
  216. package/dist/ui/ink/InteractiveApp.js.map +1 -0
  217. package/dist/ui/ink/RealAuditApp.d.ts +19 -0
  218. package/dist/ui/ink/RealAuditApp.js +170 -0
  219. package/dist/ui/ink/RealAuditApp.js.map +1 -0
  220. package/dist/ui/ink/components/AnimatedProgressBar.d.ts +20 -0
  221. package/dist/ui/ink/components/AnimatedProgressBar.js +46 -0
  222. package/dist/ui/ink/components/AnimatedProgressBar.js.map +1 -0
  223. package/dist/ui/ink/components/AsciiLogo.d.ts +12 -0
  224. package/dist/ui/ink/components/AsciiLogo.js +35 -0
  225. package/dist/ui/ink/components/AsciiLogo.js.map +1 -0
  226. package/dist/ui/ink/components/CategoryBars.d.ts +18 -0
  227. package/dist/ui/ink/components/CategoryBars.js +18 -0
  228. package/dist/ui/ink/components/CategoryBars.js.map +1 -0
  229. package/dist/ui/ink/components/FindingsTable.d.ts +18 -0
  230. package/dist/ui/ink/components/FindingsTable.js +19 -0
  231. package/dist/ui/ink/components/FindingsTable.js.map +1 -0
  232. package/dist/ui/ink/components/Footer.d.ts +15 -0
  233. package/dist/ui/ink/components/Footer.js +20 -0
  234. package/dist/ui/ink/components/Footer.js.map +1 -0
  235. package/dist/ui/ink/components/Header.d.ts +11 -0
  236. package/dist/ui/ink/components/Header.js +12 -0
  237. package/dist/ui/ink/components/Header.js.map +1 -0
  238. package/dist/ui/ink/components/LinkList.d.ts +17 -0
  239. package/dist/ui/ink/components/LinkList.js +44 -0
  240. package/dist/ui/ink/components/LinkList.js.map +1 -0
  241. package/dist/ui/ink/components/Navigation.d.ts +26 -0
  242. package/dist/ui/ink/components/Navigation.js +62 -0
  243. package/dist/ui/ink/components/Navigation.js.map +1 -0
  244. package/dist/ui/ink/components/ProgressBar.d.ts +15 -0
  245. package/dist/ui/ink/components/ProgressBar.js +14 -0
  246. package/dist/ui/ink/components/ProgressBar.js.map +1 -0
  247. package/dist/ui/ink/components/ScoreCard.d.ts +30 -0
  248. package/dist/ui/ink/components/ScoreCard.js +26 -0
  249. package/dist/ui/ink/components/ScoreCard.js.map +1 -0
  250. package/dist/ui/ink/components/SimulationResults.d.ts +33 -0
  251. package/dist/ui/ink/components/SimulationResults.js +23 -0
  252. package/dist/ui/ink/components/SimulationResults.js.map +1 -0
  253. package/dist/ui/ink/components/Spinner.d.ts +11 -0
  254. package/dist/ui/ink/components/Spinner.js +12 -0
  255. package/dist/ui/ink/components/Spinner.js.map +1 -0
  256. package/dist/ui/ink/components/ToolCard.d.ts +23 -0
  257. package/dist/ui/ink/components/ToolCard.js +20 -0
  258. package/dist/ui/ink/components/ToolCard.js.map +1 -0
  259. package/dist/ui/ink/components/shared/Badge.d.ts +21 -0
  260. package/dist/ui/ink/components/shared/Badge.js +39 -0
  261. package/dist/ui/ink/components/shared/Badge.js.map +1 -0
  262. package/dist/ui/ink/components/shared/Card.d.ts +18 -0
  263. package/dist/ui/ink/components/shared/Card.js +11 -0
  264. package/dist/ui/ink/components/shared/Card.js.map +1 -0
  265. package/dist/ui/ink/components/shared/HelpOverlay.d.ts +10 -0
  266. package/dist/ui/ink/components/shared/HelpOverlay.js +28 -0
  267. package/dist/ui/ink/components/shared/HelpOverlay.js.map +1 -0
  268. package/dist/ui/ink/components/shared/LoadingWithTimeout.d.ts +11 -0
  269. package/dist/ui/ink/components/shared/LoadingWithTimeout.js +21 -0
  270. package/dist/ui/ink/components/shared/LoadingWithTimeout.js.map +1 -0
  271. package/dist/ui/ink/components/shared/Menu.d.ts +23 -0
  272. package/dist/ui/ink/components/shared/Menu.js +43 -0
  273. package/dist/ui/ink/components/shared/Menu.js.map +1 -0
  274. package/dist/ui/ink/components/shared/Table.d.ts +23 -0
  275. package/dist/ui/ink/components/shared/Table.js +40 -0
  276. package/dist/ui/ink/components/shared/Table.js.map +1 -0
  277. package/dist/ui/ink/components/views/CrawlingView.d.ts +12 -0
  278. package/dist/ui/ink/components/views/CrawlingView.js +34 -0
  279. package/dist/ui/ink/components/views/CrawlingView.js.map +1 -0
  280. package/dist/ui/ink/components/views/DashboardView.d.ts +21 -0
  281. package/dist/ui/ink/components/views/DashboardView.js +51 -0
  282. package/dist/ui/ink/components/views/DashboardView.js.map +1 -0
  283. package/dist/ui/ink/components/views/FindingDetailView.d.ts +16 -0
  284. package/dist/ui/ink/components/views/FindingDetailView.js +34 -0
  285. package/dist/ui/ink/components/views/FindingDetailView.js.map +1 -0
  286. package/dist/ui/ink/components/views/FindingsView.d.ts +16 -0
  287. package/dist/ui/ink/components/views/FindingsView.js +79 -0
  288. package/dist/ui/ink/components/views/FindingsView.js.map +1 -0
  289. package/dist/ui/ink/components/views/OnboardingView.d.ts +12 -0
  290. package/dist/ui/ink/components/views/OnboardingView.js +40 -0
  291. package/dist/ui/ink/components/views/OnboardingView.js.map +1 -0
  292. package/dist/ui/ink/components/views/SimulationView.d.ts +17 -0
  293. package/dist/ui/ink/components/views/SimulationView.js +53 -0
  294. package/dist/ui/ink/components/views/SimulationView.js.map +1 -0
  295. package/dist/ui/ink/components/views/TestCaseDetailView.d.ts +11 -0
  296. package/dist/ui/ink/components/views/TestCaseDetailView.js +53 -0
  297. package/dist/ui/ink/components/views/TestCaseDetailView.js.map +1 -0
  298. package/dist/ui/ink/components/views/ToolDetailView.d.ts +15 -0
  299. package/dist/ui/ink/components/views/ToolDetailView.js +25 -0
  300. package/dist/ui/ink/components/views/ToolDetailView.js.map +1 -0
  301. package/dist/ui/ink/components/views/ToolsView.d.ts +15 -0
  302. package/dist/ui/ink/components/views/ToolsView.js +43 -0
  303. package/dist/ui/ink/components/views/ToolsView.js.map +1 -0
  304. package/dist/ui/ink/demo.d.ts +6 -0
  305. package/dist/ui/ink/demo.js +254 -0
  306. package/dist/ui/ink/demo.js.map +1 -0
  307. package/dist/ui/ink/hooks/useAnimation.d.ts +29 -0
  308. package/dist/ui/ink/hooks/useAnimation.js +89 -0
  309. package/dist/ui/ink/hooks/useAnimation.js.map +1 -0
  310. package/dist/ui/ink/hooks/useAudit.d.ts +69 -0
  311. package/dist/ui/ink/hooks/useAudit.js +99 -0
  312. package/dist/ui/ink/hooks/useAudit.js.map +1 -0
  313. package/dist/ui/ink/hooks/useCrawlAnimation.d.ts +19 -0
  314. package/dist/ui/ink/hooks/useCrawlAnimation.js +204 -0
  315. package/dist/ui/ink/hooks/useCrawlAnimation.js.map +1 -0
  316. package/dist/ui/ink/hooks/useKeyboardNav.d.ts +23 -0
  317. package/dist/ui/ink/hooks/useKeyboardNav.js +81 -0
  318. package/dist/ui/ink/hooks/useKeyboardNav.js.map +1 -0
  319. package/dist/ui/ink/hooks/useNavigation.d.ts +16 -0
  320. package/dist/ui/ink/hooks/useNavigation.js +42 -0
  321. package/dist/ui/ink/hooks/useNavigation.js.map +1 -0
  322. package/dist/ui/ink/hooks/useTerminalSize.d.ts +10 -0
  323. package/dist/ui/ink/hooks/useTerminalSize.js +29 -0
  324. package/dist/ui/ink/hooks/useTerminalSize.js.map +1 -0
  325. package/dist/ui/ink/index.d.ts +43 -0
  326. package/dist/ui/ink/index.js +50 -0
  327. package/dist/ui/ink/index.js.map +1 -0
  328. package/dist/ui/ink/render.d.ts +24 -0
  329. package/dist/ui/ink/render.js +14 -0
  330. package/dist/ui/ink/render.js.map +1 -0
  331. package/dist/ui/ink/theme.d.ts +37 -0
  332. package/dist/ui/ink/theme.js +38 -0
  333. package/dist/ui/ink/theme.js.map +1 -0
  334. package/dist/ui/ink/types.d.ts +77 -0
  335. package/dist/ui/ink/types.js +5 -0
  336. package/dist/ui/ink/types.js.map +1 -0
  337. package/dist/ui/score-display.d.ts +16 -0
  338. package/dist/ui/score-display.js +201 -0
  339. package/dist/ui/score-display.js.map +1 -0
  340. package/dist/ui/spinner.d.ts +45 -0
  341. package/dist/ui/spinner.js +112 -0
  342. package/dist/ui/spinner.js.map +1 -0
  343. package/dist/ui/utils.d.ts +13 -0
  344. package/dist/ui/utils.js +25 -0
  345. package/dist/ui/utils.js.map +1 -0
  346. package/package.json +61 -9
  347. package/index.js +0 -105
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Rule Types
3
+ */
4
+ import type { Page } from 'playwright';
5
+ import type { DetectedTool, UnregisteredForm } from './tool.js';
6
+ import type { PageInfo } from './audit.js';
7
+ /**
8
+ * Rule categories
9
+ */
10
+ export type RuleCategory = 'implementation' | 'description' | 'schema' | 'security' | 'best-practices' | 'coverage';
11
+ /**
12
+ * Rule severity levels
13
+ */
14
+ export type RuleSeverity = 'critical' | 'warning' | 'info';
15
+ /**
16
+ * Context provided to rules for evaluation
17
+ */
18
+ export interface RuleContext {
19
+ /**
20
+ * The URL being audited
21
+ */
22
+ url: string;
23
+ /**
24
+ * All detected tools
25
+ */
26
+ tools: DetectedTool[];
27
+ /**
28
+ * All unregistered forms
29
+ */
30
+ opportunities: UnregisteredForm[];
31
+ /**
32
+ * All pages crawled
33
+ */
34
+ pages: PageInfo[];
35
+ /**
36
+ * The Playwright page object (for dynamic checks)
37
+ */
38
+ page?: Page;
39
+ /**
40
+ * Raw HTML content of the current page
41
+ */
42
+ html?: string;
43
+ /**
44
+ * Whether WebMCP API exists
45
+ */
46
+ hasWebMCP: boolean;
47
+ /**
48
+ * JavaScript files/snippets for analysis
49
+ */
50
+ scripts?: ScriptInfo[];
51
+ }
52
+ /**
53
+ * Information about a JavaScript file or snippet
54
+ */
55
+ export interface ScriptInfo {
56
+ /**
57
+ * URL or identifier of the script
58
+ */
59
+ src: string;
60
+ /**
61
+ * Script content
62
+ */
63
+ content: string;
64
+ /**
65
+ * Whether this is an inline script
66
+ */
67
+ inline: boolean;
68
+ }
69
+ /**
70
+ * Result of evaluating a single rule
71
+ */
72
+ export interface RuleResult {
73
+ /**
74
+ * Rule ID
75
+ */
76
+ ruleId: string;
77
+ /**
78
+ * Whether the rule passed
79
+ */
80
+ passed: boolean;
81
+ /**
82
+ * Score achieved (0 to rule's maxScore)
83
+ */
84
+ score: number;
85
+ /**
86
+ * Maximum possible score for this rule
87
+ */
88
+ maxScore: number;
89
+ /**
90
+ * Human-readable message
91
+ */
92
+ message: string;
93
+ /**
94
+ * Additional details
95
+ */
96
+ details?: string[];
97
+ /**
98
+ * Suggestions for fixing issues
99
+ */
100
+ suggestions?: string[];
101
+ /**
102
+ * Tools that triggered this rule
103
+ */
104
+ affectedTools?: string[];
105
+ /**
106
+ * Pages where issues were found
107
+ */
108
+ affectedPages?: string[];
109
+ }
110
+ /**
111
+ * A finding (issue) from the audit
112
+ */
113
+ export interface Finding {
114
+ /**
115
+ * Rule ID that generated this finding
116
+ */
117
+ ruleId: string;
118
+ /**
119
+ * Severity level
120
+ */
121
+ severity: RuleSeverity;
122
+ /**
123
+ * Short message
124
+ */
125
+ message: string;
126
+ /**
127
+ * Tool name if applicable
128
+ */
129
+ tool?: string;
130
+ /**
131
+ * Page URL if applicable
132
+ */
133
+ page?: string;
134
+ /**
135
+ * Suggested fix
136
+ */
137
+ fix?: string;
138
+ /**
139
+ * Score impact (points deducted)
140
+ */
141
+ scoreImpact: number;
142
+ }
143
+ /**
144
+ * Rule definition
145
+ */
146
+ export interface Rule {
147
+ /**
148
+ * Unique rule ID (e.g., "IMP-001")
149
+ */
150
+ id: string;
151
+ /**
152
+ * Rule category
153
+ */
154
+ category: RuleCategory;
155
+ /**
156
+ * Short name
157
+ */
158
+ name: string;
159
+ /**
160
+ * Detailed description of what the rule checks
161
+ */
162
+ description: string;
163
+ /**
164
+ * Severity level
165
+ */
166
+ severity: RuleSeverity;
167
+ /**
168
+ * Maximum points for this rule
169
+ */
170
+ maxScore: number;
171
+ /**
172
+ * Evaluate the rule against the given context
173
+ */
174
+ check(context: RuleContext): Promise<RuleResult>;
175
+ }
176
+ /**
177
+ * Rule registry entry
178
+ */
179
+ export interface RuleRegistryEntry {
180
+ rule: Rule;
181
+ enabled: boolean;
182
+ }
183
+ /**
184
+ * Score weights by category
185
+ */
186
+ export declare const CATEGORY_WEIGHTS: Record<RuleCategory, number>;
187
+ /**
188
+ * Category display names
189
+ */
190
+ export declare const CATEGORY_NAMES: Record<RuleCategory, string>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Rule Types
3
+ */
4
+ /**
5
+ * Score weights by category
6
+ */
7
+ export const CATEGORY_WEIGHTS = {
8
+ implementation: 25,
9
+ description: 15,
10
+ schema: 20,
11
+ security: 25,
12
+ 'best-practices': 10,
13
+ coverage: 5,
14
+ };
15
+ /**
16
+ * Category display names
17
+ */
18
+ export const CATEGORY_NAMES = {
19
+ implementation: 'Implementation',
20
+ description: 'Description Quality',
21
+ schema: 'Schema Validation',
22
+ security: 'Security',
23
+ 'best-practices': 'Best Practices',
24
+ coverage: 'Coverage',
25
+ };
26
+ //# sourceMappingURL=rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../src/core/types/rule.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiOH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAiC;IAC5D,cAAc,EAAE,EAAE;IAClB,WAAW,EAAE,EAAE;IACf,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,gBAAgB,EAAE,EAAE;IACpB,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,qBAAqB;IAClC,MAAM,EAAE,mBAAmB;IAC3B,QAAQ,EAAE,UAAU;IACpB,gBAAgB,EAAE,gBAAgB;IAClC,QAAQ,EAAE,UAAU;CACrB,CAAC"}
@@ -0,0 +1,312 @@
1
+ /**
2
+ * WebMCP Tool Types
3
+ * Based on the Web Model Context Protocol specification
4
+ */
5
+ /**
6
+ * JSON Schema property definition (simplified for tool schemas)
7
+ */
8
+ export interface JsonSchemaProperty {
9
+ type?: string | string[];
10
+ description?: string;
11
+ enum?: unknown[];
12
+ const?: unknown;
13
+ default?: unknown;
14
+ format?: string;
15
+ minimum?: number;
16
+ maximum?: number;
17
+ minLength?: number;
18
+ maxLength?: number;
19
+ pattern?: string;
20
+ items?: JsonSchemaProperty;
21
+ properties?: Record<string, JsonSchemaProperty>;
22
+ required?: string[];
23
+ additionalProperties?: boolean | JsonSchemaProperty;
24
+ oneOf?: JsonSchemaProperty[];
25
+ anyOf?: JsonSchemaProperty[];
26
+ allOf?: JsonSchemaProperty[];
27
+ [key: string]: unknown;
28
+ }
29
+ /**
30
+ * Tool annotations that provide hints about the tool's behavior
31
+ */
32
+ export interface ToolAnnotations {
33
+ /**
34
+ * If true, the tool only reads data and has no side effects
35
+ */
36
+ readOnlyHint?: boolean;
37
+ /**
38
+ * If true, the tool may have irreversible side effects (delete, purchase, etc.)
39
+ */
40
+ destructiveHint?: boolean;
41
+ /**
42
+ * If true, the tool may take a long time to complete
43
+ */
44
+ longRunningHint?: boolean;
45
+ /**
46
+ * If true, the tool may require human confirmation before executing
47
+ */
48
+ requiresConfirmation?: boolean;
49
+ /**
50
+ * Human-readable title for the tool
51
+ */
52
+ title?: string;
53
+ /**
54
+ * Additional custom annotations
55
+ */
56
+ [key: string]: unknown;
57
+ }
58
+ /**
59
+ * Input schema for a WebMCP tool (JSON Schema format)
60
+ */
61
+ export interface ToolInputSchema {
62
+ type: 'object';
63
+ properties?: Record<string, JsonSchemaProperty>;
64
+ required?: string[];
65
+ additionalProperties?: boolean;
66
+ [key: string]: unknown;
67
+ }
68
+ /**
69
+ * A WebMCP tool definition as captured from the page
70
+ */
71
+ export interface CapturedTool {
72
+ /**
73
+ * Unique name for the tool (snake_case recommended)
74
+ */
75
+ name: string;
76
+ /**
77
+ * Human-readable description of what the tool does
78
+ */
79
+ description: string;
80
+ /**
81
+ * JSON Schema defining the tool's input parameters
82
+ */
83
+ inputSchema?: ToolInputSchema;
84
+ /**
85
+ * Annotations providing hints about the tool's behavior
86
+ */
87
+ annotations?: ToolAnnotations;
88
+ /**
89
+ * Whether the tool has an execute function defined
90
+ */
91
+ hasExecute: boolean;
92
+ /**
93
+ * Source code of the execute function (if available)
94
+ */
95
+ executeSource: string | null;
96
+ /**
97
+ * Timestamp when the tool was registered
98
+ */
99
+ registeredAt: number;
100
+ /**
101
+ * Method used to register the tool
102
+ */
103
+ registrationMethod: 'registerTool' | 'provideContext';
104
+ /**
105
+ * URL of the page where the tool was registered
106
+ */
107
+ pageUrl?: string;
108
+ }
109
+ /**
110
+ * A declarative tool detected from HTML form attributes
111
+ */
112
+ export interface DeclarativeTool {
113
+ /**
114
+ * Tool name from the toolname attribute
115
+ */
116
+ toolname: string;
117
+ /**
118
+ * Tool description from the tooldescription attribute
119
+ */
120
+ tooldescription: string;
121
+ /**
122
+ * Whether the form has the toolautosubmit attribute
123
+ */
124
+ autosubmit: boolean;
125
+ /**
126
+ * Form action URL
127
+ */
128
+ formAction: string;
129
+ /**
130
+ * Form method (GET, POST, etc.)
131
+ */
132
+ formMethod: string;
133
+ /**
134
+ * Parameters detected from form inputs
135
+ */
136
+ parameters: DeclarativeToolParameter[];
137
+ /**
138
+ * Outer HTML of the form element (truncated)
139
+ */
140
+ formElement: string;
141
+ /**
142
+ * URL of the page where the form was found
143
+ */
144
+ pageUrl?: string;
145
+ }
146
+ /**
147
+ * A parameter detected from a form input element
148
+ */
149
+ export interface DeclarativeToolParameter {
150
+ /**
151
+ * Parameter name from the input name attribute
152
+ */
153
+ name: string;
154
+ /**
155
+ * Human-friendly title from toolparamtitle attribute
156
+ */
157
+ toolparamtitle: string | null;
158
+ /**
159
+ * Description from toolparamdescription attribute
160
+ */
161
+ toolparamdescription: string | null;
162
+ /**
163
+ * JSON Schema type inferred from input type
164
+ */
165
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
166
+ /**
167
+ * Whether the input has the required attribute
168
+ */
169
+ required: boolean;
170
+ /**
171
+ * Original HTML input type
172
+ */
173
+ inputType: string;
174
+ /**
175
+ * Options for select/radio inputs
176
+ */
177
+ options: {
178
+ value: string;
179
+ text: string;
180
+ selected: boolean;
181
+ }[] | null;
182
+ /**
183
+ * Constraints from HTML attributes
184
+ */
185
+ constraints: {
186
+ min?: string | null;
187
+ max?: string | null;
188
+ minlength?: string | null;
189
+ maxlength?: string | null;
190
+ pattern?: string | null;
191
+ step?: string | null;
192
+ };
193
+ /**
194
+ * Text from the associated label element
195
+ */
196
+ labelText: string | null;
197
+ /**
198
+ * Text from aria-description attribute
199
+ */
200
+ ariaDescription: string | null;
201
+ }
202
+ /**
203
+ * A form detected without WebMCP attributes (opportunity for improvement)
204
+ */
205
+ export interface UnregisteredForm {
206
+ /**
207
+ * Index of the form on the page
208
+ */
209
+ index: number;
210
+ /**
211
+ * Context clues for generating tool suggestions
212
+ */
213
+ contextClues: {
214
+ formId: string | null;
215
+ formAction: string | null;
216
+ formMethod: string;
217
+ formClass: string | null;
218
+ submitText: string | null;
219
+ nearestHeading: string | null;
220
+ pageTitle: string;
221
+ ariaLabel: string | null;
222
+ fieldNames: string[];
223
+ fieldTypes: string[];
224
+ hasPasswordField: boolean;
225
+ hasEmailField: boolean;
226
+ hasPaymentFields: boolean;
227
+ fieldCount: number;
228
+ };
229
+ /**
230
+ * Estimated sensitivity level
231
+ */
232
+ sensitivity: 'low' | 'medium' | 'high' | 'critical';
233
+ /**
234
+ * Estimated value for AI agent interaction
235
+ */
236
+ agenticValue: 'low' | 'medium' | 'high' | 'critical';
237
+ /**
238
+ * Number of fields in the form
239
+ */
240
+ fieldCount: number;
241
+ /**
242
+ * Outer HTML of the form (truncated)
243
+ */
244
+ formOuterHTML: string;
245
+ /**
246
+ * Fields detected in the form
247
+ */
248
+ fields: {
249
+ name: string;
250
+ type: string;
251
+ required: boolean;
252
+ placeholder: string | null;
253
+ label: string | null;
254
+ options: {
255
+ value: string;
256
+ text: string;
257
+ }[] | null;
258
+ }[];
259
+ /**
260
+ * URL of the page where the form was found
261
+ */
262
+ pageUrl?: string;
263
+ }
264
+ /**
265
+ * Unified detected tool (either imperative or declarative)
266
+ */
267
+ export interface DetectedTool {
268
+ /**
269
+ * Tool name
270
+ */
271
+ name: string;
272
+ /**
273
+ * Tool description
274
+ */
275
+ description: string;
276
+ /**
277
+ * Input schema (JSON Schema format)
278
+ */
279
+ inputSchema?: ToolInputSchema;
280
+ /**
281
+ * Tool annotations
282
+ */
283
+ annotations?: ToolAnnotations;
284
+ /**
285
+ * Detection source
286
+ */
287
+ source: 'imperative' | 'declarative';
288
+ /**
289
+ * Registration method for imperative tools
290
+ */
291
+ registrationMethod?: 'registerTool' | 'provideContext';
292
+ /**
293
+ * Whether the tool has an execute function
294
+ */
295
+ hasExecute?: boolean;
296
+ /**
297
+ * Execute function source code
298
+ */
299
+ executeSource?: string | null;
300
+ /**
301
+ * URL where the tool was found
302
+ */
303
+ pageUrl: string;
304
+ /**
305
+ * Additional form-specific data for declarative tools
306
+ */
307
+ formData?: {
308
+ autosubmit: boolean;
309
+ formAction: string;
310
+ formMethod: string;
311
+ };
312
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * WebMCP Tool Types
3
+ * Based on the Web Model Context Protocol specification
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/core/types/tool.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Declarative Tool Detection
3
+ *
4
+ * Scans HTML for WebMCP form attributes (toolname, tooldescription, etc.)
5
+ */
6
+ import type { DeclarativeTool, DetectedTool, UnregisteredForm } from '../core/types/tool.js';
7
+ /**
8
+ * Scan HTML for declarative WebMCP tools (forms with toolname attribute)
9
+ */
10
+ export declare function scanDeclarativeTools(html: string, pageUrl: string): DeclarativeTool[];
11
+ /**
12
+ * Convert a declarative tool to a detected tool
13
+ */
14
+ export declare function toDetectedTool(declarative: DeclarativeTool): DetectedTool;
15
+ /**
16
+ * Scan HTML for unregistered forms (opportunities)
17
+ */
18
+ export declare function scanUnregisteredForms(html: string, pageUrl: string): UnregisteredForm[];
19
+ /**
20
+ * Get statistics about declarative tools on a page
21
+ */
22
+ export declare function getDeclarativeStats(html: string): {
23
+ totalForms: number;
24
+ registeredForms: number;
25
+ unregisteredForms: number;
26
+ autosubmitForms: number;
27
+ };