speccore 8.3.238 → 8.3.240

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.
@@ -665,7 +665,20 @@ async function iterationSplitCommand(options) {
665
665
  priority: task.priority || 'medium',
666
666
  };
667
667
  section._owner = task.owner || '未分配';
668
- section._taskType = (task.type && ['feature', 'bugfix', 'refactor', 'research', 'security', 'performance'].includes(task.type)) ? task.type : 'feature';
668
+ // v8.3.239+: 任务类型收敛为 4 种(与 task-paths.ts TASK_TYPES 对齐)——
669
+ // security 按 feature 交付(安全加固是完整交付,威胁分析归入 TECH.md 安全章节),
670
+ // performance 按 refactor 执行(性能优化本质是重构)
671
+ const rawType = task.type;
672
+ let taskType = (rawType && ['feature', 'bugfix', 'refactor', 'research'].includes(rawType)) ? rawType : 'feature';
673
+ if (rawType === 'security') {
674
+ taskType = 'feature';
675
+ logger_1.logger.info(` 🔒 任务「${task.name}」类型 security 收敛为 feature(安全加固按完整交付)`);
676
+ }
677
+ if (rawType === 'performance') {
678
+ taskType = 'refactor';
679
+ logger_1.logger.info(` ⚡ 任务「${task.name}」类型 performance 收敛为 refactor(性能优化按重构执行)`);
680
+ }
681
+ section._taskType = taskType;
669
682
  // 保存 topic slug,用于生成任务目录名(v8.3.77+: 多层提取)
670
683
  section._topic = extractTopic(task);
671
684
  // 保存 AI 生成的实际内容(用于写入 REQ.md / TECH.md)
@@ -1900,7 +1913,9 @@ ${sectionDevExtract}
1900
1913
  }
1901
1914
  }
1902
1915
  if (section.content.match(/数据库|数据表|表结构|DDL|ALTER|建表|索引/)) {
1903
- const schemaMaterial = extractRelevantSection(specContents['TECH.md'] || '', section.name, 'DDL 建表 表结构 索引 CREATE TABLE');
1916
+ // v8.3.239+: 三层匹配提取 DDL(兼容 {feature}/overview/TECH.md 嵌套键,旧扁平键取不到 DDL)
1917
+ const bestTechMatch = findBestSpecMatch(specContents, section.name, undefined, 'TECH.md');
1918
+ const schemaMaterial = extractRelevantSection((bestTechMatch && bestTechMatch.score >= 20 ? specContents[bestTechMatch.key] : specContents['TECH.md']) || '', section.name, 'DDL 建表 表结构 索引 CREATE TABLE');
1904
1919
  await (0, fs_extra_1.writeFile)((0, path_1.join)(taskDir, '00-specs', 'SCHEMA.md'), generateSchemaTemplate(section, schemaMaterial));
1905
1920
  }
1906
1921
  await (0, fs_extra_1.writeFile)((0, path_1.join)(taskDir, '00-specs', 'CHANGELOG.md'), `# ${section.name} - 变更记录
@@ -1910,7 +1925,9 @@ ${sectionDevExtract}
1910
1925
  | ${today} | v1.0 | 初始创建 | CLI |
1911
1926
  `);
1912
1927
  // API_CONTRACT.yaml 统一放 _shared/
