soloforge 1.4.4 → 1.4.6

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.
Files changed (96) hide show
  1. package/README.md +6 -5
  2. package/dist/adapters/claude_code/tools.d.ts.map +1 -1
  3. package/dist/adapters/claude_code/tools.js +50 -12
  4. package/dist/adapters/claude_code/tools.js.map +1 -1
  5. package/dist/adapters/shared/workflow_template.js +1 -1
  6. package/dist/bin/soloforge.d.ts.map +1 -1
  7. package/dist/bin/soloforge.js +73 -16
  8. package/dist/bin/soloforge.js.map +1 -1
  9. package/dist/engine/backend_implementation_contract.js +1 -1
  10. package/dist/engine/code_maintainability_observability_contract.js +7 -7
  11. package/dist/engine/code_maintainability_observability_contract.js.map +1 -1
  12. package/dist/engine/consumption_trace_store.d.ts +9 -1
  13. package/dist/engine/consumption_trace_store.d.ts.map +1 -1
  14. package/dist/engine/consumption_trace_store.js +3 -0
  15. package/dist/engine/consumption_trace_store.js.map +1 -1
  16. package/dist/engine/design_artifact_pack.d.ts +2 -0
  17. package/dist/engine/design_artifact_pack.d.ts.map +1 -1
  18. package/dist/engine/design_artifact_pack.js +30 -17
  19. package/dist/engine/design_artifact_pack.js.map +1 -1
  20. package/dist/engine/design_lifecycle_contract.d.ts +60 -0
  21. package/dist/engine/design_lifecycle_contract.d.ts.map +1 -0
  22. package/dist/engine/design_lifecycle_contract.js +499 -0
  23. package/dist/engine/design_lifecycle_contract.js.map +1 -0
  24. package/dist/engine/diagnostic_registry.js +2 -2
  25. package/dist/engine/diagnostic_registry.js.map +1 -1
  26. package/dist/engine/foundation_scenario_registry.js +2 -2
  27. package/dist/engine/foundation_scenario_registry.js.map +1 -1
  28. package/dist/engine/foundation_scenario_runners.js +9 -9
  29. package/dist/engine/foundation_scenario_runners.js.map +1 -1
  30. package/dist/engine/historical_issue_mechanization_matrix.js +1 -1
  31. package/dist/engine/historical_issue_mechanization_matrix.js.map +1 -1
  32. package/dist/engine/implementation_roadmap_registry.js +2 -2
  33. package/dist/engine/implementation_roadmap_registry.js.map +1 -1
  34. package/dist/engine/input_material_extractor.js +1 -1
  35. package/dist/engine/input_material_extractor.js.map +1 -1
  36. package/dist/engine/intent_expander.d.ts.map +1 -1
  37. package/dist/engine/intent_expander.js +38 -15
  38. package/dist/engine/intent_expander.js.map +1 -1
  39. package/dist/engine/knowledge_asset_consumer.d.ts.map +1 -1
  40. package/dist/engine/knowledge_asset_consumer.js +21 -13
  41. package/dist/engine/knowledge_asset_consumer.js.map +1 -1
  42. package/dist/engine/knowledge_injection_boundary.d.ts +2 -2
  43. package/dist/engine/knowledge_injection_boundary.d.ts.map +1 -1
  44. package/dist/engine/knowledge_injection_boundary.js +19 -7
  45. package/dist/engine/knowledge_injection_boundary.js.map +1 -1
  46. package/dist/engine/lifecycle_knowledge_contract.d.ts +59 -0
  47. package/dist/engine/lifecycle_knowledge_contract.d.ts.map +1 -0
  48. package/dist/engine/lifecycle_knowledge_contract.js +203 -0
  49. package/dist/engine/lifecycle_knowledge_contract.js.map +1 -0
  50. package/dist/engine/next_action_planner.d.ts.map +1 -1
  51. package/dist/engine/next_action_planner.js +142 -37
  52. package/dist/engine/next_action_planner.js.map +1 -1
  53. package/dist/engine/observed_consumption.d.ts.map +1 -1
  54. package/dist/engine/observed_consumption.js +2 -1
  55. package/dist/engine/observed_consumption.js.map +1 -1
  56. package/dist/engine/project_knowledge_contract.d.ts +75 -1
  57. package/dist/engine/project_knowledge_contract.d.ts.map +1 -1
  58. package/dist/engine/project_knowledge_contract.js +289 -33
  59. package/dist/engine/project_knowledge_contract.js.map +1 -1
  60. package/dist/engine/regression_matrix.js +1 -1
  61. package/dist/engine/regression_matrix.js.map +1 -1
  62. package/dist/engine/release_issue_scenario_registry.d.ts.map +1 -1
  63. package/dist/engine/release_issue_scenario_registry.js +15 -12
  64. package/dist/engine/release_issue_scenario_registry.js.map +1 -1
  65. package/dist/engine/release_readiness_gate.d.ts.map +1 -1
  66. package/dist/engine/release_readiness_gate.js +183 -54
  67. package/dist/engine/release_readiness_gate.js.map +1 -1
  68. package/dist/engine/stale_current_task_detector.d.ts +1 -1
  69. package/dist/engine/stale_current_task_detector.js +4 -4
  70. package/dist/engine/stale_current_task_detector.js.map +1 -1
  71. package/dist/engine/task_context.d.ts.map +1 -1
  72. package/dist/engine/task_context.js +2 -0
  73. package/dist/engine/task_context.js.map +1 -1
  74. package/dist/engine/traceability.d.ts +2 -2
  75. package/dist/engine/traceability.d.ts.map +1 -1
  76. package/dist/engine/traceability.js +86 -16
  77. package/dist/engine/traceability.js.map +1 -1
  78. package/dist/engine/workflow_navigation_contract.d.ts +11 -0
  79. package/dist/engine/workflow_navigation_contract.d.ts.map +1 -1
  80. package/dist/engine/workspace_resumer.d.ts.map +1 -1
  81. package/dist/engine/workspace_resumer.js +2 -1
  82. package/dist/engine/workspace_resumer.js.map +1 -1
  83. package/dist/knowledge/conflict_detector.d.ts +1 -1
  84. package/dist/knowledge/conflict_detector.d.ts.map +1 -1
  85. package/dist/knowledge/conflict_detector.js +88 -2
  86. package/dist/knowledge/conflict_detector.js.map +1 -1
  87. package/dist/types.d.ts +14 -0
  88. package/dist/types.d.ts.map +1 -1
  89. package/package.json +1 -1
  90. package/templates/knowledge/acceptance_templates//344/273/243/347/240/201/346/263/250/351/207/212/344/270/216/346/227/245/345/277/227/351/252/214/346/224/266/346/250/241/346/235/277.md +1 -1
  91. package/templates/knowledge/acceptance_templates//345/216/237/345/236/213/350/257/264/346/230/216/346/250/241/347/211/210.md +6 -6
  92. package/templates/knowledge/acceptance_templates//351/234/200/346/261/202/345/216/237/345/236/213/350/256/276/350/256/241/345/256/236/347/216/260/350/277/275/350/270/252/347/237/251/351/230/265/346/250/241/347/211/210.md +25 -20
  93. package/templates/knowledge/procedures//346/272/220/347/240/201/345/216/237/345/236/213/344/272/244/344/273/230/346/265/201/347/250/213.md +8 -5
  94. package/templates/knowledge/procedures//350/257/246/347/273/206/350/256/276/350/256/241/346/265/201/347/250/213.md +19 -6
  95. package/templates/knowledge/rules//344/273/243/347/240/201/346/263/250/351/207/212/344/270/216/346/227/245/345/277/227/345/245/221/347/272/246/350/247/204/345/210/231.md +4 -4
  96. package/templates/knowledge/rules//350/256/276/350/256/241/344/272/247/347/211/251/345/214/205/350/247/204/345/210/231.md +16 -0
