Files
zeekay e9a4d37d1f feat: C FFI + Go cgo bindings for Rust MCP tools, fix TS conformance
Rust FFI (rust/src/ffi.rs):
- Expose all 13 HIP-0300 tools via C-compatible API
- 7 extern "C" functions: init, call_tool, list_tools, last_error,
  free_string, destroy, version
- Persistent multi-threaded tokio runtime behind opaque handle
- panic::catch_unwind on all FFI boundaries
- Wire 5 missing tools (code, git, fetch, workspace, tasks, hanzo)
  into ToolRegistry::execute() match arms
- Build as cdylib + staticlib (libhanzo_mcp.a / .dylib)

Go bindings (go/hanzomcp/):
- Handle type with Init/CallTool/CallToolRaw/ListTools/Close
- JSON in, JSON out across cgo boundary
- runtime.SetFinalizer safety net
- 11 tests including 20-goroutine concurrent stress test
- Race detector clean

TypeScript fixes:
- tasks: handle stale todos.json with wrong schema (todos vs items)
- code: add symbols + summarize actions for Python parity
- fetch: add fetch + head actions for Python parity

Results: Rust 66/66 tests, Go 11/11 tests, TS 22/22 conformance
2026-03-11 11:37:15 -07:00

28 lines
614 B
Makefile

RUST_DIR := ../rust
LIB_DIR := $(RUST_DIR)/target/release
.PHONY: all build-rust test clean
all: build-rust test
## Build the Rust static + shared library (release mode)
build-rust:
cd $(RUST_DIR) && cargo build --release
## Run Go tests (requires build-rust first)
test: build-rust
CGO_ENABLED=1 go test -v ./hanzomcp/...
## Run Go tests with race detector
test-race: build-rust
CGO_ENABLED=1 go test -race -v ./hanzomcp/...
## Quick benchmark
bench: build-rust
CGO_ENABLED=1 go test -bench=. -benchtime=3s ./hanzomcp/...
## Clean build artifacts
clean:
cd $(RUST_DIR) && cargo clean
go clean -cache