Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 27, 2026

Summary

Migrates the CLI from the deprecated click.MultiCommand to click.Group. click.MultiCommand will be removed in click 9, so this change prepares the codebase for future click upgrades.

Changes:

  • Changed ElementaryCLI base class from click.MultiCommand to click.Group
  • Replaced @click.command with @click.group decorator
  • Removed the _CMD_MAP dictionary and list_commands() method (now handled by click.Group internally)
  • Register commands using cli.add_command() instead of dictionary lookup
  • Updated get_command() to delegate to super().get_command() while preserving the auto_envvar_prefix setting

Review & Testing Checklist for Human

  • Verify all CLI commands work: edr monitor --help, edr report --help, edr send-report --help, edr run-operation --help
  • Verify edr --help shows all 4 commands correctly
  • Test that environment variable prefix still works (e.g., EDR_* environment variables are recognized)

Recommended test plan: Install the package locally (pip install -e .) and run edr --help to verify the command list appears correctly, then test at least one subcommand end-to-end.

Notes

Fixes ELE-5220

Link to Devin run: https://app.devin.ai/sessions/68de447c968446cc850dc87532c97ffe
Requested by: Itamar Hartstein (@haritamar)

Summary by CodeRabbit

  • Refactor
    • Enhanced the CLI command architecture to improve code maintainability and extensibility of the command structure.

✏️ Tip: You can customize this high-level summary in your review settings.

click.MultiCommand is deprecated and will be removed in click 9.
This change migrates to click.Group which is the recommended replacement.

- Changed ElementaryCLI base class from click.MultiCommand to click.Group
- Replaced @click.command with @click.group decorator
- Removed _CMD_MAP dictionary and list_commands() method
- Added commands using cli.add_command() instead
- Updated get_command() to call super().get_command()

Fixes ELE-5220

Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@linear
Copy link

linear bot commented Jan 27, 2026

@github-actions
Copy link
Contributor

👋 @devin-ai-integration[bot]
Thank you for raising your pull request.
Please make sure to add tests and document all user-facing changes.
You can do this by editing the docs files in this pull request.

@haritamar haritamar enabled auto-merge (squash) January 27, 2026 15:52
@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The CLI base class was migrated from the deprecated click.MultiCommand to click.Group. Command resolution now uses Click's native group mechanism with explicit command registration via add_command() calls instead of custom map-based lookups.

Changes

Cohort / File(s) Summary
CLI migration from MultiCommand to Group
elementary/cli/cli.py
Replaced click.MultiCommand inheritance with click.Group; removed _CMD_MAP static attribute and list_commands() method; delegated get_command() to parent class; changed decorator from @click.command to @click.group; injected public commands (monitor, report, send-report, run-operation) via explicit add_command() registration

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hop hop, the old ways fade,
MultiCommand's worn parade,
Click's Group now takes the lead,
Fresh paths for commands to heed! 🌱

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@haritamar haritamar merged commit 2ea3ce0 into master Jan 27, 2026
13 of 16 checks passed
@haritamar haritamar deleted the devin/ELE-5220-1769526161 branch January 27, 2026 15:54
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.

2 participants