openmatrix 0.1.14 → 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/start.js +74 -9
- package/package.json +1 -1
- package/skills/start.md +2 -1
|
@@ -42,15 +42,22 @@ 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
44
|
const gitignore_js_1 = require("../../utils/gitignore.js");
|
|
45
|
+
const index_js_1 = require("../../types/index.js");
|
|
45
46
|
const fs = __importStar(require("fs/promises"));
|
|
46
47
|
const path = __importStar(require("path"));
|
|
47
48
|
exports.startCommand = new commander_1.Command('start')
|
|
48
49
|
.description('启动新的任务执行周期')
|
|
49
50
|
.argument('[input]', '任务文件路径或描述')
|
|
50
51
|
.option('-c, --config <path>', '配置文件路径')
|
|
52
|
+
.option('--init-only', '仅初始化 .openmatrix 目录,不执行任务')
|
|
51
53
|
.option('--skip-questions', '跳过澄清问题')
|
|
52
54
|
.option('--mode <mode>', '执行模式 (confirm-all|confirm-key|auto)')
|
|
53
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)')
|
|
54
61
|
.action(async (input, options) => {
|
|
55
62
|
const basePath = process.cwd();
|
|
56
63
|
const omPath = path.join(basePath, '.openmatrix');
|
|
@@ -60,6 +67,21 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
60
67
|
await fs.mkdir(path.join(omPath, 'approvals'), { recursive: true });
|
|
61
68
|
// 确保 .openmatrix 被 git 忽略
|
|
62
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
|
+
}
|
|
63
85
|
const stateManager = new state_manager_js_1.StateManager(omPath);
|
|
64
86
|
await stateManager.initialize();
|
|
65
87
|
const state = await stateManager.getState();
|
|
@@ -79,10 +101,18 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
79
101
|
}
|
|
80
102
|
return;
|
|
81
103
|
}
|
|
82
|
-
//
|
|
104
|
+
// 构建任务内容
|
|
83
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
|
+
// 如果没有任务内容,尝试读取默认文件
|
|
84
115
|
if (!taskContent) {
|
|
85
|
-
// 尝试读取默认任务文件
|
|
86
116
|
const defaultPath = path.join(basePath, 'TASK.md');
|
|
87
117
|
try {
|
|
88
118
|
taskContent = await fs.readFile(defaultPath, 'utf-8');
|
|
@@ -101,6 +131,7 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
101
131
|
console.log('❌ 请提供任务文件路径或描述');
|
|
102
132
|
console.log(' 用法: openmatrix start <task.md>');
|
|
103
133
|
console.log(' 或创建 TASK.md 文件');
|
|
134
|
+
console.log(' 或使用 --title 和 --description 选项');
|
|
104
135
|
}
|
|
105
136
|
return;
|
|
106
137
|
}
|
|
@@ -158,9 +189,6 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
158
189
|
const executionMode = options.mode || 'confirm-key';
|
|
159
190
|
let approvalPoints = [];
|
|
160
191
|
// 根据模式设置审批点
|
|
161
|
-
// auto 模式: 空数组,不暂停任何审批点
|
|
162
|
-
// confirm-key 模式: 仅在关键节点暂停
|
|
163
|
-
// confirm-all 模式: 每个阶段都暂停
|
|
164
192
|
switch (executionMode) {
|
|
165
193
|
case 'confirm-all':
|
|
166
194
|
approvalPoints = ['plan', 'phase', 'merge', 'deploy'];
|
|
@@ -169,18 +197,27 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
169
197
|
approvalPoints = ['plan', 'merge', 'deploy'];
|
|
170
198
|
break;
|
|
171
199
|
case 'auto':
|
|
172
|
-
approvalPoints = [];
|
|
200
|
+
approvalPoints = [];
|
|
173
201
|
break;
|
|
174
202
|
default:
|
|
175
203
|
approvalPoints = ['plan', 'merge'];
|
|
176
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
|
+
}
|
|
177
213
|
// 更新状态
|
|
178
214
|
await stateManager.updateState({
|
|
179
215
|
status: 'running',
|
|
180
216
|
currentPhase: 'execution',
|
|
181
217
|
config: {
|
|
182
218
|
...state.config,
|
|
183
|
-
approvalPoints: approvalPoints
|
|
219
|
+
approvalPoints: approvalPoints,
|
|
220
|
+
quality: qualityConfig || state.config.quality
|
|
184
221
|
}
|
|
185
222
|
});
|
|
186
223
|
// 创建审批请求(如果有审批点)
|
|
@@ -198,7 +235,15 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
198
235
|
index: i + 1,
|
|
199
236
|
title: t.title,
|
|
200
237
|
priority: t.priority
|
|
201
|
-
}))
|
|
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
|
+
}
|
|
202
247
|
}));
|
|
203
248
|
}
|
|
204
249
|
else {
|
|
@@ -208,6 +253,12 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
208
253
|
});
|
|
209
254
|
console.log(`\n🎯 执行模式: ${executionMode}`);
|
|
210
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
|
+
}
|
|
211
262
|
console.log(`\n⏸️ 等待计划审批`);
|
|
212
263
|
console.log(` 审批ID: ${approval.id}`);
|
|
213
264
|
console.log(` 使用 /om:approve ${approval.id} 审批`);
|
|
@@ -242,7 +293,15 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
242
293
|
taskId: t.taskId,
|
|
243
294
|
agentType: t.agentType,
|
|
244
295
|
timeout: t.timeout
|
|
245
|
-
}))
|
|
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
|
+
}
|
|
246
305
|
}));
|
|
247
306
|
}
|
|
248
307
|
else {
|
|
@@ -252,6 +311,12 @@ exports.startCommand = new commander_1.Command('start')
|
|
|
252
311
|
});
|
|
253
312
|
console.log(`\n🎯 执行模式: ${executionMode}`);
|
|
254
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
|
+
}
|
|
255
320
|
console.log('\n🚀 开始执行...');
|
|
256
321
|
console.log(' 使用 /om:status 查看进度');
|
|
257
322
|
}
|
package/package.json
CHANGED
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
|
|