Commit Graph

20 Commits

Author SHA1 Message Date
salmonumbrella
07ffcb5d84
fix(paths): expand ~ in user-provided file paths (#56)
* fix(paths): expand ~ in user-provided file paths

When users specify paths with ~ (e.g., --out ~/Downloads/file.pdf) and
the path is quoted in the shell command, the tilde is not expanded by
the shell. This caused files to be written to a literal ~/Downloads
directory instead of the user's home directory.

Add config.ExpandPath() function that expands ~ at the beginning of
paths to the user's home directory. Apply this fix to all user-provided
file paths across:

- gmail attachment download (--out)
- drive download/export (--out)
- drive upload (localPath argument)
- auth token export (--out)
- auth credentials/import/keep (input paths)
- gmail thread attachments (--out-dir)
- gmail send/drafts (--attach)

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

* fix(lint): address wrapcheck and wsl issues

* fix(calendar): support ISO 8601 time format and add 'list' alias

- Add parsing for ISO 8601 datetime with numeric timezone without colon
  (e.g., 2026-01-09T16:38:41-0800), which is the format produced by
  macOS `date +%Y-%m-%dT%H:%M:%S%z`
- Add 'list' as an alias for 'events' subcommand for more intuitive CLI
  usage (gog calendar list instead of gog calendar events)

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

* chore(changelog): note PR #56

* chore(lint): dedupe file string

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-10 02:19:30 +00:00
Anton Sotkov
edb8200cc1 fix(gmail): normalize MIME types in multipart bodies
Body extraction compared exact MIME types; parts often include params like
"text/plain; charset=utf-8", so multipart/alternative returned empty body
(null in JSON). Normalize MIME types (lowercase/trim/strip params) so
plain/html parts are found, preferring plain text. Also accept padded
base64url defensively.
2026-01-09 01:11:01 +01:00
Peter Steinberger
80a784e074 feat(cli): add --output/--output-dir aliases 2026-01-08 12:08:42 +01:00
Peter Steinberger
de72b27dd8 feat(cli): add output flag aliases 2026-01-08 10:29:35 +01:00
Peter Steinberger
6021818391 feat(gmail): surface list-unsubscribe links 2026-01-08 03:55:17 +01:00
salmonumbrella
524f198d3d
feat(gmail): add --full to thread get
- Add --full to show complete thread message bodies\n- Default output truncates previews (500 runes) with a hint\n\nThanks @salmonumbrella.
2026-01-07 18:49:53 +00:00
salmonumbrella
72f251f729
feat(gmail): add thread attachments command (#27)
* feat(gmail): add thread attachments command

Adds `gog gmail thread attachments <threadId>` command that lists all
attachments in an email thread with human-readable sizes.

Features:
- Lists attachments across all messages in a thread
- Shows filename, size (human-readable), and MIME type
- Optional --download flag to download all attachments
- Optional --out-dir to specify download directory
- Supports both JSON and text output formats

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* feat(auth): check keychain before token import

Add pre-flight keychain accessibility check to AuthTokensImportCmd.Run
to fail early if the keychain is locked, rather than after the user has
already completed the import process.

Also adds the EnsureKeychainAccess function to the secrets package which
performs a write/delete test to verify keychain accessibility on macOS.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* style: group const declarations for gofumpt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix: address lint issues in store.go

- Wrap keychain access error for wrapcheck linter
- Add blank lines before returns for wsl linter
- Define static error for err113 linter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* feat(cli): add mail and email aliases for gmail command

Enables `gog mail` and `gog email` as shortcuts for `gog gmail`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* feat(gmail): add flattened headers to gmail get JSON output

Add a headers map with common email headers (from, to, cc, bcc, subject,
date) to the JSON output of `gog gmail get`. This makes header extraction
much simpler:

  # Before (error-prone due to jq operator precedence)
  jq '.message.payload.headers[] | select(.name == "To") | .value'

  # After
  jq '.headers.to'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* fix(gmail): include inline attachments

* fix(secrets): dedupe keychain helpers

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-05 02:26:42 +00:00
Peter Steinberger
716106da4f feat(gmail): support thread-id replies 2026-01-03 13:03:27 +01:00
salmonumbrella
0866dae212 fix(gmail): improve thread display with message count and HTML stripping
- Add message count header ("Thread contains N message(s)") so users
  know upfront how many messages to expect
- Add clear message separators with position (=== Message 1/8: id ===)
- Strip HTML <script> and <style> blocks before removing tags
- Use rune-based truncation to avoid breaking multi-byte UTF-8 chars
- Truncate long message bodies to 500 chars for cleaner output
- Add comprehensive unit tests for stripHTMLTags function

Fixes issue where threads with many messages or HTML content would
produce overwhelming output that could get truncated.
2026-01-03 13:02:59 +01:00
Peter Steinberger
3c1afc6caf chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00
Peter Steinberger
e616a5b733 chore: tighten lint rules 2025-12-31 17:51:45 +01:00
Peter Steinberger
4252ad53f4 refactor(cli): migrate to kong 2025-12-31 17:24:31 +01:00
Peter Steinberger
e70b576dc9 fix: refine gmail thread modify command 2025-12-31 13:10:16 +01:00
Alex Hillman
804db7e5b6 Add thread modify command for batch label operations
This adds a new `gmail thread modify` subcommand that uses the Gmail API's
Threads.Modify endpoint to apply label changes to all messages in a thread
at once.

Usage:
  gog gmail thread modify <threadId> --add "Label1,Label2" --remove "Label3"

Features:
- Resolves label names to IDs automatically
- Supports both adding and removing labels in a single operation
- JSON output mode for programmatic use

BREAKING CHANGE: The `gmail thread` command is now a parent command with
subcommands. Use `gmail thread get <id>` instead of `gmail thread <id>`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 13:09:26 +01:00
Peter Steinberger
f158aa7ebf fix(gmail): thread attachment downloads 2025-12-26 21:34:08 +01:00
salmonumbrella
e7fae164f4
feat: add context propagation, security fixes, and new features
Drive:
- Add context propagation to all API calls
- Add path traversal security fix in download

Gmail:
- Add context propagation to labels and thread commands
- Simplify MIME building (remove unused ReplyTo, BodyHTML)
- Add --from flag for send-as aliases in send and drafts
- Simplify base64 decoding
- Add path traversal security fix in attachments

Calendar:
- Add needsAction status support to respond command
- Add --comment flag for response comments
- Add organizer check to prevent self-response

Auth:
- Add browser-based account management command (auth manage)
- Add web UI for managing connected accounts

Maintenance:
- Update golangci-lint config for v2 compatibility
2025-12-24 19:14:01 -08:00
Peter Steinberger
230f800ea7 fix(gmail): harden base64url decoding 2025-12-24 18:01:59 +01:00
Shane Lindsay
cff98b2e07 fix(gmail): decode base64url attachments 2025-12-24 18:00:55 +01:00
Peter Steinberger
0ebd388875 test: cover gmail + contacts via Execute 2025-12-12 16:51:01 +00:00
Peter Steinberger
bfbc6e4323 Unify Google CLI with auth, services, and CI 2025-12-12 14:18:38 +00:00