@probelabs/visor 0.1.124 → 0.1.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/docs/DEPLOYMENT.md +117 -11
  3. package/dist/docs/GITHUB_CHECKS.md +18 -4
  4. package/dist/docs/NPM_USAGE.md +112 -39
  5. package/dist/docs/action-reference.md +63 -9
  6. package/dist/docs/advanced-ai.md +58 -51
  7. package/dist/docs/ai-configuration.md +99 -11
  8. package/dist/docs/ai-custom-tools-usage.md +70 -33
  9. package/dist/docs/ai-custom-tools.md +50 -27
  10. package/dist/docs/architecture.md +1232 -0
  11. package/dist/docs/bot-transports-rfc.md +13 -3
  12. package/dist/docs/ci-cli-mode.md +116 -8
  13. package/dist/docs/claude-code.md +111 -41
  14. package/dist/docs/command-provider.md +37 -15
  15. package/dist/docs/commands.md +252 -6
  16. package/dist/docs/configuration.md +138 -4
  17. package/dist/docs/contributing.md +737 -0
  18. package/dist/docs/custom-tools.md +39 -8
  19. package/dist/docs/dashboards/README.md +33 -19
  20. package/dist/docs/debug-visualizer-progress.md +14 -13
  21. package/dist/docs/debug-visualizer-rfc.md +14 -13
  22. package/dist/docs/debug-visualizer.md +30 -5
  23. package/dist/docs/debugging.md +73 -8
  24. package/dist/docs/default-output-schema.md +24 -20
  25. package/dist/docs/dependencies.md +75 -21
  26. package/dist/docs/dev-playbook.md +85 -9
  27. package/dist/docs/engine-pause-resume-rfc.md +11 -11
  28. package/dist/docs/engine-state-machine-plan.md +10 -3
  29. package/dist/docs/event-driven-github-integration-rfc.md +20 -11
  30. package/dist/docs/event-triggers.md +95 -6
  31. package/dist/docs/execution-statistics-rfc.md +16 -4
  32. package/dist/docs/fact-validator-gap-analysis.md +12 -1
  33. package/dist/docs/fact-validator-implementation-plan.md +19 -11
  34. package/dist/docs/fail-if.md +116 -11
  35. package/dist/docs/failure-conditions-implementation.md +40 -6
  36. package/dist/docs/failure-conditions-schema.md +243 -87
  37. package/dist/docs/failure-routing-rfc.md +43 -18
  38. package/dist/docs/failure-routing.md +80 -23
  39. package/dist/docs/faq.md +836 -0
  40. package/dist/docs/foreach-dependency-propagation.md +32 -15
  41. package/dist/docs/github-ops.md +6 -5
  42. package/dist/docs/glossary.md +322 -0
  43. package/dist/docs/goto-forward-run-plan.md +23 -10
  44. package/dist/docs/guides/criticality-modes.md +15 -13
  45. package/dist/docs/guides/fault-management-and-contracts.md +8 -5
  46. package/dist/docs/guides/workflow-style-guide.md +17 -8
  47. package/dist/docs/http.md +102 -3
  48. package/dist/docs/human-input-provider.md +20 -36
  49. package/dist/docs/index.md +206 -0
  50. package/dist/docs/lifecycle-hooks.md +322 -2
  51. package/dist/docs/limits.md +20 -5
  52. package/dist/docs/liquid-templates.md +86 -14
  53. package/dist/docs/loop-routing-refactor.md +4 -2
  54. package/dist/docs/mcp-provider.md +53 -19
  55. package/dist/docs/mcp.md +27 -1
  56. package/dist/docs/memory.md +7 -2
  57. package/dist/docs/migration.md +596 -0
  58. package/dist/docs/observability.md +227 -6
  59. package/dist/docs/output-formats.md +388 -9
  60. package/dist/docs/output-history.md +36 -6
  61. package/dist/docs/performance.md +510 -4
  62. package/dist/docs/pluggable.md +95 -4
  63. package/dist/docs/proposals/snapshot-scope-execution.md +6 -5
  64. package/dist/docs/providers/git-checkout.md +16 -14
  65. package/dist/docs/providers/noop.md +696 -0
  66. package/dist/docs/recipes.md +8 -9
  67. package/dist/docs/rfc/git-checkout-step.md +3 -1
  68. package/dist/docs/rfc/on_init-hook.md +18 -5
  69. package/dist/docs/rfc/workspace-isolation.md +16 -0
  70. package/dist/docs/roadmap/criticality-implementation-tasks.md +27 -27
  71. package/dist/docs/router-patterns.md +155 -43
  72. package/dist/docs/schema-templates.md +51 -15
  73. package/dist/docs/script.md +162 -13
  74. package/dist/docs/sdk.md +46 -12
  75. package/dist/docs/security.md +464 -5
  76. package/dist/docs/slack-integration.md +481 -0
  77. package/dist/docs/tag-filtering.md +60 -20
  78. package/dist/docs/telemetry-setup.md +157 -46
  79. package/dist/docs/test-framework-rfc.md +37 -36
  80. package/dist/docs/testing/assertions.md +92 -4
  81. package/dist/docs/testing/ci.md +56 -7
  82. package/dist/docs/testing/cli.md +57 -15
  83. package/dist/docs/testing/cookbook.md +53 -20
  84. package/dist/docs/testing/dsl-reference.md +110 -9
  85. package/dist/docs/testing/fixtures-and-mocks.md +28 -3
  86. package/dist/docs/testing/flows.md +59 -4
  87. package/dist/docs/testing/getting-started.md +14 -13
  88. package/dist/docs/testing/troubleshooting.md +39 -2
  89. package/dist/docs/timeouts.md +174 -18
  90. package/dist/docs/troubleshooting.md +176 -6
  91. package/dist/docs/workflow-creation-guide.md +101 -3
  92. package/dist/docs/workflows.md +138 -41
  93. package/dist/examples/README.md +169 -4
  94. package/dist/examples/ai-custom-tools-simple.yaml +2 -3
  95. package/dist/examples/cron-webhook-config.yaml +15 -0
  96. package/dist/examples/forEach-example.yaml +6 -0
  97. package/dist/examples/git-checkout-basic.yaml +4 -0
  98. package/dist/examples/git-checkout-compare.yaml +6 -0
  99. package/dist/examples/git-checkout-cross-repo.yaml +7 -0
  100. package/dist/examples/http-integration-config.yaml +30 -0
  101. package/dist/examples/https-server-config.yaml +15 -0
  102. package/dist/examples/mcp-provider-example.yaml +10 -10
  103. package/dist/examples/transform-example.yaml +3 -0
  104. package/dist/examples/webhook-pipeline-config.yaml +18 -0
  105. package/dist/examples/workflows/workflow-composition-example.yaml +4 -0
  106. package/dist/frontends/slack-frontend.d.ts +2 -0
  107. package/dist/frontends/slack-frontend.d.ts.map +1 -1
  108. package/dist/generated/config-schema.d.ts +11 -7
  109. package/dist/generated/config-schema.d.ts.map +1 -1
  110. package/dist/generated/config-schema.json +11 -7
  111. package/dist/index.js +3127 -974
  112. package/dist/output/traces/{run-2026-01-28T16-15-24-569Z.ndjson → run-2026-01-31T16-37-22-321Z.ndjson} +84 -84
  113. package/dist/output/traces/{run-2026-01-28T16-16-09-757Z.ndjson → run-2026-01-31T16-38-06-031Z.ndjson} +1013 -1013
  114. package/dist/providers/ai-check-provider.d.ts +9 -2
  115. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  116. package/dist/providers/command-check-provider.d.ts.map +1 -1
  117. package/dist/providers/mcp-custom-sse-server.d.ts +17 -1
  118. package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -1
  119. package/dist/providers/workflow-check-provider.d.ts.map +1 -1
  120. package/dist/providers/workflow-tool-executor.d.ts +68 -0
  121. package/dist/providers/workflow-tool-executor.d.ts.map +1 -0
  122. package/dist/sdk/{check-provider-registry-AQ3JETBG.mjs → check-provider-registry-3KI5RKXT.mjs} +6 -5
  123. package/dist/sdk/check-provider-registry-IYILYY35.mjs +28 -0
  124. package/dist/sdk/chunk-2CPMMNIX.mjs +1459 -0
  125. package/dist/sdk/chunk-2CPMMNIX.mjs.map +1 -0
  126. package/dist/sdk/chunk-5LI6T4O3.mjs +3600 -0
  127. package/dist/sdk/chunk-5LI6T4O3.mjs.map +1 -0
  128. package/dist/sdk/{chunk-YLQ4UN62.mjs → chunk-A4PGHURG.mjs} +6838 -6257
  129. package/dist/sdk/chunk-A4PGHURG.mjs.map +1 -0
  130. package/dist/sdk/chunk-EXFGO4FX.mjs +147 -0
  131. package/dist/sdk/chunk-EXFGO4FX.mjs.map +1 -0
  132. package/dist/sdk/chunk-PJ7K5UFC.mjs +17732 -0
  133. package/dist/sdk/chunk-PJ7K5UFC.mjs.map +1 -0
  134. package/dist/sdk/{chunk-BHZ4CKUS.mjs → chunk-PXFIALUH.mjs} +77 -8
  135. package/dist/sdk/chunk-PXFIALUH.mjs.map +1 -0
  136. package/dist/sdk/{chunk-PVITVJ6J.mjs → chunk-RTKJXNZS.mjs} +32 -9
  137. package/dist/sdk/chunk-RTKJXNZS.mjs.map +1 -0
  138. package/dist/sdk/chunk-VW2GBXQT.mjs +606 -0
  139. package/dist/sdk/chunk-VW2GBXQT.mjs.map +1 -0
  140. package/dist/sdk/{config-RQQPMLRD.mjs → config-5AUYQFHE.mjs} +2 -2
  141. package/dist/sdk/config-6CUVEH7H.mjs +16 -0
  142. package/dist/sdk/config-6CUVEH7H.mjs.map +1 -0
  143. package/dist/sdk/{github-frontend-6Q4BISZX.mjs → github-frontend-BZ4N3BFZ.mjs} +7 -3
  144. package/dist/sdk/github-frontend-BZ4N3BFZ.mjs.map +1 -0
  145. package/dist/sdk/host-4MT3EW2I.mjs +52 -0
  146. package/dist/sdk/{host-P5NQICP7.mjs → host-NYWXLIFC.mjs} +2 -2
  147. package/dist/sdk/host-NYWXLIFC.mjs.map +1 -0
  148. package/dist/sdk/{routing-DEY2AIXM.mjs → routing-6R42GXUO.mjs} +2 -2
  149. package/dist/sdk/routing-6R42GXUO.mjs.map +1 -0
  150. package/dist/sdk/routing-7FXPULTO.mjs +24 -0
  151. package/dist/sdk/routing-7FXPULTO.mjs.map +1 -0
  152. package/dist/sdk/sdk.d.mts +3 -1
  153. package/dist/sdk/sdk.d.ts +3 -1
  154. package/dist/sdk/sdk.js +12163 -11204
  155. package/dist/sdk/sdk.js.map +1 -1
  156. package/dist/sdk/sdk.mjs +14 -10
  157. package/dist/sdk/sdk.mjs.map +1 -1
  158. package/dist/sdk/slack-frontend-JUT3TYVC.mjs +821 -0
  159. package/dist/sdk/slack-frontend-JUT3TYVC.mjs.map +1 -0
  160. package/dist/sdk/workflow-check-provider-H3CUOLUD.mjs +28 -0
  161. package/dist/sdk/workflow-check-provider-H3CUOLUD.mjs.map +1 -0
  162. package/dist/sdk/workflow-check-provider-YUNNF4KC.mjs +28 -0
  163. package/dist/sdk/workflow-check-provider-YUNNF4KC.mjs.map +1 -0
  164. package/dist/sdk/workflow-registry-KFWSDSLM.mjs +12 -0
  165. package/dist/sdk/workflow-registry-KFWSDSLM.mjs.map +1 -0
  166. package/dist/slack/socket-runner.d.ts +2 -0
  167. package/dist/slack/socket-runner.d.ts.map +1 -1
  168. package/dist/state-machine/context/workflow-inputs.d.ts +20 -0
  169. package/dist/state-machine/context/workflow-inputs.d.ts.map +1 -0
  170. package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -1
  171. package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -1
  172. package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -1
  173. package/dist/state-machine/states/level-dispatch.d.ts.map +1 -1
  174. package/dist/state-machine/states/routing.d.ts +2 -1
  175. package/dist/state-machine/states/routing.d.ts.map +1 -1
  176. package/dist/traces/{run-2026-01-28T16-15-24-569Z.ndjson → run-2026-01-31T16-37-22-321Z.ndjson} +84 -84
  177. package/dist/traces/{run-2026-01-28T16-16-09-757Z.ndjson → run-2026-01-31T16-38-06-031Z.ndjson} +1013 -1013
  178. package/dist/types/config.d.ts +3 -1
  179. package/dist/types/config.d.ts.map +1 -1
  180. package/dist/utils/human-id.d.ts +12 -0
  181. package/dist/utils/human-id.d.ts.map +1 -0
  182. package/dist/utils/worktree-manager.d.ts +3 -0
  183. package/dist/utils/worktree-manager.d.ts.map +1 -1
  184. package/dist/workflow-executor.d.ts.map +1 -1
  185. package/dist/workflow-registry.d.ts +1 -0
  186. package/dist/workflow-registry.d.ts.map +1 -1
  187. package/package.json +2 -2
  188. package/dist/sdk/chunk-BHZ4CKUS.mjs.map +0 -1
  189. package/dist/sdk/chunk-PVITVJ6J.mjs.map +0 -1
  190. package/dist/sdk/chunk-YLQ4UN62.mjs.map +0 -1
  191. package/dist/sdk/github-frontend-6Q4BISZX.mjs.map +0 -1
  192. /package/dist/sdk/{check-provider-registry-AQ3JETBG.mjs.map → check-provider-registry-3KI5RKXT.mjs.map} +0 -0
  193. /package/dist/sdk/{config-RQQPMLRD.mjs.map → check-provider-registry-IYILYY35.mjs.map} +0 -0
  194. /package/dist/sdk/{routing-DEY2AIXM.mjs.map → config-5AUYQFHE.mjs.map} +0 -0
  195. /package/dist/sdk/{host-P5NQICP7.mjs.map → host-4MT3EW2I.mjs.map} +0 -0
