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
This commit is contained in:
kaitranntt
2026-01-25 21:50:25 -05:00
parent 6a2c82917d
commit cd7a1121d4
5 changed files with 14 additions and 5 deletions
+4 -2
View File
@@ -44,8 +44,10 @@ export async function handleUninstallCommand(): Promise<void> {
// 2. Remove symlinks from ~/.claude/ // 2. Remove symlinks from ~/.claude/
const symlinkManager = new ClaudeSymlinkManager(); const symlinkManager = new ClaudeSymlinkManager();
symlinkManager.uninstall(); const symlinksRemoved = symlinkManager.uninstall();
removed++; if (symlinksRemoved > 0) {
removed++;
}
// 3. Summary // 3. Summary
console.log(''); console.log('');
+2 -2
View File
@@ -6,7 +6,7 @@
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import { ok, fail, warn, info } from './ui'; 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 // Ora fallback type for when ora is not available
interface OraSpinner { interface OraSpinner {
@@ -60,7 +60,7 @@ export class ClaudeDirInstaller {
private ccsClaudeDir: string; private ccsClaudeDir: string;
constructor() { constructor() {
this.homeDir = getCcsDir().replace(/\.ccs$/, ''); // Get home dir from CCS dir this.homeDir = getCcsHome();
this.ccsClaudeDir = path.join(getCcsDir(), '.claude'); this.ccsClaudeDir = path.join(getCcsDir(), '.claude');
} }
+4 -1
View File
@@ -280,8 +280,9 @@ export class ClaudeSymlinkManager {
/** /**
* Uninstall CCS items from ~/.claude/ (remove symlinks or copied files) * Uninstall CCS items from ~/.claude/ (remove symlinks or copied files)
* Safe: only removes items that are CCS symlinks or valid copies * Safe: only removes items that are CCS symlinks or valid copies
* @returns number of items removed
*/ */
uninstall(): void { uninstall(): number {
let removed = 0; let removed = 0;
for (const item of this.ccsItems) { for (const item of this.ccsItems) {
@@ -316,6 +317,8 @@ export class ClaudeSymlinkManager {
} else { } else {
console.log(info('No delegation commands or skills to remove')); console.log(info('No delegation commands or skills to remove'));
} }
return removed;
} }
/** /**
+2
View File
@@ -118,6 +118,8 @@ test_case "Empty uninstall: Reports 0 items removed" "Zero removed count" bash -
# ============================================================================ # ============================================================================
# Install first so we can test uninstall # 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 ""
echo -e "${YELLOW}Setting up for install/uninstall cycle test...${NC}" echo -e "${YELLOW}Setting up for install/uninstall cycle test...${NC}"
bash -c "HOME='$TEST_HOME' '$CCS_PATH' --install > /dev/null 2>&1" bash -c "HOME='$TEST_HOME' '$CCS_PATH' --install > /dev/null 2>&1"
+2
View File
@@ -191,6 +191,8 @@ Test-Case "Empty uninstall: Reports 0 items removed" "Zero removed count" {
# ============================================================================ # ============================================================================
# Install first so we can test uninstall # 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-Host ""
Write-ColorOutput "Setting up for install/uninstall cycle test..." "Yellow" Write-ColorOutput "Setting up for install/uninstall cycle test..." "Yellow"
$originalHome = $env:HOME $originalHome = $env:HOME