1913
- if (apiLines.length > 0) {
1928
+ // v8.3.239+: 全局契约是单一真相源——已写入时不再覆盖(保留 rate limit/幂等性/版本策略),
1929
+ // section 提取版仅作兜底(全局契约不存在时)
1930
+ if (apiLines.length > 0 && !(await (0, fs_extra_1.pathExists)((0, path_1.join)(taskDir, '_shared', 'API_CONTRACT.yaml')))) {
1914
1931
  // 从 section 内容提取每个 API 的请求/响应字段
1915
1932
  const sectionContent = section.content || '';
1916
1933
  const apiFieldMap = {};
@@ -1951,12 +1968,31 @@ ${sectionDevExtract}
1951
1968
  }
1952
1969
  // ── 4. 子任务目录(按任务类型差异化) ──
1953
1970
  // 预加载执行产出模板材料(每个子任务都需要)
1954
- const testMaterial = extractRelevantSection(specContents['TEST.md'] || '', section.name);
1955
- const reviewMaterial = extractRelevantSection(specContents['REVIEW.md'] || '', section.name);
1956
- const deployMaterial = extractRelevantSection(specContents['DEPLOY.md'] || '', section.name);
1957
- const riskMaterial = extractRelevantSection(specContents['RISK.md'] || '', section.name);
1958
- const depsMaterial = extractRelevantSection(specContents['DEPS.md'] || '', section.name);
1959
- const monitorMaterial = extractRelevantSection(specContents['MONITOR.md'] || '', section.name);
1971
+ // v8.3.239+: 材料提取统一走三层匹配——兼容 overview/ 扁平键与 {feature}/overview/ 嵌套键
1972
+ // (新结构下 RISK/DEPS/MONITOR 在功能模块目录,旧结构下在 overview/ 平铺)
1973
+ const extractMaterial = (docName) => {
1974
+ const best = findBestSpecMatch(specContents, section.name, undefined, docName);
1975
+ if (best && best.score >= 20) {
1976
+ return extractRelevantSection(specContents[best.key], section.name);
1977
+ }
1978
+ return extractRelevantSection(specContents[docName] || '', section.name);
1979
+ };
1980
+ const testMaterial = extractMaterial('TEST.md');
1981
+ // v8.3.239+: 分析层 9 份名单无 REVIEW/DEPLOY,提取恒空 → 不再提取,走内容感知模板
1982
+ // (generateReviewChecklist/generateDeployChecklist 保留 material 参数,未来补提取源即可恢复)
1983
+ const riskMaterial = extractMaterial('RISK.md');
1984
+ const depsMaterial = extractMaterial('DEPS.md');
1985
+ const monitorMaterial = extractMaterial('MONITOR.md');
1986
+ // v8.3.239+: 子任务文档按类型裁剪——bugfix 轻量(修缺陷无需部署/监控/前端设计),
1987
+ // refactor 中等(保留风险与组件树,跳过路由/样式/部署/监控),feature 全套
1988
+ const docSet = {
1989
+ hasRisk: taskType !== 'bugfix',
1990
+ hasMonitor: taskType === 'feature',
1991
+ hasDeploy: taskType === 'feature',
1992
+ hasFeDesign: taskType === 'feature', // ROUTES/STATE/STYLE_GUIDE
1993
+ hasComponentTree: taskType !== 'bugfix', // feature/refactor 前端影响面
1994
+ hasAdr: taskType !== 'bugfix',
1995
+ };
1960
1996
  // ── 4a. research 类型:不创建平台/子任务目录,直接产出调研文档 ──
1961
1997
  if (isResearch) {
1962
1998
  await (0, fs_extra_1.writeFile)((0, path_1.join)(taskDir, 'RESEARCH.md'), `# ${section.name} — 调研报告
@@ -2098,11 +2134,10 @@ ${isBk ? apiList : pageList}
2098
2134
  | :--- | :--- | :--- | :--- |
2099
2135
  | TASK.md | ✅ | ./TASK.md | 本文件 |
2100
2136
  | TEST.md | ⏳ | ./TEST.md | ${isBk ? '单元测试 + 接口测试' : 'UI 测试 + 组件测试'} |
2101
- | RISK.md | ⏳ | ./RISK.md | 风险评估 |
2102
- | REVIEW.md | ⏳ | ./REVIEW.md | 评审清单 |
2103
- | DEPLOY.md | ⏳ | ./DEPLOY.md | 部署检查 |
2104
- | ERROR_CODES.md | ⏳ | ./ERROR_CODES.md | 错误码定义 |
2105
- > ⚠️ 代码输出位置:AI 生成的代码写入 CONSTITUTION.md/PROJECT.yaml 中声明的「源码路径」,
2137
+ ${docSet.hasRisk ? '| RISK.md | ⏳ | ./RISK.md | 风险评估 |\n' : ''}| DEPS.md | ⏳ | ./DEPS.md | 依赖清单 |
2138
+ ${docSet.hasMonitor ? '| MONITOR.md | ⏳ | ./MONITOR.md | 监控指标 |\n' : ''}| REVIEW.md | ⏳ | ./REVIEW.md | 评审清单 |
2139
+ ${docSet.hasDeploy ? '| DEPLOY.md | ⏳ | ./DEPLOY.md | 部署检查 |\n' : ''}| ERROR_CODES.md | ⏳ | ./ERROR_CODES.md | 错误码定义 |
2140
+ ${!isBk && docSet.hasComponentTree ? '| COMPONENT_TREE.md | ⏳ | ./COMPONENT_TREE.md | 组件树 |\n' : ''}${!isBk && docSet.hasFeDesign ? '| ROUTES.md | ⏳ | ./ROUTES.md | 路由设计 |\n| STATE.md | ⏳ | ./STATE.md | 状态管理 |\n| STYLE_GUIDE.md | ⏳ | ./STYLE_GUIDE.md | 样式规范 |\n' : ''}> ⚠️ 代码输出位置:AI 生成的代码写入 CONSTITUTION.md/PROJECT.yaml 中声明的「源码路径」,
2106
2141
  > 不写入迭代目录。子任务目录只存放规格文档。
2107
2142
 
2108
2143
  ## 变更履历
@@ -2110,14 +2145,18 @@ ${isBk ? apiList : pageList}
2110
2145
  | :--- | :--- | :--- |
2111
2146
  | ${today} | 创建子任务 | CLI |
2112
2147
  `);
2113
- // 前端设计文档(仅非 backend 端)
2114
- if (!isBk) {
2148
+ // 前端设计文档(仅非 backend 端,按任务类型裁剪:bugfix 跳过,refactor 仅组件树)
2149
+ if (!isBk && docSet.hasComponentTree) {
2115
2150
  const feContent = extractTaskTechContent(specContents, section, platformName);
2116
2151
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'COMPONENT_TREE.md'), generateComponentTree(section, platformName, feContent));
2117
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'ROUTES.md'), generateRoutesDoc(section, platformName, feContent));
2118
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'STATE.md'), generateStateDoc(section, platformName, feContent));
2119
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'STYLE_GUIDE.md'), generateStyleGuide(section, platformName, feContent));
2120
- // v8.3.60+: 自动生成 VERIFY_SPEC.yaml(从源码路由扫描)
2152
+ if (docSet.hasFeDesign) {
2153
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'ROUTES.md'), generateRoutesDoc(section, platformName, feContent));
2154
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'STATE.md'), generateStateDoc(section, platformName, feContent));
2155
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'STYLE_GUIDE.md'), generateStyleGuide(section, platformName, feContent));
2156
+ }
2157
+ }
2158
+ // v8.3.60+: 自动生成 VERIFY_SPEC.yaml(从源码路由扫描,所有前端端均生成)
2159
+ if (!isBk) {
2121
2160
  try {
2122
2161
  const projectConfig = await (0, unified_config_1.loadProjectConfig)();
2123
2162
  const platformConfig = projectConfig.platforms.find(p => p.name === platformName);
@@ -2144,21 +2183,26 @@ ${isBk ? apiList : pageList}
2144
2183
  // 静默失败:源码不可用或扫描失败时不阻断 split 流程
2145
2184
  }
2146
2185
  }
