irongit

My nvim configuration

fix(claude): commands show in chat

huncholanehuncholaneauthored
parent 8a682bdcommit 238fafc78b09b8c7c80dd8b715a90be101eee780Browse files

2 files changed, +28 -3

+20-1claude-nvim/lua/claude/runner.lua
@@ -134,7 +134,26 @@ local function handle_event(sid, evt)
134134 if path and FILE_TOOLS[block.name] then
135135 ensure_before(sid, path)
136136 end
137- ui.append_tool_use(sid, block.name or "tool", path or "")
137+ local summary
138+ local name = block.name or "tool"
139+ if name == "Bash" then
140+ summary = input.command or ""
141+ elseif name == "Grep" or name == "Glob" then
142+ summary = input.pattern or ""
143+ elseif name == "Task" then
144+ summary = input.description or ""
145+ elseif name == "WebFetch" or name == "WebSearch" then
146+ summary = input.url or input.query or ""
147+ elseif name == "TodoWrite" then
148+ summary = "(todos)"
149+ elseif name == "Edit" or name == "MultiEdit" then
150+ summary = path or input.file_path or ""
151+ else
152+ summary = path or input.file_path or input.command or input.pattern or input.query or ""
153+ end
154+ summary = (summary or ""):gsub("\n", " ")
155+ if #summary > 200 then summary = summary:sub(1, 200) .. "…" end
156+ ui.append_tool_use(sid, name, summary)
138157 end
139158 end
140159 end
+8-2claude-nvim/lua/claude/ui.lua
@@ -512,10 +512,16 @@ function M.append_assistant_text(sid, text)
512512 end)
513513 end
514514
515-function M.append_tool_use(sid, name, path)
515+function M.append_tool_use(sid, name, summary)
516516 if sid ~= panel.sid then return end
517517 vim.schedule(function()
518- append_lines({ "", "> **" .. name .. "** `" .. path .. "`", "" })
518+ local line
519+ if summary and summary ~= "" then
520+ line = "> **" .. name .. "** `" .. summary .. "`"
521+ else
522+ line = "> **" .. name .. "**"
523+ end
524+ append_lines({ "", line, "" })
519525 spinner_render()
520526 end)
521527 end