MCPcopy Create free account
hub / github.com/diillson/chatcli / HandleContextCommand

Method HandleContextCommand

cli/context_handler.go:42–98  ·  view source on GitHub ↗

HandleContextCommand processa comandos /context

(ctx context.Context, sessionID, input string)

Source from the content-addressed store, hash-verified

40
41// HandleContextCommand processa comandos /context
42func (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

Callers 1

handleContextCommandMethod · 0.80

Calls 15

showContextHelpMethod · 0.95
handleCreateMethod · 0.95
handleUpdateMethod · 0.95
handleAttachMethod · 0.95
handleDetachMethod · 0.95
handleDeleteMethod · 0.95
handleListMethod · 0.95
handleShowMethod · 0.95
handleInspectMethod · 0.95
handleMergeMethod · 0.95
handleShowAttachedMethod · 0.95
handleExportMethod · 0.95

Tested by

no test coverage detected