Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/opencode/ui/formatter/tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ return {
webfetch = require('opencode.ui.formatter.tools.webfetch'),
list = require('opencode.ui.formatter.tools.list'),
question = require('opencode.ui.formatter.tools.question'),
skill = require('opencode.ui.formatter.tools.skill'),
task = require('opencode.ui.formatter.tools.task'),
tool = require('opencode.ui.formatter.tools.tool'),
}
20 changes: 20 additions & 0 deletions lua/opencode/ui/formatter/tools/skill.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local icons = require('opencode.ui.icons')
local utils = require('opencode.ui.formatter.utils')

local M = {}

---@param output Output
---@param part OpencodeMessagePart
function M.format(output, part)
local input = part.state and part.state.input or {}
utils.format_action(output, icons.get('skill'), 'skill', input.name or '', utils.get_duration_text(part))
end

---@param _ OpencodeMessagePart
---@param input table
---@return string, string, string
function M.summary(_, input)
return icons.get('skill'), 'skill', input.name or ''
end

return M
2 changes: 2 additions & 0 deletions lua/opencode/ui/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local presets = {
web = '󰖟 ',
list = ' ',
tool = ' ',
skill = '󰐱 ',
snapshot = '󰻛 ',
restore_point = '󱗚 ',
file = ' ',
Expand Down Expand Up @@ -64,6 +65,7 @@ local presets = {
web = '::',
list = '::',
tool = '::',
skill = '::',
snapshot = '::',
restore_point = '::',
file = '@',
Expand Down
34 changes: 34 additions & 0 deletions tests/unit/formatter_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,40 @@ describe('formatter', function()
assert.is_true(found)
end)

it('renders loaded skill name for skill tool calls', function()
local message = {
info = {
id = 'msg_1',
role = 'assistant',
sessionID = 'ses_1',
},
parts = {},
}

local part = {
id = 'prt_1',
type = 'tool',
tool = 'skill',
messageID = 'msg_1',
sessionID = 'ses_1',
state = {
status = 'completed',
input = {
name = 'context7-cli',
},
time = {
start = 1,
['end'] = 2,
},
},
}

local output = formatter.format_part(part, message, true)

assert.is_truthy(output.lines[1]:find('skill', 1, true))
assert.is_truthy(output.lines[1]:find('context7%-cli'))
end)

it('renders directory reads with trailing slash', function()
local message = {
info = {
Expand Down
Loading