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.
- package/dist/agent/features/agent-simulator.d.ts +67 -0
- package/dist/agent/features/agent-simulator.js +368 -0
- package/dist/agent/features/agent-simulator.js.map +1 -0
- package/dist/agent/features/index.d.ts +8 -0
- package/dist/agent/features/index.js +9 -0
- package/dist/agent/features/index.js.map +1 -0
- package/dist/agent/features/simulation-judge.d.ts +78 -0
- package/dist/agent/features/simulation-judge.js +276 -0
- package/dist/agent/features/simulation-judge.js.map +1 -0
- package/dist/agent/features/test-case-generator.d.ts +35 -0
- package/dist/agent/features/test-case-generator.js +257 -0
- package/dist/agent/features/test-case-generator.js.map +1 -0
- package/dist/agent/index.d.ts +7 -0
- package/dist/agent/index.js +10 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/llm-client.d.ts +76 -0
- package/dist/agent/llm-client.js +198 -0
- package/dist/agent/llm-client.js.map +1 -0
- package/dist/audit/run-single-page-audit.d.ts +41 -0
- package/dist/audit/run-single-page-audit.js +103 -0
- package/dist/audit/run-single-page-audit.js.map +1 -0
- package/dist/bin/webmcp.d.ts +5 -0
- package/dist/bin/webmcp.js +14 -0
- package/dist/bin/webmcp.js.map +1 -0
- package/dist/browser/audit-runner.d.ts +30 -0
- package/dist/browser/audit-runner.js +77 -0
- package/dist/browser/audit-runner.js.map +1 -0
- package/dist/browser/index.d.ts +6 -0
- package/dist/browser/index.js +7 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/interceptor.d.ts +68 -0
- package/dist/browser/interceptor.js +257 -0
- package/dist/browser/interceptor.js.map +1 -0
- package/dist/browser/playwright.d.ts +98 -0
- package/dist/browser/playwright.js +158 -0
- package/dist/browser/playwright.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +12 -0
- package/dist/cli/commands/audit.js +349 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/interactive.d.ts +10 -0
- package/dist/cli/commands/interactive.js +34 -0
- package/dist/cli/commands/interactive.js.map +1 -0
- package/dist/cli/index.d.ts +17 -0
- package/dist/cli/index.js +84 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/options/parse-audit-options.d.ts +12 -0
- package/dist/cli/options/parse-audit-options.js +64 -0
- package/dist/cli/options/parse-audit-options.js.map +1 -0
- package/dist/core/constants.d.ts +102 -0
- package/dist/core/constants.js +214 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/types/audit.d.ts +260 -0
- package/dist/core/types/audit.js +5 -0
- package/dist/core/types/audit.js.map +1 -0
- package/dist/core/types/index.d.ts +6 -0
- package/dist/core/types/index.js +7 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/rule.d.ts +190 -0
- package/dist/core/types/rule.js +26 -0
- package/dist/core/types/rule.js.map +1 -0
- package/dist/core/types/tool.d.ts +312 -0
- package/dist/core/types/tool.js +6 -0
- package/dist/core/types/tool.js.map +1 -0
- package/dist/detection/declarative.d.ts +27 -0
- package/dist/detection/declarative.js +343 -0
- package/dist/detection/declarative.js.map +1 -0
- package/dist/detection/imperative.d.ts +38 -0
- package/dist/detection/imperative.js +99 -0
- package/dist/detection/imperative.js.map +1 -0
- package/dist/detection/index.d.ts +5 -0
- package/dist/detection/index.js +6 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/advice-service.d.ts +38 -0
- package/dist/llm/advice-service.js +243 -0
- package/dist/llm/advice-service.js.map +1 -0
- package/dist/llm/evaluator.d.ts +89 -0
- package/dist/llm/evaluator.js +274 -0
- package/dist/llm/evaluator.js.map +1 -0
- package/dist/llm/index.d.ts +11 -0
- package/dist/llm/index.js +15 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/json-response.d.ts +12 -0
- package/dist/llm/json-response.js +67 -0
- package/dist/llm/json-response.js.map +1 -0
- package/dist/llm/providers/mock.d.ts +29 -0
- package/dist/llm/providers/mock.js +324 -0
- package/dist/llm/providers/mock.js.map +1 -0
- package/dist/llm/providers/openrouter.d.ts +53 -0
- package/dist/llm/providers/openrouter.js +321 -0
- package/dist/llm/providers/openrouter.js.map +1 -0
- package/dist/llm/request-cache.d.ts +28 -0
- package/dist/llm/request-cache.js +99 -0
- package/dist/llm/request-cache.js.map +1 -0
- package/dist/llm/types.d.ts +233 -0
- package/dist/llm/types.js +7 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/rules/best-practices/BP-001.d.ts +11 -0
- package/dist/rules/best-practices/BP-001.js +56 -0
- package/dist/rules/best-practices/BP-001.js.map +1 -0
- package/dist/rules/best-practices/BP-002.d.ts +11 -0
- package/dist/rules/best-practices/BP-002.js +63 -0
- package/dist/rules/best-practices/BP-002.js.map +1 -0
- package/dist/rules/best-practices/BP-003.d.ts +11 -0
- package/dist/rules/best-practices/BP-003.js +68 -0
- package/dist/rules/best-practices/BP-003.js.map +1 -0
- package/dist/rules/coverage/COV-001.d.ts +8 -0
- package/dist/rules/coverage/COV-001.js +51 -0
- package/dist/rules/coverage/COV-001.js.map +1 -0
- package/dist/rules/description/DESC-003.d.ts +13 -0
- package/dist/rules/description/DESC-003.js +96 -0
- package/dist/rules/description/DESC-003.js.map +1 -0
- package/dist/rules/description/DESC-004.d.ts +8 -0
- package/dist/rules/description/DESC-004.js +61 -0
- package/dist/rules/description/DESC-004.js.map +1 -0
- package/dist/rules/description/DESC-005.d.ts +12 -0
- package/dist/rules/description/DESC-005.js +70 -0
- package/dist/rules/description/DESC-005.js.map +1 -0
- package/dist/rules/description/index.d.ts +4 -0
- package/dist/rules/description/index.js +5 -0
- package/dist/rules/description/index.js.map +1 -0
- package/dist/rules/implementation/IMP-001.d.ts +10 -0
- package/dist/rules/implementation/IMP-001.js +36 -0
- package/dist/rules/implementation/IMP-001.js.map +1 -0
- package/dist/rules/implementation/IMP-003.d.ts +9 -0
- package/dist/rules/implementation/IMP-003.js +45 -0
- package/dist/rules/implementation/IMP-003.js.map +1 -0
- package/dist/rules/implementation/IMP-004.d.ts +9 -0
- package/dist/rules/implementation/IMP-004.js +48 -0
- package/dist/rules/implementation/IMP-004.js.map +1 -0
- package/dist/rules/implementation/IMP-005.d.ts +9 -0
- package/dist/rules/implementation/IMP-005.js +54 -0
- package/dist/rules/implementation/IMP-005.js.map +1 -0
- package/dist/rules/implementation/IMP-007.d.ts +8 -0
- package/dist/rules/implementation/IMP-007.js +79 -0
- package/dist/rules/implementation/IMP-007.js.map +1 -0
- package/dist/rules/implementation/IMP-013.d.ts +9 -0
- package/dist/rules/implementation/IMP-013.js +55 -0
- package/dist/rules/implementation/IMP-013.js.map +1 -0
- package/dist/rules/implementation/index.d.ts +9 -0
- package/dist/rules/implementation/index.js +10 -0
- package/dist/rules/implementation/index.js.map +1 -0
- package/dist/rules/index.d.ts +51 -0
- package/dist/rules/index.js +100 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/llm/LLM-001.d.ts +14 -0
- package/dist/rules/llm/LLM-001.js +78 -0
- package/dist/rules/llm/LLM-001.js.map +1 -0
- package/dist/rules/llm/LLM-002.d.ts +14 -0
- package/dist/rules/llm/LLM-002.js +77 -0
- package/dist/rules/llm/LLM-002.js.map +1 -0
- package/dist/rules/llm/LLM-003.d.ts +16 -0
- package/dist/rules/llm/LLM-003.js +82 -0
- package/dist/rules/llm/LLM-003.js.map +1 -0
- package/dist/rules/llm/LLM-004.d.ts +14 -0
- package/dist/rules/llm/LLM-004.js +87 -0
- package/dist/rules/llm/LLM-004.js.map +1 -0
- package/dist/rules/llm/LLM-005.d.ts +16 -0
- package/dist/rules/llm/LLM-005.js +105 -0
- package/dist/rules/llm/LLM-005.js.map +1 -0
- package/dist/rules/llm/index.d.ts +10 -0
- package/dist/rules/llm/index.js +11 -0
- package/dist/rules/llm/index.js.map +1 -0
- package/dist/rules/runner.d.ts +54 -0
- package/dist/rules/runner.js +138 -0
- package/dist/rules/runner.js.map +1 -0
- package/dist/rules/schema/SCHEMA-001.d.ts +9 -0
- package/dist/rules/schema/SCHEMA-001.js +57 -0
- package/dist/rules/schema/SCHEMA-001.js.map +1 -0
- package/dist/rules/schema/SCHEMA-002.d.ts +9 -0
- package/dist/rules/schema/SCHEMA-002.js +59 -0
- package/dist/rules/schema/SCHEMA-002.js.map +1 -0
- package/dist/rules/schema/SCHEMA-003.d.ts +10 -0
- package/dist/rules/schema/SCHEMA-003.js +66 -0
- package/dist/rules/schema/SCHEMA-003.js.map +1 -0
- package/dist/rules/schema/SCHEMA-011.d.ts +10 -0
- package/dist/rules/schema/SCHEMA-011.js +62 -0
- package/dist/rules/schema/SCHEMA-011.js.map +1 -0
- package/dist/rules/security/SEC-001.d.ts +12 -0
- package/dist/rules/security/SEC-001.js +66 -0
- package/dist/rules/security/SEC-001.js.map +1 -0
- package/dist/rules/utils/keywords.d.ts +35 -0
- package/dist/rules/utils/keywords.js +100 -0
- package/dist/rules/utils/keywords.js.map +1 -0
- package/dist/scoring/calculator.d.ts +27 -0
- package/dist/scoring/calculator.js +194 -0
- package/dist/scoring/calculator.js.map +1 -0
- package/dist/scoring/grades.d.ts +34 -0
- package/dist/scoring/grades.js +167 -0
- package/dist/scoring/grades.js.map +1 -0
- package/dist/scoring/index.d.ts +5 -0
- package/dist/scoring/index.js +6 -0
- package/dist/scoring/index.js.map +1 -0
- package/dist/ui/banner.d.ts +21 -0
- package/dist/ui/banner.js +60 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/design-tokens.d.ts +23 -0
- package/dist/ui/design-tokens.js +58 -0
- package/dist/ui/design-tokens.js.map +1 -0
- package/dist/ui/findings.d.ts +23 -0
- package/dist/ui/findings.js +190 -0
- package/dist/ui/findings.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.js +10 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/ink/App.d.ts +14 -0
- package/dist/ui/ink/App.js +113 -0
- package/dist/ui/ink/App.js.map +1 -0
- package/dist/ui/ink/FullScreenLayout.d.ts +16 -0
- package/dist/ui/ink/FullScreenLayout.js +29 -0
- package/dist/ui/ink/FullScreenLayout.js.map +1 -0
- package/dist/ui/ink/InteractiveApp.d.ts +28 -0
- package/dist/ui/ink/InteractiveApp.js +229 -0
- package/dist/ui/ink/InteractiveApp.js.map +1 -0
- package/dist/ui/ink/RealAuditApp.d.ts +19 -0
- package/dist/ui/ink/RealAuditApp.js +170 -0
- package/dist/ui/ink/RealAuditApp.js.map +1 -0
- package/dist/ui/ink/components/AnimatedProgressBar.d.ts +20 -0
- package/dist/ui/ink/components/AnimatedProgressBar.js +46 -0
- package/dist/ui/ink/components/AnimatedProgressBar.js.map +1 -0
- package/dist/ui/ink/components/AsciiLogo.d.ts +12 -0
- package/dist/ui/ink/components/AsciiLogo.js +35 -0
- package/dist/ui/ink/components/AsciiLogo.js.map +1 -0
- package/dist/ui/ink/components/CategoryBars.d.ts +18 -0
- package/dist/ui/ink/components/CategoryBars.js +18 -0
- package/dist/ui/ink/components/CategoryBars.js.map +1 -0
- package/dist/ui/ink/components/FindingsTable.d.ts +18 -0
- package/dist/ui/ink/components/FindingsTable.js +19 -0
- package/dist/ui/ink/components/FindingsTable.js.map +1 -0
- package/dist/ui/ink/components/Footer.d.ts +15 -0
- package/dist/ui/ink/components/Footer.js +20 -0
- package/dist/ui/ink/components/Footer.js.map +1 -0
- package/dist/ui/ink/components/Header.d.ts +11 -0
- package/dist/ui/ink/components/Header.js +12 -0
- package/dist/ui/ink/components/Header.js.map +1 -0
- package/dist/ui/ink/components/LinkList.d.ts +17 -0
- package/dist/ui/ink/components/LinkList.js +44 -0
- package/dist/ui/ink/components/LinkList.js.map +1 -0
- package/dist/ui/ink/components/Navigation.d.ts +26 -0
- package/dist/ui/ink/components/Navigation.js +62 -0
- package/dist/ui/ink/components/Navigation.js.map +1 -0
- package/dist/ui/ink/components/ProgressBar.d.ts +15 -0
- package/dist/ui/ink/components/ProgressBar.js +14 -0
- package/dist/ui/ink/components/ProgressBar.js.map +1 -0
- package/dist/ui/ink/components/ScoreCard.d.ts +30 -0
- package/dist/ui/ink/components/ScoreCard.js +26 -0
- package/dist/ui/ink/components/ScoreCard.js.map +1 -0
- package/dist/ui/ink/components/SimulationResults.d.ts +33 -0
- package/dist/ui/ink/components/SimulationResults.js +23 -0
- package/dist/ui/ink/components/SimulationResults.js.map +1 -0
- package/dist/ui/ink/components/Spinner.d.ts +11 -0
- package/dist/ui/ink/components/Spinner.js +12 -0
- package/dist/ui/ink/components/Spinner.js.map +1 -0
- package/dist/ui/ink/components/ToolCard.d.ts +23 -0
- package/dist/ui/ink/components/ToolCard.js +20 -0
- package/dist/ui/ink/components/ToolCard.js.map +1 -0
- package/dist/ui/ink/components/shared/Badge.d.ts +21 -0
- package/dist/ui/ink/components/shared/Badge.js +39 -0
- package/dist/ui/ink/components/shared/Badge.js.map +1 -0
- package/dist/ui/ink/components/shared/Card.d.ts +18 -0
- package/dist/ui/ink/components/shared/Card.js +11 -0
- package/dist/ui/ink/components/shared/Card.js.map +1 -0
- package/dist/ui/ink/components/shared/HelpOverlay.d.ts +10 -0
- package/dist/ui/ink/components/shared/HelpOverlay.js +28 -0
- package/dist/ui/ink/components/shared/HelpOverlay.js.map +1 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.d.ts +11 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.js +21 -0
- package/dist/ui/ink/components/shared/LoadingWithTimeout.js.map +1 -0
- package/dist/ui/ink/components/shared/Menu.d.ts +23 -0
- package/dist/ui/ink/components/shared/Menu.js +43 -0
- package/dist/ui/ink/components/shared/Menu.js.map +1 -0
- package/dist/ui/ink/components/shared/Table.d.ts +23 -0
- package/dist/ui/ink/components/shared/Table.js +40 -0
- package/dist/ui/ink/components/shared/Table.js.map +1 -0
- package/dist/ui/ink/components/views/CrawlingView.d.ts +12 -0
- package/dist/ui/ink/components/views/CrawlingView.js +34 -0
- package/dist/ui/ink/components/views/CrawlingView.js.map +1 -0
- package/dist/ui/ink/components/views/DashboardView.d.ts +21 -0
- package/dist/ui/ink/components/views/DashboardView.js +51 -0
- package/dist/ui/ink/components/views/DashboardView.js.map +1 -0
- package/dist/ui/ink/components/views/FindingDetailView.d.ts +16 -0
- package/dist/ui/ink/components/views/FindingDetailView.js +34 -0
- package/dist/ui/ink/components/views/FindingDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/FindingsView.d.ts +16 -0
- package/dist/ui/ink/components/views/FindingsView.js +79 -0
- package/dist/ui/ink/components/views/FindingsView.js.map +1 -0
- package/dist/ui/ink/components/views/OnboardingView.d.ts +12 -0
- package/dist/ui/ink/components/views/OnboardingView.js +40 -0
- package/dist/ui/ink/components/views/OnboardingView.js.map +1 -0
- package/dist/ui/ink/components/views/SimulationView.d.ts +17 -0
- package/dist/ui/ink/components/views/SimulationView.js +53 -0
- package/dist/ui/ink/components/views/SimulationView.js.map +1 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.d.ts +11 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.js +53 -0
- package/dist/ui/ink/components/views/TestCaseDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/ToolDetailView.d.ts +15 -0
- package/dist/ui/ink/components/views/ToolDetailView.js +25 -0
- package/dist/ui/ink/components/views/ToolDetailView.js.map +1 -0
- package/dist/ui/ink/components/views/ToolsView.d.ts +15 -0
- package/dist/ui/ink/components/views/ToolsView.js +43 -0
- package/dist/ui/ink/components/views/ToolsView.js.map +1 -0
- package/dist/ui/ink/demo.d.ts +6 -0
- package/dist/ui/ink/demo.js +254 -0
- package/dist/ui/ink/demo.js.map +1 -0
- package/dist/ui/ink/hooks/useAnimation.d.ts +29 -0
- package/dist/ui/ink/hooks/useAnimation.js +89 -0
- package/dist/ui/ink/hooks/useAnimation.js.map +1 -0
- package/dist/ui/ink/hooks/useAudit.d.ts +69 -0
- package/dist/ui/ink/hooks/useAudit.js +99 -0
- package/dist/ui/ink/hooks/useAudit.js.map +1 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.d.ts +19 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.js +204 -0
- package/dist/ui/ink/hooks/useCrawlAnimation.js.map +1 -0
- package/dist/ui/ink/hooks/useKeyboardNav.d.ts +23 -0
- package/dist/ui/ink/hooks/useKeyboardNav.js +81 -0
- package/dist/ui/ink/hooks/useKeyboardNav.js.map +1 -0
- package/dist/ui/ink/hooks/useNavigation.d.ts +16 -0
- package/dist/ui/ink/hooks/useNavigation.js +42 -0
- package/dist/ui/ink/hooks/useNavigation.js.map +1 -0
- package/dist/ui/ink/hooks/useTerminalSize.d.ts +10 -0
- package/dist/ui/ink/hooks/useTerminalSize.js +29 -0
- package/dist/ui/ink/hooks/useTerminalSize.js.map +1 -0
- package/dist/ui/ink/index.d.ts +43 -0
- package/dist/ui/ink/index.js +50 -0
- package/dist/ui/ink/index.js.map +1 -0
- package/dist/ui/ink/render.d.ts +24 -0
- package/dist/ui/ink/render.js +14 -0
- package/dist/ui/ink/render.js.map +1 -0
- package/dist/ui/ink/theme.d.ts +37 -0
- package/dist/ui/ink/theme.js +38 -0
- package/dist/ui/ink/theme.js.map +1 -0
- package/dist/ui/ink/types.d.ts +77 -0
- package/dist/ui/ink/types.js +5 -0
- package/dist/ui/ink/types.js.map +1 -0
- package/dist/ui/score-display.d.ts +16 -0
- package/dist/ui/score-display.js +201 -0
- package/dist/ui/score-display.js.map +1 -0
- package/dist/ui/spinner.d.ts +45 -0
- package/dist/ui/spinner.js +112 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/utils.d.ts +13 -0
- package/dist/ui/utils.js +25 -0
- package/dist/ui/utils.js.map +1 -0
- package/package.json +61 -9
- 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 @@
|
|
|
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
|
+
};
|