flowmind 1.0.0

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +855 -0
  3. package/README_CN.md +854 -0
  4. package/bin/flowmind.js +464 -0
  5. package/core/adapters/api-doc-adapter.js +71 -0
  6. package/core/adapters/base-adapter.js +80 -0
  7. package/core/adapters/database-manager-adapter.js +60 -0
  8. package/core/adapters/database-query-adapter.js +51 -0
  9. package/core/adapters/knowledge-base-adapter.js +75 -0
  10. package/core/adapters/log-service-adapter.js +41 -0
  11. package/core/adapters/mcp-adapter.js +65 -0
  12. package/core/adapters/report-adapter.js +60 -0
  13. package/core/adapters/workflow-adapter.js +62 -0
  14. package/core/component-registry.js +281 -0
  15. package/core/component-types.js +63 -0
  16. package/core/config-manager.js +360 -0
  17. package/core/index.js +223 -0
  18. package/core/learning-engine.js +588 -0
  19. package/core/mcp-compatibility.js +150 -0
  20. package/core/providers/aliyun/dms-adapter.js +98 -0
  21. package/core/providers/aliyun/redis-adapter.js +88 -0
  22. package/core/providers/aliyun/sls-adapter.js +86 -0
  23. package/core/providers/friday/flow-adapter.js +85 -0
  24. package/core/providers/friday/report-adapter.js +83 -0
  25. package/core/providers/yapi/yapi-adapter.js +79 -0
  26. package/core/providers/yuque/yuque-adapter.js +90 -0
  27. package/core/scene-matcher.js +326 -0
  28. package/core/skill-loader.js +291 -0
  29. package/package.json +67 -0
  30. package/scripts/migrate-config.js +153 -0
  31. package/skills/api-sync/SKILL.md +203 -0
  32. package/skills/archive-change/SKILL.md +172 -0
  33. package/skills/auto-flow/SKILL.md +277 -0
  34. package/skills/code-review/SKILL.md +206 -0
  35. package/skills/code-review-audit/SKILL.md +150 -0
  36. package/skills/data-logic-validation/SKILL.md +162 -0
  37. package/skills/data-validation/SKILL.md +210 -0
  38. package/skills/git-review/SKILL.md +190 -0
  39. package/skills/learning-engine/SKILL.md +352 -0
  40. package/skills/learning-feedback/SKILL.md +174 -0
  41. package/skills/log-audit/SKILL.md +226 -0
  42. package/skills/project-review/SKILL.md +196 -0
  43. package/skills/requirement-analyst/SKILL.md +275 -0
  44. package/skills/resource-bind/SKILL.md +222 -0
  45. package/skills/sls-log-audit/SKILL.md +223 -0
  46. package/skills/yapi-sync-interface/SKILL.md +145 -0
  47. package/skills/yuque-sync-design/SKILL.md +157 -0
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: data-logic-validation
3
+ description: Data logic validation skill for FlowMind. Verify actual SQL queries, Redis operations, and data processing logic against real data via MCP database and Redis connections.
4
+ metadata:
5
+ version: "1.1.0"
6
+ author: flowmind
7
+ category: quality
8
+ componentDependencies:
9
+ - databaseManager
10
+ - databaseQuery
11
+ - redisMonitor
12
+ ---
13
+
14
+ # Data Logic Validation Skill
15
+
16
+ Verify actual data processing logic by connecting to databases and Redis via MCP, extracting real SQL queries and Redis operations from code, and validating against actual data.
17
+
18
+ ## Features
19
+
20
+ ### SQL Validation
21
+ - Extract actual SQL queries from code
22
+ - Verify query logic against real database
23
+ - Check data integrity and consistency
24
+ - Validate complex join and subquery logic
25
+
26
+ ### Redis Validation
27
+ - Extract Redis operations from code
28
+ - Verify cache key structure and values
29
+ - Check TTL and expiration logic
30
+ - Validate cache-database consistency
31
+
32
+ ### Data Flow Validation
33
+ - Trace data flow from API to database
34
+ - Verify data transformations
35
+ - Check state machine transitions
36
+ - Validate business rule enforcement
37
+
38
+ ## Trigger Patterns
39
+
40
+ ```
41
+ "数据验证", "data validation"
42
+ "检查实际逻辑", "查看实际 SQL"
43
+ "检查 Redis 处理", "验证缓存逻辑"
44
+ "验证数据库操作", "查看真实查询"
45
+ "排查真实数据", "搜索词"
46
+ "预测结果", "门店结果"
47
+ "数据完整性", "data integrity"
48
+ ```
49
+
50
+ ## Output Format
51
+
52
+ ```
53
+ ┌─────────────────────────────────────────────────────┐
54
+ │ Data Logic Validation Report │
55
+ ├─────────────────────────────────────────────────────┤
56
+ │ Target: {module/service} │
57
+ │ Database: {db_name} │
58
+ │ Redis: {key_pattern} │
59
+ ├─────────────────────────────────────────────────────┤
60
+ │ SQL Queries Found: {count} │
61
+ │ • {query_description}: {result} │
62
+ ├─────────────────────────────────────────────────────┤
63
+ │ Redis Operations: {count} │
64
+ │ • {operation}: {result} │
65
+ ├─────────────────────────────────────────────────────┤
66
+ │ Validation Results: │
67
+ │ • Data Integrity: {status} │
68
+ │ • Business Logic: {status} │
69
+ │ • Cache Consistency: {status} │
70
+ └─────────────────────────────────────────────────────┘
71
+ ```
72
+
73
+ ## Validation Workflow
74
+
75
+ ```
76
+ 1. Code Analysis → Extract SQL/Redis operations
77
+ 2. MCP Connection → Connect to database/Redis
78
+ 3. Query Execution → Run extracted queries
79
+ 4. Result Comparison → Compare expected vs actual
80
+ 5. Report Generation → Output validation results
81
+ ```
82
+
83
+ ## Component Integration
84
+
85
+ This skill uses the **databaseManager**, **databaseQuery**, and **redisMonitor** components.
86
+
87
+ | Component | Provider | MCP Server | Description |
88
+ |-----------|----------|------------|-------------|
89
+ | databaseManager | aliyun-dms | aliyun-dms-mcp-server | Alibaba Cloud DMS |
90
+ | databaseQuery | aliyun-rds-query | friday-rds-redis-query | Direct SQL queries |
91
+ | redisMonitor | aliyun-redis | friday-aliyun-sz-rds-redis | Redis Prometheus metrics |
92
+
93
+ Configuration is managed in `flowmind.config.json` under `components`.
94
+
95
+ ## Learning Integration
96
+
97
+ This skill supports FlowMind learning:
98
+
99
+ - **Query Patterns**: Learns common query patterns for faster extraction
100
+ - **Connection Info**: Remembers database/Redis connection details
101
+ - **Validation Rules**: Learns project-specific validation rules
102
+
103
+ ## Examples
104
+
105
+ ### Example 1: SQL Validation
106
+
107
+ ```
108
+ User: 验证订单查询逻辑
109
+
110
+ FlowMind:
111
+ ┌─────────────────────────────────────────────────────┐
112
+ │ SQL Validation Report │
113
+ ├─────────────────────────────────────────────────────┤
114
+ │ Source: OrderService.getOrdersByUser() │
115
+ │ SQL: SELECT * FROM orders WHERE user_id = ? │
116
+ ├─────────────────────────────────────────────────────┤
117
+ │ ✅ Query returns correct results │
118
+ │ ⚠️ Missing index on user_id column │
119
+ │ ✅ Pagination working correctly │
120
+ └─────────────────────────────────────────────────────┘
121
+ ```
122
+
123
+ ### Example 2: Redis Validation
124
+
125
+ ```
126
+ User: 验证缓存逻辑
127
+
128
+ FlowMind:
129
+ ┌─────────────────────────────────────────────────────┐
130
+ │ Redis Validation Report │
131
+ ├─────────────────────────────────────────────────────┤
132
+ │ Key: store:{storeId}:config │
133
+ │ Type: Hash │
134
+ │ TTL: 3600s │
135
+ ├─────────────────────────────────────────────────────┤
136
+ │ ✅ Key structure matches code definition │
137
+ │ ✅ TTL configured correctly │
138
+ │ ⚠️ Value size: 2.5MB (consider compression) │
139
+ └─────────────────────────────────────────────────────┘
140
+ ```
141
+
142
+ ## Configuration
143
+
144
+ ```json
145
+ {
146
+ "data-logic-validation": {
147
+ "database": {
148
+ "enabled": true,
149
+ "maxRows": 100
150
+ },
151
+ "redis": {
152
+ "enabled": true,
153
+ "scanCount": 100
154
+ },
155
+ "validation": {
156
+ "checkIntegrity": true,
157
+ "checkConsistency": true,
158
+ "checkPerformance": true
159
+ }
160
+ }
161
+ }
162
+ ```
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: data-validation
3
+ description: Data validation and logic verification skill for FlowMind. Verify business logic, data integrity, and processing correctness.
4
+ metadata:
5
+ version: "1.0.0"
6
+ author: flowmind
7
+ category: quality
8
+ ---
9
+
10
+ # Data Validation Skill
11
+
12
+ Verify business logic, data integrity, and processing correctness.
13
+
14
+ ## Features
15
+
16
+ ### 📊 Data Integrity
17
+ - Referential integrity checks
18
+ - Data type validation
19
+ - Range and constraint validation
20
+ - Null/required field checks
21
+
22
+ ### 🔄 Business Logic
23
+ - Workflow validation
24
+ - Calculation verification
25
+ - State machine validation
26
+ - Rule engine checks
27
+
28
+ ### 📈 Data Quality
29
+ - Duplicate detection
30
+ - Consistency checks
31
+ - Completeness analysis
32
+ - Accuracy verification
33
+
34
+ ## Trigger Patterns
35
+
36
+ ```
37
+ "数据验证", "data validation", "validate"
38
+ "逻辑验证", "logic verification"
39
+ "数据检查", "data check"
40
+ "业务逻辑", "business logic"
41
+ "数据质量", "data quality"
42
+ ```
43
+
44
+ ## Output Format
45
+
46
+ ```
47
+ ┌─────────────────────────────────────────────────────┐
48
+ │ Data Validation Report │
49
+ ├─────────────────────────────────────────────────────┤
50
+ │ Table: {table_name} │
51
+ │ Records: {count} │
52
+ ├─────────────────────────────────────────────────────┤
53
+ │ ✓ Passed: {pass_count} │
54
+ │ ✗ Failed: {fail_count} │
55
+ │ ⚠ Warnings: {warn_count} │
56
+ ├─────────────────────────────────────────────────────┤
57
+ │ Issues: │
58
+ │ • {issue_description} │
59
+ │ • {issue_description} │
60
+ └─────────────────────────────────────────────────────┘
61
+ ```
62
+
63
+ ## Validation Types
64
+
65
+ ### Schema Validation
66
+
67
+ | Check | Description |
68
+ |-------|-------------|
69
+ | Type Match | Field types match schema |
70
+ | Required Fields | All required fields present |
71
+ | Length Limits | String lengths within limits |
72
+ | Format | Dates, emails, phones valid |
73
+
74
+ ### Business Rules
75
+
76
+ | Check | Description |
77
+ |-------|-------------|
78
+ | Calculations | Totals, averages correct |
79
+ | State Transitions | Valid state changes |
80
+ | Dependencies | Required relationships exist |
81
+ | Constraints | Business rules satisfied |
82
+
83
+ ## Learning Integration
84
+
85
+ This skill supports FlowMind learning:
86
+
87
+ - **Validation Rules**: Learns your business rules
88
+ - **Error Tolerance**: Learns acceptable error rates
89
+ - **Output Format**: Learns preferred report format
90
+
91
+ ```
92
+ User: "金额不能为负数"
93
+ FlowMind: ✓ Learned: Amount must be non-negative
94
+
95
+ User: [Next validation]
96
+ FlowMind: [Checks for negative amounts]
97
+ ```
98
+
99
+ ## Examples
100
+
101
+ ### Example 1: Order Validation
102
+
103
+ ```
104
+ User: 验证订单数据的正确性
105
+
106
+ FlowMind:
107
+ ┌─────────────────────────────────────────────────────┐
108
+ │ Order Validation Report │
109
+ ├─────────────────────────────────────────────────────┤
110
+ │ Table: orders │
111
+ │ Records: 1,000 │
112
+ ├─────────────────────────────────────────────────────┤
113
+ │ ✓ Passed: 985 │
114
+ │ ✗ Failed: 15 │
115
+ │ ⚠ Warnings: 5 │
116
+ ├─────────────────────────────────────────────────────┤
117
+ │ Critical Issues: │
118
+ │ • 10 orders with negative total │
119
+ │ • 5 orders with missing customer_id │
120
+ ├─────────────────────────────────────────────────────┤
121
+ │ Warnings: │
122
+ │ • 5 orders with future dates │
123
+ └─────────────────────────────────────────────────────┘
124
+ ```
125
+
126
+ ### Example 2: Calculation Verification
127
+
128
+ ```
129
+ User: 验证订单金额计算是否正确
130
+
131
+ FlowMind:
132
+ ┌─────────────────────────────────────────────────────┐
133
+ │ Calculation Verification │
134
+ ├─────────────────────────────────────────────────────┤
135
+ │ Formula: subtotal + tax = total │
136
+ │ Records Checked: 500 │
137
+ ├─────────────────────────────────────────────────────┤
138
+ │ ✓ Correct: 498 (99.6%) │
139
+ │ ✗ Incorrect: 2 (0.4%) │
140
+ ├─────────────────────────────────────────────────────┤
141
+ │ Errors: │
142
+ │ • Order #1234: Expected 110.00, Got 100.00 │
143
+ │ • Order #5678: Expected 55.50, Got 55.00 │
144
+ └─────────────────────────────────────────────────────┘
145
+ ```
146
+
147
+ ## Configuration
148
+
149
+ ```json
150
+ {
151
+ "data-validation": {
152
+ "rules": {
153
+ "required": ["id", "created_at", "status"],
154
+ "types": {
155
+ "id": "integer",
156
+ "email": "email",
157
+ "phone": "phone"
158
+ },
159
+ "ranges": {
160
+ "age": { "min": 0, "max": 150 },
161
+ "amount": { "min": 0 }
162
+ }
163
+ },
164
+ "business": {
165
+ "calculations": [
166
+ {
167
+ "name": "order_total",
168
+ "formula": "subtotal + tax = total",
169
+ "tolerance": 0.01
170
+ }
171
+ ]
172
+ }
173
+ }
174
+ }
175
+ ```
176
+
177
+ ## Custom Rules
178
+
179
+ ### Define Custom Validation
180
+
181
+ ```json
182
+ {
183
+ "data-validation": {
184
+ "customRules": [
185
+ {
186
+ "name": "valid_email",
187
+ "field": "email",
188
+ "pattern": "^[\\w.-]+@[\\w.-]+\\.\\w+$",
189
+ "message": "Invalid email format"
190
+ }
191
+ ]
192
+ }
193
+ }
194
+ ```
195
+
196
+ ### Business Rule Validation
197
+
198
+ ```json
199
+ {
200
+ "data-validation": {
201
+ "businessRules": [
202
+ {
203
+ "name": "order_amount",
204
+ "condition": "amount > 0",
205
+ "message": "Order amount must be positive"
206
+ }
207
+ ]
208
+ }
209
+ }
210
+ ```
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: git-review
3
+ description: Git repository and commit review skill for FlowMind. Review commit history, analyze changes, and ensure code quality.
4
+ metadata:
5
+ version: "1.0.0"
6
+ author: flowmind
7
+ category: quality
8
+ ---
9
+
10
+ # Git Review Skill
11
+
12
+ Review commit history, analyze changes, and ensure code quality.
13
+
14
+ ## Features
15
+
16
+ ### 📊 Commit Analysis
17
+ - Commit message quality
18
+ - Change size analysis
19
+ - Author statistics
20
+ - Time patterns
21
+
22
+ ### 🔍 Change Review
23
+ - Diff analysis
24
+ - Impact assessment
25
+ - Risk evaluation
26
+ - Dependency changes
27
+
28
+ ### 📈 Quality Metrics
29
+ - Code churn rate
30
+ - Review coverage
31
+ - Test coverage
32
+ - Documentation updates
33
+
34
+ ## Trigger Patterns
35
+
36
+ ```
37
+ "git审查", "git review"
38
+ "提交历史", "commit history"
39
+ "代码变更", "code changes"
40
+ "分支审查", "branch review"
41
+ "PR审查", "PR review"
42
+ ```
43
+
44
+ ## Output Format
45
+
46
+ ```
47
+ ┌─────────────────────────────────────────────────────┐
48
+ │ Git Review Report │
49
+ ├─────────────────────────────────────────────────────┤
50
+ │ Branch: {branch} │
51
+ │ Commits: {count} │
52
+ │ Files Changed: {files} │
53
+ │ Lines: +{added} -{removed} │
54
+ ├─────────────────────────────────────────────────────┤
55
+ │ Commit Quality: │
56
+ │ ✓ Good: {good_count} │
57
+ │ ⚠ Warning: {warn_count} │
58
+ │ ✗ Bad: {bad_count} │
59
+ ├─────────────────────────────────────────────────────┤
60
+ │ Issues: │
61
+ │ • {issue_description} │
62
+ └─────────────────────────────────────────────────────┘
63
+ ```
64
+
65
+ ## Commit Quality Checks
66
+
67
+ ### Message Quality
68
+
69
+ | Check | Description |
70
+ |-------|-------------|
71
+ | Format | Follows conventional commits |
72
+ | Length | Subject < 50 chars, body < 72 chars |
73
+ | Clarity | Descriptive and clear |
74
+ | Reference | Links to issues/PRs |
75
+
76
+ ### Change Quality
77
+
78
+ | Check | Description |
79
+ |-------|-------------|
80
+ | Size | Commits not too large |
81
+ | Scope | Single responsibility |
82
+ | Tests | Includes test changes |
83
+ | Docs | Documentation updated |
84
+
85
+ ## Learning Integration
86
+
87
+ This skill supports FlowMind learning:
88
+
89
+ - **Review Focus**: Learns what to check first
90
+ - **Severity Levels**: Learns your standards
91
+ - **Output Format**: Learns preferred report format
92
+
93
+ ```
94
+ User: "先检查提交规范"
95
+ FlowMind: ✓ Learned: Check commit conventions first
96
+
97
+ User: [Next review]
98
+ FlowMind: [Prioritizes commit conventions]
99
+ ```
100
+
101
+ ## Examples
102
+
103
+ ### Example 1: Branch Review
104
+
105
+ ```
106
+ User: 审查 feature/login 分支
107
+
108
+ FlowMind:
109
+ ┌─────────────────────────────────────────────────────┐
110
+ │ Git Review Report │
111
+ ├─────────────────────────────────────────────────────┤
112
+ │ Branch: feature/login │
113
+ │ Commits: 12 │
114
+ │ Files Changed: 23 │
115
+ │ Lines: +1,847 -234 │
116
+ ├─────────────────────────────────────────────────────┤
117
+ │ Commit Quality: │
118
+ │ ✓ Good: 10 │
119
+ │ ⚠ Warning: 2 │
120
+ ├─────────────────────────────────────────────────────┤
121
+ │ Warnings: │
122
+ │ • abc123: "fix stuff" - Too vague │
123
+ │ • def456: Large commit (500+ lines) │
124
+ ├─────────────────────────────────────────────────────┤
125
+ │ Impact: │
126
+ │ • Authentication: Major changes │
127
+ │ • Database: New migration │
128
+ │ • API: 5 new endpoints │
129
+ └─────────────────────────────────────────────────────┘
130
+ ```
131
+
132
+ ### Example 2: Commit History
133
+
134
+ ```
135
+ User: 查看最近的提交历史
136
+
137
+ FlowMind:
138
+ ┌─────────────────────────────────────────────────────┐
139
+ │ Recent Commits │
140
+ ├─────────────────────────────────────────────────────┤
141
+ │ 2026-06-22 15:30 - feat: add OAuth2 login │
142
+ │ 2026-06-22 14:20 - fix: resolve session timeout │
143
+ │ 2026-06-22 11:45 - docs: update API documentation │
144
+ │ 2026-06-21 18:00 - refactor: optimize queries │
145
+ │ 2026-06-21 16:30 - test: add login tests │
146
+ ├─────────────────────────────────────────────────────┤
147
+ │ Statistics: │
148
+ │ • 5 commits by 2 authors │
149
+ │ • 3 features, 1 fix, 1 docs │
150
+ │ • +456 -89 lines │
151
+ └─────────────────────────────────────────────────────┘
152
+ ```
153
+
154
+ ## Configuration
155
+
156
+ ```json
157
+ {
158
+ "git-review": {
159
+ "checks": {
160
+ "commitMessage": true,
161
+ "changeSize": true,
162
+ "testCoverage": true,
163
+ "documentation": true
164
+ },
165
+ "limits": {
166
+ "maxCommitLines": 500,
167
+ "maxCommitFiles": 20
168
+ }
169
+ }
170
+ }
171
+ ```
172
+
173
+ ## Commit Message Convention
174
+
175
+ ```
176
+ <type>(<scope>): <subject>
177
+
178
+ [optional body]
179
+
180
+ [optional footer]
181
+ ```
182
+
183
+ Types:
184
+ - `feat`: New feature
185
+ - `fix`: Bug fix
186
+ - `docs`: Documentation
187
+ - `style`: Formatting
188
+ - `refactor`: Code refactoring
189
+ - `test`: Adding tests
190
+ - `chore`: Maintenance