@@ -109,7 +109,7 @@ export function validateWorkflowRuleSources(rootDir) {
109
109
  };
110
110
  }
111
111
  /** 当前嵌入的权威规则校验和 — 由 `npm run update-workflow-checksum` 更新。 */
112
- const EMBEDDED_CHECKSUM = "3620b50bb23320b5";
112
+ const EMBEDDED_CHECKSUM = "1329a153ea580993";
113
113
  function getEmbeddedChecksum() {
114
114
  return EMBEDDED_CHECKSUM;
115
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"soloforge.d.ts","sourceRoot":"","sources":["../../src/bin/soloforge.ts"],"names":[],"mappings":";AAqgCA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC"}
1
+ {"version":3,"file":"soloforge.d.ts","sourceRoot":"","sources":["../../src/bin/soloforge.ts"],"names":[],"mappings":";AAshCA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC"}
@@ -18,6 +18,7 @@ import { isReadForbidden } from "../engine/privacy_secret_contract.js";
18
18
  import { routeIntent } from "../engine/intent_router.js";
19
19
  import { debugLog, debug, userInfo, userWarn, userError, internalWarn, jsonSafeError, initLoggerFromEnv } from "../engine/logger.js";
20
20
  import { auditControlPlaneProject, isSoloforgeStateBypassCommand } from "../engine/control_plane_contract.js";
