Commit Graph

17 Commits

Author SHA1 Message Date
Peter Steinberger
896cccc3dc
refactor(gmail): split reply metadata helpers 2026-04-27 10:31:53 +01:00
Peter Steinberger
63cfefe144
fix(gmail): expose reply threading metadata
Co-authored-by: Solomon Neas <srneas@gmail.com>
2026-04-27 10:12:21 +01:00
salmonumbrella
9977c0bedb
fix(gmail/calendar): ISO-2022-JP decoding, cc/bcc headers, calendar selection (#131)
* fix(gmail): decode ISO-2022-JP bodies

* fix(gmail): include cc/bcc in get output

* feat(calendar): allow selecting calendars in events

* test(gmail): add edge case tests for ISO-2022-JP decoding

Add tests for edge cases in ISO-2022-JP body decoding:
- Mixed ASCII and Japanese text (e.g., "Hello こんにちは World")
- Empty content with ISO-2022-JP charset header
- Malformed ISO-2022-JP sequences (graceful degradation)
- Truncated escape sequences

These tests verify the graceful fallback behavior in decodeBodyCharset
which returns original data if decoding fails.

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

* fix(calendar): validate unknown calendar names in resolveCalendarIDs

When a calendar name doesn't match any known calendar (not in bySummary
or byID maps), return an error listing the unrecognized names instead
of treating them as raw calendar IDs which causes cryptic Google API
errors.

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

* fix(calendar): validate unknown and ambiguous calendar name resolutions

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-02-16 06:56:42 +01:00
salmonumbrella
3371e3f3ad
feat(cli): agent ergonomics + gmail watch exclude labels (#201)
* feat(cli): improve agent ergonomics

* fix(cli): address code review findings

- Fix nil pointer dereference in confirmDestructive when flags is nil
- Deduplicate dry-run logic by delegating to dryRunExit
- Remove deprecated net.Error.Temporary() call (dead since Go 1.18)
- Add unit tests for resolveTasklistID and resolveCalendarID

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

* fix: resolve PR #201 conflicts and follow-ups (#201) (thanks @salmonumbrella)

* fix: resolve rebase fallout for PR #201 landing (#201) (thanks @salmonumbrella)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-02-14 03:09:49 +01:00
Peter Steinberger
0904cdb2c3 refactor(gmail): unify attachment output helpers 2026-01-17 06:34:27 +00:00
Peter Steinberger
59c5f93964 refactor(gmail): centralize attachment output 2026-01-17 06:25:54 +00:00
Peter Steinberger
67eb0d9433 fix: expand gmail get attachment output (#83) (thanks @jeanregisser) 2026-01-17 05:53:30 +00:00
Jean Regisser
1cf147b9d3 refactor(gmail): format attachment output consistently with gog codebase
Use tab-separated format like other gog commands:
  attachment\t<filename>\t<size>\t<mimeType>\t<attachmentId>

This matches the pattern used in calendar_print.go (attendee, attachment)
and drive.go for array data.
2026-01-17 05:47:18 +00:00
Jean Regisser
1b9eabd365 fix(gmail): use camelCase for attachment fields in JSON output
Use camelCase field names (filename, size, mimeType, attachmentId)
to be consistent with the rest of the JSON output (messageId, labelIds, etc.)
2026-01-17 05:47:18 +00:00
Jean Regisser
a541037c9b feat(gmail): show attachment info in get command output
Display attachment filename, size, MIME type, and attachment_id in both
plain text and JSON output for the 'gmail get' command with --format=full.

This makes it easier to identify and download attachments without needing
to manually parse the message payload structure.

Example plain text output:
  attachments:
    CV-Document.pdf (192123 bytes, application/pdf)
      attachment_id	ANGjdJ...

Example JSON output (new field):
  "attachments": [
    {"Filename": "CV-Document.pdf", "Size": 192123, ...}
  ]
2026-01-17 05:47:18 +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
6021818391 feat(gmail): surface list-unsubscribe links 2026-01-08 03:55:17 +01: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
3c1afc6caf chore: tighten lint rules and fix findings 2025-12-31 19:47:32 +01:00
Peter Steinberger
4252ad53f4 refactor(cli): migrate to kong 2025-12-31 17:24:31 +01:00
Peter Steinberger
18f2a9fd4f feat(cli)!: switch to --json/--plain 2025-12-26 10:15:12 +00:00
Peter Steinberger
7d8e93cdc2 feat(gmail): add message get and attachment download 2025-12-17 21:24:51 +01:00