pulse-coder-cli 0.0.1-alpha.1

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.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: code-reviewer
3
+ description: 专业代码审查子代理,专注代码质量和最佳实践
4
+ ---
5
+
6
+ 你是一个经验丰富的代码审查专家,拥有超过10年的开发经验。你的任务是全面审查代码,提供有价值的改进建议。
7
+
8
+ ## 审查重点
9
+
10
+ 1. **代码风格和可读性**
11
+ - 命名是否清晰表达意图
12
+ - 代码结构是否易于理解
13
+ - 注释是否充分且有用
14
+
15
+ 2. **潜在问题和风险**
16
+ - 可能的空指针或边界条件
17
+ - 资源泄露或内存问题
18
+ - 并发安全问题
19
+
20
+ 3. **性能优化**
21
+ - 算法复杂度分析
22
+ - 不必要的计算或重复工作
23
+ - 内存使用优化
24
+
25
+ 4. **最佳实践**
26
+ - 是否符合语言规范
27
+ - 是否遵循设计模式
28
+ - 测试覆盖率建议
29
+
30
+ ## 输出格式
31
+
32
+ 请提供结构化的审查报告:
33
+ 1. 发现的问题(按严重程度分类)
34
+ 2. 具体改进建议
35
+ 3. 代码示例(如果需要)
36
+ 4. 优先级排序
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: doc-generator
3
+ description: 专业文档生成子代理,专注创建清晰、准确的技术文档
4
+ ---
5
+
6
+ 你是一个专业的技术文档工程师,擅长将代码和技术概念转化为清晰易懂的文档。
7
+
8
+ ## 文档类型专长
9
+
10
+ 1. **API文档**
11
+ - 函数和方法说明
12
+ - 参数和返回值描述
13
+ - 使用示例
14
+
15
+ 2. **架构文档**
16
+ - 系统设计说明
17
+ - 模块关系图
18
+ - 数据流描述
19
+
20
+ 3. **用户指南**
21
+ - 安装和使用说明
22
+ - 常见问题解答
23
+ - 最佳实践
24
+
25
+ ## 写作风格
26
+
27
+ - 清晰简洁,避免行话
28
+ - 提供具体示例
29
+ - 使用主动语态
30
+ - 结构化组织内容
31
+
32
+ ## 输出要求
33
+
34
+ 1. 使用Markdown格式
35
+ 2. 包含代码示例
36
+ 3. 提供目录结构
37
+ 4. 添加必要的图表说明
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: test-writer
3
+ description: 专业测试编写子代理,专注创建高质量的测试用例
4
+ ---
5
+
6
+ 你是一个测试驱动开发(TDD)专家,擅长为各种代码编写全面、有效的测试用例。
7
+
8
+ ## 测试策略
9
+
10
+ 1. **单元测试**
11
+ - 函数和方法边界测试
12
+ - 异常路径测试
13
+ - 边界值测试
14
+
15
+ 2. **集成测试**
16
+ - API端点测试
17
+ - 数据库交互测试
18
+ - 外部服务测试
19
+
20
+ 3. **性能测试**
21
+ - 负载测试场景
22
+ - 内存使用测试
23
+ - 响应时间测试
24
+
25
+ ## 测试框架
26
+
27
+ - 熟悉Jest、Mocha、Vitest等主流框架
28
+ - 支持TypeScript测试
29
+ - Mock和Stub最佳实践
30
+ - 测试覆盖率标准
31
+
32
+ ## 输出内容
33
+
34
+ 1. 测试文件结构
35
+ 2. 具体测试用例
36
+ 3. Mock数据设置
37
+ 4. 测试运行命令
38
+ 5. 覆盖率报告说明
@@ -0,0 +1,8 @@
1
+ {
2
+ "servers": {
3
+ "eido_mind": {
4
+ "transport": "http",
5
+ "url": "http://localhost:3060/mcp/server"
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,427 @@
1
+ ---
2
+ name: branch-naming
3
+ description: Intelligent branch naming based on changes, context, and best practices
4
+ description_zh: 基于更改内容、上下文和最佳实践的智能分支命名
5
+ version: 1.1.0
6
+ author: Pulse Coder Team
7
+ ---
8
+
9
+ # Branch Naming Skill (增强版)
10
+
11
+ 这个 skill 专门用于生成合适的 git 分支名称,提供多种生成策略和实用工具。
12
+
13
+ ## 快速使用
14
+
15
+ ### 一键生成分支名
16
+ ```bash
17
+ # 基本使用
18
+ ./branch-name-suggest.sh
19
+
20
+ # 指定类型
21
+ ./branch-name-suggest.sh --type feature
22
+
23
+ # 指定描述
24
+ ./branch-name-suggest.sh --desc "用户认证"
25
+
26
+ # 检查当前分支
27
+ ./branch-name-suggest.sh --check
28
+ ```
29
+
30
+ ## 高级功能
31
+
32
+ ### 1. 上下文感知命名
33
+ ```bash
34
+ #!/bin/bash
35
+ # context-aware-naming.sh
36
+
37
+ get_branch_context() {
38
+ local context=""
39
+
40
+ # 检查是否在 issue 分支上
41
+ if git branch --show-current | grep -q "issue-"; then
42
+ issue_num=$(git branch --show-current | grep -o "issue-[0-9]*")
43
+ context="$issue_num"
44
+ fi
45
+
46
+ # 检查是否有 Jira ticket
47
+ if git log --oneline -1 | grep -q "[A-Z]*-[0-9]*"; then
48
+ ticket=$(git log --oneline -1 | grep -o "[A-Z]*-[0-9]*")
49
+ context="$ticket"
50
+ fi
51
+
52
+ echo "$context"
53
+ }
54
+
55
+ # 基于上下文生成
56
+ generate_contextual_name() {
57
+ local type=$1
58
+ local description=$2
59
+ local context=$(get_branch_context)
60
+
61
+ if [[ -n "$context" ]]; then
62
+ echo "${type}/${context}-${description}"
63
+ else
64
+ echo "${type}/${description}"
65
+ fi
66
+ }
67
+ ```
68
+
69
+ ### 2. 语义化描述生成
70
+ ```bash
71
+ #!/bin/bash
72
+ # semantic-description.sh
73
+
74
+ generate_semantic_desc() {
75
+ local files=$(git diff --name-only)
76
+ local desc=""
77
+
78
+ # 分析主要功能
79
+ if echo "$files" | grep -q "auth\|login\|sign"; then
80
+ desc="auth"
81
+ elif echo "$files" | grep -q "api\|service\|endpoint"; then
82
+ desc="api"
83
+ elif echo "$files" | grep -q "ui\|component\|page"; then
84
+ desc="ui"
85
+ elif echo "$files" | grep -q "config\|setting"; then
86
+ desc="config"
87
+ else
88
+ # 基于最核心文件
89
+ main_file=$(echo "$files" | head -1 | sed 's/.*\///' | sed 's/\..*$//')
90
+ desc=$(echo "$main_file" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g')
91
+ fi
92
+
93
+ echo "$desc"
94
+ }
95
+ ```
96
+
97
+ ### 3. 团队约定集成
98
+ ```bash
99
+ #!/bin/bash
100
+ # team-naming-rules.sh
101
+
102
+ # 加载团队规则
103
+ load_team_rules() {
104
+ local config_file=".branch-naming-rules"
105
+
106
+ if [[ -f "$config_file" ]]; then
107
+ source "$config_file"
108
+ else
109
+ # 默认规则
110
+ export PREFIXES=("feature" "fix" "refactor" "hotfix" "docs" "test" "chore")
111
+ export MAX_LENGTH=50
112
+ export SEPARATOR="-"
113
+ export CASE="lowercase"
114
+ fi
115
+ }
116
+
117
+ # 验证分支名是否符合团队约定
118
+ validate_team_naming() {
119
+ local branch_name=$1
120
+ load_team_rules
121
+
122
+ # 检查前缀
123
+ local valid_prefix=false
124
+ for prefix in "${PREFIXES[@]}"; do
125
+ if [[ "$branch_name" == "$prefix"/* ]]; then
126
+ valid_prefix=true
127
+ break
128
+ fi
129
+ done
130
+
131
+ if [[ "$valid_prefix" == false ]]; then
132
+ echo "❌ 无效前缀。有效前缀: ${PREFIXES[*]}"
133
+ return 1
134
+ fi
135
+
136
+ # 检查长度
137
+ if [[ ${#branch_name} -gt $MAX_LENGTH ]]; then
138
+ echo "❌ 分支名过长 (最大 $MAX_LENGTH 字符)"
139
+ return 1
140
+ fi
141
+
142
+ echo "✅ 符合团队约定"
143
+ return 0
144
+ }
145
+ ```
146
+
147
+ ## 实际场景示例
148
+
149
+ ### 场景1:功能开发
150
+ ```bash
151
+ # 更改文件
152
+ src/components/UserProfile.tsx
153
+ src/hooks/useUser.ts
154
+ src/services/userService.ts
155
+
156
+ # 生成分支名
157
+ feature/user-profile-enhancement
158
+ ```
159
+
160
+ ### 场景2:Bug修复
161
+ ```bash
162
+ # 更改文件
163
+ src/utils/validation.js
164
+ src/pages/Login.js
165
+
166
+ # 生成分支名
167
+ fix/login-validation-error
168
+ ```
169
+
170
+ ### 场景3:集成Jira
171
+ ```bash
172
+ # 基于Jira ticket
173
+ PROJ-123: Add user authentication
174
+
175
+ # 生成分支名
176
+ feature/PROJ-123-user-authentication
177
+ ```
178
+
179
+ ### 场景4:紧急修复
180
+ ```bash
181
+ # 紧急生产问题
182
+ src/security/auth.js
183
+
184
+ # 生成分支名
185
+ hotfix/security-vulnerability-fix
186
+ ```
187
+
188
+ ## 完整脚本工具
189
+
190
+ ### 主脚本:branch-name-generator.sh
191
+ ```bash
192
+ #!/bin/bash
193
+ # 完整的分支名称生成器
194
+
195
+ set -e
196
+
197
+ # 颜色定义
198
+ RED='\033[0;31m'
199
+ GREEN='\033[0;32m'
200
+ YELLOW='\033[1;33m'
201
+ BLUE='\033[0;34m'
202
+ NC='\033[0m' # No Color
203
+
204
+ # 帮助信息
205
+ show_help() {
206
+ echo "Usage: $0 [OPTIONS]"
207
+ echo ""
208
+ echo "Options:"
209
+ echo " -t, --type TYPE 指定分支类型 (feature/fix/refactor/docs/test/chore/hotfix)"
210
+ echo " -d, --desc DESC 指定描述"
211
+ echo " -c, --check 检查当前分支名"
212
+ echo " -i, --interactive 交互模式"
213
+ echo " -h, --help 显示帮助"
214
+ echo ""
215
+ echo "Examples:"
216
+ echo " $0 # 自动分析并建议"
217
+ echo " $0 -t feature -d 'user auth'"
218
+ echo " $0 --check"
219
+ echo " $0 --interactive"
220
+ }
221
+
222
+ # 检查当前分支
223
+ check_current_branch() {
224
+ local current=$(git branch --show-current)
225
+ echo -e "${BLUE}当前分支: ${NC}$current"
226
+
227
+ if [[ "$current" =~ ^(master|main|dev|develop)$ ]]; then
228
+ echo -e "${YELLOW}⚠️ 当前分支为基础分支,建议创建新分支${NC}"
229
+ return 0
230
+ else
231
+ echo -e "${GREEN}✅ 当前分支: $current${NC}"
232
+ return 1
233
+ fi
234
+ }
235
+
236
+ # 分析更改类型
237
+ analyze_changes() {
238
+ local files=$(git diff --name-only 2>/dev/null || echo "")
239
+ local untracked=$(git ls-files --others --exclude-standard 2>/dev/null || echo "")
240
+ local all_changes="$files\n$untracked"
241
+
242
+ if [[ -z "$all_changes" ]]; then
243
+ echo "no-changes"
244
+ return
245
+ fi
246
+
247
+ # 文件类型权重
248
+ local weights=(
249
+ "feature:$(echo "$all_changes" | grep -c 'src/\|lib/\|components/\|pages/' || echo 0)"
250
+ "fix:$(echo "$all_changes" | grep -c 'fix\|bug\|patch' || echo 0)"
251
+ "test:$(echo "$all_changes" | grep -c 'test\|spec\|__tests__' || echo 0)"
252
+ "docs:$(echo "$all_changes" | grep -c '\.md\|docs/\|README' || echo 0)"
253
+ "chore:$(echo "$all_changes" | grep -c 'package\.json\|\.config\|\.yml' || echo 0)"
254
+ )
255
+
256
+ # 找出权重最高的类型
257
+ local max_weight=0
258
+ local best_type="feature"
259
+
260
+ for weight in "${weights[@]}"; do
261
+ local type=$(echo "$weight" | cut -d: -f1)
262
+ local value=$(echo "$weight" | cut -d: -f2)
263
+ if [[ $value -gt $max_weight ]]; then
264
+ max_weight=$value
265
+ best_type=$type
266
+ fi
267
+ done
268
+
269
+ echo "$best_type"
270
+ }
271
+
272
+ # 生成描述
273
+ generate_description() {
274
+ local changes=$(git diff --name-only 2>/dev/null || git ls-files --others --exclude-standard 2>/dev/null || echo "")
275
+
276
+ if [[ -z "$changes" ]]; then
277
+ echo "updates"
278
+ return
279
+ fi
280
+
281
+ # 提取主要文件名
282
+ local main_file=$(echo "$changes" | head -1 | sed 's/.*\///' | sed 's/\..*$//')
283
+ if [[ -z "$main_file" ]]; then
284
+ main_file="changes"
285
+ fi
286
+
287
+ # 清理特殊字符
288
+ local clean_desc=$(echo "$main_file" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]/-/g; s/--*/-/g; s/^-//g; s/-$//g')
289
+ echo "$clean_desc"
290
+ }
291
+
292
+ # 生成完整分支名
293
+ generate_branch_name() {
294
+ local type=${1:-$(analyze_changes)}
295
+ local desc=${2:-$(generate_description)}
296
+
297
+ # 检查是否有 Jira ticket
298
+ local jira_ticket=$(git log --oneline -1 2>/dev/null | grep -o "[A-Z]*-[0-9]*" || echo "")
299
+
300
+ local branch_name
301
+ if [[ -n "$jira_ticket" ]]; then
302
+ branch_name="${type}/${jira_ticket}-${desc}"
303
+ else
304
+ branch_name="${type}/${desc}"
305
+ fi
306
+
307
+ # 确保不超过50字符
308
+ if [[ ${#branch_name} -gt 50 ]]; then
309
+ branch_name="${branch_name:0:50}"
310
+ fi
311
+
312
+ echo "$branch_name"
313
+ }
314
+
315
+ # 交互模式
316
+ interactive_mode() {
317
+ echo -e "${BLUE}=== 交互式分支命名 ===${NC}"
318
+
319
+ check_current_branch
320
+
321
+ local suggested_type=$(analyze_changes)
322
+ local suggested_desc=$(generate_description)
323
+
324
+ echo ""
325
+ echo -e "${GREEN}分析结果:${NC}"
326
+ echo "建议类型: $suggested_type"
327
+ echo "建议描述: $suggested_desc"
328
+
329
+ echo ""
330
+ echo "1) 使用建议: ${suggested_type}/${suggested_desc}"
331
+ echo "2) 自定义类型和描述"
332
+ echo "3) 查看其他建议"
333
+ read -p "选择 [1-3]: " choice
334
+
335
+ case $choice in
336
+ 1)
337
+ echo $(generate_branch_name "$suggested_type" "$suggested_desc")
338
+ ;;
339
+ 2)
340
+ read -p "分支类型 (feature/fix/refactor/docs/test/chore/hotfix): " custom_type
341
+ read -p "分支描述: " custom_desc
342
+ echo $(generate_branch_name "$custom_type" "$custom_desc")
343
+ ;;
344
+ 3)
345
+ echo "更多建议:"
346
+ echo "- ${suggested_type}/${suggested_desc}-$(date +%m%d)"
347
+ echo "- ${suggested_type}/$(date +%Y%m%d)-${suggested_desc}"
348
+ ;;
349
+ esac
350
+ }
351
+
352
+ # 主程序
353
+ main() {
354
+ local type=""
355
+ local desc=""
356
+ local check_only=false
357
+ local interactive=false
358
+
359
+ while [[ $# -gt 0 ]]; do
360
+ case $1 in
361
+ -t|--type)
362
+ type="$2"
363
+ shift 2
364
+ ;;
365
+ -d|--desc)
366
+ desc="$2"
367
+ shift 2
368
+ ;;
369
+ -c|--check)
370
+ check_only=true
371
+ shift
372
+ ;;
373
+ -i|--interactive)
374
+ interactive=true
375
+ shift
376
+ ;;
377
+ -h|--help)
378
+ show_help
379
+ exit 0
380
+ ;;
381
+ *)
382
+ echo "未知选项: $1"
383
+ show_help
384
+ exit 1
385
+ ;;
386
+ esac
387
+ done
388
+
389
+ if [[ "$check_only" == true ]]; then
390
+ check_current_branch
391
+ exit 0
392
+ fi
393
+
394
+ if [[ "$interactive" == true ]]; then
395
+ interactive_mode
396
+ exit 0
397
+ fi
398
+
399
+ # 默认行为
400
+ local branch_name=$(generate_branch_name "$type" "$desc")
401
+ echo "$branch_name"
402
+ }
403
+
404
+ # 如果直接运行
405
+ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
406
+ main "$@"
407
+ fi
408
+ ```
409
+
410
+ ## 集成到工作流
411
+
412
+ ### 添加到 package.json
413
+ ```json
414
+ {
415
+ "scripts": {
416
+ "branch:suggest": "./.coder/skills/branch-naming/branch-name-generator.sh",
417
+ "branch:check": "./.coder/skills/branch-naming/branch-name-generator.sh --check",
418
+ "branch:interactive": "./.coder/skills/branch-naming/branch-name-generator.sh --interactive"
419
+ }
420
+ }
421
+ ```
422
+
423
+ ### Git 别名配置
424
+ ```bash
425
+ git config alias.suggest "!.coder/skills/branch-naming/branch-name-generator.sh"
426
+ git config alias.branch-check "!.coder/skills/branch-naming/branch-name-generator.sh --check"
427
+ ```
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: code-review
3
+ description: Perform comprehensive code review including code quality, security, performance, and best practices
4
+ version: 1.0.0
5
+ author: Pulse Coder Team
6
+ ---
7
+
8
+ # Code Review Skill
9
+
10
+ This skill helps you perform thorough code reviews with focus on:
11
+
12
+ ## What to Check
13
+
14
+ ### Code Quality
15
+ - Readability and maintainability
16
+ - Proper naming conventions
17
+ - Code duplication
18
+ - Function/method complexity
19
+ - Documentation and comments
20
+
21
+ ### Security
22
+ - Input validation
23
+ - Authentication and authorization
24
+ - SQL injection vulnerabilities
25
+ - XSS vulnerabilities
26
+ - Sensitive data exposure
27
+
28
+ ### Performance
29
+ - Algorithm efficiency
30
+ - Database query optimization
31
+ - Memory usage
32
+ - Resource leaks
33
+
34
+ ### Best Practices
35
+ - Design patterns
36
+ - SOLID principles
37
+ - Framework conventions
38
+ - Error handling
39
+ - Testing coverage
40
+
41
+ ## Usage
42
+
43
+ When reviewing code, follow these steps:
44
+ 1. Read the code thoroughly
45
+ 2. Check for each category above
46
+ 3. Provide specific, actionable feedback
47
+ 4. Suggest concrete improvements
48
+ 5. Highlight both issues and good practices
49
+
50
+ ## Output Format
51
+
52
+ Provide feedback in this structure:
53
+ - **Critical Issues**: Security vulnerabilities, bugs
54
+ - **Improvements**: Performance, maintainability
55
+ - **Suggestions**: Best practices, style
56
+ - **Positive Notes**: Well-written code, good patterns