Skip to content

[plan] Replace raw fmt.Fprintf verbose debug output with console.LogVerbose in pkg/cli/token_usage.go #39232

@github-actions

Description

@github-actions

Objective

Replace all raw fmt.Fprintf(os.Stderr, ...) verbose debug calls inside if verbose { ... } blocks in pkg/cli/token_usage.go with console.LogVerbose() so they use consistent styled output.

Context

This issue was identified in discussion #39209 (Terminal Stylist analysis). The verbose debug messages are already correctly gated behind a verbose bool parameter, but they use plain fmt.Fprintf instead of console.LogVerbose() which both gates the output AND applies console.FormatVerboseMessage() styling.

Current Problem

// ❌ Current — raw fmt.Fprintf inside verbose check
if verbose {
    ...
    fmt.Fprintf(os.Stderr, "  Found token usage file: %s (%d bytes)\n", filepath.Base(filePath), fileInfo.Size())
}
if verbose {
    ...
    fmt.Fprintf(os.Stderr, "  Found agent usage file: %s (%d bytes)\n", filepath.Base(agentUsagePath), fileInfo.Size())
}
if verbose {
    fmt.Fprintf(os.Stderr, "  Found usage JSONL files: %s\n", strings.Join(usageJSONLFiles, ", "))
}

Approach

  1. Open pkg/cli/token_usage.go.
  2. Find all if verbose { fmt.Fprintf(os.Stderr, ...) } blocks in analyzeTokenUsage, analyzeTokenUsageAICOnly, and any other functions.
  3. Replace each if verbose { fmt.Fprintf(os.Stderr, "...", args...) } block with console.LogVerbose(verbose, fmt.Sprintf("...", args...)) — this eliminates the explicit if verbose check since LogVerbose handles it internally.
  4. Verify that console is already imported; add it if missing.
  5. Run make fmt and make agent-report-progress before committing.

Files to Modify

  • pkg/cli/token_usage.go

Acceptance Criteria

  • All verbose debug fmt.Fprintf(os.Stderr, ...) calls replaced with console.LogVerbose(verbose, fmt.Sprintf(...))
  • No standalone if verbose { fmt.Fprintf(...) } blocks remain in the file
  • console package is imported
  • Existing tests pass (make agent-report-progress)
  • make fmt passes

Generated by 📋 Plan Command · 151.7 AIC · ⌖ 34.4 AIC · ⊞ 16.1K ·
Comment /plan to run again

  • expires on Jun 16, 2026, 7:11 AM UTC-08:00

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions