@visulima/vis-mcp 1.0.0-alpha.16 → 1.0.0-alpha.17

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,27 @@
1
+ ## @visulima/vis-mcp [1.0.0-alpha.17](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.16...@visulima/vis-mcp@1.0.0-alpha.17) (2026-06-02)
2
+
3
+ ### Features
4
+
5
+ * **vis:** lint + fmt orchestrator ([3a78ed7](https://github.com/visulima/visulima/commit/3a78ed709922e6a35648e0d0eb3f41cc49f89b7a))
6
+
7
+ ### Bug Fixes
8
+
9
+ * **tests:** revert unsafe vitest autofixes from the lint sweep ([378f27c](https://github.com/visulima/visulima/commit/378f27caa370f1d3188aef2ed36d46839abc88c4))
10
+
11
+ ### Miscellaneous Chores
12
+
13
+ * apply eslint + prettier autofixes across packages ([c1bb784](https://github.com/visulima/visulima/commit/c1bb7848a0d93d0dfe2960c77e3cda22239c79a0))
14
+
15
+ ### Tests
16
+
17
+ * **vis-mcp:** cover cli-failure catch paths, resolveVisBin fallback, and version/exec edge branches ([a46fa08](https://github.com/visulima/visulima/commit/a46fa08c991ceeab1e5d4ae575768581aba7bdec))
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.29
23
+ * **@visulima/vis:** upgraded to 1.0.0-alpha.27
24
+
1
25
  ## @visulima/vis-mcp [1.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.15...@visulima/vis-mcp@1.0.0-alpha.16) (2026-05-29)
2
26
 
3
27
  ### Tests
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-yHHXxJYr.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-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)}
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
@@ -90,9 +90,15 @@ declare const registerCacheWhy: ({
90
90
  declare const registerDescribeProject: ({
91
91
  server
92
92
  }: ToolDeps, context: ToolContext) => void;
93
+ declare const registerFmt: ({
94
+ server
95
+ }: ToolDeps, context: ToolContext) => void;
93
96
  declare const registerGetRunLogs: ({
94
97
  server
95
98
  }: ToolDeps, context: ToolContext) => void;
99
+ declare const registerLint: ({
100
+ server
101
+ }: ToolDeps, context: ToolContext) => void;
96
102
  declare const registerListProjects: ({
97
103
  server
98
104
  }: ToolDeps, context: ToolContext) => void;
@@ -106,4 +112,4 @@ declare const isValidRunId: (value: string) => boolean;
106
112
  * inert, but a leading `-` would be parsed as a CLI flag by the vis CLI.
107
113
  */
108
114
  declare const isValidTaskId: (value: string) => boolean;
109
- export { type ExecOptions, type ExecResult, type McpToolResponse, type ToolContext, type ToolDeps, createMcpServer, errorResponse, execVis, execVisJson, isValidRunId, isValidTaskId, okResponse, registerAllTools, registerCacheHash, registerCacheWhy, registerDescribeProject, registerGetRunLogs, registerListProjects, registerListTargets, startMcpServer };
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 };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{execVis as o,execVisJson as s}from"./packem_shared/execVis-BzS_F-9x.js";import{errorResponse as i,okResponse as p}from"./packem_shared/okResponse-DdzqnveW.js";import{createMcpServer as c,registerAllTools as f,startMcpServer as m}from"./packem_shared/registerAllTools-yHHXxJYr.js";import{registerCacheHash as g}from"./packem_shared/registerCacheHash-CVckSIVO.js";import{registerCacheWhy as n}from"./packem_shared/registerCacheWhy-CMzL-Pg3.js";import{registerDescribeProject as h}from"./packem_shared/registerDescribeProject-Dhuzun-I.js";import{registerGetRunLogs as V}from"./packem_shared/registerGetRunLogs-BxkRfYZU.js";import{registerListProjects as T}from"./packem_shared/registerListProjects-C-AZj8RT.js";import{registerListTargets as k}from"./packem_shared/registerListTargets-Cq6bkF7O.js";import{isValidRunId as v,isValidTaskId as C}from"./packem_shared/isValidRunId-BKsKMWQf.js";export{c as createMcpServer,i as errorResponse,o as execVis,s as execVisJson,v as isValidRunId,C as isValidTaskId,p as okResponse,f as registerAllTools,g as registerCacheHash,n as registerCacheWhy,h as registerDescribeProject,V as registerGetRunLogs,T as registerListProjects,k as registerListTargets,m as startMcpServer};
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};
@@ -0,0 +1,3 @@
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};
@@ -0,0 +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(`
2
+ `).slice(-5).join(`
3
+ `);return a(new Error(`vis fmt exited with code ${String(n.exitCode)} and no JSON output${o?`
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};
@@ -0,0 +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(`
2
+ `).slice(-5).join(`
3
+ `);return a(new Error(`vis lint exited with code ${String(o.exitCode)} and no JSON output${n?`
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/vis-mcp",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.17",
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.28",
58
+ "@visulima/fs": "5.0.0-alpha.29",
59
59
  "@visulima/path": "3.0.0-alpha.11",
60
60
  "zod": "4.4.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@visulima/vis": "1.0.0-alpha.26"
63
+ "@visulima/vis": "1.0.0-alpha.27"
64
64
  },
65
65
  "engines": {
66
66
  "node": "^22.14.0 || >=24.10.0"
@@ -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 y}from"node:module";import{resolve as g,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 P}from"./registerCacheWhy-CMzL-Pg3.js";import{registerDescribeProject as V}from"./registerDescribeProject-Dhuzun-I.js";import{registerGetRunLogs as A}from"./registerGetRunLogs-BxkRfYZU.js";import{registerListProjects as _}from"./registerListProjects-C-AZj8RT.js";import{registerListTargets as B}from"./registerListTargets-Cq6bkF7O.js";var I=Object.defineProperty,C=n((t,r)=>I(t,"name",{value:r,configurable:!0}),"a$1");const D=e.object({advisoryCount:e.number(),lastSyncIso:e.string(),manifestEtag:e.string().nullable(),name:e.string()}),L=e.object({dbPath:e.string(),ecosystems:e.array(D),exists:e.boolean(),schemaVersion:e.number(),sizeBytes:e.number()}).catchall(e.unknown()),M=C(({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=L.parse(i);return m(o)}catch(a){return u(a)}})},"registerAdvisoryStatus");var E=Object.defineProperty,q=n((t,r)=>E(t,"name",{value:r,configurable:!0}),"a");const U=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),$=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(U)}),x=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array($),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),H=["low","medium","high","critical"],F=q(({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(H).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=x.parse(i);return m(o)}catch(a){return u(a)}})},"registerAudit");var J=Object.defineProperty,N=n((t,r)=>J(t,"name",{value:r,configurable:!0}),"r");const W=N(({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 z=Object.defineProperty,G=n((t,r)=>z(t,"name",{value:r,configurable:!0}),"n");const K=G(({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 Q=Object.defineProperty,c=n((t,r)=>Q(t,"name",{value:r,configurable:!0}),"s");const X=c(t=>{const r=process.env.VIS_MCP_VIS_BIN;if(r)return g(r);const s=[{label:t,require:y(k(`${t}/package.json`))},{label:"vis-mcp install location",require:y(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 g(h(i),f)},"resolveVisBin"),Y=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"),Z=c((t,r)=>{_(t,r),V(t,r),B(t,r),K(t,r),W(t,r),A(t,r),P(t,r),T(t,r),F(t,r),M(t,r)},"registerAllTools"),ee=c(async t=>{const r=new j({name:"vis",version:await Y()}),s={server:r};return Z(s,t),{deps:s,server:r}},"createMcpServer"),ge=c(async()=>{const t=process.env.VIS_MCP_WORKSPACE_ROOT??process.cwd(),r={visBin:X(t),workspaceRoot:t},{server:s}=await ee(r);await s.connect(new O),process.stderr.write(`[vis-mcp] ready (workspace: ${r.workspaceRoot})
3
- `)},"startMcpServer");export{ee as createMcpServer,Z as registerAllTools,ge as startMcpServer};