HandleContextCommand processa comandos /context
(ctx context.Context, sessionID, input string)
| 40 | |
| 41 | // HandleContextCommand processa comandos /context |
| 42 | func (h *ContextHandler) HandleContextCommand(ctx context.Context, sessionID, input string) error { |
| 43 | parts := strings.Fields(input) |
| 44 | if len(parts) < 2 { |
| 45 | h.showContextHelp() |
| 46 | return nil |
| 47 | } |
| 48 | |
| 49 | subcommand := strings.ToLower(parts[1]) |
| 50 | |
| 51 | switch subcommand { |
| 52 | case "create", "new": |
| 53 | return h.handleCreate(ctx, parts[2:]) |
| 54 | |
| 55 | case "update", "edit": |
| 56 | return h.handleUpdate(ctx, parts[2:]) |
| 57 | |
| 58 | case "attach", "add": |
| 59 | return h.handleAttach(sessionID, parts[2:]) |
| 60 | |
| 61 | case "detach", "remove": |
| 62 | return h.handleDetach(sessionID, parts[2:]) |
| 63 | |
| 64 | case "delete", "del", "rm": |
| 65 | return h.handleDelete(parts[2:]) |
| 66 | |
| 67 | case "list", "ls": |
| 68 | return h.handleList(parts[2:]) |
| 69 | |
| 70 | case "show", "info", "view": |
| 71 | return h.handleShow(parts[2:]) |
| 72 | |
| 73 | case "inspect": |
| 74 | return h.handleInspect(parts[2:]) |
| 75 | |
| 76 | case "merge", "join": |
| 77 | return h.handleMerge(parts[2:]) |
| 78 | |
| 79 | case "attached": |
| 80 | return h.handleShowAttached(sessionID) |
| 81 | |
| 82 | case "export": |
| 83 | return h.handleExport(parts[2:]) |
| 84 | |
| 85 | case "import": |
| 86 | return h.handleImport(parts[2:]) |
| 87 | |
| 88 | case "metrics", "stats": |
| 89 | return h.handleMetrics() |
| 90 | |
| 91 | case "help", "?": |
| 92 | h.showContextHelp() |
| 93 | return nil |
| 94 | |
| 95 | default: |
| 96 | return fmt.Errorf("%s", i18n.T("context.error.unknown_subcommand", subcommand)) |
| 97 | } |
| 98 | } |
| 99 |
no test coverage detected