@leocm/flowcraft 0.0.0-stage → 2.0.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 (269) hide show
  1. package/README.md +846 -3
  2. package/bin/cli.js +102 -0
  3. package/flowcraft.yaml +30 -0
  4. package/install.sh +24 -0
  5. package/lib/args.js +34 -0
  6. package/lib/config.js +20 -0
  7. package/lib/copy.js +131 -0
  8. package/lib/fix.js +110 -0
  9. package/lib/fsutil.js +104 -0
  10. package/lib/global.js +229 -0
  11. package/lib/init.js +43 -0
  12. package/lib/runtime.js +84 -0
  13. package/lib/version.js +55 -0
  14. package/lib/wizard.js +125 -0
  15. package/package.json +31 -4
  16. package/presets/backend.yaml +20 -0
  17. package/presets/default.yaml +15 -0
  18. package/presets/frontend.yaml +20 -0
  19. package/presets/quick-fix.yaml +15 -0
  20. package/setup/.claude/commands/P0.5.md +1 -0
  21. package/setup/.claude/commands/P0.md +1 -0
  22. package/setup/.claude/commands/P1.md +1 -0
  23. package/setup/.claude/commands/P2.md +1 -0
  24. package/setup/.claude/commands/P3.md +1 -0
  25. package/setup/.claude/commands/P4.md +1 -0
  26. package/setup/.claude/commands/P5.md +1 -0
  27. package/setup/.claude/commands/code-analysis-init.md +1 -0
  28. package/setup/.claude/commands/code-analysis-rebuild.md +1 -0
  29. package/setup/.claude/commands/code-analysis-show-memory.md +1 -0
  30. package/setup/.claude/commands/code-analysis-update.md +1 -0
  31. package/setup/.claude/hooks/check-phase-advancement.py +180 -0
  32. package/setup/.claude/hooks/check-phase-test.py +152 -0
  33. package/setup/.claude/hooks/check-phase-write.py +232 -0
  34. package/setup/.claude/hooks/dispatch.py +64 -0
  35. package/setup/.claude/hooks/file-suggestion.py +45 -0
  36. package/setup/.claude/hooks/flowcraft_env.py +99 -0
  37. package/setup/.claude/hooks/log_session.py +91 -0
  38. package/setup/.claude/hooks/permission-request.py +125 -0
  39. package/setup/.claude/hooks/post-tool-failure.py +34 -0
  40. package/setup/.claude/hooks/pre-compact.py +64 -0
  41. package/setup/.claude/hooks/review-runner.py +844 -0
  42. package/setup/.claude/hooks/session-end.py +182 -0
  43. package/setup/.claude/hooks/session-start.py +188 -0
  44. package/setup/.claude/hooks/settings.json +0 -0
  45. package/setup/.claude/hooks/setup-keys.py +280 -0
  46. package/setup/.claude/hooks/statusline.py +61 -0
  47. package/setup/.claude/hooks/stop-check.py +169 -0
  48. package/setup/.claude/hooks/subagent-start.py +48 -0
  49. package/setup/.claude/hooks/subagent-stop.py +61 -0
  50. package/setup/.claude/hooks/task-completed.py +55 -0
  51. package/setup/.claude/hooks/task_manager.py +592 -0
  52. package/setup/.claude/hooks/user-prompt-submit.py +85 -0
  53. package/setup/.claude/project-state.md +109 -0
  54. package/setup/.claude/settings.json +237 -0
  55. package/setup/.claude/settings.local.json +13 -0
  56. package/setup/.claude/skills/P5report/SKILL.md +77 -0
  57. package/setup/.claude/skills/Pstatus/SKILL.md +68 -0
  58. package/setup/.claude/skills/archive/SKILL.md +196 -0
  59. package/setup/.claude/skills/brainstorming/SKILL.md +155 -0
  60. package/setup/.claude/skills/brainstorming/scripts/frame-template.html +213 -0
  61. package/setup/.claude/skills/brainstorming/scripts/helper.js +167 -0
  62. package/setup/.claude/skills/brainstorming/scripts/server.cjs +723 -0
  63. package/setup/.claude/skills/brainstorming/scripts/start-server.py +245 -0
  64. package/setup/.claude/skills/brainstorming/scripts/stop-server.py +178 -0
  65. package/setup/.claude/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  66. package/setup/.claude/skills/brainstorming/visual-companion.md +298 -0
  67. package/setup/.claude/skills/checkpoint/SKILL.md +42 -0
  68. package/setup/.claude/skills/chrome-integration/SKILL.md +67 -0
  69. package/setup/.claude/skills/code-analysis/SKILL.md +1243 -0
  70. package/setup/.claude/skills/code-review/SKILL.md +265 -0
  71. package/setup/.claude/skills/cross-review/SKILL.md +41 -0
  72. package/setup/.claude/skills/executing-plans/SKILL.md +64 -0
  73. package/setup/.claude/skills/git-prep/SKILL.md +50 -0
  74. package/setup/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
  75. package/setup/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
  76. package/setup/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
  77. package/setup/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
  78. package/setup/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
  79. package/setup/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
  80. package/setup/.claude/skills/graphify/SKILL.md +49 -0
  81. package/setup/.claude/skills/openspec-apply-change/SKILL.md +185 -0
  82. package/setup/.claude/skills/openspec-archive-change/SKILL.md +182 -0
  83. package/setup/.claude/skills/openspec-bulk-archive-change/SKILL.md +339 -0
  84. package/setup/.claude/skills/openspec-continue-change/SKILL.md +118 -0
  85. package/setup/.claude/skills/openspec-explore/SKILL.md +311 -0
  86. package/setup/.claude/skills/openspec-ff-change/SKILL.md +113 -0
  87. package/setup/.claude/skills/openspec-new-change/SKILL.md +77 -0
  88. package/setup/.claude/skills/openspec-onboard/SKILL.md +573 -0
  89. package/setup/.claude/skills/openspec-propose/SKILL.md +149 -0
  90. package/setup/.claude/skills/openspec-sync-specs/SKILL.md +262 -0
  91. package/setup/.claude/skills/openspec-update-change/SKILL.md +91 -0
  92. package/setup/.claude/skills/openspec-verify-change/SKILL.md +175 -0
  93. package/setup/.claude/skills/oss-version-check/SKILL.md +71 -0
  94. package/setup/.claude/skills/oss-version-check/check_oss_version.py +205 -0
  95. package/setup/.claude/skills/phase/SKILL.md +63 -0
  96. package/setup/.claude/skills/playwright/SKILL.md +86 -0
  97. package/setup/.claude/skills/playwright-cli/SKILL.md +420 -0
  98. package/setup/.claude/skills/playwright-cli/references/element-attributes.md +23 -0
  99. package/setup/.claude/skills/playwright-cli/references/playwright-tests.md +39 -0
  100. package/setup/.claude/skills/playwright-cli/references/references/element-attributes.md +23 -0
  101. package/setup/.claude/skills/playwright-cli/references/references/playwright-tests.md +39 -0
  102. package/setup/.claude/skills/playwright-cli/references/references/request-mocking.md +87 -0
  103. package/setup/.claude/skills/playwright-cli/references/references/running-code.md +241 -0
  104. package/setup/.claude/skills/playwright-cli/references/references/session-management.md +225 -0
  105. package/setup/.claude/skills/playwright-cli/references/references/storage-state.md +275 -0
  106. package/setup/.claude/skills/playwright-cli/references/references/test-generation.md +433 -0
  107. package/setup/.claude/skills/playwright-cli/references/references/tracing.md +139 -0
  108. package/setup/.claude/skills/playwright-cli/references/references/video-recording.md +143 -0
  109. package/setup/.claude/skills/playwright-cli/references/request-mocking.md +87 -0
  110. package/setup/.claude/skills/playwright-cli/references/running-code.md +241 -0
  111. package/setup/.claude/skills/playwright-cli/references/session-management.md +225 -0
  112. package/setup/.claude/skills/playwright-cli/references/storage-state.md +275 -0
  113. package/setup/.claude/skills/playwright-cli/references/test-generation.md +433 -0
  114. package/setup/.claude/skills/playwright-cli/references/tracing.md +139 -0
  115. package/setup/.claude/skills/playwright-cli/references/video-recording.md +143 -0
  116. package/setup/.claude/skills/review/SKILL.md +98 -0
  117. package/setup/.claude/skills/review-tools/SKILL.md +76 -0
  118. package/setup/.claude/skills/subagent-driven-development/SKILL.md +94 -0
  119. package/setup/.claude/skills/task/SKILL.md +26 -0
  120. package/setup/.claude/skills/test-driven-development/SKILL.md +320 -0
  121. package/setup/.claude/skills/test-driven-development/writing-good-tests.md +198 -0
  122. package/setup/.claude/skills/ui-ux-pro-max/SKILL.md +377 -0
  123. package/setup/.claude/skills/ui-ux-pro-max/data/charts.csv +26 -0
  124. package/setup/.claude/skills/ui-ux-pro-max/data/colors.csv +97 -0
  125. package/setup/.claude/skills/ui-ux-pro-max/data/icons.csv +101 -0
  126. package/setup/.claude/skills/ui-ux-pro-max/data/landing.csv +31 -0
  127. package/setup/.claude/skills/ui-ux-pro-max/data/products.csv +97 -0
  128. package/setup/.claude/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  129. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  130. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  131. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  132. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  133. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  134. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  135. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  136. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  137. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  138. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  139. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  140. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  141. package/setup/.claude/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  142. package/setup/.claude/skills/ui-ux-pro-max/data/styles.csv +68 -0
  143. package/setup/.claude/skills/ui-ux-pro-max/data/typography.csv +58 -0
  144. package/setup/.claude/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  145. package/setup/.claude/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  146. package/setup/.claude/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  147. package/setup/.claude/skills/ui-ux-pro-max/scripts/core.py +253 -0
  148. package/setup/.claude/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  149. package/setup/.claude/skills/ui-ux-pro-max/scripts/search.py +114 -0
  150. package/setup/.claude/skills/ui-ux-standards/SKILL.md +154 -0
  151. package/setup/.claude/skills/verification-before-completion/SKILL.md +120 -0
  152. package/setup/.claude/skills/wiki-read/SKILL.md +190 -0
  153. package/setup/.claude/skills/writing-plans/SKILL.md +168 -0
  154. package/setup/.claude/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  155. package/setup/.claude/tasks/.last-session +1 -0
  156. package/setup/.codex/.agents/skills/P5report/SKILL.md +77 -0
  157. package/setup/.codex/.agents/skills/Pstatus/SKILL.md +30 -0
  158. package/setup/.codex/.agents/skills/archive/SKILL.md +196 -0
  159. package/setup/.codex/.agents/skills/brainstorming/SKILL.md +155 -0
  160. package/setup/.codex/.agents/skills/brainstorming/scripts/frame-template.html +213 -0
  161. package/setup/.codex/.agents/skills/brainstorming/scripts/helper.js +167 -0
  162. package/setup/.codex/.agents/skills/brainstorming/scripts/server.cjs +723 -0
  163. package/setup/.codex/.agents/skills/brainstorming/scripts/start-server.py +245 -0
  164. package/setup/.codex/.agents/skills/brainstorming/scripts/stop-server.py +178 -0
  165. package/setup/.codex/.agents/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  166. package/setup/.codex/.agents/skills/brainstorming/visual-companion.md +298 -0
  167. package/setup/.codex/.agents/skills/checkpoint/SKILL.md +42 -0
  168. package/setup/.codex/.agents/skills/chrome-integration/SKILL.md +67 -0
  169. package/setup/.codex/.agents/skills/code-analysis/SKILL.md +1243 -0
  170. package/setup/.codex/.agents/skills/code-review/SKILL.md +265 -0
  171. package/setup/.codex/.agents/skills/cross-review/SKILL.md +42 -0
  172. package/setup/.codex/.agents/skills/executing-plans/SKILL.md +64 -0
  173. package/setup/.codex/.agents/skills/git-prep/SKILL.md +50 -0
  174. package/setup/.codex/.agents/skills/gitnexus/gitnexus-cli/SKILL.md +67 -0
  175. package/setup/.codex/.agents/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
  176. package/setup/.codex/.agents/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
  177. package/setup/.codex/.agents/skills/gitnexus/gitnexus-guide/SKILL.md +66 -0
  178. package/setup/.codex/.agents/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
  179. package/setup/.codex/.agents/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
  180. package/setup/.codex/.agents/skills/graphify/SKILL.md +49 -0
  181. package/setup/.codex/.agents/skills/openspec-apply-change/SKILL.md +185 -0
  182. package/setup/.codex/.agents/skills/openspec-archive-change/SKILL.md +182 -0
  183. package/setup/.codex/.agents/skills/openspec-bulk-archive-change/SKILL.md +339 -0
  184. package/setup/.codex/.agents/skills/openspec-continue-change/SKILL.md +118 -0
  185. package/setup/.codex/.agents/skills/openspec-explore/SKILL.md +311 -0
  186. package/setup/.codex/.agents/skills/openspec-ff-change/SKILL.md +113 -0
  187. package/setup/.codex/.agents/skills/openspec-new-change/SKILL.md +77 -0
  188. package/setup/.codex/.agents/skills/openspec-onboard/SKILL.md +573 -0
  189. package/setup/.codex/.agents/skills/openspec-propose/SKILL.md +149 -0
  190. package/setup/.codex/.agents/skills/openspec-sync-specs/SKILL.md +262 -0
  191. package/setup/.codex/.agents/skills/openspec-update-change/SKILL.md +91 -0
  192. package/setup/.codex/.agents/skills/openspec-verify-change/SKILL.md +175 -0
  193. package/setup/.codex/.agents/skills/oss-version-check/SKILL.md +71 -0
  194. package/setup/.codex/.agents/skills/oss-version-check/check_oss_version.py +205 -0
  195. package/setup/.codex/.agents/skills/phase/SKILL.md +63 -0
  196. package/setup/.codex/.agents/skills/playwright/SKILL.md +86 -0
  197. package/setup/.codex/.agents/skills/playwright-cli/SKILL.md +420 -0
  198. package/setup/.codex/.agents/skills/playwright-cli/references/element-attributes.md +23 -0
  199. package/setup/.codex/.agents/skills/playwright-cli/references/playwright-tests.md +39 -0
  200. package/setup/.codex/.agents/skills/playwright-cli/references/references/element-attributes.md +23 -0
  201. package/setup/.codex/.agents/skills/playwright-cli/references/references/playwright-tests.md +39 -0
  202. package/setup/.codex/.agents/skills/playwright-cli/references/references/request-mocking.md +87 -0
  203. package/setup/.codex/.agents/skills/playwright-cli/references/references/running-code.md +241 -0
  204. package/setup/.codex/.agents/skills/playwright-cli/references/references/session-management.md +225 -0
  205. package/setup/.codex/.agents/skills/playwright-cli/references/references/storage-state.md +275 -0
  206. package/setup/.codex/.agents/skills/playwright-cli/references/references/test-generation.md +433 -0
  207. package/setup/.codex/.agents/skills/playwright-cli/references/references/tracing.md +139 -0
  208. package/setup/.codex/.agents/skills/playwright-cli/references/references/video-recording.md +143 -0
  209. package/setup/.codex/.agents/skills/playwright-cli/references/request-mocking.md +87 -0
  210. package/setup/.codex/.agents/skills/playwright-cli/references/running-code.md +241 -0
  211. package/setup/.codex/.agents/skills/playwright-cli/references/session-management.md +225 -0
  212. package/setup/.codex/.agents/skills/playwright-cli/references/storage-state.md +275 -0
  213. package/setup/.codex/.agents/skills/playwright-cli/references/test-generation.md +433 -0
  214. package/setup/.codex/.agents/skills/playwright-cli/references/tracing.md +139 -0
  215. package/setup/.codex/.agents/skills/playwright-cli/references/video-recording.md +143 -0
  216. package/setup/.codex/.agents/skills/review/SKILL.md +98 -0
  217. package/setup/.codex/.agents/skills/review-tools/SKILL.md +76 -0
  218. package/setup/.codex/.agents/skills/subagent-driven-development/SKILL.md +94 -0
  219. package/setup/.codex/.agents/skills/task/SKILL.md +27 -0
  220. package/setup/.codex/.agents/skills/test-driven-development/SKILL.md +320 -0
  221. package/setup/.codex/.agents/skills/test-driven-development/writing-good-tests.md +198 -0
  222. package/setup/.codex/.agents/skills/ui-ux-pro-max/SKILL.md +377 -0
  223. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
  224. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
  225. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
  226. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
  227. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
  228. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  229. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  230. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  231. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  232. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  233. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  234. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  235. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  236. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  237. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  238. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  239. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  240. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  241. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  242. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
  243. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
  244. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  245. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  246. package/setup/.codex/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  247. package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
  248. package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  249. package/setup/.codex/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
  250. package/setup/.codex/.agents/skills/ui-ux-standards/SKILL.md +154 -0
  251. package/setup/.codex/.agents/skills/verification-before-completion/SKILL.md +120 -0
  252. package/setup/.codex/.agents/skills/wiki-read/SKILL.md +190 -0
  253. package/setup/.codex/.agents/skills/writing-plans/SKILL.md +168 -0
  254. package/setup/.codex/.agents/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  255. package/setup/.codex/config.toml +10 -0
  256. package/setup/.codex/hooks/log_session.py +85 -0
  257. package/setup/.codex/hooks/review-runner.py +844 -0
  258. package/setup/.codex/hooks/sdlc-codex-hook.cjs +1020 -0
  259. package/setup/.codex/hooks/setup-keys.py +280 -0
  260. package/setup/.codex/hooks.json +121 -0
  261. package/setup/.codex/model-catalog.json +154 -0
  262. package/setup/.codex/project-state.md +103 -0
  263. package/setup/AGENTS.md +722 -0
  264. package/setup/CLAUDE.md +717 -0
  265. package/setup/install.sh +24 -0
  266. package/setup/tests/test_decision_timeout.py +241 -0
  267. package/setup/tests/test_hook_guards.py +341 -0
  268. package/setup/tests/test_sdlc_bootstrap.py +167 -0
  269. package/setup/tests/test_task_manager.py +148 -0
