Skip to content

Add entire activity#999

Merged
Soph merged 16 commits intomainfrom
soph/stats
Apr 23, 2026
Merged

Add entire activity#999
Soph merged 16 commits intomainfrom
soph/stats

Conversation

@Soph
Copy link
Copy Markdown
Collaborator

@Soph Soph commented Apr 21, 2026

https://entire.io/gh/entireio/cli/trails/64d261c6966b

Summary

  • Adds entire activity command — an interactive terminal dashboard showing checkpoint activity, mirroring the entire.io/overview page
  • Fetches data from /api/v1/stats/checkpoints and /api/v1/stats/commits concurrently, with an animated spinner during loading
  • Renders stat cards (throughput, iteration, continuity, streak), a contribution scatter chart, repository bar chart, and scrollable commit list using full terminal width
  • Includes 29 table-driven tests covering all computation and rendering logic

What it looks like

image

Test plan

  • mise run check passes (fmt + lint + test:ci)
  • Resize terminal while TUI is open — layout adapts
  • Pipe output: go run ./cmd/entire activity | head falls back to static non-interactive mode
  • ACCESSIBLE=1 go run ./cmd/entire activity uses static output
  • go run ./cmd/entire activity without login shows friendly error

Note

Medium Risk
Adds a fairly large new CLI surface area (TUI rendering + concurrent API calls) that could affect terminal behavior and error handling, but it is mostly additive and covered by unit tests.

Overview
Adds a new entire activity command that fetches per-user checkpoint and commit activity from the /api/v1/stats/checkpoints and /api/v1/stats/commits endpoints and presents an overview of throughput/iteration/continuity/streak, contribution heatmap, top repos, and recent commits.

The command supports both an interactive Bubble Tea TUI (spinner + resizable/scrollable view using full terminal width) and a non-interactive static renderer for piped output or ACCESSIBLE mode, along with new API response/types, agent normalization, and a comprehensive test suite for the computation/rendering helpers. Also promotes golang.org/x/sync to a direct dependency and makes a small comment tweak in buildSummaryGenerator.

Reviewed by Cursor Bugbot for commit ba45cf0. Configure here.

