refactor(scan): stop emitting markdown contract artifacts
Remove generated `.ui-contract.md` and `.bdd.md` outputs from the scan pipeline and documentation so downstream consumers rely on structured JSON artifacts instead. Also drop unused API `fieldRules` catalog output and remove stale app-map references to UI contract files. Update legacy flow matching to preserve only the nodes that directly matched the current entry.refactor(scan): stop emitting markdown contract artifacts Remove generated `.ui-contract.md` and `.bdd.md` outputs from the scan pipeline and documentation so downstream consumers rely on structured JSON artifacts instead. Also drop unused API `fieldRules` catalog output and remove stale app-map references to UI contract files. Update legacy flow matching to preserve only the nodes that directly matched the current entry.
This commit is contained in:
@@ -186,15 +186,13 @@ node packages/html-transform/src/cli.js scan
|
||||
.ht/cache/prototype/{page}/capture-metadata.json
|
||||
```
|
||||
|
||||
每個 HTML 的 contract artifact:
|
||||
每個 HTML 的 contract artifact:
|
||||
|
||||
```text
|
||||
.ht/api-catalog.json
|
||||
.ht/app-map.json
|
||||
.ht/spec/{page}.spec.json
|
||||
.ht/spec/{page}.validation.json
|
||||
.ht/spec/{page}.ui-contract.md
|
||||
.ht/spec/{page}.bdd.md
|
||||
```
|
||||
|
||||
`.ht/api-catalog.json` 是跨頁面的 backend API catalog,來源是 `backendDocs` 目錄下的 markdown 文件。它會包含:
|
||||
@@ -216,8 +214,6 @@ node packages/html-transform/src/cli.js scan
|
||||
- `bddContract`:以頁面 evidence 產生的 Gherkin 草稿、scenario evidence trace 與人工 review warnings。
|
||||
- `regions`:目前仍保留,目的是相容既有資料形狀;不要把它視為 Stage 2 decomposition。
|
||||
|
||||
`.bdd.md` 是 BDD 起始模版,會依 `pageKind` 產生 auth、query、maintenance、application、print 或 generic scenario。每個 scenario 會保留欄位、actions、tables、API endpoints、prototype checklist 與 legacy flow refs,供人工 review 後再轉成可執行測試。若 scan 看見錯誤流程、必填驗證、狀態限制、API error format 或尚未被 scenario 使用的 checklist/action/API,會列入 `candidateScenarios` 或 `uncoveredEvidence`,避免 evidence 被靜默漏掉。
|
||||
|
||||
`.ht/app-map.json` 是跨頁面的應用結構推論。通用 prompt 應先讀它,再決定每個 prototype 是 `auth`、`legacy-shell-reference`、`feature-page` 或其他角色。MVP 固定策略是 template layout/style 優先,prototype 只提供內容與功能證據。
|
||||
|
||||
route 也會包含 implementation hints,例如:
|
||||
@@ -286,10 +282,14 @@ node packages/html-transform/src/cli.js scan
|
||||
- 新增輸出:`.ht/api-catalog.json`。
|
||||
- `.ht/spec/{page}.spec.json` 新增 `apiContract`、`prototypeGuide`、`maintenanceContract`。
|
||||
- `.ht/app-map.json` route 新增 `pageKind`、`capabilities`、`primaryEntity`、`apiCount`。
|
||||
- `.ui-contract.md` 會顯示 page kind、capabilities、prototype checklist 與 API endpoints。
|
||||
|
||||
因此既有 `doctor` / `scan` 指令不用改;但使用 `.ht` 產物的 prompt 或下游工具,應改讀新增欄位。
|
||||
|
||||
## 產物中的路徑
|
||||
|
||||
`.spec.json` 內 `source`、`screenshot`、`domSummary`、`accessibilityTree`、`metadata` 等欄位使用絕對路徑,而非相對路徑。這是 scan pipeline 的自然結果:`config.prototypeDir`、`config.htDir` 都以 `path.resolve(cwd, ...)` 轉為絕對路徑,後續 `listFiles` 和 `path.join` 產出的路徑字串均繼承絕對形式,不做 `path.relative` 轉換。
|
||||
|
||||
因為 `.ht/` 目錄已由 `.gitignore` 排除,這些檔案不會進入版本控制,每個開發者在自己機器上跑 `scan` 會重新生成,路徑自然指向自己的專案目錄,因此不影響可攜性。
|
||||
|
||||
## 驗證
|
||||
|
||||
修改本 package 後至少執行:
|
||||
|
||||
Reference in New Issue
Block a user