feat: expand EasyCode software factory workflows

This commit is contained in:
王鹏
2026-07-15 12:48:50 +08:00
parent fcfa4374d7
commit 79dea897bc
1108 changed files with 163774 additions and 21593 deletions

View File

@@ -0,0 +1,68 @@
import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
const read = path => readFileSync(resolve(root, path), 'utf8')
test('prompt registry api exposes immutable version publication operations', () => {
const api = read('src/api/generator/prompt.js')
for (const name of [
'listPromptTemplates',
'getPromptTemplate',
'addPromptTemplate',
'updatePromptTemplate',
'createPromptVersion',
'publishPromptVersion',
'rollbackPromptVersion',
'initializePromptV1'
]) {
assert.equal(api.includes(`export function ${name}`), true, `${name} should be exported`)
}
assert.match(api, /versions\/\$\{promptVersionId\}\/publish/)
assert.match(api, /versions\/\$\{promptVersionId\}\/rollback/)
})
test('prompt registry view manages templates and version lifecycle', () => {
const view = read('src/views/generator/prompt/index.vue')
assert.match(view, /name: 'PromptRegistry'/)
assert.match(view, /class="version-drawer-body"/)
assert.match(view, /创建草稿/)
assert.match(view, /publishPromptVersion/)
assert.match(view, /rollbackPromptVersion/)
assert.match(view, /generator:prompt:publish/)
assert.match(view, /generator:prompt:rollback/)
assert.match(view, /contentHash/)
assert.match(view, /currentFingerprint/)
assert.match(view, /builtinRelease/)
assert.match(view, /初始化 V1/)
assert.doesNotMatch(view, /<textarea/)
})
test('prompt center exposes online debugging and A/B experiment workflows', () => {
const api = read('src/api/generator/prompt.js')
const view = read('src/views/generator/prompt/index.vue')
for (const name of [
'listPromptModels',
'debugPrompt',
'listPromptDebugRuns',
'scorePromptDebugRun',
'listPromptExperiments',
'addPromptExperiment',
'comparePromptExperiment',
'getPromptExperimentStats'
]) {
assert.equal(api.includes(`export function ${name}`), true, `${name} should be exported`)
}
assert.match(view, /Prompt 在线调试/)
assert.match(view, /Prompt A\/B 测试/)
assert.match(view, /generator:prompt:debug/)
assert.match(view, /generator:prompt:experiment/)
assert.match(view, /runDebug/)
assert.match(view, /runCompare/)
assert.match(view, /scorePromptDebugRun/)
assert.match(view, /User Prompt 模板/)
assert.match(view, /\{\{input\}\}/)
})