@@ -1,12 +1,233 @@
1
- ## 👀 Observability
1
+ # Observability
2
2
 
3
- - Machine-readable output: `--output json` or `--output sarif`.
4
- - Prefer the built‑in `--output-file <path>` to save results without touching stdout.
5
- - Status/progress logs are written to stderr; control verbosity via `-q`, `-v`, or `--debug`.
3
+ This document provides an overview of Visor's observability features, including output formats, logging verbosity, telemetry, debugging tools, and execution statistics.
6
4
 
7
- Examples:
5
+ ## Output Formats
8
6
 
9
- ```
7
+ Visor supports four output formats for different use cases:
8
+
9
+ | Format | Flag | Description |
10
+ |--------|------|-------------|
11
+ | **table** | `--output table` | Default terminal summary with colored output (when TTY) |
12
+ | **json** | `--output json` | Machine-readable JSON for pipelines and automation |
13
+ | **markdown** | `--output markdown` | Render results as markdown (useful for PR comments) |
14
+ | **sarif** | `--output sarif` | SARIF 2.1.0 format for code scanning integrations |
15
+
16
+ ### Saving Output to Files
17
+
18
+ Use `--output-file <path>` to write formatted results directly to a file without mixing with logs:
19
+
20
+ ```bash
10
21
  visor --check all --output json --output-file results.json
