Commit Graph

29 Commits

Author SHA1 Message Date
Jeremiah Russell
fd70ef9511 feat(cli): scaffold InitCli subcommand and clap wiring 2025-10-21 14:48:31 +01:00
Jeremiah Russell
171f441f1d 🔧 fix: Resolve clippy warnings and formatting issues
- Remove unnecessary borrowing where values can be used directly
- Use variables directly in format strings for better readability
- Apply consistent code formatting per rustfmt standards
- All clippy warnings resolved with -D warnings flag
- Code now follows Rust idioms and best practices
2025-10-21 07:47:55 +01:00
Jeremiah Russell
2bee42d7ba 🔐 feat: Add token export/import for ephemeral environments
- Add token CLI subcommand with export/import operations
- Enable OAuth2 token persistence across clean environments
- Support for containers, CI/CD, and ephemeral compute workflows
- Compress tokens with gzip and encode as base64 for env vars
- Automatic token restoration from CULL_GMAIL_TOKEN_CACHE
- Secure file permissions (600) on restored tokens
- Add comprehensive error handling for token operations
- Update dependencies: base64, flate2, serde_json

This feature enables cull-gmail to run in ephemeral environments
like Docker containers and CI/CD pipelines without re-authentication
by exporting tokens once and restoring them via environment variables.
2025-10-21 07:47:55 +01:00
Jeremiah Russell
3979379795 🎨 style(cli): apply rustfmt formatting standards to CLI modules
- Apply cargo fmt to ensure consistent code formatting across CLI modules
- Fix trailing whitespace in documentation comments
- Optimize comment formatting and indentation
- All clippy checks pass with no warnings
- Documentation generates cleanly with strict nightly flags
- All tests continue to pass after formatting changes
2025-10-20 22:27:38 +01:00
Jeremiah Russell
a35b5f9248 📝 docs(cli): add comprehensive module documentation and function docs
- Add extensive module-level documentation explaining CLI architecture
- Document all CLI structs with detailed field explanations and usage examples
- Add comprehensive function documentation covering all main workflow functions
- Include safety considerations, error handling, and configuration guidance
- Fix configuration parameter name: credentials -> credential_file
- Document logging levels, exit codes, and environment variable overrides
- Add detailed explanations of rule processing workflow and safety features
2025-10-20 22:27:38 +01:00
Jeremiah Russell
754e5229ae ♻️ refactor(cli): extract action execution into a function
- move action execution logic into `execute_action` function
- improve code readability and reduce duplication
2025-10-16 17:28:55 +01:00
Jeremiah Russell
0136d7da09 feat(cli): add default subcommand for rule execution
- Add a default subcommand that executes rules based on configuration.
- Load rules and configuration to determine execution behavior.
- Implement dry run functionality to prevent unintended actions.
2025-10-16 17:28:55 +01:00
Jeremiah Russell
44b98d0657 feat(cli): load configurations from toml file
- load configurations from `cull-gmail.toml`
- set default value for rules in config
2025-10-16 11:21:40 +01:00
Jeremiah Russell
66b7c820d7 ♻️ refactor(cli): use ClientConfig struct for gmail client
- use ClientConfig struct instead of credential string
- load config from file and env vars
- simplify config loading and client creation
2025-10-16 11:21:40 +01:00
Jeremiah Russell
c53ad65368 feat(cli): add config file support
- load configuration from a file
- use config crate for config loading
- allow overriding config with environment variables
- set default credential path
- fix error handling for config loading
2025-10-15 16:08:38 +01:00
Jeremiah Russell
2fa7cd21ab ♻️ refactor(rules): remove credentials config
- remove unused credentials configuration
- remove credentials file setting/getting logic
- rename config file to rules.toml
2025-10-15 14:30:07 +01:00
Jeremiah Russell
5905a6fb54 ♻️ refactor(cli): remove config from run args
- remove config from run args to load inside functions
- load credential.json directly instead of config file
2025-10-15 14:03:08 +01:00
Jeremiah Russell
0bc71f5b75 ♻️ refactor: rename Config to Rules
- rename Config struct to Rules to better reflect its purpose
- update all references to Config to Rules
2025-10-15 12:39:20 +01:00
Jeremiah Russell
3beab7d82d ♻️ refactor(cli): restructure cli commands for better organization
- rename `label_cli.rs` to `labels_cli.rs`
- rename `message_cli.rs` to `messages_cli.rs`
- move config related commands to `rules config` subcommand
- introduce `rules run` subcommand
2025-10-15 11:00:14 +01:00
Jeremiah Russell
f9e86bf8d9 ♻️ refactor(cli): rename run_cli to rules_cli
- rename run_cli files to rules_cli
- reflect changes in module imports and subcommand names
2025-10-14 17:10:21 +01:00
Jeremiah Russell
f7db97dd07 ♻️ refactor(cli): consolidate message handling and remove delete command
- 【Refactor】: Move `set_parameters` function from `Message` trait implementation for `DeleteCli` to `MessageCli` to avoid duplication.
- 【Feature】: Add `Delete` action to `MessageAction` enum to allow direct deletion of messages.
- 【Cleanup】: Remove `delete_cli.rs` and `message_trait.rs` as their functionalities are now integrated into `message_cli.rs`.
2025-10-14 17:10:21 +01:00
Jeremiah Russell
f3a1edaf1f ♻️ refactor(cli): refactor message handling and remove trash command
- 【Refactor】: Moved trash functionality into the message subcommand for better organization.
- 【Refactor】: Removed the separate `trash_cli` module.
- 【Feature】: Added a `Trash` action to the `MessageAction` enum.
- 【Refactor】: Modified `MessageCli::run` to handle the new `Trash` action.
2025-10-14 17:10:21 +01:00
Jeremiah Russell
1052eeb22e feat(cli): enhance cli subcommand ordering and grouping
- improve subcommand organization for better user experience
- implement display_order attribute for logical ordering of subcommands
- introduce next_help_heading for grouping subcommands under meaningful titles
2025-10-14 17:10:21 +01:00
Jeremiah Russell
7e1d07b3ab feat(cli): add message trait for cli subcommands
- introduce a trait to handle message-related operations
- implement the trait for config, delete, label, message, run, and trash subcommands
2025-10-14 07:41:39 +01:00
Jeremiah Russell
5331551eea ♻️ refactor(cli): use mutable client for subcommands
- change `client` to mutable to allow modification in subcommands
- update subcommands to use the mutable `client`
2025-10-14 07:41:39 +01:00
Jeremiah Russell
88fbf74587 ♻️ refactor(cli): use client for trash subcommand
- use the api client for the trash subcommand
2025-10-14 07:41:39 +01:00
Jeremiah Russell
f79fd2d48c ♻️ refactor(cli): pass client to run command
- pass client to run command to enable api calls
2025-10-14 07:41:39 +01:00
Jeremiah Russell
9bdb559104 ♻️ refactor(cli): use client instance for message subcommand
- use client instance for message subcommand to avoid redundant credential file access
2025-10-14 07:41:39 +01:00
Jeremiah Russell
704b2b023e 🐛 fix(cli): fix delete command
- pass the client to the delete command
2025-10-14 07:41:39 +01:00
Jeremiah Russell
04478a13f8 ♻️ refactor(cli): use gmail client for label operations
- replace credential file with gmail client for label operations
- use gmail client to list labels
2025-10-14 07:41:39 +01:00
Jeremiah Russell
6a7c67cffc ♻️ refactor(cli): inject config into run command
- inject config into run command for better access to settings
2025-10-11 09:35:12 +01:00
Jeremiah Russell
a1015d9837 feat(cli): add run command to execute rules
- introduce `run` subcommand to trigger rule execution
- implement `RunCli` struct and logic for rule processing
2025-10-11 09:35:12 +01:00
Jeremiah Russell
bca235a2e7 feat(cli): add delete subcommand
- introduce delete_cli module for handling message deletion
- implement delete subcommand to permanently remove messages
- refactor subcommands to use non-optional enum for improved handling
2025-10-09 22:45:24 +01:00
Jeremiah Russell
0e4f4c6fef ♻️ refactor(cli): move main.rs to cli folder
- move main.rs to cli folder for better structure
2025-10-09 17:03:04 +01:00