@visulima/vis-mcp 1.0.0-alpha.25 → 1.0.0-alpha.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +21 -12
  3. package/dist/bin.js +2 -2
  4. package/dist/index.d.ts +42 -1
  5. package/dist/index.js +1 -1
  6. package/dist/packem_shared/clearListCache-4BxipCYS.js +1 -0
  7. package/dist/packem_shared/createMcpServer-DOAejOGe.js +4 -0
  8. package/dist/packem_shared/errorResponse-CVaJrOoB.js +1 -0
  9. package/dist/packem_shared/execVis-CMeUcwPz.js +4 -0
  10. package/dist/packem_shared/isSafePositional-CJq1jfAS.js +1 -0
  11. package/dist/packem_shared/registerAdvisoryStatus-BHihSIOB.js +1 -0
  12. package/dist/packem_shared/registerAudit-DTsSWedQ.js +1 -0
  13. package/dist/packem_shared/registerCacheHash-gEdqaBTi.js +1 -0
  14. package/dist/packem_shared/registerCacheWhy-DSj2LYlR.js +1 -0
  15. package/dist/packem_shared/registerDescribeProject-HYlvD0tm.js +1 -0
  16. package/dist/packem_shared/registerDescribeTemplate-6RCmmfQs.js +1 -0
  17. package/dist/packem_shared/registerFmt-Dh0z0vq3.js +4 -0
  18. package/dist/packem_shared/registerGetRunLogs-CNGR-EcE.js +1 -0
  19. package/dist/packem_shared/registerLint-kA0hcRUz.js +4 -0
  20. package/dist/packem_shared/registerListProjects-DYz2st87.js +1 -0
  21. package/dist/packem_shared/registerListRuns-BPqPwFUQ.js +1 -0
  22. package/dist/packem_shared/registerListTargets-IWnJkyzy.js +1 -0
  23. package/dist/packem_shared/registerListTemplates-CSsN3JAE.js +1 -0
  24. package/package.json +4 -4
  25. package/dist/packem_shared/execVis-xKkBGVtU.js +0 -4
  26. package/dist/packem_shared/isValidRunId-BKsKMWQf.js +0 -1
  27. package/dist/packem_shared/okResponse-DdzqnveW.js +0 -1
  28. package/dist/packem_shared/registerAdvisoryStatus-C49m3wzN.js +0 -1
  29. package/dist/packem_shared/registerAllTools-BJu525kf.js +0 -3
  30. package/dist/packem_shared/registerAudit-CxOquZ97.js +0 -1
  31. package/dist/packem_shared/registerCacheHash-DLWsJrko.js +0 -1
  32. package/dist/packem_shared/registerCacheWhy-B8xDR5US.js +0 -1
  33. package/dist/packem_shared/registerDescribeProject-B6aCBcmT.js +0 -1
  34. package/dist/packem_shared/registerDescribeTemplate-DUso-ASt.js +0 -1
  35. package/dist/packem_shared/registerFmt-CRzEDH2d.js +0 -4
  36. package/dist/packem_shared/registerGetRunLogs-BxkRfYZU.js +0 -1
  37. package/dist/packem_shared/registerLint-BhuCzD64.js +0 -4
  38. package/dist/packem_shared/registerListProjects-DSpQ596w.js +0 -1
  39. package/dist/packem_shared/registerListTargets-B1AHgnI3.js +0 -1
  40. package/dist/packem_shared/registerListTemplates-qsRGPfj0.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## @visulima/vis-mcp [1.0.0-alpha.27](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.26...@visulima/vis-mcp@1.0.0-alpha.27) (2026-06-15)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/vis:** upgraded to 1.0.0-alpha.37
