openmatrix 0.1.19 → 0.1.21

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 CHANGED
@@ -251,6 +251,7 @@ Accept 阶段由 Reviewer Agent 执行:
251
251
  | 命令 | 用途 |
252
252
  |------|------|
253
253
  | `/om` | **默认入口** - 直接输入任务描述即可启动 |
254
+ | `/om:brainstorm` | 🧠 **头脑风暴** - 先探索需求和设计,再执行任务 |
254
255
  | `/om:start` | 启动新任务 (第一个问题选质量级别) |
255
256
  | `/om:auto` | 🚀 **全自动执行** - 无阻塞、无确认、直接完成 |
256
257
  | `/check` | 🔍 **项目检查** - 自动检测可改进点并提供升级建议 |
@@ -461,6 +462,7 @@ cd openmatrix && npm install && npm run build && npm test
461
462
  - [x] 质量报告
462
463
  - [x] AI 验收
463
464
  - [x] `/om:auto` 全自动模式
465
+ - [x] `/om:brainstorm` 头脑风暴模式
464
466
  - [x] 多语言支持 (Python/Go/Java/TypeScript 等)
465
467
  - [x] E2E 测试支持 (Web/Mobile/GUI)
466
468
  - [ ] VSCode 扩展
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare const brainstormCommand: Command;
@@ -0,0 +1,326 @@
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.brainstormCommand = void 0;
37
+ // src/cli/commands/brainstorm.ts
38
+ const commander_1 = require("commander");
39
+ const state_manager_js_1 = require("../../storage/state-manager.js");
40
+ const gitignore_js_1 = require("../../utils/gitignore.js");
41
+ const fs = __importStar(require("fs/promises"));
42
+ const path = __importStar(require("path"));
43
+ exports.brainstormCommand = new commander_1.Command('brainstorm')
44
+ .description('头脑风暴 - 探索需求和设计后再执行任务')
45
+ .argument('[input]', '任务文件路径或描述')
46
+ .option('--json', '输出 JSON 格式 (供 Skill 解析)')
47
+ .option('--complete', '标记头脑风暴完成,准备执行 start')
48
+ .option('--results <json>', '头脑风暴结果 JSON (从 Skill 传入)')
49
+ .action(async (input, options) => {
50
+ const basePath = process.cwd();
51
+ const omPath = path.join(basePath, '.openmatrix');
52
+ // 确保目录存在
53
+ await fs.mkdir(omPath, { recursive: true });
54
+ await fs.mkdir(path.join(omPath, 'tasks'), { recursive: true });
55
+ await fs.mkdir(path.join(omPath, 'approvals'), { recursive: true });
56
+ await fs.mkdir(path.join(omPath, 'brainstorm'), { recursive: true });
57
+ // 确保 .openmatrix 被 git 忽略
58
+ await (0, gitignore_js_1.ensureOpenmatrixGitignore)(basePath);
59
+ const stateManager = new state_manager_js_1.StateManager(omPath);
60
+ await stateManager.initialize();
61
+ const brainstormPath = path.join(omPath, 'brainstorm', 'session.json');
62
+ // --complete 模式:头脑风暴完成,输出 start 所需信息
63
+ if (options.complete) {
64
+ try {
65
+ const sessionData = await fs.readFile(brainstormPath, 'utf-8');
66
+ const session = JSON.parse(sessionData);
67
+ // 更新状态
68
+ session.status = 'ready_to_start';
69
+ // 如果传入了结果,合并
70
+ if (options.results) {
71
+ try {
72
+ const results = JSON.parse(options.results);
73
+ session.answers = { ...session.answers, ...results.answers };
74
+ session.insights = [...session.insights, ...(results.insights || [])];
75
+ session.designNotes = [...session.designNotes, ...(results.designNotes || [])];
76
+ }
77
+ catch {
78
+ // 忽略解析错误
79
+ }
80
+ }
81
+ await fs.writeFile(brainstormPath, JSON.stringify(session, null, 2));
82
+ if (options.json) {
83
+ console.log(JSON.stringify({
84
+ status: 'ready_to_start',
85
+ message: '头脑风暴完成,准备执行任务',
86
+ taskInput: session.taskInput,
87
+ taskTitle: session.taskTitle,
88
+ answers: session.answers,
89
+ insights: session.insights,
90
+ designNotes: session.designNotes,
91
+ hint: '使用 /om:start 开始执行任务'
92
+ }));
93
+ }
94
+ else {
95
+ console.log('✅ 头脑风暴完成!');
96
+ console.log(` 任务: ${session.taskTitle}`);
97
+ console.log('\n📋 收集的洞察:');
98
+ session.insights.forEach((insight, i) => {
99
+ console.log(` ${i + 1}. ${insight}`);
100
+ });
101
+ console.log('\n📝 设计要点:');
102
+ session.designNotes.forEach((note, i) => {
103
+ console.log(` ${i + 1}. ${note}`);
104
+ });
105
+ console.log('\n🚀 使用 /om:start 开始执行任务');
106
+ }
107
+ return;
108
+ }
109
+ catch {
110
+ if (options.json) {
111
+ console.log(JSON.stringify({
112
+ status: 'error',
113
+ message: '没有进行中的头脑风暴会话'
114
+ }));
115
+ }
116
+ else {
117
+ console.log('❌ 没有进行中的头脑风暴会话');
118
+ console.log(' 使用 openmatrix brainstorm <task> 开始新的头脑风暴');
119
+ }
120
+ return;
121
+ }
122
+ }
123
+ // 获取任务内容
124
+ let taskContent = input;
125
+ if (!taskContent) {
126
+ const defaultPath = path.join(basePath, 'TASK.md');
127
+ try {
128
+ taskContent = await fs.readFile(defaultPath, 'utf-8');
129
+ if (!options.json) {
130
+ console.log(`📄 读取任务文件: ${defaultPath}`);
131
+ }
132
+ }
133
+ catch {
134
+ if (options.json) {
135
+ console.log(JSON.stringify({
136
+ status: 'error',
137
+ message: '请提供任务文件路径或描述'
138
+ }));
139
+ }
140
+ else {
141
+ console.log('❌ 请提供任务文件路径或描述');
142
+ console.log(' 用法: openmatrix brainstorm <task.md>');
143
+ console.log(' 或创建 TASK.md 文件');
144
+ }
145
+ return;
146
+ }
147
+ }
148
+ else if (taskContent.endsWith('.md')) {
149
+ try {
150
+ taskContent = await fs.readFile(taskContent, 'utf-8');
151
+ if (!options.json) {
152
+ console.log(`📄 读取任务文件: ${input}`);
153
+ }
154
+ }
155
+ catch {
156
+ if (options.json) {
157
+ console.log(JSON.stringify({
158
+ status: 'error',
159
+ message: `无法读取文件: ${input}`
160
+ }));
161
+ }
162
+ else {
163
+ console.log(`❌ 无法读取文件: ${input}`);
164
+ }
165
+ return;
166
+ }
167
+ }
168
+ // 从任务内容提取标题
169
+ const lines = taskContent.split('\n');
170
+ let taskTitle = '未命名任务';
171
+ for (const line of lines) {
172
+ const match = line.match(/^#\s+(.+)$/);
173
+ if (match) {
174
+ taskTitle = match[1].trim();
175
+ break;
176
+ }
177
+ }
178
+ // 生成头脑风暴问题
179
+ const questions = generateBrainstormQuestions(taskContent, taskTitle);
180
+ // 创建会话
181
+ const session = {
182
+ status: 'brainstorming',
183
+ taskInput: taskContent,
184
+ taskTitle,
185
+ questions,
186
+ answers: {},
187
+ insights: [],
188
+ designNotes: []
189
+ };
190
+ await fs.writeFile(brainstormPath, JSON.stringify(session, null, 2));
191
+ if (options.json) {
192
+ // JSON 输出供 Skill 解析
193
+ console.log(JSON.stringify({
194
+ status: 'brainstorming',
195
+ message: '开始头脑风暴',
196
+ taskTitle,
197
+ questions: questions.map(q => ({
198
+ id: q.id,
199
+ question: q.question,
200
+ header: q.header,
201
+ options: q.options,
202
+ multiSelect: q.multiSelect
203
+ })),
204
+ hint: '请逐一回答问题,完成后再调用 --complete'
205
+ }));
206
+ }
207
+ else {
208
+ console.log('\n🧠 开始头脑风暴...\n');
209
+ console.log(`📋 任务: ${taskTitle}\n`);
210
+ console.log('需要探索以下问题:');
211
+ questions.forEach((q, i) => {
212
+ console.log(` ${i + 1}. ${q.question}`);
213
+ });
214
+ console.log('\n💡 使用 /om:brainstorm 技能进行交互式问答');
215
+ }
216
+ });
217
+ /**
218
+ * 根据任务内容生成头脑风暴问题
219
+ */
220
+ function generateBrainstormQuestions(taskContent, taskTitle) {
221
+ const questions = [];
222
+ const content = taskContent.toLowerCase();
223
+ // 问题 1: 核心目标
224
+ questions.push({
225
+ id: 'core_objective',
226
+ question: '这个任务的核心目标是什么?想要解决什么问题?',
227
+ header: '核心目标',
228
+ options: [
229
+ { label: '实现新功能', description: '添加新的功能特性,扩展系统能力' },
230
+ { label: '修复问题', description: '修复 Bug 或解决已知问题' },
231
+ { label: '重构优化', description: '改进代码结构、性能或可维护性' },
232
+ { label: '技术探索', description: '探索新技术方案,验证可行性' }
233
+ ],
234
+ multiSelect: false,
235
+ why: '明确核心目标有助于选择正确的实现策略和质量标准'
236
+ });
237
+ // 问题 2: 用户价值
238
+ questions.push({
239
+ id: 'user_value',
240
+ question: '这个任务为用户带来什么价值?最终用户是谁?',
241
+ header: '用户价值',
242
+ options: [
243
+ { label: '开发者', description: '主要用户是开发者,需要清晰的 API 和文档' },
244
+ { label: '终端用户', description: '主要用户是终端用户,需要良好的用户体验' },
245
+ { label: '运维人员', description: '主要用户是运维,需要稳定性和可观测性' },
246
+ { label: '内部团队', description: '主要用户是内部团队,需要高效协作支持' }
247
+ ],
248
+ multiSelect: false,
249
+ why: '了解目标用户有助于设计合适的接口和交互方式'
250
+ });
251
+ // 问题 3: 实现复杂度 - 如果任务内容包含复杂关键词
252
+ if (content.includes('架构') || content.includes('系统') || content.includes('集成') || content.includes('多个')) {
253
+ questions.push({
254
+ id: 'complexity',
255
+ question: '这个任务的实现复杂度如何?需要哪些关键组件?',
256
+ header: '复杂度',
257
+ options: [
258
+ { label: '简单', description: '单一功能,少量代码修改' },
259
+ { label: '中等', description: '需要多个组件协作,有依赖关系' },
260
+ { label: '复杂', description: '涉及架构调整,需要仔细规划' },
261
+ { label: '非常复杂', description: '大型重构或新系统,需要分阶段实施' }
262
+ ],
263
+ multiSelect: false,
264
+ why: '复杂度评估有助于决定是否需要分阶段实施和额外的设计审查'
265
+ });
266
+ }
267
+ // 问题 4: 技术约束 - 如果涉及技术选型
268
+ if (content.includes('技术') || content.includes('框架') || content.includes('库')) {
269
+ questions.push({
270
+ id: 'tech_constraints',
271
+ question: '有哪些技术约束或偏好?需要使用/避免什么技术?',
272
+ header: '技术约束',
273
+ options: [
274
+ { label: '使用现有技术栈', description: '复用项目已有的技术选择' },
275
+ { label: '引入新技术', description: '需要引入新的库或框架' },
276
+ { label: '保持技术中立', description: '不引入新依赖,使用原生方案' },
277
+ { label: '需要技术调研', description: '技术选型不确定,需要先调研' }
278
+ ],
279
+ multiSelect: false,
280
+ why: '技术约束影响实现方案和后续维护成本'
281
+ });
282
+ }
283
+ // 问题 5: 风险评估
284
+ questions.push({
285
+ id: 'risks',
286
+ question: '这个任务可能面临哪些风险或挑战?',
287
+ header: '风险',
288
+ options: [
289
+ { label: '技术风险', description: '技术实现存在不确定性' },
290
+ { label: '时间风险', description: '需要在短时间内完成' },
291
+ { label: '兼容性风险', description: '可能影响现有功能' },
292
+ { label: '无明显风险', description: '任务清晰,风险可控' }
293
+ ],
294
+ multiSelect: true,
295
+ why: '识别风险有助于提前规划应对策略'
296
+ });
297
+ // 问题 6: 验收标准
298
+ questions.push({
299
+ id: 'acceptance',
300
+ question: '如何判断任务完成?有哪些验收标准?',
301
+ header: '验收标准',
302
+ options: [
303
+ { label: '功能完整', description: '所有功能按预期工作' },
304
+ { label: '测试覆盖', description: '有足够的测试覆盖' },
305
+ { label: '性能达标', description: '满足性能要求' },
306
+ { label: '文档完善', description: '有完整的使用文档' }
307
+ ],
308
+ multiSelect: true,
309
+ why: '明确的验收标准有助于判断任务完成度'
310
+ });
311
+ // 问题 7: 实现优先级
312
+ questions.push({
313
+ id: 'priority',
314
+ question: '这个任务的优先级如何?是否需要 MVP 版本?',
315
+ header: '优先级',
316
+ options: [
317
+ { label: '高优先级', description: '需要尽快完成,影响其他工作' },
318
+ { label: '中优先级', description: '计划内任务,按正常节奏推进' },
319
+ { label: '低优先级', description: '可延后处理,有更重要的任务' },
320
+ { label: '需要 MVP', description: '先实现最小可用版本,再迭代' }
321
+ ],
322
+ multiSelect: false,
323
+ why: '优先级决定资源分配和实施策略'
324
+ });
325
+ return questions;
326
+ }
package/dist/cli/index.js CHANGED
@@ -14,6 +14,7 @@ const install_skills_js_1 = require("./commands/install-skills.js");
14
14
  const check_js_1 = require("./commands/check.js");
15
15
  const check_gitignore_js_1 = require("./commands/check-gitignore.js");
16
16
  const analyze_js_1 = require("./commands/analyze.js");
17
+ const brainstorm_js_1 = require("./commands/brainstorm.js");
17
18
  const program = new commander_1.Command();
18
19
  program
19
20
  .name('openmatrix')
@@ -32,5 +33,6 @@ program.addCommand(install_skills_js_1.installSkillsCommand);
32
33
  program.addCommand(check_js_1.checkCommand);
33
34
  program.addCommand(check_gitignore_js_1.checkGitignoreCommand);
34
35
  program.addCommand(analyze_js_1.analyzeCommand);
36
+ program.addCommand(brainstorm_js_1.brainstormCommand);
35
37
  // 默认帮助
36
38
  program.parse();
@@ -445,8 +445,11 @@ npm test -- --coverage 2>/dev/null || npm run test:coverage 2>/dev/null || echo
445
445
 
446
446
  ### 4. Lint 检查
447
447
  \`\`\`bash
448
- npm run lint || echo "No lint script configured"
448
+ # 先检查是否有 lint 脚本
449
+ npm run lint 2>&1 || echo "EXIT_CODE: $?"
449
450
  \`\`\`
451
+ **重要**: 如果 lint 命令返回非零退出码且有 errors,必须报告为 VERIFY_FAILED。
452
+ 如果项目没有 lint 脚本(显示 "missing script"),标记为 ⏭️ Skipped。
450
453
  **要求**: ${qc.strictLint ? '无 error' : '无严重 error'}
451
454
  **失败后果**: ${qc.strictLint ? '❌ VERIFY_FAILED' : '⚠️ 警告'}
452
455
 
@@ -562,6 +565,12 @@ Fix Required:
562
565
  - **不要伪造通过结果**
563
566
  - 如果项目没有某个脚本,标记为 "⏭️ Skipped" 而非 "❌ Failed"
564
567
  - 所有检查结果必须基于实际命令输出
568
+
569
+ ## 🔧 配置检查 (可选但推荐)
570
+ 检查以下常见配置问题:
571
+ - **Vitest 配置**: 如果存在 \`e2e/\` 目录,确保 \`vite.config.ts\` 的 \`test.exclude\` 包含 \`e2e\`
572
+ - **测试框架冲突**: 确保 Vitest 不运行 Playwright/Cypress 测试文件
573
+ - 如果发现配置问题,记录到报告中但不要阻止通过
565
574
  `);
