proton-mail-bridge-client 2.8.5 → 2.9.0

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.
Files changed (39) hide show
  1. package/README.md +17 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +43 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +57 -7
  7. package/dist/index.js.map +1 -1
  8. package/dist/scripts/check-claude-desktop.d.ts.map +1 -1
  9. package/dist/scripts/check-claude-desktop.js +1 -0
  10. package/dist/scripts/check-claude-desktop.js.map +1 -1
  11. package/dist/scripts/install-claude-desktop.d.ts.map +1 -1
  12. package/dist/scripts/install-claude-desktop.js +1 -0
  13. package/dist/scripts/install-claude-desktop.js.map +1 -1
  14. package/dist/services/delivery-queue-service.js +1 -1
  15. package/dist/services/delivery-queue-service.js.map +1 -1
  16. package/dist/services/draft-store-service.js +1 -1
  17. package/dist/services/draft-store-service.js.map +1 -1
  18. package/dist/services/simple-imap-service.d.ts.map +1 -1
  19. package/dist/services/simple-imap-service.js +4 -2
  20. package/dist/services/simple-imap-service.js.map +1 -1
  21. package/dist/services/template-service.js +2 -2
  22. package/dist/services/template-service.js.map +1 -1
  23. package/dist/types/index.d.ts +3 -0
  24. package/dist/types/index.d.ts.map +1 -1
  25. package/dist/utils/helpers.d.ts.map +1 -1
  26. package/dist/utils/helpers.js +11 -4
  27. package/dist/utils/helpers.js.map +1 -1
  28. package/dist/utils/mail-prompts.d.ts +17 -0
  29. package/dist/utils/mail-prompts.d.ts.map +1 -0
  30. package/dist/utils/mail-prompts.js +78 -0
  31. package/dist/utils/mail-prompts.js.map +1 -0
  32. package/dist/utils/runtime-policy.d.ts.map +1 -1
  33. package/dist/utils/runtime-policy.js +1 -0
  34. package/dist/utils/runtime-policy.js.map +1 -1
  35. package/dist/utils/schedule-templates.d.ts +34 -0
  36. package/dist/utils/schedule-templates.d.ts.map +1 -0
  37. package/dist/utils/schedule-templates.js +110 -0
  38. package/dist/utils/schedule-templates.js.map +1 -0
  39. package/package.json +3 -2
