Skip to content

[feature] sp stats — fun store metrics #32

Description

@rwrife

Pitch

Backlog item #11. A little personality + genuinely useful hygiene insight. sp stats prints fun/useful metrics about the store: how much rot you've avoided, your oldest survivor, your reaping mortality rate.

Behavior

sp stats reports:

  • Live scratch count and total bytes.
  • Morgue count and bytes (recoverable), plus grace-window status.
  • Oldest living scratch ("oldest survivor") and its age.
  • Total scratches ever created, total ever reaped/hard-deleted (if tracked; otherwise derive from what's available and label estimates honestly).
  • Bytes "saved from rotting in /tmp" — total bytes that passed through the store.
  • Tag breakdown (top N tags by count).
  • Pinned count (if #pin lands first; otherwise skip gracefully).

Support --json for scripting, consistent with ls --json / doctor --json.

Acceptance criteria

  • sp stats command registered on root.
  • Computes metrics purely from the index + store on disk (no new persistent counters unless trivially added atomically).
  • Human-readable output with tombstone/personality flavor; --json machine output mirrors it.
  • Handles empty store gracefully (no scratches → friendly zero-state, not a crash).
  • Unit tests covering: empty store, mixed live/morgue, oldest-survivor selection, tag breakdown.
  • README updated with a sp stats example.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature / backlog item

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions