Skip to content

[feature] commit-sprout card — export plant as SVG README badge - #30

Merged
rwrife merged 1 commit into
mainfrom
issue-27-card
Jul 17, 2026
Merged

rwrife merged 1 commit into
mainfrom
issue-27-card

Conversation

@rwrife

@rwrife rwrife commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Closes #27

What changed

Adds a card subcommand that exports the current plant as a self-contained SVG so users can embed a living-ish plant badge in their README — an on-brand answer to the green-squares contribution graph.

Command

  • commit-sprout card [--out plant.svg] — new cobra subcommand.
  • --out - streams the SVG to stdout; default writes plant.svg in cwd via an atomic write (temp file + rename), mirroring internal/store.Save.
  • Read-only: exporting a card never persists plant state.
  • --no-color (now a persistent root flag) / NO_COLOR yields a mono card; otherwise foliage color honors the theme (green / amber / red, magenta bloom).

Rendering (internal/render/card.go)

  • New exported render.Card(ps, CardOptions) builds a complete <?xml?>-prefixed <svg> document.
  • Art rows mirror the exact terminal plain art (with pests overlaid) as monospace <tspan> rows; the caption reuses the shared caption() block for stage/streak/last-commit/hints parity.
  • No external fonts or assets; generic monospace family; all glyphs inlined and XML-escaped.

Tests (internal/render/card_test.go)

  • Asserts a valid <svg> root + full XML well-formedness.
  • Asserts expected glyph rows for a known state appear as tspans.
  • Table test that color path emits the right foliage hex per health/bloom.
  • Verifies --no-color produces a mono card (neutral ink, no themed foliage).

Docs

  • README: quick-interface line + a new "README badge (SVG card)" section with usage, embed snippet, and regeneration tips (hook / cron / CI).

Acceptance criteria

  • card subcommand with --out
  • Self-contained SVG mirroring ASCII art + stage/streak caption
  • --out - to stdout; default atomic plant.svg
  • Theme color path + --no-color mono
  • Unit test: valid SVG root + expected glyph rows
  • README card section + embed snippet
  • go build ./... and go test ./... pass

Notes / scope

  • --no-color was promoted to a persistent flag so subcommands (including card) can honor it; behavior for the root command is unchanged.
  • Season/Holiday dressing is intentionally not layered onto the card yet (kept legible + diff-stable); reserved for a follow-up.

@rwrife
rwrife merged commit 27cd2fb into main Jul 17, 2026
1 check passed
@rwrife
rwrife deleted the issue-27-card branch July 17, 2026 09:00
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.

[feature] commit-sprout card — export plant as SVG for README badge

1 participant