openmatrix 0.1.13 → 0.1.15
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/dist/cli/commands/auto.js +3 -0
- package/dist/cli/commands/start.js +77 -9
- package/dist/utils/gitignore.d.ts +10 -0
- package/dist/utils/gitignore.js +78 -0
- package/package.json +1 -1
- package/skills/om-check.md +85 -129
- package/skills/start.md +2 -1
|
@@ -41,6 +41,7 @@ const task_parser_js_1 = require("../../orchestrator/task-parser.js");
|
|
|
41
41
|
const task_planner_js_1 = require("../../orchestrator/task-planner.js");
|
|
42
42
|
const approval_manager_js_1 = require("../../orchestrator/approval-manager.js");
|
|
43
43
|
const executor_js_1 = require("../../orchestrator/executor.js");
|
|
44
|
+
const gitignore_js_1 = require("../../utils/gitignore.js");
|
|
44
45
|
const index_js_1 = require("../../types/index.js");
|
|
45
46
|
const fs = __importStar(require("fs/promises"));
|
|
46
47
|
const path = __importStar(require("path"));
|
|
@@ -56,6 +57,8 @@ exports.autoCommand = new commander_1.Command('auto')
|
|
|
56
57
|
await fs.mkdir(omPath, { recursive: true });
|
|
57
58
|
await fs.mkdir(path.join(omPath, 'tasks'), { recursive: true });
|
|
58
59
|
await fs.mkdir(path.join(omPath, 'approvals'), { recursive: true });
|
|
60
|
+
// 确保 .openmatrix 被 git 忽略
|
|
61
|
+
await (0, gitignore_js_1.ensureOpenmatrixGitignore)(basePath);
|
|
59
62
|
const stateManager = new state_manager_js_1.StateManager(omPath);
|
|
60
63
|
await stateManager.initialize();
|
|
61
64
|
const state = await stateManager.getState();
|
|
@@ -41,15 +41,23 @@ const task_parser_js_1 = require("../../orchestrator/task-parser.js");
|
|
|
41
41
|
const task_planner_js_1 = require("../../orchestrator/task-planner.js");
|
|
42
42
|
const approval_manager_js_1 = require("../../orchestrator/approval-manager.js");
|
|
43
43
|
const executor_js_1 = require("../../orchestrator/executor.js");
|
|
44
|
+
const gitignore_js_1 = require("../../utils/gitignore.js");
|
|
45
|
+
const index_js_1 = require("../../types/index.js");
|
|
44
46
|
const fs = __importStar(require("fs/promises"));
|
|
45
47
|
const path = __importStar(require("path"));
|
|
46
48
|
exports.startCommand = new commander_1.Command('start')
|
|
47
49
|
.description('启动新的任务执行周期')
|
|
48
50
|
.argument('[input]', '任务文件路径或描述')
|
|
49
51
|
.option('-c, --config <path>', '配置文件路径')
|
|
52
|
+
.option('--init-only', '仅初始化 .openmatrix 目录,不执行任务')
|
|
50
53
|
.option('--skip-questions', '跳过澄清问题')
|
|
51
54
|
.option('--mode <mode>', '执行模式 (confirm-all|confirm-key|auto)')
|
|
52
55
|
.option('--json', '输出 JSON 格式 (供 Skill 解析)')
|
|
56
|
+
.option('--title <title>', '任务标题')
|
|
57
|
+
.option('--description <desc>', '任务描述')
|
|
58
|
+
.option('-q, --quality <level>', '质量级别 (strict|balanced|fast)')
|
|
59
|
+
.option('-t, --tech-stack <stack>', '技术栈 (逗号分隔,如 "TypeScript,Vue.js,PostgreSQL")')
|
|
60
|
+
.option('--docs <level>', '文档级别 (full|basic|minimal|none)')
|
|
53
61
|
.action(async (input, options) => {
|
|
54
62
|
const basePath = process.cwd();
|
|
55
63
|
const omPath = path.join(basePath, '.openmatrix');
|
|
@@ -57,6 +65,23 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
57
65
|
await fs.mkdir(omPath, { recursive: true });
|
|
58
66
|
await fs.mkdir(path.join(omPath, 'tasks'), { recursive: true });
|
|
59
67
|
await fs.mkdir(path.join(omPath, 'approvals'), { recursive: true });
|
|
68
|
+
// 确保 .openmatrix 被 git 忽略
|
|
69
|
+
await (0, gitignore_js_1.ensureOpenmatrixGitignore)(basePath);
|
|
70
|
+
// --init-only 模式:仅初始化目录后返回
|
|
71
|
+
if (options.initOnly) {
|
|
72
|
+
if (options.json) {
|
|
73
|
+
console.log(JSON.stringify({
|
|
74
|
+
status: 'initialized',
|
|
75
|
+
message: '.openmatrix 目录已初始化',
|
|
76
|
+
path: omPath
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
console.log('✅ .openmatrix 目录已初始化');
|
|
81
|
+
console.log(` 路径: ${omPath}`);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
60
85
|
const stateManager = new state_manager_js_1.StateManager(omPath);
|
|
61
86
|
await stateManager.initialize();
|
|
62
87
|
const state = await stateManager.getState();
|
|
@@ -76,10 +101,18 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
76
101
|
}
|
|
77
102
|
return;
|
|
78
103
|
}
|
|
79
|
-
//
|
|
104
|
+
// 构建任务内容
|
|
80
105
|
let taskContent = input;
|
|
106
|
+
// 如果提供了 --title 和 --description,构建任务内容
|
|
107
|
+
if (options.title || options.description) {
|
|
108
|
+
const title = options.title || '未命名任务';
|
|
109
|
+
const description = options.description || '';
|
|
110
|
+
const techStack = options.techStack ? `\n\n技术栈: ${options.techStack}` : '';
|
|
111
|
+
const docs = options.docs ? `\n文档要求: ${options.docs}` : '';
|
|
112
|
+
taskContent = `# ${title}\n\n${description}${techStack}${docs}`;
|
|
113
|
+
}
|
|
114
|
+
// 如果没有任务内容,尝试读取默认文件
|
|
81
115
|
if (!taskContent) {
|
|
82
|
-
// 尝试读取默认任务文件
|
|
83
116
|
const defaultPath = path.join(basePath, 'TASK.md');
|
|
84
117
|
try {
|
|
85
118
|
taskContent = await fs.readFile(defaultPath, 'utf-8');
|
|
@@ -98,6 +131,7 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
98
131
|
console.log('❌ 请提供任务文件路径或描述');
|
|
99
132
|
console.log(' 用法: openmatrix start <task.md>');
|
|
100
133
|
console.log(' 或创建 TASK.md 文件');
|
|
134
|
+
console.log(' 或使用 --title 和 --description 选项');
|
|
101
135
|
}
|
|
102
136
|
return;
|
|
103
137
|
}
|
|
@@ -155,9 +189,6 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
155
189
|
const executionMode = options.mode || 'confirm-key';
|
|
156
190
|
let approvalPoints = [];
|
|
157
191
|
// 根据模式设置审批点
|
|
158
|
-
// auto 模式: 空数组,不暂停任何审批点
|
|
159
|
-
// confirm-key 模式: 仅在关键节点暂停
|
|
160
|
-
// confirm-all 模式: 每个阶段都暂停
|
|
161
192
|
switch (executionMode) {
|
|
162
193
|
case 'confirm-all':
|
|
163
194
|
approvalPoints = ['plan', 'phase', 'merge', 'deploy'];
|
|
@@ -166,18 +197,27 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
166
197
|
approvalPoints = ['plan', 'merge', 'deploy'];
|
|
167
198
|
break;
|
|
168
199
|
case 'auto':
|
|
169
|
-
approvalPoints = [];
|
|
200
|
+
approvalPoints = [];
|
|
170
201
|
break;
|
|
171
202
|
default:
|
|
172
203
|
approvalPoints = ['plan', 'merge'];
|
|
173
204
|
}
|
|
205
|
+
// 处理质量配置
|
|
206
|
+
let qualityConfig;
|
|
207
|
+
if (options.quality) {
|
|
208
|
+
const qualityLevel = options.quality.toLowerCase();
|
|
209
|
+
if (['strict', 'balanced', 'fast'].includes(qualityLevel)) {
|
|
210
|
+
qualityConfig = index_js_1.QUALITY_PRESETS[qualityLevel];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
174
213
|
// 更新状态
|
|
175
214
|
await stateManager.updateState({
|
|
176
215
|
status: 'running',
|
|
177
216
|
currentPhase: 'execution',
|
|
178
217
|
config: {
|
|
179
218
|
...state.config,
|
|
180
|
-
approvalPoints: approvalPoints
|
|
219
|
+
approvalPoints: approvalPoints,
|
|
220
|
+
quality: qualityConfig || state.config.quality
|
|
181
221
|
}
|
|
182
222
|
});
|
|
183
223
|
// 创建审批请求(如果有审批点)
|
|
@@ -195,7 +235,15 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
195
235
|
index: i + 1,
|
|
196
236
|
title: t.title,
|
|
197
237
|
priority: t.priority
|
|
198
|
-
}))
|
|
238
|
+
})),
|
|
239
|
+
// 额外信息供 Skill 使用
|
|
240
|
+
taskInfo: {
|
|
241
|
+
title: options.title || parsedTask.title,
|
|
242
|
+
description: options.description,
|
|
243
|
+
quality: options.quality,
|
|
244
|
+
techStack: options.techStack,
|
|
245
|
+
docs: options.docs
|
|
246
|
+
}
|
|
199
247
|
}));
|
|
200
248
|
}
|
|
201
249
|
else {
|
|
@@ -205,6 +253,12 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
205
253
|
});
|
|
206
254
|
console.log(`\n🎯 执行模式: ${executionMode}`);
|
|
207
255
|
console.log(` 审批点: ${approvalPoints.join(', ')}`);
|
|
256
|
+
if (options.quality) {
|
|
257
|
+
console.log(` 质量级别: ${options.quality}`);
|
|
258
|
+
}
|
|
259
|
+
if (options.techStack) {
|
|
260
|
+
console.log(` 技术栈: ${options.techStack}`);
|
|
261
|
+
}
|
|
208
262
|
console.log(`\n⏸️ 等待计划审批`);
|
|
209
263
|
console.log(` 审批ID: ${approval.id}`);
|
|
210
264
|
console.log(` 使用 /om:approve ${approval.id} 审批`);
|
|
@@ -239,7 +293,15 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
239
293
|
taskId: t.taskId,
|
|
240
294
|
agentType: t.agentType,
|
|
241
295
|
timeout: t.timeout
|
|
242
|
-
}))
|
|
296
|
+
})),
|
|
297
|
+
// 额外信息供 Skill 使用
|
|
298
|
+
taskInfo: {
|
|
299
|
+
title: options.title || parsedTask.title,
|
|
300
|
+
description: options.description,
|
|
301
|
+
quality: options.quality,
|
|
302
|
+
techStack: options.techStack,
|
|
303
|
+
docs: options.docs
|
|
304
|
+
}
|
|
243
305
|
}));
|
|
244
306
|
}
|
|
245
307
|
else {
|
|
@@ -249,6 +311,12 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
249
311
|
});
|
|
250
312
|
console.log(`\n🎯 执行模式: ${executionMode}`);
|
|
251
313
|
console.log(` 审批点: ${approvalPoints.length > 0 ? approvalPoints.join(', ') : '无 (全自动)'}`);
|
|
314
|
+
if (options.quality) {
|
|
315
|
+
console.log(` 质量级别: ${options.quality}`);
|
|
316
|
+
}
|
|
317
|
+
if (options.techStack) {
|
|
318
|
+
console.log(` 技术栈: ${options.techStack}`);
|
|
319
|
+
}
|
|
252
320
|
console.log('\n🚀 开始执行...');
|
|
253
321
|
console.log(' 使用 /om:status 查看进度');
|
|
254
322
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 确保指定目录被 git 忽略
|
|
3
|
+
* @param basePath 项目根目录
|
|
4
|
+
* @param ignorePattern 要忽略的模式 (默认 .openmatrix/)
|
|
5
|
+
*/
|
|
6
|
+
export declare function ensureGitignore(basePath: string, ignorePattern?: string): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* 确保 .openmatrix 目录被 git 忽略
|
|
9
|
+
*/
|
|
10
|
+
export declare function ensureOpenmatrixGitignore(basePath: string): Promise<void>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ensureGitignore = ensureGitignore;
|
|
37
|
+
exports.ensureOpenmatrixGitignore = ensureOpenmatrixGitignore;
|
|
38
|
+
// src/utils/gitignore.ts
|
|
39
|
+
const fs = __importStar(require("fs/promises"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
/**
|
|
42
|
+
* 确保指定目录被 git 忽略
|
|
43
|
+
* @param basePath 项目根目录
|
|
44
|
+
* @param ignorePattern 要忽略的模式 (默认 .openmatrix/)
|
|
45
|
+
*/
|
|
46
|
+
async function ensureGitignore(basePath, ignorePattern = '.openmatrix/') {
|
|
47
|
+
const gitignorePath = path.join(basePath, '.gitignore');
|
|
48
|
+
try {
|
|
49
|
+
const content = await fs.readFile(gitignorePath, 'utf-8');
|
|
50
|
+
// 检查是否已经包含该模式
|
|
51
|
+
const lines = content.split('\n');
|
|
52
|
+
const patternBase = ignorePattern.replace(/\/$/, '');
|
|
53
|
+
const hasPattern = lines.some(line => {
|
|
54
|
+
const trimmed = line.trim();
|
|
55
|
+
return trimmed === patternBase ||
|
|
56
|
+
trimmed === `${patternBase}/` ||
|
|
57
|
+
trimmed === `/${patternBase}` ||
|
|
58
|
+
trimmed === `/${patternBase}/`;
|
|
59
|
+
});
|
|
60
|
+
if (!hasPattern) {
|
|
61
|
+
// 添加模式到 .gitignore
|
|
62
|
+
const newContent = content.endsWith('\n')
|
|
63
|
+
? `${content}${ignorePattern}\n`
|
|
64
|
+
: `${content}\n\n# Auto-added by OpenMatrix\n${ignorePattern}\n`;
|
|
65
|
+
await fs.writeFile(gitignorePath, newContent);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// .gitignore 不存在,创建一个新的
|
|
70
|
+
await fs.writeFile(gitignorePath, `# OpenMatrix state\n${ignorePattern}\n`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 确保 .openmatrix 目录被 git 忽略
|
|
75
|
+
*/
|
|
76
|
+
async function ensureOpenmatrixGitignore(basePath) {
|
|
77
|
+
await ensureGitignore(basePath, '.openmatrix/');
|
|
78
|
+
}
|
package/package.json
CHANGED
package/skills/om-check.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: om:check
|
|
3
|
-
description:
|
|
3
|
+
description: 自动检测项目可改进点并提供升级建议,支持交互式确认后自动执行
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<NO-OTHER-SKILLS>
|
|
@@ -8,7 +8,7 @@ description: 自动检测项目可改进点并提供升级建议,支持交互
|
|
|
8
8
|
</NO-OTHER-SKILLS>
|
|
9
9
|
|
|
10
10
|
<objective>
|
|
11
|
-
|
|
11
|
+
自动扫描项目代码,检测可改进点,用户确认后自动调用 /om:start 执行改进。
|
|
12
12
|
</objective>
|
|
13
13
|
|
|
14
14
|
<trigger-conditions>
|
|
@@ -47,8 +47,6 @@ description: 自动检测项目可改进点并提供升级建议,支持交互
|
|
|
47
47
|
{
|
|
48
48
|
"projectType": "openmatrix|ai-project|nodejs|typescript|python|go|rust|java|csharp|cpp|php|dart",
|
|
49
49
|
"projectName": "项目名称",
|
|
50
|
-
"scanPath": "/path/to/project",
|
|
51
|
-
"timestamp": "2025-01-01T00:00:00.000Z",
|
|
52
50
|
"suggestions": [
|
|
53
51
|
{
|
|
54
52
|
"id": "UPG-001",
|
|
@@ -56,81 +54,80 @@ description: 自动检测项目可改进点并提供升级建议,支持交互
|
|
|
56
54
|
"priority": "critical|high|medium|low",
|
|
57
55
|
"title": "建议标题",
|
|
58
56
|
"description": "详细描述",
|
|
59
|
-
"location": {
|
|
60
|
-
|
|
61
|
-
"line": 42
|
|
62
|
-
},
|
|
63
|
-
"suggestion": "改进建议",
|
|
64
|
-
"autoFixable": true|false,
|
|
65
|
-
"impact": "影响说明",
|
|
66
|
-
"effort": "trivial|small|medium|large"
|
|
57
|
+
"location": { "file": "src/example.ts", "line": 42 },
|
|
58
|
+
"suggestion": "改进建议"
|
|
67
59
|
}
|
|
68
60
|
],
|
|
69
|
-
"summary": {
|
|
70
|
-
"total": 10,
|
|
71
|
-
"byCategory": { ... },
|
|
72
|
-
"byPriority": { ... },
|
|
73
|
-
"autoFixable": 3
|
|
74
|
-
}
|
|
61
|
+
"summary": { "total": 10, "byCategory": {...}, "autoFixable": 3 }
|
|
75
62
|
}
|
|
76
63
|
```
|
|
77
64
|
|
|
78
|
-
3.
|
|
79
|
-
|
|
80
|
-
使用 AskUserQuestion 展示结果并询问用户选择:
|
|
65
|
+
3. **展示检测结果并询问用户**
|
|
81
66
|
|
|
67
|
+
如果没有发现问题,提示用户并结束:
|
|
82
68
|
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
🚨 关键问题 (Y 个)
|
|
86
|
-
─────────────────────
|
|
87
|
-
[UPG-001] 🔒 硬编码密钥
|
|
88
|
-
位置: src/config.ts:15
|
|
89
|
-
建议: 使用环境变量存储敏感信息
|
|
90
|
-
|
|
91
|
-
⚠️ 高优先级 (Z 个)
|
|
92
|
-
─────────────────────
|
|
93
|
-
...
|
|
94
|
-
|
|
95
|
-
💡 请选择要执行的改进:
|
|
69
|
+
✅ 未发现问题,项目状态良好!
|
|
96
70
|
```
|
|
97
71
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
**选择模式:**
|
|
72
|
+
如果发现问题,使用 AskUserQuestion 展示结果:
|
|
101
73
|
```typescript
|
|
102
74
|
AskUserQuestion({
|
|
103
75
|
questions: [{
|
|
104
|
-
question: "
|
|
105
|
-
header: "
|
|
76
|
+
question: "检测到 X 个改进建议,请选择执行方式:",
|
|
77
|
+
header: "执行方式",
|
|
106
78
|
options: [
|
|
107
|
-
{ label: "🔴 全部执行", description: "
|
|
108
|
-
{ label: "🟡 仅关键+高优先级", description: "
|
|
79
|
+
{ label: "🔴 全部执行 (推荐)", description: "自动执行所有检测到的改进" },
|
|
80
|
+
{ label: "🟡 仅关键+高优先级", description: "只执行 critical 和 high 优先级" },
|
|
109
81
|
{ label: "🟢 仅可自动修复", description: "只执行 autoFixable=true 的改进" },
|
|
110
|
-
{ label: "📋
|
|
82
|
+
{ label: "📋 查看详情后决定", description: "逐项查看后手动选择" }
|
|
111
83
|
],
|
|
112
84
|
multiSelect: false
|
|
113
85
|
}]
|
|
114
86
|
})
|
|
115
87
|
```
|
|
116
88
|
|
|
117
|
-
|
|
89
|
+
4. **用户选择后自动执行**
|
|
90
|
+
|
|
91
|
+
**重要**: 用户选择后,**立即自动调用 /om:start 执行**,无需再次确认。
|
|
118
92
|
|
|
119
|
-
|
|
93
|
+
根据用户选择筛选建议:
|
|
94
|
+
- "全部执行" → 使用所有 suggestions
|
|
95
|
+
- "仅关键+高优先级" → 过滤 priority 为 critical/high
|
|
96
|
+
- "仅可自动修复" → 过滤 autoFixable 为 true
|
|
97
|
+
- "查看详情" → 逐项展示,用户选择后执行
|
|
120
98
|
|
|
121
|
-
|
|
122
|
-
- 将选中的改进转换为任务列表
|
|
123
|
-
- 调用 `/om:start` 并传递任务
|
|
99
|
+
5. **调用 /om:start 执行改进**
|
|
124
100
|
|
|
125
|
-
|
|
126
|
-
- 使用 AskUserQuestion 逐个询问
|
|
127
|
-
- 用户确认后执行
|
|
101
|
+
将选中的建议转换为任务描述,调用 /om:start:
|
|
128
102
|
|
|
129
|
-
|
|
103
|
+
```typescript
|
|
104
|
+
// 生成任务描述
|
|
105
|
+
const taskDescription = `
|
|
106
|
+
## 项目改进任务
|
|
107
|
+
|
|
108
|
+
根据检测结果,需要修复以下问题:
|
|
109
|
+
|
|
110
|
+
${selectedSuggestions.map((s, i) => `
|
|
111
|
+
### ${i + 1}. ${s.title}
|
|
112
|
+
- 类别: ${s.category}
|
|
113
|
+
- 优先级: ${s.priority}
|
|
114
|
+
- 位置: ${s.location.file}${s.location.line ? `:${s.location.line}` : ''}
|
|
115
|
+
- 建议: ${s.suggestion}
|
|
116
|
+
`).join('\n')}
|
|
117
|
+
|
|
118
|
+
请逐一修复这些问题。
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
// 调用 /om:start
|
|
122
|
+
// 使用 Skill 工具调用 /om:start
|
|
123
|
+
Skill({ skill: "om:start", args: taskDescription });
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
6. **BYPASS 模式**
|
|
130
127
|
|
|
131
128
|
如果用户选择了"全部执行",进入 BYPASS 模式:
|
|
132
|
-
- 不再请求用户确认
|
|
133
129
|
- 自动批准所有操作
|
|
130
|
+
- 不再请求用户确认
|
|
134
131
|
- 快速完成所有改进
|
|
135
132
|
|
|
136
133
|
</process>
|
|
@@ -140,98 +137,57 @@ $ARGUMENTS
|
|
|
140
137
|
</arguments>
|
|
141
138
|
|
|
142
139
|
<examples>
|
|
143
|
-
/om:check #
|
|
144
|
-
/om:check
|
|
145
|
-
/om:check
|
|
146
|
-
/om:check --auto # 全自动执行 (无需确认)
|
|
140
|
+
/om:check # 自动扫描 → 用户确认 → 自动执行
|
|
141
|
+
/om:check 安全 # 聚焦安全问题 → 用户确认 → 自动修复
|
|
142
|
+
/om:check --auto # 全自动执行 (无确认)
|
|
147
143
|
</examples>
|
|
148
144
|
|
|
149
145
|
<notes>
|
|
150
|
-
##
|
|
151
|
-
|
|
152
|
-
| 类别 | 说明 | 示例 |
|
|
153
|
-
|------|------|------|
|
|
154
|
-
| bug | 代码缺陷 | TODO, FIXME, 潜在bug |
|
|
155
|
-
| quality | 代码质量 | 过长函数, 复杂度, 重复代码 |
|
|
156
|
-
| capability | 缺失能力 | 缺少测试, 文档, 类型定义 |
|
|
157
|
-
| ux | 用户体验 | 错误提示, 帮助信息 |
|
|
158
|
-
| style | 代码风格 | 命名, 格式, 一致性 |
|
|
159
|
-
| security | 安全问题 | 硬编码密钥, SQL注入 |
|
|
160
|
-
| common | 常见问题 | 魔法数字, 硬编码路径 |
|
|
161
|
-
| prompt | Prompt 问题 | 注入风险, 缺少格式说明 |
|
|
162
|
-
| skill | Skill 问题 | 缺少 frontmatter, objective |
|
|
163
|
-
| agent | Agent 配置 | CLAUDE.md 缺少构建命令 |
|
|
164
|
-
|
|
165
|
-
## 优先级说明
|
|
166
|
-
|
|
167
|
-
| 优先级 | 说明 | 处理建议 |
|
|
168
|
-
|--------|------|----------|
|
|
169
|
-
| critical | 严重问题 | 立即处理 |
|
|
170
|
-
| high | 重要问题 | 优先处理 |
|
|
171
|
-
| medium | 一般问题 | 计划处理 |
|
|
172
|
-
| low | 轻微问题 | 有空再处理 |
|
|
173
|
-
|
|
174
|
-
## 项目类型识别
|
|
175
|
-
|
|
176
|
-
系统自动识别以下项目类型:
|
|
177
|
-
- **openmatrix**: OpenMatrix 项目自身
|
|
178
|
-
- **ai-project**: AI 项目 (包含 prompts/skills/agents)
|
|
179
|
-
- **nodejs**: Node.js 项目
|
|
180
|
-
- **typescript**: TypeScript 项目
|
|
181
|
-
- **python**: Python 项目
|
|
182
|
-
- **go**: Go 项目
|
|
183
|
-
- **rust**: Rust 项目
|
|
184
|
-
- **java**: Java 项目
|
|
185
|
-
- **csharp**: C# 项目
|
|
186
|
-
- **cpp**: C/C++ 项目
|
|
187
|
-
- **php**: PHP 项目
|
|
188
|
-
- **dart**: Dart 项目
|
|
189
|
-
|
|
190
|
-
根据项目类型,检测器会调整检测策略和建议。
|
|
191
|
-
|
|
192
|
-
## 与 /om:start 的关系
|
|
193
|
-
|
|
194
|
-
`/om:check` 检测完成后,可以选择将改进项传递给 `/om:start` 执行:
|
|
146
|
+
## 执行流程图
|
|
195
147
|
|
|
196
148
|
```
|
|
197
149
|
/om:check
|
|
198
150
|
│
|
|
199
|
-
├── 检测项目 ──→ 生成建议列表
|
|
151
|
+
├── 1. 检测项目 ──→ 生成建议列表
|
|
152
|
+
│
|
|
153
|
+
├── 2. 展示结果 ──→ 用户选择执行方式
|
|
200
154
|
│
|
|
201
|
-
├──
|
|
155
|
+
├── 3. 用户确认 ──→ 选择"全部执行"
|
|
202
156
|
│
|
|
203
|
-
└──
|
|
204
|
-
|
|
205
|
-
|
|
157
|
+
└── 4. 自动执行 ──→ 调用 /om:start
|
|
158
|
+
│
|
|
159
|
+
├── 任务规划
|
|
160
|
+
├── 代码修改
|
|
161
|
+
├── 质量验证
|
|
162
|
+
└── 完成 ✅
|
|
206
163
|
```
|
|
207
164
|
|
|
208
|
-
##
|
|
165
|
+
## 检测类别说明
|
|
209
166
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
167
|
+
| 类别 | 说明 | 示例 |
|
|
168
|
+
|------|------|------|
|
|
169
|
+
| 🐛 bug | 代码缺陷 | TODO, FIXME, 潜在bug |
|
|
170
|
+
| 🔧 quality | 代码质量 | 过长函数, 复杂度 |
|
|
171
|
+
| 📦 capability | 缺失能力 | 缺少测试, 文档 |
|
|
172
|
+
| 🔒 security | 安全问题 | 硬编码密钥, SQL注入 |
|
|
173
|
+
| 🤖 prompt | Prompt 问题 | 注入风险, 缺少格式 |
|
|
174
|
+
| ⚡ skill | Skill 问题 | 缺少 frontmatter |
|
|
175
|
+
| 🧠 agent | Agent 配置 | CLAUDE.md 缺少构建命令 |
|
|
218
176
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
系统: 扫描安全问题...
|
|
223
|
-
发现 3 个安全隐患
|
|
224
|
-
用户选择: 全部执行
|
|
225
|
-
系统: 自动修复安全问题...
|
|
226
|
-
```
|
|
177
|
+
## 与 /om:start 的关系
|
|
178
|
+
|
|
179
|
+
`/om:check` 检测完成后,**自动**将改进项传递给 `/om:start` 执行:
|
|
227
180
|
|
|
228
|
-
### 场景 3: AI 项目检查
|
|
229
181
|
```
|
|
230
182
|
用户: /om:check
|
|
231
|
-
系统: 检测到
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
183
|
+
系统: 检测到 5 个问题...
|
|
184
|
+
[展示问题列表]
|
|
185
|
+
请选择执行方式: [全部执行]
|
|
186
|
+
系统: 正在调用 /om:start 执行改进...
|
|
187
|
+
→ 任务规划中...
|
|
188
|
+
→ 执行改进...
|
|
189
|
+
→ 完成!
|
|
236
190
|
```
|
|
191
|
+
|
|
192
|
+
**用户只需确认一次,后续全自动执行。**
|
|
237
193
|
</notes>
|
package/skills/start.md
CHANGED
|
@@ -19,6 +19,7 @@ description: 启动新的任务执行周期
|
|
|
19
19
|
openmatrix start --init-only
|
|
20
20
|
```
|
|
21
21
|
- 这会创建 `.openmatrix/`、`.openmatrix/tasks/`、`.openmatrix/approvals/` 目录
|
|
22
|
+
- 同时自动将 `.openmatrix/` 添加到 `.gitignore`
|
|
22
23
|
|
|
23
24
|
2. **检查当前状态**
|
|
24
25
|
- 读取 `.openmatrix/state.json`
|
|
@@ -40,7 +41,7 @@ description: 启动新的任务执行周期
|
|
|
40
41
|
|
|
41
42
|
5. **⚠️ 交互式问答 (必须执行)**
|
|
42
43
|
|
|
43
|
-
**重要**: 除非用户明确指定 `--skip-questions
|
|
44
|
+
**重要**: 除非用户明确指定 `--skip-questions` 或提供了 `--quality` 等选项,否则必须执行交互式问答。
|
|
44
45
|
|
|
45
46
|
使用 `AskUserQuestion` 工具,逐个提出以下问题:
|
|
46
47
|
|