[PR #3] [CLOSED] feat: add output formatter module with smart content detection #80

Closed
opened 2026-02-27 10:22:08 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/3
Author: @mikeyobrien
Created: 12/13/2025
Status: Closed

Base: mainHead: feat/output-formatters


📝 Commits (10+)

  • 9f48831 chore: clean up development artifacts for GA release
  • c20e4d5 docs: mark GA cleanup task complete with validation
  • 94f96f0 docs: final verification of GA release cleanup
  • 905be96 feat: add SecurityValidator system for input validation and path sanitization
  • bfe3c73 feat: add thread-safe configuration with ConfigValidator
  • 38fb0bd feat: add advanced async logging with rotation and security masking
  • f3e59c8 feat: implement graceful signal handling with subprocess-first cleanup
  • bf94f5f feat: add error formatter with user-friendly suggestions
  • b54b7df feat: add VerboseLogger with session metrics and Rich integration
  • 6a82c1d feat: add memory-efficient IterationStats for per-iteration tracking

📊 Changes

40 files changed (+11677 additions, -800 deletions)

View changed files

📝 .gitignore (+2 -0)
CLAUDE_TOOLS_UPDATE.md (+0 -141)
📝 PROMPT.md (+285 -118)
mkdocs-simple.yml (+0 -66)
📝 pyproject.toml (+2 -0)
ralph-orchestrator/docs/api/orchestrator.md (+0 -0)
📝 src/ralph_orchestrator/__init__.py (+16 -2)
📝 src/ralph_orchestrator/__main__.py (+137 -103)
📝 src/ralph_orchestrator/adapters/claude.py (+156 -24)
src/ralph_orchestrator/async_logger.py (+458 -0)
📝 src/ralph_orchestrator/context.py (+42 -12)
src/ralph_orchestrator/error_formatter.py (+235 -0)
📝 src/ralph_orchestrator/main.py (+337 -16)
📝 src/ralph_orchestrator/metrics.py (+173 -2)
📝 src/ralph_orchestrator/orchestrator.py (+146 -31)
src/ralph_orchestrator/output/__init__.py (+121 -0)
src/ralph_orchestrator/output/base.py (+393 -0)
src/ralph_orchestrator/output/console.py (+907 -0)
src/ralph_orchestrator/output/content_detector.py (+247 -0)
src/ralph_orchestrator/output/json_formatter.py (+417 -0)

...and 20 more files

📄 Description

Summary

  • Add comprehensive output formatter module for Claude adapter responses
  • Implement smart content detection for diffs, code blocks, markdown, and tracebacks
  • Support multiple output formats: Rich terminal, plain text, and JSON
  • Add verbosity levels (QUIET, NORMAL, VERBOSE, DEBUG)

New Components

ContentDetector

Detects content types for intelligent rendering:

  • DIFF - Git diff format with @@ markers
  • CODE_BLOCK - Fenced code blocks with syntax highlighting
  • MARKDOWN - Headings, lists, emphasis, tables
  • ERROR_TRACEBACK - Python exception tracebacks

Output Formatters

  • RichTerminalFormatter - Colors, panels, syntax highlighting (default)
  • PlainTextFormatter - Plain text for non-terminal environments
  • JsonFormatter - Structured JSON for programmatic consumption

Smart Detection

RichTerminalFormatter now auto-detects content and renders appropriately:

  • Diffs → Color-coded additions/deletions via DiffFormatter
  • Code blocks → Syntax highlighted with line numbers
  • Markdown → Rich formatting with heading/list support
  • Tracebacks → Python syntax highlighting

Test plan

  • All 158 output formatter tests pass
  • ContentDetector tests cover all content types
  • Smart detection integration tests verify rendering
  • Backward compatibility maintained

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mikeyobrien/ralph-orchestrator/pull/3 **Author:** [@mikeyobrien](https://github.com/mikeyobrien) **Created:** 12/13/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/output-formatters` --- ### 📝 Commits (10+) - [`9f48831`](https://github.com/mikeyobrien/ralph-orchestrator/commit/9f4883192fb8e060fce0c221b62421c2c06ce6d5) chore: clean up development artifacts for GA release - [`c20e4d5`](https://github.com/mikeyobrien/ralph-orchestrator/commit/c20e4d5062dfa1d9eeabb4ef5a47a0c860428d6e) docs: mark GA cleanup task complete with validation - [`94f96f0`](https://github.com/mikeyobrien/ralph-orchestrator/commit/94f96f055e75daef740291011273cfb42212382d) docs: final verification of GA release cleanup - [`905be96`](https://github.com/mikeyobrien/ralph-orchestrator/commit/905be96530ca25d62d71fadb64794075f036e90e) feat: add SecurityValidator system for input validation and path sanitization - [`bfe3c73`](https://github.com/mikeyobrien/ralph-orchestrator/commit/bfe3c73bb23324d71ad895ed731b29cd34a01f1e) feat: add thread-safe configuration with ConfigValidator - [`38fb0bd`](https://github.com/mikeyobrien/ralph-orchestrator/commit/38fb0bd5482a0325528e32d11055964b1214576c) feat: add advanced async logging with rotation and security masking - [`f3e59c8`](https://github.com/mikeyobrien/ralph-orchestrator/commit/f3e59c8db863cb809cbcaf6a90552f1efb784fef) feat: implement graceful signal handling with subprocess-first cleanup - [`bf94f5f`](https://github.com/mikeyobrien/ralph-orchestrator/commit/bf94f5f9b4b1ece110fa50ad2c4556a237f64b0b) feat: add error formatter with user-friendly suggestions - [`b54b7df`](https://github.com/mikeyobrien/ralph-orchestrator/commit/b54b7df9736d9b248053c1e93e7272e83fc46f3c) feat: add VerboseLogger with session metrics and Rich integration - [`6a82c1d`](https://github.com/mikeyobrien/ralph-orchestrator/commit/6a82c1d3e34256a156d70f2375fbd009decbc559) feat: add memory-efficient IterationStats for per-iteration tracking ### 📊 Changes **40 files changed** (+11677 additions, -800 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) ➖ `CLAUDE_TOOLS_UPDATE.md` (+0 -141) 📝 `PROMPT.md` (+285 -118) ➖ `mkdocs-simple.yml` (+0 -66) 📝 `pyproject.toml` (+2 -0) ➖ `ralph-orchestrator/docs/api/orchestrator.md` (+0 -0) 📝 `src/ralph_orchestrator/__init__.py` (+16 -2) 📝 `src/ralph_orchestrator/__main__.py` (+137 -103) 📝 `src/ralph_orchestrator/adapters/claude.py` (+156 -24) ➕ `src/ralph_orchestrator/async_logger.py` (+458 -0) 📝 `src/ralph_orchestrator/context.py` (+42 -12) ➕ `src/ralph_orchestrator/error_formatter.py` (+235 -0) 📝 `src/ralph_orchestrator/main.py` (+337 -16) 📝 `src/ralph_orchestrator/metrics.py` (+173 -2) 📝 `src/ralph_orchestrator/orchestrator.py` (+146 -31) ➕ `src/ralph_orchestrator/output/__init__.py` (+121 -0) ➕ `src/ralph_orchestrator/output/base.py` (+393 -0) ➕ `src/ralph_orchestrator/output/console.py` (+907 -0) ➕ `src/ralph_orchestrator/output/content_detector.py` (+247 -0) ➕ `src/ralph_orchestrator/output/json_formatter.py` (+417 -0) _...and 20 more files_ </details> ### 📄 Description ## Summary - Add comprehensive output formatter module for Claude adapter responses - Implement smart content detection for diffs, code blocks, markdown, and tracebacks - Support multiple output formats: Rich terminal, plain text, and JSON - Add verbosity levels (QUIET, NORMAL, VERBOSE, DEBUG) ## New Components ### ContentDetector Detects content types for intelligent rendering: - `DIFF` - Git diff format with `@@` markers - `CODE_BLOCK` - Fenced code blocks with syntax highlighting - `MARKDOWN` - Headings, lists, emphasis, tables - `ERROR_TRACEBACK` - Python exception tracebacks ### Output Formatters - `RichTerminalFormatter` - Colors, panels, syntax highlighting (default) - `PlainTextFormatter` - Plain text for non-terminal environments - `JsonFormatter` - Structured JSON for programmatic consumption ### Smart Detection `RichTerminalFormatter` now auto-detects content and renders appropriately: - Diffs → Color-coded additions/deletions via `DiffFormatter` - Code blocks → Syntax highlighted with line numbers - Markdown → Rich formatting with heading/list support - Tracebacks → Python syntax highlighting ## Test plan - [x] All 158 output formatter tests pass - [x] ContentDetector tests cover all content types - [x] Smart detection integration tests verify rendering - [x] Backward compatibility maintained 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 10:22:08 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#80
No description provided.