Skip to content

feat(docs): read-only surface for suggested edits (tracked changes) — docs suggestions list / --suggestions #876

Description

@sebsnyk

What I'm trying to do

Read the pending suggested edits (tracked changes) on a Google Doc from the CLI — the per-run inserted/deleted text a reviewer has proposed but not yet accepted — so a caller can see "what is being suggested on this doc" without opening it in the browser.

Gap (confirmed in CLI + source, v0.30.0)

There is no surface for Docs suggestions:

  • gog docs --help, gog docs cat --help expose no --suggestions flag and no suggestions subcommand. The DocsCmd struct in internal/cmd/docs.go has no suggestions command.
  • No Documents.Get call sets SuggestionsViewModegrep -rn "SuggestionsViewMode(" returns nothing. docs raw (the lossless dumper) calls svc.Documents.Get(id) without .SuggestionsViewMode("SUGGESTIONS_INLINE"), so it returns the default view, where per-run suggestedInsertionIds / suggestedDeletionIds are not reliably populated. The struct field is only copied through in projectRawDocumentTab (SuggestionsViewMode: doc.SuggestionsViewMode), never set on the request.
  • Nothing renders suggestedInsertionIds / suggestedDeletionIds / suggestedTextStyleChangesgrep -rn "SuggestedInsertionIds\|SuggestedDeletionIds" (excluding tests) returns nothing.

So today there is no way, raw or rendered, to reliably get a doc's pending suggestions out of gog.

Why this is feasible (Docs API)

The Docs REST API supports reading suggestions. documents.get accepts a suggestionsViewMode query parameter; with SUGGESTIONS_INLINE the response carries per-TextRun suggestedInsertionIds and suggestedDeletionIds, plus document-level suggestedDocumentStyleChanges / suggestedNamedStylesChanges and per-element style-change maps. Ref: https://developers.google.com/docs/api/reference/rest/v1/documents/get and the view-mode docs at https://developers.google.com/docs/api/reference/rest/v1/documents#Document.SuggestionsViewMode

gog already reaches this exact tree via docs raw; the only missing pieces are (1) setting the view mode on the request and (2) walking the runs to surface the suggested insertions/deletions.

Scope: READ-ONLY (known API ceiling)

Accepting or rejecting suggestions is not in the Docs API — there is no acceptSuggestion / rejectSuggestion request; accept/reject is UI-only. This issue is intentionally read-only surfacing. Please do not scope it to mutation.

Also note this is distinct from comments and from #672:

  • Comments are a Drive-level surface already covered by docs comments / drive comments — a different object from suggestions.
  • Expose Google Docs version history (revisions list/get) for diffing #672 (version-history diffing) is a different mechanism; it asserts suggestion ids are "already accessible" via docs raw, but in practice they aren't, because the view mode is never set. This issue closes that actual gap.

Proposed surface

A read-only command:

gog docs suggestions list <docId> [--tab <title|id>]

For each pending suggestion, print the suggestion id, kind (insertion / deletion), the affected text, and — where the API exposes it (it surfaces suggestion ids; author attribution is limited) — any available range/context. Honour -j/--json for the structured form and -p/--plain (TSV) for scripting.

Optionally, a lighter alternative for parity with existing read paths:

gog docs cat <docId> --suggestions     # inline-mark suggested insertions/deletions in the text output
gog docs raw <docId> --suggestions     # set SuggestionsViewMode=SUGGESTIONS_INLINE on the Get call so ids actually populate

Either way the load-bearing fix is: issue Documents.Get with SuggestionsViewMode=SUGGESTIONS_INLINE and walk body.content[].paragraph.elements[].textRun.{suggestedInsertionIds,suggestedDeletionIds}.

Other Workspace surfaces (scoped out, verified)

Sheets and Slides have no Docs-style suggestions / tracked-changes mode — gog sheets --help and gog slides --help expose nothing, and the underlying Sheets/Slides APIs have no suggestions view-mode equivalent. So this should stay Docs-only and not over-promise a generic "tracked changes" surface.

Version

v0.30.0 (Homebrew 2026-06-22)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions