@securityreviewai/vibereview-cli 0.1.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.
Files changed (58) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +189 -0
  3. package/SECURITY.md +46 -0
  4. package/bin/vibereview.js +7 -0
  5. package/dist/catalog/guardrails.br +0 -0
  6. package/dist/src/cli.js +103 -0
  7. package/dist/src/commands/generate.js +36 -0
  8. package/dist/src/commands/init.js +142 -0
  9. package/dist/src/core/assets.js +19 -0
  10. package/dist/src/core/catalog.js +51 -0
  11. package/dist/src/core/code-guardrails.js +154 -0
  12. package/dist/src/core/detector.js +214 -0
  13. package/dist/src/core/evidence.js +107 -0
  14. package/dist/src/core/fs.js +16 -0
  15. package/dist/src/core/generation-prompt.js +35 -0
  16. package/dist/src/core/generator.js +42 -0
  17. package/dist/src/core/hash.js +18 -0
  18. package/dist/src/core/integration.js +197 -0
  19. package/dist/src/core/matcher.js +33 -0
  20. package/dist/src/core/repository.js +36 -0
  21. package/dist/src/core/workspace.js +157 -0
  22. package/dist/src/providers/claude.js +27 -0
  23. package/dist/src/providers/codex.js +27 -0
  24. package/dist/src/providers/copilot.js +44 -0
  25. package/dist/src/providers/cursor.js +27 -0
  26. package/dist/src/providers/index.js +23 -0
  27. package/dist/src/providers/process.js +16 -0
  28. package/dist/src/providers/types.js +2 -0
  29. package/dist/src/runners/claude.js +22 -0
  30. package/dist/src/runners/codex.js +25 -0
  31. package/dist/src/runners/copilot.js +21 -0
  32. package/dist/src/runners/cursor.js +20 -0
  33. package/dist/src/runners/index.js +26 -0
  34. package/dist/src/runners/process.js +34 -0
  35. package/dist/src/runners/types.js +2 -0
  36. package/dist/src/types.js +2 -0
  37. package/dist/src/ui.js +22 -0
  38. package/docs/provider-contracts.md +55 -0
  39. package/package.json +49 -0
  40. package/runtime/hook-context.cjs +44 -0
  41. package/schemas/code-guardrails-v1.json +45 -0
  42. package/skills/guardrail-generator/SKILL.md +237 -0
  43. package/skills/guardrail-generator/agents/openai.yaml +3 -0
  44. package/skills/guardrail-generator/evals/evals.json +23 -0
  45. package/skills/guardrail-generator/references/output-contract.md +40 -0
  46. package/skills/vibereview-guardrails/SKILL.md +58 -0
  47. package/skills/vibereview-guardrails/agents/openai.yaml +3 -0
  48. package/skills/vibereview-osv-scan/SKILL.md +60 -0
  49. package/skills/vibereview-osv-scan/agents/openai.yaml +3 -0
  50. package/skills/vibereview-osv-scan/scripts/osv-scan.mjs +77 -0
  51. package/skills/vibereview-report/SKILL.md +49 -0
  52. package/skills/vibereview-report/agents/openai.yaml +3 -0
  53. package/skills/vibereview-report/references/report-contract.md +100 -0
  54. package/skills/vibereview-secure-code/SKILL.md +57 -0
  55. package/skills/vibereview-secure-code/agents/openai.yaml +3 -0
  56. package/skills/vibereview-threat-model/SKILL.md +60 -0
  57. package/skills/vibereview-threat-model/agents/openai.yaml +3 -0
  58. package/skills/vibereview-threat-model/references/pwnisms.md +46 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 VibeReview contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # VibeReview CLI
2
+
3
+ Local-first security guardrails for AI coding agents. VibeReview detects a repository's technology stack, selects relevant rules from its bundled catalog, and uses the developer's chosen coding-agent CLI to derive a small set of repository-specific guardrails.
4
+
5
+ ## Current status
6
+
7
+ Milestone 3 is implemented across Cursor, Codex, Claude Code, and GitHub Copilot:
8
+
9
+ - interactive provider selection;
10
+ - provider-specific installation and authentication preflight;
11
+ - deterministic, token-free technology detection;
12
+ - 77 compact guardrail packs bundled as one compressed runtime asset;
13
+ - deterministic pack matching and guardrail deduplication;
14
+ - bundled `guardrail-generator` skill with a strict, versioned output contract;
15
+ - bounded collection of security-relevant source evidence;
16
+ - automatic code-specific guardrail generation during initialization;
17
+ - explicit `vibereview guardrails generate` regeneration; and
18
+ - atomic workspace updates that preserve custom guardrails;
19
+ - native workspace instructions, project skills, and session hooks for every provider;
20
+ - prompt-time local guardrail selection and PWNISMS threat modelling;
21
+ - direct OSV.dev checks for every added or version-changed dependency;
22
+ - secure-by-default implementation guidance and verification; and
23
+ - one human-readable Markdown security report per IDE chat.
24
+
25
+ No server, VibeReview account, MCP server, artifact upload, or report synchronization is required.
26
+
27
+ ## Requirements
28
+
29
+ - Node.js 20.12 or newer
30
+ - Git, recommended but not required
31
+ - at least one supported coding CLI: Cursor, Codex, Claude Code, or GitHub Copilot
32
+
33
+ Useful provider checks:
34
+
35
+ ```bash
36
+ cursor-agent --version
37
+ cursor-agent status
38
+
39
+ codex --version
40
+ codex login status
41
+
42
+ claude --version
43
+ claude auth status
44
+
45
+ copilot version
46
+ ```
47
+
48
+ Copilot has no documented non-interactive authentication-status command. VibeReview detects configured token environment variables or GitHub CLI authentication when available; otherwise it defers the definitive authentication check until the first Copilot agent run.
49
+
50
+ The exact preflight contract and primary documentation links are maintained in [docs/provider-contracts.md](docs/provider-contracts.md).
51
+
52
+ ## Install and initialize
53
+
54
+ Run the CLI without a global installation:
55
+
56
+ ```bash
57
+ npx @securityreviewai/vibereview-cli init
58
+ ```
59
+
60
+ Or install it globally and use the shorter executable name:
61
+
62
+ ```bash
63
+ npm install --global @securityreviewai/vibereview-cli
64
+ vibereview init
65
+ ```
66
+
67
+ ## Development usage
68
+
69
+ ```bash
70
+ npm install
71
+ npm run build
72
+ node bin/vibereview.js init
73
+ ```
74
+
75
+ Non-interactive usage:
76
+
77
+ ```bash
78
+ node bin/vibereview.js init --provider codex --yes
79
+ ```
80
+
81
+ Accepted provider IDs are `cursor`, `codex`, `claude`, and `copilot`.
82
+
83
+ Initialization performs deterministic stack detection first, then automatically asks the selected provider CLI to generate code-specific rules. If that provider request fails, VibeReview still installs the baseline rules and prints a retry command. To regenerate after the code changes:
84
+
85
+ ```bash
86
+ node bin/vibereview.js guardrails generate
87
+ ```
88
+
89
+ Initialization also installs the local security workflow for the selected provider. Restart an already-running IDE agent after initialization so it reloads workspace instructions, skills, and hooks.
90
+
91
+ Additional options:
92
+
93
+ ```text
94
+ --force Refresh managed files while preserving custom rules
95
+ --json Print machine-readable output
96
+ --verbose Print detailed detection evidence and warnings
97
+ --cwd <path> Initialize another workspace
98
+ ```
99
+
100
+ ## Workspace output
101
+
102
+ VibeReview creates:
103
+
104
+ ```text
105
+ .vibereview/
106
+ ├── config.json
107
+ ├── profile.json
108
+ ├── guardrails.yml
109
+ ├── state.json
110
+ ├── gates/
111
+ └── reports/
112
+ ```
113
+
114
+ The full catalog and generator skill remain inside the installed npm package. They are not copied into the target workspace. `guardrails.yml` contains only matched baseline, generated code-specific, and user-maintained custom rules.
115
+
116
+ ## Code-specific generation
117
+
118
+ VibeReview selects at most 30 security-relevant source files, capped at 80 KB in total and 24 KB per file. It excludes common dependency/build directories, provider configuration directories, `.env` files, credential-like paths, private keys, lockfiles, binary files, and symbolic links. The selected contents are sent through the configured provider CLI under that provider's own account and data-handling terms.
119
+
120
+ The provider runs in a temporary empty directory rather than the repository. Cursor uses plan mode and sandboxing; Codex uses an ephemeral read-only execution; Claude Code runs in plan mode with tools disabled and no persisted session; Copilot runs non-interactively with only its read tool exposed to the empty directory. The model receives the bounded evidence inline and cannot edit the repository through this job.
121
+
122
+ Generated output must pass the bundled JSON schema. Every rule needs an exact evidence path from the supplied bundle, generic or baseline-duplicate rules are removed, and invalid output gets one repair attempt. A successful regeneration atomically replaces only `code_specific`; baseline and custom rules remain intact.
123
+
124
+ ## Prompt-time security workflow
125
+
126
+ For a security-relevant prompt, the configured coding agent performs this local sequence:
127
+
128
+ 1. shortlist applicable rules from `.vibereview/guardrails.yml`;
129
+ 2. run a focused PWNISMS threat model before implementation;
130
+ 3. when dependencies change, scan exact proposed versions with OSV.dev and re-scan any selected fix;
131
+ 4. implement secure-by-default code using the threats, guardrails, and dependency decision;
132
+ 5. run proportionate verification; and
133
+ 6. write or update the chat's Markdown report.
134
+
135
+ The bundled skills are installed into the selected provider's project skill directory. Always-on workspace instructions route security-relevant prompts through them; hooks supply session/startup context where the provider supports it.
136
+
137
+ | Provider | Always-on instructions | Project skills | Hook configuration |
138
+ |---|---|---|---|
139
+ | Cursor | `.cursor/rules/vibereview-security.mdc` | `.cursor/skills/vibereview-*` | `.cursor/hooks.json` |
140
+ | Codex | `AGENTS.md` managed block | `.codex/skills/vibereview-*` | `.codex/hooks.json` |
141
+ | Claude Code | `.claude/CLAUDE.md` managed block | `.claude/skills/vibereview-*` | `.claude/settings.json` |
142
+ | GitHub Copilot | `.github/copilot-instructions.md` managed block | `.github/skills/vibereview-*` | `.github/hooks/vibereview.json` |
143
+
144
+ Existing instruction content and unrelated hooks are preserved. Dedicated VibeReview files are overwritten only when they already contain VibeReview ownership markers.
145
+
146
+ ## Markdown session reports
147
+
148
+ Reports live at:
149
+
150
+ ```text
151
+ .vibereview/reports/<chat-session-id>.md
152
+ ```
153
+
154
+ The IDE agent writes the report directly; the CLI does not generate a JSON scan. The session ID is the complete file identity, so feature title changes cannot create another report accidentally. A new IDE chat creates one Markdown file. Every security-relevant follow-up reads and rewrites that same file. The agent may add, revise, reorder, or remove content so the report describes the latest cumulative state rather than preserving a chronological log.
155
+
156
+ Reports retain the established VibeReview fields in readable sections: summary, scope and assumptions, threats mitigated, best practices achieved, OSV.dev dependency security, secure code changes, guardrails applied, OWASP mappings, verification, and residual risks. YAML frontmatter carries session identity, provider, status, and timestamps.
157
+
158
+ ## Deterministic detection
159
+
160
+ The detector ignores dependency, build, virtual-environment, and VCS directories. It derives technologies from manifests, dependency names, source extensions, and recognized infrastructure files. It does not invoke a model and does not read `.env` files or credentials.
161
+
162
+ Currently recognized signals include major JavaScript/TypeScript and Python frameworks, Go, Rust, Java, common databases, authentication libraries, Docker, Kubernetes, Terraform providers, GitHub Actions, OpenAPI, MCP, and popular agent frameworks.
163
+
164
+ ## Catalog maintenance
165
+
166
+ The checked-in catalog is a compact runtime projection. It deliberately omits the much larger compliance-description payloads used by VibeReview Main.
167
+
168
+ To import the source packs and rebuild the compressed asset:
169
+
170
+ ```bash
171
+ npm run catalog:import -- /path/to/guardrail-packs
172
+ npm run build:catalog
173
+ ```
174
+
175
+ ## Testing
176
+
177
+ ```bash
178
+ npm test
179
+ ```
180
+
181
+ The suite covers catalog and skill assets, stack detection, evidence limits and exclusions, output validation, retry behavior, runner isolation flags, rule normalization, atomic updates, all-provider workflow installation, existing-file preservation, hook session identity, Markdown report contracts, and non-interactive initialization. Tests do not invoke paid provider requests.
182
+
183
+ ## Security
184
+
185
+ Please read [SECURITY.md](SECURITY.md) before reporting a vulnerability. Deterministic profiling is local; code-specific generation sends the documented bounded evidence through the selected provider CLI.
186
+
187
+ ## License
188
+
189
+ Apache License 2.0. See [LICENSE](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,46 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Do not open a public issue for a suspected vulnerability. Contact the VibeReview maintainers privately with:
6
+
7
+ - the affected version;
8
+ - reproduction steps;
9
+ - expected and observed behavior; and
10
+ - the potential security impact.
11
+
12
+ A dedicated private reporting address or GitHub private vulnerability reporting link must be added before the first public release.
13
+
14
+ ## Security properties through Milestone 3
15
+
16
+ - Technology detection runs locally and does not invoke an AI provider.
17
+ - The selected provider's preflight completes before workspace files are written.
18
+ - Known dependency, build, VCS, and virtual-environment directories are excluded from scanning.
19
+ - The detector reads recognized manifests and selected infrastructure files; it does not read `.env` or credential files.
20
+ - Workspace files are written with restrictive permissions and atomic replacement.
21
+ - Existing custom and code-specific rules are preserved during a forced initialization.
22
+ - Invalid existing guardrail YAML causes initialization to stop instead of overwriting the file.
23
+ - Code-specific generation considers at most 30 files and 80 KB of source evidence by default.
24
+ - `.env`, credential-like paths, private-key formats, dependencies, build output, provider configuration, binary files, and symbolic links are excluded from evidence.
25
+ - Source evidence is explicitly treated as untrusted data by the bundled skill to reduce prompt-injection risk.
26
+ - Provider jobs run in a temporary empty directory with read-only, plan, or tool-disabled controls appropriate to each supported CLI.
27
+ - Generated rules must satisfy a strict schema and cite exact supplied evidence paths; invalid structured output receives at most one repair attempt.
28
+ - Regeneration atomically replaces only generated rules and preserves baseline and custom rules.
29
+ - Prompt-time rules, skills, hook configuration, and the hook runtime are installed locally inside the workspace.
30
+ - The hook runtime reads only the provider hook payload, sanitizes the native session identifier, and emits workflow context. It does not read source code, prompts, credentials, or reports and makes no network request.
31
+ - Existing agent instructions and unrelated hook entries are preserved through managed-block and owned-entry updates.
32
+ - Dedicated paths are not overwritten when an existing file lacks a VibeReview ownership marker.
33
+ - Session reports are Markdown files written locally by the selected IDE agent; VibeReview does not upload or synchronize them.
34
+ - For a dependency delta, the installed OSV skill sends only package ecosystem, canonical name, and exact version directly to `https://api.osv.dev/v1/query`. It sends no source, prompt, repository name, secret, or lockfile and writes no separate scan artifact.
35
+
36
+ ## Provider data handling
37
+
38
+ Deterministic stack detection and catalog matching stay local. Code-specific generation sends the selected bounded source evidence to Cursor, OpenAI, Anthropic, or GitHub through the user's configured CLI. Users must evaluate that provider's data retention, privacy, and billing terms before initialization. VibeReview does not operate an intermediary server for this workflow.
39
+
40
+ Provider controls are defense in depth, not a guarantee against model or CLI defects. Do not rely on VibeReview to detect every secret-bearing file name. Repositories with unusually located sensitive source material should be reviewed before running generation.
41
+
42
+ ## Report sensitivity
43
+
44
+ Reports can describe security boundaries, mitigations, changed paths, and residual risks. They intentionally exclude full prompts, hidden reasoning, secrets, personal data, and raw tool output, but users should still treat `.vibereview/reports/` as security-sensitive project documentation and apply appropriate repository access controls.
45
+
46
+ Provider agents, not the deterministic CLI, perform prompt-time threat modelling and author reports. The installed instructions and hooks improve consistency but cannot guarantee that an underlying model or provider runtime will comply perfectly. Review important reports and security-critical changes.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ import("../dist/src/cli.js").catch((error) => {
4
+ const message = error instanceof Error ? error.message : String(error);
5
+ process.stderr.write(`vibereview: ${message}\n`);
6
+ process.exitCode = 1;
7
+ });
Binary file
@@ -0,0 +1,103 @@
1
+ import process from "node:process";
2
+ import { createRequire } from "node:module";
3
+ import { initCommand } from "./commands/init.js";
4
+ import { generateCommand } from "./commands/generate.js";
5
+ const packageVersion = createRequire(import.meta.url)("../../package.json").version;
6
+ const HELP = `VibeReview CLI
7
+
8
+ Usage:
9
+ vibereview init [options]
10
+ vibereview guardrails generate [options]
11
+
12
+ Commands:
13
+ init Detect the stack, generate guardrails, and install the IDE workflow
14
+ guardrails generate Regenerate code-specific guardrails with the configured provider
15
+
16
+ Options:
17
+ --provider <name> cursor, codex, claude, or copilot
18
+ --yes, -y Accept defaults for non-interactive use
19
+ --force Refresh managed files; preserve custom rules
20
+ --json Print machine-readable output
21
+ --verbose Show detection details and warnings
22
+ --cwd <path> Initialize a different workspace
23
+ --help, -h Show this help
24
+ --version, -V Show the CLI version
25
+ `;
26
+ async function main(argv) {
27
+ if (argv.length === 0 || argv.includes("--help") || argv.includes("-h")) {
28
+ process.stdout.write(HELP);
29
+ return;
30
+ }
31
+ if (argv.includes("--version") || argv.includes("-V")) {
32
+ process.stdout.write(`${packageVersion}\n`);
33
+ return;
34
+ }
35
+ const [command, ...args] = argv;
36
+ if (command === "init") {
37
+ await initCommand(parseInitOptions(args));
38
+ return;
39
+ }
40
+ if (command === "guardrails" && args[0] === "generate") {
41
+ await generateCommand(parseGenerateOptions(args.slice(1)));
42
+ return;
43
+ }
44
+ throw new Error(`Unknown command ${JSON.stringify([command, ...args].join(" "))}. Run \`vibereview --help\`.`);
45
+ }
46
+ function parseInitOptions(args) {
47
+ const options = {
48
+ cwd: process.cwd(), provider: undefined, yes: false, force: false,
49
+ skipPreflight: false, json: false, verbose: false,
50
+ skipGeneration: false,
51
+ };
52
+ for (let index = 0; index < args.length; index += 1) {
53
+ const arg = args[index];
54
+ if (arg === "--provider")
55
+ options.provider = requireValue(args, ++index, arg);
56
+ else if (arg === "--cwd")
57
+ options.cwd = requireValue(args, ++index, arg);
58
+ else if (arg === "--yes" || arg === "-y")
59
+ options.yes = true;
60
+ else if (arg === "--force")
61
+ options.force = true;
62
+ else if (arg === "--skip-preflight")
63
+ options.skipPreflight = true;
64
+ else if (arg === "--skip-generation")
65
+ options.skipGeneration = true;
66
+ else if (arg === "--json")
67
+ options.json = true;
68
+ else if (arg === "--verbose")
69
+ options.verbose = true;
70
+ else
71
+ throw new Error(`Unknown option ${JSON.stringify(arg)}. Run \`vibereview --help\`.`);
72
+ }
73
+ return options;
74
+ }
75
+ function parseGenerateOptions(args) {
76
+ const options = { cwd: process.cwd(), json: false, verbose: false, skipPreflight: false };
77
+ for (let index = 0; index < args.length; index += 1) {
78
+ const arg = args[index];
79
+ if (arg === "--cwd")
80
+ options.cwd = requireValue(args, ++index, arg);
81
+ else if (arg === "--json")
82
+ options.json = true;
83
+ else if (arg === "--verbose")
84
+ options.verbose = true;
85
+ else if (arg === "--skip-preflight")
86
+ options.skipPreflight = true;
87
+ else
88
+ throw new Error(`Unknown option ${JSON.stringify(arg)}. Run \`vibereview --help\`.`);
89
+ }
90
+ return options;
91
+ }
92
+ function requireValue(args, index, flag) {
93
+ const value = args[index];
94
+ if (!value || value.startsWith("-"))
95
+ throw new Error(`${flag} requires a value.`);
96
+ return value;
97
+ }
98
+ main(process.argv.slice(2)).catch((error) => {
99
+ const message = error instanceof Error ? error.message : String(error);
100
+ process.stderr.write(`\n✗ ${message}\n`);
101
+ process.exitCode = 1;
102
+ });
103
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,36 @@
1
+ import path from "node:path";
2
+ import { generateCodeGuardrails } from "../core/generator.js";
3
+ import { findRepositoryRoot } from "../core/repository.js";
4
+ import { loadWorkspace, updateCodeSpecificGuardrails } from "../core/workspace.js";
5
+ import { checkProviderPreflight, PROVIDER_NAMES } from "../providers/index.js";
6
+ import { ui } from "../ui.js";
7
+ export async function generateCommand(options) {
8
+ const root = await findRepositoryRoot(options.cwd);
9
+ const workspace = await loadWorkspace(root);
10
+ const provider = workspace.config.provider;
11
+ if (!options.json)
12
+ ui.title("VibeReview guardrail generation");
13
+ const preflight = options.skipPreflight ? undefined : await checkProviderPreflight(provider);
14
+ if (!options.json) {
15
+ ui.step(`${PROVIDER_NAMES[provider]} CLI detected${preflight ? ` (${preflight.version})` : " (preflight skipped)"}`);
16
+ ui.info(`\nGenerating code-specific guardrails with ${PROVIDER_NAMES[provider]}...`);
17
+ }
18
+ const result = await generateCodeGuardrails(provider, root, workspace.profile, workspace.guardrails.baseline);
19
+ const outputPath = await updateCodeSpecificGuardrails(root, workspace.guardrails, result.guardrails);
20
+ if (options.json) {
21
+ process.stdout.write(`${JSON.stringify({
22
+ provider,
23
+ analyzed_file_count: result.evidence.files.length,
24
+ code_specific_guardrail_count: result.guardrails.length,
25
+ attempts: result.attempts,
26
+ output: outputPath,
27
+ }, null, 2)}\n`);
28
+ return;
29
+ }
30
+ ui.step(`Analyzed ${result.evidence.files.length} security-relevant file${result.evidence.files.length === 1 ? "" : "s"}`);
31
+ ui.step(`Generated ${result.guardrails.length} code-specific guardrail${result.guardrails.length === 1 ? "" : "s"}`);
32
+ if (options.verbose)
33
+ ui.detail(` Evidence bundle: ${result.evidence.total_bytes.toLocaleString()} bytes; ${result.evidence.omitted_file_count} candidate files omitted`);
34
+ ui.detail(`Guardrails: ${path.relative(root, outputPath)}`);
35
+ }
36
+ //# sourceMappingURL=generate.js.map