Skip to content

Feature: Update kdm cache command to be interactive #141

@utkarsh232005

Description

@utkarsh232005

🎯 Goal

Convert the kdm cache command from static list/get/purge CLI operations into an interactive cache browser where users can browse, preview, and manage cached AI explanations.


📌 Current Behavior

kdm cache manages locally cached AI explanations to save tokens and avoid duplicate network requests.

Subcommands:

Subcommand Description
kdm cache list List all cached explanation keys
kdm cache get <key> Retrieve and print a cached explanation
kdm cache remove <key> Delete a specific cache entry
kdm cache purge Delete all cached explanations

Example usage:

kdm cache list
kdm cache purge

🚀 Proposed Interactive Dashboard

Layout

  Cache Browser                              3 entries
  ──────────────────────────────────────────────────────

  > Run-001    openai/gpt-4o       2 hours ago
    Run-002    ollama/llama3.1     1 day ago
    Run-003    openai/gpt-4o       3 days ago

  ──────────────────────────────────────────────────────
  ENTER:View  DELETE:Remove  P:Purge All  Q:Quit

Preview Pane (press Enter)

  ┌─ Run-001 ─────────────────────────────────────────┐
  │                                                   │
  │  Cause:                                           │
  │  Container exceeded memory limit of 256Mi.        │
  │                                                   │
  │  Fix:                                             │
  │  kubectl edit deployment app                      │
  │  Increase memory: 256Mi -> 512Mi                  │
  │                                                   │
  │  [ESC] Close                                      │
  └───────────────────────────────────────────────────┘

Purge Confirmation (press P)

  ┌─────────────────────────────────┐
  │  Delete all cached entries?     │
  │                                 │
  │  [Y] Yes        [N] No         │
  └─────────────────────────────────┘

User Flow

  1. User runs kdm cache → list of cached entries loads.
  2. Use / to select a cache entry.
  3. Press Enter to preview the cached explanation in an overlay.
  4. Press Delete or d to remove the selected entry.
  5. Press p to purge all — confirmation dialog appears.

Keyboard Shortcuts

Key Action
/ Navigate cache entries
Enter Preview cached explanation
Delete / d Remove selected entry
p Purge all (with confirmation)
Esc Close overlay
Q Quit

Recommended Libraries

Component Library
List ink-select-input
Confirmation Custom confirm modal component
Colors chalk

📋 Contribution Workflow

  1. Fork the repo and create a feature branch (e.g., feature/interactive-kdm-cache).
  2. Implement the interactive TUI for kdm cache using the layout and flow described above.
  3. Submit a PR explicitly linked to this issue (e.g., Closes #141).
  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