Soph and others added 8 commits April 21, 2026 17:05
Fetches checkpoint and commit data from /api/v1/stats/* endpoints
and renders a terminal dashboard with:
- Stat cards (throughput, iteration, continuity, streak)
- Agent breakdown with colored percentage bullets
- Repository bar chart with agent-colored segments
- Recent commits grouped by day with diff stats and agent badges

API calls run concurrently via errgroup. Computation logic mirrors
the entire.io frontend (computeStats, computeStreaks, computeRepoData).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 36f80db38d98
29 test cases covering:
- computeContributionStats: throughput, iteration (session_count not
  steps), continuity (max steps), nil field defaults, empty input
- computeStreaks: basic, dedup, invalid timestamps, gap detection
- normalizeAgentString: 19 agent name variations incl. Factory AI Droid
- groupCommitsByDay: sort order, unknown dates forced last
- uniqueCommitAgents: Agents slice, singular Agent fallback, dedup
- renderStatCards, renderCommitList, renderRepoChart: label content,
  singular/plural wording, nil messages, repo count limit
- formatCommitDate: today/yesterday/older/future/invalid
- padOrTruncate: padding, truncation, unicode safety

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 62669b9b3155
- Use full terminal width instead of 80-char cap for bar charts
  and stat cards (adds getFullTerminalWidth separate from the shared
  getTerminalWidth used by other commands)
- Add bubbletea TUI: fixed header (stat cards, agent breakdown, repo
  chart) with scrollable viewport for the full commit list
- Show all commit days in the viewport instead of limiting to 3
- Fall back to static output when piped or ACCESSIBLE=1
- Footer shows scroll controls and percentage

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 5f2dd505ea2a
Move +N / -N, file count, and checkpoint count from a separate
indented line to the right side of the commit line. Pads with
spaces to push stats to the terminal edge, truncating the commit
message if needed to fit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: f0ae68985a99
Renders checkpoint activity as a braille-dot scatter plot with
date on the x-axis and hour-of-day on the y-axis. Bubble size
scales with step count (radius 0/1/2 for small/medium/large).
Each dot colored by dominant agent. Replaces the text-only agent
breakdown with chart + integrated legend.

Uses Unicode braille characters (U+2800-U+28FF) for 2x4 sub-cell
resolution per character, giving ~24-hour vertical resolution
across 6 character rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1d803aa74220
Adds renderDotChart (Option A) using sized Unicode circles
(· • ● ⬤) in 4 hour-bands, colored by agent. This is now
the active chart via renderContributionChart.

The braille chart (Option B) is retained but inactive — swap
the call in renderContributionChart to switch between them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1b9efec1512f
Increase statsLimit from 500 to 1000 to capture more activity
for heavy users. Add repo name as tie-breaker in sort to prevent
nondeterministic ordering when repos have equal checkpoint counts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3543f82ad7ef
Move API fetching into the bubbletea model so the TUI starts
immediately with an animated spinner. Data loads in the background
and the view transitions to the dashboard when ready. Errors
display inline with a quit hint.

The static (piped/accessible) path retains its own fetch-then-render
flow via runStatsStatic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: abc114e83cfa
@Soph Soph requested a review from a team as a code owner April 21, 2026 18:30
Copilot AI review requested due to automatic review settings April 21, 2026 18:30
@Soph Soph changed the title Soph/stats Add entire stats Apr 21, 2026
Replace ANSI 256 approximations with exact hex values from the
entire.io CSS (Tailwind 400-level dark-mode variables). Lipgloss
auto-downgrades to the best match for the terminal's color profile.

claude=#fb923c gemini=#60a5fa amp=#f87171 codex=#818cf8
opencode=#22d3ee copilot=#a78bfa pi=#fbbf24 cursor=#38bdf8
droid=#f472b6 kiro=#c084fc

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 55b23513d6cf
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new entire activity command that fetches checkpoint/commit stats from the Entire API and renders them as either an interactive Bubble Tea dashboard (TTY) or a static text report (non-interactive / accessible mode).

Changes:

  • Introduces activity Cobra subcommand with concurrent API fetching and static/TUI rendering paths.
  • Adds stats domain types plus rendering + computation helpers for cards/charts/commit list.
  • Adds unit tests for stats computations and rendering behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
go.mod Promotes golang.org/x/sync to a direct dependency (for errgroup).
cmd/entire/cli/strategy/manual_commit_condensation.go Minor comment tweak for summary generator nil-safety note.
cmd/entire/cli/stats_types.go Defines API response structs and computed/rendering types for stats.
cmd/entire/cli/stats_cmd.go Implements entire stats command, API fetch, and stats computations.
cmd/entire/cli/stats_tui.go Implements Bubble Tea TUI (spinner + viewport) and TUI styles.
cmd/entire/cli/stats_render.go Implements static rendering: stat cards, contribution chart, repo chart, commit list.
cmd/entire/cli/stats_cmd_test.go Tests stats computations (throughput/iteration/continuity/streaks, grouping, parsing, formatting).
cmd/entire/cli/stats_render_test.go Tests rendering utilities (labels, pluralization, truncation behavior, repo limits, etc.).
cmd/entire/cli/root.go Registers stats command in the root CLI.

Comment thread cmd/entire/cli/stats_render.go Outdated
Comment thread cmd/entire/cli/activity_render.go
Comment thread cmd/entire/cli/stats_tui.go Outdated
Soph and others added 3 commits April 21, 2026 20:36
Switch from solid █ to ▓ (dark shade) for agent bar chart
segments. Gives a textured/dithered look while keeping the
agent colors clearly visible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 46f969b38baf
Entire-Checkpoint: 4399468be4c3
Entire-Checkpoint: e1ee10d24fc6
@Soph Soph changed the title Add entire stats Add entire activity Apr 21, 2026
evisdren
evisdren previously approved these changes Apr 21, 2026
pfleidi
pfleidi previously approved these changes Apr 21, 2026
Copy link
Copy Markdown
Contributor

@pfleidi pfleidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty cool!

gtrrz-victor
gtrrz-victor previously approved these changes Apr 22, 2026
@gtrrz-victor
Copy link
Copy Markdown
Contributor

Merge it! Merge it!!

Soph and others added 4 commits April 22, 2026 17:27
The API now aggregates stats, repo breakdown, and hourly contributions
server-side given an IANA timezone, so the CLI no longer needs to fetch
raw checkpoints and recompute everything. Drops ~290 lines of
client-side compute (stats, streaks, repo rollup, hourly grouping).

Also renames /api/v1/stats/commits to /api/v1/me/commits and swaps the
CONTINUITY stat card (peak session length, derived from per-checkpoint
steps) for ORCHESTRATION (agent step density, returned directly by the
new endpoint). Adds detectTimezone helper (checks TZ env, then
/etc/localtime, falls back to UTC).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1777e243d88a
TZ env var isn't guaranteed to be an IANA zone name. Shell settings like
TZ=:America/New_York, TZ=/usr/share/zoneinfo/America/New_York, and POSIX
forms like TZ=UTC0 would have been forwarded verbatim and made the new
endpoint 400 or mis-bucket the request.

normalizeTimezone strips the POSIX ":" prefix and zoneinfo path prefix,
then checks the result loads via time.LoadLocation so only IANA-valid
names (including legacy aliases like EST5EDT that Go and ICU both
accept) reach the API. Anything else falls through to UTC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 1bed72ec14b9
The previous commit overclaimed: normalizeTimezone does not guarantee
IANA-only output, and detectTimezone does not fall straight to UTC on a
bogus TZ. What it actually does:

- normalizeTimezone accepts anything time.LoadLocation can load, which
  includes legacy aliases (EST5EDT, GMT0, PST8PDT) that Go ships as
  zoneinfo files. These may or may not be canonically understood by
  the server.
- detectTimezone walks $TZ → /etc/localtime → time.Local → "UTC".
  A value that fails normalization is skipped, not coerced to UTC; a
  bogus TZ on a correctly-configured host still yields the system
  timezone from /etc/localtime.

The server is the canonical authority and falls back to UTC for zones
it doesn't recognize, so this mild mis-bucketing risk is accepted.

Updates doc comments and test commentary to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: c1e27901075e
The backend added two fields to /api/v1/me/activity:

- `stats.lifetime_streak` / `stats.lifetime_current_streak`: streaks
  over the last 365 days, independent of the `timeframe` param.
- `stats.continuity_hours`: peak session length (the metric previously
  dropped in favor of orchestration).

Switches the CLI to read those fields so the stat cards match what the
web dashboard shows: STREAK is now lifetime-scoped (so it stops
drifting down with short timeframes), and the third card reverts from
ORCHESTRATION back to CONTINUITY. The timeframe-scoped `streak` and
`orchestration` fields stay available on the response struct for
future use.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 39cc3312d096
@Soph Soph dismissed stale reviews from gtrrz-victor, pfleidi, and evisdren via 078dc26 April 22, 2026 19:57
@Soph Soph merged commit 5e5bd1f into main Apr 23, 2026
9 checks passed
@Soph Soph deleted the soph/stats branch April 23, 2026 11:43
gtrrz-victor added a commit that referenced this pull request Apr 23, 2026
main is currently broken — PR #999 (`Add entire activity`) merged with
an unresolved reference to `isTerminalWriter` in activity_cmd.go, which
doesn't exist in the cli package. The sibling call sites
(status_style.go, search_cmd.go, explain.go) correctly use the exported
interactive.IsTerminalWriter helper. Apply the same qualification here.

Entire-Checkpoint: 4cb94a44f29b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants