openmatrix 0.2.6 → 0.2.7
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/agents/agent-runner.js +0 -1
- package/dist/cli/commands/analyze.js +8 -7
- package/dist/cli/commands/approve.js +24 -23
- package/dist/cli/commands/brainstorm.d.ts +115 -0
- package/dist/cli/commands/brainstorm.js +358 -255
- package/dist/cli/commands/check.d.ts +25 -0
- package/dist/cli/commands/check.js +69 -44
- package/dist/cli/commands/install-skills.js +4 -4
- package/dist/cli/commands/report.d.ts +23 -0
- package/dist/cli/commands/report.js +1 -0
- package/dist/cli/commands/status.d.ts +8 -0
- package/dist/cli/commands/status.js +19 -18
- package/dist/orchestrator/phase-executor.js +21 -0
- package/dist/orchestrator/upgrade-detector.js +32 -12
- package/dist/storage/file-store.js +6 -3
- package/dist/utils/logger.d.ts +4 -4
- package/package.json +1 -1
- package/skills/auto.md +3 -1
- package/skills/debug.md +451 -425
- package/skills/start.md +40 -2
|
@@ -1,2 +1,27 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import { type UpgradeSuggestion, type ProjectType, type DetectionResult, type UpgradeCategory } from '../../orchestrator/upgrade-detector.js';
|
|
2
3
|
export declare const checkCommand: Command;
|
|
4
|
+
/**
|
|
5
|
+
* 显示项目基本信息
|
|
6
|
+
*/
|
|
7
|
+
export declare function displayProjectInfo(projectName: string, projectType: ProjectType, timestamp: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* 显示检测摘要统计
|
|
10
|
+
*/
|
|
11
|
+
export declare function displaySummary(summary: DetectionResult['summary']): void;
|
|
12
|
+
/**
|
|
13
|
+
* 获取类别标签映射
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCategoryLabels(): Record<UpgradeCategory, string>;
|
|
16
|
+
/**
|
|
17
|
+
* 按优先级分组显示建议
|
|
18
|
+
*/
|
|
19
|
+
export declare function displaySuggestionsByPriority(suggestions: UpgradeSuggestion[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* 显示单个优先级组的建议
|
|
22
|
+
*/
|
|
23
|
+
export declare function displayPriorityGroup(items: UpgradeSuggestion[], label: string, color: (text: string) => string, icon: string, maxDisplay?: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* 显示操作提示
|
|
26
|
+
*/
|
|
27
|
+
export declare function displayHints(): void;
|
|
@@ -37,6 +37,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.checkCommand = void 0;
|
|
40
|
+
exports.displayProjectInfo = displayProjectInfo;
|
|
41
|
+
exports.displaySummary = displaySummary;
|
|
42
|
+
exports.getCategoryLabels = getCategoryLabels;
|
|
43
|
+
exports.displaySuggestionsByPriority = displaySuggestionsByPriority;
|
|
44
|
+
exports.displayPriorityGroup = displayPriorityGroup;
|
|
45
|
+
exports.displayHints = displayHints;
|
|
40
46
|
// src/cli/commands/check.ts
|
|
41
47
|
const commander_1 = require("commander");
|
|
42
48
|
const upgrade_detector_js_1 = require("../../orchestrator/upgrade-detector.js");
|
|
@@ -117,13 +123,43 @@ exports.checkCommand = new commander_1.Command('check')
|
|
|
117
123
|
*/
|
|
118
124
|
function displayResult(result) {
|
|
119
125
|
const { projectType, projectName, suggestions, summary } = result;
|
|
126
|
+
displayProjectInfo(projectName, projectType, result.timestamp);
|
|
127
|
+
displaySummary(summary);
|
|
128
|
+
if (suggestions.length === 0) {
|
|
129
|
+
console.log(chalk_1.default.green('✅ 未发现问题,项目状态良好!\n'));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
displaySuggestionsByPriority(suggestions);
|
|
133
|
+
displayHints();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* 显示项目基本信息
|
|
137
|
+
*/
|
|
138
|
+
function displayProjectInfo(projectName, projectType, timestamp) {
|
|
120
139
|
console.log(chalk_1.default.bold(`📦 项目: ${projectName}`));
|
|
121
140
|
console.log(` 类型: ${formatProjectType(projectType)}`);
|
|
122
|
-
console.log(` 扫描时间: ${new Date(
|
|
123
|
-
|
|
141
|
+
console.log(` 扫描时间: ${new Date(timestamp).toLocaleString()}\n`);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 显示检测摘要统计
|
|
145
|
+
*/
|
|
146
|
+
function displaySummary(summary) {
|
|
124
147
|
console.log(chalk_1.default.bold('📊 检测摘要'));
|
|
125
148
|
console.log('━'.repeat(42));
|
|
126
|
-
const categoryLabels =
|
|
149
|
+
const categoryLabels = getCategoryLabels();
|
|
150
|
+
for (const [cat, count] of Object.entries(summary.byCategory)) {
|
|
151
|
+
if (count > 0) {
|
|
152
|
+
console.log(` ${categoryLabels[cat]}: ${chalk_1.default.yellow(count)}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
console.log(`\n 总计: ${chalk_1.default.bold(summary.total)} 个建议`);
|
|
156
|
+
console.log(` 可自动修复: ${chalk_1.default.green(summary.autoFixable)} 个\n`);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 获取类别标签映射
|
|
160
|
+
*/
|
|
161
|
+
function getCategoryLabels() {
|
|
162
|
+
return {
|
|
127
163
|
bug: '🐛 代码缺陷',
|
|
128
164
|
quality: '🔧 代码质量',
|
|
129
165
|
capability: '📦 缺失能力',
|
|
@@ -135,53 +171,42 @@ function displayResult(result) {
|
|
|
135
171
|
skill: '⚡ Skill 问题',
|
|
136
172
|
agent: '🧠 Agent 配置'
|
|
137
173
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
console.log(`\n 总计: ${chalk_1.default.bold(summary.total)} 个建议`);
|
|
144
|
-
console.log(` 可自动修复: ${chalk_1.default.green(summary.autoFixable)} 个\n`);
|
|
145
|
-
if (suggestions.length === 0) {
|
|
146
|
-
console.log(chalk_1.default.green('✅ 未发现问题,项目状态良好!\n'));
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
// 详细建议
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 按优先级分组显示建议
|
|
177
|
+
*/
|
|
178
|
+
function displaySuggestionsByPriority(suggestions) {
|
|
150
179
|
console.log(chalk_1.default.bold('📋 改进建议'));
|
|
151
180
|
console.log('━'.repeat(42) + '\n');
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
181
|
+
const groups = [
|
|
182
|
+
{ items: suggestions.filter(s => s.priority === 'critical'), label: '关键问题', color: chalk_1.default.red.bold, icon: '🚨' },
|
|
183
|
+
{ items: suggestions.filter(s => s.priority === 'high'), label: '高优先级', color: chalk_1.default.yellow.bold, icon: '⚠️' },
|
|
184
|
+
{ items: suggestions.filter(s => s.priority === 'medium'), label: '中优先级', color: chalk_1.default.blue.bold, icon: '📋' },
|
|
185
|
+
{ items: suggestions.filter(s => s.priority === 'low'), label: '低优先级', color: chalk_1.default.gray.bold, icon: '💡', maxDisplay: 10 },
|
|
186
|
+
];
|
|
187
|
+
for (const group of groups) {
|
|
188
|
+
if (group.items.length > 0) {
|
|
189
|
+
displayPriorityGroup(group.items, group.label, group.color, group.icon, group.maxDisplay);
|
|
161
190
|
}
|
|
162
191
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 显示单个优先级组的建议
|
|
195
|
+
*/
|
|
196
|
+
function displayPriorityGroup(items, label, color, icon, maxDisplay) {
|
|
197
|
+
const displayItems = maxDisplay ? items.slice(0, maxDisplay) : items;
|
|
198
|
+
console.log(color(`${icon} ${label}:\n`));
|
|
199
|
+
for (const s of displayItems) {
|
|
200
|
+
displaySuggestion(s);
|
|
168
201
|
}
|
|
169
|
-
if (
|
|
170
|
-
console.log(chalk_1.default.
|
|
171
|
-
for (const s of medium) {
|
|
172
|
-
displaySuggestion(s);
|
|
173
|
-
}
|
|
202
|
+
if (maxDisplay && items.length > maxDisplay) {
|
|
203
|
+
console.log(chalk_1.default.gray(` ... 还有 ${items.length - maxDisplay} 个低优先级建议\n`));
|
|
174
204
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (low.length > 10) {
|
|
181
|
-
console.log(chalk_1.default.gray(` ... 还有 ${low.length - 10} 个低优先级建议\n`));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// 提示
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 显示操作提示
|
|
208
|
+
*/
|
|
209
|
+
function displayHints() {
|
|
185
210
|
console.log(chalk_1.default.gray('━'.repeat(42)));
|
|
186
211
|
console.log(chalk_1.default.gray('💡 提示:'));
|
|
187
212
|
console.log(chalk_1.default.gray(' --interactive 交互式选择改进项'));
|
|
@@ -62,7 +62,7 @@ exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
|
62
62
|
}
|
|
63
63
|
catch (err) {
|
|
64
64
|
console.error('❌ Cannot create directory:', commandsDir);
|
|
65
|
-
console.error(' Error:', err.message);
|
|
65
|
+
console.error(' Error:', err instanceof Error ? err.message : String(err));
|
|
66
66
|
process.exit(1);
|
|
67
67
|
}
|
|
68
68
|
// Get skill files (excluding om.md and openmatrix.md which are handled separately)
|
|
@@ -92,7 +92,7 @@ exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
|
92
92
|
installed++;
|
|
93
93
|
}
|
|
94
94
|
catch (err) {
|
|
95
|
-
console.log(` ❌ Failed: ${file} (${err.message})`);
|
|
95
|
+
console.log(` ❌ Failed: ${file} (${err instanceof Error ? err.message : String(err)})`);
|
|
96
96
|
failed++;
|
|
97
97
|
}
|
|
98
98
|
});
|
|
@@ -112,7 +112,7 @@ exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
catch (err) {
|
|
115
|
-
console.log(` ❌ Failed: om.md (${err.message})`);
|
|
115
|
+
console.log(` ❌ Failed: om.md (${err instanceof Error ? err.message : String(err)})`);
|
|
116
116
|
failed++;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -132,7 +132,7 @@ exports.installSkillsCommand = new commander_1.Command('install-skills')
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
catch (err) {
|
|
135
|
-
console.log(` ❌ Failed: openmatrix.md (${err.message})`);
|
|
135
|
+
console.log(` ❌ Failed: openmatrix.md (${err instanceof Error ? err.message : String(err)})`);
|
|
136
136
|
failed++;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -1,2 +1,25 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
+
import type { GlobalState, Task, Approval } from '../../types/index.js';
|
|
2
3
|
export declare const reportCommand: Command;
|
|
4
|
+
export interface TaskStats {
|
|
5
|
+
total: number;
|
|
6
|
+
completed: number;
|
|
7
|
+
failed: number;
|
|
8
|
+
inProgress: number;
|
|
9
|
+
pending: number;
|
|
10
|
+
blocked: number;
|
|
11
|
+
}
|
|
12
|
+
export interface EfficiencyData {
|
|
13
|
+
totalDuration: number;
|
|
14
|
+
agentCalls: number;
|
|
15
|
+
retryCount: number;
|
|
16
|
+
parallelism: number;
|
|
17
|
+
targetParallelism: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ReportOptions {
|
|
20
|
+
format: string;
|
|
21
|
+
output?: string;
|
|
22
|
+
efficiency?: boolean;
|
|
23
|
+
graph?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function generateMarkdownReport(state: GlobalState, tasks: Task[], approvals: Approval[], stats: TaskStats, efficiency: EfficiencyData, options: ReportOptions): string;
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.reportCommand = void 0;
|
|
37
|
+
exports.generateMarkdownReport = generateMarkdownReport;
|
|
37
38
|
// src/cli/commands/report.ts
|
|
38
39
|
const commander_1 = require("commander");
|
|
39
40
|
const state_manager_js_1 = require("../../storage/state-manager.js");
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
export declare const statusCommand: Command;
|
|
3
|
+
/**
|
|
4
|
+
* 格式化状态显示
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatStatus(status: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* 获取状态颜色函数
|
|
9
|
+
*/
|
|
10
|
+
export declare function getStatusColor(status: string): (text: string) => string;
|
|
@@ -37,6 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.statusCommand = void 0;
|
|
40
|
+
exports.formatStatus = formatStatus;
|
|
41
|
+
exports.getStatusColor = getStatusColor;
|
|
40
42
|
const commander_1 = require("commander");
|
|
41
43
|
const state_manager_js_1 = require("../../storage/state-manager.js");
|
|
42
44
|
const progress_reporter_js_1 = require("../../utils/progress-reporter.js");
|
|
@@ -197,29 +199,28 @@ async function runWatchMode(manager, reporter, options) {
|
|
|
197
199
|
* 格式化状态显示
|
|
198
200
|
*/
|
|
199
201
|
function formatStatus(status) {
|
|
200
|
-
const
|
|
201
|
-
initialized:
|
|
202
|
-
running:
|
|
203
|
-
paused:
|
|
204
|
-
completed:
|
|
205
|
-
failed:
|
|
202
|
+
const colorMap = {
|
|
203
|
+
initialized: chalk_1.default.gray,
|
|
204
|
+
running: chalk_1.default.green,
|
|
205
|
+
paused: chalk_1.default.yellow,
|
|
206
|
+
completed: chalk_1.default.green,
|
|
207
|
+
failed: chalk_1.default.red
|
|
206
208
|
};
|
|
207
|
-
const
|
|
208
|
-
return
|
|
209
|
+
const colorFn = colorMap[status] || chalk_1.default.white;
|
|
210
|
+
return colorFn(status);
|
|
209
211
|
}
|
|
210
212
|
/**
|
|
211
213
|
* 获取状态颜色函数
|
|
212
214
|
*/
|
|
213
215
|
function getStatusColor(status) {
|
|
214
|
-
const
|
|
215
|
-
completed:
|
|
216
|
-
in_progress:
|
|
217
|
-
failed:
|
|
218
|
-
blocked:
|
|
219
|
-
pending:
|
|
220
|
-
verify:
|
|
221
|
-
accept:
|
|
216
|
+
const colorMap = {
|
|
217
|
+
completed: chalk_1.default.green,
|
|
218
|
+
in_progress: chalk_1.default.blue,
|
|
219
|
+
failed: chalk_1.default.red,
|
|
220
|
+
blocked: chalk_1.default.red,
|
|
221
|
+
pending: chalk_1.default.gray,
|
|
222
|
+
verify: chalk_1.default.yellow,
|
|
223
|
+
accept: chalk_1.default.cyan
|
|
222
224
|
};
|
|
223
|
-
|
|
224
|
-
return chalk_1.default[color];
|
|
225
|
+
return colorMap[status] || chalk_1.default.white;
|
|
225
226
|
}
|
|
@@ -251,6 +251,12 @@ ${task.acceptanceCriteria?.map((c, i) => `${i + 1}. ${c}`).join('\n') || '根据
|
|
|
251
251
|
## 验证
|
|
252
252
|
运行 \`npm test\` 确认测试失败 (这是正确的!)
|
|
253
253
|
|
|
254
|
+
## ⚠️ Git 提交规范
|
|
255
|
+
|
|
256
|
+
**禁止执行 \`git commit\`**
|
|
257
|
+
|
|
258
|
+
所有代码提交必须通过 \`openmatrix complete\` 命令统一执行。测试文件创建完成后,只需返回结果摘要,**不要执行 git commit**。
|
|
259
|
+
|
|
254
260
|
## 输出格式
|
|
255
261
|
\`\`\`
|
|
256
262
|
TDD_TESTS_CREATED
|
|
@@ -379,6 +385,17 @@ ${task.acceptanceCriteria.map((c, i) => `${i + 1}. [ ] ${c}`).join('\n')}`);
|
|
|
379
385
|
- [ ] 代码风格一致
|
|
380
386
|
- [ ] 验收标准全部满足
|
|
381
387
|
${isTDDMode ? '- [ ] 所有测试通过 (GREEN)' : ''}
|
|
388
|
+
|
|
389
|
+
## ⚠️ Git 提交规范
|
|
390
|
+
|
|
391
|
+
**禁止执行 \`git commit\`**
|
|
392
|
+
|
|
393
|
+
所有代码提交必须通过 \`openmatrix complete\` 命令统一执行,该命令会:
|
|
394
|
+
1. 使用正确的任务标题 (当前任务: ${task.title})
|
|
395
|
+
2. 自动生成规范的提交信息
|
|
396
|
+
3. 避免产生重复或无意义的提交
|
|
397
|
+
|
|
398
|
+
如果代码变更已完成,只需返回结果摘要,**不要执行 git commit**。
|
|
382
399
|
`);
|
|
383
400
|
return parts.join('\n');
|
|
384
401
|
}
|
|
@@ -659,6 +676,7 @@ Fix Required:
|
|
|
659
676
|
- **不要伪造通过结果**
|
|
660
677
|
- 如果项目没有某个脚本,标记为 "⏭️ Skipped" 而非 "❌ Failed"
|
|
661
678
|
- 所有检查结果必须基于实际命令输出
|
|
679
|
+
- **禁止执行 \`git commit\`** — 所有提交统一通过 \`openmatrix complete\` 执行
|
|
662
680
|
|
|
663
681
|
## 🔧 配置检查 (可选但推荐)
|
|
664
682
|
检查以下常见配置问题:
|
|
@@ -792,6 +810,9 @@ ACCEPT_FAILED
|
|
|
792
810
|
失败原因:
|
|
793
811
|
1. [原因]
|
|
794
812
|
\`\`\`
|
|
813
|
+
|
|
814
|
+
## ⚠️ Git 提交规范
|
|
815
|
+
**禁止执行 \`git commit\`** — 所有提交统一通过 \`openmatrix complete\` 执行,确保使用正确的任务标题。
|
|
795
816
|
`);
|
|
796
817
|
return parts.join('\n');
|
|
797
818
|
}
|
|
@@ -37,6 +37,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.UpgradeDetector = exports.DEFAULT_DETECTOR_CONFIG = void 0;
|
|
38
38
|
const fs = __importStar(require("fs/promises"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
+
/**
|
|
41
|
+
* 已知的绝对路径前缀模式,用于检测代码中的硬编码路径
|
|
42
|
+
* 涵盖 Windows 盘符 (C:\, D:\ 等)、Unix 家目录 (/home/, /Users/) 和常见系统路径
|
|
43
|
+
*/
|
|
44
|
+
const HARDCODED_PATH_PATTERNS = [
|
|
45
|
+
/[A-Za-z]:\\/, // Windows 盘符路径 (C:\, D:\ 等)
|
|
46
|
+
/\/home\/[a-zA-Z_]/, // Linux 家目录
|
|
47
|
+
/\/Users\/[a-zA-Z_]/, // macOS 家目录
|
|
48
|
+
/\/var\/[a-zA-Z_]/, // Linux 系统路径
|
|
49
|
+
/\/etc\//, // Unix 配置路径
|
|
50
|
+
/\/tmp\//, // Unix 临时路径
|
|
51
|
+
/\/opt\//, // Unix 可选软件路径
|
|
52
|
+
/\\Users\\[a-zA-Z_]/, // Windows 风格的 macOS 路径引用
|
|
53
|
+
];
|
|
40
54
|
/**
|
|
41
55
|
* 默认配置
|
|
42
56
|
*/
|
|
@@ -301,7 +315,7 @@ class UpgradeDetector {
|
|
|
301
315
|
const content = await fs.readFile(file, 'utf-8');
|
|
302
316
|
const lines = content.split('\n');
|
|
303
317
|
lines.forEach((line, index) => {
|
|
304
|
-
//
|
|
318
|
+
// 待办标记检测
|
|
305
319
|
const todoMatch = line.match(/\/\/\s*TODO(?:\(([^)]+)\))?:?\s*(.+)/i);
|
|
306
320
|
if (todoMatch) {
|
|
307
321
|
suggestions.push(this.createSuggestion({
|
|
@@ -316,7 +330,7 @@ class UpgradeDetector {
|
|
|
316
330
|
effort: 'small'
|
|
317
331
|
}));
|
|
318
332
|
}
|
|
319
|
-
//
|
|
333
|
+
// 待修复标记检测
|
|
320
334
|
const fixmeMatch = line.match(/\/\/\s*FIXME(?:\(([^)]+)\))?:?\s*(.+)/i);
|
|
321
335
|
if (fixmeMatch) {
|
|
322
336
|
suggestions.push(this.createSuggestion({
|
|
@@ -331,18 +345,21 @@ class UpgradeDetector {
|
|
|
331
345
|
effort: 'medium'
|
|
332
346
|
}));
|
|
333
347
|
}
|
|
334
|
-
//
|
|
335
|
-
const hackMatch = line.match(/\/\/\s*HACK
|
|
348
|
+
// 临时方案标记检测
|
|
349
|
+
const hackMatch = line.match(/\/\/\s*HACK(?:\(([^)]+)\))?:?\s*(.+)/i);
|
|
336
350
|
if (hackMatch) {
|
|
351
|
+
const hackPriority = hackMatch[1] === 'critical' ? 'critical'
|
|
352
|
+
: hackMatch[1] === 'high' ? 'high'
|
|
353
|
+
: 'medium';
|
|
337
354
|
suggestions.push(this.createSuggestion({
|
|
338
355
|
category: 'bug',
|
|
339
|
-
priority:
|
|
340
|
-
title: `临时方案: ${hackMatch[
|
|
341
|
-
description: `发现 HACK
|
|
356
|
+
priority: hackPriority,
|
|
357
|
+
title: `临时方案: ${hackMatch[2]}`,
|
|
358
|
+
description: `发现 HACK 标记,表示使用了临时解决方案: ${hackMatch[2]}`,
|
|
342
359
|
location: { file: this.getRelativePath(file), line: index + 1 },
|
|
343
|
-
suggestion:
|
|
360
|
+
suggestion: `将临时方案替换为正式实现: ${hackMatch[2]}`,
|
|
344
361
|
autoFixable: false,
|
|
345
|
-
impact: '
|
|
362
|
+
impact: '技术债务累积,可能影响长期可维护性',
|
|
346
363
|
effort: 'medium'
|
|
347
364
|
}));
|
|
348
365
|
}
|
|
@@ -407,8 +424,8 @@ class UpgradeDetector {
|
|
|
407
424
|
}));
|
|
408
425
|
}
|
|
409
426
|
}
|
|
410
|
-
// console.log 检测 (
|
|
411
|
-
if (line.includes('console.log') && !file.includes('test') && !file.includes('spec')) {
|
|
427
|
+
// console.log 检测 (生产代码,排除 CLI 命令文件)
|
|
428
|
+
if (line.includes('console.log') && !file.includes('test') && !file.includes('spec') && !file.includes('commands/')) {
|
|
412
429
|
suggestions.push(this.createSuggestion({
|
|
413
430
|
category: 'quality',
|
|
414
431
|
priority: 'low',
|
|
@@ -683,7 +700,10 @@ class UpgradeDetector {
|
|
|
683
700
|
// 检测硬编码字符串
|
|
684
701
|
lines.forEach((line, index) => {
|
|
685
702
|
// 硬编码路径
|
|
686
|
-
if (
|
|
703
|
+
if (HARDCODED_PATH_PATTERNS.some(pattern => pattern.test(line))) {
|
|
704
|
+
const relPath = this.getRelativePath(file);
|
|
705
|
+
if (relPath.includes('upgrade-detector'))
|
|
706
|
+
return;
|
|
687
707
|
if (!line.includes('example') && !line.includes('test')) {
|
|
688
708
|
suggestions.push(this.createSuggestion({
|
|
689
709
|
category: 'common',
|
|
@@ -48,7 +48,8 @@ class FileStore {
|
|
|
48
48
|
}
|
|
49
49
|
catch (error) {
|
|
50
50
|
// 只隐藏"文件不存在"错误,其他错误(权限、磁盘等)抛出以便调用者处理
|
|
51
|
-
|
|
51
|
+
const nodeError = error;
|
|
52
|
+
if (nodeError.code === 'ENOENT' || nodeError.code === 'EISDIR') {
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
54
55
|
throw error;
|
|
@@ -64,7 +65,8 @@ class FileStore {
|
|
|
64
65
|
return await (0, promises_1.readFile)(fullPath, 'utf-8');
|
|
65
66
|
}
|
|
66
67
|
catch (error) {
|
|
67
|
-
|
|
68
|
+
const nodeError = error;
|
|
69
|
+
if (nodeError.code === 'ENOENT' || nodeError.code === 'EISDIR') {
|
|
68
70
|
return null;
|
|
69
71
|
}
|
|
70
72
|
throw error;
|
|
@@ -126,7 +128,8 @@ class FileStore {
|
|
|
126
128
|
return JSON.parse(content);
|
|
127
129
|
}
|
|
128
130
|
catch (error) {
|
|
129
|
-
|
|
131
|
+
const nodeError = error;
|
|
132
|
+
if (nodeError.code === 'ENOENT' || nodeError.code === 'EISDIR') {
|
|
130
133
|
return null;
|
|
131
134
|
}
|
|
132
135
|
throw error;
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -42,10 +42,10 @@ export declare function initLoggerWithRunId(runId: string, omPath?: string): voi
|
|
|
42
42
|
* 便捷方法: 直接记录日志
|
|
43
43
|
*/
|
|
44
44
|
export declare const logger: {
|
|
45
|
-
info: (message: string, meta?:
|
|
46
|
-
error: (message: string, meta?:
|
|
47
|
-
warn: (message: string, meta?:
|
|
48
|
-
debug: (message: string, meta?:
|
|
45
|
+
info: (message: string, meta?: Record<string, unknown>) => winston.Logger;
|
|
46
|
+
error: (message: string, meta?: Record<string, unknown>) => winston.Logger;
|
|
47
|
+
warn: (message: string, meta?: Record<string, unknown>) => winston.Logger;
|
|
48
|
+
debug: (message: string, meta?: Record<string, unknown>) => winston.Logger;
|
|
49
49
|
structured: {
|
|
50
50
|
info: (operation: string, message: string, meta?: Record<string, unknown>, omPath?: string) => void;
|
|
51
51
|
error: (operation: string, message: string, meta?: Record<string, unknown>, omPath?: string) => void;
|
package/package.json
CHANGED
package/skills/auto.md
CHANGED
|
@@ -173,7 +173,7 @@ openmatrix step --json # 获取下一个任务 + 检查是
|
|
|
173
173
|
Agent({
|
|
174
174
|
subagent_type: task.subagent_type,
|
|
175
175
|
description: task.description,
|
|
176
|
-
prompt: task.prompt + "\n\n⚠️ 完成后请输出简短摘要(不超过3行):\n1. 关键决策\n2. 创建/修改的文件\n3.
|
|
176
|
+
prompt: task.prompt + "\n\n⚠️ 完成后请输出简短摘要(不超过3行):\n1. 关键决策\n2. 创建/修改的文件\n3. 对后续任务的建议\n\n🚫 **禁止执行 git commit** — 所有提交统一通过 openmatrix complete 执行,确保使用正确的任务标题。",
|
|
177
177
|
isolation: task.isolation,
|
|
178
178
|
run_in_background: true
|
|
179
179
|
})
|
|
@@ -182,6 +182,8 @@ Agent({
|
|
|
182
182
|
> ⚠️ **必须使用原生 Agent 工具** — 禁止调用 gsd-executor、superpowers 或任何其他编排技能。
|
|
183
183
|
>
|
|
184
184
|
> **上下文节省**: 使用 `run_in_background: true` 后台执行,Agent 完成后仅返回简短摘要,大幅节省主会话上下文。
|
|
185
|
+
>
|
|
186
|
+
> 🚫 **Agent 内部禁止 git commit** — 所有提交必须通过 `openmatrix complete` 执行,否则会产生无意义提交。
|
|
185
187
|
|
|
186
188
|
每个 Agent 完成后:
|
|
187
189
|
1. **保存 Agent 上下文** — 将执行结果摘要写入 `.openmatrix/tasks/TASK-XXX/context.md`,格式如下:
|