@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
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Truth Context
|
|
3
|
-
*
|
|
4
|
-
* Core
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
2
|
+
* Truth Context - MCP Tools for Evidence-Backed AI
|
|
3
|
+
*
|
|
4
|
+
* Core Context Engine tools that provide truth-backed context for AI agents.
|
|
5
|
+
* All responses include citations (file/line) and confidence levels.
|
|
6
|
+
*
|
|
7
|
+
* This is the "Truth Firewall" made visible as "Evidence Pack" / "Truth Pack".
|
|
8
|
+
*
|
|
10
9
|
* Tools:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* vibecheck.ctx - Get repo truth bundle (routes, auth, billing, env, schema)
|
|
11
|
+
* vibecheck.verify_claim - Verify a claim has evidence
|
|
12
|
+
* vibecheck.evidence - Get evidence for a specific file/function
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
import fs from "fs/promises";
|
|
@@ -24,72 +23,60 @@ import { execSync } from "child_process";
|
|
|
24
23
|
export const TRUTH_CONTEXT_TOOLS = [
|
|
25
24
|
{
|
|
26
25
|
name: "vibecheck.ctx",
|
|
27
|
-
description: `📋
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Use this before
|
|
31
|
-
about the codebase.
|
|
26
|
+
description: `📋 Get repo Truth Pack — routes, auth, billing, env vars, schema.
|
|
27
|
+
|
|
28
|
+
Returns evidence-backed context with file/line citations.
|
|
29
|
+
Use this before making any claims about the codebase.
|
|
32
30
|
|
|
33
31
|
Returns:
|
|
34
|
-
- routes: All
|
|
35
|
-
- auth: Auth guards, protected routes, auth flow
|
|
36
|
-
- billing: Payment gates, subscription checks, paid
|
|
37
|
-
- env: Environment variables (declared vs used
|
|
38
|
-
- schema: Database schema
|
|
39
|
-
- confidence:
|
|
32
|
+
- routes: All defined routes with handlers and middleware
|
|
33
|
+
- auth: Auth guards, protected routes, auth flow
|
|
34
|
+
- billing: Payment gates, subscription checks, paid features
|
|
35
|
+
- env: Environment variables (declared vs used)
|
|
36
|
+
- schema: Database schema, API contracts
|
|
37
|
+
- confidence: Overall confidence score (0-1)`,
|
|
40
38
|
inputSchema: {
|
|
41
39
|
type: "object",
|
|
42
40
|
properties: {
|
|
43
41
|
scope: {
|
|
44
42
|
type: "string",
|
|
45
43
|
enum: ["all", "routes", "auth", "billing", "env", "schema"],
|
|
46
|
-
description: "
|
|
44
|
+
description: "What context to extract (default: all)",
|
|
47
45
|
default: "all",
|
|
48
46
|
},
|
|
49
47
|
path: {
|
|
50
48
|
type: "string",
|
|
51
|
-
description: "Project
|
|
49
|
+
description: "Project path (default: current directory)",
|
|
52
50
|
},
|
|
53
51
|
},
|
|
54
52
|
},
|
|
55
53
|
},
|
|
56
54
|
{
|
|
57
55
|
name: "vibecheck.verify_claim",
|
|
58
|
-
description: `🔍
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Returns
|
|
62
|
-
or a structured rejection with an explanation when it is not.
|
|
56
|
+
description: `🔍 Verify a claim has evidence — Truth Firewall check.
|
|
57
|
+
|
|
58
|
+
Before claiming something exists or works, verify it.
|
|
59
|
+
Returns evidence (file/line) or rejection with reason.
|
|
63
60
|
|
|
64
61
|
Examples:
|
|
65
|
-
- "Route /api/users exists"
|
|
66
|
-
- "Auth is required for /admin"
|
|
67
|
-
- "Stripe is configured"
|
|
62
|
+
- "Route /api/users exists" → Verified with handler at src/routes/users.ts:45
|
|
63
|
+
- "Auth is required for /admin" → Verified with middleware at src/middleware/auth.ts:12
|
|
64
|
+
- "Stripe is configured" → REJECTED: No evidence of Stripe integration found`,
|
|
68
65
|
inputSchema: {
|
|
69
66
|
type: "object",
|
|
70
67
|
properties: {
|
|
71
68
|
claim_type: {
|
|
72
69
|
type: "string",
|
|
73
|
-
enum: [
|
|
74
|
-
|
|
75
|
-
"endpoint",
|
|
76
|
-
"env_var",
|
|
77
|
-
"middleware",
|
|
78
|
-
"auth_guard",
|
|
79
|
-
"billing_gate",
|
|
80
|
-
"file",
|
|
81
|
-
"function",
|
|
82
|
-
],
|
|
83
|
-
description: "Category of claim to verify",
|
|
70
|
+
enum: ["route", "endpoint", "env_var", "middleware", "auth_guard", "billing_gate", "file", "function"],
|
|
71
|
+
description: "Type of claim to verify",
|
|
84
72
|
},
|
|
85
73
|
claim: {
|
|
86
74
|
type: "string",
|
|
87
|
-
description:
|
|
88
|
-
"The claim subject (e.g. '/api/users', 'AUTH_SECRET', 'authMiddleware')",
|
|
75
|
+
description: "The claim to verify (e.g., '/api/users', 'AUTH_SECRET', 'authMiddleware')",
|
|
89
76
|
},
|
|
90
77
|
path: {
|
|
91
78
|
type: "string",
|
|
92
|
-
description: "Project
|
|
79
|
+
description: "Project path (default: current directory)",
|
|
93
80
|
},
|
|
94
81
|
},
|
|
95
82
|
required: ["claim_type", "claim"],
|
|
@@ -97,35 +84,33 @@ Examples:
|
|
|
97
84
|
},
|
|
98
85
|
{
|
|
99
86
|
name: "vibecheck.evidence",
|
|
100
|
-
description: `📎
|
|
101
|
-
|
|
102
|
-
Returns
|
|
103
|
-
Use this when
|
|
104
|
-
in its response.`,
|
|
87
|
+
description: `📎 Get evidence for a file/function — citations with context.
|
|
88
|
+
|
|
89
|
+
Returns the actual code with line numbers for citation.
|
|
90
|
+
Use this when you need to reference specific code in your response.`,
|
|
105
91
|
inputSchema: {
|
|
106
92
|
type: "object",
|
|
107
93
|
properties: {
|
|
108
94
|
file: {
|
|
109
95
|
type: "string",
|
|
110
|
-
description: "File path relative to
|
|
96
|
+
description: "File path relative to project root",
|
|
111
97
|
},
|
|
112
98
|
function_name: {
|
|
113
99
|
type: "string",
|
|
114
|
-
description: "Optional function/class name to
|
|
100
|
+
description: "Optional function/class name to find",
|
|
115
101
|
},
|
|
116
102
|
line: {
|
|
117
103
|
type: "number",
|
|
118
|
-
description: "Optional
|
|
104
|
+
description: "Optional specific line number",
|
|
119
105
|
},
|
|
120
106
|
context_lines: {
|
|
121
107
|
type: "number",
|
|
122
|
-
description:
|
|
123
|
-
"Number of lines of context before/after the target (default: 10)",
|
|
108
|
+
description: "Lines of context around target (default: 10)",
|
|
124
109
|
default: 10,
|
|
125
110
|
},
|
|
126
111
|
path: {
|
|
127
112
|
type: "string",
|
|
128
|
-
description: "Project
|
|
113
|
+
description: "Project path (default: current directory)",
|
|
129
114
|
},
|
|
130
115
|
},
|
|
131
116
|
required: ["file"],
|
|
@@ -134,7 +119,7 @@ in its response.`,
|
|
|
134
119
|
];
|
|
135
120
|
|
|
136
121
|
// ============================================================================
|
|
137
|
-
// TOOL
|
|
122
|
+
// TOOL HANDLERS
|
|
138
123
|
// ============================================================================
|
|
139
124
|
|
|
140
125
|
export async function handleTruthContextTool(toolName, args) {
|
|
@@ -183,11 +168,10 @@ async function getTruthPack(projectPath, scope) {
|
|
|
183
168
|
truthPack.sections.schema = await extractSchema(projectPath);
|
|
184
169
|
}
|
|
185
170
|
|
|
171
|
+
// Calculate overall confidence
|
|
186
172
|
const sections = Object.values(truthPack.sections);
|
|
187
173
|
if (sections.length > 0) {
|
|
188
|
-
truthPack.confidence =
|
|
189
|
-
sections.reduce((sum, section) => sum + (section.confidence || 0), 0) /
|
|
190
|
-
sections.length;
|
|
174
|
+
truthPack.confidence = sections.reduce((sum, s) => sum + (s.confidence || 0), 0) / sections.length;
|
|
191
175
|
}
|
|
192
176
|
|
|
193
177
|
return truthPack;
|
|
@@ -195,7 +179,7 @@ async function getTruthPack(projectPath, scope) {
|
|
|
195
179
|
return {
|
|
196
180
|
error: error.message,
|
|
197
181
|
projectPath,
|
|
198
|
-
suggestion: "Run
|
|
182
|
+
suggestion: "Run 'vibecheck init' to set up the project",
|
|
199
183
|
};
|
|
200
184
|
}
|
|
201
185
|
}
|
|
@@ -209,12 +193,12 @@ async function extractRoutes(projectPath) {
|
|
|
209
193
|
];
|
|
210
194
|
|
|
211
195
|
const files = await findSourceFiles(projectPath, [".ts", ".js", ".tsx", ".jsx"]);
|
|
212
|
-
|
|
213
|
-
for (const file of files.slice(0, 50)) {
|
|
196
|
+
|
|
197
|
+
for (const file of files.slice(0, 50)) { // Limit for performance
|
|
214
198
|
try {
|
|
215
199
|
const content = await fs.readFile(file, "utf8");
|
|
216
200
|
const relPath = path.relative(projectPath, file);
|
|
217
|
-
|
|
201
|
+
|
|
218
202
|
for (const pattern of routePatterns) {
|
|
219
203
|
let match;
|
|
220
204
|
pattern.lastIndex = 0;
|
|
@@ -239,7 +223,7 @@ async function extractRoutes(projectPath) {
|
|
|
239
223
|
|
|
240
224
|
return {
|
|
241
225
|
count: routes.length,
|
|
242
|
-
routes: routes.slice(0, 100),
|
|
226
|
+
routes: routes.slice(0, 100), // Limit output
|
|
243
227
|
confidence: routes.length > 0 ? 0.8 : 0.2,
|
|
244
228
|
};
|
|
245
229
|
}
|
|
@@ -254,12 +238,12 @@ async function extractAuth(projectPath) {
|
|
|
254
238
|
];
|
|
255
239
|
|
|
256
240
|
const files = await findSourceFiles(projectPath, [".ts", ".js"]);
|
|
257
|
-
|
|
241
|
+
|
|
258
242
|
for (const file of files.slice(0, 50)) {
|
|
259
243
|
try {
|
|
260
244
|
const content = await fs.readFile(file, "utf8");
|
|
261
245
|
const relPath = path.relative(projectPath, file);
|
|
262
|
-
|
|
246
|
+
|
|
263
247
|
for (const pattern of authPatterns) {
|
|
264
248
|
let match;
|
|
265
249
|
pattern.lastIndex = 0;
|
|
@@ -281,12 +265,7 @@ async function extractAuth(projectPath) {
|
|
|
281
265
|
return {
|
|
282
266
|
count: authIndicators.length,
|
|
283
267
|
indicators: authIndicators.slice(0, 50),
|
|
284
|
-
confidence:
|
|
285
|
-
authIndicators.length > 5
|
|
286
|
-
? 0.8
|
|
287
|
-
: authIndicators.length > 0
|
|
288
|
-
? 0.5
|
|
289
|
-
: 0.1,
|
|
268
|
+
confidence: authIndicators.length > 5 ? 0.8 : authIndicators.length > 0 ? 0.5 : 0.1,
|
|
290
269
|
};
|
|
291
270
|
}
|
|
292
271
|
|
|
@@ -300,12 +279,12 @@ async function extractBilling(projectPath) {
|
|
|
300
279
|
];
|
|
301
280
|
|
|
302
281
|
const files = await findSourceFiles(projectPath, [".ts", ".js"]);
|
|
303
|
-
|
|
282
|
+
|
|
304
283
|
for (const file of files.slice(0, 30)) {
|
|
305
284
|
try {
|
|
306
285
|
const content = await fs.readFile(file, "utf8");
|
|
307
286
|
const relPath = path.relative(projectPath, file);
|
|
308
|
-
|
|
287
|
+
|
|
309
288
|
for (const pattern of billingPatterns) {
|
|
310
289
|
let match;
|
|
311
290
|
pattern.lastIndex = 0;
|
|
@@ -327,12 +306,7 @@ async function extractBilling(projectPath) {
|
|
|
327
306
|
return {
|
|
328
307
|
count: billingIndicators.length,
|
|
329
308
|
indicators: billingIndicators.slice(0, 30),
|
|
330
|
-
confidence:
|
|
331
|
-
billingIndicators.length > 3
|
|
332
|
-
? 0.7
|
|
333
|
-
: billingIndicators.length > 0
|
|
334
|
-
? 0.4
|
|
335
|
-
: 0.1,
|
|
309
|
+
confidence: billingIndicators.length > 3 ? 0.7 : billingIndicators.length > 0 ? 0.4 : 0.1,
|
|
336
310
|
};
|
|
337
311
|
}
|
|
338
312
|
|
|
@@ -340,6 +314,7 @@ async function extractEnvVars(projectPath) {
|
|
|
340
314
|
const declared = [];
|
|
341
315
|
const used = [];
|
|
342
316
|
|
|
317
|
+
// Check .env.example, .env.local.example, etc.
|
|
343
318
|
const envFiles = [".env.example", ".env.local.example", ".env.sample"];
|
|
344
319
|
for (const envFile of envFiles) {
|
|
345
320
|
try {
|
|
@@ -356,10 +331,11 @@ async function extractEnvVars(projectPath) {
|
|
|
356
331
|
}
|
|
357
332
|
}
|
|
358
333
|
} catch {
|
|
359
|
-
// File
|
|
334
|
+
// File doesn't exist
|
|
360
335
|
}
|
|
361
336
|
}
|
|
362
337
|
|
|
338
|
+
// Find process.env usage in code
|
|
363
339
|
const files = await findSourceFiles(projectPath, [".ts", ".js"]);
|
|
364
340
|
for (const file of files.slice(0, 30)) {
|
|
365
341
|
try {
|
|
@@ -380,10 +356,11 @@ async function extractEnvVars(projectPath) {
|
|
|
380
356
|
}
|
|
381
357
|
}
|
|
382
358
|
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
const
|
|
386
|
-
const
|
|
359
|
+
// Find mismatches
|
|
360
|
+
const declaredNames = new Set(declared.map(d => d.name));
|
|
361
|
+
const usedNames = new Set(used.map(u => u.name));
|
|
362
|
+
const undeclared = [...usedNames].filter(n => !declaredNames.has(n));
|
|
363
|
+
const unused = [...declaredNames].filter(n => !usedNames.has(n));
|
|
387
364
|
|
|
388
365
|
return {
|
|
389
366
|
declared: declared.slice(0, 50),
|
|
@@ -399,6 +376,7 @@ async function extractEnvVars(projectPath) {
|
|
|
399
376
|
async function extractSchema(projectPath) {
|
|
400
377
|
const schemas = [];
|
|
401
378
|
|
|
379
|
+
// Check for Prisma schema
|
|
402
380
|
try {
|
|
403
381
|
const prismaPath = path.join(projectPath, "prisma", "schema.prisma");
|
|
404
382
|
const content = await fs.readFile(prismaPath, "utf8");
|
|
@@ -411,15 +389,16 @@ async function extractSchema(projectPath) {
|
|
|
411
389
|
});
|
|
412
390
|
}
|
|
413
391
|
} catch {
|
|
414
|
-
// No Prisma
|
|
392
|
+
// No Prisma
|
|
415
393
|
}
|
|
416
394
|
|
|
395
|
+
// Check for TypeScript types/interfaces
|
|
417
396
|
const files = await findSourceFiles(projectPath, [".ts", ".tsx"]);
|
|
418
397
|
for (const file of files.slice(0, 20)) {
|
|
419
398
|
try {
|
|
420
399
|
const content = await fs.readFile(file, "utf8");
|
|
421
400
|
const relPath = path.relative(projectPath, file);
|
|
422
|
-
|
|
401
|
+
|
|
423
402
|
const typeMatches = content.matchAll(/(?:interface|type)\s+(\w+)/g);
|
|
424
403
|
for (const match of typeMatches) {
|
|
425
404
|
const line = content.substring(0, match.index).split("\n").length;
|
|
@@ -438,8 +417,7 @@ async function extractSchema(projectPath) {
|
|
|
438
417
|
return {
|
|
439
418
|
count: schemas.length,
|
|
440
419
|
schemas: schemas.slice(0, 50),
|
|
441
|
-
confidence:
|
|
442
|
-
schemas.length > 5 ? 0.7 : schemas.length > 0 ? 0.4 : 0.2,
|
|
420
|
+
confidence: schemas.length > 5 ? 0.7 : schemas.length > 0 ? 0.4 : 0.2,
|
|
443
421
|
};
|
|
444
422
|
}
|
|
445
423
|
|
|
@@ -458,7 +436,7 @@ async function verifyClaim(projectPath, claimType, claim) {
|
|
|
458
436
|
|
|
459
437
|
try {
|
|
460
438
|
switch (claimType) {
|
|
461
|
-
case "file":
|
|
439
|
+
case "file":
|
|
462
440
|
const filePath = path.join(projectPath, claim);
|
|
463
441
|
try {
|
|
464
442
|
await fs.access(filePath);
|
|
@@ -475,14 +453,11 @@ async function verifyClaim(projectPath, claimType, claim) {
|
|
|
475
453
|
result.rejection = `File does not exist: ${claim}`;
|
|
476
454
|
}
|
|
477
455
|
break;
|
|
478
|
-
}
|
|
479
456
|
|
|
480
457
|
case "route":
|
|
481
|
-
case "endpoint":
|
|
458
|
+
case "endpoint":
|
|
482
459
|
const routes = await extractRoutes(projectPath);
|
|
483
|
-
const matchingRoute = routes.routes.find(
|
|
484
|
-
(route) => route.path === claim || route.path.includes(claim),
|
|
485
|
-
);
|
|
460
|
+
const matchingRoute = routes.routes.find(r => r.path === claim || r.path.includes(claim));
|
|
486
461
|
if (matchingRoute) {
|
|
487
462
|
result.verified = true;
|
|
488
463
|
result.confidence = 0.9;
|
|
@@ -491,31 +466,26 @@ async function verifyClaim(projectPath, claimType, claim) {
|
|
|
491
466
|
result.rejection = `No route matching "${claim}" found in codebase`;
|
|
492
467
|
}
|
|
493
468
|
break;
|
|
494
|
-
}
|
|
495
469
|
|
|
496
|
-
case "env_var":
|
|
470
|
+
case "env_var":
|
|
497
471
|
const envData = await extractEnvVars(projectPath);
|
|
498
|
-
const isDeclared = envData.declared.some(
|
|
499
|
-
const isUsed = envData.used.some(
|
|
472
|
+
const isDeclared = envData.declared.some(d => d.name === claim);
|
|
473
|
+
const isUsed = envData.used.some(u => u.name === claim);
|
|
500
474
|
if (isDeclared || isUsed) {
|
|
501
475
|
result.verified = true;
|
|
502
476
|
result.confidence = isDeclared && isUsed ? 1.0 : 0.7;
|
|
503
477
|
result.evidence = {
|
|
504
478
|
declared: isDeclared,
|
|
505
479
|
used: isUsed,
|
|
506
|
-
locations: [
|
|
507
|
-
...envData.declared.filter((env) => env.name === claim),
|
|
508
|
-
...envData.used.filter((env) => env.name === claim),
|
|
509
|
-
],
|
|
480
|
+
locations: [...envData.declared.filter(d => d.name === claim), ...envData.used.filter(u => u.name === claim)],
|
|
510
481
|
};
|
|
511
482
|
} else {
|
|
512
483
|
result.rejection = `Environment variable "${claim}" not found`;
|
|
513
484
|
}
|
|
514
485
|
break;
|
|
515
|
-
}
|
|
516
486
|
|
|
517
487
|
default:
|
|
518
|
-
result.rejection = `Claim type "${claimType}" verification
|
|
488
|
+
result.rejection = `Claim type "${claimType}" verification not yet implemented`;
|
|
519
489
|
}
|
|
520
490
|
} catch (error) {
|
|
521
491
|
result.rejection = `Verification error: ${error.message}`;
|
|
@@ -530,19 +500,17 @@ async function verifyClaim(projectPath, claimType, claim) {
|
|
|
530
500
|
|
|
531
501
|
async function getEvidence(projectPath, file, options) {
|
|
532
502
|
const filePath = path.join(projectPath, file);
|
|
533
|
-
|
|
503
|
+
|
|
534
504
|
try {
|
|
535
505
|
const content = await fs.readFile(filePath, "utf8");
|
|
536
506
|
const lines = content.split("\n");
|
|
537
|
-
|
|
507
|
+
|
|
538
508
|
let targetLine = options.line || 1;
|
|
539
509
|
const contextLines = options.context_lines || 10;
|
|
540
|
-
|
|
510
|
+
|
|
511
|
+
// If function_name provided, find it
|
|
541
512
|
if (options.function_name) {
|
|
542
|
-
const pattern = new RegExp(
|
|
543
|
-
`(function|const|let|var|class)\\s+${options.function_name}`,
|
|
544
|
-
"i",
|
|
545
|
-
);
|
|
513
|
+
const pattern = new RegExp(`(function|const|let|var|class)\\s+${options.function_name}`, "i");
|
|
546
514
|
for (let i = 0; i < lines.length; i++) {
|
|
547
515
|
if (pattern.test(lines[i])) {
|
|
548
516
|
targetLine = i + 1;
|
|
@@ -550,18 +518,14 @@ async function getEvidence(projectPath, file, options) {
|
|
|
550
518
|
}
|
|
551
519
|
}
|
|
552
520
|
}
|
|
553
|
-
|
|
521
|
+
|
|
554
522
|
const startLine = Math.max(1, targetLine - contextLines);
|
|
555
523
|
const endLine = Math.min(lines.length, targetLine + contextLines);
|
|
556
|
-
|
|
557
|
-
const snippet = lines
|
|
558
|
-
.
|
|
559
|
-
.map(
|
|
560
|
-
(line, index) =>
|
|
561
|
-
`${String(startLine + index).padStart(4, " ")} | ${line}`,
|
|
562
|
-
)
|
|
524
|
+
|
|
525
|
+
const snippet = lines.slice(startLine - 1, endLine)
|
|
526
|
+
.map((line, i) => `${String(startLine + i).padStart(4, " ")} | ${line}`)
|
|
563
527
|
.join("\n");
|
|
564
|
-
|
|
528
|
+
|
|
565
529
|
return {
|
|
566
530
|
file,
|
|
567
531
|
targetLine,
|
|
@@ -585,19 +549,14 @@ async function getEvidence(projectPath, file, options) {
|
|
|
585
549
|
|
|
586
550
|
async function findSourceFiles(projectPath, extensions) {
|
|
587
551
|
const files = [];
|
|
588
|
-
|
|
552
|
+
|
|
589
553
|
async function walk(dir) {
|
|
590
554
|
try {
|
|
591
555
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
592
556
|
for (const entry of entries) {
|
|
593
557
|
const fullPath = path.join(dir, entry.name);
|
|
594
558
|
if (entry.isDirectory()) {
|
|
595
|
-
if (
|
|
596
|
-
!entry.name.startsWith(".") &&
|
|
597
|
-
entry.name !== "node_modules" &&
|
|
598
|
-
entry.name !== "dist" &&
|
|
599
|
-
entry.name !== "build"
|
|
600
|
-
) {
|
|
559
|
+
if (!entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== "dist" && entry.name !== "build") {
|
|
601
560
|
await walk(fullPath);
|
|
602
561
|
}
|
|
603
562
|
} else if (entry.isFile()) {
|
|
@@ -611,7 +570,7 @@ async function findSourceFiles(projectPath, extensions) {
|
|
|
611
570
|
// Skip inaccessible directories
|
|
612
571
|
}
|
|
613
572
|
}
|
|
614
|
-
|
|
573
|
+
|
|
615
574
|
await walk(projectPath);
|
|
616
575
|
return files;
|
|
617
576
|
}
|