@probelabs/visor 0.1.70 → 0.1.71
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 +124 -30
- package/dist/check-execution-engine.d.ts +13 -0
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/failure-condition-evaluator.d.ts +1 -1
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +566 -34
- package/dist/providers/command-check-provider.d.ts +1 -1
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/sdk/check-execution-engine-TBF6LPYH.mjs +9 -0
- package/dist/sdk/check-execution-engine-TBF6LPYH.mjs.map +1 -0
- package/dist/sdk/chunk-745RDQD3.mjs +8299 -0
- package/dist/sdk/chunk-745RDQD3.mjs.map +1 -0
- package/dist/sdk/chunk-FIL2OGF6.mjs +68 -0
- package/dist/sdk/chunk-FIL2OGF6.mjs.map +1 -0
- package/dist/sdk/chunk-U5D2LY66.mjs +245 -0
- package/dist/sdk/chunk-U5D2LY66.mjs.map +1 -0
- package/dist/sdk/chunk-WMJKH4XE.mjs +34 -0
- package/dist/sdk/chunk-WMJKH4XE.mjs.map +1 -0
- package/dist/sdk/config-merger-TWUBWFC2.mjs +8 -0
- package/dist/sdk/config-merger-TWUBWFC2.mjs.map +1 -0
- package/dist/sdk/liquid-extensions-KDECAJTV.mjs +12 -0
- package/dist/sdk/liquid-extensions-KDECAJTV.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +568 -0
- package/dist/sdk/sdk.d.ts +568 -0
- package/dist/sdk/sdk.js +9825 -0
- package/dist/sdk/sdk.js.map +1 -0
- package/dist/sdk/sdk.mjs +1006 -0
- package/dist/sdk/sdk.mjs.map +1 -0
- package/dist/sdk.d.ts +28 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/types/config.d.ts +63 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +19 -2
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for Visor configuration system
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Failure condition severity levels
|
|
7
|
+
*/
|
|
8
|
+
type FailureConditionSeverity = 'error' | 'warning' | 'info';
|
|
9
|
+
/**
|
|
10
|
+
* Simple failure condition - just an expression string
|
|
11
|
+
*/
|
|
12
|
+
type SimpleFailureCondition = string;
|
|
13
|
+
/**
|
|
14
|
+
* Complex failure condition with additional metadata
|
|
15
|
+
*/
|
|
16
|
+
interface ComplexFailureCondition {
|
|
17
|
+
/** Expression to evaluate using Function Constructor */
|
|
18
|
+
condition: string;
|
|
19
|
+
/** Human-readable message when condition is met */
|
|
20
|
+
message?: string;
|
|
21
|
+
/** Severity level of the failure */
|
|
22
|
+
severity?: FailureConditionSeverity;
|
|
23
|
+
/** Whether this condition should halt execution */
|
|
24
|
+
halt_execution?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Failure condition - can be a simple expression string or complex object
|
|
28
|
+
*/
|
|
29
|
+
type FailureCondition = SimpleFailureCondition | ComplexFailureCondition;
|
|
30
|
+
/**
|
|
31
|
+
* Collection of failure conditions
|
|
32
|
+
*/
|
|
33
|
+
interface FailureConditions {
|
|
34
|
+
[conditionName: string]: FailureCondition;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result of failure condition evaluation
|
|
38
|
+
*/
|
|
39
|
+
interface FailureConditionResult {
|
|
40
|
+
/** Name of the condition that was evaluated */
|
|
41
|
+
conditionName: string;
|
|
42
|
+
/** Whether the condition evaluated to true (failure) */
|
|
43
|
+
failed: boolean;
|
|
44
|
+
/** The expression that was evaluated */
|
|
45
|
+
expression: string;
|
|
46
|
+
/** Human-readable message */
|
|
47
|
+
message?: string;
|
|
48
|
+
/** Severity of the failure */
|
|
49
|
+
severity: FailureConditionSeverity;
|
|
50
|
+
/** Whether execution should halt */
|
|
51
|
+
haltExecution: boolean;
|
|
52
|
+
/** Error message if evaluation failed */
|
|
53
|
+
error?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Valid check types in configuration
|
|
57
|
+
*/
|
|
58
|
+
type ConfigCheckType = 'ai' | 'command' | 'http' | 'http_input' | 'http_client' | 'noop' | 'log' | 'claude-code';
|
|
59
|
+
/**
|
|
60
|
+
* Valid event triggers for checks
|
|
61
|
+
*/
|
|
62
|
+
type EventTrigger = 'pr_opened' | 'pr_updated' | 'pr_closed' | 'issue_opened' | 'issue_comment' | 'manual' | 'schedule' | 'webhook_received';
|
|
63
|
+
/**
|
|
64
|
+
* Valid output formats
|
|
65
|
+
*/
|
|
66
|
+
type ConfigOutputFormat = 'table' | 'json' | 'markdown' | 'sarif';
|
|
67
|
+
/**
|
|
68
|
+
* Tag filter configuration for selective check execution
|
|
69
|
+
*/
|
|
70
|
+
interface TagFilter {
|
|
71
|
+
/** Tags that checks must have to be included (ANY match) */
|
|
72
|
+
include?: string[];
|
|
73
|
+
/** Tags that will exclude checks if present (ANY match) */
|
|
74
|
+
exclude?: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Valid grouping options
|
|
78
|
+
*/
|
|
79
|
+
type GroupByOption = 'check' | 'file' | 'severity';
|
|
80
|
+
/**
|
|
81
|
+
* Environment variable reference configuration
|
|
82
|
+
*/
|
|
83
|
+
interface EnvConfig {
|
|
84
|
+
[key: string]: string | number | boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* AI provider configuration
|
|
88
|
+
*/
|
|
89
|
+
interface AIProviderConfig {
|
|
90
|
+
/** AI provider to use */
|
|
91
|
+
provider?: 'google' | 'anthropic' | 'openai' | 'bedrock' | 'mock';
|
|
92
|
+
/** Model name to use */
|
|
93
|
+
model?: string;
|
|
94
|
+
/** API key (usually from environment variables) */
|
|
95
|
+
apiKey?: string;
|
|
96
|
+
/** Request timeout in milliseconds */
|
|
97
|
+
timeout?: number;
|
|
98
|
+
/** Enable debug mode */
|
|
99
|
+
debug?: boolean;
|
|
100
|
+
/** MCP servers configuration */
|
|
101
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* MCP Server configuration
|
|
105
|
+
*/
|
|
106
|
+
interface McpServerConfig {
|
|
107
|
+
/** Command to execute for the MCP server */
|
|
108
|
+
command: string;
|
|
109
|
+
/** Arguments to pass to the command */
|
|
110
|
+
args?: string[];
|
|
111
|
+
/** Environment variables for the MCP server */
|
|
112
|
+
env?: Record<string, string>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Claude Code configuration
|
|
116
|
+
*/
|
|
117
|
+
interface ClaudeCodeConfig {
|
|
118
|
+
/** List of allowed tools for Claude Code to use */
|
|
119
|
+
allowedTools?: string[];
|
|
120
|
+
/** Maximum number of turns in conversation */
|
|
121
|
+
maxTurns?: number;
|
|
122
|
+
/** System prompt for Claude Code */
|
|
123
|
+
systemPrompt?: string;
|
|
124
|
+
/** MCP servers configuration */
|
|
125
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
126
|
+
/** Path to subagent script */
|
|
127
|
+
subagent?: string;
|
|
128
|
+
/** Event hooks for lifecycle management */
|
|
129
|
+
hooks?: {
|
|
130
|
+
/** Called when check starts */
|
|
131
|
+
onStart?: string;
|
|
132
|
+
/** Called when check ends */
|
|
133
|
+
onEnd?: string;
|
|
134
|
+
/** Called when check encounters an error */
|
|
135
|
+
onError?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Configuration for a single check
|
|
140
|
+
*/
|
|
141
|
+
interface CheckConfig {
|
|
142
|
+
/** Type of check to perform (defaults to 'ai' if not specified) */
|
|
143
|
+
type?: ConfigCheckType;
|
|
144
|
+
/** AI prompt for the check - can be inline string or file path (auto-detected) - required for AI checks */
|
|
145
|
+
prompt?: string;
|
|
146
|
+
/** Additional prompt to append when extending configurations - merged with parent prompt */
|
|
147
|
+
appendPrompt?: string;
|
|
148
|
+
/** Command execution with Liquid template support - required for command checks */
|
|
149
|
+
exec?: string;
|
|
150
|
+
/** Stdin input for tools with Liquid template support - optional for tool checks */
|
|
151
|
+
stdin?: string;
|
|
152
|
+
/** HTTP URL - required for http output checks */
|
|
153
|
+
url?: string;
|
|
154
|
+
/** HTTP body template (Liquid) - required for http output checks */
|
|
155
|
+
body?: string;
|
|
156
|
+
/** HTTP method (defaults to POST) */
|
|
157
|
+
method?: string;
|
|
158
|
+
/** HTTP headers */
|
|
159
|
+
headers?: Record<string, string>;
|
|
160
|
+
/** HTTP endpoint path - required for http_input checks */
|
|
161
|
+
endpoint?: string;
|
|
162
|
+
/** Transform template for http_input data (Liquid) - optional */
|
|
163
|
+
transform?: string;
|
|
164
|
+
/** Transform using JavaScript expressions (evaluated in secure sandbox) - optional */
|
|
165
|
+
transform_js?: string;
|
|
166
|
+
/** Cron schedule expression (e.g., "0 2 * * *") - optional for any check type */
|
|
167
|
+
schedule?: string;
|
|
168
|
+
/** Focus area for the check (security/performance/style/architecture/all) - optional */
|
|
169
|
+
focus?: string;
|
|
170
|
+
/** Command that triggers this check (e.g., "review", "security-scan") - optional */
|
|
171
|
+
command?: string;
|
|
172
|
+
/** Events that trigger this check (defaults to ['manual'] if not specified) */
|
|
173
|
+
on?: EventTrigger[];
|
|
174
|
+
/** File patterns that trigger this check (optional) */
|
|
175
|
+
triggers?: string[];
|
|
176
|
+
/** AI provider configuration (optional) */
|
|
177
|
+
ai?: AIProviderConfig;
|
|
178
|
+
/** AI model to use for this check - overrides global setting */
|
|
179
|
+
ai_model?: string;
|
|
180
|
+
/** AI provider to use for this check - overrides global setting */
|
|
181
|
+
ai_provider?: 'google' | 'anthropic' | 'openai' | 'bedrock' | 'mock' | string;
|
|
182
|
+
/** MCP servers for this AI check - overrides global setting */
|
|
183
|
+
ai_mcp_servers?: Record<string, McpServerConfig>;
|
|
184
|
+
/** Claude Code configuration (for claude-code type checks) */
|
|
185
|
+
claude_code?: ClaudeCodeConfig;
|
|
186
|
+
/** Environment variables for this check */
|
|
187
|
+
env?: EnvConfig;
|
|
188
|
+
/** Check IDs that this check depends on (optional) */
|
|
189
|
+
depends_on?: string[];
|
|
190
|
+
/** Group name for comment separation (e.g., "code-review", "pr-overview") - optional */
|
|
191
|
+
group?: string;
|
|
192
|
+
/** Schema type for template rendering (e.g., "code-review", "markdown") or inline JSON schema object - optional */
|
|
193
|
+
schema?: string | Record<string, unknown>;
|
|
194
|
+
/** Custom template configuration - optional */
|
|
195
|
+
template?: CustomTemplateConfig;
|
|
196
|
+
/** Condition to determine if check should run - runs if expression evaluates to true */
|
|
197
|
+
if?: string;
|
|
198
|
+
/** Whether to reuse AI session from dependency checks (only works with depends_on) */
|
|
199
|
+
reuse_ai_session?: boolean;
|
|
200
|
+
/** Simple fail condition - fails check if expression evaluates to true */
|
|
201
|
+
fail_if?: string;
|
|
202
|
+
/** Check-specific failure conditions - optional (deprecated, use fail_if) */
|
|
203
|
+
failure_conditions?: FailureConditions;
|
|
204
|
+
/** Tags for categorizing and filtering checks (e.g., ["local", "fast", "security"]) */
|
|
205
|
+
tags?: string[];
|
|
206
|
+
/** Process output as array and run dependent checks for each item */
|
|
207
|
+
forEach?: boolean;
|
|
208
|
+
/** Failure routing configuration for this check (retry/goto/run) */
|
|
209
|
+
on_fail?: OnFailConfig;
|
|
210
|
+
/** Success routing configuration for this check (post-actions and optional goto) */
|
|
211
|
+
on_success?: OnSuccessConfig;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Backoff policy for retries
|
|
215
|
+
*/
|
|
216
|
+
interface BackoffPolicy {
|
|
217
|
+
/** Backoff mode */
|
|
218
|
+
mode?: 'fixed' | 'exponential';
|
|
219
|
+
/** Initial delay in milliseconds */
|
|
220
|
+
delay_ms?: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Retry policy for a step
|
|
224
|
+
*/
|
|
225
|
+
interface RetryPolicy {
|
|
226
|
+
/** Maximum retry attempts (excluding the first attempt) */
|
|
227
|
+
max?: number;
|
|
228
|
+
/** Backoff policy */
|
|
229
|
+
backoff?: BackoffPolicy;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Failure routing configuration per check
|
|
233
|
+
*/
|
|
234
|
+
interface OnFailConfig {
|
|
235
|
+
/** Retry policy */
|
|
236
|
+
retry?: RetryPolicy;
|
|
237
|
+
/** Remediation steps to run before reattempt */
|
|
238
|
+
run?: string[];
|
|
239
|
+
/** Jump back to an ancestor step (by id) */
|
|
240
|
+
goto?: string;
|
|
241
|
+
/** Dynamic goto: JS expression returning step id or null */
|
|
242
|
+
goto_js?: string;
|
|
243
|
+
/** Dynamic remediation list: JS expression returning string[] */
|
|
244
|
+
run_js?: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Success routing configuration per check
|
|
248
|
+
*/
|
|
249
|
+
interface OnSuccessConfig {
|
|
250
|
+
/** Post-success steps to run */
|
|
251
|
+
run?: string[];
|
|
252
|
+
/** Optional jump back to ancestor step (by id) */
|
|
253
|
+
goto?: string;
|
|
254
|
+
/** Dynamic goto: JS expression returning step id or null */
|
|
255
|
+
goto_js?: string;
|
|
256
|
+
/** Dynamic post-success steps: JS expression returning string[] */
|
|
257
|
+
run_js?: string;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Global routing defaults
|
|
261
|
+
*/
|
|
262
|
+
interface RoutingDefaults {
|
|
263
|
+
/** Per-scope cap on routing transitions (success + failure) */
|
|
264
|
+
max_loops?: number;
|
|
265
|
+
/** Default policies applied to checks (step-level overrides take precedence) */
|
|
266
|
+
defaults?: {
|
|
267
|
+
on_fail?: OnFailConfig;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Custom template configuration
|
|
272
|
+
*/
|
|
273
|
+
interface CustomTemplateConfig {
|
|
274
|
+
/** Path to custom template file (relative to config file or absolute) */
|
|
275
|
+
file?: string;
|
|
276
|
+
/** Raw template content as string */
|
|
277
|
+
content?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Debug mode configuration
|
|
281
|
+
*/
|
|
282
|
+
interface DebugConfig {
|
|
283
|
+
/** Enable debug mode */
|
|
284
|
+
enabled: boolean;
|
|
285
|
+
/** Include AI prompts in debug output */
|
|
286
|
+
includePrompts: boolean;
|
|
287
|
+
/** Include raw AI responses in debug output */
|
|
288
|
+
includeRawResponses: boolean;
|
|
289
|
+
/** Include timing information */
|
|
290
|
+
includeTiming: boolean;
|
|
291
|
+
/** Include provider information */
|
|
292
|
+
includeProviderInfo: boolean;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* PR comment output configuration
|
|
296
|
+
*/
|
|
297
|
+
interface PrCommentOutput {
|
|
298
|
+
/** Format of the output */
|
|
299
|
+
format: ConfigOutputFormat;
|
|
300
|
+
/** How to group the results */
|
|
301
|
+
group_by: GroupByOption;
|
|
302
|
+
/** Whether to collapse sections by default */
|
|
303
|
+
collapse: boolean;
|
|
304
|
+
/** Debug mode configuration (optional) */
|
|
305
|
+
debug?: DebugConfig;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* File comment output configuration
|
|
309
|
+
*/
|
|
310
|
+
interface FileCommentOutput {
|
|
311
|
+
/** Whether file comments are enabled */
|
|
312
|
+
enabled: boolean;
|
|
313
|
+
/** Whether to show inline comments */
|
|
314
|
+
inline: boolean;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* GitHub Check Runs output configuration
|
|
318
|
+
*/
|
|
319
|
+
interface GitHubCheckOutput {
|
|
320
|
+
/** Whether GitHub check runs are enabled */
|
|
321
|
+
enabled: boolean;
|
|
322
|
+
/** Whether to create individual check runs per configured check */
|
|
323
|
+
per_check: boolean;
|
|
324
|
+
/** Custom name prefix for check runs */
|
|
325
|
+
name_prefix?: string;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Output configuration
|
|
329
|
+
*/
|
|
330
|
+
interface OutputConfig {
|
|
331
|
+
/** PR comment configuration */
|
|
332
|
+
pr_comment: PrCommentOutput;
|
|
333
|
+
/** File comment configuration (optional) */
|
|
334
|
+
file_comment?: FileCommentOutput;
|
|
335
|
+
/** GitHub check runs configuration (optional) */
|
|
336
|
+
github_checks?: GitHubCheckOutput;
|
|
337
|
+
/** Whether to enable issue suppression via visor-disable comments (default: true) */
|
|
338
|
+
suppressionEnabled?: boolean;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* HTTP server authentication configuration
|
|
342
|
+
*/
|
|
343
|
+
interface HttpAuthConfig {
|
|
344
|
+
/** Authentication type */
|
|
345
|
+
type: 'bearer_token' | 'hmac' | 'basic' | 'none';
|
|
346
|
+
/** Secret or token for authentication */
|
|
347
|
+
secret?: string;
|
|
348
|
+
/** Username for basic auth */
|
|
349
|
+
username?: string;
|
|
350
|
+
/** Password for basic auth */
|
|
351
|
+
password?: string;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* HTTP server endpoint configuration
|
|
355
|
+
*/
|
|
356
|
+
interface HttpEndpointConfig {
|
|
357
|
+
/** Path for the webhook endpoint */
|
|
358
|
+
path: string;
|
|
359
|
+
/** Optional transform template (Liquid) for the received data */
|
|
360
|
+
transform?: string;
|
|
361
|
+
/** Optional name/ID for this endpoint */
|
|
362
|
+
name?: string;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* TLS/SSL configuration for HTTPS server
|
|
366
|
+
*/
|
|
367
|
+
interface TlsConfig {
|
|
368
|
+
/** Enable TLS/HTTPS */
|
|
369
|
+
enabled: boolean;
|
|
370
|
+
/** Path to TLS certificate file or certificate content */
|
|
371
|
+
cert?: string;
|
|
372
|
+
/** Path to TLS key file or key content */
|
|
373
|
+
key?: string;
|
|
374
|
+
/** Path to CA certificate file or CA content (optional) */
|
|
375
|
+
ca?: string;
|
|
376
|
+
/** Reject unauthorized connections (default: true) */
|
|
377
|
+
rejectUnauthorized?: boolean;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* HTTP server configuration for receiving webhooks
|
|
381
|
+
*/
|
|
382
|
+
interface HttpServerConfig {
|
|
383
|
+
/** Whether HTTP server is enabled */
|
|
384
|
+
enabled: boolean;
|
|
385
|
+
/** Port to listen on */
|
|
386
|
+
port: number;
|
|
387
|
+
/** Host/IP to bind to (defaults to 0.0.0.0) */
|
|
388
|
+
host?: string;
|
|
389
|
+
/** TLS/SSL configuration for HTTPS */
|
|
390
|
+
tls?: TlsConfig;
|
|
391
|
+
/** Authentication configuration */
|
|
392
|
+
auth?: HttpAuthConfig;
|
|
393
|
+
/** HTTP endpoints configuration */
|
|
394
|
+
endpoints?: HttpEndpointConfig[];
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Main Visor configuration
|
|
398
|
+
*/
|
|
399
|
+
interface VisorConfig {
|
|
400
|
+
/** Configuration version */
|
|
401
|
+
version: string;
|
|
402
|
+
/** Extends from other configurations - can be file path, HTTP(S) URL, or "default" */
|
|
403
|
+
extends?: string | string[];
|
|
404
|
+
/** Check configurations */
|
|
405
|
+
checks: Record<string, CheckConfig>;
|
|
406
|
+
/** Output configuration */
|
|
407
|
+
output: OutputConfig;
|
|
408
|
+
/** HTTP server configuration for receiving webhooks */
|
|
409
|
+
http_server?: HttpServerConfig;
|
|
410
|
+
/** Global environment variables */
|
|
411
|
+
env?: EnvConfig;
|
|
412
|
+
/** Global AI model setting */
|
|
413
|
+
ai_model?: string;
|
|
414
|
+
/** Global AI provider setting */
|
|
415
|
+
ai_provider?: 'google' | 'anthropic' | 'openai' | 'bedrock' | 'mock' | 'claude-code' | string;
|
|
416
|
+
/** Global MCP servers configuration for AI checks */
|
|
417
|
+
ai_mcp_servers?: Record<string, McpServerConfig>;
|
|
418
|
+
/** Maximum number of checks to run in parallel (default: 3) */
|
|
419
|
+
max_parallelism?: number;
|
|
420
|
+
/** Stop execution when any check fails (default: false) */
|
|
421
|
+
fail_fast?: boolean;
|
|
422
|
+
/** Simple global fail condition - fails if expression evaluates to true */
|
|
423
|
+
fail_if?: string;
|
|
424
|
+
/** Global failure conditions - optional (deprecated, use fail_if) */
|
|
425
|
+
failure_conditions?: FailureConditions;
|
|
426
|
+
/** Tag filter for selective check execution */
|
|
427
|
+
tag_filter?: TagFilter;
|
|
428
|
+
/** Optional routing defaults for retry/goto/run policies */
|
|
429
|
+
routing?: RoutingDefaults;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
interface AIDebugInfo {
|
|
433
|
+
/** The prompt sent to the AI */
|
|
434
|
+
prompt: string;
|
|
435
|
+
/** Raw response from the AI service */
|
|
436
|
+
rawResponse: string;
|
|
437
|
+
/** Provider used (google, anthropic, openai) */
|
|
438
|
+
provider: string;
|
|
439
|
+
/** Model used */
|
|
440
|
+
model: string;
|
|
441
|
+
/** API key source (for privacy, just show which env var) */
|
|
442
|
+
apiKeySource: string;
|
|
443
|
+
/** Processing time in milliseconds */
|
|
444
|
+
processingTime: number;
|
|
445
|
+
/** Prompt length in characters */
|
|
446
|
+
promptLength: number;
|
|
447
|
+
/** Response length in characters */
|
|
448
|
+
responseLength: number;
|
|
449
|
+
/** Any errors encountered */
|
|
450
|
+
errors?: string[];
|
|
451
|
+
/** Whether JSON parsing succeeded */
|
|
452
|
+
jsonParseSuccess: boolean;
|
|
453
|
+
/** Schema used for response validation */
|
|
454
|
+
schema?: string;
|
|
455
|
+
/** Schema name/type requested */
|
|
456
|
+
schemaName?: string;
|
|
457
|
+
/** Checks executed during this review */
|
|
458
|
+
checksExecuted?: string[];
|
|
459
|
+
/** Whether parallel execution was used */
|
|
460
|
+
parallelExecution?: boolean;
|
|
461
|
+
/** Timestamp when request was made */
|
|
462
|
+
timestamp: string;
|
|
463
|
+
/** Total API calls made */
|
|
464
|
+
totalApiCalls?: number;
|
|
465
|
+
/** Details about API calls made */
|
|
466
|
+
apiCallDetails?: Array<{
|
|
467
|
+
checkName: string;
|
|
468
|
+
provider: string;
|
|
469
|
+
model: string;
|
|
470
|
+
processingTime: number;
|
|
471
|
+
success: boolean;
|
|
472
|
+
}>;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface ReviewIssue {
|
|
476
|
+
file: string;
|
|
477
|
+
line: number;
|
|
478
|
+
endLine?: number;
|
|
479
|
+
ruleId: string;
|
|
480
|
+
message: string;
|
|
481
|
+
severity: 'info' | 'warning' | 'error' | 'critical';
|
|
482
|
+
category: 'security' | 'performance' | 'style' | 'logic' | 'documentation';
|
|
483
|
+
checkName?: string;
|
|
484
|
+
group?: string;
|
|
485
|
+
schema?: string;
|
|
486
|
+
timestamp?: number;
|
|
487
|
+
suggestion?: string;
|
|
488
|
+
replacement?: string;
|
|
489
|
+
}
|
|
490
|
+
interface ReviewSummary {
|
|
491
|
+
issues?: ReviewIssue[];
|
|
492
|
+
debug?: AIDebugInfo;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface GitFileChange {
|
|
496
|
+
filename: string;
|
|
497
|
+
status: 'added' | 'removed' | 'modified' | 'renamed';
|
|
498
|
+
additions: number;
|
|
499
|
+
deletions: number;
|
|
500
|
+
changes: number;
|
|
501
|
+
content?: string;
|
|
502
|
+
patch?: string;
|
|
503
|
+
}
|
|
504
|
+
interface GitRepositoryInfo {
|
|
505
|
+
title: string;
|
|
506
|
+
body: string;
|
|
507
|
+
author: string;
|
|
508
|
+
base: string;
|
|
509
|
+
head: string;
|
|
510
|
+
files: GitFileChange[];
|
|
511
|
+
totalAdditions: number;
|
|
512
|
+
totalDeletions: number;
|
|
513
|
+
isGitRepository: boolean;
|
|
514
|
+
workingDirectory: string;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
interface AnalysisResult {
|
|
518
|
+
repositoryInfo: GitRepositoryInfo;
|
|
519
|
+
reviewSummary: ReviewSummary;
|
|
520
|
+
executionTime: number;
|
|
521
|
+
timestamp: string;
|
|
522
|
+
checksExecuted: string[];
|
|
523
|
+
debug?: DebugInfo;
|
|
524
|
+
failureConditions?: FailureConditionResult[];
|
|
525
|
+
}
|
|
526
|
+
interface DebugInfo {
|
|
527
|
+
provider?: string;
|
|
528
|
+
model?: string;
|
|
529
|
+
processingTime?: number;
|
|
530
|
+
parallelExecution?: boolean;
|
|
531
|
+
checksExecuted?: string[];
|
|
532
|
+
totalApiCalls?: number;
|
|
533
|
+
apiCallDetails?: Array<{
|
|
534
|
+
checkName: string;
|
|
535
|
+
provider: string;
|
|
536
|
+
model: string;
|
|
537
|
+
processingTime: number;
|
|
538
|
+
success: boolean;
|
|
539
|
+
}>;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
interface VisorOptions {
|
|
543
|
+
cwd?: string;
|
|
544
|
+
debug?: boolean;
|
|
545
|
+
maxParallelism?: number;
|
|
546
|
+
failFast?: boolean;
|
|
547
|
+
tagFilter?: TagFilter;
|
|
548
|
+
}
|
|
549
|
+
interface RunOptions extends VisorOptions {
|
|
550
|
+
config?: VisorConfig;
|
|
551
|
+
configPath?: string;
|
|
552
|
+
checks?: string[];
|
|
553
|
+
timeoutMs?: number;
|
|
554
|
+
output?: {
|
|
555
|
+
format?: 'table' | 'json' | 'markdown' | 'sarif';
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
/** Load a Visor config from path, or discover defaults if path is omitted. */
|
|
559
|
+
declare function loadConfig(configPath?: string): Promise<VisorConfig>;
|
|
560
|
+
/** Expand check IDs by including their dependencies (shallow->deep). */
|
|
561
|
+
declare function resolveChecks(checkIds: string[], config: VisorConfig | undefined): string[];
|
|
562
|
+
/**
|
|
563
|
+
* Run Visor checks programmatically. Returns the same AnalysisResult shape used by the CLI.
|
|
564
|
+
* Thin wrapper around CheckExecutionEngine.executeChecks.
|
|
565
|
+
*/
|
|
566
|
+
declare function runChecks(opts?: RunOptions): Promise<AnalysisResult>;
|
|
567
|
+
|
|
568
|
+
export { type RunOptions, type TagFilter, type VisorConfig, type VisorOptions, loadConfig, resolveChecks, runChecks };
|