@realtimex/email-automator 2.23.5 → 2.23.7

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 (26) hide show
  1. package/api/src/services/defaultRules/development.ts +123 -79
  2. package/api/src/services/defaultRules/emailOrg.ts +80 -93
  3. package/api/src/services/defaultRules/operations.ts +60 -88
  4. package/api/src/services/defaultRules/priority.ts +48 -76
  5. package/api/src/services/defaultRules/salesBusiness.ts +148 -34
  6. package/api/src/services/defaultRules/types.ts +1 -0
  7. package/dist/api/src/services/defaultRules/development.js +118 -79
  8. package/dist/api/src/services/defaultRules/emailOrg.js +75 -93
  9. package/dist/api/src/services/defaultRules/operations.js +57 -88
  10. package/dist/api/src/services/defaultRules/priority.js +46 -76
  11. package/dist/api/src/services/defaultRules/salesBusiness.js +142 -34
  12. package/dist/assets/{es-C53Z9pEQ.js → es-CUs1SbHI.js} +1 -1
  13. package/dist/assets/{fr-CTksqdvo.js → fr-BPxHcEwt.js} +1 -1
  14. package/dist/assets/{index-C1_s4TFc.js → index-DZQnqMV-.js} +20 -20
  15. package/dist/assets/index-DmS7wnaU.css +1 -0
  16. package/dist/assets/{ja-Dvm0bRM4.js → ja-DmCVk5Xs.js} +1 -1
  17. package/dist/assets/{ko-CgJQAwfF.js → ko-Hn7rPT_g.js} +1 -1
  18. package/dist/assets/{vi-mg0Gxysw.js → vi-DZcpqfWU.js} +1 -1
  19. package/dist/index.html +2 -2
  20. package/docs/FRESH_DEPLOYMENT_FIX.md +200 -0
  21. package/docs/MIGRATION_FIX_20260206.md +349 -0
  22. package/package.json +1 -1
  23. package/supabase/migrations/20260206000000_restore_rule_templates.sql +295 -0
  24. package/supabase/migrations/20260206000010_fix_trigger_naming_conflict.sql +214 -0
  25. package/supabase/migrations/20260206000011_add_rules_unique_constraint.sql +35 -0
  26. package/dist/assets/index-D4JdJS8Y.css +0 -1
@@ -2,134 +2,178 @@
2
2
  * Development Rules
3
3
  *
4
4
  * Rules for software engineers and technical teams:
5
- * - System alert prioritization
6
- * - CI/CD and monitoring notifications
7
- * - Code review highlights
8
- * - Project management tool organization
5
+ * - GitHub mentions and assignments
6
+ * - CI/CD failure alerts
7
+ * - Dependabot cleanup
8
+ * - Code review tracking with draft automation
9
+ * - Monitoring alert cleanup
10
+ * - Weekly reports cleanup
9
11
  */
10
12
 
11
13
  import { DefaultRule } from './types.js';
12
14
 
