@happyvertical/email 0.74.8

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/AGENT.md ADDED
@@ -0,0 +1,34 @@
1
+ # @happyvertical/email
2
+
3
+ <!-- BEGIN AGENT:GENERATED -->
4
+ ## Purpose
5
+ Low-level email protocol operations with adapter-based architecture
6
+
7
+ ## Package Map
8
+ - Package: `@happyvertical/email`
9
+ - Hierarchy path: `@happyvertical/sdk > packages > email`
10
+ - Workspace position: `9 of 30` local packages
11
+ - Internal dependencies: `@happyvertical/logger`, `@happyvertical/utils`
12
+ - Internal dependents: `@happyvertical/messages`
13
+ - Knowledge graph files: `AGENT.md`, `metadata.json`, `ecosystem-manifest.json`
14
+
15
+ ## Build & Test
16
+ ```bash
17
+ pnpm --filter @happyvertical/email build
18
+ pnpm --filter @happyvertical/email test
19
+ pnpm --filter @happyvertical/email typecheck
20
+ pnpm --filter @happyvertical/email clean
21
+ ```
22
+
23
+ ## Agent Correction Loops
24
+ - If module resolution or export errors mention a workspace dependency, build the dependency first (`pnpm --filter @happyvertical/logger build`, `pnpm --filter @happyvertical/utils build`) and then rerun `pnpm --filter @happyvertical/email build`.
25
+ - If tests or exports fail after API, type, or bundle changes, run `pnpm --filter @happyvertical/email clean` followed by `pnpm --filter @happyvertical/email build` and `pnpm --filter @happyvertical/email test`.
26
+ - If failures span multiple packages or Turborepo ordering looks wrong, run `pnpm build` and `pnpm typecheck` from the repo root before retrying package-scoped commands.
27
+
28
+ ## Ecosystem Relationships
29
+ - Provides: Low-level email protocol operations with adapter-based architecture
30
+ - Implements: none
31
+ - Requires: @happyvertical/logger, @happyvertical/utils, google-auth-library, googleapis, imapflow, mailparser, node-pop3, nodemailer
32
+ - Stability: stable (Primary package surface is described as implemented and production-oriented.)
33
+ <!-- END AGENT:GENERATED -->
34
+
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright <2025> <Happy Vertical Corporation>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ import { BaseEmailClient } from '../shared/base';
2
+ import { AdapterType, EmailClientCapabilities, EmailMessage, FetchOptions, Folder, FolderInfo, GmailOptions, SearchCriteria, SendOptions, SendResult } from '../shared/types';
3
+ /**
4
+ * Gmail adapter implementation using Gmail API
5
+ *
6
+ * Requires OAuth2 credentials with appropriate scopes:
7
+ * - gmail.readonly: Read emails and settings
8
+ * - gmail.send: Send emails
9
+ * - gmail.modify: Modify emails (mark read, delete, move)
10
+ * - gmail.labels: Manage labels
11
+ */
12
+ export declare class GmailAdapter extends BaseEmailClient {
13
+ private gmail;
14
+ private options;
15
+ private auth;
16
+ constructor(options: GmailOptions);
17
+ connect(): Promise<void>;
18
+ disconnect(): Promise<void>;
19
+ send(message: EmailMessage, options?: SendOptions): Promise<SendResult>;
20
+ fetch(options?: FetchOptions): Promise<EmailMessage[]>;
21
+ getMessage(messageId: string): Promise<EmailMessage>;
22
+ listFolders(): Promise<Folder[]>;
23
+ selectFolder(name: string): Promise<FolderInfo>;
24
+ createFolder(name: string): Promise<void>;
25
+ deleteFolder(name: string): Promise<void>;
26
+ markRead(messageId: string | string[]): Promise<void>;
27
+ markUnread(messageId: string | string[]): Promise<void>;
28
+ move(messageId: string | string[], folder: string): Promise<void>;
29
+ copy(messageId: string | string[], folder: string): Promise<void>;
30
+ delete(messageId: string | string[]): Promise<void>;
31
+ search(criteria: SearchCriteria): Promise<EmailMessage[]>;
32
+ getCapabilities(): Promise<EmailClientCapabilities>;
33
+ getAdapter(): AdapterType;
34
+ private ensureConnected;
35
+ private getUserId;
36
+ private buildRFC2822Message;
37
+ private formatEmailAddress;
38
+ private buildGmailQuery;
39
+ private formatGmailDate;
40
+ private mapGmailLabelToSpecialUse;
41
+ private mapGmailError;
42
+ }
43
+ //# sourceMappingURL=gmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gmail.d.ts","sourceRoot":"","sources":["../../src/adapters/gmail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAWjD,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,qBAAa,YAAa,SAAQ,eAAe;IAC/C,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,IAAI,CAA6B;gBAE7B,OAAO,EAAE,YAAY;IAY3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,IAAI,CACR,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC;IA0ChB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,C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 import { AdapterType, EmailClientCapabilities, EmailMessage, FetchOptions, Folder, FolderInfo, IMAPOptions, SearchCriteria, SendOptions, SendResult } from '../shared/types';
3
+ /**
4
+ * IMAP adapter for receiving email via IMAP protocol
5
+ *
6
+ * Uses ImapFlow for robust IMAP operations including:
7
+ * - Fetch messages with various filters
8
+ * - Folder management (list, create, delete, rename)
9
+ * - Message operations (mark read, move, copy, delete)
10
+ * - Search functionality
11
+ * - OAuth2 authentication
12
+ * - IDLE push notifications (optional)
13
+ */
14
+ export declare class IMAPAdapter extends BaseEmailClient {
15
+ private client;
16
+ private options;
17
+ private currentFolder;
18
+ constructor(options: IMAPOptions);
19
+ /**
20
+ * Create ImapFlow client
21
+ */
22
+ private createClient;
23
+ getAdapter(): AdapterType;
24
+ /**
25
+ * Helper to convert search results to array
26
+ */
27
+ private searchResultToArray;
28
+ /**
29
+ * Connect to IMAP server
30
+ */
31
+ connect(): Promise<void>;
32
+ /**
33
+ * Disconnect from IMAP server
34
+ */
35
+ disconnect(): Promise<void>;
36
+ /**
37
+ * Fetch messages with filters
38
+ */
39
+ fetch(options?: FetchOptions): Promise<EmailMessage[]>;
40
+ /**
41
+ * Get a specific message by ID
42
+ */
43
+ getMessage(messageId: string): Promise<EmailMessage>;
44
+ /**
45
+ * List all folders
46
+ */
47
+ listFolders(): Promise<Folder[]>;
48
+ /**
49
+ * Select a folder
50
+ */
51
+ selectFolder(name: string): Promise<FolderInfo>;
52
+ /**
53
+ * Create a new folder
54
+ */
55
+ createFolder(name: string): Promise<void>;
56
+ /**
57
+ * Delete a folder
58
+ */
59
+ deleteFolder(name: string): Promise<void>;
60
+ /**
61
+ * Mark message(s) as read
62
+ */
63
+ markRead(messageId: string | string[]): Promise<void>;
64
+ /**
65
+ * Mark message(s) as unread
66
+ */
67
+ markUnread(messageId: string | string[]): Promise<void>;
68
+ /**
69
+ * Move message(s) to another folder
70
+ */
71
+ move(messageId: string | string[], folder: string): Promise<void>;
72
+ /**
73
+ * Copy message(s) to another folder
74
+ */
75
+ copy(messageId: string | string[], folder: string): Promise<void>;
76
+ /**
77
+ * Delete message(s)
78
+ */
79
+ delete(messageId: string | string[]): Promise<void>;
80
+ /**
81
+ * Search messages
82
+ */
83
+ search(criteria: SearchCriteria): Promise<EmailMessage[]>;
84
+ /**
85
+ * Get adapter capabilities
86
+ */
87
+ getCapabilities(): Promise<EmailClientCapabilities>;
88
+ /**
89
+ * Check if using OAuth2 authentication
90
+ */
91
+ private isOAuth2;
92
+ send(_message: EmailMessage, _options?: SendOptions): Promise<SendResult>;
93
+ /**
94
+ * Ensure client is connected
95
+ */
96
+ private ensureConnected;
97
+ /**
98
+ * Build IMAP search query from FetchOptions
99
+ */
100
+ private buildSearchQuery;
101
+ /**
102
+ * Build IMAP search criteria from SearchCriteria
103
+ */
104
+ private buildSearchCriteria;
105
+ /**
106
+ * Parse mailparser output to EmailMessage
107
+ */
108
+ private parseMessage;
109
+ /**
110
+ * Map ImapFlow errors to standard error types
111
+ */
112
+ private mapIMAPError;
113
+ }
114
+ //# sourceMappingURL=imap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imap.d.ts","sourceRoot":"","sources":["../../src/adapters/imap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAUjD,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAC9C,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,aAAa,CAAuB;gBAEhC,OAAO,EAAE,WAAW;IAShC;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB,UAAU,IAAI,WAAW;IAIzB;;OAEG;IACH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,CAAC;IAgC/D;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAczD;;OAEG;IACH,OAAO,CAAC,QAAQ;IAYV,IAAI,CACR,QAAQ,EAAE,YAAY,EACtB,QAAQ,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,UAAU,CAAC;IAYtB;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwE3B;;OAEG;IACH,OAAO,CAAC,YAAY;IAuEpB;;OAEG;IACH,OAAO,CAAC,YAAY;CAuCrB"}
@@ -0,0 +1,44 @@
1
+ import { BaseEmailClient } from '../shared/base';
2
+ import { AdapterType, EmailClientCapabilities, EmailMessage, FetchOptions, Folder, FolderInfo, POP3Options, SearchCriteria, SendOptions, SendResult } from '../shared/types';
3
+ /**
4
+ * POP3 adapter implementation
5
+ *
6
+ * POP3 is a simple protocol for retrieving email. It does not support:
7
+ * - Folders (POP3 has no folder concept)
8
+ * - Marking messages as read/unread
9
+ * - Moving or copying messages
10
+ * - Server-side search
11
+ *
12
+ * By default, POP3 deletes messages from the server after retrieval.
13
+ * Use leaveOnServer: true to keep messages on the server.
14
+ */
15
+ export declare class POP3Adapter extends BaseEmailClient {
16
+ private client;
17
+ private options;
18
+ private messageCache;
19
+ constructor(options: POP3Options);
20
+ connect(): Promise<void>;
21
+ disconnect(): Promise<void>;
22
+ fetch(options?: FetchOptions): Promise<EmailMessage[]>;
23
+ getMessage(messageId: string): Promise<EmailMessage>;
24
+ delete(messageId: string | string[]): Promise<void>;
25
+ send(_message: EmailMessage, _options?: SendOptions): Promise<SendResult>;
26
+ listFolders(): Promise<Folder[]>;
27
+ selectFolder(_name: string): Promise<FolderInfo>;
28
+ createFolder(_name: string): Promise<void>;
29
+ deleteFolder(_name: string): Promise<void>;
30
+ markRead(_messageId: string | string[]): Promise<void>;
31
+ markUnread(_messageId: string | string[]): Promise<void>;
32
+ move(_messageId: string | string[], _folder: string): Promise<void>;
33
+ copy(_messageId: string | string[], _folder: string): Promise<void>;
34
+ search(_criteria: SearchCriteria): Promise<EmailMessage[]>;
35
+ getCapabilities(): Promise<EmailClientCapabilities>;
36
+ getAdapter(): AdapterType;
37
+ private ensureConnected;
38
+ private fetchMessage;
39
+ private deleteMessageByNum;
40
+ private parseUidlResponse;
41
+ private shouldIncludeMessage;
42
+ private mapPOP3Error;
43
+ }
44
+ //# sourceMappingURL=pop3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pop3.d.ts","sourceRoot":"","sources":["../../src/adapters/pop3.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAQjD,OAAO,KAAK,EACV,WAAW,EACX,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,eAAe;IAC9C,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,YAAY,CAAkC;gBAE1C,OAAO,EAAE,WAAW;IAY1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB3B,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IA8DtD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA+CpD,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDnD,IAAI,CACR,QAAQ,EAAE,YAAY,EACtB,QAAQ,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,UAAU,CAAC;IAQhB,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQhC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQhD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1C,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1C,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAY1D,eAAe,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAczD,UAAU,IAAI,WAAW;IAQzB,OAAO,CAAC,eAAe;YAST,YAAY;YAuEZ,kBAAkB;IAUhC,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,YAAY;CAgDrB"}
@@ -0,0 +1,64 @@
1
+ import { BaseEmailClient } from '../shared/base';
2
+ import { AdapterType, EmailClientCapabilities, EmailMessage, FetchOptions, Folder, FolderInfo, SearchCriteria, SendOptions, SendResult, SMTPOptions } from '../shared/types';
3
+ /**
4
+ * SMTP adapter for sending email via SMTP protocol
5
+ *
6
+ * Uses Nodemailer for robust SMTP operations including:
7
+ * - Plain text and HTML email
8
+ * - Attachments (files and inline images)
9
+ * - Multiple recipients (To, CC, BCC)
10
+ * - Connection pooling
11
+ * - OAuth2 authentication
12
+ * - TLS/SSL support
13
+ */
14
+ export declare class SMTPAdapter extends BaseEmailClient {
15
+ private transporter;
16
+ private options;
17
+ constructor(options: SMTPOptions);
18
+ /**
19
+ * Create Nodemailer transporter with configuration
20
+ */
21
+ private createTransporter;
22
+ getAdapter(): AdapterType;
23
+ /**
24
+ * Send an email message
25
+ */
26
+ send(message: EmailMessage, options?: SendOptions): Promise<SendResult>;
27
+ /**
28
+ * Format email address for Nodemailer
29
+ */
30
+ private formatEmailAddress;
31
+ /**
32
+ * Map Nodemailer/SMTP errors to standard error types
33
+ */
34
+ private mapSMTPError;
35
+ /**
36
+ * Connect to SMTP server (verify connection)
37
+ */
38
+ connect(): Promise<void>;
39
+ /**
40
+ * Disconnect from SMTP server
41
+ */
42
+ disconnect(): Promise<void>;
43
+ /**
44
+ * Get adapter capabilities
45
+ */
46
+ getCapabilities(): Promise<EmailClientCapabilities>;
47
+ /**
48
+ * Check if using OAuth2 authentication
49
+ */
50
+ private isOAuth2;
51
+ fetch(_options?: FetchOptions): Promise<EmailMessage[]>;
52
+ getMessage(_messageId: string): Promise<EmailMessage>;
53
+ listFolders(): Promise<Folder[]>;
54
+ selectFolder(_name: string): Promise<FolderInfo>;
55
+ createFolder(_name: string): Promise<void>;
56
+ deleteFolder(_name: string): Promise<void>;
57
+ markRead(_messageId: string | string[]): Promise<void>;
58
+ markUnread(_messageId: string | string[]): Promise<void>;
59
+ move(_messageId: string | string[], _folder: string): Promise<void>;
60
+ copy(_messageId: string | string[], _folder: string): Promise<void>;
61
+ delete(_messageId: string | string[]): Promise<void>;
62
+ search(_criteria: SearchCriteria): Promise<EmailMessage[]>;
63
+ }
64
+ //# sourceMappingURL=smtp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smtp.d.ts","sourceRoot":"","sources":["../../src/adapters/smtp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM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AE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnE,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAOjE"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=claude-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-context.d.ts","sourceRoot":"","sources":["../../src/cli/claude-context.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, mkdirSync, copyFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ const Dirname = dirname(fileURLToPath(import.meta.url));
6
+ const pkgRoot = join(Dirname, "../..");
7
+ const targetDir = join(process.cwd(), ".claude");
8
+ if (!existsSync(targetDir)) {
9
+ mkdirSync(targetDir, { recursive: true });
10
+ }
11
+ const pkgName = "email";
12
+ const agentMdSrc = existsSync(join(pkgRoot, "AGENT.md")) ? join(pkgRoot, "AGENT.md") : join(pkgRoot, "CLAUDE.md");
13
+ const metaSrc = existsSync(join(pkgRoot, "metadata.json")) ? join(pkgRoot, "metadata.json") : join(pkgRoot, ".claude-meta.json");
14
+ if (existsSync(agentMdSrc)) {
15
+ copyFileSync(agentMdSrc, join(targetDir, `have-${pkgName}.md`));
16
+ }
17
+ if (existsSync(metaSrc)) {
18
+ copyFileSync(metaSrc, join(targetDir, `have-${pkgName}.meta.json`));
19
+ }
20
+ console.log(`✓ Installed @happyvertical/${pkgName} context to .claude/`);
21
+ //# sourceMappingURL=claude-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-context.js","sources":["../../src/cli/claude-context.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * CLI script to install agent context for @happyvertical/email\n * Run the published context installer binary for this package.\n */\nimport { copyFileSync, existsSync, mkdirSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst Dirname = dirname(fileURLToPath(import.meta.url));\nconst pkgRoot = join(Dirname, '../..');\nconst targetDir = join(process.cwd(), '.claude');\n\nif (!existsSync(targetDir)) {\n mkdirSync(targetDir, { recursive: true });\n}\n\nconst pkgName = 'email';\nconst agentMdSrc = existsSync(join(pkgRoot, 'AGENT.md'))\n ? join(pkgRoot, 'AGENT.md')\n : join(pkgRoot, 'CLAUDE.md');\nconst metaSrc = existsSync(join(pkgRoot, 'metadata.json'))\n ? join(pkgRoot, 'metadata.json')\n : join(pkgRoot, '.claude-meta.json');\n\nif (existsSync(agentMdSrc)) {\n copyFileSync(agentMdSrc, join(targetDir, `have-${pkgName}.md`));\n}\n\nif (existsSync(metaSrc)) {\n copyFileSync(metaSrc, join(targetDir, `have-${pkgName}.meta.json`));\n}\n\nconsole.log(`✓ Installed @happyvertical/${pkgName} context to .claude/`);\n"],"names":[],"mappings":";;;;AASA,MAAM,UAAU,QAAQ,cAAc,YAAY,GAAG,CAAC;AACtD,MAAM,UAAU,KAAK,SAAS,OAAO;AACrC,MAAM,YAAY,KAAK,QAAQ,IAAA,GAAO,SAAS;AAE/C,IAAI,CAAC,WAAW,SAAS,GAAG;AAC1B,YAAU,WAAW,EAAE,WAAW,KAAA,CAAM;AAC1C;AAEA,MAAM,UAAU;AAChB,MAAM,aAAa,WAAW,KAAK,SAAS,UAAU,CAAC,IACnD,KAAK,SAAS,UAAU,IACxB,KAAK,SAAS,WAAW;AAC7B,MAAM,UAAU,WAAW,KAAK,SAAS,eAAe,CAAC,IACrD,KAAK,SAAS,eAAe,IAC7B,KAAK,SAAS,mBAAmB;AAErC,IAAI,WAAW,UAAU,GAAG;AAC1B,eAAa,YAAY,KAAK,WAAW,QAAQ,OAAO,KAAK,CAAC;AAChE;AAEA,IAAI,WAAW,OAAO,GAAG;AACvB,eAAa,SAAS,KAAK,WAAW,QAAQ,OAAO,YAAY,CAAC;AACpE;AAEA,QAAQ,IAAI,8BAA8B,OAAO,sBAAsB;"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @happyvertical/email
3
+ *
4
+ * Low-level email protocol operations with adapter-based architecture.
5
+ * Supports SMTP, IMAP, POP3, and Gmail API protocols.
6
+ */
7
+ export { GmailAdapter } from './adapters/gmail.js';
8
+ export { IMAPAdapter } from './adapters/imap.js';
9
+ export { POP3Adapter } from './adapters/pop3.js';
10
+ export { SMTPAdapter } from './adapters/smtp.js';
11
+ export { BaseEmailClient } from './shared/base.js';
12
+ export { AttachmentError, AuthenticationError, AuthorizationError, ConnectionError, EmailError, FolderExistsError, FolderNotFoundError, InvalidMessageError, MessageNotFoundError, SendError, TimeoutError, } from './shared/errors.js';
13
+ export { getEmailClient, isGmailOptions, isIMAPOptions, isPOP3Options, isSMTPOptions, } from './shared/factory.js';
14
+ export type { AdapterType, Attachment, EmailAddress, EmailClient, EmailClientCapabilities, EmailClientConfig, EmailMessage, FetchOptions, Folder, FolderInfo, FolderSpecialUse, GetEmailClientOptions, GmailOptions, IMAPOptions, MessageFlag, POP3Options, SearchCriteria, SendOptions, SendResult, SMTPOptions, } from './shared/types.js';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,YAAY,GACb,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,mBAAmB,CAAC"}