universal-dev-standards 6.8.0 → 6.9.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 (194) hide show
  1. package/bin/uds.js +12 -2
  2. package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +14 -2
  3. package/bundled/ai/standards/adr-standards.ai.yaml +14 -2
  4. package/bundled/ai/standards/code-review.ai.yaml +13 -3
  5. package/bundled/ai/standards/commit-message.ai.yaml +8 -4
  6. package/bundled/ai/standards/deferred-item-exit.ai.yaml +225 -0
  7. package/bundled/ai/standards/feature-discovery-standards.ai.yaml +14 -2
  8. package/bundled/ai/standards/governance-layer.ai.yaml +128 -2
  9. package/bundled/ai/standards/logging.ai.yaml +2 -2
  10. package/bundled/ai/standards/retrospective-standards.ai.yaml +14 -2
  11. package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +73 -2
  12. package/bundled/ai/standards/security-standards.ai.yaml +2 -2
  13. package/bundled/ai/standards/spec-driven-development.ai.yaml +14 -2
  14. package/bundled/ai/standards/tech-debt-standards.ai.yaml +87 -3
  15. package/bundled/ai/standards/turn-completion-integrity.ai.yaml +131 -0
  16. package/bundled/core/acceptance-criteria-traceability.md +5 -2
  17. package/bundled/core/adr-standards.md +26 -2
  18. package/bundled/core/code-review-checklist.md +5 -2
  19. package/bundled/core/context-aware-loading.md +1 -1
  20. package/bundled/core/deferred-item-exit.md +254 -0
  21. package/bundled/core/feature-discovery-standards.md +5 -1
  22. package/bundled/core/governance-layer.md +114 -2
  23. package/bundled/core/retrospective-standards.md +4 -2
  24. package/bundled/core/reverse-engineering-standards.md +81 -2
  25. package/bundled/core/spec-driven-development.md +8 -2
  26. package/bundled/core/tech-debt-standards.md +67 -8
  27. package/bundled/core/turn-completion-integrity.md +196 -0
  28. package/bundled/hooks/check-dangerous-cmd.mjs +60 -0
  29. package/bundled/hooks/check-logging-standard.mjs +59 -0
  30. package/bundled/hooks/check-turn-completion.mjs +233 -0
  31. package/bundled/hooks/inject-standards.mjs +183 -0
  32. package/bundled/hooks/telemetry-wrapper.mjs +77 -0
  33. package/bundled/hooks/turn-completion/detect.mjs +99 -0
  34. package/bundled/hooks/turn-completion/locales/en.mjs +159 -0
  35. package/bundled/hooks/turn-completion/locales/zh-TW.mjs +166 -0
  36. package/bundled/hooks/validate-commit-msg.mjs +104 -0
  37. package/bundled/locales/zh-CN/CHANGELOG.md +47 -3
  38. package/bundled/locales/zh-CN/CLAUDE.md +1 -1
  39. package/bundled/locales/zh-CN/README.md +2 -2
  40. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  41. package/bundled/locales/zh-CN/core/adr-standards.md +1 -1
  42. package/bundled/locales/zh-CN/core/governance-layer.md +118 -6
  43. package/bundled/locales/zh-CN/core/retrospective-standards.md +1 -1
  44. package/bundled/locales/zh-CN/core/tech-debt-standards.md +71 -4
  45. package/bundled/locales/zh-CN/core/turn-completion-integrity.md +190 -0
  46. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +8 -1
  47. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +29 -68
  48. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +25 -15
  49. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -2
  50. package/bundled/locales/zh-CN/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  51. package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +3 -3
  52. package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +2 -0
  53. package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +2 -0
  54. package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +22 -12
  55. package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +12 -9
  56. package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +1 -0
  57. package/bundled/locales/zh-CN/skills/commands/brainstorm.md +17 -13
  58. package/bundled/locales/zh-CN/skills/commands/config.md +0 -1
  59. package/bundled/locales/zh-CN/skills/commands/init.md +1 -2
  60. package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +2 -0
  61. package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -0
  62. package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +2 -0
  63. package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +1 -0
  64. package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +1 -0
  65. package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +3 -0
  66. package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +2 -0
  67. package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +3 -0
  68. package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +1 -0
  69. package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +1 -0
  70. package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +2 -0
  71. package/bundled/locales/zh-TW/CHANGELOG.md +47 -3
  72. package/bundled/locales/zh-TW/CLAUDE.md +1 -1
  73. package/bundled/locales/zh-TW/README.md +2 -2
  74. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  75. package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +2 -0
  76. package/bundled/locales/zh-TW/core/adr-standards.md +26 -5
  77. package/bundled/locales/zh-TW/core/code-review-checklist.md +2 -0
  78. package/bundled/locales/zh-TW/core/container-image-standards.md +2 -2
  79. package/bundled/locales/zh-TW/core/contract-testing-standards.md +2 -2
  80. package/bundled/locales/zh-TW/core/cross-flow-regression.md +8 -7
  81. package/bundled/locales/zh-TW/core/data-contract.md +2 -2
  82. package/bundled/locales/zh-TW/core/data-migration-testing.md +2 -2
  83. package/bundled/locales/zh-TW/core/data-pipeline.md +2 -2
  84. package/bundled/locales/zh-TW/core/deferred-item-exit.md +251 -0
  85. package/bundled/locales/zh-TW/core/documentation-writing-standards.md +228 -3
  86. package/bundled/locales/zh-TW/core/full-coverage-testing.md +15 -2
  87. package/bundled/locales/zh-TW/core/governance-layer.md +118 -5
  88. package/bundled/locales/zh-TW/core/iac-design-principles.md +2 -2
  89. package/bundled/locales/zh-TW/core/incident-response.md +2 -2
  90. package/bundled/locales/zh-TW/core/model-provenance.md +4 -2
  91. package/bundled/locales/zh-TW/core/pii-classification.md +42 -6
  92. package/bundled/locales/zh-TW/core/prd-standards.md +4 -2
  93. package/bundled/locales/zh-TW/core/product-metrics-standards.md +4 -2
  94. package/bundled/locales/zh-TW/core/release-readiness-gate.md +2 -2
  95. package/bundled/locales/zh-TW/core/resource-cost-boundary.md +2 -2
  96. package/bundled/locales/zh-TW/core/retrospective-standards.md +5 -3
  97. package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +83 -5
  98. package/bundled/locales/zh-TW/core/runbook.md +2 -2
  99. package/bundled/locales/zh-TW/core/schema-evolution.md +2 -2
  100. package/bundled/locales/zh-TW/core/secret-management-standards.md +2 -2
  101. package/bundled/locales/zh-TW/core/slo-sli.md +2 -2
  102. package/bundled/locales/zh-TW/core/spec-driven-development.md +2 -0
  103. package/bundled/locales/zh-TW/core/tech-debt-standards.md +71 -4
  104. package/bundled/locales/zh-TW/core/turn-completion-integrity.md +190 -0
  105. package/bundled/locales/zh-TW/core/user-journey-testing.md +2 -2
  106. package/bundled/locales/zh-TW/core/user-story-mapping.md +2 -2
  107. package/bundled/locales/zh-TW/core/verification-oracle.md +2 -2
  108. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +8 -1
  109. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +29 -68
  110. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +25 -15
  111. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -2
  112. package/bundled/locales/zh-TW/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
  113. package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +3 -3
  114. package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
  115. package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
  116. package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
  117. package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +22 -12
  118. package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +12 -9
  119. package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -0
  120. package/bundled/locales/zh-TW/skills/commands/brainstorm.md +17 -13
  121. package/bundled/locales/zh-TW/skills/commands/config.md +0 -1
  122. package/bundled/locales/zh-TW/skills/commands/init.md +1 -2
  123. package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -0
  124. package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -1
  125. package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +2 -0
  126. package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +1 -1
  127. package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +2 -2
  128. package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
  129. package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +1 -0
  130. package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -0
  131. package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +1 -0
  132. package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +3 -0
  133. package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +2 -0
  134. package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +3 -0
  135. package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +1 -0
  136. package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +1 -0
  137. package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +2 -0
  138. package/bundled/skills/atdd-assistant/SKILL.md +2 -0
  139. package/bundled/skills/bdd-assistant/SKILL.md +2 -0
  140. package/bundled/skills/brainstorm-assistant/SKILL.md +31 -13
  141. package/bundled/skills/brainstorm-assistant/guide.md +9 -6
  142. package/bundled/skills/code-review-assistant/SKILL.md +1 -0
  143. package/bundled/skills/commands/brainstorm.md +12 -9
  144. package/bundled/skills/commands/config.md +0 -1
  145. package/bundled/skills/commands/init.md +2 -3
  146. package/bundled/skills/commit-standards/SKILL.md +2 -0
  147. package/bundled/skills/contract-test-assistant/SKILL.md +1 -0
  148. package/bundled/skills/dev-methodology/SKILL.md +4 -0
  149. package/bundled/skills/observability-assistant/SKILL.md +1 -0
  150. package/bundled/skills/project-discovery/SKILL.md +1 -0
  151. package/bundled/skills/project-structure-guide/SKILL.md +1 -0
  152. package/bundled/skills/release-standards/SKILL.md +3 -0
  153. package/bundled/skills/requirement-assistant/SKILL.md +2 -0
  154. package/bundled/skills/reverse-engineer/SKILL.md +3 -0
  155. package/bundled/skills/runbook-assistant/SKILL.md +1 -0
  156. package/bundled/skills/slo-assistant/SKILL.md +1 -0
  157. package/bundled/skills/tdd-assistant/SKILL.md +2 -0
  158. package/bundled/templates/.ai-context.yaml.template +194 -0
  159. package/bundled/templates/CLAUDE.md.template +145 -0
  160. package/bundled/templates/DESIGN.md +237 -0
  161. package/bundled/templates/SKILL-BRIEF-TEMPLATE.md +57 -0
  162. package/bundled/templates/SKILL-CANDIDATES.md +39 -0
  163. package/bundled/templates/gates/check-error-exit.mjs +309 -0
  164. package/bundled/templates/mcp-config.json +10 -0
  165. package/bundled/templates/methodology-template.yaml +209 -0
  166. package/bundled/templates/migration-template.md +408 -0
  167. package/bundled/templates/requirement-checklist.md +410 -0
  168. package/bundled/templates/requirement-document-template.md +591 -0
  169. package/bundled/templates/requirement-template.md +881 -0
  170. package/bundled/templates/reverse-spec-template.md +409 -0
  171. package/bundled/templates/test-case-template.md +74 -0
  172. package/bundled/templates/test-plan-template.md +74 -0
  173. package/package.json +7 -5
  174. package/src/commands/audit.js +82 -0
  175. package/src/commands/check.js +66 -10
  176. package/src/commands/init.js +161 -16
  177. package/src/commands/update.js +286 -14
  178. package/src/compilers/claude-code-compiler.js +4 -1
  179. package/src/config/ai-agent-paths.js +62 -17
  180. package/src/core/constants.js +42 -11
  181. package/src/core/manifest.js +201 -3
  182. package/src/core/paths.js +2 -2
  183. package/src/i18n/messages.js +6 -29
  184. package/src/installers/hooks-installer.js +167 -75
  185. package/src/installers/integration-installer.js +9 -5
  186. package/src/prompts/init.js +14 -14
  187. package/src/utils/detector.js +21 -1
  188. package/src/utils/effect-boundary.js +1093 -0
  189. package/src/utils/hasher.js +166 -1
  190. package/src/utils/hook-stats.js +1 -1
  191. package/src/utils/integration-generator.js +79 -1
  192. package/src/utils/reference-sync.js +4 -1
  193. package/src/utils/yaml-generator.js +51 -9
  194. package/standards-registry.json +31 -8
