Skip to content

Commit 2544533

Browse files
James Zhuclaude
andcommitted
feat: comprehensive CLI testing and fetch functionality fixes
- Add comprehensive CLI command and subcommand tests (108 tests total) - 89 tests for all CLI commands, subcommands, parameters, and options - 19 tests for CLI option definitions and validation - Tests for main commands: version, doctor, upgrade/install, uninstall, launch - Tests for config commands: validate, list, set, unset, show - Tests for all subcommand groups: skill, agent, plugin, mcp, extensions, prompt - Fix critical tuple unpacking bug in base.py fetch functionality - Fixed with git_repo.clone() as (temp_dir, actual_branch) instead of as temp_dir - Bug was introduced in last commit (4740d6e) during unified fetching framework - Improve error handling in repository.py clone method - Better RuntimeError instead of re-raising CalledProcessError when all branches fail - Simplified cleanup logic to always call rmtree with ignore_errors - Add regression tests to prevent future tuple unpacking issues - Test clone method returns correct tuple structure - Integration test for proper tuple unpacking in fetchers - Fix test mocking issues in parallel fetching tests - Corrected as_completed mocking to handle dictionary iteration properly - Verify all fetch commands work correctly - skill fetch: ✅ Found 1323 skills - agent fetch: ✅ Found 1355 agents - plugin marketplace add: ✅ Working with proper validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4740d6e commit 2544533

7 files changed

Lines changed: 884 additions & 15 deletions

File tree

code_assistant_manager/fetching/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _fetch_from_single_repo(self, repo: RepoConfig) -> List[T]:
133133

134134
try:
135135
# Clone/download repository
136-
with git_repo.clone() as temp_dir:
136+
with git_repo.clone() as (temp_dir, actual_branch):
137137
# Determine scan directory
138138
scan_dir = temp_dir
139139
if repo.path:

code_assistant_manager/fetching/repository.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def clone(self) -> Generator[Tuple[Path, str], None, None]:
6464
break
6565
except subprocess.CalledProcessError:
6666
if branch == branches_to_try[-1]:
67-
raise
67+
# All branches failed, raise RuntimeError instead of CalledProcessError
68+
raise RuntimeError(f"Failed to clone repository from any branch")
6869
logger.debug(f"Branch {branch} not found, trying next...")
6970

7071
if not success:
@@ -74,5 +75,4 @@ def clone(self) -> Generator[Tuple[Path, str], None, None]:
7475

7576
finally:
7677
# Cleanup
77-
if temp_dir.exists():
78-
shutil.rmtree(temp_dir, ignore_errors=True)
78+
shutil.rmtree(temp_dir, ignore_errors=True)

0 commit comments

Comments
 (0)