openmatrix 0.2.31 → 0.2.34

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 (48) hide show
  1. package/README.md +154 -154
  2. package/dist/cli/commands/approve.js +35 -1
  3. package/dist/cli/commands/auto.js +2 -2
  4. package/dist/cli/commands/check-gitignore.js +34 -30
  5. package/dist/cli/commands/check.js +1 -1
  6. package/dist/cli/commands/complete.js +35 -7
  7. package/dist/cli/commands/debug.js +2 -1
  8. package/dist/cli/commands/deploy.js +1 -1
  9. package/dist/cli/commands/install-skills.js +3 -0
  10. package/dist/cli/commands/meeting.js +37 -1
  11. package/dist/cli/commands/report.js +1 -1
  12. package/dist/cli/commands/resume.js +35 -1
  13. package/dist/cli/commands/retry.js +130 -56
  14. package/dist/cli/commands/start.js +1 -1
  15. package/dist/cli/commands/status.js +32 -29
  16. package/dist/cli/commands/step.js +4 -1
  17. package/dist/orchestrator/ai-reviewer.d.ts +5 -0
  18. package/dist/orchestrator/ai-reviewer.js +9 -2
  19. package/dist/orchestrator/context-collector.js +17 -5
  20. package/dist/orchestrator/executor.d.ts +8 -0
  21. package/dist/orchestrator/executor.js +24 -5
  22. package/dist/orchestrator/phase-executor.d.ts +4 -0
  23. package/dist/orchestrator/phase-executor.js +21 -4
  24. package/dist/storage/file-store.js +8 -0
  25. package/dist/storage/state-manager.js +52 -19
  26. package/dist/test/generator.js +113 -113
  27. package/dist/utils/error-handler.d.ts +18 -0
  28. package/dist/utils/error-handler.js +32 -0
  29. package/dist/utils/worktree-sync.js +24 -3
  30. package/package.json +61 -61
  31. package/skills/auto.md +410 -413
  32. package/skills/brainstorm.md +19 -12
  33. package/skills/debug.md +694 -691
  34. package/skills/deploy.md +658 -658
  35. package/skills/feature.md +713 -686
  36. package/skills/{SKILL.md → openmatrix-overview.md} +52 -53
  37. package/skills/plan.md +298 -296
  38. package/skills/report.md +9 -5
  39. package/skills/resume.md +292 -287
  40. package/skills/start.md +32 -20
  41. package/skills/status.md +5 -4
  42. package/skills/test.md +875 -875
  43. package/dist/agents/base-agent.d.ts +0 -46
  44. package/dist/agents/base-agent.js +0 -17
  45. package/dist/cli/commands/analyze.d.ts +0 -2
  46. package/dist/cli/commands/analyze.js +0 -50
  47. package/dist/orchestrator/smart-question-analyzer.d.ts +0 -90
  48. package/dist/orchestrator/smart-question-analyzer.js +0 -512
@@ -44,10 +44,13 @@ exports.meetingCommand = new commander_1.Command('meeting')
44
44
  .description('查看和处理待确认的 Meeting')
45
45
  .argument('[meetingId]', 'Meeting ID (可选)')
46
46
  .option('-l, --list', '列出所有待处理 Meeting')
47
+ .option('--create', '创建新 Meeting')
48
+ .option('--task <taskId>', '关联任务 ID (用于 --create)')
49
+ .option('--reason <reason>', '阻塞原因 (用于 --create) 或决策理由 (用于 decide)')
50
+ .option('--severity <severity>', '严重程度: critical/high/medium/low (用于 --create)')
47
51
  .option('--action <action>', '操作类型: provide-info, skip, retry, modify, decide, cancel')
48
52
  .option('--info <info>', '提供的信息 (用于 provide-info)')
49
53
  .option('--message <message>', '备注信息')
50
- .option('--reason <reason>', '决策理由 (用于 decide)')
51
54
  .option('--new-plan <plan>', '新方案 (用于 modify)')
52
55
  .option('--skip-all', '跳过所有 Meeting')
