vibe-notification 1.0.1__tar.gz

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 (35) hide show
  1. vibe_notification-1.0.1/LICENSE +21 -0
  2. vibe_notification-1.0.1/PKG-INFO +598 -0
  3. vibe_notification-1.0.1/README.md +569 -0
  4. vibe_notification-1.0.1/pyproject.toml +45 -0
  5. vibe_notification-1.0.1/setup.cfg +4 -0
  6. vibe_notification-1.0.1/setup.py +7 -0
  7. vibe_notification-1.0.1/tests/test_notification.py +197 -0
  8. vibe_notification-1.0.1/vibe_notification/__init__.py +75 -0
  9. vibe_notification-1.0.1/vibe_notification/__main__.py +11 -0
  10. vibe_notification-1.0.1/vibe_notification/adapters.py +319 -0
  11. vibe_notification-1.0.1/vibe_notification/cli.py +306 -0
  12. vibe_notification-1.0.1/vibe_notification/config.py +82 -0
  13. vibe_notification-1.0.1/vibe_notification/core.py +134 -0
  14. vibe_notification-1.0.1/vibe_notification/detectors/__init__.py +9 -0
  15. vibe_notification-1.0.1/vibe_notification/detectors/conversation.py +104 -0
  16. vibe_notification-1.0.1/vibe_notification/exceptions.py +40 -0
  17. vibe_notification-1.0.1/vibe_notification/factories.py +128 -0
  18. vibe_notification-1.0.1/vibe_notification/i18n.py +139 -0
  19. vibe_notification-1.0.1/vibe_notification/input_utils.py +247 -0
  20. vibe_notification-1.0.1/vibe_notification/managers.py +318 -0
  21. vibe_notification-1.0.1/vibe_notification/models.py +74 -0
  22. vibe_notification-1.0.1/vibe_notification/notifiers/__init__.py +11 -0
  23. vibe_notification-1.0.1/vibe_notification/notifiers/base.py +31 -0
  24. vibe_notification-1.0.1/vibe_notification/notifiers/sound.py +44 -0
  25. vibe_notification-1.0.1/vibe_notification/notifiers/system.py +41 -0
  26. vibe_notification-1.0.1/vibe_notification/parsers/__init__.py +11 -0
  27. vibe_notification-1.0.1/vibe_notification/parsers/base.py +40 -0
  28. vibe_notification-1.0.1/vibe_notification/parsers/claude_code.py +191 -0
  29. vibe_notification-1.0.1/vibe_notification/parsers/codex.py +59 -0
  30. vibe_notification-1.0.1/vibe_notification/utils.py +64 -0
  31. vibe_notification-1.0.1/vibe_notification.egg-info/PKG-INFO +598 -0
  32. vibe_notification-1.0.1/vibe_notification.egg-info/SOURCES.txt +33 -0
  33. vibe_notification-1.0.1/vibe_notification.egg-info/dependency_links.txt +1 -0
  34. vibe_notification-1.0.1/vibe_notification.egg-info/entry_points.txt +3 -0
  35. vibe_notification-1.0.1/vibe_notification.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Bensz Conan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,598 @@
