opencode-quota icon indicating copy to clipboard operation
opencode-quota copied to clipboard

fix: /quota command ignores percentDisplayMode config

Open XDayonline opened this issue 5 months ago • 2 comments

Bug

The /quota slash command hardcodes % left regardless of the percentDisplayMode config setting.

The sidebar and compact status correctly use formatDisplayedPercentLabel() which respects percentDisplayMode, but /quota does not.

Reproduction

  1. Set percentDisplayMode: "used" in config
  2. Run /quota -> shows XX% left (wrong)
  3. Sidebar shows XX% used (correct)

Root cause

quota-command-format.js:60 hardcodes:

lines.push(`  ${labelCol} ${bar(pct, barWidth)}  ${pct}% left${suffix}`);

Should use formatDisplayedPercentLabel(row.percentRemaining, params.percentDisplayMode) instead, and pass percentDisplayMode from runtime.config through handleQuotaSlashCommand.

Fix

  1. Import formatDisplayedPercentLabel in quota-command-format.js
  2. Replace hardcoded % left with formatDisplayedPercentLabel(row.percentRemaining, params.percentDisplayMode)
  3. Pass percentDisplayMode: runtime.config.percentDisplayMode in plugin.js handleQuotaSlashCommand

Happy to open a PR if helpful.

XDayonline avatar Jun 05 '26 18:06 XDayonline

Thanks for opening this issue.

This issue was automatically closed because it does not match the expected issue template format.

Missing required template sections:

  • A recognized Bug report or Feature request issue template

Please re-open using the Bug report or Feature request issue template.

You can open a new issue here: https://github.com/slkiser/opencode-quota/issues/new/choose

github-actions[bot] avatar Jun 05 '26 18:06 github-actions[bot]

Closing as duplicate of #118 (same issue with correct template).

XDayonline avatar Jun 16 '26 09:06 XDayonline