Skip to content

feat: Google Docs full API coverage + tab support#140

Merged
omriariav merged 3 commits intomainfrom
feat/docs-tabs
Feb 22, 2026
Merged

feat: Google Docs full API coverage + tab support#140
omriariav merged 3 commits intomainfrom
feat/docs-tabs

Conversation

@omriariav
Copy link
Owner

Summary

  • Tab support across all existing docs commands via persistent --tab flag (ID or title) and --tab-index on read
  • 3 tab management commands: add-tab, delete-tab, rename-tab
  • 25 new API operations: images, table row/col/merge/pin, page/section breaks, headers/footers, named ranges, footnotes, positioned objects, image replacement, doc/section/table style updates
  • Helper functions: flattenTabs, resolveTabID, getTabBody, resolveTabFromFlags
  • Updated buildTextRequests to accept tabID parameter (richformat rejects --tab with clear error)
  • Full test coverage: tab helpers, flag validation, command registration (41 total docs commands)
  • Documentation updated: SKILL.md, commands.md reference, README.md, CLAUDE.md

Closes #139

Test plan

  • go test ./cmd/... -run TestDocs — all tests pass
  • make release-check — fmt/vet/test pass
  • Manual: gws docs info <doc-id> → shows tabs array
  • Manual: gws docs read <doc-id> --tab "Tab 2" → reads specific tab
  • Manual: gws docs add-tab <doc-id> --title "New Tab" → creates tab

🤖 Generated with Claude Code

Add multi-tab support across all docs commands with --tab persistent flag,
plus 28 new API operations: tab management (add/delete/rename), images,
table row/col/merge/pin, page/section breaks, headers/footers, named
ranges, footnotes, object deletion, image replacement, style updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Summary
This PR adds extensive Google Docs tab support plus many new gws docs subcommands (tabs, images, table ops, breaks, headers/footers, named ranges, style updates), along with doc updates and new command/flag tests.

What Looks Good

  • Tab helpers (flattenTabs, resolveTabID, getTabBody) are clear and reused consistently in read/append/insert flows.
  • Cobra registration and flag definitions follow existing patterns and keep defaults sensible.
  • User-facing docs are updated in README.md, skills/docs/SKILL.md, and skills/docs/references/commands.md.

Issues Found

  1. Warning: --column-count is ignored in runDocsUpdateSectionStyle; the code always creates a single ColumnProperties entry, so requesting multiple columns won’t work. Use columnCount to size/initialize the slice (or otherwise apply the requested count).
    cmd/docs.go:2682-2721
  2. Warning: The persistent --tab flag is ignored by several new commands that operate on locations/ranges (table ops, table style updates, and section style). This makes --tab silently ineffective for non-first tabs. Either resolve the tab and set TabId on the relevant Location/Range or explicitly error when --tab is supplied.
    cmd/docs.go:2023-2156
    cmd/docs.go:2682-2790
  3. Warning: Required numeric flags rely on MarkFlagRequired, but int flags default to 0, so omitting them can still send invalid requests. Add explicit validation (e.g., >0, to > from) for new commands like add-named-range, pin-rows, table ops, and add-footnote.
    cmd/docs.go:2023-2058
    cmd/docs.go:2428-2458
    cmd/docs.go:2494-2539
  4. Warning: New commands don’t have httptest-based API mocking coverage (only flag/registration tests were added). Please add HTTP tests in cmd/docs_test.go consistent with existing Docs command tests.
    cmd/docs_test.go

Tests not run (not requested).

If you want, I can help wire tab support into the table/style commands and add the missing httptest coverage.

…n, columnCount

- Wire --tab through table ops (merge/unmerge/pin/insert/delete row/col),
  table style commands (cell style, col properties, row style), and
  section style via TabId on Location
- Fix runDocsUpdateSectionStyle: properly size columnProperties slice
  from --column-count instead of hardcoding single entry
- Add explicit validation: --from >= 1, --to > --from for add-named-range;
  --at >= 1 for add-footnote; --count >= 0 for pin-rows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Summary
This PR adds extensive new gws docs functionality (tab management, table ops, headers/footers, named ranges, style updates, breaks, images) plus tab-aware read/append/insert, and updates docs/skill references and tests for new flags/helpers.

What looks good

  • Cobra command registration and flag wiring are consistent and comprehensive for the new docs subcommands.
  • The tab helper utilities (flattenTabs, resolveTabID, getTabBody) and --tab-index handling are solid and tested.
  • Documentation updates in README.md and skills/docs/* are thorough and in sync with the new commands.

Issues found

Warning

  1. --tab is documented as “Tab ID or title”, but several new commands treat it as a raw Tab ID and do not resolve titles. This will break when users pass a title (API will reject TabId), and it’s inconsistent with other commands that do resolve titles.

    • tableCellLocation explicitly uses the raw value (and even comments that it expects IDs). cmd/docs.go:2023-2035
    • Table ops and styles use raw tabQuery in Location/Range: runDocsUnmergeCells, runDocsPinRows, runDocsUpdateSectionStyle, runDocsUpdateTableCellStyle, runDocsUpdateTableColProperties, runDocsUpdateTableRowStyle. cmd/docs.go:2185-2242, cmd/docs.go:2723-2907
    • runDocsAddNamedRange ignores --tab entirely. cmd/docs.go:2458-2483
      Fix options: resolve --tab to a Tab ID (fetch doc and use resolveTabID) in all commands that accept it, or update the flag help/docs to state that some commands require tab IDs only.
  2. Missing behavior-level tests for new commands. The new commands have flag/unit tests, but there are no new httptest-backed command tests for the API interactions as required by the repo guidelines.

    • Added tests are limited to helpers/flags/command registration. cmd/docs_test.go changes
      Fix: add httptest-based tests in cmd/docs_test.go for the new command handlers, similar to existing docs command tests.

Suggestion

  • Consider validating span/index values (e.g., --row-span, --col-span, --row, --col) to be >0 / >=0 in table-related commands to fail fast with user-friendly errors. This would align with the validation you already do for --from/--to and --at.

If you want, I can outline a minimal test matrix for the new commands to satisfy the httptest requirement.

All table ops (insert/delete row/col, merge/unmerge, pin-rows), style
commands (cell style, col properties, row style, section style), and
add-named-range now use resolveTabQueryToID() to properly resolve tab
titles to IDs via API fetch, consistent with read/append/insert.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

I couldn’t compute the PR diff because there’s no merge base with origin/main in this repo:

  • git diff origin/main...HEADfatal: origin/main...HEAD: no merge base

How should I proceed?

  1. Provide the correct base branch/commit (e.g., origin/your-base or a SHA), and I’ll diff against that.
  2. Paste the PR diff here, and I’ll review just those changes.
  3. If this is a fork without the base branch, tell me the base commit SHA and I’ll run git diff <base-sha>...HEAD.

@omriariav omriariav merged commit e119e7c into main Feb 22, 2026
3 checks passed
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.

gws docs: Add support for reading and writing Google Docs tabs

1 participant