flowmind 1.4.6 → 1.4.7

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/demo/DEMO.md ADDED
@@ -0,0 +1,263 @@
1
+ <div align="center">
2
+
3
+ # FlowMind Demo
4
+
5
+ **How to Use FlowMind in Your Daily Work**
6
+
7
+ [中文](DEMO_CN.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ![FlowMind terminal demo](flowmind-demo.gif)
14
+
15
+ ## Quick Start
16
+
17
+ ### Install
18
+
19
+ ```bash
20
+ npm install -g flowmind
21
+ ```
22
+
23
+ ### Try Without Install
24
+
25
+ ```bash
26
+ npx flowmind@latest skills
27
+ npx flowmind@latest doctor
28
+ ```
29
+
30
+ ### Initialize
31
+
32
+ ```bash
33
+ flowmind init
34
+ ```
35
+
36
+ > One-time setup. Configure your resources, preferences, and output formats.
37
+
38
+ ---
39
+
40
+ ## Scenario 1: Online Issue Investigation
41
+
42
+ **Before FlowMind (10+ steps):**
43
+ ```
44
+ Login SLS → Query logs → Find traceId → Trace chain → Connect RDS → Query data → Locate code → Fix → Deploy → Write doc
45
+ ```
46
+
47
+ **With FlowMind (1 command):**
48
+ ```bash
49
+ flowmind "排查线上问题 traceId abc123"
50
+ ```
51
+
52
+ FlowMind automatically: SLS query → Trace tracking → RDS data validation → Code location → Fix suggestion
53
+
54
+ ### Step by Step
55
+
56
+ ```bash
57
+ # 1. Query logs with your preferred format
58
+ flowmind "查询 traceId abc123 的日志,用顺序列表格式"
59
+
60
+ # 2. FlowMind learns your preference
61
+ # Next time, just:
62
+ flowmind "查询 traceId def456 的日志"
63
+ # → Automatically uses sequential list format
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Scenario 2: Code Review
69
+
70
+ ### Set Your Standards (Once)
71
+
72
+ ```bash
73
+ flowmind "代码审查先检查安全漏洞,再检查代码质量,最后检查性能"
74
+ ```
75
+
76
+ ### Review Any PR
77
+
78
+ ```bash
79
+ flowmind "审查这个 PR"
80
+ # → Security first → Quality check → Performance analysis
81
+ ```
82
+
83
+ ### Review Specific File
84
+
85
+ ```bash
86
+ flowmind "审查 src/api/users.js 的安全漏洞"
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Scenario 3: Data Validation
92
+
93
+ ### Validate Order Data
94
+
95
+ ```bash
96
+ flowmind "验证订单表数据完整性"
97
+ # → Referential integrity → Data types → Business logic → State machine
98
+ ```
99
+
100
+ ### Verify Calculations
101
+
102
+ ```bash
103
+ flowmind "验证订单金额计算是否正确"
104
+ ```
105
+
106
+ ### Check Redis Cache
107
+
108
+ ```bash
109
+ flowmind "验证缓存逻辑,检查 store:{storeId}:config 的结构"
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Scenario 4: API Documentation
115
+
116
+ ### Generate from Code
117
+
118
+ ```bash
119
+ flowmind "从代码注释生成 API 文档"
120
+ ```
121
+
122
+ ### Sync to YApi
123
+
124
+ ```bash
125
+ flowmind "同步 OrderController 的接口到 YApi"
126
+ ```
127
+
128
+ ### Sync to Yuque
129
+
130
+ ```bash
131
+ flowmind "同步 API 文档到语雀"
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Scenario 5: Log Analysis
137
+
138
+ ### Trace Analysis
139
+
140
+ ```bash
141
+ flowmind "查询 traceId abc123 的完整链路"
142
+ ```
143
+
144
+ ### Error Investigation
145
+
146
+ ```bash
147
+ flowmind "查看最近1小时的错误日志"
148
+ ```
149
+
150
+ ### Performance Analysis
151
+
152
+ ```bash
153
+ flowmind "分析 payment-service 接口耗时"
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Scenario 6: Project Health Check
159
+
160
+ ```bash
161
+ flowmind "审查项目整体状况"
162
+ # → Dependencies → Security audit → Code complexity → Test coverage → Technical debt
163
+ ```
164
+
165
+ ### Security Audit
166
+
167
+ ```bash
168
+ flowmind "进行安全审计"
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Learning System
174
+
175
+ ### How It Works
176
+
177
+ ```bash
178
+ # First time - teach FlowMind
179
+ flowmind "查询日志用顺序列表格式"
180
+ FlowMind: ✓ Learned
181
+
182
+ # Next time - FlowMind remembers
183
+ flowmind "查询 traceId abc123 的日志"
184
+ FlowMind: [Uses sequential list automatically]
185
+ ```
186
+
187
+ ### Scene Mapping
188
+
189
+ ```bash
190
+ # Define a workflow
191
+ flowmind "排查问题先查错误日志,再查链路,最后查代码"
192
+ FlowMind: ✓ Workflow saved
193
+
194
+ # Use it anytime
195
+ flowmind "排查线上问题 order-123"
196
+ FlowMind: [Follows your workflow automatically]
197
+ ```
198
+
199
+ ### View Learnings
200
+
201
+ ```bash
202
+ # List all learnings
203
+ flowmind learn list
204
+
205
+ # List scene mappings
206
+ flowmind scenes list
207
+
208
+ # Export for team sharing
209
+ flowmind learn export team.json
210
+
211
+ # Import from teammate
212
+ flowmind learn import team.json
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Common Commands
218
+
219
+ | Command | Description |
220
+ |---------|-------------|
221
+ | `flowmind "your request"` | Execute a task |
222
+ | `flowmind init` | Initialize configuration |
223
+ | `flowmind skills` | List available skills |
224
+ | `flowmind learn list` | View learning records |
225
+ | `flowmind scenes list` | View scene mappings |
226
+ | `flowmind learn export` | Export learnings |
227
+ | `flowmind learn import` | Import learnings |
228
+
229
+ ---
230
+
231
+ ## Repeatable Terminal Demo
232
+
233
+ From the repository root, you can replay the terminal walkthrough without requiring a global install:
234
+
235
+ ```bash
236
+ ./demo/setup-vhs-demo.sh
237
+ ./demo/01-skills.sh
238
+ ./demo/02-log-audit.sh
239
+ ./demo/03-learn-format.sh
240
+ ./demo/04-show-learning.sh
241
+ ./demo/05-log-audit-json.sh
242
+ ```
243
+
244
+ If you want to render the animated terminal capture with VHS:
245
+
246
+ ```bash
247
+ vhs demo/flowmind-demo.tape
248
+ ```
249
+
250
+ ## Tips
251
+
252
+ 1. **Be Specific**: More detailed instructions = better learning
253
+ 2. **Correct Early**: Tell FlowMind when it's wrong
254
+ 3. **Use Scenes**: Define workflows for repeated tasks
255
+ 4. **Share Knowledge**: Export and share with your team
256
+
257
+ ---
258
+
259
+ <div align="center">
260
+
261
+ **Learn once, flow forever.**
262
+
263
+ </div>
@@ -0,0 +1,263 @@
1
+ <div align="center">
2
+
3
+ # FlowMind 使用演示
4
+
5
+ **如何在日常工作中使用 FlowMind**
6
+
7
+ [English](DEMO.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ![FlowMind 终端演示](flowmind-demo.gif)
14
+
15
+ ## 快速开始
16
+
17
+ ### 安装
18
+
19
+ ```bash
20
+ npm install -g flowmind
21
+ ```
22
+
23
+ ### 免安装试用
24
+
25
+ ```bash
26
+ npx flowmind@latest skills
27
+ npx flowmind@latest doctor
28
+ ```
29
+
30
+ ### 初始化
31
+
32
+ ```bash
33
+ flowmind init
34
+ ```
35
+
36
+ > 一次性配置,永久生效。配置资源连接、学习偏好、输出格式。
37
+
38
+ ---
39
+
40
+ ## 场景 1:线上问题排查
41
+
42
+ **使用 FlowMind 前(10+ 步骤):**
43
+ ```
44
+ 登录 SLS → 查日志 → 找 traceId → 查链路 → 连 RDS → 查数据 → 定位代码 → 修复 → 部署 → 写文档
45
+ ```
46
+
47
+ **使用 FlowMind(1 个命令):**
48
+ ```bash
49
+ flowmind "排查线上问题 traceId abc123"
50
+ ```
51
+
52
+ FlowMind 自动完成:SLS 查询 → 链路追踪 → RDS 数据验证 → 代码定位 → 修复建议
53
+
54
+ ### 分步操作
55
+
56
+ ```bash
57
+ # 1. 用你喜欢的格式查询日志
58
+ flowmind "查询 traceId abc123 的日志,用顺序列表格式"
59
+
60
+ # 2. FlowMind 学习了你的偏好
61
+ # 下次只需要:
62
+ flowmind "查询 traceId def456 的日志"
63
+ # → 自动使用顺序列表格式
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 场景 2:代码审查
69
+
70
+ ### 设置你的标准(只需一次)
71
+
72
+ ```bash
73
+ flowmind "代码审查先检查安全漏洞,再检查代码质量,最后检查性能"
74
+ ```
75
+
76
+ ### 审查任意 PR
77
+
78
+ ```bash
79
+ flowmind "审查这个 PR"
80
+ # → 安全优先 → 质量检查 → 性能分析
81
+ ```
82
+
83
+ ### 审查特定文件
84
+
85
+ ```bash
86
+ flowmind "审查 src/api/users.js 的安全漏洞"
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 场景 3:数据验证
92
+
93
+ ### 验证订单数据
94
+
95
+ ```bash
96
+ flowmind "验证订单表数据完整性"
97
+ # → 引用完整性 → 数据类型 → 业务逻辑 → 状态机
98
+ ```
99
+
100
+ ### 验证计算逻辑
101
+
102
+ ```bash
103
+ flowmind "验证订单金额计算是否正确"
104
+ ```
105
+
106
+ ### 检查 Redis 缓存
107
+
108
+ ```bash
109
+ flowmind "验证缓存逻辑,检查 store:{storeId}:config 的结构"
110
+ ```
111
+
112
+ ---
113
+
114
+ ## 场景 4:API 文档
115
+
116
+ ### 从代码生成
117
+
118
+ ```bash
119
+ flowmind "从代码注释生成 API 文档"
120
+ ```
121
+
122
+ ### 同步到 YApi
123
+
124
+ ```bash
125
+ flowmind "同步 OrderController 的接口到 YApi"
126
+ ```
127
+
128
+ ### 同步到语雀
129
+
130
+ ```bash
131
+ flowmind "同步 API 文档到语雀"
132
+ ```
133
+
134
+ ---
135
+
136
+ ## 场景 5:日志分析
137
+
138
+ ### 链路追踪
139
+
140
+ ```bash
141
+ flowmind "查询 traceId abc123 的完整链路"
142
+ ```
143
+
144
+ ### 错误排查
145
+
146
+ ```bash
147
+ flowmind "查看最近1小时的错误日志"
148
+ ```
149
+
150
+ ### 性能分析
151
+
152
+ ```bash
153
+ flowmind "分析 payment-service 接口耗时"
154
+ ```
155
+
156
+ ---
157
+
158
+ ## 场景 6:项目健康检查
159
+
160
+ ```bash
161
+ flowmind "审查项目整体状况"
162
+ # → 依赖分析 → 安全审计 → 代码复杂度 → 测试覆盖率 → 技术债务
163
+ ```
164
+
165
+ ### 安全审计
166
+
167
+ ```bash
168
+ flowmind "进行安全审计"
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 学习系统
174
+
175
+ ### 工作原理
176
+
177
+ ```bash
178
+ # 第一次 - 教 FlowMind
179
+ flowmind "查询日志用顺序列表格式"
180
+ FlowMind: ✓ 已学习
181
+
182
+ # 下次 - FlowMind 记住了
183
+ flowmind "查询 traceId abc123 的日志"
184
+ FlowMind: [自动使用顺序列表格式]
185
+ ```
186
+
187
+ ### 场景映射
188
+
189
+ ```bash
190
+ # 定义工作流
191
+ flowmind "排查问题先查错误日志,再查链路,最后查代码"
192
+ FlowMind: ✓ 工作流已保存
193
+
194
+ # 随时使用
195
+ flowmind "排查线上问题 order-123"
196
+ FlowMind: [自动遵循你的工作流]
197
+ ```
198
+
199
+ ### 查看学习记录
200
+
201
+ ```bash
202
+ # 列出所有学习记录
203
+ flowmind learn list
204
+
205
+ # 列出场景映射
206
+ flowmind scenes list
207
+
208
+ # 导出供团队共享
209
+ flowmind learn export team.json
210
+
211
+ # 从队友导入
212
+ flowmind learn import team.json
213
+ ```
214
+
215
+ ---
216
+
217
+ ## 常用命令
218
+
219
+ | 命令 | 说明 |
220
+ |------|------|
221
+ | `flowmind "你的请求"` | 执行任务 |
222
+ | `flowmind init` | 初始化配置 |
223
+ | `flowmind skills` | 列出可用技能 |
224
+ | `flowmind learn list` | 查看学习记录 |
225
+ | `flowmind scenes list` | 查看场景映射 |
226
+ | `flowmind learn export` | 导出学习记录 |
227
+ | `flowmind learn import` | 导入学习记录 |
228
+
229
+ ---
230
+
231
+ ## 可重复终端演示
232
+
233
+ 在仓库根目录下,可以直接回放这套终端演示,不依赖全局安装:
234
+
235
+ ```bash
236
+ ./demo/setup-vhs-demo.sh
237
+ ./demo/01-skills.sh
238
+ ./demo/02-log-audit.sh
239
+ ./demo/03-learn-format.sh
240
+ ./demo/04-show-learning.sh
241
+ ./demo/05-log-audit-json.sh
242
+ ```
243
+
244
+ 如果要用 VHS 生成终端动画:
245
+
246
+ ```bash
247
+ vhs demo/flowmind-demo.tape
248
+ ```
249
+
250
+ ## 使用技巧
251
+
252
+ 1. **描述具体**:指令越详细,学习效果越好
253
+ 2. **及时纠正**:告诉 FlowMind 哪里不对
254
+ 3. **善用场景**:为重复任务定义工作流
255
+ 4. **团队共享**:导出学习记录分享给团队
256
+
257
+ ---
258
+
259
+ <div align="center">
260
+
261
+ **学习一次,永远流畅。**
262
+
263
+ </div>
package/demo/common.sh ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
4
+ export FLOWMIND_HOME="${FLOWMIND_HOME:-$ROOT_DIR/.flowmind-demo}"
5
+
6
+ if [[ "${FLOWMIND_USE_LOCAL:-0}" == "1" ]]; then
7
+ FLOWMIND_CMD=("node" "$ROOT_DIR/bin/flowmind.js")
8
+ elif command -v flowmind >/dev/null 2>&1; then
9
+ FLOWMIND_CMD=("flowmind")
10
+ else
11
+ FLOWMIND_CMD=("node" "$ROOT_DIR/bin/flowmind.js")
12
+ fi
13
+
14
+ flowmind_label() {
15
+ if [[ "${FLOWMIND_CMD[0]}" == "flowmind" ]]; then
16
+ printf 'flowmind'
17
+ return
18
+ fi
19
+
20
+ printf 'node ./bin/flowmind.js'
21
+ }
22
+
23
+ run_flowmind() {
24
+ "${FLOWMIND_CMD[@]}" "$@"
25
+ }
Binary file
@@ -0,0 +1,38 @@
1
+ Output demo/flowmind-demo.gif
2
+
3
+ Require node
4
+ Require jq
5
+
6
+ Set Shell "bash"
7
+ Set FontSize 22
8
+ Set Width 1100
9
+ Set Height 760
10
+ Set Padding 20
11
+ Set Theme "Catppuccin Latte"
12
+ Set WindowBar Colorful
13
+ Set TypingSpeed 35ms
14
+ Set Framerate 30
15
+
16
+ Type "./demo/setup-vhs-demo.sh"
17
+ Enter
18
+ Sleep 1s
19
+
20
+ Type "./demo/01-skills.sh"
21
+ Enter
22
+ Sleep 2s
23
+
24
+ Type "./demo/02-log-audit.sh"
25
+ Enter
26
+ Sleep 2500ms
27
+
28
+ Type "./demo/03-learn-format.sh"
29
+ Enter
30
+ Sleep 2500ms
31
+
32
+ Type "./demo/04-show-learning.sh"
33
+ Enter
34
+ Sleep 2s
35
+
36
+ Type "./demo/05-log-audit-json.sh"
37
+ Enter
38
+ Sleep 3s
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ source "$(cd "$(dirname "$0")" && pwd)/common.sh"
6
+ FLOWMIND_LABEL="$(flowmind_label)"
7
+
8
+ echo
9
+ echo "== FlowMind quickstart demo =="
10
+ echo
11
+
12
+ echo "$ ${FLOWMIND_LABEL} skills --json"
13
+ echo "This script uses the global FlowMind binary when available, otherwise falls back to the local repo binary."
14
+ echo
15
+ sleep 1
16
+
17
+ run_flowmind skills --json || true
18
+ echo
19
+ sleep 1
20
+
21
+ echo "$ ${FLOWMIND_LABEL} process --skill log-audit \"查询 traceId demo-123 的日志\" --json"
22
+ run_flowmind process --skill log-audit "查询 traceId demo-123 的日志" --json || true
23
+ echo
24
+ sleep 1
25
+
26
+ echo "$ ${FLOWMIND_LABEL} process \"下次日志结果用表格格式\""
27
+ run_flowmind process "下次日志结果用表格格式" || true
28
+ echo
29
+ sleep 1
30
+
31
+ echo "$ ${FLOWMIND_LABEL} process --skill log-audit \"查询 traceId demo-456 的日志\" --json"
32
+ run_flowmind process --skill log-audit "查询 traceId demo-456 的日志" --json || true
33
+ echo
34
+
35
+ echo "== Demo complete =="
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ source "$(cd "$(dirname "$0")" && pwd)/common.sh"
6
+
7
+ DEMO_HOME="$FLOWMIND_HOME"
8
+ CONFIG_DIR="$DEMO_HOME/.flowmind"
9
+ PACKAGE_VERSION="$(node -p "require('$ROOT_DIR/package.json').version")"
10
+
11
+ rm -rf "$DEMO_HOME"
12
+ mkdir -p "$CONFIG_DIR"
13
+
14
+ cat > "$CONFIG_DIR/config.json" <<EOF
15
+ {
16
+ "version": "$PACKAGE_VERSION",
17
+ "learning": {
18
+ "enabled": true,
19
+ "autoApply": true,
20
+ "confidenceThreshold": 0.7,
21
+ "storagePath": "$CONFIG_DIR/learning"
22
+ },
23
+ "sceneMapping": {
24
+ "enabled": true,
25
+ "weights": {
26
+ "keywordMatch": 0.4,
27
+ "patternMatch": 0.3,
28
+ "historyScore": 0.2,
29
+ "confidence": 0.1
30
+ }
31
+ }
32
+ }
33
+ EOF
34
+
35
+ echo "Prepared demo home: $DEMO_HOME"