# Changelog

## [Unreleased]

### Changed
- One definition per shared decision: `resolveSeparator`/`styleSeparator` replace the separator expression and the four-glyph dim list that were spelled out in `status.ts` (twice) and `footer.ts`; `resolveActivePreset` replaces two independent custom-preset resolutions, so a style can no longer render differently in the footer and in a badge.
- The `/beautify` picker and its command description are generated from `VALID_STYLES` plus one blurb table, so a preset cannot be valid yet missing from the menu. `stream` / `glow` / `minimal` now follow the table order.
- `SIGNED_UNIT_PATTERN` and `DELTA_METRIC_PATTERN` were byte-identical; the two bracket-count patterns merged, and the duplicated success branch in state inference is now the `else` it always was.

### Fixed
- Sub-1k savings metrics are recognized: Toolflow emits `~850 saved` and `~0 saved` without a unit, and the savings pattern required one, so a fresh install rendered `⌬ (0)` and a staged badge silently dropped the metric.
- Writing `settings.json` can no longer delete it: when the target was locked, the writer unlinked it before a second rename that could also fail. The fallback now overwrites in place, so a failed write leaves the previous file untouched.
- The config test suite no longer escapes its sandbox: `settingsPaths()` prefers `PI_CODING_AGENT_DIR`/`PI_CONFIG_DIR` over `HOME`, and the specs only overrode `HOME`, so global writes could land in the developer's real `~/.pi/agent/settings.json`. Both variables are now cleared per test.

### Added
- `sliceToVisualWidth` no longer returns a slice wider than its budget: emoji presentation (FE0F) and keycap sequences now charge the same cells `getStringWidth` measures, so footer budgets hold.
- Line 1 stays inside the terminal at 5 columns; the 6-cell model floor is clamped to the space actually available.
- `[1/3] Implementing` style stages (and `▲ Paused`) count as high priority, so an in-progress Toolflow stage is no longer folded under `(+N idle)`.
- Custom style config from disk is sanitized at the render choke point: `separator: 12` used to throw and reset every badge to raw text, and a one-element `brackets` array rendered an unclosed glyph. Inverse pills honor the configured separator.
- Width decisions no longer use UTF-16 `.length` as a proxy, and ANSI is stripped before the 512-unit cap (a bisected escape used to leak `38;5` style parameters into the metric).
- `sanitizeCustomConfig` clamps by code point, so a clamped string can no longer end on a lone surrogate.
- README/AGENTS default claims match the shipped `claude` + `fullFooter: true` defaults, and release tooling stages `extensions/` wholesale instead of a hand-copied entry file that could not load.
- Unit test suite expanded to 81 tests passing (100% green).

## [1.9.1] - 2026-11-14

### Fixed
- A badge that carries both stage progress and a savings metric (`[2/3] Implementing · ~1.4k saved`) no longer loses the progress figure: the detail slot now composes `2/3 · ~1.4k saved` instead of showing savings alone. Values without a fraction render unchanged.
- Guard and cache-hit counters (`2 guarded`, `3 hits`) no longer need to be in the vocabulary for the badge to survive compaction; the savings metric already anchors it.

### Added
- Unit test suite expanded to 69 tests passing (100% green).

## [1.9.0] - 2026-11-14

### Changed
- Default visual preset changed from `minimal` to `claude` (Anthropic serene minimal dots with warm high-signal dot markers).
- `fullFooter` is now enabled by default (`true`), offering out-of-the-box 3-tier badge compaction, Git branch, and token telemetry formatting without manual configuration.
- `/beautify <style>` single-argument invocation now switches the visual preset immediately while preserving the active scope, eliminating modal interruption. Scope can still be explicitly targeted via `/beautify <style> full` or `/beautify <style> status`.

### Added
- Enhanced ecosystem status metric recognition for ToolFlow token savings (`~1.4k saved`) and guard active states.
- Comprehensive unit test suite expanded to 68 tests passing (100% green).

## [1.8.0] - 2026-10-18

### Changed
- Split the single 1064-line extension file into `extensions/lib/**` (presets, width, fold, settings, status, footer, state, command). The entry file keeps its name and re-exports the public surface, so `pi.extensions` and existing imports are unchanged.
- Retired three byte-identical presets: `matrix` (same as `tokyo`), `powerline` and `glass` (both same as `nord`). Old names still resolve through aliases, so existing `settings.json` files keep working.
- `minimal` is now selectable from the `/beautify` menu (it was already the config default but was missing from the list).
- Token totals in full-footer mode are memoised on the session entry array instead of rescanned on every repaint.

### Fixed
- **Style changes now take effect immediately.** `/beautify` used to write the new style and then call `loadConfig()`, which reassigned the same module globals from disk — silently reverting the user's choice until the next restart, and rendering an empty first frame when enabling full-footer.
- `off` now deletes the `beautifier` key from **both** the local and global settings file. Previously it only touched the local file when that file existed, so a global block could survive the revert.
- Revert no longer reports success after a swallowed write failure; it reports a warning with the failing path.
- Badge folding can no longer exceed the terminal width: the fold slot is reserved for the *remaining* badges, the `<= 2 badges` early return is gone, and the width sweep 8..120 columns is covered by tests.
- Dingbats and geometric shapes (`✓ ✗ ✦ ▲ ◆ ● ❯`) are measured as one cell instead of two. Emoji presentation (`❤️`), keycaps (`1️⃣`) and ZWJ sequences are measured correctly.
- The spinner no longer defeats the dirty check for non-spinning badges: only spinner-bearing badges bypass the value comparison.

### Added
- `tsconfig.json` with `strict`, plus `npm run typecheck` and `npm run check`.
- 22 new tests covering config hierarchy purity, apply/revert, zero-trace cleanup, fold boundaries and cell width.

## [1.1.1] - 2026-08-23
### Added
- Memory-hoisted visual cell-width checks of character sequences to correctly align TUI status templates (Finding 5)
- State cache-based dirty-checking for status updates to prevent redundant redrawing and layout flickering (Finding 6)
### Fixed
- Fixed TUI alignment issues involving full-width CJK characters and emojis in layout paddings

