vexp-mcp 3.4.1 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,10 @@ export const SEARCH_LOGIC_FLOW_DEFINITION = {
28
28
  };
29
29
  export async function handleSearchLogicFlow(params, daemon) {
30
30
  const validated = SearchLogicFlowSchema.parse(params);
31
- const result = await daemon.call("search_logic_flow", validated);
31
+ // `with_endpoints`: the daemon also says which symbols the two names
32
+ // resolved to, so an answer with no path is still checkable. An older
33
+ // daemon ignores it and sends the bare path array.
34
+ const result = await daemon.call("search_logic_flow", { ...validated, with_endpoints: true });
32
35
  // Handle cross-repo gap response
33
36
  if (typeof result === 'object' && result !== null && 'cross_repo_gap' in result) {
34
37
  return formatCrossRepoGap(result);
@@ -57,12 +60,37 @@ function formatCrossRepoGap(gap) {
57
60
  }
58
61
  return lines.join("\n");
59
62
  }
60
- function formatFlowAsText(start, end, paths) {
63
+ /**
64
+ * search_logic_flow as text. The native server's `render_logic_flow_result`
65
+ * (vexp-core/src/mcp_stdio.rs) writes the same lines; both test files hold
66
+ * the same fixture and expected text.
67
+ *
68
+ * Takes the daemon's `with_endpoints` object, or an older daemon's bare path
69
+ * array (rendered with the names as typed). When a name matched a different
70
+ * symbol than the one typed, a line says which: without it, "no path" after
71
+ * a guessed name cannot be told apart from two symbols that do not connect.
72
+ */
73
+ export function formatFlowAsText(start, end, result) {
61
74
  const lines = [];
62
- lines.push(`# Logic Flow: \`${start}\` → \`${end}\``);
75
+ const ends = Array.isArray(result) ? null : result;
76
+ const paths = Array.isArray(result)
77
+ ? result
78
+ : Array.isArray(result?.paths) ? result.paths : [];
79
+ lines.push(`# Logic Flow: \`${ends?.start?.fqn ?? start}\` → \`${ends?.end?.fqn ?? end}\``);
80
+ if (ends) {
81
+ for (const [label, endpoint, typed] of [["start", ends.start, start], ["end", ends.end, end]]) {
82
+ const fqn = endpoint?.fqn ?? typed;
83
+ if (fqn === typed)
84
+ continue;
85
+ const at = endpoint?.file_path
86
+ ? ` (${endpoint.file_path}${typeof endpoint.start_line === "number" ? `:${endpoint.start_line}` : ""})`
87
+ : "";
88
+ lines.push(`> ${label} \`${typed}\` matched \`${fqn}\`${at}`);
89
+ }
90
+ }
63
91
  lines.push(`> ${paths.length} path(s) found`);
64
92
  lines.push("");
65
- if (!Array.isArray(paths) || paths.length === 0) {
93
+ if (paths.length === 0) {
66
94
  lines.push("*No execution path found between these symbols. " +
67
95
  "They may not be connected, or the path may exceed the search depth.*");
68
96
  return lines.join("\n");
@@ -72,7 +100,10 @@ function formatFlowAsText(start, end, paths) {
72
100
  lines.push("");
73
101
  path.nodes.forEach((node, nodeIdx) => {
74
102
  const isLast = nodeIdx === path.nodes.length - 1;
75
- const edge = path.edges_description[nodeIdx] ?? "";
103
+ // edges_description[i] joins node i to node i + 1: a step is labelled
104
+ // with the edge that reaches it. Until 3.4.1 this read [nodeIdx], the
105
+ // edge leaving the step, so the first edge was never shown.
106
+ const edge = nodeIdx > 0 ? path.edges_description[nodeIdx - 1] ?? "" : "";
76
107
  if (nodeIdx === 0) {
77
108
  lines.push(`1. **START** \`${node.fqn}\``);
78
109
  lines.push(` *${node.file_path}:${node.start_line}*`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vexp-mcp",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "vexp MCP server — AI context tools for coding agents",
6
6
  "type": "module",