@probelabs/visor 0.1.106 → 0.1.111
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/README.md +71 -2
- package/action.yml +1 -1
- package/defaults/code-refiner.yaml +114 -0
- package/defaults/{.visor.yaml → code-review.yaml} +35 -226
- package/defaults/override.yaml +52 -0
- package/defaults/task-refinement.yaml +624 -0
- package/defaults/visor.tests.yaml +685 -0
- package/defaults/visor.yaml +483 -0
- package/dist/action-cli-bridge.d.ts +11 -82
- package/dist/action-cli-bridge.d.ts.map +1 -1
- package/dist/ai-review-service.d.ts +28 -9
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts +19 -331
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/cron-scheduler.d.ts +3 -3
- package/dist/cron-scheduler.d.ts.map +1 -1
- package/dist/debug-visualizer/ws-server.d.ts +7 -1
- package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
- package/dist/defaults/code-refiner.yaml +114 -0
- package/dist/defaults/{.visor.yaml → code-review.yaml} +35 -226
- package/dist/defaults/override.yaml +52 -0
- package/dist/defaults/task-refinement.yaml +624 -0
- package/dist/defaults/visor.tests.yaml +685 -0
- package/dist/defaults/visor.yaml +483 -0
- package/dist/docs/DEPLOYMENT.md +118 -0
- package/dist/docs/GITHUB_CHECKS.md +280 -0
- package/dist/docs/NPM_USAGE.md +208 -0
- package/dist/docs/action-reference.md +19 -0
- package/dist/docs/advanced-ai.md +237 -0
- package/dist/docs/ai-configuration.md +535 -0
- package/dist/docs/ai-custom-tools-usage.md +261 -0
- package/dist/docs/ai-custom-tools.md +392 -0
- package/dist/docs/author-permissions.md +610 -0
- package/dist/docs/bot-transports-rfc.md +23 -0
- package/dist/docs/ci-cli-mode.md +34 -0
- package/dist/docs/claude-code.md +74 -0
- package/dist/docs/command-provider.md +559 -0
- package/dist/docs/commands.md +8 -0
- package/dist/docs/configuration.md +324 -0
- package/dist/docs/custom-tools.md +424 -0
- package/dist/docs/dashboards/README.md +23 -0
- package/dist/docs/dashboards/grafana-visor-diagrams.json +20 -0
- package/dist/docs/dashboards/grafana-visor-overview.json +33 -0
- package/dist/docs/debug-visualizer-progress.md +572 -0
- package/dist/docs/debug-visualizer-rfc.md +691 -0
- package/dist/docs/debug-visualizer.md +114 -0
- package/dist/docs/debugging.md +636 -0
- package/dist/docs/default-output-schema.md +28 -0
- package/dist/docs/dependencies.md +369 -0
- package/dist/docs/dev-playbook.md +9 -0
- package/dist/docs/engine-pause-resume-rfc.md +192 -0
- package/dist/docs/engine-state-machine-plan.md +333 -0
- package/dist/docs/event-driven-github-integration-rfc.md +743 -0
- package/dist/docs/event-triggers.md +292 -0
- package/dist/docs/execution-statistics-rfc.md +290 -0
- package/dist/docs/fact-validator-gap-analysis.md +178 -0
- package/dist/docs/fact-validator-implementation-plan.md +1235 -0
- package/dist/docs/fail-if.md +95 -0
- package/dist/docs/failure-conditions-implementation.md +271 -0
- package/dist/docs/failure-conditions-schema.md +173 -0
- package/dist/docs/failure-routing-rfc.md +193 -0
- package/dist/docs/failure-routing.md +507 -0
- package/dist/docs/foreach-dependency-propagation.md +473 -0
- package/dist/docs/github-ops.md +89 -0
- package/dist/docs/goto-forward-run-plan.md +113 -0
- package/dist/docs/guides/criticality-modes.md +332 -0
- package/dist/docs/guides/fault-management-and-contracts.md +738 -0
- package/dist/docs/guides/workflow-style-guide.md +224 -0
- package/dist/docs/http.md +299 -0
- package/dist/docs/human-input-provider.md +372 -0
- package/dist/docs/lifecycle-hooks.md +253 -0
- package/dist/docs/limits.md +64 -0
- package/dist/docs/liquid-templates.md +490 -0
- package/dist/docs/loop-routing-refactor.md +89 -0
- package/dist/docs/mcp-provider.md +557 -0
- package/dist/docs/mcp.md +124 -0
- package/dist/docs/memory.md +903 -0
- package/dist/docs/observability.md +12 -0
- package/dist/docs/output-formats.md +20 -0
- package/dist/docs/output-formatting.md +29 -0
- package/dist/docs/output-history.md +383 -0
- package/dist/docs/performance.md +6 -0
- package/dist/docs/pluggable.md +124 -0
- package/dist/docs/proposals/snapshot-scope-execution.md +236 -0
- package/dist/docs/providers/git-checkout.md +589 -0
- package/dist/docs/recipes.md +474 -0
- package/dist/docs/rfc/git-checkout-step.md +601 -0
- package/dist/docs/rfc/on_init-hook.md +1294 -0
- package/dist/docs/rfc/workspace-isolation.md +216 -0
- package/dist/docs/roadmap/criticality-implementation-tasks.md +92 -0
- package/dist/docs/router-patterns.md +339 -0
- package/dist/docs/schema-next-pr.md +10 -0
- package/dist/docs/schema-templates.md +68 -0
- package/dist/docs/script.md +34 -0
- package/dist/docs/sdk.md +222 -0
- package/dist/docs/security.md +7 -0
- package/dist/docs/suppressions.md +89 -0
- package/dist/docs/tag-filtering.md +258 -0
- package/dist/docs/telemetry-setup.md +119 -0
- package/dist/docs/telemetry-tracing-rfc.md +275 -0
- package/dist/docs/test-framework-rfc.md +680 -0
- package/dist/docs/testing/assertions.md +85 -0
- package/dist/docs/testing/ci.md +44 -0
- package/dist/docs/testing/cli.md +41 -0
- package/dist/docs/testing/cookbook.md +172 -0
- package/dist/docs/testing/dsl-reference.md +199 -0
- package/dist/docs/testing/fixtures-and-mocks.md +91 -0
- package/dist/docs/testing/flows.md +92 -0
- package/dist/docs/testing/getting-started.md +93 -0
- package/dist/docs/testing/troubleshooting.md +55 -0
- package/dist/docs/timeouts.md +50 -0
- package/dist/docs/troubleshooting.md +7 -0
- package/dist/docs/visor-sdk-rfc.md +186 -0
- package/dist/docs/workflows.md +569 -0
- package/dist/engine/on-finish/orchestrator.d.ts +19 -0
- package/dist/engine/on-finish/orchestrator.d.ts.map +1 -0
- package/dist/engine/on-finish/utils.d.ts +44 -0
- package/dist/engine/on-finish/utils.d.ts.map +1 -0
- package/dist/event-bus/event-bus.d.ts +13 -0
- package/dist/event-bus/event-bus.d.ts.map +1 -0
- package/dist/event-bus/types.d.ts +71 -0
- package/dist/event-bus/types.d.ts.map +1 -0
- package/dist/examples/.claude/agents/code-reviewer.md +69 -0
- package/dist/examples/.mcp.json +34 -0
- package/dist/examples/CALCULATOR-SDK.md +364 -0
- package/dist/examples/README.md +384 -0
- package/dist/examples/ai-custom-tools-example.yaml +206 -0
- package/dist/examples/ai-custom-tools-simple.yaml +76 -0
- package/dist/examples/ai-retry-fallback-config.yaml +180 -0
- package/dist/examples/ai-with-bash.yaml +126 -0
- package/dist/examples/ai-with-mcp.yaml +82 -0
- package/dist/examples/basic-human-input.yaml +15 -0
- package/dist/examples/bedrock-config.yaml +77 -0
- package/dist/examples/calculator-config.yaml +133 -0
- package/dist/examples/calculator-json-output-guide.md +311 -0
- package/dist/examples/calculator-sdk-automated.ts +340 -0
- package/dist/examples/calculator-sdk-example.ts +275 -0
- package/dist/examples/calculator-sdk-json.ts +331 -0
- package/dist/examples/calculator-sdk-real.ts +374 -0
- package/dist/examples/calculator-sdk-test.ts +148 -0
- package/dist/examples/claude-code-config.yaml +191 -0
- package/dist/examples/cron-webhook-config.yaml +215 -0
- package/dist/examples/custom-template.liquid +57 -0
- package/dist/examples/custom-tools-example.yaml +281 -0
- package/dist/examples/enhanced-config.yaml +165 -0
- package/dist/examples/environments/visor.base.yaml +92 -0
- package/dist/examples/environments/visor.dev.yaml +33 -0
- package/dist/examples/environments/visor.prod.yaml +95 -0
- package/dist/examples/environments/visor.staging.yaml +46 -0
- package/dist/examples/fact-validator.yaml +361 -0
- package/dist/examples/fail-if-simple.yaml +90 -0
- package/dist/examples/failure-conditions-advanced.yaml +136 -0
- package/dist/examples/failure-conditions-basic.yaml +48 -0
- package/dist/examples/failure-conditions-github-style.yaml +119 -0
- package/dist/examples/failure-conditions-migration.yaml +74 -0
- package/dist/examples/for-loop-example.yaml +176 -0
- package/dist/examples/forEach-example.yaml +120 -0
- package/dist/examples/git-checkout-basic.yaml +32 -0
- package/dist/examples/git-checkout-compare.yaml +59 -0
- package/dist/examples/git-checkout-cross-repo.yaml +76 -0
- package/dist/examples/github-workflow-with-tags.yml +163 -0
- package/dist/examples/http-integration-config.yaml +240 -0
- package/dist/examples/https-server-config.yaml +209 -0
- package/dist/examples/human-input-example.yaml +63 -0
- package/dist/examples/if-conditions.yaml +173 -0
- package/dist/examples/jira-simple-example.yaml +56 -0
- package/dist/examples/jira-single-issue-workflow.yaml +166 -0
- package/dist/examples/jira-workflow-mcp.yaml +182 -0
- package/dist/examples/mcp/analyzer.py +119 -0
- package/dist/examples/mcp-provider-example.yaml +301 -0
- package/dist/examples/memory-counter.yaml +99 -0
- package/dist/examples/memory-error-collection.yaml +104 -0
- package/dist/examples/memory-exec-js.yaml +247 -0
- package/dist/examples/memory-namespace-isolation.yaml +184 -0
- package/dist/examples/memory-retry-counter.yaml +65 -0
- package/dist/examples/memory-state-machine.yaml +170 -0
- package/dist/examples/on-init-import-demo.yaml +179 -0
- package/dist/examples/outputs-raw-basic.yaml +26 -0
- package/dist/examples/project-with-tools.yaml +174 -0
- package/dist/examples/prompts/architecture-analysis.liquid +116 -0
- package/dist/examples/prompts/security-comprehensive.liquid +107 -0
- package/dist/examples/quick-start-tags.yaml +53 -0
- package/dist/examples/reusable-tools.yaml +92 -0
- package/dist/examples/reusable-workflows.yaml +88 -0
- package/dist/examples/routing-basic.yaml +35 -0
- package/dist/examples/routing-dynamic-js.yaml +46 -0
- package/dist/examples/routing-foreach.yaml +34 -0
- package/dist/examples/routing-goto-event.yaml +34 -0
- package/dist/examples/routing-on-success.yaml +25 -0
- package/dist/examples/run-calculator-demo.sh +71 -0
- package/dist/examples/sdk-basic.mjs +10 -0
- package/dist/examples/sdk-cjs.cjs +10 -0
- package/dist/examples/sdk-comprehensive.mjs +175 -0
- package/dist/examples/sdk-manual-config.mjs +65 -0
- package/dist/examples/sdk-typescript.js +81 -0
- package/dist/examples/sdk-typescript.ts +92 -0
- package/dist/examples/session-reuse-config.yaml +151 -0
- package/dist/examples/session-reuse-self.yaml +81 -0
- package/dist/examples/slack-simple-chat.yaml +775 -0
- package/dist/examples/templates/security-report.liquid +137 -0
- package/dist/examples/tools-library.yaml +281 -0
- package/dist/examples/transform-example.yaml +199 -0
- package/dist/examples/visor-with-tags.yaml +198 -0
- package/dist/examples/webhook-pipeline-config.yaml +218 -0
- package/dist/examples/workflows/calculator-workflow.yaml +163 -0
- package/dist/examples/workflows/code-quality.yaml +222 -0
- package/dist/examples/workflows/quick-pr-check.yaml +90 -0
- package/dist/examples/workflows/workflow-composition-example.yaml +130 -0
- package/dist/failure-condition-evaluator.d.ts +3 -0
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/frontends/github-frontend.d.ts +58 -0
- package/dist/frontends/github-frontend.d.ts.map +1 -0
- package/dist/frontends/host.d.ts +47 -0
- package/dist/frontends/host.d.ts.map +1 -0
- package/dist/frontends/ndjson-sink.d.ts +12 -0
- package/dist/frontends/ndjson-sink.d.ts.map +1 -0
- package/dist/frontends/slack-frontend.d.ts +58 -0
- package/dist/frontends/slack-frontend.d.ts.map +1 -0
- package/dist/generated/config-schema.d.ts +967 -57
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +1033 -56
- package/dist/github-check-service.d.ts +4 -6
- package/dist/github-check-service.d.ts.map +1 -1
- package/dist/github-comments.d.ts +2 -4
- package/dist/github-comments.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134327 -99004
- package/dist/liquid-extensions.d.ts.map +1 -1
- package/dist/logger.d.ts +2 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/memory-store.d.ts +6 -0
- package/dist/memory-store.d.ts.map +1 -1
- package/dist/output/assistant-json/template.liquid +0 -0
- package/dist/output/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
- package/dist/output/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
- package/dist/output-formatters.d.ts +1 -1
- package/dist/output-formatters.d.ts.map +1 -1
- package/dist/providers/ai-check-provider.d.ts +12 -0
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/dist/providers/check-provider-registry.d.ts +6 -0
- package/dist/providers/check-provider-registry.d.ts.map +1 -1
- package/dist/providers/check-provider.interface.d.ts +43 -1
- package/dist/providers/check-provider.interface.d.ts.map +1 -1
- package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
- package/dist/providers/command-check-provider.d.ts +1 -1
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/providers/custom-tool-executor.d.ts +61 -0
- package/dist/providers/custom-tool-executor.d.ts.map +1 -0
- package/dist/providers/git-checkout-provider.d.ts +25 -0
- package/dist/providers/git-checkout-provider.d.ts.map +1 -0
- package/dist/providers/github-ops-provider.d.ts.map +1 -1
- package/dist/providers/http-client-provider.d.ts +4 -4
- package/dist/providers/http-client-provider.d.ts.map +1 -1
- package/dist/providers/human-input-check-provider.d.ts +5 -0
- package/dist/providers/human-input-check-provider.d.ts.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts +2 -5
- package/dist/providers/log-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-check-provider.d.ts +10 -4
- package/dist/providers/mcp-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-custom-sse-server.d.ts +66 -0
- package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -0
- package/dist/providers/memory-check-provider.d.ts +2 -8
- package/dist/providers/memory-check-provider.d.ts.map +1 -1
- package/dist/providers/script-check-provider.d.ts +25 -0
- package/dist/providers/script-check-provider.d.ts.map +1 -0
- package/dist/providers/workflow-check-provider.d.ts +56 -0
- package/dist/providers/workflow-check-provider.d.ts.map +1 -0
- package/dist/reviewer.d.ts +2 -1
- package/dist/reviewer.d.ts.map +1 -1
- package/dist/sdk/check-provider-registry-534KL5HT.mjs +27 -0
- package/dist/sdk/chunk-23L3QRYX.mjs +16872 -0
- package/dist/sdk/chunk-23L3QRYX.mjs.map +1 -0
- package/dist/sdk/{chunk-TUTOLSFV.mjs → chunk-3OMWVM6J.mjs} +11 -1
- package/dist/sdk/chunk-3OMWVM6J.mjs.map +1 -0
- package/dist/sdk/chunk-7UK3NIIT.mjs +482 -0
- package/dist/sdk/chunk-7UK3NIIT.mjs.map +1 -0
- package/dist/sdk/chunk-AGIZJ4UZ.mjs +173 -0
- package/dist/sdk/chunk-AGIZJ4UZ.mjs.map +1 -0
- package/dist/sdk/chunk-AIVFBIS4.mjs +1371 -0
- package/dist/sdk/chunk-AIVFBIS4.mjs.map +1 -0
- package/dist/sdk/chunk-AK6BVWIT.mjs +426 -0
- package/dist/sdk/chunk-AK6BVWIT.mjs.map +1 -0
- package/dist/sdk/chunk-AUT26LHW.mjs +139 -0
- package/dist/sdk/chunk-AUT26LHW.mjs.map +1 -0
- package/dist/sdk/chunk-BOVFH3LI.mjs +232 -0
- package/dist/sdk/chunk-BOVFH3LI.mjs.map +1 -0
- package/dist/sdk/chunk-CNX7V5JK.mjs +89 -0
- package/dist/sdk/chunk-CNX7V5JK.mjs.map +1 -0
- package/dist/sdk/chunk-HTOKWMPO.mjs +157 -0
- package/dist/sdk/chunk-HTOKWMPO.mjs.map +1 -0
- package/dist/sdk/chunk-NAW3DB3I.mjs +197 -0
- package/dist/sdk/chunk-NAW3DB3I.mjs.map +1 -0
- package/dist/sdk/chunk-O5EZDNYL.mjs +274 -0
- package/dist/sdk/chunk-O5EZDNYL.mjs.map +1 -0
- package/dist/sdk/chunk-QR7MOMJH.mjs +558 -0
- package/dist/sdk/chunk-QR7MOMJH.mjs.map +1 -0
- package/dist/sdk/chunk-QY2XYPEV.mjs +3556 -0
- package/dist/sdk/chunk-QY2XYPEV.mjs.map +1 -0
- package/dist/sdk/chunk-S2RUE2RG.mjs +145 -0
- package/dist/sdk/chunk-S2RUE2RG.mjs.map +1 -0
- package/dist/sdk/chunk-SIWNBRTK.mjs +800 -0
- package/dist/sdk/chunk-SIWNBRTK.mjs.map +1 -0
- package/dist/sdk/chunk-YSN4G6CI.mjs +146 -0
- package/dist/sdk/chunk-YSN4G6CI.mjs.map +1 -0
- package/dist/sdk/chunk-ZYAUYXSW.mjs +206 -0
- package/dist/sdk/chunk-ZYAUYXSW.mjs.map +1 -0
- package/dist/sdk/command-executor-TYUV6HUS.mjs +14 -0
- package/dist/sdk/config-YNC2EOOT.mjs +16 -0
- package/dist/sdk/config-merger-PX3WIT57.mjs +10 -0
- package/dist/sdk/event-bus-5BEVPQ6T.mjs +35 -0
- package/dist/sdk/event-bus-5BEVPQ6T.mjs.map +1 -0
- package/dist/sdk/failure-condition-evaluator-YGTF2GHG.mjs +17 -0
- package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs +458 -0
- package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs.map +1 -0
- package/dist/sdk/github-frontend-SIAEOCON.mjs +1420 -0
- package/dist/sdk/github-frontend-SIAEOCON.mjs.map +1 -0
- package/dist/sdk/host-DXUYTNMU.mjs +52 -0
- package/dist/sdk/host-DXUYTNMU.mjs.map +1 -0
- package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs → liquid-extensions-PKWCKK7E.mjs} +8 -2
- package/dist/sdk/memory-store-XGBB7LX7.mjs +12 -0
- package/dist/sdk/memory-store-XGBB7LX7.mjs.map +1 -0
- package/dist/sdk/metrics-7PP3EJUH.mjs +29 -0
- package/dist/sdk/metrics-7PP3EJUH.mjs.map +1 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs +44 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs.map +1 -0
- package/dist/sdk/prompt-state-YRJY6QAL.mjs +16 -0
- package/dist/sdk/prompt-state-YRJY6QAL.mjs.map +1 -0
- package/dist/sdk/renderer-schema-LPKN5UJS.mjs +51 -0
- package/dist/sdk/renderer-schema-LPKN5UJS.mjs.map +1 -0
- package/dist/sdk/routing-6N45MJ4F.mjs +24 -0
- package/dist/sdk/routing-6N45MJ4F.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +541 -22
- package/dist/sdk/sdk.d.ts +541 -22
- package/dist/sdk/sdk.js +27963 -16505
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +1116 -2169
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk/session-registry-4E6YRQ77.mjs +10 -0
- package/dist/sdk/session-registry-4E6YRQ77.mjs.map +1 -0
- package/dist/sdk/slack-frontend-BVKW3GD5.mjs +735 -0
- package/dist/sdk/slack-frontend-BVKW3GD5.mjs.map +1 -0
- package/dist/sdk/trace-helpers-VP6QYVBX.mjs +23 -0
- package/dist/sdk/trace-helpers-VP6QYVBX.mjs.map +1 -0
- package/dist/sdk/{tracer-init-WC75N5NW.mjs → tracer-init-GSLPPLCD.mjs} +2 -2
- package/dist/sdk/tracer-init-GSLPPLCD.mjs.map +1 -0
- package/dist/sdk/workflow-registry-R6KSACFR.mjs +12 -0
- package/dist/sdk/workflow-registry-R6KSACFR.mjs.map +1 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/slack/adapter.d.ts +36 -0
- package/dist/slack/adapter.d.ts.map +1 -0
- package/dist/slack/cache-prewarmer.d.ts +31 -0
- package/dist/slack/cache-prewarmer.d.ts.map +1 -0
- package/dist/slack/client.d.ts +77 -0
- package/dist/slack/client.d.ts.map +1 -0
- package/dist/slack/markdown.d.ts +45 -0
- package/dist/slack/markdown.d.ts.map +1 -0
- package/dist/slack/prompt-state.d.ts +33 -0
- package/dist/slack/prompt-state.d.ts.map +1 -0
- package/dist/slack/rate-limiter.d.ts +56 -0
- package/dist/slack/rate-limiter.d.ts.map +1 -0
- package/dist/slack/signature.d.ts +2 -0
- package/dist/slack/signature.d.ts.map +1 -0
- package/dist/slack/socket-runner.d.ts +42 -0
- package/dist/slack/socket-runner.d.ts.map +1 -0
- package/dist/slack/thread-cache.d.ts +51 -0
- package/dist/slack/thread-cache.d.ts.map +1 -0
- package/dist/snapshot-store.d.ts +59 -0
- package/dist/snapshot-store.d.ts.map +1 -0
- package/dist/state-machine/context/build-engine-context.d.ts +17 -0
- package/dist/state-machine/context/build-engine-context.d.ts.map +1 -0
- package/dist/state-machine/dispatch/dependency-gating.d.ts +12 -0
- package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -0
- package/dist/state-machine/dispatch/execution-invoker.d.ts +14 -0
- package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -0
- package/dist/state-machine/dispatch/foreach-processor.d.ts +8 -0
- package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -0
- package/dist/state-machine/dispatch/history-snapshot.d.ts +8 -0
- package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -0
- package/dist/state-machine/dispatch/on-init-handlers.d.ts +43 -0
- package/dist/state-machine/dispatch/on-init-handlers.d.ts.map +1 -0
- package/dist/state-machine/dispatch/renderer-schema.d.ts +8 -0
- package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -0
- package/dist/state-machine/dispatch/stats-manager.d.ts +15 -0
- package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -0
- package/dist/state-machine/dispatch/template-renderer.d.ts +7 -0
- package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -0
- package/dist/state-machine/execution/summary.d.ts +8 -0
- package/dist/state-machine/execution/summary.d.ts.map +1 -0
- package/dist/state-machine/runner.d.ts +79 -0
- package/dist/state-machine/runner.d.ts.map +1 -0
- package/dist/state-machine/states/check-running.d.ts +14 -0
- package/dist/state-machine/states/check-running.d.ts.map +1 -0
- package/dist/state-machine/states/completed.d.ts +12 -0
- package/dist/state-machine/states/completed.d.ts.map +1 -0
- package/dist/state-machine/states/error.d.ts +11 -0
- package/dist/state-machine/states/error.d.ts.map +1 -0
- package/dist/state-machine/states/init.d.ts +11 -0
- package/dist/state-machine/states/init.d.ts.map +1 -0
- package/dist/state-machine/states/level-dispatch.d.ts +17 -0
- package/dist/state-machine/states/level-dispatch.d.ts.map +1 -0
- package/dist/state-machine/states/plan-ready.d.ts +12 -0
- package/dist/state-machine/states/plan-ready.d.ts.map +1 -0
- package/dist/state-machine/states/routing.d.ts +52 -0
- package/dist/state-machine/states/routing.d.ts.map +1 -0
- package/dist/state-machine/states/wave-planning.d.ts +14 -0
- package/dist/state-machine/states/wave-planning.d.ts.map +1 -0
- package/dist/state-machine/workflow-projection.d.ts +47 -0
- package/dist/state-machine/workflow-projection.d.ts.map +1 -0
- package/dist/state-machine-execution-engine.d.ts +159 -0
- package/dist/state-machine-execution-engine.d.ts.map +1 -0
- package/dist/telemetry/opentelemetry.d.ts.map +1 -1
- package/dist/telemetry/state-capture.d.ts +5 -0
- package/dist/telemetry/state-capture.d.ts.map +1 -1
- package/dist/test-runner/assertions.d.ts +59 -0
- package/dist/test-runner/assertions.d.ts.map +1 -0
- package/dist/test-runner/core/environment.d.ts +8 -0
- package/dist/test-runner/core/environment.d.ts.map +1 -0
- package/dist/test-runner/core/fixture.d.ts +3 -0
- package/dist/test-runner/core/fixture.d.ts.map +1 -0
- package/dist/test-runner/core/flow-stage.d.ts +32 -0
- package/dist/test-runner/core/flow-stage.d.ts.map +1 -0
- package/dist/test-runner/core/mocks.d.ts +8 -0
- package/dist/test-runner/core/mocks.d.ts.map +1 -0
- package/dist/test-runner/core/test-execution-wrapper.d.ts +18 -0
- package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -0
- package/dist/test-runner/evaluators.d.ts +45 -0
- package/dist/test-runner/evaluators.d.ts.map +1 -0
- package/dist/test-runner/fixture-loader.d.ts +30 -0
- package/dist/test-runner/fixture-loader.d.ts.map +1 -0
- package/dist/test-runner/index.d.ts +127 -0
- package/dist/test-runner/index.d.ts.map +1 -0
- package/dist/test-runner/recorders/github-recorder.d.ts +23 -0
- package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -0
- package/dist/test-runner/recorders/global-recorder.d.ts +4 -0
- package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -0
- package/dist/test-runner/recorders/slack-recorder.d.ts +17 -0
- package/dist/test-runner/recorders/slack-recorder.d.ts.map +1 -0
- package/dist/test-runner/utils/selectors.d.ts +2 -0
- package/dist/test-runner/utils/selectors.d.ts.map +1 -0
- package/dist/test-runner/validator.d.ts +8 -0
- package/dist/test-runner/validator.d.ts.map +1 -0
- package/dist/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
- package/dist/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
- package/dist/types/bot.d.ts +109 -0
- package/dist/types/bot.d.ts.map +1 -0
- package/dist/types/cli.d.ts +8 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +459 -9
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/engine.d.ts +177 -0
- package/dist/types/engine.d.ts.map +1 -0
- package/dist/types/execution.d.ts +73 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/git-checkout.d.ts +76 -0
- package/dist/types/git-checkout.d.ts.map +1 -0
- package/dist/types/github.d.ts +51 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +237 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/utils/command-executor.d.ts +43 -0
- package/dist/utils/command-executor.d.ts.map +1 -0
- package/dist/utils/comment-metadata.d.ts +21 -0
- package/dist/utils/comment-metadata.d.ts.map +1 -0
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-merger.d.ts.map +1 -1
- package/dist/utils/env-exposure.d.ts +3 -0
- package/dist/utils/env-exposure.d.ts.map +1 -0
- package/dist/utils/file-exclusion.d.ts.map +1 -1
- package/dist/utils/interactive-prompt.d.ts +1 -1
- package/dist/utils/interactive-prompt.d.ts.map +1 -1
- package/dist/utils/json-text-extractor.d.ts +17 -0
- package/dist/utils/json-text-extractor.d.ts.map +1 -0
- package/dist/utils/sandbox.d.ts +10 -0
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/script-memory-ops.d.ts +21 -0
- package/dist/utils/script-memory-ops.d.ts.map +1 -0
- package/dist/utils/template-context.d.ts +8 -0
- package/dist/utils/template-context.d.ts.map +1 -0
- package/dist/utils/tracer-init.d.ts.map +1 -1
- package/dist/utils/workspace-manager.d.ts +118 -0
- package/dist/utils/workspace-manager.d.ts.map +1 -0
- package/dist/utils/worktree-cleanup.d.ts +33 -0
- package/dist/utils/worktree-cleanup.d.ts.map +1 -0
- package/dist/utils/worktree-manager.d.ts +153 -0
- package/dist/utils/worktree-manager.d.ts.map +1 -0
- package/dist/webhook-server.d.ts +3 -3
- package/dist/webhook-server.d.ts.map +1 -1
- package/dist/workflow-executor.d.ts +81 -0
- package/dist/workflow-executor.d.ts.map +1 -0
- package/dist/workflow-registry.d.ts +79 -0
- package/dist/workflow-registry.d.ts.map +1 -0
- package/package.json +12 -5
- package/dist/output/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
- package/dist/sdk/check-execution-engine-2YYKUUSH.mjs +0 -11
- package/dist/sdk/check-execution-engine-6QJXYYON.mjs +0 -11
- package/dist/sdk/check-execution-engine-PJZ4ZOKG.mjs +0 -11
- package/dist/sdk/chunk-33QVZ2D4.mjs +0 -316
- package/dist/sdk/chunk-33QVZ2D4.mjs.map +0 -1
- package/dist/sdk/chunk-B5QBV2QJ.mjs +0 -752
- package/dist/sdk/chunk-B5QBV2QJ.mjs.map +0 -1
- package/dist/sdk/chunk-BVFNRCHT.mjs +0 -14129
- package/dist/sdk/chunk-BVFNRCHT.mjs.map +0 -1
- package/dist/sdk/chunk-KWZW23FG.mjs +0 -14129
- package/dist/sdk/chunk-KWZW23FG.mjs.map +0 -1
- package/dist/sdk/chunk-O4RP4BRH.mjs +0 -14092
- package/dist/sdk/chunk-O4RP4BRH.mjs.map +0 -1
- package/dist/sdk/chunk-TUTOLSFV.mjs.map +0 -1
- package/dist/sdk/chunk-U5D2LY66.mjs +0 -245
- package/dist/sdk/chunk-U5D2LY66.mjs.map +0 -1
- package/dist/sdk/chunk-U7X54EMV.mjs +0 -331
- package/dist/sdk/chunk-U7X54EMV.mjs.map +0 -1
- package/dist/sdk/config-merger-TWUBWFC2.mjs +0 -8
- package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs +0 -61
- package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs.map +0 -1
- package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs +0 -61
- package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs.map +0 -1
- package/dist/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
- /package/dist/sdk/{check-execution-engine-2YYKUUSH.mjs.map → check-provider-registry-534KL5HT.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-6QJXYYON.mjs.map → command-executor-TYUV6HUS.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-PJZ4ZOKG.mjs.map → config-YNC2EOOT.mjs.map} +0 -0
- /package/dist/sdk/{config-merger-TWUBWFC2.mjs.map → config-merger-PX3WIT57.mjs.map} +0 -0
- /package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs.map → failure-condition-evaluator-YGTF2GHG.mjs.map} +0 -0
- /package/dist/sdk/{tracer-init-WC75N5NW.mjs.map → liquid-extensions-PKWCKK7E.mjs.map} +0 -0
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createSecureSandbox,
|
|
3
|
+
init_sandbox
|
|
4
|
+
} from "./chunk-BOVFH3LI.mjs";
|
|
5
|
+
import {
|
|
6
|
+
addEvent,
|
|
7
|
+
fallback_ndjson_exports,
|
|
8
|
+
init_fallback_ndjson,
|
|
9
|
+
init_trace_helpers
|
|
10
|
+
} from "./chunk-ZYAUYXSW.mjs";
|
|
11
|
+
import {
|
|
12
|
+
addFailIfTriggered,
|
|
13
|
+
init_metrics
|
|
14
|
+
} from "./chunk-S2RUE2RG.mjs";
|
|
15
|
+
import {
|
|
16
|
+
createPermissionHelpers,
|
|
17
|
+
detectLocalMode,
|
|
18
|
+
init_author_permissions
|
|
19
|
+
} from "./chunk-CNX7V5JK.mjs";
|
|
20
|
+
import {
|
|
21
|
+
MemoryStore,
|
|
22
|
+
init_memory_store
|
|
23
|
+
} from "./chunk-7UK3NIIT.mjs";
|
|
24
|
+
import {
|
|
25
|
+
init_logger,
|
|
26
|
+
logger_exports
|
|
27
|
+
} from "./chunk-AGIZJ4UZ.mjs";
|
|
28
|
+
import {
|
|
29
|
+
__esm,
|
|
30
|
+
__export,
|
|
31
|
+
__require,
|
|
32
|
+
__toCommonJS
|
|
33
|
+
} from "./chunk-WMJKH4XE.mjs";
|
|
34
|
+
|
|
35
|
+
// src/failure-condition-evaluator.ts
|
|
36
|
+
var failure_condition_evaluator_exports = {};
|
|
37
|
+
__export(failure_condition_evaluator_exports, {
|
|
38
|
+
FailureConditionEvaluator: () => FailureConditionEvaluator
|
|
39
|
+
});
|
|
40
|
+
var FailureConditionEvaluator;
|
|
41
|
+
var init_failure_condition_evaluator = __esm({
|
|
42
|
+
"src/failure-condition-evaluator.ts"() {
|
|
43
|
+
init_trace_helpers();
|
|
44
|
+
init_metrics();
|
|
45
|
+
init_sandbox();
|
|
46
|
+
init_author_permissions();
|
|
47
|
+
init_memory_store();
|
|
48
|
+
FailureConditionEvaluator = class _FailureConditionEvaluator {
|
|
49
|
+
sandbox;
|
|
50
|
+
constructor() {
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a secure sandbox with whitelisted functions and globals
|
|
54
|
+
*/
|
|
55
|
+
createSecureSandbox() {
|
|
56
|
+
return createSecureSandbox();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Evaluate simple fail_if condition
|
|
60
|
+
*/
|
|
61
|
+
async evaluateSimpleCondition(checkName, checkSchema, checkGroup, reviewSummary, expression, previousOutputs, authorAssociation) {
|
|
62
|
+
const context = this.buildEvaluationContext(
|
|
63
|
+
checkName,
|
|
64
|
+
checkSchema,
|
|
65
|
+
checkGroup,
|
|
66
|
+
reviewSummary,
|
|
67
|
+
previousOutputs,
|
|
68
|
+
authorAssociation
|
|
69
|
+
);
|
|
70
|
+
try {
|
|
71
|
+
try {
|
|
72
|
+
const isObj = context.output && typeof context.output === "object";
|
|
73
|
+
const keys = isObj ? Object.keys(context.output).join(",") : typeof context.output;
|
|
74
|
+
let errorVal = void 0;
|
|
75
|
+
if (isObj && context.output.error !== void 0)
|
|
76
|
+
errorVal = context.output.error;
|
|
77
|
+
(init_logger(), __toCommonJS(logger_exports)).logger.debug(
|
|
78
|
+
` fail_if: evaluating '${expression}' with output keys=${keys} error=${String(errorVal)}`
|
|
79
|
+
);
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
const res = this.evaluateExpression(expression, context);
|
|
83
|
+
if (res === true) {
|
|
84
|
+
try {
|
|
85
|
+
addEvent("fail_if.triggered", {
|
|
86
|
+
check: checkName,
|
|
87
|
+
scope: "check",
|
|
88
|
+
name: `${checkName}_fail_if`,
|
|
89
|
+
expression,
|
|
90
|
+
severity: "error"
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const { emitNdjsonSpanWithEvents } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
|
|
96
|
+
emitNdjsonSpanWithEvents(
|
|
97
|
+
"visor.fail_if",
|
|
98
|
+
{ check: checkName, scope: "check", name: `${checkName}_fail_if` },
|
|
99
|
+
[
|
|
100
|
+
{
|
|
101
|
+
name: "fail_if.triggered",
|
|
102
|
+
attrs: {
|
|
103
|
+
check: checkName,
|
|
104
|
+
scope: "check",
|
|
105
|
+
name: `${checkName}_fail_if`,
|
|
106
|
+
expression,
|
|
107
|
+
severity: "error"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
);
|
|
112
|
+
} catch {
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return res;
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.warn(`Failed to evaluate fail_if expression: ${error}`);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Determine if the event is related to pull requests
|
|
123
|
+
*/
|
|
124
|
+
determineIfPullRequest(eventType) {
|
|
125
|
+
if (!eventType) return false;
|
|
126
|
+
const prEvents = ["pr_opened", "pr_updated", "pr_closed", "pull_request"];
|
|
127
|
+
return prEvents.includes(eventType) || eventType.startsWith("pr_");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Determine if the event is related to issues
|
|
131
|
+
*/
|
|
132
|
+
determineIfIssue(eventType) {
|
|
133
|
+
if (!eventType) return false;
|
|
134
|
+
const issueEvents = ["issue_opened", "issue_comment", "issues"];
|
|
135
|
+
return issueEvents.includes(eventType) || eventType.startsWith("issue_");
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Evaluate if condition to determine whether a check should run
|
|
139
|
+
*/
|
|
140
|
+
async evaluateIfCondition(checkName, expression, contextData) {
|
|
141
|
+
const context = {
|
|
142
|
+
// Check metadata
|
|
143
|
+
checkName,
|
|
144
|
+
// Git context
|
|
145
|
+
branch: contextData?.branch || "unknown",
|
|
146
|
+
baseBranch: contextData?.baseBranch || "main",
|
|
147
|
+
filesChanged: contextData?.filesChanged || [],
|
|
148
|
+
filesCount: contextData?.filesChanged?.length || 0,
|
|
149
|
+
// GitHub event context
|
|
150
|
+
event: {
|
|
151
|
+
event_name: contextData?.event || "manual",
|
|
152
|
+
action: void 0,
|
|
153
|
+
// Would be populated from actual GitHub context
|
|
154
|
+
repository: void 0
|
|
155
|
+
// Would be populated from actual GitHub context
|
|
156
|
+
},
|
|
157
|
+
// Environment variables
|
|
158
|
+
env: contextData?.environment || {},
|
|
159
|
+
// Previous check results (unwrap output field like templates do)
|
|
160
|
+
outputs: contextData?.previousResults ? (() => {
|
|
161
|
+
const outputs = {};
|
|
162
|
+
for (const [checkName2, result] of contextData.previousResults) {
|
|
163
|
+
const summary = result;
|
|
164
|
+
outputs[checkName2] = summary.output !== void 0 ? summary.output : summary;
|
|
165
|
+
}
|
|
166
|
+
return outputs;
|
|
167
|
+
})() : {},
|
|
168
|
+
// Workflow inputs (for workflows)
|
|
169
|
+
inputs: contextData?.workflowInputs || {},
|
|
170
|
+
// Output property: use provided output for guarantee evaluation, or empty for if conditions
|
|
171
|
+
output: contextData?.output !== void 0 && contextData.output !== null && typeof contextData.output === "object" ? contextData.output : { issues: [] },
|
|
172
|
+
// Author association (used by permission helpers)
|
|
173
|
+
authorAssociation: contextData?.authorAssociation,
|
|
174
|
+
// Utility metadata
|
|
175
|
+
metadata: {
|
|
176
|
+
checkName,
|
|
177
|
+
schema: "",
|
|
178
|
+
group: "",
|
|
179
|
+
criticalIssues: 0,
|
|
180
|
+
errorIssues: 0,
|
|
181
|
+
warningIssues: 0,
|
|
182
|
+
infoIssues: 0,
|
|
183
|
+
totalIssues: 0,
|
|
184
|
+
hasChanges: (contextData?.filesChanged?.length || 0) > 0,
|
|
185
|
+
branch: contextData?.branch || "unknown",
|
|
186
|
+
event: contextData?.event || "manual"
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
try {
|
|
190
|
+
const res = this.evaluateExpression(expression, context);
|
|
191
|
+
try {
|
|
192
|
+
if (process.env.VISOR_DEBUG === "true") {
|
|
193
|
+
const outputKeys = Object.keys(context.outputs || {});
|
|
194
|
+
console.error(
|
|
195
|
+
`[if-eval] check=${checkName} expr="${expression}" result=${String(res)} outputKeys=[${outputKeys.join(",")}]`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
} catch {
|
|
199
|
+
}
|
|
200
|
+
return res;
|
|
201
|
+
} catch (error) {
|
|
202
|
+
console.warn(`Failed to evaluate if expression for check '${checkName}': ${error}`);
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Evaluate all failure conditions for a check result
|
|
208
|
+
*/
|
|
209
|
+
async evaluateConditions(checkName, checkSchema, checkGroup, reviewSummary, globalConditions, checkConditions, previousOutputs, authorAssociation) {
|
|
210
|
+
const context = this.buildEvaluationContext(
|
|
211
|
+
checkName,
|
|
212
|
+
checkSchema,
|
|
213
|
+
checkGroup,
|
|
214
|
+
reviewSummary,
|
|
215
|
+
previousOutputs,
|
|
216
|
+
authorAssociation
|
|
217
|
+
);
|
|
218
|
+
const results = [];
|
|
219
|
+
if (globalConditions) {
|
|
220
|
+
const globalResults = await this.evaluateConditionSet(globalConditions, context, "global");
|
|
221
|
+
results.push(...globalResults);
|
|
222
|
+
}
|
|
223
|
+
if (checkConditions) {
|
|
224
|
+
const checkResults = await this.evaluateConditionSet(checkConditions, context, "check");
|
|
225
|
+
const overriddenConditions = new Set(Object.keys(checkConditions));
|
|
226
|
+
const filteredResults = results.filter(
|
|
227
|
+
(result) => !overriddenConditions.has(result.conditionName)
|
|
228
|
+
);
|
|
229
|
+
results.length = 0;
|
|
230
|
+
results.push(...filteredResults, ...checkResults);
|
|
231
|
+
}
|
|
232
|
+
return results;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Evaluate a set of failure conditions
|
|
236
|
+
*/
|
|
237
|
+
async evaluateConditionSet(conditions, context, source) {
|
|
238
|
+
const results = [];
|
|
239
|
+
for (const [conditionName, condition] of Object.entries(conditions)) {
|
|
240
|
+
try {
|
|
241
|
+
addEvent("fail_if.evaluated", {
|
|
242
|
+
check: context.checkName,
|
|
243
|
+
scope: source,
|
|
244
|
+
name: conditionName,
|
|
245
|
+
expression: this.extractExpression(condition)
|
|
246
|
+
});
|
|
247
|
+
} catch {
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
const { emitNdjsonSpanWithEvents } = (init_fallback_ndjson(), __toCommonJS(fallback_ndjson_exports));
|
|
251
|
+
emitNdjsonSpanWithEvents(
|
|
252
|
+
"visor.fail_if",
|
|
253
|
+
{ check: context.checkName || "unknown", scope: source, name: conditionName },
|
|
254
|
+
[
|
|
255
|
+
{
|
|
256
|
+
name: "fail_if.evaluated",
|
|
257
|
+
attrs: {
|
|
258
|
+
check: context.checkName,
|
|
259
|
+
scope: source,
|
|
260
|
+
name: conditionName,
|
|
261
|
+
expression: this.extractExpression(condition)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
);
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
try {
|
|
269
|
+
const result = await this.evaluateSingleCondition(conditionName, condition, context);
|
|
270
|
+
results.push(result);
|
|
271
|
+
if (result.failed) {
|
|
272
|
+
try {
|
|
273
|
+
addEvent("fail_if.triggered", {
|
|
274
|
+
check: context.checkName,
|
|
275
|
+
scope: source,
|
|
276
|
+
name: conditionName,
|
|
277
|
+
expression: result.expression,
|
|
278
|
+
severity: result.severity,
|
|
279
|
+
halt_execution: result.haltExecution
|
|
280
|
+
});
|
|
281
|
+
} catch {
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
addFailIfTriggered(context.checkName || "unknown", source);
|
|
285
|
+
} catch {
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} catch (error) {
|
|
289
|
+
results.push({
|
|
290
|
+
conditionName,
|
|
291
|
+
failed: false,
|
|
292
|
+
expression: this.extractExpression(condition),
|
|
293
|
+
severity: "error",
|
|
294
|
+
haltExecution: false,
|
|
295
|
+
error: `Failed to evaluate ${source} condition '${conditionName}': ${error instanceof Error ? error.message : String(error)}`
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return results;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Evaluate a single failure condition
|
|
303
|
+
*/
|
|
304
|
+
async evaluateSingleCondition(conditionName, condition, context) {
|
|
305
|
+
const expression = this.extractExpression(condition);
|
|
306
|
+
const config = this.extractConditionConfig(condition);
|
|
307
|
+
try {
|
|
308
|
+
const failed = this.evaluateExpression(expression, context);
|
|
309
|
+
return {
|
|
310
|
+
conditionName,
|
|
311
|
+
failed,
|
|
312
|
+
expression,
|
|
313
|
+
message: config.message,
|
|
314
|
+
severity: config.severity || "error",
|
|
315
|
+
haltExecution: config.halt_execution || false
|
|
316
|
+
};
|
|
317
|
+
} catch (error) {
|
|
318
|
+
throw new Error(
|
|
319
|
+
`Expression evaluation error: ${error instanceof Error ? error.message : String(error)}`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Secure expression evaluation using SandboxJS
|
|
325
|
+
* Supports the same GitHub Actions-style functions as the previous implementation
|
|
326
|
+
*/
|
|
327
|
+
evaluateExpression(condition, context) {
|
|
328
|
+
try {
|
|
329
|
+
const normalize = (expr) => {
|
|
330
|
+
const trimmed = expr.trim();
|
|
331
|
+
if (!/[\n;]/.test(trimmed)) return trimmed;
|
|
332
|
+
const parts = trimmed.split(/[\n;]+/).map((s) => s.trim()).filter((s) => s.length > 0 && !s.startsWith("//"));
|
|
333
|
+
if (parts.length === 0) return "true";
|
|
334
|
+
const lastRaw = parts.pop();
|
|
335
|
+
const last = lastRaw.replace(/^return\s+/i, "").trim();
|
|
336
|
+
if (parts.length === 0) return last;
|
|
337
|
+
return `(${parts.join(", ")}, ${last})`;
|
|
338
|
+
};
|
|
339
|
+
const contains = (searchString, searchValue) => String(searchString).toLowerCase().includes(String(searchValue).toLowerCase());
|
|
340
|
+
const startsWith = (searchString, searchValue) => String(searchString).toLowerCase().startsWith(String(searchValue).toLowerCase());
|
|
341
|
+
const endsWith = (searchString, searchValue) => String(searchString).toLowerCase().endsWith(String(searchValue).toLowerCase());
|
|
342
|
+
const length = (value) => {
|
|
343
|
+
if (typeof value === "string" || Array.isArray(value)) {
|
|
344
|
+
return value.length;
|
|
345
|
+
}
|
|
346
|
+
if (value && typeof value === "object") {
|
|
347
|
+
return Object.keys(value).length;
|
|
348
|
+
}
|
|
349
|
+
return 0;
|
|
350
|
+
};
|
|
351
|
+
const always = () => true;
|
|
352
|
+
const success = () => true;
|
|
353
|
+
const failure = () => false;
|
|
354
|
+
const log = (...args) => {
|
|
355
|
+
console.log("\u{1F50D} Debug:", ...args);
|
|
356
|
+
};
|
|
357
|
+
const hasIssue = (issues2, field, value) => {
|
|
358
|
+
if (!Array.isArray(issues2)) return false;
|
|
359
|
+
return issues2.some((issue) => issue[field] === value);
|
|
360
|
+
};
|
|
361
|
+
const countIssues = (issues2, field, value) => {
|
|
362
|
+
if (!Array.isArray(issues2)) return 0;
|
|
363
|
+
return issues2.filter((issue) => issue[field] === value).length;
|
|
364
|
+
};
|
|
365
|
+
const hasFileMatching = (issues2, pattern) => {
|
|
366
|
+
if (!Array.isArray(issues2)) return false;
|
|
367
|
+
return issues2.some((issue) => issue.file?.includes(pattern));
|
|
368
|
+
};
|
|
369
|
+
const hasIssueWith = hasIssue;
|
|
370
|
+
const hasFileWith = hasFileMatching;
|
|
371
|
+
const permissionHelpers = createPermissionHelpers(
|
|
372
|
+
context.authorAssociation,
|
|
373
|
+
detectLocalMode()
|
|
374
|
+
);
|
|
375
|
+
const hasMinPermission = permissionHelpers.hasMinPermission;
|
|
376
|
+
const isOwner = permissionHelpers.isOwner;
|
|
377
|
+
const isMember = permissionHelpers.isMember;
|
|
378
|
+
const isCollaborator = permissionHelpers.isCollaborator;
|
|
379
|
+
const isContributor = permissionHelpers.isContributor;
|
|
380
|
+
const isFirstTimer = permissionHelpers.isFirstTimer;
|
|
381
|
+
const output = context.output || {};
|
|
382
|
+
let issues = output.issues || [];
|
|
383
|
+
if (typeof issues === "string") {
|
|
384
|
+
try {
|
|
385
|
+
issues = JSON.parse(issues);
|
|
386
|
+
} catch {
|
|
387
|
+
issues = [];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (!Array.isArray(issues)) {
|
|
391
|
+
issues = [];
|
|
392
|
+
}
|
|
393
|
+
const metadata = context.metadata || {
|
|
394
|
+
checkName: context.checkName || "",
|
|
395
|
+
schema: context.schema || "",
|
|
396
|
+
group: context.group || "",
|
|
397
|
+
criticalIssues: issues.filter((i) => i.severity === "critical").length,
|
|
398
|
+
errorIssues: issues.filter((i) => i.severity === "error").length,
|
|
399
|
+
warningIssues: issues.filter((i) => i.severity === "warning").length,
|
|
400
|
+
infoIssues: issues.filter((i) => i.severity === "info").length,
|
|
401
|
+
totalIssues: issues.length,
|
|
402
|
+
hasChanges: context.hasChanges || false
|
|
403
|
+
};
|
|
404
|
+
const criticalIssues = metadata.criticalIssues;
|
|
405
|
+
const errorIssues = metadata.errorIssues;
|
|
406
|
+
const totalIssues = metadata.totalIssues;
|
|
407
|
+
const warningIssues = metadata.warningIssues;
|
|
408
|
+
const infoIssues = metadata.infoIssues;
|
|
409
|
+
const checkName = context.checkName || "";
|
|
410
|
+
const schema = context.schema || "";
|
|
411
|
+
const group = context.group || "";
|
|
412
|
+
const branch = context.branch || "unknown";
|
|
413
|
+
const baseBranch = context.baseBranch || "main";
|
|
414
|
+
const filesChanged = context.filesChanged || [];
|
|
415
|
+
const filesCount = context.filesCount || 0;
|
|
416
|
+
const event = context.event || "manual";
|
|
417
|
+
const env = context.env || {};
|
|
418
|
+
const outputs = context.outputs || {};
|
|
419
|
+
const inputs = context.inputs || {};
|
|
420
|
+
const debugData = context.debug || null;
|
|
421
|
+
const memoryStore = MemoryStore.getInstance();
|
|
422
|
+
const memoryAccessor = {
|
|
423
|
+
get: (key, ns) => memoryStore.get(key, ns),
|
|
424
|
+
has: (key, ns) => memoryStore.has(key, ns),
|
|
425
|
+
list: (ns) => memoryStore.list(ns),
|
|
426
|
+
getAll: (ns) => memoryStore.getAll(ns)
|
|
427
|
+
};
|
|
428
|
+
const scope = {
|
|
429
|
+
// Primary context variables
|
|
430
|
+
output,
|
|
431
|
+
outputs,
|
|
432
|
+
debug: debugData,
|
|
433
|
+
// Memory accessor for fail_if expressions
|
|
434
|
+
memory: memoryAccessor,
|
|
435
|
+
// Legacy compatibility variables
|
|
436
|
+
issues,
|
|
437
|
+
metadata,
|
|
438
|
+
criticalIssues,
|
|
439
|
+
errorIssues,
|
|
440
|
+
totalIssues,
|
|
441
|
+
warningIssues,
|
|
442
|
+
infoIssues,
|
|
443
|
+
// If condition context
|
|
444
|
+
checkName,
|
|
445
|
+
schema,
|
|
446
|
+
group,
|
|
447
|
+
branch,
|
|
448
|
+
baseBranch,
|
|
449
|
+
filesChanged,
|
|
450
|
+
filesCount,
|
|
451
|
+
event,
|
|
452
|
+
env,
|
|
453
|
+
inputs,
|
|
454
|
+
// Helper functions
|
|
455
|
+
contains,
|
|
456
|
+
startsWith,
|
|
457
|
+
endsWith,
|
|
458
|
+
length,
|
|
459
|
+
always,
|
|
460
|
+
success,
|
|
461
|
+
failure,
|
|
462
|
+
log,
|
|
463
|
+
hasIssue,
|
|
464
|
+
countIssues,
|
|
465
|
+
hasFileMatching,
|
|
466
|
+
hasIssueWith,
|
|
467
|
+
hasFileWith,
|
|
468
|
+
// Permission helpers
|
|
469
|
+
hasMinPermission,
|
|
470
|
+
isOwner,
|
|
471
|
+
isMember,
|
|
472
|
+
isCollaborator,
|
|
473
|
+
isContributor,
|
|
474
|
+
isFirstTimer
|
|
475
|
+
};
|
|
476
|
+
const raw = condition.trim();
|
|
477
|
+
if (!this.sandbox) {
|
|
478
|
+
this.sandbox = this.createSecureSandbox();
|
|
479
|
+
}
|
|
480
|
+
let result;
|
|
481
|
+
try {
|
|
482
|
+
let exec;
|
|
483
|
+
try {
|
|
484
|
+
exec = this.sandbox.compile(`return (${raw});`);
|
|
485
|
+
} catch {
|
|
486
|
+
const normalizedExpr = normalize(condition);
|
|
487
|
+
exec = this.sandbox.compile(`return (${normalizedExpr});`);
|
|
488
|
+
}
|
|
489
|
+
result = exec(scope).run();
|
|
490
|
+
} catch (_primaryErr) {
|
|
491
|
+
try {
|
|
492
|
+
const vm = __require("vm");
|
|
493
|
+
const ctx = {
|
|
494
|
+
// Scope vars
|
|
495
|
+
output,
|
|
496
|
+
outputs,
|
|
497
|
+
debug: debugData,
|
|
498
|
+
memory: memoryAccessor,
|
|
499
|
+
issues,
|
|
500
|
+
metadata,
|
|
501
|
+
criticalIssues,
|
|
502
|
+
errorIssues,
|
|
503
|
+
totalIssues,
|
|
504
|
+
warningIssues,
|
|
505
|
+
infoIssues,
|
|
506
|
+
checkName,
|
|
507
|
+
schema,
|
|
508
|
+
group,
|
|
509
|
+
branch,
|
|
510
|
+
baseBranch,
|
|
511
|
+
filesChanged,
|
|
512
|
+
filesCount,
|
|
513
|
+
event,
|
|
514
|
+
env,
|
|
515
|
+
inputs,
|
|
516
|
+
// Helpers
|
|
517
|
+
contains,
|
|
518
|
+
startsWith,
|
|
519
|
+
endsWith,
|
|
520
|
+
length,
|
|
521
|
+
always,
|
|
522
|
+
success,
|
|
523
|
+
failure,
|
|
524
|
+
log,
|
|
525
|
+
hasIssue,
|
|
526
|
+
countIssues,
|
|
527
|
+
hasFileMatching,
|
|
528
|
+
hasIssueWith,
|
|
529
|
+
hasFileWith,
|
|
530
|
+
hasMinPermission,
|
|
531
|
+
isOwner,
|
|
532
|
+
isMember,
|
|
533
|
+
isCollaborator,
|
|
534
|
+
isContributor,
|
|
535
|
+
isFirstTimer,
|
|
536
|
+
Math,
|
|
537
|
+
JSON
|
|
538
|
+
};
|
|
539
|
+
const context2 = vm.createContext(ctx);
|
|
540
|
+
let code = `(${raw})`;
|
|
541
|
+
try {
|
|
542
|
+
result = new vm.Script(code).runInContext(context2, { timeout: 50 });
|
|
543
|
+
} catch {
|
|
544
|
+
const normalizedExpr = normalize(condition);
|
|
545
|
+
code = `(${normalizedExpr})`;
|
|
546
|
+
result = new vm.Script(code).runInContext(context2, { timeout: 50 });
|
|
547
|
+
}
|
|
548
|
+
} catch (vmErr) {
|
|
549
|
+
console.error("\u274C Failed to evaluate expression:", condition, vmErr);
|
|
550
|
+
throw vmErr;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
try {
|
|
554
|
+
(init_logger(), __toCommonJS(logger_exports)).logger.debug(` fail_if: result=${Boolean(result)}`);
|
|
555
|
+
} catch {
|
|
556
|
+
}
|
|
557
|
+
return Boolean(result);
|
|
558
|
+
} catch (error) {
|
|
559
|
+
console.error("\u274C Failed to evaluate expression:", condition, error);
|
|
560
|
+
throw error;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Extract the expression from a failure condition
|
|
565
|
+
*/
|
|
566
|
+
extractExpression(condition) {
|
|
567
|
+
if (typeof condition === "string") {
|
|
568
|
+
return condition;
|
|
569
|
+
}
|
|
570
|
+
return condition.condition;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Extract configuration from a failure condition
|
|
574
|
+
*/
|
|
575
|
+
extractConditionConfig(condition) {
|
|
576
|
+
if (typeof condition === "string") {
|
|
577
|
+
return {};
|
|
578
|
+
}
|
|
579
|
+
return {
|
|
580
|
+
message: condition.message,
|
|
581
|
+
severity: condition.severity,
|
|
582
|
+
halt_execution: condition.halt_execution
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Build the evaluation context for expressions
|
|
587
|
+
*/
|
|
588
|
+
buildEvaluationContext(checkName, checkSchema, checkGroup, reviewSummary, previousOutputs, authorAssociation) {
|
|
589
|
+
const { issues, debug } = reviewSummary;
|
|
590
|
+
const reviewSummaryWithOutput = reviewSummary;
|
|
591
|
+
const {
|
|
592
|
+
output: extractedOutput,
|
|
593
|
+
// Exclude issues from otherFields since we handle it separately
|
|
594
|
+
issues: _issues,
|
|
595
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
596
|
+
...otherFields
|
|
597
|
+
} = reviewSummaryWithOutput;
|
|
598
|
+
const aggregatedOutput = {
|
|
599
|
+
issues: (issues || []).map((issue) => ({
|
|
600
|
+
file: issue.file,
|
|
601
|
+
line: issue.line,
|
|
602
|
+
endLine: issue.endLine,
|
|
603
|
+
ruleId: issue.ruleId,
|
|
604
|
+
message: issue.message,
|
|
605
|
+
severity: issue.severity,
|
|
606
|
+
category: issue.category,
|
|
607
|
+
group: issue.group,
|
|
608
|
+
schema: issue.schema,
|
|
609
|
+
suggestion: issue.suggestion,
|
|
610
|
+
replacement: issue.replacement
|
|
611
|
+
})),
|
|
612
|
+
// Include additional schema-specific data from reviewSummary
|
|
613
|
+
...otherFields
|
|
614
|
+
};
|
|
615
|
+
if (Array.isArray(extractedOutput)) {
|
|
616
|
+
aggregatedOutput.items = extractedOutput;
|
|
617
|
+
const anyError = extractedOutput.find(
|
|
618
|
+
(it) => it && typeof it === "object" && it.error
|
|
619
|
+
);
|
|
620
|
+
if (anyError && anyError.error !== void 0) {
|
|
621
|
+
aggregatedOutput.error = anyError.error;
|
|
622
|
+
}
|
|
623
|
+
} else if (extractedOutput && typeof extractedOutput === "object") {
|
|
624
|
+
Object.assign(aggregatedOutput, extractedOutput);
|
|
625
|
+
}
|
|
626
|
+
try {
|
|
627
|
+
const raw = reviewSummaryWithOutput.__raw;
|
|
628
|
+
if (raw && typeof raw === "object") {
|
|
629
|
+
Object.assign(aggregatedOutput, raw);
|
|
630
|
+
}
|
|
631
|
+
} catch {
|
|
632
|
+
}
|
|
633
|
+
try {
|
|
634
|
+
if (typeof extractedOutput === "string") {
|
|
635
|
+
const parsed = this.tryExtractJsonFromEnd(extractedOutput) ?? (() => {
|
|
636
|
+
try {
|
|
637
|
+
return JSON.parse(extractedOutput);
|
|
638
|
+
} catch {
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
})();
|
|
642
|
+
if (parsed !== null) {
|
|
643
|
+
if (Array.isArray(parsed)) {
|
|
644
|
+
aggregatedOutput.items = parsed;
|
|
645
|
+
} else if (typeof parsed === "object") {
|
|
646
|
+
Object.assign(aggregatedOutput, parsed);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const lower = extractedOutput.toLowerCase();
|
|
650
|
+
const boolFrom = (key) => {
|
|
651
|
+
const reTrue = new RegExp(
|
|
652
|
+
`(?:^|[^a-z0-9_])${key}[^a-z0-9_]*[:=][^a-z0-9_]*true(?:[^a-z0-9_]|$)`
|
|
653
|
+
);
|
|
654
|
+
const reFalse = new RegExp(
|
|
655
|
+
`(?:^|[^a-z0-9_])${key}[^a-z0-9_]*[:=][^a-z0-9_]*false(?:[^a-z0-9_]|$)`
|
|
656
|
+
);
|
|
657
|
+
if (reTrue.test(lower)) return true;
|
|
658
|
+
if (reFalse.test(lower)) return false;
|
|
659
|
+
return null;
|
|
660
|
+
};
|
|
661
|
+
const keys = ["error"];
|
|
662
|
+
for (const k of keys) {
|
|
663
|
+
const v = boolFrom(k);
|
|
664
|
+
if (v !== null && aggregatedOutput[k] === void 0) {
|
|
665
|
+
aggregatedOutput[k] = v;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
} catch {
|
|
670
|
+
}
|
|
671
|
+
try {
|
|
672
|
+
const rsAny = reviewSummaryWithOutput;
|
|
673
|
+
const hasStructuredOutput = extractedOutput !== void 0 && extractedOutput !== null;
|
|
674
|
+
if (!hasStructuredOutput && typeof rsAny?.content === "string") {
|
|
675
|
+
const parsedFromContent = this.tryExtractJsonFromEnd(rsAny.content);
|
|
676
|
+
if (parsedFromContent !== null && parsedFromContent !== void 0) {
|
|
677
|
+
if (Array.isArray(parsedFromContent)) {
|
|
678
|
+
aggregatedOutput.items = parsedFromContent;
|
|
679
|
+
} else if (typeof parsedFromContent === "object") {
|
|
680
|
+
Object.assign(aggregatedOutput, parsedFromContent);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
} catch {
|
|
685
|
+
}
|
|
686
|
+
const memoryStore = MemoryStore.getInstance();
|
|
687
|
+
const context = {
|
|
688
|
+
output: aggregatedOutput,
|
|
689
|
+
outputs: (() => {
|
|
690
|
+
if (!previousOutputs) return {};
|
|
691
|
+
const outputs = {};
|
|
692
|
+
for (const [checkName2, result] of Object.entries(previousOutputs)) {
|
|
693
|
+
const summary = result;
|
|
694
|
+
outputs[checkName2] = summary.output !== void 0 ? summary.output : summary;
|
|
695
|
+
}
|
|
696
|
+
return outputs;
|
|
697
|
+
})(),
|
|
698
|
+
// Add memory accessor for fail_if expressions
|
|
699
|
+
memory: {
|
|
700
|
+
get: (key, ns) => memoryStore.get(key, ns),
|
|
701
|
+
has: (key, ns) => memoryStore.has(key, ns),
|
|
702
|
+
list: (ns) => memoryStore.list(ns),
|
|
703
|
+
getAll: (ns) => memoryStore.getAll(ns)
|
|
704
|
+
},
|
|
705
|
+
// Add basic context info for failure conditions
|
|
706
|
+
checkName,
|
|
707
|
+
schema: checkSchema,
|
|
708
|
+
group: checkGroup,
|
|
709
|
+
authorAssociation
|
|
710
|
+
};
|
|
711
|
+
if (debug) {
|
|
712
|
+
context.debug = {
|
|
713
|
+
errors: debug.errors || [],
|
|
714
|
+
processingTime: debug.processingTime || 0,
|
|
715
|
+
provider: debug.provider || "unknown",
|
|
716
|
+
model: debug.model || "unknown"
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
return context;
|
|
720
|
+
}
|
|
721
|
+
// Minimal JSON-from-end extractor for fail_if context fallback
|
|
722
|
+
tryExtractJsonFromEnd(text) {
|
|
723
|
+
try {
|
|
724
|
+
const lines = text.split("\n");
|
|
725
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
726
|
+
const t = lines[i].trim();
|
|
727
|
+
if (t.startsWith("{") || t.startsWith("[")) {
|
|
728
|
+
const candidate = lines.slice(i).join("\n").trim();
|
|
729
|
+
if (candidate.startsWith("{") && candidate.endsWith("}") || candidate.startsWith("[") && candidate.endsWith("]")) {
|
|
730
|
+
return JSON.parse(candidate);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
} catch {
|
|
735
|
+
}
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Check if any failure condition requires halting execution
|
|
740
|
+
*/
|
|
741
|
+
static shouldHaltExecution(results) {
|
|
742
|
+
return results.some((result) => result.failed && result.haltExecution);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Get all failed conditions
|
|
746
|
+
*/
|
|
747
|
+
static getFailedConditions(results) {
|
|
748
|
+
return results.filter((result) => result.failed);
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Group results by severity
|
|
752
|
+
*/
|
|
753
|
+
static groupResultsBySeverity(results) {
|
|
754
|
+
return {
|
|
755
|
+
// Only 'error' severity now (no backward compatibility needed here as this is internal)
|
|
756
|
+
error: results.filter((r) => r.severity === "error"),
|
|
757
|
+
warning: results.filter((r) => r.severity === "warning"),
|
|
758
|
+
info: results.filter((r) => r.severity === "info")
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Format results for display
|
|
763
|
+
*/
|
|
764
|
+
static formatResults(results) {
|
|
765
|
+
const failed = _FailureConditionEvaluator.getFailedConditions(results);
|
|
766
|
+
if (failed.length === 0) {
|
|
767
|
+
return "\u2705 All failure conditions passed";
|
|
768
|
+
}
|
|
769
|
+
const grouped = _FailureConditionEvaluator.groupResultsBySeverity(failed);
|
|
770
|
+
const sections = [];
|
|
771
|
+
if (grouped.error.length > 0) {
|
|
772
|
+
sections.push(`\u274C **Error severity conditions (${grouped.error.length}):**`);
|
|
773
|
+
grouped.error.forEach((result) => {
|
|
774
|
+
sections.push(` - ${result.conditionName}: ${result.message || result.expression}`);
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
if (grouped.warning.length > 0) {
|
|
778
|
+
sections.push(`\u26A0\uFE0F **Warning conditions (${grouped.warning.length}):**`);
|
|
779
|
+
grouped.warning.forEach((result) => {
|
|
780
|
+
sections.push(` - ${result.conditionName}: ${result.message || result.expression}`);
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
if (grouped.info.length > 0) {
|
|
784
|
+
sections.push(`\u2139\uFE0F **Info conditions (${grouped.info.length}):**`);
|
|
785
|
+
grouped.info.forEach((result) => {
|
|
786
|
+
sections.push(` - ${result.conditionName}: ${result.message || result.expression}`);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
return sections.join("\n");
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
export {
|
|
796
|
+
FailureConditionEvaluator,
|
|
797
|
+
failure_condition_evaluator_exports,
|
|
798
|
+
init_failure_condition_evaluator
|
|
799
|
+
};
|
|
800
|
+
//# sourceMappingURL=chunk-SIWNBRTK.mjs.map
|