From 3510fb771ca04cae50ead2197d02aae3c287cfcc Mon Sep 17 00:00:00 2001 From: sunlei Date: Mon, 6 Jul 2026 15:07:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E7=95=99Pio=20Live2D=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8C=BA=E8=B5=84=E4=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/selfTest.ts | 12 +++++++++++- src/tools/cleanup.ts | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7de6cc..d79c823 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ pnpm run admin-login -- --url http://127.0.0.1:5999/#/auth/login - Admin 页面测试前可先执行 `pnpm run admin-login -- --url ` 固化登录态,输出的 `storageState` 可作为后续 Playwright 用例前置状态。 - 接口改动后调用 `kt_api_test_plan`,并真实请求一次接口。 - 验证启动过本地服务后调用 `kt_cleanup_process_plan`,清掉本次进程。 -- 每轮测试/验证结束后先调用 `kt_cleanup_history`,或运行 `pnpm run cleanup-history -- --dry-run`;如果预览里 `deleted` 非空,确认范围后执行 `pnpm run cleanup-history -- --execute`,再复跑 dry-run 确认 `deleted=0`,让 `.kt-workspace` 历史产物只保留最近 3 轮并保留模板目录。`kt_workstream_closeout` / `kt_workflow_loop_audit` 只认可明确的 `deleted=0` / `deleted=[]` 文本证据或结构化 `cleanupFinalDeleted=0`。 +- 每轮测试/验证结束后先调用 `kt_cleanup_history`,或运行 `pnpm run cleanup-history -- --dry-run`;如果预览里 `deleted` 非空,确认范围后执行 `pnpm run cleanup-history -- --execute`,再复跑 dry-run 确认 `deleted=0`,让 `.kt-workspace` 历史产物只保留最近 3 轮并保留模板目录。Pio Live2D 的 `runtime-publish`、`runtime-export-moc-driven`、`probe-source-wordpress-parity`、`moc-runtime` 等活跃发布/基准输入会被保留,不按历史轮次删除。`kt_workstream_closeout` / `kt_workflow_loop_audit` 只认可明确的 `deleted=0` / `deleted=[]` 文本证据或结构化 `cleanupFinalDeleted=0`。 - 更新 Obsidian 图谱、模块页、文档矩阵或 `.obsidian` 配置后运行 `kt_obsidian_validate` / `pnpm run obsidian-validate`;整理工作流入口时再跑 `kt_obsidian_sync`。 - 改完文件后用 `kt_append_task_record` 先 `dryRun` 预览记录,再决定是否写入。 - 提交前调用 `kt_commit_checklist`,确认文件范围和提交信息。 diff --git a/src/selfTest.ts b/src/selfTest.ts index 349a7d7..cc253da 100644 --- a/src/selfTest.ts +++ b/src/selfTest.ts @@ -2302,7 +2302,7 @@ export async function runSelfTest(): Promise { const cleanupPreview = cleanupHistoryArtifacts({ dryRun: true, keep: 3, - roots: [".kt-workspace/test-artifacts", ".kt-workspace"], + roots: [".kt-workspace/test-artifacts", ".kt-workspace", ".kt-workspace/live2d-pio"], }); const cleanupRoots = cleanupPreview.roots as Array<{ preservedNames: string[]; @@ -2314,6 +2314,9 @@ export async function runSelfTest(): Promise { const workspaceHistoryRoot = cleanupRoots.find( (item) => item.root === ".kt-workspace", ); + const live2dPioRoot = cleanupRoots.find( + (item) => item.root === ".kt-workspace/live2d-pio", + ); if (!testArtifactsRoot?.preservedNames.includes("_templates")) { throw new Error("cleanup template preservation self-check failed"); } @@ -2326,6 +2329,13 @@ export async function runSelfTest(): Promise { ) { throw new Error("cleanup workspace cache preservation self-check failed"); } + if ( + !live2dPioRoot?.preservedNames.includes("runtime-publish") || + !live2dPioRoot.preservedNames.includes("probe-source-wordpress-parity") || + !live2dPioRoot.preservedNames.includes("moc-runtime") + ) { + throw new Error("cleanup Pio active runtime preservation self-check failed"); + } const docSyncBangDream = await buildChangeDocSync({ changedFiles: [ diff --git a/src/tools/cleanup.ts b/src/tools/cleanup.ts index f452803..cc81f5f 100644 --- a/src/tools/cleanup.ts +++ b/src/tools/cleanup.ts @@ -50,6 +50,17 @@ const workspaceRootPreservedNames = new Set([ 'verify', ]); +const live2dPioPreservedNames = new Set([ + '.venv', + 'moc-reconstruction', + 'moc-runtime', + 'probe-source-wordpress-parity', + 'runtime-export-moc-driven', + 'runtime-publish', + 'sources', + 'vendor', +]); + /** * Builds the directory names that represent generated artifact categories under * `.kt-workspace`; test artifact templates stay in place because KT page and @@ -69,6 +80,11 @@ function buildPreservedNames(rootRelativePath: string): Set { if (rootRelativePath === '.kt-workspace/test-artifacts') { preservedNames.add('_templates'); } + if (rootRelativePath === '.kt-workspace/live2d-pio') { + for (const name of live2dPioPreservedNames) { + preservedNames.add(name); + } + } return preservedNames; }