From 0d58617a4281f441b58f480bf245083e57a8667d Mon Sep 17 00:00:00 2001 From: Goon Date: Tue, 24 Mar 2026 17:49:02 +0700 Subject: [PATCH] fix(cli): check dir existence before reporting removal in uninstall Use stat() to verify directory exists before rm + push to removed[]. Prevents misleading "Skill files removed!" when dir never existed. --- cli/src/commands/uninstall.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/uninstall.ts b/cli/src/commands/uninstall.ts index ba58fea..f4815ba 100644 --- a/cli/src/commands/uninstall.ts +++ b/cli/src/commands/uninstall.ts @@ -1,4 +1,4 @@ -import { rm } from 'node:fs/promises'; +import { rm, stat } from 'node:fs/promises'; import { join } from 'node:path'; import { homedir } from 'node:os'; import chalk from 'chalk'; @@ -24,10 +24,11 @@ async function removeSkillDir(baseDir: string, aiType: Exclude): for (const folder of folders) { const skillDir = join(baseDir, folder, 'skills', 'ui-ux-pro-max'); try { + await stat(skillDir); await rm(skillDir, { recursive: true, force: true }); removed.push(`${folder}/skills/ui-ux-pro-max`); } catch (err: unknown) { - // Re-throw permission errors; force:true already handles ENOENT + // Skip non-existent dirs; re-throw permission or other errors if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err; } }