Commit Graph

442 Commits

Author SHA1 Message Date
Jeremiah Russell
368e78b1cc feat(config): implement config builder pattern for ClientConfig
- introduce ConfigBuilder struct for constructing ClientConfig instances
- add methods to ConfigBuilder for setting various configuration parameters
- implement a build method to create the ClientConfig instance
- add a default implementation for ConfigBuilder
- enhance ClientConfig with persist_path for token persistence
- update ClientConfig::new_from_configuration to use config_root.full_path()
- add ClientConfig::persist_path() to report the full path to the file to persist tokens
2025-10-16 15:37:01 +01:00
Jerus Bot
a6d5186cd9 chore: update prlog for pr 2025-10-16 11:21:40 +01:00
Jeremiah Russell
556d7bd598 ♻️ refactor(utils): improve config directory creation
- simplify directory creation logic
- handle existing directory case more efficiently
2025-10-16 11:21:40 +01:00
Jeremiah Russell
3111a1feff chore(build): bump rust version to 1.88
- update rust version in:
  - .circleci/config.yml
  - Cargo.toml
  - README.md
  - docs/readme/head.md
2025-10-16 11:21:40 +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
1ae34efb93 🐛 fix(config): resolve credential file path issue
- fix the problem of reading credential file in the production environment
- use config_root to find credential file
2025-10-16 11:21:40 +01:00
Jeremiah Russell
b17e72e6f3 feat(client_config): add config root parsing with regex
- introduce regex-based parsing for config root strings
- support 'h', 'r', and 'c' prefixes for home, root, and crate paths
- add tests for parsing different config root types
2025-10-16 11:21:40 +01:00
Jeremiah Russell
8ab89cdb0a feat(utils): add test utils module
- add test_utils module to provide common utilities for tests
- add get_test_logger function for initializing test logger
2025-10-16 11:21:40 +01:00
Jeremiah Russell
959e61743e feat(deps): add lazy-regex crate
- this commit introduces the lazy-regex crate to improve regex performance
- lazy-regex allows for the definition of static regexes that are compiled at compile time
2025-10-16 11:21:40 +01:00
Jeremiah Russell
0e68aa5560 feat(dependencies): add lazy-regex dependency
- add lazy-regex to improve regex performance
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
591e528291 ♻️ refactor(gmail): use client config for gmail client
- Replace credential file path with client config struct
- Simplify client initialization and authentication using yup-oauth2
2025-10-16 11:21:40 +01:00
Jeremiah Russell
3255f24c3a feat(config): add ConfigRoot enum for flexible path handling
- introduce ConfigRoot enum to represent different configuration file locations
- implement Display trait for ConfigRoot to provide string representation
- add parse method to determine ConfigRoot type based on prefix (h, r, c)
2025-10-16 11:21:40 +01:00
Jeremiah Russell
440144eee5 feat(core): add client config
- add client_config module for managing client configurations
- expose ClientConfig struct for external usage
2025-10-16 11:21:40 +01:00
Jeremiah Russell
dd1fe356a2 feat(config): introduce client configuration
- adds `ClientConfig` struct for managing Gmail client settings
- supports loading credentials from environment variables or a JSON file
- provides methods to access the application secret and configuration root
2025-10-16 11:21:40 +01:00
Jerus Bot
72d220e2f1 chore: update prlog for pr 2025-10-15 16:08:38 +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
Jerus Bot
6b9ce2670e chore: update prlog for pr 2025-10-15 14:30:07 +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
Jerus Bot
f3f3e22458 chore: update prlog for pr 2025-10-15 14:03:08 +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
Jerus Bot
455007dd82 chore: update prlog for pr 2025-10-15 12:39:20 +01:00
Jeremiah Russell
55b1d9a25d ♻️ refactor(eol_rule): improve labels handling
- use `cloned()` instead of `map(|i| i.to_string())` for better efficiency
2025-10-15 12:39:20 +01:00
Jeremiah Russell
972f3bb264 ♻️ refactor(cli): remove redundant Rules import
- remove redundant `Rules` import from several files in `src/cli`
- this change simplifies the code by removing unnecessary imports
2025-10-15 12:39:20 +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
Jerus Bot
0300653299 chore: update prlog for pr 2025-10-15 11:00:14 +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
Jerus Bot
7c2bcd37b4 chore: update prlog for pr 2025-10-15 07:21:07 +01:00
Jeremiah Russell
e51cd18f17 ♻️ refactor(message_list): rename messages_list to list_messages
- rename `messages_list` to `list_messages` for clarity
- update all instances of the function call
2025-10-15 07:21:07 +01:00
Jerus Bot
251baa0191 chore: update prlog for pr 2025-10-15 06:36:06 +01:00
Jeremiah Russell
73fa010974 ♻️ refactor(rule_processor): remove unused delete functions
- remove delete_messages and trash_messages functions from GmailClient struct
- these functions were commented out and not used in the current implementation
2025-10-15 06:36:06 +01:00
Jerus Bot
005b2992e2 chore: update prlog for pr 2025-10-15 06:28:07 +01:00
Jeremiah Russell
66b1263c99 🐛 fix(rule_processor): update Gmail API scope
- modify scope to allow broader access to Gmail
2025-10-15 06:28:07 +01:00
Jerus Bot
eeeca08e92 chore: Release cull-gmail v0.0.9 2025-10-14 16:22:52 +00:00
Jeremiah Russell
d31f067a13 🐛 fix(gmail_client): resolve ownership issue in message summary
- clone subject to avoid ownership transfer in format! macro
2025-10-14 17:10:21 +01:00
Jeremiah Russell
37d02bd0bf 🐛 fix(gmail): display message date and subject
- Refactor log_message_subjects to log_messages for clarity
- Simplify date and subject retrieval in log_messages
- Use MessageSummary's list_date_and_subject for logging
- Elide subject in MessageSummary for consistent display
2025-10-14 17:10:21 +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
1feeccdebe feat(gmail_client): add date to message summary
- add date field to MessageSummary struct
- implement methods to set and retrieve the date
- implement method to list the date and subject
2025-10-14 17:10:21 +01:00
Jeremiah Russell
9f4b2fa6ae feat(gmail): enhance message metadata retrieval
- add date header to message metadata retrieval
- retrieve date and subject from email headers
- set date and subject for each message in the list
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
Jerus Bot
af9ced8416 chore: update prlog for pr 2025-10-14 17:10:21 +01:00
Jeremiah Russell
ef88b88ab1 ️ perf(gmail): remove logging message subjects
- remove logging message subjects to improve performance
2025-10-14 17:10:21 +01:00
Jeremiah Russell
02e58275e7 feat(cli): add message list subcommand
- add subcommand to list messages from gmail
- implement message listing functionality
- add ability to specify query and number of pages
2025-10-14 17:10:21 +01:00
Jeremiah Russell
1eefad2cff feat(cli): add configuration options for message listing
- Add max_results, pages, labels, and query options to message CLI
- Allow users to customize message retrieval with flags
2025-10-14 17:10:21 +01:00
Jerus Bot
68a7931308 chore: Release cull-gmail v0.0.8 2025-10-14 06:50:44 +00:00
Jeremiah Russell
b6a53461ce 🐛 fix(cli): correct label adding to use non-async function
- fix label adding to use non-async function
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7b9be5f243 feat(cli): create message trait to share list parameters
- create message trait to share list parameters
- implement message trait for message and delete cli
2025-10-14 07:41:39 +01:00
Jeremiah Russell
e488cd25cf ♻️ refactor(cli): streamline message retrieval and parameter setting
- extract parameter setting logic into a separate function `set_parameters`
- consolidate label adding, query setting, and max results setting into `set_parameters`
- rename `run` to `get_messages` for clarity
- add methods for retrieving labels, query, and max_results
2025-10-14 07:41:39 +01:00