21
+ import { getDesignLifecycleArtifactPaths } from "../engine/design_lifecycle_contract.js";
21
22
  const command = process.argv[2];
22
23
  const args = process.argv.slice(3);
23
24
  async function main() {
@@ -741,9 +742,24 @@ function isImplementationSourcePath(relativeFilePath) {
741
742
  return /\.(?:java|kt|kts|scala|ts|tsx|js|jsx|mjs|cjs|py|go|rs|php|rb|cs|swift|vue|svelte|sql|xml|yml|yaml|properties)$/.test(relativeFilePath);
742
743
  }
743
744
  function isDesignArtifactPath(relativeFilePath) {
745
+ const lifecyclePaths = getDesignLifecycleArtifactPaths();
746
+ if ([
747
+ lifecyclePaths.decision_record,
748
+ lifecyclePaths.architecture_document,
749
+ lifecyclePaths.database_document,
750
+ lifecyclePaths.api_document,
751
+ lifecyclePaths.optional_detail_design_document,
752
+ lifecyclePaths.slice_plan,
753
+ lifecyclePaths.consistency_report,
754
+ lifecyclePaths.traceability_matrix,
755
+ lifecyclePaths.openapi,
756
+ ].includes(relativeFilePath))
757
+ return true;
744
758
  return /^docs\/architecture\//.test(relativeFilePath) ||
759
+ /^docs\/traceability\//.test(relativeFilePath) ||
745
760
  /^docs\/api\/openapi\.(?:ya?ml|json)$/.test(relativeFilePath) ||
746
- /^db\/(?:migrations|schema)\//.test(relativeFilePath);
761
+ /^db\/(?:migrations?|schema|changelog)\//.test(relativeFilePath) ||
762
+ /(?:^|\/)(?:src\/main\/resources\/)?db\/(?:migrations?|schema|changelog)\//.test(relativeFilePath);
747
763
  }
748
764
  function denyPreToolUse(reason) {
749
765
  process.stdout.write(JSON.stringify({
@@ -776,23 +792,25 @@ async function evaluateImplementationWriteGate(projectPath, relativeFilePath) {
776
792
  return "检测到项目已有设计产物,但当前任务缺少 design_artifact_pack 复验状态。不得取消任务后直接写业务实现,不得改用 Bash 绕过;请先运行 soloforge audit-design-artifacts,并通过 sf_expand/sf_verify 绑定设计产物包。";
777
793
  }
778
794
  if (designPack && designPack.status !== "implementation_ready") {
779
- return `设计产物包状态为 ${designPack.status},不得改用 Bash/Edit/Write 绕过设计复验;请先完善 docs/architecture、docs/api/openapi 或 db/migrations|schema 并通过复验,再写入业务实现`;
795
+ return `设计产物包状态为 ${designPack.status},不得改用 Bash/Edit/Write 绕过设计复验;请先完善 docs/architecture、docs/traceability、docs/api/openapi 或 db/migration|migrations|schema|changelog 并通过复验,再写入业务实现`;
780
796
  }
781
797
  return undefined;
782
798
  }
783
799
  function hasDesignArtifacts(projectPath) {
800
+ const lifecyclePaths = getDesignLifecycleArtifactPaths();
784
801
  const candidates = [
785
- path.join(projectPath, "docs", "architecture", "00-架构决策记录.md"),
786
- path.join(projectPath, "docs", "architecture", "01-架构设计文档.md"),
787
- path.join(projectPath, "docs", "architecture", "02-数据库设计文档.md"),
788
- path.join(projectPath, "docs", "architecture", "03-API接口规格文档.md"),
789
- path.join(projectPath, "docs", "architecture", "04-详细设计文档.md"),
790
- path.join(projectPath, "docs", "architecture", "99-设计一致性验收报告.md"),
791
- path.join(projectPath, "docs", "api", "openapi.yaml"),
802
+ lifecyclePaths.decision_record,
803
+ lifecyclePaths.architecture_document,
804
+ lifecyclePaths.database_document,
805
+ lifecyclePaths.api_document,
806
+ lifecyclePaths.optional_detail_design_document,
807
+ lifecyclePaths.slice_plan,
808
+ lifecyclePaths.consistency_report,
809
+ lifecyclePaths.traceability_matrix,
810
+ lifecyclePaths.openapi,
792
811
  path.join(projectPath, "docs", "api", "openapi.yml"),
793
- path.join(projectPath, "db", "migrations"),
794
- path.join(projectPath, "db", "migration"),
795
- ];
812
+ ...lifecyclePaths.sql_roots,
813
+ ].map((candidate) => path.join(projectPath, candidate));
796
814
  return candidates.some((candidate) => fss.existsSync(candidate));
797
815
  }
798
816
  async function cmdPostBash() {
@@ -1058,6 +1076,7 @@ async function cmdValidate() {
1058
1076
  }
1059
1077
  // 使用共享函数验证配置优先级
1060
1078
  let hasHardFail = false;
1079
+ const hardFailSources = new Set();
1061
1080
  try {
1062
1081
  const { reports, entries } = await resolveCurrentProjectConfigReports(projectPath);
1063
1082
  const findings = validateConfigPrecedence(reports, entries);
@@ -1065,6 +1084,7 @@ async function cmdValidate() {
1065
1084
  const advisory = findings.filter(f => f.severity === "advisory");
1066
1085
  if (hardFails.length > 0) {
1067
1086
  hasHardFail = true;
1087
+ hardFailSources.add("配置优先级");
1068
1088
  userInfo(`❌ 配置优先级: ${hardFails.length} hard_fail`);
1069
1089
  for (const f of hardFails) {
1070
1090
  userInfo(` - [${f.rule}] ${f.field_path ?? "N/A"}: ${f.message}`);
@@ -1099,6 +1119,7 @@ async function cmdValidate() {
1099
1119
  userInfo(` - [${f.kind}] ${f.message_zh}`);
1100
1120
  }
1101
1121
  hasHardFail = true;
1122
+ hardFailSources.add("知识治理");
1102
1123
  }
1103
1124
  else {
1104
1125
  userInfo(`✅ 知识治理检查: ${kgReport.warning_count} warning, 0 hard_fail`);
@@ -1137,6 +1158,7 @@ async function cmdValidate() {
1137
1158
  }
1138
1159
  }
1139
1160
  hasHardFail = true;
1161
+ hardFailSources.add("项目知识承载");
1140
1162
  }
1141
1163
  else {
1142
1164
  userInfo(`✅ 项目知识承载: ${pkReport.total} 条,${pkReport.injectable} 条可注入,${pkReport.index_only} 条仅索引,0 hard_fail`);
@@ -1151,6 +1173,7 @@ async function cmdValidate() {
1151
1173
  for (const v of extResult.violations)
1152
1174
  userInfo(` - ${v}`);
1153
1175
  hasHardFail = true;
1176
+ hardFailSources.add("扩展清单");
1154
1177
  }
1155
1178
  else {
1156
1179
  userInfo(" ✓ 扩展清单校验通过");
@@ -1176,6 +1199,7 @@ async function cmdValidate() {
1176
1199
  if (platformReport.platform_compatibility_status === "blocked") {
1177
1200
  userInfo(` ✗ 平台兼容性阻断: ${platformReport.issues_found.join(", ")}`);
1178
1201
  hasHardFail = true;
1202
+ hardFailSources.add("平台兼容性");
1179
1203
  }
1180
1204
  else {
1181
1205
  userInfo(` ✓ 平台兼容性检查: ${platformReport.platform_compatibility_status}`);
@@ -1202,6 +1226,7 @@ async function cmdValidate() {
1202
1226
  for (const hf of hardFails)
1203
1227
  userInfo(` - ${hf.message_zh}`);
1204
1228
  hasHardFail = true;
1229
+ hardFailSources.add("README 命令漂移");
1205
1230
  }
1206
1231
  else if (warnings.length > 0) {
1207
1232
  userInfo(" ⚠ README 命令漂移警告:");
@@ -1273,6 +1298,7 @@ async function cmdValidate() {
1273
1298
  if (tsHardFail) {
1274
1299
  userError(`❌ 测试策略覆盖验证失败: ${tsChecked} 个已检查, ${tsPending} 个元数据缺失`);
1275
1300
  hasHardFail = true;
1301
+ hardFailSources.add("测试策略覆盖");
1276
1302
  }
1277
1303
  else {
1278
1304
  userInfo(`✅ 测试策略覆盖: 已检查 ${tsChecked} 个 enforced 契约`);
@@ -1281,6 +1307,7 @@ async function cmdValidate() {
1281
1307
  catch (e) {
1282
1308
  userError(`❌ 测试策略验证异常: ${e.message}`);
1283
1309
  hasHardFail = true;
1310
+ hardFailSources.add("测试策略覆盖");
1284
1311
  }
1285
1312
  } // 双层机制检查结束
1286
1313
  try {
@@ -1296,7 +1323,8 @@ async function cmdValidate() {
1296
1323
  userInfo(` ⚠ 导航摘要异常: ${e instanceof Error ? e.message : String(e)}`);
1297
1324
  }
1298
1325
  if (hasHardFail) {
1299
- userError("❌ validate 失败: 配置优先级存在 hard_fail");
1326
+ const sources = hardFailSources.size > 0 ? Array.from(hardFailSources).join("、") : "校验项";
1327
+ userError(`❌ validate 失败: ${sources} 存在 hard_fail`);
1300
1328
  process.exit(1);
1301
1329
  }
1302
1330
  }
@@ -2498,7 +2526,20 @@ async function cmdNext() {
2498
2526
  if (plan.project_knowledge_context.selected.length > 0) {
2499
2527
  userInfo(" 下一步会优先参考:");
2500
2528
  for (const item of plan.project_knowledge_context.selected) {
2501
- userInfo(` - ${item.name} (${item.rel_path}, ${item.consumption})`);
2529
+ userInfo(` - ${item.name} (${item.rel_path}, ${item.enforcement ?? item.consumption})`);
2530
+ if (item.reason_zh)
2531
+ userInfo(` 原因: ${item.reason_zh}`);
2532
+ if (item.verification_command)
2533
+ userInfo(` 复验: ${item.verification_command}`);
2534
+ }
2535
+ }
2536
+ if (plan.project_knowledge_context.blocked && plan.project_knowledge_context.blocked.length > 0) {
2537
+ userInfo(" 必须先处理:");
2538
+ for (const item of plan.project_knowledge_context.blocked) {
2539
+ userInfo(` - ${item.name} (${item.rel_path})`);
2540
+ userInfo(` 原因: ${item.reason_zh}`);
2541
+ if (item.recovery)
2542
+ userInfo(` 恢复: ${item.recovery}`);
2502
2543
  }
2503
2544
  }
2504
2545
  }
@@ -2912,14 +2953,30 @@ async function cmdAuditProjectKnowledge() {
2912
2953
  userInfo(` hard_fail: ${report.hard_fail_count}`);
2913
2954
  userInfo(` warning: ${report.warning_count}`);
2914
2955
  for (const asset of report.assets) {
2915
- if (asset.findings.length === 0)
2916
- continue;
2917
2956
  userInfo(` - ${asset.rel_path} (${asset.identity}/${asset.consumption})`);
2957
+ userInfo(` 创建: ${asset.evidence.created_by};索引: ${asset.evidence.indexed_by}`);
2958
+ if (asset.lifecycle_stages.length > 0)
2959
+ userInfo(` 阶段: ${asset.lifecycle_stages.join(", ")}`);
2960
+ if (asset.path_patterns.length > 0)
2961
+ userInfo(` 路径: ${asset.path_patterns.join(", ")}`);
2962
+ if (asset.traceability_ids.length > 0)
2963
+ userInfo(` 追踪: ${asset.traceability_ids.join(", ")}`);
2964
+ if (asset.verification_commands.length > 0)
2965
+ userInfo(` 复验: ${asset.verification_commands.join(" / ")}`);
2966
+ if (asset.evidence.last_consumed_at) {
2967
+ userInfo(` 最近消费: ${asset.evidence.last_consumption_consumer}/${asset.evidence.last_consumption_action} ${asset.evidence.last_consumed_task} @ ${asset.evidence.last_consumed_at}`);
2968
+ }
2918
2969
  for (const finding of asset.findings) {
2919
2970
  const mark = finding.severity === "hard_fail" ? "❌" : finding.severity === "warning" ? "⚠️" : "ℹ️";
2920
2971
  userInfo(` ${mark} [${finding.code}] ${finding.message_zh}`);
2921
2972
  }
2922
2973
  }
2974
+ if (report.recent_consumption.length > 0) {
2975
+ userInfo(" 最近消费证据:");
2976
+ for (const item of report.recent_consumption.slice(0, 10)) {
2977
+ userInfo(` - ${item.rel_path ?? item.asset_id}: ${item.consumer}/${item.action ?? "unknown"} ${item.lifecycle_stage ?? "unknown_stage"} ${item.task_id_or_route} ${item.decision ?? ""}`);
2978
+ }
2979
+ }
2923
2980
  if (report.recommended_next_steps.length > 0) {
2924
2981
  userInfo(" 下一步:");
2925
2982
  for (const step of report.recommended_next_steps)