Skip to content

feat(docs): add Google Docs tab management commands#547

Closed
chopenhauer wants to merge 1 commit intoopenclaw:mainfrom
chopenhauer:feat/docs-tab-management
Closed

feat(docs): add Google Docs tab management commands#547
chopenhauer wants to merge 1 commit intoopenclaw:mainfrom
chopenhauer:feat/docs-tab-management

Conversation

@chopenhauer
Copy link
Copy Markdown
Contributor

feat(docs): add Google Docs tab management commands

Adds first-class Google Docs tab management to gog docs, covering the missing operations supported by the official Google Docs API but not yet exposed by the CLI.

New commands

  • gog docs add-tab <docId> [--title ...] [--index N] [--parent-tab <title|id>] [--icon-emoji 😀]
  • gog docs rename-tab <docId> --tab <title|id> --title <new-title>
  • gog docs delete-tab <docId> --tab <title|id>

Why

gog docs already supports:

  • listing tabs
  • reading tabs
  • writing to an existing tab

But it was still missing the lifecycle operations needed for full tab automation:

  • create a new tab
  • rename a tab
  • delete a tab

The official Google Docs API supports all three via documents.batchUpdate requests:

  • addDocumentTab
  • updateDocumentTabProperties
  • deleteTab

Implementation notes

  • Reuses the existing Docs service and tab-resolution helpers/patterns.
  • rename-tab and delete-tab resolve --tab by title or tab ID.
  • add-tab optionally resolves --parent-tab by title or tab ID.
  • delete-tab uses the existing destructive confirmation flow.
  • JSON output includes the affected tab metadata when available.

Files changed

  • internal/cmd/docs.go
  • internal/cmd/docs_tab_manage.go
  • internal/cmd/docs_tab_manage_test.go

Test coverage added

New tests cover:

  • add / rename / delete tab request generation
  • tab resolution by title
  • not-found failures for rename/delete

Caveat

This patch was prepared in a constrained environment without go, gofmt, or gh installed, so I could not run the normal local validation (make fmt, make test, make ci) before opening the PR.

References

Official Google Docs API references used for this change:

@chopenhauer
Copy link
Copy Markdown
Contributor Author

A bit more context on the motivation here:

I’m an OpenClaw user, and this came from a real workflow gap we hit while automating Google Docs from an agent environment.

gog docs already gave us most of what we needed:

  • list tabs
  • read tabs
  • write to an existing tab
  • manage comments

But in practice we still got stuck on the missing tab lifecycle operations:

  • create a new tab
  • rename a tab
  • delete a tab

That forced awkward workarounds exactly at the point where the CLI was otherwise close to being a complete automation surface for Docs.

Before opening this, we checked the official Google Docs API and confirmed these operations are already supported upstream through documents.batchUpdate:

  • addDocumentTab
  • updateDocumentTabProperties
  • deleteTab

So this PR is really about closing that last gap and making the existing tab support fully usable for automation.

This is especially useful for agent-driven document workflows where a tool needs to:

  • create a structured multi-tab doc
  • label tabs predictably
  • fill them programmatically
  • clean up or reorganize them later

Also, as an OpenClaw user, it felt especially worth contributing back here because gog is already a key part of making these workflows practical.

Thanks for building it. It’s been genuinely useful.

@steipete
Copy link
Copy Markdown
Collaborator

steipete commented May 4, 2026

Thanks for the PR. Docs tab lifecycle commands are already on main as part of 6867fe8 (feat(docs): add tab-aware editing fixes), including docs add-tab, docs rename-tab, docs delete-tab, docs, changelog credit, and tests.

The PR is now conflicting against current main, so I am closing it as superseded rather than asking you to rebase duplicate work. Attribution is preserved in the changelog.

@steipete steipete closed this May 4, 2026
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