566
575
  return parts.join('\n');
567
576
  }
@@ -805,13 +814,32 @@ ACCEPT_FAILED
805
814
  // 解析构建结果
806
815
  result.build.success = output.includes('VERIFY_PASSED') ||
807
816
  (output.includes('npm run build') && !output.includes('error'));
808
- // 解析 Lint 结果
809
- const lintErrorMatch = output.match(/(\d+)\s*error/i);
810
- if (lintErrorMatch)
811
- result.lint.errors = parseInt(lintErrorMatch[1], 10);
812
- const lintWarnMatch = output.match(/(\d+)\s*warning/i);
813
- if (lintWarnMatch)
814
- result.lint.warnings = parseInt(lintWarnMatch[1], 10);
817
+ // 解析 Lint 结果 - 支持多种 ESLint 输出格式
818
+ // 格式1: "✖ 137 problems (92 errors, 45 warnings)"
819
+ const detailedMatch = output.match(/✖\s*\d+\s*problems?\s*\((\d+)\s*errors?,\s*(\d+)\s*warnings?\)/i);
820
+ if (detailedMatch) {
821
+ result.lint.errors = parseInt(detailedMatch[1], 10);
822
+ result.lint.warnings = parseInt(detailedMatch[2], 10);
823
+ }
824
+ else {
825
+ // 格式2: "X errors" 和 "Y warnings"
826
+ const lintErrorMatch = output.match(/(\d+)\s*error/i);
827
+ if (lintErrorMatch)
828
+ result.lint.errors = parseInt(lintErrorMatch[1], 10);
829
+ const lintWarnMatch = output.match(/(\d+)\s*warning/i);
830
+ if (lintWarnMatch)
831
+ result.lint.warnings = parseInt(lintWarnMatch[1], 10);
832
+ }
833
+ // 检测 Lint 是否实际执行并失败
834
+ // ESLint 退出码非0时,输出中会包含 "✖" 或 "problems"
835
+ const lintFailed = output.includes('✖') && output.includes('problems');
836
+ if (lintFailed && result.lint.errors === 0) {
837
+ // 尝试从问题总数中推断
838
+ const problemsMatch = output.match(/✖\s*(\d+)\s*problems?/i);
839
+ if (problemsMatch) {
840
+ result.lint.errors = parseInt(problemsMatch[1], 10);
841
+ }
842
+ }
815
843
  // 解析安全漏洞
