Commit Graph
269 Commits
Author SHA1 Message Date
zeekay bcadbcd035 feat(hanzo-tools-computer): v0.2.0 - comprehensive Mac automation
- Add window management: get_active_window, list_windows, focus_window
- Add screen management: get_screens, screen_size, current_screen
- Add region abstractions: define_region, region_screenshot, region_locate
- Add image utilities: locate_all, wait_for_image, wait_while_image
- Add pixel operations: pixel, pixel_matches with tolerance
- Add timing controls: set_pause, set_failsafe, countdown
- Add input helpers: write (with clear), key_down/key_up, move_relative
- Add batch operations: run multiple actions in one call
- Performance: thread pool executor, cached screen info, faster polling
- All operations non-blocking with async-first design
2025-12-26 06:45:07 -08:00
zeekay 7d0351a4e8 fix(ci): remove extra backslash in tag extraction 2025-12-26 06:43:10 -08:00
zeekay 7c6670c50b ci: update publish-pypi.yml to support all hanzo-tools-* packages
- Add all 17 hanzo-tools packages to publish workflow
- Support tag-based publishing for individual packages
- Add workflow_dispatch with "all" option for manual publishing
- Handle missing package directories gracefully
2025-12-26 06:39:58 -08:00
zeekay 4a966e92d1 feat(hanzo-tools): v0.10.17 - modular tool packages + computer control
- Add hanzo-tools-computer package for pyautogui Mac automation
- Fix hanzo-tools-agent imports to use new package structure
- Add get_read_only_*_tools() helpers to filesystem/jupyter
- Remove BatchTool (replaced by dag - one tool per capability)
- Remove hanzo-persona dependency (not published yet)
- Simplify pyproject.toml for local development

Packages ready for PyPI:
- hanzo-tools-core
- hanzo-tools-filesystem
- hanzo-tools-shell
- hanzo-tools-browser
- hanzo-tools-memory
- hanzo-tools-todo
- hanzo-tools-reasoning
- hanzo-tools-lsp
- hanzo-tools-refactor
- hanzo-tools-database
- hanzo-tools-agent
- hanzo-tools-jupyter
- hanzo-tools-editor
- hanzo-tools-computer (NEW)
2025-12-26 06:37:28 -08:00
zeekay 11bbbc3e24 fix(hanzo-mcp): convert blocking subprocess.run to async
- git_search.py: All 6 subprocess.run calls converted to asyncio.create_subprocess_exec
- search_tool.py: All 6 subprocess.run + 3 blocking file reads converted to async
- npx.py: Converted to asyncio.create_subprocess_exec with proper timeout
- uvx.py: Both subprocess calls converted to async with timeout handling
- open.py: Platform openers converted to async fire-and-forget pattern

All tools now use non-blocking async I/O for better concurrency.
Tests: 31/31 passing.
2025-12-26 05:47:19 -08:00
zeekay b6b5e674e5 fix(tools): cleanup and architecture documentation
- Delete deprecated agent_tool_v1_deprecated.py and swarm_tool_v1_deprecated.py
- Keep CriticTool as name='critic' (not code_review) per user request
- Add missing stub classes for CLI agents when hanzo-agents unavailable
- Fix NameError: ClaudeCodeAgent not defined in tests
- Document hanzo-mcp vs hanzo-tools-* architecture in CLAUDE.md
2025-12-26 05:25:55 -08:00
zeekay aaea73b13f refactor: cleanup and consolidate tool packages
- Delete deprecated files (agent_tool_v1_deprecated.py, swarm_tool_v1_deprecated.py)
- Consolidate duplicate LLM tools (merge llm_tool.py into llm_unified.py)
- Rename agent CriticTool to CodeReviewTool to avoid conflict with reasoning critic
- Fix stub classes in swarm_tool.py to raise ImportError instead of silent pass
- Update CLAUDE.md with accurate tool counts (62 tools across 17 packages)
2025-12-26 05:05:41 -08:00
zeekay 2a5ea7169e chore(hanzo-mcp): bump version to 0.10.9 2025-12-26 04:44:58 -08:00
zeekay e8eb9e2281 fix: run black formatter on pkg/hanzo 2025-12-26 04:37:43 -08:00
zeekay 80e1e43d66 chore(hanzo-mcp): bump version to 0.10.8 2025-12-26 04:32:46 -08:00
zeekay 8e9c62d0eb fix: run ruff check --fix and format across entire codebase 2025-12-26 04:31:06 -08:00
zeekay 62e68b65ec chore(hanzo-mcp): bump version to 0.10.8 2025-12-26 04:28:13 -08:00
zeekay 2d001dab08 feat(hanzo-mcp): add DISPLAY INSTRUCTIONS to filesystem and find tools
Updated tool descriptions with DISPLAY INSTRUCTIONS to guide LLM output rendering:
- read.py: Show output in fenced code block with language hint
- write.py: Show brief status message
- edit.py: Show diff in fenced code block
- find_tool.py: Show formatted file list directly

