feat: derive flow refs and refine maintenance contracts
Parse legacy flow blocks from prototype guides into flowRefs so prompts can rely on extracted evidence instead of hardcoded JSP flow knowledge. Refine API endpoint matching for special route roles and prototype types, and expand maintenance contracts with row action conditions and checklist-derived business rules. Update README docs to reflect the new contract fields and app-map output.feat: derive flow refs and refine maintenance contracts Parse legacy flow blocks from prototype guides into flowRefs so prompts can rely on extracted evidence instead of hardcoded JSP flow knowledge. Refine API endpoint matching for special route roles and prototype types, and expand maintenance contracts with row action conditions and checklist-derived business rules. Update README docs to reflect the new contract fields and app-map output.
This commit is contained in:
@@ -169,9 +169,10 @@ node packages/html-transform/src/cli.js scan
|
||||
- 建立頁面級 `pageContract`。
|
||||
- 驗證 contract 與 DOM evidence 是否明顯衝突。
|
||||
- 讀取 `prototype/*.md` 的對照表與 checklist,擷取 prototype 檔、舊 JSP、舊 PB、對應 Vue view、功能描述與人工 checklist。
|
||||
- 讀取 `prototype/*.md` 的 legacy flow code block,產出可對照每個 prototype 的 `flowRefs`,避免 prompt 需要硬編特定 domain 的 JSP 流程知識。
|
||||
- 讀取 backend API markdown docs,建立 endpoint catalog、schema 摘要、欄位規則與錯誤格式。
|
||||
- 依 prototype evidence、guide 與 API catalog 建立 `apiContract`。
|
||||
- 依頁面 evidence 建立 `maintenanceContract`,推論頁面型態、操作能力與建議維護頁範本。
|
||||
- 依頁面 evidence 建立 `maintenanceContract`,推論頁面型態、操作能力、row action 啟用條件與 checklist 衍生的 business rules。
|
||||
- 產出 `.ht/app-map.json`,供通用 prompt 判斷 auth、legacy shell、feature page、layout 策略、API 對應與舊系統對照。
|
||||
|
||||
## 產物
|
||||
@@ -207,7 +208,8 @@ node packages/html-transform/src/cli.js scan
|
||||
- `pageContract`:頁面文字、欄位、表格、actions、layout evidence 與 Vuetify checklist。
|
||||
- `apiContract`:與該頁匹配的 API endpoints、用途分類、rejected candidates 與錯誤格式。
|
||||
- `prototypeGuide`:該 prototype 對應的人工 guide、舊 JSP/PB、target view 與 checklist。
|
||||
- `maintenanceContract`:頁面型態、capabilities、recommended template、data model 與 warnings。
|
||||
- `prototypeGuide.flowRefs`:從 guide 的 legacy flow code block 比對出的相關流程節點,包含 menu、task、nodeType、JSP、PB、動作與原始流程行。
|
||||
- `maintenanceContract`:頁面型態、capabilities、data model、row actions、business rules 與 warnings。
|
||||
- `regions`:目前仍保留,目的是相容既有資料形狀;不要把它視為 Stage 2 decomposition。
|
||||
|
||||
`.ht/app-map.json` 是跨頁面的應用結構推論。通用 prompt 應先讀它,再決定每個 prototype 是 `auth`、`legacy-shell-reference`、`feature-page` 或其他角色。MVP 固定策略是 template layout/style 優先,prototype 只提供內容與功能證據。
|
||||
@@ -219,7 +221,6 @@ route 也會包含 implementation hints,例如:
|
||||
"prototype": "venue/applications-list.html",
|
||||
"kind": "feature-page",
|
||||
"pageKind": "maintenance",
|
||||
"recommendedTemplate": "single-record",
|
||||
"primaryEntity": "ApplicationsList",
|
||||
"capabilities": ["back", "search", "edit", "delete", "print"],
|
||||
"apiCount": 8
|
||||
@@ -241,8 +242,23 @@ route 也會包含 implementation hints,例如:
|
||||
},
|
||||
"evidence": {
|
||||
"prototypeGuide": "venue.md",
|
||||
"apiCount": 2,
|
||||
"recommendedTemplate": "none"
|
||||
"apiCount": 2
|
||||
},
|
||||
"guide": {
|
||||
"flowRefs": [
|
||||
{
|
||||
"tasks": ["場地查詢"],
|
||||
"matchedKeys": ["zte451_02.jsp", "zte451_02_1.jsp"],
|
||||
"nodes": [
|
||||
{
|
||||
"task": "場地查詢",
|
||||
"nodeType": "query",
|
||||
"jsp": ["zte451_02.jsp"],
|
||||
"pb": ["of_zte451_02"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -263,8 +279,8 @@ node packages/html-transform/src/cli.js scan
|
||||
- 新增可選輸入:`backendDocs`,預設 `./apps/backend`。
|
||||
- 新增輸出:`.ht/api-catalog.json`。
|
||||
- `.ht/spec/{page}.spec.json` 新增 `apiContract`、`prototypeGuide`、`maintenanceContract`。
|
||||
- `.ht/app-map.json` route 新增 `pageKind`、`recommendedTemplate`、`capabilities`、`primaryEntity`、`apiCount`。
|
||||
- `.ui-contract.md` 會顯示 page kind、recommended template、prototype checklist 與 API endpoints。
|
||||
- `.ht/app-map.json` route 新增 `pageKind`、`capabilities`、`primaryEntity`、`apiCount`。
|
||||
- `.ui-contract.md` 會顯示 page kind、capabilities、prototype checklist 與 API endpoints。
|
||||
|
||||
因此既有 `doctor` / `scan` 指令不用改;但使用 `.ht` 產物的 prompt 或下游工具,應改讀新增欄位。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user