Files
wild-pc/event-bus/CLAUDE.md
Paul Payne f39a551aad feat: Add new tools and configurations for Castle platform
- 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.
2026-02-20 16:41:19 -08:00

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 prefix EVENT_BUS_
  • src/event_bus/main.py — FastAPI app, endpoints: publish, subscribe, unsubscribe, topics, health
  • src/event_bus/bus.py — Core EventBus class with in-memory subscription table and async HTTP delivery
  • tests/ — pytest with TestClient fixtures

API

  • POST /publish{"topic": "...", "payload": {...}} — fan-out to subscribers
  • POST /subscribe{"topic": "...", "callback_url": "...", "subscriber": "..."} — register webhook
  • POST /unsubscribe{"topic": "...", "callback_url": "..."} — remove subscription
  • GET /topics — list all topics and their subscribers
  • GET /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)