diff --git a/.gitignore b/.gitignore index acb05ac..b12319d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ token*.json accounts.json # Runtime output -summary.json -summary-secondary.json +mailSummaries/ diff --git a/src/loaders/prompt-config-loaders.ts b/src/loaders/prompt-config-loaders.ts index 3d86b24..9252bc5 100644 --- a/src/loaders/prompt-config-loaders.ts +++ b/src/loaders/prompt-config-loaders.ts @@ -51,9 +51,9 @@ export const getTokenPath = (account: string): string => { export const getSummaryPath = (account: string): string => { if (account === "work") { - return path.join(PROJECT_ROOT, "summary.json"); + return path.join(PROJECT_ROOT, "mailSummaries", "summary.json"); } - return path.join(PROJECT_ROOT, `summary-${account}.json`); + return path.join(PROJECT_ROOT, "mailSummaries", `summary-${account}.json`); }; export const VALID_ACCOUNTS = ["work", "secondary"] as const; diff --git a/summary-secondary.json b/summary-secondary.json deleted file mode 100644 index f384e02..0000000 --- a/summary-secondary.json +++ /dev/null @@ -1,130 +0,0 @@ -[ - { - "senderName": "Yelena Nikolov", - "senderEmail": "Yelena.Nikolov@meridianlink.com", - "dateReceived": "Tue, 17 Feb 2026 13:57:42 +0000", - "subject": "Interview next steps with MeridianLink", - "category": "B", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "LDEAskHR", - "senderEmail": "LDEAskHR@epiqglobal.com", - "dateReceived": "Fri, 13 Feb 2026 17:12:26 +0000", - "subject": "Immediate Action Requested - Background check", - "category": "B", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Talent Experience Team", - "senderEmail": "talentsupport@mbopartners.com", - "dateReceived": "Fri, 13 Feb 2026 17:03:27 +0000", - "subject": "[URGENT ACTION NEEDED!] FINAL NOTICE - Security Training - OVERDUE", - "category": "B", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Talent Experience Team", - "senderEmail": "talentsupport@mbopartners.com", - "dateReceived": "Fri, 13 Feb 2026 17:01:12 +0000", - "subject": "[ACTION NEEDED!] KPMG Ethics & Integrity Training for KPMG's Contingent Worker Training - OVERDUE", - "category": "B", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Penny from Rocket Money", - "senderEmail": "support@rocketmoney.com", - "dateReceived": "Tue, 17 Feb 2026 14:00:20 +0000", - "subject": "Re: [External] New Cell Number -m Cannot 2FA to My Account", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Mondaq Newsletters", - "senderEmail": "newsletters@webiis01.mondaq.com", - "dateReceived": "Tue, 17 Feb 2026 13:37:53 +0000", - "subject": "Mondaq Personalized News Alert", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "MoneyLion Partner", - "senderEmail": "partners@iemail.moneylion.com", - "dateReceived": "Tue, 17 Feb 2026 04:00:40 +0000", - "subject": "3 days left to view your personalized offers.", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "JobCopilot", - "senderEmail": "noreply@jobcopilot.com", - "dateReceived": "Mon, 16 Feb 2026 23:33:56 +0000", - "subject": "JobCopilot has applied to 50 jobs", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "no-reply@equifax.com", - "senderEmail": "no-reply@equifax.com", - "dateReceived": "Mon, 16 Feb 2026 21:01:48 +0000", - "subject": "New Equifax Credit Report Available", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Call-On-Doc", - "senderEmail": "no-reply@callondoc.com", - "dateReceived": "Mon, 16 Feb 2026 20:46:24 +0000", - "subject": "CallonDoc - Your Login Email has Been Changed.", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Bank of America", - "senderEmail": "customerservice@ealerts.bankofamerica.com", - "dateReceived": "Mon, 16 Feb 2026 09:55:20 -0600", - "subject": "Kenneth S Jannette sent you $150.00", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Concora Credit", - "senderEmail": "donotreply_concoracredit@mail.concoracredit.com", - "dateReceived": "Sat, 14 Feb 2026 16:01:10 -0600", - "subject": "Your Statement Is Ready To View", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "MBO Talent Experience & Support Team", - "senderEmail": "talentsupport@mbopartners.com", - "dateReceived": "Fri, 13 Feb 2026 10:44:08 -0600", - "subject": "KPMG Standard Work Hours and Overtime Policy", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Noun Project", - "senderEmail": "yourfriends@thenounproject.com", - "dateReceived": "Fri, 13 Feb 2026 01:00:53 +0000", - "subject": "Your Noun Project Invoice", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "The Termly Team", - "senderEmail": "termlyservices@email.termly.io", - "dateReceived": "Thu, 12 Feb 2026 20:16:59 +0000", - "subject": "Upcoming IAB TCF v2.3 update: disclosedVendors support", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - }, - { - "senderName": "Brave Search API", - "senderEmail": "search-api@brave.com", - "dateReceived": "Thu, 12 Feb 2026 19:57:43 +0000", - "subject": "New ToS & plans for the Brave Search API", - "category": "D", - "addedAt": "2026-02-17T14:10:30.911Z" - } -] \ No newline at end of file diff --git a/test/integration/email-workflow.test.ts b/test/integration/email-workflow.test.ts index acbc00d..0c5dea4 100644 --- a/test/integration/email-workflow.test.ts +++ b/test/integration/email-workflow.test.ts @@ -32,11 +32,10 @@ vi.mock("../../src/loaders/prompt-config-loaders.js", () => { loadAccounts: () => testAccounts, getTokenPath: () => "/tmp/fake-token.json", getSummaryPath: (account: string) => { - // tmpDir is set in beforeAll, but this is called lazily so it's fine const base = tmpDir || os.tmpdir(); return account === "work" - ? path.join(base, "summary.json") - : path.join(base, `summary-${account}.json`); + ? path.join(base, "mailSummaries", "summary.json") + : path.join(base, "mailSummaries", `summary-${account}.json`); }, loadClassificationPrompt: () => "CLASSIFY EACH EMAIL AS A, B, C, OR D.", loadActionPrompt: () => "PHASE 2 INSTRUCTIONS HERE.", @@ -87,6 +86,7 @@ async function callTool(name: string, args: Record) { describe("Phase 1: Email Review Workflow", () => { beforeAll(async () => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "mcp-test-")); + fs.mkdirSync(path.join(tmpDir, "mailSummaries"), { recursive: true }); await connectClient(); }); @@ -235,8 +235,7 @@ describe("Phase 1: Email Review Workflow", () => { expect(text).toContain("Appended 2 entry/entries to summary."); expect(text).toContain("Total entries in summary: 2"); - // Verify the file was actually written - const summaryPath = path.join(tmpDir, "summary.json"); + const summaryPath = path.join(tmpDir, "mailSummaries", "summary.json"); const written = JSON.parse(fs.readFileSync(summaryPath, "utf-8")); expect(written).toHaveLength(2); expect(written[0].senderName).toBe("Jane Smith"); @@ -246,7 +245,7 @@ describe("Phase 1: Email Review Workflow", () => { }); it("purges entries older than 30 days", async () => { - const summaryPath = path.join(tmpDir, "summary.json"); + const summaryPath = path.join(tmpDir, "mailSummaries", "summary.json"); const oldDate = new Date(Date.now() - 31 * 24 * 60 * 60 * 1000).toISOString(); // Seed with an old entry