executeRemoteCommand parses and executes a server-side command, returning the result string.
(rawCommand string)
| 299 | |
| 300 | // executeRemoteCommand parses and executes a server-side command, returning the result string. |
| 301 | func (h *Handler) executeRemoteCommand(rawCommand string) string { |
| 302 | cmd := strings.TrimSpace(rawCommand) |
| 303 | if cmd == "" { |
| 304 | return i18n.T("server.session.cmd_empty") |
| 305 | } |
| 306 | |
| 307 | // Normalize: remove leading '/' if present |
| 308 | cmd = strings.TrimPrefix(cmd, "/") |
| 309 | |
| 310 | switch { |
| 311 | case cmd == "status": |
| 312 | return h.cmdStatus() |
| 313 | case cmd == "watcher status": |
| 314 | return h.cmdWatcherStatus() |
| 315 | case cmd == "plugins list": |
| 316 | return h.cmdPluginsList() |
| 317 | case cmd == "agents list": |
| 318 | return h.cmdAgentsList() |
| 319 | case cmd == "skills list": |
| 320 | return h.cmdSkillsList() |
| 321 | default: |
| 322 | return i18n.T("server.session.cmd_unknown", rawCommand) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | func (h *Handler) cmdStatus() string { |
| 327 | vi := version.GetCurrentVersion() |
no test coverage detected