# crossfetch v2 — Multi-theme + Liturgical Year Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Extend the existing `~/.local/bin` rice tools (`crossfetch`, `ricefx.py`) with five new terminal themes, a Western liturgical calendar that drives colors year-round, feast-day emblems with one-shot animations, and a themed fastfetch config generator. **Architecture:** Three loose Python files in `~/.local/bin` (no package, imported via `sys.path[0]`): `ricefx.py` (theme/palette API — accent *roles* are the contract), new `liturgy.py` (pure date math, no I/O), and `crossfetch` (the animated tool, consumes both). Shell integration in `~/.dotfiles/config/animations.zsh`. Tests + templates versioned in the `~/.config/crossfetch` git repo. **Tech Stack:** Python 3.14 stdlib only (no pip deps at runtime), pytest (dev only), zsh. **Spec:** `~/.config/crossfetch/docs/specs/2026-08-12-liturgical-themes-design.md` ## Global Constraints - Runtime code uses **Python stdlib only** — no new dependencies. - Theme selection env var is **`RICEFX_THEME`** (already exists; values are `RAMPS` keys). - Accent role names are fixed: `base surface overlay muted subtle text love gold rose pine foam iris highlightLow highlightMed highlightHigh`. Every theme defines all of them. - Env var precedence for burst colors: `CROSS_BURST` (explicit) > feast roles > season roles > `DEFAULT_PAIR`. - `CROSS_LITURGY=off|0|no` disables ALL liturgical coloring; `CROSS_FEAST=off|0|no` disables only feast emblem/one-shot (season colors stay). - State dir: `~/.local/state/crossfetch/` (one-shot flags, render marker). - Never write a partial config file: write `.tmp` then `os.replace`. - `~/.local/bin` is NOT under git. After every task that edits a bin file, snapshot it: `cp ~/.local/bin/{crossfetch,ricefx.py,liturgy.py} ~/.config/crossfetch/bin/` and commit in `~/.config/crossfetch`. - Tests live in `~/.config/crossfetch/tests/`; run with `python3 -m pytest ~/.config/crossfetch/tests -v`. - `~/.dotfiles` is its own git repo — zsh changes commit there. --- ### Task 1: `liturgy.py` — computus, seasons, feasts **Files:** - Create: `~/.local/bin/liturgy.py` - Create: `~/.config/crossfetch/tests/conftest.py` - Test: `~/.config/crossfetch/tests/test_liturgy.py` **Interfaces:** - Consumes: nothing (stdlib `datetime`, `collections` only). - Produces (later tasks import these exact names): - `easter(year: int) -> datetime.date` - `season(d: datetime.date) -> Season` — `Season = namedtuple("Season", "id name roles")`, `roles` is a 2-tuple of accent role name strings - `feast(d: datetime.date) -> Feast | None` — `Feast = namedtuple("Feast", "id name emblem verse roles")` - `FEAST_DEFS: dict[str, Feast]` (keys: `christmas epiphany ash_wednesday palm_sunday good_friday easter_day ascension pentecost all_saints`) - [ ] **Step 1: Create conftest.py so tests can import the bin modules** ```python # ~/.config/crossfetch/tests/conftest.py import os import sys sys.path.insert(0, os.path.expanduser("~/.local/bin")) ``` - [ ] **Step 2: Write the failing tests** ```python # ~/.config/crossfetch/tests/test_liturgy.py import datetime as dt import liturgy # Known Western (Gregorian) Easter dates. KNOWN_EASTER = { 2024: dt.date(2024, 3, 31), 2025: dt.date(2025, 4, 20), 2026: dt.date(2026, 4, 5), 2027: dt.date(2027, 3, 28), 2028: dt.date(2028, 4, 16), 2029: dt.date(2029, 4, 1), 2030: dt.date(2030, 4, 21), } def test_easter_known_dates(): for year, expected in KNOWN_EASTER.items(): assert liturgy.easter(year) == expected, year def test_advent_2025_starts_nov_30(): # Dec 25 2025 is a Thursday; last Sunday strictly before is Dec 21; # Advent 1 is three Sundays earlier. assert liturgy.season(dt.date(2025, 11, 30)).id == "advent" assert liturgy.season(dt.date(2025, 11, 29)).id == "ordinary" def test_advent_2026_starts_nov_29(): assert liturgy.season(dt.date(2026, 11, 29)).id == "advent" assert liturgy.season(dt.date(2026, 11, 28)).id == "ordinary" def test_christmastide_spans_year_boundary(): assert liturgy.season(dt.date(2025, 12, 25)).id == "christmastide" assert liturgy.season(dt.date(2026, 1, 5)).id == "christmastide" assert liturgy.season(dt.date(2026, 1, 6)).id == "ordinary" def test_lent_and_holy_week_2026(): # Easter 2026-04-05 -> Ash Wednesday Feb 18, Palm Sunday Mar 29. assert liturgy.season(dt.date(2026, 2, 17)).id == "ordinary" assert liturgy.season(dt.date(2026, 2, 18)).id == "lent" assert liturgy.season(dt.date(2026, 3, 28)).id == "lent" assert liturgy.season(dt.date(2026, 3, 29)).id == "holy_week" assert liturgy.season(dt.date(2026, 4, 4)).id == "holy_week" assert liturgy.season(dt.date(2026, 4, 5)).id == "eastertide" def test_eastertide_ends_at_pentecost_2026(): # Pentecost = Easter + 49 = May 24 2026. assert liturgy.season(dt.date(2026, 5, 24)).id == "eastertide" assert liturgy.season(dt.date(2026, 5, 25)).id == "ordinary" def test_feasts_2026(): assert liturgy.feast(dt.date(2026, 12, 25)).id == "christmas" assert liturgy.feast(dt.date(2026, 1, 6)).id == "epiphany" assert liturgy.feast(dt.date(2026, 2, 18)).id == "ash_wednesday" assert liturgy.feast(dt.date(2026, 3, 29)).id == "palm_sunday" assert liturgy.feast(dt.date(2026, 4, 3)).id == "good_friday" assert liturgy.feast(dt.date(2026, 4, 5)).id == "easter_day" assert liturgy.feast(dt.date(2026, 5, 14)).id == "ascension" assert liturgy.feast(dt.date(2026, 5, 24)).id == "pentecost" assert liturgy.feast(dt.date(2026, 11, 1)).id == "all_saints" assert liturgy.feast(dt.date(2026, 7, 14)) is None def test_every_feast_is_complete(): for fid, f in liturgy.FEAST_DEFS.items(): assert f.id == fid assert f.name and f.verse and f.emblem assert len(f.roles) == 2 def test_every_season_has_role_pair(): for d in (dt.date(2026, 1, 2), dt.date(2026, 2, 20), dt.date(2026, 4, 1), dt.date(2026, 4, 20), dt.date(2026, 8, 12), dt.date(2026, 12, 1), dt.date(2026, 12, 26)): s = liturgy.season(d) assert len(s.roles) == 2 and s.name ``` - [ ] **Step 3: Run tests to verify they fail** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_liturgy.py -v` Expected: FAIL / collection error — `ModuleNotFoundError: No module named 'liturgy'` - [ ] **Step 4: Write `~/.local/bin/liturgy.py`** ```python """liturgy.py — Western (Gregorian) liturgical calendar for the rice tools. Pure date math, no I/O. Colors are expressed as ACCENT ROLE NAMES (gold, iris, love, ...) — the caller resolves them through ricefx's active theme, so purple is Rose Pine iris on rose-pine and Tokyo Night purple on tokyo-night without this module knowing about themes at all. """ from __future__ import annotations import datetime as _dt from collections import namedtuple Season = namedtuple("Season", "id name roles") Feast = namedtuple("Feast", "id name emblem verse roles") def easter(year: int) -> _dt.date: """Gregorian computus (Anonymous/Meeus algorithm).""" a = year % 19 b, c = divmod(year, 100) d, e = divmod(b, 4) f = (b + 8) // 25 g = (b - f + 1) // 3 h = (19 * a + b - d - g + 15) % 30 i, k = divmod(c, 4) l = (32 + 2 * e + 2 * i - h - k) % 7 m = (a + 11 * h + 22 * l) // 451 month, day = divmod(h + l - 7 * m + 114, 31) return _dt.date(year, month, day + 1) SEASONS = { "advent": Season("advent", "Advent", ("iris", "subtle")), "christmastide": Season("christmastide", "Christmastide", ("gold", "text")), "ordinary": Season("ordinary", "Ordinary Time", ("pine", "foam")), "lent": Season("lent", "Lent", ("iris", "muted")), "holy_week": Season("holy_week", "Holy Week", ("love", "muted")), "eastertide": Season("eastertide", "Eastertide", ("gold", "foam")), } FEAST_DEFS = { "christmas": Feast("christmas", "Christmas", "star", "For unto you is born this day a Saviour — Luke 2:11", ("gold", "text")), "epiphany": Feast("epiphany", "Epiphany", "star", "We have seen his star in the east — Matthew 2:2", ("gold", "iris")), "ash_wednesday": Feast("ash_wednesday", "Ash Wednesday", "orthodox", "Dust thou art, and unto dust shalt thou return — Genesis 3:19", ("iris", "muted")), "palm_sunday": Feast("palm_sunday", "Palm Sunday", "jerusalem", "Blessed is he that cometh in the name of the Lord — Mark 11:9", ("pine", "foam")), "good_friday": Feast("good_friday", "Good Friday", "thorns", "It is finished — John 19:30", ("love", "muted")), "easter_day": Feast("easter_day", "Easter", "chi", "He is not here: for he is risen — Matthew 28:6", ("gold", "foam")), "ascension": Feast("ascension", "Ascension", "chi", "He was received up into heaven — Mark 16:19", ("foam", "text")), "pentecost": Feast("pentecost", "Pentecost", "dove", "And they were all filled with the Holy Ghost — Acts 2:4", ("love", "gold")), "all_saints": Feast("all_saints", "All Saints", "orthodox", "Blessed are the pure in heart — Matthew 5:8", ("gold", "text")), } def _advent1(year: int) -> _dt.date: """Fourth Sunday before Christmas (the Sunday STRICTLY before Dec 25, minus three more weeks).""" xmas = _dt.date(year, 12, 25) dow = xmas.isoweekday() % 7 # Sunday -> 0 last_sun = xmas - _dt.timedelta(days=dow or 7) return last_sun - _dt.timedelta(days=21) def _feast_dates(year: int) -> dict[str, _dt.date]: e = easter(year) return { "christmas": _dt.date(year, 12, 25), "epiphany": _dt.date(year, 1, 6), "ash_wednesday": e - _dt.timedelta(days=46), "palm_sunday": e - _dt.timedelta(days=7), "good_friday": e - _dt.timedelta(days=2), "easter_day": e, "ascension": e + _dt.timedelta(days=39), "pentecost": e + _dt.timedelta(days=49), "all_saints": _dt.date(year, 11, 1), } def season(d: _dt.date) -> Season: y = d.year if d >= _dt.date(y, 12, 25) or d <= _dt.date(y, 1, 5): return SEASONS["christmastide"] if d >= _advent1(y): return SEASONS["advent"] e = easter(y) ash = e - _dt.timedelta(days=46) palm = e - _dt.timedelta(days=7) pentecost = e + _dt.timedelta(days=49) if d < ash: return SEASONS["ordinary"] # Epiphanytide / Ordinary I if d < palm: return SEASONS["lent"] if d < e: return SEASONS["holy_week"] if d <= pentecost: return SEASONS["eastertide"] return SEASONS["ordinary"] # Ordinary II def feast(d: _dt.date) -> Feast | None: for fid, fd in _feast_dates(d.year).items(): if fd == d: return FEAST_DEFS[fid] return None ``` - [ ] **Step 5: Run tests to verify they pass** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_liturgy.py -v` Expected: all PASS - [ ] **Step 6: Snapshot + commit** ```bash mkdir -p ~/.config/crossfetch/bin cp ~/.local/bin/liturgy.py ~/.config/crossfetch/bin/ cd ~/.config/crossfetch git add bin/liturgy.py tests/ git commit -m "feat: liturgical calendar engine (computus, seasons, feasts)" ``` --- ### Task 2: `ricefx.py` — five new themes + aliases **Files:** - Modify: `~/.local/bin/ricefx.py` (ACCENTS block ~line 151, theme() ~line 183, RAMPS_TEXT block ~line 145) - Test: `~/.config/crossfetch/tests/test_ricefx_themes.py` **Interfaces:** - Consumes: existing `ACCENTS`, `RAMPS`, `RAMPS_SOLID`, `BACKGROUNDS`, `RAMPS_TEXT`, `theme()` in ricefx.py. - Produces: `ACCENTS` gains keys `tokyo-night gruvbox catppuccin-mocha nord dracula`; `theme()` accepts those plus aliases `rose-pine`→`dark`, `rose-pine-dawn`→`dawn`; unknown value falls back to `dark` with one stderr warning. All downstream role-name lookups unchanged. - [ ] **Step 1: Write the failing tests** ```python # ~/.config/crossfetch/tests/test_ricefx_themes.py import importlib import ricefx ROLES = {"base", "surface", "overlay", "muted", "subtle", "text", "love", "gold", "rose", "pine", "foam", "iris", "highlightLow", "highlightMed", "highlightHigh"} NEW_THEMES = ["tokyo-night", "gruvbox", "catppuccin-mocha", "nord", "dracula"] def test_new_themes_present_with_all_roles(): for name in NEW_THEMES: assert name in ricefx.ACCENTS, name assert ROLES <= set(ricefx.ACCENTS[name]), name def test_theme_tables_consistent(): for name in ricefx.ACCENTS: assert name in ricefx.RAMPS, name assert name in ricefx.RAMPS_SOLID, name assert name in ricefx.RAMPS_TEXT, name assert name in ricefx.BACKGROUNDS, name assert len(ricefx.RAMPS[name]) == 8 assert len(ricefx.RAMPS_SOLID[name]) == 8 def test_all_colors_are_rgb_tuples(): for name, acc in ricefx.ACCENTS.items(): for role, c in acc.items(): assert len(c) == 3 and all(0 <= v <= 255 for v in c), (name, role) def _theme_with_env(monkeypatch, value): monkeypatch.setenv("RICEFX_THEME", value) monkeypatch.delenv("COLORFGBG", raising=False) importlib.reload(ricefx) return ricefx.theme() def test_theme_aliases_and_fallback(monkeypatch): assert _theme_with_env(monkeypatch, "rose-pine") == "dark" assert _theme_with_env(monkeypatch, "rose-pine-dawn") == "dawn" assert _theme_with_env(monkeypatch, "tokyo-night") == "tokyo-night" assert _theme_with_env(monkeypatch, "not-a-theme") == "dark" monkeypatch.delenv("RICEFX_THEME", raising=False) importlib.reload(ricefx) # leave module clean for other tests ``` - [ ] **Step 2: Run tests to verify they fail** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_ricefx_themes.py -v` Expected: FAIL — `assert 'tokyo-night' in ricefx.ACCENTS` - [ ] **Step 3: Add the five theme palettes to `ACCENTS`** Append inside the existing `ACCENTS = {...}` dict (after the `"dark"` entry), official palette hexes mapped onto Rose Pine role names: ```python # Tokyo Night (night variant): https://github.com/folke/tokyonight.nvim "tokyo-night": {"base": (26, 27, 38), "surface": (31, 35, 53), "overlay": (41, 46, 66), "muted": (86, 95, 137), "subtle": (169, 177, 214), "text": (192, 202, 245), "love": (247, 118, 142), "gold": (224, 175, 104), "rose": (255, 158, 100), "pine": (122, 162, 247), "foam": (125, 207, 255), "iris": (187, 154, 247), "highlightLow": (41, 46, 66), "highlightMed": (65, 72, 104), "highlightHigh": (84, 92, 126)}, # Gruvbox dark (medium): https://github.com/morhetz/gruvbox "gruvbox": {"base": (40, 40, 40), "surface": (60, 56, 54), "overlay": (80, 73, 69), "muted": (146, 131, 116), "subtle": (189, 174, 147), "text": (235, 219, 178), "love": (251, 73, 52), "gold": (250, 189, 47), "rose": (254, 128, 25), "pine": (131, 165, 152), "foam": (142, 192, 124), "iris": (211, 134, 155), "highlightLow": (60, 56, 54), "highlightMed": (80, 73, 69), "highlightHigh": (102, 92, 84)}, # Catppuccin Mocha: https://github.com/catppuccin/catppuccin "catppuccin-mocha": {"base": (30, 30, 46), "surface": (49, 50, 68), "overlay": (69, 71, 90), "muted": (108, 112, 134), "subtle": (166, 173, 200), "text": (205, 214, 244), "love": (243, 139, 168), "gold": (249, 226, 175), "rose": (250, 179, 135), "pine": (137, 180, 250), "foam": (148, 226, 213), "iris": (203, 166, 247), "highlightLow": (49, 50, 68), "highlightMed": (69, 71, 90), "highlightHigh": (88, 91, 112)}, # Nord: https://www.nordtheme.com "nord": {"base": (46, 52, 64), "surface": (59, 66, 82), "overlay": (67, 76, 94), "muted": (76, 86, 106), "subtle": (216, 222, 233), "text": (236, 239, 244), "love": (191, 97, 106), "gold": (235, 203, 139), "rose": (208, 135, 112), "pine": (94, 129, 172), "foam": (136, 192, 208), "iris": (180, 142, 173), "highlightLow": (59, 66, 82), "highlightMed": (67, 76, 94), "highlightHigh": (76, 86, 106)}, # Dracula: https://draculatheme.com (no true blue/teal accents — pine # borrows comment-blue, which doubles as muted; the contrast guard and # burst shoulders handle the overlap) "dracula": {"base": (40, 42, 54), "surface": (52, 55, 70), "overlay": (68, 71, 90), "muted": (98, 114, 164), "subtle": (189, 195, 225), "text": (248, 248, 242), "love": (255, 121, 198), "gold": (241, 250, 140), "rose": (255, 184, 108), "pine": (98, 114, 164), "foam": (139, 233, 253), "iris": (189, 147, 249), "highlightLow": (52, 55, 70), "highlightMed": (68, 71, 90), "highlightHigh": (98, 114, 164)}, ``` - [ ] **Step 4: Generate ramps + backgrounds for the new themes** Immediately AFTER the closing `}` of `ACCENTS`, add (mirrors the hand-tuned `"dark"` ramp shape: spark → iris → subtle → highlights → overlay trough held → muted rise): ```python def _spark(acc): """Ramp crest: the theme's iris lifted toward text — same trick as the hand-tuned dark ramp's (232, 213, 255).""" return tuple(int(i + (t - i) * 0.4) for i, t in zip(acc["iris"], acc["text"])) # Derive wave/solid ramps + background for every theme that only defines # accents (the hand-tuned dawn/dark entries stay exactly as they are). for _name, _acc in ACCENTS.items(): if _name in RAMPS: continue RAMPS[_name] = [_spark(_acc), _acc["iris"], _acc["subtle"], _acc["highlightHigh"], _acc["highlightMed"], _acc["overlay"], _acc["overlay"], _acc["muted"]] RAMPS_SOLID[_name] = [_spark(_acc), _acc["iris"], _acc["subtle"], _acc["muted"], _acc["highlightHigh"], _acc["muted"], _acc["subtle"], _acc["iris"]] BACKGROUNDS[_name] = _acc["base"] ``` Then MOVE the existing `RAMPS_TEXT = {...}` block (currently just above `ACCENTS`, ~line 145) to BELOW this generator loop, so it derives legible ramps for the new themes too. Do not change its code. - [ ] **Step 5: Teach `theme()` the aliases + fallback warning** In `theme()`, replace this existing fragment ```python choice = os.environ.get("RICEFX_THEME", "").strip().lower() if choice in RAMPS: _THEME = choice return _THEME ``` with exactly ```python choice = os.environ.get("RICEFX_THEME", "").strip().lower() choice = {"rose-pine": "dark", "rose-pine-dawn": "dawn"}.get(choice, choice) if choice in RAMPS: _THEME = choice return _THEME if choice: print(f"ricefx: unknown RICEFX_THEME {choice!r}, using dark " f"(known: {', '.join(sorted(RAMPS))})", file=sys.stderr) ``` Leave the rest of `theme()` (the COLORFGBG probe and the `dark` fallback) untouched. Ensure `import sys` exists at the top of ricefx.py; add it if missing. - [ ] **Step 6: Run tests to verify they pass** Run: `python3 -m pytest ~/.config/crossfetch/tests/ -v` Expected: all PASS (liturgy tests still green) - [ ] **Step 7: Visual smoke** Run: `for t in tokyo-night gruvbox catppuccin-mocha nord dracula; do RICEFX_THEME=$t python3 ~/.local/bin/ricefx.py demo 2>/dev/null | head -5; done` — if ricefx has no `demo` CLI arg, use `RICEFX_THEME=$t crossfetch --logo | head -8` per theme instead. Expected: distinct palettes, no tracebacks. - [ ] **Step 8: Snapshot + commit** ```bash cp ~/.local/bin/ricefx.py ~/.config/crossfetch/bin/ cd ~/.config/crossfetch git add bin/ricefx.py tests/test_ricefx_themes.py git commit -m "feat: tokyo-night, gruvbox, catppuccin-mocha, nord, dracula themes" ``` --- ### Task 3: crossfetch — `star`, `dove`, `thorns` emblem masks **Files:** - Modify: `~/.local/bin/crossfetch` (mask builders ~line 76-226, `SYMBOLS` dict ~line 227, `ALIASES` ~line 247, docstring env section) - Test: `~/.config/crossfetch/tests/test_crossfetch_masks.py` **Interfaces:** - Consumes: existing mask format — list of equal-purpose strings of `"#"`/`" "`, builders like `_build_chi_rho()`; `SYMBOLS` dict name→mask; `set_symbol(name)`. - Produces: `SYMBOLS` gains `"star"`, `"dove"`, `"thorns"`; `ALIASES` gains `"bethlehem": "star"`, `"spirit": "dove"`. Task 4's feast wiring calls `set_symbol("star"|"dove"|"thorns")`. - [ ] **Step 1: Write the failing tests** ```python # ~/.config/crossfetch/tests/test_crossfetch_masks.py import importlib.util import os import sys BIN = os.path.expanduser("~/.local/bin") def _load_crossfetch(): if "crossfetch" in sys.modules: return sys.modules["crossfetch"] spec = importlib.util.spec_from_file_location( "crossfetch", os.path.join(BIN, "crossfetch")) mod = importlib.util.module_from_spec(spec) sys.modules["crossfetch"] = mod spec.loader.exec_module(mod) return mod def test_new_emblems_registered(): cf = _load_crossfetch() for name in ("star", "dove", "thorns"): assert name in cf.SYMBOLS, name def test_new_masks_are_well_formed(): cf = _load_crossfetch() for name in ("star", "dove", "thorns"): mask = cf.SYMBOLS[name] assert len(mask) >= 12, name # tall enough to read assert all(set(row) <= {"#", " "} for row in mask), name assert sum(row.count("#") for row in mask) >= 30, name def test_set_symbol_accepts_new_names(): cf = _load_crossfetch() for name in ("star", "dove", "thorns", "bethlehem", "spirit"): cf.set_symbol(name) assert cf.MASK is not cf.CHI_RHO or name in ("chi",), name cf.set_symbol("chi") # restore default for other tests ``` - [ ] **Step 2: Run tests to verify they fail** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_crossfetch_masks.py -v` Expected: FAIL — `KeyError`/`assert 'star' in ...` - [ ] **Step 3: Add the three builders** (next to `_build_skull()`, before `SYMBOLS`) ```python # ── Star of Bethlehem ─────────────────────────────────────────────────────── def _build_star(): """Four long rays + short diagonals, center widened — the star of the Nativity (Christmas, Epiphany).""" W = H = 21 g = [[" "] * W for _ in range(H)] c = 10 for k in range(-9, 10): # vertical + horizontal rays g[c + k][c] = "#" g[c][c + k] = "#" for k in range(-4, 5): # short diagonal rays g[c + k][c + k] = "#" g[c + k][c - k] = "#" for y in (c - 1, c + 1): # widened center for x in (c - 1, c, c + 1): g[y][x] = "#" return ["".join(r) for r in g] # ── Dove (Holy Spirit) ────────────────────────────────────────────────────── def _build_dove(): """Descending dove, wing raised — Pentecost. Hand-drawn; tweak freely.""" return [ " ", " ## ", " #### ", " ###### ", " ####### ", " # ####### ", " ## ####### ", " #### ######### ", " ############## # ", " ############### ", " ############ ", " ######### ", " ###### ", " #### ", " ## ", ] # ── Crown of thorns ───────────────────────────────────────────────────────── def _build_thorns(): """Woven ring with outward spikes — Good Friday.""" W = H = 21 g = [[" "] * W for _ in range(H)] c = 10 for deg in range(0, 360, 4): # the ring, radius 7 rad = math.radians(deg) g[round(c + 7 * math.sin(rad))][round(c + 7 * math.cos(rad))] = "#" for deg in range(15, 360, 45): # spikes poking outward rad = math.radians(deg) for r in (8, 9): y = round(c + r * math.sin(rad)) x = round(c + r * math.cos(rad)) if 0 <= y < H and 0 <= x < W: g[y][x] = "#" return ["".join(r) for r in g] ``` - [ ] **Step 4: Register in `SYMBOLS` and `ALIASES`** ```python SYMBOLS = { "chi": CHI_RHO, "orthodox": ORTHODOX, "jerusalem": _build_jerusalem(), "ichthys": _build_ichthys(), "kali": KALI, "skull": _build_skull(), "star": _build_star(), "dove": _build_dove(), "thorns": _build_thorns(), } ``` and extend `ALIASES` with `"bethlehem": "star", "spirit": "dove"`. Update the docstring's `CROSS_SYMBOL` line to list the new names. - [ ] **Step 5: Run tests to verify they pass** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_crossfetch_masks.py -v` Expected: PASS - [ ] **Step 6: Visual smoke** Run: `crossfetch --logo star | head -25; crossfetch --logo dove | head -20; crossfetch --logo thorns | head -25` Expected: recognizable star / dove / ring-with-spikes. Adjust mask art if unreadable (art quality is a judgment call — keep `#`-grid format and passing tests). - [ ] **Step 7: Snapshot + commit** ```bash cp ~/.local/bin/crossfetch ~/.config/crossfetch/bin/ cd ~/.config/crossfetch git add bin/crossfetch tests/test_crossfetch_masks.py git commit -m "feat: star, dove, crown-of-thorns emblem masks" ``` --- ### Task 4: crossfetch — liturgical colors, feast one-shot, `--feast` **Files:** - Modify: `~/.local/bin/crossfetch` — imports (~line 55-70), `_pair()` (~line 833), `daily_verse()` (~line 1259), `main()` (~line 1440), docstring - Test: `~/.config/crossfetch/tests/test_crossfetch_liturgy.py` **Interfaces:** - Consumes: Task 1's `liturgy.easter/season/feast/FEAST_DEFS` (namedtuples `Season(id, name, roles)`, `Feast(id, name, emblem, verse, roles)`); Task 3's `set_symbol` names; existing `DEFAULT_PAIR`, `ricefx.ACCENTS`, `ricefx.accent`, `lerp`, `STOPS`, `run(mode, timeout)`. - Produces: `_liturgy_pair() -> tuple[str, str] | None`, `_active_feast() -> Feast | None`, `use_season_stops()`, `_feast_unseen(f) -> bool`, `_mark_feast_seen(f)`, module global `FORCED_FEAST`, CLI `--feast [id]`. Task 6's zsh block relies on: splash (bare `crossfetch`) auto-runs feast burst once/year; `CROSS_LITURGY=off` and `CROSS_FEAST=off` honored. - [ ] **Step 1: Write the failing tests** ```python # ~/.config/crossfetch/tests/test_crossfetch_liturgy.py import datetime as dt import json from test_crossfetch_masks import _load_crossfetch def test_liturgy_pair_follows_season(monkeypatch): cf = _load_crossfetch() monkeypatch.delenv("CROSS_LITURGY", raising=False) monkeypatch.delenv("CROSS_FEAST", raising=False) cf.FORCED_FEAST = None pair = cf._liturgy_pair() assert pair is not None and len(pair) == 2 # Aug 13 2026 is Ordinary Time -> (pine, foam); today's real season may # differ if this test runs another day, so check against liturgy directly. import liturgy today = dt.date.today() f = liturgy.feast(today) expected = f.roles if f else liturgy.season(today).roles assert tuple(pair) == tuple(expected) def test_liturgy_off_disables(monkeypatch): cf = _load_crossfetch() monkeypatch.setenv("CROSS_LITURGY", "off") cf.FORCED_FEAST = None assert cf._liturgy_pair() is None def test_explicit_cross_burst_wins(monkeypatch): cf = _load_crossfetch() monkeypatch.setenv("CROSS_BURST", "love,gold") assert cf._pair() == ("love", "gold") monkeypatch.delenv("CROSS_BURST", raising=False) def test_forced_feast_wins(monkeypatch): cf = _load_crossfetch() import liturgy monkeypatch.delenv("CROSS_BURST", raising=False) cf.FORCED_FEAST = liturgy.FEAST_DEFS["pentecost"] assert cf._pair() == ("love", "gold") assert cf.daily_verse() == liturgy.FEAST_DEFS["pentecost"].verse cf.FORCED_FEAST = None def test_feast_state_roundtrip(tmp_path, monkeypatch): cf = _load_crossfetch() import liturgy monkeypatch.setattr(cf, "STATE_DIR", str(tmp_path)) f = liturgy.FEAST_DEFS["easter_day"] assert cf._feast_unseen(f) cf._mark_feast_seen(f) assert not cf._feast_unseen(f) data = json.loads((tmp_path / "shown.json").read_text()) assert f.id in data[str(dt.date.today().year)] # corrupt file must not crash (tmp_path / "shown.json").write_text("{ nope") assert cf._feast_unseen(f) def test_use_season_stops_changes_gradient(monkeypatch): cf = _load_crossfetch() import liturgy monkeypatch.delenv("CROSS_LITURGY", raising=False) cf.FORCED_FEAST = liturgy.FEAST_DEFS["good_friday"] before = list(cf.STOPS) cf.use_season_stops() assert cf.STOPS != before assert len(cf.STOPS) >= 4 cf.STOPS = cf.PALETTE # restore cf.FORCED_FEAST = None ``` - [ ] **Step 2: Run tests to verify they fail** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_crossfetch_liturgy.py -v` Expected: FAIL — `AttributeError: module 'crossfetch' has no attribute '_liturgy_pair'` - [ ] **Step 3: Add imports and helpers to crossfetch** Add `import datetime` and `import json` to the import block. Next to the existing `import ricefx` (inside its try/except at ~line 64), add a sibling guarded import: ```python try: import liturgy # same directory as ricefx except Exception: liturgy = None ``` (If the ricefx import is NOT inside try/except, mirror however it is done and ensure a module-level `liturgy = None` fallback exists.) Below `DEFAULT_PAIR` (~line 817), add: ```python STATE_DIR = os.path.expanduser("~/.local/state/crossfetch") FORCED_FEAST = None # set by --feast for replays; wins over everything def _flag_off(var): return os.environ.get(var, "").strip().lower() in ("off", "0", "no") def _today_feast(): if liturgy is None or _flag_off("CROSS_LITURGY") or _flag_off("CROSS_FEAST"): return None try: return liturgy.feast(datetime.date.today()) except Exception: return None def _active_feast(): return FORCED_FEAST if FORCED_FEAST is not None else _today_feast() def _liturgy_pair(): """Accent-role pair for today: forced feast > feast > season. None when liturgical coloring is off or the liturgy module is missing.""" if FORCED_FEAST is not None: return FORCED_FEAST.roles if liturgy is None or _flag_off("CROSS_LITURGY"): return None try: f = _today_feast() return f.roles if f else liturgy.season(datetime.date.today()).roles except Exception: return None def _shown_path(): return os.path.join(STATE_DIR, "shown.json") def _feast_unseen(f): try: with open(_shown_path()) as fh: data = json.load(fh) except Exception: data = {} return f.id not in data.get(str(datetime.date.today().year), []) def _mark_feast_seen(f): os.makedirs(STATE_DIR, exist_ok=True) try: with open(_shown_path()) as fh: data = json.load(fh) except Exception: data = {} year = str(datetime.date.today().year) data.setdefault(year, []) if f.id not in data[year]: data[year].append(f.id) tmp = _shown_path() + ".tmp" with open(tmp, "w") as fh: json.dump(data, fh) os.replace(tmp, _shown_path()) def use_season_stops(): """Point STOPS at a gradient built from today's liturgical pair, so the static --logo and the --fetch glow follow the season. No-op when liturgical coloring is off. Ring/rain keep the poster rainbow.""" pair = _liturgy_pair() if not pair or ricefx is None: return acc = ricefx.ACCENTS[ricefx.theme()] if pair[0] not in acc or pair[1] not in acc: return a, b = acc[pair[0]], acc[pair[1]] global STOPS STOPS = [a, lerp(a, b, 0.35), lerp(a, b, 0.7), b, lerp(b, a, 0.5), a] ``` - [ ] **Step 4: Wire `_pair()` precedence** Replace `_pair()`'s final `return DEFAULT_PAIR` with: ```python lp = _liturgy_pair() if lp and all(n in ricefx.ACCENTS[ricefx.theme()] for n in lp): return lp[0], lp[1] return DEFAULT_PAIR ``` - [ ] **Step 5: Feast verse override** At the very top of `daily_verse()` (~line 1259), before the file read: ```python f = _active_feast() if f: return f.verse ``` - [ ] **Step 6: Wire `main()`** In `main()` (~line 1440): a. After `set_symbol(os.environ.get("CROSS_SYMBOL"))`, add: ```python f = _active_feast() if f: set_symbol(f.emblem) # feast emblem overrides the daily rotation ``` b. In the `--logo` branch, insert `use_season_stops()` before `print_logo()`. In the `--fetch` branch, insert `use_season_stops()` before `fetch(secs)`. c. Add a `--feast` branch after the `--fetch` branch: ```python if args and args[0] == "--feast": if liturgy is None: print("crossfetch: liturgy module missing", file=sys.stderr) sys.exit(2) fid = args[1] if len(args) > 1 else (f.id if f else "easter_day") fd = liturgy.FEAST_DEFS.get(fid) if fd is None: print(f"unknown feast {fid!r}; available: " f"{', '.join(sorted(liturgy.FEAST_DEFS))}", file=sys.stderr) sys.exit(2) global FORCED_FEAST FORCED_FEAST = fd set_symbol(fd.emblem) try: timeout = float(os.environ.get("CROSS_TIMEOUT", "0") or 0) except ValueError: timeout = 0.0 run("burst", timeout) return ``` d. Replace the final `run(mode, timeout)` with the one-shot gate: ```python if f and _feast_unseen(f) and sys.stdout.isatty(): # Feast day: fullscreen burst in the feast's colors, once per year # (like hyfetch's pride-month animation). Keypress still skips. run("burst", timeout if timeout else 8.0) _mark_feast_seen(f) return run(mode, timeout) ``` e. Update the module docstring: document `--feast [id]`, `CROSS_LITURGY`, `CROSS_FEAST`, and the season-driven default for `CROSS_BURST`. - [ ] **Step 7: Run all tests** Run: `python3 -m pytest ~/.config/crossfetch/tests -v` Expected: all PASS - [ ] **Step 8: Manual smoke** ```bash crossfetch --feast pentecost # dove + red/gold burst, ends on keypress crossfetch --feast good_friday # thorns + crimson CROSS_TIMEOUT=3 crossfetch # normal splash, season colors CROSS_LITURGY=off CROSS_TIMEOUT=3 crossfetch # old gold,iris default look crossfetch --logo | head -10 # season-tinted gradient ``` Expected: each runs and restores the terminal; no tracebacks. - [ ] **Step 9: Snapshot + commit** ```bash cp ~/.local/bin/crossfetch ~/.config/crossfetch/bin/ cd ~/.config/crossfetch git add bin/crossfetch tests/test_crossfetch_liturgy.py git commit -m "feat: liturgical season colors, feast one-shot animation, --feast" ``` --- ### Task 5: fastfetch template + `--sync-fastfetch` **Files:** - Create: `~/.config/crossfetch/fastfetch.template.jsonc` - Modify: `~/.local/bin/crossfetch` (add `sync_fastfetch()` + `_readable()` + `--sync-fastfetch` branch in `main()`) - Test: `~/.config/crossfetch/tests/test_sync_fastfetch.py` **Interfaces:** - Consumes: `ricefx.ACCENTS`, `ricefx.theme()`, `ricefx.background()`. - Produces: `crossfetch --sync-fastfetch` renders template → `~/.config/fastfetch/config.jsonc` (exit 0 ok, 1 error); `sync_fastfetch(tpl_path=None, out_path=None) -> int` (paths overridable for tests). Task 6's zsh block calls the CLI. - [ ] **Step 1: Create the template from the live config** ```bash cp ~/.config/fastfetch/config.jsonc ~/.config/crossfetch/fastfetch.template.jsonc python3 - <<'EOF' import re, pathlib p = pathlib.Path.home() / ".config/crossfetch/fastfetch.template.jsonc" text = p.read_text() # Rose Pine dark SGR fragments -> role placeholders (order matters: none overlap) mapping = { "38;2;246;193;119": "{{gold}}", "38;2;156;207;216": "{{foam}}", "38;2;224;222;244": "{{text}}", "38;2;144;140;170": "{{subtle}}", "38;2;235;188;186": "{{rose}}", "38;2;235;111;146": "{{love}}", "38;2;64;61;82": "{{highlightMed}}", } for sgr, ph in mapping.items(): text = text.replace(sgr, ph) assert "38;2;" not in text, "unmapped color fragment left in template" p.write_text(text) print("template ok") EOF ``` Expected output: `template ok`. (The assert guarantees every hardcoded color got a placeholder — if it fires, add the missing fragment to the mapping.) - [ ] **Step 2: Write the failing tests** ```python # ~/.config/crossfetch/tests/test_sync_fastfetch.py import os import pathlib from test_crossfetch_masks import _load_crossfetch LIVE_TPL = pathlib.Path.home() / ".config/crossfetch/fastfetch.template.jsonc" LIVE_CFG = pathlib.Path.home() / ".config/fastfetch/config.jsonc" def test_roundtrip_rose_pine_reproduces_current_config(tmp_path, monkeypatch): """Template + rose-pine dark must rebuild today's config byte-identical.""" cf = _load_crossfetch() monkeypatch.setenv("RICEFX_THEME", "dark") import importlib, ricefx importlib.reload(ricefx) cf.ricefx = ricefx out = tmp_path / "config.jsonc" rc = cf.sync_fastfetch(str(LIVE_TPL), str(out)) assert rc == 0 assert out.read_text() == LIVE_CFG.read_text() def test_other_theme_produces_different_config(tmp_path, monkeypatch): cf = _load_crossfetch() monkeypatch.setenv("RICEFX_THEME", "gruvbox") import importlib, ricefx importlib.reload(ricefx) cf.ricefx = ricefx out = tmp_path / "config.jsonc" assert cf.sync_fastfetch(str(LIVE_TPL), str(out)) == 0 text = out.read_text() assert "{{" not in text assert "38;2;250;189;47" in text # gruvbox gold monkeypatch.setenv("RICEFX_THEME", "dark") importlib.reload(ricefx) def test_missing_template_errors_and_leaves_output_alone(tmp_path): cf = _load_crossfetch() out = tmp_path / "config.jsonc" out.write_text("precious") rc = cf.sync_fastfetch(str(tmp_path / "nope.jsonc"), str(out)) assert rc == 1 assert out.read_text() == "precious" def test_unknown_role_errors(tmp_path): cf = _load_crossfetch() tpl = tmp_path / "t.jsonc" tpl.write_text('{"color": "{{nonsense}}"}') out = tmp_path / "config.jsonc" assert cf.sync_fastfetch(str(tpl), str(out)) == 1 assert not out.exists() ``` - [ ] **Step 3: Run tests to verify they fail** Run: `python3 -m pytest ~/.config/crossfetch/tests/test_sync_fastfetch.py -v` Expected: FAIL — `AttributeError: ... no attribute 'sync_fastfetch'` - [ ] **Step 4: Implement in crossfetch** (near `print_logo`) ```python def _readable(c, bg, text): """Nudge a role toward the theme's text color if it would be illegible as foreground on this background (the pine-on-dark rule, generalized).""" def lum(x): r, g, b = (v / 255 for v in x) return 0.2126 * r + 0.7152 * g + 0.0722 * b if abs(lum(c) - lum(bg)) < 0.22: return tuple(int(a + (t - a) * 0.5) for a, t in zip(c, text)) return c def sync_fastfetch(tpl_path=None, out_path=None): """Render ~/.config/crossfetch/fastfetch.template.jsonc with the active theme's accents into ~/.config/fastfetch/config.jsonc. Returns 0/1.""" tpl = tpl_path or os.path.expanduser( "~/.config/crossfetch/fastfetch.template.jsonc") out = out_path or os.path.expanduser("~/.config/fastfetch/config.jsonc") try: with open(tpl, encoding="utf-8") as fh: text = fh.read() except OSError as e: print(f"crossfetch: cannot read template: {e}", file=sys.stderr) print(" expected at ~/.config/crossfetch/fastfetch.template.jsonc", file=sys.stderr) return 1 if ricefx is None: print("crossfetch: ricefx module missing", file=sys.stderr) return 1 acc = ricefx.ACCENTS[ricefx.theme()] bg = acc["base"] missing = [] # Structural roles are ALLOWED to sit close to the background (the bar # groove uses highlightMed precisely because it is dim) — only text-ish # roles get the legibility nudge. Without this exemption the rose-pine # round-trip would rewrite highlightMed and break byte-identity. neutral = {"base", "surface", "overlay", "highlightLow", "highlightMed", "highlightHigh"} def sub(m): name = m.group(1) c = acc.get(name) if c is None: missing.append(name) return m.group(0) if name not in neutral: c = _readable(c, bg, acc["text"]) return "38;2;%d;%d;%d" % c rendered = re.sub(r"\{\{(\w+)\}\}", sub, text) if missing: print(f"crossfetch: unknown roles in template: {sorted(set(missing))}", file=sys.stderr) return 1 tmp = out + ".tmp" with open(tmp, "w", encoding="utf-8") as fh: fh.write(rendered) os.replace(tmp, out) return 0 ``` Add the CLI branch in `main()` (next to `--logo`): ```python if args and args[0] == "--sync-fastfetch": sys.exit(sync_fastfetch()) ``` Document `--sync-fastfetch` in the docstring. - [ ] **Step 5: Run tests to verify they pass** Run: `python3 -m pytest ~/.config/crossfetch/tests -v` Expected: all PASS. The round-trip test is the important one — it proves switching back to rose-pine regenerates today's exact config. - [ ] **Step 6: Live run + eyeball** ```bash crossfetch --sync-fastfetch && fastfetch | head -20 RICEFX_THEME=tokyo-night crossfetch --sync-fastfetch && fastfetch | head -20 crossfetch --sync-fastfetch # back to rose-pine (RICEFX_THEME=dark default) ``` Expected: colors flip theme and back; no mangled JSONC (fastfetch parses it). - [ ] **Step 7: Snapshot + commit** ```bash cp ~/.local/bin/crossfetch ~/.config/crossfetch/bin/ cd ~/.config/crossfetch git add bin/crossfetch fastfetch.template.jsonc tests/test_sync_fastfetch.py git commit -m "feat: --sync-fastfetch renders themed fastfetch config from template" ``` --- ### Task 6: zsh — drop CROSS_BURST default, daily/theme-change regeneration **Files:** - Modify: `~/.dotfiles/config/animations.zsh` (~line 14 `CROSS_BURST` export; append regen block after the exports) **Interfaces:** - Consumes: `crossfetch --logo `, `crossfetch --sync-fastfetch` (Tasks 4-5); marker file `~/.local/state/crossfetch/last-render`. - Produces: on any interactive shell where date or `RICEFX_THEME` changed since last render, all six logo files + `config.jsonc` regenerate — season/theme tracking with zero manual steps. - [ ] **Step 1: Remove the burst-pair default** In `~/.dotfiles/config/animations.zsh`, change ```zsh export CROSS_BURST="${CROSS_BURST:-gold,iris}" # the two Rose Pine accents the # burst alternates between ``` to ```zsh # CROSS_BURST=gold,iris pins the burst pair; UNSET, crossfetch follows the # liturgical season (Advent purple, Lent purple, Eastertide gold...). ``` (Deliberately no export — a default here would permanently mask the season colors.) - [ ] **Step 2: Append the staleness block** (after the `_cross_fastfetch` function, before the startup-splash section ~line 115) ```zsh # Regenerate the fastfetch logos + themed config whenever the day or the # theme changed — keeps the static cross.txt tracking the liturgical season. _cross_regen() { local dir="$HOME/.local/state/crossfetch" local marker="$dir/last-render" local want="$(date +%F) ${RICEFX_THEME:-dark}" [[ "$(<$marker 2>/dev/null)" == "$want" ]] && return mkdir -p "$dir" local cf="$HOME/.local/bin/crossfetch" s [[ -x "$cf" ]] || return for s in chi orthodox jerusalem ichthys kali skull; do "$cf" --logo "$s" > "$HOME/.config/fastfetch/$s.txt" 2>/dev/null done "$cf" --logo > "$HOME/.config/fastfetch/cross.txt" 2>/dev/null "$cf" --sync-fastfetch 2>/dev/null print -r -- "$want" >| "$marker" 2>/dev/null } [[ -o interactive ]] && _cross_regen ``` - [ ] **Step 3: Test in a fresh shell** ```bash rm -f ~/.local/state/crossfetch/last-render zsh -ic 'echo shell-ok' 2>&1 | tail -1 cat ~/.local/state/crossfetch/last-render ls -la ~/.config/fastfetch/cross.txt # mtime = now zsh -ic 'echo second-ok' # marker current -> instant, no regen ``` Expected: `shell-ok`, marker holds today's date + theme, cross.txt fresh; second shell starts without regenerating (same mtime). - [ ] **Step 4: Commit in dotfiles** ```bash cd ~/.dotfiles git add config/animations.zsh git commit -m "feat: liturgical season default for burst; daily logo/config regen" ``` --- ### Task 7: Full verification sweep **Files:** none new. - [ ] **Step 1: Whole test suite** Run: `python3 -m pytest ~/.config/crossfetch/tests -v` Expected: every test PASS. - [ ] **Step 2: End-to-end scenario checks** ```bash # One-shot feast replay + state rm -f ~/.local/state/crossfetch/shown.json crossfetch --feast christmas # star + gold burst cat ~/.local/state/crossfetch/shown.json 2>/dev/null # --feast replay does NOT mark seen (expected: no file) # Theme sweep on the logo for t in dark tokyo-night gruvbox catppuccin-mocha nord dracula; do echo "== $t =="; RICEFX_THEME=$t crossfetch --logo | head -6 done # Kill switches CROSS_LITURGY=off crossfetch --logo | head -3 # poster rainbow CROSS_BURST=love,gold CROSS_TIMEOUT=2 crossfetch # explicit pair wins # Login path exec zsh # or open a new terminal: splash + fastfetch, season colors ``` Expected: all behave as labeled; terminal always restored. - [ ] **Step 3: Final commit + tag** ```bash cd ~/.config/crossfetch git add -A git commit -m "chore: crossfetch v2 complete — themes + liturgical year" --allow-empty git tag v2.0 ```