fix: 保留Pio Live2D工作区资产

This commit is contained in:
sunlei 2026-07-06 15:07:31 +08:00
parent f5dbf31f82
commit 3510fb771c
3 changed files with 28 additions and 2 deletions

View File

@ -198,7 +198,7 @@ pnpm run admin-login -- --url http://127.0.0.1:5999/#/auth/login
- Admin 页面测试前可先执行 `pnpm run admin-login -- --url <Admin登录页>` 固化登录态,输出的 `storageState` 可作为后续 Playwright 用例前置状态。 - Admin 页面测试前可先执行 `pnpm run admin-login -- --url <Admin登录页>` 固化登录态,输出的 `storageState` 可作为后续 Playwright 用例前置状态。
- 接口改动后调用 `kt_api_test_plan`,并真实请求一次接口。 - 接口改动后调用 `kt_api_test_plan`,并真实请求一次接口。
- 验证启动过本地服务后调用 `kt_cleanup_process_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` - 更新 Obsidian 图谱、模块页、文档矩阵或 `.obsidian` 配置后运行 `kt_obsidian_validate` / `pnpm run obsidian-validate`;整理工作流入口时再跑 `kt_obsidian_sync`
- 改完文件后用 `kt_append_task_record``dryRun` 预览记录,再决定是否写入。 - 改完文件后用 `kt_append_task_record``dryRun` 预览记录,再决定是否写入。
- 提交前调用 `kt_commit_checklist`,确认文件范围和提交信息。 - 提交前调用 `kt_commit_checklist`,确认文件范围和提交信息。

View File

@ -2302,7 +2302,7 @@ export async function runSelfTest(): Promise<void> {
const cleanupPreview = cleanupHistoryArtifacts({ const cleanupPreview = cleanupHistoryArtifacts({
dryRun: true, dryRun: true,
keep: 3, 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<{ const cleanupRoots = cleanupPreview.roots as Array<{
preservedNames: string[]; preservedNames: string[];
@ -2314,6 +2314,9 @@ export async function runSelfTest(): Promise<void> {
const workspaceHistoryRoot = cleanupRoots.find( const workspaceHistoryRoot = cleanupRoots.find(
(item) => item.root === ".kt-workspace", (item) => item.root === ".kt-workspace",
); );
const live2dPioRoot = cleanupRoots.find(
(item) => item.root === ".kt-workspace/live2d-pio",
);
if (!testArtifactsRoot?.preservedNames.includes("_templates")) { if (!testArtifactsRoot?.preservedNames.includes("_templates")) {
throw new Error("cleanup template preservation self-check failed"); throw new Error("cleanup template preservation self-check failed");
} }
@ -2326,6 +2329,13 @@ export async function runSelfTest(): Promise<void> {
) { ) {
throw new Error("cleanup workspace cache preservation self-check failed"); 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({ const docSyncBangDream = await buildChangeDocSync({
changedFiles: [ changedFiles: [

View File

@ -50,6 +50,17 @@ const workspaceRootPreservedNames = new Set([
'verify', '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 * Builds the directory names that represent generated artifact categories under
* `.kt-workspace`; test artifact templates stay in place because KT page and * `.kt-workspace`; test artifact templates stay in place because KT page and
@ -69,6 +80,11 @@ function buildPreservedNames(rootRelativePath: string): Set<string> {
if (rootRelativePath === '.kt-workspace/test-artifacts') { if (rootRelativePath === '.kt-workspace/test-artifacts') {
preservedNames.add('_templates'); preservedNames.add('_templates');
} }
if (rootRelativePath === '.kt-workspace/live2d-pio') {
for (const name of live2dPioPreservedNames) {
preservedNames.add(name);
}
}
return preservedNames; return preservedNames;
} }