gogcli/internal/googleauth
Gonçalo Alves 7945602f15
feat: add docs update command for editing Google Docs (#219)
* feat: add docs update command for editing Google Docs

* fix: handle document content range correctly for replace

* docs: add Jarbas avatar

* feat(gogcli): add markdown formatting support for Google Docs

Phase 1 & 2 complete:
- Markdown parser supporting headings, lists, code blocks, blockquotes, links
- Google Docs API integration for formatting
- --format markdown flag for docs update command
- Heading styles (H1-H6), horizontal rules, list indentation
- Code blocks with monospace font

Pending (Phase 3):
- Inline formatting (bold, italic, inline code) - index calculation issues
- Links - index calculation issues

Usage:
  gog docs update <docId> --content-file ./doc.md --format markdown

* fix(gogcli): fix inline formatting indices in markdown formatter

- Simplified document generation to avoid index calculation errors
- Fixed ParseInlineFormatting to correctly track positions
- Preserves: headings, code blocks, blockquotes, lists, horizontal rules

Pending: inline formatting (bold, italic, code, links) - indices still need work

* fix(gogcli): use UTF-16 code units for Google Docs API indexing

- Fixed markdown formatter to use UTF-16 code units instead of UTF-8 bytes
- Added utf16Len() helper function for accurate character counting
- Fixed inline formatting indices (bold, italic, code, links)
- Added empty line handling (MDEmptyLine)
- Successfully tested with Docker course doc (21KB, emojis, diagrams)

This resolves index mismatch errors caused by multi-byte characters like emojis
which are 4 bytes in UTF-8 but 2 code units in UTF-16.

* feat(gogcli): add slides commands with markdown support

- Add 'gog slides update' command with markdown formatting
- Create slides_formatter.go for Google Slides API batch updates
- Create slides_markdown.go for markdown parsing (titles, bullets, code)
- Add slides.go with update/create/read operations
- Update googleauth service for Slides scope

Related: PR #219

* fix(gogcli): use shapes for slides text boxes instead of direct insertion

- Fixed slides creation to use CreateShape with TEXT_BOX instead of inserting text directly
- Direct text insertion into slides is not supported by Google Slides API
- Added title text box with bold 36pt font
- Added body text box for content (bullets, paragraphs, code)
- Supports markdown formatting (bold, bullets, code blocks)

Tested: Successfully created 20-slide presentation from Docker course outline

* feat: add markdown table support (formatted text output)

* feat: implement native Google Docs table insertion with multi-step API

* feat(slides): add --template flag for creating presentations from templates

* fix: stabilize docs/slides markdown + auth flow (#219) (thanks @goncaloalves)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-02-13 22:52:17 +01:00
..
templates fix(auth): correct gmail search example in success template 2026-01-19 22:01:41 +01:00
accounts_server_more_test.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
accounts_server_test.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
accounts_server.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
manual_state_test.go fix(auth): enforce remote manual auth state (#187) 2026-02-09 10:38:26 -08:00
manual_state.go fix(auth): enforce remote manual auth state (#187) 2026-02-09 10:38:26 -08:00
oauth_flow_authorize_test.go fix(auth): enforce remote manual auth state (#187) 2026-02-09 10:38:26 -08:00
oauth_flow_more_test.go chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00
oauth_flow.go fix(auth): enforce remote manual auth state (#187) 2026-02-09 10:38:26 -08:00
open_browser_test.go chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00
open_browser.go test: cover oauth authorize flow 2025-12-12 16:40:44 +00:00
service_test.go feat: add docs update command for editing Google Docs (#219) 2026-02-13 22:52:17 +01:00
service.go feat: add docs update command for editing Google Docs (#219) 2026-02-13 22:52:17 +01:00
templates_embed_test.go chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00
templates_embed.go refactor(auth): consolidate success templates into one 2025-12-31 13:19:01 +01:00
token_check_test.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
token_check.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
token_email.go feat(auth): add multi-org login 2026-01-22 04:04:14 +00:00
wait_post_success_test.go chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00