@probelabs/visor 0.1.36 → 0.1.38
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 +859 -59
- package/action.yml +10 -0
- package/defaults/.visor.yaml +69 -13
- package/dist/action-cli-bridge.d.ts +2 -0
- package/dist/action-cli-bridge.d.ts.map +1 -1
- package/dist/ai-review-service.d.ts +5 -1
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts +14 -1
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/cron-scheduler.d.ts +66 -0
- package/dist/cron-scheduler.d.ts.map +1 -0
- package/dist/defaults/.visor.yaml +69 -13
- package/dist/event-mapper.d.ts.map +1 -1
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +107335 -75687
- package/dist/output/code-review/schema.json +1 -1
- package/dist/pr-analyzer.d.ts +8 -0
- package/dist/pr-analyzer.d.ts.map +1 -1
- package/dist/providers/ai-check-provider.d.ts +8 -0
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/dist/providers/check-provider-registry.d.ts.map +1 -1
- package/dist/providers/check-provider.interface.d.ts +7 -7
- package/dist/providers/check-provider.interface.d.ts.map +1 -1
- package/dist/providers/claude-code-check-provider.d.ts +68 -0
- package/dist/providers/claude-code-check-provider.d.ts.map +1 -0
- package/dist/providers/claude-code-types.d.ts +68 -0
- package/dist/providers/claude-code-types.d.ts.map +1 -0
- package/dist/providers/{webhook-check-provider.d.ts → http-check-provider.d.ts} +6 -4
- package/dist/providers/http-check-provider.d.ts.map +1 -0
- package/dist/providers/http-client-provider.d.ts +22 -0
- package/dist/providers/http-client-provider.d.ts.map +1 -0
- package/dist/providers/http-input-provider.d.ts +27 -0
- package/dist/providers/http-input-provider.d.ts.map +1 -0
- package/dist/providers/index.d.ts +6 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts +29 -0
- package/dist/providers/log-check-provider.d.ts.map +1 -0
- package/dist/providers/mcp-tools.d.ts +106 -0
- package/dist/providers/mcp-tools.d.ts.map +1 -0
- package/dist/providers/tool-check-provider.d.ts.map +1 -1
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +136 -8
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-merger.d.ts.map +1 -1
- package/dist/webhook-server.d.ts +93 -0
- package/dist/webhook-server.d.ts.map +1 -0
- package/package.json +16 -2
- package/dist/providers/webhook-check-provider.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -12,25 +12,59 @@
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
Visor ships with a ready-to-run configuration at `defaults/.visor.yaml`, so you immediately get:
|
|
16
|
+
- A staged review pipeline (`overview → security → performance → quality → style`) that keeps AI context alive via session reuse while running checks sequentially (`max_parallelism: 1`).
|
|
17
|
+
- Automatic failures whenever any check surfaces `critical` or `error` issues through the bundled `fail_if` guard.
|
|
18
|
+
- Comment-driven automation: `/review` reruns the suite on demand and `/ask` engages an embedded issue assistant for triage.
|
|
19
|
+
- A manual release-notes generator you can trigger in tagged release workflows.
|
|
20
|
+
|
|
15
21
|
## 🚀 Quick Start
|
|
16
22
|
|
|
23
|
+
### Table of Contents
|
|
24
|
+
- [Quick Start](#-quick-start)
|
|
25
|
+
- [Features](#-features)
|
|
26
|
+
- [Developer Experience Playbook](#-developer-experience-playbook)
|
|
27
|
+
- [Tag-Based Filtering](#-tag-based-check-filtering)
|
|
28
|
+
- [PR Comment Commands](#-pr-comment-commands)
|
|
29
|
+
- [Suppress Warnings](#-suppressing-warnings)
|
|
30
|
+
- [CLI Usage](#-cli-usage)
|
|
31
|
+
- [AI Configuration](#-ai-configuration)
|
|
32
|
+
- [MCP Support](#-mcp-model-context-protocol-support-for-ai-providers)
|
|
33
|
+
- [Step Dependencies](#-step-dependencies--intelligent-execution)
|
|
34
|
+
- [Troubleshooting](#-troubleshooting)
|
|
35
|
+
- [Security Defaults](#-security-defaults)
|
|
36
|
+
- [Performance & Cost](#-performance--cost-controls)
|
|
37
|
+
- [Observability](#-observability)
|
|
38
|
+
- [Examples & Recipes](#-examples--recipes)
|
|
39
|
+
- [Contributing](#-contributing)
|
|
40
|
+
|
|
17
41
|
### As GitHub Action (Recommended)
|
|
18
42
|
|
|
19
43
|
Create `.github/workflows/code-review.yml`:
|
|
20
44
|
|
|
21
|
-
#### Option 1: Using GitHub Token (Default)
|
|
22
45
|
```yaml
|
|
23
46
|
name: Code Review
|
|
24
|
-
on:
|
|
47
|
+
on:
|
|
48
|
+
pull_request:
|
|
25
49
|
|
|
26
50
|
jobs:
|
|
27
51
|
review:
|
|
28
52
|
runs-on: ubuntu-latest
|
|
53
|
+
permissions:
|
|
54
|
+
pull-requests: write
|
|
55
|
+
contents: read
|
|
29
56
|
steps:
|
|
30
57
|
- uses: actions/checkout@v4
|
|
31
|
-
- uses:
|
|
58
|
+
- uses: actions/setup-node@v4
|
|
32
59
|
with:
|
|
33
|
-
|
|
60
|
+
node-version: 20
|
|
61
|
+
cache: npm
|
|
62
|
+
- uses: ./ # or: gates-ai/visor-action@v1
|
|
63
|
+
# Optional: run Visor as a GitHub App instead of the workflow token identity
|
|
64
|
+
# with:
|
|
65
|
+
# app-id: ${{ secrets.VISOR_APP_ID }}
|
|
66
|
+
# private-key: ${{ secrets.VISOR_APP_PRIVATE_KEY }}
|
|
67
|
+
# installation-id: ${{ secrets.VISOR_APP_INSTALLATION_ID }}
|
|
34
68
|
env:
|
|
35
69
|
# Choose one AI provider (see AI Configuration below)
|
|
36
70
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
@@ -38,43 +72,20 @@ jobs:
|
|
|
38
72
|
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
39
73
|
```
|
|
40
74
|
|
|
41
|
-
|
|
42
|
-
For better security and to have comments appear from your custom GitHub App:
|
|
75
|
+
The default `GITHUB_TOKEN` already exists in every workflow run, so you do **not** need to create a secret for it. Switch to a GitHub App when you want a dedicated bot identity, granular repo access, or org-wide deployment.
|
|
43
76
|
|
|
44
|
-
|
|
45
|
-
name: Code Review with GitHub App
|
|
46
|
-
on: pull_request
|
|
77
|
+
If you don't commit a `.visor.yaml` yet, Visor automatically loads `defaults/.visor.yaml`, giving your team the full overview → security → performance → quality → style pipeline, critical/error failure stop, `/review` orchestration, and the optional release-notes check out of the box.
|
|
47
78
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
runs-on: ubuntu-latest
|
|
51
|
-
steps:
|
|
52
|
-
- uses: actions/checkout@v4
|
|
53
|
-
- uses: ./ # or: gates-ai/visor-action@v1
|
|
54
|
-
with:
|
|
55
|
-
app-id: ${{ secrets.APP_ID }}
|
|
56
|
-
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
57
|
-
# installation-id: ${{ secrets.APP_INSTALLATION_ID }} # Optional, auto-detected
|
|
58
|
-
env:
|
|
59
|
-
# Choose one AI provider (see AI Configuration below)
|
|
60
|
-
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
61
|
-
# ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
62
|
-
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**Setting up GitHub App:**
|
|
66
|
-
1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) with these permissions:
|
|
79
|
+
**Optional GitHub App setup:**
|
|
80
|
+
1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) with:
|
|
67
81
|
- **Pull requests**: Read & Write
|
|
68
|
-
- **Issues**: Write
|
|
82
|
+
- **Issues**: Write
|
|
69
83
|
- **Metadata**: Read
|
|
70
|
-
2. Generate and
|
|
71
|
-
3. Install the app on
|
|
72
|
-
4. Add
|
|
73
|
-
- `APP_ID`: Your GitHub App's ID
|
|
74
|
-
- `APP_PRIVATE_KEY`: The private key you downloaded (entire contents)
|
|
75
|
-
- `APP_INSTALLATION_ID`: (Optional) The installation ID for this repository
|
|
84
|
+
2. Generate and store the private key securely.
|
|
85
|
+
3. Install the app on the repositories (or org) you want Visor to review.
|
|
86
|
+
4. Add secrets for `VISOR_APP_ID`, `VISOR_APP_PRIVATE_KEY`, and optionally `VISOR_APP_INSTALLATION_ID` if you don't want auto-detection.
|
|
76
87
|
|
|
77
|
-
|
|
88
|
+
Visor will now review pull requests automatically in the environments you configure.
|
|
78
89
|
|
|
79
90
|
#### Advanced Configuration Options
|
|
80
91
|
|
|
@@ -91,7 +102,6 @@ jobs:
|
|
|
91
102
|
- uses: actions/checkout@v4
|
|
92
103
|
- uses: ./ # or: gates-ai/visor-action@v1
|
|
93
104
|
with:
|
|
94
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
95
105
|
max-parallelism: '5' # Run up to 5 checks in parallel
|
|
96
106
|
fail-fast: 'true' # Stop on first failure
|
|
97
107
|
checks: 'security,performance' # Run specific checks only
|
|
@@ -102,31 +112,308 @@ jobs:
|
|
|
102
112
|
### As CLI Tool
|
|
103
113
|
|
|
104
114
|
```bash
|
|
105
|
-
#
|
|
115
|
+
# Install dependencies
|
|
106
116
|
npm install
|
|
117
|
+
|
|
118
|
+
# Build TypeScript sources (required when running from a clone)
|
|
107
119
|
npm run build
|
|
108
120
|
|
|
109
|
-
# Run analysis
|
|
110
|
-
|
|
121
|
+
# Run analysis from the compiled dist bundle
|
|
122
|
+
node dist/index.js --cli --check all
|
|
111
123
|
|
|
112
|
-
#
|
|
113
|
-
|
|
124
|
+
# Or use the published package without building
|
|
125
|
+
npx @probelabs/visor --check security --output json
|
|
114
126
|
|
|
115
|
-
#
|
|
116
|
-
|
|
127
|
+
# Point to a custom config file
|
|
128
|
+
npx @probelabs/visor --config custom.yaml --check all
|
|
117
129
|
```
|
|
118
130
|
|
|
131
|
+
> Tip: `node dist/index.js --cli` forces CLI mode even inside GitHub Action environments. Install the package globally (`npm install --global @probelabs/visor`) if you prefer calling the `visor` binary directly.
|
|
132
|
+
|
|
119
133
|
## ✨ Features
|
|
120
134
|
|
|
121
135
|
- **Automated PR Reviews** - Analyzes code changes and posts review comments
|
|
122
136
|
- **Schema-Template System** - Flexible data validation with JSON Schema and Liquid templating
|
|
123
137
|
- **Group-Based Comments** - Multiple GitHub comments organized by check groups
|
|
124
138
|
- **Multiple Check Types** - Security, performance, style, and architecture analysis
|
|
125
|
-
- **Flexible Output** - Table, JSON, Markdown, or SARIF format
|
|
139
|
+
- **Flexible Output** - Table, JSON, Markdown, or SARIF format (SARIF emits standard 2.1.0)
|
|
126
140
|
- **Step Dependencies** - Define execution order with `depends_on` relationships
|
|
127
141
|
- **PR Commands** - Trigger reviews with `/review` comments
|
|
128
142
|
- **GitHub Integration** - Creates check runs, adds labels, posts comments
|
|
129
143
|
- **Warning Suppression** - Suppress false positives with `visor-disable` comments
|
|
144
|
+
- **Tag-Based Filtering** - Run subsets of checks based on tags for different execution profiles
|
|
145
|
+
|
|
146
|
+
## 🧭 Developer Experience Playbook
|
|
147
|
+
|
|
148
|
+
- **Start with the shipping defaults** – Copy `dist/defaults/.visor.yaml` (after `npm run build`) or `examples/quick-start-tags.yaml` into your repo as `.visor.yaml`, run `npx @probelabs/visor --check all --debug`, and commit both the config and observed baseline so every contributor shares the same playbook.
|
|
149
|
+
- **Treat configuration as code** – Review config edits in PRs, version Liquid prompt templates under `prompts/`, and pin AI provider/model in config to keep reviews reproducible.
|
|
150
|
+
- **Roll out checks gradually** – Use tag filters (`local`, `fast`, `critical`) to gate heavier analysis behind branch rules and to stage new checks on a subset of teams before rolling out widely.
|
|
151
|
+
- **Secure your credentials** – Prefer GitHub App auth in production for clearer audit trails; fall back to repo `GITHUB_TOKEN` only for sandboxes. Scope AI API keys to review-only projects and rotate them with GitHub secret scanning alerts enabled.
|
|
152
|
+
- **Make feedback actionable** – Group related checks, enable `reuse_ai_session` for multi-turn follow-ups, and add `/review --check performance` comment triggers so reviewers can pull deeper insights on demand.
|
|
153
|
+
- **Keep suppressions intentional** – Use `visor-disable` sparingly, add context in the adjacent comment, and review `visor-disable-file` entries during quarterly hygiene passes to avoid silencing real regressions.
|
|
154
|
+
- **Validate locally before CI** – Reproduce findings with `node dist/index.js --cli --check security --output markdown`, run `npm test` for guardrails, and enable `--fail-fast` in fast lanes to surface blocking issues instantly.
|
|
155
|
+
|
|
156
|
+
## 📚 Examples & Recipes
|
|
157
|
+
|
|
158
|
+
- Minimal `.visor.yaml` starter
|
|
159
|
+
```yaml
|
|
160
|
+
version: "1.0"
|
|
161
|
+
checks:
|
|
162
|
+
security:
|
|
163
|
+
type: ai
|
|
164
|
+
schema: code-review
|
|
165
|
+
prompt: "Identify security vulnerabilities in changed files"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- Fast local pre-commit hook (Husky)
|
|
169
|
+
```bash
|
|
170
|
+
npx husky add .husky/pre-commit "npx @probelabs/visor --tags local,fast --output table || exit 1"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
- Deep dives and integrations
|
|
174
|
+
- docs/NPM_USAGE.md – CLI usage and flags
|
|
175
|
+
- GITHUB_CHECKS.md – Checks, outputs, and workflow integration
|
|
176
|
+
- examples/ – MCP, Jira, and advanced configs
|
|
177
|
+
|
|
178
|
+
## 🤝 Contributing
|
|
179
|
+
|
|
180
|
+
- Requirements: Node.js 18+ (20 recommended) and npm.
|
|
181
|
+
- Install and build: `npm install && npm run build`
|
|
182
|
+
- Test: `npm test` (watch: `npm run test:watch`, coverage: `npm run test:coverage`)
|
|
183
|
+
- Lint/format: `npm run lint` / `npm run lint:fix` and `npm run format`
|
|
184
|
+
- Before opening PRs: run the test suite and ensure README examples remain accurate.
|
|
185
|
+
|
|
186
|
+
Releases are handled via `scripts/release.sh` and follow semver.
|
|
187
|
+
|
|
188
|
+
## 🏷️ Tag-Based Check Filtering
|
|
189
|
+
|
|
190
|
+
Visor supports tagging checks to create flexible execution profiles. This allows you to run different sets of checks in different environments (e.g., lightweight checks locally, comprehensive checks in CI).
|
|
191
|
+
|
|
192
|
+
### How It Works
|
|
193
|
+
|
|
194
|
+
1. **Tag your checks** with descriptive labels
|
|
195
|
+
2. **Filter execution** using `--tags` and `--exclude-tags` parameters
|
|
196
|
+
3. **Dependencies work intelligently** - they use what's available after filtering
|
|
197
|
+
|
|
198
|
+
### Basic Configuration
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
# .visor.yaml
|
|
202
|
+
version: "1.0"
|
|
203
|
+
|
|
204
|
+
checks:
|
|
205
|
+
# Fast, local security check
|
|
206
|
+
security-quick:
|
|
207
|
+
type: ai
|
|
208
|
+
prompt: "Quick security scan for common vulnerabilities"
|
|
209
|
+
tags: ["local", "fast", "security"]
|
|
210
|
+
on: [pr_opened, pr_updated]
|
|
211
|
+
|
|
212
|
+
# Comprehensive security analysis (for CI)
|
|
213
|
+
security-comprehensive:
|
|
214
|
+
type: ai
|
|
215
|
+
prompt: "Deep security analysis with full vulnerability scanning"
|
|
216
|
+
tags: ["remote", "comprehensive", "security", "slow"]
|
|
217
|
+
on: [pr_opened]
|
|
218
|
+
|
|
219
|
+
# Performance check that runs everywhere
|
|
220
|
+
performance:
|
|
221
|
+
type: ai
|
|
222
|
+
prompt: "Analyze performance issues"
|
|
223
|
+
tags: ["local", "remote", "performance", "fast"]
|
|
224
|
+
on: [pr_opened, pr_updated]
|
|
225
|
+
|
|
226
|
+
# Experimental new check
|
|
227
|
+
ai-architecture:
|
|
228
|
+
type: ai
|
|
229
|
+
prompt: "AI-powered architecture review"
|
|
230
|
+
tags: ["experimental", "architecture", "slow"]
|
|
231
|
+
on: [manual]
|
|
232
|
+
|
|
233
|
+
# Report that depends on security checks
|
|
234
|
+
security-report:
|
|
235
|
+
type: noop
|
|
236
|
+
tags: ["reporting", "local", "remote"]
|
|
237
|
+
depends_on: [security-quick, security-comprehensive]
|
|
238
|
+
on: [pr_opened, pr_updated]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### CLI Usage
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Run only fast, local checks (great for pre-commit hooks)
|
|
245
|
+
visor --tags local,fast
|
|
246
|
+
|
|
247
|
+
# Run comprehensive remote checks (for CI/CD)
|
|
248
|
+
visor --tags remote,comprehensive
|
|
249
|
+
|
|
250
|
+
# Run all security-related checks
|
|
251
|
+
visor --tags security
|
|
252
|
+
|
|
253
|
+
# Run everything except slow checks
|
|
254
|
+
visor --exclude-tags slow
|
|
255
|
+
|
|
256
|
+
# Run everything except experimental features
|
|
257
|
+
visor --exclude-tags experimental
|
|
258
|
+
|
|
259
|
+
# Combine filters: Run fast security checks only
|
|
260
|
+
visor --tags security,fast
|
|
261
|
+
|
|
262
|
+
# Run local checks but skip experimental ones
|
|
263
|
+
visor --tags local --exclude-tags experimental
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### GitHub Action Usage
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
name: Code Review with Tags
|
|
270
|
+
on: pull_request
|
|
271
|
+
|
|
272
|
+
jobs:
|
|
273
|
+
# Fast checks on every push
|
|
274
|
+
fast-review:
|
|
275
|
+
runs-on: ubuntu-latest
|
|
276
|
+
steps:
|
|
277
|
+
- uses: actions/checkout@v4
|
|
278
|
+
- uses: gates-ai/visor-action@v1
|
|
279
|
+
with:
|
|
280
|
+
tags: "local,fast"
|
|
281
|
+
exclude-tags: "experimental"
|
|
282
|
+
env:
|
|
283
|
+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
284
|
+
|
|
285
|
+
# Comprehensive checks only on main branch PRs
|
|
286
|
+
comprehensive-review:
|
|
287
|
+
if: github.base_ref == 'main'
|
|
288
|
+
runs-on: ubuntu-latest
|
|
289
|
+
steps:
|
|
290
|
+
- uses: actions/checkout@v4
|
|
291
|
+
- uses: gates-ai/visor-action@v1
|
|
292
|
+
with:
|
|
293
|
+
tags: "remote,comprehensive"
|
|
294
|
+
env:
|
|
295
|
+
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Common Tag Patterns
|
|
299
|
+
|
|
300
|
+
| Tag | Purpose | Example Use |
|
|
301
|
+
|-----|---------|-------------|
|
|
302
|
+
| `local` | Checks suitable for local development | Pre-commit hooks, developer testing |
|
|
303
|
+
| `remote` | Checks designed for CI/CD environments | GitHub Actions, Jenkins |
|
|
304
|
+
| `fast` | Quick checks (< 30 seconds) | Rapid feedback loops |
|
|
305
|
+
| `slow` | Time-consuming checks | Nightly builds, release validation |
|
|
306
|
+
| `security` | Security-related checks | Security audits |
|
|
307
|
+
| `performance` | Performance analysis | Performance testing |
|
|
308
|
+
| `style` | Code style and formatting | Linting, formatting |
|
|
309
|
+
| `experimental` | Beta/testing features | Opt-in testing |
|
|
310
|
+
| `critical` | Must-pass checks | Release gates |
|
|
311
|
+
| `comprehensive` | Thorough analysis | Full PR reviews |
|
|
312
|
+
|
|
313
|
+
### Advanced Examples
|
|
314
|
+
|
|
315
|
+
#### Environment-Specific Execution
|
|
316
|
+
|
|
317
|
+
```yaml
|
|
318
|
+
# Development environment - fast feedback
|
|
319
|
+
development:
|
|
320
|
+
extends: .visor.yaml
|
|
321
|
+
tag_filter:
|
|
322
|
+
include: ["local", "fast"]
|
|
323
|
+
exclude: ["experimental"]
|
|
324
|
+
|
|
325
|
+
# Staging environment - balanced
|
|
326
|
+
staging:
|
|
327
|
+
extends: .visor.yaml
|
|
328
|
+
tag_filter:
|
|
329
|
+
include: ["remote", "security", "performance"]
|
|
330
|
+
exclude: ["experimental"]
|
|
331
|
+
|
|
332
|
+
# Production environment - comprehensive
|
|
333
|
+
production:
|
|
334
|
+
extends: .visor.yaml
|
|
335
|
+
tag_filter:
|
|
336
|
+
include: ["remote", "comprehensive", "critical"]
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### Multi-Stage Pipeline
|
|
340
|
+
|
|
341
|
+
```yaml
|
|
342
|
+
# GitHub Actions workflow with progressive checks
|
|
343
|
+
name: Progressive Code Review
|
|
344
|
+
on: pull_request
|
|
345
|
+
|
|
346
|
+
jobs:
|
|
347
|
+
stage-1-fast:
|
|
348
|
+
runs-on: ubuntu-latest
|
|
349
|
+
steps:
|
|
350
|
+
- uses: actions/checkout@v4
|
|
351
|
+
- uses: gates-ai/visor-action@v1
|
|
352
|
+
with:
|
|
353
|
+
tags: "fast,critical"
|
|
354
|
+
fail-fast: "true" # Stop if critical issues found
|
|
355
|
+
|
|
356
|
+
stage-2-security:
|
|
357
|
+
needs: stage-1-fast
|
|
358
|
+
runs-on: ubuntu-latest
|
|
359
|
+
steps:
|
|
360
|
+
- uses: actions/checkout@v4
|
|
361
|
+
- uses: gates-ai/visor-action@v1
|
|
362
|
+
with:
|
|
363
|
+
tags: "security"
|
|
364
|
+
exclude-tags: "fast" # Run deeper security checks
|
|
365
|
+
|
|
366
|
+
stage-3-comprehensive:
|
|
367
|
+
needs: [stage-1-fast, stage-2-security]
|
|
368
|
+
runs-on: ubuntu-latest
|
|
369
|
+
steps:
|
|
370
|
+
- uses: actions/checkout@v4
|
|
371
|
+
- uses: gates-ai/visor-action@v1
|
|
372
|
+
with:
|
|
373
|
+
tags: "comprehensive"
|
|
374
|
+
exclude-tags: "fast,security" # Run remaining checks
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
#### Dependency-Aware Filtering
|
|
378
|
+
|
|
379
|
+
When using tags with dependencies, Visor intelligently handles missing dependencies:
|
|
380
|
+
|
|
381
|
+
```yaml
|
|
382
|
+
checks:
|
|
383
|
+
data-validation:
|
|
384
|
+
type: ai
|
|
385
|
+
prompt: "Validate data structures"
|
|
386
|
+
tags: ["local", "data"]
|
|
387
|
+
|
|
388
|
+
api-validation:
|
|
389
|
+
type: ai
|
|
390
|
+
prompt: "Validate API contracts"
|
|
391
|
+
tags: ["remote", "api"]
|
|
392
|
+
|
|
393
|
+
integration-report:
|
|
394
|
+
type: noop
|
|
395
|
+
tags: ["reporting"]
|
|
396
|
+
depends_on: [data-validation, api-validation]
|
|
397
|
+
# When filtered by "local" tag, only uses data-validation
|
|
398
|
+
# When filtered by "remote" tag, only uses api-validation
|
|
399
|
+
# With no filter, uses both dependencies
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Tag Validation Rules
|
|
403
|
+
|
|
404
|
+
- Tags must start with an alphanumeric character
|
|
405
|
+
- Can contain letters, numbers, hyphens, and underscores
|
|
406
|
+
- Examples: `local`, `test-env`, `feature_flag`, `v2`
|
|
407
|
+
- Invalid: `-invalid`, `@special`, `tag with spaces`
|
|
408
|
+
|
|
409
|
+
### Best Practices
|
|
410
|
+
|
|
411
|
+
1. **Use consistent naming conventions** across your organization
|
|
412
|
+
2. **Document your tag taxonomy** in your team's documentation
|
|
413
|
+
3. **Start simple** - begin with `local`/`remote` or `fast`/`slow`
|
|
414
|
+
4. **Avoid over-tagging** - too many tags can be confusing
|
|
415
|
+
5. **Use tag combinations** for fine-grained control
|
|
416
|
+
6. **Test your tag filters** before deploying to production
|
|
130
417
|
|
|
131
418
|
## 💬 PR Comment Commands
|
|
132
419
|
|
|
@@ -237,7 +524,7 @@ Options:
|
|
|
237
524
|
-o, --output <format> Output format: table, json, markdown, sarif
|
|
238
525
|
Default: table
|
|
239
526
|
--config <path> Path to configuration file
|
|
240
|
-
Default: visor.
|
|
527
|
+
Default search: ./.visor.yaml or ./.visor.yml
|
|
241
528
|
--max-parallelism <count> Maximum number of checks to run in parallel
|
|
242
529
|
Default: 3
|
|
243
530
|
--fail-fast Stop execution when any check fails
|
|
@@ -263,6 +550,31 @@ Examples:
|
|
|
263
550
|
visor --check all --allowed-remote-patterns "https://github.com/myorg/"
|
|
264
551
|
```
|
|
265
552
|
|
|
553
|
+
## 🛠️ Troubleshooting
|
|
554
|
+
|
|
555
|
+
- Not a git repository or no changes: run inside a Git repo with a diff (PR or local changes), or supply a config that doesn’t require PR context.
|
|
556
|
+
- No AI keys configured: Visor falls back to pattern checks. Set `GOOGLE_API_KEY`, `ANTHROPIC_API_KEY`, or `OPENAI_API_KEY` and optionally `MODEL_NAME`.
|
|
557
|
+
- Claude Code provider errors: install optional peers `@anthropic/claude-code-sdk` and `@modelcontextprotocol/sdk`, then set `CLAUDE_CODE_API_KEY` or `ANTHROPIC_API_KEY`.
|
|
558
|
+
- No PR comments posted: ensure workflow `permissions` include `pull-requests: write`; set `debug: true` (action input) or run `--debug` locally and inspect logs.
|
|
559
|
+
- Remote extends blocked: confirm `--no-remote-extends` or `VISOR_NO_REMOTE_EXTENDS=true` is intended; otherwise remove.
|
|
560
|
+
|
|
561
|
+
## 🔐 Security Defaults
|
|
562
|
+
|
|
563
|
+
- Use the workflow token by default; prefer a GitHub App for production (bot identity, least-privilege scopes).
|
|
564
|
+
- Lock remote configuration: set `VISOR_NO_REMOTE_EXTENDS=true` in CI or pass `--no-remote-extends` to avoid loading external configs.
|
|
565
|
+
- Scope AI API keys to a review-only project; rotate regularly and enable GitHub secret scanning alerts.
|
|
566
|
+
|
|
567
|
+
## ⚡ Performance & Cost Controls
|
|
568
|
+
|
|
569
|
+
- Cache Node in CI: `actions/setup-node@v4` with `cache: npm` (included in Quick Start).
|
|
570
|
+
- Separate fast vs. deep checks via tags: run `local,fast` in PRs, `remote,comprehensive` nightly.
|
|
571
|
+
- Increase `max_parallelism` only when not using `reuse_ai_session` between dependent checks.
|
|
572
|
+
|
|
573
|
+
## 👀 Observability
|
|
574
|
+
|
|
575
|
+
- Machine-readable output: use `--output json` for pipelines; redirect SARIF for code scanning: `npx @probelabs/visor --check security --output sarif > visor-results.sarif`.
|
|
576
|
+
- Verbose logs: set `--debug` (CLI) or `debug: true` in the action input.
|
|
577
|
+
|
|
266
578
|
## 🤖 AI Configuration
|
|
267
579
|
|
|
268
580
|
Visor uses AI-powered code analysis to provide intelligent review feedback. Configure one of the following providers:
|
|
@@ -282,7 +594,7 @@ Add your API key as a repository secret:
|
|
|
282
594
|
1. Go to Settings → Secrets and variables → Actions
|
|
283
595
|
2. Click "New repository secret"
|
|
284
596
|
3. Add one of: `GOOGLE_API_KEY`, `ANTHROPIC_API_KEY`, or `OPENAI_API_KEY`
|
|
285
|
-
4. (Optional) Add `
|
|
597
|
+
4. (Optional) Add `MODEL_NAME` to specify a model
|
|
286
598
|
|
|
287
599
|
#### For Local Development
|
|
288
600
|
Set environment variables:
|
|
@@ -315,6 +627,88 @@ If no API key is configured, Visor will fall back to basic pattern-matching anal
|
|
|
315
627
|
|
|
316
628
|
For best results, configure an AI provider for intelligent, context-aware code review.
|
|
317
629
|
|
|
630
|
+
### MCP (Model Context Protocol) Support for AI Providers
|
|
631
|
+
|
|
632
|
+
Visor supports MCP servers for AI providers, enabling enhanced code analysis with specialized tools. MCP servers can provide additional context and capabilities to AI models.
|
|
633
|
+
|
|
634
|
+
MCP configuration follows the same pattern as AI provider configuration, supporting **global**, **check-level**, and **AI object-level** settings.
|
|
635
|
+
|
|
636
|
+
#### Global MCP Configuration
|
|
637
|
+
|
|
638
|
+
Configure MCP servers once globally for all AI checks:
|
|
639
|
+
|
|
640
|
+
```yaml
|
|
641
|
+
# Global configuration
|
|
642
|
+
ai_provider: anthropic
|
|
643
|
+
ai_model: claude-3-sonnet
|
|
644
|
+
ai_mcp_servers:
|
|
645
|
+
probe:
|
|
646
|
+
command: "npx"
|
|
647
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
648
|
+
filesystem:
|
|
649
|
+
command: "npx"
|
|
650
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
|
|
651
|
+
|
|
652
|
+
checks:
|
|
653
|
+
security_review:
|
|
654
|
+
type: ai
|
|
655
|
+
prompt: "Review code using available MCP tools"
|
|
656
|
+
# Inherits global MCP servers automatically
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
#### Check-Level MCP Configuration
|
|
660
|
+
|
|
661
|
+
Override global MCP servers for specific checks:
|
|
662
|
+
|
|
663
|
+
```yaml
|
|
664
|
+
checks:
|
|
665
|
+
performance_review:
|
|
666
|
+
type: ai
|
|
667
|
+
prompt: "Analyze performance using specialized tools"
|
|
668
|
+
ai_mcp_servers: # Overrides global servers
|
|
669
|
+
probe:
|
|
670
|
+
command: "npx"
|
|
671
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
672
|
+
custom_profiler:
|
|
673
|
+
command: "python3"
|
|
674
|
+
args: ["./tools/performance-analyzer.py"]
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
#### AI Object-Level MCP Configuration
|
|
678
|
+
|
|
679
|
+
Most specific level - overrides both global and check-level:
|
|
680
|
+
|
|
681
|
+
```yaml
|
|
682
|
+
checks:
|
|
683
|
+
comprehensive_review:
|
|
684
|
+
type: ai
|
|
685
|
+
prompt: "Comprehensive analysis with specific tools"
|
|
686
|
+
ai:
|
|
687
|
+
provider: anthropic
|
|
688
|
+
mcpServers: # Overrides everything else
|
|
689
|
+
probe:
|
|
690
|
+
command: "npx"
|
|
691
|
+
args: ["-y", "@probelabs/probe@latest", "mcp"]
|
|
692
|
+
github:
|
|
693
|
+
command: "npx"
|
|
694
|
+
args: ["-y", "@modelcontextprotocol/server-github"]
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### Available MCP Servers
|
|
698
|
+
|
|
699
|
+
- **Probe**: Advanced code search and analysis (`@probelabs/probe`)
|
|
700
|
+
- **Jira**: Jira Cloud integration for issue management (`@orengrinker/jira-mcp-server`)
|
|
701
|
+
- **Filesystem**: File system access (`@modelcontextprotocol/server-filesystem`)
|
|
702
|
+
- **GitHub**: GitHub API access (coming soon)
|
|
703
|
+
- **Custom**: Your own MCP servers
|
|
704
|
+
|
|
705
|
+
#### Example Configurations
|
|
706
|
+
|
|
707
|
+
- [Basic MCP with Probe](examples/ai-with-mcp.yaml) - Code analysis with multiple MCP servers
|
|
708
|
+
- [Jira Workflow Automation](examples/jira-workflow-mcp.yaml) - Complete Jira integration examples
|
|
709
|
+
- [Simple Jira Analysis](examples/jira-simple-example.yaml) - Basic JQL → analyze → label workflow
|
|
710
|
+
- [Setup Guide](examples/JIRA_MCP_SETUP.md) - Detailed Jira MCP configuration instructions
|
|
711
|
+
|
|
318
712
|
## 📊 Step Dependencies & Intelligent Execution
|
|
319
713
|
|
|
320
714
|
### Dependency-Aware Check Execution
|
|
@@ -335,6 +729,7 @@ checks:
|
|
|
335
729
|
group: code-review
|
|
336
730
|
schema: code-review
|
|
337
731
|
prompt: "Comprehensive security analysis..."
|
|
732
|
+
tags: ["security", "critical", "comprehensive"]
|
|
338
733
|
on: [pr_opened, pr_updated]
|
|
339
734
|
# No dependencies - runs first
|
|
340
735
|
|
|
@@ -343,6 +738,7 @@ checks:
|
|
|
343
738
|
group: code-review
|
|
344
739
|
schema: code-review
|
|
345
740
|
prompt: "Performance analysis..."
|
|
741
|
+
tags: ["performance", "fast", "local", "remote"]
|
|
346
742
|
on: [pr_opened, pr_updated]
|
|
347
743
|
# No dependencies - runs parallel with security
|
|
348
744
|
|
|
@@ -351,6 +747,7 @@ checks:
|
|
|
351
747
|
group: code-review
|
|
352
748
|
schema: code-review
|
|
353
749
|
prompt: "Style analysis based on security findings..."
|
|
750
|
+
tags: ["style", "fast", "local"]
|
|
354
751
|
on: [pr_opened]
|
|
355
752
|
depends_on: [security] # Waits for security to complete
|
|
356
753
|
|
|
@@ -453,6 +850,80 @@ checks:
|
|
|
453
850
|
- **Graceful Failures**: Failed checks don't prevent independent checks from running
|
|
454
851
|
- **Dependency Results**: Results from dependency checks are available to dependent checks
|
|
455
852
|
|
|
853
|
+
## 🤖 Claude Code Provider
|
|
854
|
+
|
|
855
|
+
Visor includes advanced integration with Claude Code SDK, providing powerful AI-driven code analysis with MCP (Model Context Protocol) tools and subagent support.
|
|
856
|
+
|
|
857
|
+
### Features
|
|
858
|
+
|
|
859
|
+
- **Advanced AI Analysis**: Leverages Claude Code's sophisticated understanding
|
|
860
|
+
- **MCP Tools**: Built-in and custom tools for specialized analysis
|
|
861
|
+
- **Subagents**: Delegate specific tasks to specialized agents
|
|
862
|
+
- **Streaming Responses**: Real-time feedback during analysis
|
|
863
|
+
- **Flexible Permissions**: Granular control over tool usage
|
|
864
|
+
|
|
865
|
+
### Configuration
|
|
866
|
+
|
|
867
|
+
```yaml
|
|
868
|
+
checks:
|
|
869
|
+
claude_comprehensive:
|
|
870
|
+
type: claude-code
|
|
871
|
+
prompt: "Perform a comprehensive security and performance review"
|
|
872
|
+
tags: ["comprehensive", "security", "performance", "slow", "remote"]
|
|
873
|
+
claude_code:
|
|
874
|
+
allowedTools: ['Grep', 'Read', 'WebSearch']
|
|
875
|
+
maxTurns: 5
|
|
876
|
+
systemPrompt: "You are an expert security auditor"
|
|
877
|
+
|
|
878
|
+
claude_with_mcp:
|
|
879
|
+
type: claude-code
|
|
880
|
+
prompt: "Analyze code complexity and architecture"
|
|
881
|
+
tags: ["architecture", "complexity", "comprehensive", "remote"]
|
|
882
|
+
claude_code:
|
|
883
|
+
allowedTools: ['analyze_file_structure', 'calculate_complexity']
|
|
884
|
+
mcpServers:
|
|
885
|
+
custom_analyzer:
|
|
886
|
+
command: "node"
|
|
887
|
+
args: ["./mcp-servers/analyzer.js"]
|
|
888
|
+
env:
|
|
889
|
+
ANALYSIS_MODE: "deep"
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
### Built-in MCP Tools
|
|
893
|
+
|
|
894
|
+
- `analyze_file_structure`: Analyzes project organization
|
|
895
|
+
- `detect_patterns`: Identifies code patterns and anti-patterns
|
|
896
|
+
- `calculate_complexity`: Computes complexity metrics
|
|
897
|
+
- `suggest_improvements`: Provides improvement recommendations
|
|
898
|
+
|
|
899
|
+
### Custom MCP Servers
|
|
900
|
+
|
|
901
|
+
Create `.mcp.json` in your project root:
|
|
902
|
+
|
|
903
|
+
```json
|
|
904
|
+
{
|
|
905
|
+
"mcpServers": {
|
|
906
|
+
"security_scanner": {
|
|
907
|
+
"command": "python",
|
|
908
|
+
"args": ["./tools/security_scanner.py"],
|
|
909
|
+
"env": {
|
|
910
|
+
"SCAN_DEPTH": "full"
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
### Environment Setup
|
|
918
|
+
|
|
919
|
+
```bash
|
|
920
|
+
# Install Claude Code CLI (required)
|
|
921
|
+
npm install -g @anthropic-ai/claude-code
|
|
922
|
+
|
|
923
|
+
# Set API key (optional - uses local Claude Code if available)
|
|
924
|
+
export CLAUDE_CODE_API_KEY=your-api-key
|
|
925
|
+
```
|
|
926
|
+
|
|
456
927
|
## 🔄 AI Session Reuse
|
|
457
928
|
|
|
458
929
|
Visor supports AI session reuse for dependent checks, allowing follow-up analysis to maintain conversation context with the AI. This creates more intelligent, contextual analysis workflows.
|
|
@@ -1476,15 +1947,348 @@ When new commits are pushed to a PR, Visor performs incremental analysis:
|
|
|
1476
1947
|
- **Collision Detection**: Prevents conflicts when multiple reviews run simultaneously
|
|
1477
1948
|
- **Context-Aware Updates**: Comments are updated with relevant context (PR opened, updated, synchronized)
|
|
1478
1949
|
|
|
1950
|
+
## 🌐 HTTP Integration & Scheduling
|
|
1951
|
+
|
|
1952
|
+
Visor provides comprehensive HTTP integration capabilities including webhook reception, HTTP outputs, scheduled executions via cron, and TLS/HTTPS support.
|
|
1953
|
+
|
|
1954
|
+
### HTTP Server for Webhook Reception
|
|
1955
|
+
|
|
1956
|
+
Configure an HTTP/HTTPS server to receive webhooks and trigger checks:
|
|
1957
|
+
|
|
1958
|
+
```yaml
|
|
1959
|
+
version: "1.0"
|
|
1960
|
+
|
|
1961
|
+
http_server:
|
|
1962
|
+
enabled: true
|
|
1963
|
+
port: 8080
|
|
1964
|
+
host: "0.0.0.0"
|
|
1965
|
+
|
|
1966
|
+
# Optional TLS/HTTPS configuration
|
|
1967
|
+
tls:
|
|
1968
|
+
enabled: true
|
|
1969
|
+
cert: "${TLS_CERT}" # From environment variable
|
|
1970
|
+
key: "${TLS_KEY}"
|
|
1971
|
+
ca: "${TLS_CA}" # Optional CA certificate
|
|
1972
|
+
rejectUnauthorized: true
|
|
1973
|
+
|
|
1974
|
+
# Authentication
|
|
1975
|
+
auth:
|
|
1976
|
+
type: bearer_token
|
|
1977
|
+
secret: "${WEBHOOK_SECRET}"
|
|
1978
|
+
|
|
1979
|
+
# Webhook endpoints
|
|
1980
|
+
endpoints:
|
|
1981
|
+
- path: "/webhook/github"
|
|
1982
|
+
name: "github-events"
|
|
1983
|
+
- path: "/webhook/jenkins"
|
|
1984
|
+
name: "jenkins-builds"
|
|
1985
|
+
```
|
|
1986
|
+
|
|
1987
|
+
**Note**: The HTTP server is automatically disabled when running in GitHub Actions to avoid conflicts.
|
|
1988
|
+
|
|
1989
|
+
### Check Types for HTTP Integration
|
|
1990
|
+
|
|
1991
|
+
#### 1. HTTP Input (Webhook Receiver)
|
|
1992
|
+
Receive data from configured webhook endpoints:
|
|
1993
|
+
|
|
1994
|
+
```yaml
|
|
1995
|
+
checks:
|
|
1996
|
+
github-webhook:
|
|
1997
|
+
type: http_input
|
|
1998
|
+
endpoint: "/webhook/github"
|
|
1999
|
+
on: [webhook_received]
|
|
2000
|
+
transform: |
|
|
2001
|
+
{
|
|
2002
|
+
"event": "{{ webhook.action }}",
|
|
2003
|
+
"repository": "{{ webhook.repository.full_name }}"
|
|
2004
|
+
}
|
|
2005
|
+
```
|
|
2006
|
+
|
|
2007
|
+
#### 2. HTTP Output (Send Data)
|
|
2008
|
+
Send check results to external services:
|
|
2009
|
+
|
|
2010
|
+
```yaml
|
|
2011
|
+
checks:
|
|
2012
|
+
notify-external:
|
|
2013
|
+
type: http
|
|
2014
|
+
depends_on: [security-check]
|
|
2015
|
+
url: "https://api.example.com/notify"
|
|
2016
|
+
method: POST
|
|
2017
|
+
headers:
|
|
2018
|
+
Content-Type: "application/json"
|
|
2019
|
+
Authorization: "Bearer ${API_TOKEN}"
|
|
2020
|
+
body: |
|
|
2021
|
+
{
|
|
2022
|
+
"results": {{ outputs['security-check'] | json }},
|
|
2023
|
+
"timestamp": "{{ 'now' | date: '%Y-%m-%d %H:%M:%S' }}"
|
|
2024
|
+
}
|
|
2025
|
+
```
|
|
2026
|
+
|
|
2027
|
+
#### 3. HTTP Client (Fetch Data)
|
|
2028
|
+
Fetch data from external APIs:
|
|
2029
|
+
|
|
2030
|
+
```yaml
|
|
2031
|
+
checks:
|
|
2032
|
+
fetch-config:
|
|
2033
|
+
type: http_client
|
|
2034
|
+
url: "https://api.example.com/config"
|
|
2035
|
+
method: GET
|
|
2036
|
+
headers:
|
|
2037
|
+
Authorization: "Bearer ${API_TOKEN}"
|
|
2038
|
+
transform: |
|
|
2039
|
+
{
|
|
2040
|
+
"settings": {{ response.data | json }},
|
|
2041
|
+
"fetched_at": "{{ 'now' | date: '%Y-%m-%d' }}"
|
|
2042
|
+
}
|
|
2043
|
+
```
|
|
2044
|
+
|
|
2045
|
+
#### 4. Log Provider (Debugging & Monitoring)
|
|
2046
|
+
Output debugging information and monitor workflow execution:
|
|
2047
|
+
|
|
2048
|
+
```yaml
|
|
2049
|
+
checks:
|
|
2050
|
+
debug-start:
|
|
2051
|
+
type: log
|
|
2052
|
+
group: debugging
|
|
2053
|
+
level: info
|
|
2054
|
+
message: "🚀 Starting code review for PR #{{ pr.number }} by {{ pr.author }}"
|
|
2055
|
+
include_pr_context: true
|
|
2056
|
+
include_dependencies: false
|
|
2057
|
+
include_metadata: true
|
|
2058
|
+
|
|
2059
|
+
debug-dependencies:
|
|
2060
|
+
type: log
|
|
2061
|
+
group: debugging
|
|
2062
|
+
level: debug
|
|
2063
|
+
depends_on: [security-check]
|
|
2064
|
+
message: |
|
|
2065
|
+
📊 Dependency results summary:
|
|
2066
|
+
{% if dependencies %}
|
|
2067
|
+
- Security check found {{ dependencies['security-check'].issueCount }} issues
|
|
2068
|
+
{% else %}
|
|
2069
|
+
- No dependencies processed
|
|
2070
|
+
{% endif %}
|
|
2071
|
+
include_dependencies: true
|
|
2072
|
+
|
|
2073
|
+
performance-monitor:
|
|
2074
|
+
type: log
|
|
2075
|
+
group: monitoring
|
|
2076
|
+
level: warn
|
|
2077
|
+
message: "⚠️ Large PR detected: {{ pr.totalAdditions }} lines added"
|
|
2078
|
+
include_pr_context: true
|
|
2079
|
+
```
|
|
2080
|
+
|
|
2081
|
+
**Configuration Options:**
|
|
2082
|
+
- `message` - Log message (required, supports Liquid templates)
|
|
2083
|
+
- `level` - Log level: `debug`, `info`, `warn`, `error` (default: `info`)
|
|
2084
|
+
- `include_pr_context` - Include PR information (default: `true`)
|
|
2085
|
+
- `include_dependencies` - Include dependency results (default: `true`)
|
|
2086
|
+
- `include_metadata` - Include execution metadata (default: `true`)
|
|
2087
|
+
- `group` - Output group for organization
|
|
2088
|
+
|
|
2089
|
+
**Use Cases:**
|
|
2090
|
+
- Debug complex check workflows and execution order
|
|
2091
|
+
- Monitor check performance and resource usage
|
|
2092
|
+
- Create audit trails for review processes
|
|
2093
|
+
- Troubleshoot configuration issues
|
|
2094
|
+
- Track dependency execution flow
|
|
2095
|
+
|
|
2096
|
+
### Cron Scheduling
|
|
2097
|
+
|
|
2098
|
+
Schedule any check type to run at specific intervals:
|
|
2099
|
+
|
|
2100
|
+
```yaml
|
|
2101
|
+
checks:
|
|
2102
|
+
daily-security-scan:
|
|
2103
|
+
type: ai
|
|
2104
|
+
prompt: "Perform comprehensive security audit"
|
|
2105
|
+
schedule: "0 2 * * *" # Run at 2 AM daily
|
|
2106
|
+
|
|
2107
|
+
hourly-metrics:
|
|
2108
|
+
type: http_client
|
|
2109
|
+
url: "https://metrics.example.com/latest"
|
|
2110
|
+
schedule: "0 * * * *" # Every hour
|
|
2111
|
+
|
|
2112
|
+
weekly-report:
|
|
2113
|
+
type: ai
|
|
2114
|
+
prompt: "Generate weekly summary"
|
|
2115
|
+
schedule: "0 9 * * MON" # Every Monday at 9 AM
|
|
2116
|
+
```
|
|
2117
|
+
|
|
2118
|
+
**Cron Expression Format**:
|
|
2119
|
+
```
|
|
2120
|
+
┌────────────── minute (0-59)
|
|
2121
|
+
│ ┌──────────── hour (0-23)
|
|
2122
|
+
│ │ ┌────────── day of month (1-31)
|
|
2123
|
+
│ │ │ ┌──────── month (1-12)
|
|
2124
|
+
│ │ │ │ ┌────── day of week (0-6, Sunday=0)
|
|
2125
|
+
│ │ │ │ │
|
|
2126
|
+
* * * * *
|
|
2127
|
+
```
|
|
2128
|
+
|
|
2129
|
+
### TLS/HTTPS Configuration
|
|
2130
|
+
|
|
2131
|
+
Support for various TLS certificate configurations:
|
|
2132
|
+
|
|
2133
|
+
#### Environment Variables
|
|
2134
|
+
```yaml
|
|
2135
|
+
tls:
|
|
2136
|
+
enabled: true
|
|
2137
|
+
cert: "${TLS_CERT}" # Certificate from env var
|
|
2138
|
+
key: "${TLS_KEY}" # Private key from env var
|
|
2139
|
+
```
|
|
2140
|
+
|
|
2141
|
+
#### File Paths
|
|
2142
|
+
```yaml
|
|
2143
|
+
tls:
|
|
2144
|
+
enabled: true
|
|
2145
|
+
cert: "/etc/ssl/certs/server.crt"
|
|
2146
|
+
key: "/etc/ssl/private/server.key"
|
|
2147
|
+
ca: "/etc/ssl/certs/ca-bundle.crt"
|
|
2148
|
+
```
|
|
2149
|
+
|
|
2150
|
+
#### Let's Encrypt
|
|
2151
|
+
```yaml
|
|
2152
|
+
tls:
|
|
2153
|
+
enabled: true
|
|
2154
|
+
cert: "/etc/letsencrypt/live/example.com/fullchain.pem"
|
|
2155
|
+
key: "/etc/letsencrypt/live/example.com/privkey.pem"
|
|
2156
|
+
```
|
|
2157
|
+
|
|
2158
|
+
### HTTP Security Features
|
|
2159
|
+
|
|
2160
|
+
Visor's HTTP server includes comprehensive security protections:
|
|
2161
|
+
|
|
2162
|
+
#### Authentication Methods
|
|
2163
|
+
```yaml
|
|
2164
|
+
# Bearer Token Authentication
|
|
2165
|
+
auth:
|
|
2166
|
+
type: bearer_token
|
|
2167
|
+
secret: "${WEBHOOK_SECRET}"
|
|
2168
|
+
|
|
2169
|
+
# HMAC-SHA256 Signature Verification
|
|
2170
|
+
auth:
|
|
2171
|
+
type: hmac
|
|
2172
|
+
secret: "${WEBHOOK_SECRET}"
|
|
2173
|
+
|
|
2174
|
+
# Basic Authentication
|
|
2175
|
+
auth:
|
|
2176
|
+
type: basic
|
|
2177
|
+
username: "${HTTP_USERNAME}"
|
|
2178
|
+
password: "${HTTP_PASSWORD}"
|
|
2179
|
+
```
|
|
2180
|
+
|
|
2181
|
+
#### HMAC Authentication Details
|
|
2182
|
+
For `hmac` authentication, webhooks must include the `x-webhook-signature` header:
|
|
2183
|
+
- Signature format: `sha256={hash}`
|
|
2184
|
+
- Uses HMAC-SHA256 with the configured secret
|
|
2185
|
+
- Implements timing-safe comparison to prevent timing attacks
|
|
2186
|
+
- Compatible with GitHub webhook signatures
|
|
2187
|
+
|
|
2188
|
+
#### DoS Protection
|
|
2189
|
+
- **Request size limits**: Maximum 1MB request body size
|
|
2190
|
+
- **Early rejection**: Validates `Content-Length` header before processing
|
|
2191
|
+
- **Graceful error handling**: Returns proper HTTP status codes (413 Payload Too Large)
|
|
2192
|
+
|
|
2193
|
+
#### Security Best Practices
|
|
2194
|
+
- **Environment detection**: Automatically disables in GitHub Actions
|
|
2195
|
+
- **TLS support**: Full HTTPS configuration with custom certificates
|
|
2196
|
+
- **Input validation**: Validates all webhook payloads before processing
|
|
2197
|
+
- **Error isolation**: Security failures don't affect independent checks
|
|
2198
|
+
|
|
2199
|
+
### Complete HTTP Pipeline Example
|
|
2200
|
+
|
|
2201
|
+
```yaml
|
|
2202
|
+
version: "1.0"
|
|
2203
|
+
|
|
2204
|
+
# HTTP server configuration
|
|
2205
|
+
http_server:
|
|
2206
|
+
enabled: true
|
|
2207
|
+
port: 8443
|
|
2208
|
+
tls:
|
|
2209
|
+
enabled: true
|
|
2210
|
+
cert: "${TLS_CERT}"
|
|
2211
|
+
key: "${TLS_KEY}"
|
|
2212
|
+
auth:
|
|
2213
|
+
type: bearer_token
|
|
2214
|
+
secret: "${WEBHOOK_SECRET}"
|
|
2215
|
+
endpoints:
|
|
2216
|
+
- path: "/webhook/deployment"
|
|
2217
|
+
name: "deployment-trigger"
|
|
2218
|
+
|
|
2219
|
+
checks:
|
|
2220
|
+
# 1. Receive webhook
|
|
2221
|
+
deployment-webhook:
|
|
2222
|
+
type: http_input
|
|
2223
|
+
endpoint: "/webhook/deployment"
|
|
2224
|
+
on: [webhook_received]
|
|
2225
|
+
transform: |
|
|
2226
|
+
{
|
|
2227
|
+
"version": "{{ webhook.version }}",
|
|
2228
|
+
"environment": "{{ webhook.environment }}"
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
# 2. Analyze deployment
|
|
2232
|
+
deployment-analysis:
|
|
2233
|
+
type: ai
|
|
2234
|
+
depends_on: [deployment-webhook]
|
|
2235
|
+
prompt: |
|
|
2236
|
+
Analyze deployment for version {{ outputs['deployment-webhook'].suggestions | first }}
|
|
2237
|
+
Check for potential issues and risks
|
|
2238
|
+
|
|
2239
|
+
# 3. Fetch current status
|
|
2240
|
+
current-status:
|
|
2241
|
+
type: http_client
|
|
2242
|
+
depends_on: [deployment-webhook]
|
|
2243
|
+
url: "https://api.example.com/status"
|
|
2244
|
+
method: GET
|
|
2245
|
+
|
|
2246
|
+
# 4. Send results
|
|
2247
|
+
notify-team:
|
|
2248
|
+
type: http
|
|
2249
|
+
depends_on: [deployment-analysis, current-status]
|
|
2250
|
+
url: "https://slack.example.com/webhook"
|
|
2251
|
+
body: |
|
|
2252
|
+
{
|
|
2253
|
+
"text": "Deployment Analysis Complete",
|
|
2254
|
+
"analysis": {{ outputs['deployment-analysis'] | json }},
|
|
2255
|
+
"current_status": {{ outputs['current-status'] | json }}
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
# 5. Scheduled health check
|
|
2259
|
+
health-check:
|
|
2260
|
+
type: http_client
|
|
2261
|
+
url: "https://api.example.com/health"
|
|
2262
|
+
schedule: "*/5 * * * *" # Every 5 minutes
|
|
2263
|
+
transform: |
|
|
2264
|
+
{
|
|
2265
|
+
"status": "{{ response.status }}",
|
|
2266
|
+
"checked_at": "{{ 'now' | date: '%Y-%m-%d %H:%M:%S' }}"
|
|
2267
|
+
}
|
|
2268
|
+
```
|
|
2269
|
+
|
|
2270
|
+
### Liquid Template Support
|
|
2271
|
+
|
|
2272
|
+
All HTTP configurations support Liquid templating for dynamic content:
|
|
2273
|
+
|
|
2274
|
+
- Access webhook data: `{{ webhook.field }}`
|
|
2275
|
+
- Access headers: `{{ headers['x-custom-header'] }}`
|
|
2276
|
+
- Access previous outputs: `{{ outputs['check-name'].suggestions | first }}`
|
|
2277
|
+
- Date formatting: `{{ 'now' | date: '%Y-%m-%d' }}`
|
|
2278
|
+
- JSON encoding: `{{ data | json }}`
|
|
2279
|
+
|
|
1479
2280
|
## 🔧 Pluggable Architecture
|
|
1480
2281
|
|
|
1481
2282
|
Visor features a pluggable provider system for extensibility:
|
|
1482
2283
|
|
|
1483
2284
|
### Supported Check Types
|
|
1484
|
-
- **AI Provider**: Intelligent analysis using LLMs (Google Gemini, Anthropic Claude, OpenAI GPT)
|
|
2285
|
+
- **AI Provider**: Intelligent analysis using LLMs (Google Gemini, Anthropic Claude, OpenAI GPT) with MCP (Model Context Protocol) tools support
|
|
2286
|
+
- **Claude Code Provider**: Advanced AI analysis using Claude Code SDK with MCP tools and subagents
|
|
1485
2287
|
- **Tool Provider**: Integration with external tools (ESLint, Prettier, SonarQube)
|
|
2288
|
+
- **HTTP Provider**: Send data to external HTTP endpoints
|
|
2289
|
+
- **HTTP Input Provider**: Receive data from webhooks
|
|
2290
|
+
- **HTTP Client Provider**: Fetch data from external APIs
|
|
1486
2291
|
- **Script Provider**: Custom shell scripts and commands
|
|
1487
|
-
- **Webhook Provider**: External service integration via HTTP calls
|
|
1488
2292
|
|
|
1489
2293
|
### Adding Custom Providers
|
|
1490
2294
|
```typescript
|
|
@@ -1509,7 +2313,7 @@ CheckProviderRegistry.getInstance().registerProvider(new CustomCheckProvider());
|
|
|
1509
2313
|
|
|
1510
2314
|
## ⚙️ Configuration
|
|
1511
2315
|
|
|
1512
|
-
Create
|
|
2316
|
+
Create `.visor.yaml` in your project root:
|
|
1513
2317
|
|
|
1514
2318
|
```yaml
|
|
1515
2319
|
# .visor.yaml
|
|
@@ -1595,11 +2399,11 @@ reporting:
|
|
|
1595
2399
|
|
|
1596
2400
|
| Input | Description | Default | Required |
|
|
1597
2401
|
|-------|-------------|---------|----------|
|
|
1598
|
-
| `github-token` | GitHub token for API access | `${{ github.token }}` |
|
|
2402
|
+
| `github-token` | GitHub token for API access (auto-provided) | `${{ github.token }}` | No (defaults to workflow token) |
|
|
1599
2403
|
| `auto-review` | Auto-review on PR open/update | `true` | No |
|
|
1600
2404
|
| `checks` | Checks to run (comma-separated) | `all` | No |
|
|
1601
2405
|
| `output-format` | Output format | `markdown` | No |
|
|
1602
|
-
| `config-path` | Path to config file |
|
|
2406
|
+
| `config-path` | Path to config file | `.visor.yaml` | No |
|
|
1603
2407
|
| `max-parallelism` | Maximum number of checks to run in parallel | `3` | No |
|
|
1604
2408
|
| `fail-fast` | Stop execution when any check fails | `false` | No |
|
|
1605
2409
|
| `comment-on-pr` | Post review as PR comment | `true` | No |
|
|
@@ -1637,7 +2441,6 @@ jobs:
|
|
|
1637
2441
|
- uses: actions/checkout@v4
|
|
1638
2442
|
- uses: ./
|
|
1639
2443
|
with:
|
|
1640
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
1641
2444
|
auto-review: true # Enable automatic review
|
|
1642
2445
|
env:
|
|
1643
2446
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
@@ -1657,7 +2460,6 @@ jobs:
|
|
|
1657
2460
|
- name: Run Visor Security Scan
|
|
1658
2461
|
uses: ./
|
|
1659
2462
|
with:
|
|
1660
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
1661
2463
|
checks: security
|
|
1662
2464
|
output-format: sarif
|
|
1663
2465
|
|
|
@@ -1680,7 +2482,6 @@ jobs:
|
|
|
1680
2482
|
- uses: actions/checkout@v4
|
|
1681
2483
|
- uses: ./
|
|
1682
2484
|
with:
|
|
1683
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
1684
2485
|
min-score: 80
|
|
1685
2486
|
fail-on-critical: true
|
|
1686
2487
|
```
|
|
@@ -1701,8 +2502,7 @@ jobs:
|
|
|
1701
2502
|
steps:
|
|
1702
2503
|
- uses: actions/checkout@v4
|
|
1703
2504
|
- uses: ./
|
|
1704
|
-
with
|
|
1705
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
2505
|
+
# Optional: configure inputs (e.g., tag filters, custom configs) with a `with:` block
|
|
1706
2506
|
```
|
|
1707
2507
|
|
|
1708
2508
|
## 📊 Output Formats
|
|
@@ -1725,7 +2525,7 @@ jobs:
|
|
|
1725
2525
|
"summary": {
|
|
1726
2526
|
"overallScore": 85,
|
|
1727
2527
|
"totalIssues": 12,
|
|
1728
|
-
|
|
2528
|
+
"criticalIssues": 1
|
|
1729
2529
|
},
|
|
1730
2530
|
"issues": [
|
|
1731
2531
|
{
|
|
@@ -1769,7 +2569,7 @@ visor/
|
|
|
1769
2569
|
├── tests/ # Test suites
|
|
1770
2570
|
├── .github/workflows/ # GitHub workflows
|
|
1771
2571
|
├── action.yml # Action metadata
|
|
1772
|
-
└── visor.
|
|
2572
|
+
└── .visor.yaml # Project config (overrides defaults/.visor.yaml)
|
|
1773
2573
|
```
|
|
1774
2574
|
|
|
1775
2575
|
### Available Scripts
|