Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.35.1 - Unreleased

- Gmail: add draft-only reply, reply-all, and forward workflows with shared send-side composition, no-send compatibility, and address-aware recipient validation. (#977) — thanks @malob.
- Safety: allow custom baked profiles to lock boolean CLI flags against command-line, environment, and config overrides without echoing the locked value in override errors. (#976) — thanks @ronny-rentner.
- Auth: offer one-time re-authorization for expired or revoked stored OAuth refresh tokens after interactive confirmation, while preserving non-interactive recovery guidance. (#973) — thanks @inamiy.
- Dependencies: update Kong, Google protobuf/genproto, Cloudflare Workers types, and pnpm to their latest releases.
Expand Down
5 changes: 4 additions & 1 deletion docs/commands.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,14 @@ Generated from `gog schema --json`.
- [`gog gmail (mail,email) drafts (draft) <command>`](commands/gog-gmail-drafts.md) - Draft operations
- [`gog gmail (mail,email) drafts (draft) create (add,new) [flags]`](commands/gog-gmail-drafts-create.md) - Create a draft
- [`gog gmail (mail,email) drafts (draft) delete (rm,del,remove) <draftId>`](commands/gog-gmail-drafts-delete.md) - Permanently delete a draft (not recoverable; drafts are not moved to Trash)
- [`gog gmail (mail,email) drafts (draft) forward (fwd) <messageId> [flags]`](commands/gog-gmail-drafts-forward.md) - Save a forward as a draft
- [`gog gmail (mail,email) drafts (draft) get (info,show) <draftId> [flags]`](commands/gog-gmail-drafts-get.md) - Get draft details
- [`gog gmail (mail,email) drafts (draft) list (ls) [flags]`](commands/gog-gmail-drafts-list.md) - List drafts
- [`gog gmail (mail,email) drafts (draft) reply <messageId> [flags]`](commands/gog-gmail-drafts-reply.md) - Save a reply as a draft
- [`gog gmail (mail,email) drafts (draft) reply-all (replyall) <messageId> [flags]`](commands/gog-gmail-drafts-reply-all.md) - Save a reply-all as a draft
- [`gog gmail (mail,email) drafts (draft) send (post) <draftId>`](commands/gog-gmail-drafts-send.md) - Send a draft
- [`gog gmail (mail,email) drafts (draft) update (edit,set) <draftId> [flags]`](commands/gog-gmail-drafts-update.md) - Update a draft
- [`gog gmail (mail,email) forward (fwd) --to=STRING <messageId> [flags]`](commands/gog-gmail-forward.md) - Forward a message to new recipients
- [`gog gmail (mail,email) forward (fwd) <messageId> [flags]`](commands/gog-gmail-forward.md) - Forward a message to new recipients
- [`gog gmail (mail,email) get (info,show) <messageId> [flags]`](commands/gog-gmail-get.md) - Get a message (full|metadata|raw)
- [`gog gmail (mail,email) history [flags]`](commands/gog-gmail-history.md) - Gmail history
- [`gog gmail (mail,email) import <file> [flags]`](commands/gog-gmail-import.md) - Import an RFC822/EML message into Gmail
Expand Down
5 changes: 4 additions & 1 deletion docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Every `gog` command has a generated docs page. The source of truth is the live CLI schema; run `make docs-commands` after changing command names, flags, help text, aliases, or arguments.

Generated pages: 709.
Generated pages: 712.

## Top-level Commands

Expand Down Expand Up @@ -456,8 +456,11 @@ Generated pages: 709.
- [gog gmail drafts](gog-gmail-drafts.md) - Draft operations
- [gog gmail drafts create](gog-gmail-drafts-create.md) - Create a draft
- [gog gmail drafts delete](gog-gmail-drafts-delete.md) - Permanently delete a draft (not recoverable; drafts are not moved to Trash)
- [gog gmail drafts forward](gog-gmail-drafts-forward.md) - Save a forward as a draft
- [gog gmail drafts get](gog-gmail-drafts-get.md) - Get draft details
- [gog gmail drafts list](gog-gmail-drafts-list.md) - List drafts
- [gog gmail drafts reply](gog-gmail-drafts-reply.md) - Save a reply as a draft
- [gog gmail drafts reply-all](gog-gmail-drafts-reply-all.md) - Save a reply-all as a draft
- [gog gmail drafts send](gog-gmail-drafts-send.md) - Send a draft
- [gog gmail drafts update](gog-gmail-drafts-update.md) - Update a draft
- [gog gmail forward](gog-gmail-forward.md) - Forward a message to new recipients
Expand Down
53 changes: 53 additions & 0 deletions docs/commands/gog-gmail-drafts-forward.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# `gog gmail drafts forward`

> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.

Save a forward as a draft

## Usage

```bash
gog gmail (mail,email) drafts (draft) forward (fwd) <messageId> [flags]
```

## Parent

- [gog gmail drafts](gog-gmail-drafts.md)

## Flags

| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
| `--bcc` | `string` | | BCC recipients (comma-separated) |
| `--cc` | `string` | | CC recipients (comma-separated) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
| `--from` | `string` | | Send from this email address (must be a verified send-as alias) |
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
| `--note`<br>`--intro` | `string` | | Introductory text above the forwarded message |
| `--note-file` | `string` | | Note file path (plain text; '-' for stdin) |
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
| `--readonly` | `bool` | false | Block mutating API requests at runtime; auth add also requests read-only OAuth scopes |
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
| `--skip-attachments` | `bool` | | Do not include original attachments |
| `--to` | `string` | | Recipients (comma-separated; required when sending, optional when saving a draft) |
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
| `--version` | `kong.VersionFlag` | | Print version and exit |
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |

## See Also

- [gog gmail drafts](gog-gmail-drafts.md)
- [Command index](README.md)
62 changes: 62 additions & 0 deletions docs/commands/gog-gmail-drafts-reply-all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# `gog gmail drafts reply-all`

> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.

Save a reply-all as a draft

## Usage

```bash
gog gmail (mail,email) drafts (draft) reply-all (replyall) <messageId> [flags]
```

## Parent

- [gog gmail drafts](gog-gmail-drafts.md)

## Flags

| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
| `--attach` | `[]string` | | Attachment file path (repeatable) |
| `--auto-from-addressed-alias` | `bool` | | When --from is omitted, reply from the verified send-as alias addressed by the original message |
| `--bcc` | `[]string` | | Add or move recipients to Bcc (repeatable) |
| `--body` | `string` | | Body (plain text; required unless --body-html is set) |
| `--body-file` | `string` | | Body file path (plain text; '-' for stdin) |
| `--body-html` | `string` | | Body (HTML; optional) |
| `--body-html-file` | `string` | | HTML body file path ('-' for stdin) |
| `--cc` | `[]string` | | Add or move recipients to Cc (repeatable) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
| `--from` | `string` | | Send from this email address (must be a verified send-as alias) |
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
| `--no-quote` | `bool` | | Do not include the original message below the reply |
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
| `--readonly` | `bool` | false | Block mutating API requests at runtime; auth add also requests read-only OAuth scopes |
| `--remove` | `[]string` | | Remove recipients from all fields (repeatable) |
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
| `--signature` | `bool` | | Append the Gmail signature from the active send-as address |
| `--signature-file` | `string` | | Append a local signature file (plain text or HTML) |
| `--signature-from` | `string` | | Append the Gmail signature from this send-as email address |
| `--subject` | `string` | | Override reply subject (a changed subject starts a new Gmail thread) |
| `--to` | `[]string` | | Add or move recipients to To (repeatable) |
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
| `--version` | `kong.VersionFlag` | | Print version and exit |
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |

## See Also

- [gog gmail drafts](gog-gmail-drafts.md)
- [Command index](README.md)
62 changes: 62 additions & 0 deletions docs/commands/gog-gmail-drafts-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# `gog gmail drafts reply`

> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.

Save a reply as a draft

## Usage

```bash
gog gmail (mail,email) drafts (draft) reply <messageId> [flags]
```

## Parent

- [gog gmail drafts](gog-gmail-drafts.md)

## Flags

| Flag | Type | Default | Help |
| --- | --- | --- | --- |
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
| `--attach` | `[]string` | | Attachment file path (repeatable) |
| `--auto-from-addressed-alias` | `bool` | | When --from is omitted, reply from the verified send-as alias addressed by the original message |
| `--bcc` | `[]string` | | Add or move recipients to Bcc (repeatable) |
| `--body` | `string` | | Body (plain text; required unless --body-html is set) |
| `--body-file` | `string` | | Body file path (plain text; '-' for stdin) |
| `--body-html` | `string` | | Body (HTML; optional) |
| `--body-html-file` | `string` | | HTML body file path ('-' for stdin) |
| `--cc` | `[]string` | | Add or move recipients to Cc (repeatable) |
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
| `--color` | `string` | auto | Color output: auto\|always\|never |
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
| `--from` | `string` | | Send from this email address (must be a verified send-as alias) |
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
| `--no-quote` | `bool` | | Do not include the original message below the reply |
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
| `--readonly` | `bool` | false | Block mutating API requests at runtime; auth add also requests read-only OAuth scopes |
| `--remove` | `[]string` | | Remove recipients from all fields (repeatable) |
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
| `--signature` | `bool` | | Append the Gmail signature from the active send-as address |
| `--signature-file` | `string` | | Append a local signature file (plain text or HTML) |
| `--signature-from` | `string` | | Append the Gmail signature from this send-as email address |
| `--subject` | `string` | | Override reply subject (a changed subject starts a new Gmail thread) |
| `--to` | `[]string` | | Add or move recipients to To (repeatable) |
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
| `--version` | `kong.VersionFlag` | | Print version and exit |
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |

## See Also

- [gog gmail drafts](gog-gmail-drafts.md)
- [Command index](README.md)
3 changes: 3 additions & 0 deletions docs/commands/gog-gmail-drafts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ gog gmail (mail,email) drafts (draft) <command>

- [gog gmail drafts create](gog-gmail-drafts-create.md) - Create a draft
- [gog gmail drafts delete](gog-gmail-drafts-delete.md) - Permanently delete a draft (not recoverable; drafts are not moved to Trash)
- [gog gmail drafts forward](gog-gmail-drafts-forward.md) - Save a forward as a draft
- [gog gmail drafts get](gog-gmail-drafts-get.md) - Get draft details
- [gog gmail drafts list](gog-gmail-drafts-list.md) - List drafts
- [gog gmail drafts reply](gog-gmail-drafts-reply.md) - Save a reply as a draft
- [gog gmail drafts reply-all](gog-gmail-drafts-reply-all.md) - Save a reply-all as a draft
- [gog gmail drafts send](gog-gmail-drafts-send.md) - Send a draft
- [gog gmail drafts update](gog-gmail-drafts-update.md) - Update a draft

Expand Down
4 changes: 2 additions & 2 deletions docs/commands/gog-gmail-forward.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Forward a message to new recipients
## Usage

```bash
gog gmail (mail,email) forward (fwd) --to=STRING <messageId> [flags]
gog gmail (mail,email) forward (fwd) <messageId> [flags]
```

## Parent
Expand Down Expand Up @@ -42,7 +42,7 @@ gog gmail (mail,email) forward (fwd) --to=STRING <messageId> [flags]
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
| `--skip-attachments` | `bool` | | Do not include original attachments |
| `--to` | `string` | | Recipients (comma-separated; required) |
| `--to` | `string` | | Recipients (comma-separated; required when sending, optional when saving a draft) |
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
| `--version` | `kong.VersionFlag` | | Print version and exit |
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |
Expand Down
28 changes: 26 additions & 2 deletions docs/gmail-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,29 @@ An explicit `--subject` override is supported. A changed subject cannot meet
Gmail's thread-matching requirement, so gog keeps the RFC reply headers but
does not force the original `threadId`; Gmail creates a new conversation.

To stage a reply for review instead of sending it, use the draft-side
counterparts. They accept the same flags and build the same message; only the
finalize step differs (the draft is saved, not sent), so they work under
no-send guardrails:

```bash
gog gmail drafts reply <messageId> --body-file reply.txt
gog gmail drafts reply-all <messageId> --body "Thanks all"
```

## Forward

`gog gmail forward` sends a message on with a `Fwd:` subject, a Gmail-style
forwarded-message block, and the original attachments (skip them with
`--skip-attachments`). `gog gmail drafts forward` saves the same composition
as a draft instead; unlike the send side it does not require `--to`, matching
Gmail's UI, which allows an addressless forward draft:

```bash
gog gmail forward <messageId> --to colleague@example.com --note "FYI"
gog gmail drafts forward <messageId> --note "FYI"
```

Remote HTTP images remain remote references. Only MIME parts referenced with
`cid:` are copied into the outgoing message.

Expand All @@ -142,8 +165,9 @@ Official behavior references:

## Attachment Confirmation

`gmail send --json` and `gmail drafts create|update --json` include an
`attachments` array when the resulting message contains attachments:
`gmail send --json`, `gmail drafts create|update --json`, and
`gmail drafts reply|reply-all --json` include an `attachments` array when the
resulting message contains attachments:

```json
{"attachments":[{"filename":"report.pdf","size":2411233}]}
Expand Down
Loading