11
22
  visor --check security --output sarif --output-file visor-results.sarif
23
+ visor --check architecture --output markdown --output-file report.md
24
+ ```
25
+
26
+ All status logs are sent to stderr; stdout contains only the formatted result when not using `--output-file`.
27
+
28
+ For more details, see [Output Formats](./output-formats.md).
29
+
30
+ ## Verbosity Control
31
+
32
+ Visor supports multiple log levels, from silent to debug:
33
+
34
+ | Level | Priority | Description |
35
+ |-------|----------|-------------|
36
+ | `silent` | 0 | No output |
37
+ | `error` | 10 | Errors only |
38
+ | `warn` | 20 | Warnings and errors |
39
+ | `info` | 30 | Default level - informational messages |
40
+ | `verbose` | 40 | Additional detail without full debug |
41
+ | `debug` | 50 | Full debug output including AI interactions |
42
+
43
+ ### CLI Flags
44
+
45
+ | Flag | Effect |
46
+ |------|--------|
47
+ | `-q`, `--quiet` | Reduce verbosity to warnings and errors |
48
+ | `-v`, `--verbose` | Increase verbosity without full debug |
49
+ | `--debug` | Enable debug mode for detailed output |
50
+
51
+ ### Environment Variables
52
+
53
+ | Variable | Description |
54
+ |----------|-------------|
55
+ | `VISOR_LOG_LEVEL` | Set log level (`silent`, `error`, `warn`, `info`, `verbose`, `debug`, or `quiet`) |
56
+ | `VISOR_DEBUG` | Set to `true` to enable debug mode |
57
+
58
+ ### JSON/SARIF Output Behavior
59
+
60
+ When using `--output json` or `--output sarif`, Visor automatically suppresses info and warning logs to keep stdout clean for machine-readable output. This can be overridden by explicitly setting `--verbose` or `--debug`.
61
+
62
+ ## Telemetry and Tracing
63
+
64
+ Visor supports OpenTelemetry-based telemetry for tracing and metrics.
65
+
66
+ ### Environment Variables
67
+
68
+ | Variable | Description |
69
+ |----------|-------------|
70
+ | `VISOR_TELEMETRY_ENABLED` | Set to `true` to enable telemetry |
71
+ | `VISOR_TELEMETRY_SINK` | Sink type: `file` (NDJSON), `otlp` (HTTP), or `console` |
72
+ | `VISOR_TRACE_DIR` | Directory for trace output (default: `output/traces`) |
73
+ | `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP endpoint URL for traces |
74
+ | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | OTLP endpoint specifically for traces |
75
+ | `OTEL_EXPORTER_OTLP_HEADERS` | Headers for OTLP authentication |
76
+
77
+ ### CLI Flags
78
+
79
+ | Flag | Description |
80
+ |------|-------------|
81
+ | `--telemetry` | Enable telemetry (overrides config) |
82
+ | `--telemetry-sink <sink>` | Sink selection: `otlp`, `file`, or `console` |
83
+ | `--telemetry-endpoint <url>` | OTLP endpoint (HTTP) for traces/metrics |
84
+ | `--trace-report` | Write a static HTML trace report to output/traces |
85
+ | `--auto-instrumentations` | Enable OpenTelemetry auto-instrumentations |
86
+
87
+ ### NDJSON Trace Output (Serverless Mode)
88
+
89
+ When using file sink, Visor writes simplified NDJSON spans to `output/traces/run-<timestamp>.ndjson`. These can be ingested with an OTel Collector `filelog` receiver.
90
+
91
+ ```bash
92
+ VISOR_TELEMETRY_ENABLED=true VISOR_TELEMETRY_SINK=file visor --check all
93
+ ls output/traces/*.ndjson
94
+ ```
95
+
96
+ ### OpenTelemetry OTLP Export (Connected Mode)
97
+
98
+ For real-time trace export to collectors like Jaeger or Tempo:
99
+
100
+ ```bash
101
+ VISOR_TELEMETRY_ENABLED=true \
102
+ VISOR_TELEMETRY_SINK=otlp \
103
+ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces \
104
+ visor --check all
105
+ ```
106
+
107
+ ### Configuration File
108
+
109
+ ```yaml
110
+ version: "1.0"
111
+ telemetry:
112
+ enabled: true
113
+ sink: file # otlp|file|console
114
+ otlp:
115
+ protocol: http
116
+ endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
117
+ headers: ${OTEL_EXPORTER_OTLP_HEADERS}
118
+ file:
119
+ dir: output/traces
120
+ ndjson: true
121
+ tracing:
122
+ auto_instrumentations: true
123
+ trace_report:
124
+ enabled: true
12
125
  ```
