@guanlin4924/devflow-pi 0.1.0

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 (254) hide show
  1. package/README.md +164 -0
  2. package/docs/OMP-NATIVE-ARCHITECTURE.md +104 -0
  3. package/package.json +40 -0
  4. package/plugins/devflow-core/extensions/devflow-core.ts +1642 -0
  5. package/plugins/devflow-core/package.json +14 -0
  6. package/plugins/devflow-core/runtime/hooks/context_sync_gate.py +174 -0
  7. package/plugins/devflow-core/runtime/hooks/hook_common.py +696 -0
  8. package/plugins/devflow-core/runtime/hooks/index_gate.py +63 -0
  9. package/plugins/devflow-core/runtime/hooks/injection_code_specification.py +7 -0
  10. package/plugins/devflow-core/runtime/hooks/post_tool.py +44 -0
  11. package/plugins/devflow-core/runtime/hooks/start.py +288 -0
  12. package/plugins/devflow-core/skills/workflow-orchestrator/SKILL.md +265 -0
  13. package/plugins/devflow-core/skills/workflow-orchestrator/agents/openai.yaml +4 -0
  14. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/advance_state.rb +520 -0
  15. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/control_io.rb +42 -0
  16. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/init_state.rb +138 -0
  17. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/init_workflow.rb +121 -0
  18. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/inspect_state.rb +553 -0
  19. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/manage_lessons.rb +219 -0
  20. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/sync_artifacts.rb +168 -0
  21. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/update_triage_route.rb +110 -0
  22. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/validate_state.rb +565 -0
  23. package/plugins/devflow-core/skills/workflow-orchestrator/templates/feature-development.yaml +783 -0
  24. package/plugins/devflow-core/skills/workflow-orchestrator/templates/uat-remediation.yaml +143 -0
  25. package/plugins/devflow-core/skills/workflow-orchestrator/templates/workflows-README.md +10 -0
  26. package/plugins/devflow-core/skills/workflow-pipeline/SKILL.md +117 -0
  27. package/plugins/devflow-core/skills/workflow-pipeline/references/pipeline-flow.md +167 -0
  28. package/plugins/devflow-core/skills/workflow-pipeline/references/slice-safety-guide.md +125 -0
  29. package/plugins/devflow-core/skills/workflow-project-context/SKILL.md +819 -0
  30. package/plugins/devflow-core/skills/workflow-project-context/assets/agents-md-template.md +25 -0
  31. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-backend-spec-template.md +68 -0
  32. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-frontend-spec-template.md +64 -0
  33. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-navigation-template.md +168 -0
  34. package/plugins/devflow-core/skills/workflow-project-context/assets/context-domain-index-template.md +43 -0
  35. package/plugins/devflow-core/skills/workflow-project-context/assets/context-spec-index-template.md +45 -0
  36. package/plugins/devflow-core/skills/workflow-project-context/assets/execution-contract-template.md +57 -0
  37. package/plugins/devflow-core/skills/workflow-project-context/assets/navigation-index-template.md +40 -0
  38. package/plugins/devflow-core/skills/workflow-project-context/assets/project-initialization-template.md +109 -0
  39. package/plugins/devflow-core/skills/workflow-project-context/assets/rules-index-template.md +80 -0
  40. package/plugins/devflow-core/skills/workflow-project-context/assets/run-manifest-template.json +40 -0
  41. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/directory-structure.md +46 -0
  42. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/engine.md +46 -0
  43. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/errors.md +46 -0
  44. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/locator.md +46 -0
  45. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/model.md +46 -0
  46. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/repository.md +46 -0
  47. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/router.md +46 -0
  48. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/scheduler.md +46 -0
  49. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/schema.md +46 -0
  50. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/service.md +46 -0
  51. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/testing.md +46 -0
  52. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/api-client.md +46 -0
  53. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/case-editor.md +46 -0
  54. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/components.md +46 -0
  55. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/directory-structure.md +46 -0
  56. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/forms.md +46 -0
  57. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/routing.md +46 -0
  58. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/state.md +46 -0
  59. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/testing.md +46 -0
  60. package/plugins/devflow-core/skills/workflow-project-context/assets/stack-spec-template.md +106 -0
  61. package/plugins/devflow-core/skills/workflow-project-context/assets/state-template.md +77 -0
  62. package/plugins/devflow-core/skills/workflow-project-context/assets/toolchain-template.md +37 -0
  63. package/plugins/devflow-core/skills/workflow-project-context/references/navigation-guide.md +262 -0
  64. package/plugins/devflow-core/skills/workflow-project-context/scripts/validate_initialization.py +545 -0
  65. package/plugins/devflow-design/agents/contract-auditor.md +18 -0
  66. package/plugins/devflow-design/extensions/devflow-design.ts +47 -0
  67. package/plugins/devflow-design/package.json +14 -0
  68. package/plugins/devflow-design/skills/workflow-api-call-guide/SKILL.md +142 -0
  69. package/plugins/devflow-design/skills/workflow-api-contract/SKILL.md +150 -0
  70. package/plugins/devflow-design/skills/workflow-api-supplement/SKILL.md +121 -0
  71. package/plugins/devflow-design/skills/workflow-backend-tech-spec/SKILL.md +257 -0
  72. package/plugins/devflow-design/skills/workflow-backend-tech-spec/assets/adr-template.md +57 -0
  73. package/plugins/devflow-design/skills/workflow-backend-tech-spec/assets/backend-spec-template.md +205 -0
  74. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/affected-module-exploration.md +59 -0
  75. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/backend-conventions.md +30 -0
  76. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/code-explore-guide.md +40 -0
  77. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/project-rule-contract.md +66 -0
  78. package/plugins/devflow-design/skills/workflow-design-rule-pack/SKILL.md +91 -0
  79. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/index.md +71 -0
  80. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/accessibility.md +31 -0
  81. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/component-library.md +31 -0
  82. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/design-systems.md +47 -0
  83. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/responsive-grid.md +29 -0
  84. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/stack-guidelines.md +31 -0
  85. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/ux-patterns.md +40 -0
  86. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tokens/project-tokens.md +19 -0
  87. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/SKILL.md +377 -0
  88. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/charts.csv +26 -0
  89. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/colors.csv +97 -0
  90. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/icons.csv +101 -0
  91. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/landing.csv +31 -0
  92. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/products.csv +97 -0
  93. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/react-performance.csv +45 -0
  94. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  95. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  96. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  97. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  98. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  99. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  100. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  101. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  102. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/react.csv +54 -0
  103. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  104. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  105. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  106. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  107. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/styles.csv +68 -0
  108. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/typography.csv +58 -0
  109. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  110. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  111. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/web-interface.csv +31 -0
  112. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/core.py +253 -0
  113. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/design_system.py +1067 -0
  114. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/search.py +114 -0
  115. package/plugins/devflow-design/skills/workflow-design-rule-pack/scripts/install.py +67 -0
  116. package/plugins/devflow-design/skills/workflow-feature-breakdown/SKILL.md +370 -0
  117. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/admin-system-template.md +57 -0
  118. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/api-service-template.md +42 -0
  119. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/c-end-system-template.md +25 -0
  120. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/output-template.md +139 -0
  121. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/bug-rules.md +12 -0
  122. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/exception-checklist.md +31 -0
  123. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/trace-integrity-guide.md +153 -0
  124. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/writing-guide.md +92 -0
  125. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/SKILL.md +223 -0
  126. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/assets/frontend-spec-template.md +204 -0
  127. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/affected-module-exploration.md +58 -0
  128. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/component-patterns.md +42 -0
  129. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-conventions.md +28 -0
  130. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/common-web.md +53 -0
  131. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/next.md +40 -0
  132. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/react.md +41 -0
  133. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/vue.md +41 -0
  134. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/project-rule-contract.md +95 -0
  135. package/plugins/devflow-design/skills/workflow-integration-verify/SKILL.md +172 -0
  136. package/plugins/devflow-design/skills/workflow-ui-spec/SKILL.md +302 -0
  137. package/plugins/devflow-design/skills/workflow-ui-spec/assets/ui-spec-template.md +244 -0
  138. package/plugins/devflow-design/skills/workflow-ui-spec/references/affected-module-exploration.md +55 -0
  139. package/plugins/devflow-implementation/agents/implementation-worker.md +20 -0
  140. package/plugins/devflow-implementation/package.json +6 -0
  141. package/plugins/devflow-implementation/skills/workflow-bug-fix/SKILL.md +124 -0
  142. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/INDEX.md +13 -0
  143. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/adversarial-review.md +35 -0
  144. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/first-principles.md +26 -0
  145. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/lesson-format.md +28 -0
  146. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/root-cause-ladder.md +51 -0
  147. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/seam-analysis.md +30 -0
  148. package/plugins/devflow-implementation/skills/workflow-change-plan/SKILL.md +160 -0
  149. package/plugins/devflow-implementation/skills/workflow-change-plan/references/code-conventions.md +33 -0
  150. package/plugins/devflow-implementation/skills/workflow-change-plan/references/ddl-guidelines.md +60 -0
  151. package/plugins/devflow-implementation/skills/workflow-change-plan/references/output-template.md +217 -0
  152. package/plugins/devflow-implementation/skills/workflow-change-plan/references/project-rule-contract.md +55 -0
  153. package/plugins/devflow-implementation/skills/workflow-execute-phase/SKILL.md +271 -0
  154. package/plugins/devflow-implementation/skills/workflow-execute-phase/references/execute-phase.md +1251 -0
  155. package/plugins/devflow-implementation/skills/workflow-execute-phase/references/ui-brand.md +160 -0
  156. package/plugins/devflow-intel/agents/project-scout.md +27 -0
  157. package/plugins/devflow-intel/extensions/devflow-intel.ts +104 -0
  158. package/plugins/devflow-intel/package.json +14 -0
  159. package/plugins/devflow-intel/skills/code-index-query/SKILL.md +37 -0
  160. package/plugins/devflow-intel/skills/code-index-query/references/query-patterns.md +27 -0
  161. package/plugins/devflow-intel/skills/workflow-code-index/SKILL.md +68 -0
  162. package/plugins/devflow-intel/skills/workflow-code-index/references/adapter-contract.md +38 -0
  163. package/plugins/devflow-intel/skills/workflow-code-index/references/audit-checklist.md +10 -0
  164. package/plugins/devflow-intel/skills/workflow-code-index/references/confidence-rules.md +43 -0
  165. package/plugins/devflow-intel/skills/workflow-code-index/references/data-model.md +74 -0
  166. package/plugins/devflow-intel/skills/workflow-code-index/references/discovery.md +24 -0
  167. package/plugins/devflow-intel/skills/workflow-code-index/references/query-guide.md +20 -0
  168. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/__init__.py +1 -0
  169. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/base.py +30 -0
  170. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/generic_text.py +287 -0
  171. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/registry.py +17 -0
  172. package/plugins/devflow-intel/skills/workflow-code-index/scripts/code_index.py +437 -0
  173. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/__init__.py +1 -0
  174. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/discovery.py +139 -0
  175. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/hashing.py +11 -0
  176. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/scanner.py +115 -0
  177. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/schema.py +123 -0
  178. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/__init__.py +1 -0
  179. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/project_binding_check.py +66 -0
  180. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/relation_check.py +36 -0
  181. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/schema_validate.py +11 -0
  182. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/stale_check.py +42 -0
  183. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/__init__.py +1 -0
  184. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/jsonl_writer.py +25 -0
  185. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/markdown_writer.py +106 -0
  186. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/sqlite_writer.py +143 -0
  187. package/plugins/devflow-intel/skills/workflow-context-sync/SKILL.md +381 -0
  188. package/plugins/devflow-intel/skills/workflow-context-sync/agents/openai.yaml +4 -0
  189. package/plugins/devflow-intel/skills/workflow-context-sync/scripts/context_sync_cursor.py +241 -0
  190. package/plugins/devflow-intel/skills/workflow-update-navigation/SKILL.md +186 -0
  191. package/plugins/devflow-intel/skills/workflow-update-navigation/references/incremental-update-guide.md +47 -0
  192. package/plugins/devflow-quality/agents/code-reviewer.md +18 -0
  193. package/plugins/devflow-quality/agents/verification-runner.md +21 -0
  194. package/plugins/devflow-quality/extensions/devflow-quality.ts +59 -0
  195. package/plugins/devflow-quality/package.json +14 -0
  196. package/plugins/devflow-quality/skills/code-review/SKILL.md +288 -0
  197. package/plugins/devflow-quality/skills/code-review/references/cross-layer-checklist.md +70 -0
  198. package/plugins/devflow-quality/skills/code-review/references/dao-checklist.md +70 -0
  199. package/plugins/devflow-quality/skills/code-review/references/handler-checklist.md +48 -0
  200. package/plugins/devflow-quality/skills/code-review/references/repository-checklist.md +44 -0
  201. package/plugins/devflow-quality/skills/code-review/references/service-checklist.md +57 -0
  202. package/plugins/devflow-quality/skills/code-review/references/spec-checklist.md +34 -0
  203. package/plugins/devflow-quality/skills/code-review/references/vo-checklist.md +26 -0
  204. package/plugins/devflow-quality/skills/workflow-audit-milestone/SKILL.md +31 -0
  205. package/plugins/devflow-quality/skills/workflow-audit-milestone/references/audit-milestone.md +328 -0
  206. package/plugins/devflow-quality/skills/workflow-complete-milestone/SKILL.md +132 -0
  207. package/plugins/devflow-quality/skills/workflow-complete-milestone/assets/milestone-archive.md +123 -0
  208. package/plugins/devflow-quality/skills/workflow-complete-milestone/references/complete-milestone.md +775 -0
  209. package/plugins/devflow-quality/skills/workflow-complete-milestone/references/milestone-archive.md +123 -0
  210. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/SKILL.md +126 -0
  211. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/api-mainflow-rules.md +27 -0
  212. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/codebase-discovery.md +54 -0
  213. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/intermediate-format.md +244 -0
  214. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/mainflow-selection.md +36 -0
  215. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/project-dsl-contract.md +190 -0
  216. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/ui-mainflow-rules.md +110 -0
  217. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/compile_dsl.py +583 -0
  218. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/discover_codebases.py +199 -0
  219. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/normalize_case_payloads.py +177 -0
  220. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/validate_case_payloads.py +370 -0
  221. package/plugins/devflow-quality/skills/workflow-verify-work/SKILL.md +106 -0
  222. package/plugins/devflow-quality/skills/workflow-verify-work/assets/UAT.md +265 -0
  223. package/plugins/devflow-quality/skills/workflow-verify-work/references/verify-work.md +759 -0
  224. package/plugins/devflow-requirements/agents/requirements-auditor.md +20 -0
  225. package/plugins/devflow-requirements/package.json +6 -0
  226. package/plugins/devflow-requirements/skills/requirement-feasibility-review/SKILL.md +219 -0
  227. package/plugins/devflow-requirements/skills/requirement-feasibility-review/agents/openai.yaml +4 -0
  228. package/plugins/devflow-requirements/skills/requirement-feasibility-review/references/review-method.md +257 -0
  229. package/plugins/devflow-requirements/skills/requirement-feasibility-review/references/review-template.md +80 -0
  230. package/plugins/devflow-requirements/skills/workflow-demand-clarify/SKILL.md +325 -0
  231. package/plugins/devflow-requirements/skills/workflow-domain-modeling/SKILL.md +163 -0
  232. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/SKILL.md +748 -0
  233. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/assets/baseline-template.md +281 -0
  234. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/antipatterns.md +69 -0
  235. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/challenge-review-guide.md +158 -0
  236. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/decomposition-guide.md +115 -0
  237. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/project-context-guide.md +119 -0
  238. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/questioning.md +76 -0
  239. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/requirement-review-checklist.md +115 -0
  240. package/plugins/devflow-requirements/skills/workflow-requirement-triage/SKILL.md +204 -0
  241. package/plugins/devflow-requirements/skills/workflow-wayfinder/SKILL.md +183 -0
  242. package/src/cli.ts +76 -0
  243. package/src/constants.ts +15 -0
  244. package/src/doctor.ts +66 -0
  245. package/src/paths.ts +37 -0
  246. package/src/platform-extension.ts +46 -0
  247. package/src/project-context.ts +165 -0
  248. package/src/runtime.ts +167 -0
  249. package/src/usage-stats.ts +101 -0
  250. package/templates/commands/start.md +58 -0
  251. package/templates/omp/AGENTS.md +36 -0
  252. package/templates/omp/config.yml +112 -0
  253. package/templates/omp/hook-config.json +18 -0
  254. package/templates/omp/index-policy.json +57 -0