816
844
  const vulnMatch = output.match(/(\d+)\s*(?:vulnerabilities|vulnerable)/i);
817
845
  if (vulnMatch)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
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",
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: om:brainstorm
3
+ description: 头脑风暴 - 探索需求和设计后再执行任务
4
+ ---
5
+
6
+ <NO-OTHER-SKILLS>
7
+ 执行此技能时,不得调用其他任务编排相关的技能。OpenMatrix 独立运行,不依赖外部任务编排系统。
8
+ </NO-OTHER-SKILLS>
9
+
10
+ <objective>
11
+ 在进行任务执行前,先进行头脑风暴,深入探索需求、设计和技术方案,确保理解完整后再开始执行。
12
+ </objective>
13
+
14
+ <process>
15
+ 1. **初始化头脑风暴会话**
16
+
17
+ 调用 CLI 创建头脑风暴会话:
18
+ ```bash
19
+ openmatrix brainstorm --json
20
+ ```
21
+
22
+ 这会返回:
23
+ ```json
24
+ {
25
+ "status": "brainstorming",
26
+ "message": "开始头脑风暴",
27
+ "taskTitle": "任务标题",
28
+ "questions": [
29
+ {
30
+ "id": "core_objective",
31
+ "question": "这个任务的核心目标是什么?",
32
+ "header": "核心目标",
33
+ "options": [...],
34
+ "multiSelect": false
35
+ }
36
+ ],
37
+ "hint": "请逐一回答问题,完成后再调用 --complete"
38
+ }
39
+ ```
40
+
41
+ 2. **交互式问答**
42
+
43
+ 对每个问题使用 `AskUserQuestion` 进行提问:
44
+
45
+ ```typescript
46
+ AskUserQuestion({
47
+ questions: [{
48
+ question: questions[0].question,
49
+ header: questions[0].header,
50
+ options: questions[0].options,
51
+ multiSelect: questions[0].multiSelect
52
+ }]
53
+ })
54
+ ```
55
+
56
+ **收集回答并记录洞察**:
57
+ - 每个回答后,思考其含义
58
+ - 记录可能的设计决策
59
+ - 识别潜在风险
60
+
61
+ 3. **深入追问** (可选)
62
+
63
+ 如果用户选择了"其他"或回答不够清晰,进行追问:
64
+ ```typescript
65
+ AskUserQuestion({
66
+ questions: [{
67
+ question: "请详细描述:",
68
+ header: "详情",
69
+ options: []
70
+ }]
71
+ })
72
+ ```
73
+
74
+ 4. **总结头脑风暴结果**
75
+
76
+ 所有问题回答完成后,总结:
77
+ - 核心目标
78
+ - 用户价值
79
+ - 技术方案要点
80
+ - 风险和应对
81
+ - 验收标准
82
+
83
+ 展示总结:
84
+ ```
85
+ 🧠 头脑风暴总结
86
+
87
+ 📋 任务: 实现登录功能
88
+
89
+ 🎯 核心目标
90
+ - 实现用户登录功能,支持邮箱和密码
91
+
92
+ 👥 用户价值
93
+ - 终端用户可以安全登录系统
94
+
95
+ 🔧 技术方案
96
+ - 使用 JWT 进行身份验证
97
+ - 密码使用 bcrypt 加密
98
+
99
+ ⚠️ 风险评估
100
+ - 安全风险: 需要防止暴力破解
101
+
102
+ ✅ 验收标准
103
+ - 功能完整
104
+ - 测试覆盖
105
+ ```
106
+
107
+ 5. **确认并开始执行**
108
+
109
+ ```typescript
110
+ AskUserQuestion({
111
+ questions: [{
112
+ question: "头脑风暴完成,是否开始执行任务?",
113
+ header: "下一步",
114
+ options: [
115
+ { label: "✅ 开始执行 (推荐)", description: "使用收集的信息开始执行任务" },
116
+ { label: "🔄 继续探索", description: "还有问题需要进一步讨论" },
117
+ { label: "📋 仅生成计划", description: "生成详细计划但不执行" }
118
+ ],
119
+ multiSelect: false
120
+ }]
121
+ })
122
+ ```
123
+
124
+ 6. **自动执行 start**
125
+
126
+ 如果用户选择"开始执行":
127
+ - 调用 CLI 标记头脑风暴完成:
128
+ ```bash
129
+ openmatrix brainstorm --complete --json
130
+ ```
131
+ - 自动调用 `/om:start` 开始执行任务
132
+ - 将头脑风暴收集的洞察传递给 start
133
+
134
+ </process>
135
+
136
+ <arguments>
137
+ $ARGUMENTS
138
+ </arguments>
139
+
140
+ <examples>
141
+ /om:brainstorm # 交互式头脑风暴
142
+ /om:brainstorm docs/task.md # 基于任务文件头脑风暴
143
+ /om:brainstorm "实现用户登录功能" # 基于描述头脑风暴
144
+ </examples>
145
+
146
+ <notes>
147
+ ## 头脑风暴流程图
148
+
149
+ ```
150
+ ┌─────────────────┐
151
+ │ 开始头脑风暴 │
152
+ └────────┬────────┘
153
+
154
+
155
+ ┌─────────────────┐
156
+ │ CLI 初始化会话 │
157
+ └────────┬────────┘
158
+
159
+
160
+ ┌─────────────────┐
161
+ │ 获取问题列表 │
162
+ └────────┬────────┘
163
+
164
+
165
+ ┌─────────────────┐
166
+ │ 交互式问答 │◀─────┐
167
+ │ (AskUserQuestion)│ │
168
+ └────────┬────────┘ │
169
+ │ │
170
+ ┌────┴────┐ │
171
+ │ │ │
172
+ 有下一题 无下一题 │
173
+ │ │ │
174
+ └────────┤ │
175
+ │ │
176
+ ▼ │
177
+ ┌─────────────────┐ │
178
+ │ 总结头脑风暴结果 │ │
179
+ └────────┬────────┘ │
180
+ │ │
181
+ ▼ │
182
+ ┌─────────────────┐ │
183
+ │ 用户确认 │ │
184
+ └────────┬────────┘ │
185
+ │ │
186
+ ┌────┴────┐ │
187
+ │ │ │
188
+ 开始执行 继续探索 ────┘
189
+
190
+
191
+ ┌─────────────────┐
192
+ │ 自动执行 start │
193
+ └─────────────────┘
194
+ ```
195
+
196
+ ## 问题类型
197
+
198
+ | 问题 ID | 目的 | 为什么重要 |
199
+ |---------|------|-----------|
200
+ | core_objective | 明确核心目标 | 选择正确的实现策略 |
201
+ | user_value | 了解用户价值 | 设计合适的接口 |
202
+ | complexity | 评估复杂度 | 决定实施策略 |
203
+ | tech_constraints | 技术约束 | 影响方案选择 |
204
+ | risks | 风险评估 | 提前规划应对 |
205
+ | acceptance | 验收标准 | 判断完成度 |
206
+ | priority | 优先级 | 资源分配 |
207
+
208
+ ## 与 start 的集成
209
+
210
+ 头脑风暴完成后,收集的信息会传递给 start:
211
+
212
+ ```json
213
+ {
214
+ "answers": {
215
+ "core_objective": "实现新功能",
216
+ "user_value": "终端用户",
217
+ "complexity": "中等",
218
+ "risks": ["技术风险", "兼容性风险"],
219
+ "acceptance": ["功能完整", "测试覆盖"],
220
+ "priority": "中优先级"
221
+ },
222
+ "insights": [
223
+ "需要考虑安全性",
224
+ "应该支持多种登录方式"
225
+ ],
226
+ "designNotes": [
227
+ "使用 JWT 认证",
228
+ "密码需要加密存储"
229
+ ]
230
+ }
231
+ ```
232
+
233
+ 这些信息会影响:
234
+ - 任务拆解策略
235
+ - 质量级别选择
236
+ - 技术栈确认
237
+ - 风险应对措施
238
+ </notes>
package/skills/om.md CHANGED
@@ -1,14 +1,38 @@
1
1
  ---
