@vibecheckai/cli 3.5.0 → 3.5.1
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/bin/registry.js +174 -449
- package/bin/runners/cli-utils.js +33 -2
- package/bin/runners/context/generators/cursor.js +2 -49
- package/bin/runners/context/generators/mcp.js +13 -15
- package/bin/runners/context/proof-context.js +1 -248
- package/bin/runners/lib/analysis-core.js +180 -198
- package/bin/runners/lib/analyzers.js +241 -2212
- package/bin/runners/lib/cli-output.js +210 -242
- package/bin/runners/lib/detectors-v2.js +785 -547
- package/bin/runners/lib/entitlements-v2.js +431 -161
- package/bin/runners/lib/error-handler.js +9 -16
- package/bin/runners/lib/global-flags.js +0 -37
- package/bin/runners/lib/html-proof-report.js +700 -350
- package/bin/runners/lib/missions/plan.js +6 -46
- package/bin/runners/lib/missions/templates.js +0 -232
- package/bin/runners/lib/route-truth.js +322 -1167
- package/bin/runners/lib/scan-output.js +467 -493
- package/bin/runners/lib/ship-output.js +27 -280
- package/bin/runners/lib/terminal-ui.js +700 -310
- package/bin/runners/lib/truth.js +321 -1004
- package/bin/runners/lib/unified-output.js +158 -162
- package/bin/runners/lib/upsell.js +204 -104
- package/bin/runners/runAIAgent.js +10 -5
- package/bin/runners/runAllowlist.js +324 -0
- package/bin/runners/runAuth.js +94 -344
- package/bin/runners/runCheckpoint.js +45 -43
- package/bin/runners/runContext.js +24 -139
- package/bin/runners/runDoctor.js +101 -136
- package/bin/runners/runEvidencePack.js +219 -0
- package/bin/runners/runFix.js +71 -82
- package/bin/runners/runGuard.js +119 -606
- package/bin/runners/runInit.js +60 -22
- package/bin/runners/runInstall.js +281 -0
- package/bin/runners/runLabs.js +341 -0
- package/bin/runners/runMcp.js +62 -139
- package/bin/runners/runPolish.js +83 -282
- package/bin/runners/runPromptFirewall.js +12 -5
- package/bin/runners/runProve.js +58 -33
- package/bin/runners/runReality.js +58 -81
- package/bin/runners/runReport.js +7 -34
- package/bin/runners/runRuntime.js +8 -5
- package/bin/runners/runScan.js +844 -219
- package/bin/runners/runShip.js +59 -721
- package/bin/runners/runValidate.js +11 -24
- package/bin/runners/runWatch.js +76 -131
- package/bin/vibecheck.js +69 -295
- package/mcp-server/ARCHITECTURE.md +339 -0
- package/mcp-server/__tests__/cache.test.ts +313 -0
- package/mcp-server/__tests__/executor.test.ts +239 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/.cache/webpack/cache.pack +1 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/.next/server/chunk.js +3 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/.turbo/cache.json +3 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/.venv/lib/env.py +3 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/dist/bundle.js +3 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/package.json +5 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/src/app.ts +5 -0
- package/mcp-server/__tests__/fixtures/exclusion-test/venv/lib/config.py +4 -0
- package/mcp-server/__tests__/ids.test.ts +345 -0
- package/mcp-server/__tests__/integration/tools.test.ts +410 -0
- package/mcp-server/__tests__/registry.test.ts +365 -0
- package/mcp-server/__tests__/sandbox.test.ts +323 -0
- package/mcp-server/__tests__/schemas.test.ts +372 -0
- package/mcp-server/benchmarks/run-benchmarks.ts +304 -0
- package/mcp-server/examples/doctor.request.json +14 -0
- package/mcp-server/examples/doctor.response.json +53 -0
- package/mcp-server/examples/error.response.json +15 -0
- package/mcp-server/examples/scan.request.json +14 -0
- package/mcp-server/examples/scan.response.json +108 -0
- package/mcp-server/handlers/tool-handler.ts +671 -0
- package/mcp-server/index-v1.js +698 -0
- package/mcp-server/index-v3.ts +293 -0
- package/mcp-server/index.js +1080 -1757
- package/mcp-server/index.old.js +4137 -0
- package/mcp-server/lib/cache.ts +341 -0
- package/mcp-server/lib/errors.ts +346 -0
- package/mcp-server/lib/executor.ts +792 -0
- package/mcp-server/lib/ids.ts +238 -0
- package/mcp-server/lib/logger.ts +368 -0
- package/mcp-server/lib/metrics.ts +365 -0
- package/mcp-server/lib/sandbox.ts +337 -0
- package/mcp-server/lib/validator.ts +229 -0
- package/mcp-server/package-lock.json +165 -0
- package/mcp-server/package.json +32 -7
- package/mcp-server/premium-tools.js +2 -2
- package/mcp-server/registry/tools.json +476 -0
- package/mcp-server/schemas/error-envelope.schema.json +125 -0
- package/mcp-server/schemas/finding.schema.json +167 -0
- package/mcp-server/schemas/report-artifact.schema.json +88 -0
- package/mcp-server/schemas/run-request.schema.json +75 -0
- package/mcp-server/schemas/verdict.schema.json +168 -0
- package/mcp-server/tier-auth.d.ts +71 -0
- package/mcp-server/tier-auth.js +371 -183
- package/mcp-server/truth-context.js +90 -131
- package/mcp-server/truth-firewall-tools.js +1000 -1611
- package/mcp-server/tsconfig.json +34 -0
- package/mcp-server/vibecheck-tools.js +2 -2
- package/mcp-server/vitest.config.ts +16 -0
- package/package.json +3 -4
- package/bin/runners/lib/agent-firewall/ai/false-positive-analyzer.js +0 -474
- package/bin/runners/lib/agent-firewall/change-packet/builder.js +0 -488
- package/bin/runners/lib/agent-firewall/change-packet/schema.json +0 -228
- package/bin/runners/lib/agent-firewall/change-packet/store.js +0 -200
- package/bin/runners/lib/agent-firewall/claims/claim-types.js +0 -21
- package/bin/runners/lib/agent-firewall/claims/extractor.js +0 -303
- package/bin/runners/lib/agent-firewall/claims/patterns.js +0 -24
- package/bin/runners/lib/agent-firewall/critic/index.js +0 -151
- package/bin/runners/lib/agent-firewall/critic/judge.js +0 -432
- package/bin/runners/lib/agent-firewall/critic/prompts.js +0 -305
- package/bin/runners/lib/agent-firewall/evidence/auth-evidence.js +0 -88
- package/bin/runners/lib/agent-firewall/evidence/contract-evidence.js +0 -75
- package/bin/runners/lib/agent-firewall/evidence/env-evidence.js +0 -127
- package/bin/runners/lib/agent-firewall/evidence/resolver.js +0 -102
- package/bin/runners/lib/agent-firewall/evidence/route-evidence.js +0 -213
- package/bin/runners/lib/agent-firewall/evidence/side-effect-evidence.js +0 -145
- package/bin/runners/lib/agent-firewall/fs-hook/daemon.js +0 -19
- package/bin/runners/lib/agent-firewall/fs-hook/installer.js +0 -87
- package/bin/runners/lib/agent-firewall/fs-hook/watcher.js +0 -184
- package/bin/runners/lib/agent-firewall/git-hook/pre-commit.js +0 -163
- package/bin/runners/lib/agent-firewall/ide-extension/cursor.js +0 -107
- package/bin/runners/lib/agent-firewall/ide-extension/vscode.js +0 -68
- package/bin/runners/lib/agent-firewall/ide-extension/windsurf.js +0 -66
- package/bin/runners/lib/agent-firewall/interceptor/base.js +0 -304
- package/bin/runners/lib/agent-firewall/interceptor/cursor.js +0 -35
- package/bin/runners/lib/agent-firewall/interceptor/vscode.js +0 -35
- package/bin/runners/lib/agent-firewall/interceptor/windsurf.js +0 -34
- package/bin/runners/lib/agent-firewall/lawbook/distributor.js +0 -465
- package/bin/runners/lib/agent-firewall/lawbook/evaluator.js +0 -604
- package/bin/runners/lib/agent-firewall/lawbook/index.js +0 -304
- package/bin/runners/lib/agent-firewall/lawbook/registry.js +0 -514
- package/bin/runners/lib/agent-firewall/lawbook/schema.js +0 -420
- package/bin/runners/lib/agent-firewall/learning/learning-engine.js +0 -849
- package/bin/runners/lib/agent-firewall/logger.js +0 -141
- package/bin/runners/lib/agent-firewall/policy/default-policy.json +0 -90
- package/bin/runners/lib/agent-firewall/policy/engine.js +0 -103
- package/bin/runners/lib/agent-firewall/policy/loader.js +0 -451
- package/bin/runners/lib/agent-firewall/policy/rules/auth-drift.js +0 -50
- package/bin/runners/lib/agent-firewall/policy/rules/contract-drift.js +0 -50
- package/bin/runners/lib/agent-firewall/policy/rules/fake-success.js +0 -86
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-env.js +0 -162
- package/bin/runners/lib/agent-firewall/policy/rules/ghost-route.js +0 -189
- package/bin/runners/lib/agent-firewall/policy/rules/scope.js +0 -93
- package/bin/runners/lib/agent-firewall/policy/rules/unsafe-side-effect.js +0 -57
- package/bin/runners/lib/agent-firewall/policy/schema.json +0 -183
- package/bin/runners/lib/agent-firewall/policy/verdict.js +0 -54
- package/bin/runners/lib/agent-firewall/proposal/extractor.js +0 -394
- package/bin/runners/lib/agent-firewall/proposal/index.js +0 -212
- package/bin/runners/lib/agent-firewall/proposal/schema.js +0 -251
- package/bin/runners/lib/agent-firewall/proposal/validator.js +0 -386
- package/bin/runners/lib/agent-firewall/reality/index.js +0 -332
- package/bin/runners/lib/agent-firewall/reality/state.js +0 -625
- package/bin/runners/lib/agent-firewall/reality/watcher.js +0 -322
- package/bin/runners/lib/agent-firewall/risk/index.js +0 -173
- package/bin/runners/lib/agent-firewall/risk/scorer.js +0 -328
- package/bin/runners/lib/agent-firewall/risk/thresholds.js +0 -321
- package/bin/runners/lib/agent-firewall/risk/vectors.js +0 -421
- package/bin/runners/lib/agent-firewall/simulator/diff-simulator.js +0 -472
- package/bin/runners/lib/agent-firewall/simulator/import-resolver.js +0 -346
- package/bin/runners/lib/agent-firewall/simulator/index.js +0 -181
- package/bin/runners/lib/agent-firewall/simulator/route-validator.js +0 -380
- package/bin/runners/lib/agent-firewall/time-machine/incident-correlator.js +0 -661
- package/bin/runners/lib/agent-firewall/time-machine/index.js +0 -267
- package/bin/runners/lib/agent-firewall/time-machine/replay-engine.js +0 -436
- package/bin/runners/lib/agent-firewall/time-machine/state-reconstructor.js +0 -490
- package/bin/runners/lib/agent-firewall/time-machine/timeline-builder.js +0 -530
- package/bin/runners/lib/agent-firewall/truthpack/index.js +0 -67
- package/bin/runners/lib/agent-firewall/truthpack/loader.js +0 -137
- package/bin/runners/lib/agent-firewall/unblock/planner.js +0 -337
- package/bin/runners/lib/agent-firewall/utils/ignore-checker.js +0 -118
- package/bin/runners/lib/api-client.js +0 -269
- package/bin/runners/lib/audit-logger.js +0 -532
- package/bin/runners/lib/authority/authorities/architecture.js +0 -364
- package/bin/runners/lib/authority/authorities/compliance.js +0 -341
- package/bin/runners/lib/authority/authorities/human.js +0 -343
- package/bin/runners/lib/authority/authorities/quality.js +0 -420
- package/bin/runners/lib/authority/authorities/security.js +0 -228
- package/bin/runners/lib/authority/index.js +0 -293
- package/bin/runners/lib/authority-badge.js +0 -425
- package/bin/runners/lib/bundle/bundle-intelligence.js +0 -846
- package/bin/runners/lib/cli-charts.js +0 -368
- package/bin/runners/lib/cli-config-display.js +0 -405
- package/bin/runners/lib/cli-demo.js +0 -275
- package/bin/runners/lib/cli-errors.js +0 -438
- package/bin/runners/lib/cli-help-formatter.js +0 -439
- package/bin/runners/lib/cli-interactive-menu.js +0 -509
- package/bin/runners/lib/cli-prompts.js +0 -441
- package/bin/runners/lib/cli-scan-cards.js +0 -362
- package/bin/runners/lib/compliance-reporter.js +0 -710
- package/bin/runners/lib/conductor/index.js +0 -671
- package/bin/runners/lib/easy/README.md +0 -123
- package/bin/runners/lib/easy/index.js +0 -140
- package/bin/runners/lib/easy/interactive-wizard.js +0 -788
- package/bin/runners/lib/easy/one-click-firewall.js +0 -564
- package/bin/runners/lib/easy/zero-config-reality.js +0 -714
- package/bin/runners/lib/engines/accessibility-engine.js +0 -390
- package/bin/runners/lib/engines/api-consistency-engine.js +0 -467
- package/bin/runners/lib/engines/ast-cache.js +0 -99
- package/bin/runners/lib/engines/async-patterns-engine.js +0 -444
- package/bin/runners/lib/engines/bundle-size-engine.js +0 -433
- package/bin/runners/lib/engines/code-quality-engine.js +0 -255
- package/bin/runners/lib/engines/confidence-scoring.js +0 -276
- package/bin/runners/lib/engines/console-logs-engine.js +0 -115
- package/bin/runners/lib/engines/context-detection.js +0 -264
- package/bin/runners/lib/engines/cross-file-analysis-engine.js +0 -533
- package/bin/runners/lib/engines/database-patterns-engine.js +0 -429
- package/bin/runners/lib/engines/dead-code-engine.js +0 -198
- package/bin/runners/lib/engines/deprecated-api-engine.js +0 -226
- package/bin/runners/lib/engines/duplicate-code-engine.js +0 -354
- package/bin/runners/lib/engines/empty-catch-engine.js +0 -260
- package/bin/runners/lib/engines/env-variables-engine.js +0 -458
- package/bin/runners/lib/engines/error-handling-engine.js +0 -437
- package/bin/runners/lib/engines/false-positive-prevention.js +0 -630
- package/bin/runners/lib/engines/file-filter.js +0 -131
- package/bin/runners/lib/engines/framework-adapters/index.js +0 -607
- package/bin/runners/lib/engines/framework-detection.js +0 -508
- package/bin/runners/lib/engines/hardcoded-secrets-engine.js +0 -251
- package/bin/runners/lib/engines/import-order-engine.js +0 -429
- package/bin/runners/lib/engines/mock-data-engine.js +0 -315
- package/bin/runners/lib/engines/naming-conventions-engine.js +0 -544
- package/bin/runners/lib/engines/noise-reduction-engine.js +0 -452
- package/bin/runners/lib/engines/orchestrator.js +0 -334
- package/bin/runners/lib/engines/parallel-processor.js +0 -71
- package/bin/runners/lib/engines/performance-issues-engine.js +0 -405
- package/bin/runners/lib/engines/react-patterns-engine.js +0 -457
- package/bin/runners/lib/engines/security-vulnerabilities-engine.js +0 -571
- package/bin/runners/lib/engines/todo-fixme-engine.js +0 -115
- package/bin/runners/lib/engines/type-aware-engine.js +0 -376
- package/bin/runners/lib/engines/unsafe-regex-engine.js +0 -225
- package/bin/runners/lib/engines/vibecheck-engines/README.md +0 -53
- package/bin/runners/lib/engines/vibecheck-engines/index.js +0 -124
- package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +0 -806
- package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +0 -439
- package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +0 -577
- package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +0 -543
- package/bin/runners/lib/engines/vibecheck-engines/package.json +0 -13
- package/bin/runners/lib/engines/vibecheck-engines.js +0 -514
- package/bin/runners/lib/enhanced-features/index.js +0 -305
- package/bin/runners/lib/enhanced-output.js +0 -631
- package/bin/runners/lib/enterprise.js +0 -300
- package/bin/runners/lib/exit-codes.js +0 -275
- package/bin/runners/lib/fingerprint.js +0 -377
- package/bin/runners/lib/firewall/command-validator.js +0 -351
- package/bin/runners/lib/firewall/config.js +0 -341
- package/bin/runners/lib/firewall/content-validator.js +0 -519
- package/bin/runners/lib/firewall/index.js +0 -101
- package/bin/runners/lib/firewall/path-validator.js +0 -256
- package/bin/runners/lib/help-formatter.js +0 -413
- package/bin/runners/lib/intelligence/cross-repo-intelligence.js +0 -817
- package/bin/runners/lib/logger.js +0 -38
- package/bin/runners/lib/mcp-utils.js +0 -425
- package/bin/runners/lib/output/index.js +0 -1022
- package/bin/runners/lib/policy-engine.js +0 -652
- package/bin/runners/lib/polish/autofix/accessibility-fixes.js +0 -333
- package/bin/runners/lib/polish/autofix/async-handlers.js +0 -273
- package/bin/runners/lib/polish/autofix/dead-code.js +0 -280
- package/bin/runners/lib/polish/autofix/imports-optimizer.js +0 -344
- package/bin/runners/lib/polish/autofix/index.js +0 -200
- package/bin/runners/lib/polish/autofix/remove-consoles.js +0 -209
- package/bin/runners/lib/polish/autofix/strengthen-types.js +0 -245
- package/bin/runners/lib/polish/backend-checks.js +0 -148
- package/bin/runners/lib/polish/documentation-checks.js +0 -111
- package/bin/runners/lib/polish/frontend-checks.js +0 -168
- package/bin/runners/lib/polish/index.js +0 -71
- package/bin/runners/lib/polish/infrastructure-checks.js +0 -131
- package/bin/runners/lib/polish/library-detection.js +0 -175
- package/bin/runners/lib/polish/performance-checks.js +0 -100
- package/bin/runners/lib/polish/security-checks.js +0 -148
- package/bin/runners/lib/polish/utils.js +0 -203
- package/bin/runners/lib/prompt-builder.js +0 -540
- package/bin/runners/lib/proof-certificate.js +0 -634
- package/bin/runners/lib/reality/accessibility-audit.js +0 -946
- package/bin/runners/lib/reality/api-contract-validator.js +0 -1012
- package/bin/runners/lib/reality/chaos-engineering.js +0 -1084
- package/bin/runners/lib/reality/performance-tracker.js +0 -1077
- package/bin/runners/lib/reality/scenario-generator.js +0 -1404
- package/bin/runners/lib/reality/visual-regression.js +0 -852
- package/bin/runners/lib/reality-profiler.js +0 -717
- package/bin/runners/lib/replay/flight-recorder-viewer.js +0 -1160
- package/bin/runners/lib/review/ai-code-review.js +0 -832
- package/bin/runners/lib/rules/custom-rule-engine.js +0 -985
- package/bin/runners/lib/sbom-generator.js +0 -641
- package/bin/runners/lib/scan-output-enhanced.js +0 -512
- package/bin/runners/lib/security/owasp-scanner.js +0 -939
- package/bin/runners/lib/ship-output-enterprise.js +0 -239
- package/bin/runners/lib/unified-cli-output.js +0 -777
- package/bin/runners/lib/validators/contract-validator.js +0 -283
- package/bin/runners/lib/validators/dead-export-detector.js +0 -279
- package/bin/runners/lib/validators/dep-audit.js +0 -245
- package/bin/runners/lib/validators/env-validator.js +0 -319
- package/bin/runners/lib/validators/index.js +0 -120
- package/bin/runners/lib/validators/license-checker.js +0 -252
- package/bin/runners/lib/validators/route-validator.js +0 -290
- package/bin/runners/runAgent.d.ts +0 -5
- package/bin/runners/runAgent.js +0 -164
- package/bin/runners/runApprove.js +0 -1233
- package/bin/runners/runAuthority.js +0 -528
- package/bin/runners/runClassify.js +0 -862
- package/bin/runners/runConductor.js +0 -772
- package/bin/runners/runContainer.js +0 -366
- package/bin/runners/runContext.d.ts +0 -4
- package/bin/runners/runEasy.js +0 -410
- package/bin/runners/runFirewall.d.ts +0 -5
- package/bin/runners/runFirewall.js +0 -137
- package/bin/runners/runFirewallHook.d.ts +0 -5
- package/bin/runners/runFirewallHook.js +0 -59
- package/bin/runners/runIaC.js +0 -372
- package/bin/runners/runPolish.d.ts +0 -4
- package/bin/runners/runProof.zip +0 -0
- package/bin/runners/runTruth.d.ts +0 -5
- package/bin/runners/runTruth.js +0 -104
- package/bin/runners/runVibe.js +0 -791
- package/mcp-server/HARDENING_SUMMARY.md +0 -299
- package/mcp-server/agent-firewall-interceptor.js +0 -500
- package/mcp-server/authority-tools.js +0 -569
- package/mcp-server/conductor/conflict-resolver.js +0 -588
- package/mcp-server/conductor/execution-planner.js +0 -544
- package/mcp-server/conductor/index.js +0 -377
- package/mcp-server/conductor/lock-manager.js +0 -615
- package/mcp-server/conductor/request-queue.js +0 -550
- package/mcp-server/conductor/session-manager.js +0 -500
- package/mcp-server/conductor/tools.js +0 -510
- package/mcp-server/lib/api-client.cjs +0 -13
- package/mcp-server/lib/logger.cjs +0 -30
- package/mcp-server/logger.js +0 -173
- package/mcp-server/tools-v3.js +0 -1039
- package/mcp-server/tools.js +0 -495
- package/mcp-server/vibecheck-mcp-server-3.2.0.tgz +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vibecheck allowlist - Manage Finding Allowlist
|
|
3
|
+
*
|
|
4
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
5
|
+
* Manage allowlist entries to suppress known false positives.
|
|
6
|
+
* Entries persist in .vibecheck/allowlist.json
|
|
7
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const { parseGlobalFlags, shouldShowBanner } = require("./lib/global-flags");
|
|
15
|
+
|
|
16
|
+
// Colors
|
|
17
|
+
const c = {
|
|
18
|
+
reset: '\x1b[0m',
|
|
19
|
+
bold: '\x1b[1m',
|
|
20
|
+
dim: '\x1b[2m',
|
|
21
|
+
green: '\x1b[32m',
|
|
22
|
+
yellow: '\x1b[33m',
|
|
23
|
+
cyan: '\x1b[36m',
|
|
24
|
+
red: '\x1b[31m',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const rgb = (r, g, b) => `\x1b[38;2;${r};${g};${b}m`;
|
|
28
|
+
|
|
29
|
+
const colors = {
|
|
30
|
+
accent: rgb(150, 100, 255),
|
|
31
|
+
success: rgb(0, 255, 150),
|
|
32
|
+
warning: rgb(255, 200, 0),
|
|
33
|
+
error: rgb(255, 80, 80),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const ICONS = {
|
|
37
|
+
allow: '✓',
|
|
38
|
+
block: '✗',
|
|
39
|
+
list: '📋',
|
|
40
|
+
add: '+',
|
|
41
|
+
remove: '-',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function printHelp(opts = {}) {
|
|
45
|
+
if (shouldShowBanner(opts)) {
|
|
46
|
+
console.log(`
|
|
47
|
+
${colors.accent} █████╗ ██╗ ██╗ ██████╗ ██╗ ██╗${c.reset}
|
|
48
|
+
${colors.accent} ██╔══██╗██║ ██║ ██╔═══██╗██║ ██║${c.reset}
|
|
49
|
+
${colors.accent} ███████║██║ ██║ ██║ ██║██║ █╗ ██║${c.reset}
|
|
50
|
+
${colors.accent} ██╔══██║██║ ██║ ██║ ██║██║███╗██║${c.reset}
|
|
51
|
+
${colors.accent} ██║ ██║███████╗███████╗╚██████╔╝╚███╔███╔╝${c.reset}
|
|
52
|
+
${colors.accent} ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚══╝╚══╝ ${c.reset}
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(`
|
|
57
|
+
${c.bold}Usage:${c.reset} vibecheck allowlist <action> [options]
|
|
58
|
+
|
|
59
|
+
${c.bold}Manage Finding Allowlist${c.reset} — Suppress known false positives.
|
|
60
|
+
|
|
61
|
+
${c.bold}Actions:${c.reset}
|
|
62
|
+
${colors.accent}list${c.reset} Show all allowlist entries ${c.dim}(default)${c.reset}
|
|
63
|
+
${colors.accent}add${c.reset} Add entry to allowlist
|
|
64
|
+
${colors.accent}remove${c.reset} Remove entry from allowlist
|
|
65
|
+
${colors.accent}check${c.reset} Check if finding is allowlisted
|
|
66
|
+
|
|
67
|
+
${c.bold}Options (add):${c.reset}
|
|
68
|
+
${colors.accent}--id <finding-id>${c.reset} Finding ID to allowlist
|
|
69
|
+
${colors.accent}--pattern <regex>${c.reset} Pattern to match (title, file, URL)
|
|
70
|
+
${colors.accent}--reason <text>${c.reset} Reason for allowlisting ${c.dim}(required)${c.reset}
|
|
71
|
+
${colors.accent}--scope <scope>${c.reset} Scope: global, file, line ${c.dim}(default: global)${c.reset}
|
|
72
|
+
${colors.accent}--expires <days>${c.reset} Auto-expire after N days
|
|
73
|
+
${colors.accent}--file <path>${c.reset} File scope (for scope=file|line)
|
|
74
|
+
${colors.accent}--lines <start-end>${c.reset} Line range (for scope=line)
|
|
75
|
+
|
|
76
|
+
${c.bold}Options (remove):${c.reset}
|
|
77
|
+
${colors.accent}--id <entry-id>${c.reset} Allowlist entry ID to remove
|
|
78
|
+
|
|
79
|
+
${c.bold}Options (check):${c.reset}
|
|
80
|
+
${colors.accent}--id <finding-id>${c.reset} Finding ID to check
|
|
81
|
+
|
|
82
|
+
${c.bold}Global Options:${c.reset}
|
|
83
|
+
${colors.accent}--json${c.reset} Output as JSON
|
|
84
|
+
${colors.accent}--help, -h${c.reset} Show this help
|
|
85
|
+
|
|
86
|
+
${c.bold}Examples:${c.reset}
|
|
87
|
+
${c.dim}# List all allowlist entries${c.reset}
|
|
88
|
+
vibecheck allowlist list
|
|
89
|
+
|
|
90
|
+
${c.dim}# Add specific finding to allowlist${c.reset}
|
|
91
|
+
vibecheck allowlist add --id R_ANON_DEAD_abc123 --reason "Known toggle behavior"
|
|
92
|
+
|
|
93
|
+
${c.dim}# Add pattern-based allowlist${c.reset}
|
|
94
|
+
vibecheck allowlist add --pattern "lorem ipsum" --reason "Docs page placeholder"
|
|
95
|
+
|
|
96
|
+
${c.dim}# Add file-scoped allowlist${c.reset}
|
|
97
|
+
vibecheck allowlist add --pattern "test data" --scope file --file "src/fixtures.ts" --reason "Test fixtures"
|
|
98
|
+
|
|
99
|
+
${c.dim}# Add with expiration${c.reset}
|
|
100
|
+
vibecheck allowlist add --id FAKE_xyz --reason "Temporary demo" --expires 7
|
|
101
|
+
|
|
102
|
+
${c.dim}# Remove entry${c.reset}
|
|
103
|
+
vibecheck allowlist remove --id AL_abc123
|
|
104
|
+
|
|
105
|
+
${c.dim}# Check if finding is allowlisted${c.reset}
|
|
106
|
+
vibecheck allowlist check --id R_ANON_DEAD_abc123
|
|
107
|
+
`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function runAllowlist(argsOrOpts = {}) {
|
|
111
|
+
// Handle array args from CLI
|
|
112
|
+
let globalOpts = { noBanner: false, json: false, quiet: false, ci: false };
|
|
113
|
+
if (Array.isArray(argsOrOpts)) {
|
|
114
|
+
const { flags } = parseGlobalFlags(argsOrOpts);
|
|
115
|
+
globalOpts = { ...globalOpts, ...flags };
|
|
116
|
+
|
|
117
|
+
if (globalOpts.help) {
|
|
118
|
+
printHelp(globalOpts);
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const getArg = (flags) => {
|
|
123
|
+
for (const f of flags) {
|
|
124
|
+
const idx = argsOrOpts.indexOf(f);
|
|
125
|
+
if (idx !== -1 && idx < argsOrOpts.length - 1) return argsOrOpts[idx + 1];
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Get action (first positional arg)
|
|
131
|
+
const action = argsOrOpts.find(a => !a.startsWith("-") && a !== "allowlist") || "list";
|
|
132
|
+
|
|
133
|
+
argsOrOpts = {
|
|
134
|
+
repoRoot: process.cwd(),
|
|
135
|
+
action,
|
|
136
|
+
id: getArg(["--id"]),
|
|
137
|
+
pattern: getArg(["--pattern"]),
|
|
138
|
+
reason: getArg(["--reason"]),
|
|
139
|
+
scope: getArg(["--scope"]) || "global",
|
|
140
|
+
file: getArg(["--file"]),
|
|
141
|
+
lines: getArg(["--lines"]),
|
|
142
|
+
expires: getArg(["--expires"]),
|
|
143
|
+
...globalOpts,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const {
|
|
148
|
+
repoRoot = process.cwd(),
|
|
149
|
+
action = "list",
|
|
150
|
+
id = null,
|
|
151
|
+
pattern = null,
|
|
152
|
+
reason = null,
|
|
153
|
+
scope = "global",
|
|
154
|
+
file = null,
|
|
155
|
+
lines = null,
|
|
156
|
+
expires = null,
|
|
157
|
+
json = false,
|
|
158
|
+
quiet = false
|
|
159
|
+
} = argsOrOpts;
|
|
160
|
+
|
|
161
|
+
const root = repoRoot || process.cwd();
|
|
162
|
+
|
|
163
|
+
// Import evidence-pack module
|
|
164
|
+
let evidencePack;
|
|
165
|
+
try {
|
|
166
|
+
evidencePack = require("./lib/evidence-pack");
|
|
167
|
+
} catch (e) {
|
|
168
|
+
console.error(`${colors.error}${ICONS.block}${c.reset} Failed to load evidence-pack module: ${e.message}`);
|
|
169
|
+
return 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
try {
|
|
173
|
+
switch (action) {
|
|
174
|
+
case "list": {
|
|
175
|
+
const allowlist = evidencePack.loadAllowlist(root);
|
|
176
|
+
|
|
177
|
+
if (json) {
|
|
178
|
+
console.log(JSON.stringify(allowlist, null, 2));
|
|
179
|
+
return 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (!quiet) {
|
|
183
|
+
console.log(`\n ${ICONS.list} ${c.bold}Allowlist Entries${c.reset}\n`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!allowlist.entries || allowlist.entries.length === 0) {
|
|
187
|
+
console.log(` ${c.dim}No entries in allowlist.${c.reset}\n`);
|
|
188
|
+
console.log(` ${c.dim}Add entries with: vibecheck allowlist add --id <id> --reason "..."${c.reset}\n`);
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
for (const entry of allowlist.entries) {
|
|
193
|
+
const expireStr = entry.expiresAt
|
|
194
|
+
? `${c.dim}expires ${new Date(entry.expiresAt).toLocaleDateString()}${c.reset}`
|
|
195
|
+
: '';
|
|
196
|
+
const scopeStr = entry.scope !== 'global'
|
|
197
|
+
? `${c.cyan}[${entry.scope}]${c.reset} `
|
|
198
|
+
: '';
|
|
199
|
+
|
|
200
|
+
console.log(` ${colors.success}${ICONS.allow}${c.reset} ${c.bold}${entry.id}${c.reset} ${scopeStr}${expireStr}`);
|
|
201
|
+
|
|
202
|
+
if (entry.findingId) {
|
|
203
|
+
console.log(` ${c.dim}Finding:${c.reset} ${entry.findingId}`);
|
|
204
|
+
}
|
|
205
|
+
if (entry.pattern) {
|
|
206
|
+
console.log(` ${c.dim}Pattern:${c.reset} ${entry.pattern}`);
|
|
207
|
+
}
|
|
208
|
+
console.log(` ${c.dim}Reason:${c.reset} ${entry.reason || 'No reason provided'}`);
|
|
209
|
+
console.log(` ${c.dim}Added:${c.reset} ${entry.addedAt} by ${entry.addedBy || 'user'}`);
|
|
210
|
+
console.log();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
console.log(` ${c.dim}Total: ${allowlist.entries.length} entries${c.reset}\n`);
|
|
214
|
+
return 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
case "add": {
|
|
218
|
+
if (!id && !pattern) {
|
|
219
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} Either --id or --pattern is required\n`);
|
|
220
|
+
return 1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (!reason) {
|
|
224
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} --reason is required\n`);
|
|
225
|
+
return 1;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const entry = {
|
|
229
|
+
findingId: id,
|
|
230
|
+
pattern,
|
|
231
|
+
reason,
|
|
232
|
+
scope,
|
|
233
|
+
addedBy: 'cli'
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
if (file) entry.file = file;
|
|
237
|
+
if (lines) {
|
|
238
|
+
const [start, end] = lines.split('-').map(Number);
|
|
239
|
+
entry.lines = [start, end || start];
|
|
240
|
+
}
|
|
241
|
+
if (expires) {
|
|
242
|
+
const days = parseInt(expires, 10);
|
|
243
|
+
entry.expiresAt = new Date(Date.now() + days * 24 * 60 * 60 * 1000).toISOString();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const added = evidencePack.addToAllowlist(root, entry);
|
|
247
|
+
|
|
248
|
+
if (json) {
|
|
249
|
+
console.log(JSON.stringify({ added }, null, 2));
|
|
250
|
+
return 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
console.log(`\n ${colors.success}${ICONS.add}${c.reset} Added allowlist entry: ${c.bold}${added.id}${c.reset}\n`);
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
case "remove": {
|
|
258
|
+
if (!id) {
|
|
259
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} --id is required for remove\n`);
|
|
260
|
+
return 1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const allowlist = evidencePack.loadAllowlist(root);
|
|
264
|
+
const before = allowlist.entries.length;
|
|
265
|
+
allowlist.entries = allowlist.entries.filter(e => e.id !== id && e.findingId !== id);
|
|
266
|
+
const removed = before - allowlist.entries.length;
|
|
267
|
+
|
|
268
|
+
if (removed > 0) {
|
|
269
|
+
evidencePack.saveAllowlist(root, allowlist);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (json) {
|
|
273
|
+
console.log(JSON.stringify({ removed, remaining: allowlist.entries.length }, null, 2));
|
|
274
|
+
return 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (removed > 0) {
|
|
278
|
+
console.log(`\n ${colors.success}${ICONS.remove}${c.reset} Removed ${removed} entry from allowlist\n`);
|
|
279
|
+
} else {
|
|
280
|
+
console.log(`\n ${colors.warning}${ICONS.block}${c.reset} Entry not found: ${id}\n`);
|
|
281
|
+
}
|
|
282
|
+
return 0;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
case "check": {
|
|
286
|
+
if (!id) {
|
|
287
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} --id is required for check\n`);
|
|
288
|
+
return 1;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const allowlist = evidencePack.loadAllowlist(root);
|
|
292
|
+
const result = evidencePack.isAllowlisted({ id }, allowlist);
|
|
293
|
+
|
|
294
|
+
if (json) {
|
|
295
|
+
console.log(JSON.stringify(result, null, 2));
|
|
296
|
+
return result.allowed ? 0 : 1;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (result.allowed) {
|
|
300
|
+
console.log(`\n ${colors.success}${ICONS.allow}${c.reset} ${c.bold}Allowlisted${c.reset}`);
|
|
301
|
+
console.log(` ${c.dim}Reason:${c.reset} ${result.reason}`);
|
|
302
|
+
console.log(` ${c.dim}Entry:${c.reset} ${result.entry?.id}\n`);
|
|
303
|
+
} else {
|
|
304
|
+
console.log(`\n ${colors.warning}${ICONS.block}${c.reset} ${c.bold}Not allowlisted${c.reset}\n`);
|
|
305
|
+
}
|
|
306
|
+
return result.allowed ? 0 : 1;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
default:
|
|
310
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} Unknown action: ${action}\n`);
|
|
311
|
+
printHelp(globalOpts);
|
|
312
|
+
return 1;
|
|
313
|
+
}
|
|
314
|
+
} catch (error) {
|
|
315
|
+
if (json) {
|
|
316
|
+
console.log(JSON.stringify({ error: error.message }, null, 2));
|
|
317
|
+
} else {
|
|
318
|
+
console.error(`\n ${colors.error}${ICONS.block}${c.reset} ${error.message}\n`);
|
|
319
|
+
}
|
|
320
|
+
return 1;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
module.exports = { runAllowlist };
|