openmatrix 0.1.0 → 0.1.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.md +397 -512
- package/dist/cli/commands/auto.d.ts +2 -0
- package/dist/cli/commands/auto.js +226 -0
- package/dist/cli/commands/install-skills.d.ts +3 -0
- package/dist/cli/commands/install-skills.js +134 -0
- package/dist/cli/index.js +4 -0
- package/package.json +3 -2
- package/skills/auto.md +218 -0
- package/skills/om.md +124 -0
- package/skills/start.md +153 -21
|
@@ -0,0 +1,226 @@
|
|
|
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.autoCommand = void 0;
|
|
37
|
+
// src/cli/commands/auto.ts
|
|
38
|
+
const commander_1 = require("commander");
|
|
39
|
+
const state_manager_js_1 = require("../../storage/state-manager.js");
|
|
40
|
+
const task_parser_js_1 = require("../../orchestrator/task-parser.js");
|
|
41
|
+
const task_planner_js_1 = require("../../orchestrator/task-planner.js");
|
|
42
|
+
const approval_manager_js_1 = require("../../orchestrator/approval-manager.js");
|
|
43
|
+
const executor_js_1 = require("../../orchestrator/executor.js");
|
|
44
|
+
const index_js_1 = require("../../types/index.js");
|
|
45
|
+
const fs = __importStar(require("fs/promises"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
exports.autoCommand = new commander_1.Command('auto')
|
|
48
|
+
.description('全自动执行任务 - 无阻塞,bypass permissions')
|
|
49
|
+
.argument('[input]', '任务文件路径或描述')
|
|
50
|
+
.option('-q, --quality <level>', '质量级别 (strict|balanced|fast)', 'strict')
|
|
51
|
+
.option('--json', '输出 JSON 格式 (供 Skill 解析)')
|
|
52
|
+
.action(async (input, options) => {
|
|
53
|
+
const basePath = process.cwd();
|
|
54
|
+
const omPath = path.join(basePath, '.openmatrix');
|
|
55
|
+
// 确保目录存在
|
|
56
|
+
await fs.mkdir(omPath, { recursive: true });
|
|
57
|
+
await fs.mkdir(path.join(omPath, 'tasks'), { recursive: true });
|
|
58
|
+
await fs.mkdir(path.join(omPath, 'approvals'), { recursive: true });
|
|
59
|
+
const stateManager = new state_manager_js_1.StateManager(omPath);
|
|
60
|
+
await stateManager.initialize();
|
|
61
|
+
const state = await stateManager.getState();
|
|
62
|
+
// 检查是否已有运行中的任务
|
|
63
|
+
if (state.status === 'running') {
|
|
64
|
+
if (options.json) {
|
|
65
|
+
console.log(JSON.stringify({
|
|
66
|
+
status: 'error',
|
|
67
|
+
message: '已有任务在执行中',
|
|
68
|
+
hint: '使用 /om:status 查看状态,或 /om:resume 恢复执行'
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.log('⚠️ 已有任务在执行中');
|
|
73
|
+
console.log(' 使用 /om:status 查看状态');
|
|
74
|
+
console.log(' 使用 /om:resume 恢复执行');
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// 验证质量级别
|
|
79
|
+
const qualityLevel = options.quality;
|
|
80
|
+
if (!['strict', 'balanced', 'fast'].includes(qualityLevel)) {
|
|
81
|
+
if (options.json) {
|
|
82
|
+
console.log(JSON.stringify({
|
|
83
|
+
status: 'error',
|
|
84
|
+
message: `无效的质量级别: ${qualityLevel}`,
|
|
85
|
+
hint: '可选值: strict, balanced, fast'
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
console.log(`❌ 无效的质量级别: ${qualityLevel}`);
|
|
90
|
+
console.log(' 可选值: strict, balanced, fast');
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// 获取任务内容
|
|
95
|
+
let taskContent = input;
|
|
96
|
+
if (!taskContent) {
|
|
97
|
+
// 尝试读取默认任务文件
|
|
98
|
+
const defaultPath = path.join(basePath, 'TASK.md');
|
|
99
|
+
try {
|
|
100
|
+
taskContent = await fs.readFile(defaultPath, 'utf-8');
|
|
101
|
+
if (!options.json) {
|
|
102
|
+
console.log(`📄 读取任务文件: ${defaultPath}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
if (options.json) {
|
|
107
|
+
console.log(JSON.stringify({
|
|
108
|
+
status: 'error',
|
|
109
|
+
message: '请提供任务文件路径或描述'
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
console.log('❌ 请提供任务文件路径或描述');
|
|
114
|
+
console.log(' 用法: openmatrix auto <task.md>');
|
|
115
|
+
console.log(' 或创建 TASK.md 文件');
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (taskContent.endsWith('.md')) {
|
|
121
|
+
// 读取文件
|
|
122
|
+
try {
|
|
123
|
+
taskContent = await fs.readFile(taskContent, 'utf-8');
|
|
124
|
+
if (!options.json) {
|
|
125
|
+
console.log(`📄 读取任务文件: ${input}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
if (options.json) {
|
|
130
|
+
console.log(JSON.stringify({
|
|
131
|
+
status: 'error',
|
|
132
|
+
message: `无法读取文件: ${input}`
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log(`❌ 无法读取文件: ${input}`);
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// 解析任务
|
|
142
|
+
if (!options.json) {
|
|
143
|
+
console.log('\n🔍 解析任务...');
|
|
144
|
+
}
|
|
145
|
+
const parser = new task_parser_js_1.TaskParser();
|
|
146
|
+
const parsedTask = parser.parse(taskContent);
|
|
147
|
+
if (!options.json) {
|
|
148
|
+
console.log(`\n📋 任务: ${parsedTask.title}`);
|
|
149
|
+
console.log(` 目标: ${parsedTask.goals.join(', ')}`);
|
|
150
|
+
}
|
|
151
|
+
// 拆解任务
|
|
152
|
+
if (!options.json) {
|
|
153
|
+
console.log('\n🔧 拆解任务...');
|
|
154
|
+
}
|
|
155
|
+
const planner = new task_planner_js_1.TaskPlanner();
|
|
156
|
+
const subTasks = planner.breakdown(parsedTask, {});
|
|
157
|
+
// 创建任务到状态管理器
|
|
158
|
+
for (const subTask of subTasks) {
|
|
159
|
+
await stateManager.createTask({
|
|
160
|
+
title: subTask.title,
|
|
161
|
+
description: subTask.description,
|
|
162
|
+
priority: subTask.priority,
|
|
163
|
+
timeout: subTask.estimatedComplexity === 'high' ? 300000 :
|
|
164
|
+
subTask.estimatedComplexity === 'medium' ? 180000 : 120000,
|
|
165
|
+
dependencies: subTask.dependencies,
|
|
166
|
+
assignedAgent: subTask.assignedAgent
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
// 获取质量配置
|
|
170
|
+
const qualityConfig = index_js_1.QUALITY_PRESETS[qualityLevel];
|
|
171
|
+
// auto 模式: 空审批点数组 = bypass permissions
|
|
172
|
+
const approvalPoints = [];
|
|
173
|
+
// 更新状态
|
|
174
|
+
await stateManager.updateState({
|
|
175
|
+
status: 'running',
|
|
176
|
+
currentPhase: 'execution',
|
|
177
|
+
config: {
|
|
178
|
+
...state.config,
|
|
179
|
+
approvalPoints: approvalPoints,
|
|
180
|
+
quality: qualityConfig
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
// 创建执行器并获取第一批任务
|
|
184
|
+
const approvalManager = new approval_manager_js_1.ApprovalManager(stateManager);
|
|
185
|
+
const executor = new executor_js_1.OrchestratorExecutor(stateManager, approvalManager, {
|
|
186
|
+
maxConcurrent: state.config.maxConcurrentAgents,
|
|
187
|
+
taskTimeout: state.config.timeout * 1000
|
|
188
|
+
});
|
|
189
|
+
// 设置自动模式
|
|
190
|
+
const phaseExecutor = executor.getPhaseExecutor();
|
|
191
|
+
if (phaseExecutor) {
|
|
192
|
+
phaseExecutor.setAutoMode(true);
|
|
193
|
+
}
|
|
194
|
+
const result = await executor.step();
|
|
195
|
+
if (options.json) {
|
|
196
|
+
// JSON 输出供 Skill 解析
|
|
197
|
+
console.log(JSON.stringify({
|
|
198
|
+
status: result.status,
|
|
199
|
+
message: result.message,
|
|
200
|
+
mode: 'auto',
|
|
201
|
+
quality: qualityLevel,
|
|
202
|
+
bypassPermissions: true,
|
|
203
|
+
statistics: result.statistics,
|
|
204
|
+
subagentTasks: result.subagentTasks.map(t => ({
|
|
205
|
+
subagent_type: t.subagent_type,
|
|
206
|
+
description: t.description,
|
|
207
|
+
prompt: t.prompt,
|
|
208
|
+
isolation: t.isolation,
|
|
209
|
+
taskId: t.taskId,
|
|
210
|
+
agentType: t.agentType,
|
|
211
|
+
timeout: t.timeout
|
|
212
|
+
}))
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
console.log(`\n📋 生成 ${subTasks.length} 个子任务:\n`);
|
|
217
|
+
subTasks.forEach((task, i) => {
|
|
218
|
+
console.log(` ${i + 1}. ${task.title} (${task.priority})`);
|
|
219
|
+
});
|
|
220
|
+
console.log(`\n🚀 全自动执行模式`);
|
|
221
|
+
console.log(` 质量级别: ${qualityLevel}`);
|
|
222
|
+
console.log(` 审批点: 无 (bypass permissions)`);
|
|
223
|
+
console.log('\n⏳ 开始执行...');
|
|
224
|
+
console.log(' 使用 /om:status 查看进度');
|
|
225
|
+
}
|
|
226
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.installSkillsCommand = void 0;
|
|
38
|
+
const commander_1 = require("commander");
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const os = __importStar(require("os"));
|
|
42
|
+
exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
43
|
+
.description('Install OpenMatrix skills to ~/.claude/commands/om/')
|
|
44
|
+
.option('-f, --force', 'Force overwrite existing skills', false)
|
|
45
|
+
.action((options) => {
|
|
46
|
+
const skillsDir = path.join(__dirname, '..', '..', '..', 'skills');
|
|
47
|
+
const claudeDir = path.join(os.homedir(), '.claude');
|
|
48
|
+
const commandsDir = path.join(claudeDir, 'commands', 'om');
|
|
49
|
+
console.log('📦 OpenMatrix Skills Installer\n');
|
|
50
|
+
// Check if skills directory exists
|
|
51
|
+
if (!fs.existsSync(skillsDir)) {
|
|
52
|
+
console.error('❌ Skills directory not found:', skillsDir);
|
|
53
|
+
console.error(' Make sure openmatrix is installed correctly.');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
// Create commands directory
|
|
57
|
+
try {
|
|
58
|
+
if (!fs.existsSync(commandsDir)) {
|
|
59
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
60
|
+
console.log('📁 Created directory:', commandsDir);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
console.error('❌ Cannot create directory:', commandsDir);
|
|
65
|
+
console.error(' Error:', err.message);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
// Get skill files (excluding om.md which is the default entry)
|
|
69
|
+
const files = fs.readdirSync(skillsDir).filter(f => f.endsWith('.md') && f !== 'om.md');
|
|
70
|
+
if (files.length === 0) {
|
|
71
|
+
console.error('❌ No skill files found in:', skillsDir);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
console.log(`📋 Found ${files.length} skill files\n`);
|
|
75
|
+
let installed = 0;
|
|
76
|
+
let skipped = 0;
|
|
77
|
+
let failed = 0;
|
|
78
|
+
// Install skill files to ~/.claude/commands/om/
|
|
79
|
+
files.forEach(file => {
|
|
80
|
+
const src = path.join(skillsDir, file);
|
|
81
|
+
const dest = path.join(commandsDir, file);
|
|
82
|
+
try {
|
|
83
|
+
// Check if file exists and not forcing
|
|
84
|
+
if (fs.existsSync(dest) && !options.force) {
|
|
85
|
+
console.log(` ⏭️ Skipped: ${file} (already exists)`);
|
|
86
|
+
skipped++;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
fs.copyFileSync(src, dest);
|
|
90
|
+
const skillName = path.basename(file, '.md');
|
|
91
|
+
console.log(` ✅ Installed: /om:${skillName}`);
|
|
92
|
+
installed++;
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
console.log(` ❌ Failed: ${file} (${err.message})`);
|
|
96
|
+
failed++;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
// Install default /om command to ~/.claude/commands/om.md
|
|
100
|
+
const omSrc = path.join(skillsDir, 'om.md');
|
|
101
|
+
const omDest = path.join(claudeDir, 'commands', 'om.md');
|
|
102
|
+
if (fs.existsSync(omSrc)) {
|
|
103
|
+
try {
|
|
104
|
+
if (fs.existsSync(omDest) && !options.force) {
|
|
105
|
+
console.log(` ⏭️ Skipped: om.md (already exists)`);
|
|
106
|
+
skipped++;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
fs.copyFileSync(omSrc, omDest);
|
|
110
|
+
console.log(` ✅ Installed: /om (default entry)`);
|
|
111
|
+
installed++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
console.log(` ❌ Failed: om.md (${err.message})`);
|
|
116
|
+
failed++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
console.log('\n' + '─'.repeat(50));
|
|
120
|
+
console.log(`📊 Summary:`);
|
|
121
|
+
console.log(` ✅ Installed: ${installed}`);
|
|
122
|
+
console.log(` ⏭️ Skipped: ${skipped}`);
|
|
123
|
+
console.log(` ❌ Failed: ${failed}`);
|
|
124
|
+
console.log(`\n📁 Location: ${commandsDir}`);
|
|
125
|
+
console.log(`📁 Default: ${omDest}`);
|
|
126
|
+
if (installed > 0) {
|
|
127
|
+
console.log('\n🎉 Skills installed successfully!');
|
|
128
|
+
console.log(' Try: /om <your task>');
|
|
129
|
+
console.log(' Or: /om:start <your task>');
|
|
130
|
+
}
|
|
131
|
+
if (failed > 0) {
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
});
|
package/dist/cli/index.js
CHANGED
|
@@ -9,6 +9,8 @@ const resume_js_1 = require("./commands/resume.js");
|
|
|
9
9
|
const retry_js_1 = require("./commands/retry.js");
|
|
10
10
|
const report_js_1 = require("./commands/report.js");
|
|
11
11
|
const meeting_js_1 = require("./commands/meeting.js");
|
|
12
|
+
const auto_js_1 = require("./commands/auto.js");
|
|
13
|
+
const install_skills_js_1 = require("./commands/install-skills.js");
|
|
12
14
|
const program = new commander_1.Command();
|
|
13
15
|
program
|
|
14
16
|
.name('openmatrix')
|
|
@@ -22,5 +24,7 @@ program.addCommand(resume_js_1.resumeCommand);
|
|
|
22
24
|
program.addCommand(retry_js_1.retryCommand);
|
|
23
25
|
program.addCommand(report_js_1.reportCommand);
|
|
24
26
|
program.addCommand(meeting_js_1.meetingCommand);
|
|
27
|
+
program.addCommand(auto_js_1.autoCommand);
|
|
28
|
+
program.addCommand(install_skills_js_1.installSkillsCommand);
|
|
25
29
|
// 默认帮助
|
|
26
30
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmatrix",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "AI Agent task orchestration system with Claude Code Skills integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"dev": "tsx src/cli/index.ts",
|
|
19
|
-
"test": "vitest"
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"postinstall": "node scripts/install-skills.js"
|
|
20
21
|
},
|
|
21
22
|
"keywords": [
|
|
22
23
|
"claude",
|
package/skills/auto.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: om:auto
|
|
3
|
+
description: 全自动执行任务 - 无阻塞,bypass permissions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<NO-OTHER-SKILLS>
|
|
7
|
+
执行此技能时,不得调用 superpowers、gsd 或其他任务编排相关的技能。OpenMatrix 独立运行,不依赖外部任务编排系统。
|
|
8
|
+
</NO-OTHER-SKILLS>
|
|
9
|
+
|
|
10
|
+
<objective>
|
|
11
|
+
全自动执行任务,跳过所有交互式问答和审批点,直接完成。支持 --quality 参数指定质量级别(默认 strict)。
|
|
12
|
+
</objective>
|
|
13
|
+
|
|
14
|
+
<process>
|
|
15
|
+
1. **检查并初始化 .openmatrix 目录**
|
|
16
|
+
- 检查 `.openmatrix/` 目录是否存在
|
|
17
|
+
- 如果不存在,CLI 会自动创建
|
|
18
|
+
|
|
19
|
+
2. **检查当前状态**
|
|
20
|
+
- 读取 `.openmatrix/state.json`
|
|
21
|
+
- 如果 `status === 'running'`,提示用户先完成或暂停
|
|
22
|
+
|
|
23
|
+
3. **解析参数**
|
|
24
|
+
- `$ARGUMENTS` 可能包含:
|
|
25
|
+
- 任务描述或文件路径
|
|
26
|
+
- `--quality <level>` 质量级别 (strict|balanced|fast),默认 strict
|
|
27
|
+
- `--bypass` 是否 bypass permissions (默认 true)
|
|
28
|
+
|
|
29
|
+
参数解析示例:
|
|
30
|
+
```
|
|
31
|
+
/om:auto "实现用户登录" --quality fast
|
|
32
|
+
/om:auto task.md
|
|
33
|
+
/om:auto task.md --quality balanced
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. **解析任务输入**
|
|
37
|
+
- 如果提供文件路径 → 读取文件内容
|
|
38
|
+
- 如果是任务描述 → 直接使用
|
|
39
|
+
- 如果无参数 → **使用 AskUserQuestion 询问任务**
|
|
40
|
+
|
|
41
|
+
5. **直接执行 (无交互式问答)**
|
|
42
|
+
- 跳过所有澄清问题
|
|
43
|
+
- 使用默认质量配置 (strict 除非指定)
|
|
44
|
+
- 设置 `approvalPoints: []` (bypass permissions)
|
|
45
|
+
|
|
46
|
+
6. **调用 CLI**
|
|
47
|
+
```bash
|
|
48
|
+
openmatrix auto --quality <level> --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
7. **执行循环 (全自动)**
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
while (有待执行任务) {
|
|
55
|
+
1. 读取状态文件获取 SubagentTask
|
|
56
|
+
2. 调用 Agent 工具执行 Subagent
|
|
57
|
+
3. Subagent 完成后,更新状态文件:
|
|
58
|
+
```bash
|
|
59
|
+
openmatrix complete <taskId> --success/--failed
|
|
60
|
+
```
|
|
61
|
+
4. **Git 自动提交** (每个子任务完成后):
|
|
62
|
+
```bash
|
|
63
|
+
git add -A
|
|
64
|
+
git commit -m "feat(task-id): 任务标题
|
|
65
|
+
|
|
66
|
+
- 修改内容1
|
|
67
|
+
- 修改内容2
|
|
68
|
+
|
|
69
|
+
任务ID: TASK-XXX
|
|
70
|
+
RunID: run-XXX"
|
|
71
|
+
```
|
|
72
|
+
5. Phase 验收测试
|
|
73
|
+
6. **自动批准所有审批点**:
|
|
74
|
+
- plan/merge/deploy → 自动批准 ✓
|
|
75
|
+
- meeting → 记录并跳过,继续执行
|
|
76
|
+
7. 继续下一个任务
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
8. **执行完成 - 最终 Git 提交**
|
|
81
|
+
|
|
82
|
+
所有任务完成后,执行最终提交:
|
|
83
|
+
```bash
|
|
84
|
+
git add -A
|
|
85
|
+
git commit -m "feat: 完成所有任务 (auto mode)
|
|
86
|
+
|
|
87
|
+
RunID: run-XXX
|
|
88
|
+
任务数: N
|
|
89
|
+
完成时间: YYYY-MM-DD HH:mm:ss"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
9. **展示 Meeting (如果有)**
|
|
93
|
+
如果有 pending 的 Meeting,列出供用户后续处理:
|
|
94
|
+
```
|
|
95
|
+
执行完成!
|
|
96
|
+
📋 有待处理的 Meeting (2个):
|
|
97
|
+
- APPR-001: 数据库连接失败 (TASK-B)
|
|
98
|
+
- APPR-002: API设计决策 (TASK-D)
|
|
99
|
+
|
|
100
|
+
请使用 /om:meeting 查看并处理
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</process>
|
|
104
|
+
|
|
105
|
+
<arguments>
|
|
106
|
+
$ARGUMENTS
|
|
107
|
+
</arguments>
|
|
108
|
+
|
|
109
|
+
<examples>
|
|
110
|
+
/om:auto # 交互式输入任务
|
|
111
|
+
/om:auto "实现用户登录功能" # 直接执行,strict 质量
|
|
112
|
+
/om:auto task.md --quality fast # 快速模式,无质量门禁
|
|
113
|
+
/om:auto task.md --quality balanced # 平衡模式
|
|
114
|
+
/om:auto task.md --quality strict # 严格模式 (默认)
|
|
115
|
+
</examples>
|
|
116
|
+
|
|
117
|
+
<notes>
|
|
118
|
+
## 质量级别
|
|
119
|
+
|
|
120
|
+
| 级别 | TDD | 覆盖率 | Lint | 安全扫描 | 适用场景 |
|
|
121
|
+
|------|:---:|:------:|:----:|:--------:|---------|
|
|
122
|
+
| **strict** | ✅ | >80% | ✅ 严格 | ✅ | 生产代码 (默认) |
|
|
123
|
+
| **balanced** | ❌ | >60% | ✅ | ✅ | 日常开发 |
|
|
124
|
+
| **fast** | ❌ | >20% | ❌ | ❌ | 快速原型 |
|
|
125
|
+
|
|
126
|
+
## 与 /om:start 的区别
|
|
127
|
+
|
|
128
|
+
| 特性 | /om:start | /om:auto |
|
|
129
|
+
|------|-----------|----------|
|
|
130
|
+
| 交互式问答 | ✅ 必须 | ❌ 跳过 |
|
|
131
|
+
| 质量级别选择 | 交互选择 | 参数指定,默认 strict |
|
|
132
|
+
| 执行模式选择 | 交互选择 | 固定 auto |
|
|
133
|
+
| 审批点 | 可配置 | 无 (bypass) |
|
|
134
|
+
| Meeting 处理 | 执行中交互 | 记录并跳过 |
|
|
135
|
+
|
|
136
|
+
## CLI 命令
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# 全自动执行,strict 质量
|
|
140
|
+
openmatrix auto task.md
|
|
141
|
+
|
|
142
|
+
# 全自动执行,fast 质量
|
|
143
|
+
openmatrix auto task.md --quality fast
|
|
144
|
+
|
|
145
|
+
# JSON 输出 (供 Skill 解析)
|
|
146
|
+
openmatrix auto task.md --json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 状态配置
|
|
150
|
+
|
|
151
|
+
auto 模式下的状态配置:
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"status": "running",
|
|
155
|
+
"config": {
|
|
156
|
+
"approvalPoints": [],
|
|
157
|
+
"quality": {
|
|
158
|
+
"level": "strict",
|
|
159
|
+
"tdd": true,
|
|
160
|
+
"minCoverage": 80,
|
|
161
|
+
"strictLint": true,
|
|
162
|
+
"securityScan": true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## 执行流程图
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
┌─────────────────┐
|
|
172
|
+
│ /om:auto │
|
|
173
|
+
│ 解析参数 │
|
|
174
|
+
└────────┬────────┘
|
|
175
|
+
│
|
|
176
|
+
▼
|
|
177
|
+
┌─────────────────┐
|
|
178
|
+
│ 读取任务内容 │
|
|
179
|
+
│ (文件或描述) │
|
|
180
|
+
└────────┬────────┘
|
|
181
|
+
│
|
|
182
|
+
▼
|
|
183
|
+
┌─────────────────┐
|
|
184
|
+
│ CLI: auto │
|
|
185
|
+
│ --quality=X │
|
|
186
|
+
│ approvalPoints │
|
|
187
|
+
│ = [] │
|
|
188
|
+
└────────┬────────┘
|
|
189
|
+
│
|
|
190
|
+
▼
|
|
191
|
+
┌─────────────────┐
|
|
192
|
+
│ 执行循环 │◀────────────┐
|
|
193
|
+
│ (无阻塞) │ │
|
|
194
|
+
└────────┬────────┘ │
|
|
195
|
+
│ │
|
|
196
|
+
▼ │
|
|
197
|
+
┌───────────┐ │
|
|
198
|
+
│ Agent执行 │ │
|
|
199
|
+
└─────┬─────┘ │
|
|
200
|
+
│ │
|
|
201
|
+
▼ │
|
|
202
|
+
┌───────────┐ │
|
|
203
|
+
│ 自动批准 │ │
|
|
204
|
+
│ (无阻塞) │ │
|
|
205
|
+
└─────┬─────┘ │
|
|
206
|
+
│ │
|
|
207
|
+
▼ │
|
|
208
|
+
┌───────────┐ 否 │
|
|
209
|
+
│ 还有任务? │────────────────┘
|
|
210
|
+
└─────┬─────┘
|
|
211
|
+
│ 是
|
|
212
|
+
▼
|
|
213
|
+
┌─────────────────┐
|
|
214
|
+
│ 展示 Meeting │
|
|
215
|
+
│ (如果有) │
|
|
216
|
+
└─────────────────┘
|
|
217
|
+
```
|
|
218
|
+
</notes>
|