( conversation: Conversation, message: string )
| 68 | } |
| 69 | |
| 70 | export async function handleCommand( |
| 71 | conversation: Conversation, |
| 72 | message: string |
| 73 | ): Promise<CommandResult> { |
| 74 | const { command, args } = parseCommand(message); |
| 75 | |
| 76 | switch (command) { |
| 77 | case 'help': |
| 78 | return { |
| 79 | success: true, |
| 80 | message: `Available Commands: |
| 81 | |
| 82 | Command Management: |
| 83 | /command-set <name> <path> [text] - Register command |
| 84 | /load-commands <folder> - Bulk load (recursive) |
| 85 | /command-invoke <name> [args] - Execute |
| 86 | /commands - List registered |
| 87 | Note: Commands use relative paths (e.g., .claude/commands) |
| 88 | |
| 89 | Codebase: |
| 90 | /clone <repo-url> - Clone repository |
| 91 | /repos - List workspace repositories |
| 92 | /getcwd - Show working directory |
| 93 | /setcwd <path> - Set directory |
| 94 | Note: Codebases use full paths (e.g., /workspace/repo-name) |
| 95 | |
| 96 | Session: |
| 97 | /status - Show state |
| 98 | /reset - Clear session |
| 99 | /help - Show help`, |
| 100 | }; |
| 101 | |
| 102 | case 'status': { |
| 103 | let msg = `Platform: ${conversation.platform_type}\nAI Assistant: ${conversation.ai_assistant_type}`; |
| 104 | |
| 105 | if (conversation.codebase_id) { |
| 106 | const cb = await codebaseDb.getCodebase(conversation.codebase_id); |
| 107 | if (cb?.name) { |
| 108 | msg += `\n\nCodebase: ${cb.name}`; |
| 109 | if (cb.repository_url) { |
| 110 | msg += `\nRepository: ${cb.repository_url}`; |
| 111 | } |
| 112 | } |
| 113 | } else { |
| 114 | msg += '\n\nNo codebase configured. Use /clone <repo-url> to get started.'; |
| 115 | } |
| 116 | |
| 117 | msg += `\n\nCurrent Working Directory: ${conversation.cwd || 'Not set'}`; |
| 118 | |
| 119 | const session = await sessionDb.getActiveSession(conversation.id); |
| 120 | if (session?.id) { |
| 121 | msg += `\nActive Session: ${session.id.substring(0, 8)}...`; |
| 122 | } |
| 123 | |
| 124 | return { success: true, message: msg }; |
| 125 | } |
| 126 | |
| 127 | case 'getcwd': |
nothing calls this directly
no test coverage detected