126
+
127
+ For comprehensive setup instructions, see [Telemetry Setup](./telemetry-setup.md).
128
+
129
+ ## Debug Features
130
+
131
+ ### Debug Visualizer Server
132
+
133
+ The Debug Visualizer is a lightweight HTTP server that streams OpenTelemetry spans during execution and exposes control endpoints for pause, resume, stop, and reset.
134
+
135
+ | Flag | Description |
136
+ |------|-------------|
137
+ | `--debug-server` | Start debug visualizer server for live execution visualization |
138
+ | `--debug-port <port>` | Port for debug server (default: 3456) |
139
+
140
+ ```bash
141
+ visor --config .visor.yaml --debug-server --debug-port 3456
142
+ ```
143
+
144
+ The server provides endpoints:
145
+ - `GET /api/status` - Execution state and readiness
146
+ - `GET /api/spans` - Live span stream
147
+ - `POST /api/start` - Begin execution
148
+ - `POST /api/pause` - Pause execution
149
+ - `POST /api/resume` - Resume execution
150
+ - `POST /api/stop` - Stop execution
151
+
152
+ Set `VISOR_NOBROWSER=true` for headless/CI environments.
153
+
154
+ For full details, see [Debug Visualizer](./debug-visualizer.md).
155
+
156
+ ### TUI Mode
157
+
158
+ Enable interactive terminal UI with chat and logs tabs:
159
+
160
+ ```bash
161
+ visor --tui --check all
162
+ ```
163
+
164
+ ### Debug Mode
165
+
166
+ Enable `--debug` for detailed output including:
167
+ - AI provider interactions
168
+ - Template rendering details
169
+ - Expression evaluation results
170
+ - Dependency resolution paths
171
+ - Error stack traces
172
+
173
+ For comprehensive debugging techniques, see [Debugging Guide](./debugging.md).
174
+
175
+ ## Execution Statistics
176
+
177
+ Visor tracks and displays detailed execution statistics for each run.
178
+
179
+ ### Summary Information
180
+
181
+ After execution, Visor displays:
182
+ - Total checks configured vs. total executions (including forEach iterations)
183
+ - Success, failure, and skip counts
184
+ - Total execution duration
185
+ - Issue counts by severity
186
+
187
+ ### Table Output Example
188
+
189
+ ```
190
+ Execution Complete (45.3s)
191
+ Checks: 8 configured -> 23 executions
192
+ Status: 20 success | 2 failed | 1 skipped
193
+ Issues: 15 total (3 critical, 12 warnings)
194
+
195
+ Check Details:
196
+ | Check | Duration | Status | Details |
197
+ |-----------------|----------|----------|-----------------|
198
+ | list-files | 0.5s | success | 5 outputs |
199
+ | validate-file | 12.3s | success | 5 iterations |
200
+ | security-scan | 8.2s | success | 3 critical |
201
+ | notify-slack | 2.1s | failed | HTTP 500 |
202
+ | production-only | - | skipped | if: branch==... |
203
+ ```
204
+
205
+ ### JSON Output
206
+
207
+ When using `--output json`, full `executionStatistics` object is included with:
208
+ - Per-check statistics (runs, duration, issues)
209
+ - Per-iteration timings for forEach checks
210
+ - Skip condition evaluations
211
+ - forEach item previews
212
+ - Complete error messages
213
+
214
+ ### Tracked Metrics
215
+
216
+ | Metric | Description |
217
+ |--------|-------------|
218
+ | `totalChecksConfigured` | Number of checks defined in config |
219
+ | `totalExecutions` | Sum of all runs including forEach iterations |
220
+ | `successfulExecutions` | Checks that completed without error |
221
+ | `failedExecutions` | Checks that failed |
222
+ | `skippedChecks` | Checks skipped due to conditions |
223
+ | `totalDuration` | Total execution time in milliseconds |
224
+ | Issue counts | By severity: critical, error, warning, info |
225
+
226
+ ## Related Documentation
227
+
228
+ - [Output Formats](./output-formats.md) - Detailed format specifications
229
+ - [Telemetry Setup](./telemetry-setup.md) - Complete telemetry configuration
230
+ - [Debug Visualizer](./debug-visualizer.md) - Live execution visualization
231
+ - [Debugging Guide](./debugging.md) - Debugging techniques and tips
232
+ - [Troubleshooting](./troubleshooting.md) - Common issues and solutions
233
+ - [Configuration](./configuration.md) - Full configuration reference
@@ -1,20 +1,399 @@
1
- ## 📊 Output Formats
1
+ ## Output Formats
2
2
 
