- Introduced `uv.lock` for dependency management with various packages including `pytest`, `colorama`, and `pluggy`. - Added `pyrightconfig.json` for Python type checking configuration. - Expanded `recommendations.md` with detailed scaling recommendations and project management strategies. - Created shared `ruff.toml` for consistent linting across projects. - Developed `Castle Tools` with various utilities including Android backup, browser automation, document conversion, and search tools. - Implemented `backup-collect` and `schedule` tools for system administration tasks. - Enhanced `search` functionality with indexing and querying capabilities using Tantivy. - Added comprehensive documentation for each tool, including usage examples and installation instructions.
1.6 KiB
1.6 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
event-bus is a castle-component — a lightweight inter-service event bus for HTTP fan-out. Services publish typed events to topics, other services subscribe with webhook callback URLs. No persistence, no guaranteed delivery — just simple HTTP POST fan-out.
Commands
uv sync # Install dependencies
uv run event-bus # Run service (port 9010)
uv run pytest tests/ -v # Run tests
uv run ruff check . # Lint
uv run ruff format . # Format
Architecture
src/event_bus/config.py— Settings via pydantic-settings, env prefixEVENT_BUS_src/event_bus/main.py— FastAPI app, endpoints: publish, subscribe, unsubscribe, topics, healthsrc/event_bus/bus.py— Core EventBus class with in-memory subscription table and async HTTP deliverytests/— pytest with TestClient fixtures
API
POST /publish—{"topic": "...", "payload": {...}}— fan-out to subscribersPOST /subscribe—{"topic": "...", "callback_url": "...", "subscriber": "..."}— register webhookPOST /unsubscribe—{"topic": "...", "callback_url": "..."}— remove subscriptionGET /topics— list all topics and their subscribersGET /health— health check
Configuration
Environment variables with EVENT_BUS_ prefix:
EVENT_BUS_DATA_DIR— Data directory (default: ./data)EVENT_BUS_HOST— Bind host (default: 0.0.0.0)EVENT_BUS_PORT— Port (default: 9010)