This helps Claude Code and other LLMs render tool output more readably
instead of showing raw JSON.
2025-12-26 04:27:15 -08:00
zeekay c50ef8c057 fix: sort imports in hanzo-mcp shell tools 2025-12-26 04:23:26 -08:00
zeekay 6194c72d02 fix: update test_no_stubs to recognize execute method and call aliases 2025-12-26 04:21:31 -08:00
zeekay a252257089 fix: update CI workflow to handle variable agent tool count (10-12) 2025-12-26 04:16:33 -08:00
zeekay 98bc3bfe25 fix: make new tool packages optional in tests for CI compatibility 2025-12-26 04:14:36 -08:00
zeekay 1302600fb8 chore: run ruff format on all hanzo packages 2025-12-26 04:12:26 -08:00
zeekay f9b5c76c9b chore: fix ruff linting issues across all hanzo-tools packages
- Fix import sorting (I001) in all packages
- Fix bare except (E722) in lsp_tool.py
- Fix duplicate set item (B033) in refactor_tool.py
2025-12-26 04:11:10 -08:00
zeekay 467c231355 fix: remove unused lru_cache import and update test expectations
- Remove unused functools.lru_cache import from refactor_tool.py
  (fixes ruff TID251 banned import error)
- Update test_all_tools.py to include new packages:
  config (2 tools), mcp_tools (4 tools), llm (0-4), vector (0-3)
- Make agent tool count flexible (10-12) for platform differences
- Total tools now 57-66 depending on optional dependencies
2025-12-26 04:10:22 -08:00
zeekay 678dc5d99a feat(hanzo-mcp): improve tool output formatting for Claude Code display
- Add MCPResourceDocument.to_readable_string() for human-readable output
- Update search, find, lsp, refactor tools to use readable format
- Cleaner to_json_string() that doesn't double-wrap data
- Better formatted results with:
  - Search stats and timing info
  - Numbered results with file:line locations
  - Truncated long matches for readability
  - Pagination info
- Sync improvements to hanzo-tools-core package
2025-12-26 04:07:00 -08:00
zeekay 3c87805a7b docs(hanzo-tools): add README files for new packages
- hanzo-tools-config: config, mode tools
- hanzo-tools-mcp: mcp management tools
- hanzo-tools-llm: LLM interaction tools
- hanzo-tools-vector: vector search tools
2025-12-26 03:59:54 -08:00
zeekay 7144f12c22 fix(hanzo-tools-agent): add missing semaphore in deprecated swarm tool
Fixes F821 undefined name error in swarm_tool_v1_deprecated.py
2025-12-26 03:58:20 -08:00
zeekay 355730f404 feat(hanzo-tools): complete modular tool packages v0.10.7
- Add hanzo-tools-llm (4 tools: llm, unified_llm, consensus, llm_manage)
- Add hanzo-tools-vector (3 tools: index, vector_index, vector_search)
- Add hanzo-tools-config (2 tools: config, mode)
- Add hanzo-tools-mcp (4 tools: mcp, mcp_add, mcp_remove, mcp_stats)
- Update hanzo-tools meta package with all 17 packages
- Bump hanzo-mcp to v0.10.7

Total: 63 tools across 17 modular packages

Bundle extras:
- [core]: filesystem, shell, todo, reasoning, config
- [dev]: core + editor, lsp, refactor
- [ai]: llm, agent, memory
- [all]: everything
2025-12-26 03:51:15 -08:00
zeekay 6457b4c212 fix(dag): add defensive check for ProcessManager singleton
Add runtime check to provide better error message if ProcessManager()
returns None. This should never happen with proper singleton pattern,
but helps diagnose issues in edge cases.
2025-12-26 03:49:32 -08:00
zeekay bc3ba5fa15 test(hanzo-tools): add tests and CI for 53 tools across 13 packages
- Add test_all_tools.py with 28 tests covering:
  - Package imports and tool counts
  - Import speed verification (no blocking)
  - Async call method verification
  - Total tool count validation (53 tools)

