Skip to content

Enhanced Multi-Protocol Diagnostic CLI #4

@amiable-dev

Description

@amiable-dev

Enhanced Multi-Protocol Diagnostic CLI

Overview

Extend the existing midi_diagnostic CLI tool to support all input protocols (MIDI, Gamepad, OSC future). Provides unified debugging interface with colored output, protocol-specific visualization, and export capabilities.

Motivation

Approach

Enhance existing tool rather than build new GUI:

  • Rename midi_diagnostic.rsconductor_diagnostic.rs
  • Add --protocol flag for selection
  • Keep terminal-based for simplicity
  • Add gamepad visualization (ASCII art)

Features

1. Protocol Selection

# Monitor all protocols
conductor-diagnostic --protocol all

# MIDI only (current behavior)
conductor-diagnostic --protocol midi

# Gamepad only
conductor-diagnostic --protocol gamepad

# Future: OSC
conductor-diagnostic --protocol osc

2. Enhanced Display

Current (MIDI only):

Note On:  note=60 velocity=100
Note Off: note=60 velocity=0
CC:       controller=7 value=64

New (Multi-protocol):

[MIDI] Note On:  note=60 velocity=100 (medium)
[GAMEPAD] Button: 128 (South/A) pressed
[GAMEPAD] Axis:   130 (RightStickX) value=200 (78%)

3. Gamepad Visualization

ASCII art representation of controller state:

┌─────────────────────────────────┐
│  Xbox Controller                │
├─────────────────────────────────┤
│                                 │
│   [LB]           [RB]          │
│    ●              ●            │
│                                 │
│  [◄]              [Y]          │
│   ●                ●            │
│  [▼]  [►]      [X]   [B]       │
│   ●    ●        ●     ●         │
│                                 │
│   Left Stick    Right Stick     │
│      ↑               →          │
│   (255,128)      (200,128)      │
│                                 │
└─────────────────────────────────┘

Recent Events:
[0.000s] Button 128 (South) pressed
[0.100s] Axis 130 (RightX) → 200
[0.150s] Button 128 (South) released

4. Export to Generator Format

# Record events for replay
conductor-diagnostic --protocol gamepad --record > test_sequence.json

# Compatible with conductor-generator (#3)
conductor-generator --replay test_sequence.json

5. Side-by-Side Monitoring

# Monitor MIDI + Gamepad simultaneously
conductor-diagnostic --protocol all

Output:
┌─────────────────┬─────────────────┐
│ MIDI Events     │ Gamepad Events  │
├─────────────────┼─────────────────┤
│ Note 60 On      │ Button 128 ▼   │
│ Velocity: 100   │ Axis 130: 200   │
│                 │                 │
└─────────────────┴─────────────────┘

Implementation

File Changes

Rename: conductor-daemon/src/bin/midi_diagnostic.rsconductor_diagnostic.rs

Add:

enum Protocol {
    Midi,
    Gamepad,
    All,
}

struct DiagnosticDisplay {
    protocol: Protocol,
    show_visualization: bool,
    record_mode: bool,
}

// Gamepad visualization
fn render_controller_state(buttons: &[bool], axes: &[u8]) -> String {
    // ASCII art generation
}

Display Enhancement

  • Colored output: MIDI (blue), Gamepad (yellow), OSC (green)
  • Timestamps: Relative milliseconds since start
  • Value interpretation: "velocity 100 (medium)", "axis 200 (78%)"
  • Clear screen: Optional --clear flag for live updates

Integration with MCP (#2)

Export diagnostic logs as MCP resource:

conductor://diagnostics/latest
conductor://diagnostics/{session_id}

AI can analyze logs for issues:

User: "Why isn't my gamepad responding?"
AI: [Reads conductor://diagnostics/latest]
    "No gamepad events detected. Your controller may not be connected."

Timeline

Total: 2-3 hours

  • Phase 1: Rename + protocol flag (30 min)
  • Phase 2: Gamepad event display (1 hour)
  • Phase 3: ASCII controller viz (1 hour)
  • Phase 4: Export + testing (30 min)

Dependencies

# No new dependencies needed
colored = { workspace = true }  # Already in use
clap = { workspace = true }     # Already in use

Implementation Checklist

  • Rename midi_diagnostic.rsconductor_diagnostic.rs
  • Add --protocol CLI flag
  • Implement gamepad event display
  • Create ASCII controller visualization
  • Add colored output (protocol-specific)
  • Implement --record mode (JSON export)
  • Add --clear flag for live updates
  • Test with MIDI device
  • Test with virtual gamepad (from AI-Powered Multi-Protocol Message Generator #3)
  • Update documentation

Blockers

None - can implement immediately

Blocked Issues

Future Enhancements (v3.2+)

  • OSC protocol support
  • Web-based UI (optional)
  • Statistics (events/sec, min/max/avg values)
  • Filtering (show only specific events)
  • Diff mode (compare two recordings)

Labels

enhancement, diagnostics, cli, v3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions