Skip to content

[M4] ASCII art + render: stage/health frames, caption, color path - #14

Merged
rwrife merged 1 commit into
mainfrom
issue-4-ascii-render
Jul 3, 2026
Merged

rwrife merged 1 commit into
mainfrom
issue-4-ascii-render

Conversation

@rwrife

@rwrife rwrife commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Closes #4

Implements M4 — ASCII art + render. internal/render now turns a plant.PlantState into a full framed plant, and the root command renders the live plant for your repo instead of the M1 static seedling.

What changed

  • render.Frame(PlantState, Options) — the real render. Picks ASCII art by (stage × health) and appends a caption block: stage, streak, last commit (phrased as today / yesterday / N days ago), a days-until-wilt nudge when thirsty/wilting, and the plant's mood line.
  • Art stored as data — a map[Stage]map[Health]string table, upright for healthy and progressively drooping for thirsty → wilting, so condition is visible, not just captioned. Easy to add/edit frames.
  • Color via lipgloss — foliage color by health (green / yellow / red, magenta bloom accent) with a faint caption. Options.Color gates it.
  • Pipe-safe plain path — the plain-ASCII path is used automatically for --no-color, the NO_COLOR env var, and any non-TTY stdout (piped/redirected). cmd/root.go decides via go-isatty; lipgloss's own profile detection is a second safety net. Plain output is guaranteed escape-free (tested).
  • render.PromptGlyph — compact one-line glyph stage primitive for M6 prompt mode.
  • Root command wiredcommit-sprout now runs gitstat.Read → plant.Compute → render.Frame. Handles not-a-repo and no-commits gracefully. Added --no-color; kept the hidden --activity debug bridge.
  • Seedling() retained for backward compat (it's the healthy Seed frame; M1 stability test still guards it).

State note

M5 (persistence) isn't wired yet, so a zero plant.State is passed for now — the memory floor behaves correctly from a fresh state, and M5 will load the remembered highest stage/streak at this seam.

Tests

Snapshot-style, plain-text (deterministic via pinned Now/LastCommit):

  • every (stage × health) frame exists and is non-blank
  • art is distinct across all stages and across all health states per stage (the M4 "done when")
  • plain frame contains no ANSI; color path renders without panic
  • exact snapshots for healthy-leafy and wilting-tall (art + caption + wilt hint)
  • no-commit caption, thirsty countdown wording, streak pluralization, single-line prompt glyph

Verification (Go 1.23.4, matching CI)

  • gofmt -l . clean · go vet ./... clean · go build ./... ok · go test ./... -count=1 ok
  • Manual smoke: piped / --no-color / NO_COLOR=1 all plain; forced-TTY emits ANSI; --activity still works.

Also refreshed README step 4 with an "Implemented — M4" note mirroring the M2/M3 annotations.

@rwrife rwrife mentioned this pull request Jul 2, 2026
6 tasks
@rwrife
rwrife merged commit bc97dff into main Jul 3, 2026
1 check passed
@rwrife
rwrife deleted the issue-4-ascii-render branch July 3, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M4] ASCII art + render

1 participant