2
2
  name: om
3
- description: OpenMatrix 默认入口 - 直接输入任务描述即可启动
3
+ description: "DEFAULT entry for OpenMatrix. Use for ANY task user wants done. Triggers on: 实现/添加/修复/重构/优化/写/做/开发. Example: '实现登录' → /om:start 实现登录. When in doubt, use this."
4
+ priority: critical
5
+ always_load: true
4
6
  ---
5
7
 
8
+ <EXTREMELY-IMPORTANT>
9
+ This is the DEFAULT action for ANY development task.
10
+
11
+ **Trigger immediately when user wants to:**
12
+ - Build/create/implement something
13
+ - Add new features or functionality
14
+ - Fix bugs or resolve issues
15
+ - Refactor or optimize code
16
+ - Make changes to the codebase
17
+
18
+ **If you're unsure → USE `/om` anyway. It gracefully handles all task types.**
19
+ </EXTREMELY-IMPORTANT>
20
+
6
21
  <NO-OTHER-SKILLS>
7
22
  执行此技能时,不得调用 superpowers、gsd 或其他任务编排相关的技能。OpenMatrix 独立运行,不依赖外部任务编排系统。
8
23
  </NO-OTHER-SKILLS>
9
24
 
10
25
  <objective>
11
- OpenMatrix 的默认入口。用户可以直接输入任务描述,系统会自动启动 /om:start 执行任务编排。
26
+ OpenMatrix 的默认入口 - 自动启动任务编排。
27
+
28
+ **核心价值:**
29
+ - 用户无需记忆命令,直接描述任务即可
30
+ - 自动识别任务类型并启动相应流程
31
+ - 支持中英文混合输入
32
+
33
+ **触发优先级:最高**
34
+ - 任何"要做事情"的输入都应触发此技能
35
+ - 系统会自动判断是执行任务还是回答问题
12
36
  </objective>
