aico-cli 0.3.14 → 0.3.16

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.
@@ -13,7 +13,7 @@ import { join as join$1 } from 'node:path';
13
13
  import { join, dirname, basename } from 'pathe';
14
14
  import { fileURLToPath } from 'node:url';
15
15
 
16
- const version = "0.3.14";
16
+ const version = "0.3.16";
17
17
 
18
18
  function displayBanner(subtitle) {
19
19
  const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aico-cli",
3
- "version": "0.3.14",
3
+ "version": "0.3.16",
4
4
  "packageManager": "pnpm@9.15.9",
5
5
  "description": "AI CLI",
6
6
  "repository": {
@@ -212,10 +212,36 @@ execute_hook "pre" "requirement-identifier" "自定义参数"
212
212
  # 测试语音提醒脚本
213
213
  ~/.claude/hooks/notify.sh input
214
214
  ~/.claude/hooks/notify.sh complete
215
+
216
+ # 查看调试日志(如果有问题)
217
+ tail -f ~/.claude/hooks/notify.log
215
218
  ```
216
219
 
220
+ **调试功能:**
221
+
222
+ 脚本包含详细的调试日志功能,记录到 `~/.claude/hooks/notify.log`:
223
+ - Hook调用时间和参数
224
+ - 使用的音频播放器
225
+ - 声音文件播放状态
226
+ - 错误信息和排查提示
227
+
217
228
  **重启 Claude Code** 使配置生效。
218
229
 
230
+ **日志管理:**
231
+
232
+ ```bash
233
+ # 查看最新日志
234
+ tail -10 ~/.claude/hooks/notify.log
235
+
236
+ # 清空日志文件
237
+ > ~/.claude/hooks/notify.log
238
+
239
+ # 删除日志文件
240
+ rm ~/.claude/hooks/notify.log
241
+ ```
242
+
243
+ **注意:** 如果语音提醒功能工作正常,可以定期清理日志文件以节省存储空间。
244
+
219
245
  ## 🔧 扩展开发
220
246
 
221
247
  ### 添加新的 Hook
@@ -0,0 +1,81 @@
1
+ 2025年10月14日 星期二 18时30分48秒 CST: notify.sh called with args: input
2
+ Script directory: /Users/bjyf/.claude/hooks
3
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
4
+ 2025年10月14日 星期二 18时30分56秒 CST: notify.sh called with args: complete
5
+ Script directory: /Users/bjyf/.claude/hooks
6
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
7
+ 2025年10月14日 星期二 18时38分07秒 CST: notify.sh called with args: input
8
+ Script directory: /Users/bjyf/.claude/hooks
9
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
10
+ 2025年10月14日 星期二 18时38分18秒 CST: notify.sh called with args: complete
11
+ Script directory: /Users/bjyf/.claude/hooks
12
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
13
+ 2025年10月14日 星期二 18时38分18秒 CST: notify.sh called with args: input
14
+ Script directory: /Users/bjyf/.claude/hooks
15
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
16
+ 2025年10月14日 星期二 18时38分25秒 CST: notify.sh called with args: input
17
+ Script directory: /Users/bjyf/.claude/hooks
18
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
19
+ 2025年10月14日 星期二 18时38分50秒 CST: notify.sh called with args: complete
20
+ Script directory: /Users/bjyf/.claude/hooks
21
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
22
+ 2025年10月14日 星期二 18时57分39秒 CST: notify.sh called with args: input
23
+ Script directory: /Users/bjyf/.claude/hooks
24
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
25
+ Input needed event triggered
26
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
27
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
28
+ 2025年10月14日 星期二 18时58分36秒 CST: notify.sh called with args: complete
29
+ Script directory: /Users/bjyf/.claude/hooks
30
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
31
+ Complete event triggered
32
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/complete.wav
33
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/complete.wav
34
+ 2025年10月14日 星期二 18时59分28秒 CST: notify.sh called with args: input
35
+ Script directory: /Users/bjyf/.claude/hooks
36
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
37
+ Input needed event triggered
38
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
39
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
40
+ 2025年10月14日 星期二 18时59分36秒 CST: notify.sh called with args: complete
41
+ Script directory: /Users/bjyf/.claude/hooks
42
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
43
+ Complete event triggered
44
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/complete.wav
45
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/complete.wav
46
+ 2025年10月14日 星期二 19时48分33秒 CST: notify.sh called with args: input
47
+ Script directory: /Users/bjyf/.claude/hooks
48
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
49
+ Input needed event triggered
50
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
51
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
52
+ 2025年10月14日 星期二 19时49分20秒 CST: notify.sh called with args: input
53
+ Script directory: /Users/bjyf/.claude/hooks
54
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
55
+ Input needed event triggered
56
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
57
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
58
+ 2025年10月14日 星期二 19时52分55秒 CST: notify.sh called with args: input
59
+ Script directory: /Users/bjyf/.claude/hooks
60
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
61
+ Input needed event triggered
62
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
63
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
64
+ 2025年10月14日 星期二 20时14分26秒 CST: notify.sh called with args: input
65
+ Script directory: /Users/bjyf/.claude/hooks
66
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
67
+ Input needed event triggered
68
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
69
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
70
+ 2025年10月14日 星期二 20时15分48秒 CST: notify.sh called with args: input
71
+ Script directory: /Users/bjyf/.claude/hooks
72
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
73
+ Input needed event triggered
74
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
75
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/input-needed.wav
76
+ 2025年10月14日 星期二 20时16分28秒 CST: notify.sh called with args: complete
77
+ Script directory: /Users/bjyf/.claude/hooks
78
+ Sounds directory: /Users/bjyf/.claude/hooks/sounds
79
+ Complete event triggered
80
+ Playing sound: /Users/bjyf/.claude/hooks/sounds/complete.wav
81
+ Using afplay to play: /Users/bjyf/.claude/hooks/sounds/complete.wav
@@ -2,60 +2,75 @@
2
2
  # Claude Code notification hook script
3
3
  # Plays pleasant sounds when Claude needs input or completes tasks
4
4
 
5
+ # Debug logging
6
+ LOG_FILE="$HOME/.claude/hooks/notify.log"
7
+ echo "$(date): notify.sh called with args: $@" >> "$LOG_FILE"
8
+
5
9
  # Get the directory where this script is located
6
10
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
11
  SOUNDS_DIR="$SCRIPT_DIR/sounds"
12
+ echo "Script directory: $SCRIPT_DIR" >> "$LOG_FILE"
13
+ echo "Sounds directory: $SOUNDS_DIR" >> "$LOG_FILE"
8
14
 
9
15
  # Function to play a sound file with cross-platform support
10
16
  play_sound_file() {
11
17
  local sound_file="$1"
12
-
18
+
13
19
  # Check if file exists
14
20
  if [[ ! -f "$sound_file" ]]; then
15
21
  echo "Warning: Sound file not found: $sound_file" >&2
22
+ echo "Warning: Sound file not found: $sound_file" >> "$LOG_FILE"
16
23
  return 1
17
24
  fi
18
-
25
+
26
+ echo "Playing sound: $sound_file" >> "$LOG_FILE"
27
+
19
28
  # Detect OS and use appropriate command-line audio player
20
29
  local os_type="$(uname -s)"
21
-
30
+
22
31
  case "$os_type" in
23
32
  Darwin*) # macOS
24
33
  if command -v afplay &> /dev/null; then
34
+ echo "Using afplay to play: $sound_file" >> "$LOG_FILE"
25
35
  afplay "$sound_file" 2>/dev/null &
26
36
  return 0 # Exit immediately after starting playback
27
37
  fi
28
38
  ;;
29
-
39
+
30
40
  Linux*) # Linux
31
41
  # Try PulseAudio first (most common on modern desktop Linux)
32
42
  if command -v paplay &> /dev/null; then
43
+ echo "Using paplay to play: $sound_file" >> "$LOG_FILE"
33
44
  paplay "$sound_file" 2>/dev/null &
34
45
  return 0 # Exit immediately after starting playback
35
46
  fi
36
-
47
+
37
48
  # Try ALSA
38
49
  if command -v aplay &> /dev/null; then
50
+ echo "Using aplay to play: $sound_file" >> "$LOG_FILE"
39
51
  aplay -q "$sound_file" 2>/dev/null &
40
52
  return 0 # Exit immediately after starting playback
41
53
  fi
42
-
54
+
43
55
  # Try PipeWire (newer systems)
44
56
  if command -v pw-play &> /dev/null; then
57
+ echo "Using pw-play to play: $sound_file" >> "$LOG_FILE"
45
58
  pw-play "$sound_file" 2>/dev/null &
46
59
  return 0 # Exit immediately after starting playback
47
60
  fi
48
-
61
+
49
62
  # Try sox play command
50
63
  if command -v play &> /dev/null; then
64
+ echo "Using sox play to play: $sound_file" >> "$LOG_FILE"
51
65
  play -q "$sound_file" 2>/dev/null &
52
66
  return 0 # Exit immediately after starting playback
53
67
  fi
54
68
  ;;
55
-
69
+
56
70
  MINGW*|CYGWIN*|MSYS*) # Windows (Git Bash, WSL, etc.)
57
71
  # Try PowerShell
58
72
  if command -v powershell.exe &> /dev/null; then
73
+ echo "Using PowerShell to play: $sound_file" >> "$LOG_FILE"
59
74
  # Use Windows Media Player COM object for better compatibility
60
75
  # Run in background and exit immediately
61
76
  powershell.exe -NoProfile -Command "
@@ -71,31 +86,38 @@ play_sound_file() {
71
86
  fi
72
87
  ;;
73
88
  esac
74
-
89
+
75
90
  # If we have ffplay (cross-platform)
76
91
  if command -v ffplay &> /dev/null; then
92
+ echo "Using ffplay to play: $sound_file" >> "$LOG_FILE"
77
93
  ffplay -nodisp -autoexit -loglevel quiet "$sound_file" 2>/dev/null &
78
94
  return 0 # Exit immediately after starting playback
79
95
  fi
80
-
96
+
81
97
  # No audio player found - fail silently
98
+ echo "No audio player found" >> "$LOG_FILE"
82
99
  return 1
83
100
  }
84
101
 
85
102
  # Main script logic
86
103
  case "$1" in
87
104
  "input")
105
+ echo "Input needed event triggered" >> "$LOG_FILE"
88
106
  play_sound_file "$SOUNDS_DIR/input-needed.wav"
89
107
  ;;
90
-
108
+
91
109
  "complete")
110
+ echo "Complete event triggered" >> "$LOG_FILE"
92
111
  play_sound_file "$SOUNDS_DIR/complete.wav"
93
112
  ;;
94
-
113
+
95
114
  *)
96
115
  echo "Usage: $0 {input|complete}" >&2
116
+ echo "Usage: $0 {input|complete}" >> "$LOG_FILE"
97
117
  echo " input - Play sound when Claude needs user input" >&2
118
+ echo " input - Play sound when Claude needs user input" >> "$LOG_FILE"
98
119
  echo " complete - Play sound when Claude completes tasks" >&2
120
+ echo " complete - Play sound when Claude completes tasks" >> "$LOG_FILE"
99
121
  exit 1
100
122
  ;;
101
123
  esac