@wirecat/mail-cli 0.16.0 → 0.16.2
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/CHANGELOG.md +35 -0
- package/README.md +16 -16
- package/dist/bin/mail.js +2 -2
- package/dist/bundle/{chunk-M24BGP7M.js → chunk-OLKK5V23.js} +12 -2
- package/dist/bundle/mail.js +2 -2
- package/dist/bundle/{program-L43S7DRF.js → program-GVK7TF2N.js} +143 -104
- package/dist/commands/account.js +1 -1
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/attachments.js +3 -3
- package/dist/commands/attachments.js.map +1 -1
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/drafts-send.js +1 -1
- package/dist/commands/drafts-send.js.map +1 -1
- package/dist/commands/drafts.d.ts.map +1 -1
- package/dist/commands/drafts.js +9 -6
- package/dist/commands/drafts.js.map +1 -1
- package/dist/commands/export.js +3 -3
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/folders.d.ts.map +1 -1
- package/dist/commands/folders.js +7 -4
- package/dist/commands/folders.js.map +1 -1
- package/dist/commands/messages.js +11 -11
- package/dist/commands/messages.js.map +1 -1
- package/dist/commands/rules.d.ts.map +1 -1
- package/dist/commands/rules.js +55 -33
- package/dist/commands/rules.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +7 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/session-start.js +1 -1
- package/dist/commands/session-start.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +8 -3
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/stats.js +4 -4
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.js +3 -3
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/tags.d.ts.map +1 -1
- package/dist/commands/tags.js +3 -2
- package/dist/commands/tags.js.map +1 -1
- package/dist/mail/domain-age.d.ts.map +1 -1
- package/dist/mail/domain-age.js +3 -6
- package/dist/mail/domain-age.js.map +1 -1
- package/dist/mail/save.d.ts.map +1 -1
- package/dist/mail/save.js +3 -2
- package/dist/mail/save.js.map +1 -1
- package/dist/mail/send.d.ts +6 -0
- package/dist/mail/send.d.ts.map +1 -1
- package/dist/mail/send.js +11 -4
- package/dist/mail/send.js.map +1 -1
- package/dist/mail/smtp.d.ts.map +1 -1
- package/dist/mail/smtp.js +7 -5
- package/dist/mail/smtp.js.map +1 -1
- package/dist/oauth.js +1 -1
- package/dist/oauth.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +10 -0
- package/dist/reasons.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/mail-cli/SKILL.md +16 -16
|
@@ -713,7 +713,7 @@ import {
|
|
|
713
713
|
IDENTITY,
|
|
714
714
|
PACKAGE,
|
|
715
715
|
SKILL
|
|
716
|
-
} from "./chunk-
|
|
716
|
+
} from "./chunk-OLKK5V23.js";
|
|
717
717
|
import {
|
|
718
718
|
installerOf
|
|
719
719
|
} from "./chunk-KV4267S4.js";
|
|
@@ -36950,7 +36950,7 @@ var configuration = settingsFor(IDENTITY, {
|
|
|
36950
36950
|
});
|
|
36951
36951
|
|
|
36952
36952
|
// dist/mail/domain-age.js
|
|
36953
|
-
import {
|
|
36953
|
+
import { readFileSync as readFileSync17 } from "node:fs";
|
|
36954
36954
|
import { join as join19 } from "node:path";
|
|
36955
36955
|
var BOOTSTRAP_URL = "https://data.iana.org/rdap/dns.json";
|
|
36956
36956
|
var BOOTSTRAP_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
@@ -36966,10 +36966,7 @@ var loadCache = /* @__PURE__ */ __name((env) => {
|
|
|
36966
36966
|
}
|
|
36967
36967
|
}, "loadCache");
|
|
36968
36968
|
var saveCache = /* @__PURE__ */ __name((env, cache) => {
|
|
36969
|
-
|
|
36970
|
-
mkdirSync9(join19(file, ".."), { recursive: true });
|
|
36971
|
-
writeFileSync6(`${file}.tmp`, JSON.stringify(cache));
|
|
36972
|
-
renameSync2(`${file}.tmp`, file);
|
|
36969
|
+
writeSecurely(fileOf(env), JSON.stringify(cache), 384);
|
|
36973
36970
|
}, "saveCache");
|
|
36974
36971
|
var knownAges = /* @__PURE__ */ __name((env) => new Map(Object.entries(loadCache(env).domains)), "knownAges");
|
|
36975
36972
|
var rdapDeps = /* @__PURE__ */ __name((fetcher = (input, init) => fetch(input, init)) => ({
|
|
@@ -40894,6 +40891,7 @@ var XOAuth2 = class extends Stream {
|
|
|
40894
40891
|
var xoauth2_default = XOAuth2;
|
|
40895
40892
|
|
|
40896
40893
|
// dist/mail/smtp.js
|
|
40894
|
+
var smtpErrorOf = /* @__PURE__ */ __name((value2) => value2 instanceof Error ? value2 : new Error("the SMTP client failed"), "smtpErrorOf");
|
|
40897
40895
|
var codes = /* @__PURE__ */ __name((error2) => ({
|
|
40898
40896
|
...error2.code && /^[A-Z0-9_]{1,40}$/.test(error2.code) ? { cause_code: error2.code } : {},
|
|
40899
40897
|
...error2.responseCode ? { smtp_code: error2.responseCode } : {}
|
|
@@ -40975,25 +40973,25 @@ var smtpSubmit = /* @__PURE__ */ __name((endpoint2, credential, bounds2 = {}) =>
|
|
|
40975
40973
|
try {
|
|
40976
40974
|
opened = await open4(await credential.login());
|
|
40977
40975
|
} catch (error2) {
|
|
40978
|
-
if (credential.kind !== "oauth" || !loginRefused(error2))
|
|
40976
|
+
if (credential.kind !== "oauth" || !loginRefused(smtpErrorOf(error2)))
|
|
40979
40977
|
throw error2;
|
|
40980
40978
|
try {
|
|
40981
40979
|
opened = await open4(await credential.login({ refresh: true }));
|
|
40982
40980
|
} catch (again2) {
|
|
40983
|
-
if (loginRefused(again2))
|
|
40984
|
-
throw tokenRefused(again2, credential);
|
|
40981
|
+
if (loginRefused(smtpErrorOf(again2)))
|
|
40982
|
+
throw tokenRefused(smtpErrorOf(again2), credential);
|
|
40985
40983
|
throw again2;
|
|
40986
40984
|
}
|
|
40987
40985
|
}
|
|
40988
40986
|
} catch (error2) {
|
|
40989
|
-
throw error2 instanceof CliError ? error2 : beforeSending(error2);
|
|
40987
|
+
throw error2 instanceof CliError ? error2 : beforeSending(smtpErrorOf(error2));
|
|
40990
40988
|
}
|
|
40991
40989
|
const { connection, done } = opened;
|
|
40992
40990
|
try {
|
|
40993
40991
|
const info = await settle(connection, (finish) => connection.send({ from, to: [...recipients2] }, Buffer.from(raw), finish));
|
|
40994
40992
|
return { accepted: info.accepted, rejected: info.rejected };
|
|
40995
40993
|
} catch (raw2) {
|
|
40996
|
-
const error2 = raw2;
|
|
40994
|
+
const error2 = smtpErrorOf(raw2);
|
|
40997
40995
|
if (error2.code === "EENVELOPE" || error2.code === "EMESSAGE" && error2.responseCode)
|
|
40998
40996
|
throw refused(error2);
|
|
40999
40997
|
throw new CliError("outcome_unknown", "the line to the submission server broke while the message was going; it may have been sent \u2014 look in Sent before sending it again", { retryable: false, ...codes(error2) });
|
|
@@ -41673,7 +41671,7 @@ var imapBackend = /* @__PURE__ */ __name((endpoint2, credential, tuning = {}) =>
|
|
|
41673
41671
|
}, "imapBackend");
|
|
41674
41672
|
|
|
41675
41673
|
// dist/oauth.js
|
|
41676
|
-
import { mkdirSync as
|
|
41674
|
+
import { mkdirSync as mkdirSync9, readFileSync as readFileSync19 } from "node:fs";
|
|
41677
41675
|
import { join as join21 } from "node:path";
|
|
41678
41676
|
|
|
41679
41677
|
// node_modules/.pnpm/@wirecat+cli-core@0.569.0_@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_type_8785fed449bbc2a6b34fc086f24a8413/node_modules/@wirecat/cli-core/dist/oauth/client-file.js
|
|
@@ -42452,7 +42450,7 @@ var recordSignIn = /* @__PURE__ */ __name(async (env, profile, record2) => {
|
|
|
42452
42450
|
delete records[profile];
|
|
42453
42451
|
else
|
|
42454
42452
|
return;
|
|
42455
|
-
|
|
42453
|
+
mkdirSync9(paths(env).state, { recursive: true, mode: 448 });
|
|
42456
42454
|
await writeFileAtomic(recordsPath(env), `${JSON.stringify(records, null, 2)}
|
|
42457
42455
|
`, { mode: 384 });
|
|
42458
42456
|
}, "recordSignIn");
|
|
@@ -42692,9 +42690,9 @@ var syncCommand2 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Comman
|
|
|
42692
42690
|
cooperative: true,
|
|
42693
42691
|
partial: true,
|
|
42694
42692
|
examples: [
|
|
42695
|
-
`${IDENTITY.command}
|
|
42696
|
-
`${IDENTITY.command}
|
|
42697
|
-
`${IDENTITY.command}
|
|
42693
|
+
`${IDENTITY.command} personal sync`,
|
|
42694
|
+
`${IDENTITY.command} personal sync --since-time 2026-10-01 --limit 200`,
|
|
42695
|
+
`${IDENTITY.command} personal sync --folder INBOX`
|
|
42698
42696
|
]
|
|
42699
42697
|
}), "mail_sync", mailSync).description("read mail from the server into the shared store; mail already stored is skipped").option("--since-time <time>", "only mail received since this date or time; a date alone starts at local midnight, a time without a zone is local (default: 30 days)").option("--limit <n>", "save at most this many new emails in this run, newest first", positiveCount("--limit")).option("--max-pages <pages>", "at most this many requests to the mail server in this run; as many as fit the deadline if not given", positiveCount("--max-pages")).addOption(repeatable2("--folder <folder>", "a folder to read; repeat it for more (default: the profile's folders, else INBOX and Sent; All Mail on Gmail)")).option("--attachments", "read attachments into the search index this run, whatever the profile's read_attachments").option("--no-attachments", "read no attachment this run; each is stored with its name and size, without text").option("--max-attachment-mb <mb>", "the largest attachment to read this run, in MB (default: the profile's max_attachment_mb, else 10)", positiveCount("--max-attachment-mb")).option("--rescan", "list the whole window again; also moves stored replies into their thread where the server has no thread ids").action(async function(args) {
|
|
42700
42698
|
const context = contextOf(this);
|
|
@@ -42835,7 +42833,7 @@ var mailAccountCheck = strictObject({
|
|
|
42835
42833
|
});
|
|
42836
42834
|
var checkCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("check"), {
|
|
42837
42835
|
effects: REMOTE_READ,
|
|
42838
|
-
examples: [`${IDENTITY.command}
|
|
42836
|
+
examples: [`${IDENTITY.command} personal account check`, `${IDENTITY.command} personal account check --json`]
|
|
42839
42837
|
}), "mail_account_check", mailAccountCheck).summary("log in and list what the server supports").description("log in to the server and list what it supports (IDLE, CONDSTORE, MOVE, Gmail extensions)").action(async function() {
|
|
42840
42838
|
const context = contextOf(this);
|
|
42841
42839
|
refuseOffline(context.flags);
|
|
@@ -42979,28 +42977,29 @@ var accountCommand3 = /* @__PURE__ */ __name(() => annotate(new Command("account
|
|
|
42979
42977
|
import { resolve as resolve14 } from "node:path";
|
|
42980
42978
|
|
|
42981
42979
|
// dist/mail/save.js
|
|
42982
|
-
import { lstatSync as lstatSync2, mkdirSync as
|
|
42980
|
+
import { lstatSync as lstatSync2, mkdirSync as mkdirSync10 } from "node:fs";
|
|
42983
42981
|
import { dirname as dirname8, extname as extname2 } from "node:path";
|
|
42984
42982
|
var exists = /* @__PURE__ */ __name((path2) => new CliError("validation_error", `${path2} already exists; pass --replace to overwrite it`, {
|
|
42985
42983
|
reason: "download.exists",
|
|
42986
42984
|
param: "output-dir"
|
|
42987
42985
|
}), "exists");
|
|
42986
|
+
var errnoOf = /* @__PURE__ */ __name((error2) => error2 instanceof Error && "code" in error2 ? error2.code : void 0, "errnoOf");
|
|
42988
42987
|
var present = /* @__PURE__ */ __name((path2) => {
|
|
42989
42988
|
try {
|
|
42990
42989
|
lstatSync2(path2);
|
|
42991
42990
|
return true;
|
|
42992
42991
|
} catch (error2) {
|
|
42993
|
-
if (error2
|
|
42992
|
+
if (errnoOf(error2) === "ENOENT")
|
|
42994
42993
|
return false;
|
|
42995
42994
|
throw error2;
|
|
42996
42995
|
}
|
|
42997
42996
|
}, "present");
|
|
42998
42997
|
var savePrivately = /* @__PURE__ */ __name(async (path2, bytes, overwrite) => {
|
|
42999
|
-
|
|
42998
|
+
mkdirSync10(dirname8(path2), { recursive: true, mode: 448 });
|
|
43000
42999
|
try {
|
|
43001
43000
|
await writeFileAtomic(path2, bytes, { overwrite });
|
|
43002
43001
|
} catch (error2) {
|
|
43003
|
-
if (error2
|
|
43002
|
+
if (errnoOf(error2) === "EEXIST")
|
|
43004
43003
|
throw exists(path2);
|
|
43005
43004
|
throw error2;
|
|
43006
43005
|
}
|
|
@@ -48636,7 +48635,7 @@ var messageIdFor = /* @__PURE__ */ __name((operationId, from) => `<${operationId
|
|
|
48636
48635
|
var forgotAttachment = /* @__PURE__ */ __name((text5, attached) => !attached && /\battach(ed|ment|ing)?\b|влож(ени|ил|ен)|прилага|прикреп/iu.test(text5), "forgotAttachment");
|
|
48637
48636
|
|
|
48638
48637
|
// dist/mail/changes.js
|
|
48639
|
-
import { appendFileSync as appendFileSync3, existsSync as existsSync18, mkdirSync as
|
|
48638
|
+
import { appendFileSync as appendFileSync3, existsSync as existsSync18, mkdirSync as mkdirSync11, readdirSync as readdirSync5, readFileSync as readFileSync20 } from "node:fs";
|
|
48640
48639
|
import { join as join22 } from "node:path";
|
|
48641
48640
|
var RUN_ID = /^[\w.:-]+$/;
|
|
48642
48641
|
var runsDir = /* @__PURE__ */ __name((env, account) => join22(resolvePaths({ appName: "mail-cli", prefix: "MAIL", env }).state, "changes", account.toLowerCase()), "runsDir");
|
|
@@ -48657,7 +48656,7 @@ var ChangeLog = class {
|
|
|
48657
48656
|
constructor(env, run3) {
|
|
48658
48657
|
this.run = run3;
|
|
48659
48658
|
const dir = runsDir(env, run3.account);
|
|
48660
|
-
|
|
48659
|
+
mkdirSync11(dir, { recursive: true, mode: 448 });
|
|
48661
48660
|
this.path = join22(dir, `${run3.id.replace(/[^\w.-]/g, "_")}.jsonl`);
|
|
48662
48661
|
this.write(run3);
|
|
48663
48662
|
}
|
|
@@ -49289,6 +49288,7 @@ var restoreRun = /* @__PURE__ */ __name(async (changer, { run: run3, steps, rest
|
|
|
49289
49288
|
}, "restoreRun");
|
|
49290
49289
|
|
|
49291
49290
|
// dist/mail/send.js
|
|
49291
|
+
var REAL_CLOCK = { now: Date.now, sleep: realSleep };
|
|
49292
49292
|
var everyone = /* @__PURE__ */ __name((draft) => {
|
|
49293
49293
|
const seen2 = /* @__PURE__ */ new Set();
|
|
49294
49294
|
return [...draft.to, ...draft.cc, ...draft.bcc].filter(({ address }) => !seen2.has(address) && !!seen2.add(address));
|
|
@@ -49406,7 +49406,11 @@ var sendOut = /* @__PURE__ */ __name(async (sending2, outgoing) => {
|
|
|
49406
49406
|
await sending2.guard.ask?.(probe);
|
|
49407
49407
|
sending2.guard.check(probe, { reserve: false });
|
|
49408
49408
|
} catch (error2) {
|
|
49409
|
-
sending2.guard.record({
|
|
49409
|
+
sending2.guard.record({
|
|
49410
|
+
...attempt,
|
|
49411
|
+
outcome: "refused",
|
|
49412
|
+
errorCode: error2 instanceof CliError ? error2.code : "unknown"
|
|
49413
|
+
});
|
|
49410
49414
|
throw error2;
|
|
49411
49415
|
}
|
|
49412
49416
|
}
|
|
@@ -49425,11 +49429,13 @@ var sendOut = /* @__PURE__ */ __name(async (sending2, outgoing) => {
|
|
|
49425
49429
|
if (!submit)
|
|
49426
49430
|
throw new CliError("configuration_error", `profile ${sending2.profile} names no submission server; set smtp_host, smtp_port and smtp_security with \`${IDENTITY.command} ${sending2.profile} config set\``, { sent: false });
|
|
49427
49431
|
const { raw, copy } = await build(draft);
|
|
49428
|
-
const
|
|
49432
|
+
const clock3 = sending2.clock ?? REAL_CLOCK;
|
|
49433
|
+
const pacer = new Pacer(pacePathFor(IDENTITY, sending2.profile, sending2.env), DEFAULT_PACE, clock3.now);
|
|
49429
49434
|
const submitted = await guardedWrite(sending2.guard, attempt, () => submit.send({ from: draft.from.address, recipients: recipients2.map(({ address }) => address), raw }), () => ({}), async () => {
|
|
49430
49435
|
const at2 = await pacer.reserve();
|
|
49431
|
-
|
|
49432
|
-
|
|
49436
|
+
const now = clock3.now();
|
|
49437
|
+
if (at2 > now)
|
|
49438
|
+
await clock3.sleep(at2 - now);
|
|
49433
49439
|
});
|
|
49434
49440
|
const sentCopy = await fileCopy(sending2, draft.messageId, copy);
|
|
49435
49441
|
const markedOriginal = outgoing.original ? await markOriginal(sending2, outgoing.original, outgoing.original.flag) : null;
|
|
@@ -49761,8 +49767,8 @@ var organiseAction = /* @__PURE__ */ __name((action, key, describe3) => async fu
|
|
|
49761
49767
|
var flagCommand = /* @__PURE__ */ __name((name, summary4, change2, example) => answerEntity(selection(annotate(new Command(name), {
|
|
49762
49768
|
effects: REMOTE_WRITE,
|
|
49763
49769
|
examples: [
|
|
49764
|
-
`${IDENTITY.command}
|
|
49765
|
-
`${IDENTITY.command}
|
|
49770
|
+
`${IDENTITY.command} personal messages ${name} ${example}`,
|
|
49771
|
+
`${IDENTITY.command} personal messages ${name} --filter 'from:shop@example.com is:unread' --yes`
|
|
49766
49772
|
]
|
|
49767
49773
|
})), "mail_change", mailChange).summary(summary4).description(`${summary4}; on the server first, then in the store, so search shows it at once`).action(organiseAction("message-flag", `messages.${name}`, async () => ({
|
|
49768
49774
|
name,
|
|
@@ -49773,8 +49779,8 @@ var REF = "msg:email/me%40example.com/t1/m1";
|
|
|
49773
49779
|
var updateCommand2 = /* @__PURE__ */ __name(() => answerEntity(selection(annotate(new Command("update"), {
|
|
49774
49780
|
effects: REMOTE_WRITE,
|
|
49775
49781
|
examples: [
|
|
49776
|
-
`${IDENTITY.command}
|
|
49777
|
-
`${IDENTITY.command}
|
|
49782
|
+
`${IDENTITY.command} personal messages update ${REF} --flag answered --unflag '$Junk'`,
|
|
49783
|
+
`${IDENTITY.command} personal messages update ${REF} --flag read --flag flagged --replace`
|
|
49778
49784
|
]
|
|
49779
49785
|
})), "mail_change", mailChange).summary("set, unset or replace flags and keywords").description("set and unset flags (read, flagged, answered, draft) and keywords ($Forwarded, $Junk, words of your own); --replace makes --flag each message's whole set").addOption(repeatable2("--flag <flag>", "a flag or keyword to set; repeat it for more")).addOption(repeatable2("--unflag <flag>", "a flag or keyword to take away; repeat it for more")).option("--replace", "--flag is the whole set: every other flag and keyword is taken away").action(organiseAction("message-flag", "messages.update", async (_opened, options) => {
|
|
49780
49786
|
const add = (options.flag ?? []).map(flagOf2);
|
|
@@ -49792,8 +49798,8 @@ var updateCommand2 = /* @__PURE__ */ __name(() => answerEntity(selection(annotat
|
|
|
49792
49798
|
var moveCommand = /* @__PURE__ */ __name((op) => answerEntity(selection(annotate(new Command(op), {
|
|
49793
49799
|
effects: REMOTE_WRITE,
|
|
49794
49800
|
examples: [
|
|
49795
|
-
`${IDENTITY.command}
|
|
49796
|
-
`${IDENTITY.command}
|
|
49801
|
+
`${IDENTITY.command} personal messages ${op} ${REF} --folder Archive`,
|
|
49802
|
+
`${IDENTITY.command} personal messages ${op} --filter 'list:github.com date<2026-01-01' --folder Lists --yes`
|
|
49797
49803
|
]
|
|
49798
49804
|
})), "mail_change", mailChange).summary(op === "move" ? "move messages to another folder" : "copy messages to another folder").description(op === "move" ? "move messages to a folder, by path, name or role (archive, junk, inbox); on Gmail, a label change that takes Inbox away" : "copy messages to a folder, by path, name or role; on Gmail, a label added").requiredOption("--folder <folder>", "the folder: its path, its name, or a role (archive, junk, inbox)").action(organiseAction(op === "move" ? "message-move" : "message-copy", `messages.${op}`, async (opened, options) => {
|
|
49799
49805
|
const target = await targetOf(opened.mailbox, String(options.folder), op === "copy");
|
|
@@ -49831,9 +49837,9 @@ var keptNow = /* @__PURE__ */ __name((rules) => (id3, state) => {
|
|
|
49831
49837
|
var deleteCommand4 = /* @__PURE__ */ __name(() => answerEntity(selection(annotate(new Command("delete"), {
|
|
49832
49838
|
effects: REMOTE_WRITE,
|
|
49833
49839
|
examples: [
|
|
49834
|
-
`${IDENTITY.command}
|
|
49835
|
-
`${IDENTITY.command}
|
|
49836
|
-
`${IDENTITY.command}
|
|
49840
|
+
`${IDENTITY.command} personal messages delete ${REF} --yes`,
|
|
49841
|
+
`${IDENTITY.command} personal messages delete --filter 'from:shop@example.com date<2025-01-01'`,
|
|
49842
|
+
`${IDENTITY.command} personal messages delete --rules --yes`
|
|
49837
49843
|
]
|
|
49838
49844
|
}), CLEANUP_LIMIT), "mail_change", mailChange).summary("move messages to Trash; messages restore brings them back").description("move messages to Trash, where the provider keeps them for a while (Gmail: 30 days) and messages restore brings them back; a preview unless --yes").option("--rules", "the envelope mail the owner's rules let go, each decided again (`memo mail delete` did this before)").option("--since-time <time>", "with --rules, only mail received from this time; older mail stays").addHelpText("after", `
|
|
49839
49845
|
Nothing is expunged: mail goes to Trash and the run's record keeps where it was, its flags and its Gmail labels.
|
|
@@ -49913,8 +49919,8 @@ backup is under 8 days old, and a first run moves at most 100, to check by hand.
|
|
|
49913
49919
|
var restoreCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("restore"), {
|
|
49914
49920
|
effects: REMOTE_WRITE,
|
|
49915
49921
|
examples: [
|
|
49916
|
-
`${IDENTITY.command}
|
|
49917
|
-
`${IDENTITY.command}
|
|
49922
|
+
`${IDENTITY.command} personal messages restore --run 20261101T101500Z-messages-delete-1a2b3c`,
|
|
49923
|
+
`${IDENTITY.command} personal messages restore --run 20261101T101500Z-messages-delete-1a2b3c --yes`
|
|
49918
49924
|
]
|
|
49919
49925
|
}), "mail_restore", mailRestore).summary("undo a run of messages delete, move, copy or a flag change").description("undo a change run, last step first, for the messages still where it left them: Trash back to where they were, moves back, copies removed, flags as they were; a preview unless --yes").requiredOption("--run <id>", "the run id a change answered with (runs list shows recent runs)").option("--yes", "make the change; without it, only say what would come back").option("--dry-run", "only preview, even with --yes").addHelpText("after", `
|
|
49920
49926
|
memo mail delete runs restore here too, by their id. Mail Gmail has emptied from Trash (30 days) cannot come back.
|
|
@@ -50001,7 +50007,7 @@ var attachmentsOf = /* @__PURE__ */ __name(async (opened, reference2) => {
|
|
|
50001
50007
|
}, "attachmentsOf");
|
|
50002
50008
|
var listCommand4 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("list"), {
|
|
50003
50009
|
effects: REMOTE_READ,
|
|
50004
|
-
examples: [`${IDENTITY.command}
|
|
50010
|
+
examples: [`${IDENTITY.command} personal attachments list ${REF_EXAMPLE}`]
|
|
50005
50011
|
}), "mail_attachment", attachment).summary("the files attached to one email, read from the server").description("the attachments of one stored email, numbered as attachments download takes them; reads the message from the server").argument("<message>", "the msg:email/\u2026 reference search messages shows").action(async function(reference2) {
|
|
50006
50012
|
const found2 = await organising(this, (opened) => attachmentsOf(opened, reference2));
|
|
50007
50013
|
const items = found2.map(({ content: _2, ...one }) => one);
|
|
@@ -50018,8 +50024,8 @@ var numbersOf = /* @__PURE__ */ __name((given2) => given2.map((value2) => {
|
|
|
50018
50024
|
var downloadCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("download"), {
|
|
50019
50025
|
effects: FETCH,
|
|
50020
50026
|
examples: [
|
|
50021
|
-
`${IDENTITY.command}
|
|
50022
|
-
`${IDENTITY.command}
|
|
50027
|
+
`${IDENTITY.command} personal attachments download ${REF_EXAMPLE} --output-dir ./invoices`,
|
|
50028
|
+
`${IDENTITY.command} personal attachments download ${REF_EXAMPLE} 2 --output-dir ./invoices`
|
|
50023
50029
|
]
|
|
50024
50030
|
}), "mail_attachments_saved", saved).summary("save the files attached to one email").description("save the attachments of one stored email into a folder, readable only by you; the bytes come from the server and never go into the store. An existing file is left alone unless --replace").argument("<message>", "the msg:email/\u2026 reference search messages shows").argument("[number...]", "only these attachments, by their number in attachments list (default: all)").requiredOption("--output-dir <dir>", "the folder to save into, made if missing").option("--replace", "overwrite a file of the same name in the folder").action(async function(reference2, given2, flags) {
|
|
50025
50031
|
const numbers = numbersOf(given2);
|
|
@@ -50172,7 +50178,7 @@ var ownerOf = /* @__PURE__ */ __name((opened, command) => {
|
|
|
50172
50178
|
return new Set([mailbox.address, mailbox.login].filter((one) => typeof one === "string" && one.includes("@")).map((one) => one.toLowerCase()).concat(opened.mailbox.key.account));
|
|
50173
50179
|
}, "ownerOf");
|
|
50174
50180
|
var sendingOf = /* @__PURE__ */ __name((opened, command) => {
|
|
50175
|
-
const { settings } = contextOf(command);
|
|
50181
|
+
const { settings, environment } = contextOf(command);
|
|
50176
50182
|
const address = opened.mailbox.key.account;
|
|
50177
50183
|
const provider = providerFor(address, settings.mailbox.host);
|
|
50178
50184
|
return {
|
|
@@ -50189,7 +50195,8 @@ var sendingOf = /* @__PURE__ */ __name((opened, command) => {
|
|
|
50189
50195
|
return { folders, mode: defaults.mode ?? "imap" };
|
|
50190
50196
|
}, "syncFolders"),
|
|
50191
50197
|
warn: /* @__PURE__ */ __name((message2) => outputFor(command).renderer.warn(message2), "warn"),
|
|
50192
|
-
agentWithoutOthers: environmentOf(command).agent !== void 0 && !othersSetInConfig(command)
|
|
50198
|
+
agentWithoutOthers: environmentOf(command).agent !== void 0 && !othersSetInConfig(command),
|
|
50199
|
+
...environment.sendClock ? { clock: environment.sendClock } : {}
|
|
50193
50200
|
};
|
|
50194
50201
|
}, "sendingOf");
|
|
50195
50202
|
var othersSetInConfig = /* @__PURE__ */ __name((command) => {
|
|
@@ -50352,9 +50359,9 @@ var sending = /* @__PURE__ */ __name((command) => command.addOption(repeatable2(
|
|
|
50352
50359
|
var sendCommand4 = /* @__PURE__ */ __name(() => answerEntity(sending(recipients(annotate(new Command("send"), {
|
|
50353
50360
|
effects: REMOTE_WRITE,
|
|
50354
50361
|
examples: [
|
|
50355
|
-
`${IDENTITY.command}
|
|
50356
|
-
`${IDENTITY.command}
|
|
50357
|
-
`${IDENTITY.command}
|
|
50362
|
+
`${IDENTITY.command} personal messages send --to ann@example.com --subject "Lunch" "See you at noon."`,
|
|
50363
|
+
`${IDENTITY.command} personal messages send --reply-to 'msg:email/me%40example.com/thread-1/1001' "Thanks, done."`,
|
|
50364
|
+
`${IDENTITY.command} personal messages send --to ann@example.com --subject Report --file ./report.pdf "The report."`
|
|
50358
50365
|
]
|
|
50359
50366
|
}))), "mail_send", mailSend).summary("send an email, or reply to one, over SMTP").description("send an email from this profile's address over its SMTP server, with the same app password; without [text] the text is read from stdin. Mail to anyone but you asks first (permissions.messages.send.others). Sent gets a copy where the provider does not file one itself").argument("[text]", "the text of the message; read from stdin when left out").option("--subject <text>", "the subject; a reply takes the original's with Re:").option("--reply-to <message>", "answer this msg:email/\u2026 reference: In-Reply-To, References, Re: and the quote").option("--reply-all", "with --reply-to, also to everyone the original went to, except you").action(sendAction), "sendCommand");
|
|
50360
50367
|
var forwardAction = /* @__PURE__ */ __name(async function(reference2, text5, flags) {
|
|
@@ -50393,15 +50400,15 @@ var forwardAction = /* @__PURE__ */ __name(async function(reference2, text5, fla
|
|
|
50393
50400
|
var forwardCommand3 = /* @__PURE__ */ __name(() => answerEntity(sending(recipients(annotate(new Command("forward"), {
|
|
50394
50401
|
effects: REMOTE_WRITE,
|
|
50395
50402
|
examples: [
|
|
50396
|
-
`${IDENTITY.command}
|
|
50397
|
-
`${IDENTITY.command}
|
|
50403
|
+
`${IDENTITY.command} personal messages forward 'msg:email/me%40example.com/thread-1/1001' --to bob@example.com`,
|
|
50404
|
+
`${IDENTITY.command} personal messages forward 'msg:email/me%40example.com/thread-1/1001' --to bob@example.com "FYI"`
|
|
50398
50405
|
]
|
|
50399
50406
|
}))), "mail_send", mailSend).summary("forward an email, attached whole, over SMTP").description("forward a stored email to other people: the original goes as an attached message with its own attachments, Fwd: before its subject. Mail to anyone but you asks first (permissions.messages.send.others)").argument("<message>", "the msg:email/\u2026 reference search messages shows").argument("[text]", "a few words above the forwarded message").option("--subject <text>", "the subject instead of the original's with Fwd:").action(forwardAction), "forwardCommand");
|
|
50400
50407
|
|
|
50401
50408
|
// dist/commands/drafts-send.js
|
|
50402
50409
|
var draftSendCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("send"), {
|
|
50403
50410
|
effects: REMOTE_WRITE,
|
|
50404
|
-
examples: [`${IDENTITY.command}
|
|
50411
|
+
examples: [`${IDENTITY.command} personal drafts send 5b0e1c2a@example.com`]
|
|
50405
50412
|
}), "mail_send", mailSend).summary("send a saved draft, then remove it from Drafts").description("send a draft as it is saved, over SMTP, as messages send does: mail to anyone but you asks first (permissions.messages.send.others); once it went, the draft leaves the Drafts folder").argument("<draft>", "the draft's id, as drafts list shows it").option("--operation-id <id>", "repeat a send whose outcome was unknown; Sent is checked first, so it goes once").option("--yes", "answer the question before sending to anyone but you").option("--dry-run", "show what would go; send nothing").action(async function(given2, flags) {
|
|
50406
50413
|
const id3 = draftIdOf(given2);
|
|
50407
50414
|
const operationId = operationIdOf(flags.operationId);
|
|
@@ -50505,7 +50512,10 @@ var replyTo2 = /* @__PURE__ */ __name(async (command, opened, ref, all) => {
|
|
|
50505
50512
|
}, "replyTo");
|
|
50506
50513
|
var listCommand5 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("list"), {
|
|
50507
50514
|
effects: REMOTE_READ,
|
|
50508
|
-
examples: [
|
|
50515
|
+
examples: [
|
|
50516
|
+
`${IDENTITY.command} personal drafts list`,
|
|
50517
|
+
`${IDENTITY.command} personal drafts list --limit 5 --json`
|
|
50518
|
+
]
|
|
50509
50519
|
}), "mail_draft", mailDraft).summary("the drafts on the server, newest first").description("the drafts in the mailbox's Drafts folder, newest first, read from the server").option("--limit <n>", `at most this many (default ${LIST_LIMIT}, at most ${MAX_LIST})`, limitOf2).action(async function(options) {
|
|
50510
50520
|
await organising(this, async (opened) => {
|
|
50511
50521
|
const limit = options.limit ?? LIST_LIMIT;
|
|
@@ -50517,8 +50527,8 @@ var listCommand5 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Comman
|
|
|
50517
50527
|
var createCommand = /* @__PURE__ */ __name(() => answerEntity(addressing(annotate(new Command("create"), {
|
|
50518
50528
|
effects: REMOTE_WRITE,
|
|
50519
50529
|
examples: [
|
|
50520
|
-
`${IDENTITY.command}
|
|
50521
|
-
`${IDENTITY.command}
|
|
50530
|
+
`${IDENTITY.command} personal drafts create --to anna@example.com --subject 'Monday' 'Shall we meet at ten?'`,
|
|
50531
|
+
`${IDENTITY.command} personal drafts create --reply-to ${REF2} --reply-all 'Thanks, agreed.'`
|
|
50522
50532
|
]
|
|
50523
50533
|
})), "mail_draft_change", draftChange).summary("save a new draft for the owner to check and send").description("save a new message in the Drafts folder; nothing is sent, and the owner sends it from any mail app. --reply-to answers a stored message in its thread").argument("[text]", "the text; - reads it from stdin").option("--reply-to <message>", "answer this stored message: its sender, its subject with Re:, in its thread").option("--reply-all", "with --reply-to, also everyone it went to, but you").action(async function(given2, options) {
|
|
50524
50534
|
if (options.replyAll && !options.replyTo)
|
|
@@ -50569,8 +50579,8 @@ var saveDraft = /* @__PURE__ */ __name(async (command, opened, action, message2,
|
|
|
50569
50579
|
var updateCommand3 = /* @__PURE__ */ __name(() => answerEntity(addressing(annotate(new Command("update"), {
|
|
50570
50580
|
effects: REMOTE_WRITE,
|
|
50571
50581
|
examples: [
|
|
50572
|
-
`${IDENTITY.command}
|
|
50573
|
-
`${IDENTITY.command}
|
|
50582
|
+
`${IDENTITY.command} personal drafts update ${ID} 'New text, the rest kept'`,
|
|
50583
|
+
`${IDENTITY.command} personal drafts update ${ID} --to anna@example.com --to boris@example.com`
|
|
50574
50584
|
]
|
|
50575
50585
|
})), "mail_draft_change", draftChange).summary("change a draft: what is given replaces it, the rest stays").description("replace a draft with a new version under the same id: each given field replaces the old one (a --to list replaces the whole To), the rest, the thread and the attachments stay; the old version goes to Trash").argument("<draft>", "the draft's id, as drafts list shows it").argument("[text]", "the new text; - reads it from stdin").action(async function(draft, given2, options) {
|
|
50576
50586
|
const id3 = draftIdOf(draft);
|
|
@@ -50592,7 +50602,7 @@ var updateCommand3 = /* @__PURE__ */ __name(() => answerEntity(addressing(annota
|
|
|
50592
50602
|
}), "updateCommand");
|
|
50593
50603
|
var deleteCommand5 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("delete"), {
|
|
50594
50604
|
effects: REMOTE_WRITE,
|
|
50595
|
-
examples: [`${IDENTITY.command}
|
|
50605
|
+
examples: [`${IDENTITY.command} personal drafts delete ${ID} --allow-dangerous`]
|
|
50596
50606
|
}), "mail_draft_change", draftChange).summary("delete a draft for good").description("delete a draft from the Drafts folder for good, with no restore; the owner adds --allow-dangerous to do it, without it a preview").argument("<draft>", "the draft's id, as drafts list shows it").addOption(ownerOnlyOption("--allow-dangerous", "delete it for good, no restore; without it, only a preview")).option("--dry-run", "only preview, even with --allow-dangerous").action(async function(draft, options) {
|
|
50597
50607
|
const id3 = draftIdOf(draft);
|
|
50598
50608
|
const dangerous = this.optsWithGlobals().allowDangerous === true;
|
|
@@ -50629,7 +50639,7 @@ var mailFolder = strictObject({
|
|
|
50629
50639
|
});
|
|
50630
50640
|
var listCommand6 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("list"), {
|
|
50631
50641
|
effects: REMOTE_READ,
|
|
50632
|
-
examples: [`${IDENTITY.command}
|
|
50642
|
+
examples: [`${IDENTITY.command} personal folders list`, `${IDENTITY.command} personal folders list --json`]
|
|
50633
50643
|
}), "mail_folder", mailFolder).summary("the folders with their role and message counts").description("the folders of the mailbox with their role (inbox, sent, trash, ...) and message counts").action(async function() {
|
|
50634
50644
|
const context = contextOf(this);
|
|
50635
50645
|
refuseOffline(context.flags);
|
|
@@ -50686,7 +50696,10 @@ var existing = /* @__PURE__ */ __name((folders, given2) => {
|
|
|
50686
50696
|
}, "existing");
|
|
50687
50697
|
var createCommand2 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("create"), {
|
|
50688
50698
|
effects: REMOTE_WRITE,
|
|
50689
|
-
examples: [
|
|
50699
|
+
examples: [
|
|
50700
|
+
`${IDENTITY.command} personal folders create Receipts`,
|
|
50701
|
+
`${IDENTITY.command} personal folders create Work/2026`
|
|
50702
|
+
]
|
|
50690
50703
|
}), "mail_folder_change", folderChange).summary("make a folder").description("make a folder on the server; on Gmail it is a label").argument("<folder>", "the folder's path; the server's separator (usually / or .) makes a subfolder").action(async function(folder2) {
|
|
50691
50704
|
await changeFolder(this, "create", async (writes2, folders) => {
|
|
50692
50705
|
if (folders.some(({ path: path2 }) => path2 === folder2))
|
|
@@ -50697,7 +50710,7 @@ var createCommand2 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Comm
|
|
|
50697
50710
|
}), "createCommand");
|
|
50698
50711
|
var renameCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("rename"), {
|
|
50699
50712
|
effects: REMOTE_WRITE,
|
|
50700
|
-
examples: [`${IDENTITY.command}
|
|
50713
|
+
examples: [`${IDENTITY.command} personal folders rename Receipts Invoices`]
|
|
50701
50714
|
}), "mail_folder_change", folderChange).summary("rename a folder").description("rename a folder of your own on the server; the inbox and the special folders keep their names").argument("<folder>", "the folder, by path or name").argument("<name>", "its new path").action(async function(folder2, name) {
|
|
50702
50715
|
await changeFolder(this, "rename", async (writes2, folders) => {
|
|
50703
50716
|
const found2 = existing(folders, folder2);
|
|
@@ -50709,7 +50722,7 @@ var renameCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Comma
|
|
|
50709
50722
|
}), "renameCommand");
|
|
50710
50723
|
var deleteFolderCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("delete"), {
|
|
50711
50724
|
effects: REMOTE_WRITE,
|
|
50712
|
-
examples: [`${IDENTITY.command}
|
|
50725
|
+
examples: [`${IDENTITY.command} personal folders delete Old --yes`]
|
|
50713
50726
|
}), "mail_folder_change", folderChange).summary("delete an empty folder").description("delete a folder of your own; it must be empty (move or delete its mail first), unless --allow-dangerous, which loses that mail for good; a preview without --yes").argument("<folder>", "the folder, by path or name").option("--yes", "delete it; without it, only a preview").option("--dry-run", "only preview, even with --yes").addOption(ownerOnlyOption("--allow-dangerous", "delete a folder that still holds mail: that mail is gone for good, no restore")).action(async function(folder2, options) {
|
|
50714
50727
|
const given2 = this.optsWithGlobals();
|
|
50715
50728
|
const dangerous = given2.allowDangerous === true;
|
|
@@ -51458,9 +51471,9 @@ var exportLeaf = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command(
|
|
|
51458
51471
|
cooperative: true,
|
|
51459
51472
|
partial: true,
|
|
51460
51473
|
examples: [
|
|
51461
|
-
`${IDENTITY.command}
|
|
51462
|
-
`${IDENTITY.command}
|
|
51463
|
-
`${IDENTITY.command}
|
|
51474
|
+
`${IDENTITY.command} personal messages export 'from:ann@example.com' --output ~/mail-backup`,
|
|
51475
|
+
`${IDENTITY.command} personal messages export --folder INBOX --format maildir --output ~/Maildir`,
|
|
51476
|
+
`${IDENTITY.command} personal messages export 'date>30d' --limit 500 --output ~/mail-backup --resume`
|
|
51464
51477
|
]
|
|
51465
51478
|
}), "mail_export", mailExport).summary("write stored mail to mbox or Maildir files").description("copy the original messages of stored mail that match a query into mbox files (one per folder) or a Maildir++ tree, for backup or for mu and notmuch. The store keeps text, not the original source, so each message is read from the server again; the destination folder is private (mode 700, files 600)").argument("[query...]", "which stored mail: the same query as `search messages`; all of it if left out").addOption(new Option("--format <format>", "mbox files or a Maildir++ tree").choices(["mbox", "maildir"]).default("mbox")).requiredOption("--output <file>", "the folder to write the export into (not one file); made private if it does not exist").addOption(repeatable2("--folder <folder>", "only mail filed in this folder; repeat it for more (default: the folders sync reads)")).option("--limit <n>", "write at most this many messages in this run, newest first", positiveCount("--limit")).option("--max-pages <pages>", "at most this many requests to the mail server in this run; as many as fit the deadline if not given", positiveCount("--max-pages")).option("--resume", "go on with the export already in the folder, skipping what it holds").option("--replace", "write into a folder that has something in it, over files of the same name").addHelpText("after", "\nWhat is written: the original bytes of each message, in each folder it is filed in, with its read and starred state in the Maildir file name. A message the server no longer has is counted as not_on_server, and one the store has no UID for (sync again) the same way. Gmail files a message under All Mail and INBOX both: pass --folder to export one. Without --resume or --replace a folder with something in it is refused.").action(async function(query, args) {
|
|
51466
51479
|
const context = contextOf(this);
|
|
@@ -52419,6 +52432,24 @@ var mailRule = looseObject({
|
|
|
52419
52432
|
source: optional(string()),
|
|
52420
52433
|
decided_at: string()
|
|
52421
52434
|
});
|
|
52435
|
+
var mailRuleChange = looseObject({ removed: record(string(), unknown()) });
|
|
52436
|
+
var mailRulesApply = looseObject({
|
|
52437
|
+
account: string(),
|
|
52438
|
+
applied: boolean(),
|
|
52439
|
+
listed: number(),
|
|
52440
|
+
envelopes: number(),
|
|
52441
|
+
bytes: number(),
|
|
52442
|
+
skip_matched: number(),
|
|
52443
|
+
protected_kept: number(),
|
|
52444
|
+
tagged: number(),
|
|
52445
|
+
rules: array(looseObject({}))
|
|
52446
|
+
});
|
|
52447
|
+
var gmailFiltersPreview = looseObject({
|
|
52448
|
+
rules: array(mailRule),
|
|
52449
|
+
skipped: array(looseObject({ filter: string(), why: string() })),
|
|
52450
|
+
tag_mapping: array(looseObject({ tag: string(), as: string(), why: string() })),
|
|
52451
|
+
added: number()
|
|
52452
|
+
});
|
|
52422
52453
|
var MAIL_RULES_QUERY = {
|
|
52423
52454
|
entity: "mail_rule",
|
|
52424
52455
|
backend: "sql",
|
|
@@ -52476,7 +52507,10 @@ var withRules2 = /* @__PURE__ */ __name((command, work) => {
|
|
|
52476
52507
|
}, "withRules");
|
|
52477
52508
|
var listCommand7 = /* @__PURE__ */ __name(() => answerEntity(withQuery(annotate(new Command("list"), {
|
|
52478
52509
|
effects: LOCAL_READ,
|
|
52479
|
-
examples: [
|
|
52510
|
+
examples: [
|
|
52511
|
+
`${IDENTITY.command} personal rules list`,
|
|
52512
|
+
`${IDENTITY.command} personal rules list protected:true --json`
|
|
52513
|
+
]
|
|
52480
52514
|
}), MAIL_RULES_QUERY), "mail_rule", mailRule).description("this mailbox's rules, protected ones first").addHelpText("after", "\nProtected rules come first, as PROTECTED. An envelope rule shows how many emails it recorded and their size at the source.").action(async function(words4) {
|
|
52481
52515
|
const query = listQuery(typedQuery(words4), MAIL_RULES_QUERY, "rules list");
|
|
52482
52516
|
const items = await withRules2(this, async (store, address) => {
|
|
@@ -52492,9 +52526,9 @@ var listCommand7 = /* @__PURE__ */ __name(() => answerEntity(withQuery(annotate(
|
|
|
52492
52526
|
var addCommand = /* @__PURE__ */ __name(() => answerEntity(matchOptions(grantsAuthority(annotate(new Command("add"), {
|
|
52493
52527
|
effects: LOCAL_WRITE,
|
|
52494
52528
|
examples: [
|
|
52495
|
-
`${IDENTITY.command}
|
|
52496
|
-
`${IDENTITY.command}
|
|
52497
|
-
`${IDENTITY.command}
|
|
52529
|
+
`${IDENTITY.command} personal rules add --domain shop.example --do envelope,tag:promo`,
|
|
52530
|
+
`${IDENTITY.command} personal rules add --sender boss@example.com --do protect --reason "never lose these"`,
|
|
52531
|
+
`${IDENTITY.command} personal rules add --filter "older:365d larger:5MB" --do envelope`
|
|
52498
52532
|
]
|
|
52499
52533
|
}))), "mail_rule", mailRule).description("decide mail by sender, list, subject, age, size, label or kind; repeats replace").requiredOption("--do <actions>", ACTION_HELP, actionsOf).option("--reason <text>", "why, for the owner later").addHelpText("after", "\nAll conditions given must hold. A protected rule wins over every other rule and kind; then keep wins over envelope and envelope over skip, so --do keep --sender one sender overrides --do skip --domain of its domain; an explicit rule wins over a --kind one. A skipped email is never read or stored by sync. An envelope email costs no more from the mailbox than a skipped one; its subject is kept in its metadata, not in search. Changing an envelope rule to keep, or removing it, reads those emails in full on the next sync. Mail already stored in full stays; rules apply cuts or tags it.\n\nscore: and --kind judge a sender by its mail in the same listing; a sync that lists only new mail judges it from that mail. has:attachment reads Content-Type at list time: a guess, not a parse.").action(async function(options) {
|
|
52500
52534
|
const rule = {
|
|
@@ -52509,13 +52543,13 @@ var addCommand = /* @__PURE__ */ __name(() => answerEntity(matchOptions(grantsAu
|
|
|
52509
52543
|
const saved2 = await withRules2(this, (store, address) => saveRule(store, address, rule));
|
|
52510
52544
|
renderAnswer(this, outputFor(this), itemOf(saved2), () => ruleLine(saved2));
|
|
52511
52545
|
}), "addCommand");
|
|
52512
|
-
var removeCommand = /* @__PURE__ */ __name(() => matchOptions(grantsAuthority(annotate(new Command("remove"), {
|
|
52546
|
+
var removeCommand = /* @__PURE__ */ __name(() => answerEntity(matchOptions(grantsAuthority(annotate(new Command("remove"), {
|
|
52513
52547
|
effects: LOCAL_WRITE,
|
|
52514
52548
|
examples: [
|
|
52515
|
-
`${IDENTITY.command}
|
|
52516
|
-
`${IDENTITY.command}
|
|
52549
|
+
`${IDENTITY.command} personal rules remove --domain shop.example`,
|
|
52550
|
+
`${IDENTITY.command} personal rules remove --filter "older:365d larger:5MB"`
|
|
52517
52551
|
]
|
|
52518
|
-
}))).description("drop the rule with exactly these conditions").action(async function(options) {
|
|
52552
|
+
}))), "mail_rule_change", mailRuleChange).description("drop the rule with exactly these conditions").action(async function(options) {
|
|
52519
52553
|
const match = matchOf(options);
|
|
52520
52554
|
const { removed, profile } = await withRules2(this, async (store, address, context) => ({
|
|
52521
52555
|
removed: await removeRule(store, address, match),
|
|
@@ -52525,13 +52559,13 @@ var removeCommand = /* @__PURE__ */ __name(() => matchOptions(grantsAuthority(an
|
|
|
52525
52559
|
throw new CliError("not_found", `no rule for ${describeMatch(match)}; \`${IDENTITY.command} ${profile} rules list\` shows them`, { reason: "mail.rule-not-found" });
|
|
52526
52560
|
renderAnswer(this, outputFor(this), itemOf({ removed: match }), () => `removed the rule for ${describeMatch(match)}`);
|
|
52527
52561
|
}), "removeCommand");
|
|
52528
|
-
var applyCommand = /* @__PURE__ */ __name(() => annotate(new Command("apply"), {
|
|
52562
|
+
var applyCommand = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("apply"), {
|
|
52529
52563
|
effects: LOCAL_WRITE,
|
|
52530
52564
|
examples: [
|
|
52531
|
-
`${IDENTITY.command}
|
|
52532
|
-
`${IDENTITY.command}
|
|
52565
|
+
`${IDENTITY.command} personal rules apply`,
|
|
52566
|
+
`${IDENTITY.command} personal rules apply --since-time 2026-01-01 --yes`
|
|
52533
52567
|
]
|
|
52534
|
-
}).description("cut stored mail an envelope rule matches to its envelope; dry run unless --yes").option("--since-time <time>", "only mail from this time, ISO 8601 or 30d ago (default: all mail)").option("--dry-run", "only say what would change, even with --yes; the read-only lock lets this through").addHelpText("after", "\nWithout --yes it only says what would change. Reads the mailbox's headers from the server, from the folders sync reads (List-Id is not stored), then drops the text, attachments and search entries of each matching stored email and keeps its sender, date, size, labels and subject in metadata. Mail a skip rule matches is left as stored. Nothing changes in the mailbox. Changing a rule to keep, or removing it, reads those emails in full on the next sync.").action(async function(options) {
|
|
52568
|
+
}), "mail_rules_apply", mailRulesApply).description("cut stored mail an envelope rule matches to its envelope; dry run unless --yes").option("--since-time <time>", "only mail from this time, ISO 8601 or 30d ago (default: all mail)").option("--dry-run", "only say what would change, even with --yes; the read-only lock lets this through").addHelpText("after", "\nWithout --yes it only says what would change. Reads the mailbox's headers from the server, from the folders sync reads (List-Id is not stored), then drops the text, attachments and search entries of each matching stored email and keeps its sender, date, size, labels and subject in metadata. Mail a skip rule matches is left as stored. Nothing changes in the mailbox. Changing a rule to keep, or removing it, reads those emails in full on the next sync.").action(async function(options) {
|
|
52535
52569
|
const context = contextOf(this);
|
|
52536
52570
|
refuseOffline(context.flags);
|
|
52537
52571
|
const address = addressOf2(context);
|
|
@@ -52539,8 +52573,9 @@ var applyCommand = /* @__PURE__ */ __name(() => annotate(new Command("apply"), {
|
|
|
52539
52573
|
const since = new Date(window2.since ?? 0);
|
|
52540
52574
|
const apply = this.optsWithGlobals().yes === true && options.dryRun !== true;
|
|
52541
52575
|
const { backend } = await openMail(context);
|
|
52576
|
+
let result;
|
|
52542
52577
|
try {
|
|
52543
|
-
|
|
52578
|
+
result = await withRules2(this, async (store) => applyRules({
|
|
52544
52579
|
store,
|
|
52545
52580
|
source: backend,
|
|
52546
52581
|
account: { address, rules: await storedMailRules(store, { address }) },
|
|
@@ -52548,26 +52583,26 @@ var applyCommand = /* @__PURE__ */ __name(() => annotate(new Command("apply"), {
|
|
|
52548
52583
|
since,
|
|
52549
52584
|
apply
|
|
52550
52585
|
}));
|
|
52551
|
-
const next = result.applied || result.envelopes + result.tagged === 0 ? [] : [
|
|
52552
|
-
{
|
|
52553
|
-
kind: "command",
|
|
52554
|
-
step: "mail.rules-apply",
|
|
52555
|
-
command: "rules apply",
|
|
52556
|
-
args: { yes: true, ...options.sinceTime === void 0 ? {} : { since_time: options.sinceTime } },
|
|
52557
|
-
why: "this was a dry run; --yes cuts them",
|
|
52558
|
-
safe_to_auto_execute: false
|
|
52559
|
-
}
|
|
52560
|
-
];
|
|
52561
|
-
renderAnswer(this, outputFor(this), itemOf(snakeKeys(result), { next, meta: window2.meta }), () => applyText2(result));
|
|
52562
52586
|
} finally {
|
|
52563
52587
|
await backend.close();
|
|
52564
52588
|
}
|
|
52589
|
+
const next = result.applied || result.envelopes + result.tagged === 0 ? [] : [
|
|
52590
|
+
{
|
|
52591
|
+
kind: "command",
|
|
52592
|
+
step: "mail.rules-apply",
|
|
52593
|
+
command: "rules apply",
|
|
52594
|
+
args: { yes: true, ...options.sinceTime === void 0 ? {} : { since_time: options.sinceTime } },
|
|
52595
|
+
why: "this was a dry run; --yes cuts them",
|
|
52596
|
+
safe_to_auto_execute: false
|
|
52597
|
+
}
|
|
52598
|
+
];
|
|
52599
|
+
renderAnswer(this, outputFor(this), itemOf(snakeKeys(result), { next, meta: window2.meta }), () => applyText2(result));
|
|
52565
52600
|
}), "applyCommand");
|
|
52566
52601
|
var exportCommand2 = /* @__PURE__ */ __name(() => annotate(new Command("export"), {
|
|
52567
52602
|
effects: LOCAL_READ,
|
|
52568
|
-
examples: [`${IDENTITY.command}
|
|
52603
|
+
examples: [`${IDENTITY.command} personal rules export`]
|
|
52569
52604
|
}).description("print this mailbox's rules as JSON, to review, keep or move elsewhere").addHelpText("after", `
|
|
52570
|
-
${IDENTITY.command}
|
|
52605
|
+
${IDENTITY.command} personal rules export > rules.json; ${IDENTITY.command} personal rules import rules.json reads it back. memo mail rules import reads it too.`).action(async function() {
|
|
52571
52606
|
const file = await withRules2(this, async (store, address) => {
|
|
52572
52607
|
const rules = await storedMailRules(store, { address });
|
|
52573
52608
|
return { version: 1, account: address, rules: rules.map(({ id: _2, ...rule }) => rule) };
|
|
@@ -52575,14 +52610,14 @@ ${IDENTITY.command} ya rules export > rules.json; ${IDENTITY.command} ya rules i
|
|
|
52575
52610
|
outputFor(this).streams.data(`${JSON.stringify(file, null, 2)}
|
|
52576
52611
|
`);
|
|
52577
52612
|
}), "exportCommand");
|
|
52578
|
-
var importCommand = /* @__PURE__ */ __name(() => grantsAuthority(annotate(new Command("import"), {
|
|
52613
|
+
var importCommand = /* @__PURE__ */ __name(() => answerEntity(grantsAuthority(annotate(new Command("import"), {
|
|
52579
52614
|
effects: LOCAL_WRITE,
|
|
52580
52615
|
examples: [
|
|
52581
|
-
`${IDENTITY.command}
|
|
52582
|
-
`${IDENTITY.command}
|
|
52583
|
-
`${IDENTITY.command}
|
|
52616
|
+
`${IDENTITY.command} personal rules import rules.json`,
|
|
52617
|
+
`${IDENTITY.command} personal rules import Filters.json --format gmail`,
|
|
52618
|
+
`${IDENTITY.command} personal rules import Filters.json --format gmail --yes`
|
|
52584
52619
|
]
|
|
52585
|
-
})).summary("import saved rules, or preview Gmail filters").description("import saved rules, or preview Gmail filters with --format gmail; same match replaces").argument("<file>", "a rules JSON file from rules export, or Takeout Filters.json with --format gmail").addOption(new Option("--format <format>", "the file's format: mail (memo's export is the same file) or gmail").choices(["mail", "memo", "gmail"]).default("mail")).addHelpText("after", "\nWith --format gmail it only previews the rules the filters suggest; --yes adds them. A rules file is imported at once.").action(async function(path2, options) {
|
|
52620
|
+
})), "mail_rule_import", union([mailRule, gmailFiltersPreview])).summary("import saved rules, or preview Gmail filters").description("import saved rules, or preview Gmail filters with --format gmail; same match replaces").argument("<file>", "a rules JSON file from rules export, or Takeout Filters.json with --format gmail").addOption(new Option("--format <format>", "the file's format: mail (memo's export is the same file) or gmail").choices(["mail", "memo", "gmail"]).default("mail")).addHelpText("after", "\nWith --format gmail it only previews the rules the filters suggest; --yes adds them. A rules file is imported at once.").action(async function(path2, options) {
|
|
52586
52621
|
const yes3 = this.optsWithGlobals().yes === true;
|
|
52587
52622
|
const text5 = readFileSync22(path2, "utf8");
|
|
52588
52623
|
if (options.format === "gmail") {
|
|
@@ -52886,7 +52921,7 @@ var sessionStartCommand = /* @__PURE__ */ __name(() => logsInOrOut(annotate(new
|
|
|
52886
52921
|
lifetime: "interactive",
|
|
52887
52922
|
mcp: false,
|
|
52888
52923
|
examples: [
|
|
52889
|
-
`${IDENTITY.command}
|
|
52924
|
+
`${IDENTITY.command} personal session start --address me@example.com`,
|
|
52890
52925
|
`${IDENTITY.command} work session start --address me@outlook.com`,
|
|
52891
52926
|
`${IDENTITY.command} gm session start --address me@gmail.com --client-file ~/client.json`
|
|
52892
52927
|
]
|
|
@@ -53022,7 +53057,10 @@ var oauthStatus = /* @__PURE__ */ __name((context) => {
|
|
|
53022
53057
|
}, "oauthStatus");
|
|
53023
53058
|
var statusCommand3 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("status"), {
|
|
53024
53059
|
effects: REMOTE_READ,
|
|
53025
|
-
examples: [
|
|
53060
|
+
examples: [
|
|
53061
|
+
`${IDENTITY.command} personal session status`,
|
|
53062
|
+
`${IDENTITY.command} personal session status --check --json`
|
|
53063
|
+
]
|
|
53026
53064
|
}), "mail_session_status", mailSessionStatus).summary("show how this profile signs in; no secret is printed").description("show where this profile's app password comes from, or what its OAuth sign-in allows and until when; no password or token is ever printed").option("--check", "log in to the server to prove the password or sign-in still works").action(async function(args) {
|
|
53027
53065
|
const context = contextOf(this);
|
|
53028
53066
|
const { auth } = context.settings.mailbox;
|
|
@@ -53051,8 +53089,8 @@ var statusCommand3 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Comm
|
|
|
53051
53089
|
var endCommand = /* @__PURE__ */ __name(() => logsInOrOut(annotate(new Command("end"), {
|
|
53052
53090
|
effects: LOCAL_WRITE,
|
|
53053
53091
|
mcp: false,
|
|
53054
|
-
examples: [`${IDENTITY.command}
|
|
53055
|
-
})).summary("forget this profile's password or sign-in; synced mail stays").description("forget this profile's app password or OAuth sign-in on this computer; synced mail stays").option("--revoke", "Gmail over OAuth: also ask Google to revoke the sign-in, which ends every sign-in of that Google project").action(async function(args) {
|
|
53092
|
+
examples: [`${IDENTITY.command} personal session end`, `${IDENTITY.command} personal session end --revoke`]
|
|
53093
|
+
})).summary("forget this profile's password or sign-in; synced mail stays").description("forget this profile's app password or OAuth sign-in on this computer; synced mail stays. With --revoke (Gmail over OAuth) it also asks Google to revoke the sign-in: that changes your Google account and signs out every tool that uses the same Google project").option("--revoke", "Gmail over OAuth: also ask Google to revoke the sign-in, which ends every sign-in of that Google project").action(async function(args) {
|
|
53056
53094
|
const context = contextOf(this);
|
|
53057
53095
|
refuseUnderReadOnly(this, "session end");
|
|
53058
53096
|
const kind2 = context.settings.mailbox.auth === "oauth" ? oauthKindOf(context.settings.mailbox) : void 0;
|
|
@@ -53134,8 +53172,8 @@ var topLeaf = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("to
|
|
|
53134
53172
|
effects: LOCAL_READ,
|
|
53135
53173
|
partial: true,
|
|
53136
53174
|
examples: [
|
|
53137
|
-
`${IDENTITY.command}
|
|
53138
|
-
`${IDENTITY.command}
|
|
53175
|
+
`${IDENTITY.command} personal stats messages top`,
|
|
53176
|
+
`${IDENTITY.command} personal stats messages top --by list --limit 10`
|
|
53139
53177
|
]
|
|
53140
53178
|
}), "mail_group", mailGroup).summary("senders, lists or domains with the most stored mail").description("group this profile's stored mail by sender, mailing list (List-Id) or sender domain, the biggest group first; unread and size help decide what to unsubscribe from or clean up").addOption(new Option("--by <group>", "what to group by").choices([...GROUPS]).default("sender")).option("--limit <n>", "how many groups, at most 200", positiveCount("--limit"), 20).action(async function(args) {
|
|
53141
53179
|
const context = contextOf(this);
|
|
@@ -53183,8 +53221,8 @@ var showLeaf = /* @__PURE__ */ __name(() => annotate(new Command("show"), {
|
|
|
53183
53221
|
effects: LOCAL_READ,
|
|
53184
53222
|
output: { entity: "mail_counts" },
|
|
53185
53223
|
examples: [
|
|
53186
|
-
`${IDENTITY.command}
|
|
53187
|
-
`${IDENTITY.command}
|
|
53224
|
+
`${IDENTITY.command} personal stats messages show --by day --timezone Europe/Madrid -- 'date>=30d'`,
|
|
53225
|
+
`${IDENTITY.command} personal stats messages show --by sender --limit 10`
|
|
53188
53226
|
]
|
|
53189
53227
|
}).summary("count stored mail received and sent by day, week or sender").description("how much of this profile's stored mail matches the query, received and sent, per calendar day, week (from Monday) or sender; by sender counts received mail only. Counts only, from the store; records no search").argument("[query...]", "the same query as `search messages`; every stored email if left out").addOption(new Option("--by <group>", "what to count by").choices([...MAIL_STATS_BY]).default("day")).option("--timezone <zone>", "the IANA timezone where days and weeks start").option("--limit <n>", "how many rows: the latest days or weeks, or the busiest senders", positiveCount("--limit"), 30).action(async function(words4, args) {
|
|
53190
53228
|
const context = contextOf(this);
|
|
@@ -53240,7 +53278,7 @@ var mailSyncStatus = strictObject({
|
|
|
53240
53278
|
});
|
|
53241
53279
|
var statusCommand4 = /* @__PURE__ */ __name(() => answerEntity(annotate(new Command("status"), {
|
|
53242
53280
|
effects: LOCAL_READ,
|
|
53243
|
-
examples: [`${IDENTITY.command}
|
|
53281
|
+
examples: [`${IDENTITY.command} personal status`, `${IDENTITY.command} personal status --json`]
|
|
53244
53282
|
}), "mail_sync_status", mailSyncStatus).summary("how far the sync is, and how far each agent processed the mail").description("how many messages of the synced window are read and how many are left, per folder, and how far each holder of a processing mark got and what it skipped; it asks no server, so it answers while a sync runs").action(async function() {
|
|
53245
53283
|
const context = contextOf(this);
|
|
53246
53284
|
const address = context.settings.mailbox.address;
|
|
@@ -53311,6 +53349,7 @@ var withMailbox = /* @__PURE__ */ __name(async (command, work) => {
|
|
|
53311
53349
|
if (!address)
|
|
53312
53350
|
throw new CliError("configuration_error", `profile ${context.profile} has no address`);
|
|
53313
53351
|
const store = await openMailStore(context.env);
|
|
53352
|
+
context.environment.trackCloseable?.(store);
|
|
53314
53353
|
try {
|
|
53315
53354
|
return await work(store, { provider: "email", account: address.toLowerCase() });
|
|
53316
53355
|
} finally {
|
|
@@ -53338,7 +53377,7 @@ var targetOf2 = /* @__PURE__ */ __name((key, { message: message2, chat: chat2 })
|
|
|
53338
53377
|
var shown6 = /* @__PURE__ */ __name((key, target) => target.type === "message" ? formatReference({ type: "message", ...key, chat: target.chatId, message: target.messageId }) : formatReference({ type: "chat", ...key, chat: target.chatId }), "shown");
|
|
53339
53378
|
var change = /* @__PURE__ */ __name((operation) => answerEntity(annotate(new Command(operation), {
|
|
53340
53379
|
effects: LOCAL_WRITE,
|
|
53341
|
-
examples: [`${IDENTITY.command}
|
|
53380
|
+
examples: [`${IDENTITY.command} personal tags ${operation} invoices --message ${REF3}`]
|
|
53342
53381
|
}), "mail_tag_change", tagChange).summary(operation === "add" ? "tag one stored email or conversation" : "untag one stored email or conversation").description(operation === "add" ? "put your own tags on one stored email or conversation; they stay in the local store, never on the server" : "take your own tags off one stored email or conversation").argument("<tag...>", "one or more tags: 1\u201332 letters a\u2013z, digits and hyphens; upper case is lowered").option("--message <message>", "the email: its msg:email/\u2026 reference, as search messages shows it").option("--chat <chat>", "the conversation: its chat:email/\u2026 reference, as conversations list shows it").action(async function(given2, options) {
|
|
53343
53382
|
const tags = [...new Set(given2.map(normalizeTag))];
|
|
53344
53383
|
const done = await withMailbox(this, async (store, key) => {
|
|
@@ -53356,7 +53395,7 @@ var change = /* @__PURE__ */ __name((operation) => answerEntity(annotate(new Com
|
|
|
53356
53395
|
}), "change");
|
|
53357
53396
|
var listCommand9 = /* @__PURE__ */ __name(() => withQuery(answerEntity(annotate(new Command("list"), {
|
|
53358
53397
|
effects: LOCAL_READ,
|
|
53359
|
-
examples: [`${IDENTITY.command}
|
|
53398
|
+
examples: [`${IDENTITY.command} personal tags list`, `${IDENTITY.command} personal tags list tag:invoices`]
|
|
53360
53399
|
}), "mail_tag", mailTag).summary("your tagged emails and conversations").description("the emails and conversations of this mailbox you tagged; search messages tag:<tag> finds them too").option("--limit <n>", `at most this many (default ${LIST_LIMIT2}, at most ${MAX_LIST2})`, limitOf4), TAG_QUERY).action(async function(words4, options) {
|
|
53361
53400
|
const terms = queryTerms(words4, TAG_QUERY, "tags list");
|
|
53362
53401
|
const tag = terms.get("tag");
|