viberails 0.6.1 → 0.6.2
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/dist/index.cjs +28 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -3026,8 +3026,15 @@ function setupGithubAction(projectRoot, packageManager, options) {
|
|
|
3026
3026
|
}
|
|
3027
3027
|
}
|
|
3028
3028
|
if (options?.linter) {
|
|
3029
|
-
const lintCmd = options.linter === "biome" ? "biome check
|
|
3030
|
-
lines.push(
|
|
3029
|
+
const lintCmd = options.linter === "biome" ? "biome check" : "eslint";
|
|
3030
|
+
lines.push(
|
|
3031
|
+
` - name: Lint changed files`,
|
|
3032
|
+
` run: |`,
|
|
3033
|
+
` FILES=$(git diff --name-only --diff-filter=ACMR origin/\${{ github.event.pull_request.base.ref }}...HEAD -- '*.js' '*.ts' '*.jsx' '*.tsx')`,
|
|
3034
|
+
` if [ -n "$FILES" ]; then`,
|
|
3035
|
+
` echo "$FILES" | xargs ${runPrefix} ${lintCmd}`,
|
|
3036
|
+
` fi`
|
|
3037
|
+
);
|
|
3031
3038
|
}
|
|
3032
3039
|
lines.push(
|
|
3033
3040
|
` - run: npx viberails check --enforce --diff-base origin/\${{ github.event.pull_request.base.ref }}`,
|
|
@@ -3203,9 +3210,11 @@ async function initCommand(options, cwd) {
|
|
|
3203
3210
|
await initInteractive(projectRoot, configPath, options);
|
|
3204
3211
|
}
|
|
3205
3212
|
async function initNonInteractive(projectRoot, configPath) {
|
|
3206
|
-
|
|
3213
|
+
const s = clack8.spinner();
|
|
3214
|
+
s.start("Scanning project...");
|
|
3207
3215
|
const scanResult = await scan2(projectRoot);
|
|
3208
3216
|
const config = generateConfig(scanResult);
|
|
3217
|
+
s.stop("Scan complete");
|
|
3209
3218
|
for (const pkg of config.packages) {
|
|
3210
3219
|
const pkgMeta = config._meta?.packages?.[pkg.path]?.conventions;
|
|
3211
3220
|
pkg.conventions = filterHighConfidence(pkg.conventions ?? {}, pkgMeta);
|
|
@@ -3220,7 +3229,8 @@ async function initNonInteractive(projectRoot, configPath) {
|
|
|
3220
3229
|
);
|
|
3221
3230
|
}
|
|
3222
3231
|
if (config.packages.length > 1) {
|
|
3223
|
-
|
|
3232
|
+
const bs = clack8.spinner();
|
|
3233
|
+
bs.start("Building import graph...");
|
|
3224
3234
|
const { buildImportGraph, inferBoundaries } = await import("@viberails/graph");
|
|
3225
3235
|
const packages = resolveWorkspacePackages(projectRoot, config.packages);
|
|
3226
3236
|
const graph = await buildImportGraph(projectRoot, { packages, ignore: config.ignore });
|
|
@@ -3229,7 +3239,9 @@ async function initNonInteractive(projectRoot, configPath) {
|
|
|
3229
3239
|
if (denyCount > 0) {
|
|
3230
3240
|
config.boundaries = inferred;
|
|
3231
3241
|
config.rules.enforceBoundaries = true;
|
|
3232
|
-
|
|
3242
|
+
bs.stop(`Inferred ${denyCount} boundary rules`);
|
|
3243
|
+
} else {
|
|
3244
|
+
bs.stop("No boundary rules inferred");
|
|
3233
3245
|
}
|
|
3234
3246
|
}
|
|
3235
3247
|
const compacted = compactConfig3(config);
|
|
@@ -3351,19 +3363,22 @@ async function initInteractive(projectRoot, configPath, options) {
|
|
|
3351
3363
|
clack8.outro("Aborted. No files were written.");
|
|
3352
3364
|
return;
|
|
3353
3365
|
}
|
|
3366
|
+
const ws = clack8.spinner();
|
|
3367
|
+
ws.start("Writing configuration and setting up integrations...");
|
|
3354
3368
|
const compacted = compactConfig3(config);
|
|
3355
3369
|
fs19.writeFileSync(configPath, `${JSON.stringify(compacted, null, 2)}
|
|
3356
3370
|
`);
|
|
3357
3371
|
writeGeneratedFiles(projectRoot, config, scanResult);
|
|
3358
3372
|
updateGitignore(projectRoot);
|
|
3359
|
-
const ok = chalk12.green("\u2713");
|
|
3360
|
-
clack8.log.step(`${ok} ${path19.basename(configPath)}`);
|
|
3361
|
-
clack8.log.step(`${ok} .viberails/context.md`);
|
|
3362
|
-
clack8.log.step(`${ok} .viberails/scan-result.json`);
|
|
3363
3373
|
setupSelectedIntegrations(projectRoot, integrations, {
|
|
3364
3374
|
linter: rootPkgStack?.linter?.split("@")[0],
|
|
3365
3375
|
packageManager: rootPkgStack?.packageManager?.split("@")[0]
|
|
3366
3376
|
});
|
|
3377
|
+
ws.stop("Configuration written");
|
|
3378
|
+
const ok = chalk12.green("\u2713");
|
|
3379
|
+
clack8.log.step(`${ok} ${path19.basename(configPath)}`);
|
|
3380
|
+
clack8.log.step(`${ok} .viberails/context.md`);
|
|
3381
|
+
clack8.log.step(`${ok} .viberails/scan-result.json`);
|
|
3367
3382
|
clack8.outro(
|
|
3368
3383
|
`Done! Next: review viberails.config.json, then run viberails check
|
|
3369
3384
|
${chalk12.dim("Tip: use")} ${chalk12.cyan("viberails check --enforce")} ${chalk12.dim("in CI to block PRs on violations.")}`
|
|
@@ -3402,8 +3417,10 @@ async function syncCommand(options, cwd) {
|
|
|
3402
3417
|
const configPath = path20.join(projectRoot, CONFIG_FILE6);
|
|
3403
3418
|
const existing = await loadConfig5(configPath);
|
|
3404
3419
|
const previousStats = loadPreviousStats(projectRoot);
|
|
3405
|
-
|
|
3420
|
+
const s = clack9.spinner();
|
|
3421
|
+
s.start("Scanning project...");
|
|
3406
3422
|
const scanResult = await scan3(projectRoot);
|
|
3423
|
+
s.stop("Scan complete");
|
|
3407
3424
|
const merged = mergeConfig2(existing, scanResult);
|
|
3408
3425
|
const compacted = compactConfig4(merged);
|
|
3409
3426
|
const compactedJson = JSON.stringify(compacted, null, 2);
|
|
@@ -3477,7 +3494,7 @@ ${chalk13.bold("Synced:")}`);
|
|
|
3477
3494
|
}
|
|
3478
3495
|
|
|
3479
3496
|
// src/index.ts
|
|
3480
|
-
var VERSION = "0.6.
|
|
3497
|
+
var VERSION = "0.6.2";
|
|
3481
3498
|
var program = new Command();
|
|
3482
3499
|
program.name("viberails").description("Guardrails for vibe coding").version(VERSION);
|
|
3483
3500
|
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) => {
|