From 5029106bddb22eb52f0c7aff1b174067fc98ba3f Mon Sep 17 00:00:00 2001 From: AI Christianson Date: Thu, 19 Dec 2024 15:05:00 -0500 Subject: [PATCH] Use Rich padding. --- ra_aid/console/formatting.py | 6 +++--- ra_aid/tools/memory.py | 6 +++--- ra_aid/tools/research.py | 16 +++++++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ra_aid/console/formatting.py b/ra_aid/console/formatting.py index 656c634..274bb31 100644 --- a/ra_aid/console/formatting.py +++ b/ra_aid/console/formatting.py @@ -2,6 +2,7 @@ from rich.console import Console from rich.rule import Rule from rich.panel import Panel from rich.markdown import Markdown +from rich.padding import Padding console = Console() @@ -32,9 +33,8 @@ def print_stage_header(stage: str) -> None: # Create styled rule with icon rule_content = f"{icon} {stage_title}" - console.print() - console.print(Rule(rule_content, style="green bold")) - console.print() + padded_rule = Padding(Rule(rule_content, style="green bold"), (1, 0)) + console.print(padded_rule) def print_task_header(task: str) -> None: """Print a task header with yellow styling and wrench emoji. Content is rendered as Markdown. diff --git a/ra_aid/tools/memory.py b/ra_aid/tools/memory.py index 5b678d0..81fea2d 100644 --- a/ra_aid/tools/memory.py +++ b/ra_aid/tools/memory.py @@ -3,6 +3,7 @@ from rich.console import Console from rich.markdown import Markdown from rich.panel import Panel from rich.rule import Rule +from rich.padding import Padding from langchain_core.tools import tool class SnippetInfo(TypedDict): @@ -184,9 +185,8 @@ def request_implementation() -> str: Empty string """ _global_memory['implementation_requested'] = True - console.print() - console.print(Rule("🚀 Implementation Requested", style="yellow")) - console.print() + padded_rule = Padding(Rule("🚀 Implementation Requested", style="yellow"), (1, 0)) + console.print(padded_rule) return "" diff --git a/ra_aid/tools/research.py b/ra_aid/tools/research.py index 783e8fb..c754f95 100644 --- a/ra_aid/tools/research.py +++ b/ra_aid/tools/research.py @@ -1,6 +1,7 @@ from langchain_core.tools import tool from rich.console import Console from rich.rule import Rule +from rich.padding import Padding console = Console() @@ -9,9 +10,8 @@ def existing_project_detected() -> dict: """ When to call: Once you have confirmed that the current working directory contains project files. """ - print() - console.print(Rule("📁 Existing Project Detected", style="bright_blue")) - print() + padded_rule = Padding(Rule("📁 Existing Project Detected", style="bright_blue"), (1, 0)) + console.print(padded_rule) return { 'hint': ( "You are working within an existing codebase that already has established patterns and standards. " @@ -30,9 +30,8 @@ def monorepo_detected() -> dict: """ When to call: After identifying that multiple packages or modules exist within a single repository. """ - print() - console.print(Rule("📦 Monorepo Detected", style="bright_blue")) - print() + padded_rule = Padding(Rule("📦 Monorepo Detected", style="bright_blue"), (1, 0)) + console.print(padded_rule) return { 'hint': ( "You are researching in a monorepo environment that manages multiple packages or services under one roof. " @@ -54,9 +53,8 @@ def ui_detected() -> dict: """ When to call: After detecting that the project contains a user interface layer or front-end component. """ - print() - console.print(Rule("🎯 UI Detected", style="bright_blue")) - print() + padded_rule = Padding(Rule("🎯 UI Detected", style="bright_blue"), (1, 0)) + console.print(padded_rule) return { 'hint': ( "You are working with a user interface component where established UI conventions, styles, and frameworks are likely in place. "