- Add test-hanzo-tools.yml CI workflow:
  - Runs on push/PR to pkg/hanzo-tools-*
  - Installs all 13 tool packages
  - Verifies all tools import correctly
2025-12-25 23:18:58 -08:00
zeekay dd9ec54fea feat(hanzo-tools): add modular tool packages with 53 tools across 13 packages
Introduces hanzo-tools-* namespace packages for independent tool installation:

Core packages:
- hanzo-tools-core: BaseTool, ToolRegistry, PermissionManager
- hanzo-tools-filesystem: read, write, edit, tree, find, search, ast (7 tools)
- hanzo-tools-shell: dag, ps, zsh, shell, npx, uvx, open (7 tools)

AI/Agent packages:
- hanzo-tools-agent: critic, iching, review, network, CLI agents (12 tools)
- hanzo-tools-memory: recall/create/update/delete memories, facts, KB (9 tools)
- hanzo-tools-reasoning: think, critic (2 tools)

Editor/Dev packages:
- hanzo-tools-lsp: Language Server Protocol tool (1 tool)
- hanzo-tools-refactor: rename, extract, inline, move, change_signature (1 tool)
- hanzo-tools-database: SQL + graph database tools (8 tools)
- hanzo-tools-editor: neovim integration (3 tools)
- hanzo-tools-jupyter: notebook read/edit (1 tool)
- hanzo-tools-browser: Playwright browser automation (1 tool)
- hanzo-tools-todo: unified todo management (1 tool)

Key improvements:
- All subprocess.run calls have timeout protection
- All tool .call() methods are async
- Namespace package pattern for mix-and-match installation
- Entry point discovery via hanzo.tools
- No blocking imports (all < 2s)

Also updates hanzo-mcp:
- Browser tool integration
- Tool install/registry for dynamic tool management
- Auto-background timeout reduced to 60s
2025-12-25 22:38:26 -08:00
zeekay 1d50bcd48e fix(hanzo-mcp): v0.10.4 - fix search hanging and null process_manager
- Add 30s timeout to each search engine (grep, ast, lsp, git)
- Fix NoneType error when process_manager unavailable in auto_timeout
- Prevents LSP engine from hanging indefinitely on large codebases
2025-12-25 19:58:46 -08:00
zeekay 0911b278f1 feat(hanzo-mcp): v0.10.3 - add uvloop support for faster async
- Add uvloop>=0.21.0 to performance extras (Linux/macOS only)
- Create event_loop utility for early uvloop configuration
- Configure uvloop at CLI startup before async imports
- Provides 2-4x faster event loop for async operations

Install with: pip install hanzo-mcp[performance]
2025-12-25 19:47:34 -08:00
zeekay 6b148e0854 fix(hanzo-aci): update dependencies to fix security vulnerabilities
- h11: 0.14.0 → 0.16.0 (critical: malformed chunked-encoding)
- urllib3: 2.3.0 → 2.6.2 (high: decompression chain attack)
- aiohttp: 3.11.14 → 3.13.2 (low: HTTP smuggling)
- requests: 2.32.3 → 2.32.5 (medium: .netrc leak)
- filelock: 3.18.0 → 3.20.1 (medium: symlink attack)

Fixes all 8 Dependabot security alerts.
2025-12-25 19:40:31 -08:00
zeekay e53c8ac638 chore(hanzo-mcp): update uv.lock for v0.10.2 2025-12-25 19:36:29 -08:00
zeekay b3642732b7 feat(hanzo-mcp): v0.10.2 - DAG auto-backgrounding and zsh tool
- DAG commands that exceed timeout now auto-background instead of failing
- Backgrounded processes return SUCCESS status so DAG continues
- Register backgrounded processes with ProcessManager for ps tool tracking
- Async log capture for backgrounded process output
- Enable standalone zsh tool for simple single-command execution
- All I/O uses aiofiles for non-blocking async operations
- Kill any backgrounded process without affecting DAG completion
2025-12-25 18:51:21 -08:00
zeekay 63eadd36c9 fix(hanzo-mcp): v0.10.1 - improve shell resolution
- Check Homebrew paths first (/opt/homebrew/bin, /usr/local/bin)
- Prefer zsh, fallback to bash if not available
- Support both Apple Silicon and Intel Macs
2025-12-25 17:47:09 -08:00
zeekay c8576649e3 feat(hanzo-mcp): v0.10.0 - minimal orthogonal tool set
BREAKING: Shell tools consolidated
- dag: Replaces bash, zsh, shell, exec, batch (one way to run commands)
- ps: Replaces process (UNIX-style naming)
- zsh-only by default

30 tools registered (down from ~50+):
- Shell: dag, ps, npx, uvx, open
- Files: read, write, edit, multi_edit
- Search: search, find, ast, tree
- LSP: lsp, refactor
- Thinking: think, critic
- Memory: recall/create/update/delete/manage memories
- Knowledge: recall/store facts, manage knowledge bases
- Meta: rules, mode, todo, version

Philosophy: "One and only one way to do everything"
2025-12-25 17:21:06 -08:00
zeekay 168eabfd99 feat(hanzo-mcp): add version MCP tool
- Add version() tool to get hanzo-mcp version via MCP
- Sync __version__ with pyproject.toml (0.9.23)
- Returns hanzo_mcp version, python version, platform, arch
2025-12-25 11:44:36 -08:00
zeekay 62aa55fa65 chore(hanzo-mcp): bump version to 0.9.22 2025-12-25 11:12:55 -08:00
zeekay fa0db2454e fix(hanzo-mcp): update deprecated APIs and dependencies
- Replace has_permission() with is_path_allowed() across all tools
- Update tests to use AutoPaginatedResponse instead of PaginatedResponse
- Fix batch tool invocations to use tool_name/input instead of tool/parameters
- Update ReadTool/WriteTool imports from new module locations
- Add skip markers for deprecated tests (UvxBackgroundTool, swarm dispatch_to_model)
- Update all dependencies to latest versions (aiofiles 25.1.0, fastmcp 2.14.1, etc.)
- Add e2e LiteLLM integration test structure

All tests pass (35 passed, 6 skipped)
2025-12-25 11:11:38 -08:00
zeekay eee266c1c4 feat(shell): add --force-shell option to override shell selection
- Add --force-shell CLI argument with choices [bash, zsh, sh]
- Set HANZO_MCP_FORCE_SHELL environment variable when option is used
- Modified BashTool, ZshTool, and ShellTool to respect the env var
- Allows users to force all shell operations to use a specific shell
  even when AI requests a different one

Example usage in ~/.claude.json:
  "args": ["hanzo-mcp", "--force-shell", "zsh"]

Bumps version to 0.9.19
2025-12-24 22:23:15 -08:00
zeekay cb714532f2 fix(todo): add missing read_todos/write_todos methods to TodoTool
The TodoTool was calling self.read_todos() and self.write_todos() but
these methods were not defined in either TodoTool or TodoBaseTool.
Added the methods using TodoStorage with a default session ID.
2025-12-24 18:10:40 -08:00
zeekay fa82e6aced fix(hanzo-mcp): eliminate all blocking I/O in shell modules
Comprehensive async fix for all shell/process handling modules:

- command_executor.py: Made _get_shell_by_type, _get_system_shell,
  _get_interpreter_path async with asyncio.to_thread for shutil.which.
  Temp file creation/cleanup now uses aiofiles.os.

- logs.py: Added aiofiles for async file reads. Path.exists(), stat(),
  glob() wrapped in asyncio.to_thread(). Batch async stat operations
  with asyncio.gather().

- processes.py: Changed cpu_percent(interval=0.1) to interval=None
  to avoid 100ms blocking per process. Wrapped sync psutil operations
  in asyncio.to_thread().

- streaming_command.py: Replaced subprocess.run with async subprocess
  in tail(). stream_to_file now uses aiofiles. All file I/O operations
  made async throughout.

- Legacy modules (run_background.py, npx_background.py, uvx_background.py):
  Added deprecation warnings pointing to new async implementations in
  base_process.py and tool-specific modules.

