forgejo-mcp-broker/.beads
Ole-Morten Duesund bd68d7ed06 feat(bridge): JSON-RPC pipe + SSE writer (forgejo-mcp-broker-am1)
Adds internal/bridge: connects HTTP-side MCP clients to a stdio-side
child via JSON-RPC framing. Decoupled from internal/supervisor — takes
io.Writer + *bufio.Reader + done channel directly so it tests cleanly
with io.Pipe pairs and could later wrap something other than a child
process.

Routing model: one reader goroutine consumes child stdout line-by-line.
Each line is parsed only enough to extract the JSON-RPC `id` field
(string/number/null kept as raw JSON, so `1` and `"1"` don't collide).
HTTP requests register a per-id waiter channel before forwarding their
body to the child; the reader delivers the response to whichever waiter
matches. Concurrent in-flight requests are safe; a duplicate id while
the first is still pending returns 409.

HandleSSE response shapes:
  - request with id + child reply → 200 text/event-stream, one
    `event: message` SSE event carrying the JSON-RPC response
  - request without id (notification) → 204 No Content (no waiter
    needed; MCP notifications are fire-and-forget)
  - empty body → 400
  - duplicate in-flight id → 409
  - send-to-child fails → 502
  - client disconnect mid-wait → bridge cleans up its waiter; child
    keeps running, other in-flight requests unaffected
  - child exits before reply → SSE `error` event with reason=child_exited

Tests cover all of the above plus stale unsolicited replies, malformed
lines from the child, and reader robustness across both. 90.0%
coverage. The remaining gap is splitLines' empty-data branch (only
reachable if the child sends a literal `\n` line).

Closes forgejo-mcp-broker-am1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 13:59:28 +02:00
..
hooks bd init: initialize beads issue tracking 2026-04-24 16:34:50 +02:00
.gitignore bd init: initialize beads issue tracking 2026-04-24 16:34:50 +02:00
config.yaml bd init: initialize beads issue tracking 2026-04-24 16:34:50 +02:00
issues.jsonl feat(bridge): JSON-RPC pipe + SSE writer (forgejo-mcp-broker-am1) 2026-04-27 13:59:28 +02:00
metadata.json bd init: initialize beads issue tracking 2026-04-24 16:34:50 +02:00
README.md bd init: initialize beads issue tracking 2026-04-24 16:34:50 +02:00

Beads - AI-Native Issue Tracking

Welcome to Beads! This repository uses Beads for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.

What is Beads?

Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.

Learn more: github.com/steveyegge/beads

Quick Start

Essential Commands

# Create new issues
bd create "Add user authentication"

# View all issues
bd list

# View issue details
bd show <issue-id>

# Update issue status
bd update <issue-id> --claim
bd update <issue-id> --status done

# Sync with Dolt remote
bd dolt push

Working with Issues

Issues in Beads are:

  • Git-native: Stored in Dolt database with version control and branching
  • AI-friendly: CLI-first design works perfectly with AI coding agents
  • Branch-aware: Issues can follow your branch workflow
  • Always in sync: Auto-syncs with your commits

Why Beads?

AI-Native Design

  • Built specifically for AI-assisted development workflows
  • CLI-first interface works seamlessly with AI coding agents
  • No context switching to web UIs

🚀 Developer Focused

  • Issues live in your repo, right next to your code
  • Works offline, syncs when you push
  • Fast, lightweight, and stays out of your way

🔧 Git Integration

  • Automatic sync with git commits
  • Branch-aware issue tracking
  • Dolt-native three-way merge resolution

Get Started with Beads

Try Beads in your own projects:

# Install Beads
curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash

# Initialize in your repo
bd init

# Create your first issue
bd create "Try out Beads"

Learn More


Beads: Issue tracking that moves at the speed of thought