close
Skip to content

Add recipe-apply-filter-to-existing-emails#739

Open
ldub wants to merge 1 commit intogoogleworkspace:mainfrom
ldub:add-recipe-apply-filter-to-existing-emails
Open

Add recipe-apply-filter-to-existing-emails#739
ldub wants to merge 1 commit intogoogleworkspace:mainfrom
ldub:add-recipe-apply-filter-to-existing-emails

Conversation

@ldub
Copy link
Copy Markdown

@ldub ldub commented Apr 21, 2026

Description

Adds a new recipe skill, recipe-apply-filter-to-existing-emails, that documents how to apply a Gmail filter's actions to existing messages — the API equivalent of the Gmail UI's "Also apply filter to matching conversations" checkbox, which has no parameter on filters.create and is tracked as feature request Google Issue Tracker #62715881.

The recipe walks through:

  1. gws gmail users settings filters get — read the filter's criteria and action
  2. gws gmail users messages list — translate criteria to a Gmail search query
  3. gws gmail users messages batchModify — apply the filter's label mutations in bulk (up to 1000 ids per request)
  4. A verification list call scoped to in:inbox

caution notes two constraints: the 1000-id batch limit, and that forward actions on a filter cannot be replayed against past messages.

The diff is TOML + auto-generated Markdown only — no Rust changes. A --dry-run is not applicable (no new CLI surface).

Development practices followed

  • Read docs/CONTRIBUTING.md and AGENTS.md in full. Confirmed the contribution pattern: recipes are TOML entries in crates/google-workspace-cli/registry/recipes.toml; skills/recipe-*/SKILL.md and docs/skills.md are auto-generated by gws generate-skills, not handwritten.
  • Added the recipe as a [[recipes]] entry with name, title, description (under the 120-char FRONTMATTER_DESCRIPTION_LIMIT), category = "productivity", services = ["gmail"], steps, and caution.
  • Regenerated skills/recipe-apply-filter-to-existing-emails/SKILL.md and docs/skills.md via cargo run -- generate-skills. Reverted unrelated drift that the regeneration picked up from upstream Discovery Document updates (Chat findGroupChats, Drive generateCseToken, Events patch wording, sheets-append --range description) — those belong in a separate PR.
  • Added .changeset/recipe-apply-filter-to-existing-emails.md with "@googleworkspace/cli": patch.
  • Ran cargo fmt --all -- --check (clean) and cargo test (701 passed; includes test_registry_references, which validates that services = ["gmail"] resolves to a valid gws alias).
  • Ran cargo clippy --all-targets -- -D warnings. It surfaces ~10 pre-existing errors on clean upstream/main (assert_eq! with bool literal, very-complex-type, etc. in main.rs, commands.rs, executor.rs) that are unrelated to this diff. Likely a clippy-version skew against CI.

Checklist

  • My code follows the AGENTS.md guidelines (no generated google-* crates).
  • Ran cargo fmt --all — clean.
  • Ran cargo clippy -- -D warnings — pre-existing errors on upstream main, none introduced by this diff. Noted above.
  • Registry validation test (test_registry_references) covers the new entry. No new Rust logic, so no additional tests needed.
  • Changeset added (.changeset/recipe-apply-filter-to-existing-emails.md, patch).

Adds a recipe for applying a Gmail filter's label/archive actions to
existing messages via messages.batchModify — the API equivalent of the
Gmail UI's "also apply filter to matching conversations" checkbox,
which has no parameter on filters.create.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: 50f2da6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 21, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ldub ldub marked this pull request as ready for review April 21, 2026 17:51
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request adds a new productivity recipe to the Google Workspace CLI registry. The recipe enables users to programmatically apply Gmail filter actions to existing messages, effectively replicating the 'apply to matching conversations' functionality currently missing from the Gmail API's filter creation endpoint. The changes are strictly limited to configuration and documentation files.

Highlights

  • New Recipe Added: Introduced the recipe-apply-filter-to-existing-emails skill, which provides a workflow to apply Gmail filter actions to historical messages.
  • Documentation Updates: Updated the registry and generated the corresponding skill documentation to include the new recipe.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new recipe, apply-filter-to-existing-emails, which enables applying Gmail filter actions to existing messages through the API. The changes include the addition of the recipe to the registry, a new skill documentation file, and updates to the main skills list. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants