Repository navigation
Implement slash command system #11773
Copy link
Copy link
Closed as not planned
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Description
Parent Epic
Part of #11762 (Ink-based TUI Rewrite)
Objective
Port the existing slash command system to the Ink architecture.
Current Commands (from commands.ts)
| Command | Description |
|---|---|
/help |
Show help |
/clear |
Clear screen |
/agent [name] |
Switch agent |
/model [name] |
Switch model |
/session [id] |
Switch session |
/sessions |
List sessions |
/new |
New session |
/compact |
Toggle compact mode |
/start |
Initialize context |
/bug |
Report bug |
/cost |
Show token costs |
/config |
Edit config |
/quit |
Exit |
Architecture
// Command registry
interface Command {
name: string
description: string
handler: (args: string[], context: CommandContext) => Promise<void>
}
interface CommandContext {
dispatch: Dispatch<Action>
session: SessionState
setUIMode: (mode: UIMode) => void
}
const commands: Command[] = [
{
name: 'help',
description: 'Show available commands',
handler: async (args, ctx) => {
ctx.dispatch({ type: 'SHOW_HELP' })
}
},
{
name: 'agent',
description: 'Switch agent',
handler: async (args, ctx) => {
if (args[0]) {
await switchAgent(args[0])
} else {
ctx.setUIMode('select')
ctx.dispatch({ type: 'SHOW_AGENT_SELECT' })
}
}
},
// ...
]
// Command execution
function executeCommand(input: string, context: CommandContext) {
const [cmd, ...args] = input.slice(1).split(' ')
const command = commands.find(c => c.name === cmd)
if (command) {
return command.handler(args, context)
}
throw new Error(`Unknown command: ${cmd}`)
}Tasks
- Create
src/cli/ink/commands/registry.ts- command definitions - Create
src/cli/ink/commands/handlers/- individual command handlers - Implement help command
- Implement agent/model switching with SelectMenu
- Implement session management commands
- Implement utility commands (clear, compact, cost)
- Implement /start command for context initialization
- Wire up command execution in InputLine
Acceptance Criteria
- All existing commands work
-
/helpshows all commands -
/agentand/modelshow selection menus -
/sessionslists and allows selection - Unknown commands show error
Estimated Effort
1 day
Risk
Low - porting existing logic
Dependencies
- Implement core App component and state management #11764 (App component)
- Implement TextInput component with useInput hook #11769 (TextInput)
- Implement SelectMenu component #11770 (SelectMenu)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
opentuiThis relates to changes in v1.0, now that opencode uses opentuiThis relates to changes in v1.0, now that opencode uses opentui
Activity
github-actions commentedon Feb 2, 2026
For keybind-related issues and command documentation, please also check our pinned keybinds documentation: #4997
randomm commentedon Feb 3, 2026
Reopening - Phase 1 & 2 components merged successfully. Proceeding with slash commands.