1
+ Metadata-Version: 2.4
2
+ Name: vibe-notification
3
+ Version: 1.0.1
4
+ Summary: 智能 AI 助手会话结束通知系统
5
+ Author-email: Bensz Conan <35643122+huangwb8@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/huangwb8/VibeNotification
8
+ Project-URL: Bug-Tracker, https://github.com/huangwb8/VibeNotification/issues
9
+ Project-URL: Documentation, https://github.com/huangwb8/VibeNotification#readme
10
+ Project-URL: Source, https://github.com/huangwb8/VibeNotification
11
+ Keywords: claude,codex,notification,ai,assistant
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Operating System :: MacOS :: MacOS X
23
+ Classifier: Operating System :: Microsoft :: Windows
24
+ Classifier: Operating System :: POSIX :: Linux
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Dynamic: license-file
29
+
30
+ # VibeNotification
31
+
32
+ 让 Claude Code 或 Codex 的单轮对话结束时自动弹出系统通知并播放提示音的轻量工具。
33
+
34
+ ## 安装
35
+
36
+ - 稳定版(PyPI):`pip install vibe-notification`
37
+ - 开发版:`pip install -e .`
38
+ - 准备虚拟环境(可选):`python -m venv venv && source venv/bin/activate`
39
+ - 验证环境:`python -m vibe_notification --test`(会弹窗并响铃,如果已启用)
40
+ - 交互式配置:`python -m vibe_notification --config`
41
+ - 默认配置文件:`~/.config/vibe-notification/config.json`
42
+ - 确保“声音通知”和“系统通知”均为启用状态
43
+
44
+ ## 快速开始
45
+
46
+ ### Claude Code
47
+
48
+ > 配置 ~/.claude/settings.json
49
+ > - **Stop 钩子**:每当 Claude 完成一次回复时触发
50
+ > - **SessionEnd 钩子**:当 Claude Code 会话结束时触发
51
+ > - **SubagentStop 钩子**:当子代理(Task 工具)完成时触发
52
+
53
+ Claude Code 提供了多种钩子事件,您可以根据需要选择:
54
+
55
+ #### AI回复完成时通知
56
+
57
+ > 希望 Claude 每次完成回复后立即收到通知,方便及时查看结果。这是最好的特性!
58
+
59
+ - **编辑配置文件**:
60
+ ```bash
61
+ # 配置文件路径
62
+ ~/.claude/settings.json
63
+ ```
64
+
65
+ - **添加 Stop 钩子**:
66
+ ```json
67
+ {
68
+ "hooks": {
69
+ "Stop": [
70
+ {
71
+ "hooks": [
72
+ {
73
+ "type": "command",
74
+ "command": "python -m vibe_notification"
75
+ }
76
+ ]
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ ```
82
+
83
+ - 设置在settings.json里的具体位置
84
+
85
+ ```json
86
+
87
+ {
88
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
89
+ "env": {
90
+ "ANTHROPIC_AUTH_TOKEN": "xxx",
91
+ "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
92
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.6",
93
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6",
94
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
95
+ "ANTHROPIC_MODEL": "glm-4.6",
96
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
97
+ "DISABLE_ERROR_REPORTING": "1",
98
+ "DISABLE_TELEMETRY": "1",
99
+ "MCP_TIMEOUT": "60000"
100
+ },
101
+ "hooks": {
102
+ "Stop": [
103
+ {
104
+ "hooks": [
105
+ {
106
+ "command": "python -m vibe_notification",
107
+ "type": "command"
108
+ }
109
+ ]
110
+ }
111
+ ]
112
+ },
113
+ "includeCoAuthoredBy": false,
114
+ "outputStyle": "engineer-professional"
115
+ }
116
+ ```
117
+
118
+ #### 会话结束时通知
119
+
120
+ > 仅在退出 Claude Code 时收到通知。个人感觉并不实用。
121
+
122
+ ```json
123
+ {
124
+ "hooks": {
125
+ "SessionEnd": [
126
+ {
127
+ "hooks": [
128
+ {
129
+ "type": "command",
130
+ "command": "python -m vibe_notification"
131
+ }
132
+ ]
133
+ }
134
+ ]
135
+ }
136
+ }
137
+ ```
138
+
139
+ #### 同时使用多个钩子
140
+
141
+ > 既想知道每次回复完成,也想知道会话结束。
142
+
143
+ ```json
144
+ {
145
+ "hooks": {
146
+ "Stop": [
147
+ {
148
+ "hooks": [
149
+ {
150
+ "type": "command",
151
+ "command": "python -m vibe_notification"
152
+ }
153
+ ]
154
+ }
155
+ ],
156
+ "SessionEnd": [
157
+ {
158
+ "hooks": [
159
+ {
160
+ "type": "command",
161
+ "command": "python -m vibe_notification"
162
+ }
163
+ ]
164
+ }
165
+ ]
166
+ }
167
+ }
168
+ ```
169
+
170
+ ### Codex
171
+
172
+ > 如果希望在 Codex CLI里回复结束自动通知,可在 Codex `~/.codex/config.toml` 里配置 `notify`,让 Codex 在每次 `agent-turn-complete` 时调用 VibeNotification。
173
+
174
+ #### 每次回复完成时通知(推荐)✨
175
+
176
+ - 打开 `~/.codex/config.toml`,添加:
177
+
178
+ ```toml
179
+ # Codex 通知钩子:将事件 JSON 传给 VibeNotification
180
+ notify = ["python3", "-m", "vibe_notification"]
181
+ ```
182
+
183
+ - 相关配置在config.toml文件的位置如下:
184
+
185
+ ```toml
186
+ model_provider = "xxx"
187
+ model = "gpt-5.1-codex-max"
188
+ model_reasoning_effort = "medium"
189
+ disable_response_storage = true
190
+ notify = ["python3", "-m", "vibe_notification"]
191
+
192
+ [model_providers.xxx]
193
+ name = "xxx"
194
+ base_url = "https://xxx/v1"
195
+ wire_api = "responses"
196
+ requires_openai_auth = true
197
+
198
+ [tui]
199
+ notifications = true
200
+ ```
201
+
202
+ ### 其它配置
203
+
204
+ #### 只弹窗不响铃
205
+
206
+ > 适用于需要视觉提醒但保持环境安静的场合
207
+
208
+ **Codex 配置:**
209
+
210
+ ```toml
211
+ # 在 ~/.codex/config.toml 中设置
212
+ notify = ["python3", "-m", "vibe_notification", "--sound", "0"]
213
+ ```
214
+
215
+ **Claude Code 配置:**
216
+
217
+ ```json
218
+ {
219
+ "hooks": {
220
+ "Stop": [
221
+ {
222
+ "hooks": [
223
+ {
224
+ "type": "command",
225
+ "command": "python -m vibe_notification --sound 0"
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ }
231
+ }
232
+ ```
233
+
234
+ **测试命令:**
235
+
236
+ ```bash
237
+ # 验证只弹窗不响铃效果
238
+ python -m vibe_notification --sound 0 --test
239
+ ```
240
+
241
+ #### 只响铃不弹窗
242
+
243
+ > 适用于需要听觉提醒但不希望被打断工作流的场景
244
+
245
+ **Codex 配置:**
246
+
247
+ ```toml
248
+ # 在 ~/.codex/config.toml 中设置
249
+ notify = ["python3", "-m", "vibe_notification", "--notification", "0"]
250
+ ```
251
+
252
+ **Claude Code 配置:**
253
+
254
+ ```json
255
+ {
256
+ "hooks": {
257
+ "Stop": [
258
+ {
259
+ "hooks": [
260
+ {
261
+ "type": "command",
262
+ "command": "python -m vibe_notification --notification 0"
263
+ }
264
+ ]
265
+ }
266
+ ]
267
+ }
268
+ }
269
+ ```
270
+
271
+ **测试命令:**
272
+
273
+ ```bash
274
+ # 验证只响铃不弹窗效果
275
+ python -m vibe_notification --notification 0 --test
276
+ ```
277
+
278
+ #### 临时控制
279
+
280
+ > 无需修改配置文件,通过环境变量灵活控制通知行为
281
+
282
+ **环境变量说明:**
283
+
284
+ - `VIBE_NOTIFICATION_SOUND=0` - 临时禁用声音通知
285
+ - `VIBE_NOTIFICATION_NOTIFY=0` - 临时禁用系统通知
286
+ - `VIBE_NOTIFICATION_LOG_LEVEL=DEBUG` - 临时设置调试日志级别
287
+
288
+ **Codex 配置:**
289
+
290
+ ```toml
291
+ # 在 ~/.codex/config.toml 中设置临时禁用声音
292
+ notify = ["env", "VIBE_NOTIFICATION_SOUND=0", "python3", "-m", "vibe_notification"]
293
+
294
+ # 完全禁用通知(调试用)
295
+ notify = ["env", "VIBE_NOTIFICATION_NOTIFY=0", "VIBE_NOTIFICATION_SOUND=0", "python3", "-m", "vibe_notification"]
296
+
297
+ # 启用调试日志
298
+ notify = ["env", "VIBE_NOTIFICATION_LOG_LEVEL=DEBUG", "python3", "-m", "vibe_notification"]
299
+ ```
300
+
301
+ **Claude Code 配置:**
302
+
303
+ ```json
304
+ {
305
+ "hooks": {
306
+ "Stop": [
307
+ {
308
+ "hooks": [
309
+ {
310
+ "type": "command",
311
+ "command": "env VIBE_NOTIFICATION_SOUND=0 python -m vibe_notification"
312
+ }
313
+ ]
314
+ }
315
+ ]
316
+ }
317
+ }
318
+ ```
319
+
320
+ **测试命令:**
321
+
322
+ ```bash
323
+ # 临时禁用声音通知
324
+ VIBE_NOTIFICATION_SOUND=0 python -m vibe_notification --test
325
+
326
+ # 临时禁用所有通知
327
+ VIBE_NOTIFICATION_SOUND=0 VIBE_NOTIFICATION_NOTIFY=0 python -m vibe_notification --test
328
+
329
+ # 临时启用调试日志
330
+ VIBE_NOTIFICATION_LOG_LEVEL=DEBUG python -m vibe_notification --test
331
+ ```
332
+
333
+ #### 声音类型自定义
334
+
335
+ > 支持多种系统内置声音,可根据个人偏好选择
336
+
337
+ **可用声音类型:**
338
+
339
+ - `Glass` - 玻璃音效(默认)
340
+ - `Ping` - 清脆提示音
341
+ - `Pop` - 气泡音效
342
+ - `Tink` - 叮当声
343
+ - `Basso` - 低音提示
344
+
345
+ **Codex 配置:**
346
+
347
+ ```toml
348
+ # 在 ~/.codex/config.toml 中设置不同声音类型
349
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_TYPE=Ping", "python3", "-m", "vibe_notification"]
350
+
351
+ # 使用低音提示音
352
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_TYPE=Basso", "python3", "-m", "vibe_notification"]
353
+ ```
354
+
355
+ **Claude Code 配置:**
356
+
357
+ ```json
358
+ {
359
+ "hooks": {
360
+ "Stop": [
361
+ {
362
+ "hooks": [
363
+ {
364
+ "type": "command",
365
+ "command": "env VIBE_NOTIFICATION_SOUND_TYPE=Pop python -m vibe_notification"
366
+ }
367
+ ]
368
+ }
369
+ ]
370
+ }
371
+ }
372
+ ```
373
+
374
+ **测试命令:**
375
+
376
+ ```bash
377
+ # 测试不同声音类型
378
+ VIBE_NOTIFICATION_SOUND_TYPE=Tink python -m vibe_notification --test
379
+ VIBE_NOTIFICATION_SOUND_TYPE=Ping python -m vibe_notification --test
380
+ ```
381
+
382
+ #### 音量控制
383
+
384
+ > 精确控制提示音音量,适合不同环境需求
385
+
386
+ **Codex 配置:**
387
+
388
+ ```toml
389
+ # 设置音量为 20% (0.0-1.0)
390
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_VOLUME=0.2", "python3", "-m", "vibe_notification"]
391
+
392
+ # 设置音量为 50%
393
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_VOLUME=0.5", "python3", "-m", "vibe_notification"]
394
+
395
+ # 静音模式(音量设为 0)
396
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_VOLUME=0", "python3", "-m", "vibe_notification"]
397
+ ```
398
+
399
+ **Claude Code 配置:**
400
+
401
+ ```json
402
+ {
403
+ "hooks": {
404
+ "Stop": [
405
+ {
406
+ "hooks": [
407
+ {
408
+ "type": "command",
409
+ "command": "env VIBE_NOTIFICATION_SOUND_VOLUME=0.3 python -m vibe_notification"
410
+ }
411
+ ]
412
+ }
413
+ ]
414
+ }
415
+ }
416
+ ```
417
+
418
+ **测试命令:**
419
+
420
+ ```bash
421
+ # 测试不同音量
422
+ VIBE_NOTIFICATION_SOUND_VOLUME=0.1 python -m vibe_notification --test
423
+ VIBE_NOTIFICATION_SOUND_VOLUME=0.8 python -m vibe_notification --test
424
+ ```
425
+
426
+ #### 通知持续时间控制
427
+
428
+ > 在配置文件中设置通知显示时间
429
+
430
+ **配置文件修改:**
431
+
432
+ ```bash
433
+ # 编辑配置文件
434
+ ~/.config/vibe-notification/config.json
435
+ ```
436
+
437
+ ```json
438
+ {
439
+ "enable_sound": true,
440
+ "enable_notification": true,
441
+ "notification_timeout": 5000,
442
+ "sound_type": "Glass",
443
+ "sound_volume": 0.1,
444
+ "log_level": "INFO"
445
+ }
446
+ ```
447
+
448
+ **超时时间说明:**
449
+
450
+ - `5000` - 5秒自动消失
451
+ - `10000` - 10秒自动消失(默认)
452
+ - `30000` - 30秒自动消失
453
+ - `0` - 不会自动消失(需要手动关闭)
454
+
455
+ **交互式配置:**
456
+
457
+ ```bash
458
+ # 通过交互式配置界面设置
459
+ python -m vibe_notification --config
460
+ ```
461
+
462
+ #### 高级组合配置
463
+
464
+ > 组合多个环境变量实现个性化通知
465
+
466
+ **工作专注模式:**
467
+
468
+ ```bash
469
+ # 低音量 + 只弹窗 + 短时间显示
470
+ notify = ["env", "VIBE_NOTIFICATION_SOUND_VOLUME=0.1", "VIBE_NOTIFICATION_SOUND_TYPE=Basso", "python3", "-m", "vibe_notification"]
471
+ ```
472
+
473
+ **会议模式:**
474
+
475
+ ```bash
476
+ # 只响铃 + 高音量 + 特定声音
477
+ notify = ["env", "VIBE_NOTIFICATION_NOTIFY=0", "VIBE_NOTIFICATION_SOUND_VOLUME=0.7", "VIBE_NOTIFICATION_SOUND_TYPE=Ping", "python3", "-m", "vibe_notification"]
478
+ ```
479
+
480
+ **调试模式:**
481
+
482
+ ```bash
483
+ # 启用所有通知 + 调试日志 + 长时间显示
484
+ notify = ["env", "VIBE_NOTIFICATION_LOG_LEVEL=DEBUG", "python3", "-m", "vibe_notification"]
485
+ ```
486
+
487
+ ## 进阶使用
488
+
489
+ ### 命令行参数
490
+
491
+ | 参数 | 类型 | 默认值 | 说明 |
492
+ |------|------|--------|------|
493
+ | `event_json` | 位置参数 | - | Codex 事件 JSON 字符串(可选) |
494
+ | `--test` | 标志 | - | 测试模式,发送测试通知 |
495
+ | `--config` | 标志 | - | 交互式配置模式 |
496
+ | `--sound {0,1}` | 选项 | 配置文件值 | 启用/禁用声音通知 (0=禁用, 1=启用) |
497
+ | `--notification {0,1}` | 选项 | 配置文件值 | 启用/禁用系统通知 (0=禁用, 1=启用) |
498
+ | `--log-level {DEBUG,INFO,WARNING,ERROR}` | 选项 | 配置文件值 | 设置日志级别 |
499
+ | `--version` | 标志 | - | 显示版本信息 |
500
+
501
+ ### 配置文件参数
502
+
503
+ 配置文件位置:`~/.config/vibe-notification/config.json`
504
+
505
+ | 参数 | 类型 | 默认值 | 说明 |
506
+ |------|------|--------|------|
507
+ | `enable_sound` | 布尔 | `true` | 是否启用声音通知 |
508
+ | `enable_notification` | 布尔 | `true` | 是否启用系统通知 |
509
+ | `notification_timeout` | 整数 | `10000` | 通知显示时间(毫秒) |
510
+ | `sound_type` | 字符串 | `"default"` | 声音类型 |
511
+ | `log_level` | 字符串 | `"INFO"` | 日志级别 |
512
+ | `detect_conversation_end` | 布尔 | `true` | 是否检测会话结束 |
513
+
514
+ ### 环境变量参数
515
+
516
+ | 环境变量 | 说明 | 示例 |
517
+ |----------|------|------|
518
+ | `VIBE_NOTIFICATION_SOUND` | 覆盖声音通知设置 | `VIBE_NOTIFICATION_SOUND=0` |
519
+ | `VIBE_NOTIFICATION_NOTIFY` | 覆盖系统通知设置 | `VIBE_NOTIFICATION_NOTIFY=0` |
520
+ | `VIBE_NOTIFICATION_LOG_LEVEL` | 覆盖日志级别设置 | `VIBE_NOTIFICATION_LOG_LEVEL=DEBUG` |
521
+
522
+ ### 基础用法
523
+
524
+ ```bash
525
+ # 测试通知(弹窗+声音)
526
+ python -m vibe_notification --test
527
+
528
+ # 只弹窗不响铃
529
+ python -m vibe_notification --sound 0 --test
530
+
531
+ # 只响铃不弹窗
532
+ python -m vibe_notification --notification 0 --test
533
+
534
+ # 设置日志级别为 DEBUG
535
+ python -m vibe_notification --log-level DEBUG --test
536
+ ```
537
+
538
+ ### Claude Code 钩子使用
539
+
540
+ ```bash
541
+ # 作为 Stop 钩子使用(每次回复完成时)
542
+ echo '{"toolName": "Bash"}' | python -m vibe_notification
543
+
544
+ # 临时关闭声音通知
545
+ VIBE_NOTIFICATION_SOUND=0 echo '{"toolName": "Task"}' | python -m vibe_notification
546
+
547
+ # 临时关闭所有通知
548
+ VIBE_NOTIFICATION_NOTIFY=0 python -m vibe_notification
549
+ ```
550
+
551
+ ### Codex 钩子使用
552
+
553
+ ```bash
554
+ # 直接传递 JSON 事件
555
+ python -m vibe_notification '{"type":"agent-turn-complete","agent":"codex","message":"工具 Bash 完成"}'
556
+
557
+ # 组合参数使用
558
+ python -m vibe_notification '{"type":"agent-turn-complete","agent":"codex"}' --notification 1 --sound 0
559
+
560
+ # 环境变量控制
561
+ VIBE_NOTIFICATION_SOUND=1 VIBE_NOTIFICATION_NOTIFY=1 python -m vibe_notification '{"type":"agent-turn-complete"}'
562
+ ```
563
+
564
+ ### 配置管理
565
+
566
+ ```bash
567
+ # 交互式配置
568
+ python -m vibe_notification --config
569
+
570
+ # 查看版本
571
+ python -m vibe_notification --version
572
+
573
+ # 查看帮助
574
+ python -m vibe_notification --help
575
+ ```
576
+
577
+ ### 高级组合用法
578
+
579
+ ```bash
580
+ # Claude Code 中临时启用调试日志并关闭声音
581
+ python -m vibe_notification --log-level DEBUG --sound 0
582
+
583
+ # Codex 中强制启用系统通知(即使配置文件中关闭了)
584
+ python -m vibe_notification '{"type":"agent-turn-complete"}' --notification 1
585
+
586
+ # 环境变量和命令行参数组合(环境变量优先级更高)
587
+ VIBE_NOTIFICATION_SOUND=0 python -m vibe_notification --sound 1 --test
588
+ # 结果:声音仍然被禁用(环境变量覆盖命令行参数)
589
+ ```
590
+
591
+ ## 发布到 PyPI
592
+
593
+ 1. 更新版本号:同时修改 `pyproject.toml` 的 `version` 与 `vibe_notification/__init__.py` 的 `__version__`。
594
+ 2. 安装发布工具:`python -m pip install --upgrade build twine`。
595
+ 3. 构建发布物:`python -m build`(生成 `dist/` 下的 `.tar.gz` 与 `.whl`)。
596
+ 4. 校验包体:`python -m twine check dist/*`。
597
+ 5. 上传 PyPI:`TWINE_USERNAME=__token__ TWINE_PASSWORD=<pypi-token> python -m twine upload dist/*`;若先验证,可替换为 `--repository testpypi`。
598
+ 6. 安装验证:`pip install -U vibe-notification` 并运行 `python -m vibe_notification --test`。