Skip to content

Feature: Update kdm serve command to be interactive #144

@utkarsh232005

Description

@utkarsh232005

🎯 Goal

Convert the kdm serve command from a headless daemon start into an interactive server control dashboard with live request logging, server controls, and resource metrics.


📌 Current Behavior

kdm serve starts the KDM server daemon in either REST API mode or JSON-RPC Model Context Protocol (MCP) mode.

Options:

Flag Description
-p, --port <port> HTTP server port (default: 8080)
--metrics-port <port> Metrics server port
-b, --backend <backend> Default active AI backend
-f, --filter <filter> Default analyzer filter
--http Force HTTP mode (default)
--mcp Start in MCP mode (JSON-RPC stdio)

Example usage:

kdm serve --port 8080
kdm serve --mcp

🚀 Proposed Interactive Dashboard

Layout

  KDM Server Dashboard                     ● RUNNING
  ──────────────────────────────────────────────────────

  Host:  localhost          CPU:   20%
  Port:  8080               RAM:   150MB
  Mode:  HTTP               Uptime: 2h 15m

  ──────────────────────────────────────────────────────
  Request Log
  ──────────────────────────────────────────────────────

  12:01:02  GET   /health         200   12ms
  12:01:05  POST  /analyze        200   1.2s
  12:02:10  POST  /rpc            200   340ms
  12:03:01  GET   /health         200   8ms

  ──────────────────────────────────────────────────────
  [S] Stop/Start  [R] Restart  [P] Change Port  [C] Clear Log  [Q] Quit

User Flow

  1. User runs kdm serve → server starts, dashboard appears with live metrics.
  2. Incoming HTTP requests scroll in the request log panel in real time.
  3. Press s to stop/start the server (status toggles between ● RUNNING and ● STOPPED).
  4. Press r to restart the server.
  5. Press p to open an inline input to change the port:
  Enter new port: 9000
  1. Press c to clear the request log.
  2. Press Q to quit and stop the server.

Keyboard Shortcuts

Key Action
s Toggle server start/stop
r Restart server
p Change port (inline input)
c Clear request log
Q Quit

Recommended Libraries

Component Library
Gradient header ink-gradient
Spinner ink-spinner
Colors chalk
Port input ink-text-input

📋 Contribution Workflow

  1. Fork the repo and create a feature branch (e.g., feature/interactive-kdm-serve).
  2. Implement the interactive TUI for kdm serve using the layout and flow described above.
  3. Submit a PR explicitly linked to this issue (e.g., Closes #144).
  4. 📸 Include a screenshot or recording of the implemented UI in your PR to verify the new dashboard experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions