Skip to content

feat(docs): add tab support and editing commands (write, insert, delete, find-replace)#225

Merged
steipete merged 3 commits intoopenclaw:mainfrom
alexknowshtml:feature/docs-tabs
Feb 14, 2026
Merged

feat(docs): add tab support and editing commands (write, insert, delete, find-replace)#225
steipete merged 3 commits intoopenclaw:mainfrom
alexknowshtml:feature/docs-tabs

Conversation

@alexknowshtml
Copy link
Copy Markdown
Contributor

@alexknowshtml alexknowshtml commented Feb 11, 2026

Summary

Adds support for Google Docs tabs (multi-tab documents) and document editing commands.

Tab support

  • docs list-tabs <docId> — List all tabs with ID, title, and index
  • docs cat <docId> --all-tabs — Print all tabs with === Tab: <title> === headers
  • docs cat <docId> --tab <title|id> — Print a specific tab by title or tab ID

Document editing commands

  • docs write <docId> [content] — Write/append content to a doc (supports --replace, --file, --markdown)
  • docs insert <docId> [content] — Insert text at a specific character --index
  • docs delete <docId> — Delete text range with --start/--end
  • docs find-replace <docId> <find> <replace> — Find and replace with optional --match-case

Key behaviors

  • Default docs cat (no flags) is fully backward compatible — no API behavior changes
  • Tab lookup supports exact ID match (t.abc123) and case-insensitive title match ("My Tab")
  • Nested/child tabs are flattened and included in all operations
  • JSON output (--json) supported for all tab and editing operations
  • Uses the Docs API IncludeTabsContent(true) parameter only when tab flags are specified
  • Write supports content from argument, --file, or stdin
  • Markdown mode (--markdown --replace) uses Drive API for native format conversion

Example usage

# List tabs in a document
gog docs list-tabs 1QHIRX8hGeiWiaN...

# Read all tabs
gog docs cat 1QHIRX8hGeiWiaN... --all-tabs

# Read a specific tab by title
gog docs cat 1QHIRX8hGeiWiaN... --tab "Planning"

# Append text to a document
gog docs write 1QHIRX8hGeiWiaN... "Hello, world!"

# Replace document content with markdown
gog docs write 1QHIRX8hGeiWiaN... --file content.md --markdown --replace

# Insert text at the beginning
gog docs insert 1QHIRX8hGeiWiaN... --index 1 "Prepended text"

# Delete a range
gog docs delete 1QHIRX8hGeiWiaN... --start 10 --end 50

# Find and replace
gog docs find-replace 1QHIRX8hGeiWiaN... "TODO" "DONE" --match-case

Closes #125

Test plan

  • 12 new tests covering all tab operations
  • Backward compatibility test: default cat does NOT send includeTabsContent
  • --tab/--all-tabs sends includeTabsContent=true
  • Tab-by-title (case-insensitive) and tab-by-ID lookup
  • Nested child tabs flattened correctly
  • JSON output for --tab, --all-tabs, and list-tabs
  • Tab-not-found error handling
  • Full test suite passes (all existing tests unaffected)
  • Lint passes clean (0 issues)

🤖 Generated with Claude Code

@alexknowshtml alexknowshtml changed the title feat(docs): add tab support for Google Docs feat(docs): add tab support and editing commands (write, insert, delete, find-replace) Feb 11, 2026
alexknowshtml and others added 3 commits February 14, 2026 01:58
Add support for Google Docs tabs (multi-tab documents):

- `docs list-tabs <docId>`: List all tabs with ID, title, and index
- `docs cat <docId> --all-tabs`: Print all tabs with headers
- `docs cat <docId> --tab <title|id>`: Print a specific tab by title or ID

Key behaviors:
- Default `docs cat` (no flags) is fully backward compatible
- Tab lookup supports both exact ID match and case-insensitive title match
- Nested/child tabs are flattened and included in all operations
- JSON output supported for all tab operations

Uses the Google Docs API `includeTabsContent` parameter to retrieve
tab-aware document content via `Document.Tabs`.

Closes openclaw#125

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port custom editing commands from fork to upstream architecture:
- write: append or replace doc content (plain text or markdown)
- insert: insert text at specific character index
- delete: delete text range by start/end index
- find-replace: find and replace text with optional case matching

Also fix lint issues: err shadow in tab support code, goconst for
string literal "true".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete steipete merged commit 2f51319 into openclaw:main Feb 14, 2026
4 checks passed
@steipete
Copy link
Copy Markdown
Collaborator

Landed via temp rebase onto main.

Thanks @alexknowshtml!

@alexknowshtml
Copy link
Copy Markdown
Contributor Author

Happy I can contribute, to use this thing every day now!

klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
…te, find-replace) (openclaw#225)

* feat(docs): add tab support for Google Docs

Add support for Google Docs tabs (multi-tab documents):

- `docs list-tabs <docId>`: List all tabs with ID, title, and index
- `docs cat <docId> --all-tabs`: Print all tabs with headers
- `docs cat <docId> --tab <title|id>`: Print a specific tab by title or ID

Key behaviors:
- Default `docs cat` (no flags) is fully backward compatible
- Tab lookup supports both exact ID match and case-insensitive title match
- Nested/child tabs are flattened and included in all operations
- JSON output supported for all tab operations

Uses the Google Docs API `includeTabsContent` parameter to retrieve
tab-aware document content via `Document.Tabs`.

Closes openclaw#125

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(docs): add write, insert, delete, find-replace commands

Port custom editing commands from fork to upstream architecture:
- write: append or replace doc content (plain text or markdown)
- insert: insert text at specific character index
- delete: delete text range by start/end index
- find-replace: find and replace text with optional case matching

Also fix lint issues: err shadow in tab support code, goconst for
string literal "true".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(docs): harden tab/write paths and add editing regressions (openclaw#225) (thanks @alexknowshtml)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
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.

feature request - support google docs tabs

2 participants