refactor: Convert main() coroutine to Click CLI group for extensible subcommands#93
Merged
Merged
Conversation
…subcommands - Restructure CLI entry point using Click framework - Rename main() to run_interactive_cli() for clarity - Create @click.group() decorator for cli() as main entry point - Add 'run' subcommand for interactive session (default behavior) - Add 'config' subcommand placeholder for future configuration management - Add 'clean' subcommand with --cache, --logs, --all options - Update cli/__init__.py exports to use new cli and run_interactive_cli - Update cli_launcher.py to use Click CLI structure - Add click>=8.0.0 to requirements.txt - Create CLI_COMMANDS.md documentation with usage examples Benefits: - Extensible architecture for adding new subcommands without touching main logic - Professional CLI using industry-standard Click framework - Built-in --help and --version support - Backward compatible with existing workflows - Self-documenting commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR converts the free-standing
main()coroutine into a proper Click group structure, enabling extensible subcommands without touching the main logic.Changes
Core Changes
cli/cli_app.py - Main CLI restructuring:
import clickfor CLI frameworkmain()→run_interactive_cli()(the actual async function)@click.group()decorator forcli()function as the main entry pointinvoke_without_command=Trueso running without a subcommand defaults to interactive mode@cli.command()forrunsubcommand (runs interactive session)@cli.command()forconfigsubcommand (placeholder for future configuration management)@cli.command()forcleansubcommand with options--cache,--logs,--allcli/init.py - Updated exports:
from .cli_app import main as cli_mainfrom .cli_app import cli, run_interactive_cli__all__accordinglycli/cli_launcher.py - Updated to use Click:
from cli.cli_app import main as cli_mainandasyncio.run(cli_main())from cli.cli_app import cliandcli(["run"])requirements.txt - Added dependency:
click>=8.0.0to the dependencies listcli/CLI_COMMANDS.md - Created documentation:
Usage Examples
Benefits
✅ Extensible: Easy to add new subcommands like
deepcode config,deepcode clean,deepcode doctor, etc.✅ Professional: Uses industry-standard Click framework
✅ Backward Compatible: Existing workflows continue to work
✅ Self-Documenting: Built-in
--helpfor all commands✅ Clean Separation: Main logic untouched, only CLI structure changed
Future Enhancements
Potential subcommands to add:
deepcode process --file <path>- Direct file processingdeepcode process --url <url>- Direct URL processingdeepcode history- View processing historydeepcode export- Export resultsdeepcode doctor- Check system dependencies and configurationTesting
The changes have been tested to ensure:
Related Issues
None
Checklist
Pull Request opened by Augment Code with guidance from the PR author