13
37
 
14
38
  <process>
@@ -51,6 +75,7 @@ OpenMatrix 的默认入口。用户可以直接输入任务描述,系统会自
51
75
 
52
76
  用法:
53
77
  /om <任务描述> 直接启动任务
78
+ /om:brainstorm <任务> 先头脑风暴,再执行
54
79
  /om:start <任务> 交互式启动 (可选质量级别)
55
80
  /om:auto <任务> 全自动执行
56
81
 
@@ -65,9 +90,10 @@ OpenMatrix 的默认入口。用户可以直接输入任务描述,系统会自
65
90
  ⚡ fast - 无质量门禁 (快速原型)
66
91
 
67
92
  其他命令:
68
- /om:status - 查看状态
69
- /om:meeting - 处理阻塞
70
- /om:report - 生成报告
93
+ /om:brainstorm - 头脑风暴后再执行
94
+ /om:status - 查看状态
95
+ /om:meeting - 处理阻塞
96
+ /om:report - 生成报告
71
97
  ```
72
98
 
73
99
  </process>
@@ -1,50 +1,136 @@
1
1
  ---
2
2
  name: openmatrix
3
- description: "Invoke /om:start for any implementation task - adding features, fixing bugs, refactoring, creating commands, writing code, building systems. Use this when user describes work to be done, not for questions or information requests."
4
- priority: high
3
+ description: "TRIGGER for ANY implementation task. User wants to build/create/add/fix/implement/refactor something? This is the DEFAULT. Examples: 'add feature', 'fix bug', 'implement login', 'refactor code', 'create command'. ALWAYS prefer this over direct coding."
4
+ priority: critical
5
5
  always_load: true
6
6
  ---
7
7
 
8
+ <EXTREMELY-IMPORTANT>
9
+ This skill MUST be invoked when the user describes ANY work to be done.
10
+
11
+ **If you're unsure whether to invoke → INVOKE IT.**
12
+
13
+ **If user mentions: add/create/implement/fix/build/make/write/develop/refactor/optimize/update/modify/change → INVOKE THIS SKILL.**
14
+
15
+ **Direct coding without OpenMatrix is ONLY allowed for:**
16
+ - Simple one-line fixes (typos, variable names)
17
+ - Answering questions (no code changes needed)
18
+ - Information retrieval (reading files, explaining code)
19
+
20
+ Everything else → smart selection between `/om:brainstorm` and `/om:start`.
21
+ </EXTREMELY-IMPORTANT>
22
+
8
23
  <objective>
9
- Automatically detect when user wants to accomplish a development task and invoke /om:start without requiring explicit command.
24
+ Automatically detect when user wants to accomplish a development task and intelligently choose between brainstorm (for complex tasks) or start (for simple tasks).
10
25
  </objective>
11
26
 
12
27
  <trigger-conditions>
13
- ## When to Auto-Invoke /om:start
14
-
15
- **Invoke `/om:start` when user wants to:**
16
- - Add/create/implement new features or functionality
17
- - Fix bugs or resolve issues
18
- - Refactor or optimize existing code
19
- - Write tests
20
- - Build components or systems
21
- - Integrate third-party services
22
-
23
- **This includes:**
24
- - Direct requests: "实现登录功能" / "增加一个命令" / "修复bug"
25
- - Complex tasks: "做个完整的用户系统" / "从零搭建后台"
26
- - Multi-step work: "先做A再做B" / "前端+后端+数据库"
28
+ ## AUTO-INVOKE RULES (Mandatory)
29
+
30
+ **Invoke IMMEDIATELY when user input contains ANY of these patterns:**
31
+
32
+ ### Action Verbs (触发词)
33
+ | Chinese | English | Action |
34
+ |---------|---------|--------|
35
+ | 实现/开发/做/写 | implement/build/create/make/write | → Smart Select |
36
+ | 添加/增加/加 | add/append | → Smart Select |
37
+ | 修复/解决/改 | fix/resolve/repair | → Smart Select |
38
+ | 重构/优化/改进 | refactor/optimize/improve | → Smart Select |
39
+ | 更新/修改/改 | update/modify/change | Smart Select |
40
+
41
+ ### Context Patterns (触发场景)
42
+ - **Feature requests**: "用户登录" / "支付功能" / "API接口"
43
+ - **Bug reports**: "报错" / "不工作" / "有问题" / "崩溃"
44
+ - **Code changes**: "这段代码" / "这个文件" / "那个模块"
45
+ - **Multi-step tasks**: "先做A" / "然后B" / "最后C"
46
+ - **System building**: "做一个系统" / "搭建框架" / "从零开始"
47
+
48
+ ### The 3-Second Test
49
+ ```
50
+ 用户输入 → 能在3秒内判断是"要做事情"吗?
51
+ ↓ Yes ↓ No
52
+ Smart Select 直接回答
53
+ ```
27
54
  </trigger-conditions>
28
55
 
56
+ <smart-selection>
57
+ ## 智能选择:Brainstorm vs Start
58
+
59
+ **根据任务复杂度自动选择执行路径:**
60
+
61
+ ### 🧠 复杂任务 → `/om:brainstorm`
62
+ **触发条件 (满足任一):**
63
+ - 新功能开发: "实现用户登录" / "添加支付功能" / "开发 API"
64
+ - 多模块改动: "重构用户系统" / "优化整体性能"
65
+ - 架构相关: "搭建框架" / "从零开始" / "设计架构"
66
+ - 不确定因素: 需要技术选型、涉及多种方案选择
67
+ - 关键词: "系统" / "架构" / "模块" / "集成" / "完整" / "从零"
68
+
69
+ ### 🚀 简单任务 → `/om:start`
70
+ **触发条件 (满足任一):**
71
+ - Bug 修复: "修复登录bug" / "解决样式问题" / "改个报错"
72
+ - 小改动: "修改文案" / "改变量名" / "调整配置"
73
+ - 单一功能: "添加一个按钮" / "写个工具函数"
74
+ - 明确需求: 需求清晰,无需额外探索
75
+ - 关键词: "修复" / "解决" / "改" / "调整" / "小" / "简单"
76
+
77
+ ### 选择流程
78
+ ```
79
+ 用户输入任务描述
80
+
81
+
82
+ ┌─────────────────────┐
83
+ │ 分析任务复杂度 │
84
+ └──────────┬──────────┘
85
+
86
+ ┌─────┴─────┐
87
+ │ │
88
+ 复杂任务 简单任务
89
+ │ │
90
+ ▼ ▼
91
+ /om:brainstorm /om:start
92
+ ```
93
+
94
+ ### 判断示例
95
+ | 用户输入 | 复杂度 | 执行路径 |
96
+ |---------|--------|---------|
97
+ | "实现用户登录功能" | 复杂 | `/om:brainstorm` |
98
+ | "做一个完整的支付系统" | 复杂 | `/om:brainstorm` |
99
+ | "从零搭建后台管理" | 复杂 | `/om:brainstorm` |
100
+ | "修复登录页面的样式问题" | 简单 | `/om:start` |
101
+ | "改一下这个变量名" | 简单 | `/om:start` |
102
+ | "添加一个测试用例" | 简单 | `/om:start` |
103
+ | "重构这个模块" | 中等 | `/om:brainstorm` (保守选择) |
104
+ | "优化性能" | 中等 | `/om:brainstorm` (保守选择) |
105
+
106
+ **不确定时的默认选择: `/om:brainstorm`** (宁可多问,不可漏问)
107
+ </smart-selection>
108
+
29
109
  <exclusions>
30
- ## When NOT to Auto-Invoke
110
+ ## When NOT to Invoke (Rare Cases)
111
+
112
+ **Do NOT invoke ONLY when:**
113
+ - Pure question: "怎么实现?" / "如何配置?" / "what is..." / "为什么"
114
+ - Information request: "显示配置" / "列出文件" / "show me..." / "看一下"
115
+ - Status check: "状态" / "进度" / "status"
116
+ - Casual chat: "你好" / "谢谢" / "hello"
31
117
 
32
- **Do NOT invoke when:**
33
- - User is asking a question: "怎么实现?" / "如何配置?" / "what is..."
34
- - User is requesting information: "显示配置" / "列出文件" / "show me..."
35
- - User is navigating: "打开目录" / "进入文件夹"
36
- - User is just chatting: "你好" / "谢谢"
118
+ **Key Test:**
119
+ ```
120
+ 用户要我写代码/改代码/做东西吗?
121
+ Yes Smart Select (brainstorm/start)
122
+ No → 直接回答
123
+ ```
37
124
 
38
- **Key test: Is the user asking you to BUILD/CREATE/FIX something?**
39
- - Yes → Invoke `/om:start`
40
- - No (asking for info) → Do NOT invoke
125
+ **When in doubt INVOKE. It handles both simple and complex tasks.**
41
126
  </exclusions>
42
127
 
43
128
  <examples>
44
- | User Input | Action |
45
- |------------|--------|
46
- | `增加一个 om:upgrade 命令` | → `/om:start 增加一个 om:upgrade 命令` |
47
- | `实现用户登录功能` | → `/om:start 实现用户登录功能` |
48
- | `登录页面报错了` | → `/om:start 登录页面报错了` |
49
- | `怎么实现登录?` | No invoke (question) |
50
- </examples>
129
+ | User Input | Complexity | Action |
130
+ |------------|------------|--------|
131
+ | `实现用户登录功能` | 复杂 | → `/om:brainstorm` |
132
+ | `做一个完整的订单系统` | 复杂 | → `/om:brainstorm` |
133
+ | `修复登录页面的样式问题` | 简单 | → `/om:start` |
134
+ | `改一下这个变量名` | 简单 | `/om:start` |
135
+ | `重构用户模块` | 中等 | → `/om:brainstorm` |
136
+ | `怎么实现登录?` | - | ❌ Question, not task |