* feat: Add powerful CLI for account management - 18 commands for quota monitoring, switching, validation - Interactive mode with keyboard navigation - Smart auto-switch based on quotas - Alias support for quick access - Token auto-refresh and diagnostics - Full documentation in cli/README.md" * fix: Address code review issues - Add SQLite transactions for atomicity\n- Add input validation for import_accounts\n- Add per-account error handling in bulk operations\n- Add graceful error handling in interactive mode\n- Add validation for varint encoding (negative values)\n- Improve user feedback on partial failures
2.8 KiB
2.8 KiB
CLI Feature - Pull Request Summary
What This PR Adds
A complete Command-Line Interface (CLI) for Antigravity Manager with 18+ commands for power users.
Key Features
- 📊 Live Quota Monitoring - Real-time tracking for Gemini & Claude models
- 🔄 Account Switching - Seamless switching without manual token management
- ✅ Token Validation - Auto-refresh expired tokens
- 🎯 Smart Auto-Switch - Automatically pick best account by quota
- 🏷️ Aliases - Shortcut names for accounts (
work,personal) - 💾 Backup/Restore - Export/import account configurations
- 🎮 Interactive Mode - Keyboard-navigated menus for beginners
- 🩺 Diagnostics - System health checks
Technical Highlights
- Zero Hardcoded Paths: Intelligently discovers database and executable locations
- Cross-Platform Ready: Uses environment variables and checks for Windows/Mac/Linux
- Secure: Leverages existing DPAPI + AES-256-GCM encryption (same as GUI)
- Extensible: Clean separation between core logic (
core.py) and commands (main.py)
File Structure
cli/
├── README.md # Full documentation
├── requirements.txt # Python dependencies
├── core.py # Database, encryption, API logic
├── main.py # CLI commands and interactive UI
└── proto_utils.py # Protobuf encoding helpers
Usage Examples
# Interactive mode
agm
# Quick status
agm status
# Switch accounts
agm switch work
# Auto-switch to best account
agm auto-switch --model claude --min-quota 50
# Live monitoring
agm watch
Testing
- ✅ Tested on Windows 10/11
- ✅ No hardcoded paths (uses standard Windows env vars)
- ✅ Works with both installed and development builds
- ✅ Database encryption/decryption verified
Dependencies
All Python dependencies are self-contained in cli/requirements.txt:
typer- CLI frameworkrich- Beautiful terminal outputquestionary- Interactive menuspywin32- Windows DPAPI supportcryptography- AES-256-GCM encryptionhttpx- Async HTTP clientpsutil- Process managementprotobuf- Google API protocol buffers
Platform Support
- Windows: Full support (tested)
- macOS/Linux: Partial support (no DPAPI, but core features work)
Breaking Changes
None. This is a pure addition—no changes to existing GUI code.
Future Enhancements
- OAuth flow for adding new accounts via CLI
- TUI (Terminal UI) with live dashboard
- Scheduled auto-refresh via Windows Task Scheduler
- Config file for user preferences
Checklist
- Code follows existing style
- All commands have help text
- No hardcoded paths/credentials
- README with examples
- Dependencies in requirements.txt
- .gitignore updated for Python
- Works with fresh installs
Ready to merge! 🚀