aico-cli 0.3.13 → 0.3.15
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.
- package/dist/chunks/simple-config.mjs +1 -1
- package/package.json +1 -1
- package/templates/commands/base//344/272/247/345/223/201/350/256/276/350/256/241/346/231/272/350/203/275/344/275/223.md +106 -0
- package/templates/hooks/README.md +93 -0
- package/templates/hooks/claude-code-hook-config.json +35 -0
- package/templates/hooks/notify.sh +34 -12
|
@@ -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.
|
|
16
|
+
const version = "0.3.15";
|
|
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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 基于苹果设计哲学的产品界面设计智能体,生成极简、直观、优雅的HTML界面
|
|
3
|
+
allowed-tools: Read(**), Write(.aico/prd/**/*.html), Edit(.aico/prd/**/*.html)
|
|
4
|
+
argument-hint: <产品需求描述>
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 目标
|
|
8
|
+
|
|
9
|
+
基于苹果产品设计哲学,为用户描述的产品需求生成高质量的HTML交互界面:
|
|
10
|
+
|
|
11
|
+
- **极简主义**:去除冗余元素,聚焦核心功能
|
|
12
|
+
- **直观交互**:用户无需学习即可上手
|
|
13
|
+
- **优雅动效**:流畅的过渡和反馈
|
|
14
|
+
- **统一视觉**:一致的色彩、字体和间距
|
|
15
|
+
|
|
16
|
+
## 苹果设计哲学核心原则
|
|
17
|
+
|
|
18
|
+
### 1. 极简主义
|
|
19
|
+
- 去除一切不必要的装饰和元素
|
|
20
|
+
- 聚焦核心功能和用户体验
|
|
21
|
+
- 留白空间的艺术性运用
|
|
22
|
+
|
|
23
|
+
### 2. 直观交互
|
|
24
|
+
- 符合用户心理模型的界面设计
|
|
25
|
+
- 清晰的视觉层次和信息架构
|
|
26
|
+
- 自然的交互流程和反馈机制
|
|
27
|
+
|
|
28
|
+
### 3. 优雅动效
|
|
29
|
+
- 流畅的页面过渡和状态变化
|
|
30
|
+
- 适度的微交互增强用户体验
|
|
31
|
+
- 性能优先的动画实现
|
|
32
|
+
|
|
33
|
+
### 4. 统一视觉
|
|
34
|
+
- 苹果设计系统配色方案
|
|
35
|
+
- 标准化的间距和布局系统
|
|
36
|
+
|
|
37
|
+
## 执行流程
|
|
38
|
+
|
|
39
|
+
**步骤 1**:分析产品需求,识别核心功能和用户场景
|
|
40
|
+
|
|
41
|
+
**步骤 2**:应用苹果设计哲学进行界面设计规划
|
|
42
|
+
- 确定信息架构和导航模式
|
|
43
|
+
- 设计视觉层次和交互流程
|
|
44
|
+
- 选择适合的色彩和字体方案
|
|
45
|
+
|
|
46
|
+
**步骤 3**:生成HTML界面文件
|
|
47
|
+
- 创建符合苹果设计规范的HTML结构
|
|
48
|
+
- 实现响应式布局和优雅动效
|
|
49
|
+
- 确保跨浏览器兼容性
|
|
50
|
+
|
|
51
|
+
**步骤 4**:输出到项目目录的 `.aico/prd/` 目录
|
|
52
|
+
- 按产品模块组织文件结构
|
|
53
|
+
- 提供预览和修改建议
|
|
54
|
+
|
|
55
|
+
## HTML生成规范
|
|
56
|
+
|
|
57
|
+
### 布局系统
|
|
58
|
+
- **网格系统**:12列响应式网格
|
|
59
|
+
- **间距规范**:8px基础单位的间距系统
|
|
60
|
+
- **边距规范**:标准化的页面边距
|
|
61
|
+
|
|
62
|
+
### 组件规范
|
|
63
|
+
- **按钮**:圆角、阴影、悬停效果
|
|
64
|
+
- **表单**:清晰的标签和输入框
|
|
65
|
+
- **导航**:直观的导航模式和指示器
|
|
66
|
+
- **卡片**:阴影和圆角的卡片设计
|
|
67
|
+
|
|
68
|
+
## 输出要求
|
|
69
|
+
|
|
70
|
+
- 在 `.aico/prd/` 目录下生成HTML文件
|
|
71
|
+
- 按产品模块组织文件结构
|
|
72
|
+
- 包含完整的CSS样式和JavaScript交互
|
|
73
|
+
- 提供响应式设计和移动端适配
|
|
74
|
+
- 确保代码质量和可维护性
|
|
75
|
+
|
|
76
|
+
## 示例输出结构
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
.aico/prd/
|
|
80
|
+
├── 产品名称/
|
|
81
|
+
│ ├── index.html # 主界面
|
|
82
|
+
│ ├── components/ # 组件库
|
|
83
|
+
│ │ ├── buttons.html
|
|
84
|
+
│ │ ├── forms.html
|
|
85
|
+
│ │ └── navigation.html
|
|
86
|
+
│ ├── styles/ # 样式文件
|
|
87
|
+
│ │ ├── main.css
|
|
88
|
+
│ │ └── components.css
|
|
89
|
+
│ └── scripts/ # 交互脚本
|
|
90
|
+
│ ├── main.js
|
|
91
|
+
│ └── animations.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 质量保证
|
|
95
|
+
|
|
96
|
+
- **设计一致性**:严格遵循苹果设计规范
|
|
97
|
+
- **代码质量**:语义化HTML、模块化CSS、可维护JavaScript
|
|
98
|
+
- **用户体验**:充分的用户测试和反馈收集
|
|
99
|
+
- **性能优化**:快速加载和流畅交互
|
|
100
|
+
|
|
101
|
+
## 扩展性考虑
|
|
102
|
+
|
|
103
|
+
- 支持自定义设计主题
|
|
104
|
+
- 可配置的组件库
|
|
105
|
+
- 模块化的代码结构
|
|
106
|
+
- 易于维护和迭代
|
|
@@ -130,6 +130,8 @@ execute_hook "pre" "requirement-identifier" "自定义参数"
|
|
|
130
130
|
|
|
131
131
|
## 🛠️ 配置管理
|
|
132
132
|
|
|
133
|
+
### 1. 需求管理 Hook 配置
|
|
134
|
+
|
|
133
135
|
编辑 `hooks-config.json` 可以:
|
|
134
136
|
|
|
135
137
|
- 启用/禁用特定 Hook
|
|
@@ -149,6 +151,97 @@ execute_hook "pre" "requirement-identifier" "自定义参数"
|
|
|
149
151
|
}
|
|
150
152
|
```
|
|
151
153
|
|
|
154
|
+
### 2. Claude Code 语音提醒配置
|
|
155
|
+
|
|
156
|
+
语音提醒功能需要在 Claude Code 的 `settings.json` 中配置 Hook。使用 `claude-code-hook-config.json` 作为模板:
|
|
157
|
+
|
|
158
|
+
**部署步骤:**
|
|
159
|
+
|
|
160
|
+
1. **复制配置文件**
|
|
161
|
+
```bash
|
|
162
|
+
# 将模板配置添加到 Claude Code 配置中
|
|
163
|
+
cat templates/hooks/claude-code-hook-config.json >> ~/.claude/settings.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
2. **或者手动添加配置**
|
|
167
|
+
在 `~/.claude/settings.json` 的 `hooks` 字段中添加:
|
|
168
|
+
```json
|
|
169
|
+
"hooks": {
|
|
170
|
+
"UserPromptSubmit": [
|
|
171
|
+
{
|
|
172
|
+
"hooks": [
|
|
173
|
+
{
|
|
174
|
+
"type": "command",
|
|
175
|
+
"command": "~/.claude/hooks/notify.sh input"
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"Stop": [
|
|
181
|
+
{
|
|
182
|
+
"hooks": [
|
|
183
|
+
{
|
|
184
|
+
"type": "command",
|
|
185
|
+
"command": "~/.claude/hooks/notify.sh complete"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
"Notification": [
|
|
191
|
+
{
|
|
192
|
+
"hooks": [
|
|
193
|
+
{
|
|
194
|
+
"type": "command",
|
|
195
|
+
"command": "~/.claude/hooks/notify.sh complete"
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**功能说明:**
|
|
204
|
+
|
|
205
|
+
- **UserPromptSubmit**: 当 Claude 需要用户输入时播放提示音
|
|
206
|
+
- **Stop**: 当 Claude 停止工作时播放完成音(退出提醒)
|
|
207
|
+
- **Notification**: 当 Claude 发送通知时播放完成音(任务完成提醒)
|
|
208
|
+
|
|
209
|
+
**验证配置:**
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# 测试语音提醒脚本
|
|
213
|
+
~/.claude/hooks/notify.sh input
|
|
214
|
+
~/.claude/hooks/notify.sh complete
|
|
215
|
+
|
|
216
|
+
# 查看调试日志(如果有问题)
|
|
217
|
+
tail -f ~/.claude/hooks/notify.log
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**调试功能:**
|
|
221
|
+
|
|
222
|
+
脚本包含详细的调试日志功能,记录到 `~/.claude/hooks/notify.log`:
|
|
223
|
+
- Hook调用时间和参数
|
|
224
|
+
- 使用的音频播放器
|
|
225
|
+
- 声音文件播放状态
|
|
226
|
+
- 错误信息和排查提示
|
|
227
|
+
|
|
228
|
+
**重启 Claude Code** 使配置生效。
|
|
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
|
+
|
|
152
245
|
## 🔧 扩展开发
|
|
153
246
|
|
|
154
247
|
### 添加新的 Hook
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"UserPromptSubmit": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "~/.claude/hooks/notify.sh input"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"Stop": [
|
|
15
|
+
{
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "~/.claude/hooks/notify.sh complete"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"Notification": [
|
|
25
|
+
{
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "~/.claude/hooks/notify.sh complete"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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
|