refactor(usage): consolidate duplicate formatProviderName into shared helper#3316
refactor(usage): consolidate duplicate formatProviderName into shared helper#3316oldschoola wants to merge 2 commits into
Conversation
… helper The formatProviderName function (title-casing a provider id like 'opencode-go' → 'Opencode Go') was duplicated identically across three files: - command-controller.ts (TUI rendering path) - usage-cli.ts (CLI rendering path) - usage-report.ts (ACP rendering path) Moved the single implementation to the shared format.ts helper (already home to formatDuration and renderAsciiBar), and updated all three call sites to import from there.
317723a to
8241790
Compare
roboomp
left a comment
There was a problem hiding this comment.
P1: scoped refactor is mechanically sound and typechecks; the only merge touch I found is repo convention coverage.
Finding: missing packages/coding-agent/CHANGELOG.md ## [Unreleased] entry for the usage-rendering change.
Verification: bun run check:types passed in packages/coding-agent; bun test test/usage-cli.test.ts is blocked in this checkout by missing src/export/html/tool-views.generated.js.
Thanks for the tidy dedupe.
| import { theme as currentTheme, type Theme } from "../../modes/theme/theme"; | ||
|
|
||
| /** Title-case a provider id for display (e.g. "opencode-go" → "Opencode Go"). */ | ||
| export function formatProviderName(provider: string): string { |
There was a problem hiding this comment.
should-fix: this touches packages/coding-agent user-facing usage rendering, but the PR does not add an ## [Unreleased] entry in packages/coding-agent/CHANGELOG.md. Repo convention requires a changelog entry for each touched package before merge.
|
Added the missing CHANGELOG entry in the latest push. |
…rName consolidation
Problem
The
formatProviderNamefunction (title-casing a provider id likeopencode-go→Opencode Go) was duplicated identically across three rendering paths:command-controller.ts(TUI)usage-cli.ts(CLI)usage-report.ts(ACP)Changes
slash-commands/helpers/format.ts(already home toformatDurationandrenderAsciiBar)Tests
bun checkpasses