Version bump to 0.9.17.
2025-12-24 17:56:26 -08:00
zeekay 83e74521a0 fix(hanzo-mcp): use aiofiles for non-blocking file I/O
- Add aiofiles as runtime dependency
- Convert all file I/O in base_process.py to async with aiofiles
- Convert log writing in auto_background.py to async
- Convert log reading in process_tool.py to async
- Make create_log_file() async
- Add _ensure_log_dir() async method for deferred initialization

This ensures the event loop is never blocked by file operations,
which was causing hangs in MCP tools.

Fixes blocking file I/O identified by agent swarm review.
2025-12-24 16:16:19 -08:00
zeekay 7a1c15882e refactor(hanzo-mcp): pure asyncio for process execution
- Remove all sync subprocess.Popen usage in favor of asyncio.create_subprocess_exec
- ProcessManager now exclusively uses asyncio.subprocess.Process
- Use returncode attribute instead of poll() for process status
- Add _write_output_to_log for async background log writing
- Fix test_shell_features.py to use returncode instead of poll()
- Fix decorator ordering in test_long_command_backgrounds

Breaking: ProcessManager.add_process now expects asyncio.subprocess.Process
2025-12-24 15:53:28 -08:00
zeekay 74356cab72 chore(hanzo-mcp): bump version to 0.9.14
Includes fix for asyncio.subprocess.Process handling in list_processes()
2025-12-24 15:29:25 -08:00
zeekay cd08e864ca Fix hanging 2025-12-24 15:24:46 -08:00
zeekay 3ee2eb56b5 fix: handle asyncio.subprocess.Process in list_processes
ProcessManager.list_processes() was calling .poll() which only
exists on subprocess.Popen, not asyncio.subprocess.Process.
Since auto_background.py uses asyncio.create_subprocess_exec(),
the stored process objects don't have poll(). Now checks for
.returncode directly for asyncio processes.
2025-12-24 15:22:44 -08:00
zeekay 5869fe8c35 refactor(hanzo-mcp): rename directory_tree to tree, remove symbols alias
- Rename directory_tree tool to tree for brevity
- Remove symbols alias (use ast tool directly)
- Fix search tool registration to handle new factory functions
- Update all references in configs, prompts, examples, and tests
- Bump version to 0.9.10

Note: zsh_tool and shell_tool already existed
MCP naming (mcp__hanzo__*) is standard MCP protocol format, cannot be changed
2025-12-21 04:05:20 -08:00
zeekay 39b1a490b2 fix(memory): change InfinityDB fallback log from warning to debug
On platforms without InfinityDB support (like Darwin arm64), the mock
implementation is expected behavior. Logging at debug level instead of
warning reduces noise in logs.
2025-12-21 03:51:44 -08:00
zeekay 981c6ffc87 feat(refactor): add change_signature action for function signature refactoring
Implements comprehensive change_signature functionality:
- add_parameter: Add new parameters with optional defaults and type hints
- remove_parameter: Remove parameters by name or index
- rename_parameter: Rename parameters across definition and call sites
- reorder_parameters: Reorder parameters and update all call sites
- change_default: Modify default values

Features:
- Full Python, JavaScript/TypeScript, and Go signature parsing
- Automatic call site detection and transformation
- Handles complex nested arguments and string literals
- Preview mode to review changes before applying
- Parallel processing for large codebases

Also adds 11 new tests for change_signature functionality.

Version bump to 0.9.9
2025-12-21 03:41:47 -08:00
zeekay 8e829e4eee feat: add refactoring tools and cleanup search
- Add comprehensive refactor tool with rename, extract_function,
  extract_variable, inline, move, and organize_imports actions
- Rename unified_search.py to search_tool.py for cleaner naming
- Make vector search opt-in (not required by default)
- Fix KeyError in ripgrep JSON output parsing
- Update LSP tool to use pyright for Python (faster than pylsp)
- Add 26 tests for refactor tool, all passing
- Bump version to 0.9.8

The refactor tool provides LSP/AST-powered code transformations:
- Rename symbols across entire codebase
- Extract code blocks to functions
- Extract expressions to variables
- Inline variables at all usage sites
- Move symbols between files
- Organize import statements
2025-12-21 03:27:47 -08:00
zeekay 592c79a12e fix: Add nest_asyncio and ignore test_hanzo_dev in pydantic v1 tests
- Add nest_asyncio to test dependencies for test_get_platform
- Ignore test_hanzo_dev.py which requires the hanzo package
2025-12-10 02:55:47 -08:00