guardvibe 3.12.0 → 3.13.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to GuardVibe are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.13.0] - 2026-06-07
9
+
10
+ ### Added — Season 3 S3-3: PR-native, author-independent review (441 rules / 37 tools)
11
+ - **`guardvibe ci github --pr`** generates a `.github/workflows/guardvibe-pr-review.yml` that, on every pull request, runs a **diff-aware** scan (only the issues the PR newly introduced) and posts them as **inline review comments** on the exact file + line — the moat made visible where AI-written code lands: whole-repo aware, independent of the author, in the loop.
12
+ - Uses `actions/github-script` to create the PR review (no extra runtime dependency), with `pull-requests: write` and a graceful fallback to a summary comment if inline review can't be posted. Pinned + auto-upgraded like the existing scan workflow.
13
+ - Completes Season 3 (S3-1 autonomous/prioritized intel, S3-2 proof-carrying fixes, S3-3 PR-native review). New exported `buildGithubPrReviewWorkflow`; 6 tests. No rule or tool changes (441 / 37).
14
+
15
+ Gate green (build / lint / test / self-audit PASS / A / 0).
16
+
8
17
  ## [3.12.0] - 2026-06-07
9
18
 
10
19
  ### Added — Season 3 S3-2: proof-carrying fixes (441 rules / 37 tools)
package/README.md CHANGED
@@ -150,7 +150,8 @@ npx guardvibe hook uninstall # Remove hook
150
150
  ### CI/CD (GitHub Actions)
151
151
 
152
152
  ```bash
153
- npx guardvibe ci github # Generates .github/workflows/guardvibe.yml
153
+ npx guardvibe ci github # Generates .github/workflows/guardvibe.yml (SARIF scan)
154
+ npx guardvibe ci github --pr # + a diff-aware PR review workflow that posts inline comments
154
155
  ```
155
156
 
156
157
  ## What GuardVibe Scans
package/build/cli/ci.d.ts CHANGED
@@ -2,4 +2,11 @@
2
2
  * CLI: guardvibe ci <provider>
3
3
  * Generates CI/CD workflow configurations.
4
4
  */
5
+ /**
6
+ * PR-native, author-independent review workflow: on each PR, run a DIFF-AWARE scan
7
+ * (only issues newly introduced by the PR) and post them as inline review comments
8
+ * via actions/github-script — no extra runtime dependency. The moat made visible
9
+ * exactly where AI-written code lands.
10
+ */
11
+ export declare function buildGithubPrReviewWorkflow(version: string): string;
5
12
  export declare function runCi(args: string[]): void;
package/build/cli/ci.js CHANGED
@@ -45,6 +45,78 @@ jobs:
45
45
  category: guardvibe
