Files
zeekayandHanzo Dev d3110e47ea Major refactor: Unified tools, palette system, dev mode, and shell improvements (v0.6.0)
🎨 **Tool Palette System**
- Created palette system for organizing development tools by ecosystem
- Pre-defined palettes: Python (Guido), Ruby (Matz), JavaScript, Go, Rust, DevOps, Full Stack, Minimal
- `palette` tool to list, activate, and manage tool sets
- Environment variables applied from active palette
- Keeps MCP interface clean while supporting specialized workflows

🔧 **Unified Process Tools with OO Design**
- Refactored all process execution to use clean base class hierarchy
- `BaseProcessTool`, `BaseBinaryTool`, `BaseScriptTool` for consistent interface
- Unified `bash`, `npx`, `uvx` tools with action-based approach (run/background)
- `process` tool for managing background processes
- All tools use same execution pipeline internally

🐚 **Smart Shell Detection**
- Shell tool now detects user's preferred shell from $SHELL environment
- Automatically uses zsh if .zshrc exists (perfect for your setup\!)
- Falls back to bash if no special configuration found
- All zsh aliases, functions, and configurations now available in MCP

🚀 **Development Mode with Hot Reload**
- Added `--dev` flag to hanzo-mcp CLI for development mode
- File watching with automatic reload detection using watchdog
- `hanzo-mcp-dev` command for dedicated dev server
- Watches Python files and config changes
- Debounced reloading to prevent spam

🛠️ **New Tools Added**
- `open`: Opens files/URLs in default application (platform-aware)
- `watch`: Monitors files/directories for changes with pattern matching
- `diff`: Compares files with unified/context diff formats
- `config`: Git-style configuration management

📚 **Documentation & Infrastructure**
- Comprehensive Sphinx documentation with black theme
- Automated deployment to mcp.hanzo.ai via Cloudflare Pages
- GitHub Actions workflow for docs deployment
- 25+ documentation pages organized by category

⚙️ **Configuration Improvements**
- Tool enable/disable system with palette override
- Per-project vs global indexing configuration
- Environment variable management through palettes
- Clean separation of concerns in tool registration

This release provides a much cleaner, more extensible architecture while
maintaining backward compatibility. The palette system makes it easy to
switch between development environments, and the unified process tools
eliminate code duplication while providing consistent behavior.

Co-authored-by: Hanzo Dev <[email protected]>
2025-06-26 17:59:24 -04:00
..
2025-04-12 20:24:06 -05:00
2025-05-09 22:29:55 -05:00

Filesystem Tool Tests

This directory contains tests for the filesystem tools in the Hanzo MCP project.

Test Files

  • test_fs_tools.py: Tests for the refactored filesystem tools
  • test_file_operations.py: Tests for various file operations
  • test_write_file.py: Comprehensive tests for the write file tool

Write File Tool Testing

The test_write_file.py file contains comprehensive tests for the write file tool, including:

Success Cases

  • Writing files with standard content
  • Creating nested directories
  • Writing files with Unicode content
  • Overwriting existing files
  • Writing large files

Error Cases

  • Missing path parameter
  • Empty path parameter
  • Missing content parameter
  • Path not allowed
  • Parent directory not allowed
  • Write permission issues
  • Encoding errors
  • I/O errors

Running Tests

To run all filesystem tests:

make test TEST_DIR=tests/test_filesystem

To run a specific test file:

make test TEST_DIR=tests/test_filesystem/test_write_file.py

Adding New Tests

When adding new tests for filesystem tools, follow these guidelines:

  1. Use appropriate fixtures for setup and teardown
  2. Mock external dependencies and tool context
  3. Test both success and error paths
  4. Verify file content and filesystem state after operations
  5. Clean up temporary files after tests
  6. Add tests for various edge cases (permissions, encoding, large files, etc.)

Error Handling

The write_file tool has been enhanced with improved error handling:

  1. Error categorization: Different types of errors are caught and handled appropriately
  2. Detailed error messages: Error messages include specific information about what went wrong
  3. Logging: All errors are logged with appropriate severity levels
  4. Error propagation: Errors are properly returned to the client

Debug Logging

To enable debug logging during tests:

make test TEST_DIR=tests/test_filesystem LOG_LEVEL=DEBUG

This will provide detailed logs of the test execution, including input parameters, error conditions, and results.