mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
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:
@@ -44,8 +44,10 @@ export async function handleUninstallCommand(): Promise<void> {
|
||||
|
||||
// 2. Remove symlinks from ~/.claude/
|
||||
const symlinkManager = new ClaudeSymlinkManager();
|
||||
symlinkManager.uninstall();
|
||||
removed++;
|
||||
const symlinksRemoved = symlinkManager.uninstall();
|
||||
if (symlinksRemoved > 0) {
|
||||
removed++;
|
||||
}
|
||||
|
||||
// 3. Summary
|
||||
console.log('');
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user