@@ -0,0 +1,34 @@
1
+ export type SchedulerSystem = "launchd" | "systemd" | "cron" | "schtasks";
2
+ export declare const SCHEDULER_SYSTEMS: SchedulerSystem[];
3
+ export interface ScheduleOptions {
4
+ system: SchedulerSystem;
5
+ hour: number;
6
+ minute: number;
7
+ /** Absolute path of the Node binary and of this CLI's script: a scheduler's PATH is minimal. */
8
+ node: string;
9
+ script: string;
10
+ /** Where the digest is written. */
11
+ output: string;
12
+ username: string;
13
+ /** A file holding the Bridge password, mode 600. The password itself never goes into a scheduler definition. */
14
+ passwordFile: string;
15
+ }
16
+ export interface ScheduleOutput {
17
+ /** The file to create, when the system uses one. */
18
+ file?: {
19
+ path: string;
20
+ content: string;
21
+ };
22
+ /** Text to show before the steps. */
23
+ body: string;
24
+ /** What to run to switch it on, then off. */
25
+ enable: string[];
26
+ disable: string[];
27
+ }
28
+ export declare function parseTimeOfDay(value: string): {
29
+ hour: number;
30
+ minute: number;
31
+ };
32
+ export declare function defaultSchedulerSystem(platform: NodeJS.Platform): SchedulerSystem;
33
+ export declare function buildSchedule(options: ScheduleOptions): ScheduleOutput;
34
+ //# sourceMappingURL=schedule-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-templates.d.ts","sourceRoot":"","sources":["../../src/utils/schedule-templates.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;AAE1E,eAAO,MAAM,iBAAiB,EAAE,eAAe,EAA+C,CAAC;AAE/F,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gHAAgH;IAChH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQ9E;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,eAAe,CAIjF;AAQD,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAyFtE"}
@@ -0,0 +1,110 @@
1
+ // Definitions for running `digest` every day from the operating system's own scheduler. This only builds text: the
2
+ // `schedule` command prints it, with the commands to switch it on, and installs nothing by itself.
3
+ export const SCHEDULER_SYSTEMS = ["launchd", "systemd", "cron", "schtasks"];
4
+ export function parseTimeOfDay(value) {
5
+ const match = /^(\d{1,2}):(\d{2})$/.exec(value.trim());
6
+ const hour = match ? Number(match[1]) : Number.NaN;
7
+ const minute = match ? Number(match[2]) : Number.NaN;
8
+ if (!match || hour > 23 || minute > 59) {
9
+ throw new Error(`--at must be a time of day like 08:00 (24-hour), got "${value}".`);
10
+ }
11
+ return { hour, minute };
12
+ }
13
+ export function defaultSchedulerSystem(platform) {
14
+ if (platform === "darwin")
15
+ return "launchd";
16
+ if (platform === "win32")
17
+ return "schtasks";
18
+ return "systemd";
19
+ }
20
+ const LABEL = "com.proton-mail-bridge-client.digest";
21
+ const pad = (value) => String(value).padStart(2, "0");
22
+ const xml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
23
+ // A path or value inside a double-quoted shell or cron word.
24
+ const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
25
+ export function buildSchedule(options) {
26
+ const { system, hour, minute, node, script, output, username, passwordFile } = options;
27
+ const time = `${pad(hour)}:${pad(minute)}`;
28
+ if (system === "launchd") {
29
+ const path = `~/Library/LaunchAgents/${LABEL}.plist`;
30
+ const content = `<?xml version="1.0" encoding="UTF-8"?>
31
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
32
+ <plist version="1.0">
33
+ <dict>
34
+ <key>Label</key><string>${LABEL}</string>
35
+ <key>ProgramArguments</key>
36
+ <array>
37
+ <string>${xml(node)}</string>
38
+ <string>${xml(script)}</string>
39
+ <string>digest</string>
40
+ </array>
41
+ <key>EnvironmentVariables</key>
42
+ <dict>
43
+ <key>PROTONMAIL_USERNAME</key><string>${xml(username)}</string>
44
+ <key>PROTONMAIL_PASSWORD_FILE</key><string>${xml(passwordFile)}</string>
45
+ </dict>
46
+ <key>StartCalendarInterval</key>
47
+ <dict>
48
+ <key>Hour</key><integer>${hour}</integer>
49
+ <key>Minute</key><integer>${minute}</integer>
50
+ </dict>
51
+ <key>StandardOutPath</key><string>${xml(output)}</string>
52
+ <key>StandardErrorPath</key><string>${xml(output)}</string>
53
+ </dict>
54
+ </plist>
55
+ `;
56
+ return {
57
+ file: { path, content },
58
+ body: `A launchd job that writes the digest to ${output} every day at ${time}.`,
59
+ enable: [`launchctl bootstrap gui/$(id -u) ${path}`],
60
+ disable: [`launchctl bootout gui/$(id -u)/${LABEL}`, `rm ${path}`],
61
+ };
62
+ }
63
+ if (system === "systemd") {
64
+ const dir = "~/.config/systemd/user";
65
+ const service = `[Unit]
66
+ Description=Proton Mail digest
67
+
68
+ [Service]
69
+ Type=oneshot
70
+ Environment=PROTONMAIL_USERNAME=${username}
71
+ Environment=PROTONMAIL_PASSWORD_FILE=${passwordFile}
72
+ ExecStart=${node} ${script} digest
73
+ StandardOutput=file:${output}
74
+ StandardError=file:${output}
75
+ `;
76
+ const timer = `[Unit]
77
+ Description=Proton Mail digest, daily
78
+
79
+ [Timer]
80
+ OnCalendar=*-*-* ${time}:00
81
+ Persistent=true
82
+
83
+ [Install]
84
+ WantedBy=timers.target
85
+ `;
86
+ return {
87
+ file: { path: `${dir}/proton-mail-digest.timer`, content: timer },
88
+ body: `A systemd user timer (proton-mail-digest.timer, shown below) that runs this service every day at ${time}.\nAlso create ${dir}/proton-mail-digest.service:\n\n${service}`,
89
+ enable: ["systemctl --user daemon-reload", "systemctl --user enable --now proton-mail-digest.timer"],
90
+ disable: ["systemctl --user disable --now proton-mail-digest.timer"],
91
+ };
92
+ }
93
+ if (system === "cron") {
94
+ const line = `${minute} ${hour} * * * PROTONMAIL_USERNAME=${shellQuote(username)} PROTONMAIL_PASSWORD_FILE=${shellQuote(passwordFile)} ` +
95
+ `${shellQuote(node)} ${shellQuote(script)} digest >> ${shellQuote(output)} 2>&1`;
96
+ return {
97
+ body: `A crontab line that appends the digest to ${output} every day at ${time}:\n\n${line}`,
98
+ enable: ["crontab -e # add the line above"],
99
+ disable: ["crontab -e # remove the line"],
100
+ };
101
+ }
102
+ // schtasks
103
+ const command = `cmd /c "set PROTONMAIL_USERNAME=${username}&& set PROTONMAIL_PASSWORD_FILE=${passwordFile}&& "${node}" "${script}" digest > "${output}" 2>&1"`;
104
+ return {
105
+ body: `A Windows scheduled task that writes the digest to ${output} every day at ${time}.`,
106
+ enable: [`schtasks /Create /SC DAILY /ST ${time} /TN "Proton Mail digest" /TR '${command}'`],
107
+ disable: [`schtasks /Delete /TN "Proton Mail digest" /F`],
108
+ };
109
+ }
110
+ //# sourceMappingURL=schedule-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-templates.js","sourceRoot":"","sources":["../../src/utils/schedule-templates.ts"],"names":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ge-client",
3
- "version": "2.8.5",
3
+ "version": "2.9.0",
4
4
  "description": "Proton Mail Bridge Client — full-featured CLI and Claude Desktop MCP for Proton Mail via Proton Bridge. Read, search, send, draft, archive, manage folders, and more.",
5
5
  "mcpName": "io.github.googlarz/proton-mail-bridge-client",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "test:coverage": "npm run build && node --test --experimental-test-coverage test/*.test.mjs",
33
33
  "smoke:bridge": "npm run build && node dist/scripts/bridge-smoke.js",
34
34
  "prepare": "npm run build",
35
- "lint": "tsc --noEmit",
35
+ "lint": "biome lint . && tsc --noEmit",
36
36
  "clean": "rm -rf dist",
37
37
  "ci": "npm run lint && npm test",
38
38
  "pack:check": "npm pack --dry-run",
@@ -82,6 +82,7 @@
82
82
  "turndown": "^7.2.4"
83
83
  },
84
84
  "devDependencies": {
85
+ "@biomejs/biome": "2.5.15",
85
86
  "@types/better-sqlite3": "^9.6.0",
86
87
  "@types/node": "^24.19.1",
87
88
  "@types/sanitize-html": "^2.16.1",