Skip to content

Commit 1a56a56

Browse files
committed
refactor(prompt_gen): standardize templates in English
- What: convert all prompt templates to English - What: update template content for clarity and consistency - Why: standardize on English for LLM prompt compatibility
1 parent 3fe4a77 commit 1a56a56

File tree

10 files changed

+158
-153
lines changed

10 files changed

+158
-153
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
### Changed
1919
- Cloudflare MCP installs now use OAuth interactive login (no API token required).
2020
- Prompt generator spec now uses `verification_url` (empty allowed) instead of `int_url`.
21+
- Prompt generator templates now use verification-environment wording and status tokens (`P1_DONE_DEPLOYED`, `P3_REFACTORED_DEPLOYED`) while still accepting legacy INT tokens.
2122

2223
### Fixed
2324
- Improved MCP list parsing to detect Gemini CLI entries with checkmarks and ANSI colors.

src/features/prompt_gen/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub struct FeatureSpec {
266266
/// 驗證 URL(可為空)
267267
pub verification_url: VerificationUrl,
268268

269-
/// INT 環境憑證(選填)
269+
/// 驗證環境憑證(選填)
270270
#[serde(default)]
271271
pub int_credentials: OptionalTextContent,
272272

src/features/prompt_gen/progress.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub enum Step {
2222
None,
2323
/// 步驟 1: 需求與交付
2424
P1,
25-
/// 步驟 2: INT E2E 驗證
25+
/// 步驟 2: 驗證環境 E2E 驗證
2626
P2,
2727
/// 步驟 3: 重構與優化
2828
P3,
29-
/// 步驟 4: INT E2E 回歸
29+
/// 步驟 4: 驗證環境 E2E 回歸
3030
P4,
3131
}
3232

@@ -83,10 +83,10 @@ impl Step {
8383
pub fn description(&self) -> &'static str {
8484
match self {
8585
Step::None => "未開始",
86-
Step::P1 => "需求、實作、部署(INT)",
87-
Step::P2 => "INT E2E 驗證",
86+
Step::P1 => "需求、實作、部署(驗證環境)",
87+
Step::P2 => "驗證環境 E2E 驗證",
8888
Step::P3 => "重構、流程優化、品質提升",
89-
Step::P4 => "INT E2E 回歸驗證",
89+
Step::P4 => "驗證環境 E2E 回歸驗證",
9090
}
9191
}
9292

@@ -111,11 +111,11 @@ impl fmt::Display for Step {
111111
pub enum FeatureStatus {
112112
/// 未知狀態
113113
Unknown,
114-
/// P1 完成並部署到 INT
114+
/// P1 完成並部署
115115
P1DoneIntDeployed,
116116
/// P2 E2E 通過
117117
P2E2EPassed,
118-
/// P3 重構完成並部署到 INT
118+
/// P3 重構完成並部署
119119
P3RefactoredIntDeployed,
120120
/// 就緒
121121
Ready,
@@ -126,9 +126,11 @@ impl FeatureStatus {
126126
pub fn from_str(s: &str) -> Self {
127127
let s = s.trim().to_uppercase();
128128
match s.as_str() {
129-
"P1_DONE_INT_DEPLOYED" => Self::P1DoneIntDeployed,
129+
"P1_DONE_DEPLOYED" | "P1_DONE_INT_DEPLOYED" => Self::P1DoneIntDeployed,
130130
"P2_E2E_PASSED" => Self::P2E2EPassed,
131-
"P3_REFACTORED_INT_DEPLOYED" => Self::P3RefactoredIntDeployed,
131+
"P3_REFACTORED_DEPLOYED" | "P3_REFACTORED_INT_DEPLOYED" => {
132+
Self::P3RefactoredIntDeployed
133+
}
132134
"READY" => Self::Ready,
133135
_ => Self::Unknown,
134136
}
@@ -144,9 +146,9 @@ impl fmt::Display for FeatureStatus {
144146
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
145147
let s = match self {
146148
Self::Unknown => "UNKNOWN",
147-
Self::P1DoneIntDeployed => "P1_DONE_INT_DEPLOYED",
149+
Self::P1DoneIntDeployed => "P1_DONE_DEPLOYED",
148150
Self::P2E2EPassed => "P2_E2E_PASSED",
149-
Self::P3RefactoredIntDeployed => "P3_REFACTORED_INT_DEPLOYED",
151+
Self::P3RefactoredIntDeployed => "P3_REFACTORED_DEPLOYED",
150152
Self::Ready => "READY",
151153
};
152154
write!(f, "{}", s)
@@ -387,6 +389,10 @@ LAST_DONE="p2"
387389
#[test]
388390
fn test_feature_status_parse() {
389391
assert_eq!(FeatureStatus::from_str("READY"), FeatureStatus::Ready);
392+
assert_eq!(
393+
FeatureStatus::from_str("P1_DONE_DEPLOYED"),
394+
FeatureStatus::P1DoneIntDeployed
395+
);
390396
assert_eq!(
391397
FeatureStatus::from_str("P1_DONE_INT_DEPLOYED"),
392398
FeatureStatus::P1DoneIntDeployed

src/features/prompt_gen/renderer.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl PromptRenderer {
111111
.replace("{REQUIREMENTS_BLOCK}", requirements_block)
112112
.replace("{ACCEPTANCE_BLOCK}", acceptance_block)
113113
.replace("{VERIFICATION_URL}", verification_url)
114-
.replace("{INT_CREDENTIALS_BLOCK}", int_credentials_block)
114+
.replace("{VERIFICATION_CREDENTIALS_BLOCK}", int_credentials_block)
115115
.replace("{STATE_REQUIREMENT}", state_requirement)
116116
}
117117

@@ -217,8 +217,7 @@ mod tests {
217217
let prompts = PromptRenderer::render(&spec);
218218
let prompt_03 = &prompts.prompts[2].content;
219219

220-
assert!(prompt_03.contains("frontend-design skill"));
221-
assert!(prompt_03.contains("chrome-devtools"));
220+
assert!(prompt_03.contains("visual direction"));
222221
}
223222

224223
#[test]
@@ -227,6 +226,6 @@ mod tests {
227226
let prompts = PromptRenderer::render(&spec);
228227
let prompt_03 = &prompts.prompts[2].content;
229228

230-
assert!(!prompt_03.contains("frontend-design skill"));
229+
assert!(!prompt_03.contains("visual direction"));
231230
}
232231
}

src/features/prompt_gen/templates/frontend_section.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
///
55
/// 佔位符:
66
/// - `{IS_FRONTEND}`: 是否為前端功能
7-
pub const FRONTEND_SECTION: &str = r#"## (條件式)前端設計強化(只有當 {IS_FRONTEND} = true 才執行)
8-
若此功能是前端,請額外遵守:
9-
- 使用 mcp chrome-devtools 輔助開發,必須測試不跑版、無錯誤、UI/UX 優秀
10-
- Use the frontend-design skill
11-
- 先詳細分析配色與設計方案(暗色系、有質感、低調專業、舒適配色)
12-
- 重新設計元件顏色:高辨識度但不花俏;布局合理且簡潔
13-
- 大量互動與動畫:
14-
- hover/focus/active feedback
15-
- 送出按鈕必須有明確回饋(loading/success/error)
16-
- 移除不需要的 code/邏輯,同時 build 必須通過
7+
pub const FRONTEND_SECTION: &str = r#"## (Conditional) Frontend Design and UX (Only when {IS_FRONTEND} = true)
8+
If this feature includes frontend work, also follow:
9+
- Use browser developer tools or available automation to validate; ensure no layout breakage, no errors, and reasonable UX
10+
- Define a clear visual direction (typography, color, hierarchy, spacing) and keep it consistent and readable
11+
- Use colors that are easy to distinguish without being harsh; keep layout simple and information hierarchy clear
12+
- Interactions and motion must provide explicit feedback:
13+
- hover/focus/active
14+
- primary actions must show loading/success/error states
15+
- Remove unnecessary code/logic while keeping build green
1716
"#;

src/features/prompt_gen/templates/state_requirement.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
/// 佔位符:
66
/// - `{FEATURE_KEY}`: 功能鍵值
77
pub const STATE_REQUIREMENT_BLOCK: &str = r#"
8-
## 狀態機(必須遵守,供 Runner 強制順序性)
9-
你必須在 `features/{FEATURE_KEY}/STATE.md` 維護以下欄位(若不存在就建立),並在每個 prompt 結束時更新:
8+
## State Machine (Required, for enforcing step order)
9+
You must maintain the following fields in `features/{FEATURE_KEY}/STATE.md` (create if missing) and update them at the end of each prompt:
1010
1111
- FEATURE_KEY: {FEATURE_KEY}
1212
- STATUS: <one of>
13-
- P1_DONE_INT_DEPLOYED
13+
- P1_DONE_DEPLOYED
1414
- P2_E2E_PASSED
15-
- P3_REFACTORED_INT_DEPLOYED
15+
- P3_REFACTORED_DEPLOYED
1616
- READY
1717
18-
本 prompt 的結束狀態要求:
19-
- Prompt #1 結束:STATUS 必須設為 `P1_DONE_INT_DEPLOYED`
20-
- Prompt #2 結束:STATUS 必須設為 `P2_E2E_PASSED`
21-
- Prompt #3 結束:STATUS 必須設為 `P3_REFACTORED_INT_DEPLOYED`
22-
- Prompt #4 結束:STATUS 必須設為 `READY`
18+
Required end status for each prompt:
19+
- Prompt #1 end: STATUS must be `P1_DONE_DEPLOYED`
20+
- Prompt #2 end: STATUS must be `P2_E2E_PASSED`
21+
- Prompt #3 end: STATUS must be `P3_REFACTORED_DEPLOYED`
22+
- Prompt #4 end: STATUS must be `READY`
2323
24-
如果你做不到(例如仍有失敗的驗收項),你必須維持原狀態並在 STATE.md 清楚寫出原因與下一步。
24+
If you cannot meet the requirement (for example, failed acceptance items remain), keep the previous STATUS and clearly record the reason and next steps in STATE.md.
2525
"#;
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! 模板 01 - 需求、實作、部署(INT
1+
//! 模板 01 - 需求、實作、部署(驗證環境
22
33
/// 第一階段模板:需求與交付
44
///
@@ -9,17 +9,17 @@
99
/// - `{REQUIREMENTS_BLOCK}`: 需求區塊
1010
/// - `{ACCEPTANCE_BLOCK}`: 驗收條件區塊
1111
/// - `{VERIFICATION_URL}`: 驗證 URL(可為空)
12-
/// - `{INT_CREDENTIALS_BLOCK}`: INT 環境憑證
12+
/// - `{VERIFICATION_CREDENTIALS_BLOCK}`: 驗證環境憑證
1313
/// - `{STATE_REQUIREMENT}`: 狀態需求區塊
14-
pub const TEMPLATE_01: &str = r#"# [Feature] {FEATURE_KEY} - 需求、實作、部署(INT)
14+
pub const TEMPLATE_01: &str = r#"# [Feature] {FEATURE_KEY} - Requirements, Implementation, Deployment (Verification Environment)
1515
16-
你是一位資深全端工程師/Tech Lead,在此 repo 內完成此功能並部署到 INT 環境。
17-
本輪工作(Prompt #1~#4)需要保持記憶與連貫性;但請同時把關鍵狀態寫進檔案,以便 runner 續跑。
16+
You are a senior full-stack engineer/Tech Lead. Implement this feature in the codebase and deploy it to the verification environment.
17+
This round of work (Prompt #1-#4) must remain coherent; also write key state to files so it can be continued later.
1818
19-
## 強制工具要求(必須遵守)
20-
- 你必須使用 `sequential-thinking` 來做規劃(先規劃再動手)。
19+
## Planning Requirements (Must Follow)
20+
- Complete structured planning before implementation (use any planning tool if available).
2121
22-
## 輸入資訊
22+
## Inputs
2323
- Feature Key: {FEATURE_KEY}
2424
- Feature Name: {FEATURE_NAME}
2525
@@ -33,44 +33,44 @@ pub const TEMPLATE_01: &str = r#"# [Feature] {FEATURE_KEY} - 需求、實作、
3333
{ACCEPTANCE_BLOCK}
3434
3535
- Verification URL (optional): {VERIFICATION_URL}
36-
- INT Credentials / Login Method (if needed):
37-
{INT_CREDENTIALS_BLOCK}
36+
- Verification Credentials / Login Method (if needed):
37+
{VERIFICATION_CREDENTIALS_BLOCK}
3838
3939
{STATE_REQUIREMENT}
4040
41-
## 產出與落檔(必須)
42-
`features/{FEATURE_KEY}/` 產出並維護以下檔案(若不存在就建立):
43-
1) `STATE.md`:本輪狀態(本 prompt 的決策、已完成項、待辦、風險、如何在 int 驗證;含 STATUS 欄位)
44-
2) `E2E_PLAN.md`:可在瀏覽器執行的端到端測試清單(步驟要非常具體)
45-
3) `ACCEPTANCE.md`:把驗收條件轉成可檢查項(checklist
46-
4) `RUNBOOK_INT.md`:如何部署/如何回滾/需要的設定
47-
5) `CHANGELOG.md`:本功能變更摘要(面向 reviewer
48-
49-
## 執行流程(請嚴格照順序)
50-
1) 使用 `sequential-thinking`:
51-
- 讀 repo 結構、關聯模組與既有行為
52-
- 澄清需求與邊界(缺資訊時:做合理假設並寫入 `STATE.md`,不要卡住)
53-
- 設計方案:資料流/模組邊界/錯誤處理/觀測性/測試策略
54-
- 拆出可交付的最小步驟(每一步可 build、可測、可回退)
55-
56-
2) 實作:
57-
- 實作功能與必要的後端/前端改動(依 repo 慣例)
58-
- 補齊必要測試(單元/整合,至少涵蓋主要成功路徑與重要失敗路徑)
59-
- 確保 lint/format/typecheck/build 通過
60-
61-
3) 部署到 INT:
62-
- 依 repo 的部署方式完成部署
63-
- 將部署方式、版本/commit、設定差異寫入 `RUNBOOK_INT.md` `STATE.md`
64-
65-
4) 收尾:
66-
- 更新 `E2E_PLAN.md`(讓下一個 Prompt #2 可以直接照做)
67-
- 更新 `STATE.md`,並把 STATUS 設為 `P1_DONE_INT_DEPLOYED`
68-
69-
## 重要約束
70-
- 憑證/金鑰/Token 不得寫進程式碼或 repo。需要時請使用環境變數或既有 secret 機制。
71-
72-
## 最終回覆格式(必須)
73-
- 本 prompt 完成摘要(含已部署到 INT 的證據:版本/commit/tag、部署位置)
74-
- STATE.md 狀態(包含 STATUS
75-
- 下一步(Prompt #2)執行指引(對應 `E2E_PLAN.md`
41+
## Required Artifacts (Must Produce)
42+
Create and maintain the following files under `features/{FEATURE_KEY}/` (create if missing):
43+
1) `STATE.md`: Current state (decisions, completed items, TODOs, risks, how to validate in the verification environment; include STATUS field)
44+
2) `E2E_PLAN.md`: Browser-executable end-to-end checklist (steps must be precise)
45+
3) `ACCEPTANCE.md`: Convert acceptance criteria into a checklist
46+
4) `RUNBOOK_VERIFICATION.md`: How to deploy, rollback, and required configuration
47+
5) `CHANGELOG.md`: Feature change summary (reviewer-facing)
48+
49+
## Execution Flow (Strict Order)
50+
1) Structured planning:
51+
- Review codebase structure, related modules, and current behavior
52+
- Clarify requirements and boundaries (if missing info, make reasonable assumptions and record in `STATE.md`)
53+
- Design the solution: data flow, module boundaries, error handling, observability, test strategy
54+
- Break into minimal deliverable steps (each step should build, test, and be reversible)
55+
56+
2) Implementation:
57+
- Implement required backend/frontend changes following codebase conventions
58+
- Add necessary tests (unit/integration; cover key success and failure paths)
59+
- Ensure lint/format/typecheck/build pass
60+
61+
3) Deploy to the verification environment:
62+
- Follow the codebase deployment approach
63+
- Record deployment method, version/commit, and config differences in `RUNBOOK_VERIFICATION.md` and `STATE.md`
64+
65+
4) Wrap-up:
66+
- Update `E2E_PLAN.md` (so Prompt #2 can follow it directly)
67+
- Update `STATE.md` and set STATUS to `P1_DONE_DEPLOYED`
68+
69+
## Important Constraints
70+
- Credentials/keys/tokens must not be committed to the codebase. Use environment variables or existing secret mechanisms.
71+
72+
## Final Response Format (Required)
73+
- Summary of work completed (include evidence of verification deployment: version/commit/tag and target location)
74+
- STATE.md status (including STATUS)
75+
- Guidance for Prompt #2 (aligned with `E2E_PLAN.md`)
7676
"#;
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
//! 模板 02 - INT E2E 驗證
1+
//! 模板 02 - 驗證環境 E2E 驗證
22
3-
/// 第二階段模板:INT E2E 驗證(直到符合預期)
3+
/// 第二階段模板:驗證環境 E2E 驗證(直到符合預期)
44
///
55
/// 佔位符:
66
/// - `{FEATURE_KEY}`: 功能鍵值
77
/// - `{STATE_REQUIREMENT}`: 狀態需求區塊
8-
pub const TEMPLATE_02_FIXED: &str = r#"# [Fixed] INT E2E 驗證(直到符合預期)
8+
pub const TEMPLATE_02_FIXED: &str = r#"# [Fixed] Verification Environment E2E Validation (Until Passing)
99
10-
你正在延續同一輪(Feature)的 session,請使用前一個 prompt 的記憶與 repo 產物來做 E2E
11-
目標:在 INT 環境用真實瀏覽器把功能完整驗證到符合預期;若不符合,請修復、重新部署、再測到通過。
10+
You are continuing the same feature context. Use the previous prompt outputs and codebase artifacts to run E2E.
11+
Goal: validate the feature end-to-end in the verification environment using a real browser. If it fails, fix, redeploy, and retest until it passes.
1212
13-
## 強制工具要求(必須)
14-
- 你必須使用 `sequential-thinking` 來規劃 E2E 執行與修復策略。
15-
- 你必須使用 `mcp chrome-devtools` 打開 INT 網站,進行全面端到端測試(包含 console/network/error 等檢查)。
13+
## Tooling Requirements (Must Follow)
14+
- Use structured planning to schedule E2E execution and remediation.
15+
- Use a real browser and developer tools for comprehensive end-to-end testing (including console/network/error checks).
1616
1717
{STATE_REQUIREMENT}
1818
19-
## 操作規範(必須)
20-
1) 讀取並遵循:
19+
## Operating Rules (Must Follow)
20+
1) Read and follow:
2121
- `features/{FEATURE_KEY}/E2E_PLAN.md`
2222
- `features/{FEATURE_KEY}/ACCEPTANCE.md`
23-
- `features/{FEATURE_KEY}/RUNBOOK_INT.md`
23+
- `features/{FEATURE_KEY}/RUNBOOK_VERIFICATION.md`
2424
- `features/{FEATURE_KEY}/STATE.md`
2525
26-
2) 用 `mcp chrome-devtools` 在 INT 執行測試(逐步檢查畫面、互動、console/network
27-
3) 若失敗:修復 → 測試 → 部署 INT → 再驗證(直到通過)
28-
4) 通過後:
29-
- 更新 `E2E_RUN_REPORT.md`
30-
- 更新 `STATE.md`,並把 STATUS 設為 `P2_E2E_PASSED`
26+
2) Execute tests in the verification environment with a real browser (step-by-step UI/interaction/console/network checks)
27+
3) If failing: fix -> test -> deploy to the verification environment -> re-validate (until passing)
28+
4) When passing:
29+
- Update `E2E_RUN_REPORT.md`
30+
- Update `STATE.md` and set STATUS to `P2_E2E_PASSED`
3131
32-
## 停止條件
33-
- 只有在 `ACCEPTANCE.md` 全部打勾、且 E2E 核心流程與重要失敗情境皆通過,才能宣告完成此 prompt。
32+
## Stop Condition
33+
- You may only complete this prompt when all items in `ACCEPTANCE.md` are checked off and the core E2E flows plus key failure scenarios pass.
3434
35-
## 最終回覆格式(必須)
36-
- E2E 通過摘要(對應 `ACCEPTANCE.md`
37-
- STATE.md 狀態(包含 STATUS
38-
- 下一步(Prompt #3)建議的重構/優化方向
35+
## Final Response Format (Required)
36+
- E2E pass summary (aligned with `ACCEPTANCE.md`)
37+
- STATE.md status (including STATUS)
38+
- Guidance for Prompt #3 refactoring/optimization
3939
"#;

0 commit comments

Comments
 (0)