Files
Zero/scripts/run.ts
Adam 18314cd088 Enable spam email processing and improve label management workflow (#1948)
# Improved Email Labeling System with DEV_PROXY Support

## Description

This PR enhances the email labeling workflow with a more sophisticated approach to label management. It replaces the previous labeling system with a new implementation that better handles existing labels and user-defined topics.

Key improvements:
- Added DEV_PROXY environment variable to support local development
- Implemented a more robust label suggestion system that prioritizes existing account labels
- Added ability to create missing labels when appropriate
- Modified thread workflow to reload inbox after syncing
- Enabled processing of messages marked as spam (commented out spam filtering)
- Added a test:cron script for local testing of scheduled handlers

## Type of Change

- [x]  New feature (non-breaking change which adds functionality)
- [x] 🐛 Bug fix (non-breaking change which fixes an issue)
- [x]  Performance improvement

## Areas Affected

- [x] Email Integration (Gmail, IMAP, etc.)
- [x] Development Workflow

## Testing Done

- [x] Manual testing performed

## Checklist

- [x] I have performed a self-review of my code
- [x] My changes generate no new warnings
- [x] I have updated the documentation

## Additional Notes

The new labeling system now follows a three-step process:
1. Retrieves existing user account labels
2. Gets user-defined topics for potential new labels
3. Intelligently suggests and applies labels, prioritizing existing ones

The DEV_PROXY environment variable allows for easier local development by redirecting notification requests through a local proxy when configured.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Improved label suggestion and synchronization, now incorporating user topics and existing labels for more accurate email organization.
  * Added spam detection to prevent intent analysis on spam-tagged messages.
  * Enhanced workflow steps for label management, including new steps for user topic retrieval and label suggestion generation.

* **Bug Fixes**
  * Messages labeled as spam are now properly excluded from certain processing steps.

* **Chores**
  * Updated environment variable defaults to enable workflows in local and staging environments.
  * Added a new script for testing scheduled tasks via a local endpoint.
  * Disabled the "seed-style" CLI command.

* **Other Improvements**
  * Inbox folder now reloads automatically after thread updates.
  * Improved logging for thread processing and label synchronization.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-07 14:23:01 -07:00

15 lines
358 B
TypeScript

import { sendEmailsCommand } from './send-emails/index';
// import { seedStyleCommand } from './seed-style/seeder';
import { subcommands, run } from 'cmd-ts';
const app = subcommands({
name: 'scripts',
cmds: {
// 'seed-style': seedStyleCommand,
'send-emails': sendEmailsCommand,
},
});
await run(app, process.argv.slice(2));
process.exit(0);