1
0

refactor: apply Single Responsibility Principle to Program.cs and ReplLoop.cs

extracted responsibilities from Program.cs (208→46 lines) and ReplLoop.cs (274→174 lines) into focused service classes: HeaderRenderer, SessionManager, ApplicationStartup, ResponseStreamer, SpinnerService, UsageDisplayer, and ContextCompactionService. Each class now has a single, well-defined responsibility, improving testability and maintainability.
This commit is contained in:
2026-03-11 16:59:06 +01:00
parent ccfa7e1b9d
commit 1e943e6566
10 changed files with 791 additions and 408 deletions

View File

@@ -5,12 +5,22 @@ namespace AnchorCli.OpenRouter;
/// </summary>
internal sealed class TokenTracker
{
private readonly ChatSession _session;
private ChatSession _session;
public TokenTracker(ChatSession session)
{
_session = session;
}
/// <summary>
/// Gets or sets the session. Allows setting the session after construction
/// to support dependency injection patterns.
/// </summary>
public ChatSession Session
{
get => _session;
set => _session = value;
}
public string Provider { get; set; } = "Unknown";
public long SessionInputTokens => _session.SessionInputTokens;