diff --git a/AGENTS.md b/AGENTS.md index 8229fed1..d91e2d35 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,11 +11,12 @@ This repository orchestrates multi-project agent workflows. Keep behavior projec 5. Keep run-state path logic in `src/state.ts`. 6. Keep CLI parsing and dispatch in `src/args.ts` and `src/index.ts`. 7. Do not construct raw shell command strings in workflow logic; use helper modules. -8. Keep review parsing contract stable: +8. Keep TypeScript files under 250 lines; split files before they grow beyond that limit. +9. Keep review parsing contract stable: - `RESULT: PASS|FAIL` - `SUMMARY: ...` - `BUGS_JSON: [...]` -9. Add tests for any new CLI flag, config shape, state path, or stage transition. +10. Add tests for any new CLI flag, config shape, state path, or stage transition. ## Quality Gates diff --git a/tests/config.test.ts b/tests/config.test.ts index 78c8da63..78a34897 100644 --- a/tests/config.test.ts +++ b/tests/config.test.ts @@ -272,17 +272,24 @@ describe("loadConfig", () => { }); it("loads notification settings from RESEND env vars", async () => { + const tempDir = await mkdtemp( + path.join(process.cwd(), ".tmp-config-test-"), + ); process.env.RESEND_API_KEY = "re_test_key"; process.env.RESEND_FROM = "ADHD.ai "; process.env.RESEND_TO = "a@example.com,b@example.com"; - const config = await loadConfig(process.cwd()); - expect(config.notifications.email.enabled).toBe(true); - expect(config.notifications.email.resendApiKey).toBe("re_test_key"); - expect(config.notifications.email.from).toBe("ADHD.ai "); - expect(config.notifications.email.to).toEqual([ - "a@example.com", - "b@example.com", - ]); + try { + const config = await loadConfig(tempDir); + expect(config.notifications.email.enabled).toBe(true); + expect(config.notifications.email.resendApiKey).toBe("re_test_key"); + expect(config.notifications.email.from).toBe("ADHD.ai "); + expect(config.notifications.email.to).toEqual([ + "a@example.com", + "b@example.com", + ]); + } finally { + await rm(tempDir, { recursive: true, force: true }); + } }); it("supports disabling notifications even with RESEND_API_KEY", async () => { @@ -314,12 +321,19 @@ describe("loadConfig", () => { }); it("rejects missing sender when notifications are enabled", async () => { + const tempDir = await mkdtemp( + path.join(process.cwd(), ".tmp-config-test-"), + ); process.env.RESEND_API_KEY = "re_test_key"; process.env.RESEND_FROM = ""; process.env.RESEND_TO = "a@example.com"; - await expect(loadConfig(process.cwd())).rejects.toThrow( - "notifications.email.from (or RESEND_FROM) is required when email notifications are enabled", - ); + try { + await expect(loadConfig(tempDir)).rejects.toThrow( + "notifications.email.from (or RESEND_FROM) is required when email notifications are enabled", + ); + } finally { + await rm(tempDir, { recursive: true, force: true }); + } }); it("rejects project-level notification overrides", async () => {