Skip to content

docs: warn about zsh ! history expansion in sheet range examples#412

Open
anshul-garg27 wants to merge 2 commits intogoogleworkspace:mainfrom
anshul-garg27:docs/shell-quoting-and-tips
Open

docs: warn about zsh ! history expansion in sheet range examples#412
anshul-garg27 wants to merge 2 commits intogoogleworkspace:mainfrom
anshul-garg27:docs/shell-quoting-and-tips

Conversation

@anshul-garg27
Copy link

Summary

  • Add a Shell Tips section to the gws-shared skill template explaining zsh ! history expansion
  • Replace single quotes with double quotes around sheet ranges containing ! in recipe sources and skill examples

Problem

zsh interprets ! inside single-quoted strings as history expansion. Running commands like:

gws sheets +read --spreadsheet ID --range 'Sheet1!A1:D10'

produces Invalid --params JSON errors because zsh mangles the value before gws receives it.

Changes

File What changed
src/generate_skills.rs Added Shell Tips section to shared skill template
src/helpers/sheets.rs Fixed +read after_help example
registry/recipes.yaml Fixed 5 sheet range examples (source for generated recipes)
skills/gws-shared/SKILL.md Regenerated with Shell Tips section
skills/gws-sheets-read/SKILL.md Fixed example quoting
skills/recipe-*/SKILL.md (4 files) Fixed sheet range quoting

Test plan

  • Edits made in registry/recipes.yaml (source), not just generated files
  • Shared skill template updated in generate_skills.rs
  • Generated SKILL.md files updated to match sources
  • Only sheet range ! patterns changed — Gmail/Chat ! at end of sentences left as-is (safe in zsh)

Closes #268

Add a "Shell Tips" section to the gws-shared skill explaining that
zsh interprets \! inside single quotes as history expansion, which
mangles sheet ranges like 'Sheet1\!A1:B2'.

Replace single quotes with double quotes around sheet ranges
containing \! in:
- registry/recipes.yaml (source for generated recipe skills)
- src/helpers/sheets.rs (+read after_help examples)
- src/generate_skills.rs (shared skill template)
- Generated SKILL.md files for affected recipes and gws-sheets-read

Closes googleworkspace#268
@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2026

🦋 Changeset detected

Latest commit: 9511a63

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

@googleworkspace-bot googleworkspace-bot added area: skills area: core Core CLI parsing, commands, error handling, utilities labels Mar 11, 2026
@gemini-code-assist
Copy link
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 addresses a compatibility issue where zsh's history expansion feature would incorrectly interpret sheet ranges containing ! when enclosed in single quotes within gws sheets +read commands. To resolve this, a new "Shell Tips" section has been integrated into the shared skill documentation, offering clear instructions on proper quoting. Concurrently, all affected examples in the recipe sources and generated skill documentation have been updated to utilize double quotes for sheet ranges, ensuring commands function as intended without shell misinterpretation.

Highlights

  • Shell Tips Section Added: A new "Shell Tips" section was introduced to the gws-shared skill template, providing guidance on handling zsh ! history expansion and JSON quoting.
  • Sheet Range Quoting Corrected: Shell quoting in various gws sheets +read examples across recipes and skill documentation was updated from single to double quotes for sheet ranges containing ! to prevent zsh history expansion issues.
Changelog
  • .changeset/shell-quoting-and-tips.md
    • Added a new changeset entry documenting the shell quoting and tips update.
  • registry/recipes.yaml
    • Updated five sheet range examples to use double quotes instead of single quotes for ranges containing !.
  • skills/gws-shared/SKILL.md
    • Added a new "Shell Tips" section detailing zsh ! expansion and JSON quoting.
  • skills/gws-sheets-read/SKILL.md
    • Updated an example to use double quotes for a sheet range.
  • skills/recipe-compare-sheet-tabs/SKILL.md
    • Updated two examples to use double quotes for sheet ranges.
  • skills/recipe-create-events-from-sheet/SKILL.md
    • Updated an example to use double quotes for a sheet range.
  • skills/recipe-generate-report-from-sheet/SKILL.md
    • Updated an example to use double quotes for a sheet range.
  • skills/recipe-log-deal-update/SKILL.md
    • Updated an example to use double quotes for a sheet range.
  • src/generate_skills.rs
    • Injected the new "Shell Tips" section into the shared skill template generation logic.
  • src/helpers/sheets.rs
    • Corrected the after_help example for gws sheets +read to use double quotes for the sheet range.
Activity
  • No human activity (comments, reviews, etc.) has occurred on this pull request yet.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
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 addresses an important shell compatibility issue with zsh by updating documentation and examples to use double quotes for sheet ranges containing !. The changes are mostly correct and well-implemented across the various documentation and source files. However, I've found a critical issue in src/helpers/sheets.rs where an unescaped double quote in a string literal will break the build. Please address this to ensure the code remains compilable.

"\
EXAMPLES:
gws sheets +read --spreadsheet ID --range 'Sheet1!A1:D10'
gws sheets +read --spreadsheet ID --range "Sheet1!A1:D10"
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The use of an unescaped double quote " within this string literal will cause a compilation error. Since the string literal is defined with double quotes, any double quotes inside it must be escaped with a backslash (\).

Suggested change
gws sheets +read --spreadsheet ID --range "Sheet1!A1:D10"
gws sheets +read --spreadsheet ID --range \"Sheet1!A1:D10\"

The after_help string for +read uses a regular string literal, not a
raw string, so inner double quotes must be escaped with backslashes.
@googleworkspace-bot
Copy link
Collaborator

/gemini review

Copy link
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 correctly addresses a shell compatibility issue with zsh where ! in sheet ranges is interpreted as history expansion. The fix, which replaces single quotes with double quotes in example commands across documentation and recipes, is applied consistently. A new "Shell Tips" section is also added to explain the issue to users. I have one suggestion to improve the clarity of this new documentation section.


## Shell Tips

- **zsh `!` expansion:** Sheet ranges like `Sheet1!A1` contain `!` which zsh interprets as history expansion. Use double quotes with escaped inner quotes instead of single quotes:
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The explanation for zsh ! expansion is a bit confusing. It says "Use double quotes with escaped inner quotes instead of single quotes", but the example that follows simply replaces single quotes with double quotes and contains no inner quotes. This phrasing could be misleading for users. A simpler explanation would be more accurate and easier to understand.

Suggested change
- **zsh `!` expansion:** Sheet ranges like `Sheet1!A1` contain `!` which zsh interprets as history expansion. Use double quotes with escaped inner quotes instead of single quotes:
- **zsh `!` expansion:** Sheet ranges like `Sheet1!A1` contain `!` which zsh interprets as history expansion. To prevent this, use double quotes instead of single quotes around the argument:

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

Labels

area: core Core CLI parsing, commands, error handling, utilities area: skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: warn about ! (history expansion) in shell examples containing sheet ranges

2 participants