Execute the usage command.
(self, **kwargs)
| 46 | return [] |
| 47 | |
| 48 | async def execute(self, **kwargs) -> CommandResult: |
| 49 | """Execute the usage command.""" |
| 50 | chat_context = kwargs.get("chat_context") |
| 51 | if not chat_context: |
| 52 | return CommandResult(success=False, error="No chat context available.") |
| 53 | |
| 54 | tracker = getattr(chat_context, "token_tracker", None) |
| 55 | if tracker is None or tracker.turn_count == 0: |
| 56 | output.info("No token usage recorded yet.") |
| 57 | return CommandResult(success=True, output="No usage data.") |
| 58 | |
| 59 | # Format summary |
| 60 | summary = tracker.format_summary() |
| 61 | output.panel(summary, title="Token Usage") |
| 62 | |
| 63 | return CommandResult(success=True, output=summary) |
nothing calls this directly
no test coverage detected