Files
coucou/scripts/test-plan-gauge.sh
LouisandClaude Sonnet 4.6 ad44a2f550 Claude plan usage in the notch: 5-hour and weekly limits (#159)
* Add Claude plan gauge pill with statusline relay and settings UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix claude-plan-gauge review: safe preview, live pill color, githubOnly, validation

- Preview writes nothing; all file I/O deferred to confirm (fixes cancel-uninstall data loss)
- Reinstall preserves existing statusLine padding/refreshInterval (only command swapped)
- Pill label and color computed live from claudePlanUsage at render; removed tasks mutation in didSet
- integration_claude_plan is githubOnly: true (App Store has no installer)
- Install checks xcode-select -p and shows clear error if CLTools missing
- nb-hook.py: invalid stdin returns early in normal mode; --statusline continues regardless
- Validation: clamp pct 100-200 to 100 (not rejected); reject pct > 200; reject resets_at > 400 days
- Card: TimelineView every 30s; DateFormatter created once with en_US_POSIX locale
- Settings Plan usage: shows Installed/Not installed state and only the relevant button
- Diff shows only the statusLine key (before/after), not full settings.json
- settings.json written with .withoutEscapingSlashes
- 27/27 tests pass

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: mark Claude plan gauge as GitHub build only

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Redesign Claude plan gauge: header pill and Settings toggle, not a catalog pill

- Remove integration_claude_plan from PillCatalog; it was never shipped
- Add "Show in the notch" toggle in Settings → Agents → Plan usage; enabling
  it auto-triggers relay install if not yet installed; cancelling reverts toggle
- Small capsule pill in IslandHeader (home view, GitHub build): colored dot +
  "Claude 73%" label, active look while plan detail is open
- Tap pill: ClaudePlanCardView replaces left card; showingPlanDetail resets on
  focusId/view/mode change; big Mochi takes plan usage color while open
- Card tweaks: fixed 50pt bar, arrow.clockwise icon, compact reset labels
  ("in 1 h 20" / "Mon 9:00"), subtitle "just now / N min ago / N h ago",
  no truncation; TimelineView every 30s
- App Store build unaffected (all new UI is #if !APPSTORE)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Polish plan gauge: reset label, label width, cached relay state

- Weekly reset label: "Mon 9:00" without "Resets" prefix (icon suffices)
- Label column widened to 40pt so "5 hours" never truncates
- Cache relay-installed state in AppState.planRelayInstalled; set at launch,
  refreshed on Settings open and after every Install/Uninstall confirm;
  IslandHeader reads state.planRelayInstalled instead of calling
  HookServer.statusLineInstalled() on each render
- Uninstall confirm sets showPlanInNotch = false

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-03 02:13:38 +02:00

9 lines
312 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-plan-gauge.XXXXXX")"
trap 'rm -rf "$TEST_DIR"' EXIT
swiftc NotchBuddy/Sources/App/ClaudePlanGauge.swift \
tests/ClaudePlanGaugeTests.swift -o "$TEST_DIR/plan-gauge-tests"
"$TEST_DIR/plan-gauge-tests"