diff --git a/src/core/verify-runner.ts b/src/core/verify-runner.ts index c0d707d..c655960 100644 --- a/src/core/verify-runner.ts +++ b/src/core/verify-runner.ts @@ -141,3 +141,29 @@ export async function runVerify( }) }) } + +/** + * 截图归档: 从 verify-form.ts 临时目录复制到 docs/{app}/verification/{enCode}-{ts}/ + * 返归档后路径列表 + */ +export function archiveScreenshots( + sourceDir: string, + appCode: string, + enCode: string +): string[] { + if (!existsSync(sourceDir)) return [] + const ts = new Date().toISOString().replace(/[-:T.]/g, '').slice(0, 14) // 20260616153045 + const targetDir = join(WORK_DIR, 'docs', appCode, 'verification', `${enCode}-${ts}`) + mkdirSync(targetDir, { recursive: true }) + + const archived: string[] = [] + for (const file of readdirSync(sourceDir)) { + if (file.endsWith('.png') || file.endsWith('.json')) { + const src = join(sourceDir, file) + const dst = join(targetDir, file) + copyFileSync(src, dst) + archived.push(dst) + } + } + return archived +}