openmatrix 0.2.16 → 0.2.17

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.
@@ -93,6 +93,7 @@ export declare class PhaseExecutor {
93
93
  * 设置自动模式
94
94
  */
95
95
  setAutoMode(auto: boolean): void;
96
+ disableGitCommit(): void;
96
97
  /**
97
98
  * 获取自动模式状态
98
99
  */
@@ -55,6 +55,9 @@ class PhaseExecutor {
55
55
  setAutoMode(auto) {
56
56
  this.isAutoMode = auto;
57
57
  }
58
+ disableGitCommit() {
59
+ this.gitCommitManager.setEnabled(false);
60
+ }
58
61
  /**
59
62
  * 获取自动模式状态
60
63
  */
@@ -58,9 +58,14 @@ class SmartQuestionAnalyzer {
58
58
  async analyze(taskDescription, parsedTask) {
59
59
  // 1. 获取项目上下文
60
60
  const projectContext = await this.getProjectContext();
61
- // 2. 执行推断
62
- const inferences = this.inferAnswers(taskDescription, projectContext);
63
- // 3. 筛选需要提问的问题
61
+ // 2. 如果 parsedTask 有 goalTypes,优先使用
62
+ let goalTypeOverride;
63
+ if (parsedTask?.goalTypes && parsedTask.goalTypes.length > 0) {
64
+ goalTypeOverride = parsedTask.goalTypes[0];
65
+ }
66
+ // 3. 执行推断
67
+ const inferences = this.inferAnswers(taskDescription, projectContext, goalTypeOverride);
68
+ // 4. 筛选需要提问的问题
64
69
  const questionsToAsk = inferences
65
70
  .filter(i => i.confidence === 'low' || !i.inferredAnswer)
66
71
  .map(i => i.questionId);
@@ -163,7 +168,7 @@ class SmartQuestionAnalyzer {
163
168
  /**
164
169
  * 推断问题答案
165
170
  */
166
- inferAnswers(taskDescription, context) {
171
+ inferAnswers(taskDescription, context, goalTypeOverride) {
167
172
  const inferences = [];
168
173
  const desc = taskDescription.toLowerCase();
169
174
  // 1. 推断质量级别
@@ -180,6 +185,15 @@ class SmartQuestionAnalyzer {
180
185
  inferences.push(this.inferObjective(desc, context));
181
186
  // 7. 推断测试覆盖率级别
182
187
  inferences.push(this.inferTestCoverage(desc, context));
188
+ // 8. 如果有 goalTypeOverride,覆盖 objective 推断
189
+ if (goalTypeOverride) {
190
+ const objectiveInference = inferences.find(i => i.questionId === 'objective');
191
+ if (objectiveInference) {
192
+ objectiveInference.inferredAnswer = goalTypeOverride;
193
+ objectiveInference.confidence = 'high';
194
+ objectiveInference.reason = '来自 AI 任务解析的目标类型标注';
195
+ }
196
+ }
183
197
  return inferences;
184
198
  }
185
199
  /**
@@ -336,6 +350,13 @@ class SmartQuestionAnalyzer {
336
350
  confidence: 'low',
337
351
  reason: ''
338
352
  };
353
+ // 文档/skill 文件 -> 不需要 E2E
354
+ if (/(skill|\.md|文档|readme|document|说明|指南)/i.test(desc)) {
355
+ inference.inferredAnswer = 'false';
356
+ inference.confidence = 'high';
357
+ inference.reason = '文档或 skill 文件修改不需要 E2E 测试';
358
+ return inference;
359
+ }
339
360
  // CLI/后端 -> 不需要 E2E
340
361
  if (/(cli|api|backend|后端|命令行)/i.test(desc) && !context.hasFrontend) {
341
362
  inference.inferredAnswer = 'false';
@@ -397,23 +418,30 @@ class SmartQuestionAnalyzer {
397
418
  confidence: 'low',
398
419
  reason: ''
399
420
  };
421
+ // 文档类任务 -> documentation
422
+ if (/(文档|document|readme|skill|\.md|说明|指南)/i.test(desc)) {
423
+ inference.inferredAnswer = 'documentation';
424
+ inference.confidence = 'high';
425
+ inference.reason = '任务涉及文档或 skill 文件';
426
+ return inference;
427
+ }
400
428
  if (/(fix|bug|修复|hotfix|patch)/i.test(desc)) {
401
- inference.inferredAnswer = 'bug_fix';
429
+ inference.inferredAnswer = 'development';
402
430
  inference.confidence = 'medium';
403
- inference.reason = '任务描述包含修复关键词';
431
+ inference.reason = '任务描述包含修复关键词(bug 修复属于开发)';
404
432
  }
405
433
  else if (/(implement|add|新功能|实现|开发|feature|新增)/i.test(desc)) {
406
- inference.inferredAnswer = 'new_feature';
434
+ inference.inferredAnswer = 'development';
407
435
  inference.confidence = 'medium';
408
436
  inference.reason = '任务描述包含新功能关键词';
409
437
  }
410
438
  else if (/(refactor|优化|重构|improve|性能)/i.test(desc)) {
411
- inference.inferredAnswer = 'refactor';
439
+ inference.inferredAnswer = 'development';
412
440
  inference.confidence = 'medium';
413
- inference.reason = '任务描述包含重构关键词';
441
+ inference.reason = '任务描述包含重构关键词(重构属于开发)';
414
442
  }
415
443
  else if (/(test|测试|coverage|覆盖)/i.test(desc)) {
416
- inference.inferredAnswer = 'test';
444
+ inference.inferredAnswer = 'testing';
417
445
  inference.confidence = 'medium';
418
446
  inference.reason = '任务描述包含测试关键词';
419
447
  }
@@ -390,6 +390,8 @@ class TaskPlanner {
390
390
  }
391
391
  const coverageTarget = this.getCoverageTarget(qualityConfig, userContext);
392
392
  const globalContext = this.buildGlobalContext(parsedTask, userContext, plan);
393
+ // 提取 planMetadata 用于测试任务描述注入
394
+ const planMetadata = this.extractPlanMetadata(plan);
393
395
  // 1. 为每个模块创建开发 + 测试任务对
394
396
  const devTaskIds = [];
395
397
  const moduleIdToTaskIds = new Map();
@@ -434,7 +436,7 @@ class TaskPlanner {
434
436
  breakdowns.push({
435
437
  taskId: testTaskId,
436
438
  title: `测试: ${mod.name}`,
437
- description: `## 测试目标\n为 "${mod.name}" 模块编写测试用例\n\n${globalContext}\n\n## 关联开发任务\n${modTaskId}\n\n## 测试要求\n- 单元测试覆盖率 >= ${coverageTarget}%\n- 测试正常流程\n- 测试边界情况\n- 测试异常处理\n\n## 输出\n- 测试文件\n- 测试报告\n- 覆盖率报告`,
439
+ description: this.buildTestDescription(mod.name, modTaskId, coverageTarget, globalContext, planMetadata),
438
440
  priority: this.determineModulePriority(mod, parsedPlan.modules.indexOf(mod)),
439
441
  dependencies: [modTaskId],
440
442
  estimatedComplexity: 'medium',
@@ -757,7 +759,7 @@ ${globalContext}
757
759
  breakdowns.push({
758
760
  taskId: testTaskId,
759
761
  title: `测试: ${goal}`,
760
- description: this.buildTestDescription(goal, devTaskId, coverageTarget, globalContext),
762
+ description: this.buildTestDescription(goal, devTaskId, coverageTarget, globalContext, planMetadata),
761
763
  priority: this.determinePriority(i),
762
764
  dependencies: [devTaskId],
763
765
  estimatedComplexity: 'medium',
@@ -1104,16 +1106,25 @@ ${userContext.documentationLevel}
1104
1106
  - 添加必要注释`;
1105
1107
  return desc;
1106
1108
  }
1107
- buildTestDescription(goal, devTaskId, coverageTarget, globalContext) {
1108
- return `## 测试目标
1109
+ buildTestDescription(goal, devTaskId, coverageTarget, globalContext, planMetadata) {
1110
+ let desc = `## 测试目标
1109
1111
  为 "${goal}" 编写测试用例
1110
1112
 
1111
1113
  ${globalContext}
1112
1114
 
1113
1115
  ## 关联开发任务
1114
- ${devTaskId}
1115
-
1116
- ## 测试要求
1116
+ ${devTaskId}`;
1117
+ // 注入 plan 提取的关键信息(参考 buildTaskDescription)
1118
+ if (planMetadata && planMetadata.interfaces.length > 0) {
1119
+ desc += `\n\n## 相关接口/API\n${planMetadata.interfaces.slice(0, 10).map(i => `- ${i}`).join('\n')}`;
1120
+ }
1121
+ if (planMetadata && planMetadata.dataModels.length > 0) {
1122
+ desc += `\n\n## 相关数据模型\n${planMetadata.dataModels.slice(0, 10).map(d => `- ${d}`).join('\n')}`;
1123
+ }
1124
+ if (planMetadata && planMetadata.keyDecisions.length > 0) {
1125
+ desc += `\n\n## 关键决策参考\n${planMetadata.keyDecisions.slice(0, 5).map(d => `- ${d}`).join('\n')}`;
1126
+ }
1127
+ desc += `\n\n## 测试要求
1117
1128
  - 单元测试覆盖率 >= ${coverageTarget}%
1118
1129
  - 测试正常流程
1119
1130
  - 测试边界情况
@@ -1127,6 +1138,7 @@ ${devTaskId}
1127
1138
  - 测试文件
1128
1139
  - 测试报告
1129
1140
  - 覆盖率报告`;
1141
+ return desc;
1130
1142
  }
1131
1143
  buildE2ETestDescription(e2eType, parsedTask, userContext) {
1132
1144
  const typeConfig = this.getE2ETypeConfig(e2eType);
@@ -376,3 +376,131 @@ export interface AmbiguityReport {
376
376
  /** 建议的问题列表 (用于 AskUserQuestion) */
377
377
  suggestedQuestions?: string[];
378
378
  }
379
+ /**
380
+ * 构建工具类型
381
+ */
382
+ export type BuildToolType = 'npm' | 'yarn' | 'pnpm' | 'make' | 'docker' | 'gradle' | 'maven' | 'cargo' | 'go' | 'pip' | 'poetry' | 'nuget' | 'msbuild' | 'webpack' | 'vite' | 'esbuild' | 'rollup' | 'turbo' | 'bazel' | 'unknown';
383
+ /**
384
+ * 构建工具信息
385
+ */
386
+ export interface BuildTool {
387
+ /** 工具类型 */
388
+ type: BuildToolType;
389
+ /** 可用命令列表 */
390
+ commands: string[];
391
+ /** 配置文件路径 */
392
+ configFile?: string;
393
+ /** 是否为默认构建工具 */
394
+ isDefault?: boolean;
395
+ /** 工具版本 */
396
+ version?: string;
397
+ }
398
+ /**
399
+ * 部署方式
400
+ */
401
+ export type DeployMethod = 'docker' | 'docker-compose' | 'kubernetes' | 'helm' | 'npm' | 'make' | 'script' | 'github-pages' | 'vercel' | 'netlify' | 'aws' | 'gcp' | 'azure' | 'heroku' | 'unknown';
402
+ /**
403
+ * 部署选项
404
+ */
405
+ export interface DeployOption {
406
+ /** 部署方式 */
407
+ method: DeployMethod;
408
+ /** 部署命令 */
409
+ command?: string;
410
+ /** 配置文件路径 */
411
+ configFile?: string;
412
+ /** 部署环境 */
413
+ environment?: 'development' | 'staging' | 'production';
414
+ /** 是否推荐 */
415
+ recommended?: boolean;
416
+ /** 描述信息 */
417
+ description?: string;
418
+ }
419
+ /**
420
+ * CI 平台类型
421
+ */
422
+ export type CIPlatform = 'github-actions' | 'gitlab-ci' | 'jenkins' | 'circleci' | 'travis-ci' | 'azure-pipelines' | 'bitbucket-pipelines' | 'drone' | 'teamcity' | 'unknown';
423
+ /**
424
+ * CI 配置信息
425
+ */
426
+ export interface CIConfig {
427
+ /** CI 平台 */
428
+ platform: CIPlatform;
429
+ /** 配置文件列表 */
430
+ configFiles: string[];
431
+ /** 可用的 workflow 名称 */
432
+ workflows?: string[];
433
+ /** 触发条件 */
434
+ triggers?: string[];
435
+ }
436
+ /**
437
+ * 开发命令信息
438
+ */
439
+ export interface DevCommands {
440
+ /** 安装/设置命令 */
441
+ setup: string[];
442
+ /** 构建命令 */
443
+ build: string[];
444
+ /** 测试命令 */
445
+ test: string[];
446
+ /** 开发/调试命令 */
447
+ dev: string[];
448
+ /** 启动命令 */
449
+ start: string[];
450
+ /** 清理命令 */
451
+ clean?: string[];
452
+ /** Lint 命令 */
453
+ lint?: string[];
454
+ /** 格式化命令 */
455
+ format?: string[];
456
+ }
457
+ /**
458
+ * 项目环境检测结果
459
+ */
460
+ export interface EnvironmentInfo {
461
+ /** 项目名称 */
462
+ projectName: string;
463
+ /** 项目类型 */
464
+ projectType: ProjectType;
465
+ /** 项目根目录 */
466
+ projectRoot: string;
467
+ /** 检测时间 */
468
+ timestamp: string;
469
+ /** 构建工具列表 */
470
+ buildTools: BuildTool[];
471
+ /** CI 配置 */
472
+ ciConfig?: CIConfig;
473
+ /** 部署选项 */
474
+ deployOptions: DeployOption[];
475
+ /** 开发命令 */
476
+ devCommands: DevCommands;
477
+ /** 检测摘要 */
478
+ summary: {
479
+ /** 是否有构建工具 */
480
+ hasBuildTool: boolean;
481
+ /** 是否有 CI 配置 */
482
+ hasCIConfig: boolean;
483
+ /** 是否有部署选项 */
484
+ hasDeployOption: boolean;
485
+ /** 构建工具数量 */
486
+ buildToolCount: number;
487
+ /** 部署选项数量 */
488
+ deployOptionCount: number;
489
+ };
490
+ }
491
+ /**
492
+ * 项目类型 (复用 UpgradeDetector 中的定义)
493
+ * 注意:如果 UpgradeDetector 的 ProjectType 发生变化,这里需要同步
494
+ */
495
+ export type ProjectType = 'openmatrix' | 'ai-project' | 'nodejs' | 'typescript' | 'python' | 'go' | 'rust' | 'java' | 'csharp' | 'cpp' | 'php' | 'dart' | 'ruby' | 'swift' | 'kotlin' | 'scala' | 'flutter' | 'react' | 'vue' | 'angular' | 'nextjs' | 'nuxt' | 'svelte' | 'unknown';
496
+ /**
497
+ * 环境检测器配置
498
+ */
499
+ export interface EnvironmentDetectorConfig {
500
+ /** 扫描目录 */
501
+ scanDirs: string[];
502
+ /** 排除目录 */
503
+ excludeDirs: string[];
504
+ /** 最大建议数量 */
505
+ maxDeployOptions?: number;
506
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmatrix",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
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",
package/skills/debug.md CHANGED
@@ -352,50 +352,130 @@ ${suggestedFix}
352
352
  2. 提交修复(如果文件有变更)
353
353
  3. 进入 Step 9 验证
354
354
 
355
- ## Step 9: 验证修复
355
+ ## Step 9: 自动验证修复(循环机制)
356
356
 
357
- **根据问题类型选择验证方式:**
357
+ **⛔ 自动验证流程 - 无需用户手动确认**
358
358
 
359
- | 问题类型 | 验证方式 |
359
+ 验证自动判断结果,失败时自动循环回修复步骤,直到通过或达到最大重试次数。
360
+
361
+ ### 9.1 执行验证命令(自动判断结果)
362
+
363
+ 根据问题类型执行验证:
364
+
365
+ | 问题类型 | 验证命令 |
360
366
  |---------|---------|
361
- | task_failure | 重新运行失败任务或相关测试 |
362
- | project_bug | 运行相关测试或构建 |
367
+ | task_failure | `npm test -- --run 2>&1` |
368
+ | project_bug | `npm run build 2>&1` |
363
369
  | system_bug | 验证 CLI 功能 |
364
- | environment | 检查依赖安装状态 |
370
+ | environment | `npm ls --depth=0 2>&1` |
371
+
372
+ **自动判断验证结果:**
365
373
 
366
- **任务失败:**
367
374
  ```bash
368
- # 运行相关测试
369
- npm test -- --run 2>&1 | tail -20
375
+ # 执行验证并捕获退出码
376
+ VERIFY_RESULT=0
377
+ npm test -- --run > /tmp/verify-output.txt 2>&1 || VERIFY_RESULT=1
378
+
379
+ if [ $VERIFY_RESULT -eq 0 ]; then
380
+ echo "✅ 验证自动判定: 通过"
381
+ else
382
+ echo "❌ 验证自动判定: 未通过"
383
+ cat /tmp/verify-output.txt | tail -30 # 展示失败详情
384
+ fi
370
385
  ```
371
386
 
372
- **项目 bug:**
373
- ```bash
374
- npm run build 2>&1 | tail -10
387
+ ### 9.2 验证失败自动循环(无需用户确认)
388
+
389
+ **验证失败时自动处理:**
390
+
391
+ ```
392
+ 验证失败 → 重试计数 +1 → 检查重试次数 →
393
+ ├─ < 3 次 → 自动回到 Step 8 重新修复(带新信息)
394
+ └─ >= 3 次 → 暂停,质疑架构,进入 Step 10
375
395
  ```
376
396
 
377
- **环境:**
378
- ```bash
379
- npm ls --depth=0 2>&1 | tail -20
397
+ **重试计数器更新:**
398
+ - Skill 内部维护 `retryCount` 变量
399
+ - 每次验证失败 +1
400
+ - 验证通过后重置为 0
401
+
402
+ ### 9.3 自动循环回修复步骤
403
+
404
+ **< 3 次验证失败 → 自动调用 Agent 重新修复:**
405
+
406
+ ```typescript
407
+ // 自动重新修复,无需用户确认
408
+ Agent({
409
+ subagent_type: "general-purpose",
410
+ description: `重新修复 (第 ${retryCount + 1} 次)`,
411
+ prompt: `根据验证失败结果重新分析并修复。
412
+
413
+ ## 铁律
414
+ 1. 只实施单一修复(不要做额外改动)
415
+ 2. 每次只改一个变量
416
+ 3. 不在诊断不清的情况下盲目尝试
417
+
418
+ ## 上次修复结果
419
+ ${previousFixSummary}
420
+
421
+ ## 验证失败详情
422
+ ${verifyFailureOutput}
423
+
424
+ ## 新分析
425
+ - 上次修复为什么没生效?
426
+ - 是否遗漏了某个根因?
427
+ - 是否有其他影响因素?
428
+
429
+ ## 任务
430
+ 1. 重新分析验证失败原因
431
+ 2. 实施新的修复方案
432
+ 3. 确保修改范围最小化
433
+
434
+ ## 禁止行为
435
+ ❌ 重复上次失败的修复
436
+ ❌ 同时修复多个问题
437
+ ❌ 进行额外的重构`,
438
+ run_in_background: false
439
+ })
380
440
  ```
381
441
 
382
- **验证结果判断:**
383
- - 测试全通过 / 构建成功 → 验证通过
384
- - 仍有失败 / 构建失败 → 验证未通过
442
+ ### 9.4 达到最大重试次数(>= 3 次)
385
443
 
386
- AskUserQuestion: `header: "验证结果"`, `multiSelect: false`
387
- **question:** 修复验证通过了吗?
444
+ **输出警告并暂停:**
445
+
446
+ ```
447
+ ⚠️ 已尝试 3 次以上修复,验证仍未通过
448
+
449
+ 这可能指示架构问题:
450
+ - 每次修复在其他地方产生新症状
451
+ - 修复需要"大规模重构"
452
+ - 根因分析不够深入
453
+
454
+ 建议:暂停并质疑根本问题,与用户讨论是否需要架构重构。
455
+ ```
456
+
457
+ **此时进入 Step 10,输出 Debug Report 并询问用户下一步。**
458
+
459
+ AskUserQuestion: `header: "架构问题"`, `multiSelect: false`
460
+ **question:** 已尝试 3 次修复仍未通过,可能存在架构问题。下一步?
388
461
 
389
462
  | label | description |
390
463
  |-------|-------------|
391
- | 通过 | 修复成功,记录报告 |
392
- | 未通过 | 修复未生效,重新分析 |
393
- | 部分通过 | 部分修复,继续诊断 |
464
+ | 深入重新诊断 | Step 3 重新开始完整诊断 |
465
+ | 架构重构讨论 | 讨论是否需要架构层面的改动 |
466
+ | 接受当前状态 | 记录修复尝试,结束调试 |
467
+
468
+ ### 9.5 验证通过
394
469
 
395
- **如果验证未通过:**
396
- - 重试计数 +1
397
- - **< 3 次** → 回到 Step 3(带着新信息重新分析)
398
- - **>= 3 次** → 输出"已尝试 3 次以上修复,建议暂停并质疑架构",进入 Step 10
470
+ **验证通过 → 自动进入 Step 10**
471
+
472
+ ```
473
+ 验证通过
474
+
475
+ 修复成功,自动进入报告阶段。
476
+ ```
477
+
478
+ 无需用户确认,直接继续。
399
479
 
400
480
  ## Step 10: 写入 Debug Report
401
481
 
@@ -490,23 +570,72 @@ Step 7: AskUserQuestion 选择修复策略
490
570
 
491
571
  Step 8: 实施修复
492
572
 
493
- Step 9: 验证修复结果
494
- ├─ 未通过 (< 3次) 回到 Step 3
495
- ├─ 未通过 (>= 3次) Step 10
496
- └─ 通过
573
+ Step 9: ⛔ 自动验证修复(无需用户确认)
574
+ ├─ 执行验证命令自动判断结果
575
+ ├─ 验证通过 自动进入 Step 10
576
+ └─ 验证失败 → 自动循环处理
577
+ ├─ < 3 次 → 自动回到 Step 8 重新修复
578
+ └─ >= 3 次 → 暂停,质疑架构,Step 10 ⚠️
497
579
  Step 10: 写入 Debug Report
498
580
  ```
499
581
 
582
+ ## 自动验证循环流程(Step 9 详细)
583
+
584
+ ```
585
+ ┌─────────────────────────────────────────┐
586
+ │ Step 8: 实施修复 │
587
+ └─────────────────────┬───────────────────┘
588
+
589
+ ┌─────────────────────────────────────────┐
590
+ │ Step 9: 执行验证命令 │
591
+ │ (npm test / npm build / etc.) │
592
+ └─────────────────────┬───────────────────┘
593
+
594
+ ┌───────┴───────┐
595
+ │ 自动判断结果 │
596
+ └───────┬───────┘
597
+ ┌─────────────┴─────────────┐
598
+ │ │
599
+ 退出码=0 退出码≠0
600
+ (验证通过) (验证失败)
601
+ │ │
602
+ ↓ ↓
603
+ ┌───────────────┐ ┌───────────────────┐
604
+ │ ✅ 进入 Step 10│ │ retryCount + 1 │
605
+ └───────────────┘ └───────┬───────────┘
606
+
607
+ ┌────────┴────────┐
608
+ │ 检查重试次数 │
609
+ └───────┬─────────┘
610
+ ┌─────────────┴─────────────┐
611
+ │ │
612
+ < 3 次 >= 3 次
613
+ │ │
614
+ ↓ ↓
615
+ ┌─────────────────┐ ┌───────────────────┐
616
+ │ ⚡ 自动回到 Step 8 │ │ ⚠️ 暂停,质疑架构 │
617
+ │ (带验证失败信息) │ │ 进入 Step 10 │
618
+ └─────────────────┘ └───────────────────┘
619
+ ```
620
+
500
621
  ## 铁律
501
622
 
502
623
  **不做根因调查,不许提修复方案**
503
624
 
625
+ **验证失败自动循环,无需用户手动确认**
626
+
627
+ **最大重试 3 次,超过必须暂停质疑架构**
628
+
504
629
  ## 红线
505
630
 
506
631
  - 3 次修复失败 → 暂停,质疑架构
507
632
  - 不修改未关联的文件
508
633
  - 单一修复原则
509
634
  - 修复前必须有验证方法
635
+ - **验证必须自动判断,不得依赖用户手动确认**
636
+ - **验证失败自动循环,不得跳过或手动绕过**
637
+ - **达到 3 次重试必须暂停,不得继续修复**
638
+ - 修复前必须有验证方法
510
639
 
511
640
  ## 红旗警告 - 停止并回归流程
512
641
 
@@ -522,8 +651,11 @@ Step 10: 写入 Debug Report
522
651
  - 提出解决方案前没有追踪数据流
523
652
  - **"再试一次修复"(已经试过 2+ 次)**
524
653
  - 每次修复揭示新地方的问题
654
+ - **"验证失败,让用户确认一下吧" → 应自动循环**
655
+ - **"重试超过 3 次了,继续试试" → 必须暂停质疑架构**
656
+ - **"跳过自动验证,手动确认就行" → 必须执行自动验证**
525
657
 
526
- **所有这些意味着:停止。回到 Step 3。**
658
+ **所有这些意味着:停止。回到 Step 3 或执行自动验证循环。**
527
659
 
528
660
  ## 常见借口 vs 真实情况
529
661
 
@@ -537,6 +669,9 @@ Step 10: 写入 Debug Report
537
669
  | "参考文档太长,我按模式改改" | 一知半解必然有 bug。完整阅读。 |
538
670
  | "我看到问题了,直接修吧" | 看到症状 ≠ 理解根因。 |
539
671
  | "再试一次修复"(失败 2+ 次后) | 3+ 次失败 = 架构问题。质疑模式,不要继续修。 |
672
+ | "验证失败让用户确认" | 自动验证循环无需用户干预。执行自动流程。 |
673
+ | "重试超过 3 次继续修" | 达到最大重试必须暂停。质疑架构。 |
674
+ | "手动确认验证结果" | 必须使用自动验证判断。退出码决定一切。 |
540
675
 
541
676
  ## 3+ 次修复失败:质疑架构
542
677