From cd7a1121d4f0072a4b15dc11b4864ec3aad26758 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Sun, 25 Jan 2026 21:50:25 -0500 Subject: [PATCH] fix: address PR review feedback - ClaudeSymlinkManager.uninstall() now returns count for accurate reporting - install-command.ts uses return value instead of always incrementing - claude-dir-installer.ts uses getCcsHome() directly instead of string manipulation - Add TODO comments to tests explaining --install is a no-op --- src/commands/install-command.ts | 6 ++++-- src/utils/claude-dir-installer.ts | 4 ++-- src/utils/claude-symlink-manager.ts | 5 ++++- tests/native/unix/uninstall.sh | 2 ++ tests/native/windows/uninstall.ps1 | 2 ++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/commands/install-command.ts b/src/commands/install-command.ts index 9959c735..8cc67a19 100644 --- a/src/commands/install-command.ts +++ b/src/commands/install-command.ts @@ -44,8 +44,10 @@ export async function handleUninstallCommand(): Promise { // 2. Remove symlinks from ~/.claude/ const symlinkManager = new ClaudeSymlinkManager(); - symlinkManager.uninstall(); - removed++; + const symlinksRemoved = symlinkManager.uninstall(); + if (symlinksRemoved > 0) { + removed++; + } // 3. Summary console.log(''); diff --git a/src/utils/claude-dir-installer.ts b/src/utils/claude-dir-installer.ts index d6ea1492..789e66aa 100644 --- a/src/utils/claude-dir-installer.ts +++ b/src/utils/claude-dir-installer.ts @@ -6,7 +6,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { ok, fail, warn, info } from './ui'; -import { getCcsDir } from './config-manager'; +import { getCcsDir, getCcsHome } from './config-manager'; // Ora fallback type for when ora is not available interface OraSpinner { @@ -60,7 +60,7 @@ export class ClaudeDirInstaller { private ccsClaudeDir: string; constructor() { - this.homeDir = getCcsDir().replace(/\.ccs$/, ''); // Get home dir from CCS dir + this.homeDir = getCcsHome(); this.ccsClaudeDir = path.join(getCcsDir(), '.claude'); } diff --git a/src/utils/claude-symlink-manager.ts b/src/utils/claude-symlink-manager.ts index 7bdc22e0..4bc2d92f 100644 --- a/src/utils/claude-symlink-manager.ts +++ b/src/utils/claude-symlink-manager.ts @@ -280,8 +280,9 @@ export class ClaudeSymlinkManager { /** * Uninstall CCS items from ~/.claude/ (remove symlinks or copied files) * Safe: only removes items that are CCS symlinks or valid copies + * @returns number of items removed */ - uninstall(): void { + uninstall(): number { let removed = 0; for (const item of this.ccsItems) { @@ -316,6 +317,8 @@ export class ClaudeSymlinkManager { } else { console.log(info('No delegation commands or skills to remove')); } + + return removed; } /** diff --git a/tests/native/unix/uninstall.sh b/tests/native/unix/uninstall.sh index a9f46c43..241e5089 100755 --- a/tests/native/unix/uninstall.sh +++ b/tests/native/unix/uninstall.sh @@ -118,6 +118,8 @@ test_case "Empty uninstall: Reports 0 items removed" "Zero removed count" bash - # ============================================================================ # Install first so we can test uninstall +# NOTE: --install is currently a no-op (under development), but we call it +# to test the install/uninstall cycle works without errors echo "" echo -e "${YELLOW}Setting up for install/uninstall cycle test...${NC}" bash -c "HOME='$TEST_HOME' '$CCS_PATH' --install > /dev/null 2>&1" diff --git a/tests/native/windows/uninstall.ps1 b/tests/native/windows/uninstall.ps1 index 82f79348..b9ac0785 100644 --- a/tests/native/windows/uninstall.ps1 +++ b/tests/native/windows/uninstall.ps1 @@ -191,6 +191,8 @@ Test-Case "Empty uninstall: Reports 0 items removed" "Zero removed count" { # ============================================================================ # Install first so we can test uninstall +# NOTE: --install is currently a no-op (under development), but we call it +# to test the install/uninstall cycle works without errors Write-Host "" Write-ColorOutput "Setting up for install/uninstall cycle test..." "Yellow" $originalHome = $env:HOME