diff --git a/HOW_TO_USE_EMAIL_REPLY.md b/HOW_TO_USE_EMAIL_REPLY.md index 05ed0bc..959c9a6 100644 --- a/HOW_TO_USE_EMAIL_REPLY.md +++ b/HOW_TO_USE_EMAIL_REPLY.md @@ -1,5 +1,7 @@ # TaskPing 邮件回复功能使用指南 +[English](./HOW_TO_USE_EMAIL_REPLY_EN.md) | **中文** + ## 📋 完整使用流程 ### 步骤1:启动邮件监听服务 diff --git a/HOW_TO_USE_EMAIL_REPLY_EN.md b/HOW_TO_USE_EMAIL_REPLY_EN.md new file mode 100644 index 0000000..00fa3f0 --- /dev/null +++ b/HOW_TO_USE_EMAIL_REPLY_EN.md @@ -0,0 +1,156 @@ +# TaskPing Email Reply Feature Guide + +**English** | [中文](./HOW_TO_USE_EMAIL_REPLY.md) + +## 📋 Complete Usage Workflow + +### Step 1: Start Email Listening Service +Run in Terminal 1: +```bash +cd /Users/jessytsui/dev/TaskPing +npm run relay:pty +``` + +This will start the email listening service, monitoring replies to `noreply@example.com`. + +### Step 2: Start Claude Code and Integrate TaskPing +Run in Terminal 2: +```bash +# Start Claude Code +claude + +# Use TaskPing in Claude Code to send email notifications +# Example: Email notifications will be sent automatically when tasks complete +``` + +### Step 3: Configure Claude Code Hooks (if not configured) +Run in Claude Code: +```bash +# View current hook configuration +cat ~/.config/claude-code/settings/hooks.json + +# If not configured, set up TaskPing hooks +# Copy TaskPing's hook configuration file +``` + +## 📧 Email Reply Test Workflow + +### Method 1: Manual Email Test +```bash +# Run in TaskPing directory +node test-smtp-token.js +``` + +This will send a test email to `user@example.com` with a subject containing Token format: +`[TaskPing #XXXXXXXX] Claude Code Task Completed - TaskPing-Token-Test` + +### Method 2: Integration Test +1. Execute a task in Claude Code +2. After task completion, TaskPing will automatically send email notification +3. Email will be sent to configured mailbox (`user@example.com`) + +## 💌 How to Reply to Send Commands + +### After Receiving Email: +1. Receive email at `user@example.com` with subject like: + ``` + [TaskPing #A53PXR7F] Claude Code Task Completed - Project Name + ``` + +2. **Reply directly to the email** with commands in the body: + ``` + Continue optimizing code + ``` + or + ``` + Generate unit tests + ``` + or + ``` + Explain the purpose of this function + ``` + +3. After sending reply, the email listening service will: + - Receive the reply email + - Extract the Token (A53PXR7F) + - Find corresponding PTY session + - Inject command into Claude Code CLI + +## 🔧 Configuration File Description + +### .env Configuration +```env +# Outgoing Mail Configuration (Feishu Email) +SMTP_HOST=smtp.feishu.cn +SMTP_USER=noreply@example.com +SMTP_PASS=your-smtp-password + +# Incoming Mail Configuration (Feishu Email) +IMAP_HOST=imap.feishu.cn +IMAP_USER=noreply@example.com +IMAP_PASS=your-imap-password + +# User Notification Email +EMAIL_TO=user@example.com + +# Allowed Command Senders (Security Whitelist) +ALLOWED_SENDERS=user@example.com +``` + +## 🐛 Troubleshooting + +### 1. Not Receiving Email Replies +Check: +- Email listening service is running (`npm run relay:pty`) +- Reply is sent from whitelisted email (`user@example.com`) +- Email subject contains correct Token format + +### 2. Commands Not Injected into Claude Code +Check: +- Claude Code is still running +- PTY session is still valid (Token not expired) +- Check service log output + +### 3. View Debug Logs +```bash +# View detailed email listening logs +DEBUG=true npm run relay:pty +``` + +## 📱 Supported Email Clients + +Users can reply from any email to `noreply@example.com`: +- ✅ Gmail Web/Client +- ✅ Mobile Gmail App +- ✅ Apple Mail +- ✅ Outlook +- ✅ QQ Mail +- ✅ 163 Mail +- ✅ Any SMTP-supported email + +## 🔒 Security Features + +1. **Token Verification**: Each session has unique Token to prevent misoperation +2. **Sender Whitelist**: Only authorized emails can send commands +3. **Session Expiry**: Token valid for 24 hours +4. **Command Filtering**: Automatically filters potentially dangerous commands + +## 🎯 Real-world Use Cases + +### Scenario 1: Long Build Process +``` +1. Start project build in Claude Code +2. Leave computer, receive build completion email on phone +3. Reply directly from phone: "Continue deployment to production" +4. Deployment completed when returning to computer +``` + +### Scenario 2: Code Review +``` +1. Claude Code completes code generation +2. Receive email notification +3. Reply: "Please add unit tests and documentation" +4. Claude automatically generates tests and docs +``` + +This enables true remote control of Claude Code! \ No newline at end of file diff --git a/README.md b/README.md index 68bf7bc..2cf02c4 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,8 @@ claude 3. **Reply to emails** with new commands 4. **Commands execute automatically** in Claude +📖 **Detailed Email Reply Guide**: [English](./HOW_TO_USE_EMAIL_REPLY_EN.md) | [中文](./HOW_TO_USE_EMAIL_REPLY.md) + ### Example Email Flow **📩 Notification received:** diff --git a/src/data/processed-messages.json b/src/data/processed-messages.json index 94b8102..1eccd07 100644 --- a/src/data/processed-messages.json +++ b/src/data/processed-messages.json @@ -1,26 +1,38 @@ [ { "id": 1312, - "timestamp": 1753626443001 + "timestamp": 1753632056082 }, { "id": 1315, - "timestamp": 1753626443001 + "timestamp": 1753632056082 }, { "id": 1310, - "timestamp": 1753626443001 + "timestamp": 1753632056082 }, { "id": 1323, - "timestamp": 1753626443001 + "timestamp": 1753632056082 }, { "id": 1331, - "timestamp": 1753626443001 + "timestamp": 1753632056082 }, { "id": 1334, - "timestamp": 1753626443001 + "timestamp": 1753632056082 + }, + { + "id": 1342, + "timestamp": 1753632056082 + }, + { + "id": 1346, + "timestamp": 1753632056082 + }, + { + "id": 1348, + "timestamp": 1753632056082 } ] \ No newline at end of file diff --git a/src/data/session-map.json b/src/data/session-map.json index 510de36..cb7f59e 100644 --- a/src/data/session-map.json +++ b/src/data/session-map.json @@ -214,5 +214,311 @@ "sessionId": "f8f915ee-ab64-471c-b3d2-71cb84d2b5fe", "tmuxSession": "video", "description": "completed - Claude-Code-Remote" + }, + "FU0A5E79": { + "type": "pty", + "createdAt": 1753627838, + "expiresAt": 1753714238, + "cwd": "/Users/jessytsui/dev/coverr_video", + "sessionId": "1df42826-eb8e-47ee-bc5a-5886a1234d84", + "tmuxSession": "video", + "description": "completed - coverr_video" + }, + "W3Y4UNV2": { + "type": "pty", + "createdAt": 1753627955, + "expiresAt": 1753714355, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "23f16dc9-4668-4f34-b650-7919d325efd9", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "69PWGS1L": { + "type": "pty", + "createdAt": 1753628092, + "expiresAt": 1753714492, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "8e847e83-677c-4b6a-9be8-184615731c9a", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "BP5WJBYZ": { + "type": "pty", + "createdAt": 1753631837, + "expiresAt": 1753718237, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "0c7ba308-f6da-44bc-a622-8bdb4c7613a5", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "IS18V1WH": { + "type": "pty", + "createdAt": 1753631949, + "expiresAt": 1753718349, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "563a4b27-f459-40fa-aa7b-df9c46643bab", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "QGLEAJLO": { + "type": "pty", + "createdAt": 1753632059, + "expiresAt": 1753718459, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "e81186b8-c990-42a7-a1ec-16009e671f32", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "66VKI9JR": { + "type": "pty", + "createdAt": 1753633791, + "expiresAt": 1753720191, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "29afd212-bfbb-443e-8e9f-7c4a08a9f178", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "MROLF6JQ": { + "type": "pty", + "createdAt": 1753633885, + "expiresAt": 1753720285, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "6856d493-a825-45e9-ad87-d3dab6ebd3ed", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "JH6IROYI": { + "type": "pty", + "createdAt": 1753635239, + "expiresAt": 1753721639, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "40829580-9b42-45c2-af54-994343101a4b", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "18E1GX7G": { + "type": "pty", + "createdAt": 1753635293, + "expiresAt": 1753721693, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "d9524fbe-8915-4175-89e0-9358ccd86921", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "8CZC4SWF": { + "type": "pty", + "createdAt": 1753635381, + "expiresAt": 1753721781, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "5d7673c5-5541-4c71-8f33-8270cde90376", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "L40V7BIU": { + "type": "pty", + "createdAt": 1753636194, + "expiresAt": 1753722594, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "b4112f01-a8f5-44fe-8bb6-85b1f16d5cd9", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "X0PKR9KZ": { + "type": "pty", + "createdAt": 1753636706, + "expiresAt": 1753723106, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "77747aee-ec17-4356-86be-ca20245eaa4c", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "K3G8GEM4": { + "type": "pty", + "createdAt": 1753636765, + "expiresAt": 1753723165, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "5b70bf42-ed29-4004-afad-a337be665c74", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "1U1074XQ": { + "type": "pty", + "createdAt": 1753636941, + "expiresAt": 1753723341, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "212bd122-ff8e-4299-88cc-93fed221ad2b", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "04Z5FEHE": { + "type": "pty", + "createdAt": 1753637049, + "expiresAt": 1753723449, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "da16cada-9121-47c7-b7b8-4b47cbc46c7c", + "tmuxSession": "claude-taskping", + "description": "completed - Claude-Code-Remote" + }, + "MSRLCGLS": { + "type": "pty", + "createdAt": 1753638288, + "expiresAt": 1753724688, + "cwd": "/Users/jessytsui", + "sessionId": "d245e06c-9595-48f9-8ef1-c3f826352d75", + "tmuxSession": "claude-taskping", + "description": "completed - jessytsui" + }, + "7O21O9ZR": { + "type": "pty", + "createdAt": 1753638308, + "expiresAt": 1753724708, + "cwd": "/Users/jessytsui", + "sessionId": "6ec8789d-5eb0-4138-9180-f32559336906", + "tmuxSession": "claude-taskping", + "description": "completed - jessytsui" + }, + "4S5KSCI3": { + "type": "pty", + "createdAt": 1753639559, + "expiresAt": 1753725959, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "302103bd-522f-4349-8041-979a62c606d8", + "tmuxSession": "claude-code-remote", + "description": "completed - Claude-Code-Remote" + }, + "VR3AB0NO": { + "type": "pty", + "createdAt": 1753640175, + "expiresAt": 1753726575, + "cwd": "/Users/jessytsui/dev/coverr_video", + "sessionId": "6808bb5d-4268-4f46-aad7-0f01677f781e", + "tmuxSession": "claude-code-remote", + "description": "completed - coverr_video" + }, + "RACVYH67": { + "type": "pty", + "createdAt": 1753640283, + "expiresAt": 1753726683, + "cwd": "/Users/jessytsui/dev/coverr_video", + "sessionId": "4d23ece0-6931-4d6d-bb89-b2ba2709bba6", + "tmuxSession": "claude-code-remote", + "description": "completed - coverr_video" + }, + "XBUMC8TX": { + "type": "pty", + "createdAt": 1753640359, + "expiresAt": 1753726759, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "50436697-1576-4f70-9ea7-39ae61261192", + "tmuxSession": "claude-code-remote", + "description": "completed - Claude-Code-Remote" + }, + "6L3BS2G9": { + "type": "pty", + "createdAt": 1753640370, + "expiresAt": 1753726770, + "cwd": "/Users/jessytsui/dev/coverr_video", + "sessionId": "5ec3baf8-8dcd-44b6-9583-4fac336c92e2", + "tmuxSession": "claude-code-remote", + "description": "completed - coverr_video" + }, + "ODFO312K": { + "type": "pty", + "createdAt": 1753640410, + "expiresAt": 1753726810, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "616f15e8-0ae6-4a3b-ac02-373bca701630", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "6XWPQCEF": { + "type": "pty", + "createdAt": 1753640528, + "expiresAt": 1753726928, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "b6d2d75b-c4b7-46cb-b922-d4f935e5424d", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "ZGXY36O1": { + "type": "pty", + "createdAt": 1753640690, + "expiresAt": 1753727090, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "3ce40b4d-3273-4662-a6cf-ead30c91f950", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "MUE5LCUY": { + "type": "pty", + "createdAt": 1753684860, + "expiresAt": 1753771260, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "698b6d2e-32f0-4eaa-8aa4-5bbf408b9640", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "KZVOG2PO": { + "type": "pty", + "createdAt": 1753684912, + "expiresAt": 1753771312, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "0f63ad7f-2312-427f-b1e6-d186a6be3667", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "5HDFXY41": { + "type": "pty", + "createdAt": 1753684929, + "expiresAt": 1753771329, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "22481ebb-0f9f-4f52-9668-347ed0fb0f98", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "NHXQJN3L": { + "type": "pty", + "createdAt": 1753685042, + "expiresAt": 1753771442, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "a1b56007-ef57-48bb-8aa7-449bc5f9b1f7", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "84LX5NLI": { + "type": "pty", + "createdAt": 1753685161, + "expiresAt": 1753771561, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "3535a857-c5da-4764-9367-9816955bfc30", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "3WYHK10U": { + "type": "pty", + "createdAt": 1753685478, + "expiresAt": 1753771878, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "68eca4f9-79f4-4047-ab98-636cd742deee", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "INZLQTW0": { + "type": "pty", + "createdAt": 1753685542, + "expiresAt": 1753771942, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "4bc09041-a751-43c0-93e1-f3b5a69d6aa1", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" + }, + "TPV9W6VE": { + "type": "pty", + "createdAt": 1753685640, + "expiresAt": 1753772040, + "cwd": "/Users/jessytsui/dev/Claude-Code-Remote", + "sessionId": "023bb55f-acc0-4d8a-a2f4-79be0bd9a863", + "tmuxSession": "video", + "description": "completed - Claude-Code-Remote" } } \ No newline at end of file