feat: IMAP mail sync with thread-to-contact matching (PRD §6.1)

Real IMAP connection via imapflow library:
- Connects to IMAP server (IMAPFlow, TLS on port 993)
- Fetches recent messages (configurable limit, default 20)
- Extracts: from, fromEmail, subject, date, snippet (200 chars)
- Thread-to-contact matching (PRD §6.1):
  1. Match sender email against persons table
  2. If no person match, extract domain and match against company.website
  3. Returns matchedCompany + matchedPerson for each email
- Audit-logged (action: crm.mailsync:imap)
- Zod validated (host, port, user, password, folder, limit)
- 502 on IMAP connection failure with detail
- 400 on validation failure

Tested: invalid creds → 502 'IMAP connection failed', missing host → 400
This commit is contained in:
Z User committed 2026-10-27 22:50:50 +00:00
1 parent 7acc0c5451
commit e45b68bb8b
1089 files changed
+260614

No files matched your search

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Zara Zhang
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:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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,97 @@
---
name: html-ppt-zhangzara-grove
description: Grove — 森林绿底 + 奶油色字 + Playfair 古典衬线 + 单一锈红 accent。任何应该感觉有机 / 考究 / 成熟的 deck:可持续与 wellness 品牌 / 户外自然产品 / 酒庄餐厅 / 文学艺术 deck / 咨询交付 / 双语 EN/CN 报告。
visibility: public
mode: template
carrier: deck
scenario: marketing
pattern_source: pattern.html
source_priority: skill-first
triggers:
- "做个森林绿 deck"
- "做个可持续品牌 PPT"
- "做个考究风演讲稿"
- "grove"
- "zhangzara-grove"
- "organic"
- "考究"
- "warm"
- "sustainability brand"
- "wellness brand"
- "html deck"
- "html slides"
- "zhangzara"
od:
upstream: "https://github.com/zarazhangrui/beautiful-html-templates/tree/main/templates/grove"
upstream_license: MIT
preview:
type: html
entry: pattern.html
design_system:
requires: false
speaker_notes: false
animations: false
---
# Grove
> Forest-green canvas with cream type, classical Playfair serifs, and a single rust accent.
A single self-contained HTML deck — typography, palette, decorative system,
and slide vocabulary are all tuned together. Mixing layouts across templates
breaks the system; stay inside this one.
## At a glance
- **Scheme:** mixed
- **Formality:** medium-high
- **Density:** medium
- **Slides in demo:** 12
## Best for
Anything that should feel organic, considered, and grown-up: sustainability and wellness brands, outdoor / nature products, wineries and restaurants, literary or arts decks, advisory deliverables, bilingual EN/CN reports. Also a calm, distinctive choice for tech, research, or business decks that want patience over urgency.
## Avoid for
Decks that need neon energy or rapid-fire pop — the forest-green canvas and Playfair serif commit to a slow, classical voice.
## Workflow
1. **Use `pattern.html` only as a secondary pattern reference.** Do not clone it wholesale; extract section rhythm, layout pattern, and interaction behavior, then rebuild for the current brief.
2. **Replace placeholder content** with the user's real headlines, body copy,
numbers, names, dates, and section labels. Match existing dimensions when
swapping image placeholders.
3. **Preserve the design system.** Never substitute fonts, recolor the palette,
restructure the layout grid, or strip decorative elements (corner brackets,
paper grain, geometric shapes, illustrated SVGs). They are part of the
identity.
4. **Adjust deck length by duplicating layouts.** If the user has more content
than the demo holds, duplicate an existing slide of the most appropriate
layout. If less, drop slides from the bottom. Update page-number labels.
5. **Designing missing layouts:** if a slide needs a layout the template
doesn't have, design it from scratch using the same fonts, palette,
decorative vocabulary, spacing rhythm, and component grammar — never bail
to a different template.
6. **Keep the navigation runtime as shipped.** If the deck ships an
`assets/deck-stage.js` or inline keyboard handler, leave it intact.
## Output contract
Emit between `<artifact>` tags:
```
<artifact identifier="zhangzara-grove" type="text/html" title="Deck Title">
<!doctype html>
<html>...</html>
</artifact>
```
## Source & license
Vendored from upstream MIT-licensed
[`zarazhangrui/beautiful-html-templates`](https://github.com/zarazhangrui/beautiful-html-templates/tree/main/templates/grove).
The full upstream MIT license text — including the original copyright notice — ships in this skill at
[`LICENSE`](./LICENSE) and must be redistributed alongside any copy of `pattern.html`,
`template.json`, or any vendored `assets/` runtime. See `template.json` for the upstream metadata snapshot.
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,51 @@
{
"slug": "zhangzara-grove",
"name": "Grove",
"tagline": "Forest-green canvas with cream type, classical Playfair serifs, and a single rust accent.",
"mood": [
"organic",
"considered",
"warm",
"literary",
"natural"
],
"occasion": [
"sustainability brand",
"wellness brand",
"outdoor / nature product",
"winery or restaurant",
"literary or arts deck",
"advisory deliverable",
"bilingual EN/CN deck"
],
"tone": [
"classical",
"warm",
"considered",
"patient"
],
"formality": "medium-high",
"density": "medium",
"palette": {
"bg": "#192b1b",
"bg_alt": "#1e3221",
"fg": "#d4cfbf",
"accent": "#c8524a",
"bg_light": "#e8e4d6",
"description": "deep forest green canvas with warm bone type and a single rust-red accent; alternate cream-paper mode for breathing room"
},
"typography": {
"display": "Playfair Display",
"body": "Jost",
"mono": "JetBrains Mono",
"serif_cn": "Noto Serif SC",
"sans_cn": "Noto Sans SC",
"style": "transitional serif headlines + clean geometric sans body + technical mono; full Chinese serif/sans support"
},
"scheme": "mixed",
"best_for": "Anything that should feel organic, considered, and grown-up: sustainability and wellness brands, outdoor / nature products, wineries and restaurants, literary or arts decks, advisory deliverables, bilingual EN/CN reports. Also a calm, distinctive choice for tech, research, or business decks that want patience over urgency.",
"avoid_for": "Decks that need neon energy or rapid-fire pop — the forest-green canvas and Playfair serif commit to a slow, classical voice.",
"slide_count": 12,
"navigation": "inline keyboard handler",
"source": "https://github.com/zarazhangrui/beautiful-html-templates/tree/main/templates/grove"
}