@@ -0,0 +1,722 @@
1
+ Harness 工程> This file is the Codex edition of the SDLC standard.
2
+ > State file: `.codex/project-state.md` (the single Codex state file; must be read at the start of every session).
3
+
4
+ ## Codex Command & Skill Mapping (命令与技能映射)
5
+
6
+ - `/phase`, `/P0`~`/P5`, `/P0.5` → handled by the `.agents/skills/phase` skill
7
+ - `/Pstatus` → `.agents/skills/Pstatus`
8
+ - `/review` → `.agents/skills/review`; `/code-review` → `.agents/skills/code-review`
9
+ - `/P5report` → `.agents/skills/P5report`; `/archive` → `.agents/skills/archive`; `/checkpoint` → `.agents/skills/checkpoint`
10
+ - `/wiki-read` → `.agents/skills/wiki-read`; `/code-analysis` → `.agents/skills/code-analysis`
11
+ - `/ui-ux-pro-max` → `.agents/skills/ui-ux-pro-max`; `/playwright` → `.agents/skills/playwright`
12
+ - gitnexus-* → corresponding skill under `.agents/skills/gitnexus/`
13
+ - `/git-prep` → `.agents/skills/git-prep` (P2 branch preparation)
14
+ - If a skill does not exist, follow the corresponding SKILL.md
15
+
16
+ ## Codex Automation (hooks)
17
+
18
+ Phase guard (阶段守卫), state injection, and session logging are executed automatically by `.codex/hooks.json` + `.codex/hooks/sdlc-codex-hook.cjs`:
19
+ - SessionStart: inject project state
20
+ - UserPromptSubmit: record the user question into `.codex/session_log.json`
21
+ - PreToolUse: phase write guard + phase advancement check (apply_patch / shell_command)
22
+ - PermissionRequest: SDLC permission decisions
23
+ - SubagentStart / SubagentStop: inject and validate sub-agent context
24
+ - PreCompact: state reminder before compaction
25
+ - Stop: record the AI reply and self-check
26
+ - SessionEnd: generate `.codex/session_log.md`
27
+
28
+
29
+ # SDLC Development Standard (Codex Edition)
30
+
31
+ > Available commands: `/phase`, `/P0`, `/P1`, `/P2`, `/P3`, `/P4`, `/P5`, `/Pstatus`, `/checkpoint`, `/review`, `/archive`, `/wiki-read`, `/code-review`, `/P5report`
32
+
33
+ @.codex/project-state.md
34
+
35
+ ## Framework Maintenance Rule (2026-08-19)
36
+
37
+ - `flowcraft/` is the distribution package; install source is `flowcraft/setup/` (install.sh copies from setup to project root).
38
+ - After modifying framework files (`.codex/hooks.json`, `.codex/hooks/*.cjs`, `.agents/skills` / `.claude/skills` skills, AGENTS.md / CLAUDE.md), MUST sync to `flowcraft/setup/` (and `sdlc-skills` mirrors) to take effect on next install.
39
+
40
+ ## FlowCraft Configuration (flowcraft.yaml)
41
+
42
+ Stage behavior is controlled by `flowcraft.yaml` in the project root:
43
+
44
+ - `stages.P1/P3/P5: auto` → AI decides based on complexity (low=skip, medium/high=keep)
45
+ - `stages.P2: true` → always enabled
46
+ - `stages.P4: true` → always enabled
47
+ - Complexity assessed at P0 → written to `project-state.md` → `complexity_level`
48
+ - Safety: first task always full flow; security changes never skip P1/P3
49
+
50
+ ## Startup Instructions (Mandatory)
51
+
52
+ **At the start of every conversation the following steps MUST be executed; do not skip:**
53
+
54
+ 1. **Read `.codex/project-state.md`** to get `current_phase`
55
+ 2. **Identify the request type**:
56
+ - "implement / fix / refactor / what changes / add / modify" → **modification task**
57
+ - "analyze / explain / view / why / how" → **consultation task**
58
+ 3. **Automatic phase transition** (modification task + P0 state):
59
+ - When `current_phase = P0` and the request is a modification task → **auto-execute `/P1`**
60
+ - After entering P1, perform requirement clarification and technical analysis
61
+ 4. **Phase state handling**:
62
+ - P1-P5: report status and continue
63
+ - P0 + consultation task: answer the question, do NOT enter P1
64
+ - P0.5: report the issue and wait for user decision
65
+
66
+ **Consequence of violation**: modifying code directly in P0 = SDLC violation; code must be rolled back and the flow redone.
67
+
68
+ ## Skill Trigger Rules
69
+
70
+ ### Automatic phase triggers
71
+
72
+ | Phase | Trigger | Skill | Description |
73
+ |-------|---------|-------|-------------|
74
+ | P0+modification task | auto | `/P1` | enter requirements phase |
75
+ | P1 | at start | `brainstorming` | brainstorm requirements & design |
76
+ | P1 | method B selected | `openspec-explore` / `openspec-propose` | spec-driven requirement clarification |
77
+ | P2 | method B selected | `openspec-apply-change` | implement per tasks |
78
+ | P3/P4 | method B selected | `openspec-verify-change` | verify implementation vs specs |
79
+ | P5 | method B selected | `openspec-archive-change` | archive change |
80
+ | P1 | at start | `/wiki-read` | mandatory prerequisite |
81
+ | P1 | at start | `/gitnexus-cli` | check index status (GitNexus preferred; graphify disabled) |
82
+ | P2 | at start | `subagent-driven-development` | parallel task development |
83
+ | P2 | on completion | `/code-review` | AI code review |
84
+ | P4 | at start | `/review` | comprehensive review |
85
+ | P5 | in progress | `/P5report` | generate report |
86
+ | P5 | in progress | `/archive` | archive task |
87
+ | P5 | in progress | `code-analysis update` | update Wiki |
88
+
89
+ ### On-demand triggers
90
+
91
+ | Scenario | Skill | Command |
92
+ |----------|-------|---------|
93
+ | Debug issue | gitnexus-debugging | `/gitnexus-debugging` |
94
+ | Explore code | gitnexus-exploring | `/gitnexus-exploring` |
95
+ | Impact analysis | gitnexus-impact-analysis | `/gitnexus-impact-analysis` |
96
+ | Refactor code | gitnexus-refactoring | `/gitnexus-refactoring` |
97
+ | GitNexus guidance | gitnexus-guide | `/gitnexus-guide` |
98
+ | UI/UX design | ui-ux-pro-max | `/ui-ux-pro-max` |
99
+ | End-to-end test | playwright | `/playwright` |
100
+ | Prototype demo | chrome-integration | - |
101
+ | Code review | code-review | `/code-review` |
102
+ | View status | Pstatus | `/Pstatus` |
103
+ | Save snapshot | checkpoint | `/checkpoint` |
104
+ | Clean & archive | archive | `/archive` |
105
+ | Branch preparation | git-prep | `/git-prep` |
106
+ | Version verification | oss-version-check | `/oss-version-check` |
107
+
108
+ ## Output Format Standard
109
+
110
+ ### Phase status display (at the start of every reply)
111
+
112
+ ```
113
+ ┌─────────────────────────────────────────────────────────────────┐
114
+ │ SDLC │ P2 编码实现 │ ████████░░░░ 60% │ 当前任务: 实现登录功能 │
115
+ └─────────────────────────────────────────────────────────────────┘
116
+ ```
117
+
118
+ **Format notes**:
119
+ - Fixed-width border, content centered
120
+ - Phase names: P0 Standby / P1 Requirements & Design / P2 Coding / P3 Testing / P4 Review / P5 Delivery
121
+ - Progress bar: `█` done / `░` pending, total length 12 characters
122
+ - Task description: read from `task_description`, truncate beyond 20 chars
123
+ - **No background colors**: do not use ANSI background color codes (e.g. \033[40-47m, \033[100-107m); border characters themselves are fine
124
+
125
+ **Progress calculation**:
126
+ - P0: 0%
127
+ - P1: completed decision points × 20% (max 5 decision points)
128
+ - P2: coding done 50% + review passed 100%
129
+ - P3: tests passed 100%
130
+ - P4: review passed 100%
131
+ - P5: report generated 50% + archived 100%
132
+
133
+ ## Core Rules
134
+
135
+ - **Develop strictly per PRD**: every line of code must map to a PRD requirement. If you cannot answer which requirement it maps to, do not write it. Adding or removing anything outside the PRD is forbidden.
136
+ - **Execute the six phases in order**: P1 requirements+design → P2 coding → P3 testing → P4 review → P5 delivery. P0.5 (problem rollback) triggers on demand.
137
+ - **Review only once**: P4 is the only formal review gate (code + tests + integration + PRD traceability). P1 advances on user confirmation; P2/P3/P4/P5 advance directly upon completion.
138
+ **P4 cross-model review (dual-run merge)**: current model + user-selected model each review once, merged (skip if same). Codex uses codex CLI, Claude uses claude CLI (no cross-contamination). Model list in model-catalog.json, keys per directory api-keys.json (scripts: .codex/hooks/review-runner.py / .codex/hooks/review-runner.py, auto-discovered by setup-keys.py). When user selects an unconfigured model, confirm base_url / context / key / model first, write to api-keys.json, then run.
139
+ - **Auto-driven**: after the user confirms the PRD in P1, P2-P5 run fully automatically. Once P4 review passes, advance directly to P5 without user confirmation. If P4 fails, auto-fix (up to 3 times).
140
+ - **One question at a time**: each decision point must be asked separately; combining multiple decision points into one message is forbidden.
141
+ - **Automatic task identification**: "implement / fix / refactor / what changes / add / modify" → **modification task** → automatically enter P1. "analyze / explain / view / why / how" → **consultation task** → answer directly in P0, do not enter P1. After an old task completes, a new request → archive to `completed_tasks` + reset task fields + new P1. **`project_roadmap` / `completed_tasks` / `global_architecture` are never reset**
142
+ - **Problem rollback**: when an issue is found in completed functionality → enter P0.5, do not modify code casually
143
+ - **Version selection must be user-confirmed**: when adding new dependencies/components, the P1 phase must first run `/oss-version-check` to verify the real latest stable version and known vulnerabilities (Maven Central / GitHub Releases / OSV), then provide version suggestions (current stable / latest / LTS) with a version verification table, and **wait for user confirmation before use**. Choosing a version on your own is forbidden. If the network is unavailable, mark the suggestion as "unverified" and re-verify after the network recovers.
144
+
145
+ ## Wiki Cross-Validation Rules (Mandatory)
146
+
147
+ Every SDLC phase must perform Wiki cross-validation to ensure docs and code stay consistent:
148
+
149
+ | Phase | Wiki validation action | What to do |
150
+ |-------|------------------------|------------|
151
+ | **P1 requirements clarification** | Read Wiki | Read `wiki/main`, `wiki/{module}/` docs; verify the requirement understanding matches existing docs |
152
+ | **P2 coding** | Wiki validation | When analyzing code, compare against Wiki architecture/process docs; verify implementation matches design |
153
+ | **P5 delivery & archive** | Update Wiki | Run `code-analysis update` for incremental Wiki updates |
154
+
155
+ ### Wiki directory detection
156
+
157
+ ```
158
+ 1. Check whether a `wiki/` directory exists at the project root
159
+ 2. If it exists → Wiki path is `wiki/`
160
+ 3. If not → Wiki path is `docs/wiki/`
161
+ ```
162
+
163
+ ### Per-phase Wiki operations
164
+
165
+ **P1 requirement clarification phase**:
166
+ - Read the relevant module Wiki docs (architecture, process, requirements)
167
+ - Cross-check against the user requirements
168
+ - Raise confirmation when inconsistencies are found
169
+
170
+ **P2 coding phase**:
171
+ - Code against the design docs in Wiki
172
+ - Flag issues when Wiki and code disagree
173
+ - Propose doc updates when necessary
174
+
175
+ **P5 delivery & archive phase**:
176
+ - Run `code-analysis update {module}` to update Wiki
177
+ - Ensure code changes are synced to Wiki docs
178
+ - Complete archiving
179
+
180
+ ## P2 Coding Phase
181
+
182
+ **P2 execution flow (mandatory)**: Code index check (GitNexus preferred; graphify disabled) → /git-prep branch preparation (public-branch guard + branch naming + fetch/pull) → ask development method → ask whether to enable subagent-driven-development → code / AI review → handle issues → P3
183
+
184
+ ### Change log template
185
+
186
+ Every completed task MUST print a change description:
187
+ ```
188
+ [实现记录 / Change Log]
189
+ - 任务 / Task: xxx
190
+ - 修改内容 / Change: added/modified xxx
191
+ - 修改位置 / Location: xxx.java:line
192
+ - 影响 / Impact: may cause xxx to change
193
+ ```
194
+
195
+ ### Coding process constraints
196
+
197
+ 1. **Pause and clarify immediately when a problem is found**
198
+ - If the plan cannot be implemented → print the problem description → wait for user confirmation
199
+ - If a requirement gap is found → print the defect description → wait for user confirmation
200
+ - Continuing to code without user permission is forbidden
201
+
202
+ 2. **Dependency/version issues must be clarified**
203
+ - If dependency versions do not match the code → print the version conflict → wait for user confirmation
204
+ - If new/upgraded dependencies are needed → print the dependency change → wait for user confirmation
205
+ - If environment differences exist (e.g. JDK version) → print the environment difference → wait for user confirmation
206
+ - **Never change pom.xml version numbers or dependency versions on your own**
207
+
208
+ ### Code graph usage
209
+ - **GitNexus (preferred)**: must use when indexed (impact/query/context/rename/detect_changes); see GitNexus section
210
+ - **graphify (disabled)**: only enable when user explicitly requests; skip when not indexed
211
+
212
+ ### Development method selection
213
+
214
+ **dev_method (agent mode)**: sub-agent driven approach (already determined in P1)
215
+
216
+ **code_method (coding method)**: ask the user to choose
217
+ 1. **TDD** — write test cases first, then implementation
218
+ 2. **Normal coding** — implement directly, compile+test all tasks together at the end
219
+
220
+ > Normal coding special rule: complete all tasks → compile/verify → go directly to P4 review (skip P3 testing)
221
+
222
+ ### P2 completion self-review (mandatory)
223
+ Before declaring a coding task complete (and before AI code review), answer three questions honestly and emit `[P2-COMPLETION]`:
224
+ 1. **Correctness (正确性)** — does the change actually solve the problem? Any typos, missing imports, wrong paths, off-by-one errors?
225
+ 2. **Side effects (副作用)** — does it break callers/tests? Have you traced every caller of every function you modified?
226
+ 3. **Closure (收尾)** — have you met every PRD acceptance criterion? What is still not done?
227
+ If any answer is "not sure", go back and verify — never declare completion without the self-review.
228
+ Completion marker:
229
+ ```
230
+ [P2-COMPLETION]
231
+ ## What I changed
232
+ - <file> — <one-line description>
233
+ ## Impact analysis
234
+ - Affected callers: <list or none>
235
+ - Verification: <tests/commands run>
236
+ ```
237
+
238
+ ### AI code review (auto-triggered after P2)
239
+
240
+ 1. **Trigger time**: P2 phase completed → before transitioning to P3
241
+ 2. **Read files**: read the `modified_files` list from `project-state.md`
242
+ 3. **Perform review**: review each file for AI code quality (based on the Alibaba Java Development Manual)
243
+ 4. **Issue handling**:
244
+ - No issues: **auto-advance to P3 without user confirmation**
245
+ - Issues found: **must first list the complete issue list** (file, line, description, severity), **wait for client confirmation before fixing**
246
+ - After the client confirms the fix method:
247
+ - A. AI-generated: AI generates the fix, user confirms, back to P2
248
+ - B. User-directed: user tells the fix approach, AI executes, back to P2
249
+ - C. Ignore: record the exemption, enter P3
250
+ - **Hard constraint**: forbidden to modify code before listing the issue list or obtaining client confirmation
251
+ - **Retry limit**: same issue max 5 fixes; after that must stop and ask the user to intervene (prevent infinite loops)
252
+ 5. **Save report**: review report saved to `.codex/code-review-report.md`
253
+
254
+ **Manual invocation**: user can run `/code-review` at any time
255
+ ## P0.5 Problem Rollback (on demand)
256
+
257
+ Receive issue report → record symptom → root-cause analysis (requirement ambiguity / design flaw / implementation bug) → A/B/C decision → wait for user choice, then execute:
258
+ - **A** Optimize on original approach → P1 (approach has direction but has flaws)
259
+ - **B** Redo requirements → P1 (requirements themselves are problematic)
260
+ - **C** Fix code directly (not recommended, only when error is clear and does not affect approach)
261
+
262
+ After execution → update `phase_history` → `current_phase` returns to P0
263
+
264
+ ## P1 Requirements Clarification + Research + Design + Prototype
265
+
266
+ **P1 execution flow**: Wiki read → Code index check (GitNexus preferred; graphify disabled) → requirement method selection (A: brainstorming default / B: openspec) → A: brainstorming → PRD → Plan | B: openspec-explore → openspec-propose (proposal/specs/design/tasks) → confirm → P2
267
+
268
+ **brainstorming output**:
269
+ - Design doc: brainstorming writes to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
270
+ - After user confirmation → copy to `wiki/{module}/05-plan/{task-name}.md` → enter PRD
271
+
272
+ ### 0. Wiki read + Code index + Plan (mandatory prerequisites)
273
+
274
+ 1. `/wiki-read` (auto, cannot be skipped) → no other action allowed until completed
275
+ 2. GitNexus index check (indexed → assist analysis; not indexed → prompt user to run `npx gitnexus analyze` or `/gitnexus-cli`)
276
+ 3. Create Plan file: wiki exists → `wiki/{module}/05-plan/{task-name}.md`, otherwise → `plan/{task-name}.md` (with goal/interface/implementation/steps/risks)
277
+
278
+ > Plan not created → forbidden to enter requirement clarification
279
+
280
+ ### 1.0 Requirement method selection (mandatory)
281
+ At P1 start, ask the user to choose the requirement clarification method:
282
+ - **A. brainstorming (default)**: existing flow → PRD → Plan; P2-P5 use existing review/archive
283
+ - **B. openspec**: openspec-explore → openspec-propose; P2 = openspec-apply-change, P3/P4 = openspec-verify-change, P5 = openspec-archive-change
284
+
285
+ ### 1. brainstorming requirement clarification
286
+ Use the brainstorming skill to systematically clarify requirements; output the requirement list and design doc.
287
+
288
+ **【Decision Point 1: requirement confirmation】**
289
+
290
+ ### 2. Technical research + tech stack confirmation
291
+ First ask technical preference; research with Context7 MCP + WebSearch; UI must use ui-ux-pro-max (67 styles + 96 palettes + 57 fonts). **【Decision Point 2: tech stack confirmation】**
292
+
293
+ ### 3. Write PRD and confirm
294
+ Write a lean PRD (≤150 lines) to `.codex/prd.md`, record `prd_file`, delete `requirements_clarification`, lock it. **【Decision Point 3: PRD confirmation】**
295
+
296
+ ### 4. Architecture design + approach comparison
297
+ Provide 2-3 approaches (with modules/data/API/deployment/pros-cons/scenarios); after the user picks, write to `architecture_decisions`. **【Decision Point 4: architecture confirmation】**
298
+
299
+ ### 5. Prototype design + design confirmation (UI projects)
300
+ Apply the design system, show responsive design in Chrome (375/768/1440px), write to `ui_design`; Bootstrap 3/4 and jQuery UI are forbidden. **【Decision Point 5: design confirmation】**
301
+
302
+ **5 decision points confirmed → P2 auto-driven**
303
+
304
+ ## P3 Interface List Check (optional)
305
+
306
+ Only for tasks with external HTTP calls (API development); TDD / pure utilities skip by default.
307
+ Flow: ask user if needed → scan HTTP/HTTPS calls in `modified_files` → choose format (CURL/table/JSON) → generate `.codex/external-urls.md` → user confirm → P4
308
+
309
+ ## P5 Delivery Phase
310
+
311
+ **P5 execution flow**: GitNexus update → wiki update → generate report → delivery confirmation → archive
312
+
313
+ ### 1. GitNexus update
314
+ - Indexed: run `npx gitnexus analyze` to update the knowledge graph
315
+ - Not indexed: prompt user to configure index; if user declines, record skip reason
316
+
317
+ ### 2. wiki update
318
+ - Wiki directory exists: run `/code-analysis update {module}` to update docs
319
+ - Wiki directory does not exist: skip
320
+
321
+ ### 3. Generate report
322
+ Auto-run `/P5report` to generate the task summary report.
323
+
324
+ ### 4. Delivery confirmation
325
+ Show the user the deliverable list and report summary; confirm completion.
326
+
327
+ ### 5. Archive
328
+ After confirmation, archive the task to `completed_tasks`, clear `phase_history`, and return to P0.
329
+
330
+ ### P5 Delivery Outputs
331
+
332
+ Deliverables: requirements design (`plan/{task}-需求.md`) + approach (`plan/{task}-方案.md`) + code commit + test report + review report + work analysis report (change stats / issue list / exception waivers) + session_log
333
+
334
+ > Work analysis report auto-generated by `/P5report`, includes requirements / coding / stats / issues / waivers / delivery 6 sections
335
+
336
+ ## Phase Checkpoints
337
+
338
+ **Purpose**: ensure no mandatory action of any phase is skipped
339
+
340
+ | Phase | Checkpoint | Verification | Skippable |
341
+ |-------|------------|--------------|-----------|
342
+ | P1 | wiki_read | must read Wiki and record consistency conclusion with code | no |
343
+ | P1 | requirements_clarified | `requirements_clarification` filled | no |
344
+ | P1 | plan_created | plan file created (wiki→`wiki/{module}/05-plan/{Chinese-task-name}.md`, no→`plan/{Chinese-task-name}.md`) | no |
345
+ | P1 | requirement_method_selected | `requirement_method` recorded(A brainstorming / B openspec)| no |
346
+ | P2 | prd_confirmed | `prd_file` set | no |
347
+ | P2 | architecture_decided | `architecture_decisions` filled | no |
348
+ | P2 | dev_method_selected | `dev_method` set with a valid value | no |
349
+ | P2 | code_method_selected | `code_method` set (TDD/Normal) | no |
350
+ | P3 | test_executed | test results recorded | no |
351
+ | P4 | code_review_passed | `review_retry_count <= 3` | no |
352
+ | P5 | wiki_updated | `code-analysis update` executed | no |
353
+ | P5 | report_generated | report file exists under `.codex/reports/` | no |
354
+
355
+ **Phase transition rules**:
356
+ - P0 → P1: all P1 mandatory checkpoints must be complete
357
+ - P1 → P2: all P1 mandatory checkpoints + `plan_file` set + `prd_file` set
358
+ - P2 → P3: all P2 mandatory checkpoints
359
+ - P3 → P4: all P3 mandatory checkpoints
360
+ - P4 → P5: all P4 mandatory checkpoints
361
+ - **Phases cannot advance until checkpoints are complete**
362
+
363
+ ## Self-check (mandatory)
364
+
365
+ **At conversation start**: read `project-state.md` → identify task type → P0 + modification task auto-enters P1
366
+
367
+ **Before every reply**: log reply with `python ".codex/hooks/log_session.py" assistant`
368
+
369
+ **On issue report**: read phase → check P0.5 trigger → if triggered, wait for user A/B/C (no code changes until chosen) → C requires double confirmation
370
+
371
+ **Hard constraint**: changing code before user chooses = SDLC violation, must rollback. When in doubt, read `project-state.md`; do not rely on memory.
372
+
373
+ ## Execution Standards
374
+
375
+ **Bash format**: all commands must be single-line. No line breaks before `2>&1`, `|`, `&&`.
376
+ **Test efficiency**: run only once (`tee /tmp/sdlc-test-output.txt`), Read to analyze results, batch-fix, then run once more. Max 3 runs.
377
+ **Process restart**: Java/Node processes must be killed with `kill -9`, not just `pkill`. Steps: `ps aux` to find PID → `kill -9 PID` → start the new process.
378
+ **Lean output**: reports/PRDs/docs use concise formats:
379
+ - One-sentence principle: use one sentence rather than two
380
+ - Tables preferred: structured info in tables
381
+ - Length limits: PRD≤150 lines, review≤15 lines, delivery≤10 lines
382
+ - Lean memory: `completed_tasks` in lean format; auto-archive when ≥5
383
+
384
+ **phase_history rules**:
385
+ - Only record the current task's `phase_history`; after task completion archive to `completed_tasks` and clear it
386
+ - Time format: seconds (e.g. "2026-05-11 18:58:05")
387
+ - Update `phase_history` immediately on phase transitions
388
+
389
+ ## Display Format Standard
390
+
391
+ ### Forbidden Formats
392
+ - **Markdown tables forbidden** (borderless, not intuitive)
393
+ - **ASCII-art tables forbidden** (not pretty)
394
+
395
+ ### Approach comparison format
396
+ Use **bold headings + lists**:
397
+
398
+ **Approach A: name**
399
+ - Description: concrete description
400
+ - Pros: pro1, pro2
401
+ - Cons: con1, con2
402
+
403
+ **Approach B: name**
404
+ - Description: concrete description
405
+ - Pros: pro1, pro2
406
+ - Cons: con1, con2
407
+
408
+ ### Issue list format
409
+ Use **bold headings + lists** for each issue:
410
+
411
+ **Issue 1: file line X**
412
+ - Issue: description
413
+ - Severity: blocker / serious / suggestion
414
+
415
+ **Issue 2: file line X**
416
+ - Issue: description
417
+ - Severity: blocker / serious / suggestion
418
+
419
+
420
+ ### Decision point format
421
+
422
+ All decision points must be presented as a "Decision Card" (决策卡片): bold black title, options labeled **A./B./C.** in order, recommended option marked **✅ Recommended (推荐)**, alternatives marked **🔀 Alternative (备选)**, each option lists Features/When-to-use/Costs (特点/适合/代价), a `>` line may state prerequisites, and a selection rule (选择规则) closes the card. No thin box-drawing characters (━ ┃ ─), no trailing "operation" hint line. Applies to every decision point: P0.5 (A/B/C), P1 decision points 0-5, P2 dev/coding method, P3 interface-list format, P4 issue handling, P5 delivery confirmation.
423
+
424
+ Template (模板):
425
+
426
+ **🧭 决策点 N | 名称**
427
+ ⏱ {N}s 未选择 → 自动按推荐项执行
428
+
429
+ **✅ 推荐 · A. 名称(默认)**
430
+ - 特点 / Features: ...
431
+ - 适合 / When to use: ...
432
+ - 代价 / Costs: ...
433
+
434
+ **🔀 备选 · B. 名称**
435
+ - 特点 / Features: ...
436
+ - 适合 / When to use: ...
437
+ - 代价 / Costs: ...
438
+
439
+ **选择规则 / Selection rule**: ...
440
+
441
+ **Timeout auto-default (超时自动默认)**:
442
+ - Decision cards MUST be sent as plain text ending the turn (never via AskUserQuestion — it blocks without a timer). Then schedule a /loop wakeup (interval = flowcraft.yaml `decision_timeout`, default 120s). If it fires with no user reply → auto-execute the recommended option; mark the output 「⏱ 已超时自动执行(推荐项 X),如需改选请说明,可回退」
443
+ - Danger decision points (删除文件 / 推送远端 / 合并 main / rebase etc., irreversible external operations) never time out and show no ⏱ line — always wait for the user's explicit choice
444
+ - Stop hook writes pending marker `.claude/decision-pending.json` (Codex side: `.codex/decision-pending.json`); any user input resolves the decision and deletes the marker (mis-execution guard); cross-session fallback: session-start lazy-checks an expired marker and injects「先按推荐项自动执行」context
445
+
446
+ ---
447
+
448
+ ## Coding Standards
449
+
450
+ ### PRD constraints (highest priority)
451
+
452
+ For every function/class/module written, you must be able to answer "which PRD requirement does this map to?"
453
+
454
+ - **No additions**: functions, interfaces, parameters, config items, or optimizations not listed in the PRD
455
+ - **No reductions**: do not skip or simplify any PRD requirement
456
+ - **No "while-at-it" improvements**: do not refactor unrelated code, add extra docs, or optimize unrequested performance during coding
457
+
458
+ > PRD gap found → **stop coding, return to P1 and confirm with the user**.
459
+
460
+ ### Hard metrics
461
+
462
+ | Metric | Limit |
463
+ |--------|-------|
464
+ | Function body lines | ≤ 50 lines (excluding comments and blank lines) |
465
+ | Nesting depth | ≤ 3 levels |
466
+ | Function parameters | ≤ 4; use object/struct beyond that |
467
+ | Single responsibility | function name needing "and" → split |
468
+
469
+ ### Security standard (OWASP focus)
470
+
471
+ | Risk | Defense |
472
+ |------|---------|
473
+ | SQL injection | parameterized queries; concatenation forbidden |
474
+ | XSS | escape user input HTML |
475
+ | Path traversal | validate file path operations |
476
+ | Hardcoded secrets | forbidden; use env vars or secret management |
477
+ | Log leakage | no sensitive info in logs |
478
+ | Loop DB execution | **SQL in loops forbidden**. If unavoidable → clarify with user first, then replace with batch operations |
479
+
480
+ ### Transaction standard
481
+
482
+ | Rule | Description |
483
+ |------|-------------|
484
+ | Transaction granularity | as small as possible, only necessary data ops |
485
+ | Transaction propagation | explicitly specify (`_required`/`_nested`/`_requires_new` etc.) |
486
+ | Read-only transactions | use `readOnly=true` for queries |
487
+
488
+ ### Exception handling standard
489
+
490
+ | Rule | Description |
491
+ |------|-------------|
492
+ | Catch must handle | empty catch implementations forbidden |
493
+ | Sanitize external errors | do not expose technical details to clients |
494
+ | Preserve exception chain | use `cause` |
495
+
496
+ ### Comment standard
497
+
498
+ **All methods must have comments** (public/private/static/constructor): description + `@param` + `@return` + `@throws` (if applicable). Core calculation logic must have detailed comments.
499
+
500
+ ### Coding checklist
501
+
502
+ - [ ] **PRD compliance** — all code maps to a PRD requirement
503
+ - [ ] function ≤50 lines, nesting ≤3, single responsibility
504
+ - [ ] no security issues (injection, XSS, sensitive info leakage)
505
+ - [ ] no hardcoded magic numbers/strings
506
+ - [ ] **100% comment coverage** — all methods commented, core logic detailed
507
+ - [ ] **UI/UX standard** (when UI involved) — modern component library, responsive, accessible
508
+
509
+ ### UI/UX coding standard (mandatory when UI involved)
510
+
511
+ Implement strictly per P1 prototype + componentize + CSS Modules/Tailwind + CSS Variables theming + responsive relative units + Lucide/Heroicons icons + accessibility (≥44px interactive elements, contrast≥4.5:1, keyboard nav, label+for, aria-label)
512
+
513
+ > Forbidden: Bootstrap 3/4, jQuery UI, inline style, fixed pixels, emoji icons; see UI/UX Design Standards section
514
+ ---
515
+
516
+ ## Testing Standards
517
+
518
+ ### PRD-driven testing (highest priority)
519
+
520
+ Tests must be based on the PRD; every PRD requirement maps to at least one test case.
521
+
522
+ ### Test types
523
+
524
+ | Type | Requirement | Description |
525
+ |------|-------------|-------------|
526
+ | Unit test | must | cover all new/modified public functions |
527
+ | Boundary test | must | null values, extremes, boundary conditions |
528
+ | Error-path test | must | exception input, error-handling branches |
529
+ | Integration test | as needed | when multiple modules interact |
530
+ | E2E test | as needed | when user interaction flows are involved |
531
+
532
+ ### Coverage requirements
533
+
534
+ | Metric | Target |
535
+ |--------|--------|
536
+ | New code line coverage | ≥ 80% |
537
+ | Key business logic coverage | ≥ 90% |
538
+ | Branch coverage | ≥ 70% |
539
+
540
+ ### PRD→test mapping table
541
+
542
+ At the start of P3, first list the PRD→test mapping:
543
+ ```
544
+ PRD requirement → test case mapping:
545
+ - R1 (JVM monitoring) → test_getJvmMetrics_shouldReturnJvmData
546
+ - R2 (HTTP monitoring) → test_getHttpMetrics_shouldReturnHttpData
547
+ - ...
548
+ ```
549
+
550
+ ### Test execution report template
551
+
552
+ ```
553
+ [测试执行报告 / Test Execution Report]
554
+ 用例总数 / Total cases:X
555
+ 通过 / Passed:X | 失败 / Failed:X | 跳过 / Skipped:X
556
+ 执行时间 / Duration:Xs
557
+
558
+ [覆盖率报告 / Coverage Report]
559
+ 行覆盖率 / Line coverage:XX% (target≥80%)
560
+ 分支覆盖率 / Branch coverage:XX% (target≥70%)
561
+ 关键业务覆盖率 / Key business coverage:XX% (target≥90%)
562
+ ```
563
+
564
+ ### Test execution efficiency rules
565
+
566
+ **Run a test command only once; analyze results from the output file. Running the same test repeatedly is forbidden.**
567
+
568
+ 1. Run once, `tee /tmp/sdlc-test-output.txt` to save output
569
+ 2. Read the output file and analyze all results
570
+ 3. If failures → collect all errors at once → **batch-fix** → run once more to verify
571
+ 4. **At most 3 test runs across the whole P3**
572
+
573
+ ---
574
+
575
+ ## Git Workflow
576
+
577
+ **Branch naming**: `{type}/{requirement}-{yyyyMMdd}` (type: feature/fixbug/hotfix); call `/git-prep` before P2
578
+
579
+ **Branch operations**: public-branch guard (dev/main/master forbidden for direct development) → create branch → daily pull → pre-commit fetch to confirm not behind → merge requires user confirmation
580
+
581
+ **Safety rules**:
582
+ - ❌ `push --force` (main/master), `reset --hard`, `clean -f`, `branch -D` (unless explicitly requested by user)
583
+ - ⚠️ First `push`, merge to main, `rebase` → user confirmation required
584
+ - ✅ `status`/`diff`/`log`/`stash` freely executable
585
+
586
+ **Conflict resolution**: prefer `git merge` to keep full history, resolve file by file keeping both sides' valid changes, run tests after resolving, confirm before committing for complex conflicts
587
+
588
+ ---
589
+
590
+ ## Anti-Amnesia
591
+
592
+ Defenses: SessionStart hook + UserPromptSubmit phase reminders + PreCompact state save + sub-agent context injection + public-branch guard. New task completed → archive to `completed_tasks`, `project_roadmap` never reset.
593
+
594
+ **Priority**: Security > User instruction > SDLC process > Coding standards > Git rules
595
+
596
+ ---
597
+
598
+ ## Multi-Agent Parallel Development
599
+
600
+ ### Core Principles
601
+
602
+ 1. **Independence & PRD alignment** — only dependency-free tasks can run in parallel; each sub-agent maps to explicit PRD requirements
603
+ 2. **Main-agent coordination** — split, assign, aggregate, resolve conflicts
604
+
605
+ ### Agent Dispatch
606
+
607
+ | Phase | Trigger | Split granularity | Post-aggregation |
608
+ |-------|---------|-------------------|------------------|
609
+ | P2 | 2+ independent implementation modules | by module/file | check interface consistency |
610
+ | P3 | 2+ independent tested modules | by tested module | run all tests together |
611
+ | P4 | modified_files ≥5 | by review dimension (max 3) | merge review reports |
612
+
613
+ ### Limits
614
+
615
+ - Max 2 parallel sub-agents; small tasks (single file or <50 lines) done by the main agent directly
616
+ - P1/P5 do not support parallelism; sub-agent failure → switch to main-agent serial execution
617
+
618
+ ---
619
+
620
+ ## Chrome Browser Integration
621
+
622
+ Browser operations via chrome-integration / playwright. **Only P1 (prototype preview / design confirmation) and P3 (visual regression / E2E / responsive testing) allowed**; all other phases forbidden. UI tasks create self-contained prototype HTML in P1 → Chrome preview → screenshot → iterate until confirmed → enter P2.
623
+
624
+ ---
625
+
626
+ ## Lean Memory & Document Management
627
+
628
+ Minimum-necessary principle: keep only the minimal info needed to resume work; delete redundant, decorative, derivable content.
629
+
630
+ **completed_tasks**: task≤20 chars + prd_summary≤50 chars + key_decisions≤3 items + completed_at; auto-archive oldest 2 when ≥5 to `.codex/archive/`; forbidden to store full PRD / file lists / code snippets
631
+
632
+ **Field leanness**: `architecture_decisions`≤5 items, `phase_history` compress when ≥10, `key_context`≤50 chars, `prd_file` store path only
633
+
634
+ **Document rules**: one sentence over two, tables preferred, no decoration, no duplication, quantifiable. PRD≤150 lines, architecture≤50 lines, review≤15 lines, delivery≤10 lines
635
+
636
+ ---
637
+
638
+ ## UI/UX Design Standards
639
+
640
+ ### Core Principles
641
+
642
+ | Principle | Description |
643
+ |-----------|-------------|
644
+ | **Modern first** | ❌ Bootstrap 3/4, jQuery UI ✅ shadcn/ui, Radix, Ant Design 5+ |
645
+ | **Design-system driven** | choose from 67 styles + 96 palettes + 57 fonts (arbitrary colors forbidden) |
646
+ | **Accessibility** | WCAG 2.1 AA (contrast≥4.5:1, keyboard nav, ARIA) |
647
+ | **Responsive** | mobile-first; test 375px/768px/1440px |
648
+ | **Performance** | Core Web Vitals (LCP<2.5s, CLS<0.1) |
649
+
650
+ ### UI/UX forbidden implementations
651
+
652
+ | ❌ Forbidden | ✅ Replacement |
653
+ |--------------|----------------|
654
+ | lots of inline `style={{}}` | CSS Modules/Tailwind |
655
+ | fixed pixel `width: 300px` | responsive `max-width: 100%` |
656
+ | `!important` | proper CSS specificity |
657
+ | hardcoded color `#3b82f6` | `var(--color-primary)` |
658
+ | jQuery DOM manipulation | framework state management |
659
+ | float layout | Flexbox / Grid |
660
+
661
+ ### UI/UX P3 test requirements
662
+
663
+ | Test type | Tool | Requirement |
664
+ |-----------|------|-------------|
665
+ | Visual regression | Playwright screenshot | major pages/components |
666
+ | Responsive | 3 breakpoint tests | 375/768/1440px |
667
+ | Accessibility | axe-core/Lighthouse | 0 critical violations |
668
+ | Interaction | Testing Library/Playwright | all user flows |
669
+ | Performance | Lighthouse CI | LCP<2.5s, CLS<0.1 |
670
+
671
+ ---
672
+
673
+ ## Review Toolchain
674
+
675
+ Auto-detect project type by file (package.json→Node / pyproject.toml→Python / go.mod→Go / pom.xml→Java), select corresponding lint/typecheck/test/audit commands.
676
+
677
+ **Key metrics**: P2 review = lint error count + build success + dependency vulnerabilities; P3 test = pass rate + line coverage≥80% + key business≥90% + branch≥70%
678
+
679
+ <!-- gitnexus:start -->
680
+ # GitNexus — Code Intelligence
681
+
682
+ This project is indexed by GitNexus as **sdlc** (2676 symbols, 4199 relationships, 183 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
683
+
684
+ > Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
685
+
686
+ ## Always Do
687
+
688
+ - **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
689
+ - **MUST run `detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. For regression review, compare against the default branch: `detect_changes({scope: "compare", base_ref: "main"})`.
690
+ - **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
691
+ - When exploring unfamiliar code, use `query({search_query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
692
+ - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `context({name: "symbolName"})`.
693
+ - For security review, `explain({target: "fileOrSymbol"})` lists taint findings (source→sink flows; needs `analyze --pdg`).
694
+
695
+ ## Never Do
696
+
697
+ - NEVER edit a function, class, or method without first running `impact` on it.
698
+ - NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
699
+ - NEVER rename symbols with find-and-replace — use `rename` which understands the call graph.
700
+ - NEVER commit changes without running `detect_changes()` to check affected scope.
701
+
702
+ ## Resources
703
+
704
+ | Resource | Use for |
705
+ |----------|---------|
706
+ | `gitnexus://repo/sdlc/context` | Codebase overview, check index freshness |
707
+ | `gitnexus://repo/sdlc/clusters` | All functional areas |
708
+ | `gitnexus://repo/sdlc/processes` | All execution flows |
709
+ | `gitnexus://repo/sdlc/process/{name}` | Step-by-step execution trace |
710
+
711
+ ## CLI
712
+
713
+ | Task | Read this skill file |
714
+ |------|---------------------|
715
+ | Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
716
+ | Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
717
+ | Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
718
+ | Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
719
+ | Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
720
+ | Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
721
+
722
+ <!-- gitnexus:end -->