flowmind 1.0.1 → 1.2.2
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/README_CN.md +248 -0
- package/bin/flowmind.js +638 -2
- package/config/ai-config.example.json +64 -0
- package/config/claude-mcp-config.example.json +12 -0
- package/core/ai/base-model.js +70 -0
- package/core/ai/index.js +29 -0
- package/core/ai/model-manager.js +320 -0
- package/core/ai/prompts/extraction.js +38 -0
- package/core/ai/prompts/index.js +11 -0
- package/core/ai/prompts/intent.js +43 -0
- package/core/ai/prompts/learning.js +46 -0
- package/core/ai/prompts/selection.js +38 -0
- package/core/ai/prompts/summary.js +35 -0
- package/core/ai/providers/anthropic.js +93 -0
- package/core/ai/providers/deepseek.js +80 -0
- package/core/ai/providers/ernie.js +111 -0
- package/core/ai/providers/glm.js +80 -0
- package/core/ai/providers/mimo.js +80 -0
- package/core/ai/providers/ollama.js +147 -0
- package/core/ai/providers/openai.js +82 -0
- package/core/ai/providers/qwen.js +80 -0
- package/core/event-bus.js +17 -0
- package/core/honor-engine.js +255 -0
- package/core/index.js +115 -13
- package/core/learning-engine.js +29 -1
- package/core/skill-loader.js +31 -9
- package/dashboard/app.jsx +29 -0
- package/dashboard/components/ActivityFeed.jsx +86 -0
- package/dashboard/components/DragonPanel.jsx +67 -0
- package/dashboard/components/McpStatusBar.jsx +43 -0
- package/dashboard/components/StatsRow.jsx +65 -0
- package/mcp/server.js +328 -0
- package/package.json +19 -7
- package/tui/app.jsx +69 -0
- package/tui/components/ChatPanel.jsx +72 -0
- package/tui/components/DragonTotem.jsx +108 -0
- package/tui/components/ResultPanel.jsx +33 -0
- package/tui/components/Sidebar.jsx +70 -0
- package/tui/components/StatusBar.jsx +49 -0
package/README_CN.md
CHANGED
|
@@ -94,7 +94,13 @@ npm install -g flowmind
|
|
|
94
94
|
### 初始化
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
+
# 基础初始化
|
|
97
98
|
flowmind init
|
|
99
|
+
|
|
100
|
+
# 带 AI 模型初始化 (推荐)
|
|
101
|
+
flowmind init --ai openai
|
|
102
|
+
flowmind init --ai anthropic
|
|
103
|
+
flowmind init --ai ollama
|
|
98
104
|
```
|
|
99
105
|
|
|
100
106
|
> 一次配置,永久生效。配置资源连接、学习偏好、输出格式,无需每次重复设置。
|
|
@@ -113,6 +119,248 @@ FlowMind: [自动使用顺序列表格式] ✓
|
|
|
113
119
|
|
|
114
120
|
---
|
|
115
121
|
|
|
122
|
+
## 📖 使用方式
|
|
123
|
+
|
|
124
|
+
FlowMind 支持 4 种使用方式,满足不同场景需求:
|
|
125
|
+
|
|
126
|
+
### 方式1: CLI 独立使用
|
|
127
|
+
|
|
128
|
+
最简单的使用方式,无需 AI 模型,直接通过命令行调用。
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 单次执行
|
|
132
|
+
flowmind "查询 traceId abc123 的日志"
|
|
133
|
+
flowmind "审查代码质量"
|
|
134
|
+
flowmind "验证订单数据"
|
|
135
|
+
|
|
136
|
+
# 交互模式
|
|
137
|
+
flowmind
|
|
138
|
+
|
|
139
|
+
# 指定技能执行
|
|
140
|
+
flowmind process --skill log-audit "查询最近1小时的错误日志"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**特点:**
|
|
144
|
+
- ✅ 无需 AI 模型
|
|
145
|
+
- ✅ 基于规则引擎匹配
|
|
146
|
+
- ✅ 支持学习和记忆
|
|
147
|
+
- ✅ 离线可用
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### 方式2: AI 模型直接接入
|
|
152
|
+
|
|
153
|
+
FlowMind 内置 AI 模型接入层,可直接调用 OpenAI、Anthropic、Ollama 等模型。
|
|
154
|
+
|
|
155
|
+
#### 配置 AI 模型
|
|
156
|
+
|
|
157
|
+
**方式 A:通过 CLI 初始化(推荐)**
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# 配置 OpenAI
|
|
161
|
+
flowmind init --ai openai
|
|
162
|
+
# 会提示输入 API Key
|
|
163
|
+
|
|
164
|
+
# 配置 Anthropic
|
|
165
|
+
flowmind init --ai anthropic
|
|
166
|
+
|
|
167
|
+
# 配置 Ollama (本地模型)
|
|
168
|
+
flowmind init --ai ollama
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**方式 B:手动配置**
|
|
172
|
+
|
|
173
|
+
创建 `~/.flowmind/ai-config.json`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"ai": {
|
|
178
|
+
"enabled": true,
|
|
179
|
+
"defaultProvider": "openai",
|
|
180
|
+
"fallbackToRules": true,
|
|
181
|
+
"providers": {
|
|
182
|
+
"openai": {
|
|
183
|
+
"apiKey": "sk-your-api-key",
|
|
184
|
+
"model": "gpt-4",
|
|
185
|
+
"temperature": 0.3
|
|
186
|
+
},
|
|
187
|
+
"anthropic": {
|
|
188
|
+
"apiKey": "sk-ant-your-api-key",
|
|
189
|
+
"model": "claude-3-sonnet-20240229"
|
|
190
|
+
},
|
|
191
|
+
"ollama": {
|
|
192
|
+
"baseUrl": "http://localhost:11434",
|
|
193
|
+
"model": "llama2"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"features": {
|
|
197
|
+
"intentUnderstanding": true,
|
|
198
|
+
"parameterExtraction": true,
|
|
199
|
+
"skillSelection": true,
|
|
200
|
+
"resultSummary": true,
|
|
201
|
+
"learningFeedback": true
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**方式 C:环境变量**
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
export OPENAI_API_KEY=sk-your-api-key
|
|
211
|
+
export ANTHROPIC_API_KEY=sk-ant-your-api-key
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### 测试 AI 连接
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# 测试默认 Provider
|
|
218
|
+
flowmind ai --test
|
|
219
|
+
|
|
220
|
+
# 测试指定 Provider
|
|
221
|
+
flowmind ai --test openai
|
|
222
|
+
flowmind ai --test anthropic
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### 使用 AI 增强功能
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# AI 会理解意图、提取参数、选择技能、生成摘要
|
|
229
|
+
flowmind "帮我查一下最近1小时用户服务的错误日志"
|
|
230
|
+
|
|
231
|
+
# AI 会分析复杂的多步骤任务
|
|
232
|
+
flowmind "排查线上问题:用户下单失败,需要查看日志、检查数据库、分析原因"
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**特点:**
|
|
236
|
+
- ✅ 自然语言理解
|
|
237
|
+
- ✅ 智能参数提取
|
|
238
|
+
- ✅ 结果摘要生成
|
|
239
|
+
- ✅ 降级到规则引擎
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
### 方式3: Claude Code 集成(MCP Server)
|
|
244
|
+
|
|
245
|
+
让 Claude Code 直接调用 FlowMind 的内部流程。
|
|
246
|
+
|
|
247
|
+
#### 步骤 1:安装 FlowMind
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npm install -g flowmind
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 步骤 2:配置 MCP Server
|
|
254
|
+
|
|
255
|
+
在项目根目录创建 `.claude/settings.local.json`:
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"mcpServers": {
|
|
260
|
+
"flowmind": {
|
|
261
|
+
"command": "flowmind-mcp",
|
|
262
|
+
"args": [],
|
|
263
|
+
"env": {
|
|
264
|
+
"OPENAI_API_KEY": "${OPENAI_API_KEY}"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
或者使用完整路径:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"mcpServers": {
|
|
276
|
+
"flowmind": {
|
|
277
|
+
"command": "node",
|
|
278
|
+
"args": ["/path/to/flowmind/mcp/server.js"]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### 步骤 3:在 Claude Code 中使用
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
你:帮我查询最近1小时的错误日志
|
|
288
|
+
|
|
289
|
+
Claude:我来调用 FlowMind 帮你查询...
|
|
290
|
+
[调用 flowmind_process 工具]
|
|
291
|
+
|
|
292
|
+
你:审查一下这个项目的代码质量
|
|
293
|
+
|
|
294
|
+
Claude:我来使用 FlowMind 的代码审查技能...
|
|
295
|
+
[调用 flowmind_skill_code-review 工具]
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### 可用的 MCP 工具
|
|
299
|
+
|
|
300
|
+
| 工具名称 | 描述 |
|
|
301
|
+
|---------|------|
|
|
302
|
+
| `flowmind_process` | 处理请求的主入口 |
|
|
303
|
+
| `flowmind_list_skills` | 列出所有可用技能 |
|
|
304
|
+
| `flowmind_get_skill` | 获取技能详情 |
|
|
305
|
+
| `flowmind_ai_status` | 查看 AI 状态 |
|
|
306
|
+
| `flowmind_learning_stats` | 查看学习统计 |
|
|
307
|
+
| `flowmind_skill_<name>` | 执行特定技能 |
|
|
308
|
+
|
|
309
|
+
**特点:**
|
|
310
|
+
- ✅ Claude Code 直接调用
|
|
311
|
+
- ✅ 无需额外配置 MCP Server
|
|
312
|
+
- ✅ 保留学习和记忆功能
|
|
313
|
+
- ✅ 支持所有 FlowMind 技能
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
### 方式4: Codex 集成(JSON 输出)
|
|
318
|
+
|
|
319
|
+
通过 JSON 输出与 Codex 集成。
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# 获取技能列表 (JSON 格式)
|
|
323
|
+
flowmind skills --json
|
|
324
|
+
|
|
325
|
+
# 获取技能详情
|
|
326
|
+
flowmind skill log-audit --json
|
|
327
|
+
|
|
328
|
+
# 执行并输出 JSON
|
|
329
|
+
flowmind process --json "查询日志"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Codex 脚本示例:**
|
|
333
|
+
|
|
334
|
+
```python
|
|
335
|
+
import subprocess
|
|
336
|
+
import json
|
|
337
|
+
|
|
338
|
+
def flowmind_query(query):
|
|
339
|
+
result = subprocess.run(
|
|
340
|
+
['flowmind', 'process', '--json', query],
|
|
341
|
+
capture_output=True,
|
|
342
|
+
text=True
|
|
343
|
+
)
|
|
344
|
+
return json.loads(result.stdout)
|
|
345
|
+
|
|
346
|
+
# 使用
|
|
347
|
+
result = flowmind_query("查询 traceId abc123 的日志")
|
|
348
|
+
print(result)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
### 使用方式对比
|
|
354
|
+
|
|
355
|
+
| 方式 | 适用场景 | 需要 AI | 需要 MCP | 特点 |
|
|
356
|
+
|------|---------|---------|----------|------|
|
|
357
|
+
| CLI 独立使用 | 快速执行、脚本集成 | ❌ | ❌ | 简单直接 |
|
|
358
|
+
| AI 模型接入 | 智能理解、复杂任务 | ✅ | ❌ | 自然语言 |
|
|
359
|
+
| Claude Code | 智能对话、多步骤 | ✅ | ✅ | 深度集成 |
|
|
360
|
+
| Codex 集成 | 自动化、CI/CD | ❌ | ❌ | 程序化调用 |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
116
364
|
## 🧠 工作原理
|
|
117
365
|
|
|
118
366
|
### 1. 多源代码定位
|