feat/figment: periodic SVG glyph overlays with CLI flag #34

Merged
genewildish merged 14 commits from feat/figment into main 2026-03-19 20:42:11 +00:00
Owner

Summary

  • Adds periodic full-screen SVG glyph overlays (Mayan/Aztec glyphs) that animate through a reveal → hold (strobe) → dissolve cycle in theme-selected colors
  • Exposes --figment and --figment-interval N CLI flags so figment mode no longer requires code changes to enable
  • Fixes Cairo C library discovery on macOS when running uv run directly (sets DYLD_LIBRARY_PATH before cairosvg import)
  • Adds boot status line: Figment: ARMED [Ns interval] or UNAVAILABLE — run: brew install cairo

Architecture

  • engine/figment_render.py — SVG → cairosvg → PIL → greyscale → half-block rasterizer with LRU cache
  • engine/figment_trigger.pyFigmentTrigger protocol + FigmentAction/FigmentCommand types for extensible input sources
  • effects_plugins/figment.pyFigmentEffect state machine (REVEAL → HOLD → DISSOLVE → IDLE), timer-based auto-trigger, random SVG/theme selection
  • engine/layers.pyrender_figment_overlay() renders ANSI cursor-positioned overlay between effects chain and ntfy message layer
  • figments/ — bundled Mayan and Aztec SVG glyph assets

Test plan

  • uv sync --extra figment && brew install cairo then uv run mainline.py --figment --figment-interval 10
  • Boot output shows Figment: ARMED [10s interval]
  • Glyph overlay appears within ~10 seconds, animates reveal → hold → dissolve
  • uv run pytest passes (figment tests auto-skip if Cairo not installed)
  • Running without --figment shows no figment activity

🤖 Generated with Claude Code

## Summary - Adds periodic full-screen SVG glyph overlays (Mayan/Aztec glyphs) that animate through a reveal → hold (strobe) → dissolve cycle in theme-selected colors - Exposes `--figment` and `--figment-interval N` CLI flags so figment mode no longer requires code changes to enable - Fixes Cairo C library discovery on macOS when running `uv run` directly (sets `DYLD_LIBRARY_PATH` before cairosvg import) - Adds boot status line: **Figment: ARMED [Ns interval]** or **UNAVAILABLE — run: brew install cairo** ## Architecture - `engine/figment_render.py` — SVG → cairosvg → PIL → greyscale → half-block rasterizer with LRU cache - `engine/figment_trigger.py` — `FigmentTrigger` protocol + `FigmentAction`/`FigmentCommand` types for extensible input sources - `effects_plugins/figment.py` — `FigmentEffect` state machine (REVEAL → HOLD → DISSOLVE → IDLE), timer-based auto-trigger, random SVG/theme selection - `engine/layers.py` — `render_figment_overlay()` renders ANSI cursor-positioned overlay between effects chain and ntfy message layer - `figments/` — bundled Mayan and Aztec SVG glyph assets ## Test plan - [ ] `uv sync --extra figment && brew install cairo` then `uv run mainline.py --figment --figment-interval 10` - [ ] Boot output shows **Figment: ARMED [10s interval]** - [ ] Glyph overlay appears within ~10 seconds, animates reveal → hold → dissolve - [ ] `uv run pytest` passes (figment tests auto-skip if Cairo not installed) - [ ] Running without `--figment` shows no figment activity 🤖 Generated with [Claude Code](https://claude.com/claude-code)
genewildish added 14 commits 2026-03-19 20:41:48 +00:00
Hybrid plugin + overlay architecture for periodic SVG glyph display
with theme-aware coloring and extensible input abstraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename FigmentPlugin to FigmentEffect (discovery convention)
- Define FigmentState dataclass and FigmentPhase enum
- Clarify chain exclusion (no-op process, not in chain order)
- Add isinstance() downcast for type-safe scroll.py access
- Use FigmentAction enum instead of string literals
- Add Error Handling section (missing deps, empty dir, resize)
- Add Goals, Out of Scope sections
- Split tests per module (test_figment_render, test_figment_trigger)
- Add FIGMENT_TRIGGER to modified files (events.py)
- Document timing formula (progress += FRAME_DT / phase_duration)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8-task plan covering SVG rasterization, overlay rendering,
FigmentEffect plugin, trigger protocol, and scroll loop integration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Also adds DYLD_LIBRARY_PATH to mise.toml for macOS Cairo discovery.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the core figment plugin: timer-driven SVG selection, REVEAL →
HOLD → DISSOLVE state machine, trigger API, and get_figment_state() for
overlay rendering. process() is a deliberate no-op; scroll.py will call
get_figment_state() instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements phase-aware (REVEAL/HOLD/DISSOLVE) ANSI cursor-positioning overlay
renderer for figment glyphs, with deterministic shuffle seeding and gradient
coloring via _color_codes_to_ansi(). Includes 6 TDD tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wire render_figment_overlay() into stream() between the effects chain
and the ntfy message overlay, with optional cairosvg import guard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes: unused imports, import sorting, unused variable, overly broad
exception type in test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Gracefully skips figment tests when system Cairo library is unavailable
instead of crashing with opaque OSError during test collection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add figment mode to intro paragraph
- New Figment Mode section: enabling, assets, trigger protocol, deps
- Architecture table updated with engine/figment_render.py,
  figment_trigger.py, and effects_plugins/ directory breakdown
- Dev setup: separate uv sync --extras entries (mic vs figment)
- Testing section: mentions figment test coverage and Cairo skip
- Roadmap: adds figment follow-up items (CLI flag, intensity wiring,
  ntfy trigger)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
genewildish force-pushed feat/figment from 509cee6312 to a25b80d4a6 2026-03-19 20:41:48 +00:00 Compare
genewildish merged commit 42aa6f16cc into main 2026-03-19 20:42:11 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: genewildish/Mainline#34