@probelabs/visor 0.1.37 → 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 +504 -58
- package/action.yml +10 -0
- 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 +4 -0
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts +6 -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 +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +510 -10
- 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 +1 -7
- package/dist/providers/check-provider.interface.d.ts.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts +29 -0
- package/dist/providers/log-check-provider.d.ts.map +1 -0
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +22 -1
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +2 -2
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:
|
|
43
|
-
|
|
44
|
-
```yaml
|
|
45
|
-
name: Code Review with GitHub App
|
|
46
|
-
on: pull_request
|
|
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.
|
|
47
76
|
|
|
48
|
-
|
|
49
|
-
review:
|
|
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
|
-
```
|
|
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.
|
|
64
78
|
|
|
65
|
-
**
|
|
66
|
-
1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) with
|
|
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
|
|
|
@@ -472,6 +869,7 @@ checks:
|
|
|
472
869
|
claude_comprehensive:
|
|
473
870
|
type: claude-code
|
|
474
871
|
prompt: "Perform a comprehensive security and performance review"
|
|
872
|
+
tags: ["comprehensive", "security", "performance", "slow", "remote"]
|
|
475
873
|
claude_code:
|
|
476
874
|
allowedTools: ['Grep', 'Read', 'WebSearch']
|
|
477
875
|
maxTurns: 5
|
|
@@ -480,6 +878,7 @@ checks:
|
|
|
480
878
|
claude_with_mcp:
|
|
481
879
|
type: claude-code
|
|
482
880
|
prompt: "Analyze code complexity and architecture"
|
|
881
|
+
tags: ["architecture", "complexity", "comprehensive", "remote"]
|
|
483
882
|
claude_code:
|
|
484
883
|
allowedTools: ['analyze_file_structure', 'calculate_complexity']
|
|
485
884
|
mcpServers:
|
|
@@ -1643,6 +2042,57 @@ checks:
|
|
|
1643
2042
|
}
|
|
1644
2043
|
```
|
|
1645
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
|
+
|
|
1646
2096
|
### Cron Scheduling
|
|
1647
2097
|
|
|
1648
2098
|
Schedule any check type to run at specific intervals:
|
|
@@ -1832,7 +2282,7 @@ All HTTP configurations support Liquid templating for dynamic content:
|
|
|
1832
2282
|
Visor features a pluggable provider system for extensibility:
|
|
1833
2283
|
|
|
1834
2284
|
### Supported Check Types
|
|
1835
|
-
- **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
|
|
1836
2286
|
- **Claude Code Provider**: Advanced AI analysis using Claude Code SDK with MCP tools and subagents
|
|
1837
2287
|
- **Tool Provider**: Integration with external tools (ESLint, Prettier, SonarQube)
|
|
1838
2288
|
- **HTTP Provider**: Send data to external HTTP endpoints
|
|
@@ -1863,7 +2313,7 @@ CheckProviderRegistry.getInstance().registerProvider(new CustomCheckProvider());
|
|
|
1863
2313
|
|
|
1864
2314
|
## ⚙️ Configuration
|
|
1865
2315
|
|
|
1866
|
-
Create
|
|
2316
|
+
Create `.visor.yaml` in your project root:
|
|
1867
2317
|
|
|
1868
2318
|
```yaml
|
|
1869
2319
|
# .visor.yaml
|
|
@@ -1949,11 +2399,11 @@ reporting:
|
|
|
1949
2399
|
|
|
1950
2400
|
| Input | Description | Default | Required |
|
|
1951
2401
|
|-------|-------------|---------|----------|
|
|
1952
|
-
| `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) |
|
|
1953
2403
|
| `auto-review` | Auto-review on PR open/update | `true` | No |
|
|
1954
2404
|
| `checks` | Checks to run (comma-separated) | `all` | No |
|
|
1955
2405
|
| `output-format` | Output format | `markdown` | No |
|
|
1956
|
-
| `config-path` | Path to config file |
|
|
2406
|
+
| `config-path` | Path to config file | `.visor.yaml` | No |
|
|
1957
2407
|
| `max-parallelism` | Maximum number of checks to run in parallel | `3` | No |
|
|
1958
2408
|
| `fail-fast` | Stop execution when any check fails | `false` | No |
|
|
1959
2409
|
| `comment-on-pr` | Post review as PR comment | `true` | No |
|
|
@@ -1991,7 +2441,6 @@ jobs:
|
|
|
1991
2441
|
- uses: actions/checkout@v4
|
|
1992
2442
|
- uses: ./
|
|
1993
2443
|
with:
|
|
1994
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
1995
2444
|
auto-review: true # Enable automatic review
|
|
1996
2445
|
env:
|
|
1997
2446
|
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
|
|
@@ -2011,7 +2460,6 @@ jobs:
|
|
|
2011
2460
|
- name: Run Visor Security Scan
|
|
2012
2461
|
uses: ./
|
|
2013
2462
|
with:
|
|
2014
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
2015
2463
|
checks: security
|
|
2016
2464
|
output-format: sarif
|
|
2017
2465
|
|
|
@@ -2034,7 +2482,6 @@ jobs:
|
|
|
2034
2482
|
- uses: actions/checkout@v4
|
|
2035
2483
|
- uses: ./
|
|
2036
2484
|
with:
|
|
2037
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
2038
2485
|
min-score: 80
|
|
2039
2486
|
fail-on-critical: true
|
|
2040
2487
|
```
|
|
@@ -2055,8 +2502,7 @@ jobs:
|
|
|
2055
2502
|
steps:
|
|
2056
2503
|
- uses: actions/checkout@v4
|
|
2057
2504
|
- uses: ./
|
|
2058
|
-
with
|
|
2059
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
2505
|
+
# Optional: configure inputs (e.g., tag filters, custom configs) with a `with:` block
|
|
2060
2506
|
```
|
|
2061
2507
|
|
|
2062
2508
|
## 📊 Output Formats
|
|
@@ -2079,7 +2525,7 @@ jobs:
|
|
|
2079
2525
|
"summary": {
|
|
2080
2526
|
"overallScore": 85,
|
|
2081
2527
|
"totalIssues": 12,
|
|
2082
|
-
|
|
2528
|
+
"criticalIssues": 1
|
|
2083
2529
|
},
|
|
2084
2530
|
"issues": [
|
|
2085
2531
|
{
|
|
@@ -2123,7 +2569,7 @@ visor/
|
|
|
2123
2569
|
├── tests/ # Test suites
|
|
2124
2570
|
├── .github/workflows/ # GitHub workflows
|
|
2125
2571
|
├── action.yml # Action metadata
|
|
2126
|
-
└── visor.
|
|
2572
|
+
└── .visor.yaml # Project config (overrides defaults/.visor.yaml)
|
|
2127
2573
|
```
|
|
2128
2574
|
|
|
2129
2575
|
### Available Scripts
|