13
15
  export const DEVELOPMENT_RULES: DefaultRule[] = [
16
+ // Rule 11: GitHub Mentions
14
17
  {
15
- id: 'system-alerts-prioritizer',
18
+ id: 'dev-github-mentions',
16
19
  category: 'development',
17
- name: '🚨 System Alerts Prioritizer',
18
- intent: 'Prioritize critical system alerts and incidents',
19
- description: 'Stars critical alerts from AWS, Datadog, Sentry, PagerDuty while archiving info-level notifications',
20
+ name: '👤 GitHub Mentions',
21
+ intent: 'Keep mention and assignment notifications discoverable',
22
+ description: 'Labels GitHub mentions and assignments for tracking',
20
23
  condition: {
21
- or: [
24
+ and: [
22
25
  {
23
- sender_domain: 'aws.amazon.com',
24
- contains_keywords: ['critical', 'down', 'outage', 'incident']
26
+ or: [
27
+ { category: 'notification' },
28
+ { category: 'internal' }
29
+ ]
25
30
  },
31
+ { contains_keywords: ['@', 'mentioned you', 'assigned you', 'requested your review'] },
26
32
  {
27
- sender_domain: 'datadoghq.com',
28
- contains_keywords: ['alert', 'critical', 'error rate']
29
- },
30
- {
31
- sender_domain: 'sentry.io',
32
- contains_keywords: ['new issue', 'regression', 'error']
33
- },
34
- {
35
- sender_domain: 'pagerduty.com',
36
- contains_keywords: ['triggered', 'incident']
33
+ or: [
34
+ { sender_domain: 'github.com' },
35
+ { sender_domain: 'gitlab.com' }
36
+ ]
37
37
  }
38
38
  ]
39
39
  },
40
- actions: ['star', 'important', 'pin'],
41
- priority: 100,
40
+ actions: ['label:GitHub/Mentions'],
41
+ priority: 80,
42
42
  is_enabled_by_default: true
43
43
  },
44
+
45
+ // Rule 12: CI/CD Failures
44
46
  {
45
- id: 'system-info-organizer',
47
+ id: 'dev-ci-failures',
46
48
  category: 'development',
47
- name: '⚠️ System Info Organizer',
48
- intent: 'Archive non-critical system notifications',
49
- description: 'Archives info and warning level alerts from monitoring tools',
49
+ name: ' CI/CD Failures',
50
+ intent: 'Escalate build/deploy failures for faster recovery',
51
+ description: 'Stars CI/CD failure notifications for immediate attention',
50
52
  condition: {
51
- or: [
53
+ and: [
54
+ { category: 'notification' },
55
+ { contains_keywords: ['failed', 'failure', 'error', 'broken', 'build failed'] },
52
56
  {
53
- sender_domain: 'aws.amazon.com',
54
- not: {
55
- contains_keywords: ['critical', 'down', 'outage']
56
- }
57
- },
57
+ or: [
58
+ { sender_domain: 'circleci.com' },
59
+ { sender_domain: 'github.com' },
60
+ { sender_domain: 'gitlab.com' },
61
+ { sender_domain: 'travis-ci.com' }
62
+ ]
63
+ }
64
+ ]
65
+ },
66
+ actions: ['star', 'label:CI/Failures'],
67
+ priority: 90,
68
+ is_enabled_by_default: true
69
+ },
70
+
71
+ // Rule 13: Dependabot Noise
72
+ {
73
+ id: 'dev-dependabot',
74
+ category: 'development',
75
+ name: '🤖 Dependabot Noise',
76
+ intent: 'Reduce low-priority dependency update noise',
77
+ description: 'Deletes non-security Dependabot notifications older than 14 days',
78
+ condition: {
79
+ and: [
58
80
  {
59
- sender_domain: 'datadoghq.com',
60
- contains_keywords: ['info', 'warning', 'recovered']
81
+ or: [
82
+ { category: 'notification' },
83
+ { category: 'newsletter' }
84
+ ]
61
85
  },
86
+ { contains_keywords: ['dependabot', 'dependency', 'package update'] },
62
87
  {
63
- sender_domain: 'circleci.com'
88
+ not: { contains_keywords: ['security', 'vulnerability', 'CVE'] }
64
89
  },
65
- {
66
- sender_domain: 'github.com',
67
- contains_keywords: ['build', 'workflow']
68
- }
90
+ { older_than_days: 14 }
69
91
  ]
70
92
  },
71
- actions: ['label:Logs', 'archive'],
72
- priority: 20,
93
+ actions: ['delete'],
94
+ priority: 15,
73
95
  is_enabled_by_default: true
74
96
  },
97
+
98
+ // Rule 14: Code Review Requests
75
99
  {
76
- id: 'project-management-organizer',
100
+ id: 'dev-code-review',
77
101
  category: 'development',
78
- name: '🔨 Project Management Organizer',
79
- intent: 'Organize Jira, GitHub, and project management notifications',
80
- description: 'Archives project management notifications unless you\'re directly assigned',
102
+ name: '👀 Code Review Requests',
103
+ intent: 'Track review requests and draft quick acknowledgments',
104
+ description: 'Labels code review requests and drafts acknowledgment',
81
105
  condition: {
82
- or: [
106
+ and: [
83
107
  {
84
- sender_domain: 'atlassian.net',
85
- not: {
86
- contains_keywords: ['assigned to you', 'mentioned you']
87
- }
108
+ or: [
109
+ { category: 'internal' },
110
+ { category: 'notification' }
111
+ ]
88
112
  },
113
+ { contains_keywords: ['review requested', 'pull request', 'merge request', 'PR'] },
114
+ { confidence_gt: 0.70 }
115
+ ]
116
+ },
117
+ actions: ['label:GitHub/Review Requests', 'draft'],
118
+ instructions: 'Acknowledge review request. Provide estimated review timeline. Ask for context if needed.',
119
+ priority: 80,
120
+ is_enabled_by_default: true
121
+ },
122
+
123
+ // Rule 15: Monitoring Alerts
124
+ {
125
+ id: 'dev-monitoring',
126
+ category: 'development',
127
+ name: '⚠️ Monitoring Alerts',
128
+ intent: 'Tidy non-urgent monitoring alerts while keeping labels',
129
+ description: 'Labels and deletes non-urgent monitoring alerts older than 14 days',
130
+ condition: {
131
+ and: [
89
132
  {
90
- sender_domain: 'github.com',
91
- not: {
92
- contains_keywords: ['assigned', 'review requested', '@']
93
- }
133
+ or: [
134
+ { category: 'notification' },
135
+ { category: 'support' }
136
+ ]
94
137
  },
95
138
  {
96
- sender_domain: 'asana.com',
97
- not: {
98
- contains_keywords: ['assigned to you']
99
- }
139
+ not: { contains_keywords: ['critical', 'urgent', 'down', 'outage'] }
100
140
  },
101
141
  {
102
- sender_domain: 'trello.com'
142
+ or: [
143
+ { sender_domain: 'datadog.com' },
144
+ { sender_domain: 'pingdom.com' },
145
+ { sender_domain: 'sentry.io' }
146
+ ]
103
147
  },
104
- {
105
- sender_domain: 'monday.com'
106
- }
148
+ { older_than_days: 14 }
107
149
  ]
108
150
  },
109
- actions: ['label:Tools', 'archive'],
110
- priority: 15,
151
+ actions: ['label:Monitoring', 'delete'],
152
+ priority: 20,
111
153
  is_enabled_by_default: true
112
154
  },
155
+
156
+ // Rule 7: Weekly Reports
113
157
  {
114
- id: 'code-reviews-highlighter',
158
+ id: 'exec-reports',
115
159
  category: 'development',
116
- name: '👀 Code Review Highlighter',
117
- intent: 'Highlight pull request reviews and assignments',
118
- description: 'Stars GitHub/GitLab notifications where your review is requested',
160
+ name: '📊 Weekly Reports',
161
+ intent: 'Keep reports structured and remove stale report traffic',
162
+ description: 'Labels reports and deletes them after 30 days',
119
163
  condition: {
120
- or: [
164
+ and: [
121
165
  {
122
- sender_domain: 'github.com',
123
- contains_keywords: ['review requested', 'requested your review']
166
+ or: [
167
+ { category: 'internal' },
168
+ { category: 'client' }
169
+ ]
124
170
  },
125
- {
126
- sender_domain: 'gitlab.com',
127
- contains_keywords: ['review', 'merge request']
128
- }
171
+ { contains_keywords: ['weekly report', 'status report', 'metrics', 'dashboard'] },
172
+ { older_than_days: 30 }
129
173
  ]
130
174
  },
131
- actions: ['star'],
132
- priority: 80,
133
- is_enabled_by_default: true
175
+ actions: ['label:Reports', 'delete'],
176
+ priority: 10,
177
+ is_enabled_by_default: false
134
178
  }
135
179
  ];
@@ -2,153 +2,140 @@
2
2
  * Email Organization Rules
3
3
  *
4
4
  * Rules for keeping inbox clean through automated organization:
5
- * - Newsletter management
6
- * - Cold outreach filtering
7
- * - CC/FYI organization
5
+ * - Newsletter cleanup with age-based deletion
6
+ * - Cold outreach filtering with draft automation
7
+ * - CC organization
8
8
  * - Receipt labeling
9
+ * - Social media noise reduction
10
+ * - Stack Overflow digest cleanup
9
11
  */
10
12
 
11
13
  import { DefaultRule } from './types.js';
12
14
 
13
15
  export const EMAIL_ORG_RULES: DefaultRule[] = [
16
+ // Rule 1: Newsletter Sweeper
14
17
  {
15
- id: 'newsletters-auto-archive',
18
+ id: 'universal-newsletters',
16
19
  category: 'email_organization',
17
20
  name: '📚 Newsletter Sweeper',
18
- intent: 'Keep newsletters organized and out of main inbox',
19
- description: 'Automatically archives newsletters and mass-marketing emails so you can read them later without inbox clutter',
21
+ intent: 'Remove low-value newsletters/news updates from inbox after short retention',
22
+ description: 'Deletes newsletters and news digests older than 7 days to keep inbox clean',
20
23
  condition: {
21
- category: 'newsletter',
22
- confidence_gt: 0.7
24
+ and: [
25
+ {
26
+ or: [
27
+ { category: 'newsletter' },
28
+ { category: 'news' }
29
+ ]
30
+ },
31
+ { confidence_gt: 0.81 },
32
+ { older_than_days: 7 }
33
+ ]
23
34
  },
24
- actions: ['archive'],
35
+ actions: ['delete'],
25
36
  priority: 10,
26
37
  is_enabled_by_default: true
27
38
  },
39
+
40
+ // Rule 2: Cold Outreach Filter
28
41
  {
29
- id: 'cold-outreach-filter',
42
+ id: 'universal-cold-outreach',
30
43
  category: 'email_organization',
31
44
  name: '❄️ Cold Outreach Filter',
32
- intent: 'Filter unsolicited sales and marketing emails',
33
- description: 'Identifies and archives cold emails from unknown senders with sales language',
45
+ intent: 'Route cold outreach and prepare a polite response draft',
46
+ description: 'Labels cold outreach and generates polite decline/interest draft responses',
34
47
  condition: {
35
- or: [
48
+ and: [
36
49
  {
37
- // High-confidence promotional emails that are first contact
38
- category: 'promotional',
39
- confidence_gt: 0.85,
40
- is_first_contact: true
50
+ or: [
51
+ { category: 'promotional' },
52
+ { category: 'client' }
53
+ ]
41
54
  },
42
- {
43
- // Spam category (very high confidence)
44
- category: 'spam',
45
- confidence_gt: 0.9
46
- }
55
+ { recipient_type: 'bcc' },
56
+ { confidence_gt: 0.70 }
47
57
  ]
48
58
  },
49
- actions: ['archive'],
59
+ actions: ['label:Sales/Cold Outreach', 'draft'],
60
+ instructions: 'Politely acknowledge the outreach. If not interested, thank them and decline. If potentially interested, ask for more details.',
50
61
  priority: 20,
51
62
  is_enabled_by_default: true
52
63
  },
64
+
65
+ // Rule 3: CC Organizer
53
66
  {
54
- id: 'cc-fyi-organizer',
67
+ id: 'universal-cc-organizer',
55
68
  category: 'email_organization',
56
- name: '👀 CC/FYI Organizer',
57
- intent: 'Keep inbox focused on direct communications',
58
- description: 'Archives emails where you\'re CC\'d in group threads, keeping your inbox for direct messages',
69
+ name: '👀 CC Organizer',
70
+ intent: 'Label CC traffic for quick triage',
71
+ description: 'Labels emails where you are CC\'d for easier filtering and batch review',
59
72
  condition: {
60
- recipient_type: 'cc',
61
- recipient_count_gt: 3 // Group emails (more than 3 recipients)
73
+ recipient_type: 'cc'
62
74
  },
63
- actions: ['archive'],
75
+ actions: ['label:CC'],
64
76
  priority: 5,
65
77
  is_enabled_by_default: true
66
78
  },
79
+
80
+ // Rule 4: Receipt Organizer
67
81
  {
68
- id: 'receipts-organizer',
82
+ id: 'universal-receipts',
69
83
  category: 'email_organization',
70
84
  name: '🧾 Receipt Organizer',
71
- intent: 'Auto-label receipts for easy tax and expense retrieval',
72
- description: 'Labels transactional emails (receipts, invoices, confirmations) for easy searching',
85
+ intent: 'Preserve receipts for tracing, audit, and tax filing',
86
+ description: 'Labels transactional emails (receipts, invoices) for easy searching and tax filing',
73
87
  condition: {
74
- category: 'transactional',
75
- contains_keywords: ['receipt', 'invoice', 'payment', 'order confirmation', 'purchase'],
76
- confidence_gt: 0.75
88
+ and: [
89
+ { category: 'transactional' },
90
+ { confidence_gt: 0.90 },
91
+ { contains_keywords: ['receipt', 'invoice', 'payment', 'order confirmation', 'purchase'] }
92
+ ]
77
93
  },
78
- actions: ['label:Finance/Receipts'],
94
+ actions: ['label:Receipts'],
79
95
  priority: 15,
80
96
  is_enabled_by_default: true
81
97
  },
98
+
99
+ // Rule 8: Social Noise
82
100
  {
83
- id: 'social-notifications-archiver',
84
- category: 'email_organization',
85
- name: '🔔 Social Media Archiver',
86
- intent: 'Archive social media notifications',
87
- description: 'Automatically archives LinkedIn, Twitter, and other social notifications',
88
- condition: {
89
- category: 'social',
90
- confidence_gt: 0.8
91
- },
92
- actions: ['archive'],
93
- priority: 5,
94
- is_enabled_by_default: true
95
- },
96
- {
97
- id: 'calendar-responses-cleaner',
101
+ id: 'exec-social',
98
102
  category: 'email_organization',
99
- name: '📅 Calendar Response Cleaner',
100
- intent: 'Clean up calendar accept/decline notifications',
101
- description: 'Deletes automatic calendar responses that don\'t contain custom messages',
103
+ name: '🔔 Social Noise',
104
+ intent: 'Reduce social updates that do not require action',
105
+ description: 'Deletes social media notifications older than 7 days (LinkedIn, Twitter, etc.)',
102
106
  condition: {
103
- contains_keywords: ['accepted:', 'declined:', 'tentative:'],
104
- not: {
105
- recipient_type: 'to' // Don't delete if you're the only recipient
106
- }
107
+ and: [
108
+ { category: 'social' },
109
+ { confidence_gt: 0.81 },
110
+ { older_than_days: 7 }
111
+ ]
107
112
  },
108
113
  actions: ['delete'],
109
- priority: 10,
110
- is_enabled_by_default: false // Disabled by default - deletion is aggressive
111
- },
112
- {
113
- id: 'drive-shares-organizer',
114
- category: 'email_organization',
115
- name: '📂 Drive Share Organizer',
116
- intent: 'Archive Google Drive/Docs share notifications',
117
- description: 'Archives notifications about shared documents (usually redundant)',
118
- condition: {
119
- sender_domain: 'google.com',
120
- contains_keywords: ['shared', 'document', 'commented on', 'mentioned you in']
121
- },
122
- actions: ['label:Drive', 'archive'],
123
114
  priority: 5,
124
115
  is_enabled_by_default: true
125
116
  },
117
+
118
+ // Rule 16: Stack Overflow Digests
126
119
  {
127
- id: 'meeting-recordings-archiver',
120
+ id: 'dev-stack-overflow',
128
121
  category: 'email_organization',
129
- name: '📹 Meeting Recording Archiver',
130
- intent: 'Archive meeting recordings and transcripts',
131
- description: 'Automatically archives Zoom, Teams, and AI note-taker recordings',
122
+ name: '💻 Stack Overflow Digests',
123
+ intent: 'Remove stale Stack Overflow digests from inbox',
124
+ description: 'Deletes Stack Overflow digest emails older than 7 days',
132
125
  condition: {
133
- or: [
126
+ and: [
134
127
  {
135
- sender_domain: 'zoom.us',
136
- contains_keywords: ['recording', 'cloud recording']
128
+ or: [
129
+ { category: 'newsletter' },
130
+ { category: 'news' }
131
+ ]
137
132
  },
138
- {
139
- sender_domain: 'microsoft.com',
140
- contains_keywords: ['recording', 'teams recording']
141
- },
142
- {
143
- sender_domain: 'fireflies.ai'
144
- },
145
- {
146
- sender_domain: 'otter.ai'
147
- }
133
+ { contains_keywords: ['stack overflow', 'stackoverflow'] },
134
+ { older_than_days: 7 }
148
135
  ]
149
136
  },
150
- actions: ['label:Recordings', 'archive'],
151
- priority: 10,
152
- is_enabled_by_default: true
137
+ actions: ['delete'],
138
+ priority: 5,
139
+ is_enabled_by_default: false
153
140
  }
154
141
  ];