feat: Add dynamic slash commands from Claude with UI improvements

- Load available commands from Claude at session start (control_initialized event)
- Display commands in autocomplete dropdown with search in name and description
- Group commands into "UI Commands" and "Claude Commands" sections
- Shorten display names by removing common prefixes (taches-cc-resources:, claude-mem:)
- Blacklist TUI-only commands (vim, terminal-setup, ide, etc.)
- Add max-height with scrollbar for long command lists
- Implement auto-scroll to keep selected command visible during keyboard navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-19 06:58:05 +01:00
parent f133ad0576
commit 6df37b8a08
9 changed files with 248 additions and 585 deletions

View File

@@ -38,6 +38,7 @@ function createSessionState(id, host = 'neko', project = '/home/sumdex/projects'
},
permissionMode: 'default',
controlInitialized: false,
availableCommands: [], // Slash commands from Claude
pendingPermission: null,
unreadCount: 0,
currentContext: null, // For dynamic tab naming
@@ -156,11 +157,12 @@ export function SessionProvider({ children }) {
const updateSession = useCallback((sessionId, updates) => {
setSessions(prev => {
if (!prev[sessionId]) return prev;
const newUpdates = typeof updates === 'function' ? updates(prev[sessionId]) : updates;
return {
...prev,
[sessionId]: {
...prev[sessionId],
...(typeof updates === 'function' ? updates(prev[sessionId]) : updates),
...newUpdates,
},
};
});
@@ -444,6 +446,7 @@ export function SessionProvider({ children }) {
case 'control_initialized': {
updateSession(sessionId, {
controlInitialized: true,
availableCommands: data.commands || [],
});
// Restore saved permission mode after control is initialized
// Read from localStorage since sessions state may be stale in this callback