feat(compaction): add a metric selector for composable sub-values#457
Open
zachthedev wants to merge 1 commit into
Open
feat(compaction): add a metric selector for composable sub-values#457zachthedev wants to merge 1 commit into
zachthedev wants to merge 1 commit into
Conversation
compaction-counter only emitted the full composite line. A new `metric` metadata selector (count|auto|manual|unknown|reclaimed) makes one instance emit a single raw value, so several can be composed with custom separators/symbols, following the existing skills `mode` / context-bar `display` metadata-mode precedent. Default `count` keeps the composite display unchanged; sub-metrics render a bare number (reclaimed via formatTokens) and respect hideZero on the selected value. Closes sirmalloc#450 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #450
compaction-counteronly emitted the full composite line (↻ N (a auto, b manual) ↓X). This adds ametricselector so a single instance can emit one raw value:count(default): unchanged composite display.auto/manual/unknown: that trigger's count as a bare integer.reclaimed: reclaimed tokens viaformatTokens.Several instances then compose with custom-symbol separators/glyphs into a custom layout instead of the built-in format, e.g.
2 · 1a 1m · ↓2M. This follows the existing metadata-mode precedent (skillsmode,context-bardisplay) rather than adding separate widget types, which keeps the niche per-trigger values out of the widget picker. Cycled with(m)in the editor; in metric mode the format/glyph/trigger binds collapse to metric + hide-zero, andhideZeroapplies to the selected value (so a0 autowidget can hide). Default behavior is unchanged (backward compatible).Coordination with #430 (unified hideable states): both PRs touch this widget's hide-zero handling, so whichever lands second needs a small reconciliation. This PR adds per-metric hide-zero via the current
hideZeroflag; #430 migrates that flag to the unified hideable system. If #430 merges first, the metric hide-zero here should move to itsisHidden()API; if this merges first, #430'sCompactionCounterconversion should cover the newmetricmode and its per-metric hide-zero. (Cleanly hiding a zero sub-value without orphaning its separator ultimately depends on #430.)Tests: added metric render/preview/hide-zero/editor/keybind/cycle cases and updated the count-mode keybind assertions for the new
(m)bind.bun run lintclean;bun testgreen (1563/1563).