Skip to content

Conversation

@chasdr
Copy link

@chasdr chasdr commented Jan 14, 2026

Summary

Adds a plugin discovery and execution system to the DR CLI, allowing external executables (e.g., dr-agentassist) to be discovered and invoked as subcommands.

Related PR

Changes

New Files

File Description
internal/plugin/types.go PluginManifest, PluginCommand, DiscoveredPlugin structs
internal/plugin/discover.go PATH scanning, manifest fetching with 2s timeout
internal/plugin/exec.go Subprocess execution with signal forwarding
PLUGIN_POC.md Installation and usage documentation

Modified Files

File Description
cmd/root.go Plugin registration and collision detection

How It Works

  1. Discovery: On startup, scans .datarobot/cli/bin/ and PATH for dr-* executables
  2. Manifest: Calls each plugin with --dr-plugin-manifest to get JSON metadata
  3. Registration: Adds plugins as subcommands under "Plugin Commands" group
  4. Execution: Forwards stdin/stdout/stderr and signals to plugin subprocess

Local Testing Instructions

Step 1: Build the CLI

# Clone and checkout this branch
git clone https://github.com/chasdr/cli.git
cd cli
git checkout chas/plugin-poc

# Build
task build

# Verify build
./dist/dr --version

Step 2: Install the Agent-Assist Plugin

# Clone the agent-assist repo
git clone https://github.com/datarobot/dr-agent-cli.git
cd dr-agent-cli
git checkout chas/plugin-poc

# Install as a tool (adds dr-agentassist to PATH)
cd mdb
uv tool install --force --editable .

# Verify installation
which dr-agentassist
dr-agentassist --dr-plugin-manifest

Step 3: Test Plugin Discovery

# From the cli directory
cd /path/to/cli

# Check help shows plugin
./dist/dr --help
# Should show:
# Plugin Commands:
#   agentassist   AI agent design, coding, and deployment assistant

# Run the plugin via CLI
./dist/dr agentassist --help

Step 4: Verify Signal Handling

# Start the plugin
./dist/dr agentassist

# Press Ctrl+C - should propagate to plugin and exit cleanly

Plugin Manifest Format

Plugins must respond to --dr-plugin-manifest with JSON:

{
  "name": "agentassist",
  "version": "0.1.0",
  "description": "AI agent design, coding, and deployment assistant",
  "commands": [{
    "name": "agentassist",
    "description": "Interactive agent development assistant"
  }]
}

- types.go: PluginManifest, PluginCommand, DiscoveredPlugin, PluginRegistry structs
- discover.go: PATH scanning, dr-* pattern matching, manifest fetching with timeout
- exec.go: subprocess execution with signal forwarding and exit code propagation
- Register discovered plugins as subcommands under 'Plugin Commands' group
- Collision detection: skip plugins that conflict with builtin commands
- DisableFlagParsing: pass all args through to plugin subprocess
@chasdr chasdr changed the title feat: Add plugin discovery and execution system POC: Add plugin discovery and execution system Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant