viberails 0.6.12 → 0.6.13
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 +140 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +9 -8
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# viberails
|
|
2
|
+
|
|
3
|
+
Guardrails for vibe coding.
|
|
4
|
+
|
|
5
|
+
viberails scans your existing JavaScript/TypeScript project, detects the conventions you're already following, and enforces them with file-level feedback during AI edits and structured enforcement at commit and PR time. Rules are derived from your actual codebase, not a template.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
AI coding tools are fast but inconsistent. They'll use camelCase in one file and kebab-case in another, create 500-line files, and ignore your project's import boundaries. viberails catches this by learning your conventions and enforcing them where it matters: file-level checks surface naming and size issues immediately during AI edits, while commit hooks and CI enforce naming, file-size, missing-test, and boundary rules. Coverage enforcement runs via `viberails check` (full mode).
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd your-project
|
|
15
|
+
npx viberails
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The interactive wizard scans your project, shows what it found with confidence levels, and lets you customize rules before generating config. It also sets up pre-commit hooks and Claude Code integration.
|
|
19
|
+
If a config already exists, re-running `viberails` lets you edit it, replace it with a fresh scan, or cancel. `viberails config` remains available as a shortcut for direct rule editing.
|
|
20
|
+
|
|
21
|
+
## What It Does
|
|
22
|
+
|
|
23
|
+
**Scans** your codebase to detect framework, language, styling, tooling, directory structure, and naming conventions, each scored by consistency across your files.
|
|
24
|
+
|
|
25
|
+
**Enforces** four rules:
|
|
26
|
+
- **File size** — files over 300 lines (configurable) are flagged
|
|
27
|
+
- **Naming conventions** — detects your naming style (kebab-case, camelCase, PascalCase, snake_case) and enforces it
|
|
28
|
+
- **Missing tests** — source files must have corresponding test files
|
|
29
|
+
- **Import boundaries** — prevents packages from importing where they shouldn't (monorepos)
|
|
30
|
+
|
|
31
|
+
**Fixes** violations automatically:
|
|
32
|
+
- Renames files to match your convention and updates relative imports via AST rewriting (aliased imports like `@/...` require manual updates)
|
|
33
|
+
- Generates test stubs for missing test files
|
|
34
|
+
|
|
35
|
+
## What It Generates
|
|
36
|
+
|
|
37
|
+
| File | Purpose |
|
|
38
|
+
|------|---------|
|
|
39
|
+
| `viberails.config.json` | Detected stack, conventions, boundary rules, and thresholds |
|
|
40
|
+
| `.viberails/context.md` | Enforced rules in natural language for AI tools to follow |
|
|
41
|
+
| `.viberails/scan-result.json` | Raw scan data (gitignored) |
|
|
42
|
+
|
|
43
|
+
The generated `context.md` is designed to be referenced from your `CLAUDE.md`, `.cursorrules`, or similar AI context files so that AI tools automatically follow your project's conventions.
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
### `npx viberails` / `viberails init`
|
|
48
|
+
|
|
49
|
+
Scans your project and walks you through setup. If a config already exists, the same command lets you edit the current setup or replace it with a fresh scan.
|
|
50
|
+
|
|
51
|
+
| Flag | Effect |
|
|
52
|
+
|------|--------|
|
|
53
|
+
| `--yes` / `-y` | Non-interactive. Uses defaults, keeps high-confidence conventions, and auto-sets up integrations. |
|
|
54
|
+
| `--force` / `-f` | Re-initialize from scratch, replacing existing config without the edit/replace chooser. |
|
|
55
|
+
|
|
56
|
+
### `viberails check`
|
|
57
|
+
|
|
58
|
+
Validates your project against configured rules.
|
|
59
|
+
|
|
60
|
+
| Flag | Effect |
|
|
61
|
+
|------|--------|
|
|
62
|
+
| `--staged` | Check only git-staged files (used by pre-commit hook). |
|
|
63
|
+
| `--files <paths>` | Check specific files. |
|
|
64
|
+
| `--format json` | Machine-readable output for tool integration. |
|
|
65
|
+
| `--quiet` | Summary only. |
|
|
66
|
+
| `--enforce` | Return exit code 1 when violations are found (CI mode). |
|
|
67
|
+
| `--diff-base <ref>` | Check only files changed since a git ref (useful in CI). |
|
|
68
|
+
| `--hook` | Output via stdin/stderr for Claude Code hook integration. |
|
|
69
|
+
|
|
70
|
+
### `viberails fix`
|
|
71
|
+
|
|
72
|
+
Auto-fixes naming violations and generates missing test stubs.
|
|
73
|
+
|
|
74
|
+
| Flag | Effect |
|
|
75
|
+
|------|--------|
|
|
76
|
+
| `--dry-run` | Preview changes without applying them. |
|
|
77
|
+
| `--rule <name>` | Fix only `file-naming` or `missing-test`. |
|
|
78
|
+
| `--yes` / `-y` | Apply fixes without confirmation. |
|
|
79
|
+
|
|
80
|
+
### `viberails config`
|
|
81
|
+
|
|
82
|
+
Interactively edit existing config rules without re-initializing. Opens the same rule menu used during `init` with your current values pre-filled. Most users can simply re-run `viberails`; this command is the direct shortcut.
|
|
83
|
+
|
|
84
|
+
| Flag | Effect |
|
|
85
|
+
|------|--------|
|
|
86
|
+
| `--rescan` | Re-scan the project first, picking up new packages and stack changes. |
|
|
87
|
+
|
|
88
|
+
### `viberails sync`
|
|
89
|
+
|
|
90
|
+
Re-scans and regenerates context files. Preserves manual edits to `viberails.config.json` and reports what changed.
|
|
91
|
+
|
|
92
|
+
| Flag | Effect |
|
|
93
|
+
|------|--------|
|
|
94
|
+
| `--interactive` / `-i` | Review changes before writing. Choose to accept, customize rules, or cancel. |
|
|
95
|
+
|
|
96
|
+
### `viberails boundaries`
|
|
97
|
+
|
|
98
|
+
Displays boundary rules and violations. Use `--infer` to re-infer rules from your current import graph.
|
|
99
|
+
|
|
100
|
+
## Hooks
|
|
101
|
+
|
|
102
|
+
During `viberails init`, you can set up automatic enforcement:
|
|
103
|
+
|
|
104
|
+
### Pre-commit hook
|
|
105
|
+
|
|
106
|
+
Detects your hook manager (Lefthook, Husky, or bare git) and adds `viberails check --staged`. Violations warn by default. Use `viberails check --enforce` (for CI) to make violations fail with exit code 1.
|
|
107
|
+
|
|
108
|
+
### Claude Code hook
|
|
109
|
+
|
|
110
|
+
Adds a PostToolUse hook to `.claude/settings.json` that runs fast file-scoped checks after every edit, surfacing naming and file-size issues immediately. Repository-level checks like missing tests and boundaries are enforced at commit and PR time via staged checks and CI. Coverage enforcement runs via `viberails check` (full mode) or your existing CI test pipeline.
|
|
111
|
+
|
|
112
|
+
### GitHub Actions
|
|
113
|
+
|
|
114
|
+
Generates a `.github/workflows/viberails.yml` workflow that runs `viberails check --enforce --diff-base` on pull requests, checking only files changed in the PR.
|
|
115
|
+
|
|
116
|
+
### Typecheck & lint hooks
|
|
117
|
+
|
|
118
|
+
Optionally adds `tsc --noEmit` and your linter (Biome, ESLint) as pre-commit checks during `viberails init`.
|
|
119
|
+
|
|
120
|
+
## Confidence Model
|
|
121
|
+
|
|
122
|
+
Not all conventions are equally consistent in a codebase. viberails scores each detection:
|
|
123
|
+
|
|
124
|
+
| Level | Consistency | Behavior |
|
|
125
|
+
|-------|-------------|----------|
|
|
126
|
+
| **High** | >= 90% | Enforced by default |
|
|
127
|
+
| **Medium** | 70-89% | Included in config, not enforced |
|
|
128
|
+
| **Low** | < 70% | Omitted entirely |
|
|
129
|
+
|
|
130
|
+
In `--yes` mode, only high-confidence conventions are included.
|
|
131
|
+
|
|
132
|
+
## Monorepo Support
|
|
133
|
+
|
|
134
|
+
viberails detects workspaces (pnpm, npm, yarn), scans each package independently, and infers import boundaries from your existing dependency graph. Packages that don't import from each other get automatic deny rules, preventing accidental coupling before it starts.
|
|
135
|
+
|
|
136
|
+
Per-package convention overrides are detected and displayed during setup.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -4339,7 +4339,7 @@ ${import_chalk19.default.bold("Synced:")}`);
|
|
|
4339
4339
|
}
|
|
4340
4340
|
|
|
4341
4341
|
// src/index.ts
|
|
4342
|
-
var VERSION = "0.6.
|
|
4342
|
+
var VERSION = "0.6.13";
|
|
4343
4343
|
var program = new import_commander.Command();
|
|
4344
4344
|
program.name("viberails").description("Guardrails for vibe coding").version(VERSION);
|
|
4345
4345
|
program.command("init", { isDefault: true }).description("Scan your project and set up enforcement guardrails").option("-y, --yes", "Non-interactive mode (use defaults, high-confidence only)").option("-f, --force", "Re-initialize, replacing existing config").action(async (options) => {
|
package/dist/index.js
CHANGED
|
@@ -4318,7 +4318,7 @@ ${chalk19.bold("Synced:")}`);
|
|
|
4318
4318
|
}
|
|
4319
4319
|
|
|
4320
4320
|
// src/index.ts
|
|
4321
|
-
var VERSION = "0.6.
|
|
4321
|
+
var VERSION = "0.6.13";
|
|
4322
4322
|
var program = new Command();
|
|
4323
4323
|
program.name("viberails").description("Guardrails for vibe coding").version(VERSION);
|
|
4324
4324
|
program.command("init", { isDefault: true }).description("Scan your project and set up enforcement guardrails").option("-y, --yes", "Non-interactive mode (use defaults, high-confidence only)").option("-f, --force", "Re-initialize, replacing existing config").action(async (options) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viberails",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.13",
|
|
4
|
+
"description": "Guardrails for vibe coding. Scan your codebase, detect conventions, and enforce them during AI edits, commits, and CI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"LICENSE"
|
|
26
27
|
],
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@clack/prompts": "^1.1.0",
|
|
@@ -31,11 +32,11 @@
|
|
|
31
32
|
"picomatch": "^4.0.3",
|
|
32
33
|
"ts-morph": "^27.0.2",
|
|
33
34
|
"yaml": "^2.8.2",
|
|
34
|
-
"@viberails/
|
|
35
|
-
"@viberails/
|
|
36
|
-
"@viberails/
|
|
37
|
-
"@viberails/
|
|
38
|
-
"@viberails/types": "0.6.
|
|
35
|
+
"@viberails/context": "0.6.13",
|
|
36
|
+
"@viberails/graph": "0.6.13",
|
|
37
|
+
"@viberails/config": "0.6.13",
|
|
38
|
+
"@viberails/scanner": "0.6.13",
|
|
39
|
+
"@viberails/types": "0.6.13"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@types/node": "^25.3.5",
|