@probelabs/visor 0.1.106 → 0.1.107
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 +65 -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 +620 -0
- package/defaults/visor.tests.yaml +674 -0
- package/defaults/visor.yaml +482 -0
- package/dist/663.index.js +2 -3
- package/dist/80.index.js +2 -3
- 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 +15 -0
- 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.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 +620 -0
- package/dist/defaults/visor.tests.yaml +674 -0
- package/dist/defaults/visor.yaml +482 -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 +178 -0
- package/dist/docs/ai-configuration.md +468 -0
- package/dist/docs/author-permissions.md +610 -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 +303 -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-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/limits.md +64 -0
- package/dist/docs/liquid-templates.md +347 -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/recipes.md +21 -0
- package/dist/docs/roadmap/criticality-implementation-tasks.md +92 -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 +57 -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-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/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/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/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/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 +1 -0
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/frontends/github-frontend.d.ts +38 -0
- package/dist/frontends/github-frontend.d.ts.map +1 -0
- package/dist/frontends/host.d.ts +43 -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/generated/config-schema.d.ts +564 -22
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +612 -24
- 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 +0 -4
- package/dist/github-comments.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70335 -62514
- package/dist/liquid-extensions.d.ts.map +1 -1
- package/dist/logger.d.ts +1 -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-2025-11-21T11-50-46-505Z.ndjson +138 -0
- package/dist/output/traces/run-2025-11-21T11-51-33-674Z.ndjson +839 -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.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 +34 -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/github-ops-provider.d.ts.map +1 -1
- package/dist/providers/http-client-provider.d.ts +1 -4
- package/dist/providers/http-client-provider.d.ts.map +1 -1
- package/dist/providers/human-input-check-provider.d.ts +3 -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 +9 -3
- package/dist/providers/mcp-check-provider.d.ts.map +1 -1
- 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/chunk-37ZSCMFC.mjs +482 -0
- package/dist/sdk/chunk-37ZSCMFC.mjs.map +1 -0
- package/dist/sdk/chunk-6Y4YTKCF.mjs +197 -0
- package/dist/sdk/chunk-6Y4YTKCF.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-IEO6CFLG.mjs +1215 -0
- package/dist/sdk/chunk-IEO6CFLG.mjs.map +1 -0
- package/dist/sdk/chunk-JEHPDJIF.mjs +223 -0
- package/dist/sdk/chunk-JEHPDJIF.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-TUTOLSFV.mjs → chunk-OOZITMRU.mjs} +1 -1
- package/dist/sdk/chunk-OOZITMRU.mjs.map +1 -0
- package/dist/sdk/chunk-OWUVOILT.mjs +557 -0
- package/dist/sdk/chunk-OWUVOILT.mjs.map +1 -0
- package/dist/sdk/chunk-OZJ263FM.mjs +986 -0
- package/dist/sdk/chunk-OZJ263FM.mjs.map +1 -0
- package/dist/sdk/chunk-PTL3K3PN.mjs +3128 -0
- package/dist/sdk/chunk-PTL3K3PN.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-VMPLF6FT.mjs +127 -0
- package/dist/sdk/chunk-VMPLF6FT.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/config-M4ZNO6NU.mjs +14 -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-NBO5YRXW.mjs +16 -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-4AWRJT7D.mjs +1242 -0
- package/dist/sdk/github-frontend-4AWRJT7D.mjs.map +1 -0
- package/dist/sdk/host-7GBC3S7L.mjs +49 -0
- package/dist/sdk/host-7GBC3S7L.mjs.map +1 -0
- package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs → liquid-extensions-C7EG3YKH.mjs} +7 -2
- package/dist/sdk/memory-store-GJACZC2A.mjs +11 -0
- package/dist/sdk/metrics-7PP3EJUH.mjs +29 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs +44 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs.map +1 -0
- package/dist/sdk/renderer-schema-6RF26VUS.mjs +50 -0
- package/dist/sdk/renderer-schema-6RF26VUS.mjs.map +1 -0
- package/dist/sdk/routing-RP56JTV2.mjs +23 -0
- package/dist/sdk/routing-RP56JTV2.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +326 -21
- package/dist/sdk/sdk.d.ts +326 -21
- package/dist/sdk/sdk.js +21403 -16366
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +13510 -2096
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk/session-registry-N5FFYFTM.mjs +10 -0
- package/dist/sdk/session-registry-N5FFYFTM.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-WP4X46IF.mjs} +2 -2
- package/dist/sdk/tracer-init-WP4X46IF.mjs.map +1 -0
- package/dist/sdk/workflow-registry-2YIIXQCK.mjs +11 -0
- package/dist/sdk/workflow-registry-2YIIXQCK.mjs.map +1 -0
- package/dist/sdk.d.ts.map +1 -1
- 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 +9 -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/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 +73 -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 +147 -0
- package/dist/state-machine-execution-engine.d.ts.map +1 -0
- package/dist/telemetry/opentelemetry.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 +12 -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 +120 -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/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-2025-11-21T11-50-46-505Z.ndjson +138 -0
- package/dist/traces/run-2025-11-21T11-51-33-674Z.ndjson +839 -0
- package/dist/types/cli.d.ts +4 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +278 -5
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/engine.d.ts +172 -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/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/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 +7 -0
- package/dist/utils/template-context.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 +10 -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 → config-M4ZNO6NU.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-6QJXYYON.mjs.map → config-merger-PX3WIT57.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-PJZ4ZOKG.mjs.map → failure-condition-evaluator-NBO5YRXW.mjs.map} +0 -0
- /package/dist/sdk/{config-merger-TWUBWFC2.mjs.map → liquid-extensions-C7EG3YKH.mjs.map} +0 -0
- /package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs.map → memory-store-GJACZC2A.mjs.map} +0 -0
- /package/dist/sdk/{tracer-init-WC75N5NW.mjs.map → metrics-7PP3EJUH.mjs.map} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Example Visor configuration demonstrating MCP support in AI checks
|
|
2
|
+
version: "1.0"
|
|
3
|
+
|
|
4
|
+
# Global AI provider configuration
|
|
5
|
+
ai_provider: anthropic
|
|
6
|
+
ai_model: claude-3-sonnet
|
|
7
|
+
|
|
8
|
+
# Global MCP servers (available to all AI checks by default)
|
|
9
|
+
ai_mcp_servers:
|
|
10
|
+
probe:
|
|
11
|
+
command: "npx"
|
|
12
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
13
|
+
filesystem:
|
|
14
|
+
command: "npx"
|
|
15
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/project"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
# Example 1: Uses global MCP servers (inherits probe and filesystem)
|
|
19
|
+
basic_security_review:
|
|
20
|
+
type: ai
|
|
21
|
+
prompt: |
|
|
22
|
+
Review the code changes for security vulnerabilities using available tools.
|
|
23
|
+
Focus on common security issues like injection attacks and XSS.
|
|
24
|
+
on: ["pr_opened", "pr_updated"]
|
|
25
|
+
tags: ["security", "basic"]
|
|
26
|
+
|
|
27
|
+
# Example 2: Check-level MCP servers (overrides global)
|
|
28
|
+
performance_review:
|
|
29
|
+
type: ai
|
|
30
|
+
prompt: |
|
|
31
|
+
Analyze the code for performance issues using specialized tools.
|
|
32
|
+
Look for inefficient algorithms and potential bottlenecks.
|
|
33
|
+
ai_mcp_servers:
|
|
34
|
+
probe:
|
|
35
|
+
command: "npx"
|
|
36
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
37
|
+
custom_profiler:
|
|
38
|
+
command: "python3"
|
|
39
|
+
args: ["./tools/performance-analyzer.py"]
|
|
40
|
+
env:
|
|
41
|
+
ANALYSIS_DEPTH: "comprehensive"
|
|
42
|
+
on: ["pr_opened"]
|
|
43
|
+
tags: ["performance", "mcp"]
|
|
44
|
+
|
|
45
|
+
# Example 3: AI object-level MCP servers (overrides all others)
|
|
46
|
+
comprehensive_review:
|
|
47
|
+
type: ai
|
|
48
|
+
prompt: |
|
|
49
|
+
Perform comprehensive code analysis using all available tools.
|
|
50
|
+
This check uses its own specific set of MCP servers.
|
|
51
|
+
ai:
|
|
52
|
+
provider: anthropic
|
|
53
|
+
model: claude-3-opus # Override global model for this check
|
|
54
|
+
mcpServers:
|
|
55
|
+
probe:
|
|
56
|
+
command: "npx"
|
|
57
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
58
|
+
env:
|
|
59
|
+
PROBE_DEBUG: "true"
|
|
60
|
+
filesystem:
|
|
61
|
+
command: "npx"
|
|
62
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/project"]
|
|
63
|
+
github:
|
|
64
|
+
command: "npx"
|
|
65
|
+
args: ["-y", "@modelcontextprotocol/server-github"]
|
|
66
|
+
env:
|
|
67
|
+
GITHUB_TOKEN: "${GITHUB_TOKEN}"
|
|
68
|
+
on: ["pr_opened"]
|
|
69
|
+
tags: ["comprehensive", "mcp"]
|
|
70
|
+
|
|
71
|
+
# Example 4: No MCP servers (basic AI check)
|
|
72
|
+
simple_ai_check:
|
|
73
|
+
type: ai
|
|
74
|
+
prompt: "Review this code for basic issues without using external tools"
|
|
75
|
+
ai_mcp_servers: {} # Explicitly disable global MCP servers for this check
|
|
76
|
+
on: ["pr_opened", "pr_updated"]
|
|
77
|
+
tags: ["basic", "simple"]
|
|
78
|
+
|
|
79
|
+
output:
|
|
80
|
+
pr_comment:
|
|
81
|
+
enabled: true
|
|
82
|
+
group_by: check
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: '1.0'
|
|
2
|
+
|
|
3
|
+
checks:
|
|
4
|
+
ask-user:
|
|
5
|
+
type: human-input
|
|
6
|
+
prompt: "What is your name?"
|
|
7
|
+
placeholder: "Enter your name..."
|
|
8
|
+
allow_empty: false
|
|
9
|
+
|
|
10
|
+
greet:
|
|
11
|
+
type: log
|
|
12
|
+
depends_on: [ask-user]
|
|
13
|
+
message: |
|
|
14
|
+
Hello, {{ outputs['ask-user'] }}!
|
|
15
|
+
Welcome to Visor.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Example Visor configuration for AWS Bedrock
|
|
2
|
+
# This demonstrates various ways to configure and use AWS Bedrock as your AI provider
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# Example GitHub Actions workflow to use this configuration:
|
|
6
|
+
#
|
|
7
|
+
# name: AI Code Review with AWS Bedrock
|
|
8
|
+
# on: [pull_request]
|
|
9
|
+
#
|
|
10
|
+
# jobs:
|
|
11
|
+
# review:
|
|
12
|
+
# runs-on: ubuntu-latest
|
|
13
|
+
# steps:
|
|
14
|
+
# - uses: actions/checkout@v4
|
|
15
|
+
# - uses: probelabs/visor@v1
|
|
16
|
+
# with:
|
|
17
|
+
# ai-provider: bedrock
|
|
18
|
+
# ai-model: anthropic.claude-sonnet-4-20250514-v1:0
|
|
19
|
+
# env:
|
|
20
|
+
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
21
|
+
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
22
|
+
# AWS_REGION: us-east-1
|
|
23
|
+
|
|
24
|
+
# As alternative to github action, you can also set it in config on various levels, or via following env vars:
|
|
25
|
+
#
|
|
26
|
+
# export AI_PROVIDER=bedrock # This gets mapped internally
|
|
27
|
+
# export AI_MODEL=anthropic.claude-sonnet-4-20250514-v1:0
|
|
28
|
+
|
|
29
|
+
# Configuration version
|
|
30
|
+
version: "1.0"
|
|
31
|
+
|
|
32
|
+
# Global AI provider settings, via config
|
|
33
|
+
# Set Bedrock as the default provider for all AI checks
|
|
34
|
+
ai_provider: bedrock
|
|
35
|
+
ai_model: anthropic.claude-sonnet-4-20250514-v1:0 # Default Bedrock model
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
# Basic check using global Bedrock settings
|
|
39
|
+
security-analysis:
|
|
40
|
+
type: ai
|
|
41
|
+
prompt: |
|
|
42
|
+
Analyze the code changes for security vulnerabilities including:
|
|
43
|
+
- SQL injection risks
|
|
44
|
+
- XSS vulnerabilities
|
|
45
|
+
- Authentication/authorization issues
|
|
46
|
+
- Sensitive data exposure
|
|
47
|
+
- Input validation problems
|
|
48
|
+
|
|
49
|
+
# Check with explicit Bedrock configuration
|
|
50
|
+
performance-review:
|
|
51
|
+
type: ai
|
|
52
|
+
ai_provider: bedrock
|
|
53
|
+
ai_model: anthropic.claude-3-opus-20240229 # Use a different Bedrock model
|
|
54
|
+
prompt: |
|
|
55
|
+
Review code for performance issues:
|
|
56
|
+
- Inefficient algorithms (O(n²) or worse)
|
|
57
|
+
- Memory leaks or excessive allocations
|
|
58
|
+
- Database query optimization opportunities
|
|
59
|
+
- Caching opportunities
|
|
60
|
+
schema: code-review # Use structured output
|
|
61
|
+
|
|
62
|
+
# Mixed provider example - use different providers for different checks
|
|
63
|
+
quick-style-check:
|
|
64
|
+
type: ai
|
|
65
|
+
ai_provider: google # Override to use Google Gemini for this check
|
|
66
|
+
ai_model: gemini-2.0-flash-exp
|
|
67
|
+
prompt: "Quick style and formatting check"
|
|
68
|
+
|
|
69
|
+
# Output configuration
|
|
70
|
+
output:
|
|
71
|
+
pr_comment:
|
|
72
|
+
format: markdown
|
|
73
|
+
group_by: check
|
|
74
|
+
collapse: true
|
|
75
|
+
github_checks:
|
|
76
|
+
enabled: true
|
|
77
|
+
per_check: true # Create separate GitHub check runs for each check
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
version: "1.0"
|
|
2
|
+
|
|
3
|
+
# Interactive Calculator Example
|
|
4
|
+
# Demonstrates human-input + memory + JavaScript workflow
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# visor --config examples/calculator-config.yaml
|
|
8
|
+
#
|
|
9
|
+
# Or with inline messages:
|
|
10
|
+
# visor --config examples/calculator-config.yaml \
|
|
11
|
+
# --message 42 # First run asks for number1
|
|
12
|
+
#
|
|
13
|
+
# The workflow will:
|
|
14
|
+
# 1. Ask for first number
|
|
15
|
+
# 2. Store it in memory
|
|
16
|
+
# 3. Ask for second number
|
|
17
|
+
# 4. Store it in memory
|
|
18
|
+
# 5. Ask for operation (+, -, *, /)
|
|
19
|
+
# 6. Calculate result using JavaScript
|
|
20
|
+
# 7. Display formatted result
|
|
21
|
+
|
|
22
|
+
memory:
|
|
23
|
+
storage: memory
|
|
24
|
+
namespace: calculator
|
|
25
|
+
|
|
26
|
+
checks:
|
|
27
|
+
# Step 1: Get first number
|
|
28
|
+
get-number1:
|
|
29
|
+
type: human-input
|
|
30
|
+
prompt: "Enter the first number:"
|
|
31
|
+
placeholder: "e.g., 42"
|
|
32
|
+
allow_empty: false
|
|
33
|
+
|
|
34
|
+
# Step 2: Store first number in memory
|
|
35
|
+
store-number1:
|
|
36
|
+
type: memory
|
|
37
|
+
depends_on: [get-number1]
|
|
38
|
+
operation: set
|
|
39
|
+
namespace: calculator
|
|
40
|
+
key: number1
|
|
41
|
+
value_js: "parseFloat(outputs['get-number1'])"
|
|
42
|
+
|
|
43
|
+
# Step 3: Get second number
|
|
44
|
+
get-number2:
|
|
45
|
+
type: human-input
|
|
46
|
+
depends_on: [store-number1]
|
|
47
|
+
prompt: "Enter the second number:"
|
|
48
|
+
placeholder: "e.g., 7"
|
|
49
|
+
allow_empty: false
|
|
50
|
+
|
|
51
|
+
# Step 4: Store second number in memory
|
|
52
|
+
store-number2:
|
|
53
|
+
type: memory
|
|
54
|
+
depends_on: [get-number2]
|
|
55
|
+
operation: set
|
|
56
|
+
namespace: calculator
|
|
57
|
+
key: number2
|
|
58
|
+
value_js: "parseFloat(outputs['get-number2'])"
|
|
59
|
+
|
|
60
|
+
# Step 5: Get operation
|
|
61
|
+
get-operation:
|
|
62
|
+
type: human-input
|
|
63
|
+
depends_on: [store-number2]
|
|
64
|
+
prompt: "Select operation (+, -, *, /):"
|
|
65
|
+
placeholder: "Enter one of: + - * /"
|
|
66
|
+
allow_empty: false
|
|
67
|
+
|
|
68
|
+
# Step 6: Store operation in memory
|
|
69
|
+
store-operation:
|
|
70
|
+
type: memory
|
|
71
|
+
depends_on: [get-operation]
|
|
72
|
+
operation: set
|
|
73
|
+
namespace: calculator
|
|
74
|
+
key: operation
|
|
75
|
+
value_js: "outputs['get-operation'].trim()"
|
|
76
|
+
|
|
77
|
+
# Step 7: Perform calculation using memory and JavaScript
|
|
78
|
+
calculate:
|
|
79
|
+
type: script
|
|
80
|
+
depends_on: [store-operation]
|
|
81
|
+
content: |
|
|
82
|
+
// Get values from memory
|
|
83
|
+
const num1 = memory.get('number1', 'calculator');
|
|
84
|
+
const num2 = memory.get('number2', 'calculator');
|
|
85
|
+
const op = memory.get('operation', 'calculator');
|
|
86
|
+
|
|
87
|
+
// Log for debugging
|
|
88
|
+
log('Calculating:', num1, op, num2);
|
|
89
|
+
|
|
90
|
+
// Perform calculation
|
|
91
|
+
let result;
|
|
92
|
+
switch(op) {
|
|
93
|
+
case '+':
|
|
94
|
+
result = num1 + num2;
|
|
95
|
+
break;
|
|
96
|
+
case '-':
|
|
97
|
+
result = num1 - num2;
|
|
98
|
+
break;
|
|
99
|
+
case '*':
|
|
100
|
+
result = num1 * num2;
|
|
101
|
+
break;
|
|
102
|
+
case '/':
|
|
103
|
+
if (num2 === 0) {
|
|
104
|
+
throw new Error('Division by zero!');
|
|
105
|
+
}
|
|
106
|
+
result = num1 / num2;
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
throw new Error('Invalid operation: ' + op);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Return result for output
|
|
113
|
+
return result;
|
|
114
|
+
|
|
115
|
+
# Step 8: Display the result
|
|
116
|
+
show-result:
|
|
117
|
+
type: log
|
|
118
|
+
depends_on: [calculate]
|
|
119
|
+
message: |
|
|
120
|
+
|
|
121
|
+
╔════════════════════════════════════════╗
|
|
122
|
+
║ CALCULATION RESULT ║
|
|
123
|
+
╠════════════════════════════════════════╣
|
|
124
|
+
║ ║
|
|
125
|
+
║ {{ outputs['get-number1'] }} {{ outputs['get-operation'] }} {{ outputs['get-number2'] }} = {{ outputs['calculate'] }}
|
|
126
|
+
║ ║
|
|
127
|
+
╚════════════════════════════════════════╝
|
|
128
|
+
|
|
129
|
+
output:
|
|
130
|
+
pr_comment:
|
|
131
|
+
format: markdown
|
|
132
|
+
group_by: check
|
|
133
|
+
collapse: false
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Calculator SDK - JSON Output Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to use the calculator examples with JSON output for programmatic processing.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Three calculator variants are provided:
|
|
8
|
+
|
|
9
|
+
1. **`calculator-sdk-real.ts`** - Interactive with table output (original)
|
|
10
|
+
2. **`calculator-sdk-json.ts`** - Interactive with JSON output + custom visualization
|
|
11
|
+
3. **`calculator-sdk-automated.ts`** - Non-interactive with pure JSON output
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Interactive with JSON Output
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun examples/calculator-sdk-json.ts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Features:**
|
|
22
|
+
- Prompts for user input
|
|
23
|
+
- Uses `outputFormat: 'json'`
|
|
24
|
+
- Suppresses engine console output
|
|
25
|
+
- Returns structured JSON
|
|
26
|
+
- Custom visualization in script
|
|
27
|
+
|
|
28
|
+
**Output:**
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"success": true,
|
|
32
|
+
"calculation": {
|
|
33
|
+
"number1": 10,
|
|
34
|
+
"number2": 5,
|
|
35
|
+
"operation": "+",
|
|
36
|
+
"result": 15,
|
|
37
|
+
"expression": "10 + 5 = 15"
|
|
38
|
+
},
|
|
39
|
+
"executionTime": 1234,
|
|
40
|
+
"issues": []
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Fully Automated (No Interaction)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# With default values (10 + 5)
|
|
48
|
+
bun examples/calculator-sdk-automated.ts
|
|
49
|
+
|
|
50
|
+
# With custom values
|
|
51
|
+
bun examples/calculator-sdk-automated.ts 100 25 -
|
|
52
|
+
|
|
53
|
+
# Output is pure JSON
|
|
54
|
+
bun examples/calculator-sdk-automated.ts 7 8 '*' --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Features:**
|
|
58
|
+
- No user interaction required
|
|
59
|
+
- Inputs provided programmatically
|
|
60
|
+
- All console output suppressed
|
|
61
|
+
- Perfect for testing & automation
|
|
62
|
+
- Includes test suite
|
|
63
|
+
|
|
64
|
+
## Key Techniques
|
|
65
|
+
|
|
66
|
+
### 1. Using JSON Output Format
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const result = await engine.executeChecks({
|
|
70
|
+
checks: checksToRun,
|
|
71
|
+
config: calculatorConfig,
|
|
72
|
+
outputFormat: 'json', // ← Instead of 'table'
|
|
73
|
+
maxParallelism: 1,
|
|
74
|
+
debug: false
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Suppressing Console Output
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
function suppressAllOutput() {
|
|
82
|
+
const noop = () => {};
|
|
83
|
+
const originalLog = console.log;
|
|
84
|
+
// ... save all console methods
|
|
85
|
+
|
|
86
|
+
console.log = noop;
|
|
87
|
+
console.error = noop;
|
|
88
|
+
console.warn = noop;
|
|
89
|
+
// ... suppress all
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
restore: () => {
|
|
93
|
+
console.log = originalLog;
|
|
94
|
+
// ... restore all
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Usage
|
|
100
|
+
const suppressor = suppressAllOutput();
|
|
101
|
+
const result = await engine.executeChecks({...});
|
|
102
|
+
suppressor.restore();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 3. Automated Input Provider
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
function createAutomatedInputHandler(inputs: {
|
|
109
|
+
'get-number1': string;
|
|
110
|
+
'get-number2': string;
|
|
111
|
+
'get-operation': string;
|
|
112
|
+
}) {
|
|
113
|
+
return async (request: HumanInputRequest): Promise<string> => {
|
|
114
|
+
return inputs[request.checkId];
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Set the hook
|
|
119
|
+
HumanInputCheckProvider.setHooks({
|
|
120
|
+
onHumanInput: createAutomatedInputHandler({
|
|
121
|
+
'get-number1': '10',
|
|
122
|
+
'get-number2': '5',
|
|
123
|
+
'get-operation': '+'
|
|
124
|
+
})
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 4. Accessing Memory Results
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
const { MemoryStore } = await import('../src/memory-store');
|
|
132
|
+
const memoryStore = MemoryStore.getInstance(config.memory);
|
|
133
|
+
|
|
134
|
+
const result = memoryStore.get('result', 'calculator');
|
|
135
|
+
const num1 = memoryStore.get('number1', 'calculator');
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## JSON Output Structure
|
|
139
|
+
|
|
140
|
+
The result from `executeChecks` with `outputFormat: 'json'` returns:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
interface ExecutionResult {
|
|
144
|
+
executionTime: number;
|
|
145
|
+
timestamp: string;
|
|
146
|
+
summary: {
|
|
147
|
+
issues: Array<{
|
|
148
|
+
file: string;
|
|
149
|
+
line: number;
|
|
150
|
+
ruleId: string;
|
|
151
|
+
message: string;
|
|
152
|
+
severity: 'info' | 'warning' | 'error' | 'critical';
|
|
153
|
+
category: string;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
// Additional fields based on output format
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Custom Result Structure
|
|
161
|
+
|
|
162
|
+
You can transform this into your own structure:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
interface CalculationResult {
|
|
166
|
+
success: boolean;
|
|
167
|
+
calculation?: {
|
|
168
|
+
number1: number;
|
|
169
|
+
number2: number;
|
|
170
|
+
operation: string;
|
|
171
|
+
result: number;
|
|
172
|
+
expression: string;
|
|
173
|
+
};
|
|
174
|
+
executionTime?: number;
|
|
175
|
+
issues?: any[];
|
|
176
|
+
error?: string;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function calculate(num1, num2, op): Promise<CalculationResult> {
|
|
180
|
+
// Suppress output
|
|
181
|
+
const suppressor = suppressAllOutput();
|
|
182
|
+
|
|
183
|
+
// Execute
|
|
184
|
+
const result = await engine.executeChecks({
|
|
185
|
+
outputFormat: 'json',
|
|
186
|
+
// ...
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
suppressor.restore();
|
|
190
|
+
|
|
191
|
+
// Extract from memory
|
|
192
|
+
const memoryStore = MemoryStore.getInstance();
|
|
193
|
+
const resultValue = memoryStore.get('result', 'calculator');
|
|
194
|
+
|
|
195
|
+
// Return custom structure
|
|
196
|
+
return {
|
|
197
|
+
success: true,
|
|
198
|
+
calculation: {
|
|
199
|
+
number1: parseFloat(num1),
|
|
200
|
+
number2: parseFloat(num2),
|
|
201
|
+
operation: op,
|
|
202
|
+
result: resultValue,
|
|
203
|
+
expression: `${num1} ${op} ${num2} = ${resultValue}`
|
|
204
|
+
},
|
|
205
|
+
executionTime: result.executionTime,
|
|
206
|
+
issues: result.summary?.issues || []
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Testing Example
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
// Run multiple calculations programmatically
|
|
215
|
+
const testCases = [
|
|
216
|
+
{ num1: '100', num2: '25', operation: '-', expected: 75 },
|
|
217
|
+
{ num1: '7', num2: '8', operation: '*', expected: 56 },
|
|
218
|
+
{ num1: '100', num2: '4', operation: '/', expected: 25 },
|
|
219
|
+
];
|
|
220
|
+
|
|
221
|
+
const results = await Promise.all(
|
|
222
|
+
testCases.map(tc =>
|
|
223
|
+
calculate(tc.num1, tc.num2, tc.operation, { suppressOutput: true })
|
|
224
|
+
)
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
// Verify results
|
|
228
|
+
results.forEach((result, idx) => {
|
|
229
|
+
const tc = testCases[idx];
|
|
230
|
+
const passed = result.calculation?.result === tc.expected;
|
|
231
|
+
console.log(`${tc.num1} ${tc.operation} ${tc.num2} = ${result.calculation?.result} ${passed ? '✅' : '❌'}`);
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Benefits
|
|
236
|
+
|
|
237
|
+
### For Production Use
|
|
238
|
+
- ✅ Clean JSON output for APIs
|
|
239
|
+
- ✅ No stdout pollution
|
|
240
|
+
- ✅ Easy to parse and process
|
|
241
|
+
- ✅ Structured error handling
|
|
242
|
+
|
|
243
|
+
### For Testing
|
|
244
|
+
- ✅ Automated test suites
|
|
245
|
+
- ✅ CI/CD integration
|
|
246
|
+
- ✅ Reproducible results
|
|
247
|
+
- ✅ No user interaction needed
|
|
248
|
+
|
|
249
|
+
### For Monitoring
|
|
250
|
+
- ✅ Log to files/databases
|
|
251
|
+
- ✅ Metrics collection
|
|
252
|
+
- ✅ Alerting on failures
|
|
253
|
+
- ✅ Performance tracking
|
|
254
|
+
|
|
255
|
+
## Integration Examples
|
|
256
|
+
|
|
257
|
+
### Express API Endpoint
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
app.post('/api/calculate', async (req, res) => {
|
|
261
|
+
const { num1, num2, operation } = req.body;
|
|
262
|
+
|
|
263
|
+
const result = await calculate(num1, num2, operation, {
|
|
264
|
+
suppressOutput: true
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
if (result.success) {
|
|
268
|
+
res.json(result);
|
|
269
|
+
} else {
|
|
270
|
+
res.status(400).json({ error: result.error });
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### CLI Tool with JSON Flag
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
if (process.argv.includes('--json')) {
|
|
279
|
+
const result = await calculate(num1, num2, op, { suppressOutput: true });
|
|
280
|
+
console.log(JSON.stringify(result));
|
|
281
|
+
} else {
|
|
282
|
+
// Interactive mode
|
|
283
|
+
await interactiveCalculator();
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Background Job
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
async function processCalculations(jobs: CalculationJob[]) {
|
|
291
|
+
const results = await Promise.all(
|
|
292
|
+
jobs.map(job =>
|
|
293
|
+
calculate(job.num1, job.num2, job.operation, {
|
|
294
|
+
suppressOutput: true
|
|
295
|
+
})
|
|
296
|
+
)
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
// Store results in database
|
|
300
|
+
await db.calculations.insertMany(results);
|
|
301
|
+
|
|
302
|
+
return results;
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## See Also
|
|
307
|
+
|
|
308
|
+
- **SDK Documentation**: `docs/sdk.md`
|
|
309
|
+
- **Human Input Feature**: `docs/human-input-feature-plan.md`
|
|
310
|
+
- **Memory Provider**: `src/providers/memory-check-provider.ts`
|
|
311
|
+
- **Examples**: `examples/calculator-*.ts`
|