46
46
  `;
47
47
  }
48
+ /**
49
+ * PR-native, author-independent review workflow: on each PR, run a DIFF-AWARE scan
50
+ * (only issues newly introduced by the PR) and post them as inline review comments
51
+ * via actions/github-script — no extra runtime dependency. The moat made visible
52
+ * exactly where AI-written code lands.
53
+ */
54
+ export function buildGithubPrReviewWorkflow(version) {
55
+ return `name: GuardVibe PR Review
56
+ # Pinned to guardvibe@${version}. Re-run \`npx guardvibe ci github --pr\` to upgrade.
57
+ # Diff-aware: comments only on issues this PR newly introduced (not pre-existing debt).
58
+
59
+ on:
60
+ pull_request:
61
+ branches: [main, master]
62
+
63
+ permissions:
64
+ contents: read
65
+ pull-requests: write
66
+
67
+ jobs:
68
+ guardvibe-pr-review:
69
+ name: GuardVibe PR Review
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+ with:
74
+ fetch-depth: 0
75
+ persist-credentials: false
76
+
77
+ - uses: actions/setup-node@v4
78
+ with:
79
+ node-version: "22"
80
+
81
+ - name: GuardVibe diff-aware scan (newly-introduced issues only)
82
+ run: |
83
+ git fetch --no-tags --depth=1 origin "\${{ github.base_ref }}"
84
+ npx -y guardvibe@${version} diff "origin/\${{ github.base_ref }}" --format json --output gv-diff.json || true
85
+
86
+ - name: Post findings as PR review comments
87
+ uses: actions/github-script@v7
88
+ with:
89
+ script: |
90
+ const fs = require('fs');
91
+ let data;
92
+ try { data = JSON.parse(fs.readFileSync('gv-diff.json', 'utf8')); } catch (e) { return; }
93
+ const findings = (data.findings || []).filter(f => f.line > 0);
94
+ if (!findings.length) return;
95
+ const comments = findings.map(f => ({
96
+ path: f.file,
97
+ line: f.line,
98
+ body: '**GuardVibe ' + String(f.severity).toUpperCase() + ': ' + f.name + '** (' + f.id + ')\\n\\n' + (f.fix || '')
99
+ }));
100
+ const summary = 'GuardVibe found ' + findings.length + ' newly-introduced issue(s) in this PR.';
101
+ try {
102
+ await github.rest.pulls.createReview({
103
+ owner: context.repo.owner,
104
+ repo: context.repo.repo,
105
+ pull_number: context.issue.number,
106
+ event: 'COMMENT',
107
+ body: summary,
108
+ comments
109
+ });
110
+ } catch (e) {
111
+ await github.rest.issues.createComment({
112
+ owner: context.repo.owner,
113
+ repo: context.repo.repo,
114
+ issue_number: context.issue.number,
115
+ body: summary + ' (inline review unavailable: ' + e.message + ')'
116
+ });
117
+ }
118
+ `;
119
+ }
48
120
  /** Extract a pinned guardvibe version from a generated workflow YAML, or "latest"/null for legacy/unrecognized forms. */
49
121
  function extractPinnedVersionFromWorkflow(content) {
50
122
  const pinned = content.match(/guardvibe@(\d+\.\d+\.\d+(?:-[\w.]+)?)/);
@@ -85,14 +157,43 @@ function generateGitHubActions() {
85
157
  console.log(` [OK] Created .github/workflows/guardvibe.yml (pinned to v${pkg.version}).`);
86
158
  console.log(" [OK] SARIF results will appear in GitHub Security tab.");
87
159
  }
160
+ function generateGitHubPrReview() {
161
+ const workflowDir = join(process.cwd(), ".github", "workflows");
162
+ if (!existsSync(workflowDir))
163
+ mkdirSync(workflowDir, { recursive: true });
164
+ const workflowPath = join(workflowDir, "guardvibe-pr-review.yml");
165
+ const fresh = buildGithubPrReviewWorkflow(pkg.version);
166
+ if (existsSync(workflowPath)) {
167
+ const existingPin = extractPinnedVersionFromWorkflow(readFileSync(workflowPath, "utf-8"));
168
+ if (existingPin === pkg.version) {
169
+ console.log(` [OK] .github/workflows/guardvibe-pr-review.yml already up-to-date (pinned to v${pkg.version}).`);
170
+ return;
171
+ }
172
+ if (existingPin) {
173
+ writeFileSync(workflowPath, fresh, "utf-8");
174
+ console.log(` [OK] Updated .github/workflows/guardvibe-pr-review.yml (${existingPin} → ${pkg.version}).`);
175
+ return;
176
+ }
177
+ console.log(" [OK] .github/workflows/guardvibe-pr-review.yml exists with custom contents — leaving as-is.");
178
+ return;
179
+ }
180
+ writeFileSync(workflowPath, fresh, "utf-8");
181
+ console.log(` [OK] Created .github/workflows/guardvibe-pr-review.yml (pinned to v${pkg.version}).`);
182
+ console.log(" [OK] PRs will get inline, diff-aware GuardVibe review comments.");
183
+ }
88
184
  export function runCi(args) {
89
185
  const provider = args[0]?.toLowerCase();
186
+ const wantPr = args.includes("--pr");
90
187
  console.log(`\n GuardVibe CI/CD Setup\n`);
91
188
  if (provider === "github") {
92
189
  generateGitHubActions();
190
+ if (wantPr)
191
+ generateGitHubPrReview();
192
+ else
193
+ console.log(" [tip] Add --pr to also generate a diff-aware PR review workflow (inline comments).");
93
194
  }
94
195
  else {
95
- console.error(" [ERR] Unknown CI provider. Usage: npx guardvibe ci github");
196
+ console.error(" [ERR] Unknown CI provider. Usage: npx guardvibe ci github [--pr]");
96
197
  process.exit(1);
97
198
  }
98
199
  console.log();
package/build/cli.js CHANGED
@@ -37,7 +37,7 @@ function printUsage() {
37
37
  npx guardvibe init <platform> Setup MCP server configuration
38
38
  npx guardvibe hook install Install pre-commit security hook
39
39
  npx guardvibe hook uninstall Remove pre-commit security hook
40
- npx guardvibe ci github Generate GitHub Actions workflow
40
+ npx guardvibe ci github [--pr] Generate GitHub Actions workflow (--pr: diff-aware PR review with inline comments)
41
41
 
42
42
  Scan CLI (used by pre-commit hook and CI):
43
43
  npx guardvibe-scan Scan git-staged files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardvibe",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "mcpName": "io.github.goklab/guardvibe",
5
5
  "description": "Security infrastructure your AI can't be — deterministic, current past your model's training cutoff, whole-repo-aware, author-independent. Security MCP for vibe coding. 441 rules, 37 tools, CLI + doctor. Host security, auth coverage mapping, LLM-powered deep scan (IDOR/business logic), taint analysis. 70 CVE rules refreshed daily from GHSA/OSV/CISA KEV — React Router 7 cluster, DOMPurify XSS, Better Auth bypass, Miasma @redhat-cloud-services compromise, Next.js May 2026 13-advisory cluster, Drizzle/MikroORM/Kysely SQL injection, Axios proxy-auth redirect leak, Hono setCookie attribute injection, Clerk SSRF, tRPC prototype pollution, @tanstack supply-chain, node-ipc protestware, OpenClaude sandbox bypass, plus the full AI-generated stack (Supabase, Stripe, Prisma, Hono, GraphQL, Convex, Turso, Uploadthing, AI SDK). 68 AI-native rules including OWASP MCP Top 10 tool-description prompt injection (VG1068), model-controlled sandbox-disable flag detection (VG1063), Session messenger exfil endpoint IOC (VG1075), and CI/CD supply-chain hardening (VG1070 npm --expect-provenance / --ignore-scripts enforcement).",
6
6
  "type": "module",