@visulima/vis-mcp 1.0.12 → 1.0.14
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 +15 -0
- package/dist/bin.js +2 -2
- package/dist/index.js +1 -1
- package/dist/packem_shared/clearListCache-D-qeI660.js +1 -0
- package/dist/packem_shared/createMcpServer-B0Io8ymj.js +4 -0
- package/dist/packem_shared/errorResponse-D1WOFYuT.js +1 -0
- package/dist/packem_shared/execVis-CInWWszP.js +4 -0
- package/dist/packem_shared/isSafeOptionValue-BEUaZ7UP.js +1 -0
- package/dist/packem_shared/orchestrator-shared-flcsuwN5.js +4 -0
- package/dist/packem_shared/registerAdvisoryStatus-DnpRlAZ2.js +1 -0
- package/dist/packem_shared/registerAudit-ZskmQpJB.js +1 -0
- package/dist/packem_shared/registerCacheHash-CLFe-S23.js +1 -0
- package/dist/packem_shared/registerCacheWhy-DBIgl8ww.js +1 -0
- package/dist/packem_shared/registerDescribeProject-zZZrCz2G.js +1 -0
- package/dist/packem_shared/{registerDescribeTemplate-DFk88tgP.js → registerDescribeTemplate-D1DYYNOB.js} +1 -1
- package/dist/packem_shared/{registerFmt-BdNw7Btl.js → registerFmt-DYE0dqsx.js} +1 -1
- package/dist/packem_shared/{registerGetRunLogs-BNGK67zZ.js → registerGetRunLogs-Em3MkMxy.js} +1 -1
- package/dist/packem_shared/{registerLint-BTPVj4G7.js → registerLint-D_A4H5jb.js} +1 -1
- package/dist/packem_shared/registerListProjects-3dPVnYC9.js +1 -0
- package/dist/packem_shared/registerListRuns-ESA88EcH.js +1 -0
- package/dist/packem_shared/registerListTargets-95gAK_Bj.js +1 -0
- package/dist/packem_shared/{registerListTemplates-CSsN3JAE.js → registerListTemplates-LK8yLlVB.js} +1 -1
- package/package.json +21 -21
- package/dist/packem_shared/clearListCache-4BxipCYS.js +0 -1
- package/dist/packem_shared/createMcpServer-BYF8yGpu.js +0 -4
- package/dist/packem_shared/errorResponse-CVaJrOoB.js +0 -1
- package/dist/packem_shared/execVis-CMeUcwPz.js +0 -4
- package/dist/packem_shared/isSafeOptionValue-BLs7zyGy.js +0 -1
- package/dist/packem_shared/orchestrator-shared-DzTSMbhK.js +0 -4
- package/dist/packem_shared/registerAdvisoryStatus-Ctq9WTp7.js +0 -1
- package/dist/packem_shared/registerAudit-Tg-VQen8.js +0 -1
- package/dist/packem_shared/registerCacheHash-kLMq5p_z.js +0 -1
- package/dist/packem_shared/registerCacheWhy-kAMZHbMk.js +0 -1
- package/dist/packem_shared/registerDescribeProject-HYlvD0tm.js +0 -1
- package/dist/packem_shared/registerListProjects-RaMh3FYt.js +0 -1
- package/dist/packem_shared/registerListRuns-BYGb5LoE.js +0 -1
- package/dist/packem_shared/registerListTargets-IWnJkyzy.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @visulima/vis-mcp [1.0.14](https://github.com/visulima/visulima/compare/%40visulima%2Fvis-mcp%401.0.13...%40visulima%2Fvis-mcp%401.0.14) (2026-08-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/fs:** upgraded to 6.0.1
|
|
7
|
+
* **@visulima/vis:** upgraded to 3.0.2
|
|
8
|
+
|
|
9
|
+
## @visulima/vis-mcp [1.0.13](https://github.com/visulima/visulima/compare/%40visulima%2Fvis-mcp%401.0.12...%40visulima%2Fvis-mcp%401.0.13) (2026-08-17)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* **@visulima/vis:** upgraded to 3.0.1
|
|
15
|
+
|
|
1
16
|
## @visulima/vis-mcp [1.0.12](https://github.com/visulima/visulima/compare/%40visulima%2Fvis-mcp%401.0.11...%40visulima%2Fvis-mcp%401.0.12) (2026-08-08)
|
|
2
17
|
|
|
3
18
|
|
package/dist/bin.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{realpathSync as t}from"node:fs";import{argv as
|
|
3
|
-
`),process.exit(1)}},s=(()=>{const r=
|
|
2
|
+
import{realpathSync as t}from"node:fs";import{argv as e}from"node:process";import{fileURLToPath as o}from"node:url";import{startMcpServer as a}from"./packem_shared/createMcpServer-B0Io8ymj.js";const i=async()=>{try{await a()}catch(r){process.stderr.write(`[vis-mcp] failed to start: ${r instanceof Error?r.message:String(r)}
|
|
3
|
+
`),process.exit(1)}},s=(()=>{const r=e[1];if(r===void 0)return!1;try{return t(r)===t(o(import.meta.url))}catch{return!1}})();s&&await i();export{i as main};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execVis as t,execVisJson as o}from"./packem_shared/execVis-
|
|
1
|
+
import{execVis as t,execVisJson as o}from"./packem_shared/execVis-CInWWszP.js";import{clearListCache as i,listVisJson as p}from"./packem_shared/clearListCache-D-qeI660.js";import{errorResponse as f,okResponse as x,okStructuredResponse as a}from"./packem_shared/errorResponse-D1WOFYuT.js";import{createMcpServer as c,registerAllTools as l,startMcpServer as n}from"./packem_shared/createMcpServer-B0Io8ymj.js";import{registerAdvisoryStatus as d}from"./packem_shared/registerAdvisoryStatus-DnpRlAZ2.js";import{registerAudit as R}from"./packem_shared/registerAudit-ZskmQpJB.js";import{registerCacheHash as V}from"./packem_shared/registerCacheHash-CLFe-S23.js";import{registerCacheWhy as T}from"./packem_shared/registerCacheWhy-DBIgl8ww.js";import{registerDescribeProject as v}from"./packem_shared/registerDescribeProject-zZZrCz2G.js";import{registerDescribeTemplate as C}from"./packem_shared/registerDescribeTemplate-D1DYYNOB.js";import{registerFmt as b}from"./packem_shared/registerFmt-DYE0dqsx.js";import{registerGetRunLogs as y}from"./packem_shared/registerGetRunLogs-Em3MkMxy.js";import{registerLint as I}from"./packem_shared/registerLint-D_A4H5jb.js";import{registerListProjects as M}from"./packem_shared/registerListProjects-3dPVnYC9.js";import{registerListRuns as G}from"./packem_shared/registerListRuns-ESA88EcH.js";import{registerListTargets as O}from"./packem_shared/registerListTargets-95gAK_Bj.js";import{registerListTemplates as q}from"./packem_shared/registerListTemplates-LK8yLlVB.js";import{isSafeOptionValue as z,isSafePositional as B,isValidRunId as E,isValidTaskId as K}from"./packem_shared/isSafeOptionValue-BEUaZ7UP.js";export{i as clearListCache,c as createMcpServer,f as errorResponse,t as execVis,o as execVisJson,z as isSafeOptionValue,B as isSafePositional,E as isValidRunId,K as isValidTaskId,p as listVisJson,x as okResponse,a as okStructuredResponse,d as registerAdvisoryStatus,l as registerAllTools,R as registerAudit,V as registerCacheHash,T as registerCacheWhy,v as registerDescribeProject,C as registerDescribeTemplate,b as registerFmt,y as registerGetRunLogs,I as registerLint,M as registerListProjects,G as registerListRuns,O as registerListTargets,q as registerListTemplates,n as startMcpServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{execVisJson as u}from"./execVis-CInWWszP.js";const w=5e3,e=new Map,x=(c,t)=>`${c}\0${t.join("\0")}`,p=async(c,t,r,a=w)=>{const n=x(t,r),i=Date.now(),s=e.get(n);if(s&&s.expiresAt>i)return s.value;const o=u(c,r,{cwd:t});e.set(n,{expiresAt:i+a,value:o});try{return await o}catch(l){throw e.get(n)?.value===o&&e.delete(n),l}},y=()=>{e.clear()};export{y as clearListCache,p as listVisJson};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import"./execVis-CInWWszP.js";import"./clearListCache-D-qeI660.js";import"./errorResponse-D1WOFYuT.js";import{readFile as g}from"node:fs/promises";import{createRequire as l}from"node:module";import{resolve as u,dirname as v}from"node:path";import{pathToFileURL as d,fileURLToPath as h}from"node:url";import{McpServer as b}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as w}from"@modelcontextprotocol/sdk/server/stdio.js";import{findUp as N}from"@visulima/fs";import{registerAdvisoryStatus as I}from"./registerAdvisoryStatus-DnpRlAZ2.js";import{registerAudit as S}from"./registerAudit-ZskmQpJB.js";import{registerCacheHash as y}from"./registerCacheHash-CLFe-S23.js";import{registerCacheWhy as k}from"./registerCacheWhy-DBIgl8ww.js";import{registerDescribeProject as P}from"./registerDescribeProject-zZZrCz2G.js";import{registerDescribeTemplate as R}from"./registerDescribeTemplate-D1DYYNOB.js";import{registerFmt as V}from"./registerFmt-DYE0dqsx.js";import{registerGetRunLogs as _}from"./registerGetRunLogs-Em3MkMxy.js";import{registerLint as L}from"./registerLint-D_A4H5jb.js";import{registerListProjects as C}from"./registerListProjects-3dPVnYC9.js";import{registerListRuns as T}from"./registerListRuns-ESA88EcH.js";import{registerListTargets as j}from"./registerListTargets-95gAK_Bj.js";import{registerListTemplates as M}from"./registerListTemplates-LK8yLlVB.js";import"./isSafeOptionValue-BEUaZ7UP.js";const c="1.0.0-alpha.35",f=r=>{const[e,o=""]=r.split("-",2);return{core:(e??"").split(".").map(t=>Number.parseInt(t,10)||0),pre:o.length>0?o.split("."):[]}},q=(r,e)=>{if(r===void 0)return e===void 0?0:-1;if(e===void 0)return 1;const o=Number.parseInt(r,10),t=Number.parseInt(e,10);return!Number.isNaN(o)&&!Number.isNaN(t)?o-t:r.localeCompare(e)},E=(r,e)=>{if(r.length===0&&e.length>0)return 1;if(r.length>0&&e.length===0)return-1;const o=Math.max(r.length,e.length);for(let t=0;t<o;t+=1){const i=q(r[t],e[t]);if(i!==0)return i}return 0},$=(r,e)=>{const o=f(r),t=f(e);for(let i=0;i<3;i+=1){const s=(o.core[i]??0)-(t.core[i]??0);if(s!==0)return s}return E(o.pre,t.pre)},O=r=>{!r||$(r,c)>=0||process.stderr.write(`[vis-mcp] warning: @visulima/vis ${r} is older than the required ${c}; lint/fmt/audit tools may fail with opaque errors. Upgrade @visulima/vis to >= ${c}.
|
|
2
|
+
`)},A=r=>{const e=process.env.VIS_MCP_VIS_BIN;if(e)return{binPath:u(e)};const o=[{label:r,require:l(d(`${r}/package.json`))},{label:"vis-mcp install location",require:l(import.meta.url)}],t=[];let i,s;for(const{label:a,require:n}of o)try{i=n.resolve("@visulima/vis/package.json"),s=n("@visulima/vis/package.json");break}catch(m){t.push({error:m,label:a})}if(!i||!s){const a=t.at(-1)?.error,n=t.map(m=>m.label).join(", ");throw new Error(`Cannot resolve \`@visulima/vis\` (tried: ${n}). Install it as a workspace dependency, or set VIS_MCP_VIS_BIN to a vis CLI path.`,{cause:a})}const p=typeof s.bin=="string"?s.bin:s.bin?.vis;if(!p)throw new Error("`@visulima/vis` is installed but does not declare a `vis` bin entry — install a current version.");return{binPath:u(v(i),p),version:s.version}},B=async()=>{try{const r=await N("package.json",{cwd:v(h(import.meta.url))});return r?JSON.parse(await g(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)}
|
|
3
|
+
`),"0.0.0"}},U=(r,e)=>{C(r,e),P(r,e),j(r,e),M(r,e),R(r,e),_(r,e),T(r,e),k(r,e),y(r,e),S(r,e),I(r,e),L(r,e),V(r,e)},F=async r=>{const e=new b({name:"vis",version:await B()}),o={server:e};return U(o,r),{deps:o,server:e}},ur=async()=>{const r=process.env.VIS_MCP_WORKSPACE_ROOT??process.cwd(),{binPath:e,version:o}=A(r);O(o);const t={visBin:e,workspaceRoot:r},{server:i}=await F(t);await i.connect(new w),process.stderr.write(`[vis-mcp] ready (workspace: ${t.workspaceRoot})
|
|
4
|
+
`)};export{c as MIN_VIS_VERSION,$ as compareVersions,F as createMcpServer,U as registerAllTools,ur as startMcpServer,O as warnIfVisTooOld};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=t=>({content:[{text:typeof t=="string"?t:JSON.stringify(t),type:"text"}]}),r=t=>({content:[{text:JSON.stringify(t),type:"text"}],structuredContent:t}),s=t=>{const e=t instanceof Error?t.message:String(t);return{content:[{text:JSON.stringify({error:e}),type:"text"}],isError:!0}};export{s as errorResponse,n as okResponse,r as okStructuredResponse};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{spawn as h}from"node:child_process";const E=12e4,x=64*1024*1024,O=async(u,n,t={})=>{const r=t.timeoutMs??E,i=t.maxBufferBytes??x,l={};for(const[d,s]of Object.entries(process.env))s!==void 0&&(l[d]=s);if(t.env)for(const[d,s]of Object.entries(t.env))s!==void 0&&(l[d]=s);l.NO_COLOR="1";const S={cwd:t.cwd??process.cwd(),env:l,stdio:["ignore","pipe","pipe"],windowsHide:!0};return await new Promise((d,s)=>{const e=h(process.execPath,[u,...n],S);let f="",a="",w=!1,m=!1,o;const v=setTimeout(()=>{w=!0,e.kill("SIGTERM"),o=setTimeout(()=>e.kill("SIGKILL"),2e3),o.unref()},r),T=()=>{m||f.length+a.length<=i||(m=!0,e.kill("SIGTERM"),o??=setTimeout(()=>e.kill("SIGKILL"),2e3),o.unref())};e.stdout?.setEncoding("utf8"),e.stdout?.on("data",c=>{f+=c,T()}),e.stderr?.setEncoding("utf8"),e.stderr?.on("data",c=>{a+=c,T()}),e.once("error",c=>{clearTimeout(v),o&&clearTimeout(o),s(c)}),e.once("close",c=>{clearTimeout(v),o&&clearTimeout(o),d({exitCode:c??-1,overflowed:m,stderr:a,stdout:f,timedOut:w})})})},p=async(u,n,t={})=>{const r=await O(u,n,t);if(r.timedOut)throw new Error(`vis ${n.join(" ")} timed out after ${String(t.timeoutMs??E)}ms`);if(r.overflowed)throw new Error(`vis ${n.join(" ")} exceeded the ${String(t.maxBufferBytes??x)}-byte output limit and was killed`);if(r.exitCode!==0){const i=r.stderr.trim().split(`
|
|
2
|
+
`).slice(-5).join(`
|
|
3
|
+
`);throw new Error(`vis ${n.join(" ")} exited with code ${String(r.exitCode)}${i?`
|
|
4
|
+
${i}`:""}`)}try{return JSON.parse(r.stdout)}catch(i){throw new Error(`vis ${n.join(" ")} did not emit valid JSON: ${i instanceof Error?i.message:String(i)}`,{cause:i})}};export{O as execVis,p as execVisJson};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=/^[\w.-]+$/,d=t=>a.test(t),e=t=>t.length>0&&!t.startsWith("-")&&t.includes(":"),o=t=>t.length>0&&!t.startsWith("-"),r=t=>!t.startsWith("-"),l=(t,s)=>{if(!s||s.length===0)return;const n=s.find(i=>!o(i));if(n!==void 0)return`Invalid file path "${n}". A leading "-" would be parsed as a CLI flag.`;t.push("--",...s)};export{l as appendPositionalFiles,r as isSafeOptionValue,o as isSafePositional,d as isValidRunId,e as isValidTaskId};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import*as r from"zod";import{execVis as d}from"./execVis-CInWWszP.js";import{errorResponse as n,okStructuredResponse as m}from"./errorResponse-D1WOFYuT.js";const w=r.object({adapter:r.string(),column:r.number().optional(),endColumn:r.number().optional(),endLine:r.number().optional(),file:r.string(),fixable:r.boolean().optional(),line:r.number().optional(),message:r.string(),ruleId:r.string().optional(),severity:r.enum(["error","info","warning"])}).catchall(r.unknown()),g=r.object({adapter:r.string(),durationMs:r.number(),exitCode:r.number(),findingCount:r.number()}).catchall(r.unknown()),b=async(i,o,a,u,l)=>{try{const e=await d(i.visBin,a,{cwd:i.workspaceRoot});if(e.timedOut)return n(new Error(`vis ${o} timed out`));if(e.overflowed)return n(new Error(`vis ${o} produced more output than the buffer ceiling allows and was killed`));if(e.stdout.trim().length===0){const t=e.stderr.trim().split(`
|
|
2
|
+
`).slice(-5).join(`
|
|
3
|
+
`);return n(new Error(`vis ${o} exited with code ${String(e.exitCode)} and no JSON output${t?`
|
|
4
|
+
${t}`:""}`))}let s;try{s=JSON.parse(e.stdout)}catch(t){return n(new Error(`vis ${a.join(" ")} did not emit valid JSON: ${t instanceof Error?t.message:String(t)}`,{cause:t}))}const c=u.parse(s);return m(l(c,e.exitCode))}catch(e){return n(e)}};export{b as a,w as f,g as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as s from"zod";import{execVisJson as d}from"./execVis-CInWWszP.js";import{errorResponse as r,okStructuredResponse as m}from"./errorResponse-D1WOFYuT.js";import{isSafeOptionValue as u}from"./isSafeOptionValue-BEUaZ7UP.js";const l=s.object({advisoryCount:s.number(),lastSyncIso:s.string(),manifestEtag:s.string().nullable(),name:s.string()}),o=s.object({dbPath:s.string(),ecosystems:s.array(l),exists:s.boolean(),schemaVersion:s.number(),sizeBytes:s.number()}).catchall(s.unknown()),h=o.shape,y=({server:i},a)=>{i.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:s.string().min(1).optional().describe("Override the cache DB path (default: <cache>/vis/advisories/db.sqlite).")},outputSchema:h},async e=>{try{const t=["advisories","status","--format","json"];if(e.db!==void 0){if(!u(e.db))return r(new Error(`Invalid --db value "${e.db}". A leading "-" would be parsed as a CLI flag.`));t.push("--db",e.db)}const n=await d(a.visBin,t,{cwd:a.workspaceRoot}),c=o.parse(n);return m(c)}catch(t){return r(t)}})};export{y as registerAdvisoryStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"zod";import{execVisJson as l}from"./execVis-CInWWszP.js";import{errorResponse as r,okStructuredResponse as u}from"./errorResponse-D1WOFYuT.js";import{isSafeOptionValue as p}from"./isSafeOptionValue-BEUaZ7UP.js";const d=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),m=e.object({acceptedRisk:e.unknown().optional(),name:e.string(),socketAlerts:e.array(e.unknown()).optional(),socketScore:e.number().nullish(),version:e.string(),vulnerabilities:e.array(d)}),a=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array(m),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),y=a.shape,h=["low","medium","high","critical"],v=({server:i},t)=>{i.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.")},outputSchema:y},async s=>{try{const o=["audit","--format","json"];if(s.severity&&o.push("--severity",s.severity),s.offline&&o.push("--offline"),s.prodOnly&&o.push("--prod-only"),s.usage&&o.push("--usage"),s.ecosystem){if(!p(s.ecosystem))return r(new Error(`Invalid --ecosystem value "${s.ecosystem}". A leading "-" would be parsed as a CLI flag.`));o.push("--ecosystem",s.ecosystem)}s.showAccepted&&o.push("--show-accepted");const n=await l(t.visBin,o,{cwd:t.workspaceRoot}),c=a.parse(n);return u(c)}catch(o){return r(o)}})};export{v as registerAudit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as o from"zod";import{execVisJson as c}from"./execVis-CInWWszP.js";import{errorResponse as i,okResponse as p}from"./errorResponse-D1WOFYuT.js";import{isValidTaskId as d,isValidRunId as h}from"./isSafeOptionValue-BEUaZ7UP.js";const f=({server:a},s)=>{a.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:e,taskId:t})=>{if(!d(t))return i(new Error(`Invalid taskId "${t}". Expected "<project>:<target>".`));if(e!==void 0&&!h(e))return i(new Error(`Invalid runId "${e}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const r=["cache","hash",t,"--format=json"];e&&r.push("--run",e);const n=await c(s.visBin,r,{cwd:s.workspaceRoot});return p(n)}catch(r){return i(r)}})};export{f as registerCacheHash};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as a from"zod";import{execVisJson as c}from"./execVis-CInWWszP.js";import{errorResponse as s,okResponse as p}from"./errorResponse-D1WOFYuT.js";import{isValidTaskId as h,isValidRunId as d}from"./isSafeOptionValue-BEUaZ7UP.js";const f=({server:o},i)=>{o.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:a.string().optional().describe("Run ID to inspect (default: latest)"),taskId:a.string().describe('Task ID like "@my/app:build"')}},async({runId:e,taskId:r})=>{if(!h(r))return s(new Error(`Invalid taskId "${r}". Expected "<project>:<target>".`));if(e!==void 0&&!d(e))return s(new Error(`Invalid runId "${e}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const t=["cache","why",r,"--format=json"];e&&t.push("--run",e);const n=await c(i.visBin,t,{cwd:i.workspaceRoot});return p(n)}catch(t){return s(t)}})};export{f as registerCacheWhy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as i from"zod";import{listVisJson as c}from"./clearListCache-D-qeI660.js";import{errorResponse as s,okResponse as p}from"./errorResponse-D1WOFYuT.js";const j=({server:a},e)=>{a.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:i.string().describe('Project name (e.g. "@visulima/cerebro")')}},async({name:r})=>{try{const o=(await c(e.visBin,e.workspaceRoot,["list","--json"])).find(n=>n.name===r);return o?p(o):s(new Error(`No project named "${r}". Use list_projects to see available names.`))}catch(t){return s(t)}})};export{j as registerDescribeProject};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as s from"zod";import{execVisJson as
|
|
1
|
+
import*as s from"zod";import{execVisJson as i}from"./execVis-CInWWszP.js";import{errorResponse as a,okResponse as n}from"./errorResponse-D1WOFYuT.js";import{isSafePositional as l}from"./isSafeOptionValue-BEUaZ7UP.js";const d=({server:o},r)=>{o.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:s.string().describe('Template name (e.g. "package", "component"). Use list_templates to see available names.')}},async({name:e})=>{if(!l(e))return a(new Error(`Invalid template name "${e}". A leading "-" would be parsed as a CLI flag.`));try{const t=await i(r.visBin,["generate","--describe","--json","--",e],{cwd:r.workspaceRoot});return n(t)}catch(t){return a(t)}})};export{d as registerDescribeTemplate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"zod";import{errorResponse as
|
|
1
|
+
import*as e from"zod";import{errorResponse as s}from"./errorResponse-D1WOFYuT.js";import{isSafeOptionValue as l,appendPositionalFiles as m}from"./isSafeOptionValue-BEUaZ7UP.js";import{r as n,f as a,a as h}from"./orchestrator-shared-flcsuwN5.js";const u=e.object({findings:e.array(a),mode:e.enum(["check","fix"]).optional(),runs:e.array(n)}).catchall(e.unknown()),p={exitCode:e.number(),findings:e.array(a),mode:e.enum(["check","fix"]),runs:e.array(n)},y=({server:c},f)=>{c.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.")},outputSchema:p},async r=>{const t=["fmt","--check","--format","json"];if(r.quiet&&t.push("--quiet"),r.staged)t.push("--staged");else if(r.since!==void 0&&r.since.length>0){if(!l(r.since))return s(new Error(`Invalid --since value "${r.since}". A leading "-" would be parsed as a CLI flag.`));t.push("--since",r.since)}const o=m(t,r.files);return o!==void 0?s(new Error(o)):h(f,"fmt",t,u,(i,d)=>({...i,exitCode:d,mode:i.mode??"check"}))})};export{y as registerFmt};
|
package/dist/packem_shared/{registerGetRunLogs-BNGK67zZ.js → registerGetRunLogs-Em3MkMxy.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as
|
|
1
|
+
import{readFile as f}from"node:fs/promises";import{join as u}from"@visulima/path";import*as l from"zod";import{errorResponse as e,okResponse as m}from"./errorResponse-D1WOFYuT.js";import{isValidRunId as c}from"./isSafeOptionValue-BEUaZ7UP.js";const R=({server:p},o)=>{p.registerTool("get_run_logs",{annotations:{readOnlyHint:!0},description:"Read a vis run summary from .task-runner/. Returns the most recent run by default, or a specific run when `runId` is set. Optionally filter to a single task with `taskId`.",inputSchema:{runId:l.string().optional().describe("Run ID (default: latest)"),taskId:l.string().optional().describe('Filter to a single task ID like "@my/app:build"')}},async({runId:r,taskId:s})=>{if(r!==void 0&&!c(r))return e(new Error(`Invalid runId "${r}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));const a=r?u(o.workspaceRoot,".task-runner","runs",`${r}.json`):u(o.workspaceRoot,".task-runner","last-summary.json");try{const t=await f(a,"utf8"),n=JSON.parse(t);if(s){const i=n.tasks?.find(d=>d.taskId===s);return i?m({runId:n.runId,task:i}):e(new Error(`Task "${s}" not found in run "${n.runId??"(unknown)"}".`))}return m(n)}catch(t){return t.code==="ENOENT"?e(new Error(`No run summary at ${a}. Run a task first to populate it.`)):e(t)}})};export{R as registerGetRunLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"zod";import{errorResponse as t}from"./errorResponse-
|
|
1
|
+
import*as e from"zod";import{errorResponse as t}from"./errorResponse-D1WOFYuT.js";import{isSafeOptionValue as f,appendPositionalFiles as g}from"./isSafeOptionValue-BEUaZ7UP.js";import{r as s,f as o,a as h}from"./orchestrator-shared-flcsuwN5.js";const m=e.object({findings:e.array(o),runs:e.array(s)}).catchall(e.unknown()),u={exitCode:e.number(),findings:e.array(o),runs:e.array(s)},w=({server:a},l)=>{a.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.")},outputSchema:u},async r=>{const n=["lint","--format","json"];if(r.quiet&&n.push("--quiet"),typeof r.maxWarnings=="number"&&n.push("--max-warnings",String(r.maxWarnings)),r.staged)n.push("--staged");else if(r.since!==void 0&&r.since.length>0){if(!f(r.since))return t(new Error(`Invalid --since value "${r.since}". A leading "-" would be parsed as a CLI flag.`));n.push("--since",r.since)}const i=g(n,r.files);return i!==void 0?t(new Error(i)):h(l,"lint",n,m,(d,c)=>({...d,exitCode:c}))})};export{w as registerLint};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as a from"zod";import{execVisJson as n}from"./execVis-CInWWszP.js";import{errorResponse as i,okResponse as p}from"./errorResponse-D1WOFYuT.js";import{isSafeOptionValue as l}from"./isSafeOptionValue-BEUaZ7UP.js";const d=({server:s},e)=>{s.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:t})=>{try{const r=["list","--json"];if(t){if(!l(t))return i(new Error(`Invalid --query value "${t}". A leading "-" would be parsed as a CLI flag.`));r.push("--query",t)}const o=await n(e.visBin,r,{cwd:e.workspaceRoot});return p({count:o.length,projects:o})}catch(r){return i(r)}})};export{d as registerListProjects};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readdir as v,stat as w,readFile as y}from"node:fs/promises";import{join as d}from"@visulima/path";import*as g from"zod";import{okResponse as m,errorResponse as p}from"./errorResponse-D1WOFYuT.js";const _=/\.json$/,I=e=>{if(typeof e.status=="string")return e.status;if(e.tasks)return e.tasks.some(a=>a.status==="failure"||a.status==="failed")?"failure":"success"},R=({server:e},a)=>{e.registerTool("list_runs",{annotations:{readOnlyHint:!0},description:'List recorded vis runs from `.task-runner/runs/`, most recent first. Each entry includes the run ID, start timestamp, derived status, task count, and failed-task count — use it to discover run IDs for `get_run_logs`, `cache_hash`, or `cache_why` (e.g. "compare this run to the previous one").',inputSchema:{limit:g.int().positive().max(100).optional().describe("Maximum runs to return (default: 20, newest first).")}},async({limit:h})=>{const i=d(a.workspaceRoot,".task-runner","runs");let l;try{l=(await v(i)).filter(u=>u.endsWith(".json"))}catch(n){return n.code==="ENOENT"?m({count:0,runs:[]}):p(n)}try{const u=(await Promise.all(l.map(async t=>{try{const s=await w(d(i,t));return{file:t,modifiedMs:s.mtimeMs}}catch{return}}))).filter(t=>t!==void 0).toSorted((t,s)=>s.modifiedMs-t.modifiedMs).slice(0,h??20),f=(await Promise.all(u.map(async({file:t,modifiedMs:s})=>{try{const c=await y(d(i,t),"utf8"),r=JSON.parse(c);return{failedTasks:r.tasks?.filter(o=>o.status==="failure"||o.status==="failed").length,modifiedMs:s,runId:r.runId??t.replace(_,""),startedAt:r.startedAt,status:I(r),taskCount:r.tasks?.length}}catch{return}}))).filter(t=>t!==void 0).map(t=>{const{failedTasks:s,runId:c,startedAt:r,status:o,taskCount:k}=t;return{failedTasks:s,runId:c,startedAt:r,status:o,taskCount:k}});return m({count:f.length,runs:f})}catch(n){return p(n)}})};export{R as registerListRuns};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as p from"zod";import{listVisJson as l}from"./clearListCache-D-qeI660.js";import{errorResponse as n,okResponse as m}from"./errorResponse-D1WOFYuT.js";const w=({server:c},o)=>{c.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:p.string().optional().describe('Limit to one project (e.g. "@visulima/cerebro")')}},async({project:t})=>{try{const e=await l(o.visBin,o.workspaceRoot,["list","--targets","--json"]),s=t?e.filter(r=>r.name===t):e;if(t&&s.length===0)return n(new Error(`No project named "${t}". Use list_projects to see available names.`));const a=s.flatMap(r=>(r.targets??[]).map(i=>({...i,project:r.name,target:i.name})));return m({count:a.length,targets:a})}catch(e){return n(e)}})};export{w as registerListTargets};
|
package/dist/packem_shared/{registerListTemplates-CSsN3JAE.js → registerListTemplates-LK8yLlVB.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execVisJson as n}from"./execVis-
|
|
1
|
+
import{execVisJson as n}from"./execVis-CInWWszP.js";import{okResponse as o,errorResponse as r}from"./errorResponse-D1WOFYuT.js";const c=({server:s},t)=>{s.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 e=await n(t.visBin,["generate","--list","--json"],{cwd:t.workspaceRoot});return o({count:e.length,templates:e})}catch(e){return r(e)}})};export{c as registerListTemplates};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/vis-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
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",
|
|
@@ -15,11 +15,6 @@
|
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://visulima.com/packages/vis-mcp",
|
|
17
17
|
"bugs": "https://github.com/visulima/visulima/issues",
|
|
18
|
-
"license": "MIT",
|
|
19
|
-
"author": {
|
|
20
|
-
"name": "Daniel Bannert",
|
|
21
|
-
"email": "d.bannert@anolilab.de"
|
|
22
|
-
},
|
|
23
18
|
"repository": {
|
|
24
19
|
"type": "git",
|
|
25
20
|
"url": "git+https://github.com/visulima/visulima.git",
|
|
@@ -35,17 +30,13 @@
|
|
|
35
30
|
"url": "https://anolilab.com/support"
|
|
36
31
|
}
|
|
37
32
|
],
|
|
38
|
-
"
|
|
39
|
-
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"author": {
|
|
35
|
+
"name": "Daniel Bannert",
|
|
36
|
+
"email": "d.bannert@anolilab.de"
|
|
40
37
|
},
|
|
41
|
-
"files": [
|
|
42
|
-
"dist/**",
|
|
43
|
-
"README.md",
|
|
44
|
-
"CHANGELOG.md",
|
|
45
|
-
"LICENSE.md"
|
|
46
|
-
],
|
|
47
|
-
"type": "module",
|
|
48
38
|
"sideEffects": false,
|
|
39
|
+
"type": "module",
|
|
49
40
|
"exports": {
|
|
50
41
|
".": {
|
|
51
42
|
"types": "./dist/index.d.ts",
|
|
@@ -53,20 +44,29 @@
|
|
|
53
44
|
},
|
|
54
45
|
"./package.json": "./package.json"
|
|
55
46
|
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"provenance": true
|
|
47
|
+
"bin": {
|
|
48
|
+
"vis-mcp": "./dist/bin.js"
|
|
59
49
|
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist/**",
|
|
52
|
+
"README.md",
|
|
53
|
+
"CHANGELOG.md",
|
|
54
|
+
"LICENSE.md"
|
|
55
|
+
],
|
|
60
56
|
"dependencies": {
|
|
61
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
62
|
-
"@visulima/fs": "6.0.
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
58
|
+
"@visulima/fs": "6.0.1",
|
|
63
59
|
"@visulima/path": "4.0.0",
|
|
64
60
|
"zod": "4.4.3"
|
|
65
61
|
},
|
|
66
62
|
"peerDependencies": {
|
|
67
|
-
"@visulima/vis": "3.0.
|
|
63
|
+
"@visulima/vis": "3.0.2"
|
|
68
64
|
},
|
|
69
65
|
"engines": {
|
|
70
66
|
"node": "^22.14.0 || >=24.10.0"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public",
|
|
70
|
+
"provenance": true
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{execVisJson as u}from"./execVis-CMeUcwPz.js";const p=5e3,e=new Map,w=(c,t)=>`${c}\0${t.join("\0")}`,g=async(c,t,a,o=p)=>{const s=w(t,a),i=Date.now(),n=e.get(s);if(n&&n.expiresAt>i)return n.value;const r=u(c,a,{cwd:t});e.set(s,{expiresAt:i+o,value:r});try{return await r}catch(l){throw e.get(s)?.value===r&&e.delete(s),l}},h=()=>{e.clear()};export{h as clearListCache,g as listVisJson};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{readFile as g}from"node:fs/promises";import{createRequire as l}from"node:module";import{resolve as u,dirname as f}from"node:path";import{pathToFileURL as d,fileURLToPath as h}from"node:url";import{McpServer as w}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as b}from"@modelcontextprotocol/sdk/server/stdio.js";import{findUp as I}from"@visulima/fs";import{registerAdvisoryStatus as S}from"./registerAdvisoryStatus-Ctq9WTp7.js";import{registerAudit as N}from"./registerAudit-Tg-VQen8.js";import{registerCacheHash as y}from"./registerCacheHash-kLMq5p_z.js";import{registerCacheWhy as _}from"./registerCacheWhy-kAMZHbMk.js";import{registerDescribeProject as k}from"./registerDescribeProject-HYlvD0tm.js";import{registerDescribeTemplate as P}from"./registerDescribeTemplate-DFk88tgP.js";import{registerFmt as R}from"./registerFmt-BdNw7Btl.js";import{registerGetRunLogs as C}from"./registerGetRunLogs-BNGK67zZ.js";import{registerLint as L}from"./registerLint-BTPVj4G7.js";import{registerListProjects as T}from"./registerListProjects-RaMh3FYt.js";import{registerListRuns as V}from"./registerListRuns-BYGb5LoE.js";import{registerListTargets as j}from"./registerListTargets-IWnJkyzy.js";import{registerListTemplates as M}from"./registerListTemplates-CSsN3JAE.js";const p="1.0.0-alpha.35",v=r=>{const[e,s=""]=r.split("-",2);return{core:(e??"").split(".").map(t=>Number.parseInt(t,10)||0),pre:s.length>0?s.split("."):[]}},$=(r,e)=>{if(r===void 0)return e===void 0?0:-1;if(e===void 0)return 1;const s=Number.parseInt(r,10),t=Number.parseInt(e,10);return!Number.isNaN(s)&&!Number.isNaN(t)?s-t:r.localeCompare(e)},O=(r,e)=>{if(r.length===0&&e.length>0)return 1;if(r.length>0&&e.length===0)return-1;const s=Math.max(r.length,e.length);for(let t=0;t<s;t+=1){const i=$(r[t],e[t]);if(i!==0)return i}return 0},q=(r,e)=>{const s=v(r),t=v(e);for(let i=0;i<3;i+=1){const o=(s.core[i]??0)-(t.core[i]??0);if(o!==0)return o}return O(s.pre,t.pre)},E=r=>{!r||q(r,p)>=0||process.stderr.write(`[vis-mcp] warning: @visulima/vis ${r} is older than the required ${p}; lint/fmt/audit tools may fail with opaque errors. Upgrade @visulima/vis to >= ${p}.
|
|
2
|
-
`)},A=r=>{const e=process.env.VIS_MCP_VIS_BIN;if(e)return{binPath:u(e)};const s=[{label:r,require:l(d(`${r}/package.json`))},{label:"vis-mcp install location",require:l(import.meta.url)}],t=[];let i,o;for(const{label:n,require:a}of s)try{i=a.resolve("@visulima/vis/package.json"),o=a("@visulima/vis/package.json");break}catch(m){t.push({error:m,label:n})}if(!i||!o){const n=t.at(-1)?.error,a=t.map(m=>m.label).join(", ");throw new Error(`Cannot resolve \`@visulima/vis\` (tried: ${a}). Install it as a workspace dependency, or set VIS_MCP_VIS_BIN to a vis CLI path.`,{cause:n})}const c=typeof o.bin=="string"?o.bin:o.bin?.vis;if(!c)throw new Error("`@visulima/vis` is installed but does not declare a `vis` bin entry — install a current version.");return{binPath:u(f(i),c),version:o.version}},U=async()=>{try{const r=await I("package.json",{cwd:f(h(import.meta.url))});return r?JSON.parse(await g(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)}
|
|
3
|
-
`),"0.0.0"}},B=(r,e)=>{T(r,e),k(r,e),j(r,e),M(r,e),P(r,e),C(r,e),V(r,e),_(r,e),y(r,e),N(r,e),S(r,e),L(r,e),R(r,e)},D=async r=>{const e=new w({name:"vis",version:await U()}),s={server:e};return B(s,r),{deps:s,server:e}},mr=async()=>{const r=process.env.VIS_MCP_WORKSPACE_ROOT??process.cwd(),{binPath:e,version:s}=A(r);E(s);const t={visBin:e,workspaceRoot:r},{server:i}=await D(t);await i.connect(new b),process.stderr.write(`[vis-mcp] ready (workspace: ${t.workspaceRoot})
|
|
4
|
-
`)};export{p as MIN_VIS_VERSION,q as compareVersions,D as createMcpServer,B as registerAllTools,mr as startMcpServer,E as warnIfVisTooOld};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const r=t=>({content:[{text:typeof t=="string"?t:JSON.stringify(t),type:"text"}]}),n=t=>({content:[{text:JSON.stringify(t),type:"text"}],structuredContent:t}),o=t=>{const e=t instanceof Error?t.message:String(t);return{content:[{text:JSON.stringify({error:e}),type:"text"}],isError:!0}};export{o as errorResponse,r as okResponse,n as okStructuredResponse};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{spawn as E}from"node:child_process";const x=12e4,g=64*1024*1024,S=async(a,s,t={})=>{const r=t.timeoutMs??x,o=t.maxBufferBytes??g,u={};for(const[d,n]of Object.entries(process.env))n!==void 0&&(u[d]=n);if(t.env)for(const[d,n]of Object.entries(t.env))n!==void 0&&(u[d]=n);u.NO_COLOR="1";const h={cwd:t.cwd??process.cwd(),env:u,stdio:["ignore","pipe","pipe"],windowsHide:!0};return await new Promise((d,n)=>{const e=E(process.execPath,[a,...s],h);let l="",f="",w=!1,m=!1,i;const p=setTimeout(()=>{w=!0,e.kill("SIGTERM"),i=setTimeout(()=>e.kill("SIGKILL"),2e3),i.unref()},r),v=()=>{m||l.length+f.length<=o||(m=!0,e.kill("SIGTERM"),i??=setTimeout(()=>e.kill("SIGKILL"),2e3),i.unref())};e.stdout?.setEncoding("utf8"),e.stdout?.on("data",c=>{l+=c,v()}),e.stderr?.setEncoding("utf8"),e.stderr?.on("data",c=>{f+=c,v()}),e.once("error",c=>{clearTimeout(p),i&&clearTimeout(i),n(c)}),e.once("close",c=>{clearTimeout(p),i&&clearTimeout(i),d({exitCode:c??-1,overflowed:m,stderr:f,stdout:l,timedOut:w})})})},$=async(a,s,t={})=>{const r=await S(a,s,t);if(r.timedOut)throw new Error(`vis ${s.join(" ")} timed out after ${String(t.timeoutMs??x)}ms`);if(r.overflowed)throw new Error(`vis ${s.join(" ")} exceeded the ${String(t.maxBufferBytes??g)}-byte output limit and was killed`);if(r.exitCode!==0){const o=r.stderr.trim().split(`
|
|
2
|
-
`).slice(-5).join(`
|
|
3
|
-
`);throw new Error(`vis ${s.join(" ")} exited with code ${String(r.exitCode)}${o?`
|
|
4
|
-
${o}`:""}`)}try{return JSON.parse(r.stdout)}catch(o){throw new Error(`vis ${s.join(" ")} did not emit valid JSON: ${o instanceof Error?o.message:String(o)}`,{cause:o})}};export{S as execVis,$ as execVisJson};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=/^[\w.-]+$/,n=i=>e.test(i),d=i=>i.length>0&&!i.startsWith("-")&&i.includes(":"),l=i=>i.length>0&&!i.startsWith("-"),o=i=>!i.startsWith("-"),r=(i,s)=>{if(!s||s.length===0)return;const t=s.find(a=>!l(a));if(t!==void 0)return`Invalid file path "${t}". A leading "-" would be parsed as a CLI flag.`;i.push("--",...s)};export{r as appendPositionalFiles,o as isSafeOptionValue,l as isSafePositional,n as isValidRunId,d as isValidTaskId};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import*as r from"zod";import{execVis as l}from"./execVis-CMeUcwPz.js";import{errorResponse as t,okStructuredResponse as m}from"./errorResponse-CVaJrOoB.js";const g=r.object({adapter:r.string(),column:r.number().optional(),endColumn:r.number().optional(),endLine:r.number().optional(),file:r.string(),fixable:r.boolean().optional(),line:r.number().optional(),message:r.string(),ruleId:r.string().optional(),severity:r.enum(["error","info","warning"])}).catchall(r.unknown()),w=r.object({adapter:r.string(),durationMs:r.number(),exitCode:r.number(),findingCount:r.number()}).catchall(r.unknown()),b=async(i,o,a,u,c)=>{try{const e=await l(i.visBin,a,{cwd:i.workspaceRoot});if(e.timedOut)return t(new Error(`vis ${o} timed out`));if(e.overflowed)return t(new Error(`vis ${o} produced more output than the buffer ceiling allows and was killed`));if(e.stdout.trim().length===0){const n=e.stderr.trim().split(`
|
|
2
|
-
`).slice(-5).join(`
|
|
3
|
-
`);return t(new Error(`vis ${o} exited with code ${String(e.exitCode)} and no JSON output${n?`
|
|
4
|
-
${n}`:""}`))}let s;try{s=JSON.parse(e.stdout)}catch(n){return t(new Error(`vis ${a.join(" ")} did not emit valid JSON: ${n instanceof Error?n.message:String(n)}`,{cause:n}))}const d=u.parse(s);return m(c(d,e.exitCode))}catch(e){return t(e)}};export{b as a,g as f,w as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"zod";import{execVisJson as d}from"./execVis-CMeUcwPz.js";import{errorResponse as a,okStructuredResponse as u}from"./errorResponse-CVaJrOoB.js";import{isSafeOptionValue as l}from"./isSafeOptionValue-BLs7zyGy.js";const m=e.object({advisoryCount:e.number(),lastSyncIso:e.string(),manifestEtag:e.string().nullable(),name:e.string()}),o=e.object({dbPath:e.string(),ecosystems:e.array(m),exists:e.boolean(),schemaVersion:e.number(),sizeBytes:e.number()}).catchall(e.unknown()),p=o.shape,v=({server:i},r)=>{i.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).")},outputSchema:p},async s=>{try{const t=["advisories","status","--format","json"];if(s.db!==void 0){if(!l(s.db))return a(new Error(`Invalid --db value "${s.db}". A leading "-" would be parsed as a CLI flag.`));t.push("--db",s.db)}const n=await d(r.visBin,t,{cwd:r.workspaceRoot}),c=o.parse(n);return u(c)}catch(t){return a(t)}})};export{v as registerAdvisoryStatus};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"zod";import{execVisJson as l}from"./execVis-CMeUcwPz.js";import{errorResponse as o,okStructuredResponse as p}from"./errorResponse-CVaJrOoB.js";import{isSafeOptionValue as u}from"./isSafeOptionValue-BLs7zyGy.js";const d=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),m=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(d)}),a=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array(m),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),y=a.shape,h=["low","medium","high","critical"],v=({server:i},r)=>{i.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.")},outputSchema:y},async s=>{try{const t=["audit","--format","json"];if(s.severity&&t.push("--severity",s.severity),s.offline&&t.push("--offline"),s.prodOnly&&t.push("--prod-only"),s.usage&&t.push("--usage"),s.ecosystem){if(!u(s.ecosystem))return o(new Error(`Invalid --ecosystem value "${s.ecosystem}". A leading "-" would be parsed as a CLI flag.`));t.push("--ecosystem",s.ecosystem)}s.showAccepted&&t.push("--show-accepted");const n=await l(r.visBin,t,{cwd:r.workspaceRoot}),c=a.parse(n);return p(c)}catch(t){return o(t)}})};export{v as registerAudit};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as n from"zod";import{execVisJson as d}from"./execVis-CMeUcwPz.js";import{errorResponse as s,okResponse as c}from"./errorResponse-CVaJrOoB.js";import{isValidTaskId as p,isValidRunId as u}from"./isSafeOptionValue-BLs7zyGy.js";const I=({server:a},i)=>{a.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:n.string().optional().describe("Run ID to inspect (default: latest)"),taskId:n.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:e})=>{if(!p(e))return s(new Error(`Invalid taskId "${e}". Expected "<project>:<target>".`));if(t!==void 0&&!u(t))return s(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const r=["cache","hash",e,"--format=json"];t&&r.push("--run",t);const o=await d(i.visBin,r,{cwd:i.workspaceRoot});return c(o)}catch(r){return s(r)}})};export{I as registerCacheHash};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as n from"zod";import{execVisJson as c}from"./execVis-CMeUcwPz.js";import{errorResponse as s,okResponse as d}from"./errorResponse-CVaJrOoB.js";import{isValidTaskId as p,isValidRunId as u}from"./isSafeOptionValue-BLs7zyGy.js";const f=({server:i},a)=>{i.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:n.string().optional().describe("Run ID to inspect (default: latest)"),taskId:n.string().describe('Task ID like "@my/app:build"')}},async({runId:t,taskId:r})=>{if(!p(r))return s(new Error(`Invalid taskId "${r}". Expected "<project>:<target>".`));if(t!==void 0&&!u(t))return s(new Error(`Invalid runId "${t}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));try{const e=["cache","why",r,"--format=json"];t&&e.push("--run",t);const o=await c(a.visBin,e,{cwd:a.workspaceRoot});return d(o)}catch(e){return s(e)}})};export{f as registerCacheWhy};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as n from"zod";import{listVisJson as i}from"./clearListCache-4BxipCYS.js";import{okResponse as c,errorResponse as o}from"./errorResponse-CVaJrOoB.js";const m=({server:s},r)=>{s.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:n.string().describe('Project name (e.g. "@visulima/cerebro")')}},async({name:t})=>{try{const e=(await i(r.visBin,r.workspaceRoot,["list","--json"])).find(a=>a.name===t);return e?c(e):o(new Error(`No project named "${t}". Use list_projects to see available names.`))}catch(e){return o(e)}})};export{m as registerDescribeProject};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as a from"zod";import{execVisJson as n}from"./execVis-CMeUcwPz.js";import{errorResponse as i,okResponse as p}from"./errorResponse-CVaJrOoB.js";import{isSafeOptionValue as l}from"./isSafeOptionValue-BLs7zyGy.js";const y=({server:s},t)=>{s.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:e})=>{try{const r=["list","--json"];if(e){if(!l(e))return i(new Error(`Invalid --query value "${e}". A leading "-" would be parsed as a CLI flag.`));r.push("--query",e)}const o=await n(t.visBin,r,{cwd:t.workspaceRoot});return p({count:o.length,projects:o})}catch(r){return i(r)}})};export{y as registerListProjects};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readdir as k,stat as y,readFile as g}from"node:fs/promises";import{join as d}from"@visulima/path";import*as w from"zod";import{okResponse as f,errorResponse as m}from"./errorResponse-CVaJrOoB.js";const v=/\.json$/,M=a=>{if(typeof a.status=="string")return a.status;if(a.tasks)return a.tasks.some(i=>i.status==="failure"||i.status==="failed")?"failure":"success"},A=({server:a},i)=>{a.registerTool("list_runs",{annotations:{readOnlyHint:!0},description:'List recorded vis runs from `.task-runner/runs/`, most recent first. Each entry includes the run ID, start timestamp, derived status, task count, and failed-task count — use it to discover run IDs for `get_run_logs`, `cache_hash`, or `cache_why` (e.g. "compare this run to the previous one").',inputSchema:{limit:w.int().positive().max(100).optional().describe("Maximum runs to return (default: 20, newest first).")}},async({limit:p})=>{const o=d(i.workspaceRoot,".task-runner","runs");let c;try{c=(await k(o)).filter(s=>s.endsWith(".json"))}catch(s){return s.code==="ENOENT"?f({count:0,runs:[]}):m(s)}try{const s=(await Promise.all(c.map(async t=>{try{const e=await y(d(o,t));return{file:t,modifiedMs:e.mtimeMs}}catch{return}}))).filter(t=>t!==void 0).toSorted((t,e)=>e.modifiedMs-t.modifiedMs).slice(0,p??20),l=(await Promise.all(s.map(async({file:t,modifiedMs:e})=>{try{const u=await g(d(o,t),"utf8"),r=JSON.parse(u);return{failedTasks:r.tasks?.filter(n=>n.status==="failure"||n.status==="failed").length,modifiedMs:e,runId:r.runId??t.replace(v,""),startedAt:r.startedAt,status:M(r),taskCount:r.tasks?.length}}catch{return}}))).filter(t=>t!==void 0).map(t=>{const{failedTasks:e,runId:u,startedAt:r,status:n,taskCount:h}=t;return{failedTasks:e,runId:u,startedAt:r,status:n,taskCount:h}});return f({count:l.length,runs:l})}catch(s){return m(s)}})};export{A as registerListRuns};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as p from"zod";import{listVisJson as l}from"./clearListCache-4BxipCYS.js";import{errorResponse as i,okResponse as m}from"./errorResponse-CVaJrOoB.js";const j=({server:c},o)=>{c.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:p.string().optional().describe('Limit to one project (e.g. "@visulima/cerebro")')}},async({project:e})=>{try{const t=await l(o.visBin,o.workspaceRoot,["list","--targets","--json"]),s=e?t.filter(r=>r.name===e):t;if(e&&s.length===0)return i(new Error(`No project named "${e}". Use list_projects to see available names.`));const a=s.flatMap(r=>(r.targets??[]).map(n=>({...n,project:r.name,target:n.name})));return m({count:a.length,targets:a})}catch(t){return i(t)}})};export{j as registerListTargets};
|