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:
skytek_xinliang
2026-05-26 16:44:36 +08:00
parent 8d40f6972b
commit 23fc852321
6 changed files with 35 additions and 159 deletions
-9
View File
@@ -34,20 +34,11 @@ test('CLI runs doctor and scan against one prototype', async () => {
const doctor = await exec('node', [cli, 'doctor'], { cwd })
await exec('node', [cli, 'scan'], { cwd })
const contract = await readFile(join(cwd, '.ht/spec/index.ui-contract.md'), 'utf8')
const bdd = await readFile(join(cwd, '.ht/spec/index.bdd.md'), 'utf8')
const spec = JSON.parse(await readFile(join(cwd, '.ht/spec/index.spec.json'), 'utf8'))
const validation = JSON.parse(await readFile(join(cwd, '.ht/spec/index.validation.json'), 'utf8'))
const appMap = JSON.parse(await readFile(join(cwd, '.ht/app-map.json'), 'utf8'))
assert.match(doctor.stdout, /ok prototype directory/)
assert.match(contract, /Customer Portal/)
assert.match(contract, /BDD Scenarios/)
assert.match(contract, /Capture Artifacts/)
assert.match(contract, /Browser Evidence/)
assert.match(bdd, /Feature: Customer portal entry/)
assert.match(bdd, /Scenario: 使用者填寫必要資料並送出成功/)
assert.doesNotMatch(contract, /Recommended template/)
assert.equal(spec.pageContract.title, null)
assert.equal(spec.bddContract.feature, 'Customer portal entry')
assert.equal(spec.bddContract.scenarios[0].type, 'application-submit')
+3 -2
View File
@@ -229,7 +229,7 @@ test('parsePrototypeGuide extracts legacy flow references for matched entries',
assert.equal(guide.legacyFlows.length, 1)
assert.equal(guide.entries[0].flowRefs[0].tasks[0], '場地申請')
assert.ok(guide.entries[0].flowRefs[0].nodes.some((node) => node.nodeType === 'precondition'))
assert.ok(guide.entries[0].flowRefs[0].nodes.some((node) => node.nodeType === 'form'))
assert.ok(guide.entries[0].flowRefs[0].nodes.some((node) => node.jsp.includes('zte450_01.jsp')))
})
@@ -278,7 +278,8 @@ test('buildApiCatalog parses generic markdown API docs and matches routes', () =
])
assert.ok(catalog.endpoints.some((endpoint) => endpoint.id === 'POST /api/v1/orders'))
assert.equal(catalog.fieldRules[0].field, 'orderName')
const ordersEndpoint = catalog.endpoints.find((endpoint) => endpoint.id === 'POST /api/v1/orders')
assert.equal(ordersEndpoint.fieldRules[0].field, 'orderName')
const matches = matchApiEndpoints({
prototype: 'orders/apply.html',
page: 'apply.html',