7
+
8
+ ## @visulima/vis-mcp [1.0.0-alpha.26](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.25...@visulima/vis-mcp@1.0.0-alpha.26) (2026-06-13)
9
+
10
+ ### Features
11
+
12
+ * **vis-mcp:** add audit/advisory/lint/fmt/list_runs tools and structured output ([4918e4b](https://github.com/visulima/visulima/commit/4918e4bb176508065bc8a578141beb79316c530d))
13
+
14
+ ### Code Refactoring
15
+
16
+ * **vis-mcp:** reformat source and README for prettier line-length ([5b41e65](https://github.com/visulima/visulima/commit/5b41e65dceb622cecf554b938261fb7c550a47bd))
17
+
18
+ ### Tests
19
+
20
+ * **vis-mcp:** assert error payloads are strings ([cf18663](https://github.com/visulima/visulima/commit/cf1866327423e77b6a99d6e6e41ebc9f10995dc2))
21
+
22
+ ### Build System
23
+
24
+ * **deps:** update vis-mcp dependencies ([5f27664](https://github.com/visulima/visulima/commit/5f2766405b74001dee44f90722e65608a71434ac))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * **@visulima/fs:** upgraded to 5.0.0-alpha.32
30
+ * **@visulima/path:** upgraded to 3.0.0-alpha.13
31
+ * **@visulima/vis:** upgraded to 1.0.0-alpha.36
32
+
1
33
  ## @visulima/vis-mcp [1.0.0-alpha.25](https://github.com/visulima/visulima/compare/@visulima/vis-mcp@1.0.0-alpha.24...@visulima/vis-mcp@1.0.0-alpha.25) (2026-06-09)
2
34
 
3
35
 
package/README.md CHANGED
@@ -85,21 +85,30 @@ Add the server to `~/Library/Application Support/Claude/claude_desktop_config.js
85
85
 
86
86
  ### Tools
87
87
 
88
- All eight tools are read-only. The agent prepares commands; a human runs them.
89
-
90
- | Tool | What it does |
91
- | ------------------- | ------------------------------------------------------------------------------------------------------- |
92
- | `list_projects` | List all workspace projects, optionally filtered by a vis query string. |
93
- | `describe_project` | Return full metadata for one project (language, layer, stack, targets). |
94
- | `list_targets` | Flatten projects into per-target rows; optionally narrow to one project. |
95
- | `list_templates` | List scaffolding templates discovered in the workspace, with source and one-line description. |
96
- | `describe_template` | Return template metadata: description, default destination, and the variable schema for `vis generate`. |
97
- | `get_run_logs` | Read a run summary from `.task-runner/`; optionally filter to one task. |
98
- | `cache_why` | Diff a task's hash inputs against the previous run to explain a rotation. |
99
- | `cache_hash` | Print the recorded hash and per-input hash details for a task. |
88
+ All tools are read-only (each is annotated `readOnlyHint: true`). The agent prepares commands; a human runs anything that writes. The `lint` and `fmt` tools always run in check-only mode and never apply fixes — invoke `vis lint --fix` / `vis fmt` directly for that.
89
+
90
+ | Tool | What it does |
91
+ | ------------------- | ------------------------------------------------------------------------------------------------------------ |
92
+ | `list_projects` | List all workspace projects, optionally filtered by a vis query string. |
93
+ | `describe_project` | Return full metadata for one project (language, layer, stack, targets). |
94
+ | `list_targets` | Flatten projects into per-target rows; optionally narrow to one project. |
95
+ | `list_templates` | List scaffolding templates discovered in the workspace, with source and one-line description. |
96
+ | `describe_template` | Return template metadata: description, default destination, and the variable schema for `vis generate`. |
97
+ | `get_run_logs` | Read a run summary from `.task-runner/`; optionally filter to one task. |
98
+ | `list_runs` | List recorded runs from `.task-runner/runs/` (newest first) with status and task counts to discover run IDs. |
99
+ | `cache_why` | Diff a task's hash inputs against the previous run to explain a rotation. |
100
+ | `cache_hash` | Print the recorded hash and per-input hash details for a task. |
101
+ | `audit` | Audit installed packages for known vulnerabilities and supply-chain risk (`vis audit`). |
102
+ | `advisory_status` | Report local OSV advisory DB freshness (path, schema version, per-ecosystem counts, last sync). |
103
+ | `lint` | Run the vis lint orchestrator in check-only mode (`vis lint --format json`) and return `{ findings, runs }`. |
104
+ | `fmt` | Run the vis fmt orchestrator in `--check` mode and return the files that would change. |
105
+
106
+ Tools backed by a typed CLI payload (`audit`, `advisory_status`, `lint`, `fmt`) also expose an `outputSchema` and return `structuredContent`, so MCP-aware clients can validate and render the result instead of re-parsing the JSON text block.
100
107
 
101
108
  ## Related
102
109
 
110
+ - [`@visulima/vis`](https://github.com/visulima/visulima/tree/main/packages/tooling/vis) — the workspace CLI this server exposes. vis-mcp is a thin RPC over `vis` subcommands and does not duplicate vis logic.
111
+
103
112
  ## Supported Node.js Versions
104
113
 
105
114
  Libraries in this ecosystem make the best effort to track [Node.js’ release schedule](https://github.com/nodejs/release#release-schedule).
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-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
- `),process.exit(1)}},"main"),p=e[1]!==void 0&&o(import.meta.url)===e[1];p&&await n();export{n as main};
2
+ import{argv as t}from"node:process";import{fileURLToPath as a}from"node:url";import{startMcpServer as o}from"./packem_shared/createMcpServer-DOAejOGe.js";const i=async()=>{try{await o()}catch(r){process.stderr.write(`[vis-mcp] failed to start: ${r instanceof Error?r.message:String(r)}
3
+ `),process.exit(1)}},e=t[1]!==void 0&&a(import.meta.url)===t[1];e&&await i();export{i as main};
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ declare const execVis: (visBin: string, args: ReadonlyArray<string>, options?: E
16
16
  declare const execVisJson: <T>(visBin: string, args: ReadonlyArray<string>, options?: ExecOptions) => Promise<T>;
17
17
  interface ExecResult {
18
18
  exitCode: number;
19
+ /** True when captured output hit `maxBufferBytes` and the child was killed. */
20
+ overflowed: boolean;
19
21
  stderr: string;
20
22
  stdout: string;
21
23
  timedOut: boolean;
@@ -23,10 +25,23 @@ interface ExecResult {
23
25
  interface ExecOptions {
24
26
  cwd?: string;
25
27
  env?: Record<string, string | undefined>;
28
+ /**
29
+ * Maximum combined stdout+stderr (in code units, an over-approximation of
30
+ * bytes) before the child is killed. Defaults to 64 MiB.
31
+ */
32
+ maxBufferBytes?: number;
26
33
  /** Hard ceiling. The default 120s suits cache lookups and listings. */
27
34
  timeoutMs?: number;
28
35
  }
29
36
  /**
37
+ * Run `vis list ...` and parse stdout as JSON, served from a short-TTL memo
38
+ * keyed on `workspaceRoot` + `args`. A rejected lookup is never cached, so a
39
+ * transient CLI failure does not poison subsequent calls.
40
+ */
41
+ declare const listVisJson: <T>(visBin: string, workspaceRoot: string, args: ReadonlyArray<string>, ttlMs?: number) => Promise<T>;
42
+ /** Clear the memo. Exposed for tests and long-running embeds that need a reset. */
43
+ declare const clearListCache: () => void;
44
+ /**
30
45
  * MCP tool response shape used across all `vis` tools. Kept in one place so
31
46
  * adding a new tool doesn't require re-deriving the type from the SDK.
32
47
  *
@@ -41,8 +56,21 @@ interface McpToolResponse {
41
56
  type: "text";
42
57
  }[];
43
58
  isError?: boolean;
59
+ /**
60
+ * Typed payload mirrored from `content`. Present only for tools that declare
61
+ * an `outputSchema`; lets MCP clients validate and render the result instead
62
+ * of re-parsing the JSON string in the text block.
63
+ */
64
+ structuredContent?: Record<string, unknown>;
44
65
  }
45
66
  declare const okResponse: (payload: unknown) => McpToolResponse;
67
+ /**
68
+ * Like {@link okResponse} but also attaches `structuredContent` so clients of a
69
+ * tool that declared an `outputSchema` get a validated, typed payload alongside
70
+ * the JSON text block. Only object payloads are valid structured content per the
71
+ * MCP spec, so the caller must pass a record.
72
+ */
73
+ declare const okStructuredResponse: (payload: Record<string, unknown>) => McpToolResponse;
46
74
  declare const errorResponse: (error: unknown) => McpToolResponse;
47
75
  interface ToolContext {
48
76
  /** Absolute path to the resolved `vis` CLI bundle. */
@@ -111,6 +139,9 @@ declare const registerLint: ({
111
139
  declare const registerListProjects: ({
112
140
  server
113
141
  }: ToolDeps, context: ToolContext) => void;
142
+ declare const registerListRuns: ({
143
+ server
144
+ }: ToolDeps, context: ToolContext) => void;
114
145
  declare const registerListTargets: ({
115
146
  server
116
147
  }: ToolDeps, context: ToolContext) => void;
@@ -124,4 +155,14 @@ declare const isValidRunId: (value: string) => boolean;
124
155
  * inert, but a leading `-` would be parsed as a CLI flag by the vis CLI.
125
156
  */
126
157
  declare const isValidTaskId: (value: string) => boolean;
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 };
158
+ /**
159
+ * Guard for free-form positional arguments forwarded to the vis CLI (template
160
+ * names, file paths). Spawn is argv-form so shell metacharacters are inert, but
161
+ * a leading `-` would be parsed as a CLI flag — turning an LLM-supplied
162
+ * `files: ["--fix"]` into a write operation that violates the `readOnlyHint`
163
+ * contract clients rely on for auto-approval. Callers must additionally insert
164
+ * a literal `--` separator before any positionals so a value that *becomes*
165
+ * flag-shaped through some other path can never be reinterpreted as an option.
166
+ */
167
+ declare const isSafePositional: (value: string) => boolean;
168
+ export { type ExecOptions, type ExecResult, type McpToolResponse, type ToolContext, type ToolDeps, clearListCache, createMcpServer, errorResponse, execVis, execVisJson, isSafePositional, isValidRunId, isValidTaskId, listVisJson, okResponse, okStructuredResponse, registerAdvisoryStatus, registerAllTools, registerAudit, registerCacheHash, registerCacheWhy, registerDescribeProject, registerDescribeTemplate, registerFmt, registerGetRunLogs, registerLint, registerListProjects, registerListRuns, registerListTargets, registerListTemplates, startMcpServer };
package/dist/index.js CHANGED
@@ -1 +1 @@
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};
1
+ import{execVis as t,execVisJson as o}from"./packem_shared/execVis-CMeUcwPz.js";import{clearListCache as i,listVisJson as p}from"./packem_shared/clearListCache-4BxipCYS.js";import{errorResponse as x,okResponse as f,okStructuredResponse as a}from"./packem_shared/errorResponse-CVaJrOoB.js";import{createMcpServer as c,registerAllTools as l,startMcpServer as n}from"./packem_shared/createMcpServer-DOAejOGe.js";import{registerAdvisoryStatus as u}from"./packem_shared/registerAdvisoryStatus-BHihSIOB.js";import{registerAudit as R}from"./packem_shared/registerAudit-DTsSWedQ.js";import{registerCacheHash as S}from"./packem_shared/registerCacheHash-gEdqaBTi.js";import{registerCacheWhy as V}from"./packem_shared/registerCacheWhy-DSj2LYlR.js";import{registerDescribeProject as v}from"./packem_shared/registerDescribeProject-HYlvD0tm.js";import{registerDescribeTemplate as C}from"./packem_shared/registerDescribeTemplate-6RCmmfQs.js";import{registerFmt as b}from"./packem_shared/registerFmt-Dh0z0vq3.js";import{registerGetRunLogs as y}from"./packem_shared/registerGetRunLogs-CNGR-EcE.js";import{registerLint as I}from"./packem_shared/registerLint-kA0hcRUz.js";import{registerListProjects as M}from"./packem_shared/registerListProjects-DYz2st87.js";import{registerListRuns as G}from"./packem_shared/registerListRuns-BPqPwFUQ.js";import{registerListTargets as W}from"./packem_shared/registerListTargets-IWnJkyzy.js";import{registerListTemplates as w}from"./packem_shared/registerListTemplates-CSsN3JAE.js";import{isSafePositional as B,isValidRunId as E,isValidTaskId as K}from"./packem_shared/isSafePositional-CJq1jfAS.js";export{i as clearListCache,c as createMcpServer,x as errorResponse,t as execVis,o as execVisJson,B as isSafePositional,E as isValidRunId,K as isValidTaskId,p as listVisJson,f as okResponse,a as okStructuredResponse,u as registerAdvisoryStatus,l as registerAllTools,R as registerAudit,S as registerCacheHash,V as registerCacheWhy,v as registerDescribeProject,C as registerDescribeTemplate,b as registerFmt,y as registerGetRunLogs,I as registerLint,M as registerListProjects,G as registerListRuns,W as registerListTargets,w as registerListTemplates,n as startMcpServer};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,4 @@
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-BHihSIOB.js";import{registerAudit as N}from"./registerAudit-DTsSWedQ.js";import{registerCacheHash as y}from"./registerCacheHash-gEdqaBTi.js";import{registerCacheWhy as _}from"./registerCacheWhy-DSj2LYlR.js";import{registerDescribeProject as k}from"./registerDescribeProject-HYlvD0tm.js";import{registerDescribeTemplate as P}from"./registerDescribeTemplate-6RCmmfQs.js";import{registerFmt as R}from"./registerFmt-Dh0z0vq3.js";import{registerGetRunLogs as C}from"./registerGetRunLogs-CNGR-EcE.js";import{registerLint as L}from"./registerLint-kA0hcRUz.js";import{registerListProjects as T}from"./registerListProjects-DYz2st87.js";import{registerListRuns as V}from"./registerListRuns-BPqPwFUQ.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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1,4 @@
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};
@@ -0,0 +1 @@
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,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{o as appendPositionalFiles,l as isSafePositional,n as isValidRunId,d as isValidTaskId};
@@ -0,0 +1 @@
1
+ import*as s from"zod";import{execVisJson as c}from"./execVis-CMeUcwPz.js";import{okStructuredResponse as d,errorResponse as u}from"./errorResponse-CVaJrOoB.js";const m=s.object({advisoryCount:s.number(),lastSyncIso:s.string(),manifestEtag:s.string().nullable(),name:s.string()}),o=s.object({dbPath:s.string(),ecosystems:s.array(m),exists:s.boolean(),schemaVersion:s.number(),sizeBytes:s.number()}).catchall(s.unknown()),h=o.shape,v=({server:a},t)=>{a.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 r=>{try{const e=["advisories","status","--format","json"];r.db!==void 0&&e.push("--db",r.db);const i=await c(t.visBin,e,{cwd:t.workspaceRoot}),n=o.parse(i);return d(n)}catch(e){return u(e)}})};export{v as registerAdvisoryStatus};
@@ -0,0 +1 @@
1
+ import*as e from"zod";import{execVisJson as c}from"./execVis-CMeUcwPz.js";import{okStructuredResponse as l,errorResponse as p}from"./errorResponse-CVaJrOoB.js";const u=e.object({fixedVersions:e.array(e.string()).optional(),id:e.string(),severity:e.string(),summary:e.string().optional()}),d=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)}),r=e.object({duplicates:e.array(e.object({name:e.string(),versionCount:e.number(),versions:e.array(e.string())})),packages:e.number(),results:e.array(d),summary:e.object({accepted:e.number(),duplicatePackages:e.number(),issues:e.number(),total:e.number()})}).catchall(e.unknown()),m=r.shape,y=["low","medium","high","critical"],f=({server:i},s)=>{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(y).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:m},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 c(s.visBin,t,{cwd:s.workspaceRoot}),n=r.parse(a);return l(n)}catch(t){return p(t)}})};export{f as registerAudit};
@@ -0,0 +1 @@
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"./isSafePositional-CJq1jfAS.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};
@@ -0,0 +1 @@
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"./isSafePositional-CJq1jfAS.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};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
1
+ import*as s from"zod";import{execVisJson as o}from"./execVis-CMeUcwPz.js";import{errorResponse as r,okResponse as i}from"./errorResponse-CVaJrOoB.js";import{isSafePositional as m}from"./isSafePositional-CJq1jfAS.js";const d=({server:n},a)=>{n.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(!m(e))return r(new Error(`Invalid template name "${e}". A leading "-" would be parsed as a CLI flag.`));try{const t=await o(a.visBin,["generate","--describe","--json","--",e],{cwd:a.workspaceRoot});return i(t)}catch(t){return r(t)}})};export{d as registerDescribeTemplate};
@@ -0,0 +1,4 @@
1
+ import*as e from"zod";import{execVis as f}from"./execVis-CMeUcwPz.js";import{errorResponse as n,okStructuredResponse as p}from"./errorResponse-CVaJrOoB.js";import{appendPositionalFiles as h}from"./isSafePositional-CJq1jfAS.js";const l=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()),u=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),g=e.object({findings:e.array(l),mode:e.enum(["check","fix"]).optional(),runs:e.array(u)}).catchall(e.unknown()),w={exitCode:e.number(),findings:e.array(l),mode:e.enum(["check","fix"]),runs:e.array(u)},y=({server:m},s)=>{m.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:w},async i=>{try{const t=["fmt","--check","--format","json"];i.quiet&&t.push("--quiet"),i.staged?t.push("--staged"):i.since!==void 0&&i.since.length>0&&t.push("--since",i.since);const a=h(t,i.files);if(a!==void 0)return n(new Error(a));const r=await f(s.visBin,t,{cwd:s.workspaceRoot});if(r.timedOut)return n(new Error("vis fmt timed out"));if(r.overflowed)return n(new Error("vis fmt produced more output than the buffer ceiling allows and was killed"));if(r.stdout.trim().length===0){const o=r.stderr.trim().split(`
2
+ `).slice(-5).join(`
3
+ `);return n(new Error(`vis fmt exited with code ${String(r.exitCode)} and no JSON output${o?`
4
+ ${o}`:""}`))}let c;try{c=JSON.parse(r.stdout)}catch(o){return n(new Error(`vis ${t.join(" ")} did not emit valid JSON: ${o instanceof Error?o.message:String(o)}`,{cause:o}))}const d=g.parse(c);return p({...d,exitCode:r.exitCode,mode:d.mode??"check"})}catch(t){return n(t)}})};export{y as registerFmt};
@@ -0,0 +1 @@
1
+ import{readFile as c}from"node:fs/promises";import{join as u}from"@visulima/path";import*as d from"zod";import{errorResponse as e,okResponse as l}from"./errorResponse-CVaJrOoB.js";import{isValidRunId as f}from"./isSafePositional-CJq1jfAS.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:d.string().optional().describe("Run ID (default: latest)"),taskId:d.string().optional().describe('Filter to a single task ID like "@my/app:build"')}},async({runId:r,taskId:s})=>{if(r!==void 0&&!f(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 c(a,"utf8"),n=JSON.parse(t);if(s){const i=n.tasks?.find(m=>m.taskId===s);return i?l({runId:n.runId,task:i}):e(new Error(`Task "${s}" not found in run "${n.runId??"(unknown)"}".`))}return l(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};
@@ -0,0 +1,4 @@
1
+ import*as e from"zod";import{execVis as m}from"./execVis-CMeUcwPz.js";import{errorResponse as o,okStructuredResponse as g}from"./errorResponse-CVaJrOoB.js";import{appendPositionalFiles as f}from"./isSafePositional-CJq1jfAS.js";const d=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()),u=e.object({adapter:e.string(),durationMs:e.number(),exitCode:e.number(),findingCount:e.number()}).catchall(e.unknown()),h=e.object({findings:e.array(d),runs:e.array(u)}).catchall(e.unknown()),w={exitCode:e.number(),findings:e.array(d),runs:e.array(u)},x=({server:c},s)=>{c.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:w},async t=>{try{const n=["lint","--format","json"];t.quiet&&n.push("--quiet"),typeof t.maxWarnings=="number"&&n.push("--max-warnings",String(t.maxWarnings)),t.staged?n.push("--staged"):t.since!==void 0&&t.since.length>0&&n.push("--since",t.since);const a=f(n,t.files);if(a!==void 0)return o(new Error(a));const i=await m(s.visBin,n,{cwd:s.workspaceRoot});if(i.timedOut)return o(new Error("vis lint timed out"));if(i.overflowed)return o(new Error("vis lint produced more output than the buffer ceiling allows and was killed"));if(i.stdout.trim().length===0){const r=i.stderr.trim().split(`
2
+ `).slice(-5).join(`
3
+ `);return o(new Error(`vis lint exited with code ${String(i.exitCode)} and no JSON output${r?`
4
+ ${r}`:""}`))}let l;try{l=JSON.parse(i.stdout)}catch(r){return o(new Error(`vis ${n.join(" ")} did not emit valid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r}))}const p=h.parse(l);return g({...p,exitCode:i.exitCode})}catch(n){return o(n)}})};export{x as registerLint};
@@ -0,0 +1 @@
1
+ import*as i from"zod";import{execVisJson as n}from"./execVis-CMeUcwPz.js";import{okResponse as a,errorResponse as p}from"./errorResponse-CVaJrOoB.js";const g=({server:o},e)=>{o.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:i.string().optional().describe('Filter projects by vis query string (e.g. "tag=frontend")')}},async({query:r})=>{try{const t=["list","--json"];r&&t.push("--query",r);const s=await n(e.visBin,t,{cwd:e.workspaceRoot});return a({count:s.length,projects:s})}catch(t){return p(t)}})};export{g as registerListProjects};
@@ -0,0 +1 @@
1
+ import{readdir as h,stat as k,readFile as g}from"node:fs/promises";import{join as l}from"@visulima/path";import*as y from"zod";import{okResponse as m,errorResponse as f}from"./errorResponse-CVaJrOoB.js";const v=/\.json$/,w=r=>{if(typeof r.status=="string")return r.status;if(r.tasks)return r.tasks.some(n=>n.status==="failure"||n.status==="failed")?"failure":"success"},R=({server:r},n)=>{r.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:y.int().positive().max(100).optional().describe("Maximum runs to return (default: 20, newest first).")}},async({limit:p})=>{const d=l(n.workspaceRoot,".task-runner","runs");let c;try{c=(await h(d)).filter(t=>t.endsWith(".json"))}catch(t){return t.code==="ENOENT"?m({count:0,runs:[]}):f(t)}try{const t=(await Promise.all(c.map(async s=>{const a=l(d,s);try{const[o,u]=await Promise.all([k(a),g(a,"utf8")]),e=JSON.parse(u);return{failedTasks:e.tasks?.filter(i=>i.status==="failure"||i.status==="failed").length,modifiedMs:o.mtimeMs,runId:e.runId??s.replace(v,""),startedAt:e.startedAt,status:w(e),taskCount:e.tasks?.length}}catch{return}}))).filter(s=>s!==void 0).toSorted((s,a)=>a.modifiedMs-s.modifiedMs).slice(0,p??20).map(s=>{const{failedTasks:a,runId:o,startedAt:u,status:e,taskCount:i}=s;return{failedTasks:a,runId:o,startedAt:u,status:e,taskCount:i}});return m({count:t.length,runs:t})}catch(t){return f(t)}})};export{R as registerListRuns};
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
1
+ import{execVisJson as n}from"./execVis-CMeUcwPz.js";import{okResponse as o,errorResponse as r}from"./errorResponse-CVaJrOoB.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.0-alpha.25",
3
+ "version": "1.0.0-alpha.27",
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.31",
59
- "@visulima/path": "3.0.0-alpha.12",
58
+ "@visulima/fs": "5.0.0-alpha.32",
59
+ "@visulima/path": "3.0.0-alpha.13",
60
60
  "zod": "4.4.3"
61
61
  },
62
62
  "peerDependencies": {
63
- "@visulima/vis": "1.0.0-alpha.35"
63
+ "@visulima/vis": "1.0.0-alpha.37"
64
64
  },
65
65
  "engines": {
66
66
  "node": "^22.14.0 || >=24.10.0"
@@ -1,4 +0,0 @@
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};
@@ -1 +0,0 @@
1
- var d=Object.defineProperty;var a=(i,s)=>d(i,"name",{value:s,configurable:!0});var t=Object.defineProperty,e=a((i,s)=>t(i,"name",{value:s,configurable:!0}),"s");const n=/^[\w.-]+$/,r=e(i=>n.test(i),"isValidRunId"),o=e(i=>i.length>0&&!i.startsWith("-")&&i.includes(":"),"isValidTaskId");export{r as isValidRunId,o as isValidTaskId};
@@ -1 +0,0 @@
1
- var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});var s=Object.defineProperty,n=t((e,r)=>s(e,"name",{value:r,configurable:!0}),"o");const p=n(e=>({content:[{text:typeof e=="string"?e:JSON.stringify(e),type:"text"}]}),"okResponse"),a=n(e=>{const r=e instanceof Error?e.message:String(e);return{content:[{text:JSON.stringify({error:r}),type:"text"}],isError:!0}},"errorResponse");export{a as errorResponse,p as okResponse};
@@ -1 +0,0 @@
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};
@@ -1,3 +0,0 @@
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};
@@ -1 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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};
@@ -1 +0,0 @@
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 +0,0 @@
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
- `).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};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var d=(t,r)=>f(t,"name",{value:r,configurable:!0});import{readFile as k}from"node:fs/promises";import{join as l}from"@visulima/path";import*as m from"zod";import{errorResponse as o,okResponse as p}from"./okResponse-DdzqnveW.js";import{isValidRunId as I}from"./isValidRunId-BKsKMWQf.js";var g=Object.defineProperty,y=d((t,r)=>g(t,"name",{value:r,configurable:!0}),"m");const h=y(({server:t},r)=>{t.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:m.string().optional().describe("Run ID (default: latest)"),taskId:m.string().optional().describe('Filter to a single task ID like "@my/app:build"')}},async({runId:e,taskId:a})=>{if(e!==void 0&&!I(e))return o(new Error(`Invalid runId "${e}". Expected filesystem-safe slug ([A-Za-z0-9_.-]).`));const i=e?l(r.workspaceRoot,".task-runner","runs",`${e}.json`):l(r.workspaceRoot,".task-runner","last-summary.json");try{const n=await k(i,"utf8"),s=JSON.parse(n);if(a){const u=s.tasks?.find(c=>c.taskId===a);return u?p({runId:s.runId,task:u}):o(new Error(`Task "${a}" not found in run "${s.runId??"(unknown)"}".`))}return p(s)}catch(n){return n.code==="ENOENT"?o(new Error(`No run summary at ${i}. Run a task first to populate it.`)):o(n)}})},"registerGetRunLogs");export{h as registerGetRunLogs};
@@ -1,4 +0,0 @@
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
- `).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};
@@ -1 +0,0 @@
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 +0,0 @@
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};
@@ -1 +0,0 @@
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};