Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,9 @@ need Go or Codexometer's source dependencies.
## Versioning

Codexometer follows semantic versioning; the current source version is
`v0.7.6`. The Git tag is the release source of truth. Go automatically embeds
`v0.7.7`. The Git tag is the release source of truth. Go automatically embeds
that tag in binaries built with
`go install github.com/merefield/codexometer@v0.7.6`; direct source builds fall
`go install github.com/merefield/codexometer@v0.7.7`; direct source builds fall
back to the maintained value in `internal/version/version.go`.

Both forms report the embedded version and exit without starting the interface:
Expand All @@ -1039,7 +1039,7 @@ codexometer --version
Release automation can override the source-build fallback without editing code:

```sh
go build -ldflags="-s -w -X github.com/merefield/codexometer/internal/version.Fallback=0.7.6" .
go build -ldflags="-s -w -X github.com/merefield/codexometer/internal/version.Fallback=0.7.7" .
```

## How refresh works
Expand Down
6 changes: 5 additions & 1 deletion internal/ui/meters.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func renderMeterArea(width, height int, meter codex.Meter, view meterViewID, col
reset := "RESET DATA UNAVAILABLE"
if meter.Window.ResetsAt != nil {
at := time.Unix(*meter.Window.ResetsAt, 0)
reset = fmt.Sprintf("RESET T-%s // %s", countdown(at), at.Local().Format("MON 15:04:05"))
reset = fmt.Sprintf("RESET T-%s // %s", countdown(at), formatResetDeadline(at))
if lipgloss.Width(reset) > innerWidth {
reset = fmt.Sprintf("RESET T-%s", countdown(at))
}
Expand Down Expand Up @@ -212,6 +212,10 @@ func renderMeterArea(width, height int, meter codex.Meter, view meterViewID, col
return frameSized(width, frameHeight, title, body, color, colors)
}

func formatResetDeadline(at time.Time) string {
return strings.ToUpper(at.Local().Format("Mon 15:04:05"))
}

func meterDetailLines(details string) []string {
if strings.TrimSpace(details) == "" {
return nil
Expand Down
17 changes: 17 additions & 0 deletions internal/ui/meters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ func TestEveryViewIncludesResetCycleGauge(t *testing.T) {
}
}

func TestResetDeadlineUsesActualLocalWeekday(t *testing.T) {
reset := time.Date(2026, time.August, 13, 9, 36, 35, 0, time.Local)
if got := formatResetDeadline(reset); got != "THU 09:36:35" {
t.Fatalf("reset deadline = %q, want THU 09:36:35", got)
}
duration := int64((7 * 24 * time.Hour) / time.Minute)
meter := codex.Meter{
Bucket: "codex",
Name: "1 WEEK",
Window: codex.Window{WindowDurationMins: &duration, ResetsAt: ptr(reset.Unix())},
}
output := ansi.Strip(renderMeterArea(100, 18, meter, viewBars, paletteFor(themeHacker)))
if !strings.Contains(output, "// THU 09:36:35") {
t.Fatalf("rendered reset deadline did not contain its actual weekday:\n%s", output)
}
}

func TestResetGaugeUsesSameActiveColorAsMeter(t *testing.T) {
colors := paletteFor(themeHacker)
duration := int64(60)
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// checkout. Release automation may override it with:
//
// -X github.com/merefield/codexometer/internal/version.Fallback=1.2.3
var Fallback = "0.7.6"
var Fallback = "0.7.7"

// Current returns the module version embedded by Go for tagged installs, or
// Fallback for ordinary source builds. The leading tag prefix is omitted so
Expand Down
4 changes: 2 additions & 2 deletions internal/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "testing"

func TestCurrentReportsMaintainedFallbackForSourceBuild(t *testing.T) {
got := Current()
if got != "0.7.6" {
t.Fatalf("Current() = %q, want 0.7.6", got)
if got != "0.7.7" {
t.Fatalf("Current() = %q, want 0.7.7", got)
}
}

Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestRunVersion(t *testing.T) {
for _, flag := range []string{"-v", "--version"} {
var stdout, stderr bytes.Buffer
code := run([]string{flag}, &stdout, &stderr, dependencies{})
if code != 0 || stdout.String() != "codexometer v0.7.6\n" || stderr.Len() != 0 {
if code != 0 || stdout.String() != "codexometer v0.7.7\n" || stderr.Len() != 0 {
t.Errorf("flag=%s code=%d stdout=%q stderr=%q", flag, code, stdout.String(), stderr.String())
}
}
Expand Down
Loading