Skip to content

Conversation

@edmundmiller
Copy link
Member

Summary

This PR implements a comprehensive system for Nextflow plugins to register first-class CLI commands that appear directly in the main Nextflow CLI, eliminating the need for verbose nextflow plugin <plugin>:<command> syntax.

🎯 Problem Solved

Before: nextflow plugin nf-wave:command -- --help
After: nextflow wave --help

Users can now execute plugin commands as if they were built-in Nextflow commands.

🔧 Implementation

Core Components

  • CommandExtensionPoint Interface: Allows plugins to register CLI commands
  • PluginCommandDiscovery: Automatically discovers and registers plugin commands
  • CLI Integration: Plugin commands appear in main help output with descriptions
  • Priority System: Handles conflicts when multiple plugins provide same command name

Architecture Changes

Main Nextflow CLI
├── Built-in Commands (run, clean, etc.)
└── Plugin Commands (discovered dynamically)
    └── wave (from nf-wave-cli plugin)

📋 Changes

New Files

  • CommandExtensionPoint.groovy - Core interface for plugin command registration
  • PluginCommandBase.groovy - Abstract base class extending CmdBase
  • PluginCommandDiscovery.groovy - Command discovery and registration system

Modified Files

  • Launcher.groovy - Integrated plugin commands into main CLI
  • ✅ Extension point cleanup - Moved interfaces to gradle plugin
  • ✅ Wave plugin refactor - Removed CLI to avoid conflicts
  • ✅ Build configuration - Updated for new architecture

Removed Files

  • ✅ Wave CLI classes - Moved to separate nf-wave-cli plugin
  • ✅ Duplicate extension points - Now in gradle plugin

🧪 Testing

  • ✅ All existing functionality preserved
  • ✅ Plugin commands appear in help output
  • ✅ Commands execute with full functionality
  • ✅ Priority-based conflict resolution works
  • ✅ Backward compatibility maintained

🔗 Related PRs

📖 Usage Example

# Traditional verbose syntax
nextflow plugin nf-wave:command -- --help

# New first-class command syntax  
nextflow wave --help

🎉 Benefits

  • Better UX: Clean, intuitive command syntax
  • Help Integration: Commands appear in main help with descriptions
  • Extensible: Easy for other plugins to add first-class commands
  • Maintainable: Clear separation between core and plugin functionality

🤖 Generated with Claude Code

edmundmiller and others added 10 commits August 14, 2025 19:40
Add new extension point infrastructure to allow plugins to register
top-level CLI commands that appear as first-class citizens alongside
built-in commands.

Changes:
- Add CommandExtensionPoint interface for plugin command registration
- Add PluginCommandBase abstract class with session management
- Add PluginCommandDiscovery utility for dynamic command discovery
- Support priority-based conflict resolution between plugin commands
- Enable commands like 'nextflow wave' instead of 'nextflow plugin nf-wave:command'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Modernize Launcher to dynamically discover and register plugin commands
alongside built-in commands, with unified help system support.

Changes:
- Replace static command list with dynamic discovery system
- Add plugin command integration with conflict detection
- Update help system to display both built-in and plugin commands
- Maintain full backward compatibility with existing plugin syntax
- Add graceful error handling for plugin discovery failures

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add new Wave command classes that enable 'nextflow wave' syntax
while maintaining full backward compatibility with existing
'nextflow plugin nf-wave:command' syntax.

Changes:
- Add WaveCmd extending PluginCommandBase with subcommand routing
- Add WaveCmdExtension implementing CommandExtensionPoint
- Support all existing Wave commands: get-container, run-container, pack, debug-task
- Enable clean syntax: 'nextflow wave get-container' vs 'nextflow plugin nf-wave:get-container'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Configure Wave plugin to expose the new command extension alongside
existing functionality, maintaining full backward compatibility.

Changes:
- Add WaveCmdExtension to plugin extensions registry
- Import WaveCmd in WavePlugin for reference
- Enable both 'nextflow wave' (new) and 'nextflow plugin nf-wave:command' (legacy) syntax

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…tialization

- Add comprehensive debug logging to track plugin command discovery process
- Fix plugin initialization timing by ensuring all plugins are started before extension discovery
- Add explicit plugin state checking and starting in ensurePluginsInitialized()
- Enhance error logging in addPluginCommands() for better troubleshooting
- Include test script for verifying CLI plugin command system functionality

This completes the first-class plugin command system, enabling commands like 'nextflow wave'
instead of the verbose 'nextflow plugin nf-wave:command' syntax.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Replace error message with helpful usage information when no subcommand provided.
Add detailed help text showing available subcommands with descriptions and examples.
Support 'help' subcommand and handle help flags gracefully.
Maintain backward compatibility with existing Wave functionality.

Users can now run 'nextflow wave' to see helpful usage information instead of an error.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add CommandExtensionPoint interface for plugin command registration
- Add PluginCommandBase abstract class extending CmdBase
- Add PluginCommandDiscovery for automatic command discovery and registration
- Support priority-based conflict resolution for command names
- Enable plugins to provide first-class CLI commands

This system allows plugins to register commands that appear directly
in the main Nextflow CLI help and can be executed as 'nextflow <command>'
instead of the verbose 'nextflow plugin <plugin>:<command>' syntax.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove extension point interfaces moved to nextflow-plugin-gradle
- Update imports in remaining files to use gradle plugin versions
- Maintain backward compatibility for existing functionality

Extension points are now provided by the nextflow-plugin gradle plugin
to enable standalone plugin development while eliminating duplication
in the main Nextflow codebase.

Files removed:
- PluginExtensionPoint.groovy
- Factory.groovy
- Function.groovy
- Operator.groovy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove CLI command classes moved to separate nf-wave-cli plugin
- Clean up WavePlugin main class to focus on core Wave functionality
- Update extensions.idx to remove CLI extension registrations

This separation allows independent development of Wave CLI functionality
while maintaining core Wave features in the main plugin. The CLI is now
provided by the separate nf-wave-cli plugin for first-class command integration.

Removed CLI classes:
- WaveCmd.groovy
- WaveCmdEntry.groovy
- WaveCmdExtension.groovy
- WaveDebugCmd.groovy
- WaveRunCmd.groovy
- Associated test files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update dependencies to use nextflow-plugin-gradle 1.0.0-beta.7
- Configure build system for new extension point architecture
- Maintain compatibility with existing plugin ecosystem

These changes support the new extension point system that enables
standalone plugin development while maintaining full integration
with the main Nextflow CLI system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@netlify
Copy link

netlify bot commented Aug 19, 2025

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit a3b2450
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/68a4c1051592610008dbd260
😎 Deploy Preview https://deploy-preview-6350--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bentsherman
Copy link
Member

I appreciate the ingenuity but I think this is too much dynamism

My understanding is that you want to piggy-back on Nextflow's distribution mechanism to provide CLI tools as extensions. But I think that is really stretching the intended purpose of plugins

If you need a new CLI tool, you should really just create a separate CLI tool that uses the Nextflow runtime as a library. I already went through this thought process with the language server. We ended up finding a suitable distribution mechanism for that (VS Code extension) and I'm sure we can do the same for your use case (e.g. DXT for MCP servers)

@pditommaso
Copy link
Member

Closing as not planned

@pditommaso pditommaso closed this Sep 4, 2025
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.

3 participants