refactor: merge slashcommand tool into skill tool
Per reviewer feedback (code-yeongyu), keep the 'skill' tool as the main tool and merge slashcommand functionality INTO it, rather than the reverse. Changes: - skill/tools.ts: Add command discovery (discoverCommandsSync) support; handle both SKILL.md skills and .omo/commands/ slash commands in a single tool; show combined listing in tool description - skill/types.ts: Add 'commands' option to SkillLoadOptions - skill/constants.ts: Update description to mention both skills and commands - plugin/tool-registry.ts: Replace createSlashcommandTool with createSkillTool; register tool as 'skill' instead of 'slashcommand' - tools/index.ts: Export createSkillTool instead of createSlashcommandTool - plugin/tool-execute-before.ts: Update tool name checks from 'slashcommand' to 'skill'; update arg name from 'command' to 'name' - agents/dynamic-agent-prompt-builder.ts: Categorize 'skill' tool as 'command' - tools/skill-mcp/tools.ts: Update hint message to reference 'skill' tool - hooks/auto-slash-command/executor.ts: Update error message The slashcommand/ module files are kept (they provide shared utilities used by the skill tool), but the slashcommand tool itself is no longer registered.
This commit is contained in:
@@ -43,13 +43,13 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
}
|
||||
}
|
||||
|
||||
if (hooks.ralphLoop && input.tool === "slashcommand") {
|
||||
const rawCommand = typeof output.args.command === "string" ? output.args.command : undefined
|
||||
const command = rawCommand?.replace(/^\//, "").toLowerCase()
|
||||
if (hooks.ralphLoop && input.tool === "skill") {
|
||||
const rawName = typeof output.args.name === "string" ? output.args.name : undefined
|
||||
const command = rawName?.replace(/^\//, "").toLowerCase()
|
||||
const sessionID = input.sessionID || getMainSessionID()
|
||||
|
||||
if (command === "ralph-loop" && sessionID) {
|
||||
const rawArgs = rawCommand?.replace(/^\/?(ralph-loop)\s*/i, "") || ""
|
||||
const rawArgs = rawName?.replace(/^\/?(ralph-loop)\s*/i, "") || ""
|
||||
const taskMatch = rawArgs.match(/^["'](.+?)["']/)
|
||||
const prompt =
|
||||
taskMatch?.[1] ||
|
||||
@@ -66,7 +66,7 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
} else if (command === "cancel-ralph" && sessionID) {
|
||||
hooks.ralphLoop.cancelLoop(sessionID)
|
||||
} else if (command === "ulw-loop" && sessionID) {
|
||||
const rawArgs = rawCommand?.replace(/^\/?(ulw-loop)\s*/i, "") || ""
|
||||
const rawArgs = rawName?.replace(/^\/?(ulw-loop)\s*/i, "") || ""
|
||||
const taskMatch = rawArgs.match(/^["'](.+?)["']/)
|
||||
const prompt =
|
||||
taskMatch?.[1] ||
|
||||
@@ -84,9 +84,9 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
}
|
||||
}
|
||||
|
||||
if (input.tool === "slashcommand") {
|
||||
const rawCommand = typeof output.args.command === "string" ? output.args.command : undefined
|
||||
const command = rawCommand?.replace(/^\//, "").toLowerCase()
|
||||
if (input.tool === "skill") {
|
||||
const rawName = typeof output.args.name === "string" ? output.args.name : undefined
|
||||
const command = rawName?.replace(/^\//, "").toLowerCase()
|
||||
const sessionID = input.sessionID || getMainSessionID()
|
||||
|
||||
if (command === "stop-continuation" && sessionID) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
createCallOmoAgent,
|
||||
createLookAt,
|
||||
createSkillMcpTool,
|
||||
createSlashcommandTool,
|
||||
createSkillTool,
|
||||
createGrepTools,
|
||||
createGlobTools,
|
||||
createAstGrepTools,
|
||||
@@ -95,7 +95,7 @@ export function createToolRegistry(args: {
|
||||
})
|
||||
|
||||
const commands = discoverCommandsSync(ctx.directory)
|
||||
const slashcommandTool = createSlashcommandTool({
|
||||
const skillTool = createSkillTool({
|
||||
commands,
|
||||
skills: skillContext.mergedSkills,
|
||||
mcpManager: managers.skillMcpManager,
|
||||
@@ -129,7 +129,7 @@ export function createToolRegistry(args: {
|
||||
...(lookAt ? { look_at: lookAt } : {}),
|
||||
task: delegateTask,
|
||||
skill_mcp: skillMcpTool,
|
||||
slashcommand: slashcommandTool,
|
||||
skill: skillTool,
|
||||
interactive_bash,
|
||||
...taskToolsRecord,
|
||||
...hashlineToolsRecord,
|
||||
|
||||
Reference in New Issue
Block a user