Add Docs and Slides write commands (create / append / find-replace, etc.)#21
Conversation
…etc.) First write pass for Docs and Slides, following the established pattern (--dry-run preview, --json passthrough, googleURL + GoogleHTTPClient, one-line summary) and gated at the .edit write tier: docs create | append | find-replace (Docs API batchUpdate) slides create | add-slide | replace-text (Slides API batchUpdate) Writes use docs.googleapis.com / slides.googleapis.com (reads still export via Drive on www.googleapis.com), so the host must allow those two hosts — noted in the README allow-list example and SKILL.md. replaceAllText is shared between Docs and Slides (DocsReplaceBatch). Adds wiring tests (verb + endpoint + body) plus a validation and a dry-run test; SKILL.md documents the new commands. https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
Code Review
This pull request adds write capabilities to the Google Docs and Google Slides CLI commands, introducing new subcommands for creating documents/presentations, appending text, adding slides, and performing find-and-replace operations. It also updates the network configuration and documentation to support these new endpoints, backed by comprehensive unit tests. The feedback suggests renaming the shared DocsReplaceBatch struct to a service-agnostic name like ReplaceAllTextBatch to improve clarity and maintainability since it is used by both Docs and Slides commands.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Per review: the replaceAllText batchUpdate body is shared by both DocsFindReplace and SlidesReplaceText, so a service-agnostic name (matching the Google API request name) is clearer than the Docs-prefixed one. https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65298fec38
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… line Codex: endOfSegmentLocation inserts just before the body's final newline, so `docs append --text 'Foo'` joined the document's last paragraph. Prefix the inserted text with a newline so it starts a new paragraph (matching the command name and the documented example); help text updated and the test asserts the newline prefix. https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2fc75d4a0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex: the unconditional newline prefix gives a brand-new empty doc a leading blank paragraph. Keeping the prefix (so "append a paragraph" stays a single offline request and the common existing-doc case is right) and documenting the empty-doc edge as intentional — detecting emptiness would need an extra read and would break the offline --dry-run. https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c283de695
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex: an empty endOfSegmentLocation resolves to the first tab, so append silently wrote to the wrong tab in multi-tab docs. Add --tab-id (encoded into endOfSegmentLocation; omitted via encodeIfPresent for single-tab docs, which the API resolves to the only tab). Test covers the tabId encoding. https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
|
@codex review |
Extends the write surface to Docs and Slides (previously read/export-only), following the pattern from #19:
--dry-runpreview,--jsonpassthrough,googleURL+GoogleHTTPClient, a one-line summary, and gating under the hostGogWriteTier.New commands (all
.edit)create --titledocuments.createappend <id> --textdocuments.batchUpdate(insertText @ end)find-replace <id> --find --replace [--match-case]documents.batchUpdate(replaceAllText)create --titlepresentations.createadd-slide <id>presentations.batchUpdate(createSlide, blank)replace-text <id> --find --replace [--match-case]presentations.batchUpdate(replaceAllText)replaceAllTextis shared between Docs and Slides (DocsReplaceBatch).Hosts
Writes use
docs.googleapis.com/slides.googleapis.com(reads still export through Drive onwww.googleapis.com). Hosts must allow those two prefixes — added to the README allow-list example, and flagged in SKILL.md. Without them, the commands fail closed (exit 7), consistent with the rest of the tree.Scope
A focused, additive first pass. Destructive ops (
docs clear,slides delete-slide) and the richer gogcli surface (markdown decks, smart chips, image/table inserts, tabs) are intentionally not included here — natural follow-ups if wanted.Tests / docs
8 wiring tests (verb + endpoint + request body, a validation, a dry-run); SKILL.md documents the new commands (Docs/Slides sections only, so it merges cleanly alongside #20). CI green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
Generated by Claude Code