Skip to content

Commit bd042f0

Browse files
authored
Merge pull request #285 from Opencode-DCP/feat/context-ui-cleanup
refactor: simplify context command UI
2 parents 31cc864 + 0fb9680 commit bd042f0

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

lib/commands/context.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ function formatContextMessage(breakdown: TokenBreakdown): string {
170170
breakdown.assistant,
171171
breakdown.reasoning,
172172
breakdown.tools,
173-
breakdown.pruned,
174173
]
175174
const maxValue = Math.max(...values)
176175

@@ -179,8 +178,7 @@ function formatContextMessage(breakdown: TokenBreakdown): string {
179178
{ label: "User", value: breakdown.user, char: "▓" },
180179
{ label: "Assistant", value: breakdown.assistant, char: "▒" },
181180
{ label: "Reasoning", value: breakdown.reasoning, char: "░" },
182-
{ label: "Tools", value: breakdown.tools, char: "▓" },
183-
{ label: "Pruned", value: breakdown.pruned, char: "⣿", isSaved: true },
181+
{ label: "Tools", value: breakdown.tools, char: "⣿" },
184182
] as const
185183

186184
lines.push("╭───────────────────────────────────────────────────────────╮")
@@ -193,19 +191,10 @@ function formatContextMessage(breakdown: TokenBreakdown): string {
193191

194192
for (const cat of categories) {
195193
const bar = createBar(cat.value, maxValue, barWidth, cat.char)
196-
197-
let labelWithPct: string
198-
let valueStr: string
199-
if ("isSaved" in cat && cat.isSaved) {
200-
labelWithPct = cat.label.padEnd(17)
201-
valueStr = `${formatTokenCount(cat.value).replace(" tokens", "").padStart(6)} saved`
202-
} else {
203-
const percentage =
204-
breakdown.total > 0 ? ((cat.value / breakdown.total) * 100).toFixed(1) : "0.0"
205-
labelWithPct = `${cat.label.padEnd(9)} ${percentage.padStart(5)}% `
206-
valueStr = formatTokenCount(cat.value).padStart(13)
207-
}
208-
194+
const percentage =
195+
breakdown.total > 0 ? ((cat.value / breakdown.total) * 100).toFixed(1) : "0.0"
196+
const labelWithPct = `${cat.label.padEnd(9)} ${percentage.padStart(5)}% `
197+
const valueStr = formatTokenCount(cat.value).padStart(13)
209198
lines.push(`${labelWithPct}${bar.padEnd(barWidth)}${valueStr}`)
210199
}
211200

0 commit comments

Comments
 (0)