Skip to content

Add Docs and Slides write commands (create / append / find-replace, etc.)#21

Merged
ronaldmannak merged 5 commits into
mainfrom
claude/gog-docs-slides-writes
Jun 21, 2026
Merged

Add Docs and Slides write commands (create / append / find-replace, etc.)#21
ronaldmannak merged 5 commits into
mainfrom
claude/gog-docs-slides-writes

Conversation

@ronaldmannak

Copy link
Copy Markdown
Contributor

Extends the write surface to Docs and Slides (previously read/export-only), following the pattern from #19: --dry-run preview, --json passthrough, googleURL + GoogleHTTPClient, a one-line summary, and gating under the host GogWriteTier.

New commands (all .edit)

Service Command API
Docs create --title documents.create
Docs append <id> --text documents.batchUpdate (insertText @ end)
Docs find-replace <id> --find --replace [--match-case] documents.batchUpdate (replaceAllText)
Slides create --title presentations.create
Slides add-slide <id> presentations.batchUpdate (createSlide, blank)
Slides replace-text <id> --find --replace [--match-case] presentations.batchUpdate (replaceAllText)

replaceAllText is shared between Docs and Slides (DocsReplaceBatch).

Hosts

Writes use docs.googleapis.com / slides.googleapis.com (reads still export through Drive on www.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

…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

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

Copy link
Copy Markdown

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 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.

Comment thread Sources/GogCommands/GogCommand.swift Outdated
Comment thread Sources/GogCommands/GogCommand.swift Outdated
Comment thread Sources/GogCommands/GogCommand.swift Outdated
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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread Sources/GogCommands/GogCommand.swift Outdated
… 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread Sources/GogCommands/GogCommand.swift Outdated
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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread Sources/GogCommands/GogCommand.swift Outdated
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
@ronaldmannak

Copy link
Copy Markdown
Contributor Author

@codex review

@ronaldmannak ronaldmannak merged commit 06f075d into main Jun 21, 2026
2 checks passed
@ronaldmannak ronaldmannak deleted the claude/gog-docs-slides-writes branch June 21, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants