Metadata-Version: 2.4
Name: vibeguard-gate
Version: 0.9.0
Summary: Guardrails for vibe-coded software — a pre-merge safety gate for AI-generated changes
Project-URL: Homepage, https://github.com/dgenio/vibeguard
Project-URL: Repository, https://github.com/dgenio/vibeguard
Project-URL: Issues, https://github.com/dgenio/vibeguard/issues
Project-URL: Changelog, https://github.com/dgenio/vibeguard/releases
Author: VibeGuard Contributors
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Keywords: ai,code-review,devtools,security,static-analysis
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: pathspec>=0.12.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0.0
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: hypothesis>=6.31; extra == 'dev'
Requires-Dist: jsonschema>=4.0; extra == 'dev'
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Description-Content-Type: text/markdown

# VibeGuard

**Guardrails for vibe-coded software.**

> "AI coding tools made it cheap to generate code. They did not make it cheap to trust code."

[![CI](https://github.com/dgenio/vibeguard/actions/workflows/ci.yml/badge.svg)](https://github.com/dgenio/vibeguard/actions/workflows/ci.yml)
[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)

---

## Add VibeGuard to your PR workflow

**The deterministic pre-merge safety gate for AI-generated diffs** — runs in
single-digit seconds, fully offline, no API key.

**Try it locally** (full walkthrough in [Try it in 30 seconds](#try-it-in-30-seconds)):

```bash
pip install vibeguard-gate
vibeguard scan --path .
```

**Add it as a GitHub Actions PR gate** — one command generates the workflow:

```bash
vibeguard setup github-actions
```

This writes `.github/workflows/vibeguard.yml` wiring three PR surfaces in one
job: inline code-scanning annotations (SARIF), a single summary comment that
updates in place on each push, and a gate that fails the PR on high-severity
findings. Commit the file and open a PR. See
[one-command setup](docs/github-actions.md#0-one-command-setup) for options
(`--policy-pack`, `--fail-on`, `--with-config`, `--dry-run`).

Prefer to copy/paste instead? The minimal action snippet:

```yaml
# .github/workflows/vibeguard.yml
name: VibeGuard
on: [pull_request]
jobs:
  vibeguard:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: dgenio/vibeguard@v0.8.0
        with:
          diff: "true"
          fail-on: high
```

When a finding blocks, VibeGuard prints a severity/rule/path table and exits
non-zero — see [Example Output](#example-output). It **complements** Semgrep,
CodeQL, gitleaks, and Dependabot rather than replacing them; see the
[tool comparison guide](docs/comparison.md) for when to use it and when not to.

---

## The Problem

AI coding tools let developers ship in hours what used to take days. That is genuinely great. But accepting large AI-generated diffs without scrutiny creates a new failure mode that traditional security tools were not designed to catch:

- **Accidentally committed secrets** — API keys, tokens, and database URLs sneak in through AI-generated config files
- **Package publish leaks** — source maps, .env files, and test fixtures end up in npm/PyPI packages
- **Dependency supply chain risks** — AI agents pull in git URLs, typosquatted packages, or broad version ranges
- **Security control bypasses** — AI comments out auth checks or disables SSL verification to "make things work"
- **Risky code changes without tests** — huge diffs touching auth, crypto, and database writes with zero test coverage
- **AI footprints** — placeholder credentials, `# TODO: implement real auth`, and `trust all certificates`

## Why VibeGuard Exists

VibeGuard is **not** another AI wrapper, SAST scanner, or dependency checker.

It is a **fast, deterministic pre-merge safety gate** specifically designed for the failure modes of AI-assisted coding ("vibe coding"). It runs in seconds, works offline, and requires no API key.

Think of it as the check between "AI generated this diff" and "this diff reaches production."

## What It Catches

| Category | Examples |
|---|---|
| 🔑 **Secrets** | AWS keys, GitHub tokens, OpenAI keys, database URLs, private keys, .env files |
| 🗺️ **Source maps** | .map files in dist/, sourceMappingURL in bundles, npm packages that publish maps |
| 📦 **Packaging leaks** | .env, tests/, .github/, source maps in npm/PyPI packages |
| 🔗 **Dependency risks** | git/URL deps, typosquatted packages, unpinned versions (strict mode) |
| ⚠️ **Risky code patterns** | eval/exec, shell=True, JWT verify=False, CORS wildcard, pickle.loads, SQL construction |
| 🧪 **Missing tests** | Source changes with no corresponding test changes |
| 🤖 **AI footprints** | Placeholder creds, disabled auth, trust-all-certs, TODO stubs, temporary bypasses |
| 🐚 **Slopsquatting** | AI-hallucinated dependency names (offline heuristic + opt-in registry check) |
| 💉 **Prompt injection** | Agent-directed instructions, exfiltration directives, hidden/zero-width Unicode in comments/docs/config |

---

## Quickstart

```bash
pip install vibeguard-gate
```

Or from source:

```bash
git clone https://github.com/dgenio/vibeguard
cd vibeguard
pip install -e ".[dev]"
```

Initialize a config file:

```bash
vibeguard init
```

Scan a directory:

```bash
vibeguard scan --path .
```

Gate your CI (exits 1 if blocking findings found):

```bash
vibeguard gate --diff --fail-on high
```

---

## Try it in 30 seconds

The repo ships two deliberately-vulnerable example packages with fake
secrets, so you can see a real, meaningful set of findings without
pointing VibeGuard at anything sensitive:

```bash
git clone https://github.com/dgenio/vibeguard
cd vibeguard
pip install -e .
vibeguard scan --path examples/vulnerable-node-package
```

You should see ~16 findings spanning secrets, source-map leaks, packaging
leaks, risky patterns, and AI footprints — none of which touch the network
or call out to any external service. Try `examples/vulnerable-python-package`
for a Python-flavored version.

To use VibeGuard as a CI gate (exits non-zero on blocking findings):

```bash
vibeguard gate --path examples/vulnerable-python-package --fail-on medium
```

No API key, no telemetry, no network calls.

Want changes that look like a real PR rather than a kitchen-sink demo? See
[`examples/pr-scenarios/`](examples/pr-scenarios) — six self-contained
scenarios (disable-TLS-to-pass-tests, temporary auth bypass, packaging leaks,
committed agent memory, git-URL dependency, risky DB write) each with the
exact command, expected findings, and a fix.

---

## CLI Reference

### `vibeguard init`

Creates a `vibeguard.yaml` config file with sensible defaults.

```bash
vibeguard init
vibeguard init --path /path/to/repo
```

### `vibeguard setup github-actions`

Generates `.github/workflows/vibeguard.yml` — a complete PR gate that uploads
SARIF for inline code-scanning annotations, posts a single self-updating summary
comment, and fails the PR on findings at/above the threshold.

```bash
vibeguard setup github-actions                       # fail-on: high
vibeguard setup github-actions --policy-pack web-app # also writes vibeguard.yaml; fail-on from pack
vibeguard setup github-actions --fail-on medium      # override the threshold
vibeguard setup github-actions --dry-run             # print the workflow, write nothing
vibeguard setup github-actions --force               # overwrite an existing workflow
```

Existing files are never overwritten without `--force`.

### `vibeguard scan`

Scans a repository and prints findings. **Always exits 0** (informational).

```bash
vibeguard scan
vibeguard scan --path .
vibeguard scan --diff                  # only changed files (requires git)
vibeguard scan --json                  # machine-readable output
vibeguard scan --markdown              # for PR comments
vibeguard scan --verbose               # detailed descriptions
vibeguard scan --fail-on medium        # set threshold (informational only)
```

### `vibeguard gate`

Same as `scan` but **exits 1** when findings meet or exceed the threshold.

```bash
vibeguard gate --path . --fail-on high
vibeguard gate --diff --fail-on medium
```

### `vibeguard publish-check`

Simulate `npm publish` or `python -m build` and gate on findings in the
published file set, before anything reaches the registry.

```bash
vibeguard publish-check --path .
vibeguard publish-check --ecosystem npm --manifest-out publish-manifest.json
vibeguard publish-check --ecosystem python-sdist --fail-on medium
```

See [docs/pre-publish.md](docs/pre-publish.md) for the full guide,
finding IDs, and a GitHub Actions release-gate template.

### `vibeguard explain <finding-id>`

Print a detailed explanation and remediation guide for a finding.

```bash
vibeguard explain SEC-ENV
vibeguard explain MAP-DIST
vibeguard explain TEST-MISSING
```

---

## Example Output

Below is the actual output of `vibeguard scan --path examples/vulnerable-node-package`
on this repository (regenerate with the same command if rules change):

```
                                                       VibeGuard Findings
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Sev        ┃ Rule           ┃ Path                 ┃ Title                                              ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ ☠ CRITICAL │ secrets        │ src/server.js:12     │ GitHub Token detected                              │
│ ✗ HIGH     │ secrets        │ .env                 │ Sensitive file committed: .env                     │
│ ✗ HIGH     │ sourcemaps     │ package.json         │ package.json 'files' includes source maps          │
│ ✗ HIGH     │ packaging      │ package.json         │ npm package may publish Environment files (.env)   │
│ ✗ HIGH     │ packaging      │ package.json         │ npm package may publish Source map files           │
│ ✗ HIGH     │ dependencies   │ package.json         │ URL/git/path dependency: axios                     │
│ ✗ HIGH     │ ai_footprints  │ src/server.js:14     │ AI footprint: Security disabled in code            │
│ ✗ HIGH     │ ai_footprints  │ src/server.js:31     │ AI footprint: Trust-all certificates               │
│ ✗ HIGH     │ auth           │ src/server.js:16     │ Auth: Auth bypass TODO/FIXME/HACK comment          │
│ ⚠ MEDIUM   │ packaging      │ .npmignore:8         │ Overly broad .npmignore negation: '!*'             │
│ ⚠ MEDIUM   │ risky_diff     │ src/server.js:9      │ Risk-sensitive area changed: CORS configuration    │
│ ⚠ MEDIUM   │ risky_diff     │ src/server.js:27     │ Risk-sensitive area changed: eval() or exec() usag │
│ ⚠ MEDIUM   │ risky_diff     │ src/server.js:32     │ Risk-sensitive area changed: Environment variable  │
│ ⚠ MEDIUM   │ ai_footprints  │ src/server.js:17     │ AI footprint: Temporary security bypass or mock    │
│ ↓ LOW      │ packaging      │ package.json         │ package.json runs `prepare` at publish time        │
│ ℹ INFO     │ ai_footprints  │ src/server.js:11     │ AI footprint: AI-generated code comment            │
└────────────┴────────────────┴──────────────────────┴────────────────────────────────────────────────────┘

  Scanned 5 file(s)  •  16 finding(s)  |  critical: 1  high: 8  medium: 5  low: 1  info: 1  •  policy: balanced
```

`vibeguard scan` always exits `0` (informational). `vibeguard gate` runs
the same checks but exits `1` when findings meet or exceed `--fail-on`:

```bash
vibeguard gate --path examples/vulnerable-node-package --fail-on high
echo "exit: $?"   # exit: 1
```

---

## Policy Levels

| Policy | Description |
|---|---|
| `relaxed` | Only critical and high findings |
| `balanced` | High + medium findings (default) |
| `strict` | All findings; unpinned dependencies and missing tests are elevated |

Set in `vibeguard.yaml`:

```yaml
policy: strict
fail_on: medium
```

Or override on the command line:

```bash
vibeguard gate --fail-on medium
```

---

## Configuration

Run `vibeguard init` to create a `vibeguard.yaml`:

```yaml
policy: balanced
fail_on: high

ignore:
  paths:
    - .git/
    - node_modules/
    - .venv/
    - dist/
    - build/
  findings: []        # suppress specific finding IDs

secrets:
  enabled: true
  min_entropy: 3.5

sourcemaps:
  enabled: true

packaging:
  enabled: true

dependencies:
  enabled: true

# `risky_patterns:` tunes the `risky_diff` rule — the YAML section name and
# the rule id differ for historical reasons. Use `vibeguard rules explain
# <rule-id>` to look up the config section for any rule.
risky_patterns:
  enabled: true

tests:
  enabled: true

ai_footprints:
  enabled: true
```

---

## GitHub Actions Usage

Add to your pull request workflow:

```yaml
name: VibeGuard
on: [pull_request]
jobs:
  vibeguard:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - run: pip install vibeguard-gate
      - run: vibeguard gate --diff --fail-on high
```

For local development (before publishing to PyPI):

```yaml
      - run: pip install -e .
      - run: vibeguard gate --fail-on high
```

---

## Rule quick reference

VibeGuard ships **13 deterministic rules**. Each rule emits one or more
stable finding IDs you can target with `vibeguard explain <ID>`,
suppress via `vibeguard.yaml`, or remap via `severity_overrides`.

| Rule              | Default severity | Detects                                                                                          |
|-------------------|------------------|---------------------------------------------------------------------------------------------------|
| `secrets`         | high             | AWS keys, GitHub/OpenAI/Slack/Stripe tokens, private keys, bearer tokens, hardcoded passwords, DB URLs with credentials, committed `.env` files. |
| `sourcemaps`      | high             | `.map` files in `dist/`/`build/`, `sourceMappingURL` comments, `package.json` `files` entries that include source maps. |
| `packaging`       | medium           | npm/PyPI manifests that would publish `.env`, tests, source maps, build configs; broad `MANIFEST.in` grafts, `.npmignore` negations. |
| `dependencies`    | high             | git/URL/path dependencies, typosquatting heuristics, broad version ranges, lockfile drift, registry changes. |
| `risky_diff`      | medium           | Changes to risk-sensitive areas (auth, crypto, eval/exec, shell, network, DB writes, payments, CORS, JWT, certs) plus diff-breadth/size signals. |
| `auth`            | high             | Commented-out auth, JWT `alg=none`, hardcoded admin passwords, `verify=False`, allow-all middlewares, auth functions that return `True`/`nil`. |
| `sql`             | high             | f-string / concatenation / template-literal / `fmt.Sprintf` SQL construction that smells like injection. |
| `ai_footprints`   | medium           | AI generation comments, placeholder credentials, trust-all-certs, CORS wildcards, temporary bypasses, skip-validation, hallucinated TODOs. |
| `agent_memory`    | high             | Accidentally committed agent artifacts: SQLite memory DBs, JSONL logs, transcripts, tool traces, hidden memory directories. |
| `ci_docker`       | high             | Risky Dockerfiles and GitHub Actions: privileged containers, `latest` tags, curl-pipe-bash, `pull_request_target`, broad permissions, secret echoes, unversioned actions. |
| `iac`             | high             | Terraform: IAM wildcards, open security groups, public S3, unencrypted resources. Kubernetes: privileged containers, hostPath, root user, no-TLS, allow-all policies. |
| `go_rules`        | high             | Go-specific risks: TLS bypass, shell injection, CORS wildcards, SQL via `Sprintf`, hardcoded tokens, auth bypass comments, unsafe file deletion. |
| `slopsquat`       | high             | AI-hallucinated dependencies: descriptive multi-token names absent from the lockfile, plus an opt-in registry existence/age check (network). |
| `prompt_injection`| high             | Agent-directed prompt-injection planted in comments/docstrings/markdown/config: instruction overrides, exfiltration directives, hidden/zero-width Unicode, base64 payloads. |
| `tests`           | low              | Source files changed without any corresponding test-file changes. |

Run `vibeguard explain <finding-id>` for the full remediation guidance for any specific finding (e.g. `vibeguard explain SEC-GITHUBTOKEN`).

`risky_diff` is intentionally a **risk signal**, not a vulnerability
claim — it says "human, please look at this," not "this is exploitable."

---

## What VibeGuard is / is not

**Is:**

- A deterministic, offline pre-merge safety gate for the kinds of mistakes
  AI-assisted coding produces at scale.
- A fast first line of defense — typically runs in single-digit seconds
  on a typical repo, suitable for pre-commit hooks and PR gates.
- A tool that requires **no API key, no network calls, no telemetry**,
  and no LLM in the loop.

**Is not:**

- A full SAST replacement (use Semgrep, CodeQL, Bandit, ESLint security
  plugins for deep semantic analysis).
- A secret-scanning replacement for already-leaked credentials (use
  truffleHog or gitleaks against your full git history).
- A dependency vulnerability scanner (use Dependabot, pip-audit, npm
  audit, Snyk for CVE coverage).
- A substitute for human code review.
- A guarantee that code is safe or production-ready.

### Where VibeGuard fits next to other tools

| Tool category                     | What it's great at                       | What it tends to miss for AI-generated diffs              |
|-----------------------------------|------------------------------------------|------------------------------------------------------------|
| **VibeGuard**                     | Pre-merge gate for AI-coding failure modes (secrets in new files, packaging leaks, "trust all certs", commented-out auth, risky-diff signals). | Deep dataflow analysis, CVE lookups, historical leak scans. |
| Secret scanners (gitleaks, truffleHog) | Wide pattern coverage; can scan full git history. | A `.env` that's about to be committed *now*; secrets in newly-staged code that hasn't been pushed yet. |
| SAST (Semgrep, CodeQL, Bandit)    | Deep dataflow; community rule packs.     | "AI footprint" patterns (`# TODO: real auth`, `verify=False`, CORS wildcards) and packaging-manifest hygiene. |
| Dependency scanners (Dependabot, pip-audit, npm audit, Snyk) | Known CVEs; transitive vuln coverage. | git/URL dependencies, typosquatting heuristics, lockfile drift introduced by an AI commit. |
| Linters (ruff, eslint)            | Style + simple correctness.              | Anything security-shaped.                                 |

The intent is to **complement** these tools, not replace them. A typical
CI pipeline runs VibeGuard alongside one of each of the above.

For a deeper, per-tool breakdown — when to reach for VibeGuard and when not
to, plus a recommended layered CI pipeline — see the
[tool comparison guide](docs/comparison.md).

### Speed & false positives

VibeGuard ships a reproducible [benchmark & evaluation report](docs/benchmark.md):
scan throughput on synthetic repos, detection across Node/Python/Go/Terraform
fixtures, and a **zero blocking false-positives** baseline on clean code. Run
it yourself with `make bench` and `make bench-scenarios`.

---

## Ecosystem

VibeGuard is **fully standalone**. It has no runtime dependency on any
external service, API, or sibling project, and it never phones home. The only
thing it needs is the diff or directory you point it at.

It is built to fit *into* a broader toolchain through standard, boring
interfaces — process exit codes, JSON and SARIF reports, and editor
diagnostics — so downstream tooling can consume its findings without coupling
to VibeGuard internals. Treat those outputs as the integration surface:
nothing downstream is required for VibeGuard to do its job, and adopting
VibeGuard never forces any other tool on you.

---

## Part of the Weaver Stack

VibeGuard is the **dev-time / pre-merge guardrail** in the
[Weaver Stack](https://github.com/dgenio/weaver-spec) — a family of
independently useful tools that share contracts but never each other's
runtime. VibeGuard sits *off the runtime request path*: it gates AI-generated
diffs **before** they merge.

```mermaid
flowchart LR
    dev["AI-generated diff"] --> vg["VibeGuard<br/>(dev-time gate · pre-merge)"]
    vg -->|"merged code"| af["agentfence<br/>(runtime edge)"]
    vg -. "ArtifactSafetyReport<br/>(repeated findings)" .-> lw["lessonweaver<br/>(learning loop → reviewed lessons)"]
    lw -. "AGENTS.md guidance" .-> dev
    spec["weaver-spec<br/>(shared contracts)"] -. defines .- vg
    spec -. defines .- af
    spec -. defines .- lw
```

The connections are **standard, serialized contracts**, not coupling:

- VibeGuard's `--weaver` export emits a weaver-spec
  [`ArtifactSafetyReport`](docs/weaver/artifact_safety_report.schema.json);
  see [docs/interop-lessons.md](docs/interop-lessons.md) for how repeated
  findings become reviewed lessons in **lessonweaver**.
- **agentfence** is the runtime edge; **lessonweaver** closes the learning
  loop; **weaver-spec** holds the shared contracts.

None of this changes the promise above: VibeGuard remains **fully standalone**,
has **no runtime dependency** on any sibling, and **never phones home**. The
stack is a set of interfaces you can opt into, not a framework you have to
adopt. Repos in the stack carry the `weaver-stack` topic on GitHub.

---

## Stability & roadmap

VibeGuard is meant to be enforced in CI, so its behaviour is contractual:

- **[docs/stability-contract.md](docs/stability-contract.md)** — which
  surfaces are stable (CLI, exit codes, finding IDs, JSON/SARIF), how
  `scan` and `gate` differ, the versioning policy, and the fail-closed
  guarantees for bad paths, malformed config, and empty scans.
- **[docs/roadmap.md](docs/roadmap.md)** — where the project is heading
  (trust before breadth), the label taxonomy, what makes a good rule, and
  when to ship a plugin instead of a core rule.

Maintainers: see **[docs/release-checklist.md](docs/release-checklist.md)**
for the release process that keeps the README, PyPI, tags, and action
snippets aligned (`make check-versions` is the automated guard).

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for local setup, test commands,
branch and commit conventions, and how to add a new rule.

For security disclosures, see [SECURITY.md](SECURITY.md) — do not file
public issues for vulnerabilities.

Filing a bug, feature, rule request, or false-positive? Use the
[issue forms](https://github.com/dgenio/vibeguard/issues/new/choose).

- **[docs/rules.md](docs/rules.md)** — auto-generated rule reference (`make docs` to regenerate).
- **[docs/how-to-add-a-rule.md](docs/how-to-add-a-rule.md)** — step-by-step guide for adding a built-in rule.
- **[docs/plugin-api.md](docs/plugin-api.md)** — public plugin API for shipping rules in your own package.
- **[docs/policy-packs.md](docs/policy-packs.md)** — built-in policy packs (`oss-library`, `web-app`, `strict-ci`) and source-test mapping for monorepos.
- **[docs/pre-commit.md](docs/pre-commit.md)** — run VibeGuard locally via the [pre-commit](https://pre-commit.com) framework.
- **[docs/docker.md](docs/docker.md)** — run VibeGuard as a container in any CI environment.

---

## License

Apache 2.0 — see [LICENSE](LICENSE).
