fix(skill/command): add user_message param to skill tool, fix command priority order

- BUG-20: Add optional user_message parameter to skill tool for command arguments
- BUG-19: Reorder command discovery: user > project > opencode-project > opencode-global > builtin
- Update AGENTS.md to reflect slashcommand removal and skill tool changes
This commit is contained in:
YeonGyu-Kim
2026-02-21 02:16:11 +09:00
parent 7fa22aebdf
commit 945c7e658a
4 changed files with 12 additions and 8 deletions

View File

@@ -67,13 +67,12 @@
| `session_search` | `createSessionManagerTools` | query, session_id, case_sensitive, limit |
| `session_info` | `createSessionManagerTools` | session_id |
### Skill/Command (3)
### Skill/Command (2)
| Tool | Factory | Parameters |
|------|---------|------------|
| `skill` | `createSkillTool` | name |
| `skill` | `createSkillTool` | name, user_message |
| `skill_mcp` | `createSkillMcpTool` | mcp_name, tool_name/resource_name/prompt_name, arguments, grep |
| `slashcommand` | `createSlashcommandTool` | command, user_message |
### System (2)

View File

@@ -224,6 +224,10 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
},
args: {
name: tool.schema.string().describe("The skill or command name (e.g., 'code-review' or 'publish'). Use without leading slash for commands."),
user_message: tool.schema
.string()
.optional()
.describe("Optional arguments or context for command invocation. Example: name='publish', user_message='patch'"),
},
async execute(args: SkillArgs, ctx?: { agent?: string }) {
const skills = await getSkills()
@@ -273,7 +277,7 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
const matchedCommand = commands.find(c => c.name.toLowerCase() === requestedName.toLowerCase())
if (matchedCommand) {
return await formatLoadedCommand(matchedCommand)
return await formatLoadedCommand(matchedCommand, args.user_message)
}
// No match found — provide helpful error with partial matches

View File

@@ -5,6 +5,7 @@ import type { CommandInfo } from "../slashcommand/types"
export interface SkillArgs {
name: string
user_message?: string
}
export interface SkillInfo {

View File

@@ -76,10 +76,10 @@ export function discoverCommandsSync(directory?: string): CommandInfo[] {
}))
return [
...builtinCommands,
...opencodeProjectCommands,
...projectCommands,
...opencodeGlobalCommands,
...userCommands,
...projectCommands,
...opencodeProjectCommands,
...opencodeGlobalCommands,
...builtinCommands,
]
}