openmatrix 0.1.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.
- package/README.md +512 -0
- package/dist/agents/agent-runner.d.ts +152 -0
- package/dist/agents/agent-runner.js +656 -0
- package/dist/agents/base-agent.d.ts +46 -0
- package/dist/agents/base-agent.js +17 -0
- package/dist/agents/impl/coder-agent.d.ts +17 -0
- package/dist/agents/impl/coder-agent.js +96 -0
- package/dist/agents/impl/executor-agent.d.ts +32 -0
- package/dist/agents/impl/executor-agent.js +168 -0
- package/dist/agents/impl/index.d.ts +6 -0
- package/dist/agents/impl/index.js +17 -0
- package/dist/agents/impl/planner-agent.d.ts +24 -0
- package/dist/agents/impl/planner-agent.js +126 -0
- package/dist/agents/impl/researcher-agent.d.ts +17 -0
- package/dist/agents/impl/researcher-agent.js +133 -0
- package/dist/agents/impl/reviewer-agent.d.ts +17 -0
- package/dist/agents/impl/reviewer-agent.js +120 -0
- package/dist/agents/impl/tester-agent.d.ts +17 -0
- package/dist/agents/impl/tester-agent.js +110 -0
- package/dist/cli/commands/approve.d.ts +2 -0
- package/dist/cli/commands/approve.js +87 -0
- package/dist/cli/commands/meeting.d.ts +2 -0
- package/dist/cli/commands/meeting.js +245 -0
- package/dist/cli/commands/report.d.ts +2 -0
- package/dist/cli/commands/report.js +202 -0
- package/dist/cli/commands/resume.d.ts +2 -0
- package/dist/cli/commands/resume.js +104 -0
- package/dist/cli/commands/retry.d.ts +2 -0
- package/dist/cli/commands/retry.js +79 -0
- package/dist/cli/commands/start.d.ts +2 -0
- package/dist/cli/commands/start.js +252 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +226 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/dist/orchestrator/ai-reviewer.d.ts +50 -0
- package/dist/orchestrator/ai-reviewer.js +326 -0
- package/dist/orchestrator/approval-manager.d.ts +62 -0
- package/dist/orchestrator/approval-manager.js +160 -0
- package/dist/orchestrator/executor.d.ts +114 -0
- package/dist/orchestrator/executor.js +325 -0
- package/dist/orchestrator/full-test-runner.d.ts +122 -0
- package/dist/orchestrator/full-test-runner.js +335 -0
- package/dist/orchestrator/git-commit-manager.d.ts +75 -0
- package/dist/orchestrator/git-commit-manager.js +248 -0
- package/dist/orchestrator/interactive-question-generator.d.ts +90 -0
- package/dist/orchestrator/interactive-question-generator.js +312 -0
- package/dist/orchestrator/meeting-manager.d.ts +85 -0
- package/dist/orchestrator/meeting-manager.js +222 -0
- package/dist/orchestrator/phase-executor.d.ts +198 -0
- package/dist/orchestrator/phase-executor.js +796 -0
- package/dist/orchestrator/question-generator.d.ts +22 -0
- package/dist/orchestrator/question-generator.js +102 -0
- package/dist/orchestrator/retry-manager.d.ts +41 -0
- package/dist/orchestrator/retry-manager.js +83 -0
- package/dist/orchestrator/scheduler.d.ts +62 -0
- package/dist/orchestrator/scheduler.js +148 -0
- package/dist/orchestrator/state-machine.d.ts +53 -0
- package/dist/orchestrator/state-machine.js +124 -0
- package/dist/orchestrator/task-parser.d.ts +7 -0
- package/dist/orchestrator/task-parser.js +63 -0
- package/dist/orchestrator/task-planner.d.ts +71 -0
- package/dist/orchestrator/task-planner.js +316 -0
- package/dist/storage/file-store.d.ts +12 -0
- package/dist/storage/file-store.js +80 -0
- package/dist/storage/state-manager.d.ts +31 -0
- package/dist/storage/state-manager.js +202 -0
- package/dist/types/index.d.ts +193 -0
- package/dist/types/index.js +30 -0
- package/dist/utils/logger.d.ts +41 -0
- package/dist/utils/logger.js +166 -0
- package/dist/utils/progress-reporter.d.ts +116 -0
- package/dist/utils/progress-reporter.js +287 -0
- package/package.json +50 -0
- package/scripts/build-check.js +19 -0
- package/scripts/install-skills.js +51 -0
- package/skills/approve.md +253 -0
- package/skills/meeting.md +346 -0
- package/skills/report.md +100 -0
- package/skills/resume.md +68 -0
- package/skills/retry.md +61 -0
- package/skills/start.md +449 -0
- package/skills/status.md +46 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Task, TaskStatus } from '../types/index.js';
|
|
2
|
+
export interface ProgressOptions {
|
|
3
|
+
width?: number;
|
|
4
|
+
showEta?: boolean;
|
|
5
|
+
showCount?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface TaskNode {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
status: TaskStatus;
|
|
11
|
+
dependencies: string[];
|
|
12
|
+
level: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ProgressReporter - 进度可视化工具
|
|
16
|
+
*
|
|
17
|
+
* 提供:
|
|
18
|
+
* 1. 进度条渲染
|
|
19
|
+
* 2. 依赖图 ASCII 渲染
|
|
20
|
+
* 3. 状态图标
|
|
21
|
+
* 4. ETA 计算
|
|
22
|
+
*/
|
|
23
|
+
export declare class ProgressReporter {
|
|
24
|
+
private width;
|
|
25
|
+
private showEta;
|
|
26
|
+
private showCount;
|
|
27
|
+
constructor(options?: ProgressOptions);
|
|
28
|
+
/**
|
|
29
|
+
* 渲染进度条
|
|
30
|
+
*/
|
|
31
|
+
renderProgressBar(completed: number, total: number, label?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* 渲染空进度
|
|
34
|
+
*/
|
|
35
|
+
private renderEmptyProgress;
|
|
36
|
+
/**
|
|
37
|
+
* 获取状态图标
|
|
38
|
+
*/
|
|
39
|
+
getStatusIcon(status: TaskStatus): string;
|
|
40
|
+
/**
|
|
41
|
+
* 渲染任务依赖图
|
|
42
|
+
*/
|
|
43
|
+
renderDependencyGraph(tasks: Task[]): string;
|
|
44
|
+
/**
|
|
45
|
+
* 构建任务节点
|
|
46
|
+
*/
|
|
47
|
+
private buildTaskNodes;
|
|
48
|
+
/**
|
|
49
|
+
* 计算任务层级
|
|
50
|
+
*/
|
|
51
|
+
private calculateLevel;
|
|
52
|
+
/**
|
|
53
|
+
* 渲染单个节点
|
|
54
|
+
*/
|
|
55
|
+
private renderNode;
|
|
56
|
+
/**
|
|
57
|
+
* 渲染任务卡片
|
|
58
|
+
*/
|
|
59
|
+
renderTaskCard(task: Task): string;
|
|
60
|
+
/**
|
|
61
|
+
* 渲染统计摘要
|
|
62
|
+
*/
|
|
63
|
+
renderStatistics(stats: {
|
|
64
|
+
total: number;
|
|
65
|
+
completed: number;
|
|
66
|
+
inProgress: number;
|
|
67
|
+
pending: number;
|
|
68
|
+
failed: number;
|
|
69
|
+
}): string;
|
|
70
|
+
/**
|
|
71
|
+
* 渲染失败建议
|
|
72
|
+
*/
|
|
73
|
+
renderFailureSuggestion(task: Task): string;
|
|
74
|
+
/**
|
|
75
|
+
* 渲染效率分析
|
|
76
|
+
*/
|
|
77
|
+
renderEfficiencyAnalysis(stats: {
|
|
78
|
+
totalDuration: number;
|
|
79
|
+
agentCalls: number;
|
|
80
|
+
retryCount: number;
|
|
81
|
+
parallelism: number;
|
|
82
|
+
targetParallelism: number;
|
|
83
|
+
}): string;
|
|
84
|
+
/**
|
|
85
|
+
* 获取状态文本
|
|
86
|
+
*/
|
|
87
|
+
private getStatusText;
|
|
88
|
+
/**
|
|
89
|
+
* 截断标题
|
|
90
|
+
*/
|
|
91
|
+
private truncateTitle;
|
|
92
|
+
/**
|
|
93
|
+
* 填充右侧空格
|
|
94
|
+
*/
|
|
95
|
+
private padRight;
|
|
96
|
+
/**
|
|
97
|
+
* 渲染完整执行报告
|
|
98
|
+
*/
|
|
99
|
+
renderFullReport(options: {
|
|
100
|
+
tasks: Task[];
|
|
101
|
+
statistics: {
|
|
102
|
+
total: number;
|
|
103
|
+
completed: number;
|
|
104
|
+
inProgress: number;
|
|
105
|
+
pending: number;
|
|
106
|
+
failed: number;
|
|
107
|
+
};
|
|
108
|
+
efficiency: {
|
|
109
|
+
totalDuration: number;
|
|
110
|
+
agentCalls: number;
|
|
111
|
+
retryCount: number;
|
|
112
|
+
parallelism: number;
|
|
113
|
+
targetParallelism: number;
|
|
114
|
+
};
|
|
115
|
+
}): string;
|
|
116
|
+
}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressReporter = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ProgressReporter - 进度可视化工具
|
|
6
|
+
*
|
|
7
|
+
* 提供:
|
|
8
|
+
* 1. 进度条渲染
|
|
9
|
+
* 2. 依赖图 ASCII 渲染
|
|
10
|
+
* 3. 状态图标
|
|
11
|
+
* 4. ETA 计算
|
|
12
|
+
*/
|
|
13
|
+
class ProgressReporter {
|
|
14
|
+
width;
|
|
15
|
+
showEta;
|
|
16
|
+
showCount;
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this.width = options.width || 40;
|
|
19
|
+
this.showEta = options.showEta ?? true;
|
|
20
|
+
this.showCount = options.showCount ?? true;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 渲染进度条
|
|
24
|
+
*/
|
|
25
|
+
renderProgressBar(completed, total, label) {
|
|
26
|
+
if (total === 0) {
|
|
27
|
+
return this.renderEmptyProgress(label);
|
|
28
|
+
}
|
|
29
|
+
const percentage = Math.round((completed / total) * 100);
|
|
30
|
+
const filledWidth = Math.round((completed / total) * this.width);
|
|
31
|
+
const emptyWidth = this.width - filledWidth;
|
|
32
|
+
const filled = '━'.repeat(filledWidth);
|
|
33
|
+
const empty = '─'.repeat(emptyWidth);
|
|
34
|
+
const lines = [];
|
|
35
|
+
if (label) {
|
|
36
|
+
lines.push(`\n📋 ${label}`);
|
|
37
|
+
}
|
|
38
|
+
lines.push(`${filled}${empty} ${percentage}%`);
|
|
39
|
+
if (this.showCount) {
|
|
40
|
+
lines.push(`${completed}/${total} 完成`);
|
|
41
|
+
}
|
|
42
|
+
return lines.join('\n');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 渲染空进度
|
|
46
|
+
*/
|
|
47
|
+
renderEmptyProgress(label) {
|
|
48
|
+
const lines = [];
|
|
49
|
+
if (label) {
|
|
50
|
+
lines.push(`\n📋 ${label}`);
|
|
51
|
+
}
|
|
52
|
+
lines.push('─'.repeat(this.width) + ' 0%');
|
|
53
|
+
lines.push('无任务');
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 获取状态图标
|
|
58
|
+
*/
|
|
59
|
+
getStatusIcon(status) {
|
|
60
|
+
const icons = {
|
|
61
|
+
pending: '⏳',
|
|
62
|
+
scheduled: '📅',
|
|
63
|
+
in_progress: '🔄',
|
|
64
|
+
blocked: '🔴',
|
|
65
|
+
waiting: '⏸️',
|
|
66
|
+
verify: '🔍',
|
|
67
|
+
accept: '✅',
|
|
68
|
+
completed: '✅',
|
|
69
|
+
failed: '❌',
|
|
70
|
+
retry_queue: '🔁'
|
|
71
|
+
};
|
|
72
|
+
return icons[status] || '❓';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 渲染任务依赖图
|
|
76
|
+
*/
|
|
77
|
+
renderDependencyGraph(tasks) {
|
|
78
|
+
if (tasks.length === 0) {
|
|
79
|
+
return '无任务';
|
|
80
|
+
}
|
|
81
|
+
// 构建任务树
|
|
82
|
+
const nodes = this.buildTaskNodes(tasks);
|
|
83
|
+
const lines = [];
|
|
84
|
+
// 找出根节点 (无依赖的任务)
|
|
85
|
+
const rootNodes = nodes.filter(n => n.dependencies.length === 0);
|
|
86
|
+
// 递归渲染
|
|
87
|
+
for (const rootNode of rootNodes) {
|
|
88
|
+
this.renderNode(rootNode, nodes, lines, '', true);
|
|
89
|
+
}
|
|
90
|
+
return lines.join('\n');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 构建任务节点
|
|
94
|
+
*/
|
|
95
|
+
buildTaskNodes(tasks) {
|
|
96
|
+
const taskMap = new Map(tasks.map(t => [t.id, t]));
|
|
97
|
+
return tasks.map(task => ({
|
|
98
|
+
id: task.id,
|
|
99
|
+
title: this.truncateTitle(task.title, 20),
|
|
100
|
+
status: task.status,
|
|
101
|
+
dependencies: task.dependencies,
|
|
102
|
+
level: this.calculateLevel(task, taskMap)
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 计算任务层级
|
|
107
|
+
*/
|
|
108
|
+
calculateLevel(task, taskMap) {
|
|
109
|
+
if (task.dependencies.length === 0)
|
|
110
|
+
return 0;
|
|
111
|
+
const depLevels = task.dependencies
|
|
112
|
+
.map(depId => {
|
|
113
|
+
const depTask = taskMap.get(depId);
|
|
114
|
+
return depTask ? this.calculateLevel(depTask, taskMap) : 0;
|
|
115
|
+
});
|
|
116
|
+
return Math.max(...depLevels) + 1;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* 渲染单个节点
|
|
120
|
+
*/
|
|
121
|
+
renderNode(node, allNodes, lines, prefix, isLast) {
|
|
122
|
+
const icon = this.getStatusIcon(node.status);
|
|
123
|
+
const connector = isLast ? '└─' : '├─';
|
|
124
|
+
const line = `${prefix}${connector} ${icon} ${node.title}`;
|
|
125
|
+
lines.push(line);
|
|
126
|
+
// 找出依赖此任务的子节点
|
|
127
|
+
const children = allNodes.filter(n => n.dependencies.includes(node.id));
|
|
128
|
+
for (let i = 0; i < children.length; i++) {
|
|
129
|
+
const child = children[i];
|
|
130
|
+
const childIsLast = i === children.length - 1;
|
|
131
|
+
const childPrefix = prefix + (isLast ? ' ' : '│ ');
|
|
132
|
+
this.renderNode(child, allNodes, lines, childPrefix, childIsLast);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 渲染任务卡片
|
|
137
|
+
*/
|
|
138
|
+
renderTaskCard(task) {
|
|
139
|
+
const icon = this.getStatusIcon(task.status);
|
|
140
|
+
const lines = [];
|
|
141
|
+
lines.push(`┌─────────────────────────────────────┐`);
|
|
142
|
+
lines.push(`│ ${icon} ${this.padRight(task.title, 33)} │`);
|
|
143
|
+
lines.push(`├─────────────────────────────────────┤`);
|
|
144
|
+
lines.push(`│ ID: ${this.padRight(task.id, 31)} │`);
|
|
145
|
+
lines.push(`│ 状态: ${this.padRight(this.getStatusText(task.status), 29)} │`);
|
|
146
|
+
lines.push(`│ 优先级: ${this.padRight(task.priority, 28)} │`);
|
|
147
|
+
lines.push(`│ Agent: ${this.padRight(task.assignedAgent, 28)} │`);
|
|
148
|
+
if (task.error) {
|
|
149
|
+
lines.push(`├─────────────────────────────────────┤`);
|
|
150
|
+
lines.push(`│ ❌ 错误: ${this.padRight(this.truncateTitle(task.error, 26), 26)} │`);
|
|
151
|
+
}
|
|
152
|
+
lines.push(`└─────────────────────────────────────┘`);
|
|
153
|
+
return lines.join('\n');
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 渲染统计摘要
|
|
157
|
+
*/
|
|
158
|
+
renderStatistics(stats) {
|
|
159
|
+
const lines = [];
|
|
160
|
+
const percentage = stats.total > 0
|
|
161
|
+
? Math.round((stats.completed / stats.total) * 100)
|
|
162
|
+
: 0;
|
|
163
|
+
lines.push('');
|
|
164
|
+
lines.push('📊 任务统计');
|
|
165
|
+
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
166
|
+
lines.push(this.renderProgressBar(stats.completed, stats.total));
|
|
167
|
+
lines.push('');
|
|
168
|
+
lines.push(` ✅ 完成: ${stats.completed}`);
|
|
169
|
+
lines.push(` 🔄 进行中: ${stats.inProgress}`);
|
|
170
|
+
lines.push(` ⏳ 待处理: ${stats.pending}`);
|
|
171
|
+
lines.push(` ❌ 失败: ${stats.failed}`);
|
|
172
|
+
lines.push('');
|
|
173
|
+
return lines.join('\n');
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 渲染失败建议
|
|
177
|
+
*/
|
|
178
|
+
renderFailureSuggestion(task) {
|
|
179
|
+
const lines = [];
|
|
180
|
+
lines.push('');
|
|
181
|
+
lines.push(`❌ ${task.id} 执行失败`);
|
|
182
|
+
lines.push('');
|
|
183
|
+
lines.push(`原因: ${task.error || '未知错误'}`);
|
|
184
|
+
lines.push('');
|
|
185
|
+
lines.push('建议:');
|
|
186
|
+
lines.push(`[1] 增加超时时间 (当前: ${task.timeout / 1000}s)`);
|
|
187
|
+
lines.push('[2] 拆分为更小的子任务');
|
|
188
|
+
lines.push('[3] 检查依赖是否正确');
|
|
189
|
+
lines.push('[4] 跳过此任务');
|
|
190
|
+
lines.push('');
|
|
191
|
+
return lines.join('\n');
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 渲染效率分析
|
|
195
|
+
*/
|
|
196
|
+
renderEfficiencyAnalysis(stats) {
|
|
197
|
+
const lines = [];
|
|
198
|
+
lines.push('');
|
|
199
|
+
lines.push('🏆 效率分析');
|
|
200
|
+
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
201
|
+
// 耗时
|
|
202
|
+
const hours = Math.floor(stats.totalDuration / 3600000);
|
|
203
|
+
const minutes = Math.floor((stats.totalDuration % 3600000) / 60000);
|
|
204
|
+
lines.push(` 总耗时: ${hours}h ${minutes}m`);
|
|
205
|
+
// Agent 调用
|
|
206
|
+
lines.push(` Agent 调用: ${stats.agentCalls} 次`);
|
|
207
|
+
// 重试次数
|
|
208
|
+
lines.push(` 重试次数: ${stats.retryCount} 次`);
|
|
209
|
+
// 并行度
|
|
210
|
+
const parallelismPercentage = Math.round((stats.parallelism / stats.targetParallelism) * 100);
|
|
211
|
+
lines.push(` 并行度: ${stats.parallelism.toFixed(1)} / ${stats.targetParallelism} (${parallelismPercentage}%)`);
|
|
212
|
+
// 优化建议
|
|
213
|
+
if (parallelismPercentage < 80) {
|
|
214
|
+
const potentialImprovement = Math.round((1 - stats.parallelism / stats.targetParallelism) * 100);
|
|
215
|
+
lines.push(` 💡 建议: 增加并发数可提升 ${potentialImprovement}% 效率`);
|
|
216
|
+
}
|
|
217
|
+
lines.push('');
|
|
218
|
+
return lines.join('\n');
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 获取状态文本
|
|
222
|
+
*/
|
|
223
|
+
getStatusText(status) {
|
|
224
|
+
const texts = {
|
|
225
|
+
pending: '待处理',
|
|
226
|
+
scheduled: '已调度',
|
|
227
|
+
in_progress: '进行中',
|
|
228
|
+
blocked: '已阻塞',
|
|
229
|
+
waiting: '等待中',
|
|
230
|
+
verify: '验证中',
|
|
231
|
+
accept: '验收中',
|
|
232
|
+
completed: '已完成',
|
|
233
|
+
failed: '已失败',
|
|
234
|
+
retry_queue: '重试队列'
|
|
235
|
+
};
|
|
236
|
+
return texts[status] || status;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 截断标题
|
|
240
|
+
*/
|
|
241
|
+
truncateTitle(title, maxLength) {
|
|
242
|
+
if (title.length <= maxLength)
|
|
243
|
+
return title;
|
|
244
|
+
return title.slice(0, maxLength - 3) + '...';
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* 填充右侧空格
|
|
248
|
+
*/
|
|
249
|
+
padRight(text, length) {
|
|
250
|
+
if (text.length >= length)
|
|
251
|
+
return text.slice(0, length);
|
|
252
|
+
return text + ' '.repeat(length - text.length);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 渲染完整执行报告
|
|
256
|
+
*/
|
|
257
|
+
renderFullReport(options) {
|
|
258
|
+
const sections = [];
|
|
259
|
+
// 标题
|
|
260
|
+
sections.push('');
|
|
261
|
+
sections.push('📋 执行报告');
|
|
262
|
+
sections.push('━'.repeat(42));
|
|
263
|
+
sections.push('');
|
|
264
|
+
// 进度
|
|
265
|
+
sections.push(this.renderStatistics(options.statistics));
|
|
266
|
+
// 依赖图
|
|
267
|
+
sections.push('');
|
|
268
|
+
sections.push('📊 任务依赖图');
|
|
269
|
+
sections.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
270
|
+
sections.push(this.renderDependencyGraph(options.tasks));
|
|
271
|
+
sections.push('');
|
|
272
|
+
// 效率分析
|
|
273
|
+
sections.push(this.renderEfficiencyAnalysis(options.efficiency));
|
|
274
|
+
// 失败任务
|
|
275
|
+
const failedTasks = options.tasks.filter(t => t.status === 'failed');
|
|
276
|
+
if (failedTasks.length > 0) {
|
|
277
|
+
sections.push('');
|
|
278
|
+
sections.push('❌ 失败任务');
|
|
279
|
+
sections.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
280
|
+
for (const task of failedTasks) {
|
|
281
|
+
sections.push(this.renderFailureSuggestion(task));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return sections.join('\n');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.ProgressReporter = ProgressReporter;
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openmatrix",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI Agent task orchestration system with Claude Code Skills integration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"openmatrix": "dist/cli/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"skills",
|
|
13
|
+
"scripts",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsx src/cli/index.ts",
|
|
19
|
+
"test": "vitest"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"claude",
|
|
23
|
+
"claude-code",
|
|
24
|
+
"ai-agent",
|
|
25
|
+
"task-orchestration",
|
|
26
|
+
"automation",
|
|
27
|
+
"multi-agent"
|
|
28
|
+
],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"type": "commonjs",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/bigfish1913/openmatrix"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
|
+
"chokidar": "^5.0.0",
|
|
40
|
+
"commander": "^14.0.3",
|
|
41
|
+
"typescript": "^5.3.3",
|
|
42
|
+
"winston": "^3.19.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"vitest": "^1.6.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=18.0.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Safe build script that checks if dependencies are available
|
|
2
|
+
const { existsSync } = require('fs');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
// Check if we're in a git clone scenario (npm install from github)
|
|
6
|
+
// In this case, node_modules might not be fully populated yet
|
|
7
|
+
const tscPath = require.resolve('typescript').replace('lib/typescript.js', 'bin/tsc');
|
|
8
|
+
|
|
9
|
+
if (!existsSync(tscPath)) {
|
|
10
|
+
console.log('Skipping build: TypeScript not available yet');
|
|
11
|
+
process.exit(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
execSync(`node "${tscPath}"`, { stdio: 'inherit' });
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.log('Build failed, but continuing installation');
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
// Change to home directory to avoid cwd issues
|
|
8
|
+
process.chdir(os.homedir());
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
// Get the package skills directory - use the path relative to this script
|
|
12
|
+
const scriptDir = __dirname;
|
|
13
|
+
const skillsDir = path.join(scriptDir, '..', 'skills');
|
|
14
|
+
|
|
15
|
+
// Get user's .claude directory
|
|
16
|
+
const claudeDir = path.join(os.homedir(), '.claude');
|
|
17
|
+
const commandsDir = path.join(claudeDir, 'commands', 'om');
|
|
18
|
+
|
|
19
|
+
// Create commands directory if it doesn't exist
|
|
20
|
+
try {
|
|
21
|
+
if (!fs.existsSync(commandsDir)) {
|
|
22
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
} catch (mkdirErr) {
|
|
25
|
+
console.log(`⚠️ Cannot create ${commandsDir}`);
|
|
26
|
+
console.log(` Please run: mkdir -p ${commandsDir}`);
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Copy skill files
|
|
31
|
+
if (fs.existsSync(skillsDir)) {
|
|
32
|
+
const files = fs.readdirSync(skillsDir).filter(f => f.endsWith('.md'));
|
|
33
|
+
|
|
34
|
+
files.forEach(file => {
|
|
35
|
+
const src = path.join(skillsDir, file);
|
|
36
|
+
const dest = path.join(commandsDir, file);
|
|
37
|
+
try {
|
|
38
|
+
fs.copyFileSync(src, dest);
|
|
39
|
+
console.log(`✓ Installed: om:${path.basename(file, '.md')}`);
|
|
40
|
+
} catch (copyErr) {
|
|
41
|
+
console.log(`⚠️ Skipped: om:${path.basename(file, '.md')} (${copyErr.message})`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(`\n✅ OpenMatrix skills installed to ${commandsDir}`);
|
|
46
|
+
} else {
|
|
47
|
+
console.log('Skills directory not found, skipping installation.');
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.log('OpenMatrix skills installation skipped:', err.message);
|
|
51
|
+
}
|