gogcli-mcp-gmail 2.26.0 → 2.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +481 -196
- package/manifest.json +1 -1
- package/mint.yaml +1 -1
- package/package.json +2 -2
- package/src/tools/gmail-extra.ts +5 -111
- package/tests/tools/gmail-extra.test.ts +0 -146
package/manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest_version": "0.3",
|
|
4
4
|
"name": "gogcli-mcp-gmail",
|
|
5
5
|
"display_name": "gogcli (Gmail)",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.27.1",
|
|
7
7
|
"description": "Extended Gmail for Claude via gogcli — auth + full Gmail support (threads, labels, drafts, attachments, forward, autoreply, bulk operations)",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
package/mint.yaml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gogcli-mcp-gmail",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.1",
|
|
4
4
|
"mcpName": "io.github.chrischall/gogcli-mcp-gmail",
|
|
5
5
|
"description": "Extended Gmail MCP server via gogcli — auth + full Gmail support (threads, labels, drafts, attachments, forward, autoreply, bulk operations)",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:coverage": "vitest run --coverage"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@chrischall/mcp-utils": "^0.
|
|
27
|
+
"@chrischall/mcp-utils": "^0.17.1",
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
29
29
|
"zod": "^4.4.3"
|
|
30
30
|
},
|
package/src/tools/gmail-extra.ts
CHANGED
|
@@ -2,29 +2,9 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
import { rawTextResult, textResult, errorResult } from '@chrischall/mcp-utils';
|
|
5
|
-
import { accountParam, runOrDiagnose, run, diagnose, payloadArg, runExecutor, normalizeTimestamps, finalizeGmailSearch, fetchGmailPages, pageTokenParam, pageAliasParam, resolvePageToken, attachInlineParam, inlineAttachmentArgs} from '../../../gogcli-mcp/src/lib.js';
|
|
5
|
+
import { accountParam, runOrDiagnose, run, diagnose, payloadArg, runExecutor, normalizeTimestamps, finalizeGmailSearch, fetchGmailPages, pageTokenParam, pageAliasParam, resolvePageToken, attachInlineParam, inlineAttachmentArgs, assertNotBoth, replySchema, appendReplyFlags} from '../../../gogcli-mcp/src/lib.js';
|
|
6
6
|
import type { GogArg, InlineAttachmentInput } from '../../../gogcli-mcp/src/lib.js';
|
|
7
7
|
|
|
8
|
-
// gog rejects an inline flag together with its --*-file twin — `gmail drafts
|
|
9
|
-
// create` errors with "use only one of --body-html or --body-html-file", and
|
|
10
|
-
// `gmail forward` does the same for --note (misreporting it as --body). Catch
|
|
11
|
-
// the conflict here so the caller gets a message naming the TOOL params it
|
|
12
|
-
// actually passed, instead of a gog error naming flags it never saw.
|
|
13
|
-
function assertNotBoth(
|
|
14
|
-
inlineParam: string,
|
|
15
|
-
fileParam: string,
|
|
16
|
-
inlineValue: string | undefined,
|
|
17
|
-
fileValue: string | undefined,
|
|
18
|
-
): void {
|
|
19
|
-
if (inlineValue !== undefined && fileValue !== undefined) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
`${inlineParam} and ${fileParam} are mutually exclusive — gog accepts only one of them. ` +
|
|
22
|
-
`Pass ${inlineParam} with the content itself (it is written to a temp file automatically when large), ` +
|
|
23
|
-
`or ${fileParam} with a path that already exists on the gog server.`,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
8
|
// Pull the text out of a single-text-block tool result; undefined for any
|
|
29
9
|
// other shape (an error result is still a text block, so it parses below).
|
|
30
10
|
function resultText(result: CallToolResult): string | undefined {
|
|
@@ -2889,7 +2869,7 @@ export function registerExtraGmailTools(server: McpServer): void {
|
|
|
2889
2869
|
replyToMessageId: z.string().optional().describe('Reply to a specific Gmail MESSAGE id — the short hex `id` field from gog_gmail_get / _search / _thread_get (e.g. 19e7593d77fd9636), NOT a thread id and NOT the RFC822 `<…@host>` Message-Id header. Anchors In-Reply-To/References to that exact message. To reply to a thread when you don\'t know the latest message, use replyToThreadId instead. If both are given, replyToMessageId wins.'),
|
|
2890
2870
|
replyToThreadId: z.string().optional().describe('Reply to a Gmail THREAD id — passed to gog as --thread-id, which threads the draft using the thread\'s latest-message headers (In-Reply-To/References). This is what "reply to this thread" almost always means. Mutually exclusive with replyToMessageId (which wins if both are set). Thread ids and message ids are both 16-hex strings and easy to confuse — use this param, not replyToMessageId, when the id came from a thread.'),
|
|
2891
2871
|
replyTo: z.string().optional().describe('Reply-To header address'),
|
|
2892
|
-
quote: z.boolean().optional().describe('Include
|
|
2872
|
+
quote: z.boolean().optional().describe('Include the original message quoted below the body. Requires replyToMessageId or replyToThreadId. DEFAULTS OFF: a draft created with a reply target but without this threads correctly and still reads as a brand-new message, because gog only quotes by default on its reply subcommands. For a real reply draft prefer gog_gmail_drafts_reply / gog_gmail_drafts_reply_all, which also inherit the recipients and the "Re:" subject that this tool leaves to you.'),
|
|
2893
2873
|
replyAll: z.boolean().optional().describe('Auto-populate recipients from the original message (reply-all), inferring To/Cc from it. Requires replyToMessageId or replyToThreadId. Explicit to/cc/bcc still apply on top; omitRecipients still suppresses them.'),
|
|
2894
2874
|
attach: z.array(z.string()).optional().describe('File paths to attach (repeatable), resolved ON THE GOG SERVER\'s filesystem — NOT this client\'s. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" — use attachInline there. Read on the server, base64-encoded with a MIME type inferred from the extension. The JSON result echoes attached filenames and byte sizes — check it to confirm the files were found and embedded. On gog_gmail_drafts_update, supplying attach REPLACES the draft\'s existing attachments; omitting it preserves them (use clearAttachments to remove all).'),
|
|
2895
2875
|
attachInline: attachInlineParam,
|
|
@@ -3216,97 +3196,11 @@ export function registerExtraGmailTools(server: McpServer): void {
|
|
|
3216
3196
|
return runOrDiagnose(args, { account });
|
|
3217
3197
|
});
|
|
3218
3198
|
|
|
3219
|
-
// gmail reply / reply-all share an identical flag set (gog 0.27+); they differ
|
|
3220
|
-
// only in the subcommand and default recipient set (reply → sender; reply-all
|
|
3221
|
-
// → every participant). Recipient flags are repeatable on the CLI, so they are
|
|
3222
|
-
// arrays here. --to/--cc/--bcc ADD or MOVE recipients onto the inherited reply
|
|
3223
|
-
// set; --remove drops them. Body/HTML follow the same inline-or-file shape as
|
|
3224
|
-
// the draft tools.
|
|
3225
|
-
const replySchema = {
|
|
3226
|
-
messageId: z.string().describe('Gmail message ID to reply to — the short hex `id` from gog_gmail_get / _search / _messages_search (NOT the threadId, NOT the RFC822 `<…@host>` Message-Id header).'),
|
|
3227
|
-
body: z.string().optional().describe('Reply body (plain text; required unless bodyHtml or bodyHtmlFile is set). Any size — a large body is written to a temp file on the gog server rather than inlined into the command line. Note gog strips trailing newlines from a file-delivered body.'),
|
|
3228
|
-
bodyHtml: z.string().optional().describe('Reply body (HTML; optional). Pass the HTML itself at any size — a large body is written to a temp file on the gog server rather than inlined into the command line. Mutually exclusive with bodyHtmlFile.'),
|
|
3229
|
-
bodyHtmlFile: z.string().optional().describe('Path to an HTML file that ALREADY EXISTS on the gog server for the reply body. gog also accepts "-" for stdin, but this server never writes to gog\'s stdin, so "-" would hang until the call times out. Mutually exclusive with bodyHtml — supplying both is rejected. You rarely need this: bodyHtml handles large bodies on its own.'),
|
|
3230
|
-
to: z.array(z.string()).optional().describe('Add or move recipients to To (repeatable). Added on top of the recipients inherited from the original message.'),
|
|
3231
|
-
cc: z.array(z.string()).optional().describe('Add or move recipients to Cc (repeatable)'),
|
|
3232
|
-
bcc: z.array(z.string()).optional().describe('Add or move recipients to Bcc (repeatable)'),
|
|
3233
|
-
remove: z.array(z.string()).optional().describe('Remove these recipients from all fields (repeatable) — e.g. to drop someone from a reply-all.'),
|
|
3234
|
-
subject: z.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
|
|
3235
|
-
noQuote: z.boolean().optional().describe('Do not include the original message quoted below the reply (default: the original is quoted)'),
|
|
3236
|
-
attach: z.array(z.string()).optional().describe('File paths to attach (repeatable), resolved ON THE GOG SERVER\'s filesystem — NOT this client\'s. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" — use attachInline there. Read on the server, base64-encoded with a MIME type inferred from the extension.'),
|
|
3237
|
-
attachInline: attachInlineParam,
|
|
3238
|
-
from: z.string().optional().describe('Send from this email address (must be a verified send-as alias)'),
|
|
3239
|
-
autoFromAddressedAlias: z.boolean().optional().describe('When from is omitted, send from the verified send-as alias the original message was addressed TO, instead of the account\'s primary address — so a reply to mail sent to an alias goes back out from that alias. Ignored when from is set.'),
|
|
3240
|
-
signature: z.boolean().optional().describe('Append the Gmail signature from the active send-as address'),
|
|
3241
|
-
signatureFrom: z.string().optional().describe('Append the Gmail signature from this send-as email address'),
|
|
3242
|
-
signatureFile: z.string().optional().describe('Append a local signature file (plain text or HTML), read on the gog server'),
|
|
3243
|
-
account: accountParam,
|
|
3244
|
-
};
|
|
3245
|
-
|
|
3246
|
-
type ReplyFlags = {
|
|
3247
|
-
body?: string;
|
|
3248
|
-
bodyHtml?: string;
|
|
3249
|
-
bodyHtmlFile?: string;
|
|
3250
|
-
to?: string[];
|
|
3251
|
-
cc?: string[];
|
|
3252
|
-
bcc?: string[];
|
|
3253
|
-
remove?: string[];
|
|
3254
|
-
subject?: string;
|
|
3255
|
-
noQuote?: boolean;
|
|
3256
|
-
attach?: string[];
|
|
3257
|
-
attachInline?: InlineAttachmentInput[];
|
|
3258
|
-
from?: string;
|
|
3259
|
-
autoFromAddressedAlias?: boolean;
|
|
3260
|
-
signature?: boolean;
|
|
3261
|
-
signatureFrom?: string;
|
|
3262
|
-
signatureFile?: string;
|
|
3263
|
-
};
|
|
3264
|
-
|
|
3265
|
-
function appendReplyFlags(args: GogArg[], f: ReplyFlags): void {
|
|
3266
|
-
assertNotBoth('bodyHtml', 'bodyHtmlFile', f.bodyHtml, f.bodyHtmlFile);
|
|
3267
|
-
if (f.body) args.push(payloadArg('body', 'body-file', f.body));
|
|
3268
|
-
if (f.bodyHtml) args.push(payloadArg('body-html', 'body-html-file', f.bodyHtml, 'html'));
|
|
3269
|
-
else if (f.bodyHtmlFile) args.push(`--body-html-file=${f.bodyHtmlFile}`);
|
|
3270
|
-
if (f.to) for (const r of f.to) args.push(`--to=${r}`);
|
|
3271
|
-
if (f.cc) for (const r of f.cc) args.push(`--cc=${r}`);
|
|
3272
|
-
if (f.bcc) for (const r of f.bcc) args.push(`--bcc=${r}`);
|
|
3273
|
-
if (f.remove) for (const r of f.remove) args.push(`--remove=${r}`);
|
|
3274
|
-
if (f.subject) args.push(`--subject=${f.subject}`);
|
|
3275
|
-
if (f.noQuote) args.push('--no-quote');
|
|
3276
|
-
if (f.attach) for (const p of f.attach) args.push(`--attach=${p}`);
|
|
3277
|
-
args.push(...inlineAttachmentArgs('attach', f.attachInline, args)); // see appendDraftFlags
|
|
3278
|
-
if (f.from) args.push(`--from=${f.from}`);
|
|
3279
|
-
if (f.signature) args.push('--signature');
|
|
3280
|
-
if (f.signatureFrom) args.push(`--signature-from=${f.signatureFrom}`);
|
|
3281
|
-
if (f.signatureFile) args.push(`--signature-file=${f.signatureFile}`);
|
|
3282
|
-
args.push(f.autoFromAddressedAlias ? '--auto-from-addressed-alias' : '--auto-from-addressed-alias=false'); // PINNED — see appendDraftFlags
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
server.registerTool('gog_gmail_reply', {
|
|
3286
|
-
description: 'Reply to a Gmail message (sends to the original sender only). Threads off the message and inherits a "Re:" subject and the quoted original by default. For replying to every participant use gog_gmail_reply_all; to reply across many messages matching a query use gog_gmail_autoreply; to stage this same reply without sending it use gog_gmail_drafts_reply, which composes exactly what this tool would send.',
|
|
3287
|
-
annotations: { destructiveHint: true },
|
|
3288
|
-
inputSchema: replySchema,
|
|
3289
|
-
}, async ({ messageId, account, ...flags }) => {
|
|
3290
|
-
const args: GogArg[] = ['gmail', 'reply', messageId];
|
|
3291
|
-
appendReplyFlags(args, flags);
|
|
3292
|
-
return runOrDiagnose(args, { account });
|
|
3293
|
-
});
|
|
3294
|
-
|
|
3295
|
-
server.registerTool('gog_gmail_reply_all', {
|
|
3296
|
-
description: 'Reply to all participants of a Gmail message (sender plus every To/Cc recipient). Same inherited "Re:" subject and quoting as gog_gmail_reply. Use the remove flag to drop specific recipients from the reply-all. To stage it without sending use gog_gmail_drafts_reply_all.',
|
|
3297
|
-
annotations: { destructiveHint: true },
|
|
3298
|
-
inputSchema: replySchema,
|
|
3299
|
-
}, async ({ messageId, account, ...flags }) => {
|
|
3300
|
-
const args: GogArg[] = ['gmail', 'reply-all', messageId];
|
|
3301
|
-
appendReplyFlags(args, flags);
|
|
3302
|
-
return runOrDiagnose(args, { account });
|
|
3303
|
-
});
|
|
3304
|
-
|
|
3305
3199
|
// gog >= 0.36.0: the draft-side twins of reply / reply-all / forward. They
|
|
3306
3200
|
// take the SAME flag set as the send-side commands and share the composition
|
|
3307
|
-
// path with them, so
|
|
3308
|
-
//
|
|
3309
|
-
// SENT.
|
|
3201
|
+
// path with them, so replySchema/appendReplyFlags are imported from the base
|
|
3202
|
+
// package (where gog_gmail_reply itself now lives) rather than re-declared —
|
|
3203
|
+
// the only difference is the subcommand and that NOTHING IS SENT.
|
|
3310
3204
|
//
|
|
3311
3205
|
// These exist because staging a reply used to mean gog_gmail_drafts_create
|
|
3312
3206
|
// with replyToMessageId/replyToThreadId, which threads the draft but does NOT
|
|
@@ -1742,96 +1742,6 @@ describe('gog_gmail_forward', () => {
|
|
|
1742
1742
|
});
|
|
1743
1743
|
});
|
|
1744
1744
|
|
|
1745
|
-
describe('gog_gmail_reply', () => {
|
|
1746
|
-
it('calls runOrDiagnose with messageId and --body', async () => {
|
|
1747
|
-
await harness.callTool('gog_gmail_reply', { messageId: 'm1', body: 'Thanks' });
|
|
1748
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
1749
|
-
['gmail', 'reply', 'm1', '--body=Thanks', '--auto-from-addressed-alias=false'],
|
|
1750
|
-
{ account: undefined },
|
|
1751
|
-
);
|
|
1752
|
-
});
|
|
1753
|
-
|
|
1754
|
-
it('passes all reply flags including repeatable recipients', async () => {
|
|
1755
|
-
await harness.callTool('gog_gmail_reply', {
|
|
1756
|
-
messageId: 'm1',
|
|
1757
|
-
body: 'Hi',
|
|
1758
|
-
bodyHtml: '<p>Hi</p>',
|
|
1759
|
-
to: ['a@b.com', 'c@d.com'],
|
|
1760
|
-
cc: ['cc@x.com'],
|
|
1761
|
-
bcc: ['bcc@x.com'],
|
|
1762
|
-
remove: ['old@x.com'],
|
|
1763
|
-
subject: 'New subject',
|
|
1764
|
-
noQuote: true,
|
|
1765
|
-
attach: ['/tmp/a.pdf', '/tmp/b.pdf'],
|
|
1766
|
-
from: 'me@x.com',
|
|
1767
|
-
signature: true,
|
|
1768
|
-
signatureFrom: 'alias@x.com',
|
|
1769
|
-
signatureFile: '/tmp/sig.txt',
|
|
1770
|
-
account: 'me@gmail.com',
|
|
1771
|
-
});
|
|
1772
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
1773
|
-
[
|
|
1774
|
-
'gmail', 'reply', 'm1',
|
|
1775
|
-
'--body=Hi',
|
|
1776
|
-
'--body-html=<p>Hi</p>',
|
|
1777
|
-
'--to=a@b.com',
|
|
1778
|
-
'--to=c@d.com',
|
|
1779
|
-
'--cc=cc@x.com',
|
|
1780
|
-
'--bcc=bcc@x.com',
|
|
1781
|
-
'--remove=old@x.com',
|
|
1782
|
-
'--subject=New subject',
|
|
1783
|
-
'--no-quote',
|
|
1784
|
-
'--attach=/tmp/a.pdf',
|
|
1785
|
-
'--attach=/tmp/b.pdf',
|
|
1786
|
-
'--from=me@x.com',
|
|
1787
|
-
'--signature',
|
|
1788
|
-
'--signature-from=alias@x.com',
|
|
1789
|
-
'--signature-file=/tmp/sig.txt', '--auto-from-addressed-alias=false'
|
|
1790
|
-
],
|
|
1791
|
-
{ account: 'me@gmail.com' },
|
|
1792
|
-
);
|
|
1793
|
-
});
|
|
1794
|
-
|
|
1795
|
-
it('omits --no-quote and --signature when false', async () => {
|
|
1796
|
-
await harness.callTool('gog_gmail_reply', { messageId: 'm1', body: 'Hi', noQuote: false, signature: false });
|
|
1797
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
1798
|
-
['gmail', 'reply', 'm1', '--body=Hi', '--auto-from-addressed-alias=false'],
|
|
1799
|
-
{ account: undefined },
|
|
1800
|
-
);
|
|
1801
|
-
});
|
|
1802
|
-
});
|
|
1803
|
-
|
|
1804
|
-
describe('gog_gmail_reply_all', () => {
|
|
1805
|
-
it('uses the reply-all subcommand', async () => {
|
|
1806
|
-
await harness.callTool('gog_gmail_reply_all', { messageId: 'm1', body: 'Thanks all' });
|
|
1807
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
1808
|
-
['gmail', 'reply-all', 'm1', '--body=Thanks all', '--auto-from-addressed-alias=false'],
|
|
1809
|
-
{ account: undefined },
|
|
1810
|
-
);
|
|
1811
|
-
});
|
|
1812
|
-
|
|
1813
|
-
it('passes repeatable recipient and signature flags', async () => {
|
|
1814
|
-
await harness.callTool('gog_gmail_reply_all', {
|
|
1815
|
-
messageId: 'm1',
|
|
1816
|
-
bodyHtml: '<p>Hi</p>',
|
|
1817
|
-
cc: ['x@y.com', 'z@y.com'],
|
|
1818
|
-
remove: ['drop@y.com'],
|
|
1819
|
-
signatureFile: '/tmp/sig.html',
|
|
1820
|
-
});
|
|
1821
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
1822
|
-
[
|
|
1823
|
-
'gmail', 'reply-all', 'm1',
|
|
1824
|
-
'--body-html=<p>Hi</p>',
|
|
1825
|
-
'--cc=x@y.com',
|
|
1826
|
-
'--cc=z@y.com',
|
|
1827
|
-
'--remove=drop@y.com',
|
|
1828
|
-
'--signature-file=/tmp/sig.html', '--auto-from-addressed-alias=false'
|
|
1829
|
-
],
|
|
1830
|
-
{ account: undefined },
|
|
1831
|
-
);
|
|
1832
|
-
});
|
|
1833
|
-
});
|
|
1834
|
-
|
|
1835
1745
|
// gog 0.36.0 (openclaw/gogcli#977) added the draft-side twins of reply /
|
|
1836
1746
|
// reply-all / forward. The point of these tests is the SUBCOMMAND: the flag
|
|
1837
1747
|
// handling is the send path's, shared verbatim, and a copy of it here would
|
|
@@ -2524,24 +2434,6 @@ describe('large payloads route to file args', () => {
|
|
|
2524
2434
|
expect(args()).not.toContain('--thread-id=t1');
|
|
2525
2435
|
});
|
|
2526
2436
|
|
|
2527
|
-
it('gog_gmail_reply routes a large body and bodyHtml to file args', async () => {
|
|
2528
|
-
await harness.callTool('gog_gmail_reply', { messageId: 'm1', body: big, bodyHtml: bigHtml });
|
|
2529
|
-
expect(args()).toEqual([
|
|
2530
|
-
'gmail', 'reply', 'm1',
|
|
2531
|
-
{ kind: 'file', flag: 'body-file', contents: big, ext: undefined },
|
|
2532
|
-
{ kind: 'file', flag: 'body-html-file', contents: bigHtml, ext: 'html' }, '--auto-from-addressed-alias=false'
|
|
2533
|
-
]);
|
|
2534
|
-
});
|
|
2535
|
-
|
|
2536
|
-
it('gog_gmail_reply_all routes a large body to --body-file, leaving the signature boolean a bare flag', async () => {
|
|
2537
|
-
await harness.callTool('gog_gmail_reply_all', { messageId: 'm1', body: big, signature: true });
|
|
2538
|
-
expect(args()).toEqual([
|
|
2539
|
-
'gmail', 'reply-all', 'm1',
|
|
2540
|
-
{ kind: 'file', flag: 'body-file', contents: big, ext: undefined },
|
|
2541
|
-
'--signature', '--auto-from-addressed-alias=false'
|
|
2542
|
-
]);
|
|
2543
|
-
});
|
|
2544
|
-
|
|
2545
2437
|
it('gog_gmail_forward routes a large note to --note-file', async () => {
|
|
2546
2438
|
await harness.callTool('gog_gmail_forward', { messageId: 'm1', to: 'a@b.com', note: big });
|
|
2547
2439
|
expect(args()).toEqual([
|
|
@@ -2587,33 +2479,6 @@ describe('inline/file param conflicts are rejected before gog runs', () => {
|
|
|
2587
2479
|
expect((res.content[0] as { text: string }).text).toContain('mutually exclusive');
|
|
2588
2480
|
expect(lib.runOrDiagnose).not.toHaveBeenCalled();
|
|
2589
2481
|
});
|
|
2590
|
-
|
|
2591
|
-
it('gog_gmail_reply rejects bodyHtml plus bodyHtmlFile', async () => {
|
|
2592
|
-
const res = await harness.callTool('gog_gmail_reply', {
|
|
2593
|
-
messageId: 'm1', bodyHtml: '<p>Hi</p>', bodyHtmlFile: '/tmp/b.html',
|
|
2594
|
-
});
|
|
2595
|
-
expect(res.isError).toBe(true);
|
|
2596
|
-
expect((res.content[0] as { text: string }).text).toContain('bodyHtml and bodyHtmlFile are mutually exclusive');
|
|
2597
|
-
expect(lib.runOrDiagnose).not.toHaveBeenCalled();
|
|
2598
|
-
});
|
|
2599
|
-
|
|
2600
|
-
it('an empty-string bodyHtml still counts as supplied and conflicts', async () => {
|
|
2601
|
-
// Guards the `!== undefined` check against a falsy-but-present value
|
|
2602
|
-
// sliding through to gog, which rejects the pair regardless of content.
|
|
2603
|
-
const res = await harness.callTool('gog_gmail_reply', {
|
|
2604
|
-
messageId: 'm1', body: 'B', bodyHtml: '', bodyHtmlFile: '/tmp/b.html',
|
|
2605
|
-
});
|
|
2606
|
-
expect(res.isError).toBe(true);
|
|
2607
|
-
expect(lib.runOrDiagnose).not.toHaveBeenCalled();
|
|
2608
|
-
});
|
|
2609
|
-
|
|
2610
|
-
it('bodyHtmlFile alone still passes through as --body-html-file', async () => {
|
|
2611
|
-
await harness.callTool('gog_gmail_reply', { messageId: 'm1', body: 'Hi', bodyHtmlFile: '/tmp/b.html' });
|
|
2612
|
-
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
2613
|
-
['gmail', 'reply', 'm1', '--body=Hi', '--body-html-file=/tmp/b.html', '--auto-from-addressed-alias=false'],
|
|
2614
|
-
{ account: undefined },
|
|
2615
|
-
);
|
|
2616
|
-
});
|
|
2617
2482
|
});
|
|
2618
2483
|
|
|
2619
2484
|
// ---------------------------------------------------------------------------
|
|
@@ -2808,15 +2673,6 @@ describe('gog 0.35.0 — --auto-from-addressed-alias is pinned on every send-sha
|
|
|
2808
2673
|
await harness.callTool('gog_gmail_drafts_update', { draftId: 'd1', subject: 'S', body: 'B', autoFromAddressedAlias: true });
|
|
2809
2674
|
expect(args()).toEqual(['gmail', 'drafts', 'update', 'd1', '--subject=S', '--body=B', '--auto-from-addressed-alias']);
|
|
2810
2675
|
});
|
|
2811
|
-
|
|
2812
|
-
it('gog_gmail_reply and gog_gmail_reply_all pin it', async () => {
|
|
2813
|
-
await harness.callTool('gog_gmail_reply', { messageId: 'm1', body: 'Hi' });
|
|
2814
|
-
expect(args()).toEqual(['gmail', 'reply', 'm1', '--body=Hi', '--auto-from-addressed-alias=false']);
|
|
2815
|
-
vi.clearAllMocks();
|
|
2816
|
-
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
2817
|
-
await harness.callTool('gog_gmail_reply_all', { messageId: 'm1', body: 'Hi', autoFromAddressedAlias: true });
|
|
2818
|
-
expect(args()).toEqual(['gmail', 'reply-all', 'm1', '--body=Hi', '--auto-from-addressed-alias']);
|
|
2819
|
-
});
|
|
2820
2676
|
});
|
|
2821
2677
|
|
|
2822
2678
|
describe('gog 0.35.0 — gog_gmail_import', () => {
|
|
@@ -2871,8 +2727,6 @@ describe('server-side file params never advertise stdin as usable', () => {
|
|
|
2871
2727
|
['gog_gmail_import', 'file'],
|
|
2872
2728
|
['gog_gmail_drafts_create', 'bodyHtmlFile'],
|
|
2873
2729
|
['gog_gmail_drafts_update', 'bodyHtmlFile'],
|
|
2874
|
-
['gog_gmail_reply', 'bodyHtmlFile'],
|
|
2875
|
-
['gog_gmail_reply_all', 'bodyHtmlFile'],
|
|
2876
2730
|
];
|
|
2877
2731
|
|
|
2878
2732
|
async function paramDescriptions(): Promise<Map<string, Record<string, { description?: string }>>> {
|