@visulima/vis-mcp 1.0.0-alpha.18 → 1.0.0-alpha.19

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/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## @visulima/vis-mcp [1.0.0-alpha.19](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.18...@visulima/vis-mcp@1.0.0-alpha.19) (2026-06-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **vis-mcp:** 1 bug fix ([33cd25e](https://github.com/visulima/visulima/commit/33cd25ecbcea0185e4cab1e3d49ba0fd41206d67))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.30
11
+ * **@visulima/path:** upgraded to 3.0.0-alpha.12
12
+ * **@visulima/vis:** upgraded to 1.0.0-alpha.29
13
+
1
14
  ## @visulima/vis-mcp [1.0.0-alpha.18](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.17...@visulima/vis-mcp@1.0.0-alpha.18) (2026-06-03)
2
15
 
3
16
 
package/dist/bin.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- var i=Object.defineProperty;var a=(r,t)=>i(r,"name",{value:t,configurable:!0});import{argv as e}from"node:process";import{fileURLToPath as o}from"node:url";import{startMcpServer as s}from"./packem_shared/registerAllTools-D6IL1GM-.js";var m=Object.defineProperty,c=a((r,t)=>m(r,"name",{value:t,configurable:!0}),"t");const n=c(async()=>{try{await s()}catch(r){process.stderr.write(`[vis-mcp] failed to start: ${r instanceof Error?r.message:String(r)}
2
+ var i=Object.defineProperty;var a=(r,t)=>i(r,"name",{value:t,configurable:!0});import{argv as e}from"node:process";import{fileURLToPath as o}from"node:url";import{startMcpServer as s}from"./packem_shared/registerAllTools-BJu525kf.js";var m=Object.defineProperty,c=a((r,t)=>m(r,"name",{value:t,configurable:!0}),"t");const n=c(async()=>{try{await s()}catch(r){process.stderr.write(`[vis-mcp] failed to start: ${r instanceof Error?r.message:String(r)}
3
3
  `),process.exit(1)}},"main"),p=e[1]!==void 0&&o(import.meta.url)===e[1];p&&await n();export{n as main};
package/dist/index.d.ts CHANGED
@@ -81,6 +81,12 @@ declare const createMcpServer: (context: ToolContext) => Promise<{
81
81
  * the JSON-RPC stream. Logs go to stderr only.
82
82
  */
83
83
  declare const startMcpServer: () => Promise<void>;
84
+ declare const registerAdvisoryStatus: ({
85
+ server
86
+ }: ToolDeps, context: ToolContext) => void;
87
+ declare const registerAudit: ({
88
+ server
89
+ }: ToolDeps, context: ToolContext) => void;
84
90
  declare const registerCacheHash: ({
85
91
  server
86
92
  }: ToolDeps, context: ToolContext) => void;
@@ -90,6 +96,9 @@ declare const registerCacheWhy: ({
90
96
  declare const registerDescribeProject: ({
91
97
  server
92
98
  }: ToolDeps, context: ToolContext) => void;
99
+ declare const registerDescribeTemplate: ({
100
+ server
101
+ }: ToolDeps, context: ToolContext) => void;
93
102
  declare const registerFmt: ({
94
103
  server
95
104
  }: ToolDeps, context: ToolContext) => void;
@@ -105,6 +114,9 @@ declare const registerListProjects: ({
105
114
  declare const registerListTargets: ({
106
115
  server
107
116
  }: ToolDeps, context: ToolContext) => void;
117
+ declare const registerListTemplates: ({
118
+ server
119
+ }: ToolDeps, context: ToolContext) => void;
108
120
  declare const isValidRunId: (value: string) => boolean;
109
121
  /**
110
122
  * Task IDs are `&lt;project>:&lt;target>`; both halves are package or npm-scope
@@ -112,4 +124,4 @@ declare const isValidRunId: (value: string) => boolean;
112
124
  * inert, but a leading `-` would be parsed as a CLI flag by the vis CLI.
113
125
  */
114
126
  declare const isValidTaskId: (value: string) => boolean;
115
- export { type ExecOptions, type ExecResult, type McpToolResponse, type ToolContext, type ToolDeps, createMcpServer, errorResponse, execVis, execVisJson, isValidRunId, isValidTaskId, okResponse, registerAllTools, registerCacheHash, registerCacheWhy, registerDescribeProject, registerFmt, registerGetRunLogs, registerLint, registerListProjects, registerListTargets, startMcpServer };
127
+ export { type ExecOptions, type ExecResult, type McpToolResponse, type ToolContext, type ToolDeps, createMcpServer, errorResponse, execVis, execVisJson, isValidRunId, isValidTaskId, okResponse, registerAdvisoryStatus, registerAllTools, registerAudit, registerCacheHash, registerCacheWhy, registerDescribeProject, registerDescribeTemplate, registerFmt, registerGetRunLogs, registerLint, registerListProjects, registerListTargets, registerListTemplates, startMcpServer };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{execVis as o,execVisJson as t}from"./packem_shared/execVis-BzS_F-9x.js";import{errorResponse as i,okResponse as p}from"./packem_shared/okResponse-DdzqnveW.js";import{createMcpServer as m,registerAllTools as f,startMcpServer as g}from"./packem_shared/registerAllTools-D6IL1GM-.js";import{registerCacheHash as a}from"./packem_shared/registerCacheHash-CVckSIVO.js";import{registerCacheWhy as l}from"./packem_shared/registerCacheWhy-CMzL-Pg3.js";import{registerDescribeProject as h}from"./packem_shared/registerDescribeProject-Dhuzun-I.js";import{registerFmt as R}from"./packem_shared/registerFmt-CFXIo-XC.js";import{registerGetRunLogs as T}from"./packem_shared/registerGetRunLogs-BxkRfYZU.js";import{registerLint as k}from"./packem_shared/registerLint-D3EpE2RG.js";import{registerListProjects as v}from"./packem_shared/registerListProjects-C-AZj8RT.js";import{registerListTargets as I}from"./packem_shared/registerListTargets-Cq6bkF7O.js";import{isValidRunId as P,isValidTaskId as S}from"./packem_shared/isValidRunId-BKsKMWQf.js";export{m as createMcpServer,i as errorResponse,o as execVis,t as execVisJson,P as isValidRunId,S as isValidTaskId,p as okResponse,f as registerAllTools,a as registerCacheHash,l as registerCacheWhy,h as registerDescribeProject,R as registerFmt,T as registerGetRunLogs,k as registerLint,v as registerListProjects,I as registerListTargets,g as startMcpServer};
1
+ import{execVis as t,execVisJson as o}from"./packem_shared/execVis-xKkBGVtU.js";import{errorResponse as i,okResponse as p}from"./packem_shared/okResponse-DdzqnveW.js";import{createMcpServer as x,registerAllTools as f,startMcpServer as g}from"./packem_shared/registerAllTools-BJu525kf.js";import{registerAdvisoryStatus as c}from"./packem_shared/registerAdvisoryStatus-C49m3wzN.js";import{registerAudit as d}from"./packem_shared/registerAudit-CxOquZ97.js";import{registerCacheHash as L}from"./packem_shared/registerCacheHash-DLWsJrko.js";import{registerCacheWhy as h}from"./packem_shared/registerCacheWhy-B8xDR5US.js";import{registerDescribeProject as R}from"./packem_shared/registerDescribeProject-B6aCBcmT.js";import{registerDescribeTemplate as v}from"./packem_shared/registerDescribeTemplate-DUso-ASt.js";import{registerFmt as S}from"./packem_shared/registerFmt-CRzEDH2d.js";import{registerGetRunLogs as j}from"./packem_shared/registerGetRunLogs-BxkRfYZU.js";import{registerLint as y}from"./packem_shared/registerLint-BhuCzD64.js";import{registerListProjects as D}from"./packem_shared/registerListProjects-DSpQ596w.js";import{registerListTargets as M}from"./packem_shared/registerListTargets-B1AHgnI3.js";import{registerListTemplates as F}from"./packem_shared/registerListTemplates-qsRGPfj0.js";import{isValidRunId as H,isValidTaskId as J}from"./packem_shared/isValidRunId-BKsKMWQf.js";export{x as createMcpServer,i as errorResponse,t as execVis,o as execVisJson,H as isValidRunId,J as isValidTaskId,p as okResponse,c as registerAdvisoryStatus,f as registerAllTools,d as registerAudit,L as registerCacheHash,h as registerCacheWhy,R as registerDescribeProject,v as registerDescribeTemplate,S as registerFmt,j as registerGetRunLogs,y as registerLint,D as registerListProjects,M as registerListTargets,F as registerListTemplates,g as startMcpServer};
@@ -0,0 +1,4 @@
1
+ var O=Object.defineProperty;var w=(i,t)=>O(i,"name",{value:t,configurable:!0});import{spawn as g}from"node:child_process";var $=Object.defineProperty,p=w((i,t)=>$(i,"name",{value:t,configurable:!0}),"a");const v=12e4,j=p(async(i,t,r={})=>{const s=r.timeoutMs??v,e={};for(const[a,n]of Object.entries(process.env))n!==void 0&&(e[a]=n);if(r.env)for(const[a,n]of Object.entries(r.env))n!==void 0&&(e[a]=n);e.NO_COLOR="1";const x={cwd:r.cwd??process.cwd(),env:e,stdio:["ignore","pipe","pipe"],windowsHide:!0};return await new Promise((a,n)=>{const o=g(process.execPath,[i,...t],x);let u="",m="",f=!1,d;const l=setTimeout(()=>{f=!0,o.kill("SIGTERM"),d=setTimeout(()=>o.kill("SIGKILL"),2e3),d.unref()},s);o.stdout?.setEncoding("utf8"),o.stdout?.on("data",c=>{u+=c}),o.stderr?.setEncoding("utf8"),o.stderr?.on("data",c=>{m+=c}),o.once("error",c=>{clearTimeout(l),d&&clearTimeout(d),n(c)}),o.once("close",c=>{clearTimeout(l),d&&clearTimeout(d),a({exitCode:c??-1,stderr:m,stdout:u,timedOut:f})})})},"execVis"),T=p(async(i,t,r={})=>{const s=await j(i,t,r);if(s.timedOut)throw new Error(`vis ${t.join(" ")} timed out after ${String(r.timeoutMs??v)}ms`);if(s.exitCode!==0){const e=s.stderr.trim().split(`
2
+ `).slice(-5).join(`
3
+ `);throw new Error(`vis ${t.join(" ")} exited with code ${String(s.exitCode)}${e?`
4
+ ${e}`:""}`)}try{return JSON.parse(s.stdout)}catch(e){throw new Error(`vis ${t.join(" ")} did not emit valid JSON: ${e instanceof Error?e.message:String(e)}`,{cause:e})}},"execVisJson");export{j as execVis,T as execVisJson};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var a=(t,s)=>c(t,"name",{value:s,configurable:!0});import*as e from"zod";import{execVisJson as d}from"./execVis-xKkBGVtU.js";import{okResponse as u,errorResponse as m}from"./okResponse-DdzqnveW.js";var l=Object.defineProperty,v=a((t,s)=>l(t,"name",{value:s,configurable:!0}),"a");const h=e.object({advisoryCount:e.number(),lastSyncIso:e.string(),manifestEtag:e.string().nullable(),name:e.string()}),p=e.object({dbPath:e.string(),ecosystems:e.array(h),exists:e.boolean(),schemaVersion:e.number(),sizeBytes:e.number()}).catchall(e.unknown()),g=v(({server:t},s)=>{t.registerTool("advisory_status",{annotations:{readOnlyHint:!0},description:"Report the local OSV advisory DB freshness via `vis advisories status --format json`: DB path, schema version, per-ecosystem advisory counts, last sync timestamp, and ETag. Use this to detect whether the offline cache is stale before running an `audit` in offline mode.",inputSchema:{db:e.string().min(1).optional().describe("Override the cache DB path (default: <cache>/vis/advisories/db.sqlite).")}},async o=>{try{const r=["advisories","status","--format","json"];o.db!==void 0&&r.push("--db",o.db);const i=await d(s.visBin,r,{cwd:s.workspaceRoot}),n=p.parse(i);return u(n)}catch(r){return m(r)}})},"registerAdvisoryStatus");export{g as registerAdvisoryStatus};
@@ -0,0 +1,3 @@
1
+ var g=Object.defineProperty;var l=(r,e)=>g(r,"name",{value:e,configurable:!0});import{readFile as d}from"node:fs/promises";import{createRequire as v}from"node:module";import{resolve as f,dirname as u}from"node:path";import{pathToFileURL as w,fileURLToPath as S}from"node:url";import{McpServer as b}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as h}from"@modelcontextprotocol/sdk/server/stdio.js";import{findUp as y}from"@visulima/fs";import{registerAdvisoryStatus as k}from"./registerAdvisoryStatus-C49m3wzN.js";import{registerAudit as j}from"./registerAudit-CxOquZ97.js";import{registerCacheHash as I}from"./registerCacheHash-DLWsJrko.js";import{registerCacheWhy as M}from"./registerCacheWhy-B8xDR5US.js";import{registerDescribeProject as T}from"./registerDescribeProject-B6aCBcmT.js";import{registerDescribeTemplate as _}from"./registerDescribeTemplate-DUso-ASt.js";import{registerFmt as C}from"./registerFmt-CRzEDH2d.js";import{registerGetRunLogs as L}from"./registerGetRunLogs-BxkRfYZU.js";import{registerLint as P}from"./registerLint-BhuCzD64.js";import{registerListProjects as R}from"./registerListProjects-DSpQ596w.js";import{registerListTargets as V}from"./registerListTargets-B1AHgnI3.js";import{registerListTemplates as A}from"./registerListTemplates-qsRGPfj0.js";var O=Object.defineProperty,i=l((r,e)=>O(r,"name",{value:e,configurable:!0}),"s");const q=i(r=>{const e=process.env.VIS_MCP_VIS_BIN;if(e)return f(e);const t=[{label:r,require:v(w(`${r}/package.json`))},{label:"vis-mcp install location",require:v(import.meta.url)}],a=[];let n,o;for(const{label:c,require:s}of t)try{n=s.resolve("@visulima/vis/package.json"),o=s("@visulima/vis/package.json");break}catch(m){a.push({error:m,label:c})}if(!n||!o){const c=a.at(-1)?.error,s=a.map(m=>m.label).join(", ");throw new Error(`Cannot resolve \`@visulima/vis\` (tried: ${s}). Install it as a workspace dependency, or set VIS_MCP_VIS_BIN to a vis CLI path.`,{cause:c})}const p=typeof o.bin=="string"?o.bin:o.bin?.vis;if(!p)throw new Error("`@visulima/vis` is installed but does not declare a `vis` bin entry — install a current version.");return f(u(n),p)},"resolveVisBin"),B=i(async()=>{try{const r=await y("package.json",{cwd:u(S(import.meta.url))});return r?JSON.parse(await d(r,"utf8")).version??"0.0.0":"0.0.0"}catch(r){return process.stderr.write(`[vis-mcp] failed to read package.json: ${r instanceof Error?r.message:String(r)}
2
+ `),"0.0.0"}},"loadVersion"),E=i((r,e)=>{R(r,e),T(r,e),V(r,e),A(r,e),_(r,e),L(r,e),M(r,e),I(r,e),j(r,e),k(r,e),P(r,e),C(r,e)},"registerAllTools"),$=i(async r=>{const e=new b({name:"vis",version:await B()}),t={server:e};return E(t,r),{deps:t,server:e}},"createMcpServer"),sr=i(async()=>{const r=process.env.VIS_MCP_WORKSPACE_ROOT??process.cwd(),e={visBin:q(r),workspaceRoot:r},{server:t}=await $(e);await t.connect(new h),process.stderr.write(`[vis-mcp] ready (workspace: ${e.workspaceRoot})
3
+ `)},"startMcpServer");export{$ as createMcpServer,E as registerAllTools,sr as startMcpServer};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var i=(s,r)=>c(s,"name",{value:r,configurable:!0});import*as e from"zod";import{execVisJson as l}from"./execVis-xKkBGVtU.js";import{okResponse as p,errorResponse as u}from"./okResponse-DdzqnveW.js";var d=Object.defineProperty,m=i((s,r)=>d(s,"name",{value:r,configurable:!0}),"a");const y=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),h=e.object({acceptedRisk:e.unknown().optional(),name:e.string(),socketAlerts:e.array(e.unknown()).optional(),socketScore:e.number().nullable().optional(),version:e.string(),vulnerabilities:e.array(y)}),b=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array(h),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),f=["low","medium","high","critical"],w=m(({server:s},r)=>{s.registerTool("audit",{annotations:{readOnlyHint:!0},description:"Audit installed packages for known vulnerabilities and supply-chain risk via `vis audit --format json`. Defaults to the local offline OSV cache when one exists, otherwise falls back to the live OSV API. Returns the parsed audit payload (results, duplicates, summary).",inputSchema:{ecosystem:e.string().optional().describe("Comma-separated OSV ecosystems to scan. Defaults to 'npm' (the only matcher wired today)."),offline:e.boolean().optional().describe("Force the local OSV cache. Errors if the cache is missing — run `vis advisories sync` first."),prodOnly:e.boolean().optional().describe("Skip devDependencies — scan the production graph only."),severity:e.enum(f).optional().describe("Minimum severity to report. Defaults to 'low'."),showAccepted:e.boolean().optional().describe("Include findings already on the workspace's accepted-risk list."),usage:e.boolean().optional().describe("Apply the reachability filter — only report vulnerabilities in statically-imported packages.")}},async o=>{try{const t=["audit","--format","json"];o.severity&&t.push("--severity",o.severity),o.offline&&t.push("--offline"),o.prodOnly&&t.push("--prod-only"),o.usage&&t.push("--usage"),o.ecosystem&&t.push("--ecosystem",o.ecosystem),o.showAccepted&&t.push("--show-accepted");const a=await l(r.visBin,t,{cwd:r.workspaceRoot}),n=b.parse(a);return p(n)}catch(t){return u(t)}})},"registerAudit");export{w as registerAudit};
@@ -1 +1 @@
1
- var d=Object.defineProperty;var s=(e,r)=>d(e,"name",{value:r,configurable:!0});import*as o from"zod";import{execVisJson as p}from"./execVis-BzS_F-9x.js";import{errorResponse as n,okResponse as u}from"./okResponse-DdzqnveW.js";import{isValidTaskId as h,isValidRunId as l}from"./isValidRunId-BKsKMWQf.js";var m=Object.defineProperty,f=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"n");const b=f(({server:e},r)=>{e.registerTool("cache_hash",{annotations:{readOnlyHint:!0},description:"Print the recorded hash and per-input hash details for a task — the contributing inputs (command, nodes, runtime, implicitDeps) that produced it.",inputSchema:{runId:o.string().optional().describe("Run ID to inspect (default: latest)"),taskId:o.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:i})=>{if(!h(i))return n(new Error(`Invalid taskId "${i}". Expected "<project>:<target>".`));if(t!==void 0&&!l(t))return n(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const a=["cache","hash",i,"--format=json"];t&&a.push("--run",t);const c=await p(r.visBin,a,{cwd:r.workspaceRoot});return u(c)}catch(a){return n(a)}})},"registerCacheHash");export{b as registerCacheHash};
1
+ var d=Object.defineProperty;var s=(e,r)=>d(e,"name",{value:r,configurable:!0});import*as o from"zod";import{execVisJson as p}from"./execVis-xKkBGVtU.js";import{errorResponse as n,okResponse as u}from"./okResponse-DdzqnveW.js";import{isValidTaskId as h,isValidRunId as l}from"./isValidRunId-BKsKMWQf.js";var m=Object.defineProperty,f=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"n");const b=f(({server:e},r)=>{e.registerTool("cache_hash",{annotations:{readOnlyHint:!0},description:"Print the recorded hash and per-input hash details for a task — the contributing inputs (command, nodes, runtime, implicitDeps) that produced it.",inputSchema:{runId:o.string().optional().describe("Run ID to inspect (default: latest)"),taskId:o.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:i})=>{if(!h(i))return n(new Error(`Invalid taskId "${i}". Expected "<project>:<target>".`));if(t!==void 0&&!l(t))return n(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const a=["cache","hash",i,"--format=json"];t&&a.push("--run",t);const c=await p(r.visBin,a,{cwd:r.workspaceRoot});return u(c)}catch(a){return n(a)}})},"registerCacheHash");export{b as registerCacheHash};
@@ -1 +1 @@
1
- var d=Object.defineProperty;var n=(r,e)=>d(r,"name",{value:e,configurable:!0});import*as o from"zod";import{execVisJson as p}from"./execVis-BzS_F-9x.js";import{errorResponse as i,okResponse as u}from"./okResponse-DdzqnveW.js";import{isValidTaskId as h,isValidRunId as l}from"./isValidRunId-BKsKMWQf.js";var m=Object.defineProperty,f=n((r,e)=>m(r,"name",{value:e,configurable:!0}),"i");const w=f(({server:r},e)=>{r.registerTool("cache_why",{annotations:{readOnlyHint:!0},description:"Explain why a task's cache hash rotated between runs. Diffs the task's hashDetails (command, nodes, runtime, implicitDeps) against the previous run to pinpoint what changed.",inputSchema:{runId:o.string().optional().describe("Run ID to inspect (default: latest)"),taskId:o.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:a})=>{if(!h(a))return i(new Error(`Invalid taskId "${a}". Expected "<project>:<target>".`));if(t!==void 0&&!l(t))return i(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const s=["cache","why",a,"--format=json"];t&&s.push("--run",t);const c=await p(e.visBin,s,{cwd:e.workspaceRoot});return u(c)}catch(s){return i(s)}})},"registerCacheWhy");export{w as registerCacheWhy};
1
+ var d=Object.defineProperty;var n=(r,e)=>d(r,"name",{value:e,configurable:!0});import*as o from"zod";import{execVisJson as p}from"./execVis-xKkBGVtU.js";import{errorResponse as i,okResponse as u}from"./okResponse-DdzqnveW.js";import{isValidTaskId as h,isValidRunId as l}from"./isValidRunId-BKsKMWQf.js";var m=Object.defineProperty,f=n((r,e)=>m(r,"name",{value:e,configurable:!0}),"i");const w=f(({server:r},e)=>{r.registerTool("cache_why",{annotations:{readOnlyHint:!0},description:"Explain why a task's cache hash rotated between runs. Diffs the task's hashDetails (command, nodes, runtime, implicitDeps) against the previous run to pinpoint what changed.",inputSchema:{runId:o.string().optional().describe("Run ID to inspect (default: latest)"),taskId:o.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:a})=>{if(!h(a))return i(new Error(`Invalid taskId "${a}". Expected "<project>:<target>".`));if(t!==void 0&&!l(t))return i(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const s=["cache","why",a,"--format=json"];t&&s.push("--run",t);const c=await p(e.visBin,s,{cwd:e.workspaceRoot});return u(c)}catch(s){return i(s)}})},"registerCacheWhy");export{w as registerCacheWhy};
@@ -1 +1 @@
1
- var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import*as c from"zod";import{execVisJson as p}from"./execVis-BzS_F-9x.js";import{okResponse as l,errorResponse as s}from"./okResponse-DdzqnveW.js";var m=Object.defineProperty,g=a((r,e)=>m(r,"name",{value:e,configurable:!0}),"n");const b=g(({server:r},e)=>{r.registerTool("describe_project",{annotations:{readOnlyHint:!0},description:"Return full metadata for a single workspace project: language, layer, stack, type, tags, root path, and all targets.",inputSchema:{name:c.string().describe('Project name (e.g. "@visulima/cerebro")')}},async({name:o})=>{try{const t=(await p(e.visBin,["list","--json"],{cwd:e.workspaceRoot})).find(n=>n.name===o);return t?l(t):s(new Error(`No project named "${o}". Use list_projects to see available names.`))}catch(t){return s(t)}})},"registerDescribeProject");export{b as registerDescribeProject};
1
+ var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import*as c from"zod";import{execVisJson as p}from"./execVis-xKkBGVtU.js";import{okResponse as l,errorResponse as s}from"./okResponse-DdzqnveW.js";var m=Object.defineProperty,g=a((r,e)=>m(r,"name",{value:e,configurable:!0}),"n");const b=g(({server:r},e)=>{r.registerTool("describe_project",{annotations:{readOnlyHint:!0},description:"Return full metadata for a single workspace project: language, layer, stack, type, tags, root path, and all targets.",inputSchema:{name:c.string().describe('Project name (e.g. "@visulima/cerebro")')}},async({name:o})=>{try{const t=(await p(e.visBin,["list","--json"],{cwd:e.workspaceRoot})).find(n=>n.name===o);return t?l(t):s(new Error(`No project named "${o}". Use list_projects to see available names.`))}catch(t){return s(t)}})},"registerDescribeProject");export{b as registerDescribeProject};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var a=(t,e)=>s(t,"name",{value:e,configurable:!0});import*as o from"zod";import{execVisJson as i}from"./execVis-xKkBGVtU.js";import{okResponse as c,errorResponse as m}from"./okResponse-DdzqnveW.js";var l=Object.defineProperty,p=a((t,e)=>l(t,"name",{value:e,configurable:!0}),"r");const g=p(({server:t},e)=>{t.registerTool("describe_template",{annotations:{readOnlyHint:!0},description:"Return full metadata for a scaffolding template: description, default destination, and the variable schema (name, type, default, required, prompt, enum values). Use this before suggesting a `vis generate` command so option values can be filled correctly.",inputSchema:{name:o.string().describe('Template name (e.g. "package", "component"). Use list_templates to see available names.')}},async({name:n})=>{try{const r=await i(e.visBin,["generate",n,"--describe","--json"],{cwd:e.workspaceRoot});return c(r)}catch(r){return m(r)}})},"registerDescribeTemplate");export{g as registerDescribeTemplate};
@@ -1,4 +1,4 @@
1
- var m=Object.defineProperty;var l=(s,i)=>m(s,"name",{value:i,configurable:!0});import*as e from"zod";import{execVis as u}from"./execVis-BzS_F-9x.js";import{errorResponse as a,okResponse as f}from"./okResponse-DdzqnveW.js";var p=Object.defineProperty,h=l((s,i)=>p(s,"name",{value:i,configurable:!0}),"d");const g=e.object({adapter:e.string(),column:e.number().optional(),file:e.string(),fixable:e.boolean().optional(),line:e.number().optional(),message:e.string(),ruleId:e.string().optional(),severity:e.enum(["error","info","warning"])}).catchall(e.unknown()),v=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),b=e.object({findings:e.array(g),mode:e.enum(["check","fix"]).optional(),runs:e.array(v)}).catchall(e.unknown()),x=h(({server:s},i)=>{s.registerTool("fmt",{annotations:{readOnlyHint:!0},description:"Run the vis fmt orchestrator in --check mode via `vis fmt --check --format json`. Auto-detects every installed formatter (oxfmt, biome, dprint, prettier, ruff-fmt, deno-fmt) and returns the merged { findings, runs } payload — each finding represents a file that would change. This tool never writes to disk; invoke `vis fmt` directly to apply the formatting.",inputSchema:{files:e.array(e.string()).optional().describe("Restrict the check to these files (relative to the workspace root). Empty/omitted = workspace-wide."),quiet:e.boolean().optional().describe("Suppress per-file logs (findings still flow through)."),since:e.string().optional().describe("Forward `--since <ref>` so only files changed vs `<ref>` are checked."),staged:e.boolean().optional().describe("Forward `--staged` so only files in the git index are checked.")}},async t=>{try{const r=["fmt","--check","--format","json"];t.quiet&&r.push("--quiet"),t.staged?r.push("--staged"):t.since!==void 0&&t.since.length>0&&r.push("--since",t.since),t.files&&t.files.length>0&&r.push(...t.files);const n=await u(i.visBin,r,{cwd:i.workspaceRoot});if(n.timedOut)return a(new Error("vis fmt timed out"));if(n.stdout.trim().length===0){const o=n.stderr.trim().split(`
1
+ var m=Object.defineProperty;var l=(s,i)=>m(s,"name",{value:i,configurable:!0});import*as e from"zod";import{execVis as u}from"./execVis-xKkBGVtU.js";import{errorResponse as a,okResponse as f}from"./okResponse-DdzqnveW.js";var p=Object.defineProperty,h=l((s,i)=>p(s,"name",{value:i,configurable:!0}),"d");const g=e.object({adapter:e.string(),column:e.number().optional(),file:e.string(),fixable:e.boolean().optional(),line:e.number().optional(),message:e.string(),ruleId:e.string().optional(),severity:e.enum(["error","info","warning"])}).catchall(e.unknown()),v=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),b=e.object({findings:e.array(g),mode:e.enum(["check","fix"]).optional(),runs:e.array(v)}).catchall(e.unknown()),x=h(({server:s},i)=>{s.registerTool("fmt",{annotations:{readOnlyHint:!0},description:"Run the vis fmt orchestrator in --check mode via `vis fmt --check --format json`. Auto-detects every installed formatter (oxfmt, biome, dprint, prettier, ruff-fmt, deno-fmt) and returns the merged { findings, runs } payload — each finding represents a file that would change. This tool never writes to disk; invoke `vis fmt` directly to apply the formatting.",inputSchema:{files:e.array(e.string()).optional().describe("Restrict the check to these files (relative to the workspace root). Empty/omitted = workspace-wide."),quiet:e.boolean().optional().describe("Suppress per-file logs (findings still flow through)."),since:e.string().optional().describe("Forward `--since <ref>` so only files changed vs `<ref>` are checked."),staged:e.boolean().optional().describe("Forward `--staged` so only files in the git index are checked.")}},async t=>{try{const r=["fmt","--check","--format","json"];t.quiet&&r.push("--quiet"),t.staged?r.push("--staged"):t.since!==void 0&&t.since.length>0&&r.push("--since",t.since),t.files&&t.files.length>0&&r.push(...t.files);const n=await u(i.visBin,r,{cwd:i.workspaceRoot});if(n.timedOut)return a(new Error("vis fmt timed out"));if(n.stdout.trim().length===0){const o=n.stderr.trim().split(`
2
2
  `).slice(-5).join(`
3
3
  `);return a(new Error(`vis fmt exited with code ${String(n.exitCode)} and no JSON output${o?`
4
4
  ${o}`:""}`))}let c;try{c=JSON.parse(n.stdout)}catch(o){return a(new Error(`vis ${r.join(" ")} did not emit valid JSON: ${o instanceof Error?o.message:String(o)}`,{cause:o}))}const d=b.parse(c);return f({...d,exitCode:n.exitCode,mode:d.mode??"check"})}catch(r){return a(r)}})},"registerFmt");export{x as registerFmt};
@@ -1,4 +1,4 @@
1
- var u=Object.defineProperty;var d=(s,r)=>u(s,"name",{value:r,configurable:!0});import*as e from"zod";import{execVis as p}from"./execVis-BzS_F-9x.js";import{errorResponse as a,okResponse as g}from"./okResponse-DdzqnveW.js";var m=Object.defineProperty,f=d((s,r)=>m(s,"name",{value:r,configurable:!0}),"d");const h=e.object({adapter:e.string(),column:e.number().optional(),endColumn:e.number().optional(),endLine:e.number().optional(),file:e.string(),fixable:e.boolean().optional(),line:e.number().optional(),message:e.string(),ruleId:e.string().optional(),severity:e.enum(["error","info","warning"])}).catchall(e.unknown()),b=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),v=e.object({findings:e.array(h),runs:e.array(b)}).catchall(e.unknown()),k=f(({server:s},r)=>{s.registerTool("lint",{annotations:{readOnlyHint:!0},description:"Run the vis lint orchestrator in check-only mode via `vis lint --format json`. Auto-detects every installed linter (oxlint, biome, eslint, stylelint, ruff, markdownlint, shellcheck, deno-lint) and returns the merged { findings, runs } payload. This tool never applies fixes — invoke `vis lint --fix` directly for that.",inputSchema:{files:e.array(e.string()).optional().describe("Restrict the run to these files (relative to the workspace root). Empty/omitted = workspace-wide."),maxWarnings:e.int().nonnegative().optional().describe("Forward `--max-warnings N` to every adapter that supports it."),quiet:e.boolean().optional().describe("Suppress warning-severity findings (errors still flow through)."),since:e.string().optional().describe("Forward `--since <ref>` so only files changed vs `<ref>` are linted."),staged:e.boolean().optional().describe("Forward `--staged` so only files in the git index are linted.")}},async t=>{try{const i=["lint","--format","json"];t.quiet&&i.push("--quiet"),typeof t.maxWarnings=="number"&&i.push("--max-warnings",String(t.maxWarnings)),t.staged?i.push("--staged"):t.since!==void 0&&t.since.length>0&&i.push("--since",t.since),t.files&&t.files.length>0&&i.push(...t.files);const o=await p(r.visBin,i,{cwd:r.workspaceRoot});if(o.timedOut)return a(new Error("vis lint timed out"));if(o.stdout.trim().length===0){const n=o.stderr.trim().split(`
1
+ var u=Object.defineProperty;var d=(s,r)=>u(s,"name",{value:r,configurable:!0});import*as e from"zod";import{execVis as p}from"./execVis-xKkBGVtU.js";import{errorResponse as a,okResponse as g}from"./okResponse-DdzqnveW.js";var m=Object.defineProperty,f=d((s,r)=>m(s,"name",{value:r,configurable:!0}),"d");const h=e.object({adapter:e.string(),column:e.number().optional(),endColumn:e.number().optional(),endLine:e.number().optional(),file:e.string(),fixable:e.boolean().optional(),line:e.number().optional(),message:e.string(),ruleId:e.string().optional(),severity:e.enum(["error","info","warning"])}).catchall(e.unknown()),b=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),v=e.object({findings:e.array(h),runs:e.array(b)}).catchall(e.unknown()),k=f(({server:s},r)=>{s.registerTool("lint",{annotations:{readOnlyHint:!0},description:"Run the vis lint orchestrator in check-only mode via `vis lint --format json`. Auto-detects every installed linter (oxlint, biome, eslint, stylelint, ruff, markdownlint, shellcheck, deno-lint) and returns the merged { findings, runs } payload. This tool never applies fixes — invoke `vis lint --fix` directly for that.",inputSchema:{files:e.array(e.string()).optional().describe("Restrict the run to these files (relative to the workspace root). Empty/omitted = workspace-wide."),maxWarnings:e.int().nonnegative().optional().describe("Forward `--max-warnings N` to every adapter that supports it."),quiet:e.boolean().optional().describe("Suppress warning-severity findings (errors still flow through)."),since:e.string().optional().describe("Forward `--since <ref>` so only files changed vs `<ref>` are linted."),staged:e.boolean().optional().describe("Forward `--staged` so only files in the git index are linted.")}},async t=>{try{const i=["lint","--format","json"];t.quiet&&i.push("--quiet"),typeof t.maxWarnings=="number"&&i.push("--max-warnings",String(t.maxWarnings)),t.staged?i.push("--staged"):t.since!==void 0&&t.since.length>0&&i.push("--since",t.since),t.files&&t.files.length>0&&i.push(...t.files);const o=await p(r.visBin,i,{cwd:r.workspaceRoot});if(o.timedOut)return a(new Error("vis lint timed out"));if(o.stdout.trim().length===0){const n=o.stderr.trim().split(`
2
2
  `).slice(-5).join(`
3
3
  `);return a(new Error(`vis lint exited with code ${String(o.exitCode)} and no JSON output${n?`
4
4
  ${n}`:""}`))}let l;try{l=JSON.parse(o.stdout)}catch(n){return a(new Error(`vis ${i.join(" ")} did not emit valid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n}))}const c=v.parse(l);return g({...c,exitCode:o.exitCode})}catch(i){return a(i)}})},"registerLint");export{k as registerLint};
@@ -1 +1 @@
1
- var n=Object.defineProperty;var i=(t,e)=>n(t,"name",{value:e,configurable:!0});import*as a from"zod";import{execVisJson as c}from"./execVis-BzS_F-9x.js";import{okResponse as p,errorResponse as l}from"./okResponse-DdzqnveW.js";var g=Object.defineProperty,u=i((t,e)=>g(t,"name",{value:e,configurable:!0}),"n");const f=u(({server:t},e)=>{t.registerTool("list_projects",{annotations:{readOnlyHint:!0},description:'List all workspace projects with their language, type, layer, tags, and target metadata. Optionally filter with a vis query string (e.g. "tag=frontend", "type=application").',inputSchema:{query:a.string().optional().describe('Filter projects by vis query string (e.g. "tag=frontend")')}},async({query:s})=>{try{const r=["list","--json"];s&&r.push("--query",s);const o=await c(e.visBin,r,{cwd:e.workspaceRoot});return p({count:o.length,projects:o})}catch(r){return l(r)}})},"registerListProjects");export{f as registerListProjects};
1
+ var n=Object.defineProperty;var i=(t,e)=>n(t,"name",{value:e,configurable:!0});import*as a from"zod";import{execVisJson as c}from"./execVis-xKkBGVtU.js";import{okResponse as p,errorResponse as l}from"./okResponse-DdzqnveW.js";var g=Object.defineProperty,u=i((t,e)=>g(t,"name",{value:e,configurable:!0}),"n");const f=u(({server:t},e)=>{t.registerTool("list_projects",{annotations:{readOnlyHint:!0},description:'List all workspace projects with their language, type, layer, tags, and target metadata. Optionally filter with a vis query string (e.g. "tag=frontend", "type=application").',inputSchema:{query:a.string().optional().describe('Filter projects by vis query string (e.g. "tag=frontend")')}},async({query:s})=>{try{const r=["list","--json"];s&&r.push("--query",s);const o=await c(e.visBin,r,{cwd:e.workspaceRoot});return p({count:o.length,projects:o})}catch(r){return l(r)}})},"registerListProjects");export{f as registerListProjects};
@@ -1 +1 @@
1
- var l=Object.defineProperty;var c=(t,e)=>l(t,"name",{value:e,configurable:!0});import*as g from"zod";import{execVisJson as m}from"./execVis-BzS_F-9x.js";import{errorResponse as p,okResponse as j}from"./okResponse-DdzqnveW.js";var u=Object.defineProperty,d=c((t,e)=>u(t,"name",{value:e,configurable:!0}),"c");const v=d(({server:t},e)=>{t.registerTool("list_targets",{annotations:{readOnlyHint:!0},description:"List per-target rows across the workspace: which targets each project exposes, with type, command, and description. Optionally narrow to a single project.",inputSchema:{project:g.string().optional().describe('Limit to one project (e.g. "@visulima/cerebro")')}},async({project:r})=>{try{const o=await m(e.visBin,["list","--targets","--json"],{cwd:e.workspaceRoot}),a=r?o.filter(s=>s.name===r):o;if(r&&a.length===0)return p(new Error(`No project named "${r}". Use list_projects to see available names.`));const n=a.flatMap(s=>(s.targets??[]).map(i=>({project:s.name,target:i.name,...i})));return j({count:n.length,targets:n})}catch(o){return p(o)}})},"registerListTargets");export{v as registerListTargets};
1
+ var l=Object.defineProperty;var c=(t,e)=>l(t,"name",{value:e,configurable:!0});import*as g from"zod";import{execVisJson as m}from"./execVis-xKkBGVtU.js";import{errorResponse as p,okResponse as j}from"./okResponse-DdzqnveW.js";var u=Object.defineProperty,d=c((t,e)=>u(t,"name",{value:e,configurable:!0}),"c");const v=d(({server:t},e)=>{t.registerTool("list_targets",{annotations:{readOnlyHint:!0},description:"List per-target rows across the workspace: which targets each project exposes, with type, command, and description. Optionally narrow to a single project.",inputSchema:{project:g.string().optional().describe('Limit to one project (e.g. "@visulima/cerebro")')}},async({project:r})=>{try{const o=await m(e.visBin,["list","--targets","--json"],{cwd:e.workspaceRoot}),a=r?o.filter(s=>s.name===r):o;if(r&&a.length===0)return p(new Error(`No project named "${r}". Use list_projects to see available names.`));const n=a.flatMap(s=>(s.targets??[]).map(i=>({...i,project:s.name,target:i.name})));return j({count:n.length,targets:n})}catch(o){return p(o)}})},"registerListTargets");export{v as registerListTargets};
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var r=(t,e)=>n(t,"name",{value:e,configurable:!0});import{execVisJson as o}from"./execVis-xKkBGVtU.js";import{okResponse as i,errorResponse as a}from"./okResponse-DdzqnveW.js";var c=Object.defineProperty,p=r((t,e)=>c(t,"name",{value:e,configurable:!0}),"n");const u=p(({server:t},e)=>{t.registerTool("list_templates",{annotations:{readOnlyHint:!0},description:"List scaffolding templates discovered in the workspace (`.vis/templates/`, `.moon/templates/`, and `vis.config.ts` `generator.templates`). Each entry includes name, source, on-disk path, and one-line description.",inputSchema:{}},async()=>{try{const s=await o(e.visBin,["generate","--list","--json"],{cwd:e.workspaceRoot});return i({count:s.length,templates:s})}catch(s){return a(s)}})},"registerListTemplates");export{u as registerListTemplates};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/vis-mcp",
3
- "version": "1.0.0-alpha.18",
3
+ "version": "1.0.0-alpha.19",
4
4
  "description": "MCP (Model Context Protocol) server for @visulima/vis — exposes vis tooling to AI agents over stdio",
5
5
  "keywords": [
6
6
  "agent",
@@ -55,12 +55,12 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@modelcontextprotocol/sdk": "^1.29.0",
58
- "@visulima/fs": "5.0.0-alpha.29",
59
- "@visulima/path": "3.0.0-alpha.11",
58
+ "@visulima/fs": "5.0.0-alpha.30",
59
+ "@visulima/path": "3.0.0-alpha.12",
60
60
  "zod": "4.4.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@visulima/vis": "1.0.0-alpha.28"
63
+ "@visulima/vis": "1.0.0-alpha.29"
64
64
  },
65
65
  "engines": {
66
66
  "node": "^22.14.0 || >=24.10.0"
@@ -1,4 +0,0 @@
1
- var x=Object.defineProperty;var m=(i,e)=>x(i,"name",{value:e,configurable:!0});import{spawn as v}from"node:child_process";var g=Object.defineProperty,w=m((i,e)=>g(i,"name",{value:e,configurable:!0}),"c");const l=12e4,O=w(async(i,e,n={})=>{const o=n.timeoutMs??l,t={cwd:n.cwd??process.cwd(),env:{...process.env,...n.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"],windowsHide:!0};return await new Promise((p,f)=>{const r=v(process.execPath,[i,...e],t);let c="",d="",a=!1;const u=setTimeout(()=>{a=!0,r.kill("SIGTERM"),setTimeout(()=>r.kill("SIGKILL"),2e3).unref()},o);r.stdout?.setEncoding("utf8"),r.stdout?.on("data",s=>{c+=s}),r.stderr?.setEncoding("utf8"),r.stderr?.on("data",s=>{d+=s}),r.once("error",s=>{clearTimeout(u),f(s)}),r.once("close",s=>{clearTimeout(u),p({exitCode:s??-1,stderr:d,stdout:c,timedOut:a})})})},"execVis"),S=w(async(i,e,n={})=>{const o=await O(i,e,n);if(o.timedOut)throw new Error(`vis ${e.join(" ")} timed out after ${String(n.timeoutMs??l)}ms`);if(o.exitCode!==0){const t=o.stderr.trim().split(`
2
- `).slice(-5).join(`
3
- `);throw new Error(`vis ${e.join(" ")} exited with code ${String(o.exitCode)}${t?`
4
- ${t}`:""}`)}try{return JSON.parse(o.stdout)}catch(t){throw new Error(`vis ${e.join(" ")} did not emit valid JSON: ${t instanceof Error?t.message:String(t)}`,{cause:t})}},"execVisJson");export{O as execVis,S as execVisJson};
@@ -1,3 +0,0 @@
1
- var b=Object.defineProperty;var n=(t,r)=>b(t,"name",{value:r,configurable:!0});import{readFile as w}from"node:fs/promises";import{createRequire as g}from"node:module";import{resolve as y,dirname as h}from"node:path";import{pathToFileURL as k,fileURLToPath as S}from"node:url";import{McpServer as j}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as O}from"@modelcontextprotocol/sdk/server/stdio.js";import{findUp as R}from"@visulima/fs";import*as e from"zod";import{execVisJson as p}from"./execVis-BzS_F-9x.js";import{okResponse as m,errorResponse as u}from"./okResponse-DdzqnveW.js";import{registerCacheHash as T}from"./registerCacheHash-CVckSIVO.js";import{registerCacheWhy as V}from"./registerCacheWhy-CMzL-Pg3.js";import{registerDescribeProject as P}from"./registerDescribeProject-Dhuzun-I.js";import{registerFmt as A}from"./registerFmt-CFXIo-XC.js";import{registerGetRunLogs as _}from"./registerGetRunLogs-BxkRfYZU.js";import{registerLint as B}from"./registerLint-D3EpE2RG.js";import{registerListProjects as I}from"./registerListProjects-C-AZj8RT.js";import{registerListTargets as C}from"./registerListTargets-Cq6bkF7O.js";var D=Object.defineProperty,L=n((t,r)=>D(t,"name",{value:r,configurable:!0}),"a$1");const M=e.object({advisoryCount:e.number(),lastSyncIso:e.string(),manifestEtag:e.string().nullable(),name:e.string()}),E=e.object({dbPath:e.string(),ecosystems:e.array(M),exists:e.boolean(),schemaVersion:e.number(),sizeBytes:e.number()}).catchall(e.unknown()),q=L(({server:t},r)=>{t.registerTool("advisory_status",{annotations:{readOnlyHint:!0},description:"Report the local OSV advisory DB freshness via `vis advisories status --format json`: DB path, schema version, per-ecosystem advisory counts, last sync timestamp, and ETag. Use this to detect whether the offline cache is stale before running an `audit` in offline mode.",inputSchema:{db:e.string().min(1).optional().describe("Override the cache DB path (default: <cache>/vis/advisories/db.sqlite).")}},async s=>{try{const a=["advisories","status","--format","json"];s.db!==void 0&&a.push("--db",s.db);const i=await p(r.visBin,a,{cwd:r.workspaceRoot}),o=E.parse(i);return m(o)}catch(a){return u(a)}})},"registerAdvisoryStatus");var U=Object.defineProperty,$=n((t,r)=>U(t,"name",{value:r,configurable:!0}),"a");const x=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),H=e.object({acceptedRisk:e.unknown().optional(),name:e.string(),socketAlerts:e.array(e.unknown()).optional(),socketScore:e.number().nullable().optional(),version:e.string(),vulnerabilities:e.array(x)}),F=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array(H),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),N=["low","medium","high","critical"],J=$(({server:t},r)=>{t.registerTool("audit",{annotations:{readOnlyHint:!0},description:"Audit installed packages for known vulnerabilities and supply-chain risk via `vis audit --format json`. Defaults to the local offline OSV cache when one exists, otherwise falls back to the live OSV API. Returns the parsed audit payload (results, duplicates, summary).",inputSchema:{ecosystem:e.string().optional().describe("Comma-separated OSV ecosystems to scan. Defaults to 'npm' (the only matcher wired today)."),offline:e.boolean().optional().describe("Force the local OSV cache. Errors if the cache is missing — run `vis advisories sync` first."),prodOnly:e.boolean().optional().describe("Skip devDependencies — scan the production graph only."),severity:e.enum(N).optional().describe("Minimum severity to report. Defaults to 'low'."),showAccepted:e.boolean().optional().describe("Include findings already on the workspace's accepted-risk list."),usage:e.boolean().optional().describe("Apply the reachability filter — only report vulnerabilities in statically-imported packages.")}},async s=>{try{const a=["audit","--format","json"];s.severity&&a.push("--severity",s.severity),s.offline&&a.push("--offline"),s.prodOnly&&a.push("--prod-only"),s.usage&&a.push("--usage"),s.ecosystem&&a.push("--ecosystem",s.ecosystem),s.showAccepted&&a.push("--show-accepted");const i=await p(r.visBin,a,{cwd:r.workspaceRoot}),o=F.parse(i);return m(o)}catch(a){return u(a)}})},"registerAudit");var W=Object.defineProperty,z=n((t,r)=>W(t,"name",{value:r,configurable:!0}),"r");const G=z(({server:t},r)=>{t.registerTool("describe_template",{annotations:{readOnlyHint:!0},description:"Return full metadata for a scaffolding template: description, default destination, and the variable schema (name, type, default, required, prompt, enum values). Use this before suggesting a `vis generate` command so option values can be filled correctly.",inputSchema:{name:e.string().describe('Template name (e.g. "package", "component"). Use list_templates to see available names.')}},async({name:s})=>{try{const a=await p(r.visBin,["generate",s,"--describe","--json"],{cwd:r.workspaceRoot});return m(a)}catch(a){return u(a)}})},"registerDescribeTemplate");var K=Object.defineProperty,Q=n((t,r)=>K(t,"name",{value:r,configurable:!0}),"n");const X=Q(({server:t},r)=>{t.registerTool("list_templates",{annotations:{readOnlyHint:!0},description:"List scaffolding templates discovered in the workspace (`.vis/templates/`, `.moon/templates/`, and `vis.config.ts` `generator.templates`). Each entry includes name, source, on-disk path, and one-line description.",inputSchema:{}},async()=>{try{const s=await p(r.visBin,["generate","--list","--json"],{cwd:r.workspaceRoot});return m({count:s.length,templates:s})}catch(s){return u(s)}})},"registerListTemplates");var Y=Object.defineProperty,c=n((t,r)=>Y(t,"name",{value:r,configurable:!0}),"s");const Z=c(t=>{const r=process.env.VIS_MCP_VIS_BIN;if(r)return y(r);const s=[{label:t,require:g(k(`${t}/package.json`))},{label:"vis-mcp install location",require:g(import.meta.url)}],a=[];let i,o;for(const{label:d,require:l}of s)try{i=l.resolve("@visulima/vis/package.json"),o=l("@visulima/vis/package.json");break}catch(v){a.push({error:v,label:d})}if(!i||!o){const d=a.at(-1)?.error,l=a.map(v=>v.label).join(", ");throw new Error(`Cannot resolve \`@visulima/vis\` (tried: ${l}). Install it as a workspace dependency, or set VIS_MCP_VIS_BIN to a vis CLI path.`,{cause:d})}const f=typeof o.bin=="string"?o.bin:o.bin?.vis;if(!f)throw new Error("`@visulima/vis` is installed but does not declare a `vis` bin entry — install a current version.");return y(h(i),f)},"resolveVisBin"),ee=c(async()=>{try{const t=await R("package.json",{cwd:h(S(import.meta.url))});return t?JSON.parse(await w(t,"utf8")).version??"0.0.0":"0.0.0"}catch(t){return process.stderr.write(`[vis-mcp] failed to read package.json: ${t instanceof Error?t.message:String(t)}
2
- `),"0.0.0"}},"loadVersion"),te=c((t,r)=>{I(t,r),P(t,r),C(t,r),X(t,r),G(t,r),_(t,r),V(t,r),T(t,r),J(t,r),q(t,r),B(t,r),A(t,r)},"registerAllTools"),re=c(async t=>{const r=new j({name:"vis",version:await ee()}),s={server:r};return te(s,t),{deps:s,server:r}},"createMcpServer"),ke=c(async()=>{const t=process.env.VIS_MCP_WORKSPACE_ROOT??process.cwd(),r={visBin:Z(t),workspaceRoot:t},{server:s}=await re(r);await s.connect(new O),process.stderr.write(`[vis-mcp] ready (workspace: ${r.workspaceRoot})
3
- `)},"startMcpServer");export{re as createMcpServer,te as registerAllTools,ke as startMcpServer};