refactor: Convert main() coroutine to Click CLI group for extensible subcommands #93
+351
−33
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