Skip to content

Commit a8d5b8a

Browse files
committed
✨ feat: update README and clean up code formatting
✨ feat: update README and clean up code formatting 📄 Documentation: - Updated the README to reflect the new author @Arakiss. - Improved documentation clarity and formatting. 🔧 Code Improvement: - Consistent use of double quotes for string literals. - Formatted import statements for better readability. - Added new lines for better code separation in several functions. These changes enhance documentation accuracy and improve code readability and consistency.
1 parent 50e795b commit a8d5b8a

File tree

9 files changed

+278
-238
lines changed

9 files changed

+278
-238
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
156156

157157
---
158158

159-
<p align="center">Crafted with 🧵 by <a href="https://github.com/yourusername">@yourusername</a></p>
159+
<p align="center">Crafted with 🧵 by <a href="https://github.com/Arakiss">@Arakiss</a></p>

commitloom/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import os
77

88
# Load environment variables before any imports
9-
env_path = Path(__file__).parent.parent / '.env'
9+
env_path = Path(__file__).parent.parent / ".env"
1010
load_dotenv(dotenv_path=env_path)
1111

1212
from .cli.main import main
1313

14-
if __name__ == '__main__':
15-
main()
14+
if __name__ == "__main__":
15+
main()

commitloom/cli/console.py

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
from rich.panel import Panel
55
from rich.prompt import Confirm, Prompt
66
from rich.text import Text
7-
from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TaskProgressColumn
7+
from rich.progress import (
8+
Progress,
9+
SpinnerColumn,
10+
TextColumn,
11+
BarColumn,
12+
TaskProgressColumn,
13+
)
814
from typing import List, Optional
915

1016
from ..core.analyzer import CommitAnalysis, WarningLevel
@@ -14,6 +20,7 @@
1420

1521
console = Console()
1622

23+
1724
def create_progress() -> Progress:
1825
"""Create a progress bar with custom styling."""
1926
return Progress(
@@ -24,12 +31,16 @@ def create_progress() -> Progress:
2431
console=console,
2532
)
2633

34+
2735
def print_changed_files(files: List[GitFile]) -> None:
2836
"""Print list of changed files."""
29-
console.print("\n[bold blue]📜 Changes detected in the following files:[/bold blue]")
37+
console.print(
38+
"\n[bold blue]📜 Changes detected in the following files:[/bold blue]"
39+
)
3040
for file in files:
3141
console.print(f" - [cyan]{file.path}[/cyan]")
3242

43+
3344
def print_warnings(analysis: CommitAnalysis) -> None:
3445
"""Print analysis warnings."""
3546
if not analysis.warnings:
@@ -45,16 +56,23 @@ def print_warnings(analysis: CommitAnalysis) -> None:
4556
console.print(f" • Estimated cost: €{analysis.estimated_cost:.4f}")
4657
console.print(f" • Files changed: {analysis.num_files}")
4758

59+
4860
def print_batch_start(batch_num: int, total_batches: int, files: List[GitFile]) -> None:
4961
"""Print information about starting a new batch."""
50-
console.print(f"\n[bold blue]📦 Processing Batch {batch_num}/{total_batches}[/bold blue]")
62+
console.print(
63+
f"\n[bold blue]📦 Processing Batch {batch_num}/{total_batches}[/bold blue]"
64+
)
5165
console.print("[cyan]Files in this batch:[/cyan]")
5266
for file in files:
5367
console.print(f" - [dim]{file.path}[/dim]")
5468

69+
5570
def print_batch_complete(batch_num: int, total_batches: int) -> None:
5671
"""Print completion message for a batch."""
57-
console.print(f"\n[bold green]✅ Batch {batch_num}/{total_batches} completed successfully[/bold green]")
72+
console.print(
73+
f"\n[bold green]✅ Batch {batch_num}/{total_batches} completed successfully[/bold green]"
74+
)
75+
5876

5977
def print_batch_summary(total_files: int, total_batches: int) -> None:
6078
"""Print summary of batch processing plan."""
@@ -63,12 +81,14 @@ def print_batch_summary(total_files: int, total_batches: int) -> None:
6381
console.print(f" • Number of batches: [cyan]{total_batches}[/cyan]")
6482
console.print(f" • Files per batch: [cyan]~{total_files // total_batches}[/cyan]")
6583

84+
6685
def format_cost(cost: float) -> str:
6786
"""Format cost in both human-readable and precise formats."""
6887
human_cost = CommitAnalyzer.format_cost_for_humans(cost)
6988
precise_cost = f"(€{cost:.8f})"
7089
return f"{human_cost} {precise_cost}"
7190

91+
7292
def print_token_usage(usage: TokenUsage, batch_num: Optional[int] = None) -> None:
7393
"""Print token usage summary."""
7494
batch_info = f" (Batch {batch_num})" if batch_num is not None else ""
@@ -86,45 +106,54 @@ def print_token_usage(usage: TokenUsage, batch_num: Optional[int] = None) -> Non
86106
"""
87107
)
88108

109+
89110
def print_commit_message(message: str) -> None:
90111
"""Print formatted commit message."""
91112
console.print(Panel(Text(message), expand=False, border_style="green"))
92113

114+
93115
def print_batch_info(batch_number: int, files: List[str]) -> None:
94116
"""Print information about a batch of files."""
95117
console.print(f"\n[bold blue]📑 Batch {batch_number} Summary:[/bold blue]")
96118
for file in files:
97119
console.print(f" - [cyan]{file}[/cyan]")
98120

121+
99122
def confirm_action(prompt: str) -> bool:
100123
"""Ask user to confirm an action."""
101124
return Confirm.ask(f"\n{prompt}")
102125

126+
103127
def confirm_batch_continue() -> bool:
104128
"""Ask user if they want to continue with next batch."""
105129
return Confirm.ask("\n[bold yellow]🤔 Continue with next batch?[/bold yellow]")
106130

131+
107132
def select_commit_strategy() -> str:
108133
"""Ask user how they want to handle multiple commits."""
109-
console.print("\n[bold blue]🤔 How would you like to handle the commits?[/bold blue]")
134+
console.print(
135+
"\n[bold blue]🤔 How would you like to handle the commits?[/bold blue]"
136+
)
110137
return Prompt.ask(
111-
"Choose strategy",
112-
choices=["individual", "combined"],
113-
default="individual"
138+
"Choose strategy", choices=["individual", "combined"], default="individual"
114139
)
115140

141+
116142
def print_success(message: str) -> None:
117143
"""Print success message."""
118144
console.print(f"\n[bold green]✅ {message}[/bold green]")
119145

146+
120147
def print_error(message: str) -> None:
121148
"""Print error message."""
122149
console.print(f"\n[bold red]❌ {message}[/bold red]")
123150

151+
124152
def print_info(message: str) -> None:
125153
"""Print info message."""
126154
console.print(f"\n[bold blue]ℹ️ {message}[/bold blue]")
127155

156+
128157
def print_warning(message: str) -> None:
129158
"""Print warning message."""
130159
console.print(f"\n[bold yellow]⚠️ {message}[/bold yellow]")

0 commit comments

Comments
 (0)