@vibecheck-ai/mcp 24.4.3 → 24.5.6

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 (3) hide show
  1. package/dist/index.js +758 -510
  2. package/package.json +23 -14
  3. package/LICENSE +0 -21
package/dist/index.js CHANGED
@@ -219676,7 +219676,7 @@ var require_wrappers = __commonJS({
219676
219676
  exports2.prepare = function prepare(sql) {
219677
219677
  return this[cppdb].prepare(sql, this, false);
219678
219678
  };
219679
- exports2.exec = function exec(sql) {
219679
+ exports2.exec = function exec2(sql) {
219680
219680
  this[cppdb].exec(sql);
219681
219681
  return this;
219682
219682
  };
@@ -219823,9 +219823,9 @@ var require_backup = __commonJS({
219823
219823
  "use strict";
219824
219824
  var fs7 = __require("fs");
219825
219825
  var path10 = __require("path");
219826
- var { promisify } = __require("util");
219826
+ var { promisify: promisify2 } = __require("util");
219827
219827
  var { cppdb } = require_util2();
219828
- var fsAccess = promisify(fs7.access);
219828
+ var fsAccess = promisify2(fs7.access);
219829
219829
  module2.exports = async function backup(filename, options) {
219830
219830
  if (options == null) options = {};
219831
219831
  if (typeof filename !== "string") throw new TypeError("Expected first argument to be a string");
@@ -275179,10 +275179,10 @@ var init_browser = __esm({
275179
275179
  return response;
275180
275180
  };
275181
275181
  post = async (fetch3, host, data, options) => {
275182
- const isRecord = (input) => {
275182
+ const isRecord2 = (input) => {
275183
275183
  return input !== null && typeof input === "object" && !Array.isArray(input);
275184
275184
  };
275185
- const formattedData = isRecord(data) ? JSON.stringify(data) : data;
275185
+ const formattedData = isRecord2(data) ? JSON.stringify(data) : data;
275186
275186
  const response = await fetchWithHeaders(fetch3, host, {
275187
275187
  method: "POST",
275188
275188
  body: formattedData,
@@ -278734,6 +278734,8 @@ import { pathToFileURL } from "url";
278734
278734
  // src/server.ts
278735
278735
  import * as path9 from "path";
278736
278736
  import * as fs6 from "fs";
278737
+ import { exec } from "child_process";
278738
+ import { promisify } from "util";
278737
278739
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
278738
278740
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
278739
278741
  import {
@@ -278747,6 +278749,7 @@ import {
278747
278749
  } from "@vibecheck/engines";
278748
278750
  import { formatRoastHtml } from "@vibecheck/roast";
278749
278751
  import {
278752
+ gateCanonicalScanReportFindings,
278750
278753
  normalizeCanonicalScanReport
278751
278754
  } from "@repo/shared-types";
278752
278755
 
@@ -291808,7 +291811,7 @@ var ContextEngine = class {
291808
291811
  // src/server.ts
291809
291812
  init_dist();
291810
291813
 
291811
- // ../subscriptions/dist/chunk-PGIBAA63.js
291814
+ // ../subscriptions/dist/chunk-EQ52N5FM.js
291812
291815
  var PLAN_IDS = ["free", "pro", "team", "enterprise"];
291813
291816
  var PLAN_RANK = Object.fromEntries(
291814
291817
  PLAN_IDS.map((id, index2) => [id, index2])
@@ -291840,9 +291843,6 @@ function normalizePlanId(raw) {
291840
291843
  if (isCanonicalPlanId(lower)) return lower;
291841
291844
  return PLAN_NORMALIZATION_ALIASES[lower] ?? "free";
291842
291845
  }
291843
- function isPlanId(value) {
291844
- return isCanonicalPlanId(value);
291845
- }
291846
291846
  function validateNormalizationAliases() {
291847
291847
  const errors = [];
291848
291848
  for (const [alias, canonical] of Object.entries(PLAN_NORMALIZATION_ALIASES)) {
@@ -292063,7 +292063,7 @@ if (typeof process !== "undefined") {
292063
292063
  }
292064
292064
  var PLAN_QUOTAS = {
292065
292065
  free: {
292066
- findingDetailLimit: 5,
292066
+ findingDetailLimit: 0,
292067
292067
  canAutoFix: false,
292068
292068
  canHealPR: false,
292069
292069
  canModelFingerprint: false,
@@ -292188,10 +292188,213 @@ function formatDailyScanLimitMessage(usage) {
292188
292188
  }
292189
292189
 
292190
292190
  // ../subscriptions/dist/index.js
292191
+ var ENTITLEMENTS = {
292192
+ // ── FREE ────────────────────────────────────────────────────────────────
292193
+ /** Basic scanning (single file, summary only for free) */
292194
+ SCAN: "v2.scan",
292195
+ /** Workspace-level scanning (doctor, roast, score, codegraph, wikicode, atlas) */
292196
+ SCAN_WORKSPACE: "v2.scan_workspace",
292197
+ // ── PRO ─────────────────────────────────────────────────────────────────
292198
+ /** GitHub Action CI guard, PR comments, status checks */
292199
+ GITHUB_ACTION: "v2.github_action",
292200
+ /** Reality Mode, Proof View, Certification, Provenance, Drift */
292201
+ FULL_EVIDENCE: "v2.full_evidence",
292202
+ /** Export findings to SARIF format */
292203
+ SARIF_EXPORT: "v2.sarif_export",
292204
+ /** API keys, programmatic access */
292205
+ API_ACCESS: "v2.api_access",
292206
+ /** Deep Scan (16+ engines), performance analysis, accessibility */
292207
+ PRIORITY_ENGINES: "v2.priority_engines",
292208
+ /** PDF reports, executive summaries, shareable links */
292209
+ ADVANCED_REPORT: "v2.advanced_report",
292210
+ /** AI-powered code repair, apply fixes, rollback */
292211
+ AUTOFIX: "v2.autofix",
292212
+ /** Ship Quality Gate, PR merge protection, CI blocking */
292213
+ CI_BLOCK: "v2.ci_block",
292214
+ /** Full AI context generation, rules, agents, skills, hooks */
292215
+ CONTEXT_ENGINE: "v2.context_engine",
292216
+ /** MCP Playground, AI generation, slash commands */
292217
+ SANDBOX: "v2.sandbox",
292218
+ /** Email support, faster response */
292219
+ SUPPORT: "v2.support",
292220
+ // ── TEAM ────────────────────────────────────────────────────────────────
292221
+ /** Team dashboard, shared policies, cross-repo scanning, audit logs */
292222
+ TEAM_COLLABORATION: "v2.team_collaboration",
292223
+ // ── ENTERPRISE ──────────────────────────────────────────────────────────
292224
+ /** SOC2, HIPAA, PCI-DSS, GDPR, SSO/SAML, dedicated SLA */
292225
+ ENTERPRISE_COMPLIANCE: "v2.enterprise_compliance"
292226
+ };
292227
+ var FREE_SET = /* @__PURE__ */ new Set([
292228
+ ENTITLEMENTS.SCAN,
292229
+ ENTITLEMENTS.SCAN_WORKSPACE
292230
+ ]);
292231
+ var PRO_SET = /* @__PURE__ */ new Set([
292232
+ ...FREE_SET,
292233
+ ENTITLEMENTS.GITHUB_ACTION,
292234
+ ENTITLEMENTS.FULL_EVIDENCE,
292235
+ ENTITLEMENTS.SARIF_EXPORT,
292236
+ ENTITLEMENTS.API_ACCESS,
292237
+ ENTITLEMENTS.PRIORITY_ENGINES,
292238
+ ENTITLEMENTS.ADVANCED_REPORT,
292239
+ ENTITLEMENTS.AUTOFIX,
292240
+ ENTITLEMENTS.CI_BLOCK,
292241
+ ENTITLEMENTS.CONTEXT_ENGINE,
292242
+ ENTITLEMENTS.SANDBOX,
292243
+ ENTITLEMENTS.SUPPORT
292244
+ ]);
292245
+ var TEAM_SET = /* @__PURE__ */ new Set([
292246
+ ...PRO_SET,
292247
+ ENTITLEMENTS.TEAM_COLLABORATION
292248
+ ]);
292249
+ var ENTERPRISE_SET = /* @__PURE__ */ new Set([
292250
+ ...TEAM_SET,
292251
+ ENTITLEMENTS.ENTERPRISE_COMPLIANCE
292252
+ ]);
292253
+ var PLAN_ENTITLEMENTS = {
292254
+ free: FREE_SET,
292255
+ pro: PRO_SET,
292256
+ team: TEAM_SET,
292257
+ enterprise: ENTERPRISE_SET
292258
+ };
292191
292259
  function normalizePlanForEntitlement(plan) {
292192
292260
  return typeof plan === "string" ? normalizePlanId(plan) : "free";
292193
292261
  }
292194
- var ENTITLEMENTS = {
292262
+ function hasEntitlement(plan, entitlement) {
292263
+ const safePlan = normalizePlanForEntitlement(plan);
292264
+ return PLAN_ENTITLEMENTS[safePlan]?.has(entitlement) ?? false;
292265
+ }
292266
+ function getRequiredPlan(entitlement) {
292267
+ for (const id of PLAN_IDS) {
292268
+ if (PLAN_ENTITLEMENTS[id]?.has(entitlement)) return id;
292269
+ }
292270
+ if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
292271
+ console.warn(`[subscriptions] Unknown entitlement "${entitlement}" \u2014 defaulting to enterprise tier`);
292272
+ }
292273
+ return "enterprise";
292274
+ }
292275
+ function getEntitlementsForPlan(plan) {
292276
+ const safePlan = normalizePlanForEntitlement(plan);
292277
+ return PLAN_ENTITLEMENTS[safePlan] ?? FREE_SET;
292278
+ }
292279
+ function meetsPlanRequirement(userPlan, requiredPlan) {
292280
+ const safeUserPlan = normalizePlanForEntitlement(userPlan);
292281
+ return PLAN_RANK[safeUserPlan] >= PLAN_RANK[requiredPlan];
292282
+ }
292283
+ function validateEntitlementMatrix() {
292284
+ const errors = [];
292285
+ const validEntitlements = new Set(Object.values(ENTITLEMENTS));
292286
+ const coveredEntitlements = /* @__PURE__ */ new Set();
292287
+ for (const planId of PLAN_IDS) {
292288
+ if (!PLAN_ENTITLEMENTS[planId]) {
292289
+ errors.push(`Missing entitlement set for "${planId}"`);
292290
+ }
292291
+ }
292292
+ for (const [planId, entitlements] of Object.entries(PLAN_ENTITLEMENTS)) {
292293
+ for (const entitlement of entitlements) {
292294
+ if (!validEntitlements.has(entitlement)) {
292295
+ errors.push(`Plan "${planId}" contains unknown entitlement "${entitlement}"`);
292296
+ }
292297
+ coveredEntitlements.add(entitlement);
292298
+ }
292299
+ }
292300
+ for (const entitlement of validEntitlements) {
292301
+ if (!coveredEntitlements.has(entitlement)) {
292302
+ errors.push(`Entitlement "${entitlement}" is not granted by any plan`);
292303
+ }
292304
+ }
292305
+ for (let index2 = 1; index2 < PLAN_IDS.length; index2 += 1) {
292306
+ const lowerPlan = PLAN_IDS[index2 - 1];
292307
+ const higherPlan = PLAN_IDS[index2];
292308
+ const lowerSet = PLAN_ENTITLEMENTS[lowerPlan];
292309
+ const higherSet = PLAN_ENTITLEMENTS[higherPlan];
292310
+ for (const entitlement of lowerSet) {
292311
+ if (!higherSet.has(entitlement)) {
292312
+ errors.push(`Plan "${higherPlan}" is missing inherited entitlement "${entitlement}" from "${lowerPlan}"`);
292313
+ }
292314
+ }
292315
+ }
292316
+ return errors;
292317
+ }
292318
+ function assertValidEntitlementMatrix() {
292319
+ const errors = validateEntitlementMatrix();
292320
+ if (errors.length > 0) {
292321
+ throw new Error(`[subscriptions] Invalid entitlement matrix:
292322
+ - ${errors.join("\n- ")}`);
292323
+ }
292324
+ }
292325
+ if (typeof process !== "undefined") {
292326
+ if (process.env?.NODE_ENV === "test") {
292327
+ assertValidEntitlementMatrix();
292328
+ } else if (process.env?.NODE_ENV !== "production") {
292329
+ const errors = validateEntitlementMatrix();
292330
+ if (errors.length > 0) {
292331
+ console.warn("[subscriptions] entitlement matrix validation failed:", errors);
292332
+ }
292333
+ }
292334
+ }
292335
+ var ENTITLEMENT_META = {
292336
+ [ENTITLEMENTS.SCAN]: {
292337
+ title: "Scan",
292338
+ benefits: ["Single-file scanning", "Basic HTML report"]
292339
+ },
292340
+ [ENTITLEMENTS.SCAN_WORKSPACE]: {
292341
+ title: "Workspace Scan",
292342
+ benefits: ["Unlimited scans", "Doctor, Roast, Score", "Codegraph, WikiCode, Atlas"]
292343
+ },
292344
+ [ENTITLEMENTS.GITHUB_ACTION]: {
292345
+ title: "GitHub Action",
292346
+ benefits: ["CI guard action", "PR comments", "Status checks"]
292347
+ },
292348
+ [ENTITLEMENTS.FULL_EVIDENCE]: {
292349
+ title: "Full Evidence",
292350
+ benefits: ["Reality Mode", "Proof View", "Certification", "Provenance tracking", "Drift detection"]
292351
+ },
292352
+ [ENTITLEMENTS.SARIF_EXPORT]: {
292353
+ title: "SARIF Export",
292354
+ benefits: ["Export findings to SARIF format"]
292355
+ },
292356
+ [ENTITLEMENTS.API_ACCESS]: {
292357
+ title: "API Access",
292358
+ benefits: ["API keys", "Programmatic access"]
292359
+ },
292360
+ [ENTITLEMENTS.PRIORITY_ENGINES]: {
292361
+ title: "Priority Engines",
292362
+ benefits: ["Deep Scan (16 engines)", "Performance analysis", "Accessibility audit", "API connectivity check"]
292363
+ },
292364
+ [ENTITLEMENTS.ADVANCED_REPORT]: {
292365
+ title: "Advanced Reports",
292366
+ benefits: ["PDF reports", "Executive summaries", "Shareable links"]
292367
+ },
292368
+ [ENTITLEMENTS.AUTOFIX]: {
292369
+ title: "Auto-Fix",
292370
+ benefits: ["AI-powered code repair", "Apply fixes with one click", "Rollback support"]
292371
+ },
292372
+ [ENTITLEMENTS.CI_BLOCK]: {
292373
+ title: "CI & PR Gates",
292374
+ benefits: ["Ship Quality Gate (SHIP / NO_SHIP)", "PR merge protection & status checks", "Verify, trust, coverage & drift panels"]
292375
+ },
292376
+ [ENTITLEMENTS.CONTEXT_ENGINE]: {
292377
+ title: "Context Engine",
292378
+ benefits: ["Full AI context generation", "Rules, agents, skills, hooks"]
292379
+ },
292380
+ [ENTITLEMENTS.SANDBOX]: {
292381
+ title: "Sandbox",
292382
+ benefits: ["MCP Playground", "AI generation", "Slash commands"]
292383
+ },
292384
+ [ENTITLEMENTS.SUPPORT]: {
292385
+ title: "Priority Support",
292386
+ benefits: ["Email support", "Faster response"]
292387
+ },
292388
+ [ENTITLEMENTS.TEAM_COLLABORATION]: {
292389
+ title: "Team Collaboration",
292390
+ benefits: ["Team dashboard", "Shared policies", "Cross-repo scanning", "Audit logs"]
292391
+ },
292392
+ [ENTITLEMENTS.ENTERPRISE_COMPLIANCE]: {
292393
+ title: "Enterprise Compliance",
292394
+ benefits: ["SOC2", "HIPAA", "PCI-DSS", "GDPR", "SSO/SAML", "Dedicated SLA"]
292395
+ }
292396
+ };
292397
+ var LEGACY_ENTITLEMENTS = {
292195
292398
  SCAN_UNLIMITED: "scan_unlimited",
292196
292399
  SCAN_BASIC: "scan_basic",
292197
292400
  SHIP_SCORE: "ship_score",
@@ -292284,7 +292487,6 @@ var ENTITLEMENTS = {
292284
292487
  COMMIT_SHIELD_COMPLIANCE: "commit_shield_compliance",
292285
292488
  ENTERPRISE_MULTI_REPO: "enterprise_multi_repo",
292286
292489
  ENTERPRISE_SIGNED_BUNDLES: "enterprise_signed_bundles",
292287
- // Sandbox & AI Engine
292288
292490
  SANDBOX_ACCESS: "sandbox_access",
292289
292491
  SANDBOX_GENERATIONS: "sandbox_generations",
292290
292492
  SANDBOX_PREMIUM_MODELS: "sandbox_premium_models",
@@ -292295,446 +292497,129 @@ var ENTITLEMENTS = {
292295
292497
  AI_CONFIDENCE_METER: "ai_confidence_meter",
292296
292498
  AI_HALLUCINATION_SHIELD: "ai_hallucination_shield",
292297
292499
  VERIFIED_BUILD_CERT: "verified_build_cert",
292298
- // ── Free-tier features (explicit entitlements per product spec) ──────────
292299
292500
  KICKOFF_CONNECT: "kickoff_connect",
292300
292501
  CODEGRAPH_VIEW: "codegraph_view",
292301
292502
  WIKICODE_VIEW: "wikicode_view",
292302
292503
  ROAST: "roast",
292303
292504
  VIBE_FLOW: "vibe_flow"
292304
292505
  };
292305
- var FREE_SET = /* @__PURE__ */ new Set([
292306
- // ── Core free features (product spec: sign-in required for all) ──────────
292307
- // Free users get: unlimited scans (summary only), kickoff, doctor, roast, reports,
292308
- // truthpack, codegraph, wikicode, vibe flow. Everything else is PAID.
292309
- // For new features, prefer isPaidPlan() over adding new entitlement keys.
292310
- ENTITLEMENTS.SCAN_BASIC,
292311
- // unlimited scans, gated evidence (summary only for free)
292312
- ENTITLEMENTS.KICKOFF_CONNECT,
292313
- // vibecheckAI-Official kickoff / connect my project
292314
- ENTITLEMENTS.DOCTOR,
292315
- // health check / doctor
292316
- ENTITLEMENTS.ROAST,
292317
- // roast me
292318
- ENTITLEMENTS.REPORTS_HTML,
292319
- // reports (HTML)
292320
- ENTITLEMENTS.REPORTS_PDF,
292321
- // reports (PDF)
292322
- ENTITLEMENTS.TRUTHPACK_GENERATE,
292323
- // truth pack
292324
- ENTITLEMENTS.TRUTHPACK_VALIDATE,
292325
- // truth pack validation
292326
- ENTITLEMENTS.CODEGRAPH_VIEW,
292327
- // codegraph
292328
- ENTITLEMENTS.WIKICODE_VIEW,
292329
- // wikicode
292330
- ENTITLEMENTS.ATLAS,
292331
- // wikicode atlas (dashboard view of wikicode)
292332
- ENTITLEMENTS.VIBE_FLOW,
292333
- // vibe flow
292334
- ENTITLEMENTS.REVIEW_WORKFLOWS,
292335
- // vibe flow review workflows
292336
- ENTITLEMENTS.FLOW_WORKFLOWS,
292337
- // vibe flow flow workflows
292338
- ENTITLEMENTS.SHIP_SCORE,
292339
- // scan output (part of basic scan)
292340
- ENTITLEMENTS.ISL_STUDIO
292341
- // ISL Studio — free to browse/edit; generation uses credit packs
292342
- ]);
292343
- var PRO_SET = /* @__PURE__ */ new Set([
292344
- ...FREE_SET,
292345
- // ── Moved from free to pro (product spec: everything else is paid) ────
292346
- ENTITLEMENTS.MISSIONS_VIEW,
292347
- ENTITLEMENTS.TEMPLATES_BROWSE,
292348
- ENTITLEMENTS.TEMPLATES_INSTALL,
292349
- ENTITLEMENTS.FIREWALL_OBSERVE,
292350
- // ISL_STUDIO moved to FREE_SET — credit-based generation, not tier-gated
292351
- // ── Pro features ──────────────────────────────────────────────────────
292352
- ENTITLEMENTS.AUTOFIX_LIMITED,
292353
- ENTITLEMENTS.PROOF_VIEW,
292354
- ENTITLEMENTS.SCAN_UNLIMITED,
292355
- ENTITLEMENTS.CHECKPOINT,
292356
- ENTITLEMENTS.FORGE_BASIC,
292357
- ENTITLEMENTS.PROMPT_TEMPLATES_BASIC,
292358
- ENTITLEMENTS.WATCH_MODE,
292359
- ENTITLEMENTS.TRACE_ANALYSIS,
292360
- ENTITLEMENTS.FILE_LOCKING,
292361
- ENTITLEMENTS.COMMIT_SHIELD_WARNINGS,
292362
- ENTITLEMENTS.GITHUB_ACTION_WARN,
292363
- ENTITLEMENTS.VIBE_PROMPT,
292364
- ENTITLEMENTS.AUTOFIX_UNLIMITED,
292365
- ENTITLEMENTS.AUTOFIX_APPLY,
292366
- ENTITLEMENTS.REALITY_MODE,
292367
- ENTITLEMENTS.COMMIT_SHIELD_FULL,
292368
- ENTITLEMENTS.COMMIT_SHIELD_AUDITOR,
292369
- ENTITLEMENTS.REPORTS_EXECUTIVE,
292370
- ENTITLEMENTS.CLOUD_SYNC,
292371
- ENTITLEMENTS.CERTIFY,
292372
- ENTITLEMENTS.BADGE_VERIFIED,
292373
- ENTITLEMENTS.PROOF_HISTORY,
292374
- ENTITLEMENTS.SHAREABLE_REPORTS,
292375
- ENTITLEMENTS.PRIORITY_SUPPORT,
292376
- // Sandbox (Pro tier)
292377
- ENTITLEMENTS.SANDBOX_ACCESS,
292378
- ENTITLEMENTS.SANDBOX_GENERATIONS,
292379
- ENTITLEMENTS.SANDBOX_SLASH_COMMANDS,
292380
- ENTITLEMENTS.AI_CONFIDENCE_METER,
292381
- ENTITLEMENTS.AI_HALLUCINATION_SHIELD,
292382
- // Former Team tier — included on Pro (single paid SKU; team rank kept for legacy subscribers).
292383
- // `PLAN_QUOTAS.pro.canCIBlock` is kept aligned so dashboard/API limits match this set.
292384
- ENTITLEMENTS.GITHUB_ACTION,
292385
- ENTITLEMENTS.CI_INTEGRATION,
292386
- ENTITLEMENTS.API_ACCESS,
292387
- ENTITLEMENTS.PR_COMMENTS,
292388
- ENTITLEMENTS.STATUS_CHECKS,
292389
- ENTITLEMENTS.BRANCH_PROTECTION,
292390
- ENTITLEMENTS.WEBHOOK_INTEGRATION,
292391
- ENTITLEMENTS.CI_GATE_BLOCK,
292392
- ENTITLEMENTS.CONTEXT_ENGINE,
292393
- ENTITLEMENTS.ISL_VERIFY,
292394
- ENTITLEMENTS.DEEP_SCAN,
292395
- ENTITLEMENTS.SCAN_PRO_ENGINES,
292396
- ENTITLEMENTS.DRIFT_DETECTION,
292397
- ENTITLEMENTS.CHAOS_AGENT,
292398
- ENTITLEMENTS.MODEL_FINGERPRINT,
292399
- ENTITLEMENTS.PROVENANCE_TRACKING,
292400
- ENTITLEMENTS.FIREWALL_AGENT,
292401
- ENTITLEMENTS.FIREWALL_ENFORCE,
292402
- ENTITLEMENTS.FIREWALL_LOCKDOWN,
292403
- ENTITLEMENTS.FORGE_EXTENDED,
292404
- ENTITLEMENTS.PROMPT_TEMPLATES_PRO,
292405
- ENTITLEMENTS.AI_GENERATION,
292406
- ENTITLEMENTS.REPLAY_VIEWER_FULL,
292407
- ENTITLEMENTS.SANDBOX_PREMIUM_MODELS,
292408
- ENTITLEMENTS.SANDBOX_AGENT_MODES,
292409
- ENTITLEMENTS.SANDBOX_PROOF_BUNDLES,
292410
- ENTITLEMENTS.SANDBOX_CLAUDE_SKILLS,
292411
- ENTITLEMENTS.VERIFIED_BUILD_CERT
292412
- ]);
292413
- var TEAM_SET = new Set(PRO_SET);
292414
- var ENTERPRISE_SET = /* @__PURE__ */ new Set([
292415
- ...TEAM_SET,
292416
- ENTITLEMENTS.TEAM_DASHBOARD,
292417
- ENTITLEMENTS.TEAM_COLLABORATION,
292418
- ENTITLEMENTS.TEAM_CROSS_REPO_SCANNING,
292419
- ENTITLEMENTS.TEAM_SHARED_POLICIES,
292420
- ENTITLEMENTS.TEAM_PROVENANCE_INSIGHTS,
292421
- ENTITLEMENTS.TEAM_ADMIN_POLICY_ENFORCEMENT,
292422
- ENTITLEMENTS.TEAM_AUDIT_LOG_EXPORT,
292423
- ENTITLEMENTS.TEAM_CONTEXT_ENGINE_SHARED,
292424
- ENTITLEMENTS.TEAM_PRIORITY_QUEUE,
292425
- ENTITLEMENTS.TEAM_ANALYTICS,
292426
- ENTITLEMENTS.TEAM_SLACK_ALERTS,
292427
- ENTITLEMENTS.TEAM_LEADERBOARDS,
292428
- ENTITLEMENTS.TEAM_BULK_INVITE,
292429
- ENTITLEMENTS.TEAM_ROLES,
292430
- ENTITLEMENTS.TEAM_SCAN_BUDGETS,
292431
- ENTITLEMENTS.COMPLIANCE_SOC2,
292432
- ENTITLEMENTS.COMPLIANCE_HIPAA,
292433
- ENTITLEMENTS.COMPLIANCE_PCI_DSS,
292434
- ENTITLEMENTS.COMPLIANCE_GDPR,
292435
- ENTITLEMENTS.COMPLIANCE_ISO27001,
292436
- ENTITLEMENTS.SDK_GENERATOR,
292437
- ENTITLEMENTS.POLICY_ENGINE,
292438
- ENTITLEMENTS.SSO_SAML,
292439
- ENTITLEMENTS.ON_PREMISE,
292440
- ENTITLEMENTS.DEDICATED_SLA,
292441
- ENTITLEMENTS.COMMIT_SHIELD_TEAM,
292442
- ENTITLEMENTS.COMMIT_SHIELD_ENTERPRISE,
292443
- ENTITLEMENTS.COMMIT_SHIELD_COMPLIANCE,
292444
- ENTITLEMENTS.ENTERPRISE_MULTI_REPO,
292445
- ENTITLEMENTS.ENTERPRISE_SIGNED_BUNDLES
292446
- ]);
292447
- var PLAN_ENTITLEMENTS = {
292448
- free: FREE_SET,
292449
- pro: PRO_SET,
292450
- team: TEAM_SET,
292451
- enterprise: ENTERPRISE_SET
292452
- };
292453
- function validateEntitlementMatrix() {
292454
- const errors = [];
292455
- const validEntitlements = new Set(Object.values(ENTITLEMENTS));
292456
- const coveredEntitlements = /* @__PURE__ */ new Set();
292457
- for (const planId of PLAN_IDS) {
292458
- if (!PLAN_ENTITLEMENTS[planId]) {
292459
- errors.push(`Missing entitlement set for "${planId}"`);
292460
- }
292461
- }
292462
- for (const key of Object.keys(PLAN_ENTITLEMENTS)) {
292463
- if (!isPlanId(key)) {
292464
- errors.push(`Unexpected non-canonical entitlement plan key "${key}"`);
292465
- }
292466
- }
292467
- for (const [planId, entitlements] of Object.entries(PLAN_ENTITLEMENTS)) {
292468
- for (const entitlement of entitlements) {
292469
- if (!validEntitlements.has(entitlement)) {
292470
- errors.push(`Plan "${planId}" contains unknown entitlement "${entitlement}"`);
292471
- }
292472
- coveredEntitlements.add(entitlement);
292473
- }
292474
- }
292475
- for (const entitlement of validEntitlements) {
292476
- if (!coveredEntitlements.has(entitlement)) {
292477
- errors.push(`Entitlement "${entitlement}" is not granted by any plan`);
292478
- }
292479
- }
292480
- for (let index2 = 1; index2 < PLAN_IDS.length; index2 += 1) {
292481
- const lowerPlan = PLAN_IDS[index2 - 1];
292482
- const higherPlan = PLAN_IDS[index2];
292483
- const lowerSet = PLAN_ENTITLEMENTS[lowerPlan];
292484
- const higherSet = PLAN_ENTITLEMENTS[higherPlan];
292485
- for (const entitlement of lowerSet) {
292486
- if (!higherSet.has(entitlement)) {
292487
- errors.push(`Plan "${higherPlan}" is missing inherited entitlement "${entitlement}" from "${lowerPlan}"`);
292488
- }
292489
- }
292490
- }
292491
- return errors;
292492
- }
292493
- function assertValidEntitlementMatrix() {
292494
- const errors = validateEntitlementMatrix();
292495
- if (errors.length > 0) {
292496
- throw new Error(`[subscriptions] Invalid entitlement matrix:
292497
- - ${errors.join("\n- ")}`);
292498
- }
292499
- }
292500
- function hasEntitlement(plan, entitlement) {
292501
- const safePlan = normalizePlanForEntitlement(plan);
292502
- return PLAN_ENTITLEMENTS[safePlan]?.has(entitlement) ?? false;
292503
- }
292504
- function getRequiredPlan(entitlement) {
292505
- for (const id of PLAN_IDS) {
292506
- if (PLAN_ENTITLEMENTS[id]?.has(entitlement)) return id;
292507
- }
292508
- if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
292509
- console.warn(`[subscriptions] Unknown entitlement "${entitlement}" \u2014 defaulting to enterprise tier`);
292510
- }
292511
- return "enterprise";
292512
- }
292513
- function getEntitlementsForPlan(plan) {
292514
- const safePlan = normalizePlanForEntitlement(plan);
292515
- return PLAN_ENTITLEMENTS[safePlan] ?? FREE_SET;
292516
- }
292517
- function meetsPlanRequirement(userPlan, requiredPlan) {
292518
- const safeUserPlan = normalizePlanForEntitlement(userPlan);
292519
- return PLAN_RANK[safeUserPlan] >= PLAN_RANK[requiredPlan];
292520
- }
292521
- if (typeof process !== "undefined") {
292522
- if (process.env?.NODE_ENV === "test") {
292523
- assertValidEntitlementMatrix();
292524
- } else if (process.env?.NODE_ENV !== "production") {
292525
- const errors = validateEntitlementMatrix();
292526
- if (errors.length > 0) {
292527
- console.warn("[subscriptions] entitlement matrix validation failed:", errors);
292528
- }
292529
- }
292530
- }
292531
- var ENTITLEMENTS_V2 = {
292532
- // ── FREE ────────────────────────────────────────────────────────────────
292533
- SCAN: "v2.scan",
292534
- SCAN_WORKSPACE: "v2.scan_workspace",
292535
- // ── PRO ─────────────────────────────────────────────────────────────────
292536
- GITHUB_ACTION: "v2.github_action",
292537
- FULL_EVIDENCE: "v2.full_evidence",
292538
- SARIF_EXPORT: "v2.sarif_export",
292539
- API_ACCESS: "v2.api_access",
292540
- PRIORITY_ENGINES: "v2.priority_engines",
292541
- ADVANCED_REPORT: "v2.advanced_report",
292542
- AUTOFIX: "v2.autofix",
292543
- CI_BLOCK: "v2.ci_block",
292544
- CONTEXT_ENGINE: "v2.context_engine",
292545
- SANDBOX: "v2.sandbox",
292546
- SUPPORT: "v2.support",
292547
- // ── TEAM ────────────────────────────────────────────────────────────────
292548
- TEAM_COLLABORATION: "v2.team_collaboration",
292549
- // ── ENTERPRISE ──────────────────────────────────────────────────────────
292550
- ENTERPRISE_COMPLIANCE: "v2.enterprise_compliance"
292551
- };
292552
292506
  var LEGACY_TO_V2_MAP = {
292553
292507
  // ── FREE tier keys ──────────────────────────────────────────────────────
292554
- [ENTITLEMENTS.SCAN_BASIC]: ENTITLEMENTS_V2.SCAN,
292555
- [ENTITLEMENTS.SCAN_UNLIMITED]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292556
- [ENTITLEMENTS.SHIP_SCORE]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292557
- [ENTITLEMENTS.DOCTOR]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292558
- [ENTITLEMENTS.ROAST]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292559
- [ENTITLEMENTS.REPORTS_HTML]: ENTITLEMENTS_V2.SCAN,
292560
- [ENTITLEMENTS.CHECKPOINT]: null,
292561
- // Not visible in UI
292562
- [ENTITLEMENTS.MISSIONS_VIEW]: null,
292563
- // Missions merged into autofix
292564
- [ENTITLEMENTS.TEMPLATES_BROWSE]: null,
292565
- // Templates culled (P8)
292566
- [ENTITLEMENTS.TEMPLATES_INSTALL]: null,
292567
- // Templates culled (P8)
292568
- [ENTITLEMENTS.TRUTHPACK_GENERATE]: null,
292569
- // Truthpack culled (P8)
292570
- [ENTITLEMENTS.TRUTHPACK_VALIDATE]: null,
292571
- // Truthpack culled (P8)
292572
- [ENTITLEMENTS.KICKOFF_CONNECT]: null,
292573
- // Merged into onboarding
292574
- [ENTITLEMENTS.CODEGRAPH_VIEW]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292575
- [ENTITLEMENTS.WIKICODE_VIEW]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292576
- [ENTITLEMENTS.VIBE_FLOW]: null,
292577
- // Culled (P8)
292578
- [ENTITLEMENTS.REVIEW_WORKFLOWS]: null,
292579
- // Culled (P8)
292580
- [ENTITLEMENTS.FLOW_WORKFLOWS]: null,
292581
- // Culled (P8)
292582
- [ENTITLEMENTS.ATLAS]: ENTITLEMENTS_V2.SCAN_WORKSPACE,
292583
- [ENTITLEMENTS.ISL_STUDIO]: null,
292584
- // Free to browse; generation is credit-based
292585
- [ENTITLEMENTS.REPORTS_PDF]: ENTITLEMENTS_V2.ADVANCED_REPORT,
292508
+ [LEGACY_ENTITLEMENTS.SCAN_BASIC]: ENTITLEMENTS.SCAN,
292509
+ [LEGACY_ENTITLEMENTS.SCAN_UNLIMITED]: ENTITLEMENTS.SCAN_WORKSPACE,
292510
+ [LEGACY_ENTITLEMENTS.SHIP_SCORE]: ENTITLEMENTS.SCAN_WORKSPACE,
292511
+ [LEGACY_ENTITLEMENTS.DOCTOR]: ENTITLEMENTS.SCAN_WORKSPACE,
292512
+ [LEGACY_ENTITLEMENTS.ROAST]: ENTITLEMENTS.SCAN_WORKSPACE,
292513
+ [LEGACY_ENTITLEMENTS.REPORTS_HTML]: ENTITLEMENTS.SCAN,
292514
+ [LEGACY_ENTITLEMENTS.CHECKPOINT]: null,
292515
+ [LEGACY_ENTITLEMENTS.MISSIONS_VIEW]: null,
292516
+ [LEGACY_ENTITLEMENTS.TEMPLATES_BROWSE]: null,
292517
+ [LEGACY_ENTITLEMENTS.TEMPLATES_INSTALL]: null,
292518
+ [LEGACY_ENTITLEMENTS.TRUTHPACK_GENERATE]: null,
292519
+ [LEGACY_ENTITLEMENTS.TRUTHPACK_VALIDATE]: null,
292520
+ [LEGACY_ENTITLEMENTS.KICKOFF_CONNECT]: null,
292521
+ [LEGACY_ENTITLEMENTS.CODEGRAPH_VIEW]: ENTITLEMENTS.SCAN_WORKSPACE,
292522
+ [LEGACY_ENTITLEMENTS.WIKICODE_VIEW]: ENTITLEMENTS.SCAN_WORKSPACE,
292523
+ [LEGACY_ENTITLEMENTS.VIBE_FLOW]: null,
292524
+ [LEGACY_ENTITLEMENTS.REVIEW_WORKFLOWS]: null,
292525
+ [LEGACY_ENTITLEMENTS.FLOW_WORKFLOWS]: null,
292526
+ [LEGACY_ENTITLEMENTS.ATLAS]: ENTITLEMENTS.SCAN_WORKSPACE,
292527
+ [LEGACY_ENTITLEMENTS.ISL_STUDIO]: null,
292528
+ [LEGACY_ENTITLEMENTS.REPORTS_PDF]: ENTITLEMENTS.ADVANCED_REPORT,
292586
292529
  // ── PRO tier keys ───────────────────────────────────────────────────────
292587
- [ENTITLEMENTS.FORGE_BASIC]: null,
292588
- // Forge culled
292589
- [ENTITLEMENTS.PROMPT_TEMPLATES_BASIC]: null,
292590
- // Part of context_engine
292591
- [ENTITLEMENTS.WATCH_MODE]: null,
292592
- // Not actively used
292593
- [ENTITLEMENTS.TRACE_ANALYSIS]: null,
292594
- // Not visible
292595
- [ENTITLEMENTS.FIREWALL_OBSERVE]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292596
- [ENTITLEMENTS.FILE_LOCKING]: null,
292597
- // Feature incomplete
292598
- [ENTITLEMENTS.AUTOFIX_LIMITED]: ENTITLEMENTS_V2.AUTOFIX,
292599
- [ENTITLEMENTS.COMMIT_SHIELD_WARNINGS]: ENTITLEMENTS_V2.AUTOFIX,
292600
- [ENTITLEMENTS.GITHUB_ACTION_WARN]: ENTITLEMENTS_V2.GITHUB_ACTION,
292601
- [ENTITLEMENTS.VIBE_PROMPT]: null,
292602
- // Culled
292603
- [ENTITLEMENTS.PROOF_VIEW]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292604
- [ENTITLEMENTS.AUTOFIX_UNLIMITED]: ENTITLEMENTS_V2.AUTOFIX,
292605
- [ENTITLEMENTS.AUTOFIX_APPLY]: ENTITLEMENTS_V2.AUTOFIX,
292606
- [ENTITLEMENTS.REALITY_MODE]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292607
- [ENTITLEMENTS.COMMIT_SHIELD_FULL]: ENTITLEMENTS_V2.CI_BLOCK,
292608
- [ENTITLEMENTS.COMMIT_SHIELD_AUDITOR]: null,
292609
- // Auditor culled
292610
- [ENTITLEMENTS.REPORTS_EXECUTIVE]: ENTITLEMENTS_V2.ADVANCED_REPORT,
292611
- [ENTITLEMENTS.CLOUD_SYNC]: null,
292612
- // Implicit in paid
292613
- [ENTITLEMENTS.CERTIFY]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292614
- [ENTITLEMENTS.BADGE_VERIFIED]: null,
292615
- // Badges culled (P8)
292616
- [ENTITLEMENTS.PROOF_HISTORY]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292617
- [ENTITLEMENTS.SHAREABLE_REPORTS]: ENTITLEMENTS_V2.ADVANCED_REPORT,
292618
- [ENTITLEMENTS.PRIORITY_SUPPORT]: ENTITLEMENTS_V2.SUPPORT,
292619
- [ENTITLEMENTS.GITHUB_ACTION]: ENTITLEMENTS_V2.GITHUB_ACTION,
292620
- [ENTITLEMENTS.CI_INTEGRATION]: ENTITLEMENTS_V2.GITHUB_ACTION,
292621
- [ENTITLEMENTS.API_ACCESS]: ENTITLEMENTS_V2.API_ACCESS,
292622
- [ENTITLEMENTS.PR_COMMENTS]: ENTITLEMENTS_V2.GITHUB_ACTION,
292623
- [ENTITLEMENTS.STATUS_CHECKS]: ENTITLEMENTS_V2.GITHUB_ACTION,
292624
- [ENTITLEMENTS.BRANCH_PROTECTION]: ENTITLEMENTS_V2.CI_BLOCK,
292625
- [ENTITLEMENTS.WEBHOOK_INTEGRATION]: null,
292626
- // Webhooks culled
292627
- [ENTITLEMENTS.CI_GATE_BLOCK]: ENTITLEMENTS_V2.CI_BLOCK,
292628
- [ENTITLEMENTS.CONTEXT_ENGINE]: ENTITLEMENTS_V2.CONTEXT_ENGINE,
292629
- [ENTITLEMENTS.ISL_VERIFY]: null,
292630
- // ISL culled
292631
- [ENTITLEMENTS.DEEP_SCAN]: ENTITLEMENTS_V2.PRIORITY_ENGINES,
292632
- [ENTITLEMENTS.SCAN_PRO_ENGINES]: ENTITLEMENTS_V2.PRIORITY_ENGINES,
292633
- [ENTITLEMENTS.DRIFT_DETECTION]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292634
- [ENTITLEMENTS.CHAOS_AGENT]: null,
292635
- // Chaos culled
292636
- [ENTITLEMENTS.MODEL_FINGERPRINT]: null,
292637
- // Model fingerprint culled
292638
- [ENTITLEMENTS.PROVENANCE_TRACKING]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292639
- [ENTITLEMENTS.FIREWALL_AGENT]: ENTITLEMENTS_V2.FULL_EVIDENCE,
292640
- [ENTITLEMENTS.FIREWALL_ENFORCE]: ENTITLEMENTS_V2.CI_BLOCK,
292641
- [ENTITLEMENTS.FIREWALL_LOCKDOWN]: null,
292642
- // Lockdown not implemented
292643
- [ENTITLEMENTS.FORGE_EXTENDED]: null,
292644
- // Forge culled
292645
- [ENTITLEMENTS.PROMPT_TEMPLATES_PRO]: null,
292646
- // Part of context_engine
292647
- [ENTITLEMENTS.AI_GENERATION]: ENTITLEMENTS_V2.SANDBOX,
292648
- [ENTITLEMENTS.REPLAY_VIEWER_FULL]: null,
292649
- // Replay culled
292530
+ [LEGACY_ENTITLEMENTS.FORGE_BASIC]: null,
292531
+ [LEGACY_ENTITLEMENTS.PROMPT_TEMPLATES_BASIC]: null,
292532
+ [LEGACY_ENTITLEMENTS.WATCH_MODE]: null,
292533
+ [LEGACY_ENTITLEMENTS.TRACE_ANALYSIS]: null,
292534
+ [LEGACY_ENTITLEMENTS.FIREWALL_OBSERVE]: ENTITLEMENTS.FULL_EVIDENCE,
292535
+ [LEGACY_ENTITLEMENTS.FILE_LOCKING]: null,
292536
+ [LEGACY_ENTITLEMENTS.AUTOFIX_LIMITED]: ENTITLEMENTS.AUTOFIX,
292537
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_WARNINGS]: ENTITLEMENTS.AUTOFIX,
292538
+ [LEGACY_ENTITLEMENTS.GITHUB_ACTION_WARN]: ENTITLEMENTS.GITHUB_ACTION,
292539
+ [LEGACY_ENTITLEMENTS.VIBE_PROMPT]: null,
292540
+ [LEGACY_ENTITLEMENTS.PROOF_VIEW]: ENTITLEMENTS.FULL_EVIDENCE,
292541
+ [LEGACY_ENTITLEMENTS.AUTOFIX_UNLIMITED]: ENTITLEMENTS.AUTOFIX,
292542
+ [LEGACY_ENTITLEMENTS.AUTOFIX_APPLY]: ENTITLEMENTS.AUTOFIX,
292543
+ [LEGACY_ENTITLEMENTS.REALITY_MODE]: ENTITLEMENTS.FULL_EVIDENCE,
292544
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_FULL]: ENTITLEMENTS.CI_BLOCK,
292545
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_AUDITOR]: null,
292546
+ [LEGACY_ENTITLEMENTS.REPORTS_EXECUTIVE]: ENTITLEMENTS.ADVANCED_REPORT,
292547
+ [LEGACY_ENTITLEMENTS.CLOUD_SYNC]: null,
292548
+ [LEGACY_ENTITLEMENTS.CERTIFY]: ENTITLEMENTS.FULL_EVIDENCE,
292549
+ [LEGACY_ENTITLEMENTS.BADGE_VERIFIED]: null,
292550
+ [LEGACY_ENTITLEMENTS.PROOF_HISTORY]: ENTITLEMENTS.FULL_EVIDENCE,
292551
+ [LEGACY_ENTITLEMENTS.SHAREABLE_REPORTS]: ENTITLEMENTS.ADVANCED_REPORT,
292552
+ [LEGACY_ENTITLEMENTS.PRIORITY_SUPPORT]: ENTITLEMENTS.SUPPORT,
292553
+ [LEGACY_ENTITLEMENTS.GITHUB_ACTION]: ENTITLEMENTS.GITHUB_ACTION,
292554
+ [LEGACY_ENTITLEMENTS.CI_INTEGRATION]: ENTITLEMENTS.GITHUB_ACTION,
292555
+ [LEGACY_ENTITLEMENTS.API_ACCESS]: ENTITLEMENTS.API_ACCESS,
292556
+ [LEGACY_ENTITLEMENTS.PR_COMMENTS]: ENTITLEMENTS.GITHUB_ACTION,
292557
+ [LEGACY_ENTITLEMENTS.STATUS_CHECKS]: ENTITLEMENTS.GITHUB_ACTION,
292558
+ [LEGACY_ENTITLEMENTS.BRANCH_PROTECTION]: ENTITLEMENTS.CI_BLOCK,
292559
+ [LEGACY_ENTITLEMENTS.WEBHOOK_INTEGRATION]: null,
292560
+ [LEGACY_ENTITLEMENTS.CI_GATE_BLOCK]: ENTITLEMENTS.CI_BLOCK,
292561
+ [LEGACY_ENTITLEMENTS.CONTEXT_ENGINE]: ENTITLEMENTS.CONTEXT_ENGINE,
292562
+ [LEGACY_ENTITLEMENTS.ISL_VERIFY]: null,
292563
+ [LEGACY_ENTITLEMENTS.DEEP_SCAN]: ENTITLEMENTS.PRIORITY_ENGINES,
292564
+ [LEGACY_ENTITLEMENTS.SCAN_PRO_ENGINES]: ENTITLEMENTS.PRIORITY_ENGINES,
292565
+ [LEGACY_ENTITLEMENTS.DRIFT_DETECTION]: ENTITLEMENTS.FULL_EVIDENCE,
292566
+ [LEGACY_ENTITLEMENTS.CHAOS_AGENT]: null,
292567
+ [LEGACY_ENTITLEMENTS.MODEL_FINGERPRINT]: null,
292568
+ [LEGACY_ENTITLEMENTS.PROVENANCE_TRACKING]: ENTITLEMENTS.FULL_EVIDENCE,
292569
+ [LEGACY_ENTITLEMENTS.FIREWALL_AGENT]: ENTITLEMENTS.FULL_EVIDENCE,
292570
+ [LEGACY_ENTITLEMENTS.FIREWALL_ENFORCE]: ENTITLEMENTS.CI_BLOCK,
292571
+ [LEGACY_ENTITLEMENTS.FIREWALL_LOCKDOWN]: null,
292572
+ [LEGACY_ENTITLEMENTS.FORGE_EXTENDED]: null,
292573
+ [LEGACY_ENTITLEMENTS.PROMPT_TEMPLATES_PRO]: null,
292574
+ [LEGACY_ENTITLEMENTS.AI_GENERATION]: ENTITLEMENTS.SANDBOX,
292575
+ [LEGACY_ENTITLEMENTS.REPLAY_VIEWER_FULL]: null,
292650
292576
  // ── Sandbox & AI ────────────────────────────────────────────────────────
292651
- [ENTITLEMENTS.SANDBOX_ACCESS]: ENTITLEMENTS_V2.SANDBOX,
292652
- [ENTITLEMENTS.SANDBOX_GENERATIONS]: ENTITLEMENTS_V2.SANDBOX,
292653
- [ENTITLEMENTS.SANDBOX_PREMIUM_MODELS]: null,
292654
- // Not offered
292655
- [ENTITLEMENTS.SANDBOX_SLASH_COMMANDS]: ENTITLEMENTS_V2.SANDBOX,
292656
- [ENTITLEMENTS.SANDBOX_AGENT_MODES]: null,
292657
- // Agent modes culled
292658
- [ENTITLEMENTS.SANDBOX_PROOF_BUNDLES]: null,
292659
- // Proof bundles culled
292660
- [ENTITLEMENTS.SANDBOX_CLAUDE_SKILLS]: null,
292661
- // Skills culled
292662
- [ENTITLEMENTS.AI_CONFIDENCE_METER]: null,
292663
- // Not visible
292664
- [ENTITLEMENTS.AI_HALLUCINATION_SHIELD]: null,
292665
- // Part of core scanning
292666
- [ENTITLEMENTS.VERIFIED_BUILD_CERT]: null,
292667
- // Build certs culled
292577
+ [LEGACY_ENTITLEMENTS.SANDBOX_ACCESS]: ENTITLEMENTS.SANDBOX,
292578
+ [LEGACY_ENTITLEMENTS.SANDBOX_GENERATIONS]: ENTITLEMENTS.SANDBOX,
292579
+ [LEGACY_ENTITLEMENTS.SANDBOX_PREMIUM_MODELS]: null,
292580
+ [LEGACY_ENTITLEMENTS.SANDBOX_SLASH_COMMANDS]: ENTITLEMENTS.SANDBOX,
292581
+ [LEGACY_ENTITLEMENTS.SANDBOX_AGENT_MODES]: null,
292582
+ [LEGACY_ENTITLEMENTS.SANDBOX_PROOF_BUNDLES]: null,
292583
+ [LEGACY_ENTITLEMENTS.SANDBOX_CLAUDE_SKILLS]: null,
292584
+ [LEGACY_ENTITLEMENTS.AI_CONFIDENCE_METER]: null,
292585
+ [LEGACY_ENTITLEMENTS.AI_HALLUCINATION_SHIELD]: null,
292586
+ [LEGACY_ENTITLEMENTS.VERIFIED_BUILD_CERT]: null,
292668
292587
  // ── Team keys ───────────────────────────────────────────────────────────
292669
- [ENTITLEMENTS.TEAM_DASHBOARD]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292670
- [ENTITLEMENTS.TEAM_COLLABORATION]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292671
- [ENTITLEMENTS.TEAM_CROSS_REPO_SCANNING]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292672
- [ENTITLEMENTS.TEAM_SHARED_POLICIES]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292673
- [ENTITLEMENTS.TEAM_PROVENANCE_INSIGHTS]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292674
- [ENTITLEMENTS.TEAM_ADMIN_POLICY_ENFORCEMENT]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292675
- [ENTITLEMENTS.TEAM_AUDIT_LOG_EXPORT]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292676
- [ENTITLEMENTS.TEAM_CONTEXT_ENGINE_SHARED]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292677
- [ENTITLEMENTS.TEAM_PRIORITY_QUEUE]: null,
292678
- // Not implemented
292679
- [ENTITLEMENTS.TEAM_ANALYTICS]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292680
- [ENTITLEMENTS.TEAM_SLACK_ALERTS]: null,
292681
- // Slack culled
292682
- [ENTITLEMENTS.TEAM_LEADERBOARDS]: null,
292683
- // Gamification culled
292684
- [ENTITLEMENTS.TEAM_BULK_INVITE]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292685
- [ENTITLEMENTS.TEAM_ROLES]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292686
- [ENTITLEMENTS.TEAM_SCAN_BUDGETS]: null,
292687
- // Budgeting not implemented
292588
+ [LEGACY_ENTITLEMENTS.TEAM_DASHBOARD]: ENTITLEMENTS.TEAM_COLLABORATION,
292589
+ [LEGACY_ENTITLEMENTS.TEAM_COLLABORATION]: ENTITLEMENTS.TEAM_COLLABORATION,
292590
+ [LEGACY_ENTITLEMENTS.TEAM_CROSS_REPO_SCANNING]: ENTITLEMENTS.TEAM_COLLABORATION,
292591
+ [LEGACY_ENTITLEMENTS.TEAM_SHARED_POLICIES]: ENTITLEMENTS.TEAM_COLLABORATION,
292592
+ [LEGACY_ENTITLEMENTS.TEAM_PROVENANCE_INSIGHTS]: ENTITLEMENTS.TEAM_COLLABORATION,
292593
+ [LEGACY_ENTITLEMENTS.TEAM_ADMIN_POLICY_ENFORCEMENT]: ENTITLEMENTS.TEAM_COLLABORATION,
292594
+ [LEGACY_ENTITLEMENTS.TEAM_AUDIT_LOG_EXPORT]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292595
+ [LEGACY_ENTITLEMENTS.TEAM_CONTEXT_ENGINE_SHARED]: ENTITLEMENTS.TEAM_COLLABORATION,
292596
+ [LEGACY_ENTITLEMENTS.TEAM_PRIORITY_QUEUE]: null,
292597
+ [LEGACY_ENTITLEMENTS.TEAM_ANALYTICS]: ENTITLEMENTS.TEAM_COLLABORATION,
292598
+ [LEGACY_ENTITLEMENTS.TEAM_SLACK_ALERTS]: null,
292599
+ [LEGACY_ENTITLEMENTS.TEAM_LEADERBOARDS]: null,
292600
+ [LEGACY_ENTITLEMENTS.TEAM_BULK_INVITE]: ENTITLEMENTS.TEAM_COLLABORATION,
292601
+ [LEGACY_ENTITLEMENTS.TEAM_ROLES]: ENTITLEMENTS.TEAM_COLLABORATION,
292602
+ [LEGACY_ENTITLEMENTS.TEAM_SCAN_BUDGETS]: null,
292688
292603
  // ── Enterprise keys ─────────────────────────────────────────────────────
292689
- [ENTITLEMENTS.COMPLIANCE_SOC2]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292690
- [ENTITLEMENTS.COMPLIANCE_HIPAA]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292691
- [ENTITLEMENTS.COMPLIANCE_PCI_DSS]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292692
- [ENTITLEMENTS.COMPLIANCE_GDPR]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292693
- [ENTITLEMENTS.COMPLIANCE_ISO27001]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292694
- [ENTITLEMENTS.SDK_GENERATOR]: null,
292695
- // SDK gen culled
292696
- [ENTITLEMENTS.POLICY_ENGINE]: null,
292697
- // Part of context_engine
292698
- [ENTITLEMENTS.SSO_SAML]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292699
- [ENTITLEMENTS.ON_PREMISE]: null,
292700
- // On-premise not offered
292701
- [ENTITLEMENTS.DEDICATED_SLA]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292702
- [ENTITLEMENTS.COMMIT_SHIELD_TEAM]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292703
- [ENTITLEMENTS.COMMIT_SHIELD_ENTERPRISE]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292704
- [ENTITLEMENTS.COMMIT_SHIELD_COMPLIANCE]: ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE,
292705
- [ENTITLEMENTS.ENTERPRISE_MULTI_REPO]: ENTITLEMENTS_V2.TEAM_COLLABORATION,
292706
- [ENTITLEMENTS.ENTERPRISE_SIGNED_BUNDLES]: null
292707
- // Not implemented
292604
+ [LEGACY_ENTITLEMENTS.COMPLIANCE_SOC2]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292605
+ [LEGACY_ENTITLEMENTS.COMPLIANCE_HIPAA]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292606
+ [LEGACY_ENTITLEMENTS.COMPLIANCE_PCI_DSS]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292607
+ [LEGACY_ENTITLEMENTS.COMPLIANCE_GDPR]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292608
+ [LEGACY_ENTITLEMENTS.COMPLIANCE_ISO27001]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292609
+ [LEGACY_ENTITLEMENTS.SDK_GENERATOR]: null,
292610
+ [LEGACY_ENTITLEMENTS.POLICY_ENGINE]: null,
292611
+ [LEGACY_ENTITLEMENTS.SSO_SAML]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292612
+ [LEGACY_ENTITLEMENTS.ON_PREMISE]: null,
292613
+ [LEGACY_ENTITLEMENTS.DEDICATED_SLA]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292614
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_TEAM]: ENTITLEMENTS.TEAM_COLLABORATION,
292615
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_ENTERPRISE]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292616
+ [LEGACY_ENTITLEMENTS.COMMIT_SHIELD_COMPLIANCE]: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292617
+ [LEGACY_ENTITLEMENTS.ENTERPRISE_MULTI_REPO]: ENTITLEMENTS.TEAM_COLLABORATION,
292618
+ [LEGACY_ENTITLEMENTS.ENTERPRISE_SIGNED_BUNDLES]: null
292708
292619
  };
292709
- var V2_FREE_SET = /* @__PURE__ */ new Set([
292710
- ENTITLEMENTS_V2.SCAN,
292711
- ENTITLEMENTS_V2.SCAN_WORKSPACE
292712
- ]);
292713
- var V2_PRO_SET = /* @__PURE__ */ new Set([
292714
- ...V2_FREE_SET,
292715
- ENTITLEMENTS_V2.GITHUB_ACTION,
292716
- ENTITLEMENTS_V2.FULL_EVIDENCE,
292717
- ENTITLEMENTS_V2.SARIF_EXPORT,
292718
- ENTITLEMENTS_V2.API_ACCESS,
292719
- ENTITLEMENTS_V2.PRIORITY_ENGINES,
292720
- ENTITLEMENTS_V2.ADVANCED_REPORT,
292721
- ENTITLEMENTS_V2.AUTOFIX,
292722
- ENTITLEMENTS_V2.CI_BLOCK,
292723
- ENTITLEMENTS_V2.CONTEXT_ENGINE,
292724
- ENTITLEMENTS_V2.SANDBOX,
292725
- ENTITLEMENTS_V2.SUPPORT
292726
- ]);
292727
- var V2_TEAM_SET = /* @__PURE__ */ new Set([
292728
- ...V2_PRO_SET,
292729
- ENTITLEMENTS_V2.TEAM_COLLABORATION
292730
- ]);
292731
- var V2_ENTERPRISE_SET = /* @__PURE__ */ new Set([
292732
- ...V2_TEAM_SET,
292733
- ENTITLEMENTS_V2.ENTERPRISE_COMPLIANCE
292734
- ]);
292735
292620
  var FEATURE_REGISTRY = {
292736
292621
  "Unlimited Auto-Fix": {
292737
- entitlement: ENTITLEMENTS.AUTOFIX_UNLIMITED,
292622
+ entitlement: ENTITLEMENTS.AUTOFIX,
292738
292623
  title: "Unlimited Auto-Fix",
292739
292624
  subtitle: "AI-powered code repair without limits",
292740
292625
  benefits: ["No monthly limits", "Smart suggestions", "Safe rollback"],
@@ -292743,7 +292628,7 @@ var FEATURE_REGISTRY = {
292743
292628
  upgradeMessage: "Auto-Fix requires Pro. Upgrade to unlock AI-powered code repair."
292744
292629
  },
292745
292630
  "Reality Mode": {
292746
- entitlement: ENTITLEMENTS.REALITY_MODE,
292631
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
292747
292632
  title: "Reality Mode",
292748
292633
  subtitle: "Browser-based runtime verification",
292749
292634
  benefits: ["Runtime testing", "Screenshot evidence", "Error detection", "Network validation"],
@@ -292753,7 +292638,7 @@ var FEATURE_REGISTRY = {
292753
292638
  docsUrl: "/docs/reality-mode"
292754
292639
  },
292755
292640
  "CommitShield": {
292756
- entitlement: ENTITLEMENTS.COMMIT_SHIELD_FULL,
292641
+ entitlement: ENTITLEMENTS.CI_BLOCK,
292757
292642
  title: "CommitShield",
292758
292643
  subtitle: "Pre-commit quality gate",
292759
292644
  benefits: ["25+ security rules", "Risk scoring", "Evidence bundles"],
@@ -292762,7 +292647,7 @@ var FEATURE_REGISTRY = {
292762
292647
  },
292763
292648
  /** CLI `vibecheck guard` — operator tooling (Pro). */
292764
292649
  "Guard": {
292765
- entitlement: ENTITLEMENTS.COMMIT_SHIELD_FULL,
292650
+ entitlement: ENTITLEMENTS.CI_BLOCK,
292766
292651
  title: "Guard",
292767
292652
  subtitle: "Quality gate & policy enforcement from the CLI",
292768
292653
  benefits: ["Configurable fail thresholds", "Engine toggles", "CI-friendly output"],
@@ -292771,7 +292656,7 @@ var FEATURE_REGISTRY = {
292771
292656
  },
292772
292657
  /** CLI `vibecheck doctor` — engine / workspace diagnostics (Free). */
292773
292658
  "Doctor": {
292774
- entitlement: ENTITLEMENTS.DOCTOR,
292659
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292775
292660
  title: "Doctor",
292776
292661
  subtitle: "Engine health and workspace diagnostics",
292777
292662
  benefits: ["Engine readiness", "Config validation", "Optional repair flows"],
@@ -292780,7 +292665,7 @@ var FEATURE_REGISTRY = {
292780
292665
  },
292781
292666
  /** Truthpack generation / validation — free tier (local CLI + IDE viewer). */
292782
292667
  Truthpack: {
292783
- entitlement: ENTITLEMENTS.TRUTHPACK_GENERATE,
292668
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292784
292669
  title: "Truthpack",
292785
292670
  subtitle: "Ground-truth artifacts for your repo",
292786
292671
  benefits: ["Regenerate truthpack", "Cross-reference validation", "CI contracts"],
@@ -292789,7 +292674,7 @@ var FEATURE_REGISTRY = {
292789
292674
  },
292790
292675
  /** CLI `vibecheck roast` — stylized scan output (free for everyone; no login on CLI). */
292791
292676
  Roast: {
292792
- entitlement: ENTITLEMENTS.SCAN_BASIC,
292677
+ entitlement: ENTITLEMENTS.SCAN,
292793
292678
  title: "Roast",
292794
292679
  subtitle: "Scan findings with editorial voice",
292795
292680
  benefits: [
@@ -292804,7 +292689,7 @@ var FEATURE_REGISTRY = {
292804
292689
  },
292805
292690
  /** CLI code graph / intent context that builds on local graph (free tier). */
292806
292691
  "Code Graph": {
292807
- entitlement: ENTITLEMENTS.SCAN_BASIC,
292692
+ entitlement: ENTITLEMENTS.SCAN,
292808
292693
  title: "Code Graph",
292809
292694
  subtitle: "Local dependency and symbol graph",
292810
292695
  benefits: ["Import/export map", "Intent search", "Proactive file context"],
@@ -292813,7 +292698,7 @@ var FEATURE_REGISTRY = {
292813
292698
  },
292814
292699
  /** Ship / verify workflows from CLI (Pro). */
292815
292700
  "Ship Verification": {
292816
- entitlement: ENTITLEMENTS.CERTIFY,
292701
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
292817
292702
  title: "Ship Verification",
292818
292703
  subtitle: "Checklists, reports, and ship gates",
292819
292704
  benefits: ["Structured ship checks", "Evidence-friendly output"],
@@ -292821,7 +292706,7 @@ var FEATURE_REGISTRY = {
292821
292706
  category: "productivity"
292822
292707
  },
292823
292708
  "Firewall Enforce": {
292824
- entitlement: ENTITLEMENTS.FIREWALL_ENFORCE,
292709
+ entitlement: ENTITLEMENTS.CI_BLOCK,
292825
292710
  title: "Firewall Enforce",
292826
292711
  subtitle: "Block AI mistakes before save",
292827
292712
  benefits: ["Pre-save validation", "Intent locking", "Drift prevention"],
@@ -292830,7 +292715,7 @@ var FEATURE_REGISTRY = {
292830
292715
  docsUrl: "/docs/firewall"
292831
292716
  },
292832
292717
  "Cloud Sync": {
292833
- entitlement: ENTITLEMENTS.CLOUD_SYNC,
292718
+ entitlement: ENTITLEMENTS.SUPPORT,
292834
292719
  title: "Cloud Sync",
292835
292720
  subtitle: "Cross-device synchronization",
292836
292721
  benefits: ["Multi-device access", "Team sharing", "Automatic backup"],
@@ -292838,7 +292723,7 @@ var FEATURE_REGISTRY = {
292838
292723
  category: "productivity"
292839
292724
  },
292840
292725
  "PDF Reports": {
292841
- entitlement: ENTITLEMENTS.REPORTS_PDF,
292726
+ entitlement: ENTITLEMENTS.SCAN,
292842
292727
  title: "PDF Reports",
292843
292728
  subtitle: "Professional shareable reports",
292844
292729
  benefits: ["Executive summaries", "Custom branding", "Print-ready"],
@@ -292846,7 +292731,7 @@ var FEATURE_REGISTRY = {
292846
292731
  category: "productivity"
292847
292732
  },
292848
292733
  "Verified Badge": {
292849
- entitlement: ENTITLEMENTS.BADGE_VERIFIED,
292734
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
292850
292735
  title: "Verified Ship Badge",
292851
292736
  subtitle: "Dynamic ship badges for your README",
292852
292737
  benefits: ["Live status", "README embeds", "Trust signals"],
@@ -292854,7 +292739,7 @@ var FEATURE_REGISTRY = {
292854
292739
  category: "productivity"
292855
292740
  },
292856
292741
  "Vibe Prompt": {
292857
- entitlement: ENTITLEMENTS.VIBE_PROMPT,
292742
+ entitlement: ENTITLEMENTS.AUTOFIX,
292858
292743
  title: "Vibe Prompt",
292859
292744
  subtitle: "Generate prompt packs from intent",
292860
292745
  benefits: ["Truth-pack aware", "Implementation prompts", "Verification prompts"],
@@ -292863,7 +292748,7 @@ var FEATURE_REGISTRY = {
292863
292748
  upgradeMessage: "Vibe Prompt requires Pro. Upgrade to generate project-aware prompt packs."
292864
292749
  },
292865
292750
  "Review Workflows": {
292866
- entitlement: ENTITLEMENTS.REVIEW_WORKFLOWS,
292751
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292867
292752
  title: "Review Workflows",
292868
292753
  subtitle: "Code review workflows for Cursor/Claude",
292869
292754
  benefits: ["Copy to clipboard", "Install agents", "Workflow templates"],
@@ -292871,7 +292756,7 @@ var FEATURE_REGISTRY = {
292871
292756
  category: "productivity"
292872
292757
  },
292873
292758
  "Flow Workflows": {
292874
- entitlement: ENTITLEMENTS.FLOW_WORKFLOWS,
292759
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292875
292760
  title: "Flow Workflows",
292876
292761
  subtitle: "AI workflows panel",
292877
292762
  benefits: ["Copy workflows", "Agent chips", "AI automation"],
@@ -292879,7 +292764,7 @@ var FEATURE_REGISTRY = {
292879
292764
  category: "productivity"
292880
292765
  },
292881
292766
  "WikiCode Atlas": {
292882
- entitlement: ENTITLEMENTS.ATLAS,
292767
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292883
292768
  title: "WikiCode Atlas",
292884
292769
  subtitle: "Code atlas and wiki",
292885
292770
  benefits: ["Browse codebase", "Feature mapping", "Documentation"],
@@ -292891,17 +292776,17 @@ var FEATURE_REGISTRY = {
292891
292776
  * Pro+ unlimited. Use getAccessMode + getLimitForFeature — not canAccessFeature alone.
292892
292777
  */
292893
292778
  "Guided Route": {
292894
- entitlement: ENTITLEMENTS.WIKICODE_VIEW,
292779
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292895
292780
  title: "Guided Route (LLM)",
292896
292781
  subtitle: "Intent-driven tour with AI-ordered stops",
292897
292782
  benefits: ["Hybrid search + call graph context", "Next/prev stops", "Follow-up Q&A on each stop"],
292898
292783
  requiredPlan: "pro",
292899
292784
  category: "analysis",
292900
292785
  freeTasteLimit: "guidedRoute",
292901
- upgradeMessage: "You have used today\u2019s free guided routes. Upgrade to Pro for unlimited LLM routes and follow-ups."
292786
+ upgradeMessage: "You have used today's free guided routes. Upgrade to Pro for unlimited LLM routes and follow-ups."
292902
292787
  },
292903
292788
  "Proof History": {
292904
- entitlement: ENTITLEMENTS.PROOF_VIEW,
292789
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
292905
292790
  title: "Proof History",
292906
292791
  subtitle: "Saved proof bundles beyond last run",
292907
292792
  benefits: ["90-day history", "Proof chains", "Audit trail"],
@@ -292910,7 +292795,7 @@ var FEATURE_REGISTRY = {
292910
292795
  upgradeMessage: "Proof History requires Pro. Upgrade for full proof history and audit trail."
292911
292796
  },
292912
292797
  "Forge": {
292913
- entitlement: ENTITLEMENTS.FORGE_BASIC,
292798
+ entitlement: ENTITLEMENTS.AUTOFIX,
292914
292799
  title: "Forge",
292915
292800
  subtitle: "AI code generation (component, api, hook, test)",
292916
292801
  benefits: ["Component generation", "API scaffolding", "Test generation"],
@@ -292928,7 +292813,7 @@ var FEATURE_REGISTRY = {
292928
292813
  upgradeMessage: "GitHub Action requires Pro. Upgrade to automate PR quality checks."
292929
292814
  },
292930
292815
  "CI Integration": {
292931
- entitlement: ENTITLEMENTS.CI_INTEGRATION,
292816
+ entitlement: ENTITLEMENTS.GITHUB_ACTION,
292932
292817
  title: "CI/CD Integration",
292933
292818
  subtitle: "All CI platforms supported",
292934
292819
  benefits: ["GitHub Actions", "GitLab CI", "CircleCI", "Jenkins"],
@@ -292957,7 +292842,7 @@ var FEATURE_REGISTRY = {
292957
292842
  upgradeMessage: "Context Engine (cloud rules & agents) requires Pro. Your local CLI `vibecheck context` command stays on Free."
292958
292843
  },
292959
292844
  "ISL Studio": {
292960
- entitlement: ENTITLEMENTS.ISL_STUDIO,
292845
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
292961
292846
  title: "ISL Studio",
292962
292847
  subtitle: "Visual spec editor & code generation",
292963
292848
  benefits: ["Visual editor", "Real-time validation", "Code generation (credit packs)"],
@@ -292965,7 +292850,7 @@ var FEATURE_REGISTRY = {
292965
292850
  category: "analysis"
292966
292851
  },
292967
292852
  "Deep Scan": {
292968
- entitlement: ENTITLEMENTS.DEEP_SCAN,
292853
+ entitlement: ENTITLEMENTS.PRIORITY_ENGINES,
292969
292854
  title: "Deep Scan",
292970
292855
  subtitle: "Advanced security analysis",
292971
292856
  benefits: ["18 production engines", "Runtime proof", "Mock detection"],
@@ -292973,7 +292858,7 @@ var FEATURE_REGISTRY = {
292973
292858
  category: "analysis"
292974
292859
  },
292975
292860
  "Drift Detection": {
292976
- entitlement: ENTITLEMENTS.DRIFT_DETECTION,
292861
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
292977
292862
  title: "Drift Detection",
292978
292863
  subtitle: "Code vs spec divergence tracking",
292979
292864
  benefits: ["Contract drift", "Intent violations", "Auto-alerts"],
@@ -292981,7 +292866,7 @@ var FEATURE_REGISTRY = {
292981
292866
  category: "analysis"
292982
292867
  },
292983
292868
  "Chaos Agent": {
292984
- entitlement: ENTITLEMENTS.CHAOS_AGENT,
292869
+ entitlement: ENTITLEMENTS.PRIORITY_ENGINES,
292985
292870
  title: "Chaos Agent",
292986
292871
  subtitle: "AI-powered bug hunting",
292987
292872
  benefits: ["Edge case discovery", "Fault injection", "Resilience testing"],
@@ -292989,7 +292874,7 @@ var FEATURE_REGISTRY = {
292989
292874
  category: "analysis"
292990
292875
  },
292991
292876
  "Team Dashboard": {
292992
- entitlement: ENTITLEMENTS.TEAM_DASHBOARD,
292877
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
292993
292878
  title: "Team Dashboard",
292994
292879
  subtitle: "Aggregate team metrics & analytics",
292995
292880
  benefits: ["Cross-member insights", "Usage tracking", "Performance trends"],
@@ -292997,7 +292882,7 @@ var FEATURE_REGISTRY = {
292997
292882
  category: "team"
292998
292883
  },
292999
292884
  "Enterprise Dashboard": {
293000
- entitlement: ENTITLEMENTS.TEAM_DASHBOARD,
292885
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293001
292886
  title: "Enterprise Dashboard",
293002
292887
  subtitle: "Org-wide visibility & governance",
293003
292888
  benefits: ["Cross-repo insights", "Policy enforcement", "Audit trails"],
@@ -293005,7 +292890,7 @@ var FEATURE_REGISTRY = {
293005
292890
  category: "team"
293006
292891
  },
293007
292892
  "Team Management": {
293008
- entitlement: ENTITLEMENTS.TEAM_COLLABORATION,
292893
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293009
292894
  title: "Team Management",
293010
292895
  subtitle: "Unlimited team members & roles",
293011
292896
  benefits: ["Role-based access", "Shared policies", "Team analytics"],
@@ -293013,7 +292898,7 @@ var FEATURE_REGISTRY = {
293013
292898
  category: "team"
293014
292899
  },
293015
292900
  "Audit Log": {
293016
- entitlement: ENTITLEMENTS.TEAM_AUDIT_LOG_EXPORT,
292901
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293017
292902
  title: "Audit Log Export",
293018
292903
  subtitle: "Compliance-ready activity records",
293019
292904
  benefits: ["CSV/JSON export", "Activity tracking", "SOC2 ready"],
@@ -293021,7 +292906,7 @@ var FEATURE_REGISTRY = {
293021
292906
  category: "compliance"
293022
292907
  },
293023
292908
  "Multi-Repo": {
293024
- entitlement: ENTITLEMENTS.ENTERPRISE_MULTI_REPO,
292909
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293025
292910
  title: "Multi-Repo Scanning",
293026
292911
  subtitle: "Unified view across repositories",
293027
292912
  benefits: ["Aggregate metrics", "Cross-project drift", "Org-wide insights"],
@@ -293029,7 +292914,7 @@ var FEATURE_REGISTRY = {
293029
292914
  category: "team"
293030
292915
  },
293031
292916
  "Compliance Audit": {
293032
- entitlement: ENTITLEMENTS.COMPLIANCE_SOC2,
292917
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293033
292918
  title: "Compliance Audit",
293034
292919
  subtitle: "SOC2, HIPAA, PCI-DSS, GDPR, ISO27001",
293035
292920
  benefits: ["Pre-built rules", "Evidence collection", "Audit reports"],
@@ -293037,7 +292922,7 @@ var FEATURE_REGISTRY = {
293037
292922
  category: "compliance"
293038
292923
  },
293039
292924
  "SDK Generator": {
293040
- entitlement: ENTITLEMENTS.SDK_GENERATOR,
292925
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293041
292926
  title: "SDK Generator",
293042
292927
  subtitle: "Multi-language SDK generation",
293043
292928
  benefits: ["TypeScript, Python, Go, Rust", "Type-safe clients", "Auto-updated"],
@@ -293045,7 +292930,7 @@ var FEATURE_REGISTRY = {
293045
292930
  category: "compliance"
293046
292931
  },
293047
292932
  "Policy Engine": {
293048
- entitlement: ENTITLEMENTS.POLICY_ENGINE,
292933
+ entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE,
293049
292934
  title: "Policy Engine",
293050
292935
  subtitle: "Policy-as-code evaluation",
293051
292936
  benefits: ["YAML/JSON policies", "Violation detection", "Team enforcement"],
@@ -293053,7 +292938,7 @@ var FEATURE_REGISTRY = {
293053
292938
  category: "compliance"
293054
292939
  },
293055
292940
  "Polish": {
293056
- entitlement: ENTITLEMENTS.AUTOFIX_UNLIMITED,
292941
+ entitlement: ENTITLEMENTS.AUTOFIX,
293057
292942
  title: "Polish",
293058
292943
  subtitle: "Enterprise-grade code quality engine",
293059
292944
  benefits: ["Code quality scoring", "Complexity analysis", "Trend tracking"],
@@ -293061,7 +292946,7 @@ var FEATURE_REGISTRY = {
293061
292946
  category: "productivity"
293062
292947
  },
293063
292948
  "DocGuard": {
293064
- entitlement: ENTITLEMENTS.COMMIT_SHIELD_FULL,
292949
+ entitlement: ENTITLEMENTS.CI_BLOCK,
293065
292950
  title: "DocGuard",
293066
292951
  subtitle: "Documentation quality enforcement",
293067
292952
  benefits: ["JSDoc validation", "Coverage tracking", "Stale doc detection"],
@@ -293069,7 +292954,7 @@ var FEATURE_REGISTRY = {
293069
292954
  category: "productivity"
293070
292955
  },
293071
292956
  "TestGap": {
293072
- entitlement: ENTITLEMENTS.DEEP_SCAN,
292957
+ entitlement: ENTITLEMENTS.PRIORITY_ENGINES,
293073
292958
  title: "TestGap Analysis",
293074
292959
  subtitle: "Test coverage gap detection",
293075
292960
  benefits: ["Zero coverage detection", "Happy path analysis", "Orphaned test detection"],
@@ -293077,7 +292962,7 @@ var FEATURE_REGISTRY = {
293077
292962
  category: "analysis"
293078
292963
  },
293079
292964
  "ArchRules": {
293080
- entitlement: ENTITLEMENTS.DEEP_SCAN,
292965
+ entitlement: ENTITLEMENTS.PRIORITY_ENGINES,
293081
292966
  title: "Architecture Rules",
293082
292967
  subtitle: "Enforce architectural patterns",
293083
292968
  benefits: ["YAML rule config", "6 rule types", "Violation detection"],
@@ -293085,7 +292970,7 @@ var FEATURE_REGISTRY = {
293085
292970
  category: "analysis"
293086
292971
  },
293087
292972
  "Provenance": {
293088
- entitlement: ENTITLEMENTS.PROVENANCE_TRACKING,
292973
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
293089
292974
  title: "Provenance Tracking",
293090
292975
  subtitle: "Edit history and attestations",
293091
292976
  benefits: ["Edit tracking", "Attestation DB", "Audit trail"],
@@ -293093,7 +292978,7 @@ var FEATURE_REGISTRY = {
293093
292978
  category: "compliance"
293094
292979
  },
293095
292980
  "Model Fingerprint": {
293096
- entitlement: ENTITLEMENTS.MODEL_FINGERPRINT,
292981
+ entitlement: ENTITLEMENTS.FULL_EVIDENCE,
293097
292982
  title: "Model Fingerprint",
293098
292983
  subtitle: "AI model detection and tracking",
293099
292984
  benefits: ["Model identification", "Version tracking", "Usage analytics"],
@@ -293102,7 +292987,7 @@ var FEATURE_REGISTRY = {
293102
292987
  },
293103
292988
  /** Kickoff / connect project (Free). */
293104
292989
  "Kickoff Connect": {
293105
- entitlement: ENTITLEMENTS.KICKOFF_CONNECT,
292990
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
293106
292991
  title: "Kickoff & Connect",
293107
292992
  subtitle: "Initialize and connect your project",
293108
292993
  benefits: ["Project scaffolding", "Config generation", "Quick start"],
@@ -293111,7 +292996,7 @@ var FEATURE_REGISTRY = {
293111
292996
  },
293112
292997
  /** Codegraph — local dependency/symbol graph (Free). */
293113
292998
  "Codegraph": {
293114
- entitlement: ENTITLEMENTS.CODEGRAPH_VIEW,
292999
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
293115
293000
  title: "Codegraph",
293116
293001
  subtitle: "Local dependency and symbol graph",
293117
293002
  benefits: ["Import/export map", "Symbol navigation", "Dependency visualization"],
@@ -293120,7 +293005,7 @@ var FEATURE_REGISTRY = {
293120
293005
  },
293121
293006
  /** WikiCode — codebase wiki and atlas (Free). */
293122
293007
  "WikiCode": {
293123
- entitlement: ENTITLEMENTS.WIKICODE_VIEW,
293008
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
293124
293009
  title: "WikiCode",
293125
293010
  subtitle: "Codebase wiki and documentation",
293126
293011
  benefits: ["Browse codebase", "Feature mapping", "Documentation"],
@@ -293129,7 +293014,7 @@ var FEATURE_REGISTRY = {
293129
293014
  },
293130
293015
  /** Vibe Flow — AI workflows panel (Free). */
293131
293016
  "Vibe Flow": {
293132
- entitlement: ENTITLEMENTS.VIBE_FLOW,
293017
+ entitlement: ENTITLEMENTS.SCAN_WORKSPACE,
293133
293018
  title: "Vibe Flow",
293134
293019
  subtitle: "AI workflow automation",
293135
293020
  benefits: ["Workflow templates", "Agent chips", "AI automation"],
@@ -293265,6 +293150,74 @@ var FEATURE_NAMES = {
293265
293150
  SDK_GENERATOR: "SDK Generator",
293266
293151
  COMPLIANCE_AUDIT: "Compliance Audit"
293267
293152
  };
293153
+ var DEFAULT_API_BASE_URL = "https://api.vibecheckai.dev";
293154
+ function isRecord(value) {
293155
+ return typeof value === "object" && value !== null && !Array.isArray(value);
293156
+ }
293157
+ function getCanonicalAccessUrl(apiBaseUrl2) {
293158
+ const baseUrl = (apiBaseUrl2 || DEFAULT_API_BASE_URL).replace(/\/+$/, "");
293159
+ return baseUrl.endsWith("/api/v1") ? `${baseUrl}/me/access` : `${baseUrl}/api/v1/me/access`;
293160
+ }
293161
+ function buildPlatformAuthHeaders(token, headers) {
293162
+ const merged = new Headers(headers);
293163
+ if (!merged.has("Accept")) {
293164
+ merged.set("Accept", "application/json");
293165
+ }
293166
+ const trimmedToken = token?.trim();
293167
+ if (!trimmedToken) {
293168
+ return merged;
293169
+ }
293170
+ if (trimmedToken.startsWith("vc_")) {
293171
+ merged.set("X-API-Key", trimmedToken);
293172
+ merged.delete("Authorization");
293173
+ return merged;
293174
+ }
293175
+ if (!merged.has("Authorization")) {
293176
+ merged.set("Authorization", `Bearer ${trimmedToken}`);
293177
+ }
293178
+ return merged;
293179
+ }
293180
+ function coerceCanonicalAccessResponse(value) {
293181
+ const payload = isRecord(value) && isRecord(value.data) ? value.data : value;
293182
+ if (!isRecord(payload) || typeof payload.plan !== "string") {
293183
+ return null;
293184
+ }
293185
+ return {
293186
+ ...payload,
293187
+ plan: normalizePlanId(payload.plan)
293188
+ };
293189
+ }
293190
+ async function fetchCanonicalAccess(options = {}) {
293191
+ const fetchImpl = options.fetchImpl ?? fetch;
293192
+ const response = await fetchImpl(getCanonicalAccessUrl(options.apiBaseUrl), {
293193
+ headers: buildPlatformAuthHeaders(options.token, options.headers),
293194
+ signal: options.signal,
293195
+ credentials: options.credentials
293196
+ });
293197
+ if (!response.ok) {
293198
+ return {
293199
+ ok: false,
293200
+ status: response.status,
293201
+ data: null
293202
+ };
293203
+ }
293204
+ let json;
293205
+ try {
293206
+ json = await response.json();
293207
+ } catch {
293208
+ return {
293209
+ ok: false,
293210
+ status: response.status,
293211
+ data: null
293212
+ };
293213
+ }
293214
+ const data = coerceCanonicalAccessResponse(json);
293215
+ return {
293216
+ ok: data !== null,
293217
+ status: response.status,
293218
+ data
293219
+ };
293220
+ }
293268
293221
  var CLI_COMMAND_MIN_PLAN = {
293269
293222
  scan: "free",
293270
293223
  score: "free",
@@ -293298,19 +293251,19 @@ var CLI_COMMAND_MIN_PLAN_LOWER = Object.fromEntries(
293298
293251
  Object.entries(CLI_COMMAND_MIN_PLAN).map(([k, v]) => [k.toLowerCase(), v])
293299
293252
  );
293300
293253
  var API_SURFACE_RULES = {
293301
- ship_proof: { kind: "entitlement", entitlement: ENTITLEMENTS.CERTIFY },
293302
- reality_mode: { kind: "entitlement", entitlement: ENTITLEMENTS.REALITY_MODE },
293303
- autofix: { kind: "entitlement", entitlement: ENTITLEMENTS.AUTOFIX_UNLIMITED },
293304
- isl_studio: { kind: "entitlement", entitlement: ENTITLEMENTS.ISL_STUDIO },
293305
- sandbox: { kind: "entitlement", entitlement: ENTITLEMENTS.SANDBOX_ACCESS },
293306
- commit_shield: { kind: "entitlement", entitlement: ENTITLEMENTS.COMMIT_SHIELD_FULL },
293254
+ ship_proof: { kind: "entitlement", entitlement: ENTITLEMENTS.FULL_EVIDENCE },
293255
+ reality_mode: { kind: "entitlement", entitlement: ENTITLEMENTS.FULL_EVIDENCE },
293256
+ autofix: { kind: "entitlement", entitlement: ENTITLEMENTS.AUTOFIX },
293257
+ isl_studio: { kind: "entitlement", entitlement: ENTITLEMENTS.SCAN_WORKSPACE },
293258
+ sandbox: { kind: "entitlement", entitlement: ENTITLEMENTS.SANDBOX },
293259
+ commit_shield: { kind: "entitlement", entitlement: ENTITLEMENTS.CI_BLOCK },
293307
293260
  context_engine: { kind: "entitlement", entitlement: ENTITLEMENTS.CONTEXT_ENGINE },
293308
- firewall: { kind: "entitlement", entitlement: ENTITLEMENTS.FIREWALL_ENFORCE },
293309
- cloud_sync: { kind: "entitlement", entitlement: ENTITLEMENTS.CLOUD_SYNC },
293310
- custom_policies: { kind: "entitlement", entitlement: ENTITLEMENTS.POLICY_ENGINE },
293311
- sso: { kind: "entitlement", entitlement: ENTITLEMENTS.SSO_SAML },
293312
- audit_logs: { kind: "entitlement", entitlement: ENTITLEMENTS.TEAM_AUDIT_LOG_EXPORT },
293313
- team_dashboard: { kind: "entitlement", entitlement: ENTITLEMENTS.TEAM_DASHBOARD },
293261
+ firewall: { kind: "entitlement", entitlement: ENTITLEMENTS.CI_BLOCK },
293262
+ cloud_sync: { kind: "entitlement", entitlement: ENTITLEMENTS.SUPPORT },
293263
+ custom_policies: { kind: "entitlement", entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE },
293264
+ sso: { kind: "entitlement", entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE },
293265
+ audit_logs: { kind: "entitlement", entitlement: ENTITLEMENTS.ENTERPRISE_COMPLIANCE },
293266
+ team_dashboard: { kind: "entitlement", entitlement: ENTITLEMENTS.TEAM_COLLABORATION },
293314
293267
  csv_export: { kind: "quota", satisfies: (q) => q.canExportCSV }
293315
293268
  };
293316
293269
  function minPlanForQuotaRule(satisfies) {
@@ -293369,6 +293322,16 @@ var INTRO_PRICES = {
293369
293322
  team: "$4.99",
293370
293323
  enterprise: "$14.99"
293371
293324
  };
293325
+ function formatFindingSeverityBreakdown(summary) {
293326
+ const parts2 = [`${summary.total} total`];
293327
+ if (summary.critical > 0) parts2.push(`${summary.critical} critical`);
293328
+ if (summary.high > 0) parts2.push(`${summary.high} high`);
293329
+ if (summary.medium > 0) parts2.push(`${summary.medium} medium`);
293330
+ if (summary.low > 0) parts2.push(`${summary.low} low`);
293331
+ if (summary.info > 0) parts2.push(`${summary.info} info`);
293332
+ if (summary.other > 0) parts2.push(`${summary.other} other`);
293333
+ return parts2.join(" \xB7 ");
293334
+ }
293372
293335
  function buildCliUpgradeBlock(featureName, currentPlan) {
293373
293336
  const target = getUpgradeTarget(currentPlan, featureName);
293374
293337
  if (!target) return "";
@@ -293386,12 +293349,66 @@ function buildCliUpgradeBlock(featureName, currentPlan) {
293386
293349
  }
293387
293350
  lines.push(
293388
293351
  "",
293389
- " Upgrade: https://vibecheckai.dev/checkout?plan=pro",
293352
+ ` Upgrade: ${getPricingPageUrl("pro")}`,
293390
293353
  " Or run: vibecheck auth upgrade",
293391
293354
  ""
293392
293355
  );
293393
293356
  return lines.join("\n");
293394
293357
  }
293358
+ function getPricingPageUrl(highlightPlan) {
293359
+ const canonicalPlan = highlightPlan ? normalizePlanId(highlightPlan) : "pro";
293360
+ const target = canonicalPlan === "free" ? "pro" : canonicalPlan;
293361
+ return `https://vibecheckai.dev/pricing?plan=${target}`;
293362
+ }
293363
+ function buildGatedScanResponse(opts) {
293364
+ const plan = normalizePlanId(opts.plan);
293365
+ const limit = getQuotas(plan).findingDetailLimit;
293366
+ const isFree = plan === "free";
293367
+ const isGated = isFree && limit <= 0 && opts.findings.length > 0;
293368
+ const severitySummary = {
293369
+ total: opts.summary.total,
293370
+ critical: opts.summary.critical,
293371
+ high: opts.summary.high,
293372
+ medium: opts.summary.medium,
293373
+ low: opts.summary.low,
293374
+ info: opts.summary.info ?? 0,
293375
+ other: 0
293376
+ };
293377
+ if (!isGated) {
293378
+ return {
293379
+ gated: false,
293380
+ plan,
293381
+ summary: severitySummary,
293382
+ healthScore: opts.healthScore,
293383
+ verdict: opts.verdict,
293384
+ findings: opts.findings,
293385
+ upgrade: null
293386
+ };
293387
+ }
293388
+ const gatedFindings = opts.findings.map((f) => ({
293389
+ severity: String(f.severity ?? "info"),
293390
+ engine: f.engine,
293391
+ category: f.category,
293392
+ ruleId: f.ruleId,
293393
+ _gated: true,
293394
+ _upgradeMessage: "Upgrade to Pro to see the full error details, location, and fix suggestion.",
293395
+ _upgradeUrl: getPricingPageUrl("pro")
293396
+ }));
293397
+ return {
293398
+ gated: true,
293399
+ plan,
293400
+ summary: severitySummary,
293401
+ healthScore: opts.healthScore,
293402
+ verdict: opts.verdict,
293403
+ findings: gatedFindings,
293404
+ upgrade: {
293405
+ show: true,
293406
+ message: `${opts.summary.total} issues found (${opts.summary.critical} critical, ${opts.summary.high} high, ${opts.summary.medium} medium). Upgrade to Pro to see every error with location, explanation, and fix suggestion.`,
293407
+ url: getPricingPageUrl("pro"),
293408
+ buttonLabel: "Upgrade to Pro"
293409
+ }
293410
+ };
293411
+ }
293395
293412
 
293396
293413
  // src/plan-resolver.ts
293397
293414
  var MCPAuthRequiredError = class extends Error {
@@ -293403,13 +293420,9 @@ var MCPAuthRequiredError = class extends Error {
293403
293420
  this.name = "MCPAuthRequiredError";
293404
293421
  }
293405
293422
  };
293406
- var DEFAULT_API_BASE_URL = "https://api.vibecheckai.dev";
293423
+ var DEFAULT_API_BASE_URL2 = "https://api.vibecheckai.dev";
293407
293424
  function getApiBaseUrl() {
293408
- return (process.env.VIBECHECK_API_URL || DEFAULT_API_BASE_URL).replace(/\/+$/, "");
293409
- }
293410
- function getMeAccessUrl() {
293411
- const baseUrl = getApiBaseUrl();
293412
- return baseUrl.endsWith("/api/v1") ? `${baseUrl}/me/access` : `${baseUrl}/api/v1/me/access`;
293425
+ return (process.env.VIBECHECK_API_URL || DEFAULT_API_BASE_URL2).replace(/\/+$/, "");
293413
293426
  }
293414
293427
  async function resolveUserPlan() {
293415
293428
  const resolved = await resolveUser();
@@ -293429,18 +293442,16 @@ async function resolveUser() {
293429
293442
  throw new MCPAuthRequiredError();
293430
293443
  }
293431
293444
  try {
293432
- const response = await fetch(getMeAccessUrl(), {
293433
- headers: {
293434
- Authorization: `Bearer ${token}`
293435
- },
293445
+ const response = await fetchCanonicalAccess({
293446
+ apiBaseUrl: getApiBaseUrl(),
293447
+ token,
293436
293448
  signal: AbortSignal.timeout(1e4)
293437
293449
  });
293438
- if (!response.ok) {
293450
+ if (!response.ok || !response.data) {
293439
293451
  throw new MCPAuthRequiredError();
293440
293452
  }
293441
- const payload = await response.json();
293442
- const rawPlan = payload.data?.plan;
293443
- const userId = payload.data?.user?.id ?? null;
293453
+ const rawPlan = response.data.plan;
293454
+ const userId = response.data.user?.id ?? null;
293444
293455
  return {
293445
293456
  plan: rawPlan ? normalizePlanId(rawPlan) : "free",
293446
293457
  userId,
@@ -293935,7 +293946,17 @@ var TOOL_FEATURE_MAP = {
293935
293946
  vibecheck_context_proactive: FEATURE_NAMES.CONTEXT_ENGINE,
293936
293947
  vibecheck_context_intent: FEATURE_NAMES.CONTEXT_ENGINE,
293937
293948
  vibecheck_context_evolve: FEATURE_NAMES.CONTEXT_ENGINE,
293938
- vibecheck_context_feedback: FEATURE_NAMES.CONTEXT_ENGINE
293949
+ vibecheck_context_feedback: FEATURE_NAMES.CONTEXT_ENGINE,
293950
+ vibecheck_forge: FEATURE_NAMES.FORGE_BASIC,
293951
+ vibecheck_reality: FEATURE_NAMES.REALITY_MODE,
293952
+ vibecheck_ship: FEATURE_NAMES.VERIFIED_BADGE,
293953
+ vibecheck_firewall: FEATURE_NAMES.FIREWALL_ENFORCE,
293954
+ vibecheck_isl: FEATURE_NAMES.ISL_STUDIO,
293955
+ vibecheck_docguard: FEATURE_NAMES.DOCGUARD,
293956
+ vibecheck_commitshield: FEATURE_NAMES.COMMIT_SHIELD,
293957
+ vibecheck_polish: FEATURE_NAMES.POLISH,
293958
+ vibecheck_truthpack: "Truthpack",
293959
+ vibecheck_review: FEATURE_NAMES.COMMIT_SHIELD
293939
293960
  };
293940
293961
  function getToolApiSurface(toolName) {
293941
293962
  return TOOL_API_SURFACE_MAP[toolName];
@@ -294056,6 +294077,160 @@ var MCP_TOOLS = [
294056
294077
  }
294057
294078
  }
294058
294079
  }
294080
+ },
294081
+ {
294082
+ name: "vibecheck_forge",
294083
+ description: "Scaffolding for components, APIs, hooks, and tests.",
294084
+ inputSchema: {
294085
+ type: "object",
294086
+ properties: {
294087
+ path: { type: "string", description: "Destination path." },
294088
+ type: { type: "string", enum: ["component", "api", "hook", "test"], description: "Type of code to forge." },
294089
+ name: { type: "string", description: "Name of the component/api/hook." }
294090
+ },
294091
+ required: ["type", "name"]
294092
+ }
294093
+ },
294094
+ {
294095
+ name: "vibecheck_reality",
294096
+ description: "Runtime health checks (homepage, links, API health, mixed-content).",
294097
+ inputSchema: {
294098
+ type: "object",
294099
+ properties: {
294100
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." },
294101
+ targetUrl: { type: "string", description: "Base URL to test." }
294102
+ }
294103
+ }
294104
+ },
294105
+ {
294106
+ name: "vibecheck_ship",
294107
+ description: "Runs a 16-point pre-deployment readiness checklist.",
294108
+ inputSchema: {
294109
+ type: "object",
294110
+ properties: {
294111
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294112
+ }
294113
+ }
294114
+ },
294115
+ {
294116
+ name: "vibecheck_firewall",
294117
+ description: "Manage intent locking and protection management (observe, enforce, lockdown).",
294118
+ inputSchema: {
294119
+ type: "object",
294120
+ properties: {
294121
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." },
294122
+ mode: { type: "string", enum: ["enforce", "observe", "off"], description: "Firewall mode to set." }
294123
+ },
294124
+ required: ["mode"]
294125
+ }
294126
+ },
294127
+ {
294128
+ name: "vibecheck_isl",
294129
+ description: "Intent Specification Language generation and verification.",
294130
+ inputSchema: {
294131
+ type: "object",
294132
+ properties: {
294133
+ path: { type: "string", description: "Path to ISL file or project root." },
294134
+ action: { type: "string", enum: ["generate", "verify"], description: "Action to perform." }
294135
+ },
294136
+ required: ["action"]
294137
+ }
294138
+ },
294139
+ {
294140
+ name: "vibecheck_docguard",
294141
+ description: "Documentation quality analysis (orphaned, stale, or duplicate docs).",
294142
+ inputSchema: {
294143
+ type: "object",
294144
+ properties: {
294145
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294146
+ }
294147
+ }
294148
+ },
294149
+ {
294150
+ name: "vibecheck_commitshield",
294151
+ description: "Pre-commit security analysis and risk scoring.",
294152
+ inputSchema: {
294153
+ type: "object",
294154
+ properties: {
294155
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294156
+ }
294157
+ }
294158
+ },
294159
+ {
294160
+ name: "vibecheck_polish",
294161
+ description: "Project-level quality report (SEO, performance, observability).",
294162
+ inputSchema: {
294163
+ type: "object",
294164
+ properties: {
294165
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294166
+ }
294167
+ }
294168
+ },
294169
+ {
294170
+ name: "vibecheck_truthpack",
294171
+ description: "Ground-truth artifact generation (routes, env, contracts).",
294172
+ inputSchema: {
294173
+ type: "object",
294174
+ properties: {
294175
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." },
294176
+ out: { type: "string", description: "Output path for the truthpack." }
294177
+ }
294178
+ }
294179
+ },
294180
+ {
294181
+ name: "vibecheck_review",
294182
+ description: "Git-aware code review across 10 quality dimensions.",
294183
+ inputSchema: {
294184
+ type: "object",
294185
+ properties: {
294186
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." },
294187
+ branch: { type: "string", description: "Branch to compare against." }
294188
+ }
294189
+ }
294190
+ },
294191
+ {
294192
+ name: "vibecheck_report",
294193
+ description: "Generates a full codebase quality report as HTML.",
294194
+ inputSchema: {
294195
+ type: "object",
294196
+ properties: {
294197
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294198
+ }
294199
+ }
294200
+ },
294201
+ {
294202
+ name: "vibecheck_prompt_pack",
294203
+ description: "Generates an AI implementation prompt pack based on an intent.",
294204
+ inputSchema: {
294205
+ type: "object",
294206
+ properties: {
294207
+ intent: { type: "string", description: "Description of the feature to build." },
294208
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294209
+ },
294210
+ required: ["intent"]
294211
+ }
294212
+ },
294213
+ {
294214
+ name: "vibecheck_rules_list",
294215
+ description: "Lists all available custom detection rules.",
294216
+ inputSchema: {
294217
+ type: "object",
294218
+ properties: {
294219
+ path: { type: "string", description: "Workspace or project root path. Defaults to current directory." }
294220
+ }
294221
+ }
294222
+ },
294223
+ {
294224
+ name: "vibecheck_explain_file",
294225
+ description: "Gets full codebase intelligence, call graph, and git temporal stats for a file.",
294226
+ inputSchema: {
294227
+ type: "object",
294228
+ properties: {
294229
+ file: { type: "string", description: "Absolute path to the file." },
294230
+ path: { type: "string", description: "Workspace root path." }
294231
+ },
294232
+ required: ["file"]
294233
+ }
294059
294234
  }
294060
294235
  ];
294061
294236
  function isKnownToolName(toolName) {
@@ -294204,10 +294379,12 @@ function createScanIdempotencyKey(prefix) {
294204
294379
  // src/mcp-scan-meter-client.ts
294205
294380
  var MCP_SCAN_METER_CLIENT = {
294206
294381
  type: "mcp",
294207
- version: "24.4.3"
294382
+ version: "24.5.6"
294208
294383
  };
294209
294384
 
294210
294385
  // src/server.ts
294386
+ import { uploadScanToApi } from "@repo/shared/sync/upload-scan";
294387
+ var execAsync = promisify(exec);
294211
294388
  async function executeScan(targetPath, engineToggles = null) {
294212
294389
  const resolved = path9.resolve(targetPath);
294213
294390
  const stat4 = fs6.statSync(resolved);
@@ -294635,6 +294812,7 @@ ${validation.errors.join("\n")}`
294635
294812
  MCP_TOOL_TIMEOUT_MS,
294636
294813
  "vibecheck_scan"
294637
294814
  );
294815
+ const gatedReport = gateCanonicalScanReportFindings(report, userPlan);
294638
294816
  const scanRec = await recordMcpBillableUsage("mcp-scan");
294639
294817
  if (!scanRec.ok) {
294640
294818
  return buildErrorResponse(
@@ -294645,11 +294823,50 @@ ${validation.errors.join("\n")}`
294645
294823
  })
294646
294824
  );
294647
294825
  }
294826
+ const mcpToken = process.env.VIBECHECK_TOKEN?.trim();
294827
+ if (mcpToken) {
294828
+ uploadScanToApi(report, {
294829
+ token: mcpToken,
294830
+ apiBaseUrl: process.env.VIBECHECK_API_URL || "https://api.vibecheckai.dev",
294831
+ clientType: MCP_SCAN_METER_CLIENT.type,
294832
+ clientVersion: MCP_SCAN_METER_CLIENT.version,
294833
+ idempotencyKey: `mcp:${workspaceRoot}:${report.timestamp}`,
294834
+ maxRetries: 1,
294835
+ timeoutMs: 1e4
294836
+ }).catch(() => {
294837
+ });
294838
+ }
294839
+ const gatedResponse = buildGatedScanResponse({
294840
+ plan: userPlan,
294841
+ findings: gatedReport.findings,
294842
+ summary: gatedReport.summary,
294843
+ healthScore: gatedReport.summary.healthScore ?? 0,
294844
+ verdict: gatedReport.summary.verdict ?? "REVIEW"
294845
+ });
294846
+ let responseText;
294847
+ if (gatedResponse.gated) {
294848
+ const breakdown = formatFindingSeverityBreakdown(gatedResponse.summary);
294849
+ responseText = [
294850
+ `## Scan Results (Free Tier \u2014 counts only)`,
294851
+ "",
294852
+ `**${gatedResponse.summary.total} issues found** \xB7 ${breakdown}`,
294853
+ `**Health Score**: ${gatedResponse.healthScore}/100 \xB7 **Verdict**: ${gatedResponse.verdict}`,
294854
+ "",
294855
+ `> ${gatedResponse.upgrade?.message}`,
294856
+ `> Upgrade: ${gatedResponse.upgrade?.url}`,
294857
+ "",
294858
+ "```json",
294859
+ JSON.stringify(gatedResponse, null, 2),
294860
+ "```"
294861
+ ].join("\n");
294862
+ } else {
294863
+ responseText = JSON.stringify(gatedReport, null, 2);
294864
+ }
294648
294865
  return {
294649
294866
  content: [
294650
294867
  {
294651
294868
  type: "text",
294652
- text: JSON.stringify(report, null, 2)
294869
+ text: responseText
294653
294870
  }
294654
294871
  ]
294655
294872
  };
@@ -294694,6 +294911,37 @@ ${validation.errors.join("\n")}`
294694
294911
  ]
294695
294912
  };
294696
294913
  }
294914
+ case "vibecheck_forge":
294915
+ case "vibecheck_reality":
294916
+ case "vibecheck_ship":
294917
+ case "vibecheck_firewall":
294918
+ case "vibecheck_isl":
294919
+ case "vibecheck_docguard":
294920
+ case "vibecheck_commitshield":
294921
+ case "vibecheck_polish":
294922
+ case "vibecheck_truthpack":
294923
+ case "vibecheck_report":
294924
+ case "vibecheck_prompt_pack":
294925
+ case "vibecheck_rules_list":
294926
+ case "vibecheck_explain_file":
294927
+ case "vibecheck_review": {
294928
+ const cmdName = name2.replace("vibecheck_", "");
294929
+ const cliArgs = Object.entries(args2).filter(([k]) => k !== "path").map(([k, v]) => `--${k}="${String(v)}"`).join(" ");
294930
+ const workDir = targetPath || workspaceRoot;
294931
+ try {
294932
+ const { stdout, stderr } = await execAsync(`npx vibecheck ${cmdName} ${cliArgs}`, { cwd: workDir });
294933
+ return {
294934
+ content: [
294935
+ {
294936
+ type: "text",
294937
+ text: stdout || stderr || `Successfully executed ${cmdName}`
294938
+ }
294939
+ ]
294940
+ };
294941
+ } catch (error) {
294942
+ return buildErrorResponse(`CLI Execution Error: ${error.message || error.stdout || error.stderr || String(error)}`);
294943
+ }
294944
+ }
294697
294945
  default:
294698
294946
  return buildErrorResponse(`Unknown tool: ${name2}`);
294699
294947
  }