@@ -0,0 +1,370 @@
1
+ #!/usr/bin/env python3
2
+ """Validate normalized mainflow case import payloads."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import importlib
8
+ import json
9
+ import re
10
+ import sys
11
+ from datetime import datetime, timezone
12
+ from pathlib import Path
13
+ from typing import Any
14
+
15
+
16
+ MAINFLOW_TAGS = {"api-mainflow", "ui-mainflow"}
17
+ ALLOWED_DRIVERS = {"api", "web", "ui"}
18
+ VALID_TARGET_KEYS = {"css", "xpath", "label", "placeholder", "role", "name", "near_text", "exact"}
19
+ # 精确匹配器:严格对应DOM结构,必须来自 source code 证据,不能凭空编造
20
+ EXACT_LOCATOR_KEYS = {"css", "xpath", "role"}
21
+ # 语义匹配器:通过用户可见文本/属性定位,更抗DOM变化但需检查唯一性
22
+ SEMANTIC_LOCATOR_KEYS = {"label", "placeholder", "near_text"}
23
+ # 表格行常见操作文本 — 用 label 定位时几乎一定不唯一
24
+ HIGH_RISK_LABELS = {
25
+ "编辑", "删除", "查看", "详情", "启用", "禁用", "停用", "启用",
26
+ "新增", "添加", "修改", "复制", "移动", "导出", "导入", "下载",
27
+ "上传", "设置", "配置", "操作", "更多", "取消", "确定", "保存",
28
+ "提交", "重置", "刷新", "搜索", "查询", "筛选", "排序",
29
+ }
30
+ # CSS 选择器最小长度 — 太短的选择器通常是编造的,缺乏 scope
31
+ MIN_CSS_LENGTH = 10
32
+ # 验证类 action — 应使用 ai_only
33
+ VERIFICATION_ACTIONS = {"assert_visible", "assert_text", "assert_url_contains", "assert_any_visible"}
34
+ VALID_ASSERTION_TYPES = {
35
+ "equals", "json_path_equals", "status_code", "not_equals", "contains",
36
+ "not_contains", "greater_than", "less_than", "json_path_exists",
37
+ "regex", "is_empty", "is_not_empty", "in", "not_in",
38
+ }
39
+ API_ACTIONS = {"get", "post", "put", "patch", "delete", "head", "options"}
40
+ WEB_UI_ACTIONS = {
41
+ "goto",
42
+ "navigate",
43
+ "click",
44
+ "fill",
45
+ "input",
46
+ "select",
47
+ "hover",
48
+ "wait",
49
+ "assert_visible",
50
+ "assert_text",
51
+ "assert_url_contains",
52
+ "assert_any_visible",
53
+ "evaluate_js",
54
+ "screenshot",
55
+ "act",
56
+ }
57
+ SECRET_KEY_RE = re.compile(r"(token|password|passwd|secret|api[_-]?key|authorization|cookie)", re.I)
58
+ SECRET_VALUE_RE = re.compile(
59
+ r"(sk-[A-Za-z0-9_\-]{16,}|ghp_[A-Za-z0-9_]{16,}|xox[baprs]-[A-Za-z0-9\-]{16,}|"
60
+ r"Bearer\s+[A-Za-z0-9_\-.]{16,}|eyJ[A-Za-z0-9_\-]{16,}\.[A-Za-z0-9_\-]{8,})"
61
+ )
62
+ PLACEHOLDER_RE = re.compile(r"^(\$\{[A-Za-z_][A-Za-z0-9_]*\}|<[^>]+>|REPLACE_ME|dummy|example|your-.+)$", re.I)
63
+
64
+
65
+ def load_payload(path: Path) -> dict[str, Any]:
66
+ raw = json.loads(path.read_text(encoding="utf-8"))
67
+ if isinstance(raw, list):
68
+ return {"metadata": {}, "cases": raw}
69
+ if isinstance(raw, dict) and isinstance(raw.get("cases"), list):
70
+ return raw
71
+ raise ValueError("payload must be a JSON object with cases[] or a JSON array")
72
+
73
+
74
+ def backend_root_from_discovery(path: Path) -> Path:
75
+ data = json.loads(path.read_text(encoding="utf-8"))
76
+ for codebase in data.get("codebases", []):
77
+ if codebase.get("domain") == "backend" or "后端" in str(codebase.get("type", "")):
78
+ root = Path(str(codebase.get("root", "")))
79
+ if root.exists():
80
+ return root
81
+ raise ValueError("no existing backend codebase root found in discovery")
82
+
83
+
84
+ def load_project_validators(discovery_path: Path):
85
+ backend_root = backend_root_from_discovery(discovery_path)
86
+ sys.path.insert(0, str(backend_root.resolve()))
87
+ case_module = importlib.import_module("app.schemas.case")
88
+ dsl_module = importlib.import_module("app.services.dsl_parser")
89
+ return case_module.CaseCreate, dsl_module.validate_dsl
90
+
91
+
92
+ def is_placeholder(value: str) -> bool:
93
+ return bool(PLACEHOLDER_RE.match(value.strip())) or "${" in value
94
+
95
+
96
+ def walk_values(value: Any, path: str = "$") -> list[tuple[str, Any]]:
97
+ found = [(path, value)]
98
+ if isinstance(value, dict):
99
+ for key, child in value.items():
100
+ found.extend(walk_values(child, f"{path}.{key}"))
101
+ elif isinstance(value, list):
102
+ for index, child in enumerate(value):
103
+ found.extend(walk_values(child, f"{path}[{index}]"))
104
+ return found
105
+
106
+
107
+ def detect_secrets(case: dict[str, Any]) -> list[str]:
108
+ errors: list[str] = []
109
+ for path, value in walk_values(case):
110
+ if isinstance(value, str) and SECRET_VALUE_RE.search(value) and not is_placeholder(value):
111
+ errors.append(f"{path} contains a token-like literal")
112
+ key = path.rsplit(".", 1)[-1].lower()
113
+ if SECRET_KEY_RE.search(key) and isinstance(value, str) and value.strip() and not is_placeholder(value):
114
+ errors.append(f"{path} contains a secret-looking literal")
115
+ return errors
116
+
117
+
118
+ def validate_case_payload_shape(case: dict[str, Any], CaseCreate: Any) -> list[str]:
119
+ errors: list[str] = []
120
+ try:
121
+ if hasattr(CaseCreate, "model_validate"):
122
+ CaseCreate.model_validate(case)
123
+ else:
124
+ CaseCreate(**case)
125
+ except Exception as exc: # noqa: BLE001
126
+ errors.append(f"CaseCreate validation failed: {exc}")
127
+ return errors
128
+
129
+
130
+ def validate_dsl_static(dsl: dict[str, Any], tags: list[str]) -> list[str]:
131
+ errors: list[str] = []
132
+ if not dsl.get("name"):
133
+ errors.append("dsl_json.name is required")
134
+ steps = dsl.get("steps")
135
+ if not isinstance(steps, list) or not steps:
136
+ errors.append("dsl_json.steps must be a non-empty list")
137
+ return errors
138
+
139
+ step_ids: set[str] = set()
140
+ for index, step in enumerate(steps):
141
+ path = f"dsl_json.steps[{index}]"
142
+ if not isinstance(step, dict):
143
+ errors.append(f"{path} must be an object")
144
+ continue
145
+ step_id = step.get("id")
146
+ if not step_id:
147
+ errors.append(f"{path}.id is required")
148
+ elif step_id in step_ids:
149
+ errors.append(f"{path}.id duplicates '{step_id}'")
150
+ else:
151
+ step_ids.add(step_id)
152
+
153
+ driver = step.get("driver")
154
+ action = str(step.get("action") or "").lower()
155
+ if driver not in ALLOWED_DRIVERS:
156
+ errors.append(f"{path}.driver must be one of {sorted(ALLOWED_DRIVERS)}")
157
+ if not action:
158
+ errors.append(f"{path}.action is required")
159
+ elif driver == "api" and action not in API_ACTIONS:
160
+ errors.append(f"{path}.action is not a valid API method")
161
+ elif driver in {"web", "ui"} and action not in WEB_UI_ACTIONS:
162
+ errors.append(f"{path}.action is not a valid UI/Web action")
163
+
164
+ params = step.get("params") or {}
165
+ if driver == "api" and not params.get("url"):
166
+ errors.append(f"{path}.params.url is required for API steps")
167
+ if driver == "ui":
168
+ strategy = step.get("strategy") or {}
169
+ target = step.get("target") or {}
170
+ strategy_mode = strategy.get("mode", "")
171
+ if strategy_mode != "ai_only" and not any(target.values()):
172
+ errors.append(f"{path}.target is required for non-ai_only UI steps")
173
+ unknown_keys = set(target.keys()) - VALID_TARGET_KEYS
174
+ if unknown_keys:
175
+ errors.append(
176
+ f"{path}.target contains invalid keys {sorted(unknown_keys)}. "
177
+ f"Valid keys: {sorted(VALID_TARGET_KEYS)}"
178
+ )
179
+
180
+ # --- Locator quality rules ---
181
+
182
+ # Rule 1: 精确匹配器 (css/xpath/role) 必须来自 source evidence,检查选择器质量
183
+ for exact_key in EXACT_LOCATOR_KEYS & set(target.keys()):
184
+ value = str(target.get(exact_key, "")).strip()
185
+ if not value:
186
+ continue
187
+ if exact_key == "css":
188
+ if len(value) < MIN_CSS_LENGTH:
189
+ errors.append(
190
+ f"{path}.target.css='{value}' is too generic ({len(value)} chars, min {MIN_CSS_LENGTH}). "
191
+ f"CSS selectors are exact matchers and must be scoped. "
192
+ f"Add context: dialog footer, table row, form item, etc."
193
+ )
194
+ # CSS 选择器不应是裸的 tag/class 名(无组合器、无伪类)
195
+ if " " not in value and "." not in value and "#" not in value:
196
+ errors.append(
197
+ f"{path}.target.css='{value}' looks like a bare identifier. "
198
+ f"Use a scoped selector like '.el-dialog__footer .el-button--primary'."
199
+ )
200
+ if exact_key == "role":
201
+ if "name" not in target or not str(target.get("name", "")).strip():
202
+ errors.append(
203
+ f"{path}.target has 'role' but missing 'name'. "
204
+ f"role+name is a paired exact matcher; role alone is not scoped enough."
205
+ )
206
+
207
+ # Rule 2: 语义匹配器 — label 用于高风险文本时检查唯一性
208
+ label_value = str(target.get("label", "")).strip()
209
+ if label_value and label_value in HIGH_RISK_LABELS:
210
+ has_scope = bool(target.get("css") or target.get("near_text") or target.get("xpath"))
211
+ if not has_scope:
212
+ errors.append(
213
+ f"{path}.target.label='{label_value}' is a high-risk label "
214
+ f"(common table-row action, likely appears on multiple rows). "
215
+ f"Add scope with 'css' for row-specific selector, or use 'near_text' to bind to a row identifier."
216
+ )
217
+
218
+ # Rule 3: 验证步骤必须用 ai_only
219
+ if action in VERIFICATION_ACTIONS and strategy_mode != "ai_only":
220
+ errors.append(
221
+ f"{path}.action='{action}' is a verification step but strategy.mode='{strategy_mode}'. "
222
+ f"Verification steps must use strategy.mode='ai_only'. "
223
+ f"Visual verification of transient UI (toast, dialogs) is inherently an AI task."
224
+ )
225
+ # act + prompt 也是验证,同样要求 ai_only
226
+ if action == "act" and step.get("prompt") and strategy_mode != "ai_only":
227
+ errors.append(
228
+ f"{path}.action='act' with prompt indicates an AI-driven step but strategy.mode='{strategy_mode}'. "
229
+ f"Use strategy.mode='ai_only' for AI-driven verification/action steps."
230
+ )
231
+
232
+ if driver == "api":
233
+ for ai, assertion in enumerate(step.get("assertions") or []):
234
+ atype = str(assertion.get("type") or "")
235
+ if atype and atype not in VALID_ASSERTION_TYPES:
236
+ errors.append(
237
+ f"{path}.assertions[{ai}].type '{atype}' is not a valid assertion type. "
238
+ f"Valid types: {sorted(VALID_ASSERTION_TYPES)}"
239
+ )
240
+
241
+ # Web/UI steps: catch assertions that look like confused actions
242
+ if driver in {"web", "ui"}:
243
+ for ai, assertion in enumerate(step.get("assertions") or []):
244
+ atype = str(assertion.get("type") or "").lower()
245
+ if atype in {"text", "visible", "url_contains", "any_visible"}:
246
+ errors.append(
247
+ f"{path}.assertions[{ai}].type '{atype}' is not a valid assertion type. "
248
+ f"For web/ui steps, use action='assert_{atype}' instead of assertions[]."
249
+ )
250
+
251
+ for index, step in enumerate(steps):
252
+ for dep in step.get("depends_on") or []:
253
+ if dep not in step_ids:
254
+ errors.append(f"dsl_json.steps[{index}].depends_on references missing step '{dep}'")
255
+
256
+ case_tags = set(tags)
257
+ dsl_tags = set(dsl.get("tags") or [])
258
+ if not case_tags:
259
+ errors.append("tags must include api-mainflow or ui-mainflow")
260
+ elif not case_tags.issubset(MAINFLOW_TAGS):
261
+ errors.append(f"tags contain non-mainflow values: {tags}")
262
+ if not dsl_tags:
263
+ errors.append("dsl_json.tags must include api-mainflow or ui-mainflow")
264
+ elif not dsl_tags.issubset(MAINFLOW_TAGS):
265
+ errors.append(f"dsl_json.tags contain non-mainflow values: {dsl.get('tags')}")
266
+
267
+ return errors
268
+
269
+
270
+ def validate_project_dsl(dsl: dict[str, Any], validate_dsl: Any) -> list[str]:
271
+ result = validate_dsl(dsl)
272
+ if getattr(result, "valid", False):
273
+ return []
274
+ return [f"project dsl_parser: {error}" for error in getattr(result, "errors", [])]
275
+
276
+
277
+ def render_report(results: list[dict[str, Any]], warnings: list[str], payload_path: Path) -> str:
278
+ total_errors = sum(len(item["errors"]) for item in results)
279
+ status = "passed" if total_errors == 0 else "failed"
280
+ lines = [
281
+ "# Mainflow Case Validation Report",
282
+ "",
283
+ f"- Payload: `{payload_path}`",
284
+ f"- Generated at: {datetime.now(timezone.utc).isoformat()}",
285
+ f"- Status: **{status}**",
286
+ f"- Cases: {len(results)}",
287
+ f"- Errors: {total_errors}",
288
+ f"- Warnings: {len(warnings)}",
289
+ "",
290
+ "## Case Results",
291
+ "",
292
+ "| Case | Tags | Status | Errors |",
293
+ "|---|---|---:|---:|",
294
+ ]
295
+ for item in results:
296
+ case_status = "passed" if not item["errors"] else "failed"
297
+ lines.append(f"| {item['name']} | {', '.join(item['tags'])} | {case_status} | {len(item['errors'])} |")
298
+
299
+ if warnings:
300
+ lines.extend(["", "## Warnings", ""])
301
+ lines.extend(f"- {warning}" for warning in warnings)
302
+
303
+ failed = [item for item in results if item["errors"]]
304
+ if failed:
305
+ lines.extend(["", "## Errors", ""])
306
+ for item in failed:
307
+ lines.append(f"### {item['name']}")
308
+ for error in item["errors"]:
309
+ lines.append(f"- {error}")
310
+ lines.append("")
311
+
312
+ return "\n".join(lines).rstrip() + "\n"
313
+
314
+
315
+ def main() -> int:
316
+ parser = argparse.ArgumentParser()
317
+ parser.add_argument("input", help="case-import-payloads.json")
318
+ parser.add_argument("--discovery", required=True, help="codebase-discovery.json")
319
+ parser.add_argument("--output", required=True, help="validation-report.md")
320
+ args = parser.parse_args()
321
+
322
+ payload_path = Path(args.input)
323
+ discovery_path = Path(args.discovery)
324
+ output_path = Path(args.output)
325
+ warnings: list[str] = []
326
+ results: list[dict[str, Any]] = []
327
+
328
+ try:
329
+ payload = load_payload(payload_path)
330
+ if payload.get("cases"):
331
+ CaseCreate, project_validate_dsl = load_project_validators(discovery_path)
332
+ else:
333
+ CaseCreate = project_validate_dsl = None
334
+ except Exception as exc: # noqa: BLE001
335
+ output_path.parent.mkdir(parents=True, exist_ok=True)
336
+ output_path.write_text(
337
+ "# Mainflow Case Validation Report\n\n"
338
+ f"- Payload: `{payload_path}`\n"
339
+ "- Status: **failed**\n\n"
340
+ "## Errors\n\n"
341
+ f"- Validation bootstrap failed: {exc}\n",
342
+ encoding="utf-8",
343
+ )
344
+ print(f"ERROR: {exc}", file=sys.stderr)
345
+ return 2
346
+
347
+ if not payload.get("cases"):
348
+ warnings.append("No cases were generated.")
349
+
350
+ for index, case in enumerate(payload.get("cases") or [], start=1):
351
+ name = str(case.get("name") or f"case-{index}")
352
+ tags = list(case.get("tags") or [])
353
+ dsl = case.get("dsl_json") or {}
354
+ errors: list[str] = []
355
+ errors.extend(validate_case_payload_shape(case, CaseCreate))
356
+ errors.extend(validate_dsl_static(dsl, tags))
357
+ errors.extend(detect_secrets(case))
358
+ errors.extend(validate_project_dsl(dsl, project_validate_dsl))
359
+ results.append({"name": name, "tags": tags, "errors": errors})
360
+
361
+ report = render_report(results, warnings, payload_path)
362
+ output_path.parent.mkdir(parents=True, exist_ok=True)
363
+ output_path.write_text(report, encoding="utf-8")
364
+ total_errors = sum(len(item["errors"]) for item in results)
365
+ print(json.dumps({"status": "passed" if total_errors == 0 else "failed", "errors": total_errors}, ensure_ascii=False))
366
+ return 0 if total_errors == 0 else 1
367
+
368
+
369
+ if __name__ == "__main__":
370
+ raise SystemExit(main())
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: workflow-verify-work
3
+ description: "Use when implemented features need UAT, verification evidence, user-facing behavior checks, or failure routing before milestone audit."
4
+ ---
5
+
6
+ <objective>
7
+ Validate built features through conversational testing with persistent state.
8
+
9
+ Purpose: Confirm what the agent built actually works from the user's perspective. One test at a time, plain text responses, no interrogation. When issues are found, automatically diagnose, plan fixes, and prepare for execution.
10
+
11
+ Output:
12
+ - `{phase_num}-UAT.md` — raw test log (items, results, user responses)
13
+ - `{phase_num}-VERIFICATION.md` — formal verification report mapping REQ-IDs / FP-IDs to passed UAT items, with evidence summary and closure statement. Must be generated when all UAT items pass (no failures, no skips that block closure). If VERIFICATION.md already exists from execute-phase, merge UAT results into it rather than creating a duplicate.
14
+ - `.planning/phases/{phase}/01-VERIFICATION.meta.json` — structured metadata (`uat_passed`, `uat_failed`, `uat_skipped`, `gate_passed`, `gate_total`, `known_issues`). Schema in `feature-development.yaml` under `steps[verify].meta_output.fields`.
15
+ </objective>
16
+
17
+ <execution_context>
18
+ references/verify-work.md
19
+ assets/UAT.md
20
+ </execution_context>
21
+
22
+ <context>
23
+ Phase: $ARGUMENTS (optional)
24
+ - If provided: Test specific phase (e.g., "4")
25
+ - If not provided: Check for active sessions or prompt for phase
26
+
27
+ **Project rule package:**
28
+ During verification, discover and read applicable rule sources:
29
+ - `.planning/rules/INDEX.md`
30
+ - `.planning/execution-contract.md`
31
+ - `.planning/toolchain.md`
32
+ - `.planning/lessons/README.md`
33
+ - `.planning/milestones/`
34
+ - `.planning/requirements/`
35
+ - `.planning/code-index/`
36
+ - `.context/spec/`
37
+ - `.context/workflow/verification.md`
38
+ - `.context/workflow/checklist.md`
39
+ - `.context/lessons/README.md`(如存在)
40
+ - root `AGENTS.md`, `CLAUDE.md`, or equivalent project instruction files
41
+
42
+ Context files are resolved inside the workflow (`init verify-work`) and delegated via `<files_to_read>` blocks.
43
+ Use `.planning/milestones/`, `.planning/requirements/`, `.planning/lessons/`, and phase `CONTEXT.md` as primary history when verification needs prior decisions. Treat `features/` or `.context/lessons/` as optional legacy/project-rule sources only when present.
44
+ </context>
45
+
46
+ <verification_gates>
47
+ Verification must include these gates when project artifacts exist:
48
+
49
+ 1. **Change-list consistency gate**
50
+ - Locate the relevant `.planning/features/**/*变更清单.md` or phase plan. If missing, check legacy `features/**/*变更清单.md`.
51
+ - Check expected changes against implementation.
52
+ - If `.planning/code-index/` exists, use it to verify changed files, symbols, callers/callees, imports, and resource reads/writes before source readback.
53
+ - Report missing implementation, extra implementation, and deviations before functional UAT conclusions.
54
+
55
+ 2. **Project rule review gate**
56
+ - Review changed files against applicable project rules, task-level rules, and lessons.
57
+ - Existing code style may inform local patterns but must not override explicit project rules.
58
+ - Review the whole changed file or component boundary, not only the diff, when the project rules apply at file or layer level.
59
+ - Check both omissions and extras: missing required pieces, extra unplanned code, unused imports/fields/methods, stale generated artifacts, and duplicated implementations.
60
+ - If issues exist, produce a fix list and route back to execution.
61
+
62
+ 3. **Mainflow automation gate**
63
+ - Read `.planning/phases/{phase}/MAINFLOW-CASES.md`, `.planning/generated-cases/{feature}/validation-report.md`, and `.planning/generated-cases/{feature}/case-import-payloads.json` when they exist.
64
+ - If generated DSL validation failed, UAT does not pass.
65
+ - If mainflow case execution failed after import or direct execution, UAT does not pass.
66
+ - If environment or platform dependencies are missing and execution cannot run, mark verification `blocked`, not passed.
67
+ - If cases were not imported into the platform, complete at least static validation and record that import/execution remains pending.
68
+ - If cases were imported into the platform, record `execution_id` and execution result for each imported mainflow case.
69
+ - Mainflow cases must be limited to `api-mainflow` and `ui-mainflow`; any non-mainflow tag is a gate failure.
70
+
71
+ 4. **Toolchain and test gate**
72
+ - Run or require the commands declared by `.planning/toolchain.md`, `.planning/execution-contract.md`, `.context/workflow/verification.md`, or the change list.
73
+ - Include target tests, full tests, build, codegen/mock/DI checks, migration checks, and integration tests when applicable.
74
+
75
+ 5. **Compatibility gate**
76
+ - Check interface, database, config, data migration, permission, and consumer compatibility risks.
77
+ - For frontend-visible API/VO/schema changes, record backward compatibility or migration handling.
78
+ - For database/model/config changes, record migration, rollback, and deployment ordering risk.
79
+ - Record accepted residual risks explicitly.
80
+
81
+ 6. **Baseline decision gate**
82
+ - Compare implementation against `.planning/requirements/baseline.md`, especially `反向审视与用户拍板`, `待确认事项`, and `下游输入契约`.
83
+ - Confirm implemented behavior maps to `FP-*`, `BR-*`, `BC-*`, and confirmed `CR-*` decisions.
84
+ - Any implemented scope based on a pending decision is a verification failure unless the user explicitly approved it.
85
+
86
+ 7. **Lessons extraction gate**
87
+ - After verification is complete, review the findings for lessons worth preserving.
88
+ - Candidate triggers for a lesson:
89
+ - A regression was caught early — what pattern prevented it?
90
+ - A non-obvious interaction between modules was discovered
91
+ - A test gap was identified that exists beyond this feature
92
+ - A design decision was made that future tasks must reference
93
+ - If a lesson candidate exists, write to `.context/lessons/YYYY-MM-DD-{slug}.md`.
94
+ - If no candidate, skip.
95
+ - This gate covers both positive patterns (successful approach worth repeating) and negative patterns (regression prevention).
96
+
97
+ The feature is complete only when UAT, mainflow automation, baseline decision, consistency, project rule review, compatibility, and required toolchain/test gates pass or have explicit user-approved exceptions.
98
+
99
+ When all gates pass: write `VERIFICATION.md` before exiting. This is non-negotiable — downstream `workflow-audit-milestone` requires it.
100
+ </verification_gates>
101
+
102
+ <process>
103
+ Execute the verify-work workflow from references/verify-work.md end-to-end.
104
+ Preserve all workflow gates (session management, test presentation, diagnosis, fix planning, routing).
105
+ Additionally preserve the verification gates above before declaring the work complete.
106
+ </process>