2147
- // 执行产出文档
2186
+ // 执行产出文档(按任务类型裁剪:bugfix 无 RISK/MONITOR/DEPLOY,refactor 无 MONITOR/DEPLOY)
2148
2187
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'TEST.md'), generateTestOutline(section, testMaterial));
2149
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'REVIEW.md'), generateReviewChecklist(section, reviewMaterial));
2150
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'DEPLOY.md'), generateDeployChecklist(section, deployMaterial));
2188
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'REVIEW.md'), generateReviewChecklist(section));
2189
+ if (docSet.hasDeploy)
2190
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'DEPLOY.md'), generateDeployChecklist(section));
2151
2191
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'ERROR_CODES.md'), generateErrorCodes(section));
2152
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'RISK.md'), generateRiskTemplate(section, riskMaterial));
2192
+ if (docSet.hasRisk)
2193
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'RISK.md'), generateRiskTemplate(section, riskMaterial));
2153
2194
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'DEPS.md'), generateDepsTemplate(section, depsMaterial));
2154
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'MONITOR.md'), generateMonitorTemplate(section, monitorMaterial));
2195
+ if (docSet.hasMonitor)
2196
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'MONITOR.md'), generateMonitorTemplate(section, monitorMaterial));
2155
2197
  // v8.0.0+: 预创建 REQ.md 和 TECH.md 骨架文件
2156
2198
  // AI 用 Write 覆盖这些文件,不再自行创建路径(消除路径错误)
2157
2199
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'REQ.md'), `${spec_skeleton_1.SKELETON_MARKER}\n# ${section.name} — ${platformLabel}\n\n> 本文件由 CLI 预创建,请用 Write 工具覆盖为专业需求规格。\n\n## 功能描述\n<!-- AI-FILL: 本端的需求描述 -->\n\n## 验收标准\n<!-- AI-FILL: Given/When/Then 格式 -->\n\n## 业务规则\n<!-- AI-FILL -->\n\n## 边界条件\n<!-- AI-FILL -->\n\n## 异常场景\n<!-- AI-FILL -->\n`);
2158
2200
  await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'TECH.md'), `${spec_skeleton_1.SKELETON_MARKER}\n# ${section.name} — ${platformLabel} 技术方案\n\n> 本文件由 CLI 预创建,请用 Write 工具覆盖为专业技术方案。\n\n## 接口定义\n<!-- AI-FILL: 请求/响应结构体 -->\n\n## 数据模型\n<!-- AI-FILL: 字段/类型/约束 -->\n\n## 核心逻辑\n<!-- AI-FILL -->\n\n## 依赖说明\n<!-- AI-FILL -->\n`);
2159
- const adr = generateAdr(section);
2160
- if (adr) {
2161
- await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'ADR.md'), adr);
2201
+ if (docSet.hasAdr) {
2202
+ const adr = generateAdr(section);
2203
+ if (adr) {
2204
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(subtaskDir, 'ADR.md'), adr);
2205
+ }
2162
2206
  }
2163
2207
  };
2164
2208
  // ── 所有端平铺:{端名}/{子任务}/ (v6.49.2+ 统一架构)──
@@ -2213,14 +2257,17 @@ ${isBk ? apiList : pageList}
2213
2257
  - REQ.md → ../../../00-specs/REQ.md
2214
2258
  - TECH.md → ../../../00-specs/TECH.md
2215
2259
  `);
2216
- // 自动补充的后端也需要执行产出文档
2260
+ // 自动补充的后端也需要执行产出文档(按任务类型裁剪)
2217
2261
  await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'TEST.md'), generateTestOutline(section, testMaterial));
2218
- await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'REVIEW.md'), generateReviewChecklist(section, reviewMaterial));
2219
- await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'DEPLOY.md'), generateDeployChecklist(section, deployMaterial));
2262
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'REVIEW.md'), generateReviewChecklist(section));
2263
+ if (docSet.hasDeploy)
2264
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'DEPLOY.md'), generateDeployChecklist(section));
2220
2265
  await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'ERROR_CODES.md'), generateErrorCodes(section));
2221
- await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'RISK.md'), generateRiskTemplate(section, riskMaterial));
2266
+ if (docSet.hasRisk)
2267
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'RISK.md'), generateRiskTemplate(section, riskMaterial));
2222
2268
  await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'DEPS.md'), generateDepsTemplate(section, depsMaterial));
2223
- await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'MONITOR.md'), generateMonitorTemplate(section, monitorMaterial));
2269
+ if (docSet.hasMonitor)
2270
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(autoSubtaskDir, 'MONITOR.md'), generateMonitorTemplate(section, monitorMaterial));
2224
2271
  taskPlatforms.push(fallbackBackend);
2225
2272
  subtaskIdMap.set(fallbackBackend, `${taskId}-${fallbackBackend}-auto`);
2226
2273
  }
@@ -2236,7 +2283,7 @@ ${isBk ? apiList : pageList}
2236
2283
  ? `020-specs/${sourceFile}`
2237
2284
  : `020-specs/${taskType === 'feature' ? 'features' : taskType === 'bugfix' ? 'bugs' : taskType === 'refactor' ? 'refactors' : 'research'}/${topic}.md`;
2238
2285
  // 任务类型中文标签
2239
- const typeLabels = { feature: '功能开发', bugfix: '缺陷修复', refactor: '重构优化', research: '技术调研', security: '安全修复', performance: '性能优化' };
2286
+ const typeLabels = { feature: '功能开发', bugfix: '缺陷修复', refactor: '重构优化', research: '技术调研' };
2240
2287
  const typeLabel = typeLabels[taskType] || taskType;
2241
2288
  // 收集同迭代的其它任务(用于关联关系)
2242
2289
  const relatedTasks = allSections
@@ -2322,8 +2369,8 @@ async function updateProjectGraph(iterationDir, sections) {
2322
2369
  * 根据需求内容自动生成测试用例框架
2323
2370
  */
2324
2371
  function generateTestOutline(section, material) {
2325
- // v6.79.0+: 降低阈值,让更多 analyze 内容被使用
2326
- if (material && material.trim().length > 10) {
2372
+ // v8.3.239+: 阈值统一 200 字符,低质量提取片段不再替换内容感知模板
2373
+ if (material && material.trim().length > 200) {
2327
2374
  return `# ${section.name} — 测试用例\n\n> 来源: analyze → TEST.md(自动提取)\n\n${material.trim()}\n`;