53
56
  .action(async (meetingId, options) => {
@@ -58,6 +61,39 @@ exports.meetingCommand = new commander_1.Command('meeting')
58
61
  const approvalManager = new approval_manager_js_1.ApprovalManager(stateManager);
59
62
  const meetingManager = new meeting_manager_js_1.MeetingManager(stateManager, approvalManager);
60
63
  try {
64
+ // --create: 创建新 Meeting
65
+ if (options.create) {
66
+ if (!options.task) {
67
+ console.log('❌ 请提供 --task 参数指定关联任务');
68
+ return;
69
+ }
70
+ const task = await stateManager.getTask(options.task);
71
+ if (!task) {
72
+ console.log(`❌ 任务 ${options.task} 不存在`);
73
+ return;
74
+ }
75
+ const severity = options.severity || 'medium';
76
+ const reason = options.reason || '未指定原因';
77
+ // 创建阻塞 Meeting(使用 MeetingManager)
78
+ const result = await meetingManager.createBlockingMeeting(options.task, reason, [severity]);
79
+ if (options.json) {
80
+ console.log(JSON.stringify({
81
+ status: 'created',
82
+ meetingId: result.meeting.id,
83
+ approvalId: result.approval.id,
84
+ taskId: options.task,
85
+ severity,
86
+ reason
87
+ }));
88
+ }
89
+ else {
90
+ console.log(`✅ Meeting 已创建: ${result.meeting.id}`);
91
+ console.log(` 关联任务: ${options.task}`);
92
+ console.log(` 严重程度: ${severity}`);
93
+ console.log(` 阻塞原因: ${reason}`);
94
+ }
95
+ return;
96
+ }
61
97
  // 获取所有 pending 的 meeting approvals
62
98
  const pendingApprovals = await stateManager.getApprovalsByStatus('pending');
63
99
  const meetingApprovals = pendingApprovals.filter(a => a.type === 'meeting');
@@ -49,7 +49,7 @@ exports.reportCommand = new commander_1.Command('report')
49
49
  .option('--graph', '包含依赖图')
50
50
  .action(async (options) => {
51
51
  const basePath = process.cwd();
52
- const omPath = `${basePath}/.openmatrix`;
52
+ const omPath = path.join(basePath, '.openmatrix');
53
53
  const stateManager = new state_manager_js_1.StateManager(omPath);
54
54
  await stateManager.initialize();
55
55
  const state = await stateManager.getState();
@@ -1,9 +1,43 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.resumeCommand = void 0;
4
37
  // src/cli/commands/resume.ts
5
38
  const commander_1 = require("commander");
6
39
  const state_manager_js_1 = require("../../storage/state-manager.js");
40
+ const path = __importStar(require("path"));
7
41
  exports.resumeCommand = new commander_1.Command('resume')
8
42
  .description('恢复中断或暂停的任务')
9
43
  .argument('[taskId]', '任务ID')
@@ -11,7 +45,7 @@ exports.resumeCommand = new commander_1.Command('resume')
11
45
  .option('--json', '输出 JSON 格式 (供 Skill 解析)')
12
46
  .action(async (taskId, options) => {
13
47
  const basePath = process.cwd();
14
- const omPath = `${basePath}/.openmatrix`;
48
+ const omPath = path.join(basePath, '.openmatrix');
15
49
  const stateManager = new state_manager_js_1.StateManager(omPath);
16
50
  await stateManager.initialize();
17
51
  const state = await stateManager.getState();
@@ -1,80 +1,154 @@
1
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  exports.retryCommand = void 0;
4
40
  // src/cli/commands/retry.ts
5
41
  const commander_1 = require("commander");
6
42
  const state_manager_js_1 = require("../../storage/state-manager.js");
7
- const retry_manager_js_1 = require("../../orchestrator/retry-manager.js");
43
+ const chalk_1 = __importDefault(require("chalk"));
44
+ const path = __importStar(require("path"));
8
45
  exports.retryCommand = new commander_1.Command('retry')
9
46
  .description('重试失败的任务')
10
- .argument('[taskId]', '任务ID')
11
- .option('--all', '重试所有失败任务')
12
- .option('--reset', '重置重试计数')
13
- .option('--json', '输出 JSON 格式 (供 Skill 解析)')
47
+ .argument('[taskId]', '任务ID (如 TASK-001)')
48
+ .option('--all', '重试所有失败任务', false)
49
+ .option('--reset', '重置重试计数', false)
50
+ .option('--json', '输出 JSON 格式')
14
51
  .action(async (taskId, options) => {
15
52
  const basePath = process.cwd();
16
- const omPath = `${basePath}/.openmatrix`;
53
+ const omPath = path.join(basePath, '.openmatrix');
17
54
  const stateManager = new state_manager_js_1.StateManager(omPath);
18
55
  await stateManager.initialize();
19
- const retryManager = new retry_manager_js_1.RetryManager({
20
- maxRetries: 3,
21
- backoff: 'exponential',
22
- baseDelay: 10000
23
- });
24
- // 如果没有提供任务ID,列出失败任务
25
- if (!taskId && !options.all) {
26
- const tasks = await stateManager.listTasks();
27
- const failed = tasks.filter(t => t.status === 'failed');
28
- if (failed.length === 0) {
29
- console.log('✅ 没有失败的任务');
56
+ const state = await stateManager.getState();
57
+ // 获取失败任务列表
58
+ const allTasks = await stateManager.listTasks();
59
+ const failedTasks = allTasks.filter(t => t.status === 'failed');
60
+ if (failedTasks.length === 0) {
61
+ if (options.json) {
62
+ console.log(JSON.stringify({ status: 'no_failed_tasks', message: '没有失败任务' }));
63
+ }
64
+ else {
65
+ console.log(chalk_1.default.green('✅ 没有失败任务需要重试'));
66
+ }
67
+ return;
68
+ }
69
+ // 如果指定了 taskId
70
+ if (taskId) {
71
+ const task = failedTasks.find(t => t.id === taskId);
72
+ if (!task) {
73
+ if (options.json) {
74
+ console.log(JSON.stringify({ status: 'error', message: `任务 ${taskId} 不是失败状态` }));
75
+ }
76
+ else {
77
+ console.log(chalk_1.default.red(`❌ 任务 ${taskId} 不是失败状态`));
78
+ }
30
79
  return;
31
80
  }
32
- console.log('❌ 失败任务列表:\n');
33
- failed.forEach((task, i) => {
34
- console.log(` [${i + 1}] ${task.id}: ${task.title}`);
35
- console.log(` 失败原因: ${task.error || '未知'}`);
36
- console.log(` 重试次数: ${task.retryCount}/3`);
37
- console.log(` 失败时间: ${task.updatedAt}`);
38
- });
39
- console.log('\n💡 使用 openmatrix retry <ID> 重试指定任务');
40
- console.log(' 使用 openmatrix retry --all 重试所有任务');
81
+ await retryTask(stateManager, task, options.reset);
82
+ if (options.json) {
83
+ console.log(JSON.stringify({ status: 'success', taskId, reset: options.reset }));
84
+ }
85
+ else {
86
+ console.log(chalk_1.default.green(`✅ 任务 ${taskId} 已加入重试队列`));
87
+ }
41
88
  return;
42
89
  }
43
- // 重试任务
90
+ // 如果 --all
44
91
  if (options.all) {
45
- const tasks = await stateManager.listTasks();
46
- const failed = tasks.filter(t => t.status === 'failed');
47
- console.log(`🔄 重试 ${failed.length} 个失败任务...\n`);
48
- for (const task of failed) {
49
- await retryTask(stateManager, retryManager, task.id, options.reset);
50
- console.log(` ✅ ${task.id}: ${task.title}`);
92
+ for (const task of failedTasks) {
93
+ await retryTask(stateManager, task, options.reset);
51
94
  }
52
- }
53
- else if (taskId) {
54
- const task = await stateManager.getTask(taskId);
55
- if (!task) {
56
- console.log(`❌ 任务 ${taskId} 不存在`);
57
- return;
95
+ if (options.json) {
96
+ console.log(JSON.stringify({
97
+ status: 'success',
98
+ retriedCount: failedTasks.length,
99
+ tasks: failedTasks.map(t => t.id)
100
+ }));
58
101
  }
59
- if (task.status !== 'failed') {
60
- console.log(`❌ 任务 ${taskId} 状态不是失败`);
61
- return;
102
+ else {
103
+ console.log(chalk_1.default.green(`✅ 已重试 ${failedTasks.length} 个失败任务`));
104
+ }
105
+ return;
106
+ }
107
+ // 没有参数,显示失败任务列表
108
+ if (options.json) {
109
+ console.log(JSON.stringify({
110
+ status: 'failed_tasks',
111
+ tasks: failedTasks.map(t => ({
112
+ id: t.id,
113
+ title: t.title,
114
+ error: t.error,
115
+ retryCount: t.retryCount
116
+ }))
117
+ }));
118
+ }
119
+ else {
120
+ console.log(chalk_1.default.bold.red('\n❌ 失败任务列表\n'));
121
+ for (let i = 0; i < failedTasks.length; i++) {
122
+ const task = failedTasks[i];
123
+ const retryInfo = `重试次数: ${task.retryCount}/${state.config.maxRetries || 3}`;
124
+ console.log(`[${i + 1}] ${chalk_1.default.yellow(task.id)}: ${task.title}`);
125
+ console.log(` 失败原因: ${task.error || '未知'}`);
126
+ console.log(` ${retryInfo}`);
127
+ console.log();
62
128
  }
63
- console.log(`🔄 重试任务 ${taskId}...\n`);
64
- await retryTask(stateManager, retryManager, taskId, options.reset);
65
- console.log(` ✅ ${task.title}`);
129
+ console.log(chalk_1.default.gray('提示: 使用 retry <taskId> 重试指定任务'));
130
+ console.log(chalk_1.default.gray('提示: 使用 retry --all 重试所有失败任务'));
131
+ console.log(chalk_1.default.gray('提示: 使用 retry --reset 重试并重置计数'));
66
132
  }
67
- console.log('\n💡 使用 /om:resume 继续执行');
68
133
  });
69
- async function retryTask(stateManager, retryManager, taskId, reset) {
70
- const task = await stateManager.getTask(taskId);
71
- if (!task)
72
- return;
73
- const newRetryCount = reset ? 0 : task.retryCount + 1;
74
- await stateManager.updateTask(taskId, {
75
- status: 'pending',
76
- retryCount: newRetryCount,
77
- error: null
134
+ /**
135
+ * 重试单个任务
136
+ */
137
+ async function retryTask(stateManager, task, reset) {
138
+ const updates = {
139
+ status: 'pending'
140
+ };
141
+ if (reset) {
142
+ updates.retryCount = 0;
143
+ }
144
+ await stateManager.updateTask(task.id, updates);
145
+ // 更新全局统计
146
+ const state = await stateManager.getState();
147
+ await stateManager.updateState({
148
+ statistics: {
149
+ ...state.statistics,
150
+ failed: state.statistics.failed - 1,
151
+ pending: state.statistics.pending + 1
152
+ }
78
153
  });
79
- retryManager.addToQueue(taskId, 'manual retry');
80
154
  }
@@ -59,7 +59,7 @@ exports.startCommand = new commander_1.Command('start')
59
59
  .option('--docs <level>', '文档级别 (full|basic|minimal|none)')
60
60
  .option('--tasks-json <json>', 'AI 已拆分的任务 JSON (跳过自动解析)')
61
61
  .option('--e2e-tests', '启用 E2E 测试')
62
- .option('--e2e-type <type>', 'E2E 测试类型 (web|visual)')
62
+ .option('--e2e-type <type>', 'E2E 测试类型 (functional|visual)')
63
63
  .option('--research-context <path>', '研究上下文 JSON 路径 (来自 /om:research 的 context.json)')
64
64
  .option('--parallel', '多 Agent 并行执行 (推荐,速度快)')
65
65
  .option('--single-agent', '单 Agent 串行执行 (上下文连贯)')
@@ -45,14 +45,17 @@ const progress_reporter_js_1 = require("../../utils/progress-reporter.js");
45
45
  const chalk_1 = __importDefault(require("chalk"));
46
46
  const chokidar = __importStar(require("chokidar"));
47
47
  const readline = __importStar(require("readline"));
48
+ const path = __importStar(require("path"));
48
49
  exports.statusCommand = new commander_1.Command('status')
49
- .description('Show current execution status')
50
- .option('--json', 'Output as JSON')
51
- .option('--graph', 'Show dependency graph')
52
- .option('--detailed', 'Show detailed task info')
53
- .option('--watch', 'Watch for status changes in real-time')
50
+ .description('显示当前执行状态')
51
+ .option('--json', '输出 JSON 格式')
52
+ .option('--graph', '显示依赖关系图')
53
+ .option('--detailed', '显示详细任务信息')
54
+ .option('--watch', '实时监控状态变化')
54
55
  .action(async (options) => {
55
- const manager = new state_manager_js_1.StateManager('.openmatrix');
56
+ const basePath = process.cwd();
57
+ const omPath = path.join(basePath, '.openmatrix');
58
+ const manager = new state_manager_js_1.StateManager(omPath);
56
59
  const reporter = new progress_reporter_js_1.ProgressReporter({ width: 30 });
57
60
  if (options.watch) {
58
61
  await runWatchMode(manager, reporter, options);
@@ -86,12 +89,12 @@ async function showStatus(manager, reporter, options) {
86
89
  return;
87
90
  }
88
91
  // Header
89
- console.log(chalk_1.default.bold('\n📊 OpenMatrix Status'));
92
+ console.log(chalk_1.default.bold('\n📊 OpenMatrix 状态'));
90
93
  console.log('━'.repeat(42));
91
94
  console.log(`\n Run ID: ${chalk_1.default.cyan(state.runId)}`);
92
- console.log(` Status: ${formatStatus(state.status)}`);
93
- console.log(` Phase: ${chalk_1.default.yellow(state.currentPhase)}`);
94
- console.log(` Started: ${state.startedAt}\n`);
95
+ console.log(` 状态: ${formatStatus(state.status)}`);
96
+ console.log(` 阶段: ${chalk_1.default.yellow(state.currentPhase)}`);
97
+ console.log(` 开始时间: ${state.startedAt}\n`);
95
98
  // Progress visualization
96
99
  if (state.statistics.totalTasks > 0) {
97
100
  console.log(reporter.renderStatistics({
@@ -104,14 +107,14 @@ async function showStatus(manager, reporter, options) {
104
107
  }
105
108
  // Dependency graph
106
109
  if (options.graph && tasks.length > 0) {
107
- console.log('\n📊 Task Dependency Graph');
110
+ console.log('\n📊 任务依赖关系图');
108
111
  console.log('━'.repeat(42));
109
112
  console.log(reporter.renderDependencyGraph(tasks));
110
113
  console.log();
111
114
  }
112
115
  // Detailed task list
113
116
  if (options.detailed && tasks.length > 0) {
114
- console.log('\n📋 Task Details');
117
+ console.log('\n📋 任务详情');
115
118
  console.log('━'.repeat(42));
116
119
  for (const task of tasks) {
117
120
  console.log(reporter.renderTaskCard(task));
@@ -120,7 +123,7 @@ async function showStatus(manager, reporter, options) {
120
123
  }
121
124
  else if (tasks.length > 0) {
122
125
  // Simple task list
123
- console.log(chalk_1.default.bold('\n📋 Tasks'));
126
+ console.log(chalk_1.default.bold('\n📋 任务列表'));
124
127
  for (const task of tasks) {
125
128
  const icon = reporter.getStatusIcon(task.status);
126
129
  console.log(` ${icon} ${task.id}: ${task.title}`);
@@ -128,15 +131,15 @@ async function showStatus(manager, reporter, options) {
128
131
  console.log();
129
132
  }
130
133
  // Quick tips
131
- console.log(chalk_1.default.gray('💡 Tips:'));
132
- console.log(chalk_1.default.gray(' --watch Real-time status updates'));
133
- console.log(chalk_1.default.gray(' --graph Show dependency graph'));
134
- console.log(chalk_1.default.gray(' --detailed Show detailed task info'));
135
- console.log(chalk_1.default.gray(' --json Output as JSON'));
134
+ console.log(chalk_1.default.gray('💡 提示:'));
135
+ console.log(chalk_1.default.gray(' --watch 实时状态更新'));
136
+ console.log(chalk_1.default.gray(' --graph 显示依赖关系图'));
137
+ console.log(chalk_1.default.gray(' --detailed 显示详细任务信息'));
138
+ console.log(chalk_1.default.gray(' --json 输出 JSON 格式'));
136
139
  console.log();
137
140
  }
138
141
  catch (error) {
139
- console.error(chalk_1.default.red('Error:'), error);
142
+ console.error(chalk_1.default.red('错误:'), error);
140
143
  }
141
144
  }
142
145
  /**
@@ -151,24 +154,24 @@ async function runWatchMode(manager, reporter, options) {
151
154
  // 渲染状态
152
155
  const renderStatus = async () => {
153
156
  clearScreen();
154
- console.log(chalk_1.default.bold.cyan('📊 OpenMatrix Watch Mode'));
157
+ console.log(chalk_1.default.bold.cyan('📊 OpenMatrix 实时监控'));
155
158
  console.log(chalk_1.default.gray('━'.repeat(42)));
156
- console.log(chalk_1.default.gray('Press Ctrl+C to exit\n'));
159
+ console.log(chalk_1.default.gray(' Ctrl+C 退出\n'));
157
160
  try {
158
161
  const state = await manager.getState();
159
162
  const tasks = await manager.listTasks();
160
163
  // 状态概览
161
164
  console.log(`Run ID: ${chalk_1.default.cyan(state.runId)}`);
162
- console.log(`Status: ${formatStatus(state.status)}`);
163
- console.log(`Phase: ${chalk_1.default.yellow(state.currentPhase)}`);
164
- console.log(`Updated: ${chalk_1.default.gray(new Date().toLocaleTimeString())}\n`);
165
+ console.log(`状态: ${formatStatus(state.status)}`);
166
+ console.log(`阶段: ${chalk_1.default.yellow(state.currentPhase)}`);
167
+ console.log(`更新时间: ${chalk_1.default.gray(new Date().toLocaleTimeString())}\n`);
165
168
  // 进度条
166
169
  if (state.statistics.totalTasks > 0) {
167
- console.log(reporter.renderProgressBar(state.statistics.completed, state.statistics.totalTasks, 'Overall Progress'));
170
+ console.log(reporter.renderProgressBar(state.statistics.completed, state.statistics.totalTasks, '总体进度'));
168
171
  }
169
172
  // 任务列表 (带动画图标)
170
173
  if (tasks.length > 0) {
171
- console.log(chalk_1.default.bold('\n📋 Tasks:'));
174
+ console.log(chalk_1.default.bold('\n📋 任务列表:'));
172
175
  for (const task of tasks) {
173
176
  const icon = reporter.getStatusIcon(task.status);
174
177
  const statusColor = getStatusColor(task.status);
@@ -177,10 +180,10 @@ async function runWatchMode(manager, reporter, options) {
177
180
  }
178
181
  // 底部提示
179
182
  console.log(chalk_1.default.gray('\n━'.repeat(42)));
180
- console.log(chalk_1.default.gray('Watching for changes...'));
183
+ console.log(chalk_1.default.gray('正在监听状态变化...'));
181
184
  }
182
185
  catch (error) {
183
- console.error(chalk_1.default.red('Error:'), error);
186
+ console.error(chalk_1.default.red('错误:'), error);
184
187
  }
185
188
  };
186
189
  // 初始渲染
@@ -201,7 +204,7 @@ async function runWatchMode(manager, reporter, options) {
201
204
  });
202
205
  rl.on('close', () => {
203
206
  watcher.close();
204
- console.log(chalk_1.default.gray('\n👋 Watch mode ended'));
207
+ console.log(chalk_1.default.gray('\n👋 监控模式已结束'));
205
208
  process.exit(0);
206
209
  });
207
210
  // 保持进程运行
@@ -107,7 +107,10 @@ exports.stepCommand = new commander_1.Command('step')
107
107
  description: subagentTask.description,
108
108
  prompt: subagentTask.prompt,
109
109
  isolation: subagentTask.isolation,
110
- timeout: subagentTask.timeout
110
+ taskId: subagentTask.taskId,
111
+ agentType: subagentTask.agentType,
112
+ timeout: subagentTask.timeout,
113
+ needsApproval: subagentTask.needsApproval
111
114
  },
112
115
  statistics: {
113
116
  total: stats.totalTasks,
@@ -47,6 +47,11 @@ export interface ReviewFixTask {
47
47
  * 5. 测试覆盖检查
48
48
  */
49
49
  export declare class AIReviewer {
50
+ private runId;
51
+ /**
52
+ * 设置当前运行 ID
53
+ */
54
+ setRunId(runId: string): void;
50
55
  /**
51
56
  * 生成 AI Review 提示词
52
57
  */
@@ -12,6 +12,13 @@ exports.AIReviewer = void 0;
12
12
  * 5. 测试覆盖检查
13
13
  */
14
14
  class AIReviewer {
15
+ runId = '';
16
+ /**
17
+ * 设置当前运行 ID
18
+ */
19
+ setRunId(runId) {
20
+ this.runId = runId;
21
+ }
15
22
  /**
16
23
  * 生成 AI Review 提示词
17
24
  */
@@ -65,7 +72,7 @@ class AIReviewer {
65
72
 
66
73
  ## 输出格式
67
74
 
68
- 在 \`.openmatrix/tasks/${task.id}/artifacts/\` 目录下创建:
75
+ 在 \`.openmatrix/${this.runId}/tasks/${task.id}/artifacts/\` 目录下创建:
69
76
 
70
77
  ### ai-review-report.md
71
78
 
@@ -295,7 +302,7 @@ ${reviewPrompt}
295
302
 
296
303
  ## 输出要求
297
304
 
298
- 在 \`.openmatrix/tasks/${task.id}/artifacts/\` 目录下创建:
305
+ 在 \`.openmatrix/${this.runId}/tasks/${task.id}/artifacts/\` 目录下创建:
299
306
  - \`accept-report.md\` - 验收报告
300
307
  - \`ai-review-report.md\` - AI 审查报告
301
308
 
@@ -37,6 +37,7 @@ exports.ContextCollector = void 0;
37
37
  // src/orchestrator/context-collector.ts
38
38
  const fs = __importStar(require("fs"));
39
39
  const path = __importStar(require("path"));
40
+ const error_handler_js_1 = require("../utils/error-handler.js");
40
41
  /**
41
42
  * 根据问题类型收集上下文信息
42
43
  */
@@ -53,7 +54,9 @@ class ContextCollector {
53
54
  try {
54
55
  context.state = JSON.parse(fs.readFileSync(statePath, 'utf-8'));
55
56
  }
56
- catch { /* ignore */ }
57
+ catch (error) {
58
+ (0, error_handler_js_1.logError)(error, { operation: 'readState', file: statePath });
59
+ }
57
60
  }
58
61
  // 读取任务文件
59
62
  const taskPath = path.join(this.basePath, 'tasks', `${taskId}.json`);
@@ -61,7 +64,9 @@ class ContextCollector {
61
64
  try {
62
65
  context.task = JSON.parse(fs.readFileSync(taskPath, 'utf-8'));
63
66
  }
64
- catch { /* ignore */ }
67
+ catch (error) {
68
+ (0, error_handler_js_1.logError)(error, { operation: 'readTask', file: taskPath });
69
+ }
65
70
  }
66
71
  // 读取日志
67
72
  const logPath = path.join(this.basePath, 'logs');
@@ -75,7 +80,9 @@ class ContextCollector {
75
80
  if (logs)
76
81
  context.logs = logs;
77
82
  }
78
- catch { /* ignore */ }
83
+ catch (error) {
84
+ (0, error_handler_js_1.logError)(error, { operation: 'readLogs', file: logPath });
85
+ }
79
86
  }
80
87
  return context;
81
88
  }
@@ -139,7 +146,9 @@ class ContextCollector {
139
146
  try {
140
147
  context.systemState = JSON.parse(fs.readFileSync(statePath, 'utf-8'));
141
148
  }
142
- catch { /* ignore */ }
149
+ catch (error) {
150
+ (0, error_handler_js_1.logError)(error, { operation: 'readSystemState', file: statePath });
151
+ }
143
152
  }
144
153
  return context;
145
154
  }
@@ -161,7 +170,10 @@ class ContextCollector {
161
170
  }
162
171
  }
163
172
  }
164
- catch { /* ignore */ }
173
+ catch (error) {
174
+ // 目录扫描失败可能是权限问题,记录但不中断
175
+ (0, error_handler_js_1.logError)(error, { operation: 'scanFiles', file: dir });
176
+ }
165
177
  return results;
166
178
  }
167
179
  }
@@ -53,6 +53,10 @@ export declare class OrchestratorExecutor {
53
53
  * 获取 PhaseExecutor 实例
54
54
  */
55
55
  getPhaseExecutor(): PhaseExecutor;
56
+ /**
57
+ * 设置运行 ID(同时更新 PhaseExecutor 和 AIReviewer)
58
+ */
59
+ setRunId(runId: string): void;
56
60
  private loadConfigFromState;
57
61
  /**
58
62
  * 执行一步 - 返回待执行的 Subagent 任务
@@ -145,10 +149,14 @@ export declare class OrchestratorExecutor {
145
149
  getStatus(): Promise<ExecutorStatus>;
146
150
  /**
147
151
  * 获取 AgentRunner 实例
152
+ *
153
+ * 注意:此方法假设 executor 已完成初始化(通过 step() 或其他方法触发)
148
154
  */
149
155
  getAgentRunner(): AgentRunner;
150
156
  /**
151
157
  * 获取 Scheduler 实例
158
+ *
159
+ * 注意:此方法假设 executor 已完成初始化(通过 step() 或其他方法触发)
152
160
  */
153
161
  getScheduler(): Scheduler;
154
162
  /**