From a2f98b7c00504e93dd3e0ea1a6c3057d4e8d5783 Mon Sep 17 00:00:00 2001 From: sunlei Date: Fri, 3 Jul 2026 18:22:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=9D=E7=95=99ktWorkflow=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E6=9D=BF=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/selfTest.ts | 4 ++-- src/tools/cleanup.ts | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/selfTest.ts b/src/selfTest.ts index 6fa1eca..85d4e88 100644 --- a/src/selfTest.ts +++ b/src/selfTest.ts @@ -2082,8 +2082,8 @@ export async function runSelfTest(): Promise { const workspaceHistoryRoot = cleanupRoots.find( (item) => item.root === ".kt-workspace", ); - if (testArtifactsRoot?.preservedNames.includes("_templates")) { - throw new Error("cleanup template migration self-check failed"); + if (!testArtifactsRoot?.preservedNames.includes("_templates")) { + throw new Error("cleanup template preservation self-check failed"); } if (!workspaceHistoryRoot?.preservedNames.includes("test-artifacts")) { throw new Error("cleanup workspace root preservation self-check failed"); diff --git a/src/tools/cleanup.ts b/src/tools/cleanup.ts index 453868a..f452803 100644 --- a/src/tools/cleanup.ts +++ b/src/tools/cleanup.ts @@ -52,8 +52,8 @@ const workspaceRootPreservedNames = new Set([ /** * Builds the directory names that represent generated artifact categories under - * `.kt-workspace`; reusable templates and references are intentionally not - * preserved here because they belong in `workspace-assets`. + * `.kt-workspace`; test artifact templates stay in place because KT page and + * business test flows use them as local scaffolding inputs. * * @param rootRelativePath - Cleanup root relative to the KT workspace. * @returns Category names that cleanup should skip when pruning `.kt-workspace`. @@ -66,6 +66,9 @@ function buildPreservedNames(rootRelativePath: string): Set { preservedNames.add(name); } } + if (rootRelativePath === '.kt-workspace/test-artifacts') { + preservedNames.add('_templates'); + } return preservedNames; }