3
- - Table: default terminal summary
4
- - JSON: `--output json` for pipelines
5
- - Markdown: render comments as markdown
6
- - SARIF 2.1.0: `--output sarif` for code scanning
3
+ Visor supports multiple output formats to suit different use cases, from terminal-friendly tables to machine-readable formats for CI/CD pipelines.
7
4
 
8
- ### Saving outputs reliably
5
+ ### Command-line Options
9
6
 
10
- - Use the built‑in `--output-file <path>` to write the formatted result directly to a file without mixing with logs.
11
- - All status logs are sent to stderr; stdout contains only the formatted result when not using `--output-file`.
7
+ ```bash
8
+ # Short form
9
+ visor -o json
12
10
 
13
- Examples:
11
+ # Long form
12
+ visor --output json
14
13
 
14
+ # Write to file instead of stdout
15
+ visor --output sarif --output-file results.sarif
15
16
  ```
17
+
18
+ Supported formats: `table` (default), `json`, `markdown`, `sarif`
19
+
20
+ ---
21
+
22
+ ## Table Format (Default)
23
+
24
+ The table format provides a colored, human-readable summary optimized for terminal output.
25
+
26
+ ### Structure
27
+
28
+ ```
29
+ Analysis Summary
30
+ ┌─────────────────────────┬──────────────────────────────┐
31
+ │ Metric │ Value │
32
+ ├─────────────────────────┼──────────────────────────────┤
33
+ │ Total Issues │ 5 │
34
+ │ Critical Issues │ 1 │
35
+ │ Files Analyzed │ 12 │
36
+ │ Total Additions │ 245 │
37
+ │ Total Deletions │ 89 │
38
+ │ Execution Time │ 3421ms │
39
+ │ Checks Executed │ security, performance │
40
+ └─────────────────────────┴──────────────────────────────┘
41
+
42
+ SECURITY Issues (2)
43
+ ┌─────────────────────────┬────────┬───────────────┬────────────────────────────────────────────────────────────┐
44
+ │ File │ Line │ Severity │ Message │
45
+ ├─────────────────────────┼────────┼───────────────┼────────────────────────────────────────────────────────────┤
46
+ │ src/auth.ts │ 42 │ CRITICAL │ SQL injection vulnerability in user query │
47
+ │ src/utils.ts │ 15 │ WARNING │ Potential XSS via unsanitized input │
48
+ └─────────────────────────┴────────┴───────────────┴────────────────────────────────────────────────────────────┘
49
+ ```
50
+
51
+ ### Columns
52
+
53
+ | Column | Width | Description |
54
+ |----------|-------|------------------------------------------------|
55
+ | File | 25 | Filename (truncated with `...` if too long) |
56
+ | Line | 8 | Line number of the issue |
57
+ | Severity | 15 | INFO, WARNING, ERROR, or CRITICAL |
58
+ | Message | 60 | Issue description with suggestions/code fixes |
59
+
60
+ ### Categories
61
+
62
+ Issues are grouped by category when `groupByCategory: true` (default):
63
+ - **Security** - Input validation, injection, authentication issues
64
+ - **Performance** - Optimization opportunities, resource management
65
+ - **Style** - Naming conventions, formatting inconsistencies
66
+ - **Logic** - Complexity, potential bugs, control flow issues
67
+ - **Documentation** - Missing or incomplete documentation
68
+
69
+ ### Colored Output
70
+
71
+ When output is a TTY, severity levels are colorized:
72
+ - `critical` / `error` - Red
73
+ - `warning` - Yellow
74
+ - `info` - Cyan
75
+
76
+ ### Truncation Behavior
77
+
78
+ Table cells are truncated to prevent rendering slowdowns:
79
+ - Maximum cell characters: 4000 (configurable via `VISOR_MAX_TABLE_CELL`)
80
+ - Maximum code block lines: 120 (configurable via `VISOR_MAX_TABLE_CODE_LINES`)
81
+ - Truncated content shows: `... [truncated]`
82
+
83
+ See [Output Formatting](./output-formatting.md) for detailed truncation controls.
84
+
85
+ ---
86
+
87
+ ## JSON Format
88
+
89
+ Machine-readable format ideal for programmatic processing and CI/CD pipelines.
90
+
91
+ ```bash
92
+ visor -o json --output-file results.json
93
+ ```
94
+
95
+ ### Schema
96
+
97
+ ```json
98
+ {
99
+ "summary": {
100
+ "totalIssues": 5,
101
+ "criticalIssues": 1,
102
+ "executionTime": 3421,
103
+ "timestamp": "2024-01-15T10:30:00.000Z",
104
+ "checksExecuted": ["security", "performance"]
105
+ },
106
+ "repository": {
107
+ "title": "Fix authentication flow",
108
+ "author": "developer",
109
+ "base": "main",
110
+ "head": "feature/auth-fix",
111
+ "isGitRepository": true,
112
+ "workingDirectory": "/home/user/project",
113
+ "filesChanged": 12,
114
+ "totalAdditions": 245,
115
+ "totalDeletions": 89
116
+ },
117
+ "issues": {
118
+ "security": [
119
+ {
120
+ "file": "src/auth.ts",
121
+ "line": 42,
122
+ "message": "SQL injection vulnerability in user query",
123
+ "severity": "critical",
124
+ "category": "security"
125
+ }
126
+ ],
127
+ "performance": [],
128
+ "style": [],
129
+ "logic": [],
130
+ "documentation": []
131
+ },
132
+ "files": [
133
+ {
134
+ "filename": "src/auth.ts",
135
+ "status": "modified",
136
+ "additions": 45,
137
+ "deletions": 12
138
+ }
139
+ ],
140
+ "debug": {
141
+ "provider": "openai",
142
+ "model": "gpt-4",
143
+ "processingTime": 2100,
144
+ "parallelExecution": true
145
+ },
146
+ "failureConditions": []
147
+ }
148
+ ```
149
+
150
+ ### Fields
151
+
152
+ | Field | Type | Description |
153
+ |---------------------|----------|--------------------------------------------------|
154
+ | `summary` | object | Execution metrics and totals |
155
+ | `repository` | object | Repository and PR metadata |
156
+ | `issues` | object | Issues grouped by category |
157
+ | `files` | array | Changed files with diff statistics (optional) |
158
+ | `debug` | object | Debug info when `--debug` enabled |
159
+ | `failureConditions` | array | Results of `fail_if` conditions |
160
+
161
+ ---
162
+
163
+ ## Markdown Format
164
+
165
+ GitHub-flavored markdown for embedding in PRs, wikis, or documentation.
166
+
167
+ ```bash
168
+ visor -o markdown --output-file report.md
169
+ ```
170
+
171
+ ### Structure
172
+
173
+ ```markdown
174
+ # Visor Analysis Results
175
+ <!-- analysis results -->
176
+
177
+ ## Summary
178
+
179
+ | Metric | Value |
180
+ |--------|-------|
181
+ | Total Issues | 5 |
182
+ | Critical Issues | 1 |
183
+ | Files Analyzed | 12 |
184
+ | Execution Time | 3421ms |
185
+ | Checks Executed | security, performance |
186
+
187
+ ## Repository Information
188
+
189
+ - **Title**: Fix authentication flow
190
+ - **Author**: developer
191
+ - **Branch**: feature/auth-fix <- main
192
+ - **Working Directory**: `/home/user/project`
193
+ - **Changes**: +245/-89
194
+
195
+ ## Security Issues (2 found)
196
+
197
+ ### `src/auth.ts:42`
198
+ **Severity**: CRITICAL
199
+ **Message**: SQL injection vulnerability in user query
200
+ **Suggestion**: Use parameterized queries instead of string concatenation
201
+
202
+ **Suggested Fix**:
203
+ ```typescript
204
+ const result = await db.query('SELECT * FROM users WHERE id = ?', [userId]);
205
+ ```
206
+
207
+ <details>
208
+ <summary>Show 3 more issues...</summary>
209
+ <!-- Additional issues collapsed by default -->
210
+ </details>
211
+ ```
212
+
213
+ ### Sections
214
+
215
+ 1. **Summary** - Metrics table with issue counts and execution stats
216
+ 2. **Repository Information** - PR/branch context
217
+ 3. **Issues by Category** - Grouped with severity, message, suggestions, and code fixes
218
+ 4. **Files Changed** - Optional diff statistics table
219
+
220
+ ---
221
+
222
+ ## SARIF Format
223
+
224
+ [SARIF 2.1.0](https://sarifweb.azurewebsites.net/) format for integration with GitHub Code Scanning, VS Code, and other security tools.
225
+
226
+ ```bash
227
+ visor -o sarif --output-file visor-results.sarif
228
+ ```
229
+
230
+ ### Schema
231
+
232
+ ```json
233
+ {
234
+ "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
235
+ "version": "2.1.0",
236
+ "runs": [
237
+ {
238
+ "tool": {
239
+ "driver": {
240
+ "name": "Visor",
241
+ "version": "1.0.0",
242
+ "informationUri": "https://github.com/your-org/visor",
243
+ "rules": [
244
+ {
245
+ "id": "visor-security-input-validation",
246
+ "shortDescription": { "text": "Input validation required" },
247
+ "fullDescription": { "text": "Input validation and sanitization should be implemented..." },
248
+ "helpUri": "https://owasp.org/www-project-top-ten/2017/A1_2017-Injection"
249
+ }
250
+ ]
251
+ }
252
+ },
253
+ "results": [
254
+ {
255
+ "ruleId": "visor-security-input-validation",
256
+ "ruleIndex": 0,
257
+ "level": "error",
258
+ "message": { "text": "SQL injection vulnerability in user query" },
259
+ "locations": [
260
+ {
261
+ "physicalLocation": {
262
+ "artifactLocation": {
263
+ "uri": "src/auth.ts",
264
+ "uriBaseId": "%SRCROOT%"
265
+ },
266
+ "region": {
267
+ "startLine": 42,
268
+ "startColumn": 1
269
+ }
270
+ }
271
+ }
272
+ ]
273
+ }
274
+ ]
275
+ }
276
+ ]
277
+ }
278
+ ```
279
+
280
+ ### Severity Mapping
281
+
282
+ | Visor Severity | SARIF Level |
283
+ |----------------|-------------|
284
+ | `critical` | `error` |
285
+ | `error` | `error` |
286
+ | `warning` | `warning` |
287
+ | `info` | `note` |
288
+
289
+ ### Rule IDs
290
+
291
+ | Category | Rule ID |
292
+ |---------------|----------------------------------|
293
+ | security | `visor-security-input-validation`|
294
+ | performance | `visor-performance-optimization` |
295
+ | style | `visor-style-consistency` |
296
+ | logic | `visor-logic-complexity` |
297
+ | documentation | `visor-documentation-missing` |
298
+
299
+ ---
300
+
301
+ ## Environment Variables
302
+
303
+ | Variable | Default | Description |
304
+ |-----------------------------|---------|------------------------------------------------------|
305
+ | `VISOR_OUTPUT_FORMAT` | `table` | Default output format (overridden by `-o`/`--output`)|
306
+ | `VISOR_MAX_TABLE_CELL` | `4000` | Maximum characters per table cell before truncation |
307
+ | `VISOR_MAX_TABLE_CODE_LINES`| `120` | Maximum code block lines in table cells |
308
+
309
+ Example:
310
+ ```bash
311
+ # Set default format via environment
312
+ export VISOR_OUTPUT_FORMAT=json
313
+ visor --config .visor.yaml # Uses JSON format
314
+
315
+ # Override environment with CLI flag
316
+ visor -o table --config .visor.yaml # Uses table format
317
+ ```
318
+
319
+ ---
320
+
321
+ ## Use-Case Guidance
322
+
323
+ ### When to Use Each Format
324
+
325
+ | Format | Best For |
326
+ |----------|-------------------------------------------------------------|
327
+ | Table | Interactive terminal use, quick human review |
328
+ | JSON | CI/CD pipelines, programmatic processing, API responses |
329
+ | Markdown | PR comments, documentation, reports for stakeholders |
330
+ | SARIF | GitHub Code Scanning, IDE integrations, security dashboards |
331
+
332
+ ### CI/CD Integration Patterns
333
+
334
+ **Basic CI Pipeline (JSON for parsing)**:
335
+ ```yaml
336
+ - name: Run Visor
337
+ run: |
338
+ visor -o json --output-file results.json
339
+ CRITICAL=$(jq '.summary.criticalIssues' results.json)
340
+ if [ "$CRITICAL" -gt 0 ]; then
341
+ echo "Critical issues found!"
342
+ exit 1
343
+ fi
344
+ ```
345
+
346
+ **GitHub Actions with SARIF Upload**:
347
+ ```yaml
348
+ jobs:
349
+ visor:
350
+ runs-on: ubuntu-latest
351
+ permissions:
352
+ security-events: write
353
+ steps:
354
+ - uses: actions/checkout@v4
355
+
356
+ - name: Run Visor
357
+ run: npx -y @probelabs/visor@latest -o sarif --output-file visor-results.sarif
358
+ env:
359
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
360
+
361
+ - name: Upload SARIF
362
+ uses: github/codeql-action/upload-sarif@v3
363
+ with:
364
+ sarif_file: visor-results.sarif
365
+ category: visor
366
+ ```
367
+
368
+ **PR Comment with Markdown**:
369
+ ```yaml
370
+ - name: Run Visor
371
+ run: visor -o markdown --output-file report.md
372
+
373
+ - name: Comment on PR
374
+ uses: marocchino/sticky-pull-request-comment@v2
375
+ with:
376
+ path: report.md
377
+ ```
378
+
379
+ ### Saving Output Reliably
380
+
381
+ Use `--output-file` to write results directly to a file without mixing with logs:
382
+
383
+ ```bash
16
384
  visor --check all --output json --output-file results.json
17
385
  visor --check security --output sarif --output-file visor-results.sarif
18
386
  visor --check architecture --output markdown --output-file report.md
19
387
  visor --check style --output table --output-file summary.txt
20
388
  ```
389
+
390
+ All status logs are sent to stderr; stdout contains only the formatted result when not using `--output-file`.
391
+
392
+ ---
393
+
394
+ ## Related Documentation
395
+
396
+ - [Output Formatting](./output-formatting.md) - Table safety limits and truncation controls
397
+ - [CI/CLI Mode](./ci-cli-mode.md) - Running Visor in CI environments
398
+ - [Configuration](./configuration.md) - Full configuration options
399
+ - [Failure Conditions](./fail-if.md) - Exit codes and `fail_if` conditions