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.
- package/.pulse-coder/agents/code-reviewer.md +36 -0
- package/.pulse-coder/agents/doc-generator.md +37 -0
- package/.pulse-coder/agents/test-writer.md +38 -0
- package/.pulse-coder/mcp.json +8 -0
- package/.pulse-coder/skills/branch-naming/SKILL.md +427 -0
- package/.pulse-coder/skills/code-review/SKILL.md +56 -0
- package/.pulse-coder/skills/deep-research/SKILL.md +124 -0
- package/.pulse-coder/skills/git-workflow/SKILL.md +93 -0
- package/.pulse-coder/skills/mr-generator/README.md +96 -0
- package/.pulse-coder/skills/mr-generator/SKILL.md +113 -0
- package/.pulse-coder/skills/mr-generator/mr-generate.sh +342 -0
- package/.pulse-coder/skills/refactor/SKILL.md +63 -0
- package/README.md +155 -0
- package/dist/index.js +599 -0
- package/dist/index.js.map +1 -0
- package/package.json +25 -0
- package/src/index.ts +321 -0
- package/src/input-manager.ts +113 -0
- package/src/session-commands.ts +142 -0
- package/src/session.ts +171 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# MR Generator - 自动生成 MR 标题和描述
|
|
4
|
+
# 基于当前分支与远程 master 的 diff 分析
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# 配置
|
|
9
|
+
TARGET_BRANCH="origin/master"
|
|
10
|
+
PREVIEW_MODE=false
|
|
11
|
+
|
|
12
|
+
# 颜色定义
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
BLUE='\033[0;34m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
RED='\033[0;31m'
|
|
17
|
+
NC='\033[0m'
|
|
18
|
+
|
|
19
|
+
# 解析参数
|
|
20
|
+
while [[ $# -gt 0 ]]; do
|
|
21
|
+
case $1 in
|
|
22
|
+
--target)
|
|
23
|
+
TARGET_BRANCH="$2"
|
|
24
|
+
shift 2
|
|
25
|
+
;;
|
|
26
|
+
--preview)
|
|
27
|
+
PREVIEW_MODE=true
|
|
28
|
+
shift
|
|
29
|
+
;;
|
|
30
|
+
-h|--help)
|
|
31
|
+
echo "Usage: $0 [--target branch] [--preview]"
|
|
32
|
+
echo "Generate MR title and description based on branch diff"
|
|
33
|
+
echo ""
|
|
34
|
+
echo "Options:"
|
|
35
|
+
echo " --target branch Target branch to compare against (default: origin/master)"
|
|
36
|
+
echo " --preview Show preview mode with additional info"
|
|
37
|
+
echo " -h, --help Show this help message"
|
|
38
|
+
exit 0
|
|
39
|
+
;;
|
|
40
|
+
*)
|
|
41
|
+
echo "❌ Unknown option: $1"
|
|
42
|
+
exit 1
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
# 获取当前分支
|
|
48
|
+
current_branch=$(git branch --show-current)
|
|
49
|
+
if [[ "$current_branch" == "master" || "$current_branch" == "main" ]]; then
|
|
50
|
+
echo "❌ Cannot create MR from master branch"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# 确保远程分支是最新的
|
|
55
|
+
echo -e "${BLUE}Fetching latest changes...${NC}"
|
|
56
|
+
git fetch origin
|
|
57
|
+
|
|
58
|
+
# 检查目标分支是否存在
|
|
59
|
+
if ! git ls-remote --heads origin "${TARGET_BRANCH#origin/}" | grep -q "refs/heads/"; then
|
|
60
|
+
echo "❌ Target branch $TARGET_BRANCH does not exist"
|
|
61
|
+
exit 1
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# 获取 diff 统计和变更类型
|
|
65
|
+
diff_stats=$(git diff --stat "$TARGET_BRANCH"...HEAD 2>/dev/null || echo "")
|
|
66
|
+
if [[ -z "$diff_stats" ]]; then
|
|
67
|
+
echo "❌ No changes detected between $current_branch and $TARGET_BRANCH"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# 获取变更文件列表和状态
|
|
72
|
+
changed_files=$(git diff --name-only "$TARGET_BRANCH"...HEAD)
|
|
73
|
+
file_count=$(echo "$changed_files" | wc -l | tr -d ' ')
|
|
74
|
+
|
|
75
|
+
# 获取文件状态统计
|
|
76
|
+
added_files=$(git diff --name-status "$TARGET_BRANCH"...HEAD | grep "^A" | wc -l | tr -d ' ')
|
|
77
|
+
modified_files=$(git diff --name-status "$TARGET_BRANCH"...HEAD | grep "^M" | wc -l | tr -d ' ')
|
|
78
|
+
deleted_files=$(git diff --name-status "$TARGET_BRANCH"...HEAD | grep "^D" | wc -l | tr -d ' ')
|
|
79
|
+
|
|
80
|
+
# 分析变更类型
|
|
81
|
+
analyze_change_type() {
|
|
82
|
+
local files="$1"
|
|
83
|
+
|
|
84
|
+
# 检查文件类型分布
|
|
85
|
+
local has_src=$(echo "$files" | grep -c "src/" || echo 0)
|
|
86
|
+
local has_test=$(echo "$files" | grep -c "test\|spec" || echo 0)
|
|
87
|
+
local has_docs=$(echo "$files" | grep -c "\.md\|README\|docs/" || echo 0)
|
|
88
|
+
local has_config=$(echo "$files" | grep -c "\.json\|\.yml\|\.yaml\|\.config" || echo 0)
|
|
89
|
+
local has_fix=$(git log --oneline "$TARGET_BRANCH"...HEAD | grep -ic "fix\|bug\|repair\|resolve" || echo 0)
|
|
90
|
+
local has_feature=$(git log --oneline "$TARGET_BRANCH"...HEAD | grep -ic "feat\|feature\|add\|implement" || echo 0)
|
|
91
|
+
|
|
92
|
+
# 基于文件状态判断
|
|
93
|
+
if [[ $added_files -gt 0 && $modified_files -eq 0 && $deleted_files -eq 0 ]]; then
|
|
94
|
+
echo "add"
|
|
95
|
+
elif [[ $deleted_files -gt 0 ]]; then
|
|
96
|
+
echo "remove"
|
|
97
|
+
elif [[ $has_fix -gt 0 ]]; then
|
|
98
|
+
echo "fix"
|
|
99
|
+
elif [[ $has_feature -gt 0 ]]; then
|
|
100
|
+
echo "feature"
|
|
101
|
+
elif [[ $has_test -gt $(($file_count / 2)) ]]; then
|
|
102
|
+
echo "test"
|
|
103
|
+
elif [[ $has_docs -gt $(($file_count / 2)) ]]; then
|
|
104
|
+
echo "docs"
|
|
105
|
+
elif [[ $has_config -gt 0 ]]; then
|
|
106
|
+
echo "config"
|
|
107
|
+
else
|
|
108
|
+
echo "update"
|
|
109
|
+
fi
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
# 提取主要模块
|
|
113
|
+
extract_main_module() {
|
|
114
|
+
local files="$1"
|
|
115
|
+
|
|
116
|
+
# 找出最常见的目录/模块
|
|
117
|
+
local module=$(echo "$files" | sed 's|\(.*\)/.*|\1|' | sort | uniq -c | sort -nr | head -1 | awk '{print $2}' | sed 's|packages/cli/||' | sed 's|src/||' | sed 's|lib/||' | sed 's|components/||' | sed 's|pages/||' | sed 's|\.coder/skills/||')
|
|
118
|
+
|
|
119
|
+
# 如果没有目录,从文件名提取
|
|
120
|
+
if [[ -z "$module" || "$module" == "." ]]; then
|
|
121
|
+
local first_file=$(echo "$files" | head -1 | sed 's|.*/||' | sed 's/\..*$//')
|
|
122
|
+
module=$(echo "$first_file" | tr '_' ' ' | tr '-' ' ')
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# 转换为简洁描述
|
|
126
|
+
echo "$module" | sed 's/$/ module/' | sed 's/src module/source/' | sed 's/config module/configuration/' | sed 's/test module/testing/' | sed 's/api/API/' | sed 's/ui/UI/' | sed 's/auth/authentication/' | sed 's/validation/validation/' | sed 's/utils/utilities/' | sed 's/services/service layer/' | sed 's/ [Mm]odule$//' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# 生成标题
|
|
130
|
+
generate_title() {
|
|
131
|
+
local change_type="$1"
|
|
132
|
+
local module="$2"
|
|
133
|
+
|
|
134
|
+
case "$change_type" in
|
|
135
|
+
"add")
|
|
136
|
+
echo "Add ${module}"
|
|
137
|
+
;;
|
|
138
|
+
"remove")
|
|
139
|
+
echo "Remove ${module}"
|
|
140
|
+
;;
|
|
141
|
+
"fix")
|
|
142
|
+
echo "Fix ${module} issue"
|
|
143
|
+
;;
|
|
144
|
+
"test")
|
|
145
|
+
echo "Add tests for ${module}"
|
|
146
|
+
;;
|
|
147
|
+
"docs")
|
|
148
|
+
echo "Update ${module} documentation"
|
|
149
|
+
;;
|
|
150
|
+
"config")
|
|
151
|
+
echo "Update ${module} configuration"
|
|
152
|
+
;;
|
|
153
|
+
"feature")
|
|
154
|
+
echo "Add ${module} functionality"
|
|
155
|
+
;;
|
|
156
|
+
"update")
|
|
157
|
+
echo "Update ${module}"
|
|
158
|
+
;;
|
|
159
|
+
*)
|
|
160
|
+
echo "Update ${module}"
|
|
161
|
+
;;
|
|
162
|
+
esac
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
# 生成更智能的描述点
|
|
166
|
+
generate_description_points() {
|
|
167
|
+
local change_type="$1"
|
|
168
|
+
local files="$2"
|
|
169
|
+
|
|
170
|
+
local points=()
|
|
171
|
+
|
|
172
|
+
# 基于文件状态和类型生成描述
|
|
173
|
+
local file_statuses=$(git diff --name-status "$TARGET_BRANCH"...HEAD)
|
|
174
|
+
|
|
175
|
+
while IFS= read -r line; do
|
|
176
|
+
local status=$(echo "$line" | awk '{print $1}')
|
|
177
|
+
local file=$(echo "$line" | awk '{print $2}')
|
|
178
|
+
local basename=$(basename "$file" | sed 's/\..*$//')
|
|
179
|
+
local dirname=$(dirname "$file")
|
|
180
|
+
|
|
181
|
+
case "$status" in
|
|
182
|
+
"A")
|
|
183
|
+
case "$file" in
|
|
184
|
+
*.sh)
|
|
185
|
+
points+=("Add ${basename} script for automation")
|
|
186
|
+
;;
|
|
187
|
+
*.md|*.txt)
|
|
188
|
+
points+=("Add ${basename} documentation")
|
|
189
|
+
;;
|
|
190
|
+
*.js|*.ts|*.py|*.go|*.java|*.cpp|*.c)
|
|
191
|
+
points+=("Implement ${basename} functionality")
|
|
192
|
+
;;
|
|
193
|
+
*.json|*.yml|*.yaml|toml)
|
|
194
|
+
points+=("Add ${basename} configuration")
|
|
195
|
+
;;
|
|
196
|
+
*.test.js|*.spec.js|*.test.ts|*.spec.ts)
|
|
197
|
+
points+=("Add test suite for ${basename%.*}")
|
|
198
|
+
;;
|
|
199
|
+
*)
|
|
200
|
+
points+=("Add ${basename}")
|
|
201
|
+
;;
|
|
202
|
+
esac
|
|
203
|
+
;;
|
|
204
|
+
"M")
|
|
205
|
+
case "$file" in
|
|
206
|
+
*.js|*.ts|*.py|*.go)
|
|
207
|
+
if [[ "$change_type" == "fix" ]]; then
|
|
208
|
+
points+=("Fix ${basename} logic")
|
|
209
|
+
else
|
|
210
|
+
points+=("Improve ${basename} implementation")
|
|
211
|
+
fi
|
|
212
|
+
;;
|
|
213
|
+
*.test.js|*.spec.js|*.test.ts|*.spec.ts)
|
|
214
|
+
points+=("Update tests for ${basename%.*}")
|
|
215
|
+
;;
|
|
216
|
+
*.md|*.txt)
|
|
217
|
+
points+=("Update documentation")
|
|
218
|
+
;;
|
|
219
|
+
*.json|*.yml|*.yaml)
|
|
220
|
+
points+=("Update configuration")
|
|
221
|
+
;;
|
|
222
|
+
*.css|*.scss|*.less)
|
|
223
|
+
points+=("Improve styling")
|
|
224
|
+
;;
|
|
225
|
+
*)
|
|
226
|
+
points+=("Update ${basename}")
|
|
227
|
+
;;
|
|
228
|
+
esac
|
|
229
|
+
;;
|
|
230
|
+
"D")
|
|
231
|
+
points+=("Remove ${basename}")
|
|
232
|
+
;;
|
|
233
|
+
esac
|
|
234
|
+
done <<< "$file_statuses"
|
|
235
|
+
|
|
236
|
+
# 去重并保持顺序,最多3个点
|
|
237
|
+
printf '%s\n' "${points[@]}" | awk '!seen[$0]++' | head -3
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
# 生成完整描述
|
|
241
|
+
generate_description() {
|
|
242
|
+
local change_type="$1"
|
|
243
|
+
local module="$2"
|
|
244
|
+
local files="$3"
|
|
245
|
+
|
|
246
|
+
local summary=""
|
|
247
|
+
case "$change_type" in
|
|
248
|
+
"add")
|
|
249
|
+
summary="Add comprehensive ${module} functionality"
|
|
250
|
+
;;
|
|
251
|
+
"remove")
|
|
252
|
+
summary="Remove ${module} from codebase"
|
|
253
|
+
;;
|
|
254
|
+
"fix")
|
|
255
|
+
summary="Resolve ${module} issues and improve stability"
|
|
256
|
+
;;
|
|
257
|
+
"test")
|
|
258
|
+
summary="Enhance test coverage for ${module}"
|
|
259
|
+
;;
|
|
260
|
+
"docs")
|
|
261
|
+
summary="Improve ${module} documentation"
|
|
262
|
+
;;
|
|
263
|
+
"config")
|
|
264
|
+
summary="Update ${module} configuration"
|
|
265
|
+
;;
|
|
266
|
+
"feature")
|
|
267
|
+
summary="Implement ${module} functionality"
|
|
268
|
+
;;
|
|
269
|
+
"update")
|
|
270
|
+
summary="Update ${module} implementation"
|
|
271
|
+
;;
|
|
272
|
+
*)
|
|
273
|
+
summary="Update ${module}"
|
|
274
|
+
;;
|
|
275
|
+
esac
|
|
276
|
+
|
|
277
|
+
local points=$(generate_description_points "$change_type" "$files")
|
|
278
|
+
|
|
279
|
+
echo "$summary"
|
|
280
|
+
echo ""
|
|
281
|
+
echo "$points" | sed 's/^/- /'
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
# 检查是否有 Jira ticket
|
|
285
|
+
get_jira_ticket() {
|
|
286
|
+
local ticket=$(git log --oneline "$TARGET_BRANCH"...HEAD | grep -o "[A-Z][A-Z0-9]*-[0-9]*" | head -1 || echo "")
|
|
287
|
+
echo "$ticket"
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
# 生成详细统计信息
|
|
291
|
+
generate_stats() {
|
|
292
|
+
local files="$1"
|
|
293
|
+
local total_lines=$(git diff --stat "$TARGET_BRANCH"...HEAD | tail -1 | awk '{print $1+$3}' || echo "0")
|
|
294
|
+
|
|
295
|
+
echo "Files changed: $file_count"
|
|
296
|
+
[[ $added_files -gt 0 ]] && echo "Files added: $added_files"
|
|
297
|
+
[[ $modified_files -gt 0 ]] && echo "Files modified: $modified_files"
|
|
298
|
+
[[ $deleted_files -gt 0 ]] && echo "Files deleted: $deleted_files"
|
|
299
|
+
[[ $total_lines -gt 0 ]] && echo "Lines changed: ±$total_lines"
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
# 主逻辑
|
|
303
|
+
main() {
|
|
304
|
+
echo -e "${BLUE}Analyzing changes between $current_branch and $TARGET_BRANCH...${NC}"
|
|
305
|
+
|
|
306
|
+
# 分析变更
|
|
307
|
+
change_type=$(analyze_change_type "$changed_files")
|
|
308
|
+
main_module=$(extract_main_module "$changed_files")
|
|
309
|
+
jira_ticket=$(get_jira_ticket)
|
|
310
|
+
|
|
311
|
+
# 生成标题
|
|
312
|
+
title=$(generate_title "$change_type" "$main_module")
|
|
313
|
+
|
|
314
|
+
# 如果有 Jira ticket,添加到标题
|
|
315
|
+
if [[ -n "$jira_ticket" ]]; then
|
|
316
|
+
title="$jira_ticket: $title"
|
|
317
|
+
fi
|
|
318
|
+
|
|
319
|
+
# 截断标题到50字符以内
|
|
320
|
+
if [[ ${#title} -gt 50 ]]; then
|
|
321
|
+
title="${title:0:47}..."
|
|
322
|
+
fi
|
|
323
|
+
|
|
324
|
+
# 生成描述
|
|
325
|
+
description=$(generate_description "$change_type" "$main_module" "$changed_files")
|
|
326
|
+
|
|
327
|
+
# 输出结果
|
|
328
|
+
if [[ "$PREVIEW_MODE" == true ]]; then
|
|
329
|
+
echo -e "${GREEN}=== MR Preview ===${NC}"
|
|
330
|
+
echo "Source: $current_branch"
|
|
331
|
+
echo "Target: $TARGET_BRANCH"
|
|
332
|
+
generate_stats "$changed_files"
|
|
333
|
+
echo ""
|
|
334
|
+
fi
|
|
335
|
+
|
|
336
|
+
echo "$title"
|
|
337
|
+
echo ""
|
|
338
|
+
echo "$description"
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
# 运行主程序
|
|
342
|
+
main
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor
|
|
3
|
+
description: Refactor code to improve structure, readability, and maintainability without changing behavior
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: Pulse Coder Team
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Code Refactoring Skill
|
|
9
|
+
|
|
10
|
+
This skill guides systematic code refactoring while preserving functionality.
|
|
11
|
+
|
|
12
|
+
## Refactoring Principles
|
|
13
|
+
|
|
14
|
+
### Extract Method/Function
|
|
15
|
+
- Break down large functions into smaller, focused ones
|
|
16
|
+
- Name functions based on their purpose
|
|
17
|
+
- Each function should do one thing well
|
|
18
|
+
|
|
19
|
+
### Simplify Conditionals
|
|
20
|
+
- Replace complex conditions with well-named functions
|
|
21
|
+
- Use early returns to reduce nesting
|
|
22
|
+
- Consider guard clauses
|
|
23
|
+
|
|
24
|
+
### Remove Duplication
|
|
25
|
+
- Identify repeated code patterns
|
|
26
|
+
- Extract common logic into reusable functions
|
|
27
|
+
- Use abstraction wisely (avoid premature optimization)
|
|
28
|
+
|
|
29
|
+
### Improve Naming
|
|
30
|
+
- Use descriptive, meaningful names
|
|
31
|
+
- Follow language conventions
|
|
32
|
+
- Avoid abbreviations unless widely known
|
|
33
|
+
|
|
34
|
+
### Organize Code
|
|
35
|
+
- Group related functionality
|
|
36
|
+
- Separate concerns
|
|
37
|
+
- Follow single responsibility principle
|
|
38
|
+
|
|
39
|
+
## Refactoring Workflow
|
|
40
|
+
|
|
41
|
+
1. **Understand First**: Read and understand the existing code
|
|
42
|
+
2. **Ensure Tests**: Make sure tests exist or write them
|
|
43
|
+
3. **Small Steps**: Make incremental changes
|
|
44
|
+
4. **Test After Each Step**: Verify functionality is preserved
|
|
45
|
+
5. **Review**: Check if the code is clearer than before
|
|
46
|
+
|
|
47
|
+
## Common Refactoring Patterns
|
|
48
|
+
|
|
49
|
+
- Extract Method
|
|
50
|
+
- Extract Variable
|
|
51
|
+
- Inline Method/Variable
|
|
52
|
+
- Replace Magic Number with Named Constant
|
|
53
|
+
- Replace Conditional with Polymorphism
|
|
54
|
+
- Move Method/Field
|
|
55
|
+
- Rename Method/Variable
|
|
56
|
+
|
|
57
|
+
## Safety Guidelines
|
|
58
|
+
|
|
59
|
+
- Never change behavior while refactoring
|
|
60
|
+
- Keep refactoring separate from feature work
|
|
61
|
+
- Run tests after each change
|
|
62
|
+
- Use version control to track changes
|
|
63
|
+
- Consider reverting if complexity increases
|
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# @pulse-coder/cli
|
|
2
|
+
|
|
3
|
+
Pulse Coder CLI 是一个智能命令行助手,基于 `@pulse-coder/engine` 构建,自动包含 MCP 和 Skills 功能。
|
|
4
|
+
|
|
5
|
+
## 快速开始
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 安装依赖
|
|
9
|
+
npm install
|
|
10
|
+
|
|
11
|
+
# 开发模式
|
|
12
|
+
npm run dev
|
|
13
|
+
|
|
14
|
+
# 构建
|
|
15
|
+
npm run build
|
|
16
|
+
|
|
17
|
+
# 运行
|
|
18
|
+
npm start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 功能特性
|
|
22
|
+
|
|
23
|
+
- ✅ **内置 MCP 支持** - 无需额外配置
|
|
24
|
+
- ✅ **内置 Skills 系统** - 智能技能识别
|
|
25
|
+
- ✅ **会话管理** - 保存和恢复对话
|
|
26
|
+
- ✅ **命令模式** - 丰富的交互命令
|
|
27
|
+
|
|
28
|
+
## 使用示例
|
|
29
|
+
|
|
30
|
+
### 基本使用
|
|
31
|
+
```bash
|
|
32
|
+
# 直接启动
|
|
33
|
+
./dist/index.js
|
|
34
|
+
|
|
35
|
+
# 或者全局安装后
|
|
36
|
+
coder
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 内置功能示例
|
|
40
|
+
|
|
41
|
+
**MCP 功能**(自动加载):
|
|
42
|
+
```
|
|
43
|
+
> 使用 mcp_eido_mind_search 搜索一些信息
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Skills 功能**(自动加载):
|
|
47
|
+
```
|
|
48
|
+
> 帮我生成一个分支名
|
|
49
|
+
# 会自动使用 branch-naming 技能
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 会话管理命令
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
/new [title] - 创建新会话
|
|
56
|
+
/resume <id> - 恢复会话
|
|
57
|
+
/sessions - 列出所有会话
|
|
58
|
+
/search <query> - 搜索会话
|
|
59
|
+
/rename <id> <title> - 重命名会话
|
|
60
|
+
/delete <id> - 删除会话
|
|
61
|
+
/save - 保存当前会话
|
|
62
|
+
/status - 显示会话状态
|
|
63
|
+
/exit - 退出并保存
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 配置文件
|
|
67
|
+
|
|
68
|
+
### MCP 配置
|
|
69
|
+
创建 `.coder/mcp.json`:
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"servers": {
|
|
73
|
+
"eido_mind": {
|
|
74
|
+
"transport": "http",
|
|
75
|
+
"url": "http://localhost:3060/mcp/server"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Skills 配置
|
|
82
|
+
创建 `.coder/skills/<skill-name>/SKILL.md`:
|
|
83
|
+
```markdown
|
|
84
|
+
---
|
|
85
|
+
name: my-custom-skill
|
|
86
|
+
description: 我的自定义技能
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
# 技能内容...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 架构优势
|
|
93
|
+
|
|
94
|
+
### 零配置体验
|
|
95
|
+
```typescript
|
|
96
|
+
// 之前需要显式配置
|
|
97
|
+
const engine = new Engine({
|
|
98
|
+
enginePlugins: {
|
|
99
|
+
plugins: [skillRegistryPlugin, mcpPlugin]
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// 现在自动包含
|
|
104
|
+
const engine = new Engine(); // 内置插件已自动加载
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 可扩展性
|
|
108
|
+
```typescript
|
|
109
|
+
// 仍然支持自定义插件
|
|
110
|
+
const engine = new Engine({
|
|
111
|
+
enginePlugins: {
|
|
112
|
+
plugins: [myCustomPlugin], // 额外插件
|
|
113
|
+
dirs: ['.coder/engine-plugins'],
|
|
114
|
+
scan: true
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 选择性禁用
|
|
120
|
+
```typescript
|
|
121
|
+
// 如果需要禁用内置插件
|
|
122
|
+
const engine = new Engine({
|
|
123
|
+
disableBuiltInPlugins: true,
|
|
124
|
+
enginePlugins: {
|
|
125
|
+
plugins: [onlyMCPPlugin] // 只使用部分内置功能
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 开发
|
|
131
|
+
|
|
132
|
+
### 环境要求
|
|
133
|
+
- Node.js 18+
|
|
134
|
+
- TypeScript 5.0+
|
|
135
|
+
|
|
136
|
+
### 项目结构
|
|
137
|
+
```
|
|
138
|
+
src/
|
|
139
|
+
├── index.ts # 主入口
|
|
140
|
+
├── session-commands.ts # 会话管理
|
|
141
|
+
└── input-manager.ts # 输入处理
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 构建
|
|
145
|
+
```bash
|
|
146
|
+
npm run build # 构建 TypeScript
|
|
147
|
+
npm run dev # 开发模式(带热重载)
|
|
148
|
+
npm run test # 运行测试
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 依赖
|
|
152
|
+
|
|
153
|
+
- `@pulse-coder/engine` - 核心引擎(包含内置 MCP 和 Skills 插件)
|
|
154
|
+
|
|
155
|
+
无需额外依赖,所有核心功能都已内置!
|