2328
2375
  }
2329
2376
  const name = section.name;
@@ -2394,7 +2441,8 @@ function extractApiRowsFromContent(content) {
2394
2441
  * 根据需求内容自动生成代码审查清单
2395
2442
  */
2396
2443
  function generateReviewChecklist(section, material) {
2397
- if (material && material.trim().length > 10) {
2444
+ // v8.3.239+: 阈值统一 200 字符(分析层暂无 REVIEW 提取源,material 恒空,走内容感知模板)
2445
+ if (material && material.trim().length > 200) {
2398
2446
  return `# ${section.name} — Code Review Checklist\n\n> 来源: analyze → REVIEW.md(自动提取)\n\n${material.trim()}\n`;
2399
2447
  }
2400
2448
  const name = section.name;
@@ -2592,7 +2640,7 @@ async function generateImpactGraph(iterationDir, sections, platforms) {
2592
2640
  }
2593
2641
  function generateSchemaTemplate(section, material) {
2594
2642
  const name = section.name;
2595
- if (material && material.trim().length > 30) {
2643
+ if (material && material.trim().length > 200) {
2596
2644
  return `# ${name} — Database Schema\n\n> 来源: analyze → TECH.md(自动提取)\n\n${material.trim()}\n`;
2597
2645
  }
2598
2646
  return `# ${name} — Database Schema
@@ -2633,7 +2681,8 @@ function generateSchemaTemplate(section, material) {
2633
2681
  `;
2634
2682
  }
2635
2683
  function generateDeployChecklist(section, material) {
2636
- if (material && material.trim().length > 10) {
2684
+ // v8.3.239+: 阈值统一 200 字符(分析层暂无 DEPLOY 提取源,material 恒空,走内容感知模板)
2685
+ if (material && material.trim().length > 200) {
2637
2686
  return `# ${section.name} — 部署检查清单\n\n> 来源: analyze → DEPLOY.md(自动提取)\n\n${material.trim()}\n`;
2638
2687
  }
2639
2688
  const name = section.name;
@@ -2642,7 +2691,7 @@ function generateDeployChecklist(section, material) {
2642
2691
 
2643
2692
  ## Pre-Deploy
2644
2693
 
2645
- - [ ] All tests pass (\`speccore lifecycle --task=${name} --check\`)
2694
+ - [ ] All tests pass (\`speccore verify\`)
2646
2695
  - [ ] Code review approved (REVIEW.md all checked)
2647
2696
  - [ ] PR merged to main
2648
2697
  - [ ] CI/CD pipeline green
@@ -2869,21 +2918,21 @@ function generateAcceptanceCriteria(section) {
2869
2918
  }
2870
2919
  // 风险评估
2871
2920
  function generateRiskTemplate(section, material) {
2872
- if (material && material.trim().length > 30) {
2921
+ if (material && material.trim().length > 200) {
2873
2922
  return `# ${section.name} — 风险评估\n\n> 来源: analyze → RISK.md(自动提取)\n\n${material.trim()}\n`;
2874
2923
  }
2875
2924
  return `# ${section.name} — 风险评估\n\n> split | ${new Date().toISOString().split('T')[0]}\n\n## 风险矩阵\n\n| 风险 | 可能 | 影响 | 缓解 |\n| :--- | :--- | :--- | :--- |\n| 兼容性 | 中 | 高 | 版本号+测试 |\n| 性能 | 低 | 中 | 压测+索引 |\n| 依赖故障 | 低 | 高 | 降级方案 |\n\n## 回滚\n\n1. 触发: 线上错误率 > 1%\n2. 步骤: git revert → 重部署\n3. 验证: 冒烟测试 + 监控\n`;
2876
2925
  }
2877
2926
  // 依赖清单
2878
2927
  function generateDepsTemplate(section, material) {
2879
- if (material && material.trim().length > 30) {
2928
+ if (material && material.trim().length > 200) {
2880
2929
  return `# ${section.name} — 依赖清单\n\n> 来源: analyze → DEPS.md(自动提取)\n\n${material.trim()}\n`;
2881
2930
  }
2882
2931
  return `# ${section.name} — 依赖清单\n\n## 上游依赖\n\n| 服务 | 版本 | 用途 | SLA |\n| :--- | :--- | :--- | :--- |\n| _待补充_ | — | — | — |\n\n## 下游影响\n\n| 服务 | 影响 | 通知 |\n| :--- | :--- | :--- |\n| _待补充_ | — | — |\n`;
2883
2932
  }
2884
2933
  // 监控指标
2885
2934
  function generateMonitorTemplate(section, material) {
2886
- if (material && material.trim().length > 30) {
2935
+ if (material && material.trim().length > 200) {
2887
2936
  return `# ${section.name} — 监控\n\n> 来源: analyze → MONITOR.md(自动提取)\n\n${material.trim()}\n`;
2888
2937
  }
2889
2938
  return `# ${section.name} — 监控\n\n## 关键指标\n\n| 指标 | 阈值 | 级别 |\n| :--- | :--- | :--- |\n| 成功率 | <99.9% | P1 |\n| P99延迟 | >1000ms | P2 |\n| 错误率 | >0.1% | P0 |\n\n## 关键日志\n\n- 请求入口 (traceId)\n- 业务异常 (上下文)\n- 外部调用 (耗时)\n`;
@@ -3146,7 +3195,7 @@ function extractTaskDevGuideContent(specContents, section, taskPlatforms) {
3146
3195
  }
3147
3196
  // 前端专属:组件树
3148
3197
  function generateComponentTree(section, platform, material) {
3149
- if (material && material.trim().length > 30) {
3198
+ if (material && material.trim().length > 200) {
3150
3199
  return `# ${section.name} — 组件树 (${platform})\n\n> 来源: analyze → TECH.md(自动提取)\n\n${material.trim()}\n`;
3151
3200
  }
3152
3201
  return `# ${section.name} — 组件树 (${platform})
@@ -3169,7 +3218,7 @@ function generateComponentTree(section, platform, material) {
3169
3218
  }
3170
3219
  // 前端专属:路由
3171
3220
  function generateRoutesDoc(section, platform, material) {
3172
- if (material && material.trim().length > 30) {
3221
+ if (material && material.trim().length > 200) {
3173
3222
  return `# ${section.name} — 路由设计 (${platform})\n\n> 来源: analyze → TECH.md(自动提取)\n\n${material.trim()}\n`;
3174
3223
  }
3175
3224
  return `# ${section.name} — 路由设计 (${platform})
@@ -3187,7 +3236,7 @@ function generateRoutesDoc(section, platform, material) {
3187
3236
  }
3188
3237
  // 前端专属:状态管理
3189
3238
  function generateStateDoc(section, platform, material) {
3190
- if (material && material.trim().length > 30) {
3239
+ if (material && material.trim().length > 200) {
3191
3240
  return `# ${section.name} — 状态管理 (${platform})\n\n> 来源: analyze → TECH.md(自动提取)\n\n${material.trim()}\n`;
3192
3241
  }
3193
3242
  return `# ${section.name} — 状态管理 (${platform})
@@ -3210,7 +3259,7 @@ function generateStateDoc(section, platform, material) {
3210
3259
  }
3211
3260
  // 前端专属:样式规范
3212
3261
  function generateStyleGuide(section, platform, material) {
3213
- if (material && material.trim().length > 30) {
3262
+ if (material && material.trim().length > 200) {
3214
3263
  return `# ${section.name} — 样式规范 (${platform})\n\n> 来源: analyze → TECH.md(自动提取)\n\n${material.trim()}\n`;
3215
3264
  }
3216
3265
  const isH5 = platform.includes('h5') || platform.includes('mobile');