@chongyan/autospec 1.0.1 → 1.0.2

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 (283) hide show
  1. package/LICENSE +21 -21
  2. package/README.en.md +447 -321
  3. package/README.md +418 -286
  4. package/knowledge/01-principles/00-principles-hierarchy.md +247 -0
  5. package/knowledge/01-principles/01-first-principles.md +241 -0
  6. package/knowledge/01-principles/02-strategic-principles.md +286 -0
  7. package/knowledge/01-principles/03-tactical-principles.md +385 -0
  8. package/knowledge/01-principles/04-operational-principles.md +275 -0
  9. package/knowledge/01-principles/05-domain-principles.md +539 -0
  10. package/knowledge/01-principles/06-methodology-principles.md +281 -0
  11. package/knowledge/01-principles/07-cognitive-principles.md +277 -0
  12. package/knowledge/01-principles/08-auto-fix-principles.md +320 -0
  13. package/knowledge/01-principles/09-constitution.md +220 -0
  14. package/knowledge/{principles/evolution.md → 01-principles/10-evolution-mechanism.md} +160 -14
  15. package/knowledge/01-principles/README.en.md +385 -0
  16. package/knowledge/01-principles/README.md +385 -0
  17. package/knowledge/{process/overview.md → 02-process/00-overview.md} +90 -5
  18. package/knowledge/02-process/README.en.md +143 -0
  19. package/knowledge/02-process/README.md +186 -0
  20. package/knowledge/{guides/support/pipeline-protocol.md → 03-guides/00-pipeline-protocol.md} +10 -10
  21. package/knowledge/{guides/support/team-orchestrator.md → 03-guides/01-team-orchestrator.md} +53 -8
  22. package/knowledge/{guides/stages/requirement-analyzer.md → 03-guides/02-analyze-requirement.md} +3 -3
  23. package/knowledge/{guides/stages/ai-effect-evaluator.md → 03-guides/08-evaluate-ai-effect.md} +14 -7
  24. package/knowledge/{guides/support/skill-distiller.md → 03-guides/19-distill-skill.md} +3 -3
  25. package/knowledge/{guides/support/skill-updater.md → 03-guides/20-update-skill.md} +1 -1
  26. package/knowledge/{guides/support/methodology-extractor.md → 03-guides/22-extract-methodology.md} +2 -2
  27. package/knowledge/{guides/support/complexity-assessor.md → 03-guides/24-assess-complexity.md} +6 -4
  28. package/knowledge/{guides/support/tech-stack-analyzer.md → 03-guides/26-analyze-tech-stack.md} +1 -1
  29. package/knowledge/{guides/domain-driven-design.md → 03-guides/42-apply-ddd.md} +1 -1
  30. package/knowledge/{process/ai-sdlc.md → 03-guides/43-run-ai-sdlc.md} +1 -1
  31. package/knowledge/{guides/knowledge-management.md → 03-guides/44-manage-knowledge.md} +4 -4
  32. package/knowledge/03-guides/README.en.md +212 -0
  33. package/knowledge/03-guides/README.md +212 -0
  34. package/knowledge/{checklists/requirement.md → 04-checklists/00-requirement.md} +1 -1
  35. package/knowledge/{checklists/design.md → 04-checklists/01-design.md} +1 -1
  36. package/knowledge/{checklists/code.md → 04-checklists/02-code.md} +16 -1
  37. package/knowledge/{checklists/release.md → 04-checklists/04-release.md} +1 -1
  38. package/knowledge/04-checklists/README.en.md +119 -0
  39. package/knowledge/04-checklists/README.md +123 -0
  40. package/knowledge/{config/validation-patterns.yaml → 05-config/00-validation-patterns.yaml} +1 -1
  41. package/knowledge/{config/team-tasks.yaml → 05-config/02-team-tasks.yaml} +2 -2
  42. package/knowledge/05-config/03-role-composition.yaml +346 -0
  43. package/knowledge/{config/skill-compositions.yaml → 05-config/05-skill-compositions.yaml} +24 -24
  44. package/knowledge/05-config/README.en.md +54 -0
  45. package/knowledge/05-config/README.md +132 -0
  46. package/knowledge/06-environment/00-template-registry.md +310 -0
  47. package/knowledge/06-environment/01-detection-patterns.yaml +1692 -0
  48. package/knowledge/{environment → 06-environment}/README.en.md +4 -0
  49. package/knowledge/{environment → 06-environment}/README.md +66 -25
  50. package/knowledge/{standards/coding-style.md → 07-standards/00-coding-style.md} +123 -4
  51. package/knowledge/{standards/code-review.md → 07-standards/01-code-review.md} +3 -3
  52. package/knowledge/{standards/data-consistency.md → 07-standards/02-data-consistency.md} +1 -1
  53. package/knowledge/{standards/document-versioning.md → 07-standards/03-document-versioning.md} +1 -1
  54. package/knowledge/{standards/risk-detection.md → 07-standards/04-risk-detection.md} +5 -5
  55. package/knowledge/07-standards/README.en.md +119 -0
  56. package/knowledge/07-standards/README.md +123 -0
  57. package/knowledge/08-organization/00-vision-mission.md +113 -0
  58. package/knowledge/{organization/ai-native-team.md → 08-organization/01-ai-native-culture.md} +1 -1
  59. package/knowledge/{organization/team-metrics.md → 08-organization/02-team-metrics.md} +1 -1
  60. package/knowledge/08-organization/03-committee-structure.md +54 -0
  61. package/knowledge/08-organization/04-governance-metrics.md +55 -0
  62. package/knowledge/08-organization/05-improvement-process.md +71 -0
  63. package/knowledge/08-organization/README.en.md +165 -0
  64. package/knowledge/08-organization/README.md +165 -0
  65. package/knowledge/09-templates/00-requirement-proposal.md +344 -0
  66. package/knowledge/09-templates/01-architecture-design.md +494 -0
  67. package/knowledge/09-templates/02-api-design.md +408 -0
  68. package/knowledge/09-templates/03-database-design.md +313 -0
  69. package/knowledge/09-templates/04-product-design.md +237 -0
  70. package/knowledge/09-templates/05-domain-business.md +388 -0
  71. package/knowledge/09-templates/06-test-design.md +268 -0
  72. package/knowledge/09-templates/07-evaluation-design.md +372 -0
  73. package/knowledge/09-templates/08-component-knowledge.md +272 -0
  74. package/knowledge/09-templates/09-best-practices.md +218 -0
  75. package/knowledge/{environment/middleware-knowledge.md → 09-templates/10-middleware-knowledge.md} +106 -1
  76. package/knowledge/09-templates/README.en.md +222 -0
  77. package/knowledge/09-templates/README.md +216 -0
  78. package/knowledge/README.en.md +372 -0
  79. package/knowledge/README.md +354 -99
  80. package/package.json +1 -1
  81. package/plugins/.claude-plugin/plugin.json +460 -81
  82. package/plugins/agents/roles/ceo.md +1 -1
  83. package/plugins/agents/roles/product-owner.md +1 -1
  84. package/plugins/agents/roles/tech-lead.md +1 -1
  85. package/plugins/agents/support/consistency-checker.md +36 -3
  86. package/plugins/agents/support/monitoring-agent.md +215 -0
  87. package/plugins/agents/support/safety-auditor.md +2 -2
  88. package/plugins/agents/support/stage-gate-evaluator.md +95 -11
  89. package/plugins/agents/support/test-coverage-reviewer.md +1 -1
  90. package/plugins/benchmarks/templates/README.md +165 -13
  91. package/plugins/benchmarks/templates/commands/apply-template.yaml +108 -0
  92. package/plugins/benchmarks/templates/commands/archive-template.yaml +65 -0
  93. package/plugins/benchmarks/templates/commands/env-export-template.yaml +64 -0
  94. package/plugins/benchmarks/templates/commands/env-sync-template.yaml +104 -0
  95. package/plugins/benchmarks/templates/commands/env-template-template.yaml +96 -0
  96. package/plugins/benchmarks/templates/commands/env-template.yaml +58 -0
  97. package/plugins/benchmarks/templates/commands/env-update-template.yaml +110 -0
  98. package/plugins/benchmarks/templates/commands/env-validate-template.yaml +95 -0
  99. package/plugins/benchmarks/templates/commands/field-evolve-template.yaml +104 -0
  100. package/plugins/benchmarks/templates/commands/project-evolve-template.yaml +104 -0
  101. package/plugins/benchmarks/templates/commands/propose-template.yaml +88 -0
  102. package/plugins/benchmarks/templates/commands/review-template.yaml +124 -0
  103. package/plugins/benchmarks/templates/commands/run-template.yaml +127 -0
  104. package/plugins/benchmarks/templates/commands/test-template.yaml +149 -0
  105. package/plugins/benchmarks/templates/pipeline/experiment-template.yaml +92 -0
  106. package/plugins/benchmarks/templates/pipeline/hotfix-template.yaml +81 -0
  107. package/plugins/benchmarks/templates/skills/agile-iteration-template.yaml +78 -0
  108. package/plugins/benchmarks/templates/skills/benchmark-executor-template.yaml +114 -0
  109. package/plugins/benchmarks/templates/skills/benchmark-generator-template.yaml +52 -0
  110. package/plugins/benchmarks/templates/skills/delivery-stage-template.yaml +130 -0
  111. package/plugins/benchmarks/templates/skills/design-stage-template.yaml +131 -0
  112. package/plugins/benchmarks/templates/skills/experiment-iteration-template.yaml +60 -0
  113. package/plugins/benchmarks/templates/skills/exploration-phase-template.yaml +114 -0
  114. package/plugins/benchmarks/templates/skills/field-evolve-analyzer-template.yaml +51 -0
  115. package/plugins/benchmarks/templates/skills/field-evolve-distiller-template.yaml +34 -0
  116. package/plugins/benchmarks/templates/skills/field-evolve-executor-template.yaml +50 -0
  117. package/plugins/benchmarks/templates/skills/field-evolve-fixer-template.yaml +52 -0
  118. package/plugins/benchmarks/templates/skills/field-evolve-learner-template.yaml +33 -0
  119. package/plugins/benchmarks/templates/skills/field-evolve-scanner-template.yaml +74 -0
  120. package/plugins/benchmarks/templates/skills/field-evolve-template.yaml +71 -0
  121. package/plugins/benchmarks/templates/skills/field-evolve-verifier-template.yaml +51 -0
  122. package/plugins/benchmarks/templates/skills/hotfix-iteration-template.yaml +54 -0
  123. package/plugins/benchmarks/templates/skills/implementation-stage-template.yaml +127 -0
  124. package/plugins/benchmarks/templates/skills/layer1-validation-template.yaml +121 -0
  125. package/plugins/benchmarks/templates/skills/project-evolve-analyzer-template.yaml +51 -0
  126. package/plugins/benchmarks/templates/skills/project-evolve-fixer-template.yaml +52 -0
  127. package/plugins/benchmarks/templates/skills/project-evolve-generator-template.yaml +34 -0
  128. package/plugins/benchmarks/templates/skills/project-evolve-learner-template.yaml +50 -0
  129. package/plugins/benchmarks/templates/skills/project-evolve-reviewer-template.yaml +50 -0
  130. package/plugins/benchmarks/templates/skills/project-evolve-scanner-template.yaml +75 -0
  131. package/plugins/benchmarks/templates/skills/project-evolve-template.yaml +72 -0
  132. package/plugins/benchmarks/templates/skills/project-evolve-verifier-template.yaml +51 -0
  133. package/plugins/benchmarks/templates/skills/skill-forge-template.yaml +117 -0
  134. package/plugins/benchmarks/templates/skills/startup-guard-template.yaml +103 -0
  135. package/plugins/benchmarks/templates/skills/testing-stage-template.yaml +146 -0
  136. package/plugins/benchmarks/templates/skills/waterfall-iteration-template.yaml +55 -0
  137. package/plugins/commands/README.en.md +2 -2
  138. package/plugins/commands/README.md +2 -2
  139. package/plugins/commands/apply.md +102 -16
  140. package/plugins/commands/archive.md +60 -4
  141. package/plugins/commands/env-sync.md +1047 -406
  142. package/plugins/commands/env-template.md +11 -135
  143. package/plugins/commands/env-update.md +1 -1
  144. package/plugins/commands/env-validate.md +3 -3
  145. package/plugins/commands/explore.md +118 -1
  146. package/plugins/commands/field-evolve.md +51 -175
  147. package/plugins/commands/project-evolve.md +167 -68
  148. package/plugins/commands/propose.md +97 -6
  149. package/plugins/commands/review.md +5 -5
  150. package/plugins/commands/run.md +841 -13
  151. package/plugins/commands/status.md +138 -17
  152. package/plugins/commands/test.md +389 -0
  153. package/plugins/hooks/constitution-guard.js +1 -1
  154. package/plugins/hooks/environment-autocommit.js +366 -24
  155. package/plugins/hooks/environment-manager.js +3 -2
  156. package/plugins/hooks/execution-tracker.js +109 -4
  157. package/plugins/hooks/layer1-validator.js +117 -1
  158. package/plugins/hooks/lib/auto-fix-loop.js +605 -0
  159. package/plugins/hooks/lib/environment-config-loader.js +11 -7
  160. package/plugins/hooks/lib/hook-state-manager.js +98 -0
  161. package/plugins/hooks/lib/memory-extractor.js +27 -5
  162. package/plugins/hooks/lib/memory-manager.js +1 -1
  163. package/plugins/hooks/lib/test-auto-fix.test.js +194 -0
  164. package/plugins/hooks/monitoring-trigger.js +467 -0
  165. package/plugins/skills/README.en.md +15 -3
  166. package/plugins/skills/README.md +21 -11
  167. package/plugins/skills/agile-iteration/SKILL.md +187 -0
  168. package/plugins/skills/delivery-stage/SKILL.md +133 -12
  169. package/plugins/skills/design-stage/SKILL.md +103 -12
  170. package/plugins/skills/experiment-evaluator/SKILL.md +271 -0
  171. package/plugins/skills/experiment-iteration/SKILL.md +154 -0
  172. package/plugins/skills/exploration-phase/SKILL.md +93 -10
  173. package/plugins/skills/field-evolve-analyzer/SKILL.md +65 -0
  174. package/plugins/skills/field-evolve-distiller/SKILL.md +66 -0
  175. package/plugins/skills/field-evolve-executor/SKILL.md +94 -0
  176. package/plugins/skills/field-evolve-executor/executor.js +342 -0
  177. package/plugins/skills/field-evolve-fixer/SKILL.md +69 -0
  178. package/plugins/skills/field-evolve-learner/SKILL.md +65 -0
  179. package/plugins/skills/field-evolve-scanner/SKILL.md +87 -0
  180. package/plugins/skills/field-evolve-scanner/scripts/fallback-scanner.js +288 -0
  181. package/plugins/skills/field-evolve-verifier/SKILL.md +64 -0
  182. package/plugins/skills/hotfix-iteration/SKILL.md +279 -0
  183. package/plugins/skills/implementation-stage/SKILL.md +156 -15
  184. package/plugins/skills/layer1-validation/SKILL.md +1 -1
  185. package/plugins/skills/pending-dashboard/SKILL.md +9 -8
  186. package/plugins/skills/project-evolve-analyzer/SKILL.md +95 -0
  187. package/plugins/skills/project-evolve-fixer/SKILL.md +99 -0
  188. package/plugins/skills/project-evolve-generator/SKILL.md +149 -0
  189. package/plugins/skills/project-evolve-learner/SKILL.md +103 -0
  190. package/plugins/skills/project-evolve-reviewer/SKILL.md +104 -0
  191. package/plugins/skills/project-evolve-scanner/SKILL.md +95 -0
  192. package/plugins/skills/project-evolve-scanner/scripts/dependency-reuse-checker.js +395 -0
  193. package/plugins/skills/project-evolve-scanner/scripts/subsystem-coverage.js +315 -0
  194. package/plugins/skills/project-evolve-verifier/SKILL.md +105 -0
  195. package/plugins/skills/requirement-stage/SKILL.md +47 -13
  196. package/plugins/skills/skill-forge/SKILL.md +2 -2
  197. package/plugins/skills/testing-stage/SKILL.md +583 -8
  198. package/plugins/skills/waterfall-iteration/SKILL.md +115 -0
  199. package/scripts/cli/index.js +1 -1
  200. package/scripts/cli/init.js +30 -4
  201. package/scripts/cli/list.js +3 -2
  202. package/scripts/config/commands.config.js +8 -8
  203. package/scripts/config/hooks.config.js +1 -1
  204. package/scripts/install/constants.js +204 -165
  205. package/scripts/state.js +210 -1
  206. package/knowledge/config/README.en.md +0 -44
  207. package/knowledge/config/README.md +0 -44
  208. package/knowledge/config/role-composition.yaml +0 -98
  209. package/knowledge/config/team-triggers.yaml +0 -198
  210. package/knowledge/domain/README.md +0 -115
  211. package/knowledge/domain/flows/README.md +0 -194
  212. package/knowledge/domain/glossary.md +0 -143
  213. package/knowledge/domain/rules.md +0 -138
  214. package/knowledge/environment/component-knowledge.md +0 -316
  215. package/knowledge/environment/detection-patterns.yaml +0 -502
  216. package/knowledge/environment/template-registry.md +0 -321
  217. package/knowledge/guides/requirement-engineering.md +0 -329
  218. package/knowledge/guides/system-design.md +0 -352
  219. package/knowledge/principles/constitution.md +0 -134
  220. package/knowledge/principles/core-principles.md +0 -368
  221. package/knowledge/principles/design-philosophy.md +0 -877
  222. package/knowledge/process/README.en.md +0 -38
  223. package/knowledge/process/README.md +0 -48
  224. package/knowledge/templates/ai-evaluation.md +0 -150
  225. package/knowledge/templates/api-design.md +0 -117
  226. package/knowledge/templates/database-design.md +0 -132
  227. package/knowledge/templates/domain-driven-design.md +0 -321
  228. package/knowledge/templates/product-proposal.md +0 -201
  229. package/knowledge/templates/system-design.md +0 -227
  230. package/knowledge/templates/task-breakdown.md +0 -107
  231. package/knowledge/templates/test-case.md +0 -170
  232. package/plugins/commands/validate.md +0 -108
  233. package/plugins/skills/benchmark-executor/README.md +0 -93
  234. package/plugins/skills/evolution-process/SKILL.md +0 -291
  235. package/plugins/skills/project-evolution/SKILL.md +0 -847
  236. package/scripts/evolution/evolution-router.js +0 -273
  237. package/scripts/evolution/evolution-signal-collector.js +0 -307
  238. package/scripts/evolution/knowledge-loader.js +0 -346
  239. package/scripts/evolution/marketplace.js +0 -317
  240. package/scripts/evolution/version-manager.js +0 -371
  241. /package/knowledge/{process → 02-process}/01-requirement.md +0 -0
  242. /package/knowledge/{process → 02-process}/02-design.md +0 -0
  243. /package/knowledge/{process → 02-process}/03-implementation.md +0 -0
  244. /package/knowledge/{process → 02-process}/04-review.md +0 -0
  245. /package/knowledge/{process → 02-process}/05-testing.md +0 -0
  246. /package/knowledge/{process → 02-process}/06-delivery.md +0 -0
  247. /package/knowledge/{guides/stages/design-planner.md → 03-guides/03-design-solution.md} +0 -0
  248. /package/knowledge/{guides/stages/code-implementer.md → 03-guides/04-implement-code.md} +0 -0
  249. /package/knowledge/{guides/stages/test-planner.md → 03-guides/05-plan-testing.md} +0 -0
  250. /package/knowledge/{guides/stages/test-generator.md → 03-guides/06-generate-tests.md} +0 -0
  251. /package/knowledge/{guides/stages/release-checker.md → 03-guides/07-check-release.md} +0 -0
  252. /package/knowledge/{guides/stages/requirement-reviewer.md → 03-guides/09-review-requirement.md} +0 -0
  253. /package/knowledge/{guides/stages/design-reviewer.md → 03-guides/10-review-design.md} +0 -0
  254. /package/knowledge/{guides/stages/code-reviewer.md → 03-guides/11-review-code.md} +0 -0
  255. /package/knowledge/{guides/stages/test-reviewer.md → 03-guides/12-review-testing.md} +0 -0
  256. /package/knowledge/{guides/stages/security-reviewer.md → 03-guides/13-audit-security.md} +0 -0
  257. /package/knowledge/{guides/stages/consistency-checker.md → 03-guides/14-check-consistency.md} +0 -0
  258. /package/knowledge/{guides/stages/unit-test-runner.md → 03-guides/15-run-unit-tests.md} +0 -0
  259. /package/knowledge/{guides/stages/integration-test-runner.md → 03-guides/16-run-integration-tests.md} +0 -0
  260. /package/knowledge/{guides/stages/test-context-analyzer.md → 03-guides/17-analyze-test-context.md} +0 -0
  261. /package/knowledge/{guides/support/practice-logger.md → 03-guides/18-log-practice.md} +0 -0
  262. /package/knowledge/{guides/support/skill-validator.md → 03-guides/21-validate-skill.md} +0 -0
  263. /package/knowledge/{guides/support/scope-inference.md → 03-guides/23-infer-scope.md} +0 -0
  264. /package/knowledge/{guides/support/component-discovery.md → 03-guides/25-discover-component.md} +0 -0
  265. /package/knowledge/{guides/support/environment-scanner.md → 03-guides/27-scan-environment.md} +0 -0
  266. /package/knowledge/{guides/support/environment-validator.md → 03-guides/28-validate-environment.md} +0 -0
  267. /package/knowledge/{guides/support/knowledge-generator.md → 03-guides/29-generate-knowledge.md} +0 -0
  268. /package/knowledge/{guides/support/ai-capability-analyzer.md → 03-guides/30-analyze-ai-capability.md} +0 -0
  269. /package/knowledge/{guides/support/ai-component-analyzer.md → 03-guides/31-analyze-ai-component.md} +0 -0
  270. /package/knowledge/{guides/support/ai-agent-analyzer.md → 03-guides/32-analyze-ai-agent.md} +0 -0
  271. /package/knowledge/{guides/support/ai-rag-analyzer.md → 03-guides/33-analyze-ai-rag.md} +0 -0
  272. /package/knowledge/{guides/support/ai-task-assessor.md → 03-guides/34-assess-ai-task.md} +0 -0
  273. /package/knowledge/{guides/support/ai-pipeline-evaluator.md → 03-guides/35-evaluate-ai-pipeline.md} +0 -0
  274. /package/knowledge/{guides/support/ai-artifact-evaluator.md → 03-guides/36-evaluate-ai-artifact.md} +0 -0
  275. /package/knowledge/{guides/support/ai-evaluation-planner.md → 03-guides/37-plan-ai-evaluation.md} +0 -0
  276. /package/knowledge/{guides/support/ai-path-evaluator.md → 03-guides/38-evaluate-ai-path.md} +0 -0
  277. /package/knowledge/{guides/support/ai-data-validator.md → 03-guides/39-validate-ai-data.md} +0 -0
  278. /package/knowledge/{guides/support/ai-anomaly-analyzer.md → 03-guides/40-detect-ai-anomaly.md} +0 -0
  279. /package/knowledge/{guides/support/ai-test-diagnostics.md → 03-guides/41-diagnose-ai-test.md} +0 -0
  280. /package/knowledge/{guides/support/test-runner.md → 03-guides/45-test-runner.md} +0 -0
  281. /package/knowledge/{checklists/test.md → 04-checklists/03-test.md} +0 -0
  282. /package/knowledge/{config/team-stage.yaml → 05-config/01-team-stage.yaml} +0 -0
  283. /package/knowledge/{config/role-extensions.yaml → 05-config/04-role-extensions.yaml} +0 -0
