feat: add docs comments subcommand for managing Google Doc comments#263
Merged
steipete merged 3 commits intosteipete:mainfrom Feb 14, 2026
Merged
feat: add docs comments subcommand for managing Google Doc comments#263steipete merged 3 commits intosteipete:mainfrom
docs comments subcommand for managing Google Doc comments#263steipete merged 3 commits intosteipete:mainfrom
Conversation
Add a full `gog docs comments` command tree that provides a doc-centric interface for managing comments on Google Docs via the Drive API v3 comments endpoint. Subcommands: list - List comments (filters resolved by default, --include-resolved to show all) get - Get a single comment with full details including replies add - Add a comment, optionally anchored to quoted text reply - Reply to a comment resolve - Resolve a comment (mark as done), with optional message delete - Delete a comment Key differences from `drive comments`: - `list` filters resolved comments by default (--include-resolved to include) - `list` always shows quoted text column (no separate flag needed) - `resolve` subcommand (drive comments has no equivalent) - Accepts Google Doc URLs in addition to bare IDs (via normalizeGoogleID) - Doc-centric naming and help text Follows existing patterns: uses shared helpers (collectAllPages, tableWriter, formatDateTime, truncateString, normalizeGoogleID, failEmptyExit, dryRunExit, confirmDestructive), same auth/token flow, consistent output formatting.
c3832a1 to
09dba05
Compare
docs comments subcommanddocs comments subcommand for managing Google Doc comments
Owner
|
Landed (squash) onto main. Thanks @alextnetto! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When working with Google Docs through
gog, there's no way to interact with comments from thedocscommand tree. Whilegog drive commentsexists with full CRUD support, it's not discoverable when you're in agog docsworkflow, and it lacks some doc-specific conveniences like filtering resolved comments by default.This PR adds
gog docs commentsas a doc-centric interface for managing comments, following the same pattern asdocs exportanddocs copywhich delegate to Drive API functionality.What's New
A full
gog docs commentscommand tree with 6 subcommands:Key differences from
drive commentsdrive comments listdocs comments list--include-quoteddocs comments resolvenormalizeGoogleIDExample output
Plain text (default):
JSON (
--json):{ "docId": "1BxiMVs0XRA...", "comments": [ { "id": "c1", "author": {"displayName": "Alice"}, "content": "Needs revision", "quotedFileContent": {"value": "The quick brown fox"}, "createdTime": "2025-06-01T10:00:00Z", "resolved": false, "replies": [...] } ], "nextPageToken": "" }Implementation
internal/cmd/docs_comments.go— all 6 subcommandsinternal/cmd/docs_comments_test.go— thorough testsinternal/cmd/docs.go— addedCommentsfield toDocsCmdPatterns followed
collectAllPages,tableWriter,formatDateTime,truncateString,normalizeGoogleID,failEmptyExit,dryRunExit,confirmDestructive--jsonfor machine-readable, tabwriter for human-readable--max,--page,--allusage()patternresolveuses Drive API reply withaction: "resolve"per Google's docsTests
Execute()covering JSON + plain text for all subcommands--include-resolvedfilterOpenCommentsincluding edge cases (nil, all open, all resolved)