feat: add comprehensive test suite, CI/CD workflows, and install command
Major improvements to SuperClaude Framework infrastructure and testing:
## New Features
- Add 'superclaude install' command to install slash commands (/research, /index-repo, /agent, /recommend)
- Create comprehensive test suite with 71 tests (70 passing, 1 skipped)
- Add GitHub Actions CI/CD workflows for automated testing
- Add essential documentation files (PLANNING.md, TASK.md, KNOWLEDGE.md)
## Testing
- tests/unit/: 59 tests covering PM Agent components
- test_confidence.py: 13 tests for ConfidenceChecker
- test_self_check.py: 14 tests for SelfCheckProtocol
- test_reflexion.py: 9 tests for ReflexionPattern
- test_token_budget.py: 12 tests for TokenBudgetManager
- test_cli_install.py: 12 tests for install command (NEW)
- tests/integration/: 11 tests for pytest plugin integration
- tests/conftest.py: Shared fixtures for all tests
## CI/CD Workflows
- .github/workflows/test.yml: Comprehensive test matrix
- Tests on Python 3.10, 3.11, 3.12
- Lint and format checks with ruff
- Pytest plugin verification
- SuperClaude doctor health checks
- Coverage reporting with Codecov
- .github/workflows/quick-check.yml: Fast PR validation (~2-3 min)
- .github/workflows/README.md: Workflow documentation
## Documentation
- PLANNING.md: Architecture, design principles, absolute rules
- TASK.md: Current tasks, priorities, backlog
- KNOWLEDGE.md: Accumulated insights, best practices, troubleshooting
## Bug Fixes
- Fix .gitignore contradictions (remove conflicting Claude Code patterns)
- Fix TokenBudgetManager to properly validate and default invalid complexity
- Update package.json version to 4.1.6 (sync with VERSION file)
## CLI Improvements
- src/superclaude/cli/install_commands.py: Command installation logic
- src/superclaude/cli/main.py: Add 'install' command with --list and --force options
- README.md: Update installation instructions with correct commands
## Breaking Changes
None - all changes are backwards compatible
## Migration Guide
Users should run 'superclaude install' after upgrading to install slash commands
Fixes #466 (indirectly by clarifying installation process)
Refs #419 (plugin system - documentation updated)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 18:21:22 +01:00
|
|
|
"""
|
|
|
|
|
Unit tests for CLI install command
|
|
|
|
|
|
|
|
|
|
Tests the command installation functionality.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from superclaude.cli.install_commands import (
|
|
|
|
|
install_commands,
|
|
|
|
|
list_available_commands,
|
|
|
|
|
list_installed_commands,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestInstallCommands:
|
|
|
|
|
"""Test suite for install commands functionality"""
|
|
|
|
|
|
|
|
|
|
def test_list_available_commands(self):
|
|
|
|
|
"""Test listing available commands"""
|
|
|
|
|
commands = list_available_commands()
|
|
|
|
|
|
|
|
|
|
assert isinstance(commands, list)
|
|
|
|
|
assert len(commands) > 0
|
|
|
|
|
assert "research" in commands
|
|
|
|
|
assert "index-repo" in commands
|
|
|
|
|
|
|
|
|
|
def test_install_commands_to_temp_dir(self, tmp_path):
|
|
|
|
|
"""Test installing commands to a temporary directory"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
|
|
|
|
|
success, message = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
assert success is True
|
|
|
|
|
assert "Installed" in message
|
|
|
|
|
assert target_dir.exists()
|
|
|
|
|
|
|
|
|
|
# Check that command files were copied
|
|
|
|
|
command_files = list(target_dir.glob("*.md"))
|
|
|
|
|
assert len(command_files) > 0
|
|
|
|
|
|
|
|
|
|
# Verify specific commands
|
|
|
|
|
assert (target_dir / "research.md").exists()
|
|
|
|
|
assert (target_dir / "index-repo.md").exists()
|
|
|
|
|
|
|
|
|
|
def test_install_commands_skip_existing(self, tmp_path):
|
|
|
|
|
"""Test that existing commands are skipped without --force"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
|
|
|
|
|
# First install
|
|
|
|
|
success1, message1 = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
assert success1 is True
|
|
|
|
|
|
|
|
|
|
# Second install without force
|
|
|
|
|
success2, message2 = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
assert success2 is True
|
|
|
|
|
assert "Skipped" in message2
|
|
|
|
|
|
|
|
|
|
def test_install_commands_force_reinstall(self, tmp_path):
|
|
|
|
|
"""Test force reinstall of existing commands"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
|
|
|
|
|
# First install
|
|
|
|
|
success1, message1 = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
assert success1 is True
|
|
|
|
|
|
|
|
|
|
# Modify a file
|
|
|
|
|
research_file = target_dir / "research.md"
|
|
|
|
|
research_file.write_text("modified")
|
|
|
|
|
assert research_file.read_text() == "modified"
|
|
|
|
|
|
|
|
|
|
# Force reinstall
|
|
|
|
|
success2, message2 = install_commands(target_path=target_dir, force=True)
|
|
|
|
|
assert success2 is True
|
|
|
|
|
assert "Installed" in message2
|
|
|
|
|
|
|
|
|
|
# Verify file was overwritten
|
|
|
|
|
content = research_file.read_text()
|
|
|
|
|
assert content != "modified"
|
|
|
|
|
assert "research" in content.lower()
|
|
|
|
|
|
|
|
|
|
def test_list_installed_commands(self, tmp_path):
|
|
|
|
|
"""Test listing installed commands"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
|
|
|
|
|
# Before install
|
|
|
|
|
# Note: list_installed_commands checks ~/.claude/commands by default
|
|
|
|
|
# We can't easily test this without mocking, so just verify it returns a list
|
|
|
|
|
installed = list_installed_commands()
|
|
|
|
|
assert isinstance(installed, list)
|
|
|
|
|
|
|
|
|
|
# After install to temp dir
|
|
|
|
|
install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
# Verify files exist
|
|
|
|
|
command_files = list(target_dir.glob("*.md"))
|
|
|
|
|
assert len(command_files) > 0
|
|
|
|
|
|
|
|
|
|
def test_install_commands_creates_target_directory(self, tmp_path):
|
|
|
|
|
"""Test that target directory is created if it doesn't exist"""
|
|
|
|
|
target_dir = tmp_path / "nested" / "commands"
|
|
|
|
|
|
|
|
|
|
assert not target_dir.exists()
|
|
|
|
|
|
|
|
|
|
success, message = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
assert success is True
|
|
|
|
|
assert target_dir.exists()
|
|
|
|
|
|
|
|
|
|
def test_available_commands_format(self):
|
|
|
|
|
"""Test that available commands have expected format"""
|
|
|
|
|
commands = list_available_commands()
|
|
|
|
|
|
|
|
|
|
# Should be list of strings
|
|
|
|
|
assert all(isinstance(cmd, str) for cmd in commands)
|
|
|
|
|
|
|
|
|
|
# Should not include file extensions
|
|
|
|
|
assert all(not cmd.endswith(".md") for cmd in commands)
|
|
|
|
|
|
|
|
|
|
# Should be sorted
|
|
|
|
|
assert commands == sorted(commands)
|
|
|
|
|
|
|
|
|
|
def test_research_command_exists(self, tmp_path):
|
|
|
|
|
"""Test that research command specifically gets installed"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
|
|
|
|
|
install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
research_file = target_dir / "research.md"
|
|
|
|
|
assert research_file.exists()
|
|
|
|
|
|
|
|
|
|
content = research_file.read_text()
|
|
|
|
|
assert "research" in content.lower()
|
|
|
|
|
assert len(content) > 100 # Should have substantial content
|
|
|
|
|
|
|
|
|
|
def test_all_expected_commands_available(self):
|
|
|
|
|
"""Test that all expected commands are available"""
|
|
|
|
|
commands = list_available_commands()
|
|
|
|
|
|
|
|
|
|
expected = ["agent", "index-repo", "recommend", "research"]
|
|
|
|
|
|
|
|
|
|
for expected_cmd in expected:
|
2025-11-12 18:19:45 +01:00
|
|
|
assert expected_cmd in commands, (
|
|
|
|
|
f"Expected command '{expected_cmd}' not found"
|
|
|
|
|
)
|
feat: add comprehensive test suite, CI/CD workflows, and install command
Major improvements to SuperClaude Framework infrastructure and testing:
## New Features
- Add 'superclaude install' command to install slash commands (/research, /index-repo, /agent, /recommend)
- Create comprehensive test suite with 71 tests (70 passing, 1 skipped)
- Add GitHub Actions CI/CD workflows for automated testing
- Add essential documentation files (PLANNING.md, TASK.md, KNOWLEDGE.md)
## Testing
- tests/unit/: 59 tests covering PM Agent components
- test_confidence.py: 13 tests for ConfidenceChecker
- test_self_check.py: 14 tests for SelfCheckProtocol
- test_reflexion.py: 9 tests for ReflexionPattern
- test_token_budget.py: 12 tests for TokenBudgetManager
- test_cli_install.py: 12 tests for install command (NEW)
- tests/integration/: 11 tests for pytest plugin integration
- tests/conftest.py: Shared fixtures for all tests
## CI/CD Workflows
- .github/workflows/test.yml: Comprehensive test matrix
- Tests on Python 3.10, 3.11, 3.12
- Lint and format checks with ruff
- Pytest plugin verification
- SuperClaude doctor health checks
- Coverage reporting with Codecov
- .github/workflows/quick-check.yml: Fast PR validation (~2-3 min)
- .github/workflows/README.md: Workflow documentation
## Documentation
- PLANNING.md: Architecture, design principles, absolute rules
- TASK.md: Current tasks, priorities, backlog
- KNOWLEDGE.md: Accumulated insights, best practices, troubleshooting
## Bug Fixes
- Fix .gitignore contradictions (remove conflicting Claude Code patterns)
- Fix TokenBudgetManager to properly validate and default invalid complexity
- Update package.json version to 4.1.6 (sync with VERSION file)
## CLI Improvements
- src/superclaude/cli/install_commands.py: Command installation logic
- src/superclaude/cli/main.py: Add 'install' command with --list and --force options
- README.md: Update installation instructions with correct commands
## Breaking Changes
None - all changes are backwards compatible
## Migration Guide
Users should run 'superclaude install' after upgrading to install slash commands
Fixes #466 (indirectly by clarifying installation process)
Refs #419 (plugin system - documentation updated)
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 18:21:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestInstallCommandsEdgeCases:
|
|
|
|
|
"""Test edge cases and error handling"""
|
|
|
|
|
|
|
|
|
|
def test_install_to_nonexistent_parent(self, tmp_path):
|
|
|
|
|
"""Test installation to path with nonexistent parent directories"""
|
|
|
|
|
target_dir = tmp_path / "a" / "b" / "c" / "commands"
|
|
|
|
|
|
|
|
|
|
success, message = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
assert success is True
|
|
|
|
|
assert target_dir.exists()
|
|
|
|
|
|
|
|
|
|
def test_empty_target_directory_ok(self, tmp_path):
|
|
|
|
|
"""Test that installation works with empty target directory"""
|
|
|
|
|
target_dir = tmp_path / "commands"
|
|
|
|
|
target_dir.mkdir()
|
|
|
|
|
|
|
|
|
|
success, message = install_commands(target_path=target_dir, force=False)
|
|
|
|
|
|
|
|
|
|
assert success is True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cli_integration():
|
|
|
|
|
"""
|
|
|
|
|
Integration test: verify CLI can import and use install functions
|
|
|
|
|
|
|
|
|
|
This tests that the CLI main.py can successfully import the functions
|
|
|
|
|
"""
|
|
|
|
|
from superclaude.cli.install_commands import (
|
|
|
|
|
list_available_commands,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Should not raise ImportError
|
|
|
|
|
commands = list_available_commands()
|
|
|
|
|
assert len(commands) > 0
|