@@ -31,21 +31,33 @@ export const EVOLUTION_FILES = {
31
31
 
32
32
  // Pipeline stages (ordered)
33
33
  export const STAGES = [
34
- { id: '01', name: 'require', file: '01-requirement.md', label: '需求分析', skill: 'requirement-analyzer', reviewer: 'requirement-reviewer' },
35
- { id: '02', name: 'design', file: '02-design.md', label: '方案设计', skill: 'design-planner', reviewer: 'design-reviewer' },
36
- { id: '03', name: 'implement', file: '03-implementation.md', label: '编码实现', skill: 'code-implementer', reviewer: 'code-reviewer' },
34
+ { id: '01', name: 'require', file: '01-requirement.md', label: '需求分析', skill: 'requirement-stage', reviewer: 'requirement-reviewer' },
35
+ { id: '02', name: 'design', file: '02-design.md', label: '方案设计', skill: 'design-stage', reviewer: 'design-reviewer' },
36
+ { id: '03', name: 'implement', file: '03-implementation.md', label: '编码实现', skill: 'implementation-stage', reviewer: 'code-reviewer' },
37
37
  { id: '04', name: 'review', file: '04-review.md', label: '代码审查', skill: 'code-reviewer', reviewer: null },
38
- { id: '05', name: 'test', file: '05-testing.md', label: 'QA测试', skill: 'test-generator', reviewer: 'test-reviewer' },
39
- { id: '06', name: 'deliver', file: '06-delivery.md', label: '交付部署', skill: 'release-checker', reviewer: null }
38
+ { id: '05', name: 'test', file: '05-testing.md', label: 'QA 测试', skill: 'testing-stage', reviewer: 'test-reviewer' },
39
+ { id: '06', name: 'deliver', file: '06-delivery.md', label: '交付部署', skill: 'delivery-stage', reviewer: null }
40
40
  ];
41
41
 
42
+ // Extended stages (for experiment mode EVAL stage)
43
+ export const EXTENDED_STAGES = {
44
+ EVAL: {
45
+ id: 'EVAL',
46
+ name: 'evaluation',
47
+ file: 'evaluation.md',
48
+ label: '效果评测',
49
+ skill: 'experiment-evaluator',
50
+ reviewer: null
51
+ }
52
+ };
53
+
42
54
  // Workflow templates (used as --workflow parameter values)
43
55
  export const WORKFLOWS = {
44
56
  waterfall: {
45
57
  name: 'waterfall',
46
58
  label: '瀑布迭代',
47
59
  stages: ['01', '02', '03', '04', '05', '06'],
48
- description: '完整6阶段研发流程,适用于新功能开发',
60
+ description: '完整 6 阶段研发流程,适用于新功能开发',
49
61
  mode: 'waterfall'
50
62
  },
51
63
  agile: {
@@ -54,22 +66,101 @@ export const WORKFLOWS = {
54
66
  stages: ['01', '02', '03', '04', '05', '06'],
55
67
  description: '需求拆分为用户故事,设计→编码→审查循环迭代,最后集成测试和交付',
56
68
  mode: 'agile',
57
- iterableStages: ['02', '03', '04'] // design-implement-review per story
69
+ iterableStages: ['02', '03', '04'],
70
+
71
+ storySplitting: true,
72
+ storyLoop: {
73
+ stages: ['02', '03', '04'],
74
+ validation: 'quick',
75
+ incrementalDelivery: true,
76
+ concurrency: 'sequential',
77
+ },
78
+
79
+ finalStages: ['05', '06'],
80
+ finalValidation: 'full',
81
+
82
+ parallelExecution: {
83
+ enabled: true,
84
+ defaultMode: 'sequential',
85
+ userSelectable: true,
86
+ conflictDetection: true,
87
+ }
58
88
  },
59
89
  experiment: {
60
90
  name: 'experiment',
61
91
  label: '实验模式',
62
- stages: ['01', '02', '03'],
63
- description: '需求+设计+原型,AI实验自动添加效果评测',
92
+ stages: ['01', '02', '03', 'EVAL'],
93
+ description: '需求 + 设计 + 原型 + 效果评测,快速假设验证',
64
94
  mode: 'experiment',
65
- needsEvaluation: true // AI/ML experiment requires效果评测
95
+ needsEvaluation: true,
96
+
97
+ evaluationStage: {
98
+ id: 'EVAL',
99
+ name: 'evaluation',
100
+ label: '效果评测',
101
+ skill: 'experiment-evaluator',
102
+ autoTrigger: true,
103
+ },
104
+
105
+ prototypeStage: {
106
+ id: '03',
107
+ lightweight: true,
108
+ skipReview: false,
109
+ validationLevel: 'quick',
110
+ },
111
+
112
+ hypothesisValidation: {
113
+ maxIterations: 10,
114
+ successThreshold: 0.8,
115
+ failAction: 'report',
116
+ complexityAdaptive: {
117
+ enabled: true,
118
+ simple: { maxIterations: 3 },
119
+ medium: { maxIterations: 5 },
120
+ complex: { maxIterations: 10 },
121
+ }
122
+ }
66
123
  },
67
124
  hotfix: {
68
125
  name: 'hotfix',
69
126
  label: '热修复',
70
127
  stages: ['01', '03', '04', '06'],
71
- description: '跳过设计阶段的快速修复流程',
72
- mode: 'waterfall'
128
+ description: '最小化流程快速修复,严格变更范围控制',
129
+ mode: 'hotfix',
130
+ rapidMode: true,
131
+
132
+ riskAssessment: {
133
+ beforeCoding: true,
134
+ highRiskAction: 'prompt-user',
135
+ riskFactors: [
136
+ { name: 'data-migration', weight: 3, pattern: '涉及数据迁移' },
137
+ { name: 'security', weight: 3, pattern: '涉及安全相关代码' },
138
+ { name: 'core-business', weight: 2, pattern: '影响核心业务流程' },
139
+ { name: 'many-files', weight: 1, pattern: '变更范围超过 3 个文件' },
140
+ { name: 'public-api', weight: 2, pattern: '影响公共 API' },
141
+ ],
142
+ },
143
+
144
+ changeControl: {
145
+ maxFiles: 5,
146
+ maxLines: 100,
147
+ excludePatterns: [
148
+ '**/migrations/**',
149
+ '**/schema.sql',
150
+ '**/auth/**',
151
+ ],
152
+ },
153
+
154
+ validation: {
155
+ level: 'minimal',
156
+ checks: ['compile', 'affected-tests'],
157
+ skipFullTest: true,
158
+ },
159
+
160
+ review: {
161
+ autoPass: ['formatting', 'minor-fix'],
162
+ requireHuman: ['security', 'data-integrity'],
163
+ }
73
164
  }
74
165
  };
75
166
 
@@ -102,7 +193,7 @@ export const EXECUTION_MODES = {
102
193
  unattended: {
103
194
  name: 'unattended',
104
195
  label: '自动模式',
105
- description: '无人值守,全自动执行,禁止阻塞,使用推荐值+记录待确认',
196
+ description: '无人值守,全自动执行,禁止阻塞,使用推荐值 + 记录待确认',
106
197
  blocking: false
107
198
  }
108
199
  };
@@ -142,163 +233,32 @@ export const STATE_FILE = '.autospec/runtime/state.json';
142
233
  // Metrics file path
143
234
  export const METRICS_FILE = '.autospec/runtime/metrics.json';
144
235
 
145
- // Skills paths (relative to knowledge/)
146
- export const SKILLS = {
147
- // Stage skills (做类 + 审类)
148
- STAGES: {
149
- REQUIREMENT_ANALYZER: 'guides/stages/requirement-analyzer.md',
150
- REQUIREMENT_REVIEWER: 'guides/stages/requirement-reviewer.md',
151
- DESIGN_PLANNER: 'guides/stages/design-planner.md',
152
- DESIGN_REVIEWER: 'guides/stages/design-reviewer.md',
153
- CODE_IMPLEMENTER: 'guides/stages/code-implementer.md',
154
- CODE_REVIEWER: 'guides/stages/code-reviewer.md',
155
- TEST_PLANNER: 'guides/stages/test-planner.md',
156
- TEST_GENERATOR: 'guides/stages/test-generator.md',
157
- TEST_REVIEWER: 'guides/stages/test-reviewer.md',
158
- RELEASE_CHECKER: 'guides/stages/release-checker.md',
159
- CONSISTENCY_CHECKER: 'guides/stages/consistency-checker.md',
160
- },
161
- // Support skills (流程增强 + AI专项)
162
- SUPPORT: {
163
- // Skill evolution
164
- SKILL_DISTILLER: 'guides/support/skill-distiller.md',
165
- SKILL_UPDATER: 'guides/support/skill-updater.md',
166
- SKILL_VALIDATOR: 'guides/support/skill-validator.md',
167
- METHODOLOGY_EXTRACTOR: 'guides/support/methodology-extractor.md',
168
- PRACTICE_LOGGER: 'guides/support/practice-logger.md',
169
- // Environment
170
- ENVIRONMENT_SCANNER: 'guides/support/environment-scanner.md',
171
- ENVIRONMENT_VALIDATOR: 'guides/support/environment-validator.md',
172
- COMPONENT_DISCOVERY: 'guides/support/component-discovery.md',
173
- TECH_STACK_ANALYZER: 'guides/support/tech-stack-analyzer.md',
174
- AI_COMPONENT_ANALYZER: 'guides/support/ai-component-analyzer.md',
175
- KNOWLEDGE_GENERATOR: 'guides/support/knowledge-generator.md',
176
- // Protocol
177
- PIPELINE_PROTOCOL: 'guides/support/pipeline-protocol.md',
178
- SCOPE_INFERENCE: 'guides/support/scope-inference.md',
179
- // Runner
180
- TEST_RUNNER: 'guides/support/test-runner.md',
181
- // AI
182
- RAG_ANALYZER: 'guides/support/ai-rag-analyzer.md',
183
- AGENT_ANALYZER: 'guides/support/ai-agent-analyzer.md',
184
- EVALUATION_PLANNER: 'guides/support/ai-evaluation-planner.md',
185
- AI_DATA_VALIDATOR: 'guides/support/ai-data-validator.md',
186
- AI_TEST_DIAGNOSTICS: 'guides/support/ai-test-diagnostics.md',
187
- }
188
- };
189
-
190
- // Knowledge paths (relative to .autospec/knowledge/)
191
- export const FW_PATHS = {
192
- CONSTITUTION: 'principles/constitution.md',
193
- EVOLUTION: 'principles/evolution.md',
194
- PIPELINE_DIR: 'process/',
195
- CHECKLISTS_DIR: 'checklists/',
196
- GUIDES_DIR: 'guides/',
197
- ENVIRONMENT_DIR: 'environment/',
198
- CONFIG_DIR: 'config/',
199
- };
200
-
201
236
  // ============================================================
202
237
  // Environment Integration Protocol (环境衔接协议)
203
238
  // ============================================================
204
239
 
205
240
  // Environment directories (relative to .autospec/)
241
+ // 使用带序号前缀的目录结构,与 env-sync 命令创建的目录保持一致
206
242
  export const ENV_DIRS = {
207
243
  ROOT: 'environment',
208
- ENV_KNOWLEDGE: 'environment/env-knowledge',
209
- MIDDLEWARE: 'environment/env-knowledge/middleware',
210
- INFRASTRUCTURE: 'environment/env-knowledge/infrastructure',
211
- ENV_VARIABLES: 'environment/env-knowledge/env-variables',
212
- COMPONENT_LIB: 'environment/component-lib',
213
- COMPONENTS: 'environment/component-lib/components',
214
- BEST_PRACTICES: 'environment/component-lib/best-practices',
215
- DOMAIN_MODELS: 'environment/component-lib/domain-models',
216
- INTEGRATION: 'environment/integration',
217
- CI_CD: 'environment/integration/ci-cd',
218
- TESTING: 'environment/integration/testing',
219
- DEPLOYMENT: 'environment/integration/deployment',
220
- };
221
-
222
- // Environment files (relative to .autospec/environment/)
223
- export const ENV_FILES = {
224
- REGISTRY: 'registry.json',
225
- DETECTION_PATTERNS: 'detection-patterns.yaml',
226
- ENVIRONMENT_CONTEXT: 'environment-context.json',
227
- };
228
-
229
- // Knowledge types for environment protocol
230
- export const KNOWLEDGE_TYPES = {
231
- MIDDLEWARE: 'MiddlewareKnowledge',
232
- COMPONENT: 'ComponentKnowledge',
233
- INTEGRATION: 'IntegrationKnowledge',
234
- INFRASTRUCTURE: 'InfrastructureKnowledge',
235
- BEST_PRACTICE: 'BestPracticeKnowledge',
236
- };
237
-
238
- // Knowledge evolution zones
239
- export const KNOWLEDGE_ZONES = {
240
- FROZEN: 'frozen', // 冻结区:人工变更(constitution, evolution, design-philosophy)
241
- CONTROLLED: 'controlled', // 受控区:人工批准+自动验证(pipeline, roles, method skills)
242
- FREE: 'free', // 自由区:自动进化(domain skills, decision trees)
243
- };
244
-
245
- // Knowledge scope (for global/org/project triple-layer)
246
- export const KNOWLEDGE_SCOPE = {
247
- GLOBAL: 'global', // 用户级全局知识 (~/.claude/autospec/)
248
- ORG: 'org', // 组织级知识 (~/.claude/autospec/orgs/{org-name}/)
249
- PROJECT: 'project' // 项目级知识 (.autospec/)
250
- };
251
-
252
- // Global autospec directories (in user home)
253
- export const GLOBAL_AUTOSPEC_DIR = '.claude/autospec';
254
- export const GLOBAL_AUTOSPEC_SUBDIRS = {
255
- KNOWLEDGE: 'knowledge',
256
- SKILLS: 'skills',
257
- ROLES: 'roles',
258
- ENVIRONMENT: 'environment',
259
- EVOLUTION: 'evolution',
260
- MEMORY: 'memory'
261
- };
262
-
263
- // Organization autospec directories
264
- export const ORG_AUTOSPEC_DIR = '.claude/autospec/orgs';
265
- export const ORG_AUTOSPEC_SUBDIRS = {
266
- SKILLS: 'skills',
267
- ROLES: 'roles',
268
- ENVIRONMENT: 'environment',
269
- EVOLUTION: 'evolution'
270
- };
271
-
272
- // Claude Code skills symlink path
273
- export const CLAUDE_CODE_SKILLS_DIR = '.claude/skills';
274
-
275
- // Environment knowledge schema version
276
- export const ENV_KNOWLEDGE_API_VERSION = 'autospec/v1';
277
-
278
- // Default environment registry
279
- export const DEFAULT_ENV_REGISTRY = {
280
- version: '1.0',
281
- lastUpdated: new Date().toISOString().split('T')[0],
282
- environmentKnowledge: {
283
- middleware: [],
284
- infrastructure: [],
285
- },
286
- componentKnowledge: {
287
- components: [],
288
- bestPractices: [],
289
- domainModels: [],
290
- },
291
- integrationKnowledge: {
292
- ci_cd: [],
293
- testing: [],
294
- deployment: [],
295
- },
296
- activeProfiles: {
297
- environment: 'development',
298
- middleware: [],
299
- components: [],
300
- ci_cd: null,
301
- },
244
+ ENV_KNOWLEDGE: 'environment/01-env-knowledge',
245
+ MIDDLEWARE: 'environment/01-env-knowledge/01-middleware',
246
+ INFRASTRUCTURE: 'environment/01-env-knowledge/02-infrastructure',
247
+ ENV_VARIABLES: 'environment/01-env-knowledge/03-env-variables',
248
+ COMPONENT_LIB: 'environment/02-component-lib',
249
+ COMPONENTS: 'environment/02-component-lib/01-components',
250
+ BEST_PRACTICES: 'environment/02-component-lib/02-best-practices',
251
+ DOMAIN_MODELS: 'environment/02-component-lib/03-domain-models',
252
+ DESIGN_KNOWLEDGE: 'environment/03-design-knowledge',
253
+ BUSINESS_KNOWLEDGE: 'environment/04-business-knowledge',
254
+ TEST_KNOWLEDGE: 'environment/05-test-knowledge',
255
+ STANDARDS: 'environment/06-standards',
256
+ GUIDES: 'environment/07-guides',
257
+ INTEGRATION: 'environment/08-integration',
258
+ CI_CD: 'environment/08-integration/01-ci-cd',
259
+ TESTING: 'environment/08-integration/02-testing',
260
+ DEPLOYMENT: 'environment/08-integration/03-deployment',
261
+ DOMAIN_MODELS_ROOT: 'environment/09-domain-models',
302
262
  };
303
263
 
304
264
  // ============================================================
@@ -346,8 +306,8 @@ export const MEMORY_SCOPE = {
346
306
 
347
307
  // Memory TTL (days)
348
308
  export const MEMORY_TTL = {
349
- SESSION: 90, // 会话记忆保留90天
350
- WORKING: 7, // 工作记忆保留7天
309
+ SESSION: 90, // 会话记忆保留 90
310
+ WORKING: 7, // 工作记忆保留 7
351
311
  PROJECT: Infinity // 项目记忆永久保留
352
312
  };
353
313
 
@@ -421,4 +381,83 @@ export const DEFAULT_MEMORY_META = {
421
381
  totalDecisions: 0,
422
382
  lastSessionDate: null
423
383
  }
384
+ };
385
+
386
+ // ============================================================
387
+ // Global/Organization Autospec Directories
388
+ // ============================================================
389
+
390
+ // Global autospec directories (in user home)
391
+ export const GLOBAL_AUTOSPEC_DIR = '.claude/autospec';
392
+ export const GLOBAL_AUTOSPEC_SUBDIRS = {
393
+ KNOWLEDGE: 'knowledge',
394
+ SKILLS: 'skills',
395
+ ROLES: 'roles',
396
+ ENVIRONMENT: 'environment',
397
+ EVOLUTION: 'evolution',
398
+ MEMORY: 'memory'
399
+ };
400
+
401
+ // Organization autospec directories
402
+ export const ORG_AUTOSPEC_DIR = '.claude/autospec/orgs';
403
+ export const ORG_AUTOSPEC_SUBDIRS = {
404
+ SKILLS: 'skills',
405
+ ROLES: 'roles',
406
+ ENVIRONMENT: 'environment',
407
+ EVOLUTION: 'evolution'
408
+ };
409
+
410
+ // Claude Code skills symlink path
411
+ export const CLAUDE_CODE_SKILLS_DIR = '.claude/skills';
412
+
413
+ // Knowledge types for environment protocol
414
+ export const KNOWLEDGE_TYPES = {
415
+ MIDDLEWARE: 'MiddlewareKnowledge',
416
+ COMPONENT: 'ComponentKnowledge',
417
+ INTEGRATION: 'IntegrationKnowledge',
418
+ INFRASTRUCTURE: 'InfrastructureKnowledge',
419
+ BEST_PRACTICE: 'BestPracticeKnowledge',
420
+ };
421
+
422
+ // Knowledge evolution zones
423
+ export const KNOWLEDGE_ZONES = {
424
+ FROZEN: 'frozen', // 冻结区:人工变更(constitution, evolution, design-philosophy)
425
+ CONTROLLED: 'controlled', // 受控区:人工批准 + 自动验证(pipeline, roles, method skills)
426
+ FREE: 'free', // 自由区:自动进化(domain skills, decision trees)
427
+ };
428
+
429
+ // Knowledge scope (for global/org/project triple-layer)
430
+ export const KNOWLEDGE_SCOPE = {
431
+ GLOBAL: 'global', // 用户级全局知识 (~/.claude/autospec/)
432
+ ORG: 'org', // 组织级知识 (~/.claude/autospec/orgs/{org-name}/)
433
+ PROJECT: 'project' // 项目级知识 (.autospec/)
434
+ };
435
+
436
+ // Environment knowledge schema version
437
+ export const ENV_KNOWLEDGE_API_VERSION = 'autospec/v1';
438
+
439
+ // Default environment registry
440
+ export const DEFAULT_ENV_REGISTRY = {
441
+ version: '1.0',
442
+ lastUpdated: new Date().toISOString().split('T')[0],
443
+ environmentKnowledge: {
444
+ middleware: [],
445
+ infrastructure: [],
446
+ },
447
+ componentKnowledge: {
448
+ components: [],
449
+ bestPractices: [],
450
+ domainModels: [],
451
+ },
452
+ integrationKnowledge: {
453
+ ci_cd: [],
454
+ testing: [],
455
+ deployment: [],
456
+ },
457
+ activeProfiles: {
458
+ environment: 'development',
459
+ middleware: [],
460
+ components: [],
461
+ ci_cd: null,
462
+ },
424
463
  };
package/scripts/state.js CHANGED
@@ -237,7 +237,7 @@ export function createState(taskName, workflow = 'waterfall', roles = [], subsys
237
237
  }
238
238
 
239
239
  return {
240
- version: '0.1.0',
240
+ version: '1.0.2',
241
241
  taskName,
242
242
  workflow,
243
243
  roles,
@@ -374,3 +374,212 @@ export function getStatusSummary(state) {
374
374
 
375
375
  return lines.join('\n');
376
376
  }
377
+
378
+ /**
379
+ * Get all subsystems status for current stage
380
+ * @param {Object} state - pipeline state
381
+ * @returns {Array} all subsystems status for current stage
382
+ */
383
+ export function getAllSubsystemsStatus(state) {
384
+ if (!state?.stages?.[state.currentStage]?.subsystems) {
385
+ return [];
386
+ }
387
+ return state.stages[state.currentStage].subsystems;
388
+ }
389
+
390
+ /**
391
+ * Get subsystem coverage report
392
+ * Compares designed subsystems vs implemented subsystems
393
+ * @param {string} projectDir - project directory
394
+ * @param {Object} state - pipeline state
395
+ * @returns {Object} coverage report
396
+ */
397
+ export function getSubsystemCoverage(state, designSubsystems = []) {
398
+ if (!state?.stages?.[state.currentStage]?.subsystems) {
399
+ return {
400
+ designed: [],
401
+ implemented: [],
402
+ coverage: 0,
403
+ missing: [],
404
+ completed: [],
405
+ inProgress: [],
406
+ pending: []
407
+ };
408
+ }
409
+
410
+ const currentSubsystems = state.stages[state.currentStage].subsystems;
411
+
412
+ // Categorize by status
413
+ const completed = currentSubsystems.filter(s => s.status === 'completed');
414
+ const inProgress = currentSubsystems.filter(s => s.status === 'in_progress' || s.status === 'layer1_pass');
415
+ const pending = currentSubsystems.filter(s => s.status === 'pending');
416
+
417
+ // Calculate coverage
418
+ const total = currentSubsystems.length;
419
+ const covered = completed.length + inProgress.length;
420
+ const coverageRate = total > 0 ? Math.round((covered / total) * 100) : 0;
421
+
422
+ return {
423
+ designed: currentSubsystems.map(s => ({ name: s.name, type: s.type, path: s.path })),
424
+ implemented: currentSubsystems.filter(s => s.status !== 'pending'),
425
+ coverage: coverageRate,
426
+ missing: pending.map(s => s.name),
427
+ completed: completed.map(s => s.name),
428
+ inProgress: inProgress.map(s => s.name),
429
+ pending: pending.map(s => s.name),
430
+ details: currentSubsystems
431
+ };
432
+ }
433
+
434
+ /**
435
+ * Get monitoring issues from .autospec/monitoring-issues.json
436
+ * @param {string} projectDir - project directory
437
+ * @returns {Array} monitoring issues
438
+ */
439
+ export function getMonitoringIssues(projectDir) {
440
+ const monitoringIssuesPath = path.join(projectDir, '.autospec/monitoring-issues.json');
441
+ if (fs.existsSync(monitoringIssuesPath)) {
442
+ try {
443
+ return JSON.parse(fs.readFileSync(monitoringIssuesPath, 'utf-8'));
444
+ } catch {
445
+ return [];
446
+ }
447
+ }
448
+ return [];
449
+ }
450
+
451
+ /**
452
+ * Add monitoring issue to .autospec/monitoring-issues.json
453
+ * @param {string} projectDir - project directory
454
+ * @param {Object} issue - issue to add
455
+ */
456
+ export function addMonitoringIssue(projectDir, issue) {
457
+ const monitoringIssuesPath = path.join(projectDir, '.autospec/monitoring-issues.json');
458
+
459
+ let issues = [];
460
+ if (fs.existsSync(monitoringIssuesPath)) {
461
+ try {
462
+ issues = JSON.parse(fs.readFileSync(monitoringIssuesPath, 'utf-8'));
463
+ } catch {
464
+ issues = [];
465
+ }
466
+ }
467
+
468
+ const newIssue = {
469
+ id: `issue-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
470
+ createdAt: new Date().toISOString(),
471
+ updatedAt: new Date().toISOString(),
472
+ status: 'open', // open | acknowledged | fixing | fixed | closed
473
+ ...issue
474
+ };
475
+
476
+ issues.push(newIssue);
477
+
478
+ const dir = path.dirname(monitoringIssuesPath);
479
+ if (!fs.existsSync(dir)) {
480
+ fs.mkdirSync(dir, { recursive: true });
481
+ }
482
+
483
+ fs.writeFileSync(monitoringIssuesPath, JSON.stringify(issues, null, 2), 'utf-8');
484
+ return newIssue;
485
+ }
486
+
487
+ /**
488
+ * Update monitoring issue status
489
+ * @param {string} projectDir - project directory
490
+ * @param {string} issueId - issue ID
491
+ * @param {Object} updates - status updates
492
+ * @returns {boolean} success
493
+ */
494
+ export function updateMonitoringIssue(projectDir, issueId, updates) {
495
+ const monitoringIssuesPath = path.join(projectDir, '.autospec/monitoring-issues.json');
496
+
497
+ if (!fs.existsSync(monitoringIssuesPath)) {
498
+ return false;
499
+ }
500
+
501
+ let issues;
502
+ try {
503
+ issues = JSON.parse(fs.readFileSync(monitoringIssuesPath, 'utf-8'));
504
+ } catch {
505
+ return false;
506
+ }
507
+
508
+ const issueIndex = issues.findIndex(i => i.id === issueId);
509
+ if (issueIndex === -1) {
510
+ return false;
511
+ }
512
+
513
+ issues[issueIndex] = {
514
+ ...issues[issueIndex],
515
+ ...updates,
516
+ updatedAt: new Date().toISOString()
517
+ };
518
+
519
+ fs.writeFileSync(monitoringIssuesPath, JSON.stringify(issues, null, 2), 'utf-8');
520
+ return true;
521
+ }
522
+
523
+ /**
524
+ * Get monitoring report summary
525
+ * @param {string} projectDir - project directory
526
+ * @returns {Object} monitoring report
527
+ */
528
+ export function getMonitoringReport(projectDir) {
529
+ const issues = getMonitoringIssues(projectDir);
530
+
531
+ const summary = {
532
+ total: issues.length,
533
+ open: issues.filter(i => i.status === 'open').length,
534
+ acknowledged: issues.filter(i => i.status === 'acknowledged').length,
535
+ fixing: issues.filter(i => i.status === 'fixing').length,
536
+ fixed: issues.filter(i => i.status === 'fixed').length,
537
+ closed: issues.filter(i => i.status === 'closed').length,
538
+ bySeverity: {
539
+ critical: issues.filter(i => i.severity === 'critical').length,
540
+ high: issues.filter(i => i.severity === 'high').length,
541
+ medium: issues.filter(i => i.severity === 'medium').length,
542
+ low: issues.filter(i => i.severity === 'low').length
543
+ },
544
+ recentIssues: issues.slice(-10).reverse()
545
+ };
546
+
547
+ return summary;
548
+ }
549
+
550
+ /**
551
+ * Check if all subsystems have passed Layer 1 validation
552
+ * @param {Object} state - pipeline state
553
+ * @param {string} stageId - stage ID
554
+ * @returns {Object} validation result
555
+ */
556
+ export function checkAllSubsystemsLayer1(state, stageId) {
557
+ const subsystems = state?.stages?.[stageId]?.subsystems;
558
+
559
+ if (!subsystems || subsystems.length === 0) {
560
+ return {
561
+ allPassed: true,
562
+ hasSubsystems: false,
563
+ details: []
564
+ };
565
+ }
566
+
567
+ const passed = subsystems.filter(s => s.layer1 === 'pass');
568
+ const failed = subsystems.filter(s => s.layer1 === 'fail');
569
+ const pending = subsystems.filter(s => !s.layer1 || s.layer1 === null);
570
+
571
+ return {
572
+ allPassed: failed.length === 0 && pending.length === 0,
573
+ hasSubsystems: true,
574
+ total: subsystems.length,
575
+ passed: passed.length,
576
+ failed: failed.length,
577
+ pending: pending.length,
578
+ details: subsystems.map(s => ({
579
+ name: s.name,
580
+ type: s.type,
581
+ layer1: s.layer1,
582
+ status: s.status
583
+ }))
584
+ };
585
+ }
@@ -1,44 +0,0 @@
1
- # Config Directory
2
-
3
- This directory contains AutoSpec's configuration files, defining validation patterns and team triggers.
4
-
5
- ## Directory Structure
6
-
7
- ```
8
- config/
9
- ├── validation-patterns.yaml # Validation pattern configuration
10
- └── team-triggers.yaml # Team trigger configuration
11
- ```
12
-
13
- ## Configuration Files
14
-
15
- ### validation-patterns.yaml
16
-
17
- Defines validation patterns for each stage:
18
-
19
- ```yaml
20
- # Validation pattern example
21
- patterns:
22
- - name: "build-check"
23
- stage: "implementation"
24
- commands:
25
- - "npm run build"
26
- required: true
27
- ```
28
-
29
- ### team-triggers.yaml
30
-
31
- Defines team collaboration triggers:
32
-
33
- ```yaml
34
- # Team trigger example
35
- triggers:
36
- - name: "code-review-request"
37
- condition: "pull_request.opened"
38
- actions:
39
- - "notify: @team-lead"
40
- ```
41
-
42
- ## Usage
43
-
44
- Configuration files are copied to `.autospec/knowledge/config/` during `autospec init` and can be customized per project needs.