@viberaven/mcp 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -3
- package/dist/lib/cli-runner.js +126 -36
- package/dist/server.js +563 -39
- package/dist/tools/index.js +561 -38
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -30,6 +30,122 @@ var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
|
30
30
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
31
31
|
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
32
32
|
|
|
33
|
+
// ../../shared/rlsTool.ts
|
|
34
|
+
var RLS_TOOL_NAME = "viberaven_rls_test";
|
|
35
|
+
var RLS_RUN_TIMEOUT_MS = 3e5;
|
|
36
|
+
var RLS_MAX_OUTPUT_BYTES = 8 * 1024 * 1024;
|
|
37
|
+
var NON_AUTHORITATIVE_LABEL = "PGlite imitation of Supabase, non-authoritative. Scenario passed locally does not prove production.";
|
|
38
|
+
var MAX_PATH_LENGTH = 4096;
|
|
39
|
+
var RLS_TOOL = {
|
|
40
|
+
name: RLS_TOOL_NAME,
|
|
41
|
+
description: "After reviewing a Supabase migration or ownership policy, optionally execute already reviewed local permissions scenarios for owner, other_user and anon. Returns Pass, Fail or Unknown per cell with the original scoped evidence. This is an experimental PGlite imitation, not live Supabase proof. The optional PGlite dependency must already be installed next to the matching CLI used by this local MCP host; missing setup returns the CLI setup guidance as a tool error. No SQL, credentials, provider calls or dependency installation are accepted.",
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {
|
|
45
|
+
matrix: { type: "string", minLength: 1, maxLength: MAX_PATH_LENGTH, description: "Path to an already reviewed permissions JSON file, relative to cwd or absolute. Expectations must describe intended access." },
|
|
46
|
+
migrations: { type: "string", minLength: 1, maxLength: MAX_PATH_LENGTH, description: "Local migrations directory. Defaults to supabase/migrations under cwd." },
|
|
47
|
+
cwd: { type: "string", minLength: 1, maxLength: MAX_PATH_LENGTH, description: "Project root. Defaults to the MCP server working directory." }
|
|
48
|
+
},
|
|
49
|
+
required: ["matrix"],
|
|
50
|
+
additionalProperties: false
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function record(value) {
|
|
54
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
55
|
+
}
|
|
56
|
+
function nonempty(value) {
|
|
57
|
+
return typeof value === "string" && Boolean(value.trim());
|
|
58
|
+
}
|
|
59
|
+
function pathArg(value, name, commandLine = true) {
|
|
60
|
+
if (!nonempty(value) || value.length > MAX_PATH_LENGTH || /[\x00-\x1f\x7f]/.test(value)) throw Error(`Invalid RLS ${name}: expected a non-empty local path up to ${MAX_PATH_LENGTH} characters`);
|
|
61
|
+
if (commandLine && (value.trimStart().startsWith("-") || /[&|<>^%!"'`$();]/.test(value))) throw Error(`Unsafe RLS ${name} path`);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function buildRlsToolArgs(input) {
|
|
65
|
+
if (!record(input) || Object.keys(input).some((key) => !["matrix", "migrations", "cwd"].includes(key))) throw Error("Invalid RLS tool arguments: only matrix, migrations and cwd are accepted");
|
|
66
|
+
const args = ["rls-test", "--json", "--matrix", pathArg(input.matrix, "matrix")];
|
|
67
|
+
if ("migrations" in input) args.push("--migrations", pathArg(input.migrations, "migrations"));
|
|
68
|
+
if ("cwd" in input) pathArg(input.cwd, "cwd", false);
|
|
69
|
+
return args;
|
|
70
|
+
}
|
|
71
|
+
var hash = (value) => typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
|
|
72
|
+
var strings = (value) => Array.isArray(value) && value.every(nonempty);
|
|
73
|
+
var actions = ["select", "insert", "update", "delete"];
|
|
74
|
+
var actors = ["owner", "other_user", "anon"];
|
|
75
|
+
function completedReceipt(receipt, processExit) {
|
|
76
|
+
if ("error" in receipt || receipt.tool !== "viberaven rls-test" || receipt.experimental !== true || receipt.label !== NON_AUTHORITATIVE_LABEL || !nonempty(receipt.project)) return false;
|
|
77
|
+
if (![0, 1, 2].includes(processExit) || receipt.exitCode !== processExit) return false;
|
|
78
|
+
const { engine, migrations, matrix, summary, tables, roleChecks } = receipt;
|
|
79
|
+
if (!record(engine) || engine.name !== "PGlite" || engine.available !== true || "error" in engine) return false;
|
|
80
|
+
if (!record(migrations) || migrations.applied !== true || "failure" in migrations || !nonempty(migrations.dir) || !hash(migrations.hash) || !Array.isArray(migrations.files) || migrations.files.length === 0 || !migrations.files.every((file) => record(file) && nonempty(file.name) && hash(file.sha256))) return false;
|
|
81
|
+
if (!record(matrix) || !nonempty(matrix.path) || !hash(matrix.hash) || !["none", "supabase-legacy"].includes(matrix.defaultGrants)) return false;
|
|
82
|
+
if (receipt.commit !== null && (!record(receipt.commit) || typeof receipt.commit.sha !== "string" || !/^[a-f0-9]{40}$/.test(receipt.commit.sha) || ![true, false, null].includes(receipt.commit.dirty))) return false;
|
|
83
|
+
if (!strings(receipt.filesRead) || !strings(receipt.assumptions) || !strings(receipt.exclusions)) return false;
|
|
84
|
+
if (!Array.isArray(roleChecks) || !roleChecks.every((check) => record(check) && nonempty(check.role) && check.ok === true && nonempty(check.detail))) return false;
|
|
85
|
+
const checkedRoles = new Set(roleChecks.map((check) => check.role));
|
|
86
|
+
if (checkedRoles.size !== roleChecks.length || !checkedRoles.has("anon") || !checkedRoles.has("authenticated")) return false;
|
|
87
|
+
if (!record(summary) || !Array.isArray(tables) || tables.length === 0) return false;
|
|
88
|
+
const counts = { pass: 0, fail: 0, unknown: 0, notApplicable: 0, tested: 0, total: 0 };
|
|
89
|
+
const tableNames = /* @__PURE__ */ new Set();
|
|
90
|
+
for (const table of tables) {
|
|
91
|
+
if (!record(table) || !nonempty(table.name) || tableNames.has(table.name) || !Array.isArray(table.cells) || table.cells.length === 0) return false;
|
|
92
|
+
tableNames.add(table.name);
|
|
93
|
+
const cells = /* @__PURE__ */ new Set();
|
|
94
|
+
let observed = false;
|
|
95
|
+
for (const cell of table.cells) {
|
|
96
|
+
if (!record(cell) || cell.table !== table.name || ![...actors, "service_role"].includes(cell.actor) || ![...actions, "reassign"].includes(cell.action)) return false;
|
|
97
|
+
const key = `${cell.actor}:${cell.action}`;
|
|
98
|
+
if (cells.has(key) || !record(cell.observed) || !nonempty(cell.observed.summary) || !nonempty(cell.reason)) return false;
|
|
99
|
+
cells.add(key);
|
|
100
|
+
if (cell.actor === "service_role") {
|
|
101
|
+
if (!actions.includes(cell.action) || cell.expected !== "excluded" || cell.outcome !== "N/A") return false;
|
|
102
|
+
} else if (cell.expected === "skip") {
|
|
103
|
+
if (cell.outcome !== "N/A") return false;
|
|
104
|
+
} else if (!["allow", "deny"].includes(cell.expected) || !["Pass", "Fail", "Unknown"].includes(cell.outcome)) return false;
|
|
105
|
+
if (cell.outcome === "Pass") {
|
|
106
|
+
counts.pass += 1;
|
|
107
|
+
observed = true;
|
|
108
|
+
} else if (cell.outcome === "Fail") {
|
|
109
|
+
counts.fail += 1;
|
|
110
|
+
observed = true;
|
|
111
|
+
} else if (cell.outcome === "Unknown") counts.unknown += 1;
|
|
112
|
+
else if (cell.outcome === "N/A") counts.notApplicable += 1;
|
|
113
|
+
else return false;
|
|
114
|
+
counts.total += 1;
|
|
115
|
+
}
|
|
116
|
+
if (actors.some((actor) => actions.some((action) => !cells.has(`${actor}:${action}`)))) return false;
|
|
117
|
+
if (actions.some((action) => cells.has(`service_role:${action}`)) && actions.some((action) => !cells.has(`service_role:${action}`))) return false;
|
|
118
|
+
if (observed || table.rls !== void 0) {
|
|
119
|
+
if (!record(table.rls) || typeof table.rls.enabled !== "boolean" || typeof table.rls.forced !== "boolean" || !nonempty(table.rls.owner)) return false;
|
|
120
|
+
if (!checkedRoles.has(`anon on ${table.name}`) || !checkedRoles.has(`authenticated on ${table.name}`)) return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
counts.tested = counts.total - counts.notApplicable;
|
|
124
|
+
if (Object.entries(counts).some(([key, value]) => !Number.isSafeInteger(summary[key]) || summary[key] !== value)) return false;
|
|
125
|
+
const exitCode = counts.fail > 0 ? 1 : counts.pass === 0 || counts.unknown > 0 ? 2 : 0;
|
|
126
|
+
if (processExit !== exitCode) return false;
|
|
127
|
+
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
128
|
+
const verdict = counts.fail > 0 ? `Not ready within tested scope: ${plural(counts.fail, "cell does", "cells do")} not match the matrix; ${plural(counts.unknown, "unknown")}.` : counts.pass === 0 ? `Nothing was observed: ${plural(counts.unknown, "unknown")}, ${counts.notApplicable} N/A.` : counts.unknown > 0 ? `No blockers found within tested scope; ${plural(counts.unknown, "unknown")}.` : "No blockers found within tested scope; 0 unknowns. Scenario passed locally.";
|
|
129
|
+
return receipt.verdict === verdict;
|
|
130
|
+
}
|
|
131
|
+
function classifyRlsToolResult(stdout, exitCode, transportError = false) {
|
|
132
|
+
let receipt;
|
|
133
|
+
try {
|
|
134
|
+
receipt = JSON.parse(stdout);
|
|
135
|
+
} catch {
|
|
136
|
+
return { isError: true };
|
|
137
|
+
}
|
|
138
|
+
if (!record(receipt)) return { isError: true };
|
|
139
|
+
return { isError: transportError || !completedReceipt(receipt, exitCode), structuredContent: receipt };
|
|
140
|
+
}
|
|
141
|
+
function buildRlsToolResponse(run) {
|
|
142
|
+
const classified = classifyRlsToolResult(run.stdout, run.exitCode, run.transportError);
|
|
143
|
+
const text = !classified.isError && classified.structuredContent ? `exit ${run.exitCode}
|
|
144
|
+
${JSON.stringify(classified.structuredContent)}${run.stderr ? `
|
|
145
|
+
${run.stderr}` : ""}`.trim() : run.text;
|
|
146
|
+
return { content: [{ type: "text", text }], ...classified };
|
|
147
|
+
}
|
|
148
|
+
|
|
33
149
|
// ../../shared/liveTools.ts
|
|
34
150
|
var cwd = { type: "string", description: "Local project directory. Defaults to the MCP working directory." };
|
|
35
151
|
var stepId = { type: "string", format: "uuid", description: "The stepId returned by live_start; preserve it through sign-in, payment and retries." };
|
|
@@ -457,6 +573,321 @@ var registry_generated_default = {
|
|
|
457
573
|
}
|
|
458
574
|
};
|
|
459
575
|
|
|
576
|
+
// ../providers/recent-changes.generated.mjs
|
|
577
|
+
var recent_changes_generated_default = {
|
|
578
|
+
"hash": "d2aaaaf9089270914954d2a8fd7b4fa3933c8525111162650feeb7bf726c67dc",
|
|
579
|
+
"pack": {
|
|
580
|
+
"schemaVersion": 1,
|
|
581
|
+
"packVersion": "1.0.0",
|
|
582
|
+
"reviewedAt": "2026-10-30",
|
|
583
|
+
"dateConvention": "effective = provider-stated date; announced = publication/release date; verified = checked date only, not rollout.",
|
|
584
|
+
"limits": [
|
|
585
|
+
"Guidance only; repository and live provider state remain not_checked.",
|
|
586
|
+
"Static, reviewed official sources can change. A matching entry is a candidate explanation, not a diagnosis or evidence that a fix worked.",
|
|
587
|
+
"No provider connection, account, credential, runtime file read, network request, deployment or data change is performed."
|
|
588
|
+
],
|
|
589
|
+
"correctionsAndConflicts": [
|
|
590
|
+
"Lovable current official dates Oct 23 retirement/Dec 1 deletion replace seeded Oct5/Nov 4. Affected built-in-backend projects only.",
|
|
591
|
+
"Vercel current docs list 26.x default; 24.x remains supported but is not the current default claim.",
|
|
592
|
+
"Railway IaC migration doc says --apply clears settings, but newer Oct 16 changelog explicitly requires separate cutover. Current CLI help must be inspected before execution.",
|
|
593
|
+
"Railway announcement has2026-08-21 visible publish date despite Aug 20 URL; avoid inventing Aug 20 announced date.",
|
|
594
|
+
"Clerk production-instance setup is evergreen verified Oct 30, not an Oct 30 provider change. Related secret masking is dated Oct 19.",
|
|
595
|
+
"Supabase legacy-key end 2026 deprecation is not an exact shutdown day; no mandatory day invented."
|
|
596
|
+
],
|
|
597
|
+
"sources": [
|
|
598
|
+
{
|
|
599
|
+
"id": "supabase-grants-announcement",
|
|
600
|
+
"url": "https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically",
|
|
601
|
+
"notes": "Dated April 28, 2026. Announces October 30 application to existing projects; newly created public tables need explicit grants. Existing table grants persist; direct Postgres users unaffected. Official example uses code 42501 and permission denied for table your_table."
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"id": "supabase-api-security",
|
|
605
|
+
"url": "https://supabase.com/docs/guides/api/securing-your-api",
|
|
606
|
+
"notes": "Grants determine object/role access; RLS controls rows. Configure both for API-exposed tables. Does not prove hosted project rollout or actual grants."
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"id": "vercel-node20-announcement",
|
|
610
|
+
"url": "https://vercel.com/changelog/node-js-20-is-being-deprecated",
|
|
611
|
+
"notes": "Published July 14, 2026. October 1 deprecation for Builds/Functions affects new deployments, not existing invocations. Official upgrade example sets engines.node to 24.x, matches local/CI and reruns build/tests."
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"id": "vercel-node-versions",
|
|
615
|
+
"url": "https://vercel.com/docs/functions/runtimes/node-js/node-js-versions",
|
|
616
|
+
"notes": "Current docs list 26.x default and 24.x/22.x supported. package.json engines.node overrides Project Settings. Do not repeat seed's 24.x default claim."
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"id": "vercel-node-error-source",
|
|
620
|
+
"url": "https://raw.githubusercontent.com/vercel/vercel/main/packages/build-utils/src/fs/node-version.ts",
|
|
621
|
+
"notes": "Official mutable main source lists20.x discontinueDate 2026-10-01 and constructs discontinued error prefix with selected range; code BUILD_UTILS_NODE_VERSION_DISCONTINUED. Prefix instantiated at20.x is source-derived, not a deployment observation."
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"id": "next164-announcement",
|
|
625
|
+
"url": "https://nextjs.org/blog/next-16-4",
|
|
626
|
+
"notes": "Dated October 6,2026. New create-next-app apps enable Cache Components by default; existing apps require adoption. This is not a universal default switch for every existing app."
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"id": "next-blocking-error",
|
|
630
|
+
"url": "https://nextjs.org/docs/messages/blocking-route",
|
|
631
|
+
"notes": "Official exact error title. With cacheComponents enabled, request-time async data needs parent Suspense. Cache deliberately reusable data with use cache, or move runtime read into child below Suspense. Build --debug-prerender may identify component."
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"id": "next-cache-migration",
|
|
635
|
+
"url": "https://nextjs.org/docs/app/guides/migrating-to-cache-components",
|
|
636
|
+
"notes": "Route configs dynamic/revalidate/fetchCache replaced by use cache/cacheLife under Cache Components; avoid caching user request data indiscriminately."
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"id": "lovable-environments",
|
|
640
|
+
"url": "https://docs.lovable.dev/features/environments",
|
|
641
|
+
"notes": "Current guide states retirement October 23,2026; detached Test databases restorable untilDecember 1,2026 then deleted. Built-in backend only. Drafts preview code with same database. Publishing schema/policies/functions does not copy rows/files/auth settings. Restore request required after detachment."
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"id": "railway-cac",
|
|
645
|
+
"url": "https://docs.railway.com/config-as-code",
|
|
646
|
+
"notes": "Existing railway.json/toml services continue until 2026-12-01 hard cutoff; new services cannot opt into CaC. Prefer .railway/railway.ts."
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"id": "railway-iac",
|
|
650
|
+
"url": "https://docs.railway.com/infrastructure-as-code",
|
|
651
|
+
"notes": "Review railway config plan before apply; whole-project omissions can delete resources; deployments do not read .railway directly. Migration section still claims --apply clears settings, conflicting with newer Oct 16 changelog's separate cutover."
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"id": "railway-guided-migration",
|
|
655
|
+
"url": "https://railway.com/changelog/2026-10-16-activity-feed-filters",
|
|
656
|
+
"notes": "Dated Oct 16,2026. --apply writes config without switching services. migrate cutover lists effects/saves old paths; status reports and undo restores paths. Use newer scoped migration flow and installed CLI help rather than stale IaC snippet."
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"id": "railway-cac-announcement",
|
|
660
|
+
"url": "https://railway.com/changelog/2026-08-20-railway-anon",
|
|
661
|
+
"notes": "Visible publish date 2026-08-21 despiteURLAug 20. Announces August 28 new-project restriction and December 1 end. Its older statement allows new services in existing projects; current CaC docs disallow new services, so avoid generalizing that exception."
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"id": "clerk-production",
|
|
665
|
+
"url": "https://clerk.com/docs/guides/development/deployment/production",
|
|
666
|
+
"notes": "Evergreen current guidance: create/select production instance; use pk_live_/sk_live_ pair in production host vars then redeploy. Configure production OAuth/webhooks/DNS. This is verified Oct 30, not a newOct 30 rollout."
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"id": "clerk-environments",
|
|
670
|
+
"url": "https://clerk.com/docs/guides/development/managing-environments",
|
|
671
|
+
"notes": "Development/Production instances differ; development unsuitable for production. Does not prove a particular app's live keys or readiness."
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"id": "clerk-keys-once",
|
|
675
|
+
"url": "https://clerk.com/changelog/2026-10-19-secret-keys-visible-only-on-creation",
|
|
676
|
+
"notes": "Published Oct 19; URL supplies2026 and footer2026. Full secret value shown only on creation. Existing keys still work; if lost, add replacement, update code, delete old only after no longer used."
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
"id": "supabase-api-keys",
|
|
680
|
+
"url": "https://supabase.com/docs/guides/getting-started/api-keys",
|
|
681
|
+
"notes": "Current docs say legacy anon/service_role deprecated by end 2026, no exact shutdown date. Publishable/secret replace them; secret server-only/BYPASSRLS and browser rejectionHTTP401. New keys not JWTs; use apikey header, not Authorization bearer as a userJWT."
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"id": "supabase-key-migration",
|
|
685
|
+
"url": "https://supabase.com/docs/guides/getting-started/migrating-to-new-api-keys",
|
|
686
|
+
"notes": "Create new keys alongside legacy; replace frontend anon with publishable and backend service_role with secret. Check components then disable legacy keys. Grant/RLS behavior retained, and key switch doesn't fix access policy."
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
"entries": [
|
|
690
|
+
{
|
|
691
|
+
"id": "supabase-explicit-data-api-grants",
|
|
692
|
+
"provider": "supabase",
|
|
693
|
+
"date": "2026-10-30",
|
|
694
|
+
"dateKind": "effective",
|
|
695
|
+
"dateNote": "Provider-announced application date for existing projects; announced 2026-04-28. This is not verification that any particular hosted project has rolled over.",
|
|
696
|
+
"whatChanged": "After the rollout, new public tables need explicit role grants to be reachable through the Data/GraphQL API. Existing table grants remain; direct Postgres connections are unaffected.",
|
|
697
|
+
"errorText": "permission denied for table your_table",
|
|
698
|
+
"errorTextKind": "official_documentation_example",
|
|
699
|
+
"errorCode": "42501",
|
|
700
|
+
"fix": "Confirm the actual role/table/operation. In a reviewed migration, grant only required privileges (for example GRANT SELECT ON public.your_table TO authenticated), and keep RLS enabled with policies matching intended row access. Do not replace a missing grant with a server secret in browser code.",
|
|
701
|
+
"officialSource": "https://supabase.com/changelog/45329-breaking-change-tables-not-exposed-to-data-and-graphql-api-automatically",
|
|
702
|
+
"sourceIds": [
|
|
703
|
+
"supabase-grants-announcement",
|
|
704
|
+
"supabase-api-security"
|
|
705
|
+
],
|
|
706
|
+
"limitations": "Repo inspection cannot establish hosted grants, actual rollout, policy behavior, or a successful live request."
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"id": "vercel-node20-to24",
|
|
710
|
+
"provider": "vercel",
|
|
711
|
+
"date": "2026-10-01",
|
|
712
|
+
"dateKind": "effective",
|
|
713
|
+
"dateNote": "Announced 2026-07-14. Scope: new Builds/Functions deployments, not already-deployed function invocations.",
|
|
714
|
+
"whatChanged": "Node 20 is discontinued for new Builds/Functions deployments. Node 24 remains supported; current docs additionally list Node 26 as default, so 24 must not be described as today's default.",
|
|
715
|
+
"errorText": 'Node.js Version "20.x" is discontinued and must be upgraded.',
|
|
716
|
+
"errorTextKind": "official_source_template_instantiated",
|
|
717
|
+
"errorCode": "BUILD_UTILS_NODE_VERSION_DISCONTINUED",
|
|
718
|
+
"fix": "Change a Node 20 engines.node pin to 24.x, or select 24.x in Project Settings when engines is absent; engines overrides settings. Match local/CI runtime, reinstall dependencies, run build/tests, then verify the runtime in a future deployment. No deployment performed here.",
|
|
719
|
+
"officialSource": "https://vercel.com/changelog/node-js-20-is-being-deprecated",
|
|
720
|
+
"sourceIds": [
|
|
721
|
+
"vercel-node20-announcement",
|
|
722
|
+
"vercel-node-versions",
|
|
723
|
+
"vercel-node-error-source"
|
|
724
|
+
],
|
|
725
|
+
"limitations": "Exact prefix comes from official source with 20.x substituted, not a newly observed build. Container deployments have a separate runtime model."
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"id": "next-cache-components-suspense",
|
|
729
|
+
"provider": "nextjs",
|
|
730
|
+
"date": "2026-10-06",
|
|
731
|
+
"dateKind": "announced",
|
|
732
|
+
"dateNote": "Next 16.4 release date. Default enablement statement applies to newly generated create-next-app apps; existing app config must be inspected.",
|
|
733
|
+
"whatChanged": "Next 16.4 enables Cache Components in new create-next-app apps. With cacheComponents enabled, uncached request-time reads without a parent Suspense boundary trigger the documented error.",
|
|
734
|
+
"errorText": "Uncached data was accessed outside of `<Suspense>`",
|
|
735
|
+
"errorTextKind": "official_documentation_title",
|
|
736
|
+
"errorCode": null,
|
|
737
|
+
"fix": 'Move request-time reads into a child rendered under <Suspense fallback={...}>. For deliberately reusable data, use "use cache" with an appropriate lifetime. Migrate incompatible route configs such as dynamic/revalidate/fetchCache using the official guide, and build to verify.',
|
|
738
|
+
"officialSource": "https://nextjs.org/blog/next-16-4",
|
|
739
|
+
"sourceIds": [
|
|
740
|
+
"next164-announcement",
|
|
741
|
+
"next-blocking-error",
|
|
742
|
+
"next-cache-migration"
|
|
743
|
+
],
|
|
744
|
+
"limitations": "No app/version-specific reproduction or build run. Do not cache authentication/request data indiscriminately."
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"id": "lovable-test-live-retired",
|
|
748
|
+
"provider": "lovable",
|
|
749
|
+
"date": "2026-10-23",
|
|
750
|
+
"dateKind": "effective",
|
|
751
|
+
"dateNote": "Current official guide differs from seeded VibeRaven dates Oct 5/Nov 4. Current retirement Oct 23 and deletion Dec 1 verified Oct 30.",
|
|
752
|
+
"whatChanged": "Separate Test/Live on the built-in backend retired; projects use one database. Detached Test databases remain restorable by request until 2026-12-01, then are deleted. Drafts share data with the published app.",
|
|
753
|
+
"errorText": null,
|
|
754
|
+
"errorTextKind": "not_documented",
|
|
755
|
+
"symptom": "Test/Live switcher disappears; missing data may remain in detached Test rather than Live.",
|
|
756
|
+
"fix": "If needed data is in detached Test, request restoration before December 1, export needed rows/files and move them into Live, reconcile duplicates and verify Live content. Publishing alone does not migrate rows/files/auth settings. No account or data changes performed.",
|
|
757
|
+
"officialSource": "https://docs.lovable.dev/features/environments",
|
|
758
|
+
"sourceIds": [
|
|
759
|
+
"lovable-environments"
|
|
760
|
+
],
|
|
761
|
+
"limitations": "Applies to built-in-backend projects that used the split, not every external Supabase project. No runtime error quote supplied by the guide."
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"id": "railway-config-as-code-retirement",
|
|
765
|
+
"provider": "railway",
|
|
766
|
+
"date": "2026-12-01",
|
|
767
|
+
"dateKind": "effective",
|
|
768
|
+
"dateNote": "Upcoming hard cutoff documented today; announcement page visible date 2026-08-21 despite Aug 20 URL. Guided migration announced Oct 16.",
|
|
769
|
+
"whatChanged": "railway.json/railway.toml Config as Code is deprecated and stops working for existing services at Dec 1 cutoff. New services cannot opt in; prefer .railway/railway.ts IaC.",
|
|
770
|
+
"errorText": null,
|
|
771
|
+
"errorTextKind": "not_documented",
|
|
772
|
+
"symptom": "IaC plan is blocked for a service still managed by a CaC file; no exact cutoff failure message verified.",
|
|
773
|
+
"fix": "Preview with railway config migrate, inspect generated IaC, write with --apply, review separate migrate cutover using current CLI help, then migrate status and config plan. Review all changes/deletions before any authorized apply; committing .railway alone does not apply configuration.",
|
|
774
|
+
"officialSource": "https://docs.railway.com/config-as-code",
|
|
775
|
+
"sourceIds": [
|
|
776
|
+
"railway-cac",
|
|
777
|
+
"railway-iac",
|
|
778
|
+
"railway-guided-migration",
|
|
779
|
+
"railway-cac-announcement"
|
|
780
|
+
],
|
|
781
|
+
"limitations": "Official IaC page still says --apply clears config settings; newer Oct 16 changelog explicitly separates cutover. No CLI/provider execution here; avoid unverified variables flags or predicting post-cutoff fallback."
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"id": "clerk-production-instance-keys",
|
|
785
|
+
"provider": "clerk",
|
|
786
|
+
"date": "2026-10-30",
|
|
787
|
+
"dateKind": "verified",
|
|
788
|
+
"dateNote": "Verification date only for evergreen production-instance guidance, not a rollout date. Related show-secret-once change announced 2026-10-19.",
|
|
789
|
+
"whatChanged": "Current production deployment guidance requires production-instance pk_live_/sk_live_ keys. Separately, since the Oct 19 announcement, existing secret values are masked and full values appear only when created.",
|
|
790
|
+
"errorText": null,
|
|
791
|
+
"errorTextKind": "not_documented",
|
|
792
|
+
"symptom": "Production app still uses pk_test_/sk_test_, or a lost secret cannot be revealed again.",
|
|
793
|
+
"fix": "Use matching production-instance keys in the production host environment and redeploy, with production OAuth/webhook/DNS configuration checked. If a secret value is lost, create a replacement, update all consuming components, then delete the old one only after it is unused. Existing keys are not invalidated merely by masking.",
|
|
794
|
+
"officialSource": "https://clerk.com/docs/guides/development/deployment/production",
|
|
795
|
+
"sourceIds": [
|
|
796
|
+
"clerk-production",
|
|
797
|
+
"clerk-environments",
|
|
798
|
+
"clerk-keys-once"
|
|
799
|
+
],
|
|
800
|
+
"limitations": "No account, secret, production-instance, redirect, or deployment inspection. These docs give no single exact runtime error for the whole symptom."
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"id": "supabase-publishable-secret-api-keys",
|
|
804
|
+
"provider": "supabase",
|
|
805
|
+
"date": "2026-10-30",
|
|
806
|
+
"dateKind": "verified",
|
|
807
|
+
"dateNote": "Verification date only. Docs say legacy keys deprecated by end 2026; no exact shutdown day claimed or checked here.",
|
|
808
|
+
"whatChanged": "Publishable (sb_publishable_) and secret (sb_secret_) replace legacy anon/service_role keys. New keys are not JWTs; both systems can coexist during migration.",
|
|
809
|
+
"errorText": "HTTP 401 Unauthorized",
|
|
810
|
+
"errorTextKind": "official_documented_http_status",
|
|
811
|
+
"symptom": "A secret key sent with a browser User-Agent is rejected; this is not a guarantee against use from scripts.",
|
|
812
|
+
"fix": "Replace public/client anon usage with publishable and backend service_role usage with secret; keep privileged keys out of client code. Send API keys through apikey; use actual user JWTs for user Authorization. Verify all clients before disabling legacy keys. Rotate a leaked secret after fixing its exposure.",
|
|
813
|
+
"officialSource": "https://supabase.com/docs/guides/getting-started/api-keys",
|
|
814
|
+
"sourceIds": [
|
|
815
|
+
"supabase-api-keys",
|
|
816
|
+
"supabase-key-migration"
|
|
817
|
+
],
|
|
818
|
+
"limitations": "No key/account/provider inspection, rotation, or live request. Switching key formats does not fix missing grants or RLS policies."
|
|
819
|
+
}
|
|
820
|
+
]
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// ../providers/recentChanges.mjs
|
|
825
|
+
var availableProviders = [...new Set(recent_changes_generated_default.pack.entries.map((entry) => entry.provider))].sort();
|
|
826
|
+
var RECENT_PROVIDER_CHANGES_TOOL = {
|
|
827
|
+
name: "recent_provider_changes",
|
|
828
|
+
title: "Check recent provider changes",
|
|
829
|
+
description: `Check dated official provider guidance before answering a provider error or updating a deployment. Returns candidate changes, documented errors or symptoms, fixes, date meanings and official supporting sources. Filter by provider or redacted error keywords. Available providers: ${availableProviders.join(", ")}.
|
|
830
|
+
Limits: guidance only; does not read your repo, connect to providers, run fixes or verify rollout, deployment or live behavior.`,
|
|
831
|
+
inputSchema: {
|
|
832
|
+
type: "object",
|
|
833
|
+
properties: {
|
|
834
|
+
provider: { type: "string", enum: [...availableProviders], description: "Optional lowercase provider id. Unsupported ids return the bounded available list." },
|
|
835
|
+
query: { type: "string", minLength: 1, maxLength: 500, description: "Optional redacted error text or public keywords. Remove credentials, private paths and personal data before calling." },
|
|
836
|
+
limit: { type: "integer", minimum: 1, maximum: 8, default: 5, description: "Maximum entries, 1 to 8; default 5." }
|
|
837
|
+
},
|
|
838
|
+
additionalProperties: false
|
|
839
|
+
},
|
|
840
|
+
outputSchema: {
|
|
841
|
+
type: "object",
|
|
842
|
+
properties: { packVersion: { type: "string" }, packHash: { type: "string" }, reviewedAt: { type: "string" }, dateConvention: { type: "string" }, entries: { type: "array", items: { type: "object" }, maxItems: 8 }, availableProviders: { type: "array", items: { type: "string" } }, limits: { type: "array", items: { type: "string" } }, correctionsAndConflicts: { type: "array", items: { type: "string" } }, verification: { type: "object" } },
|
|
843
|
+
required: ["packVersion", "packHash", "reviewedAt", "dateConvention", "entries", "availableProviders", "limits", "correctionsAndConflicts", "verification"],
|
|
844
|
+
additionalProperties: false
|
|
845
|
+
},
|
|
846
|
+
annotations: { title: "Check recent provider changes", readOnlyHint: true, destructiveHint: false, openWorldHint: false, idempotentHint: true }
|
|
847
|
+
};
|
|
848
|
+
var stopWords = /* @__PURE__ */ new Set([...availableProviders, "next", "js", ..."a an and app apps are as at be before by can does error for from has have how in is it not of on or provider the this to was what when which with".split(" ")]);
|
|
849
|
+
var words = (text) => [...new Set((text.toLowerCase().match(/[a-z0-9_]+/g) ?? []).filter((word) => (word.length >= 3 || /^\d{2,}$/.test(word)) && !stopWords.has(word)))];
|
|
850
|
+
var indexed = recent_changes_generated_default.pack.entries.map((entry) => ({ entry, words: new Set(words([entry.id, entry.provider, entry.whatChanged, entry.errorText, entry.errorCode, entry.symptom, entry.fix].filter(Boolean).join(" "))) }));
|
|
851
|
+
function invalidInput(field) {
|
|
852
|
+
return { isError: true, content: [{ type: "text", text: `invalid_input: Use optional supported provider, redacted query (1 to 500 characters), and limit (integer 1 to 8).
|
|
853
|
+
Field: ${field}
|
|
854
|
+
Example arguments: {"provider":"supabase","query":"42501","limit":5}
|
|
855
|
+
Next step: Choose an available provider: ${availableProviders.join(", ")}. Retrieval returns guidance; no connection or check was attempted.` }] };
|
|
856
|
+
}
|
|
857
|
+
function renderRecentChanges(result) {
|
|
858
|
+
const lines = [`Recent provider changes ${result.packVersion} (reviewed ${result.reviewedAt})`, result.dateConvention, "Guidance only. Repository and live checks: not checked.", ""];
|
|
859
|
+
if (!result.entries.length) lines.push("No entry matched. A missing match does not rule out a provider change; inspect the current official documentation and actual app evidence.");
|
|
860
|
+
for (const entry of result.entries) {
|
|
861
|
+
lines.push(`${entry.provider}: ${entry.id}`, `Date: ${entry.date} (${entry.dateKind}). ${entry.dateNote}`, `What changed: ${entry.whatChanged}`);
|
|
862
|
+
if (entry.errorText !== null) lines.push(`Error: ${entry.errorText} (${entry.errorTextKind}${entry.errorCode ? `; code ${entry.errorCode}` : ""})`);
|
|
863
|
+
else lines.push(`Error: no exact error documented (${entry.errorTextKind}).`);
|
|
864
|
+
if (entry.symptom) lines.push(`Symptom: ${entry.symptom}`);
|
|
865
|
+
lines.push(`Fix guidance: ${entry.fix}`, `Official source: ${entry.officialSource}`, `Supporting sources: ${entry.sources.map((source) => source.url).join(" ")}`, `Limits: ${entry.limitations}`, "");
|
|
866
|
+
}
|
|
867
|
+
lines.push("Source corrections and conflicts:", ...result.correctionsAndConflicts.map((note) => `- ${note}`), "Limits:", ...result.limits.map((limit) => `- ${limit}`));
|
|
868
|
+
return lines.join("\n");
|
|
869
|
+
}
|
|
870
|
+
function recentProviderChanges(args) {
|
|
871
|
+
if (!args || typeof args !== "object" || Array.isArray(args) || Object.keys(args).some((key) => !["provider", "query", "limit"].includes(key))) return invalidInput("arguments");
|
|
872
|
+
if (Object.hasOwn(args, "provider") && (typeof args.provider !== "string" || !availableProviders.includes(args.provider))) return invalidInput("provider");
|
|
873
|
+
if (Object.hasOwn(args, "query") && (typeof args.query !== "string" || args.query.length > 500 || !args.query.trim() || /\u0000/.test(args.query))) return invalidInput("query");
|
|
874
|
+
if (Object.hasOwn(args, "limit") && (!Number.isInteger(args.limit) || args.limit < 1 || args.limit > 8)) return invalidInput("limit");
|
|
875
|
+
const terms = args.query === void 0 ? null : words(args.query);
|
|
876
|
+
const entries = indexed.filter((item) => args.provider === void 0 || item.entry.provider === args.provider).map((item) => ({ ...item, score: terms === null ? 0 : terms.reduce((score, term) => score + Number(item.words.has(term)), 0) })).filter((item) => terms === null || item.score > 0).sort((a, b) => b.score - a.score).slice(0, args.limit ?? 5).map(({ entry }) => ({ ...entry, sources: entry.sourceIds.map((id2) => recent_changes_generated_default.pack.sources.find((source) => source.id === id2)) }));
|
|
877
|
+
const structuredContent = JSON.parse(JSON.stringify({
|
|
878
|
+
packVersion: recent_changes_generated_default.pack.packVersion,
|
|
879
|
+
packHash: recent_changes_generated_default.hash,
|
|
880
|
+
reviewedAt: recent_changes_generated_default.pack.reviewedAt,
|
|
881
|
+
dateConvention: recent_changes_generated_default.pack.dateConvention,
|
|
882
|
+
entries,
|
|
883
|
+
availableProviders,
|
|
884
|
+
limits: recent_changes_generated_default.pack.limits,
|
|
885
|
+
correctionsAndConflicts: recent_changes_generated_default.pack.correctionsAndConflicts,
|
|
886
|
+
verification: { repo: "not_checked", live: "not_checked" }
|
|
887
|
+
}));
|
|
888
|
+
return { isError: false, structuredContent, content: [{ type: "text", text: renderRecentChanges(structuredContent) }] };
|
|
889
|
+
}
|
|
890
|
+
|
|
460
891
|
// ../providers/index.mjs
|
|
461
892
|
var PROVIDER_TOOL = {
|
|
462
893
|
name: "provider_playbook",
|
|
@@ -963,7 +1394,7 @@ function runWorkReportProcess(entry, args, cwd3, spawnFn2) {
|
|
|
963
1394
|
} catch {
|
|
964
1395
|
return Promise.resolve(workReportFailure());
|
|
965
1396
|
}
|
|
966
|
-
return new Promise((
|
|
1397
|
+
return new Promise((resolve2) => {
|
|
967
1398
|
let settled = false, stdoutBytes = 0, stderrBytes = 0;
|
|
968
1399
|
const chunks = [];
|
|
969
1400
|
let child;
|
|
@@ -971,7 +1402,7 @@ function runWorkReportProcess(entry, args, cwd3, spawnFn2) {
|
|
|
971
1402
|
if (!settled) {
|
|
972
1403
|
settled = true;
|
|
973
1404
|
clearTimeout(timer);
|
|
974
|
-
|
|
1405
|
+
resolve2(result);
|
|
975
1406
|
}
|
|
976
1407
|
};
|
|
977
1408
|
const fail = () => {
|
|
@@ -1020,27 +1451,34 @@ var within = (root, target) => {
|
|
|
1020
1451
|
const rel = (0, import_node_path.relative)(root, target);
|
|
1021
1452
|
return !rel || !(0, import_node_path.isAbsolute)(rel) && rel !== ".." && !rel.startsWith(`..${import_node_path.sep}`);
|
|
1022
1453
|
};
|
|
1023
|
-
function
|
|
1454
|
+
function resolveInstalledCli(version, cwd3) {
|
|
1024
1455
|
const override = process.env.VIBERAVEN_CLI_PATH;
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1456
|
+
try {
|
|
1457
|
+
if (override !== void 0 && !(0, import_node_path.isAbsolute)(override)) throw new Error("Unavailable installed CLI");
|
|
1458
|
+
const selected = override ?? (0, import_node_path.join)((0, import_node_path.dirname)((0, import_node_module.createRequire)(__filename).resolve("@viberaven/cli/package.json")), "dist", "cli.js");
|
|
1459
|
+
const info = (0, import_node_fs2.lstatSync)(selected);
|
|
1460
|
+
if (!info.isFile() || info.isSymbolicLink()) throw new Error("Unavailable installed CLI");
|
|
1461
|
+
const entry = (0, import_node_fs2.realpathSync)(selected);
|
|
1462
|
+
const root = (0, import_node_fs2.realpathSync)((0, import_node_path.join)((0, import_node_path.dirname)(entry), ".."));
|
|
1463
|
+
if (entry !== (0, import_node_path.resolve)(selected) || entry !== (0, import_node_path.join)(root, "dist", "cli.js") || within((0, import_node_fs2.realpathSync)(cwd3), entry)) throw new Error("Unavailable installed CLI");
|
|
1464
|
+
const manifestPath = (0, import_node_path.join)(root, "package.json"), manifestInfo = (0, import_node_fs2.lstatSync)(manifestPath);
|
|
1465
|
+
if (!manifestInfo.isFile() || manifestInfo.isSymbolicLink() || manifestInfo.size > 65536 || (0, import_node_fs2.realpathSync)(manifestPath) !== manifestPath) throw new Error("Unavailable installed CLI");
|
|
1466
|
+
const manifest = JSON.parse((0, import_node_fs2.readFileSync)(manifestPath, "utf8"));
|
|
1467
|
+
if (manifest.name !== "@viberaven/cli" || manifest.version !== version) throw new Error("Unavailable installed CLI");
|
|
1468
|
+
return entry;
|
|
1469
|
+
} catch {
|
|
1470
|
+
if (override !== void 0) throw new Error("Matching installed CLI unavailable. Check VIBERAVEN_CLI_PATH, its exact version and installation outside the task repository.");
|
|
1471
|
+
return void 0;
|
|
1472
|
+
}
|
|
1037
1473
|
}
|
|
1038
1474
|
function runInstalledWorkReport(args, cwd3, version, spawnFn2) {
|
|
1039
1475
|
let entry, canonicalCwd;
|
|
1040
1476
|
try {
|
|
1041
1477
|
if (cwd3 !== void 0 && (typeof cwd3 !== "string" || !cwd3.trim())) return Promise.resolve(workReportFailure());
|
|
1042
1478
|
canonicalCwd = (0, import_node_fs2.realpathSync)(cwd3 === void 0 ? process.cwd() : cwd3);
|
|
1043
|
-
|
|
1479
|
+
const installed = resolveInstalledCli(version, canonicalCwd);
|
|
1480
|
+
if (!installed) return Promise.resolve(workReportFailure());
|
|
1481
|
+
entry = installed;
|
|
1044
1482
|
} catch {
|
|
1045
1483
|
return Promise.resolve(workReportFailure());
|
|
1046
1484
|
}
|
|
@@ -1062,7 +1500,7 @@ function mcpVersion() {
|
|
|
1062
1500
|
} catch {
|
|
1063
1501
|
}
|
|
1064
1502
|
}
|
|
1065
|
-
found ??= true ? "1.7.
|
|
1503
|
+
found ??= true ? "1.7.2" : void 0;
|
|
1066
1504
|
if (!found || !PLAIN_VERSION.test(found)) {
|
|
1067
1505
|
throw new Error(`Could not read a valid ${MCP_PACKAGE} version (got ${JSON.stringify(found)}), so the matching ${CLI_PACKAGE} cannot be pinned.`);
|
|
1068
1506
|
}
|
|
@@ -1113,6 +1551,7 @@ function buildHealArgs(prefix, args) {
|
|
|
1113
1551
|
return cliArgs;
|
|
1114
1552
|
}
|
|
1115
1553
|
function buildToolArgs(name, args) {
|
|
1554
|
+
if (name === RLS_TOOL_NAME) return buildRlsToolArgs(args);
|
|
1116
1555
|
if (isLiveTool(name)) return buildLiveToolArgs(name, args);
|
|
1117
1556
|
if (isWorkTool(name)) return buildWorkToolArgs(name, args);
|
|
1118
1557
|
switch (name) {
|
|
@@ -1162,6 +1601,9 @@ function buildToolArgs(name, args) {
|
|
|
1162
1601
|
throw new Error(`Unknown VibeRaven tool: ${name}`);
|
|
1163
1602
|
}
|
|
1164
1603
|
}
|
|
1604
|
+
function transportFailure(error, stderr = "") {
|
|
1605
|
+
return { stdout: "", stderr, exitCode: 1, transportError: true, text: `ERROR: ${error instanceof Error ? error.message : String(error)}` };
|
|
1606
|
+
}
|
|
1165
1607
|
function runVibeRavenDetailed(args, cwd3) {
|
|
1166
1608
|
if (args[0] === "work" && args[1] === "report") {
|
|
1167
1609
|
try {
|
|
@@ -1170,32 +1612,87 @@ function runVibeRavenDetailed(args, cwd3) {
|
|
|
1170
1612
|
return Promise.resolve(workReportFailure());
|
|
1171
1613
|
}
|
|
1172
1614
|
}
|
|
1173
|
-
let
|
|
1615
|
+
let built;
|
|
1616
|
+
let childCwd, env;
|
|
1174
1617
|
try {
|
|
1175
|
-
|
|
1618
|
+
childCwd = resolveCwd(cwd3);
|
|
1619
|
+
const installed = resolveInstalledCli(mcpVersion(), childCwd);
|
|
1620
|
+
if (args[0] === "rls-test" && !installed) return Promise.resolve(transportFailure(new Error("RLS testing requires a matching installed CLI outside the task repository, with optional PGlite installed next to it. Configure the local MCP host installation or VIBERAVEN_CLI_PATH; this tool does not download or install dependencies.")));
|
|
1621
|
+
built = installed ? { command: process.execPath, args: [installed, ...args], shell: false } : buildNpxCommand(cliNpxArgs(args));
|
|
1622
|
+
env = installed ? Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:node_|npm_)/i.test(key) && key.toLowerCase() !== "viberaven_cli_path")) : cliChildEnv();
|
|
1176
1623
|
} catch (error) {
|
|
1177
|
-
return Promise.resolve(
|
|
1624
|
+
return Promise.resolve(transportFailure(error));
|
|
1178
1625
|
}
|
|
1179
|
-
return new Promise((
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1626
|
+
return new Promise((resolve2) => {
|
|
1627
|
+
let child;
|
|
1628
|
+
try {
|
|
1629
|
+
child = spawnFn(built.command, built.args, {
|
|
1630
|
+
cwd: childCwd,
|
|
1631
|
+
env,
|
|
1632
|
+
shell: built.shell,
|
|
1633
|
+
windowsHide: true,
|
|
1634
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
1635
|
+
});
|
|
1636
|
+
} catch (error) {
|
|
1637
|
+
resolve2(transportFailure(error));
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1187
1640
|
let stdout = "";
|
|
1188
1641
|
let stderr = "";
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1642
|
+
const boundedRls = args[0] === "rls-test";
|
|
1643
|
+
const rlsChunks = { stdout: [], stderr: [] };
|
|
1644
|
+
let outputBytes = 0;
|
|
1645
|
+
let settled = false;
|
|
1646
|
+
let timer;
|
|
1647
|
+
const finish = (result) => {
|
|
1648
|
+
if (settled) return;
|
|
1649
|
+
settled = true;
|
|
1650
|
+
if (timer) clearTimeout(timer);
|
|
1651
|
+
resolve2(result);
|
|
1652
|
+
};
|
|
1653
|
+
const stopRls = (reason) => {
|
|
1654
|
+
finish(transportFailure(new Error(reason)));
|
|
1655
|
+
try {
|
|
1656
|
+
child.kill("SIGKILL");
|
|
1657
|
+
} catch {
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
if (boundedRls) timer = setTimeout(() => stopRls("RLS test exceeded its 300-second aggregate time limit and was stopped; no partial result is reported as passed."), RLS_RUN_TIMEOUT_MS);
|
|
1661
|
+
const collect = (chunk, stream) => {
|
|
1662
|
+
if (settled) return;
|
|
1663
|
+
outputBytes += Buffer.byteLength(chunk);
|
|
1664
|
+
if (boundedRls && outputBytes > RLS_MAX_OUTPUT_BYTES) {
|
|
1665
|
+
stopRls("RLS test exceeded its combined output limit and was stopped; no partial result is reported as passed.");
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
if (boundedRls) {
|
|
1669
|
+
rlsChunks[stream].push(Buffer.from(chunk));
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
if (stream === "stdout") stdout += chunk.toString();
|
|
1673
|
+
else stderr += chunk.toString();
|
|
1674
|
+
};
|
|
1675
|
+
child.stdout?.on("data", (chunk) => collect(chunk, "stdout"));
|
|
1676
|
+
child.stderr?.on("data", (chunk) => collect(chunk, "stderr"));
|
|
1677
|
+
child.on("error", (error) => finish(transportFailure(error, boundedRls ? "" : stderr)));
|
|
1196
1678
|
child.on("close", (code) => {
|
|
1679
|
+
if (settled) return;
|
|
1680
|
+
if (code === null) {
|
|
1681
|
+
finish(transportFailure(new Error("CLI process ended without an exit code"), boundedRls ? "" : stderr));
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
if (boundedRls) {
|
|
1685
|
+
try {
|
|
1686
|
+
const decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
1687
|
+
stdout = decoder.decode(Buffer.concat(rlsChunks.stdout));
|
|
1688
|
+
stderr = decoder.decode(Buffer.concat(rlsChunks.stderr));
|
|
1689
|
+
} catch {
|
|
1690
|
+
finish(transportFailure(new Error("RLS test returned invalid UTF-8; no partial result is reported as passed.")));
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1197
1694
|
const combined = `${stdout}${stderr}`.trim();
|
|
1198
|
-
|
|
1695
|
+
finish({ stdout, stderr, exitCode: code ?? 1, text: `exit ${code ?? 1}${combined ? `
|
|
1199
1696
|
${combined}` : ""}` });
|
|
1200
1697
|
});
|
|
1201
1698
|
});
|
|
@@ -1203,8 +1700,10 @@ ${combined}` : ""}` });
|
|
|
1203
1700
|
|
|
1204
1701
|
// src/tools/index.ts
|
|
1205
1702
|
var [checkReadiness, verify, strictGate, gateResult, contextMap] = readinessTools;
|
|
1703
|
+
var SEMANTIC_FINDING_TOOLS = /* @__PURE__ */ new Set(["viberaven_check_readiness", "viberaven_verify", "viberaven_audit", "viberaven_strict_gate", "viberaven_gate_result"]);
|
|
1206
1704
|
var ALL_TOOLS = [
|
|
1207
1705
|
checkReadiness,
|
|
1706
|
+
RLS_TOOL,
|
|
1208
1707
|
verify,
|
|
1209
1708
|
...auditTools,
|
|
1210
1709
|
...rulesTools,
|
|
@@ -1216,6 +1715,7 @@ var ALL_TOOLS = [
|
|
|
1216
1715
|
...npmTools,
|
|
1217
1716
|
...WORK_TOOLS,
|
|
1218
1717
|
PROVIDER_TOOL,
|
|
1718
|
+
RECENT_PROVIDER_CHANGES_TOOL,
|
|
1219
1719
|
...LIVE_TOOLS
|
|
1220
1720
|
];
|
|
1221
1721
|
function parseJsonObjectFromToolText(text) {
|
|
@@ -1227,16 +1727,38 @@ function parseJsonObjectFromToolText(text) {
|
|
|
1227
1727
|
return void 0;
|
|
1228
1728
|
}
|
|
1229
1729
|
}
|
|
1730
|
+
function isCompletedNegativeNpmVerdict(receipt) {
|
|
1731
|
+
if (!receipt || "error" in receipt) return false;
|
|
1732
|
+
const results = "results" in receipt ? receipt.results : [receipt];
|
|
1733
|
+
try {
|
|
1734
|
+
return Array.isArray(results) && results.length > 0 && results.every((item) => {
|
|
1735
|
+
if (!item || typeof item !== "object" || Array.isArray(item) || "error" in item) return false;
|
|
1736
|
+
return typeof item.name === "string" && Boolean(item.name.trim()) && ["ok", "not_found", "suspicious"].includes(item.verdict) && Array.isArray(item.reasons) && item.reasons.length > 0 && item.reasons.every((reason) => typeof reason === "string" && Boolean(reason.trim())) && item.registryUrl === `https://registry.npmjs.org/${encodeURIComponent(item.name)}` && typeof item.followUpCommand === "string" && Boolean(item.followUpCommand.trim());
|
|
1737
|
+
}) && results.some((item) => item.verdict !== "ok");
|
|
1738
|
+
} catch {
|
|
1739
|
+
return false;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1230
1742
|
async function handleRequest(method, params) {
|
|
1231
1743
|
if (method === "tools/list") return { tools: ALL_TOOLS };
|
|
1232
1744
|
if (method === "tools/call") {
|
|
1233
1745
|
if (params.name === "provider_playbook") return providerPlaybook(params.arguments);
|
|
1746
|
+
if (params.name === "recent_provider_changes") return recentProviderChanges(params.arguments ?? {});
|
|
1234
1747
|
const args = params.arguments || {};
|
|
1235
|
-
const
|
|
1748
|
+
const cliArgs = buildToolArgs(params.name, args);
|
|
1749
|
+
const run = await runVibeRavenDetailed(cliArgs, args.cwd);
|
|
1750
|
+
if (params.name === RLS_TOOL_NAME) return buildRlsToolResponse(run);
|
|
1751
|
+
const { text, stdout, exitCode, transportError } = run;
|
|
1236
1752
|
const parsed = parseJsonObjectFromToolText(stdout);
|
|
1753
|
+
const receipt = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : void 0;
|
|
1754
|
+
const approvalRefusal = params.name === "viberaven_heal_apply" && receipt?.status === "refused_dangerous";
|
|
1755
|
+
const textAuditFinding = params.name === "viberaven_audit" && !cliArgs.includes("--json") && !transportError && /^VibeRaven Vercel\/Supabase audit\r?\nStatus: needs_work\r?\n/.test(stdout) && /^NEEDS_WORK [a-z][a-z0-9-]*\r?$/m.test(stdout);
|
|
1756
|
+
const semanticFinding = exitCode === 1 && (textAuditFinding || receipt && !receipt.error && (SEMANTIC_FINDING_TOOLS.has(params.name) || approvalRefusal));
|
|
1757
|
+
const npmFinding = params.name === "viberaven_validate_npm_package" && exitCode === 2 && !transportError && isCompletedNegativeNpmVerdict(receipt);
|
|
1758
|
+
const isError = transportError || cliArgs.includes("--json") && !receipt || Boolean(receipt?.error) || exitCode !== 0 && !semanticFinding && !npmFinding || isLiveTool(params.name) && isLiveToolFailure(exitCode, parsed);
|
|
1237
1759
|
return {
|
|
1238
1760
|
content: [{ type: "text", text }],
|
|
1239
|
-
...
|
|
1761
|
+
...isError ? { isError: true } : {},
|
|
1240
1762
|
...parsed ? { structuredContent: parsed } : {}
|
|
1241
1763
|
};
|
|
1242
1764
|
}
|
|
@@ -1244,7 +1766,7 @@ async function handleRequest(method, params) {
|
|
|
1244
1766
|
}
|
|
1245
1767
|
|
|
1246
1768
|
// src/server.ts
|
|
1247
|
-
var SERVER_INFO = { name: "viberaven-mcp", version: "1.7.
|
|
1769
|
+
var SERVER_INFO = { name: "viberaven-mcp", version: "1.7.2" };
|
|
1248
1770
|
var INSTRUCTIONS = [
|
|
1249
1771
|
"VibeRaven reads a repository and lists launch gaps for AI-built apps that deploy on Vercel and use Supabase.",
|
|
1250
1772
|
"Suggest one viberaven_check_readiness run before such an app launches or is handed off, after a Supabase migration or policy change,",
|
|
@@ -1253,6 +1775,8 @@ var INSTRUCTIONS = [
|
|
|
1253
1775
|
"It is a repository check, not a live database test. It cannot show which RLS policies are live in production, and a clear result is not a security audit.",
|
|
1254
1776
|
"The existing repository checks are scoped to Vercel and Supabase; they do not cover every provider.",
|
|
1255
1777
|
"For feature planning, provider_playbook returns versioned provider knowledge independently of hosting. Read the supported pack and its limits; retrieval does not execute checks or connect to providers.",
|
|
1778
|
+
"Check recent_provider_changes before answering a provider error or updating a deployment. Pass redacted error keywords; dates and official sources give candidate explanations, not a diagnosis or proof of live state.",
|
|
1779
|
+
"For optional behavioral checks after reviewing a Supabase migration or ownership policy, viberaven_rls_test runs an already reviewed local permissions matrix for owner, other_user and anon. Read Pass, Fail and Unknown per cell; Unknown is inconclusive. This experimental PGlite imitation is not live Supabase proof. PGlite must already be installed next to the matching CLI used by the local MCP host; missing setup is a tool error with CLI guidance, not a passing result.",
|
|
1256
1780
|
"After fixes, call viberaven_verify once per batch, not after every edit."
|
|
1257
1781
|
].join(" ");
|
|
1258
1782
|
var server = new import_server.Server(SERVER_INFO, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
|