Skip to content

Feature: Update kdm custom-analyzer command to be interactive #143

@utkarsh232005

Description

@utkarsh232005

🎯 Goal

Convert the kdm custom-analyzer command from static add/list/remove CLI operations into an interactive rule manager with a table view and a guided creation wizard.


📌 Current Behavior

kdm custom-analyzer registers custom shell commands or HTTP webhooks to analyze arbitrary custom resources (CRDs).

Subcommands:

Subcommand Description
kdm custom-analyzer add <name> Register a new analyzer (--command or --url)
kdm custom-analyzer list List all registered custom analyzers
kdm custom-analyzer remove <name> Delete a registered custom analyzer

Example usage:

kdm custom-analyzer add keda --command "kubectl get scaledobjects -A -o json"
kdm custom-analyzer list
kdm custom-analyzer remove keda

🚀 Proposed Interactive Dashboard

Layout

  Custom Analyzers                           2 rules
  ──────────────────────────────────────────────────────

  Name            Type        Command / URL
  ─────────────────────────────────────────────────────
  > MemoryCheck   Command     kubectl get pods -o json
    SlackAlert    Webhook     https://hooks.slack.com/...

  ──────────────────────────────────────────────────────
  [A] Add Rule  [DELETE] Remove  [Q] Quit

Add Rule Wizard (press A)

  ┌─ Add Custom Analyzer ────────────────────┐
  │                                          │
  │  Step 1/3 — Rule Name:  keda-check       │
  │                                          │
  │  Step 2/3 — Type:                        │
  │    > Command                             │
  │      Webhook                             │
  │                                          │
  │  Step 3/3 — Command:                     │
  │    kubectl get scaledobjects -A -o json  │
  │                                          │
  │  [ENTER] Next   [ESC] Cancel             │
  └──────────────────────────────────────────┘

User Flow

  1. User runs kdm custom-analyzer → rule table loads.
  2. Use / to navigate rules.
  3. Press a to open the Add Rule Wizard:
    • Step 1: Enter rule name.
    • Step 2: Select type (Command or Webhook).
    • Step 3: Enter the command string or webhook URL. Input is validated before saving.
  4. Press Delete or d to remove the selected rule.

Keyboard Shortcuts

Key Action
/ Navigate rules
a Add new rule (wizard)
Delete / d Remove selected rule
Enter Next step in wizard
Esc Cancel wizard
Q Quit

Recommended Libraries

Component Library
Text input ink-text-input
Type selector ink-select-input
Table layout Ink <Box> with <Text> columns

📋 Contribution Workflow

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