feat: enable ui tool in hanzo-mcp with local-first component reading #122
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Hanzo Tools | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'pkg/hanzo-tools-*/**' | |
| - '.github/workflows/test-hanzo-tools.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'pkg/hanzo-tools-*/**' | |
| - '.github/workflows/test-hanzo-tools.yml' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: hanzo-build-linux-amd64 | |
| timeout-minutes: 10 | |
| strategy: | |
| matrix: | |
| python-version: ['3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install hanzo-tools packages | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| # Install base shim first (provides hanzo_tools.core.unified) | |
| uv pip install -e pkg/hanzo-tools | |
| uv pip install -e pkg/hanzo-tools-core | |
| # Install all tool packages | |
| uv pip install -e pkg/hanzo-tools-fs | |
| uv pip install -e pkg/hanzo-tools-shell | |
| uv pip install -e pkg/hanzo-tools-browser | |
| uv pip install -e pkg/hanzo-tools-memory | |
| uv pip install -e pkg/hanzo-tools-todo | |
| uv pip install -e pkg/hanzo-tools-reasoning | |
| uv pip install -e pkg/hanzo-tools-lsp | |
| uv pip install -e pkg/hanzo-tools-refactor | |
| uv pip install -e pkg/hanzo-tools-database | |
| uv pip install -e pkg/hanzo-tools-agent | |
| uv pip install -e pkg/hanzo-tools-jupyter | |
| uv pip install -e pkg/hanzo-tools-editor | |
| uv pip install -e pkg/hanzo-tools-config | |
| uv pip install -e pkg/hanzo-tools-computer | |
| uv pip install pytest pytest-asyncio | |
| - name: Run tests | |
| run: | | |
| source .venv/bin/activate | |
| python -m pytest pkg/hanzo-tools-core/tests/test_all_tools.py -v --tb=short | |
| - name: Verify tool counts | |
| run: | | |
| source .venv/bin/activate | |
| python -c " | |
| # Packages with exact expected counts | |
| exact_packages = [ | |
| ('hanzo_tools.fs', 1), # unified fs tool | |
| ('hanzo_tools.browser', 1), | |
| ('hanzo_tools.memory', 1), # unified memory tool with actions | |
| ('hanzo_tools.todo', 1), | |
| ('hanzo_tools.reasoning', 2), # think, critic | |
| ('hanzo_tools.lsp', 1), | |
| ('hanzo_tools.refactor', 1), | |
| ('hanzo_tools.database', 9), | |
| ('hanzo_tools.jupyter', 1), | |
| ('hanzo_tools.editor', 3), | |
| ('hanzo_tools.agent', 3), # agent, zen, review | |
| ] | |
| # Shell tool count depends on detected shell, but core tools are fixed. | |
| shell_required = {'ps', 'npx', 'uvx', 'open', 'curl', 'jq', 'wget'} | |
| total = 0 | |
| import importlib | |
| # Check exact packages | |
| for pkg_name, expected in exact_packages: | |
| pkg = importlib.import_module(pkg_name) | |
| tools = getattr(pkg, 'TOOLS', []) | |
| actual = len(tools) | |
| status = '✓' if actual == expected else '✗' | |
| print(f'{status} {pkg_name}: {actual}/{expected} tools') | |
| assert actual == expected, f'{pkg_name}: expected {expected}, got {actual}' | |
| total += actual | |
| # Check shell package (detected-shell mode) | |
| shell_pkg = importlib.import_module('hanzo_tools.shell') | |
| shell_tools = getattr(shell_pkg, 'TOOLS', []) | |
| shell_names = {t.name for t in shell_tools} | |
| print(f'✓ hanzo_tools.shell: {len(shell_tools)} tools (detected-shell mode)') | |
| assert len(shell_tools) >= 8, f'hanzo_tools.shell: expected >=8, got {len(shell_tools)}' | |
| assert shell_required.issubset(shell_names), ( | |
| f'hanzo_tools.shell: missing required tools: {shell_required - shell_names}' | |
| ) | |
| total += len(shell_tools) | |
| print(f'\\nTotal: {total} tools') | |
| # Minimum total: exact packages (23) + shell minimum (8) = 31 | |
| assert total >= 31, f'Expected at least 31 tools, got {total}' | |
| print('✓ All tool packages verified') | |
| " |