From c5d34142eb04dbf6bbbb3f96854cd45f450a08ac Mon Sep 17 00:00:00 2001 From: ssw Date: Tue, 16 Jun 2026 11:49:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(verify-runner):=20archiveScreenshots()=20?= =?UTF-8?q?=E5=BD=92=E6=A1=A3=E5=88=B0=20docs/{app}/verification/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- src/core/verify-runner.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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 +}