@@ -0,0 +1,209 @@
1
+ # Custom Methodology Template
2
+ # 自訂方法論模板
3
+ #
4
+ # Use this template to create your own development methodology.
5
+ # Save to: .standards/methodologies/<your-id>.methodology.yaml
6
+ #
7
+ # 使用此模板建立您自己的開發方法論。
8
+ # 儲存到: .standards/methodologies/<your-id>.methodology.yaml
9
+
10
+ $schema: "https://raw.githubusercontent.com/AsiaOstrich/universal-dev-standards/main/methodologies/methodology-schema.json"
11
+
12
+ # === BASIC INFORMATION | 基本資訊 ===
13
+ id: my-workflow # Unique ID (lowercase, hyphens) | 唯一識別碼
14
+ name: My Custom Workflow # Display name | 顯示名稱
15
+ nameZh: 我的自訂工作流 # Chinese name (optional) | 中文名稱(選填)
16
+ version: 1.0.0 # Semantic version | 語意化版本
17
+ description: A custom development workflow for our team
18
+ descriptionZh: 我們團隊的自訂開發工作流
19
+
20
+ # === PHASES | 階段 ===
21
+ # Define your development phases. Each phase represents a distinct stage.
22
+ # 定義您的開發階段。每個階段代表一個明確的開發狀態。
23
+ phases:
24
+ # --- Phase 1: Planning ---
25
+ - id: plan
26
+ name: Planning
27
+ nameZh: 規劃
28
+ description: Plan the implementation approach
29
+ descriptionZh: 規劃實作方法
30
+ duration: "15-30 minutes"
31
+ emoji: "📋"
32
+
33
+ # Checklist items for this phase
34
+ # 此階段的檢查清單項目
35
+ checklist:
36
+ - id: requirements-clear
37
+ text: Requirements are clearly understood
38
+ textZh: 需求已清楚理解
39
+ required: true # Must complete to proceed | 必須完成才能繼續
40
+ - id: design-reviewed
41
+ text: Design approach reviewed with team
42
+ textZh: 設計方法已與團隊審查
43
+ required: false # Optional item | 選填項目
44
+
45
+ # Phase transition triggers
46
+ # 階段轉換觸發條件
47
+ triggers:
48
+ entry:
49
+ - condition: feature_start # When to enter this phase | 何時進入此階段
50
+ exit:
51
+ - condition: user_confirms_plan_complete
52
+ nextPhase: implement # Where to go next | 下一個階段
53
+
54
+ # AI guidance for this phase
55
+ # 此階段的 AI 引導提示
56
+ guidance:
57
+ prompt: |
58
+ ## Planning Phase
59
+
60
+ Before implementation, ensure:
61
+ {{ checklist | format_checklist }}
62
+
63
+ Consider:
64
+ - What is the expected outcome?
65
+ - Are there any dependencies?
66
+ - What could go wrong?
67
+ promptZh: |
68
+ ## 規劃階段
69
+
70
+ 在實作前,確保:
71
+ {{ checklist | format_checklist }}
72
+
73
+ 考慮:
74
+ - 預期結果是什麼?
75
+ - 有任何相依性嗎?
76
+ - 可能出什麼問題?
77
+
78
+ # --- Phase 2: Implementation ---
79
+ - id: implement
80
+ name: Implementation
81
+ nameZh: 實作
82
+ description: Write the code
83
+ descriptionZh: 撰寫程式碼
84
+ duration: "Variable"
85
+ emoji: "💻"
86
+
87
+ checklist:
88
+ - id: follows-patterns
89
+ text: Code follows team patterns
90
+ textZh: 程式碼遵循團隊慣例
91
+ required: true
92
+ - id: tests-written
93
+ text: Tests written alongside code
94
+ textZh: 測試與程式碼同步撰寫
95
+ required: true
96
+ - id: no-debug-code
97
+ text: No debugging code left behind
98
+ textZh: 無除錯程式碼殘留
99
+ required: true
100
+
101
+ triggers:
102
+ entry:
103
+ - condition: plan_complete
104
+ exit:
105
+ - condition: implementation_complete
106
+ nextPhase: review
107
+
108
+ guidance:
109
+ prompt: |
110
+ ## Implementation Phase
111
+
112
+ Writing code for: {{feature_description}}
113
+
114
+ {{ checklist | format_checklist }}
115
+
116
+ Remember:
117
+ - Keep commits small and focused
118
+ - Write tests as you go
119
+
120
+ # --- Phase 3: Review ---
121
+ - id: review
122
+ name: Review
123
+ nameZh: 審查
124
+ description: Self-review and prepare for PR
125
+ descriptionZh: 自我審查並準備 PR
126
+ duration: "15-30 minutes"
127
+ emoji: "👀"
128
+
129
+ checklist:
130
+ - id: self-reviewed
131
+ text: Code self-reviewed
132
+ textZh: 程式碼已自我審查
133
+ required: true
134
+ - id: tests-pass
135
+ text: All tests pass
136
+ textZh: 所有測試通過
137
+ required: true
138
+ - id: docs-updated
139
+ text: Documentation updated
140
+ textZh: 文件已更新
141
+ required: false
142
+
143
+ triggers:
144
+ entry:
145
+ - condition: implementation_complete
146
+ exit:
147
+ - condition: ready_for_pr
148
+ nextPhase: done
149
+
150
+ guidance:
151
+ prompt: |
152
+ ## Review Phase
153
+
154
+ Before marking as ready:
155
+ {{ checklist | format_checklist }}
156
+
157
+ Self-review questions:
158
+ - Would I approve this if reviewing someone else's code?
159
+ - Are edge cases handled?
160
+ - Is the code easy to understand?
161
+
162
+ # --- Phase 4: Done ---
163
+ - id: done
164
+ name: Done
165
+ nameZh: 完成
166
+ description: Ready for PR
167
+ descriptionZh: 準備提交 PR
168
+ emoji: "✅"
169
+ checklist: []
170
+ triggers:
171
+ entry:
172
+ - condition: ready_for_pr
173
+ exit: []
174
+
175
+ # === CHECKPOINTS | 檢查點 ===
176
+ # Define automatic reminders and validation points
177
+ # 定義自動提醒和驗證點
178
+ checkpoints:
179
+ - id: phase-transition
180
+ trigger: phase_transition # When a phase is completed
181
+ intensity: suggest # suggest | warn | block
182
+ action: "Phase complete. Consider committing your changes."
183
+ actionZh: "階段完成。考慮提交您的變更。"
184
+
185
+ - id: large-changes
186
+ trigger: lines_changed
187
+ threshold: 200 # Trigger after 200+ lines changed
188
+ intensity: warn
189
+ action: "You have 200+ uncommitted lines. Consider breaking into smaller commits."
190
+ actionZh: "您有超過 200 行未提交的變更。考慮拆分為較小的提交。"
191
+
192
+ # === COMMANDS | 命令 ===
193
+ # Define custom slash commands for this methodology (optional)
194
+ # 為此方法論定義自訂斜線命令(選填)
195
+ commands:
196
+ - name: workflow
197
+ description: Start custom workflow
198
+ descriptionZh: 啟動自訂工作流
199
+ usage: "/workflow [feature]"
200
+ action: start_workflow
201
+
202
+ # === AI GUIDANCE SETTINGS | AI 引導設定 ===
203
+ aiGuidance:
204
+ autoDetect: true # Detect methodology from context
205
+ proactiveReminders: true # Show phase reminders proactively
206
+ contextKeywords: # Keywords that trigger this methodology
207
+ - "team workflow"
208
+ - "our process"
209
+ - "custom workflow"
@@ -0,0 +1,408 @@
1
+ # [Project Name] Migration Plan
2
+ # [專案名稱] 遷移計畫
3
+
4
+ **Document Version | 文件版本**: 1.0
5
+ **Created | 建立日期**: YYYY-MM-DD
6
+ **Last Updated | 最後更新**: YYYY-MM-DD
7
+ **Source System | 來源系統**: [e.g., PHP/Fat-Free Framework]
8
+ **Target System | 目標系統**: [e.g., .NET 10]
9
+
10
+ ---
11
+
12
+ ## Purpose | 目的
13
+
14
+ This template provides a structured approach for technology migration projects, ensuring systematic planning, execution, and verification.
15
+
16
+ 本範本提供技術遷移專案的結構化方法,確保系統性的規劃、執行與驗證。
17
+
18
+ ---
19
+
20
+ ## 1. Migration Overview | 遷移概述
21
+
22
+ ### 1.1 Project Summary | 專案摘要
23
+
24
+ <!-- TODO: 1-2 段說明遷移的背景與目標 -->
25
+
26
+ **Why Migrate | 為何遷移**:
27
+ - [Reason 1: e.g., End of framework support]
28
+ - [Reason 2: e.g., Performance improvements needed]
29
+ - [Reason 3: e.g., Team expertise shift]
30
+
31
+ **Migration Scope | 遷移範圍**:
32
+ - [Module/Feature 1]
33
+ - [Module/Feature 2]
34
+ - [Module/Feature 3]
35
+
36
+ **Out of Scope | 不在範圍內**:
37
+ - [Item 1]
38
+ - [Item 2]
39
+
40
+ ### 1.2 System Comparison | 系統對比
41
+
42
+ | Aspect | Source System | Target System |
43
+ |--------|---------------|---------------|
44
+ | **Language** | [e.g., PHP 8.2] | [e.g., C# 12] |
45
+ | **Framework** | [e.g., Fat-Free 3.8] | [e.g., ASP.NET Core 10] |
46
+ | **Database** | [e.g., MySQL 8.0] | [e.g., SQL Server 2022] |
47
+ | **ORM** | [e.g., Cortex] | [e.g., Entity Framework Core] |
48
+ | **Authentication** | [e.g., Custom JWT] | [e.g., ASP.NET Identity] |
49
+ | **Hosting** | [e.g., Apache] | [e.g., Docker/Kubernetes] |
50
+
51
+ ### 1.3 Success Criteria | 成功標準
52
+
53
+ <!-- TODO: 定義遷移成功的可量化標準 -->
54
+
55
+ - [ ] All critical features migrated and functional
56
+ - [ ] Performance metrics meet or exceed baseline
57
+ - [ ] Zero data loss during migration
58
+ - [ ] Security audit passed
59
+ - [ ] User acceptance testing completed
60
+
61
+ ---
62
+
63
+ ## 2. Five-Phase Migration Roadmap | 五階段遷移路線圖
64
+
65
+ ### Phase 1: Assessment & Planning | 評估與規劃
66
+
67
+ **Duration | 時程**: [X weeks]
68
+
69
+ **Objectives | 目標**:
70
+ - Inventory existing system components
71
+ - Identify dependencies and integrations
72
+ - Define migration strategy (Big Bang vs. Strangler Fig)
73
+ - Establish success metrics
74
+
75
+ **Deliverables | 交付項目**:
76
+ - [ ] System inventory document
77
+ - [ ] Dependency mapping diagram
78
+ - [ ] Risk assessment report
79
+ - [ ] Migration strategy document
80
+
81
+ **Key Activities | 主要活動**:
82
+
83
+ | Activity | Owner | Status |
84
+ |----------|-------|--------|
85
+ | Code audit and analysis | [Name] | [ ] |
86
+ | Database schema review | [Name] | [ ] |
87
+ | API endpoint inventory | [Name] | [ ] |
88
+ | Third-party integration review | [Name] | [ ] |
89
+
90
+ ---
91
+
92
+ ### Phase 2: Environment Setup | 環境建置
93
+
94
+ **Duration | 時程**: [X weeks]
95
+
96
+ **Objectives | 目標**:
97
+ - Set up target development environment
98
+ - Configure CI/CD pipelines
99
+ - Establish coding standards
100
+ - Create project scaffolding
101
+
102
+ **Deliverables | 交付項目**:
103
+ - [ ] Development environment ready
104
+ - [ ] CI/CD pipeline configured
105
+ - [ ] Coding standards documented
106
+ - [ ] Project template created
107
+
108
+ **Environment Checklist | 環境檢查清單**:
109
+
110
+ | Environment | URL/Location | Status |
111
+ |-------------|--------------|--------|
112
+ | Development | [URL] | [ ] |
113
+ | Staging | [URL] | [ ] |
114
+ | Production | [URL] | [ ] |
115
+ | CI/CD | [URL] | [ ] |
116
+
117
+ ---
118
+
119
+ ### Phase 3: Core Migration | 核心遷移
120
+
121
+ **Duration | 時程**: [X weeks]
122
+
123
+ **Objectives | 目標**:
124
+ - Migrate core business logic
125
+ - Migrate database schema and data
126
+ - Implement authentication/authorization
127
+ - Migrate critical APIs
128
+
129
+ **Migration Order | 遷移順序**:
130
+
131
+ | Priority | Module | Complexity | Dependencies |
132
+ |----------|--------|------------|--------------|
133
+ | 1 | [Core Module] | High | None |
134
+ | 2 | [Auth Module] | Medium | Core |
135
+ | 3 | [Feature A] | Medium | Core, Auth |
136
+ | 4 | [Feature B] | Low | Core |
137
+
138
+ **Database Migration Steps | 資料庫遷移步驟**:
139
+
140
+ 1. [ ] Export source database schema
141
+ 2. [ ] Convert schema to target format
142
+ 3. [ ] Create migration scripts
143
+ 4. [ ] Set up data transformation ETL
144
+ 5. [ ] Validate data integrity
145
+
146
+ ---
147
+
148
+ ### Phase 4: Integration & Testing | 整合與測試
149
+
150
+ **Duration | 時程**: [X weeks]
151
+
152
+ **Objectives | 目標**:
153
+ - Integrate migrated components
154
+ - Execute comprehensive testing
155
+ - Perform security audit
156
+ - Conduct performance testing
157
+
158
+ **Testing Checklist | 測試檢查清單**:
159
+
160
+ | Test Type | Coverage Target | Status |
161
+ |-----------|-----------------|--------|
162
+ | Unit Tests | > 80% | [ ] |
163
+ | Integration Tests | All APIs | [ ] |
164
+ | E2E Tests | Critical paths | [ ] |
165
+ | Performance Tests | Baseline comparison | [ ] |
166
+ | Security Tests | OWASP Top 10 | [ ] |
167
+ | UAT | All features | [ ] |
168
+
169
+ **Performance Baseline Comparison | 效能基準比較**:
170
+
171
+ | Metric | Source System | Target System | Status |
172
+ |--------|---------------|---------------|--------|
173
+ | API Response Time (p95) | [X]ms | [Y]ms | [ ] |
174
+ | Database Query Time | [X]ms | [Y]ms | [ ] |
175
+ | Memory Usage | [X]MB | [Y]MB | [ ] |
176
+ | CPU Utilization | [X]% | [Y]% | [ ] |
177
+
178
+ ---
179
+
180
+ ### Phase 5: Deployment & Cutover | 部署與切換
181
+
182
+ **Duration | 時程**: [X weeks]
183
+
184
+ **Objectives | 目標**:
185
+ - Deploy to production
186
+ - Execute cutover plan
187
+ - Monitor system stability
188
+ - Decommission legacy system
189
+
190
+ **Cutover Checklist | 切換檢查清單**:
191
+
192
+ **Pre-Cutover | 切換前**:
193
+ - [ ] Final data sync completed
194
+ - [ ] All tests passed
195
+ - [ ] Rollback plan verified
196
+ - [ ] Team availability confirmed
197
+ - [ ] Customer notification sent
198
+
199
+ **Cutover | 切換中**:
200
+ - [ ] DNS/Load balancer switch
201
+ - [ ] Final data migration
202
+ - [ ] Service activation
203
+ - [ ] Smoke tests passed
204
+
205
+ **Post-Cutover | 切換後**:
206
+ - [ ] Monitor error rates
207
+ - [ ] Monitor performance metrics
208
+ - [ ] User feedback collection
209
+ - [ ] Legacy system decommission schedule
210
+
211
+ ---
212
+
213
+ ## 3. Rollback Plan | 回滾計畫
214
+
215
+ ### 3.1 Rollback Triggers | 回滾觸發條件
216
+
217
+ | Trigger | Threshold | Action |
218
+ |---------|-----------|--------|
219
+ | Error Rate | > [X]% | Initiate rollback |
220
+ | Response Time | > [X]ms (p95) | Evaluate rollback |
221
+ | Data Inconsistency | Any | Immediate rollback |
222
+ | Security Breach | Any | Immediate rollback |
223
+
224
+ ### 3.2 Rollback Steps | 回滾步驟
225
+
226
+ **Immediate Actions | 立即行動** (within 15 minutes):
227
+ 1. [ ] Switch DNS/Load balancer back to legacy system
228
+ 2. [ ] Disable new system endpoints
229
+ 3. [ ] Notify stakeholders
230
+
231
+ **Data Recovery | 資料恢復** (within 1 hour):
232
+ 1. [ ] Identify data changes during cutover window
233
+ 2. [ ] Execute reverse data sync
234
+ 3. [ ] Verify data integrity
235
+
236
+ **Post-Rollback | 回滾後**:
237
+ 1. [ ] Conduct root cause analysis
238
+ 2. [ ] Update migration plan
239
+ 3. [ ] Schedule re-migration
240
+
241
+ ### 3.3 Rollback Decision Matrix | 回滾決策矩陣
242
+
243
+ | Time Since Cutover | Data Changes | Recommended Action |
244
+ |--------------------|--------------|-------------------|
245
+ | < 1 hour | Minimal | Quick rollback |
246
+ | 1-4 hours | Moderate | Evaluate data sync effort |
247
+ | > 4 hours | Significant | Fix forward if possible |
248
+
249
+ ---
250
+
251
+ ## 4. Risk Management | 風險管理
252
+
253
+ ### 4.1 Risk Register | 風險登記
254
+
255
+ | ID | Risk | Impact | Probability | Mitigation |
256
+ |----|------|--------|-------------|------------|
257
+ | R1 | Data loss during migration | High | Low | Multiple backups, dry runs |
258
+ | R2 | Performance degradation | Medium | Medium | Performance testing, optimization |
259
+ | R3 | Feature parity gaps | Medium | Medium | Comprehensive feature inventory |
260
+ | R4 | Extended downtime | High | Low | Parallel running, quick rollback |
261
+ | R5 | Team skill gaps | Medium | Medium | Training, pair programming |
262
+
263
+ ### 4.2 Contingency Plans | 應變計畫
264
+
265
+ **R1: Data Loss**
266
+ - Maintain real-time replication during migration window
267
+ - Keep source database read-only during critical phase
268
+ - Store transaction logs for replay
269
+
270
+ **R2: Performance Issues**
271
+ - Pre-scale infrastructure for migration
272
+ - Have database optimization scripts ready
273
+ - Prepare CDN configuration for quick activation
274
+
275
+ ---
276
+
277
+ ## 5. Verification Checklist | 驗證檢查清單
278
+
279
+ ### 5.1 Functional Verification | 功能驗證
280
+
281
+ | Feature | Source Behavior | Target Behavior | Verified |
282
+ |---------|-----------------|-----------------|----------|
283
+ | [Feature 1] | [Description] | [Expected same/different] | [ ] |
284
+ | [Feature 2] | [Description] | [Expected same/different] | [ ] |
285
+ | [Feature 3] | [Description] | [Expected same/different] | [ ] |
286
+
287
+ ### 5.2 Data Verification | 資料驗證
288
+
289
+ | Data Set | Record Count (Source) | Record Count (Target) | Checksum Match |
290
+ |----------|----------------------|----------------------|----------------|
291
+ | Users | [X] | [Y] | [ ] |
292
+ | Transactions | [X] | [Y] | [ ] |
293
+ | Configurations | [X] | [Y] | [ ] |
294
+
295
+ ### 5.3 Integration Verification | 整合驗證
296
+
297
+ | External System | Integration Type | Verified |
298
+ |-----------------|-----------------|----------|
299
+ | [System A] | API | [ ] |
300
+ | [System B] | Database | [ ] |
301
+ | [System C] | Message Queue | [ ] |
302
+
303
+ ---
304
+
305
+ ## 6. Communication Plan | 溝通計畫
306
+
307
+ ### 6.1 Stakeholder Notification | 利害關係人通知
308
+
309
+ | Event | Recipients | Timing | Channel |
310
+ |-------|------------|--------|---------|
311
+ | Migration Start | All stakeholders | 1 week before | Email |
312
+ | Cutover Window | Technical team, Support | 24 hours before | Email, Slack |
313
+ | Cutover Complete | All stakeholders | Immediately | Email, Slack |
314
+ | Issues Detected | Technical team | Immediately | Slack, Phone |
315
+ | Rollback Initiated | All stakeholders | Immediately | Email, Slack |
316
+
317
+ ### 6.2 Status Reporting | 狀態回報
318
+
319
+ | Report | Frequency | Audience |
320
+ |--------|-----------|----------|
321
+ | Daily Standup | Daily | Dev team |
322
+ | Weekly Summary | Weekly | Management |
323
+ | Phase Completion | Per phase | All stakeholders |
324
+
325
+ ---
326
+
327
+ ## 7. Post-Migration | 遷移後
328
+
329
+ ### 7.1 Hypercare Period | 密切關注期
330
+
331
+ **Duration | 時程**: [X weeks]
332
+
333
+ **Monitoring Focus | 監控重點**:
334
+ - [ ] Error rates and types
335
+ - [ ] Performance metrics
336
+ - [ ] User feedback
337
+ - [ ] Support ticket volume
338
+
339
+ ### 7.2 Legacy Decommission | 舊系統退役
340
+
341
+ | Task | Target Date | Status |
342
+ |------|-------------|--------|
343
+ | Disable legacy write access | [Date] | [ ] |
344
+ | Archive legacy database | [Date] | [ ] |
345
+ | Terminate legacy infrastructure | [Date] | [ ] |
346
+ | Update documentation | [Date] | [ ] |
347
+
348
+ ### 7.3 Lessons Learned | 經驗學習
349
+
350
+ <!-- TODO: 遷移完成後填寫 -->
351
+
352
+ **What Went Well | 順利之處**:
353
+ - [Item 1]
354
+ - [Item 2]
355
+
356
+ **What Could Be Improved | 可改進之處**:
357
+ - [Item 1]
358
+ - [Item 2]
359
+
360
+ **Recommendations for Future Migrations | 未來遷移建議**:
361
+ - [Recommendation 1]
362
+ - [Recommendation 2]
363
+
364
+ ---
365
+
366
+ ## Appendix | 附錄
367
+
368
+ ### A. Architecture Diagrams | 架構圖
369
+
370
+ <!-- TODO: 插入架構圖 -->
371
+
372
+ ### B. API Mapping | API 對應表
373
+
374
+ | Source Endpoint | Target Endpoint | Notes |
375
+ |-----------------|-----------------|-------|
376
+ | `GET /api/users` | `GET /api/v2/users` | Response format changed |
377
+ | `POST /api/login` | `POST /api/auth/login` | Added refresh token |
378
+
379
+ ### C. Database Schema Mapping | 資料庫結構對應
380
+
381
+ | Source Table | Target Table | Transformation |
382
+ |--------------|--------------|----------------|
383
+ | `users` | `Users` | Column renames, type changes |
384
+ | `orders` | `Orders` | Split into Orders + OrderItems |
385
+
386
+ ---
387
+
388
+ ## Related Standards | 相關標準
389
+
390
+ - [Testing Standards](../core/testing-standards.md) - 測試標準
391
+ - [Code Check-in Standards](../core/checkin-standards.md) - 程式碼簽入檢查點標準
392
+ - [Documentation Structure](../core/documentation-structure.md) - 文件結構標準
393
+
394
+ ---
395
+
396
+ ## Version History | 版本歷史
397
+
398
+ | Version | Date | Changes |
399
+ |---------|------|---------|
400
+ | 1.0.0 | 2025-12-22 | Initial migration template |
401
+
402
+ ---
403
+
404
+ ## License | 授權
405
+
406
+ This template is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
407
+
408
+ 本範本以 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 授權發布。