Skip to content

The agent that turns websites into APIs!

feat(cursor): MCP/todo UI, OpenCode parity, and web tools via settingSources

Cursor Agent07cb32d323ee
diff --git a/src/reverse_api/cli.py b/src/reverse_api/cli.py
index 473c7c9..a5086fc 100644
--- a/src/reverse_api/cli.py
+++ b/src/reverse_api/cli.py
@@ -928,6 +928,7 @@ def handle_settings(mode_color=THEME_PRIMARY):
Choice(title="Claude Code Model", value="claude_code_model"),
Choice(title="Copilot Model", value="copilot_model"),
Choice(title="Cursor Model", value="cursor_model"),
+ Choice(title="Cursor Web Search", value="cursor_web_search"),
Choice(title="OpenCode Model", value="opencode_model"),
Choice(title="OpenCode Provider", value="opencode_provider"),
Choice(title="Output Directory", value="output_dir"),
@@ -1121,6 +1122,27 @@ def handle_settings(mode_color=THEME_PRIMARY):
config_manager.set("cursor_model", new_model)
console.print(f" [dim]updated[/dim] cursor model: {new_model}\n")
+ elif action == "cursor_web_search":
+ pick = questionary.select(
+ "",
+ choices=[
+ Choice(title="On — WebFetch/WebSearch + plugins/team settings", value=True),
+ Choice(title="Off — project + user Cursor settings only", value=False),
+ Choice(title="back", value="back"),
+ ],
+ pointer=">",
+ qmark="",
+ style=questionary.Style(
+ [
+ ("pointer", f"fg:{mode_color} bold"),
+ ("highlighted", f"fg:{mode_color} bold"),
+ ]
+ ),
+ ).ask()
+ if pick is not None and pick != "back":
+ config_manager.set("cursor_web_search", pick)
+ console.print(f" [dim]updated[/dim] cursor web search: {'on' if pick else 'off'}\n")
+
elif action == "opencode_model":
current = config_manager.get("opencode_model", "claude-opus-4-6")
new_model = questionary.text(
@@ -1782,6 +1804,8 @@ def run_auto_capture(
elif sdk == "cursor":
from .cursor_engineer import CursorAutoEngineer
+ _cs = config_manager.get("cursor_setting_sources")
+ _cursor_src = _cs if isinstance(_cs, list) and all(isinstance(x, str) for x in _cs) else None
engineer = CursorAutoEngineer(
run_id=run_id,
prompt=prompt,
@@ -1793,6 +1817,8 @@ def run_auto_capture(
interactive=interactive,
headless=headless,
cursor_model=config_manager.get("cursor_model", "composer-2"),
+ cursor_web_search=bool(config_manager.get("cursor_web_search", True)),
+ cursor_setting_sources=_cursor_src,
)
else:
from .auto_engineer import ClaudeAutoEngineer
@@ -2056,6 +2082,8 @@ def run_engineer(
interactive=interactive,
)
elif sdk == "cursor":
+ _cs = config_manager.get("cursor_setting_sources")
+ _cursor_src = _cs if isinstance(_cs, list) and all(isinstance(x, str) for x in _cs) else None
result = run_reverse_engineering(
run_id=run_id,
har_path=har_path,
@@ -2064,6 +2092,8 @@ def run_engineer(
output_dir=output_dir,
sdk=sdk,
cursor_model=config_manager.get("cursor_model", "composer-2"),
+ cursor_web_search=bool(config_manager.get("cursor_web_search", True)),
+ cursor_setting_sources=_cursor_src,
enable_sync=enable_sync,
additional_instructions=additional_instructions,
is_fresh=is_fresh,
diff --git a/src/reverse_api/config.py b/src/reverse_api/config.py
index e09dfa2..90c108c 100644
--- a/src/reverse_api/config.py
+++ b/src/reverse_api/config.py
@@ -9,6 +9,11 @@ DEFAULT_CONFIG = {
"claude_code_model": "claude-sonnet-4-6",
"collector_model": "claude-sonnet-4-6", # Model for collector mode
"cursor_model": "composer-2", # Model id for Cursor SDK (see Cursor.models.list())
+ # When True, local agents load broader Cursor setting layers (plugins/team) so WebFetch/WebSearch
+ # and other IDE tools match Cursor desktop behavior. Set False for minimal "project+user" only.
+ "cursor_web_search": True,
+ # Optional override: list of setting source ids, e.g. ["project","user","all"]. None uses cursor_web_search.
+ "cursor_setting_sources": None,
"copilot_model": "gpt-5", # Model for Copilot SDK sessions
"opencode_model": "claude-opus-4-6",
"opencode_provider": "anthropic",
diff --git a/src/reverse_api/cursor_bridge/run.mjs b/src/reverse_api/cursor_bridge/run.mjs
index 6691920..cd1a8da 100644
--- a/src/reverse_api/cursor_bridge/run.mjs
+++ b/src/reverse_api/cursor_bridge/run.mjs
@@ -73,6 +73,13 @@ if (!prompt || typeof prompt !== "string") {
process.exit(1);
}
+const settingSources =
+ Array.isArray(input.settingSources) && input.settingSources.length > 0
+ ? input.settingSources
+ : input.cursorWebSearch === false
+ ? ["project", "user"]
+ : ["project", "user", "plugins", "team"];
+
const usageAgg = {
input_tokens: 0,
output_tokens: 0,
@@ -87,13 +94,13 @@ try {
agent = await Agent.resume(resumeAgentId, {
apiKey,
model: { id: modelId },
- local: { cwd },
+ local: { cwd, settingSources },
});
} else {
agent = await Agent.create({
apiKey,
model: { id: modelId },
- local: { cwd },
+ local: { cwd, settingSources },
mcpServers,
});
}
diff --git a/src/reverse_api/cursor_engineer.py b/src/reverse_api/cursor_engineer.py
index 39a34c9..5e4e481 100644
--- a/src/reverse_api/cursor_engineer.py
+++ b/src/reverse_api/cursor_engineer.py
@@ -69,16 +69,41 @@ class CursorEngineer(BaseEngineer):
prompt: str,
model: str | None = None,
cursor_model: str | None = None,
+ cursor_web_search: bool = True,
+ cursor_setting_sources: list[str] | None = None,
**kwargs: Any,
):
cm = cursor_model or model or "composer-2"
super().__init__(run_id=run_id, har_path=har_path, prompt=prompt, model=cm, **kwargs)
self.cursor_model = cm
+ self.cursor_web_search = cursor_web_search
+ self.cursor_setting_sources = cursor_setting_sources
vb = self.ui.verbose
self.ui = CursorStreamUI(self, verbose=vb)
self._cursor_thinking_acc = ""
self._cursor_assistant_acc = ""
+ @staticmethod
+ def _cursor_coerce_args(raw: Any) -> dict[str, Any]:
+ if isinstance(raw, dict):
+ return raw
+ if isinstance(raw, str) and raw.strip().startswith("{"):
+ try:
+ parsed = json.loads(raw)
+ return parsed if isinstance(parsed, dict) else {}
+ except json.JSONDecodeError:
+ return {}
+ return {}
+
+ def _cursor_emit_todo_ui(self, name: str, args: dict[str, Any]) -> None:
+ if "todo" not in name.lower():
+ return
+ todos = args.get("todos")
+ if not isinstance(todos, list) or not todos:
+ return
+ self.ui.todo_updated(todos)
+ self.message_store.save_todos(todos)
+
def _workspace_cwd(self) -> str:
return str(self.scripts_dir.parent.parent)
@@ -138,7 +163,8 @@ class CursorEngineer(BaseEngineer):
status = event.get("status")
if status == "running":
self._cursor_flush_narrative()
- args = event.get("args") if isinstance(event.get("args"), dict) else {}
+ args = self._cursor_coerce_args(event.get("args"))
+ self._cursor_emit_todo_ui(name, args)
self.ui.tool_start(name, args)
self.message_store.save_tool_start(name, args)
else:
@@ -148,7 +174,7 @@ class CursorEngineer(BaseEngineer):
self.ui.tool_result(name, is_err, out)
self.message_store.save_tool_result(name, is_err, out)
- async def _one_turn(
+ async def _one_turn( # noqa: C901 - subprocess + NDJSON; splitting obscures control flow
self,
prompt: str,
*,
@@ -167,6 +193,10 @@ class CursorEngineer(BaseEngineer):
req["mcpServers"] = mcp_servers
if resume_agent_id:
req["resumeAgentId"] = resume_agent_id
+ if isinstance(self.cursor_setting_sources, list) and self.cursor_setting_sources:
+ req["settingSources"] = [str(x) for x in self.cursor_setting_sources]
+ else:
+ req["cursorWebSearch"] = bool(self.cursor_web_search)
pre = _ensure_cursor_bridge_deps()
if pre:
@@ -214,7 +244,7 @@ class CursorEngineer(BaseEngineer):
while True:
try:
line_b = await asyncio.wait_for(proc.stdout.readline(), timeout=900.0)
- except asyncio.TimeoutError:
+ except TimeoutError:
ret = {"error": "cursor bridge: no stdout for 15 minutes (timed out)"}
break
if not line_b:
@@ -270,11 +300,11 @@ class CursorEngineer(BaseEngineer):
finally:
try:
await asyncio.wait_for(proc.wait(), timeout=120.0)
- except asyncio.TimeoutError:
+ except TimeoutError:
try:
proc.terminate()
await asyncio.wait_for(proc.wait(), timeout=15.0)
- except (ProcessLookupError, asyncio.TimeoutError):
+ except (ProcessLookupError, TimeoutError):
try:
proc.kill()
except ProcessLookupError:
diff --git a/src/reverse_api/engineer.py b/src/reverse_api/engineer.py
index 6948fe9..2ad5dde 100644
--- a/src/reverse_api/engineer.py
+++ b/src/reverse_api/engineer.py
@@ -211,6 +211,8 @@ def run_reverse_engineering(
opencode_model: str | None = None,
copilot_model: str | None = None,
cursor_model: str | None = None,
+ cursor_web_search: bool = True,
+ cursor_setting_sources: list[str] | None = None,
enable_sync: bool = False,
is_fresh: bool = False,
output_language: str = "python",
@@ -225,6 +227,8 @@ def run_reverse_engineering(
opencode_model: Model ID for OpenCode (e.g., "claude-sonnet-4-6")
copilot_model: Model ID for Copilot (e.g., "gpt-5")
cursor_model: Model id for Cursor SDK (e.g., "composer-2")
+ cursor_web_search: When True, load extra Cursor setting layers so WebFetch/WebSearch and plugins apply.
+ cursor_setting_sources: Optional explicit list (overrides cursor_web_search), e.g. ["project","user","all"].
enable_sync: Enable real-time file syncing during engineering
is_fresh: Whether to start fresh (ignore previous scripts)
output_language: Target language - "python", "javascript", or "typescript"
@@ -267,6 +271,8 @@ def run_reverse_engineering(
output_language=output_language,
output_mode=output_mode,
cursor_model=cursor_model,
+ cursor_web_search=cursor_web_search,
+ cursor_setting_sources=cursor_setting_sources,
interactive=interactive,
)
elif sdk == "copilot":
diff --git a/src/reverse_api/messages.py b/src/reverse_api/messages.py
index 52276e4..564a160 100644
--- a/src/reverse_api/messages.py
+++ b/src/reverse_api/messages.py
@@ -49,6 +49,10 @@ class MessageStore:
"""Save Claude's thinking/response text."""
self.append("thinking", text)
+ def save_todos(self, todos: list) -> None:
+ """Persist a todo list snapshot (e.g. Cursor / agent todo tools)."""
+ self.append("todos", todos)
+
def save_error(self, error: str) -> None:
"""Save an error event."""
self.append("error", error)
diff --git a/src/reverse_api/opencode_ui.py b/src/reverse_api/opencode_ui.py
index 0378f24..59744c2 100644
--- a/src/reverse_api/opencode_ui.py
+++ b/src/reverse_api/opencode_ui.py
@@ -1,5 +1,6 @@
"""OpenCode-specific Terminal UI with live streaming updates."""
+import json
from typing import Any
from rich.console import Console
@@ -125,9 +126,20 @@ class OpenCodeUI:
self._tool_status = "running"
self._tools_used.append(tool_name)
- # Print tool start (this stays in terminal)
- input_summary = self._summarize_input(tool_name, tool_input or {})
- self.console.print(f" [dim]>[/dim] {tool_name.lower():12} {input_summary}")
+ args = tool_input if isinstance(tool_input, dict) else {}
+ tl = (tool_name or "").lower()
+ icon = "◇" if tl.startswith("mcp") else ">"
+ header = tool_name or "tool"
+ if tl.startswith("mcp_"):
+ rest = tool_name[4:].replace("__", " · ").replace("_", " ")
+ header = rest[:56] + ("…" if len(rest) > 56 else "")
+ elif len(header) > 48:
+ header = header[:45] + "…"
+
+ input_summary = self._summarize_input(tool_name, args)
+ self.console.print(f" [dim]{icon}[/dim] [white]{header}[/white]")
+ if input_summary:
+ self.console.print(f" {input_summary}")
if self._live:
self._live.update(self._build_display())
@@ -249,34 +261,42 @@ class OpenCodeUI:
def todo_updated(self, todos: list) -> None:
"""Display todo list updates."""
- if not todos:
+ if not self.verbose or not todos:
return
- # Count by status
- pending = sum(1 for t in todos if t.get("status") == "pending")
- completed = sum(1 for t in todos if t.get("status") == "completed")
- in_progress_todos = [t for t in todos if t.get("status") == "in_progress"]
-
- parts = []
- if in_progress_todos:
- parts.append(f"{len(in_progress_todos)} active")
+ icons = {
+ "pending": "○",
+ "in_progress": "›",
+ "completed": "✓",
+ "cancelled": "✗",
+ }
+ pending = sum(1 for t in todos if str(t.get("status", "")).lower() == "pending")
+ done = sum(1 for t in todos if str(t.get("status", "")).lower() == "completed")
+ active = [t for t in todos if str(t.get("status", "")).lower() == "in_progress"]
+
+ summary_parts: list[str] = []
+ if active:
+ summary_parts.append(f"{len(active)} active")
if pending:
- parts.append(f"{pending} pending")
- if completed:
- parts.append(f"{completed} done")
-
- status_str = ", ".join(parts) if parts else f"{len(todos)} items"
-
- # Show current task if there is one in progress
- if in_progress_todos:
- current_task = in_progress_todos[0]
- task_content = current_task.get("activeForm") or current_task.get("content", "")
- # Truncate if too long
- if len(task_content) > 50:
- task_content = task_content[:47] + "..."
- self.console.print(f" [dim]tasks:[/dim] {status_str} [dim]→ {task_content}[/dim]")
- else:
- self.console.print(f" [dim]tasks:[/dim] {status_str}")
+ summary_parts.append(f"{pending} pending")
+ if done:
+ summary_parts.append(f"{done} done")
+ summary = ", ".join(summary_parts) if summary_parts else f"{len(todos)} items"
+
+ self.console.print(f" [dim]todos[/dim] [white]{summary}[/white]")
+ for t in todos[:14]:
+ st = str(t.get("status", "pending")).lower()
+ ic = icons.get(st, "·")
+ line = (t.get("activeForm") or t.get("content") or "").strip() or "(empty)"
+ if len(line) > 76:
+ line = line[:73] + "..."
+ self.console.print(f" [dim]{ic}[/dim] {line}")
+ if len(todos) > 14:
+ self.console.print(f" [dim]… {len(todos) - 14} more[/dim]")
+ self.console.print()
+
+ if self._live:
+ self._live.update(self._build_display())
def file_edited(self, file_path: str) -> None:
"""Display when a file is edited."""
@@ -324,6 +344,41 @@ class OpenCodeUI:
"""Create a brief summary of tool input."""
tool_lower = tool_name.lower()
+ if tool_lower in ("todowrite", "todo_write", "write_todos", "update_todos"):
+ todos = tool_input.get("todos", [])
+ if isinstance(todos, list):
+ return f"[dim]{len(todos)} item(s)[/dim]"
+ return "[dim]todos[/dim]"
+ if tool_lower == "call_mcp_tool":
+ mn = tool_input.get("name") or tool_input.get("server") or tool_input.get("tool")
+ if isinstance(mn, str) and mn:
+ return f"[dim]{mn[:70]}{'…' if len(mn) > 70 else ''}[/dim]"
+ return ""
+ if tool_lower.startswith("mcp_") or tool_lower.startswith("mcp"):
+ keys = ("url", "path", "file_path", "command", "query", "pattern", "browserTab", "tabId", "text")
+ for k in keys:
+ v = tool_input.get(k)
+ if isinstance(v, str) and v.strip():
+ vv = v.replace("\n", " ").strip()
+ cap = 72 if k in ("url", "path", "file_path") else 60
+ return f"[dim]{k}[/dim] [dim]{vv[:cap]}{'…' if len(vv) > cap else ''}[/dim]"
+ args = tool_input.get("arguments")
+ if isinstance(args, str) and args.strip().startswith("{"):
+ try:
+ args = json.loads(args)
+ except json.JSONDecodeError:
+ args = None
+ if isinstance(args, dict):
+ for k in keys:
+ v = args.get(k)
+ if isinstance(v, str) and v.strip():
+ vv = v.replace("\n", " ").strip()
+ return f"[dim]{k}[/dim] [dim]{vv[:70]}{'…' if len(vv) > 70 else ''}[/dim]"
+ blob = json.dumps(tool_input, default=str)
+ if len(blob) > 90:
+ return f"[dim]{blob[:87]}…[/dim]"
+ return f"[dim]{blob}[/dim]"
+
if tool_lower in ("read", "file_read"):
path = tool_input.get("path", tool_input.get("file_path", ""))
return f"[dim]{self._truncate_path(path)}[/dim]"
@@ -339,9 +394,9 @@ class OpenCodeUI:
elif tool_lower in ("webfetch", "web_fetch"):
url = str(tool_input.get("url", ""))[:50]
return f"[dim]{url}{'...' if len(url) >= 50 else ''}[/dim]"
- elif tool_lower == "todowrite":
- todos = tool_input.get("todos", [])
- return f"[dim]{len(todos)} items[/dim]"
+ elif tool_lower in ("websearch", "web_search"):
+ q = str(tool_input.get("query", ""))[:50]
+ return f"[dim]'{q}{'...' if len(q) >= 50 else ''}'[/dim]"
return ""
diff --git a/src/reverse_api/tui.py b/src/reverse_api/tui.py
index ea443ac..d8f3509 100644
--- a/src/reverse_api/tui.py
+++ b/src/reverse_api/tui.py
@@ -1,5 +1,8 @@
"""Rich Terminal UI for Claude SDK interactions."""
+import json
+from typing import Any
+
from rich.console import Console
from rich.padding import Padding
from rich.text import Text
@@ -34,6 +37,7 @@ TOOL_ICONS = {
"WebFetch": "wf",
"Task": "tk",
"AskUserQuestion": "??",
+ "mcp": "◇",
"browser_navigate": "br",
"browser_click": "br",
"browser_type": "br",
@@ -88,23 +92,30 @@ class ClaudeUI:
self.console.print(" [dim]decoding starting...[/dim]")
self.console.print()
- def tool_start(self, tool_name: str, tool_input: dict) -> None:
+ def tool_start(self, tool_name: str, tool_input: dict | Any) -> None:
"""Display when a tool starts execution."""
self._tool_count += 1
self._tools_used.append(tool_name)
- icon = TOOL_ICONS.get(tool_name, TOOL_ICONS["default"])
-
- # Build input summary
- input_summary = self._summarize_input(tool_name, tool_input)
+ args = self._coerce_tool_input(tool_input)
+ icon = self._tool_icon_for(tool_name)
+ header = self._tool_header_label(tool_name)
+ input_summary = self._summarize_input(tool_name, args)
- # Compact single-line format
- self.console.print(f" [dim]>[/dim] {icon} [white]{tool_name.lower():8}[/white] {input_summary}")
+ self.console.print(f" [dim]>[/dim] {icon} [white]{header}[/white]")
+ if input_summary:
+ self.console.print(f" {input_summary}")
def tool_result(self, tool_name: str, is_error: bool = False, output: str | None = None) -> None:
"""Display when a tool completes."""
+ tl = tool_name.lower()
if is_error:
- self.console.print(f" [dim]![/dim] [red]{tool_name.lower()} failed[/red]")
+ self.console.print(f" [dim]![/dim] [red]{self._tool_header_label(tool_name)} failed[/red]")
+ if output and self.verbose:
+ err = str(output).strip().replace("\n", " ")
+ if len(err) > 200:
+ err = err[:197] + "..."
+ self.console.print(f" [dim]{err}[/dim]")
elif tool_name == "Bash" and output and self.verbose:
# Display bash output
output_str = str(output).strip()
@@ -115,6 +126,53 @@ class ClaudeUI:
self.console.print(f" [dim]│[/dim] [dim]{line}[/dim]")
if len(output_lines) > max_lines:
self.console.print(f" [dim]│[/dim] [dim]... ({len(output_lines) - max_lines} more lines)[/dim]")
+ elif output and self.verbose and (tl.startswith("mcp") or "web" in tl or "fetch" in tl):
+ preview = str(output).strip()
+ if len(preview) > 400:
+ preview = preview[:397] + "..."
+ if "\n" in preview:
+ lines = preview.split("\n")[:12]
+ self.console.print(" [dim]│[/dim] [dim]result[/dim]")
+ for line in lines:
+ self.console.print(f" [dim]│[/dim] [dim]{line[:140]}{'…' if len(line) > 140 else ''}[/dim]")
+ elif preview:
+ self.console.print(f" [dim]│[/dim] [dim]{preview}[/dim]")
+
+ def todo_updated(self, todos: list) -> None:
+ """Show agent todo list (Cursor / Claude todo-style tools)."""
+ if not self.verbose or not todos:
+ return
+
+ icons = {
+ "pending": "○",
+ "in_progress": "›",
+ "completed": "✓",
+ "cancelled": "✗",
+ }
+ pending = sum(1 for t in todos if str(t.get("status", "")).lower() == "pending")
+ done = sum(1 for t in todos if str(t.get("status", "")).lower() == "completed")
+ active = [t for t in todos if str(t.get("status", "")).lower() == "in_progress"]
+
+ summary_parts: list[str] = []
+ if active:
+ summary_parts.append(f"{len(active)} active")
+ if pending:
+ summary_parts.append(f"{pending} pending")
+ if done:
+ summary_parts.append(f"{done} done")
+ summary = ", ".join(summary_parts) if summary_parts else f"{len(todos)} items"
+
+ self.console.print(f" [dim]todos[/dim] [white]{summary}[/white]")
+ for t in todos[:14]:
+ st = str(t.get("status", "pending")).lower()
+ ic = icons.get(st, "·")
+ line = (t.get("activeForm") or t.get("content") or "").strip() or "(empty)"
+ if len(line) > 76:
+ line = line[:73] + "..."
+ self.console.print(f" [dim]{ic}[/dim] {line}")
+ if len(todos) > 14:
+ self.console.print(f" [dim]… {len(todos) - 14} more[/dim]")
+ self.console.print()
def thinking(self, text: str, max_length: int = 500) -> None:
"""Display Claude's thinking/response text."""
@@ -165,28 +223,98 @@ class ClaudeUI:
self.console.print(f" [dim]![/dim] [red]error:[/red] {message}")
self.console.print(f" [dim]{ERROR_CTA}[/dim]")
+ def _coerce_tool_input(self, tool_input: Any) -> dict:
+ if isinstance(tool_input, dict):
+ return tool_input
+ if isinstance(tool_input, str) and tool_input.strip():
+ s = tool_input.strip()
+ if s.startswith("{"):
+ try:
+ parsed = json.loads(s)
+ return parsed if isinstance(parsed, dict) else {}
+ except json.JSONDecodeError:
+ return {}
+ return {}
+
+ def _tool_icon_for(self, tool_name: str) -> str:
+ if tool_name in TOOL_ICONS and tool_name != "default":
+ return TOOL_ICONS[tool_name]
+ tl = tool_name.lower()
+ if tl.startswith("mcp"):
+ return TOOL_ICONS.get("mcp", "◇")
+ return TOOL_ICONS["default"]
+
+ def _tool_header_label(self, tool_name: str) -> str:
+ if not tool_name:
+ return "tool"
+ tl = tool_name.lower()
+ if tl.startswith("mcp_"):
+ rest = tool_name[4:].replace("__", " · ")
+ rest = rest.replace("_", " ")
+ if len(rest) > 56:
+ return rest[:53].strip() + "…"
+ return rest
+ if len(tool_name) > 48:
+ return tool_name[:45] + "…"
+ return tool_name
+
def _summarize_input(self, tool_name: str, tool_input: dict) -> str:
"""Create a brief summary of tool input."""
- if tool_name == "Read":
- path = tool_input.get("file_path", "")
+ tl = tool_name.lower()
+ if tl in ("todowrite", "todo_write", "write_todos", "update_todos"):
+ todos = tool_input.get("todos")
+ if isinstance(todos, list):
+ return f"[dim]{len(todos)} item(s)[/dim]"
+ return "[dim]todos[/dim]"
+ if tl == "call_mcp_tool":
+ mn = tool_input.get("name") or tool_input.get("server") or tool_input.get("tool")
+ if isinstance(mn, str) and mn:
+ return f"[dim]{mn[:70]}{'…' if len(mn) > 70 else ''}[/dim]"
+ return ""
+ if tl.startswith("mcp_") or tl.startswith("mcp"):
+ keys = ("url", "path", "file_path", "command", "query", "pattern", "browserTab", "tabId", "text")
+ for k in keys:
+ v = tool_input.get(k)
+ if isinstance(v, str) and v.strip():
+ vv = v.replace("\n", " ").strip()
+ cap = 72 if k in ("url", "path", "file_path") else 60
+ return f"[dim]{k}[/dim] [dim]{vv[:cap]}{'…' if len(vv) > cap else ''}[/dim]"
+ args = tool_input.get("arguments")
+ if isinstance(args, str) and args.strip().startswith("{"):
+ try:
+ args = json.loads(args)
+ except json.JSONDecodeError:
+ args = None
+ if isinstance(args, dict):
+ for k in keys:
+ v = args.get(k)
+ if isinstance(v, str) and v.strip():
+ vv = v.replace("\n", " ").strip()
+ return f"[dim]{k}[/dim] [dim]{vv[:70]}{'…' if len(vv) > 70 else ''}[/dim]"
+ blob = json.dumps(tool_input, default=str)
+ if len(blob) > 90:
+ return f"[dim]{blob[:87]}…[/dim]"
+ return f"[dim]{blob}[/dim]"
+ if tool_name == "Read" or tl == "read":
+ path = tool_input.get("file_path") or tool_input.get("path", "")
return f"[dim]{self._truncate_path(path)}[/dim]"
- elif tool_name == "Write":
- path = tool_input.get("file_path", "")
+ elif tool_name == "Write" or tl == "write":
+ path = tool_input.get("file_path") or tool_input.get("path", "")
return f"[dim]→ {self._truncate_path(path)}[/dim]"
- elif tool_name == "Edit":
- path = tool_input.get("file_path", "")
+ elif tool_name == "Edit" or tl == "edit":
+ path = tool_input.get("file_path") or tool_input.get("path", "")
return f"[dim]{self._truncate_path(path)}[/dim]"
- elif tool_name == "Bash":
- cmd = tool_input.get("command", "")
+ elif tool_name == "Bash" or tl in ("bash", "shell"):
+ cmd = str(tool_input.get("command", ""))
cmd = cmd.replace("\n", " ").strip()
return f"[dim]$ {cmd[:60]}{'...' if len(cmd) > 60 else ''}[/dim]"
- elif tool_name in ("Grep", "Glob"):
- pattern = tool_input.get("pattern", "")
+ elif tool_name in ("Grep", "Glob") or tl in ("grep", "glob"):
+ pattern = tool_input.get("pattern", tool_input.get("query", ""))
return f"[dim]'{pattern}'[/dim]"
- elif tool_name == "WebSearch":
+ elif tool_name == "WebSearch" or tl == "websearch":
query = tool_input.get("query", "")
return f"[dim]'{query[:50]}{'...' if len(query) > 50 else ''}'[/dim]"
- elif tool_name == "WebFetch":
+ elif tool_name == "WebFetch" or tl == "webfetch":
url = tool_input.get("url", "")
return f"[dim]{url[:60]}{'...' if len(url) > 60 else ''}[/dim]"
elif tool_name == "browser_navigate":
diff --git a/tests/test_config.py b/tests/test_config.py
index 26c01b8..47fa160 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -147,6 +147,8 @@ class TestDefaultConfig:
"collector_model",
"copilot_model",
"cursor_model",
+ "cursor_setting_sources",
+ "cursor_web_search",
"opencode_model",
"opencode_provider",
"output_dir",
@@ -163,3 +165,5 @@ class TestDefaultConfig:
assert DEFAULT_CONFIG["output_language"] == "python"
assert DEFAULT_CONFIG["real_time_sync"] is True
assert DEFAULT_CONFIG["cursor_model"] == "composer-2"
+ assert DEFAULT_CONFIG["cursor_web_search"] is True
+ assert DEFAULT_CONFIG["cursor_setting_sources"] is None
diff --git a/tests/test_messages.py b/tests/test_messages.py
index cf67d74..ea434da 100644
--- a/tests/test_messages.py
+++ b/tests/test_messages.py
@@ -119,6 +119,14 @@ class TestMessageStoreSaveHelpers:
assert data["type"] == "thinking"
assert "analyze" in data["content"]
+ def test_save_todos(self, tmp_path):
+ store, msg_path = self._make_store(tmp_path)
+ todos = [{"content": "a", "status": "pending"}]
+ store.save_todos(todos)
+ data = json.loads(msg_path.read_text().strip())
+ assert data["type"] == "todos"
+ assert data["content"] == todos
+
def test_save_error(self, tmp_path):
"""save_error writes error type."""
store, msg_path = self._make_store(tmp_path)
diff --git a/tests/test_opencode_ui.py b/tests/test_opencode_ui.py
index d601fec..f9a4a79 100644
--- a/tests/test_opencode_ui.py
+++ b/tests/test_opencode_ui.py
@@ -335,11 +335,10 @@ class TestOpenCodeUI:
assert "sync" in output
def test_sync_flash(self):
- """Sync flash displays."""
+ """Sync flash is intentionally silenced (too noisy during bulk sync)."""
ui, console = self._make_ui()
ui.sync_flash("Synced api_client.py")
- output = console.file.getvalue()
- assert "Synced" in output
+ assert console.file.getvalue() == ""
def test_sync_error(self):
"""Sync error displays."""
@@ -451,7 +450,7 @@ class TestOpenCodeUISummarizeInput:
"""TodoWrite shows count."""
ui = self._make_ui()
result = ui._summarize_input("todowrite", {"todos": [1, 2, 3]})
- assert "3 items" in result
+ assert "3 item(s)" in result
def test_unknown_tool(self):
"""Unknown tool returns empty string."""
diff --git a/tests/test_tui.py b/tests/test_tui.py
index 5c9c4bc..f115b82 100644
--- a/tests/test_tui.py
+++ b/tests/test_tui.py
@@ -259,8 +259,33 @@ class TestSummarizeInput:
result = ui._summarize_input("UnknownTool", {})
assert result == ""
+ def test_mcp_tool_url(self):
+ ui = self._make_ui()
+ r = ui._summarize_input("mcp_playwright_navigate", {"url": "https://x.com/y"})
+ assert "url" in r
+ assert "x.com" in r
+
+ def test_todo_write_summary(self):
+ ui = self._make_ui()
+ r = ui._summarize_input("TodoWrite", {"todos": [{"content": "a", "status": "pending"}]})
+ assert "1 item" in r
+
-class TestTruncatePath:
+class TestTodoUpdated:
+ def test_todo_updated_lists(self):
+ console = Console(file=StringIO(), no_color=True)
+ ui = ClaudeUI(verbose=True)
+ ui.console = console
+ ui.todo_updated(
+ [
+ {"content": "First", "status": "completed"},
+ {"content": "Second", "status": "in_progress"},
+ ]
+ )
+ out = console.file.getvalue()
+ assert "todos" in out
+ assert "First" in out
+ assert "Second" in out
"""Test _truncate_path method."""
def test_short_path(self):