Skip to content

Commit 1dd8168

Browse files
committed
docs(notify): replace terminal notification examples with Feishu webhook example
- Remove iTerm2/Windows Terminal OSC 9, macOS osascript, Linux notify-send, and Windows msg examples (OSC 9 is not compatible with current spawn+stdio:ignore architecture) - Add Feishu (Lark) webhook notification example in both Chinese and English docs - Keep the env variable table (DURATION, STATUS, FAIL_REASON, BODY, TITLE) unchanged
1 parent 65064e7 commit 1dd8168

2 files changed

Lines changed: 54 additions & 78 deletions

File tree

docs/configuration.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,53 +83,41 @@ Deep Code 使用 `settings.json` 设置文件进行持久化配置,支持两
8383
}
8484
```
8585

86-
**终端内通知示例(支持 iTerm2 / Windows Terminal)**
87-
88-
如果你的终端是 iTerm2 或 Windows Terminal,可以直接通过 OSC 9 转义序列弹出终端原生通知,无需额外依赖。创建以下脚本(如 `~/.deepcode/notify.sh`):
86+
**飞书 Webhook 通知示例**
8987

9088
```bash
9189
#!/bin/bash
92-
# iTerm2 / Windows Terminal OSC 9 通知
93-
printf '\x1b]9;DeepCode: task %s (%ss)\x07' "${STATUS:-completed}" "${DURATION}"
94-
```
90+
# 飞书 Webhook 通知
91+
WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxx"
9592

96-
```json
93+
curl -s -X POST "$WEBHOOK_URL" \
94+
-H "Content-Type: application/json" \
95+
-d "$(cat <<EOF
9796
{
98-
"notify": "/Users/you/.deepcode/notify.sh"
97+
"msg_type": "interactive",
98+
"card": {
99+
"header": {
100+
"title": {
101+
"tag": "plain_text",
102+
"content": "DeepCode: task ${STATUS:-completed}"
103+
}
104+
},
105+
"elements": [
106+
{
107+
"tag": "div",
108+
"text": {
109+
"tag": "lark_md",
110+
"content": "**${TITLE:-Untitled}**\\n耗时 ${DURATION}s"
111+
}
112+
}
113+
]
114+
}
99115
}
116+
EOF
117+
)"
100118
```
101119

102-
Windows 用户如使用 Git Bash,上述脚本同样可用;也可创建 `.bat` 脚本:
103-
104-
```batch
105-
@echo off
106-
REM Windows Terminal OSC 9 通知
107-
echo \x1b]9;DeepCode: task %STATUS% (%DURATION%s)\x07
108-
```
109-
110-
**macOS 系统通知示例**
111-
112-
```bash
113-
#!/bin/bash
114-
# macOS 系统通知
115-
osascript -e "display notification \"任务已${STATUS:-完成},耗时 ${DURATION}s\" with title \"DeepCode\""
116-
```
117-
118-
**Linux 系统通知示例**(需安装 `libnotify-bin`):
119-
120-
```bash
121-
#!/bin/bash
122-
# Linux notify-send 通知
123-
notify-send "DeepCode" "任务已${STATUS:-完成},耗时 ${DURATION}s"
124-
```
125-
126-
**Windows msg 弹窗通知示例**
127-
128-
```batch
129-
@echo off
130-
REM Windows msg 弹窗通知
131-
msg %USERNAME% "DeepCode: task %STATUS% (%DURATION%s)"
132-
```
120+
`WEBHOOK_URL` 替换为你的飞书机器人 Webhook 地址即可使用。更多变量参考上表。也适用于其他 webhook 类通知(如 Slack、企业微信),只需修改 JSON payload 格式。
133121

134122
#### `webSearchTool` — 自定义联网搜索
135123

docs/configuration_en.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -83,53 +83,41 @@ The following context is injected as environment variables when the notify scrip
8383
}
8484
```
8585

86-
**Terminal Notification Example (iTerm2 / Windows Terminal)**:
87-
88-
On iTerm2 or Windows Terminal you can use the OSC 9 escape sequence for native terminal notifications with zero dependencies. Create a script (e.g., `~/.deepcode/notify.sh`):
86+
**Feishu (Lark) Webhook Notification Example**:
8987

9088
```bash
9189
#!/bin/bash
92-
# iTerm2 / Windows Terminal OSC 9 notification
93-
printf '\x1b]9;DeepCode: task %s (%ss)\x07' "${STATUS:-completed}" "${DURATION}"
94-
```
90+
# Feishu Webhook Notification
91+
WEBHOOK_URL="https://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxx"
9592

96-
```json
93+
curl -s -X POST "$WEBHOOK_URL" \
94+
-H "Content-Type: application/json" \
95+
-d "$(cat <<EOF
9796
{
98-
"notify": "/Users/you/.deepcode/notify.sh"
97+
"msg_type": "interactive",
98+
"card": {
99+
"header": {
100+
"title": {
101+
"tag": "plain_text",
102+
"content": "DeepCode: task ${STATUS:-completed}"
103+
}
104+
},
105+
"elements": [
106+
{
107+
"tag": "div",
108+
"text": {
109+
"tag": "lark_md",
110+
"content": "**${TITLE:-Untitled}**\\nDuration: ${DURATION}s"
111+
}
112+
}
113+
]
114+
}
99115
}
116+
EOF
117+
)"
100118
```
101119

102-
Windows users on Git Bash can use the same script; alternatively create a `.bat` script:
103-
104-
```batch
105-
@echo off
106-
REM Windows Terminal OSC 9 notification
107-
echo \x1b]9;DeepCode: task %STATUS% (%DURATION%s)\x07
108-
```
109-
110-
**macOS System Notification Example**:
111-
112-
```bash
113-
#!/bin/bash
114-
# macOS system notification
115-
osascript -e "display notification \"Task ${STATUS:-completed}, took ${DURATION}s\" with title \"DeepCode\""
116-
```
117-
118-
**Linux System Notification Example** (requires `libnotify-bin`):
119-
120-
```bash
121-
#!/bin/bash
122-
# Linux notify-send notification
123-
notify-send "DeepCode" "Task ${STATUS:-completed}, took ${DURATION}s"
124-
```
125-
126-
**Windows msg Popup Notification Example**:
127-
128-
```batch
129-
@echo off
130-
REM Windows msg popup notification
131-
msg %USERNAME% "DeepCode: task %STATUS% (%DURATION%s)"
132-
```
120+
Replace `WEBHOOK_URL` with your Feishu bot webhook URL. See the table above for all available variables. This pattern also works for other webhook-based notifications (Slack, WeCom, etc.) — just adjust the JSON payload format.
133121

134122
#### `webSearchTool` — Custom Web Search
135123

0 commit comments

Comments
 (0)