@vibecheckai/cli 2.5.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/LICENSE +21 -0
- package/README.md +532 -0
- package/dist/autopatch/verified-autopatch.d.ts +111 -0
- package/dist/autopatch/verified-autopatch.d.ts.map +1 -0
- package/dist/autopatch/verified-autopatch.js +503 -0
- package/dist/autopatch/verified-autopatch.js.map +1 -0
- package/dist/bundles/guardrail-core.js +25799 -0
- package/dist/bundles/guardrail-security.js +208687 -0
- package/dist/bundles/guardrail-ship.js +2318 -0
- package/dist/bundles/index.js +8 -0
- package/dist/commands/autopilot-decision.d.ts +24 -0
- package/dist/commands/autopilot-decision.d.ts.map +1 -0
- package/dist/commands/autopilot-decision.js +304 -0
- package/dist/commands/autopilot-decision.js.map +1 -0
- package/dist/commands/autopilot.d.ts +33 -0
- package/dist/commands/autopilot.d.ts.map +1 -0
- package/dist/commands/autopilot.js +1539 -0
- package/dist/commands/autopilot.js.map +1 -0
- package/dist/commands/baseline.d.ts +7 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +79 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/cache.d.ts +13 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +165 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/checkpoint.d.ts +8 -0
- package/dist/commands/checkpoint.d.ts.map +1 -0
- package/dist/commands/checkpoint.js +35 -0
- package/dist/commands/checkpoint.js.map +1 -0
- package/dist/commands/context.d.ts +8 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +340 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/debug.d.ts +78 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +381 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/doctor.d.ts +17 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +226 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/evidence.d.ts +45 -0
- package/dist/commands/evidence.d.ts.map +1 -0
- package/dist/commands/evidence.js +197 -0
- package/dist/commands/evidence.js.map +1 -0
- package/dist/commands/explain.d.ts +8 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +52 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/fix-consolidated.d.ts +19 -0
- package/dist/commands/fix-consolidated.d.ts.map +1 -0
- package/dist/commands/fix-consolidated.js +165 -0
- package/dist/commands/fix-consolidated.js.map +1 -0
- package/dist/commands/index.d.ts +8 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +15 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +125 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/launcher.d.ts +10 -0
- package/dist/commands/launcher.d.ts.map +1 -0
- package/dist/commands/launcher.js +174 -0
- package/dist/commands/launcher.js.map +1 -0
- package/dist/commands/on.d.ts +8 -0
- package/dist/commands/on.d.ts.map +1 -0
- package/dist/commands/on.js +123 -0
- package/dist/commands/on.js.map +1 -0
- package/dist/commands/preview.d.ts +54 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +352 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/quality/check.d.ts +31 -0
- package/dist/commands/quality/check.d.ts.map +1 -0
- package/dist/commands/quality/check.js +242 -0
- package/dist/commands/quality/check.js.map +1 -0
- package/dist/commands/quality/index.d.ts +8 -0
- package/dist/commands/quality/index.d.ts.map +1 -0
- package/dist/commands/quality/index.js +14 -0
- package/dist/commands/quality/index.js.map +1 -0
- package/dist/commands/quality/setup-quality.d.ts +23 -0
- package/dist/commands/quality/setup-quality.d.ts.map +1 -0
- package/dist/commands/quality/setup-quality.js +452 -0
- package/dist/commands/quality/setup-quality.js.map +1 -0
- package/dist/commands/quality/tidy.d.ts +41 -0
- package/dist/commands/quality/tidy.d.ts.map +1 -0
- package/dist/commands/quality/tidy.js +466 -0
- package/dist/commands/quality/tidy.js.map +1 -0
- package/dist/commands/quality/utils.d.ts +73 -0
- package/dist/commands/quality/utils.d.ts.map +1 -0
- package/dist/commands/quality/utils.js +158 -0
- package/dist/commands/quality/utils.js.map +1 -0
- package/dist/commands/replay.d.ts +8 -0
- package/dist/commands/replay.d.ts.map +1 -0
- package/dist/commands/replay.js +52 -0
- package/dist/commands/replay.js.map +1 -0
- package/dist/commands/scan-consolidated.d.ts +61 -0
- package/dist/commands/scan-consolidated.d.ts.map +1 -0
- package/dist/commands/scan-consolidated.js +243 -0
- package/dist/commands/scan-consolidated.js.map +1 -0
- package/dist/commands/scan-secrets.d.ts +47 -0
- package/dist/commands/scan-secrets.d.ts.map +1 -0
- package/dist/commands/scan-secrets.js +225 -0
- package/dist/commands/scan-secrets.js.map +1 -0
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts +41 -0
- package/dist/commands/scan-vulnerabilities-enhanced.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities-enhanced.js +368 -0
- package/dist/commands/scan-vulnerabilities-enhanced.js.map +1 -0
- package/dist/commands/scan-vulnerabilities-osv.d.ts +58 -0
- package/dist/commands/scan-vulnerabilities-osv.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities-osv.js +716 -0
- package/dist/commands/scan-vulnerabilities-osv.js.map +1 -0
- package/dist/commands/scan-vulnerabilities.d.ts +32 -0
- package/dist/commands/scan-vulnerabilities.d.ts.map +1 -0
- package/dist/commands/scan-vulnerabilities.js +283 -0
- package/dist/commands/scan-vulnerabilities.js.map +1 -0
- package/dist/commands/secrets-allowlist.d.ts +7 -0
- package/dist/commands/secrets-allowlist.d.ts.map +1 -0
- package/dist/commands/secrets-allowlist.js +85 -0
- package/dist/commands/secrets-allowlist.js.map +1 -0
- package/dist/commands/ship-consolidated.d.ts +58 -0
- package/dist/commands/ship-consolidated.d.ts.map +1 -0
- package/dist/commands/ship-consolidated.js +515 -0
- package/dist/commands/ship-consolidated.js.map +1 -0
- package/dist/commands/stats.d.ts +8 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +134 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/upgrade.d.ts +8 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +30 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/fix/analytics.d.ts +121 -0
- package/dist/fix/analytics.d.ts.map +1 -0
- package/dist/fix/analytics.js +289 -0
- package/dist/fix/analytics.js.map +1 -0
- package/dist/fix/applicator.d.ts +44 -0
- package/dist/fix/applicator.d.ts.map +1 -0
- package/dist/fix/applicator.js +144 -0
- package/dist/fix/applicator.js.map +1 -0
- package/dist/fix/audit.d.ts +61 -0
- package/dist/fix/audit.d.ts.map +1 -0
- package/dist/fix/audit.js +149 -0
- package/dist/fix/audit.js.map +1 -0
- package/dist/fix/backup.d.ts +38 -0
- package/dist/fix/backup.d.ts.map +1 -0
- package/dist/fix/backup.js +154 -0
- package/dist/fix/backup.js.map +1 -0
- package/dist/fix/config.d.ts +78 -0
- package/dist/fix/config.d.ts.map +1 -0
- package/dist/fix/config.js +200 -0
- package/dist/fix/config.js.map +1 -0
- package/dist/fix/engine.d.ts +55 -0
- package/dist/fix/engine.d.ts.map +1 -0
- package/dist/fix/engine.js +285 -0
- package/dist/fix/engine.js.map +1 -0
- package/dist/fix/impact.d.ts +74 -0
- package/dist/fix/impact.d.ts.map +1 -0
- package/dist/fix/impact.js +281 -0
- package/dist/fix/impact.js.map +1 -0
- package/dist/fix/index.d.ts +5 -0
- package/dist/fix/index.d.ts.map +1 -0
- package/dist/fix/index.js +12 -0
- package/dist/fix/index.js.map +1 -0
- package/dist/fix/interactive.d.ts +22 -0
- package/dist/fix/interactive.d.ts.map +1 -0
- package/dist/fix/interactive.js +172 -0
- package/dist/fix/interactive.js.map +1 -0
- package/dist/fix/learning.d.ts +109 -0
- package/dist/fix/learning.d.ts.map +1 -0
- package/dist/fix/learning.js +296 -0
- package/dist/fix/learning.js.map +1 -0
- package/dist/fix/metrics.d.ts +106 -0
- package/dist/fix/metrics.d.ts.map +1 -0
- package/dist/fix/metrics.js +138 -0
- package/dist/fix/metrics.js.map +1 -0
- package/dist/fix/parallel.d.ts +69 -0
- package/dist/fix/parallel.d.ts.map +1 -0
- package/dist/fix/parallel.js +203 -0
- package/dist/fix/parallel.js.map +1 -0
- package/dist/fix/report.d.ts +40 -0
- package/dist/fix/report.d.ts.map +1 -0
- package/dist/fix/report.js +212 -0
- package/dist/fix/report.js.map +1 -0
- package/dist/fix/strategy.d.ts +53 -0
- package/dist/fix/strategy.d.ts.map +1 -0
- package/dist/fix/strategy.js +143 -0
- package/dist/fix/strategy.js.map +1 -0
- package/dist/fix/templates.d.ts +58 -0
- package/dist/fix/templates.d.ts.map +1 -0
- package/dist/fix/templates.js +259 -0
- package/dist/fix/templates.js.map +1 -0
- package/dist/fix/testing.d.ts +68 -0
- package/dist/fix/testing.d.ts.map +1 -0
- package/dist/fix/testing.js +245 -0
- package/dist/fix/testing.js.map +1 -0
- package/dist/fix/validation.d.ts +71 -0
- package/dist/fix/validation.d.ts.map +1 -0
- package/dist/fix/validation.js +267 -0
- package/dist/fix/validation.js.map +1 -0
- package/dist/fix/visualization.d.ts +73 -0
- package/dist/fix/visualization.d.ts.map +1 -0
- package/dist/fix/visualization.js +243 -0
- package/dist/fix/visualization.js.map +1 -0
- package/dist/formatters/index.d.ts +6 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +11 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/sarif-enhanced.d.ts +78 -0
- package/dist/formatters/sarif-enhanced.d.ts.map +1 -0
- package/dist/formatters/sarif-enhanced.js +144 -0
- package/dist/formatters/sarif-enhanced.js.map +1 -0
- package/dist/formatters/sarif-v2.d.ts +121 -0
- package/dist/formatters/sarif-v2.d.ts.map +1 -0
- package/dist/formatters/sarif-v2.js +356 -0
- package/dist/formatters/sarif-v2.js.map +1 -0
- package/dist/formatters/sarif.d.ts +72 -0
- package/dist/formatters/sarif.d.ts.map +1 -0
- package/dist/formatters/sarif.js +146 -0
- package/dist/formatters/sarif.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4455 -0
- package/dist/index.js.map +1 -0
- package/dist/init/ci-generator.d.ts +18 -0
- package/dist/init/ci-generator.d.ts.map +1 -0
- package/dist/init/ci-generator.js +317 -0
- package/dist/init/ci-generator.js.map +1 -0
- package/dist/init/detect-framework.d.ts +15 -0
- package/dist/init/detect-framework.d.ts.map +1 -0
- package/dist/init/detect-framework.js +301 -0
- package/dist/init/detect-framework.js.map +1 -0
- package/dist/init/hooks-installer.d.ts +22 -0
- package/dist/init/hooks-installer.d.ts.map +1 -0
- package/dist/init/hooks-installer.js +310 -0
- package/dist/init/hooks-installer.js.map +1 -0
- package/dist/init/index.d.ts +8 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/init/index.js +22 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/templates.d.ts +401 -0
- package/dist/init/templates.d.ts.map +1 -0
- package/dist/init/templates.js +240 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/mcp/server.d.ts +12 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +42 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/telemetry.d.ts +40 -0
- package/dist/mcp/telemetry.d.ts.map +1 -0
- package/dist/mcp/telemetry.js +98 -0
- package/dist/mcp/telemetry.js.map +1 -0
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts +32 -0
- package/dist/reality/no-dead-buttons/button-sweep-generator.d.ts.map +1 -0
- package/dist/reality/no-dead-buttons/button-sweep-generator.js +236 -0
- package/dist/reality/no-dead-buttons/button-sweep-generator.js.map +1 -0
- package/dist/reality/no-dead-buttons/index.d.ts +11 -0
- package/dist/reality/no-dead-buttons/index.d.ts.map +1 -0
- package/dist/reality/no-dead-buttons/index.js +18 -0
- package/dist/reality/no-dead-buttons/index.js.map +1 -0
- package/dist/reality/no-dead-buttons/static-scanner.d.ts +34 -0
- package/dist/reality/no-dead-buttons/static-scanner.d.ts.map +1 -0
- package/dist/reality/no-dead-buttons/static-scanner.js +230 -0
- package/dist/reality/no-dead-buttons/static-scanner.js.map +1 -0
- package/dist/reality/reality-graph.d.ts +192 -0
- package/dist/reality/reality-graph.d.ts.map +1 -0
- package/dist/reality/reality-graph.js +600 -0
- package/dist/reality/reality-graph.js.map +1 -0
- package/dist/reality/reality-runner.d.ts +89 -0
- package/dist/reality/reality-runner.d.ts.map +1 -0
- package/dist/reality/reality-runner.js +540 -0
- package/dist/reality/reality-runner.js.map +1 -0
- package/dist/reality/receipt-generator.d.ts +152 -0
- package/dist/reality/receipt-generator.d.ts.map +1 -0
- package/dist/reality/receipt-generator.js +495 -0
- package/dist/reality/receipt-generator.js.map +1 -0
- package/dist/reality/runtime-tracer.d.ts +75 -0
- package/dist/reality/runtime-tracer.d.ts.map +1 -0
- package/dist/reality/runtime-tracer.js +109 -0
- package/dist/reality/runtime-tracer.js.map +1 -0
- package/dist/runtime/auth-utils.d.ts +43 -0
- package/dist/runtime/auth-utils.d.ts.map +1 -0
- package/dist/runtime/auth-utils.js +130 -0
- package/dist/runtime/auth-utils.js.map +1 -0
- package/dist/runtime/cli-errors.d.ts +38 -0
- package/dist/runtime/cli-errors.d.ts.map +1 -0
- package/dist/runtime/cli-errors.js +354 -0
- package/dist/runtime/cli-errors.js.map +1 -0
- package/dist/runtime/client.d.ts +74 -0
- package/dist/runtime/client.d.ts.map +1 -0
- package/dist/runtime/client.js +222 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/creds.d.ts +48 -0
- package/dist/runtime/creds.d.ts.map +1 -0
- package/dist/runtime/creds.js +245 -0
- package/dist/runtime/creds.js.map +1 -0
- package/dist/runtime/exit-codes.d.ts +49 -0
- package/dist/runtime/exit-codes.d.ts.map +1 -0
- package/dist/runtime/exit-codes.js +93 -0
- package/dist/runtime/exit-codes.js.map +1 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +25 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/json-output.d.ts +42 -0
- package/dist/runtime/json-output.d.ts.map +1 -0
- package/dist/runtime/json-output.js +59 -0
- package/dist/runtime/json-output.js.map +1 -0
- package/dist/runtime/owner-mode.d.ts +48 -0
- package/dist/runtime/owner-mode.d.ts.map +1 -0
- package/dist/runtime/owner-mode.js +284 -0
- package/dist/runtime/owner-mode.js.map +1 -0
- package/dist/runtime/semver.d.ts +37 -0
- package/dist/runtime/semver.d.ts.map +1 -0
- package/dist/runtime/semver.js +110 -0
- package/dist/runtime/semver.js.map +1 -0
- package/dist/scan/dead-ui-detector.d.ts +48 -0
- package/dist/scan/dead-ui-detector.d.ts.map +1 -0
- package/dist/scan/dead-ui-detector.js +170 -0
- package/dist/scan/dead-ui-detector.js.map +1 -0
- package/dist/scan/playwright-sweep.d.ts +40 -0
- package/dist/scan/playwright-sweep.d.ts.map +1 -0
- package/dist/scan/playwright-sweep.js +216 -0
- package/dist/scan/playwright-sweep.js.map +1 -0
- package/dist/scan/proof-bundle.d.ts +25 -0
- package/dist/scan/proof-bundle.d.ts.map +1 -0
- package/dist/scan/proof-bundle.js +203 -0
- package/dist/scan/proof-bundle.js.map +1 -0
- package/dist/scan/proof-graph.d.ts +59 -0
- package/dist/scan/proof-graph.d.ts.map +1 -0
- package/dist/scan/proof-graph.js +64 -0
- package/dist/scan/proof-graph.js.map +1 -0
- package/dist/scan/reality-sniff.d.ts +56 -0
- package/dist/scan/reality-sniff.d.ts.map +1 -0
- package/dist/scan/reality-sniff.js +200 -0
- package/dist/scan/reality-sniff.js.map +1 -0
- package/dist/scan/structural-verifier.d.ts +20 -0
- package/dist/scan/structural-verifier.d.ts.map +1 -0
- package/dist/scan/structural-verifier.js +112 -0
- package/dist/scan/structural-verifier.js.map +1 -0
- package/dist/scan/verification-engine.d.ts +47 -0
- package/dist/scan/verification-engine.d.ts.map +1 -0
- package/dist/scan/verification-engine.js +141 -0
- package/dist/scan/verification-engine.js.map +1 -0
- package/dist/scanner/baseline.d.ts +52 -0
- package/dist/scanner/baseline.d.ts.map +1 -0
- package/dist/scanner/baseline.js +85 -0
- package/dist/scanner/baseline.js.map +1 -0
- package/dist/scanner/incremental.d.ts +30 -0
- package/dist/scanner/incremental.d.ts.map +1 -0
- package/dist/scanner/incremental.js +82 -0
- package/dist/scanner/incremental.js.map +1 -0
- package/dist/scanner/index.d.ts +8 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +15 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/parallel.d.ts +43 -0
- package/dist/scanner/parallel.d.ts.map +1 -0
- package/dist/scanner/parallel.js +99 -0
- package/dist/scanner/parallel.js.map +1 -0
- package/dist/scanner/placeholder-detector.d.ts +56 -0
- package/dist/scanner/placeholder-detector.d.ts.map +1 -0
- package/dist/scanner/placeholder-detector.js +220 -0
- package/dist/scanner/placeholder-detector.js.map +1 -0
- package/dist/scanner/route-detector.d.ts +100 -0
- package/dist/scanner/route-detector.d.ts.map +1 -0
- package/dist/scanner/route-detector.js +455 -0
- package/dist/scanner/route-detector.js.map +1 -0
- package/dist/scanner/scoring.d.ts +67 -0
- package/dist/scanner/scoring.d.ts.map +1 -0
- package/dist/scanner/scoring.js +284 -0
- package/dist/scanner/scoring.js.map +1 -0
- package/dist/ship-baseline.d.ts +56 -0
- package/dist/ship-baseline.d.ts.map +1 -0
- package/dist/ship-baseline.js +194 -0
- package/dist/ship-baseline.js.map +1 -0
- package/dist/ship-config.d.ts +91 -0
- package/dist/ship-config.d.ts.map +1 -0
- package/dist/ship-config.js +133 -0
- package/dist/ship-config.js.map +1 -0
- package/dist/ship-data-loader.d.ts +70 -0
- package/dist/ship-data-loader.d.ts.map +1 -0
- package/dist/ship-data-loader.js +301 -0
- package/dist/ship-data-loader.js.map +1 -0
- package/dist/standalone.d.ts +1 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +1 -0
- package/dist/standalone.js.map +1 -0
- package/dist/truth-pack/index.d.ts +102 -0
- package/dist/truth-pack/index.d.ts.map +1 -0
- package/dist/truth-pack/index.js +694 -0
- package/dist/truth-pack/index.js.map +1 -0
- package/dist/ui/frame.d.ts +68 -0
- package/dist/ui/frame.d.ts.map +1 -0
- package/dist/ui/frame.js +165 -0
- package/dist/ui/frame.js.map +1 -0
- package/dist/ui/index.d.ts +5 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +16 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui.d.ts +36 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +45 -0
- package/dist/ui.js.map +1 -0
- package/dist/utils/ai-helpers.d.ts +72 -0
- package/dist/utils/ai-helpers.d.ts.map +1 -0
- package/dist/utils/ai-helpers.js +339 -0
- package/dist/utils/ai-helpers.js.map +1 -0
- package/dist/utils/validation.d.ts +34 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +160 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Server for Context Mode
|
|
4
|
+
*
|
|
5
|
+
* Starts MCP server that AI tools can connect to
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.startMCPServer = startMCPServer;
|
|
9
|
+
exports.stopMCPServer = stopMCPServer;
|
|
10
|
+
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
11
|
+
let mcpServer = null;
|
|
12
|
+
async function startMCPServer(projectPath, options = {}) {
|
|
13
|
+
// For now, we'll use stdio transport (standard MCP)
|
|
14
|
+
// The actual MCP server is in mcp-server/index.js
|
|
15
|
+
// This function just ensures it's available
|
|
16
|
+
// Check if MCP server module exists
|
|
17
|
+
try {
|
|
18
|
+
// The MCP server runs as a separate process
|
|
19
|
+
// We just need to indicate it's ready
|
|
20
|
+
mcpServer = new index_js_1.Server({
|
|
21
|
+
name: 'guardrail-mcp',
|
|
22
|
+
version: '2.0.0',
|
|
23
|
+
}, {
|
|
24
|
+
capabilities: {
|
|
25
|
+
tools: {},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
// Register tools from the reorganized groups
|
|
29
|
+
// This will be handled by the main MCP server file
|
|
30
|
+
console.log(' MCP server ready for connections');
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw new Error(`Failed to start MCP server: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function stopMCPServer() {
|
|
37
|
+
if (mcpServer) {
|
|
38
|
+
// Cleanup
|
|
39
|
+
mcpServer = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAYH,wCAwBC;AAED,sCAKC;AAzCD,wEAAmE;AAQnE,IAAI,SAAS,GAAkB,IAAI,CAAC;AAE7B,KAAK,UAAU,cAAc,CAAC,WAAmB,EAAE,UAA4B,EAAE;IACtF,oDAAoD;IACpD,kDAAkD;IAClD,4CAA4C;IAE5C,oCAAoC;IACpC,IAAI,CAAC;QACH,4CAA4C;QAC5C,sCAAsC;QACtC,SAAS,GAAG,IAAI,iBAAM,CAAC;YACrB,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,OAAO;SACjB,EAAE;YACD,YAAY,EAAE;gBACZ,KAAK,EAAE,EAAE;aACV;SACF,CAAC,CAAC;QAEH,6CAA6C;QAC7C,mDAAmD;QACnD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED,SAAgB,aAAa;IAC3B,IAAI,SAAS,EAAE,CAAC;QACd,UAAU;QACV,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Telemetry Logger
|
|
3
|
+
*
|
|
4
|
+
* Logs every tool call:
|
|
5
|
+
* - tool name
|
|
6
|
+
* - latency
|
|
7
|
+
* - blocked hallucination yes/no
|
|
8
|
+
* - what it prevented (symbol/route/version/boundary)
|
|
9
|
+
* - minimal anonymized metadata (no code)
|
|
10
|
+
*/
|
|
11
|
+
export interface TelemetryEntry {
|
|
12
|
+
timestamp: string;
|
|
13
|
+
tool: string;
|
|
14
|
+
latency: number;
|
|
15
|
+
blockedHallucination: boolean;
|
|
16
|
+
prevented?: {
|
|
17
|
+
type: 'symbol' | 'route' | 'version' | 'boundary';
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
metadata?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
export declare class TelemetryLogger {
|
|
23
|
+
private projectPath;
|
|
24
|
+
private telemetryFile;
|
|
25
|
+
constructor(projectPath: string);
|
|
26
|
+
/**
|
|
27
|
+
* Log tool call
|
|
28
|
+
*/
|
|
29
|
+
logToolCall(entry: TelemetryEntry): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Get stats for last N hours
|
|
32
|
+
*/
|
|
33
|
+
getStats(hours?: number): {
|
|
34
|
+
totalCalls: number;
|
|
35
|
+
hallucinationsBlocked: number;
|
|
36
|
+
symbolsVerified: number;
|
|
37
|
+
averageLatency: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/mcp/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE;QACV,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;QAClD,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAAS;gBAElB,WAAW,EAAE,MAAM;IAK/B;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CvD;;OAEG;IACH,QAAQ,CAAC,KAAK,GAAE,MAAW,GAAG;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;KACxB;CAsCF"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Telemetry Logger
|
|
4
|
+
*
|
|
5
|
+
* Logs every tool call:
|
|
6
|
+
* - tool name
|
|
7
|
+
* - latency
|
|
8
|
+
* - blocked hallucination yes/no
|
|
9
|
+
* - what it prevented (symbol/route/version/boundary)
|
|
10
|
+
* - minimal anonymized metadata (no code)
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TelemetryLogger = void 0;
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
class TelemetryLogger {
|
|
17
|
+
constructor(projectPath) {
|
|
18
|
+
this.projectPath = projectPath;
|
|
19
|
+
this.telemetryFile = (0, path_1.join)(projectPath, '.guardrail', 'telemetry.json');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Log tool call
|
|
23
|
+
*/
|
|
24
|
+
async logToolCall(entry) {
|
|
25
|
+
// Ensure directory exists
|
|
26
|
+
const telemetryDir = (0, path_1.join)(this.projectPath, '.guardrail');
|
|
27
|
+
if (!(0, fs_1.existsSync)(telemetryDir)) {
|
|
28
|
+
(0, fs_1.mkdirSync)(telemetryDir, { recursive: true });
|
|
29
|
+
}
|
|
30
|
+
// Load existing telemetry
|
|
31
|
+
let telemetry = {
|
|
32
|
+
toolCalls: [],
|
|
33
|
+
hallucinationsBlocked: 0,
|
|
34
|
+
symbolsVerified: 0,
|
|
35
|
+
};
|
|
36
|
+
if ((0, fs_1.existsSync)(this.telemetryFile)) {
|
|
37
|
+
try {
|
|
38
|
+
telemetry = JSON.parse((0, fs_1.readFileSync)(this.telemetryFile, 'utf-8'));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Reset on error
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Add new entry
|
|
45
|
+
telemetry.toolCalls.push(entry);
|
|
46
|
+
// Update counters
|
|
47
|
+
if (entry.blockedHallucination) {
|
|
48
|
+
telemetry.hallucinationsBlocked = (telemetry.hallucinationsBlocked || 0) + 1;
|
|
49
|
+
}
|
|
50
|
+
if (entry.prevented?.type === 'symbol') {
|
|
51
|
+
telemetry.symbolsVerified = (telemetry.symbolsVerified || 0) + 1;
|
|
52
|
+
}
|
|
53
|
+
// Keep only last 1000 entries
|
|
54
|
+
if (telemetry.toolCalls.length > 1000) {
|
|
55
|
+
telemetry.toolCalls = telemetry.toolCalls.slice(-1000);
|
|
56
|
+
}
|
|
57
|
+
// Write back
|
|
58
|
+
(0, fs_1.writeFileSync)(this.telemetryFile, JSON.stringify(telemetry, null, 2));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get stats for last N hours
|
|
62
|
+
*/
|
|
63
|
+
getStats(hours = 24) {
|
|
64
|
+
if (!(0, fs_1.existsSync)(this.telemetryFile)) {
|
|
65
|
+
return {
|
|
66
|
+
totalCalls: 0,
|
|
67
|
+
hallucinationsBlocked: 0,
|
|
68
|
+
symbolsVerified: 0,
|
|
69
|
+
averageLatency: 0,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const telemetry = JSON.parse((0, fs_1.readFileSync)(this.telemetryFile, 'utf-8'));
|
|
74
|
+
const cutoff = Date.now() - hours * 60 * 60 * 1000;
|
|
75
|
+
const recentCalls = telemetry.toolCalls.filter((call) => new Date(call.timestamp).getTime() > cutoff);
|
|
76
|
+
const latencies = recentCalls.map((c) => c.latency || 0).filter((l) => l > 0);
|
|
77
|
+
const averageLatency = latencies.length > 0
|
|
78
|
+
? latencies.reduce((a, b) => a + b, 0) / latencies.length
|
|
79
|
+
: 0;
|
|
80
|
+
return {
|
|
81
|
+
totalCalls: recentCalls.length,
|
|
82
|
+
hallucinationsBlocked: recentCalls.filter((c) => c.blockedHallucination).length,
|
|
83
|
+
symbolsVerified: recentCalls.filter((c) => c.prevented?.type === 'symbol').length,
|
|
84
|
+
averageLatency,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return {
|
|
89
|
+
totalCalls: 0,
|
|
90
|
+
hallucinationsBlocked: 0,
|
|
91
|
+
symbolsVerified: 0,
|
|
92
|
+
averageLatency: 0,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.TelemetryLogger = TelemetryLogger;
|
|
98
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/mcp/telemetry.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button Sweep Test Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates Playwright test that:
|
|
5
|
+
* - Logs in (test user)
|
|
6
|
+
* - Navigates all major pages
|
|
7
|
+
* - Clicks every visible button (or every element with data-action-id)
|
|
8
|
+
* - Fails if:
|
|
9
|
+
* - Any console error occurs
|
|
10
|
+
* - Any network request returns 4xx/5xx (except explicitly allowed)
|
|
11
|
+
* - Any click produces no state change when expected
|
|
12
|
+
* - Any toast says "success" but request failed
|
|
13
|
+
*/
|
|
14
|
+
export interface ButtonSweepConfig {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
auth?: {
|
|
17
|
+
email: string;
|
|
18
|
+
password: string;
|
|
19
|
+
};
|
|
20
|
+
pages?: string[];
|
|
21
|
+
allowedStatusCodes?: number[];
|
|
22
|
+
requireDataActionId?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate Playwright test for button sweep
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateButtonSweepTest(config: ButtonSweepConfig): string;
|
|
28
|
+
/**
|
|
29
|
+
* Generate simplified button sweep (for CI/CD)
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateCIButtonSweepTest(config: ButtonSweepConfig): string;
|
|
32
|
+
//# sourceMappingURL=button-sweep-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-sweep-generator.d.ts","sourceRoot":"","sources":["../../../src/reality/no-dead-buttons/button-sweep-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAsNzE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAK3E"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Button Sweep Test Generator
|
|
4
|
+
*
|
|
5
|
+
* Generates Playwright test that:
|
|
6
|
+
* - Logs in (test user)
|
|
7
|
+
* - Navigates all major pages
|
|
8
|
+
* - Clicks every visible button (or every element with data-action-id)
|
|
9
|
+
* - Fails if:
|
|
10
|
+
* - Any console error occurs
|
|
11
|
+
* - Any network request returns 4xx/5xx (except explicitly allowed)
|
|
12
|
+
* - Any click produces no state change when expected
|
|
13
|
+
* - Any toast says "success" but request failed
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.generateButtonSweepTest = generateButtonSweepTest;
|
|
17
|
+
exports.generateCIButtonSweepTest = generateCIButtonSweepTest;
|
|
18
|
+
/**
|
|
19
|
+
* Generate Playwright test for button sweep
|
|
20
|
+
*/
|
|
21
|
+
function generateButtonSweepTest(config) {
|
|
22
|
+
const { baseUrl, auth, pages = ['/', '/dashboard', '/settings', '/billing'], allowedStatusCodes = [200, 201, 204], requireDataActionId = false, } = config;
|
|
23
|
+
return `import { test, expect } from '@playwright/test';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Button Sweep Test
|
|
27
|
+
*
|
|
28
|
+
* This test clicks every button on the application and ensures:
|
|
29
|
+
* - No console errors occur
|
|
30
|
+
* - No 4xx/5xx network errors (except allowed)
|
|
31
|
+
* - Buttons produce expected state changes
|
|
32
|
+
* - Success toasts match successful requests
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
test.describe('Button Sweep - No Dead Buttons', () => {
|
|
36
|
+
let pageErrors: string[] = [];
|
|
37
|
+
let networkErrors: Array<{ url: string; status: number; method: string }> = [];
|
|
38
|
+
let clickedButtons: Array<{ actionId: string; url: string; success: boolean }> = [];
|
|
39
|
+
|
|
40
|
+
test.beforeEach(async ({ page }) => {
|
|
41
|
+
pageErrors = [];
|
|
42
|
+
networkErrors = [];
|
|
43
|
+
clickedButtons = [];
|
|
44
|
+
|
|
45
|
+
// Capture console errors
|
|
46
|
+
page.on('console', (msg) => {
|
|
47
|
+
if (msg.type() === 'error') {
|
|
48
|
+
const text = msg.text();
|
|
49
|
+
// Ignore known benign errors
|
|
50
|
+
if (!text.includes('favicon') && !text.includes('ResizeObserver')) {
|
|
51
|
+
pageErrors.push(text);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Capture network errors
|
|
57
|
+
page.on('response', (response) => {
|
|
58
|
+
const status = response.status();
|
|
59
|
+
const url = response.url();
|
|
60
|
+
const method = response.request().method();
|
|
61
|
+
|
|
62
|
+
// Track failed requests
|
|
63
|
+
if (status >= 400 && !allowedStatusCodes.includes(status)) {
|
|
64
|
+
// Ignore preflight OPTIONS requests
|
|
65
|
+
if (method !== 'OPTIONS') {
|
|
66
|
+
networkErrors.push({ url, status, method });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('should log in and authenticate', async ({ page }) => {
|
|
73
|
+
await page.goto(\`\${baseUrl}/login\`);
|
|
74
|
+
|
|
75
|
+
${auth
|
|
76
|
+
? `
|
|
77
|
+
// Fill login form
|
|
78
|
+
await page.fill('[data-testid="email-input"], input[type="email"]', '${auth.email}');
|
|
79
|
+
await page.fill('[data-testid="password-input"], input[type="password"]', '${auth.password}');
|
|
80
|
+
|
|
81
|
+
// Submit login
|
|
82
|
+
await page.click('[data-testid="login-button"], button[type="submit"]');
|
|
83
|
+
|
|
84
|
+
// Wait for navigation after login
|
|
85
|
+
await page.waitForURL(/\/(dashboard|home)/, { timeout: 10000 });
|
|
86
|
+
|
|
87
|
+
// Verify logged in (check for user menu, logout button, etc.)
|
|
88
|
+
await expect(page.locator('[data-testid="user-menu"], [data-testid="logout"]')).toBeVisible({ timeout: 5000 });
|
|
89
|
+
`
|
|
90
|
+
: `
|
|
91
|
+
// Skip authentication if no credentials provided
|
|
92
|
+
// Note: You may need to handle authentication differently
|
|
93
|
+
await page.waitForTimeout(1000);
|
|
94
|
+
`}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
${pages
|
|
98
|
+
.map((pagePath, index) => `
|
|
99
|
+
test('should sweep buttons on ${pagePath}', async ({ page }) => {
|
|
100
|
+
${index === 0 && auth
|
|
101
|
+
? `
|
|
102
|
+
// Login first
|
|
103
|
+
await page.goto(\`\${baseUrl}/login\`);
|
|
104
|
+
await page.fill('[data-testid="email-input"], input[type="email"]', '${auth.email}');
|
|
105
|
+
await page.fill('[data-testid="password-input"], input[type="password"]', '${auth.password}');
|
|
106
|
+
await page.click('[data-testid="login-button"], button[type="submit"]');
|
|
107
|
+
await page.waitForURL(/\/(dashboard|home)/, { timeout: 10000 });
|
|
108
|
+
`
|
|
109
|
+
: ''}
|
|
110
|
+
|
|
111
|
+
// Navigate to page
|
|
112
|
+
await page.goto(\`\${baseUrl}${pagePath}\`);
|
|
113
|
+
await page.waitForLoadState('networkidle');
|
|
114
|
+
|
|
115
|
+
// Find all buttons
|
|
116
|
+
const buttonSelector = ${requireDataActionId
|
|
117
|
+
? `'[data-action-id]'`
|
|
118
|
+
: `'button:visible, a[role="button"]:visible, [role="button"]:visible'`};
|
|
119
|
+
const buttons = await page.locator(buttonSelector).all();
|
|
120
|
+
|
|
121
|
+
test.info().annotations.push({
|
|
122
|
+
type: 'info',
|
|
123
|
+
description: \`Found \${buttons.length} buttons on ${pagePath}\`,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Click each button (with timeout to avoid hanging)
|
|
127
|
+
for (const button of buttons) {
|
|
128
|
+
try {
|
|
129
|
+
const actionId = await button.getAttribute('data-action-id') || 'unknown';
|
|
130
|
+
const buttonText = await button.textContent() || '';
|
|
131
|
+
const currentUrl = page.url();
|
|
132
|
+
|
|
133
|
+
// Skip disabled buttons
|
|
134
|
+
const isDisabled = await button.isDisabled().catch(() => false);
|
|
135
|
+
if (isDisabled) {
|
|
136
|
+
test.info().annotations.push({
|
|
137
|
+
type: 'skip',
|
|
138
|
+
description: \`Skipped disabled button: \${buttonText.substring(0, 50)}\`,
|
|
139
|
+
});
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Skip buttons that are not visible
|
|
144
|
+
const isVisible = await button.isVisible().catch(() => false);
|
|
145
|
+
if (!isVisible) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Scroll button into view
|
|
150
|
+
await button.scrollIntoViewIfNeeded();
|
|
151
|
+
await page.waitForTimeout(100); // Small delay for animations
|
|
152
|
+
|
|
153
|
+
// Capture state before click
|
|
154
|
+
const stateBefore = {
|
|
155
|
+
url: page.url(),
|
|
156
|
+
errorCount: pageErrors.length,
|
|
157
|
+
networkErrorCount: networkErrors.length,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Click button (with timeout)
|
|
161
|
+
await Promise.race([
|
|
162
|
+
button.click({ timeout: 5000 }),
|
|
163
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Button click timeout')), 5000)),
|
|
164
|
+
]).catch((err) => {
|
|
165
|
+
// Button click failed - log but continue
|
|
166
|
+
test.info().annotations.push({
|
|
167
|
+
type: 'warning',
|
|
168
|
+
description: \`Button click failed: \${buttonText.substring(0, 50)} - \${err.message}\`,
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Wait a bit for state changes
|
|
173
|
+
await page.waitForTimeout(500);
|
|
174
|
+
|
|
175
|
+
// Check for state change (URL change or DOM change)
|
|
176
|
+
const stateAfter = {
|
|
177
|
+
url: page.url(),
|
|
178
|
+
errorCount: pageErrors.length,
|
|
179
|
+
networkErrorCount: networkErrors.length,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const hadStateChange = stateBefore.url !== stateAfter.url;
|
|
183
|
+
const hadError = stateAfter.errorCount > stateBefore.errorCount ||
|
|
184
|
+
stateAfter.networkErrorCount > stateBefore.networkErrorCount;
|
|
185
|
+
|
|
186
|
+
clickedButtons.push({
|
|
187
|
+
actionId,
|
|
188
|
+
url: currentUrl,
|
|
189
|
+
success: !hadError,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
} catch (error) {
|
|
193
|
+
// Button interaction failed - log but continue
|
|
194
|
+
test.info().annotations.push({
|
|
195
|
+
type: 'warning',
|
|
196
|
+
description: \`Error interacting with button: \${error instanceof Error ? error.message : String(error)}\`,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Assertions after sweep
|
|
202
|
+
if (pageErrors.length > 0) {
|
|
203
|
+
console.error('Console errors during button sweep:', pageErrors);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (networkErrors.length > 0) {
|
|
207
|
+
console.error('Network errors during button sweep:', networkErrors);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Fail if there were errors
|
|
211
|
+
expect(pageErrors.length, \`Found \${pageErrors.length} console errors. First: \${pageErrors[0]}\`).toBe(0);
|
|
212
|
+
expect(networkErrors.length, \`Found \${networkErrors.length} network errors. First: \${networkErrors[0]?.url} (status: \${networkErrors[0]?.status})\`).toBe(0);
|
|
213
|
+
});
|
|
214
|
+
`)
|
|
215
|
+
.join('\n')}
|
|
216
|
+
|
|
217
|
+
test.afterAll(async () => {
|
|
218
|
+
// Log summary
|
|
219
|
+
console.log(\`\\nButton Sweep Summary:\`);
|
|
220
|
+
console.log(\` Total buttons clicked: \${clickedButtons.length}\`);
|
|
221
|
+
console.log(\` Successful: \${clickedButtons.filter(b => b.success).length}\`);
|
|
222
|
+
console.log(\` Failed: \${clickedButtons.filter(b => !b.success).length}\`);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Generate simplified button sweep (for CI/CD)
|
|
229
|
+
*/
|
|
230
|
+
function generateCIButtonSweepTest(config) {
|
|
231
|
+
return generateButtonSweepTest({
|
|
232
|
+
...config,
|
|
233
|
+
pages: config.pages || ['/', '/dashboard'],
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=button-sweep-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-sweep-generator.js","sourceRoot":"","sources":["../../../src/reality/no-dead-buttons/button-sweep-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAgBH,0DAsNC;AAKD,8DAKC;AAnOD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,MAAyB;IAC/D,MAAM,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,CAAC,EACpD,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpC,mBAAmB,GAAG,KAAK,GAC5B,GAAG,MAAM,CAAC;IAEX,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoDH,IAAI;QACJ,CAAC,CAAC;;2EAEmE,IAAI,CAAC,KAAK;iFACJ,IAAI,CAAC,QAAQ;;;;;;;;;;KAUzF;QACC,CAAC,CAAC;;;;KAIH;;;IAGD,KAAK;SACJ,GAAG,CACF,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;kCACO,QAAQ;MACpC,KAAK,KAAK,CAAC,IAAI,IAAI;QACnB,CAAC,CAAC;;;2EAGmE,IAAI,CAAC,KAAK;iFACJ,IAAI,CAAC,QAAQ;;;KAGzF;QACC,CAAC,CAAC,EAAE;;;mCAGyB,QAAQ;;;;6BAId,mBAAmB;QAC1C,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,qEAAqE;;;;;2DAKlB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FhE,CACE;SACA,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;CAUd,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,MAAyB;IACjE,OAAO,uBAAuB,CAAC;QAC7B,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC;KAC3C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No Dead Buttons System
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive system to prevent dead buttons and silent failures:
|
|
5
|
+
* - Static scanner for dead UI patterns
|
|
6
|
+
* - Button sweep test generator
|
|
7
|
+
* - Integration helpers
|
|
8
|
+
*/
|
|
9
|
+
export { runStaticScan, formatStaticScanResults, type DeadUIPattern, type StaticScanResult, } from './static-scanner';
|
|
10
|
+
export { generateButtonSweepTest, generateCIButtonSweepTest, type ButtonSweepConfig, } from './button-sweep-generator';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reality/no-dead-buttons/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,iBAAiB,GACvB,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* No Dead Buttons System
|
|
4
|
+
*
|
|
5
|
+
* Comprehensive system to prevent dead buttons and silent failures:
|
|
6
|
+
* - Static scanner for dead UI patterns
|
|
7
|
+
* - Button sweep test generator
|
|
8
|
+
* - Integration helpers
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.generateCIButtonSweepTest = exports.generateButtonSweepTest = exports.formatStaticScanResults = exports.runStaticScan = void 0;
|
|
12
|
+
var static_scanner_1 = require("./static-scanner");
|
|
13
|
+
Object.defineProperty(exports, "runStaticScan", { enumerable: true, get: function () { return static_scanner_1.runStaticScan; } });
|
|
14
|
+
Object.defineProperty(exports, "formatStaticScanResults", { enumerable: true, get: function () { return static_scanner_1.formatStaticScanResults; } });
|
|
15
|
+
var button_sweep_generator_1 = require("./button-sweep-generator");
|
|
16
|
+
Object.defineProperty(exports, "generateButtonSweepTest", { enumerable: true, get: function () { return button_sweep_generator_1.generateButtonSweepTest; } });
|
|
17
|
+
Object.defineProperty(exports, "generateCIButtonSweepTest", { enumerable: true, get: function () { return button_sweep_generator_1.generateCIButtonSweepTest; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/reality/no-dead-buttons/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,mDAK0B;AAJxB,+GAAA,aAAa,OAAA;AACb,yHAAA,uBAAuB,OAAA;AAKzB,mEAIkC;AAHhC,iIAAA,uBAAuB,OAAA;AACvB,mIAAA,yBAAyB,OAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static "No Dead UI" Scanner
|
|
3
|
+
*
|
|
4
|
+
* Fast static scan (<1s) that blocks obvious deadness before running e2e tests:
|
|
5
|
+
* - TODO, stub, placeholder, "coming soon" text
|
|
6
|
+
* - <button disabled> without a real reason
|
|
7
|
+
* - href="#", onClick={() => {}}, return true handlers
|
|
8
|
+
* - UI gating without server-side gating
|
|
9
|
+
* - Empty catch blocks, fake success toasts
|
|
10
|
+
*/
|
|
11
|
+
export interface DeadUIPattern {
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
pattern: string;
|
|
15
|
+
severity: 'error' | 'warning';
|
|
16
|
+
message: string;
|
|
17
|
+
suggestion?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StaticScanResult {
|
|
20
|
+
passed: boolean;
|
|
21
|
+
errors: DeadUIPattern[];
|
|
22
|
+
warnings: DeadUIPattern[];
|
|
23
|
+
scannedFiles: number;
|
|
24
|
+
duration: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run static scan on codebase
|
|
28
|
+
*/
|
|
29
|
+
export declare function runStaticScan(projectPath: string, scanPaths?: string[], excludeDirs?: string[]): StaticScanResult;
|
|
30
|
+
/**
|
|
31
|
+
* Format scan results for console output
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatStaticScanResults(result: StaticScanResult): string;
|
|
34
|
+
//# sourceMappingURL=static-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-scanner.d.ts","sourceRoot":"","sources":["../../../src/reality/no-dead-buttons/static-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqJD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAAM,EAAiC,EAClD,WAAW,GAAE,MAAM,EAAO,GACzB,gBAAgB,CAwClB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA0CxE"}
|